- exported DukeActor's native member variables.

This includes renaming two native ones because they shared the same name with members of spritetype.
This commit is contained in:
Christoph Oelckers 2022-01-24 00:10:25 +01:00
parent f194fb6c90
commit a252b206d1
14 changed files with 125 additions and 69 deletions

View file

@ -5168,7 +5168,7 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
SKIPJIBS:
actor->attackertype = SHOTSPARK1;
actor->extra = 1;
actor->hitextra = 1;
actor->spr.zvel = 0;
}
else if (actor->spr.zvel > 2048 && actor->sector()->lotag != 1)

View file

@ -242,7 +242,7 @@ bool ifsquished(DDukeActor* actor, int p)
if (actor->spr.pal == 1)
{
actor->attackertype = SHOTSPARK1;
actor->extra = 1;
actor->hitextra = 1;
return false;
}
@ -349,7 +349,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (d < r && cansee(act2->spr.pos.X, act2->spr.pos.Y, act2->spr.pos.Z - (8 << 8), act2->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - (12 << 8), actor->sector()))
{
act2->ang = getangle(act2->spr.pos.X - actor->spr.pos.X, act2->spr.pos.Y - actor->spr.pos.Y);
act2->hitang = getangle(act2->spr.pos.X - actor->spr.pos.X, act2->spr.pos.Y - actor->spr.pos.Y);
if (actor->spr.picnum == RPG && act2->spr.extra > 0)
act2->attackertype = RPG;
@ -379,17 +379,17 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (d < r / 3)
{
if (hp4 == hp3) hp4++;
act2->extra = hp3 + (krand() % (hp4 - hp3));
act2->hitextra = hp3 + (krand() % (hp4 - hp3));
}
else if (d < 2 * r / 3)
{
if (hp3 == hp2) hp3++;
act2->extra = hp2 + (krand() % (hp3 - hp2));
act2->hitextra = hp2 + (krand() % (hp3 - hp2));
}
else if (d < r)
{
if (hp2 == hp1) hp2++;
act2->extra = hp1 + (krand() % (hp2 - hp1));
act2->hitextra = hp1 + (krand() % (hp2 - hp1));
}
if (act2->spr.picnum != TANK && act2->spr.picnum != ROTATEGUN && act2->spr.picnum != RECON && !bossguy(act2))
@ -401,7 +401,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (gs.actorinfo[act2->spr.picnum].flags & SFLAG_HITRADIUSCHECK)
fi.checkhitsprite(act2, actor);
}
else if (actor->spr.extra == 0) act2->extra = 0;
else if (actor->spr.extra == 0) act2->hitextra = 0;
if (act2->spr.picnum != RADIUSEXPLOSION && Owner && Owner->spr.statnum < MAXSTATUS)
{
@ -598,7 +598,7 @@ int ifhitbyweapon_d(DDukeActor *actor)
int p;
auto hitowner = actor->GetHitOwner();
if (actor->extra >= 0)
if (actor->hitextra >= 0)
{
if (actor->spr.extra >= 0)
{
@ -614,7 +614,7 @@ int ifhitbyweapon_d(DDukeActor *actor)
ud.ffire == 0)
return -1;
actor->spr.extra -= actor->extra;
actor->spr.extra -= actor->hitextra;
if (hitowner)
{
@ -641,18 +641,18 @@ int ifhitbyweapon_d(DDukeActor *actor)
case SEENINE:
case OOZFILTER:
case EXPLODINGBARREL:
ps[p].vel.X += actor->extra * bcos(actor->ang, 2);
ps[p].vel.Y += actor->extra * bsin(actor->ang, 2);
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 2);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 2);
break;
default:
ps[p].vel.X += actor->extra * bcos(actor->ang, 1);
ps[p].vel.Y += actor->extra * bsin(actor->ang, 1);
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 1);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 1);
break;
}
}
else
{
if (actor->extra == 0)
if (actor->hitextra == 0)
if (actor->attackertype == SHRINKSPARK && actor->spr.xrepeat < 24)
return -1;
@ -662,13 +662,13 @@ int ifhitbyweapon_d(DDukeActor *actor)
return -1;
}
actor->spr.extra -= actor->extra;
actor->spr.extra -= actor->hitextra;
auto Owner = actor->GetOwner();
if (actor->spr.picnum != RECON && Owner && Owner->spr.statnum < MAXSTATUS)
actor->SetOwner(hitowner);
}
actor->extra = -1;
actor->hitextra = -1;
return actor->attackertype;
}
}
@ -676,13 +676,13 @@ int ifhitbyweapon_d(DDukeActor *actor)
if (ud.multimode < 2 || !isWorldTour()
|| actor->attackertype != FLAMETHROWERFLAME
|| actor->extra >= 0
|| actor->hitextra >= 0
|| actor->spr.extra > 0
|| actor->spr.picnum != APLAYER
|| ps[actor->PlayerIndex()].numloogs > 0
|| hitowner == nullptr)
{
actor->extra = -1;
actor->hitextra = -1;
return -1;
}
else
@ -695,7 +695,7 @@ int ifhitbyweapon_d(DDukeActor *actor)
ps[p].frag_ps = hitowner->PlayerIndex(); // set the proper player index here - this previously set the sprite index...
actor->SetHitOwner(ps[p].GetActor());
actor->extra = -1;
actor->hitextra = -1;
return FLAMETHROWERFLAME;
}
@ -745,7 +745,7 @@ void movefallers_d(void)
}
else
{
act->extra = 0;
act->hitextra = 0;
act->spr.extra = x;
}
}

View file

@ -301,7 +301,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
continue;
}
act2->ang = getangle(act2->spr.pos.X - actor->spr.pos.X, act2->spr.pos.Y - actor->spr.pos.Y);
act2->hitang = getangle(act2->spr.pos.X - actor->spr.pos.X, act2->spr.pos.Y - actor->spr.pos.Y);
if (actor->spr.picnum == RPG && act2->spr.extra > 0)
act2->attackertype = RPG;
@ -313,17 +313,17 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (d < r / 3)
{
if (hp4 == hp3) hp4++;
act2->extra = hp3 + (krand() % (hp4 - hp3));
act2->hitextra = hp3 + (krand() % (hp4 - hp3));
}
else if (d < 2 * r / 3)
{
if (hp3 == hp2) hp3++;
act2->extra = hp2 + (krand() % (hp3 - hp2));
act2->hitextra = hp2 + (krand() % (hp3 - hp2));
}
else if (d < r)
{
if (hp2 == hp1) hp2++;
act2->extra = hp1 + (krand() % (hp2 - hp1));
act2->hitextra = hp1 + (krand() % (hp2 - hp1));
}
int pic = act2->spr.picnum;
@ -502,7 +502,7 @@ int ifhitbyweapon_r(DDukeActor *actor)
int p;
auto hitowner = actor->GetHitOwner();
if (actor->extra >= 0)
if (actor->hitextra >= 0)
{
if (actor->spr.extra >= 0)
{
@ -518,7 +518,7 @@ int ifhitbyweapon_r(DDukeActor *actor)
ud.ffire == 0)
return -1;
actor->spr.extra -= actor->extra;
actor->spr.extra -= actor->hitextra;
if (hitowner)
{
@ -549,32 +549,32 @@ int ifhitbyweapon_r(DDukeActor *actor)
case EXPLODINGBARREL:
case TRIPBOMBSPRITE:
case RPG2:
ps[p].vel.X += actor->extra * bcos(actor->ang, 2);
ps[p].vel.Y += actor->extra * bsin(actor->ang, 2);
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 2);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 2);
break;
default:
ps[p].vel.X += actor->extra * bcos(actor->ang, 1);
ps[p].vel.Y += actor->extra * bsin(actor->ang, 1);
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 1);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 1);
break;
}
}
else
{
if (actor->extra == 0)
if (actor->hitextra == 0)
if (actor->spr.xrepeat < 24)
return -1;
actor->spr.extra -= actor->extra;
actor->spr.extra -= actor->hitextra;
if (actor->spr.picnum != RECON && actor->GetOwner() && actor->GetOwner()->spr.statnum < MAXSTATUS)
actor->SetOwner(hitowner);
}
actor->extra = -1;
actor->hitextra = -1;
return actor->attackertype;
}
}
actor->extra = -1;
actor->hitextra = -1;
return -1;
}
@ -670,7 +670,7 @@ void movefallers_r(void)
}
else
{
act->extra = 0;
act->hitextra = 0;
act->spr.extra = x;
}
}
@ -3880,7 +3880,7 @@ static int fallspecial(DDukeActor *actor, int playernum)
return 0;
}
actor->attackertype = SHOTSPARK1;
actor->extra = 1;
actor->hitextra = 1;
}
else if (isRRRA() && (actor->sector()->floorpicnum == RRTILE7820 || actor->sector()->floorpicnum == RRTILE7768))
{
@ -3889,7 +3889,7 @@ static int fallspecial(DDukeActor *actor, int playernum)
if ((krand() & 3) == 1)
{
actor->attackertype = SHOTSPARK1;
actor->extra = 5;
actor->hitextra = 5;
}
}
}
@ -3941,7 +3941,7 @@ void destroyit(DDukeActor *actor)
if (a3->spr.picnum == DESTRUCTO)
{
a3->attackertype = SHOTSPARK1;
a3->extra = 1;
a3->hitextra = 1;
}
}
}

View file

@ -68,7 +68,7 @@ static const char *cheatGod(int myconnectindex, int state)
p->resurrected = true;
act->spr.extra = gs.max_player_health;
act->extra = 0;
act->hitextra = 0;
if (ud.god)
{
if (isRRRA()) S_PlaySound(218, CHAN_AUTO, CHANF_UI);
@ -92,7 +92,7 @@ static const char *cheatGod(int myconnectindex, int state)
{
ud.god = 0;
act->spr.extra = gs.max_player_health;
act->extra = -1;
act->hitextra = -1;
ps[myconnectindex].last_extra = gs.max_player_health;
return quoteMgr.GetQuote(QUOTE_CHEAT_GODMODE_OFF);
}

View file

@ -292,11 +292,6 @@ enum amoveflags_t
antifaceplayerslow = 32768
};
enum aflags_t
{
AFLAG_USEACTIVATOR = 0x00000001,
};
enum sflags_t
{
SFLAG_INVENTORY = 0x00000001,
@ -317,7 +312,7 @@ enum sflags_t
SFLAG_TRIGGER_IFHITSECTOR = 0x00008000,
SFLAG_MOVEFTA_WAKEUPCHECK = 0x00010000,
SFLAG_MOVEFTA_CHECKSEEWITHPAL8 = 0x00020000, // let's hope this can be done better later. For now this was what blocked merging the Duke and RR variants of movefta
SFLAG_NOSHADOW = 0x00020000,
SFLAG_NOSHADOW = 0x00040000,
};
@ -326,7 +321,7 @@ DEFINE_TFLAGS_OPERATORS(EDukeFlags1)
enum sflags2_t
{
SFLAG2_USEACTIVATOR = 0x00000001,
};
using EDukeFlags2 = TFlags<sflags2_t, uint32_t>;

View file

@ -41,6 +41,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "gamestate.h"
#include "razefont.h"
#include "psky.h"
#include "vm.h"
BEGIN_DUKE_NS
@ -397,4 +398,23 @@ void GameInterface::app_init()
S_ParseDeveloperCommentary();
}
DEFINE_FIELD(DDukeActor, ownerActor)
DEFINE_FIELD(DDukeActor, hitOwnerActor)
DEFINE_FIELD(DDukeActor, cgg)
DEFINE_FIELD(DDukeActor, spriteextra)
DEFINE_FIELD(DDukeActor, hitang)
DEFINE_FIELD(DDukeActor, hitextra)
DEFINE_FIELD(DDukeActor, movflag)
DEFINE_FIELD(DDukeActor, tempang)
DEFINE_FIELD(DDukeActor, timetosleep)
DEFINE_FIELD(DDukeActor, floorz)
DEFINE_FIELD(DDukeActor, ceilingz)
DEFINE_FIELD(DDukeActor, saved_ammo)
DEFINE_FIELD(DDukeActor, palvals)
DEFINE_FIELD(DDukeActor, temp_data)
DEFINE_FIELD(DDukeActor, temp_actor)
DEFINE_FIELD(DDukeActor, seek_actor)
DEFINE_FIELD(DDukeActor, flags1)
DEFINE_FIELD(DDukeActor, flags2)
END_DUKE_NS

View file

@ -1281,12 +1281,12 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, act->attackertype, sActor, sPlayer);
break;
case ACTOR_HTANG:
if (bSet) act->ang = lValue;
else SetGameVarID(lVar2, act->ang, sActor, sPlayer);
if (bSet) act->hitang = lValue;
else SetGameVarID(lVar2, act->hitang, sActor, sPlayer);
break;
case ACTOR_HTEXTRA:
if (bSet) act->extra = lValue;
else SetGameVarID(lVar2, act->extra, sActor, sPlayer);
if (bSet) act->hitextra = lValue;
else SetGameVarID(lVar2, act->hitextra, sActor, sPlayer);
break;
case ACTOR_HTOWNER:
if (bSet) act->hitOwnerActor = vValue.safeActor();
@ -2281,7 +2281,7 @@ int ParseState::parse(void)
ps[g_p].falling_counter = 0;
g_ac->extra = -1;
g_ac->hitextra = -1;
g_ac->cgg = 0;
g_ac->movflag = 0;

View file

@ -2477,7 +2477,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim)
else
victim->SetHitOwner(p->GetActor());
victim->attackertype = MOTOHIT;
victim->extra = xs_CRoundToInt(p->MotoSpeed / 2.);
victim->hitextra = xs_CRoundToInt(p->MotoSpeed / 2.);
p->MotoSpeed -= p->MotoSpeed / 4.;
p->TurbCount = 6;
}
@ -2537,7 +2537,7 @@ void onBoatHit(int snum, DDukeActor* victim)
else
victim->SetHitOwner(p->GetActor());
victim->attackertype = MOTOHIT;
victim->extra = xs_CRoundToInt(p->MotoSpeed / 4.);
victim->hitextra = xs_CRoundToInt(p->MotoSpeed / 4.);
p->MotoSpeed -= p->MotoSpeed / 4.;
p->TurbCount = 6;
}
@ -3460,7 +3460,7 @@ void processinput_r(int snum)
if (badguy(clz.actor()))
{
clz.actor()->attackertype = MOTOHIT;
clz.actor()->extra = xs_CRoundToInt(2 + (p->MotoSpeed / 2.));
clz.actor()->hitextra = xs_CRoundToInt(2 + (p->MotoSpeed / 2.));
p->MotoSpeed -= p->MotoSpeed / 16.;
}
if (p->OnBoat)
@ -3468,7 +3468,7 @@ void processinput_r(int snum)
if (badguy(clz.actor()))
{
clz.actor()->attackertype = MOTOHIT;
clz.actor()->extra = xs_CRoundToInt(2 + (p->MotoSpeed / 2.));
clz.actor()->hitextra = xs_CRoundToInt(2 + (p->MotoSpeed / 2.));
p->MotoSpeed -= p->MotoSpeed / 16.;
}
}

View file

@ -297,8 +297,8 @@ void DDukeActor::Serialize(FSerializer& arc)
arc("cgg", cgg)
("spriteextra", spriteextra)
("picnum", attackertype)
("ang", ang)
("extra", extra)
("ang", hitang)
("extra", hitextra)
("owneractor", ownerActor)
("owner", hitOwnerActor)
("movflag", movflag)
@ -310,7 +310,6 @@ void DDukeActor::Serialize(FSerializer& arc)
("ceilingz", ceilingz)
("lastvx", ovel.X)
("lastvy", ovel.Y)
("aflags", aflags)
("saved_ammo", saved_ammo)
("temp_actor", temp_actor)
("seek_actor", seek_actor)
@ -318,6 +317,8 @@ void DDukeActor::Serialize(FSerializer& arc)
.Array("temo_wall", temp_walls, 2)
("temp_sect", temp_sect)
("uservars", uservars)
("flags1", flags1)
("flags2", flags2)
("fireproj", fproj);
}

View file

@ -1453,8 +1453,8 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
}
targ->attackertype = hitpic;
targ->extra += proj->spr.extra;
targ->ang = proj->spr.ang;
targ->hitextra += proj->spr.extra;
targ->hitang = proj->spr.ang;
targ->SetHitOwner(Owner);
}

View file

@ -2400,9 +2400,9 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
return;
targ->attackertype = proj->spr.picnum;
targ->extra += proj->spr.extra;
targ->hitextra += proj->spr.extra;
if (targ->spr.picnum != COW)
targ->ang = proj->spr.ang;
targ->hitang = proj->spr.ang;
targ->SetHitOwner(proj->GetOwner());
}
@ -2933,7 +2933,7 @@ void tearitup(sectortype* sect)
if (act->spr.picnum == DESTRUCTO)
{
act->attackertype = SHOTSPARK1;
act->extra = 1;
act->hitextra = 1;
}
}
}

View file

@ -85,7 +85,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8
act->timetosleep = 0;
act->actorstayput = nullptr;
act->extra = -1;
act->hitextra = -1;
act->cgg = 0;
act->movflag = 0;
act->tempang = 0;
@ -139,7 +139,7 @@ bool initspriteforspawn(DDukeActor* act, const std::initializer_list<int> &exclu
{
act->attackertype = act->spr.picnum;
act->timetosleep = 0;
act->extra = -1;
act->hitextra = -1;
act->backuppos();
@ -1026,7 +1026,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
while (auto itActor = it.Next())
{
if (itActor->spr.picnum == ACTIVATOR || itActor->spr.picnum == ACTIVATORLOCKED)
actor->aflags |= AFLAG_USEACTIVATOR;
actor->flags2 |= SFLAG2_USEACTIVATOR;
}
ChangeActorStat(actor, STAT_LIGHT);
break;

View file

@ -35,11 +35,11 @@ public:
uint8_t cgg;
uint8_t spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'.
short attackertype, ang, extra, movflag;
short attackertype, hitang, hitextra, movflag;
short tempang, dispicnum;
short timetosleep;
vec2_t ovel;
int floorz, ceilingz, aflags;
int floorz, ceilingz;
union
{
int saved_ammo;
@ -54,6 +54,9 @@ public:
TArray<GameVarValue> uservars;
EDukeFlags1 flags1;
EDukeFlags2 flags2;
// Todo: Once we start assigning subclasses to actors, this one needs to be moved to the proper FIREBALL subclass.
FireProj fproj;

View file

@ -1,3 +1,40 @@
class DukeActor : CoreActor native
{
native DukeActor ownerActor, hitOwnerActor;
native uint8 cgg;
native uint8 spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'.
native int16 /*attackertype,*/ hitang, hitextra, movflag;
native int16 tempang; /*, dispicnum;*/
native int16 timetosleep;
native int floorz, ceilingz;
native int saved_ammo;
native int palvals;
native int temp_data[6];
native private int flags1, flags2;
//walltype* temp_walls[2]; // SE20 + SE128
//sectortype* temp_sect, *actorstayput;
native DukeActor temp_actor, seek_actor;
flagdef Inventory: flags1, 0;
flagdef ShrinkAutoaim: flags1, 1;
flagdef Badguy: flags1, 2;
flagdef ForceAutoaim: flags1, 3;
flagdef Boss: flags1, 4;
flagdef Badguystayput: flags1, 5;
flagdef GreenSlimeFood: flags1, 6;
flagdef NoDamagePush: flags1, 7;
flagdef NoWaterDrip: flags1, 8;
flagdef InternalBadguy: flags1, 9;
flagdef Killcount: flags1, 10;
flagdef NoCanSeeCheck: flags1, 11;
flagdef HitRadiusCheck: flags1, 12;
flagdef MoveFTA_CheckSee: flags1, 13;
flagdef MoveFTA_MakeStandable: flags1, 14;
flagdef TriggerIfHitSector: flags1, 15;
//flagdef MoveFTA_WakeupCheck: flags1, 16; // this one needs to be auto-set for RR, not for Duke, should not be exposed unless the feature becomes generally available.
flagdef CheckSeeWithPal8: flags1, 17;
flagdef NoShadow: flags1, 18;
}