diff --git a/.gitignore b/.gitignore index 5ebd21a..b0158a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +################# +## Kdevelop 4.X +################# +.kdev4/ +rpgxEF.kdev4 + ################# ## Eclipse ################# diff --git a/Makefile b/Makefile index 5b9b5f3..0a64d07 100644 --- a/Makefile +++ b/Makefile @@ -385,14 +385,13 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) SHLIBEXT=so SHLIBCFLAGS=-fPIC -fvisibility=hidden SHLIBLDFLAGS=-shared $(LDFLAGS) -pthread - + ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif THREAD_LIBS=-lpthread LIBS=-ldl -lm - LIBS += -L/emul/linux/x86/usr/lib CLIENT_LIBS=$(SDL_LIBS) RENDERER_LIBS = $(SDL_LIBS) -lGL @@ -445,7 +444,7 @@ ifeq ($(PLATFORM),darwin) CLIENT_LIBS= RENDERER_LIBS= OPTIMIZEVM= - + BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes ifeq ($(ARCH),ppc) @@ -508,7 +507,7 @@ ifeq ($(PLATFORM),darwin) SHLIBEXT=dylib SHLIBCFLAGS=-fPIC -fno-common SHLIBLDFLAGS=-dynamiclib $(LDFLAGS) -Wl,-U,_com_altivec -pthread - + ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif @@ -549,7 +548,7 @@ ifeq ($(PLATFORM),mingw32) CLIENT_LDFLAGS += $(OPENAL_LDFLAGS) endif endif - + ifeq ($(USE_CODEC_MP3),1) BASE_CFLAGS += -DUSE_CODEC_MP3 CLIENT_LIBS += -lmad @@ -573,7 +572,7 @@ ifeq ($(PLATFORM),mingw32) SHLIBEXT=dll SHLIBCFLAGS= SHLIBLDFLAGS=-shared $(LDFLAGS) - + ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif @@ -584,7 +583,7 @@ ifeq ($(PLATFORM),mingw32) CLIENT_LDFLAGS += -mwindows CLIENT_LIBS = -lgdi32 -lole32 RENDERER_LIBS = -lgdi32 -lole32 -lopengl32 - + ifeq ($(USE_CURL),1) CLIENT_CFLAGS += $(CURL_CFLAGS) ifneq ($(USE_CURL_DLOPEN),1) @@ -623,7 +622,7 @@ ifeq ($(PLATFORM),mingw32) # libmingw32 must be linked before libSDLmain CLIENT_LIBS += -lmingw32 RENDERER_LIBS += -lmingw32 - + ifeq ($(USE_LOCAL_HEADERS),1) CLIENT_CFLAGS += -I$(SDLHDIR)/include ifeq ($(ARCH), x86) @@ -666,7 +665,7 @@ ifeq ($(PLATFORM),freebsd) SHLIBEXT=so SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) -lpthread - + ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif @@ -742,7 +741,7 @@ ifeq ($(PLATFORM),openbsd) ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif - + THREAD_LIBS=-pthread LIBS=-lm @@ -761,7 +760,7 @@ ifeq ($(PLATFORM),openbsd) CLIENT_LIBS += -lvorbisfile -lvorbis -logg endif - ifeq ($(USE_CURL),1) + ifeq ($(USE_CURL),1) ifneq ($(USE_CURL_DLOPEN),1) CLIENT_LIBS += -lcurl endif @@ -784,7 +783,7 @@ ifeq ($(PLATFORM),netbsd) SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) -lpthread THREAD_LIBS=-lpthread - + ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif @@ -814,7 +813,7 @@ ifeq ($(PLATFORM),irix64) -I. -I$(ROOT)/usr/include CLIENT_CFLAGS += $(SDL_CFLAGS) OPTIMIZE = -O3 - + SHLIBEXT=so SHLIBCFLAGS= SHLIBLDFLAGS=-shared -lptrhead @@ -822,7 +821,7 @@ ifeq ($(PLATFORM),irix64) ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif - + LIBS=-ldl -lm -lgen # FIXME: The X libraries probably aren't necessary? CLIENT_LIBS=-L/usr/X11/$(LIB) $(SDL_LIBS) \ @@ -876,7 +875,7 @@ ifeq ($(PLATFORM),sunos) CLIENT_LDFLAGS += -L/usr/X11/lib/NVIDIA -R/usr/X11/lib/NVIDIA endif endif - + OPTIMIZE = $(OPTIMIZEVM) -ffast-math SHLIBEXT=so @@ -886,7 +885,7 @@ ifeq ($(PLATFORM),sunos) ifeq ($(VM_USE_SQL), 1) SHLIBCFLAGS+=-DSQL endif - + THREAD_LIBS=-lpthread LIBS=-lsocket -lnsl -ldl -lm @@ -1576,7 +1575,7 @@ Q3ROBJ = \ $(B)/renderer/tr_world.o \ \ $(B)/renderer/sdl_gamma.o - + ifneq ($(USE_RENDERER_DLOPEN), 0) Q3ROBJ += \ $(B)/renderer/q_shared.o \ @@ -1921,22 +1920,22 @@ ifeq ($(ARCH),x86) Q3DOBJ += \ $(B)/ded/matha.o \ $(B)/ded/snapvector.o \ - $(B)/ded/ftola.o + $(B)/ded/ftola.o endif ifeq ($(ARCH),x86_64) Q3DOBJ += \ $(B)/ded/snapvector.o \ - $(B)/ded/ftola.o + $(B)/ded/ftola.o endif ifeq ($(ARCH),amd64) Q3DOBJ += \ $(B)/ded/snapvector.o \ - $(B)/ded/ftola.o + $(B)/ded/ftola.o endif ifeq ($(ARCH),x64) Q3DOBJ += \ $(B)/ded/snapvector.o \ - $(B)/ded/ftola.o + $(B)/ded/ftola.o endif ifeq ($(USE_INTERNAL_ZLIB),1) @@ -2521,12 +2520,12 @@ endif $(B)/$(BASEGAME)/cgame/bg_%.o: $(GDIR)/bg_%.c $(DO_CGAME_CC) - + $(B)/$(BASEGAME)/cgame/l%.o: $(GDIR)/l%.c - $(DO_CGAME_CC) - + $(DO_CGAME_CC) + $(B)/$(BASEGAME)/cgame/q_%.o: $(GDIR)/q_%.c - $(DO_CGAME_CC) + $(DO_CGAME_CC) $(B)/$(BASEGAME)/cgame/%.o: $(CGDIR)/%.c $(DO_CGAME_CC) @@ -2570,7 +2569,7 @@ $(B)/$(BASEGAME)/ui/bg_%.o: $(GDIR)/bg_%.c $(B)/$(BASEGAME)/ui/q_%.o: $(GDIR)/q_%.c $(DO_UI_CC) - + $(B)/$(BASEGAME)/ui/%.o: $(Q3UIDIR)/%.c $(DO_UI_CC) diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index b361d93..c738ec1 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -36,7 +36,7 @@ This is the only way control passes into the module. This must be the very first function compiled into the .q3vm file ================ */ -int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) { +Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) { switch ( command ) { case CG_INIT: CG_Init( arg0, arg1 ); @@ -306,11 +306,11 @@ static cvarTable_t cvarTable[] = { { &cg_thirdPersonZoomRate, "cg_thirdPersonZoomRate", "25", CVAR_ARCHIVE }, { &cg_showEntityNums, "cg_showEntityNums", "1", CVAR_ARCHIVE }, - + //TiM - security cvars { &sv_securityHash, "sv_securityHash", "4294967295", CVAR_ARCHIVE | CVAR_ROM | CVAR_NORESTART }, - { &sv_securityCode, "sv_securityCode", "4294967295", CVAR_ARCHIVE | CVAR_USERINFO | CVAR_ROM | CVAR_NORESTART }, - + { &sv_securityCode, "sv_securityCode", "4294967295", CVAR_ARCHIVE | CVAR_USERINFO | CVAR_ROM | CVAR_NORESTART }, + { &cg_handleWidescreen, "cg_handleWidescreen", "1", CVAR_ARCHIVE }, { &ui_handleWidescreen, "ui_handleWidescreen", "1", CVAR_ARCHIVE }, @@ -347,7 +347,7 @@ void CG_PrecacheRemapShaders(void) { qhandle_t shader; COM_StripExtension(cgs.mapname, filepath); - Com_sprintf(filepath, MAX_QPATH, "%s.precache", filepath); + Com_sprintf(filepath, MAX_QPATH, "%s.precache", filepath); len = trap_FS_FOpenFile(filepath, &f, FS_READ); @@ -574,7 +574,7 @@ static void CG_RegisterItemSounds( int itemNum ) { len = s-start; if (len >= MAX_QPATH || len < 5) { - CG_Error( "PrecacheItem: %s has bad precache string", + CG_Error( "PrecacheItem: %s has bad precache string", item->classname); return; } @@ -709,8 +709,8 @@ static void CG_RegisterSounds( void ) cgs.media.glassChunkSound = trap_S_RegisterSound( "sound/weapons/explosions/glassbreak1.wav" ); cgs.media.woodChunkSound = trap_S_RegisterSound( "sound/weapons/explosions/metalexplode.wav" ); cgs.media.stoneChunkSound = trap_S_RegisterSound( "sound/weapons/explosions/metalexplode.wav" ); - - // trek sounds + + // trek sounds //TiM : Q flash cgs.media.qFlash = trap_S_RegisterSound( "sound/world/q_flash.wav" ); @@ -872,13 +872,13 @@ static void CG_RegisterGraphics( void ) { cgs.media.weaponPlaceholderShader = trap_R_RegisterShader("powerups/placeholder" ); cgs.media.rezOutShader = trap_R_RegisterShader("powerups/rezout"); cgs.media.electricBodyShader = trap_R_RegisterShader("gfx/misc/electric"); - + //RPG-X: RedTechie - Scoreboard Endcaps cgs.media.scoreboardtopleft = trap_R_RegisterShaderNoMip( "menu/common/rpgx_sb_topleft"); cgs.media.scoreboardtopright = trap_R_RegisterShaderNoMip( "menu/common/rpgx_sb_topright"); cgs.media.scoreboardbotleft = trap_R_RegisterShaderNoMip( "menu/common/rpgx_sb_bottomleft"); cgs.media.scoreboardbotright = trap_R_RegisterShaderNoMip( "menu/common/rpgx_sb_bottomright"); - + //RPG-X: RedTechie - Healthbar Curves cgs.media.healthendcap = trap_R_RegisterShaderNoMip("gfx/interface/rpgx_healthbar_endcap"); cgs.media.healthbigcurve = trap_R_RegisterShaderNoMip("gfx/interface/rpgx_healthbar_leftcorner"); @@ -1064,7 +1064,7 @@ static void CG_RegisterGraphics( void ) { if ( cg_dynamiclensflares.integer ) { cgs.media.flareCore = trap_R_RegisterShaderNoMip("gfx/effects/flares/flare_core"); cgs.media.flareStreak = trap_R_RegisterShaderNoMip("gfx/effects/flares/flare_streak"); - cgs.media.flareHaze = trap_R_RegisterShaderNoMip("gfx/effects/flares/flare_haze"); + cgs.media.flareHaze = trap_R_RegisterShaderNoMip("gfx/effects/flares/flare_haze"); for ( i=0; i<10; i++ ) { lensReflec[i].graphic = trap_R_RegisterShaderNoMip( lensReflec[i].file ); @@ -1236,7 +1236,7 @@ void CG_Init( int serverMessageNum, int serverCommandSequence ) { cgs.screenYScale = cgs.glconfig.vidHeight / 480.0; //TiM - handle wide screens - if ( cgs.glconfig.vidWidth * 480 > cgs.glconfig.vidHeight * 640 ) + if ( cgs.glconfig.vidWidth * 480 > cgs.glconfig.vidHeight * 640 ) { cgs.widescreen.ratio = 640.0f*cgs.screenYScale * (1.0f/cgs.glconfig.vidWidth); cgs.widescreen.bias = 0.5 * ( cgs.glconfig.vidWidth - ( cgs.glconfig.vidHeight * (640.0/480.0) ) ); @@ -1293,11 +1293,11 @@ void CG_Init( int serverMessageNum, int serverCommandSequence ) { CG_LoadingString( "" ); //RPG-X | GSIO01 | 08/05/09: - //Make sure all weapons are registered to prevent + //Make sure all weapons are registered to prevent //missing models when someone get killed and weapons are dropped for(i = 0; i < WP_NUM_WEAPONS; i++) { CG_RegisterWeapon(i); - } + } // To get the interface timing started cg.interfaceStartupTime = 0; @@ -1305,12 +1305,12 @@ void CG_Init( int serverMessageNum, int serverCommandSequence ) { CG_InitModRules(); - if ( !CG_LoadCrosshairs() ) + if ( !CG_LoadCrosshairs() ) { CG_Error( "Couldn't load crosshairs script" ); } - if ( !CG_LoadRanks() ) + if ( !CG_LoadRanks() ) { CG_Error( "Couldn't load rankset script: %s", cgs.rankSet ); } @@ -1364,7 +1364,7 @@ void CG_ParseIngameText(void) buffer = ingameText; i = 1; // Zero is null string - while ( buffer ) + while ( buffer ) { token = COM_ParseExt( &buffer, qtrue ); @@ -1442,7 +1442,7 @@ void CG_LoadIngameText(void) len = trap_FS_FOpenFile( fileName, &f, FS_READ ); - if ( !f ) + if ( !f ) { Com_Printf( S_COLOR_RED "CG_LoadIngameText : mp_ingametext.dat file not found!\n"); return; @@ -1455,7 +1455,7 @@ void CG_LoadIngameText(void) } // initialise the data area - memset(ingameText, 0, sizeof(ingameText)); + memset(ingameText, 0, sizeof(ingameText)); trap_FS_Read( ingameText, len, f ); @@ -1498,7 +1498,7 @@ void CG_LoadObjectivesForMap(void) buf = objtext; //Now parse out each objective - while ( 1 ) + while ( 1 ) { token = COM_ParseExt( &buf, qtrue ); if ( !token[0] ) { @@ -1506,7 +1506,7 @@ void CG_LoadObjectivesForMap(void) } // Normal objective text - if ( !Q_strncmp( token, "obj", 3 ) ) + if ( !Q_strncmp( token, "obj", 3 ) ) { objnum = atoi( &token[3] ); @@ -1520,11 +1520,11 @@ void CG_LoadObjectivesForMap(void) Q_strncpyz( cgs.objectives[objnum-1].text, token, sizeof(cgs.objectives[objnum-1].text) ); } - else if ( !Q_strncmp( token, "abridged_obj", 12 ) ) + else if ( !Q_strncmp( token, "abridged_obj", 12 ) ) { objnum = atoi( &token[12] ); - if ( objnum < 1 || objnum == MAX_OBJECTIVES ) + if ( objnum < 1 || objnum == MAX_OBJECTIVES ) { Com_Printf( "Invalid objective number (%d), valid range is 1 to %d\n", objnum, MAX_OBJECTIVES ); break; @@ -1559,7 +1559,7 @@ qboolean CG_LoadClasses( void ) CG_Printf( S_COLOR_RED "Couldn't find class file: %s\n", filePath ); return qfalse; } - + if ( file_len > sizeof( buffer ) ) { CG_Printf( S_COLOR_RED "File %s was way too big to be loaded.\n", filePath ); @@ -1598,14 +1598,14 @@ qboolean CG_LoadClasses( void ) while ( 1 ) { token = COM_Parse( &textPtr ); - + if (!token[0]) { break; } - if ( !Q_stricmpn( token, "formalName", 10 ) ) + if ( !Q_stricmpn( token, "formalName", 10 ) ) { - if ( COM_ParseString( &textPtr, &token ) ) + if ( COM_ParseString( &textPtr, &token ) ) { CG_Printf( S_COLOR_RED "ERROR: Invalid class formal name in class index: %i.\n", numClasses ); continue; @@ -1615,17 +1615,17 @@ qboolean CG_LoadClasses( void ) continue; } - if ( !Q_stricmpn( token, "radarColor", 5 ) ) + if ( !Q_stricmpn( token, "radarColor", 5 ) ) { vec3_t temp; - if ( COM_ParseVec3( &textPtr, temp ) ) + if ( COM_ParseVec3( &textPtr, temp ) ) { CG_Printf( S_COLOR_RED "ERROR: Invalid color values in class index: %i.\n", numClasses ); continue; } - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; i++ ) { cgs.classData[numClasses].radarColor[i] = (int)Com_Clamp( 0, 255, (int)temp[i] ); } @@ -1633,9 +1633,9 @@ qboolean CG_LoadClasses( void ) continue; } - if ( !Q_stricmpn( token, "iconColor", 9 ) ) + if ( !Q_stricmpn( token, "iconColor", 9 ) ) { - if ( COM_ParseString( &textPtr, &token ) ) + if ( COM_ParseString( &textPtr, &token ) ) { CG_Printf( S_COLOR_RED "ERROR: Invalid class icon color in class index: %i.\n", numClasses ); continue; @@ -1643,23 +1643,23 @@ qboolean CG_LoadClasses( void ) //Eh... there are enum values for these, //but they're currently out of scope ;P - if ( !Q_stricmp( token, "red" ) ) + if ( !Q_stricmp( token, "red" ) ) { cgs.classData[numClasses].iconColor = 1; //CLR_RED } - else if ( !Q_stricmp( token, "gold" ) ) + else if ( !Q_stricmp( token, "gold" ) ) { cgs.classData[numClasses].iconColor = 2; //CLR_GOLD } - else if ( !Q_stricmp( token, "teal" ) ) + else if ( !Q_stricmp( token, "teal" ) ) { cgs.classData[numClasses].iconColor = 3; //CLR_TEAL } - else if ( !Q_stricmp( token, "green" ) ) + else if ( !Q_stricmp( token, "green" ) ) { cgs.classData[numClasses].iconColor = 4; //CLR_GREEN } - else + else { cgs.classData[numClasses].iconColor = 0; //0 } @@ -1667,9 +1667,9 @@ qboolean CG_LoadClasses( void ) continue; } - if ( !Q_stricmpn( token, "medical", 7 ) ) + if ( !Q_stricmpn( token, "medical", 7 ) ) { - if ( COM_ParseInt( &textPtr, (int *)&cgs.classData[numClasses].isMedic ) ) + if ( COM_ParseInt( &textPtr, (int *)&cgs.classData[numClasses].isMedic ) ) { CG_Printf( S_COLOR_RED "ERROR: Class medic check for class %i was invalid.\n", numClasses ); continue; @@ -1688,9 +1688,9 @@ qboolean CG_LoadClasses( void ) continue; } - if ( !Q_stricmpn( token, "hasRanks", 8 ) ) + if ( !Q_stricmpn( token, "hasRanks", 8 ) ) { - if ( COM_ParseInt( &textPtr, (int *)&cgs.classData[numClasses].showRanks ) ) + if ( COM_ParseInt( &textPtr, (int *)&cgs.classData[numClasses].showRanks ) ) { CG_Printf( S_COLOR_RED "ERROR: Class Ranks check for class %i was invalid.\n", numClasses ); continue; @@ -1702,13 +1702,13 @@ qboolean CG_LoadClasses( void ) //I'm a n00b lol. I made a class called 'medical' and a parameter called 'medical'. //I have to double check both parms or else it confuses the parser //better check all of them. I'm still getting errors - if ( !Q_stricmpn( token, "consoleName", 10 ) - || !Q_stricmpn( token, "modelSkin", 9 ) + if ( !Q_stricmpn( token, "consoleName", 10 ) + || !Q_stricmpn( token, "modelSkin", 9 ) || !Q_stricmpn( token, "message", 7 ) || !Q_stricmpn( token, "admin", 5 ) || !Q_stricmpn( token, "marine", 6 ) || !Q_stricmpn( token, "noShow", 6 ) - ) + ) { SkipRestOfLine(&textPtr); continue; @@ -1721,7 +1721,7 @@ qboolean CG_LoadClasses( void ) continue; } - if ( !Q_stricmpn( token, "}", 1 ) ) + if ( !Q_stricmpn( token, "}", 1 ) ) { numClasses++; break; @@ -1730,8 +1730,8 @@ qboolean CG_LoadClasses( void ) } token = COM_Parse( &textPtr ); - - if (!token[0]) + + if (!token[0]) { break; } @@ -1786,7 +1786,7 @@ qboolean CG_LoadUsablesStrings( void ) buffer[file_len] = '0'; trap_FS_FCloseFile( f ); - + if ( !buffer[0] ) { CG_Printf( S_COLOR_RED "ERROR: Attempted to load %s, but no data was inside!\n", fileRoute ); diff --git a/code/cgame/cg_syscalls.c b/code/cgame/cg_syscalls.c index 72c028c..3d90ec5 100644 --- a/code/cgame/cg_syscalls.c +++ b/code/cgame/cg_syscalls.c @@ -10,7 +10,7 @@ static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1; -void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { +Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { syscall = syscallptr; } @@ -37,7 +37,7 @@ void trap_Error( const char *fmt ) { } int trap_Milliseconds( void ) { - return syscall( CG_MILLISECONDS ); + return syscall( CG_MILLISECONDS ); } void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags ) { @@ -141,7 +141,7 @@ void trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const ve syscall( CG_CM_TRANSFORMEDBOXTRACE, results, start, end, mins, maxs, model, brushmask, origin, angles ); } -int trap_CM_MarkFragments( int numPoints, const vec3_t *points, +int trap_CM_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projection, int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer ) { @@ -228,7 +228,7 @@ void trap_R_SetColor( const float *rgba ) { syscall( CG_R_SETCOLOR, rgba ); } -void trap_R_DrawStretchPic( float x, float y, float w, float h, +void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { syscall( CG_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h), PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader ); } @@ -237,7 +237,7 @@ void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) { syscall( CG_R_MODELBOUNDS, model, mins, maxs ); } -void trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, +void trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName ) { syscall( CG_R_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName ); } diff --git a/code/game/g_main.c b/code/game/g_main.c index 14ee19c..552fde7 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -351,10 +351,10 @@ static cvarTable_t gameCvarTable[] = { #endif { &g_language, "g_language", "", CVAR_ARCHIVE, 0, qfalse }, { &g_holoIntro, "g_holoIntro", "1", CVAR_ARCHIVE, 0, qfalse }, - { &g_team_group_red, "g_team_group_red", "", CVAR_LATCH, 0, qfalse }, // Used to have CVAR_ARCHIVE + { &g_team_group_red, "g_team_group_red", "", CVAR_LATCH, 0, qfalse }, // Used to have CVAR_ARCHIVE { &g_team_group_blue, "g_team_group_blue", "", CVAR_LATCH, 0, qfalse }, // Used to have CVAR_ARCHIVE { &g_random_skin_limit, "g_random_skin_limit", "4", CVAR_ARCHIVE, 0, qfalse }, - { &g_classChangeDebounceTime, "g_classChangeDebounceTime", "180", CVAR_ARCHIVE, 0, qfalse }, + { &g_classChangeDebounceTime, "g_classChangeDebounceTime", "180", CVAR_ARCHIVE, 0, qfalse }, //RPG-X: RedTechie - RPG-X CVARS....duh....just for the slow ones { &rpg_allowvote, "rpg_allowVote", "1", CVAR_ARCHIVE, 0, qfalse }, { &rpg_chatsallowed, "rpg_chatsAllowed", "10", CVAR_ARCHIVE, 0, qfalse }, @@ -499,7 +499,7 @@ This is the only way control passes into the module. This MUST be the very first function compiled into the .q3vm file ================ */ -intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) { +Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) { switch ( command ) { case GAME_INIT: G_InitGame( arg0, arg1, arg2 ); @@ -559,7 +559,7 @@ void QDECL G_PrintfClient(gentity_t *ent, const char *fmt, ...) { #ifdef G_LUA LuaHook_G_ClientPrint(text, ent-g_entities); #endif - + trap_SendServerCommand(ent-g_entities, va("print \"%s\n\"", text)); } @@ -601,17 +601,17 @@ void QDECL G_Error( const char *fmt, ... ) { stringID_table_t WeaponTable[] = { { ENUM2STRING(WP_2) }, { ENUM2STRING(WP_3) }, - { ENUM2STRING(WP_4) }, - { ENUM2STRING(WP_5) }, - { ENUM2STRING(WP_6) }, + { ENUM2STRING(WP_4) }, + { ENUM2STRING(WP_5) }, + { ENUM2STRING(WP_6) }, { ENUM2STRING(WP_7) }, { ENUM2STRING(WP_8) }, - { ENUM2STRING(WP_9) }, - { ENUM2STRING(WP_10) }, - { ENUM2STRING(WP_11) }, - { ENUM2STRING(WP_12) }, - { ENUM2STRING(WP_13) }, - { ENUM2STRING(WP_14) }, + { ENUM2STRING(WP_9) }, + { ENUM2STRING(WP_10) }, + { ENUM2STRING(WP_11) }, + { ENUM2STRING(WP_12) }, + { ENUM2STRING(WP_13) }, + { ENUM2STRING(WP_14) }, { ENUM2STRING(WP_15) }, { "WP_TRICORDER", WP_2 }, @@ -628,7 +628,7 @@ stringID_table_t WeaponTable[] = { { "WP_DERMAL_REGEN", WP_13 }, { "WP_TOOLKIT", WP_14 }, { "WP_HYPERSPANNER", WP_15 }, - + { NULL, -1 } }; @@ -653,7 +653,7 @@ static qboolean G_LoadClassData( char* fileName ) //Init the storage place memset( &g_classData, 0, sizeof ( g_classData ) ); - + fileLen = trap_FS_FOpenFile( fileName, &f, FS_READ ); if ( !f ) { @@ -691,23 +691,23 @@ static qboolean G_LoadClassData( char* fileName ) return qfalse; } - while ( 1 ) + while ( 1 ) { if ( classIndex >= MAX_CLASSES ) break; - if ( !Q_stricmpn( token, "{", 1 ) ) + if ( !Q_stricmpn( token, "{", 1 ) ) { - while ( 1 ) + while ( 1 ) { token = COM_Parse( &textPtr ); if (!token[0]) { break; - } + } if ( !Q_stricmpn( token, "consoleName", 11 ) ) { - if ( COM_ParseString( &textPtr, &token ) ) + if ( COM_ParseString( &textPtr, &token ) ) { G_Printf( S_COLOR_RED "ERROR: Invalid class console name in class index: %i.\n", classIndex ); SkipBracedSection( &textPtr ); @@ -722,7 +722,7 @@ static qboolean G_LoadClassData( char* fileName ) if ( !Q_stricmpn( token, "formalName", 11 ) ) { - if ( COM_ParseString( &textPtr, &token ) ) + if ( COM_ParseString( &textPtr, &token ) ) { G_Printf( S_COLOR_RED "ERROR: Invalid class formal name in class index: %i.\n", classIndex ); SkipBracedSection( &textPtr ); @@ -731,25 +731,25 @@ static qboolean G_LoadClassData( char* fileName ) Q_strncpyz( g_classData[classIndex].formalName, token, sizeof( g_classData[classIndex].formalName ) ); classValid = qtrue; - + continue; } - if ( !Q_stricmpn( token, "message", 7 ) ) + if ( !Q_stricmpn( token, "message", 7 ) ) { - if ( COM_ParseString( &textPtr, &token ) ) + if ( COM_ParseString( &textPtr, &token ) ) { G_Printf( S_COLOR_RED "ERROR: Invalid class message in class index: %i.\n", classIndex ); continue; } Q_strncpyz( g_classData[classIndex].message, token, sizeof( g_classData[classIndex].message ) ); - continue; + continue; } - if ( !Q_stricmpn( token, "modelSkin", 9 ) ) + if ( !Q_stricmpn( token, "modelSkin", 9 ) ) { - if ( COM_ParseString( &textPtr, &token ) ) + if ( COM_ParseString( &textPtr, &token ) ) { G_Printf( S_COLOR_RED "ERROR: Invalid class skin color in class index: %i.\n", classIndex ); continue; @@ -759,11 +759,11 @@ static qboolean G_LoadClassData( char* fileName ) continue; } - if ( !Q_stricmpn( token, "weapons", 7) ) + if ( !Q_stricmpn( token, "weapons", 7) ) { token = COM_Parse( &textPtr ); - if ( Q_stricmpn( token, "{", 1 ) ) + if ( Q_stricmpn( token, "{", 1 ) ) { G_Printf( S_COLOR_RED "No opening bracket found for weapons field in class: %i.\n", classIndex ); SkipRestOfLine( &textPtr ); @@ -771,24 +771,24 @@ static qboolean G_LoadClassData( char* fileName ) } //sub loop - while ( 1 ) + while ( 1 ) { token = COM_Parse( &textPtr ); if ( !token[0] ) break; - + if ( !Q_stricmpn( token, "|", 1 ) ) continue; if ( !Q_stricmpn( token, "}", 1 ) ) break; - if( !Q_stricmpn( token, "WP_", 3 ) ) + if( !Q_stricmpn( token, "WP_", 3 ) ) { weapon = GetIDForString( WeaponTable, token ); - if ( weapon >= 0 ) + if ( weapon >= 0 ) { g_classData[classIndex].weaponsFlags |= ( 1 << weapon ); continue; @@ -799,9 +799,9 @@ static qboolean G_LoadClassData( char* fileName ) continue; } - if ( !Q_stricmpn( token, "admin", 5 ) ) + if ( !Q_stricmpn( token, "admin", 5 ) ) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isAdmin ) ) + if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isAdmin ) ) { G_Printf( S_COLOR_RED "ERROR: Class admin check for class %i was invalid.\n", classIndex ); continue; @@ -810,9 +810,9 @@ static qboolean G_LoadClassData( char* fileName ) continue; } - if ( !Q_stricmpn( token, "marine", 6 ) ) + if ( !Q_stricmpn( token, "marine", 6 ) ) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMarine ) ) + if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMarine ) ) { G_Printf( S_COLOR_RED "ERROR: Class marine check for class %i was invalid.\n", classIndex ); continue; @@ -821,9 +821,9 @@ static qboolean G_LoadClassData( char* fileName ) continue; } - if ( !Q_stricmpn( token, "medical", 7 ) ) + if ( !Q_stricmpn( token, "medical", 7 ) ) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMedical ) ) + if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMedical ) ) { G_Printf( S_COLOR_RED "ERROR: Class medic check for class %i was invalid.\n", classIndex ); continue; @@ -842,9 +842,9 @@ static qboolean G_LoadClassData( char* fileName ) continue; } - if ( !Q_stricmpn( token, "n00b", 4 ) ) + if ( !Q_stricmpn( token, "n00b", 4 ) ) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isn00b ) ) + if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isn00b ) ) { G_Printf( S_COLOR_RED "ERROR: Class n00b check for class %i was invalid.\n", classIndex ); continue; @@ -854,9 +854,9 @@ static qboolean G_LoadClassData( char* fileName ) } //skip the client-side specific entries since they interfere with the parsing - if ( !Q_stricmpn( token, "radarColor", 10 ) - || !Q_stricmpn( token, "iconColor", 9 ) - || !Q_stricmpn( token, "hasRanks", 8 ) + if ( !Q_stricmpn( token, "radarColor", 10 ) + || !Q_stricmpn( token, "iconColor", 9 ) + || !Q_stricmpn( token, "hasRanks", 8 ) || !Q_stricmpn( token, "noShow", 6 ) ) { @@ -864,22 +864,22 @@ static qboolean G_LoadClassData( char* fileName ) continue; } - if ( !Q_stricmpn( token, "}", 1 ) ) + if ( !Q_stricmpn( token, "}", 1 ) ) { break; } } - - if ( classValid ) + + if ( classValid ) { classIndex++; classValid = qfalse; } } - - token = COM_Parse( &textPtr ); - if (!token[0]) + + token = COM_Parse( &textPtr ); + if (!token[0]) { break; } @@ -888,17 +888,17 @@ static qboolean G_LoadClassData( char* fileName ) free(buffer); //build ourselves custom CVARs for each class - for ( i=0; g_classData[i].consoleName[0] && i < MAX_CLASSES; i++ ) + for ( i=0; g_classData[i].consoleName[0] && i < MAX_CLASSES; i++ ) { trap_Cvar_Register( NULL, va("rpg_%sPass", g_classData[i].consoleName ), g_classData[i].consoleName, CVAR_ARCHIVE ); trap_Cvar_Register( NULL, va("rpg_%sFlags", g_classData[i].consoleName ), va("%i", g_classData[i].weaponsFlags), CVAR_ARCHIVE ); } - if ( classIndex > 0 ) + if ( classIndex > 0 ) { return qtrue; } - else + else { G_Printf( S_COLOR_RED "ERROR: No valid classes were found.\n"); return qfalse; @@ -1124,7 +1124,7 @@ static void G_LoadServerChangeFile(void) { file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ); - if(!file_len) + if(!file_len) return; buffer = (char *)malloc(32000 * sizeof(char)); @@ -1164,7 +1164,7 @@ static void G_LoadServerChangeFile(void) { G_Printf( S_COLOR_RED "ERROR: ServerChangeConfig had no opening brace ( { )!\n" ); continue; } - + while(Q_strncmp(token, "}", 1)) { token = COM_Parse(&txtPtr); if(!token[0]) break; @@ -1218,7 +1218,7 @@ static void G_LoadMapChangeFile(void) { file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ); - if(!file_len) + if(!file_len) return; buffer = (char *)malloc(32000 * sizeof(char)); @@ -1256,7 +1256,7 @@ static void G_LoadMapChangeFile(void) { G_Printf( S_COLOR_RED "ERROR: MapChangeConfig had no opening brace ( { )!\n" ); continue; } - + while(Q_strncmp(token, "}", 1)) { token = COM_Parse(&txtPtr); if(!token[0]) break; @@ -1347,7 +1347,7 @@ static void G_LoadLocationsFile( void ) buffer[file_len] = '\0'; trap_FS_FCloseFile( f ); - + G_Printf( "Locations file %s located. Proceeding to load scan data.\n", fileRoute ); //GSIO01: why did this say "Usables file ..."? lol ;) COM_BeginParseSession(); @@ -1514,7 +1514,7 @@ static void G_LoadLocationsFile( void ) token = COM_Parse( &textPtr ); } } - } + } free(buffer); } @@ -1684,7 +1684,7 @@ static void G_UpdateCvars( void ) //RPG-X: J2J - Don't show gravity changed messages any more (for the gravity target ents) if(Q_stricmp(cv->cvarName,"g_gravity") != 0) { - trap_SendServerCommand( -1, va("print \"Server: %s changed to %s\n\"", + trap_SendServerCommand( -1, va("print \"Server: %s changed to %s\n\"", cv->cvarName, cv->vmCvar->string ) ); } } @@ -1764,8 +1764,8 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { //Class loader memset( fileName, 0, sizeof( fileName ) ); - Com_sprintf( fileName, sizeof( fileName ), "ext_data/classes/%s.classes", rpg_classSet.string ); - if ( !G_LoadClassData( fileName ) ) + Com_sprintf( fileName, sizeof( fileName ), "ext_data/classes/%s.classes", rpg_classSet.string ); + if ( !G_LoadClassData( fileName ) ) { G_Printf( S_COLOR_RED "ERROR: Could not load class set %s. Reverting to default.\n", fileName ); trap_Cvar_Set( "rpg_classSet", CLASS_DEFAULT ); @@ -1779,12 +1779,12 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { //Rank Loader memset( fileName, 0, sizeof( fileName ) ); Com_sprintf( fileName, sizeof( fileName ), "ext_data/ranksets/%s.ranks", rpg_rankSet.string ); - if ( !BG_ParseRankNames( fileName, g_rankNames ) ) + if ( !BG_ParseRankNames( fileName, g_rankNames ) ) { G_Printf( S_COLOR_RED "ERROR: Could not load rankset %s. Reverting to default.\n", fileName ); trap_Cvar_Set( "rpg_rankSet", RANKSET_DEFAULT ); - if ( !BG_ParseRankNames( va( "ext_data/ranksets/%s.ranks", RANKSET_DEFAULT ), g_rankNames ) ) + if ( !BG_ParseRankNames( va( "ext_data/ranksets/%s.ranks", RANKSET_DEFAULT ), g_rankNames ) ) { G_Error( "Could not load default rankset: %s", RANKSET_DEFAULT ); } @@ -1846,14 +1846,14 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { for ( i=0 ; i 128 are clients only. cyclicng thru all ents here is not needed. for(i = 0; i < MAX_CLIENTS; i++) - { + { //RPG-X: Redtechie - Make sure score cant be chnaged unless other wise told to if(g_entities[i].client){ g_entities[i].client->UpdateScore = qfalse; @@ -1969,24 +1969,24 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { /*************************************************************************************************/ G_Printf(" ,. \n"); G_Printf(" ..:, :Xt. ,:. \n"); - G_Printf(" ,=+t: .IRX= :++=. \n"); G_Printf(" .=iVt:. :RYYI. .itt+ \n"); - G_Printf(" .:tXI=;. tRtiV; ,IYY:. \n"); G_Printf(" .+;ii=;. ,XVi+Vt. :tIi+ \n"); - G_Printf(" .;ti;;:. +RI++IY, ,+tt=. \n"); G_Printf(" ,++YY;. ,XXi+++X= ;IYI=. \n"); - G_Printf(" ;ttY+;. .,=iVRI++++YX+;. ;VYt; \n"); G_Printf(" .;ii+=, .;IXRRXVi++++iVRXVi:. ,=iii. \n"); - G_Printf(" .==;ti, .;YRRVVXYii+++++IVIVRXt, ,+=tI= \n"); G_Printf(" .iitY=, .tRRVXXVRV+++ii++YRXVIYXV; :tYti, \n"); - G_Printf(" .+iii=,,IBVVXYiiXViiiiiiitVtIXViVR= ,+t+I: \n"); G_Printf(" =+=I:.tBVXVt=;tRIiiiiiiiiXi:=YXiIX; :+=It; \n"); + G_Printf(" ,=+t: .IRX= :++=. \n"); G_Printf(" .=iVt:. :RYYI. .itt+ \n"); + G_Printf(" .:tXI=;. tRtiV; ,IYY:. \n"); G_Printf(" .+;ii=;. ,XVi+Vt. :tIi+ \n"); + G_Printf(" .;ti;;:. +RI++IY, ,+tt=. \n"); G_Printf(" ,++YY;. ,XXi+++X= ;IYI=. \n"); + G_Printf(" ;ttY+;. .,=iVRI++++YX+;. ;VYt; \n"); G_Printf(" .;ii+=, .;IXRRXVi++++iVRXVi:. ,=iii. \n"); + G_Printf(" .==;ti, .;YRRVVXYii+++++IVIVRXt, ,+=tI= \n"); G_Printf(" .iitY=, .tRRVXXVRV+++ii++YRXVIYXV; :tYti, \n"); + G_Printf(" .+iii=,,IBVVXYiiXViiiiiiitVtIXViVR= ,+t+I: \n"); G_Printf(" =+=I:.tBVXVt=;tRIiiiiiiiiXi:=YXiIX; :+=It; \n"); G_Printf(" .;;tYt:;RVVV+=:,YRiiiiiiiiiYI,.:IXiVY..+IYi= \n"); G_Printf(" .ti=t+;tRIXi;, :XViiiiiiiiiIV: ,YViX=.:titt. \n"); - G_Printf(" iY++I;YVYY=: +BIiiiiiiiiiiX= +XiVi;i++Vi, \n"); G_Printf(" ,+YYYI:VYYY;. .YRiiiiiiiiiiiVt. ;RIYt:IIVVi: \n"); + G_Printf(" iY++I;YVYY=: +BIiiiiiiiiiiX= +XiVi;i++Vi, \n"); G_Printf(" ,+YYYI:VYYY;. .YRiiiiiiiiiiiVt. ;RIYt:IIVVi: \n"); G_Printf(" ,+tYXi;YVIX; ;RVtiiiiIXXtiiVI, iRIVt,=XVit: \n"); G_Printf(" .+iiti++XiXI. iBIiiiiYXIIXtiIV: :XXIV++;i+iI;.\n"); - G_Printf(" ;Ii=ii:VYtRi,VRtiiiVVi=;IXitX=;VBYXI=i+;iV+;.\n"); G_Printf(" ;tYtVt;;XYIRXBVttiVV+;:.:VYiXVRBVXY+;+IYVt+, \n"); + G_Printf(" ;Ii=ii:VYtRi,VRtiiiVVi=;IXitX=;VBYXI=i+;iV+;.\n"); G_Printf(" ;tYtVt;;XYIRXBVttiVV+;:.:VYiXVRBVXY+;+IYVt+, \n"); G_Printf(" =iiItii,=XVIRRIttXV+=:..,tRtVBXVRI+=i:iIit+. \n"); G_Printf(" :t==++I:.=YXYIIiYBXYIttIVRBYtVXXI+;;t+;;+Y=, \n"); - G_Printf(" +I=;+Y= .:IRItYIVXRRRBBRXXVIRY+=;.:i=;iVi;. \n"); G_Printf(" .+IYVV+: +BYXXVXXXXXXXXXVRVVi;:.:;tVYY+=: \n"); + G_Printf(" +I=;+Y= .:IRItYIVXRRRBBRXXVIRY+=;.:i=;iVi;. \n"); G_Printf(" .+IYVV+: +BYXXVXXXXXXXXXVRVVi;:.:;tVYY+=: \n"); G_Printf(" .+ttii+ .IBXY++ittIIIti++tXXi, .++=tI+;: \n"); G_Printf(" ;YYtIY;;VBI+;:,::;;;;;:,:IBt,::tItYV=. \n"); G_Printf(" =IYYI++ti+;, ....... :Xt;i=iYYI+;. \n"); G_Printf(" .:+i++ii;;. .=i=+i=t+;;:. \n"); G_Printf(" ,tYIVI==:,.. ..,;=+iYIVt:.. \n"); G_Printf(" ,itt+iIYYti;. ,;itYIIt:iIi=;. \n"); - G_Printf(" .:;;:+tIIVIi:.;iYYIii+=:,;;:. \n"); G_Printf(" . ,:=itIXi.tXYit=;::, . \n"); - G_Printf(" .+tti=,,iIt+;. \n"); G_Printf(" .:;;:. ,;;;:. \n"); - + G_Printf(" .:;;:+tIIVIi:.;iYYIii+=:,;;:. \n"); G_Printf(" . ,:=itIXi.tXYit=;::, . \n"); + G_Printf(" .+tti=,,iIt+;. \n"); G_Printf(" .:;;:. ,;;;:. \n"); + } extern list_iter_p iterTimedMessages; /* list iterator for timed messages */ @@ -2216,7 +2216,7 @@ void G_Client_CalculateRanks( qboolean fromExit ) { if ( level.clients[i].sess.sessionTeam != TEAM_SPECTATOR ) { level.numNonSpectatorClients++; - + // decide if this should be auto-followed if ( level.clients[i].pers.connected == CON_CONNECTED ) { level.numPlayingClients++; @@ -2233,7 +2233,7 @@ void G_Client_CalculateRanks( qboolean fromExit ) { } } - qsort( level.sortedClients, level.numConnectedClients, + qsort( level.sortedClients, level.numConnectedClients, sizeof(level.sortedClients[0]), SortRanks ); // set the rank value for all clients that are connected and not spectators @@ -2249,7 +2249,7 @@ void G_Client_CalculateRanks( qboolean fromExit ) { cl->ps.persistant[PERS_RANK] = 1; } } - } else { + } else { rank = -1; score = 0; for ( i = 0; i < level.numPlayingClients; i++ ) { @@ -2404,7 +2404,7 @@ static void ClearFiringFlags(void) int i = 0; gentity_t *ent = NULL; - for (i=0 ; i< level.maxclients ; i++) + for (i=0 ; i< level.maxclients ; i++) { ent = g_entities + i; if (!ent->inuse) @@ -2486,7 +2486,7 @@ void G_ClearObjectives( void ) ExitLevel When the intermission has been exited, the server is either killed -or moved to a new level based on the "nextmap" cvar +or moved to a new level based on the "nextmap" cvar ============= */ @@ -2510,7 +2510,7 @@ void ExitLevel (void) { level.changemap = NULL; level.intermissiontime = 0; } - return; + return; } trap_SendConsoleCommand( EXEC_APPEND, "vstr nextmap\n" ); @@ -2571,7 +2571,7 @@ static void CheckTournement( void ) { if ( level.warmupTime == 0 || level.warmupTime != 0) {//RPG-X: RedTechie - No warmup Fail safe return; } - } else if ( g_gametype.integer != GT_SINGLE_PLAYER ) { + } else if ( g_gametype.integer != GT_SINGLE_PLAYER ) { if ( level.warmupTime == 0) { return; } @@ -2644,7 +2644,7 @@ void G_RunThink (gentity_t *ent) { if (thinktime > level.time) { return; } - + ent->nextthink = 0; if (!ent->think) { G_Error ( "NULL ent->think"); diff --git a/code/game/g_syscalls.c b/code/game/g_syscalls.c index 8c11098..5c14f70 100644 --- a/code/game/g_syscalls.c +++ b/code/game/g_syscalls.c @@ -7,7 +7,7 @@ static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1; -void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { +Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { syscall = syscallptr; } @@ -26,7 +26,7 @@ void trap_Error( const char *fmt ) { } int trap_Milliseconds( void ) { - return syscall( G_MILLISECONDS ); + return syscall( G_MILLISECONDS ); } int trap_Argc( void ) { return syscall( G_ARGC ); diff --git a/code/game/q_shared.h b/code/game/q_shared.h index a8ee5a5..e1b6bc3 100644 --- a/code/game/q_shared.h +++ b/code/game/q_shared.h @@ -10,9 +10,9 @@ // q_shared.h -- included first by ALL program modules. // A user mod should never modify this file -#if defined(ppc) || defined(__ppc) || defined(__ppc__) -#define idppc -#endif +#if defined(ppc) || defined(__ppc) || defined(__ppc__) +#define idppc +#endif //#define MISSION_PACK //TiM: was commented out @@ -44,6 +44,16 @@ #endif #endif +#if (defined _MSC_VER) +#define Q_EXPORT __declspec(dllexport) +#elif (defined __SUNPRO_C) +#define Q_EXPORT __global +#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun)) +#define Q_EXPORT __attribute__((visibility("default"))) +#else +#define Q_EXPORT +#endif + /********************************************************************** VM Considerations @@ -693,7 +703,7 @@ char* Q_strupr( char *s1 ); char* Q_strrchr( const char* string, int c ); /** * Goes through a given str searching for one of the given tokens. - * If it finds one it returns a new string containing everything + * If it finds one it returns a new string containing everything * from str until the found token (Note: remember to free the result * if no longer needed). Returns NULL if no token is found. Make sure * to adjust str for the next call yourself as this function won't do that. @@ -962,7 +972,7 @@ typedef struct { #define MAX_STATS 16 #define MAX_PERSISTANT 16 #define MAX_POWERUPS 16 //RPG-X:TiM -#define MAX_WEAPONS 16 +#define MAX_WEAPONS 16 #define MAX_PS_EVENTS 4 @@ -993,7 +1003,7 @@ typedef struct playerState_s { int weaponTime; int rechargeTime; // for the phaser short useTime; // use debounce - + int introTime; // for the holodoor int gravity; @@ -1167,7 +1177,7 @@ typedef struct entityState_s { typedef enum { CA_UNINITIALIZED, CA_DISCONNECTED, // not talking to a server - CA_AUTHORIZING, // not used any more, was checking cd key + CA_AUTHORIZING, // not used any more, was checking cd key CA_CONNECTING, // sending request packets to the server CA_CHALLENGING, // sending challenge packets to the server CA_CONNECTED, // netchan_t established, getting gamestate @@ -1185,7 +1195,7 @@ typedef enum { //extern vmCvar_t rpg_medicsrevive; //RPG-X: RedTechie - To let bg_pmovto work //extern vmCvar_t rpg_noclipspectating; //Added here (by rpg-x:j2j) so it could be seen in bg_pmove.c -//extern qboolean ClientNCSpec; //Private flag for weather the client chooses to spectate noclip style (rpg-x:j2j) +//extern qboolean ClientNCSpec; //Private flag for weather the client chooses to spectate noclip style (rpg-x:j2j) /* ======================================================================== @@ -1205,6 +1215,6 @@ typedef struct stringID_table_s } stringID_table_t; int GetIDForString ( stringID_table_t *table, const char *string ); -const char *GetStringForID( stringID_table_t *table, int id ); +const char *GetStringForID( stringID_table_t *table, int id ); #endif // __Q_SHARED_H diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index 932f4ea..29b7664 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -60,14 +60,13 @@ char *Sys_DefaultHomePath(void) Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP); #ifdef ELITEFORCE #ifdef MACOS_X - Q_strcat(homePath, sizeof(homePath), "/Library/Application Support/STVEF"); + Q_strcat(homePath, sizeof(homePath), "Library/Application Support/STVEF"); #else - Q_strcat(homePath, sizeof(homePath), "/.stvef"); + Q_strcat(homePath, sizeof(homePath), ".stvef"); #endif #else #ifdef MACOS_X - Q_strcat(homePath, sizeof(homePath), - "Library/Application Support/"); + Q_strcat(homePath, sizeof(homePath), "Library/Application Support/"); if(com_homepath->string[0]) Q_strcat(homePath, sizeof(homePath), com_homepath->string); diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 2aaed5e..34d3ad2 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -20,7 +20,7 @@ This is the only way control passes into the module. This must be the very first function compiled into the .qvm file ================ */ -int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) { +Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 ) { switch ( command ) { case UI_GETAPIVERSION: return UI_API_VERSION; @@ -417,7 +417,7 @@ static cvarTable_t cvarTable[] = { // { &ui_lastactive, "sys_lastactive", "0", CVAR_ARCHIVE }, //RPG-X | Phenix | 25/02/2005 (Trying to make a timer for intro) //TiM : RPG-X variables 8-8-2005 { &ui_dynamicLensFlares, "cg_dynamicLensFlares", "1", CVAR_ARCHIVE }, - { &ui_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE }, + { &ui_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE }, { &ui_currentRankSet, "ui_currentRankSet", RANKSET_DEFAULT, CVAR_ARCHIVE | CVAR_ROM }, { &ui_currentClassSet, "ui_currentClassSet", CLASS_DEFAULT, CVAR_ARCHIVE | CVAR_ROM }, @@ -481,11 +481,11 @@ UI_RegisterCvars void UI_RegisterCvars( void ) { int i; cvarTable_t *cv; - + //RPG-X: RedTechie - Keep no class default //RPG-X: TiM - just commented this out for now to see if I can add class support to the main UI // trap_Cvar_Set( "ui_playerclass", "NOCLASS" ); - + for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) { trap_Cvar_Register( cv->vmCvar, cv->cvarName, cv->defaultString, cv->cvarFlags ); } @@ -542,7 +542,7 @@ int UI_GetAnim ( int anim, int weapon, qboolean upper ) case WP_10: if ( upper ) return TORSO_WEAPONPOSE1; - else + else return BOTH_CROUCH1IDLE; break; case WP_4: @@ -612,7 +612,7 @@ int UI_GetAnim ( int anim, int weapon, qboolean upper ) case WP_5: case WP_10: if (upper) - return TORSO_WEAPONREADY1; + return TORSO_WEAPONREADY1; else return BOTH_STAND1; break; @@ -645,7 +645,7 @@ int UI_GetAnim ( int anim, int weapon, qboolean upper ) return BOTH_STAND1; //Other: "Toolkit" /*case WP_14: - //Return nothing. + //Return nothing. //A bit hacky, but the engine accepts it :P break;*/ //Other Tools "everything else" @@ -673,7 +673,7 @@ int UI_GetAnim ( int anim, int weapon, qboolean upper ) //break; default: if (upper) - return TORSO_WEAPONREADY1; + return TORSO_WEAPONREADY1; else return BOTH_STAND1; break; @@ -683,7 +683,7 @@ int UI_GetAnim ( int anim, int weapon, qboolean upper ) //When the player jumps case ANIM_JUMP: return BOTH_JUMP1; - + //When the player runs case ANIM_RUN: //2 handed weapons @@ -729,11 +729,11 @@ int UI_GetAnim ( int anim, int weapon, qboolean upper ) break; } break; - + //When the player walks case ANIM_BACK: //2 handed weapons - switch (weapon) + switch (weapon) { //case WP_7: case WP_8: diff --git a/code/ui/ui_syscalls.c b/code/ui/ui_syscalls.c index 87fca9a..d654585 100644 --- a/code/ui/ui_syscalls.c +++ b/code/ui/ui_syscalls.c @@ -10,7 +10,7 @@ static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1; -void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { +Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { syscall = syscallptr; } @@ -35,7 +35,7 @@ void trap_Error( const char *string ) { } int trap_Milliseconds( void ) { - return syscall( UI_MILLISECONDS ); + return syscall( UI_MILLISECONDS ); } void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) { @@ -65,7 +65,7 @@ void trap_Cvar_SetValue( const char *var_name, float value ) { } void trap_Cvar_Reset( const char *name ) { - syscall( UI_CVAR_RESET, name ); + syscall( UI_CVAR_RESET, name ); } void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) { diff --git a/code/ui/ui_video.c b/code/ui/ui_video.c index f9aa075..da6c50e 100644 --- a/code/ui/ui_video.c +++ b/code/ui/ui_video.c @@ -15,7 +15,7 @@ static void Video_MenuEvent (void* ptr, int event); #define PIC_SLIDER "menu/common/slider.tga" // Video Data -typedef struct +typedef struct { menuframework_s menu; @@ -30,7 +30,7 @@ static videoddata_t s_videodata; // Video Drivers -typedef struct +typedef struct { menuframework_s menu; @@ -40,7 +40,7 @@ typedef struct // Video Data 2 -typedef struct +typedef struct { menuframework_s menu; @@ -80,7 +80,7 @@ static int s_graphics_options_Names[] = extern int s_OffOnNone_Names[]; -static int s_resolutions[] = +static int s_resolutions[] = { // MNT_320X200, // MNT_400X300, @@ -109,6 +109,7 @@ static char *s_wideResolutions16x9[] = { "854x480", "1280x720", + "1366x768", "1920x1080", 0 }; @@ -117,6 +118,7 @@ static videoResolutions_t videoResolutions16x9[] = { { 854, 480 }, { 1280, 720 }, + { 1366, 768 }, { 1920, 1080 } }; @@ -139,7 +141,7 @@ static videoResolutions_t videoResolutions16x10[] = { 2560, 1600 } }; -static void *s_widescreenResolutions[] = +static void *s_widescreenResolutions[] = { &videoResolutions16x9, &videoResolutions16x10, @@ -154,11 +156,11 @@ static void *s_widescreenResStrings[] = }; //store the number of widescreen arrays -static int s_wideScreenSets = 2; +static int s_wideScreenSets = 2; //store the number of resolutions in each array. //This will be necessary when we change the lists over -static int s_resolutionNums[] = {9,3,5}; +static int s_resolutionNums[] = {9,4,5}; //finally for reference sake, use an enum typedef enum @@ -237,7 +239,7 @@ static menubitmap_s s_video_data2; // Precache stuff for Video Driver #define MAX_VID_DRIVERS 128 -static struct +static struct { menuframework_s menu; @@ -284,34 +286,34 @@ static struct static void* g_videolines[] = { - &s_videodriver.line1, - &s_videodriver.line2, - &s_videodriver.line3, - &s_videodriver.line4, - &s_videodriver.line5, - &s_videodriver.line6, - &s_videodriver.line7, - &s_videodriver.line8, - &s_videodriver.line9, - &s_videodriver.line10, - &s_videodriver.line11, - &s_videodriver.line12, - &s_videodriver.line13, - &s_videodriver.line14, - &s_videodriver.line15, - &s_videodriver.line16, - &s_videodriver.line17, - &s_videodriver.line18, - &s_videodriver.line19, - &s_videodriver.line20, - &s_videodriver.line21, - &s_videodriver.line22, - &s_videodriver.line23, - &s_videodriver.line24, + &s_videodriver.line1, + &s_videodriver.line2, + &s_videodriver.line3, + &s_videodriver.line4, + &s_videodriver.line5, + &s_videodriver.line6, + &s_videodriver.line7, + &s_videodriver.line8, + &s_videodriver.line9, + &s_videodriver.line10, + &s_videodriver.line11, + &s_videodriver.line12, + &s_videodriver.line13, + &s_videodriver.line14, + &s_videodriver.line15, + &s_videodriver.line16, + &s_videodriver.line17, + &s_videodriver.line18, + &s_videodriver.line19, + &s_videodriver.line20, + &s_videodriver.line21, + &s_videodriver.line22, + &s_videodriver.line23, + &s_videodriver.line24, NULL, }; -int video_sidebuttons[3][2] = +int video_sidebuttons[3][2] = { { 30, 250 }, // Video Data Button { 30, 250 + 6 + (MENU_BUTTON_MED_HEIGHT * 1.5) }, // Video Drivers Button @@ -516,7 +518,7 @@ typedef struct { menutext_s display; menutext_s sound; menutext_s network; - + menulist_s aspectRatio; menulist_s list; menulist_s mode; @@ -558,7 +560,7 @@ typedef struct } InitialVideoOptions_s; static InitialVideoOptions_s s_ivo; -static graphicsoptions_t s_graphicsoptions; +static graphicsoptions_t s_graphicsoptions; static InitialVideoOptions_s s_ivo_templates[] = { @@ -767,7 +769,7 @@ static void GraphicsOptions_UpdateMenuItems( void ) } GraphicsOptions_CheckConfig(); -} +} /* ================= @@ -827,9 +829,9 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification ) } trap_Cvar_SetValue( "r_lowEndVideo", s_graphicsoptions.simpleshaders.curvalue ); - + trap_Cvar_SetValue( "r_ext_compress_textures", s_graphicsoptions.compresstextures.curvalue ); - + switch ( s_graphicsoptions.colordepth.curvalue ) { case 0: @@ -882,7 +884,7 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification ) GraphicsOptions_Event ================= */ -static void GraphicsOptions_Event( void* ptr, int event ) +static void GraphicsOptions_Event( void* ptr, int event ) { InitialVideoOptions_s *ivo; @@ -1010,7 +1012,7 @@ static void GraphicsOptions_SetMenuItems( void ) s_graphicsoptions.aspectRatio.curvalue = ASPECTRATIO_4X3; //set aspect to 'Normal' for now s_graphicsoptions.mode.curvalue = (trap_Cvar_VariableValue( "r_mode" ) - 2); - + //TiM - adjust for widescreen if ( s_graphicsoptions.mode.curvalue < 0 && !GraphicsOptions_CheckWidescreen() ) //less than 0 means custom resolution now s_graphicsoptions.mode.curvalue = 1; @@ -1093,7 +1095,7 @@ static void GraphicsOptions_SetMenuItems( void ) -void VideoSideButtonsAction( qboolean result ) +void VideoSideButtonsAction( qboolean result ) { if ( result ) // Yes - do it { @@ -1117,7 +1119,7 @@ static void VideoSideButtons_MenuEvent (void* ptr, int event) if (s_graphicsoptions.apply.generic.flags & QMF_BLINK) // Video apply changes button is flashing { - UI_ConfirmMenu(menu_normal_text[MNT_LOOSEVIDSETTINGS], 0, VideoSideButtonsAction); + UI_ConfirmMenu(menu_normal_text[MNT_LOOSEVIDSETTINGS], 0, VideoSideButtonsAction); } else // Go ahead, act normal { @@ -1303,7 +1305,7 @@ static void VideoData_MenuInit( void ) x = 170; y = 178; width = 145; - + s_graphicsoptions.list.generic.type = MTYPE_SPINCONTROL; s_graphicsoptions.list.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_graphicsoptions.list.generic.x = x; @@ -1353,7 +1355,7 @@ static void VideoData_MenuInit( void ) y += inc; // references/modifies "r_mode" - // TiM: can now be potentially '-1', + // TiM: can now be potentially '-1', // in which case 'r_customeheight' and 'r_customwidth' // will be used s_graphicsoptions.mode.generic.type = MTYPE_SPINCONTROL; @@ -1580,7 +1582,7 @@ void Video_SideButtons(menuframework_s *menu,int menuType) { // Button Data - s_video_data.generic.type = MTYPE_BITMAP; + s_video_data.generic.type = MTYPE_BITMAP; s_video_data.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_video_data.generic.x = video_sidebuttons[0][0]; s_video_data.generic.y = video_sidebuttons[0][1]; @@ -1613,7 +1615,7 @@ void Video_SideButtons(menuframework_s *menu,int menuType) s_video_data.textcolor2 = CT_WHITE; } - s_video_data2.generic.type = MTYPE_BITMAP; + s_video_data2.generic.type = MTYPE_BITMAP; s_video_data2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_video_data2.generic.x = video_sidebuttons[1][0]; s_video_data2.generic.y = video_sidebuttons[1][1]; @@ -1648,7 +1650,7 @@ void Video_SideButtons(menuframework_s *menu,int menuType) s_video_data2.textcolor2 = CT_WHITE; } - s_video_drivers.generic.type = MTYPE_BITMAP; + s_video_drivers.generic.type = MTYPE_BITMAP; s_video_drivers.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_video_drivers.generic.x = video_sidebuttons[2][0]; s_video_drivers.generic.y = video_sidebuttons[2][1]; @@ -1733,23 +1735,23 @@ void VideoDriver_Lines(int increment) { if (i2<24) { - ((menutext_s *)g_videolines[i2])->string = s_videodriver.drivers[i]; + ((menutext_s *)g_videolines[i2])->string = s_videodriver.drivers[i]; i2++; } } - else + else { if (i2<24) { - ((menutext_s *)g_videolines[i2])->string = NULL; + ((menutext_s *)g_videolines[i2])->string = NULL; i2++; } - else + else { break; } } - } + } // Set up arrows @@ -1769,7 +1771,7 @@ void VideoDriver_Lines(int increment) } i = (s_videodriver.currentDriverLine * 2); - if (!s_videodriver.drivers[i + 24]) + if (!s_videodriver.drivers[i + 24]) { s_videodriver.activeArrowDwn = qfalse; return; @@ -1810,15 +1812,15 @@ void VideoDriver_LineSetup(void) if (i<24) { - ((menutext_s *)g_videolines[i])->string = eptr; + ((menutext_s *)g_videolines[i])->string = eptr; } - bufhold++; + bufhold++; eptr = bufhold; s_videodriver.driverCnt++; i++; } - } + } // Set down arrows if (i> 24) @@ -1890,12 +1892,12 @@ void M_VideoDriverMenu_Graphics (void) trap_R_SetColor( colorTable[CT_LTGOLD1]); if (s_videodriver.activeArrowUp) { - UI_DrawHandlePic( 382, 237, 32, -14, s_videodriver.arrow_dn); + UI_DrawHandlePic( 382, 237, 32, -14, s_videodriver.arrow_dn); } if (s_videodriver.activeArrowDwn) { - UI_DrawHandlePic( 382, 422, 32, 14, s_videodriver.arrow_dn); + UI_DrawHandlePic( 382, 422, 32, 14, s_videodriver.arrow_dn); } x = 204; @@ -1972,7 +1974,7 @@ static void VideoDriver_MenuInit( void ) Video_SideButtons(&s_videodriver.menu,ID_VIDEODRIVERS); - s_videodriver.arrowup.generic.type = MTYPE_BITMAP; + s_videodriver.arrowup.generic.type = MTYPE_BITMAP; s_videodriver.arrowup.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_videodriver.arrowup.generic.x = 572; s_videodriver.arrowup.generic.y = 262; @@ -1990,7 +1992,7 @@ static void VideoDriver_MenuInit( void ) s_videodriver.arrowup.textcolor2 = CT_WHITE; Menu_AddItem( &s_videodriver.menu,( void * ) &s_videodriver.arrowup); - s_videodriver.arrowdwn.generic.type = MTYPE_BITMAP; + s_videodriver.arrowdwn.generic.type = MTYPE_BITMAP; s_videodriver.arrowdwn.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_videodriver.arrowdwn.generic.x = 572; s_videodriver.arrowdwn.generic.y = 397; @@ -2017,14 +2019,14 @@ static void VideoDriver_MenuInit( void ) for (i=0;i<24;i++) { - ((menutext_s *)g_videolines[i])->generic.type = MTYPE_TEXT; + ((menutext_s *)g_videolines[i])->generic.type = MTYPE_TEXT; ((menutext_s *)g_videolines[i])->generic.flags = QMF_LEFT_JUSTIFY | QMF_INACTIVE; ((menutext_s *)g_videolines[i])->generic.y = y; if ((i % 2 ) == 0) { ((menutext_s *)g_videolines[i])->generic.x = x; } - else + else { ((menutext_s *)g_videolines[i])->generic.x = x2; y +=13; @@ -2099,7 +2101,7 @@ void M_VideoData2Menu_Graphics (void) if (uis.glconfig.deviceSupportsGamma) { trap_R_SetColor( colorTable[CT_DKGREY]); - UI_DrawHandlePic( 178, y, 68, 68, uis.whiteShader); // + UI_DrawHandlePic( 178, y, 68, 68, uis.whiteShader); // trap_R_SetColor( colorTable[CT_WHITE]); UI_DrawHandlePic( 180, y+2, 64, 64, s_videodata2.gamma); // Starfleet graphic @@ -2271,19 +2273,19 @@ static void VideoData2_MenuInit( void ) s_videodata2.screensize_slider.thumbColor2 = CT_LTBLUE1; y += 34; - s_videodata2.anisotropicfiltering.generic.type = MTYPE_SPINCONTROL; + s_videodata2.anisotropicfiltering.generic.type = MTYPE_SPINCONTROL; s_videodata2.anisotropicfiltering.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_videodata2.anisotropicfiltering.generic.x = x; s_videodata2.anisotropicfiltering.generic.y = y; s_videodata2.anisotropicfiltering.generic.name = GRAPHIC_BUTTONRIGHT; - s_videodata2.anisotropicfiltering.generic.callback = AnisotropicFilteringCallback; + s_videodata2.anisotropicfiltering.generic.callback = AnisotropicFilteringCallback; s_videodata2.anisotropicfiltering.color = CT_DKPURPLE1; s_videodata2.anisotropicfiltering.color2 = CT_LTPURPLE1; s_videodata2.anisotropicfiltering.textX = MENU_BUTTON_TEXT_X; s_videodata2.anisotropicfiltering.textY = MENU_BUTTON_TEXT_Y; s_videodata2.anisotropicfiltering.textEnum = MBT_ANISOTROPICFILTERING; s_videodata2.anisotropicfiltering.textcolor = CT_BLACK; - s_videodata2.anisotropicfiltering.textcolor2 = CT_WHITE; + s_videodata2.anisotropicfiltering.textcolor2 = CT_WHITE; s_videodata2.anisotropicfiltering.listnames = s_OffOnNone_Names;