1#include <game/bases/d_a_bullet.hpp>
2#include <game/mLib/m_allocator_dummy_heap.hpp>
3#include <game/bases/d_a_player_base.hpp>
4#include <game/bases/d_eff_actor_manager.hpp>
5#include <game/bases/d_bg.hpp>
52 mStateMgr.changeState(StateID_HitReflect);
60 case HIT_YOSHI_BULLET:
61 mStateMgr.changeState(StateID_HitYoshiBullet);
93 if (
mAllocator.mpHeap != mAllocatorDummyHeap_c::getInstance()) {
110 self->
mInfo |= CC_NO_HIT;
111 }
else if (!player->isNoDamage()) {
116 if (plrNo >= PLAYER_COUNT) {
125 self->
mInfo |= CC_NO_HIT;
126 }
else if (!player->isNoDamage()) {
131 self->
mInfo |= CC_NO_HIT;
132 }
else if (other->
mCcData.
mAttack == CC_ATTACK_YOSHI_BULLET && bullet->hitProc_YoshiBullet(other)) {
133 self->
mInfo |= CC_NO_HIT;
139 if (!(other->
mCcData.mVsDamage & (1 << CC_ATTACK_YOSHI_BULLET))) {
161 self->
mInfo |= CC_NO_HIT;
162 bullet->hitProc_Reflect(other);
163 bullet->revengeHitSE();
167void daBullet_c::revengeHitSE() {}
212 float mag = 1.75f + 0.35f * std::fabs(owner->
mSpeed.x);
217 mVec3_c effectPos(
mCc.getCollPosX(),
mCc.getCollPosY(), 5500.0f);
218 mEf::createEffect(
"Wm_en_hit", 0, &effectPos,
nullptr,
nullptr);
220 dAudio::g_pSndObjEmy->startSound(SE_EMY_DOWN_NO_SCORE,
mPos, 0);
230 if (owner->
mSpeed.x >= 0.0f) {
236 float mag = 1.75f + 0.35f * std::fabs(owner->
mSpeed.x);
241 mVec3_c effectPos(
mCc.getCollPosX(),
mCc.getCollPosY(), 5500.0f);
242 mEf::createEffect(
"Wm_en_hit", 0, &effectPos,
nullptr,
nullptr);
244 dAudio::g_pSndObjEmy->startSound(SE_EMY_DOWN_NO_SCORE,
mPos, 0);
251bool daBullet_c::hitProc_YoshiBullet(
dCc_c *other) {
254 if (owner->
mSpeed.x >= 0.0f) {
260 float mag = 1.75f + 0.35f * std::fabs(owner->
mSpeed.x);
265 mVec3_c effectPos(
mCc.getCollPosX(),
mCc.getCollPosY(), 5500.0f);
266 mEf::createEffect(
"Wm_en_hit", 0, &effectPos,
nullptr,
nullptr);
268 dAudio::g_pSndObjEmy->startSound(SE_EMY_DOWN_NO_SCORE,
mPos, 0);
275bool daBullet_c::hitProc_Reflect(
dCc_c *other) {
296 mCc.mCcData.mKind = CC_KIND_TAMA;
297 mCc.mCcData.mAttack = CC_ATTACK_YOSHI_BULLET;
298 mCc.mCcData.mVsKind =
299 BIT_FLAG(CC_KIND_PLAYER) |
300 BIT_FLAG(CC_KIND_PLAYER_ATTACK) |
301 BIT_FLAG(CC_KIND_YOSHI) |
302 BIT_FLAG(CC_KIND_ENEMY);
303 mCc.mCcData.mVsDamage = 0;
309 mStateMgr.changeState(StateID_SpiteMove);
320 switch (dBc_c::checkWater(
mPos.x,
mPos.y + 4.0f,
mLayer, &height)) {
321 case dBc_c::WATER_CHECK_WATER:
322 case dBc_c::WATER_CHECK_WATER_BUBBLE:
334 u32 splashFlags = (
mLayer << 16) | 1;
336 mVec3_c splashScale(scale, scale, scale);
338 dEffActorMng_c::m_instance->createWaterSplashEff(splashPos, splashFlags, -1, splashScale);
340 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH, pos, 0);
342 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 6);
347 player->setDamage(
this, daPlBase_c::DAMAGE_DEFAULT);
350void daBullet_c::initializeState_EatIn() {}
352void daBullet_c::finalizeState_EatIn() {}
354void daBullet_c::executeState_EatIn() {
360void daBullet_c::initializeState_EatNow() {}
362void daBullet_c::finalizeState_EatNow() {}
364void daBullet_c::executeState_EatNow() {}
366void daBullet_c::initializeState_SpiteMove() {}
368void daBullet_c::finalizeState_SpiteMove() {}
370void daBullet_c::executeState_SpiteMove() {
378void daBullet_c::spitRoll() {}
380void daBullet_c::moveSE() {}
382void daBullet_c::initializeState_Reflect() {}
384void daBullet_c::finalizeState_Reflect() {}
386void daBullet_c::executeState_Reflect() {
391void daBullet_c::initializeState_HitReflect() {}
393void daBullet_c::finalizeState_HitReflect() {}
395void daBullet_c::executeState_HitReflect() {
401void daBullet_c::deadRoll() {
407void daBullet_c::initializeState_HitStar() {}
409void daBullet_c::finalizeState_HitStar() {}
411void daBullet_c::executeState_HitStar() {
417void daBullet_c::initializeState_HitShell() {}
419void daBullet_c::finalizeState_HitShell() {}
421void daBullet_c::executeState_HitShell() {
427void daBullet_c::initializeState_HitYoshiBullet() {}
429void daBullet_c::finalizeState_HitYoshiBullet() {}
431void daBullet_c::executeState_HitYoshiBullet() {
sFStateMgr_c< dActorState_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
The minimum required implementation for a stage actor.
virtual s8 & getPlrNo()
Gets the player number associated with the actor. See mPlayerNo.
virtual void reviveCc()
Enables the actor's collision.
@ SKIP_NONE
No checks are skipped.
u8 mKind
The actor's kind. Value is a STAGE_ACTOR_KIND_e.
u8 mEatState
The actor's eat state. Value is a EAT_STATE_e.
u8 mDirection
The actor's facing direction.
dCc_c mCc
The actor-to-actor collision sensor.
virtual void removeCc()
Disables the actor's collision.
virtual int preExecute()
pre method for the execute operation.
s8 mPlayerNo
The player associated with the actor, -1 if not associated to any player.
bool ActorScrOutCheck(u16 flags)
Checks if the actor is out of gameplay and optionally deletes it.
@ EAT_STATE_EATEN
The actor has been successfully eaten.
dActor_c()
Constructs a new actor.
STAGE_ACTOR_KIND_e
The possible stage actor kinds.
@ STAGE_ACTOR_YOSHI
The Yoshi actor.
@ STAGE_ACTOR_PLAYER
The player actor.
u8 mLayer
The actor's layer.
mVec3_c mSpeed
The actor's speed.
mVec3_c mPos
The actor's position.
mVec3_c mSpeedMax
The actor's maximum speed.
void calcSpeedX()
Updates the actor's X speed. See here for details.
void posMove()
Moves the actor by its speed.
mAng3_c mAngle
The actor's rotation (for 2D actors).
u32 mActorProperties
The actor's properties. See fProf::fActorProfile_c::mActorProperties.
float mAccelY
The actor's vertical acceleration.
void calcSpeedY()
Updates the actor's Y speed. See here for details.
Collider ("Collision Check") class - handles collisions between actors.
u8 mInfo
Info flags for this collider. See CC_INFO_e.
dActor_c * getOwner() const
Gets the owner actor of this collider.
sCcDatNewF mCcData
The collision data of this collider.
The base class for various projectile actors.
dHeapAllocator_c mAllocator
The allocator.
virtual void setSpitOutMove(dActor_c *eatingActor)
Handles the bullet being spat out by Yoshi.
virtual void cullingProc()
Culls the bullet if needed.
static void revengeCallback(dCc_c *self, dCc_c *other)
Collision callback for when the bullet was spat back out by Yoshi.
virtual void createMdl()
Creates the model for the bullet.
BOOL mHasSplashed
Whether the bullet has splashed in water yet.
void allocate()
Creates the allocator and load the model.
bool splashProc()
Checks if the bullet has hit water and creates a splash effect if so.
void setDamage_Player(dActor_c *actor)
Triggers damage to a player that touched the bullet.
virtual void waterSplashEffect(const mVec3_c &pos, float size)
Generates a water splash effect.
virtual bool hitProc_Star(dCc_c *other)
Handles the bullet being hit by a player or Yoshi with a star.
virtual int doDelete()
do method for the delete operation.
static const float smc_DEAD_FALL_YMAXSPEED
The maximum falling speed of a bullet.
virtual int preExecute()
pre method for the execute operation.
static const float smc_DIR_PRM[]
The unit direction values for left and right movement of the bullet.
virtual void setEatTongue(dActor_c *eatingActor)
Callback for when the actor is targeted by Yoshi's tongue.
virtual int create()
do method for the create operation.
daBullet_c()
Constructs a new actor.
int mHitMoveDirection
The direction to travel after the bullet has been hit.
virtual bool setEatSpitOut(dActor_c *eatingActor)
Callback for when the actor is about to be spat out.
virtual bool hitProc_Shell(dCc_c *other)
Handles the bullet being hit by a shell.
virtual void removeMdl()
Removes the model for the bullet.
static void collisionCallback(dCc_c *self, dCc_c *other)
Regular collision callback for the bullet.
virtual void setDeadMove(const mVec3_c &speed, short angle)
Sets the movement parameters for the bullet after it has been hit.
virtual int execute()
do method for the execute operation.
virtual int draw()
do method for the draw operation.
mAng3_c mHitRollDelta
The rotation delta to apply to the bullet each frame after it has been hit.
bool checkPlayerDamage(dCc_c *self, dCc_c *other)
Returns whether a player with a star is touching the bullet.
bool checkYoshiDamage(dCc_c *self, dCc_c *other)
Returns whether a Yoshi with a star is touching the bullet.
static const float smc_DEAD_FALL_GRAVITY
The gravity to apply to a falling bullet.
virtual void initialize()
Subclass-specific initialization logic for the bullet.
HitType_e mHitType
The type of hit that the bullet has received.
virtual void deleteReady()
Informs the base that it's about to be deleted.
The base class for the player and Yoshi.
@ NOT_READY
The step could not completed at this time.
@ SUCCEEDED
The step was completed successfully.
A three-dimensional floating point vector.
@ GAME_HEAP_DEFAULT
The default game heap (alias of MEM1 or MEM2).
EGG::ExpHeap * g_gameHeaps[GAME_HEAP_COUNT]
The game heaps.
#define STATE_VIRTUAL_DEFINE(class, name)
Defines a virtual state.
u8 mAttack
The attack type of this collider. See CC_ATTACK_e.