#include <spriteObject.h>
Inherited by floorTile, massObject, Pickup, pickupSpawner, Rope, singleFireSprite, titleWidget, wp_boomerang_proj, wp_mine_proj, and wp_net_proj.
Inheritance diagram for spriteObject:
Public Types | |
enum | collisionInfo { COL_NONE = 0, COL_BASEABLE = 1, COL_DOWNONLY = 2, COL_DOWNBASEABLE = 3, COL_SOLID = 4, COL_SOLIDBASEABLE = 5, COL_CENTERPOINT = 8, COL_PIXELPERFECT = 16 } |
The collision type of a spriteObject. More... | |
Public Member Functions | |
spriteObject (spriteManager *newsm) | |
Builds a new spriteObject and assigns it to a spriteManager. | |
virtual | ~spriteObject () |
Halt any (looping) sounds that this spriteObject was playing and delete all sprite data. | |
spriteObject (const spriteObject &s) | |
Here is a copy constructor that probably isn't needed. | |
virtual void | setPallete (u8 id) |
Set the pallete of this sprite by passing a pallete ID from a spriteManager. | |
bool | updatePallete (s8 newPalID, u8 sizex, u8 sizey, u8 colorMode=1) |
Update the pallete of this sprite with a new one. | |
s8 | getPalleteID () const |
s8 | getSpriteID () const |
u8 | getFrame () const |
void | setBounds (s8 t, s8 r, s8 b, s8 l) |
Set the collision bounds of this spriteObject to those provided. | |
void | setBounds (s8 arr[4]) |
Set this spriteObject's bounds by passing in an array of values. | |
void | setCenter (u8 x, u8 y) |
void | setLayer (u8 newLayer) |
Set the layer of this sprite to one of the 4 sprite layers the DS provides. | |
s8 | giveSprite (const unsigned char *spriteData, u8 sizex, u8 sizey, u8 cx=16, u8 cy=16, u8 minIndex=0, s16 nx=0, s16 ny=0, u8 colorMode=1) |
Give sprite data to this sprite. | |
s8 | givePallete (const unsigned short *palleteData) |
Give raw pallete data to this sprite. | |
s8 | giveGFX (u16 GFXid, u8 sizex, u8 sizey, u8 cx=16, u8 cy=16, u8 minIndex=0, s16 nx=0, s16 ny=0, u8 colorMode=1) |
Assign a pre-created GFX object to this sprite. | |
void | deleteSprite () |
Cleanup function to remove all low-level sprite junk from memory. | |
bool | hasGraphics () const |
Work out whether or not this sprite has any visible graphics assigned. | |
virtual void | setPos (s16 nx, s16 ny) |
void | setBasePos (s16 ny) |
Sets the position of this spriteObject based on where its base will sit. | |
void | setSpeed (float nvx, float nvy) |
void | setSpeed (s32 nvx, s32 nvy) |
void | setvx (s32 nvx) |
void | setvy (s32 nvy) |
void | setRawSpeed (s32 nvx, s32 nvy) |
A speed setting function that can be used when necessary to set the spriteObject's speed directly in fixed point format. | |
void | setFlipped (bool fh, bool fv=false) |
Set this spriteObject to have its graphics flipped (or not) in both horizontal and vertical directions. | |
void | setTransparency (u8 transLevel=15) |
Set the transparency level of this spriteObject. | |
virtual void | turnAround () |
Flip this spriteObject to face the opposite way and reverse its x velocity. | |
void | setFrame (u8 fr) |
Set the animation frame of this spriteObject. | |
void | setAnim (u8 f1, u8 f2, u8 s, u8 type=ANIM_LOOP, u8 times=-1) |
Set an animation cycle for this spriteObject. | |
void | setArbitraryAnim (vector< u8 > frames, bool loop, u8 ticksPerFrame=TICKSPERFRAME) |
Set an animation cycle for this spriteObject which does not consist of a sequential list of frames. | |
bool | isInAnim () const |
Check if this spriteObject is running an animation. | |
virtual bool | isColliding (const spriteObject *other, bool checkReverse=true) const |
Collision check with another spriteObject. | |
bool | inHorizPlaneOf (const spriteObject *other) const |
Check whether this spriteObject is overlapping another spriteObject on the y axis. | |
bool | inVertPlaneOf (const spriteObject *other) const |
Check whether this spriteObject is overlapping another spriteObject on the x axis. | |
bool | isUnder (const spriteObject *other) const |
Check whether this spriteObject's top is under the bottom of another spriteObject. | |
bool | isOver (const spriteObject *other) const |
Check whether this spriteObject's base is above the top of another spriteObject. | |
bool | isStandingOn (const spriteObject *other) const |
Check whether this spriteObject is standing on another. | |
bool | isFacing (const spriteObject *other) const |
Check whether this spriteObject is facing another one. | |
void | setCollision (collisionInfo c) |
void | setCheckCollision (bool ch) |
Set whether or not for this spriteObject to check collision AT ALL. | |
bool | isBaseable () const |
Check whether or not another spriteObject could possibly stand on this one. | |
spriteObject * | getIgnored () |
Find the spriteObject (if any) that this one is currently ignoring collision with for the purposes of travelling through another spriteObject. | |
void | setIgnored (spriteObject *o) |
Tell this spriteObject to ignore another spriteObject until the two are no longer colliding. | |
virtual void | updateSprite () |
The main 'tick' loop for this sprite, executed every frame. | |
virtual void | checkCollisions (u8 indexToCheckFrom=0) |
Check for collisions with other spriteObjects. | |
virtual void | collidingWith (spriteObject *other) |
Actions to take to mutate this spriteObject and another sprite object that is colliding with this one. | |
bool | pointCollision (s16 x, s16 y) |
Check if this spriteObject is colliding with a point on the screen. | |
s16 | getx () const |
s16 | gety () const |
s32 | getvx () const |
s32 | getvy () const |
s32 | getRawvx () const |
s32 | getRawvy () const |
s16 | getTop () const |
s16 | getRight () const |
s16 | getBottom () const |
s16 | getLeft () const |
bool | getFlippedh () const |
bool | getFlippedv () const |
void | setSoundChannel (s8 channel) |
void | playSound (const u8 *sound, const u32 *size, bool repeat=false, u8 vol=127) |
Tell this spriteObject to play a sound. | |
void | playSound (spriteManager::soundData *sound, bool repeat=false, u8 vol=127) |
Tell this spriteObject to play a sound. | |
void | stopSound () |
Stop any LOOPING sounds this spriteObject has running. | |
bool | hasSoundLooping () |
void | setParent (spriteObject *other) |
Assign this spriteObject a parent sprite, which it will stick to as if they are one. | |
void | addChild (spriteObject *other) |
Assign a child spriteObject to this sprite. | |
bool | removeChild () |
Remove reference to a child spriteObject. | |
virtual void | makeStatic () |
Sets this spriteObject to be completely immobile and inanimate. | |
spriteObject * | getAttachment () const |
Get this spriteObject's attachment sprite, if present. | |
void | setAttachment (spriteObject *o) |
Allows for another spriteObject to mimic or conform to the animation of this one. | |
void | setRotSet (u8 rs) |
Another limitation of DS hardware - rotsets. | |
bool | enableRotation () |
| |
void | disableRotation () |
| |
bool | setRotation (u16 newRot) |
| |
s32 | getGFXid () const |
Find out the id of the GFX assigned to this spriteObject, so that it can be freed up later. | |
void | setLifetime (u16 numSecs) |
Set the lifetime of this spriteObject. | |
s16 | getLifetime () |
void | disableLifetime () |
bool | markedForDeletion () |
Delayed deletion - spriteManager deletes this spriteObject on next of tick if flagged for cleanup. | |
void | destroy () |
Flag this spriteObject for deletion on the next tick. | |
Public Attributes | |
bool | bNeedsGFXCleanup |
if true, spriteManager should delete this sprite's GFX when cleaning it up | |
Static Public Attributes | |
static const u32 | SCREENW = 65536 |
width of the DS screen in fixed point | |
static const u32 | SCREENH = 49152 |
height of the DS screen in fixed point | |
static const u8 | TICKSPERFRAME = 6 |
10fps animation speed in ticks per frame (for arbitrary framerate dependent animation) | |
static const u8 | ANIMSPEED = 10 |
10fps animation speed in fps (for regular timed animation) | |
Protected Member Functions | |
void | swapHBounds () |
void | swapVBounds () |
Protected Attributes | |
spriteObject * | attachment |
an attachment is another sprite which will be animated in the exact same way as this one | |
bool | isAttachment |
bool | staticSprite |
if true, sprite only needs to be updated when first created | |
spriteManager * | sm |
global sprite manager for this screen | |
spriteObject * | parentSprite |
spriteObject * | childSprite |
s8 | spriteID |
OAM id of this spriteObject's sprite. | |
s8 | palleteID |
id of this spriteObject's pallete | |
s32 | gfxID |
id of this spriteObject's GFX | |
s8 | soundChannel |
s32 | x |
s32 | y |
s32 | vx |
s32 | vy |
s32 | oldx |
s32 | oldy |
bool | flippedh |
bool | flippedv |
bool | oldFliph |
bool | oldFlipv |
u8 | layer |
u8 | frame |
u8 | oldFrame |
u8 | arbitraryAnim |
0 = none, 1 = play, 2 = loop | |
u8 | arbitrarySpeed |
animation speed in ticks per frame | |
u8 | arbitraryFrameCounter |
u8 | arbitraryTimeCounter |
vector< u8 > | arbFrames |
animation frame IDs to play sequentially | |
boundingbox | bounds |
u8 | centerx |
u8 | centery |
collisionInfo | collision |
bool | checkCollision |
spriteObject * | ignoreUntilUntouched |
this sprite's collision is ignored until it stops colliding | |
s8 | rotSetID |
u16 | rotAngle |
bool | bRotating |
bool | UPDATEDlayer |
bool | UPDATEDflip |
s16 | framesToLive |
Classes | |
struct | boundingbox |
bounding box, in pixel offsets from sprite registration point More... |
Internally handles low-level logic such as collision, graphics memory allocation & deallocation, sounds and display. spriteObjects are linked to spriteManager instances which are responsibe for updating all sprites and deleting them when they are no longer needed.
Each spriteObject is assigned one of the 128 Object Address Memory (OAM) sprite slots that the DS hardware is capable of. They are also assigned one of the 16 sprite palletes that fit into VRAM at once. Whilst the spriteManager is responsible for creating and assigning palletes, the spriteObject is responsible for its own OAM addressing - the spriteManager merely keeps track of which indexes are being used.
When a spriteObject is assigned visible graphics (referred to as GFX), it is referencing an array in VRAM which holds the sprite data. In this way, sprites which share the same GFX will be displayed and animated as one, even though they may be positioned at different points on the screen. 'Dirty' sprites which copy GFX for their own display are responsible for deleting that GFX when they are destroyed, whilst sprites which are assigned GFX by the spriteManager must leave it for sharing sprites to use.
All position / velocity calculations are done internally in fixed point format to make things easier on the ARM processor's lack of floating point calculation speed. Values are stored as 32 bit integers where the last 8 bits denote 256 fractions of a pixel.
Definition at line 56 of file spriteObject.h.
The collision type of a spriteObject.
No collision will skip all collision calculations, making it extremely fast if used correctly.
COL_NONE | |
COL_BASEABLE | |
COL_DOWNONLY | |
COL_DOWNBASEABLE | |
COL_SOLID | |
COL_SOLIDBASEABLE | |
COL_CENTERPOINT | |
COL_PIXELPERFECT |
Definition at line 240 of file spriteObject.h.
spriteObject::spriteObject | ( | spriteManager * | newsm | ) |
Builds a new spriteObject and assigns it to a spriteManager.
newsm | the spriteManager which should be responsible for updating and deleting this sprite |
Definition at line 27 of file spriteObject.cpp.
References spriteManager::gameSprites, spriteManager::screen, and sm.
Referenced by Pickup::Pickup().
spriteObject::~spriteObject | ( | ) | [virtual] |
Halt any (looping) sounds that this spriteObject was playing and delete all sprite data.
Definition at line 51 of file spriteObject.cpp.
References deleteSprite(), and stopSound().
Here is the call graph for this function:
spriteObject::spriteObject | ( | const spriteObject & | s | ) |
Here is a copy constructor that probably isn't needed.
I've been over my code and I'm pretty sure there's actually no cases where I pass objects by value. So I'm probably pretty safe in just.. not bothering.
Definition at line 64 of file spriteObject.cpp.
References arbitraryAnim, arbitraryFrameCounter, arbitrarySpeed, arbitraryTimeCounter, attachment, bNeedsGFXCleanup, bRotating, centerx, centery, checkCollision, childSprite, collision, flippedh, flippedv, frame, framesToLive, gfxID, ignoreUntilUntouched, isAttachment, layer, oldFliph, oldFlipv, oldFrame, oldx, oldy, palleteID, parentSprite, rotAngle, rotSetID, sm, soundChannel, spriteID, staticSprite, UPDATEDflip, UPDATEDlayer, vx, vy, x, and y.
virtual void spriteObject::setPallete | ( | u8 | id | ) | [inline, virtual] |
Set the pallete of this sprite by passing a pallete ID from a spriteManager.
palleteID | ID of the pallete that the spriteManager has preloaded |
Reimplemented in Player.
Definition at line 79 of file spriteObject.h.
References palleteID.
Referenced by menuBottom::characterMenu(), wp_shield::equipAction(), wp_dunce::equipAction(), wp_boot::equipAction(), menuGBottom::gameTick(), gameManager::generateRopes(), gameManager::generateSpawners(), menuGBottom::loadBackground(), menuBottom::makeCursor(), menuBottom::makeInstructions(), menuBottom::makePickupIcon(), Pickup::Pickup(), gameManager::resetGame(), singleFireSprite::singleFireSprite(), menuGBottom::spawnPickup(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), wp_net_proj::wp_net_proj(), wp_puck_proj::wp_puck_proj(), and wp_weasel_proj::wp_weasel_proj().
bool spriteObject::updatePallete | ( | s8 | newPalID, | |
u8 | sizex, | |||
u8 | sizey, | |||
u8 | colorMode = 1 | |||
) |
Update the pallete of this sprite with a new one.
Only works for sprites created with giveGFX().
newPalID | ID of the new pallete in spriteManager palletes array | |
sizex | memory constant to specify x size of the sprite | |
sizey | memory constant to specify y size of the sprite | |
colorMode | colour mode, using PALib constants. 1 = 8bit. |
Definition at line 177 of file spriteObject.cpp.
References gfxID, palleteID, spriteManager::screen, sm, spriteID, UPDATEDflip, spriteManager::updateSpritePallete(), x, and y.
Referenced by wp_1000V::weaponTick(), and wp_1000V::~wp_1000V().
Here is the call graph for this function:
s8 spriteObject::getPalleteID | ( | ) | const [inline] |
Definition at line 92 of file spriteObject.h.
References palleteID.
Referenced by wp_1000V::weaponTick().
s8 spriteObject::getSpriteID | ( | ) | const [inline] |
u8 spriteObject::getFrame | ( | ) | const [inline] |
Definition at line 94 of file spriteObject.h.
References frame.
Referenced by menuBottom::charNameRender(), wp_dunce::equipAction(), wp_boot::equipAction(), and updateSprite().
void spriteObject::setBounds | ( | s8 | t, | |
s8 | r, | |||
s8 | b, | |||
s8 | l | |||
) | [inline] |
Set the collision bounds of this spriteObject to those provided.
Values passed are the pixel distance from the center of the sprite to each of its edges.
t | distance to top edge | |
r | distance to right edge | |
b | distance to bottom edge | |
l | distance to left edge |
Definition at line 105 of file spriteObject.h.
References spriteObject::boundingbox::b, bounds, spriteObject::boundingbox::l, spriteObject::boundingbox::r, and spriteObject::boundingbox::t.
Referenced by Player::bounce(), Player::crouch(), wp_shield::equipAction(), floorTile::floorTile(), Player::jump(), Player::justfell(), Player::justlanded(), Pickup::Pickup(), Player::Player(), Player::roll(), Rope::Rope(), Player::startNetted(), Player::stopNetted(), Player::uncrouch(), wp_gren_proj::updateSprite(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), wp_mine_proj::wp_mine_proj(), wp_net_proj::wp_net_proj(), wp_puck_proj::wp_puck_proj(), and wp_weasel_proj::wp_weasel_proj().
void spriteObject::setBounds | ( | s8 | arr[4] | ) | [inline] |
Set this spriteObject's bounds by passing in an array of values.
Definition at line 110 of file spriteObject.h.
References spriteObject::boundingbox::b, bounds, spriteObject::boundingbox::l, spriteObject::boundingbox::r, and spriteObject::boundingbox::t.
void spriteObject::setCenter | ( | u8 | x, | |
u8 | y | |||
) | [inline] |
void spriteObject::setLayer | ( | u8 | newLayer | ) | [inline] |
Set the layer of this sprite to one of the 4 sprite layers the DS provides.
Layers can be used to quickly prioritize groups of sprites.
newLayer | the new layer, from 0 to 3 |
Definition at line 118 of file spriteObject.h.
References layer, and UPDATEDlayer.
Referenced by floorTile::floorTile(), menuGBottom::gameTick(), menuGBottom::loadBackground(), menuBottom::makeCursor(), menuBottom::makeInstructions(), Pickup::Pickup(), pickupSpawner::pickupSpawner(), Player::Player(), gameManager::resetGame(), Rope::Rope(), singleFireSprite::singleFireSprite(), menuGBottom::spawnPickup(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), wp_mine_proj::wp_mine_proj(), wp_net_proj::wp_net_proj(), wp_puck_proj::wp_puck_proj(), and wp_weasel_proj::wp_weasel_proj().
s8 spriteObject::giveSprite | ( | const unsigned char * | spriteData, | |
u8 | sizex, | |||
u8 | sizey, | |||
u8 | cx = 16 , |
|||
u8 | cy = 16 , |
|||
u8 | minIndex = 0 , |
|||
s16 | nx = 0 , |
|||
s16 | ny = 0 , |
|||
u8 | colorMode = 1 | |||
) |
Give sprite data to this sprite.
This will create new GFX for the sprite and load the sprite into one of the spriteManager's 128 OAM slots.
spriteData | pointer to the sprite data | |
sizex | memory constant to specify x size of the sprite | |
sizey | memory constant to specify y size of the sprite | |
cx | x offset from top-left corner to the center of the sprite | |
cy | y offset from top-left corner to the center of the sprite | |
minIndex | minimum sprite index in the spriteManager OAM array, which can be used as a depth hierachy | |
nx | starting x screen position in pixels | |
ny | starting y screen position in pixels | |
colorMode | colour mode, using PALib constants. 1 = 8bit. |
Definition at line 109 of file spriteObject.cpp.
References bNeedsGFXCleanup, centerx, centery, gfxID, spriteManager::loadGFX(), spriteManager::loadSpriteFromGFX(), OFFX, OFFY, palleteID, spriteManager::screen, setPos(), sm, and spriteID.
Referenced by menuBottom::characterMenu(), wp_shield::equipAction(), menuGBottom::gameTick(), gameManager::generateSpawners(), menuGBottom::loadBackground(), menuTitle::loadRotatingBackground(), menuBottom::makeCursor(), menuBottom::makeInstructions(), menuBottom::makePickupIcon(), Pickup::Pickup(), gameManager::resetGame(), singleFireSprite::singleFireSprite(), menuGBottom::spawnPickup(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), wp_net_proj::wp_net_proj(), wp_puck_proj::wp_puck_proj(), and wp_weasel_proj::wp_weasel_proj().
Here is the call graph for this function:
s8 spriteObject::givePallete | ( | const unsigned short * | palleteData | ) |
Give raw pallete data to this sprite.
Pallete will be loaded into one of the 16 available pallete slots.
palleteData | a pointer to raw pallete data |
Definition at line 151 of file spriteObject.cpp.
References spriteManager::loadPallete(), palleteID, spriteManager::screen, and sm.
Referenced by menuTitle::loadRotatingBackground().
Here is the call graph for this function:
s8 spriteObject::giveGFX | ( | u16 | GFXid, | |
u8 | sizex, | |||
u8 | sizey, | |||
u8 | cx = 16 , |
|||
u8 | cy = 16 , |
|||
u8 | minIndex = 0 , |
|||
s16 | nx = 0 , |
|||
s16 | ny = 0 , |
|||
u8 | colorMode = 1 | |||
) |
Assign a pre-created GFX object to this sprite.
This will create new GFX for the sprite and load the sprite into one of the spriteManager's 128 OAM slots.
GFXid | index of sprite GFX in memory | |
sizex | memory constant to specify x size of the sprite | |
sizey | memory constant to specify y size of the sprite | |
cx | x offset from top-left corner to the center of the sprite | |
cy | y offset from top-left corner to the center of the sprite | |
minIndex | minimum sprite index in the spriteManager OAM array, which can be used as a depth hierachy | |
nx | starting x screen position in pixels | |
ny | starting y screen position in pixels | |
colorMode | colour mode, using PALib constants. 1 = 8bit. |
Definition at line 210 of file spriteObject.cpp.
References centerx, centery, gfxID, spriteManager::loadSpriteFromGFX(), OFFX, OFFY, palleteID, spriteManager::screen, setPos(), sm, and spriteID.
Referenced by wp_dunce::equipAction(), wp_boot::equipAction(), gameManager::generateRopes(), Pickup::Pickup(), gameManager::resetGame(), and singleFireSprite::singleFireSprite().
Here is the call graph for this function:
void spriteObject::deleteSprite | ( | ) |
Cleanup function to remove all low-level sprite junk from memory.
Should really be in spriteManager, but then you have to pass an object that's being destroyed to another function, and I imagine that isn't wise.
Cleanup of child sprites, GFX and the spriteManager's OAM array are only performed if the spriteManager is not resetting, since otherwise this is a redundant step.
Definition at line 241 of file spriteObject.cpp.
References bNeedsGFXCleanup, childSprite, destroy(), getGFXid(), getSpriteID(), gfxID, hasGraphics(), spriteManager::isResetting(), OFFX, OFFY, palleteID, spriteManager::removeSprite(), spriteManager::screen, sm, and spriteID.
Referenced by ~spriteObject().
Here is the call graph for this function:
bool spriteObject::hasGraphics | ( | ) | const |
Work out whether or not this sprite has any visible graphics assigned.
Definition at line 305 of file spriteObject.cpp.
References spriteManager::isSprite(), sm, and spriteID.
Referenced by deleteSprite(), and updateSprite().
Here is the call graph for this function:
virtual void spriteObject::setPos | ( | s16 | nx, | |
s16 | ny | |||
) | [inline, virtual] |
Reimplemented in Rope.
Definition at line 133 of file spriteObject.h.
References centerx, centery, x, and y.
Referenced by Player::climbRope(), menuBottom::gameTick(), gameManager::generateSpawners(), giveGFX(), giveSprite(), Player::groundDeleted(), menuGBottom::loadBackground(), Pickup::Pickup(), Player::resetPlayer(), Rope::setPos(), Player::setStartPos(), menuGBottom::spawnPickup(), titleWidget::updateSprite(), wp_weasel::weaponFireAction(), wp_warp::weaponFireAction(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_mine::weaponFireAction(), wp_gren::weaponFireAction(), wp_boomerang::weaponFireAction(), and wp_shield::weaponTick().
void spriteObject::setBasePos | ( | s16 | ny | ) | [inline] |
Sets the position of this spriteObject based on where its base will sit.
ny | new y position for the spriteObject's base to sit at |
Definition at line 140 of file spriteObject.h.
References spriteObject::boundingbox::b, bounds, centery, and y.
Referenced by Player::resetPlayer(), and Player::setStartPos().
void spriteObject::setSpeed | ( | float | nvx, | |
float | nvy | |||
) | [inline] |
Definition at line 142 of file spriteObject.h.
Referenced by wp_magnet::popOutPawnWeapon(), Player::resetPlayer(), menuGBottom::spawnPickup(), pickupSpawner::updateSprite(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_gren::weaponFireAction(), and wp_boomerang::weaponFireAction().
void spriteObject::setSpeed | ( | s32 | nvx, | |
s32 | nvy | |||
) | [inline] |
void spriteObject::setvx | ( | s32 | nvx | ) | [inline] |
Definition at line 144 of file spriteObject.h.
References vx.
Referenced by Player::collidingWith(), Weapon::handleMovementAndAmmo(), Player::updateSprite(), wp_hook::weaponFireAction(), and wp_gun::weaponFireAction().
void spriteObject::setvy | ( | s32 | nvy | ) | [inline] |
Definition at line 145 of file spriteObject.h.
References vy.
Referenced by Player::updateSprite(), wp_hook::weaponFireAction(), and wp_chut::weaponTick().
void spriteObject::setRawSpeed | ( | s32 | nvx, | |
s32 | nvy | |||
) | [inline] |
A speed setting function that can be used when necessary to set the spriteObject's speed directly in fixed point format.
nvx | new x velocity | |
nvy | new y velocity |
Definition at line 157 of file spriteObject.h.
Referenced by wp_boomerang_proj::returnTick().
void spriteObject::setFlipped | ( | bool | fh, | |
bool | fv = false | |||
) |
Set this spriteObject to have its graphics flipped (or not) in both horizontal and vertical directions.
fh | whether or not to flip horizontally | |
fv | whether or not to flip vertically |
Definition at line 648 of file spriteObject.cpp.
References bRotating, flippedh, flippedv, oldFliph, oldFlipv, rotSetID, swapHBounds(), swapVBounds(), and UPDATEDflip.
Referenced by Player::basicInput(), Player::justlanded(), menuGBottom::loadBackground(), Player::resetPlayer(), wp_weasel_proj::runLeft(), wp_weasel_proj::runRight(), Player::setStartFlipped(), Player::stopNetted(), turnAround(), Player::uncrouch(), updateSprite(), wp_net::weaponFireAction(), and wp_weasel_proj::wp_weasel_proj().
Here is the call graph for this function:
void spriteObject::setTransparency | ( | u8 | transLevel = 15 |
) |
Set the transparency level of this spriteObject.
Note that due to DS hardware limitations, there is really only one transparency level at a time. Thus running this function will overwrite the global transparency level as well as set this sprite to use it.
translevel | the transparency level to set this sprite to. Levels range from 0 (invisible) to 15 (opaque) |
Definition at line 435 of file spriteObject.cpp.
References spriteManager::screen, spriteManager::setAlpha(), sm, and spriteID.
Referenced by menuGBottom::loadBackground().
Here is the call graph for this function:
void spriteObject::turnAround | ( | ) | [virtual] |
Flip this spriteObject to face the opposite way and reverse its x velocity.
Will also shift it backwards an unnoticeable amount so that if its flip is the result of a collision, it won't loop.
Definition at line 446 of file spriteObject.cpp.
References flippedh, flippedv, setFlipped(), vx, and x.
Here is the call graph for this function:
void spriteObject::setFrame | ( | u8 | fr | ) | [inline] |
Set the animation frame of this spriteObject.
fr | the frame index to set. Be careful not to set outside the sprite GFX's length! |
Definition at line 168 of file spriteObject.h.
References arbitraryAnim, frame, spriteManager::screen, sm, and spriteID.
Referenced by Player::basicInput(), menuBottom::charNameRender(), wp_shield::equipAction(), wp_dunce::equipAction(), wp_boot::equipAction(), menuGBottom::gameTick(), menuBottom::gameTick(), gameManager::generateSpawners(), Player::handleNetted(), menuGBottom::loadBackground(), menuBottom::makeCursor(), Pickup::makeIcon(), menuBottom::makeInstructions(), menuBottom::makePickupIcon(), Pickup::Pickup(), menuBottom::pickupsRender(), Player::play1000VHitEffect(), Player::playFalling(), Player::playIdle(), Player::playInvis(), Player::playMineHitEffect(), Rope::Rope(), singleFireSprite::singleFireSprite(), wp_weasel_proj::updateSprite(), updateSprite(), wp_hook::weaponFireAction(), wp_chut::weaponTick(), wp_net_proj::wp_net_proj(), and wp_weasel_proj::wp_weasel_proj().
void spriteObject::setAnim | ( | u8 | f1, | |
u8 | f2, | |||
u8 | s, | |||
u8 | type = ANIM_LOOP , |
|||
u8 | times = -1 | |||
) | [inline] |
Set an animation cycle for this spriteObject.
All animations actually use spriteObject::setArbitraryAnim() because the normal sprite looping doesn't have as high an update priority and it tends to skip frames.
f1 | frame to start at | |
f2 | frame to end at | |
s | time between frames of the animation, in 100ths of a second | |
type | type of animation - ANIM_ONESHOT, ANIM_LOOP or ANIM_UPDOWN | |
times | LEGACY. NOT USED - number of times to play the animation |
Definition at line 186 of file spriteObject.h.
References setArbitraryAnim().
Referenced by menuBottom::makePickupIcon(), Player::playPushedBackward(), Player::playPushedForward(), Player::playRunning(), Pickup::setType(), menuGBottom::spawnPickup(), wp_magnet::weaponFireAction(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), and wp_puck_proj::wp_puck_proj().
Here is the call graph for this function:
void spriteObject::setArbitraryAnim | ( | vector< u8 > | frames, | |
bool | loop, | |||
u8 | ticksPerFrame = TICKSPERFRAME | |||
) | [inline] |
Set an animation cycle for this spriteObject which does not consist of a sequential list of frames.
frames | a vector of unsigned chars that correspond to animation frames to play | |
loop | whether or not to loop the animation | |
ticksPerFrame | animation speed counter. The game runs at 60fps so the standard spriteObject::TICKSPERFRAME results in a 10fps animation speed. |
Definition at line 203 of file spriteObject.h.
References arbFrames, arbitraryAnim, arbitraryFrameCounter, arbitrarySpeed, arbitraryTimeCounter, spriteManager::screen, sm, and spriteID.
Referenced by Weapon::handleMovementAndAmmo(), Player::playClimbingDown(), Player::playClimbingUp(), Player::playCrouching(), Player::playDisintegrated(), wp_weasel_proj::playFalling(), Player::playJumpedMoving(), Player::playJumpedStanding(), Player::playRolling(), Player::playRollingBack(), Player::playSkulled(), Player::playVictory(), wp_weasel_proj::playWalking(), gameManager::resetGame(), setAnim(), singleFireSprite::singleFireSprite(), menuGBottom::spawnPickup(), and wp_gun::weaponFireAction().
bool spriteObject::isInAnim | ( | ) | const [inline] |
Check if this spriteObject is running an animation.
Definition at line 216 of file spriteObject.h.
References arbitraryAnim.
bool spriteObject::isColliding | ( | const spriteObject * | other, | |
bool | checkReverse = true | |||
) | const [virtual] |
Collision check with another spriteObject.
The check is run twice for each comparison - each spriteObject is only concerned with its own collision setting. If both are colliding, then they are successfully touching.
other | the spriteObject to compare with | |
checkReverse | whether or not to compute collision for the complementary spriteObject |
These more intense pixel-perfect calculations work fairly well, however they tend to slow the game down a lot and create animation glitches etc as a side-effect. Since there are no COL_PIXELPERFECT sprites, it shouldn't matter.
Definition at line 559 of file spriteObject.cpp.
References centerx, centery, COL_CENTERPOINT, COL_NONE, COL_PIXELPERFECT, collision, frame, getBottom(), getGFXid(), getLeft(), getRight(), getTop(), getx(), gety(), ignoreUntilUntouched, inHorizPlaneOf(), inVertPlaneOf(), isColliding(), spriteManager::screen, sm, x, and y.
Referenced by checkCollisions(), isColliding(), Player::isColliding(), Pickup::isColliding(), isStandingOn(), and wp_gren_proj::updateSprite().
Here is the call graph for this function:
bool spriteObject::inHorizPlaneOf | ( | const spriteObject * | other | ) | const |
Check whether this spriteObject is overlapping another spriteObject on the y axis.
When combined with spriteObject::inVertPlaneOf(), this can be used to check for box collision.
other | the spriteObject to check against |
Definition at line 475 of file spriteObject.cpp.
References isOver(), and isUnder().
Referenced by massObject::checkPenetration(), and isColliding().
Here is the call graph for this function:
bool spriteObject::inVertPlaneOf | ( | const spriteObject * | other | ) | const |
Check whether this spriteObject is overlapping another spriteObject on the x axis.
When combined with spriteObject::inHorizPlaneOf(), this can be used to check for box collision.
other | the spriteObject to check against |
Definition at line 490 of file spriteObject.cpp.
References getLeft(), and getRight().
Referenced by massObject::checkPenetration(), isColliding(), and isStandingOn().
Here is the call graph for this function:
bool spriteObject::isUnder | ( | const spriteObject * | other | ) | const |
Check whether this spriteObject's top is under the bottom of another spriteObject.
other | the spriteObject to check against |
Definition at line 502 of file spriteObject.cpp.
References getBottom(), and getTop().
Referenced by massObject::checkPenetration(), and inHorizPlaneOf().
Here is the call graph for this function:
bool spriteObject::isOver | ( | const spriteObject * | other | ) | const |
Check whether this spriteObject's base is above the top of another spriteObject.
other | the spriteObject to check against |
Definition at line 512 of file spriteObject.cpp.
References getBottom(), and getTop().
Referenced by massObject::checkPenetration(), and inHorizPlaneOf().
Here is the call graph for this function:
bool spriteObject::isStandingOn | ( | const spriteObject * | other | ) | const |
Check whether this spriteObject is standing on another.
Note that the other spriteObject must have baseable collision set for this to ever occur.
other | the spriteObject to check against |
Definition at line 525 of file spriteObject.cpp.
References getBottom(), getTop(), inVertPlaneOf(), isBaseable(), isColliding(), and vy.
Referenced by Pickup::collidingWith(), massObject::collidingWith(), and wp_gren_proj::updateSprite().
Here is the call graph for this function:
bool spriteObject::isFacing | ( | const spriteObject * | other | ) | const |
Check whether this spriteObject is facing another one.
other | the spriteObject to check against |
Definition at line 461 of file spriteObject.cpp.
References flippedh, and getx().
Referenced by wp_puck_proj::collidingWith(), and Player::collidingWith().
Here is the call graph for this function:
void spriteObject::setCollision | ( | collisionInfo | c | ) | [inline] |
Definition at line 251 of file spriteObject.h.
References collision.
Referenced by wp_shield::equipAction(), floorTile::floorTile(), Player::freezePlayer(), massObject::massObject(), Pickup::Pickup(), Player::Player(), Rope::Rope(), Pickup::setType(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), wp_mine_proj::wp_mine_proj(), wp_net_proj::wp_net_proj(), wp_puck_proj::wp_puck_proj(), and wp_weasel_proj::wp_weasel_proj().
void spriteObject::setCheckCollision | ( | bool | ch | ) | [inline] |
Set whether or not for this spriteObject to check collision AT ALL.
Basically a very nice speed optimisation.
ch | whether or not to run collision checks whatsoever |
Definition at line 257 of file spriteObject.h.
References checkCollision.
Referenced by Player::freezePlayer(), massObject::massObject(), Player::Player(), Pickup::setType(), wp_gren_proj::wp_gren_proj(), wp_puck_proj::wp_puck_proj(), and wp_weasel_proj::wp_weasel_proj().
bool spriteObject::isBaseable | ( | ) | const |
Check whether or not another spriteObject could possibly stand on this one.
Definition at line 542 of file spriteObject.cpp.
References COL_BASEABLE, and collision.
Referenced by isStandingOn().
spriteObject* spriteObject::getIgnored | ( | ) | [inline] |
Find the spriteObject (if any) that this one is currently ignoring collision with for the purposes of travelling through another spriteObject.
Definition at line 266 of file spriteObject.h.
References ignoreUntilUntouched.
void spriteObject::setIgnored | ( | spriteObject * | o | ) | [inline] |
Tell this spriteObject to ignore another spriteObject until the two are no longer colliding.
o | spriteObject to ignore |
Definition at line 272 of file spriteObject.h.
References ignoreUntilUntouched.
Referenced by wp_net_proj::wp_net_proj().
void spriteObject::updateSprite | ( | ) | [virtual] |
The main 'tick' loop for this sprite, executed every frame.
Basically updates visual properties only - further logic is left for child classes to implement.
Reimplemented in massObject, Pickup, pickupSpawner, Player, singleFireSprite, titleWidget, wp_boomerang_proj, wp_gren_proj, wp_net_proj, wp_puck_proj, and wp_weasel_proj.
Definition at line 316 of file spriteObject.cpp.
References arbFrames, arbitraryAnim, arbitraryFrameCounter, arbitrarySpeed, arbitraryTimeCounter, bRotating, centerx, centery, flippedh, flippedv, frame, getFrame(), hasGraphics(), isAttachment, layer, oldFrame, oldx, oldy, parentSprite, rotAngle, rotSetID, spriteManager::screen, setFlipped(), setFrame(), sm, spriteID, staticSprite, UPDATEDflip, UPDATEDlayer, vx, vy, x, and y.
Referenced by menuGBottom::loadBackground(), makeStatic(), wp_net_proj::updateSprite(), wp_boomerang_proj::updateSprite(), titleWidget::updateSprite(), singleFireSprite::updateSprite(), pickupSpawner::updateSprite(), Pickup::updateSprite(), and massObject::updateSprite().
Here is the call graph for this function:
void spriteObject::checkCollisions | ( | u8 | indexToCheckFrom = 0 |
) | [virtual] |
Check for collisions with other spriteObjects.
This is designed to be of O(2n) complexity, so that an iteration of collision checks only requires 2 full loops through the sprite array. Collision checks are of course bidirectional, so each check need only check from its position in the spriteManager's OAM array onwards.
indexToCheckFrom | index in the spriteManager's OAM array to begin checking from. |
Definition at line 410 of file spriteObject.cpp.
References checkCollision, collidingWith(), spriteManager::gameSprites, ignoreUntilUntouched, isColliding(), and sm.
Here is the call graph for this function:
virtual void spriteObject::collidingWith | ( | spriteObject * | other | ) | [inline, virtual] |
Actions to take to mutate this spriteObject and another sprite object that is colliding with this one.
spriteObjects should not be moved in this function unless you know what you are doing, as this changes collision they may have with other spriteObjects in the same tick.
other | spriteObject to perform collision actions with |
Reimplemented in massObject, Pickup, Player, and wp_puck_proj.
Definition at line 289 of file spriteObject.h.
Referenced by checkCollisions(), and Pickup::collidingWith().
bool spriteObject::pointCollision | ( | s16 | x, | |
s16 | y | |||
) | [inline] |
Check if this spriteObject is colliding with a point on the screen.
x | x pixel coordinate of the designated point | |
y | y pixel coordinate of the designated point |
Definition at line 297 of file spriteObject.h.
References getBottom(), getLeft(), getRight(), and getTop().
Referenced by wp_magnet::weaponFireAction(), and wp_gun::weaponFireAction().
Here is the call graph for this function:
s16 spriteObject::getx | ( | ) | const [inline] |
Definition at line 300 of file spriteObject.h.
Referenced by Player::climbRope(), Player::collideNormally(), Player::collidingWith(), Player::groundDeleted(), Player::handleNetted(), isColliding(), isFacing(), Player::play1000VHitEffect(), Player::playSplashEffect(), Player::playWarpEffect(), wp_magnet::popOutPawnWeapon(), gameManager::resetGame(), wp_boomerang_proj::returnTick(), Rope::setLength(), wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_net_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), Player::updateSprite(), pickupSpawner::updateSprite(), Pickup::updateSprite(), wp_puck::weaponFireAction(), wp_magnet::weaponFireAction(), wp_gun::weaponFireAction(), wp_gren::weaponFireAction(), wp_boomerang::weaponFireAction(), Pickup::~Pickup(), wp_gren_proj::~wp_gren_proj(), wp_mine_proj::~wp_mine_proj(), and wp_puck_proj::~wp_puck_proj().
s16 spriteObject::gety | ( | ) | const [inline] |
Definition at line 301 of file spriteObject.h.
Referenced by Player::climbRope(), Player::collideNormally(), Pickup::collidingWith(), Player::groundDeleted(), isColliding(), Player::play1000VHitEffect(), Player::playWarpEffect(), wp_magnet::popOutPawnWeapon(), gameManager::resetGame(), wp_boomerang_proj::returnTick(), Rope::setLength(), Player::updateSprite(), pickupSpawner::updateSprite(), Pickup::updateSprite(), wp_net::weaponFireAction(), wp_magnet::weaponFireAction(), wp_hook::weaponFireAction(), wp_boomerang::weaponFireAction(), Pickup::~Pickup(), and wp_mine_proj::~wp_mine_proj().
s32 spriteObject::getvx | ( | ) | const [inline] |
Definition at line 302 of file spriteObject.h.
References vx.
Referenced by Player::collidingWith().
s32 spriteObject::getvy | ( | ) | const [inline] |
s32 spriteObject::getRawvx | ( | ) | const [inline] |
Definition at line 304 of file spriteObject.h.
References vx.
Referenced by wp_boomerang_proj::returnTick().
s32 spriteObject::getRawvy | ( | ) | const [inline] |
Definition at line 305 of file spriteObject.h.
References vy.
Referenced by wp_boomerang_proj::returnTick().
s16 spriteObject::getTop | ( | ) | const [inline] |
Definition at line 306 of file spriteObject.h.
References bounds, centery, spriteObject::boundingbox::t, and y.
Referenced by Player::basicInput(), isColliding(), isOver(), isStandingOn(), isUnder(), pointCollision(), wp_magnet::weaponFireAction(), and wp_gren::weaponFireAction().
s16 spriteObject::getRight | ( | ) | const [inline] |
Definition at line 307 of file spriteObject.h.
References bounds, centerx, spriteObject::boundingbox::r, and x.
Referenced by wp_weasel_proj::atEdge(), Player::basicInput(), Pickup::collidingWith(), inVertPlaneOf(), isColliding(), pointCollision(), wp_weasel_proj::updateSprite(), wp_weasel::weaponFireAction(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_mine::weaponFireAction(), and wp_hook::weaponFireAction().
s16 spriteObject::getBottom | ( | ) | const [inline] |
Definition at line 308 of file spriteObject.h.
References spriteObject::boundingbox::b, bounds, centery, and y.
Referenced by wp_weasel_proj::atEdge(), Player::basicInput(), massObject::checkPenetration(), isColliding(), isOver(), isStandingOn(), isUnder(), pointCollision(), wp_weasel::weaponFireAction(), wp_puck::weaponFireAction(), wp_mine::weaponFireAction(), wp_gun::weaponFireAction(), wp_gren_proj::~wp_gren_proj(), and wp_puck_proj::~wp_puck_proj().
s16 spriteObject::getLeft | ( | ) | const [inline] |
Definition at line 309 of file spriteObject.h.
References bounds, centerx, spriteObject::boundingbox::l, and x.
Referenced by wp_weasel_proj::atEdge(), Player::basicInput(), Pickup::collidingWith(), inVertPlaneOf(), isColliding(), pointCollision(), wp_weasel_proj::updateSprite(), wp_weasel::weaponFireAction(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_mine::weaponFireAction(), and wp_hook::weaponFireAction().
bool spriteObject::getFlippedh | ( | ) | const [inline] |
Definition at line 311 of file spriteObject.h.
References flippedh.
Referenced by wp_weasel::weaponFireAction(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_mine::weaponFireAction(), wp_magnet::weaponFireAction(), wp_hook::weaponFireAction(), wp_gun::weaponFireAction(), wp_gren::weaponFireAction(), wp_boomerang::weaponFireAction(), and wp_weasel_proj::wp_weasel_proj().
bool spriteObject::getFlippedv | ( | ) | const [inline] |
Definition at line 312 of file spriteObject.h.
References flippedv.
Referenced by Player::basicInput().
void spriteObject::setSoundChannel | ( | s8 | channel | ) | [inline] |
void spriteObject::playSound | ( | const u8 * | sound, | |
const u32 * | size, | |||
bool | repeat = false , |
|||
u8 | vol = 127 | |||
) |
Tell this spriteObject to play a sound.
The spriteManager is actually responsible for managing sound channels, so this is more of a 'request' for a sound - if no channels are free, the sound is ignored.
sound | a pointer to the array of sound data | |
size | the length of the sound data array | |
repeat | whether or not to loop the sound. Looped sounds will stop when the spriteObject is destroyed. | |
vol | volume for the sound to play at |
Definition at line 678 of file spriteObject.cpp.
References spriteManager::playSound(), spriteManager::screen, setSoundChannel(), sm, soundChannel, and stopSound().
Referenced by Player::collidingWith(), wp_dunce::equipAction(), Player::play1000VHitEffect(), wp_weasel_proj::playRandomSnarl(), Player::playSkulled(), Player::playSplashEffect(), Player::playWarpEffect(), gameManager::resetGame(), Pickup::setType(), wp_chut::stopFiring(), wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_magnet::weaponFireAction(), wp_invis::weaponFireAction(), wp_gun::weaponFireAction(), wp_gren::weaponFireAction(), wp_chut::weaponFireAction(), wp_boot::weaponFireAction(), wp_boomerang_proj::wp_boomerang_proj(), wp_mine_proj::wp_mine_proj(), Pickup::~Pickup(), wp_gren_proj::~wp_gren_proj(), wp_mine_proj::~wp_mine_proj(), and wp_puck_proj::~wp_puck_proj().
Here is the call graph for this function:
void spriteObject::playSound | ( | spriteManager::soundData * | sound, | |
bool | repeat = false , |
|||
u8 | vol = 127 | |||
) |
Tell this spriteObject to play a sound.
The spriteManager is actually responsible for managing sound channels, so this is more of a 'request' for a sound - if no channels are free, the sound is ignored.
sound | a pointer to a spriteManager soundData array, which includes the sound data and size value. | |
repeat | whether or not to loop the sound. Looped sounds will stop when the spriteObject is destroyed. | |
vol | volume for the sound to play at |
Definition at line 697 of file spriteObject.cpp.
References spriteManager::soundData::data, spriteManager::playSound(), spriteManager::screen, setSoundChannel(), spriteManager::soundData::size, sm, soundChannel, and stopSound().
Here is the call graph for this function:
void spriteObject::stopSound | ( | ) | [inline] |
Stop any LOOPING sounds this spriteObject has running.
Sounds that are played only once need not be stopped as they will end soon enough and free up a sound channel.
Definition at line 323 of file spriteObject.h.
References hasSoundLooping(), sm, soundChannel, and spriteManager::stopSound().
Referenced by Player::collidingWith(), playSound(), Pickup::setType(), wp_magnet::stopFiring(), and ~spriteObject().
Here is the call graph for this function:
bool spriteObject::hasSoundLooping | ( | ) | [inline] |
Definition at line 327 of file spriteObject.h.
References sm, soundChannel, and spriteManager::soundLooping().
Referenced by wp_magnet::stopFiring(), stopSound(), and wp_magnet::weaponFireAction().
Here is the call graph for this function:
void spriteObject::setParent | ( | spriteObject * | other | ) |
Assign this spriteObject a parent sprite, which it will stick to as if they are one.
This is a fairly nasty bidirectional reference, since the parent sprite will also reference the child in order to destroy it. TODO: make this better.
other | the spriteObject to parent to |
Definition at line 719 of file spriteObject.cpp.
References parentSprite.
Referenced by addChild().
void spriteObject::addChild | ( | spriteObject * | other | ) |
Assign a child spriteObject to this sprite.
Only used for cleanup and sprite deletion.
This was originally a vector of children so that a branching hierachy could be established, but in the end I only ended up using '1 child <-> 1 parent' hierachies anyway. Thusly, the more complex code has been commented out until this feature becomes useful.
other | the spriteObject to add as a child |
Definition at line 736 of file spriteObject.cpp.
References childSprite, and setParent().
Referenced by wp_shield::equipAction(), wp_dunce::equipAction(), wp_boot::equipAction(), menuTitle::loadRotatingBackground(), Pickup::Pickup(), and menuGBottom::spawnPickup().
Here is the call graph for this function:
bool spriteObject::removeChild | ( | ) |
Remove reference to a child spriteObject.
Definition at line 756 of file spriteObject.cpp.
References childSprite.
Referenced by wp_shield::unEquipAction(), wp_dunce::unEquipAction(), and wp_boot::unEquipAction().
virtual void spriteObject::makeStatic | ( | ) | [inline, virtual] |
Sets this spriteObject to be completely immobile and inanimate.
Any more updates to this sprite from now on have no effect at all. Basically, after this is run, spriteObject::updateSprite() won't do anything.
Reimplemented in Rope.
Definition at line 349 of file spriteObject.h.
References staticSprite, and updateSprite().
Referenced by menuGBottom::gameTick(), menuGBottom::loadBackground(), menuBottom::makeInstructions(), and Rope::makeStatic().
Here is the call graph for this function:
spriteObject* spriteObject::getAttachment | ( | ) | const [inline] |
Get this spriteObject's attachment sprite, if present.
Definition at line 357 of file spriteObject.h.
References attachment.
Referenced by wp_dunce::unEquipAction(), and wp_boot::unEquipAction().
void spriteObject::setAttachment | ( | spriteObject * | o | ) | [inline] |
Allows for another spriteObject to mimic or conform to the animation of this one.
Attachment sprites are sprites that inherit the animation of the parent one. An attachment sprite should usually be a child sprite, but could work with sprites that are unparented as well.
o | the sprite to set as an attachment |
Definition at line 366 of file spriteObject.h.
References attachment, and isAttachment.
Referenced by wp_dunce::equipAction(), wp_boot::equipAction(), wp_dunce::unEquipAction(), and wp_boot::unEquipAction().
void spriteObject::setRotSet | ( | u8 | rs | ) | [inline] |
Another limitation of DS hardware - rotsets.
The console is limited to 16 of these, which are then assigned sprites which rotate to whichever value is set on that rotset. After a rotset is given to a sprite, it must have its rotation enabled before rotation can be applied.
Definition at line 377 of file spriteObject.h.
References rotSetID.
Referenced by gameManager::resetGame().
bool spriteObject::enableRotation | ( | ) | [inline] |
Definition at line 381 of file spriteObject.h.
References bRotating, rotSetID, spriteManager::screen, sm, and spriteID.
Referenced by Player::startNetted().
void spriteObject::disableRotation | ( | ) | [inline] |
Definition at line 385 of file spriteObject.h.
References bRotating, spriteManager::screen, sm, and spriteID.
Referenced by Player::stopNetted().
bool spriteObject::setRotation | ( | u16 | newRot | ) | [inline] |
Definition at line 389 of file spriteObject.h.
References bRotating, rotAngle, and rotSetID.
Referenced by Player::handleNetted().
s32 spriteObject::getGFXid | ( | ) | const [inline] |
Find out the id of the GFX assigned to this spriteObject, so that it can be freed up later.
Definition at line 398 of file spriteObject.h.
References gfxID.
Referenced by deleteSprite(), and isColliding().
void spriteObject::setLifetime | ( | u16 | numSecs | ) | [inline] |
Set the lifetime of this spriteObject.
Lifetime is decremented every tick, and when it expires the spriteObject will be destroyed.
numSecs | the number of seconds for this spriteObject to live for |
Definition at line 408 of file spriteObject.h.
References ANIMSPEED, framesToLive, and TICKSPERFRAME.
Referenced by Pickup::Pickup(), and menuGBottom::spawnPickup().
s16 spriteObject::getLifetime | ( | ) | [inline] |
void spriteObject::disableLifetime | ( | ) | [inline] |
bool spriteObject::markedForDeletion | ( | ) | [inline] |
Delayed deletion - spriteManager deletes this spriteObject on next of tick if flagged for cleanup.
Definition at line 417 of file spriteObject.h.
References framesToLive.
void spriteObject::destroy | ( | ) | [inline] |
Flag this spriteObject for deletion on the next tick.
Definition at line 422 of file spriteObject.h.
References framesToLive, gfxID, palleteID, and spriteID.
Referenced by wp_puck_proj::collidingWith(), Player::collidingWith(), Pickup::collidingWith(), menuBottom::controlsMenu(), menuBottom::creditsMenu(), deleteSprite(), menuGBottom::gameTick(), menuBottom::roundsMenu(), menuBottom::saveWarningMenu(), wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_net_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), singleFireSprite::updateSprite(), and equipWeapon::~equipWeapon().
void spriteObject::swapHBounds | ( | ) | [inline, protected] |
Definition at line 432 of file spriteObject.h.
References bounds, spriteObject::boundingbox::l, and spriteObject::boundingbox::r.
Referenced by setFlipped().
void spriteObject::swapVBounds | ( | ) | [inline, protected] |
Definition at line 433 of file spriteObject.h.
References spriteObject::boundingbox::b, bounds, and spriteObject::boundingbox::t.
Referenced by setFlipped().
const u32 spriteObject::SCREENW = 65536 [static] |
width of the DS screen in fixed point
Definition at line 331 of file spriteObject.h.
Referenced by Player::updateSprite().
const u32 spriteObject::SCREENH = 49152 [static] |
height of the DS screen in fixed point
Definition at line 333 of file spriteObject.h.
Referenced by wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), and Player::updateSprite().
const u8 spriteObject::TICKSPERFRAME = 6 [static] |
10fps animation speed in ticks per frame (for arbitrary framerate dependent animation)
Definition at line 335 of file spriteObject.h.
Referenced by pickupSpawner::addSpawnTime(), Pickup::Pickup(), Player::play1000VHitEffect(), Player::playClimbingDown(), Player::playClimbingUp(), Player::playDisintegrated(), Player::playJumpedMoving(), Player::playJumpedStanding(), Player::playRolling(), Player::playRollingBack(), Player::playSkulled(), Player::playSplashEffect(), Player::playWarpEffect(), gameManager::resetGame(), menuGBottom::resetIdleTime(), setLifetime(), wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), wp_hook::weaponFireAction(), Pickup::~Pickup(), wp_gren_proj::~wp_gren_proj(), wp_mine_proj::~wp_mine_proj(), and wp_puck_proj::~wp_puck_proj().
const u8 spriteObject::ANIMSPEED = 10 [static] |
10fps animation speed in fps (for regular timed animation)
Definition at line 337 of file spriteObject.h.
Referenced by pickupSpawner::addSpawnTime(), menuBottom::makePickupIcon(), Player::playPushedBackward(), Player::playPushedForward(), Player::playRunning(), setLifetime(), Pickup::setType(), menuGBottom::spawnPickup(), wp_magnet::weaponFireAction(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), and wp_puck_proj::wp_puck_proj().
if true, spriteManager should delete this sprite's GFX when cleaning it up
Definition at line 392 of file spriteObject.h.
Referenced by deleteSprite(), giveSprite(), and spriteObject().
spriteObject* spriteObject::attachment [protected] |
an attachment is another sprite which will be animated in the exact same way as this one
Definition at line 437 of file spriteObject.h.
Referenced by getAttachment(), setAttachment(), and spriteObject().
bool spriteObject::isAttachment [protected] |
Definition at line 438 of file spriteObject.h.
Referenced by setAttachment(), spriteObject(), and updateSprite().
bool spriteObject::staticSprite [protected] |
if true, sprite only needs to be updated when first created
Definition at line 441 of file spriteObject.h.
Referenced by makeStatic(), spriteObject(), and updateSprite().
spriteManager* spriteObject::sm [protected] |
global sprite manager for this screen
Definition at line 444 of file spriteObject.h.
Referenced by wp_weasel_proj::atEdge(), checkCollisions(), massObject::checkPenetration(), Pickup::collidingWith(), deleteSprite(), disableRotation(), enableRotation(), giveGFX(), givePallete(), giveSprite(), hasGraphics(), hasSoundLooping(), isColliding(), Pickup::Pickup(), wp_weasel_proj::playRandomSnarl(), playSound(), pickupSpawner::resetIdleTime(), setArbitraryAnim(), setFrame(), Rope::setLength(), setTransparency(), spriteObject(), stopSound(), updatePallete(), wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), updateSprite(), pickupSpawner::updateSprite(), wp_boomerang_proj::wp_boomerang_proj(), wp_gren_proj::wp_gren_proj(), wp_mine_proj::wp_mine_proj(), wp_net_proj::wp_net_proj(), wp_puck_proj::wp_puck_proj(), wp_weasel_proj::wp_weasel_proj(), wp_gren_proj::~wp_gren_proj(), wp_mine_proj::~wp_mine_proj(), and wp_puck_proj::~wp_puck_proj().
spriteObject* spriteObject::parentSprite [protected] |
Definition at line 447 of file spriteObject.h.
Referenced by setParent(), spriteObject(), and updateSprite().
spriteObject* spriteObject::childSprite [protected] |
Definition at line 449 of file spriteObject.h.
Referenced by addChild(), deleteSprite(), removeChild(), and spriteObject().
s8 spriteObject::spriteID [protected] |
OAM id of this spriteObject's sprite.
Definition at line 452 of file spriteObject.h.
Referenced by deleteSprite(), destroy(), disableRotation(), enableRotation(), getSpriteID(), giveGFX(), giveSprite(), hasGraphics(), setArbitraryAnim(), setFrame(), setTransparency(), spriteObject(), updatePallete(), updateSprite(), and Player::~Player().
s8 spriteObject::palleteID [protected] |
id of this spriteObject's pallete
Definition at line 454 of file spriteObject.h.
Referenced by deleteSprite(), destroy(), getPalleteID(), giveGFX(), givePallete(), giveSprite(), Rope::setLength(), setPallete(), Player::setPallete(), spriteObject(), and updatePallete().
s32 spriteObject::gfxID [protected] |
id of this spriteObject's GFX
Definition at line 456 of file spriteObject.h.
Referenced by deleteSprite(), destroy(), getGFXid(), giveGFX(), giveSprite(), spriteObject(), and updatePallete().
s8 spriteObject::soundChannel [protected] |
Definition at line 460 of file spriteObject.h.
Referenced by hasSoundLooping(), playSound(), setSoundChannel(), spriteObject(), and stopSound().
s32 spriteObject::x [protected] |
Definition at line 464 of file spriteObject.h.
Referenced by getLeft(), getRight(), getx(), isColliding(), setPos(), spriteObject(), turnAround(), updatePallete(), and updateSprite().
s32 spriteObject::y [protected] |
Definition at line 464 of file spriteObject.h.
Referenced by massObject::checkPenetration(), getBottom(), getTop(), gety(), isColliding(), setBasePos(), setPos(), spriteObject(), updatePallete(), wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), updateSprite(), and Player::updateSprite().
s32 spriteObject::vx [protected] |
Definition at line 464 of file spriteObject.h.
Referenced by Player::basicInput(), Player::bounce(), wp_weasel_proj::changeDirection(), wp_puck_proj::collidingWith(), Player::collidingWith(), Player::crouch(), Player::freezePlayer(), getRawvx(), getvx(), Player::handleNetted(), wp_weasel_proj::hangDown(), Player::jump(), Player::justlanded(), Player::play1000VHitEffect(), wp_boomerang_proj::returnTick(), wp_weasel_proj::runLeft(), wp_weasel_proj::runRight(), setRawSpeed(), setSpeed(), setvx(), spriteObject(), turnAround(), wp_weasel_proj::updateSprite(), wp_boomerang_proj::updateSprite(), updateSprite(), and Pickup::updateSprite().
s32 spriteObject::vy [protected] |
Definition at line 464 of file spriteObject.h.
Referenced by Player::basicInput(), Player::bounce(), massObject::checkPenetration(), Player::collideNormally(), Player::collidingWith(), massObject::collidingWith(), Player::freezePlayer(), getRawvy(), getvy(), Player::handleNetted(), wp_weasel_proj::hangDown(), isStandingOn(), Player::jump(), Player::play1000VHitEffect(), Player::playMineHitEffect(), setRawSpeed(), setSpeed(), setvy(), spriteObject(), wp_puck_proj::updateSprite(), updateSprite(), Pickup::updateSprite(), and massObject::updateSprite().
s32 spriteObject::oldx [protected] |
s32 spriteObject::oldy [protected] |
bool spriteObject::flippedh [protected] |
Definition at line 466 of file spriteObject.h.
Referenced by wp_weasel_proj::atEdge(), Player::basicInput(), Player::bounce(), wp_weasel_proj::changeDirection(), Player::collideNormally(), getFlippedh(), isFacing(), Player::justfell(), Player::justlanded(), setFlipped(), spriteObject(), Player::stopNetted(), turnAround(), Player::uncrouch(), and updateSprite().
bool spriteObject::flippedv [protected] |
Definition at line 466 of file spriteObject.h.
Referenced by getFlippedv(), Player::justlanded(), setFlipped(), spriteObject(), turnAround(), Player::uncrouch(), and updateSprite().
bool spriteObject::oldFliph [protected] |
bool spriteObject::oldFlipv [protected] |
u8 spriteObject::layer [protected] |
Definition at line 467 of file spriteObject.h.
Referenced by setLayer(), spriteObject(), and updateSprite().
u8 spriteObject::frame [protected] |
Definition at line 468 of file spriteObject.h.
Referenced by Player::basicInput(), getFrame(), isColliding(), setFrame(), spriteObject(), wp_weasel_proj::updateSprite(), and updateSprite().
u8 spriteObject::oldFrame [protected] |
u8 spriteObject::arbitraryAnim [protected] |
0 = none, 1 = play, 2 = loop
Definition at line 471 of file spriteObject.h.
Referenced by Player::basicInput(), isInAnim(), setArbitraryAnim(), setFrame(), spriteObject(), updateSprite(), and singleFireSprite::updateSprite().
u8 spriteObject::arbitrarySpeed [protected] |
animation speed in ticks per frame
Definition at line 473 of file spriteObject.h.
Referenced by setArbitraryAnim(), spriteObject(), and updateSprite().
u8 spriteObject::arbitraryFrameCounter [protected] |
Definition at line 474 of file spriteObject.h.
Referenced by setArbitraryAnim(), spriteObject(), and updateSprite().
u8 spriteObject::arbitraryTimeCounter [protected] |
Definition at line 475 of file spriteObject.h.
Referenced by setArbitraryAnim(), spriteObject(), and updateSprite().
vector<u8> spriteObject::arbFrames [protected] |
animation frame IDs to play sequentially
Definition at line 477 of file spriteObject.h.
Referenced by setArbitraryAnim(), and updateSprite().
boundingbox spriteObject::bounds [protected] |
Definition at line 484 of file spriteObject.h.
Referenced by getBottom(), getLeft(), getRight(), getTop(), setBasePos(), setBounds(), swapHBounds(), and swapVBounds().
u8 spriteObject::centerx [protected] |
Definition at line 485 of file spriteObject.h.
Referenced by getLeft(), getRight(), getx(), giveGFX(), giveSprite(), isColliding(), setCenter(), setPos(), spriteObject(), and updateSprite().
u8 spriteObject::centery [protected] |
Definition at line 485 of file spriteObject.h.
Referenced by getBottom(), getTop(), gety(), giveGFX(), giveSprite(), isColliding(), setBasePos(), setCenter(), Rope::setLength(), setPos(), Rope::setPos(), spriteObject(), and updateSprite().
collisionInfo spriteObject::collision [protected] |
Definition at line 487 of file spriteObject.h.
Referenced by isBaseable(), isColliding(), setCollision(), and spriteObject().
bool spriteObject::checkCollision [protected] |
Definition at line 488 of file spriteObject.h.
Referenced by checkCollisions(), setCheckCollision(), and spriteObject().
spriteObject* spriteObject::ignoreUntilUntouched [protected] |
this sprite's collision is ignored until it stops colliding
Definition at line 490 of file spriteObject.h.
Referenced by checkCollisions(), Player::collidingWith(), getIgnored(), isColliding(), setIgnored(), spriteObject(), and Player::uncrouch().
s8 spriteObject::rotSetID [protected] |
Definition at line 493 of file spriteObject.h.
Referenced by enableRotation(), setFlipped(), setRotation(), setRotSet(), spriteObject(), and updateSprite().
u16 spriteObject::rotAngle [protected] |
Definition at line 494 of file spriteObject.h.
Referenced by setRotation(), spriteObject(), and updateSprite().
bool spriteObject::bRotating [protected] |
Definition at line 495 of file spriteObject.h.
Referenced by disableRotation(), enableRotation(), setFlipped(), setRotation(), spriteObject(), and updateSprite().
bool spriteObject::UPDATEDlayer [protected] |
Definition at line 502 of file spriteObject.h.
Referenced by setLayer(), spriteObject(), and updateSprite().
bool spriteObject::UPDATEDflip [protected] |
Definition at line 503 of file spriteObject.h.
Referenced by setFlipped(), spriteObject(), updatePallete(), and updateSprite().
s16 spriteObject::framesToLive [protected] |
Definition at line 506 of file spriteObject.h.
Referenced by destroy(), disableLifetime(), getLifetime(), markedForDeletion(), setLifetime(), and spriteObject().