#include #include #include #include extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*); class daFakeStarCoin : public dEn_c { int onCreate(); int onExecute(); int onDelete(); int onDraw(); mHeapAllocator_c allocator; m3d::mdl_c bodyModel; u64 eventFlag; s32 timer; u32 delay; u32 effect; u8 type; static daFakeStarCoin *build(); void updateModelMatrices(); void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); }; void daFakeStarCoin::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU); SpawnEffect("Wm_en_obakedoor", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) this->Delete(1); } void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_en_explosion", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); SpawnEffect("Wm_en_explosion_smk", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}); PlaySound(this, SE_OBJ_EMY_FIRE_DISAPP); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) this->Delete(1); } bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_ob_cmnicekira", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); SpawnEffect("Wm_ob_icebreakwt", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); SpawnEffect("Wm_ob_iceattack", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); PlaySound(this, SE_OBJ_PNGN_ICE_BREAK); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) this->Delete(1); return false; } void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); SpawnEffect("Wm_en_obakedoor_sm", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) this->Delete(1); } void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); SpawnEffect("Wm_en_obakedoor_sm", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) this->Delete(1); } void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_en_explosion", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); SpawnEffect("Wm_en_explosion_smk", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}); PlaySound(this, SE_OBJ_EMY_FIRE_DISAPP); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) this->Delete(1); } daFakeStarCoin *daFakeStarCoin::build() { void *buffer = AllocFromGameHeap1(sizeof(daFakeStarCoin)); return new(buffer) daFakeStarCoin; } int daFakeStarCoin::onCreate() { allocator.link(-1, GameHeaps[0], 0, 0x20); nw4r::g3d::ResFile rf(getResource("star_coin", "g3d/star_coin.brres")); bodyModel.setup(rf.GetResMdl("star_coinA"), &allocator, 0x224, 1, 0); SetupTextures_Map(&bodyModel, 0); allocator.unlink(); ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; HitMeBaby.yDistToCenter = -3.0; HitMeBaby.xDistToEdge = 12.0; HitMeBaby.yDistToEdge = 15.0; HitMeBaby.category1 = 0x5; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4F; HitMeBaby.bitfield2 = 0xFFFFFFFF; HitMeBaby.unkShort1C = 0; HitMeBaby.callback = &dEn_c::collisionCallback; this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); this->scale.x = 1.0; this->scale.y = 1.0; this->scale.z = 1.0; this->pos.x -= 120.0; this->pos.z = 3300.0; this->onExecute(); return true; } int daFakeStarCoin::onDelete() { return true; } int daFakeStarCoin::onDraw() { bodyModel.scheduleForDrawing(); return true; } void daFakeStarCoin::updateModelMatrices() { matrix.translation(pos.x, pos.y, pos.z); matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); bodyModel.setDrawMatrix(matrix); bodyModel.setScale(&scale); bodyModel.calcWorld(false); } int daFakeStarCoin::onExecute() { updateModelMatrices(); this->rot.x += 0x200; return true; }