GithubHelp home page GithubHelp logo

libcod's Introduction

The Call of Duty extension libcod is adding new server-side functions to:

  • Call Of Duty 2 1.2
  • Call Of Duty 2 1.3
  • Call Of Duty 4 1.7

Requirements:

dpkg --add-architecture i386
apt-get update
apt-get install gcc-multilib
apt-get install libmysqlclient-dev:i386
apt-get install g++-multilib

Precompiled shared libraries: http://killtube.org/downloads/libcod/

Starting the server:

LD_PRELOAD=libcod2_1_3_nomysql.so ./cod2_lnxded +set fs_game ...

Some enviroments need LD_LIBRARY_PATH also:

LD_LIBRARY_PATH=. LD_PRELOAD=libcod2_1_3_nomysql.so ./cod2_lnxded +set fs_game ...

Working with the source / Compiling:

./doit.sh tar
./doit.sh base # compiles object files needed by every .so
./doit.sh cod1_1_5 # compiles object files for CoD 1 1.5 and linking them against base to the actual bin/libcod1_1_5.so
./doit.sh cod2_1_2
./doit.sh cod2_1_3
./doit.sh cod4_1_7
./doit.sh wrapper

Mods depending on libcod:

Little overview of added functions:

  • MySQL
  • setVelocity, getVelocity, addVelocity (needed for the mods: portal, surf)
  • keyPressed-functions for left, right, forward, backward, leanleft, leanright, jump etc., (needed for: surf, doublejump made by IzNoGod)
  • blazing fast astar-implementation (needed for: zombots)
  • setAlive-function (needed for: zombots, so xmodels are damagable without damage-trigger... zombots in stockmaps)
  • disableGlobalPlayerCollision()

Community / Help: http://killtube.org/forum.php

Porting libcod to a new Call Of Duty: find . -name '*.c*' | xargs grep -n _VERSION

libcod's People

Contributors

iznogod avatar kungfooman avatar m-itch avatar riicchhaarrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libcod's Issues

Compiler as variable in doit.sh

My patch (now you can easily switch between compilers)

Index: doit.sh
===================================================================
--- doit.sh (revision 3)
+++ doit.sh (working copy)
@@ -15,6 +15,7 @@

 #options="-I. -m32 -fPIC -fvisibility=hidden -O1"
 options="-I. -m32 -fPIC"
+compiler="gcc"

 #objects_tcc="build/gsc_tcc.opp /home/kung/tcc/tcc-0.9.25/libtcc.a"

@@ -44,15 +45,15 @@

 if [ "$1" == "" ] || [ "$1" == "base" ]; then
    echo "##### COMPILE GSC_ASTAR.CPP #####"
-   gcc $options -c gsc_astar.cpp -o objects_normal/gsc_astar.opp
+   $compiler $options -c gsc_astar.cpp -o objects_normal/gsc_astar.opp
    echo "##### COMPILE GSC_MYSQL.CPP #####"
-   gcc $options -c gsc_mysql.cpp -o objects_normal/gsc_mysql.opp -lmysqlclient -L/usr/lib/mysql
+   $compiler $options -c gsc_mysql.cpp -o objects_normal/gsc_mysql.opp -lmysqlclient -L/usr/lib/mysql
    echo "##### COMPILE SERVER.CPP #####"
-   gcc $options -c server.c -o objects_normal/server.opp -D SERVER_PORT=8000
+   $compiler $options -c server.c -o objects_normal/server.opp -D SERVER_PORT=8000
    echo "##### COMPILE GSC_MEMORY.CPP #####"
-   gcc $options -c gsc_memory.cpp -o objects_normal/gsc_memory.opp
+   $compiler $options -c gsc_memory.cpp -o objects_normal/gsc_memory.opp
    echo "##### COMPILE cracking.CPP #####"
-   gcc $options -c cracking.cpp -o objects_normal/cracking.opp
+   $compiler $options -c cracking.cpp -o objects_normal/cracking.opp
 fi

 if [ "$1" == "" ] || [ "$1" == "clean" ]; then
@@ -67,14 +68,14 @@
    mkdir -p objects_tcc

    echo "##### COMPILE gsc_tcc.cpp #####"
-   gcc $options -c gsc_tcc.cpp -o objects_tcc/gsc_tcc.opp
+   $compiler $options -c gsc_tcc.cpp -o objects_tcc/gsc_tcc.opp
 fi

 if [ "$1" == "" ] || [ "$1" == "car" ]; then
    mkdir -p objects_car

    echo "##### COMPILE GSC_CAR.CPP #####"
-   gcc $options -c gsc_car.cpp -o objects_car/gsc_car.opp -I/root/q3rally/q3rallysa/
+   $compiler $options -c gsc_car.cpp -o objects_car/gsc_car.opp -I/root/q3rally/q3rallysa/
 fi

 if [ "$1" == "" ] || [ "$1" == "cod2_1_3" ]; then
@@ -82,17 +83,17 @@

    mkdir -p objects_$1
    echo "##### COMPILE $1 LIBCOD.CPP #####"
-   gcc $options $constants -o objects_$1/libcod.opp -c libcod.cpp
+   $compiler $options $constants -o objects_$1/libcod.opp -c libcod.cpp
    echo "##### COMPILE $1 GSC.CPP #####"
-   gcc $options $constants -o objects_$1/gsc.opp -c gsc.cpp
+   $compiler $options $constants -o objects_$1/gsc.opp -c gsc.cpp
    echo "##### COMPILE $1 GSC_PLAYER.CPP #####"
-   gcc $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
+   $compiler $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
    echo "##### COMPILE $1 GSC_UTILS.CPP #####"
-   gcc $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp
+   $compiler $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp

    echo "##### LINK lib$1.so #####"
    objects="$(ls objects_normal/*.opp) $(ls objects_$1/*.opp)"
-   gcc -m32 -shared -L/lib32 $mysql_link -L./vendors/lib -o bin/lib$1.so $objects $objects_tcc -Os -s -ldl -Wall
+   $compiler -m32 -shared -L/lib32 $mysql_link -L./vendors/lib -o bin/lib$1.so $objects $objects_tcc -Os -s -ldl -Wall
 fi
 # -Xlinker --defsym -Xlinker stackStart=0x08297500 

@@ -101,17 +102,17 @@

    mkdir -p objects_$1
    echo "##### COMPILE $1 LIBCOD.CPP #####"
-   gcc $options $constants -o objects_$1/libcod.opp -c libcod.cpp
+   $compiler $options $constants -o objects_$1/libcod.opp -c libcod.cpp
    echo "##### COMPILE $1 GSC.CPP #####"
-   gcc $options $constants -o objects_$1/gsc.opp -c gsc.cpp
+   $compiler $options $constants -o objects_$1/gsc.opp -c gsc.cpp
    echo "##### COMPILE $1 GSC_PLAYER.CPP #####"
-   gcc $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
+   $compiler $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
    echo "##### COMPILE $1 GSC_UTILS.CPP #####"
-   gcc $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp
+   $compiler $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp

    echo "##### LINK lib$1.so #####"
    objects="$(ls objects_normal/*.opp) $(ls objects_$1/*.opp)"
-   gcc -m32 -shared -L/lib32 $mysql_link -L./vendors/lib -o bin/lib$1.so $objects $objects_tcc -Os -s -ldl -Wall
+   $compiler -m32 -shared -L/lib32 $mysql_link -L./vendors/lib -o bin/lib$1.so $objects $objects_tcc -Os -s -ldl -Wall
 fi


@@ -119,14 +120,14 @@
    constants="-D COD_VERSION=COD1_1_5"

    #echo "##### COMPILE CoD1 1.5 LIBCOD2.CPP #####"
-   #gcc $options $constants -c libcod2.cpp -o libcod2.opp
+   #$compiler $options $constants -c libcod2.cpp -o libcod2.opp
    echo "##### COMPILE CoD1 1.5 GSC.CPP #####"
-   gcc $options $constants -c gsc.cpp -o gsc.opp
+   $compiler $options $constants -c gsc.cpp -o gsc.opp
    #echo "##### COMPILE CoD1 1.5 GSC_PLAYER.CPP #####"
-   #gcc $options $constants -c gsc_player.cpp -o gsc_player.opp
+   #$compiler $options $constants -c gsc_player.cpp -o gsc_player.opp

    echo "##### LINK libcod1_1_5.so #####"
-   gcc -m32 -shared -L/lib32 -lmysqlclient -L./vendors/lib -o bin/libcod1_1_5.so libcod2.opp gsc.opp gsc_player.opp gsc_astar.opp gsc_mysql.opp server.opp gsc_memory.opp cracking.opp $objects_tcc -Os -s -ldl -Wall
+   $compiler -m32 -shared -L/lib32 -lmysqlclient -L./vendors/lib -o bin/libcod1_1_5.so libcod2.opp gsc.opp gsc_player.opp gsc_astar.opp gsc_mysql.opp server.opp gsc_memory.opp cracking.opp $objects_tcc -Os -s -ldl -Wall
 fi


@@ -135,17 +136,17 @@

    mkdir -p objects_$1
    echo "##### COMPILE $1 LIBCOD.CPP #####"
-   gcc $options $constants -o objects_$1/libcod.opp -c libcod.cpp
+   $compiler $options $constants -o objects_$1/libcod.opp -c libcod.cpp
    echo "##### COMPILE $1 GSC.CPP #####"
-   gcc $options $constants -o objects_$1/gsc.opp -c gsc.cpp
+   $compiler $options $constants -o objects_$1/gsc.opp -c gsc.cpp
    echo "##### COMPILE $1 GSC_PLAYER.CPP #####"
-   gcc $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
+   $compiler $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
    echo "##### COMPILE $1 GSC_UTILS.CPP #####"
-   gcc $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp
+   $compiler $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp

    echo "##### LINK lib$1.so #####"
    objects="$(ls objects_normal/*.opp) $(ls objects_$1/*.opp)"
-   gcc -m32 -shared -L/lib32 $mysql_link -L./vendors/lib -o bin/lib$1.so $objects $objects_tcc -Os -s -ldl -Wall
+   $compiler -m32 -shared -L/lib32 $mysql_link -L./vendors/lib -o bin/lib$1.so $objects $objects_tcc -Os -s -ldl -Wall
 fi


@@ -153,13 +154,13 @@
 if [ "$1" == "wrapper" ]; then
    echo "##### WRAPPER: COMPILE wrapper_libcod2.cpp #####"
    cp wrapper_libcod2.cpp a.cpp # just for name hiding in the .opp/.so -.-
-   gcc -m32 -fPIC -c a.cpp -o wrapper_libcod2.opp
+   $compiler -m32 -fPIC -c a.cpp -o wrapper_libcod2.opp

    #strip wrapper_libcod2.opp

    # make the shared lib for the wrapper
    echo "##### WRAPPER: LINK wrapper_libcod2.so #####"
-   gcc -m32 -shared -L/lib32 -o wrapper_libcod2.so wrapper_libcod2.opp
+   $compiler -m32 -shared -L/lib32 -o wrapper_libcod2.so wrapper_libcod2.opp


    cp wrapper_libcod2.so bin/libcod2.so

Compile for COD 1.5

Hi Kungfooman,

i can not compile the shared libary for Call of Duty 1 1.5, all other versions work.

##### COMPILE CoD1 1.5 GSC.CPP #####
In file included from gsc.hpp:48:0,
                 from gsc.cpp:1:
functions.hpp:20:4: warning: #warning trap_Argc() return *(int *)NULL; [-Wcpp]
   #warning trap_Argc() return *(int *)NULL;
    ^~~~~~~
functions.hpp:33:3: warning: #warning static Cmd_Argv_t Cmd_Argv = (Cmd_Argv_t)NULL; [-Wcpp]
  #warning static Cmd_Argv_t Cmd_Argv = (Cmd_Argv_t)NULL;
   ^~~~~~~
functions.hpp:47:3: warning: #warning static trap_Argv_t trap_Argv = (trap_Argv_t)NULL; [-Wcpp]
  #warning static trap_Argv_t trap_Argv = (trap_Argv_t)NULL;
   ^~~~~~~
functions.hpp:70:3: warning: #warning static Com_Printf_t Com_Printf = (Com_Printf_t)NULL; [-Wcpp]
  #warning static Com_Printf_t Com_Printf = (Com_Printf_t)NULL;
   ^~~~~~~
functions.hpp:71:3: warning: #warning static Com_DPrintf_t Com_DPrintf =
(Com_DPrintf_t)NULL; [-Wcpp]
  #warning static Com_DPrintf_t Com_DPrintf = (Com_DPrintf_t)NULL;
   ^~~~~~~
functions.hpp:92:3: warning: #warning Cmd_ExecuteString_t Cmd_ExecuteString = NULL; [-Wcpp]
  #warning Cmd_ExecuteString_t Cmd_ExecuteString = NULL;
   ^~~~~~~
functions.hpp:112:3: warning: #warning static ClientCommand_t ClientCommand = (ClientCommand_t)NULL; [-Wcpp]
  #warning static ClientCommand_t ClientCommand = (ClientCommand_t)NULL;
   ^~~~~~~
functions.hpp:113:3: warning: #warning static int hook_ClientCommand_call = NULL; [-Wcpp]
  #warning static int hook_ClientCommand_call = NULL;
   ^~~~~~~
functions.hpp:130:3: warning: #warning static Cvar_VariableValue_t CvarVariableValue = NULL; [-Wcpp]
  #warning static Cvar_VariableValue_t CvarVariableValue = NULL;
   ^~~~~~~
functions.hpp:142:3: warning: #warning static Cvar_VariableValue_t CvarVariableValue = NULL; [-Wcpp]
  #warning static Cvar_VariableValue_t CvarVariableValue = NULL;
   ^~~~~~~
functions.hpp:154:3: warning: #warning static FS_ReadFile_t FS_ReadFile = NULL; [-Wcpp]
  #warning static FS_ReadFile_t FS_ReadFile = NULL;
   ^~~~~~~
functions.hpp:167:3: warning: #warning static FS_LoadDir_t FS_LoadDir = NULL; [-Wcpp]
  #warning static FS_LoadDir_t FS_LoadDir = NULL;
   ^~~~~~~
functions.hpp:178:3: warning: #warning static int rconPasswordAddress = NULL; [-Wcpp]
  #warning static int rconPasswordAddress = NULL;
   ^~~~~~~
functions.hpp:189:3: warning: #warning static int hook_findMap_call = NULL; [-Wcpp]
  #warning static int hook_findMap_call = NULL;
   ^~~~~~~
functions.hpp:200:3: warning: #warning static int hook_AuthorizeState_call = NULL; [-Wcpp]
  #warning static int hook_AuthorizeState_call = NULL;
   ^~~~~~~
functions.hpp:238:3: warning: #warning static SV_ConnectionlessPacket_t SV_ConnectionlessPacket = NULL; [-Wcpp]
  #warning static SV_ConnectionlessPacket_t SV_ConnectionlessPacket = NULL;
   ^~~~~~~
functions.hpp:250:3: warning: #warning NET_OutOfBandPrint_t NET_OutOfBandPrint = NULL; [-Wcpp]
  #warning NET_OutOfBandPrint_t NET_OutOfBandPrint =  NULL;
   ^~~~~~~
functions.hpp:262:3: warning: #warning SV_FlushRedirect_t SV_FlushRedirect = NULL; [-Wcpp]
  #warning SV_FlushRedirect_t SV_FlushRedirect = NULL;
   ^~~~~~~
functions.hpp:274:3: warning: #warning static SV_GameSendServerCommand_t
SV_GameSendServerCommand = NULL; [-Wcpp]
  #warning static SV_GameSendServerCommand_t SV_GameSendServerCommand = NULL;
   ^~~~~~~
functions.hpp:286:3: warning: #warning SV_DropClient_t SV_DropClient = (SV_DropClient_t)NULL; [-Wcpp]
  #warning SV_DropClient_t SV_DropClient = (SV_DropClient_t)NULL;
   ^~~~~~~
functions.hpp:298:3: warning: #warning static SV_WriteDownloadToClient_t
SV_WriteDownloadToClient = (SV_WriteDownloadToClient_t)NULL; [-Wcpp]
  #warning static SV_WriteDownloadToClient_t SV_WriteDownloadToClient = (SV_WriteDownloadToClient_t)NULL;
   ^~~~~~~
functions.hpp:313:3: warning: #warning ClientUserinfoChanged_t changeClientUserinfo = (ClientUserinfoChanged_t)NULL; [-Wcpp]
  #warning ClientUserinfoChanged_t changeClientUserinfo = (ClientUserinfoChanged_t)NULL;
   ^~~~~~~
functions.hpp:325:3: warning: #warning Info_SetValueForKey_t Info_SetValueForKey = (Info_SetValueForKey_t)NULL; [-Wcpp]
  #warning Info_SetValueForKey_t Info_SetValueForKey = (Info_SetValueForKey_t)NULL;
   ^~~~~~~
functions.hpp:337:3: warning: #warning Info_ValueForKey_t Info_ValueForKey = (Info_ValueForKey_t)NULL; [-Wcpp]
  #warning Info_ValueForKey_t Info_ValueForKey = (Info_ValueForKey_t)NULL;
   ^~~~~~~
In file included from gsc.hpp:48:0,
                 from gsc.cpp:1:
functions.hpp:351:3: warning: #warning static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)NULL; [-Wcpp]
  #warning static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)NULL;
   ^~~~~~~
functions.hpp:367:3: warning: #warning static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)NULL; [-Wcpp]
  #warning static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)NULL;
   ^~~~~~~
gsc.cpp:54:3: warning: #warning Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)NULL; [-Wcpp]
  #warning Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)NULL;
   ^~~~~~~
gsc.cpp:55:3: warning: #warning Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)NULL; [-Wcpp]
  #warning Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)NULL;
   ^~~~~~~
gsc.cpp:795:5: warning: #warning int stackPushInt(int ret) [-Wcpp]
    #warning int stackPushInt(int ret)
     ^~~~~~~
gsc.cpp:882:4: warning: #warning int stackPushFloat(float ret) *((int *)(&signature)) = NULL; [-Wcpp]
   #warning int stackPushFloat(float ret) *((int *)(&signature)) = NULL;
    ^~~~~~~
gsc.cpp:903:4: warning: #warning int stackPushString(char *toPush) *((int *)(&signature)) = NULL; [-Wcpp]
   #warning int stackPushString(char *toPush) *((int *)(&signature)) = NULL;
    ^~~~~~~
gsc.cpp:922:4: warning: #warning int stackPushEntity(int arg) *((int *)(&signature)) = NULL; [-Wcpp]
   #warning int stackPushEntity(int arg) *((int *)(&signature)) = NULL;
    ^~~~~~~
gsc.cpp:951:4: warning: #warning int stackPushArray() *((int *)(&signature)) = NULL; [-Wcpp]
   #warning int stackPushArray() *((int *)(&signature)) = NULL;
    ^~~~~~~
gsc.cpp:979:4: warning: #warning int stackPushArrayLast() *((int *)(&signature)) = NULL; [-Wcpp]
   #warning int stackPushArrayLast() *((int *)(&signature)) = NULL;
    ^~~~~~~
gsc.cpp: In function ‘int cdecl_injected_closer()’:
gsc.cpp:1819:3: warning: typedef ‘aSearchPath’ locally defined but not used [-Wunused-local-typedefs]
 } aSearchPath;
   ^~~~~~~~~~~
##### LINK libcod1_1_5.so #####
gcc: error: libcod2.opp: No such file or directory
gcc: error: gsc_player.opp: No such file or directory
gcc: error: gsc_astar.opp: No such file or directory
gcc: error: gsc_mysql.opp: No such file or directory
gcc: error: server.opp: No such file or directory
gcc: error: gsc_memory.opp: No such file or directory
gcc: error: cracking.opp: No such file or directory

can you give me an hint how to compile for 1.5? And will this work for CODUO 1.51 too?

Greets

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.