Difference between revisions of "Generate Range Around Tile Routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Add duplicated link)
(redirect)
Tag: New redirect
 
Line 1: Line 1:
  DUPLICATED routine [[Calculate_Possible_AoE_Tiles]]
+
  #REDIRECT[[Calculate_Possible_AoE_Tiles]]
  
 
<pre>
 
<pre>

Latest revision as of 22:10, 5 February 2022

Generate Range Around Tile
r4 = Y Counter
r5 = X Counter
r11 = 0x00ff (unverified)
0017963c: 3c02800e lui r2,0x800e
00179640: 90424e9c lbu r2,0x4e9c(r2)				r2 = Max Map X
00179644: 00000000 nop
00179648: 00820018 mult r4,r2						Y Counter * Max X
0017964c: 00007021 addu r14,r0,r0					r14 = 0
00179650: 00004821 addu r9,r0,r0					r9 = Range Counter
00179654: 00001812 mflo r3
00179658: 00651821 addu r3,r3,r5					Y Counter * Max X + X Counter
0017965c: 00031080 sll r2,r3,0x02					r2 = Tile ID
00179660: 00431021 addu r2,r2,r3					r2 = Tile ID + Tile ID
00179664: 3c018019 lui r1,0x8019
00179668: 00220821 addu r1,r1,r2
0017966c: 902c2dd8 lbu r12,0x2dd8(r1)				r12 = AoE @ Current Tile (Original AoE)
00179670: 340f0001 ori r15,r0,0x0001				r15 = True
00179674: 258dffff addiu r13,r12,-0x0001			r13 = AoE - 1
00179678: 112f0011 beq r9,r15,0x001796c0			Branch if r9 = 1
0017967c: 29220002 slti r2,r9,0x0002				If r9 < 2
00179680: 10400005 beq r2,r0,0x00179698				Branch if False
00179684: 00000000 nop
00179688: 1120000a beq r9,r0,0x001796b4				Branch if r9 = 0
0017968c: 00ab4021 addu r8,r5,r11					r8 = X Counter - 1
00179690: 0805e5b9 j 0x001796e4
00179694: 00000000 nop
00179698: 34020002 ori r2,r0,0x0002					
0017969c: 1122000b beq r9,r2,0x001796cc				Branch if r9 = 2
001796a0: 34020003 ori r2,r0,0x0003
001796a4: 1122000c beq r9,r2,0x001796d8				Branch if r9 = 3
001796a8: 00ab4021 addu r8,r5,r11					r8 = X Counter - 1
001796ac: 0805e5b9 j 0x001796e4
001796b0: 00000000 nop
001796b4: 340b0001 ori r11,r0,0x0001				r11 = 1
001796b8: 0805e5b8 j 0x001796e0
001796bc: 00005021 addu r10,r0,r0					r10 = 0
001796c0: 00005821 addu r11,r0,r0					r11 = 0
001796c4: 0805e5b8 j 0x001796e0
001796c8: 340a0001 ori r10,r0,0x0001				r10 = 1
001796cc: 240bffff addiu r11,r0,-0x0001				r11 = -1
001796d0: 0805e5b8 j 0x001796e0
001796d4: 00005021 addu r10,r0,r0					r10 = 0
001796d8: 00005821 addu r11,r0,r0					r11 = 0
001796dc: 240affff addiu r10,r0,-0x0001				r10 = -1
001796e0: 00ab4021 addu r8,r5,r11					r8 = X Counter +/- 1
001796e4: 0500002d bltz r8,0x0017979c				Branch if X Counter is negative
001796e8: 008a3821 addu r7,r4,r10					r7 = Y Counter +/- 1
001796ec: 04e0002b bltz r7,0x0017979c				Branch if Y Counter is negative
001796f0: 00000000 nop
001796f4: 3c03800e lui r3,0x800e
001796f8: 90634e9c lbu r3,0x4e9c(r3)				r3 = Max Map X
001796fc: 00000000 nop
00179700: 0103102a slt r2,r8,r3						If X Counter+/- < Max X
00179704: 10400025 beq r2,r0,0x0017979c				Branch if False
00179708: 00000000 nop
0017970c: 3c02800e lui r2,0x800e
00179710: 90424ea0 lbu r2,0x4ea0(r2)				r2 = Max Map Y
00179714: 00000000 nop
00179718: 00e2102a slt r2,r7,r2						If Y Counter+/- < Max Y
0017971c: 1040001f beq r2,r0,0x0017979c				Branch if False
00179720: 00e30018 mult r7,r3						Y Counter +/- * Max X
00179724: 00001012 mflo r2
00179728: 00481021 addu r2,r2,r8					r2 = Y Counter +/- * Max X + X Counter +/-
0017972c: 00021880 sll r3,r2,0x02					r3 = Tile ID
00179730: 00621821 addu r3,r3,r2					r3 = Tile ID + Tile ID
00179734: 3c028019 lui r2,0x8019
00179738: 24422dd8 addiu r2,r2,0x2dd8				r2 = Tile Grid Data (0x192dd8)
0017973c: 00623021 addu r6,r3,r2					r6 = Get Tile Data
00179740: 90c20000 lbu r2,0x0000(r6)				r2 = Current AoE
00179744: 00000000 nop
00179748: 004c102a slt r2,r2,r12					If Current AoE < Original AoE
0017974c: 10400013 beq r2,r0,0x0017979c				Branch if False
00179750: 00000000 nop
00179754: a0cd0000 sb r13,0x0000(r6)				Save Original AoE - 1 to Current Tile
00179758: 3c02800e lui r2,0x800e
0017975c: 90424e9c lbu r2,0x4e9c(r2)				r2 = Max Map X
00179760: 00000000 nop
00179764: 00e20018 mult r7,r2						Y Counter +/- * Max X
00179768: 25020100 addiu r2,r8,0x0100               r2 = X Counter + (0x100) (High Tile)
0017976c: 00001812 mflo r3                          r2 = Y Counter +/- * Max X + X Counter +/-
00179770: 00621821 addu r3,r3,r2                    r3 = Tile ID
00179774: 00031080 sll r2,r3,0x02                   
00179778: 00431021 addu r2,r2,r3					r2 = Tile ID + Tile ID
0017977c: 3c018019 lui r1,0x8019
00179780: 00220821 addu r1,r1,r2
00179784: a02d2dd8 sb r13,0x2dd8(r1)				Save Original AoE - 1 to Current Tile (High)
00179788: 29820003 slti r2,r12,0x0003				If Original AoE < 0x03
0017978c: 14400003 bne r2,r0,0x0017979c				Branch if True
00179790: 00000000 nop
00179794: a0cf0001 sb r15,0x0001(r6)				Current Tile = Targeted
00179798: 340e0001 ori r14,r0,0x0001				r14 = True
0017979c: 25290001 addiu r9,r9,0x0001				Range Counter++
001797a0: 29220004 slti r2,r9,0x0004				If Range Counter < 4
001797a4: 1440ffb4 bne r2,r0,0x00179678				Branch Back if True
001797a8: 00000000 nop
001797ac: 03e00008 jr r31
001797b0: 01c01021 addu r2,r14,r0					r2 = True