diff options
-rw-r--r-- | NewerProject.yaml | 2 | ||||
-rw-r--r-- | bossCaptainBowser.yaml | 69 | ||||
-rw-r--r-- | challengeStar.yaml | 17 | ||||
-rw-r--r-- | kamek_pal.x | 10 | ||||
-rw-r--r-- | makeYourOwn.yaml | 17 | ||||
-rw-r--r-- | src/bossCaptainBowser.cpp | 81 | ||||
-rw-r--r-- | src/bossFlameThrower.cpp | 291 | ||||
-rw-r--r-- | src/bossKoopaThrow.cpp | 37 | ||||
-rw-r--r-- | src/bossPlayerClown.cpp | 60 | ||||
-rw-r--r-- | src/challengeStar.cpp | 130 | ||||
-rwxr-xr-x | src/growup.s | 4 | ||||
-rw-r--r-- | src/levelspecial.cpp | 18 | ||||
-rw-r--r-- | src/makeYourOwnModelSprite.cpp | 300 |
13 files changed, 720 insertions, 316 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index c8b836a..b2c9693 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -47,5 +47,7 @@ modules: - processed/meteor.yaml - processed/topman.yaml - processed/electricLine.yaml + - processed/makeYourOwn.yaml + - processed/challengeStar.yaml # - processed/pengi.yaml # - processed/actorlog.yaml diff --git a/bossCaptainBowser.yaml b/bossCaptainBowser.yaml index 5ef0ea0..0583af0 100644 --- a/bossCaptainBowser.yaml +++ b/bossCaptainBowser.yaml @@ -1,10 +1,10 @@ --- -# Captain Bowser Replaces Mask +# Captain Bowser Replaces Branch # # KoopaThrow = WM_ANCHOR -# FlameThrower = WM_ANTLION_MGR +# FlameThrower = WM_ANTLION -source_files: [../src/bossCaptainBowser.cpp, ../src/bossKoopaThrow.cpp, ../src/bossFlameThrower.cpp] +source_files: [../src/bossPlayerClown.cpp, ../src/bossCaptainBowser.cpp, ../src/bossKoopaThrow.cpp, ../src/bossFlameThrower.cpp] hooks: - name: BossCaptainBoswerBuild @@ -12,6 +12,14 @@ hooks: src_addr_pal: 0x80955978 target_func: 'daCaptainBowser::build(void)' + - name: UpdateaptainBoswerSpriteInfo + type: patch + addr_pal: 0x8030C4AC + # [010] ( 16, 16) ( 0, 0 32: 32) 64? 64? 0? 0? | [0:No Flags] + data: '0002 0000' + # 0x8030A340 + sprite num * 0x28 == offset (+24 in this case) + + - name: KoopaThrowBuild type: add_func_pointer src_addr_pal: 0x80981960 @@ -26,7 +34,7 @@ hooks: - name: KFlameThrowerBuild type: add_func_pointer - src_addr_pal: 0x80981BD4 + src_addr_pal: 0x80981A3C target_func: 'daKoopaBreath::build(void)' - name: UpdateKoopaThrowSpriteInfo @@ -35,3 +43,56 @@ hooks: # [011] ( 16, 16) ( 0, 0 32: 32) 64? 64? 0? 0? | [0:No Flags] data: '0271 0000 00000010 00000010 00000000 00000000 00000020 00000020 0040 0040 0000 0000 0000 0000' # 0x8030A340 + sprite num * 0x28 == offset + + + + - name: ClownCarFloor + type: patch + addr_pal: 0x80810A40 + data: '60000000' + + - name: ClownCarWalls + type: patch + addr_pal: 0x80937A60 + data: '471C4000' + + - name: ClownCarAllocation + type: patch + addr_pal: 0x8080F918 + data: '38600FD0' # Replace 0x0FD0 which how much space I want to allocate + + + + # Official Funcs + # - name: ClownCarCtor + # type: branch_insn + # branch_type: bl + # src_addr_pal: 0x8080F92C + # target_func: 'newClownCtor(dEn_c *clown)' + + # - name: ClownCarDtor + # type: add_func_pointer + # src_addr_pal: 0x809602A8 + # target_func: 'newClownDtor(dEn_c *clown, u32 willDelete)' + + + # # My overrides + # - name: ClownCarMoveExecute + # type: add_func_pointer + # src_addr_pal: 0x80960184 + # target_func: 'CConExecuteMove(dEn_c *clown)' + + # - name: ClownCarAfterCreate + # type: add_func_pointer + # src_addr_pal: 0x8095FEF8 + # target_func: 'CCafterCreate(dEn_c *clown)' + + # - name: ClownCarOnExecute + # type: add_func_pointer + # src_addr_pal: 0x8095FF08 + # target_func: 'CConExecute(dEn_c *clown)' + + # - name: ClownCarOnDraw + # type: add_func_pointer + # src_addr_pal: 0x8095FF14 + # target_func: 'CConDraw(dEn_c *clown)' diff --git a/challengeStar.yaml b/challengeStar.yaml new file mode 100644 index 0000000..8164043 --- /dev/null +++ b/challengeStar.yaml @@ -0,0 +1,17 @@ +--- +# Replaces WM_Kuribo + +source_files: [../src/challengeStar.cpp] +hooks: + - name: ChallengeStarBuild + type: add_func_pointer + src_addr_pal: 0x8098872C + target_func: 'dChallengeStar::build(void)' + + - name: UpdateModelSpriteInfo + type: patch + # 0x8030A340 + sprite num * 0x28 == offset + addr_pal: 0x8030A520 + # -ID- ---- -X Offs- -Y Offs- -RectX1- -RectY1- -RectX2- -RectY2- -1C- -1E- -20- -22- Flag ---- + # Orig 01FC 0000 00000008 00000000 00000000 FFFFFFC0 00000010 00000040 0030 0030 0000 0000 0008 0000 + data: '028F 0000 00000000 00000000 00000000 00000000 00000040 00000010 0000 0000 0000 0000 0000 0000' diff --git a/kamek_pal.x b/kamek_pal.x index 4e979e3..18b4a8b 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -5,6 +5,16 @@ OUTPUT_FORMAT ("binary") }*/ SECTIONS { + +/* Scrolling is annoying, clown car goes here! */ + + __ct__20daJrClownForPlayer_cFv = 0x8080F910; + __dt__20daJrClownForPlayer_cFv = 0x80810500; /* Or 0x80810540 maybe, beans if I know */ + + + +/* Back to other shit I didn't want to scroll for */ + GlobalTickCount = 0x8042A648; GetSpecificPlayerActor = 0x8005F900; diff --git a/makeYourOwn.yaml b/makeYourOwn.yaml new file mode 100644 index 0000000..6309b88 --- /dev/null +++ b/makeYourOwn.yaml @@ -0,0 +1,17 @@ +--- +# Replaces WM_KoopaCastle + +source_files: [../src/makeYourOwnModelSprite.cpp] +hooks: + - name: BuildYourOwnModel + type: add_func_pointer + src_addr_pal: 0x80988574 + target_func: 'dMakeYourOwn::build(void)' + + - name: UpdateModelSpriteInfo + type: patch + # 0x8030A340 + sprite num * 0x28 == offset + addr_pal: 0x8030A4F8 + # -ID- ---- -X Offs- -Y Offs- -RectX1- -RectY1- -RectX2- -RectY2- -1C- -1E- -20- -22- Flag ---- + # Orig 01FC 0000 00000008 00000000 00000000 FFFFFFC0 00000010 00000040 0030 0030 0000 0000 0008 0000 + data: '029E 0000 00000000 00000000 FFFFFC00 FFFFFC00 00000400 00000400 0400 0400 0000 0000 0008 0000' diff --git a/src/bossCaptainBowser.cpp b/src/bossCaptainBowser.cpp index 710af77..6152b42 100644 --- a/src/bossCaptainBowser.cpp +++ b/src/bossCaptainBowser.cpp @@ -5,12 +5,34 @@ #include <stage.h> #include "boss.h" + + +const char* effects_name_list [] = { + "Wm_jr_electricline", // cool + "Wm_jr_fireattack", // cool + "Wm_jr_firehit", // cool + "Wm_jr_fireplace", // cool + "Wm_jr_fireplace_ind", // cool + "Wm_jr_shot", + "Wm_jr_sweat", + "Wm_ko_fireattack", // cool + "Wm_ko_firehit", // cool + "Wm_ko_firehitdie01", // cool + "Wm_ko_firehitdie02", // cool + "Wm_ko_firehitdie03", // cool + "Wm_ko_magmapocha", + "Wm_ko_magmapochabig", + "Wm_ko_shout", // cool + "Wm_ko_shout02", // cool + "Wm_seacloudout", // cool +}; + + + void ShipPhysicsCallback(daBoss *self, dStageActor_c *other) { - OSReport("Physics"); if (other->name == EN_CANNON_BULLET) { } - } @@ -32,9 +54,12 @@ public: m3d::anmChr_c shipAnm; Physics ShipPhysics; + ActivePhysics Roar; + mEf::es2 effect; char isAngry; char isInvulnerable; + float scaleIncreaser; // int isInvulnerableCountdown; // int isTurningCountdown; // char charging; @@ -182,6 +207,25 @@ int daCaptainBowser::onCreate() { this->aPhysics.addToList(); + + // Roar Physics! + ActivePhysics::Info RoarStruct; + RoarStruct.xDistToCenter = -186.0; + RoarStruct.yDistToCenter = 138.0; + + RoarStruct.xDistToEdge = 20.0; + RoarStruct.yDistToEdge = 20.0; + + RoarStruct.category1 = 0x3; + RoarStruct.category2 = 0x0; + RoarStruct.bitfield1 = 0x4F; + RoarStruct.bitfield2 = 0x8028E; + RoarStruct.unkShort1C = 0; + RoarStruct.callback = &dEn_c::collisionCallback; + + this->Roar.initWithStruct(this, &RoarStruct); + + // State Changers doStateChange(&StateID_Wait); @@ -196,6 +240,8 @@ int daCaptainBowser::onExecute() { acState.execute(); this->ShipPhysics.update(); + PlaySound(this, SE_BOSS_SHIP_PRPL); + bodyModel._vf1C(); shipModel._vf1C(); @@ -265,6 +311,9 @@ int daCaptainBowser::onDraw() { if (num == 0) { doStateChange(&StateID_Fire); } + else if (num == 1) { + doStateChange(&StateID_Roar); + } else{ doStateChange(&StateID_Throw); } @@ -320,8 +369,9 @@ int daCaptainBowser::onDraw() { } void daCaptainBowser::executeState_Fire() { - if (this->chrAnimation.getCurrentFrame() == 70) { // spit fire - CreateActor(KOOPA_FIRE, 0x30, (Vec){pos.x-156.0, pos.y+128.0, pos.z}, 0, 0); // Seems like nyb 5 has a setting, 2 bits long, maybe. + if (this->chrAnimation.getCurrentFrame() == 70.5) { // spit fire + PlaySound(this, SE_BOSS_KOOPA_L_FIRE_SHOT); + CreateActor(WM_ANTLION, 0, (Vec){pos.x-172.0, pos.y+152.0, pos.z}, 0, 0); } if (this->chrAnimation.isAnimationDone()) { @@ -349,11 +399,30 @@ int daCaptainBowser::onDraw() { void daCaptainBowser::beginState_Roar() { bindAnimChr_and_setUpdateRate("kp_roar3", 1, 0.0, 1.0); this->isInvulnerable = 1; + this->timer = 0; + this->scaleIncreaser = 0.5; + + this->Roar.info.xDistToEdge = 70.0 * scaleIncreaser; + this->Roar.info.yDistToEdge = 70.0 * scaleIncreaser; + this->Roar.addToList(); } void daCaptainBowser::executeState_Roar() { + if (this->chrAnimation.getCurrentFrame() == 53.0) { // This is where the smackdown starts - SpawnEffect("Wm_ob_itemget_ring", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + PlaySound(this, SE_VOC_KP_L_SHOUT); + } + + if (this->chrAnimation.getCurrentFrame() > 53.0) { // This is where the smackdown starts + scaleIncreaser += 0.014285; + effect.spawn("Wm_ko_shout", 0, &(Vec){pos.x-186.0+(scaleIncreaser*16.0), pos.y+138.0+(scaleIncreaser*16.0), pos.z}, &(S16Vec){0,0,0}, &(Vec){scaleIncreaser, scaleIncreaser, scaleIncreaser}); + + this->Roar.info.xDistToEdge = 70.0 * scaleIncreaser; + this->Roar.info.yDistToEdge = 70.0 * scaleIncreaser; + } + + if (this->chrAnimation.getCurrentFrame() == 197.0) { // This is where the smackdown ends + this->Roar.removeFromList(); } if (this->chrAnimation.isAnimationDone()) { @@ -375,6 +444,8 @@ int daCaptainBowser::onDraw() { bindAnimChr_and_setUpdateRate("grow_big", 1, 0.0, 1.0); this->isInvulnerable = 1; this->chrAnimation.setCurrentFrame(9.0); + + PlaySound(this, SE_VOC_KP_DAMAGE_HPDP); } void daCaptainBowser::executeState_Damage() { diff --git a/src/bossFlameThrower.cpp b/src/bossFlameThrower.cpp index 70583fd..3a77621 100644 --- a/src/bossFlameThrower.cpp +++ b/src/bossFlameThrower.cpp @@ -7,69 +7,17 @@ class daKoopaBreath : public dEn_c { int onCreate(); int onExecute(); - int onDelete(); - int onDraw(); - - mHeapAllocator_c allocator; - m3d::mdl_c bodyModel; - - int timer; - char Kaboom; - char direction; - char front; - float ymod; - int lifespan; - u32 cmgr_returnValue; + mEf::es2 effect; static daKoopaBreath *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 collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); - - - USING_STATES(daKoopaBreath); - DECLARE_STATE(Straight); - DECLARE_STATE(Kaboom); + void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); }; -CREATE_STATE(daKoopaBreath, Straight); -CREATE_STATE(daKoopaBreath, Kaboom); - - -extern "C" void *PlayWrenchSound(dEn_c *); - - void daKoopaBreath::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } - -void daKoopaBreath::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { } -bool daKoopaBreath::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { - return false; -} -void daKoopaBreath::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {} -void daKoopaBreath::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { - SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}); - - PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); - this->Delete(1); -} -void daKoopaBreath::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) {} -void daKoopaBreath::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { - this->_vf220(apOther->owner); - - SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}); - - PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); - this->Delete(1); -} - +void daKoopaBreath::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) {} daKoopaBreath *daKoopaBreath::build() { @@ -80,234 +28,43 @@ daKoopaBreath *daKoopaBreath::build() { int daKoopaBreath::onCreate() { - allocator.link(-1, GameHeaps[0], 0, 0x20); - - nw4r::g3d::ResFile rf(getResource("choropoo", "g3d/choropoo.brres")); - bodyModel.setup(rf.GetResMdl("spanner"), &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&bodyModel, 0); - - allocator.unlink(); - - - this->direction = this->settings & 0xF; - this->Kaboom = (this->settings >> 4) & 0xF; - this->front = (this->settings >> 8) & 0xF; - - ActivePhysics::Info HitMeBaby; - - if (this->Kaboom == 0) { - HitMeBaby.xDistToCenter = 0.0; - HitMeBaby.yDistToCenter = 0.0; - HitMeBaby.xDistToEdge = 5.0; - HitMeBaby.yDistToEdge = 5.0; - - this->scale.x = 1.25; - this->scale.y = 1.25; - this->scale.z = 1.25; - } - - else { - HitMeBaby.xDistToCenter = 0.0; - HitMeBaby.yDistToCenter = 0.0; - HitMeBaby.xDistToEdge = 8.0; - HitMeBaby.yDistToEdge = 8.0; + OSReport("Made a fireball"); + ActivePhysics::Info GreatBalls; - this->scale.x = 2.0; - this->scale.y = 2.0; - this->scale.z = 2.0; - } + GreatBalls.xDistToCenter = 0.0; + GreatBalls.yDistToCenter = 18.0; + GreatBalls.xDistToEdge = 38.0; + GreatBalls.yDistToEdge = 38.0; - HitMeBaby.category1 = 0x3; - HitMeBaby.category2 = 0x0; - HitMeBaby.bitfield1 = 0x47; - HitMeBaby.bitfield2 = 0xFFFFFFFF; - HitMeBaby.unkShort1C = 0; - HitMeBaby.callback = &dEn_c::collisionCallback; - - this->aPhysics.initWithStruct(this, &HitMeBaby); + GreatBalls.category1 = 0x3; + GreatBalls.category2 = 0x0; + GreatBalls.bitfield1 = 0x47; + GreatBalls.bitfield2 = 0xFFFFFFFF; + GreatBalls.unkShort1C = 0; + GreatBalls.callback = &dEn_c::collisionCallback; + + this->aPhysics.initWithStruct(this, &GreatBalls); this->aPhysics.addToList(); - - - spriteSomeRectX = 5.0f; - spriteSomeRectY = 5.0f; - _320 = 0.0f; - _324 = 5.0f; - - // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; - - collMgr.Init(this, one, two, three); - collMgr.execute(); - - cmgr_returnValue = collMgr.CollidedWithTile(); - - - if (this->direction == 0) { // Ground Facing Left - this->pos.x -= 0.0; // -32 to +32 - this->pos.y += 36.0; - this->rot.z = 0x2000; - } - else if (this->direction == 1) { // Ground Facing Right - this->pos.x += 0.0; // +32 to -32 - this->pos.y += 36.0; - this->rot.z = 0xE000; - } - if (this->front == 1) { this->pos.z = -1804.0; } - else { this->pos.z = 3300.0; } - - - if (this->Kaboom) { - doStateChange(&StateID_Kaboom); } - else { - doStateChange(&StateID_Straight); } + speed.x = -2.0; this->onExecute(); return true; } -int daKoopaBreath::onDelete() { - return true; -} - -int daKoopaBreath::onDraw() { - bodyModel.scheduleForDrawing(); - return true; -} - - -void daKoopaBreath::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 daKoopaBreath::onExecute() { - acState.execute(); - updateModelMatrices(); - - return true; -} - - -void daKoopaBreath::beginState_Kaboom() { - float rand = (float)GenerateRandomNumber(10) * 0.4; - - if (this->direction == 0) { // directions 1 spins clockwise, fly rightwards - speed.x = 1.0 + rand; - } - else { // directions 0 spins anti-clockwise, fly leftwards - speed.x = -1.0 - rand; - } - - speed.y = 6.0; -} -void daKoopaBreath::executeState_Kaboom() { - - speed.y = speed.y - 0.01875; - - HandleXSpeed(); - HandleYSpeed(); - doSpriteMovement(); - - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); - - if (collMgr.CollidedWithTile()) { - // hit the ground - PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST); - - SpawnEffect("Wm_en_burst_s", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}); - SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.25, 1.25, 1.25}); - this->Delete(1); - } - if (collMgr.bitfield_for_checks & (0x15 << direction)) { - // hit the wall - PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST); - - if (this->direction == 0) { // directions 1 spins clockwise, fly rightwards - SpawnEffect("Wm_en_burst_s", 0, &this->pos, &(S16Vec){0,0x4000,0}, &(Vec){0.75, 0.75, 0.75}); - SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &(S16Vec){0,0x4000,0}, &(Vec){1.25, 1.25, 1.25}); - } - else { // directions 0 spins anti-clockwise, fly leftwards - SpawnEffect("Wm_en_burst_s", 0, &this->pos, &(S16Vec){0,0xE000,0}, &(Vec){0.75, 0.75, 0.75}); - SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &(S16Vec){0,0xE000,0}, &(Vec){1.25, 1.25, 1.25}); - } - - this->Delete(1); - } - - if (this->direction == 1) { // directions 1 spins clockwise, fly rightwards - this->rot.z -= 0x1000; } - else { // directions 0 spins anti-clockwise, fly leftwards - this->rot.z += 0x1000; } - - PlayWrenchSound(this); - -} -void daKoopaBreath::endState_Kaboom() { } - - - -void daKoopaBreath::beginState_Straight() { - float rand = (float)GenerateRandomNumber(10) * 0.4; - - if (this->direction == 0) { // directions 1 spins clockwise, fly rightwards - speed.x = 1.0 + rand; - } - else { // directions 0 spins anti-clockwise, fly leftwards - speed.x = -1.0 - rand; - } - - speed.y = 6.0; -} -void daKoopaBreath::executeState_Straight() { - - speed.y = speed.y - 0.01875; - HandleXSpeed(); - HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + PlaySound(this, SE_BOSS_JR_FIRE_BURNING); - if (collMgr.CollidedWithTile()) { - // hit the ground - PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); + effect.spawn("Wm_ko_fireattack", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}); - SpawnEffect("Wm_en_burst_s", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}); + float rect[] = {0.0, 0.0, 38.0, 38.0}; + int ret = this->outOfZone(this->pos, (float*)&rect, this->currentZoneID); + if(ret) { this->Delete(1); } - if (collMgr.bitfield_for_checks & (0x15 << direction)) { - // hit the wall - PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); - - SpawnEffect("Wm_en_burst_s", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}); - this->Delete(1); - } - - if (this->direction == 1) { // directions 1 spins clockwise, fly rightwards - this->rot.z -= 0x1000; } - else { // directions 0 spins anti-clockwise, fly leftwards - this->rot.z += 0x1000; } - - PlayWrenchSound(this); + return true; } -void daKoopaBreath::endState_Straight() { } - - - - - -// Wm_en_explosion_smk - - - diff --git a/src/bossKoopaThrow.cpp b/src/bossKoopaThrow.cpp index 19beadd..821a848 100644 --- a/src/bossKoopaThrow.cpp +++ b/src/bossKoopaThrow.cpp @@ -22,10 +22,10 @@ struct TypeInfo { static const TypeInfo types[6] = { {"choropoo", "g3d/choropoo.brres", "spanner", "Wm_en_hit", 0, SE_BOSS_JR_FLOOR_BREAK, 0, 8.0f, 2.0f, 0, 0, 0x1000}, {"choropoo", "g3d/choropoo.brres", "spanner", "Wm_en_burst_s", 0, SE_BOSS_JR_BOMB_BURST, 0, 8.0f, 2.0f, 0, 0, 0x1000}, - {"koopa_clown_bomb", "g3d/koopa_clown_bomb.brres", "koopa_clown_bomb", "Wm_en_burst_s", SE_BOSS_JR_BOMB_BOUND, SE_BOSS_JR_BOMB_BURST, 0, 16.0f, 0.8f, 0x200, 0x800, 0x1000}, + {"koopa_clown_bomb", "g3d/koopa_clown_bomb.brres", "koopa_clown_bomb", "Wm_en_burst_s", SE_EMY_ELCJ_THROW, SE_BOSS_JR_BOMB_BURST, 0, 16.0f, 0.8f, 0x200, 0x800, 0x1000}, {"bros", "g3d/t00.brres", "bros_hammer", "Wm_en_hit", 0, SE_OBJ_HAMMER_HIT_BOTH, SE_EMY_MEGA_BROS_HAMMER, 16.0f, 2.0f, 0, 0, 0x1000}, {"dossun", "g3d/t00.brres", "dossun", "Wm_en_hit", SE_EMY_DOSSUN, SE_EMY_DOSSUN_DEAD, 0, 16.0f, 1.0f, 0x100, 0x100, 0x100}, - {"KoopaShip", "g3d/present.brres", "PresentBox_penguin", "Wm_dm_presentopen",SE_DEMO_OP_PRESENT_THROW_2400f, SE_DEMO_OP_PRESENT_BOX_BURST, 0, 12.0f, 1.0f, 0x20, 0x40, 0x200} + {"KoopaShip", "g3d/present.brres", "PresentBox_penguin", "Wm_dm_presentopen",SE_DEMO_OP_PRESENT_THROW_2400f, SE_DEMO_OP_PRESENT_BOX_BURST, 0, 20.0f, 1.0f, 0x20, 0x40, 0x200} }; @@ -88,7 +88,7 @@ void daKoopaThrow::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther if (Type == 5) { PlaySoundAsync(this, currentInfo->breakSound); SpawnEffect(currentInfo->deathEffect, 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}); - dStageActor_c *spawned = CreateActor(EN_HATENA_BALLOON, 0x100, this->pos, 0, 0); + dStageActor_c *spawned = CreateActor(EN_ITEM, 0x20000063, this->pos, 0, 0); spawned->pos.x = this->pos.x; spawned->pos.y = this->pos.y; this->Delete(1); @@ -141,9 +141,7 @@ void daKoopaThrow::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhys daKoopaThrow *daKoopaThrow::build() { - OSReport("Building"); void *buffer = AllocFromGameHeap1(sizeof(daKoopaThrow)); - OSReport("Built"); return new(buffer) daKoopaThrow; } @@ -154,31 +152,20 @@ int daKoopaThrow::onCreate() { this->Type = (this->settings >> 4) & 0xF; this->front = (this->settings >> 8) & 0xF; - OSReport("Type is %d", this->Type); - currentInfo = &types[Type]; - OSReport("Current Info is: %s, %s, %s", currentInfo->arcName, currentInfo->brresName, currentInfo->modelName); - allocator.link(-1, GameHeaps[0], 0, 0x20); - OSReport("Allocated"); - nw4r::g3d::ResFile rf(getResource(currentInfo->arcName, currentInfo->brresName)); - OSReport("Res File Gotten"); bodyModel.setup(rf.GetResMdl(currentInfo->modelName), &allocator, 0x224, 1, 0); - OSReport("Body model setup"); SetupTextures_Enemy(&bodyModel, 0); - OSReport("Textures setup"); allocator.unlink(); - OSReport("Onwards to Physics"); - ActivePhysics::Info KoopaJunk; - KoopaJunk.xDistToCenter = 0.0; + KoopaJunk.xDistToCenter = -currentInfo->size; KoopaJunk.yDistToCenter = 0.0; KoopaJunk.xDistToEdge = currentInfo->size; KoopaJunk.yDistToEdge = currentInfo->size; @@ -266,7 +253,6 @@ int daKoopaThrow::onExecute() { float rect[] = {this->_320, this->_324, this->spriteSomeRectX, this->spriteSomeRectY}; int ret = this->outOfZone(this->pos, (float*)&rect, this->currentZoneID); if(ret) { - OSReport("Deleting"); this->Delete(1); } @@ -295,8 +281,8 @@ void daKoopaThrow::executeState_Straight() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + // cmgr_returnValue = collMgr.CollidedWithTile(); + // collMgr.execute(); // if (collMgr.CollidedWithTile() || (collMgr.bitfield_for_checks & (0x15 << direction))) { // // hit the ground or wall @@ -324,17 +310,6 @@ void daKoopaThrow::executeState_Straight() { PlaySound(this, currentInfo->flySound); } - if (Type == 5) { - if (this->speed.y < 0.0) { - PlaySoundAsync(this, currentInfo->breakSound); - SpawnEffect(currentInfo->deathEffect, 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); - dStageActor_c *spawned = CreateActor(EN_HATENA_BALLOON, 0x100, this->pos, 0, 0); - spawned->pos.x = this->pos.x; - spawned->pos.y = this->pos.y; - this->Delete(1); - } - } - } void daKoopaThrow::endState_Straight() { } diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp new file mode 100644 index 0000000..afa8c3e --- /dev/null +++ b/src/bossPlayerClown.cpp @@ -0,0 +1,60 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> +#include <stage.h> +#include "boss.h" + + +#define CLOWN_MODEL(clown) ((m3d::mdl_c*)( ((u32)(clown)) + 0xFD0 )) + +dEn_c *newClownCtor(dEn_c *clown); +void newClownDtor(dEn_c *clown, u32 willDelete); + +void CConDraw(dEn_c *clown) { + // setup matrices + CLOWN_MODEL(clown)->scheduleForDrawing(); + + // run normal clown function +} + +void CConExecute(dEn_c *clown) { + // run normal execute +} + +void CCafterCreate(dEn_c *clown) { + clown->scale.x = clown->scale.x * 1.25; + clown->scale.y = clown->scale.y * 1.25; + clown->scale.z = clown->scale.z * 1.25; + + // setup the model + + // dEn_c::afterCreate(1); +} + +void CConExecuteMove(dEn_c *clown) { + // run normal move + + // check for wiimote button presses + + // spawn effect and attack if there are any +} + + +extern "C" m3d::mdl_c *__ct__Q23m3d5mdl_cFv(m3d::mdl_c *mdl); +extern "C" dEn_c *__ct__20daJrClownForPlayer_cFv(dEn_c *clown); + +dEn_c *newClownCtor(dEn_c *clown) { + __ct__20daJrClownForPlayer_cFv(clown); + __ct__Q23m3d5mdl_cFv(CLOWN_MODEL(clown)); + return clown; +} + + +extern "C" void __dt__Q23m3d5mdl_cFv(m3d::mdl_c *mdl, u32 willDelete); +extern "C" void __dt__20daJrClownForPlayer_cFv(dEn_c *mdl, u32 willDelete); + +void newClownDtor(dEn_c *clown, u32 willDelete) { + __dt__Q23m3d5mdl_cFv(CLOWN_MODEL(clown), 0xFFFFFFFF); + __dt__20daJrClownForPlayer_cFv(clown, willDelete); +} diff --git a/src/challengeStar.cpp b/src/challengeStar.cpp new file mode 100644 index 0000000..fc710d4 --- /dev/null +++ b/src/challengeStar.cpp @@ -0,0 +1,130 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> + + +extern "C" void *PlaySound(dEn_c *, int soundID); +extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*); + +extern int GlobalStarsCollected; + +struct EventTable_t { u64 events; }; +extern EventTable_t *EventTable; + + +class dChallengeStar : public dEn_c { + int onCreate(); + int onExecute(); + int onDelete(); + int onDraw(); + + mHeapAllocator_c allocator; + m3d::mdl_c bodyModel; + + mEf::es2 effect; + + u64 eventFlag; + s32 timer; + + static dChallengeStar *build(); + + void updateModelMatrices(); + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); + + void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); + +}; + + +void dChallengeStar::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + PlaySound(this, SE_OBJ_BROOM_KEY_SHOW); + SpawnEffect("Wm_ob_greencoinkira_a", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}); + + GlobalStarsCollected++; + if (GlobalStarsCollected == 50) { + GlobalStarsCollected = 0; + EventTable->events = EventTable->events | this->eventFlag; + } + + this->Delete(this->_390); +} + +void dChallengeStar::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); } +void dChallengeStar::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); } + + +dChallengeStar *dChallengeStar::build() { + void *buffer = AllocFromGameHeap1(sizeof(dChallengeStar)); + return new(buffer) dChallengeStar; +} + + +int dChallengeStar::onCreate() { + + OSReport("Creating a star collectable\n"); + allocator.link(-1, GameHeaps[0], 0, 0x20); + + nw4r::g3d::ResFile rf(getResource("I_star", "g3d/I_star.brres")); + bodyModel.setup(rf.GetResMdl("I_star"), &allocator, 0x224, 1, 0); + SetupTextures_Map(&bodyModel, 0); + + allocator.unlink(); + + ActivePhysics::Info HitMeBaby; + HitMeBaby.xDistToCenter = 0.0; + HitMeBaby.yDistToCenter = -3.0; + HitMeBaby.xDistToEdge = 4.0; + HitMeBaby.yDistToEdge = 4.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(); + + char eventNum = (this->settings >> 24) & 0xFF; + this->eventFlag = (u64)1 << (eventNum - 1); + + this->scale.x = 0.5; + this->scale.y = 0.5; + this->scale.z = 0.5; + + this->pos.z = 3300.0; + + this->onExecute(); + return true; +} + + +int dChallengeStar::onDelete() { + return true; +} + +int dChallengeStar::onDraw() { + bodyModel.scheduleForDrawing(); + return true; +} + + +void dChallengeStar::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 dChallengeStar::onExecute() { + updateModelMatrices(); + + effect.spawn("Wm_ob_keyget02_kira", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + this->rot.y += 0x200; + return true; +} + diff --git a/src/growup.s b/src/growup.s index 0b284ce..6e78e52 100755 --- a/src/growup.s +++ b/src/growup.s @@ -1291,6 +1291,10 @@ GlobalSpriteSpeed: GlobalRiderSize: .float 1.0 +.global GlobalStarsCollected +GlobalStarsCollected: + .int 0 + .global SizerOn SizerOn: .byte 0 diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index b5447e9..f57e14a 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -26,8 +26,8 @@ struct EventTable_t { extern EventTable_t *EventTable; -// extern u16 TimeStopFlag; -// extern u32 TimerBranch; +extern u16 TimeStopFlag; +extern u32 TimerBranch; extern u32 AlwaysDrawFlag; extern u32 AlwaysDrawBranch; @@ -62,7 +62,7 @@ fBase_c *FindActorByID(u32 id); bool ResetAfterLevel(void) { // TimeStopFlag = 0; - // TimerBranch = 0x3403FFA4; + TimerBranch = 0x3403FFA4; MarioDescentRate = -4; MarioJumpMax = 3.628; MarioJumpArc = 2.5; @@ -120,9 +120,9 @@ void LevelSpecial_Update(LevelSpecial *self) { // TimeStopFlag = self->effect * 0x100; // break; - // case 2: // Stop Timer - // TimerBranch = 0x7C601B78; - // break; + case 2: // Stop Timer + TimerBranch = 0x7C601B78; + break; case 3: // Mario Gravity @@ -262,9 +262,9 @@ void LevelSpecial_Update(LevelSpecial *self) { // TimeStopFlag = 0; // break; - // case 2: // Stop Timer - // TimerBranch = 0x3403FFA4; - // break; + case 2: // Stop Timer + TimerBranch = 0x3403FFA4; + break; case 3: // Mario Gravity diff --git a/src/makeYourOwnModelSprite.cpp b/src/makeYourOwnModelSprite.cpp new file mode 100644 index 0000000..d607f78 --- /dev/null +++ b/src/makeYourOwnModelSprite.cpp @@ -0,0 +1,300 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> + + +////////////////////////////////////////////////////////// +// +// How it works: +// +// 1) Skip down to line 70 - read the comments along the way if you like +// 2) Change the stuff inside " " to be what you want. +// 3) Copy paste an entire 'case' section of code, and change the number to change the setting it uses +// 4) give it back to Tempus to compile in +// + + + +// This is the class allocator, you don't need to touch this +class dMakeYourOwn : public dStageActor_c { + // Let's give ourselves a few functions + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + static dMakeYourOwn *build(); + + // And a model and an anmChr + mHeapAllocator_c allocator; + m3d::mdl_c bodyModel; + nw4r::g3d::ResFile resFile; + m3d::anmChr_c chrAnimation; + + nw4r::g3d::ResMdl mdl; + + // Some variables to use + int model; + char isAnimating; + float size; + + void setupAnim(const char* name, float rate); + void setupModel(const char* arcName, const char* brresName, const char* mdlName); +}; + +// This sets up how much space we have in memory +dMakeYourOwn *dMakeYourOwn::build() { + void *buffer = AllocFromGameHeap1(sizeof(dMakeYourOwn)); + return new(buffer) dMakeYourOwn; +} + + +// Saves space when we do it like this +void dMakeYourOwn::setupAnim(const char* name, float rate) { + if (isAnimating) { + nw4r::g3d::ResAnmChr anmChr; + + anmChr = this->resFile.GetResAnmChr(name); + this->chrAnimation.setup(this->mdl, anmChr, &this->allocator, 0); + this->chrAnimation.bind(&this->bodyModel, anmChr, 1); + this->bodyModel.bindAnim(&this->chrAnimation, 0.0); + this->chrAnimation.setUpdateRate(rate); + } +} + +void dMakeYourOwn::setupModel(const char* arcName, const char* brresName, const char* mdlName) { + this->resFile.data = getResource(arcName, brresName); + this->mdl = this->resFile.GetResMdl(mdlName); + + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); +} + + +// This gets run when the sprite spawns! +int dMakeYourOwn::onCreate() { + + // Settings for your sprite! + + this->model = this->settings & 0xFF; // Sets nubble 12 to choose the model you want + this->isAnimating = this->settings & 0x100; // Sets nybble 11 to a checkbox for whether or not the model has an anmChr to use + this->size = (float)((this->settings >> 24) & 0xFF) / 4.0; // Sets nybbles 5-6 to size. Size equals value / 4. + + // Setup the models inside an allocator + allocator.link(-1, GameHeaps[0], 0, 0x20); + + + // Makes the code shorter and clearer to put these up here + + // A switch case, add extra models in here + switch (this->model) { + + // COPY FROM BELOW HERE + + case 0: // If nyb 12 is 0, it'll load this model + + setupModel("arrow", "g3d/bre0.brres", "ballon_red"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = -3300.0; + + setupAnim("anim00", 1.0); // AnmChr name, animation speed + + break; // ends the case + + // TO HERE + // That is a 'block' of case code, which will run depending on your sprite setting + + case 1: // If nyb 12 is 1, it'll load this model. Add more cases for each model you'd like! + + setupModel("arrow", "g3d/bre1.brres", "ballon_green"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim01", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 2: // If nyb 12 is 2, it'll load this model + + setupModel("arrow", "g3d/bre2.brres", "mario_ts"); // arc name (no .arc), brres name, model name + SetupTextures_Player(&bodyModel, 0); + this->pos.z = -3000.0; + + setupAnim("anim02", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 3: // If nyb 12 is 0, it'll load this model + + setupModel("arrow", "g3d/bre3.brres", "peach_ts"); // arc name (no .arc), brres name, model name + SetupTextures_Enemy(&bodyModel, 0); + this->pos.z = -3000.0; + + setupAnim("anim03", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 4: // If nyb 12 is 0, it'll load this model + + setupModel("arrow", "g3d/bre4.brres", "luigi_ts"); // arc name (no .arc), brres name, model name + SetupTextures_Player(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim04", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 5: // If nyb 12 is 0, it'll load this model + + setupModel("arrow", "g3d/bre5.brres", "toady_ts"); // arc name (no .arc), brres name, model name + SetupTextures_Player(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim05", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 6: // If nyb 12 is 0, it'll load this model + + setupModel("arrow", "g3d/bre6.brres", "toadb_ts"); // arc name (no .arc), brres name, model name + SetupTextures_Player(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim06", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 7: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre7.brres", "clowncar_mario"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim07", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 8: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre8.brres", "clowncar_luigi"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim08", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 9: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre9.brres", "clowncar_toady"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim09", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 10: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre10.brres", "clowncar_toadb"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim10", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 11: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre11.brres", "clowncar_peach"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3300.0; + + setupAnim("anim11", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 12: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre12.brres", "mario_end"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim12", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 13: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre13.brres", "luigi_end"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim13", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 14: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre14.brres", "toady_end"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim14", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 15: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre15.brres", "toadb_end"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim15", 1.0); // AnmChr name, animation speed + break; // ends the case + + case 16: // If nyb 12 is 0, it'll load this model + + setupModel("block_arrow", "g3d/bre16.brres", "peach_end"); // arc name (no .arc), brres name, model name + SetupTextures_MapObj(&bodyModel, 0); + this->pos.z = 3000.0; + + setupAnim("anim16", 1.0); // AnmChr name, animation speed + break; // ends the case + + // COPY the entire case here, and then change the number + // + //case 2: + //case 3: + //etc, etc... + } + + allocator.unlink(); + + if (size == 0.0) { // If the person has the size nybble at zero, make it normal sized + this->scale = (Vec){1.0,1.0,1.0}; + } + else { // Else, use our size + this->scale = (Vec){size,size,size}; + } + + this->onExecute(); + return true; +} + + +// YOU'RE DONE, no need to do anything below here. + + +int dMakeYourOwn::onDelete() { + return true; +} + +int dMakeYourOwn::onExecute() { + if (isAnimating) { + bodyModel._vf1C(); // Advances the animation one update + + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); // Resets the animation when it's done + } + } + + return true; +} + +int dMakeYourOwn::onDraw() { + matrix.translation(pos.x, pos.y, pos.z - 6500.0); // Set where to draw the model : -5500.0 is the official behind layer 2, while 5500.0 is in front of layer 0. + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); // Set how to rotate the drawn model + + bodyModel.setDrawMatrix(matrix); // Apply matrix + bodyModel.setScale(&scale); // Apply scale + bodyModel.calcWorld(false); // Do some shit + + bodyModel.scheduleForDrawing(); // Add it to the draw list for the game + return true; +} |