From a536985a13f2cb1110bdb0573634d433473a4d81 Mon Sep 17 00:00:00 2001 From: Tyler McGavran Date: Wed, 27 Jul 2022 22:03:35 -0400 Subject: [PATCH] Add structs for "vehicle" types in 80005FD0 (#248) Signed-off-by: Taggerung --- asm/bss_MainSeg.s | 61 +- .../code_80005FD0/func_80012220.s | 49 - .../code_80005FD0/func_800122D8.s | 313 ---- .../code_80005FD0/func_80012A48.s | 32 - .../code_80005FD0/func_800147E0.s | 4 +- .../code_80005FD0/func_80014934.s | 4 +- .../code_80005FD0/func_80014A88.s | 4 +- .../code_80005FD0/func_80014BDC.s | 4 +- include/actor_types.h | 7 +- include/vehicles.h | 92 ++ src/actors.c | 32 +- src/actors.h | 2 +- src/code_80005FD0.c | 1293 +++++++---------- src/code_80005FD0.h | 25 +- 14 files changed, 699 insertions(+), 1223 deletions(-) delete mode 100644 asm/non_matchings/code_80005FD0/func_80012220.s delete mode 100644 asm/non_matchings/code_80005FD0/func_800122D8.s delete mode 100644 asm/non_matchings/code_80005FD0/func_80012A48.s create mode 100644 include/vehicles.h diff --git a/asm/bss_MainSeg.s b/asm/bss_MainSeg.s index 1c14a7c68..85be90cb9 100644 --- a/asm/bss_MainSeg.s +++ b/asm/bss_MainSeg.s @@ -41,71 +41,26 @@ glabel D_801637F0 glabel D_80163814 .skip 4 -glabel D_80163818 -.skip 4 - -glabel D_8016381C -.skip 12 - -glabel D_80163828 -.skip 24 - -glabel D_80163840 -.skip 324 +glabel gBoxTruckList +.skip 364 glabel D_80163984 .skip 4 -glabel D_80163988 -.skip 4 - -glabel D_8016398C -.skip 8 - -glabel D_80163994 -.skip 4 - -glabel D_80163998 -.skip 24 - -glabel D_801639B0 -.skip 324 +glabel gSchoolBusList +.skip 364 glabel D_80163AF4 .skip 4 -glabel D_80163AF8 -.skip 4 - -glabel D_80163AFC -.skip 8 - -glabel D_80163B04 -.skip 4 - -glabel D_80163B08 -.skip 24 - -glabel D_80163B20 -.skip 324 +glabel gTankerTruckList +.skip 364 glabel D_80163C64 .skip 4 -glabel D_80163C68 -.skip 4 - -glabel D_80163C6C -.skip 8 - -glabel D_80163C74 -.skip 4 - -glabel D_80163C78 -.skip 24 - -glabel D_80163C90 -.skip 324 +glabel gCarList +.skip 364 glabel D_80163DD4 .skip 4 diff --git a/asm/non_matchings/code_80005FD0/func_80012220.s b/asm/non_matchings/code_80005FD0/func_80012220.s deleted file mode 100644 index e717d8836..000000000 --- a/asm/non_matchings/code_80005FD0/func_80012220.s +++ /dev/null @@ -1,49 +0,0 @@ -glabel func_80012220 -/* 012E20 80012220 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 012E24 80012224 AFBF0024 */ sw $ra, 0x24($sp) -/* 012E28 80012228 AFB00020 */ sw $s0, 0x20($sp) -/* 012E2C 8001222C C4840004 */ lwc1 $f4, 4($a0) -/* 012E30 80012230 3C0E8016 */ lui $t6, %hi(D_8016347A) # $t6, 0x8016 -/* 012E34 80012234 85CE347A */ lh $t6, %lo(D_8016347A)($t6) -/* 012E38 80012238 E7A40034 */ swc1 $f4, 0x34($sp) -/* 012E3C 8001223C C486000C */ lwc1 $f6, 0xc($a0) -/* 012E40 80012240 00808025 */ move $s0, $a0 -/* 012E44 80012244 15C0000E */ bnez $t6, .L80012280 -/* 012E48 80012248 E7A6002C */ swc1 $f6, 0x2c($sp) -/* 012E4C 8001224C 8E060020 */ lw $a2, 0x20($s0) -/* 012E50 80012250 8E070024 */ lw $a3, 0x24($s0) -/* 012E54 80012254 240F0003 */ li $t7, 3 -/* 012E58 80012258 AFAF0014 */ sw $t7, 0x14($sp) -/* 012E5C 8001225C AFA00010 */ sw $zero, 0x10($sp) -/* 012E60 80012260 24840004 */ addiu $a0, $a0, 4 -/* 012E64 80012264 0C0035B4 */ jal func_8000D6D0 -/* 012E68 80012268 2605001C */ addiu $a1, $s0, 0x1c -/* 012E6C 8001226C 24188000 */ li $t8, -32768 -/* 012E70 80012270 A6000028 */ sh $zero, 0x28($s0) -/* 012E74 80012274 A618002A */ sh $t8, 0x2a($s0) -/* 012E78 80012278 1000000A */ b .L800122A4 -/* 012E7C 8001227C A600002C */ sh $zero, 0x2c($s0) -.L80012280: -/* 012E80 80012280 8E060020 */ lw $a2, 0x20($s0) -/* 012E84 80012284 8E070024 */ lw $a3, 0x24($s0) -/* 012E88 80012288 AFA00010 */ sw $zero, 0x10($sp) -/* 012E8C 8001228C 26040004 */ addiu $a0, $s0, 4 -/* 012E90 80012290 0C003650 */ jal func_8000D940 -/* 012E94 80012294 2605001C */ addiu $a1, $s0, 0x1c -/* 012E98 80012298 A6000028 */ sh $zero, 0x28($s0) -/* 012E9C 8001229C A600002A */ sh $zero, 0x2a($s0) -/* 012EA0 800122A0 A600002C */ sh $zero, 0x2c($s0) -.L800122A4: -/* 012EA4 800122A4 C6080004 */ lwc1 $f8, 4($s0) -/* 012EA8 800122A8 C7AA0034 */ lwc1 $f10, 0x34($sp) -/* 012EAC 800122AC C612000C */ lwc1 $f18, 0xc($s0) -/* 012EB0 800122B0 460A4401 */ sub.s $f16, $f8, $f10 -/* 012EB4 800122B4 E6100010 */ swc1 $f16, 0x10($s0) -/* 012EB8 800122B8 C7A4002C */ lwc1 $f4, 0x2c($sp) -/* 012EBC 800122BC 46049181 */ sub.s $f6, $f18, $f4 -/* 012EC0 800122C0 E6060018 */ swc1 $f6, 0x18($s0) -/* 012EC4 800122C4 8FBF0024 */ lw $ra, 0x24($sp) -/* 012EC8 800122C8 8FB00020 */ lw $s0, 0x20($sp) -/* 012ECC 800122CC 27BD0038 */ addiu $sp, $sp, 0x38 -/* 012ED0 800122D0 03E00008 */ jr $ra -/* 012ED4 800122D4 00000000 */ nop diff --git a/asm/non_matchings/code_80005FD0/func_800122D8.s b/asm/non_matchings/code_80005FD0/func_800122D8.s deleted file mode 100644 index 2bbfe6ebe..000000000 --- a/asm/non_matchings/code_80005FD0/func_800122D8.s +++ /dev/null @@ -1,313 +0,0 @@ -glabel func_800122D8 -/* 012ED8 800122D8 27BDFF30 */ addiu $sp, $sp, -0xd0 -/* 012EDC 800122DC 3C02800E */ lui $v0, %hi(gCurrentCourseId) -/* 012EE0 800122E0 8442C5A0 */ lh $v0, %lo(gCurrentCourseId)($v0) -/* 012EE4 800122E4 2401000A */ li $at, 10 -/* 012EE8 800122E8 AFBF004C */ sw $ra, 0x4c($sp) -/* 012EEC 800122EC AFBE0048 */ sw $fp, 0x48($sp) -/* 012EF0 800122F0 AFB70044 */ sw $s7, 0x44($sp) -/* 012EF4 800122F4 AFB60040 */ sw $s6, 0x40($sp) -/* 012EF8 800122F8 AFB5003C */ sw $s5, 0x3c($sp) -/* 012EFC 800122FC AFB40038 */ sw $s4, 0x38($sp) -/* 012F00 80012300 AFB30034 */ sw $s3, 0x34($sp) -/* 012F04 80012304 AFB20030 */ sw $s2, 0x30($sp) -/* 012F08 80012308 AFB1002C */ sw $s1, 0x2c($sp) -/* 012F0C 8001230C AFB00028 */ sw $s0, 0x28($sp) -/* 012F10 80012310 F7B60020 */ sdc1 $f22, 0x20($sp) -/* 012F14 80012314 104100A9 */ beq $v0, $at, .L800125BC -/* 012F18 80012318 F7B40018 */ sdc1 $f20, 0x18($sp) -/* 012F1C 8001231C 2401000B */ li $at, 11 -/* 012F20 80012320 10410006 */ beq $v0, $at, .L8001233C -/* 012F24 80012324 3C0E8016 */ lui $t6, %hi(D_801635A0) # 0x8016 -/* 012F28 80012328 24010012 */ li $at, 18 -/* 012F2C 8001232C 1041007D */ beq $v0, $at, .L80012524 -/* 012F30 80012330 3C108016 */ lui $s0, %hi(D_801637C0) # 0x8016 -/* 012F34 80012334 10000105 */ b .L8001274C -/* 012F38 80012338 8FBF004C */ lw $ra, 0x4c($sp) -.L8001233C: -/* 012F3C 8001233C 3C048016 */ lui $a0, %hi(D_801635A4) # $a0, 0x8016 -/* 012F40 80012340 3C058016 */ lui $a1, %hi(D_801635BC) # $a1, 0x8016 -/* 012F44 80012344 3C0F8016 */ lui $t7, %hi(D_801635B0) # $t7, 0x8016 -/* 012F48 80012348 25EF35B0 */ addiu $t7, %lo(D_801635B0) # addiu $t7, $t7, 0x35b0 -/* 012F4C 8001234C 24A535BC */ addiu $a1, %lo(D_801635BC) # addiu $a1, $a1, 0x35bc -/* 012F50 80012350 248435A4 */ addiu $a0, %lo(D_801635A4) # addiu $a0, $a0, 0x35a4 -/* 012F54 80012354 25D635A0 */ addiu $s6, $t6, %lo(D_801635A0) # 0x35a0 -/* 012F58 80012358 AFB60068 */ sw $s6, 0x68($sp) -/* 012F5C 8001235C AFA40074 */ sw $a0, 0x74($sp) -/* 012F60 80012360 AFA50070 */ sw $a1, 0x70($sp) -/* 012F64 80012364 AFAF0054 */ sw $t7, 0x54($sp) -/* 012F68 80012368 241E0001 */ li $fp, 1 -/* 012F6C 8001236C 241700B4 */ li $s7, 180 -/* 012F70 80012370 27B500AC */ addiu $s5, $sp, 0xac -.L80012374: -/* 012F74 80012374 8FA40074 */ lw $a0, 0x74($sp) -/* 012F78 80012378 8FA50070 */ lw $a1, 0x70($sp) -/* 012F7C 8001237C C6D40004 */ lwc1 $f20, 4($s6) -/* 012F80 80012380 C6D6000C */ lwc1 $f22, 0xc($s6) -/* 012F84 80012384 0C0036EB */ jal func_8000DBAC -/* 012F88 80012388 8EC600FC */ lw $a2, 0xfc($s6) -/* 012F8C 8001238C C6C40004 */ lwc1 $f4, 4($s6) -/* 012F90 80012390 C6C8000C */ lwc1 $f8, 0xc($s6) -/* 012F94 80012394 00023400 */ sll $a2, $v0, 0x10 -/* 012F98 80012398 46142181 */ sub.s $f6, $f4, $f20 -/* 012F9C 8001239C 0006C403 */ sra $t8, $a2, 0x10 -/* 012FA0 800123A0 03003025 */ move $a2, $t8 -/* 012FA4 800123A4 46164281 */ sub.s $f10, $f8, $f22 -/* 012FA8 800123A8 E6C60010 */ swc1 $f6, 0x10($s6) -/* 012FAC 800123AC 02A02025 */ move $a0, $s5 -/* 012FB0 800123B0 00002825 */ move $a1, $zero -/* 012FB4 800123B4 E6CA0018 */ swc1 $f10, 0x18($s6) -/* 012FB8 800123B8 0C0AD4AF */ jal vec3s_set -/* 012FBC 800123BC 00003825 */ move $a3, $zero -/* 012FC0 800123C0 8FA40074 */ lw $a0, 0x74($sp) -/* 012FC4 800123C4 02A02825 */ move $a1, $s5 -/* 012FC8 800123C8 8FA60054 */ lw $a2, 0x54($sp) -/* 012FCC 800123CC 0C0A7B22 */ jal func_8029EC88 -/* 012FD0 800123D0 2407000F */ li $a3, 15 -/* 012FD4 800123D4 86D90024 */ lh $t9, 0x24($s6) -/* 012FD8 800123D8 26D00024 */ addiu $s0, $s6, 0x24 -/* 012FDC 800123DC A6C2001E */ sh $v0, 0x1e($s6) -/* 012FE0 800123E0 17D9001B */ bne $fp, $t9, .L80012450 -/* 012FE4 800123E4 26110004 */ addiu $s1, $s0, 4 -/* 012FE8 800123E8 C6140004 */ lwc1 $f20, 4($s0) -/* 012FEC 800123EC C616000C */ lwc1 $f22, 0xc($s0) -/* 012FF0 800123F0 02202025 */ move $a0, $s1 -/* 012FF4 800123F4 2605001C */ addiu $a1, $s0, 0x1c -/* 012FF8 800123F8 8EC600FC */ lw $a2, 0xfc($s6) -/* 012FFC 800123FC 0C0036EB */ jal func_8000DBAC -/* 013000 80012400 26120010 */ addiu $s2, $s0, 0x10 -/* 013004 80012404 C6100004 */ lwc1 $f16, 4($s0) -/* 013008 80012408 C604000C */ lwc1 $f4, 0xc($s0) -/* 01300C 8001240C 00023400 */ sll $a2, $v0, 0x10 -/* 013010 80012410 46148481 */ sub.s $f18, $f16, $f20 -/* 013014 80012414 00064403 */ sra $t0, $a2, 0x10 -/* 013018 80012418 01003025 */ move $a2, $t0 -/* 01301C 8001241C 46162181 */ sub.s $f6, $f4, $f22 -/* 013020 80012420 E6120010 */ swc1 $f18, 0x10($s0) -/* 013024 80012424 02A02025 */ move $a0, $s5 -/* 013028 80012428 00002825 */ move $a1, $zero -/* 01302C 8001242C E6060018 */ swc1 $f6, 0x18($s0) -/* 013030 80012430 0C0AD4AF */ jal vec3s_set -/* 013034 80012434 00003825 */ move $a3, $zero -/* 013038 80012438 02202025 */ move $a0, $s1 -/* 01303C 8001243C 02A02825 */ move $a1, $s5 -/* 013040 80012440 02403025 */ move $a2, $s2 -/* 013044 80012444 0C0A7B22 */ jal func_8029EC88 -/* 013048 80012448 24070010 */ li $a3, 16 -/* 01304C 8001244C A602001E */ sh $v0, 0x1e($s0) -.L80012450: -/* 013050 80012450 00009825 */ move $s3, $zero -/* 013054 80012454 8FB20068 */ lw $s2, 0x68($sp) -.L80012458: -/* 013058 80012458 86490048 */ lh $t1, 0x48($s2) -/* 01305C 8001245C 26500048 */ addiu $s0, $s2, 0x48 -/* 013060 80012460 26110004 */ addiu $s1, $s0, 4 -/* 013064 80012464 17C9001A */ bne $fp, $t1, .L800124D0 -/* 013068 80012468 02202025 */ move $a0, $s1 -/* 01306C 8001246C C6140004 */ lwc1 $f20, 4($s0) -/* 013070 80012470 C616000C */ lwc1 $f22, 0xc($s0) -/* 013074 80012474 2605001C */ addiu $a1, $s0, 0x1c -/* 013078 80012478 8EC600FC */ lw $a2, 0xfc($s6) -/* 01307C 8001247C 0C0036EB */ jal func_8000DBAC -/* 013080 80012480 26140010 */ addiu $s4, $s0, 0x10 -/* 013084 80012484 C6080004 */ lwc1 $f8, 4($s0) -/* 013088 80012488 C610000C */ lwc1 $f16, 0xc($s0) -/* 01308C 8001248C 00023400 */ sll $a2, $v0, 0x10 -/* 013090 80012490 46144281 */ sub.s $f10, $f8, $f20 -/* 013094 80012494 00065403 */ sra $t2, $a2, 0x10 -/* 013098 80012498 01403025 */ move $a2, $t2 -/* 01309C 8001249C 46168481 */ sub.s $f18, $f16, $f22 -/* 0130A0 800124A0 E60A0010 */ swc1 $f10, 0x10($s0) -/* 0130A4 800124A4 02A02025 */ move $a0, $s5 -/* 0130A8 800124A8 00002825 */ move $a1, $zero -/* 0130AC 800124AC E6120018 */ swc1 $f18, 0x18($s0) -/* 0130B0 800124B0 0C0AD4AF */ jal vec3s_set -/* 0130B4 800124B4 00003825 */ move $a3, $zero -/* 0130B8 800124B8 02202025 */ move $a0, $s1 -/* 0130BC 800124BC 02A02825 */ move $a1, $s5 -/* 0130C0 800124C0 02803025 */ move $a2, $s4 -/* 0130C4 800124C4 0C0A7B22 */ jal func_8029EC88 -/* 0130C8 800124C8 24070011 */ li $a3, 17 -/* 0130CC 800124CC A602001E */ sh $v0, 0x1e($s0) -.L800124D0: -/* 0130D0 800124D0 26730024 */ addiu $s3, $s3, 0x24 -/* 0130D4 800124D4 1677FFE0 */ bne $s3, $s7, .L80012458 -/* 0130D8 800124D8 26520024 */ addiu $s2, $s2, 0x24 -/* 0130DC 800124DC 8FAB0074 */ lw $t3, 0x74($sp) -/* 0130E0 800124E0 8FAD0070 */ lw $t5, 0x70($sp) -/* 0130E4 800124E4 8FAF0068 */ lw $t7, 0x68($sp) -/* 0130E8 800124E8 8FB90054 */ lw $t9, 0x54($sp) -/* 0130EC 800124EC 3C098016 */ lui $t1, %hi(D_801637C8) # $t1, 0x8016 -/* 0130F0 800124F0 252937C8 */ addiu $t1, %lo(D_801637C8) # addiu $t1, $t1, 0x37c8 -/* 0130F4 800124F4 256C010C */ addiu $t4, $t3, 0x10c -/* 0130F8 800124F8 25AE010C */ addiu $t6, $t5, 0x10c -/* 0130FC 800124FC 25F8010C */ addiu $t8, $t7, 0x10c -/* 013100 80012500 2728010C */ addiu $t0, $t9, 0x10c -/* 013104 80012504 AFA80054 */ sw $t0, 0x54($sp) -/* 013108 80012508 AFB80068 */ sw $t8, 0x68($sp) -/* 01310C 8001250C AFAE0070 */ sw $t6, 0x70($sp) -/* 013110 80012510 AFAC0074 */ sw $t4, 0x74($sp) -/* 013114 80012514 1509FF97 */ bne $t0, $t1, .L80012374 -/* 013118 80012518 26D6010C */ addiu $s6, $s6, 0x10c -/* 01311C 8001251C 1000008B */ b .L8001274C -/* 013120 80012520 8FBF004C */ lw $ra, 0x4c($sp) -.L80012524: -/* 013124 80012524 3C148016 */ lui $s4, %hi(D_801637EC) # $s4, 0x8016 -/* 013128 80012528 269437EC */ addiu $s4, %lo(D_801637EC) # addiu $s4, $s4, 0x37ec -/* 01312C 8001252C 261037C0 */ addiu $s0, $s0, %lo(D_801637C0) # 0x37c0 -/* 013130 80012530 241E0001 */ li $fp, 1 -/* 013134 80012534 27B30090 */ addiu $s3, $sp, 0x90 -/* 013138 80012538 860A0000 */ lh $t2, ($s0) -.L8001253C: -/* 01313C 8001253C 26110004 */ addiu $s1, $s0, 4 -/* 013140 80012540 02202025 */ move $a0, $s1 -/* 013144 80012544 17CA0018 */ bne $fp, $t2, .L800125A8 -/* 013148 80012548 2605001C */ addiu $a1, $s0, 0x1c -/* 01314C 8001254C C6140004 */ lwc1 $f20, 4($s0) -/* 013150 80012550 C616000C */ lwc1 $f22, 0xc($s0) -/* 013154 80012554 8E060020 */ lw $a2, 0x20($s0) -/* 013158 80012558 0C0036EB */ jal func_8000DBAC -/* 01315C 8001255C 26120010 */ addiu $s2, $s0, 0x10 -/* 013160 80012560 C6040004 */ lwc1 $f4, 4($s0) -/* 013164 80012564 C608000C */ lwc1 $f8, 0xc($s0) -/* 013168 80012568 A6020024 */ sh $v0, 0x24($s0) -/* 01316C 8001256C 46142181 */ sub.s $f6, $f4, $f20 -/* 013170 80012570 86060024 */ lh $a2, 0x24($s0) -/* 013174 80012574 02602025 */ move $a0, $s3 -/* 013178 80012578 46164281 */ sub.s $f10, $f8, $f22 -/* 01317C 8001257C E6060010 */ swc1 $f6, 0x10($s0) -/* 013180 80012580 00002825 */ move $a1, $zero -/* 013184 80012584 00003825 */ move $a3, $zero -/* 013188 80012588 0C0AD4AF */ jal vec3s_set -/* 01318C 8001258C E60A0018 */ swc1 $f10, 0x18($s0) -/* 013190 80012590 02202025 */ move $a0, $s1 -/* 013194 80012594 02602825 */ move $a1, $s3 -/* 013198 80012598 02403025 */ move $a2, $s2 -/* 01319C 8001259C 0C0A7B22 */ jal func_8029EC88 -/* 0131A0 800125A0 24070026 */ li $a3, 38 -/* 0131A4 800125A4 A602001E */ sh $v0, 0x1e($s0) -.L800125A8: -/* 0131A8 800125A8 2610002C */ addiu $s0, $s0, 0x2c -/* 0131AC 800125AC 5614FFE3 */ bnel $s0, $s4, .L8001253C -/* 0131B0 800125B0 860A0000 */ lh $t2, ($s0) -/* 0131B4 800125B4 10000065 */ b .L8001274C -/* 0131B8 800125B8 8FBF004C */ lw $ra, 0x4c($sp) -.L800125BC: -/* 0131BC 800125BC 3C108016 */ lui $s0, %hi(D_80163818) # $s0, 0x8016 -/* 0131C0 800125C0 3C128016 */ lui $s2, %hi(D_8016381C) # $s2, 0x8016 -/* 0131C4 800125C4 3C138016 */ lui $s3, %hi(D_80163840) # $s3, 0x8016 -/* 0131C8 800125C8 3C118016 */ lui $s1, %hi(D_80163828) # $s1, 0x8016 -/* 0131CC 800125CC 3C158016 */ lui $s5, %hi(D_80163994) # $s5, 0x8016 -/* 0131D0 800125D0 26B53994 */ addiu $s5, %lo(D_80163994) # addiu $s5, $s5, 0x3994 -/* 0131D4 800125D4 26313828 */ addiu $s1, %lo(D_80163828) # addiu $s1, $s1, 0x3828 -/* 0131D8 800125D8 26733840 */ addiu $s3, %lo(D_80163840) # addiu $s3, $s3, 0x3840 -/* 0131DC 800125DC 2652381C */ addiu $s2, %lo(D_8016381C) # addiu $s2, $s2, 0x381c -/* 0131E0 800125E0 26103818 */ addiu $s0, %lo(D_80163818) # addiu $s0, $s0, 0x3818 -.L800125E4: -/* 0131E4 800125E4 0200A025 */ move $s4, $s0 -/* 0131E8 800125E8 0C004888 */ jal func_80012220 -/* 0131EC 800125EC 02002025 */ move $a0, $s0 -/* 0131F0 800125F0 02402025 */ move $a0, $s2 -/* 0131F4 800125F4 02602825 */ move $a1, $s3 -/* 0131F8 800125F8 02203025 */ move $a2, $s1 -/* 0131FC 800125FC 0C0A7B22 */ jal func_8029EC88 -/* 013200 80012600 24070025 */ li $a3, 37 -/* 013204 80012604 26310034 */ addiu $s1, $s1, 0x34 -/* 013208 80012608 0235082B */ sltu $at, $s1, $s5 -/* 01320C 8001260C 26100034 */ addiu $s0, $s0, 0x34 -/* 013210 80012610 26520034 */ addiu $s2, $s2, 0x34 -/* 013214 80012614 26730034 */ addiu $s3, $s3, 0x34 -/* 013218 80012618 1420FFF2 */ bnez $at, .L800125E4 -/* 01321C 8001261C A682001E */ sh $v0, 0x1e($s4) -/* 013220 80012620 3C108016 */ lui $s0, %hi(D_80163988) # $s0, 0x8016 -/* 013224 80012624 3C128016 */ lui $s2, %hi(D_8016398C) # $s2, 0x8016 -/* 013228 80012628 3C138016 */ lui $s3, %hi(D_801639B0) # $s3, 0x8016 -/* 01322C 8001262C 3C118016 */ lui $s1, %hi(D_80163998) # $s1, 0x8016 -/* 013230 80012630 3C158016 */ lui $s5, %hi(D_80163B04) # $s5, 0x8016 -/* 013234 80012634 26B53B04 */ addiu $s5, %lo(D_80163B04) # addiu $s5, $s5, 0x3b04 -/* 013238 80012638 26313998 */ addiu $s1, %lo(D_80163998) # addiu $s1, $s1, 0x3998 -/* 01323C 8001263C 267339B0 */ addiu $s3, %lo(D_801639B0) # addiu $s3, $s3, 0x39b0 -/* 013240 80012640 2652398C */ addiu $s2, %lo(D_8016398C) # addiu $s2, $s2, 0x398c -/* 013244 80012644 26103988 */ addiu $s0, %lo(D_80163988) # addiu $s0, $s0, 0x3988 -.L80012648: -/* 013248 80012648 0200A025 */ move $s4, $s0 -/* 01324C 8001264C 0C004888 */ jal func_80012220 -/* 013250 80012650 02002025 */ move $a0, $s0 -/* 013254 80012654 02402025 */ move $a0, $s2 -/* 013258 80012658 02602825 */ move $a1, $s3 -/* 01325C 8001265C 02203025 */ move $a2, $s1 -/* 013260 80012660 0C0A7B22 */ jal func_8029EC88 -/* 013264 80012664 24070028 */ li $a3, 40 -/* 013268 80012668 26310034 */ addiu $s1, $s1, 0x34 -/* 01326C 8001266C 0235082B */ sltu $at, $s1, $s5 -/* 013270 80012670 26100034 */ addiu $s0, $s0, 0x34 -/* 013274 80012674 26520034 */ addiu $s2, $s2, 0x34 -/* 013278 80012678 26730034 */ addiu $s3, $s3, 0x34 -/* 01327C 8001267C 1420FFF2 */ bnez $at, .L80012648 -/* 013280 80012680 A682001E */ sh $v0, 0x1e($s4) -/* 013284 80012684 3C108016 */ lui $s0, %hi(D_80163AF8) # $s0, 0x8016 -/* 013288 80012688 3C128016 */ lui $s2, %hi(D_80163AFC) # $s2, 0x8016 -/* 01328C 8001268C 3C138016 */ lui $s3, %hi(D_80163B20) # $s3, 0x8016 -/* 013290 80012690 3C118016 */ lui $s1, %hi(D_80163B08) # $s1, 0x8016 -/* 013294 80012694 3C158016 */ lui $s5, %hi(D_80163C74) # $s5, 0x8016 -/* 013298 80012698 26B53C74 */ addiu $s5, %lo(D_80163C74) # addiu $s5, $s5, 0x3c74 -/* 01329C 8001269C 26313B08 */ addiu $s1, %lo(D_80163B08) # addiu $s1, $s1, 0x3b08 -/* 0132A0 800126A0 26733B20 */ addiu $s3, %lo(D_80163B20) # addiu $s3, $s3, 0x3b20 -/* 0132A4 800126A4 26523AFC */ addiu $s2, %lo(D_80163AFC) # addiu $s2, $s2, 0x3afc -/* 0132A8 800126A8 26103AF8 */ addiu $s0, %lo(D_80163AF8) # addiu $s0, $s0, 0x3af8 -.L800126AC: -/* 0132AC 800126AC 0200A025 */ move $s4, $s0 -/* 0132B0 800126B0 0C004888 */ jal func_80012220 -/* 0132B4 800126B4 02002025 */ move $a0, $s0 -/* 0132B8 800126B8 02402025 */ move $a0, $s2 -/* 0132BC 800126BC 02602825 */ move $a1, $s3 -/* 0132C0 800126C0 02203025 */ move $a2, $s1 -/* 0132C4 800126C4 0C0A7B22 */ jal func_8029EC88 -/* 0132C8 800126C8 24070029 */ li $a3, 41 -/* 0132CC 800126CC 26310034 */ addiu $s1, $s1, 0x34 -/* 0132D0 800126D0 0235082B */ sltu $at, $s1, $s5 -/* 0132D4 800126D4 26100034 */ addiu $s0, $s0, 0x34 -/* 0132D8 800126D8 26520034 */ addiu $s2, $s2, 0x34 -/* 0132DC 800126DC 26730034 */ addiu $s3, $s3, 0x34 -/* 0132E0 800126E0 1420FFF2 */ bnez $at, .L800126AC -/* 0132E4 800126E4 A682001E */ sh $v0, 0x1e($s4) -/* 0132E8 800126E8 3C108016 */ lui $s0, %hi(D_80163C68) # $s0, 0x8016 -/* 0132EC 800126EC 3C128016 */ lui $s2, %hi(D_80163C6C) # $s2, 0x8016 -/* 0132F0 800126F0 3C138016 */ lui $s3, %hi(D_80163C90) # $s3, 0x8016 -/* 0132F4 800126F4 3C118016 */ lui $s1, %hi(D_80163C78) # $s1, 0x8016 -/* 0132F8 800126F8 3C158016 */ lui $s5, %hi(D_80163DE4) # $s5, 0x8016 -/* 0132FC 800126FC 26B53DE4 */ addiu $s5, %lo(D_80163DE4) # addiu $s5, $s5, 0x3de4 -/* 013300 80012700 26313C78 */ addiu $s1, %lo(D_80163C78) # addiu $s1, $s1, 0x3c78 -/* 013304 80012704 26733C90 */ addiu $s3, %lo(D_80163C90) # addiu $s3, $s3, 0x3c90 -/* 013308 80012708 26523C6C */ addiu $s2, %lo(D_80163C6C) # addiu $s2, $s2, 0x3c6c -/* 01330C 8001270C 26103C68 */ addiu $s0, %lo(D_80163C68) # addiu $s0, $s0, 0x3c68 -.L80012710: -/* 013310 80012710 0200A025 */ move $s4, $s0 -/* 013314 80012714 0C004888 */ jal func_80012220 -/* 013318 80012718 02002025 */ move $a0, $s0 -/* 01331C 8001271C 02402025 */ move $a0, $s2 -/* 013320 80012720 02602825 */ move $a1, $s3 -/* 013324 80012724 02203025 */ move $a2, $s1 -/* 013328 80012728 0C0A7B22 */ jal func_8029EC88 -/* 01332C 8001272C 2407002C */ li $a3, 44 -/* 013330 80012730 26310034 */ addiu $s1, $s1, 0x34 -/* 013334 80012734 26100034 */ addiu $s0, $s0, 0x34 -/* 013338 80012738 26520034 */ addiu $s2, $s2, 0x34 -/* 01333C 8001273C 26730034 */ addiu $s3, $s3, 0x34 -/* 013340 80012740 1635FFF3 */ bne $s1, $s5, .L80012710 -/* 013344 80012744 A682001E */ sh $v0, 0x1e($s4) -/* 013348 80012748 8FBF004C */ lw $ra, 0x4c($sp) -.L8001274C: -/* 01334C 8001274C D7B40018 */ ldc1 $f20, 0x18($sp) -/* 013350 80012750 D7B60020 */ ldc1 $f22, 0x20($sp) -/* 013354 80012754 8FB00028 */ lw $s0, 0x28($sp) -/* 013358 80012758 8FB1002C */ lw $s1, 0x2c($sp) -/* 01335C 8001275C 8FB20030 */ lw $s2, 0x30($sp) -/* 013360 80012760 8FB30034 */ lw $s3, 0x34($sp) -/* 013364 80012764 8FB40038 */ lw $s4, 0x38($sp) -/* 013368 80012768 8FB5003C */ lw $s5, 0x3c($sp) -/* 01336C 8001276C 8FB60040 */ lw $s6, 0x40($sp) -/* 013370 80012770 8FB70044 */ lw $s7, 0x44($sp) -/* 013374 80012774 8FBE0048 */ lw $fp, 0x48($sp) -/* 013378 80012778 03E00008 */ jr $ra -/* 01337C 8001277C 27BD00D0 */ addiu $sp, $sp, 0xd0 diff --git a/asm/non_matchings/code_80005FD0/func_80012A48.s b/asm/non_matchings/code_80005FD0/func_80012A48.s deleted file mode 100644 index 0cc9af0c5..000000000 --- a/asm/non_matchings/code_80005FD0/func_80012A48.s +++ /dev/null @@ -1,32 +0,0 @@ -glabel func_80012A48 -/* 013648 80012A48 AFA50004 */ sw $a1, 4($sp) -/* 01364C 80012A4C 8498001E */ lh $t8, 0x1e($a0) -/* 013650 80012A50 C4840004 */ lwc1 $f4, 4($a0) -/* 013654 80012A54 3C088016 */ lui $t0, %hi(gActorList) # $t0, 0x8016 -/* 013658 80012A58 0018C8C0 */ sll $t9, $t8, 3 -/* 01365C 80012A5C 0338C823 */ subu $t9, $t9, $t8 -/* 013660 80012A60 0019C900 */ sll $t9, $t9, 4 -/* 013664 80012A64 2508F9B8 */ addiu $t0, %lo(gActorList) # addiu $t0, $t0, -0x648 -/* 013668 80012A68 03281021 */ addu $v0, $t9, $t0 -/* 01366C 80012A6C E4440018 */ swc1 $f4, 0x18($v0) -/* 013670 80012A70 C4860008 */ lwc1 $f6, 8($a0) -/* 013674 80012A74 3C09800E */ lui $t1, %hi(gIsMirrorMode) -/* 013678 80012A78 00057400 */ sll $t6, $a1, 0x10 -/* 01367C 80012A7C E446001C */ swc1 $f6, 0x1c($v0) -/* 013680 80012A80 C488000C */ lwc1 $f8, 0xc($a0) -/* 013684 80012A84 000E7C03 */ sra $t7, $t6, 0x10 -/* 013688 80012A88 01E02825 */ move $a1, $t7 -/* 01368C 80012A8C E4480020 */ swc1 $f8, 0x20($v0) -/* 013690 80012A90 8D29C604 */ lw $t1, %lo(gIsMirrorMode)($t1) -/* 013694 80012A94 000F5023 */ negu $t2, $t7 -/* 013698 80012A98 51200004 */ beql $t1, $zero, .L80012AAC -/* 01369C 80012A9C A4450012 */ sh $a1, 0x12($v0) -/* 0136A0 80012AA0 10000002 */ b .L80012AAC -/* 0136A4 80012AA4 A44A0012 */ sh $t2, 0x12($v0) -/* 0136A8 80012AA8 A4450012 */ sh $a1, 0x12($v0) -.L80012AAC: -/* 0136AC 80012AAC C48A0010 */ lwc1 $f10, 0x10($a0) -/* 0136B0 80012AB0 E44A0024 */ swc1 $f10, 0x24($v0) -/* 0136B4 80012AB4 C4900018 */ lwc1 $f16, 0x18($a0) -/* 0136B8 80012AB8 03E00008 */ jr $ra -/* 0136BC 80012ABC E450002C */ swc1 $f16, 0x2c($v0) diff --git a/asm/non_matchings/code_80005FD0/func_800147E0.s b/asm/non_matchings/code_80005FD0/func_800147E0.s index e0a6c6cb9..e757c8950 100644 --- a/asm/non_matchings/code_80005FD0/func_800147E0.s +++ b/asm/non_matchings/code_80005FD0/func_800147E0.s @@ -17,11 +17,11 @@ glabel func_800147E0 /* 01541C 8001481C 8DEFC53C */ lw $t7, %lo(gModeSelection)($t7) /* 015420 80014820 27BDFFE0 */ addiu $sp, $sp, -0x20 /* 015424 80014824 24010001 */ li $at, 1 -/* 015428 80014828 3C188016 */ lui $t8, %hi(D_80163818) # $t8, 0x8016 +/* 015428 80014828 3C188016 */ lui $t8, %hi(gBoxTruckList) # $t8, 0x8016 /* 01542C 8001482C AFBF001C */ sw $ra, 0x1c($sp) /* 015430 80014830 46305003 */ div.d $f0, $f10, $f16 /* 015434 80014834 24060007 */ li $a2, 7 -/* 015438 80014838 27183818 */ addiu $t8, %lo(D_80163818) # addiu $t8, $t8, 0x3818 +/* 015438 80014838 27183818 */ addiu $t8, %lo(gBoxTruckList) # addiu $t8, $t8, 0x3818 /* 01543C 8001483C 00003825 */ move $a3, $zero /* 015440 80014840 3C198016 */ lui $t9, %hi(D_80164550) # $t9, 0x8016 /* 015444 80014844 46320100 */ add.d $f4, $f0, $f18 diff --git a/asm/non_matchings/code_80005FD0/func_80014934.s b/asm/non_matchings/code_80005FD0/func_80014934.s index 3e3f65558..51e7010e6 100644 --- a/asm/non_matchings/code_80005FD0/func_80014934.s +++ b/asm/non_matchings/code_80005FD0/func_80014934.s @@ -17,11 +17,11 @@ glabel func_80014934 /* 015570 80014970 8DEFC53C */ lw $t7, %lo(gModeSelection)($t7) /* 015574 80014974 27BDFFE0 */ addiu $sp, $sp, -0x20 /* 015578 80014978 24010001 */ li $at, 1 -/* 01557C 8001497C 3C188016 */ lui $t8, %hi(D_80163988) # $t8, 0x8016 +/* 01557C 8001497C 3C188016 */ lui $t8, %hi(gSchoolBusList) # $t8, 0x8016 /* 015580 80014980 AFBF001C */ sw $ra, 0x1c($sp) /* 015584 80014984 46305003 */ div.d $f0, $f10, $f16 /* 015588 80014988 24060007 */ li $a2, 7 -/* 01558C 8001498C 27183988 */ addiu $t8, %lo(D_80163988) # addiu $t8, $t8, 0x3988 +/* 01558C 8001498C 27183988 */ addiu $t8, %lo(gSchoolBusList) # addiu $t8, $t8, 0x3988 /* 015590 80014990 2407004B */ li $a3, 75 /* 015594 80014994 3C198016 */ lui $t9, %hi(D_80164550) # $t9, 0x8016 /* 015598 80014998 46320100 */ add.d $f4, $f0, $f18 diff --git a/asm/non_matchings/code_80005FD0/func_80014A88.s b/asm/non_matchings/code_80005FD0/func_80014A88.s index 23e139a72..bc524bc5e 100644 --- a/asm/non_matchings/code_80005FD0/func_80014A88.s +++ b/asm/non_matchings/code_80005FD0/func_80014A88.s @@ -17,11 +17,11 @@ glabel func_80014A88 /* 0156C4 80014AC4 8DEFC53C */ lw $t7, %lo(gModeSelection)($t7) /* 0156C8 80014AC8 27BDFFE0 */ addiu $sp, $sp, -0x20 /* 0156CC 80014ACC 24010001 */ li $at, 1 -/* 0156D0 80014AD0 3C188016 */ lui $t8, %hi(D_80163AF8) # $t8, 0x8016 +/* 0156D0 80014AD0 3C188016 */ lui $t8, %hi(gTankerTruckList) # $t8, 0x8016 /* 0156D4 80014AD4 AFBF001C */ sw $ra, 0x1c($sp) /* 0156D8 80014AD8 46305003 */ div.d $f0, $f10, $f16 /* 0156DC 80014ADC 24060007 */ li $a2, 7 -/* 0156E0 80014AE0 27183AF8 */ addiu $t8, %lo(D_80163AF8) # addiu $t8, $t8, 0x3af8 +/* 0156E0 80014AE0 27183AF8 */ addiu $t8, %lo(gTankerTruckList) # addiu $t8, $t8, 0x3af8 /* 0156E4 80014AE4 24070032 */ li $a3, 50 /* 0156E8 80014AE8 3C198016 */ lui $t9, %hi(D_80164550) # $t9, 0x8016 /* 0156EC 80014AEC 46320100 */ add.d $f4, $f0, $f18 diff --git a/asm/non_matchings/code_80005FD0/func_80014BDC.s b/asm/non_matchings/code_80005FD0/func_80014BDC.s index 02029a770..6a35f3373 100644 --- a/asm/non_matchings/code_80005FD0/func_80014BDC.s +++ b/asm/non_matchings/code_80005FD0/func_80014BDC.s @@ -17,11 +17,11 @@ glabel func_80014BDC /* 015818 80014C18 8DEFC53C */ lw $t7, %lo(gModeSelection)($t7) /* 01581C 80014C1C 27BDFFE0 */ addiu $sp, $sp, -0x20 /* 015820 80014C20 24010001 */ li $at, 1 -/* 015824 80014C24 3C188016 */ lui $t8, %hi(D_80163C68) # $t8, 0x8016 +/* 015824 80014C24 3C188016 */ lui $t8, %hi(gCarList) # $t8, 0x8016 /* 015828 80014C28 AFBF001C */ sw $ra, 0x1c($sp) /* 01582C 80014C2C 46305003 */ div.d $f0, $f10, $f16 /* 015830 80014C30 24060007 */ li $a2, 7 -/* 015834 80014C34 27183C68 */ addiu $t8, %lo(D_80163C68) # addiu $t8, $t8, 0x3c68 +/* 015834 80014C34 27183C68 */ addiu $t8, %lo(gCarList) # addiu $t8, $t8, 0x3c68 /* 015838 80014C38 24070019 */ li $a3, 25 /* 01583C 80014C3C 3C198016 */ lui $t9, %hi(D_80164550) # $t9, 0x8016 /* 015840 80014C40 46320100 */ add.d $f4, $f0, $f18 diff --git a/include/actor_types.h b/include/actor_types.h index 0efe7c7c6..1fb7a8fff 100644 --- a/include/actor_types.h +++ b/include/actor_types.h @@ -49,10 +49,14 @@ exactly what you're doing. #define ACTOR_MARIO_RACEWAY_SIGN 0x17 #define ACTOR_PALM_TREE 0x19 #define ACTOR_WARIO_STADIUM_SIGN 0x23 +#define ACTOR_BOX_TRUCK 0x25 #define ACTOR_PADDLE_WHEEL_BOAT 0x26 #define ACTOR_RAILROAD_CROSSING 0x27 +#define ACTOR_SCHOOL_BUS 0x28 +#define ACTOR_TANKER_TRUCK 0x29 #define ACTOR_BLUE_SPINY_SHELL 0x2A #define ACTOR_HOT_AIR_BALLOON_ITEM_BOX 0x2B +#define ACTOR_CAR 0x2C #define ACTOR_KIWANO_FRUIT 0x2D #define ACTOR_LIST_SIZE 100 @@ -101,7 +105,8 @@ struct RailroadCrossing { /* 0x06 */ s16 crossingId; /* 0x08 */ f32 unk_08; /* 0x0C */ f32 unk_0C; - /* 0x10 */ Vec4s unk_10; + /* 0x10 */ Vec3s rot; + /* 0x16 */ s16 unk_16; /* 0x18 */ Vec3f pos; /* 0x24 */ Vec3f velocity; /* 0x30 */ UnkActorInner unk30; diff --git a/include/vehicles.h b/include/vehicles.h new file mode 100644 index 000000000..e3e142fd1 --- /dev/null +++ b/include/vehicles.h @@ -0,0 +1,92 @@ +#ifndef VEHICLES_H +#define VEHICLES_H + +#include "common_structs.h" + +#define NUM_1P_PASSENGER_CARS 5 +#define NUM_2P_PASSENGER_CARS 2 +#define NUM_PASSENGER_CAR_ENTRIES 5 +#define NUM_TRAINS 2 + +#define NUM_PADDLE_WHEEL_BOATS 1 + +#define NUM_RACE_BOX_TRUCKS 7 +#define NUM_RACE_SCHOOL_BUSES 7 +#define NUM_RACE_TANKER_TRUCKS 7 +#define NUM_RACE_CARS 7 + +#define NUM_TIME_TRIAL_BOX_TRUCKS (NUM_RACE_BOX_TRUCKS + 1) +#define NUM_TIME_TRIAL_SCHOOL_BUSES (NUM_RACE_SCHOOL_BUSES + 1) +#define NUM_TIME_TRIAL_TANKER_TRUCKS (NUM_RACE_TANKER_TRUCKS + 1) +#define NUM_TIME_TRIAL_CARS (NUM_RACE_CARS + 1) + +typedef struct { + /* 0x00 */ s16 isActive; // Only used for Tender and Passenger Cars, unused for Locomotives + /* 0x02 */ s16 compilerPadding; + /* 0x04 */ Vec3f position; + /* 0x10 */ Vec3f velocity; + /* 0x1C */ s16 wayPointIndex; + /* 0x1E */ s16 actorIndex; + /* 0x20 */ s32 unused; // Not read or written. Could be padding? +} TrainCarStuff; // size = 0x24; + +typedef struct { + /* 0x000 */ TrainCarStuff locomotive; + /* 0x024 */ TrainCarStuff tender; + /* 0x048 */ TrainCarStuff passengerCars[NUM_PASSENGER_CAR_ENTRIES]; + /* 0x0FC */ f32 someMultiplier; + /* 0x100 */ s32 someFlags; + /* 0x104 */ s32 numCars; // Non-locomotive car count? + /* 0x108 */ s32 unused; // Not read or written. Could be padding? +} TrainStuff; // size = 0x10C + +typedef struct { + /* 0x00 */ s16 isActive; // The paddle wheel boat only shows up if the number of players is < 3 + /* 0x02 */ // s16 compilerPadding; + /* 0x04 */ Vec3f position; // + /* 0x10 */ Vec3f velocity; // + /* 0x1C */ s16 wayPointIndex; // + /* 0x1E */ s16 actorIndex; // + /* 0x20 */ f32 someMultiplier; // + /* 0x24 */ s16 yRotation; // Only Y rotation is tracked in this struct + /* 0x26 */ // s16 compilerPadding2; + /** + * Bit field that tracks whether a given human player is within a certain distance of the boat + * Probably audio related + **/ + /* 0x28 */ s32 someFlags; +} PaddleWheelBoatStuff; // size = 0x2C + +typedef struct { + /* 0x00 */ s16 unused; // Gets set to 0, but doesn't seem to have any purpose + /* 0x02 */ // s16 compilerPadding; + /* 0x04 */ Vec3f position; + /* 0x10 */ Vec3f velocity; + /* 0x1C */ s16 wayPointIndex; + /* 0x1E */ s16 actorIndex; + /* 0x20 */ f32 someMultiplier; // + /* 0x24 */ f32 someMultiplierTheSequel; // + /* 0x28 */ Vec3s rotation; + /* 0x2E */ s16 someType; // + /** + * Each set of flags seems to be a bit field tracking whether a given human player + * is within a certain distance of the vehicle. Likely related to audio stuff + * Seems to turn on/off based on player distance from the vehicle + **/ + /* 0x30 */ s8 someFlags; // + /* 0x31 */ s8 someFlagsTheSequel; // + /* 0x32 */ // s16 compilerPadding2; +} VehicleStuff; // size = 0x34 + +extern TrainStuff D_801635A0[]; + +// This is an array, maybe they intended to have multiple boats at some point in development? +extern PaddleWheelBoatStuff D_801637C0[]; + +// Lists for different vehicles in Toad's Turnpike +extern VehicleStuff gBoxTruckList[]; +extern VehicleStuff gSchoolBusList[]; +extern VehicleStuff gTankerTruckList[]; +extern VehicleStuff gCarList[]; + +#endif diff --git a/src/actors.c b/src/actors.c index be1d77542..ca83323d5 100644 --- a/src/actors.c +++ b/src/actors.c @@ -202,7 +202,7 @@ void func_80296D10(struct Actor *actor, Vec3f startingPos, Vec3s startingRot, Ve sp2C = temp_a0; func_802AAAAC(temp_a0); switch ((s16) actorType) { - case 37: + case ACTOR_BOX_TRUCK: temp_v0 = D_802BA260; phi_v0 = (s16) temp_v0; if ((s32) temp_v0 >= 3) { @@ -326,7 +326,7 @@ void func_80296D10(struct Actor *actor, Vec3f startingPos, Vec3s startingRot, Ve actor->boundingBoxSize = 3.0f; actor->unk_08 = 7.0f; return; - case 25: + case ACTOR_PALM_TREE: actor->flags |= 0x4000; actor->state = 0x003C; actor->boundingBoxSize = 3.0f; @@ -5030,21 +5030,21 @@ void func_802A29BC(Camera *arg0, Mat4 arg1, struct Actor *arg2) { s32 D_802B8850[] = {0, 0, 0}; s16 D_802B885C[] = {0, 0, 0}; -void func_802A2AD0(Camera *arg0, struct Actor *arg1) { +void func_802A2AD0(Camera *arg0, struct RailroadCrossing *rr_crossing) { Vec3s sp80 = {0, 0, 0}; Mat4 sp40; - f32 unk = func_802B80D0(arg0->pos, arg1->pos, arg0->rot[1], 0.0f, D_80150130[arg0 - camera1], 4000000.0f); + f32 unk = func_802B80D0(arg0->pos, rr_crossing->pos, arg0->rot[1], 0.0f, D_80150130[arg0 - camera1], 4000000.0f); - if (unk < 0.0f) { return; } - func_802B5F74(sp40, arg1->pos, arg1->rot); - if (func_802B4FF8(sp40, 0) == 0) { return; } + if (!(unk < 0.0f)) { + func_802B5F74(sp40, rr_crossing->pos, rr_crossing->rot); + if (func_802B4FF8(sp40, 0) != 0) { gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING); gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK); - if (D_801637B8[arg1->state]) { + if (D_801637B8[rr_crossing->crossingId]) { - if (arg1->unk_04 < 20) { + if (rr_crossing->someTimer < 20) { gSPDisplayList(gDisplayListHead++, D_06010AE8); } else { gSPDisplayList(gDisplayListHead++, D_06010C10); @@ -5053,6 +5053,8 @@ void func_802A2AD0(Camera *arg0, struct Actor *arg1) { gSPDisplayList(gDisplayListHead++, D_06010D38); } gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK); + } + } } void func_802A2C78(Camera *arg0, Mat4 arg1, struct Actor *arg2) { @@ -5249,25 +5251,25 @@ void func_802A3008(struct UnkStruct_800DC5EC *arg0) { case ACTOR_WARIO_STADIUM_SIGN: func_802A269C(temp_s1, actor); break; - case 25: + case ACTOR_PALM_TREE: func_802A2C78(temp_s1, D_801502C0, actor); break; case ACTOR_PADDLE_WHEEL_BOAT: func_8029AE1C(temp_s1, actor, D_801502C0, sp92); break; - case 37: + case ACTOR_BOX_TRUCK: func_8029B06C(temp_s1, actor); break; - case 40: + case ACTOR_SCHOOL_BUS: func_8029B2E4(temp_s1, actor); break; - case 41: + case ACTOR_TANKER_TRUCK: func_8029B6EC(temp_s1, actor); break; - case 44: + case ACTOR_CAR: func_8029B4E0(temp_s1, actor); break; - case 39: + case ACTOR_RAILROAD_CROSSING: func_802A2AD0(temp_s1, actor); break; case ACTOR_YOSHI_VALLEY_EGG: diff --git a/src/actors.h b/src/actors.h index 3b02ca16b..310c3ba20 100644 --- a/src/actors.h +++ b/src/actors.h @@ -97,7 +97,7 @@ void func_802A1EA0(Camera*, struct Actor*); void func_802A269C(Camera*, struct Actor*); void func_802A27A0(Camera*, Mat4, struct YoshiValleyEgg*, u16); void func_802A29BC(Camera*, Mat4, struct Actor*); -void func_802A2AD0(Camera*, struct Actor*); +void func_802A2AD0(Camera*, struct RailroadCrossing*); void func_802A2C78(Camera*, Mat4, struct Actor*); void func_802A2F34(struct UnkStruct_800DC5EC*); void func_802A3008(struct UnkStruct_800DC5EC*); diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index d1c1517e4..f29dc55bc 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -5,10 +5,13 @@ #include "memory.h" #include "waypoints.h" #include "camera.h" +#include "actors.h" #include "code_80005FD0.h" +#include "code_8001F980.h" #include "code_80027D00.h" #include "variables.h" #include +#include "vehicles.h" s16 func_80005FD0(Vec3f arg0, Vec3f arg1) { s16 temp_ret; @@ -82,14 +85,14 @@ s32 func_800061DC(Vec3f arg0, f32 arg1, s32 arg2) { temp_f0 = arg0[0]; temp_f2 = arg0[2]; switch (gActiveScreenMode) { - case 0: + case SCREEN_MODE_1P: var_v0 = 1; break; - case 1: - case 2: + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: var_v0 = 2; break; - case 3: + case SCREEN_MODE_3P_4P_SPLITSCREEN: var_v0 = D_8018EDF3; break; default: @@ -3154,8 +3157,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000BA14.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -extern f32 D_80162FA0; +//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de extern f32 D_80162FA8; void func_8000BBD8(s32 wayPointIndex, f32 arg1, s16 pathIndex) { @@ -3198,7 +3200,7 @@ void func_8000BBD8(s32 wayPointIndex, f32 arg1, s16 pathIndex) { sp0 = temp_f4_2; temp_f0 = 0.5f - (arg1 * 0.5f); temp_f12 = 1.0f - temp_f0; - D_80162FA0 = (((f32) temp_v0->wayPointX + temp_f8) * temp_f0 * 0.5f) + (temp_f12 * ((f32) temp_t0->wayPointX + temp_f8_2) * 0.5f); + *D_80162FA0 = (((f32) temp_v0->wayPointX + temp_f8) * temp_f0 * 0.5f) + (temp_f12 * ((f32) temp_t0->wayPointX + temp_f8_2) * 0.5f); D_80162FA8 = (((f32) temp_v0->wayPointZ + temp_f4) * temp_f0 * 0.5f) + (temp_f12 * (sp8 + temp_f4_2) * 0.5f); } #else @@ -6399,377 +6401,233 @@ loop_1: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012190.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8000D6D0(void *, void *, s32, s32, s32, s32); // extern -? func_8000D940(void *, void *, s32, s32, s32); // extern -extern s16 D_8016347A; +void func_80012220(VehicleStuff *vehicle) { + f32 origXPos; + f32 stackPadding; + f32 origZPos; -void func_80012220(void *arg0) { - f32 sp34; - f32 sp2C; - - sp34 = arg0->unk4; - sp2C = arg0->unkC; + origXPos = vehicle->position[0]; + origZPos = vehicle->position[2]; if (D_8016347A == 0) { - func_8000D6D0(arg0 + 4, arg0 + 0x1C, arg0->unk20, arg0->unk24, 0, 3); - arg0->unk28 = 0; - arg0->unk2A = -0x8000; + func_8000D6D0(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); + vehicle->rotation[0] = 0; + vehicle->rotation[1] = -0x8000; + vehicle->rotation[2] = 0; } else { - func_8000D940(arg0 + 4, arg0 + 0x1C, arg0->unk20, arg0->unk24, 0); - arg0->unk28 = 0; - arg0->unk2A = 0; + func_8000D940(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); + vehicle->rotation[0] = 0; + vehicle->rotation[1] = 0; + vehicle->rotation[2] = 0; } - arg0->unk2C = 0; - arg0->unk10 = arg0->unk4 - sp34; - arg0->unk18 = arg0->unkC - sp2C; + vehicle->velocity[0] = vehicle->position[0] - origXPos; + vehicle->velocity[2] = vehicle->position[2] - origZPos; } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012220.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -s16 func_8000DBAC(f32 *, ? *, s32); /* extern */ -? func_80012220(? *); /* extern */ -extern ? D_801635A0; -extern f32 D_801635A4; -extern f32 D_801635B0; -extern ? D_801635BC; -extern ? D_801637C0; -extern ? D_801637C8; -extern ? D_801637EC; -extern ? D_80163818; -extern f32 D_8016381C; -extern f32 D_80163828; -extern s16 D_80163840; -extern ? D_80163988; -extern f32 D_8016398C; -extern ? D_80163994; -extern f32 D_80163998; -extern s16 D_801639B0; -extern ? D_80163AF8; -extern f32 D_80163AFC; -extern ? D_80163B04; -extern f32 D_80163B08; -extern s16 D_80163B20; -extern ? D_80163C68; -extern f32 D_80163C6C; -extern ? D_80163C74; -extern f32 D_80163C78; -extern s16 D_80163C90; -extern ? D_80163DE4; -s16 gCurrentCourseId; /* unable to generate initializer */ void func_800122D8(void) { - s16 spAC; - s16 sp90; - f32 *sp74; - ? *sp70; - ? *sp68; - f32 *sp54; - ? *temp_s4; - ? *temp_s4_2; - ? *temp_s4_3; - ? *temp_s4_4; - ? *var_s0; - ? *var_s0_2; - ? *var_s0_3; - ? *var_s0_4; - ? *var_s0_5; - ? *var_s2; - ? *var_s6; - f32 *temp_s1; - f32 *temp_s1_2; - f32 *temp_s1_3; - f32 *temp_t0; - f32 *var_s1; - f32 *var_s1_2; - f32 *var_s1_3; - f32 *var_s1_4; - f32 *var_s2_2; - f32 *var_s2_3; - f32 *var_s2_4; - f32 *var_s2_5; - f32 temp_f20; - f32 temp_f20_2; - f32 temp_f20_3; - f32 temp_f20_4; - f32 temp_f22; - f32 temp_f22_2; - f32 temp_f22_3; - f32 temp_f22_4; - s16 *var_s3_2; - s16 *var_s3_3; - s16 *var_s3_4; - s16 *var_s3_5; - s16 temp_a2; - s16 temp_a2_2; - s16 temp_a2_3; - s16 temp_v0; - s16 temp_v0_2; - s16 temp_v0_3; - s16 temp_v0_4; - s16 temp_v0_5; - s32 var_s3; - void *temp_s0; - void *temp_s0_2; + s16 trainCarYRot; + f32 stackPadding0; + f32 stackPadding1; + f32 stackPadding2; + TrainCarStuff *tempLocomotive; + TrainCarStuff *tempTender; + TrainCarStuff *tempPassengerCar; + Vec3s trainCarRot; + VehicleStuff *tempBoxTruck; + VehicleStuff *tempSchoolBus; + VehicleStuff *tempTankerTruck; + VehicleStuff *tempCar; + PaddleWheelBoatStuff *tempPaddleWheelBoat; + Vec3s paddleWheelBoatRot; + s32 loopIndex; + s32 loopIndex2; + f32 origXPos; + f32 origZPos; - temp_v0 = gCurrentCourseId; - switch (temp_v0) { /* irregular */ - case 11: - var_s6 = &D_801635A0; - sp68 = &D_801635A0; - sp74 = &D_801635A4; - sp70 = &D_801635BC; - sp54 = &D_801635B0; - do { - temp_f20 = var_s6->unk4; - temp_f22 = var_s6->unkC; - temp_a2 = func_8000DBAC(sp74, sp70, var_s6->unkFC); - var_s6->unk10 = (f32) (var_s6->unk4 - temp_f20); - var_s6->unk18 = (f32) (var_s6->unkC - temp_f22); - vec3s_set(&spAC, 0, temp_a2, 0); - temp_s0 = var_s6 + 0x24; - var_s6->unk1E = func_8029EC88(sp74, &spAC, sp54, 0x000F); - temp_s1 = temp_s0 + 4; - if (var_s6->unk24 == 1) { - temp_f20_2 = temp_s0->unk4; - temp_f22_2 = temp_s0->unkC; - temp_a2_2 = func_8000DBAC(temp_s1, temp_s0 + 0x1C, var_s6->unkFC); - temp_s0->unk10 = (f32) (temp_s0->unk4 - temp_f20_2); - temp_s0->unk18 = (f32) (temp_s0->unkC - temp_f22_2); - vec3s_set(&spAC, 0, temp_a2_2, 0); - temp_s0->unk1E = func_8029EC88(temp_s1, &spAC, temp_s0 + 0x10, 0x0010); + switch (gCurrentCourseId) { + case COURSE_KALAMARI_DESERT: + for(loopIndex = 0; loopIndex < NUM_TRAINS; loopIndex++) { + tempLocomotive = &D_801635A0[loopIndex].locomotive; + origXPos = tempLocomotive->position[0]; + origZPos = tempLocomotive->position[2]; + trainCarYRot = func_8000DBAC(tempLocomotive->position, &tempLocomotive->wayPointIndex, D_801635A0[loopIndex].someMultiplier); + tempLocomotive->velocity[0] = tempLocomotive->position[0] - origXPos; + tempLocomotive->velocity[2] = tempLocomotive->position[2] - origZPos; + vec3s_set(trainCarRot, 0, trainCarYRot, 0); + tempLocomotive->actorIndex = func_8029EC88(tempLocomotive->position, trainCarRot, tempLocomotive->velocity, ACTOR_TRAIN_ENGINE); + + tempTender = &D_801635A0[loopIndex].tender; + if (tempTender->isActive == 1) { + origXPos = tempTender->position[0]; + origZPos = tempTender->position[2]; + trainCarYRot = func_8000DBAC(tempTender->position, &tempTender->wayPointIndex, D_801635A0[loopIndex].someMultiplier); + tempTender->velocity[0] = tempTender->position[0] - origXPos; + tempTender->velocity[2] = tempTender->position[2] - origZPos; + vec3s_set(trainCarRot, 0, trainCarYRot, 0); + tempTender->actorIndex = func_8029EC88(tempTender->position, trainCarRot, tempTender->velocity, ACTOR_TRAIN_TENDER); } - var_s3 = 0; - var_s2 = sp68; -loop_8: - temp_s0_2 = var_s2 + 0x48; - temp_s1_2 = temp_s0_2 + 4; - if (var_s2->unk48 == 1) { - temp_f20_3 = temp_s0_2->unk4; - temp_f22_3 = temp_s0_2->unkC; - temp_a2_3 = func_8000DBAC(temp_s1_2, temp_s0_2 + 0x1C, var_s6->unkFC); - temp_s0_2->unk10 = (f32) (temp_s0_2->unk4 - temp_f20_3); - temp_s0_2->unk18 = (f32) (temp_s0_2->unkC - temp_f22_3); - vec3s_set(&spAC, 0, temp_a2_3, 0); - temp_s0_2->unk1E = func_8029EC88(temp_s1_2, &spAC, temp_s0_2 + 0x10, 0x0011); + + for(loopIndex2 = 0; loopIndex2 < NUM_PASSENGER_CAR_ENTRIES; loopIndex2++) { + tempPassengerCar = &D_801635A0[loopIndex].passengerCars[loopIndex2]; + if (tempPassengerCar->isActive == 1) { + origXPos = tempPassengerCar->position[0]; + origZPos = tempPassengerCar->position[2]; + trainCarYRot = func_8000DBAC(tempPassengerCar->position, &tempPassengerCar->wayPointIndex, D_801635A0[loopIndex].someMultiplier); + tempPassengerCar->velocity[0] = tempPassengerCar->position[0] - origXPos; + tempPassengerCar->velocity[2] = tempPassengerCar->position[2] - origZPos; + vec3s_set(trainCarRot, 0, trainCarYRot, 0); + tempPassengerCar->actorIndex = func_8029EC88(tempPassengerCar->position, trainCarRot, tempPassengerCar->velocity, ACTOR_TRAIN_PASSENGER_CAR); + } } - var_s3 += 0x24; - var_s2 += 0x24; - if (var_s3 != 0xB4) { - goto loop_8; + } + break; + case COURSE_DK_JUNGLE: + for(loopIndex = 0; loopIndex < NUM_PADDLE_WHEEL_BOATS; loopIndex++) { + tempPaddleWheelBoat = &D_801637C0[loopIndex]; + if(tempPaddleWheelBoat->isActive == 1) { + origXPos = tempPaddleWheelBoat->position[0]; + origZPos = tempPaddleWheelBoat->position[2]; + tempPaddleWheelBoat->yRotation = func_8000DBAC(tempPaddleWheelBoat->position, &tempPaddleWheelBoat->wayPointIndex, tempPaddleWheelBoat->someMultiplier); + tempPaddleWheelBoat->velocity[0] = tempPaddleWheelBoat->position[0] - origXPos; + tempPaddleWheelBoat->velocity[2] = tempPaddleWheelBoat->position[2] - origZPos; + vec3s_set(paddleWheelBoatRot, 0, tempPaddleWheelBoat->yRotation, 0); + tempPaddleWheelBoat->actorIndex = func_8029EC88(tempPaddleWheelBoat->position, paddleWheelBoatRot, tempPaddleWheelBoat->velocity, ACTOR_PADDLE_WHEEL_BOAT); } - temp_t0 = sp54 + 0x10C; - sp54 = temp_t0; - sp68 += 0x10C; - sp70 += 0x10C; - sp74 += 0x10C; - var_s6 += 0x10C; - } while (temp_t0 != &D_801637C8); - return; - case 18: - var_s0 = &D_801637C0; - do { - temp_s1_3 = var_s0 + 4; - if (var_s0->unk0 == 1) { - temp_f20_4 = var_s0->unk4; - temp_f22_4 = var_s0->unkC; - var_s0->unk24 = func_8000DBAC(temp_s1_3, var_s0 + 0x1C, var_s0->unk20); - var_s0->unk10 = (f32) (var_s0->unk4 - temp_f20_4); - var_s0->unk18 = (f32) (var_s0->unkC - temp_f22_4); - vec3s_set(&sp90, 0, var_s0->unk24, 0); - var_s0->unk1E = func_8029EC88(temp_s1_3, &sp90, var_s0 + 0x10, 0x0026); - } - var_s0 += 0x2C; - } while (var_s0 != &D_801637EC); - return; - case 10: - var_s1 = &D_80163828; - var_s3_2 = &D_80163840; - var_s2_2 = &D_8016381C; - var_s0_2 = &D_80163818; - do { - temp_s4 = var_s0_2; - func_80012220(var_s0_2); - temp_v0_2 = func_8029EC88(var_s2_2, var_s3_2, var_s1, 0x0025); - var_s1 += 0x34; - var_s0_2 += 0x34; - var_s2_2 += 0x34; - var_s3_2 += 0x34; - temp_s4->unk1E = temp_v0_2; - } while ((u32) var_s1 < (u32) &D_80163994); - var_s1_2 = &D_80163998; - var_s3_3 = &D_801639B0; - var_s2_3 = &D_8016398C; - var_s0_3 = &D_80163988; - do { - temp_s4_2 = var_s0_3; - func_80012220(var_s0_3); - temp_v0_3 = func_8029EC88(var_s2_3, var_s3_3, var_s1_2, 0x0028); - var_s1_2 += 0x34; - var_s0_3 += 0x34; - var_s2_3 += 0x34; - var_s3_3 += 0x34; - temp_s4_2->unk1E = temp_v0_3; - } while ((u32) var_s1_2 < (u32) &D_80163B04); - var_s1_3 = &D_80163B08; - var_s3_4 = &D_80163B20; - var_s2_4 = &D_80163AFC; - var_s0_4 = &D_80163AF8; - do { - temp_s4_3 = var_s0_4; - func_80012220(var_s0_4); - temp_v0_4 = func_8029EC88(var_s2_4, var_s3_4, var_s1_3, 0x0029); - var_s1_3 += 0x34; - var_s0_4 += 0x34; - var_s2_4 += 0x34; - var_s3_4 += 0x34; - temp_s4_3->unk1E = temp_v0_4; - } while ((u32) var_s1_3 < (u32) &D_80163C74); - var_s1_4 = &D_80163C78; - var_s3_5 = &D_80163C90; - var_s2_5 = &D_80163C6C; - var_s0_5 = &D_80163C68; - do { - temp_s4_4 = var_s0_5; - func_80012220(var_s0_5); - temp_v0_5 = func_8029EC88(var_s2_5, var_s3_5, var_s1_4, 0x002C); - var_s1_4 += 0x34; - var_s0_5 += 0x34; - var_s2_5 += 0x34; - var_s3_5 += 0x34; - temp_s4_4->unk1E = temp_v0_5; - } while (var_s1_4 != &D_80163DE4); - return; + } + break; + case COURSE_TOADS_TURNPIKE: + for(loopIndex = 0; loopIndex < NUM_RACE_BOX_TRUCKS; loopIndex++) { + tempBoxTruck = &gBoxTruckList[loopIndex]; + func_80012220(tempBoxTruck); + tempBoxTruck->actorIndex = func_8029EC88(tempBoxTruck->position, tempBoxTruck->rotation, tempBoxTruck->velocity, ACTOR_BOX_TRUCK); + } + for(loopIndex = 0; loopIndex < NUM_RACE_SCHOOL_BUSES; loopIndex++) { + tempSchoolBus = &gSchoolBusList[loopIndex]; + func_80012220(tempSchoolBus); + tempSchoolBus->actorIndex = func_8029EC88(tempSchoolBus->position, tempSchoolBus->rotation, tempSchoolBus->velocity, ACTOR_SCHOOL_BUS); + } + for(loopIndex = 0; loopIndex < NUM_RACE_TANKER_TRUCKS; loopIndex++) { + tempTankerTruck = &gTankerTruckList[loopIndex]; + func_80012220(tempTankerTruck); + tempTankerTruck->actorIndex = func_8029EC88(tempTankerTruck->position, tempTankerTruck->rotation, tempTankerTruck->velocity, ACTOR_TANKER_TRUCK); + } + for(loopIndex = 0; loopIndex < NUM_RACE_CARS; loopIndex++) { + tempCar = &gCarList[loopIndex]; + func_80012220(tempCar); + tempCar->actorIndex = func_8029EC88(tempCar->position, tempCar->rotation, tempCar->velocity, ACTOR_CAR); + } + break; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800122D8.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern s16 D_80162EB0; -void func_80012780(void *arg0, void *arg1, s16 arg2) { - arg0->unk4 = arg1->unk0; - arg0->unk8 = D_80162EB0; - arg0->unk1E = -1; - arg0->unk1C = arg2; - arg0->unk0 = 0; - arg0->unk10 = 0.0f; - arg0->unk14 = 0.0f; - arg0->unk18 = 0.0f; - arg0->unkC = arg1->unk2; +void func_80012780(TrainCarStuff *trainCar, void *arg1, s16 arg2) { + trainCar->position[0] = (f32) arg1->unk0; + trainCar->position[1] = (f32) D_80162EB0; + trainCar->actorIndex = -1; + trainCar->wayPointIndex = arg2; + trainCar->isActive = 0; + trainCar->velocity[0] = 0.0f; + trainCar->velocity[1] = 0.0f; + trainCar->velocity[2] = 0.0f; + trainCar->position[2] = (f32) arg1->unk2; } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012780.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80012780(? *, s32, s32); // extern +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_80012780(TrainStuff *, s32, s32); /* extern */ extern s16 D_80162FCC; extern s32 D_80163598; extern s32 D_8016359C; -extern ? D_801635A0; -extern ? D_801635C4; -extern ? D_801637B8; +extern TrainStuff D_801635C4; +extern s32 gScreenModeSelection; void func_800127E0(void) { - ? *sp4C; - ? *temp_a2; - ? *temp_s6; - ? *temp_s6_2; - ? *temp_s6_3; - s32 temp_fp; - s32 temp_s1; + TrainStuff *sp4C; + TrainCarStuff *var_s2; + TrainStuff *var_a2; + TrainStuff *var_s6; + TrainStuff *var_s6_2; + TrainStuff *var_s6_3; + TrainStuff *var_s7; + TrainStuff *var_s7_2; s32 temp_t3; + s32 temp_t4; s32 temp_t6; s32 temp_t9; s32 temp_v0; s32 temp_v0_2; + s32 var_fp; + s32 var_s0; + s32 var_s1; void *temp_v0_3; - ? *phi_s6; - ? *phi_s2; - s32 phi_s0; - s32 phi_s1; - s32 phi_fp; - ? *phi_s6_2; - ? *phi_s6_3; - ? *phi_a2; - ? *phi_s7; - ? *phi_s7_2; sp4C = &D_801635C4; - phi_s6 = &D_801635A0; - phi_fp = 0; - phi_s7_2 = &D_801635A0; + var_s6 = D_801635A0; + var_s7 = D_801635A0; + var_fp = 0; do { temp_v0 = D_8016359C; - phi_s6->unkFC = 5.0f; - phi_s2 = phi_s7_2 + 0x48; - phi_s0 = ((((phi_fp * temp_v0) / 2) + 0xA0) % temp_v0) & 0xFFFF; - phi_s1 = 0; + var_s6->someMultiplier = 5.0f; + var_s1 = 0; + var_s2 = var_s7->passengerCars; + var_s0 = ((s32) (((s32) (var_fp * temp_v0) / 2) + 0xA0) % temp_v0) & 0xFFFF; loop_2: - temp_t3 = (phi_s0 + 4) & 0xFFFF; - func_80012780(phi_s2, (temp_t3 * 4) + D_80163598, temp_t3 & 0xFFFF); - temp_s1 = phi_s1 + 0x24; - phi_s2 += 0x24; - phi_s0 = temp_t3; - phi_s1 = temp_s1; - if (temp_s1 != 0xB4) { + temp_t3 = (var_s0 + 4) & 0xFFFF; + temp_t4 = temp_t3 * 4; + var_s0 = temp_t3; + func_80012780((TrainStuff *) var_s2, temp_t4 + D_80163598, temp_t3 & 0xFFFF); + var_s1 += 0x24; + var_s2 += 0x24; + if (var_s1 != 0xB4) { goto loop_2; } - temp_t6 = (temp_t3 + 3) & 0xFFFF; + temp_t6 = (var_s0 + 3) & 0xFFFF; func_80012780(sp4C, (temp_t6 * 4) + D_80163598, temp_t6 & 0xFFFF); temp_t9 = (temp_t6 + 4) & 0xFFFF; - func_80012780(phi_s6, (temp_t9 * 4) + D_80163598, temp_t9 & 0xFFFF); - temp_fp = phi_fp + 1; + func_80012780(var_s6, (temp_t9 * 4) + D_80163598, temp_t9 & 0xFFFF); + var_fp += 1; sp4C += 0x10C; - temp_s6 = phi_s6 + 0x10C; - temp_s6->unk-8 = 0; - phi_s6 = temp_s6; - phi_fp = temp_fp; - phi_s7_2 += 0x10C; - } while (temp_fp < 2); - temp_v0_2 = gScreenModeSelection; - phi_s6_3 = &D_801635A0; - phi_a2 = &D_801635A0; - if (temp_v0_2 != 0) { - if ((temp_v0_2 != 1) && (temp_v0_2 != 2)) { - - } else { - phi_s6_2 = &D_801635A0; - if (gModeSelection != GRAND_PRIX) { - do { - temp_s6_2 = phi_s6_2 + 0x10C; - temp_s6_2->unk-E8 = 1; - temp_s6_2->unk-34 = 1; - temp_s6_2->unk-8 = 2; - phi_s6_2 = temp_s6_2; - } while (temp_s6_2 != &D_801637B8); - } - } - } else { - phi_s7 = &D_801635A0; + var_s6 += 0x10C; + var_s7 += 0x10C; + var_s6->unk-8 = 0; + } while (var_fp < 2); + var_a2 = D_801635A0; + var_s6_2 = D_801635A0; + switch (gScreenModeSelection) { /* irregular */ + case SCREEN_MODE_1P: + var_s7_2 = D_801635A0; do { - phi_s6_3->unk24 = 1; - phi_a2->unk48 = 1; - temp_a2 = phi_a2 + 0x10C; - temp_s6_3 = phi_s6_3 + 0x10C; - temp_v0_3 = phi_s7 + (1 * 0x24); - temp_v0_3->unk48 = 1; + var_s6_2->tender.isActive = 1; + var_a2->passengerCars[0].isActive = 1; + var_a2 += 0x10C; + var_s6_2 += 0x10C; + temp_v0_3 = var_s7_2 + (1 * 0x24); + var_s7_2->passengerCars[1].isActive = 1; temp_v0_3->unk6C = 1; temp_v0_3->unk90 = 1; temp_v0_3->unkB4 = 1; - temp_s6_3->unk-8 = 6; - phi_s6_3 = temp_s6_3; - phi_a2 = temp_a2; - phi_s7 += 0x10C; - } while (temp_a2 != &D_801637B8); + var_s7_2 += 0x10C; + var_s6_2->unk-8 = 6; + } while (var_a2 != D_801637B8); + break; + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: + var_s6_3 = D_801635A0; + if (gModeSelection != GRAND_PRIX) { + do { + var_s6_3 += 0x10C; + var_s6_3->unk-E8 = 1; + var_s6_3->unk-34 = 1; + var_s6_3->unk-8 = 2; + } while (var_s6_3 != D_801637B8); + } + break; } D_80162FCC = 0; } @@ -6777,49 +6635,40 @@ loop_2: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800127E0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? gActorList; +void func_80012A48(TrainCarStuff *trainCar, s16 arg1) { + struct TrainCar *trainCarActor; -void func_80012A48(void *arg0, s16 arg1) { - void *temp_v0; - - temp_v0 = (arg0->unk1E * 0x70) + &gActorList; - temp_v0->unk18 = arg0->unk4; - temp_v0->unk1C = arg0->unk8; - temp_v0->unk20 = arg0->unkC; + trainCarActor = &gActorList[trainCar->actorIndex]; + trainCarActor->pos[0] = trainCar->position[0]; + trainCarActor->pos[1] = trainCar->position[1]; + trainCarActor->pos[2] = trainCar->position[2]; if (gIsMirrorMode != 0) { - temp_v0->unk12 = -arg1; + trainCarActor->rot[1] = -arg1; } else { - temp_v0->unk12 = arg1; + trainCarActor->rot[1] = arg1; } - temp_v0->unk24 = arg0->unk10; - temp_v0->unk2C = arg0->unk18; + trainCarActor->velocity[0] = trainCar->velocity[0]; + trainCarActor->velocity[2] = trainCar->velocity[2]; } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012A48.s") -#endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -s16 func_8000DBAC(f32 *, ? *, s32); /* extern */ -? func_80012A48(? *, s16); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +s16 func_8000DBAC(f32 *, s16 *, f32); /* extern */ +? func_80012A48(TrainStuff *, s16); /* extern */ ? func_800755FC(s32, f32 *, f32); /* extern */ extern s16 D_80162FCC; -extern ? D_801635A0; extern f32 D_801635A4; -extern ? D_801635BC; +extern s16 D_801635BC; void func_80012AC0(void) { f32 sp98; f32 sp94; f32 sp90; - ? *sp7C; - ? *temp_s0_2; - ? *temp_s0_3; - ? *var_fp; - ? *var_s1; - ? *var_s3; + TrainStuff *sp7C; + TrainCarStuff *temp_s0_2; + TrainCarStuff *temp_s0_3; + TrainStuff *var_s1; + TrainStuff *var_s3; f32 *var_s6; f32 temp_f20; f32 temp_f20_2; @@ -6827,6 +6676,7 @@ void func_80012AC0(void) { f32 temp_f22; f32 temp_f22_2; f32 temp_f22_3; + s16 *var_fp; s16 temp_a1; s16 temp_a1_2; s16 temp_s1; @@ -6839,56 +6689,56 @@ void func_80012AC0(void) { u16 temp_v0_2; D_80162FCC += 1; - var_s3 = &D_801635A0; + var_s3 = D_801635A0; var_fp = &D_801635BC; var_s6 = &D_801635A4; - sp7C = &D_801635A0; + sp7C = D_801635A0; var_s7 = 0; do { - temp_s0 = var_s3->unk1C; - temp_f20 = var_s3->unk4; - temp_f22 = var_s3->unkC; - temp_v0 = func_8000DBAC(var_s6, var_fp, var_s3->unkFC); + temp_s0 = (u16) var_s3->locomotive.wayPointIndex; + temp_f20 = var_s3->locomotive.position[0]; + temp_f22 = var_s3->locomotive.position[2]; + temp_v0 = func_8000DBAC(var_s6, var_fp, var_s3->someMultiplier); temp_t0 = temp_v0; temp_s1 = temp_v0; - var_s3->unk10 = (f32) (var_s3->unk4 - temp_f20); - var_s3->unk18 = (f32) (var_s3->unkC - temp_f22); + var_s3->locomotive.velocity[0] = var_s3->locomotive.position[0] - temp_f20; + var_s3->locomotive.velocity[2] = var_s3->locomotive.position[2] - temp_f22; func_80012A48(var_s3, temp_t0); - temp_v0_2 = var_s3->unk1C; + temp_v0_2 = (u16) var_s3->locomotive.wayPointIndex; if ((temp_s0 != temp_v0_2) && ((temp_v0_2 == 0x00BE) || (temp_v0_2 == 0x0140))) { - func_800C98B8(var_s6, var_s3 + 0x10, 0x1901800EU); + func_800C98B8(var_s6, var_s3->locomotive.velocity, 0x1901800EU); } else if (random_int(0x0064U) == 0) { - func_800C98B8(var_s6, var_s3 + 0x10, 0x1901800DU); + func_800C98B8(var_s6, var_s3->locomotive.velocity, 0x1901800DU); } - temp_v0_3 = func_800061DC(var_s6, 2000.0f, var_s3->unk100); - var_s3->unk100 = temp_v0_3; + temp_v0_3 = func_800061DC(var_s6, 2000.0f, var_s3->someFlags); + var_s3->someFlags = temp_v0_3; if ((((s16) D_80162FCC % 5) == 0) && (temp_v0_3 != 0)) { - sp90 = var_s3->unk4; - sp94 = (f32) ((f64) var_s3->unk8 + 65.0); - sp98 = (f32) ((f64) var_s3->unkC + 25.0); + sp90 = var_s3->locomotive.position[0]; + sp94 = (f32) ((f64) var_s3->locomotive.position[1] + 65.0); + sp98 = (f32) ((f64) var_s3->locomotive.position[2] + 25.0); func_80006114(&sp90, var_s6, temp_s1); func_800755FC(var_s7, &sp90, 1.1f); } - temp_s0_2 = var_s3 + 0x24; - if (var_s3->unk24 == 1) { - temp_f20_2 = temp_s0_2->unk4; - temp_f22_2 = temp_s0_2->unkC; - temp_a1 = func_8000DBAC(temp_s0_2 + 4, temp_s0_2 + 0x1C, var_s3->unkFC); - temp_s0_2->unk10 = (f32) (temp_s0_2->unk4 - temp_f20_2); - temp_s0_2->unk18 = (f32) (temp_s0_2->unkC - temp_f22_2); - func_80012A48(temp_s0_2, temp_a1); + temp_s0_2 = &var_s3->tender; + if (var_s3->tender.isActive == 1) { + temp_f20_2 = temp_s0_2->position[0]; + temp_f22_2 = temp_s0_2->position[2]; + temp_a1 = func_8000DBAC(temp_s0_2->position, &temp_s0_2->wayPointIndex, var_s3->someMultiplier); + temp_s0_2->velocity[0] = temp_s0_2->position[0] - temp_f20_2; + temp_s0_2->velocity[2] = temp_s0_2->position[2] - temp_f22_2; + func_80012A48((TrainStuff *) temp_s0_2, temp_a1); } var_s2 = 0; var_s1 = sp7C; loop_13: - temp_s0_3 = var_s1 + 0x48; - if (var_s1->unk48 == 1) { - temp_f20_3 = temp_s0_3->unk4; - temp_f22_3 = temp_s0_3->unkC; - temp_a1_2 = func_8000DBAC(temp_s0_3 + 4, temp_s0_3 + 0x1C, var_s3->unkFC); - temp_s0_3->unk10 = (f32) (temp_s0_3->unk4 - temp_f20_3); - temp_s0_3->unk18 = (f32) (temp_s0_3->unkC - temp_f22_3); - func_80012A48(temp_s0_3, temp_a1_2); + temp_s0_3 = var_s1->passengerCars; + if (var_s1->passengerCars[0].isActive == 1) { + temp_f20_3 = temp_s0_3->position[0]; + temp_f22_3 = temp_s0_3->position[2]; + temp_a1_2 = func_8000DBAC(temp_s0_3->position, &temp_s0_3->wayPointIndex, var_s3->someMultiplier); + temp_s0_3->velocity[0] = temp_s0_3->position[0] - temp_f20_3; + temp_s0_3->velocity[2] = temp_s0_3->position[2] - temp_f22_3; + func_80012A48((TrainStuff *) temp_s0_3, temp_a1_2); } var_s2 += 0x24; var_s1 += 0x24; @@ -6907,15 +6757,16 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012AC0.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_801631E0; -extern ? D_801635A0; void func_80012DC0(s32 playerId, Player *player) { f32 sp84; - ? *var_s0; - ? *var_s6; - ? *var_s7; + TrainCarStuff *temp_v0; + TrainCarStuff *temp_v0_2; + TrainStuff *var_s0; + TrainStuff *var_s6; + TrainStuff *var_s7; f32 temp_f14; f32 temp_f16; f32 temp_f24; @@ -6925,28 +6776,26 @@ void func_80012DC0(s32 playerId, Player *player) { f64 temp_f0_3; f64 temp_f0_4; s32 var_s1; - void *temp_v0; - void *temp_v0_2; if (*(&D_801631E0 + (playerId * 2)) != 1) { - var_s7 = &D_801635A0; - var_s6 = &D_801635A0; + var_s7 = D_801635A0; + var_s6 = D_801635A0; if ((player->unk_0BC << 7) >= 0) { temp_f24 = player->pos[0]; temp_f26 = player->pos[2]; do { - temp_f16 = var_s6->unk4; - temp_f14 = var_s6->unkC; + temp_f16 = var_s6->locomotive.position[0]; + temp_f14 = var_s6->locomotive.position[2]; sp84 = temp_f16; temp_f0 = (f64) (temp_f24 - temp_f16); if ((temp_f0 > -100.0) && (temp_f0 < 100.0)) { temp_f0_2 = (f64) (temp_f26 - temp_f14); if ((temp_f0_2 > -100.0) && (temp_f0_2 < 100.0)) { - if (func_80006018(sp84, temp_f14, var_s6->unk10, var_s6->unk18, 60.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U) { + if (func_80006018(sp84, temp_f14, var_s6->locomotive.velocity[0], var_s6->locomotive.velocity[2], 60.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U) { player->unk_00C |= 0x400000; } - temp_v0 = var_s6 + 0x24; - if ((var_s6->unk24 == (s16) 1U) && (func_80006018(temp_v0->unk4, temp_v0->unkC, temp_v0->unk10, temp_v0->unk18, 30.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U)) { + temp_v0 = &var_s6->tender; + if ((var_s6->tender.isActive == (s16) 1U) && (func_80006018(temp_v0->position[0], temp_v0->position[2], temp_v0->velocity[0], temp_v0->velocity[2], 30.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U)) { player->unk_00C |= 0x400000; } } @@ -6954,13 +6803,13 @@ void func_80012DC0(s32 playerId, Player *player) { var_s1 = 0; var_s0 = var_s7; loop_13: - if (var_s0->unk48 == (s16) 1U) { - temp_f0_3 = (f64) (temp_f24 - var_s0->unk4C); + if (var_s0->passengerCars[0].isActive == (s16) 1U) { + temp_f0_3 = (f64) (temp_f24 - var_s0->passengerCars[0].position[0]); if ((temp_f0_3 > -100.0) && (temp_f0_3 < 100.0)) { - temp_f0_4 = (f64) (temp_f26 - var_s0->unk54); + temp_f0_4 = (f64) (temp_f26 - var_s0->passengerCars[0].position[2]); if (temp_f0_4 > -100.0) { - temp_v0_2 = var_s0 + 0x48; - if ((temp_f0_4 < 100.0) && (func_80006018(temp_v0_2->unk4, temp_v0_2->unkC, temp_v0_2->unk10, temp_v0_2->unk18, 30.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U)) { + temp_v0_2 = var_s0->passengerCars; + if ((temp_f0_4 < 100.0) && (func_80006018(temp_v0_2->position[0], temp_v0_2->position[2], temp_v0_2->velocity[0], temp_v0_2->velocity[2], 30.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U)) { player->unk_00C |= 0x400000; } } @@ -6982,74 +6831,58 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012DC0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f32 D_800ED100; -extern f64 D_800ED108; -extern f32 D_800ED110; -extern f64 D_800ED118; -extern f64 D_800ED120; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern s32 D_8016359C; -extern ? D_801635A0; -extern u16 D_801637B8; extern u16 D_801637BC; -extern ? D_801637C0; void func_80013054(void) { - ? *temp_v1; - f32 temp_f8; + TrainStuff *var_v1; + f32 var_f8; f64 temp_f12; f64 temp_f16; f64 temp_f18; - f64 temp_f22; - u16 *temp_a0; + u16 *var_a0; + u16 *var_v1_2; u16 temp_t7; - ? *phi_v1; - f32 phi_f8; - u16 *phi_v1_2; - u16 *phi_a0; - D_801637B8.unk0 = 0; - D_801637B8.unk2 = 0; - temp_f12 = D_800ED100; - temp_f18 = D_800ED110; - temp_f22 = D_800ED120; - phi_v1 = &D_801635A0; + D_801637B8->unk0 = 0; + D_801637B8->unk2 = 0U; + temp_f12 = (f64) 0.42299348f; + temp_f18 = (f64) 0.72017354f; + var_v1 = D_801635A0; do { - temp_t7 = phi_v1->unk1C; - temp_f8 = temp_t7; - phi_f8 = temp_f8; - if (temp_t7 < 0) { - phi_f8 = temp_f8 + 4294967296.0f; + temp_t7 = (u16) var_v1->locomotive.wayPointIndex; + var_f8 = (f32) temp_t7; + if ((s32) temp_t7 < 0) { + var_f8 += 4294967296.0f; } - temp_f16 = phi_f8 / D_8016359C; - if (((temp_f12 - D_800ED108) < temp_f16) && (temp_f16 < ((phi_v1->unk104 * temp_f22) + (temp_f12 + temp_f22)))) { - D_801637B8.unk0 = 1; + temp_f16 = (f64) (var_f8 / (f32) D_8016359C); + if (((temp_f12 - 0.1) < temp_f16) && (temp_f16 < (((f64) var_v1->numCars * 0.01) + (temp_f12 + 0.01)))) { + D_801637B8->unk0 = 1; } - if (((temp_f18 - D_800ED118) < temp_f16) && (temp_f16 < ((phi_v1->unk104 * temp_f22) + (temp_f18 + temp_f22)))) { - D_801637B8.unk2 = 1; + if (((temp_f18 - 0.1) < temp_f16) && (temp_f16 < (((f64) var_v1->numCars * 0.01) + (temp_f18 + 0.01)))) { + D_801637B8->unk2 = 1U; } - temp_v1 = phi_v1 + 0x10C; - phi_v1 = temp_v1; - } while (temp_v1 < &D_801637B8); - phi_v1_2 = &D_801637B8; - phi_a0 = &D_801637BC; + var_v1 += 0x10C; + } while ((u32) var_v1 < (u32) D_801637B8); + var_a0 = &D_801637BC; + var_v1_2 = D_801637B8; do { - if (*phi_v1_2 == 1) { - *phi_a0 = *phi_a0 + 1; + if (*var_v1_2 == 1) { + *var_a0 += 1; } else { - *phi_a0 = 0; + *var_a0 = 0; } - temp_a0 = phi_a0 + 2; - phi_v1_2 += 2; - phi_a0 = temp_a0; - } while (temp_a0 != &D_801637C0); + var_a0 += 2; + var_v1_2 += 2; + } while (var_a0 != D_801637C0); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80013054.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_801631E0; extern ? D_801634D8; extern u16 D_801637BC; @@ -7086,43 +6919,42 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800131DC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f32 D_800ED128; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern s16 D_80162EB2; extern s16 D_801630FC; extern s32 D_80163598; -extern ? D_801637C0; extern ? D_801637EC; +extern s8 D_8018EDF3; void func_800132F4(void) { - ? *temp_a1; + PaddleWheelBoatStuff *temp_a0; + PaddleWheelBoatStuff *var_a1; + s16 var_v1; void *temp_a2; - s16 phi_v1; - ? *phi_a1; - phi_v1 = 0; - phi_a1 = &D_801637C0; + var_a1 = D_801637C0; + var_v1 = 0; do { - temp_a2 = ((phi_v1 & 0xFFFF) * 4) + D_80163598; - phi_a1->unk4 = temp_a2->unk0; - phi_a1->unk8 = D_80162EB2; - phi_a1->unk1C = phi_v1; - phi_a1->unk1E = -1; - phi_a1->unkC = temp_a2->unk2; - phi_v1 += 0xB4; - if (D_8018EDF3 >= THREE_PLAYERS_SELECTED) { - phi_a1->unk0 = 0; + temp_a2 = ((var_v1 & 0xFFFF) * 4) + D_80163598; + temp_a0 = var_a1; + var_a1->position[0] = (f32) temp_a2->unk0; + var_a1->position[1] = (f32) D_80162EB2; + var_a1->wayPointIndex = var_v1; + var_v1 += 0xB4; + var_a1->actorIndex = -1; + var_a1->position[2] = (f32) temp_a2->unk2; + if (D_8018EDF3 >= 3) { + var_a1->isActive = 0; } else { - phi_a1->unk0 = 1; + var_a1->isActive = 1; } - temp_a1 = phi_a1 + 0x2C; - phi_a1->unk10 = 0.0f; - phi_a1->unk14 = 0.0f; - phi_a1->unk18 = 0.0f; - phi_a1->unk20 = D_800ED128; - phi_a1->unk24 = 0; - phi_a1 = temp_a1; - } while (temp_a1 != &D_801637EC); + var_a1 += 0x2C; + temp_a0->velocity[0] = 0.0f; + temp_a0->velocity[1] = 0.0f; + temp_a0->velocity[2] = 0.0f; + temp_a0->someMultiplier = 1.6666666f; + temp_a0->yRotation = 0; + } while (var_a1 != &D_801637EC); D_801630FC = 0; } #else @@ -7130,14 +6962,13 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800132F4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -? func_8000DBAC(f32 *, void *, f32); /* extern */ +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +? func_8000DBAC(f32 *, s16 *, f32); /* extern */ ? func_80075A6C(s16, f32 *, ?); /* extern */ extern s16 D_80162EB0; extern s16 D_801630FC; extern s32 D_80163598; extern s32 D_8016359C; -extern ? D_801637C0; void func_800133C4(void) { f32 sp9C; @@ -7149,7 +6980,7 @@ void func_800133C4(void) { f32 sp80; f32 sp7C; f32 sp78; - ? *var_s0; + PaddleWheelBoatStuff *var_s0; f32 *temp_s1; f32 *temp_s2; f32 temp_f0_3; @@ -7166,31 +6997,31 @@ void func_800133C4(void) { void *temp_v0_2; D_801630FC += 1; - var_s0 = &D_801637C0; + var_s0 = D_801637C0; var_s3 = 0; do { - temp_s2 = var_s0 + 4; - if (var_s0->unk0 == 1) { - temp_f26 = var_s0->unk4; - temp_f28 = var_s0->unk8; - temp_f30 = var_s0->unkC; - func_8000DBAC(temp_s2, var_s0 + 0x1C, var_s0->unk20); - temp_v0 = func_800061DC(temp_s2, 2000.0f, var_s0->unk28); - var_s0->unk28 = temp_v0; + temp_s2 = var_s0->position; + if (var_s0->isActive == 1) { + temp_f26 = var_s0->position[0]; + temp_f28 = var_s0->position[1]; + temp_f30 = var_s0->position[2]; + func_8000DBAC(temp_s2, &var_s0->wayPointIndex, var_s0->someMultiplier); + temp_v0 = func_800061DC(temp_s2, 2000.0f, var_s0->someFlags); + var_s0->someFlags = temp_v0; if ((((s16) D_801630FC % 10) == 0) && (temp_v0 != 0)) { - sp78 = (f32) ((f64) var_s0->unk4 - 30.0); - sp7C = (f32) ((f64) var_s0->unk8 + 180.0); - sp80 = (f32) ((f64) var_s0->unkC + 45.0); - func_80006114(&sp78, temp_s2, var_s0->unk24); + sp78 = (f32) ((f64) var_s0->position[0] - 30.0); + sp7C = (f32) ((f64) var_s0->position[1] + 180.0); + sp80 = (f32) ((f64) var_s0->position[2] + 45.0); + func_80006114(&sp78, temp_s2, var_s0->yRotation); func_80075A6C(var_s3, &sp78, 0x3F8CCCCD); - sp78 = (f32) ((f64) var_s0->unk4 + 30.0); - sp7C = (f32) ((f64) var_s0->unk8 + 180.0); - sp80 = (f32) ((f64) var_s0->unkC + 45.0); - func_80006114(&sp78, temp_s2, var_s0->unk24); + sp78 = (f32) ((f64) var_s0->position[0] + 30.0); + sp7C = (f32) ((f64) var_s0->position[1] + 180.0); + sp80 = (f32) ((f64) var_s0->position[2] + 45.0); + func_80006114(&sp78, temp_s2, var_s0->yRotation); func_80075A6C(var_s3, &sp78, 0x3F8CCCCD); } if (random_int(0x0064U) == 0) { - temp_s1 = var_s0 + 0x10; + temp_s1 = var_s0->velocity; if (random_int(2U) == 0) { func_800C98B8(temp_s2, temp_s1, 0x19018047U); } else { @@ -7200,57 +7031,57 @@ void func_800133C4(void) { sp94 = temp_f26; sp98 = temp_f28; sp9C = temp_f30; - temp_v0_2 = (((s32) (var_s0->unk1C + 5) % (s32) D_8016359C) * 4) + D_80163598; + temp_v0_2 = (((s32) ((u16) var_s0->wayPointIndex + 5) % (s32) D_8016359C) * 4) + D_80163598; sp88 = (f32) temp_v0_2->unk0; sp8C = (f32) D_80162EB0; sp90 = (f32) temp_v0_2->unk2; - temp_a1 = func_80005FD0(&sp94, &sp88) - var_s0->unk24; + temp_a1 = func_80005FD0(&sp94, &sp88) - var_s0->yRotation; var_v1 = temp_a1; if (temp_a1 < 0) { var_v1 = temp_a1 * -1; } if (var_v1 >= 0x1771) { - temp_f0 = (f64) var_s0->unk20; + temp_f0 = (f64) var_s0->someMultiplier; if (temp_f0 > 0.2) { - var_s0->unk20 = (f32) (temp_f0 - 0.04); + var_s0->someMultiplier = (f32) (temp_f0 - 0.04); } if (var_v1 >= 0x3D) { var_v1 = 0x003C; } } else { - temp_f0_2 = (f64) var_s0->unk20; + temp_f0_2 = (f64) var_s0->someMultiplier; if (temp_f0_2 < 2.0) { - var_s0->unk20 = (f32) (temp_f0_2 + 0.02); + var_s0->someMultiplier = (f32) (temp_f0_2 + 0.02); } if (var_v1 >= 0x1F) { var_v1 = 0x001E; } } if (temp_a1 >= 0x8000) { - var_s0->unk24 = (s16) (var_s0->unk24 - var_v1); + var_s0->yRotation -= var_v1; } else if (temp_a1 > 0) { - var_s0->unk24 = (s16) (var_s0->unk24 + var_v1); + var_s0->yRotation += var_v1; } else if (temp_a1 < -0x7FFF) { - var_s0->unk24 = (s16) (var_s0->unk24 + var_v1); + var_s0->yRotation += var_v1; } else if (temp_a1 < 0) { - var_s0->unk24 = (s16) (var_s0->unk24 - var_v1); + var_s0->yRotation -= var_v1; } - temp_f0_3 = var_s0->unk4; - var_s0->unk10 = (f32) (temp_f0_3 - temp_f26); - var_s0->unk14 = (f32) (var_s0->unk8 - temp_f28); - var_s0->unk18 = (f32) (var_s0->unkC - temp_f30); - temp_v0_3 = &gActorList[var_s0->unk1E]; + temp_f0_3 = var_s0->position[0]; + var_s0->velocity[0] = temp_f0_3 - temp_f26; + var_s0->velocity[1] = var_s0->position[1] - temp_f28; + var_s0->velocity[2] = var_s0->position[2] - temp_f30; + temp_v0_3 = &gActorList[var_s0->actorIndex]; temp_v0_3->pos[0] = temp_f0_3; - temp_v0_3->pos[1] = var_s0->unk8; - temp_v0_3->pos[2] = var_s0->unkC; + temp_v0_3->pos[1] = var_s0->position[1]; + temp_v0_3->pos[2] = var_s0->position[2]; if (gIsMirrorMode != 0) { - temp_v0_3->rot[1] = -var_s0->unk24; + temp_v0_3->rot[1] = -var_s0->yRotation; } else { - temp_v0_3->rot[1] = var_s0->unk24; + temp_v0_3->rot[1] = var_s0->yRotation; } - temp_v0_3->velocity[0] = var_s0->unk10; - temp_v0_3->velocity[1] = var_s0->unk14; - temp_v0_3->velocity[2] = var_s0->unk18; + temp_v0_3->velocity[0] = var_s0->velocity[0]; + temp_v0_3->velocity[1] = var_s0->velocity[1]; + temp_v0_3->velocity[2] = var_s0->velocity[2]; } var_s3 += 1; var_s0 += 0x2C; @@ -7261,13 +7092,12 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800133C4.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -extern ? D_801637C0; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern ? D_801637EC; void func_80013854(Player *player) { f32 sp70; - ? *var_s0; + PaddleWheelBoatStuff *var_s0; f32 temp_f12; f32 temp_f14; f32 temp_f24; @@ -7283,18 +7113,18 @@ void func_80013854(Player *player) { temp_f26 = player->pos[0]; var_f18 = player->pos[1]; temp_f28 = player->pos[2]; - var_s0 = &D_801637C0; + var_s0 = D_801637C0; do { - if (var_s0->unk0 == 1) { - temp_f12 = var_s0->unk4; - temp_f14 = var_s0->unkC; - temp_f24 = var_f18 - var_s0->unk8; + if (var_s0->isActive == 1) { + temp_f12 = var_s0->position[0]; + temp_f14 = var_s0->position[2]; + temp_f24 = var_f18 - var_s0->position[1]; temp_f0 = (f64) (temp_f26 - temp_f12); if ((temp_f0 > -300.0) && (temp_f0 < 300.0)) { temp_f0_2 = (f64) (temp_f28 - temp_f14); if ((temp_f0_2 > -300.0) && (temp_f0_2 < 300.0)) { sp70 = var_f18; - if ((func_80006018(temp_f12, temp_f14, var_s0->unk10, var_s0->unk18, 200.0f, 60.0f, temp_f26, temp_f28) == (s32) 1) && ((f64) temp_f24 < 60.0)) { + if ((func_80006018(temp_f12, temp_f14, var_s0->velocity[0], var_s0->velocity[2], 200.0f, 60.0f, temp_f26, temp_f28) == (s32) 1) && ((f64) temp_f24 < 60.0)) { player->unk_00C |= 0x80000; } } @@ -7309,77 +7139,73 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80013854.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s16 func_8000D6D0(s32, s32, f32, f32, s32, s32); // extern -s16 func_8000D940(s32, s32, f32, f32, s32); // extern -extern f64 D_800ED168; +//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +s16 func_8000D6D0(f32 *, s16 *, f32, f32, s32, s32); /* extern */ +s16 func_8000D940(f32 *, s16 *, f32, f32, s32); /* extern */ extern s16 D_801631C8; extern s16 D_8016347A; -extern u16 gWaypointCountByPathIndex; -void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, void *arg4, s32 arg5) { +void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle, struct TrackWayPoint *wayPointList) { + VehicleStuff *var_s0; + f32 *var_s1; + s16 *var_s2; s16 temp_v0_2; + s16 var_v0; s32 temp_hi; - s32 temp_s3; + s32 var_s3; + s32 var_s4; + struct TrackWayPoint *temp_v0; u16 temp_s7; - void *temp_v0; - s32 phi_s4; - void *phi_s0; - s32 phi_s3; - s32 phi_s1; - s32 phi_s2; - s16 phi_v0; - temp_s7 = gWaypointCountByPathIndex; - phi_s3 = 0; + temp_s7 = *gWaypointCountByPathIndex; + var_s3 = 0; if (arg2 > 0) { - phi_s4 = 0; - phi_s0 = arg4; - phi_s1 = arg4 + 4; - phi_s2 = arg4 + 0x1C; + var_s0 = vehicle; + var_s4 = 0; + var_s1 = var_s0->position; + var_s2 = &var_s0->waypointId; do { - temp_hi = ((phi_s4 / arg2) + arg3) % temp_s7; - temp_v0 = ((temp_hi & 0xFFFF) * 8) + arg5; - phi_s0->unk4 = temp_v0->unk0; - phi_s0->unk8 = temp_v0->unk2; - phi_s0->unk1E = -1; - phi_s0->unk1C = temp_hi; - phi_s0->unk0 = 0; - phi_s0->unk10 = 0.0f; - phi_s0->unk14 = 0.0f; - phi_s0->unk18 = 0.0f; - phi_s0->unk30 = 0; - phi_s0->unk31 = 0; - phi_s0->unkC = temp_v0->unk4; - if (gModeSelection == TIME_TRIALS) { - phi_s0->unk2E = phi_s3 % 3; + temp_hi = (s32) ((var_s4 / arg2) + arg3) % (s32) temp_s7; + temp_v0 = &wayPointList[temp_hi & 0xFFFF]; + var_s0->position[0] = (f32) temp_v0->wayPointX; + var_s0->position[1] = (f32) temp_v0->wayPointY; + var_s0->actorIndex = -1; + var_s0->waypointId = (s16) temp_hi; + var_s0->unk0 = 0; + var_s0->velocity[0] = 0.0f; + var_s0->velocity[1] = 0.0f; + var_s0->velocity[2] = 0.0f; + var_s0->someFlags = 0; + var_s0->someFlagsTheSequel = 0; + var_s0->position[2] = (f32) temp_v0->wayPointZ; + if (gModeSelection == 1) { + var_s0->someType = (s16) (var_s3 % 3); } else { - phi_s0->unk2E = random_int(3); + var_s0->someType = random_int(3U); } - temp_v0_2 = phi_s0->unk2E; - phi_s0->unk24 = (temp_v0_2 - 1) * D_800ED168; - if (((gCCSelection > 0) || (gModeSelection == TIME_TRIALS)) && (temp_v0_2 == 2)) { - phi_s0->unk20 = arg0; + temp_v0_2 = var_s0->someType; + var_s0->someMultiplierTheSequel = (f32) ((f64) (f32) (temp_v0_2 - 1) * 0.6); + if (((gCCSelection > 0) || (gModeSelection == 1)) && (temp_v0_2 == 2)) { + var_s0->someMultiplier = arg0; } else { - phi_s0->unk20 = arg1; + var_s0->someMultiplier = arg1; } - phi_s0->unk28 = 0; - phi_s0->unk2C = 0; + var_s0->rotation[0] = 0; + var_s0->rotation[2] = 0; if (D_8016347A == 0) { - phi_v0 = func_8000D6D0(phi_s1, phi_s2, phi_s0->unk20, phi_s0->unk24, 0, 3); + var_v0 = func_8000D6D0(var_s1, var_s2, var_s0->someMultiplier, var_s0->someMultiplierTheSequel, 0, 3); } else { - phi_v0 = func_8000D940(phi_s1, phi_s2, phi_s0->unk20, phi_s0->unk24, 0); + var_v0 = func_8000D940(var_s1, var_s2, var_s0->someMultiplier, var_s0->someMultiplierTheSequel, 0); } - phi_s0->unk2A = phi_v0; - temp_s3 = phi_s3 + 1; - phi_s4 += temp_s7; - phi_s0 += 0x34; - phi_s3 = temp_s3; - phi_s1 += 0x34; - phi_s2 += 0x34; - } while (temp_s3 != arg2); + var_s0->rotation[1] = var_v0; + var_s3 += 1; + var_s4 += temp_s7; + var_s0 += 0x34; + var_s1 += 0x34; + var_s2 += 0x34; + } while (var_s3 != arg2); } - D_801631C8 = 0xA; + D_801631C8 = 0x000A; } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800139E4.s") @@ -7426,102 +7252,94 @@ f32 func_80013C74(s16 arg0, s16 arg1) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80013C74.s") #endif -#ifdef MIPS_TO_C +#ifdef NEEDS_RODATA //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -s16 func_8000D6D0(void *, void *, s32, f32, s32, s32); /* extern */ -s16 func_8000D940(void *, void *, s32, f32, s32); /* extern */ -extern s16 D_8016347A; +extern f64 D_800ED178;// = 0.06; +extern f64 D_800ED180;// = 0.06; -void func_80013D20(void *arg0) { +void func_80013D20(VehicleStuff *vehicle) { + f32 temp_f0_2; + f32 temp_f0_3; f32 sp5C; f32 sp58; f32 sp54; - f32 sp48; - f32 sp44; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_3; - f32 temp_f0_4; - f32 temp_f2; f32 temp_f2_2; s16 var_a1; - struct Actor *temp_v1; + s16 thing; + Vec3f sp40; + Vec3f sp34; + struct Actor *vehicleActor; - sp5C = arg0->unk4; - temp_f0 = arg0->unk8; - sp44 = 0.0f; - sp48 = 0.0f; - sp40 = temp_f0; - sp54 = arg0->unkC; - sp58 = temp_f0; - temp_f0_2 = func_80013C74(arg0->unk2E, arg0->unk1C); - temp_f2 = arg0->unk24; - if (temp_f2 < temp_f0_2) { - arg0->unk24 = (f32) ((f64) temp_f2 + 0.06); - if (temp_f0_2 < arg0->unk24) { - arg0->unk24 = temp_f0_2; + sp5C = vehicle->position[0]; + sp58 = vehicle->position[1]; + sp54 = vehicle->position[2]; + sp40[0] = sp58; + sp40[1] = 0.0f; + sp40[2] = 0.0f; + temp_f0_2 = func_80013C74(vehicle->someType, vehicle->wayPointIndex); + if (vehicle->someMultiplierTheSequel < temp_f0_2) { + vehicle->someMultiplierTheSequel = vehicle->someMultiplierTheSequel + 0.06; + if (temp_f0_2 < vehicle->someMultiplierTheSequel) { + vehicle->someMultiplierTheSequel = temp_f0_2; } } - if (temp_f0_2 < arg0->unk24) { - arg0->unk24 = (f32) ((f64) arg0->unk24 - 0.06); - if (arg0->unk24 < temp_f0_2) { - arg0->unk24 = temp_f0_2; + if (temp_f0_2 < vehicle->someMultiplierTheSequel) { + vehicle->someMultiplierTheSequel = vehicle->someMultiplierTheSequel - 0.06; + if (vehicle->someMultiplierTheSequel < temp_f0_2) { + vehicle->someMultiplierTheSequel = temp_f0_2; } } if (D_8016347A == 0) { - var_a1 = func_8000D6D0(arg0 + 4, arg0 + 0x1C, arg0->unk20, arg0->unk24, 0, 3); + var_a1 = func_8000D6D0(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); } else { - var_a1 = func_8000D940(arg0 + 4, arg0 + 0x1C, arg0->unk20, arg0->unk24, 0); + var_a1 = func_8000D940(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); } - func_800224F0(arg0 + 0x2A, var_a1, 0x0064); - temp_f0_3 = arg0->unk4 - sp5C; - temp_f2_2 = arg0->unkC - sp54; - sp34 = arg0->unk8; - sp38 = 0.0f; - sp3C = sqrtf((temp_f0_3 * temp_f0_3) + (temp_f2_2 * temp_f2_2)); - func_800224F0(arg0 + 0x28, (s16) (func_802B5224(&sp40, &sp34) * -1), 0x0064); - temp_f0_4 = arg0->unk4; - arg0->unk10 = (f32) (temp_f0_4 - sp5C); - temp_v1 = &gActorList[arg0->unk1E]; - arg0->unk14 = (f32) (arg0->unk8 - sp58); - arg0->unk18 = (f32) (arg0->unkC - sp54); - temp_v1->pos[0] = temp_f0_4; - temp_v1->pos[1] = arg0->unk8; - temp_v1->pos[2] = arg0->unkC; - temp_v1->rot[0] = arg0->unk28; + func_800224F0(&vehicle->rotation[1], var_a1, 100); + temp_f0_3 = vehicle->position[0] - sp5C; + temp_f2_2 = vehicle->position[2] - sp54; + sp34[0] = vehicle->position[1]; + sp34[1] = 0.0f; + sp34[2] = sqrtf((temp_f0_3 * temp_f0_3) + (temp_f2_2 * temp_f2_2)); + thing = func_802B5224(sp40, sp34); + func_800224F0(&vehicle->rotation[0], -thing, 100); + vehicle->velocity[0] = vehicle->position[0] - sp5C; + vehicle->velocity[1] = vehicle->position[1] - sp58; + vehicle->velocity[2] = vehicle->position[2] - sp54; + vehicleActor = &gActorList[vehicle->actorIndex]; + vehicleActor->pos[0] = vehicle->position[0]; + vehicleActor->pos[1] = vehicle->position[1]; + vehicleActor->pos[2] = vehicle->position[2]; + vehicleActor->rot[0] = vehicle->rotation[0]; if (gIsMirrorMode != 0) { - temp_v1->rot[1] = -arg0->unk2A; + vehicleActor->rot[1] = -vehicle->rotation[1]; } else { - temp_v1->rot[1] = arg0->unk2A; + vehicleActor->rot[1] = vehicle->rotation[1]; } - temp_v1->rot[2] = arg0->unk2C; - temp_v1->velocity[0] = arg0->unk10; - temp_v1->velocity[1] = arg0->unk14; - temp_v1->velocity[2] = arg0->unk18; + vehicleActor->rot[2] = vehicle->rotation[2]; + vehicleActor->velocity[0] = vehicle->velocity[0]; + vehicleActor->velocity[1] = vehicle->velocity[1]; + vehicleActor->velocity[2] = vehicle->velocity[2]; } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80013D20.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -? func_800C9EF4(void *, u32); /* extern */ +//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de +? func_800C9EF4(f32 *, u32); /* extern */ extern s16 D_801631C8; extern ? D_801631E0; extern ? D_80163270; extern s16 D_8016347A; -void func_80013F7C(s32 playerId, Player *player, void *arg2, f32 arg3, f32 arg4, s32 arg5, u32 arg6) { +void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3, f32 arg4, s32 arg5, u32 arg6) { f32 spC4; f32 spC0; f32 spBC; u32 spA8; u16 *sp9C; f32 *sp84; + VehicleStuff *var_s0; f32 temp_f12; f32 temp_f14; f32 temp_f22; @@ -7548,62 +7366,61 @@ void func_80013F7C(s32 playerId, Player *player, void *arg2, f32 arg3, f32 arg4, u16 temp_v1_3; u16 var_s1; u32 var_a2; - void *var_s0; temp_s7 = playerId * 2; - var_s0 = arg2; - if (((*(&D_801631E0 + temp_s7) != 1) || ((temp_v0 = player->unk_000, ((temp_v0 & 0x4000) != 0)) && ((temp_v0 & 0x1000) == 0))) && ((player->unk_0BC << 7) >= 0)) { + var_s0 = vehicle; + if (((*(&D_801631E0 + temp_s7) != 1) || ((temp_v0 = player->unk_000, ((temp_v0 & 0x4000) != 0)) && !(temp_v0 & 0x1000))) && ((player->unk_0BC << 7) >= 0)) { spC4 = player->pos[0]; var_fp = 0; spC0 = player->pos[1]; spBC = player->pos[2]; if (arg5 > 0) { do { - temp_f12 = var_s0->unk4; - temp_f14 = var_s0->unkC; + temp_f12 = var_s0->position[0]; + temp_f14 = var_s0->position[2]; temp_f20 = (f64) (spC4 - temp_f12); - temp_f22 = spC0 - var_s0->unk8; + temp_f22 = spC0 - var_s0->position[1]; temp_f24 = spBC - temp_f14; if ((temp_f20 > -100.0) && (temp_f20 < 100.0)) { temp_f0 = (f64) temp_f22; if ((temp_f0 > -20.0) && (temp_f0 < 20.0)) { temp_f0_2 = (f64) temp_f24; - if ((temp_f0_2 > -100.0) && (temp_f0_2 < 100.0) && (func_80006018(temp_f12, temp_f14, var_s0->unk10, var_s0->unk18, arg3, arg4, spC4, spBC) == (s32) 1U)) { + if ((temp_f0_2 > -100.0) && (temp_f0_2 < 100.0) && (func_80006018(temp_f12, temp_f14, var_s0->velocity[0], var_s0->velocity[2], arg3, arg4, spC4, spBC) == (s32) 1U)) { player->unk_00C |= 0x400000; } } } temp_v0_2 = player->unk_000; - if (((temp_v0_2 & 0x4000) != 0) && ((temp_v0_2 & 0x1000) == 0)) { + if ((temp_v0_2 & 0x4000) && !(temp_v0_2 & 0x1000)) { temp_s2 = 1 << playerId; if ((temp_f20 > -300.0) && (temp_f20 < 300.0) && (temp_f0_3 = (f64) temp_f22, (temp_f0_3 > -20.0)) && (temp_f0_3 < 20.0) && (temp_f0_4 = (f64) temp_f24, (temp_f0_4 > -300.0)) && (temp_f0_4 < 300.0)) { temp_v0_3 = D_801631C8; - if ((temp_v0_3 > 0) && (var_s0->unk30 == 0)) { + if ((temp_v0_3 > 0) && (var_s0->someFlags == 0)) { D_801631C8 = temp_v0_3 - 1; - var_s0->unk30 = (s8) (var_s0->unk30 | temp_s2); - func_800C9D80(var_s0 + 4, var_s0 + 0x10, arg6); + var_s0->someFlags |= temp_s2; + func_800C9D80((f32 (*)[3]) var_s0->position, (f32 (*)[3]) var_s0->velocity, arg6); } } else { - temp_v0_4 = var_s0->unk30; + temp_v0_4 = var_s0->someFlags; if (temp_v0_4 != 0) { - var_s0->unk30 = (s8) (temp_v0_4 & ~temp_s2); - if (var_s0->unk30 == 0) { + var_s0->someFlags = temp_v0_4 & ~temp_s2; + if (var_s0->someFlags == 0) { D_801631C8 += 1; - func_800C9EF4(var_s0 + 4, arg6); + func_800C9EF4(var_s0->position, arg6); } } } if ((temp_f20 > -200.0) && (temp_f20 < 200.0) && (temp_f0_5 = (f64) temp_f22, (temp_f0_5 > -20.0)) && (temp_f0_5 < 20.0) && (temp_f0_6 = (f64) temp_f24, (temp_f0_6 > -200.0)) && (temp_f0_6 < 200.0)) { - if ((var_s0->unk31 & temp_s2) == 0) { + if (!(var_s0->someFlagsTheSequel & temp_s2)) { temp_v1 = D_8016347A; var_s1 = 0; temp_v0_5 = *gWaypointCountByPathIndex; switch (temp_v1) { /* irregular */ case 0: sp9C = temp_s7 + &D_80163270; - temp_v0_6 = func_80007BF8(var_s0->unk1C, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) temp_v0_5); + temp_v0_6 = func_80007BF8((u16) var_s0->wayPointIndex, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) temp_v0_5); temp_v1_2 = *sp9C; - if ((temp_v1_2 == 0) && (temp_v0_6 > 0) && (player->unk_094 < var_s0->unk20)) { + if ((temp_v1_2 == 0) && (temp_v0_6 > 0) && (player->unk_094 < var_s0->someMultiplier)) { var_s1 = 1; } if ((temp_v1_2 == 1) && (temp_v0_6 > 0)) { @@ -7611,24 +7428,24 @@ void func_80013F7C(s32 playerId, Player *player, void *arg2, f32 arg3, f32 arg4, } break; case 1: - if (func_80007BF8(var_s0->unk1C, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) temp_v0_5) > 0) { + if (func_80007BF8((u16) var_s0->wayPointIndex, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) temp_v0_5) > 0) { if (random_int(2U) == 0) { temp_v1_3 = *(&D_80163270 + temp_s7); if (temp_v1_3 == 0) { var_s1 = 1; } - if ((temp_v1_3 == 1) && (player->unk_094 < var_s0->unk20)) { + if ((temp_v1_3 == 1) && (player->unk_094 < var_s0->someMultiplier)) { var_s1 = 1; } } else { - var_s0->unk31 = (s8) (var_s0->unk31 | temp_s2); + var_s0->someFlagsTheSequel |= temp_s2; } } break; } if (var_s1 == 1) { var_a2 = 0x1901703B; - sp84 = var_s0 + 0x10; + sp84 = var_s0->velocity; switch (arg6) { /* switch 1; irregular */ case 0x51018005: /* switch 1 */ spA8 = 0x1901703B; @@ -7659,14 +7476,14 @@ void func_80013F7C(s32 playerId, Player *player, void *arg2, f32 arg3, f32 arg4, } break; } - var_s0->unk31 = (s8) (var_s0->unk31 | temp_s2); - func_800C98B8(var_s0 + 4, sp84, var_a2); + var_s0->someFlagsTheSequel |= temp_s2; + func_800C98B8(var_s0->position, sp84, var_a2); } } } else { - temp_v0_7 = var_s0->unk31; - if ((temp_v0_7 & temp_s2) != 0) { - var_s0->unk31 = (s8) (temp_v0_7 & ~temp_s2); + temp_v0_7 = var_s0->someFlagsTheSequel; + if (temp_v0_7 & temp_s2) { + var_s0->someFlagsTheSequel = temp_v0_7 & ~temp_s2; } } } @@ -7728,26 +7545,26 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800145A8.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 +//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de extern ? D_801634FC; -void func_800146B8(s32 playerId, s32 arg1, void *arg2) { +void func_800146B8(s32 playerId, s32 arg1, VehicleStuff *vehicle) { + VehicleStuff *var_s0; s16 var_v1; s32 var_a2; s32 var_v0; u16 temp_a1; - void *var_s0; - var_s0 = arg2; + var_s0 = vehicle; if (!((f64) *(&gPlayers->unk_094 + (playerId * 0xDD8)) < 1.6666666666666667) && (var_a2 = 0, (arg1 > 0))) { loop_3: - temp_a1 = var_s0->unk1C; + temp_a1 = (u16) var_s0->wayPointIndex; var_v0 = 0; var_v1 = D_80162FCE; loop_4: var_v0 += 3; if (temp_a1 == (var_v1 % (s32) *gWaypointCountByPathIndex)) { - *(&D_801634FC + (playerId * 0x10)) = func_800145A8(var_s0->unk2E, D_80163068[playerId], (s16) temp_a1); + *(&D_801634FC + (playerId * 0x10)) = func_800145A8(var_s0->someType, D_80163068[playerId], (s16) temp_a1); return; } var_v1 += 3; @@ -7768,52 +7585,39 @@ loop_4: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800146B8.s") #endif -typedef struct { - s32 innards[0xD]; -} somestruct; -//extern s32 D_80163984; -extern somestruct D_80163818[]; - #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//? func_800139E4(f32, f32, ?, ?, ? *, s16 *); // extern +void func_800139E4(f32 arg0, f32 arg1, s32 arg2, f32 arg3, VehicleStuff *arg4, struct TrackWayPoint *arg5); extern f64 D_800ED1B8; extern f64 D_800ED1C0; extern f64 D_800ED1C8; -//extern s32 D_80163818; -void func_800139E4(f32 arg0, f32 arg1, s32 arg2, f32 arg3, somestruct *arg4, struct TrackWayPoint *arg5); +extern s32 gBoxTruckList; void func_800147E0(void) { f64 temp_f0 = (gCCSelection * D_800ED1B8) / 216.0; - s32 phi_a2 = 7; + s32 phi_a2 = NUM_RACE_BOX_TRUCKS; - //phi_a2 = 7; - //temp_f0 = (gCCSelection * D_800ED1B8) / 216.0; if (gModeSelection == TIME_TRIALS) { - phi_a2 = 8; + phi_a2 = NUM_TIME_TRIAL_BOX_TRUCKS; } - func_800139E4(temp_f0 + D_800ED1C0, temp_f0 + D_800ED1C8, phi_a2, 0, &D_80163818, D_80164550); + func_800139E4(temp_f0 + D_800ED1C0, temp_f0 + D_800ED1C8, phi_a2, 0, &gBoxTruckList, D_80164550); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800147E0.s") #endif -void func_80013D20(void*); // extern - void func_8001487C(void) { s32 loopIndex; - for(loopIndex = 0; loopIndex < 7; loopIndex++) { - func_80013D20(&D_80163818[loopIndex]); + for (loopIndex = 0; loopIndex < NUM_RACE_BOX_TRUCKS; loopIndex++) { + func_80013D20(&gBoxTruckList[loopIndex]); } } -void func_80013F7C(s32 playerId, Player *player, void *arg2, f32 arg3, f32 arg4, s32 arg5, u32 arg6); - -void func_800148C4(s32 arg0, s32 arg1) { - func_80013F7C(arg0, arg1, &D_80163818, 55.0f, 12.5f, 7, 0x51018003); +void func_800148C4(s32 playerId, Player *player) { + func_80013F7C(playerId, player, gBoxTruckList, 55.0f, 12.5f, NUM_RACE_BOX_TRUCKS, 0x51018003); } -void func_8001490C(s32 arg0) { - func_800146B8(arg0, 7, &D_80163818); +void func_8001490C(s32 playerId) { + func_800146B8(playerId, NUM_RACE_BOX_TRUCKS, gBoxTruckList); } #ifdef MIPS_TO_C @@ -7822,41 +7626,36 @@ void func_8001490C(s32 arg0) { extern f64 D_800ED1D0; extern f64 D_800ED1D8; extern f64 D_800ED1E0; -extern ? D_80163988; +extern ? gSchoolBusList; void func_80014934(void) { f64 temp_f0; ? phi_a2; temp_f0 = (gCCSelection * D_800ED1D0) / 216.0; - phi_a2 = 7; + phi_a2 = NUM_RACE_SCHOOL_BUSES; if (gModeSelection == TIME_TRIALS) { - phi_a2 = 8; + phi_a2 = NUM_TIME_TRIAL_SCHOOL_BUSES; } - func_800139E4(temp_f0 + D_800ED1D8, temp_f0 + D_800ED1E0, phi_a2, 0x4B, &D_80163988, D_80164550); + func_800139E4(temp_f0 + D_800ED1D8, temp_f0 + D_800ED1E0, phi_a2, 0x4B, &gSchoolBusList, D_80164550); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80014934.s") #endif -extern somestruct D_80163988[]; - void func_800149D0(void) { - s32 i; - - for (i = 0; i < 7; i++) { - func_80013D20(&D_80163988[i]); + s32 loopIndex; + for (loopIndex = 0; loopIndex < NUM_RACE_SCHOOL_BUSES; loopIndex++) { + func_80013D20(&gSchoolBusList[loopIndex]); } } - -void func_80014A18(s32 arg0, s32 arg1) { - func_80013F7C(arg0, arg1, &D_80163988, 70.0f, 12.5f, 7, 0x51018002); +void func_80014A18(s32 playerId, Player *player) { + func_80013F7C(playerId, player, gSchoolBusList, 70.0f, 12.5f, NUM_RACE_SCHOOL_BUSES, 0x51018002); } - -void func_80014A60(s32 arg0) { - func_800146B8(arg0, 7, &D_80163988); +void func_80014A60(s32 playerId) { + func_800146B8(playerId, NUM_RACE_SCHOOL_BUSES, gSchoolBusList); } #ifdef MIPS_TO_C @@ -7865,39 +7664,36 @@ void func_80014A60(s32 arg0) { extern f64 D_800ED1E8; extern f64 D_800ED1F0; extern f64 D_800ED1F8; -extern ? D_80163AF8; +extern ? gTankerTruckList; void func_80014A88(void) { f64 temp_f0; ? phi_a2; temp_f0 = (gCCSelection * D_800ED1E8) / 216.0; - phi_a2 = 7; + phi_a2 = NUM_RACE_TANKER_TRUCKS; if (gModeSelection == TIME_TRIALS) { - phi_a2 = 8; + phi_a2 = NUM_TIME_TRIAL_TANKER_TRUCKS; } - func_800139E4(temp_f0 + D_800ED1F0, temp_f0 + D_800ED1F8, phi_a2, 0x32, &D_80163AF8, D_80164550); + func_800139E4(temp_f0 + D_800ED1F0, temp_f0 + D_800ED1F8, phi_a2, 0x32, &gTankerTruckList, D_80164550); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80014A88.s") #endif -extern somestruct D_80163AF8[]; - void func_80014B24(void) { - s32 i; - - for (i = 0; i < 7; i++) { - func_80013D20(&D_80163AF8[i]); + s32 loopIndex; + for (loopIndex = 0; loopIndex < NUM_RACE_TANKER_TRUCKS; loopIndex++) { + func_80013D20(&gTankerTruckList[loopIndex]); } } -void func_80014B6C(s32 arg0, s32 arg1) { - func_80013F7C(arg0, arg1, &D_80163AF8, 55.0f, 12.5f, 7, 0x51018004); +void func_80014B6C(s32 playerId, Player *player) { + func_80013F7C(playerId, player, gTankerTruckList, 55.0f, 12.5f, NUM_RACE_TANKER_TRUCKS, 0x51018004); } -void func_80014BB4(s32 arg0) { - func_800146B8(arg0, 7, &D_80163AF8); +void func_80014BB4(s32 playerId) { + func_800146B8(playerId, NUM_RACE_TANKER_TRUCKS, gTankerTruckList); } #ifdef MIPS_TO_C @@ -7906,39 +7702,36 @@ void func_80014BB4(s32 arg0) { extern f64 D_800ED200; extern f64 D_800ED208; extern f64 D_800ED210; -extern ? D_80163C68; +extern ? gCarList; void func_80014BDC(void) { f64 temp_f0; ? phi_a2; temp_f0 = (gCCSelection * D_800ED200) / 216.0; - phi_a2 = 7; + phi_a2 = NUM_RACE_CARS; if (gModeSelection == TIME_TRIALS) { - phi_a2 = 8; + phi_a2 = NUM_TIME_TRIAL_CARS; } - func_800139E4(temp_f0 + D_800ED208, temp_f0 + D_800ED210, phi_a2, 0x19, &D_80163C68, D_80164550); + func_800139E4(temp_f0 + D_800ED208, temp_f0 + D_800ED210, phi_a2, 0x19, &gCarList, D_80164550); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80014BDC.s") #endif -extern somestruct D_80163C68[]; - void func_80014C78(void) { - s32 i; - - for (i = 0; i < 7; i++) { - func_80013D20(&D_80163C68[i]); + s32 loopIndex; + for (loopIndex = 0; loopIndex < NUM_RACE_CARS; loopIndex++) { + func_80013D20(&gCarList[loopIndex]); } } -void func_80014CC0(s32 arg0, s32 arg1) { - func_80013F7C(arg0, arg1, &D_80163C68, 11.5f, 8.5f, 7, 0x51018005); +void func_80014CC0(s32 playerId, Player *player) { + func_80013F7C(playerId, player, gCarList, 11.5f, 8.5f, NUM_RACE_CARS, 0x51018005); } -void func_80014D08(s32 arg0) { - func_800146B8(arg0, 7, &D_80163C68); +void func_80014D08(s32 playerId) { + func_800146B8(playerId, NUM_RACE_CARS, gCarList); } void func_80014D30(s32 cameraId, s32 pathIndex) { diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 2c069f53f..8fcbae60f 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -2,6 +2,7 @@ #define CODE_80005FD0_H #include "common_structs.h" +#include "vehicles.h" /* Function Prototypes */ s16 func_80005FD0(Vec3f, Vec3f); @@ -29,6 +30,9 @@ s16 func_8000CD24(f32, f32, f32, s16, Player*, s32, s32); s16 func_8000D24C(f32, f32, f32, s32*); s16 func_8000D2B4(f32, f32, f32, s16, s32); s16 func_8000D33C(f32, f32, f32, s16, s32); +s16 func_8000D6D0(Vec3f, s16 *, f32, f32, s32, s32); +s16 func_8000D940(Vec3f, s16 *, f32, f32, s32); +s16 func_8000DBAC(Vec3f, s16*, f32); void func_8000F0E0(void); void func_8000F124(void); void func_80010218(s32); @@ -39,14 +43,33 @@ void func_80010DBC(s32); f32 func_80010F40(f32, f32, f32, s32); f32 func_80010FA0(f32, f32, f32, s32); s32 process_path_data(struct TrackWayPoint*, struct TrackWayPoint*); +void func_80012220(VehicleStuff*); +void func_80012A48(TrainCarStuff*, s16); f32 func_80013C74(s16, s16); +void func_80013D20(VehicleStuff*); +void func_80013F7C(s32, Player*, VehicleStuff*, f32, f32, s32, u32); f32 func_800145A8(s16, f32, s16); +void func_800146B8(s32, s32, VehicleStuff*); +void func_8001487C(); +void func_800148C4(s32, Player*); +void func_8001490C(s32); +void func_800149D0(); +void func_80014A18(s32, Player*); +void func_80014A60(s32); +void func_80014B24(); +void func_80014B6C(s32, Player*); +void func_80014BB4(s32); +void func_80014C78(); +void func_80014CC0(s32, Player*); +void func_80014D08(s32); void func_80014D30(s32, s32); void func_8001968C(); /* This is where I'd put my static data, if I had any */ +// 0 or 1, only 1 when when in extra (mirror) mode +extern s16 D_8016347A; // Might belong in menus.h? -extern s8 D_8018EDF3; +extern s8 D_8018EDF3; // Suspected to be the "width" of each wayPoint. See data_0DD0A0_1.s extern f32 D_800DCA4C[];