#include #include #include #include "player.h" #include "effects.h" #include extern "C" void *PlaySound(dEn_c *, int soundID); 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); CreateEffect(377, &this->pos); this->Delete(); } void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 336); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 342); PlaySound(this, SE_EMY_FIRE_SNAKE_BIGGER); this->Delete(); } bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 44); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 231); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 235); PlaySound(this, SE_OBJ_PNGN_ICE_BREAK); this->Delete(); return false; } void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 48); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 378); PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); this->Delete(); } void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 48); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 378); PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); this->Delete(); } void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 336); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 342); PlaySound(this, SE_EMY_FIRE_SNAKE_BIGGER); this->Delete(); } 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; }