Get Formation Graphic Entry
Jump to navigation
Jump to search
# ROUTINE: GET FORMATION GRAPHIC ENTRY # Parameters: # r4 = (formationUnitIndex) Formation unit index # r5 = (buffer) Buffer in which to write formation entry 801256c8: 27bdffe0 addiu r29,r29,-0x0020 801256cc: afb00010 sw r16,0x0010(r29) 801256d0: 00a08021 addu r16,r5,r0 # p2 801256d4: 00041400 sll r2,r4,0x10 801256d8: 00021383 sra r2,r2,0x0e # formationUnitIndex * 4 801256dc: afbf0018 sw r31,0x0018(r29) 801256e0: afb10014 sw r17,0x0014(r29) 801256e4: 3c01801d lui r1,0x801d 801256e8: 00220821 addu r1,r1,r2 801256ec: 8c25d5ec lw r5,-0x2a14(r1) # formationUnit = formationUnits[formationUnitIndex] 801256f0: 00000000 nop 801256f4: 84a30024 lh r3,0x0024(r5) # formationUnit.JobID 801256f8: 34020090 ori r2,r0,0x0090 801256fc: 10620007 beq r3,r2,0x8012571c 80125700: 00808821 addu r17,r4,r0 # formationUnitIndex # if (formationUnit.JobID == 0x90) // Byblos # index = 0x4e 80125704: 34020091 ori r2,r0,0x0091 80125708: 10620027 beq r3,r2,0x801257a8 # else if (formationUnit.JobID == 0x91) // Steel Giant 8012570c: 34020052 ori r2,r0,0x0052 # index = 0x52 80125710: 34020096 ori r2,r0,0x0096 80125714: 14620003 bne r3,r2,0x80125724 # else if (formationUnit.JobID == 0x96) // Apanda 80125718: 00000000 nop 8012571c: 080495ea j 0x801257a8 80125720: 3402004e ori r2,r0,0x004e # index = 0x4e 80125724: 34020097 ori r2,r0,0x0097 80125728: 1062001f beq r3,r2,0x801257a8 # else if (formationUnit.JobID == 0x97) // Serpentarius 8012572c: 3402004f ori r2,r0,0x004f # index = 0x4f 80125730: 34020099 ori r2,r0,0x0099 80125734: 1062001c beq r3,r2,0x801257a8 # else if (formationUnit.JobID == 0x99) // Archaic Demon 80125738: 34020051 ori r2,r0,0x0051 # index = 0x51 8012573c: 3402009a ori r2,r0,0x009a 80125740: 10620019 beq r3,r2,0x801257a8 # else if (formationUnit.JobID == 0x9a) // Ultima Demon 80125744: 34020051 ori r2,r0,0x0051 # index = 0x51 80125748: 34020048 ori r2,r0,0x0048 8012574c: 10620016 beq r3,r2,0x801257a8 # else if (formationUnit.JobID == 0x48) // Holy Dragon 80125750: 3402004c ori r2,r0,0x004c # index = 0x4c 80125754: 90a40072 lbu r4,0x0072(r5) # formationUnit.BaseClass 80125758: 34020082 ori r2,r0,0x0082 8012575c: 14820004 bne r4,r2,0x80125770 # else if (formationUnit.BaseClass == 0x82) { // Other Monster 80125760: 00000000 nop 80125764: 90a2011e lbu r2,0x011e(r5) # formationUnit.Graphic 80125768: 080495ea j 0x801257a8 8012576c: 2442003d addiu r2,r2,0x003d # index = formationUnit.Graphic + 0x3d # } 80125770: 2c82004a sltiu r2,r4,0x004a 80125774: 10400006 beq r2,r0,0x80125790 80125778: 02003021 addu r6,r16,r0 # else if (formationUnit.BaseClass < 0x4a) { // Special Character 8012577c: 3c018019 lui r1,0x8019 80125780: 00240821 addu r1,r1,r4 80125784: 9022de34 lbu r2,-0x21cc(r1) # index = *0x8018de34 + formationUnit.BaseClass 80125788: 080495eb j 0x801257ac 8012578c: 00022040 sll r4,r2,0x01 # } else { 80125790: 00602021 addu r4,r3,r0 80125794: 90a50070 lbu r5,0x0070(r5) 80125798: 0c049629 jal 0x801258a4 # Get Formation Sprite Entry (formationUnit.JobID, formationUnit.Flags & FLAG_FEMALE, buffer); 8012579c: 30a50040 andi r5,r5,0x0040 801257a0: 0804960b j 0x8012582c # return; 801257a4: 00000000 nop # } 801257a8: 00022040 sll r4,r2,0x01 # index * 2 801257ac: 00822021 addu r4,r4,r2 # index * 3 801257b0: 00042080 sll r4,r4,0x02 # index * 12 801257b4: 3c028019 lui r2,0x8019 801257b8: 2442da44 addiu r2,r2,-0x25bc # 0x8018da44 801257bc: 00822021 addu r4,r4,r2 # 0x8018da44 + (index * 12) 801257c0: 02002821 addu r5,r16,r0 # buffer 801257c4: 0c0088b7 jal 0x800222dc # bcopy (0x8018da44 + (index * 12), buffer, 12); 801257c8: 3406000c ori r6,r0,0x000c # 12 801257cc: 00111400 sll r2,r17,0x10 801257d0: 00021383 sra r2,r2,0x0e # formationUnitIndex * 4 801257d4: 3c01801d lui r1,0x801d 801257d8: 00220821 addu r1,r1,r2 801257dc: 8c22d5ec lw r2,-0x2a14(r1) # formationUnits[formationUnitIndex] 801257e0: 00000000 nop 801257e4: 8444002c lh r4,0x002c(r2) # formationUnits[formationUnitIndex].PartyUnitIndex 801257e8: 0c042432 jal 0x801090c8 # paletteIndex = Find Formation Palette Index (formationUnits[formationUnitIndex].PartyUnitIndex); 801257ec: 00000000 nop 801257f0: 00021400 sll r2,r2,0x10 801257f4: 00021c03 sra r3,r2,0x10 # paletteIndex 801257f8: 04610002 bgez r3,0x80125804 801257fc: 00601021 addu r2,r3,r0 80125800: 24620003 addiu r2,r3,0x0003 80125804: 00022883 sra r5,r2,0x02 80125808: 00051080 sll r2,r5,0x02 8012580c: 00621023 subu r2,r3,r2 # paletteIndex % 4 (modulus) 80125810: 00021100 sll r2,r2,0x04 # (paletteIndex % 4) << 4 80125814: 24420140 addiu r2,r2,0x0140 # ((paletteIndex % 4) << 4) + 320 80125818: 00022400 sll r4,r2,0x10 8012581c: 00042403 sra r4,r4,0x10 80125820: 0c008e95 jal 0x80023a54 # result = P01 GetClut (((paletteIndex % 4) << 4) + 320, 240); // ((paletteIndex % 4) + 20) + 15360 (0x3C00) 80125824: 24a500e0 addiu r5,r5,0x00e0 80125828: a6020008 sh r2,0x0008(r16) # buffer[8] = VRAM palette 8012582c: 8fbf0018 lw r31,0x0018(r29) 80125830: 8fb10014 lw r17,0x0014(r29) 80125834: 8fb00010 lw r16,0x0010(r29) 80125838: 27bd0020 addiu r29,r29,0x0020 8012583c: 03e00008 jr r31 80125840: 00000000 nop