Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.93 KB | None | 0 0
  1. hook:8072E8A8
  2. stwu r1,-128(r1)
  3. stmw r2,8(r1) #creates a stack frame so I can freely use all registers
  4. lis r11,0x8000 #loads 0x80000000 into r11
  5. lwz r5,136(r3) #phantom wings stuff
  6. stfs f1,4(r4) #?????
  7. lis r6,0x901C
  8. ori r6,r6,0x4900 #loads address of XYWW floats into r6
  9. lfs f17,4(r4) #loads float coordinate of current player's Y position into f17
  10. lfs f18,0x14(r6) #loads float coordinate of stage's top wrap point into f18
  11. lfs f19,0x18(r6) #loads float coordinate of stage's bottom wrap point into f19
  12. lwz r17,4(r4) #loads float coordinate of current player's Y position into r17
  13. lwz r18,0x14(r6) #loads float coordinate of stage's top wrap point into r18
  14. lwz r19,0x18(r6) #loads float coordinate of stage's bottom wrap point into r19
  15. lfs f20,0(r4) #loads float coordinate of current player's X position into f20
  16. lfs f21,0x0C(r6) #loads float coordinate of stage's left wrap point into f21
  17. lfs f22,0x10(r6) #loads float coordinate of stage's right wrap point into f22
  18. lwz r20,0(r4) #loads float coordinate of current player's X position into r20
  19. lwz r21,0x0C(r6) #loads float coordinate of stage's left wrap point into r21
  20. lwz r22,0x10(r6) #loads float coordinate of stage's right wrap point into r22
  21. subis r29,r19,1
  22. cmplw r17,r29
  23. 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
  24. subis r29,r18,1
  25. cmplw r17,r29
  26. 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
  27. subis r29,r22,1
  28. cmplw r20,r29
  29. 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
  30. subis r29,r21,1
  31. cmplw r20,r29
  32. 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
  33. etcd:addi r30,r6,0x28 #adds 0x28 to XYWW floats address in r6 to store TSCD AD flags address in r30
  34. lbz r24,8(r6) #loads player number ID from stamina flags area into r24
  35. stbx r15,r30,r24 #clears current player's TSCD currently wrapping flag (AD)
  36. detcd:li r7,7
  37. li r8,0
  38. lbz r9,188(r3)
  39. cmpwi r9,7
  40. bne- 0x0C
  41. li r9,5
  42. stb r9,188(r3) #phantom wings stuff (part of the original x world wrap code, I don't know what it does)
  43. cmpwi r30,8
  44. bne end #branches to end if r30 isn't 8 (prevents crash)
  45. lwz r12,0x1C(r31) #(1)
  46. cmplw r12,r11
  47. blt end #sanity check, branches to end if r12 is not a valid address
  48. lwz r12,0x28(r12) #(2)
  49. cmplw r12,r11
  50. blt end #sanity check, branches to end if r12 is not a valid address
  51. lwz r27,0x10(r12)
  52. lbz r24,0x55(r27) #(1 2) loads player number ID into r24
  53. lwz r28,0x10(r27) #loads value that can identify what is wrapping into r28?
  54. cmplwi r28,0xFFFF
  55. bgt end #branches to end if value in r28 is greater than 0xFFFF to prevent items from wrapping
  56. lwz r26,-0xB4(r27) #loads current player damage integer into r26
  57. lis r11,0x9018
  58. ori r11,r11,0x0C1C #loads player 1 stamina address into r11
  59. mulli r25,r24,0x5C #multiplies PNID by mem2 per player data offset and stores result in r25
  60. lhzx r25,r11,r25 #loads current player stamina into r25 from player 1 stamina address + offset to current player mem2 player data
  61. cmpw r26,r25
  62. bge end #branches to end disallowing wrapping if current player's damage taken is >= to current player's max stamina
  63. addi r11,r6,0x24 #loads stamina dead flags address into r11
  64. lbzx r25,r11,r24 #loads current player stamina dead flag byte into r25 from stamina dead flags address + PNID
  65. cmpwi r25,0x1D
  66. beq end #branches to end if current player's stamina dead flag is set (appears to be redundant with above branch)
  67. lwz r12,0x7C(r31)
  68. lhz r11,0x06(r12) #loads current player previous action into r11
  69. lhz r12,0x3A(r12) #loads cureent player action into r12
  70. cmpwi r12,0xBC
  71. beq end #branches to end if current action is drowning (if allowed you would drown forever)
  72. cmpwi r12,0xBE
  73. beq end #branches to end if current action is respawn (if allowed you take wrap damage on respawn)
  74. cmpwi r12,0xC6
  75. beq end #branches to end if current action is eaten by summit fish (if allowed you're trapped in the fish)
  76. cmpwi r12,0xF1
  77. beq end #branches to end if current action is Kirby/MK uthrow (if allowed you take wrap damage and jump up through the stage)
  78. cmpwi r11,0x116
  79. beq end #branches to end if current action is final smash (some final smashes crash when wrapping)
  80. lwz r11,0x64(r31)
  81. lwz r11,-0xC(r11)
  82. lbz r11,0x3F(r11) #loads current player is grabbed/being thrown flag into r11
  83. cmpwi r11,1
  84. beq end #branches to end if current player is grabbed/thrown (prevents ganondorf/kirby/DDDK cheese)
  85. fcmpo cr0,f17,f18
  86. blt bwpc #branches to bottom wrap point check if current player's Y coordinate is less than the stage's top wrap point
  87. li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
  88. subis r17,r19,1 #sets current player Y coordinate to bottom wrap point -0x10000 (adds about .5-1 in float)
  89. bwpc:fcmpo cr0,f17,f19
  90. bgt lwpc #branches to left wrap point check if current player's Y coordinate is greater than the stage's bottom wrap point
  91. li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
  92. subis r17,r18,1 #sets current player Y coordinate to top wrap point -0x10000 (subtracts about .5-1 in float)
  93. lwpc:fcmpo cr0,f20,f21
  94. bgt rwpc #branches to right wrap point check if current player's X coordinate is greater than the stage's left wrap point
  95. li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
  96. subis r20,r22,1 #sets current player X coordinate to right wrap point -0x10000 (subtracts about .5-1 in float)
  97. stb r7,188(r3)
  98. stb r8,117(r5) #phantom wings stuff (part of the original x world wrap code, I don't know what it does)
  99. rwpc:fcmpo cr0,f20,f22
  100. blt adc #branches to AD check if current player's X coordinate is less than the stage's right wrap point
  101. li r10,0xAD #sets flag 0xAD in r10 indicating a wrap is in progress
  102. subis r20,r21,1 #sets current player X coordinate to left wrap point -0x10000 (adds about .5-1 in float)
  103. stb r7,188(r3)
  104. stb r8,117(r5) #phantom wings stuff (part of the original x world wrap code, I don't know what it does)
  105. adc:ccmpwi r10,0xAD
  106. bne end #branches to end if a wrap is not in progress
  107. addi r30,r6,0x30 #Loads WD AD flags address into r30
  108. lwz r12,8(r31)
  109. lwz r11,0x110(r12) #loads alternate character ID into r11
  110. cmpwi r11,0xF
  111. bne fs #branches to flag store if character isn't ice climbers
  112. lhz r11,0xFC(r12) #loads popo or nana ID into r11
  113. cmpwi r11,1
  114. beq nwd #branches to no wrap damage if nana
  115. fs:stbx r10,r30,r24 #stores AD flag to WD AD flags address + PNID
  116. nwd:subi r30,r30,4
  117. stbx r10,r30,r24 #stores AD flag to HI AD flags address + PNID
  118. subi r30,r30,4
  119. stbx r10,r30,r24 #stores AD flag to TSCD AD flags address + PNID
  120. stb r24,8(r6)
  121. end:stw r17,16(r3) #stores current player Y coordinate
  122. stw r20,12(r3) #stores current player X coordinate
  123. lmw r2,8(r1) #reloads previous register values back from the stack
  124. 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