Cleaning out my tree... mostly internal changes. Adds workaround to disable texture compression with the crappy fglrx driver on Linux, fixes FIRE sprites so that they don't render at their sector's floorz all the time, changes CON compiler around a bit to use a loop instead of calling C_ParseCommand() 10 million times.

git-svn-id: https://svn.eduke32.com/eduke32@1857 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2011-04-07 01:16:29 +00:00
parent 958c207622
commit 1fdafcdad6
27 changed files with 3769 additions and 4156 deletions

View file

@ -20,7 +20,7 @@ ENGINELIB=engine.lib
EDITORLIB=build.lib EDITORLIB=build.lib
# this path should match eduke32\Makefile.msvc # this path should match eduke32\Makefile.msvc
WDKROOT="C:\WinDDK\7600.16385.1" WDKROOT="H:\WinDDK\7600.16385.1"
# /D these to enable certain features of the port's compile process # /D these to enable certain features of the port's compile process
# NOASM When defined, uses C instead of assembly code # NOASM When defined, uses C instead of assembly code

View file

@ -3,7 +3,7 @@
ENGINELIB=libengine.a ENGINELIB=libengine.a
EDITORLIB=libbuild.a EDITORLIB=libbuild.a
SDLCONFIG = /usr/local/bin/sdl-configinvalid SDLCONFIG = /usr/local/bin/sdl-config
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG)) ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
SDLROOT = /usr/local SDLROOT = /usr/local

View file

@ -87,6 +87,7 @@ extern void SetKey(int32_t key, int32_t state);
// mouse // mouse
extern volatile int32_t mousex, mousey, mouseb; extern volatile int32_t mousex, mousey, mouseb;
extern volatile uint8_t mousegrab, moustat;
// joystick // joystick
extern int32_t *joyaxis, *joyhat, joyb; extern int32_t *joyaxis, *joyhat, joyb;

View file

@ -37,8 +37,8 @@ extern "C" {
#define MAXVOXELS 4096 #define MAXVOXELS 4096
#define MAXSTATUS 1024 #define MAXSTATUS 1024
#define MAXPLAYERS 16 #define MAXPLAYERS 16
#define MAXXDIM 3072 #define MAXXDIM 7680
#define MAXYDIM 2304 #define MAXYDIM 3200
#define MAXBASEPALS 8 #define MAXBASEPALS 8
#define MAXPALOOKUPS 256 #define MAXPALOOKUPS 256
#define MAXPSKYTILES 256 #define MAXPSKYTILES 256
@ -339,9 +339,6 @@ extern char noclip;
EXTERN int32_t editorzrange[2]; EXTERN int32_t editorzrange[2];
EXTERN int32_t myconnectindex, numplayers;
EXTERN int32_t connecthead, connectpoint2[MAXPLAYERS];
static inline int32_t getrendermode(void) static inline int32_t getrendermode(void)
{ {
#ifndef USE_OPENGL #ifndef USE_OPENGL

View file

@ -34,7 +34,7 @@ enum cvartype_t
CVAR_BOOL = 0x00000008, CVAR_BOOL = 0x00000008,
CVAR_STRING = 0x00000010, CVAR_STRING = 0x00000010,
CVAR_DOUBLE = 0x00000020, CVAR_DOUBLE = 0x00000020,
CVAR_NOMULTI = 0x00000040, CVAR_LOCKED = 0x00000040,
CVAR_MULTI = 0x00000080, CVAR_MULTI = 0x00000080,
CVAR_NOSAVE = 0x00000100, CVAR_NOSAVE = 0x00000100,
CVAR_FUNCPTR = 0x00000200, CVAR_FUNCPTR = 0x00000200,
@ -43,7 +43,7 @@ enum cvartype_t
typedef struct typedef struct
{ {
const char *name; const char *name;
const char *helpstr; const char *desc;
void *var; void *var;
int32_t type; // see cvartype_t int32_t type; // see cvartype_t
int32_t min; int32_t min;
@ -53,7 +53,7 @@ typedef struct
typedef struct typedef struct
{ {
char *name; char *name;
char *helpstr; char *desc;
void *var; void *var;
int32_t type; // see cvartype_t int32_t type; // see cvartype_t
int32_t min; int32_t min;

View file

@ -17,6 +17,7 @@ char remap[256];
int32_t remapinit=0; int32_t remapinit=0;
char key_names[256][24]; char key_names[256][24];
volatile int32_t mousex=0,mousey=0,mouseb=0; volatile int32_t mousex=0,mousey=0,mouseb=0;
volatile uint8_t moustat = 0, mousegrab = 0;
int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL; int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL;
char joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0; char joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0;
int32_t joyaxespresent=0; int32_t joyaxespresent=0;
@ -93,6 +94,20 @@ const char *getkeyname(int32_t num)
return ((unsigned)num >= 256) ? NULL : key_names[num]; return ((unsigned)num >= 256) ? NULL : key_names[num];
} }
void readmousexy(int32_t *x, int32_t *y)
{
if (!moustat || !mousegrab || !appactive) { *x = *y = 0; return; }
*x = mousex;
*y = mousey;
mousex = mousey = 0;
}
void readmousebstatus(int32_t *b)
{
if (!moustat || !mousegrab || !appactive) { *b = 0; return; }
*b = mouseb;
}
#ifdef USE_OPENGL #ifdef USE_OPENGL
struct glinfo_t glinfo = struct glinfo_t glinfo =
{ {
@ -337,7 +352,7 @@ int32_t baselayer_init(void)
if (OSD_RegisterCvar(&cvars_engine[i])) if (OSD_RegisterCvar(&cvars_engine[i]))
continue; continue;
OSD_RegisterFunction(cvars_engine[i].name, cvars_engine[i].helpstr, OSD_RegisterFunction(cvars_engine[i].name, cvars_engine[i].desc,
(cvars_engine[i].type & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set); (cvars_engine[i].type & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
} }

View file

@ -133,13 +133,7 @@ int32_t OSD_RegisterCvar(const cvar_t *cvar)
if ((osdflags & OSD_INITIALIZED) == 0) if ((osdflags & OSD_INITIALIZED) == 0)
OSD_Init(); OSD_Init();
if (!cvar->name || !cvar->name[0]) if (!cvar->name || !cvar->name[0] || !cvar->var)
{
OSD_Printf("OSD_RegisterCvar(): can't register cvar with null name\n");
return -1;
}
if (!cvar->var)
{ {
OSD_Printf("OSD_RegisterCvar(): can't register null cvar\n"); OSD_Printf("OSD_RegisterCvar(): can't register null cvar\n");
return -1; return -1;
@ -511,6 +505,7 @@ static int32_t _internal_osdfunc_alias(const osdfuncparm_t *parm)
else OSD_Printf("%s is a function, not an alias\n",i->name); else OSD_Printf("%s is a function, not an alias\n",i->name);
return OSDCMD_OK; return OSDCMD_OK;
} }
if (i->func != OSD_ALIAS && i->func != OSD_UNALIASED) if (i->func != OSD_ALIAS && i->func != OSD_UNALIASED)
{ {
OSD_Printf("Cannot override function \"%s\" with alias\n",i->name); OSD_Printf("Cannot override function \"%s\" with alias\n",i->name);
@ -570,7 +565,9 @@ static int32_t _internal_osdfunc_listsymbols(const osdfuncparm_t *parm)
OSD_Printf(OSDTEXT_RED "Symbol listing:\n"); OSD_Printf(OSDTEXT_RED "Symbol listing:\n");
for (i=symbols; i!=NULL; i=i->next) for (i=symbols; i!=NULL; i=i->next)
{ {
if (i->func != OSD_UNALIASED) if (i->func == OSD_UNALIASED)
continue;
{ {
int32_t j = hash_find(&h_cvars, i->name); int32_t j = hash_find(&h_cvars, i->name);
@ -584,6 +581,7 @@ static int32_t _internal_osdfunc_listsymbols(const osdfuncparm_t *parm)
x += maxwidth; x += maxwidth;
count++; count++;
} }
if (x > osdcols - maxwidth) if (x > osdcols - maxwidth)
{ {
x = 0; x = 0;
@ -745,7 +743,7 @@ void OSD_Init(void)
if (OSD_RegisterCvar(&cvars_osd[i])) if (OSD_RegisterCvar(&cvars_osd[i]))
continue; continue;
OSD_RegisterFunction(cvars_osd[i].name, cvars_osd[i].helpstr, OSD_RegisterFunction(cvars_osd[i].name, cvars_osd[i].desc,
cvars_osd[i].type & CVAR_FUNCPTR ? osdcmd_cvar_set_osd : osdcmd_cvar_set); cvars_osd[i].type & CVAR_FUNCPTR ? osdcmd_cvar_set_osd : osdcmd_cvar_set);
} }
@ -1991,10 +1989,10 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
if (i > -1) if (i > -1)
{ {
if ((cvars[i].type & CVAR_NOMULTI) && numplayers > 1) if (cvars[i].type & CVAR_LOCKED)
{ {
// sound the alarm // sound the alarm
OSD_Printf("Cvar \"%s\" locked in multiplayer.\n",cvars[i].name); OSD_Printf("Cvar \"%s\" is read only.\n",cvars[i].name);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -2005,7 +2003,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
float val; float val;
if (showval) if (showval)
{ {
OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(float *)cvars[i].var,(char *)cvars[i].helpstr); OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(float *)cvars[i].var,(char *)cvars[i].desc);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -2026,7 +2024,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
double val; double val;
if (showval) if (showval)
{ {
OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(double *)cvars[i].var,(char *)cvars[i].helpstr); OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(double *)cvars[i].var,(char *)cvars[i].desc);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -2049,7 +2047,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
int32_t val; int32_t val;
if (showval) if (showval)
{ {
OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvars[i].name,*(int32_t *)cvars[i].var,(char *)cvars[i].helpstr); OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvars[i].name,*(int32_t *)cvars[i].var,(char *)cvars[i].desc);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -2070,7 +2068,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
{ {
if (showval) if (showval)
{ {
OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvars[i].name,(char *)cvars[i].var,(char *)cvars[i].helpstr); OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvars[i].name,(char *)cvars[i].var,(char *)cvars[i].desc);
return OSDCMD_OK; return OSDCMD_OK;
} }

View file

@ -6261,7 +6261,7 @@ void polymost_initosdfuncs(void)
if (OSD_RegisterCvar(&cvars_polymost[i])) if (OSD_RegisterCvar(&cvars_polymost[i]))
continue; continue;
OSD_RegisterFunction(cvars_polymost[i].name, cvars_polymost[i].helpstr, OSD_RegisterFunction(cvars_polymost[i].name, cvars_polymost[i].desc,
cvars_polymost[i].type & CVAR_FUNCPTR ? osdcmd_cvar_set_polymost : osdcmd_cvar_set); cvars_polymost[i].type & CVAR_FUNCPTR ? osdcmd_cvar_set_polymost : osdcmd_cvar_set);
} }
} }

View file

@ -276,18 +276,3 @@ void grabmouse(char a)
SetCursorPos(pos.x, pos.y); SetCursorPos(pos.x, pos.y);
} }
void readmousexy(int32_t *x, int32_t *y)
{
if (!moustat || !mousegrab) { *x = *y = 0; return; }
*x = mousex;
mousex = 0;
*y = mousey;
mousey = 0;
}
void readmousebstatus(int32_t *b)
{
if (!moustat || !mousegrab) { *b = 0; return; }
*b = mouseb;
}

View file

@ -447,7 +447,6 @@ void debugprintf(const char *f, ...)
// //
// //
static char mouseacquired=0,moustat=0;
// static int32_t joyblast=0; // static int32_t joyblast=0;
static SDL_Joystick *joydev = NULL; static SDL_Joystick *joydev = NULL;
@ -470,7 +469,7 @@ int32_t initinput(void)
if (SDL_EnableKeyRepeat(250, 30)) // doesn't do anything in 1.3 if (SDL_EnableKeyRepeat(250, 30)) // doesn't do anything in 1.3
initprintf("Error enabling keyboard repeat.\n"); initprintf("Error enabling keyboard repeat.\n");
inputdevices = 1|2; // keyboard (1) and mouse (2) inputdevices = 1|2; // keyboard (1) and mouse (2)
mouseacquired = 0; mousegrab = 0;
SDL_EnableUNICODE(1); // let's hope this doesn't hit us too hard SDL_EnableUNICODE(1); // let's hope this doesn't hit us too hard
@ -588,51 +587,27 @@ void grabmouse(char a)
{ {
if (appactive && moustat) if (appactive && moustat)
{ {
if (a != mouseacquired) if (a != mousegrab)
{ {
#ifndef DEBUGGINGAIDS #ifndef DEBUGGINGAIDS
SDL_GrabMode g; SDL_GrabMode g;
g = SDL_WM_GrabInput(a ? SDL_GRAB_ON : SDL_GRAB_OFF); g = SDL_WM_GrabInput(a ? SDL_GRAB_ON : SDL_GRAB_OFF);
mouseacquired = (g == SDL_GRAB_ON); mousegrab = (g == SDL_GRAB_ON);
SDL_ShowCursor(mouseacquired ? SDL_DISABLE : SDL_ENABLE); SDL_ShowCursor(mousegrab ? SDL_DISABLE : SDL_ENABLE);
#else #else
mouseacquired = a; mousegrab = a;
#endif #endif
} }
} }
else else
{ {
mouseacquired = a; mousegrab = a;
} }
mousex = mousey = 0; mousex = mousey = 0;
} }
//
// readmousexy() -- return mouse motion information
//
void readmousexy(int32_t *x, int32_t *y)
{
if (!mouseacquired || !appactive || !moustat) { *x = *y = 0; return; }
// if (mousex|mousey)printf("r:%d,%d\n",mousex,mousey); ///
*x = mousex;
*y = mousey;
mousex = mousey = 0;
}
//
// readmousebstatus() -- return mouse button information
//
void readmousebstatus(int32_t *b)
{
if (!mouseacquired || !appactive || !moustat) *b = 0;
else *b = mouseb;
}
// //
// setjoydeadzone() -- sets the dead and saturation zones for the joystick // setjoydeadzone() -- sets the dead and saturation zones for the joystick
// //
@ -979,7 +954,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
startwin_close(); startwin_close();
if (mouseacquired) if (mousegrab)
{ {
regrab = 1; regrab = 1;
grabmouse(0); grabmouse(0);
@ -1195,7 +1170,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
// support bgra textures // support bgra textures
glinfo.bgra = 1; glinfo.bgra = 1;
} }
else if (!Bstrcmp(p2, "GL_ARB_texture_compression")) else if (!Bstrcmp(p2, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor,"ATI Technologies Inc."))
{ {
// support texture compression // support texture compression
glinfo.texcompr = 1; glinfo.texcompr = 1;
@ -1559,7 +1534,6 @@ int32_t handleevents(void)
switch (ev.type) switch (ev.type)
{ {
#if (SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2) #if (SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2)
/*
case SDL_TEXTINPUT: case SDL_TEXTINPUT:
j = 0; j = 0;
do do
@ -1568,8 +1542,6 @@ int32_t handleevents(void)
if (code != scantoasc[OSD_OSDKey()] && ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc) if (code != scantoasc[OSD_OSDKey()] && ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
{ {
printf("got char %d\n",code);
if (OSD_HandleChar(code)) if (OSD_HandleChar(code))
{ {
keyasciififo[keyasciififoend] = code; keyasciififo[keyasciififoend] = code;
@ -1579,14 +1551,15 @@ int32_t handleevents(void)
} }
while (j < SDL_TEXTINPUTEVENT_TEXT_SIZE && ev.text.text[++j]); while (j < SDL_TEXTINPUTEVENT_TEXT_SIZE && ev.text.text[++j]);
break; break;
*/
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
code = keytranslation[ev.key.keysym.scancode]; code = keytranslation[ev.key.keysym.scancode];
if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN && if (ev.key.type == SDL_KEYDOWN &&
(ev.key.keysym.unicode & 0xff80) == 0 && (ev.key.keysym.scancode == SDL_SCANCODE_RETURN ||
ev.key.keysym.scancode == SDL_SCANCODE_BACKSPACE ||
ev.key.keysym.scancode == SDL_SCANCODE_TAB) &&
((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc) ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
{ {
if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f)) if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f))
@ -1624,7 +1597,7 @@ int32_t handleevents(void)
case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_FOCUS_GAINED:
appactive = 1; appactive = 1;
#ifndef DEBUGGINGAIDS #ifndef DEBUGGINGAIDS
if (mouseacquired && moustat) if (mousegrab && moustat)
{ {
SDL_WM_GrabInput(SDL_GRAB_ON); SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
@ -1634,7 +1607,7 @@ int32_t handleevents(void)
case SDL_WINDOWEVENT_FOCUS_LOST: case SDL_WINDOWEVENT_FOCUS_LOST:
appactive = 0; appactive = 0;
#ifndef DEBUGGINGAIDS #ifndef DEBUGGINGAIDS
if (mouseacquired && moustat) if (mousegrab && moustat)
{ {
SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(SDL_ENABLE); SDL_ShowCursor(SDL_ENABLE);
@ -1706,7 +1679,7 @@ int32_t handleevents(void)
{ {
appactive = ev.active.gain; appactive = ev.active.gain;
#ifndef DEBUGGINGAIDS #ifndef DEBUGGINGAIDS
if (mouseacquired && moustat) if (mousegrab && moustat)
{ {
if (appactive) if (appactive)
{ {
@ -1769,7 +1742,7 @@ int32_t handleevents(void)
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
// SDL 1.3 doesn't handle relative mouse movement correctly yet as the cursor still clips to the screen edges // SDL 1.3 doesn't handle relative mouse movement correctly yet as the cursor still clips to the screen edges
// so, we call SDL_WarpMouse() to center the cursor and ignore the resulting motion event that occurs // so, we call SDL_WarpMouse() to center the cursor and ignore the resulting motion event that occurs
if (appactive && mouseacquired && (ev.motion.x != xdim>>1 || ev.motion.y != ydim>>1)) if (appactive && mousegrab && (ev.motion.x != xdim>>1 || ev.motion.y != ydim>>1))
{ {
mousex += ev.motion.xrel; mousex += ev.motion.xrel;
mousey += ev.motion.yrel; mousey += ev.motion.yrel;

View file

@ -157,7 +157,6 @@ char di_disabled = 0;
static char di_devacquired; static char di_devacquired;
static HANDLE di_inputevt = 0; static HANDLE di_inputevt = 0;
static int32_t joyblast=0; static int32_t joyblast=0;
volatile uint8_t moustat = 0, mousegrab = 0;
static struct static struct
{ {
@ -3579,7 +3578,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
{ {
appactive = wParam; appactive = (wParam != 0);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (hGLWindow) if (hGLWindow)
{ {
@ -3628,6 +3627,8 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
} }
case WM_ACTIVATE: case WM_ACTIVATE:
appactive = (wParam != WA_INACTIVE);
if (appactive) if (appactive)
{ {
SetForegroundWindow(hWindow); SetForegroundWindow(hWindow);

View file

@ -2243,8 +2243,8 @@ CLEAR_THE_BOLT:
if (t[5] == 1) goto BOLT; if (t[5] == 1) goto BOLT;
p = G_CheckPlayerInSector(sect); if ((p = G_CheckPlayerInSector(sect)) >= 0 &&
if (p >= 0 && (g_player[p].ps->on_ground || s->ang == 512)) (g_player[p].ps->on_ground || s->ang == 512))
{ {
if (t[0] == 0 && !G_CheckActivatorMotion(s->lotag)) if (t[0] == 0 && !G_CheckActivatorMotion(s->lotag))
{ {

View file

@ -75,7 +75,6 @@ static int32_t usecwd = 0;
#endif /* _WIN32 */ #endif /* _WIN32 */
int32_t g_quitDeadline = 0; int32_t g_quitDeadline = 0;
int32_t g_scriptSanityChecks = 1;
int32_t g_cameraDistance = 0, g_cameraClock = 0; int32_t g_cameraDistance = 0, g_cameraClock = 0;
static int32_t g_quickExit; static int32_t g_quickExit;
@ -6372,7 +6371,7 @@ skip:
case BURNING__STATIC: case BURNING__STATIC:
case BURNING2__STATIC: case BURNING2__STATIC:
if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2) if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2)
t->z = sector[t->sectnum].floorz; t->z = actor[t->owner].floorz;
t->shade = -127; t->shade = -127;
case SMALLSMOKE__STATIC: case SMALLSMOKE__STATIC:
t->cstat |= 8192; t->cstat |= 8192;
@ -7049,7 +7048,7 @@ FOUNDCHEAT:
g_player[screenpeek].ps->cheat_phase = 0; g_player[screenpeek].ps->cheat_phase = 0;
Bsprintf(ScriptQuotes[QUOTE_RESERVED4], "MONSTERS: %s", s[g_noEnemies%1]); Bsprintf(ScriptQuotes[QUOTE_RESERVED4], "MONSTERS: %s", s[g_noEnemies & 1]);
P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps); P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
KB_FlushKeyBoardQueue(); KB_FlushKeyBoardQueue();

View file

@ -217,7 +217,6 @@ extern int32_t g_levelTextTime;
extern int32_t g_noSetup; extern int32_t g_noSetup;
extern int32_t g_quitDeadline; extern int32_t g_quitDeadline;
extern int32_t g_restorePalette; extern int32_t g_restorePalette;
extern int32_t g_scriptSanityChecks;
extern int32_t hud_glowingquotes; extern int32_t hud_glowingquotes;
extern int32_t hud_showmapname; extern int32_t hud_showmapname;
extern int32_t lastvisinc; extern int32_t lastvisinc;

File diff suppressed because it is too large Load diff

View file

@ -123,8 +123,6 @@ typedef struct {
extern vmstate_t vm; extern vmstate_t vm;
extern int32_t g_scriptSanityChecks;
extern int32_t g_errorLineNum; extern int32_t g_errorLineNum;
extern int32_t g_tw; extern int32_t g_tw;
extern const char *keyw[]; extern const char *keyw[];

View file

@ -1415,15 +1415,15 @@ skip_check:
switch (tw) switch (tw)
{ {
case CON_ACTIVATEBYSECTOR: case CON_ACTIVATEBYSECTOR:
if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} if ((unsigned)var1 >= (unsigned)numsectors) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
G_ActivateBySector(var1, var2); G_ActivateBySector(var1, var2);
break; break;
case CON_OPERATESECTORS: case CON_OPERATESECTORS:
if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} if ((unsigned)var1 >= (unsigned)numsectors) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
G_OperateSectors(var1, var2); G_OperateSectors(var1, var2);
break; break;
case CON_OPERATEACTIVATORS: case CON_OPERATEACTIVATORS:
if ((var2<0 || var2>=playerswhenstarted)) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2); break;} if ((unsigned)var2>=(unsigned)playerswhenstarted) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2); break;}
G_OperateActivators(var1, var2); G_OperateActivators(var1, var2);
break; break;
case CON_SETASPECT: case CON_SETASPECT:
@ -1616,7 +1616,7 @@ skip_check:
int32_t st = Gv_GetVarX(*insptr++); int32_t st = Gv_GetVarX(*insptr++);
int32_t ln = Gv_GetVarX(*insptr++); int32_t ln = Gv_GetVarX(*insptr++);
if ((q1<0 || q1>=MAXQUOTES)) if ((unsigned)q1>=MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q1); OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q1);
continue; continue;
@ -1626,7 +1626,7 @@ skip_check:
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q1); OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q1);
continue; continue;
} }
if ((q2<0 || q2>=MAXQUOTES)) if ((unsigned)q2>=MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q2); OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q2);
continue; continue;
@ -2269,7 +2269,7 @@ nullquote:
OSD_Printf(CON_ERROR "incorrect coordinates\n",g_errorLineNum,keyw[g_tw]); OSD_Printf(CON_ERROR "incorrect coordinates\n",g_errorLineNum,keyw[g_tw]);
continue; continue;
} }
if ((sect<0 || sect>=numsectors)) if ((unsigned)sect >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sect); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sect);
continue; continue;
@ -2445,7 +2445,7 @@ nullquote:
int32_t ceilz, ceilhit, florz, florhit; int32_t ceilz, ceilhit, florz, florhit;
if ((sectnum<0 || sectnum>=numsectors)) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
continue; continue;
@ -2465,7 +2465,7 @@ nullquote:
{ {
int32_t sectnum = Gv_GetVarX(*insptr++), osectnum; int32_t sectnum = Gv_GetVarX(*insptr++), osectnum;
if ((sectnum<0 || sectnum>=numsectors)) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
continue; continue;
@ -2539,7 +2539,7 @@ nullquote:
vect.z = z; vect.z = z;
sectnum = Gv_GetVarX(sectnumvar); sectnum = Gv_GetVarX(sectnumvar);
if ((sectnum<0 || sectnum>=numsectors)) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
Gv_SetVarX(retvar, 0); Gv_SetVarX(retvar, 0);
@ -2574,7 +2574,7 @@ nullquote:
int32_t hitsectvar=*insptr++, hitwallvar=*insptr++, hitspritevar=*insptr++; int32_t hitsectvar=*insptr++, hitwallvar=*insptr++, hitspritevar=*insptr++;
int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++); int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++);
if ((sectnum<0 || sectnum>=numsectors)) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
continue; continue;
@ -2598,7 +2598,7 @@ nullquote:
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++); int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++);
int32_t sect2=Gv_GetVarX(*insptr++), rvar=*insptr++; int32_t sect2=Gv_GetVarX(*insptr++), rvar=*insptr++;
if ((sect1<0 || sect1>=numsectors || sect2<0 || sect2>=numsectors)) if ((unsigned)sect1 >= (unsigned)numsectors || (unsigned)sect2 >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector\n",g_errorLineNum,keyw[g_tw]); OSD_Printf(CON_ERROR "Invalid sector\n",g_errorLineNum,keyw[g_tw]);
Gv_SetVarX(rvar, 0); Gv_SetVarX(rvar, 0);
@ -2638,7 +2638,7 @@ nullquote:
int32_t neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++; int32_t neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++;
int32_t neartagrange=Gv_GetVarX(*insptr++), tagsearch=Gv_GetVarX(*insptr++); int32_t neartagrange=Gv_GetVarX(*insptr++), tagsearch=Gv_GetVarX(*insptr++);
if ((sectnum<0 || sectnum>=numsectors)) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
continue; continue;
@ -2715,7 +2715,7 @@ nullquote:
insptr++; insptr++;
{ {
int32_t sectnum = Gv_GetVarX(*insptr++), x = Gv_GetVarX(*insptr++), y = Gv_GetVarX(*insptr++); int32_t sectnum = Gv_GetVarX(*insptr++), x = Gv_GetVarX(*insptr++), y = Gv_GetVarX(*insptr++);
if ((sectnum<0 || sectnum>=numsectors)) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
insptr++; insptr++;

View file

@ -1205,10 +1205,10 @@ static void __fastcall VM_GetPlayer(register int32_t lVar1, register int32_t lLa
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iPlayer=Gv_GetVarX(lVar1); iPlayer=Gv_GetVarX(lVar1);
if ((iPlayer<0 || iPlayer >= playerswhenstarted) /* && g_scriptSanityChecks */) if ((unsigned)iPlayer >= (unsigned)playerswhenstarted)
goto badplayer; goto badplayer;
if ((PlayerLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && ((unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2))
goto badpos; goto badpos;
switch (lLabelID) switch (lLabelID)
@ -1536,10 +1536,10 @@ static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVa
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iPlayer=Gv_GetVarX(lVar1); iPlayer=Gv_GetVarX(lVar1);
if ((iPlayer<0 || iPlayer >= playerswhenstarted) /* && g_scriptSanityChecks */) if ((unsigned)iPlayer >= (unsigned)playerswhenstarted)
goto badplayer; goto badplayer;
if ((PlayerLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2)
goto badpos; goto badpos;
lVar1=Gv_GetVarX(lVar2); lVar1=Gv_GetVarX(lVar2);
@ -1883,7 +1883,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iPlayer=Gv_GetVarX(lVar1); iPlayer=Gv_GetVarX(lVar1);
if ((iPlayer<0 || iPlayer >= playerswhenstarted) /* && g_scriptSanityChecks */) if ((unsigned)iPlayer >= (unsigned)playerswhenstarted)
goto badplayer; goto badplayer;
if (iSet) if (iSet)
@ -1959,7 +1959,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel
int32_t lValue=0; int32_t lValue=0;
int32_t iWall = Gv_GetVarX(lVar1); int32_t iWall = Gv_GetVarX(lVar1);
if ((iWall<0 || iWall >= numwalls) /* && g_scriptSanityChecks */) if ((unsigned)iWall >= (unsigned)numwalls)
goto badwall; goto badwall;
if (iSet) if (iSet)
@ -2137,7 +2137,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iSector=Gv_GetVarX(lVar1); iSector=Gv_GetVarX(lVar1);
if ((iSector<0 || iSector >= numsectors) /* && g_scriptSanityChecks */) if ((unsigned)iSector >= (unsigned)numsectors)
goto badsector; goto badsector;
if (iSet) if (iSet)
@ -2372,7 +2372,7 @@ static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa
if ((unsigned)iActor >= MAXSPRITES) if ((unsigned)iActor >= MAXSPRITES)
goto badactor; goto badactor;
if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) if (ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)
goto badpos; goto badpos;
lVar1=Gv_GetVarX(lVar2); lVar1=Gv_GetVarX(lVar2);
@ -2616,7 +2616,7 @@ static void __fastcall VM_GetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa
if ((unsigned)iActor >= MAXSPRITES) if ((unsigned)iActor >= MAXSPRITES)
goto badactor; goto badactor;
if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) if (ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)
goto badpos; goto badpos;
switch (lLabelID) switch (lLabelID)
@ -2862,7 +2862,7 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa
if (iSet) if (iSet)
lValue=Gv_GetVarX(lVar2); lValue=Gv_GetVarX(lVar2);
if ((!spriteext[iActor].tspr) && g_scriptSanityChecks) if (!spriteext[iActor].tspr)
goto badtspr; goto badtspr;
switch (lLabelID) switch (lLabelID)
@ -3094,7 +3094,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t
{ {
int32_t lValue=0; int32_t lValue=0;
if ((lVar1 < 0 || lVar1 >= MAXTILES) /* && g_scriptSanityChecks */) if ((unsigned)lVar1 >= MAXTILES)
goto badtile; goto badtile;
if (iSet) if (iSet)
@ -3366,7 +3366,7 @@ badtile:
#else #else
static int32_t __fastcall VM_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2) static int32_t __fastcall VM_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2)
{ {
if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) if (ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)
goto badpos; goto badpos;
switch (lLabelID) switch (lLabelID)
@ -3465,7 +3465,7 @@ static int32_t __fastcall VM_AccessSectorX(int32_t iSector, int32_t lLabelID)
static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2) static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2)
{ {
if ((PlayerLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2)
goto badpos; goto badpos;
switch (lLabelID) switch (lLabelID)

View file

@ -361,7 +361,7 @@ void Gv_DumpValues(void)
OSD_Printf(" // "); OSD_Printf(" // ");
if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM)) if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM))
OSD_Printf(" (system)"); OSD_Printf(" (system)");
if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) if (aGameVars[i].dwFlags & (GAMEVAR_PTR_MASK))
OSD_Printf(" (pointer)"); OSD_Printf(" (pointer)");
if (aGameVars[i].dwFlags & (GAMEVAR_READONLY)) if (aGameVars[i].dwFlags & (GAMEVAR_READONLY))
OSD_Printf(" (read only)"); OSD_Printf(" (read only)");
@ -464,7 +464,7 @@ int32_t Gv_NewVar(const char *pszLabel, int32_t lValue, uint32_t dwFlags)
if (i >= 0 && !(aGameVars[i].dwFlags & GAMEVAR_RESET)) if (i >= 0 && !(aGameVars[i].dwFlags & GAMEVAR_RESET))
{ {
// found it... // found it...
if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) if (aGameVars[i].dwFlags & (GAMEVAR_PTR_MASK))
{ {
// warning++; // warning++;
// initprintf("%s:%d: warning: Internal gamevar '%s' cannot be redefined.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); // initprintf("%s:%d: warning: Internal gamevar '%s' cannot be redefined.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
@ -572,10 +572,10 @@ int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, regis
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1)); id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
if (index >= aGameArrays[id].size || index < 0) if ((unsigned)index >= (unsigned)aGameArrays[id].size)
{ {
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index); iActor = index;
return -1; goto badindex;
} }
return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult); return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult);
@ -615,22 +615,18 @@ int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, regis
case 2: //else if (id == g_iWallVarID) case 2: //else if (id == g_iWallVarID)
return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult); return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
default: default:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]); goto wtf;
return -1;
} }
} }
id &= (MAXGAMEVARS-1); id &= (MAXGAMEVARS-1);
if (!negateResult) if (!negateResult)
{ goto badvarid;
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
return -1;
}
} }
switch (aGameVars[id].dwFlags & switch (aGameVars[id].dwFlags &
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
{ {
default: default:
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult); return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
@ -648,20 +644,33 @@ int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, regis
return (((*((char *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); return (((*((char *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
} }
} }
bad_id: bad_id:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite/player ID %d/%d\n",g_errorLineNum,keyw[g_tw],iActor,iPlayer); OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite/player ID %d/%d\n",g_errorLineNum,keyw[g_tw],iActor,iPlayer);
return -1; return -1;
badvarid:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
return -1;
badindex:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,iActor);
return -1;
wtf:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]);
return -1;
} }
void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register int32_t iActor, register int32_t iPlayer) 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; if ((unsigned)id >= (unsigned)g_gameVarCount) goto badvarid;
//Bsprintf(g_szBuf,"SGVI: %d ('%s') to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer); //Bsprintf(g_szBuf,"SGVI: %d ('%s') to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer);
//AddLog(g_szBuf); //AddLog(g_szBuf);
switch (aGameVars[id].dwFlags & switch (aGameVars[id].dwFlags &
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
{ {
default: default:
aGameVars[id].val.lValue=lValue; aGameVars[id].val.lValue=lValue;
@ -718,11 +727,12 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1)); id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
if (index >= aGameArrays[id].size || index < 0) if ((unsigned)index >= (unsigned)aGameArrays[id].size)
{ {
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index); negateResult = index;
return -1; goto badindex;
} }
return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult); return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult);
} }
@ -760,22 +770,18 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
case 2: //else if (id == g_iWallVarID) case 2: //else if (id == g_iWallVarID)
return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult); return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
default: default:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]); goto wtf;
return -1;
} }
} }
id &= (MAXGAMEVARS-1); id &= (MAXGAMEVARS-1);
if (!negateResult) if (!negateResult)
{ goto badvarid;
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
return -1;
}
} }
switch (aGameVars[id].dwFlags & switch (aGameVars[id].dwFlags &
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
{ {
default: default:
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult); return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
@ -790,13 +796,25 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
case GAMEVAR_CHARPTR: case GAMEVAR_CHARPTR:
return (((*((uint8_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); return (((*((uint8_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
} }
badindex:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,negateResult);
return -1;
badvarid:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
return -1;
wtf:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]);
return -1;
} }
} }
void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue) void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
{ {
switch (aGameVars[id].dwFlags & switch (aGameVars[id].dwFlags &
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
{ {
default: default:
aGameVars[id].val.lValue=lValue; aGameVars[id].val.lValue=lValue;
@ -1457,79 +1475,79 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("player", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL); Gv_NewVar("player", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("actorvar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL); Gv_NewVar("actorvar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("currentweapon",(intptr_t)&g_currentweapon, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("currentweapon",(intptr_t)&g_currentweapon, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("gs",(intptr_t)&g_gs, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("gs",(intptr_t)&g_gs, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("looking_arc",(intptr_t)&g_looking_arc, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("looking_arc",(intptr_t)&g_looking_arc, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("gun_pos",(intptr_t)&g_gun_pos, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("gun_pos",(intptr_t)&g_gun_pos, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("weapon_xoffset",(intptr_t)&g_weapon_xoffset, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("weapon_xoffset",(intptr_t)&g_weapon_xoffset, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("weaponcount",(intptr_t)&g_kb, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("weaponcount",(intptr_t)&g_kb, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("looking_angSR1",(intptr_t)&g_looking_angSR1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("looking_angSR1",(intptr_t)&g_looking_angSR1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("windowx1",(intptr_t)&windowx1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("windowx1",(intptr_t)&windowx1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("windowx2",(intptr_t)&windowx2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("windowx2",(intptr_t)&windowx2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("windowy1",(intptr_t)&windowy1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("windowy1",(intptr_t)&windowy1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("windowy2",(intptr_t)&windowy2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("windowy2",(intptr_t)&windowy2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("lastvisinc",(intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("lastvisinc",(intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
Gv_NewVar("current_menu",(intptr_t)&g_currentMenu, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); Gv_NewVar("current_menu",(intptr_t)&g_currentMenu, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("numplayers",(intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); Gv_NewVar("numplayers",(intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("gametype_flags",(intptr_t)&GametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("gametype_flags",(intptr_t)&GametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("framerate",(intptr_t)&g_currentFrameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_NewVar("framerate",(intptr_t)&g_currentFrameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY); Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY); Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
Gv_NewVar("camerax",(intptr_t)&ud.camera.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("camerax",(intptr_t)&ud.camera.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("cameray",(intptr_t)&ud.camera.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameray",(intptr_t)&ud.camera.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("cameraz",(intptr_t)&ud.camera.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameraz",(intptr_t)&ud.camera.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myx",(intptr_t)&my.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myx",(intptr_t)&my.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myy",(intptr_t)&my.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myy",(intptr_t)&my.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myz",(intptr_t)&my.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myz",(intptr_t)&my.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("omyx",(intptr_t)&omy.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("omyx",(intptr_t)&omy.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("omyy",(intptr_t)&omy.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("omyy",(intptr_t)&omy.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("omyz",(intptr_t)&omy.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("omyz",(intptr_t)&omy.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myvelx",(intptr_t)&myvel.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myvelx",(intptr_t)&myvel.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myvely",(intptr_t)&myvel.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myvely",(intptr_t)&myvel.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myvelz",(intptr_t)&myvel.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myvelz",(intptr_t)&myvel.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("myhoriz",(intptr_t)&myhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myhoriz",(intptr_t)&myhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("myhorizoff",(intptr_t)&myhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myhorizoff",(intptr_t)&myhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("omyhoriz",(intptr_t)&omyhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("omyhoriz",(intptr_t)&omyhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("omyhorizoff",(intptr_t)&omyhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("omyhorizoff",(intptr_t)&omyhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("myang",(intptr_t)&myang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myang",(intptr_t)&myang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("omyang",(intptr_t)&omyang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("omyang",(intptr_t)&omyang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("mycursectnum",(intptr_t)&mycursectnum, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("mycursectnum",(intptr_t)&mycursectnum, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("myjumpingcounter",(intptr_t)&myjumpingcounter, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myjumpingcounter",(intptr_t)&myjumpingcounter, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
Gv_NewVar("myjumpingtoggle",(intptr_t)&myjumpingtoggle, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myjumpingtoggle",(intptr_t)&myjumpingtoggle, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
Gv_NewVar("myonground",(intptr_t)&myonground, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myonground",(intptr_t)&myonground, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
Gv_NewVar("myhardlanding",(intptr_t)&myhardlanding, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myhardlanding",(intptr_t)&myhardlanding, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
Gv_NewVar("myreturntocenter",(intptr_t)&myreturntocenter, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("myreturntocenter",(intptr_t)&myreturntocenter, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
Gv_NewVar("display_mirror",(intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("display_mirror",(intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
Gv_NewVar("randomseed",(intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("randomseed",(intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("NUMWALLS",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); Gv_NewVar("NUMWALLS",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
#ifdef USE_OPENGL #ifdef USE_OPENGL
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
#else #else
Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
#endif #endif
} }

View file

@ -29,7 +29,7 @@ enum GamevarFlags_t {
MAXVARLABEL = 26, MAXVARLABEL = 26,
GAMEVAR_PERPLAYER = 0x00000001, // per-player variable GAMEVAR_PERPLAYER = 0x00000001, // per-player variable
GAMEVAR_PERACTOR = 0x00000002, // per-actor variable GAMEVAR_PERACTOR = 0x00000002, // per-actor variable
GAMEVAR_USER_MASK = (0x00000001|0x00000002), GAMEVAR_USER_MASK = (GAMEVAR_PERPLAYER|GAMEVAR_PERACTOR),
GAMEVAR_RESET = 0x00000008, // marks var for to default GAMEVAR_RESET = 0x00000008, // marks var for to default
GAMEVAR_DEFAULT = 0x00000100, // allow override GAMEVAR_DEFAULT = 0x00000100, // allow override
GAMEVAR_SECRET = 0x00000200, // don't dump... GAMEVAR_SECRET = 0x00000200, // don't dump...
@ -37,9 +37,9 @@ enum GamevarFlags_t {
GAMEVAR_SYSTEM = 0x00000800, // cannot change mode flags...(only default value) GAMEVAR_SYSTEM = 0x00000800, // cannot change mode flags...(only default value)
GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed) GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed)
GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t
GAMEVAR_SYNCCHECK = 0x00004000, // throw warnings during compile if used in local event
GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short
GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char
GAMEVAR_PTR_MASK = (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR),
GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars
GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets

View file

@ -36,6 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAXINTERPOLATIONS MAXSPRITES #define MAXINTERPOLATIONS MAXSPRITES
G_EXTERN int32_t myconnectindex, numplayers;
G_EXTERN int32_t connectpoint2[MAXPLAYERS];
G_EXTERN const char *s_buildRev; G_EXTERN const char *s_buildRev;
G_EXTERN DukeStatus_t sbar; G_EXTERN DukeStatus_t sbar;
G_EXTERN actor_t actor[MAXSPRITES]; G_EXTERN actor_t actor[MAXSPRITES];

View file

@ -1594,6 +1594,7 @@ static int32_t C_ParseCommand(void)
{ {
default: default:
case -1: case -1:
case -2:
return 0; //End return 0; //End
// *** basic commands // *** basic commands

View file

@ -1973,6 +1973,7 @@ void Net_ParseServerPacket(ENetEvent *event)
if (g_netClientPeer) if (g_netClientPeer)
enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(packbuf, 2, ENET_PACKET_FLAG_RELIABLE)); enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(packbuf, 2, ENET_PACKET_FLAG_RELIABLE));
g_netSync = 0; g_netSync = 0;
} }
@ -2237,6 +2238,28 @@ void Net_ParseClientPacket(ENetEvent *event)
enet_host_broadcast(g_netServer, CHAN_GAMESTATE , enet_packet_create(packbuf, j, ENET_PACKET_FLAG_RELIABLE)); enet_host_broadcast(g_netServer, CHAN_GAMESTATE , enet_packet_create(packbuf, j, ENET_PACKET_FLAG_RELIABLE));
// a player connecting is a good time to mark things as needing to be updated
// we invalidate everything that has changed since we started sending the snapshot of the map to the new player
{
int32_t zz, i, nexti;
for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])); zz++)
TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti)
{
if (lastupdate[i] >= g_player[other].netsynctime)
lastupdate[i] = 0;
}
}
for (i=numwalls-1; i>=0; i--)
if (lastwallupdate[i] >= g_player[other].netsynctime)
lastwallupdate[i] = 0;
for (i=numsectors-1; i>=0; i--)
if (lastsectupdate[i] >= g_player[other].netsynctime)
lastsectupdate[i] = 0;
break; break;
@ -2416,35 +2439,7 @@ void Net_ParseClientPacket(ENetEvent *event)
enet_peer_send(event->peer, CHAN_GAMESTATE, enet_packet_create(packbuf, 13, ENET_PACKET_FLAG_RELIABLE)); enet_peer_send(event->peer, CHAN_GAMESTATE, enet_packet_create(packbuf, 13, ENET_PACKET_FLAG_RELIABLE));
/*
P_ResetStatus(other);
P_ResetWeapons(other);
P_ResetInventory(other);
*/
g_netPlayersWaiting--; g_netPlayersWaiting--;
// a player connecting is a good time to mark things as needing to be updated
// we invalidate everything that has changed since we started sending the snapshot of the map to the new player
{
int32_t zz, i, nexti;
for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])); zz++)
TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti)
{
if (lastupdate[i] >= g_player[other].netsynctime)
spritecrc[i] = 0xdeadbeef;
}
}
for (i=numwalls-1; i>=0; i--)
if (lastwallupdate[i] >= g_player[other].netsynctime)
wallcrc[i] = 0xdeadbeef;
for (i=numsectors-1; i>=0; i--)
if (lastsectupdate[i] >= g_player[other].netsynctime)
sectcrc[i] = 0xdeadbeef;
} }
break; break;
} }
@ -2544,42 +2539,37 @@ void Net_GetPackets(void)
else if (g_netClient) else if (g_netClient)
{ {
ENetEvent event; ENetEvent event;
size_t datasiz = 0;
enet_host_service(g_netClient, NULL, 0); do
while (enet_host_check_events(g_netClient, &event) > 0)
{ {
switch (event.type) enet_host_service(g_netClient, NULL, 0);
while (enet_host_check_events(g_netClient, &event) > 0)
{ {
case ENET_EVENT_TYPE_RECEIVE: switch (event.type)
/*
initprintf("A packet of length %u was received from player %d on channel %u.\n",
event.packet -> dataLength,
event.peer -> data,
event.channelID);
*/
// mapstate transfer from the server... all packets but the last are SYNCPACKETSIZE
if (event.channelID == CHAN_SYNC)
{ {
static int32_t datasiz = 0; case ENET_EVENT_TYPE_RECEIVE:
static uint8_t *buf = NULL;
if (buf == NULL) /*
initprintf("A packet of length %u was received from player %d on channel %u.\n",
event.packet -> dataLength,
event.peer -> data,
event.channelID);
*/
// mapstate transfer from the server... all packets but the last are SYNCPACKETSIZE
if (event.channelID == CHAN_SYNC)
{ {
datasiz = 0; static uint8_t *buf = NULL;
g_netSync = 1;
buf = (uint8_t *)Bcalloc(1, sizeof(mapstate_t)<<1);
}
g_multiMapState = (mapstate_t *)Brealloc(g_multiMapState, sizeof(mapstate_t)); if (buf == NULL)
{
g_netSync = 1;
buf = (uint8_t *)Bcalloc(1, sizeof(mapstate_t)<<1);
}
if (buf && event.packet->dataLength == SYNCPACKETSIZE) g_multiMapState = (mapstate_t *)Brealloc(g_multiMapState, sizeof(mapstate_t));
{
char tbuf[64];
Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
datasiz += SYNCPACKETSIZE;
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
@ -2588,89 +2578,87 @@ void Net_GetPackets(void)
if (PLUTOPAK) // JBF 20030804 if (PLUTOPAK) // JBF 20030804
rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1); rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1);
Bsprintf(tbuf, "RECEIVED %d BYTES\n", datasiz); if (buf && event.packet->dataLength == SYNCPACKETSIZE)
gametext(160,190,tbuf,14,2);
}
// last packet of mapstate sequence
else if (buf)
{
Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
datasiz = 0;
// g_netSync = 0;
if (qlz_size_decompressed((const char *)buf) == sizeof(mapstate_t))
{ {
qlz_decompress((const char *)buf, g_multiMapState, state_decompress); char tbuf[64];
Bfree(buf); Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
buf = NULL; datasiz += SYNCPACKETSIZE;
packbuf[0] = PACKET_REQUEST_GAMESTATE; Bsprintf(tbuf, "RECEIVED %d BYTES\n", datasiz);
packbuf[1] = myconnectindex; gametext(160,190,tbuf,14,2);
enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(&packbuf[0], 2, ENET_PACKET_FLAG_RELIABLE)); }
// last packet of mapstate sequence
else if (buf)
{
Bmemcpy((uint8_t *)(buf)+datasiz, event.packet->data, event.packet->dataLength);
datasiz = 0;
// g_netSync = 0;
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); if (qlz_size_decompressed((const char *)buf) == sizeof(mapstate_t))
{
qlz_decompress((const char *)buf, g_multiMapState, state_decompress);
Bfree(buf);
buf = NULL;
rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); packbuf[0] = PACKET_REQUEST_GAMESTATE;
rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1); packbuf[1] = myconnectindex;
if (PLUTOPAK) // JBF 20030804 enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(&packbuf[0], 2, ENET_PACKET_FLAG_RELIABLE));
rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1);
gametext(160,190,"TRANSFER COMPLETE",14,2); gametext(160,190,"TRANSFER COMPLETE",14,2);
}
else
{
initprintf("Invalid map state from server!\n");
Bfree(buf);
buf = NULL;
g_netDisconnect = 1;
g_netSync = 0;
gametext(160,190,"TRANSFER ERROR",14,2);
}
} }
else else
{ {
initprintf("Invalid map state from server!\n"); initprintf("Error allocating buffer for map state!\n");
Bfree(buf);
buf = NULL;
g_netDisconnect = 1; g_netDisconnect = 1;
g_netSync = 0;
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1);
if (PLUTOPAK) // JBF 20030804
rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1);
gametext(160,190,"TRANSFER ERROR",14,2); gametext(160,190,"TRANSFER ERROR",14,2);
} }
nextpage();
} }
else else Net_ParseServerPacket(&event);
enet_packet_destroy(event.packet);
break;
case ENET_EVENT_TYPE_DISCONNECT:
g_netDisconnect = 1;
numplayers = playerswhenstarted = ud.multimode = 1;
myconnectindex = screenpeek = 0;
G_BackToMenu();
switch (event.data)
{ {
initprintf("Error allocating buffer for map state!\n"); case DISC_BAD_PASSWORD:
g_netDisconnect = 1; initprintf("Bad password.\n");
return;
case DISC_KICKED:
initprintf("You have been kicked from the server.\n");
return;
case DISC_BANNED:
initprintf("You are banned from this server.\n");
return;
default:
initprintf("Disconnected.\n");
return;
} }
nextpage();
}
else Net_ParseServerPacket(&event);
enet_packet_destroy(event.packet);
break;
case ENET_EVENT_TYPE_DISCONNECT:
g_netDisconnect = 1;
numplayers = playerswhenstarted = ud.multimode = 1;
myconnectindex = screenpeek = 0;
G_BackToMenu();
switch (event.data)
{
case DISC_BAD_PASSWORD:
initprintf("Bad password.\n");
return;
case DISC_KICKED:
initprintf("You have been kicked from the server.\n");
return;
case DISC_BANNED:
initprintf("You are banned from this server.\n");
return;
default: default:
initprintf("Disconnected.\n"); break;
return;
} }
default:
break;
} }
} }
while (datasiz);
} }
} }
@ -2965,8 +2953,6 @@ void Net_StreamLevel(void)
} }
*(uint16_t *)&packbuf[zj] = k; *(uint16_t *)&packbuf[zj] = k;
// j += sizeof(uint16_t);
k = 0; k = 0;
*(uint16_t *)&packbuf[(zj = j)] = 0; *(uint16_t *)&packbuf[(zj = j)] = 0;
@ -2991,7 +2977,6 @@ void Net_StreamLevel(void)
} }
} }
*(uint16_t *)&packbuf[zj] = k; *(uint16_t *)&packbuf[zj] = k;
// j += sizeof(uint16_t);
k = 0; k = 0;
*(uint16_t *)&packbuf[(zj = j)] = 0; *(uint16_t *)&packbuf[(zj = j)] = 0;
@ -3016,15 +3001,12 @@ void Net_StreamLevel(void)
} }
} }
*(uint16_t *)&packbuf[zj] = k; *(uint16_t *)&packbuf[zj] = k;
// j += sizeof(uint16_t);
{ {
char buf[PACKBUF_SIZE]; char buf[PACKBUF_SIZE];
if (j >= PACKBUF_SIZE) if (j >= PACKBUF_SIZE)
{
initprintf("Global packet buffer overflow! Size of packet: %i\n", j); initprintf("Global packet buffer overflow! Size of packet: %i\n", j);
}
j = qlz_compress((char *)(packbuf)+1, (char *)buf, j, state_compress); j = qlz_compress((char *)(packbuf)+1, (char *)buf, j, state_compress);
Bmemcpy((char *)(packbuf)+1, (char *)buf, j); Bmemcpy((char *)(packbuf)+1, (char *)buf, j);
@ -3203,20 +3185,20 @@ void Net_WaitForServer(void)
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 11); P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 11);
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1);
if (PLUTOPAK) // JBF 20030804
rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1);
gametext(160,170,"WAITING FOR SERVER",14,2);
nextpage();
do do
{ {
if (quitevent || keystatus[1]) G_GameExit(""); if (quitevent || keystatus[1]) G_GameExit("");
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1);
if (PLUTOPAK) // JBF 20030804
rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1);
gametext(160,170,"WAITING FOR SERVER",14,2);
nextpage();
packbuf[0] = PACKET_PLAYER_PING; packbuf[0] = PACKET_PLAYER_PING;
packbuf[1] = myconnectindex; packbuf[1] = myconnectindex;

View file

@ -1337,7 +1337,7 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
if (numplayers > 1) if (numplayers > 1)
return r; return r;
ud.m_player_skill = ud.player_skill; ud.player_skill = ud.m_player_skill;
return r; return r;
} }
@ -1448,7 +1448,7 @@ int32_t registerosdcommands(void)
{ "sensitivity","sensitivity <value>: changes the mouse sensitivity", (void *)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 25 }, { "sensitivity","sensitivity <value>: changes the mouse sensitivity", (void *)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 25 },
{ "skill","skill <value>: changes the game skill setting", (void *)&ud.player_skill, CVAR_INT|CVAR_FUNCPTR|CVAR_NOMULTI, 0, 5 }, { "skill","skill <value>: changes the game skill setting", (void *)&ud.m_player_skill, CVAR_INT|CVAR_FUNCPTR/*|CVAR_NOMULTI*/, 0, 5 },
{ "snd_ambience", "snd_ambience: enables/disables ambient sounds", (void *)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 1 }, { "snd_ambience", "snd_ambience: enables/disables ambient sounds", (void *)&ud.config.AmbienceToggle, CVAR_BOOL, 0, 1 },
{ "snd_duketalk", "snd_duketalk: enables/disables Duke's speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 }, { "snd_duketalk", "snd_duketalk: enables/disables Duke's speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 },
@ -1477,14 +1477,14 @@ int32_t registerosdcommands(void)
switch (cvars_game[i].type & (CVAR_FUNCPTR|CVAR_MULTI)) switch (cvars_game[i].type & (CVAR_FUNCPTR|CVAR_MULTI))
{ {
case CVAR_FUNCPTR: case CVAR_FUNCPTR:
OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].helpstr, osdcmd_cvar_set_game); OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].desc, osdcmd_cvar_set_game);
break; break;
case CVAR_MULTI: case CVAR_MULTI:
case CVAR_FUNCPTR|CVAR_MULTI: case CVAR_FUNCPTR|CVAR_MULTI:
OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].helpstr, osdcmd_cvar_set_multi); OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].desc, osdcmd_cvar_set_multi);
break; break;
default: default:
OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].helpstr, osdcmd_cvar_set); OSD_RegisterFunction(cvars_game[i].name, cvars_game[i].desc, osdcmd_cvar_set);
break; break;
} }
} }

View file

@ -3212,18 +3212,17 @@ void getinput(int32_t snum)
CONTROL_ClearButton(gamefunc_Fire); CONTROL_ClearButton(gamefunc_Fire);
loc.extbits = 0; loc.extbits = 0;
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEFORWARD]) loc.extbits |= (BUTTON(gamefunc_Move_Forward) || (vel > 0));
loc.extbits |= BUTTON(gamefunc_Move_Forward) || (vel > 0);
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEBACKWARD])
loc.extbits |= (BUTTON(gamefunc_Move_Backward) || (vel < 0))<<1; loc.extbits |= (BUTTON(gamefunc_Move_Backward) || (vel < 0))<<1;
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFELEFT])
loc.extbits |= (BUTTON(gamefunc_Strafe_Left) || (svel > 0))<<2; loc.extbits |= (BUTTON(gamefunc_Strafe_Left) || (svel > 0))<<2;
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFERIGHT])
loc.extbits |= (BUTTON(gamefunc_Strafe_Right) || (svel < 0))<<3; loc.extbits |= (BUTTON(gamefunc_Strafe_Right) || (svel < 0))<<3;
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNLEFT]) if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNLEFT])
loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4; loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNRIGHT]) if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNRIGHT])
loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5; loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
// used for changing team // used for changing team
loc.extbits |= (g_player[snum].pteam != g_player[snum].ps->team)<<6; loc.extbits |= (g_player[snum].pteam != g_player[snum].ps->team)<<6;
@ -4490,7 +4489,7 @@ void P_ProcessInput(int32_t snum)
p->player_par++; p->player_par++;
VM_OnEvent(EVENT_PROCESSINPUT, p->i, snum, -1); // VM_OnEvent(EVENT_PROCESSINPUT, p->i, snum, -1);
if (p->cheat_phase > 0) sb_snum = 0; if (p->cheat_phase > 0) sb_snum = 0;

View file

@ -1911,7 +1911,6 @@ int32_t G_EnterLevel(int32_t g)
g_restorePalette = 1; g_restorePalette = 1;
Net_WaitForServer();
// mmulti_flushpackets(); // mmulti_flushpackets();
G_FadePalette(0,0,0,0); G_FadePalette(0,0,0,0);
@ -1934,6 +1933,8 @@ int32_t G_EnterLevel(int32_t g)
VM_OnEvent(EVENT_ENTERLEVEL, -1, -1, -1); VM_OnEvent(EVENT_ENTERLEVEL, -1, -1, -1);
OSD_Printf(OSDTEXT_YELLOW "E%dL%d: %s\n",ud.volume_number+1,ud.level_number+1, OSD_Printf(OSDTEXT_YELLOW "E%dL%d: %s\n",ud.volume_number+1,ud.level_number+1,
MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name); MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].name);
Net_WaitForServer();
return 0; return 0;
} }

View file

@ -372,7 +372,6 @@ int32_t G_LoadPlayer(int32_t spot)
ud.m_ffire = ud.ffire; ud.m_ffire = ud.ffire;
if (kdfread(&camsprite,sizeof(camsprite),1,fil) != 1) goto corrupt; if (kdfread(&camsprite,sizeof(camsprite),1,fil) != 1) goto corrupt;
if (kdfread(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt;
if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt; if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt;
if (kdfread(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil) != 1) goto corrupt; if (kdfread(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil) != 1) goto corrupt;
for (i=0; i<MAXPLAYERS; i++) for (i=0; i<MAXPLAYERS; i++)
@ -854,7 +853,6 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&ud.marker,sizeof(ud.marker),1,fil); dfwrite(&ud.marker,sizeof(ud.marker),1,fil);
dfwrite(&ud.ffire,sizeof(ud.ffire),1,fil); dfwrite(&ud.ffire,sizeof(ud.ffire),1,fil);
dfwrite(&camsprite,sizeof(camsprite),1,fil); dfwrite(&camsprite,sizeof(camsprite),1,fil);
dfwrite(&connecthead,sizeof(connecthead),1,fil);
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil); dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
dfwrite(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil); dfwrite(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil);
for (i=0; i<MAXPLAYERS; i++) for (i=0; i<MAXPLAYERS; i++)
@ -1408,7 +1406,6 @@ static const dataspec_t svgm_udnetw[] =
{ 0, &ud.pause_on, sizeof(ud.pause_on), 1 }, { 0, &ud.pause_on, sizeof(ud.pause_on), 1 },
{ DS_NOCHK, &currentboardfilename[0], BMAX_PATH, 1 }, { DS_NOCHK, &currentboardfilename[0], BMAX_PATH, 1 },
{ DS_LOADFN, (void *)&sv_postudload, 0, 1 }, { DS_LOADFN, (void *)&sv_postudload, 0, 1 },
{ 0, &connecthead, sizeof(connecthead), 1 },
{ 0, connectpoint2, sizeof(connectpoint2), 1 }, { 0, connectpoint2, sizeof(connectpoint2), 1 },
{ 0, &randomseed, sizeof(randomseed), 1 }, { 0, &randomseed, sizeof(randomseed), 1 },
{ 0, &g_globalRandom, sizeof(g_globalRandom), 1 }, { 0, &g_globalRandom, sizeof(g_globalRandom), 1 },