From 33ad4b98600f90ab6ce1915d87d6de826dad0be7 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 26 Dec 2019 06:26:15 +0000 Subject: [PATCH 01/14] Fix -Wfallthrough error in gamevars.h git-svn-id: https://svn.eduke32.com/eduke32@8495 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gamevars.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/duke3d/src/gamevars.h b/source/duke3d/src/gamevars.h index c45c194e1..b413f3850 100644 --- a/source/duke3d/src/gamevars.h +++ b/source/duke3d/src/gamevars.h @@ -255,7 +255,7 @@ static FORCE_INLINE void __fastcall Gv_DivVar(int const id, int32_t const d) { case GAMEVAR_PERACTOR: iptr = &var.pValues[vm.spriteNum & (MAXSPRITES-1)]; goto jmp; case GAMEVAR_PERPLAYER: iptr = &var.pValues[vm.playerNum & (MAXPLAYERS-1)]; fallthrough__; - jmp: default: *iptr = libdivide_s32_do(*iptr, dptr); break; + default: jmp: *iptr = libdivide_s32_do(*iptr, dptr); break; case GAMEVAR_INT32PTR: { From e9602e0e740876197c43987f16c64a169f78f5c0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 08:42:35 +0100 Subject: [PATCH 02/14] - SW grpinfo updates. --- wadsrc/static/demolition/demolition.grpinfo | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wadsrc/static/demolition/demolition.grpinfo b/wadsrc/static/demolition/demolition.grpinfo index 7321f2e71..ecbd72e97 100644 --- a/wadsrc/static/demolition/demolition.grpinfo +++ b/wadsrc/static/demolition/demolition.grpinfo @@ -454,3 +454,15 @@ grpinfo gamefilter "ShadowWarrior.TwinDragon" } +grpinfo +{ + name "Shadow Warrior: Twin Dragon" + flags GAMEFLAG_SW|GAMEFLAG_ADDON + crc 0xB5B71277 + size 6236287 + defname "twindrag.def" // included in the GRP + dependency SWREG12_CRC + gamefilter "ShadowWarrior.TwinDragon" +} + + \ No newline at end of file From 846c7eaff25cb220278b97cacd1fee619d118654 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 26 Dec 2019 06:27:29 +0000 Subject: [PATCH 03/14] SW: Run all allocations through Xmalloc et al git-svn-id: https://svn.eduke32.com/eduke32@8515 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/audiolib/src/driver_winmm.cpp # source/audiolib/src/flac.cpp # source/sw/src/StartupWinController.game.mm # source/sw/src/bldscript.cpp # source/sw/src/game.cpp # source/sw/src/game.h # source/sw/src/grpscan.cpp # source/sw/src/jbhlp.cpp # source/sw/src/rts.cpp # source/sw/src/scrip2.cpp # source/sw/src/sounds.cpp --- source/sw/src/game.cpp | 49 +++++++++++------------------------------- source/sw/src/game.h | 14 ++++++------ 2 files changed, 19 insertions(+), 44 deletions(-) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 85802b6de..f8056ad51 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -443,12 +443,19 @@ AllocMem(int size) void * ReAllocMem(void *ptr, int size) { + if (ptr == nullptr) + return AllocMem(size); + + if (size == 0) + { + FreeMem(ptr); + return nullptr; + } + uint8_t* bp; MEM_HDRp mhp; uint8_t* check; - ASSERT(size != 0); - ASSERT(ValidPtr(ptr)); mhp = (MEM_HDRp)(((uint8_t*) ptr) - sizeof(MEM_HDR)); @@ -506,11 +513,12 @@ CallocMem(int size, int num) void FreeMem(void *ptr) { + if (ptr == nullptr) + return; + MEM_HDRp mhp; uint8_t* check; - ASSERT(ptr != NULL); - ASSERT(ValidPtr(ptr)); mhp = (MEM_HDRp)(((uint8_t*) ptr) - sizeof(MEM_HDR)); @@ -521,39 +529,6 @@ FreeMem(void *ptr) free(mhp); } -#else -SWBOOL -ValidPtr(void *ptr) -{ - return TRUE; -} - -#if 0 -void * -AllocMem(int size) -{ - return malloc(size); -} - -void * -CallocMem(int size, int num) -{ - return calloc(size, num); -} - -void * -ReAllocMem(void *ptr, int size) -{ - return realloc(ptr, size); -} - -void -FreeMem(void *ptr) -{ - free(ptr); -} -#endif - #endif int PointOnLine(int x, int y, int x1, int y1, int x2, int y2) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index dbcf6a3f3..b6e480834 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1754,18 +1754,18 @@ typedef struct unsigned int size, checksum; } MEM_HDR,*MEM_HDRp; +#if !DEBUG +# define ValidPtr(ptr) ((SWBOOL)(TRUE)) +# define AllocMem(size) Xmalloc(size) +# define CallocMem(size, num) Xcalloc(size, num) +# define ReAllocMem(ptr, size) Xrealloc(ptr, size) +# define FreeMem(ptr) Xfree(ptr) +#else SWBOOL ValidPtr(void *ptr); -#if 0 void *AllocMem(int size); void *CallocMem(int size, int num); void *ReAllocMem(void *ptr, int size); void FreeMem(void *ptr); -#else -// Make these #defines so that MSVC's allocation tracker gets correct line numbers -#define AllocMem malloc -#define CallocMem calloc -#define ReAllocMem realloc -#define FreeMem free #endif typedef struct From 91cbaa14918cbe52f315635d4c4a3c41779f4dee Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 26 Dec 2019 06:27:40 +0000 Subject: [PATCH 04/14] Add information to cstat enums git-svn-id: https://svn.eduke32.com/eduke32@8518 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/buildtypes.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/source/build/include/buildtypes.h b/source/build/include/buildtypes.h index 72545057e..cfab7ee3c 100644 --- a/source/build/include/buildtypes.h +++ b/source/build/include/buildtypes.h @@ -126,11 +126,11 @@ enum CSTAT_SPRITE_BLOCK_HITSCAN = 1u<<8u, CSTAT_SPRITE_TRANSLUCENT_INVERT = 1u<<9u, - CSTAT_SPRITE_RESERVED1 = 1u<<10u, // game-side - CSTAT_SPRITE_RESERVED2 = 1u<<11u, // game-side - CSTAT_SPRITE_RESERVED3 = 1u<<12u, - CSTAT_SPRITE_RESERVED4 = 1u<<13u, - CSTAT_SPRITE_RESERVED5 = 1u<<14u, + CSTAT_SPRITE_RESERVED1 = 1u<<10u, // used by Duke 3D (Polymost) + CSTAT_SPRITE_RESERVED2 = 1u<<11u, // used by Duke 3D (EDuke32 game code extension) + CSTAT_SPRITE_RESERVED3 = 1u<<12u, // used by Shadow Warrior, Blood + CSTAT_SPRITE_RESERVED4 = 1u<<13u, // used by Duke 3D (Polymer), Shadow Warrior, Blood + CSTAT_SPRITE_RESERVED5 = 1u<<14u, // used by Duke 3D (Polymer), Shadow Warrior, Blood // TODO: Make these two Duke3D-only by translating them to bits in tspr CSTAT_SPRITE_NO_SHADOW = 1u<<13u, // re-defined in Shadow Warrior @@ -160,9 +160,14 @@ enum CSTAT_WALL_TRANSLUCENT = 1u<<7u, CSTAT_WALL_YFLIP = 1u<<8u, CSTAT_WALL_TRANS_FLIP = 1u<<9u, - CSTAT_WALL_YAX_UPWALL = 1u<<10u, - CSTAT_WALL_YAX_DOWNWALL = 1u<<11u, - CSTAT_WALL_ROTATE_90 = 1u<<12u, + + CSTAT_WALL_YAX_UPWALL = 1u<<10u, // EDuke32 extension + CSTAT_WALL_YAX_DOWNWALL = 1u<<11u, // EDuke32 extension + CSTAT_WALL_ROTATE_90 = 1u<<12u, // EDuke32 extension + + CSTAT_WALL_RESERVED1 = 1u<<13u, + CSTAT_WALL_RESERVED2 = 1u<<14u, // used by Shadow Warrior, Blood + CSTAT_WALL_RESERVED3 = 1u<<15u, // used by Shadow Warrior, Blood }; #endif From ae94566fb55b4a001d1c893f094d02a4ad8eb346 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 26 Dec 2019 06:28:12 +0000 Subject: [PATCH 05/14] SW: Draw the crosshair actually centered Thanks to Striker for the tip. git-svn-id: https://svn.eduke32.com/eduke32@8524 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/draw.cpp --- source/sw/src/draw.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 502953081..6bd9e3a7c 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1633,10 +1633,9 @@ void DrawCrosshair(PLAYERp pp) { //NORMALXHAIR: - rotatesprite(CrosshairX, CrosshairY, (1 << 16), 0, + rotatesprite(160<<16, 100<<16, (1 << 16), 0, 2326, 10, 0, - //ROTATE_SPRITE_VIEW_CLIP|ROTATE_SPRITE_CORNER, 0, 0, xdim - 1, ydim - 1); - ROTATE_SPRITE_SCREEN_CLIP|ROTATE_SPRITE_CORNER, 0, 0, xdim - 1, ydim - 1); + ROTATE_SPRITE_VIEW_CLIP, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); } //#define TITLE_ROT_FLAGS (ROTATE_SPRITE_CORNER|ROTATE_SPRITE_SCREEN_CLIP|ROTATE_SPRITE_NON_MASK) From 3bbecf84c2090acd9cee3656485c6f3f6ad86f12 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 26 Dec 2019 06:28:16 +0000 Subject: [PATCH 06/14] SW: Fix FindDistance3D calls to not z>>4 at the call site This is handled by the function itself now. Fixes the distance issue with the ceiling fan. git-svn-id: https://svn.eduke32.com/eduke32@8525 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/sw/src/jweapon.cpp | 2 +- source/sw/src/player.cpp | 4 ++-- source/sw/src/quake.cpp | 2 +- source/sw/src/sector.cpp | 4 ++-- source/sw/src/weapon.cpp | 24 ++++++++++++------------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/sw/src/jweapon.cpp b/source/sw/src/jweapon.cpp index a9b309878..e846921e4 100644 --- a/source/sw/src/jweapon.cpp +++ b/source/sw/src/jweapon.cpp @@ -2188,7 +2188,7 @@ DoFlagRangeTest(short Weapon, short range) if (!FAFcansee(sp->x, sp->y, sp->z, sp->sectnum, wp->x, wp->y, wp->z, wp->sectnum)) continue; - dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, (wp->z - sp->z) >> 4); + dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, wp->z - sp->z); if (dist > range) continue; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index e0f4ef84d..b53ecda4c 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1219,7 +1219,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, SWBOOL skip_targets) // Only look at closest ones //if ((dist = Distance(sp->x, sp->y, ep->x, ep->y)) > PICK_DIST) - if ((dist = FindDistance3D(sp->x - ep->x, sp->y - ep->y, (sp->z - ep->z)>>4)) > PICK_DIST) + if ((dist = FindDistance3D(sp->x - ep->x, sp->y - ep->y, sp->z - ep->z)) > PICK_DIST) continue; if (skip_targets != 2) // Used for spriteinfo mode @@ -8178,7 +8178,7 @@ int SearchSpawnPosition(PLAYERp pp) if (opp != pp) // don't test for yourself { - if (FindDistance3D(sp->x - opp->posx, sp->y - opp->posy, (sp->z - opp->posz)>>4) < 1000) + if (FindDistance3D(sp->x - opp->posx, sp->y - opp->posy, sp->z - opp->posz) < 1000) { blocked = TRUE; break; diff --git a/source/sw/src/quake.cpp b/source/sw/src/quake.cpp index 0c9533b48..1da8fb5a2 100644 --- a/source/sw/src/quake.cpp +++ b/source/sw/src/quake.cpp @@ -200,7 +200,7 @@ void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *a { sp = &sprite[i]; - dist = FindDistance3D(pp->posx - sp->x, pp->posy - sp->y, (pp->posz - sp->z)>>4); + dist = FindDistance3D(pp->posx - sp->x, pp->posy - sp->y, pp->posz - sp->z); // shake whole level if (QUAKE_TestDontTaper(sp)) diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index f6e0d58f8..ce7f5fdf2 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -1424,7 +1424,7 @@ WeaponExplodeSectorInRange(short weapon) sp = &sprite[i]; // test to see if explosion is close to crack sprite - dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, (wp->z - sp->z)>>4); + dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, wp->z - sp->z); if (sp->clipdist == 0) continue; @@ -2568,7 +2568,7 @@ int DoPlayerGrabStar(PLAYERp pp) { sp = &sprite[StarQueue[i]]; - if (FindDistance3D(sp->x - pp->posx, sp->y - pp->posy, (sp->z - pp->posz + Z(12))>>4) < 500) + if (FindDistance3D(sp->x - pp->posx, sp->y - pp->posy, sp->z - pp->posz + Z(12)) < 500) { break; } diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 3f273ba60..ee8526349 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -7857,7 +7857,7 @@ int DoExpDamageTest(short Weapon) { int zdist=0; - if ((unsigned)FindDistance3D(sp->x - wp->x, sp->y - wp->y, (sp->z - wp->z)>>4) > wu->Radius + u->Radius) + if ((unsigned)FindDistance3D(sp->x - wp->x, sp->y - wp->y, sp->z - wp->z) > wu->Radius + u->Radius) continue; // added hitscan block because mines no long clip against actors/players @@ -7894,7 +7894,7 @@ int DoExpDamageTest(short Weapon) if ((unsigned)dist > wu->Radius) continue; - dist = FindDistance3D(sp->x - wp->x, sp->y - wp->y, (SPRITEp_MID(sp) - wp->z)>>4); + dist = FindDistance3D(sp->x - wp->x, sp->y - wp->y, SPRITEp_MID(sp) - wp->z); if ((unsigned)dist > wu->Radius) continue; @@ -9020,7 +9020,7 @@ DoGrenade(int16_t Weapon) if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256) SpawnBubble(Weapon); - ////DSPRINTF(ds, "dist %d, u->ret %d", FindDistance3D(u->xchange, u->ychange, u->zchange>>4), u->ret); + ////DSPRINTF(ds, "dist %d, u->ret %d", FindDistance3D(u->xchange, u->ychange, u->zchange), u->ret); //MONO_PRINT(ds); if (u->ret) @@ -9453,7 +9453,7 @@ DoMineRangeTest(short Weapon, short range) if (u->ID == GIRLNINJA_RUN_R0 && !ownerisplayer) continue; - dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, (wp->z - sp->z)>>4); + dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, wp->z - sp->z); if (dist > range) continue; @@ -11281,7 +11281,7 @@ SpawnNuclearSecondaryExp(int16_t Weapon, short ang) eu->ret = move_missile(explosion, eu->xchange, eu->ychange, 0, eu->ceiling_dist, eu->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); - if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, (exp->z - sp->z)>>4) < 1024) + if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, exp->z - sp->z) < 1024) { KillSprite(explosion); return -1; @@ -11627,7 +11627,7 @@ SpawnGrenadeSecondaryExp(int16_t Weapon, short ang) eu->ret = move_missile(explosion, eu->xchange, eu->ychange, 0, eu->ceiling_dist, eu->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); - if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, (exp->z - sp->z)>>4) < 1024) + if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, exp->z - sp->z) < 1024) { KillSprite(explosion); return -1; @@ -13925,7 +13925,7 @@ InitSwordAttack(PLAYERp pp) if (hitinfo.sect < 0) return 0; - if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, (pp->posz - hitinfo.pos.z)>>4) < 700) + if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, pp->posz - hitinfo.pos.z) < 700) { if (hitinfo.sprite >= 0) @@ -14117,7 +14117,7 @@ InitFistAttack(PLAYERp pp) if (hitinfo.sect < 0) return 0; - if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, (pp->posz - hitinfo.pos.z)>>4) < 700) + if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, pp->posz - hitinfo.pos.z) < 700) { if (hitinfo.sprite >= 0) @@ -16155,7 +16155,7 @@ InitRipperSlash(short SpriteNum) if (i == SpriteNum) break; - if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4) > hu->Radius + u->Radius) + if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z) > hu->Radius + u->Radius) continue; DISTANCE(hp->x, hp->y, sp->x, sp->y, dist, a, b, c); @@ -16304,7 +16304,7 @@ DoBladeDamage(short SpriteNum) if (dist > 2000) continue; - dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4); + dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z); if (dist > 2000) continue; @@ -16347,7 +16347,7 @@ DoStaticFlamesDamage(short SpriteNum) if (dist > 2000) continue; - dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4); + dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z); if (dist > 2000) continue; @@ -17365,7 +17365,7 @@ InitEelFire(short SpriteNum) if (hp != u->tgt_sp) continue; - if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4) > hu->Radius + u->Radius) + if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z) > hu->Radius + u->Radius) continue; DISTANCE(hp->x, hp->y, sp->x, sp->y, dist, a, b, c); From 8e6a54a1e4871b72609f4dd6bcebb5a34f051e7d Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 26 Dec 2019 06:27:48 +0000 Subject: [PATCH 07/14] Mostly clean up the codebase in preparation for tspritetype != uspritetype Remaining exceptions: SW - ConnectCopySprite CON and M32Script - pSprite/pUSprite git-svn-id: https://svn.eduke32.com/eduke32@8519 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/include/polymer.h # source/build/src/engine.cpp # source/build/src/engine_priv.h # source/build/src/polymer.cpp # source/build/src/polymost.cpp # source/duke3d/src/astub.cpp # source/duke3d/src/game.h # source/duke3d/src/m32common.cpp # source/duke3d/src/m32exec.cpp # source/duke3d/src/m32structures.cpp # source/kenbuild/src/bstub.cpp # source/kenbuild/src/game.cpp # source/sw/src/jnstub.cpp # source/sw/src/jsector.cpp --- source/build/include/build.h | 2 +- source/build/include/polymost.h | 2 +- source/build/src/engine.cpp | 72 ++------------------------------- source/build/src/engine_priv.h | 72 ++++++++++++++++++++++++++++++--- source/build/src/polymost.cpp | 7 ++-- source/duke3d/src/game.cpp | 5 ++- source/duke3d/src/game.h | 35 ++++++++-------- source/sw/src/draw.cpp | 48 ++++++++++------------ source/sw/src/jsector.cpp | 5 ++- source/sw/src/jsector.h | 2 +- 10 files changed, 122 insertions(+), 128 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index b1b3a1a75..502f3d8e5 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -337,7 +337,7 @@ typedef struct { uint8_t filler; float alpha; // NOTE: keep 'tspr' on an 8-byte boundary: - uspritetype *tspr; + tspriteptr_t tspr; #if !defined UINTPTR_MAX # error Need UINTPTR_MAX define to select between 32- and 64-bit structs #endif diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index cc1335e0f..bfe7a6a1c 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -39,7 +39,7 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fix16_t daang void polymost_completeMirror(); int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall); -int32_t polymost_spriteHasTranslucency(uspritetype const * const tspr); +int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr); float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 2e34d2d9c..a51456f77 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -823,7 +823,7 @@ static void yax_copytsprites() if (spritesortcnt >= maxspritesonscreen) break; - Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype)); + Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(tspritetype)); tsprite[spritesortcnt].owner = spritenum; tsprite[spritesortcnt].extra = 0; tsprite[spritesortcnt].sectnum = sectnum; // potentially tweak sectnum! @@ -1478,7 +1478,7 @@ int32_t renderAddTsprite(int16_t z, int16_t sectnum) if (spritesortcnt >= maxspritesonscreen) return 1; - Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype)); + Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(tspritetype)); tsprite[spritesortcnt].extra = 0; tsprite[spritesortcnt++].owner = z; @@ -2051,7 +2051,7 @@ int32_t wallfront(int32_t l1, int32_t l2) // // spritewallfront (internal) // -static inline int32_t spritewallfront(uspriteptr_t s, int32_t w) +static inline int32_t spritewallfront(tspritetype const * const s, int32_t w) { auto const wal = (uwallptr_t)&wall[w]; auto const wal2 = (uwallptr_t)&wall[wal->point2]; @@ -8863,7 +8863,7 @@ killsprite: if ((tspr->cstat & 48) != 16) tspriteptr[i]->ang = globalang; - get_wallspr_points((uspriteptr_t)tspr, &xx[0], &xx[1], &yy[0], &yy[1]); + get_wallspr_points(tspr, &xx[0], &xx[1], &yy[0], &yy[1]); if (!playing_blood? ((tspr->cstat & 48) == 0) : ((tspr->cstat & 48) != 16)) tspriteptr[i]->ang = oang; @@ -10604,70 +10604,6 @@ add_nextsector: return 0; } -// x1, y1: in/out -// rest x/y: out -void get_wallspr_points(uspriteptr_t const spr, int32_t *x1, int32_t *x2, - int32_t *y1, int32_t *y2) -{ - //These lines get the 2 points of the rotated sprite - //Given: (x1, y1) starts out as the center point - - const int32_t tilenum=spr->picnum, ang=spr->ang; - const int32_t xrepeat = spr->xrepeat; - int32_t xoff = picanm[tilenum].xofs + spr->xoffset; - int32_t k, l, dax, day; - - if (spr->cstat&4) - xoff = -xoff; - - dax = sintable[ang&2047]*xrepeat; - day = sintable[(ang+1536)&2047]*xrepeat; - - l = tilesiz[tilenum].x; - k = (l>>1)+xoff; - - *x1 -= mulscale16(dax,k); - *x2 = *x1 + mulscale16(dax,l); - - *y1 -= mulscale16(day,k); - *y2 = *y1 + mulscale16(day,l); -} - -// x1, y1: in/out -// rest x/y: out -void get_floorspr_points(uspriteptr_t const spr, int32_t px, int32_t py, - int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, - int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4) -{ - const int32_t tilenum = spr->picnum; - const int32_t cosang = sintable[(spr->ang+512)&2047]; - const int32_t sinang = sintable[spr->ang&2047]; - - vec2_t const span = { tilesiz[tilenum].x, tilesiz[tilenum].y}; - vec2_t const repeat = { spr->xrepeat, spr->yrepeat }; - - vec2_t adjofs = { picanm[tilenum].xofs + spr->xoffset, picanm[tilenum].yofs + spr->yoffset }; - - if (spr->cstat & 4) - adjofs.x = -adjofs.x; - - if (spr->cstat & 8) - adjofs.y = -adjofs.y; - - vec2_t const center = { ((span.x >> 1) + adjofs.x) * repeat.x, ((span.y >> 1) + adjofs.y) * repeat.y }; - vec2_t const rspan = { span.x * repeat.x, span.y * repeat.y }; - vec2_t const ofs = { -mulscale16(cosang, rspan.y), -mulscale16(sinang, rspan.y) }; - - *x1 += dmulscale16(sinang, center.x, cosang, center.y) - px; - *y1 += dmulscale16(sinang, center.y, -cosang, center.x) - py; - - *x2 = *x1 - mulscale16(sinang, rspan.x); - *y2 = *y1 + mulscale16(cosang, rspan.x); - - *x3 = *x2 + ofs.x, *x4 = *x1 + ofs.x; - *y3 = *y2 + ofs.y, *y4 = *y1 + ofs.y; -} - // // neartag // diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index 490fee68a..f641fef14 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -132,12 +132,6 @@ extern int16_t bunchp2[MAXWALLSB]; extern int16_t numscans, numbunches; extern int32_t rxi[8], ryi[8]; -extern void get_wallspr_points(uspriteptr_t spr, int32_t *x1, int32_t *x2, - int32_t *y1, int32_t *y2); -extern void get_floorspr_points(uspriteptr_t spr, int32_t px, int32_t py, - int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, - int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4); - // int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat); int32_t wallfront(int32_t l1, int32_t l2); @@ -239,4 +233,70 @@ template static FORCE_INLINE void tileUpdatePicnum(T * const tilept tile = RotTile(tile).newtile; } +// x1, y1: in/out +// rest x/y: out +template +static inline void get_wallspr_points(T const * const spr, int32_t *x1, int32_t *x2, + int32_t *y1, int32_t *y2) +{ + //These lines get the 2 points of the rotated sprite + //Given: (x1, y1) starts out as the center point + + const int32_t tilenum=spr->picnum, ang=spr->ang; + const int32_t xrepeat = spr->xrepeat; + int32_t xoff = picanm[tilenum].xofs + spr->xoffset; + int32_t k, l, dax, day; + + if (spr->cstat&4) + xoff = -xoff; + + dax = sintable[ang&2047]*xrepeat; + day = sintable[(ang+1536)&2047]*xrepeat; + + l = tilesiz[tilenum].x; + k = (l>>1)+xoff; + + *x1 -= mulscale16(dax,k); + *x2 = *x1 + mulscale16(dax,l); + + *y1 -= mulscale16(day,k); + *y2 = *y1 + mulscale16(day,l); +} + +// x1, y1: in/out +// rest x/y: out +template +static inline void get_floorspr_points(T const * const spr, int32_t px, int32_t py, + int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, + int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4) +{ + const int32_t tilenum = spr->picnum; + const int32_t cosang = sintable[(spr->ang+512)&2047]; + const int32_t sinang = sintable[spr->ang&2047]; + + vec2_t const span = { tilesiz[tilenum].x, tilesiz[tilenum].y}; + vec2_t const repeat = { spr->xrepeat, spr->yrepeat }; + + vec2_t adjofs = { picanm[tilenum].xofs + spr->xoffset, picanm[tilenum].yofs + spr->yoffset }; + + if (spr->cstat & 4) + adjofs.x = -adjofs.x; + + if (spr->cstat & 8) + adjofs.y = -adjofs.y; + + vec2_t const center = { ((span.x >> 1) + adjofs.x) * repeat.x, ((span.y >> 1) + adjofs.y) * repeat.y }; + vec2_t const rspan = { span.x * repeat.x, span.y * repeat.y }; + vec2_t const ofs = { -mulscale16(cosang, rspan.y), -mulscale16(sinang, rspan.y) }; + + *x1 += dmulscale16(sinang, center.x, cosang, center.y) - px; + *y1 += dmulscale16(sinang, center.y, -cosang, center.x) - py; + + *x2 = *x1 - mulscale16(sinang, rspan.x); + *y2 = *y1 + mulscale16(cosang, rspan.x); + + *x3 = *x2 + ofs.x, *x4 = *x1 + ofs.x; + *y3 = *y2 + ofs.y, *y4 = *y1 + ofs.y; +} + #endif /* ENGINE_PRIV_H */ diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 5b41010b4..a8fc02509 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -416,7 +416,7 @@ int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall) return tex && tex->GetTranslucency(); } -int32_t polymost_spriteHasTranslucency(uspritetype const * const tspr) +int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr) { if ((tspr->cstat & (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_RESERVED1)) || ((unsigned)tspr->owner < MAXSPRITES && spriteext[tspr->owner].alpha)) @@ -3849,7 +3849,7 @@ void Polymost_prepare_loadboard(void) Bmemset(wsprinfo, 0, sizeof(wsprinfo)); } -static inline int32_t polymost_findwall(uspriteptr_t const tspr, vec2_t const * const tsiz, int32_t * rd) +static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd) { int32_t dist = 4, closest = -1; auto const sect = (usectortype * )§or[tspr->sectnum]; @@ -4573,8 +4573,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, vec3f_t vec1; - uspritetype tspr; - Bmemset(&tspr, 0, sizeof(spritetype)); + tspritetype tspr{}; hudtyp const * const hud = tile2model[tilenum].hudmem[(dastat&4)>>2]; diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 6b005d4db..e16daa1ca 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -360,7 +360,7 @@ static void G_OROR_DupeSprites(spritetype const *sp) if (sprite[k].picnum != SECTOREFFECTOR && sprite[k].z >= sp->z) { - Bmemcpy(&tsprite[spritesortcnt], &sprite[k], sizeof(spritetype)); + Bmemcpy(&tsprite[spritesortcnt], &sprite[k], sizeof(tspritetype)); tsprite[spritesortcnt].x += (refsp->x - sp->x); tsprite[spritesortcnt].y += (refsp->y - sp->y); @@ -3621,6 +3621,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura const int32_t i = t->owner; // XXX: what's up with the (i < 0) check? // NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below). + EDUKE32_STATIC_ASSERT(sizeof(uspritetype) == sizeof(tspritetype)); // see TSPRITE_SIZE auto const pSprite = (i < 0) ? (uspriteptr_t)&tsprite[j] : (uspriteptr_t)&sprite[i]; #ifndef EDUKE32_STANDALONE @@ -3762,7 +3763,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura { auto const newt = &tsprite[spritesortcnt++]; - Bmemcpy(newt, t, sizeof(spritetype)); + *newt = *t; newt->cstat |= 2|512; newt->x += (sintable[(newt->ang+512)&2047]>>12); diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index 45385896e..1983cde1d 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -462,23 +462,6 @@ static inline int G_GetMusicIdx(const char *str) return (ep * MAXLEVELS) + lev; } -static inline int G_GetViewscreenSizeShift(uspriteptr_t const spr) -{ -#if VIEWSCREENFACTOR == 0 - UNREFERENCED_PARAMETER(spr); - return VIEWSCREENFACTOR; -#else - static const int mask = (1<xrepeat & mask) | (spr->yrepeat & mask); - - for (int i=0; i < VIEWSCREENFACTOR; i++) - if (rem & (1< +static inline int G_GetViewscreenSizeShift(T const * spr) +{ +#if VIEWSCREENFACTOR == 0 + UNREFERENCED_PARAMETER(spr); + return VIEWSCREENFACTOR; +#else + static CONSTEXPR int const mask = (1<xrepeat & mask) | (spr->yrepeat & mask); + + for (int i=0; i < VIEWSCREENFACTOR; i++) + if (rem & (1<shade = sector[tsp->sectnum].floorshade - 25; @@ -104,7 +104,7 @@ GetRotation(short tSpriteNum, int viewx, int viewy) short rotation; extern short screenpeek; - uspritetype * tsp = &tsprite[tSpriteNum]; + tspriteptr_t tsp = &tsprite[tSpriteNum]; USERp tu = User[tsp->owner]; PLAYERp pp = Player + screenpeek; short angle2; @@ -172,7 +172,7 @@ directions was not standardized. int SetActorRotation(short tSpriteNum, int viewx, int viewy) { - uspritetype * tsp = &tsprite[tSpriteNum]; + tspriteptr_t tsp = &tsprite[tSpriteNum]; USERp tu = User[tsp->owner]; short StateOffset, Rotation; @@ -233,7 +233,7 @@ SetActorRotation(short tSpriteNum, int viewx, int viewy) } int -DoShadowFindGroundPoint(uspritetype * sp) +DoShadowFindGroundPoint(tspriteptr_t sp) { // USES TSPRITE !!!!! USERp u = User[sp->owner]; @@ -369,9 +369,9 @@ DoVoxelShadow(SPRITEp tspr) #endif void -DoShadows(uspritetype * tsp, int viewz) +DoShadows(tspriteptr_t tsp, int viewz) { - uspritetype * New = &tsprite[spritesortcnt]; + tspriteptr_t New = &tsprite[spritesortcnt]; USERp tu = User[tsp->owner]; int ground_dist = 0; int view_dist = 0; @@ -396,7 +396,7 @@ DoShadows(uspritetype * tsp, int viewz) } tsp->sectnum = sectnum; - memcpy(New, tsp, sizeof(SPRITE)); + *New = *tsp; // shadow is ALWAYS draw last - status is priority New->statnum = MAXSTATUS; New->sectnum = sectnum; @@ -464,9 +464,8 @@ DoShadows(uspritetype * tsp, int viewz) } void -DoMotionBlur(uspritetype const * tsp) +DoMotionBlur(tspritetype const * const tsp) { - uspritetype * New; USERp tu = User[tsp->owner]; int nx,ny,nz = 0,dx,dy,dz; short i, ang; @@ -537,8 +536,8 @@ DoMotionBlur(uspritetype const * tsp) for (i = 0; i < tu->motion_blur_num; i++) { - New = &tsprite[spritesortcnt]; - memcpy(New, tsp, sizeof(SPRITE)); + tspriteptr_t New = &tsprite[spritesortcnt]; + *New = *tsp; SET(New->cstat, CSTAT_SPRITE_TRANSLUCENT|CSTAT_SPRITE_TRANSLUCENT_INVERT); New->x += dx; @@ -569,7 +568,6 @@ void SetVoxelSprite(SPRITEp sp, short pic) void WarpCopySprite(void) { SPRITEp sp1, sp2, sp; - uspritetype * New; short sn, nsn; short sn2, nsn2; short spnum, next_spnum; @@ -602,8 +600,8 @@ void WarpCopySprite(void) if (sprite[spnum].picnum == ST1) continue; - New = &tsprite[spritesortcnt]; - memcpy(New, &sprite[spnum], sizeof(SPRITE)); + tspriteptr_t New = &tsprite[spritesortcnt]; + memcpy(New, &sprite[spnum], sizeof(tspritetype)); spritesortcnt++; New->owner = spnum; New->statnum = 0; @@ -626,8 +624,8 @@ void WarpCopySprite(void) if (sprite[spnum].picnum == ST1) continue; - New = &tsprite[spritesortcnt]; - memcpy(New, &sprite[spnum], sizeof(SPRITE)); + tspriteptr_t New = &tsprite[spritesortcnt]; + memcpy(New, &sprite[spnum], sizeof(tspritetype)); spritesortcnt++; New->owner = spnum; New->statnum = 0; @@ -646,7 +644,7 @@ void WarpCopySprite(void) } } -void DoStarView(uspritetype * tsp, USERp tu, int viewz) +void DoStarView(tspriteptr_t tsp, USERp tu, int viewz) { extern STATE s_Star[], s_StarDown[]; extern STATE s_StarStuck[], s_StarDownStuck[]; @@ -675,7 +673,6 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) int tSpriteNum, j, k; short SpriteNum, pnum; int smr4, smr2; - uspritetype * tsp; USERp tu; static int ang = 0; PLAYERp pp = Player + screenpeek; @@ -690,7 +687,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) for (tSpriteNum = spritesortcnt - 1; tSpriteNum >= 0; tSpriteNum--) { SpriteNum = tsprite[tSpriteNum].owner; - tsp = &tsprite[tSpriteNum]; + tspriteptr_t tsp = &tsprite[tSpriteNum]; tu = User[SpriteNum]; //if(tsp->statnum == STAT_GENERIC_QUEUE) @@ -901,7 +898,8 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) if (OverlapDraw && FAF_ConnectArea(tsp->sectnum) && tsp->owner >= 0) { - ConnectCopySprite(tsp); + EDUKE32_STATIC_ASSERT(sizeof(uspritetype) == sizeof(tspritetype)); // see TSPRITE_SIZE + ConnectCopySprite((uspriteptr_t)tsp); } // @@ -977,8 +975,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) } #if 1 -uspritetype * -get_tsprite(short SpriteNum) +tspriteptr_t get_tsprite(short SpriteNum) { int tSpriteNum; @@ -996,14 +993,13 @@ post_analyzesprites(void) { int tSpriteNum; short SpriteNum; - uspritetype * tsp; USERp tu; for (tSpriteNum = spritesortcnt - 1; tSpriteNum >= 0; tSpriteNum--) { SpriteNum = tsprite[tSpriteNum].owner; if (SpriteNum < 0) continue; // JBF: verify this is safe - tsp = &tsprite[tSpriteNum]; + tspriteptr_t tsp = &tsprite[tSpriteNum]; tu = User[SpriteNum]; if (tu) @@ -1011,7 +1007,7 @@ post_analyzesprites(void) if (tu->ID == FIREBALL_FLAMES && tu->Attach >= 0) { //uspritetype * const atsp = &sprite[tu->Attach]; - uspritetype * const atsp = get_tsprite(tu->Attach); + tspriteptr_t const atsp = get_tsprite(tu->Attach); if (!atsp) { @@ -1496,7 +1492,7 @@ void SpriteSortList2D(int tx, int ty) if (dist < 22000) { - memcpy(&tsprite[spritesortcnt], sp, sizeof(SPRITE)); + memcpy(&tsprite[spritesortcnt], sp, sizeof(tspritetype)); tsprite[spritesortcnt++].owner = i; } } diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index 16ab9c1a5..05fc7ab5f 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -806,7 +806,7 @@ JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz) } void -DoAutoSize(uspritetype * tspr) +DoAutoSize(tspriteptr_t tspr) { short i; @@ -957,7 +957,8 @@ DoAutoSize(uspritetype * tspr) // Rotation angles for sprites short rotang = 0; -void JAnalyzeSprites(uspritetype * tspr) +void +JAnalyzeSprites(tspriteptr_t tspr) { int i, currsprite; diff --git a/source/sw/src/jsector.h b/source/sw/src/jsector.h index 3ac8a8660..05f53dcba 100644 --- a/source/sw/src/jsector.h +++ b/source/sw/src/jsector.h @@ -70,7 +70,7 @@ extern short floormirrorsector[MAXMIRRORS]; extern SWBOOL mirrorinview; extern short NormalVisibility; -void JAnalyzeSprites(uspritetype * tspr); +void JAnalyzeSprites(tspriteptr_t tspr); void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,short tpang,int tphoriz); void JS_InitMirrors(void); void JS_InitLockouts(void); From 5dcfa1cb0ccbd805c154f3edb8e6d634510cabc5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 10:47:10 +0100 Subject: [PATCH 08/14] - do not use the internal SWCUSTOM.TXT from the Twin Dragon add-on. There's a second variant without this definition, so this needs to be defined internally, and since it needs to be done internally it may receive proper localization labels. --- source/common/filesystem/filesystem.cpp | 31 +++- source/common/filesystem/filesystem.h | 4 +- source/common/gamecontrol.h | 1 + source/common/initfs.cpp | 6 +- source/common/searchpaths.cpp | 8 + wadsrc/static/demolition/demolition.grpinfo | 31 ++++ wadsrc/static/demolition/language.csv | 54 ++---- .../shadowwarrior.twindragon/SWCUSTOM.TXT | 154 ++++++++++++++++++ 8 files changed, 250 insertions(+), 39 deletions(-) create mode 100644 wadsrc/static/filter/shadowwarrior.twindragon/SWCUSTOM.TXT diff --git a/source/common/filesystem/filesystem.cpp b/source/common/filesystem/filesystem.cpp index 759cb4af0..2e5bcc75f 100644 --- a/source/common/filesystem/filesystem.cpp +++ b/source/common/filesystem/filesystem.cpp @@ -100,7 +100,7 @@ void FileSystem::DeleteAll () // //========================================================================== -int FileSystem::InitMultipleFiles (TArray &filenames, const TArray &deletelumps) +int FileSystem::InitMultipleFiles (TArray &filenames, const TArray &deletelumps, int maingamefiles) { int numfiles; @@ -126,6 +126,7 @@ int FileSystem::InitMultipleFiles (TArray &filenames, const TArray &filenames, const TArray& deletelumps, int numgamefiles) +{ + // This must account for the game directory being inserted at index 2. + // Deletion may only occur in the main game file, the directory and the add-on, there are no secondary dependencies, i.e. more than two game files. + numgamefiles++; + if (deletelumps.Size()) + for (uint32_t i = 0; i < FileInfo.Size(); i++) + { + if (FileInfo[i].rfnum >= 1 && FileInfo[i].rfnum <= numgamefiles) + { + auto cmp = FileInfo[i].lump->LumpName[FResourceLump::FullNameType].GetChars(); + for (auto &str : deletelumps) + { + if (!str.CompareNoCase(cmp)) + { + for (auto& n : FileInfo[i].lump->LumpName) n = NAME_None; + } + } + } + } +} + //========================================================================== // // AddFile diff --git a/source/common/filesystem/filesystem.h b/source/common/filesystem/filesystem.h index ae4a02db9..e89f31430 100644 --- a/source/common/filesystem/filesystem.h +++ b/source/common/filesystem/filesystem.h @@ -81,7 +81,9 @@ public: FileSystem () = default; ~FileSystem (); - int InitMultipleFiles (TArray &filenames, const TArray &todelete); + int InitMultipleFiles (TArray &filenames, const TArray &todelete, int maingamefiles); + void DeleteStuff(const TArray& deletelumps, int numgamefiles); + void AddFile (const char *filename, FileReader *wadinfo = NULL, bool nosubdirflag = false); void AddAdditionalFile(const char* filename, FileReader* wadinfo = NULL) {} int CheckIfResourceFileLoaded (const char *name) noexcept; diff --git a/source/common/gamecontrol.h b/source/common/gamecontrol.h index ca1ff4cac..5d3eb9c79 100644 --- a/source/common/gamecontrol.h +++ b/source/common/gamecontrol.h @@ -124,6 +124,7 @@ struct GrpInfo int flags = 0; bool loaddirectory = false; TArray mustcontain; + TArray tobedeleted; TArray loadfiles; TArray loadart; }; diff --git a/source/common/initfs.cpp b/source/common/initfs.cpp index 0bb9a9ee9..fedad69b8 100644 --- a/source/common/initfs.cpp +++ b/source/common/initfs.cpp @@ -378,7 +378,11 @@ void InitFileSystem(TArray& groups) } TArray todelete; - fileSystem.InitMultipleFiles(Files, todelete); + for (auto& g : groups) + { + todelete.Append(g.FileInfo.tobedeleted); + } + fileSystem.InitMultipleFiles(Files, todelete, groups.Size()); FILE* f = fopen("filesystem.dir", "wb"); for (int i = 0; i < fileSystem.GetNumEntries(); i++) diff --git a/source/common/searchpaths.cpp b/source/common/searchpaths.cpp index 0c464bd3b..aa5aa4c08 100644 --- a/source/common/searchpaths.cpp +++ b/source/common/searchpaths.cpp @@ -797,6 +797,14 @@ static TArray ParseGrpInfo(const char *fn, FileReader &fr, TMap Date: Thu, 26 Dec 2019 10:55:43 +0100 Subject: [PATCH 09/14] - disabled the "User Maps" option pending implementation of a working selection menu for exposing this. --- source/common/menu/menudef.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index fd1133e4a..81a450564 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -1260,6 +1260,7 @@ static void BuildEpisodeMenu() } } } +#if 0 // this needs to be backed by a working selection menu, until that gets done it must be disabled. if (!(g_gameType & GAMEFLAG_SHAREWARE)) { //auto it = new FListMenuItemNativeStaticText(ld->mXpos, "", NIT_SmallFont); // empty entry as spacer. @@ -1270,6 +1271,7 @@ static void BuildEpisodeMenu() ld->mItems.Push(it); addedVolumes++; } +#endif if (addedVolumes == 1) { ld->mAutoselect = 0; From d8dfe752b5cf2f37d7addf8e74a538f17efbc865 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 13:04:29 +0100 Subject: [PATCH 10/14] - fixed handling of music in Redneck Rampage and Shadow Warrior. After merging the CD enabling CVAR they had the same default (off) as Blood which is wrong. This also addresses other music related issues, like not properly cycling through the RR music. --- source/blood/src/loadsave.cpp | 2 +- source/common/gamecontrol.cpp | 9 ++++++++- source/common/gamecvars.cpp | 2 +- source/common/music/music.cpp | 9 +++++++-- source/common/music/z_music.h | 3 ++- source/duke3d/src/savegame.cpp | 2 +- source/duke3d/src/screens.cpp | 4 ++-- source/rr/src/premap.cpp | 7 ++++--- source/rr/src/savegame.cpp | 2 +- source/rr/src/screens.cpp | 6 +++--- source/rr/src/sounds.cpp | 27 +++++++++++++++++---------- source/sw/src/save.cpp | 2 +- source/sw/src/scrip2.cpp | 7 +++---- source/sw/src/sounds.cpp | 12 ++++++++---- 14 files changed, 59 insertions(+), 35 deletions(-) diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index 9f3773db7..085afc05f 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -177,7 +177,7 @@ bool GameInterface::LoadGame(FSaveGameNode* node) gGameStarted = 1; bVanilla = false; - MUS_ResumeSaved(); + Mus_ResumeSaved(); netBroadcastPlayerInfo(myconnectindex); return true; diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index 5a4263a1a..3e5d30e16 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -544,6 +544,13 @@ int RunGame() InitFileSystem(usedgroups); if (usedgroups.Size() == 0) return 0; + if (g_gameType & GAMEFLAG_BLOOD) + { + UCVarValue v; + v.Bool = false; + mus_redbook.SetGenericRepDefault(v, CVAR_Bool); // Blood should default to CD Audio off - all other games must default to on. + } + G_ReadConfig(currentGame); V_InitFontColors(); @@ -682,7 +689,7 @@ CCMD(snd_reset) { Mus_Stop(); if (soundEngine) soundEngine->Reset(); - MUS_ResumeSaved(); + Mus_ResumeSaved(); } //========================================================================== diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index 910b80b3e..5fd247310 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -134,7 +134,7 @@ CVARD(Bool, snd_tryformats, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disab CVARD(Bool, snd_doppler, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable 3d sound") CVARD(Bool, mus_restartonload, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "restart the music when loading a saved game with the same map or not") // only implemented for Blood - todo: generalize -CVARD(Bool, mus_redbook, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_FRONTEND_BLOOD, "enables/disables redbook audio (Blood only!)") // only Blood has assets for this. +CVARD(Bool, mus_redbook, true, CVAR_ARCHIVE, "enables/disables redbook audio") CUSTOM_CVARD(Int, snd_fxvolume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls volume for sound effects") { diff --git a/source/common/music/music.cpp b/source/common/music/music.cpp index 340b03124..30e34ec88 100644 --- a/source/common/music/music.cpp +++ b/source/common/music/music.cpp @@ -536,7 +536,7 @@ CCMD (stopmus) static FString lastMusicLevel, lastMusic; int Mus_Play(const char *mapname, const char *fn, bool loop) { - if (mus_blocked) return 0; + if (mus_blocked) return 1; // Caller should believe it succeeded. // Store the requested names for resuming. lastMusicLevel = mapname; lastMusic = fn; @@ -579,6 +579,11 @@ int Mus_Play(const char *mapname, const char *fn, bool loop) return mus_playing.handle != nullptr; } +bool Mus_IsPlaying() +{ + return mus_playing.handle != nullptr; +} + void Mus_Stop() { if (mus_blocked) return; @@ -654,7 +659,7 @@ bool MUS_Restore() return true; } -void MUS_ResumeSaved() +void Mus_ResumeSaved() { S_RestartMusic(); } diff --git a/source/common/music/z_music.h b/source/common/music/z_music.h index e2dff877a..735661f65 100644 --- a/source/common/music/z_music.h +++ b/source/common/music/z_music.h @@ -5,6 +5,7 @@ void Mus_Init(); int Mus_Play(const char *mapname, const char *fn, bool loop); void Mus_Stop(); +bool Mus_IsPlaying(); void Mus_Fade(double seconds); void Mus_SetPaused(bool on); -void MUS_ResumeSaved(); +void Mus_ResumeSaved(); diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 626846a65..814f2ba6a 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -1929,7 +1929,7 @@ static void postloadplayer(int32_t savegamep) Bmemset(gotpic, 0, sizeof(gotpic)); S_ClearSoundLocks(); G_CacheMapData(); - MUS_ResumeSaved(); + Mus_ResumeSaved(); g_player[myconnectindex].ps->gm = MODE_GAME; ud.recstat = 0; diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index eae273ae9..899235086 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -1994,7 +1994,7 @@ void G_BonusScreen(int32_t bonusonly) videoClearScreen(0); G_DisplayMPResultsScreen(); - if (MusicEnabled()) + if (MusicEnabled() && mus_enabled) S_PlaySound(BONUSMUSIC); videoNextPage(); @@ -2033,7 +2033,7 @@ void G_BonusScreen(int32_t bonusonly) gametext_center_shade(192, GStrings("PRESSKEY"), quotepulseshade); - if (MusicEnabled()) + if (MusicEnabled() && mus_enabled) S_PlaySound(BONUSMUSIC); videoNextPage(); diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index d3605feb1..c3717bb17 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -2413,6 +2413,10 @@ int G_EnterLevel(int gameMode) G_CacheMapData(); // G_FadeLoad(0,0,0, 0,252, 28, 4, -2); + // Try this first so that it can disable the CD player if no tracks are found. + if (RR && !(gameMode & MODE_DEMO)) + S_PlayRRMusic(); + if (ud.recstat != 2) { if (Menu_HaveUserMap()) @@ -2422,9 +2426,6 @@ int G_EnterLevel(int gameMode) else S_PlayLevelMusicOrNothing(mii); } - if (RR && !(gameMode & MODE_DEMO)) - S_PlayRRMusic(); - if (gameMode & (MODE_GAME|MODE_EOL)) { for (TRAVERSE_CONNECT(i)) diff --git a/source/rr/src/savegame.cpp b/source/rr/src/savegame.cpp index 60c7e8990..6bc0fd587 100644 --- a/source/rr/src/savegame.cpp +++ b/source/rr/src/savegame.cpp @@ -1543,7 +1543,7 @@ static void postloadplayer(int32_t savegamep) Bmemset(gotpic, 0, sizeof(gotpic)); S_ClearSoundLocks(); G_CacheMapData(); - MUS_ResumeSaved(); + Mus_ResumeSaved(); Mus_SetPaused(false); g_player[myconnectindex].ps->gm = MODE_GAME; diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 10a5a6649..f5523176a 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -2000,7 +2000,7 @@ void G_BonusScreen(int32_t bonusonly) videoClearScreen(0); G_DisplayMPResultsScreen(); - if (MusicEnabled()) + if (MusicEnabled() && mus_enabled) S_PlaySound(BONUSMUSIC); videoNextPage(); @@ -2042,7 +2042,7 @@ void G_BonusScreen(int32_t bonusonly) gametext_center_shade(192, GStrings("PRESSKEY"), quotepulseshade); - if (MusicEnabled()) + if (MusicEnabled() && mus_enabled) S_PlaySound(BONUSMUSIC); } else @@ -2579,7 +2579,7 @@ void G_BonusScreenRRRA(int32_t bonusonly) videoClearScreen(0); G_DisplayMPResultsScreen(); - if (MusicEnabled()) + if (MusicEnabled() && mus_enabled) S_PlaySound(BONUSMUSIC); videoNextPage(); diff --git a/source/rr/src/sounds.cpp b/source/rr/src/sounds.cpp index 3dcba9cff..252d6f592 100644 --- a/source/rr/src/sounds.cpp +++ b/source/rr/src/sounds.cpp @@ -314,10 +314,8 @@ void S_Update(void) vec3_t* c; int32_t ca, cs; -#if 0 - if (RR /*&& todo: fix the conditions here */ ) + if (RR && Mus_IsPlaying()) S_PlayRRMusic(); -#endif S_GetCamera(&c, &ca, &cs); @@ -552,6 +550,8 @@ void S_MenuSound(void) // //========================================================================== +static bool cd_disabled = false; // This is in case mus_redbook is enabled but no tracks found so that the regular music system can be switched on. + static void S_SetMusicIndex(unsigned int m) { ud.music_episode = m / MAXLEVELS; @@ -560,6 +560,7 @@ static void S_SetMusicIndex(unsigned int m) void S_PlayLevelMusicOrNothing(unsigned int m) { + if (RR && mus_redbook && !cd_disabled) return; auto& mr = m == USERMAPMUSICFAKESLOT ? userMapRecord : mapList[m]; Mus_Play(mr.labelName, mr.music, true); S_SetMusicIndex(m); @@ -567,6 +568,7 @@ void S_PlayLevelMusicOrNothing(unsigned int m) int S_TryPlaySpecialMusic(unsigned int m) { + if (RR) return 0; // Can only be MUS_LOADING, RR does not use it. auto& musicfn = mapList[m].music; if (musicfn.IsNotEmpty()) { @@ -590,16 +592,21 @@ void S_PlaySpecialMusicOrNothing(unsigned int m) void S_PlayRRMusic(int newTrack) { - char fileName[16]; - if (!RR || !mus_redbook) + if (!RR || !mus_redbook || cd_disabled) return; Mus_Stop(); - g_cdTrack = newTrack != -1 ? newTrack : g_cdTrack + 1; - if (newTrack != 10 && (g_cdTrack > 9 || g_cdTrack < 2)) - g_cdTrack = 2; - Bsprintf(fileName, "track%.2d.ogg", g_cdTrack); - Mus_Play(fileName, 0, true); + for (int i = 0; i < 10; i++) + { + g_cdTrack = newTrack != -1 ? newTrack : g_cdTrack + 1; + if (newTrack != 10 && (g_cdTrack > 9 || g_cdTrack < 2)) + g_cdTrack = 2; + + FStringf filename("track%02d.ogg", g_cdTrack); + if (Mus_Play(nullptr, 0, false)) return; + } + // If none of the tracks managed to start, disable the CD music for this session so that regular music can play if defined. + cd_disabled = true; } diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 2faa576e6..204c0163d 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -1209,7 +1209,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) screenpeek = myconnectindex; PlayingLevel = Level; - MUS_ResumeSaved(); + Mus_ResumeSaved(); if (snd_ambience) StartAmbientSound(); diff --git a/source/sw/src/scrip2.cpp b/source/sw/src/scrip2.cpp index 80dcddc2d..b1aad0ae2 100644 --- a/source/sw/src/scrip2.cpp +++ b/source/sw/src/scrip2.cpp @@ -616,25 +616,24 @@ void LoadCustomInfoFromScript(const char *filename) case CM_BESTTIME: { int n; - char s[10]; if (scriptfile_getnumber(script, &n)) break; - mapList[curmap].designerTime = (int)strtoll(s, nullptr, 0); + mapList[curmap].designerTime = n; break; } case CM_PARTIME: { int n; - char s[10]; if (scriptfile_getnumber(script, &n)) break; - mapList[curmap].parTime = (int)strtoll(s, nullptr, 0); + mapList[curmap].parTime = n; break; } case CM_CDATRACK: { int n; if (scriptfile_getnumber(script, &n)) break; + mapList[curmap].cdSongId = n; break; } default: diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index 5e386707c..0a30cece2 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -922,7 +922,6 @@ int PlayerYellVocs[] = //========================================================================== extern short Level; -CVAR(Bool, sw_nothememidi, false, CVAR_ARCHIVE) SWBOOL PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music. { @@ -935,13 +934,18 @@ SWBOOL PlaySong(const char* mapname, const char* song_file_name, int cdaudio_tra if (cdaudio_track >= 0 && mus_redbook) { FStringf trackname("track%02d.ogg", cdaudio_track); - if (!Mus_Play(nullptr, trackname, true)) + if (!Mus_Play(mapname, trackname, true)) { buildprintf("Can't find CD track %i!\n", cdaudio_track); } } - else if (isThemeTrack && sw_nothememidi) return false; // The original SW source only used CD Audio for theme tracks, so this is optional. - return Mus_Play(nullptr, song_file_name, true); + if (!Mus_Play(mapname, song_file_name, true)) + { + // try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing id mus_redbook is off.) + FStringf trackname("track%02d.ogg", cdaudio_track); + if (!Mus_Play(nullptr, trackname, true)) return false; + } + return true; } void StopSound(void) From 7f62208bad7282d869261a56bac486c98d0bd4c7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 13:31:48 +0100 Subject: [PATCH 11/14] - renamed demolition.grpinfo to grpinfo.txt. --- source/common/searchpaths.cpp | 4 ++-- wadsrc/static/demolition/{demolition.grpinfo => grpinfo.txt} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename wadsrc/static/demolition/{demolition.grpinfo => grpinfo.txt} (100%) diff --git a/source/common/searchpaths.cpp b/source/common/searchpaths.cpp index aa5aa4c08..9c85d0da0 100644 --- a/source/common/searchpaths.cpp +++ b/source/common/searchpaths.cpp @@ -847,13 +847,13 @@ TArray ParseAllGrpInfos(TArray& filelist) engine_res.reset(FResourceFile::OpenResourceFile(baseres, true, true)); if (engine_res) { - auto basegrp = engine_res->FindLump("demolition/demolition.grpinfo"); + auto basegrp = engine_res->FindLump("demolition/grpinfo.txt"); if (basegrp) { auto fr = basegrp->NewReader(); if (fr.isOpen()) { - groups = ParseGrpInfo("demolition/demolition.grpinfo", fr, CRCMap); + groups = ParseGrpInfo("demolition/grpinfo.txt", fr, CRCMap); } } } diff --git a/wadsrc/static/demolition/demolition.grpinfo b/wadsrc/static/demolition/grpinfo.txt similarity index 100% rename from wadsrc/static/demolition/demolition.grpinfo rename to wadsrc/static/demolition/grpinfo.txt From 62e9112133f3e2ead90652576063d74e855fcfd0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 14:04:53 +0100 Subject: [PATCH 12/14] - renamed the internal resource directory to "engine" and routed most literal mentions of the engine name through version.h All this comes from a time when I didn't use version.h so it's better to do it the same way as GZDoom to allow easy renaming of the engine. --- source/build/src/engine.cpp | 5 +++-- source/common/console/c_bind.cpp | 4 ++-- source/common/fonts/v_font.cpp | 10 +++++----- source/common/gamecontrol.cpp | 8 ++++---- source/common/initfs.cpp | 3 ++- source/common/menu/menu.cpp | 4 ++-- source/common/menu/menudef.cpp | 2 +- source/common/music/i_music.cpp | 2 +- source/common/music/i_soundfont.cpp | 3 ++- source/common/music/music_config.cpp | 5 +++-- source/common/music/s_advsound.cpp | 2 +- source/common/ns.h | 7 ------- source/common/rendering/v_video.cpp | 2 +- source/common/screenshot.cpp | 2 +- source/common/searchpaths.cpp | 7 ++++--- source/common/statistics.cpp | 3 ++- source/common/utility/stringtable.cpp | 4 ++-- source/common/version.h | 9 +++++---- source/duke3d/src/duke3d.h | 2 -- source/duke3d/src/game.cpp | 2 +- source/duke3d/src/gameexec.cpp | 9 ++++++--- source/glbackend/glbackend.cpp | 16 ++++++++-------- source/platform/win32/i_specialpaths.cpp | 17 ++++++----------- source/rr/src/duke3d.h | 2 -- source/rr/src/game.cpp | 2 +- source/rr/src/gameexec.cpp | 7 +++++-- source/sw/src/game.cpp | 2 +- .../static/{demolition => engine}/GENMIDI.op2 | Bin .../{demolition => engine}/Roboto-Regular.ttf | Bin .../{demolition => engine}/commonbinds.txt | 0 .../static/{demolition => engine}/confont.lmp | Bin .../static/{demolition => engine}/defbinds.txt | 0 .../static/{demolition => engine}/dsempty.lmp | Bin .../{demolition => engine}/graphics/M_BACK.png | Bin .../static/{demolition => engine}/grpinfo.txt | 0 .../static/{demolition => engine}/language.csv | 0 .../{demolition => engine}/leftbinds.txt | 0 .../static/{demolition => engine}/menudef.txt | 0 .../{demolition => engine}/newconsolefont.hex | 0 .../{demolition => engine}/origbinds.txt | 0 .../shaders/glsl/animvpx.fp | 0 .../shaders/glsl/animvpx.vp | 0 .../shaders/glsl/glsurface.fp | 0 .../shaders/glsl/glsurface.vp | 0 .../shaders/glsl/polymost.fp | 0 .../shaders/glsl/polymost.vp | 0 .../{demolition => engine}/textcolors.txt | 0 .../{demolition => engine}/combatmacros.txt | 0 .../blood/{demolition => engine}/defbinds.txt | 0 .../blood/{demolition => engine}/leftbinds.txt | 0 .../blood/{demolition => engine}/origbinds.txt | 0 .../{demolition => engine}/combatmacros.txt | 0 .../duke/{demolition => engine}/defbinds.txt | 0 .../duke/{demolition => engine}/leftbinds.txt | 0 .../duke/{demolition => engine}/origbinds.txt | 0 .../{demolition => engine}/combatmacros.txt | 0 .../{demolition => engine}/defbinds.txt | 0 .../{demolition => engine}/graphics/M_BACK.png | Bin .../{demolition => engine}/leftbinds.txt | 0 .../{demolition => engine}/origbinds.txt | 0 .../{demolition => engine}/combatmacros.txt | 0 .../nam/{demolition => engine}/defbinds.txt | 0 .../{demolition => engine}/graphics/M_BACK.png | Bin .../nam/{demolition => engine}/leftbinds.txt | 0 .../nam/{demolition => engine}/origbinds.txt | 0 .../{demolition => engine}/combatmacros.txt | 0 .../{demolition => engine}/defbinds.txt | 0 .../{demolition => engine}/graphics/M_BACK.png | Bin .../{demolition => engine}/leftbinds.txt | 0 .../{demolition => engine}/origbinds.txt | 0 .../{demolition => engine}/SWCustom.txt | 0 .../{demolition => engine}/combatmacros.txt | 0 .../{demolition => engine}/defbinds.txt | 0 .../{demolition => engine}/leftbinds.txt | 0 .../{demolition => engine}/origbinds.txt | 0 .../{demolition => engine}/combatmacros.txt | 0 .../ww2gi/{demolition => engine}/defbinds.txt | 0 .../{demolition => engine}/graphics/M_BACK.png | Bin .../ww2gi/{demolition => engine}/leftbinds.txt | 0 .../ww2gi/{demolition => engine}/origbinds.txt | 0 80 files changed, 69 insertions(+), 72 deletions(-) rename wadsrc/static/{demolition => engine}/GENMIDI.op2 (100%) rename wadsrc/static/{demolition => engine}/Roboto-Regular.ttf (100%) rename wadsrc/static/{demolition => engine}/commonbinds.txt (100%) rename wadsrc/static/{demolition => engine}/confont.lmp (100%) rename wadsrc/static/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/{demolition => engine}/dsempty.lmp (100%) rename wadsrc/static/{demolition => engine}/graphics/M_BACK.png (100%) rename wadsrc/static/{demolition => engine}/grpinfo.txt (100%) rename wadsrc/static/{demolition => engine}/language.csv (100%) rename wadsrc/static/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/{demolition => engine}/menudef.txt (100%) rename wadsrc/static/{demolition => engine}/newconsolefont.hex (100%) rename wadsrc/static/{demolition => engine}/origbinds.txt (100%) rename wadsrc/static/{demolition => engine}/shaders/glsl/animvpx.fp (100%) rename wadsrc/static/{demolition => engine}/shaders/glsl/animvpx.vp (100%) rename wadsrc/static/{demolition => engine}/shaders/glsl/glsurface.fp (100%) rename wadsrc/static/{demolition => engine}/shaders/glsl/glsurface.vp (100%) rename wadsrc/static/{demolition => engine}/shaders/glsl/polymost.fp (100%) rename wadsrc/static/{demolition => engine}/shaders/glsl/polymost.vp (100%) rename wadsrc/static/{demolition => engine}/textcolors.txt (100%) rename wadsrc/static/filter/blood/{demolition => engine}/combatmacros.txt (100%) rename wadsrc/static/filter/blood/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/filter/blood/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/filter/blood/{demolition => engine}/origbinds.txt (100%) rename wadsrc/static/filter/duke/{demolition => engine}/combatmacros.txt (100%) rename wadsrc/static/filter/duke/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/filter/duke/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/filter/duke/{demolition => engine}/origbinds.txt (100%) rename wadsrc/static/filter/ionfury/{demolition => engine}/combatmacros.txt (100%) rename wadsrc/static/filter/ionfury/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/filter/ionfury/{demolition => engine}/graphics/M_BACK.png (100%) rename wadsrc/static/filter/ionfury/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/filter/ionfury/{demolition => engine}/origbinds.txt (100%) rename wadsrc/static/filter/nam/{demolition => engine}/combatmacros.txt (100%) rename wadsrc/static/filter/nam/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/filter/nam/{demolition => engine}/graphics/M_BACK.png (100%) rename wadsrc/static/filter/nam/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/filter/nam/{demolition => engine}/origbinds.txt (100%) rename wadsrc/static/filter/redneck/{demolition => engine}/combatmacros.txt (100%) rename wadsrc/static/filter/redneck/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/filter/redneck/{demolition => engine}/graphics/M_BACK.png (100%) rename wadsrc/static/filter/redneck/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/filter/redneck/{demolition => engine}/origbinds.txt (100%) rename wadsrc/static/filter/shadowwarrior/{demolition => engine}/SWCustom.txt (100%) rename wadsrc/static/filter/shadowwarrior/{demolition => engine}/combatmacros.txt (100%) rename wadsrc/static/filter/shadowwarrior/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/filter/shadowwarrior/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/filter/shadowwarrior/{demolition => engine}/origbinds.txt (100%) rename wadsrc/static/filter/ww2gi/{demolition => engine}/combatmacros.txt (100%) rename wadsrc/static/filter/ww2gi/{demolition => engine}/defbinds.txt (100%) rename wadsrc/static/filter/ww2gi/{demolition => engine}/graphics/M_BACK.png (100%) rename wadsrc/static/filter/ww2gi/{demolition => engine}/leftbinds.txt (100%) rename wadsrc/static/filter/ww2gi/{demolition => engine}/origbinds.txt (100%) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index a51456f77..c0e39bc6b 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -28,6 +28,7 @@ #include "imgui.h" #include "stats.h" #include "menu.h" +#include "version.h" #ifdef USE_OPENGL # include "glsurface.h" @@ -1454,8 +1455,8 @@ static int32_t bakrendmode; #endif static int32_t baktile; -#ifdef APPNAME -char apptitle[256] = APPNAME; +#ifdef GAMENAME +char apptitle[256] = GAMENAME; #else char apptitle[256] = "Build Engine"; #endif diff --git a/source/common/console/c_bind.cpp b/source/common/console/c_bind.cpp index cfa0b9f4f..368fb335d 100644 --- a/source/common/console/c_bind.cpp +++ b/source/common/console/c_bind.cpp @@ -682,7 +682,7 @@ void ReadBindings(int lump, bool override) void CONFIG_SetDefaultKeys(const char* baseconfig) { - auto lump = fileSystem.GetFile("demolition/commonbinds.txt", ELookupMode::FullName, 0); + auto lump = fileSystem.GetFile("engine/commonbinds.txt", ELookupMode::FullName, 0); if (lump >= 0) ReadBindings(lump, true); int lastlump = 0; @@ -700,7 +700,7 @@ void CONFIG_SetDefaultKeys(const char* baseconfig) void C_BindDefaults() { - CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt"); + CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "engine/origbinds.txt" : cl_defaultconfiguration == 2 ? "engine/leftbinds.txt" : "engine/defbinds.txt"); } #if 0 diff --git a/source/common/fonts/v_font.cpp b/source/common/fonts/v_font.cpp index da2caa409..9458fae6f 100644 --- a/source/common/fonts/v_font.cpp +++ b/source/common/fonts/v_font.cpp @@ -404,7 +404,7 @@ void V_InitFontColors () TranslationLookup.Clear(); TranslationColors.Clear(); - while ((lump = fileSystem.Iterate("demolition/textcolors.txt", &lastlump)) != -1) + while ((lump = fileSystem.Iterate("engine/textcolors.txt", &lastlump)) != -1) { FScanner sc(lump); while (sc.GetString()) @@ -714,13 +714,13 @@ void V_InitFonts() FFont *CreateHexLumpFont(const char *fontname, const char* lump); FFont *CreateHexLumpFont2(const char *fontname, const char * lump); - if (fileSystem.FindFile("demolition/newconsolefont.hex") < 0) + if (fileSystem.FindFile("engine/newconsolefont.hex") < 0) I_Error("newconsolefont.hex not found"); // This font is needed - do not start up without it. - NewConsoleFont = CreateHexLumpFont("NewConsoleFont", "demolition/newconsolefont.hex"); - NewSmallFont = CreateHexLumpFont2("NewSmallFont", "demolition/newconsolefont.hex"); + NewConsoleFont = CreateHexLumpFont("NewConsoleFont", "engine/newconsolefont.hex"); + NewSmallFont = CreateHexLumpFont2("NewSmallFont", "engine/newconsolefont.hex"); CurrentConsoleFont = NewConsoleFont; - ConFont = V_GetFont("ConsoleFont", "demolition/confont.lmp"); // The con font is needed for the slider graphics + ConFont = V_GetFont("ConsoleFont", "engine/confont.lmp"); // The con font is needed for the slider graphics SmallFont = ConFont; // This is so that it doesn't crash and that it immediately gets seen as a proble. The SmallFont should later be mapped to the small game font. } diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index 3e5d30e16..273958146 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -521,7 +521,7 @@ int RunGame() FString logfile = Args->TakeValue("+logfile"); // As long as this engine is still in prerelease mode let's always write a log file. - if (logfile.IsEmpty()) logfile.Format("%sdemolition.log", M_GetDocumentsPath().GetChars()); + if (logfile.IsEmpty()) logfile.Format("%s" GAMENAMELOWERCASE ".log", M_GetDocumentsPath().GetChars()); if (logfile.IsNotEmpty()) { @@ -576,7 +576,7 @@ int RunGame() TileFiles.AddArt(addArt); inputState.ClearAllInput(); - CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt"); + CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "engine/origbinds.txt" : cl_defaultconfiguration == 2 ? "engine/leftbinds.txt" : "engine/defbinds.txt"); if (!GameConfig->IsInitialized()) { @@ -589,7 +589,7 @@ int RunGame() } V_InitFonts(); C_CON_SetAliases(); - sfx_empty = fileSystem.FindFile("demolition/dsempty.lmp"); // this must be done outside the sound code because it's initialized late. + sfx_empty = fileSystem.FindFile("engine/dsempty.lmp"); // this must be done outside the sound code because it's initialized late. Mus_Init(); InitStatistics(); M_Init(); @@ -639,7 +639,7 @@ FStringCVar* const CombatMacros[] = { &combatmacro0, &combatmacro1, &combatmacro void CONFIG_ReadCombatMacros() { FScanner sc; - sc.Open("demolition/combatmacros.txt"); + sc.Open("engine/combatmacros.txt"); for (auto s : CombatMacros) { sc.MustGetToken(TK_StringConst); diff --git a/source/common/initfs.cpp b/source/common/initfs.cpp index fedad69b8..4a1bd31c5 100644 --- a/source/common/initfs.cpp +++ b/source/common/initfs.cpp @@ -41,6 +41,7 @@ #include "gameconfigfile.h" #include "printf.h" #include "m_argv.h" +#include "version.h" #include "../platform/win32/i_findfile.h" // This is a temporary direct path. Needs to be fixed when stuff gets cleaned up. #ifndef PATH_MAX @@ -296,7 +297,7 @@ void InitFileSystem(TArray& groups) TArray Files; // First comes the engine's own stuff. - FString baseres = progdir + "demolition.pk3"; + FString baseres = progdir + ENGINERES_FILE; D_AddFile(Files, baseres); bool insertdirectoriesafter = Args->CheckParm("-insertdirafter"); diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index 3d0c9c0be..7d01f7e5f 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -265,7 +265,7 @@ bool DMenu::MouseEventBack(int type, int x, int y) { if (m_show_backbutton >= 0) { - FTexture* tex = TileFiles.GetTexture("demolition/graphics/m_back.png"); + FTexture* tex = TileFiles.GetTexture("engine/graphics/m_back.png"); if (tex != NULL) { if (m_show_backbutton&1) x -= screen->GetWidth() - tex->GetWidth() * CleanXfac; @@ -321,7 +321,7 @@ void DMenu::Drawer () { if (this == DMenu::CurrentMenu && BackbuttonAlpha > 0 && m_show_backbutton >= 0 && m_use_mouse) { - FTexture* tex = TileFiles.GetTexture("demolition/graphics/m_back.png"); + FTexture* tex = TileFiles.GetTexture("engine/graphics/m_back.png"); int w = tex->GetWidth() * CleanXfac; int h = tex->GetHeight() * CleanYfac; int x = (!(m_show_backbutton&1))? 0:screen->GetWidth() - w; diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index 81a450564..29e421df7 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -1145,7 +1145,7 @@ void M_ParseMenuDefs() DefaultOptionMenuSettings.Reset(); M_DeinitMenus(); - while ((lump = fileSystem.Iterate("demolition/menudef.txt", &lastlump)) != -1) + while ((lump = fileSystem.Iterate("engine/menudef.txt", &lastlump)) != -1) { FScanner sc(lump); diff --git a/source/common/music/i_music.cpp b/source/common/music/i_music.cpp index dd4093b1f..638b3a99c 100644 --- a/source/common/music/i_music.cpp +++ b/source/common/music/i_music.cpp @@ -226,7 +226,7 @@ static void SetupGenMidi() { // The OPL renderer should not care about where this comes from. // Note: No I_Error here - this needs to be consistent with the rest of the music code. - auto lump = fileSystem.FindFile("demolition/genmidi.op2"); + auto lump = fileSystem.FindFile("engine/genmidi.op2"); if (lump < 0) { Printf("No GENMIDI lump found. OPL playback not available."); diff --git a/source/common/music/i_soundfont.cpp b/source/common/music/i_soundfont.cpp index 666c07544..46c6a32d5 100644 --- a/source/common/music/i_soundfont.cpp +++ b/source/common/music/i_soundfont.cpp @@ -40,6 +40,7 @@ #include "filereadermusicinterface.h" #include "zmusic/zmusic.h" #include "resourcefile.h" +#include "version.h" #include "../platform/win32/i_findfile.h" // This is a temporary direct path. Needs to be fixed when stuff gets cleaned up. //========================================================================== @@ -436,7 +437,7 @@ void FSoundFontManager::CollectSoundfonts() if (soundfonts.Size() == 0) { - ProcessOneFile(NicePath("$PROGDIR/soundfonts/demolition.sf2")); + ProcessOneFile(NicePath("$PROGDIR/soundfonts/" GAMENAMELOWERCASE ".sf2")); } } diff --git a/source/common/music/music_config.cpp b/source/common/music/music_config.cpp index 2f8cc98ab..a4762ee9f 100644 --- a/source/common/music/music_config.cpp +++ b/source/common/music/music_config.cpp @@ -38,6 +38,7 @@ #include #include "c_cvars.h" #include "s_music.h" +#include "version.h" #include "zmusic/zmusic.h" //========================================================================== @@ -74,7 +75,7 @@ CUSTOM_CVAR(String, fluid_lib, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTU FORWARD_STRING_CVAR(fluid_lib); } -CUSTOM_CVAR(String, fluid_patchset, "demolition", CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL) +CUSTOM_CVAR(String, fluid_patchset, GAMENAMELOWERCASE, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL) { FORWARD_STRING_CVAR(fluid_patchset); } @@ -273,7 +274,7 @@ CUSTOM_CVAR(Float, min_sustain_time, 5000, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CV FORWARD_CVAR(min_sustain_time); } -CUSTOM_CVAR(String, timidity_config, "demolition", CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL) +CUSTOM_CVAR(String, timidity_config, GAMENAMELOWERCASE, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL) { FORWARD_STRING_CVAR(timidity_config); } diff --git a/source/common/music/s_advsound.cpp b/source/common/music/s_advsound.cpp index aeaae7d36..f236adc14 100644 --- a/source/common/music/s_advsound.cpp +++ b/source/common/music/s_advsound.cpp @@ -97,7 +97,7 @@ void S_ParseSndInfo () { int lump, lastlump = 0; - while ((lump = fileSystem.Iterate("demolition/mussetting.txt", &lastlump)) >= 0) + while ((lump = fileSystem.Iterate("engine/mussetting.txt", &lastlump)) >= 0) { S_AddSNDINFO (lump); } diff --git a/source/common/ns.h b/source/common/ns.h index e7a3b0d85..48e8230e9 100644 --- a/source/common/ns.h +++ b/source/common/ns.h @@ -30,10 +30,3 @@ #endif -#ifndef APPNAME -#define APPNAME "Demolition" -#endif - -#ifndef APPBASENAME -#define APPBASENAME "demolition" -#endif diff --git a/source/common/rendering/v_video.cpp b/source/common/rendering/v_video.cpp index 8cc554bbf..c323fd1af 100644 --- a/source/common/rendering/v_video.cpp +++ b/source/common/rendering/v_video.cpp @@ -373,7 +373,7 @@ FString V_GetColorStringByName (const char *name, FScriptPosition *sc) if (fileSystem.GetNumEntries()==0) return FString(); - rgblump = fileSystem.FindFile ("demolition/X11R6RGB.txt"); + rgblump = fileSystem.FindFile ("engine/X11R6RGB.txt"); if (rgblump == -1) { if (!sc) Printf ("X11R6RGB lump not found\n"); diff --git a/source/common/screenshot.cpp b/source/common/screenshot.cpp index 305bbc24a..5b4fc1be8 100644 --- a/source/common/screenshot.cpp +++ b/source/common/screenshot.cpp @@ -76,7 +76,7 @@ CVAR(String, screenshot_dir, "", CVAR_ARCHIVE) // same here. static void WritePNGfile(FileWriter* file, const uint8_t* buffer, const PalEntry* palette, ESSType color_type, int width, int height, int pitch, float gamma) { - FStringf software("Demolition %s", GetVersionString()); + FStringf software(GAMENAME " %s", GetVersionString()); if (!M_CreatePNG(file, buffer, palette, color_type, width, height, pitch, gamma) || !M_AppendPNGText(file, "Software", software) || !M_FinishPNG(file)) diff --git a/source/common/searchpaths.cpp b/source/common/searchpaths.cpp index 9c85d0da0..0d02ab48a 100644 --- a/source/common/searchpaths.cpp +++ b/source/common/searchpaths.cpp @@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "resourcefile.h" #include "printf.h" #include "common.h" +#include "version.h" #include "gamecontrol.h" #include "filesystem/filesystem.h" @@ -843,17 +844,17 @@ TArray ParseAllGrpInfos(TArray& filelist) extern FString progdir; // This opens the base resource only for reading the grpinfo from it which we need before setting up the game state. std::unique_ptr engine_res; - FString baseres = progdir + "demolition.pk3"; + FString baseres = progdir + ENGINERES_FILE; engine_res.reset(FResourceFile::OpenResourceFile(baseres, true, true)); if (engine_res) { - auto basegrp = engine_res->FindLump("demolition/grpinfo.txt"); + auto basegrp = engine_res->FindLump("engine/grpinfo.txt"); if (basegrp) { auto fr = basegrp->NewReader(); if (fr.isOpen()) { - groups = ParseGrpInfo("demolition/grpinfo.txt", fr, CRCMap); + groups = ParseGrpInfo("engine/grpinfo.txt", fr, CRCMap); } } } diff --git a/source/common/statistics.cpp b/source/common/statistics.cpp index 8405e541c..746a37b75 100644 --- a/source/common/statistics.cpp +++ b/source/common/statistics.cpp @@ -48,9 +48,10 @@ #include "savegamehelp.h" #include "sjson.h" #include "gstrings.h" +#include "version.h" CVAR(Int, savestatistics, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -CVAR(String, statfile, "demolitionstat.txt", CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CVAR(String, statfile, GAMENAMELOWERCASE "stat.txt", CVAR_ARCHIVE|CVAR_GLOBALCONFIG) //========================================================================== // diff --git a/source/common/utility/stringtable.cpp b/source/common/utility/stringtable.cpp index 5f5b9809f..eca32f315 100644 --- a/source/common/utility/stringtable.cpp +++ b/source/common/utility/stringtable.cpp @@ -61,13 +61,13 @@ void FStringTable::LoadStrings () int lastlump, lump; lastlump = 0; - while ((lump = fileSystem.Iterate("demolition/lmacros", &lastlump, ELookupMode::NoExtension)) != -1) + while ((lump = fileSystem.Iterate("engine/lmacros", &lastlump, ELookupMode::NoExtension)) != -1) { readMacros(lump); } lastlump = 0; - while ((lump = fileSystem.Iterate ("demolition/language", &lastlump, ELookupMode::NoExtension)) != -1) + while ((lump = fileSystem.Iterate ("engine/language", &lastlump, ELookupMode::NoExtension)) != -1) { auto lumpdata = fileSystem.GetFileData(lump); diff --git a/source/common/version.h b/source/common/version.h index 8fce4a3ca..0f3ae30c4 100644 --- a/source/common/version.h +++ b/source/common/version.h @@ -58,11 +58,12 @@ const char *GetVersionString(); #define GAMENAMELOWERCASE "demolition" #define FORUM_URL "http://forum.zdoom.org/" #define BUGS_FORUM_URL "http://forum.zdoom.org/viewforum.php?f=2" // fixme before release!!! +#define ENGINERES_FILE GAMENAMELOWERCASE ".pk3" -#define SAVESIG_DN3D "Demolition.Duke" -#define SAVESIG_BLD "Demolition.Blood" -#define SAVESIG_RR "Demolition.Redneck" -#define SAVESIG_SW "Demolition.SW" +#define SAVESIG_DN3D GAMENAME ".Duke" +#define SAVESIG_BLD GAMENAME "Blood" +#define SAVESIG_RR GAMENAME "Redneck" +#define SAVESIG_SW GAMENAME "SW" #define MINSAVEVER_DN3D 1 #define MINSAVEVER_BLD 1 diff --git a/source/duke3d/src/duke3d.h b/source/duke3d/src/duke3d.h index 0fd7fb128..241fce099 100644 --- a/source/duke3d/src/duke3d.h +++ b/source/duke3d/src/duke3d.h @@ -36,8 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menu/menu.h" #include "memarena.h" -#define HEAD2 APPNAME - #ifdef EDUKE32_STANDALONE #define VOLUMEALL (1) #define PLUTOPAK (1) diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index e16daa1ca..a1345ab51 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -263,7 +263,7 @@ void G_GameExit(const char *msg) { if (!(msg[0] == ' ' && msg[1] == 0)) { - I_Error("%s", msg); + I_FatalError("%s", msg); } } throw ExitEvent(0); diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index c74162c37..4a60ee240 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -41,6 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c_dispatch.h" #include "quotemgr.h" #include "mapinfo.h" +#include "version.h" #include "debugbreak.h" extern bool rotatesprite_2doverride; @@ -3776,7 +3777,7 @@ badindex: quoteMgr.InitializeQuote(q, g_player[vm.playerNum].user_name); break; case STR_VERSION: - Bsprintf(tempbuf, HEAD2 " %s", GetGitDescription()); + Bsprintf(tempbuf, GAMENAME " %s", GetGitDescription()); quoteMgr.InitializeQuote(q, tempbuf); break; case STR_GAMETYPE: quoteMgr.InitializeQuote(q, g_gametypeNames[ud.coop]); break; @@ -6222,12 +6223,14 @@ badindex: vmErrorCase: // you're not supposed to be here VM_ScriptInfo(insptr, 64); debug_break(); - G_GameExit("An error has occurred in the " APPNAME " virtual machine.\n\n" - "If you are an end user, please e-mail the file " APPBASENAME ".log\n" + G_GameExit("An error has occurred in the " GAMENAME " virtual machine.\n\n"); +#if 0 + "If you are an end user, please e-mail the file " GAMENAMELOWERCASE ".log\n" "along with links to any mods you're using to development@voidpoint.com.\n\n" "If you are a developer, please attach all of your script files\n" "along with instructions on how to reproduce this error.\n\n" "Thank you!"); +#endif } #ifndef CON_USE_COMPUTED_GOTO } diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index a9aa4f995..aec7b1ad3 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -98,8 +98,8 @@ void GLInstance::Init(int ydim) ImGui_ImplOpenGL3_Init(); if (!ttf.Size()) { - //ttf = fileSystem.LoadFile("demolition/Capsmall_clean.ttf", 0); - ttf = fileSystem.LoadFile("demolition/Roboto-Regular.ttf", 0); + //ttf = fileSystem.LoadFile("engine/Capsmall_clean.ttf", 0); + ttf = fileSystem.LoadFile("engine/Roboto-Regular.ttf", 0); } if (ttf.Size()) io.Fonts->AddFontFromMemoryTTF(ttf.Data(), ttf.Size(), std::clamp(ydim / 40, 10, 30)); #endif @@ -107,9 +107,9 @@ void GLInstance::Init(int ydim) void GLInstance::LoadPolymostShader() { - auto fr1 = GetResource("demolition/shaders/glsl/polymost.vp"); + auto fr1 = GetResource("engine/shaders/glsl/polymost.vp"); TArray Vert = fr1.Read(); - fr1 = GetResource("demolition/shaders/glsl/polymost.fp"); + fr1 = GetResource("engine/shaders/glsl/polymost.fp"); TArray Frag = fr1.Read(); // Zero-terminate both strings. Vert.Push(0); @@ -121,9 +121,9 @@ void GLInstance::LoadPolymostShader() void GLInstance::LoadVPXShader() { - auto fr1 = GetResource("demolition/shaders/glsl/animvpx.vp"); + auto fr1 = GetResource("engine/shaders/glsl/animvpx.vp"); TArray Vert = fr1.Read(); - fr1 = GetResource("demolition/shaders/glsl/animvpx.fp"); + fr1 = GetResource("engine/shaders/glsl/animvpx.fp"); TArray Frag = fr1.Read(); // Zero-terminate both strings. Vert.Push(0); @@ -134,9 +134,9 @@ void GLInstance::LoadVPXShader() void GLInstance::LoadSurfaceShader() { - auto fr1 = GetResource("demolition/shaders/glsl/glsurface.vp"); + auto fr1 = GetResource("engine/shaders/glsl/glsurface.vp"); TArray Vert = fr1.Read(); - fr1 = GetResource("demolition/shaders/glsl/glsurface.fp"); + fr1 = GetResource("engine/shaders/glsl/glsurface.fp"); TArray Frag = fr1.Read(); // Zero-terminate both strings. Vert.Push(0); diff --git a/source/platform/win32/i_specialpaths.cpp b/source/platform/win32/i_specialpaths.cpp index 9a07e0584..a64cb03fc 100644 --- a/source/platform/win32/i_specialpaths.cpp +++ b/source/platform/win32/i_specialpaths.cpp @@ -44,14 +44,11 @@ #include "i_findfile.h" #include "gamecontrol.h" #include "m_argv.h" -//#include "version.h" // for GAMENAME +#include "version.h" // for GAMENAME // Stuff that needs to be set up later. FString progdir; static bool batchrun; -#define GAMENAMELOWERCASE "demolition" -#define GAMENAME "Demolition" -#define GAME_DIR "demolition" // Vanilla MinGW does not have folder ids #if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) @@ -136,8 +133,6 @@ FString M_GetAppDataPath(bool create) { // Failed (e.g. On Win9x): use program directory path = progdir; } - // Don't use GAME_DIR and such so that demolition and its child ports can - // share the node cache. path += "/" GAMENAMELOWERCASE; path.Substitute("//", "/"); // needed because progdir ends with a slash. if (create) @@ -165,8 +160,8 @@ FString M_GetAutoexecPath() // M_GetConfigPath Windows // // Returns the path to the config file. On Windows, this can vary for reading -// vs writing. i.e. If $PROGDIR/demolition-.ini does not exist, it will try -// to read from $PROGDIR/demolition.ini, but it will never write to demolition.ini. +// vs writing. i.e. If the user specific ini does not exist, it will try +// to read from a neutral version, but never write to it. // //=========================================================================== @@ -190,7 +185,7 @@ FString M_GetConfigPath(bool for_reading) path += "/" GAMENAMELOWERCASE ".ini"; } else - { // construct "$PROGDIR/demolition-$USER.ini" + { // construct "$PROGDIR/-$USER.ini" WCHAR uname[UNLEN+1]; DWORD unamelen = UNLEN; @@ -210,13 +205,13 @@ FString M_GetConfigPath(bool for_reading) path << GAMENAMELOWERCASE "-" << FString(uname) << ".ini"; } else - { // Couldn't get user name, so just use demolition.ini + { // Couldn't get user name, so just use base version. path += GAMENAMELOWERCASE ".ini"; } } // If we are reading the config file, check if it exists. If not, fallback - // to $PROGDIR/demolition.ini + // to base version. if (for_reading) { if (!FileExists(path)) diff --git a/source/rr/src/duke3d.h b/source/rr/src/duke3d.h index b71040bc9..afd4db0cd 100644 --- a/source/rr/src/duke3d.h +++ b/source/rr/src/duke3d.h @@ -38,8 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_RR_NS -#define HEAD2 APPNAME - #define VOLUMEALL (g_Shareware == 0) #define PLUTOPAK (g_scriptVersion >= 14) #define VOLUMEONE (g_Shareware == 1) diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 894c6209b..decc30058 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -371,7 +371,7 @@ void G_GameExit(const char *msg) { if (!(msg[0] == ' ' && msg[1] == 0)) { - I_Error(msg); + I_FatalError(msg); } } throw ExitEvent(0); diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index 39b36ee33..36ca27625 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "osdcmds.h" #include "savegame.h" #include "gamecvars.h" +#include "version.h" #include "debugbreak.h" extern bool rotatesprite_2doverride; @@ -2528,12 +2529,14 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) } debug_break(); VM_ScriptInfo(insptr, 64); - G_GameExit("An error has occurred in the " APPNAME " virtual machine.\n\n" - "If you are an end user, please e-mail the file " APPBASENAME ".log\n" + G_GameExit("An error has occurred in the " GAMENAME " virtual machine.\n\n"); +#if 0 + "If you are an end user, please e-mail the file " GAMENAMELOWERCASE ".log\n" "along with links to any mods you're using to development@voidpoint.com.\n\n" "If you are a developer, please attach all of your script files\n" "along with instructions on how to reproduce this error.\n\n" "Thank you!"); +#endif break; } } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index f8056ad51..ba0d95d79 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -852,7 +852,7 @@ bool InitGame() LoadKVXFromScript("swvoxfil.txt"); // Load voxels from script file LoadPLockFromScript("swplock.txt"); // Get Parental Lock setup info - LoadCustomInfoFromScript("demolition/swcustom.txt"); // load the internal definitions. These also apply to the shareware version. + LoadCustomInfoFromScript("engine/swcustom.txt"); // load the internal definitions. These also apply to the shareware version. if (!SW_SHAREWARE) { LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information diff --git a/wadsrc/static/demolition/GENMIDI.op2 b/wadsrc/static/engine/GENMIDI.op2 similarity index 100% rename from wadsrc/static/demolition/GENMIDI.op2 rename to wadsrc/static/engine/GENMIDI.op2 diff --git a/wadsrc/static/demolition/Roboto-Regular.ttf b/wadsrc/static/engine/Roboto-Regular.ttf similarity index 100% rename from wadsrc/static/demolition/Roboto-Regular.ttf rename to wadsrc/static/engine/Roboto-Regular.ttf diff --git a/wadsrc/static/demolition/commonbinds.txt b/wadsrc/static/engine/commonbinds.txt similarity index 100% rename from wadsrc/static/demolition/commonbinds.txt rename to wadsrc/static/engine/commonbinds.txt diff --git a/wadsrc/static/demolition/confont.lmp b/wadsrc/static/engine/confont.lmp similarity index 100% rename from wadsrc/static/demolition/confont.lmp rename to wadsrc/static/engine/confont.lmp diff --git a/wadsrc/static/demolition/defbinds.txt b/wadsrc/static/engine/defbinds.txt similarity index 100% rename from wadsrc/static/demolition/defbinds.txt rename to wadsrc/static/engine/defbinds.txt diff --git a/wadsrc/static/demolition/dsempty.lmp b/wadsrc/static/engine/dsempty.lmp similarity index 100% rename from wadsrc/static/demolition/dsempty.lmp rename to wadsrc/static/engine/dsempty.lmp diff --git a/wadsrc/static/demolition/graphics/M_BACK.png b/wadsrc/static/engine/graphics/M_BACK.png similarity index 100% rename from wadsrc/static/demolition/graphics/M_BACK.png rename to wadsrc/static/engine/graphics/M_BACK.png diff --git a/wadsrc/static/demolition/grpinfo.txt b/wadsrc/static/engine/grpinfo.txt similarity index 100% rename from wadsrc/static/demolition/grpinfo.txt rename to wadsrc/static/engine/grpinfo.txt diff --git a/wadsrc/static/demolition/language.csv b/wadsrc/static/engine/language.csv similarity index 100% rename from wadsrc/static/demolition/language.csv rename to wadsrc/static/engine/language.csv diff --git a/wadsrc/static/demolition/leftbinds.txt b/wadsrc/static/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/demolition/leftbinds.txt rename to wadsrc/static/engine/leftbinds.txt diff --git a/wadsrc/static/demolition/menudef.txt b/wadsrc/static/engine/menudef.txt similarity index 100% rename from wadsrc/static/demolition/menudef.txt rename to wadsrc/static/engine/menudef.txt diff --git a/wadsrc/static/demolition/newconsolefont.hex b/wadsrc/static/engine/newconsolefont.hex similarity index 100% rename from wadsrc/static/demolition/newconsolefont.hex rename to wadsrc/static/engine/newconsolefont.hex diff --git a/wadsrc/static/demolition/origbinds.txt b/wadsrc/static/engine/origbinds.txt similarity index 100% rename from wadsrc/static/demolition/origbinds.txt rename to wadsrc/static/engine/origbinds.txt diff --git a/wadsrc/static/demolition/shaders/glsl/animvpx.fp b/wadsrc/static/engine/shaders/glsl/animvpx.fp similarity index 100% rename from wadsrc/static/demolition/shaders/glsl/animvpx.fp rename to wadsrc/static/engine/shaders/glsl/animvpx.fp diff --git a/wadsrc/static/demolition/shaders/glsl/animvpx.vp b/wadsrc/static/engine/shaders/glsl/animvpx.vp similarity index 100% rename from wadsrc/static/demolition/shaders/glsl/animvpx.vp rename to wadsrc/static/engine/shaders/glsl/animvpx.vp diff --git a/wadsrc/static/demolition/shaders/glsl/glsurface.fp b/wadsrc/static/engine/shaders/glsl/glsurface.fp similarity index 100% rename from wadsrc/static/demolition/shaders/glsl/glsurface.fp rename to wadsrc/static/engine/shaders/glsl/glsurface.fp diff --git a/wadsrc/static/demolition/shaders/glsl/glsurface.vp b/wadsrc/static/engine/shaders/glsl/glsurface.vp similarity index 100% rename from wadsrc/static/demolition/shaders/glsl/glsurface.vp rename to wadsrc/static/engine/shaders/glsl/glsurface.vp diff --git a/wadsrc/static/demolition/shaders/glsl/polymost.fp b/wadsrc/static/engine/shaders/glsl/polymost.fp similarity index 100% rename from wadsrc/static/demolition/shaders/glsl/polymost.fp rename to wadsrc/static/engine/shaders/glsl/polymost.fp diff --git a/wadsrc/static/demolition/shaders/glsl/polymost.vp b/wadsrc/static/engine/shaders/glsl/polymost.vp similarity index 100% rename from wadsrc/static/demolition/shaders/glsl/polymost.vp rename to wadsrc/static/engine/shaders/glsl/polymost.vp diff --git a/wadsrc/static/demolition/textcolors.txt b/wadsrc/static/engine/textcolors.txt similarity index 100% rename from wadsrc/static/demolition/textcolors.txt rename to wadsrc/static/engine/textcolors.txt diff --git a/wadsrc/static/filter/blood/demolition/combatmacros.txt b/wadsrc/static/filter/blood/engine/combatmacros.txt similarity index 100% rename from wadsrc/static/filter/blood/demolition/combatmacros.txt rename to wadsrc/static/filter/blood/engine/combatmacros.txt diff --git a/wadsrc/static/filter/blood/demolition/defbinds.txt b/wadsrc/static/filter/blood/engine/defbinds.txt similarity index 100% rename from wadsrc/static/filter/blood/demolition/defbinds.txt rename to wadsrc/static/filter/blood/engine/defbinds.txt diff --git a/wadsrc/static/filter/blood/demolition/leftbinds.txt b/wadsrc/static/filter/blood/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/filter/blood/demolition/leftbinds.txt rename to wadsrc/static/filter/blood/engine/leftbinds.txt diff --git a/wadsrc/static/filter/blood/demolition/origbinds.txt b/wadsrc/static/filter/blood/engine/origbinds.txt similarity index 100% rename from wadsrc/static/filter/blood/demolition/origbinds.txt rename to wadsrc/static/filter/blood/engine/origbinds.txt diff --git a/wadsrc/static/filter/duke/demolition/combatmacros.txt b/wadsrc/static/filter/duke/engine/combatmacros.txt similarity index 100% rename from wadsrc/static/filter/duke/demolition/combatmacros.txt rename to wadsrc/static/filter/duke/engine/combatmacros.txt diff --git a/wadsrc/static/filter/duke/demolition/defbinds.txt b/wadsrc/static/filter/duke/engine/defbinds.txt similarity index 100% rename from wadsrc/static/filter/duke/demolition/defbinds.txt rename to wadsrc/static/filter/duke/engine/defbinds.txt diff --git a/wadsrc/static/filter/duke/demolition/leftbinds.txt b/wadsrc/static/filter/duke/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/filter/duke/demolition/leftbinds.txt rename to wadsrc/static/filter/duke/engine/leftbinds.txt diff --git a/wadsrc/static/filter/duke/demolition/origbinds.txt b/wadsrc/static/filter/duke/engine/origbinds.txt similarity index 100% rename from wadsrc/static/filter/duke/demolition/origbinds.txt rename to wadsrc/static/filter/duke/engine/origbinds.txt diff --git a/wadsrc/static/filter/ionfury/demolition/combatmacros.txt b/wadsrc/static/filter/ionfury/engine/combatmacros.txt similarity index 100% rename from wadsrc/static/filter/ionfury/demolition/combatmacros.txt rename to wadsrc/static/filter/ionfury/engine/combatmacros.txt diff --git a/wadsrc/static/filter/ionfury/demolition/defbinds.txt b/wadsrc/static/filter/ionfury/engine/defbinds.txt similarity index 100% rename from wadsrc/static/filter/ionfury/demolition/defbinds.txt rename to wadsrc/static/filter/ionfury/engine/defbinds.txt diff --git a/wadsrc/static/filter/ionfury/demolition/graphics/M_BACK.png b/wadsrc/static/filter/ionfury/engine/graphics/M_BACK.png similarity index 100% rename from wadsrc/static/filter/ionfury/demolition/graphics/M_BACK.png rename to wadsrc/static/filter/ionfury/engine/graphics/M_BACK.png diff --git a/wadsrc/static/filter/ionfury/demolition/leftbinds.txt b/wadsrc/static/filter/ionfury/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/filter/ionfury/demolition/leftbinds.txt rename to wadsrc/static/filter/ionfury/engine/leftbinds.txt diff --git a/wadsrc/static/filter/ionfury/demolition/origbinds.txt b/wadsrc/static/filter/ionfury/engine/origbinds.txt similarity index 100% rename from wadsrc/static/filter/ionfury/demolition/origbinds.txt rename to wadsrc/static/filter/ionfury/engine/origbinds.txt diff --git a/wadsrc/static/filter/nam/demolition/combatmacros.txt b/wadsrc/static/filter/nam/engine/combatmacros.txt similarity index 100% rename from wadsrc/static/filter/nam/demolition/combatmacros.txt rename to wadsrc/static/filter/nam/engine/combatmacros.txt diff --git a/wadsrc/static/filter/nam/demolition/defbinds.txt b/wadsrc/static/filter/nam/engine/defbinds.txt similarity index 100% rename from wadsrc/static/filter/nam/demolition/defbinds.txt rename to wadsrc/static/filter/nam/engine/defbinds.txt diff --git a/wadsrc/static/filter/nam/demolition/graphics/M_BACK.png b/wadsrc/static/filter/nam/engine/graphics/M_BACK.png similarity index 100% rename from wadsrc/static/filter/nam/demolition/graphics/M_BACK.png rename to wadsrc/static/filter/nam/engine/graphics/M_BACK.png diff --git a/wadsrc/static/filter/nam/demolition/leftbinds.txt b/wadsrc/static/filter/nam/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/filter/nam/demolition/leftbinds.txt rename to wadsrc/static/filter/nam/engine/leftbinds.txt diff --git a/wadsrc/static/filter/nam/demolition/origbinds.txt b/wadsrc/static/filter/nam/engine/origbinds.txt similarity index 100% rename from wadsrc/static/filter/nam/demolition/origbinds.txt rename to wadsrc/static/filter/nam/engine/origbinds.txt diff --git a/wadsrc/static/filter/redneck/demolition/combatmacros.txt b/wadsrc/static/filter/redneck/engine/combatmacros.txt similarity index 100% rename from wadsrc/static/filter/redneck/demolition/combatmacros.txt rename to wadsrc/static/filter/redneck/engine/combatmacros.txt diff --git a/wadsrc/static/filter/redneck/demolition/defbinds.txt b/wadsrc/static/filter/redneck/engine/defbinds.txt similarity index 100% rename from wadsrc/static/filter/redneck/demolition/defbinds.txt rename to wadsrc/static/filter/redneck/engine/defbinds.txt diff --git a/wadsrc/static/filter/redneck/demolition/graphics/M_BACK.png b/wadsrc/static/filter/redneck/engine/graphics/M_BACK.png similarity index 100% rename from wadsrc/static/filter/redneck/demolition/graphics/M_BACK.png rename to wadsrc/static/filter/redneck/engine/graphics/M_BACK.png diff --git a/wadsrc/static/filter/redneck/demolition/leftbinds.txt b/wadsrc/static/filter/redneck/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/filter/redneck/demolition/leftbinds.txt rename to wadsrc/static/filter/redneck/engine/leftbinds.txt diff --git a/wadsrc/static/filter/redneck/demolition/origbinds.txt b/wadsrc/static/filter/redneck/engine/origbinds.txt similarity index 100% rename from wadsrc/static/filter/redneck/demolition/origbinds.txt rename to wadsrc/static/filter/redneck/engine/origbinds.txt diff --git a/wadsrc/static/filter/shadowwarrior/demolition/SWCustom.txt b/wadsrc/static/filter/shadowwarrior/engine/SWCustom.txt similarity index 100% rename from wadsrc/static/filter/shadowwarrior/demolition/SWCustom.txt rename to wadsrc/static/filter/shadowwarrior/engine/SWCustom.txt diff --git a/wadsrc/static/filter/shadowwarrior/demolition/combatmacros.txt b/wadsrc/static/filter/shadowwarrior/engine/combatmacros.txt similarity index 100% rename from wadsrc/static/filter/shadowwarrior/demolition/combatmacros.txt rename to wadsrc/static/filter/shadowwarrior/engine/combatmacros.txt diff --git a/wadsrc/static/filter/shadowwarrior/demolition/defbinds.txt b/wadsrc/static/filter/shadowwarrior/engine/defbinds.txt similarity index 100% rename from wadsrc/static/filter/shadowwarrior/demolition/defbinds.txt rename to wadsrc/static/filter/shadowwarrior/engine/defbinds.txt diff --git a/wadsrc/static/filter/shadowwarrior/demolition/leftbinds.txt b/wadsrc/static/filter/shadowwarrior/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/filter/shadowwarrior/demolition/leftbinds.txt rename to wadsrc/static/filter/shadowwarrior/engine/leftbinds.txt diff --git a/wadsrc/static/filter/shadowwarrior/demolition/origbinds.txt b/wadsrc/static/filter/shadowwarrior/engine/origbinds.txt similarity index 100% rename from wadsrc/static/filter/shadowwarrior/demolition/origbinds.txt rename to wadsrc/static/filter/shadowwarrior/engine/origbinds.txt diff --git a/wadsrc/static/filter/ww2gi/demolition/combatmacros.txt b/wadsrc/static/filter/ww2gi/engine/combatmacros.txt similarity index 100% rename from wadsrc/static/filter/ww2gi/demolition/combatmacros.txt rename to wadsrc/static/filter/ww2gi/engine/combatmacros.txt diff --git a/wadsrc/static/filter/ww2gi/demolition/defbinds.txt b/wadsrc/static/filter/ww2gi/engine/defbinds.txt similarity index 100% rename from wadsrc/static/filter/ww2gi/demolition/defbinds.txt rename to wadsrc/static/filter/ww2gi/engine/defbinds.txt diff --git a/wadsrc/static/filter/ww2gi/demolition/graphics/M_BACK.png b/wadsrc/static/filter/ww2gi/engine/graphics/M_BACK.png similarity index 100% rename from wadsrc/static/filter/ww2gi/demolition/graphics/M_BACK.png rename to wadsrc/static/filter/ww2gi/engine/graphics/M_BACK.png diff --git a/wadsrc/static/filter/ww2gi/demolition/leftbinds.txt b/wadsrc/static/filter/ww2gi/engine/leftbinds.txt similarity index 100% rename from wadsrc/static/filter/ww2gi/demolition/leftbinds.txt rename to wadsrc/static/filter/ww2gi/engine/leftbinds.txt diff --git a/wadsrc/static/filter/ww2gi/demolition/origbinds.txt b/wadsrc/static/filter/ww2gi/engine/origbinds.txt similarity index 100% rename from wadsrc/static/filter/ww2gi/demolition/origbinds.txt rename to wadsrc/static/filter/ww2gi/engine/origbinds.txt From eff25141a06192e5d301d223226fce1d9b47c38f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 14:16:00 +0100 Subject: [PATCH 13/14] - little bit of CMake cleanup. --- CMakeLists.txt | 20 +++----------------- source/CMakeLists.txt | 4 ++-- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80d794a05..558bb78e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,9 +115,9 @@ function( add_pk3 PK3_NAME PK3_DIR ) assort_pk3_source_folder("Source Files" ${PK3_DIR}) # Phase 4: Add the resulting PK3 to the install target. if( WIN32 ) - set( INSTALL_PK3_PATH . CACHE STRING "Directory where demolition.pk3 will be placed during install." ) + set( INSTALL_PK3_PATH . CACHE STRING "Directory where engine data will be placed during install." ) else() - set( INSTALL_PK3_PATH share/games/doom CACHE STRING "Directory where demolition.pk3 will be placed during install." ) + set( INSTALL_PK3_PATH share/games/doom CACHE STRING "Directory where engine data will be placed during install." ) endif() install(FILES "${PROJECT_BINARY_DIR}/${PK3_NAME}" DESTINATION ${INSTALL_PK3_PATH} @@ -140,7 +140,7 @@ IF( NOT CMAKE_BUILD_TYPE ) FORCE ) ENDIF() -set( DEMOLITION_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where demolition.pk3 and the executable will be created." ) +set( DEMOLITION_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where engine data and the executable will be created." ) set( DEMOLITION_EXE_NAME "demolition" CACHE FILEPATH "Name of the executable to create" ) if( MSVC ) # Allow the user to use DEMOLITION_OUTPUT_DIR as a single release point. @@ -206,20 +206,6 @@ if( MSVC ) #set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2") # This is already the default -# if( CMAKE_SIZEOF_VOID_P MATCHES "4") -# # SSE2 option (to allow x87 in 32 bit and disallow extended feature sets which have not yet been checked for precision) -# option (DEMOLITION_USE_SSE2 "Use SSE2 instruction set") -# if (DEMOLITION_USE_SSE2) -# set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2") -# else () -# if (MSVC_VERSION GREATER 1699) -# # On Visual C++ 2012 and later SSE2 is the default, so we need to switch it off explicitly -# set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:IA32") -# endif () -# endif () -# else() -# set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2") -# endif() # Avoid CRT DLL dependancies in release builds, optionally generate assembly output for checking crash locations. option( DEMOLITION_GENERATE_ASM "Generate assembly output." OFF ) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index f816f17cb..d318fa05c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -429,7 +429,7 @@ add_custom_target( revision_check ALL WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} DEPENDS updaterevision ) -# Libraries Demolition needs +# required libraries message( STATUS "Fluid synth libs: ${FLUIDSYNTH_LIBRARIES}" ) set( DEMOLITION_LIBS ${DEMOLITION_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${CMAKE_DL_LIBS}" ) @@ -468,7 +468,7 @@ endif() -# Start defining source files for Demolition +# Start defining source files set( PLAT_WIN32_SOURCES platform/win32/base_sysfb.cpp platform/win32/gl_sysfb.cpp From d473f9c590dfae1a28b504678889583b02f1a0d2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 14:43:44 +0100 Subject: [PATCH 14/14] - replaced all uses of Bfree with Xfree so they are subjected to debug instrumentation, uses FStrings in a few cases where it made sense. - fixed: Sound channels weren't freed. --- source/blood/src/blood.cpp | 88 ------------------------ source/blood/src/credits.cpp | 27 ++------ source/build/include/compat.h | 14 +++- source/build/src/voxmodel.cpp | 4 +- source/common/openaudio.cpp | 8 +-- source/common/searchpaths.cpp | 4 +- source/common/sound/s_sound.cpp | 3 +- source/common/sound/s_soundinternal.h | 5 +- source/libsmackerdec/include/BitReader.h | 3 +- source/libsmackerdec/src/BitReader.cpp | 7 +- source/rr/src/game.cpp | 30 ++++---- source/rr/src/gamedef.cpp | 16 ++--- source/rr/src/net.cpp | 4 +- source/rr/src/premap.cpp | 2 +- source/rr/src/screentext.cpp | 4 +- 15 files changed, 66 insertions(+), 153 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index dc169caad..1dec67413 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -1434,94 +1434,6 @@ static void parsedefinitions_game_include(const char *fileName, scriptfile *pScr } } -#if 0 -static void parsedefinitions_game_animsounds(scriptfile *pScript, const char * blockEnd, char const * fileName, dukeanim_t * animPtr) -{ - Bfree(animPtr->sounds); - - size_t numPairs = 0, allocSize = 4; - - animPtr->sounds = (animsound_t *)Xmalloc(allocSize * sizeof(animsound_t)); - animPtr->numsounds = 0; - - int defError = 1; - uint16_t lastFrameNum = 1; - - while (pScript->textptr < blockEnd) - { - int32_t frameNum; - int32_t soundNum; - - // HACK: we've reached the end of the list - // (hack because it relies on knowledge of - // how scriptfile_* preprocesses the text) - if (blockEnd - pScript->textptr == 1) - break; - - // would produce error when it encounters the closing '}' - // without the above hack - if (scriptfile_getnumber(pScript, &frameNum)) - break; - - defError = 1; - - if (scriptfile_getsymbol(pScript, &soundNum)) - break; - - // frame numbers start at 1 for us - if (frameNum <= 0) - { - initprintf("Error: frame number must be greater zero on line %s:%d\n", pScript->filename, - scriptfile_getlinum(pScript, pScript->ltextptr)); - break; - } - - if (frameNum < lastFrameNum) - { - initprintf("Error: frame numbers must be in (not necessarily strictly)" - " ascending order (line %s:%d)\n", - pScript->filename, scriptfile_getlinum(pScript, pScript->ltextptr)); - break; - } - - lastFrameNum = frameNum; - - if ((unsigned)soundNum >= MAXSOUNDS && soundNum != -1) - { - initprintf("Error: sound number #%d invalid on line %s:%d\n", soundNum, pScript->filename, - scriptfile_getlinum(pScript, pScript->ltextptr)); - break; - } - - if (numPairs >= allocSize) - { - allocSize *= 2; - animPtr->sounds = (animsound_t *)Xrealloc(animPtr->sounds, allocSize * sizeof(animsound_t)); - } - - defError = 0; - - animsound_t & sound = animPtr->sounds[numPairs]; - sound.frame = frameNum; - sound.sound = soundNum; - - ++numPairs; - } - - if (!defError) - { - animPtr->numsounds = numPairs; - // initprintf("Defined sound sequence for hi-anim \"%s\" with %d frame/sound pairs\n", - // hardcoded_anim_tokens[animnum].text, numpairs); - } - else - { - DO_FREE_AND_NULL(animPtr->sounds); - initprintf("Failed defining sound sequence for anim \"%s\".\n", fileName); - } -} - -#endif static int parsedefinitions_game(scriptfile *pScript, int firstPass) { diff --git a/source/blood/src/credits.cpp b/source/blood/src/credits.cpp index 742094d76..ccc4d78e3 100644 --- a/source/blood/src/credits.cpp +++ b/source/blood/src/credits.cpp @@ -161,22 +161,17 @@ void credReset(void) DoUnFade(1); } -FileReader credKOpen4Load(char *&pzFile) +FileReader credKOpen4Load(FString pzFile) { int nLen = strlen(pzFile); - for (int i = 0; i < nLen; i++) - { - if (pzFile[i] == '\\') - pzFile[i] = '/'; - } + FixPathSeperator(pzFile); auto nHandle = fileSystem.OpenFileReader(pzFile, 0); if (!nHandle.isOpen()) { // Hack if (nLen >= 3 && isalpha(pzFile[0]) && pzFile[1] == ':' && pzFile[2] == '/') { - pzFile += 3; - nHandle = fileSystem.OpenFileReader(pzFile, 0); + nHandle = fileSystem.OpenFileReader(pzFile.GetChars()+3, 0); } } return nHandle; @@ -200,24 +195,18 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) } smkPlayer.sub_82E6C(pzSMK, pzWAV); #endif - if (Bstrlen(_pzSMK) == 0) + if (!_pzSMK || !*_pzSMK) return; - char *pzSMK = Xstrdup(_pzSMK); - char *pzWAV = Xstrdup(_pzWAV); - char *pzSMK_ = pzSMK; - char *pzWAV_ = pzWAV; + FString pzSMK = _pzSMK; + FString pzWAV = _pzWAV; auto nHandleSMK = credKOpen4Load(pzSMK); if (!nHandleSMK.isOpen()) { - Bfree(pzSMK_); - Bfree(pzWAV_); return; } SmackerHandle hSMK = Smacker_Open(pzSMK); if (!hSMK.isValid) { - Bfree(pzSMK_); - Bfree(pzWAV_); return; } uint32_t nWidth, nHeight; @@ -228,8 +217,6 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) if (!pFrame) { Smacker_Close(hSMK); - Bfree(pzSMK_); - Bfree(pzWAV_); return; } int nFrameRate = Smacker_GetFrameRate(hSMK); @@ -295,8 +282,6 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) GLInterface.EnableNonTransparent255(false); videoSetPalette(0, 0, 8+2); tileDelete(kSMKTile); - Bfree(pzSMK_); - Bfree(pzWAV_); } END_BLD_NS diff --git a/source/build/include/compat.h b/source/build/include/compat.h index 1a56dd50d..864ad92c2 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -1229,7 +1229,7 @@ static FORCE_INLINE void *xrealloc(void * const ptr, const bsize_t size) return (EDUKE32_PREDICT_TRUE(newptr != NULL || size == 0)) ? newptr: handle_memerr(ptr); } -// This will throw up when BFee is no longer usable, I do not want to change all code right now that uses it to make future merges easier. +// This will throw up when BFree is no longer usable, I do not want to change all code right now that uses it to make future merges easier. static_assert(Bfree == free, "BFree must be free"); static FORCE_INLINE void xfree(void *const ptr) { Bfree(ptr); } @@ -1265,6 +1265,7 @@ static FORCE_INLINE void *xaligned_calloc(const bsize_t alignment, const bsize_t # define EDUKE32_PRE_XALLOC #endif +#ifndef _DEBUG #define Xstrdup(s) (EDUKE32_PRE_XALLOC xstrdup(s)) #define Xmalloc(size) (EDUKE32_PRE_XALLOC xmalloc(size)) #define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLOC xcalloc(nmemb, size)) @@ -1273,6 +1274,17 @@ static FORCE_INLINE void *xaligned_calloc(const bsize_t alignment, const bsize_t #define Xaligned_calloc(alignment, count, size) (EDUKE32_PRE_XALLOC xaligned_calloc(alignment, count, size)) #define Xfree(ptr) (EDUKE32_PRE_XALLOC xfree(ptr)) #define Xaligned_free(ptr) (EDUKE32_PRE_XALLOC xaligned_free(ptr)) +#else +// This is for allowing the compiler's heap checker to do its job. When wrapped it only points to the wrapper for a memory leak, not to the real location where the allocation takes place. +#define Xstrdup(s) (strdup(s)) +#define Xmalloc(size) (malloc(size)) +#define Xcalloc(nmemb, size) (calloc(nmemb, size)) +#define Xrealloc(ptr, size) (realloc(ptr, size)) +#define Xaligned_alloc(alignment, size) (malloc(size)) +#define Xaligned_calloc(alignment, count, size) (calloc(count, size)) +#define Xfree(ptr) (free(ptr)) +#define Xaligned_free(ptr) (free(ptr)) +#endif ////////// More utility functions ////////// diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index 0771ca08f..8421d9947 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -905,7 +905,7 @@ voxmodel_t *loadkvxfrombuf(const char *kvxbuffer, int32_t length) if (mip1leng > length - 4) { // Invalid KVX file - Bfree(buffer); + Xfree(buffer); return NULL; } memcpy(&voxsiz, longptr, sizeof(vec3_t)); @@ -993,7 +993,7 @@ voxmodel_t *loadkvxfrombuf(const char *kvxbuffer, int32_t length) DO_FREE_AND_NULL(vcol); vnum = vmax = 0; DO_FREE_AND_NULL(vcolhashead); - Bfree(buffer); + Xfree(buffer); return vm; } diff --git a/source/common/openaudio.cpp b/source/common/openaudio.cpp index 32d5eac60..c94cb9001 100644 --- a/source/common/openaudio.cpp +++ b/source/common/openaudio.cpp @@ -79,7 +79,7 @@ FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic) auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic); if (fp.isOpen()) { - Bfree(testfn); + Xfree(testfn); return fp; } @@ -95,7 +95,7 @@ FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic) auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic); if (fp.isOpen()) { - Bfree(testfn); + Xfree(testfn); return fp; } } @@ -107,12 +107,12 @@ FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic) auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic); if (fp.isOpen()) { - Bfree(testfn); + Xfree(testfn); return fp; } } - Bfree(testfn); + Xfree(testfn); return origfp; #endif } diff --git a/source/common/searchpaths.cpp b/source/common/searchpaths.cpp index 0d02ab48a..f1546f0eb 100644 --- a/source/common/searchpaths.cpp +++ b/source/common/searchpaths.cpp @@ -1192,10 +1192,10 @@ bool AddINIFile(const char* pzFile, bool bForce = false) if (findfrompath(pzFile, &pzFN)) return false; // failed to resolve the filename if (!FileExists(pzFN)) { - Bfree(pzFN); + Xfree(pzFN); return false; } // failed to stat the file - Bfree(pzFN); + Xfree(pzFN); IniFile* pTempIni = new IniFile(pzFile); if (!pTempIni->FindSection("Episode1")) { diff --git a/source/common/sound/s_sound.cpp b/source/common/sound/s_sound.cpp index af9bcb1de..f00db6fcf 100644 --- a/source/common/sound/s_sound.cpp +++ b/source/common/sound/s_sound.cpp @@ -65,6 +65,7 @@ int sfx_empty = -1; void SoundEngine::Init(TArray &curve) { + StopAllChannels(); // Free all channels for use. while (Channels != NULL) { @@ -1427,7 +1428,7 @@ void SoundEngine::StopChannel(FSoundChan *chan) chan->Source = NULL; } } - GSnd->StopChannel(chan); + if (GSnd) GSnd->StopChannel(chan); } else { diff --git a/source/common/sound/s_soundinternal.h b/source/common/sound/s_soundinternal.h index 2241ffede..7d9a29d78 100644 --- a/source/common/sound/s_soundinternal.h +++ b/source/common/sound/s_soundinternal.h @@ -271,7 +271,10 @@ protected: virtual FSoundID ResolveSound(const void *ent, int srctype, FSoundID soundid, float &attenuation); public: - virtual ~SoundEngine() = default; + virtual ~SoundEngine() + { + Shutdown(); + } void EvictAllChannels(); void StopChannel(FSoundChan* chan); diff --git a/source/libsmackerdec/include/BitReader.h b/source/libsmackerdec/include/BitReader.h index 39a1511f3..4863e42a8 100644 --- a/source/libsmackerdec/include/BitReader.h +++ b/source/libsmackerdec/include/BitReader.h @@ -22,6 +22,7 @@ #include #include "FileStream.h" +#include "tarray.h" namespace SmackerCommon { @@ -44,7 +45,7 @@ class BitReader SmackerCommon::FileStream *file; - uint8_t *cache; + TArray Cache; void FillCache(); }; diff --git a/source/libsmackerdec/src/BitReader.cpp b/source/libsmackerdec/src/BitReader.cpp index 81afa947d..ea5169d3f 100644 --- a/source/libsmackerdec/src/BitReader.cpp +++ b/source/libsmackerdec/src/BitReader.cpp @@ -29,13 +29,12 @@ BitReader::BitReader(SmackerCommon::FileStream &file, uint32_t size) this->currentOffset = 0; this->bytesRead = 0; - this->cache = (uint8_t*)Xmalloc(size); - file.ReadBytes(this->cache, size); + this->Cache.Resize(size); + file.ReadBytes(this->Cache.Data(), size); } BitReader::~BitReader() { - Bfree(this->cache); } void BitReader::FillCache() @@ -54,7 +53,7 @@ uint32_t BitReader::GetPosition() uint32_t BitReader::GetBit() { - uint32_t ret = (cache[currentOffset>>3]>>(currentOffset&7))&1; + uint32_t ret = (Cache[currentOffset>>3]>>(currentOffset&7))&1; currentOffset++; return ret; } diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index decc30058..e86ea80b3 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -371,7 +371,7 @@ void G_GameExit(const char *msg) { if (!(msg[0] == ' ' && msg[1] == 0)) { - I_FatalError(msg); + I_Error(msg); } } throw ExitEvent(0); @@ -876,7 +876,7 @@ static void G_ReadGLFrame(void) } } - Bfree(frame); + Xfree(frame); } #endif @@ -4678,7 +4678,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura #endif for (j=spritesortcnt-1; j>=0; j--) { - uspritetype *const t = &tsprite[j]; + tspritetype *const t = &tsprite[j]; const int32_t i = t->owner; const spritetype *const s = &sprite[i]; @@ -4707,7 +4707,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura for (j=spritesortcnt-1; j>=0; j--) { - uspritetype *const t = &tsprite[j]; + tspritetype *const t = &tsprite[j]; const int32_t i = t->owner; spritetype *const s = &sprite[i]; @@ -4818,11 +4818,11 @@ default_case1: int32_t curframe; int32_t scrofs_action; //is the perfect time to animate sprites - uspritetype *const t = &tsprite[j]; + tspritetype *const t = &tsprite[j]; const int32_t i = t->owner; // XXX: what's up with the (i < 0) check? // NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below). - uspritetype *const pSprite = (i < 0) ? &tsprite[j] : (uspritetype *)&sprite[i]; + tspritetype *const pSprite = (i < 0) ? &tsprite[j] : (tspritetype *)&sprite[i]; if (adult_lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum))) { @@ -6696,7 +6696,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass) static void G_FreeHashAnim(const char * /*string*/, intptr_t key) { - Bfree((void *)key); + Xfree((void *)key); } static void G_Cleanup(void) @@ -6712,17 +6712,17 @@ static void G_Cleanup(void) for (i=MAXPLAYERS-1; i>=0; i--) { - Bfree(g_player[i].ps); - Bfree(g_player[i].inputBits); + Xfree(g_player[i].ps); + Xfree(g_player[i].inputBits); } - if (label != (char *)&sprite[0]) Bfree(label); - if (labelcode != (int32_t *)§or[0]) Bfree(labelcode); - if (labeltype != (int32_t*)&wall[0]) Bfree(labeltype); - Bfree(apScript); - Bfree(bitptr); + if (label != (char *)&sprite[0]) Xfree(label); + if (labelcode != (int32_t *)§or[0]) Xfree(labelcode); + if (labeltype != (int32_t*)&wall[0]) Xfree(labeltype); + Xfree(apScript); + Xfree(bitptr); -// Bfree(MusicPtr); +// Xfree(MusicPtr); hash_free(&h_labels); } diff --git a/source/rr/src/gamedef.cpp b/source/rr/src/gamedef.cpp index dae444e17..1fe52b3c9 100644 --- a/source/rr/src/gamedef.cpp +++ b/source/rr/src/gamedef.cpp @@ -334,7 +334,7 @@ static int32_t C_SetScriptSize(int32_t newsize) else Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((newsize+7)>>3)); - Bfree(bitptr); + Xfree(bitptr); bitptr = newbitptr; if (apScript != newscript) { @@ -358,7 +358,7 @@ static int32_t C_SetScriptSize(int32_t newsize) G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0); G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0); - Bfree(scriptptrs); + Xfree(scriptptrs); return 0; } @@ -659,7 +659,7 @@ static int32_t C_GetNextValue(int32_t type) { char *gl = C_GetLabelType(labeltype[i]); initprintf("%s:%d: debug: %s label `%s'.\n",g_scriptFileName,g_lineNumber,gl,label+(i<<6)); - Bfree(gl); + Xfree(gl); } BITPTR_CLEAR(g_scriptPtr-apScript); @@ -677,8 +677,8 @@ static int32_t C_GetNextValue(int32_t type) C_ReportError(-1); initprintf("%s:%d: warning: expected %s, found %s.\n",g_scriptFileName,g_lineNumber,el,gl); g_warningCnt++; - Bfree(el); - Bfree(gl); + Xfree(el); + Xfree(gl); return -1; // valid label name, but wrong type } @@ -829,7 +829,7 @@ static void C_Include(const char *confile) textptr = origtptr; - Bfree(mptr); + Xfree(mptr); } void G_DoGameStartup(const int32_t *params) @@ -1001,7 +1001,7 @@ static int32_t C_ParseCommand(int32_t loop) C_ReportError(-1); initprintf("%s:%d: warning: expected state, found %s.\n", g_scriptFileName, g_lineNumber, gl); g_warningCnt++; - Bfree(gl); + Xfree(gl); *(g_scriptPtr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions BITPTR_CLEAR(g_scriptPtr-apScript-1); continue; // valid label name, but wrong type @@ -2226,7 +2226,7 @@ void C_Compile(const char *fileName) g_scriptcrc = Bcrc32(NULL, 0, 0L); g_scriptcrc = Bcrc32(textptr, kFileLen, g_scriptcrc); - Bfree(apScript); + Xfree(apScript); apScript = (intptr_t *)Xcalloc(1, g_scriptSize * sizeof(intptr_t)); bitptr = (char *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t)); diff --git a/source/rr/src/net.cpp b/source/rr/src/net.cpp index 5a7b0000f..0dc77b1df 100644 --- a/source/rr/src/net.cpp +++ b/source/rr/src/net.cpp @@ -2398,7 +2398,7 @@ void Net_Connect(const char *srvaddr) event.type == ENET_EVENT_TYPE_CONNECT) { initprintf("Connection to %s:%d succeeded.\n", oursrvaddr, address.port); - Bfree(oursrvaddr); + Xfree(oursrvaddr); return; } else @@ -2412,7 +2412,7 @@ void Net_Connect(const char *srvaddr) initprintf(i ? "Retrying...\n" : "Giving up connection attempt.\n"); } - Bfree(oursrvaddr); + Xfree(oursrvaddr); Net_Disconnect(); } diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index c3717bb17..a9146fd57 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -1669,7 +1669,7 @@ static void prelevel(char g) actor[j].t_data[0] = 1; } - Bfree(tagbitmap); + Xfree(tagbitmap); g_mirrorCount = 0; diff --git a/source/rr/src/screentext.cpp b/source/rr/src/screentext.cpp index 6aea65a7b..5719d5bd9 100644 --- a/source/rr/src/screentext.cpp +++ b/source/rr/src/screentext.cpp @@ -541,7 +541,7 @@ vec2_t G_ScreenText(const int32_t font, linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x; - Bfree(line); + Xfree(line); } if (f & TEXT_XJUSTIFY) @@ -733,7 +733,7 @@ vec2_t G_ScreenText(const int32_t font, int32_t linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x; - Bfree(line); + Xfree(line); if (f & TEXT_XJUSTIFY) {