Update Sprite display data
Jump to navigation
Jump to search
00083f18: 27bdffc8 addiu r29,r29,0xffc8 stack pointer -0x38. This is important. 00083f1c: afb3001c sw r19,0x001c(r29) 00083f20: 00809821 addu r19,r4,r0 unit misc data 00083f24: afb10014 sw r17,0x0014(r29) 00083f28: 00a08821 addu r17,r5,r0 unit sprite data 00083f2c: 3c089249 lui r8,0x9249 00083f30: afbf0030 sw r31,0x0030(r29) 00083f34: afb7002c sw r23,0x002c(r29) 00083f38: afb60028 sw r22,0x0028(r29) 00083f3c: afb50024 sw r21,0x0024(r29) 00083f40: afb40020 sw r20,0x0020(r29) 00083f44: afb20018 sw r18,0x0018(r29) 00083f48: afb00010 sw r16,0x0010(r29) 00083f4c: 96620040 lhu r2,0x0040(r19) load X mod (raw X location on screen) 00083f50: 35082493 ori r8,r8,0x2493 r8 = 4/7 (effectively) 00083f54: 00021400 sll r2,r2,0x10 r2 = raw X mod << 0x10 (filters out upper halfword) 00083f58: 00022c03 sra r5,r2,0x10 r5 = x(?) 00083f5c: 00a80018 mult r5,r8 X * 4/7 00083f60: 00c0a021 addu r20,r6,r0 r20 = anim. frame 00083f64: 96630044 lhu r3,0x0044(r19) load Y mod (raw Y location on screen) 00083f68: 00002010 mfhi r4 r4 = Raw X mod * 4/7 00083f6c: 00031c00 sll r3,r3,0x10 00083f70: 00034c03 sra r9,r3,0x10 00083f74: 01280018 mult r9,r8 raw Y mod * 4/7 00083f78: 00e0a821 addu r21,r7,r0 r21 = animation 00083f7c: 8fb70048 lw r23,0x0048(r29) load stack pointer from previous routine. this stack pointer points to stack pointer + 0x60. 00083f80: 9266007e lbu r6,0x007e(r19) load unit's map level 00083f84: 8fb6004c lw r22,0x004c(r29) load stack pointer from previous routine. this stack pointer points to Stack pointer + 0x64 00083f88: 000217c3 sra r2,r2,0x1f rounding 00083f8c: 00031fc3 sra r3,r3,0x1f rounding 00083f90: 00852021 addu r4,r4,r5 r4 = Raw X mod * 11/7 00083f94: 00042103 sra r4,r4,0x04 r4 = Raw X mod * 11/112 00083f98: 00822023 subu r4,r4,r2 r4 = Raw X mod * ~ 1/10 00083f9c: 00042400 sll r4,r4,0x10 00083fa0: 00042403 sra r4,r4,0x10 00083fa4: 00002810 mfhi r5 r5 = Raw Y mod * 4/7 00083fa8: 00a92821 addu r5,r5,r9 Y * 11/7 00083fac: 00052903 sra r5,r5,0x04 Y * 11/112 00083fb0: 00a32823 subu r5,r5,r3 Y * ~1/10 00083fb4: 00052c00 sll r5,r5,0x10 00083fb8: 0c060fed jal 0x00183fb4 get tiles data pointer 00083fbc: 00052c03 sra r5,r5,0x10 00083fc0: 00408021 addu r16,r2,r0 r16 = tile data pointer 00083fc4: 3292ffff andi r18,r20,0xffff r18 = anim frame 00083fc8: 2e4200d2 sltiu r2,r18,0x00d2 set r2 = true if less than 0xd2 00083fcc: 10400071 beq r2,r0,0x00084194 #branch if not less than that 00083fd0: 34020001 ori r2,r0,0x0001 |r2 = 1 00083fd4: 92630130 lbu r3,0x0130(r19) |load mount byte 00083fd8: 8e31001c lw r17,0x001c(r17) |load SHP data pointer 00083fdc: 14620008 bne r3,r2,0x00084000 $branch if not riding something 00083fe0: 00000000 nop | 00083fe4: 8e620144 lw r2,0x0144(r19) |load status flags 5, 6, ? and ? 00083fe8: 00000000 nop | 00083fec: 30420240 andi r2,r2,0x0240 |seperate Jumping and ?? bytes 00083ff0: 14400064 bne r2,r0,0x00084184 %branch if jumping or ?? 00083ff4: 00121080 sll r2,r18,0x02 |r2 = 4 * anim. frame 00083ff8: 0802105d j 0x00084174 @jump ahead 00083ffc: 00511021 addu r2,r2,r17 |r2 = SHP data pointer + above 00084000: 92020003 lbu r2,0x0003(r16) $load tile depth 00084004: 00000000 nop | 00084008: 304200e0 andi r2,r2,0x00e0 |seperate depth flags 0008400c: 1040005c beq r2,r0,0x00084180 $branch if no depth 00084010: 00000000 nop | 00084014: 8e640134 lw r4,0x0134(r19) |load pointer to unit data 00084018: 00000000 nop | 0008401c: 10800040 beq r4,r0,0x00084120 &branch if null pointer 00084020: 00000000 nop | 00084024: 0c05fc08 jal 0x0017f020 |Float/Float/Fly movements 00084028: 00000000 nop | 0008402c: 8e630144 lw r3,0x0144(r19) |load status flags 5, 6, ? and ? 00084030: 00000000 nop | 00084034: 30630020 andi r3,r3,0x0020 |seperate float status 00084038: 14600051 bne r3,r0,0x00084180 $branch if float status? 0008403c: 00402021 addu r4,r2,r0 |r4 = depth flags 00084040: 30820020 andi r2,r4,0x0020 |move on water flag 00084044: 1440004f bne r2,r0,0x00084184 %branch if unit is walking on the surface of the water 00084048: 00121080 sll r2,r18,0x02 |r2 = 4 * anim frame 0008404c: 30820040 andi r2,r4,0x0040 |float flag 00084050: 1440004c bne r2,r0,0x00084184 %branch if floating (as there is depth, now checks for swimming depth) 00084054: 00121080 sll r2,r18,0x02 |r2 = 4 * anim frame 00084058: 92630006 lbu r3,0x0006(r19) |load spritesheet ID 0008405c: 3402009b ori r2,r0,0x009b |r2 = WEP1 spritesheet 00084060: 10620047 beq r3,r2,0x00084180 $branch if somehow a weapon goes through this routine(?) 00084064: 3402009e ori r2,r0,0x009e |r2 = 0x9e 00084068: 10620046 beq r3,r2,0x00084184 %branch if spritesheet is EFF2 0008406c: 00121080 sll r2,r18,0x02 |r2 = 4 * frame 00084070: 92620006 lbu r2,0x0006(r19) |load spritesheet 00084074: 00000000 nop | 00084078: 24420064 addiu r2,r2,0x0064 |sprite sheet + 0x64 0008407c: 304200ff andi r2,r2,0x00ff |sprite sheet - 0x9c (effectively) 00084080: 2c420002 sltiu r2,r2,0x0002 |r2 = true if sprite sheet is 9c or 9d (WEP2 or EFF1) 00084084: 10400010 beq r2,r0,0x000840c8 *branch if sprite sheet is not WEP2 or EFF1 00084088: 00000000 nop | 0008408c: 92020003 lbu r2,0x0003(r16) |load height/depth (Halves and depth flags, very creative) 00084090: 92030002 lbu r3,0x0002(r16) |load height (whole numbers) 00084094: 00021142 srl r2,r2,0x05 |obtain depth flags 00084098: 00621821 addu r3,r3,r2 |r3 = Height + depth 0008409c: 00031040 sll r2,r3,0x01 |r2 = 2 * (height + depth) 000840a0: 00431021 addu r2,r2,r3 |r2 = 3 * (height + depth) 000840a4: 86630042 lh r3,0x0042(r19) |load height mod 000840a8: 00021080 sll r2,r2,0x02 |r2 = 12 * (height + depth) 000840ac: 00031823 subu r3,r0,r3 |r3 = -height mod 000840b0: 24630004 addiu r3,r3,0x0004 |r3 = -height mod + 4 000840b4: 0043102a slt r2,r2,r3 |0 if weapon is significantly submerged in water 000840b8: 1040002c beq r2,r0,0x0008416c ♥branch if weapon/effect is submerged 000840bc: 3282ffff andi r2,r20,0xffff |r2 = frame ID 000840c0: 08021061 j 0x00084184 %jumps ahead 000840c4: 00021080 sll r2,r2,0x02 |r2 = 4 * (command byte + speed) 000840c8: 92020003 lbu r2,0x0003(r16) *load height/depth 000840cc: 92030002 lbu r3,0x0002(r16) |load height 000840d0: 00021142 srl r2,r2,0x05 |depth flags 000840d4: 00621821 addu r3,r3,r2 |height + depth 000840d8: 00031040 sll r2,r3,0x01 |" * 2 000840dc: 00431021 addu r2,r2,r3 |" * 3 000840e0: 86630042 lh r3,0x0042(r19) |load height mod 000840e4: 00022080 sll r4,r2,0x02 |r4 = 12 * " 000840e8: 00031823 subu r3,r0,r3 |r3 = -height mod 000840ec: 24620024 addiu r2,r3,0x0024 |r2 = -height mod + 24 000840f0: 0082102a slt r2,r4,r2 |If (height + depth) * 12 < height mod + 0x24 000840f4: 10400017 beq r2,r0,0x00084154 *branch if unit is submerged in depth 2 or greater 000840f8: 2462000c addiu r2,r3,0x000c |r2 = -height mod + 0xc 000840fc: 0082102a slt r2,r4,r2 |r2 = true if 12 * (height + depth) < -height mod + 0xc 00084100: 14400004 bne r2,r0,0x00084114 ♦Branch if unit is not submerged in depth 1 or greater 00084104: 00000000 nop | 00084108: 3282ffff andi r2,r20,0xffff |r2 = frame ID 0008410c: 0802105c j 0x00084170 ♣jump ahead 00084110: 00021080 sll r2,r2,0x02 |r2 = 4 * Frame ID 00084114: 3282ffff andi r2,r20,0xffff ♦r2 = command byte + speed 00084118: 08021061 j 0x00084184 %Jump ahead 0008411c: 00021080 sll r2,r2,0x02 |r2 = 4 * (command byte + speed) 00084120: 92020003 lbu r2,0x0003(r16) &Load height/depth 00084124: 92030002 lbu r3,0x0002(r16) |load height 00084128: 00021142 srl r2,r2,0x05 |depth 0008412c: 00621821 addu r3,r3,r2 |h+d 00084130: 00031040 sll r2,r3,0x01 |2(h+d) 00084134: 00431021 addu r2,r2,r3 |3(h+d) 00084138: 86630042 lh r3,0x0042(r19) |load height mod 0008413c: 00022080 sll r4,r2,0x02 |12(h+d) 00084140: 00031823 subu r3,r0,r3 |-m 00084144: 24620024 addiu r2,r3,0x0024 |-m + 0x24 00084148: 0082102a slt r2,r4,r2 |r2 = true if 12 * (height + depth) < -height mod + 0xc 0008414c: 14400004 bne r2,r0,0x00084160 &Branch if that is the case 00084150: 2462000c addiu r2,r3,0x000c |r2 = -m + 0xc 00084154: 8e220348 lw r2,0x0348(r17) *load totally submerged sprite (is not relative to current frame at all.) 00084158: 08021078 j 0x000841e0 ♠jump ahead 0008415c: aef10000 sw r17,0x0000(r23) save SHP data pointer to... er, unknown pointer saved in stack 00084160: 0082102a slt r2,r4,r2 &set r2 = true if 12 * (height + depth) < -height mod + 0xc 00084164: 14400007 bne r2,r0,0x00084184 %Branch if this is the case 00084168: 00121080 sll r2,r18,0x02 |r2 = frame 0008416c: 00121080 sll r2,r18,0x02 ♥ditto 00084170: 00511021 addu r2,r2,r17 ♣frame ptr. 00084174: 8c420348 lw r2,0x0348(r2) @Load swimming sprite 00084178: 08021078 j 0x000841e0 ♠jump ahead 0008417c: aef10000 sw r17,0x0000(r23) |save SHP pointer to location, the location of which is saved to the stack 00084180: 00121080 sll r2,r18,0x02 $r2 = frame 00084184: 00511021 addu r2,r2,r17 %ptr. to ptr. to current SHP frame data 00084188: 8c420008 lw r2,0x0008(r2) |load SHP data pointer 0008418c: 08021078 j 0x000841e0 ♠jump ahead 00084190: aef10000 sw r17,0x0000(r23) |save SHP pointer to stack 00084194: 3c11800b lui r17,0x800b #if frame ID > 0xd2 00084198: 2631f244 addiu r17,r17,0xf244 |r17 = 0x800af244 (EVTCHR1 SHP data) 0008419c: 32a2ffff andi r2,r21,0xffff |r2 = animation 000841a0: 2c420258 sltiu r2,r2,0x0258 |set if animation < 0x0258 000841a4: 10400002 beq r2,r0,0x000841b0 #branch if not 000841a8: 00000000 nop | 000841ac: 26318a9c addiu r17,r17,0x8a9c |r17 = 0x800a7ce0 (EVTCHR2 SHP data) 000841b0: 92020003 lbu r2,0x0003(r16) #load tile height/depth 000841b4: 00000000 nop 000841b8: 304200e0 andi r2,r2,0x00e0 seperate depth 000841bc: 10400005 beq r2,r0,0x000841d4 $branch if no depth 000841c0: 00121080 sll r2,r18,0x02 |r2 = frame * ptr. 000841c4: 02221021 addu r2,r17,r2 |ptr. to frame ptr. 000841c8: 8c420000 lw r2,0x0000(r2) |load frame data pointer 000841cc: 08021078 j 0x000841e0 ♠Finish the routine! 000841d0: aef10000 sw r17,0x0000(r23) |save to stack 000841d4: 02221021 addu r2,r17,r2 $add SHP data pointer and frame pointer thing (Frame * 4) 000841d8: 8c42fcc0 lw r2,-0x0340(r2) Load the thing there! 000841dc: aef10000 sw r17,0x0000(r23) store SHP start pointer in stack (in mother routine, + 0x28) 000841e0: aec20000 sw r2,0x0000(r22) ♠store SHP frame pointer stack (in mother routine, + 0x2c) 000841e4: 8fbf0030 lw r31,0x0030(r29) 000841e8: 8fb7002c lw r23,0x002c(r29) 000841ec: 8fb60028 lw r22,0x0028(r29) 000841f0: 8fb50024 lw r21,0x0024(r29) 000841f4: 8fb40020 lw r20,0x0020(r29) 000841f8: 8fb3001c lw r19,0x001c(r29) 000841fc: 8fb20018 lw r18,0x0018(r29) 00084200: 8fb10014 lw r17,0x0014(r29) 00084204: 8fb00010 lw r16,0x0010(r29) 00084208: 27bd0038 addiu r29,r29,0x0038 0008420c: 03e00008 jr r31 00084210: 00000000 nop