Mana
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ActorSprite Class Reference

#include <actorsprite.h>

Inheritance diagram for ActorSprite:
Actor Being FloorItem LocalPlayer

Public Types

enum  Type {
  UNKNOWN , PLAYER , NPC , MONSTER ,
  FLOOR_ITEM , PORTAL
}
 
enum  TargetCursorSize { TC_SMALL = 0 , TC_MEDIUM , TC_LARGE , NUM_TC }
 
enum  TargetCursorType { TCT_NONE = -1 , TCT_NORMAL = 0 , TCT_IN_RANGE , NUM_TCT }
 

Public Member Functions

 ActorSprite (int id)
 
 ~ActorSprite () override
 
int getId () const
 
void setId (int id)
 
virtual Type getType () const
 Returns the type of the ActorSprite.
 
int getDrawOrder () const override
 Returns the pixel Y coordinate that the actor should be drawn at.
 
bool draw (Graphics *graphics, int offsetX, int offsetY) const override
 Draws the Actor to the given graphics context.
 
bool drawSpriteAt (Graphics *graphics, int x, int y) const
 
virtual void logic ()
 
void setMap (Map *map) override
 
virtual Map::BlockType getBlockType () const
 Gets the way the object blocks pathfinding for other objects.
 
void controlParticle (Particle *particle)
 Take control of a particle.
 
virtual TargetCursorSize getTargetCursorSize () const
 Returns the required size of a target cursor for this being.
 
void setTargetType (TargetCursorType type)
 Sets the target animation for this actor.
 
void untarget ()
 Untargets the actor.
 
void setAlpha (float alpha) override
 Sets the alpha value used to draw the actor.
 
float getAlpha () const override
 Returns the current alpha value used to draw the actor.
 
int getWidth () const
 
int getHeight () const
 
- Public Member Functions inherited from Actor
 Actor ()
 
virtual ~Actor ()
 
const VectorgetPosition () const
 Returns the pixel position of this actor.
 
virtual void setPosition (const Vector &pos)
 Sets the pixel position of this actor.
 
int getPixelX () const
 Returns the pixels X coordinate of the actor.
 
int getPixelY () const
 Returns the pixel Y coordinate of the actor.
 
virtual bool drawnWhenBehind () const
 Determines wether the actor should be drawn translucent when behind another object.
 
virtual int getTileX () const
 Returns the x coordinate in tiles of the actor.
 
virtual int getTileY () const
 Returns the y coordinate in tiles of the actor.
 
MapgetMap () const
 

Static Public Member Functions

static void load ()
 
static void unload ()
 

Protected Member Functions

void setupSpriteDisplay (const SpriteDisplay &display, bool forceDisplay=true)
 

Protected Attributes

int mId
 
std::vector< ParticleHandlemChildParticleEffects
 
CompoundSprite mSprites
 
- Protected Attributes inherited from Actor
MapmMap = nullptr
 
Vector mPos
 Position in pixels relative to map.
 

Static Private Member Functions

static void initTargetCursor ()
 Load the target cursors into memory.
 
static void cleanupTargetCursors ()
 Remove the target cursors from memory.
 
static void loadTargetCursor (const std::string &filename, int width, int height, int type, int size)
 Helper function for loading target cursors.
 

Private Attributes

SimpleAnimationmUsedTargetCursor = nullptr
 Target cursor being used.
 

Static Private Attributes

static ResourceRef< ImageSettargetCursorImages [NUM_TCT][NUM_TC]
 Images of the target cursor.
 
static SimpleAnimationtargetCursor [NUM_TCT][NUM_TC]
 Animated target cursors.
 
static bool loaded = false
 

Detailed Description

Definition at line 30 of file actorsprite.h.

Member Enumeration Documentation

◆ TargetCursorSize

Enumerator
TC_SMALL 
TC_MEDIUM 
TC_LARGE 
NUM_TC 

Definition at line 43 of file actorsprite.h.

◆ TargetCursorType

Enumerator
TCT_NONE 
TCT_NORMAL 
TCT_IN_RANGE 
NUM_TCT 

Definition at line 51 of file actorsprite.h.

◆ Type

Enumerator
UNKNOWN 
PLAYER 
NPC 
MONSTER 
FLOOR_ITEM 
PORTAL 

Definition at line 33 of file actorsprite.h.

Constructor & Destructor Documentation

◆ ActorSprite()

ActorSprite::ActorSprite ( int  id)

Definition at line 47 of file actorsprite.cpp.

◆ ~ActorSprite()

ActorSprite::~ActorSprite ( )
override

Definition at line 51 of file actorsprite.cpp.

Member Function Documentation

◆ cleanupTargetCursors()

void ActorSprite::cleanupTargetCursors ( )
staticprivate

Remove the target cursors from memory.

Definition at line 194 of file actorsprite.cpp.

◆ controlParticle()

void ActorSprite::controlParticle ( Particle particle)

Take control of a particle.

Definition at line 109 of file actorsprite.cpp.

◆ draw()

bool ActorSprite::draw ( Graphics graphics,
int  offsetX,
int  offsetY 
) const
overridevirtual

Draws the Actor to the given graphics context.

Note: this function could be simplified if the graphics context would support setting a translation offset. It already does this partly with the clipping rectangle support.

Implements Actor.

Reimplemented in FloorItem.

Definition at line 64 of file actorsprite.cpp.

◆ drawSpriteAt()

bool ActorSprite::drawSpriteAt ( Graphics graphics,
int  x,
int  y 
) const

Definition at line 75 of file actorsprite.cpp.

◆ getAlpha()

float ActorSprite::getAlpha ( ) const
inlineoverridevirtual

Returns the current alpha value used to draw the actor.

Implements Actor.

Definition at line 111 of file actorsprite.h.

◆ getBlockType()

virtual Map::BlockType ActorSprite::getBlockType ( ) const
inlinevirtual

Gets the way the object blocks pathfinding for other objects.

Reimplemented in Being.

Definition at line 86 of file actorsprite.h.

◆ getDrawOrder()

int ActorSprite::getDrawOrder ( ) const
overridevirtual

Returns the pixel Y coordinate that the actor should be drawn at.

Reimplemented from Actor.

Definition at line 59 of file actorsprite.cpp.

◆ getHeight()

int ActorSprite::getHeight ( ) const
inline

Definition at line 114 of file actorsprite.h.

◆ getId()

int ActorSprite::getId ( ) const
inline

Definition at line 63 of file actorsprite.h.

◆ getTargetCursorSize()

virtual TargetCursorSize ActorSprite::getTargetCursorSize ( ) const
inlinevirtual

Returns the required size of a target cursor for this being.

Reimplemented in Being.

Definition at line 97 of file actorsprite.h.

◆ getType()

virtual Type ActorSprite::getType ( ) const
inlinevirtual

Returns the type of the ActorSprite.

Reimplemented in Being, and FloorItem.

Definition at line 71 of file actorsprite.h.

◆ getWidth()

int ActorSprite::getWidth ( ) const
inline

Definition at line 113 of file actorsprite.h.

◆ initTargetCursor()

void ActorSprite::initTargetCursor ( )
staticprivate

Load the target cursors into memory.

Definition at line 169 of file actorsprite.cpp.

◆ load()

void ActorSprite::load ( )
static

Definition at line 150 of file actorsprite.cpp.

◆ loadTargetCursor()

void ActorSprite::loadTargetCursor ( const std::string &  filename,
int  width,
int  height,
int  type,
int  size 
)
staticprivate

Helper function for loading target cursors.

Definition at line 206 of file actorsprite.cpp.

◆ logic()

void ActorSprite::logic ( )
virtual

Reimplemented in Being, and LocalPlayer.

Definition at line 81 of file actorsprite.cpp.

◆ setAlpha()

void ActorSprite::setAlpha ( float  alpha)
inlineoverridevirtual

Sets the alpha value used to draw the actor.

Implements Actor.

Definition at line 110 of file actorsprite.h.

◆ setId()

void ActorSprite::setId ( int  id)
inline

Definition at line 66 of file actorsprite.h.

◆ setMap()

void ActorSprite::setMap ( Map map)
overridevirtual

Reimplemented from Actor.

Reimplemented in Being.

Definition at line 101 of file actorsprite.cpp.

◆ setTargetType()

void ActorSprite::setTargetType ( TargetCursorType  type)

Sets the target animation for this actor.

Definition at line 114 of file actorsprite.cpp.

◆ setupSpriteDisplay()

void ActorSprite::setupSpriteDisplay ( const SpriteDisplay display,
bool  forceDisplay = true 
)
protected

Definition at line 122 of file actorsprite.cpp.

◆ unload()

void ActorSprite::unload ( )
static

Definition at line 160 of file actorsprite.cpp.

◆ untarget()

void ActorSprite::untarget ( )
inline

Untargets the actor.

Definition at line 108 of file actorsprite.h.

Member Data Documentation

◆ loaded

bool ActorSprite::loaded = false
staticprivate

Definition at line 147 of file actorsprite.h.

◆ mChildParticleEffects

std::vector<ParticleHandle> ActorSprite::mChildParticleEffects
protected

Definition at line 124 of file actorsprite.h.

◆ mId

int ActorSprite::mId
protected

Definition at line 123 of file actorsprite.h.

◆ mSprites

CompoundSprite ActorSprite::mSprites
protected

Definition at line 126 of file actorsprite.h.

◆ mUsedTargetCursor

SimpleAnimation* ActorSprite::mUsedTargetCursor = nullptr
private

Target cursor being used.

Definition at line 150 of file actorsprite.h.

◆ targetCursor

SimpleAnimation * ActorSprite::targetCursor
staticprivate

Animated target cursors.

Definition at line 145 of file actorsprite.h.

◆ targetCursorImages

ResourceRef< ImageSet > ActorSprite::targetCursorImages
staticprivate

Images of the target cursor.

Definition at line 142 of file actorsprite.h.


The documentation for this class was generated from the following files: