From ec71eebecb3fa1ae74f6520d915c45ff703abec4 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 12 Apr 2009 21:52:49 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1312 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile.msvc | 10 +- polymer/eduke32/build/Makefile.msvc | 32 ++-- polymer/eduke32/build/include/polymer.h | 12 +- polymer/eduke32/build/src/baselayer.c | 2 +- polymer/eduke32/build/src/engine.c | 11 +- polymer/eduke32/build/src/polymer.c | 65 ++++---- polymer/eduke32/source/actors.c | 191 +++++++++++++++++++++- polymer/eduke32/source/anim.c | 2 +- polymer/eduke32/source/duke3d.h | 2 +- polymer/eduke32/source/game.c | 18 +- polymer/eduke32/source/global.c | 2 +- polymer/eduke32/source/jaudiolib/mpu401.c | 11 +- polymer/eduke32/source/player.c | 42 +++++ polymer/eduke32/source/sounds.c | 21 ++- polymer/eduke32/source/sync.c | 1 + 15 files changed, 329 insertions(+), 93 deletions(-) diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 0a007e53b..07383aee1 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -23,7 +23,7 @@ flags_link=/RELEASE !endif -DXROOT=c:\sdks\dx6 +DXROOT="U:\SDKs\Microsoft DirectX SDK (April 2007) MSSDKROOT="N:\Program Files\Microsoft Visual Studio 9.0\VC PLATFORMSDK="N:\Program Files\Microsoft Visual Studio 9.0\VC\PlatformSDK @@ -36,7 +36,7 @@ MT=mt CFLAGS= /MD /J /nologo $(flags_cl) \ /I$(INC) /I$(EINC)\ /I$(SRC)\jmact /I$(SRC)\jaudiolib /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \ /DNOCOPYPROTECT /D "_CRT_SECURE_NO_DEPRECATE" -W2 $(ENGINEOPTS) \ - /I$(DXROOT)\include /DRENDERTYPEWIN=1 + /I$(DXROOT)\include" /DRENDERTYPEWIN=1 LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \ /NODEFAULTLIB:libFLAC.lib /NODEFAULTLIB:glu32.lib /NODEFAULTLIB:LIBCMT.lib /NODEFAULTLIB:LIBCMTD.lib @@ -146,15 +146,15 @@ EDITOROBJS=$(OBJ)\astub.$o \ all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) # duke3d_w32$(EXESUFFIX); eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)\$(ENGINELIB) - $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest $(RSRC)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)\$(ENGINELIB) $(EOBJ)\$(EDITORLIB) - $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest $(RSRC)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest duke3d_w32$(EXESUFFIX): $(OBJ)/wrapper.$o - $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest -outputresource:$@ !include Makefile.deps diff --git a/polymer/eduke32/build/Makefile.msvc b/polymer/eduke32/build/Makefile.msvc index b9fa4af98..a2b366b47 100644 --- a/polymer/eduke32/build/Makefile.msvc +++ b/polymer/eduke32/build/Makefile.msvc @@ -19,15 +19,15 @@ asm=masm ENGINELIB=engine.lib EDITORLIB=build.lib -DXROOT=c:\sdks\dx6 -MSSDKROOT="C:\Program Files\Microsoft Visual Studio 8\VC -PLATFORMSDK="C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK +DXROOT="U:\SDKs\Microsoft DirectX SDK (April 2007) +MSSDKROOT="N:\Program Files\Microsoft Visual Studio 9.0\VC +PLATFORMSDK="N:\Program Files\Microsoft Visual Studio 9.0\VC\PlatformSDK # ENETROOT=$(SRC)\enet # /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 !ifdef NOASM -TARGETOPTS=/DNOASM +TARGETOPTS=/DNOASM !endif !ifdef DEBUG @@ -45,18 +45,18 @@ CC=cl AS=ml RC=rc LINK=link /opt:nowin98 /opt:ref /nologo -CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" # /I$(ENETROOT)\include" +CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include" /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" # /I$(ENETROOT)\include" ASFLAGS=/nologo /coff /c EXESUFFIX=.exe !ifdef DEBUG CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS !endif -ENGINEOBJS= \ -!ifdef NOASM - $(OBJ)\a-c.$o \ -!else - $(OBJ)\a.$o \ +ENGINEOBJS= \ +!ifdef NOASM + $(OBJ)\a-c.$o \ +!else + $(OBJ)\a.$o \ !endif $(OBJ)\baselayer.$o \ $(OBJ)\cache1d.$o \ @@ -127,23 +127,23 @@ $(OBJ)\$(EDITORLIB): $(EDITOROBJS) # the tools kextract$(EXESUFFIX): $(OBJ)\kextract.$o $(OBJ)\compat.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest -outputresource:$@ kgroup$(EXESUFFIX): $(OBJ)\kgroup.$o $(OBJ)\compat.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest -outputresource:$@ transpal$(EXESUFFIX): $(OBJ)\transpal.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest -outputresource:$@ wad2map$(EXESUFFIX): $(OBJ)\wad2map.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest -outputresource:$@ wad2art$(EXESUFFIX): $(OBJ)\wad2art.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib + $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE /LIBPATH:$(DXROOT)\lib\x86" /LIBPATH:$(PLATFORMSDK)\lib" /LIBPATH:$(MSSDKROOT)\lib" $(flags_link) /MAP $** $(LIBS) msvcrt.lib $(MT) -manifest $@.manifest -outputresource:$@ # DEPENDENCIES diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index c6db80fcb..daaf58159 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -279,7 +279,7 @@ void polymer_setanimatesprites(animatespritesptr animatesprites, // CORE static void polymer_displayrooms(int16_t sectnum); static void polymer_drawplane(_prplane* plane); -static void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane); +static inline void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane); static void polymer_animatesprites(void); // SECTORS static int32_t polymer_initsector(int16_t sectnum); @@ -295,12 +295,12 @@ static void polymer_updatewall(int16_t wallnum); static void polymer_drawwall(int16_t sectnum, int16_t wallnum); // HSR static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, int32_t indicecount, GLfloat* plane, GLfloat* t, GLfloat* b, GLfloat* n); -static void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out); -static void polymer_transformpoint(float* inpos, float* pos, float* matrix); -static void polymer_pokesector(int16_t sectnum); +static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out); +static inline void polymer_transformpoint(float* inpos, float* pos, float* matrix); +static inline void polymer_pokesector(int16_t sectnum); static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projection, float* frustum); static int32_t polymer_planeinfrustum(_prplane *plane, float* frustum); -static void polymer_scansprites(int16_t sectnum, spritetype* tsprite, int32_t* spritesortcnt); +static inline void polymer_scansprites(int16_t sectnum, spritetype* tsprite, int32_t* spritesortcnt); // SKIES static void polymer_getsky(void); static void polymer_drawsky(int16_t tilenum); @@ -321,7 +321,7 @@ static void polymer_compileprogram(int32_t programbits); static void polymer_resetlights(void); static void polymer_addlight(_prlight light); static int32_t polymer_planeinlight(_prplane* plane, _prlight* light); -static void polymer_culllight(char lightindex); +static inline void polymer_culllight(char lightindex); static void polymer_prepareshadows(void); static void polymer_applylights(void); // RENDER TARGETS diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index 943d545b8..07f47b017 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -237,7 +237,7 @@ int32_t baselayer_init(void) " 2 - Polygonal textured software\n" #ifdef USE_OPENGL " 3 - Polygonal OpenGL\n" -// " 4 - great justice renderer\n" + " 4 - Great justice renderer\n" #endif , osdfunc_setrendermode); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index e607ed0c2..0c235bf84 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -5733,8 +5733,8 @@ void uninitengine(void) Bfree(tsprite); if (spriteext != NULL) Bfree(spriteext); - if (spritesmooth != NULL) - Bfree(spritesmooth); +// if (spritesmooth != NULL) +// Bfree(spritesmooth); #endif } @@ -6824,8 +6824,8 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo kclose(fil); #if defined(POLYMOST) && defined(USE_OPENGL) - memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); - memset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID)); + Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); + Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID)); # ifdef POLYMER if (rendmode == 4) @@ -7827,10 +7827,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da } # ifdef POLYMER if (rendmode == 4) - { polymer_init(); -// polymer_glinit(); - } #endif #endif qsetmode = 200; diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 7d2473f26..500484dd2 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -37,7 +37,7 @@ _prwall *prwalls[MAXWALLS]; _prplane spriteplane; _prmaterial mdspritematerial; -GLfloat vertsprite[4 * 5] = +static GLfloat vertsprite[4 * 5] = { -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, @@ -49,7 +49,7 @@ GLfloat vertsprite[4 * 5] = 0.0f, 0.0f, }; -GLfloat horizsprite[4 * 5] = +static GLfloat horizsprite[4 * 5] = { -0.5f, 0.0f, -0.5f, 0.0f, 1.0f, @@ -61,7 +61,7 @@ GLfloat horizsprite[4 * 5] = 0.0f, 0.0f, }; -GLfloat skyboxdata[4 * 5 * 6] = +static GLfloat skyboxdata[4 * 5 * 6] = { // -ZY -0.5f, -0.5f, 0.5f, @@ -142,7 +142,7 @@ int32_t gamelightcount; _prlight framelights[PR_MAXLIGHTS]; int32_t framelightcount; -GLfloat shadowBias[] = +static GLfloat shadowBias[] = { 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, @@ -552,24 +552,13 @@ int32_t polymer_init(void) if (pr_verbosity >= 1) OSD_Printf("Initalizing Polymer subsystem...\n"); - i = 0; - while (i < MAXSECTORS) - { - prsectors[i] = NULL; - i++; - } - - i = 0; - while (i < MAXWALLS) - { - prwalls[i] = NULL; - i++; - } + Bmemset(&prsectors[0], sizeof(prsectors[0]) * MAXSECTORS, 0); + Bmemset(&prwalls[0], sizeof(prwalls[0]) * MAXWALLS, 0); prtess = bgluNewTess(); if (prtess == 0) { - if (pr_verbosity >= 1) OSD_Printf("PR : Tesselator initialization failed.\n"); + OSD_Printf("PR : Tesselator initialization failed.\n"); return (0); } @@ -892,19 +881,19 @@ void polymer_drawsprite(int32_t snum) } if (((tspr->cstat>>4) & 3) == 0) - xratio = (float)(tspr->xrepeat) * 32.0f / 160.0f; + xratio = (float)(tspr->xrepeat) * 0.20f; else - xratio = (float)(tspr->xrepeat) / 4.0f; + xratio = (float)(tspr->xrepeat) * 0.25f; - yratio = (float)(tspr->yrepeat) / 4.0f; + yratio = (float)(tspr->yrepeat) * 0.25f; + + xsize = tilesizx[curpicnum]; + ysize = tilesizy[curpicnum]; if (usehightile && h_xsize[curpicnum]) { xsize = h_xsize[curpicnum]; ysize = h_ysize[curpicnum]; - } else { - xsize = tilesizx[curpicnum]; - ysize = tilesizy[curpicnum]; } xsize *= xratio; @@ -1035,6 +1024,13 @@ void polymer_setanimatesprites(animatespritesptr animatesprites, asi.smoothratio = smoothratio; } +static int16_t sectorqueue[MAXSECTORS]; +static int16_t querydelay[MAXSECTORS]; +static GLuint queryid[MAXWALLS]; +static int16_t drawingstate[MAXSECTORS]; +static spritetype localtsprite[MAXSPRITESONSCREEN]; +static int16_t localmaskwall[MAXWALLSB]; + // CORE static void polymer_displayrooms(int16_t dacursectnum) { @@ -1044,16 +1040,11 @@ static void polymer_displayrooms(int16_t dacursectnum) int16_t doquery; int32_t front; int32_t back; - int16_t sectorqueue[MAXSECTORS]; - int16_t querydelay[MAXSECTORS]; - GLuint queryid[MAXWALLS]; - int16_t drawingstate[MAXSECTORS]; GLfloat localmodelviewmatrix[16]; GLfloat localprojectionmatrix[16]; float frustum[5 * 4]; int32_t localspritesortcnt; - spritetype localtsprite[MAXSPRITESONSCREEN]; - int16_t localmaskwall[MAXWALLSB], localmaskwallcnt; + int16_t localmaskwallcnt; _prmirror mirrorlist[10]; int mirrorcount; int32_t gx, gy, gz, px, py, pz; @@ -1423,7 +1414,7 @@ static void polymer_drawplane(_prplane* plane) plane->drawn = 1; } -static void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane) +static inline void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane) { float pv; float reflectionmatrix[16]; @@ -2406,7 +2397,7 @@ static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, in norm = plane[0] * plane[0] + plane[1] * plane[1] + plane[2] * plane[2]; - if (norm >= 15000) // hack to work around a precision issue with slopes + if (norm >= 5000) // hack to work around a precision issue with slopes { // normalize the normal/plane equation and calculate its plane norm norm = -sqrt(norm); @@ -2476,14 +2467,14 @@ static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, in while (i < indicecount); } -static void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out) +static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out) { out[0] = in_a[1] * in_b[2] - in_a[2] * in_b[1]; out[1] = in_a[2] * in_b[0] - in_a[0] * in_b[2]; out[2] = in_a[0] * in_b[1] - in_a[1] * in_b[0]; } -static void polymer_transformpoint(float* inpos, float* pos, float* matrix) +static inline void polymer_transformpoint(float* inpos, float* pos, float* matrix) { pos[0] = inpos[0] * matrix[0] + inpos[1] * matrix[4] + @@ -2499,7 +2490,7 @@ static void polymer_transformpoint(float* inpos, float* pos, float* matr + matrix[14]; } -static void polymer_pokesector(int16_t sectnum) +static inline void polymer_pokesector(int16_t sectnum) { sectortype *sec; _prsector *s; @@ -2580,7 +2571,7 @@ static int32_t polymer_planeinfrustum(_prplane *plane, float* frustum) return (1); } -static void polymer_scansprites(int16_t sectnum, spritetype* localtsprite, int32_t* localspritesortcnt) +static inline void polymer_scansprites(int16_t sectnum, spritetype* localtsprite, int32_t* localspritesortcnt) { int32_t i; spritetype *spr; @@ -3803,7 +3794,7 @@ static int32_t polymer_planeinlight(_prplane* plane, _prlight* light) return 1; } -static void polymer_culllight(char lightindex) +static inline void polymer_culllight(char lightindex) { _prlight* light; int32_t front; diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 98acfe844..5f6b05234 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2680,8 +2680,88 @@ static void G_MoveWeapons(void) switch (DynamicTileMap[s->picnum]) { + case FREEZEBLAST__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = 2048; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 128; + gamelights[gamelightcount].color[1] = 128; + gamelights[gamelightcount].color[2] = 255; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + + case COOLEXPLOSION1__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = 3072; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 128; + gamelights[gamelightcount].color[1] = 0; + gamelights[gamelightcount].color[2] = 255; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + + case SHRINKSPARK__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 128; + gamelights[gamelightcount].color[1] = 255; + gamelights[gamelightcount].color[2] = 128; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + case RPG__STATIC: - if (ActorExtra[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) + case FIRELASER__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 255; + gamelights[gamelightcount].color[1] = 80; + gamelights[gamelightcount].color[2] = 0; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + + if (DynamicTileMap[s->picnum] == RPG__STATIC && ActorExtra[i].picnum != BOSS2 && + s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { j = A_Spawn(i,SMALLSMOKE); sprite[j].z += (1<<8); @@ -3323,6 +3403,47 @@ static void G_MoveActors(void) } switch (DynamicTileMap[switchpicnum]) { + case ATOMICHEALTH__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = 2048; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 128; + gamelights[gamelightcount].color[1] = 128; + gamelights[gamelightcount].color[2] = 255; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + + case FIRE__STATIC: + case FIRE2__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 255; + gamelights[gamelightcount].color[1] = 80; + gamelights[gamelightcount].color[2] = 0; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + case DUCK__STATIC: case TARGET__STATIC: if (s->cstat&32) @@ -5063,11 +5184,77 @@ static void G_MoveMisc(void) // STATNUM 5 case FORCERIPPLE__STATIC: case TRANSPORTERSTAR__STATIC: case TRANSPORTERBEAM__STATIC: + { + switch (DynamicTileMap[switchpicnum]) + { + case BURNING__STATIC: + case BURNING2__STATIC: + case EXPLOSION2__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 255; + gamelights[gamelightcount].color[1] = 80; + gamelights[gamelightcount].color[2] = 0; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + case FORCERIPPLE__STATIC: + case TRANSPORTERSTAR__STATIC: + case TRANSPORTERBEAM__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 80; + gamelights[gamelightcount].color[1] = 80; + gamelights[gamelightcount].color[2] = 255; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + case SHRINKEREXPLOSION__STATIC: + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z; + + gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 128; + gamelights[gamelightcount].color[1] = 255; + gamelights[gamelightcount].color[2] = 128; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + break; + } if (!actorscrptr[sprite[i].picnum]) goto BOLT; p = A_FindPlayer(s,&x); A_Execute(i,p,x); goto BOLT; + } case SHELL__STATIC: case SHOTGUNSHELL__STATIC: @@ -7612,8 +7799,6 @@ int32_t A_CheckSwitchTile(int32_t i) void G_MoveWorld(void) { - gamelightcount = 0; - G_MoveZombieActors(); //ST 2 G_MoveWeapons(); //ST 4 G_MoveTransports(); //ST 9 diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index 04a2a7d42..646a20848 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -228,7 +228,7 @@ void G_PlayAnim(const char *fn,char t) walock[TILE_ANIM] = 219+t; - allocache((intptr_t *)&animbuf,length,&walock[TILE_ANIM]); + allocache((intptr_t *)&animbuf,length+1,&walock[TILE_ANIM]); tilesizx[TILE_ANIM] = 200; tilesizy[TILE_ANIM] = 320; diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index ecdb0c41b..2250640aa 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -52,7 +52,7 @@ extern "C" { #include "macros.h" #define APPNAME "EDuke32" -#define VERSION " 1.5.0devel" +#define VERSION " 2.0.0devel" // this is checked against http://eduke32.com/VERSION extern const char *s_buildDate; #define HEAD2 APPNAME VERSION diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index bda332e81..0c1fef5a8 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -7369,6 +7369,7 @@ PALONLY: case FLOORFLAME__STATIC: #ifdef POLYMER +/* framelights[framelightcount].radius = 0; framelights[framelightcount].sector = t->sectnum; @@ -7401,6 +7402,7 @@ PALONLY: } framelightcount++; +*/ #endif if (t->picnum == EXPLOSION2) { @@ -7418,6 +7420,7 @@ PALONLY: t->z = sector[t->sectnum].floorz; t->shade = -127; #ifdef POLYMER +/* framelights[framelightcount].radius = 0; framelights[framelightcount].sector = t->sectnum; @@ -7435,12 +7438,14 @@ PALONLY: framelights[framelightcount].priority = 0; framelightcount++; +*/ #endif break; case COOLEXPLOSION1__STATIC: t->shade = -127; t->picnum += (s->shade>>1); #ifdef POLYMER +/* framelights[framelightcount].radius = 0; framelights[framelightcount].sector = t->sectnum; @@ -7458,6 +7463,7 @@ PALONLY: framelights[framelightcount].priority = 0; framelightcount++; +*/ #endif break; case PLAYERONWATER__STATIC: @@ -8441,11 +8447,13 @@ static void G_HandleLocalKeys(void) if (i == 5 && g_player[myconnectindex].ps->fta > 0 && g_player[myconnectindex].ps->ftq == 26) { i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6); - g_musicIndex++; - while ((MapInfo[(uint8_t)g_musicIndex].musicfn == NULL) && g_musicIndex < i) + g_musicIndex = (g_musicIndex+1)%i; + while (MapInfo[(uint8_t)g_musicIndex].musicfn == NULL) + { g_musicIndex++; - if (g_musicIndex == i) - g_musicIndex = 0; + if (g_musicIndex >= i) + g_musicIndex = 0; + } if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) { if (S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex)) @@ -12803,6 +12811,8 @@ static int32_t G_DoMoveThings(void) if (ud.recstat == 1) G_DemoRecord(); + gamelightcount = 0; + if (ud.pause_on == 0) { g_globalRandom = krand(); diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 378dddaf7..e5ae27d7a 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //------------------------------------------------------------------------- #include "duke3d.h" -const char *s_buildDate = "20090313"; +const char *s_buildDate = "20090412"; char *MusicPtr = NULL; int32_t g_musicSize; diff --git a/polymer/eduke32/source/jaudiolib/mpu401.c b/polymer/eduke32/source/jaudiolib/mpu401.c index 0fd040fc8..b83685d84 100644 --- a/polymer/eduke32/source/jaudiolib/mpu401.c +++ b/polymer/eduke32/source/jaudiolib/mpu401.c @@ -32,6 +32,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) #include "mpu401.h" #include "compat.h" +#include "osd.h" #define WIN32_LEAN_AND_MEAN #include @@ -51,7 +52,7 @@ MIDIEVENTHEAD; #define PAD(x) ((((x)+3)&(~3))) #define BUFFERLEN (32*4*4) -#define NUMBUFFERS 6 +#define NUMBUFFERS 8 static char eventbuf[NUMBUFFERS][BUFFERLEN]; static int32_t eventcnt[NUMBUFFERS]; static MIDIHDR bufferheaders[NUMBUFFERS]; @@ -91,7 +92,7 @@ void MPU_FinishBuffer(int32_t buffer) bufferheaders[buffer].dwBytesRecorded = eventcnt[buffer]; midiOutPrepareHeader((HMIDIOUT)hmido, &bufferheaders[buffer], sizeof(MIDIHDR)); midiStreamOut(hmido, &bufferheaders[buffer], sizeof(MIDIHDR)); -// printf("Sending %d bytes (buffer %d)\n",eventcnt[buffer],buffer); + // OSD_Printf("Sending %d bytes (buffer %d)\n",eventcnt[buffer],buffer); _MPU_BuffersWaiting++; } @@ -128,7 +129,7 @@ void CALLBACK MPU_MIDICallback(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWO if (dwParam1 == (uint32_t)&bufferheaders[i]) { eventcnt[i] = 0; // marks the buffer as free -// printf("Finished buffer %d\n",i); + // OSD_Printf("Finished buffer %d\n",i); _MPU_BuffersWaiting--; break; } @@ -171,7 +172,7 @@ void MPU_SendMidi(char *data, int32_t count) nextbuffer = MPU_GetNextBuffer(); if (nextbuffer < 0) { -// printf("All buffers full!\n"); + // OSD_Printf("All buffers full!\n"); return; } MPU_FinishBuffer(_MPU_CurrentBuffer); @@ -193,7 +194,7 @@ void MPU_SendMidi(char *data, int32_t count) nextbuffer = MPU_GetNextBuffer(); if (nextbuffer < 0) { -// printf("All buffers full!\n"); + // OSD_Printf("All buffers full!\n"); return; } MPU_FinishBuffer(_MPU_CurrentBuffer); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 7d3c0b2a6..8a8b33aac 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2111,8 +2111,50 @@ void P_FireWeapon(DukePlayer_t *p) if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_NOVISIBLE)) { + spritetype *s = &sprite[p->i]; + lastvisinc = totalclock+32; p->visibility = 0; + + gamelights[gamelightcount].radius = 0; + gamelights[gamelightcount].sector = s->sectnum; + + gamelights[gamelightcount].x = s->x; + gamelights[gamelightcount].y = s->y; + gamelights[gamelightcount].z = s->z-PHEIGHT; + + gamelights[gamelightcount].range = 4096; + gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + + gamelights[gamelightcount].color[0] = 255; + gamelights[gamelightcount].color[1] = 80; + gamelights[gamelightcount].color[2] = 0; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + + gamelights[gamelightcount].sector = s->sectnum; + gamelights[gamelightcount].x = s->x+((sintable[(p->ang+512)&2047])>>5); + gamelights[gamelightcount].y = s->y+((sintable[(p->ang)&2047])>>5); + + gamelights[gamelightcount].z = s->z-PHEIGHT; + gamelights[gamelightcount].range = 8192; + + gamelights[gamelightcount].angle = (s->ang+1024)&2047; + gamelights[gamelightcount].horiz = 100; + gamelights[gamelightcount].radius = 256; + gamelights[gamelightcount].faderadius = 200; + + gamelights[gamelightcount].color[0] = 255; + gamelights[gamelightcount].color[1] = 80; + gamelights[gamelightcount].color[2] = 0; + + gamelights[gamelightcount].priority = 0; + + gamelightcount++; + + } /* if( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_CHECKATRELOAD) && diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 83abe4365..094206839 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -214,7 +214,7 @@ void S_MenuSound(void) void _playmusic(const char *fn) { - int32_t fp, l; + int32_t fp, l, i; if (fn == NULL) return; @@ -223,18 +223,27 @@ void _playmusic(const char *fn) fp = kopen4loadfrommod((char *)fn,0); - if (fp == -1) return; + if (fp == -1) + { + OSD_Printf(OSD_ERROR "S_PlayMusic(): error: can't open '%s' for playback!",fn); + return; + } l = kfilelength(fp); MUSIC_StopSong(); - if (!MusicPtr) MusicPtr = Bcalloc(1, l); - else MusicPtr = Brealloc(MusicPtr, l); + MusicPtr = Brealloc(MusicPtr, l); + if ((i = kread(fp, (char *)MusicPtr, l)) != l) + { + OSD_Printf(OSD_ERROR "S_PlayMusic(): error: read %d bytes from '%s', needed %d\n",i, fn, l); + kclose(fp); + return; + } + + kclose(fp); g_musicSize=l; - kread(fp, (char *)MusicPtr, l); - kclose(fp); // FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler MUSIC_SetVolume(ud.config.MusicVolume); MUSIC_PlaySong((char *)MusicPtr, MUSIC_LoopSong); diff --git a/polymer/eduke32/source/sync.c b/polymer/eduke32/source/sync.c index c93260869..90551c913 100644 --- a/polymer/eduke32/source/sync.c +++ b/polymer/eduke32/source/sync.c @@ -197,6 +197,7 @@ char Net_RandomSync(void) updatecrc(crc,Net_PlayerSync2() & 255); updatecrc(crc,Net_WeaponSync() & 255); updatecrc(crc,Net_ActorSync() & 255); + updatecrc(crc,Net_MapSync() & 255); } return ((uint8_t) crc & 255);