- merged tileinfo and actorinfo.

This commit is contained in:
Christoph Oelckers 2022-12-21 22:17:17 +01:00
parent c5c8ed16a3
commit 947d427a9d
5 changed files with 11 additions and 10 deletions

View file

@ -1213,6 +1213,7 @@ int ConCompiler::parsecommand()
gs.actorinfo[lnum].scriptaddress = parsing_actor; // TRANSITIONAL should only store an index
if (tw == concmd_useractor)
{
gs.actorinfo[lnum].enemyflags |= EDukeFlags1::FromInt(1);
if (j & 1)
gs.actorinfo[lnum].enemyflags |= SFLAG_BADGUY | SFLAG_KILLCOUNT;
@ -2008,7 +2009,7 @@ int ConCompiler::parsecommand()
transnum(LABEL_DEFINE);
int n = popscriptvalue();
gs.tileinfo[n].loadeventscriptptr = parsing_actor;
gs.actorinfo[n].loadeventscriptptr = parsing_actor;
checking_ifelse = 0;
return 0;
}

View file

@ -3190,7 +3190,7 @@ void LoadActor(DDukeActor *actor, int p, int x)
s.g_ac = actor;
if (actor->spr.picnum < 0 || actor->spr.picnum >= MAXTILES) return;
auto addr = gs.tileinfo[actor->spr.picnum].loadeventscriptptr;
auto addr = gs.actorinfo[actor->spr.picnum].loadeventscriptptr;
if (addr == 0) return;
s.killit_flag = 0;

View file

@ -40,7 +40,6 @@ struct DukeGameInfo
int impact_damage;
int firstdebris;
TileInfo tileinfo[MAXTILES]; // This is not from EDuke32.
ActorInfo actorinfo[MAXTILES];
int16_t max_ammo_amount[MAX_WEAPONS];
int16_t weaponsandammosprites[15];

View file

@ -290,6 +290,12 @@ inline void processinputvel(int snum)
p->sync.svel = (float)velvect.Y;
}
inline const ActorInfo* DDukeActor::conInfo() const
{
auto tn = static_cast<PClassActor*>(GetClass())->ActorInfo()->TypeNum;
return tn < 0 ? nullptr : &gs.actorinfo[tn];
}
inline void setPlayerActorViewZOffset(DDukeActor* const pact)
{
if (!PlayClock)

View file

@ -54,6 +54,7 @@ inline TArray<ActorAI> ais;
struct ActorInfo
{
uint32_t loadeventscriptptr;
uint32_t scriptaddress;
EDukeFlags1 enemyflags; // placeholder during parsing. Since CON gets parsed before the spawn type table we cannot copy these to their final location yet.
};
@ -113,7 +114,7 @@ public:
DDukeActor() = default;
size_t PropagateMark() override;
const ActorInfo* actorInfo() const;
const ActorInfo* conInfo() const;
// This once was stored in the owner field of the sprite
inline DDukeActor* GetOwner()
@ -178,12 +179,6 @@ struct animwalltype
bool overpic;
};
// legacy CON baggage which needs to be refactored later.
struct TileInfo
{
int loadeventscriptptr;
};
struct user_defs
{
uint8_t god, cashman, eog;