diff --git a/Makefile b/Makefile index 46387f4ed..1798b0784 100644 --- a/Makefile +++ b/Makefile @@ -205,7 +205,7 @@ DATA_DIR := data INCLUDE_DIRS := include # Directories containing source files -SRC_DIRS := src src/audio src/debug src/os src/os/math courses +SRC_DIRS := src src/racing src/ending src/audio src/debug src/os src/os/math courses ASM_DIRS := asm asm/audio asm/os asm/unused asm/os/non_matchings $(DATA_DIR) $(DATA_DIR)/sound_data $(DATA_DIR)/karts @@ -227,7 +227,7 @@ COURSE_ASM_FILES := $(wildcard courses/*/*/packed.s) # These are files that need to be encoded into EUC-JP in order for the ROM to match # We filter them out from the regular C_FILES since we don't need nor want the # UTF-8 versions getting compiled -EUC_JP_FILES := src/credits.c src/code_80005FD0.c src/code_80091750.c +EUC_JP_FILES := src/ending/credits.c src/code_80005FD0.c src/code_80091750.c C_FILES := $(filter-out $(EUC_JP_FILES),$(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))) S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s)) $(COURSE_ASM_FILES) COURSE_FILES := $(foreach dir,$(COURSE_DIRS),$(wildcard $(dir)/*.inc.c)) @@ -245,8 +245,10 @@ DEP_FILES := $(O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d # Files with GLOBAL_ASM blocks GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/*.c) GLOBAL_ASM_AUDIO_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/audio/*.c) +GLOBAL_ASM_RACING_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/racing/*.c) GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) GLOBAL_ASM_AUDIO_O_FILES = $(foreach file,$(GLOBAL_ASM_AUDIO_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) +GLOBAL_ASM_RACING_O_FILES = $(foreach file,$(GLOBAL_ASM_RACING_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) @@ -289,7 +291,7 @@ ifeq ($(TARGET_N64),1) CC_CFLAGS := -fno-builtin endif -INCLUDE_DIRS := include $(BUILD_DIR) $(BUILD_DIR)/include src . +INCLUDE_DIRS := include $(BUILD_DIR) $(BUILD_DIR)/include src src/racing src/ending . ifeq ($(TARGET_N64),1) INCLUDE_DIRS += include/libc endif @@ -587,7 +589,7 @@ $(GLOBAL_ASM_O_FILES): CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(A $(GLOBAL_ASM_AUDIO_O_FILES): CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- - +$(GLOBAL_ASM_RACING_O_FILES): CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- #==============================================================================# # Libultra Definitions # diff --git a/asm/bss_80005FD0.s b/asm/bss_80005FD0.s index df88d5c61..b0131ef02 100644 --- a/asm/bss_80005FD0.s +++ b/asm/bss_80005FD0.s @@ -294,7 +294,7 @@ glabel D_80163598 glabel D_8016359C .skip 4 -glabel D_801635A0 +glabel sTrains .skip 4 glabel D_801635A4 diff --git a/asm/bss_MainSeg.s b/asm/bss_MainSeg.s index 44d9fc48c..1ba0a0cc1 100644 --- a/asm/bss_MainSeg.s +++ b/asm/bss_MainSeg.s @@ -11,7 +11,7 @@ glabel D_801636B0 glabel D_801637AC # .skip 12 -glabel D_801637B8 # Crossing activated bit field +glabel isCrossingTriggeredByIndex # Crossing activated boolean .skip 4 glabel D_801637BC # CrossingTimer diff --git a/asm/non_matchings/code_80005FD0/func_800100F0.s b/asm/non_matchings/code_80005FD0/func_800100F0.s deleted file mode 100644 index 35c3b3870..000000000 --- a/asm/non_matchings/code_80005FD0/func_800100F0.s +++ /dev/null @@ -1,81 +0,0 @@ -glabel func_800100F0 -/* 010CF0 800100F0 3C02800E */ lui $v0, %hi(gCurrentCourseId) -/* 010CF4 800100F4 8442C5A0 */ lh $v0, %lo(gCurrentCourseId)($v0) -/* 010CF8 800100F8 3C01800E */ lui $at, %hi(D_800DCA4C) -/* 010CFC 800100FC 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 010D00 80010100 00027080 */ sll $t6, $v0, 2 -/* 010D04 80010104 002E0821 */ addu $at, $at, $t6 -/* 010D08 80010108 C424CA4C */ lwc1 $f4, %lo(D_800DCA4C)($at) -/* 010D0C 8001010C 0004C880 */ sll $t9, $a0, 2 -/* 010D10 80010110 3C088016 */ lui $t0, %hi(D_80164550) -/* 010D14 80010114 4600218D */ trunc.w.s $f6, $f4 -/* 010D18 80010118 AFBF0014 */ sw $ra, 0x14($sp) -/* 010D1C 8001011C AFA40038 */ sw $a0, 0x38($sp) -/* 010D20 80010120 01194021 */ addu $t0, $t0, $t9 -/* 010D24 80010124 44183000 */ mfc1 $t8, $f6 -/* 010D28 80010128 03201825 */ move $v1, $t9 -/* 010D2C 8001012C 24060001 */ li $a2, 1 -/* 010D30 80010130 07020036 */ bltzl $t8, .L8001020C -/* 010D34 80010134 8FBF0014 */ lw $ra, 0x14($sp) -/* 010D38 80010138 8D084550 */ lw $t0, %lo(D_80164550)($t0) -/* 010D3C 8001013C 24010014 */ li $at, 20 -/* 010D40 80010140 10410010 */ beq $v0, $at, .L80010184 -/* 010D44 80010144 AFA80030 */ sw $t0, 0x30($sp) -/* 010D48 80010148 00024900 */ sll $t1, $v0, 4 -/* 010D4C 8001014C 01395021 */ addu $t2, $t1, $t9 -/* 010D50 80010150 3C04800E */ lui $a0, %hi(D_800DC8D0) -/* 010D54 80010154 008A2021 */ addu $a0, $a0, $t2 -/* 010D58 80010158 0C026455 */ jal segmented_to_virtual_dupe_2 -/* 010D5C 8001015C 8C84C8D0 */ lw $a0, %lo(D_800DC8D0)($a0) -/* 010D60 80010160 8FA40030 */ lw $a0, 0x30($sp) -/* 010D64 80010164 0C00457D */ jal process_path_data -/* 010D68 80010168 00402825 */ move $a1, $v0 -/* 010D6C 8001016C 8FAB0038 */ lw $t3, 0x38($sp) -/* 010D70 80010170 3C018016 */ lui $at, %hi(gWaypointCountByPathIndex) # 0x8016 -/* 010D74 80010174 000B6040 */ sll $t4, $t3, 1 -/* 010D78 80010178 002C0821 */ addu $at, $at, $t4 -/* 010D7C 8001017C 10000022 */ b .L80010208 -/* 010D80 80010180 A42245C8 */ sh $v0, %lo(gWaypointCountByPathIndex)($at) # 0x45c8($at) -.L80010184: -/* 010D84 80010184 00026900 */ sll $t5, $v0, 4 -/* 010D88 80010188 01A37021 */ addu $t6, $t5, $v1 -/* 010D8C 8001018C 3C04800E */ lui $a0, %hi(gCoursePathTable) -/* 010D90 80010190 008E2021 */ addu $a0, $a0, $t6 -/* 010D94 80010194 8C84C780 */ lw $a0, %lo(gCoursePathTable)($a0) -/* 010D98 80010198 0C026455 */ jal segmented_to_virtual_dupe_2 -/* 010D9C 8001019C A7A6001A */ sh $a2, 0x1a($sp) -/* 010DA0 800101A0 AFA2002C */ sw $v0, 0x2c($sp) -/* 010DA4 800101A4 00402025 */ move $a0, $v0 -/* 010DA8 800101A8 87A6001A */ lh $a2, 0x1a($sp) -/* 010DAC 800101AC 34028000 */ li $v0, 32768 -/* 010DB0 800101B0 00001825 */ move $v1, $zero -/* 010DB4 800101B4 24050BB8 */ li $a1, 3000 -.L800101B8: -/* 010DB8 800101B8 948F0000 */ lhu $t7, ($a0) -/* 010DBC 800101BC 144F0004 */ bne $v0, $t7, .L800101D0 -/* 010DC0 800101C0 2478FFFF */ addiu $t8, $v1, -1 -/* 010DC4 800101C4 AFB80024 */ sw $t8, 0x24($sp) -/* 010DC8 800101C8 10000004 */ b .L800101DC -/* 010DCC 800101CC 00003025 */ move $a2, $zero -.L800101D0: -/* 010DD0 800101D0 24630001 */ addiu $v1, $v1, 1 -/* 010DD4 800101D4 1465FFF8 */ bne $v1, $a1, .L800101B8 -/* 010DD8 800101D8 24840008 */ addiu $a0, $a0, 8 -.L800101DC: -/* 010DDC 800101DC 14C0000A */ bnez $a2, .L80010208 -/* 010DE0 800101E0 8FA40030 */ lw $a0, 0x30($sp) -/* 010DE4 800101E4 8FA5002C */ lw $a1, 0x2c($sp) -/* 010DE8 800101E8 8FA60024 */ lw $a2, 0x24($sp) -/* 010DEC 800101EC 0C004405 */ jal func_80011014 -/* 010DF0 800101F0 8FA70038 */ lw $a3, 0x38($sp) -/* 010DF4 800101F4 8FB90038 */ lw $t9, 0x38($sp) -/* 010DF8 800101F8 3C018016 */ lui $at, %hi(gWaypointCountByPathIndex) # 0x8016 -/* 010DFC 800101FC 00194040 */ sll $t0, $t9, 1 -/* 010E00 80010200 00280821 */ addu $at, $at, $t0 -/* 010E04 80010204 A42245C8 */ sh $v0, %lo(gWaypointCountByPathIndex)($at) # 0x45c8($at) -.L80010208: -/* 010E08 80010208 8FBF0014 */ lw $ra, 0x14($sp) -.L8001020C: -/* 010E0C 8001020C 27BD0038 */ addiu $sp, $sp, 0x38 -/* 010E10 80010210 03E00008 */ jr $ra -/* 010E14 80010214 00000000 */ nop diff --git a/asm/non_matchings/code_80005FD0/func_800120C8.s b/asm/non_matchings/code_80005FD0/func_800120C8.s deleted file mode 100644 index f0f8dc531..000000000 --- a/asm/non_matchings/code_80005FD0/func_800120C8.s +++ /dev/null @@ -1,53 +0,0 @@ -glabel func_800120C8 -/* 012CC8 800120C8 3C040600 */ lui $a0, %hi(d_course_kalimari_desert_track_unknown_waypoints) # $a0, 0x600 -/* 012CCC 800120CC 24846C60 */ addiu $a0, %lo(d_course_kalimari_desert_track_unknown_waypoints) # addiu $a0, $a0, 0x6c60 -/* 012CD0 800120D0 00047602 */ srl $t6, $a0, 0x18 -/* 012CD4 800120D4 000E7880 */ sll $t7, $t6, 2 -/* 012CD8 800120D8 3C188015 */ lui $t8, %hi(gSegmentTable) # 0x8015 -/* 012CDC 800120DC 030FC021 */ addu $t8, $t8, $t7 -/* 012CE0 800120E0 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* 012CE4 800120E4 8F180258 */ lw $t8, %lo(gSegmentTable)($t8) # 0x258($t8) -/* 012CE8 800120E8 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* 012CEC 800120EC 0081C824 */ and $t9, $a0, $at -/* 012CF0 800120F0 3C018000 */ lui $at, 0x8000 -/* 012CF4 800120F4 03192821 */ addu $a1, $t8, $t9 -/* 012CF8 800120F8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 012CFC 800120FC 00A12821 */ addu $a1, $a1, $at -/* 012D00 80012100 AFBF0014 */ sw $ra, 0x14($sp) -/* 012D04 80012104 00A01025 */ move $v0, $a1 -/* 012D08 80012108 34048000 */ li $a0, 32768 -/* 012D0C 8001210C 00001825 */ move $v1, $zero -.L80012110: -/* 012D10 80012110 94480000 */ lhu $t0, ($v0) -/* 012D14 80012114 24420008 */ addiu $v0, $v0, 8 -/* 012D18 80012118 10880003 */ beq $a0, $t0, .L80012128 -/* 012D1C 8001211C 00000000 */ nop -/* 012D20 80012120 1000FFFB */ b .L80012110 -/* 012D24 80012124 24630001 */ addiu $v1, $v1, 1 -.L80012128: -/* 012D28 80012128 3C048016 */ lui $a0, %hi(D_80163598) # $a0, 0x8016 -/* 012D2C 8001212C 8C843598 */ lw $a0, %lo(D_80163598)($a0) -/* 012D30 80012130 2466FFFF */ addiu $a2, $v1, -1 -/* 012D34 80012134 0C0045A3 */ jal func_8001168C -/* 012D38 80012138 AFA40018 */ sw $a0, 0x18($sp) -/* 012D3C 8001213C 8FA40018 */ lw $a0, 0x18($sp) -/* 012D40 80012140 3C018016 */ lui $at, %hi(D_8016359C) # $at, 0x8016 -/* 012D44 80012144 AC22359C */ sw $v0, %lo(D_8016359C)($at) -/* 012D48 80012148 848A0002 */ lh $t2, 2($a0) -/* 012D4C 8001214C 84890000 */ lh $t1, ($a0) -/* 012D50 80012150 3C0144FA */ li $at, 0x44FA0000 # 2000.000000 -/* 012D54 80012154 448A3000 */ mtc1 $t2, $f6 -/* 012D58 80012158 44892000 */ mtc1 $t1, $f4 -/* 012D5C 8001215C 44817000 */ mtc1 $at, $f14 -/* 012D60 80012160 468031A0 */ cvt.s.w $f6, $f6 -/* 012D64 80012164 46802320 */ cvt.s.w $f12, $f4 -/* 012D68 80012168 44063000 */ mfc1 $a2, $f6 -/* 012D6C 8001216C 0C0AB870 */ jal func_802AE1C0 -/* 012D70 80012170 00000000 */ nop -/* 012D74 80012174 4600020D */ trunc.w.s $f8, $f0 -/* 012D78 80012178 8FBF0014 */ lw $ra, 0x14($sp) -/* 012D7C 8001217C 3C018016 */ lui $at, %hi(D_80162EB0) # 0x8016 -/* 012D80 80012180 27BD0020 */ addiu $sp, $sp, 0x20 -/* 012D84 80012184 440C4000 */ mfc1 $t4, $f8 -/* 012D88 80012188 03E00008 */ jr $ra -/* 012D8C 8001218C A42C2EB0 */ sh $t4, %lo(D_80162EB0)($at) # 0x2eb0($at) diff --git a/asm/non_matchings/code_80005FD0/func_80012780.s b/asm/non_matchings/code_80005FD0/func_80012780.s deleted file mode 100644 index b4b9f114d..000000000 --- a/asm/non_matchings/code_80005FD0/func_80012780.s +++ /dev/null @@ -1,25 +0,0 @@ -glabel func_80012780 -/* 013380 80012780 AFA60008 */ sw $a2, 8($sp) -/* 013384 80012784 84AF0000 */ lh $t7, ($a1) -/* 013388 80012788 3C188016 */ lui $t8, %hi(D_80162EB0) # $t8, 0x8016 -/* 01338C 8001278C 44800000 */ mtc1 $zero, $f0 -/* 013390 80012790 448F2000 */ mtc1 $t7, $f4 -/* 013394 80012794 2408FFFF */ li $t0, -1 -/* 013398 80012798 468021A0 */ cvt.s.w $f6, $f4 -/* 01339C 8001279C E4860004 */ swc1 $f6, 4($a0) -/* 0133A0 800127A0 87182EB0 */ lh $t8, %lo(D_80162EB0)($t8) -/* 0133A4 800127A4 44984000 */ mtc1 $t8, $f8 -/* 0133A8 800127A8 00000000 */ nop -/* 0133AC 800127AC 468042A0 */ cvt.s.w $f10, $f8 -/* 0133B0 800127B0 E48A0008 */ swc1 $f10, 8($a0) -/* 0133B4 800127B4 84B90002 */ lh $t9, 2($a1) -/* 0133B8 800127B8 A488001E */ sh $t0, 0x1e($a0) -/* 0133BC 800127BC A486001C */ sh $a2, 0x1c($a0) -/* 0133C0 800127C0 44998000 */ mtc1 $t9, $f16 -/* 0133C4 800127C4 A4800000 */ sh $zero, ($a0) -/* 0133C8 800127C8 E4800010 */ swc1 $f0, 0x10($a0) -/* 0133CC 800127CC 468084A0 */ cvt.s.w $f18, $f16 -/* 0133D0 800127D0 E4800014 */ swc1 $f0, 0x14($a0) -/* 0133D4 800127D4 E4800018 */ swc1 $f0, 0x18($a0) -/* 0133D8 800127D8 03E00008 */ jr $ra -/* 0133DC 800127DC E492000C */ swc1 $f18, 0xc($a0) diff --git a/asm/non_matchings/code_80005FD0/func_800127E0.s b/asm/non_matchings/code_80005FD0/func_800127E0.s deleted file mode 100644 index c51dedb12..000000000 --- a/asm/non_matchings/code_80005FD0/func_800127E0.s +++ /dev/null @@ -1,165 +0,0 @@ -glabel func_800127E0 -/* 0133E0 800127E0 27BDFF88 */ addiu $sp, $sp, -0x78 -/* 0133E4 800127E4 3C0E8016 */ lui $t6, %hi(D_801635A0) # $t6, 0x8016 -/* 0133E8 800127E8 AFB40030 */ sw $s4, 0x30($sp) -/* 0133EC 800127EC F7B40018 */ sdc1 $f20, 0x18($sp) -/* 0133F0 800127F0 25CE35A0 */ addiu $t6, %lo(D_801635A0) # addiu $t6, $t6, 0x35a0 -/* 0133F4 800127F4 3C0F8016 */ lui $t7, %hi(D_801635C4) # $t7, 0x8016 -/* 0133F8 800127F8 3C0140A0 */ li $at, 0x40A00000 # 5.000000 -/* 0133FC 800127FC AFBE0040 */ sw $fp, 0x40($sp) -/* 013400 80012800 AFB7003C */ sw $s7, 0x3c($sp) -/* 013404 80012804 AFB60038 */ sw $s6, 0x38($sp) -/* 013408 80012808 AFB50034 */ sw $s5, 0x34($sp) -/* 01340C 8001280C 25EF35C4 */ addiu $t7, %lo(D_801635C4) # addiu $t7, $t7, 0x35c4 -/* 013410 80012810 3C148016 */ lui $s4, %hi(D_80163598) # $s4, 0x8016 -/* 013414 80012814 4481A000 */ mtc1 $at, $f20 -/* 013418 80012818 AFBF0044 */ sw $ra, 0x44($sp) -/* 01341C 8001281C AFB3002C */ sw $s3, 0x2c($sp) -/* 013420 80012820 AFB20028 */ sw $s2, 0x28($sp) -/* 013424 80012824 AFB10024 */ sw $s1, 0x24($sp) -/* 013428 80012828 AFB00020 */ sw $s0, 0x20($sp) -/* 01342C 8001282C 26943598 */ addiu $s4, %lo(D_80163598) # addiu $s4, $s4, 0x3598 -/* 013430 80012830 AFAF004C */ sw $t7, 0x4c($sp) -/* 013434 80012834 241500B4 */ li $s5, 180 -/* 013438 80012838 01C0B025 */ move $s6, $t6 -/* 01343C 8001283C 01C0B825 */ move $s7, $t6 -/* 013440 80012840 0000F025 */ move $fp, $zero -.L80012844: -/* 013444 80012844 3C028016 */ lui $v0, %hi(D_8016359C) # $v0, 0x8016 -/* 013448 80012848 8C42359C */ lw $v0, %lo(D_8016359C)($v0) -/* 01344C 8001284C E6D400FC */ swc1 $f20, 0xfc($s6) -/* 013450 80012850 00002025 */ move $a0, $zero -/* 013454 80012854 03C20019 */ multu $fp, $v0 -/* 013458 80012858 00008825 */ move $s1, $zero -/* 01345C 8001285C 26F20048 */ addiu $s2, $s7, 0x48 -/* 013460 80012860 0000C012 */ mflo $t8 -/* 013464 80012864 07010003 */ bgez $t8, .L80012874 -/* 013468 80012868 0018C843 */ sra $t9, $t8, 1 -/* 01346C 8001286C 27010001 */ addiu $at, $t8, 1 -/* 013470 80012870 0001C843 */ sra $t9, $at, 1 -.L80012874: -/* 013474 80012874 272900A0 */ addiu $t1, $t9, 0xa0 -/* 013478 80012878 0122001A */ div $zero, $t1, $v0 -/* 01347C 8001287C 00008010 */ mfhi $s0 -/* 013480 80012880 320AFFFF */ andi $t2, $s0, 0xffff -/* 013484 80012884 01408025 */ move $s0, $t2 -/* 013488 80012888 14400002 */ bnez $v0, .L80012894 -/* 01348C 8001288C 00000000 */ nop -/* 013490 80012890 0007000D */ break 7 -.L80012894: -/* 013494 80012894 2401FFFF */ li $at, -1 -/* 013498 80012898 14410004 */ bne $v0, $at, .L800128AC -/* 01349C 8001289C 3C018000 */ lui $at, 0x8000 -/* 0134A0 800128A0 15210002 */ bne $t1, $at, .L800128AC -/* 0134A4 800128A4 00000000 */ nop -/* 0134A8 800128A8 0006000D */ break 6 -.L800128AC: -/* 0134AC 800128AC 26100004 */ addiu $s0, $s0, 4 -/* 0134B0 800128B0 8E8D0000 */ lw $t5, ($s4) -/* 0134B4 800128B4 320BFFFF */ andi $t3, $s0, 0xffff -/* 0134B8 800128B8 000B6080 */ sll $t4, $t3, 2 -/* 0134BC 800128BC 01608025 */ move $s0, $t3 -/* 0134C0 800128C0 3166FFFF */ andi $a2, $t3, 0xffff -/* 0134C4 800128C4 02402025 */ move $a0, $s2 -/* 0134C8 800128C8 0C0049E0 */ jal func_80012780 -/* 0134CC 800128CC 018D2821 */ addu $a1, $t4, $t5 -/* 0134D0 800128D0 26310024 */ addiu $s1, $s1, 0x24 -/* 0134D4 800128D4 1635FFF5 */ bne $s1, $s5, .L800128AC -/* 0134D8 800128D8 26520024 */ addiu $s2, $s2, 0x24 -/* 0134DC 800128DC 26100003 */ addiu $s0, $s0, 3 -/* 0134E0 800128E0 8E980000 */ lw $t8, ($s4) -/* 0134E4 800128E4 320EFFFF */ andi $t6, $s0, 0xffff -/* 0134E8 800128E8 000E7880 */ sll $t7, $t6, 2 -/* 0134EC 800128EC 01C08025 */ move $s0, $t6 -/* 0134F0 800128F0 31C6FFFF */ andi $a2, $t6, 0xffff -/* 0134F4 800128F4 8FA4004C */ lw $a0, 0x4c($sp) -/* 0134F8 800128F8 0C0049E0 */ jal func_80012780 -/* 0134FC 800128FC 01F82821 */ addu $a1, $t7, $t8 -/* 013500 80012900 8E8A0000 */ lw $t2, ($s4) -/* 013504 80012904 26100004 */ addiu $s0, $s0, 4 -/* 013508 80012908 3219FFFF */ andi $t9, $s0, 0xffff -/* 01350C 8001290C 00194880 */ sll $t1, $t9, 2 -/* 013510 80012910 012A9821 */ addu $s3, $t1, $t2 -/* 013514 80012914 03208025 */ move $s0, $t9 -/* 013518 80012918 02602825 */ move $a1, $s3 -/* 01351C 8001291C 3326FFFF */ andi $a2, $t9, 0xffff -/* 013520 80012920 0C0049E0 */ jal func_80012780 -/* 013524 80012924 02C02025 */ move $a0, $s6 -/* 013528 80012928 8FAB004C */ lw $t3, 0x4c($sp) -/* 01352C 8001292C 27DE0001 */ addiu $fp, $fp, 1 -/* 013530 80012930 2BC10002 */ slti $at, $fp, 2 -/* 013534 80012934 256C010C */ addiu $t4, $t3, 0x10c -/* 013538 80012938 AFAC004C */ sw $t4, 0x4c($sp) -/* 01353C 8001293C 26D6010C */ addiu $s6, $s6, 0x10c -/* 013540 80012940 26F7010C */ addiu $s7, $s7, 0x10c -/* 013544 80012944 1420FFBF */ bnez $at, .L80012844 -/* 013548 80012948 AEC0FFF8 */ sw $zero, -8($s6) -/* 01354C 8001294C 3C02800E */ lui $v0, %hi(gScreenModeSelection) -/* 013550 80012950 8C42C530 */ lw $v0, %lo(gScreenModeSelection)($v0) -/* 013554 80012954 3C0D8016 */ lui $t5, %hi(D_801635A0) # 0x8016 -/* 013558 80012958 25A635A0 */ addiu $a2, $t5, %lo(D_801635A0) # 0x35a0 -/* 01355C 8001295C 10400008 */ beqz $v0, .L80012980 -/* 013560 80012960 00C0B025 */ move $s6, $a2 -/* 013564 80012964 24030001 */ li $v1, 1 -/* 013568 80012968 1043001B */ beq $v0, $v1, .L800129D8 -/* 01356C 8001296C 24010002 */ li $at, 2 -/* 013570 80012970 10410019 */ beq $v0, $at, .L800129D8 -/* 013574 80012974 00000000 */ nop -/* 013578 80012978 10000025 */ b .L80012A10 -/* 01357C 8001297C 8FBF0044 */ lw $ra, 0x44($sp) -.L80012980: -/* 013580 80012980 3C088016 */ lui $t0, %hi(D_801637B8) # $t0, 0x8016 -/* 013584 80012984 250837B8 */ addiu $t0, %lo(D_801637B8) # addiu $t0, $t0, 0x37b8 -/* 013588 80012988 00C0B825 */ move $s7, $a2 -/* 01358C 8001298C 24070006 */ li $a3, 6 -/* 013590 80012990 24050024 */ li $a1, 36 -/* 013594 80012994 24030001 */ li $v1, 1 -.L80012998: -/* 013598 80012998 00650019 */ multu $v1, $a1 -/* 01359C 8001299C A6C30024 */ sh $v1, 0x24($s6) -/* 0135A0 800129A0 A4C30048 */ sh $v1, 0x48($a2) -/* 0135A4 800129A4 24C6010C */ addiu $a2, $a2, 0x10c -/* 0135A8 800129A8 26D6010C */ addiu $s6, $s6, 0x10c -/* 0135AC 800129AC 00007012 */ mflo $t6 -/* 0135B0 800129B0 02EE1021 */ addu $v0, $s7, $t6 -/* 0135B4 800129B4 A4430048 */ sh $v1, 0x48($v0) -/* 0135B8 800129B8 A443006C */ sh $v1, 0x6c($v0) -/* 0135BC 800129BC A4430090 */ sh $v1, 0x90($v0) -/* 0135C0 800129C0 A44300B4 */ sh $v1, 0xb4($v0) -/* 0135C4 800129C4 26F7010C */ addiu $s7, $s7, 0x10c -/* 0135C8 800129C8 14C8FFF3 */ bne $a2, $t0, .L80012998 -/* 0135CC 800129CC AEC7FFF8 */ sw $a3, -8($s6) -/* 0135D0 800129D0 1000000F */ b .L80012A10 -/* 0135D4 800129D4 8FBF0044 */ lw $ra, 0x44($sp) -.L800129D8: -/* 0135D8 800129D8 3C0F800E */ lui $t7, %hi(gModeSelection) -/* 0135DC 800129DC 8DEFC53C */ lw $t7, %lo(gModeSelection)($t7) -/* 0135E0 800129E0 3C168016 */ lui $s6, %hi(D_801635A0) # $s6, 0x8016 -/* 0135E4 800129E4 26D635A0 */ addiu $s6, %lo(D_801635A0) # addiu $s6, $s6, 0x35a0 -/* 0135E8 800129E8 11E00008 */ beqz $t7, .L80012A0C -/* 0135EC 800129EC 3C028016 */ lui $v0, %hi(D_801637B8) # $v0, 0x8016 -/* 0135F0 800129F0 244237B8 */ addiu $v0, %lo(D_801637B8) # addiu $v0, $v0, 0x37b8 -.L800129F4: -/* 0135F4 800129F4 26D6010C */ addiu $s6, $s6, 0x10c -/* 0135F8 800129F8 24180002 */ li $t8, 2 -/* 0135FC 800129FC A6C3FF18 */ sh $v1, -0xe8($s6) -/* 013600 80012A00 A6C3FFCC */ sh $v1, -0x34($s6) -/* 013604 80012A04 16C2FFFB */ bne $s6, $v0, .L800129F4 -/* 013608 80012A08 AED8FFF8 */ sw $t8, -8($s6) -.L80012A0C: -/* 01360C 80012A0C 8FBF0044 */ lw $ra, 0x44($sp) -.L80012A10: -/* 013610 80012A10 3C018016 */ lui $at, %hi(D_80162FCC) # $at, 0x8016 -/* 013614 80012A14 D7B40018 */ ldc1 $f20, 0x18($sp) -/* 013618 80012A18 8FB00020 */ lw $s0, 0x20($sp) -/* 01361C 80012A1C 8FB10024 */ lw $s1, 0x24($sp) -/* 013620 80012A20 8FB20028 */ lw $s2, 0x28($sp) -/* 013624 80012A24 8FB3002C */ lw $s3, 0x2c($sp) -/* 013628 80012A28 8FB40030 */ lw $s4, 0x30($sp) -/* 01362C 80012A2C 8FB50034 */ lw $s5, 0x34($sp) -/* 013630 80012A30 8FB60038 */ lw $s6, 0x38($sp) -/* 013634 80012A34 8FB7003C */ lw $s7, 0x3c($sp) -/* 013638 80012A38 8FBE0040 */ lw $fp, 0x40($sp) -/* 01363C 80012A3C A4202FCC */ sh $zero, %lo(D_80162FCC)($at) -/* 013640 80012A40 03E00008 */ jr $ra -/* 013644 80012A44 27BD0078 */ addiu $sp, $sp, 0x78 diff --git a/asm/non_matchings/code_80005FD0/func_80012AC0.s b/asm/non_matchings/code_80005FD0/func_80012AC0.s deleted file mode 100644 index 6bdf659f3..000000000 --- a/asm/non_matchings/code_80005FD0/func_80012AC0.s +++ /dev/null @@ -1,213 +0,0 @@ -.section .late_rodata - -glabel D_800ED0F0 -.float 1.1 -.word 0x00000000 - -glabel D_800ED0F8 -.double 65.0 - -.section .text - -glabel func_80012AC0 -/* 0136C0 80012AC0 27BDFF40 */ addiu $sp, $sp, -0xc0 -/* 0136C4 80012AC4 3C028016 */ lui $v0, %hi(D_80162FCC) # $v0, 0x8016 -/* 0136C8 80012AC8 24422FCC */ addiu $v0, %lo(D_80162FCC) # addiu $v0, $v0, 0x2fcc -/* 0136CC 80012ACC 844E0000 */ lh $t6, ($v0) -/* 0136D0 80012AD0 F7BE0040 */ sdc1 $f30, 0x40($sp) -/* 0136D4 80012AD4 3C01800F */ lui $at, %hi(D_800ED0F0) # $at, 0x800f -/* 0136D8 80012AD8 25CF0001 */ addiu $t7, $t6, 1 -/* 0136DC 80012ADC A44F0000 */ sh $t7, ($v0) -/* 0136E0 80012AE0 C43ED0F0 */ lwc1 $f30, %lo(D_800ED0F0)($at) -/* 0136E4 80012AE4 F7BC0038 */ sdc1 $f28, 0x38($sp) -/* 0136E8 80012AE8 3C0144FA */ li $at, 0x44FA0000 # 2000.000000 -/* 0136EC 80012AEC 4481E000 */ mtc1 $at, $f28 -/* 0136F0 80012AF0 F7BA0030 */ sdc1 $f26, 0x30($sp) -/* 0136F4 80012AF4 3C014039 */ li $at, 0x40390000 # 2.890625 -/* 0136F8 80012AF8 AFBE0068 */ sw $fp, 0x68($sp) -/* 0136FC 80012AFC AFB60060 */ sw $s6, 0x60($sp) -/* 013700 80012B00 AFB30054 */ sw $s3, 0x54($sp) -/* 013704 80012B04 4481D800 */ mtc1 $at, $f27 -/* 013708 80012B08 3C188016 */ lui $t8, %hi(D_801635A0) # 0x8016 -/* 01370C 80012B0C AFB70064 */ sw $s7, 0x64($sp) -/* 013710 80012B10 AFB5005C */ sw $s5, 0x5c($sp) -/* 013714 80012B14 AFB40058 */ sw $s4, 0x58($sp) -/* 013718 80012B18 F7B80028 */ sdc1 $f24, 0x28($sp) -/* 01371C 80012B1C 271335A0 */ addiu $s3, $t8, %lo(D_801635A0) # 0x35a0 -/* 013720 80012B20 3C01800F */ lui $at, %hi(D_800ED0F8) -/* 013724 80012B24 3C168016 */ lui $s6, %hi(D_801635A4) # $s6, 0x8016 -/* 013728 80012B28 3C1E8016 */ lui $fp, %hi(D_801635BC) # $fp, 0x8016 -/* 01372C 80012B2C 4480D000 */ mtc1 $zero, $f26 -/* 013730 80012B30 AFBF006C */ sw $ra, 0x6c($sp) -/* 013734 80012B34 AFB20050 */ sw $s2, 0x50($sp) -/* 013738 80012B38 AFB1004C */ sw $s1, 0x4c($sp) -/* 01373C 80012B3C AFB00048 */ sw $s0, 0x48($sp) -/* 013740 80012B40 F7B60020 */ sdc1 $f22, 0x20($sp) -/* 013744 80012B44 F7B40018 */ sdc1 $f20, 0x18($sp) -/* 013748 80012B48 27DE35BC */ addiu $fp, %lo(D_801635BC) # addiu $fp, $fp, 0x35bc -/* 01374C 80012B4C 26D635A4 */ addiu $s6, %lo(D_801635A4) # addiu $s6, $s6, 0x35a4 -/* 013750 80012B50 D438D0F8 */ ldc1 $f24, %lo(D_800ED0F8)($at) -/* 013754 80012B54 AFB3007C */ sw $s3, 0x7c($sp) -/* 013758 80012B58 24140001 */ li $s4, 1 -/* 01375C 80012B5C 241500B4 */ li $s5, 180 -/* 013760 80012B60 0000B825 */ move $s7, $zero -.L80012B64: -/* 013764 80012B64 9670001C */ lhu $s0, 0x1c($s3) -/* 013768 80012B68 C6740004 */ lwc1 $f20, 4($s3) -/* 01376C 80012B6C C676000C */ lwc1 $f22, 0xc($s3) -/* 013770 80012B70 02C02025 */ move $a0, $s6 -/* 013774 80012B74 03C02825 */ move $a1, $fp -/* 013778 80012B78 0C0036EB */ jal func_8000DBAC -/* 01377C 80012B7C 8E6600FC */ lw $a2, 0xfc($s3) -/* 013780 80012B80 C6640004 */ lwc1 $f4, 4($s3) -/* 013784 80012B84 C668000C */ lwc1 $f8, 0xc($s3) -/* 013788 80012B88 00028C00 */ sll $s1, $v0, 0x10 -/* 01378C 80012B8C 46142181 */ sub.s $f6, $f4, $f20 -/* 013790 80012B90 00022C00 */ sll $a1, $v0, 0x10 -/* 013794 80012B94 0011CC03 */ sra $t9, $s1, 0x10 -/* 013798 80012B98 46164281 */ sub.s $f10, $f8, $f22 -/* 01379C 80012B9C 00054403 */ sra $t0, $a1, 0x10 -/* 0137A0 80012BA0 03208825 */ move $s1, $t9 -/* 0137A4 80012BA4 E6660010 */ swc1 $f6, 0x10($s3) -/* 0137A8 80012BA8 E66A0018 */ swc1 $f10, 0x18($s3) -/* 0137AC 80012BAC 01002825 */ move $a1, $t0 -/* 0137B0 80012BB0 0C004A92 */ jal func_80012A48 -/* 0137B4 80012BB4 02602025 */ move $a0, $s3 -/* 0137B8 80012BB8 9662001C */ lhu $v0, 0x1c($s3) -/* 0137BC 80012BBC 240100BE */ li $at, 190 -/* 0137C0 80012BC0 1202000B */ beq $s0, $v0, .L80012BF0 -/* 0137C4 80012BC4 00000000 */ nop -/* 0137C8 80012BC8 10410003 */ beq $v0, $at, .L80012BD8 -/* 0137CC 80012BCC 02C02025 */ move $a0, $s6 -/* 0137D0 80012BD0 24010140 */ li $at, 320 -/* 0137D4 80012BD4 14410006 */ bne $v0, $at, .L80012BF0 -.L80012BD8: -/* 0137D8 80012BD8 3C061901 */ lui $a2, (0x1901800E >> 16) # lui $a2, 0x1901 -/* 0137DC 80012BDC 34C6800E */ ori $a2, (0x1901800E & 0xFFFF) # ori $a2, $a2, 0x800e -/* 0137E0 80012BE0 0C03262E */ jal func_800C98B8 -/* 0137E4 80012BE4 26650010 */ addiu $a1, $s3, 0x10 -/* 0137E8 80012BE8 1000000A */ b .L80012C14 -/* 0137EC 80012BEC 4405E000 */ mfc1 $a1, $f28 -.L80012BF0: -/* 0137F0 80012BF0 0C0ADF8D */ jal random_int -/* 0137F4 80012BF4 24040064 */ li $a0, 100 -/* 0137F8 80012BF8 14400005 */ bnez $v0, .L80012C10 -/* 0137FC 80012BFC 02C02025 */ move $a0, $s6 -/* 013800 80012C00 3C061901 */ lui $a2, (0x1901800D >> 16) # lui $a2, 0x1901 -/* 013804 80012C04 34C6800D */ ori $a2, (0x1901800D & 0xFFFF) # ori $a2, $a2, 0x800d -/* 013808 80012C08 0C03262E */ jal func_800C98B8 -/* 01380C 80012C0C 26650010 */ addiu $a1, $s3, 0x10 -.L80012C10: -/* 013810 80012C10 4405E000 */ mfc1 $a1, $f28 -.L80012C14: -/* 013814 80012C14 02C02025 */ move $a0, $s6 -/* 013818 80012C18 0C001877 */ jal func_800061DC -/* 01381C 80012C1C 8E660100 */ lw $a2, 0x100($s3) -/* 013820 80012C20 AE620100 */ sw $v0, 0x100($s3) -/* 013824 80012C24 3C098016 */ lui $t1, %hi(D_80162FCC) # $t1, 0x8016 -/* 013828 80012C28 85292FCC */ lh $t1, %lo(D_80162FCC)($t1) -/* 01382C 80012C2C 24010005 */ li $at, 5 -/* 013830 80012C30 0121001A */ div $zero, $t1, $at -/* 013834 80012C34 00005010 */ mfhi $t2 -/* 013838 80012C38 5540001A */ bnel $t2, $zero, .L80012CA4 -/* 01383C 80012C3C 866D0024 */ lh $t5, 0x24($s3) -/* 013840 80012C40 50400018 */ beql $v0, $zero, .L80012CA4 -/* 013844 80012C44 866D0024 */ lh $t5, 0x24($s3) -/* 013848 80012C48 C6700004 */ lwc1 $f16, 4($s3) -/* 01384C 80012C4C C6720008 */ lwc1 $f18, 8($s3) -/* 013850 80012C50 C66A000C */ lwc1 $f10, 0xc($s3) -/* 013854 80012C54 E7B00090 */ swc1 $f16, 0x90($sp) -/* 013858 80012C58 46009121 */ cvt.d.s $f4, $f18 -/* 01385C 80012C5C 46005421 */ cvt.d.s $f16, $f10 -/* 013860 80012C60 46382180 */ add.d $f6, $f4, $f24 -/* 013864 80012C64 00113400 */ sll $a2, $s1, 0x10 -/* 013868 80012C68 00066403 */ sra $t4, $a2, 0x10 -/* 01386C 80012C6C 463A8480 */ add.d $f18, $f16, $f26 -/* 013870 80012C70 01803025 */ move $a2, $t4 -/* 013874 80012C74 27A40090 */ addiu $a0, $sp, 0x90 -/* 013878 80012C78 46203220 */ cvt.s.d $f8, $f6 -/* 01387C 80012C7C 02C02825 */ move $a1, $s6 -/* 013880 80012C80 46209120 */ cvt.s.d $f4, $f18 -/* 013884 80012C84 E7A80094 */ swc1 $f8, 0x94($sp) -/* 013888 80012C88 0C001845 */ jal func_80006114 -/* 01388C 80012C8C E7A40098 */ swc1 $f4, 0x98($sp) -/* 013890 80012C90 4406F000 */ mfc1 $a2, $f30 -/* 013894 80012C94 02E02025 */ move $a0, $s7 -/* 013898 80012C98 0C01D57F */ jal func_800755FC -/* 01389C 80012C9C 27A50090 */ addiu $a1, $sp, 0x90 -/* 0138A0 80012CA0 866D0024 */ lh $t5, 0x24($s3) -.L80012CA4: -/* 0138A4 80012CA4 26700024 */ addiu $s0, $s3, 0x24 -/* 0138A8 80012CA8 26040004 */ addiu $a0, $s0, 4 -/* 0138AC 80012CAC 168D0010 */ bne $s4, $t5, .L80012CF0 -/* 0138B0 80012CB0 2605001C */ addiu $a1, $s0, 0x1c -/* 0138B4 80012CB4 C6140004 */ lwc1 $f20, 4($s0) -/* 0138B8 80012CB8 C616000C */ lwc1 $f22, 0xc($s0) -/* 0138BC 80012CBC 0C0036EB */ jal func_8000DBAC -/* 0138C0 80012CC0 8E6600FC */ lw $a2, 0xfc($s3) -/* 0138C4 80012CC4 C6060004 */ lwc1 $f6, 4($s0) -/* 0138C8 80012CC8 C60A000C */ lwc1 $f10, 0xc($s0) -/* 0138CC 80012CCC 00022C00 */ sll $a1, $v0, 0x10 -/* 0138D0 80012CD0 46143201 */ sub.s $f8, $f6, $f20 -/* 0138D4 80012CD4 00057403 */ sra $t6, $a1, 0x10 -/* 0138D8 80012CD8 01C02825 */ move $a1, $t6 -/* 0138DC 80012CDC 46165401 */ sub.s $f16, $f10, $f22 -/* 0138E0 80012CE0 E6080010 */ swc1 $f8, 0x10($s0) -/* 0138E4 80012CE4 02002025 */ move $a0, $s0 -/* 0138E8 80012CE8 0C004A92 */ jal func_80012A48 -/* 0138EC 80012CEC E6100018 */ swc1 $f16, 0x18($s0) -.L80012CF0: -/* 0138F0 80012CF0 00009025 */ move $s2, $zero -/* 0138F4 80012CF4 8FB1007C */ lw $s1, 0x7c($sp) -.L80012CF8: -/* 0138F8 80012CF8 862F0048 */ lh $t7, 0x48($s1) -/* 0138FC 80012CFC 26300048 */ addiu $s0, $s1, 0x48 -/* 013900 80012D00 26040004 */ addiu $a0, $s0, 4 -/* 013904 80012D04 168F0010 */ bne $s4, $t7, .L80012D48 -/* 013908 80012D08 2605001C */ addiu $a1, $s0, 0x1c -/* 01390C 80012D0C C6140004 */ lwc1 $f20, 4($s0) -/* 013910 80012D10 C616000C */ lwc1 $f22, 0xc($s0) -/* 013914 80012D14 0C0036EB */ jal func_8000DBAC -/* 013918 80012D18 8E6600FC */ lw $a2, 0xfc($s3) -/* 01391C 80012D1C C6120004 */ lwc1 $f18, 4($s0) -/* 013920 80012D20 C606000C */ lwc1 $f6, 0xc($s0) -/* 013924 80012D24 00022C00 */ sll $a1, $v0, 0x10 -/* 013928 80012D28 46149101 */ sub.s $f4, $f18, $f20 -/* 01392C 80012D2C 0005C403 */ sra $t8, $a1, 0x10 -/* 013930 80012D30 03002825 */ move $a1, $t8 -/* 013934 80012D34 46163201 */ sub.s $f8, $f6, $f22 -/* 013938 80012D38 E6040010 */ swc1 $f4, 0x10($s0) -/* 01393C 80012D3C 02002025 */ move $a0, $s0 -/* 013940 80012D40 0C004A92 */ jal func_80012A48 -/* 013944 80012D44 E6080018 */ swc1 $f8, 0x18($s0) -.L80012D48: -/* 013948 80012D48 26520024 */ addiu $s2, $s2, 0x24 -/* 01394C 80012D4C 1655FFEA */ bne $s2, $s5, .L80012CF8 -/* 013950 80012D50 26310024 */ addiu $s1, $s1, 0x24 -/* 013954 80012D54 8FB9007C */ lw $t9, 0x7c($sp) -/* 013958 80012D58 26F70001 */ addiu $s7, $s7, 1 -/* 01395C 80012D5C 24010002 */ li $at, 2 -/* 013960 80012D60 2728010C */ addiu $t0, $t9, 0x10c -/* 013964 80012D64 AFA8007C */ sw $t0, 0x7c($sp) -/* 013968 80012D68 2673010C */ addiu $s3, $s3, 0x10c -/* 01396C 80012D6C 26D6010C */ addiu $s6, $s6, 0x10c -/* 013970 80012D70 16E1FF7C */ bne $s7, $at, .L80012B64 -/* 013974 80012D74 27DE010C */ addiu $fp, $fp, 0x10c -/* 013978 80012D78 8FBF006C */ lw $ra, 0x6c($sp) -/* 01397C 80012D7C D7B40018 */ ldc1 $f20, 0x18($sp) -/* 013980 80012D80 D7B60020 */ ldc1 $f22, 0x20($sp) -/* 013984 80012D84 D7B80028 */ ldc1 $f24, 0x28($sp) -/* 013988 80012D88 D7BA0030 */ ldc1 $f26, 0x30($sp) -/* 01398C 80012D8C D7BC0038 */ ldc1 $f28, 0x38($sp) -/* 013990 80012D90 D7BE0040 */ ldc1 $f30, 0x40($sp) -/* 013994 80012D94 8FB00048 */ lw $s0, 0x48($sp) -/* 013998 80012D98 8FB1004C */ lw $s1, 0x4c($sp) -/* 01399C 80012D9C 8FB20050 */ lw $s2, 0x50($sp) -/* 0139A0 80012DA0 8FB30054 */ lw $s3, 0x54($sp) -/* 0139A4 80012DA4 8FB40058 */ lw $s4, 0x58($sp) -/* 0139A8 80012DA8 8FB5005C */ lw $s5, 0x5c($sp) -/* 0139AC 80012DAC 8FB60060 */ lw $s6, 0x60($sp) -/* 0139B0 80012DB0 8FB70064 */ lw $s7, 0x64($sp) -/* 0139B4 80012DB4 8FBE0068 */ lw $fp, 0x68($sp) -/* 0139B8 80012DB8 03E00008 */ jr $ra -/* 0139BC 80012DBC 27BD00C0 */ addiu $sp, $sp, 0xc0 diff --git a/asm/non_matchings/code_80005FD0/func_80013054.s b/asm/non_matchings/code_80005FD0/func_80013054.s deleted file mode 100644 index af0eeba0b..000000000 --- a/asm/non_matchings/code_80005FD0/func_80013054.s +++ /dev/null @@ -1,126 +0,0 @@ -.section .late_rodata - -glabel D_800ED100 -.float 0.42299348 -.word 0x00000000 - -glabel D_800ED108 -.double 0.1 - -glabel D_800ED110 -.float 0.72017353 -.word 0x00000000 - -glabel D_800ED118 -.double 0.1 - -glabel D_800ED120 -.double 0.01 - -.section .text - -glabel func_80013054 -/* 013C54 80013054 3C048016 */ lui $a0, %hi(D_801637B8) # $a0, 0x8016 -/* 013C58 80013058 248437B8 */ addiu $a0, %lo(D_801637B8) # addiu $a0, $a0, 0x37b8 -/* 013C5C 8001305C A4800000 */ sh $zero, ($a0) -/* 013C60 80013060 A4800002 */ sh $zero, 2($a0) -/* 013C64 80013064 3C01800F */ lui $at, %hi(D_800ED100) # $at, 0x800f -/* 013C68 80013068 C430D100 */ lwc1 $f16, %lo(D_800ED100)($at) -/* 013C6C 8001306C 3C01800F */ lui $at, %hi(D_800ED108) -/* 013C70 80013070 D42AD108 */ ldc1 $f10, %lo(D_800ED108)($at) -/* 013C74 80013074 3C0E8016 */ lui $t6, %hi(D_8016359C) # $t6, 0x8016 -/* 013C78 80013078 8DCE359C */ lw $t6, %lo(D_8016359C)($t6) -/* 013C7C 8001307C 3C01800F */ lui $at, %hi(D_800ED110) # $at, 0x800f -/* 013C80 80013080 C428D110 */ lwc1 $f8, %lo(D_800ED110)($at) -/* 013C84 80013084 448E3000 */ mtc1 $t6, $f6 -/* 013C88 80013088 46008321 */ cvt.d.s $f12, $f16 -/* 013C8C 8001308C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 013C90 80013090 468030A0 */ cvt.s.w $f2, $f6 -/* 013C94 80013094 3C01800F */ lui $at, %hi(D_800ED118) -/* 013C98 80013098 D426D118 */ ldc1 $f6, %lo(D_800ED118)($at) -/* 013C9C 8001309C F7B60010 */ sdc1 $f22, 0x10($sp) -/* 013CA0 800130A0 F7B40008 */ sdc1 $f20, 8($sp) -/* 013CA4 800130A4 462A6381 */ sub.d $f14, $f12, $f10 -/* 013CA8 800130A8 3C038016 */ lui $v1, %hi(D_801635A0) # $v1, 0x8016 -/* 013CAC 800130AC 3C01800F */ lui $at, %hi(D_800ED120) -/* 013CB0 800130B0 460044A1 */ cvt.d.s $f18, $f8 -/* 013CB4 800130B4 D436D120 */ ldc1 $f22, %lo(D_800ED120)($at) -/* 013CB8 800130B8 46269501 */ sub.d $f20, $f18, $f6 -/* 013CBC 800130BC 3C058016 */ lui $a1, %hi(D_801637B8) # $a1, 0x8016 -/* 013CC0 800130C0 246335A0 */ addiu $v1, %lo(D_801635A0) # addiu $v1, $v1, 0x35a0 -/* 013CC4 800130C4 24A537B8 */ addiu $a1, %lo(D_801637B8) # addiu $a1, $a1, 0x37b8 -/* 013CC8 800130C8 24020001 */ li $v0, 1 -/* 013CCC 800130CC 946F001C */ lhu $t7, 0x1c($v1) -.L800130D0: -/* 013CD0 800130D0 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 013CD4 800130D4 448F3000 */ mtc1 $t7, $f6 -/* 013CD8 800130D8 05E10004 */ bgez $t7, .L800130EC -/* 013CDC 800130DC 46803220 */ cvt.s.w $f8, $f6 -/* 013CE0 800130E0 44815000 */ mtc1 $at, $f10 -/* 013CE4 800130E4 00000000 */ nop -/* 013CE8 800130E8 460A4200 */ add.s $f8, $f8, $f10 -.L800130EC: -/* 013CEC 800130EC 46024003 */ div.s $f0, $f8, $f2 -/* 013CF0 800130F0 46000421 */ cvt.d.s $f16, $f0 -/* 013CF4 800130F4 4630703C */ c.lt.d $f14, $f16 -/* 013CF8 800130F8 00000000 */ nop -/* 013CFC 800130FC 4502000E */ bc1fl .L80013138 -/* 013D00 80013100 4630A03C */ c.lt.d $f20, $f16 -/* 013D04 80013104 8C780104 */ lw $t8, 0x104($v1) -/* 013D08 80013108 46366200 */ add.d $f8, $f12, $f22 -/* 013D0C 8001310C 44982000 */ mtc1 $t8, $f4 -/* 013D10 80013110 00000000 */ nop -/* 013D14 80013114 468021A1 */ cvt.d.w $f6, $f4 -/* 013D18 80013118 46363282 */ mul.d $f10, $f6, $f22 -/* 013D1C 8001311C 46285100 */ add.d $f4, $f10, $f8 -/* 013D20 80013120 4624803C */ c.lt.d $f16, $f4 -/* 013D24 80013124 00000000 */ nop -/* 013D28 80013128 45020003 */ bc1fl .L80013138 -/* 013D2C 8001312C 4630A03C */ c.lt.d $f20, $f16 -/* 013D30 80013130 A4820000 */ sh $v0, ($a0) -/* 013D34 80013134 4630A03C */ c.lt.d $f20, $f16 -.L80013138: -/* 013D38 80013138 00000000 */ nop -/* 013D3C 8001313C 4502000E */ bc1fl .L80013178 -/* 013D40 80013140 2463010C */ addiu $v1, $v1, 0x10c -/* 013D44 80013144 8C790104 */ lw $t9, 0x104($v1) -/* 013D48 80013148 46369100 */ add.d $f4, $f18, $f22 -/* 013D4C 8001314C 44993000 */ mtc1 $t9, $f6 -/* 013D50 80013150 00000000 */ nop -/* 013D54 80013154 468032A1 */ cvt.d.w $f10, $f6 -/* 013D58 80013158 46365202 */ mul.d $f8, $f10, $f22 -/* 013D5C 8001315C 46244180 */ add.d $f6, $f8, $f4 -/* 013D60 80013160 4626803C */ c.lt.d $f16, $f6 -/* 013D64 80013164 00000000 */ nop -/* 013D68 80013168 45020003 */ bc1fl .L80013178 -/* 013D6C 8001316C 2463010C */ addiu $v1, $v1, 0x10c -/* 013D70 80013170 A4820002 */ sh $v0, 2($a0) -/* 013D74 80013174 2463010C */ addiu $v1, $v1, 0x10c -.L80013178: -/* 013D78 80013178 0065082B */ sltu $at, $v1, $a1 -/* 013D7C 8001317C 5420FFD4 */ bnel $at, $zero, .L800130D0 -/* 013D80 80013180 946F001C */ lhu $t7, 0x1c($v1) -/* 013D84 80013184 3C038016 */ lui $v1, %hi(D_801637B8) # $v1, 0x8016 -/* 013D88 80013188 3C048016 */ lui $a0, %hi(D_801637BC) # $a0, 0x8016 -/* 013D8C 8001318C 3C058016 */ lui $a1, %hi(D_801637C0) # $a1, 0x8016 -/* 013D90 80013190 24A537C0 */ addiu $a1, %lo(D_801637C0) # addiu $a1, $a1, 0x37c0 -/* 013D94 80013194 248437BC */ addiu $a0, %lo(D_801637BC) # addiu $a0, $a0, 0x37bc -/* 013D98 80013198 246337B8 */ addiu $v1, %lo(D_801637B8) # addiu $v1, $v1, 0x37b8 -/* 013D9C 8001319C 24020001 */ li $v0, 1 -.L800131A0: -/* 013DA0 800131A0 94680000 */ lhu $t0, ($v1) -/* 013DA4 800131A4 54480006 */ bnel $v0, $t0, .L800131C0 -/* 013DA8 800131A8 A4800000 */ sh $zero, ($a0) -/* 013DAC 800131AC 94890000 */ lhu $t1, ($a0) -/* 013DB0 800131B0 252A0001 */ addiu $t2, $t1, 1 -/* 013DB4 800131B4 10000002 */ b .L800131C0 -/* 013DB8 800131B8 A48A0000 */ sh $t2, ($a0) -/* 013DBC 800131BC A4800000 */ sh $zero, ($a0) -.L800131C0: -/* 013DC0 800131C0 24840002 */ addiu $a0, $a0, 2 -/* 013DC4 800131C4 1485FFF6 */ bne $a0, $a1, .L800131A0 -/* 013DC8 800131C8 24630002 */ addiu $v1, $v1, 2 -/* 013DCC 800131CC D7B40008 */ ldc1 $f20, 8($sp) -/* 013DD0 800131D0 D7B60010 */ ldc1 $f22, 0x10($sp) -/* 013DD4 800131D4 03E00008 */ jr $ra -/* 013DD8 800131D8 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/non_matchings/code_80005FD0/func_800131DC.s b/asm/non_matchings/code_80005FD0/func_800131DC.s deleted file mode 100644 index 8c3e098c0..000000000 --- a/asm/non_matchings/code_80005FD0/func_800131DC.s +++ /dev/null @@ -1,76 +0,0 @@ -glabel func_800131DC -/* 013DDC 800131DC 3C0E8016 */ lui $t6, %hi(D_801634D8) # $t6, 0x8016 -/* 013DE0 800131E0 25CE34D8 */ addiu $t6, %lo(D_801634D8) # addiu $t6, $t6, 0x34d8 -/* 013DE4 800131E4 00041040 */ sll $v0, $a0, 1 -/* 013DE8 800131E8 004E1821 */ addu $v1, $v0, $t6 -/* 013DEC 800131EC A4600000 */ sh $zero, ($v1) -/* 013DF0 800131F0 3C0F800E */ lui $t7, %hi(gCurrentCourseId) -/* 013DF4 800131F4 85EFC5A0 */ lh $t7, %lo(gCurrentCourseId)($t7) -/* 013DF8 800131F8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 013DFC 800131FC 2401000B */ li $at, 11 -/* 013E00 80013200 15E10038 */ bne $t7, $at, .L800132E4 -/* 013E04 80013204 AFBF0014 */ sw $ra, 0x14($sp) -/* 013E08 80013208 3C188016 */ lui $t8, %hi(D_801631E0) # 0x8016 -/* 013E0C 8001320C 0302C021 */ addu $t8, $t8, $v0 -/* 013E10 80013210 971831E0 */ lhu $t8, %lo(D_801631E0)($t8) # 0x31e0($t8) -/* 013E14 80013214 0004C8C0 */ sll $t9, $a0, 3 -/* 013E18 80013218 0324C823 */ subu $t9, $t9, $a0 -/* 013E1C 8001321C 1300000F */ beqz $t8, .L8001325C -/* 013E20 80013220 0019C900 */ sll $t9, $t9, 4 -/* 013E24 80013224 0324C823 */ subu $t9, $t9, $a0 -/* 013E28 80013228 0019C880 */ sll $t9, $t9, 2 -/* 013E2C 8001322C 0324C823 */ subu $t9, $t9, $a0 -/* 013E30 80013230 0019C8C0 */ sll $t9, $t9, 3 -/* 013E34 80013234 3C09800F */ lui $t1, %hi(gPlayers) # $t1, 0x800f -/* 013E38 80013238 25296990 */ addiu $t1, %lo(gPlayers) # addiu $t1, $t1, 0x6990 -/* 013E3C 8001323C 27280014 */ addiu $t0, $t9, 0x14 -/* 013E40 80013240 01092021 */ addu $a0, $t0, $t1 -/* 013E44 80013244 3C05447A */ lui $a1, 0x447a -/* 013E48 80013248 00003025 */ move $a2, $zero -/* 013E4C 8001324C 0C001877 */ jal func_800061DC -/* 013E50 80013250 AFA30018 */ sw $v1, 0x18($sp) -/* 013E54 80013254 10400023 */ beqz $v0, .L800132E4 -/* 013E58 80013258 8FA30018 */ lw $v1, 0x18($sp) -.L8001325C: -/* 013E5C 8001325C 3C058016 */ lui $a1, %hi(D_801637B8) # $a1, 0x8016 -/* 013E60 80013260 24A537B8 */ addiu $a1, %lo(D_801637B8) # addiu $a1, $a1, 0x37b8 -/* 013E64 80013264 94AA0002 */ lhu $t2, 2($a1) -/* 013E68 80013268 24040001 */ li $a0, 1 -/* 013E6C 8001326C 3C0B8016 */ lui $t3, %hi(D_801637BE) # $t3, 0x8016 -/* 013E70 80013270 148A000D */ bne $a0, $t2, .L800132A8 -/* 013E74 80013274 3C0D8016 */ lui $t5, %hi(D_801637BC) # $t5, 0x8016 -/* 013E78 80013278 956B37BE */ lhu $t3, %lo(D_801637BE)($t3) -/* 013E7C 8001327C 3C028016 */ lui $v0, %hi(D_80162FCE) # $v0, 0x8016 -/* 013E80 80013280 296100F1 */ slti $at, $t3, 0xf1 -/* 013E84 80013284 54200009 */ bnel $at, $zero, .L800132AC -/* 013E88 80013288 94AC0000 */ lhu $t4, ($a1) -/* 013E8C 8001328C 84422FCE */ lh $v0, %lo(D_80162FCE)($v0) -/* 013E90 80013290 284100B1 */ slti $at, $v0, 0xb1 -/* 013E94 80013294 14200004 */ bnez $at, .L800132A8 -/* 013E98 80013298 284100B6 */ slti $at, $v0, 0xb6 -/* 013E9C 8001329C 50200003 */ beql $at, $zero, .L800132AC -/* 013EA0 800132A0 94AC0000 */ lhu $t4, ($a1) -/* 013EA4 800132A4 A4640000 */ sh $a0, ($v1) -.L800132A8: -/* 013EA8 800132A8 94AC0000 */ lhu $t4, ($a1) -.L800132AC: -/* 013EAC 800132AC 548C000E */ bnel $a0, $t4, .L800132E8 -/* 013EB0 800132B0 8FBF0014 */ lw $ra, 0x14($sp) -/* 013EB4 800132B4 95AD37BC */ lhu $t5, %lo(D_801637BC)($t5) -/* 013EB8 800132B8 3C028016 */ lui $v0, %hi(D_80162FCE) # $v0, 0x8016 -/* 013EBC 800132BC 29A100F1 */ slti $at, $t5, 0xf1 -/* 013EC0 800132C0 54200009 */ bnel $at, $zero, .L800132E8 -/* 013EC4 800132C4 8FBF0014 */ lw $ra, 0x14($sp) -/* 013EC8 800132C8 84422FCE */ lh $v0, %lo(D_80162FCE)($v0) -/* 013ECC 800132CC 28410132 */ slti $at, $v0, 0x132 -/* 013ED0 800132D0 14200004 */ bnez $at, .L800132E4 -/* 013ED4 800132D4 28410136 */ slti $at, $v0, 0x136 -/* 013ED8 800132D8 50200003 */ beql $at, $zero, .L800132E8 -/* 013EDC 800132DC 8FBF0014 */ lw $ra, 0x14($sp) -/* 013EE0 800132E0 A4640000 */ sh $a0, ($v1) -.L800132E4: -/* 013EE4 800132E4 8FBF0014 */ lw $ra, 0x14($sp) -.L800132E8: -/* 013EE8 800132E8 27BD0020 */ addiu $sp, $sp, 0x20 -/* 013EEC 800132EC 03E00008 */ jr $ra -/* 013EF0 800132F0 00000000 */ nop diff --git a/include/segment_symbols.h b/include/segment_symbols.h index c65aad3fc..372f16ef6 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -3,12 +3,12 @@ extern u8 _mainSegNoloadEnd[]; -extern u8 _code_80280000SegmentStart[]; -extern u8 _code_80280000SegmentRomStart[]; -extern u8 _code_80280000SegmentRomEnd[]; +extern u8 _endingSequencesSegmentStart[]; +extern u8 _endingSequencesSegmentRomStart[]; +extern u8 _endingSequencesSegmentRomEnd[]; -extern u8 _code_8028DF00SegmentStart[]; -extern u8 _code_8028DF00SegmentRomStart[]; -extern u8 _code_8028DF00SegmentRomEnd[]; +extern u8 _racingSegmentStart[]; +extern u8 _racingSegmentRomStart[]; +extern u8 _racingSegmentRomEnd[]; #endif diff --git a/include/segments.h b/include/segments.h index 8ce0fece9..f33243006 100644 --- a/include/segments.h +++ b/include/segments.h @@ -3,8 +3,8 @@ #define SEG_START 0x80000000 #define SEG_MAIN 0x80000400 -#define SEG_80280000 0x80280000 -#define SEG_8028DF00 0x8028DF00 +#define SEG_ENDING_SEQUENCES 0x80280000 +#define SEG_RACING 0x8028DF00 #define SEG_FRAMEBUFFERS 0x802BA290 #define SEG_802BA370 0x802BA370 #define SEG_AUDIO 0x803AF780 diff --git a/include/vehicles.h b/include/vehicles.h index e3e142fd1..65b71a4e2 100644 --- a/include/vehicles.h +++ b/include/vehicles.h @@ -25,7 +25,7 @@ typedef struct { /* 0x02 */ s16 compilerPadding; /* 0x04 */ Vec3f position; /* 0x10 */ Vec3f velocity; - /* 0x1C */ s16 wayPointIndex; + /* 0x1C */ u16 wayPointIndex; /* 0x1E */ s16 actorIndex; /* 0x20 */ s32 unused; // Not read or written. Could be padding? } TrainCarStuff; // size = 0x24; @@ -78,7 +78,7 @@ typedef struct { /* 0x32 */ // s16 compilerPadding2; } VehicleStuff; // size = 0x34 -extern TrainStuff D_801635A0[]; +extern TrainStuff sTrains[]; // This is an array, maybe they intended to have multiple boats at some point in development? extern PaddleWheelBoatStuff D_801637C0[]; diff --git a/mk64.ld b/mk64.ld index 856ab4ea1..75574dfd5 100644 --- a/mk64.ld +++ b/mk64.ld @@ -376,40 +376,40 @@ SECTIONS END_NOLOAD(main) /* 0x8028DF00 0F7510-123640 [2C130] */ - BEGIN_SEG(code_8028DF00, SEG_8028DF00) + BEGIN_SEG(racing, SEG_RACING) { - BUILD_DIR/src/race_logic.o(.text); - BUILD_DIR/src/render_courses.o(.text); - BUILD_DIR/src/actors.o(.text); - BUILD_DIR/src/skybox_and_splitscreen.o(.text); - BUILD_DIR/src/memory.o(.text); - BUILD_DIR/src/collision.o(.text); - BUILD_DIR/src/actors_extended.o(.text); - BUILD_DIR/src/math_util.o(.text); - BUILD_DIR/src/race_logic.o(.data); - BUILD_DIR/src/render_courses.o(.data); - BUILD_DIR/src/actors.o(.data); - BUILD_DIR/src/skybox_and_splitscreen.o(.data); - BUILD_DIR/src/memory.o(.data); + BUILD_DIR/src/racing/race_logic.o(.text); + BUILD_DIR/src/racing/render_courses.o(.text); + BUILD_DIR/src/racing/actors.o(.text); + BUILD_DIR/src/racing/skybox_and_splitscreen.o(.text); + BUILD_DIR/src/racing/memory.o(.text); + BUILD_DIR/src/racing/collision.o(.text); + BUILD_DIR/src/racing/actors_extended.o(.text); + BUILD_DIR/src/racing/math_util.o(.text); + BUILD_DIR/src/racing/race_logic.o(.data); + BUILD_DIR/src/racing/render_courses.o(.data); + BUILD_DIR/src/racing/actors.o(.data); + BUILD_DIR/src/racing/skybox_and_splitscreen.o(.data); + BUILD_DIR/src/racing/memory.o(.data); BUILD_DIR/courses/courseTable.inc.o(.data); - BUILD_DIR/src/actors_extended.o(.data); - BUILD_DIR/src/math_util.o(.data); - BUILD_DIR/src/race_logic.o(.rodata); - BUILD_DIR/src/render_courses.o(.rodata); - BUILD_DIR/src/actors.o(.rodata); - BUILD_DIR/src/skybox_and_splitscreen.o(.rodata); - BUILD_DIR/src/memory.o(.rodata); - BUILD_DIR/src/collision.o(.rodata); - BUILD_DIR/src/actors_extended.o(.rodata); - BUILD_DIR/src/math_util.o(.rodata); + BUILD_DIR/src/racing/actors_extended.o(.data); + BUILD_DIR/src/racing/math_util.o(.data); + BUILD_DIR/src/racing/race_logic.o(.rodata); + BUILD_DIR/src/racing/render_courses.o(.rodata); + BUILD_DIR/src/racing/actors.o(.rodata); + BUILD_DIR/src/racing/skybox_and_splitscreen.o(.rodata); + BUILD_DIR/src/racing/memory.o(.rodata); + BUILD_DIR/src/racing/collision.o(.rodata); + BUILD_DIR/src/racing/actors_extended.o(.rodata); + BUILD_DIR/src/racing/math_util.o(.rodata); } - END_SEG(code_8028DF00) + END_SEG(racing) - BEGIN_NOLOAD(code_8028DF00) + BEGIN_NOLOAD(racing) { - BUILD_DIR/src/race_logic.o(.bss); - BUILD_DIR/src/actors.o(.bss); - BUILD_DIR/src/memory.o(.bss); + BUILD_DIR/src/racing/race_logic.o(.bss); + BUILD_DIR/src/racing/actors.o(.bss); + BUILD_DIR/src/racing/memory.o(.bss); BUILD_DIR/src/framebuffers.o(.bss*); BUILD_DIR/src/audio/synthesis.o(.bss*); BUILD_DIR/src/audio/heap.o(.bss*); @@ -417,46 +417,46 @@ SECTIONS BUILD_DIR/src/audio/data.o(.bss); . = ALIGN(0x8); } - END_NOLOAD(code_8028DF00) + END_NOLOAD(racing) - _code_8028DF00SegmentNoloadSize = SIZEOF(.code_8028DF00.noload) + 0x10; + _racingSegmentNoloadSize = SIZEOF(.racing.noload) + 0x10; - _code_8028DF00SegmentNoloadSizeHi = _code_8028DF00SegmentNoloadSize >> 16; - _code_8028DF00SegmentNoloadSizeLo = _code_8028DF00SegmentNoloadSize & 0xFFFF; + _racingSegmentNoloadSizeHi = _racingSegmentNoloadSize >> 16; + _racingSegmentNoloadSizeLo = _racingSegmentNoloadSize & 0xFFFF; /* 0x80280000 123640-12AAE0 [74A0] */ - BEGIN_SEG(code_80280000, SEG_80280000) + BEGIN_SEG(endingSequences, SEG_ENDING_SEQUENCES) { - BUILD_DIR/src/code_80280000.o(.text); - BUILD_DIR/src/podium_ceremony_actors.o(.text); - BUILD_DIR/src/camera_junk.o(.text); - BUILD_DIR/src/code_80281780.o(.text); - BUILD_DIR/src/code_80281C40.o(.text); - BUILD_DIR/src/ceremony_and_credits.o(.text); - BUILD_DIR/src/podium_ceremony_actors.o(.data); - BUILD_DIR/src/code_80281780.o(.data); - BUILD_DIR/src/dl_unk_80284EE0.inc.o(.data); - BUILD_DIR/src/credits.jp.o(.data); - BUILD_DIR/src/ceremony_and_credits.o(.data); - BUILD_DIR/src/podium_ceremony_actors.o(.rodata); - BUILD_DIR/src/camera_junk.o(.rodata); - BUILD_DIR/src/credits.jp.o(.rodata); - BUILD_DIR/src/ceremony_and_credits.o(.rodata); + BUILD_DIR/src/ending/code_80280000.o(.text); + BUILD_DIR/src/ending/podium_ceremony_actors.o(.text); + BUILD_DIR/src/ending/camera_junk.o(.text); + BUILD_DIR/src/ending/code_80281780.o(.text); + BUILD_DIR/src/ending/code_80281C40.o(.text); + BUILD_DIR/src/ending/ceremony_and_credits.o(.text); + BUILD_DIR/src/ending/podium_ceremony_actors.o(.data); + BUILD_DIR/src/ending/code_80281780.o(.data); + BUILD_DIR/src/ending/dl_unk_80284EE0.inc.o(.data); + BUILD_DIR/src/ending/credits.jp.o(.data); + BUILD_DIR/src/ending/ceremony_and_credits.o(.data); + BUILD_DIR/src/ending/podium_ceremony_actors.o(.rodata); + BUILD_DIR/src/ending/camera_junk.o(.rodata); + BUILD_DIR/src/ending/credits.jp.o(.rodata); + BUILD_DIR/src/ending/ceremony_and_credits.o(.rodata); } - END_SEG(code_80280000) + END_SEG(endingSequences) - BEGIN_NOLOAD(code_80280000) { - BUILD_DIR/src/code_80280000.o(.bss); - BUILD_DIR/src/podium_ceremony_actors.o(.bss); - BUILD_DIR/src/code_80281C40.o(.bss); - BUILD_DIR/src/ceremony_and_credits.o(.bss); + BEGIN_NOLOAD(endingSequences) { + BUILD_DIR/src/ending/code_80280000.o(.bss); + BUILD_DIR/src/ending/podium_ceremony_actors.o(.bss); + BUILD_DIR/src/ending/code_80281C40.o(.bss); + BUILD_DIR/src/ending/ceremony_and_credits.o(.bss); } - END_NOLOAD(code_80280000) + END_NOLOAD(endingSequences) - _code_80280000SegmentNoloadSize = SIZEOF(.code_80280000.noload) + 0x10; + _endingSequencesSegmentNoloadSize = SIZEOF(.endingSequences.noload) + 0x10; - _code_80280000SegmentNoloadSizeHi = _code_80280000SegmentNoloadSize >> 16; - _code_80280000SegmentNoloadSizeLo = _code_80280000SegmentNoloadSize & 0xFFFF; + _endingSequencesSegmentNoloadSizeHi = _endingSequencesSegmentNoloadSize >> 16; + _endingSequencesSegmentNoloadSizeLo = _endingSequencesSegmentNoloadSize & 0xFFFF; diff --git a/progress.py b/progress.py index 7a4cfce99..62b79ff98 100644 --- a/progress.py +++ b/progress.py @@ -162,14 +162,14 @@ mainSegFiles = [ "build/us/src/staff_ghosts", ] seg2Files = [ - "build/us/src/actors", - "build/us/src/actors_extended", - "build/us/src/math_util", - "build/us/src/memory", - "build/us/src/collision", - "build/us/src/race_logic", - "build/us/src/render_courses", - "build/us/src/skybox_and_splitscreen", + "build/us/src/racing/actors", + "build/us/src/racing/actors_extended", + "build/us/src/racing/math_util", + "build/us/src/racing/memory", + "build/us/src/racing/collision", + "build/us/src/racing/race_logic", + "build/us/src/racing/render_courses", + "build/us/src/racing/skybox_and_splitscreen", ] segAudioFiles = [ "build/us/src/audio/effects", @@ -279,7 +279,7 @@ if args.format == 'shield-json': elif args.format == 'totalBadge': print(str(round(((mk64Code_size - text_size) / mk64Code_size) * 100, 2))+"%") elif args.format == 'gameBadge': - print(str(round(((mk64Code_size - text_size) / (mk64Code_size - audio_size)) * 100, 2))+"%") + print(str(round((((mk64Code_size - audio_size) - (text_size - audio)) / (mk64Code_size - audio_size)) * 100, 2))+"%") elif args.format == 'audioBadge': print(str(round(audioPct, 2))+"%") elif args.format == 'bytesToDecompile': diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 0356473b7..ca6d4e547 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -535,17 +535,17 @@ void set_places(void) { s32 temp_a0; s32 var_t1_3; - switch (gModeSelection) { /* irregular */ - case BATTLE: - default: - return; // HEY! returns, not breaks - case GRAND_PRIX: - case TIME_TRIALS: - var_t4 = 8; - break; - case VERSUS: - var_t4 = D_8018EDF3; - break; + switch (gModeSelection) { + case BATTLE: + default: + return; // HEY! returns, not breaks + case GRAND_PRIX: + case TIME_TRIALS: + var_t4 = 8; + break; + case VERSUS: + var_t4 = D_8018EDF3; + break; } if (D_8016348C == 0) { @@ -623,17 +623,17 @@ void func_800070F4(void) { s32 var_a3; s32 var_a2; - switch (gModeSelection) { /* irregular */ - case BATTLE: - default: - return; // HEY! returns, not breaks - case GRAND_PRIX: - case TIME_TRIALS: - var_a2 = 8; - break; - case VERSUS: - var_a2 = D_8018EDF3; - break; + switch (gModeSelection) { + case BATTLE: + default: + return; // HEY! returns, not breaks + case GRAND_PRIX: + case TIME_TRIALS: + var_a2 = 8; + break; + case VERSUS: + var_a2 = D_8018EDF3; + break; } for (var_a3 = 0; var_a3 < var_a2; var_a3++) { @@ -1624,13 +1624,13 @@ void func_800097E0(void) { } switch(gCurrentCourseId) { - case 11: + case COURSE_KALAMARI_DESERT: func_80012AC0(); break; - case 18: + case COURSE_DK_JUNGLE: func_800133C4(); break; - case 10: + case COURSE_TOADS_TURNPIKE: func_8001487C(); func_800149D0(); func_80014B24(); @@ -4137,6 +4137,7 @@ extern uintptr_t *D_80163598; // An array of 21 items. The final element is for podium ceremony. extern struct _struct_D_800DD9D0_0x10 D_800DD9D0[]; +// Appears to allocate memory for each course. void func_8000F2DC(void) { struct _struct_D_800DD9D0_0x10 *ptr = &D_800DD9D0[gCurrentCourseId]; @@ -4176,7 +4177,7 @@ void func_8000F2DC(void) { func_8000F2BC(D_80164570[i], D_80163368[i]); } - // Skips several cpu cycles. + // Skip several cpu cycles. for (i = 0; i < 4; i++) {} for (i = 0; i < 4; i++) { @@ -4191,15 +4192,15 @@ void func_8000F2DC(void) { D_80164430 = *gWaypointCountByPathIndex; switch (gCurrentCourseId) { - case 11: + case COURSE_KALAMARI_DESERT: func_800120C8(); func_800127E0(); break; - case 18: + case COURSE_DK_JUNGLE: func_80012190(); func_800132F4(); break; - case 10: + case COURSE_TOADS_TURNPIKE: func_800147E0(); func_80014934(); func_80014A88(); @@ -4700,64 +4701,59 @@ void func_8000F628(void) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F628.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -u16 func_80011014(struct TrackWayPoint *, u16 *, s32, s32); /* extern */ -static ? D_800DC8D0; /* unable to generate initializer */ -static ? gCoursePathTable; /* unable to generate initializer */ -s16 gCurrentCourseId; /* unable to generate initializer */ +// dest src size pathIndex +u16 func_80011014(struct TrackWayPoint *, struct TrackWayPoint *, s32, s32); /* extern */ +extern uintptr_t gCoursePathTable[20][4]; +extern uintptr_t D_800DC8D0[20][4]; + +// @arg index from 0 to 3. + +// Processes course path by index. +// @arg index from 0 to 3. +// Each course can have 1-4 course paths. void func_800100F0(s32 pathIndex) { - struct TrackWayPoint *sp30; - u16 *sp2C; - s32 sp24; - s16 sp1A; - s16 temp_v0; - s16 var_a2; - s32 temp_t9; - s32 var_v0; - s32 var_v1; - u16 *temp_v0_2; - u16 *var_a0; - u16 *var_at; - temp_v0 = gCurrentCourseId; - temp_t9 = pathIndex * 4; - if ((s32) D_800DCA4C[temp_v0] >= 0) { - sp30 = D_80164550[pathIndex]; - if (temp_v0 != 0x0014) { - var_v0 = process_path_data(sp30, segmented_to_virtual_dupe_2(*(&D_800DC8D0 + ((temp_v0 * 0x10) + temp_t9)))); - var_at = &gWaypointCountByPathIndex[pathIndex]; - goto block_9; - } - sp1A = 1; - temp_v0_2 = segmented_to_virtual_dupe_2(*(&gCoursePathTable + ((temp_v0 * 0x10) + temp_t9))); - sp2C = temp_v0_2; - var_a0 = temp_v0_2; - var_a2 = 1; - var_v1 = 0; -loop_4: - if (*var_a0 == 0x8000) { - sp24 = var_v1 - 1; - var_a2 = 0; + struct TrackWayPoint *ptr; + struct TrackWayPoint *pathDest; + struct TrackWayPoint *path; + s32 var_v0; + s32 sp24; + s32 pad[2]; + s16 bInvalidPath; + s32 i; + + // cast required + if ((s32)D_800DCA4C[gCurrentCourseId] >= 0) { + pathDest = D_80164550[pathIndex]; + bInvalidPath = 1; + if (gCurrentCourseId != COURSE_AWARD_CEREMONY) { + var_v0 = process_path_data(pathDest, segmented_to_virtual_dupe_2(D_800DC8D0[gCurrentCourseId][pathIndex])); + gWaypointCountByPathIndex[pathIndex] = (u16) var_v0; } else { - var_v1 += 1; - var_a0 += 8; - if (var_v1 != 0xBB8) { - goto loop_4; + // Course path included in course_data which has already been loaded into memory. + // This is how we get the addr to our path data. + path = segmented_to_virtual_dupe_2(gCoursePathTable[gCurrentCourseId][pathIndex]); + ptr = path; + + for (i = 0; i < 3000; i++, ptr++) { + if ((u16)ptr->wayPointX == 0x8000 ) { + sp24 = i - 1; + bInvalidPath = 0; + break; + } + } + + // If path data higher than 3000 something has gone wrong. + // Skip processing the data. + // todo: Confirm this comment + if (!bInvalidPath) { + var_v0 = func_80011014(pathDest, path, sp24, pathIndex); + gWaypointCountByPathIndex[pathIndex] = (u16) var_v0; } - } - if (var_a2 == 0) { - var_v0 = func_80011014(sp30, sp2C, sp24, pathIndex); - var_at = &gWaypointCountByPathIndex[pathIndex]; -block_9: - *var_at = (u16) var_v0; } } } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800100F0.s") -#endif void func_80010218(s32 pathIndex) { f32 wayPointWidth; @@ -5180,6 +5176,7 @@ block_29: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011014.s") #endif +// Returns number of waypoints processed. s32 process_path_data(struct TrackWayPoint *dest, struct TrackWayPoint *src) { s16 temp_a0; s16 temp_a2; @@ -5214,6 +5211,7 @@ s32 process_path_data(struct TrackWayPoint *dest, struct TrackWayPoint *src) { //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 extern f64 D_800ED078; +// blank memory segmented waypoints waypoint size s32 func_8001168C(s16 *arg0, void *arg1, s32 arg2) { f32 spC8; f32 spC4; @@ -5599,39 +5597,30 @@ void func_80011EC0(s32 arg0, Player *player, s32 arg2, s32 arg3) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011EC0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_8001168C(void *, u16 *, s32); // extern -extern ? d_course_kalimari_desert_track_unknown_waypoints; extern s16 D_80162EB0; -extern void *D_80163598; extern s32 D_8016359C; -extern uintptr_t gSegmentTable; +f32 func_802AE1C0(f32, f32, f32); + +s32 func_8001168C(void *, struct TrackWayPoint *, s32); + void func_800120C8(void) { - void *sp18; - u16 *temp_a1; - void *temp_a0; - u16 *phi_v0; - s32 phi_v1; + s32 i; + s16 *temp; + struct TrackWayPoint *waypoint = (struct TrackWayPoint *) VIRTUAL_TO_PHYSICAL2( + gSegmentTable[SEGMENT_NUMBER2(d_course_kalimari_desert_track_unknown_waypoints)] + + SEGMENT_OFFSET(d_course_kalimari_desert_track_unknown_waypoints)); - temp_a1 = *(&gSegmentTable + ((&d_course_kalimari_desert_track_unknown_waypoints >> 0x18) * 4)) + (&d_course_kalimari_desert_track_unknown_waypoints & 0xFFFFFF) + 0x80000000; - phi_v0 = temp_a1; - phi_v1 = 0; -loop_1: - phi_v0 += 8; - if (*phi_v0 != 0x8000) { - phi_v1 += 1; - goto loop_1; + for (i = 0; ; i++) { + if ((u16)waypoint[i].wayPointX == 0x8000) { + break; + } } - temp_a0 = D_80163598; - sp18 = temp_a0; - D_8016359C = func_8001168C(temp_a0, temp_a1, phi_v1 - 1); - D_80162EB0 = func_802AE1C0(temp_a0->unk0, 2000.0f, temp_a0->unk2); + + temp = (s16 *)D_80163598; + D_8016359C = func_8001168C(temp , waypoint, i - 1); + D_80162EB0 = func_802AE1C0(temp[0], 2000.0f, temp[1]); } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800120C8.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -5706,20 +5695,20 @@ void func_800122D8(void) { switch (gCurrentCourseId) { case COURSE_KALAMARI_DESERT: for(loopIndex = 0; loopIndex < NUM_TRAINS; loopIndex++) { - tempLocomotive = &D_801635A0[loopIndex].locomotive; + tempLocomotive = &sTrains[loopIndex].locomotive; origXPos = tempLocomotive->position[0]; origZPos = tempLocomotive->position[2]; - trainCarYRot = func_8000DBAC(tempLocomotive->position, &tempLocomotive->wayPointIndex, D_801635A0[loopIndex].someMultiplier); + trainCarYRot = func_8000DBAC(tempLocomotive->position, &tempLocomotive->wayPointIndex, sTrains[loopIndex].someMultiplier); tempLocomotive->velocity[0] = tempLocomotive->position[0] - origXPos; tempLocomotive->velocity[2] = tempLocomotive->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); tempLocomotive->actorIndex = addActorToEmptySlot(tempLocomotive->position, trainCarRot, tempLocomotive->velocity, ACTOR_TRAIN_ENGINE); - tempTender = &D_801635A0[loopIndex].tender; + tempTender = &sTrains[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); + trainCarYRot = func_8000DBAC(tempTender->position, &tempTender->wayPointIndex, sTrains[loopIndex].someMultiplier); tempTender->velocity[0] = tempTender->position[0] - origXPos; tempTender->velocity[2] = tempTender->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5727,11 +5716,11 @@ void func_800122D8(void) { } for(loopIndex2 = 0; loopIndex2 < NUM_PASSENGER_CAR_ENTRIES; loopIndex2++) { - tempPassengerCar = &D_801635A0[loopIndex].passengerCars[loopIndex2]; + tempPassengerCar = &sTrains[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); + trainCarYRot = func_8000DBAC(tempPassengerCar->position, &tempPassengerCar->wayPointIndex, sTrains[loopIndex].someMultiplier); tempPassengerCar->velocity[0] = tempPassengerCar->position[0] - origXPos; tempPassengerCar->velocity[2] = tempPassengerCar->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5779,122 +5768,99 @@ void func_800122D8(void) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern s16 D_80162EB0; -// arg1 struct tbd -void func_80012780(TrainCarStuff *trainCar, void *arg1, s16 arg2) { - trainCar->position[0] = (f32) arg1->unk0; +void func_80012780(TrainCarStuff *trainCar, s16 *arg1, u16 arg2) { + trainCar->position[0] = (f32) arg1[0]; trainCar->position[1] = (f32) D_80162EB0; + trainCar->position[2] = (f32) arg1[1]; 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 m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80012780(TrainStuff *, s32, s32); /* extern */ +//void func_80012780(TrainStuff *, s32, s32); /* extern */ extern s16 D_80162FCC; -extern s32 D_80163598; +//extern s32 D_80163598 extern s32 D_8016359C; -extern TrainStuff D_801635C4; -extern s32 gScreenModeSelection; +//extern TrainStuff D_801635C4; +//extern s32 gScreenModeSelection; +// This is really Vec2s D_80163598[465] but that does not match. +// Likely because this is a shared pointer between courses. +extern uintptr_t *D_80163598; + +/** + * Set waypoint spawn locations for each rolling stock + * The railroad has 465 waypoints + */ void func_800127E0(void) { - 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; + u16 waypointOffset; + TrainCarStuff * ptr1; + s32 * ptr2; + s32 i; + s32 j; - sp4C = &D_801635C4; - var_s6 = D_801635A0; - var_s7 = D_801635A0; - var_fp = 0; - do { - temp_v0 = D_8016359C; - 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 = (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; + for (i = 0; i < 2; i++) { + // outputs 160 or 392 depending on the train + // Wraps the value around to always output a valid waypoint. + waypointOffset = (((i * D_8016359C) / 2) + 160) % D_8016359C; + // 120.0f is about the maximum usable value + sTrains[i].someMultiplier = 5.0f; + for (j = 0; j < 5; j++) { + waypointOffset += 4; + ptr1 = &sTrains[i].passengerCars[j]; + ptr2 = &D_80163598[waypointOffset]; + func_80012780(ptr1, ptr2, waypointOffset); } - 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(var_s6, (temp_t9 * 4) + D_80163598, temp_t9 & 0xFFFF); - var_fp += 1; - sp4C += 0x10C; - 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 { - 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; - 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; + // Smaller offset for the tender + waypointOffset += 3; + ptr1 = &sTrains[i].tender; + ptr2 = &D_80163598[waypointOffset]; + func_80012780(ptr1, ptr2, waypointOffset); + + waypointOffset += 4; + ptr1 = &sTrains[i].locomotive; + ptr2 = &D_80163598[waypointOffset]; + func_80012780(&sTrains[i].locomotive, ptr2, waypointOffset); + + sTrains[i].numCars = 0; } + + // Spawn all rolling stock in single player mode. + switch (gScreenModeSelection) { + case 0: // single player + for (i = 0; i < 2; i++) { + sTrains[i].tender.isActive = 1; + + // Same line required for matching... + for (j = 0; j < 5; j++) { sTrains[i].passengerCars[j].isActive = 1; } + + sTrains[i].numCars = 6; + } + break; + + // Spawn locomotive, tender, and one passenger car in versus 2/3 player mode. + case 1: // multiplayer fall-through + case 2: + if (gModeSelection != 0) { + for (i = 0; i < 2; i++) { + sTrains[i].tender.isActive = 1; + sTrains[i].passengerCars[4].isActive = 1; + sTrains[i].numCars = 2; + } + } + break; + + } + D_80162FCC = 0; } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800127E0.s") -#endif void func_80012A48(TrainCarStuff *trainCar, s16 arg1) { struct TrainCar *trainCarActor; @@ -5912,108 +5878,88 @@ void func_80012A48(TrainCarStuff *trainCar, s16 arg1) { trainCarActor->velocity[2] = trainCar->velocity[2]; } -#ifdef MIPS_TO_C +//#ifdef MIPS_TO_C //generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -s32 func_800755FC(s32, f32 *, f32); /* extern */ +s32 func_800755FC(s32, Vec3f, f32); /* extern */ +s16 func_800DBAC(Vec3f, Vec3s, f32); extern s16 D_80162FCC; -extern f32 D_801635A4; -extern s16 D_801635BC; +extern Vec3f D_801635A4; +extern Vec3s D_801635BC; + void func_80012AC0(void) { - f32 sp98; - f32 sp94; - f32 sp90; - TrainStuff *sp7C; - TrainCarStuff *temp_s0_2; - TrainCarStuff *temp_s0_3; - TrainStuff *var_s1; - TrainStuff *var_s3; - f32 *var_s6; + s32 pad[3]; f32 temp_f20; - f32 temp_f20_2; - f32 temp_f20_3; - f32 temp_f22; - f32 temp_f22_2; - f32 temp_f22_3; - s16 *var_fp; - s16 temp_a1; - s16 temp_a1_2; - s16 temp_s1; - s16 temp_t0; - s16 temp_v0; - s32 temp_v0_3; - s32 var_s2; - s32 var_s7; + TrainCarStuff *car; u16 temp_s0; - u16 temp_v0_2; + s16 temp_v0; + f32 temp_f22; + s32 i; + s32 j; + Vec3f sp90; D_80162FCC += 1; - var_s3 = D_801635A0; - var_fp = &D_801635BC; - var_s6 = &D_801635A4; - sp7C = D_801635A0; - var_s7 = 0; - do { - 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->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->locomotive, temp_t0); - 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->locomotive.velocity, 0x1901800EU); - } else if (random_int(0x0064U) == 0) { - func_800C98B8(var_s6, var_s3->locomotive.velocity, 0x1901800DU); + + for (i = 0; i < 2; i++) { + temp_s0 = (u16) sTrains[i].locomotive.wayPointIndex; + + temp_f20 = sTrains[i].locomotive.position[0]; + temp_f22 = sTrains[i].locomotive.position[2]; + + temp_v0 = func_8000DBAC(sTrains[i].locomotive.position, &sTrains[i].locomotive.wayPointIndex, sTrains[i].someMultiplier); + + sTrains[i].locomotive.velocity[0] = sTrains[i].locomotive.position[0] - temp_f20; + sTrains[i].locomotive.velocity[2] = sTrains[i].locomotive.position[2] - temp_f22; + + func_80012A48(&sTrains[i].locomotive, temp_v0); + //temp_v0_2 = (u16) sTrains[i].locomotive.wayPointIndex; + if ((temp_s0 != sTrains[i].locomotive.wayPointIndex) + && ((sTrains[i].locomotive.wayPointIndex == 0x00BE) + || (sTrains[i].locomotive.wayPointIndex == 0x0140))) { + func_800C98B8(sTrains[i].locomotive.position, sTrains[i].locomotive.velocity, 0x1901800E); + } else if (random_int(100) == 0) { + func_800C98B8(sTrains[i].locomotive.position, sTrains[i].locomotive.velocity, 0x1901800D); + //if ((sTrains && sTrains) && sTrains) {} } - 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->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_v0_3 = func_800061DC(&D_801635A4, 2000.0f, sTrains[i].someFlags); + sTrains[i].someFlags = func_800061DC(sTrains[i].locomotive.position, 2000.0f, sTrains[i].someFlags); + if ((((s16) D_80162FCC % 5) == 0) && (sTrains[i].someFlags != 0)) { + sp90[0] = sTrains[i].locomotive.position[0]; + sp90[1] = (f32) ((f64) sTrains[i].locomotive.position[1] + 65.0); + sp90[2] = (f32) ((f64) sTrains[i].locomotive.position[2] + 25.0); + func_80006114(sp90, sTrains[i].locomotive.position, temp_v0); + func_800755FC(i, sp90, 1.1f); } - 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(temp_s0_2, temp_a1); + + car = &sTrains[i].tender; + + if (car->isActive == 1) { + temp_f20 = car->position[0]; + temp_f22 = car->position[2]; + temp_v0 = func_8000DBAC(car->position, &car->wayPointIndex, sTrains[i].someMultiplier); + car->velocity[0] = car->position[0] - temp_f20; + car->velocity[2] = car->position[2] - temp_f22; + func_80012A48(car, temp_v0); } - var_s2 = 0; - var_s1 = sp7C; -loop_13: - 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(temp_s0_3, temp_a1_2); + + for (j = 0; j < 5; j++) { + car = &sTrains[i].passengerCars[j]; + if (car->isActive == 1) { + temp_f20 = car->position[0]; + temp_f22 = car->position[2]; + + temp_v0 = func_8000DBAC(car->position, &car->wayPointIndex, sTrains[i].someMultiplier); + car->velocity[0] = car->position[0] - temp_f20; + car->velocity[2] = car->position[2] - temp_f22; + func_80012A48(car, temp_v0); + } } - var_s2 += 0x24; - var_s1 += 0x24; - if (var_s2 != 0xB4) { - goto loop_13; - } - var_s7 += 1; - sp7C += 0x10C; - var_s3 += 0x10C; - var_s6 += 0x10C; - var_fp += 0x10C; - } while (var_s7 != 2); + } } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012AC0.s") -#endif + +//#else +//GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012AC0.s") +//#endif void func_80012DC0(s32 playerId, Player *player) { TrainCarStuff *trainCar; @@ -6029,7 +5975,7 @@ void func_80012DC0(s32 playerId, Player *player) { playerPosX = player->pos[0]; playerPosZ = player->pos[2]; for (trainIndex = 0; trainIndex < NUM_TRAINS; trainIndex++) { - trainCar = &D_801635A0[trainIndex].locomotive; + trainCar = &sTrains[trainIndex].locomotive; x_dist = playerPosX - trainCar->position[0]; z_dist = playerPosZ - trainCar->position[2]; if ((x_dist > -100.0) && (x_dist < 100.0)) { @@ -6037,7 +5983,7 @@ void func_80012DC0(s32 playerId, Player *player) { if (func_80006018(trainCar->position[0], trainCar->position[2], trainCar->velocity[0], trainCar->velocity[2], 60.0f, 20.0f, playerPosX, playerPosZ) == 1) { player->statusEffects |= 0x400000; } - trainCar = &D_801635A0[trainIndex].tender; + trainCar = &sTrains[trainIndex].tender; if (trainCar->isActive == 1) { if (func_80006018(trainCar->position[0], trainCar->position[2], trainCar->velocity[0], trainCar->velocity[2], 30.0f, 20.0f, playerPosX, playerPosZ) == 1) { player->statusEffects |= 0x400000; @@ -6047,7 +5993,7 @@ void func_80012DC0(s32 playerId, Player *player) { } for (passengerCarIndex = 0; passengerCarIndex < NUM_PASSENGER_CAR_ENTRIES; passengerCarIndex++) { - trainCar = &D_801635A0[trainIndex].passengerCars[passengerCarIndex]; + trainCar = &sTrains[trainIndex].passengerCars[passengerCarIndex]; x_dist = playerPosX - trainCar->position[0]; z_dist = playerPosZ - trainCar->position[2]; if (trainCar->isActive == 1) { @@ -6065,93 +6011,71 @@ void func_80012DC0(s32 playerId, Player *player) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc extern s32 D_8016359C; -extern u16 D_801637BC; +extern u16 D_801637BC[2]; +/** + * Appears to check if the train is close to the crossing. + * Implements D_801637BC as a counter +*/ void func_80013054(void) { - TrainStuff *var_v1; - f32 var_f8; - f64 temp_f12; - f64 temp_f16; - f64 temp_f18; - u16 *var_a0; - u16 *var_v1_2; - u16 temp_t7; + f32 temp_f16; + f32 temp_f18; + f32 temp_f12; + s32 i; + isCrossingTriggeredByIndex[0] = 0; + isCrossingTriggeredByIndex[1] = 0; - 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 = (u16) var_v1->locomotive.wayPointIndex; - var_f8 = (f32) temp_t7; - if ((s32) temp_t7 < 0) { - var_f8 += 4294967296.0f; + for (i = 0; i < 2; i++) { + temp_f16 = sTrains[i].locomotive.wayPointIndex / ((f32) D_8016359C); + temp_f18 = 0.72017354f; + temp_f12 = 0.42299348f; + + if (((temp_f12 - 0.1) < temp_f16) + && (temp_f16 < ((((f64) sTrains[i].numCars) * 0.01) + (temp_f12 + 0.01)))) { + + isCrossingTriggeredByIndex[0] = 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 - 0.1) < temp_f16) + && (temp_f16 < ((((f64) sTrains[i].numCars) * 0.01) + (temp_f18 + 0.01)))) { + + isCrossingTriggeredByIndex[1] = 1; } - if (((temp_f18 - 0.1) < temp_f16) && (temp_f16 < (((f64) var_v1->numCars * 0.01) + (temp_f18 + 0.01)))) { - D_801637B8->unk2 = 1U; - } - var_v1 += 0x10C; - } while ((u32) var_v1 < (u32) D_801637B8); - var_a0 = &D_801637BC; - var_v1_2 = D_801637B8; - do { - if (*var_v1_2 == 1) { - *var_a0 += 1; + } + + for (i = 0; i < 2; i++) { + if (isCrossingTriggeredByIndex[i] == 1) { + D_801637BC[i] += 1; } else { - *var_a0 = 0; + D_801637BC[i] = 0; } - 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 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern s16 D_801631E0; -extern ? D_801634D8; -extern u16 D_801637BC; +extern s16 D_801634D8[8]; extern u16 D_801637BE; -s16 gCurrentCourseId; /* unable to generate initializer */ void func_800131DC(s32 playerId) { - u16 *sp18; - s16 temp_v0_2; - s16 temp_v0_3; - s32 temp_v0; - u16 *temp_v1; + D_801634D8[playerId] = 0; + if (gCurrentCourseId == COURSE_KALAMARI_DESERT) { + if ((!(D_801631E0[playerId] != 0)) + || (func_800061DC(gPlayers[playerId].pos, 1000.0f, 0))) { - temp_v0 = playerId * 2; - temp_v1 = temp_v0 + &D_801634D8; - *temp_v1 = 0; - if ((gCurrentCourseId == 0x000B) && ((*(&D_801631E0 + temp_v0) == 0) || (sp18 = temp_v1, (func_800061DC((playerId * 0xDD8) + 0x14 + gPlayers, 1000.0f, 0) != 0)))) { - if ((D_801637B8->unk2 == 1) && ((s32) D_801637BE >= 0xF1)) { - temp_v0_2 = D_80162FCE; - if ((temp_v0_2 >= 0xB1) && (temp_v0_2 < 0xB6)) { - *temp_v1 = 1; + if ((isCrossingTriggeredByIndex[1] == 1) + && ((D_801637BE) > 240)) { + + if ((D_80162FCE > 176) && (D_80162FCE < 182)) { + D_801634D8[playerId] = 1; + } } - } - if ((D_801637B8->unk0 == 1) && ((s32) D_801637BC >= 0xF1)) { - temp_v0_3 = D_80162FCE; - if ((temp_v0_3 >= 0x132) && (temp_v0_3 < 0x136)) { - *temp_v1 = 1; + if ((isCrossingTriggeredByIndex[0] == 1) && (( D_801637BC[0]) > 240)) { + if ((D_80162FCE >= 306) && (D_80162FCE < 0x136)) { + D_801634D8[playerId] = 1; + } } } } } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800131DC.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc @@ -10511,7 +10435,7 @@ extern Struct80163418 D_80163428; extern Struct80163418 D_80163438; void func_8001C05C(void) { - init_seg_8028DF00(); + init_segment_racing(); gCurrentCourseId = COURSE_AWARD_CEREMONY; D_8016347C = 0; D_8016347E = 0; diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 1e7cf6b03..dd6d84656 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -29,7 +29,9 @@ struct unexpiredActors { /* Function Prototypes */ s16 func_80005FD0(Vec3f, Vec3f); - +void func_800100F0(s32); +void func_800120C8(void); +void func_800127E0(void); s32 func_80006018(f32, f32, f32, f32, f32, f32, f32, f32); void func_80006114(Vec3f, Vec3f, s16); s32 func_800061DC(Vec3f, f32, s32); diff --git a/src/debug/debug.inc.c b/src/debug/debug.inc.c index 5b5950469..84c903dd6 100644 --- a/src/debug/debug.inc.c +++ b/src/debug/debug.inc.c @@ -53,6 +53,28 @@ variableWatchAttributes gMainVariableWatchList[] = { DISPLAY_FLOAT_NUMBER, 0, 0 }, + { + "Torque 9C: ", + &gPlayers[0].unk_09C, + sizeof(gPlayerOne->unk_09C), + DISPLAY_FLOAT_NUMBER, + 0, 0 + }, + { + "Top Speed 214: ", + &gPlayers[0].unk_214, + sizeof(gPlayerOne->unk_214), + DISPLAY_FLOAT_NUMBER, + 0, 0 + }, + { + "Accel Offset C4: ", + &gPlayers[0].unk_0C4, + sizeof(gPlayerOne->unk_0C4), + DISPLAY_SIGNED_NUMBER, + 0, 0 + }, + }; #endif diff --git a/src/camera_junk.c b/src/ending/camera_junk.c similarity index 100% rename from src/camera_junk.c rename to src/ending/camera_junk.c diff --git a/src/ceremony_and_credits.c b/src/ending/ceremony_and_credits.c similarity index 100% rename from src/ceremony_and_credits.c rename to src/ending/ceremony_and_credits.c diff --git a/src/ceremony_and_credits.h b/src/ending/ceremony_and_credits.h similarity index 100% rename from src/ceremony_and_credits.h rename to src/ending/ceremony_and_credits.h diff --git a/src/code_80280000.c b/src/ending/code_80280000.c similarity index 100% rename from src/code_80280000.c rename to src/ending/code_80280000.c diff --git a/src/code_80280000.h b/src/ending/code_80280000.h similarity index 100% rename from src/code_80280000.h rename to src/ending/code_80280000.h diff --git a/src/code_80281780.c b/src/ending/code_80281780.c similarity index 100% rename from src/code_80281780.c rename to src/ending/code_80281780.c diff --git a/src/code_80281780.h b/src/ending/code_80281780.h similarity index 100% rename from src/code_80281780.h rename to src/ending/code_80281780.h diff --git a/src/code_80281C40.c b/src/ending/code_80281C40.c similarity index 100% rename from src/code_80281C40.c rename to src/ending/code_80281C40.c diff --git a/src/code_80281C40.h b/src/ending/code_80281C40.h similarity index 100% rename from src/code_80281C40.h rename to src/ending/code_80281C40.h diff --git a/src/credits.c b/src/ending/credits.c similarity index 100% rename from src/credits.c rename to src/ending/credits.c diff --git a/src/credits.h b/src/ending/credits.h similarity index 100% rename from src/credits.h rename to src/ending/credits.h diff --git a/src/dl_unk_80284EE0.inc.c b/src/ending/dl_unk_80284EE0.inc.c similarity index 100% rename from src/dl_unk_80284EE0.inc.c rename to src/ending/dl_unk_80284EE0.inc.c diff --git a/src/podium_ceremony_actors.c b/src/ending/podium_ceremony_actors.c similarity index 100% rename from src/podium_ceremony_actors.c rename to src/ending/podium_ceremony_actors.c diff --git a/src/podium_ceremony_actors.h b/src/ending/podium_ceremony_actors.h similarity index 100% rename from src/podium_ceremony_actors.h rename to src/ending/podium_ceremony_actors.h diff --git a/src/main.c b/src/main.c index cebffeed4..9b07f040b 100644 --- a/src/main.c +++ b/src/main.c @@ -459,20 +459,20 @@ void display_and_vsync(void) { gGlobalTimer++; } -void init_seg_80280000(void) { - bzero((void *) SEG_80280000, 0xDF00); +void init_segment_ending_sequences(void) { + bzero((void *) SEG_ENDING_SEQUENCES, 0xDF00); osWritebackDCacheAll(); - dma_copy((u8 *) SEG_80280000, (u8 *) &_code_80280000SegmentRomStart, ALIGN16((u32)&_code_80280000SegmentRomEnd - (u32)&_code_80280000SegmentRomStart)); - osInvalICache((void *) SEG_80280000, 0xDF00); - osInvalDCache((void *) SEG_80280000, 0xDF00); + dma_copy((u8 *) SEG_ENDING_SEQUENCES, (u8 *) &_endingSequencesSegmentRomStart, ALIGN16((u32)&_endingSequencesSegmentRomEnd - (u32)&_endingSequencesSegmentRomStart)); + osInvalICache((void *) SEG_ENDING_SEQUENCES, 0xDF00); + osInvalDCache((void *) SEG_ENDING_SEQUENCES, 0xDF00); } -void init_seg_8028DF00(void) { - bzero((void *) SEG_8028DF00, 0x2C470); +void init_segment_racing(void) { + bzero((void *) SEG_RACING, 0x2C470); osWritebackDCacheAll(); - dma_copy((u8 *) SEG_8028DF00, (u8 *) &_code_8028DF00SegmentRomStart, ALIGN16((u32)&_code_8028DF00SegmentRomEnd - (u32)&_code_8028DF00SegmentRomStart)); - osInvalICache((void *) SEG_8028DF00, 0x2C470); - osInvalDCache((void *) SEG_8028DF00, 0x2C470); + dma_copy((u8 *) SEG_RACING, (u8 *) &_racingSegmentRomStart, ALIGN16((u32)&_racingSegmentRomEnd - (u32)&_racingSegmentRomStart)); + osInvalICache((void *) SEG_RACING, 0x2C470); + osInvalDCache((void *) SEG_RACING, 0x2C470); } void dma_copy(u8 *dest, u8 *romAddr, u32 size) { @@ -502,8 +502,8 @@ void setup_game_memory(void) { u32 sp38; UNUSED s32 unknown_padding; - init_seg_8028DF00(); - gHeapEndPtr = SEG_8028DF00; + init_segment_racing(); + gHeapEndPtr = SEG_RACING; set_segment_base_addr(0, (void *) SEG_START); // Memory pool size of 0xAB630 // todo: is it possible to shift this value? @@ -519,7 +519,7 @@ void setup_game_memory(void) { set_segment_base_addr(2, (void *) load_data((uintptr_t) &_data_segment2SegmentRomStart, (uintptr_t) &_data_segment2SegmentRomEnd)); sp2C = (u32)&_common_texturesSegmentRomEnd - (u32)&_common_texturesSegmentRomStart; sp2C = ALIGN16(sp2C); - texture_seg = SEG_8028DF00-sp2C; + texture_seg = SEG_RACING-sp2C; osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_common_texturesSegmentRomStart, (void *) texture_seg, sp2C, &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK); @@ -1127,19 +1127,19 @@ void update_gamestate(void) { break; case RACING: // @bug Reloading this segment makes random_u16() deterministic for player spawn order. - // In laymens terms, random_u16() outputs the same value everytime. - init_seg_8028DF00(); + // In laymens terms, random_u16() outputs the same value every time. + init_segment_racing(); setup_race(); break; case ENDING_SEQUENCE: gCurrentlyLoadedCourseId = COURSE_NULL; - init_seg_80280000(); + init_segment_ending_sequences(); load_ceremony_cutscene(); break; case CREDITS_SEQUENCE: gCurrentlyLoadedCourseId = COURSE_NULL; - init_seg_8028DF00(); - init_seg_80280000(); + init_segment_racing(); + init_segment_ending_sequences(); load_credits(); break; } diff --git a/src/main.h b/src/main.h index 9d63ce5ea..db59c091f 100644 --- a/src/main.h +++ b/src/main.h @@ -82,8 +82,8 @@ void *clear_framebuffer(s32); void rendering_init(void); void config_gfx_pool(void); void display_and_vsync(void); -void init_seg_80280000(void); -void init_seg_8028DF00(void); +void init_segment_ending_sequences(void); +void init_segment_racing(void); void dma_copy(u8*, u8*, u32); void setup_game_memory(void); void game_init_clear_framebuffer(void); diff --git a/src/os/contpfs.c b/src/os/contpfs.c index a94d59fa1..5946547ae 100644 --- a/src/os/contpfs.c +++ b/src/os/contpfs.c @@ -295,4 +295,4 @@ s32 __osPfsSelectBank(OSPfs *pfs) } ret = __osContRamWrite(pfs->queue, pfs->channel, 1024, (u8*)temp, FALSE); return ret; -} \ No newline at end of file +} diff --git a/src/os/osPfsSearchFile.c b/src/os/osPfsSearchFile.c index dc1bc8a21..efd994698 100755 --- a/src/os/osPfsSearchFile.c +++ b/src/os/osPfsSearchFile.c @@ -48,4 +48,4 @@ s32 osPfsFindFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 } *file_no = -1; return PFS_ERR_INVALID; -} \ No newline at end of file +} diff --git a/src/actors.c b/src/racing/actors.c similarity index 99% rename from src/actors.c rename to src/racing/actors.c index 23f1ab5d0..65849547c 100644 --- a/src/actors.c +++ b/src/racing/actors.c @@ -1314,7 +1314,7 @@ void update_obj_wario_stadium_sign(struct Actor *arg0) { **/ void update_obj_railroad_crossing(struct RailroadCrossing *crossing) { // If train close? - if (D_801637B8[crossing->crossingId] != 0) { + if (isCrossingTriggeredByIndex[crossing->crossingId] != 0) { // Timer++ crossing->someTimer++; // Reset timer @@ -3920,7 +3920,7 @@ void func_802A2AD0(Camera *arg0, struct RailroadCrossing *rr_crossing) { gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING); gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK); - if (D_801637B8[rr_crossing->crossingId]) { + if (isCrossingTriggeredByIndex[rr_crossing->crossingId]) { if (rr_crossing->someTimer < 20) { gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_crossing_right_active); diff --git a/src/actors.h b/src/racing/actors.h similarity index 99% rename from src/actors.h rename to src/racing/actors.h index 7a30d3cac..9b14e4e32 100644 --- a/src/actors.h +++ b/src/racing/actors.h @@ -142,7 +142,7 @@ extern Gfx *gDisplayListHead; extern s32 gModeSelection; extern s16 gCurrentCourseId; extern f32 D_80150130[]; -extern u16 D_801637B8[]; +extern u16 isCrossingTriggeredByIndex[]; extern Lights1 D_800DC610[]; extern u16 gMatrixObjectCount; diff --git a/src/actors_extended.c b/src/racing/actors_extended.c similarity index 100% rename from src/actors_extended.c rename to src/racing/actors_extended.c diff --git a/src/actors_extended.h b/src/racing/actors_extended.h similarity index 100% rename from src/actors_extended.h rename to src/racing/actors_extended.h diff --git a/src/collision.c b/src/racing/collision.c similarity index 99% rename from src/collision.c rename to src/racing/collision.c index 4583daeb6..48debefc1 100644 --- a/src/collision.c +++ b/src/racing/collision.c @@ -636,7 +636,6 @@ void func_802AC114(Vec3f pos1, f32 boundingBoxSize, Vec3f pos2, UNUSED f32 unk) // m2c removed because no need to match. // UNUSED mk64_surface_map_ram *func_802AC22C(void *arg) -// todo: Remove this asm from non_matchings. GLOBAL_ASM("asm/unused/collision/func_802AC22C.s") s32 is_colliding_with_drivable_surface(Collision *collision, f32 boundingBoxSize, f32 x1, f32 y1, f32 z1, u16 index, f32 posX, f32 posY, f32 posZ) { diff --git a/src/collision.h b/src/racing/collision.h similarity index 100% rename from src/collision.h rename to src/racing/collision.h diff --git a/src/math_util.c b/src/racing/math_util.c similarity index 100% rename from src/math_util.c rename to src/racing/math_util.c diff --git a/src/math_util.h b/src/racing/math_util.h similarity index 100% rename from src/math_util.h rename to src/racing/math_util.h diff --git a/src/memory.c b/src/racing/memory.c similarity index 99% rename from src/memory.c rename to src/racing/memory.c index 57eb029af..506aa6695 100644 --- a/src/memory.c +++ b/src/racing/memory.c @@ -1353,9 +1353,9 @@ u8 *load_course(s32 courseId) { unknown1 = gCourseTable[courseId].unknown1; if ((gGamestate == ENDING_SEQUENCE) || (gGamestate == CREDITS_SEQUENCE)) { - gHeapEndPtr = SEG_80280000; + gHeapEndPtr = SEG_ENDING_SEQUENCES; } else { - gHeapEndPtr = SEG_8028DF00; + gHeapEndPtr = SEG_RACING; } set_segment_base_addr(9, load_data((uintptr_t)offsetRomStart, (uintptr_t) offsetRomEnd)); diff --git a/src/memory.h b/src/racing/memory.h similarity index 100% rename from src/memory.h rename to src/racing/memory.h diff --git a/src/race_logic.c b/src/racing/race_logic.c similarity index 100% rename from src/race_logic.c rename to src/racing/race_logic.c diff --git a/src/race_logic.h b/src/racing/race_logic.h similarity index 100% rename from src/race_logic.h rename to src/racing/race_logic.h diff --git a/src/render_courses.c b/src/racing/render_courses.c similarity index 100% rename from src/render_courses.c rename to src/racing/render_courses.c diff --git a/src/render_courses.h b/src/racing/render_courses.h similarity index 100% rename from src/render_courses.h rename to src/racing/render_courses.h diff --git a/src/skybox_and_splitscreen.c b/src/racing/skybox_and_splitscreen.c similarity index 100% rename from src/skybox_and_splitscreen.c rename to src/racing/skybox_and_splitscreen.c diff --git a/src/skybox_and_splitscreen.h b/src/racing/skybox_and_splitscreen.h similarity index 100% rename from src/skybox_and_splitscreen.h rename to src/racing/skybox_and_splitscreen.h