Decompile func0f12955c
This commit is contained in:
parent
5c77d1d686
commit
8778aa25ba
|
|
@ -102,200 +102,82 @@ void func0f12939c(void)
|
|||
}
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel func0f12955c
|
||||
/* f12955c: 27bdff80 */ addiu $sp,$sp,-128
|
||||
/* f129560: 3c0e8009 */ lui $t6,%hi(g_Is4Mb)
|
||||
/* f129564: 91ce0af0 */ lbu $t6,%lo(g_Is4Mb)($t6)
|
||||
/* f129568: afb5002c */ sw $s5,0x2c($sp)
|
||||
/* f12956c: 24150001 */ addiu $s5,$zero,0x1
|
||||
/* f129570: afb40028 */ sw $s4,0x28($sp)
|
||||
/* f129574: afb30024 */ sw $s3,0x24($sp)
|
||||
/* f129578: afb20020 */ sw $s2,0x20($sp)
|
||||
/* f12957c: 00809025 */ or $s2,$a0,$zero
|
||||
/* f129580: 00c09825 */ or $s3,$a2,$zero
|
||||
/* f129584: 00e0a025 */ or $s4,$a3,$zero
|
||||
/* f129588: afbf003c */ sw $ra,0x3c($sp)
|
||||
/* f12958c: afbe0038 */ sw $s8,0x38($sp)
|
||||
/* f129590: afb70034 */ sw $s7,0x34($sp)
|
||||
/* f129594: afb60030 */ sw $s6,0x30($sp)
|
||||
/* f129598: afb1001c */ sw $s1,0x1c($sp)
|
||||
/* f12959c: 16ae0003 */ bne $s5,$t6,.L0f1295ac
|
||||
/* f1295a0: afb00018 */ sw $s0,0x18($sp)
|
||||
/* f1295a4: 10000090 */ b .L0f1297e8
|
||||
/* f1295a8: 00001025 */ or $v0,$zero,$zero
|
||||
.L0f1295ac:
|
||||
/* f1295ac: 00057880 */ sll $t7,$a1,0x2
|
||||
/* f1295b0: 01e57823 */ subu $t7,$t7,$a1
|
||||
/* f1295b4: 000f7880 */ sll $t7,$t7,0x2
|
||||
/* f1295b8: 01e57821 */ addu $t7,$t7,$a1
|
||||
/* f1295bc: 3c188008 */ lui $t8,%hi(var8007e3d0)
|
||||
/* f1295c0: 2718e3d0 */ addiu $t8,$t8,%lo(var8007e3d0)
|
||||
/* f1295c4: 000f7880 */ sll $t7,$t7,0x2
|
||||
/* f1295c8: 01f88821 */ addu $s1,$t7,$t8
|
||||
/* f1295cc: 8e39002c */ lw $t9,0x2c($s1)
|
||||
/* f1295d0: 0332082a */ slt $at,$t9,$s2
|
||||
/* f1295d4: 1420002f */ bnez $at,.L0f129694
|
||||
/* f1295d8: 00000000 */ nop
|
||||
/* f1295dc: 8e220030 */ lw $v0,0x30($s1)
|
||||
/* f1295e0: 00122080 */ sll $a0,$s2,0x2
|
||||
/* f1295e4: 00002825 */ or $a1,$zero,$zero
|
||||
/* f1295e8: 1840002a */ blez $v0,.L0f129694
|
||||
/* f1295ec: 00922023 */ subu $a0,$a0,$s2
|
||||
/* f1295f0: 00008025 */ or $s0,$zero,$zero
|
||||
/* f1295f4: 8e230024 */ lw $v1,0x24($s1)
|
||||
.L0f1295f8:
|
||||
/* f1295f8: 8468000e */ lh $t0,0xe($v1)
|
||||
/* f1295fc: 24a50001 */ addiu $a1,$a1,0x1
|
||||
/* f129600: 00a2082a */ slt $at,$a1,$v0
|
||||
/* f129604: 15000021 */ bnez $t0,.L0f12968c
|
||||
/* f129608: 24630010 */ addiu $v1,$v1,0x10
|
||||
/* f12960c: 00042080 */ sll $a0,$a0,0x2
|
||||
/* f129610: 2484000f */ addiu $a0,$a0,0xf
|
||||
/* f129614: 3489000f */ ori $t1,$a0,0xf
|
||||
/* f129618: 0c004aac */ jal func00012ab0
|
||||
/* f12961c: 3924000f */ xori $a0,$t1,0xf
|
||||
/* f129620: 8e2b0024 */ lw $t3,0x24($s1)
|
||||
/* f129624: 01706021 */ addu $t4,$t3,$s0
|
||||
/* f129628: ad820000 */ sw $v0,0x0($t4)
|
||||
/* f12962c: 8e2d0024 */ lw $t5,0x24($s1)
|
||||
/* f129630: 01b01821 */ addu $v1,$t5,$s0
|
||||
/* f129634: 8c6e0000 */ lw $t6,0x0($v1)
|
||||
/* f129638: 11c00012 */ beqz $t6,.L0f129684
|
||||
/* f12963c: 00000000 */ nop
|
||||
/* f129640: a472000c */ sh $s2,0xc($v1)
|
||||
/* f129644: 8e2f0024 */ lw $t7,0x24($s1)
|
||||
/* f129648: 01f0c021 */ addu $t8,$t7,$s0
|
||||
/* f12964c: a715000e */ sh $s5,0xe($t8)
|
||||
/* f129650: 8e390024 */ lw $t9,0x24($s1)
|
||||
/* f129654: 03304021 */ addu $t0,$t9,$s0
|
||||
/* f129658: ad130004 */ sw $s3,0x4($t0)
|
||||
/* f12965c: 8e290024 */ lw $t1,0x24($s1)
|
||||
/* f129660: 01305021 */ addu $t2,$t1,$s0
|
||||
/* f129664: ad540008 */ sw $s4,0x8($t2)
|
||||
/* f129668: 8e2b002c */ lw $t3,0x2c($s1)
|
||||
/* f12966c: 8e2d0024 */ lw $t5,0x24($s1)
|
||||
/* f129670: 01726023 */ subu $t4,$t3,$s2
|
||||
/* f129674: ae2c002c */ sw $t4,0x2c($s1)
|
||||
/* f129678: 01b07021 */ addu $t6,$t5,$s0
|
||||
/* f12967c: 1000005a */ b .L0f1297e8
|
||||
/* f129680: 8dc20000 */ lw $v0,0x0($t6)
|
||||
.L0f129684:
|
||||
/* f129684: 10000058 */ b .L0f1297e8
|
||||
/* f129688: 00001025 */ or $v0,$zero,$zero
|
||||
.L0f12968c:
|
||||
/* f12968c: 1420ffda */ bnez $at,.L0f1295f8
|
||||
/* f129690: 26100010 */ addiu $s0,$s0,0x10
|
||||
.L0f129694:
|
||||
/* f129694: 0fc07934 */ jal getNumChrs
|
||||
/* f129698: 00002825 */ or $a1,$zero,$zero
|
||||
/* f12969c: 0040a825 */ or $s5,$v0,$zero
|
||||
/* f1296a0: 18400039 */ blez $v0,.L0f129788
|
||||
/* f1296a4: 00009025 */ or $s2,$zero,$zero
|
||||
/* f1296a8: 0002b0c0 */ sll $s6,$v0,0x3
|
||||
/* f1296ac: 02c2b023 */ subu $s6,$s6,$v0
|
||||
/* f1296b0: 0016b080 */ sll $s6,$s6,0x2
|
||||
/* f1296b4: 02c2b023 */ subu $s6,$s6,$v0
|
||||
/* f1296b8: 0016b080 */ sll $s6,$s6,0x2
|
||||
/* f1296bc: 02c2b021 */ addu $s6,$s6,$v0
|
||||
/* f1296c0: 3c178006 */ lui $s7,%hi(g_ChrsA)
|
||||
/* f1296c4: 26f72988 */ addiu $s7,$s7,%lo(g_ChrsA)
|
||||
/* f1296c8: 0016b0c0 */ sll $s6,$s6,0x3
|
||||
/* f1296cc: 00009825 */ or $s3,$zero,$zero
|
||||
/* f1296d0: 241e0005 */ addiu $s8,$zero,0x5
|
||||
/* f1296d4: 27b40054 */ addiu $s4,$sp,0x54
|
||||
/* f1296d8: 8eef0000 */ lw $t7,0x0($s7)
|
||||
.L0f1296dc:
|
||||
/* f1296dc: 026f8021 */ addu $s0,$s3,$t7
|
||||
/* f1296e0: 8e180020 */ lw $t8,0x20($s0)
|
||||
/* f1296e4: 53000025 */ beqzl $t8,.L0f12977c
|
||||
/* f1296e8: 26730368 */ addiu $s3,$s3,0x368
|
||||
/* f1296ec: 8e02001c */ lw $v0,0x1c($s0)
|
||||
/* f1296f0: 50400022 */ beqzl $v0,.L0f12977c
|
||||
/* f1296f4: 26730368 */ addiu $s3,$s3,0x368
|
||||
/* f1296f8: 90590001 */ lbu $t9,0x1($v0)
|
||||
/* f1296fc: 33280080 */ andi $t0,$t9,0x80
|
||||
/* f129700: 5500001e */ bnezl $t0,.L0f12977c
|
||||
/* f129704: 26730368 */ addiu $s3,$s3,0x368
|
||||
/* f129708: 82090007 */ lb $t1,0x7($s0)
|
||||
/* f12970c: 57c9001b */ bnel $s8,$t1,.L0f12977c
|
||||
/* f129710: 26730368 */ addiu $s3,$s3,0x368
|
||||
/* f129714: 8e0a0030 */ lw $t2,0x30($s0)
|
||||
/* f129718: 2a410006 */ slti $at,$s2,0x6
|
||||
/* f12971c: 55400017 */ bnezl $t2,.L0f12977c
|
||||
/* f129720: 26730368 */ addiu $s3,$s3,0x368
|
||||
/* f129724: 10200005 */ beqz $at,.L0f12973c
|
||||
/* f129728: 00125880 */ sll $t3,$s2,0x2
|
||||
/* f12972c: 028b6021 */ addu $t4,$s4,$t3
|
||||
/* f129730: ad900000 */ sw $s0,0x0($t4)
|
||||
/* f129734: 10000010 */ b .L0f129778
|
||||
/* f129738: 26520001 */ addiu $s2,$s2,0x1
|
||||
.L0f12973c:
|
||||
/* f12973c: 0c004b70 */ jal random
|
||||
/* f129740: 00000000 */ nop
|
||||
/* f129744: 0052001b */ divu $zero,$v0,$s2
|
||||
/* f129748: 00001810 */ mfhi $v1
|
||||
/* f12974c: 00036880 */ sll $t5,$v1,0x2
|
||||
/* f129750: 16400002 */ bnez $s2,.L0f12975c
|
||||
/* f129754: 00000000 */ nop
|
||||
/* f129758: 0007000d */ break 0x7
|
||||
.L0f12975c:
|
||||
/* f12975c: 028d7021 */ addu $t6,$s4,$t5
|
||||
/* f129760: 00608825 */ or $s1,$v1,$zero
|
||||
/* f129764: 0fc0f341 */ jal chrEnableReap
|
||||
/* f129768: 8dc40000 */ lw $a0,0x0($t6)
|
||||
/* f12976c: 00117880 */ sll $t7,$s1,0x2
|
||||
/* f129770: 028fc021 */ addu $t8,$s4,$t7
|
||||
/* f129774: af100000 */ sw $s0,0x0($t8)
|
||||
.L0f129778:
|
||||
/* f129778: 26730368 */ addiu $s3,$s3,0x368
|
||||
.L0f12977c:
|
||||
/* f12977c: 0276082a */ slt $at,$s3,$s6
|
||||
/* f129780: 5420ffd6 */ bnezl $at,.L0f1296dc
|
||||
/* f129784: 8eef0000 */ lw $t7,0x0($s7)
|
||||
.L0f129788:
|
||||
/* f129788: 00128843 */ sra $s1,$s2,0x1
|
||||
/* f12978c: 12200015 */ beqz $s1,.L0f1297e4
|
||||
/* f129790: 27b40054 */ addiu $s4,$sp,0x54
|
||||
.L0f129794:
|
||||
/* f129794: 0c004b70 */ jal random
|
||||
/* f129798: 00000000 */ nop
|
||||
/* f12979c: 0052001b */ divu $zero,$v0,$s2
|
||||
/* f1297a0: 00001810 */ mfhi $v1
|
||||
/* f1297a4: 0003c880 */ sll $t9,$v1,0x2
|
||||
/* f1297a8: 02994021 */ addu $t0,$s4,$t9
|
||||
/* f1297ac: 8d090000 */ lw $t1,0x0($t0)
|
||||
/* f1297b0: 16400002 */ bnez $s2,.L0f1297bc
|
||||
/* f1297b4: 00000000 */ nop
|
||||
/* f1297b8: 0007000d */ break 0x7
|
||||
.L0f1297bc:
|
||||
/* f1297bc: 00602825 */ or $a1,$v1,$zero
|
||||
/* f1297c0: 11200006 */ beqz $t1,.L0f1297dc
|
||||
/* f1297c4: 00035080 */ sll $t2,$v1,0x2
|
||||
/* f1297c8: 028a8021 */ addu $s0,$s4,$t2
|
||||
/* f1297cc: 0fc0f341 */ jal chrEnableReap
|
||||
/* f1297d0: 8e040000 */ lw $a0,0x0($s0)
|
||||
/* f1297d4: ae000000 */ sw $zero,0x0($s0)
|
||||
/* f1297d8: 2631ffff */ addiu $s1,$s1,-1
|
||||
.L0f1297dc:
|
||||
/* f1297dc: 1620ffed */ bnez $s1,.L0f129794
|
||||
/* f1297e0: 00000000 */ nop
|
||||
.L0f1297e4:
|
||||
/* f1297e4: 00001025 */ or $v0,$zero,$zero
|
||||
.L0f1297e8:
|
||||
/* f1297e8: 8fbf003c */ lw $ra,0x3c($sp)
|
||||
/* f1297ec: 8fb00018 */ lw $s0,0x18($sp)
|
||||
/* f1297f0: 8fb1001c */ lw $s1,0x1c($sp)
|
||||
/* f1297f4: 8fb20020 */ lw $s2,0x20($sp)
|
||||
/* f1297f8: 8fb30024 */ lw $s3,0x24($sp)
|
||||
/* f1297fc: 8fb40028 */ lw $s4,0x28($sp)
|
||||
/* f129800: 8fb5002c */ lw $s5,0x2c($sp)
|
||||
/* f129804: 8fb60030 */ lw $s6,0x30($sp)
|
||||
/* f129808: 8fb70034 */ lw $s7,0x34($sp)
|
||||
/* f12980c: 8fbe0038 */ lw $s8,0x38($sp)
|
||||
/* f129810: 03e00008 */ jr $ra
|
||||
/* f129814: 27bd0080 */ addiu $sp,$sp,0x80
|
||||
);
|
||||
void *func0f12955c(s32 count, s32 index, s32 arg2, s32 arg3)
|
||||
{
|
||||
s32 i;
|
||||
s32 numchrs;
|
||||
s32 tally;
|
||||
s32 rand;
|
||||
u32 stack;
|
||||
struct chrdata *chrs[6];
|
||||
|
||||
if (IS4MB()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (count <= var8007e3d0[index].val2) {
|
||||
for (i = 0; i < var8007e3d0[index].numallocated; i++) {
|
||||
if (var8007e3d0[index].unk24[i].unk0e == 0) {
|
||||
var8007e3d0[index].unk24[i].unk00 = func00012ab0(ALIGN16(count * 0xc));
|
||||
|
||||
if (var8007e3d0[index].unk24[i].unk00) {
|
||||
var8007e3d0[index].unk24[i].unk0c = count;
|
||||
var8007e3d0[index].unk24[i].unk0e = 1;
|
||||
var8007e3d0[index].unk24[i].unk04 = arg2;
|
||||
var8007e3d0[index].unk24[i].unk08 = arg3;
|
||||
var8007e3d0[index].val2 -= count;
|
||||
|
||||
return var8007e3d0[index].unk24[i].unk00;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build an array of all corpses. If the array becomes full then enable
|
||||
// reaping on a random corpose and replace its entry in the array.
|
||||
// So at the end, we'll have an array of up to six unreapable corpses and
|
||||
// all other corpses will be flagged for reaping.
|
||||
numchrs = getNumChrs();
|
||||
tally = 0;
|
||||
|
||||
for (i = 0; i < numchrs; i++) {
|
||||
struct chrdata *chr = &g_ChrsA[i];
|
||||
|
||||
if (chr->model
|
||||
&& chr->prop
|
||||
&& (chr->prop->flags & PROPFLAG_80) == 0
|
||||
&& chr->actiontype == ACT_DEAD
|
||||
&& chr->act_dead.allowreap == false) {
|
||||
if (tally < 6) {
|
||||
chrs[tally] = chr;
|
||||
tally++;
|
||||
} else {
|
||||
rand = random() % tally;
|
||||
chrEnableReap(chrs[rand]);
|
||||
chrs[rand] = chr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enable reaping on half the remaining corpses.
|
||||
// I'm reusing the rand and i variables here in order to get a match.
|
||||
// The original code likely didn't reuse them.
|
||||
rand = tally >> 1;
|
||||
|
||||
while (rand) {
|
||||
i = random() % tally;
|
||||
|
||||
if (chrs[i]) {
|
||||
chrEnableReap(chrs[i]);
|
||||
chrs[i] = NULL;
|
||||
rand--;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void func0f129818(s32 arg0, void *arg1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
void func0f129210(void *find, void *replacement);
|
||||
void func0f12939c(void);
|
||||
u32 func0f12955c(void);
|
||||
void *func0f12955c(s32 count, s32 index, s32 arg2, s32 arg3);
|
||||
void func0f129818(s32 arg0, void *arg1);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ u32 func00012914(void);
|
|||
void func00012a0c(void);
|
||||
void func00012a14(void *ptr, u32 arg1);
|
||||
void func00012a8c(void);
|
||||
void *func00012ab0(u32 size); // some kind of malloc for save files?
|
||||
void *func00012ab0(u32 size);
|
||||
u32 func00012c3c(void);
|
||||
void func00012cb4(void *arg0, s32 arg1);
|
||||
u32 func00012cdc(void);
|
||||
|
|
|
|||
Loading…
Reference in New Issue