Set Tile Flags for Pathfinding
Jump to navigation
Jump to search
00174e84: 00806021 addu r12,r4,r0 PV1 00174e88: 00004021 addu r8,r0,r0 00174e8c: 00003821 addu r7,r0,r0 00174e90: 3c098019 lui r9,0x8019 00174e94: 8d29f4e0 lw r9,-0x0b20(r9) Scratchpad for current unit (S0x00) 00174e98: 3c0d8019 lui r13,0x8019 00174e9c: 8dadf4e4 lw r13,-0x0b1c(r13) 0x80 Scratchpad (S0x80) 00174ea0: 3c0b8019 lui r11,0x8019 00174ea4: 8d6bf4f0 lw r11,-0x0b10(r11) pointer to scratchpad 0x200 (S0x200) 00174ea8: 3c0e8019 lui r14,0x8019 00174eac: 8dcef4e8 lw r14,-0x0b18(r14) Scratchpad for all other units(S0x180) 00174eb0: 01602021 addu r4,r11,r0 00174eb4: 01603021 addu r6,r11,r0 00174eb8: 3c028019 lui r2,0x8019 00174ebc: 24422dd8 addiu r2,r2,0x2dd8 moveable/targettable panel grid 00174ec0: 00e22821 addu r5,r7,r2 00174ec4: 31820001 andi r2,r12,0x0001 check for flag input 00174ec8: a0a00001 sb r0,0x0001(r5) set panel colour to initial 00174ecc: 10400005 beq r2,r0,0x00174ee4 branch if PV even 00174ed0: a0a00002 sb r0,0x0002(r5) unit standing on tile to initialise 00174ed4: 340200ff ori r2,r0,0x00ff 00174ed8: a0a00000 sb r0,0x0000(r5) 00174edc: a0a00003 sb r0,0x0003(r5) 00174ee0: a0a20004 sb r2,0x0004(r5)
00174ee4: 29020200 slti r2,r8,0x0200 00174ee8: 10400055 beq r2,r0,0x00175040 skip ahead if tile counter > 0x200 00174eec: 000818c0 sll r3,r8,0x03 00174ef0: 3c028019 lui r2,0x8019 00174ef4: 2442f8cc addiu r2,r2,0xf8cc 00174ef8: 00622821 addu r5,r3,r2 tile data start 00174efc: a0c00000 sb r0,0x0000(r6) set scratchpad 0x200 to 0 00174f00: 90a20004 lbu r2,0x0004(r5) load slope height 00174f04: 00000000 nop 00174f08: 30430005 andi r3,r2,0x0005 00174f0c: 34020001 ori r2,r0,0x0001 00174f10: 10620003 beq r3,r2,0x00174f20 branch if slope height = 1 00174f14: 34020004 ori r2,r0,0x0004 00174f18: 1462000d bne r3,r2,0x00174f50 branch if slope height != 4 00174f1c: 00000000 nop 00174f20: 90830000 lbu r3,0x0000(r4) slope heights 1 + 4: load scratchpad 0x200 value 00174f24: 00000000 nop 00174f28: 34620002 ori r2,r3,0x0002 00174f2c: a0820000 sb r2,0x0000(r4) add flag 0x02 and store 00174f30: 90a20003 lbu r2,0x0003(r5) load tile height 00174f34: 00000000 nop 00174f38: 3042001f andi r2,r2,0x001f 00174f3c: 28420003 slti r2,r2,0x0003 00174f40: 1440000d bne r2,r0,0x00174f78 branch if tile height < 0x3 00174f44: 34620042 ori r2,r3,0x0042 00174f48: 0805d3de j 0x00174f78 00174f4c: a0820000 sb r2,0x0000(r4) if tile height > 0x03 + slope = 1 or 4, set value 0x42 and store
00174f50: 90a20003 lbu r2,0x0003(r5) 00174f54: 91230004 lbu r3,0x0004(r9) load unit's jump 00174f58: 3042001f andi r2,r2,0x001f 00174f5c: 0062182a slt r3,r3,r2 00174f60: 10600005 beq r3,r0,0x00174f78 branch if jump > tile height 00174f64: 00000000 nop 00174f68: 90820000 lbu r2,0x0000(r4) 00174f6c: 00000000 nop 00174f70: 34420040 ori r2,r2,0x0040 00174f74: a0820000 sb r2,0x0000(r4) 00174f78: 90a20006 lbu r2,0x0006(r5) misc. tile flags 00174f7c: 00000000 nop 00174f80: 30430001 andi r3,r2,0x0001 Unselectable by cursor 00174f84: 00021042 srl r2,r2,0x01 00174f88: 30420001 andi r2,r2,0x0001 cannot target (red cursor) 00174f8c: 00621825 or r3,r3,r2 00174f90: 14600014 bne r3,r0,0x00174fe4 branch if either of the above 00174f94: 00000000 nop 00174f98: 90a20003 lbu r2,0x0003(r5) else, load height halves + depth value 00174f9c: 00000000 nop 00174fa0: 00021942 srl r3,r2,0x05 depth 00174fa4: 10600005 beq r3,r0,0x00174fbc branch if depth = 0 00174fa8: 2c620004 sltiu r2,r3,0x0004 check for depth < 4 00174fac: 91220011 lbu r2,0x0011(r9) load unit's cannot enter water flag 00174fb0: 00000000 nop 00174fb4: 1440000b bne r2,r0,0x00174fe4 branch if unit cannot enter water 00174fb8: 2c620004 sltiu r2,r3,0x0004 00174fbc: 14400005 bne r2,r0,0x00174fd4 branch if water depth < 0x4 00174fc0: 00000000 nop 00174fc4: 91220013 lbu r2,0x0013(r9) if tile is depth = 4, load unit's will sink flag 00174fc8: 00000000 nop 00174fcc: 14400005 bne r2,r0,0x00174fe4 branch if they will 00174fd0: 00000000 nop 00174fd4: 90820000 lbu r2,0x0000(r4) load 0x200 flag 00174fd8: 00000000 nop 00174fdc: 34420010 ori r2,r2,0x0010 set avoids sinking in tile 00174fe0: a0820000 sb r2,0x0000(r4) 00174fe4: 90a30006 lbu r3,0x0006(r5) 00174fe8: 00000000 nop 00174fec: 30620001 andi r2,r3,0x0001 00174ff0: 10400004 beq r2,r0,0x00175004 branch if tile can be selected 00174ff4: 00000000 nop 00174ff8: 90820000 lbu r2,0x0000(r4) 00174ffc: 0805d40f j 0x0017503c 00175000: 34420080 ori r2,r2,0x0080 00175004: 9122000e lbu r2,0x000e(r9) load move type 00175008: 00000000 nop 0017500c: 1440000c bne r2,r0,0x00175040 branch if not fly 00175010: 30620002 andi r2,r3,0x0002 00175014: 1040000a beq r2,r0,0x00175040 branch if can target tile 00175018: 3403003f ori r3,r0,0x003f 0017501c: 90a20000 lbu r2,0x0000(r5) load tile type 00175020: 00000000 nop 00175024: 3042003f andi r2,r2,0x003f 00175028: 10430005 beq r2,r3,0x00175040 branch if tile is cross-section 0017502c: 00000000 nop 00175030: 90820000 lbu r2,0x0000(r4) 00175034: 00000000 nop 00175038: 34420010 ori r2,r2,0x0010 unit avoids sinking if unit has fly - unless tile is cross-section (what) 0017503c: a0820000 sb r2,0x0000(r4) 00175040: 24840001 addiu r4,r4,0x0001 0x200 scratchpad ++ 00175044: 24c60001 addiu r6,r6,0x0001 00175048: 25080001 addiu r8,r8,0x0001 increment tile count 0017504c: 29020210 slti r2,r8,0x0210 00175050: 1440ff99 bne r2,r0,0x00174eb8 00175054: 24e70005 addiu r7,r7,0x0005 this process seems redundant for tiles 0x200 and up, they're skipped anyway. 00175058: 34020003 ori r2,r0,0x0003 0017505c: 11820052 beq r12,r2,0x001751a8 branch if PV1 = 3 00175060: 31820001 andi r2,r12,0x0001 check for PV = 1 00175064: 00004021 addu r8,r0,r0 reset counter 00175068: 01c03821 addu r7,r14,r0 other units scratchpad S80 (S180?) 0017506c: 90e60003 lbu r6,0x0003(r7) load first unit's unit ID 00175070: 340200ff ori r2,r0,0x00ff 00175074: 30c300ff andi r3,r6,0x00ff 00175078: 10620046 beq r3,r2,0x00175194 branch if invalid 0017507c: 00000000 nop 00175080: 90e30001 lbu r3,0x0001(r7) load other unit's Y 00175084: 91220018 lbu r2,0x0018(r9) load Max X 00175088: 00000000 nop 0017508c: 00620018 mult r3,r2 other unit Y x max X 00175090: 90e20002 lbu r2,0x0002(r7) load other unit stepping stone/height 00175094: 90e40000 lbu r4,0x0000(r7) load other unit X 00175098: 3042007f andi r2,r2,0x007f remove stepping stone flag 0017509c: 00021200 sll r2,r2,0x08 height x 0x100 001750a0: 00001812 mflo r3 Y x max X 001750a4: 00431021 addu r2,r2,r3 001750a8: 00445021 addu r10,r2,r4 Tile ID for other unit 001750ac: 30c3001f andi r3,r6,0x001f unit ID 001750b0: 000310c0 sll r2,r3,0x03 001750b4: 00431023 subu r2,r2,r3 001750b8: 00021180 sll r2,r2,0x06 x 0x1c0 001750bc: 3c018019 lui r1,0x8019 001750c0: 00220821 addu r1,r1,r2 001750c4: 902308cc lbu r3,0x08cc(r1) load base class/generic ID 001750c8: 34020049 ori r2,r0,0x0049 001750cc: 14620007 bne r3,r2,0x001750ec branch if not - WHAT'- KANZEN?? 001750d0: 016a2021 addu r4,r11,r10 scratchpad 0x200 + tile ID of other unit 001750d4: 016a1821 addu r3,r11,r10 001750d8: 90620000 lbu r2,0x0000(r3) load its flags 001750dc: 00000000 nop 001750e0: 34420080 ori r2,r2,0x0080 001750e4: 304200ef andi r2,r2,0x00ef remove 0x10 flag (cannot do anything sink related if another unit is already on the tile? (unless that unit is altima perfect?)) 001750e8: a0620000 sb r2,0x0000(r3) restore 001750ec: 000a1080 sll r2,r10,0x02 001750f0: 004a1021 addu r2,r2,r10 Tile ID * 5 001750f4: 3c018019 lui r1,0x8019 001750f8: 00220821 addu r1,r1,r2 001750fc: a0282dda sb r8,0x2dda(r1) store counter to unit ID standing on panel? 00175100: 90820000 lbu r2,0x0000(r4) load 0x200 data 00175104: 00000000 nop 00175108: 34450004 ori r5,r2,0x0004 add 0x04 flag 0017510c: 30c20040 andi r2,r6,0x0040 check for if in active unit team 00175110: 14400018 bne r2,r0,0x00175174 branch if not in unit team 00175114: a0850000 sb r5,0x0000(r4) restore 0x200 data 00175118: 91220022 lbu r2,0x0022(r9) if in unit team, load if current unit has stepping stone (? yeah that is weird. will look into it) 0017511c: 00000000 nop 00175120: 14400006 bne r2,r0,0x0017513c branch if not 00175124: 30a200f7 andi r2,r5,0x00f7 check for all but 0x1 flag? 00175128: 90e30002 lbu r3,0x0002(r7) load other unit map elevation + stepping stone 0017512c: 00000000 nop 00175130: 000319c2 srl r3,r3,0x07 00175134: 000318c0 sll r3,r3,0x03 stepping stone flag -> 0x1 flag -> 0x8 flag 00175138: 00431025 or r2,r2,r3 0017513c: a0820000 sb r2,0x0000(r4) store 0x8 (other unit stepping stone) and 0x1 (current unit stepping stone) flags 00175140: 30c20020 andi r2,r6,0x0020 check for it unit can be mounted 00175144: 14400006 bne r2,r0,0x00175160 branch if unit can be mounted 00175148: 016a1821 addu r3,r11,r10 0017514c: 90620000 lbu r2,0x0000(r3) if can't, 00175150: 00000000 nop 00175154: 34420020 ori r2,r2,0x0020 add 0x20 flag (cannot stop here; unit cannot be mounted) 00175158: 0805d465 j 0x00175194 0017515c: a0620000 sb r2,0x0000(r3) restore 00175160: 90620000 lbu r2,0x0000(r3) 00175164: 00000000 nop 00175168: 304200df andi r2,r2,0x00df remove 0x20 flag 0017516c: 0805d465 j 0x00175194 00175170: a0620000 sb r2,0x0000(r3) restore 00175174: 30a300cf andi r3,r5,0x00cf if on enemy team, remove 0x10 and 0x20 flags (not relevant) 00175178: a0830000 sb r3,0x0000(r4) 0017517c: 9122000e lbu r2,0x000e(r9) load current unit's move type 00175180: 00000000 nop 00175184: 14400002 bne r2,r0,0x00175190 branch if not fly 00175188: 30a200c7 andi r2,r5,0x00c7 remove 0x10, 0x20, 0x08 flags 0017518c: 34620008 ori r2,r3,0x0008 if fly, set tile can be jumped off? (er? relevance?) 00175190: a0820000 sb r2,0x0000(r4) restore 00175194: 25080001 addiu r8,r8,0x0001 00175198: 29020010 slti r2,r8,0x0010 0017519c: 1440ffb3 bne r2,r0,0x0017506c do for all 0x10 units 001751a0: 24e70007 addiu r7,r7,0x0007 001751a4: 31820001 andi r2,r12,0x0001 001751a8: 1040000d beq r2,r0,0x001751e0 branch if PV is even (unit isn't moving? unit is backing to a previous space (cancelling movement?)) 001751ac: 34020001 ori r2,r0,0x0001 001751b0: a5a00018 sh r0,0x0018(r13) if odd, store no reachable tiles 001751b4: 91230008 lbu r3,0x0008(r9) load current unit Y 001751b8: 91220018 lbu r2,0x0018(r9) load max X 001751bc: 00000000 nop 001751c0: 00620018 mult r3,r2 001751c4: 91220009 lbu r2,0x0009(r9) map level 001751c8: 91240007 lbu r4,0x0007(r9) current unit X 001751cc: 00021200 sll r2,r2,0x08 map level x 0x100 001751d0: 00001812 mflo r3 001751d4: 00431021 addu r2,r2,r3 001751d8: 00445021 addu r10,r2,r4 replace other unit's tile ID with current unit's Tile ID 001751dc: 34020001 ori r2,r0,0x0001 001751e0: 15820027 bne r12,r2,0x00175280 branch if PV != 1 001751e4: 000a1880 sll r3,r10,0x02 001751e8: 006a1821 addu r3,r3,r10 target tile ID * 5 001751ec: 3c048019 lui r4,0x8019 001751f0: 24842dd8 addiu r4,r4,0x2dd8 moveable tile data 001751f4: 016a1021 addu r2,r11,r10 001751f8: 90420000 lbu r2,0x0000(r2) load tile's 0x200 scratchpad data 001751fc: 00000000 nop 00175200: 30420020 andi r2,r2,0x0020 00175204: 1040000d beq r2,r0,0x0017523c branch if target tile unit can be mounted/there is no unit on the tile 00175208: 00642821 addu r5,r3,r4 0017520c: 34020024 ori r2,r0,0x0024 00175210: a1a20054 sb r2,0x0054(r13) store 0x24 in ? (loop counter of some kind?) 00175214: 90a20002 lbu r2,0x0002(r5) load unit number on tile 00175218: 24840a00 addiu r4,r4,0x0a00 check higher elevation too 0017521c: 00021880 sll r3,r2,0x02 00175220: 00621821 addu r3,r3,r2 unit number * 5 00175224: 91220006 lbu r2,0x0006(r9) load unit move 00175228: 00641821 addu r3,r3,r4 ? that's an interesting math. 0017522c: a0600004 sb r0,0x0004(r3) store tile not obstructed (tile above unit as indexed? does a mountable unit count as terrain???) 00175230: 24420001 addiu r2,r2,0x0001 00175234: 0805d491 j 0x00175244 00175238: a0620000 sb r2,0x0000(r3) store AoE of movable tiles as move + 1 0017523c: 34020008 ori r2,r0,0x0008 else, 00175240: a1a20054 sb r2,0x0054(r13) store 8 in loop counter? 00175244: 34020004 ori r2,r0,0x0004 00175248: a1a20055 sb r2,0x0055(r13) store 4 as ai loop counter? 0017524c: 91220006 lbu r2,0x0006(r9) load unit move 00175250: 016a1821 addu r3,r11,r10 00175254: a0a00004 sb r0,0x0004(r5) store unobstructed 00175258: 24420001 addiu r2,r2,0x0001 0017525c: a0a20000 sb r2,0x0000(r5) store move + 1 as moveable aoe 00175260: 90620000 lbu r2,0x0000(r3) load 0x200 data 00175264: 00000000 nop 00175268: 34420001 ori r2,r2,0x0001 0017526c: a0620000 sb r2,0x0000(r3) add 0x1 flag (current unit has stepping stone?) to 0x200 data 00175270: 91220006 lbu r2,0x0006(r9) 00175274: 00000000 nop 00175278: 24420001 addiu r2,r2,0x0001 0017527c: a1a20062 sb r2,0x0062(r13) store unit's move to that scratchpad mess 00175280: 03e00008 jr r31 00175284: 00000000 nop