Difference between revisions of "Check Horizontal Jump option"
Jump to navigation
Jump to search
m (Orkney moved page 0017622c - 001764d4 to Check Horizontal Jump option) |
|
(No difference)
|
Latest revision as of 19:06, 30 May 2023
BATTLE.BIN : Check Horizontal Jump option ---------------------------------------------------------------- Parameters : r4 : Destination Tile ID (X-Y) without elevation r5 : Origin exit side slope type (Opposite destination side slope type) r6 : Destination Entry side slope type r7 : Origin Exit side Height Returns r2 = 0x00 if Jump is possible r2 = 0x01 if Acting Unit cannot jump above destination (tile/unit in the way) Note : Im' sick of these tedious height check. I don't get the details (and notes might be inaccurate) But with the context of the calling routine. I assume this routine checks Horizontal Jumpability. Loop 4 Times : both elevation - Empty / Occupied Tile ------------------------------------------------------------------------------------------------------------ 0017622c: 0080c021 addu r24,r4,r0 | 00176230: 340d007f ori r13,r0,0x007f | 00176234: 00006021 addu r12,r0,r0 |Initialize counter 00176238: 3c0f8019 lui r15,0x8019 | 0017623c: 8deff4f0 lw r15,-0x0b10(r15) |Pointer to Scratch Pad (0x1f800200) 00176240: 3c098019 lui r9,0x8019 | 00176244: 8d29f4e4 lw r9,-0x0b1c(r9) |Pointer to Scratch Pad (0x1f800180) 00176248: 3c028019 lui r2,0x8019 | 0017624c: 8c42f4e0 lw r2,-0x0b20(r2) |Pointer to Scratch Pad (0x1f800000) 00176250: 3c0e8019 lui r14,0x8019 | 00176254: 8dcef4e8 lw r14,-0x0b18(r14) |Poiter to Other units Scratchpad ( 0x1f800080 ) 00176258: 9042001b lbu r2,0x001b(r2) |Acting Unit Size 0017625c: 30eb00ff andi r11,r7,0x00ff | 00176260: a1220053 sb r2,0x0053(r9) |Store acting unit size @LOOP - 4 Times 00176264: 000c17c2 srl r2,r12,0x1f | 00176268: 01821021 addu r2,r12,r2 | 0017626c: 00021043 sra r2,r2,0x01 |Counter/2 00176270: 00021200 sll r2,r2,0x08 |Elevation Offset (0 / 0 / 0x100 / 0x100) 00176274: 00582021 addu r4,r2,r24 |Tile ID 2 times low elevation, 2 times high elevation 00176278: 000418c0 sll r3,r4,0x03 |Tile ID * 8 0017627c: 3c028019 lui r2,0x8019 | 00176280: 2442f8cc addiu r2,r2,-0x0734 | 00176284: 00624021 addu r8,r3,r2 |Pointer : This iteration Tile data (8018f8cc) 00176288: 31820001 andi r2,r12,0x0001 |Uneven counter flag 0017628c: 1040002b beq r2,r0,0x0017633c #If 2nd Loop on Low or High Elevation 00176290: 01e41021 addu r2,r15,r4 |Pointer to this Tile S-Pad 0x200 data 00176294: 90420000 lbu r2,0x0000(r2) |Load Tile Flag 00176298: 34030004 ori r3,r0,0x0004 | 0017629c: 3042000c andi r2,r2,0x000c |Keep only 0x08 and 0x04 001762a0: 14430082 bne r2,r3,0x001764ac #If Flags 0x08 and 0x04 are ON /Else branch to Next iteration Ally Unit with stepping stone 001762a4: 00041080 sll r2,r4,0x02 | 001762a8: 00441021 addu r2,r2,r4 |Tile ID * 5 001762ac: 3c018019 lui r1,0x8019 | 001762b0: 00220821 addu r1,r1,r2 |Part of Pointer to Grid Data 001762b4: 90222dda lbu r2,0x2dda(r1) |Grid 0x02 - ID of unit on tile 001762b8: 00000000 nop | 001762bc: a1220050 sb r2,0x0050(r9) |Store Unit ID 001762c0: 91230050 lbu r3,0x0050(r9) |Unit ID 001762c4: 00000000 nop | 001762c8: 000310c0 sll r2,r3,0x03 | 001762cc: 00431023 subu r2,r2,r3 |Id *7 001762d0: 004e1821 addu r3,r2,r14 |Pointer : Destination Unit data in S-Pad 0x80 001762d4: 90620003 lbu r2,0x0003(r3) |Unit Flag + ID 001762d8: 00000000 nop | 001762dc: 30420040 andi r2,r2,0x0040 | 001762e0: 10400072 beq r2,r0,0x001764ac #If Unit is an Ally / Else branch to Next iteration 001762e4: 00000000 nop | 001762e8: 90640005 lbu r4,0x0005(r3) |Destination Unit Height 001762ec: 00000000 nop | 001762f0: 24880003 addiu r8,r4,0x0003 |Unit Height + 3 001762f4: 310300ff andi r3,r8,0x00ff | 001762f8: 0163102b sltu r2,r11,r3 | 001762fc: 10400007 beq r2,r0,0x0017631c #If Origin Height < Unit Height + 3 00176300: 00000000 nop | 00176304: 91220053 lbu r2,0x0053(r9) |Acting Unit Size 00176308: 00000000 nop | 0017630c: 01621021 addu r2,r11,r2 |Origin + Acting unit size 00176310: 0062102a slt r2,r3,r2 |1 UH+3 < O+AUS 00176314: 1440006e bne r2,r0,0x001764d0 #If Destination Unit Height + 3 < Origin Height + Unit size : branch to End - returns 0x01 00176318: 34020001 ori r2,r0,0x0001 | 0017631c: 91230050 lbu r3,0x0050(r9) |Unit ID 00176320: 00000000 nop | 00176324: 000310c0 sll r2,r3,0x03 | 00176328: 00431023 subu r2,r2,r3 |ID*7 0017632c: 004e1021 addu r2,r2,r14 |Pointer : Destination Unit data in S-Pad 0x80 00176330: 90480006 lbu r8,0x0006(r2) |Destination Unit Height + Size 00176334: 0805d90a j 0x00176428 >>Jump to check some height data (Lower height is Tile height, Higher is Unit Height) 00176338: 308300ff andi r3,r4,0x00ff |Destination Unit Height Else : 1st Loop on Low/High elevation Tile 0017633c: 90430000 lbu r3,0x0000(r2) |Tile's flags 00176340: 00000000 nop | 00176344: 30620080 andi r2,r3,0x0080 | 00176348: 10400005 beq r2,r0,0x00176360 #If Tile is Unselectable 0017634c: 30620004 andi r2,r3,0x0004 | 00176350: 10400056 beq r2,r0,0x001764ac #If Archangel is on Tile / Else branch to Next iteration 0x04 is Unit on Tile - Archangel enables 0x80 00176354: 34020001 ori r2,r0,0x0001 | 00176358: 0805d934 j 0x001764d0 >>Jump to End - returns 0x01 0017635c: 00000000 nop | Else : Tile is Selectable 00176360: 91020002 lbu r2,0x0002(r8) |Tile Height 00176364: 00000000 nop | 00176368: 00021040 sll r2,r2,0x01 | 0017636c: a1220050 sb r2,0x0050(r9) |Store Destination Height * 2 00176370: 91020003 lbu r2,0x0003(r8) |Tile Halves + Depth 00176374: 00000000 nop | 00176378: 3042001f andi r2,r2,0x001f | 0017637c: a1220051 sb r2,0x0051(r9) |Store Destination Halves 00176380: 91020004 lbu r2,0x0004(r8) |Destination Slope Type 00176384: 00000000 nop | 00176388: a1220052 sb r2,0x0052(r9) |Store Destination Slope Type 0017638c: 91230052 lbu r3,0x0052(r9) |Destination Slope Type 00176390: 91240051 lbu r4,0x0051(r9) |Destination Halves 00176394: 00a31007 srav r2,r3,r5 |Opposite Side Slope 00176398: 30420003 andi r2,r2,0x0003 | 0017639c: 00820018 mult r4,r2 | 001763a0: 00001012 mflo r2 |Destination opposite Side Slope height 001763a4: 00c31807 srav r3,r3,r6 |Destination Entry side Slope 001763a8: 30630003 andi r3,r3,0x0003 | 001763ac: 00830018 mult r4,r3 | 001763b0: 91230050 lbu r3,0x0050(r9) | 001763b4: 00000000 nop | 001763b8: 00625021 addu r10,r3,r2 |Destination opposite side Height 001763bc: 00001012 mflo r2 |Destination entry Side Slope height 001763c0: 00622021 addu r4,r3,r2 |Destination entry side Height 001763c4: 314300ff andi r3,r10,0x00ff |Opposite side 001763c8: 308200ff andi r2,r4,0x00ff |Entry side 001763cc: 0043102b sltu r2,r2,r3 | 001763d0: 1040000c beq r2,r0,0x00176404 #If Entry Side is below Opposite side 001763d4: 00000000 nop | 001763d8: 91020005 lbu r2,0x0005(r8) |Destination 0x05 001763dc: 91030003 lbu r3,0x0003(r8) |Destination Halves + Depth 001763e0: 3042001f andi r2,r2,0x001f | 001763e4: 00021040 sll r2,r2,0x01 |Thickness * 2 001763e8: 00824023 subu r8,r4,r2 |Entry height - Thickness Lower - Thickness 001763ec: 00031942 srl r3,r3,0x05 |Depth 001763f0: 00031840 sll r3,r3,0x01 |Depth * 2 001763f4: a1280050 sb r8,0x0050(r9) |Store Ceiling Height 001763f8: 91240050 lbu r4,0x0050(r9) |Load Ceiling 001763fc: 0805d909 j 0x00176424 | 00176400: 01434021 addu r8,r10,r3 |Opposite Side + depth Higher + depth 00176404: 91020003 lbu r2,0x0003(r8) |Destination Halves + Depth 00176408: 91030005 lbu r3,0x0005(r8) |Destination 0x05 0017640c: 00021142 srl r2,r2,0x05 | 00176410: 00021040 sll r2,r2,0x01 |Depth*2 00176414: 00824021 addu r8,r4,r2 |Entry height + depth 00176418: 3063001f andi r3,r3,0x001f | 0017641c: 00031840 sll r3,r3,0x01 |Thickness * 2 00176420: 01432023 subu r4,r10,r3 |Opposite Height - Thickness 00176424: 308300ff andi r3,r4,0x00ff |Ceiling --- 2nd section jump here 00176428: 31a200ff andi r2,r13,0x00ff |0x7f 0017642c: 0062102b sltu r2,r3,r2 | 00176430: 10400002 beq r2,r0,0x0017643c #If Ceiling < 0x7f Or Low elevation Height 00176434: 0163102b sltu r2,r11,r3 | 00176438: 00806821 addu r13,r4,r0 |r13 Becomes ceiling or lower height 0017643c: 10400007 beq r2,r0,0x0017645c #If Origin Exit Side Height < Ceiling 00176440: 00000000 nop | 00176444: 91220053 lbu r2,0x0053(r9) |Acting Unit Size 00176448: 00000000 nop | 0017644c: 01621021 addu r2,r11,r2 |Origin Heigt + Acting Unit Size 00176450: 0062102a slt r2,r3,r2 | 00176454: 1440001e bne r2,r0,0x001764d0 #If Ceiling < Origin Height + Acting Unit Size {{f/loc| Exit and returns 0x01 00176458: 34020001 ori r2,r0,0x0001 | 0017645c: 310300ff andi r3,r8,0x00ff |Higher height + depth 00176460: 0163102b sltu r2,r11,r3 | 00176464: 10400008 beq r2,r0,0x00176488 #If Origin Height < Destination Height + depth 00176468: 308200ff andi r2,r4,0x00ff | 0017646c: 91220053 lbu r2,0x0053(r9) |Acting Unit Size 00176470: 00000000 nop | 00176474: 01621021 addu r2,r11,r2 |Origin Height + Acting Unit Size 00176478: 0062102a slt r2,r3,r2 |1 if destination < Origin 0017647c: 14400014 bne r2,r0,0x001764d0 #If Destination height + depth < Origin Height + Acting Unit Size {{f/loc| Exit and returns 0x01 00176480: 34020001 ori r2,r0,0x0001 | 00176484: 308200ff andi r2,r4,0x00ff |Lower Destination / Ceiling 00176488: 0162102b sltu r2,r11,r2 | 0017648c: 14400007 bne r2,r0,0x001764ac #If Origin Height > Lower destination Height 00176490: 310200ff andi r2,r8,0x00ff | 00176494: 91230053 lbu r3,0x0053(r9) |Acting Unit Size 00176498: 00000000 nop | 0017649c: 01631821 addu r3,r11,r3 |Origin Height + Acting Unit Size 001764a0: 0043102a slt r2,r2,r3 | 001764a4: 1040000a beq r2,r0,0x001764d0 #If Destination Height > Origin Height + Acting unit size {{f/loc| Exit and returns 0x01 001764a8: 34020001 ori r2,r0,0x0001 | 001764ac: 258c0001 addiu r12,r12,0x0001 |Counter +1 001764b0: 29820004 slti r2,r12,0x0004 | 001764b4: 1440ff6b bne r2,r0,0x00176264 Λ Loop 4 times 001764b8: 31a400ff andi r4,r13,0x00ff | 001764bc: 3403007f ori r3,r0,0x007f | 001764c0: 10830003 beq r4,r3,0x001764d0 #If There is no ceiling (still max value) {{f/loc| Exit and returns 0x00 001764c4: 00001021 addu r2,r0,r0 | 001764c8: 30e200ff andi r2,r7,0x00ff | 001764cc: 0044102b sltu r2,r2,r4 |Returns 0x01 if Origin Height < Ceiling 001764d0: 03e00008 jr r31 001764d4: 00000000 nop
Return Location
BATTLE.BIN 001765e8: 001764d8_-_001766b0 00177d7c: 00177c08_-_00177e60