From 84825d9314ddffccd65c387604ed51f529fa5cab Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 9 Apr 2013 22:29:27 +0200 Subject: credits sequence final fixes --- creditsMgr.yaml | 17 ++++++++++++++++- src/creditsMgr.S | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/creditsMgr.cpp | 20 ++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/creditsMgr.yaml b/creditsMgr.yaml index 6dfccea..c1c44c7 100644 --- a/creditsMgr.yaml +++ b/creditsMgr.yaml @@ -58,4 +58,19 @@ hooks: type: branch_insn branch_type: b src_addr_pal: 0x8007A694 - target_func: 'AutoScrollInjector' \ No newline at end of file + target_func: 'AutoScrollInjector' + - name: PlayerRotInjector + type: branch_insn + branch_type: bl + src_addr_pal: 0x8014572C + target_func: 'PlayerRotInjector' + - name: PlayerRotInjector2 + type: branch_insn + branch_type: bl + src_addr_pal: 0x80150D38 + target_func: 'PlayerRotInjector2' + - name: PlayerRotInjector3 + type: branch_insn + branch_type: bl + src_addr_pal: 0x80145A90 + target_func: 'PlayerRotInjector3' diff --git a/src/creditsMgr.S b/src/creditsMgr.S index cf5e809..fc675cb 100644 --- a/src/creditsMgr.S +++ b/src/creditsMgr.S @@ -51,10 +51,64 @@ AutoScrollInjector: blr +.global PlayerRotInjector +PlayerRotInjector: + lis r9, isLockPlayerRotation@h + ori r9, r9, isLockPlayerRotation@l + lbz r9, 0(r9) + cmpwi r9, 1 + bne dontOverridePlayerRot + lis r9, lockedPlayerRotation@h + ori r9, r9, lockedPlayerRotation@l + lha r7, 0(r9) +dontOverridePlayerRot: + sth r7, 0xA(r1) + blr + +.global PlayerRotInjector2 +PlayerRotInjector2: + lis r9, isLockPlayerRotation@h + ori r9, r9, isLockPlayerRotation@l + lbz r9, 0(r9) + cmpwi r9, 1 + bne dontOverridePlayerRot2 + lis r9, lockedPlayerRotation@h + ori r9, r9, lockedPlayerRotation@l + lha r0, 0(r9) +dontOverridePlayerRot2: + sth r0, 0xA(r1) + blr + +.global PlayerRotInjector3 +PlayerRotInjector3: + lis r9, isLockPlayerRotation@h + ori r9, r9, isLockPlayerRotation@l + lbz r9, 0(r9) + cmpwi r9, 1 + bne dontOverridePlayerRot3 + lis r9, lockedPlayerRotation@h + ori r9, r9, lockedPlayerRotation@l + lha r0, 0(r9) +dontOverridePlayerRot3: + sth r0, 0x12(r1) + blr + +# FOR SOME FUN + # li r0, 0x6000 + # sth r0, 0x12(r1) + # li r0, 0x4000 + # sth r0, 0x10(r1) + # li r0, 0x8000 + # sth r0, 0x14(r1) + .data .global CameraLockEnabled +.global isLockPlayerRotation .global CameraLockPosition +.global lockedPlayerRotation CameraLockEnabled: .byte 0 +isLockPlayerRotation: .byte 0 +lockedPlayerRotation: .short 0 .align 4 CameraLockPosition: .float 0.0, 0.0 \ No newline at end of file diff --git a/src/creditsMgr.cpp b/src/creditsMgr.cpp index e4dafda..0d7b5e7 100644 --- a/src/creditsMgr.cpp +++ b/src/creditsMgr.cpp @@ -27,6 +27,9 @@ void EGG__Heap__free(void *ptr, void *heap); extern char CameraLockEnabled; extern VEC2 CameraLockPosition; +extern char isLockPlayerRotation; +extern s16 lockedPlayerRotation; + mTexture_c efbTexture; bool getNextEFB = false; int thing = 0; @@ -164,6 +167,8 @@ int dCreditsMgr_c::onCreate() { } int dCreditsMgr_c::onDelete() { + isLockPlayerRotation = false; + scriptLoader.unload(); return layout.free() && titleLayout.free(); } @@ -214,6 +219,9 @@ int dCreditsMgr_c::onExecute() { VEC3 efPos = {10208.0f + xOffs, -304.0f - yOffs, pos.z + 200.0f}; SpawnEffect(fw[fwID], 0, &efPos, 0, 0); + + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_GOAL_FIREWORKS, 1); } } @@ -461,6 +469,18 @@ void dCreditsMgr_c::doAutoscroll(int pathID) { fauxScrollY = -firstNode->yPos; CameraLockEnabled = 1; + + // set directions + isLockPlayerRotation = true; + lockedPlayerRotation = endingMode ? 0 : 0x3000; + + for (int i = 0; i < 4; i++) { + dAcPy_c *player; + if ((player = dAcPy_c::findByID(i))) { + player->direction = 0; + player->rot.y = 0x3000; + } + } } void dCreditsMgr_c::animComplete() { -- cgit v1.2.3