Mgamerz

Enhanced Flashman Video v1 ASM

Dec 20th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Mgamerz Enhanced Enemies Mod v0.001
  2. ;12/17/2016
  3. ;Apply to MMBN3 ENGLISH WHITE version only! Apply with ARMIPS:
  4. ;armips filename.asm
  5.  
  6. input   equ whitevanilla.gba    ; Put the name of your ROM here
  7.  
  8. fspace equ 0x800000; Put the ROM free space offset here
  9.  
  10. .gba
  11. .open input,output.gba,8000000h
  12.  
  13. rngaddress EQU 0x080016a2|1b
  14. timestopchipcall EQU 08008E54h
  15. GetPlayer EQU 0x080013E0
  16. RecoveryChipRoutine EQU 0x80ADB04
  17. SpawnObject EQU 0x08003084
  18. ;FieldConfiguration EQU 0x
  19. SetPanelTeam EQU 0x0800B7C4
  20.  
  21. ;Flashman Chips
  22. flashmanchipcount EQU 4h
  23. flashmanChipHookAddress EQU 0x080B6726
  24.  
  25. gutsmanChipHookAddress EQU 0x080B8592
  26. gutsmanZPunchHookAddress EQU 0x080B84C6
  27. gutsmanChipCount EQU 4h
  28. gutsmanZPunchChipCount EQU 3h
  29. gutsmanMovesBeforeZPunch EQU 6h
  30.  
  31. teamfamily EQU 3Fh
  32. areafamily EQU 0h
  33. stagefamily EQU 4h
  34. trumpyfamily EQU 26h
  35. sensorfamily EQU 3Eh
  36. grabbackfamily EQU 15h
  37. mpchipfamily EQU 18h
  38.  
  39.  
  40. .org 08235156h ;Free Space
  41. .align 2
  42.  
  43. rngRoutine:
  44.     ldr r0, =rngaddress
  45.     bx r0
  46.     pop r15
  47.  
  48. ;setPanelToTeam:
  49. ;   ldr r0 =fieldConfiguration
  50.  
  51. ;callTimestopChipWithoutTimestop:
  52.     ;requires routine and parameters.
  53.  
  54.  
  55.     ;healSelf:
  56.     ;r0 = how much to heal
  57.     ;r5 = who to heal
  58.     ;bl RecoveryChipRoutine
  59.  
  60. ;===========================FLASH MAN==========================
  61. armRaiseMove:
  62.     ;Hijack at 080D7A66
  63.     push r1-r3,r5,r6
  64.     push r14
  65.     ;b performBulbSpawn
  66.     push r0
  67.     ldrh r0, [r5,24h] ;GetHP
  68.     ldr r4, =12Ch
  69.     cmp r0,r4
  70.     pop r0
  71.     bgt notInRecoveryThreshold
  72.  
  73.     inRecoveryThreshold:
  74.         ldr r0, =0x7D ;how much HP to heal at level 0 (125)
  75.         ldr r4, [r5,4h] ;get level
  76.         add r4, r4, 1h ; prevents *0
  77.         mul r0, r4 ;multiply how much HP to heal
  78.         bl RecoveryChipRoutine
  79.         mov r1, 0h ;0 = Navi Pixelated Summon
  80.         strb r1, [r5, 0xC]
  81.         mov r1, 1h  ;Give Flashman another chip to use as he may run out.
  82.         strb r1, [r5,0x1A] ;0xA offset is how many chips an AI have to use, but r5 is incremented by 4 here for some reason.
  83.         pop r1
  84.         pop r1-r3,r5,r6; including get rid of return address, we will set our own to resume control
  85.  
  86.         ldr r0, =080D7A84h|1b
  87.         bx r0 ;ignore post spawn
  88.  
  89.     notInRecoveryThreshold:
  90.        
  91.         push r1-r3
  92.         bl rngRoutine ;GET RNG result AND PUT INTO r0
  93.         mov r1, 0Ah ;remainder 0 = steal, anything else = bulbs
  94.         swi 6; Divide, remainder is in r1
  95.         mov r0, 0h
  96.         cmp r0, r1
  97.         pop r1
  98.         pop r2
  99.         pop r3
  100.         bne performBulbSpawn
  101.         stealPanels:
  102.             ;position is on the stack it seems...?
  103.             mov r0, 9h
  104.             b armRaiseFinish
  105.             ;mov r2, 1h
  106.             ;bl SetPanelTeam
  107.             ;pop r1 ;don't care
  108.             pop r1-r3,r5,r6
  109.             ldr r0, =080D7A84h|1b
  110.             bx r0 ;ignore post spawn
  111.  
  112.         performBulbSpawn:
  113.             mov r0, 11h
  114.  
  115.         armRaiseFinish:
  116.             bl SpawnObject
  117.             pop r15 ;finish
  118.  
  119. snakeTrace:
  120.     push r14
  121.     bl GetPlayer ;load X,Y into r0 r1
  122.     ;r0 - Player Current X
  123.     ;r1 - Player Current Y
  124.     push r1
  125.     push r3 ;temporary variable
  126.     ldr r1, [sp,0xC] ;next X pos of bulb
  127.     add r1, r1, 1h
  128.     cmp r0, r1 ;compare next X+1 (same) vs Megaman's X
  129.     ldrb r2,[r5,13h] ; highjacks at 080D7688 ;Current Y position
  130.     bne snakeTraceNotLinedUp ;exit if numbers aren't the same
  131.     snakeTraceLinedUp:
  132.         pop r3
  133.         pop r0 ;Player Y
  134.         cmp r2, r0 ;compare Y coordinates. also used by the routine we return to
  135.         bne snakeTraceDifferentYs
  136.         b snakeTraceLinedUpExit ;same Ys.
  137.  
  138.        
  139.        
  140.         snakeTraceDifferentYs:
  141.             str r1, [sp,0x4] ;store same X if our current Y is not the same as the player Y (hit and leave field)
  142.  
  143.         snakeTraceLinedUpExit:
  144.             pop r15
  145.  
  146.     snakeTraceNotLinedUp:
  147.         pop r3
  148.         mov r1, 1h
  149.         cmp r1, 1h ;force same y
  150.         pop r1
  151.         ;mov r2, 1h
  152.         ;cmp r2, 2h ;Same Y
  153.         pop r15
  154.    
  155.  
  156. loadFlashmanRandomChip:
  157.     push r14
  158.     bl rngRoutine ;GET RNG result AND PUT INTO r0
  159.     mov r1, flashmanchipcount ;number of chips in selection list
  160.     swi 6; Divide
  161.     ldr r0,=@@flashmanChipLookupTable ;Load address of chip lookup table (defined below)
  162.     mov r2,0x03 ; Load r2 with 3
  163.     mul r1,r2 ;Multiply the remainder result by the size of the structs (3 bytes) - this will provide an offset into the chip lookup table
  164.     add r0,r0,r1 ;calculate the address using the offset, store in r0
  165.     ldrb r3, [r0,0x02] ;load byte from *r0 (offset 2 forward) into r3 (dmg)
  166.     ldrb r1, [r0,0x01] ;load byte from *r0 (offset 1 forward) into r1 (sublevel)
  167.     ldrb r0, [r0,0x00] ;load byte from *r0 (direct addr) into r0 (family)
  168.     ldrb r2,[r5,16h] ; ...this is actually the object's alliance enemy/allied
  169.     pop r15
  170.  
  171. .pool
  172. @@flashmanChipLookupTable:
  173. .byte teamfamily, 1h, 0h
  174. ;.byte areafamily, 1h, 10h
  175. .byte stagefamily, 4h, 0h
  176. .byte trumpyfamily, 2h, 0h
  177.  
  178. ;Flashman zap throwdown
  179. .align 4
  180. flashmanThrowdownAction:
  181. .align 2
  182.     push r1,r2,r5,r6
  183.     push r14
  184.     bl rngRoutine ;GET RNG result AND PUT INTO r0
  185.     mov r1, 0x3 ;number of available actions
  186.     swi 6; Divide
  187.     ldr r0,=@@flashmanThrowdownLookupTable ;Load address of actions
  188.     add r0,r0,r1 ;calculate the address using the offset, store in r0
  189.     ldr r0, [r0]
  190.     pop r15
  191.  
  192. .pool
  193. @@flashmanThrowdownLookupTable:
  194. .byte 0x35 ;Mine
  195. .byte 0x3A ;NoBeam
  196. .byte 0x10 ;ZapAttack
  197.  
  198. ;-----------------------------GUTS MAN----------------------
  199.  
  200. ;This block is unused right now due to spam issues
  201. ;loadGutsmanRandomChip:
  202. ;push r14
  203. ;bl rngRoutine
  204. ;mov r1, gutsmanchipcount
  205. ;swi 6; Divide
  206. ;ldr r0,=@@gutsmanChipLookupTable ;Load address of chip lookup table (defined below)
  207. ;mov r2,0x03 ; Load r2 with 3
  208. ;mul r1,r2 ;Multiple the remainder result by the size of the structs (3 bytes) - this will provide ;an offset into the chip lookup table
  209. ;add r0,r0,r1 ;calculate the address using the offset, store in r0
  210. ;ldrb r3, [r0,0x02] ;load byte from *r0 (offset 2 forward) into r3 (dmg)
  211. ;ldrb r1, [r0,0x01] ;load byte from *r0 (offset 1 forward) into r1 (sublevel)
  212. ;ldrb r0, [r0,0x00] ;load byte from *r0 (direct addr) into r0 (family)
  213. ;ldrb r2,[r5,16h] ; ...this is actually the object's alliance enemy/allied
  214. ;pop r15
  215.  
  216.  
  217. ;.pool
  218. ;@@gutsmanChipLookupTable:
  219. ;.byte teamfamily, 0h, 0h
  220. ;.byte areafamily, 1h, 10h
  221. ;.byte stagefamily, 4h, 0h
  222. ;.byte trumpyfamily, 1h, 0h
  223. ;.align 4
  224. loadZPunchRandomChip:
  225.     .align 2
  226.     push r14
  227.     bl rngRoutine
  228.     mov r1, gutsmanZPunchChipCount
  229.     swi 6; Divide
  230.     ldr r0,=@@gutsmanZPunchLookupTable ;Load address of chip lookup table (defined below)
  231.     mov r2,0x03 ; Load r2 with 3
  232.     mul r1,r2 ;Multiple the remainder result by the size of the structs (3 bytes) - this will provide an offset into the chip lookup table
  233.     add r0,r0,r1 ;calculate the address using the offset, store in r0
  234.     ldrb r3, [r0,0x02] ;load byte from *r0 (offset 2 forward) into r3 (dmg)
  235.     ldrb r1, [r0,0x01] ;load byte from *r0 (offset 1 forward) into r1 (sublevel)
  236.     ldrb r0, [r0,0x00] ;load byte from *r0 (direct addr) into r0 (family;)
  237.     ldrb r2,[r5,16h] ; ...this is actually the object's alliance enemy/allied
  238.     pop r15
  239.  
  240. .pool
  241. @@gutsmanZPunchLookupTable:
  242. ;.byte teamfamily, 0h, 0h
  243. ;.byte areafamily, 1h, 10h
  244. ;.byte stagefamily, 4h, 0h
  245. .byte trumpyfamily, 2h, 0h
  246. .byte sensorfamily, 2h, 100h
  247. .byte mpchipfamily, 2h, 0h
  248.  
  249.  
  250. ;==================HOOKS================
  251. .org flashmanChipHookAddress
  252. flashmanChipHook:
  253.     bl loadFlashmanRandomChip
  254.     nop
  255.  
  256. .org 0x080D7A66 ;Flashman Bulb Spawn (Arm Raise Move to heal)
  257. flashmanArmRaiseMoveHook:
  258.     bl armRaiseMove
  259.     nop
  260.     nop
  261.  
  262. .org 0x080D7664 ;In the Follow Trace Y calculation area (will only affect follow and not zigzag tracer)
  263. snakeTraceHook:
  264.     bl snakeTrace
  265.     nop
  266.     nop
  267.  
  268. .org 0x080D7850 ;Flashman zap throwdown
  269. flashmanThrowdownHook:
  270.     bl flashmanThrowdownAction
  271.  
  272. ;.org gutsmanChipHookAddress
  273. ;gutsmanAreaGrabChipHook:
  274. ;bl loadGutsmanRandomChip
  275. ;nop
  276.  
  277. ;.org gutsmanZPunchHookAddress
  278. ;   bl loadZPunchRandomChip ;Hook z-punch chip and use my routine instead
  279.     ;nop
  280.  
  281. ;=================PATCHES===============
  282.  
  283. ;--------------HP SPEED PATCH---------------------
  284. ;Makes HP display change faster than default (which is 2)
  285. ;.org 0x08010E22
  286. ;mov r0, 4h
  287.  
  288. ;--------------Flashman Patches---------
  289.  
  290. ;--------------GUTSMAN PATCHES----------
  291. ;.org 0x080B7DF0 ;gutsmans sets move counter here to 0xFF so Z-Punch attack no longer comes up
  292. ;mov r0, #0x0 ;reset to 0 instead so he can use it again. this is the amount of moves he has done.
  293.  
  294. ;.org 0x080b7de8 ;gutsmans checks if his move count is same as this in order to activate Z-Punch
  295. ;cmp r0, gutsmanMovesBeforeZPunch
  296.  
  297. ;.org 0x080b7dcc ;gutsman checks this value and if his hp is less he can use zpunch. by default it is division by 2 by shifting to the right by 1.
  298. ;add r1, r1, 1 ;add 1 HP so its one over the max. Can use zpunch anytime now
  299.  
  300. ;.org 0x080b8590 ;gutsmans areagrab response chip
  301. ;mov r0, grabbackfamily
  302. ;mov r1, 0x1 ;grabrevenge sublevel
  303. ;ldrb r2,[r5,#0x16]
  304. ;mov r3,#0x32 ;50 damage per hit
  305.  
  306. ;-.org 0x080ae6a4 ;gutsman beta AI - delay after shockwave
  307. ;-.byte 0x64 ;contact damage
  308.  
  309. .org 0x08019b68 ;flashman beta HP
  310. .byte 0xe8
  311. .byte 0x03 ;1000 HP 0x03e8
  312.  
  313. .close
  314.  ; eof
Advertisement
Add Comment
Please, Sign In to add comment