A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Kinoko::System::CourseMap Class Reference0x809BD6E8

#include <CourseMap.hh>

Description

Contains course metadata, notably the starting position.

Definition at line 35 of file CourseMap.hh.

Inheritance diagram for Kinoko::System::CourseMap:

Public Member Functions

void init ()
template<MapdataDerived T>
T * parseMapdata (u32 sectionName) const
s16 findSector (const EGG::Vector3f &pos, u16 checkpointIdx, f32 &distanceRatio)
s16 findRecursiveSector (const EGG::Vector3f &pos, s16 depth, bool searchBackwardsFirst, MapdataCheckPoint *checkpoint, f32 &completion, bool playerIsForwards) const

Static Public Member Functions

static CourseMap * CreateInstance ()
static void DestroyInstance ()
static CourseMap * Instance ()

Getters

u16 getCheckPointEntryOffsetMs (u16 i, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos) const
f32 getCheckPointEntryOffsetExact (u16 i, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos) const
s16 getCurrentAreaID (s16 i, const EGG::Vector3f &pos, MapdataAreaBase::Type type) const
MapdataCannonPoint * getCannonPoint (u16 i) const
MapdataCheckPath * getCheckPath (u16 i) const
MapdataCheckPoint * getCheckPoint (u16 i) const
MapdataGeoObj * getGeoObj (u16 i) const
MapdataAreaBase * getArea (u16 i) const
MapdataAreaBase * getAreaSorted (u16 i) const
MapdataPointInfo * getPointInfo (u16 i) const
MapdataJugemPoint * getJugemPoint (u16 i) const
MapdataStageInfo * getStageInfo () const
MapdataStartPoint * getStartPoint (u16 i) const
u16 getCannonPointCount () const
u16 getCheckPathCount () const
u16 getCheckPointCount () const
u16 getGeoObjCount () const
u16 getAreaCount () const
u16 getPointInfoCount () const
u16 getJugemPointCount () const
u16 getStageInfoCount () const
u16 getStartPointCount () const
u32 version () const
MapdataCheckPathAccessor * checkPath () const
MapdataCheckPointAccessor * checkPoint () const
f32 startTmpAngle () const
f32 startTmp0 () const
f32 startTmp1 () const
f32 startTmp2 () const
f32 startTmp3 () const

Private Member Functions

s16 findSectorBetweenSides (const EGG::Vector3f &pos, MapdataCheckPoint *checkpoint, f32 &distanceRatio)
s16 findSectorOutsideSector (const EGG::Vector3f &pos, MapdataCheckPoint *checkpoint, f32 &distanceRatio)
s16 findSectorRegional (const EGG::Vector3f &pos, MapdataCheckPoint *checkpoint, f32 &distanceRatio)
s16 searchNextCheckpoint (const EGG::Vector3f &pos, s16 depth, const MapdataCheckPoint *checkpoint, f32 &completion, bool playerIsForwards, bool useCache) const
s16 searchPrevCheckpoint (const EGG::Vector3f &pos, s16 depth, const MapdataCheckPoint *checkpoint, f32 &completion, bool playerIsForwards, bool useCache) const
void clearSectorChecked ()

Static Private Member Functions

static void * LoadFile (const char *filename)
Static Private Member Functions inherited from Kinoko::EGG::Disposer
static constexpr u16 getLinkOffset ()

Private Attributes

MapdataFileAccessor * m_course
MapdataStartPointAccessor * m_startPoint
MapdataCheckPathAccessor * m_checkPath
MapdataCheckPointAccessor * m_checkPoint
MapdataPointInfoAccessor * m_pointInfo
MapdataGeoObjAccessor * m_geoObj
MapdataAreaAccessor * m_area
MapdataJugemPointAccessor * m_jugemPoint
MapdataCannonPointAccessor * m_cannonPoint
MapdataStageInfoAccessor * m_stageInfo
f32 m_startTmpAngle
f32 m_startTmp0
f32 m_startTmp1
f32 m_startTmp2
f32 m_startTmp3
u32 m_sectorSearchId
 Identifies the current sector search for MapdataCheckPoint::searched().
bool m_hasMovingRoadArea
 Whether the loaded course has a moving road AREA.

Static Private Attributes

static CourseMap * s_instance = nullptr

Constructor & Destructor Documentation

◆ CourseMap()

Kinoko::System::CourseMap::CourseMap ( )
private0x8051276C

Definition at line 242 of file CourseMap.cc.

Member Function Documentation

◆ ~CourseMap()

Kinoko::System::CourseMap::~CourseMap ( )
overrideprivate0x805127AC

Definition at line 248 of file CourseMap.cc.

◆ checkPath()

MapdataCheckPathAccessor * Kinoko::System::CourseMap::checkPath ( ) const
inlinenodiscard

Definition at line 151 of file CourseMap.hh.

◆ checkPoint()

MapdataCheckPointAccessor * Kinoko::System::CourseMap::checkPoint ( ) const
inlinenodiscard

Definition at line 155 of file CourseMap.hh.

◆ clearSectorChecked()

void Kinoko::System::CourseMap::clearSectorChecked ( )
private0x80511E00
Note
Rather than clearing every checkpoint, we can introduce a performance improvement for Kinoko by leveraging m_sectorSearchId to indicate a new search is being performed. This way, we don't need to explicitly clear a "searched" flag for each checkpoint.

Definition at line 507 of file CourseMap.cc.

◆ CreateInstance()

CourseMap * Kinoko::System::CourseMap::CreateInstance ( )
static0x80512694

Definition at line 227 of file CourseMap.cc.

◆ DestroyInstance()

void Kinoko::System::CourseMap::DestroyInstance ( )
static0x8051271C

Definition at line 234 of file CourseMap.cc.

◆ findRecursiveSector()

s16 Kinoko::System::CourseMap::findRecursiveSector ( const EGG::Vector3f & pos,
s16 depth,
bool searchBackwardsFirst,
MapdataCheckPoint * checkpoint,
f32 & completion,
bool playerIsForwards ) const
nodiscard0x80511110

Definition at line 100 of file CourseMap.cc.

◆ findSector()

s16 Kinoko::System::CourseMap::findSector ( const EGG::Vector3f & pos,
u16 checkpointIdx,
f32 & distanceRatio )
nodiscard0x80511500

Definition at line 64 of file CourseMap.cc.

◆ findSectorBetweenSides()

s16 Kinoko::System::CourseMap::findSectorBetweenSides ( const EGG::Vector3f & pos,
MapdataCheckPoint * checkpoint,
f32 & distanceRatio )
nodiscardprivate

Definition at line 266 of file CourseMap.cc.

◆ findSectorOutsideSector()

s16 Kinoko::System::CourseMap::findSectorOutsideSector ( const EGG::Vector3f & pos,
MapdataCheckPoint * checkpoint,
f32 & distanceRatio )
nodiscardprivate

Definition at line 370 of file CourseMap.cc.

◆ findSectorRegional()

s16 Kinoko::System::CourseMap::findSectorRegional ( const EGG::Vector3f & pos,
MapdataCheckPoint * checkpoint,
f32 & distanceRatio )
nodiscardprivate

Definition at line 434 of file CourseMap.cc.

◆ getArea()

MapdataAreaBase * Kinoko::System::CourseMap::getArea ( u16 i) const
inlinenodiscard0x80516768

Definition at line 81 of file CourseMap.hh.

◆ getAreaCount()

u16 Kinoko::System::CourseMap::getAreaCount ( ) const
inlinenodiscard0x80512CB4

Definition at line 127 of file CourseMap.hh.

◆ getAreaSorted()

MapdataAreaBase * Kinoko::System::CourseMap::getAreaSorted ( u16 i) const
inlinenodiscard0x805167B4

Definition at line 86 of file CourseMap.hh.

◆ getCannonPoint()

MapdataCannonPoint * Kinoko::System::CourseMap::getCannonPoint ( u16 i) const
inlinenodiscard0x80518AE0

Definition at line 61 of file CourseMap.hh.

◆ getCannonPointCount()

u16 Kinoko::System::CourseMap::getCannonPointCount ( ) const
inlinenodiscard

Definition at line 110 of file CourseMap.hh.

◆ getCheckPath()

MapdataCheckPath * Kinoko::System::CourseMap::getCheckPath ( u16 i) const
inlinenodiscard0x80515C70

Definition at line 66 of file CourseMap.hh.

◆ getCheckPathCount()

u16 Kinoko::System::CourseMap::getCheckPathCount ( ) const
inlinenodiscard

Definition at line 114 of file CourseMap.hh.

◆ getCheckPoint()

MapdataCheckPoint * Kinoko::System::CourseMap::getCheckPoint ( u16 i) const
inlinenodiscard0x80515C24

Definition at line 71 of file CourseMap.hh.

◆ getCheckPointCount()

u16 Kinoko::System::CourseMap::getCheckPointCount ( ) const
inlinenodiscard

Definition at line 118 of file CourseMap.hh.

◆ getCheckPointEntryOffsetExact()

f32 Kinoko::System::CourseMap::getCheckPointEntryOffsetExact ( u16 i,
const EGG::Vector3f & pos,
const EGG::Vector3f & prevPos ) const
nodiscard

Definition at line 189 of file CourseMap.cc.

◆ getCheckPointEntryOffsetMs()

u16 Kinoko::System::CourseMap::getCheckPointEntryOffsetMs ( u16 i,
const EGG::Vector3f & pos,
const EGG::Vector3f & prevPos ) const
nodiscard0x80511E7C

Definition at line 179 of file CourseMap.cc.

◆ getCurrentAreaID()

s16 Kinoko::System::CourseMap::getCurrentAreaID ( s16 i,
const EGG::Vector3f & pos,
MapdataAreaBase::Type type ) const
nodiscard0x80516808

Definition at line 200 of file CourseMap.cc.

◆ getGeoObj()

MapdataGeoObj * Kinoko::System::CourseMap::getGeoObj ( u16 i) const
inlinenodiscard0x80514148

Definition at line 76 of file CourseMap.hh.

◆ getGeoObjCount()

u16 Kinoko::System::CourseMap::getGeoObjCount ( ) const
inlinenodiscard

Definition at line 122 of file CourseMap.hh.

◆ getJugemPoint()

MapdataJugemPoint * Kinoko::System::CourseMap::getJugemPoint ( u16 i) const
inlinenodiscard0x80518920

Definition at line 96 of file CourseMap.hh.

◆ getJugemPointCount()

u16 Kinoko::System::CourseMap::getJugemPointCount ( ) const
inlinenodiscard

Definition at line 135 of file CourseMap.hh.

◆ getPointInfo()

MapdataPointInfo * Kinoko::System::CourseMap::getPointInfo ( u16 i) const
inlinenodiscard0x80515E04

Definition at line 91 of file CourseMap.hh.

◆ getPointInfoCount()

u16 Kinoko::System::CourseMap::getPointInfoCount ( ) const
inlinenodiscard

Definition at line 131 of file CourseMap.hh.

◆ getStageInfo()

MapdataStageInfo * Kinoko::System::CourseMap::getStageInfo ( ) const
inlinenodiscard0x80518B78

Definition at line 101 of file CourseMap.hh.

◆ getStageInfoCount()

u16 Kinoko::System::CourseMap::getStageInfoCount ( ) const
inlinenodiscard

Definition at line 139 of file CourseMap.hh.

◆ getStartPoint()

MapdataStartPoint * Kinoko::System::CourseMap::getStartPoint ( u16 i) const
inlinenodiscard0x80514B30

Definition at line 106 of file CourseMap.hh.

◆ getStartPointCount()

u16 Kinoko::System::CourseMap::getStartPointCount ( ) const
inlinenodiscard

Definition at line 143 of file CourseMap.hh.

◆ init()

void Kinoko::System::CourseMap::init ( )
0x805127EC

Definition at line 8 of file CourseMap.cc.

◆ Instance()

CourseMap * Kinoko::System::CourseMap::Instance ( )
inlinestaticnodiscard

Definition at line 183 of file CourseMap.hh.

◆ LoadFile()

void * Kinoko::System::CourseMap::LoadFile ( const char * filename)
staticprivate0x809BD6E80x80512C10

Definition at line 520 of file CourseMap.cc.

◆ parseMapdata()

template<MapdataDerived T>
T * Kinoko::System::CourseMap::parseMapdata ( u32 sectionName) const
inlinenodiscard

Definition at line 42 of file CourseMap.hh.

◆ searchNextCheckpoint()

s16 Kinoko::System::CourseMap::searchNextCheckpoint ( const EGG::Vector3f & pos,
s16 depth,
const MapdataCheckPoint * checkpoint,
f32 & completion,
bool playerIsForwards,
bool useCache ) const
nodiscardprivate0x80510F58

Definition at line 460 of file CourseMap.cc.

◆ searchPrevCheckpoint()

s16 Kinoko::System::CourseMap::searchPrevCheckpoint ( const EGG::Vector3f & pos,
s16 depth,
const MapdataCheckPoint * checkpoint,
f32 & completion,
bool playerIsForwards,
bool useCache ) const
nodiscardprivate0x80511034

Definition at line 482 of file CourseMap.cc.

◆ startTmp0()

f32 Kinoko::System::CourseMap::startTmp0 ( ) const
inlinenodiscard

Definition at line 163 of file CourseMap.hh.

◆ startTmp1()

f32 Kinoko::System::CourseMap::startTmp1 ( ) const
inlinenodiscard

Definition at line 167 of file CourseMap.hh.

◆ startTmp2()

f32 Kinoko::System::CourseMap::startTmp2 ( ) const
inlinenodiscard

Definition at line 171 of file CourseMap.hh.

◆ startTmp3()

f32 Kinoko::System::CourseMap::startTmp3 ( ) const
inlinenodiscard

Definition at line 175 of file CourseMap.hh.

◆ startTmpAngle()

f32 Kinoko::System::CourseMap::startTmpAngle ( ) const
inlinenodiscard

Definition at line 159 of file CourseMap.hh.

◆ version()

u32 Kinoko::System::CourseMap::version ( ) const
inlinenodiscard

Definition at line 147 of file CourseMap.hh.

Member Data Documentation

◆ m_area

MapdataAreaAccessor* Kinoko::System::CourseMap::m_area
private

Definition at line 213 of file CourseMap.hh.

◆ m_cannonPoint

MapdataCannonPointAccessor* Kinoko::System::CourseMap::m_cannonPoint
private

Definition at line 215 of file CourseMap.hh.

◆ m_checkPath

MapdataCheckPathAccessor* Kinoko::System::CourseMap::m_checkPath
private

Definition at line 209 of file CourseMap.hh.

◆ m_checkPoint

MapdataCheckPointAccessor* Kinoko::System::CourseMap::m_checkPoint
private

Definition at line 210 of file CourseMap.hh.

◆ m_course

MapdataFileAccessor* Kinoko::System::CourseMap::m_course
private

Definition at line 207 of file CourseMap.hh.

◆ m_geoObj

MapdataGeoObjAccessor* Kinoko::System::CourseMap::m_geoObj
private

Definition at line 212 of file CourseMap.hh.

◆ m_hasMovingRoadArea

bool Kinoko::System::CourseMap::m_hasMovingRoadArea
private

Whether the loaded course has a moving road AREA.

This is a performance optimization for Kinoko which lets getCurrentAreaID() skip searching for AREA types that are not present in the course.

Definition at line 234 of file CourseMap.hh.

◆ m_jugemPoint

MapdataJugemPointAccessor* Kinoko::System::CourseMap::m_jugemPoint
private

Definition at line 214 of file CourseMap.hh.

◆ m_pointInfo

MapdataPointInfoAccessor* Kinoko::System::CourseMap::m_pointInfo
private

Definition at line 211 of file CourseMap.hh.

◆ m_sectorSearchId

u32 Kinoko::System::CourseMap::m_sectorSearchId
private

Identifies the current sector search for MapdataCheckPoint::searched().

This is a performance optimization for Kinoko. Rather than clearing the "searched" flag for every checkpoint whenever we call findSector(), we can instead store an ID that represents the last time the sector was searched.

Definition at line 229 of file CourseMap.hh.

◆ m_stageInfo

MapdataStageInfoAccessor* Kinoko::System::CourseMap::m_stageInfo
private

Definition at line 216 of file CourseMap.hh.

◆ m_startPoint

MapdataStartPointAccessor* Kinoko::System::CourseMap::m_startPoint
private

Definition at line 208 of file CourseMap.hh.

◆ m_startTmp0

f32 Kinoko::System::CourseMap::m_startTmp0
private

Definition at line 220 of file CourseMap.hh.

◆ m_startTmp1

f32 Kinoko::System::CourseMap::m_startTmp1
private

Definition at line 221 of file CourseMap.hh.

◆ m_startTmp2

f32 Kinoko::System::CourseMap::m_startTmp2
private

Definition at line 222 of file CourseMap.hh.

◆ m_startTmp3

f32 Kinoko::System::CourseMap::m_startTmp3
private

Definition at line 223 of file CourseMap.hh.

◆ m_startTmpAngle

f32 Kinoko::System::CourseMap::m_startTmpAngle
private

Definition at line 219 of file CourseMap.hh.

◆ s_instance

CourseMap * Kinoko::System::CourseMap::s_instance = nullptr
staticprivate0x809BD6E8

Definition at line 238 of file CourseMap.hh.