diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index c5734083e..b77e5e0ef 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -57,11 +57,13 @@ int adjustfall(spritetype* s, int c); // //--------------------------------------------------------------------------- -void RANDOMSCRAP(spritetype *s, int i) +void RANDOMSCRAP(DDukeActor* origin) { 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); + EGS(origin->s.sectnum, + origin->s.x + (r7 & 255) - 128, origin->s.y + (r6 & 255) - 128, origin->s.z - (8 << 8) - (r5 & 8191), + TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), origin, 5); } //--------------------------------------------------------------------------- @@ -70,13 +72,13 @@ void RANDOMSCRAP(spritetype *s, int i) // //--------------------------------------------------------------------------- -void deletesprite(int num) +void deletesprite(DDukeActor *const actor) { - if (sprite[num].picnum == MUSICANDSFX && hittype[num].temp_data[0] == 1) - S_StopSound(sprite[num].lotag, num); + if (actor->s.picnum == MUSICANDSFX && actor->temp_data[0] == 1) + S_StopSound(actor->s.lotag, actor); else - S_RelinkActorSound(num, -1); - ::deletesprite(num); + S_RelinkActorSound(actor, nullptr); + ::deletesprite(actor->GetIndex()); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 77a0e821f..c11b67717 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -38,6 +38,7 @@ This file contains parts of DukeGDX by Alexander Makarov-[M210] (m210-2007@mail. #include "global.h" #include "names_d.h" #include "serializer.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 14fdfd867..1328cf976 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -31,6 +31,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "names_r.h" #include "mmulti.h" #include "mapinfo.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/bowling.cpp b/source/games/duke/src/bowling.cpp index ef8314f32..bb9579b8c 100644 --- a/source/games/duke/src/bowling.cpp +++ b/source/games/duke/src/bowling.cpp @@ -29,6 +29,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" #include "names_r.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 6608bc810..07a98bd6e 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -34,6 +34,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) #include "cheathandler.h" #include "c_dispatch.h" #include "gamestate.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index b6ebea8d9..76b5e29af 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -9,10 +9,10 @@ #include "polymost.h" #include "gamecvars.h" #include "razemenu.h" -#include "funct.h" #include "gamecontrol.h" #include "gamevar.h" #include "global.h" +#include "funct.h" #include "names.h" #include "quotemgr.h" #include "rts.h" diff --git a/source/games/duke/src/dukeactor.h b/source/games/duke/src/dukeactor.h index 68434962a..30e6e7d13 100644 --- a/source/games/duke/src/dukeactor.h +++ b/source/games/duke/src/dukeactor.h @@ -101,11 +101,6 @@ inline void changespritesect(int i, int newsect) ::changespritesect(i, newsect); } -inline void deletesprite(DDukeActor* i) -{ - deletesprite(i->GetIndex()); -} - inline int setsprite(DDukeActor* a, int x, int y, int z) { return ::setsprite(a->GetIndex(), x, y, z); @@ -206,4 +201,16 @@ inline void SetGameVarID(int id, int lValue, DDukeActor* sActor, int sPlayer) SetGameVarID(id, lValue, sActor->GetIndex(), sPlayer); } +// old interface versions of already changed functions + +inline void RANDOMSCRAP(spritetype* s, int i) +{ + return RANDOMSCRAP(&hittype[s - sprite]); +} + +inline void deletesprite(int num) +{ + deletesprite(&hittype[num]); +} + END_DUKE_NS diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 381dddee7..f813903e4 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -3,11 +3,14 @@ #include "screenjob.h" #include "constants.h" #include "packet.h" +#include "types.h" struct MapRecord; BEGIN_DUKE_NS + + // dumping ground for all external function prototypes to keep them out of the important headers. // This list is not sorted in any way. @@ -25,7 +28,7 @@ void doanimations(); void movefx(); void moveclouds(double smoothratio); -void RANDOMSCRAP(spritetype* s, int i); +void RANDOMSCRAP(DDukeActor* i); void ms(short i); void movecrane(int i, int crane); void movefountain(int i, int fountain); @@ -94,7 +97,7 @@ int dodge(spritetype*); void alterang(int a, int g_i, int g_p); void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*)); void checkavailweapon(struct player_struct* p); -void deletesprite(int num); +void deletesprite(DDukeActor* num); void addammo(int weapon, struct player_struct* p, int amount); int ssp(int i, unsigned int cliptype); //The set sprite function diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 2aee773c6..cbc53b7dc 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -187,13 +187,6 @@ inline bool playrunning() return (paused == 0 || (paused == 1 && (ud.recstat == 2 || ud.multimode > 1))); } -inline void backupplayer(player_struct* p) -{ - backuppos(p); - p->angle.backup(); - p->horizon.backup(); -} - // the weapon display code uses this. inline double get16thOfHoriz(int const snum, bool const interpolate, double const smoothratio) { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 1c998b9d6..bd9cff4ec 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -571,6 +571,13 @@ void footprints(int snum) // //--------------------------------------------------------------------------- +inline void backupplayer(player_struct* p) +{ + backuppos(p); + p->angle.backup(); + p->horizon.backup(); +} + void playerisdead(int snum, int psectlotag, int fz, int cz) { auto p = &ps[snum]; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 05cae826d..11715a1bb 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -30,6 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "global.h" #include "names_r.h" #include "mapinfo.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index a43a0e9a4..65e2b7612 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -34,6 +34,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "gamestate.h" #include "sbar.h" #include "automap.h" +#include "dukeactor.h" BEGIN_DUKE_NS @@ -508,7 +509,7 @@ void resetpspritevars(int g) STATUSBARTYPE tsbar[MAXPLAYERS]; EGS(ps[0].cursectnum, ps[0].posx, ps[0].posy, ps[0].posz, - TILE_APLAYER, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, 0, 10); + TILE_APLAYER, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, nullptr, 10); if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++) { diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 90030f2da..305996333 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -36,6 +36,7 @@ source as it is released. #include "global.h" #include "build.h" #include "names_d.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index c436db2ce..a47fb42d9 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -30,6 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "global.h" #include "names_r.h" #include "mapinfo.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 55f449b35..765b3878d 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -37,6 +37,7 @@ source as it is released. #include "sounds.h" #include "names_d.h" #include "mapinfo.h" +#include "dukeactor.h" // PRIMITIVE BEGIN_DUKE_NS diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index ad3c5e710..c70abbab4 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -31,6 +31,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "sounds.h" #include "names_r.h" #include "mapinfo.h" +#include "dukeactor.h" // PRIMITIVE BEGIN_DUKE_NS