Construct Polygon Data for Units
(Redirected from 0007af44 - 0007b4e8)
Jump to navigation
Jump to search
Alternate documentation here: Display Related? (0x7af44)
0007af44: 27bdffa8 addiu r29,r29,0xffa8 0007af48: afb20038 sw r18,0x0038(r29) 0007af4c: 87b20068 lh r18,0x0068(r29) Loads... something! from the stack. 0007af50: afb60048 sw r22,0x0048(r29) 0007af54: 0080b021 addu r22,r4,r0 moves ? display pointer in r4 to r22 (for weapons) 0007af58: afb40040 sw r20,0x0040(r29) 0007af5c: 00c0a021 addu r20,r6,r0 moves r6 to r20 0007af60: afb3003c sw r19,0x003c(r29) 0007af64: 00e09821 addu r19,r7,r0 moves pointer in r7 to r19 (stack) 0007af68: afbf0054 sw r31,0x0054(r29) 0007af6c: afbe0050 sw r30,0x0050(r29) 0007af70: afb7004c sw r23,0x004c(r29) 0007af74: afb50044 sw r21,0x0044(r29) 0007af78: afb10034 sw r17,0x0034(r29) 0007af7c: afb00030 sw r16,0x0030(r29) 0007af80: afa50020 sw r5,0x0020(r29) 0007af84: 96c4000c lhu r4,0x000c(r22) Load unit's spin on the Y axis? 0007af88: 8fb00070 lw r16,0x0070(r29) 0007af8c: 8fb50074 lw r21,0x0074(r29) 0007af90: 97b7006c lhu r23,0x006c(r29) loads another something from the stack. 0007af94: 0c006f0a jal 0x0001bc28 Sin call function 0007af98: 02442021 addu r4,r18,r4 r4 = spin on Y axis? + ?? 0007af9c: 00021400 sll r2,r2,0x10 obtains the lower halfword of that sin 0007afa0: 86030000 lh r3,0x0000(r16) loads from stack 0007afa4: 00021403 sra r2,r2,0x10 " 0007afa8: 00430018 mult r2,r3 multiply these together 0007afac: 00001812 mflo r3 0007afb0: 96c40008 lhu r4,0x0008(r22) load horizontal image stretch from wep1 sprite data 0007afb4: 00031b03 sra r3,r3,0x0c divide above multiplication by 2^12 0007afb8: 00640018 mult r3,r4 multiply ? and horizontal image stretch 0007afbc: 3c11800a lui r17,0x800a 0007afc0: 26318dcc addiu r17,r17,0x8dcc Numerical display data 0007afc4: 00001812 mflo r3 0007afc8: 00031b03 sra r3,r3,0x0c another division 0007afcc: a6230000 sh r3,0x0000(r17) save the result of all that... to numerical display data :D 0007afd0: 86030002 lh r3,0x0002(r16) more nonsense from stack. 0007afd4: 00000000 nop 0007afd8: 00430018 mult r2,r3 do the multiply 0007afdc: 00001012 mflo r2 0007afe0: 96c3000a lhu r3,0x000a(r22) load more vertical image stretch from wep1 sprite data 0007afe4: 00021303 sra r2,r2,0x0c 0007afe8: 00430018 mult r2,r3 0007afec: 00001012 mflo r2 0007aff0: 00021303 sra r2,r2,0x0c 0007aff4: 3c01800a lui r1,0x800a 0007aff8: a4228dd4 sh r2,-0x722c(r1) save to numerical display data? 0007affc: 96c4000c lhu r4,0x000c(r22) Load spin on Y axis? 0007b000: 0c006ed7 jal 0x0001bb5c Sin call function 0007b004: 02442021 addu r4,r18,r4 add r4 and r18 for that sin thing 0007b008: 00021400 sll r2,r2,0x10 0007b00c: 00021403 sra r2,r2,0x10 gets lower halfword of above call 0007b010: 86040002 lh r4,0x0002(r16) load from stack 0007b014: 00021823 subu r3,r0,r2 negative r2 0007b018: 00640018 mult r3,r4 0007b01c: 00001812 mflo r3 multiply those together 0007b020: 96c4000a lhu r4,0x000a(r22) load more ??? from wep1 sprite data 0007b024: 00031b03 sra r3,r3,0x0c divide 0007b028: 00640018 mult r3,r4 0007b02c: 00001812 mflo r3 multiply 0007b030: 00031b03 sra r3,r3,0x0c divide 0007b034: 3c01800a lui r1,0x800a 0007b038: a4238dce sh r3,-0x7232(r1) save to numerical display data? 0007b03c: 86030000 lh r3,0x0000(r16) load ? (stack again) 0007b040: 00000000 nop 0007b044: 00430018 mult r2,r3 0007b048: 00001012 mflo r2 0007b04c: 96c30008 lhu r3,0x0008(r22) horizontal image stretch 0007b050: 00021303 sra r2,r2,0x0c 0007b054: 00430018 mult r2,r3 0007b058: 00001012 mflo r2 0007b05c: 00021303 sra r2,r2,0x0c 0007b060: 3c01800a lui r1,0x800a 0007b064: a4228dd2 sh r2,-0x722e(r1) numerical display data? 0007b068: 86620000 lh r2,0x0000(r19) 0007b06c: 3c01800a lui r1,0x800a 0007b070: ac228de0 sw r2,-0x7220(r1) " 0007b074: 86620002 lh r2,0x0002(r19) 0007b078: 3c01800a lui r1,0x800a 0007b07c: ac228de4 sw r2,-0x721c(r1) " 0007b080: 0c00742a jal 0x0001d0a8 Store Rotation matrix elements to GTE 0007b084: 02202021 addu r4,r17,r0 r4 = numerical display data 0007b088: 0c00744e jal 0x0001d138 Store Translation Vectors to GTE 0007b08c: 02202021 addu r4,r17,r0 r4 = numerical display data 0007b090: 8fa80020 lw r8,0x0020(r29) load ? from stack 0007b094: 00000000 nop 0007b098: 0288102a slt r2,r20,r8 r2 = true if r20 < r8 0007b09c: 10400106 beq r2,r0,0x0007b4b8 #branch if r20 < r8 0007b0a0: 3c1eb60b lui r30,0xb60b |r30 = 0xb60b0000 0007b0a4: 3c07800a lui r7,0x800a | 0007b0a8: 24e77784 addiu r7,r7,0x7784 |word loaded to co-processor 0007b0ac: 3c06800c lui r6,0x800c | 0007b0b0: 24c67ca8 addiu r6,r6,0x7ca8 |camera zoom level 0007b0b4: 37de60b7 ori r30,r30,0x60b7 |r30 = 0xb60b60b7 (1/sqrt(2)?) 0007b0b8: 3c1100ff lui r17,0x00ff | 0007b0bc: 3631ffff ori r17,r17,0xffff |r17 = 0x00ffffff 0007b0c0: 3c13ff00 lui r19,0xff00 |r19 = 0xff000000 0007b0c4: 001410c0 sll r2,r20,0x03 |r2 = r20 * 8 0007b0c8: 00541023 subu r2,r2,r20 |r2 = r20 * 7 0007b0cc: 2442000e addiu r2,r2,0x000e |r2 = counter + e (:O) 0007b0d0: 02c28021 addu r16,r22,r2 |offset display data (:OO) 0007b0d4: 92120006 lbu r18,0x0006(r16) |load reversal bytes 0007b0d8: afa60028 sw r6,0x0028(r29) |save camera zoom to stack 0007b0dc: 0c01ebc2 jal 0x0007af08 |0007af08 - 0007af40 0007b0e0: afa7002c sw r7,0x002c(r29) |save word to co-processor to stack 0007b0e4: 00021400 sll r2,r2,0x10 |yeah this was cleared in the above routine. decompiler is on drugs. 0007b0e8: 00021403 sra r2,r2,0x10 | 0007b0ec: 02571826 xor r3,r18,r23 |flips bits between reversal bytes and unknown, and otherwise combines them. 0007b0f0: 00609021 addu r18,r3,r0 |move these back into r18 0007b0f4: 00021880 sll r3,r2,0x02 |r3 = r2*4 0007b0f8: 00621821 addu r3,r3,r2 |r3 = r2*5 0007b0fc: 3c02800e lui r2,0x800e | 0007b100: 8c424e70 lw r2,0x4e70(r2) |appears to be a pointer elsewhere. 0007b104: 000318c0 sll r3,r3,0x03 |r3 = r2*0x28 0007b108: 00622021 addu r4,r3,r2 |r4 = that pointer + r3 (polygon data for graphic) 0007b10c: 34020009 ori r2,r0,0x0009 |r2 = 0x9 0007b110: a0820003 sb r2,0x0003(r4) |0x9 words long 0007b114: 3402002c ori r2,r0,0x002c |r2 = 0x2c 0007b118: a0820007 sb r2,0x0007(r4) |polygon type 0x2c 0007b11c: 32e20002 andi r2,r23,0x0002 |moves 0x2 bitflag to r2 0007b120: 8fa60028 lw r6,0x0028(r29) |loads a curiosity 0007b124: 8fa7002c lw r7,0x002c(r29) |yeah same deal. 0007b128: 10400008 beq r2,r0,0x0007b14c $branch if bitflag is false 0007b12c: 00000000 nop | 0007b130: 92020000 lbu r2,0x0000(r16) |load X shift 0007b134: 92030002 lbu r3,0x0002(r16) |load X Width 0007b138: 00021600 sll r2,r2,0x18 | 0007b13c: 00021603 sra r2,r2,0x18 |here at squeenix... 0007b140: 00021023 subu r2,r0,r2 |negative X shift 0007b144: 0801ec57 j 0x0007b15c @jump ahead 0007b148: 00432823 subu r5,r2,r3 |r5 = -X shift -X Width 0007b14c: 92020000 lbu r2,0x0000(r16) $Load X shift 0007b150: 00000000 nop | 0007b154: 00021600 sll r2,r2,0x18 | 0007b158: 00022e03 sra r5,r2,0x18 |r5 = X shift 0007b15c: 32e20004 andi r2,r23,0x0004 @moves 0x4 bitflag to r2 0007b160: 10400008 beq r2,r0,0x0007b184 $branch if bitflag is false 0007b164: 00000000 nop | 0007b168: 92020001 lbu r2,0x0001(r16) |Load Y shift 0007b16c: 92030003 lbu r3,0x0003(r16) |Load Y Width 0007b170: 00021600 sll r2,r2,0x18 | 0007b174: 00021603 sra r2,r2,0x18 |here at squeenix... 0007b178: 00021023 subu r2,r0,r2 |negative 0007b17c: 0801ec65 j 0x0007b194 @jump ahead 0007b180: 00431823 subu r3,r2,r3 |r3 = -Y shift -Y Width 0007b184: 92020001 lbu r2,0x0001(r16) $Load Y shift 0007b188: 00000000 nop | 0007b18c: 00021600 sll r2,r2,0x18 | 0007b190: 00021e03 sra r3,r2,0x18 |r3 = Y shift 0007b194: 32420002 andi r2,r18,0x0002 @move 0x2 bitflag into r2 0007b198: 1040000e beq r2,r0,0x0007b1d4 $branch if bitflag is false 0007b19c: 00000000 nop | 0007b1a0: 3c01800a lui r1,0x800a | 0007b1a4: a42577a8 sh r5,0x77a8(r1) |save -X shift - X Width to coprocessor word (left most point of sprite) 0007b1a8: 3c01800a lui r1,0x800a | 0007b1ac: a4257798 sh r5,0x7798(r1) |save ditto to coprocessor word 0007b1b0: 92020002 lbu r2,0x0002(r16) |Load image width 0007b1b4: 00000000 nop | 0007b1b8: 00451021 addu r2,r2,r5 |r2 = -X shift 0007b1bc: 3c01800a lui r1,0x800a | 0007b1c0: a42277a0 sh r2,0x77a0(r1) |Save -X shift to coprocessor word (right most point of sprite) 0007b1c4: 3c01800a lui r1,0x800a | 0007b1c8: a4227790 sh r2,0x7790(r1) |ditto to ditto 0007b1cc: 0801ec81 j 0x0007b204 @Jump ahead 0007b1d0: 32420004 andi r2,r18,0x0004 |move 0007b1d4: 3c01800a lui r1,0x800a $ 0007b1d8: a42577a0 sh r5,0x77a0(r1) |save left-most point of sprite 0007b1dc: 3c01800a lui r1,0x800a | 0007b1e0: a4257790 sh r5,0x7790(r1) |save left-most point of sprite 0007b1e4: 92020002 lbu r2,0x0002(r16) |Load image width 0007b1e8: 00000000 nop | 0007b1ec: 00451021 addu r2,r2,r5 |r2 = rightmost point of sprite 0007b1f0: 3c01800a lui r1,0x800a | 0007b1f4: a42277a8 sh r2,0x77a8(r1) |save rightmost point of sprite 0007b1f8: 3c01800a lui r1,0x800a | 0007b1fc: a4227798 sh r2,0x7798(r1) |save rightmost point of sprite 0007b200: 32420004 andi r2,r18,0x0004 |move 0x4 bitflag to r2 0007b204: 1040000e beq r2,r0,0x0007b240 @$Branch if bitflag is 0 0007b208: 00000000 nop | 0007b20c: 3c01800a lui r1,0x800a | 0007b210: a42377aa sh r3,0x77aa(r1) |save -Y shift -Y width to coprocessor word (southern most point of sprite) 0007b214: 3c01800a lui r1,0x800a | 0007b218: a42377a2 sh r3,0x77a2(r1) |save southern most point of sprite 0007b21c: 92020003 lbu r2,0x0003(r16) |Load Y width 0007b220: 00000000 nop | 0007b224: 00431021 addu r2,r2,r3 |r2 = -Y shift 0007b228: 3c01800a lui r1,0x800a | 0007b22c: a422779a sh r2,0x779a(r1) |Save northern most point of sprite to coprocessor word 0007b230: 3c01800a lui r1,0x800a | 0007b234: a4227792 sh r2,0x7792(r1) |save northern most point of sprite 0007b238: 0801ec9b j 0x0007b26c @jump ahead 0007b23c: 00000000 nop | 0007b240: 3c01800a lui r1,0x800a $ 0007b244: a423779a sh r3,0x779a(r1) |save southern most point of sprite 0007b248: 3c01800a lui r1,0x800a | 0007b24c: a4237792 sh r3,0x7792(r1) |ditto 0007b250: 92020003 lbu r2,0x0003(r16) |load Y width 0007b254: 00000000 nop | 0007b258: 00431021 addu r2,r2,r3 |r2 = northern most point of sprite 0007b25c: 3c01800a lui r1,0x800a | 0007b260: a42277aa sh r2,0x77aa(r1) |save northern most point of sprite 0007b264: 3c01800a lui r1,0x800a | 0007b268: a42277a2 sh r2,0x77a2(r1) |ditto 0007b26c: 3c08800a lui r8,0x800a @ 0007b270: 25087790 addiu r8,r8,0x7790 |here down are the locations of the respective X and Y furthest and nearest points, depending on flip flags 0007b274: 01006021 addu r12,r8,r0 | 0007b278: 3c08800a lui r8,0x800a | 0007b27c: 25087798 addiu r8,r8,0x7798 |ditto 0007b280: 01006821 addu r13,r8,r0 |r13 = r8 0007b284: 3c08800a lui r8,0x800a | 0007b288: 250877a0 addiu r8,r8,0x77a0 | 0007b28c: 01007021 addu r14,r8,r0 |r14 = r8 0007b290: c9800000 lwc2 gtedr00_vxy0,0x0000(r12) |I hope you like staring at the void 0007b294: c9810004 lwc2 gtedr01_vz0,0x0004(r12) |because that's the vibe I'm getting. 0007b298: c9a20000 lwc2 gtedr02_vxy1,0x0000(r13) |big 0007b29c: c9a30004 lwc2 gtedr03_vz1,0x0004(r13) |empty 0007b2a0: c9c40000 lwc2 gtedr04_vxy2,0x0000(r14) |fleeting 0007b2a4: c9c50004 lwc2 gtedr05_vz2,0x0004(r14) |oh here it ends nice 0007b2a8: 00000000 nop | 0007b2ac: 00000000 nop | 0007b2b0: 4a280030 rtpt |what the fuck is this 0007b2b4: 02571025 or r2,r18,r23 0007b2b8: 30420001 andi r2,r2,0x0001 0007b2bc: 10400004 beq r2,r0,0x0007b2d0 0007b2c0: 00000000 nop 0007b2c4: 90820007 lbu r2,0x0007(r4) 0007b2c8: 0801ecb7 j 0x0007b2dc 0007b2cc: 34420002 ori r2,r2,0x0002 0007b2d0: 90820007 lbu r2,0x0007(r4) 0007b2d4: 00000000 nop 0007b2d8: 304200fd andi r2,r2,0x00fd 0007b2dc: a0820007 sb r2,0x0007(r4) 0007b2e0: 96c20004 lhu r2,0x0004(r22) 0007b2e4: 32e30060 andi r3,r23,0x0060 0007b2e8: 00431025 or r2,r2,r3 0007b2ec: a4820016 sh r2,0x0016(r4) 0007b2f0: 96c20006 lhu r2,0x0006(r22) 0007b2f4: 00000000 nop 0007b2f8: a482000e sh r2,0x000e(r4) 0007b2fc: 24820008 addiu r2,r4,0x0008 0007b300: 00406021 addu r12,r2,r0 0007b304: 24820010 addiu r2,r4,0x0010 0007b308: 00406821 addu r13,r2,r0 0007b30c: 24820018 addiu r2,r4,0x0018 0007b310: 00407021 addu r14,r2,r0 0007b314: e98c0000 swc2 gtedr12_sxy0,0x0000(r12) 0007b318: e9ad0000 swc2 gtedr13_sxy1,0x0000(r13) 0007b31c: e9ce0000 swc2 gtedr14_sxy2,0x0000(r14) 0007b320: 3c08800a lui r8,0x800a 0007b324: 250877a8 addiu r8,r8,0x77a8 0007b328: 01006021 addu r12,r8,r0 0007b32c: c9800000 lwc2 gtedr00_vxy0,0x0000(r12) 0007b330: c9810004 lwc2 gtedr01_vz0,0x0004(r12) 0007b334: 00000000 nop 0007b338: 00000000 nop 0007b33c: 4a180001 rtps 0007b340: 96c20000 lhu r2,0x0000(r22) 0007b344: 00000000 nop 0007b348: a4820004 sh r2,0x0004(r4) 0007b34c: 92c20002 lbu r2,0x0002(r22) 0007b350: 00000000 nop 0007b354: a0820006 sb r2,0x0006(r4) 0007b358: 24820020 addiu r2,r4,0x0020 0007b35c: 00406021 addu r12,r2,r0 0007b360: e98e0000 swc2 gtedr14_sxy2,0x0000(r12) 0007b364: 92020004 lbu r2,0x0004(r16) 0007b368: 00000000 nop 0007b36c: a082001c sb r2,0x001c(r4) 0007b370: a082000c sb r2,0x000c(r4) 0007b374: 92030002 lbu r3,0x0002(r16) 0007b378: 00000000 nop 0007b37c: 00431021 addu r2,r2,r3 0007b380: a0820024 sb r2,0x0024(r4) 0007b384: a0820014 sb r2,0x0014(r4) 0007b388: 92020005 lbu r2,0x0005(r16) 0007b38c: 00000000 nop 0007b390: a0820015 sb r2,0x0015(r4) 0007b394: a082000d sb r2,0x000d(r4) 0007b398: 92030003 lbu r3,0x0003(r16) 0007b39c: 00000000 nop 0007b3a0: 00431021 addu r2,r2,r3 0007b3a4: a0820025 sb r2,0x0025(r4) 0007b3a8: a082001d sb r2,0x001d(r4) 0007b3ac: 32420080 andi r2,r18,0x0080 0007b3b0: 10400031 beq r2,r0,0x0007b478 0007b3b4: 00000000 nop 0007b3b8: 94e20000 lhu r2,0x0000(r7) 0007b3bc: 00000000 nop 0007b3c0: 30450fff andi r5,r2,0x0fff 0007b3c4: 28a20400 slti r2,r5,0x0400 0007b3c8: 1040002b beq r2,r0,0x0007b478 0007b3cc: 24a2fed2 addiu r2,r5,0xfed2 0007b3d0: 8cc30000 lw r3,0x0000(r6) 0007b3d4: 00000000 nop 0007b3d8: 00430018 mult r2,r3 0007b3dc: 00001812 mflo r3 0007b3e0: 00000000 nop 0007b3e4: 00000000 nop 0007b3e8: 007e0018 mult r3,r30 0007b3ec: 00001010 mfhi r2 0007b3f0: 00431021 addu r2,r2,r3 0007b3f4: 00021483 sra r2,r2,0x12 0007b3f8: 00031fc3 sra r3,r3,0x1f 0007b3fc: 00431023 subu r2,r2,r3 0007b400: 00021080 sll r2,r2,0x02 0007b404: 02a21023 subu r2,r21,r2 0007b408: 8c830000 lw r3,0x0000(r4) 0007b40c: 8c42fffc lw r2,-0x0004(r2) 0007b410: 00731824 and r3,r3,r19 0007b414: 00511024 and r2,r2,r17 0007b418: 00621825 or r3,r3,r2 0007b41c: ac830000 sw r3,0x0000(r4) 0007b420: 94e20000 lhu r2,0x0000(r7) 0007b424: 8cc30000 lw r3,0x0000(r6) 0007b428: 30420fff andi r2,r2,0x0fff 0007b42c: 2442fed2 addiu r2,r2,0xfed2 0007b430: 00430018 mult r2,r3 0007b434: 00001812 mflo r3 0007b438: 00000000 nop 0007b43c: 00000000 nop 0007b440: 007e0018 mult r3,r30 0007b444: 00001010 mfhi r2 0007b448: 00431021 addu r2,r2,r3 0007b44c: 00021483 sra r2,r2,0x12 0007b450: 00031fc3 sra r3,r3,0x1f 0007b454: 00431023 subu r2,r2,r3 0007b458: 00021080 sll r2,r2,0x02 0007b45c: 02a21023 subu r2,r21,r2 0007b460: 8c43fffc lw r3,-0x0004(r2) 0007b464: 00912024 and r4,r4,r17 0007b468: 00731824 and r3,r3,r19 0007b46c: 00641825 or r3,r3,r4 0007b470: 0801ed29 j 0x0007b4a4 0007b474: ac43fffc sw r3,-0x0004(r2) 0007b478: 8c830000 lw r3,0x0000(r4) 0007b47c: 8ea20000 lw r2,0x0000(r21) 0007b480: 00731824 and r3,r3,r19 0007b484: 00511024 and r2,r2,r17 0007b488: 00621825 or r3,r3,r2 0007b48c: ac830000 sw r3,0x0000(r4) 0007b490: 8ea20000 lw r2,0x0000(r21) 0007b494: 00911824 and r3,r4,r17 0007b498: 00531024 and r2,r2,r19 0007b49c: 00431025 or r2,r2,r3 0007b4a0: aea20000 sw r2,0x0000(r21) 0007b4a4: 8fa80020 lw r8,0x0020(r29) 0007b4a8: 26940001 addiu r20,r20,0x0001 0007b4ac: 0288102a slt r2,r20,r8 0007b4b0: 1440ff05 bne r2,r0,0x0007b0c8 0007b4b4: 001410c0 sll r2,r20,0x03 0007b4b8: 8fbf0054 lw r31,0x0054(r29) # 0007b4bc: 8fbe0050 lw r30,0x0050(r29) 0007b4c0: 8fb7004c lw r23,0x004c(r29) 0007b4c4: 8fb60048 lw r22,0x0048(r29) 0007b4c8: 8fb50044 lw r21,0x0044(r29) 0007b4cc: 8fb40040 lw r20,0x0040(r29) 0007b4d0: 8fb3003c lw r19,0x003c(r29) 0007b4d4: 8fb20038 lw r18,0x0038(r29) 0007b4d8: 8fb10034 lw r17,0x0034(r29) 0007b4dc: 8fb00030 lw r16,0x0030(r29) 0007b4e0: 27bd0058 addiu r29,r29,0x0058 0007b4e4: 03e00008 jr r31 0007b4e8: 00000000 nop