Decompiled func_8001D6E4

This commit is contained in:
David Benepe
2021-06-23 10:23:55 -05:00
parent 9460937a46
commit d7c3a819c4
2 changed files with 69 additions and 84 deletions
@@ -1,83 +0,0 @@
glabel func_8001D6E4
/* 01E2E4 8001D6E4 27BDFFD0 */ addiu $sp, $sp, -0x30
/* 01E2E8 8001D6E8 AFBF0024 */ sw $ra, 0x24($sp)
/* 01E2EC 8001D6EC AFB10020 */ sw $s1, 0x20($sp)
/* 01E2F0 8001D6F0 AFB0001C */ sw $s0, 0x1c($sp)
/* 01E2F4 8001D6F4 AFA60038 */ sw $a2, 0x38($sp)
/* 01E2F8 8001D6F8 84880028 */ lh $t0, 0x28($a0)
/* 01E2FC 8001D6FC 44876000 */ mtc1 $a3, $f12
/* 01E300 8001D700 00A08025 */ move $s0, $a1
/* 01E304 8001D704 00808825 */ move $s1, $a0
/* 01E308 8001D708 00003825 */ move $a3, $zero
/* 01E30C 8001D70C 00004825 */ move $t1, $zero
/* 01E310 8001D710 19000018 */ blez $t0, .L8001D774
/* 01E314 8001D714 00001825 */ move $v1, $zero
/* 01E318 8001D718 8C860038 */ lw $a2, 0x38($a0)
/* 01E31C 8001D71C 240400FF */ li $a0, 255
/* 01E320 8001D720 2405000C */ li $a1, 12
.L8001D724:
/* 01E324 8001D724 00650019 */ multu $v1, $a1
/* 01E328 8001D728 24630001 */ addiu $v1, $v1, 1
/* 01E32C 8001D72C 00035400 */ sll $t2, $v1, 0x10
/* 01E330 8001D730 000A1C03 */ sra $v1, $t2, 0x10
/* 01E334 8001D734 0068082A */ slt $at, $v1, $t0
/* 01E338 8001D738 00007012 */ mflo $t6
/* 01E33C 8001D73C 00CE1021 */ addu $v0, $a2, $t6
/* 01E340 8001D740 904F0006 */ lbu $t7, 6($v0)
/* 01E344 8001D744 00000000 */ nop
/* 01E348 8001D748 108F0002 */ beq $a0, $t7, .L8001D754
/* 01E34C 8001D74C 00000000 */ nop
/* 01E350 8001D750 2407FFFF */ li $a3, -1
.L8001D754:
/* 01E354 8001D754 8C580008 */ lw $t8, 8($v0)
/* 01E358 8001D758 00000000 */ nop
/* 01E35C 8001D75C 33198000 */ andi $t9, $t8, 0x8000
/* 01E360 8001D760 13200002 */ beqz $t9, .L8001D76C
/* 01E364 8001D764 00000000 */ nop
/* 01E368 8001D768 2409FFFF */ li $t1, -1
.L8001D76C:
/* 01E36C 8001D76C 1420FFED */ bnez $at, .L8001D724
/* 01E370 8001D770 00000000 */ nop
.L8001D774:
/* 01E374 8001D774 10E00019 */ beqz $a3, .L8001D7DC
/* 01E378 8001D778 00000000 */ nop
/* 01E37C 8001D77C 8E0C0040 */ lw $t4, 0x40($s0)
/* 01E380 8001D780 87A6003A */ lh $a2, 0x3a($sp)
/* 01E384 8001D784 918D0071 */ lbu $t5, 0x71($t4)
/* 01E388 8001D788 02002025 */ move $a0, $s0
/* 01E38C 8001D78C 11A0000E */ beqz $t5, .L8001D7C8
/* 01E390 8001D790 02202825 */ move $a1, $s1
/* 01E394 8001D794 3C013F80 */ li $at, 0x3F800000 # 1.000000
/* 01E398 8001D798 44812000 */ mtc1 $at, $f4
/* 01E39C 8001D79C 87A6003A */ lh $a2, 0x3a($sp)
/* 01E3A0 8001D7A0 02002025 */ move $a0, $s0
/* 01E3A4 8001D7A4 02202825 */ move $a1, $s1
/* 01E3A8 8001D7A8 02003825 */ move $a3, $s0
/* 01E3AC 8001D7AC E7AC0010 */ swc1 $f12, 0x10($sp)
/* 01E3B0 8001D7B0 A7A9002E */ sh $t1, 0x2e($sp)
/* 01E3B4 8001D7B4 0C007603 */ jal func_8001D80C
/* 01E3B8 8001D7B8 E7A40014 */ swc1 $f4, 0x14($sp)
/* 01E3BC 8001D7BC 87A9002E */ lh $t1, 0x2e($sp)
/* 01E3C0 8001D7C0 10000006 */ b .L8001D7DC
/* 01E3C4 8001D7C4 00000000 */ nop
.L8001D7C8:
/* 01E3C8 8001D7C8 44076000 */ mfc1 $a3, $f12
/* 01E3CC 8001D7CC 0C0091D1 */ jal func_80024744
/* 01E3D0 8001D7D0 A7A9002E */ sh $t1, 0x2e($sp)
/* 01E3D4 8001D7D4 87A9002E */ lh $t1, 0x2e($sp)
/* 01E3D8 8001D7D8 00000000 */ nop
.L8001D7DC:
/* 01E3DC 8001D7DC 11200007 */ beqz $t1, .L8001D7FC
/* 01E3E0 8001D7E0 8FBF0024 */ lw $ra, 0x24($sp)
/* 01E3E4 8001D7E4 86050004 */ lh $a1, 4($s0)
/* 01E3E8 8001D7E8 86060002 */ lh $a2, 2($s0)
/* 01E3EC 8001D7EC 86070000 */ lh $a3, ($s0)
/* 01E3F0 8001D7F0 0C007755 */ jal func_8001DD54
/* 01E3F4 8001D7F4 02202025 */ move $a0, $s1
/* 01E3F8 8001D7F8 8FBF0024 */ lw $ra, 0x24($sp)
.L8001D7FC:
/* 01E3FC 8001D7FC 8FB0001C */ lw $s0, 0x1c($sp)
/* 01E400 8001D800 8FB10020 */ lw $s1, 0x20($sp)
/* 01E404 8001D804 03E00008 */ jr $ra
/* 01E408 8001D808 27BD0030 */ addiu $sp, $sp, 0x30
+69 -1
View File
@@ -279,6 +279,40 @@ extern s16 D_8011D5AC;
extern s32 osTvType;
/* Size: 12 bytes */
typedef struct TriangleBatchInfo {
/* 0x00 */ u8 textureIndex; // 0xFF = No texture
/* 0x02 */ s16 verticesOffset;
/* 0x04 */ s16 facesOffset;
/* 0x06 */ u8 unk6;
/* 0x08 */ u32 flags;
// 0x00000100 = Hidden geometry
// 0x00008000 = Environment mapping
} TriangleBatchInfo;
typedef struct ObjectModel {
u8 pad0[0x28];
/* 0x28 */ s16 numberOfBatches;
u8 pad2A[14];
/* 0x38 */ TriangleBatchInfo *batches;
} ObjectModel;
typedef struct unk8001D6E4_arg1_40 {
u8 pad0[0x71];
/* 0x71 */ u8 unk71;
} unk8001D6E4_arg1_40;
typedef struct unk8001D6E4_arg1 {
/* 0x00 */ s16 unk0;
/* 0x02 */ s16 unk2;
/* 0x04 */ s16 unk4;
u8 pad6[0x3A];
/* 0x40 */ unk8001D6E4_arg1_40 *unk40;
} unk8001D6E4_arg1;
void func_8001D80C(unk8001D6E4_arg1 *, ObjectModel *, s16, unk8001D6E4_arg1 *, f32, f32);
void func_80024744(unk8001D6E4_arg1 *, ObjectModel *, s16, f32);
void func_8000C460(void);
void *new_sub_memory_pool(s32, u32);
@@ -1360,7 +1394,41 @@ GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001D258.s")
GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001D2A0.s")
GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001D4B4.s")
GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001D5E0.s")
GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001D6E4.s")
void func_8001D6E4(ObjectModel *arg0, Player *object, s32 arg2, f32 arg3) {
s16 environmentMappingEnabled;
s32 dynamicLightingEnabled;
s16 i;
dynamicLightingEnabled = 0;
environmentMappingEnabled = 0;
for (i = 0; i < arg0->numberOfBatches; i++) {
if (arg0->batches[i].unk6 != 0xFF) {
dynamicLightingEnabled = -1; // This is a bit weird, but I guess it works.
}
if (arg0->batches[i].flags & 0x8000) {
environmentMappingEnabled = -1;
}
}
if (dynamicLightingEnabled) {
// Calculates dynamic lighting for the object
if (object->descriptor_ptr->unk71 != 0) {
// Dynamic lighting for some objects? (Intro diddy, Taj, T.T., Bosses)
func_8001D80C(object, arg0, arg2, object, arg3, 1.0f);
} else {
// Dynamic lighting for other objects? (Racers, Rare logo, Wizpig face, etc.)
func_80024744(object, arg0, arg2, arg3);
}
}
if (environmentMappingEnabled) {
// Calculates environment mapping for the object
func_8001DD54(arg0, object->z_rotation, object->x_rotation, object->y_rotation);
}
}
GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001D80C.s")
GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001DD54.s")
GLOBAL_ASM("asm/non_matchings/unknown_00BC20/func_8001E13C.s")