mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
Generic non-descript commit message
git-svn-id: https://svn.eduke32.com/eduke32@1440 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5fcbdf3dd1
commit
3d0c34863d
21 changed files with 2867 additions and 3538 deletions
File diff suppressed because it is too large
Load diff
|
@ -1458,7 +1458,9 @@ static void md3postload(md3model_t* m)
|
|||
m->head.frames[framei].max.x = frameverts[verti].x;
|
||||
m->head.frames[framei].max.y = frameverts[verti].y;
|
||||
m->head.frames[framei].max.z = frameverts[verti].z;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m->head.frames[framei].min.x > frameverts[verti].x)
|
||||
m->head.frames[framei].min.x = frameverts[verti].x;
|
||||
if (m->head.frames[framei].max.x < frameverts[verti].x)
|
||||
|
|
|
@ -86,7 +86,7 @@ DEALINGS IN THE SOFTWARE.
|
|||
#ifndef THREADCACHEMAX
|
||||
#define THREADCACHEMAX 8192
|
||||
#endif
|
||||
#if 0
|
||||
#if 1
|
||||
/* The number of cache entries for finer grained bins. This is (topbitpos(THREADCACHEMAX)-4)*2 */
|
||||
#define THREADCACHEMAXBINS ((13-4)*2)
|
||||
#else
|
||||
|
@ -134,9 +134,11 @@ static LPVOID ChkedTlsGetValue(DWORD idx)
|
|||
|
||||
#if defined(__cplusplus)
|
||||
#if !defined(NO_NED_NAMESPACE)
|
||||
namespace nedalloc {
|
||||
namespace nedalloc
|
||||
{
|
||||
#else
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -226,7 +228,8 @@ static FORCEINLINE unsigned int size2binidx(size_t _size) THROWSPEC
|
|||
}
|
||||
#else
|
||||
#if 0
|
||||
union {
|
||||
union
|
||||
{
|
||||
unsigned asInt[2];
|
||||
double asDouble;
|
||||
};
|
||||
|
@ -493,7 +496,8 @@ static void threadcache_free(nedpool *p, threadcache *tc, int mymspace, void *me
|
|||
{ /* Make sure this is a valid memory block */
|
||||
mchunkptr p = mem2chunk(mem);
|
||||
mstate fm = get_mstate_for(p);
|
||||
if (!ok_magic(fm)) {
|
||||
if (!ok_magic(fm))
|
||||
{
|
||||
USAGE_ERROR_ACTION(fm, p);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -667,6 +667,8 @@ extern int32_t g_cameraDistance, g_cameraClock, g_playerFriction,g_showShareware
|
|||
extern int32_t g_networkBroadcastMode, g_movesPerPacket;
|
||||
extern int32_t g_gameQuit;
|
||||
|
||||
extern int32_t playerswhenstarted;
|
||||
|
||||
extern char pus,pub;
|
||||
extern int32_t g_damageCameras,g_freezerSelfDamage,g_tripbombLaserMode;
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ extern void G_DrawTXDigiNumZ(int32_t starttile, int32_t x,int32_t y,int32_t n,in
|
|||
extern void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
|
||||
extern void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
|
||||
extern void Gv_ResetVars(void);
|
||||
extern void A_ResetVars(int32_t iActor);
|
||||
extern void __fastcall A_ResetVars(register int32_t iActor);
|
||||
|
||||
extern int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
|
||||
|
||||
|
@ -219,10 +219,10 @@ extern void Gv_Init(void);
|
|||
extern void Gv_WriteSave(FILE *fil);
|
||||
extern int32_t Gv_ReadSave(int32_t fil);
|
||||
|
||||
extern int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer);
|
||||
extern void __fastcall Gv_SetVar(int32_t id, int32_t lValue, int32_t iActor, int32_t iPlayer);
|
||||
extern int32_t __fastcall Gv_GetVarX(int32_t id);
|
||||
extern void __fastcall Gv_SetVarX(int32_t id, int32_t lValue);
|
||||
extern int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, register int32_t iPlayer);
|
||||
extern void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register int32_t iActor, register int32_t iPlayer);
|
||||
extern int32_t __fastcall Gv_GetVarX(register int32_t id);
|
||||
extern void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue);
|
||||
|
||||
// extern void SetGameArrayID(int32_t id,int32_t index, int32_t lValue);
|
||||
|
||||
|
@ -232,7 +232,7 @@ extern void C_ReportError(int32_t iError);
|
|||
|
||||
extern void onvideomodechange(int32_t newmode);
|
||||
|
||||
extern void X_OnEvent(int32_t iEventID, int32_t sActor, int32_t sPlayer, int32_t lDist);
|
||||
extern void X_OnEvent(register int32_t iEventID, register int32_t sActor, register int32_t sPlayer, register int32_t lDist);
|
||||
|
||||
extern int32_t A_CheckSoundPlaying(int32_t i, int32_t num);
|
||||
extern int32_t S_CheckSoundPlaying(int32_t i, int32_t num);
|
||||
|
|
|
@ -63,7 +63,6 @@ int32_t g_scriptSanityChecks = 1;
|
|||
#define TIMERUPDATESIZ 32
|
||||
|
||||
int32_t g_cameraDistance = 0, g_cameraClock = 0;
|
||||
static int32_t playerswhenstarted;
|
||||
static int32_t qe,cp;
|
||||
static int32_t g_commandSetup = 0;
|
||||
int32_t g_noSetup = 0;
|
||||
|
@ -8892,7 +8891,7 @@ static void G_ShowDebugHelp(void)
|
|||
"-q#\t\tFake multiplayer with # (2-8) players\n"
|
||||
"-rmnet\t\tUse network config file (OBSOLETE, see -net)\n"
|
||||
"-stun\t\tUse UDP hole punching for multiplayer connections\n"
|
||||
"-unstable \tForce EDuke32 to execute unsafe CON commands (and crash)\n"
|
||||
/*"-unstable \tForce EDuke32 to execute unsafe CON commands (and crash)\n"*/
|
||||
"-w\t\tShow coordinates\n"
|
||||
"-z#/-condebug\tEnable line-by-line CON compile debugging at level #\n"
|
||||
;
|
||||
|
@ -10379,7 +10378,8 @@ static void G_LoadExtraPalettes(void)
|
|||
|
||||
#if defined(__APPLE__) && B_BIG_ENDIAN != 0
|
||||
// this is almost as bad as just setting the value to 25 :P
|
||||
g_numRealPalettes = (g_numRealPalettes * (uint64)0x0202020202 & (uint64)0x010884422010) % 1023;
|
||||
g_numRealPalettes = ((g_numRealPalettes * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32;
|
||||
|
||||
#endif
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
|
@ -11135,9 +11135,22 @@ void app_main(int32_t argc,const char **argv)
|
|||
|
||||
if (mod_dir[0] != '/')
|
||||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
||||
Bstrcat(root,mod_dir);
|
||||
addsearchpath(root);
|
||||
// addsearchpath(mod_dir);
|
||||
|
||||
if (getcwd(cwd,BMAX_PATH))
|
||||
{
|
||||
Bsprintf(cwd,"%s/%s",cwd,mod_dir);
|
||||
if (!Bstrcmp(root, cwd))
|
||||
{
|
||||
if (addsearchpath(cwd) == -2)
|
||||
if (Bmkdir(cwd,S_IRWXU) == 0) addsearchpath(cwd);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
Bsprintf(tempbuf,"%s/%s",mod_dir,TEXCACHEFILE);
|
||||
Bstrcpy(TEXCACHEFILE,tempbuf);
|
||||
|
@ -11390,8 +11403,6 @@ CLEAN_DIRECTORY:
|
|||
|
||||
if (ud.multimode > 1)
|
||||
{
|
||||
playerswhenstarted = ud.multimode;
|
||||
|
||||
if (ud.warp_on == 0)
|
||||
{
|
||||
ud.m_monsters_off = 1;
|
||||
|
@ -11399,6 +11410,7 @@ CLEAN_DIRECTORY:
|
|||
}
|
||||
}
|
||||
|
||||
playerswhenstarted = ud.multimode;
|
||||
ud.last_level = -1;
|
||||
|
||||
if (Bstrcasecmp(ud.rtsname,"DUKE.RTS") == 0 ||
|
||||
|
|
|
@ -1905,7 +1905,8 @@ static inline int32_t C_IntPow2(int32_t v)
|
|||
static inline uint32_t C_Pow2IntLogBase2(int32_t v)
|
||||
{
|
||||
static const uint32_t b[] = {0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0,
|
||||
0xFF00FF00, 0xFFFF0000};
|
||||
0xFF00FF00, 0xFFFF0000
|
||||
};
|
||||
register uint32_t r = (v & b[0]) != 0;
|
||||
int32_t i = 4;
|
||||
|
||||
|
@ -3919,6 +3920,13 @@ static int32_t C_ParseCommand(void)
|
|||
|
||||
C_GetNextValue(LABEL_DEFINE); // the number to check against...
|
||||
|
||||
if (tw == CON_MULVAR && *(g_scriptPtr-1) == -1)
|
||||
{
|
||||
*inst = CON_INV;
|
||||
g_scriptPtr--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tw == CON_DIVVAR || (tw == CON_MULVAR && *(g_scriptPtr-1) > 0))
|
||||
{
|
||||
int32_t i = *(g_scriptPtr-1);
|
||||
|
|
|
@ -39,7 +39,7 @@ vmstate_t vm;
|
|||
int32_t g_errorLineNum;
|
||||
int32_t g_tw;
|
||||
|
||||
static int32_t X_DoExecute(int32_t once);
|
||||
static int32_t X_DoExecute(register int32_t once);
|
||||
|
||||
#include "gamestructures.c"
|
||||
|
||||
|
@ -62,7 +62,7 @@ void X_ScriptInfo(void)
|
|||
}
|
||||
}
|
||||
|
||||
void X_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist)
|
||||
void X_OnEvent(register int32_t iEventID, register int32_t iActor, register int32_t iPlayer, register int32_t lDist)
|
||||
{
|
||||
if (iEventID<0 || iEventID >= MAXGAMEEVENTS)
|
||||
{
|
||||
|
@ -645,7 +645,7 @@ static void X_Move(void)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void __fastcall X_DoConditional(int32_t condition)
|
||||
static inline void __fastcall X_DoConditional(register int32_t condition)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
|
@ -664,9 +664,9 @@ static inline void __fastcall X_DoConditional(int32_t condition)
|
|||
}
|
||||
}
|
||||
|
||||
static int32_t X_DoExecute(int32_t once)
|
||||
static int32_t X_DoExecute(register int32_t once)
|
||||
{
|
||||
int32_t tw;
|
||||
register int32_t tw;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1402,7 +1402,7 @@ static int32_t X_DoExecute(int32_t once)
|
|||
G_OperateSectors(var1, var2);
|
||||
break;
|
||||
case CON_OPERATEACTIVATORS:
|
||||
if ((var2<0 || var2>=ud.multimode) /* && g_scriptSanityChecks */) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2); break;}
|
||||
if ((var2<0 || var2>=playerswhenstarted) /* && g_scriptSanityChecks */) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2); break;}
|
||||
G_OperateActivators(var1, var2);
|
||||
break;
|
||||
case CON_SETASPECT:
|
||||
|
@ -1590,24 +1590,42 @@ static int32_t X_DoExecute(int32_t once)
|
|||
case CON_QSUBSTR:
|
||||
insptr++;
|
||||
{
|
||||
char *s1,*s2;
|
||||
int32_t q1,q2,st,ln;
|
||||
int32_t q1 = Gv_GetVarX(*insptr++);
|
||||
int32_t q2 = Gv_GetVarX(*insptr++);
|
||||
int32_t st = Gv_GetVarX(*insptr++);
|
||||
int32_t ln = Gv_GetVarX(*insptr++);
|
||||
|
||||
q1 = Gv_GetVarX(*insptr++),
|
||||
q2 = Gv_GetVarX(*insptr++);
|
||||
st = Gv_GetVarX(*insptr++);
|
||||
ln = Gv_GetVarX(*insptr++);
|
||||
|
||||
if ((q1<0 || q1>=MAXQUOTES) /* && g_scriptSanityChecks */) OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q1);
|
||||
else if ((ScriptQuotes[q1] == NULL) /* && g_scriptSanityChecks */) OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q1);
|
||||
else if ((q2<0 || q2>=MAXQUOTES) /* && g_scriptSanityChecks */) OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q2);
|
||||
else if ((ScriptQuotes[q2] == NULL) /* && g_scriptSanityChecks */) OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q2);
|
||||
else
|
||||
if ((q1<0 || q1>=MAXQUOTES) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
s1=ScriptQuotes[q1];
|
||||
s2=ScriptQuotes[q2];
|
||||
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q1);
|
||||
break;
|
||||
}
|
||||
if ((ScriptQuotes[q1] == NULL) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q1);
|
||||
break;
|
||||
}
|
||||
if ((q2<0 || q2>=MAXQUOTES) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q2);
|
||||
break;
|
||||
}
|
||||
if ((ScriptQuotes[q2] == NULL) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q2);
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
char *s1 = ScriptQuotes[q1];
|
||||
char *s2 = ScriptQuotes[q2];
|
||||
|
||||
while (*s2 && st--) s2++;
|
||||
while ((*s1=*s2)&&ln--) {s1++; s2++;}
|
||||
while ((*s1 = *s2) && ln--)
|
||||
{
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
*s1=0;
|
||||
}
|
||||
break;
|
||||
|
@ -1900,25 +1918,36 @@ static int32_t X_DoExecute(int32_t once)
|
|||
break;
|
||||
}
|
||||
|
||||
case CON_DIST:
|
||||
case CON_LDIST:
|
||||
insptr++;
|
||||
{
|
||||
int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++), distx=0;
|
||||
int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++);
|
||||
|
||||
if ((xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]);
|
||||
break;
|
||||
}
|
||||
if (tw == CON_DIST) distx = dist(&sprite[xvar],&sprite[yvar]);
|
||||
else distx = ldist(&sprite[xvar],&sprite[yvar]);
|
||||
|
||||
Gv_SetVarX(distvar, distx);
|
||||
Gv_SetVarX(distvar, ldist(&sprite[xvar],&sprite[yvar]));
|
||||
break;
|
||||
}
|
||||
|
||||
case CON_DIST:
|
||||
insptr++;
|
||||
{
|
||||
int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++);
|
||||
|
||||
if ((xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]);
|
||||
break;
|
||||
}
|
||||
|
||||
Gv_SetVarX(distvar, dist(&sprite[xvar],&sprite[yvar]));
|
||||
break;
|
||||
}
|
||||
|
||||
case CON_GETINCANGLE:
|
||||
case CON_GETANGLE:
|
||||
insptr++;
|
||||
{
|
||||
|
@ -1926,11 +1955,17 @@ static int32_t X_DoExecute(int32_t once)
|
|||
int32_t xvar = Gv_GetVarX(*insptr++);
|
||||
int32_t yvar = Gv_GetVarX(*insptr++);
|
||||
|
||||
if (tw==CON_GETANGLE)
|
||||
{
|
||||
Gv_SetVarX(angvar, getangle(xvar,yvar));
|
||||
break;
|
||||
}
|
||||
|
||||
case CON_GETINCANGLE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t angvar = *insptr++;
|
||||
int32_t xvar = Gv_GetVarX(*insptr++);
|
||||
int32_t yvar = Gv_GetVarX(*insptr++);
|
||||
|
||||
Gv_SetVarX(angvar, G_GetAngleDelta(xvar,yvar));
|
||||
break;
|
||||
}
|
||||
|
@ -3440,6 +3475,22 @@ static int32_t X_DoExecute(int32_t once)
|
|||
break;
|
||||
|
||||
case CON_SETPLAYER:
|
||||
insptr++;
|
||||
{
|
||||
// syntax [gs]etplayer[<var>].x <VAR>
|
||||
// <varid> <xxxid> <varid>
|
||||
int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2;
|
||||
// HACK: need to have access to labels structure at run-time...
|
||||
|
||||
if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2)
|
||||
lParm2=Gv_GetVarX(*insptr++);
|
||||
lVar2=*insptr++;
|
||||
|
||||
X_SetPlayer(lVar1, lLabelID, lVar2, lParm2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case CON_GETPLAYER:
|
||||
insptr++;
|
||||
{
|
||||
|
@ -3452,7 +3503,7 @@ static int32_t X_DoExecute(int32_t once)
|
|||
lParm2=Gv_GetVarX(*insptr++);
|
||||
lVar2=*insptr++;
|
||||
|
||||
X_AccessPlayer(tw==CON_SETPLAYER, lVar1, lLabelID, lVar2, lParm2);
|
||||
X_GetPlayer(lVar1, lLabelID, lVar2, lParm2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3544,7 +3595,7 @@ static int32_t X_DoExecute(int32_t once)
|
|||
{
|
||||
int32_t lVar1=*insptr++, lVar2=*insptr++;
|
||||
|
||||
if ((iPlayer < 0 || iPlayer >= ud.multimode) /* && g_scriptSanityChecks */)
|
||||
if ((iPlayer < 0 || iPlayer >= playerswhenstarted) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid player ID %d\n",g_errorLineNum,keyw[g_tw],iPlayer);
|
||||
if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
|
||||
|
@ -3563,6 +3614,24 @@ static int32_t X_DoExecute(int32_t once)
|
|||
}
|
||||
|
||||
case CON_SETACTOR:
|
||||
insptr++;
|
||||
{
|
||||
// syntax [gs]etactor[<var>].x <VAR>
|
||||
// <varid> <xxxid> <varid>
|
||||
|
||||
int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0;
|
||||
|
||||
if (ActorLabels[lLabelID].flags & LABEL_HASPARM2)
|
||||
lParm2=Gv_GetVarX(*insptr++);
|
||||
|
||||
{
|
||||
int32_t lVar2=*insptr++;
|
||||
|
||||
X_SetSprite(lVar1, lLabelID, lVar2, lParm2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CON_GETACTOR:
|
||||
insptr++;
|
||||
{
|
||||
|
@ -3577,7 +3646,7 @@ static int32_t X_DoExecute(int32_t once)
|
|||
{
|
||||
int32_t lVar2=*insptr++;
|
||||
|
||||
X_AccessSprite(tw==CON_SETACTOR, lVar1, lLabelID, lVar2, lParm2);
|
||||
X_GetSprite(lVar1, lLabelID, lVar2, lParm2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3622,7 +3691,7 @@ static int32_t X_DoExecute(int32_t once)
|
|||
|
||||
insptr++;
|
||||
|
||||
if ((j < 0 || j >= ud.multimode) /* && g_scriptSanityChecks */)
|
||||
if ((j < 0 || j >= playerswhenstarted) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid player ID %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
break;
|
||||
|
@ -4307,7 +4376,7 @@ static int32_t X_DoExecute(int32_t once)
|
|||
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))
|
||||
{
|
||||
int32_t j = ud.multimode-1;
|
||||
int32_t j = playerswhenstarted-1;
|
||||
for (; j>=0; j--)
|
||||
{
|
||||
if (g_player[j].ps->actorsqu == vm.g_i)
|
||||
|
@ -4745,7 +4814,7 @@ void G_RestoreMapState(mapstate_t *save)
|
|||
intptr_t j;
|
||||
char phealth[MAXPLAYERS];
|
||||
|
||||
for (i=0; i<ud.multimode; i++)
|
||||
for (i=0; i<playerswhenstarted; i++)
|
||||
phealth[i] = sprite[g_player[i].ps->i].extra;
|
||||
|
||||
pub = NUMPAGES;
|
||||
|
@ -4817,7 +4886,7 @@ void G_RestoreMapState(mapstate_t *save)
|
|||
|
||||
Gv_RefreshPointers();
|
||||
|
||||
for (i=0; i<ud.multimode; i++)
|
||||
for (i=0; i<playerswhenstarted; i++)
|
||||
sprite[g_player[i].ps->i].extra = phealth[i];
|
||||
|
||||
if (g_player[myconnectindex].ps->over_shoulder_on != 0)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -298,7 +298,7 @@ void Gv_WriteSave(FILE *fil)
|
|||
}
|
||||
|
||||
Bsprintf(g_szBuf,"EOF: EDuke32");
|
||||
l=strlen(g_szBuf);
|
||||
l=Bstrlen(g_szBuf);
|
||||
dfwrite(&l,sizeof(l),1,fil);
|
||||
dfwrite(g_szBuf,l,1,fil);
|
||||
}
|
||||
|
@ -503,13 +503,16 @@ int32_t Gv_NewVar(const char *pszLabel, int32_t lValue, uint32_t dwFlags)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void A_ResetVars(int32_t iActor)
|
||||
void __fastcall A_ResetVars(register int32_t iActor)
|
||||
{
|
||||
int32_t i=(MAXGAMEVARS-1);
|
||||
for (; i>=0; i--)
|
||||
if ((aGameVars[i].dwFlags & GAMEVAR_PERACTOR) && !(aGameVars[i].dwFlags & GAMEVAR_NODEFAULT))
|
||||
register int32_t i=(MAXGAMEVARS-1);
|
||||
do
|
||||
{
|
||||
if ((aGameVars[i].dwFlags & (GAMEVAR_PERACTOR|GAMEVAR_NODEFAULT)) == GAMEVAR_PERACTOR)
|
||||
aGameVars[i].val.plValues[iActor]=aGameVars[i].lDefault;
|
||||
}
|
||||
while (i--);
|
||||
}
|
||||
|
||||
static int32_t Gv_GetVarIndex(const char *szGameLabel)
|
||||
{
|
||||
|
@ -522,25 +525,22 @@ static int32_t Gv_GetVarIndex(const char *szGameLabel)
|
|||
return i;
|
||||
}
|
||||
|
||||
int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer)
|
||||
int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, register int32_t iPlayer)
|
||||
{
|
||||
if (id == MAXGAMEVARS)
|
||||
return(*insptr++);
|
||||
|
||||
if (id == g_iThisActorID)
|
||||
return iActor;
|
||||
|
||||
if (id == MAXGAMEVARS)
|
||||
return(*insptr++);
|
||||
|
||||
{
|
||||
int32_t negateResult = 0;
|
||||
register intptr_t negateResult = id&(MAXGAMEVARS<<1);
|
||||
|
||||
if (id >= g_gameVarCount || id < 0)
|
||||
{
|
||||
if (id&(MAXGAMEVARS<<2)) // array
|
||||
{
|
||||
int32_t index=Gv_GetVar(*insptr++,iActor,iPlayer);
|
||||
|
||||
if (id&(MAXGAMEVARS<<1)) // negative array access
|
||||
negateResult = 1;
|
||||
register int32_t index=Gv_GetVar(*insptr++,iActor,iPlayer);
|
||||
|
||||
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
|
||||
|
||||
|
@ -549,174 +549,102 @@ int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer)
|
|||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index);
|
||||
return -1;
|
||||
}
|
||||
if (negateResult) return (-aGameArrays[id].plValues[index]);
|
||||
return (aGameArrays[id].plValues[index]);
|
||||
|
||||
return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult);
|
||||
}
|
||||
|
||||
if (id&(MAXGAMEVARS<<3)) // struct shortcut vars
|
||||
{
|
||||
int32_t index=Gv_GetVar(*insptr++, iActor, iPlayer), label;
|
||||
register int32_t index=Gv_GetVar(*insptr++, iActor, iPlayer);
|
||||
|
||||
if (id == g_iActorVarID)
|
||||
switch ((id&(MAXGAMEVARS-1)) - g_iSpriteVarID)
|
||||
{
|
||||
if (index >= MAXSPRITES || index < 0)
|
||||
case 0: //if (id == g_iSpriteVarID)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]);
|
||||
return -1;
|
||||
}
|
||||
label = Gv_GetVar(*insptr++, index, iPlayer);
|
||||
// OSD_Printf("actorvar returned %d\n",label);
|
||||
}
|
||||
else label = *insptr++;
|
||||
|
||||
if (id&(MAXGAMEVARS<<1)) // negative array access
|
||||
negateResult = 1;
|
||||
|
||||
id &= (MAXGAMEVARS-1); //~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1));
|
||||
|
||||
if (id == g_iSpriteVarID)
|
||||
{
|
||||
int32_t parm2 = 0;
|
||||
int32_t parm2 = 0, label = *insptr++;
|
||||
|
||||
/*OSD_Printf("%d %d %d\n",__LINE__,index,label);*/
|
||||
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;
|
||||
return ((X_AccessSpriteX(index, label, parm2) ^ -negateResult) + negateResult);
|
||||
}
|
||||
if (negateResult) return (-X_AccessSpriteX(index, label, parm2));
|
||||
return (X_AccessSpriteX(index, label, parm2));
|
||||
}
|
||||
else if (id == g_iPlayerVarID)
|
||||
case 3: //else if (id == g_iPlayerVarID)
|
||||
{
|
||||
int32_t parm2 = 0;
|
||||
int32_t parm2 = 0, label = *insptr++;
|
||||
|
||||
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;
|
||||
return ((X_AccessPlayerX(index, label, parm2) ^ -negateResult) + negateResult);
|
||||
}
|
||||
if (negateResult) return (-X_AccessPlayerX(index, label, parm2));
|
||||
return (X_AccessPlayerX(index, label, parm2));
|
||||
}
|
||||
else if (id == g_iActorVarID)
|
||||
{
|
||||
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 -label;
|
||||
return label;
|
||||
}
|
||||
else if (id == g_iSectorVarID)
|
||||
{
|
||||
case 4: //else if (id == g_iActorVarID)
|
||||
return ((Gv_GetVar(*insptr++, index, iPlayer) ^ -negateResult) + negateResult);
|
||||
case 1: //else 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 ((X_AccessSectorX(index, *insptr++) ^ -negateResult) + negateResult);
|
||||
case 2: //else if (id == g_iWallVarID)
|
||||
return ((X_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
|
||||
default:
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF??\n",g_errorLineNum,keyw[g_tw]);
|
||||
return -1;
|
||||
}
|
||||
if (negateResult) return (-X_AccessSectorX(index, label));
|
||||
return (X_AccessSectorX(index, label));
|
||||
}
|
||||
else 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)
|
||||
id &= (MAXGAMEVARS-1);
|
||||
|
||||
if (!negateResult)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
negateResult = 1;
|
||||
id &= ~(MAXGAMEVARS<<1);
|
||||
}
|
||||
|
||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
switch (aGameVars[id].dwFlags &
|
||||
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
{
|
||||
default:
|
||||
if (negateResult) return (-aGameVars[id].val.lValue);
|
||||
return (aGameVars[id].val.lValue);
|
||||
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_PERPLAYER:
|
||||
if (iPlayer < 0 || iPlayer >= MAXPLAYERS)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid player ID (%d)\n",g_errorLineNum,keyw[g_tw],iPlayer);
|
||||
return -1;
|
||||
}
|
||||
if (negateResult) return (-aGameVars[id].val.plValues[iPlayer]);
|
||||
return (aGameVars[id].val.plValues[iPlayer]);
|
||||
if (iPlayer < 0 || iPlayer >= MAXPLAYERS) goto bad_id;
|
||||
return ((aGameVars[id].val.plValues[iPlayer] ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_PERACTOR:
|
||||
if (iActor < 0 || iActor >= MAXSPRITES)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite ID (%d)\n",g_errorLineNum,keyw[g_tw],iActor);
|
||||
if (iActor < 0 || iActor >= MAXSPRITES) goto bad_id;
|
||||
return ((aGameVars[id].val.plValues[iActor] ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_INTPTR:
|
||||
return (((*((int32_t*)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_SHORTPTR:
|
||||
return (((*((int16_t*)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_CHARPTR:
|
||||
return (((*((char*)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
||||
}
|
||||
}
|
||||
bad_id:
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite/player ID %d/%d\n",g_errorLineNum,keyw[g_tw],iActor,iPlayer);
|
||||
return -1;
|
||||
}
|
||||
if (negateResult) return (-aGameVars[id].val.plValues[iActor]);
|
||||
return (aGameVars[id].val.plValues[iActor]);
|
||||
case GAMEVAR_INTPTR:
|
||||
if (negateResult) return (-(*((int32_t*)aGameVars[id].val.lValue)));
|
||||
return ((*((int32_t*)aGameVars[id].val.lValue)));
|
||||
case GAMEVAR_SHORTPTR:
|
||||
if (negateResult) return (-(*((int16_t*)aGameVars[id].val.lValue)));
|
||||
return ((*((int16_t*)aGameVars[id].val.lValue)));
|
||||
case GAMEVAR_CHARPTR:
|
||||
if (negateResult) return (-(*((char*)aGameVars[id].val.lValue)));
|
||||
return ((*((char*)aGameVars[id].val.lValue)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register int32_t iActor, register int32_t iPlayer)
|
||||
{
|
||||
if (id<0 || id >= g_gameVarCount) goto badvarid;
|
||||
|
||||
void __fastcall Gv_SetVar(int32_t id, int32_t lValue, int32_t iActor, int32_t 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,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);
|
||||
//AddLog(g_szBuf);
|
||||
|
||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
switch (aGameVars[id].dwFlags &
|
||||
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
{
|
||||
default:
|
||||
aGameVars[id].val.lValue=lValue;
|
||||
return;
|
||||
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,vm.g_i,vm.g_p);
|
||||
return;
|
||||
}
|
||||
if (iPlayer < 0 || iPlayer > MAXPLAYERS-1) goto badplayer;
|
||||
// for the current player
|
||||
aGameVars[id].val.plValues[iPlayer]=lValue;
|
||||
return;
|
||||
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,vm.g_i,sprite[vm.g_i].picnum,vm.g_p);
|
||||
return;
|
||||
}
|
||||
// for the current actor
|
||||
if (iActor < 0 || iActor > MAXSPRITES-1) goto badactor;
|
||||
aGameVars[id].val.plValues[iActor]=lValue;
|
||||
return;
|
||||
case GAMEVAR_INTPTR:
|
||||
|
@ -726,30 +654,39 @@ void __fastcall Gv_SetVar(int32_t id, int32_t lValue, int32_t iActor, int32_t iP
|
|||
*((int16_t*)aGameVars[id].val.lValue)=(int16_t)lValue;
|
||||
return;
|
||||
case GAMEVAR_CHARPTR:
|
||||
*((char*)aGameVars[id].val.lValue)=(uint8_t)lValue;
|
||||
*((uint8_t*)aGameVars[id].val.lValue)=(uint8_t)lValue;
|
||||
return;
|
||||
}
|
||||
|
||||
badvarid:
|
||||
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;
|
||||
|
||||
badplayer:
|
||||
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;
|
||||
|
||||
badactor:
|
||||
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;
|
||||
}
|
||||
|
||||
int32_t __fastcall Gv_GetVarX(int32_t id)
|
||||
int32_t __fastcall Gv_GetVarX(register int32_t id)
|
||||
{
|
||||
if (id == MAXGAMEVARS)
|
||||
return(*insptr++);
|
||||
|
||||
if (id == g_iThisActorID)
|
||||
return vm.g_i;
|
||||
|
||||
if (id == MAXGAMEVARS)
|
||||
return(*insptr++);
|
||||
|
||||
{
|
||||
int32_t negateResult = 0;
|
||||
register intptr_t negateResult = id&(MAXGAMEVARS<<1);
|
||||
|
||||
if (id >= g_gameVarCount || id < 0)
|
||||
{
|
||||
if (id&(MAXGAMEVARS<<2)) // array
|
||||
{
|
||||
int32_t index=Gv_GetVarX(*insptr++);
|
||||
|
||||
if (id&(MAXGAMEVARS<<1)) // negative array access
|
||||
negateResult = 1;
|
||||
register int32_t index=Gv_GetVarX(*insptr++);
|
||||
|
||||
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
|
||||
|
||||
|
@ -758,134 +695,80 @@ int32_t __fastcall Gv_GetVarX(int32_t 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 (negateResult) return (-aGameArrays[id].plValues[index]);
|
||||
return (aGameArrays[id].plValues[index]);
|
||||
return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult);
|
||||
}
|
||||
|
||||
if (id&(MAXGAMEVARS<<3)) // struct shortcut vars
|
||||
{
|
||||
int32_t index=Gv_GetVarX(*insptr++), label;
|
||||
register int32_t index=Gv_GetVarX(*insptr++);
|
||||
|
||||
if (id&(MAXGAMEVARS<<1)) // negative array access
|
||||
negateResult = 1;
|
||||
|
||||
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<3)|(MAXGAMEVARS<<1));
|
||||
|
||||
if (id == g_iActorVarID)
|
||||
switch ((id&(MAXGAMEVARS-1)) - g_iSpriteVarID)
|
||||
{
|
||||
if (index >= MAXSPRITES || index < 0)
|
||||
case 0: //if (id == g_iSpriteVarID)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index\n",g_errorLineNum,keyw[g_tw]);
|
||||
return -1;
|
||||
}
|
||||
label = Gv_GetVar(*insptr++, index, vm.g_p);
|
||||
}
|
||||
else label = *insptr++;
|
||||
|
||||
if (id == g_iSpriteVarID)
|
||||
{
|
||||
int32_t parm2 = 0;
|
||||
int32_t parm2 = 0, label = *insptr++;
|
||||
|
||||
/*OSD_Printf("%d %d %d\n",__LINE__,index,label);*/
|
||||
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));
|
||||
return ((X_AccessSpriteX(index, label, parm2) ^ -negateResult) + negateResult);
|
||||
}
|
||||
else if (id == g_iPlayerVarID)
|
||||
case 3: //else if (id == g_iPlayerVarID)
|
||||
{
|
||||
int32_t parm2 = 0;
|
||||
int32_t parm2 = 0, label = *insptr++;
|
||||
|
||||
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;
|
||||
return ((X_AccessPlayerX(index, label, parm2) ^ -negateResult) + negateResult);
|
||||
}
|
||||
if (negateResult) return (-X_AccessPlayerX(index, label, parm2));
|
||||
return (X_AccessPlayerX(index, label, parm2));
|
||||
}
|
||||
else if (id == g_iActorVarID)
|
||||
{
|
||||
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 -label;
|
||||
return label;
|
||||
}
|
||||
else if (id == g_iSectorVarID)
|
||||
{
|
||||
case 4: //else if (id == g_iActorVarID)
|
||||
return ((Gv_GetVar(*insptr++, index, vm.g_p) ^ -negateResult) + negateResult);
|
||||
case 1: //else 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 ((X_AccessSectorX(index, *insptr++) ^ -negateResult) + negateResult);
|
||||
case 2: //else if (id == g_iWallVarID)
|
||||
return ((X_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
|
||||
default:
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF??\n",g_errorLineNum,keyw[g_tw]);
|
||||
return -1;
|
||||
}
|
||||
if (negateResult) return (-X_AccessSectorX(index, label));
|
||||
return (X_AccessSectorX(index, label));
|
||||
}
|
||||
else 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)
|
||||
id &= (MAXGAMEVARS-1);
|
||||
|
||||
if (!negateResult)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
negateResult = 1;
|
||||
id &= ~(MAXGAMEVARS<<1);
|
||||
}
|
||||
|
||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
switch (aGameVars[id].dwFlags &
|
||||
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
{
|
||||
default:
|
||||
if (negateResult) return (-aGameVars[id].val.lValue);
|
||||
return (aGameVars[id].val.lValue);
|
||||
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_PERPLAYER:
|
||||
if (negateResult) return (-aGameVars[id].val.plValues[vm.g_p]);
|
||||
return (aGameVars[id].val.plValues[vm.g_p]);
|
||||
return ((aGameVars[id].val.plValues[vm.g_p] ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_PERACTOR:
|
||||
if (negateResult) return (-aGameVars[id].val.plValues[vm.g_i]);
|
||||
return (aGameVars[id].val.plValues[vm.g_i]);
|
||||
return ((aGameVars[id].val.plValues[vm.g_i] ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_INTPTR:
|
||||
if (negateResult) return (-(*((int32_t*)aGameVars[id].val.lValue)));
|
||||
return (*((int32_t*)aGameVars[id].val.lValue));
|
||||
return (((*((int32_t*)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_SHORTPTR:
|
||||
if (negateResult) return (-(*((int16_t*)aGameVars[id].val.lValue)));
|
||||
return (*((int16_t*)aGameVars[id].val.lValue));
|
||||
return (((*((int16_t*)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
||||
case GAMEVAR_CHARPTR:
|
||||
if (negateResult) return (-(*((char*)aGameVars[id].val.lValue)));
|
||||
return (*((char*)aGameVars[id].val.lValue));
|
||||
return (((*((uint8_t*)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall Gv_SetVarX(int32_t id, int32_t lValue)
|
||||
void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
|
||||
{
|
||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|
|
||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
switch (aGameVars[id].dwFlags &
|
||||
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||
{
|
||||
default:
|
||||
aGameVars[id].val.lValue=lValue;
|
||||
|
@ -903,7 +786,7 @@ void __fastcall Gv_SetVarX(int32_t id, int32_t lValue)
|
|||
*((int16_t*)aGameVars[id].val.lValue)=(int16_t)lValue;
|
||||
return;
|
||||
case GAMEVAR_CHARPTR:
|
||||
*((char*)aGameVars[id].val.lValue)=(uint8_t)lValue;
|
||||
*((uint8_t*)aGameVars[id].val.lValue)=(uint8_t)lValue;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,8 @@ sound_t g_sounds[ MAXSOUNDS ];
|
|||
|
||||
char g_numPlayerSprites,g_loadFromGroupOnly=0,g_earthquakeTime;
|
||||
|
||||
int32_t playerswhenstarted;
|
||||
|
||||
int32_t fricxv,fricyv;
|
||||
playerdata_t g_player[MAXPLAYERS];
|
||||
input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
|
||||
|
|
|
@ -1868,7 +1868,10 @@ int32_t G_EnterLevel(int32_t g)
|
|||
}
|
||||
|
||||
if ((g&MODE_GAME) || (g&MODE_EOL))
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
{
|
||||
TRAVERSE_CONNECT(i)
|
||||
g_player[i].ps->gm = MODE_GAME;
|
||||
}
|
||||
else if (g&MODE_RESTART)
|
||||
{
|
||||
if (ud.recstat == 2)
|
||||
|
|
Loading…
Reference in a new issue