diff options
-rw-r--r-- | NewerProjectKP.yaml | 2 | ||||
-rw-r--r-- | classic_controller.yaml | 27 | ||||
-rwxr-xr-x | include/game.h | 4 | ||||
-rw-r--r-- | src/bossRamboo.cpp | 1 | ||||
-rw-r--r-- | src/bossSamurshai.cpp | 4 | ||||
-rw-r--r-- | src/classic_controller.S | 175 | ||||
-rwxr-xr-x | src/mrsun.cpp | 9 | ||||
-rw-r--r-- | src/prolog.S | 2 | ||||
-rw-r--r-- | src/soundPlayer.S | 1 | ||||
-rw-r--r-- | src/topman.cpp | 14 |
10 files changed, 150 insertions, 89 deletions
diff --git a/NewerProjectKP.yaml b/NewerProjectKP.yaml index 9941b7f..57cc063 100644 --- a/NewerProjectKP.yaml +++ b/NewerProjectKP.yaml @@ -43,7 +43,7 @@ modules: - processed/compression.yaml # - processed/crowdclapper.yaml - processed/blocksnake.yaml -# - processed/classic_controller.yaml + - processed/classic_controller.yaml - processed/topman.yaml - processed/bossMegaGoomba.yaml - processed/bossFuzzyBear.yaml diff --git a/classic_controller.yaml b/classic_controller.yaml index a98cafc..d9e55de 100644 --- a/classic_controller.yaml +++ b/classic_controller.yaml @@ -5,38 +5,25 @@ hooks: type: branch_insn branch_type: b src_addr_pal: 0x801eb6f8 - src_addr_ntsc: 0x801eb5b8 target_func: '_switch_buttons' - - name: Patch1 - type: patch - addr_pal: 0x801EAF70 - addr_ntsc: 0x801EAE30 - data: '39800000 91840000' + - name: WiimoteWaggleAdjust + type: branch_insn + branch_type: b + src_addr_pal: 0x801EAF74 + target_func: 'waggleAdjust' - name: PatchExtensionScall type: patch addr_pal: 0x80019EE0 - addr_ntsc: 0x80019EE0 data: '38000000' - - name: Patch3 # DISABLE WARNING MANAGER BLOCK + - name: DisableWarningMgrOne type: patch addr_pal: 0x800B3B30 - addr_ntsc: 0x800B3B30 data: '38000000' - - name: Patch4 # USELESS - type: patch - addr_pal: 0x8076DB68 - addr_ntsc: 0x8076DBA8 - data: '38000004' - - - name: Patch5 # DISABLE WARNING MANAGER BLOCK + - name: DisableWarningMgrTwo type: patch addr_pal: 0x8076DBa8 - addr_ntsc: 0x8076DBE8 data: '38000000' - -# crediar's warningMgr patch -# *(vu32*)(0x00DD1C0) = 0x4E800020;
\ No newline at end of file diff --git a/include/game.h b/include/game.h index d72e349..9e9d860 100755 --- a/include/game.h +++ b/include/game.h @@ -3789,7 +3789,6 @@ struct IceActorSpawnInfo { extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(dEn_c *, Vec pos);
extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int, unsigned int);
-extern "C" void *PlaySound(dStageActor_c *, int soundID);
extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
extern "C" u32 GetActivePlayerCount();
@@ -3833,7 +3832,7 @@ namespace nw4r { void SetPitch(float value) { SetPitch__Q44nw4r3snd6detail10BasicSoundFf(data, value); }
void Pause(bool pause, int count) { Pause__Q44nw4r3snd6detail10BasicSoundFbi(data, pause, count); }
- void SetVolume(float value, int count) { SetVolume__Q44nw4r3snd6detail10BasicSoundFfi(data, pause, count); }
+ void SetVolume(float value, int count) { SetVolume__Q44nw4r3snd6detail10BasicSoundFfi(data, value, count); }
void *GetSound() const { return data; }
@@ -3847,6 +3846,7 @@ namespace nw4r { }
}
+extern "C" nw4r::snd::SoundHandle *PlaySound(dStageActor_c *, int soundID);
extern float EnemyBounceValue;
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index 3bc19d7..59e6d0c 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -205,6 +205,7 @@ int daRamboo_c::onCreate() { this->speed.x = 0.0; this->ytimer = 0; + this->pos.z = 3300.0; char eventNum = (this->settings >> 16) & 0xFF; diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp index 12adfeb..ba871cd 100644 --- a/src/bossSamurshai.cpp +++ b/src/bossSamurshai.cpp @@ -264,7 +264,7 @@ daSamurshai *daSamurshai::build() { if (collMgr.isOnTopOfTile()) { isBouncing = true; } - pos.x = direction ? pos.x + speed.x : pos.x - speed.x; + pos.x += direction ? 2.0 : -2.0; return true; } return false; @@ -339,7 +339,7 @@ int daSamurshai::onCreate() { _324 = 18.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const lineSensor_s below(-0<<12, 0<<12, 0<<12); static const pointSensor_s above(0<<12, 12<<12); static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); diff --git a/src/classic_controller.S b/src/classic_controller.S index 6084c05..a1af772 100644 --- a/src/classic_controller.S +++ b/src/classic_controller.S @@ -24,17 +24,17 @@ #define WPAD_CLASSIC_BUTTON_UP 0x0001 #define WPAD_CLASSIC_BUTTON_LEFT 0x0002 -#define WPAD_CLASSIC_BUTTON_ZR 0x0004 +#define WPAD_CLASSIC_BUTTON_R 0x0004 #define WPAD_CLASSIC_BUTTON_X 0x0008 #define WPAD_CLASSIC_BUTTON_A 0x0010 #define WPAD_CLASSIC_BUTTON_Y 0x0020 #define WPAD_CLASSIC_BUTTON_B 0x0040 -#define WPAD_CLASSIC_BUTTON_ZL 0x0080 -#define WPAD_CLASSIC_BUTTON_FULL_R 0x0200 +#define WPAD_CLASSIC_BUTTON_L 0x0080 +#define WPAD_CLASSIC_BUTTON_ZR 0x0200 #define WPAD_CLASSIC_BUTTON_PLUS 0x0400 #define WPAD_CLASSIC_BUTTON_HOME 0x0800 #define WPAD_CLASSIC_BUTTON_MINUS 0x1000 -#define WPAD_CLASSIC_BUTTON_FULL_L 0x2000 +#define WPAD_CLASSIC_BUTTON_ZL 0x2000 #define WPAD_CLASSIC_BUTTON_DOWN 0x4000 #define WPAD_CLASSIC_BUTTON_RIGHT 0x8000 @@ -51,9 +51,30 @@ .text .align 4 -;TODO - check that classic controller is attached -;TODO - add tilt to right analog -;TODO - add R/L to be full tilt + + + + +.global waggleAdjust +waggleAdjust: + + lbz r5, 0x5C(r3) # wiimote extension type + cmpwi r5, 2 # classic controller + + beq ClassicControllerWaggle + + stfs f0, 0(r4) + blr + +ClassicControllerWaggle: + + li r12, 0 + stw r12, 0(r4) + blr + + + + .global _switch_buttons _switch_buttons: addi r1,r1,0x50 # replaced instruction @@ -71,8 +92,38 @@ _switch_buttons: lbz r5,0x5C(r26) # wiimote extension type cmpwi r5, 2 # classic controller - beq cleanup + bne cleanup + + lwz r5, 0x60(r26) +Tilt: + + lwz r5, 0x80(r26) + cmpwi r5, 0 + beq TiltLeftSkip + + lfs f11, 0x80(r26) + + lis r5, 0 + stw r5, 0x80(r26) + lfs f10, 0x80(r26) + + fsubs f11, f10, f11 + + stfs f11, 0x58(r26) + li r5, 0 + stw r5, 0x54(r26) + +TiltLeftSkip: + + lwz r5, 0x7C(r26) + cmpwi r5, 0 + beq TiltRightSkip + stw r5, 0x58(r26) + li r5, 0 + stw r5, 0x54(r26) + +TiltRightSkip: lwz r5,0x60(r26) # wiimote cc data ; KPADInsideStatus->KPADEXStatus_bl->hold bl map_buttons lwz r4,0(r26) # wiimote ; KPADInsideStatus->hold @@ -102,56 +153,58 @@ cleanup: addi r1,r1,stackSize blr -; r5 == CC data -; r5 returns the wpad data +# r5 == CC data +# r5 returns the wpad data + + map_buttons: - andi. r4,r5,0x10 // WPAD_CLASSIC_BUTTON_A - cmpwi r4,0 - beq- skip_waggle - lis r6,0x7fc0 // float - stw r6,0x10(r26) // set waggle ; KPADInsideStatus->acc->y -skip_waggle: li r6,0 + andi. r4,r5,0x10 // WPAD_CLASSIC_BUTTON_A + beq- skip_A + ori r6,r6,0x100 // WPAD_BUTTON_2 +skip_A: andi. r4,r5,0x800 // WPAD_CLASSIC_BUTTON_HOME beq- skip_home ori r6,r6,0x8000 // WPAD_BUTTON_HOME skip_home: andi. r4,r5,0x20 // WPAD_CLASSIC_BUTTON_Y - beq- skip_run_one - ori r6,r6,0x200 // WPAD_BUTTON_1 -skip_run_one: + beq- skip_Y + ori r6,r6,0x800 // WPAD_BUTTON_A +skip_Y: andi. r4,r5,0x8 // WPAD_CLASSIC_BUTTON_X - beq- skip_run_two - ori r6,r6,0x200 // WPAD_BUTTON_1 -skip_run_two: + beq- skip_X + lis r6,0x7fc0 // float + stw r6,0x10(r26) // set waggle ; KPADInsideStatus->acc->y +skip_X: andi. r4,r5,0x40 // WPAD_CLASSIC_BUTTON_B - beq- skip_jump - ori r6,r6,0x100 // WPAD_BUTTON_2 -skip_jump: + beq- skip_B + ori r6,r6,0x200 // WPAD_BUTTON_1 +skip_B: andi. r4,r5,0x80 // WPAD_CLASSIC_BUTTON_ZL - beq- skip_bubble1 - ori r6,r6,0x8 // WPAD_BUTTON_A -skip_bubble1: + beq- skip_ZL + ori r6,r6,0x200 // WPAD_BUTTON_1 +skip_ZL: andi. r4,r5,0x4 // WPAD_CLASSIC_BUTTON_ZR - beq- skip_bubble2 - ori r6,r6,0x8 // WPAD_BUTTON_A -skip_bubble2: + beq- skip_ZR + lis r6,0x7fc0 // float + stw r6,0x10(r26) // set waggle ; KPADInsideStatus->acc->y +skip_ZR: andi. r4,r5,1 // WPAD_CLASSIC_BUTTON_UP - beq- skip_right + beq- skip_up ori r6,r6,2 // WPAD_BUTTON_RIGHT -skip_right: +skip_up: andi. r4,r5,2 // WPAD_CLASSIC_BUTTON_LEFT - beq- skip_up + beq- skip_left ori r6,r6,8 // WPAD_BUTTON_UP -skip_up: +skip_left: andi. r4,r5,0x8000 // WPAD_CLASSIC_BUTTON_RIGHT - beq- skip_down + beq- skip_right ori r6,r6,4 // WPAD_BUTTON_DOWN -skip_down: +skip_right: andi. r4,r5,0x4000 // WPAD_CLASSIC_BUTTON_DOWN - beq- skip_left + beq- skip_down ori r6,r6,1 // WPAD_BUTTON_LEFT -skip_left: +skip_down: andi. r4,r5,0x400 // WPAD_CLASSIC_BUTTON_PLUS beq- skip_plus ori r6,r6,0x10 // WPAD_BUTTON_PLUS @@ -162,33 +215,41 @@ skip_plus: skip_minus: lfs f8,0x6c(r26) // left analog x ; KPADInsideStatus->KPADEXStatus_cl->lstick lfs f9,0x70(r26) // left analog y ; KPADInsideStatus->KPADEXStatus_cl->rstick + lis r5,float_one@ha lfs f10,float_one@l(r5) + + lis r5,float_neg_one@ha lfs f11,float_neg_one@l(r5) -; fcmpu cr0,f8,f10 -; bne skip_right_analog -; ori r6,r6,4 // WPAD_BUTTON_DOWN -;skip_right_analog: -; fcmpu cr0,f9,f10 -; bne skip_right_analog -; ori r6,r6,2 // WPAD_BUTTON_RIGHT -;skip_up_analog: -; fcmpu cr0,f9,f11 -; bne skip_right_analog -; ori r6,r6,1 // WPAD_BUTTON_LEFT -;skip_down_analog: -; fcmpu cr0,f8,f11 -; bne skip_right_analog -; ori r6,r6,8 // WPAD_BUTTON_UP -;skip_left_analog: + + fcmpu cr0,f8,f10 // WPAD_R_ANALOG_RIGHT + blt skip_right_analog + ori r6,r6,4 // WPAD_BUTTON_DOWN +skip_right_analog: + fcmpu cr0,f9,f10 // WPAD_R_ANALOG_UP + blt skip_up_analog + ori r6,r6,2 // WPAD_BUTTON_RIGHT +skip_up_analog: + fcmpu cr0,f8,f11 // WPAD_R_ANALOG_LEFT + bge skip_down_analog + ori r6,r6,8 // WPAD_BUTTON_UP +skip_down_analog: + fcmpu cr0,f9,f11 // WPAD_R_ANALOG_DOWN + bge skip_left_analog + ori r6,r6,1 // WPAD_BUTTON_LEFT +skip_left_analog: mr r5,r6 blr + + + + .data float_one: -.float 1.0 +.float 0.5 float_neg_one: -.float -1.0 +.float -0.5 float_zero: .float 0.0 diff --git a/src/mrsun.cpp b/src/mrsun.cpp index 1cdfdc9..fa9c96a 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -53,6 +53,7 @@ class daMrSun_c : public dEn_c { void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); + bool collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); @@ -110,7 +111,7 @@ bool daMrSun_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics return true; } bool daMrSun_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { - this->timer = 0; + this->timer = 0; PlaySound(this, SE_EMY_DOWN); doStateChange(&StateID_DieFall); return true; @@ -137,6 +138,10 @@ bool daMrSun_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics DamagePlayer(this, apThis, apOther); return true; } +bool daMrSun_c::collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther) { + DamagePlayer(this, apThis, apOther); + return true; +} void daMrSun_c::dieFall_Execute() { @@ -261,7 +266,7 @@ int daMrSun_c::onCreate() { doStateChange(&StateID_Follow); - this->onExecute(); + // this->onExecute(); return true; } diff --git a/src/prolog.S b/src/prolog.S index 7d7e40b..ffeaf92 100644 --- a/src/prolog.S +++ b/src/prolog.S @@ -61,7 +61,7 @@ startLoop: .data PMsg: - .string "Newer Super Mario Bros. Wii - Hacks by Treeki and Tempus 2009-2013\nNewer Release Candidate 05 - v1012\n.ctors: %p - %p\n" + .string "Newer Super Mario Bros. Wii - Hacks by Treeki and Tempus 2009-2013\nNewer Release Candidate 08 - v1012\n.ctors: %p - %p\n" PMsg2: .string "%d inits called\n" diff --git a/src/soundPlayer.S b/src/soundPlayer.S index 1cf7cbd..8fbfd7b 100644 --- a/src/soundPlayer.S +++ b/src/soundPlayer.S @@ -59,6 +59,7 @@ PlaySound: # Go away if it is cmpwi r3, 0 + li r3, 0 bne GoAwaySoundGuy # If we're good to go, play the sound! diff --git a/src/topman.cpp b/src/topman.cpp index 55123f8..5d98761 100644 --- a/src/topman.cpp +++ b/src/topman.cpp @@ -433,8 +433,11 @@ void daTopman::updateModelMatrices() { } void daTopman::executeState_Walk() { - if (!this->isOutOfView()) - PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); // 5 + if (!this->isOutOfView()) { + nw4r::snd::SoundHandle *handle = PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); + if (handle) + handle->SetVolume(0.5f, 0); + } bool ret = calculateTileCollisions(); if (ret) { @@ -486,8 +489,11 @@ void daTopman::updateModelMatrices() { } void daTopman::executeState_Wait() { - if (!this->isOutOfView()) - PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); // 5 + if (!this->isOutOfView()) { + nw4r::snd::SoundHandle *handle = PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); + if (handle) + handle->SetVolume(0.5f, 0); + } bool ret = calculateTileCollisions(); if (ret) { |