From 2f9d62a40a337df1ccd9b04e226a89a5f3c79903 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 13 May 2020 08:50:13 +0200 Subject: [PATCH] - the last simple ones. --- source/games/duke/src/gamedef.cpp | 5 + source/games/duke/src/savegame.h | 1 - source/games/duke/src/zz_gamedef.cpp | 238 ++++---------------------- source/games/duke/src/zz_savegame.cpp | 27 --- 4 files changed, 39 insertions(+), 232 deletions(-) diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 0a6d9da9a..5d777955b 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -1697,6 +1697,7 @@ int parsecommand(int tw) // for now just run an externally parsed command. } return 0; +#endif case concmd_enda: if (parsing_actor == 0) @@ -1751,7 +1752,11 @@ int parsecommand(int tw) // for now just run an externally parsed command. case concmd_garybanjo: case concmd_motoloopsnd: case concmd_rndmove: + //case concmd_leavetrax: // RRDH + //case concmd_leavedroppings: + //case concmd_deploybias: return 0; +#if 0 case concmd_gamestartup: { #if 0 // cannot be activated before the old CON code is tossed. diff --git a/source/games/duke/src/savegame.h b/source/games/duke/src/savegame.h index a09c89cca..90e6f89d9 100644 --- a/source/games/duke/src/savegame.h +++ b/source/games/duke/src/savegame.h @@ -77,7 +77,6 @@ enum P2I_BACK_NON0 = 1+2, }; void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode); -void G_Util_PtrToIdx2(void *ptr, int32_t count, size_t stride, const void *base, int32_t const mode); END_DUKE_NS diff --git a/source/games/duke/src/zz_gamedef.cpp b/source/games/duke/src/zz_gamedef.cpp index ce89b4bf5..b9239e447 100644 --- a/source/games/duke/src/zz_gamedef.cpp +++ b/source/games/duke/src/zz_gamedef.cpp @@ -82,31 +82,6 @@ extern intptr_t parsing_actor; static intptr_t g_scriptEventOffset; extern char *textptr; -static char *C_GetLabelType(int32_t type) -{ - int32_t i; - char x[64]; - - const char *LabelTypeText[] = - { - "define", - "state", - "actor", - "action", - "ai", - "move" - }; - - x[0] = 0; - for (i=0; i<6; i++) - { - if (!(type & (1<= 0; i--) - { - if (apScript[i] >= (intptr_t)&apScript[0] && apScript[i] < (intptr_t)&apScript[g_scriptSize]) - { - scriptptrs[i] = 1; - apScript[i] -= (intptr_t)&apScript[0]; - } - else scriptptrs[i] = 0; - } - - G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_FWD_NON0); - G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_FWD_NON0); - - newscript = (intptr_t *)Xrealloc(apScript, newsize * sizeof(intptr_t)); - - if (newsize >= osize) - { - Bmemset(&newscript[0]+osize,0,(newsize-osize) * sizeof(uint8_t)); - } - - if (apScript != newscript) - { - buildprint("Relocating compiled code from to 0x", hex((intptr_t)apScript), " to 0x", hex((intptr_t)newscript), "\n"); - apScript = newscript; - } - - g_scriptSize = newsize; - scriptptr = apScript + (intptr_t)scriptptr - oscript; - - if (g_caseScriptPtr) - g_caseScriptPtr = apScript + (intptr_t)g_caseScriptPtr - oscript; - - for (i=(((newsize>=osize)?osize:newsize))-1; i>=0; i--) - if (scriptptrs[i]) - { - j = (intptr_t)apScript[i]+(intptr_t)&apScript[0]; - apScript[i] = j; - } - - G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0); - G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0); - - Xfree(scriptptrs); -#endif return 0; } @@ -639,14 +561,6 @@ static int32_t C_GetNextValue_() { //if (EDUKE32_PREDICT_TRUE(labeltype[i] & type)) { -#if 0 - if (!(errorcount || warningcount) && g_scriptDebug > 1) - { - char *gl = C_GetLabelType(labeltype[i]); - Printf("%s:%d: debug: %s label `%s'.\n",g_scriptFileName,line_number,gl,label+(i<<6)); - Xfree(gl); - } -#endif BITPTR_CLEAR(scriptptr-apScript); *(scriptptr++) = labelcode[i]; @@ -654,20 +568,6 @@ static int32_t C_GetNextValue_() textptr += l; return 0;// labeltype[i]; } - -#if 0 - BITPTR_CLEAR(scriptptr-apScript); - *(scriptptr++) = 0; - textptr += l; - char *el = C_GetLabelType(type); - char *gl = C_GetLabelType(/*labeltype[i]*/0); - C_ReportError(-1); - Printf("%s:%d: warning: expected %s, found %s.\n",g_scriptFileName,line_number,el,gl); - warningcount++; - Xfree(el); - Xfree(gl); - return -1; // valid label name, but wrong type -#endif } if (EDUKE32_PREDICT_FALSE(isdigit(*textptr) == 0 && *textptr != '-')) @@ -1062,6 +962,40 @@ int32_t C_ParseCommand(int32_t loop) case concmd_definelevelname: case concmd_definequote: case concmd_definesound: + case concmd_enda: + case concmd_break: + case concmd_fall: + case concmd_tip: + case concmd_killit: + case concmd_resetactioncount: + case concmd_pstomp: + case concmd_resetplayer: + case concmd_resetcount: + case concmd_wackplayer: + case concmd_operate: + case concmd_respawnhitag: + case concmd_getlastpal: + case concmd_pkick: + case concmd_mikesnd: + case concmd_tossweapon: + case concmd_destroyit: + case concmd_larrybird: + case concmd_strafeleft: + case concmd_straferight: + case concmd_slapplayer: + case concmd_tearitup: + case concmd_smackbubba: + case concmd_soundtagonce: + case concmd_soundtag: + case concmd_smacksprite: + case concmd_fakebubba: + case concmd_mamatrigger: + case concmd_mamaspawn: + case concmd_mamaquake: + case concmd_mamaend: + case concmd_garybanjo: + case concmd_motoloopsnd: + case concmd_rndmove: if (parsecommand(g_lastKeyword)) return 1; continue; @@ -1338,75 +1272,6 @@ ifvar: Bsprintf(g_szCurrentBlockName,"(none)"); continue; - case concmd_enda: - if (EDUKE32_PREDICT_FALSE(!parsing_actor || g_scriptEventOffset)) - { - C_ReportError(-1); - Printf("%s:%d: error: found `enda' without open `actor'.\n",g_scriptFileName,line_number); - errorcount++; - g_scriptEventOffset = 0; - } - if (EDUKE32_PREDICT_FALSE(num_squigilly_brackets != 0)) - { - C_ReportError(num_squigilly_brackets > 0 ? ERROR_OPENBRACKET : ERROR_CLOSEBRACKET); - errorcount++; - } - parsing_actor = 0; - Bsprintf(g_szCurrentBlockName,"(none)"); - continue; - - case concmd_break: - continue; - - case concmd_fall: - case concmd_tip: - // case 21: - case concmd_killit: - case concmd_resetactioncount: - case concmd_pstomp: - case concmd_resetplayer: - case concmd_resetcount: - case concmd_wackplayer: - case concmd_operate: - case concmd_respawnhitag: - case concmd_getlastpal: - case concmd_pkick: - case concmd_mikesnd: - case concmd_tossweapon: - case concmd_destroyit: - case concmd_larrybird: - case concmd_strafeleft: - case concmd_straferight: - case concmd_slapplayer: - case concmd_tearitup: - case concmd_smackbubba: - case concmd_soundtagonce: - case concmd_soundtag: - case concmd_smacksprite: - case concmd_fakebubba: - case concmd_mamatrigger: - case concmd_mamaspawn: - case concmd_mamaquake: - case concmd_mamaend: - case concmd_garybanjo: - case concmd_motoloopsnd: - case concmd_rndmove: - //case CON_LEAVETRAX: - //case CON_LEAVEDROPPINGS: - //case CON_DEPLOYBIAS: - continue; - - case concmd_nullop: - if (EDUKE32_PREDICT_FALSE(C_GetKeyword() != concmd_else)) - { - C_ReportError(-1); - warningcount++; - Printf("%s:%d: warning: `nullop' found without `else'\n",g_scriptFileName,line_number); - scriptptr--; - g_skipBranch = 1; - } - continue; - case concmd_gamestartup: { int32_t params[34]; @@ -1435,41 +1300,6 @@ ifvar: /*else g_scriptVersion = 16;*/ } - - /* - v1.3d v1.5 - DEFAULTVISIBILITY DEFAULTVISIBILITY - GENERICIMPACTDAMAGE GENERICIMPACTDAMAGE - MAXPLAYERHEALTH MAXPLAYERHEALTH - STARTARMORHEALTH STARTARMORHEALTH - RESPAWNACTORTIME RESPAWNACTORTIME - RESPAWNITEMTIME RESPAWNITEMTIME - RUNNINGSPEED RUNNINGSPEED - RPGBLASTRADIUS GRAVITATIONALCONSTANT - PIPEBOMBRADIUS RPGBLASTRADIUS - SHRINKERBLASTRADIUS PIPEBOMBRADIUS - TRIPBOMBBLASTRADIUS SHRINKERBLASTRADIUS - MORTERBLASTRADIUS TRIPBOMBBLASTRADIUS - BOUNCEMINEBLASTRADIUS MORTERBLASTRADIUS - SEENINEBLASTRADIUS BOUNCEMINEBLASTRADIUS - MAXPISTOLAMMO SEENINEBLASTRADIUS - MAXSHOTGUNAMMO MAXPISTOLAMMO - MAXCHAINGUNAMMO MAXSHOTGUNAMMO - MAXRPGAMMO MAXCHAINGUNAMMO - MAXHANDBOMBAMMO MAXRPGAMMO - MAXSHRINKERAMMO MAXHANDBOMBAMMO - MAXDEVISTATORAMMO MAXSHRINKERAMMO - MAXTRIPBOMBAMMO MAXDEVISTATORAMMO - MAXFREEZEAMMO MAXTRIPBOMBAMMO - CAMERASDESTRUCTABLE MAXFREEZEAMMO - NUMFREEZEBOUNCES MAXGROWAMMO - FREEZERHURTOWNER CAMERASDESTRUCTABLE - NUMFREEZEBOUNCES - FREEZERHURTOWNER - QSIZE - TRIPBOMBLASERMODE - */ - G_DoGameStartup(params); } continue; diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index 967f92d64..bd53aca1d 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -65,33 +65,6 @@ void G_Util_PtrToIdx(void *ptr, int32_t const count, const void *base, int32_t c } } -void G_Util_PtrToIdx2(void *ptr, int32_t const count, size_t const stride, const void *base, int32_t const mode) -{ - uint8_t *iptr = (uint8_t *)ptr; - intptr_t const ibase = (intptr_t)base; - int32_t const onlynon0_p = mode&P2I_ONLYNON0_BIT; - - if ((mode & P2I_BACK_BIT) == 0) - { - for (bssize_t i = 0; i < count; ++i) - { - if (!onlynon0_p || *(intptr_t *)iptr) - *(intptr_t *)iptr -= ibase; - - iptr += stride; - } - } - else - { - for (bssize_t i = 0; i < count; ++i) - { - if (!onlynon0_p || *(intptr_t *)iptr) - *(intptr_t *)iptr += ibase; - - iptr += stride; - } - } -} // TODO: sync with TROR special interpolations? (e.g. upper floor of subway) void G_ResetInterpolations(void)