-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourseMap.cpp
More file actions
40 lines (31 loc) · 1.49 KB
/
CourseMap.cpp
File metadata and controls
40 lines (31 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <common/Common.hpp>
#include <game/system/CourseMap.hpp>
/////////////////////////////
// Invalid KMP Point Fixes //
/////////////////////////////
// Prevent invalid item points from crashing the game
const MapdataItemPoint* CourseMap::getDummyItemPoint() {
static const MapdataItemPoint::SData dummyPointData = {{0.0f, 0.0f, 0.0f}, 1.0f, {0, 0}};
static const MapdataItemPoint dummyPoint = {(MapdataItemPoint::SData*)&dummyPointData };
return &dummyPoint;
}
// CourseMap::getItemPoint() override
// Prevent invalid item points from crashing the game
kmBranchDefCpp(0x80514D3C, NULL, const MapdataItemPoint*, CourseMap* self, u32 id) {
if (!self->mpItemPoint || id >= self->mpItemPoint->numEntries)
return CourseMap::getDummyItemPoint();
return self->mpItemPoint->entries[id];
}
// Prevent invalid cannon points from crashing the game
const MapdataCannonPoint* CourseMap::getDummyCannonPoint() {
static const MapdataCannonPoint::SData dummyPointData = {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, 0, 0};
static const MapdataCannonPoint dummyPoint = {(MapdataCannonPoint::SData*)&dummyPointData};
return &dummyPoint;
}
// CourseMap::getCannonPoint() override
// Prevent invalid cannon points from crashing the game
kmBranchDefCpp(0x80518AE0, NULL, const MapdataCannonPoint*, CourseMap* self, u32 id) {
if (!self->mpCannonPoint || id >= self->mpCannonPoint->numEntries)
return CourseMap::getDummyCannonPoint();
return self->mpCannonPoint->entries[id];
}