Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hook:8072E8A8
- stwu r1,-128(r1)
- stmw r2,8(r1) #creates a stack frame so I can freely use all registers
- lis r11,0x8000 #loads 0x80000000 into r11
- lwz r5,136(r3) #phantom wings stuff
- stfs f1,4(r4) #?????
- lis r6,0x901C
- ori r6,r6,0x4900 #loads address of XYWW floats into r6
- lfs f17,4(r4) #loads float coordinate of current player's Y position into f17
- lfs f18,0x14(r6) #loads float coordinate of stage's top wrap point into f18
- lfs f19,0x18(r6) #loads float coordinate of stage's bottom wrap point into f19
- lwz r17,4(r4) #loads float coordinate of current player's Y position into r17
- lwz r18,0x14(r6) #loads float coordinate of stage's top wrap point into r18
- lwz r19,0x18(r6) #loads float coordinate of stage's bottom wrap point into r19
- lfs f20,0(r4) #loads float coordinate of current player's X position into f20
- lfs f21,0x0C(r6) #loads float coordinate of stage's left wrap point into f21
- lfs f22,0x10(r6) #loads float coordinate of stage's right wrap point into f22
- lwz r20,0(r4) #loads float coordinate of current player's X position into r20
- lwz r21,0x0C(r6) #loads float coordinate of stage's left wrap point into r21
- lwz r22,0x10(r6) #loads float coordinate of stage's right wrap point into r22
- subis r29,r19,1
- cmplw r17,r29
- beq etcd #branches to end temp collision disable if current player has wrapped from stage's top wrap point to stage's bottom wrap point
- subis r29,r18,1
- cmplw r17,r29
- beq etcd #branches to end temp collision disable if current player has wrapped from stage's bottom wrap point to stage's top wrap point
- subis r29,r22,1
- cmplw r20,r29
- beq etcd #branches to end temp collision disable if current player has wrapped from stage's left wrap point to stage's right wrap point
- subis r29,r21,1
- cmplw r20,r29
- bne detcd #branches to don't end temp collision disable if current player has not wrapped from stage's right wrap point to stage's LWP
- etcd:addi r30,r6,0x28 #adds 0x28 to XYWW floats address in r6 to store TSCD AD flags address in r30
- lbz r24,8(r6) #loads player number ID from stamina flags area into r24
- stbx r15,r30,r24 #clears current player's TSCD currently wrapping flag (AD)
- detcd:li r7,7
- li r8,0
- lbz r9,188(r3)
- cmpwi r9,7
- bne- 0x0C
- li r9,5
- stb r9,188(r3) #phantom wings stuff (part of the original x world wrap code, I don't know what it does)
- cmpwi r30,8
- bne end #branches to end if r30 isn't 8 (prevents crash)
- lwz r12,0x1C(r31) #(1)
- cmplw r12,r11
- blt end #sanity check, branches to end if r12 is not a valid address
- lwz r12,0x28(r12) #(2)
- cmplw r12,r11
- blt end #sanity check, branches to end if r12 is not a valid address
- lwz r27,0x10(r12)
- lbz r24,0x55(r27) #(1 2) loads player number ID into r24
- lwz r28,0x10(r27) #loads value that can identify what is wrapping into r28?
- cmplwi r28,0xFFFF
- bgt end #branches to end if value in r28 is greater than 0xFFFF to prevent items from wrapping
- lwz r26,-0xB4(r27) #loads current player damage integer into r26
- lis r11,0x9018
- ori r11,r11,0x0C1C #loads player 1 stamina address into r11
- mulli r25,r24,0x5C #multiplies PNID by mem2 per player data offset and stores result in r25
- lhzx r25,r11,r25 #loads current player stamina into r25 from player 1 stamina address + offset to current player mem2 player data
- cmpw r26,r25
- bge end #branches to end disallowing wrapping if current player's damage taken is >= to current player's max stamina
- addi r11,r6,0x24 #loads stamina dead flags address into r11
- lbzx r25,r11,r24 #loads current player stamina dead flag byte into r25 from stamina dead flags address + PNID
- cmpwi r25,0x1D
- beq end #branches to end if current player's stamina dead flag is set (appears to be redundant with above branch)
- lwz r12,0x7C(r31)
- lhz r11,0x06(r12) #loads current player previous action into r11
- lhz r12,0x3A(r12) #loads cureent player action into r12
- cmpwi r12,0xBC
- beq end #branches to end if current action is drowning (if allowed you would drown forever)
- cmpwi r12,0xBE
- beq end #branches to end if current action is respawn (if allowed you take wrap damage on respawn)
- cmpwi r12,0xC6
- beq end #branches to end if current action is eaten by summit fish (if allowed you're trapped in the fish)
- cmpwi r12,0xF1
- beq end #branches to end if current action is Kirby/MK uthrow (if allowed you take wrap damage and jump up through the stage)
- cmpwi r11,0x116
- beq end #branches to end if current action is final smash (some final smashes crash when wrapping)
- lwz r11,0x64(r31)
- lwz r11,-0xC(r11)
- lbz r11,0x3F(r11) #loads current player is grabbed/being thrown flag into r11
- cmpwi r11,1
- beq end #branches to end if current player is grabbed/thrown (prevents ganondorf/kirby/DDDK cheese)
- fcmpo cr0,f17,f18
- blt bwpc #branches to bottom wrap point check if current player's Y coordinate is less than the stage's top wrap point
- li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
- subis r17,r19,1 #sets current player Y coordinate to bottom wrap point -0x10000 (adds about .5-1 in float)
- bwpc:fcmpo cr0,f17,f19
- bgt lwpc #branches to left wrap point check if current player's Y coordinate is greater than the stage's bottom wrap point
- li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
- subis r17,r18,1 #sets current player Y coordinate to top wrap point -0x10000 (subtracts about .5-1 in float)
- lwpc:fcmpo cr0,f20,f21
- bgt rwpc #branches to right wrap point check if current player's X coordinate is greater than the stage's left wrap point
- li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
- subis r20,r22,1 #sets current player X coordinate to right wrap point -0x10000 (subtracts about .5-1 in float)
- stb r7,188(r3)
- stb r8,117(r5) #phantom wings stuff (part of the original x world wrap code, I don't know what it does)
- rwpc:fcmpo cr0,f20,f22
- blt adc #branches to AD check if current player's X coordinate is less than the stage's right wrap point
- li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
- subis r20,r21,1 #sets current player X coordinate to left wrap point -0x10000 (adds about .5-1 in float)
- stb r7,188(r3)
- stb r8,117(r5) #phantom wings stuff (part of the original x world wrap code, I don't know what it does)
- adc:ccmpwi r10,0xAD
- bne end #branches to end if a wrap is not in progress
- addi r30,r6,0x30 #Loads WD AD flags address into r30
- lwz r12,8(r31)
- lwz r11,0x110(r12) #loads alternate character ID into r11
- cmpwi r11,0xF
- bne fs #branches to flag store if character isn't ice climbers
- lhz r11,0xFC(r12) #loads popo or nana ID into r11
- cmpwi r11,1
- beq nwd #branches to no wrap damage if nana
- fs:stbx r10,r30,r24 #stores AD flag to WD AD flags address + PNID
- nwd:subi r30,r30,4
- stbx r10,r30,r24 #stores AD flag to HI AD flags address + PNID
- subi r30,r30,4
- stbx r10,r30,r24 #stores AD flag to TSCD AD flags address + PNID
- stb r24,8(r6)
- end:stw r17,16(r3) #stores current player Y coordinate
- stw r20,12(r3) #stores current player X coordinate
- lmw r2,8(r1) #reloads previous register values back from the stack
- addi r1,r1,128 #sets stack pointer back to where it was before now that the space is free again
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement