Initialize units battlefield data
Jump to navigation
Jump to search
0017f388: 27bdff98 addiu r29,r29,0xff98 0017f38c: afbe0060 sw r30,0x0060(r29) 0017f390: 00a0f021 addu r30,r5,r0 0017f394: afb7005c sw r23,0x005c(r29) 0017f398: 0000b821 addu r23,r0,r0 0017f39c: afb50054 sw r21,0x0054(r29) 0017f3a0: afbf0064 sw r31,0x0064(r29) 0017f3a4: afb60058 sw r22,0x0058(r29) 0017f3a8: afb40050 sw r20,0x0050(r29) 0017f3ac: afb3004c sw r19,0x004c(r29) 0017f3b0: afb20048 sw r18,0x0048(r29) 0017f3b4: afb10044 sw r17,0x0044(r29) 0017f3b8: afb00040 sw r16,0x0040(r29) 0017f3bc: 3c018006 lui r1,0x8006 0017f3c0: ac246234 sw r4,0x6234(r1) store pointer to units party ID? 0017f3c4: 13c00006 beq r30,r0,0x0017f3e0 branch if preset r5 = 0 0017f3c8: 34150001 ori r21,r0,0x0001 0017f3cc: 341600fe ori r22,r0,0x00fe 0017f3d0: 2408ffff addiu r8,r0,0xffff 0017f3d4: afa80030 sw r8,0x0030(r29) 0017f3d8: 0805fcfd j 0x0017f3f4 0017f3dc: afa00038 sw r0,0x0038(r29) 0017f3e0: 34160078 ori r22,r0,0x0078 0017f3e4: 34080001 ori r8,r0,0x0001 0017f3e8: afa80030 sw r8,0x0030(r29) 0017f3ec: 34080010 ori r8,r0,0x0010 0017f3f0: afa80038 sw r8,0x0038(r29) 0017f3f4: 00009021 addu r18,r0,r0 0017f3f8: 341400ff ori r20,r0,0x00ff 0017f3fc: 00009821 addu r19,r0,r0 0017f400: 8fa80038 lw r8,0x0038(r29) 0017f404: 3c038019 lui r3,0x8019 0017f408: 246308cc addiu r3,r3,0x08cc 0017f40c: 02488821 addu r17,r18,r8 0017f410: 001110c0 sll r2,r17,0x03 0017f414: 00511023 subu r2,r2,r17 0017f418: 00021180 sll r2,r2,0x06 0017f41c: 00438021 addu r16,r2,r3 0017f420: a211018a sb r17,0x018a(r16) Store ENTD ID 0017f424: 3c028006 lui r2,0x8006 0017f428: 8c426234 lw r2,0x6234(r2) load party ID address 0017f42c: 00000000 nop 0017f430: 02621021 addu r2,r19,r2 go to next word (r19 increases by 4 each loop) 0017f434: 90420000 lbu r2,0x0000(r2) load Party ID 0017f438: 00000000 nop 0017f43c: 1054004c beq r2,r20,0x0017f570 branch if party ID = 0xff 0017f440: 34080001 ori r8,r0,0x0001 0017f444: a2110001 sb r17,0x0001(r16) store Unit ID = ENTD ID? 0017f448: a2080183 sb r8,0x0183(r16) store unit exists 0017f44c: 3c028006 lui r2,0x8006 0017f450: 8c426234 lw r2,0x6234(r2) 0017f454: 02002021 addu r4,r16,r0 0017f458: 02621021 addu r2,r19,r2 0017f45c: 90450000 lbu r5,0x0000(r2) load Party ID 0017f460: 0c016a35 jal 0x0005a8d4 Initialize Job data 0017f464: 00003021 addu r6,r0,r0 0017f468: 10400005 beq r2,r0,0x0017f480 0017f46c: 02202021 addu r4,r17,r0 r4 = ENTD ID? 0017f470: 0c017a3a jal 0x0005e8e8 xfer r4 to r5, r4 = 0x03 0017f474: 262401f4 addiu r4,r17,0x01f4 ENTD + 0x1f4 0017f478: 0805fd5c j 0x0017f570 0017f47c: 02f5b821 addu r23,r23,r21 0017f480: 3c058006 lui r5,0x8006 0017f484: 8ca56234 lw r5,0x6234(r5) 0017f488: 0c05fd90 jal 0x0017f640 set unit placement and validate map location 0017f48c: 02652821 addu r5,r19,r5 0017f490: 10400005 beq r2,r0,0x0017f4a8 0017f494: 02002021 addu r4,r16,r0 0017f498: 0c017a3a jal 0x0005e8e8 xfer r4 to r5, r4 = 0x03 0017f49c: 26240190 addiu r4,r17,0x0190 0017f4a0: 0805fd5c j 0x0017f570 0017f4a4: 02f5b821 addu r23,r23,r21 0017f4a8: 0c017822 jal 0x0005e088 calculate units palette/portrait (return portrait) 0017f4ac: 27a50028 addiu r5,r29,0x0028 0017f4b0: 92030000 lbu r3,0x0000(r16) load spriteset 0017f4b4: 00403021 addu r6,r2,r0 0017f4b8: 306200ff andi r2,r3,0x00ff 0017f4bc: 10400003 beq r2,r0,0x0017f4cc branch if spriteset = 0x00 0017f4c0: 2c420004 sltiu r2,r2,0x0004 0017f4c4: 14400004 bne r2,r0,0x0017f4d8 branch if not ramza spriteset 0017f4c8: 00000000 nop 0017f4cc: 8fa80030 lw r8,0x0030(r29) load ?? (chapter?) 0017f4d0: 02c01821 addu r3,r22,r0 0017f4d4: 0068b021 addu r22,r3,r8 0017f4d8: 13c00006 beq r30,r0,0x0017f4f4 branch if preset value (r5) = 00 0017f4dc: a2030161 sb r3,0x0161(r16) store ENTD ID 0017f4e0: 34020018 ori r2,r0,0x0018 0017f4e4: 34080001 ori r8,r0,0x0001 0017f4e8: a2020005 sb r2,0x0005(r16) store ENTD flags = 0x18 (red team and control) 0017f4ec: a20201ba sb r2,0x01ba(r16) store modified ENTD flags 0017f4f0: a2080004 sb r8,0x0004(r16) Store palette = player team 0017f4f4: 3c028006 lui r2,0x8006 0017f4f8: 8c426234 lw r2,0x6234(r2) 0017f4fc: 00000000 nop 0017f500: 02621021 addu r2,r19,r2 0017f504: 90420003 lbu r2,0x0003(r2) 0017f508: 00000000 nop 0017f50c: 30420010 andi r2,r2,0x0010 0017f510: 10400004 beq r2,r0,0x0017f524 0017f514: 30c200ff andi r2,r6,0x00ff 0017f518: a2000183 sb r0,0x0183(r16) store unit doesn't exist, but can later? 0017f51c: 0805fd5e j 0x0017f578 0017f520: a2140001 sb r20,0x0001(r16) store unit ID = 0xff 0017f524: 92040047 lbu r4,0x0047(r16) 0017f528: 92050048 lbu r5,0x0048(r16) 0017f52c: 96070048 lhu r7,0x0048(r16) Load map location data 0017f530: afa20010 sw r2,0x0010(r29) 0017f534: 93a20028 lbu r2,0x0028(r29) 0017f538: afb40018 sw r20,0x0018(r29) 0017f53c: afb0001c sw r16,0x001c(r29) 0017f540: afa00020 sw r0,0x0020(r29) 0017f544: 000733c2 srl r6,r7,0x0f 0017f548: 00073a02 srl r7,r7,0x08 0017f54c: 30e7000f andi r7,r7,0x000f 0017f550: 0c023950 jal 0x0008e540 ??? 0017f554: afa20014 sw r2,0x0014(r29) 0017f558: 02002021 addu r4,r16,r0 0017f55c: 0c0177f5 jal 0x0005dfd4 Minimum SP Capping/War Trophy Nulling/Status Initialization 0017f560: 34050001 ori r5,r0,0x0001 0017f564: 34080001 ori r8,r0,0x0001 0017f568: 0805fd5e j 0x0017f578 0017f56c: a2080183 sb r8,0x0183(r16) store unit exists 0017f570: a2140001 sb r20,0x0001(r16) store unit ID = 0xff 0017f574: a2140183 sb r20,0x0183(r16) store unit cannot appear in battle 0017f578: 26730004 addiu r19,r19,0x0004 r19 + 4 0017f57c: 26520001 addiu r18,r18,0x0001 0017f580: 2a420005 slti r2,r18,0x0005 0017f584: 1440ff9e bne r2,r0,0x0017f400 0017f588: 0015a840 sll r21,r21,0x01 0017f58c: 13c0000d beq r30,r0,0x0017f5c4 0017f590: 02e01021 addu r2,r23,r0 0017f594: 34120005 ori r18,r0,0x0005 0017f598: 340400ff ori r4,r0,0x00ff 0017f59c: 3c038019 lui r3,0x8019 0017f5a0: 2463118c addiu r3,r3,0x118c load 6th units data 0017f5a4: a072018a sb r18,0x018a(r3) store ENTD = 0x05 0017f5a8: a0640001 sb r4,0x0001(r3) store Unit ID = 0xff 0017f5ac: a0640183 sb r4,0x0183(r3) store unit doesn't exist 0017f5b0: 26520001 addiu r18,r18,0x0001 0017f5b4: 2a420010 slti r2,r18,0x0010 0017f5b8: 1440fffa bne r2,r0,0x0017f5a4 perform for the rest of units 0017f5bc: 246301c0 addiu r3,r3,0x01c0 0017f5c0: 02e01021 addu r2,r23,r0 0017f5c4: 8fbf0064 lw r31,0x0064(r29) 0017f5c8: 8fbe0060 lw r30,0x0060(r29) 0017f5cc: 8fb7005c lw r23,0x005c(r29) 0017f5d0: 8fb60058 lw r22,0x0058(r29) 0017f5d4: 8fb50054 lw r21,0x0054(r29) 0017f5d8: 8fb40050 lw r20,0x0050(r29) 0017f5dc: 8fb3004c lw r19,0x004c(r29) 0017f5e0: 8fb20048 lw r18,0x0048(r29) 0017f5e4: 8fb10044 lw r17,0x0044(r29) 0017f5e8: 8fb00040 lw r16,0x0040(r29) 0017f5ec: 27bd0068 addiu r29,r29,0x0068 0017f5f0: 03e00008 jr r31 0017f5f4: 00000000 nop