Refactor World::Courses to unique_ptr (#211)

* wip course unique ptr

* Track unique_ptr : This probably compiles

* Finish impl Courses as unique_ptr

* Fix error

* Fixes

* More fixes

* Cleanup

* Remove old vars

---------

Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
This commit is contained in:
MegaMech
2025-05-23 16:53:14 -06:00
committed by GitHub
parent 9363e3d776
commit 2a0c0939c7
34 changed files with 403 additions and 473 deletions
+10 -10
View File
@@ -1711,7 +1711,7 @@ void func_8002C11C(Player* player) {
}
void func_8002C17C(Player* player, s8 playerId) {
if (GetCourse() == GetYoshiValley()) {
if (IsYoshiValley()) {
if ((player->collision.surfaceDistance[2] >= 600.0f) && (D_80165330[playerId] == 0)) {
D_80165330[playerId] = 1;
gCopyNearestWaypointByPlayerId[playerId] = gNearestWaypointByPlayerId[playerId];
@@ -1724,7 +1724,7 @@ void func_8002C17C(Player* player, s8 playerId) {
D_80165330[playerId] = 0;
}
}
} else if (GetCourse() == GetFrappeSnowland()) {
} else if (IsFrappeSnowland()) {
if ((player->surfaceType == SNOW_OFFROAD) && (D_80165330[playerId] == 0)) {
D_80165330[playerId] = 1;
gCopyNearestWaypointByPlayerId[playerId] = gNearestWaypointByPlayerId[playerId];
@@ -1734,7 +1734,7 @@ void func_8002C17C(Player* player, s8 playerId) {
gCopyNearestWaypointByPlayerId[playerId] = gNearestWaypointByPlayerId[playerId];
gCopyPathIndexByPlayerId[playerId] = gPathIndexByPlayerId[playerId];
}
} else if (GetCourse() == GetRoyalRaceway()) {
} else if (IsRoyalRaceway()) {
if (((player->effects & BOOST_RAMP_ASPHALT_EFFECT) != 0) && (D_80165330[playerId] == 0)) {
D_80165330[playerId] = 1;
gCopyNearestWaypointByPlayerId[playerId] = gNearestWaypointByPlayerId[playerId];
@@ -1744,7 +1744,7 @@ void func_8002C17C(Player* player, s8 playerId) {
gCopyNearestWaypointByPlayerId[playerId] = gNearestWaypointByPlayerId[playerId];
gCopyPathIndexByPlayerId[playerId] = gPathIndexByPlayerId[playerId];
}
} else if (GetCourse() == GetRainbowRoad()) {
} else if (IsRainbowRoad()) {
if ((player->collision.surfaceDistance[2] >= 600.0f) && (D_80165330[playerId] == 0)) {
D_80165330[playerId] = 1;
gCopyNearestWaypointByPlayerId[playerId] = gNearestWaypointByPlayerId[playerId];
@@ -1778,9 +1778,9 @@ void func_8002C4F8(Player* player, s8 arg1) {
if ((player->unk_0DE & 4) != 4) {
player->unk_0DE |= 8;
player->unk_0DE |= 4;
if ((GetCourse() != GetKoopaTroopaBeach()) && (GetCourse() != GetSkyscraper()) &&
(GetCourse() != GetRainbowRoad()) && ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
if ((GetCourse() == GetBowsersCastle()) || (GetCourse() == GetBigDonut())) {
if ((!IsKoopaTroopaBeach()) && (!IsSkyscraper()) &&
(!IsRainbowRoad()) && ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
if ((IsBowsersCastle()) || (IsBigDonut())) {
func_800C9060((u8) arg1, 0x1900801CU);
} else {
func_800C9060((u8) arg1, 0x19008008U);
@@ -1788,8 +1788,8 @@ void func_8002C4F8(Player* player, s8 arg1) {
}
}
}
if ((GetCourse() == GetKoopaTroopaBeach()) || (GetCourse() == GetSkyscraper()) ||
(GetCourse() == GetRainbowRoad())) {
if ((IsKoopaTroopaBeach()) || (IsSkyscraper()) ||
(IsRainbowRoad())) {
player->unk_0DE &= ~0x000C;
}
if ((player->boundingBoxSize < (D_801652A0[arg1] - player->pos[1])) &&
@@ -2254,7 +2254,7 @@ void func_8002D268(Player* player, UNUSED Camera* camera, s8 screenId, s8 player
player->unk_DB4.unkC = 1.5f;
if (((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) &&
((player->type & PLAYER_INVISIBLE_OR_BOMB) != PLAYER_INVISIBLE_OR_BOMB)) {
if (((player->unk_0C2 < 0xB) && (player->unk_0C2 >= 4)) && (GetCourse() == GetBowsersCastle())) {
if (((player->unk_0C2 < 0xB) && (player->unk_0C2 >= 4)) && (IsBowsersCastle())) {
func_800CADD0((u8) playerId, player->unk_0C2 / 14.0f);
} else {
func_800CADD0((u8) playerId, player->unk_0C2 / 25.0f);