2020-10-17 07:14:31 +00:00
|
|
|
#pragma once
|
|
|
|
#include "dobject.h"
|
|
|
|
#include "build.h"
|
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
|
|
|
2021-11-26 20:13:19 +00:00
|
|
|
using DukeStatIterator = TStatIterator<DDukeActor>;
|
|
|
|
using DukeSectIterator = TSectIterator<DDukeActor>;
|
|
|
|
using DukeSpriteIterator = TSpriteIterator<DDukeActor>;
|
|
|
|
using DukeLinearSpriteIterator = TLinearSpriteIterator<DDukeActor>;
|
2020-10-27 06:15:03 +00:00
|
|
|
|
2020-10-17 07:26:52 +00:00
|
|
|
inline DDukeActor* player_struct::GetActor()
|
|
|
|
{
|
|
|
|
return &hittype[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int player_struct::GetPlayerNum()
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
return GetActor()->s->yvel;
|
2020-10-17 07:26:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int ActorToScriptIndex(DDukeActor* a)
|
|
|
|
{
|
|
|
|
if (!a) return -1;
|
2021-10-24 07:22:35 +00:00
|
|
|
return a->GetSpriteIndex();
|
2020-10-17 07:26:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline DDukeActor* ScriptIndexToActor(int index)
|
|
|
|
{
|
2020-10-17 08:30:11 +00:00
|
|
|
// only allow valid actors to get through here. Everything else gets null'ed.
|
2021-04-15 17:21:43 +00:00
|
|
|
if (index < 0 || index >= MAXSPRITES || hittype[index].s->statnum == MAXSTATUS) return nullptr;
|
2020-10-17 07:26:52 +00:00
|
|
|
return &hittype[index];
|
|
|
|
}
|
|
|
|
|
2021-11-19 09:41:50 +00:00
|
|
|
DDukeActor* spawn(DDukeActor* spawner, int type);
|
2020-10-17 07:26:52 +00:00
|
|
|
|
|
|
|
inline int ldist(DDukeActor* s1, DDukeActor* s2)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
return ldist(s1->s, s2->s);
|
2020-10-17 07:26:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int dist(DDukeActor* s1, DDukeActor* s2)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
return dist(s1->s, s2->s);
|
2020-10-17 07:26:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int badguy(DDukeActor* pSprite)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
return badguypic(pSprite->s->picnum);
|
2020-10-17 07:26:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int bossguy(DDukeActor* pSprite)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
return bossguypic(pSprite->s->picnum);
|
2020-10-17 07:26:52 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 17:14:41 +00:00
|
|
|
// old interface versions of already changed functions
|
|
|
|
|
|
|
|
inline void deletesprite(int num)
|
|
|
|
{
|
|
|
|
deletesprite(&hittype[num]);
|
|
|
|
}
|
|
|
|
|
2020-10-24 07:31:15 +00:00
|
|
|
int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision& result);
|
|
|
|
int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision& result);
|
|
|
|
|
|
|
|
inline int movesprite_ex(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision& result)
|
|
|
|
{
|
|
|
|
auto f = isRR() ? movesprite_ex_r : movesprite_ex_d;
|
|
|
|
return f(actor, xchange, ychange, zchange, cliptype, result);
|
|
|
|
}
|
|
|
|
|
2021-11-21 08:05:58 +00:00
|
|
|
|
2021-08-27 14:38:53 +00:00
|
|
|
|
2020-10-17 07:14:31 +00:00
|
|
|
END_DUKE_NS
|