diff --git a/source/games/duke/src/actor.h b/source/games/duke/src/actor.h index 97ef88cda..39542a892 100644 --- a/source/games/duke/src/actor.h +++ b/source/games/duke/src/actor.h @@ -77,3 +77,5 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT void checkavailweapon(struct player_struct* p); void deletesprite(int num); +int ssp(int i, unsigned int cliptype); //The set sprite function +void insertspriteq(int i); diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index bfc67f86b..d4c6bc9d9 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -222,7 +222,7 @@ void clearcamera(player_struct* ps) // //--------------------------------------------------------------------------- -int ssp(short i, unsigned int cliptype) //The set sprite function +int ssp(int i, unsigned int cliptype) //The set sprite function { spritetype* s; int movetype; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 035059918..99460594d 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3469,6 +3469,7 @@ void moveexplosions_d(void) // STATNUM 5 case LAVAPOOL: case ONFIRE: + case ONFIRESMOKE: case BURNEDCORPSE: case LAVAPOOLBUBBLE: case WHISPYSMOKE: diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index f6bd3509a..5257a793b 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -67,6 +67,13 @@ enum GameFunction_t }; +enum +{ + TICRATE = 120, + REALGAMETICSPERSEC = 30, // The number of game state updates per second: + TICSPERFRAME = (TICRATE/REALGAMETICSPERSEC) // (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated to 4 by integer division.) +}; + // tile names which are identical for all games. enum { @@ -81,6 +88,9 @@ enum RESPAWN = 9, GPSPEED = 10, FOF = 13, + + TILE_VIEWSCR = (MAXTILES-5) + }; // the available palettes. These are indices into the global table of translations. diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 1ad4b3ec4..7f96faf33 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -34,72 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "polymost.h" #include "gamecvars.h" #include "menu/menu.h" - -BEGIN_DUKE_NS - -#define VOLUMEALL (g_Shareware == 0) -#define PLUTOPAK (true)//g_scriptVersion >= 14) -#define VOLUMEONE (g_Shareware == 1) - -// increase by 3, because atomic GRP adds 1, and Shareware adds 2 -// Non-Lua build -# define BYTEVERSION_EDUKE32 336 - -//#define BYTEVERSION_13 27 -//#define BYTEVERSION_14 116 -//#define BYTEVERSION_15 117 -#define BYTEVERSION (BYTEVERSION_EDUKE32+(PLUTOPAK?1:(VOLUMEONE<<1))) - -#define NUMPAGES 1 - -#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3 -#define MOVEFIFOSIZ 256 - -#define MAXLEVELS 64 -#define MAXGAMETYPES 16 - -enum { - MUS_FIRST_SPECIAL = MAXVOLUMES*MAXLEVELS, - - MUS_INTRO = MUS_FIRST_SPECIAL, - MUS_BRIEFING = MUS_FIRST_SPECIAL + 1, - MUS_LOADING = MUS_FIRST_SPECIAL + 2, -}; - -////////// TIMING CONSTANTS ////////// -// The number of 'totalclock' increments per second: -#define TICRATE 120 -// The number of game state updates per second: -#define REALGAMETICSPERSEC 30 -// The number of 'totalclock' increments per game state update: -// NOTE: calling a game state update a 'frame' is really weird. -// (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated -// to 4 by integer division.) -#define TICSPERFRAME (TICRATE/REALGAMETICSPERSEC) -// Used as a constant to satisfy all of the calculations written with ticrate = -// 26 in mind: -#define GAMETICSPERSEC 26 - - -#define PACKBUF_SIZE 32768 - -#define TILE_VIEWSCR (MAXTILES-5) -EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES); - -// sprites with these statnums should be considered for fixing -#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \ - (k)==STAT_FALLER || (k)==STAT_LIGHT) -#define ROTFIXSPR_MAGIC 0x18190000 - -// JBF 20040604: sync is a function on some platforms -#define sync dsync - -// Uncomment the following to remove calls to a.nasm functions with the GL renderers -// so that debugging with valgrind --smc-check=none is possible: -//#define DEBUG_VALGRIND_NO_SMC - -END_DUKE_NS - #include "zz_actors.h" #include "gamecontrol.h" #include "game.h" diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index b0d2e4ddb..4ff180428 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -251,7 +251,7 @@ void initactorflags_d() TILE_CAMCORNER = CAMCORNER; TILE_CAMLIGHT = CAMLIGHT; TILE_STATIC = STATIC; - TILE_BOTTOMSTATUSBAR = BOTTOMSTATUSBAR; + TILE_BOTTOMSTATUSBAR = isWorldTour()? WIDESCREENSTATUSBAR : BOTTOMSTATUSBAR; TILE_SPINNINGNUKEICON = SPINNINGNUKEICON; TILE_THREEDEE = THREEDEE; TILE_INGAMEDUKETHREEDEE = INGAMEDUKETHREEDEE; diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index fd5330363..961b18059 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -34,6 +34,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS + +#define VOLUMEALL (g_Shareware == 0) +#define PLUTOPAK (true)//g_scriptVersion >= 14) +#define VOLUMEONE (g_Shareware == 1) + +#define MOVEFIFOSIZ 256 + +#define MAXLEVELS 64 +#define MAXGAMETYPES 16 + +enum { + MUS_FIRST_SPECIAL = MAXVOLUMES * MAXLEVELS, + + MUS_INTRO = MUS_FIRST_SPECIAL, + MUS_BRIEFING = MUS_FIRST_SPECIAL + 1, + MUS_LOADING = MUS_FIRST_SPECIAL + 2, +}; + + #define MAXMINECARTS 16 #define MAXJAILDOORS 32 #define MAXLIGHTNINSECTORS 64 @@ -47,9 +66,6 @@ BEGIN_DUKE_NS #endif #define MAXINTERPOLATIONS MAXSPRITES -// KEEPINSYNC lunatic/con_lang.lua - -// duke3d global soup :( G_EXTERN int32_t duke3d_globalflags; @@ -77,11 +93,9 @@ G_EXTERN char pus,pub; G_EXTERN char ready2send; #define MAXPLAYERNAME 32 G_EXTERN char tempbuf[MAXSECTORS<<1],buf[1024]; -G_EXTERN uint8_t packbuf[PACKBUF_SIZE]; G_EXTERN input_t localInput; -G_EXTERN input_t recsync[RECSYNCBUFSIZ]; G_EXTERN int32_t avgfvel, avgsvel, avgbits; G_EXTERN fix16_t avgavel, avghorz; @@ -378,6 +392,24 @@ inline fixed_t PlayerInputAngVel(int pl) return g_player[pl].input->q16avel; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +inline void hud_drawsprite(int sx, int sy, int z, int16_t a, int16_t picnum, int8_t dashade, uint8_t dapalnum, int dastat) +{ + twod_rotatesprite(&twodpsp, sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); +} + +inline void hud_draw(int x, int y, int tilenum, int shade, int orientation) +{ + int p = sector[ps[screenpeek].cursectnum].floorpal; + hud_drawsprite(x << 16, y << 16, 65536L, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation); +} + + enum { kHitTypeMask = 0xC000, diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index 048472fca..965b5cd45 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -38,8 +38,6 @@ source as it is released. BEGIN_DUKE_NS -#define CRECT windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y - // wrapped in case it needs to be refactored int getavel(int snum) { @@ -55,19 +53,7 @@ int getavel(int snum) inline static void hud_drawpal(int x, int y, int tilenum, int shade, int orientation, int p) { - hud_rotatesprite(x << 16, y << 16, 65536, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -inline static void hud_draw(int x, int y, int tilenum, int shade, int orientation) -{ - int p = sector[ps[screenpeek].cursectnum].floorpal; - rotatesprite(x << 16, y << 16, 65536L, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); + hud_drawsprite(x << 16, y << 16, 65536, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation); } //--------------------------------------------------------------------------- @@ -187,7 +173,8 @@ int animateknuckles(int gs, int snum) else pal = sector[ps[snum].cursectnum].floorpal; - hud_drawpal(160 + (getavel(snum) >> 4) - (ps[snum].look_ang >> 1), looking_arc + 180 - ((ps[snum].gethoriz() - ps[snum].gethorizof()) >> 4), CRACKKNUCKLES + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); + auto pic = isWorldTour() ? CRACKKNUCKLESWIDE : CRACKKNUCKLES; + hud_drawpal(160 + (getavel(snum) >> 4) - (ps[snum].look_ang >> 1), looking_arc + 180 - ((ps[snum].gethoriz() - ps[snum].gethorizof()) >> 4), pic + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); return 1; } @@ -212,13 +199,13 @@ void displaymasks_d(int snum) { if (ud.screen_size > 4) { - rotatesprite(44 << 16, (200 - 8 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16, CRECT); - rotatesprite((320 - 43) << 16, (200 - 8 - tilesiz[SCUBAMASK].y) << 16, 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16, CRECT); + hud_drawsprite(44 << 16, (200 - 8 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16); + hud_drawsprite((320 - 43) << 16, (200 - 8 - tilesiz[SCUBAMASK].y) << 16, 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16); } else { - rotatesprite(44 << 16, (200 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16, CRECT); - rotatesprite((320 - 43) << 16, (200 - tilesiz[SCUBAMASK].y) << 16, 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16, CRECT); + hud_drawsprite(44 << 16, (200 - tilesiz[SCUBAMASK].y) << 16, 65536, 0, SCUBAMASK, 0, p, 2 + 16); + hud_drawsprite((320 - 43) << 16, (200 - tilesiz[SCUBAMASK].y) << 16, 65536, 1024, SCUBAMASK, 0, p, 2 + 4 + 16); } } } @@ -464,7 +451,8 @@ void displayweapon_d(int snum) auto displayrpg = [&]() { - pin = (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING) ? 0 : RS_ALIGN_R; + pin = (isWorldTour() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R; + auto rpgpic = isWorldTour() ? RPGGUNWIDE : RPGGUN; if (sprite[p->i].pal == 1) pal = 1; @@ -478,7 +466,7 @@ void displayweapon_d(int snum) if (*kb < (isWW2GI() ? aplWeaponTotalTime[RPG_WEAPON][snum] : 8)) { hud_drawpal(weapon_xoffset + 164, (looking_arc << 1) + 176 - gun_pos, - RPGGUN + (p->kickback_pic >> 1), gs, o | pin, pal); + rpgpic + (p->kickback_pic >> 1), gs, o | pin, pal); } else if (isWW2GI()) { @@ -503,7 +491,7 @@ void displayweapon_d(int snum) } } - hud_drawpal(weapon_xoffset + 164, (looking_arc << 1) + 176 - gun_pos, RPGGUN, gs, o | pin, pal); + hud_drawpal(weapon_xoffset + 164, (looking_arc << 1) + 176 - gun_pos, rpgpic, gs, o | pin, pal); }; //--------------------------------------------------------------------------- @@ -852,46 +840,47 @@ void displayweapon_d(int snum) } else { - pin = (isWW2GI() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R; + pin = (isWW2GI() || isWorldTour() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R; + auto pic = isWorldTour() ? FIRSTGUNRELOAD - 4 : FIRSTGUN; // I do not want to edit all code below const int WEAPON2_RELOAD_TIME = 50; auto reload_time = isWW2GI() ? aplWeaponReload[PISTOL_WEAPON][snum] : WEAPON2_RELOAD_TIME; if (p->kickback_pic < 10) - hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 230 - gun_pos, FIRSTGUN + 4, gs, o|pin, pal); + hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 230 - gun_pos, pic + 4, gs, o|pin, pal); else if (p->kickback_pic < 15) { - hud_drawpal(244 - (p->kickback_pic << 3) - (p->look_ang >> 1), looking_arc + 130 - gun_pos + (p->kickback_pic << 4), FIRSTGUN + 6, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal); + hud_drawpal(244 - (p->kickback_pic << 3) - (p->look_ang >> 1), looking_arc + 130 - gun_pos + (p->kickback_pic << 4), pic + 6, gs, o | pin, pal); + hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < 20) { - hud_drawpal(124 + (p->kickback_pic << 1) - (p->look_ang >> 1), looking_arc + 430 - gun_pos - (p->kickback_pic << 3), FIRSTGUN + 6, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal); + hud_drawpal(124 + (p->kickback_pic << 1) - (p->look_ang >> 1), looking_arc + 430 - gun_pos - (p->kickback_pic << 3), pic + 6, gs, o | pin, pal); + hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < (reload_time - 12)) { - hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal); + hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < (reload_time - 6)) { - hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal); + hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < (reload_time)) - hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 5, gs, o, pal); + hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 5, gs, o, pal); else if (p->kickback_pic < 23) { - hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal); + hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < 25) { - hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, FIRSTGUN + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal); + hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < 27) - hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FIRSTGUN + 5, gs, o | pin, pal); + hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 5, gs, o | pin, pal); } }; @@ -1082,7 +1071,8 @@ void displayweapon_d(int snum) auto displayfreezer = [&] { - pin = (isWW2GI() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R; + pin = (isWW2GI() || isWorldTour() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R; + auto pic = isWorldTour() ? FREEZEWIDE : FREEZE; if (sprite[p->i].pal == 1) pal = 1; @@ -1099,10 +1089,10 @@ void displayweapon_d(int snum) looking_arc += rand() & 3; } gun_pos -= 16; - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, FREEZE + 2, -32, o|pin, pal); - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FREEZE + 3 + cat_frames[*kb % 6], -32, o | pin, pal); + hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, pic + 2, -32, o|pin, pal); + hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 3 + cat_frames[*kb % 6], -32, o | pin, pal); } - else hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, FREEZE, gs, o | pin, pal); + else hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, pic, gs, o | pin, pal); }; //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index ff551c772..4587ed32c 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -33,9 +33,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms BEGIN_DUKE_NS -#define CRECT windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y - - //--------------------------------------------------------------------------- // // @@ -44,7 +41,7 @@ BEGIN_DUKE_NS inline static void hud_drawpal(int x, int y, int tilenum, int shade, int orientation, int p, int scale = 32768) { - hud_rotatesprite(x << 16, y << 16, scale, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); + hud_drawsprite(x << 16, y << 16, scale, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation); } inline static void rdmyospal(int x, int y, int tilenum, int shade, int orientation, int p) @@ -62,19 +59,6 @@ inline static void rd3myospal(int x, int y, int tilenum, int shade, int orientat hud_drawpal(x, y, tilenum, shade, orientation, p, 47040); } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -inline static void hud_draw(int x, int y, int tilenum, int shade, int orientation) -{ - int p = sector[ps[screenpeek].cursectnum].floorpal; - rotatesprite(x << 16, y << 16, 65536L, (orientation & 4) ? 1024 : 0, tilenum, shade, p, 2 | orientation, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); -} - - //--------------------------------------------------------------------------- // // @@ -94,11 +78,11 @@ void displaymasks_r(int snum) { int pin = 0; if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_STRETCH; - hud_rotatesprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15) << 16, (200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int)totalclock & 2047] >> 10)) << 16, 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin, CRECT); - hud_rotatesprite((320 - tilesiz[SCUBAMASK + 4].x) << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin, CRECT); - hud_rotatesprite(tilesiz[SCUBAMASK + 4].x << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 1024, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin, CRECT); - hud_rotatesprite(35 << 16, (-1) << 16, 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16 + pin, CRECT); - hud_rotatesprite(285 << 16, 200 << 16, 65536, 1024, SCUBAMASK + 3, 0, p, 2 + 16 + pin, CRECT); + hud_drawsprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15) << 16, (200 - (tilesiz[SCUBAMASK].y >> 1) + (sintable[(int)totalclock & 2047] >> 10)) << 16, 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin); + hud_drawsprite((320 - tilesiz[SCUBAMASK + 4].x) << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin); + hud_drawsprite(tilesiz[SCUBAMASK + 4].x << 16, (200 - tilesiz[SCUBAMASK + 4].y) << 16, 65536, 1024, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin); + hud_drawsprite(35 << 16, (-1) << 16, 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16 + pin); + hud_drawsprite(285 << 16, 200 << 16, 65536, 1024, SCUBAMASK + 3, 0, p, 2 + 16 + pin); } } @@ -110,13 +94,13 @@ void displaymasks_r(int snum) void ShowMotorcycle(int x, int y, short tilenum, signed char shade, char orientation, char p, short a) { - hud_rotatesprite(x << 16, y << 16, 34816L, a, tilenum, shade, p, 2 | orientation, CRECT); + hud_drawsprite(x << 16, y << 16, 34816L, a, tilenum, shade, p, 2 | orientation); } void ShowBoat(int x, int y, short tilenum, signed char shade, char orientation, char p, short a) { - hud_rotatesprite(x << 16, y << 16, 66048L, a, tilenum, shade, p, 2 | orientation, CRECT); + hud_drawsprite(x << 16, y << 16, 66048L, a, tilenum, shade, p, 2 | orientation); } diff --git a/source/games/duke/src/names_d.h b/source/games/duke/src/names_d.h index 191ccf2bf..793564bbf 100644 --- a/source/games/duke/src/names_d.h +++ b/source/games/duke/src/names_d.h @@ -11,13 +11,13 @@ of the License, or (at your option) any later version. 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. +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Original Source: 1996 - Todd Replogle Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms @@ -747,7 +747,21 @@ enum SIGN2 = 4912, JURYGUY = 4943, + // New names from World Tour + WIDESCREENSTATUSBAR = 5120, + RPGGUNWIDE = 5121, + FIRSTGUNRELOADWIDE = 5122, + FREEZEWIDE = 5123, + FREEZEFIREWIDE = 5124, + SHRINKERWIDE = 5127, + CRACKKNUCKLESWIDE = 5129, + ONFIRESMOKE = 5143, + LAVASPLASH = 5371, + BOSS2STAYPUT = 2711, + BOSS3STAYPUT = 2761, + WTGLASS1 = 5736, + WTGLASS2 = 5737, FLAMETHROWERSPRITE = 5134, FLAMETHROWERAMMO = 5135, FLAMETHROWER = 5138, diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 5b54a01cf..b1c789b64 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -530,7 +530,6 @@ void playerisdead(int snum, int psectlotag, int fz, int cz) #endif p->frag_ps = snum; - pus = NUMPAGES; } } diff --git a/source/games/duke/src/player.h b/source/games/duke/src/player.h index 964b243d6..decdfc351 100644 --- a/source/games/duke/src/player.h +++ b/source/games/duke/src/player.h @@ -448,17 +448,6 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, extern int lastvisinc; -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -inline void hud_rotatesprite(int sx, int sy, int z, int16_t a, int16_t picnum, int8_t dashade, uint8_t dapalnum, int dastat, int cx1, int cy1, int cx2, int cy2) -{ - twod_rotatesprite(&twodpsp, sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, cx1, cy1, cx2, cy2); -} - END_DUKE_NS #endif diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 0febdcce8..59ae80ba8 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1237,8 +1237,6 @@ void selectweapon_d(int snum, int j) // playernum, weaponnum if (j == SHRINKER_WEAPON && PLUTOPAK) // JBF 20040116: so we don't select the grower with v1.3d { - if (screenpeek == snum) pus = NUMPAGES; - if (p->curr_weapon != GROW_WEAPON && p->curr_weapon != SHRINKER_WEAPON) { if (p->ammo_amount[GROW_WEAPON] > 0) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index fc8c95719..63bd94176 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1019,8 +1019,6 @@ void selectweapon_r(int snum, int j) } else if (j == CROSSBOW_WEAPON && isRRRA()) { - if (screenpeek == snum) pus = NUMPAGES; - if (p->curr_weapon == CROSSBOW_WEAPON || p->ammo_amount[CROSSBOW_WEAPON] == 0) { if (p->ammo_amount[CHICKEN_WEAPON] == 0) @@ -1036,8 +1034,6 @@ void selectweapon_r(int snum, int j) } else if (j == THROWSAW_WEAPON) { - if (screenpeek == snum) pus = NUMPAGES; - if (p->curr_weapon == THROWSAW_WEAPON || p->ammo_amount[THROWSAW_WEAPON] == 0) { p->subweapon = (1 << BUZZSAW_WEAPON); @@ -1051,8 +1047,6 @@ void selectweapon_r(int snum, int j) } else if (j == POWDERKEG_WEAPON) { - if (screenpeek == snum) pus = NUMPAGES; - if (p->curr_weapon == POWDERKEG_WEAPON || p->ammo_amount[POWDERKEG_WEAPON] == 0) { p->subweapon = (1 << BOWLING_WEAPON); diff --git a/source/games/duke/src/sbar.cpp b/source/games/duke/src/sbar.cpp index 808259157..6063551b8 100644 --- a/source/games/duke/src/sbar.cpp +++ b/source/games/duke/src/sbar.cpp @@ -75,11 +75,10 @@ void DDukeCommonStatusBar::displayfragbar(void) for (i = connecthead; i >= 0; i = connectpoint2[i]) if (i > j) j = i; - rotatesprite(0, 0, 65600L, 0, TILE_FRAGBAR, 0, 0, 2 + 8 + 16 + 64 + 128, 0, 0, xdim - 1, ydim - 1); - if (j >= 4) rotatesprite(319, (8) << 16, 65600L, 0, TILE_FRAGBAR, 0, 0, 10 + 16 + 64 + 128, 0, 0, xdim - 1, ydim - 1); - if (j >= 8) rotatesprite(319, (16) << 16, 65600L, 0, TILE_FRAGBAR, 0, 0, 10 + 16 + 64 + 128, 0, 0, xdim - 1, ydim - 1); - if (j >= 12) rotatesprite(319, (24) << 16, 65600L, 0, TILE_FRAGBAR, 0, 0, 10 + 16 + 64 + 128, 0, 0, xdim - 1, ydim - 1); - + auto tex = tileGetTexture(TILE_FRAGBAR); + for (int y = 0; y < 32; y += 8) + DrawTexture(twod, tex, 0, 0, DTA_FullscreenScale, 3, DTA_ViewportWidth, 320, DTA_ViewportHeight, 200, DTA_ScaleX, 1.001, DTA_ScaleY, 1.001, TAG_Done); + for (i = connecthead; i >= 0; i = connectpoint2[i]) { m initext(21 + (73 * (i & 3)), 2 + ((i & 28) << 1), &ud.user_name[i][0], sprite[ps[i].i].pal, 2 + 8 + 16 + 128); diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index f898bee52..5d3615e41 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -58,7 +58,7 @@ public: DDukeStatusBar() { // optionally draw at the top of the screen. - SetSize(tilesiz[BOTTOMSTATUSBAR].y); + SetSize(tilesiz[TILE_BOTTOMSTATUSBAR].y); scale = 1; ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, TRIPBOMBSPRITE, FREEZEAMMO + 1, HBOMBAMMO, GROWAMMO/*, FLAMETHROWERAMMO + 1*/ }; @@ -345,11 +345,11 @@ public: void Statusbar(int snum) { auto p = g_player[snum].ps; - int h = tilesiz[BOTTOMSTATUSBAR].y; + int h = tilesiz[TILE_BOTTOMSTATUSBAR].y; int top = 200 - h; BeginStatusBar(320, 200, h, true); DrawInventory(p, 160, 154, 0); - DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); + DrawGraphic(tileGetTexture(TILE_BOTTOMSTATUSBAR), 0, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1); FString format; diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index f64790db2..f97610038 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1048,6 +1048,15 @@ void checkhitsprite_d(int i, int sn) switch (sprite[i].picnum) { + case WTGLASS1: + case WTGLASS2: + if (!isWorldTour()) + break; + A_PlaySound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + deletesprite(i); + return; + case OCEANSPRITE1: case OCEANSPRITE2: case OCEANSPRITE3: diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 26c53ec8e..6026d0c5c 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -386,7 +386,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh { auto const pl = &ps[myconnectindex]; if (!soundEngine->isValidSoundId(sndnum+1) || !SoundEnabled() || (unsigned)spriteNum >= MAXSPRITES || (pl->gm & MODE_MENU) || - (pl->timebeforeexit > 0 && pl->timebeforeexit <= GAMETICSPERSEC * 3)) return -1; + (pl->timebeforeexit > 0 && pl->timebeforeexit <= REALGAMETICSPERSEC * 3)) return -1; int userflags = S_GetUserFlags(sndnum); diff --git a/source/games/duke/src/zz_actors.h b/source/games/duke/src/zz_actors.h index 674a71337..e01781a3b 100644 --- a/source/games/duke/src/zz_actors.h +++ b/source/games/duke/src/zz_actors.h @@ -238,7 +238,6 @@ void setsectinterpolate(int sprnum); #endif ACTOR_INLINE_HEADER int A_CheckEnemyTile(int tileNum); -ACTOR_INLINE_HEADER int A_SetSprite(int spriteNum, uint32_t cliptype); EXTERN_INLINE_HEADER int A_CheckEnemySprite(void const * s); @@ -251,13 +250,6 @@ ACTOR_INLINE int A_CheckEnemyTile(int const tileNum) return ((actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0); } -int ssp(short i, unsigned int cliptype); //The set sprite function -void insertspriteq(int i); - -ACTOR_INLINE int A_SetSprite(int const spriteNum, uint32_t cliptype) -{ - return ssp(spriteNum, cliptype); -} # endif diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index 1e70091c9..a9d6a229c 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -160,8 +160,6 @@ void P_GetInput(int const playerNum) lastInputTicks = currentHiTicks; - auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); }; - if (buttonMap.ButtonDown(gamefunc_Strafe)) { if (!localInput.svel) @@ -330,7 +328,7 @@ void P_GetInput(int const playerNum) localInput.bits |= (mouseaim << SK_AIMMODE); localInput.bits |= (g_gameQuit << SK_GAMEQUIT); - localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; + localInput.bits |= !!inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; //localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; fixme.This needs to be done differently if (isRR()) @@ -492,8 +490,6 @@ void P_GetInputMotorcycle(int playerNum) lastInputTicks = currentHiTicks; - auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); }; - pPlayer->crouch_toggle = 0; localInput.bits |= buttonMap.ButtonDown(gamefunc_Fire) << SK_FIRE; @@ -502,7 +498,7 @@ void P_GetInputMotorcycle(int playerNum) localInput.bits |= buttonMap.ButtonDown(gamefunc_MedKit) << SK_MEDKIT; localInput.bits |= (buttonMap.ButtonDown(gamefunc_Inventory_Left) || (buttonMap.ButtonDown(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT; - localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; + localInput.bits |= !!inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; localInput.bits |= buttonMap.ButtonDown(gamefunc_Holo_Duke) << SK_HOLODUKE; localInput.bits |= buttonMap.ButtonDown(gamefunc_Jetpack) << SK_JETPACK; localInput.bits |= (g_gameQuit << SK_GAMEQUIT); @@ -686,8 +682,6 @@ void P_GetInputBoat(int playerNum) lastInputTicks = currentHiTicks; - auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); }; - pPlayer->crouch_toggle = 0; localInput.bits |= buttonMap.ButtonDown(gamefunc_Fire) << SK_FIRE; @@ -696,7 +690,7 @@ void P_GetInputBoat(int playerNum) localInput.bits |= buttonMap.ButtonDown(gamefunc_MedKit) << SK_MEDKIT; localInput.bits |= (buttonMap.ButtonDown(gamefunc_Inventory_Left) || (buttonMap.ButtonDown(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT; - localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; + localInput.bits |= !!inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; localInput.bits |= buttonMap.ButtonDown(gamefunc_Holo_Duke) << SK_HOLODUKE; localInput.bits |= buttonMap.ButtonDown(gamefunc_Jetpack) << SK_JETPACK; localInput.bits |= (g_gameQuit << SK_GAMEQUIT); diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 0dee91d3e..133885ee7 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -104,7 +104,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum) G_BonusScreen(0); #endif - show_shareware = GAMETICSPERSEC*34; + show_shareware = REALGAMETICSPERSEC*30; ud.level_number = levelNum; ud.volume_number = volumeNum; diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index dd100eb8c..c5be7d4c0 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -965,7 +965,7 @@ int32_t sv_saveandmakesnapshot(FileWriter &fil, int8_t spot, bool isAutoSave) if (isAutoSave) h.ptrsize |= 1u << 7u; - h.bytever = BYTEVERSION; + h.bytever = 0; h.userbytever = ud.userbytever; h.scriptcrc = 0; @@ -1053,14 +1053,8 @@ int32_t sv_loadheader(FileReader &fill, int32_t spot, savehead_t *h) return -2; } - if (h->majorver != SV_MAJOR_VER || h->minorver != SV_MINOR_VER || h->bytever != BYTEVERSION || h->userbytever != ud.userbytever || ScriptCode.Size()) + if (h->majorver != SV_MAJOR_VER || h->minorver != SV_MINOR_VER || h->bytever != 0 || h->userbytever != ud.userbytever || ScriptCode.Size()) { -#ifndef DEBUGGINGAIDS - if (havedemo) -#endif - Printf("Incompatible savegame. Expected version %d.%d.%d.%d, found %d.%d.%d.%d\n", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION, - ud.userbytever, h->majorver, h->minorver, h->bytever, h->userbytever); - if (h->majorver == SV_MAJOR_VER && h->minorver == SV_MINOR_VER) { return 1; diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index bd09ab616..27f5250a6 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -284,14 +284,15 @@ void G_DisplayRest(int32_t smoothratio) if ((unsigned) a < MAXTILES) { - vec2_t crosshairpos = { (160<<16) - (g_player[myconnectindex].ps->look_ang<<15), 100<<16 }; + vec2_t crosshairpos = { }; //vec2_t crosshairpos = { ud.returnvar[0], ud.returnvar[1] }; uint32_t crosshair_o = 1|2; - uint32_t crosshair_scale = divscale16(cl_crosshairscale, 100); - if (isRR()) - crosshair_scale >>= 1; + double crosshair_scale = cl_crosshairscale * .001; + if (isRR()) crosshair_scale *= .5; - rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, 0, crosshair_o); + DrawTexture(twod, tileGetTexture(a), 160 - (g_player[myconnectindex].ps->look_ang >> 1), 100, + DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, + DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x, DTA_ViewportY, windowxy2.y - windowxy1.y, TAG_DONE); } }