raze/source/games/duke/src/dukeactor.h
Christoph Oelckers dd2ea96d6c turn players into DObjects and fix several bugs with bad memory access.
* DObjects may not be memset to 0.
* There was still code trying to retrieve the player index with pointer artithmetic. With an array of pointers this does not work.
2023-10-02 21:03:59 +02:00

36 lines
819 B
C

#pragma once
#include "dobject.h"
#include "build.h"
BEGIN_DUKE_NS
using DukeStatIterator = TStatIterator<DDukeActor>;
using DukeSectIterator = TSectIterator<DDukeActor>;
using DukeSpriteIterator = TSpriteIterator<DDukeActor>;
inline DDukeActor* DDukePlayer::GetActor()
{
return static_cast<DDukeActor*>(actor);
}
inline int DDukePlayer::GetPlayerNum()
{
return GetActor()->PlayerIndex();
}
DDukeActor* spawn(DDukeActor* spawner, PClassActor* pname);
DDukeActor* spawnsprite(DDukeActor* origin, int typeId);
// return type is int for scripting - the value must still be true or false!
inline int badguy(const DDukeActor* pSprite)
{
return !!(pSprite->flags1 & (SFLAG_BADGUY | SFLAG_INTERNAL_BADGUY));
}
inline int bossguy(const DDukeActor* pSprite)
{
return !!(pSprite->flags1 & SFLAG_BOSS);
}
END_DUKE_NS