fork/training-mode-ce
git clone https://git.julia.blue/fork/training-mode-ce
2c08d3a
techchase-camera
1# To be inserted at 800C9A44 2.include "../../Globals.s" 3.include "../Header.s" 4 5.set REG_PlayerData , 31 6.set REG_Floats , 30 7.set REG_InputIndex , 29 8.set REG_PrevInput , 28 9 10NTSC102 : 11.set Injection , 0x800C9A44 12.set OFST_PlCo , -0x514C 13.set InputIndex , 0x804c1f78 14.set InputArray , 0x8046b108 15.set PlayerBlock_LoadPlayerGObj , 0x8003418c 16 17# Original codeline 18stfs f0 , 0x2C ( REG_PlayerData ) # Entry point, store new facing direction 19 20# Init 21backup 22bl Floats 23mflr REG_Floats 24 25CHECK_IF_SLOW_TURN : 26lfs f1 , 0x894 ( REG_PlayerData ) # Check if 2nd frame of turn 27lfs f2 , OFST_SlowTurnFrame ( REG_Floats ) # 2fp 28fcmpo cr0 , f1 , f2 29bne Injection_Exit 30 31CHECK_SMASH_TURN_INPUT_CONDITIONS : 32lwz r4 , OFST_PlCo ( r13 ) 33lfs f1 , 0x0620 ( REG_PlayerData ) 34fabs f1 , f1 35lfs f2 , 0x3C ( r4 ) # PlCo constant 0.8 36fcmpo cr0 , f1 , f2 # Load control stick x-inputs and compare to 0.8 37blt Injection_Exit 38# Check that cardinal direction not held 2+ frames 39lbz r3 , 0x0670 ( REG_PlayerData ) 40cmpwi r3 , 2 41bge - Injection_Exit # Skip if no dash input 42 43SKIP_IF_NANA : 44lbz r3 , 0x221f ( REG_PlayerData ) # load flags 45rlwinm. r0 , r3 , 0 , 28 , 28 # (08) = secondary character 46bne Injection_Exit 47 48BEGIN_HW_INPUTS : 49LOAD_2_FRAMES_PAST_INPUTS : 50lbz REG_PrevInput , MEX_UCF2fX ( REG_PlayerData ) 51extsb REG_PrevInput , REG_PrevInput 52 53LOAD_CURRENT_FRAME_INPUT : 54lbz r3 , MEX_UCFCurrX ( REG_PlayerData ) 55extsb r3 , r3 56 57CALCULATE_DIFFERENCE : 58sub r3 , REG_PrevInput , r3 59mullw r3 , r3 , r3 # Take square to get positive value for comparison 60 61THRESHOLD_TEST : 62cmpwi r3 , 3600 # compare square of input difference between current frame and 2 frames ago to square of 60(formerly 75 because different units) 63ble - Injection_Exit 64 65CHANGE_TO_SMASH_TURN : 66li r0 , 1 67stw r0 , 0x2358 ( REG_PlayerData ) 68stw r0 , 0x2340 ( REG_PlayerData ) # Change smash turn and can dash flags 69# Check if Popo 70lwz r4 , 0x4 ( REG_PlayerData ) # Load character id 71cmpwi r4 , 0xA # Check if Popo 72bne + Injection_Exit # Skip if not Popo 73# Get Nana's Block From Popo's in r4 74lbz r3 , 0xC ( REG_PlayerData ) # P1 Slot 75li r4 , 0x1 # Subchar Bool 76branchl r12 , PlayerBlock_LoadPlayerGObj 77cmpwi r3 , 0x0 78beq Injection_Exit 79lwz r4 , 0x2C ( r3 ) 80# Adjust Nana's inputs 81lwz r4 , 0x1ECC ( r4 ) # Load address where popos inputs were last stored 82lfs f1 , 0x2C ( REG_PlayerData ) # get popos facing direction 83stfs f1 , 0x18 ( r4 ) # Store popos direction for nana 84# Check which direction popo turned 85lfs f2 , OFST_ZeroFP ( REG_Floats ) # 0fp 86fcmpo cr0 , f1 , f2 87bgt - POPO_TURNED_RIGHT 88li r3 , 0x80 # leftward 1.0 89b StoreNanaDirection 90 91POPO_TURNED_RIGHT : 92li r3 , 0x7f # rightward 1.0 93 94StoreNanaDirection : 95stb r3 , 0x6 ( r4 ) # Store rightward 1.0 input for Nana 96b Injection_Exit 97 98Floats : 99.set OFST_SlowTurnFrame , 0x0 100.set OFST_ZeroFP , 0x4 101blrl 102.float 2 103.float 0 104.align 2 105 106################### 107 108Injection_Exit : 109restore