From 45052b8273688176fded1905786fe6768dc20e9f Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 19 May 2010 10:02:35 +0000 Subject: [PATCH] minor changes from my tree that I'm committing to test automated synthesis builds git-svn-id: https://svn.eduke32.com/eduke32@1645 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/Makefile.shared | 4 +- polymer/eduke32/build/include/baselayer.h | 2 +- polymer/eduke32/build/src/build.c | 20 ++-- polymer/eduke32/build/src/cache1d.c | 2 +- polymer/eduke32/build/src/engine.c | 68 ++++++++----- polymer/eduke32/build/src/polymer.c | 4 +- polymer/eduke32/build/src/polymost.c | 2 +- polymer/eduke32/build/src/sdlayer.c | 2 +- polymer/eduke32/build/src/winlayer.c | 118 ++++++++++------------ polymer/eduke32/source/actors.c | 78 ++++++++++---- polymer/eduke32/source/astub.c | 20 +++- polymer/eduke32/source/config.c | 2 +- polymer/eduke32/source/duke3d.h | 1 - polymer/eduke32/source/game.c | 54 +++++----- polymer/eduke32/source/gamedef.c | 24 ++--- polymer/eduke32/source/osdcmds.c | 1 + 16 files changed, 228 insertions(+), 174 deletions(-) diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index 26025867f..ad14ca253 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -3,8 +3,8 @@ ENGINELIB=libengine.a EDITORLIB=libbuild.a -SDLCONFIG = /usr/local/bin/sdl-config -# SDLCONFIG = sdl-config +# SDLCONFIG = /usr/local/bin/sdl-config +SDLCONFIG = /usr/bin/sdl-config ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG)) SDLROOT = /usr/local diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index 476909833..9de021f4a 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -98,7 +98,7 @@ void debugprintf(const char *,...); int32_t handleevents(void); extern inline void idle(void); extern inline void idle_waitevent(void); -extern inline void idle_waitevent_timeout(int32_t timeout); +extern inline void idle_waitevent_timeout(uint32_t timeout); typedef void (*KeyPressCallback)(int32_t,int32_t); typedef void (*MousePressCallback)(int32_t,int32_t); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 0bab6720e..873293c30 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -1267,7 +1267,7 @@ void overheadeditor(void) walltype *wal; int32_t prefixarg = 0; hitdata_t hitinfo; - int32_t resetsynctics = 0, lasttick=getticks(); + int32_t resetsynctics = 0, lasttick=getticks(), waitdelay=totalclock, lastdraw=getticks(); int32_t tsign; //qsetmode640480(); @@ -1322,11 +1322,16 @@ void overheadeditor(void) if (!((vel|angvel|svel) //DOWN_BK(MOVEFORWARD) || DOWN_BK(MOVEBACKWARD) || DOWN_BK(TURNLEFT) || DOWN_BK(TURNRIGHT) || DOWN_BK(MOVEUP) || DOWN_BK(MOVEDOWN) || bstatus || OSD_IsMoving())) { - // wait for event, timeout after 200 ms - (last loop time) - idle_waitevent_timeout(200 - min(getticks()-lasttick, 200)); - // have synctics reset to 0 after we've slept to avoid zooming out to the max instantly - resetsynctics = 1; + if (totalclock > waitdelay) + { + // wait for event, timeout after 200 ms - (last loop time) + idle_waitevent_timeout(200 - min(getticks()-lasttick, 200)); + // have synctics reset to 0 after we've slept to avoid zooming out to the max instantly + resetsynctics = 1; + } } + else waitdelay = totalclock + 30; // should be 250 ms + lasttick = getticks(); if (handleevents()) @@ -1429,8 +1434,11 @@ void overheadeditor(void) numwalls = newnumwalls; if (numwalls < 0) numwalls = tempint; - if (DOWN_BK(MOVEUP) || DOWN_BK(MOVEDOWN) || mousx || mousy || bstatus || (totalclock & 8) == 0 || newnumwalls>=0) + if ((getticks() - lastdraw) >= 5 || (vel|angvel|svel) || DOWN_BK(MOVEUP) || DOWN_BK(MOVEDOWN) || mousx || mousy || bstatus || + newnumwalls>=0 || OSD_IsMoving()) { + lastdraw = getticks(); + clear2dscreen(); if (graphicsmode) diff --git a/polymer/eduke32/build/src/cache1d.c b/polymer/eduke32/build/src/cache1d.c index 6e0b8b38c..709003da1 100644 --- a/polymer/eduke32/build/src/cache1d.c +++ b/polymer/eduke32/build/src/cache1d.c @@ -301,7 +301,7 @@ int32_t addsearchpath(const char *p) Bcorrectfilename(srch->path,0); - initprintf("addsearchpath(): Added %s\n", srch->path); + initprintf("Using %s for game data\n", srch->path); return 0; } diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index c3b08457a..f2d07348f 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -5492,21 +5492,45 @@ int32_t preinitengine(void) makeasmwriteable(); - // this shite is to help get around data segment size limits on some platforms - - state_compress = (qlz_state_compress *)Bmalloc(sizeof(qlz_state_compress)); - state_decompress = (qlz_state_decompress *)Bmalloc(sizeof(qlz_state_decompress)); - #ifdef DYNALLOC_ARRAYS - sector = Bcalloc(MAXSECTORS,sizeof(sectortype)); - wall = Bcalloc(MAXWALLS,sizeof(walltype)); - sprite = Bcalloc(MAXSPRITES,sizeof(spritetype)); - tsprite = Bcalloc(MAXSPRITESONSCREEN,sizeof(spritetype)); - spriteext = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spriteext_t)); - spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmooth_t)); + { + size_t i, size = 0; + int8_t *ptr; + + // allocate everything at once... why not? entries can just be added to this table + // to allocate future arrays without further intervention + struct + { + void **ptr; + size_t size; + } + dynarray[] = + { + { (void **)§or, sizeof(sectortype) * MAXSECTORS }, + { (void **)&wall, sizeof(walltype) * MAXWALLS }, + { (void **)&sprite, sizeof(spritetype) * MAXSPRITES }, + { (void **)&tsprite, sizeof(spritetype) * MAXSPRITESONSCREEN }, + { (void **)&spriteext, sizeof(spriteext_t) * (MAXSPRITES+MAXUNIQHUDID) }, + { (void **)&spritesmooth, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID) }, + { (void **)&state_compress, sizeof(qlz_state_compress) }, + { (void **)&state_decompress, sizeof(qlz_state_decompress) } + }; + + for (i=0;i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++) + size += dynarray[i].size; + + if ((ptr = (int8_t *)Bcalloc(1, size)) == NULL) + return 1; + + size = 0; + + for (i=0;i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++) + { + *dynarray[i].ptr = ptr + size; + size += dynarray[i].size; + } + } - if (!sector || !wall || !sprite || !tsprite || !spriteext || !spritesmooth) - return 1; #else sector = sector_s; wall = wall_s; @@ -5514,6 +5538,8 @@ int32_t preinitengine(void) tsprite = tsprite_s; spriteext = spriteext_s; spritesmooth = spritesmooth_s; + state_compress = (qlz_state_compress *) Bmalloc(sizeof(qlz_state_compress) + sizeof(qlz_state_decompress)); + state_decompress = (qlz_state_decompress *) ((int8_t *)(state_compress) + sizeof(qlz_state_compress)); #endif if ((e = Bgetenv("BUILD_NOP6")) != NULL) @@ -5632,7 +5658,6 @@ void uninitengine(void) Bfclose(cacheindexptr); */ #endif - uninitsystem(); if (artfil != -1) kclose(artfil); i=(sizeof(artptrs)/sizeof(intptr_t))-1; @@ -5662,20 +5687,11 @@ void uninitengine(void) #ifdef DYNALLOC_ARRAYS if (sector != NULL) Bfree(sector); - if (wall != NULL) - Bfree(wall); - if (sprite != NULL) - Bfree(sprite); - if (tsprite != NULL) - Bfree(tsprite); - if (spriteext != NULL) - Bfree(spriteext); - if (spritesmooth != NULL) - Bfree(spritesmooth); +#else + if (state_compress) Bfree(state_compress); #endif - if (state_compress) Bfree(state_compress); - if (state_decompress) Bfree(state_decompress); + uninitsystem(); } diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 3af4726da..737436efe 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -775,7 +775,7 @@ void polymer_loadboard(void) polymer_resetlights(); - if (pr_verbosity >= 1) OSD_Printf("PR : Board loaded.\n"); + if (pr_verbosity >= 1 && numsectors) OSD_Printf("PR : Board loaded.\n"); } void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum) @@ -4318,7 +4318,7 @@ static void polymer_compileprogram(int32_t programbits) prprograms[programbits].handle = program; - if (pr_verbosity >= 1) OSD_Printf("PR : Compiling GPU program with bits %i...\n", programbits); + if (pr_verbosity >= 2) OSD_Printf("PR : Compiling GPU program with bits %i...\n", programbits); if (!linkstatus) { OSD_Printf("PR : Failed to compile GPU program with bits %i!\n", programbits); if (pr_verbosity >= 1) OSD_Printf("PR : Compilation log:\n%s\n", infobuffer); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index f236b0433..acabb2b4e 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -105,7 +105,7 @@ static double dxb1[MAXWALLSB], dxb2[MAXWALLSB]; #define LINTERPSIZ 4 //log2 of interpolation size. 4:pretty fast&acceptable quality, 0:best quality/slow! #define DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default -float shadescale = 1.050f; +float shadescale = 1.0f; double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz; double gcosang, gsinang, gcosang2, gsinang2; diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 267c84ea7..973f95c50 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -1896,7 +1896,7 @@ static int32_t SDL_WaitEventTimeout(SDL_Event * event, int32_t timeout) } #endif -inline void idle_waitevent_timeout(int32_t timeout) +inline void idle_waitevent_timeout(uint32_t timeout) { SDL_WaitEventTimeout(NULL, timeout); } diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index ecb998ca1..e24806479 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -98,8 +98,6 @@ static BOOL RegisterWindowClass(void); static BOOL CreateAppWindow(int32_t modenum); static void DestroyAppWindow(void); -static BOOL bDInputInited = FALSE; - // video static int32_t desktopxdim=0,desktopydim=0,desktopbpp=0,modesetusing=-1; int32_t xres=-1, yres=-1, fullscreen=0, bpp=0, bytesperline=0, imageSize=0; @@ -144,6 +142,36 @@ void (*mousepresscallback)(int32_t,int32_t) = 0; void (*joypresscallback)(int32_t,int32_t) = 0; +//------------------------------------------------------------------------------------------------- +// DINPUT (JOYSTICK) +//================================================================================================= + +#define JOYSTICK 0 + +static HMODULE hDInputDLL = NULL; +static LPDIRECTINPUT7A lpDI = NULL; +static LPDIRECTINPUTDEVICE7A lpDID = NULL; +#define INPUT_BUFFER_SIZE 32 +static GUID guidDevs; + +static char di_devacquired; +static HANDLE di_inputevt; +static int32_t joyblast=0; +volatile uint8_t moustat = 0, mousegrab = 0; + +static struct +{ + char *name; + LPDIRECTINPUTDEVICE7A *did; + const DIDATAFORMAT *df; +} devicedef = { "joystick", &lpDID, &c_dfDIJoystick }; + +static struct _joydef +{ + const char *name; + uint32_t ofs; // directinput 'dwOfs' value +} *axisdefs = NULL, *buttondefs = NULL, *hatdefs = NULL; + //------------------------------------------------------------------------------------------------- @@ -542,9 +570,8 @@ static void printsysversion(void) break; } - initprintf("Running under Windows %s (build %lu.%lu.%lu) %s", ver, osv.dwMajorVersion, osv.dwMinorVersion, - osv.dwPlatformId == VER_PLATFORM_WIN32_NT ? osv.dwBuildNumber : osv.dwBuildNumber&0xffff, - osv.szCSDVersion); + initprintf("Windows %s (build %lu.%lu.%lu) %s", ver, + osv.dwMajorVersion, osv.dwMinorVersion, osv.dwBuildNumber, osv.szCSDVersion); #ifdef NEDMALLOC initprintf("\n"); @@ -552,7 +579,7 @@ static void printsysversion(void) if (largepagesavailable) initprintf("Large page support available\n"); #else - if (nedhandle) initprintf("with nedmalloc\n"); + initprintf(nedhandle ? "w/ nedmalloc.dll\n" : "\n"); #endif } @@ -691,7 +718,7 @@ int32_t handleevents(void) RI_PollDevices(TRUE); - if (bDInputInited) + if (hDInputDLL) DI_PollJoysticks(); while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) @@ -721,36 +748,6 @@ int32_t handleevents(void) return rv; } -//------------------------------------------------------------------------------------------------- -// DINPUT (JOYSTICK) -//================================================================================================= - -#define JOYSTICK 0 - -static HMODULE hDInputDLL = NULL; -static LPDIRECTINPUT7A lpDI = NULL; -static LPDIRECTINPUTDEVICE7A lpDID = NULL; -#define INPUT_BUFFER_SIZE 32 -static GUID guidDevs; - -static char di_devacquired; -static HANDLE di_inputevt; -static int32_t joyblast=0; -volatile uint8_t moustat = 0, mousegrab = 0; - -static struct -{ - char *name; - LPDIRECTINPUTDEVICE7A *did; - const DIDATAFORMAT *df; -} devicedef = { "joystick", &lpDID, &c_dfDIJoystick }; - -static struct _joydef -{ - const char *name; - uint32_t ofs; // directinput 'dwOfs' value -} *axisdefs = NULL, *buttondefs = NULL, *hatdefs = NULL; - // I don't see any pressing need to store the key-up events yet inline void SetKey(int32_t key, int32_t state) @@ -842,9 +839,10 @@ void setkeypresscallback(void (*callback)(int32_t, int32_t)) { keypresscallback void setmousepresscallback(void (*callback)(int32_t, int32_t)) { mousepresscallback = callback; } void setjoypresscallback(void (*callback)(int32_t, int32_t)) { joypresscallback = callback; } -inline void idle_waitevent(void) +inline void idle_waitevent_timeout(uint32_t timeout) { - int32_t i = 10; + // timeout becomes a completion deadline + timeout += getticks(); do { @@ -858,12 +856,12 @@ inline void idle_waitevent(void) Sleep(10); } - while (--i); + while (timeout > (getticks() + 10)); } -inline void idle_waitevent_timeout(int32_t timeout) +inline void idle_waitevent(void) { - idle_waitevent(); + idle_waitevent_timeout(100); } inline void idle(void) @@ -1077,7 +1075,7 @@ static BOOL InitDirectInput(void) LPDIRECTINPUTDEVICE7A dev2; DIDEVCAPS didc; - if (bDInputInited) return FALSE; + if (hDInputDLL) return FALSE; initprintf("Initializing DirectInput...\n"); @@ -1108,7 +1106,6 @@ static BOOL InitDirectInput(void) if (inputdevices == (1|2)) { initprintf(" - No game controllers found\n"); - bDInputInited = TRUE; UninitDirectInput(); return TRUE; } @@ -1186,7 +1183,6 @@ static BOOL InitDirectInput(void) di_devacquired = 0; - bDInputInited = TRUE; return FALSE; } @@ -1198,7 +1194,7 @@ static void UninitDirectInput(void) { int32_t i; - if (bDInputInited) initprintf("Uninitializing DirectInput...\n"); + if (hDInputDLL) initprintf("Uninitializing DirectInput...\n"); AcquireInputDevices(0); @@ -1240,8 +1236,6 @@ static void UninitDirectInput(void) FreeLibrary(hDInputDLL); hDInputDLL = NULL; } - - bDInputInited = FALSE; } @@ -1291,7 +1285,7 @@ static void AcquireInputDevices(char acquire) DWORD flags; HRESULT result; - if (!bDInputInited) return; + if (!hDInputDLL) return; if (!hWindow) return; if (acquire) @@ -1616,11 +1610,6 @@ int32_t gettimerfreq(void) // VIDEO //================================================================================================= -// DWM stuff -static HMODULE hDWMApiDLL = NULL; -static BOOL bDWMApiInited = FALSE; -HRESULT(WINAPI *aDwmEnableComposition)(UINT); - // DirectDraw objects static HMODULE hDDrawDLL = NULL; static LPDIRECTDRAW lpDD = NULL; @@ -1643,23 +1632,17 @@ static int32_t getgammaramp(WORD gt[3][256]); static void ToggleDesktopComposition(BOOL compEnable) { - if (!bDWMApiInited) - { - hDWMApiDLL = LoadLibrary("DWMAPI.DLL"); - if (hDWMApiDLL) - { - aDwmEnableComposition = (void *)GetProcAddress(hDWMApiDLL, "DwmEnableComposition"); - } - bDWMApiInited = TRUE; - } + static HMODULE hDWMApiDLL = NULL; + static HRESULT(WINAPI *aDwmEnableComposition)(UINT); + + if (!hDWMApiDLL && (hDWMApiDLL = LoadLibrary("DWMAPI.DLL"))) + aDwmEnableComposition = (void *)GetProcAddress(hDWMApiDLL, "DwmEnableComposition"); if (aDwmEnableComposition) { aDwmEnableComposition(compEnable); if (!silentvideomodeswitch) - { - initprintf("%s desktop composition.\n", (compEnable) ? "Enabling" : "Disabling"); - } + initprintf("%sabling desktop composition...\n", (compEnable) ? "En" : "Dis"); } } @@ -1760,7 +1743,8 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) gammabrightness = 0; } - ToggleDesktopComposition(c < 16); + if (osv.dwMajorVersion >= 6) + ToggleDesktopComposition(c < 16); if (!silentvideomodeswitch) initprintf("Setting video mode %dx%d (%d-bit %s)\n", diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 046a41647..648ea6686 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -8002,7 +8002,8 @@ void G_MoveWorld(void) { int32_t x, y; - if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) + if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || + !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) { if (actor[i].lightptr != NULL) { @@ -8029,11 +8030,13 @@ void G_MoveWorld(void) switch (DynamicTileMap[sprite[i].picnum]) { case ATOMICHEALTH__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2 * 3, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); break; case FIRE__STATIC: case FIRE2__STATIC: + case BURNING__STATIC: + case BURNING2__STATIC: /* if (Actor[i].floorz - Actor[i].ceilingz < 128) break; if (s->z > Actor[i].floorz+2048) break; @@ -8041,18 +8044,9 @@ void G_MoveWorld(void) G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); break; - case BURNING__STATIC: - case BURNING2__STATIC: - /* - if (Actor[i].floorz - Actor[i].ceilingz < 128) break; - if (s->z > Actor[i].floorz + 2048) break; - */ - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); - break; - case OOZFILTER__STATIC: if (s->xrepeat > 4) - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 6144, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); break; case FLOORFLAME__STATIC: case FIREBARREL__STATIC: @@ -8062,25 +8056,58 @@ void G_MoveWorld(void) case EXPLOSION2__STATIC: if (!actor[i].lightcount) + { + int32_t x = ((sintable[(s->ang+512)&2047])>>6); + int32_t y = ((sintable[(s->ang)&2047])>>6); + + s->x -= x; + s->y -= y; + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8), s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME); + + s->x += x; + s->y += y; + } break; case FORCERIPPLE__STATIC: - // case TRANSPORTERSTAR__STATIC: case TRANSPORTERBEAM__STATIC: G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME); break; + case GROWSPARK__STATIC: + { + int32_t x = ((sintable[(s->ang+512)&2047])>>6); + int32_t y = ((sintable[(s->ang)&2047])>>6); + + s->x -= x; + s->y -= y; + + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); + + s->x += x; + s->y += y; + } + break; case SHRINKEREXPLOSION__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); + { + int32_t x = ((sintable[(s->ang+512)&2047])>>6); + int32_t y = ((sintable[(s->ang)&2047])>>6); + + s->x -= x; + s->y -= y; + + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); + + s->x += x; + s->y += y; + } break; case FREEZEBLAST__STATIC: G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); break; - case COOLEXPLOSION1__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<3, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); break; - case SHRINKSPARK__STATIC: G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); break; @@ -8088,9 +8115,22 @@ void G_MoveWorld(void) G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); break; case RPG__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 128 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); break; + case SHOTSPARK1__STATIC: + { + int32_t x = ((sintable[(s->ang+512)&2047])>>7); + int32_t y = ((sintable[(s->ang)&2047])>>7); + s->x -= x; + s->y -= y; + + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 16 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); + + s->x += x; + s->y += y; + } + break; case DIPSWITCH__STATIC: case DIPSWITCH2__STATIC: case DIPSWITCH3__STATIC: @@ -8126,7 +8166,7 @@ void G_MoveWorld(void) s->x += x; s->y += y; - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 768, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW); s->x -= x; s->y -= y; } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 37500dedb..63b81baa6 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -6382,18 +6382,30 @@ static void Keys2d(void) else if (!(keystatus[KEYSC_F5]|keystatus[KEYSC_F6]|keystatus[KEYSC_F7]|keystatus[KEYSC_F8])) { static int32_t counter = 0; + static int32_t omx = 0, omy = 0; +/* static int32_t opointhighlight, olinehighlight, ocursectornum; if (pointhighlight == opointhighlight && linehighlight == olinehighlight && cursectornum == ocursectornum) - counter++; - else - counter = 0; +*/ + if (omx == mousxplc && omy == mousyplc) + { + if (counter < 6) + counter++; + } + else if (counter > 0) + counter--; + + omx = mousxplc; + omy = mousyplc; +/* opointhighlight = pointhighlight; olinehighlight = linehighlight; ocursectornum = cursectornum; +*/ - if (counter >= 40 && totalclock >= 120*6) + if (counter >= 2 && totalclock >= 120*6) { if (pointhighlight >= 16384) { diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 6f0c444ec..b7ca78c15 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -216,7 +216,7 @@ void CONFIG_SetDefaults(void) ud.config.NumChannels = 2; ud.config.NumVoices = 32; ud.config.ReverseStereo = 0; - ud.config.RunMode = ud.auto_run = 1; + ud.auto_run = 1; ud.config.ShowOpponentWeapons = 0; ud.config.SmoothInput = 1; ud.config.SoundToggle = 1; diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 54706de2b..24373dfc0 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -342,7 +342,6 @@ typedef struct { struct { int32_t UseJoystick; int32_t UseMouse; - int32_t RunMode; int32_t AutoAim; int32_t ShowOpponentWeapons; int32_t MouseDeadZone,MouseBias; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3b6043f1a..75804e7ee 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1004,7 +1004,7 @@ void Net_ParseServerPacket(ENetEvent * event) if (i == myconnectindex && !g_player[i].ps->dead_flag) { - j += (sizeof(input_t) - sizeof(loc.filler)) + + j += offsetof(input_t, filler) + (sizeof(vec3_t) * 3) + // position and velocity (sizeof(int16_t) * 3); // ang and horiz goto process; @@ -1014,7 +1014,7 @@ void Net_ParseServerPacket(ENetEvent * event) Bmemcpy(&nsyn[i], &packbuf[j], sizeof(input_t)); - j += sizeof(input_t)-sizeof(loc.filler); + j += offsetof(input_t, filler); if (TEST_SYNC_KEY(nsyn[i].bits,SK_GAMEQUIT)) g_player[i].playerquitflag = 0; g_player[i].movefifoend++; @@ -1206,7 +1206,8 @@ process: if (var_id == MAXGAMEVARS) break; - aGameVars[var_id].val.plValues[i] = *(int32_t *)&packbuf[j]; + if (aGameVars[var_id].val.plValues) + aGameVars[var_id].val.plValues[i] = *(int32_t *)&packbuf[j]; j += sizeof(int32_t); } while (1); @@ -1503,7 +1504,7 @@ void Net_ParseClientPacket(ENetEvent * event) Bmemcpy(&nsyn[other], &packbuf[j], sizeof(input_t)); - j += sizeof(input_t)-sizeof(loc.filler); + j += offsetof(input_t, filler); g_player[other].movefifoend++; @@ -1957,13 +1958,13 @@ void Net_UpdateClients(void) { if (g_player[i].playerquitflag == 0) continue; - Bmemcpy(&osyn[i], &nsyn[i], sizeof(input_t)); + Bmemcpy(&osyn[i], &nsyn[i], offsetof(input_t, filler)); *(int16_t *)&packbuf[j] = g_player[i].ps->dead_flag; j += sizeof(int16_t); - Bmemcpy(&packbuf[j], &nsyn[i], sizeof(input_t)-sizeof(loc.filler)); - j += sizeof(input_t)-sizeof(loc.filler); + Bmemcpy(&packbuf[j], &nsyn[i], offsetof(input_t, filler)); + j += offsetof(input_t, filler); Bmemcpy(&packbuf[j], &g_player[i].ps->pos.x, sizeof(vec3_t) * 2); j += sizeof(vec3_t) * 2; @@ -2041,11 +2042,11 @@ void Net_UpdateClients(void) if (packbuf[jj] & 2) T5 += (intptr_t)&script[0]; } - i = l; + /*i = l;*/ { int16_t ii=g_gameVarCount-1, kk = 0; - for (; ii>=0; ii--) + for (; ii>=0 && kk <= 64; ii--) { if ((aGameVars[ii].dwFlags & (GAMEVAR_PERACTOR|GAMEVAR_NOMULTI)) == GAMEVAR_PERACTOR && aGameVars[ii].val.plValues) { @@ -2060,7 +2061,6 @@ void Net_UpdateClients(void) kk++; } } - if (kk > 64) break; } *(int16_t *)&packbuf[j] = MAXGAMEVARS; j += sizeof(int16_t); @@ -2070,7 +2070,7 @@ void Net_UpdateClients(void) { int16_t ii=g_gameVarCount-1, kk = 0; - for (; ii>=0; ii--) + for (; ii>=0 && kk <= 64; ii--) { if ((aGameVars[ii].dwFlags & (GAMEVAR_PERPLAYER|GAMEVAR_NOMULTI)) == GAMEVAR_PERPLAYER && aGameVars[ii].val.plValues) { @@ -2085,7 +2085,6 @@ void Net_UpdateClients(void) kk++; } } - if (kk > 64) break; } *(int16_t *)&packbuf[j] = MAXGAMEVARS; j += sizeof(int16_t); @@ -2099,17 +2098,17 @@ void Net_UpdateClients(void) packbuf[(zj = j++)] = 0; - for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])); zz++) + for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])) && k <= 8; zz++) TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti) { - if (totalclock > (lastupdate[i] + TICRATE)) + // only send STAT_MISC sprites at spawn time and let the client handle it from there + if (totalclock > (lastupdate[i] + TICRATE) && (!lastupdate[i] || sprite[i].statnum != STAT_MISC)) { l = crc32once((uint8_t *)&sprite[i], sizeof(spritetype)); - // only send STAT_MISC sprites at spawn time and let the client handle it from there - if (!lastupdate[i] || (spritecrc[i] != l && sprite[i].statnum != STAT_MISC)) + if (!lastupdate[i] || spritecrc[i] != l) { - int32_t jj = 0; + int32_t jj; /*initprintf("updating sprite %d (%d)\n",i,sprite[i].picnum);*/ spritecrc[i] = l; @@ -2126,16 +2125,19 @@ void Net_UpdateClients(void) packbuf[jj] |= 1; T2 -= (intptr_t)&script[0]; } + if (T5 >= (intptr_t)&script[0] && T5 < (intptr_t)(&script[g_scriptSize])) { packbuf[jj] |= 2; T5 -= (intptr_t)&script[0]; } + if (T6 >= (intptr_t)&script[0] && T6 < (intptr_t)(&script[g_scriptSize])) { packbuf[jj] |= 4; T6 -= (intptr_t)&script[0]; } + Bmemcpy(&packbuf[j], &actor[i], sizeof(NetActorData_t)); j += sizeof(NetActorData_t); @@ -2146,7 +2148,7 @@ void Net_UpdateClients(void) { int16_t ii=g_gameVarCount-1, kk = 0; - for (; ii>=0; ii--) + for (; ii>=0 && kk <= 64; ii--) { if ((aGameVars[ii].dwFlags & GAMEVAR_PERACTOR) && aGameVars[ii].val.plValues) { @@ -2161,7 +2163,6 @@ void Net_UpdateClients(void) kk++; } } - if (kk > 64) break; } *(int16_t *)&packbuf[j] = MAXGAMEVARS; j += sizeof(int16_t); @@ -2170,14 +2171,13 @@ void Net_UpdateClients(void) k++; } } - if (k > 8) break; } + packbuf[zj] = k; k = 0; - packbuf[(zj = j++)] = 0; - for (i = numsectors-1; i >= 0; i--) + for (i = numsectors-1; i >= 0 && k <= 6; i--) { if (totalclock > (lastsectupdate[i] + TICRATE)) { @@ -2194,13 +2194,12 @@ void Net_UpdateClients(void) k++; } } - if (k > 6) break; } packbuf[zj] = k; k = 0; packbuf[(zj = j++)] = 0; - for (i = numwalls-1; i >= 0; i--) + for (i = numwalls-1; i >= 0 && k <= 6; i--) { if (totalclock > (lastwallupdate[i] + TICRATE)) { @@ -2217,7 +2216,6 @@ void Net_UpdateClients(void) k++; } } - if (k > 6) break; } packbuf[zj] = k; @@ -9445,7 +9443,6 @@ FAKE_F3: { CONTROL_ClearButton(gamefunc_AutoRun); ud.auto_run = 1-ud.auto_run; - ud.config.RunMode = ud.auto_run; P_DoQuote(85+ud.auto_run,g_player[myconnectindex].ps); } @@ -11779,7 +11776,6 @@ MAIN_LOOP_RESTART: } else G_UpdateScreenArea(); - ud.auto_run = ud.config.RunMode; ud.showweapons = ud.config.ShowOpponentWeapons; g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; g_player[myconnectindex].ps->auto_aim = ud.config.AutoAim; @@ -12725,8 +12721,8 @@ GAME_STATIC int32_t G_DoMoveThings(void) packbuf[0] = PACKET_SLAVE_TO_MASTER; j = 1; - Bmemcpy(&packbuf[j], &nsyn[0], sizeof(input_t) - sizeof(loc.filler)); - j += sizeof(input_t) - sizeof(loc.filler); + Bmemcpy(&packbuf[j], &nsyn[0], offsetof(input_t, filler)); + j += offsetof(input_t, filler); Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->pos.x, sizeof(vec3_t) * 2); j += sizeof(vec3_t) * 2; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 638deb8b4..0b3c0230f 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -6155,7 +6155,7 @@ void C_Compile(const char *filenam) } else { - int32_t j=0, k=0; + int32_t j=0, k=0, l=0; hash_free(&h_keywords); freehashnames(); @@ -6174,12 +6174,9 @@ void C_Compile(const char *filenam) C_SetScriptSize(g_scriptPtr-script+8); - initprintf("Script compiled in %dms\n", getticks() - startcompiletime); + initprintf("Script compiled in %dms, %ld*%db, version %s\n", getticks() - startcompiletime, + (unsigned)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); - initprintf("Compiled code size: %ld*%d bytes, version %s\n", - (unsigned)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); - - initprintf("Pointer bitmap size: %ld bytes\n",(g_scriptSize+7)>>3); initprintf("%ld/%ld labels, %d/%d variables\n", g_numLabels, min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)), MAXSPRITES * sizeof(spritetype)/(1<<6)), @@ -6188,18 +6185,19 @@ void C_Compile(const char *filenam) for (i=MAXQUOTES-1; i>=0; i--) if (ScriptQuotes[i]) j++; - - initprintf("%ld/%d quotes, %d quote redefinitions\n",j,MAXQUOTES,g_numQuoteRedefinitions); - - j = 0; for (i=MAXGAMEEVENTS-1; i>=0; i--) if (apScriptGameEvent[i]) - j++; + k++; for (i=MAXTILES-1; i>=0; i--) if (actorscrptr[i]) - k++; + l++; - initprintf("%ld/%d event definitions, %ld defined actors\n",j,MAXEVENTS,k); + if (j) initprintf("%ld quotes, ", j); + if (g_numQuoteRedefinitions) initprintf("%d strings, ", g_numQuoteRedefinitions); + if (k) initprintf("%ld events, ", k); + if (l) initprintf("%ld actors", l); + + initprintf("\n"); for (i=127; i>=0; i--) if (ScriptQuotes[i] == NULL) diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index cb30ce419..43b10eb2f 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1373,6 +1373,7 @@ int32_t registerosdcommands(void) { "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 2 }, { "cl_automsg", "cl_automsg: enable/disable automatically sending messages to all players", (void*)&ud.automsg, CVAR_BOOL, 0, 1 }, + { "cl_autorun", "cl_autorun", (void*)&ud.auto_run, CVAR_BOOL, 0, 1 }, { "cl_autovote", "cl_autovote: enable/disable automatic voting", (void*)&ud.autovote, CVAR_INT, 0, 2 }, { "cl_obituaries", "cl_obituaries: enable/disable multiplayer death messages", (void*)&ud.obituaries, CVAR_BOOL, 0, 1 },