- migrated EGS and deletesprite to new actor interface.

Inline wrappers for old code exist.
The backupplayer inline was moved into player.cpp because that's the only place it gets used.
This commit is contained in:
Christoph Oelckers 2020-10-21 19:14:41 +02:00
parent b8b79b6fa9
commit 9cdaaff42b
16 changed files with 45 additions and 23 deletions

View File

@ -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());
}
//---------------------------------------------------------------------------

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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];

View File

@ -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

View File

@ -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++)
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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