diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index c2be65b12..22e1a4509 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -58,7 +58,7 @@ int adjustfall(spritetype* s, int c); void RANDOMSCRAP(spritetype *s, int i) { - int r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(), r5 = krand2(), r6 = krand2(), r7 = krand2(); + int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand(); int v = isRR() ? 16 : 48; EGS(s->sectnum, s->x + (r7 & 255) - 128, s->y + (r6 & 255) - 128, s->z - (8 << 8) - (r5 & 8191), TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), i, 5); } diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index a1c5901ac..343e17087 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -452,3 +452,14 @@ enum TRIPBOMB_TRIPWIRE = 1, TRIPBOMB_TIMER = 2 }; + +// World tour +enum EFlamethrowerState +{ + kHitTypeMask = 0xC000, + //kHitIndexMask = 0x3FFF, + kHitSector = 0x4000, + kHitWall = 0x8000, + kHitSprite = 0xC000, +}; + diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 0e6e68bed..23bec0242 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -17,7 +17,6 @@ #include "game.h" #include "gamevar.h" #include "global.h" -#include "macros.h" #include "names.h" #include "player.h" #include "quotemgr.h" diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index f44d0adef..4a92eff1b 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -45,7 +45,6 @@ extern int rtsplaying; extern int32_t g_Shareware; extern int32_t cameraclock; extern int32_t cameradist; -extern int32_t g_doQuickSave; extern int32_t tempwallptr; enum diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 886a54d2e..3079de497 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -34,7 +34,6 @@ source as it is released. #include "ns.h" #include "concmd.h" #include "duke3d.h" -#include "gamedef.h" #include "gamevar.h" #include "mapinfo.h" diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index 966c514df..250857ce2 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -118,7 +118,6 @@ G_EXTERN int32_t g_cyclerCnt; G_EXTERN int32_t g_damageCameras; #define camerashitable g_damageCameras G_EXTERN int32_t g_defaultLabelCnt; -G_EXTERN int32_t g_doQuickSave; G_EXTERN int32_t g_earthquakeTime; #define earthquaketime g_earthquakeTime G_EXTERN int32_t g_freezerSelfDamage; @@ -194,17 +193,7 @@ G_EXTERN int16_t ambienthitag[64]; G_EXTERN uint32_t ambientfx; -G_EXTERN vec2_t g_origins[MAXANIMPOINTS]; -struct msx_ -{ - int &operator[](int v) { return g_origins[v].x; } -}; -struct msy_ -{ - int &operator[](int v) { return g_origins[v].y; } -}; -G_EXTERN msx_ msx; -G_EXTERN msy_ msy; +G_EXTERN int msx[MAXANIMPOINTS], msy[MAXANIMPOINTS]; G_EXTERN int32_t WindTime, WindDir; G_EXTERN int16_t fakebubba_spawn, mamaspawn_count, banjosound, g_bellTime, BellSprite; @@ -217,10 +206,6 @@ extern int32_t g_cdTrack; #define raat605 chickenphase #define at59d yeehaa_timer -// XXX: I think this pragma pack is meaningless here. -// MSDN (https://msdn.microsoft.com/en-us/library/2e70t5y1%28VS.80%29.aspx) says: -// "pack takes effect at the first struct, union, or class declaration after -// the pragma is seen; pack has no effect on definitions." G_EXTERN player_orig po[MAXPLAYERS]; G_EXTERN uint32_t everyothertime; @@ -263,11 +248,6 @@ extern int32_t g_gametypeFlags[MAXGAMETYPES]; #endif -enum -{ - EF_HIDEFROMSP = 1<<0, -}; - // Interpolation code is the same in all games with slightly different naming - this needs to be unified and cleaned up. extern int32_t numinterpolations; extern int32_t* curipos[MAXINTERPOLATIONS]; @@ -291,15 +271,6 @@ extern int spriteqamount; -enum -{ - kHitTypeMask = 0xC000, - //kHitIndexMask = 0x3FFF, - kHitSector = 0x4000, - kHitWall = 0x8000, - kHitSprite = 0xC000, -}; - extern uint8_t shadedsector[MAXSECTORS]; diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 382b30de5..bf2e773cf 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -7,6 +7,11 @@ // all inline functions. BEGIN_DUKE_NS +inline int rnd(int X) +{ + return ((krand() >> 8) >= (255 - (X))); +} + inline bool AFLAMABLE(int X) { return (X == TILE_BOX || X == TILE_TREE1 || X == TILE_TREE2 || X == TILE_TIRE || X == TILE_CONE); diff --git a/source/games/duke/src/macros.h b/source/games/duke/src/macros.h deleted file mode 100644 index 062575175..000000000 --- a/source/games/duke/src/macros.h +++ /dev/null @@ -1,85 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef EDUKE32_MACROS_H_ -#define EDUKE32_MACROS_H_ - -#include "mmulti.h" - -BEGIN_DUKE_NS - -// Macros, some from SW source - -static FORCE_INLINE int32_t krand2(void) -{ - randomseed = (randomseed * 27584621ul) + 1ul; - return ((uint32_t) randomseed)>>16; -} - -#define BGSTRETCH (hud_bgstretch ? 1024 : 0) - -#define TRAVERSE_SPRITE_SECT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n) -#define TRAVERSE_SPRITE_STAT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n) -#define TRAVERSE_CONNECT(i) i = 0; i != -1; i = connectpoint2[i] - -#define TEST(flags,mask) ((flags) & (mask)) -#define SET(flags,mask) ((flags) |= (mask)) -#define RESET(flags,mask) ((flags) &= ~(mask)) -#define FLIP(flags,mask) ((flags) ^= (mask)) - -// mask definitions - -#define BIT(shift) (1u<<(shift)) - -#define rnd(X) ((krand2()>>8)>=(255-(X))) - -// -// NETWORK - REDEFINABLE SHARED (SYNC) KEYS BIT POSITIONS -// - -//cstat, bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B" -// bit 1: 1 = 50/50 transluscence, 0 = normal "T" -// bit 2: 1 = x-flipped, 0 = normal "F" -// bit 3: 1 = y-flipped, 0 = normal "F" -// bits 5-4: 00 = FACE sprite (default) "R" -// 01 = WALL sprite (like masked walls) -// 10 = FLOOR sprite (parallel to ceilings&floors) -// 11 = SPIN sprite (face sprite that can spin 2draw style - not done yet) -// bit 6: 1 = 1-sided sprite, 0 = normal "1" -// bit 7: 1 = Real centered centering, 0 = foot center "C" -// bit 8: 1 = Blocking sprite (use with hitscan) "H" -// bit 9: reserved -// bit 10: reserved -// bit 11: 1 = determine shade based only on its own shade member (see CON's spritenoshade command), i.e. -// don't take over shade from parallaxed ceiling/nonparallaxed floor -// (NOTE: implemented on the game side) -// bit 12: reserved -// bit 13: reserved -// bit 14: reserved -// bit 15: 1 = Invisible sprite, 0 = not invisible -#define CSTAT_SPRITE_NOSHADE BIT(11) -#define CSTAT_SPRITE_BREAKABLE (CSTAT_SPRITE_BLOCK_HITSCAN) - - -END_DUKE_NS - -#endif diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 8d8f4feae..515fb5b19 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -39,7 +39,6 @@ source as it is released. #include "gamevar.h" #include "player.h" #include "names_d.h" -#include "macros.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index a137d3872..fec692c59 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1691,7 +1691,7 @@ static void onMotorcycle(int snum, ESyncBits &sb_snum) } else { - p->sethoriz(100 + ((krand2() & 15) - 7)); + p->sethoriz(100 + ((krand() & 15) - 7)); p->TurbCount--; p->moto_drink = (krand() & 3) - 2; } diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 17f28eca6..eab95151d 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -39,7 +39,6 @@ source as it is released. #include "gamevar.h" #include "player.h" #include "names_d.h" -#include "macros.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index 0115ba02a..32acd5a79 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -610,7 +610,7 @@ static const dataspec_t svgm_anmisc[] = { 0, &g_animatePtr[0], sizeof(g_animatePtr[0]), MAXANIMATES }, { DS_SAVEFN|DS_LOADFN , (void *)&sv_postanimateptr, 0, 1 }, { 0, &camsprite, sizeof(camsprite), 1 }, - { 0, &g_origins[0], sizeof(g_origins[0]), ARRAY_SIZE(g_origins) }, + // { 0, &g_origins[0], sizeof(g_origins[0]), ARRAY_SIZE(g_origins) }, type has changed { 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 }, { DS_NOCHK, &spriteqamount, sizeof(spriteqamount), 1 }, { DS_CNT(spriteqamount), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&spriteqamount },