From 8540d5b4e1a43dd0c8b50dfa886b64b4049bb70f Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Fri, 14 Apr 2006 18:16:31 +0000 Subject: [PATCH] no message --- reaction/cgame/cg_draw.c | 8 +- reaction/cgame/cg_local.h | 5 ++ reaction/cgame/cg_main.c | 6 ++ reaction/cgame/cg_marks.c | 11 ++- reaction/cgame/cg_particles.c | 5 +- reaction/cgame/cgame.dsp | 6 +- reaction/cgame/cgame.plg | 163 ++++++++++++++++++++++++++-------- reaction/game/bg_misc.c | 75 ++++++++++++++++ reaction/game/bg_public.h | 15 ++++ reaction/game/g_main.c | 7 ++ reaction/game/g_parser.c | 54 ++++++++++- reaction/game/g_parser.h | 57 ++---------- reaction/game/g_scripts.h | 3 +- reaction/game/g_utils.c | 19 ++++ reaction/game/game.dsp | 4 +- reaction/game/game.plg | 100 +++++++++++++++++++-- reaction/game/game.q3asm | 2 + 17 files changed, 433 insertions(+), 107 deletions(-) diff --git a/reaction/cgame/cg_draw.c b/reaction/cgame/cg_draw.c index fba7d09f..14f7f1dc 100644 --- a/reaction/cgame/cg_draw.c +++ b/reaction/cgame/cg_draw.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.79 2006/04/14 18:16:31 makro +// no message +// // Revision 1.78 2005/02/15 16:33:38 makro // Tons of updates (entity tree attachment system, UI vectors) // @@ -1980,6 +1983,9 @@ static void CG_DrawCrosshair(void) } trap_R_SetColor(NULL); + if (cgs.media.zoomMask) + CG_DrawPic(0, 0, 640, 480, cgs.media.zoomMask); + drawSSG = 1; } } @@ -2554,9 +2560,9 @@ static void CG_Draw2D(void) // don't draw any status if dead or the scoreboard is being explicitly shown // if ( !cg.showScores && cg.snap->ps.stats[STAT_HEALTH] > 0 ) { if (cg.snap->ps.stats[STAT_HEALTH] > 0) { + CG_DrawCrosshair(); CG_DrawStatusBar(); CG_DrawAmmoWarning(); - CG_DrawCrosshair(); CG_DrawCrosshairNames(); CG_DrawWeaponSelect(); CG_DrawHoldableItem(); diff --git a/reaction/cgame/cg_local.h b/reaction/cgame/cg_local.h index d3e9c120..899a2015 100644 --- a/reaction/cgame/cg_local.h +++ b/reaction/cgame/cg_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.162 2006/04/14 18:16:31 makro +// no message +// // Revision 1.161 2005/09/07 22:19:15 makro // Dead player view offset tweaks // @@ -1420,6 +1423,8 @@ typedef struct { //qhandle_t medalAssist; //qhandle_t medalCapture; + qhandle_t zoomMask; + // sounds sfxHandle_t kickSound; //Elder: kick sound sfxHandle_t headshotSound; //Elder: splat diff --git a/reaction/cgame/cg_main.c b/reaction/cgame/cg_main.c index fcb44fe6..f9222e3c 100644 --- a/reaction/cgame/cg_main.c +++ b/reaction/cgame/cg_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.148 2006/04/14 18:16:31 makro +// no message +// // Revision 1.147 2005/09/07 20:29:05 makro // Stuff I can't remember // @@ -2252,6 +2255,9 @@ static void CG_RegisterGraphics(void) cgs.media.ssgCrosshair[1] = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg4x-%i", i)); cgs.media.ssgCrosshair[2] = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg6x-%i", i)); + //Makro - zoom mask + cgs.media.zoomMask = trap_R_RegisterShaderNoMip("gfx/2d/zoom_mask"); + //Elder: other hud-related elements cgs.media.rq3_healthicon = trap_R_RegisterShaderNoMip("gfx/rq3_hud/hud_health"); cgs.media.rq3_healthicon2 = trap_R_RegisterShaderNoMip("gfx/rq3_hud/hud_healthwarning"); diff --git a/reaction/cgame/cg_marks.c b/reaction/cgame/cg_marks.c index 395787fd..acbe2884 100644 --- a/reaction/cgame/cg_marks.c +++ b/reaction/cgame/cg_marks.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.21 2006/04/14 18:16:31 makro +// no message +// // Revision 1.20 2004/01/26 21:26:08 makro // no message // @@ -2089,7 +2092,10 @@ void CG_ParticleSparks(vec3_t org, vec3_t vel, int duration, float x, float y, f cparticle_t *p; if (!free_particles) + { + CG_Printf(S_COLOR_RED "No particles left for sparks!!!\n"); return; + } p = free_particles; free_particles = p->next; p->next = active_particles; @@ -2139,7 +2145,6 @@ void CG_ParticleSparks(vec3_t org, vec3_t vel, int duration, float x, float y, f p->accel[0] = crandom() * 4; p->accel[1] = crandom() * 4; - } //Makro - snow @@ -2148,7 +2153,10 @@ void CG_ParticleHitSnow(vec3_t org, vec3_t vel, int duration, float x, float y, cparticle_t *p; if (!free_particles) + { + CG_Printf(S_COLOR_RED "No particles left for sparks!!!\n"); return; + } p = free_particles; free_particles = p->next; p->next = active_particles; @@ -2188,7 +2196,6 @@ void CG_ParticleHitSnow(vec3_t org, vec3_t vel, int duration, float x, float y, p->vel[0] += (crandom() * 8); p->vel[1] += (crandom() * 8); //p->vel[2] += (20 + (crandom() * 10)) * speed; - } //Makro - grass diff --git a/reaction/cgame/cg_particles.c b/reaction/cgame/cg_particles.c index dffc9764..e9f555e5 100644 --- a/reaction/cgame/cg_particles.c +++ b/reaction/cgame/cg_particles.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.8 2006/04/14 18:16:31 makro +// no message +// // Revision 1.7 2003/03/29 18:53:41 jbravo // Fixed ammo bug when dropping bandolier. Added color to more errormessages // @@ -1745,6 +1748,7 @@ void CG_ParticleSparks(vec3_t org, vec3_t vel, int duration, float x, float y, f if (!free_particles) return; + p = free_particles; free_particles = p->next; p->next = active_particles; @@ -1784,7 +1788,6 @@ void CG_ParticleSparks(vec3_t org, vec3_t vel, int duration, float x, float y, f p->accel[0] = crandom() * 4; p->accel[1] = crandom() * 4; - } void CG_ParticleDust(centity_t * cent, vec3_t origin, vec3_t dir) diff --git a/reaction/cgame/cgame.dsp b/reaction/cgame/cgame.dsp index 9c0fb6d7..b28d2fa0 100644 --- a/reaction/cgame/cgame.dsp +++ b/reaction/cgame/cgame.dsp @@ -40,7 +40,7 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "D:\Work\rq3source\reaction\Release" +# PROP Output_Dir "D:\games\quake3\reaction" # PROP Intermediate_Dir "D:\Work\rq3source\reaction\Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" @@ -67,7 +67,7 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" +# PROP Output_Dir "D:\games\quake3\reaction" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" @@ -82,7 +82,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /base:"0x30000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"D:\Work\rq3source\reaction\Release\cgamex86.dll" +# ADD LINK32 /nologo /base:"0x30000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"D:\Games\Quake3\Reaction\cgamex86.dll" # SUBTRACT LINK32 /profile /nodefaultlib !ELSEIF "$(CFG)" == "cgame - Win32 Release TA" diff --git a/reaction/cgame/cgame.plg b/reaction/cgame/cgame.plg index 66748623..130e0ba2 100644 --- a/reaction/cgame/cgame.plg +++ b/reaction/cgame/cgame.plg @@ -3,56 +3,149 @@
 

Build Log

---------------------Configuration: cgame - Win32 Debug-------------------- +--------------------Configuration: cgame - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP3C.tmp" with contents +Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP13C.tmp" with contents [ -/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"Debug/" /Fp"Debug/cgame.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c +/nologo /G6 /ML /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"D:\Work\rq3source\reaction\Release/" /Fp"D:\Work\rq3source\reaction\Release/cgame.pch" /YX /Fo"D:\Work\rq3source\reaction\Release/" /Fd"D:\Work\rq3source\reaction\Release/" /FD /c +"D:\Work\rq3source\reaction\game\bg_misc.c" +"D:\Work\rq3source\reaction\game\bg_pmove.c" +"D:\Work\rq3source\reaction\game\bg_slidemove.c" +"D:\Work\rq3source\reaction\cgame\cg_atmospheric.c" +"D:\Work\rq3source\reaction\cgame\cg_consolecmds.c" +"D:\Work\rq3source\reaction\cgame\cg_draw.c" +"D:\Work\rq3source\reaction\cgame\cg_drawtools.c" +"D:\Work\rq3source\reaction\cgame\cg_effects.c" +"D:\Work\rq3source\reaction\cgame\cg_ents.c" +"D:\Work\rq3source\reaction\cgame\cg_event.c" +"D:\Work\rq3source\reaction\cgame\cg_info.c" +"D:\Work\rq3source\reaction\cgame\cg_localents.c" +"D:\Work\rq3source\reaction\cgame\cg_main.c" +"D:\Work\rq3source\reaction\cgame\cg_marks.c" +"D:\Work\rq3source\reaction\cgame\cg_players.c" +"D:\Work\rq3source\reaction\cgame\cg_playerstate.c" +"D:\Work\rq3source\reaction\cgame\cg_predict.c" +"D:\Work\rq3source\reaction\cgame\cg_scoreboard.c" +"D:\Work\rq3source\reaction\cgame\cg_servercmds.c" +"D:\Work\rq3source\reaction\cgame\cg_snapshot.c" +"D:\Work\rq3source\reaction\cgame\cg_syscalls.c" +"D:\Work\rq3source\reaction\cgame\cg_unlagged.c" "D:\Work\rq3source\reaction\cgame\cg_view.c" +"D:\Work\rq3source\reaction\cgame\cg_weapons.c" +"D:\Work\rq3source\reaction\game\q_math.c" +"D:\Work\rq3source\reaction\game\q_shared.c" +"D:\Work\rq3source\reaction\ui\ui_shared.c" ] -Creating command line "cl.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP3C.tmp" -Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP3D.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP13C.tmp" +Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP13D.tmp" with contents [ -/nologo /base:"0x30000000" /subsystem:windows /dll /incremental:yes /pdb:"Debug/cgamex86.pdb" /map:"Debug/cgamex86.map" /debug /machine:I386 /def:".\cgame.def" /out:"D:\Work\rq3source\reaction\Release\cgamex86.dll" /implib:"Debug/cgamex86.lib" -.\Debug\bg_misc.obj -.\Debug\bg_pmove.obj -.\Debug\bg_slidemove.obj -.\Debug\cg_atmospheric.obj -.\Debug\cg_consolecmds.obj -.\Debug\cg_draw.obj -.\Debug\cg_drawtools.obj -.\Debug\cg_effects.obj -.\Debug\cg_ents.obj -.\Debug\cg_event.obj -.\Debug\cg_info.obj -.\Debug\cg_localents.obj -.\Debug\cg_main.obj -.\Debug\cg_marks.obj -.\Debug\cg_players.obj -.\Debug\cg_playerstate.obj -.\Debug\cg_predict.obj -.\Debug\cg_scoreboard.obj -.\Debug\cg_servercmds.obj -.\Debug\cg_snapshot.obj -.\Debug\cg_syscalls.obj -.\Debug\cg_unlagged.obj -.\Debug\cg_view.obj -.\Debug\cg_weapons.obj -.\Debug\q_math.obj -.\Debug\q_shared.obj -.\Debug\ui_shared.obj +/nologo /base:"0x30000000" /subsystem:windows /dll /incremental:no /pdb:"D:\Work\rq3source\reaction\Release/cgamex86.pdb" /map:"D:\Work\rq3source\reaction\Release/cgamex86.map" /machine:I386 /def:".\cgame.def" /out:"D:\Work\rq3source\reaction\Release\cgamex86.dll" /implib:"D:\Work\rq3source\reaction\Release/cgamex86.lib" +\Work\rq3source\reaction\Release\bg_misc.obj +\Work\rq3source\reaction\Release\bg_pmove.obj +\Work\rq3source\reaction\Release\bg_slidemove.obj +\Work\rq3source\reaction\Release\cg_atmospheric.obj +\Work\rq3source\reaction\Release\cg_consolecmds.obj +\Work\rq3source\reaction\Release\cg_draw.obj +\Work\rq3source\reaction\Release\cg_drawtools.obj +\Work\rq3source\reaction\Release\cg_effects.obj +\Work\rq3source\reaction\Release\cg_ents.obj +\Work\rq3source\reaction\Release\cg_event.obj +\Work\rq3source\reaction\Release\cg_info.obj +\Work\rq3source\reaction\Release\cg_localents.obj +\Work\rq3source\reaction\Release\cg_main.obj +\Work\rq3source\reaction\Release\cg_marks.obj +\Work\rq3source\reaction\Release\cg_players.obj +\Work\rq3source\reaction\Release\cg_playerstate.obj +\Work\rq3source\reaction\Release\cg_predict.obj +\Work\rq3source\reaction\Release\cg_scoreboard.obj +\Work\rq3source\reaction\Release\cg_servercmds.obj +\Work\rq3source\reaction\Release\cg_snapshot.obj +\Work\rq3source\reaction\Release\cg_syscalls.obj +\Work\rq3source\reaction\Release\cg_unlagged.obj +\Work\rq3source\reaction\Release\cg_view.obj +\Work\rq3source\reaction\Release\cg_weapons.obj +\Work\rq3source\reaction\Release\q_math.obj +\Work\rq3source\reaction\Release\q_shared.obj +\Work\rq3source\reaction\Release\ui_shared.obj ] -Creating command line "link.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP3D.tmp" +Creating command line "link.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP13D.tmp"

Output Window

Compiling... +bg_misc.c +bg_pmove.c +bg_slidemove.c +cg_atmospheric.c +cg_consolecmds.c +D:\Work\rq3source\reaction\cgame\cg_atmospheric.c(626) : warning C4706: assignment within conditional expression +D:\Work\rq3source\reaction\cgame\cg_atmospheric.c(638) : warning C4706: assignment within conditional expression +D:\Work\rq3source\reaction\cgame\cg_atmospheric.c(184) : warning C4701: local variable 'tr' may be used without having been initialized +D:\Work\rq3source\reaction\cgame\cg_atmospheric.c(334) : warning C4701: local variable 'tr' may be used without having been initialized +cg_draw.c +cg_drawtools.c +D:\Work\rq3source\reaction\cgame\cg_draw.c(1977) : warning C4706: assignment within conditional expression +cg_effects.c +cg_ents.c +cg_event.c +cg_info.c +cg_localents.c +cg_main.c +cg_marks.c +cg_players.c +cg_playerstate.c +cg_predict.c +cg_scoreboard.c +D:\Work\rq3source\reaction\cgame\cg_predict.c(813) : warning C4701: local variable 'predictCmd' may be used without having been initialized +D:\Work\rq3source\reaction\cgame\cg_predict.c(817) : warning C4701: local variable 'stateIndex' may be used without having been initialized +cg_servercmds.c +cg_snapshot.c +cg_syscalls.c +cg_unlagged.c cg_view.c +cg_weapons.c +q_math.c +q_shared.c +ui_shared.c Linking... + Creating library D:\Work\rq3source\reaction\Release/cgamex86.lib and object D:\Work\rq3source\reaction\Release/cgamex86.exp +Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP141.tmp" with contents +[ +/nologo /o"D:\Work\rq3source\reaction\Release/cgame.bsc" +\Work\rq3source\reaction\Release\bg_misc.sbr +\Work\rq3source\reaction\Release\bg_pmove.sbr +\Work\rq3source\reaction\Release\bg_slidemove.sbr +\Work\rq3source\reaction\Release\cg_atmospheric.sbr +\Work\rq3source\reaction\Release\cg_consolecmds.sbr +\Work\rq3source\reaction\Release\cg_draw.sbr +\Work\rq3source\reaction\Release\cg_drawtools.sbr +\Work\rq3source\reaction\Release\cg_effects.sbr +\Work\rq3source\reaction\Release\cg_ents.sbr +\Work\rq3source\reaction\Release\cg_event.sbr +\Work\rq3source\reaction\Release\cg_info.sbr +\Work\rq3source\reaction\Release\cg_localents.sbr +\Work\rq3source\reaction\Release\cg_main.sbr +\Work\rq3source\reaction\Release\cg_marks.sbr +\Work\rq3source\reaction\Release\cg_players.sbr +\Work\rq3source\reaction\Release\cg_playerstate.sbr +\Work\rq3source\reaction\Release\cg_predict.sbr +\Work\rq3source\reaction\Release\cg_scoreboard.sbr +\Work\rq3source\reaction\Release\cg_servercmds.sbr +\Work\rq3source\reaction\Release\cg_snapshot.sbr +\Work\rq3source\reaction\Release\cg_syscalls.sbr +\Work\rq3source\reaction\Release\cg_unlagged.sbr +\Work\rq3source\reaction\Release\cg_view.sbr +\Work\rq3source\reaction\Release\cg_weapons.sbr +\Work\rq3source\reaction\Release\q_math.sbr +\Work\rq3source\reaction\Release\q_shared.sbr +\Work\rq3source\reaction\Release\ui_shared.sbr] +Creating command line "bscmake.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP141.tmp" +Creating browse info file... +

Output Window

Results

-cgamex86.dll - 0 error(s), 0 warning(s) +cgamex86.dll - 0 error(s), 7 warning(s)
diff --git a/reaction/game/bg_misc.c b/reaction/game/bg_misc.c index efce968e..eee546ab 100644 --- a/reaction/game/bg_misc.c +++ b/reaction/game/bg_misc.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.58 2006/04/14 18:15:45 makro +// no message +// // Revision 1.57 2005/09/07 20:27:41 makro // Entity attachment trees // @@ -1734,3 +1737,75 @@ int GetIntBytes(char *buf, char count) return rez; } +/* +==================================================== +IdMatchesString + +Returns 1 if any of the tokens in the first string +matches any of the tokens in the second string + +Added by Makro +==================================================== +*/ + +#define IS_DELIM(x) ((x)==',' || (x)==' ' || (x)=='\t') +#define SKIP_DELIM(s) while (IS_DELIM(*(s))) (s)++ + +qboolean IdMatchesString(const char *id, const char *match) +{ + const char *tok1, *tok2; + + // iterate through all the tokens in "id" + while (id && *id) + { + int len1; + const char *tomatch = match; + + // find the end of the current token + for (tok1=id, len1=0; *tok1 && !IS_DELIM(*tok1); tok1++, len1++) {} + // skip all delimiters + SKIP_DELIM(tok1); + + // iterate through all the tokens in "match" + while (match && *match) + { + int len2; + char ok = 1; + + // find the end of the current token + for (tok2=match, len2=0; *tok2 && !IS_DELIM(*tok2); tok2++, len2++) + { + if (ok) + if (len2 > len1 || toupper(*tok2) != toupper(id[len2])) + ok = 0; + } + // skip all delimiters + SKIP_DELIM(tok2); + + if (len1 == len2 && ok) + return qtrue; + // fetch next token in "match" + match = tok2; + } + // restore "match" string + match = tomatch; + + // fetch next token in "id" + id = tok1; + } + return qfalse; +} + + +float SawTooth(int time, int period) +{ + if (period <= 0) + return 0; + else + { + if ((time / period) & 1) + return (time % period) / ((float)period); + else + return 1.0f - (time % period) / ((float)period); + } +} diff --git a/reaction/game/bg_public.h b/reaction/game/bg_public.h index 3f2863a9..09bda674 100644 --- a/reaction/game/bg_public.h +++ b/reaction/game/bg_public.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.113 2006/04/14 18:15:45 makro +// no message +// // Revision 1.112 2005/09/13 03:11:08 jbravo // Dead players cant use unzoom or weapon commands // @@ -1585,3 +1588,15 @@ char *Q_strins(char *dest, char *s, int size); void SetIntBytes(int i, char *buf, char count); int GetIntBytes(char *buf, char count); +//Makro - returns true if any of the tokens in the first string +//matches any of the tokens in the second string +qboolean IdMatchesString(const char *id, const char *match); + + +float SawTooth(int time, int period); + +#define PULSE_SAWTOOTH_PERIOD 500 +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) + +#define INFINITE_LOOP for (;;) + diff --git a/reaction/game/g_main.c b/reaction/game/g_main.c index 639f853f..f760f038 100644 --- a/reaction/game/g_main.c +++ b/reaction/game/g_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.153 2006/04/14 18:15:45 makro +// no message +// // Revision 1.152 2005/09/13 02:33:17 jbravo // Adding new callvote gametype:map // @@ -440,6 +443,8 @@ #include "zcam.h" #include "q_shared.h" +#include "g_scripts.h" + int trap_RealTime(qtime_t * qtime); gentity_t *getEntByName(char *name); void AddIP(char *str); @@ -1490,6 +1495,8 @@ void G_InitGame(int levelTime, int randomSeed, int restart) //Makro - moveparents stuff G_InitMoveParents(); G_SetMoveParentOrder(); + + G_ParseScript("main_test.ini"); } /* diff --git a/reaction/game/g_parser.c b/reaction/game/g_parser.c index 4f184e38..4f08045b 100644 --- a/reaction/game/g_parser.c +++ b/reaction/game/g_parser.c @@ -18,7 +18,7 @@ char *Script_GetToken(char **str) if (!**str) return NULL; - if ( inQuotes = (**str == '\"')) + if ( (inQuotes = (**str == '\"')) ) (*str)++; ret = *str; @@ -86,7 +86,7 @@ TParseFunc Script_FindHandler(char *token, TParseState* state) for (ptr = state->hashTable[index]; ptr; ptr = ptr->next) { - if (stricmp(token, ptr->keyword) == 0) + if (Q_stricmp(token, ptr->keyword) == 0) return ptr->handler; } return NULL; @@ -99,6 +99,54 @@ ID_INLINE void Script_InitStateStack(TStateStack *stack) } +int Script_PushState(TStateStack *stack, TParseState *state) +{ + if (stack->top >= STATE_STACK_SIZE) + { + SCRIPT_INFO(SHOW_ERROR) + G_Printf("* ERROR: Stack overflow before %s.\n", (state) ? state->name : "[UNKNOWN]"); + END_SCRIPT_INFO(); + return 0; + } + stack->states[stack->top++] = state; + + return 1; +} + +int Script_GetTopState(const TStateStack *stack, TParseState **state) +{ + if (!state) + return 1; + if (stack->top < 0 || stack->top >= STATE_STACK_SIZE) + { + *state = NULL; + SCRIPT_INFO(SHOW_ERROR) + G_Printf("* ERROR: Stack index out of bounds (%d).\n", stack->top); + END_SCRIPT_INFO(); + return 0; + } + + *state = stack->states[stack->top-1]; + return 1; +} + +int Script_PopState(TStateStack *stack, TParseState **state) +{ + stack->top--; + if (stack->top < 0) + { + SCRIPT_INFO(SHOW_ERROR) + G_Printf("* ERROR: Stack underflow before %s.\n", (stack->states[0]) ? ((TParseState*)stack->states[0])->name : "[UNKNOWN]"); + END_SCRIPT_INFO(); + if (state) + *state = NULL; + return 0; + } + if (state) + *state = stack->states[stack->top]; + return 1; +} + void Script_ParseString(char *str, TParseState *baseState) { char *token = NULL; @@ -141,7 +189,7 @@ SCRIPT_FUNC(SFN_SkipComment) char *token; while ( (token = Script_GetToken(SCRIPT_INPUT)) != NULL) { - if (stricmp(token, "*/") == 0) + if (Q_stricmp(token, "*/") == 0) return 1; } SCRIPT_INFO(SHOW_ERROR) diff --git a/reaction/game/g_parser.h b/reaction/game/g_parser.h index a3db89a1..7d7ca94f 100644 --- a/reaction/game/g_parser.h +++ b/reaction/game/g_parser.h @@ -25,13 +25,15 @@ typedef struct _TParseRule struct _TParseRule *next; } TParseRule; +#define MAX_RULES_IN_STATE 32 + typedef struct { const char *name; void *data; int initialized; TParseRule *hashTable[SCRIPT_HASH_SIZE]; - TParseRule rules[]; + TParseRule rules[MAX_RULES_IN_STATE]; } TParseState; #define SCRIPT_STATE(name, data)\ @@ -99,54 +101,9 @@ extern int SCRIPT_SHOW_LEVEL; /////////////////////////////////////////////////////////////// -ID_INLINE int Script_PushState(TStateStack *stack, TParseState *state) -{ - if (stack->top >= STATE_STACK_SIZE) - { - SCRIPT_INFO(SHOW_ERROR) - G_Printf("* ERROR: Stack overflow before %s.\n", (state) ? state->name : "[UNKNOWN]"); - END_SCRIPT_INFO(); - return 0; - } - stack->states[stack->top++] = state; - - return 1; -} - -ID_INLINE int Script_GetTopState(const TStateStack *stack, TParseState **state) -{ - if (!state) - return 1; - if (stack->top < 0 || stack->top >= STATE_STACK_SIZE) - { - *state = NULL; - SCRIPT_INFO(SHOW_ERROR) - G_Printf("* ERROR: Stack index out of bounds (%d).\n", stack->top); - END_SCRIPT_INFO(); - return 0; - } - - *state = stack->states[stack->top-1]; - return 1; -} - -ID_INLINE int Script_PopState(TStateStack *stack, TParseState **state) -{ - stack->top--; - if (stack->top < 0) - { - SCRIPT_INFO(SHOW_ERROR) - G_Printf("* ERROR: Stack underflow before %s.\n", (stack->states[0]) ? ((TParseState*)stack->states[0])->name : "[UNKNOWN]"); - END_SCRIPT_INFO(); - if (state) - *state = NULL; - return 0; - } - if (state) - *state = stack->states[stack->top]; - return 1; -} - +int Script_PushState(TStateStack *stack, TParseState *state); +int Script_GetTopState(const TStateStack *stack, TParseState **state); +int Script_PopState(TStateStack *stack, TParseState **state); char* Script_GetToken(char **str); TParseFunc Script_FindHandler(char *token, TParseState *state); @@ -173,4 +130,4 @@ SCRIPT_FUNC_PROTO(SFN_PopState); /////////////////////////////////////////////////////////////// -#endif //_G_PARSER_H_ \ No newline at end of file +#endif //_G_PARSER_H_ diff --git a/reaction/game/g_scripts.h b/reaction/game/g_scripts.h index 60e3c31c..d805b1cc 100644 --- a/reaction/game/g_scripts.h +++ b/reaction/game/g_scripts.h @@ -1,2 +1,3 @@ -void G_ParseScript(const char *fname); \ No newline at end of file +void G_ParseScript(const char *fname); + diff --git a/reaction/game/g_utils.c b/reaction/game/g_utils.c index a5fc34ba..93b8830f 100644 --- a/reaction/game/g_utils.c +++ b/reaction/game/g_utils.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.26 2006/04/14 18:15:45 makro +// no message +// // Revision 1.25 2005/02/15 16:33:39 makro // Tons of updates (entity tree attachment system, UI vectors) // @@ -248,8 +251,16 @@ gentity_t *G_Find2(gentity_t * from, int fieldofs, const char *match, int fieldo return NULL; } +/* +==================================================== +MatchesId + +Added by Makro +==================================================== +*/ qboolean MatchesId(gentity_t *ent, const char *ids) { +#if 0 char tmp_alias[128]={0}, tmp_ids[128]={0}, *pi; if (!ent || !ids) @@ -302,6 +313,14 @@ qboolean MatchesId(gentity_t *ent, const char *ids) *sep = ','; } return qfalse; +#else + if (!ent || !ids) + return qfalse; + return + IdMatchesString(ent->targetname, ids) || + IdMatchesString(ent->activatename, ids) || + IdMatchesString(ent->alias, ids); +#endif } diff --git a/reaction/game/game.dsp b/reaction/game/game.dsp index 6f76781f..44af1392 100644 --- a/reaction/game/game.dsp +++ b/reaction/game/game.dsp @@ -38,7 +38,7 @@ RSC=rc.exe # PROP BASE Target_Dir "." # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "D:\Work\rq3source\reaction\Release" +# PROP Output_Dir "D:\games\quake3\reaction" # PROP Intermediate_Dir "D:\Work\rq3source\reaction\Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "." @@ -65,7 +65,7 @@ LINK32=link.exe # PROP BASE Target_Dir "." # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "d:\games\quake3\reaction" +# PROP Output_Dir "D:\games\quake3\reaction" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "." diff --git a/reaction/game/game.plg b/reaction/game/game.plg index ece4cd36..51cd1565 100644 --- a/reaction/game/game.plg +++ b/reaction/game/game.plg @@ -6,16 +6,56 @@ --------------------Configuration: game - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP451.tmp" with contents +Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP43B.tmp" with contents [ /nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "BUILDING_REF_GL" /D "DEBUG" /FR"Debug/" /Fp"Debug/game.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c +"D:\Work\rq3source\reaction\game\ai_chat.c" +"D:\Work\rq3source\reaction\game\ai_cmd.c" +"D:\Work\rq3source\reaction\game\ai_dmnet.c" +"D:\Work\rq3source\reaction\game\ai_dmq3.c" +"D:\Work\rq3source\reaction\game\ai_main.c" +"D:\Work\rq3source\reaction\game\ai_team.c" +"D:\Work\rq3source\reaction\game\ai_vcmd.c" +"D:\Work\rq3source\reaction\game\bg_misc.c" +"D:\Work\rq3source\reaction\game\bg_pmove.c" +"D:\Work\rq3source\reaction\game\bg_slidemove.c" +"D:\Work\rq3source\reaction\game\g_active.c" +"D:\Work\rq3source\reaction\game\g_arenas.c" +"D:\Work\rq3source\reaction\game\g_bot.c" +"D:\Work\rq3source\reaction\game\g_client.c" +"D:\Work\rq3source\reaction\game\g_cmds.c" +"D:\Work\rq3source\reaction\game\g_combat.c" +"D:\Work\rq3source\reaction\game\g_fileio.c" +"D:\Work\rq3source\reaction\game\g_items.c" +"D:\Work\rq3source\reaction\game\g_main.c" +"D:\Work\rq3source\reaction\game\g_matchmode.c" +"D:\Work\rq3source\reaction\game\g_mem.c" +"D:\Work\rq3source\reaction\game\g_misc.c" +"D:\Work\rq3source\reaction\game\g_missile.c" +"D:\Work\rq3source\reaction\game\g_mover.c" "D:\Work\rq3source\reaction\game\g_parser.c" "D:\Work\rq3source\reaction\game\g_scripts.c" +"D:\Work\rq3source\reaction\game\g_session.c" +"D:\Work\rq3source\reaction\game\g_spawn.c" +"D:\Work\rq3source\reaction\game\g_svcmds.c" +"D:\Work\rq3source\reaction\game\g_syscalls.c" +"D:\Work\rq3source\reaction\game\g_target.c" +"D:\Work\rq3source\reaction\game\g_team.c" +"D:\Work\rq3source\reaction\game\g_teamplay.c" +"D:\Work\rq3source\reaction\game\g_trigger.c" +"D:\Work\rq3source\reaction\game\g_unlagged.c" +"D:\Work\rq3source\reaction\game\g_utils.c" +"D:\Work\rq3source\reaction\game\g_weapon.c" +"D:\Work\rq3source\reaction\game\q_math.c" +"D:\Work\rq3source\reaction\game\q_shared.c" +"D:\Work\rq3source\reaction\game\rxn_game.c" +"D:\Work\rq3source\reaction\game\zcam.c" +"D:\Work\rq3source\reaction\game\zcam_target.c" ] -Creating command line "cl.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP451.tmp" -Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP452.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP43B.tmp" +Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP43C.tmp" with contents [ -kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:yes /pdb:"d:\games\quake3\reaction/qagamex86.pdb" /map:"Debug/qagamex86.map" /debug /machine:I386 /def:".\game.def" /out:"D:\Work\rq3source\reaction\Release\qagamex86.dll" /implib:"d:\games\quake3\reaction/qagamex86.lib" +kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:yes /pdb:"D:\games\quake3\reaction/qagamex86.pdb" /map:"Debug/qagamex86.map" /debug /machine:I386 /def:".\game.def" /out:"D:\Work\rq3source\reaction\Release\qagamex86.dll" /implib:"D:\games\quake3\reaction/qagamex86.lib" .\Debug\ai_chat.obj .\Debug\ai_cmd.obj .\Debug\ai_dmnet.obj @@ -59,15 +99,57 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows .\Debug\zcam.obj .\Debug\zcam_target.obj ] -Creating command line "link.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP452.tmp" +Creating command line "link.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP43C.tmp"

Output Window

Compiling... +ai_chat.c +ai_cmd.c +ai_dmnet.c +ai_dmq3.c +ai_main.c +ai_team.c +ai_vcmd.c +bg_misc.c +bg_pmove.c +bg_slidemove.c +g_active.c +g_arenas.c +g_bot.c +g_client.c +g_cmds.c +g_combat.c +g_fileio.c +D:\Work\rq3source\reaction\game\g_combat.c(2034) : warning C4700: local variable 'asave' used without having been initialized +g_items.c +g_main.c +g_matchmode.c +g_mem.c +g_misc.c +g_missile.c +g_mover.c g_parser.c g_scripts.c +g_session.c +g_spawn.c +g_svcmds.c +g_syscalls.c +g_target.c +g_team.c +g_teamplay.c +g_trigger.c +g_unlagged.c +g_utils.c +g_weapon.c +q_math.c +q_shared.c +rxn_game.c +zcam.c +zcam_target.c Linking... -Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP453.tmp" with contents + Creating library D:\games\quake3\reaction/qagamex86.lib and object D:\games\quake3\reaction/qagamex86.exp +Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP440.tmp" with contents [ -/nologo /o"d:\games\quake3\reaction/game.bsc" +/nologo /o"D:\games\quake3\reaction/game.bsc" .\Debug\ai_chat.sbr .\Debug\ai_cmd.sbr .\Debug\ai_dmnet.sbr @@ -110,14 +192,14 @@ Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP453.tmp" with conte .\Debug\rxn_game.sbr .\Debug\zcam.sbr .\Debug\zcam_target.sbr] -Creating command line "bscmake.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP453.tmp" +Creating command line "bscmake.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP440.tmp" Creating browse info file...

Output Window

Results

-qagamex86.dll - 0 error(s), 0 warning(s) +qagamex86.dll - 0 error(s), 1 warning(s) diff --git a/reaction/game/game.q3asm b/reaction/game/game.q3asm index 2187e02c..5e21c84d 100644 --- a/reaction/game/game.q3asm +++ b/reaction/game/game.q3asm @@ -26,6 +26,8 @@ g_mem g_misc g_missile g_mover +g_parser +g_scripts g_session g_spawn g_svcmds