mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@1204 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1cc73560f2
commit
b53c959919
7 changed files with 1843 additions and 1148 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue