wip decomp of 80040E50, documentation of dma code, and other (#215)

* Math decomp and more.
This commit is contained in:
MegaMech 2022-06-14 21:36:00 -06:00 committed by GitHub
parent 242aa9ffc5
commit 7d11a134cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 485 additions and 375 deletions

1
asm-differ Submodule

@ -0,0 +1 @@
Subproject commit 3b9cfa5a18cab2d11107790a17719642488cdb9d

View File

@ -0,0 +1,111 @@
glabel func_80042B5C
/* 04375C 80042B5C 27BDFF88 */ addiu $sp, $sp, -0x78
/* 043760 80042B60 AFBF0024 */ sw $ra, 0x24($sp)
/* 043764 80042B64 AFB00020 */ sw $s0, 0x20($sp)
/* 043768 80042B68 F7B40018 */ sdc1 $f20, 0x18($sp)
/* 04376C 80042B6C AFA40078 */ sw $a0, 0x78($sp)
/* 043770 80042B70 AFA5007C */ sw $a1, 0x7c($sp)
/* 043774 80042B74 00C08025 */ move $s0, $a2
/* 043778 80042B78 0C0AE006 */ jal sins
/* 04377C 80042B7C 94C40000 */ lhu $a0, ($a2)
/* 043780 80042B80 E7A00050 */ swc1 $f0, 0x50($sp)
/* 043784 80042B84 0C0AE00E */ jal coss
/* 043788 80042B88 96040000 */ lhu $a0, ($s0)
/* 04378C 80042B8C 46000506 */ mov.s $f20, $f0
/* 043790 80042B90 0C0AE006 */ jal sins
/* 043794 80042B94 96040002 */ lhu $a0, 2($s0)
/* 043798 80042B98 96040002 */ lhu $a0, 2($s0)
/* 04379C 80042B9C 0C0AE00E */ jal coss
/* 0437A0 80042BA0 E7A00048 */ swc1 $f0, 0x48($sp)
/* 0437A4 80042BA4 96040004 */ lhu $a0, 4($s0)
/* 0437A8 80042BA8 0C0AE006 */ jal sins
/* 0437AC 80042BAC E7A00044 */ swc1 $f0, 0x44($sp)
/* 0437B0 80042BB0 96040004 */ lhu $a0, 4($s0)
/* 0437B4 80042BB4 0C0AE00E */ jal coss
/* 0437B8 80042BB8 E7A00040 */ swc1 $f0, 0x40($sp)
/* 0437BC 80042BBC C7AE0048 */ lwc1 $f14, 0x48($sp)
/* 0437C0 80042BC0 C7A80050 */ lwc1 $f8, 0x50($sp)
/* 0437C4 80042BC4 C7B00044 */ lwc1 $f16, 0x44($sp)
/* 0437C8 80042BC8 C7A20040 */ lwc1 $f2, 0x40($sp)
/* 0437CC 80042BCC 460E4302 */ mul.s $f12, $f8, $f14
/* 0437D0 80042BD0 8FA2007C */ lw $v0, 0x7c($sp)
/* 0437D4 80042BD4 46008282 */ mul.s $f10, $f16, $f0
/* 0437D8 80042BD8 C4520000 */ lwc1 $f18, ($v0)
/* 0437DC 80042BDC 46026102 */ mul.s $f4, $f12, $f2
/* 0437E0 80042BE0 46045180 */ add.s $f6, $f10, $f4
/* 0437E4 80042BE4 46069282 */ mul.s $f10, $f18, $f6
/* 0437E8 80042BE8 46008187 */ neg.s $f6, $f16
/* 0437EC 80042BEC E7AA0074 */ swc1 $f10, 0x74($sp)
/* 0437F0 80042BF0 C4440004 */ lwc1 $f4, 4($v0)
/* 0437F4 80042BF4 46023282 */ mul.s $f10, $f6, $f2
/* 0437F8 80042BF8 E7A40034 */ swc1 $f4, 0x34($sp)
/* 0437FC 80042BFC 46006102 */ mul.s $f4, $f12, $f0
/* 043800 80042C00 46045180 */ add.s $f6, $f10, $f4
/* 043804 80042C04 C7AA0034 */ lwc1 $f10, 0x34($sp)
/* 043808 80042C08 46065102 */ mul.s $f4, $f10, $f6
/* 04380C 80042C0C E7A40068 */ swc1 $f4, 0x68($sp)
/* 043810 80042C10 C4460008 */ lwc1 $f6, 8($v0)
/* 043814 80042C14 E7A80028 */ swc1 $f8, 0x28($sp)
/* 043818 80042C18 460EA202 */ mul.s $f8, $f20, $f14
/* 04381C 80042C1C E7A60030 */ swc1 $f6, 0x30($sp)
/* 043820 80042C20 C7A60030 */ lwc1 $f6, 0x30($sp)
/* 043824 80042C24 E7AA002C */ swc1 $f10, 0x2c($sp)
/* 043828 80042C28 8FA20078 */ lw $v0, 0x78($sp)
/* 04382C 80042C2C 46083202 */ mul.s $f8, $f6, $f8
/* 043830 80042C30 00000000 */ nop
/* 043834 80042C34 4602A282 */ mul.s $f10, $f20, $f2
/* 043838 80042C38 E7A8005C */ swc1 $f8, 0x5c($sp)
/* 04383C 80042C3C 460A9282 */ mul.s $f10, $f18, $f10
/* 043840 80042C40 E7AA0070 */ swc1 $f10, 0x70($sp)
/* 043844 80042C44 C7AA002C */ lwc1 $f10, 0x2c($sp)
/* 043848 80042C48 E7A4002C */ swc1 $f4, 0x2c($sp)
/* 04384C 80042C4C 4600A102 */ mul.s $f4, $f20, $f0
/* 043850 80042C50 00000000 */ nop
/* 043854 80042C54 46045102 */ mul.s $f4, $f10, $f4
/* 043858 80042C58 E7A40064 */ swc1 $f4, 0x64($sp)
/* 04385C 80042C5C C7A40028 */ lwc1 $f4, 0x28($sp)
/* 043860 80042C60 E7A80028 */ swc1 $f8, 0x28($sp)
/* 043864 80042C64 46002207 */ neg.s $f8, $f4
/* 043868 80042C68 46083202 */ mul.s $f8, $f6, $f8
/* 04386C 80042C6C E7A80058 */ swc1 $f8, 0x58($sp)
/* 043870 80042C70 46102302 */ mul.s $f12, $f4, $f16
/* 043874 80042C74 46007207 */ neg.s $f8, $f14
/* 043878 80042C78 46004102 */ mul.s $f4, $f8, $f0
/* 04387C 80042C7C 00000000 */ nop
/* 043880 80042C80 46026202 */ mul.s $f8, $f12, $f2
/* 043884 80042C84 46082100 */ add.s $f4, $f4, $f8
/* 043888 80042C88 46049202 */ mul.s $f8, $f18, $f4
/* 04388C 80042C8C E7A8006C */ swc1 $f8, 0x6c($sp)
/* 043890 80042C90 46027102 */ mul.s $f4, $f14, $f2
/* 043894 80042C94 00000000 */ nop
/* 043898 80042C98 46006202 */ mul.s $f8, $f12, $f0
/* 04389C 80042C9C 46082100 */ add.s $f4, $f4, $f8
/* 0438A0 80042CA0 46045202 */ mul.s $f8, $f10, $f4
/* 0438A4 80042CA4 00000000 */ nop
/* 0438A8 80042CA8 4610A282 */ mul.s $f10, $f20, $f16
/* 0438AC 80042CAC E7A80060 */ swc1 $f8, 0x60($sp)
/* 0438B0 80042CB0 C7A8002C */ lwc1 $f8, 0x2c($sp)
/* 0438B4 80042CB4 460A3102 */ mul.s $f4, $f6, $f10
/* 0438B8 80042CB8 C7A60074 */ lwc1 $f6, 0x74($sp)
/* 0438BC 80042CBC 46083280 */ add.s $f10, $f6, $f8
/* 0438C0 80042CC0 E7A40054 */ swc1 $f4, 0x54($sp)
/* 0438C4 80042CC4 C7A40028 */ lwc1 $f4, 0x28($sp)
/* 0438C8 80042CC8 46045180 */ add.s $f6, $f10, $f4
/* 0438CC 80042CCC E4460000 */ swc1 $f6, ($v0)
/* 0438D0 80042CD0 C7AA0064 */ lwc1 $f10, 0x64($sp)
/* 0438D4 80042CD4 C7A80070 */ lwc1 $f8, 0x70($sp)
/* 0438D8 80042CD8 C7A60058 */ lwc1 $f6, 0x58($sp)
/* 0438DC 80042CDC 460A4100 */ add.s $f4, $f8, $f10
/* 0438E0 80042CE0 46062200 */ add.s $f8, $f4, $f6
/* 0438E4 80042CE4 E4480004 */ swc1 $f8, 4($v0)
/* 0438E8 80042CE8 C7A40060 */ lwc1 $f4, 0x60($sp)
/* 0438EC 80042CEC C7AA006C */ lwc1 $f10, 0x6c($sp)
/* 0438F0 80042CF0 C7A80054 */ lwc1 $f8, 0x54($sp)
/* 0438F4 80042CF4 46045180 */ add.s $f6, $f10, $f4
/* 0438F8 80042CF8 46083280 */ add.s $f10, $f6, $f8
/* 0438FC 80042CFC E44A0008 */ swc1 $f10, 8($v0)
/* 043900 80042D00 8FBF0024 */ lw $ra, 0x24($sp)
/* 043904 80042D04 8FB00020 */ lw $s0, 0x20($sp)
/* 043908 80042D08 D7B40018 */ ldc1 $f20, 0x18($sp)
/* 04390C 80042D0C 03E00008 */ jr $ra
/* 043910 80042D10 27BD0078 */ addiu $sp, $sp, 0x78

View File

@ -19,45 +19,3 @@ glabel func_80071F6C
/* 072BB0 80071FB0 27BD0018 */ addiu $sp, $sp, 0x18
/* 072BB4 80071FB4 03E00008 */ jr $ra
/* 072BB8 80071FB8 00000000 */ nop
/* 072BBC 80071FBC 3C0E8016 */ lui $t6, %hi(D_80165CE2) # $t6, 0x8016
/* 072BC0 80071FC0 81CE5CE2 */ lb $t6, %lo(D_80165CE2)($t6)
/* 072BC4 80071FC4 00001825 */ move $v1, $zero
/* 072BC8 80071FC8 3C0F8016 */ lui $t7, %hi(D_80165DC2) # $t7, 0x8016
/* 072BCC 80071FCC 11C00002 */ beqz $t6, .L80071FD8
/* 072BD0 80071FD0 3C048016 */ lui $a0, %hi(D_80165DD8) # $a0, 0x8016
/* 072BD4 80071FD4 24030001 */ li $v1, 1
.L80071FD8:
/* 072BD8 80071FD8 81EF5DC2 */ lb $t7, %lo(D_80165DC2)($t7)
/* 072BDC 80071FDC 3C028018 */ lui $v0, %hi(D_80183D58) # $v0, 0x8018
/* 072BE0 80071FE0 24423D58 */ addiu $v0, %lo(D_80183D58) # addiu $v0, $v0, 0x3d58
/* 072BE4 80071FE4 11E00002 */ beqz $t7, .L80071FF0
/* 072BE8 80071FE8 24845DD8 */ addiu $a0, %lo(D_80165DD8) # addiu $a0, $a0, 0x5dd8
/* 072BEC 80071FEC 24630001 */ addiu $v1, $v1, 1
.L80071FF0:
/* 072BF0 80071FF0 809800CA */ lb $t8, 0xca($a0)
.L80071FF4:
/* 072BF4 80071FF4 53000003 */ beql $t8, $zero, .L80072004
/* 072BF8 80071FF8 809901AA */ lb $t9, 0x1aa($a0)
/* 072BFC 80071FFC 24630001 */ addiu $v1, $v1, 1
/* 072C00 80072000 809901AA */ lb $t9, 0x1aa($a0)
.L80072004:
/* 072C04 80072004 53200003 */ beql $t9, $zero, .L80072014
/* 072C08 80072008 8088028A */ lb $t0, 0x28a($a0)
/* 072C0C 8007200C 24630001 */ addiu $v1, $v1, 1
/* 072C10 80072010 8088028A */ lb $t0, 0x28a($a0)
.L80072014:
/* 072C14 80072014 51000003 */ beql $t0, $zero, .L80072024
/* 072C18 80072018 8089036A */ lb $t1, 0x36a($a0)
/* 072C1C 8007201C 24630001 */ addiu $v1, $v1, 1
/* 072C20 80072020 8089036A */ lb $t1, 0x36a($a0)
.L80072024:
/* 072C24 80072024 24840380 */ addiu $a0, $a0, 0x380
/* 072C28 80072028 11200002 */ beqz $t1, .L80072034
/* 072C2C 8007202C 00000000 */ nop
/* 072C30 80072030 24630001 */ addiu $v1, $v1, 1
.L80072034:
/* 072C34 80072034 5482FFEF */ bnel $a0, $v0, .L80071FF4
/* 072C38 80072038 809800CA */ lb $t8, 0xca($a0)
/* 072C3C 8007203C 03E00008 */ jr $ra
/* 072C40 80072040 00601025 */ move $v0, $v1

View File

@ -0,0 +1,42 @@
glabel func_80071FBC
/* 072BBC 80071FBC 3C0E8016 */ lui $t6, %hi(D_80165CE2) # $t6, 0x8016
/* 072BC0 80071FC0 81CE5CE2 */ lb $t6, %lo(D_80165CE2)($t6)
/* 072BC4 80071FC4 00001825 */ move $v1, $zero
/* 072BC8 80071FC8 3C0F8016 */ lui $t7, %hi(D_80165DC2) # $t7, 0x8016
/* 072BCC 80071FCC 11C00002 */ beqz $t6, .L80071FD8
/* 072BD0 80071FD0 3C048016 */ lui $a0, %hi(D_80165DD8) # $a0, 0x8016
/* 072BD4 80071FD4 24030001 */ li $v1, 1
.L80071FD8:
/* 072BD8 80071FD8 81EF5DC2 */ lb $t7, %lo(D_80165DC2)($t7)
/* 072BDC 80071FDC 3C028018 */ lui $v0, %hi(D_80183D58) # $v0, 0x8018
/* 072BE0 80071FE0 24423D58 */ addiu $v0, %lo(D_80183D58) # addiu $v0, $v0, 0x3d58
/* 072BE4 80071FE4 11E00002 */ beqz $t7, .L80071FF0
/* 072BE8 80071FE8 24845DD8 */ addiu $a0, %lo(D_80165DD8) # addiu $a0, $a0, 0x5dd8
/* 072BEC 80071FEC 24630001 */ addiu $v1, $v1, 1
.L80071FF0:
/* 072BF0 80071FF0 809800CA */ lb $t8, 0xca($a0)
.L80071FF4:
/* 072BF4 80071FF4 53000003 */ beql $t8, $zero, .L80072004
/* 072BF8 80071FF8 809901AA */ lb $t9, 0x1aa($a0)
/* 072BFC 80071FFC 24630001 */ addiu $v1, $v1, 1
/* 072C00 80072000 809901AA */ lb $t9, 0x1aa($a0)
.L80072004:
/* 072C04 80072004 53200003 */ beql $t9, $zero, .L80072014
/* 072C08 80072008 8088028A */ lb $t0, 0x28a($a0)
/* 072C0C 8007200C 24630001 */ addiu $v1, $v1, 1
/* 072C10 80072010 8088028A */ lb $t0, 0x28a($a0)
.L80072014:
/* 072C14 80072014 51000003 */ beql $t0, $zero, .L80072024
/* 072C18 80072018 8089036A */ lb $t1, 0x36a($a0)
/* 072C1C 8007201C 24630001 */ addiu $v1, $v1, 1
/* 072C20 80072020 8089036A */ lb $t1, 0x36a($a0)
.L80072024:
/* 072C24 80072024 24840380 */ addiu $a0, $a0, 0x380
/* 072C28 80072028 11200002 */ beqz $t1, .L80072034
/* 072C2C 8007202C 00000000 */ nop
/* 072C30 80072030 24630001 */ addiu $v1, $v1, 1
.L80072034:
/* 072C34 80072034 5482FFEF */ bnel $a0, $v0, .L80071FF4
/* 072C38 80072038 809800CA */ lb $t8, 0xca($a0)
/* 072C3C 8007203C 03E00008 */ jr $ra
/* 072C40 80072040 00601025 */ move $v0, $v1

View File

@ -1,22 +0,0 @@
glabel func_800773D8
/* 077FD8 800773D8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 077FDC 800773DC AFA40018 */ sw $a0, 0x18($sp)
/* 077FE0 800773E0 AFA5001C */ sw $a1, 0x1c($sp)
/* 077FE4 800773E4 AFBF0014 */ sw $ra, 0x14($sp)
/* 077FE8 800773E8 3C058018 */ lui $a1, %hi(D_80183E5C) # $a1, 0x8018
/* 077FEC 800773EC 3C048019 */ lui $a0, %hi(D_8018C630) # $a0, 0x8019
/* 077FF0 800773F0 2484C630 */ addiu $a0, %lo(D_8018C630) # addiu $a0, $a0, -0x39d0
/* 077FF4 800773F4 24A53E5C */ addiu $a1, %lo(D_80183E5C) # addiu $a1, $a1, 0x3e5c
/* 077FF8 800773F8 0C01C811 */ jal func_80072044
/* 077FFC 800773FC 24060080 */ li $a2, 128
/* 078000 80077400 2401FFFF */ li $at, -1
/* 078004 80077404 10410004 */ beq $v0, $at, .L80077418
/* 078008 80077408 00402025 */ move $a0, $v0
/* 07800C 8007740C 8FA50018 */ lw $a1, 0x18($sp)
/* 078010 80077410 0C01DC4E */ jal func_80077138
/* 078014 80077414 8FA6001C */ lw $a2, 0x1c($sp)
.L80077418:
/* 078018 80077418 8FBF0014 */ lw $ra, 0x14($sp)
/* 07801C 8007741C 27BD0018 */ addiu $sp, $sp, 0x18
/* 078020 80077420 03E00008 */ jr $ra
/* 078024 80077424 00000000 */ nop

View File

@ -1,11 +0,0 @@
glabel func_80077428
/* 078028 80077428 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 07802C 8007742C AFBF0014 */ sw $ra, 0x14($sp)
/* 078030 80077430 0C01C922 */ jal func_80072488
/* 078034 80077434 AFA40018 */ sw $a0, 0x18($sp)
/* 078038 80077438 0C021B9C */ jal func_80086E70
/* 07803C 8007743C 8FA40018 */ lw $a0, 0x18($sp)
/* 078040 80077440 8FBF0014 */ lw $ra, 0x14($sp)
/* 078044 80077444 27BD0018 */ addiu $sp, $sp, 0x18
/* 078048 80077448 03E00008 */ jr $ra
/* 07804C 8007744C 00000000 */ nop

1
decomp-permuter Submodule

@ -0,0 +1 @@
Subproject commit bb41b4db604adeaf8369be9b994e27e2d550a9ca

View File

@ -6,6 +6,7 @@
typedef f32 Vec3f[3];
typedef s16 Vec3s[3];
typedef u16 Vec3su[3];
typedef s16 Vec4s[4];
typedef enum {

View File

@ -290,40 +290,42 @@ uintptr_t ***gKartTextureTable1[] = {
gKartBowserTable1,
};
/**
* @brief Place DMA mio0 compressed character textures in a buffer.
* Later, this data becomes decompressed.
*
* The player struct tracks the texture indices to load.
*
* @param player
* @param arg1 Appears to be character index; 0-7.
* @param arg2 Rom buffer index appears to always be 0-3. Sometimes subtracted by 2.
* @param arg3 Second buffer index appears to always be 0-3.
* @param arg4 First buffer index always zero.
**/
void func_80027040(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
//s32 tmp = player->unk_0BC;
//void *buf; // = &D_802DFB80[arg4][arg3][arg1 * 0x920];
s32 temp;
if (((((((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40)) || ((player->unk_0BC & 0x80000) == 0x80000)) ||
((player->unk_0BC & 0x800000) == 0x800000)) || ((player->unk_0BC & 0x20000) == 0x20000)) || ((player->unk_044 & 0x800) != 0))
((player->unk_0BC & 0x800000) == 0x800000)) || ((player->unk_0BC & 0x20000) == 0x20000)) || ((player->unk_044 & 0x800) != 0))
{
// temp_v1 = player + (arg2 * 2);
if (player->unk_244[arg2] != 0) {
//buf = &D_802DFB80[arg2][arg1 * 0x920];
//buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
// temp_s0 = &D_802DFB80[0][0][(arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920)];
//temp = 0x30;
//if (temp);
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId]);
//temp = player->characterId;
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
} else {
//buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId]);
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
} else if (((((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x1000000) == 0x1000000)) || ((player->unk_0BC & 0x2000000) == 0x2000000)) || ((player->unk_0BC & 0x10000) == 0x10000))
} else if (((((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x1000000) == 0x1000000)) ||
((player->unk_0BC & 0x2000000) == 0x2000000)) || ((player->unk_0BC & 0x10000) == 0x10000))
{
//temp = player->unk_0A8 >> 8;
//buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], 0x780U);
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], &D_802DFB80[arg4][arg3][arg1 * 0x920], 0x900U, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
} else {
//buf = &D_802DFB80[arg4][arg3][arg1 * 0x920];
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId]);
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
@ -331,38 +333,33 @@ void func_80027040(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
}
void func_80027560(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
//s32 temp_v0;
s32 temp = player->unk_0BC;
//temp_v0 = player->unk_0BC;
if (((temp & 0x80) == 0x80) || ((temp & 0x40) == 0x40) || ((temp & 0x80000) == 0x80000) || ((temp & 0x800000) == 0x800000) || ((temp & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0))
if (((temp & 0x80) == 0x80) || ((temp & 0x40) == 0x40) || ((temp & 0x80000) == 0x80000) ||
((temp & 0x800000) == 0x800000) || ((temp & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0))
{
//temp_v1_2 = player + (arg2 * 2);
if (player->unk_244[arg2] != 0) {
//temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId]);
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId], &gDmaMesgQueue);
} else {
//temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId]);
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) || ((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000))
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) ||
((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000))
{
// temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], 0x780);
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], &D_802DFB80[arg4][arg3][arg1 * 0x920], 0x900, &gDmaMesgQueue);
} else {
//temp_s0 = D_802DFB80[arg4][arg3][arg1 * 0x920];
osInvalDCache(&D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId]);
//temp_v1 = player + (arg2 * 2);
osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1 * 0x920], D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
}
void func_80027A20(Player *player, s8 arg1, s8 arg2, s8 arg3) {
// @bug: Undefined Behaviour UB
// untested fix
// untested fix. [arg1 << 8] may be a fake match.
#ifdef AVOID_UB
void *temp_s0 = &D_802F1F80[arg3][arg2][0];
#else

View File

@ -5,6 +5,7 @@
#include "main.h"
#include "variables.h"
#include "math_util.h"
#include "memory.h"
#pragma intrinsic (sqrtf)
@ -339,13 +340,12 @@ s32 vec3f_set_dupe_2_electric_boogaloo(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3)
}
Vec3f *func_80041530(Vec3f dest) {
f32 temp_f16;
f32 invsqrt = 1.0f / sqrtf(dest[0] * dest[0] + dest[1] * dest[1] + dest[2] * dest[2]);
temp_f16 = 1.0f / sqrtf((dest[0] * dest[0]) + (dest[1] * dest[1]) + (dest[2] * dest[2]));
dest[0] = dest[0] * temp_f16;
dest[1] = dest[1] * temp_f16;
dest[2] = dest[2] * temp_f16;
return &dest;
dest[0] = dest[0] * invsqrt;
dest[1] = dest[1] * invsqrt;
dest[2] = dest[2] * invsqrt;
return &dest;
}
Vec3f *func_80041594(Vec3f arg0, Vec3f arg1, Vec3f arg2) {
@ -459,130 +459,145 @@ s32 func_80041980(Vec3f arg0, Camera *arg1, u16 arg2) {
}
void func_800419F8(void) {
Vec3f sp24;
Vec3f sp18;
Vec3f sp24;
sp24[0] = 0.0f;
sp24[1] = 0.0f;
sp24[2] = 120.0f;
func_80042D14(sp18, sp24, D_80165834);
D_80165840[0] = sp18[0];
D_80165840[1] = sp18[1];
D_80165840[2] = sp18[2];
sp18[0] = 0.0f;
sp18[1] = 0.0f;
sp18[2] = 120.0f;
func_80042D14(sp24, sp18, D_80165834);
D_80165840[0] = sp24[0];
D_80165840[1] = sp24[1];
D_80165840[2] = sp24[2];
}
UNUSED void func_80041A70(void){
return;
UNUSED func_80041A70(void) {
}
void func_80041A78(Mat4 arg0, s32 arg1, s32 arg2) {
arg0[0][0] = 1.0f;
arg0[1][1] = 1.0f;
arg0[2][2] = 1.0f;
arg0[1][0] = 0.0f;
arg0[2][0] = 0.0f;
arg0[3][0] = arg1;
arg0[0][1] = 0.0f;
arg0[1][1] = 1.0f;
arg0[3][0] = arg1;
arg0[2][1] = 0.0f;
arg0[3][1] = arg2;
arg0[0][2] = 0.0f;
arg0[1][2] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][2] = 0.0f;
arg0[3][1] = arg2;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
arg0[2][3] = 0.0f;
arg0[3][3] = 1.0f;
}
void func_80041AD8(Mat4 arg0, u16 angle) {
f32 sine = sins(angle);
f32 cosine = coss(angle);
arg0[0][0] = cosine;
arg0[1][0] = -sine;
void func_80041AD8(Mat4 arg0, u16 arg1) {
f32 sp1C = sins(arg1);
f32 temp_f0 = coss(arg1);
arg0[0][0] = temp_f0;
arg0[1][0] = -sp1C;
arg0[1][1] = temp_f0;
arg0[0][1] = sp1C;
arg0[2][0] = 0.0f;
arg0[3][0] = 0.0f;
arg0[0][1] = sine;
arg0[1][1] = cosine;
arg0[2][1] = 0.0f;
arg0[3][1] = 0.0f;
arg0[0][2] = 0.0f;
arg0[1][2] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][2] = 0.0f;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
arg0[2][3] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][3] = 1.0f;
}
void func_80041B68(Mat4 arg0, f32 arg1) {
arg0[0][0] = arg1;
arg0[1][0] = 0.0f;
arg0[2][0] = 0.0f;
arg0[3][0] = 0.0f;
arg0[0][1] = 0.0f;
arg0[1][1] = arg1;
arg0[2][1] = 0.0f;
arg0[3][1] = 0.0f;
arg0[0][2] = 0.0f;
arg0[1][2] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][2] = 0.0f;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
arg0[2][3] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][3] = 1.0f;
arg0[0][0] = arg1;
arg0[1][1] = arg1;
}
void func_80041BBC(Mat4 arg0, u16 angle, f32 arg2) {
f32 sine = sins(angle);
f32 cosine = coss(angle) * arg2;
void func_80041BBC(Mat4 arg0, u16 arg1, f32 arg2) {
f32 sp1C = sins(arg1);
f32 temp_f12 = coss(arg1) * arg2;
arg0[0][0] = cosine;
arg0[1][0] = -sine * arg2;
arg0[2][0] = 0.0f;
arg0[0][0] = temp_f12;
arg0[1][1] = temp_f12;
arg0[2][1] = 0.0f;
arg0[1][0] = -sp1C * arg2;
arg0[0][2] = 0.0f;
arg0[1][2] = 0.0f;
arg0[0][1] = sp1C * arg2;
arg0[3][2] = 0.0f;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
arg0[2][3] = 0.0f;
arg0[3][0] = 1.0f;
arg0[0][1] = sine * arg2;
arg0[1][1] = cosine;
arg0[2][1] = 0.0f;
arg0[3][1] = 1.0f;
arg0[0][2] = 0.0f;
arg0[1][2] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][2] = 0.0f;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
arg0[2][3] = 0.0f;
arg0[3][3] = 1.0f;
}
void func_80041C64(Mat4 arg0, s32 arg1, s32 arg2, u16 angle, f32 arg4) {
f32 sine = sins(angle);
f32 cosine = coss(angle) * arg4;
/**
* @brief arg1 and arg2 are s32's into floats?!?
*
* @param arg0
* @param arg1
* @param arg2
* @param arg3
* @param arg4
*/
void func_80041C64(Mat4 arg0, s32 arg1, s32 arg2, u16 arg3, f32 arg4) {
f32 sp24 = sins(arg3);
f32 temp_f12 = coss(arg3) * arg4;
arg0[0][0] = cosine;
arg0[1][0] = -sine * arg4;
arg0[2][0] = 0.0f;
arg0[3][0] = arg1;
arg0[0][1] = sine * arg4;
arg0[1][1] = cosine;
arg0[2][1] = 0.0f;
arg0[3][1] = arg2;
arg0[0][2] = 0.0f;
arg0[1][2] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][2] = 0.0f;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
arg0[2][3] = 0.0f;
arg0[3][3] = 1.0f;
arg0[2][0] = 0.0f;
arg0[0][0] = temp_f12;
arg0[1][0] = (-sp24) * arg4;
arg0[3][0] = (f32) arg1;
arg0[1][1] = temp_f12;
arg0[0][1] = sp24 * arg4;
arg0[2][1] = 0.0f;
arg0[3][1] = (f32) arg2;
arg0[0][2] = 0.0f;
arg0[1][2] = 0.0f;
arg0[2][2] = 1.0f;
arg0[3][3] = 1.0f;
arg0[3][2] = 0.0f;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
arg0[2][3] = 0.0f;
}
// Likely D_801658**[index] = 1; * denotes wildcard
void func_80041D24(void) {
D_801658FE = 1;
}
void guOrtho(Mtx *, f32, f32, f32, f32, f32, f32, f32); /* extern */
extern s32 gActiveScreenMode;
extern s8 D_801658FE;
extern Mtx D_80183D60[];
void func_80041D34(void) {
guOrtho(&D_80183D60, 0.0f, 320.0f, 240.0f, 0.0f, -1.0f, 1.0f, 1.0f);
switch (gActiveScreenMode) {
@ -611,89 +626,101 @@ void func_80041EF4(void) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[5]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
}
UNUSED void func_80041F54(s32 arg0, s32 arg1) {
Mat4 someMatrix;
extern s32 D_8018D120;
void func_80022180(Mtx*, Mat4);
UNUSED void func_80041F54(s32 arg0, s32 arg1) {
Mat4 matrix;
func_80041A78(matrix, arg0, arg1);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
func_80041A78(someMatrix, arg0, arg1);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
UNUSED void func_80042000(u16 arg0) {
Mat4 someMatrix;
Mat4 matrix;
func_80041AD8(matrix, arg0);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], &matrix);
func_80041AD8(someMatrix, arg0);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
UNUSED void func_800420A8(f32 arg0) {
Mat4 someMatrix;
Mat4 matrix;
func_80041B68(matrix, arg0);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
func_80041B68(someMatrix, arg0);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
UNUSED void func_8004214C(u16 arg0, f32 arg1) {
Mat4 someMatrix;
UNUSED void func_8004214C(u16 arg1, f32 arg2) {
Mat4 matrix;
func_80041BBC(matrix, arg1, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
func_80041BBC(someMatrix, arg0, arg1);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
UNUSED void func_800421FC(s32 arg0, s32 arg1, f32 arg2) {
Mat4 someMatrix;
Mat4 matrix;
func_80041A78(matrix, arg0, arg1);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
func_80041A78(someMatrix, arg0, arg1);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
func_80041B68(someMatrix, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
D_8018D120++;
func_80041B68(matrix, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
void func_80042330(s32 arg0, s32 arg1, u16 arg2, f32 arg3) {
Mat4 someMatrix;
func_80041C64(someMatrix, arg0, arg1, arg2, arg3);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
Mat4 matrix;
func_80041C64(matrix, arg0, arg1, arg2, arg3);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
UNUSED void func_800423F0(Mat4 arg0, u16 arg1, u16 arg2, u16 arg3) {
f32 sine1;
f32 cosine1;
f32 sine2;
f32 cosine2;
f32 sine3;
f32 cosine3;
sine1 = sins(arg1);
cosine1 = coss(arg1);
sine2 = sins(arg2);
cosine2 = coss(arg2);
sine3 = sins(arg3);
cosine3 = coss(arg3);
f32 sp3C;
f32 temp_f20;
f32 sp34;
f32 sp30;
f32 sp2C;
f32 temp_f0;
arg0[0][0] = (cosine2 * cosine3) + ((sine1 * sine2) * sine3);
arg0[1][0] = ((-cosine2) * sine3) + ((sine1 * sine2) * cosine3);
arg0[2][0] = cosine1 * sine2;
sp3C = sins(arg1);
temp_f20 = coss(arg1);
sp34 = sins(arg2);
sp30 = coss(arg2);
sp2C = sins(arg3);
temp_f0 = coss(arg3);
arg0[0][0] = (f32) (sp30 * temp_f0 + (sp3C * sp34 * sp2C));
arg0[1][0] = (f32) ((-sp30 * sp2C) + (sp3C * sp34 * temp_f0));
arg0[2][0] = (f32) (temp_f20 * sp34);
arg0[3][0] = 0.0f;
arg0[0][1] = cosine1 * sine3;
arg0[1][1] = cosine1 * cosine3;
arg0[2][1] = -sine1;
arg0[0][1] = (f32) (temp_f20 * sp2C);
arg0[1][1] = (f32) (temp_f20 * temp_f0);
arg0[2][1] = (f32) -sp3C;
arg0[3][1] = 0.0f;
arg0[0][2] = ((-sine2) * cosine3) + ((sine1 * cosine2) * sine3);
arg0[1][2] = (sine2 * sine3) + ((sine1 * cosine2) * cosine3);
arg0[2][2] = cosine1 * cosine2;
arg0[0][2] = (f32) ((-sp34 * temp_f0) + (sp3C * sp30 * sp2C));
arg0[1][2] = (f32) ((sp34 * sp2C) + (sp3C * sp30 * temp_f0));
arg0[2][2] = (f32) (temp_f20 * sp30);
arg0[3][2] = 0.0f;
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
@ -702,51 +729,41 @@ UNUSED void func_800423F0(Mat4 arg0, u16 arg1, u16 arg2, u16 arg3) {
}
UNUSED void func_8004252C(Mat4 arg0, u16 arg1, u16 arg2) {
f32 sine1;
f32 cosine1;
f32 sine2;
f32 cosine2;
f32 sp2C = sins(arg1);
f32 sp28 = coss(arg1);
f32 sp24 = sins(arg2);
f32 temp_f0 = coss(arg2);
sine1 = sins(arg1);
cosine1 = coss(arg1);
sine2 = sins(arg2);
cosine2 = coss(arg2);
arg0[0][0] = cosine2;
arg0[1][0] = sine1 * sine2;
arg0[2][0] = cosine1 * sine2;
arg0[1][0] = sp2C * sp24;
arg0[2][0] = sp28 * sp24;
arg0[0][1] = 0.0f;
arg0[1][1] = cosine1;
arg0[2][1] = -sine1;
arg0[0][2] = -sine2;
arg0[1][2] = sine1 * cosine2;
arg0[2][2] = cosine1 * cosine2;
arg0[0][0] = temp_f0;
arg0[2][1] = -sp2C;
arg0[0][2] = -sp24;
arg0[1][1] = sp28;
arg0[1][2] = sp2C * temp_f0;
arg0[2][2] = sp28 * temp_f0;
}
void func_800425D0(Mat4 arg0, Vec3f arg1, Vec3s arg2, f32 arg3) {
f32 sine1;
f32 cosine1;
f32 sine2;
f32 cosine2;
f32 sine3;
f32 cosine3;
f32 sp44 = sins(arg2[0]);
f32 temp_f22 = coss(arg2[0]);
f32 sp3C = sins(arg2[1]);
f32 sp38 = coss(arg2[1]);
f32 sp34 = sins(arg2[2]);
f32 temp_f0 = coss(arg2[2]);
sine1 = sins(arg2[0]);
cosine1 = coss(arg2[0]);
sine2 = sins(arg2[1]);
cosine2 = coss(arg2[1]);
sine3 = sins(arg2[2]);
cosine3 = coss(arg2[2]);
arg0[0][0] = ((cosine2 * cosine3) + ((sine1 * sine2) * sine3)) * arg3;
arg0[1][0] = ((-cosine2 * sine3) + ((sine1 * sine2) * cosine3)) * arg3;
arg0[2][0] = cosine1 * sine2 * arg3;
arg0[0][0] = ((sp38 * temp_f0) + (sp44 * sp3C * sp34)) * arg3;
arg0[1][0] = ((-sp38 * sp34) + (sp44 * sp3C * temp_f0)) * arg3;
arg0[2][0] = (temp_f22 * sp3C) * arg3;
arg0[3][0] = arg1[0];
arg0[0][1] = cosine1 * sine3 * arg3;
arg0[1][1] = cosine1 * cosine3 * arg3;
arg0[2][1] = -sine1 * arg3;
arg0[0][1] = temp_f22 * sp34 * arg3;
arg0[1][1] = temp_f22 * temp_f0 * arg3;
arg0[2][1] = -sp44 * arg3;
arg0[3][1] = arg1[1];
arg0[0][2] = ((-sine2 * cosine3) + ((sine1 * cosine2) * sine3)) * arg3;
arg0[1][2] = ((sine2 * sine3) + ((sine1 * cosine2) * cosine3)) * arg3;
arg0[2][2] = cosine1 * cosine2 * arg3;
arg0[0][2] = ((-sp3C * temp_f0) + (sp44 * sp38 * sp34)) * arg3;
arg0[1][2] = ((sp3C * sp34) + (sp44 * sp38 * temp_f0)) * arg3;
arg0[2][2] = temp_f22 * sp38 * arg3;
arg0[3][2] = arg1[2];
arg0[0][3] = 0.0f;
arg0[1][3] = 0.0f;
@ -773,32 +790,44 @@ void func_80042760(Mat4 arg0, Vec3f arg1, Vec3f arg2, f32 arg3) {
arg0[3][3] = 1.0f;
}
void func_800427DC(s32 arg0, Mat4 arg1) {
f32 sine1;
f32 cosine1;
f32 sine2;
f32 cosine2;
f32 sine3;
f32 cosine3;
extern struct_80165C18_entry D_80165C18[];
sine1 = sins(D_80165C18[arg0].unk_0B2);
cosine1 = coss(D_80165C18[arg0].unk_0B2);
sine2 = sins(D_80165C18[arg0].unk_0B4);
cosine2 = coss(D_80165C18[arg0].unk_0B4);
sine3 = sins(D_80165C18[arg0].unk_0B6);
cosine3 = coss(D_80165C18[arg0].unk_0B6);
arg1[0][0] = D_80165C18[arg0].unk_000 * ((cosine2 * cosine3) + ((sine1 * sine2) * sine3));
arg1[1][0] = (D_80165C18[arg0].unk_000 * ((-cosine2 * sine3) + ((sine1 * sine2) * cosine3)));
arg1[2][0] = (D_80165C18[arg0].unk_000 * (cosine1 * sine2));
arg1[3][0] = D_80165C18[arg0].unk_004[0];
arg1[0][1] = D_80165C18[arg0].unk_000 * (cosine1 * sine3);
arg1[1][1] = (D_80165C18[arg0].unk_000 * (cosine1 * cosine3));
arg1[2][1] = (D_80165C18[arg0].unk_000 * -sine1);
arg1[3][1] = D_80165C18[arg0].unk_004[1];
arg1[0][2] = D_80165C18[arg0].unk_000 * ((-sine2 * cosine3) + ((sine1 * cosine2) * sine3));
arg1[1][2] = (D_80165C18[arg0].unk_000 * ((sine2 * sine3) + ((sine1 * cosine2) * cosine3)));
arg1[2][2] = (D_80165C18[arg0].unk_000 * (cosine1 * cosine2));
arg1[3][2] = D_80165C18[arg0].unk_004[2];
/**
* @brief Tried to put the definitions in the declares. However, sp3C wants to be at the top.
* Something may be possible with some padding. Couldn't find a way though. So we get big mess.
*
* @param arg0
* @param arg1
**/
void func_800427DC(s32 arg0, Mat4 arg1) {
f32 sp3C;
struct_80165C18_entry *temp_s0 = &D_80165C18[arg0];
f32 sp34;
f32 sp30;
f32 sp2C;
f32 temp_f0;
f32 temp_f20;
sp3C = sins(temp_s0->unk_0B2);
temp_f20 = coss(temp_s0->unk_0B2);
sp34 = sins(temp_s0->unk_0B4);
sp30 = coss(temp_s0->unk_0B4);
sp2C = sins(temp_s0->unk_0B6);
temp_f0 = coss(temp_s0->unk_0B6);
arg1[0][0] = temp_s0->unk_000 * ((sp30 * temp_f0) + (sp3C * sp34 * sp2C));
arg1[1][0] = temp_s0->unk_000 * ((-sp30 * sp2C) + sp3C * sp34 * temp_f0);
arg1[2][0] = temp_s0->unk_000 * (temp_f20 * sp34);
arg1[3][0] = temp_s0->unk_004[0];
arg1[0][1] = temp_s0->unk_000 * (temp_f20 * sp2C);
arg1[1][1] = temp_s0->unk_000 * (temp_f20 * temp_f0);
arg1[2][1] = temp_s0->unk_000 * -sp3C;
arg1[3][1] = temp_s0->unk_004[1];
arg1[0][2] = temp_s0->unk_000 * ((-sp34 * temp_f0) + (sp3C * sp30 * sp2C));
arg1[1][2] = temp_s0->unk_000 * ((sp34 * sp2C) + (sp3C * sp30 * temp_f0));
arg1[2][2] = temp_s0->unk_000 * (temp_f20 * sp30);
arg1[3][2] = temp_s0->unk_004[2];
arg1[0][3] = 0.0f;
arg1[1][3] = 0.0f;
arg1[2][3] = 0.0f;
@ -834,7 +863,6 @@ void func_80042A20(Mat4 arg0, Vec3f arg1, Vec3f arg2, u16 arg3, f32 arg4) {
func_80041530(sp38);
func_80041594(sp2C, sp38, arg1);
func_80041530(sp2C);
arg0[0][0] = sp38[0] * arg4;
arg0[0][1] = sp38[1] * arg4;
arg0[0][2] = sp38[2] * arg4;
@ -912,51 +940,53 @@ void func_80042D14(Vec3f arg0, Vec3f arg1, Vec3s arg2) {
}
void func_80042E00(Vec3f arg0, Vec3s arg1, f32 arg2) {
Mat4 someMatrix;
Mat4 matrix;
func_800425D0(someMatrix, arg0, arg1, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
func_800425D0(matrix, arg0, arg1, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
UNUSED void func_80042EB8(Vec3f arg0, Vec3f arg1, f32 arg2) {
Mat4 someMatrix;
Mat4 matrix;
func_80042760(someMatrix, arg0, arg1, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
func_80042760(matrix, arg0, arg1, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
void func_80042F70(Vec3f arg0, Vec3s arg1, f32 arg2) {
Mat4 someMatrix;
Vec3s sp20;
sp20[0] = (u16)arg1[0] + 0x8000;
sp20[1] = (u16)arg1[1] + 0x8000;
// * 1 done here to force the compiler to respect the u16 typecast
sp20[2] = (u16)arg1[2] * 1;
func_800425D0(someMatrix, arg0, sp20, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
void func_80042F70(Vec3f arg0, Vec3su arg1, f32 arg2) {
Mat4 matrix;
Vec3su sp20;
sp20[0] = arg1[0] + 0x8000;
sp20[1] = arg1[1] + 0x8000;
sp20[2] = arg1[2];
func_800425D0(matrix, arg0, sp20, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
void func_80043050(Vec3f arg0,Vec3f arg1, f32 arg2) {
Mat4 someMatrix;
Mat4 matrix;
func_80042A20(someMatrix, arg1, arg0, 0, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
func_80042A20(matrix, arg1, arg0, 0, arg2);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}
void func_80043104(s32 arg0) {
Mat4 someMatrix;
Mat4 sp20;
func_800427DC(arg0, sp20);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], sp20);
func_800427DC(arg0, someMatrix);
func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], someMatrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120 += 1;
D_8018D120++;
}

View File

@ -22,7 +22,6 @@ s32 s32_step_towards(s32*, s32, s32);
s32 func_80041608(f32, f32, f32, f32, f32);
s32 func_80041680(f32, f32);
s32 func_800416AC(f32, f32);
void func_80041A70();
void func_80041F54(s32, s32);
void func_80042000(u16);
void func_800420A8(f32);
@ -77,7 +76,7 @@ void func_800427DC(s32, Mat4);
void func_80042A20(Mat4, Vec3f, Vec3f, u16, f32);
void func_80042D14(Vec3f, Vec3f, Vec3s);
void func_80042E00(Vec3f, Vec3s, f32);
void func_80042F70(Vec3f, Vec3s, f32);
void func_80042F70(Vec3f, Vec3su, f32);
void func_80043050(Vec3f, Vec3f, f32);
void func_80043104(s32);

View File

@ -1,6 +1,8 @@
#include <ultra64.h>
#include <macros.h>
#include <defines.h>
#include <common_structs.h>
#include <actor_types.h>
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern void func_80042E00(s32, s32, f32); // extern
@ -72,23 +74,24 @@ void func_80043500(s32 arg0, s32 arg1, f32 arg2, s32 arg3) {
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_80042F70(?, ?); // extern
extern ? D_0D007878;
extern void *gDisplayListHead;
//? func_80042F70(?, ?); // extern
extern s8 D_0D007878[];
//extern void *gDisplayListHead;
void func_800435A0(? arg2, s32 arg3, s32 arg4) {
void *temp_v0;
void *temp_v0_2;
void *temp_v0_3;
void *temp_v0_4;
void *temp_v0_5;
void func_80042F70(s32 arg0, Vec3su arg1, f32 arg2);
void func_800435A0(s32 arg0, Vec3su arg1, f32 arg2, s32 arg3, s32 arg4) {
arg4 &= 0xFF;
func_80042F70(arg0, arg1, arg2);
gSPDisplayList(gDisplayListHead++, D_0D007878);
gDPSetPrimColor(gDisplayListHead++, 0, 0, arg4, 0xFF, 0xFF, 0xFF);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BOTH);
gSPDisplayList(gDisplayListHead++, arg3);
gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING);
/*
func_80042F70(arg2, arg2);
temp_v0 = gDisplayListHead;
gDisplayListHead = temp_v0 + 8;
temp_v0->unk4 = &D_0D007878;
temp_v0->unk0 = 0x6000000;
temp_v0_2 = gDisplayListHead;
gDisplayListHead = temp_v0_2 + 8;
temp_v0_2->unk0 = 0xFA000000;
temp_v0_2->unk4 = (arg4 & 0xFF) | ~0xFF;
@ -104,6 +107,7 @@ void func_800435A0(? arg2, s32 arg3, s32 arg4) {
gDisplayListHead = temp_v0_5 + 8;
temp_v0_5->unk4 = 0x2000;
temp_v0_5->unk0 = 0xB7000000;
*/
}
#else
GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800435A0.s")
@ -3488,27 +3492,45 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004A414.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_80041924(); // extern
? func_80043050(? *, void *, s32); // extern
f32 func_802ABE30(f32, ?, ? *, ?32, u16); // extern
extern ? D_0D007B98;
//s32 func_80041924(); // extern
//? func_80043050(? *, void *, s32); // extern
//f32 func_802ABE30(f32, ?, ? *, ?32, u16); // extern
//extern ? D_0D007B98;
//extern f64 D_800EE030;
//extern ? D_80183E50;
//extern void *gDisplayListHead;
extern s8 D_0D007B98[];
extern f64 D_800EE030;
extern ? D_80183E50;
extern void *gDisplayListHead;
extern Vec3f D_80183E50;
void func_8004A630(void *arg0, void *arg1, s32 arg2) {
void *temp_v1;
s32 func_80041924(UnkActorInner*, Vec3f, s32);
if (func_80041924() != 0) {
D_80183E50.unk0 = arg1->unk0;
D_80183E50.unk4 = func_802ABE30(arg1->unk0, 0, &D_80183E50, arg1->unk8, arg0->unkA) + D_800EE030;
D_80183E50.unk8 = arg1->unk8;
func_80043050(&D_80183E50, arg0 + 0x30, arg2);
temp_v1 = gDisplayListHead;
gDisplayListHead = temp_v1 + 8;
temp_v1->unk0 = 0x6000000;
temp_v1->unk4 = &D_0D007B98;
}
f32 func_802ABE30(f32, f32, f32, u16);
void func_80043050(Vec3f, Vec3f, f32);
struct UnknownStruct8004A630 {
Vec3f unk0;
f32 unk4;
};
void func_8004A630(struct UnknownStruct8004A630 *arg0, Vec3f arg1, f32 arg2) {
//void *temp_v1;
if (func_80041924((UnkActorInner *) &arg0->unk0, arg1, arg2) == 0) { return; }
D_80183E50[0] = arg1[0];
D_80183E50[1] = func_802ABE30(arg1[0], 0.0f, D_80183E50[0], arg0->unk4) + D_800EE030;
D_80183E50[2] = arg1[2];
func_80043050(D_80183E50, arg0->unk0, arg2);
gSPDisplayList(gDisplayListHead++, D_0D007B98);
/*
temp_v1 = gDisplayListHead;
gDisplayListHead = temp_v1 + 8;
temp_v1->unk0 = 0x6000000;
temp_v1->unk4 = &D_0D007B98;
*/
}
#else
GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004A630.s")

View File

@ -30,24 +30,27 @@ s32 find_unused_obj_index(s32* arg0) {
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_80072428(s32, s32 *); // extern
extern ? D_80165CE2;
//? func_80072428(s32, s32 *); // extern
extern s8 D_80165CE2[];
void func_80071F6C(s32 *arg0) {
s32 *temp_a1;
void func_80071F6C(s32 arg0, s32 arg1) {
s32 temp_a0;
s32 temp_a1;
temp_a1 = arg0;
temp_a0 = *arg0;
temp_a0 = arg0;
arg0 = temp_a1;
func_80072428(temp_a0, temp_a1);
*(&D_80165CE2 + (*arg0 * 0xE0)) = 0;
*arg0 = -1;
func_80072428(arg0);
D_80165CE2[0xE0] = 0;
arg0 = -1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80071F6C.s")
#endif
// UNUSED FUNC
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80071FBC.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 find_unused_obj_index(s32 *, s32); // extern
@ -115,8 +118,8 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80072044.s")
void func_80071F6C(); // extern
void func_80072100(void) {
func_80071F6C();
void func_80072100(s32 arg0, s32 arg1) {
func_80071F6C(arg0, arg1);
}
#ifdef MIPS_TO_C
@ -3122,37 +3125,17 @@ void func_80077138(s32 arg0, void *arg1, s32 arg2) {
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077138.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_80072044(? *, ? *, ?); // extern
? func_80077138(s32, s32, s32); // extern
extern ? D_80183E5C;
extern ? D_8018C630;
void func_800773D8(s32 arg0, s32 arg1) {
s32 temp_v0;
temp_v0 = func_80072044(&D_8018C630, &D_80183E5C, 0x80);
s32 temp_v0 = func_80072044(&D_8018C630, &D_80183E5C, 0x80);
if (temp_v0 != -1) {
func_80077138(temp_v0, arg0, arg1);
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_800773D8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_80072488(); // extern
? func_80086E70(s32); // extern
void func_80077428(s32 arg0) {
func_80072488();
func_80072488(arg0);
func_80086E70(arg0);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077428.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307

@ -1 +0,0 @@
Subproject commit c379de7d88c37204f8a96fbc4b98abc700c5ae28

@ -1 +0,0 @@
Subproject commit 2420458ba7ed130df82e4393b8e0ba3d222aa336