Difference between revisions of "Set Reachable Tiles"
Jump to navigation
Jump to search
m |
|||
(One intermediate revision by the same user not shown) | |||
Line 111: | Line 111: | ||
00174cfc: 1040000b beq r2,r0,0x00174d2c {{f/Cond|If This a Tile to spread the AoE from}} | 00174cfc: 1040000b beq r2,r0,0x00174d2c {{f/Cond|If This a Tile to spread the AoE from}} | ||
00174d00: 306200fe andi r2,r3,0x00fe |{{f/std|Keep every other flags}} | 00174d00: 306200fe andi r2,r3,0x00fe |{{f/std|Keep every other flags}} | ||
− | 00174d04: 0c05d7a8 jal 0x00175ea0 |{{f/jal| | + | 00174d04: 0c05d7a8 jal 0x00175ea0 |{{f/jal|Check_and_Spread_Movement_One_Tile_Around|Check_and_Spread_Movement_One_Tile_Around}} |
00174d08: a0820000 sb r2,0x0000(r4) |{{f/store|Update Tile's flags without 0x01}} | 00174d08: a0820000 sb r2,0x0000(r4) |{{f/store|Update Tile's flags without 0x01}} | ||
00174d0c: 9222001d lbu r2,0x001d(r17) |{{f/load|Load Acting Unit Fly/Teleport flag}} | 00174d0c: 9222001d lbu r2,0x001d(r17) |{{f/load|Load Acting Unit Fly/Teleport flag}} | ||
Line 155: | Line 155: | ||
00174dac: 1440ffa1 bne r2,r0,0x00174c34 {{f/eloop|Loop While Counter < Acting unit Move}} | 00174dac: 1440ffa1 bne r2,r0,0x00174c34 {{f/eloop|Loop While Counter < Acting unit Move}} | ||
00174db0: 00000000 nop | | 00174db0: 00000000 nop | | ||
− | 00174db4: 0c05d4a2 jal 0x00175288 |{{f/jal| | + | 00174db4: 0c05d4a2 jal 0x00175288 |{{f/jal|Set_Reachable_Tile_Flag|Set_Reachable_Tile_Flag}} |
00174db8: 00000000 nop | | 00174db8: 00000000 nop | | ||
00174dbc: 34030001 ori r3,r0,0x0001 | | 00174dbc: 34030001 ori r3,r0,0x0001 | |
Latest revision as of 14:13, 29 July 2023
BATTLE.BIN : Set Reachable Tiles --------------------------------------------------------------------------------- Parameters : r4 - Acting Unit ID (or his mount) Returns : r2 = Reachable Tiles counter r2 = -0x01 if Invalid Unit Spread Movement on Tiles Once it's done : - All reachable tiles flag 0x20 is enabled on byte 0x05 (8018f8cc) - 8018f510 = 0x01 - 8018f514 = Active Unit ID ------------------------------------------------------------------------------------------------------------ 00174b8c: 27bdffd0 addiu r29,r29,-0x0030 | 00174b90: 000410c0 sll r2,r4,0x03 |Unit ID * 8 00174b94: 00441023 subu r2,r2,r4 |Unit ID * 7 00174b98: afb1001c sw r17,0x001c(r29) | 00174b9c: 3c118019 lui r17,0x8019 | 00174ba0: 8e31f4e0 lw r17,-0x0b20(r17) |Pointer to scratch pad 0x1f800000 00174ba4: 00021180 sll r2,r2,0x06 |Unit ID * 0x1c0 00174ba8: afb00018 sw r16,0x0018(r29) | 00174bac: 3c108019 lui r16,0x8019 | 00174bb0: 8e10f4e4 lw r16,-0x0b1c(r16) |Pointer to Scratch Pad 0x1f800180 00174bb4: 340300ff ori r3,r0,0x00ff | 00174bb8: afbf0028 sw r31,0x0028(r29) | 00174bbc: afb30024 sw r19,0x0024(r29) | 00174bc0: afb20020 sw r18,0x0020(r29) | 00174bc4: 3c018019 lui r1,0x8019 | 00174bc8: 00220821 addu r1,r1,r2 |Part of Pointer to Unit battle data 00174bcc: 902208cd lbu r2,0x08cd(r1) |Load Unit battle ID 801908cc + 0x01 + Unit offset 00174bd0: 3c138019 lui r19,0x8019 | 00174bd4: 8e73f4f0 lw r19,-0x0b10(r19) |Pointer to Scratch Pad 0x1f800200 00174bd8: 1043007f beq r2,r3,0x00174dd8 #If Unit doesn't exist (ID = 0xff) Exit routine and returns -0x01 00174bdc: 2402ffff addiu r2,r0,-0x0001 | 00174be0: 0c05d10c jal 0x00174430 |-->Store_movement_stuff_into_scratch_pad 00174be4: 00000000 nop | 00174be8: 0c05d3a1 jal 0x00174e84 |-->Set Tile's Flags for pathfinding S-Pad 0x200 Grid, S-Pad 0x180 00174bec: 34040001 ori r4,r0,0x0001 | 00174bf0: 9223000e lbu r3,0x000e(r17) |Load Acting Unit Move Type 00174bf4: 34020001 ori r2,r0,0x0001 | 00174bf8: 1462000a bne r3,r2,0x00174c24 #If Acting Unit can Teleport 00174bfc: 34030001 ori r3,r0,0x0001 | 00174c00: 341201ff ori r18,r0,0x01ff |Initialize counter 00174c04: 3c028019 lui r2,0x8019 | 00174c08: 244237d3 addiu r2,r2,0x37d3 |801937d3 -Pointer to End of Targetable grid data (last tile) @LOOP - through all Targetable grid Tiles (backward) 00174c0c: a0430000 sb r3,0x0000(r2) |Set all AoE flags to 0x01 00174c10: 2652ffff addiu r18,r18,-0x0001 |counter - 1 00174c14: 0641fffd bgez r18,0x00174c0c Λ Loop 0x200 times 00174c18: 2442fffb addiu r2,r2,-0x0005 |Pointer -0x05 00174c1c: 0805d36d j 0x00174db4 >>Avoid Non Teleport section 00174c20: 00000000 nop | Else : Unit is not teleporting 00174c24: 92220006 lbu r2,0x0006(r17) |Load Acting Unit's Move 00174c28: 00000000 nop | 00174c2c: 18400061 blez r2,0x00174db4 #If Invalid (<= 0) Abort Loop 00174c30: 00009021 addu r18,r0,r0 |Initialize Counter @LOOP - 1 Time per Active unit Movement 00174c34: 92020062 lbu r2,0x0062(r16) |Load Acting Unit Move +1 (Because AoE ends at 0x1 not at 0x00) 00174c38: 00000000 nop | 00174c3c: 1040005d beq r2,r0,0x00174db4 #If Unit Move +1 = 0 : Abort loop 00174c40: 00000000 nop | 00174c44: a2000062 sb r0,0x0062(r16) |Reset 0x62 (S-Pad 0x180) 00174c48: a600002a sh r0,0x002a(r16) |Reset 0x2a (S-Pad 0x180) @LOOP - Each Elevation 00174c4c: 8602002a lh r2,0x002a(r16) |Load Elevation counter 00174c50: a6000028 sh r0,0x0028(r16) |Reset Y counter (New elevation) 00174c54: 00021200 sll r2,r2,0x08 | 00174c58: a602002c sh r2,0x002c(r16) |Store Elevation offset (0 or 0x100) 00174c5c: 92220019 lbu r2,0x0019(r17) |Load Map Max Y 00174c60: 00000000 nop | 00174c64: 10400045 beq r2,r0,0x00174d7c #If Invalid max Y : branch to Next Elevation iteration 00174c68: 00000000 nop | @LOOP - All Y rows 00174c6c: 86030028 lh r3,0x0028(r16) |Load Y counter 00174c70: 92220018 lbu r2,0x0018(r17) |Load Max X 00174c74: 00000000 nop | 00174c78: 00620018 mult r3,r2 | 00174c7c: a6000026 sh r0,0x0026(r16) |Reset X counter (new Y Row) 00174c80: 9603002c lhu r3,0x002c(r16) |Load Elevation offset 00174c84: 00001012 mflo r2 |Y * Max X 00174c88: 00621821 addu r3,r3,r2 | 00174c8c: a603002e sh r3,0x002e(r16) |Store Elevation + Y*MaxX in 0x2e 00174c90: 92220018 lbu r2,0x0018(r17) |Load Max X 00174c94: 00000000 nop | 00174c98: 1040002e beq r2,r0,0x00174d54 #If Invalid max X : branch to Next Y iteration 00174c9c: 00000000 nop | @LOOP - All Tiles (X coord) in a Y Row 00174ca0: 9602002e lhu r2,0x002e(r16) |Load Elevation + Y*MaxX 00174ca4: 96030026 lhu r3,0x0026(r16) |X counter 00174ca8: 00000000 nop | 00174cac: 00431021 addu r2,r2,r3 | 00174cb0: a602001a sh r2,0x001a(r16) |Store this iteration Tile ID 00174cb4: 00021400 sll r2,r2,0x10 | 00174cb8: 00021343 sra r2,r2,0x0d |Tile ID * 8 00174cbc: 3c038019 lui r3,0x8019 | 00174cc0: 2463f8cc addiu r3,r3,-0x0734 | 00174cc4: 00431021 addu r2,r2,r3 |This iteration Tile's data pointer ( 8018f8cc) 0x8018f8cc + Tile offset 00174cc8: 8604001a lh r4,0x001a(r16) |Load This iteration Tile ID 00174ccc: 3c038019 lui r3,0x8019 | 00174cd0: 24632dd8 addiu r3,r3,0x2dd8 | 00174cd4: ae020000 sw r2,0x0000(r16) |Store this Tile pointer at 0x00 (S-Pad 0x180) 00174cd8: 00041080 sll r2,r4,0x02 | 00174cdc: 00441021 addu r2,r2,r4 |Tile ID*5 00174ce0: 8604001a lh r4,0x001a(r16) |Load This iteration Tile ID 00174ce4: 00431021 addu r2,r2,r3 |Pointer : This tile data in targetable grid table 80192dd8 + Tile offset 00174ce8: ae020008 sw r2,0x0008(r16) |Store this Tile pointer - targetable grid (S-Pad 0x180) 00174cec: 02642021 addu r4,r19,r4 |Pointer : This iteration Tile data in S-Pad 0x200 00174cf0: 90830000 lbu r3,0x0000(r4) |Load This Tile S-Pad 0x200 data 00174cf4: 00000000 nop | 00174cf8: 30620001 andi r2,r3,0x0001 |Check [0x01] - First Active Unit Tile and Then Tile to spread the AoE from 00174cfc: 1040000b beq r2,r0,0x00174d2c #If This a Tile to spread the AoE from 00174d00: 306200fe andi r2,r3,0x00fe |Keep every other flags 00174d04: 0c05d7a8 jal 0x00175ea0 |-->Check_and_Spread_Movement_One_Tile_Around 00174d08: a0820000 sb r2,0x0000(r4) |Update Tile's flags without 0x01 00174d0c: 9222001d lbu r2,0x001d(r17) |Load Acting Unit Fly/Teleport flag 00174d10: 00000000 nop | 00174d14: 14400004 bne r2,r0,0x00174d28 #If Unit cannot Fly (Teleport Avoid this loop) 00174d18: 34020008 ori r2,r0,0x0008 | 00174d1c: 0c05d936 jal 0x001764d8 |-->Spread_Horizontal_Jump 00174d20: 00000000 nop | 00174d24: 34020008 ori r2,r0,0x0008 | 00174d28: a2020054 sb r2,0x0054(r16) |Restore counter at S-Pad 0x180 (0x54) 00174d2c: 96020026 lhu r2,0x0026(r16) |X Counter 00174d30: 00000000 nop | 00174d34: 24420001 addiu r2,r2,0x0001 | 00174d38: a6020026 sh r2,0x0026(r16) |Store X counter + 1 00174d3c: 00021400 sll r2,r2,0x10 | 00174d40: 92230018 lbu r3,0x0018(r17) |Max X 00174d44: 00021403 sra r2,r2,0x10 | 00174d48: 0043102a slt r2,r2,r3 | 00174d4c: 1440ffd4 bne r2,r0,0x00174ca0 Λ Loop While X counter < Max X 00174d50: 00000000 nop | 00174d54: 96020028 lhu r2,0x0028(r16) |Y counter 00174d58: 00000000 nop | 00174d5c: 24420001 addiu r2,r2,0x0001 | 00174d60: a6020028 sh r2,0x0028(r16) |Store Y counter +1 00174d64: 00021400 sll r2,r2,0x10 | 00174d68: 92230019 lbu r3,0x0019(r17) |Load Max Y 00174d6c: 00021403 sra r2,r2,0x10 | 00174d70: 0043102a slt r2,r2,r3 | 00174d74: 1440ffbd bne r2,r0,0x00174c6c Λ Loop While Y counter < Map Max Y 00174d78: 00000000 nop | 00174d7c: 9602002a lhu r2,0x002a(r16) |Load Elevation counter 00174d80: 00000000 nop | 00174d84: 24420001 addiu r2,r2,0x0001 | 00174d88: a602002a sh r2,0x002a(r16) |Store Elevation +1 (S-Pad 0x180) 00174d8c: 00021400 sll r2,r2,0x10 | 00174d90: 00021403 sra r2,r2,0x10 | 00174d94: 28420002 slti r2,r2,0x0002 | 00174d98: 1440ffac bne r2,r0,0x00174c4c Λ Loop 2 Times 00174d9c: 00000000 nop | 00174da0: 92220006 lbu r2,0x0006(r17) |Load Acting Unit's Move 00174da4: 26520001 addiu r18,r18,0x0001 |Counter +1 00174da8: 0242102a slt r2,r18,r2 | 00174dac: 1440ffa1 bne r2,r0,0x00174c34 Λ Loop While Counter < Acting unit Move 00174db0: 00000000 nop | 00174db4: 0c05d4a2 jal 0x00175288 |-->Set_Reachable_Tile_Flag 00174db8: 00000000 nop | 00174dbc: 34030001 ori r3,r0,0x0001 | 00174dc0: 3c018019 lui r1,0x8019 | 00174dc4: ac23f510 sw r3,-0x0af0(r1) |Store 0x01 at [ 8018f510 ] 0x8018f510 00174dc8: 9223000d lbu r3,0x000d(r17) |Load Active Unit ID (S-Pad 0x000) 00174dcc: 86020018 lh r2,0x0018(r16) |Reachable Tiles counter 00174dd0: 3c018019 lui r1,0x8019 | 00174dd4: ac23f514 sw r3,-0x0aec(r1) |Store Active Unit ID at [ 8018f514 ] 0x8018f514 00174dd8: 8fbf0028 lw r31,0x0028(r29) END 00174ddc: 8fb30024 lw r19,0x0024(r29) 00174de0: 8fb20020 lw r18,0x0020(r29) 00174de4: 8fb1001c lw r17,0x001c(r29) 00174de8: 8fb00018 lw r16,0x0018(r29) 00174dec: 27bd0030 addiu r29,r29,0x0030 00174df0: 03e00008 jr r31 00174df4: 00000000 nop
Return Location
BATTLE.BIN 00071628: 000715e8_-_00071664 000718e4: 0007187c_-_00071928 00194b68: AI_movement/panel_data_setting