E.g. take a look at the function gsc_player_button_right() in gsc_player.cpp:
https://github.com/kungfooman/libcod...gsc_player.cpp
PHP Code:
#if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26FD);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FA7);
#else
#warning unsigned char *aim_address = (unsigned char *)(NULL);
unsigned char *aim_address = (unsigned char *)(NULL);
#endif
This will support CoD2 1.2, 1.3 and CoD4 1.7
Since 1.2 and 1.3 got the same address, it might be also the same for 1.0, but I don't do much with 1.0 to check that.
The code is dependent on the CoD version, because every binary is always recompiled, thus changing the hardcoded addresses.
Since the code is open source: you are young and intelligent, add those addresses and make libcod more portable. You only need IDA Pro 5.5 with Decompiler (F5), and the memory viewer
http://dbg.killtube.org/libcod/memoryshell.zip :D