diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 5ed5f3319..4e95b30e3 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -12,15 +12,6 @@ DXROOT=../sdk/dx ALROOT = AL -SDLCONFIG = sdl-config -# SDLCONFIG = /usr/local/bin/sdl-config - -ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG)) - SDLROOT = /usr/local -else - SDLCONFIG = sdl-config -endif - # Engine options SUPERBUILD = 1 POLYMOST = 1 diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index a2c952330..fb0bd36a5 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -3,9 +3,7 @@ ENGINELIB=libengine.a EDITORLIB=libbuild.a -# SDLCONFIG = /usr/local/bin/sdl-config - -SDLCONFIG = sdl-config +SDLCONFIG = /usr/local/bin/sdl-config ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG)) SDLROOT = /usr/local diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 2cf9c804a..e4a80be17 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -77,6 +77,11 @@ int g_iLoTagID=-1; // var ID of "LOTAG" int g_iHiTagID=-1; // var ID of "HITAG" int g_iTextureID=-1; // var ID of "TEXTURE" int g_iThisActorID=-1; // var ID of "THISACTOR" +int g_iSpriteVarID=-1; +int g_iSectorVarID=-1; +int g_iWallVarID=-1; +int g_iPlayerVarID=-1; +int g_iActorVarID=-1; intptr_t *actorLoadEventScrptr[MAXTILES]; @@ -1587,15 +1592,26 @@ static void C_GetNextVarType(int type) C_SkipComments(); //skip comments and whitespace if ((*textptr == '[')) //read of array as a gamevar { + int lLabelID = -1; + f |= (MAXGAMEVARS<<2); // initprintf("got an array"); textptr++; i=GetADefID(label+(g_numLabels<<6)); if (i < 0) { - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEARRAY); - return; + i=GetDefID(label+(g_numLabels<<6)); + if (i < g_iSpriteVarID || i > g_iPlayerVarID) + i = -1; + + if (i < 0) + { + g_numCompilerErrors++; + C_ReportError(ERROR_NOTAGAMEARRAY); + return; + } + f &= ~(MAXGAMEVARS<<2); // not an array + f |= (MAXGAMEVARS<<3); } bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); @@ -1616,6 +1632,76 @@ static void C_GetNextVarType(int type) C_ReportError(ERROR_INVALIDARRAYWRITE); return; } + + if (f & (MAXGAMEVARS<<3)) + { + while (*textptr != '.') + { + if (*textptr == 0xa) + break; + if (!*textptr) + break; + + textptr++; + } + + if (*textptr!='.') + { + g_numCompilerErrors++; + C_ReportError(ERROR_SYNTAXERROR); + return; + } + textptr++; + /// now pointing at 'xxx' + C_GetNextLabelName(); + //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); + + if (i == g_iSpriteVarID) + lLabelID=C_GetLabelNameOffset(&actorH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + else if (i == g_iSectorVarID) + lLabelID=C_GetLabelNameOffset(§orH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + else if (i == g_iWallVarID) + lLabelID=C_GetLabelNameOffset(&wallH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + else if (i == g_iPlayerVarID) + lLabelID=C_GetLabelNameOffset(&playerH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + + //printf("LabelID is %d\n",lLabelID); + if (lLabelID == -1) + { + g_numCompilerErrors++; + C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return; + } + + bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); + + if (i == g_iSpriteVarID) + { + *g_scriptPtr++=ActorLabels[lLabelID].lId; + + //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); + if (ActorLabels[lLabelID].flags & LABEL_HASPARM2) + { + //printf("Member has PARM2\n"); + // get parm2 + // get the ID of the DEF + C_GetNextVarType(0); + } + } + else if (i == g_iPlayerVarID) + { + *g_scriptPtr++=PlayerLabels[lLabelID].lId; + + //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); + if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) + { + //printf("Member has PARM2\n"); + // get parm2 + // get the ID of the DEF + C_GetNextVarType(0); + } + } + } return; } // initprintf("not an array"); @@ -1805,7 +1891,7 @@ static int C_CheckEmptyBranch(int tw, intptr_t lastScriptPtr) { // ifrnd and ifhitweapon actually do something when the condition is executed if ((Bstrncmp(keyw[tw], "if", 2) && tw != CON_ELSE) || - tw == CON_IFRND || tw == CON_IFHITWEAPON) + tw == CON_IFRND || tw == CON_IFHITWEAPON) { g_ifElseAborted = 0; return 0; @@ -2985,7 +3071,7 @@ static int C_ParseCommand(void) g_numBraces++; do - done = C_ParseCommand(); + done = C_ParseCommand(); while (done == 0); } else C_ParseCommand(); diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index ae5f3cc24..f4f6b3cc7 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -39,6 +39,11 @@ extern int g_iLoTagID; // var ID of "LOTAG" extern int g_iHiTagID; // var ID of "HITAG" extern int g_iTextureID; // var ID of "TEXTURE" extern int g_iThisActorID; // var ID of "THISACTOR" +extern int g_iSpriteVarID; +extern int g_iSectorVarID; +extern int g_iWallVarID; +extern int g_iPlayerVarID; +extern int g_iActorVarID; extern intptr_t *actorLoadEventScrptr[MAXTILES]; @@ -92,13 +97,21 @@ extern void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVar2); #define CON_ERROR OSD_ERROR "Line %d, %s: " -extern int g_i,g_p; +typedef struct { + int g_i, g_p, g_x; + intptr_t *g_t; + spritetype *g_sp; + int g_killitFlag, g_returnFlag; + int filler; +} vmstate_t; + +extern vmstate_t vm; + extern int g_scriptSanityChecks; extern int g_errorLineNum; extern int g_tw; extern const char *keyw[]; -extern spritetype *g_sp; enum ScriptError_t { diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 6f9704f8a..32a9fd96d 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -34,14 +34,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void G_RestoreMapState(mapstate_t *save); void G_SaveMapState(mapstate_t *save); -int g_i,g_p; -static int g_x; -static intptr_t *g_t; -spritetype *g_sp; -static int g_killitFlag; +vmstate_t vm; + int g_errorLineNum; int g_tw; -int g_return; static int X_DoExecute(void); @@ -60,8 +56,8 @@ void X_ScriptInfo(void) else initprintf(" %d",*p); } - if (g_i) - initprintf("current actor: %d (%d)\n",g_i,g_sp->picnum); + if (vm.g_i) + initprintf("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum); initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw); } } @@ -82,44 +78,37 @@ void X_OnEvent(int iEventID, int iActor, int iPlayer, int lDist) } { - int og_i=g_i, og_p=g_p, okillit_flag=g_killitFlag; - int og_x=g_x;// *og_t=g_t; - intptr_t *oinsptr=insptr, *og_t=g_t; - spritetype *og_sp=g_sp; - int oreturn=g_return; + intptr_t *oinsptr=insptr; + vmstate_t vm_backup; - g_i = iActor; // current sprite ID - g_p = iPlayer; // current player ID - g_x = lDist; // ? - g_sp = &sprite[g_i]; - g_t = &ActorExtra[g_i].temp_data[0]; - g_return = 0; + Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t)); + + vm.g_i = iActor; // current sprite ID + vm.g_p = iPlayer; // current player ID + vm.g_x = lDist; // ? + vm.g_sp = &sprite[vm.g_i]; + vm.g_t = &ActorExtra[vm.g_i].temp_data[0]; + vm.g_returnFlag = 0; insptr = apScriptGameEvent[iEventID]; - g_killitFlag = 0; + vm.g_killitFlag = 0; while (!X_DoExecute()); - if (g_killitFlag == 1) + if (vm.g_killitFlag == 1) { // if player was set to squish, first stop that... - if (g_p >= 0) + if (vm.g_p >= 0) { - if (g_player[g_p].ps->actorsqu == g_i) - g_player[g_p].ps->actorsqu = -1; + if (g_player[vm.g_p].ps->actorsqu == vm.g_i) + g_player[vm.g_p].ps->actorsqu = -1; } - deletesprite(g_i); + deletesprite(vm.g_i); } // restore old values... - g_i=og_i; - g_p=og_p; - g_x=og_x; - g_sp=og_sp; - g_t=og_t; - g_killitFlag=okillit_flag; - g_return=oreturn; + Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t)); insptr=oinsptr; //AddLog("End of Execution"); @@ -374,32 +363,32 @@ int G_GetAngleDelta(int a,int na) static inline void X_AlterAng(int a) { - intptr_t *moveptr = (intptr_t *)g_t[1]; - int ticselapsed = (g_t[0])&31; + intptr_t *moveptr = (intptr_t *)vm.g_t[1]; + int ticselapsed = (vm.g_t[0])&31; - g_sp->xvel += (*moveptr-g_sp->xvel)/5; - if (g_sp->zvel < 648) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)/5; + vm.g_sp->xvel += (*moveptr-vm.g_sp->xvel)/5; + if (vm.g_sp->zvel < 648) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)/5; - if (A_CheckEnemySprite(g_sp) && g_sp->extra <= 0) // hack + if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack return; if (a&seekplayer) { - int aang = g_sp->ang, angdif, goalang; - int j = g_player[g_p].ps->holoduke_on; + int aang = vm.g_sp->ang, angdif, goalang; + int j = g_player[vm.g_p].ps->holoduke_on; // NOTE: looks like 'owner' is set to target sprite ID... - if (j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,g_sp->x,g_sp->y,g_sp->z,g_sp->sectnum)) - g_sp->owner = j; - else g_sp->owner = g_player[g_p].ps->i; + if (j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,vm.g_sp->x,vm.g_sp->y,vm.g_sp->z,vm.g_sp->sectnum)) + vm.g_sp->owner = j; + else vm.g_sp->owner = g_player[vm.g_p].ps->i; - if (sprite[g_sp->owner].picnum == APLAYER) - goalang = getangle(ActorExtra[g_i].lastvx-g_sp->x,ActorExtra[g_i].lastvy-g_sp->y); + if (sprite[vm.g_sp->owner].picnum == APLAYER) + goalang = getangle(ActorExtra[vm.g_i].lastvx-vm.g_sp->x,ActorExtra[vm.g_i].lastvy-vm.g_sp->y); else - goalang = getangle(sprite[g_sp->owner].x-g_sp->x,sprite[g_sp->owner].y-g_sp->y); + goalang = getangle(sprite[vm.g_sp->owner].x-vm.g_sp->x,sprite[vm.g_sp->owner].y-vm.g_sp->y); - if (g_sp->xvel && g_sp->picnum != DRONE) + if (vm.g_sp->xvel && vm.g_sp->picnum != DRONE) { angdif = G_GetAngleDelta(aang,goalang); @@ -408,18 +397,18 @@ static inline void X_AlterAng(int a) if (klabs(angdif) < 256) { j = 128-(krand()&256); - g_sp->ang += j; - if (A_GetHitscanRange(g_i) < 844) - g_sp->ang -= j; + vm.g_sp->ang += j; + if (A_GetHitscanRange(vm.g_i) < 844) + vm.g_sp->ang -= j; } } else if (ticselapsed > 18 && ticselapsed < 26) // choose { - if (klabs(angdif>>2) < 128) g_sp->ang = goalang; - else g_sp->ang += angdif>>2; + if (klabs(angdif>>2) < 128) vm.g_sp->ang = goalang; + else vm.g_sp->ang += angdif>>2; } } - else g_sp->ang = goalang; + else vm.g_sp->ang = goalang; } if (ticselapsed < 1) @@ -427,13 +416,13 @@ static inline void X_AlterAng(int a) int j = 2; if (a&furthestdir) { - g_sp->ang = A_GetFurthestAngle(g_i,j); - g_sp->owner = g_player[g_p].ps->i; + vm.g_sp->ang = A_GetFurthestAngle(vm.g_i,j); + vm.g_sp->owner = g_player[vm.g_p].ps->i; } if (a&fleeenemy) { - g_sp->ang = A_GetFurthestAngle(g_i,j); // += angdif; // = G_GetAngleDelta(aang,goalang)>>1; + vm.g_sp->ang = A_GetFurthestAngle(vm.g_i,j); // += angdif; // = G_GetAngleDelta(aang,goalang)>>1; } } } @@ -442,193 +431,193 @@ static void X_Move(void) { int l; intptr_t *moveptr; - int a = g_sp->hitag, goalang, angdif; + int a = vm.g_sp->hitag, goalang, angdif; int daxvel; - int deadflag = (A_CheckEnemySprite(g_sp) && g_sp->extra <= 0); + int deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0); if (a == -1) a = 0; - g_t[0]++; + vm.g_t[0]++; - if (g_t[1] == 0 || a == 0) + if (vm.g_t[1] == 0 || a == 0) { - if (deadflag || (ActorExtra[g_i].bposx != g_sp->x) || (ActorExtra[g_i].bposy != g_sp->y)) + if (deadflag || (ActorExtra[vm.g_i].bposx != vm.g_sp->x) || (ActorExtra[vm.g_i].bposy != vm.g_sp->y)) { - ActorExtra[g_i].bposx = g_sp->x; - ActorExtra[g_i].bposy = g_sp->y; - setsprite(g_i,g_sp->x,g_sp->y,g_sp->z); + ActorExtra[vm.g_i].bposx = vm.g_sp->x; + ActorExtra[vm.g_i].bposy = vm.g_sp->y; + setsprite(vm.g_i,vm.g_sp->x,vm.g_sp->y,vm.g_sp->z); } return; } if (a&face_player && !deadflag) { - if (g_player[g_p].ps->newowner >= 0) - goalang = getangle(g_player[g_p].ps->oposx-g_sp->x,g_player[g_p].ps->oposy-g_sp->y); - else goalang = getangle(g_player[g_p].ps->posx-g_sp->x,g_player[g_p].ps->posy-g_sp->y); - angdif = G_GetAngleDelta(g_sp->ang,goalang)>>2; + if (g_player[vm.g_p].ps->newowner >= 0) + goalang = getangle(g_player[vm.g_p].ps->oposx-vm.g_sp->x,g_player[vm.g_p].ps->oposy-vm.g_sp->y); + else goalang = getangle(g_player[vm.g_p].ps->posx-vm.g_sp->x,g_player[vm.g_p].ps->posy-vm.g_sp->y); + angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2; if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) angdif *= 2; - g_sp->ang += angdif; + vm.g_sp->ang += angdif; } if (a&spin && !deadflag) - g_sp->ang += sintable[((g_t[0]<<3)&2047)]>>6; + vm.g_sp->ang += sintable[((vm.g_t[0]<<3)&2047)]>>6; if (a&face_player_slow && !deadflag) { - if (g_player[g_p].ps->newowner >= 0) - goalang = getangle(g_player[g_p].ps->oposx-g_sp->x,g_player[g_p].ps->oposy-g_sp->y); - else goalang = getangle(g_player[g_p].ps->posx-g_sp->x,g_player[g_p].ps->posy-g_sp->y); - angdif = G_GetAngleDelta(g_sp->ang,goalang)>>4; + if (g_player[vm.g_p].ps->newowner >= 0) + goalang = getangle(g_player[vm.g_p].ps->oposx-vm.g_sp->x,g_player[vm.g_p].ps->oposy-vm.g_sp->y); + else goalang = getangle(g_player[vm.g_p].ps->posx-vm.g_sp->x,g_player[vm.g_p].ps->posy-vm.g_sp->y); + angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>4; if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) angdif *= 2; - g_sp->ang += angdif; + vm.g_sp->ang += angdif; } if (((a&jumptoplayer) == jumptoplayer) && !deadflag) { - if (g_t[0] < 16) - g_sp->zvel -= (sintable[(512+(g_t[0]<<4))&2047]>>5); + if (vm.g_t[0] < 16) + vm.g_sp->zvel -= (sintable[(512+(vm.g_t[0]<<4))&2047]>>5); } if (a&face_player_smart && !deadflag) { - int newx = g_player[g_p].ps->posx+(g_player[g_p].ps->posxv/768); - int newy = g_player[g_p].ps->posy+(g_player[g_p].ps->posyv/768); + int newx = g_player[vm.g_p].ps->posx+(g_player[vm.g_p].ps->posxv/768); + int newy = g_player[vm.g_p].ps->posy+(g_player[vm.g_p].ps->posyv/768); - goalang = getangle(newx-g_sp->x,newy-g_sp->y); - angdif = G_GetAngleDelta(g_sp->ang,goalang)>>2; + goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y); + angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2; if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) angdif *= 2; - g_sp->ang += angdif; + vm.g_sp->ang += angdif; } - moveptr = (intptr_t *)g_t[1]; + moveptr = (intptr_t *)vm.g_t[1]; - if (a&geth) g_sp->xvel += (*moveptr-g_sp->xvel)>>1; - if (a&getv) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)>>1; + if (a&geth) vm.g_sp->xvel += (*moveptr-vm.g_sp->xvel)>>1; + if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1; if (a&dodgebullet && !deadflag) - A_Dodge(g_sp); + A_Dodge(vm.g_sp); - if (g_sp->picnum != APLAYER) + if (vm.g_sp->picnum != APLAYER) X_AlterAng(a); - if (g_sp->xvel > -6 && g_sp->xvel < 6) g_sp->xvel = 0; + if (vm.g_sp->xvel > -6 && vm.g_sp->xvel < 6) vm.g_sp->xvel = 0; - a = A_CheckEnemySprite(g_sp); + a = A_CheckEnemySprite(vm.g_sp); - if (g_sp->xvel || g_sp->zvel) + if (vm.g_sp->xvel || vm.g_sp->zvel) { - if (a && g_sp->picnum != ROTATEGUN) + if (a && vm.g_sp->picnum != ROTATEGUN) { - if ((g_sp->picnum == DRONE || g_sp->picnum == COMMANDER) && g_sp->extra > 0) + if ((vm.g_sp->picnum == DRONE || vm.g_sp->picnum == COMMANDER) && vm.g_sp->extra > 0) { - if (g_sp->picnum == COMMANDER) + if (vm.g_sp->picnum == COMMANDER) { - ActorExtra[g_i].floorz = l = getflorzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if (g_sp->z > (l-(8<<8))) + ActorExtra[vm.g_i].floorz = l = getflorzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); + if (vm.g_sp->z > (l-(8<<8))) { - if (g_sp->z > (l-(8<<8))) g_sp->z = l-(8<<8); - g_sp->zvel = 0; + if (vm.g_sp->z > (l-(8<<8))) vm.g_sp->z = l-(8<<8); + vm.g_sp->zvel = 0; } - ActorExtra[g_i].ceilingz = l = getceilzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if ((g_sp->z-l) < (80<<8)) + ActorExtra[vm.g_i].ceilingz = l = getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); + if ((vm.g_sp->z-l) < (80<<8)) { - g_sp->z = l+(80<<8); - g_sp->zvel = 0; + vm.g_sp->z = l+(80<<8); + vm.g_sp->zvel = 0; } } else { - if (g_sp->zvel > 0) + if (vm.g_sp->zvel > 0) { - ActorExtra[g_i].floorz = l = getflorzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if (g_sp->z > (l-(30<<8))) - g_sp->z = l-(30<<8); + ActorExtra[vm.g_i].floorz = l = getflorzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); + if (vm.g_sp->z > (l-(30<<8))) + vm.g_sp->z = l-(30<<8); } else { - ActorExtra[g_i].ceilingz = l = getceilzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if ((g_sp->z-l) < (50<<8)) + ActorExtra[vm.g_i].ceilingz = l = getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); + if ((vm.g_sp->z-l) < (50<<8)) { - g_sp->z = l+(50<<8); - g_sp->zvel = 0; + vm.g_sp->z = l+(50<<8); + vm.g_sp->zvel = 0; } } } } - else if (g_sp->picnum != ORGANTIC) + else if (vm.g_sp->picnum != ORGANTIC) { - if (g_sp->zvel > 0 && ActorExtra[g_i].floorz < g_sp->z) - g_sp->z = ActorExtra[g_i].floorz; - if (g_sp->zvel < 0) + if (vm.g_sp->zvel > 0 && ActorExtra[vm.g_i].floorz < vm.g_sp->z) + vm.g_sp->z = ActorExtra[vm.g_i].floorz; + if (vm.g_sp->zvel < 0) { - l = getceilzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if ((g_sp->z-l) < (66<<8)) + l = getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); + if ((vm.g_sp->z-l) < (66<<8)) { - g_sp->z = l+(66<<8); - g_sp->zvel >>= 1; + vm.g_sp->z = l+(66<<8); + vm.g_sp->zvel >>= 1; } } } } - else if (g_sp->picnum == APLAYER) - if ((g_sp->z-ActorExtra[g_i].ceilingz) < (32<<8)) - g_sp->z = ActorExtra[g_i].ceilingz+(32<<8); + else if (vm.g_sp->picnum == APLAYER) + if ((vm.g_sp->z-ActorExtra[vm.g_i].ceilingz) < (32<<8)) + vm.g_sp->z = ActorExtra[vm.g_i].ceilingz+(32<<8); - daxvel = g_sp->xvel; - angdif = g_sp->ang; + daxvel = vm.g_sp->xvel; + angdif = vm.g_sp->ang; - if (a && g_sp->picnum != ROTATEGUN) + if (a && vm.g_sp->picnum != ROTATEGUN) { - if (g_x < 960 && g_sp->xrepeat > 16) + if (vm.g_x < 960 && vm.g_sp->xrepeat > 16) { - daxvel = -(1024-g_x); - angdif = getangle(g_player[g_p].ps->posx-g_sp->x,g_player[g_p].ps->posy-g_sp->y); + daxvel = -(1024-vm.g_x); + angdif = getangle(g_player[vm.g_p].ps->posx-vm.g_sp->x,g_player[vm.g_p].ps->posy-vm.g_sp->y); - if (g_x < 512) + if (vm.g_x < 512) { - g_player[g_p].ps->posxv = 0; - g_player[g_p].ps->posyv = 0; + g_player[vm.g_p].ps->posxv = 0; + g_player[vm.g_p].ps->posyv = 0; } else { - g_player[g_p].ps->posxv = mulscale(g_player[g_p].ps->posxv,g_player[g_p].ps->runspeed-0x2000,16); - g_player[g_p].ps->posyv = mulscale(g_player[g_p].ps->posyv,g_player[g_p].ps->runspeed-0x2000,16); + g_player[vm.g_p].ps->posxv = mulscale(g_player[vm.g_p].ps->posxv,g_player[vm.g_p].ps->runspeed-0x2000,16); + g_player[vm.g_p].ps->posyv = mulscale(g_player[vm.g_p].ps->posyv,g_player[vm.g_p].ps->runspeed-0x2000,16); } } - else if (g_sp->picnum != DRONE && g_sp->picnum != SHARK && g_sp->picnum != COMMANDER) + else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER) { - if (ActorExtra[g_i].bposz != g_sp->z || (ud.multimode < 2 && ud.player_skill < 2)) + if (ActorExtra[vm.g_i].bposz != vm.g_sp->z || (ud.multimode < 2 && ud.player_skill < 2)) { - if ((g_t[0]&1) || g_player[g_p].ps->actorsqu == g_i) return; + if ((vm.g_t[0]&1) || g_player[vm.g_p].ps->actorsqu == vm.g_i) return; else daxvel <<= 1; } else { - if ((g_t[0]&3) || g_player[g_p].ps->actorsqu == g_i) return; + if ((vm.g_t[0]&3) || g_player[vm.g_p].ps->actorsqu == vm.g_i) return; else daxvel <<= 2; } } } - ActorExtra[g_i].movflag = A_MoveSprite(g_i, + ActorExtra[vm.g_i].movflag = A_MoveSprite(vm.g_i, (daxvel*(sintable[(angdif+512)&2047]))>>14, - (daxvel*(sintable[angdif&2047]))>>14,g_sp->zvel,CLIPMASK0); + (daxvel*(sintable[angdif&2047]))>>14,vm.g_sp->zvel,CLIPMASK0); } if (a) { - if (sector[g_sp->sectnum].ceilingstat&1) - g_sp->shade += (sector[g_sp->sectnum].ceilingshade-g_sp->shade)>>1; - else g_sp->shade += (sector[g_sp->sectnum].floorshade-g_sp->shade)>>1; + if (sector[vm.g_sp->sectnum].ceilingstat&1) + vm.g_sp->shade += (sector[vm.g_sp->sectnum].ceilingshade-vm.g_sp->shade)>>1; + else vm.g_sp->shade += (sector[vm.g_sp->sectnum].floorshade-vm.g_sp->shade)>>1; - if (sector[g_sp->sectnum].floorpicnum == MIRROR) - deletesprite(g_i); + if (sector[vm.g_sp->sectnum].floorpicnum == MIRROR) + deletesprite(vm.g_i); } } @@ -655,8 +644,8 @@ static int X_DoExecute(void) { int j, l, s, tw = *insptr; - if (g_killitFlag) return 1; - if (g_return) return 1; + if (vm.g_killitFlag) return 1; + if (vm.g_returnFlag) return 1; // Bsprintf(g_szBuf,"Parsing: %d",*insptr); // AddLog(g_szBuf); @@ -696,17 +685,17 @@ static int X_DoExecute(void) break; case CON_IFCANSHOOTTARGET: - if (g_x > 1024) + if (vm.g_x > 1024) { short temphit, sclip = 768, angdif = 16; - if (A_CheckEnemySprite(g_sp) && g_sp->xrepeat > 56) + if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->xrepeat > 56) { sclip = 3084; angdif = 48; } - j = A_CheckHitSprite(g_i,&temphit); + j = A_CheckHitSprite(vm.g_i,&temphit); if (j == (1<<30)) { X_DoConditional(1); @@ -714,25 +703,25 @@ static int X_DoExecute(void) } if (j > sclip) { - if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum) j = 0; else { - g_sp->ang += angdif; - j = A_CheckHitSprite(g_i,&temphit); - g_sp->ang -= angdif; + vm.g_sp->ang += angdif; + j = A_CheckHitSprite(vm.g_i,&temphit); + vm.g_sp->ang -= angdif; if (j > sclip) { - if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum) j = 0; else { - g_sp->ang -= angdif; - j = A_CheckHitSprite(g_i,&temphit); - g_sp->ang += angdif; + vm.g_sp->ang -= angdif; + j = A_CheckHitSprite(vm.g_i,&temphit); + vm.g_sp->ang += angdif; if (j > 768) { - if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum) j = 0; else j = 1; } @@ -750,38 +739,38 @@ static int X_DoExecute(void) break; case CON_IFCANSEETARGET: - j = cansee(g_sp->x,g_sp->y,g_sp->z-((krand()&41)<<8),g_sp->sectnum,g_player[g_p].ps->posx,g_player[g_p].ps->posy,g_player[g_p].ps->posz/*-((krand()&41)<<8)*/,sprite[g_player[g_p].ps->i].sectnum); + j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-((krand()&41)<<8),vm.g_sp->sectnum,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz/*-((krand()&41)<<8)*/,sprite[g_player[vm.g_p].ps->i].sectnum); X_DoConditional(j); - if (j) ActorExtra[g_i].timetosleep = SLEEPTIME; + if (j) ActorExtra[vm.g_i].timetosleep = SLEEPTIME; break; case CON_IFACTORNOTSTAYPUT: - X_DoConditional(ActorExtra[g_i].actorstayput == -1); + X_DoConditional(ActorExtra[vm.g_i].actorstayput == -1); break; case CON_IFCANSEE: { - spritetype *s = &sprite[g_player[g_p].ps->i]; + spritetype *s = &sprite[g_player[vm.g_p].ps->i]; // select sprite for monster to target // if holoduke is on, let them target holoduke first. // - if (g_player[g_p].ps->holoduke_on >= 0) + if (g_player[vm.g_p].ps->holoduke_on >= 0) { - s = &sprite[g_player[g_p].ps->holoduke_on]; - j = cansee(g_sp->x,g_sp->y,g_sp->z-(krand()&((32<<8)-1)),g_sp->sectnum, + s = &sprite[g_player[vm.g_p].ps->holoduke_on]; + j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((32<<8)-1)),vm.g_sp->sectnum, s->x,s->y,s->z,s->sectnum); if (j == 0) { // they can't see player's holoduke // check for player... - s = &sprite[g_player[g_p].ps->i]; + s = &sprite[g_player[vm.g_p].ps->i]; } } // can they see player, (or player's holoduke) - j = cansee(g_sp->x,g_sp->y,g_sp->z-(krand()&((47<<8))),g_sp->sectnum, + j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((47<<8))),vm.g_sp->sectnum, s->x,s->y,s->z-(24<<8),s->sectnum); if (j == 0) @@ -790,8 +779,8 @@ static int X_DoExecute(void) // Huh?. This does nothing.... // (the result is always j==0....) -// if ((klabs(ActorExtra[g_i].lastvx-g_sp->x)+klabs(ActorExtra[g_i].lastvy-g_sp->y)) < -// (klabs(ActorExtra[g_i].lastvx-s->x)+klabs(ActorExtra[g_i].lastvy-s->y))) +// if ((klabs(ActorExtra[vm.g_i].lastvx-vm.g_sp->x)+klabs(ActorExtra[vm.g_i].lastvy-vm.g_sp->y)) < +// (klabs(ActorExtra[vm.g_i].lastvx-s->x)+klabs(ActorExtra[vm.g_i].lastvy-s->y))) // j = 0; // um yeah, this if() will always fire.... @@ -802,7 +791,7 @@ static int X_DoExecute(void) // also modifies 'target' x&y if found.. j = 1; - if (A_FurthestVisiblePoint(g_i,s,&ActorExtra[g_i].lastvx,&ActorExtra[g_i].lastvy) == -1) + if (A_FurthestVisiblePoint(vm.g_i,s,&ActorExtra[vm.g_i].lastvx,&ActorExtra[vm.g_i].lastvy) == -1) j = 0; } } @@ -810,64 +799,64 @@ static int X_DoExecute(void) { // else, they did see it. // save where we were looking... - ActorExtra[g_i].lastvx = s->x; - ActorExtra[g_i].lastvy = s->y; + ActorExtra[vm.g_i].lastvx = s->x; + ActorExtra[vm.g_i].lastvy = s->y; } - if (j && (g_sp->statnum == 1 || g_sp->statnum == 6)) - ActorExtra[g_i].timetosleep = SLEEPTIME; + if (j && (vm.g_sp->statnum == 1 || vm.g_sp->statnum == 6)) + ActorExtra[vm.g_i].timetosleep = SLEEPTIME; X_DoConditional(j); break; } case CON_IFHITWEAPON: - X_DoConditional(A_IncurDamage(g_i) >= 0); + X_DoConditional(A_IncurDamage(vm.g_i) >= 0); break; case CON_IFSQUISHED: - X_DoConditional(A_CheckSquished(g_i, g_p)); + X_DoConditional(A_CheckSquished(vm.g_i, vm.g_p)); break; case CON_IFDEAD: -// j = g_sp->extra; -// if (g_sp->picnum == APLAYER) +// j = vm.g_sp->extra; +// if (vm.g_sp->picnum == APLAYER) // j--; - X_DoConditional(g_sp->extra <= 0); + X_DoConditional(vm.g_sp->extra <= 0); break; case CON_AI: insptr++; //Following changed to use pointersizes - g_t[5] = *insptr++; // Ai - g_t[4] = *(intptr_t *)(g_t[5]); // Action - if (g_t[5]) g_t[1] = *(((intptr_t *)g_t[5])+1); // move - g_sp->hitag = *(((intptr_t *)g_t[5])+2); // move flags - g_t[0] = g_t[2] = g_t[3] = 0; // count, actioncount... g_t[3] = ??? - if (A_CheckEnemySprite(g_sp) && g_sp->extra <= 0) // hack + vm.g_t[5] = *insptr++; // Ai + vm.g_t[4] = *(intptr_t *)(vm.g_t[5]); // Action + if (vm.g_t[5]) vm.g_t[1] = *(((intptr_t *)vm.g_t[5])+1); // move + vm.g_sp->hitag = *(((intptr_t *)vm.g_t[5])+2); // move flags + vm.g_t[0] = vm.g_t[2] = vm.g_t[3] = 0; // count, actioncount... vm.g_t[3] = ??? + if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack break; - if (g_sp->hitag&random_angle) - g_sp->ang = krand()&2047; + if (vm.g_sp->hitag&random_angle) + vm.g_sp->ang = krand()&2047; break; case CON_ACTION: insptr++; - g_t[2] = g_t[3] = 0; - g_t[4] = *insptr++; + vm.g_t[2] = vm.g_t[3] = 0; + vm.g_t[4] = *insptr++; break; case CON_IFPDISTL: insptr++; - X_DoConditional(g_x < *insptr); - if (g_x > MAXSLEEPDIST && ActorExtra[g_i].timetosleep == 0) - ActorExtra[g_i].timetosleep = SLEEPTIME; + X_DoConditional(vm.g_x < *insptr); + if (vm.g_x > MAXSLEEPDIST && ActorExtra[vm.g_i].timetosleep == 0) + ActorExtra[vm.g_i].timetosleep = SLEEPTIME; break; case CON_IFPDISTG: insptr++; - X_DoConditional(g_x > *insptr); - if (g_x > MAXSLEEPDIST && ActorExtra[g_i].timetosleep == 0) - ActorExtra[g_i].timetosleep = SLEEPTIME; + X_DoConditional(vm.g_x > *insptr); + if (vm.g_x > MAXSLEEPDIST && ActorExtra[vm.g_i].timetosleep == 0) + ActorExtra[vm.g_i].timetosleep = SLEEPTIME; break; case CON_ELSE: @@ -876,12 +865,12 @@ static int X_DoExecute(void) case CON_ADDSTRENGTH: insptr++; - g_sp->extra += *insptr++; + vm.g_sp->extra += *insptr++; break; case CON_STRENGTH: insptr++; - g_sp->extra = *insptr++; + vm.g_sp->extra = *insptr++; break; case CON_IFGOTWEAPONCE: @@ -891,16 +880,16 @@ static int X_DoExecute(void) { if (*insptr == 0) { - for (j=0;j < g_player[g_p].ps->weapreccnt;j++) - if (g_player[g_p].ps->weaprecs[j] == g_sp->picnum) + for (j=0;j < g_player[vm.g_p].ps->weapreccnt;j++) + if (g_player[vm.g_p].ps->weaprecs[j] == vm.g_sp->picnum) break; - X_DoConditional(j < g_player[g_p].ps->weapreccnt && g_sp->owner == g_i); + X_DoConditional(j < g_player[vm.g_p].ps->weapreccnt && vm.g_sp->owner == vm.g_i); } - else if (g_player[g_p].ps->weapreccnt < 16) + else if (g_player[vm.g_p].ps->weapreccnt < 16) { - g_player[g_p].ps->weaprecs[g_player[g_p].ps->weapreccnt++] = g_sp->picnum; - X_DoConditional(g_sp->owner == g_i); + g_player[vm.g_p].ps->weaprecs[g_player[vm.g_p].ps->weapreccnt++] = vm.g_sp->picnum; + X_DoConditional(vm.g_sp->owner == vm.g_i); } else X_DoConditional(0); } @@ -909,20 +898,20 @@ static int X_DoExecute(void) case CON_GETLASTPAL: insptr++; - if (g_sp->picnum == APLAYER) - g_sp->pal = g_player[g_sp->yvel].ps->palookup; + if (vm.g_sp->picnum == APLAYER) + vm.g_sp->pal = g_player[vm.g_sp->yvel].ps->palookup; else { - if (g_sp->pal == 1 && g_sp->extra == 0) // hack for frozen - g_sp->extra++; - g_sp->pal = ActorExtra[g_i].tempang; + if (vm.g_sp->pal == 1 && vm.g_sp->extra == 0) // hack for frozen + vm.g_sp->extra++; + vm.g_sp->pal = ActorExtra[vm.g_i].tempang; } - ActorExtra[g_i].tempang = 0; + ActorExtra[vm.g_i].tempang = 0; break; case CON_TOSSWEAPON: insptr++; - P_DropWeapon(g_player[g_sp->yvel].ps); + P_DropWeapon(g_player[vm.g_sp->yvel].ps); break; case CON_NULLOP: @@ -931,38 +920,38 @@ static int X_DoExecute(void) case CON_MIKESND: insptr++; - if ((g_sp->yvel<0 || g_sp->yvel>=MAXSOUNDS) && g_scriptSanityChecks) + if ((vm.g_sp->yvel<0 || vm.g_sp->yvel>=MAXSOUNDS) && g_scriptSanityChecks) { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],g_sp->yvel); + OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->yvel); insptr++; break; } - if (!A_CheckSoundPlaying(g_i,g_sp->yvel)) - A_PlaySound(g_sp->yvel,g_i); + if (!A_CheckSoundPlaying(vm.g_i,vm.g_sp->yvel)) + A_PlaySound(vm.g_sp->yvel,vm.g_i); break; case CON_PKICK: insptr++; - if (ud.multimode > 1 && g_sp->picnum == APLAYER) + if (ud.multimode > 1 && vm.g_sp->picnum == APLAYER) { if (g_player[otherp].ps->quick_kick == 0) g_player[otherp].ps->quick_kick = 14; } - else if (g_sp->picnum != APLAYER && g_player[g_p].ps->quick_kick == 0) - g_player[g_p].ps->quick_kick = 14; + else if (vm.g_sp->picnum != APLAYER && g_player[vm.g_p].ps->quick_kick == 0) + g_player[vm.g_p].ps->quick_kick = 14; break; case CON_SIZETO: insptr++; - j = (*insptr++-g_sp->xrepeat)<<1; - g_sp->xrepeat += ksgn(j); + j = (*insptr++-vm.g_sp->xrepeat)<<1; + vm.g_sp->xrepeat += ksgn(j); - if ((g_sp->picnum == APLAYER && g_sp->yrepeat < 36) || *insptr < g_sp->yrepeat || ((g_sp->yrepeat*(tilesizy[g_sp->picnum]+8))<<2) < (ActorExtra[g_i].floorz - ActorExtra[g_i].ceilingz)) + if ((vm.g_sp->picnum == APLAYER && vm.g_sp->yrepeat < 36) || *insptr < vm.g_sp->yrepeat || ((vm.g_sp->yrepeat*(tilesizy[vm.g_sp->picnum]+8))<<2) < (ActorExtra[vm.g_i].floorz - ActorExtra[vm.g_i].ceilingz)) { - j = ((*insptr)-g_sp->yrepeat)<<1; - if (klabs(j)) g_sp->yrepeat += ksgn(j); + j = ((*insptr)-vm.g_sp->yrepeat)<<1; + if (klabs(j)) vm.g_sp->yrepeat += ksgn(j); } insptr++; @@ -970,13 +959,13 @@ static int X_DoExecute(void) case CON_SIZEAT: insptr++; - g_sp->xrepeat = (char) *insptr++; - g_sp->yrepeat = (char) *insptr++; + vm.g_sp->xrepeat = (char) *insptr++; + vm.g_sp->yrepeat = (char) *insptr++; break; case CON_SHOOT: insptr++; - A_Shoot(g_i,*insptr++); + A_Shoot(vm.g_i,*insptr++); break; case CON_SOUNDONCE: @@ -986,8 +975,8 @@ static int X_DoExecute(void) OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr++); break; } - if (!A_CheckSoundPlaying(g_i,*insptr++)) - A_PlaySound(*(insptr-1),g_i); + if (!A_CheckSoundPlaying(vm.g_i,*insptr++)) + A_PlaySound(*(insptr-1),vm.g_i); break; case CON_IFSOUND: @@ -997,8 +986,8 @@ static int X_DoExecute(void) OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr); insptr++;break; } - X_DoConditional(A_CheckSoundPlaying(g_i,*insptr)); - // X_DoConditional(SoundOwner[*insptr][0].i == g_i); + X_DoConditional(A_CheckSoundPlaying(vm.g_i,*insptr)); + // X_DoConditional(SoundOwner[*insptr][0].i == vm.g_i); break; case CON_STOPSOUND: @@ -1008,8 +997,8 @@ static int X_DoExecute(void) OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr); insptr++;break; } - if (A_CheckSoundPlaying(g_i,*insptr)) - A_StopSound((short)*insptr,g_i); + if (A_CheckSoundPlaying(vm.g_i,*insptr)) + A_StopSound((short)*insptr,vm.g_i); insptr++; break; @@ -1020,7 +1009,7 @@ static int X_DoExecute(void) OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr); insptr++;break; } - if (g_p == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND)) + if (vm.g_p == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND)) A_PlaySound((short) *insptr,g_player[screenpeek].ps->i); insptr++; break; @@ -1032,87 +1021,87 @@ static int X_DoExecute(void) OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr); insptr++;break; } - A_PlaySound((short) *insptr++,g_i); + A_PlaySound((short) *insptr++,vm.g_i); break; case CON_TIP: insptr++; - g_player[g_p].ps->tipincs = 26; + g_player[vm.g_p].ps->tipincs = 26; break; case CON_FALL: insptr++; - g_sp->xoffset = g_sp->yoffset = 0; + vm.g_sp->xoffset = vm.g_sp->yoffset = 0; j = g_spriteGravity; - if (G_CheckForSpaceCeiling(g_sp->sectnum) || sector[g_sp->sectnum].lotag == 2) + if (G_CheckForSpaceCeiling(vm.g_sp->sectnum) || sector[vm.g_sp->sectnum].lotag == 2) j = g_spriteGravity/6; - else if (G_CheckForSpaceFloor(g_sp->sectnum)) + else if (G_CheckForSpaceFloor(vm.g_sp->sectnum)) j = 0; - if (!ActorExtra[g_i].cgg-- || (sector[g_sp->sectnum].floorstat&2)) + if (!ActorExtra[vm.g_i].cgg-- || (sector[vm.g_sp->sectnum].floorstat&2)) { - A_GetZLimits(g_i); - ActorExtra[g_i].cgg = 3; + A_GetZLimits(vm.g_i); + ActorExtra[vm.g_i].cgg = 3; } - if (g_sp->z < (ActorExtra[g_i].floorz-FOURSLEIGHT)) + if (vm.g_sp->z < (ActorExtra[vm.g_i].floorz-FOURSLEIGHT)) { - g_sp->z += g_sp->zvel = min(6144, g_sp->zvel+j); + vm.g_sp->z += vm.g_sp->zvel = min(6144, vm.g_sp->zvel+j); - if (g_sp->z > (ActorExtra[g_i].floorz - FOURSLEIGHT)) - g_sp->z = (ActorExtra[g_i].floorz - FOURSLEIGHT); + if (vm.g_sp->z > (ActorExtra[vm.g_i].floorz - FOURSLEIGHT)) + vm.g_sp->z = (ActorExtra[vm.g_i].floorz - FOURSLEIGHT); break; } - g_sp->z = ActorExtra[g_i].floorz - FOURSLEIGHT; + vm.g_sp->z = ActorExtra[vm.g_i].floorz - FOURSLEIGHT; - if (A_CheckEnemySprite(g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0)) + if (A_CheckEnemySprite(vm.g_sp) || (vm.g_sp->picnum == APLAYER && vm.g_sp->owner >= 0)) { - if (g_sp->zvel > 3084 && g_sp->extra <= 1) + if (vm.g_sp->zvel > 3084 && vm.g_sp->extra <= 1) { - if (!(g_sp->picnum == APLAYER && g_sp->extra > 0) && g_sp->pal != 1 && g_sp->picnum != DRONE) + if (!(vm.g_sp->picnum == APLAYER && vm.g_sp->extra > 0) && vm.g_sp->pal != 1 && vm.g_sp->picnum != DRONE) { - A_DoGuts(g_i,JIBS6,15); - A_PlaySound(SQUISHED,g_i); - A_Spawn(g_i,BLOODPOOL); + A_DoGuts(vm.g_i,JIBS6,15); + A_PlaySound(SQUISHED,vm.g_i); + A_Spawn(vm.g_i,BLOODPOOL); } - ActorExtra[g_i].picnum = SHOTSPARK1; - ActorExtra[g_i].extra = 1; - g_sp->zvel = 0; + ActorExtra[vm.g_i].picnum = SHOTSPARK1; + ActorExtra[vm.g_i].extra = 1; + vm.g_sp->zvel = 0; } - else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1) + else if (vm.g_sp->zvel > 2048 && sector[vm.g_sp->sectnum].lotag != 1) { - j = g_sp->sectnum; - pushmove(&g_sp->x,&g_sp->y,&g_sp->z,(short*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); - if (j != g_sp->sectnum && j >= 0 && j < MAXSECTORS) - changespritesect(g_i,j); - A_PlaySound(THUD,g_i); + j = vm.g_sp->sectnum; + pushmove(&vm.g_sp->x,&vm.g_sp->y,&vm.g_sp->z,(short*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); + if (j != vm.g_sp->sectnum && j >= 0 && j < MAXSECTORS) + changespritesect(vm.g_i,j); + A_PlaySound(THUD,vm.g_i); } } - if (g_sp->z > (ActorExtra[g_i].floorz - FOURSLEIGHT)) + if (vm.g_sp->z > (ActorExtra[vm.g_i].floorz - FOURSLEIGHT)) { - A_GetZLimits(g_i); - if (ActorExtra[g_i].floorz != sector[g_sp->sectnum].floorz) - g_sp->z = (ActorExtra[g_i].floorz - FOURSLEIGHT); + A_GetZLimits(vm.g_i); + if (ActorExtra[vm.g_i].floorz != sector[vm.g_sp->sectnum].floorz) + vm.g_sp->z = (ActorExtra[vm.g_i].floorz - FOURSLEIGHT); break; } - else if (sector[g_sp->sectnum].lotag == 1) + else if (sector[vm.g_sp->sectnum].lotag == 1) { - intptr_t *moveptr = (intptr_t *)g_t[1]; - switch (DynamicTileMap[g_sp->picnum]) + intptr_t *moveptr = (intptr_t *)vm.g_t[1]; + switch (DynamicTileMap[vm.g_sp->picnum]) { default: // fix for flying/jumping monsters getting stuck in water - if (g_sp->hitag & jumptoplayer || (actorscrptr[g_sp->picnum] && + if (vm.g_sp->hitag & jumptoplayer || (actorscrptr[vm.g_sp->picnum] && moveptr >= &script[0] && moveptr <= (&script[0]+g_scriptSize) && *(moveptr+1))) { // OSD_Printf("%d\n",*(moveptr+1)); break; } -// OSD_Printf("hitag: %d\n",g_sp->hitag); - g_sp->z += (24<<8); +// OSD_Printf("hitag: %d\n",vm.g_sp->hitag); + vm.g_sp->z += (24<<8); case OCTABRAIN__STATIC: case COMMANDER__STATIC: case DRONE__STATIC: @@ -1120,11 +1109,11 @@ static int X_DoExecute(void) } break; } - g_sp->zvel = 0; + vm.g_sp->zvel = 0; break; case CON_RETURN: - g_return = 1; + vm.g_returnFlag = 1; case CON_ENDA: case CON_BREAK: case CON_ENDS: @@ -1139,54 +1128,54 @@ static int X_DoExecute(void) OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],*insptr); insptr+=2;break; } - if (g_player[g_p].ps->ammo_amount[*insptr] >= g_player[g_p].ps->max_ammo_amount[*insptr]) + if (g_player[vm.g_p].ps->ammo_amount[*insptr] >= g_player[vm.g_p].ps->max_ammo_amount[*insptr]) { - g_killitFlag = 2; + vm.g_killitFlag = 2; break; } - P_AddAmmo(*insptr, g_player[g_p].ps, *(insptr+1)); - if (g_player[g_p].ps->curr_weapon == KNEE_WEAPON && g_player[g_p].ps->gotweapon[*insptr]) + P_AddAmmo(*insptr, g_player[vm.g_p].ps, *(insptr+1)); + if (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && g_player[vm.g_p].ps->gotweapon[*insptr]) { - if (!(g_player[g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[g_p].ps, *insptr); - else P_AddWeapon(g_player[g_p].ps, *insptr); + if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, *insptr); + else P_AddWeapon(g_player[vm.g_p].ps, *insptr); } insptr += 2; break; case CON_MONEY: insptr++; - A_SpawnMultiple(g_i, MONEY, *insptr++); + A_SpawnMultiple(vm.g_i, MONEY, *insptr++); break; case CON_MAIL: insptr++; - A_SpawnMultiple(g_i, MAIL, *insptr++); + A_SpawnMultiple(vm.g_i, MAIL, *insptr++); break; case CON_SLEEPTIME: insptr++; - ActorExtra[g_i].timetosleep = (short)*insptr++; + ActorExtra[vm.g_i].timetosleep = (short)*insptr++; break; case CON_PAPER: insptr++; - A_SpawnMultiple(g_i, PAPER, *insptr++); + A_SpawnMultiple(vm.g_i, PAPER, *insptr++); break; case CON_ADDKILLS: insptr++; - g_player[g_p].ps->actors_killed += *insptr++; - ActorExtra[g_i].actorstayput = -1; + g_player[vm.g_p].ps->actors_killed += *insptr++; + ActorExtra[vm.g_i].actorstayput = -1; break; case CON_LOTSOFGLASS: insptr++; - A_SpawnGlass(g_i,*insptr++); + A_SpawnGlass(vm.g_i,*insptr++); break; case CON_KILLIT: insptr++; - g_killitFlag = 1; + vm.g_killitFlag = 1; break; case CON_ADDWEAPON: @@ -1196,21 +1185,21 @@ static int X_DoExecute(void) OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],*insptr); insptr+=2;break; } - if (g_player[g_p].ps->gotweapon[*insptr] == 0) + if (g_player[vm.g_p].ps->gotweapon[*insptr] == 0) { - if (!(g_player[g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[g_p].ps, *insptr); - else P_AddWeapon(g_player[g_p].ps, *insptr); + if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, *insptr); + else P_AddWeapon(g_player[vm.g_p].ps, *insptr); } - else if (g_player[g_p].ps->ammo_amount[*insptr] >= g_player[g_p].ps->max_ammo_amount[*insptr]) + else if (g_player[vm.g_p].ps->ammo_amount[*insptr] >= g_player[vm.g_p].ps->max_ammo_amount[*insptr]) { - g_killitFlag = 2; + vm.g_killitFlag = 2; break; } - P_AddAmmo(*insptr, g_player[g_p].ps, *(insptr+1)); - if (g_player[g_p].ps->curr_weapon == KNEE_WEAPON && g_player[g_p].ps->gotweapon[*insptr]) + P_AddAmmo(*insptr, g_player[vm.g_p].ps, *(insptr+1)); + if (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && g_player[vm.g_p].ps->gotweapon[*insptr]) { - if (!(g_player[g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[g_p].ps, *insptr); - else P_AddWeapon(g_player[g_p].ps, *insptr); + if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, *insptr); + else P_AddWeapon(g_player[vm.g_p].ps, *insptr); } insptr+=2; break; @@ -1222,23 +1211,23 @@ static int X_DoExecute(void) case CON_ENDOFGAME: insptr++; - g_player[g_p].ps->timebeforeexit = *insptr++; - g_player[g_p].ps->customexitsound = -1; + g_player[vm.g_p].ps->timebeforeexit = *insptr++; + g_player[vm.g_p].ps->customexitsound = -1; ud.eog = 1; break; case CON_ADDPHEALTH: insptr++; - if (g_player[g_p].ps->newowner >= 0) + if (g_player[vm.g_p].ps->newowner >= 0) { - g_player[g_p].ps->newowner = -1; - g_player[g_p].ps->posx = g_player[g_p].ps->oposx; - g_player[g_p].ps->posy = g_player[g_p].ps->oposy; - g_player[g_p].ps->posz = g_player[g_p].ps->oposz; - g_player[g_p].ps->ang = g_player[g_p].ps->oang; - updatesector(g_player[g_p].ps->posx,g_player[g_p].ps->posy,&g_player[g_p].ps->cursectnum); - P_UpdateScreenPal(g_player[g_p].ps); + g_player[vm.g_p].ps->newowner = -1; + g_player[vm.g_p].ps->posx = g_player[vm.g_p].ps->oposx; + g_player[vm.g_p].ps->posy = g_player[vm.g_p].ps->oposy; + g_player[vm.g_p].ps->posz = g_player[vm.g_p].ps->oposz; + g_player[vm.g_p].ps->ang = g_player[vm.g_p].ps->oang; + updatesector(g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,&g_player[vm.g_p].ps->cursectnum); + P_UpdateScreenPal(g_player[vm.g_p].ps); j = headspritestat[STAT_ACTOR]; while (j >= 0) @@ -1249,11 +1238,11 @@ static int X_DoExecute(void) } } - j = sprite[g_player[g_p].ps->i].extra; + j = sprite[g_player[vm.g_p].ps->i].extra; - if (g_sp->picnum != ATOMICHEALTH) + if (vm.g_sp->picnum != ATOMICHEALTH) { - if (j > g_player[g_p].ps->max_player_health && *insptr > 0) + if (j > g_player[vm.g_p].ps->max_player_health && *insptr > 0) { insptr++; break; @@ -1262,16 +1251,16 @@ static int X_DoExecute(void) { if (j > 0) j += *insptr; - if (j > g_player[g_p].ps->max_player_health && *insptr > 0) - j = g_player[g_p].ps->max_player_health; + if (j > g_player[vm.g_p].ps->max_player_health && *insptr > 0) + j = g_player[vm.g_p].ps->max_player_health; } } else { if (j > 0) j += *insptr; - if (j > (g_player[g_p].ps->max_player_health<<1)) - j = (g_player[g_p].ps->max_player_health<<1); + if (j > (g_player[vm.g_p].ps->max_player_health<<1)) + j = (g_player[vm.g_p].ps->max_player_health<<1); } if (j < 0) j = 0; @@ -1280,14 +1269,14 @@ static int X_DoExecute(void) { if (*insptr > 0) { - if ((j - *insptr) < (g_player[g_p].ps->max_player_health>>2) && - j >= (g_player[g_p].ps->max_player_health>>2)) - A_PlaySound(DUKE_GOTHEALTHATLOW,g_player[g_p].ps->i); + if ((j - *insptr) < (g_player[vm.g_p].ps->max_player_health>>2) && + j >= (g_player[vm.g_p].ps->max_player_health>>2)) + A_PlaySound(DUKE_GOTHEALTHATLOW,g_player[vm.g_p].ps->i); - g_player[g_p].ps->last_extra = j; + g_player[vm.g_p].ps->last_extra = j; } - sprite[g_player[g_p].ps->i].extra = j; + sprite[g_player[vm.g_p].ps->i].extra = j; } insptr++; @@ -1310,32 +1299,32 @@ static int X_DoExecute(void) case CON_MOVE: insptr++; - g_t[0]=0; - g_t[1] = *insptr++; - g_sp->hitag = *insptr++; - if (A_CheckEnemySprite(g_sp) && g_sp->extra <= 0) // hack + vm.g_t[0]=0; + vm.g_t[1] = *insptr++; + vm.g_sp->hitag = *insptr++; + if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack break; - if (g_sp->hitag&random_angle) - g_sp->ang = krand()&2047; + if (vm.g_sp->hitag&random_angle) + vm.g_sp->ang = krand()&2047; break; case CON_ADDWEAPONVAR: insptr++; - if (g_player[g_p].ps->gotweapon[Gv_GetVarX(*(insptr))] == 0) + if (g_player[vm.g_p].ps->gotweapon[Gv_GetVarX(*(insptr))] == 0) { - if (!(g_player[g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[g_p].ps, Gv_GetVarX(*(insptr))); - else P_AddWeapon(g_player[g_p].ps, Gv_GetVarX(*(insptr))); + if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); + else P_AddWeapon(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); } - else if (g_player[g_p].ps->ammo_amount[Gv_GetVarX(*(insptr))] >= g_player[g_p].ps->max_ammo_amount[Gv_GetVarX(*(insptr))]) + else if (g_player[vm.g_p].ps->ammo_amount[Gv_GetVarX(*(insptr))] >= g_player[vm.g_p].ps->max_ammo_amount[Gv_GetVarX(*(insptr))]) { - g_killitFlag = 2; + vm.g_killitFlag = 2; break; } - P_AddAmmo(Gv_GetVarX(*(insptr)), g_player[g_p].ps, Gv_GetVarX(*(insptr+1))); - if (g_player[g_p].ps->curr_weapon == KNEE_WEAPON && g_player[g_p].ps->gotweapon[Gv_GetVarX(*(insptr))]) + P_AddAmmo(Gv_GetVarX(*(insptr)), g_player[vm.g_p].ps, Gv_GetVarX(*(insptr+1))); + if (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && g_player[vm.g_p].ps->gotweapon[Gv_GetVarX(*(insptr))]) { - if (!(g_player[g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[g_p].ps, Gv_GetVarX(*(insptr))); - else P_AddWeapon(g_player[g_p].ps, Gv_GetVarX(*(insptr))); + if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); + else P_AddWeapon(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); } insptr+=2; break; @@ -1350,7 +1339,7 @@ static int X_DoExecute(void) int var1 = Gv_GetVarX(*insptr++), var2; if (tw == CON_OPERATEACTIVATORS && *insptr == g_iThisActorID) { - var2 = g_p; + var2 = vm.g_p; insptr++; } else var2 = Gv_GetVarX(*insptr++); @@ -1421,7 +1410,7 @@ static int X_DoExecute(void) case CON_INSERTSPRITEQ: insptr++; - A_AddToDeleteQueue(g_i); + A_AddToDeleteQueue(vm.g_i); break; case CON_QSTRLEN: @@ -1587,7 +1576,7 @@ static int X_DoExecute(void) int i = Gv_GetVarX(*insptr++), j; if (tw == CON_GETPNAME && *insptr == g_iThisActorID) { - j = g_p; + j = vm.g_p; insptr++; } else j = Gv_GetVarX(*insptr++); @@ -1619,7 +1608,7 @@ static int X_DoExecute(void) Bstrcpy(ScriptQuotes[i],MapInfo[ud.volume_number*MAXLEVELS + ud.level_number].filename); break; case STR_PLAYERNAME: - Bstrcpy(ScriptQuotes[i],g_player[g_p].user_name); + Bstrcpy(ScriptQuotes[i],g_player[vm.g_p].user_name); break; case STR_VERSION: Bsprintf(tempbuf,HEAD2 " %s",s_buildDate); @@ -1926,12 +1915,12 @@ static int X_DoExecute(void) insptr++; { int lIn=Gv_GetVarX(*insptr++); - if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && g_scriptSanityChecks) + if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors) && g_scriptSanityChecks) { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],g_sp->sectnum); + OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); break; } - j = A_Spawn(g_i, lIn); + j = A_Spawn(vm.g_i, lIn); switch (tw) { case CON_EQSPAWNVAR: @@ -1953,14 +1942,14 @@ static int X_DoExecute(void) case CON_QSPAWN: insptr++; - if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && g_scriptSanityChecks) + if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors) && g_scriptSanityChecks) { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],g_sp->sectnum); + OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); insptr++; break; } - j = A_Spawn(g_i,*insptr++); + j = A_Spawn(vm.g_i,*insptr++); switch (tw) { @@ -1984,25 +1973,25 @@ static int X_DoExecute(void) if (tw == CON_ZSHOOT || tw == CON_EZSHOOT) { - ActorExtra[g_i].temp_data[9] = Gv_GetVarX(*insptr++); - if (ActorExtra[g_i].temp_data[9] == 0) - ActorExtra[g_i].temp_data[9] = 1; + ActorExtra[vm.g_i].temp_data[9] = Gv_GetVarX(*insptr++); + if (ActorExtra[vm.g_i].temp_data[9] == 0) + ActorExtra[vm.g_i].temp_data[9] = 1; } - if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && g_scriptSanityChecks) + if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors) && g_scriptSanityChecks) { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],g_sp->sectnum); + OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); insptr++; - ActorExtra[g_i].temp_data[9]=0; + ActorExtra[vm.g_i].temp_data[9]=0; break; } - j = A_Shoot(g_i,*insptr++); + j = A_Shoot(vm.g_i,*insptr++); if (tw == CON_EZSHOOT || tw == CON_ESHOOT) Gv_SetVarX(g_iReturnVarID, j); - ActorExtra[g_i].temp_data[9]=0; + ActorExtra[vm.g_i].temp_data[9]=0; break; case CON_SHOOTVAR: @@ -2016,23 +2005,23 @@ static int X_DoExecute(void) if (tw == CON_ZSHOOTVAR || tw == CON_EZSHOOTVAR) { - ActorExtra[g_i].temp_data[9] = Gv_GetVarX(*insptr++); - if (ActorExtra[g_i].temp_data[9] == 0) - ActorExtra[g_i].temp_data[9] = 1; + ActorExtra[vm.g_i].temp_data[9] = Gv_GetVarX(*insptr++); + if (ActorExtra[vm.g_i].temp_data[9] == 0) + ActorExtra[vm.g_i].temp_data[9] = 1; } j=Gv_GetVarX(*insptr++); - if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && g_scriptSanityChecks) + if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors) && g_scriptSanityChecks) { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],g_sp->sectnum); - ActorExtra[g_i].temp_data[9]=0; + OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); + ActorExtra[vm.g_i].temp_data[9]=0; break; } - lReturn = A_Shoot(g_i, j); + lReturn = A_Shoot(vm.g_i, j); if (tw == CON_ESHOOTVAR || tw == CON_EZSHOOTVAR) Gv_SetVarX(g_iReturnVarID, lReturn); - ActorExtra[g_i].temp_data[9]=0; + ActorExtra[vm.g_i].temp_data[9]=0; break; } @@ -2053,8 +2042,8 @@ static int X_DoExecute(void) { case CON_SOUNDONCEVAR: if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;} - if (!A_CheckSoundPlaying(g_i,j)) - A_PlaySound((short)j,g_i); + if (!A_CheckSoundPlaying(vm.g_i,j)) + A_PlaySound((short)j,vm.g_i); break; case CON_GLOBALSOUNDVAR: if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;} @@ -2062,12 +2051,12 @@ static int X_DoExecute(void) break; case CON_STOPSOUNDVAR: if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;} - if (A_CheckSoundPlaying(g_i,j)) - A_StopSound((short)j,g_i); + if (A_CheckSoundPlaying(vm.g_i,j)) + A_StopSound((short)j,vm.g_i); break; case CON_SOUNDVAR: if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;} - A_PlaySound((short)j,g_i); + A_PlaySound((short)j,vm.g_i); break; } break; @@ -2273,7 +2262,7 @@ static int X_DoExecute(void) case CON_ANGOFF: insptr++; - spriteext[g_i].angoff=*insptr++; + spriteext[vm.g_i].angoff=*insptr++; break; case CON_GETZRANGE: @@ -2468,7 +2457,7 @@ static int X_DoExecute(void) int x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++); int z=(tw==CON_UPDATESECTORZ)?Gv_GetVarX(*insptr++):0; int var=*insptr++; - short w=sprite[g_i].sectnum; + short w=sprite[vm.g_i].sectnum; if (tw==CON_UPDATESECTOR) updatesector(x,y,&w); else updatesectorz(x,y,z,&w); @@ -2479,34 +2468,34 @@ static int X_DoExecute(void) case CON_SPAWN: insptr++; - if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - A_Spawn(g_i,*insptr); + if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS) + A_Spawn(vm.g_i,*insptr); insptr++; break; case CON_IFWASWEAPON: insptr++; - X_DoConditional(ActorExtra[g_i].picnum == *insptr); + X_DoConditional(ActorExtra[vm.g_i].picnum == *insptr); break; case CON_IFAI: insptr++; - X_DoConditional(g_t[5] == *insptr); + X_DoConditional(vm.g_t[5] == *insptr); break; case CON_IFACTION: insptr++; - X_DoConditional(g_t[4] == *insptr); + X_DoConditional(vm.g_t[4] == *insptr); break; case CON_IFACTIONCOUNT: insptr++; - X_DoConditional(g_t[2] >= *insptr); + X_DoConditional(vm.g_t[2] >= *insptr); break; case CON_RESETACTIONCOUNT: insptr++; - g_t[2] = 0; + vm.g_t[2] = 0; break; case CON_DEBRIS: @@ -2514,22 +2503,22 @@ static int X_DoExecute(void) { int dnum = *insptr++; - if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS) for (j=(*insptr)-1;j>=0;j--) { - if (g_sp->picnum == BLIMP && dnum == SCRAP1) + if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1) s = 0; else s = (krand()%3); - l = A_InsertSprite(g_sp->sectnum, - g_sp->x+(krand()&255)-128,g_sp->y+(krand()&255)-128,g_sp->z-(8<<8)-(krand()&8191), - dnum+s,g_sp->shade,32+(krand()&15),32+(krand()&15), + l = A_InsertSprite(vm.g_sp->sectnum, + vm.g_sp->x+(krand()&255)-128,vm.g_sp->y+(krand()&255)-128,vm.g_sp->z-(8<<8)-(krand()&8191), + dnum+s,vm.g_sp->shade,32+(krand()&15),32+(krand()&15), krand()&2047,(krand()&127)+32, - -(krand()&2047),g_i,5); - if (g_sp->picnum == BLIMP && dnum == SCRAP1) + -(krand()&2047),vm.g_i,5); + if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1) sprite[l].yvel = BlimpSpawnSprites[j%14]; else sprite[l].yvel = -1; - sprite[l].pal = g_sp->pal; + sprite[l].pal = vm.g_sp->pal; } insptr++; } @@ -2537,22 +2526,22 @@ static int X_DoExecute(void) case CON_COUNT: insptr++; - g_t[0] = (short) *insptr++; + vm.g_t[0] = (short) *insptr++; break; case CON_CSTATOR: insptr++; - g_sp->cstat |= (short) *insptr++; + vm.g_sp->cstat |= (short) *insptr++; break; case CON_CLIPDIST: insptr++; - g_sp->clipdist = (short) *insptr++; + vm.g_sp->clipdist = (short) *insptr++; break; case CON_CSTAT: insptr++; - g_sp->cstat = (short) *insptr++; + vm.g_sp->cstat = (short) *insptr++; break; case CON_SAVENN: case CON_SAVE: @@ -2598,7 +2587,7 @@ static int X_DoExecute(void) case CON_IFMOVE: insptr++; - X_DoConditional(g_t[1] == *insptr); + X_DoConditional(vm.g_t[1] == *insptr); break; case CON_RESETPLAYER: @@ -2610,98 +2599,98 @@ static int X_DoExecute(void) { if (g_lastSaveSlot >= 0 && ud.recstat != 2) { - g_player[g_p].ps->gm = MODE_MENU; + g_player[vm.g_p].ps->gm = MODE_MENU; KB_ClearKeyDown(sc_Space); ChangeToMenu(15000); } - else g_player[g_p].ps->gm = MODE_RESTART; - g_killitFlag = 2; + else g_player[vm.g_p].ps->gm = MODE_RESTART; + vm.g_killitFlag = 2; } else { - P_RandomSpawnPoint(g_p); - g_sp->x = ActorExtra[g_i].bposx = g_player[g_p].ps->bobposx = g_player[g_p].ps->oposx = g_player[g_p].ps->posx; - g_sp->y = ActorExtra[g_i].bposy = g_player[g_p].ps->bobposy = g_player[g_p].ps->oposy =g_player[g_p].ps->posy; - g_sp->z = ActorExtra[g_i].bposy = g_player[g_p].ps->oposz =g_player[g_p].ps->posz; - updatesector(g_player[g_p].ps->posx,g_player[g_p].ps->posy,&g_player[g_p].ps->cursectnum); - setsprite(g_player[g_p].ps->i,g_player[g_p].ps->posx,g_player[g_p].ps->posy,g_player[g_p].ps->posz+PHEIGHT); - g_sp->cstat = 257; + P_RandomSpawnPoint(vm.g_p); + vm.g_sp->x = ActorExtra[vm.g_i].bposx = g_player[vm.g_p].ps->bobposx = g_player[vm.g_p].ps->oposx = g_player[vm.g_p].ps->posx; + vm.g_sp->y = ActorExtra[vm.g_i].bposy = g_player[vm.g_p].ps->bobposy = g_player[vm.g_p].ps->oposy =g_player[vm.g_p].ps->posy; + vm.g_sp->z = ActorExtra[vm.g_i].bposy = g_player[vm.g_p].ps->oposz =g_player[vm.g_p].ps->posz; + updatesector(g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,&g_player[vm.g_p].ps->cursectnum); + setsprite(g_player[vm.g_p].ps->i,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz+PHEIGHT); + vm.g_sp->cstat = 257; - g_sp->shade = -12; - g_sp->clipdist = 64; - g_sp->xrepeat = 42; - g_sp->yrepeat = 36; - g_sp->owner = g_i; - g_sp->xoffset = 0; - g_sp->pal = g_player[g_p].ps->palookup; + vm.g_sp->shade = -12; + vm.g_sp->clipdist = 64; + vm.g_sp->xrepeat = 42; + vm.g_sp->yrepeat = 36; + vm.g_sp->owner = vm.g_i; + vm.g_sp->xoffset = 0; + vm.g_sp->pal = g_player[vm.g_p].ps->palookup; - g_player[g_p].ps->last_extra = g_sp->extra = g_player[g_p].ps->max_player_health; - g_player[g_p].ps->wantweaponfire = -1; - g_player[g_p].ps->horiz = 100; - g_player[g_p].ps->on_crane = -1; - g_player[g_p].ps->frag_ps = g_p; - g_player[g_p].ps->horizoff = 0; - g_player[g_p].ps->opyoff = 0; - g_player[g_p].ps->wackedbyactor = -1; - g_player[g_p].ps->shield_amount = g_startArmorAmount; - g_player[g_p].ps->dead_flag = 0; - g_player[g_p].ps->pals_time = 0; - g_player[g_p].ps->footprintcount = 0; - g_player[g_p].ps->weapreccnt = 0; - g_player[g_p].ps->fta = 0; - g_player[g_p].ps->ftq = 0; - g_player[g_p].ps->posxv = g_player[g_p].ps->posyv = 0; - g_player[g_p].ps->rotscrnang = 0; - g_player[g_p].ps->runspeed = g_playerFriction; - g_player[g_p].ps->falling_counter = 0; + g_player[vm.g_p].ps->last_extra = vm.g_sp->extra = g_player[vm.g_p].ps->max_player_health; + g_player[vm.g_p].ps->wantweaponfire = -1; + g_player[vm.g_p].ps->horiz = 100; + g_player[vm.g_p].ps->on_crane = -1; + g_player[vm.g_p].ps->frag_ps = vm.g_p; + g_player[vm.g_p].ps->horizoff = 0; + g_player[vm.g_p].ps->opyoff = 0; + g_player[vm.g_p].ps->wackedbyactor = -1; + g_player[vm.g_p].ps->shield_amount = g_startArmorAmount; + g_player[vm.g_p].ps->dead_flag = 0; + g_player[vm.g_p].ps->pals_time = 0; + g_player[vm.g_p].ps->footprintcount = 0; + g_player[vm.g_p].ps->weapreccnt = 0; + g_player[vm.g_p].ps->fta = 0; + g_player[vm.g_p].ps->ftq = 0; + g_player[vm.g_p].ps->posxv = g_player[vm.g_p].ps->posyv = 0; + g_player[vm.g_p].ps->rotscrnang = 0; + g_player[vm.g_p].ps->runspeed = g_playerFriction; + g_player[vm.g_p].ps->falling_counter = 0; - ActorExtra[g_i].extra = -1; - ActorExtra[g_i].owner = g_i; + ActorExtra[vm.g_i].extra = -1; + ActorExtra[vm.g_i].owner = vm.g_i; - ActorExtra[g_i].cgg = 0; - ActorExtra[g_i].movflag = 0; - ActorExtra[g_i].tempang = 0; - ActorExtra[g_i].actorstayput = -1; - ActorExtra[g_i].dispicnum = 0; - ActorExtra[g_i].owner = g_player[g_p].ps->i; + ActorExtra[vm.g_i].cgg = 0; + ActorExtra[vm.g_i].movflag = 0; + ActorExtra[vm.g_i].tempang = 0; + ActorExtra[vm.g_i].actorstayput = -1; + ActorExtra[vm.g_i].dispicnum = 0; + ActorExtra[vm.g_i].owner = g_player[vm.g_p].ps->i; - P_ResetInventory(g_p); - P_ResetWeapons(g_p); + P_ResetInventory(vm.g_p); + P_ResetWeapons(vm.g_p); - g_player[g_p].ps->reloading = 0; + g_player[vm.g_p].ps->reloading = 0; - g_player[g_p].ps->movement_lock = 0; + g_player[vm.g_p].ps->movement_lock = 0; - X_OnEvent(EVENT_RESETPLAYER, g_player[g_p].ps->i, g_p, -1); + X_OnEvent(EVENT_RESETPLAYER, g_player[vm.g_p].ps->i, vm.g_p, -1); g_cameraDistance = 0; g_cameraClock = totalclock; } - P_UpdateScreenPal(g_player[g_p].ps); + P_UpdateScreenPal(g_player[vm.g_p].ps); //AddLog("EOF: resetplayer"); } break; case CON_IFONWATER: - X_DoConditional(klabs(g_sp->z-sector[g_sp->sectnum].floorz) < (32<<8) && sector[g_sp->sectnum].lotag == 1); + X_DoConditional(klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8) && sector[vm.g_sp->sectnum].lotag == 1); break; case CON_IFINWATER: - X_DoConditional(sector[g_sp->sectnum].lotag == 2); + X_DoConditional(sector[vm.g_sp->sectnum].lotag == 2); break; case CON_IFCOUNT: insptr++; - X_DoConditional(g_t[0] >= *insptr); + X_DoConditional(vm.g_t[0] >= *insptr); break; case CON_IFACTOR: insptr++; - X_DoConditional(g_sp->picnum == *insptr); + X_DoConditional(vm.g_sp->picnum == *insptr); break; case CON_RESETCOUNT: insptr++; - g_t[0] = 0; + vm.g_t[0] = 0; break; case CON_ADDINVENTORY: @@ -2709,59 +2698,59 @@ static int X_DoExecute(void) switch (*(insptr-1)) { case GET_STEROIDS: - g_player[g_p].ps->steroids_amount = *insptr; - g_player[g_p].ps->inven_icon = 2; + g_player[vm.g_p].ps->steroids_amount = *insptr; + g_player[vm.g_p].ps->inven_icon = 2; break; case GET_SHIELD: - g_player[g_p].ps->shield_amount += *insptr;// 100; - if (g_player[g_p].ps->shield_amount > g_player[g_p].ps->max_shield_amount) - g_player[g_p].ps->shield_amount = g_player[g_p].ps->max_shield_amount; + g_player[vm.g_p].ps->shield_amount += *insptr;// 100; + if (g_player[vm.g_p].ps->shield_amount > g_player[vm.g_p].ps->max_shield_amount) + g_player[vm.g_p].ps->shield_amount = g_player[vm.g_p].ps->max_shield_amount; break; case GET_SCUBA: - g_player[g_p].ps->scuba_amount = *insptr;// 1600; - g_player[g_p].ps->inven_icon = 6; + g_player[vm.g_p].ps->scuba_amount = *insptr;// 1600; + g_player[vm.g_p].ps->inven_icon = 6; break; case GET_HOLODUKE: - g_player[g_p].ps->holoduke_amount = *insptr;// 1600; - g_player[g_p].ps->inven_icon = 3; + g_player[vm.g_p].ps->holoduke_amount = *insptr;// 1600; + g_player[vm.g_p].ps->inven_icon = 3; break; case GET_JETPACK: - g_player[g_p].ps->jetpack_amount = *insptr;// 1600; - g_player[g_p].ps->inven_icon = 4; + g_player[vm.g_p].ps->jetpack_amount = *insptr;// 1600; + g_player[vm.g_p].ps->inven_icon = 4; break; case GET_ACCESS: - switch (g_sp->pal) + switch (vm.g_sp->pal) { case 0: - g_player[g_p].ps->got_access |= 1; + g_player[vm.g_p].ps->got_access |= 1; break; case 21: - g_player[g_p].ps->got_access |= 2; + g_player[vm.g_p].ps->got_access |= 2; break; case 23: - g_player[g_p].ps->got_access |= 4; + g_player[vm.g_p].ps->got_access |= 4; break; } break; case GET_HEATS: - g_player[g_p].ps->heat_amount = *insptr; - g_player[g_p].ps->inven_icon = 5; + g_player[vm.g_p].ps->heat_amount = *insptr; + g_player[vm.g_p].ps->inven_icon = 5; break; case GET_FIRSTAID: - g_player[g_p].ps->inven_icon = 1; - g_player[g_p].ps->firstaid_amount = *insptr; + g_player[vm.g_p].ps->inven_icon = 1; + g_player[vm.g_p].ps->firstaid_amount = *insptr; break; case GET_BOOTS: - g_player[g_p].ps->inven_icon = 7; - g_player[g_p].ps->boot_amount = *insptr; + g_player[vm.g_p].ps->inven_icon = 7; + g_player[vm.g_p].ps->boot_amount = *insptr; break; default: OSD_Printf(CON_ERROR "Invalid inventory ID %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1)); @@ -2775,12 +2764,12 @@ static int X_DoExecute(void) { int v1=Gv_GetVarX(*insptr++),v2=Gv_GetVarX(*insptr++),v3=Gv_GetVarX(*insptr++); int v4=Gv_GetVarX(*insptr++),v5=Gv_GetVarX(*insptr++); - A_RadiusDamage(g_i,v1,v2,v3,v4,v5); + A_RadiusDamage(vm.g_i,v1,v2,v3,v4,v5); } break; case CON_HITRADIUS: - A_RadiusDamage(g_i,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5)); + A_RadiusDamage(vm.g_i,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5)); insptr+=6; break; @@ -2791,47 +2780,47 @@ static int X_DoExecute(void) l = *(++insptr); j = 0; - s = sprite[g_player[g_p].ps->i].xvel; + s = sprite[g_player[vm.g_p].ps->i].xvel; - if ((l&8) && g_player[g_p].ps->on_ground && TEST_SYNC_KEY(g_player[g_p].sync->bits, SK_CROUCH)) + if ((l&8) && g_player[vm.g_p].ps->on_ground && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_CROUCH)) j = 1; - else if ((l&16) && g_player[g_p].ps->jumping_counter == 0 && !g_player[g_p].ps->on_ground && - g_player[g_p].ps->poszv > 2048) + else if ((l&16) && g_player[vm.g_p].ps->jumping_counter == 0 && !g_player[vm.g_p].ps->on_ground && + g_player[vm.g_p].ps->poszv > 2048) j = 1; - else if ((l&32) && g_player[g_p].ps->jumping_counter > 348) + else if ((l&32) && g_player[vm.g_p].ps->jumping_counter > 348) j = 1; else if ((l&1) && s >= 0 && s < 8) j = 1; - else if ((l&2) && s >= 8 && !TEST_SYNC_KEY(g_player[g_p].sync->bits, SK_RUN)) + else if ((l&2) && s >= 8 && !TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) j = 1; - else if ((l&4) && s >= 8 && TEST_SYNC_KEY(g_player[g_p].sync->bits, SK_RUN)) + else if ((l&4) && s >= 8 && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) j = 1; - else if ((l&64) && g_player[g_p].ps->posz < (g_sp->z-(48<<8))) + else if ((l&64) && g_player[vm.g_p].ps->posz < (vm.g_sp->z-(48<<8))) j = 1; - else if ((l&128) && s <= -8 && !TEST_SYNC_KEY(g_player[g_p].sync->bits, SK_RUN)) + else if ((l&128) && s <= -8 && !TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) j = 1; - else if ((l&256) && s <= -8 && TEST_SYNC_KEY(g_player[g_p].sync->bits, SK_RUN)) + else if ((l&256) && s <= -8 && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) j = 1; - else if ((l&512) && (g_player[g_p].ps->quick_kick > 0 || (g_player[g_p].ps->curr_weapon == KNEE_WEAPON && g_player[g_p].ps->kickback_pic > 0))) + else if ((l&512) && (g_player[vm.g_p].ps->quick_kick > 0 || (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && g_player[vm.g_p].ps->kickback_pic > 0))) j = 1; - else if ((l&1024) && sprite[g_player[g_p].ps->i].xrepeat < 32) + else if ((l&1024) && sprite[g_player[vm.g_p].ps->i].xrepeat < 32) j = 1; - else if ((l&2048) && g_player[g_p].ps->jetpack_on) + else if ((l&2048) && g_player[vm.g_p].ps->jetpack_on) j = 1; - else if ((l&4096) && g_player[g_p].ps->steroids_amount > 0 && g_player[g_p].ps->steroids_amount < 400) + else if ((l&4096) && g_player[vm.g_p].ps->steroids_amount > 0 && g_player[vm.g_p].ps->steroids_amount < 400) j = 1; - else if ((l&8192) && g_player[g_p].ps->on_ground) + else if ((l&8192) && g_player[vm.g_p].ps->on_ground) j = 1; - else if ((l&16384) && sprite[g_player[g_p].ps->i].xrepeat > 32 && sprite[g_player[g_p].ps->i].extra > 0 && g_player[g_p].ps->timebeforeexit == 0) + else if ((l&16384) && sprite[g_player[vm.g_p].ps->i].xrepeat > 32 && sprite[g_player[vm.g_p].ps->i].extra > 0 && g_player[vm.g_p].ps->timebeforeexit == 0) j = 1; - else if ((l&32768) && sprite[g_player[g_p].ps->i].extra <= 0) + else if ((l&32768) && sprite[g_player[vm.g_p].ps->i].extra <= 0) j = 1; else if ((l&65536L)) { - if (g_sp->picnum == APLAYER && ud.multimode > 1) - j = G_GetAngleDelta(g_player[otherp].ps->ang,getangle(g_player[g_p].ps->posx-g_player[otherp].ps->posx,g_player[g_p].ps->posy-g_player[otherp].ps->posy)); + if (vm.g_sp->picnum == APLAYER && ud.multimode > 1) + j = G_GetAngleDelta(g_player[otherp].ps->ang,getangle(g_player[vm.g_p].ps->posx-g_player[otherp].ps->posx,g_player[vm.g_p].ps->posy-g_player[otherp].ps->posy)); else - j = G_GetAngleDelta(g_player[g_p].ps->ang,getangle(g_sp->x-g_player[g_p].ps->posx,g_sp->y-g_player[g_p].ps->posy)); + j = G_GetAngleDelta(g_player[vm.g_p].ps->ang,getangle(vm.g_sp->x-g_player[vm.g_p].ps->posx,vm.g_sp->y-g_player[vm.g_p].ps->posy)); if (j > -128 && j < 128) j = 1; @@ -2844,29 +2833,29 @@ static int X_DoExecute(void) case CON_IFSTRENGTH: insptr++; - X_DoConditional(g_sp->extra <= *insptr); + X_DoConditional(vm.g_sp->extra <= *insptr); break; case CON_GUTS: insptr += 2; - A_DoGuts(g_i,*(insptr-1),*insptr); + A_DoGuts(vm.g_i,*(insptr-1),*insptr); insptr++; break; case CON_IFSPAWNEDBY: insptr++; - X_DoConditional(ActorExtra[g_i].picnum == *insptr); + X_DoConditional(ActorExtra[vm.g_i].picnum == *insptr); break; case CON_WACKPLAYER: insptr++; - P_ForceAngle(g_player[g_p].ps); + P_ForceAngle(g_player[vm.g_p].ps); return 0; case CON_FLASH: insptr++; - sprite[g_i].shade = -127; - g_player[g_p].ps->visibility = -127; + sprite[vm.g_i].shade = -127; + g_player[vm.g_p].ps->visibility = -127; lastvisinc = totalclock+32; return 0; @@ -2897,21 +2886,21 @@ static int X_DoExecute(void) case CON_STOPALLSOUNDS: insptr++; - if (screenpeek == g_p) + if (screenpeek == vm.g_p) FX_StopAllSounds(); return 0; case CON_IFGAPZL: insptr++; - X_DoConditional(((ActorExtra[g_i].floorz - ActorExtra[g_i].ceilingz) >> 8) < *insptr); + X_DoConditional(((ActorExtra[vm.g_i].floorz - ActorExtra[vm.g_i].ceilingz) >> 8) < *insptr); break; case CON_IFHITSPACE: - X_DoConditional(TEST_SYNC_KEY(g_player[g_p].sync->bits, SK_OPEN)); + X_DoConditional(TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_OPEN)); break; case CON_IFOUTSIDE: - X_DoConditional(sector[g_sp->sectnum].ceilingstat&1); + X_DoConditional(sector[vm.g_sp->sectnum].ceilingstat&1); break; case CON_IFMULTIPLAYER: @@ -2920,9 +2909,9 @@ static int X_DoExecute(void) case CON_OPERATE: insptr++; - if (sector[g_sp->sectnum].lotag == 0) + if (sector[vm.g_sp->sectnum].lotag == 0) { - neartag(g_sp->x,g_sp->y,g_sp->z-(32<<8),g_sp->sectnum,g_sp->ang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,1); + neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,1); if (neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag)) if ((sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz) if ((sector[neartagsector].lotag&16384) == 0) @@ -2936,35 +2925,35 @@ static int X_DoExecute(void) j = nextspritesect[j]; } if (j == -1) - G_OperateSectors(neartagsector,g_i); + G_OperateSectors(neartagsector,vm.g_i); } } break; case CON_IFINSPACE: - X_DoConditional(G_CheckForSpaceCeiling(g_sp->sectnum)); + X_DoConditional(G_CheckForSpaceCeiling(vm.g_sp->sectnum)); break; case CON_SPRITEPAL: insptr++; - if (g_sp->picnum != APLAYER) - ActorExtra[g_i].tempang = g_sp->pal; - g_sp->pal = *insptr++; + if (vm.g_sp->picnum != APLAYER) + ActorExtra[vm.g_i].tempang = vm.g_sp->pal; + vm.g_sp->pal = *insptr++; break; case CON_CACTOR: insptr++; - g_sp->picnum = *insptr++; + vm.g_sp->picnum = *insptr++; break; case CON_IFBULLETNEAR: - X_DoConditional(A_Dodge(g_sp) == 1); + X_DoConditional(A_Dodge(vm.g_sp) == 1); break; case CON_IFRESPAWN: - if (A_CheckEnemySprite(g_sp)) + if (A_CheckEnemySprite(vm.g_sp)) X_DoConditional(ud.respawn_monsters); - else if (A_CheckInventorySprite(g_sp)) + else if (A_CheckInventorySprite(vm.g_sp)) X_DoConditional(ud.respawn_inventory); else X_DoConditional(ud.respawn_items); @@ -2972,19 +2961,19 @@ static int X_DoExecute(void) case CON_IFFLOORDISTL: insptr++; - X_DoConditional((ActorExtra[g_i].floorz - g_sp->z) <= ((*insptr)<<8)); + X_DoConditional((ActorExtra[vm.g_i].floorz - vm.g_sp->z) <= ((*insptr)<<8)); break; case CON_IFCEILINGDISTL: insptr++; - X_DoConditional((g_sp->z - ActorExtra[g_i].ceilingz) <= ((*insptr)<<8)); + X_DoConditional((vm.g_sp->z - ActorExtra[vm.g_i].ceilingz) <= ((*insptr)<<8)); break; case CON_PALFROM: insptr++; - g_player[g_p].ps->pals_time = *insptr++; + g_player[vm.g_p].ps->pals_time = *insptr++; for (j=2;j>=0;j--) - g_player[g_p].ps->pals[2-j] = *insptr++; + g_player[vm.g_p].ps->pals[2-j] = *insptr++; break; case CON_QSPRINTF: @@ -3054,6 +3043,37 @@ static int X_DoExecute(void) break; } } + else if (*insptr&(MAXGAMEVARS<<3)) + { +// FIXME FIXME FIXME + int index, label; + + lVarID ^= (MAXGAMEVARS<<3); + + if (lVarID&(MAXGAMEVARS<<1)) + { + m = -m; + lVarID ^= (MAXGAMEVARS<<1); + } + + insptr++; + + index=Gv_GetVarX(*insptr++); + label=*insptr++; + +/* if ((index < aGameArrays[lVarID].size)&&(index>=0)) + { + OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n",g_errorLineNum,keyw[g_tw], + aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]); + break; + } + else + { + OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); + break; + } */ + break; + } else if (*insptr&(MAXGAMEVARS<<1)) { m = -m; @@ -3077,11 +3097,11 @@ static int X_DoExecute(void) } if (aGameVars[lVarID].dwFlags & GAMEVAR_PERPLAYER) { - Bsprintf(szBuf," (Per Player. Player=%d)",g_p); + Bsprintf(szBuf," (Per Player. Player=%d)",vm.g_p); } else if (aGameVars[lVarID].dwFlags & GAMEVAR_PERACTOR) { - Bsprintf(szBuf," (Per Actor. Actor=%d)",g_i); + Bsprintf(szBuf," (Per Actor. Actor=%d)",vm.g_i); } else { @@ -3140,7 +3160,7 @@ static int X_DoExecute(void) { while (j>=0) { - if (sprite[j].picnum == lType && j != g_i && dist(&sprite[g_i], &sprite[j]) < lMaxDist) + if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) { lFound=j; j = MAXSPRITES; @@ -3155,7 +3175,7 @@ static int X_DoExecute(void) while (j>=0) { - if (sprite[j].picnum == lType && j != g_i && ldist(&sprite[g_i], &sprite[j]) < lMaxDist) + if (sprite[j].picnum == lType && j != vm.g_i && ldist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) { lFound=j; j = MAXSPRITES; @@ -3196,7 +3216,7 @@ static int X_DoExecute(void) { while (j >= 0) { - if (sprite[j].picnum == lType && j != g_i && dist(&sprite[g_i], &sprite[j]) < lMaxDist) + if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) { lFound=j; j = MAXSPRITES; @@ -3211,7 +3231,7 @@ static int X_DoExecute(void) while (j >= 0) { - if (sprite[j].picnum == lType && j != g_i && ldist(&sprite[g_i], &sprite[j]) < lMaxDist) + if (sprite[j].picnum == lType && j != vm.g_i && ldist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) { lFound=j; j = MAXSPRITES; @@ -3246,12 +3266,12 @@ static int X_DoExecute(void) if (j == -1) continue; do { - if (sprite[j].picnum == lType && j != g_i) + if (sprite[j].picnum == lType && j != vm.g_i) { - lTemp=ldist(&sprite[g_i], &sprite[j]); + lTemp=ldist(&sprite[vm.g_i], &sprite[j]); if (lTemp < lMaxDist) { - lTemp2=klabs(sprite[g_i].z-sprite[j].z); + lTemp2=klabs(sprite[vm.g_i].z-sprite[j].z); if (lTemp2 < lMaxZDist) { lFound=j; @@ -3289,12 +3309,12 @@ static int X_DoExecute(void) if (j == -1) continue; do { - if (sprite[j].picnum == lType && j != g_i) + if (sprite[j].picnum == lType && j != vm.g_i) { - lTemp=ldist(&sprite[g_i], &sprite[j]); + lTemp=ldist(&sprite[vm.g_i], &sprite[j]); if (lTemp < lMaxDist) { - lTemp2=klabs(sprite[g_i].z-sprite[j].z); + lTemp2=klabs(sprite[vm.g_i].z-sprite[j].z); if (lTemp2 < lMaxZDist) { lFound=j; @@ -3316,13 +3336,13 @@ static int X_DoExecute(void) case CON_FINDPLAYER: insptr++; - Gv_SetVarX(g_iReturnVarID, A_FindPlayer(&sprite[g_i],&j)); + Gv_SetVarX(g_iReturnVarID, A_FindPlayer(&sprite[vm.g_i],&j)); Gv_SetVarX(*insptr++, j); break; case CON_FINDOTHERPLAYER: insptr++; - Gv_SetVarX(g_iReturnVarID, P_FindOtherPlayer(g_p,&j)); + Gv_SetVarX(g_iReturnVarID, P_FindOtherPlayer(vm.g_p,&j)); Gv_SetVarX(*insptr++, j); break; @@ -3411,10 +3431,10 @@ static int X_DoExecute(void) if (tw == CON_SETACTORVAR) { - Gv_SetVar(lVar1, Gv_GetVarX(j), lSprite, g_p); + Gv_SetVar(lVar1, Gv_GetVarX(j), lSprite, vm.g_p); break; } - Gv_SetVarX(j, Gv_GetVar(lVar1, lSprite, g_p)); + Gv_SetVarX(j, Gv_GetVar(lVar1, lSprite, vm.g_p)); break; } @@ -3426,7 +3446,7 @@ static int X_DoExecute(void) if (*insptr != g_iThisActorID) iPlayer=Gv_GetVarX(*insptr); - else iPlayer = g_p; + else iPlayer = vm.g_p; insptr++; { @@ -3440,10 +3460,10 @@ static int X_DoExecute(void) if (tw == CON_SETPLAYERVAR) { - Gv_SetVar(lVar1, Gv_GetVarX(lVar2), g_i, iPlayer); + Gv_SetVar(lVar1, Gv_GetVarX(lVar2), vm.g_i, iPlayer); break; } - Gv_SetVarX(lVar2, Gv_GetVar(lVar1, g_i, iPlayer)); + Gv_SetVarX(lVar2, Gv_GetVar(lVar1, vm.g_i, iPlayer)); break; } } @@ -3483,24 +3503,24 @@ static int X_DoExecute(void) case CON_GETANGLETOTARGET: insptr++; - // ActorExtra[g_i].lastvx and lastvy are last known location of target. - Gv_SetVarX(*insptr++, getangle(ActorExtra[g_i].lastvx-g_sp->x,ActorExtra[g_i].lastvy-g_sp->y)); + // ActorExtra[vm.g_i].lastvx and lastvy are last known location of target. + Gv_SetVarX(*insptr++, getangle(ActorExtra[vm.g_i].lastvx-vm.g_sp->x,ActorExtra[vm.g_i].lastvy-vm.g_sp->y)); break; case CON_ANGOFFVAR: insptr++; - spriteext[g_i].angoff=Gv_GetVarX(*insptr++); + spriteext[vm.g_i].angoff=Gv_GetVarX(*insptr++); break; case CON_LOCKPLAYER: insptr++; - g_player[g_p].ps->transporter_hold=Gv_GetVarX(*insptr++); + g_player[vm.g_p].ps->transporter_hold=Gv_GetVarX(*insptr++); break; case CON_CHECKAVAILWEAPON: case CON_CHECKAVAILINVEN: insptr++; - j = g_p; + j = vm.g_p; if (*insptr != g_iThisActorID) j=Gv_GetVarX(*insptr); @@ -3521,24 +3541,24 @@ static int X_DoExecute(void) case CON_GETPLAYERANGLE: insptr++; - Gv_SetVarX(*insptr++, g_player[g_p].ps->ang); + Gv_SetVarX(*insptr++, g_player[vm.g_p].ps->ang); break; case CON_SETPLAYERANGLE: insptr++; - g_player[g_p].ps->ang=Gv_GetVarX(*insptr++); - g_player[g_p].ps->ang &= 2047; + g_player[vm.g_p].ps->ang=Gv_GetVarX(*insptr++); + g_player[vm.g_p].ps->ang &= 2047; break; case CON_GETACTORANGLE: insptr++; - Gv_SetVarX(*insptr++, g_sp->ang); + Gv_SetVarX(*insptr++, vm.g_sp->ang); break; case CON_SETACTORANGLE: insptr++; - g_sp->ang=Gv_GetVarX(*insptr++); - g_sp->ang &= 2047; + vm.g_sp->ang=Gv_GetVarX(*insptr++); + vm.g_sp->ang &= 2047; break; case CON_SETVAR: @@ -3557,7 +3577,7 @@ static int X_DoExecute(void) // SetGameArrayID(j,index,value); if (j<0 || j >= g_gameArrayCount || index >= aGameArrays[j].size || index < 0) { - OSD_Printf(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",j,g_i,sprite[g_i].picnum,g_p); + OSD_Printf(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",j,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); return 0; } aGameArrays[j].plValues[index]=value; @@ -3670,7 +3690,7 @@ static int X_DoExecute(void) insptr++; break; } - Gv_SetVarX(*insptr++, g_player[g_p].ps->max_ammo_amount[j]); + Gv_SetVarX(*insptr++, g_player[vm.g_p].ps->max_ammo_amount[j]); break; case CON_SMAXAMMO: @@ -3682,7 +3702,7 @@ static int X_DoExecute(void) insptr++; break; } - g_player[g_p].ps->max_ammo_amount[j]=Gv_GetVarX(*insptr++); + g_player[vm.g_p].ps->max_ammo_amount[j]=Gv_GetVarX(*insptr++); break; case CON_MULVARVAR: @@ -3790,27 +3810,27 @@ static int X_DoExecute(void) case CON_SPGETLOTAG: insptr++; - Gv_SetVarX(g_iLoTagID, g_sp->lotag); + Gv_SetVarX(g_iLoTagID, vm.g_sp->lotag); break; case CON_SPGETHITAG: insptr++; - Gv_SetVarX(g_iHiTagID, g_sp->hitag); + Gv_SetVarX(g_iHiTagID, vm.g_sp->hitag); break; case CON_SECTGETLOTAG: insptr++; - Gv_SetVarX(g_iLoTagID, sector[g_sp->sectnum].lotag); + Gv_SetVarX(g_iLoTagID, sector[vm.g_sp->sectnum].lotag); break; case CON_SECTGETHITAG: insptr++; - Gv_SetVarX(g_iHiTagID, sector[g_sp->sectnum].hitag); + Gv_SetVarX(g_iHiTagID, sector[vm.g_sp->sectnum].hitag); break; case CON_GETTEXTUREFLOOR: insptr++; - Gv_SetVarX(g_iTextureID, sector[g_sp->sectnum].floorpicnum); + Gv_SetVarX(g_iTextureID, sector[vm.g_sp->sectnum].floorpicnum); break; case CON_STARTTRACK: @@ -3844,19 +3864,19 @@ static int X_DoExecute(void) switch (j) { default: - case 0:P_SetGamePalette(g_player[g_p].ps,palette ,0);break; - case 1:P_SetGamePalette(g_player[g_p].ps,waterpal ,0);break; - case 2:P_SetGamePalette(g_player[g_p].ps,slimepal ,0);break; - case 3:P_SetGamePalette(g_player[g_p].ps,drealms ,0);break; - case 4:P_SetGamePalette(g_player[g_p].ps,titlepal ,0);break; - case 5:P_SetGamePalette(g_player[g_p].ps,endingpal,0);break; - case 6:P_SetGamePalette(g_player[g_p].ps,animpal ,0);break; + case 0:P_SetGamePalette(g_player[vm.g_p].ps,palette ,0);break; + case 1:P_SetGamePalette(g_player[vm.g_p].ps,waterpal ,0);break; + case 2:P_SetGamePalette(g_player[vm.g_p].ps,slimepal ,0);break; + case 3:P_SetGamePalette(g_player[vm.g_p].ps,drealms ,0);break; + case 4:P_SetGamePalette(g_player[vm.g_p].ps,titlepal ,0);break; + case 5:P_SetGamePalette(g_player[vm.g_p].ps,endingpal,0);break; + case 6:P_SetGamePalette(g_player[vm.g_p].ps,animpal ,0);break; } break; case CON_GETTEXTURECEILING: insptr++; - Gv_SetVarX(g_iTextureID, sector[g_sp->sectnum].ceilingpicnum); + Gv_SetVarX(g_iTextureID, sector[vm.g_sp->sectnum].ceilingpicnum); break; case CON_IFVARVARAND: @@ -3990,7 +4010,7 @@ static int X_DoExecute(void) case CON_IFPHEALTHL: insptr++; - X_DoConditional(sprite[g_player[g_p].ps->i].extra < *insptr); + X_DoConditional(sprite[g_player[vm.g_p].ps->i].extra < *insptr); break; case CON_IFPINVENTORY: @@ -4000,44 +4020,44 @@ static int X_DoExecute(void) switch (*insptr++) { case GET_STEROIDS: - if (g_player[g_p].ps->steroids_amount != *insptr) + if (g_player[vm.g_p].ps->steroids_amount != *insptr) j = 1; break; case GET_SHIELD: - if (g_player[g_p].ps->shield_amount != g_player[g_p].ps->max_shield_amount) + if (g_player[vm.g_p].ps->shield_amount != g_player[vm.g_p].ps->max_shield_amount) j = 1; break; case GET_SCUBA: - if (g_player[g_p].ps->scuba_amount != *insptr) j = 1; + if (g_player[vm.g_p].ps->scuba_amount != *insptr) j = 1; break; case GET_HOLODUKE: - if (g_player[g_p].ps->holoduke_amount != *insptr) j = 1; + if (g_player[vm.g_p].ps->holoduke_amount != *insptr) j = 1; break; case GET_JETPACK: - if (g_player[g_p].ps->jetpack_amount != *insptr) j = 1; + if (g_player[vm.g_p].ps->jetpack_amount != *insptr) j = 1; break; case GET_ACCESS: - switch (g_sp->pal) + switch (vm.g_sp->pal) { case 0: - if (g_player[g_p].ps->got_access&1) j = 1; + if (g_player[vm.g_p].ps->got_access&1) j = 1; break; case 21: - if (g_player[g_p].ps->got_access&2) j = 1; + if (g_player[vm.g_p].ps->got_access&2) j = 1; break; case 23: - if (g_player[g_p].ps->got_access&4) j = 1; + if (g_player[vm.g_p].ps->got_access&4) j = 1; break; } break; case GET_HEATS: - if (g_player[g_p].ps->heat_amount != *insptr) j = 1; + if (g_player[vm.g_p].ps->heat_amount != *insptr) j = 1; break; case GET_FIRSTAID: - if (g_player[g_p].ps->firstaid_amount != *insptr) j = 1; + if (g_player[vm.g_p].ps->firstaid_amount != *insptr) j = 1; break; case GET_BOOTS: - if (g_player[g_p].ps->boot_amount != *insptr) j = 1; + if (g_player[vm.g_p].ps->boot_amount != *insptr) j = 1; break; default: OSD_Printf(CON_ERROR "invalid inventory ID: %d\n",g_errorLineNum,keyw[g_tw],*(insptr-1)); @@ -4049,41 +4069,41 @@ static int X_DoExecute(void) case CON_PSTOMP: insptr++; - if (g_player[g_p].ps->knee_incs == 0 && sprite[g_player[g_p].ps->i].xrepeat >= 40) - if (cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,g_player[g_p].ps->posx,g_player[g_p].ps->posy,g_player[g_p].ps->posz+(16<<8),sprite[g_player[g_p].ps->i].sectnum)) + if (g_player[vm.g_p].ps->knee_incs == 0 && sprite[g_player[vm.g_p].ps->i].xrepeat >= 40) + if (cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(4<<8),vm.g_sp->sectnum,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz+(16<<8),sprite[g_player[vm.g_p].ps->i].sectnum)) { for (j=ud.multimode-1;j>=0;j--) { - if (g_player[j].ps->actorsqu == g_i) + if (g_player[j].ps->actorsqu == vm.g_i) break; } if (j == -1) { - g_player[g_p].ps->knee_incs = 1; - if (g_player[g_p].ps->weapon_pos == 0) - g_player[g_p].ps->weapon_pos = -1; - g_player[g_p].ps->actorsqu = g_i; + g_player[vm.g_p].ps->knee_incs = 1; + if (g_player[vm.g_p].ps->weapon_pos == 0) + g_player[vm.g_p].ps->weapon_pos = -1; + g_player[vm.g_p].ps->actorsqu = vm.g_i; } } break; case CON_IFAWAYFROMWALL: { - short s1=g_sp->sectnum; + short s1=vm.g_sp->sectnum; j = 0; - updatesector(g_sp->x+108,g_sp->y+108,&s1); - if (s1 == g_sp->sectnum) + updatesector(vm.g_sp->x+108,vm.g_sp->y+108,&s1); + if (s1 == vm.g_sp->sectnum) { - updatesector(g_sp->x-108,g_sp->y-108,&s1); - if (s1 == g_sp->sectnum) + updatesector(vm.g_sp->x-108,vm.g_sp->y-108,&s1); + if (s1 == vm.g_sp->sectnum) { - updatesector(g_sp->x+108,g_sp->y-108,&s1); - if (s1 == g_sp->sectnum) + updatesector(vm.g_sp->x+108,vm.g_sp->y-108,&s1); + if (s1 == vm.g_sp->sectnum) { - updatesector(g_sp->x-108,g_sp->y+108,&s1); - if (s1 == g_sp->sectnum) + updatesector(vm.g_sp->x-108,vm.g_sp->y+108,&s1); + if (s1 == vm.g_sp->sectnum) j = 1; } } @@ -4102,14 +4122,14 @@ static int X_DoExecute(void) break; } - if ((g_p < 0 || g_p >= MAXPLAYERS) && g_scriptSanityChecks) + if ((vm.g_p < 0 || vm.g_p >= MAXPLAYERS) && g_scriptSanityChecks) { - OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],*insptr,g_p); + OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],*insptr,vm.g_p); insptr++; break; } - P_DoQuote(*(insptr++)|MAXQUOTES,g_player[g_p].ps); + P_DoQuote(*(insptr++)|MAXQUOTES,g_player[vm.g_p].ps); break; case CON_USERQUOTE: @@ -4127,16 +4147,16 @@ static int X_DoExecute(void) break; case CON_IFINOUTERSPACE: - X_DoConditional(G_CheckForSpaceFloor(g_sp->sectnum)); + X_DoConditional(G_CheckForSpaceFloor(vm.g_sp->sectnum)); break; case CON_IFNOTMOVING: - X_DoConditional((ActorExtra[g_i].movflag&49152) > 16384); + X_DoConditional((ActorExtra[vm.g_i].movflag&49152) > 16384); break; case CON_RESPAWNHITAG: insptr++; - switch (DynamicTileMap[g_sp->picnum]) + switch (DynamicTileMap[vm.g_sp->picnum]) { case FEM1__STATIC: case FEM2__STATIC: @@ -4151,28 +4171,28 @@ static int X_DoExecute(void) case PODFEM1__STATIC: case NAKED1__STATIC: case STATUE__STATIC: - if (g_sp->yvel) G_OperateRespawns(g_sp->yvel); + if (vm.g_sp->yvel) G_OperateRespawns(vm.g_sp->yvel); break; default: - if (g_sp->hitag >= 0) G_OperateRespawns(g_sp->hitag); + if (vm.g_sp->hitag >= 0) G_OperateRespawns(vm.g_sp->hitag); break; } break; case CON_IFSPRITEPAL: insptr++; - X_DoConditional(g_sp->pal == *insptr); + X_DoConditional(vm.g_sp->pal == *insptr); break; case CON_IFANGDIFFL: insptr++; - j = klabs(G_GetAngleDelta(g_player[g_p].ps->ang,g_sp->ang)); + j = klabs(G_GetAngleDelta(g_player[vm.g_p].ps->ang,vm.g_sp->ang)); X_DoConditional(j <= *insptr); break; case CON_IFNOSOUNDS: for (j=MAXSOUNDS-1;j>=0;j--) - if (g_sounds[j].SoundOwner[0].i == g_i) + if (g_sounds[j].SoundOwner[0].i == vm.g_i) break; X_DoConditional(j < 0); @@ -4180,7 +4200,7 @@ static int X_DoExecute(void) case CON_SPRITEFLAGS: insptr++; - ActorExtra[g_i].flags = Gv_GetVarX(*insptr++); + ActorExtra[vm.g_i].flags = Gv_GetVarX(*insptr++); break; case CON_GETTICKS: @@ -4217,31 +4237,31 @@ static int X_DoExecute(void) void A_LoadActor(int iActor) { - g_i = iActor; // Sprite ID - g_p = -1; // iPlayer; // Player ID - g_x = -1; // lDist; // ?? - g_sp = &sprite[g_i]; // Pointer to sprite structure - g_t = &ActorExtra[g_i].temp_data[0]; // Sprite's 'extra' data - g_return = 0; + vm.g_i = iActor; // Sprite ID + vm.g_p = -1; // iPlayer; // Player ID + vm.g_x = -1; // lDist; // ?? + vm.g_sp = &sprite[vm.g_i]; // Pointer to sprite structure + vm.g_t = &ActorExtra[vm.g_i].temp_data[0]; // Sprite's 'extra' data + vm.g_returnFlag = 0; - if (actorLoadEventScrptr[g_sp->picnum] == 0) return; + if (actorLoadEventScrptr[vm.g_sp->picnum] == 0) return; - insptr = actorLoadEventScrptr[g_sp->picnum]; + insptr = actorLoadEventScrptr[vm.g_sp->picnum]; - g_killitFlag = 0; + vm.g_killitFlag = 0; - if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) + if (vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= MAXSECTORS) { - // if(A_CheckEnemySprite(g_sp)) - // g_player[g_p].ps->actors_killed++; - deletesprite(g_i); + // if(A_CheckEnemySprite(vm.g_sp)) + // g_player[vm.g_p].ps->actors_killed++; + deletesprite(vm.g_i); return; } while (!X_DoExecute()); - if (g_killitFlag == 1) - deletesprite(g_i); + if (vm.g_killitFlag == 1) + deletesprite(vm.g_i); } void A_Execute(int iActor,int iPlayer,int lDist) @@ -4250,51 +4270,51 @@ void A_Execute(int iActor,int iPlayer,int lDist) // if (actorscrptr[sprite[iActor].picnum] == 0) return; - g_i = iActor; // Sprite ID - g_p = iPlayer; // Player ID - g_x = lDist; // ?? - g_sp = &sprite[g_i]; // Pointer to sprite structure - g_t = &ActorExtra[g_i].temp_data[0]; // Sprite's 'extra' data - g_return = 0; + vm.g_i = iActor; // Sprite ID + vm.g_p = iPlayer; // Player ID + vm.g_x = lDist; // ?? + vm.g_sp = &sprite[vm.g_i]; // Pointer to sprite structure + vm.g_t = &ActorExtra[vm.g_i].temp_data[0]; // Sprite's 'extra' data + vm.g_returnFlag = 0; - insptr = 4 + (actorscrptr[g_sp->picnum]); + insptr = 4 + (actorscrptr[vm.g_sp->picnum]); - g_killitFlag = 0; + vm.g_killitFlag = 0; - if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) + if (vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= MAXSECTORS) { - if (A_CheckEnemySprite(g_sp)) - g_player[g_p].ps->actors_killed++; - deletesprite(g_i); + if (A_CheckEnemySprite(vm.g_sp)) + g_player[vm.g_p].ps->actors_killed++; + deletesprite(vm.g_i); return; } /* Qbix: Changed variables to be aware of the sizeof *insptr * (wether it is int vs intptr_t), Although it is specificly cast to intptr_t* * which might be corrected if the code is converted to use offsets */ - if (g_t[4]) + if (vm.g_t[4]) { - g_sp->lotag += TICSPERFRAME; + vm.g_sp->lotag += TICSPERFRAME; - if (g_sp->lotag > *(intptr_t *)(g_t[4]+4*sizeof(*insptr))) + if (vm.g_sp->lotag > *(intptr_t *)(vm.g_t[4]+4*sizeof(*insptr))) { - g_t[2]++; - g_sp->lotag = 0; - g_t[3] += *(intptr_t *)(g_t[4]+3*sizeof(*insptr)); + vm.g_t[2]++; + vm.g_sp->lotag = 0; + vm.g_t[3] += *(intptr_t *)(vm.g_t[4]+3*sizeof(*insptr)); } - if (klabs(g_t[3]) >= klabs(*(intptr_t *)(g_t[4]+sizeof(*insptr)) * *(intptr_t *)(g_t[4]+3*sizeof(*insptr)))) - g_t[3] = 0; + if (klabs(vm.g_t[3]) >= klabs(*(intptr_t *)(vm.g_t[4]+sizeof(*insptr)) * *(intptr_t *)(vm.g_t[4]+3*sizeof(*insptr)))) + vm.g_t[3] = 0; } while (!X_DoExecute()); - if (g_killitFlag == 1) + if (vm.g_killitFlag == 1) { // if player was set to squish, first stop that... - if (g_player[g_p].ps->actorsqu == g_i) - g_player[g_p].ps->actorsqu = -1; - deletesprite(g_i); + if (g_player[vm.g_p].ps->actorsqu == vm.g_i) + g_player[vm.g_p].ps->actorsqu = -1; + deletesprite(vm.g_i); return; } @@ -4302,21 +4322,21 @@ void A_Execute(int iActor,int iPlayer,int lDist) /* if (ud.angleinterpolation) { - temp = (g_sp->ang & 2047) - sprpos[g_i].ang; - sprpos[g_i].oldang = sprpos[g_i].ang; + temp = (vm.g_sp->ang & 2047) - sprpos[vm.g_i].ang; + sprpos[vm.g_i].oldang = sprpos[vm.g_i].ang; if (temp) { temp2 = temp/klabs(temp); if (klabs(temp) > 1024) temp2 = -(temp2); - sprpos[g_i].angdir = temp2; - sprpos[g_i].angdif = min(ud.angleinterpolation,klabs(temp)); - sprpos[g_i].ang += sprpos[g_i].angdif * sprpos[g_i].angdir; - sprpos[g_i].ang &= 2047; + sprpos[vm.g_i].angdir = temp2; + sprpos[vm.g_i].angdif = min(ud.angleinterpolation,klabs(temp)); + sprpos[vm.g_i].ang += sprpos[vm.g_i].angdif * sprpos[vm.g_i].angdir; + sprpos[vm.g_i].ang &= 2047; } } */ - if (g_sp->statnum == 6) - switch (DynamicTileMap[g_sp->picnum]) + if (vm.g_sp->statnum == 6) + switch (DynamicTileMap[vm.g_sp->picnum]) { case RUBBERCAN__STATIC: case EXPLODINGBARREL__STATIC: @@ -4329,28 +4349,28 @@ void A_Execute(int iActor,int iPlayer,int lDist) case NUKEBARRELLEAKED__STATIC: case TRIPBOMB__STATIC: case EGG__STATIC: - if (ActorExtra[g_i].timetosleep > 1) - ActorExtra[g_i].timetosleep--; - else if (ActorExtra[g_i].timetosleep == 1) - changespritestat(g_i,2); + if (ActorExtra[vm.g_i].timetosleep > 1) + ActorExtra[vm.g_i].timetosleep--; + else if (ActorExtra[vm.g_i].timetosleep == 1) + changespritestat(vm.g_i,2); default: return; } - if (g_sp->statnum != 1) + if (vm.g_sp->statnum != 1) return; - if (A_CheckEnemySprite(g_sp)) + if (A_CheckEnemySprite(vm.g_sp)) { - if (g_sp->xrepeat > 60) return; - if (ud.respawn_monsters == 1 && g_sp->extra <= 0) return; + if (vm.g_sp->xrepeat > 60) return; + if (ud.respawn_monsters == 1 && vm.g_sp->extra <= 0) return; } - else if (ud.respawn_items == 1 && (g_sp->cstat&32768)) return; + else if (ud.respawn_items == 1 && (vm.g_sp->cstat&32768)) return; - if (ActorExtra[g_i].timetosleep > 1) - ActorExtra[g_i].timetosleep--; - else if (ActorExtra[g_i].timetosleep == 1) - changespritestat(g_i,2); + if (ActorExtra[vm.g_i].timetosleep > 1) + ActorExtra[vm.g_i].timetosleep--; + else if (ActorExtra[vm.g_i].timetosleep == 1) + changespritestat(vm.g_i,2); } void G_SaveMapState(mapstate_t *save) diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index 6ecefc853..52942ca57 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -29,11 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // this is all the crap for accessing the game's structs through the CON VM // I got a 3-4 fps gain by inlining these... +#ifndef _gamevars_c_ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) { int lValue=0; - if (g_p != myconnectindex) + if (vm.g_p != myconnectindex) { // if (lVar2 == MAXGAMEVARS) // insptr++; @@ -42,7 +43,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); switch (lLabelID) { @@ -52,7 +53,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.god = lValue; return; } - Gv_SetVar(lVar2, ud.god, g_i, g_p); + Gv_SetVar(lVar2, ud.god, vm.g_i, vm.g_p); return; case USERDEFS_WARP_ON: @@ -61,7 +62,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.warp_on = lValue; return; } - Gv_SetVar(lVar2, ud.warp_on, g_i, g_p); + Gv_SetVar(lVar2, ud.warp_on, vm.g_i, vm.g_p); return; case USERDEFS_CASHMAN: @@ -70,7 +71,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.cashman = lValue; return; } - Gv_SetVar(lVar2, ud.cashman, g_i, g_p); + Gv_SetVar(lVar2, ud.cashman, vm.g_i, vm.g_p); return; case USERDEFS_EOG: @@ -79,7 +80,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.eog = lValue; return; } - Gv_SetVar(lVar2, ud.eog, g_i, g_p); + Gv_SetVar(lVar2, ud.eog, vm.g_i, vm.g_p); return; case USERDEFS_SHOWALLMAP: @@ -88,7 +89,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.showallmap = lValue; return; } - Gv_SetVar(lVar2, ud.showallmap, g_i, g_p); + Gv_SetVar(lVar2, ud.showallmap, vm.g_i, vm.g_p); return; case USERDEFS_SHOW_HELP: @@ -97,7 +98,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.show_help = lValue; return; } - Gv_SetVar(lVar2, ud.show_help, g_i, g_p); + Gv_SetVar(lVar2, ud.show_help, vm.g_i, vm.g_p); return; case USERDEFS_SCROLLMODE: @@ -106,7 +107,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.scrollmode = lValue; return; } - Gv_SetVar(lVar2, ud.scrollmode, g_i, g_p); + Gv_SetVar(lVar2, ud.scrollmode, vm.g_i, vm.g_p); return; case USERDEFS_CLIPPING: @@ -115,7 +116,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.clipping = lValue; return; } - Gv_SetVar(lVar2, ud.clipping, g_i, g_p); + Gv_SetVar(lVar2, ud.clipping, vm.g_i, vm.g_p); return; // case USERDEFS_USER_NAME: @@ -124,7 +125,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) // ud.user_name[MAXPLAYERS][32] = lValue; // return; // } - // Gv_SetVar(lVar2, ud.user_name[MAXPLAYERS][32], g_i, g_p); + // Gv_SetVar(lVar2, ud.user_name[MAXPLAYERS][32], vm.g_i, vm.g_p); // return; // case USERDEFS_RIDECULE: @@ -133,7 +134,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) // ud.ridecule = lValue; // return; // } - // Gv_SetVar(lVar2, ud.ridecule, g_i, g_p); + // Gv_SetVar(lVar2, ud.ridecule, vm.g_i, vm.g_p); // return; // case USERDEFS_SAVEGAME: @@ -142,7 +143,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) // ud.savegame = lValue; // return; // } - // Gv_SetVar(lVar2, ud.savegame, g_i, g_p); + // Gv_SetVar(lVar2, ud.savegame, vm.g_i, vm.g_p); // return; // case USERDEFS_PWLOCKOUT: @@ -151,7 +152,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) // ud.pwlockout = lValue; // return; // } - // Gv_SetVar(lVar2, ud.pwlockout, g_i, g_p); + // Gv_SetVar(lVar2, ud.pwlockout, vm.g_i, vm.g_p); // return; // case USERDEFS_RTSNAME: @@ -160,7 +161,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) // ud.rtsname = lValue; // return; // } - // Gv_SetVar(lVar2, ud.rtsname, g_i, g_p); + // Gv_SetVar(lVar2, ud.rtsname, vm.g_i, vm.g_p); // return; case USERDEFS_OVERHEAD_ON: @@ -169,7 +170,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.overhead_on = lValue; return; } - Gv_SetVar(lVar2, ud.overhead_on, g_i, g_p); + Gv_SetVar(lVar2, ud.overhead_on, vm.g_i, vm.g_p); return; case USERDEFS_LAST_OVERHEAD: @@ -178,7 +179,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.last_overhead = lValue; return; } - Gv_SetVar(lVar2, ud.last_overhead, g_i, g_p); + Gv_SetVar(lVar2, ud.last_overhead, vm.g_i, vm.g_p); return; case USERDEFS_SHOWWEAPONS: @@ -187,7 +188,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.showweapons = lValue; return; } - Gv_SetVar(lVar2, ud.showweapons, g_i, g_p); + Gv_SetVar(lVar2, ud.showweapons, vm.g_i, vm.g_p); return; case USERDEFS_PAUSE_ON: @@ -196,7 +197,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.pause_on = lValue; return; } - Gv_SetVar(lVar2, ud.pause_on, g_i, g_p); + Gv_SetVar(lVar2, ud.pause_on, vm.g_i, vm.g_p); return; case USERDEFS_FROM_BONUS: @@ -205,7 +206,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.from_bonus = lValue; return; } - Gv_SetVar(lVar2, ud.from_bonus, g_i, g_p); + Gv_SetVar(lVar2, ud.from_bonus, vm.g_i, vm.g_p); return; case USERDEFS_CAMERASPRITE: @@ -214,7 +215,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.camerasprite = lValue; return; } - Gv_SetVar(lVar2, ud.camerasprite, g_i, g_p); + Gv_SetVar(lVar2, ud.camerasprite, vm.g_i, vm.g_p); return; case USERDEFS_LAST_CAMSPRITE: @@ -223,7 +224,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.last_camsprite = lValue; return; } - Gv_SetVar(lVar2, ud.last_camsprite, g_i, g_p); + Gv_SetVar(lVar2, ud.last_camsprite, vm.g_i, vm.g_p); return; case USERDEFS_LAST_LEVEL: @@ -232,7 +233,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.last_level = lValue; return; } - Gv_SetVar(lVar2, ud.last_level, g_i, g_p); + Gv_SetVar(lVar2, ud.last_level, vm.g_i, vm.g_p); return; case USERDEFS_SECRETLEVEL: @@ -241,7 +242,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.secretlevel = lValue; return; } - Gv_SetVar(lVar2, ud.secretlevel, g_i, g_p); + Gv_SetVar(lVar2, ud.secretlevel, vm.g_i, vm.g_p); return; case USERDEFS_CONST_VISIBILITY: @@ -250,7 +251,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.const_visibility = lValue; return; } - Gv_SetVar(lVar2, ud.const_visibility, g_i, g_p); + Gv_SetVar(lVar2, ud.const_visibility, vm.g_i, vm.g_p); return; case USERDEFS_UW_FRAMERATE: @@ -259,7 +260,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.uw_framerate = lValue; return; } - Gv_SetVar(lVar2, ud.uw_framerate, g_i, g_p); + Gv_SetVar(lVar2, ud.uw_framerate, vm.g_i, vm.g_p); return; case USERDEFS_CAMERA_TIME: @@ -268,7 +269,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.camera_time = lValue; return; } - Gv_SetVar(lVar2, ud.camera_time, g_i, g_p); + Gv_SetVar(lVar2, ud.camera_time, vm.g_i, vm.g_p); return; case USERDEFS_FOLFVEL: @@ -277,7 +278,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.folfvel = lValue; return; } - Gv_SetVar(lVar2, ud.folfvel, g_i, g_p); + Gv_SetVar(lVar2, ud.folfvel, vm.g_i, vm.g_p); return; case USERDEFS_FOLAVEL: @@ -286,7 +287,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.folavel = lValue; return; } - Gv_SetVar(lVar2, ud.folavel, g_i, g_p); + Gv_SetVar(lVar2, ud.folavel, vm.g_i, vm.g_p); return; case USERDEFS_FOLX: @@ -295,7 +296,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.folx = lValue; return; } - Gv_SetVar(lVar2, ud.folx, g_i, g_p); + Gv_SetVar(lVar2, ud.folx, vm.g_i, vm.g_p); return; case USERDEFS_FOLY: @@ -304,7 +305,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.foly = lValue; return; } - Gv_SetVar(lVar2, ud.foly, g_i, g_p); + Gv_SetVar(lVar2, ud.foly, vm.g_i, vm.g_p); return; case USERDEFS_FOLA: @@ -313,7 +314,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.fola = lValue; return; } - Gv_SetVar(lVar2, ud.fola, g_i, g_p); + Gv_SetVar(lVar2, ud.fola, vm.g_i, vm.g_p); return; case USERDEFS_RECCNT: @@ -322,7 +323,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.reccnt = lValue; return; } - Gv_SetVar(lVar2, ud.reccnt, g_i, g_p); + Gv_SetVar(lVar2, ud.reccnt, vm.g_i, vm.g_p); return; case USERDEFS_ENTERED_NAME: @@ -331,7 +332,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.entered_name = lValue; return; } - Gv_SetVar(lVar2, ud.entered_name, g_i, g_p); + Gv_SetVar(lVar2, ud.entered_name, vm.g_i, vm.g_p); return; case USERDEFS_SCREEN_TILTING: @@ -340,7 +341,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.screen_tilting = lValue; return; } - Gv_SetVar(lVar2, ud.screen_tilting, g_i, g_p); + Gv_SetVar(lVar2, ud.screen_tilting, vm.g_i, vm.g_p); return; case USERDEFS_SHADOWS: @@ -349,7 +350,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.shadows = lValue; return; } - Gv_SetVar(lVar2, ud.shadows, g_i, g_p); + Gv_SetVar(lVar2, ud.shadows, vm.g_i, vm.g_p); return; case USERDEFS_FTA_ON: @@ -358,7 +359,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.fta_on = lValue; return; } - Gv_SetVar(lVar2, ud.fta_on, g_i, g_p); + Gv_SetVar(lVar2, ud.fta_on, vm.g_i, vm.g_p); return; case USERDEFS_EXECUTIONS: @@ -367,7 +368,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.executions = lValue; return; } - Gv_SetVar(lVar2, ud.executions, g_i, g_p); + Gv_SetVar(lVar2, ud.executions, vm.g_i, vm.g_p); return; case USERDEFS_AUTO_RUN: @@ -376,7 +377,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.auto_run = lValue; return; } - Gv_SetVar(lVar2, ud.auto_run, g_i, g_p); + Gv_SetVar(lVar2, ud.auto_run, vm.g_i, vm.g_p); return; case USERDEFS_COORDS: @@ -385,7 +386,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.coords = lValue; return; } - Gv_SetVar(lVar2, ud.coords, g_i, g_p); + Gv_SetVar(lVar2, ud.coords, vm.g_i, vm.g_p); return; case USERDEFS_TICKRATE: @@ -394,7 +395,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.tickrate = lValue; return; } - Gv_SetVar(lVar2, ud.tickrate, g_i, g_p); + Gv_SetVar(lVar2, ud.tickrate, vm.g_i, vm.g_p); return; case USERDEFS_M_COOP: @@ -403,7 +404,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_coop = lValue; return; } - Gv_SetVar(lVar2, ud.m_coop, g_i, g_p); + Gv_SetVar(lVar2, ud.m_coop, vm.g_i, vm.g_p); return; case USERDEFS_COOP: @@ -412,7 +413,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.coop = lValue; return; } - Gv_SetVar(lVar2, ud.coop, g_i, g_p); + Gv_SetVar(lVar2, ud.coop, vm.g_i, vm.g_p); return; case USERDEFS_SCREEN_SIZE: @@ -425,7 +426,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) } return; } - Gv_SetVar(lVar2, ud.screen_size, g_i, g_p); + Gv_SetVar(lVar2, ud.screen_size, vm.g_i, vm.g_p); return; case USERDEFS_LOCKOUT: @@ -434,7 +435,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.lockout = lValue; return; } - Gv_SetVar(lVar2, ud.lockout, g_i, g_p); + Gv_SetVar(lVar2, ud.lockout, vm.g_i, vm.g_p); return; case USERDEFS_CROSSHAIR: @@ -443,7 +444,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.crosshair = lValue; return; } - Gv_SetVar(lVar2, ud.crosshair, g_i, g_p); + Gv_SetVar(lVar2, ud.crosshair, vm.g_i, vm.g_p); return; // case USERDEFS_WCHOICE: @@ -452,7 +453,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) // ud.wchoice = lValue; // return; // } - // Gv_SetVar(lVar2, ud.wchoice, g_i, g_p); + // Gv_SetVar(lVar2, ud.wchoice, vm.g_i, vm.g_p); // return; case USERDEFS_PLAYERAI: @@ -461,7 +462,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.playerai = lValue; return; } - Gv_SetVar(lVar2, ud.playerai, g_i, g_p); + Gv_SetVar(lVar2, ud.playerai, vm.g_i, vm.g_p); return; case USERDEFS_RESPAWN_MONSTERS: @@ -470,7 +471,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.respawn_monsters = lValue; return; } - Gv_SetVar(lVar2, ud.respawn_monsters, g_i, g_p); + Gv_SetVar(lVar2, ud.respawn_monsters, vm.g_i, vm.g_p); return; case USERDEFS_RESPAWN_ITEMS: @@ -479,7 +480,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.respawn_items = lValue; return; } - Gv_SetVar(lVar2, ud.respawn_items, g_i, g_p); + Gv_SetVar(lVar2, ud.respawn_items, vm.g_i, vm.g_p); return; case USERDEFS_RESPAWN_INVENTORY: @@ -488,7 +489,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.respawn_inventory = lValue; return; } - Gv_SetVar(lVar2, ud.respawn_inventory, g_i, g_p); + Gv_SetVar(lVar2, ud.respawn_inventory, vm.g_i, vm.g_p); return; case USERDEFS_RECSTAT: @@ -497,7 +498,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.recstat = lValue; return; } - Gv_SetVar(lVar2, ud.recstat, g_i, g_p); + Gv_SetVar(lVar2, ud.recstat, vm.g_i, vm.g_p); return; case USERDEFS_MONSTERS_OFF: @@ -506,7 +507,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.monsters_off = lValue; return; } - Gv_SetVar(lVar2, ud.monsters_off, g_i, g_p); + Gv_SetVar(lVar2, ud.monsters_off, vm.g_i, vm.g_p); return; case USERDEFS_BRIGHTNESS: @@ -515,7 +516,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.brightness = lValue; return; } - Gv_SetVar(lVar2, ud.brightness, g_i, g_p); + Gv_SetVar(lVar2, ud.brightness, vm.g_i, vm.g_p); return; case USERDEFS_M_RESPAWN_ITEMS: @@ -524,7 +525,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_respawn_items = lValue; return; } - Gv_SetVar(lVar2, ud.m_respawn_items, g_i, g_p); + Gv_SetVar(lVar2, ud.m_respawn_items, vm.g_i, vm.g_p); return; case USERDEFS_M_RESPAWN_MONSTERS: @@ -533,7 +534,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_respawn_monsters = lValue; return; } - Gv_SetVar(lVar2, ud.m_respawn_monsters, g_i, g_p); + Gv_SetVar(lVar2, ud.m_respawn_monsters, vm.g_i, vm.g_p); return; case USERDEFS_M_RESPAWN_INVENTORY: @@ -542,7 +543,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_respawn_inventory = lValue; return; } - Gv_SetVar(lVar2, ud.m_respawn_inventory, g_i, g_p); + Gv_SetVar(lVar2, ud.m_respawn_inventory, vm.g_i, vm.g_p); return; case USERDEFS_M_RECSTAT: @@ -551,7 +552,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_recstat = lValue; return; } - Gv_SetVar(lVar2, ud.m_recstat, g_i, g_p); + Gv_SetVar(lVar2, ud.m_recstat, vm.g_i, vm.g_p); return; case USERDEFS_M_MONSTERS_OFF: @@ -560,7 +561,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_monsters_off = lValue; return; } - Gv_SetVar(lVar2, ud.m_monsters_off, g_i, g_p); + Gv_SetVar(lVar2, ud.m_monsters_off, vm.g_i, vm.g_p); return; case USERDEFS_DETAIL: @@ -569,7 +570,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.detail = lValue; return; } - Gv_SetVar(lVar2, ud.detail, g_i, g_p); + Gv_SetVar(lVar2, ud.detail, vm.g_i, vm.g_p); return; case USERDEFS_M_FFIRE: @@ -578,7 +579,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_ffire = lValue; return; } - Gv_SetVar(lVar2, ud.m_ffire, g_i, g_p); + Gv_SetVar(lVar2, ud.m_ffire, vm.g_i, vm.g_p); return; case USERDEFS_FFIRE: @@ -587,7 +588,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.ffire = lValue; return; } - Gv_SetVar(lVar2, ud.ffire, g_i, g_p); + Gv_SetVar(lVar2, ud.ffire, vm.g_i, vm.g_p); return; case USERDEFS_M_PLAYER_SKILL: @@ -596,7 +597,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_player_skill = lValue; return; } - Gv_SetVar(lVar2, ud.m_player_skill, g_i, g_p); + Gv_SetVar(lVar2, ud.m_player_skill, vm.g_i, vm.g_p); return; case USERDEFS_M_LEVEL_NUMBER: @@ -605,7 +606,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_level_number = lValue; return; } - Gv_SetVar(lVar2, ud.m_level_number, g_i, g_p); + Gv_SetVar(lVar2, ud.m_level_number, vm.g_i, vm.g_p); return; case USERDEFS_M_VOLUME_NUMBER: @@ -614,7 +615,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_volume_number = lValue; return; } - Gv_SetVar(lVar2, ud.m_volume_number, g_i, g_p); + Gv_SetVar(lVar2, ud.m_volume_number, vm.g_i, vm.g_p); return; case USERDEFS_MULTIMODE: @@ -623,7 +624,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.multimode = lValue; return; } - Gv_SetVar(lVar2, ud.multimode, g_i, g_p); + Gv_SetVar(lVar2, ud.multimode, vm.g_i, vm.g_p); return; case USERDEFS_PLAYER_SKILL: @@ -632,7 +633,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.player_skill = lValue; return; } - Gv_SetVar(lVar2, ud.player_skill, g_i, g_p); + Gv_SetVar(lVar2, ud.player_skill, vm.g_i, vm.g_p); return; case USERDEFS_LEVEL_NUMBER: @@ -641,7 +642,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.level_number = lValue; return; } - Gv_SetVar(lVar2, ud.level_number, g_i, g_p); + Gv_SetVar(lVar2, ud.level_number, vm.g_i, vm.g_p); return; case USERDEFS_VOLUME_NUMBER: @@ -650,7 +651,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.volume_number = lValue; return; } - Gv_SetVar(lVar2, ud.volume_number, g_i, g_p); + Gv_SetVar(lVar2, ud.volume_number, vm.g_i, vm.g_p); return; case USERDEFS_M_MARKER: @@ -659,7 +660,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_marker = lValue; return; } - Gv_SetVar(lVar2, ud.m_marker, g_i, g_p); + Gv_SetVar(lVar2, ud.m_marker, vm.g_i, vm.g_p); return; case USERDEFS_MARKER: @@ -668,7 +669,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.marker = lValue; return; } - Gv_SetVar(lVar2, ud.marker, g_i, g_p); + Gv_SetVar(lVar2, ud.marker, vm.g_i, vm.g_p); return; case USERDEFS_MOUSEFLIP: @@ -677,7 +678,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.mouseflip = lValue; return; } - Gv_SetVar(lVar2, ud.mouseflip, g_i, g_p); + Gv_SetVar(lVar2, ud.mouseflip, vm.g_i, vm.g_p); return; case USERDEFS_STATUSBARSCALE: @@ -686,7 +687,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.statusbarscale = lValue; return; } - Gv_SetVar(lVar2, ud.statusbarscale, g_i, g_p); + Gv_SetVar(lVar2, ud.statusbarscale, vm.g_i, vm.g_p); return; case USERDEFS_DRAWWEAPON: @@ -695,7 +696,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.drawweapon = lValue; return; } - Gv_SetVar(lVar2, ud.drawweapon, g_i, g_p); + Gv_SetVar(lVar2, ud.drawweapon, vm.g_i, vm.g_p); return; case USERDEFS_MOUSEAIMING: @@ -704,7 +705,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.mouseaiming = lValue; return; } - Gv_SetVar(lVar2, ud.mouseaiming, g_i, g_p); + Gv_SetVar(lVar2, ud.mouseaiming, vm.g_i, vm.g_p); return; case USERDEFS_WEAPONSWITCH: @@ -713,7 +714,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.weaponswitch = lValue; return; } - Gv_SetVar(lVar2, ud.weaponswitch, g_i, g_p); + Gv_SetVar(lVar2, ud.weaponswitch, vm.g_i, vm.g_p); return; case USERDEFS_DEMOCAMS: @@ -722,7 +723,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.democams = lValue; return; } - Gv_SetVar(lVar2, ud.democams, g_i, g_p); + Gv_SetVar(lVar2, ud.democams, vm.g_i, vm.g_p); return; case USERDEFS_COLOR: @@ -731,7 +732,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.color = lValue; return; } - Gv_SetVar(lVar2, ud.color, g_i, g_p); + Gv_SetVar(lVar2, ud.color, vm.g_i, vm.g_p); return; case USERDEFS_MSGDISPTIME: @@ -740,7 +741,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.msgdisptime = lValue; return; } - Gv_SetVar(lVar2, ud.msgdisptime, g_i, g_p); + Gv_SetVar(lVar2, ud.msgdisptime, vm.g_i, vm.g_p); return; case USERDEFS_STATUSBARMODE: @@ -749,7 +750,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.statusbarmode = lValue; return; } - Gv_SetVar(lVar2, ud.statusbarmode, g_i, g_p); + Gv_SetVar(lVar2, ud.statusbarmode, vm.g_i, vm.g_p); return; case USERDEFS_M_NOEXITS: @@ -758,7 +759,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.m_noexits = lValue; return; } - Gv_SetVar(lVar2, ud.m_noexits, g_i, g_p); + Gv_SetVar(lVar2, ud.m_noexits, vm.g_i, vm.g_p); return; case USERDEFS_NOEXITS: @@ -767,7 +768,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.noexits = lValue; return; } - Gv_SetVar(lVar2, ud.noexits, g_i, g_p); + Gv_SetVar(lVar2, ud.noexits, vm.g_i, vm.g_p); return; case USERDEFS_AUTOVOTE: @@ -776,7 +777,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.autovote = lValue; return; } - Gv_SetVar(lVar2, ud.autovote, g_i, g_p); + Gv_SetVar(lVar2, ud.autovote, vm.g_i, vm.g_p); return; case USERDEFS_AUTOMSG: @@ -785,7 +786,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.automsg = lValue; return; } - Gv_SetVar(lVar2, ud.automsg, g_i, g_p); + Gv_SetVar(lVar2, ud.automsg, vm.g_i, vm.g_p); return; case USERDEFS_IDPLAYERS: @@ -794,7 +795,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.idplayers = lValue; return; } - Gv_SetVar(lVar2, ud.idplayers, g_i, g_p); + Gv_SetVar(lVar2, ud.idplayers, vm.g_i, vm.g_p); return; case USERDEFS_TEAM: @@ -803,7 +804,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.team = lValue; return; } - Gv_SetVar(lVar2, ud.team, g_i, g_p); + Gv_SetVar(lVar2, ud.team, vm.g_i, vm.g_p); return; case USERDEFS_VIEWBOB: @@ -812,7 +813,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.viewbob = lValue; return; } - Gv_SetVar(lVar2, ud.viewbob, g_i, g_p); + Gv_SetVar(lVar2, ud.viewbob, vm.g_i, vm.g_p); return; case USERDEFS_WEAPONSWAY: @@ -821,7 +822,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.weaponsway = lValue; return; } - Gv_SetVar(lVar2, ud.weaponsway, g_i, g_p); + Gv_SetVar(lVar2, ud.weaponsway, vm.g_i, vm.g_p); return; case USERDEFS_ANGLEINTERPOLATION: @@ -830,7 +831,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.angleinterpolation = lValue; return; } - Gv_SetVar(lVar2, ud.angleinterpolation, g_i, g_p); + Gv_SetVar(lVar2, ud.angleinterpolation, vm.g_i, vm.g_p); return; case USERDEFS_OBITUARIES: @@ -839,7 +840,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.obituaries = lValue; return; } - Gv_SetVar(lVar2, ud.obituaries, g_i, g_p); + Gv_SetVar(lVar2, ud.obituaries, vm.g_i, vm.g_p); return; case USERDEFS_LEVELSTATS: @@ -848,7 +849,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.levelstats = lValue; return; } - Gv_SetVar(lVar2, ud.levelstats, g_i, g_p); + Gv_SetVar(lVar2, ud.levelstats, vm.g_i, vm.g_p); return; case USERDEFS_CROSSHAIRSCALE: @@ -857,7 +858,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.crosshairscale = lValue; return; } - Gv_SetVar(lVar2, ud.crosshairscale, g_i, g_p); + Gv_SetVar(lVar2, ud.crosshairscale, vm.g_i, vm.g_p); return; case USERDEFS_ALTHUD: @@ -866,7 +867,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.althud = lValue; return; } - Gv_SetVar(lVar2, ud.althud, g_i, g_p); + Gv_SetVar(lVar2, ud.althud, vm.g_i, vm.g_p); return; case USERDEFS_DISPLAY_BONUS_SCREEN: @@ -875,7 +876,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.display_bonus_screen = lValue; return; } - Gv_SetVar(lVar2, ud.display_bonus_screen, g_i, g_p); + Gv_SetVar(lVar2, ud.display_bonus_screen, vm.g_i, vm.g_p); return; case USERDEFS_SHOW_LEVEL_TEXT: @@ -884,7 +885,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.show_level_text = lValue; return; } - Gv_SetVar(lVar2, ud.show_level_text, g_i, g_p); + Gv_SetVar(lVar2, ud.show_level_text, vm.g_i, vm.g_p); return; case USERDEFS_WEAPONSCALE: @@ -893,7 +894,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.weaponscale = lValue; return; } - Gv_SetVar(lVar2, ud.weaponscale, g_i, g_p); + Gv_SetVar(lVar2, ud.weaponscale, vm.g_i, vm.g_p); return; case USERDEFS_TEXTSCALE: @@ -902,7 +903,7 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) ud.textscale = lValue; return; } - Gv_SetVar(lVar2, ud.textscale, g_i, g_p); + Gv_SetVar(lVar2, ud.textscale, vm.g_i, vm.g_p); return; default: @@ -912,23 +913,23 @@ static inline void X_AccessUserdef(int iSet, int lLabelID, int lVar2) static inline void X_AccessActiveProjectile(int iSet, int lVar1, int lLabelID, int lVar2) { - int lValue=0,proj=g_i; + int lValue=0,proj=vm.g_i; if (lVar1 != g_iThisActorID) - proj=Gv_GetVar(lVar1, g_i, g_p); + proj=Gv_GetVar(lVar1, vm.g_i, vm.g_p); if ((proj < 0 || proj >= MAXSPRITES) && g_scriptSanityChecks) { // OSD_Printf("X_AccessActiveProjectile(): invalid projectile (%d)\n",proj); OSD_Printf(CON_ERROR "tried to %s %s on invalid target projectile (%d) %d %d from %s\n",g_errorLineNum,keyw[g_tw], - iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,g_i,g_sp->picnum, + iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,vm.g_sp->picnum, (lVar1= ud.multimode) && g_scriptSanityChecks) { -// OSD_Printf("X_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,g_i); +// OSD_Printf("X_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i); OSD_Printf(CON_ERROR "tried to %s %s on invalid target player (%d) from spr %d gv %s\n",g_errorLineNum,keyw[g_tw], - iSet?"set":"get",PlayerLabels[lLabelID].name,iPlayer,g_i, + iSet?"set":"get",PlayerLabels[lLabelID].name,iPlayer,vm.g_i, (lVar1= PlayerLabels[lLabelID].maxParm2)) && g_scriptSanityChecks) { OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on player (%d) from spr %d\n",g_errorLineNum,keyw[g_tw], - iSet?"set":"get",PlayerLabels[lLabelID].name,lParm2,iPlayer,g_i); + iSet?"set":"get",PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); insptr += (lVar2 == MAXGAMEVARS); return; } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); switch (lLabelID) { @@ -1226,7 +1227,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->zoom=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->zoom, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->zoom, vm.g_i, vm.g_p); return; case PLAYER_EXITX: @@ -1235,7 +1236,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->exitx=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->exitx, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->exitx, vm.g_i, vm.g_p); return; case PLAYER_EXITY: @@ -1244,7 +1245,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->exity=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->exity, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->exity, vm.g_i, vm.g_p); return; case PLAYER_LOOGIEX: @@ -1253,7 +1254,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->loogiex[lParm2]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->loogiex[lParm2], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->loogiex[lParm2], vm.g_i, vm.g_p); return; case PLAYER_LOOGIEY: @@ -1262,7 +1263,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->loogiey[lParm2]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->loogiey[lParm2], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->loogiey[lParm2], vm.g_i, vm.g_p); return; case PLAYER_NUMLOOGS: @@ -1271,7 +1272,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->numloogs=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->numloogs, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->numloogs, vm.g_i, vm.g_p); return; case PLAYER_LOOGCNT: @@ -1280,7 +1281,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->loogcnt=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->loogcnt, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->loogcnt, vm.g_i, vm.g_p); return; case PLAYER_POSX: @@ -1289,7 +1290,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->posx=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->posx, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->posx, vm.g_i, vm.g_p); return; case PLAYER_POSY: @@ -1298,7 +1299,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->posy=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->posy, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->posy, vm.g_i, vm.g_p); return; case PLAYER_POSZ: @@ -1307,7 +1308,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->posz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->posz, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->posz, vm.g_i, vm.g_p); return; case PLAYER_HORIZ: @@ -1316,7 +1317,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->horiz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->horiz, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->horiz, vm.g_i, vm.g_p); return; case PLAYER_OHORIZ: @@ -1325,7 +1326,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->ohoriz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->ohoriz, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->ohoriz, vm.g_i, vm.g_p); return; case PLAYER_OHORIZOFF: @@ -1334,7 +1335,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->ohorizoff=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->ohorizoff, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->ohorizoff, vm.g_i, vm.g_p); return; case PLAYER_INVDISPTIME: @@ -1343,7 +1344,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->invdisptime=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->invdisptime, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->invdisptime, vm.g_i, vm.g_p); return; case PLAYER_BOBPOSX: @@ -1352,7 +1353,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->bobposx=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->bobposx, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->bobposx, vm.g_i, vm.g_p); return; case PLAYER_BOBPOSY: @@ -1361,7 +1362,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->bobposy=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->bobposy, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->bobposy, vm.g_i, vm.g_p); return; case PLAYER_OPOSX: @@ -1370,7 +1371,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->oposx=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->oposx, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->oposx, vm.g_i, vm.g_p); return; case PLAYER_OPOSY: @@ -1379,7 +1380,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->oposy=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->oposy, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->oposy, vm.g_i, vm.g_p); return; case PLAYER_OPOSZ: @@ -1388,7 +1389,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->oposz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->oposz, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->oposz, vm.g_i, vm.g_p); return; case PLAYER_PYOFF: @@ -1397,7 +1398,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->pyoff=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->pyoff, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->pyoff, vm.g_i, vm.g_p); return; case PLAYER_OPYOFF: @@ -1406,7 +1407,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->opyoff=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->opyoff, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->opyoff, vm.g_i, vm.g_p); return; case PLAYER_POSXV: @@ -1415,7 +1416,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->posxv=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->posxv, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->posxv, vm.g_i, vm.g_p); return; case PLAYER_POSYV: @@ -1424,7 +1425,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->posyv=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->posyv, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->posyv, vm.g_i, vm.g_p); return; case PLAYER_POSZV: @@ -1433,7 +1434,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->poszv=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->poszv, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->poszv, vm.g_i, vm.g_p); return; case PLAYER_LAST_PISSED_TIME: @@ -1442,7 +1443,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->last_pissed_time=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_pissed_time, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->last_pissed_time, vm.g_i, vm.g_p); return; case PLAYER_TRUEFZ: @@ -1451,7 +1452,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->truefz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->truefz, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->truefz, vm.g_i, vm.g_p); return; case PLAYER_TRUECZ: @@ -1460,7 +1461,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->truecz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->truecz, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->truecz, vm.g_i, vm.g_p); return; case PLAYER_PLAYER_PAR: @@ -1469,7 +1470,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->player_par=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->player_par, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->player_par, vm.g_i, vm.g_p); return; case PLAYER_VISIBILITY: @@ -1478,7 +1479,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->visibility=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->visibility, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->visibility, vm.g_i, vm.g_p); return; case PLAYER_BOBCOUNTER: @@ -1487,7 +1488,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->bobcounter=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->bobcounter, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->bobcounter, vm.g_i, vm.g_p); return; case PLAYER_WEAPON_SWAY: @@ -1496,7 +1497,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->weapon_sway=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_sway, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_sway, vm.g_i, vm.g_p); return; case PLAYER_PALS_TIME: @@ -1505,7 +1506,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->pals_time=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->pals_time, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->pals_time, vm.g_i, vm.g_p); return; case PLAYER_RANDOMFLAMEX: @@ -1514,7 +1515,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->randomflamex=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->randomflamex, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->randomflamex, vm.g_i, vm.g_p); return; case PLAYER_CRACK_TIME: @@ -1523,7 +1524,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->crack_time=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->crack_time, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->crack_time, vm.g_i, vm.g_p); return; case PLAYER_AIM_MODE: @@ -1532,7 +1533,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->aim_mode=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->aim_mode, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->aim_mode, vm.g_i, vm.g_p); return; case PLAYER_ANG: @@ -1541,7 +1542,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->ang=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->ang, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->ang, vm.g_i, vm.g_p); return; case PLAYER_OANG: @@ -1550,7 +1551,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->oang=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->oang, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->oang, vm.g_i, vm.g_p); return; case PLAYER_ANGVEL: @@ -1559,7 +1560,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->angvel=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->angvel, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->angvel, vm.g_i, vm.g_p); return; case PLAYER_CURSECTNUM: @@ -1568,7 +1569,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->cursectnum=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->cursectnum, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->cursectnum, vm.g_i, vm.g_p); return; case PLAYER_LOOK_ANG: @@ -1577,7 +1578,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->look_ang=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->look_ang, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->look_ang, vm.g_i, vm.g_p); return; case PLAYER_LAST_EXTRA: @@ -1586,7 +1587,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->last_extra=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_extra, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->last_extra, vm.g_i, vm.g_p); return; case PLAYER_SUBWEAPON: @@ -1595,7 +1596,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->subweapon=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->subweapon, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->subweapon, vm.g_i, vm.g_p); return; case PLAYER_AMMO_AMOUNT: @@ -1604,7 +1605,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->ammo_amount[lParm2]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->ammo_amount[lParm2], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->ammo_amount[lParm2], vm.g_i, vm.g_p); return; case PLAYER_WACKEDBYACTOR: @@ -1613,7 +1614,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->wackedbyactor=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->wackedbyactor, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->wackedbyactor, vm.g_i, vm.g_p); return; case PLAYER_FRAG: @@ -1622,7 +1623,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->frag=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->frag, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->frag, vm.g_i, vm.g_p); return; case PLAYER_FRAGGEDSELF: @@ -1631,7 +1632,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->fraggedself=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->fraggedself, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->fraggedself, vm.g_i, vm.g_p); return; case PLAYER_CURR_WEAPON: @@ -1640,7 +1641,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->curr_weapon=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->curr_weapon, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->curr_weapon, vm.g_i, vm.g_p); return; case PLAYER_LAST_WEAPON: @@ -1649,7 +1650,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->last_weapon=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_weapon, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->last_weapon, vm.g_i, vm.g_p); return; case PLAYER_TIPINCS: @@ -1658,7 +1659,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->tipincs=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->tipincs, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->tipincs, vm.g_i, vm.g_p); return; case PLAYER_HORIZOFF: @@ -1667,7 +1668,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->horizoff=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->horizoff, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->horizoff, vm.g_i, vm.g_p); return; case PLAYER_WANTWEAPONFIRE: @@ -1676,7 +1677,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->wantweaponfire=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->wantweaponfire, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->wantweaponfire, vm.g_i, vm.g_p); return; case PLAYER_HOLODUKE_AMOUNT: @@ -1685,7 +1686,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->holoduke_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_amount, vm.g_i, vm.g_p); return; case PLAYER_NEWOWNER: @@ -1694,7 +1695,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->newowner=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->newowner, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->newowner, vm.g_i, vm.g_p); return; case PLAYER_HURT_DELAY: @@ -1703,7 +1704,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->hurt_delay=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->hurt_delay, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->hurt_delay, vm.g_i, vm.g_p); return; case PLAYER_HBOMB_HOLD_DELAY: @@ -1712,7 +1713,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->hbomb_hold_delay=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->hbomb_hold_delay, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->hbomb_hold_delay, vm.g_i, vm.g_p); return; case PLAYER_JUMPING_COUNTER: @@ -1721,7 +1722,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->jumping_counter=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->jumping_counter, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->jumping_counter, vm.g_i, vm.g_p); return; case PLAYER_AIRLEFT: @@ -1730,7 +1731,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->airleft=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->airleft, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->airleft, vm.g_i, vm.g_p); return; case PLAYER_KNEE_INCS: @@ -1739,7 +1740,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->knee_incs=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->knee_incs, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->knee_incs, vm.g_i, vm.g_p); return; case PLAYER_ACCESS_INCS: @@ -1748,7 +1749,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->access_incs=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->access_incs, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->access_incs, vm.g_i, vm.g_p); return; case PLAYER_FTA: @@ -1757,7 +1758,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->fta=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->fta, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->fta, vm.g_i, vm.g_p); return; case PLAYER_FTQ: @@ -1766,7 +1767,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->ftq=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->ftq, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->ftq, vm.g_i, vm.g_p); return; case PLAYER_ACCESS_WALLNUM: @@ -1775,7 +1776,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->access_wallnum=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->access_wallnum, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->access_wallnum, vm.g_i, vm.g_p); return; case PLAYER_ACCESS_SPRITENUM: @@ -1784,7 +1785,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->access_spritenum=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->access_spritenum, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->access_spritenum, vm.g_i, vm.g_p); return; case PLAYER_KICKBACK_PIC: @@ -1793,7 +1794,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->kickback_pic=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->kickback_pic, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->kickback_pic, vm.g_i, vm.g_p); return; case PLAYER_GOT_ACCESS: @@ -1802,7 +1803,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->got_access=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->got_access, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->got_access, vm.g_i, vm.g_p); return; case PLAYER_WEAPON_ANG: @@ -1811,7 +1812,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->weapon_ang=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_ang, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_ang, vm.g_i, vm.g_p); return; case PLAYER_FIRSTAID_AMOUNT: @@ -1820,7 +1821,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->firstaid_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->firstaid_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->firstaid_amount, vm.g_i, vm.g_p); return; case PLAYER_SOMETHINGONPLAYER: @@ -1829,7 +1830,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->somethingonplayer=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->somethingonplayer, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->somethingonplayer, vm.g_i, vm.g_p); return; case PLAYER_ON_CRANE: @@ -1838,7 +1839,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->on_crane=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->on_crane, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->on_crane, vm.g_i, vm.g_p); return; case PLAYER_I: @@ -1847,7 +1848,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->i=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->i, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->i, vm.g_i, vm.g_p); return; case PLAYER_ONE_PARALLAX_SECTNUM: @@ -1856,7 +1857,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->one_parallax_sectnum=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->one_parallax_sectnum, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->one_parallax_sectnum, vm.g_i, vm.g_p); return; case PLAYER_OVER_SHOULDER_ON: @@ -1865,7 +1866,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->over_shoulder_on=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->over_shoulder_on, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->over_shoulder_on, vm.g_i, vm.g_p); return; case PLAYER_RANDOM_CLUB_FRAME: @@ -1874,7 +1875,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->random_club_frame=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->random_club_frame, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->random_club_frame, vm.g_i, vm.g_p); return; case PLAYER_FIST_INCS: @@ -1883,7 +1884,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->fist_incs=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->fist_incs, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->fist_incs, vm.g_i, vm.g_p); return; case PLAYER_ONE_EIGHTY_COUNT: @@ -1892,7 +1893,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->one_eighty_count=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->one_eighty_count, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->one_eighty_count, vm.g_i, vm.g_p); return; case PLAYER_CHEAT_PHASE: @@ -1901,7 +1902,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->cheat_phase=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->cheat_phase, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->cheat_phase, vm.g_i, vm.g_p); return; case PLAYER_DUMMYPLAYERSPRITE: @@ -1910,7 +1911,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->dummyplayersprite=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->dummyplayersprite, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->dummyplayersprite, vm.g_i, vm.g_p); return; case PLAYER_EXTRA_EXTRA8: @@ -1919,7 +1920,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->extra_extra8=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->extra_extra8, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->extra_extra8, vm.g_i, vm.g_p); return; case PLAYER_QUICK_KICK: @@ -1928,7 +1929,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->quick_kick=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->quick_kick, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->quick_kick, vm.g_i, vm.g_p); return; case PLAYER_HEAT_AMOUNT: @@ -1937,7 +1938,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->heat_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->heat_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->heat_amount, vm.g_i, vm.g_p); return; case PLAYER_ACTORSQU: @@ -1946,7 +1947,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->actorsqu=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->actorsqu, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->actorsqu, vm.g_i, vm.g_p); return; case PLAYER_TIMEBEFOREEXIT: @@ -1955,7 +1956,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->timebeforeexit=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->timebeforeexit, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->timebeforeexit, vm.g_i, vm.g_p); return; case PLAYER_CUSTOMEXITSOUND: @@ -1964,7 +1965,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->customexitsound=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->customexitsound, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->customexitsound, vm.g_i, vm.g_p); return; case PLAYER_WEAPRECS: @@ -1973,7 +1974,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->weaprecs[15]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->weaprecs[15], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->weaprecs[15], vm.g_i, vm.g_p); return; case PLAYER_WEAPRECCNT: @@ -1982,7 +1983,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->weapreccnt=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapreccnt, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->weapreccnt, vm.g_i, vm.g_p); return; case PLAYER_INTERFACE_TOGGLE_FLAG: @@ -1991,7 +1992,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->interface_toggle_flag=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->interface_toggle_flag, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->interface_toggle_flag, vm.g_i, vm.g_p); return; case PLAYER_ROTSCRNANG: @@ -2000,7 +2001,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->rotscrnang=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->rotscrnang, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->rotscrnang, vm.g_i, vm.g_p); return; case PLAYER_DEAD_FLAG: @@ -2009,7 +2010,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->dead_flag=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->dead_flag, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->dead_flag, vm.g_i, vm.g_p); return; case PLAYER_SHOW_EMPTY_WEAPON: @@ -2018,7 +2019,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->show_empty_weapon=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->show_empty_weapon, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->show_empty_weapon, vm.g_i, vm.g_p); return; case PLAYER_SCUBA_AMOUNT: @@ -2027,7 +2028,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->scuba_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->scuba_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->scuba_amount, vm.g_i, vm.g_p); return; case PLAYER_JETPACK_AMOUNT: @@ -2036,7 +2037,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->jetpack_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->jetpack_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->jetpack_amount, vm.g_i, vm.g_p); return; case PLAYER_STEROIDS_AMOUNT: @@ -2045,7 +2046,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->steroids_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->steroids_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->steroids_amount, vm.g_i, vm.g_p); return; case PLAYER_SHIELD_AMOUNT: @@ -2054,7 +2055,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->shield_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->shield_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->shield_amount, vm.g_i, vm.g_p); return; case PLAYER_HOLODUKE_ON: @@ -2063,7 +2064,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->holoduke_on=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_on, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->holoduke_on, vm.g_i, vm.g_p); return; case PLAYER_PYCOUNT: @@ -2072,7 +2073,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->pycount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->pycount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->pycount, vm.g_i, vm.g_p); return; case PLAYER_WEAPON_POS: @@ -2081,7 +2082,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->weapon_pos=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_pos, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->weapon_pos, vm.g_i, vm.g_p); return; case PLAYER_FRAG_PS: @@ -2090,7 +2091,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->frag_ps=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->frag_ps, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->frag_ps, vm.g_i, vm.g_p); return; case PLAYER_TRANSPORTER_HOLD: @@ -2099,7 +2100,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->transporter_hold=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->transporter_hold, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->transporter_hold, vm.g_i, vm.g_p); return; case PLAYER_LAST_FULL_WEAPON: @@ -2108,7 +2109,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->last_full_weapon=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_full_weapon, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->last_full_weapon, vm.g_i, vm.g_p); return; case PLAYER_FOOTPRINTSHADE: @@ -2117,7 +2118,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->footprintshade=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintshade, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintshade, vm.g_i, vm.g_p); return; case PLAYER_BOOT_AMOUNT: @@ -2126,7 +2127,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->boot_amount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->boot_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->boot_amount, vm.g_i, vm.g_p); return; case PLAYER_SCREAM_VOICE: @@ -2135,7 +2136,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->scream_voice=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->scream_voice, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->scream_voice, vm.g_i, vm.g_p); return; case PLAYER_GM: @@ -2144,7 +2145,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->gm=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->gm, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->gm, vm.g_i, vm.g_p); return; case PLAYER_ON_WARPING_SECTOR: @@ -2153,7 +2154,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->on_warping_sector=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->on_warping_sector, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->on_warping_sector, vm.g_i, vm.g_p); return; case PLAYER_FOOTPRINTCOUNT: @@ -2162,7 +2163,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->footprintcount=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintcount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintcount, vm.g_i, vm.g_p); return; case PLAYER_HBOMB_ON: @@ -2171,7 +2172,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->hbomb_on=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->hbomb_on, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->hbomb_on, vm.g_i, vm.g_p); return; case PLAYER_JUMPING_TOGGLE: @@ -2180,7 +2181,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->jumping_toggle=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->jumping_toggle, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->jumping_toggle, vm.g_i, vm.g_p); return; case PLAYER_RAPID_FIRE_HOLD: @@ -2189,7 +2190,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->rapid_fire_hold=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->rapid_fire_hold, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->rapid_fire_hold, vm.g_i, vm.g_p); return; case PLAYER_ON_GROUND: @@ -2198,7 +2199,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->on_ground=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->on_ground, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->on_ground, vm.g_i, vm.g_p); return; /* case PLAYER_NAME: @@ -2207,7 +2208,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->name[32]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->name[32], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->name[32], vm.g_i, vm.g_p); return;*/ case PLAYER_INVEN_ICON: @@ -2216,7 +2217,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->inven_icon=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->inven_icon, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->inven_icon, vm.g_i, vm.g_p); return; case PLAYER_BUTTONPALETTE: @@ -2225,7 +2226,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->buttonpalette=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->buttonpalette, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->buttonpalette, vm.g_i, vm.g_p); return; case PLAYER_JETPACK_ON: @@ -2234,7 +2235,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->jetpack_on=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->jetpack_on, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->jetpack_on, vm.g_i, vm.g_p); return; case PLAYER_SPRITEBRIDGE: @@ -2243,7 +2244,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->spritebridge=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->spritebridge, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->spritebridge, vm.g_i, vm.g_p); return; case PLAYER_LASTRANDOMSPOT: @@ -2252,7 +2253,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->lastrandomspot=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->lastrandomspot, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->lastrandomspot, vm.g_i, vm.g_p); return; case PLAYER_SCUBA_ON: @@ -2261,7 +2262,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->scuba_on=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->scuba_on, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->scuba_on, vm.g_i, vm.g_p); return; case PLAYER_FOOTPRINTPAL: @@ -2270,7 +2271,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->footprintpal=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintpal, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->footprintpal, vm.g_i, vm.g_p); return; case PLAYER_HEAT_ON: @@ -2285,7 +2286,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, } return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->heat_on, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->heat_on, vm.g_i, vm.g_p); return; case PLAYER_HOLSTER_WEAPON: @@ -2294,7 +2295,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->holster_weapon=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->holster_weapon, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->holster_weapon, vm.g_i, vm.g_p); return; case PLAYER_FALLING_COUNTER: @@ -2303,7 +2304,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->falling_counter=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->falling_counter, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->falling_counter, vm.g_i, vm.g_p); return; case PLAYER_GOTWEAPON: @@ -2312,7 +2313,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->gotweapon[lParm2]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->gotweapon[lParm2], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->gotweapon[lParm2], vm.g_i, vm.g_p); return; case PLAYER_REFRESH_INVENTORY: @@ -2321,7 +2322,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->refresh_inventory=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->refresh_inventory, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->refresh_inventory, vm.g_i, vm.g_p); return; // case PLAYER_PALETTE: @@ -2331,7 +2332,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, // } // return; } // { - // Gv_SetVar(lVar2, g_player[iPlayer].ps->palette, g_i, g_p); + // Gv_SetVar(lVar2, g_player[iPlayer].ps->palette, vm.g_i, vm.g_p); // } // return; @@ -2341,7 +2342,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->toggle_key_flag=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->toggle_key_flag, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->toggle_key_flag, vm.g_i, vm.g_p); return; case PLAYER_KNUCKLE_INCS: @@ -2350,7 +2351,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->knuckle_incs=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->knuckle_incs, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->knuckle_incs, vm.g_i, vm.g_p); return; case PLAYER_WALKING_SND_TOGGLE: @@ -2359,7 +2360,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->walking_snd_toggle=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->walking_snd_toggle, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->walking_snd_toggle, vm.g_i, vm.g_p); return; case PLAYER_PALOOKUP: @@ -2368,7 +2369,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->palookup=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->palookup, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->palookup, vm.g_i, vm.g_p); return; case PLAYER_HARD_LANDING: @@ -2377,7 +2378,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->hard_landing=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->hard_landing, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->hard_landing, vm.g_i, vm.g_p); return; case PLAYER_MAX_SECRET_ROOMS: @@ -2386,7 +2387,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->max_secret_rooms=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_secret_rooms, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->max_secret_rooms, vm.g_i, vm.g_p); return; case PLAYER_SECRET_ROOMS: @@ -2395,7 +2396,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->secret_rooms=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->secret_rooms, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->secret_rooms, vm.g_i, vm.g_p); return; case PLAYER_PALS: @@ -2404,7 +2405,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->pals[lParm2]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->pals[lParm2], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->pals[lParm2], vm.g_i, vm.g_p); return; case PLAYER_MAX_ACTORS_KILLED: @@ -2413,7 +2414,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->max_actors_killed=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_actors_killed, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->max_actors_killed, vm.g_i, vm.g_p); return; case PLAYER_ACTORS_KILLED: @@ -2422,7 +2423,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->actors_killed=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->actors_killed, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->actors_killed, vm.g_i, vm.g_p); return; case PLAYER_RETURN_TO_CENTER: @@ -2431,7 +2432,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->return_to_center=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->return_to_center, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->return_to_center, vm.g_i, vm.g_p); return; case PLAYER_RUNSPEED: @@ -2440,7 +2441,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->runspeed=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->runspeed, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->runspeed, vm.g_i, vm.g_p); return; case PLAYER_SBS: @@ -2449,7 +2450,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->sbs=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->sbs, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->sbs, vm.g_i, vm.g_p); return; case PLAYER_RELOADING: @@ -2458,7 +2459,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->reloading=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->reloading, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->reloading, vm.g_i, vm.g_p); return; case PLAYER_AUTO_AIM: @@ -2467,7 +2468,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->auto_aim=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->auto_aim, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->auto_aim, vm.g_i, vm.g_p); return; case PLAYER_MOVEMENT_LOCK: @@ -2476,7 +2477,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->movement_lock=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->movement_lock, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->movement_lock, vm.g_i, vm.g_p); return; case PLAYER_SOUND_PITCH: @@ -2485,7 +2486,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->sound_pitch=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->sound_pitch, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->sound_pitch, vm.g_i, vm.g_p); return; case PLAYER_WEAPONSWITCH: @@ -2494,7 +2495,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->weaponswitch=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->weaponswitch, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->weaponswitch, vm.g_i, vm.g_p); return; case PLAYER_TEAM: @@ -2503,7 +2504,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->team=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->team, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->team, vm.g_i, vm.g_p); return; case PLAYER_MAX_PLAYER_HEALTH: @@ -2512,7 +2513,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->max_player_health = lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_player_health, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->max_player_health, vm.g_i, vm.g_p); return; case PLAYER_MAX_SHIELD_AMOUNT: @@ -2521,7 +2522,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->max_shield_amount = lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_shield_amount, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->max_shield_amount, vm.g_i, vm.g_p); return; case PLAYER_MAX_AMMO_AMOUNT: @@ -2530,7 +2531,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->max_ammo_amount[lParm2]=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->max_ammo_amount[lParm2], g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->max_ammo_amount[lParm2], vm.g_i, vm.g_p); return; case PLAYER_LAST_QUICK_KICK: @@ -2539,7 +2540,7 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, g_player[iPlayer].ps->last_quick_kick=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].ps->last_quick_kick, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].ps->last_quick_kick, vm.g_i, vm.g_p); return; default: @@ -2550,20 +2551,20 @@ static inline void X_AccessPlayer(int iSet, int lVar1, int lLabelID, int lVar2, static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lVar2) { int lValue=0; - int iPlayer=g_p; + int iPlayer=vm.g_p; if (lVar1 != g_iThisActorID) - iPlayer=Gv_GetVar(lVar1, g_i, g_p); + iPlayer=Gv_GetVar(lVar1, vm.g_i, vm.g_p); if ((iPlayer<0 || iPlayer >= ud.multimode) && g_scriptSanityChecks) { insptr += (lVar2 == MAXGAMEVARS); - OSD_Printf(CON_ERROR "invalid target player (%d) %d\n",g_errorLineNum,keyw[g_tw],iPlayer,g_i); + OSD_Printf(CON_ERROR "invalid target player (%d) %d\n",g_errorLineNum,keyw[g_tw],iPlayer,vm.g_i); return; } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); switch (lLabelID) { @@ -2573,7 +2574,7 @@ static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lV g_player[iPlayer].sync->avel=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->avel, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].sync->avel, vm.g_i, vm.g_p); return; case INPUT_HORZ: @@ -2582,7 +2583,7 @@ static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lV g_player[iPlayer].sync->horz=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->horz, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].sync->horz, vm.g_i, vm.g_p); return; case INPUT_FVEL: @@ -2591,7 +2592,7 @@ static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lV g_player[iPlayer].sync->fvel=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->fvel, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].sync->fvel, vm.g_i, vm.g_p); return; case INPUT_SVEL: @@ -2600,7 +2601,7 @@ static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lV g_player[iPlayer].sync->svel=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->svel, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].sync->svel, vm.g_i, vm.g_p); return; case INPUT_BITS: @@ -2609,7 +2610,7 @@ static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lV g_player[iPlayer].sync->bits=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->bits, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].sync->bits, vm.g_i, vm.g_p); return; case INPUT_EXTBITS: @@ -2618,7 +2619,7 @@ static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lV g_player[iPlayer].sync->extbits=lValue; return; } - Gv_SetVar(lVar2, g_player[iPlayer].sync->extbits, g_i, g_p); + Gv_SetVar(lVar2, g_player[iPlayer].sync->extbits, vm.g_i, vm.g_p); return; default: return; @@ -2628,7 +2629,7 @@ static inline void X_AccessPlayerInput(int iSet, int lVar1, int lLabelID, int lV static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) { int lValue=0; - int iWall = Gv_GetVar(lVar1, g_i, g_p); + int iWall = Gv_GetVar(lVar1, vm.g_i, vm.g_p); if ((iWall<0 || iWall >= numwalls) && g_scriptSanityChecks) { @@ -2638,7 +2639,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); switch (lLabelID) { @@ -2648,7 +2649,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].x=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].x, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].x, vm.g_i, vm.g_p); return; case WALL_Y: @@ -2657,7 +2658,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].y=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].y, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].y, vm.g_i, vm.g_p); return; case WALL_POINT2: @@ -2666,7 +2667,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].point2=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].point2, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].point2, vm.g_i, vm.g_p); return; case WALL_NEXTWALL: @@ -2675,7 +2676,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].nextwall=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].nextwall, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].nextwall, vm.g_i, vm.g_p); return; case WALL_NEXTSECTOR: @@ -2684,7 +2685,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].nextsector=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].nextsector, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].nextsector, vm.g_i, vm.g_p); return; case WALL_CSTAT: @@ -2693,7 +2694,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].cstat=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].cstat, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].cstat, vm.g_i, vm.g_p); return; case WALL_PICNUM: @@ -2702,7 +2703,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].picnum=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].picnum, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].picnum, vm.g_i, vm.g_p); return; case WALL_OVERPICNUM: @@ -2711,7 +2712,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].overpicnum=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].overpicnum, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].overpicnum, vm.g_i, vm.g_p); return; case WALL_SHADE: @@ -2720,7 +2721,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].shade=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].shade, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].shade, vm.g_i, vm.g_p); return; case WALL_PAL: @@ -2729,7 +2730,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].pal=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].pal, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].pal, vm.g_i, vm.g_p); return; case WALL_XREPEAT: @@ -2738,7 +2739,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].xrepeat=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].xrepeat, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].xrepeat, vm.g_i, vm.g_p); return; case WALL_YREPEAT: @@ -2747,7 +2748,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].yrepeat=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].yrepeat, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].yrepeat, vm.g_i, vm.g_p); return; case WALL_XPANNING: @@ -2756,7 +2757,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].xpanning=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].xpanning, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].xpanning, vm.g_i, vm.g_p); return; case WALL_YPANNING: @@ -2765,7 +2766,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].ypanning=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].ypanning, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].ypanning, vm.g_i, vm.g_p); return; case WALL_LOTAG: @@ -2774,7 +2775,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].lotag=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].lotag, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].lotag, vm.g_i, vm.g_p); return; case WALL_HITAG: @@ -2783,7 +2784,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].hitag=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].hitag, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].hitag, vm.g_i, vm.g_p); return; case WALL_EXTRA: @@ -2792,7 +2793,7 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) wall[iWall].extra=lValue; return; } - Gv_SetVar(lVar2, wall[iWall].extra, g_i, g_p); + Gv_SetVar(lVar2, wall[iWall].extra, vm.g_i, vm.g_p); return; default: return; @@ -2802,10 +2803,10 @@ static inline void X_AccessWall(int iSet, int lVar1, int lLabelID, int lVar2) static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) { int lValue=0; - int iSector=sprite[g_i].sectnum; + int iSector=sprite[vm.g_i].sectnum; if (lVar1 != g_iThisActorID) - iSector=Gv_GetVar(lVar1, g_i, g_p); + iSector=Gv_GetVar(lVar1, vm.g_i, vm.g_p); if ((iSector<0 || iSector >= numsectors) && g_scriptSanityChecks) { @@ -2815,7 +2816,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); switch (lLabelID) { @@ -2825,7 +2826,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].wallptr=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].wallptr,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].wallptr,vm.g_i,vm.g_p); return; case SECTOR_WALLNUM: @@ -2834,7 +2835,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].wallnum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].wallnum,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].wallnum,vm.g_i,vm.g_p); return; case SECTOR_CEILINGZ: @@ -2843,7 +2844,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingz=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingz,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingz,vm.g_i,vm.g_p); return; case SECTOR_FLOORZ: @@ -2852,7 +2853,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorz=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorz,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorz,vm.g_i,vm.g_p); return; case SECTOR_CEILINGSTAT: @@ -2861,7 +2862,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingstat=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingstat,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingstat,vm.g_i,vm.g_p); return; case SECTOR_FLOORSTAT: @@ -2870,7 +2871,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorstat=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorstat,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorstat,vm.g_i,vm.g_p); return; case SECTOR_CEILINGPICNUM: @@ -2879,7 +2880,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingpicnum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingpicnum,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingpicnum,vm.g_i,vm.g_p); return; case SECTOR_CEILINGSLOPE: @@ -2888,7 +2889,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingheinum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingheinum,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingheinum,vm.g_i,vm.g_p); return; case SECTOR_CEILINGSHADE: @@ -2897,7 +2898,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingshade=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingshade,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingshade,vm.g_i,vm.g_p); return; case SECTOR_CEILINGPAL: @@ -2906,7 +2907,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingpal=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingpal,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingpal,vm.g_i,vm.g_p); return; case SECTOR_CEILINGXPANNING: @@ -2915,7 +2916,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingxpanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingxpanning,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingxpanning,vm.g_i,vm.g_p); return; case SECTOR_CEILINGYPANNING: @@ -2924,7 +2925,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].ceilingypanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].ceilingypanning,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].ceilingypanning,vm.g_i,vm.g_p); return; case SECTOR_FLOORPICNUM: @@ -2933,7 +2934,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorpicnum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorpicnum,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorpicnum,vm.g_i,vm.g_p); return; case SECTOR_FLOORSLOPE: @@ -2942,7 +2943,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorheinum=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorheinum,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorheinum,vm.g_i,vm.g_p); return; case SECTOR_FLOORSHADE: @@ -2951,7 +2952,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorshade=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorshade,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorshade,vm.g_i,vm.g_p); return; case SECTOR_FLOORPAL: @@ -2960,7 +2961,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorpal=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorpal,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorpal,vm.g_i,vm.g_p); return; case SECTOR_FLOORXPANNING: @@ -2969,7 +2970,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorxpanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorxpanning,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorxpanning,vm.g_i,vm.g_p); return; case SECTOR_FLOORYPANNING: @@ -2978,7 +2979,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].floorypanning=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].floorypanning,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].floorypanning,vm.g_i,vm.g_p); return; case SECTOR_VISIBILITY: @@ -2987,7 +2988,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].visibility=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].visibility,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].visibility,vm.g_i,vm.g_p); return; case SECTOR_ALIGNTO: @@ -2996,7 +2997,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].filler=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].filler,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].filler,vm.g_i,vm.g_p); return; case SECTOR_LOTAG: @@ -3005,7 +3006,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].lotag=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].lotag,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].lotag,vm.g_i,vm.g_p); return; case SECTOR_HITAG: @@ -3014,7 +3015,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].hitag=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].hitag,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].hitag,vm.g_i,vm.g_p); return; case SECTOR_EXTRA: @@ -3023,7 +3024,7 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) sector[iSector].extra=lValue; return; } - Gv_SetVar(lVar2, sector[iSector].extra,g_i,g_p); + Gv_SetVar(lVar2, sector[iSector].extra,vm.g_i,vm.g_p); return; default: @@ -3034,15 +3035,15 @@ static inline void X_AccessSector(int iSet, int lVar1, int lLabelID, int lVar2) static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2) { int lValue=0; - int iActor=g_i; + int iActor=vm.g_i; if (lVar1 != g_iThisActorID) - iActor=Gv_GetVar(lVar1, g_i, g_p); + iActor=Gv_GetVar(lVar1, vm.g_i, vm.g_p); if ((iActor < 0 || iActor >= MAXSPRITES) && g_scriptSanityChecks) { OSD_Printf(CON_ERROR "tried to %s %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",g_errorLineNum,keyw[g_tw], - iSet?"set":"get",ActorLabels[lLabelID].name,iActor,g_i,g_sp->picnum, + iSet?"set":"get",ActorLabels[lLabelID].name,iActor,vm.g_i,vm.g_sp->picnum, (lVar1= ActorLabels[lLabelID].maxParm2)) && g_scriptSanityChecks) { OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on sprite (%d) from spr %d\n",g_errorLineNum,keyw[g_tw], - iSet?"set":"get",ActorLabels[lLabelID].name,lParm2,iActor,g_i); + iSet?"set":"get",ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); insptr += (lVar2 == MAXGAMEVARS); return; } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); switch (lLabelID) { @@ -3067,7 +3068,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].x=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].x,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].x,vm.g_i,vm.g_p); return; case ACTOR_Y: @@ -3076,7 +3077,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].y=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].y,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].y,vm.g_i,vm.g_p); return; case ACTOR_Z: @@ -3085,7 +3086,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].z=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].z,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].z,vm.g_i,vm.g_p); return; case ACTOR_CSTAT: @@ -3094,7 +3095,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].cstat=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].cstat,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].cstat,vm.g_i,vm.g_p); return; case ACTOR_PICNUM: @@ -3103,7 +3104,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].picnum=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].picnum,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].picnum,vm.g_i,vm.g_p); return; case ACTOR_SHADE: @@ -3112,7 +3113,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].shade=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].shade,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].shade,vm.g_i,vm.g_p); return; case ACTOR_PAL: @@ -3121,7 +3122,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].pal=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].pal,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].pal,vm.g_i,vm.g_p); return; case ACTOR_CLIPDIST: @@ -3130,7 +3131,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].clipdist=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].clipdist,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].clipdist,vm.g_i,vm.g_p); return; case ACTOR_DETAIL: @@ -3139,7 +3140,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].filler=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].filler,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].filler,vm.g_i,vm.g_p); return; case ACTOR_XREPEAT: @@ -3148,7 +3149,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].xrepeat=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].xrepeat,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].xrepeat,vm.g_i,vm.g_p); return; case ACTOR_YREPEAT: @@ -3157,7 +3158,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].yrepeat=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].yrepeat,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].yrepeat,vm.g_i,vm.g_p); return; case ACTOR_XOFFSET: @@ -3166,7 +3167,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].xoffset=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].xoffset,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].xoffset,vm.g_i,vm.g_p); return; case ACTOR_YOFFSET: @@ -3175,7 +3176,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].yoffset=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].yoffset,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].yoffset,vm.g_i,vm.g_p); return; case ACTOR_SECTNUM: @@ -3184,7 +3185,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, changespritesect(iActor,lValue); return; } - Gv_SetVar(lVar2, sprite[iActor].sectnum,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].sectnum,vm.g_i,vm.g_p); return; case ACTOR_STATNUM: @@ -3193,7 +3194,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, changespritestat(iActor,lValue); return; } - Gv_SetVar(lVar2, sprite[iActor].statnum,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].statnum,vm.g_i,vm.g_p); return; case ACTOR_ANG: @@ -3202,7 +3203,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].ang=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].ang,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].ang,vm.g_i,vm.g_p); return; case ACTOR_OWNER: @@ -3211,7 +3212,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].owner=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].owner,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].owner,vm.g_i,vm.g_p); return; case ACTOR_XVEL: @@ -3220,7 +3221,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].xvel=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].xvel,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].xvel,vm.g_i,vm.g_p); return; case ACTOR_YVEL: @@ -3229,7 +3230,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].yvel=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].yvel,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].yvel,vm.g_i,vm.g_p); return; case ACTOR_ZVEL: @@ -3238,7 +3239,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].zvel=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].zvel,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].zvel,vm.g_i,vm.g_p); return; case ACTOR_LOTAG: @@ -3247,7 +3248,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].lotag=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].lotag,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].lotag,vm.g_i,vm.g_p); return; case ACTOR_HITAG: @@ -3256,7 +3257,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].hitag=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].hitag,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].hitag,vm.g_i,vm.g_p); return; case ACTOR_EXTRA: @@ -3265,7 +3266,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, sprite[iActor].extra=lValue; return; } - Gv_SetVar(lVar2, sprite[iActor].extra,g_i,g_p); + Gv_SetVar(lVar2, sprite[iActor].extra,vm.g_i,vm.g_p); return; case ACTOR_HTCGG: @@ -3274,7 +3275,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].cgg=lValue; return; } - Gv_SetVar(lVar2, ActorExtra[iActor].cgg, g_i, g_p); + Gv_SetVar(lVar2, ActorExtra[iActor].cgg, vm.g_i, vm.g_p); return; case ACTOR_HTPICNUM : @@ -3283,7 +3284,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].picnum=lValue; return; } - Gv_SetVar(lVar2, ActorExtra[iActor].picnum, g_i, g_p); + Gv_SetVar(lVar2, ActorExtra[iActor].picnum, vm.g_i, vm.g_p); return; case ACTOR_HTANG: @@ -3292,7 +3293,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].ang=lValue; return; } - Gv_SetVar(lVar2, ActorExtra[iActor].ang, g_i, g_p); + Gv_SetVar(lVar2, ActorExtra[iActor].ang, vm.g_i, vm.g_p); return; case ACTOR_HTEXTRA: @@ -3301,7 +3302,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].extra=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].extra, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].extra, vm.g_i, vm.g_p); return; case ACTOR_HTOWNER: @@ -3310,7 +3311,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].owner=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].owner, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].owner, vm.g_i, vm.g_p); return; case ACTOR_HTMOVFLAG: @@ -3319,7 +3320,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].movflag=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].movflag, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].movflag, vm.g_i, vm.g_p); return; case ACTOR_HTTEMPANG: @@ -3328,7 +3329,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].tempang=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].tempang, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].tempang, vm.g_i, vm.g_p); return; case ACTOR_HTACTORSTAYPUT: @@ -3337,7 +3338,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].actorstayput=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].actorstayput, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].actorstayput, vm.g_i, vm.g_p); return; case ACTOR_HTDISPICNUM: @@ -3346,7 +3347,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].dispicnum=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].dispicnum, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].dispicnum, vm.g_i, vm.g_p); return; case ACTOR_HTTIMETOSLEEP: @@ -3355,7 +3356,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].timetosleep=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].timetosleep, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].timetosleep, vm.g_i, vm.g_p); return; case ACTOR_HTFLOORZ: @@ -3364,7 +3365,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].floorz=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].floorz, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].floorz, vm.g_i, vm.g_p); return; case ACTOR_HTCEILINGZ: @@ -3373,7 +3374,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].ceilingz=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].ceilingz, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].ceilingz, vm.g_i, vm.g_p); return; case ACTOR_HTLASTVX: @@ -3382,7 +3383,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].lastvx=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].lastvx, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].lastvx, vm.g_i, vm.g_p); return; case ACTOR_HTLASTVY: @@ -3391,7 +3392,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].lastvy=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].lastvy, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].lastvy, vm.g_i, vm.g_p); return; case ACTOR_HTBPOSX: @@ -3400,7 +3401,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].bposx=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].bposx, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].bposx, vm.g_i, vm.g_p); return; case ACTOR_HTBPOSY: @@ -3409,7 +3410,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].bposy=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].bposy, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].bposy, vm.g_i, vm.g_p); return; case ACTOR_HTBPOSZ: @@ -3418,7 +3419,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].bposz=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].bposz, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].bposz, vm.g_i, vm.g_p); return; case ACTOR_HTG_T: @@ -3427,7 +3428,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].temp_data[lParm2]=lValue; return; } - Gv_SetVar(lVar2, ActorExtra[iActor].temp_data[lParm2], g_i, g_p); + Gv_SetVar(lVar2, ActorExtra[iActor].temp_data[lParm2], vm.g_i, vm.g_p); return; case ACTOR_ANGOFF: @@ -3436,7 +3437,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].angoff=lValue; return; } - Gv_SetVar(lVar2,spriteext[iActor].angoff, g_i, g_p); + Gv_SetVar(lVar2,spriteext[iActor].angoff, vm.g_i, vm.g_p); return; case ACTOR_PITCH: @@ -3445,7 +3446,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].pitch=lValue; return; } - Gv_SetVar(lVar2,spriteext[iActor].pitch, g_i, g_p); + Gv_SetVar(lVar2,spriteext[iActor].pitch, vm.g_i, vm.g_p); return; case ACTOR_ROLL: @@ -3454,7 +3455,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].roll=lValue; return; } - Gv_SetVar(lVar2,spriteext[iActor].roll, g_i, g_p); + Gv_SetVar(lVar2,spriteext[iActor].roll, vm.g_i, vm.g_p); return; case ACTOR_MDXOFF: @@ -3463,7 +3464,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].xoff=lValue; return; } - Gv_SetVar(lVar2,spriteext[iActor].xoff, g_i, g_p); + Gv_SetVar(lVar2,spriteext[iActor].xoff, vm.g_i, vm.g_p); return; case ACTOR_MDYOFF: @@ -3472,7 +3473,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].yoff=lValue; return; } - Gv_SetVar(lVar2,spriteext[iActor].yoff, g_i, g_p); + Gv_SetVar(lVar2,spriteext[iActor].yoff, vm.g_i, vm.g_p); return; case ACTOR_MDZOFF: @@ -3481,7 +3482,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].zoff=lValue; return; } - Gv_SetVar(lVar2,spriteext[iActor].zoff, g_i, g_p); + Gv_SetVar(lVar2,spriteext[iActor].zoff, vm.g_i, vm.g_p); return; case ACTOR_MDFLAGS: @@ -3490,7 +3491,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].flags=lValue; return; } - Gv_SetVar(lVar2,spriteext[iActor].flags, g_i, g_p); + Gv_SetVar(lVar2,spriteext[iActor].flags, vm.g_i, vm.g_p); return; case ACTOR_XPANNING: @@ -3499,7 +3500,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].xpanning=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].xpanning,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].xpanning,vm.g_i,vm.g_p); return; case ACTOR_YPANNING: @@ -3508,7 +3509,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, spriteext[iActor].ypanning=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].ypanning,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].ypanning,vm.g_i,vm.g_p); return; case ACTOR_HTFLAGS: @@ -3517,7 +3518,7 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, ActorExtra[iActor].flags=lValue; return; } - Gv_SetVar(lVar2,ActorExtra[iActor].flags, g_i, g_p); + Gv_SetVar(lVar2,ActorExtra[iActor].flags, vm.g_i, vm.g_p); return; default: @@ -3528,20 +3529,20 @@ static inline void X_AccessSprite(int iSet, int lVar1, int lLabelID, int lVar2, static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) { int lValue=0; - int iActor=g_i; + int iActor=vm.g_i; if (lVar1 != g_iThisActorID) - iActor=Gv_GetVar(lVar1, g_i, g_p); + iActor=Gv_GetVar(lVar1, vm.g_i, vm.g_p); if ((iActor < 0 || iActor >= MAXSPRITES) && g_scriptSanityChecks) { - OSD_Printf(CON_ERROR "invalid target sprite (%d) %d %d\n",g_errorLineNum,keyw[g_tw],iActor,g_i,g_sp->picnum); + OSD_Printf(CON_ERROR "invalid target sprite (%d) %d %d\n",g_errorLineNum,keyw[g_tw],iActor,vm.g_i,vm.g_sp->picnum); insptr += (lVar2 == MAXGAMEVARS); return; } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); if ((!spriteext[iActor].tspr) && g_scriptSanityChecks) { @@ -3557,7 +3558,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->x=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->x,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->x,vm.g_i,vm.g_p); return; case ACTOR_Y: @@ -3566,7 +3567,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->y=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->y,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->y,vm.g_i,vm.g_p); return; case ACTOR_Z: @@ -3575,7 +3576,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->z=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->z,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->z,vm.g_i,vm.g_p); return; case ACTOR_CSTAT: @@ -3584,7 +3585,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->cstat=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->cstat,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->cstat,vm.g_i,vm.g_p); return; case ACTOR_PICNUM: @@ -3593,7 +3594,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->picnum=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->picnum,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->picnum,vm.g_i,vm.g_p); return; case ACTOR_SHADE: @@ -3602,7 +3603,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->shade=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->shade,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->shade,vm.g_i,vm.g_p); return; case ACTOR_PAL: @@ -3611,7 +3612,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->pal=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->pal,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->pal,vm.g_i,vm.g_p); return; case ACTOR_CLIPDIST: @@ -3620,7 +3621,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->clipdist=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->clipdist,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->clipdist,vm.g_i,vm.g_p); return; case ACTOR_DETAIL: @@ -3629,7 +3630,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->filler=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->filler,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->filler,vm.g_i,vm.g_p); return; case ACTOR_XREPEAT: @@ -3638,7 +3639,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->xrepeat=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->xrepeat,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->xrepeat,vm.g_i,vm.g_p); return; case ACTOR_YREPEAT: @@ -3647,7 +3648,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->yrepeat=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->yrepeat,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->yrepeat,vm.g_i,vm.g_p); return; case ACTOR_XOFFSET: @@ -3656,7 +3657,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->xoffset=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->xoffset,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->xoffset,vm.g_i,vm.g_p); return; case ACTOR_YOFFSET: @@ -3665,7 +3666,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->yoffset=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->yoffset,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->yoffset,vm.g_i,vm.g_p); return; case ACTOR_SECTNUM: @@ -3674,7 +3675,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->sectnum=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->sectnum,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->sectnum,vm.g_i,vm.g_p); return; case ACTOR_STATNUM: @@ -3683,7 +3684,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->statnum=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->statnum,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->statnum,vm.g_i,vm.g_p); return; case ACTOR_ANG: @@ -3692,7 +3693,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->ang=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->ang,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->ang,vm.g_i,vm.g_p); return; case ACTOR_OWNER: @@ -3701,7 +3702,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->owner=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->owner,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->owner,vm.g_i,vm.g_p); return; #if 1 @@ -3711,7 +3712,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->xvel=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->xvel,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->xvel,vm.g_i,vm.g_p); return; case ACTOR_YVEL: @@ -3720,7 +3721,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->yvel=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->yvel,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->yvel,vm.g_i,vm.g_p); return; case ACTOR_ZVEL: @@ -3729,7 +3730,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->zvel=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->zvel,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->zvel,vm.g_i,vm.g_p); return; case ACTOR_LOTAG: @@ -3738,7 +3739,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->lotag=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->lotag,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->lotag,vm.g_i,vm.g_p); return; case ACTOR_HITAG: @@ -3747,7 +3748,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->hitag=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->hitag,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->hitag,vm.g_i,vm.g_p); return; case ACTOR_EXTRA: @@ -3756,7 +3757,7 @@ static inline void X_AccessTsprite(int iSet, int lVar1, int lLabelID, int lVar2) spriteext[iActor].tspr->extra=lValue; return; } - Gv_SetVar(lVar2, spriteext[iActor].tspr->extra,g_i,g_p); + Gv_SetVar(lVar2, spriteext[iActor].tspr->extra,vm.g_i,vm.g_p); return; #endif @@ -3777,7 +3778,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa } if (iSet) - lValue=Gv_GetVar(lVar2, g_i, g_p); + lValue=Gv_GetVar(lVar2, vm.g_i, vm.g_p); switch (lLabelID) { @@ -3787,7 +3788,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].workslike=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].workslike, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].workslike, vm.g_i, vm.g_p); return; case PROJ_SPAWNS: @@ -3796,7 +3797,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].spawns=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].spawns, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].spawns, vm.g_i, vm.g_p); return; case PROJ_SXREPEAT: @@ -3805,7 +3806,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].sxrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].sxrepeat, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].sxrepeat, vm.g_i, vm.g_p); return; case PROJ_SYREPEAT: @@ -3814,7 +3815,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].syrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].syrepeat, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].syrepeat, vm.g_i, vm.g_p); return; case PROJ_SOUND: @@ -3823,7 +3824,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].sound=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].sound, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].sound, vm.g_i, vm.g_p); return; case PROJ_ISOUND: @@ -3832,7 +3833,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].isound=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].isound, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].isound, vm.g_i, vm.g_p); return; case PROJ_VEL: @@ -3841,7 +3842,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].vel=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].vel, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].vel, vm.g_i, vm.g_p); return; case PROJ_EXTRA: @@ -3850,7 +3851,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].extra=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].extra, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].extra, vm.g_i, vm.g_p); return; case PROJ_DECAL: @@ -3859,7 +3860,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].decal=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].decal, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].decal, vm.g_i, vm.g_p); return; case PROJ_TRAIL: @@ -3868,7 +3869,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].trail=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].trail, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].trail, vm.g_i, vm.g_p); return; case PROJ_TXREPEAT: @@ -3877,7 +3878,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].txrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].txrepeat, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].txrepeat, vm.g_i, vm.g_p); return; case PROJ_TYREPEAT: @@ -3886,7 +3887,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].tyrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].tyrepeat, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].tyrepeat, vm.g_i, vm.g_p); return; case PROJ_TOFFSET: @@ -3895,7 +3896,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].toffset=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].toffset, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].toffset, vm.g_i, vm.g_p); return; case PROJ_TNUM: @@ -3904,7 +3905,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].tnum=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].tnum, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].tnum, vm.g_i, vm.g_p); return; case PROJ_DROP: @@ -3913,7 +3914,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].drop=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].drop, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].drop, vm.g_i, vm.g_p); return; case PROJ_CSTAT: @@ -3922,7 +3923,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].cstat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].cstat, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].cstat, vm.g_i, vm.g_p); return; case PROJ_CLIPDIST: @@ -3931,7 +3932,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].clipdist=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].clipdist, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].clipdist, vm.g_i, vm.g_p); return; case PROJ_SHADE: @@ -3940,7 +3941,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].shade=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].shade, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].shade, vm.g_i, vm.g_p); return; case PROJ_XREPEAT: @@ -3949,7 +3950,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].xrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].xrepeat, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].xrepeat, vm.g_i, vm.g_p); return; case PROJ_YREPEAT: @@ -3958,7 +3959,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].yrepeat=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].yrepeat, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].yrepeat, vm.g_i, vm.g_p); return; case PROJ_PAL: @@ -3967,7 +3968,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].pal=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].pal, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].pal, vm.g_i, vm.g_p); return; case PROJ_EXTRA_RAND: @@ -3976,7 +3977,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].extra_rand=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].extra_rand, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].extra_rand, vm.g_i, vm.g_p); return; case PROJ_HITRADIUS: @@ -3985,7 +3986,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].hitradius=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].hitradius, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].hitradius, vm.g_i, vm.g_p); return; case PROJ_VEL_MULT: @@ -3994,7 +3995,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].velmult=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].velmult, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].velmult, vm.g_i, vm.g_p); return; case PROJ_OFFSET: @@ -4003,7 +4004,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].offset=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].offset, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].offset, vm.g_i, vm.g_p); return; case PROJ_BOUNCES: @@ -4012,7 +4013,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].bounces=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].bounces, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].bounces, vm.g_i, vm.g_p); return; case PROJ_BSOUND: @@ -4021,7 +4022,7 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].bsound=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].bsound, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].bsound, vm.g_i, vm.g_p); return; case PROJ_RANGE: @@ -4030,10 +4031,454 @@ static inline void X_AccessProjectile(int iSet, int lVar1, int lLabelID, int lVa ProjectileData[lVar1].range=lValue; return; } - Gv_SetVar(lVar2, ProjectileData[lVar1].range, g_i, g_p); + Gv_SetVar(lVar2, ProjectileData[lVar1].range, vm.g_i, vm.g_p); return; default: return; } } +#else +static int X_AccessSpriteX(int iActor, int lLabelID, int lParm2) +{ + if ((ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) && g_scriptSanityChecks) + { + OSD_Printf(CON_ERROR "tried to get invalid %s position %d on sprite (%d) from spr %d\n", + g_errorLineNum,keyw[g_tw],ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); + return -1; + } + + switch (lLabelID) + { + case ACTOR_X: return sprite[iActor].x; + case ACTOR_Y: return sprite[iActor].y; + case ACTOR_Z: return sprite[iActor].z; + case ACTOR_CSTAT: return sprite[iActor].cstat; + case ACTOR_PICNUM: return sprite[iActor].picnum; + case ACTOR_SHADE: return sprite[iActor].shade; + case ACTOR_PAL: return sprite[iActor].pal; + case ACTOR_CLIPDIST: return sprite[iActor].clipdist; + case ACTOR_DETAIL: return sprite[iActor].filler; + case ACTOR_XREPEAT: return sprite[iActor].xrepeat; + case ACTOR_YREPEAT: return sprite[iActor].yrepeat; + case ACTOR_XOFFSET: return sprite[iActor].xoffset; + case ACTOR_YOFFSET: return sprite[iActor].yoffset; + case ACTOR_SECTNUM: return sprite[iActor].sectnum; + case ACTOR_STATNUM: return sprite[iActor].statnum; + case ACTOR_ANG: return sprite[iActor].ang; + case ACTOR_OWNER: return sprite[iActor].owner; + case ACTOR_XVEL: return sprite[iActor].xvel; + case ACTOR_YVEL: return sprite[iActor].yvel; + case ACTOR_ZVEL: return sprite[iActor].zvel; + case ACTOR_LOTAG: return sprite[iActor].lotag; + case ACTOR_HITAG: return sprite[iActor].hitag; + case ACTOR_EXTRA: return sprite[iActor].extra; + case ACTOR_HTCGG: return ActorExtra[iActor].cgg; + case ACTOR_HTPICNUM : return ActorExtra[iActor].picnum; + case ACTOR_HTANG: return ActorExtra[iActor].ang; + case ACTOR_HTEXTRA: return ActorExtra[iActor].extra; + case ACTOR_HTOWNER: return ActorExtra[iActor].owner; + case ACTOR_HTMOVFLAG: return ActorExtra[iActor].movflag; + case ACTOR_HTTEMPANG: return ActorExtra[iActor].tempang; + case ACTOR_HTACTORSTAYPUT: return ActorExtra[iActor].actorstayput; + case ACTOR_HTDISPICNUM: return ActorExtra[iActor].dispicnum; + case ACTOR_HTTIMETOSLEEP: return ActorExtra[iActor].timetosleep; + case ACTOR_HTFLOORZ: return ActorExtra[iActor].floorz; + case ACTOR_HTCEILINGZ: return ActorExtra[iActor].ceilingz; + case ACTOR_HTLASTVX: return ActorExtra[iActor].lastvx; + case ACTOR_HTLASTVY: return ActorExtra[iActor].lastvy; + case ACTOR_HTBPOSX: return ActorExtra[iActor].bposx; + case ACTOR_HTBPOSY: return ActorExtra[iActor].bposy; + case ACTOR_HTBPOSZ: return ActorExtra[iActor].bposz; + case ACTOR_HTG_T: return ActorExtra[iActor].temp_data[lParm2]; + case ACTOR_ANGOFF: return spriteext[iActor].angoff; + case ACTOR_PITCH: return spriteext[iActor].pitch; + case ACTOR_ROLL: return spriteext[iActor].roll; + case ACTOR_MDXOFF: return spriteext[iActor].xoff; + case ACTOR_MDYOFF: return spriteext[iActor].yoff; + case ACTOR_MDZOFF: return spriteext[iActor].zoff; + case ACTOR_MDFLAGS: return spriteext[iActor].flags; + case ACTOR_XPANNING: return spriteext[iActor].xpanning; + case ACTOR_YPANNING: return spriteext[iActor].ypanning; + case ACTOR_HTFLAGS: return ActorExtra[iActor].flags; + default: return -1; + } +} + +static int X_AccessSectorX(int iSector, int lLabelID) +{ + switch (lLabelID) + { + case SECTOR_WALLPTR: return sector[iSector].wallptr; + case SECTOR_WALLNUM: return sector[iSector].wallnum; + case SECTOR_CEILINGZ: return sector[iSector].ceilingz; + case SECTOR_FLOORZ: return sector[iSector].floorz; + case SECTOR_CEILINGSTAT: return sector[iSector].ceilingstat; + case SECTOR_FLOORSTAT: return sector[iSector].floorstat; + case SECTOR_CEILINGPICNUM: return sector[iSector].ceilingpicnum; + case SECTOR_CEILINGSLOPE: return sector[iSector].ceilingheinum; + case SECTOR_CEILINGSHADE: return sector[iSector].ceilingshade; + case SECTOR_CEILINGPAL: return sector[iSector].ceilingpal; + case SECTOR_CEILINGXPANNING: return sector[iSector].ceilingxpanning; + case SECTOR_CEILINGYPANNING: return sector[iSector].ceilingypanning; + case SECTOR_FLOORPICNUM: return sector[iSector].floorpicnum; + case SECTOR_FLOORSLOPE: return sector[iSector].floorheinum; + case SECTOR_FLOORSHADE: return sector[iSector].floorshade; + case SECTOR_FLOORPAL: return sector[iSector].floorpal; + case SECTOR_FLOORXPANNING: return sector[iSector].floorxpanning; + case SECTOR_FLOORYPANNING: return sector[iSector].floorypanning; + case SECTOR_VISIBILITY: return sector[iSector].visibility; + case SECTOR_ALIGNTO: return sector[iSector].filler; + case SECTOR_LOTAG: return sector[iSector].lotag; + case SECTOR_HITAG: return sector[iSector].hitag; + case SECTOR_EXTRA: return sector[iSector].extra; + default: return -1; + } +} + +static int X_AccessPlayerX(int iPlayer, int lLabelID, int lParm2) +{ + if ((PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) && g_scriptSanityChecks) + { + OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on player (%d) from spr %d\n", + g_errorLineNum,keyw[g_tw],PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); + } + + switch (lLabelID) + { + case PLAYER_ZOOM: + return g_player[iPlayer].ps->zoom; + case PLAYER_EXITX: + return g_player[iPlayer].ps->exitx; + case PLAYER_EXITY: + return g_player[iPlayer].ps->exity; + case PLAYER_LOOGIEX: + return g_player[iPlayer].ps->loogiex[lParm2]; + case PLAYER_LOOGIEY: + return g_player[iPlayer].ps->loogiey[lParm2]; + case PLAYER_NUMLOOGS: + return g_player[iPlayer].ps->numloogs; + case PLAYER_LOOGCNT: + return g_player[iPlayer].ps->loogcnt; + case PLAYER_POSX: + return g_player[iPlayer].ps->posx; + case PLAYER_POSY: + return g_player[iPlayer].ps->posy; + case PLAYER_POSZ: + return g_player[iPlayer].ps->posz; + case PLAYER_HORIZ: + return g_player[iPlayer].ps->horiz; + case PLAYER_OHORIZ: + return g_player[iPlayer].ps->ohoriz; + case PLAYER_OHORIZOFF: + return g_player[iPlayer].ps->ohorizoff; + case PLAYER_INVDISPTIME: + return g_player[iPlayer].ps->invdisptime; + case PLAYER_BOBPOSX: + return g_player[iPlayer].ps->bobposx; + case PLAYER_BOBPOSY: + return g_player[iPlayer].ps->bobposy; + case PLAYER_OPOSX: + return g_player[iPlayer].ps->oposx; + case PLAYER_OPOSY: + return g_player[iPlayer].ps->oposy; + case PLAYER_OPOSZ: + return g_player[iPlayer].ps->oposz; + case PLAYER_PYOFF: + return g_player[iPlayer].ps->pyoff; + case PLAYER_OPYOFF: + return g_player[iPlayer].ps->opyoff; + case PLAYER_POSXV: + return g_player[iPlayer].ps->posxv; + case PLAYER_POSYV: + return g_player[iPlayer].ps->posyv; + case PLAYER_POSZV: + return g_player[iPlayer].ps->poszv; + case PLAYER_LAST_PISSED_TIME: + return g_player[iPlayer].ps->last_pissed_time; + case PLAYER_TRUEFZ: + return g_player[iPlayer].ps->truefz; + case PLAYER_TRUECZ: + return g_player[iPlayer].ps->truecz; + case PLAYER_PLAYER_PAR: + return g_player[iPlayer].ps->player_par; + case PLAYER_VISIBILITY: + return g_player[iPlayer].ps->visibility; + case PLAYER_BOBCOUNTER: + return g_player[iPlayer].ps->bobcounter; + case PLAYER_WEAPON_SWAY: + return g_player[iPlayer].ps->weapon_sway; + case PLAYER_PALS_TIME: + return g_player[iPlayer].ps->pals_time; + case PLAYER_RANDOMFLAMEX: + return g_player[iPlayer].ps->randomflamex; + case PLAYER_CRACK_TIME: + return g_player[iPlayer].ps->crack_time; + case PLAYER_AIM_MODE: + return g_player[iPlayer].ps->aim_mode; + case PLAYER_ANG: + return g_player[iPlayer].ps->ang; + case PLAYER_OANG: + return g_player[iPlayer].ps->oang; + case PLAYER_ANGVEL: + return g_player[iPlayer].ps->angvel; + case PLAYER_CURSECTNUM: + return g_player[iPlayer].ps->cursectnum; + case PLAYER_LOOK_ANG: + return g_player[iPlayer].ps->look_ang; + case PLAYER_LAST_EXTRA: + return g_player[iPlayer].ps->last_extra; + case PLAYER_SUBWEAPON: + return g_player[iPlayer].ps->subweapon; + case PLAYER_AMMO_AMOUNT: + return g_player[iPlayer].ps->ammo_amount[lParm2]; + case PLAYER_WACKEDBYACTOR: + return g_player[iPlayer].ps->wackedbyactor; + case PLAYER_FRAG: + return g_player[iPlayer].ps->frag; + case PLAYER_FRAGGEDSELF: + return g_player[iPlayer].ps->fraggedself; + case PLAYER_CURR_WEAPON: + return g_player[iPlayer].ps->curr_weapon; + case PLAYER_LAST_WEAPON: + return g_player[iPlayer].ps->last_weapon; + case PLAYER_TIPINCS: + return g_player[iPlayer].ps->tipincs; + case PLAYER_HORIZOFF: + return g_player[iPlayer].ps->horizoff; + case PLAYER_WANTWEAPONFIRE: + return g_player[iPlayer].ps->wantweaponfire; + case PLAYER_HOLODUKE_AMOUNT: + return g_player[iPlayer].ps->holoduke_amount; + case PLAYER_NEWOWNER: + return g_player[iPlayer].ps->newowner; + case PLAYER_HURT_DELAY: + return g_player[iPlayer].ps->hurt_delay; + case PLAYER_HBOMB_HOLD_DELAY: + return g_player[iPlayer].ps->hbomb_hold_delay; + case PLAYER_JUMPING_COUNTER: + return g_player[iPlayer].ps->jumping_counter; + case PLAYER_AIRLEFT: + return g_player[iPlayer].ps->airleft; + case PLAYER_KNEE_INCS: + return g_player[iPlayer].ps->knee_incs; + case PLAYER_ACCESS_INCS: + return g_player[iPlayer].ps->access_incs; + case PLAYER_FTA: + return g_player[iPlayer].ps->fta; + case PLAYER_FTQ: + return g_player[iPlayer].ps->ftq; + case PLAYER_ACCESS_WALLNUM: + return g_player[iPlayer].ps->access_wallnum; + case PLAYER_ACCESS_SPRITENUM: + return g_player[iPlayer].ps->access_spritenum; + case PLAYER_KICKBACK_PIC: + return g_player[iPlayer].ps->kickback_pic; + case PLAYER_GOT_ACCESS: + return g_player[iPlayer].ps->got_access; + case PLAYER_WEAPON_ANG: + return g_player[iPlayer].ps->weapon_ang; + case PLAYER_FIRSTAID_AMOUNT: + return g_player[iPlayer].ps->firstaid_amount; + case PLAYER_SOMETHINGONPLAYER: + return g_player[iPlayer].ps->somethingonplayer; + case PLAYER_ON_CRANE: + return g_player[iPlayer].ps->on_crane; + case PLAYER_I: + return g_player[iPlayer].ps->i; + case PLAYER_ONE_PARALLAX_SECTNUM: + return g_player[iPlayer].ps->one_parallax_sectnum; + case PLAYER_OVER_SHOULDER_ON: + return g_player[iPlayer].ps->over_shoulder_on; + case PLAYER_RANDOM_CLUB_FRAME: + return g_player[iPlayer].ps->random_club_frame; + case PLAYER_FIST_INCS: + return g_player[iPlayer].ps->fist_incs; + case PLAYER_ONE_EIGHTY_COUNT: + return g_player[iPlayer].ps->one_eighty_count; + case PLAYER_CHEAT_PHASE: + return g_player[iPlayer].ps->cheat_phase; + case PLAYER_DUMMYPLAYERSPRITE: + return g_player[iPlayer].ps->dummyplayersprite; + case PLAYER_EXTRA_EXTRA8: + return g_player[iPlayer].ps->extra_extra8; + case PLAYER_QUICK_KICK: + return g_player[iPlayer].ps->quick_kick; + case PLAYER_HEAT_AMOUNT: + return g_player[iPlayer].ps->heat_amount; + case PLAYER_ACTORSQU: + return g_player[iPlayer].ps->actorsqu; + case PLAYER_TIMEBEFOREEXIT: + return g_player[iPlayer].ps->timebeforeexit; + case PLAYER_CUSTOMEXITSOUND: + return g_player[iPlayer].ps->customexitsound; + case PLAYER_WEAPRECS: + return g_player[iPlayer].ps->weaprecs[15]; + case PLAYER_WEAPRECCNT: + return g_player[iPlayer].ps->weapreccnt; + case PLAYER_INTERFACE_TOGGLE_FLAG: + return g_player[iPlayer].ps->interface_toggle_flag; + case PLAYER_ROTSCRNANG: + return g_player[iPlayer].ps->rotscrnang; + case PLAYER_DEAD_FLAG: + return g_player[iPlayer].ps->dead_flag; + case PLAYER_SHOW_EMPTY_WEAPON: + return g_player[iPlayer].ps->show_empty_weapon; + case PLAYER_SCUBA_AMOUNT: + return g_player[iPlayer].ps->scuba_amount; + case PLAYER_JETPACK_AMOUNT: + return g_player[iPlayer].ps->jetpack_amount; + case PLAYER_STEROIDS_AMOUNT: + return g_player[iPlayer].ps->steroids_amount; + case PLAYER_SHIELD_AMOUNT: + return g_player[iPlayer].ps->shield_amount; + case PLAYER_HOLODUKE_ON: + return g_player[iPlayer].ps->holoduke_on; + case PLAYER_PYCOUNT: + return g_player[iPlayer].ps->pycount; + case PLAYER_WEAPON_POS: + return g_player[iPlayer].ps->weapon_pos; + case PLAYER_FRAG_PS: + return g_player[iPlayer].ps->frag_ps; + case PLAYER_TRANSPORTER_HOLD: + return g_player[iPlayer].ps->transporter_hold; + case PLAYER_LAST_FULL_WEAPON: + return g_player[iPlayer].ps->last_full_weapon; + case PLAYER_FOOTPRINTSHADE: + return g_player[iPlayer].ps->footprintshade; + case PLAYER_BOOT_AMOUNT: + return g_player[iPlayer].ps->boot_amount; + case PLAYER_SCREAM_VOICE: + return g_player[iPlayer].ps->scream_voice; + case PLAYER_GM: + return g_player[iPlayer].ps->gm; + case PLAYER_ON_WARPING_SECTOR: + return g_player[iPlayer].ps->on_warping_sector; + case PLAYER_FOOTPRINTCOUNT: + return g_player[iPlayer].ps->footprintcount; + case PLAYER_HBOMB_ON: + return g_player[iPlayer].ps->hbomb_on; + case PLAYER_JUMPING_TOGGLE: + return g_player[iPlayer].ps->jumping_toggle; + case PLAYER_RAPID_FIRE_HOLD: + return g_player[iPlayer].ps->rapid_fire_hold; + case PLAYER_ON_GROUND: + return g_player[iPlayer].ps->on_ground; + case PLAYER_INVEN_ICON: + return g_player[iPlayer].ps->inven_icon; + case PLAYER_BUTTONPALETTE: + return g_player[iPlayer].ps->buttonpalette; + case PLAYER_JETPACK_ON: + return g_player[iPlayer].ps->jetpack_on; + case PLAYER_SPRITEBRIDGE: + return g_player[iPlayer].ps->spritebridge; + case PLAYER_LASTRANDOMSPOT: + return g_player[iPlayer].ps->lastrandomspot; + case PLAYER_SCUBA_ON: + return g_player[iPlayer].ps->scuba_on; + case PLAYER_FOOTPRINTPAL: + return g_player[iPlayer].ps->footprintpal; + case PLAYER_HEAT_ON: + return g_player[iPlayer].ps->heat_on; + case PLAYER_HOLSTER_WEAPON: + return g_player[iPlayer].ps->holster_weapon; + case PLAYER_FALLING_COUNTER: + return g_player[iPlayer].ps->falling_counter; + case PLAYER_GOTWEAPON: + return g_player[iPlayer].ps->gotweapon[lParm2]; + case PLAYER_REFRESH_INVENTORY: + return g_player[iPlayer].ps->refresh_inventory; + case PLAYER_TOGGLE_KEY_FLAG: + return g_player[iPlayer].ps->toggle_key_flag; + case PLAYER_KNUCKLE_INCS: + return g_player[iPlayer].ps->knuckle_incs; + case PLAYER_WALKING_SND_TOGGLE: + return g_player[iPlayer].ps->walking_snd_toggle; + case PLAYER_PALOOKUP: + return g_player[iPlayer].ps->palookup; + case PLAYER_HARD_LANDING: + return g_player[iPlayer].ps->hard_landing; + case PLAYER_MAX_SECRET_ROOMS: + return g_player[iPlayer].ps->max_secret_rooms; + case PLAYER_SECRET_ROOMS: + return g_player[iPlayer].ps->secret_rooms; + case PLAYER_PALS: + return g_player[iPlayer].ps->pals[lParm2]; + case PLAYER_MAX_ACTORS_KILLED: + return g_player[iPlayer].ps->max_actors_killed; + case PLAYER_ACTORS_KILLED: + return g_player[iPlayer].ps->actors_killed; + case PLAYER_RETURN_TO_CENTER: + return g_player[iPlayer].ps->return_to_center; + case PLAYER_RUNSPEED: + return g_player[iPlayer].ps->runspeed; + case PLAYER_SBS: + return g_player[iPlayer].ps->sbs; + case PLAYER_RELOADING: + return g_player[iPlayer].ps->reloading; + case PLAYER_AUTO_AIM: + return g_player[iPlayer].ps->auto_aim; + case PLAYER_MOVEMENT_LOCK: + return g_player[iPlayer].ps->movement_lock; + case PLAYER_SOUND_PITCH: + return g_player[iPlayer].ps->sound_pitch; + case PLAYER_WEAPONSWITCH: + return g_player[iPlayer].ps->weaponswitch; + case PLAYER_TEAM: + return g_player[iPlayer].ps->team; + case PLAYER_MAX_PLAYER_HEALTH: + return g_player[iPlayer].ps->max_player_health; + case PLAYER_MAX_SHIELD_AMOUNT: + return g_player[iPlayer].ps->max_shield_amount; + case PLAYER_MAX_AMMO_AMOUNT: + return g_player[iPlayer].ps->max_ammo_amount[lParm2]; + case PLAYER_LAST_QUICK_KICK: + return g_player[iPlayer].ps->last_quick_kick; + default: + return -1; + } +} + +static int X_AccessWallX(int iWall, int lLabelID) +{ + switch (lLabelID) + { + case WALL_X: + return wall[iWall].x; + case WALL_Y: + return wall[iWall].y; + case WALL_POINT2: + return wall[iWall].point2; + case WALL_NEXTWALL: + return wall[iWall].nextwall; + case WALL_NEXTSECTOR: + return wall[iWall].nextsector; + case WALL_CSTAT: + return wall[iWall].cstat; + case WALL_PICNUM: + return wall[iWall].picnum; + case WALL_OVERPICNUM: + return wall[iWall].overpicnum; + case WALL_SHADE: + return wall[iWall].shade; + case WALL_PAL: + return wall[iWall].pal; + case WALL_XREPEAT: + return wall[iWall].xrepeat; + case WALL_YREPEAT: + return wall[iWall].yrepeat; + case WALL_XPANNING: + return wall[iWall].xpanning; + case WALL_YPANNING: + return wall[iWall].ypanning; + case WALL_LOTAG: + return wall[iWall].lotag; + case WALL_HITAG: + return wall[iWall].hitag; + case WALL_EXTRA: + return wall[iWall].extra; + default: + return -1; + } +} +#endif // _gamevars_c_ diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index ba4a9314e..d666af603 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -26,7 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "gamedef.h" #include "osd.h" -extern int g_i,g_p; +#define _gamevars_c_ +#include "gamestructures.c" + extern int OSD_errors; void Gv_RefreshPointers(void); @@ -528,7 +530,7 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer) return iActor; { - int neg = 0; + int negateResult = 0; if (id >= g_gameVarCount || id < 0) { @@ -537,7 +539,7 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer) int index=Gv_GetVar(*insptr++,iActor,iPlayer); if (id&(MAXGAMEVARS<<1)) // negative array access - neg = 1; + negateResult = 1; id &= ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1)); @@ -546,7 +548,70 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer) OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index); return -1; } - return(neg?-aGameArrays[id].plValues[index]:aGameArrays[id].plValues[index]); + return(negateResult?-aGameArrays[id].plValues[index]:aGameArrays[id].plValues[index]); + } + + if (id&(MAXGAMEVARS<<3)) // struct shortcut vars + { + int index=Gv_GetVar(*insptr++, iActor, iPlayer), label=*insptr++; + + if (id&(MAXGAMEVARS<<1)) // negative array access + negateResult = 1; + + id &= ~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1)); + + if (id == g_iSpriteVarID) + { + int parm2 = 0; + + if (ActorLabels[label].flags & LABEL_HASPARM2) + parm2 = Gv_GetVar(*insptr++, iActor, iPlayer); + + if (index >= MAXSPRITES || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessSpriteX(index, label, parm2)); + return (X_AccessSpriteX(index, label, parm2)); + } + if (id == g_iPlayerVarID) + { + int parm2 = 0; + + if (PlayerLabels[label].flags & LABEL_HASPARM2) + parm2 = Gv_GetVar(*insptr++, iActor, iPlayer); + + if (index == vm.g_i) index = vm.g_p; + if (index >= MAXPLAYERS || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessPlayerX(index, label, parm2)); + return (X_AccessPlayerX(index, label, parm2)); + } + if (id == g_iSectorVarID) + { + if (index == vm.g_i) index = sprite[vm.g_i].sectnum; + if (index >= MAXSECTORS || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessSectorX(index, label)); + return (X_AccessSectorX(index, label)); + } + if (id == g_iWallVarID) + { + if (index >= MAXWALLS || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessWallX(index, label)); + return (X_AccessWallX(index, label)); + } } if ((id&(MAXGAMEVARS<<1)) == 0) @@ -555,7 +620,7 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer) return -1; } - neg = 1; + negateResult = 1; id &= ~(MAXGAMEVARS<<1); } @@ -563,7 +628,7 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer) GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) { default: - if (neg) return (-aGameVars[id].val.lValue); + if (negateResult) return (-aGameVars[id].val.lValue); return (aGameVars[id].val.lValue); case GAMEVAR_PERPLAYER: if (iPlayer < 0 || iPlayer >= MAXPLAYERS) @@ -571,7 +636,7 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer) OSD_Printf(CON_ERROR "Gv_GetVar(): invalid player ID (%d)\n",g_errorLineNum,keyw[g_tw],iPlayer); return -1; } - if (neg) return (-aGameVars[id].val.plValues[iPlayer]); + if (negateResult) return (-aGameVars[id].val.plValues[iPlayer]); return (aGameVars[id].val.plValues[iPlayer]); case GAMEVAR_PERACTOR: if (iActor < 0 || iActor >= MAXSPRITES) @@ -579,16 +644,16 @@ int __fastcall Gv_GetVar(int id, int iActor, int iPlayer) OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite ID (%d)\n",g_errorLineNum,keyw[g_tw],iActor); return -1; } - if (neg) return (-aGameVars[id].val.plValues[iActor]); + if (negateResult) return (-aGameVars[id].val.plValues[iActor]); return (aGameVars[id].val.plValues[iActor]); case GAMEVAR_INTPTR: - if (neg) return (-(*((int*)aGameVars[id].val.lValue))); + if (negateResult) return (-(*((int*)aGameVars[id].val.lValue))); return ((*((int*)aGameVars[id].val.lValue))); case GAMEVAR_SHORTPTR: - if (neg) return (-(*((short*)aGameVars[id].val.lValue))); + if (negateResult) return (-(*((short*)aGameVars[id].val.lValue))); return ((*((short*)aGameVars[id].val.lValue))); case GAMEVAR_CHARPTR: - if (neg) return (-(*((char*)aGameVars[id].val.lValue))); + if (negateResult) return (-(*((char*)aGameVars[id].val.lValue))); return ((*((char*)aGameVars[id].val.lValue))); } @@ -599,7 +664,7 @@ void __fastcall Gv_SetVar(int id, int lValue, int iActor, int iPlayer) { if (id<0 || id >= g_gameVarCount) { - OSD_Printf(CON_ERROR "Gv_SetVar(): tried to set invalid gamevar ID (%d) from sprite %d (%d), player %d\n",g_errorLineNum,keyw[g_tw],id,g_i,sprite[g_i].picnum,g_p); + OSD_Printf(CON_ERROR "Gv_SetVar(): tried to set invalid gamevar ID (%d) from sprite %d (%d), player %d\n",g_errorLineNum,keyw[g_tw],id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); return; } //Bsprintf(g_szBuf,"SGVI: %d ('%s') to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer); @@ -614,7 +679,7 @@ void __fastcall Gv_SetVar(int id, int lValue, int iActor, int iPlayer) case GAMEVAR_PERPLAYER: if (iPlayer < 0 || iPlayer > MAXPLAYERS-1) { - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for per-player gamevar %s from sprite %d, player %d\n",g_errorLineNum,keyw[g_tw],iPlayer,aGameVars[id].szLabel,g_i,g_p); + OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for per-player gamevar %s from sprite %d, player %d\n",g_errorLineNum,keyw[g_tw],iPlayer,aGameVars[id].szLabel,vm.g_i,vm.g_p); return; } // for the current player @@ -623,7 +688,7 @@ void __fastcall Gv_SetVar(int id, int lValue, int iActor, int iPlayer) case GAMEVAR_PERACTOR: if (iActor < 0 || iActor > MAXSPRITES-1) { - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid sprite (%d) for per-actor gamevar %s from sprite %d (%d), player %d\n",g_errorLineNum,keyw[g_tw],iActor,aGameVars[id].szLabel,g_i,sprite[g_i].picnum,g_p); + OSD_Printf(CON_ERROR "Gv_SetVar(): invalid sprite (%d) for per-actor gamevar %s from sprite %d (%d), player %d\n",g_errorLineNum,keyw[g_tw],iActor,aGameVars[id].szLabel,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); return; } // for the current actor @@ -647,10 +712,10 @@ int __fastcall Gv_GetVarX(int id) return(*insptr++); if (id == g_iThisActorID) - return g_i; + return vm.g_i; { - int neg = 0; + int negateResult = 0; if (id >= g_gameVarCount || id < 0) { @@ -659,7 +724,7 @@ int __fastcall Gv_GetVarX(int id) int index=Gv_GetVarX(*insptr++); if (id&(MAXGAMEVARS<<1)) // negative array access - neg = 1; + negateResult = 1; id &= ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1)); @@ -668,17 +733,80 @@ int __fastcall Gv_GetVarX(int id) OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index); return -1; } - if (neg) return (-aGameArrays[id].plValues[index]); + if (negateResult) return (-aGameArrays[id].plValues[index]); return (aGameArrays[id].plValues[index]); } + if (id&(MAXGAMEVARS<<3)) // struct shortcut vars + { + int index=Gv_GetVarX(*insptr++), label=*insptr++; + + if (id&(MAXGAMEVARS<<1)) // negative array access + negateResult = 1; + + id &= ~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1)); + + if (id == g_iSpriteVarID) + { + int parm2 = 0; + + if (ActorLabels[label].flags & LABEL_HASPARM2) + parm2 = Gv_GetVarX(*insptr++); + + if (index >= MAXSPRITES || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessSpriteX(index, label, parm2)); + return (X_AccessSpriteX(index, label, parm2)); + } + if (id == g_iPlayerVarID) + { + int parm2 = 0; + + if (PlayerLabels[label].flags & LABEL_HASPARM2) + parm2 = Gv_GetVarX(*insptr++); + + if (index == vm.g_i) index = vm.g_p; + if (index >= MAXPLAYERS || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessPlayerX(index, label, parm2)); + return (X_AccessPlayerX(index, label, parm2)); + } + if (id == g_iSectorVarID) + { + if (index == vm.g_i) index = sprite[vm.g_i].sectnum; + if (index >= MAXSECTORS || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessSectorX(index, label)); + return (X_AccessSectorX(index, label)); + } + if (id == g_iWallVarID) + { + if (index >= MAXWALLS || index < 0) + { + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]); + return -1; + } + if (negateResult) return (-X_AccessWallX(index, label)); + return (X_AccessWallX(index, label)); + } + } + if ((id&(MAXGAMEVARS<<1)) == 0) { OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id); return -1; } - neg = 1; + negateResult = 1; id &= ~(MAXGAMEVARS<<1); } @@ -686,22 +814,22 @@ int __fastcall Gv_GetVarX(int id) GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) { default: - if (neg) return (-aGameVars[id].val.lValue); + if (negateResult) return (-aGameVars[id].val.lValue); return (aGameVars[id].val.lValue); case GAMEVAR_PERPLAYER: - if (neg) return (-aGameVars[id].val.plValues[g_p]); - return (aGameVars[id].val.plValues[g_p]); + if (negateResult) return (-aGameVars[id].val.plValues[vm.g_p]); + return (aGameVars[id].val.plValues[vm.g_p]); case GAMEVAR_PERACTOR: - if (neg) return (-aGameVars[id].val.plValues[g_i]); - return (aGameVars[id].val.plValues[g_i]); + if (negateResult) return (-aGameVars[id].val.plValues[vm.g_i]); + return (aGameVars[id].val.plValues[vm.g_i]); case GAMEVAR_INTPTR: - if (neg) return (-(*((int*)aGameVars[id].val.lValue))); + if (negateResult) return (-(*((int*)aGameVars[id].val.lValue))); return (*((int*)aGameVars[id].val.lValue)); case GAMEVAR_SHORTPTR: - if (neg) return (-(*((short*)aGameVars[id].val.lValue))); + if (negateResult) return (-(*((short*)aGameVars[id].val.lValue))); return (*((short*)aGameVars[id].val.lValue)); case GAMEVAR_CHARPTR: - if (neg) return (-(*((char*)aGameVars[id].val.lValue))); + if (negateResult) return (-(*((char*)aGameVars[id].val.lValue))); return (*((char*)aGameVars[id].val.lValue)); } } @@ -716,10 +844,10 @@ void __fastcall Gv_SetVarX(int id, int lValue) aGameVars[id].val.lValue=lValue; return; case GAMEVAR_PERPLAYER: - aGameVars[id].val.plValues[g_p]=lValue; + aGameVars[id].val.plValues[vm.g_p]=lValue; return; case GAMEVAR_PERACTOR: - aGameVars[id].val.plValues[g_i]=lValue; + aGameVars[id].val.plValues[vm.g_i]=lValue; return; case GAMEVAR_INTPTR: *((int*)aGameVars[id].val.lValue)=(int)lValue; @@ -823,6 +951,12 @@ void Gv_ResetSystemDefaults(void) g_iTextureID=Gv_GetVarIndex("TEXTURE"); g_iThisActorID=Gv_GetVarIndex("THISACTOR"); + g_iSpriteVarID=Gv_GetVarIndex("sprite"); + g_iSectorVarID=Gv_GetVarIndex("sector"); + g_iWallVarID=Gv_GetVarIndex("wall"); + g_iPlayerVarID=Gv_GetVarIndex("player"); + g_iActorVarID=Gv_GetVarIndex("actorvar"); + Bmemcpy(&ProjectileData,&DefaultProjectileData,sizeof(ProjectileData)); //AddLog("EOF:ResetWeaponDefaults"); @@ -1321,6 +1455,14 @@ static void Gv_AddSystemVars(void) Gv_NewVar("HITAG", 0, GAMEVAR_SYSTEM); Gv_NewVar("TEXTURE", 0, GAMEVAR_SYSTEM); Gv_NewVar("THISACTOR", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); + + // special vars for struct access + Gv_NewVar("sprite", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); + Gv_NewVar("sector", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); + Gv_NewVar("wall", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); + Gv_NewVar("player", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); + Gv_NewVar("actorvar", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); + Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("currentweapon",(intptr_t)&g_currentweapon, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK);