Skip to content

Commit

Permalink
some rename and allow change the course engine (#691)
Browse files Browse the repository at this point in the history
* some rename and allow change the course engine

* fix comment

* add more comment

* rename and change description
  • Loading branch information
coco875 authored Oct 20, 2024
1 parent 0e0345f commit 8901f82
Show file tree
Hide file tree
Showing 59 changed files with 891 additions and 751 deletions.
6 changes: 3 additions & 3 deletions asm/non_matchings/code_80005FD0/kart_ai_use_item_strategy.s
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ glabel L8001AFD8
/* 01BC94 8001B094 46283280 */ add.d $f10, $f6, $f8
/* 01BC98 8001B098 8D86001C */ lw $a2, 0x1c($t4)
/* 01BC9C 8001B09C AFA70028 */ sw $a3, 0x28($sp)
/* 01BCA0 8001B0A0 0C0AB870 */ jal spawn_actor_on_surface
/* 01BCA0 8001B0A0 0C0AB870 */ jal get_surface_height
/* 01BCA4 8001B0A4 462053A0 */ cvt.s.d $f14, $f10
/* 01BCA8 8001B0A8 8FA70028 */ lw $a3, 0x28($sp)
/* 01BCAC 8001B0AC 3C013F80 */ li $at, 0x3F800000 # 1.000000
Expand Down Expand Up @@ -582,7 +582,7 @@ glabel L8001B3B4
/* 01C054 8001B454 E4E00028 */ swc1 $f0, 0x28($a3)
/* 01C058 8001B458 E4E0002C */ swc1 $f0, 0x2c($a3)
/* 01C05C 8001B45C AFA70028 */ sw $a3, 0x28($sp)
/* 01C060 8001B460 0C0AB870 */ jal spawn_actor_on_surface
/* 01C060 8001B460 0C0AB870 */ jal get_surface_height
/* 01C064 8001B464 462033A0 */ cvt.s.d $f14, $f6
/* 01C068 8001B468 8FA70028 */ lw $a3, 0x28($sp)
/* 01C06C 8001B46C 3C013F80 */ li $at, 0x3F800000 # 1.000000
Expand Down Expand Up @@ -1122,7 +1122,7 @@ glabel L8001BB30
/* 01C7F4 8001BBF4 46249180 */ add.d $f6, $f18, $f4
/* 01C7F8 8001BBF8 8CE60020 */ lw $a2, 0x20($a3)
/* 01C7FC 8001BBFC AFA70028 */ sw $a3, 0x28($sp)
/* 01C800 8001BC00 0C0AB870 */ jal spawn_actor_on_surface
/* 01C800 8001BC00 0C0AB870 */ jal get_surface_height
/* 01C804 8001BC04 462033A0 */ cvt.s.d $f14, $f6
/* 01C808 8001BC08 8FA70028 */ lw $a3, 0x28($sp)
/* 01C80C 8001BC0C C4E8000C */ lwc1 $f8, 0xc($a3)
Expand Down
2 changes: 1 addition & 1 deletion asm/non_matchings/code_8006E9C0/func_8006FA94.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ glabel func_8006FA94
/* 070698 8006FA98 AFBF0014 */ sw $ra, 0x14($sp)
/* 07069C 8006FA9C 0C01BE33 */ jal func_8006F8CC
/* 0706A0 8006FAA0 00000000 */ nop
/* 0706A4 8006FAA4 0C01BC02 */ jal func_8006F008
/* 0706A4 8006FAA4 0C01BC02 */ jal course_mini_map_settings
/* 0706A8 8006FAA8 00000000 */ nop
/* 0706AC 8006FAAC 24040000 */ li $a0, 0
/* 0706B0 8006FAB0 0C0338C4 */ jal osSetTime
Expand Down
20 changes: 10 additions & 10 deletions asm/non_matchings/render_objects/func_8004F168.s
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ glabel func_8004F168
/* 04FD9C 8004F19C 01CF1821 */ addu $v1, $t6, $t7
/* 04FDA0 8004F1A0 94780000 */ lhu $t8, ($v1)
/* 04FDA4 8004F1A4 00A03825 */ move $a3, $a1
/* 04FDA8 8004F1A8 3C018019 */ lui $at, %hi(D_8018D2A0) # $at, 0x8019
/* 04FDA8 8004F1A8 3C018019 */ lui $at, %hi(gMiniMapMarkerScale) # $at, 0x8019
/* 04FDAC 8004F1AC 33198000 */ andi $t9, $t8, 0x8000
/* 04FDB0 8004F1B0 13200088 */ beqz $t9, .L8004F3D4
/* 04FDB4 8004F1B4 00044040 */ sll $t0, $a0, 1
/* 04FDB8 8004F1B8 C420D2A0 */ lwc1 $f0, %lo(D_8018D2A0)($at)
/* 04FDB8 8004F1B8 C420D2A0 */ lwc1 $f0, %lo(gMiniMapMarkerScale)($at)
/* 04FDBC 8004F1BC C4640014 */ lwc1 $f4, 0x14($v1)
/* 04FDC0 8004F1C0 3C098019 */ lui $t1, %hi(D_8018D2C0) # 0x8019
/* 04FDC0 8004F1C0 3C098019 */ lui $t1, %hi(gMiniMapFinishLineX) # 0x8019
/* 04FDC4 8004F1C4 C466001C */ lwc1 $f6, 0x1c($v1)
/* 04FDC8 8004F1C8 46002082 */ mul.s $f2, $f4, $f0
/* 04FDCC 8004F1CC 01284821 */ addu $t1, $t1, $t0
/* 04FDD0 8004F1D0 3C0A8019 */ lui $t2, %hi(D_8018D2F0) # $t2, 0x8019
/* 04FDD4 8004F1D4 3C0C8019 */ lui $t4, %hi(D_8018D2B0) # $t4, 0x8019
/* 04FDD8 8004F1D8 858CD2B0 */ lh $t4, %lo(D_8018D2B0)($t4)
/* 04FDDC 8004F1DC 854AD2F0 */ lh $t2, %lo(D_8018D2F0)($t2)
/* 04FDE0 8004F1E0 8529D2C0 */ lh $t1, %lo(D_8018D2C0)($t1) # -0x2d40($t1)
/* 04FDE0 8004F1E0 8529D2C0 */ lh $t1, %lo(gMiniMapFinishLineX)($t1) # -0x2d40($t1)
/* 04FDE4 8004F1E4 4600120D */ trunc.w.s $f8, $f2
/* 04FDE8 8004F1E8 46003302 */ mul.s $f12, $f6, $f0
/* 04FDEC 8004F1EC 3C0F8019 */ lui $t7, %hi(D_8018D2E0) # $t7, 0x8019
/* 04FDF0 8004F1F0 85EFD2E0 */ lh $t7, %lo(D_8018D2E0)($t7)
/* 04FDEC 8004F1EC 3C0F8019 */ lui $t7, %hi(gMiniMapX) # $t7, 0x8019
/* 04FDF0 8004F1F0 85EFD2E0 */ lh $t7, %lo(gMiniMapX)($t7)
/* 04FDF4 8004F1F4 01001025 */ move $v0, $t0
/* 04FDF8 8004F1F8 012A5821 */ addu $t3, $t1, $t2
/* 04FDFC 8004F1FC 05810003 */ bgez $t4, .L8004F20C
Expand All @@ -43,21 +43,21 @@ glabel func_8004F168
.L8004F20C:
/* 04FE0C 8004F20C 44084000 */ mfc1 $t0, $f8
/* 04FE10 8004F210 016D7023 */ subu $t6, $t3, $t5
/* 04FE14 8004F214 3C0D8019 */ lui $t5, %hi(D_8018D2D8) # 0x8019
/* 04FE14 8004F214 3C0D8019 */ lui $t5, %hi(gMiniMapFinishLineY) # 0x8019
/* 04FE18 8004F218 01CFC021 */ addu $t8, $t6, $t7
/* 04FE1C 8004F21C 3C0E8019 */ lui $t6, %hi(D_8018D2F8) # $t6, 0x8019
/* 04FE20 8004F220 01A26821 */ addu $t5, $t5, $v0
/* 04FE24 8004F224 00084C00 */ sll $t1, $t0, 0x10
/* 04FE28 8004F228 85ADD2D8 */ lh $t5, %lo(D_8018D2D8)($t5) # -0x2d28($t5)
/* 04FE28 8004F228 85ADD2D8 */ lh $t5, %lo(gMiniMapFinishLineY)($t5) # -0x2d28($t5)
/* 04FE2C 8004F22C 85CED2F8 */ lh $t6, %lo(D_8018D2F8)($t6)
/* 04FE30 8004F230 3C198019 */ lui $t9, %hi(D_8018D2B8) # $t9, 0x8019
/* 04FE34 8004F234 4600628D */ trunc.w.s $f10, $f12
/* 04FE38 8004F238 8739D2B8 */ lh $t9, %lo(D_8018D2B8)($t9)
/* 04FE3C 8004F23C 00095403 */ sra $t2, $t1, 0x10
/* 04FE40 8004F240 030A2021 */ addu $a0, $t8, $t2
/* 04FE44 8004F244 3C188019 */ lui $t8, %hi(D_8018D2E8) # $t8, 0x8019
/* 04FE44 8004F244 3C188019 */ lui $t8, %hi(gMiniMapY) # $t8, 0x8019
/* 04FE48 8004F248 01AE7821 */ addu $t7, $t5, $t6
/* 04FE4C 8004F24C 8718D2E8 */ lh $t8, %lo(D_8018D2E8)($t8)
/* 04FE4C 8004F24C 8718D2E8 */ lh $t8, %lo(gMiniMapY)($t8)
/* 04FE50 8004F250 440E5000 */ mfc1 $t6, $f10
/* 04FE54 8004F254 00046400 */ sll $t4, $a0, 0x10
/* 04FE58 8004F258 000C5C03 */ sra $t3, $t4, 0x10
Expand Down
122 changes: 0 additions & 122 deletions ctx_includes.c

This file was deleted.

2 changes: 1 addition & 1 deletion enhancements/flycam.patch
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ index c2a84aa..338e2bd 100644
temp_v1 = ((temp_v1 - 1) * 4) + var_a3;

+ if (isFlycam) {
+ func_8029569C();
+ render_course_credits();
+ return;
+ }
+
Expand Down
1 change: 1 addition & 0 deletions include/bomb_kart.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <common_structs.h>
#include <mk64.h>
#include <course.h>

#define NUM_BOMB_KARTS_MAX 7
#define NUM_BOMB_KARTS_VERSUS 7
Expand Down
11 changes: 11 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef CONFIG_H
#define CONFIG_H

/**
* @brief Use a custom course engine
* Use a custom course engine instead of the default one who use switch. see course.h and everywhere
* ENABLE_CUSTOM_COURSE_ENGINE are use to define your
*
*/
#define ENABLE_CUSTOM_COURSE_ENGINE 0
#endif
116 changes: 116 additions & 0 deletions include/course.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <ultra64.h>
#include <PR/gbi.h>
#include <macros.h>
#include "waypoints.h"

/**
* @file Include for course gfx.inc.c.
Expand All @@ -16,4 +17,119 @@ typedef struct {
u16 flags;
} TrackSections;

struct _struct_gCoursePathSizes_0x10 {
/* 0x00 */ u16 unk0;
/* 0x02 */ u16 unk2;
/* 0x04 */ u16 unk4;
/* 0x06 */ u16 unk6;
/* 0x08 */ u16 unk8;
/* 0x0A */ char padA[6];
}; // size 0x10

#if !ENABLE_CUSTOM_COURSE_ENGINE
typedef enum {
/* 0x00 */ COURSE_MARIO_RACEWAY = 0,
/* 0x01 */ COURSE_CHOCO_MOUNTAIN,
/* 0x02 */ COURSE_BOWSER_CASTLE,
/* 0x03 */ COURSE_BANSHEE_BOARDWALK,
/* 0x04 */ COURSE_YOSHI_VALLEY,
/* 0x05 */ COURSE_FRAPPE_SNOWLAND,
/* 0x06 */ COURSE_KOOPA_BEACH,
/* 0x07 */ COURSE_ROYAL_RACEWAY,
/* 0x08 */ COURSE_LUIGI_RACEWAY,
/* 0x09 */ COURSE_MOO_MOO_FARM,
/* 0x0A */ COURSE_TOADS_TURNPIKE,
/* 0x0B */ COURSE_KALAMARI_DESERT,
/* 0x0C */ COURSE_SHERBET_LAND,
/* 0x0D */ COURSE_RAINBOW_ROAD,
/* 0x0E */ COURSE_WARIO_STADIUM,
/* 0x0F */ COURSE_BLOCK_FORT,
/* 0x10 */ COURSE_SKYSCRAPER,
/* 0x11 */ COURSE_DOUBLE_DECK,
/* 0x12 */ COURSE_DK_JUNGLE,
/* 0x13 */ COURSE_BIG_DONUT,
/* 0x14 */ COURSE_AWARD_CEREMONY,
/* 0x15 */ NUM_COURSES
} COURSES;

#else

#define COURSE_MARIO_RACEWAY
#define COURSE_CHOCO_MOUNTAIN
#define COURSE_BOWSER_CASTLE
#define COURSE_BANSHEE_BOARDWALK
#define COURSE_YOSHI_VALLEY
#define COURSE_FRAPPE_SNOWLAND
#define COURSE_KOOPA_BEACH
#define COURSE_ROYAL_RACEWAY
#define COURSE_LUIGI_RACEWAY
#define COURSE_MOO_MOO_FARM
#define COURSE_TOADS_TURNPIKE
#define COURSE_KALAMARI_DESERT
#define COURSE_SHERBET_LAND
#define COURSE_RAINBOW_ROAD
#define COURSE_WARIO_STADIUM
#define COURSE_BLOCK_FORT
#define COURSE_SKYSCRAPER
#define COURSE_DOUBLE_DECK
#define COURSE_DK_JUNGLE
#define COURSE_BIG_DONUT
#define COURSE_AWARD_CEREMONY
#define NUM_COURSES

#endif

#if !ENABLE_CUSTOM_COURSE_ENGINE
extern s16 gCurrentCourseId;
extern s16* D_800DCBB4[];
#define GET_COURSE_800DCBB4(n) D_800DCBB4[gCurrentCourseId][n]
extern f32 gKartAICourseMaximumSeparation[];
#define GET_COURSE_AIMaximumSeparation gKartAICourseMaximumSeparation[gCurrentCourseId]
extern struct _struct_gCoursePathSizes_0x10 gCoursePathSizes[];
#define GET_COURSE_PathSizes gCoursePathSizes[gCurrentCourseId]
extern s16 gKartAISteeringSensitivity[];
#define GET_COURSE_AISteeringSensitivity gKartAISteeringSensitivity[gCurrentCourseId]
extern f32 gKartAICourseMinimumSeparation[];
#define GET_COURSE_AIMinimumSeparation gKartAICourseMinimumSeparation[gCurrentCourseId]
extern TrackWaypoint* gCoursePathTable[][4];
#define GET_COURSE_PathTable(p) segmented_to_virtual_dupe_2(gCoursePathTable[gCurrentCourseId][p])
extern TrackWaypoint* gCoursePathTable2[][4];
#define GET_COURSE_PathTable2(p) segmented_to_virtual_dupe_2(gCoursePathTable2[gCurrentCourseId][p])
extern KartAIBehaviour* gKartAIBehaviourLUT[];
#define GET_COURSE_AIBehaviour segmented_to_virtual_dupe_2(gKartAIBehaviourLUT[i])
extern char* gCourseNames[];
#define GET_COURSE_Name gCourseNames[gCurrentCourseId]
extern char* gCourseNamesDup[];
#define GET_COURSE_NameDup gCourseNamesDup[gCupCourseOrder[gCupSelection][gCourseIndexInCup]]
extern char* gDebugCourseNames[];
#define GET_COURSE_debugName gDebugCourseNames[gCurrentCourseId]
extern f32 gCourseFarPersp;
#define gCourseFarPersp gCourseFarPersp
extern f32 gCourseNearPersp;
#define gCourseNearPersp gCourseNearPersp
#define GET_COURSE_D_0D0096B8(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D0096B8[gCurrentCourseId][cc])
#define GET_COURSE_D_0D009808(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009808[gCurrentCourseId][cc])
#define GET_COURSE_D_0D009418(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009418[gCurrentCourseId][cc])
#define GET_COURSE_D_0D009568(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009568[gCurrentCourseId][cc])
#else
#define gCurrentCourseId
#define GET_COURSE_800DCBB4(n)
#define GET_COURSE_AIMaximumSeparation
#define GET_COURSE_PathSizes
#define GET_COURSE_AISteeringSensitivity
#define GET_COURSE_AIMinimumSeparation
#define GET_COURSE_PathTable(p)
#define GET_COURSE_PathTable2(p)
#define GET_COURSE_AIBehaviour
#define GET_COURSE_Name
#define GET_COURSE_NameDup
#define GET_COURSE_debugName
#define gCourseFarPersp
#define gCourseNearPersp
#define GET_COURSE_D_0D0096B8(cc)
#define GET_COURSE_D_0D009808(cc)
#define GET_COURSE_D_0D009418(cc)
#define GET_COURSE_D_0D009568(cc)
#endif

#endif // COURSE_H
Loading

0 comments on commit 8901f82

Please sign in to comment.