Navigation Menu

Skip to content

Commit

Permalink
- no more picnum in gameexec.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 27, 2023
1 parent 5a2bb1d commit a6f9c27
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion source/games/duke/src/animatesprites.cpp
Expand Up @@ -109,7 +109,7 @@ bool RRRAFullbrightHack(tspritetype* t, int k)

void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAngle viewang)
{
if (GetActorInfo(h)->scriptaddress && !(h->flags2 & SFLAG2_DONTANIMATE))// && (t->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLAB)
if (h->conInfo()->scriptaddress && !(h->flags2 & SFLAG2_DONTANIMATE))// && (t->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLAB)
{
DAngle kang;
auto action = h->curAction;
Expand Down
17 changes: 7 additions & 10 deletions source/games/duke/src/gameexec.cpp
Expand Up @@ -1400,7 +1400,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
}
if (hs > sclip)
{
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
if (hit != nullptr && hit->GetClass() == actor->GetClass())
return 0;
else
{
Expand All @@ -1409,7 +1409,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
actor->spr.Angles.Yaw -= angdif;
if (hs > sclip)
{
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
if (hit != nullptr && hit->GetClass() == actor->GetClass())
return 0;
else
{
Expand All @@ -1418,7 +1418,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
actor->spr.Angles.Yaw -= angdif;
if (hs > 48)
{
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
if (hit != nullptr && hit->GetClass() == actor->GetClass())
return 0;
return 1;
}
Expand Down Expand Up @@ -1997,7 +1997,7 @@ int ParseState::parse(void)
break;
case concmd_ifactor:
insptr++;
parseifelse(g_ac->spr.picnum == *insptr);
parseifelse(g_ac->GetClass() == GetSpawnType(*insptr));
break;
case concmd_resetcount:
insptr++;
Expand Down Expand Up @@ -2127,7 +2127,6 @@ int ParseState::parse(void)
if (info != nullptr)
{
g_ac->ChangeType(info->cls);
g_ac->spr.picnum = *insptr;
}
insptr++;
break;
Expand Down Expand Up @@ -2471,7 +2470,7 @@ int ParseState::parse(void)
DukeStatIterator it(STAT_ACTOR);
while (auto actj = it.Next())
{
if (actj->spr.picnum == lType)
if (actj->GetClass() == GetSpawnType(lType))
{
lTemp = (g_ac->spr.pos.XY() - actj->spr.pos.XY()).Length();
if (lTemp < lMaxDist)
Expand Down Expand Up @@ -2514,7 +2513,7 @@ int ParseState::parse(void)
DukeStatIterator it(STAT_ACTOR);
while (auto actj = it.Next())
{
if (actj->spr.picnum == lType)
if (actj->GetClass() == GetSpawnType(lType))
{
lTemp = (g_ac->spr.pos.XY() - actj->spr.pos.XY()).Length();
if (lTemp < lMaxDist)
Expand Down Expand Up @@ -3233,9 +3232,7 @@ bool execute(DDukeActor *actor,int p,double pdist)
s.g_p = p; // Player ID
s.g_x = int(pdist / maptoworld); // ??
s.g_ac = actor;
s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->spr.picnum].scriptaddress)];
auto insptr = coninf? &ScriptCode[4 + coninf->scriptaddress] : nullptr;
if (insptr != s.insptr) Printf("%s: %p vs. %p\n", insptr, s.insptr);
s.insptr = coninf? &ScriptCode[4 + coninf->scriptaddress] : nullptr;
s.killit_flag = 0;

int done;
Expand Down
5 changes: 0 additions & 5 deletions source/games/duke/src/inlines.h
Expand Up @@ -311,11 +311,6 @@ inline void addkill(player_struct* p, DDukeActor* g_ac, int amount)
g_ac->actorstayput = nullptr;
}

inline ActorInfo* GetActorInfo(DDukeActor* actor)
{
auto cls = static_cast<PClassActor*>(actor->GetClass());
return &gs.actorinfo[cls->ActorInfo()->TypeNum];
}

inline const ActorInfo* DDukeActor::conInfo() const
{
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/savegame.cpp
Expand Up @@ -290,7 +290,7 @@ void DDukeActor::Serialize(FSerializer& arc)

arc("cgg", cgg)
("spriteextra", spriteextra)
("picnum", attackertype)
("attackertype", attackertype)
("ang", hitang)
("extra", hitextra)
("owneractor", ownerActor)
Expand Down

0 comments on commit a6f9c27

Please sign in to comment.