World BuildFT4

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   arguments:
#   r4    -> pointer to X, Y, W, H (halfwords)
#   r5    -> u coordinate
#   r6    -> v coordinate
#   r7    -> pointer to RGB tint (null if empty)
#   s(10) -> semi transparent flag
#   s(14) -> tpage
#   s(16) -> clut
#   s(18) -> ?
#
#   return: I don't think it returns anything of consequence.


0012c6a8: 27bdffc8 addiu r29,r29,0xffc8         stack - 0x38
0012c6ac: afb7002c sw r23,0x002c(r29)
0012c6b0: 8fb70054 lw r23,0x0054(r29)
0012c6b4: afb10014 sw r17,0x0014(r29)
0012c6b8: 00808821 addu r17,r4,r0
0012c6bc: afb60028 sw r22,0x0028(r29)
0012c6c0: 97b6004c lhu r22,0x004c(r29)
0012c6c4: 3c04801d lui r4,0x801d
0012c6c8: 9484d1cc lhu r4,-0x2e34(r4)
0012c6cc: afb50024 sw r21,0x0024(r29)
0012c6d0: 97b50050 lhu r21,0x0050(r29)
0012c6d4: 3c03801d lui r3,0x801d
0012c6d8: 8c63d528 lw r3,-0x2ad8(r3)
0012c6dc: afb3001c sw r19,0x001c(r29)
0012c6e0: 00a09821 addu r19,r5,r0
0012c6e4: afb40020 sw r20,0x0020(r29)
0012c6e8: 00c0a021 addu r20,r6,r0
0012c6ec: afb20018 sw r18,0x0018(r29)
0012c6f0: 00e09021 addu r18,r7,r0                ptr to RGB shading
0012c6f4: afbf0030 sw r31,0x0030(r29)
0012c6f8: afb00010 sw r16,0x0010(r29)
0012c6fc: 24820001 addiu r2,r4,0x0001
0012c700: 3c01801d lui r1,0x801d
0012c704: a422d1cc sh r2,-0x2e34(r1)
0012c708: 00041080 sll r2,r4,0x02
0012c70c: 00441021 addu r2,r2,r4
0012c710: 8c630010 lw r3,0x0010(r3)
0012c714: 000210c0 sll r2,r2,0x03
0012c718: 1240000d beq r18,r0,0x0012c750         
0012c71c: 00438021 addu r16,r2,r3                primative address
0012c720: 02002021 addu r4,r16,r0
0012c724: 0c008f24 jal 0x00023c90                P11 SetShadeTex
0012c728: 00002821 addu r5,r0,r0                 unshaded texturing
0012c72c: 92420000 lbu r2,0x0000(r18)            r
0012c730: 00000000 nop
0012c734: a2020004 sb r2,0x0004(r16)
0012c738: 92420001 lbu r2,0x0001(r18)            g
0012c73c: 00000000 nop
0012c740: a2020005 sb r2,0x0005(r16)
0012c744: 92420002 lbu r2,0x0002(r18)            b
0012c748: 0804b1d7 j 0x0012c75c
0012c74c: a2020006 sb r2,0x0006(r16)
0012c750: 02002021 addu r4,r16,r0
0012c754: 0c008f24 jal 0x00023c90                P11 SetShadeTex
0012c758: 34050001 ori r5,r0,0x0001              shaded texturing
0012c75c: 8fa50048 lw r5,0x0048(r29)             if semi trans
0012c760: 0c008f1a jal 0x00023c68                P10 SetSemiTrans
0012c764: 02002021 addu r4,r16,r0  
0012c768: 96220000 lhu r2,0x0000(r17)
0012c76c: 00000000 nop
0012c770: 24420080 addiu r2,r2,0x0080
0012c774: a6020008 sh r2,0x0008(r16)
0012c778: 96220002 lhu r2,0x0002(r17)
0012c77c: 00000000 nop
0012c780: a602000a sh r2,0x000a(r16)
0012c784: 96220004 lhu r2,0x0004(r17)
0012c788: 96230000 lhu r3,0x0000(r17)
0012c78c: 24420080 addiu r2,r2,0x0080
0012c790: 00621821 addu r3,r3,r2
0012c794: a6030010 sh r3,0x0010(r16)
0012c798: 96220002 lhu r2,0x0002(r17)
0012c79c: 00000000 nop
0012c7a0: a6020012 sh r2,0x0012(r16)
0012c7a4: 96220000 lhu r2,0x0000(r17)
0012c7a8: 00000000 nop
0012c7ac: 24420080 addiu r2,r2,0x0080
0012c7b0: a6020018 sh r2,0x0018(r16)
0012c7b4: 96220002 lhu r2,0x0002(r17)
0012c7b8: 96230006 lhu r3,0x0006(r17)
0012c7bc: 00000000 nop
0012c7c0: 00431021 addu r2,r2,r3
0012c7c4: a602001a sh r2,0x001a(r16)
0012c7c8: 96220004 lhu r2,0x0004(r17)
0012c7cc: 96230000 lhu r3,0x0000(r17)
0012c7d0: 24420080 addiu r2,r2,0x0080
0012c7d4: 00621821 addu r3,r3,r2
0012c7d8: a6030020 sh r3,0x0020(r16)
0012c7dc: 96220002 lhu r2,0x0002(r17)
0012c7e0: 96230006 lhu r3,0x0006(r17)
0012c7e4: a213000c sb r19,0x000c(r16)
0012c7e8: a214000d sb r20,0x000d(r16)
0012c7ec: 00431021 addu r2,r2,r3
0012c7f0: a6020022 sh r2,0x0022(r16)
0012c7f4: 92220004 lbu r2,0x0004(r17)
0012c7f8: a2140015 sb r20,0x0015(r16)
0012c7fc: a213001c sb r19,0x001c(r16)
0012c800: 02621021 addu r2,r19,r2
0012c804: a2020014 sb r2,0x0014(r16)
0012c808: 92220006 lbu r2,0x0006(r17)
0012c80c: 3c0500ff lui r5,0x00ff
0012c810: 02821021 addu r2,r20,r2
0012c814: a202001d sb r2,0x001d(r16)
0012c818: 92220004 lbu r2,0x0004(r17)
0012c81c: 34a5ffff ori r5,r5,0xffff
0012c820: 02621021 addu r2,r19,r2
0012c824: a2020024 sb r2,0x0024(r16)
0012c828: 92220006 lbu r2,0x0006(r17)
0012c82c: 00172080 sll r4,r23,0x02
0012c830: a615000e sh r21,0x000e(r16)
0012c834: 02821021 addu r2,r20,r2
0012c838: a2020025 sb r2,0x0025(r16)
0012c83c: a6160016 sh r22,0x0016(r16)
0012c840: 3c07801d lui r7,0x801d
0012c844: 8ce7d528 lw r7,-0x2ad8(r7)
0012c848: 3c06ff00 lui r6,0xff00
0012c84c: 8ce20000 lw r2,0x0000(r7)
0012c850: 8e030000 lw r3,0x0000(r16)
0012c854: 00821021 addu r2,r4,r2
0012c858: 8c420000 lw r2,0x0000(r2)
0012c85c: 00661824 and r3,r3,r6
0012c860: 00451024 and r2,r2,r5
0012c864: 00621825 or r3,r3,r2
0012c868: ae030000 sw r3,0x0000(r16)       # store polygon tag
0012c86c: 8ce20000 lw r2,0x0000(r7)
0012c870: 00000000 nop
0012c874: 00822021 addu r4,r4,r2
0012c878: 8c820000 lw r2,0x0000(r4)
0012c87c: 02052824 and r5,r16,r5
0012c880: 00461024 and r2,r2,r6
0012c884: 00451025 or r2,r2,r5
0012c888: ac820000 sw r2,0x0000(r4)
0012c88c: 8fbf0030 lw r31,0x0030(r29)
0012c890: 8fb7002c lw r23,0x002c(r29)
0012c894: 8fb60028 lw r22,0x0028(r29)
0012c898: 8fb50024 lw r21,0x0024(r29)
0012c89c: 8fb40020 lw r20,0x0020(r29)
0012c8a0: 8fb3001c lw r19,0x001c(r29)
0012c8a4: 8fb20018 lw r18,0x0018(r29)
0012c8a8: 8fb10014 lw r17,0x0014(r29)
0012c8ac: 8fb00010 lw r16,0x0010(r29)
0012c8b0: 27bd0038 addiu r29,r29,0x0038
0012c8b4: 03e00008 jr r31
0012c8b8: 00000000 nop