From cb12f25cdad694f7444e09b0ea86ca4042c2b05e Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 25 Jun 2017 11:23:53 +0000 Subject: [PATCH] Add a wallext structure for non-Lunatic builds so they can have a blend member too. git-svn-id: https://svn.eduke32.com/eduke32@6276 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/build.h | 12 ++++++++++++ source/build/src/engine.cpp | 14 +++++++++++++- source/build/src/polymost.cpp | 2 +- source/duke3d/src/duke3d.h | 4 ++-- source/duke3d/src/gameexec.cpp | 6 ++++++ source/duke3d/src/savegame.cpp | 3 +++ source/duke3d/src/sector.h | 3 +++ 7 files changed, 40 insertions(+), 4 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 8e70f7046..d886f5d93 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -504,6 +504,12 @@ typedef struct { uint8_t filler[2]; } spritesmooth_t; +#ifndef NEW_MAP_FORMAT +typedef struct { + uint8_t blend; +} wallext_t; +#endif + #define SPREXT_NOTMD 1 #define SPREXT_NOMDANIM 2 #define SPREXT_AWAY1 4 @@ -531,6 +537,9 @@ extern int32_t num_usermaphacks; #if !defined DEBUG_MAIN_ARRAYS EXTERN spriteext_t *spriteext; EXTERN spritesmooth_t *spritesmooth; +# ifndef NEW_MAP_FORMAT +EXTERN wallext_t *wallext; +# endif EXTERN sectortype *sector; EXTERN walltype *wall; @@ -539,6 +548,9 @@ EXTERN uspritetype *tsprite; #else EXTERN spriteext_t spriteext[MAXSPRITES+MAXUNIQHUDID]; EXTERN spritesmooth_t spritesmooth[MAXSPRITES+MAXUNIQHUDID]; +# ifndef NEW_MAP_FORMAT +EXTERN wallext_t wallext[MAXWALLS]; +# endif EXTERN sectortype sector[MAXSECTORS + M32_FIXME_SECTORS]; EXTERN walltype wall[MAXWALLS + M32_FIXME_WALLS]; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index ac259ea24..248e1307b 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -5910,7 +5910,7 @@ static void drawmaskwall(int16_t damaskwallcnt) #ifdef NEW_MAP_FORMAT setup_blend(wal->blend, globalorientation&512); #else - setup_blend(0, globalorientation&512); + setup_blend(wallext[thewall[z]].blend, globalorientation&512); #endif transmaskwallscan(xb1[z],xb2[z], 0); } @@ -7588,6 +7588,9 @@ static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID]; static spritesmooth_t spritesmooth_s[MAXSPRITES+MAXUNIQHUDID]; static sectortype sector_s[MAXSECTORS + M32_FIXME_SECTORS]; static walltype wall_s[MAXWALLS + M32_FIXME_WALLS]; +#ifndef NEW_MAP_FORMAT +static wallext_t wallext_s[MAXWALLS]; +#endif static spritetype sprite_s[MAXSPRITES]; static uspritetype tsprite_s[MAXSPRITESONSCREEN]; #endif @@ -7613,6 +7616,9 @@ int32_t preinitengine(void) { { (void **) §or, sizeof(sectortype) *MAXSECTORS }, { (void **) &wall, sizeof(walltype) *MAXWALLS }, // +512: editor quirks. FIXME! +# ifndef NEW_MAP_FORMAT + { (void **) &wallext, sizeof(wallext_t) *MAXWALLS }, +# endif { (void **) &sprite, sizeof(spritetype) *MAXSPRITES }, { (void **) &tsprite, sizeof(spritetype) *MAXSPRITESONSCREEN }, { (void **) &spriteext, sizeof(spriteext_t) *(MAXSPRITES+MAXUNIQHUDID) }, @@ -7644,6 +7650,9 @@ int32_t preinitengine(void) #elif !defined DEBUG_MAIN_ARRAYS sector = sector_s; wall = wall_s; +# ifndef NEW_MAP_FORMAT + wallext = wallext_s; +# endif sprite = sprite_s; tsprite = tsprite_s; spriteext = spriteext_s; @@ -9010,6 +9019,9 @@ static int32_t finish_loadboard(const vec3_t *dapos, int16_t *dacursectnum, int1 #endif { Bmemset(spriteext, 0, sizeof(spriteext_t)*MAXSPRITES); +#ifndef NEW_MAP_FORMAT + Bmemset(wallext, 0, sizeof(wallext_t)*MAXWALLS); +#endif #ifdef USE_OPENGL Bmemset(spritesmooth, 0, sizeof(spritesmooth_t)*(MAXSPRITES+MAXUNIQHUDID)); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 5a0fbbe96..bcef52191 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -4133,7 +4133,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) #ifdef NEW_MAP_FORMAT uint8_t const blend = wal->blend; #else - uint8_t const blend = 0; + uint8_t const blend = wallext[thewall[z]].blend; #endif handle_blend(!!(wal->cstat & 128), blend, !!(wal->cstat & 512)); diff --git a/source/duke3d/src/duke3d.h b/source/duke3d/src/duke3d.h index 811a37358..89e115ca1 100644 --- a/source/duke3d/src/duke3d.h +++ b/source/duke3d/src/duke3d.h @@ -66,10 +66,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // increase by 3, because atomic GRP adds 1, and Shareware adds 2 #ifdef LUNATIC // Lunatic -# define BYTEVERSION_EDUKE32 312 +# define BYTEVERSION_EDUKE32 315 #else // Non-Lua build -# define BYTEVERSION_EDUKE32 312 +# define BYTEVERSION_EDUKE32 315 #endif //#define BYTEVERSION_13 27 diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 35814d957..f27fcfab1 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -6014,6 +6014,9 @@ void G_SaveMapState(void) initprintf("Line %d: savemapstate called from EVENT_ANIMATESPRITES. WHY?\n", g_errorLineNum); #endif Bmemcpy(&save->spriteext[0],&spriteext[0],sizeof(spriteext_t)*MAXSPRITES); +#ifndef NEW_MAP_FORMAT + Bmemcpy(&save->wallext[0],&wallext[0],sizeof(wallext_t)*MAXWALLS); +#endif save->numsprites = Numsprites; save->tailspritefree = tailspritefree; @@ -6143,6 +6146,9 @@ void G_RestoreMapState(void) numwalls = pSavedState->numwalls; Bmemcpy(&wall[0],&pSavedState->wall[0],sizeof(walltype)*MAXWALLS); +#ifndef NEW_MAP_FORMAT + Bmemcpy(&wallext[0],&pSavedState->wallext[0],sizeof(wallext_t)*MAXWALLS); +#endif numsectors = pSavedState->numsectors; Bmemcpy(§or[0],&pSavedState->sector[0],sizeof(sectortype)*MAXSECTORS); Bmemcpy(&sprite[0],&pSavedState->sprite[0],sizeof(spritetype)*MAXSPRITES); diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 654878248..71507460e 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -1072,6 +1072,9 @@ static const dataspec_t svgm_secwsp[] = { DS_SAVEFN, (void *)&sv_prespriteextsave, 0, 1 }, #endif { DS_MAINAR, &spriteext, sizeof(spriteext_t), MAXSPRITES }, +#ifndef NEW_MAP_FORMAT + { DS_MAINAR, &wallext, sizeof(wallext_t), MAXWALLS }, +#endif #ifdef USE_OPENGL { DS_SAVEFN|DS_LOADFN, (void *)&sv_postspriteext, 0, 1 }, #endif diff --git a/source/duke3d/src/sector.h b/source/duke3d/src/sector.h index 7904726bf..fbf145b60 100644 --- a/source/duke3d/src/sector.h +++ b/source/duke3d/src/sector.h @@ -84,6 +84,9 @@ typedef struct { spriteext_t spriteext[MAXSPRITES]; uspritetype sprite[MAXSPRITES]; uwalltype wall[MAXWALLS]; +#ifndef NEW_MAP_FORMAT + wallext_t wallext[MAXWALLS]; +#endif #if !defined LUNATIC intptr_t *vars[MAXGAMEVARS]; intptr_t *arrays[MAXGAMEARRAYS];