PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Gladiator bot port.

I got it to compile with no problems finally, but i get lots of unresolved externals when linking. I looked at dans game project source and relised theres no game.def to export functions how do i do this in ce? That is why id get unresolved externals right?

Also i excpect this first file to have lots of bugs in it do to gladiator using io.h for file access i just // it all out im going to need like some type of ce functions and structures that do the same thing so if anyone knows anything there it may be helpfull.
Post a portion of the linker errors so we can determine what's missing.

If it uses io functions for File IO, then you will either need to find / make your own version of that lib, or replace the file io calls with stdio functions. Someone was working on a replacement io lib here on these forums, so I don't know if that is available or not. I created an io lib for Bochs, but I'm not going to release it for a bit.

Dan East
Linking...
Creating library MIPSDbg/Gladiator.lib and object MIPSDbg/Gladiator.exp
q_shared.obj : error LNK2019: unresolved external symbol strcasecmp referenced in function Q_stricmp
bl_botcfg.obj : error LNK2019: unresolved external symbol stricmp referenced in function AddBotToList
bl_spawn.obj : error LNK2019: unresolved external symbol stricmp referenced in function SP_bot
g_ctf.obj : error LNK2001: unresolved external symbol stricmp
p_weapon.obj : error LNK2019: unresolved external symbol stricmp referenced in function NoAmmoWeaponChange
bl_main.obj : error LNK2019: unresolved external symbol access referenced in function BotUseLibrary
g_main.obj : error LNK2019: unresolved external symbol strdup referenced in function EndDMLevel
g_misc.obj : error LNK2019: unresolved external symbol time referenced in function func_clock_think
g_misc.obj : error LNK2019: unresolved external symbol localtime referenced in function func_clock_think
g_spawn.obj : error LNK2019: unresolved external symbol EDICT_NUM referenced in function SpawnEntities
g_spawn.obj : error LNK2019: unresolved external symbol Com_DPrintf referenced in function SpawnEntities
MIPSDbg/Gladiator.dll : fatal error LNK1120: 8 unresolved externals
Error executing link.exe.

Gladiator.dll - 12 error(s), 0 warning(s)
just tell me if these arent exporting or compiler problems if there still code problems all go figure it out.
Replace calls to strcasecmp and stricmp with _stricmp.

For strdup use _strdup.

Access is being used either to see if a file exists, or to make sure it can be written to or read. You can just try opening the file with fopen with the appopriate read or write permission to see if that type of access is allowed on that file or if the file even exists.

Time might be a little tricky. It is most certainly only being used to determine the number of milliseconds that have elapsed over a certain time period. You can use GetTickCount to do that instead:
Code:

DWORD startTime=GetTickCount();

//Do some stuff

DWORD elapsedMS=GetTickCount()-startTime;
//'elapsedMS' milliseconds elapsed while doing some stuff.


I don't know why Com_DPrintf is being called. That should only be accessible from within the EXE.

I also don't know why localtime would be used. Again, if it is for timing purposes, you can use GetTickCount.

EDICT_NUM is just a macro which is not getting defined:
Code:
#define EDICT_NUM(n) ((edict_t *)((byte *)ge->edicts + ge->edict_size*(n)))


Dan East
thanks alot that was pretty good help. :)
Im unclear on something i had to replace all the calls to stricmp with _stricmp also. But i looked in msdn and there was no stricmp function without the _, also ive always wondered why do they put underscores in front of functions anyway?
heh ok i cant figure out where that define for EDICT_NUM goes i put it in q_shared.h becuase it seamed like a logical place but im getting an error when g_spwan is called the error is ge is an undeclared identifier. I searched through the originall port of the game project but didnt see it defined in there and notice it was called the same way in g_spwan.
heh im not at home right now but maybe the problem is the file containg g_spawn doesnt also include q_shared.h although i doubt that since q-shared is included in like everything. Dan where do you have that define at?
It's defined in one of the Quake II C source files. I don't have access to it at the moment - just do a search of the source code files for it.

Dan East
Hmm i found out it is defined in the server project, strange. Anyways i have given up on gladiator for now its to complicated for me to port considering how much i suck at C and porting. But i have found i nice simple bot called Famkebot wich may be a nice bot to port since it doesnt have bot loading with files and all kinds of stuff like that i figure i or others can always imporve on it after the orginal source is ported. :)
Pewww ok i have a bot ported it compiles fine but for some reason pq2 doesnt seam to load the custom dll. I noticed you changed the project name to game.dll wich didnt seam to work, i also tried gamex86.dll wich didnt seam to work. I added a simple console command to call a gi.bprintf and it just kept saying it as chat text when i tried to run the command. I know that the console command i added was 100% right and the one to add bots is right. The only thing i can think of is quake wont switch dll files from its original. Do you think this is a possibility?