Advertisement
Guest User

DisableMarioControlsButNotControllerRAM

a guest
Aug 20th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.34 KB | None | 0 0
  1. !Freeram_DisableMarioReactControls = $60
  2. ;^[1 byte] a bit flag that when set, makes
  3. ;mario assume that no button is pressed
  4. ;reguardless. Same format as smw's button
  5. ;format: byetUDLR and axlr----. These are
  6. ;handled individually, for example, you
  7. ;can disable only left, but enable right.
  8.  
  9. !Freeram_DisableMarioReactControls_SA1 = $400000
  10. ;^[1 byte] Same as above, but used instead of
  11. ; the above.
  12.  
  13.  
  14. ;Note: If you wanted to disable other things that depends
  15. ;on the controls, you can edit those to check the freeram
  16. ;as well. This patch is meant so that other things react
  17. ;to controls while mario doesn't is made possible (not
  18. ;clearing the controls flag).
  19.  
  20. ;This patch only modifies the reaction Mario does on inputs
  21. ;IN SMW's code, therefore other ASM stuff will not work
  22. ;unless you include this freeram to check.
  23.  
  24. !dp = $0000
  25. !addr = $0000
  26. !sa1 = 0
  27. !gsu = 0
  28.  
  29. if read1($00FFD6) == $15
  30. sfxrom
  31. !dp = $6000
  32. !addr = !dp
  33. !gsu = 1
  34. elseif read1($00FFD5) == $23
  35. sa1rom
  36. !dp = $3000
  37. !addr = $6000
  38. !sa1 = 1
  39. endif
  40.  
  41. if !sa1 == 1
  42. !Freeram_DisableMarioReactControls = !Freeram_DisableMarioReactControls_SA1
  43. endif
  44.  
  45. org $00D618
  46. autoclean JML DisableJump
  47. ;^Note that this will disable both jumps when standing on surface.
  48.  
  49. org $00DB98
  50. autoclean JML DisableJumpOffClimbing
  51.  
  52. org $00DBD0
  53. autoclean JML DisableLeftRightClimbing
  54.  
  55. org $00DBF2
  56. autoclean JML DisableUpDownClimbing
  57.  
  58. org $00D687
  59. autoclean JML DisableLeftRight
  60.  
  61. org $00CFD8
  62. autoclean JML DisableLeftRightWalkAnimation
  63.  
  64. org $00D715
  65. autoclean JML DisableDash
  66.  
  67. org $00D068
  68. autoclean JML DisableCapeSpin
  69.  
  70. org $00D08C
  71. autoclean JML DisableThrowFireball
  72.  
  73. org $00CFCD
  74. autoclean JSL DisableLookUp
  75.  
  76. org $00D600
  77. autoclean JML DisableDucking
  78. freecode
  79. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  80. DisableJump: ;>$00D618
  81. LDA !Freeram_DisableMarioReactControls
  82. BMI .DisableJump
  83.  
  84. .Restore
  85. LDA $16 ;>Pressing B (normal jump)
  86. ORA $18 ;>Pressing A (spin junp)
  87. BMI ..Jump ;>Jump
  88. JML $00D61E ;>Not pressing junp
  89.  
  90. ..Jump
  91. JML $00D630
  92.  
  93. .DisableJump
  94. JML $00D61E
  95. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  96. DisableJumpOffClimbing: ;>$00DB98
  97. .JumpingOff
  98. LDA !Freeram_DisableMarioReactControls
  99. BMI ..DisableJump
  100.  
  101. ..Restore
  102. BIT $16
  103. BPL ..NoJump
  104. JML $00DB9C
  105.  
  106. ..NoJump
  107. ..DisableJump
  108.  
  109. ;Allow punching net tile while only jump disabled.
  110.  
  111. .CheckPunching
  112. LDA !Freeram_DisableMarioReactControls
  113. AND.b #%01000000
  114. BNE ..DisablePunch
  115.  
  116. ..Restore
  117. LDA $16
  118. BIT.b #%01000000
  119. BEQ ..NoPunch
  120. JML $00DBAE
  121.  
  122. ..NoPunch
  123. ..DisablePunch
  124. JML $00DBCA
  125. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  126. DisableLeftRightClimbing: ;>$00DBD0
  127. LDA !Freeram_DisableMarioReactControls
  128. AND.b #%00000011
  129. CMP.b #%00000011
  130. BEQ .BothDisabled
  131.  
  132. ;Feel free to add another disabler/condition here.
  133.  
  134. CMP.b #%00000010 ;\Disable left
  135. BEQ .DisableLeft ;/
  136. CMP.b #%00000001 ;\Disable right
  137. BEQ .DisableRight ;/
  138. BRA .NoDisable ;>Disable none
  139.  
  140. .DisableLeft
  141. LDA $15
  142. AND.b #%00000001
  143. JML $00DBD4 ;>Treat as normal only for right bit
  144.  
  145. .DisableRight
  146. LDA $15
  147. AND.b #%00000010
  148. JML $00DBD4 ;>Treat as normal only for left bit
  149.  
  150. .BothDisabled
  151. JML $00DBF2 ;>Skip as if the player didn't press left or right.
  152.  
  153. .NoDisable
  154. LDA $15 ;\Restore
  155. AND.b #%00000011 ;|
  156. JML $00DBD4 ;/
  157. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  158. DisableUpDownClimbing: ;>$00DBF2
  159. LDA !Freeram_DisableMarioReactControls
  160. AND.b #%00001100
  161. CMP.b #%00001100
  162. BEQ .BothDisabled
  163.  
  164. ;Feel free to add another disabler/condition here.
  165.  
  166. CMP.b #%00001000
  167. BEQ .DisableUp
  168. CMP.b #%00000100
  169. BEQ .DisableDown
  170. BRA .NoDisable
  171.  
  172. .DisableUp
  173. LDA $15
  174. AND.b #%00000100 ;>Treat as normal only for down bit
  175. JML $00DBF6
  176.  
  177. .DisableDown
  178. LDA $15
  179. AND.b #%00001000 ;>Treat as normal only for up bit
  180. JML $00DBF6
  181.  
  182. .BothDisabled
  183. JML $00DC2C
  184.  
  185. .NoDisable
  186. LDA $15
  187. AND.b #%00001100
  188. JML $00DBF6
  189. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  190. DisableLeftRight: ;>$00D687
  191. ;The left and right on the D pad that
  192. ;makes mario move left or right.
  193.  
  194. LDA !Freeram_DisableMarioReactControls
  195. AND.b #%00000011 ;>Focus on left and right bits only
  196. CMP.b #%00000011 ;\if both left and right set, disable entirely
  197. BEQ .BothDisabled ;/
  198.  
  199. ;Feel free to add another disabler/condition here.
  200.  
  201. CMP.b #%00000010 ;\Disable left
  202. BEQ .DisableLeft ;/
  203. CMP.b #%00000001 ;\Disable right
  204. BEQ .DisableRight ;/
  205. BRA .NoDisable ;>Disable none
  206.  
  207. .DisableLeft
  208. LDA $15
  209. AND.b #%00000001
  210. JML $00D68B ;>Treat as normal only for right bit
  211.  
  212. .DisableRight
  213. LDA $15
  214. AND.b #%00000010
  215. JML $00D68B ;>Treat as normal only for left bit
  216.  
  217. .BothDisabled
  218. JML $00D68D ;>Skip as if the player didn't press left or right.
  219.  
  220. .NoDisable
  221. LDA $15 ;\Restore
  222. AND.b #%00000011 ;|
  223. JML $00D68B ;/
  224. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  225. DisableLeftRightWalkAnimation: ;>$00CFD8
  226. LDA !Freeram_DisableMarioReactControls
  227. AND.b #%00000011
  228. CMP.b #%00000011
  229. BEQ .BothDisabled
  230. CMP.b #%00000010
  231. BEQ .DisableLeft
  232. CMP.b #%00000001
  233. BEQ .DisableRight
  234. BRA .NoDisable
  235.  
  236. .DisableLeft
  237. LDA $15
  238. AND.b #%00000001
  239. JML $00CFDC ;>Treat as normal only for right bit
  240.  
  241. .DisableRight
  242. LDA $15
  243. AND.b #%00000010
  244. JML $00CFDC ;>Treat as normal only for left bit
  245.  
  246. .BothDisabled
  247. JML $00D003 ;>Skip as if the player didn't press left or right.
  248.  
  249. .NoDisable
  250. LDA $15 ;\Restore
  251. AND.b #%00000011 ;|
  252. JML $00CFDC ;/
  253. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  254. DisableDash: ;>$00D715
  255. LDA !Freeram_DisableMarioReactControls
  256. AND.b #%01000000
  257. BNE .DisableDash
  258.  
  259. .Restore
  260. BIT $15
  261. BVC ..NoDash
  262. JML $00D719
  263.  
  264. ..NoDash
  265. JML $00D737
  266.  
  267. .DisableDash
  268. JML $00D737
  269. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  270. ;If you have some code that limits the cape spin (such as MP),
  271. ;you may have to combine patches.
  272. DisableCapeSpin: ;>$00D068
  273. ;XBA ;>Powerup was in A (just in case)
  274. LDA !Freeram_DisableMarioReactControls
  275. AND.b #%01000000
  276. BNE .DisableSpin
  277.  
  278. .Restore
  279. ;XBA ;>Needed in case if a patch enables powerups >= #$80
  280. BIT $16 ;\Not pressing XY
  281. BVC .DisableSpin ;/
  282. JML $00D06C ;>Cape spin
  283.  
  284. .DisableSpin
  285. JML $00D0AD ;>Return
  286. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  287. DisableThrowFireball: ;>$00D08C
  288. ;may not be compatible wtih the fireball ammo, so you must combine the code
  289. ;here.
  290. ;XBA ;>Powerup was in A (just in case)
  291. LDA !Freeram_DisableMarioReactControls
  292. AND.b #%01000000
  293. BNE .DisableFireball
  294.  
  295. .Restore
  296. ;XBA ;>Needed in case if a patch enables powerups >= #$80
  297. BIT $16 ;\Pressing XY
  298. BVS ..TossFireball ;/
  299.  
  300. JML $00D090
  301. ;^Change from $00D090 to $00D0AD to disable throwing fireballs while spinjumping.
  302.  
  303. ..TossFireball
  304. JML $00D0AA
  305.  
  306. .DisableFireball
  307. JML $00D0AD ;>Return
  308. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  309. DisableLookUp: ;>$00CFCD
  310. LDA !Freeram_DisableMarioReactControls
  311. AND.b #%00001000
  312. BNE .DisableLookUp
  313.  
  314. .Restore
  315. LDA $15
  316. AND.b #%00001000
  317. BEQ .NotPressingUp
  318. LDA #$03 ;\Look up
  319. STA $13DE|!addr ;/
  320.  
  321. .NotPressingUp
  322. .DisableLookUp
  323. RTL
  324. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  325. DisableDucking: ;>$00D600
  326. LDA !Freeram_DisableMarioReactControls
  327. AND.b #%00000100
  328. BNE .DisableDucking
  329.  
  330. .Restore
  331. LDA $15
  332. AND.b #%00000100
  333. BEQ .NoDuck
  334. JML $00D606
  335.  
  336. .NoDuck
  337. .DisableDucking
  338. JML $00D60B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement