2#include <game/bases/d_enemy.hpp>
3#include <game/bases/d_bg_ctr.hpp>
4#include <game/bases/d_heap_allocator.hpp>
5#include <game/mLib/m_3d/anm_mat_clr.hpp>
6#include <game/mLib/m_3d/mdl.hpp>
8#define MAX_SNAKE_BLOCK_COUNT 20
158 dCtrlBlock_c &getTailBlock() {
return mCtrlBlock[1]; }
189 static const float sc_SnakeSpeeds[dCtrlBlock_c::SNAKE_SPEED_COUNT];
mVec3_c mPos
The actor's position.
dEn_c()
Constructs a new enemy actor.
A single block segment within the Snake Block actor.
void deleteBlock()
Releases the model and associated animation resources.
mVec3_c mLastPos
The block's position in the previous movement.
void releaseBgCtr()
Releases the block's collision.
static dBg_ctr_c::CallbackH callBackH
The ceiling collision callback.
void calcCollapse1(s8 *moveSequence)
Updates the block's position when in the Collapse1 state.
mVec3_c mSpeed
The block' speed.
daEnSnakeBlock_c * mpOwner
The parent Snake Block actor.
int mMoveSequenceIdx
The block's current step in the movement sequence.
m3d::anmMatClr_c mAnmClr
The color animation.
void calcAnm()
Advances the animations for the block.
void posMove()
Moves the block by its speed.
dBg_ctr_c mBgCtr
The collision.
mVec3_c mPos
The block's position (center of block).
nw4r::g3d::ResAnmTexSrt mResTexSrt
The texture animation resource.
dBlock_c()
Creates a block.
nw4r::g3d::ResFile mResFile
The resource file.
void calcCollision()
Updates the block's collision based on its offset from the parent.
static dBg_ctr_c::CallbackW callBackW
The side collision callback.
void initCollision(daEnSnakeBlock_c *parent, mVec3_c &blockPos, bool icy)
Initializes the block's collision.
m3d::anmTexSrt_c mAnmTexSrt
The texture animation.
void calcFallSpeed()
Updates the block's falling speed.
void setAnmClr(const char *name)
Sets the color animation for the block.
virtual ~dBlock_c()
Destroys the block.
m3d::mdl_c mModel
The block model.
static dBg_ctr_c::CallbackF callBackF
The floor collision callback.
Specialized block representing the head or tail of the Snake Block.
SnakeSpeed_e
The possible speed modes of a Snake Block.
virtual ~dCtrlBlock_c()
Destroys the block.
dCtrlBlock_c()
Creates a block.
bool moveBlock(s8 *moveSequence)
Moves the block in the direction specified by the current sequence step.
SnakeSpeed_e mSnakeSpeed
The speed mode for this block.
bool nextTravelMove(s8 *moveSequence)
Snaps the block to the grid and advances the sequence index to the next step.
int mBlockCount
The number of blocks between the head and tail.
sStateID_c * mpStopState
The state to transition to when the Snake Block stops.
virtual ~daEnSnakeBlock_c()
Destroys the Snake Block.
int mSnakeType
The snake type.
ACTOR_PARAM_CONFIG(SnakeSpeed, 8, 2)
The snake's speed. See dCtrlBlock_c::SnakeSpeed_e.
ACTOR_PARAM_CONFIG(BlockCount, 0, 4)
The number of blocks between the head and tail.
bool chkOffScreen()
Checks whether the Snake Block is far past the right edge of the screen.
static const mVec2_c sc_TravelDirs[MOVE_DIR_COUNT]
The unit vector for each movement direction.
void initMoveSequence()
Rasterizes the rail path into the sequence of movements.
static const float sc_FallMaxSpeed
The terminal velocity applied during a collapse.
dHeapAllocator_c mAllocator
The allocator.
static const int scSnakeSoundID
The sound effect ID played while the snake moves.
ACTOR_PARAM_CONFIG(StopMode, 28, 4)
Determines how the Snake Block behaves after terminating.
static const float sc_FallAccel
The gravity acceleration applied during a collapse.
int mGradientActiveBlocks
The number of blocks currently displaying the gradient animation.
void createMdl()
Creates the model and animations for each block.
ACTOR_PARAM_CONFIG(SnakeType, 20, 1)
The snake type. See mSnakeType.
dCtrlBlock_c mCtrlBlock[2]
The head and tail blocks.
void calcAnm()
Advances the animations for all blocks in the Snake Block.
void deleteBlocks()
Releases the resources for each block.
ACTOR_PARAM_CONFIG(RailStartIdx, 12, 8)
The rail node index where the snake spawns.
int mMoveSequenceIdx
The current index into mpMoveSequence.
dBlock_c mBlocks[20]
The blocks between the head and tail. Only the first mBlockCount of these are used.
bool chkCollapseDelete()
Checks whether the tail block is below the screen edge.
virtual int execute()
do method for the execute operation.
int mCollapseTimer
The timer used by the Collapse2 state to delay the fall of each block.
virtual int create()
do method for the create operation.
s8 * mpMoveSequence
The precalculated sequence of movements each block has to perform to reach the end of the rail.
void calcActorPos()
Updates the Snake Block's position to match the head block's.
void calcBlockPos()
Updates each body block's position.
void calcCollision()
Updates each block's collision.
s16 mShakeTimer
Counts down frames for the shake animation at the end of the rail.
virtual int doDelete()
do method for the delete operation.
static const float sc_SnakeSpeeds2[dCtrlBlock_c::SNAKE_SPEED_COUNT]
Alternate array of speed values.
ACTOR_PARAM_CONFIG(RailID, 4, 4)
The ID of the rail that the Snake Block travels along.
void initBlockCollision()
Initializes the collision for the head, body, and tail segments.
virtual void deleteReady()
Informs the base that it's about to be deleted.
void setStopState()
Sets the state to transition to after the Snake Block reaches the end of the rail.
daEnSnakeBlock_c()
Creates a Snake Block.
void initBlocks()
Initializes various components.
static const float sc_SnakeSpeeds[dCtrlBlock_c::SNAKE_SPEED_COUNT]
The speed values corresponding to SnakeSpeed_e.
int mGradientMaxBlocks
The maximum number of blocks the gradient animation can cover.
static int g_SnakeNum
Global counter for the active Snake Blocks.
virtual int draw()
do method for the draw operation.
An allocator class that wraps an EGG:Allocator .
A two-dimensional floating point vector.
A three-dimensional floating point vector.
A generic implementation of a state ID.
#define STATE_FUNC_DECLARE(class, name)
Declares a state.