Difference between revisions of "Calculate Possible AoE Tiles"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Calculate Possible AoE Tiles 0017963c: 3c02800e lui r2,0x800e 00179640: 90424e9c lbu r2,0x4e9c(r2) r2 = Map Max X 00179644: 00000000 nop 00179648: 00820018 mult r4,r2 ...")
 
m (Add duplicated link)
Line 1: Line 1:
 +
DUPLICATED [[Generate_Range_Around_Tile_Routine]]
  
 
  Calculate Possible AoE Tiles
 
  Calculate Possible AoE Tiles

Revision as of 20:06, 5 February 2022

DUPLICATED Generate_Range_Around_Tile_Routine
Calculate Possible AoE Tiles
0017963c: 3c02800e lui r2,0x800e
00179640: 90424e9c lbu r2,0x4e9c(r2)		r2 = Map Max X
00179644: 00000000 nop
00179648: 00820018 mult r4,r2			Max X * YC
0017964c: 00007021 addu r14,r0,r0		Tiles Left? = 0
00179650: 00004821 addu r9,r0,r0		Tile Check = 0
00179654: 00001812 mflo r3
00179658: 00651821 addu r3,r3,r5		Max X * YC + XC
0017965c: 00031080 sll r2,r3,0x02		(Max X * YC + XC) * 4
00179660: 00431021 addu r2,r2,r3		Tile ID = (Max X * YC + XC) * 4
00179664: 3c018019 lui r1,0x8019		(Tile ID was calculated before jumping here, and this is only
00179668: 00220821 addu r1,r1,r2		 ever called form that routine)
0017966c: 902c2dd8 lbu r12,0x2dd8(r1)		Load Tile's AoE?
00179670: 340f0001 ori r15,r0,0x0001		r15 = 1
00179674: 258dffff addiu r13,r12,0xffff		r13 = AoE - 1
00179678: 112f0011 beq r9,r15,0x 001796c0	Branch if Tile Check = 1
0017967c: 29220002 slti r2,r9,0x0002
00179680: 10400005 beq r2,r0,0x 00179698		Branch if Tile Check >= 2
00179684: 00000000 nop
00179688: 1120000a beq r9,r0,0x 001796b4		Branch if Tile Check = 0
0017968c: 00ab4021 addu r8,r5,r11		AoE X = X Counter + X Mod
00179690: 0805e5b9 j 0x 001796e4
00179694: 00000000 nop
00179698: 34020002 ori r2,r0,0x0002		r2 = 2
0017969c: 1122000b beq r9,r2,0x 001796cc		Branch if Tile Check = 2
001796a0: 34020003 ori r2,r0,0x0003		r2 = 3
001796a4: 1122000c beq r9,r2,0x 001796d8		Branch if Tile Check = 3
001796a8: 00ab4021 addu r8,r5,r11		AoE X = X Counter + X Mod
001796ac: 0805e5b9 j 0x 001796e4
001796b0: 00000000 nop
001796b4: 340b0001 ori r11,r0,0x0001		X Mod = 1
001796b8: 0805e5b8 j 0x 001796e0
001796bc: 00005021 addu r10,r0,r0		Y Mod = 0
001796c0: 00005821 addu r11,r0,r0		X Mod = 0
001796c4: 0805e5b8 j 0x 001796e0
001796c8: 340a0001 ori r10,r0,0x0001		Y Mod = 1
001796cc: 240bffff addiu r11,r0,0xffff		X Mod = -1
001796d0: 0805e5b8 j 0x 001796e0
001796d4: 00005021 addu r10,r0,r0		Y Mod = 0
001796d8: 00005821 addu r11,r0,r0		X Mod = 0
001796dc: 240affff addiu r10,r0,0xffff		Y Mod = -1
001796e0: 00ab4021 addu r8,r5,r11		AoE X = X Counter + X Mod
001796e4: 0500002d bltz r8,0x 0017979c		Branch if AoE X < 0
001796e8: 008a3821 addu r7,r4,r10		AoE Y = Y Counter + Y Mod
001796ec: 04e0002b bltz r7,0x 0017979c		Branch if AoE Y < 0
001796f0: 00000000 nop
001796f4: 3c03800e lui r3,0x800e
001796f8: 90634e9c lbu r3,0x4e9c(r3)		Load Map Max X
001796fc: 00000000 nop
00179700: 0103102a slt r2,r8,r3
00179704: 10400025 beq r2,r0,0x 0017979c		Branch if AoE X >= Max X
00179708: 00000000 nop
0017970c: 3c02800e lui r2,0x800e
00179710: 90424ea0 lbu r2,0x4ea0(r2)		Load Map Max Y
00179714: 00000000 nop
00179718: 00e2102a slt r2,r7,r2
0017971c: 1040001f beq r2,r0,0x 0017979c		Branch if AoE Y >= Max Y
00179720: 00e30018 mult r7,r3			AoE Y * Max X
00179724: 00001012 mflo r2
00179728: 00481021 addu r2,r2,r8		AoE Y * Max X + AoE X
0017972c: 00021880 sll r3,r2,0x02		(AoE Y * Max X + AoE X) * 4
00179730: 00621821 addu r3,r3,r2		Tile ID = (AoE Y * Max X + AoE X) * 5
00179734: 3c028019 lui r2,0x8019
00179738: 24422dd8 addiu r2,r2,0x2dd8
0017973c: 00623021 addu r6,r3,r2
00179740: 90c20000 lbu r2,0x0000(r6)		Load Tile's AoE
00179744: 00000000 nop
00179748: 004c102a slt r2,r2,r12
0017974c: 10400013 beq r2,r0,0x 0017979c		Branch if New Tile AoE > Starting AoE
00179750: 00000000 nop
00179754: a0cd0000 sb r13,0x0000(r6)		Store AoE = AoE - 1
00179758: 3c02800e lui r2,0x800e
0017975c: 90424e9c lbu r2,0x4e9c(r2)		Load Map Max X
00179760: 00000000 nop
00179764: 00e20018 mult r7,r2			Max X * AoE Y
00179768: 25020100 addiu r2,r8,0x0100		r2 = AoE X + 0x100 (higher elevation)
0017976c: 00001812 mflo r3
00179770: 00621821 addu r3,r3,r2		Max X * AoE Y + AoE X + 0x100
00179774: 00031080 sll r2,r3,0x02		(Max X * AoE Y + AoE X + 0x100) * 4
00179778: 00431021 addu r2,r2,r3		(Max X * AoE Y + AoE X + 0x100) * 5
0017977c: 3c018019 lui r1,0x8019
00179780: 00220821 addu r1,r1,r2
00179784: a02d2dd8 sb r13,0x2dd8(r1)		Store Tile's reduced AoE (slowly spread out from origin)
00179788: 29820003 slti r2,r12,0x0003
0017978c: 14400003 bne r2,r0,0x 0017979c		Branch if Starting AoE <= 3
00179790: 00000000 nop
00179794: a0cf0001 sb r15,0x0001(r6)		Store Tile Targeted Flag? = 1
00179798: 340e0001 ori r14,r0,0x0001		Tiles Left? = 1
0017979c: 25290001 addiu r9,r9,0x0001		Tile Check += 1
001797a0: 29220004 slti r2,r9,0x0004
001797a4: 1440ffb4 bne r2,r0,0x 00179678		Branch if Tile Check < 4
001797a8: 00000000 nop
001797ac: 03e00008 jr r31
001797b0: 01c01021 addu r2,r14,r0		r2 = Tiles Left Check