decompile CenterLine

This commit is contained in:
SwareJonge 2023-08-22 15:41:56 +02:00
parent cd78aef516
commit 5b93c8253e
9 changed files with 185 additions and 6 deletions

View File

@ -613,6 +613,9 @@ src/Kaneshige/ScrnShot.cpp:
.text: [0x801b4764, 0x801b4860] .text: [0x801b4764, 0x801b4860]
.sbss: [0x804163c0, 0x804163c8] .sbss: [0x804163c0, 0x804163c8]
src/Kaneshige/CenterLine.cpp:
.text: [0x801b4e4c, 0x801b5098]
src/Kaneshige/RaceInfo.cpp: src/Kaneshige/RaceInfo.cpp:
.text: [0x801b5098, 0x801b5e14] # excludes __sinit_RaceInfo_cpp and __dt__8RaceInfoFv .text: [0x801b5098, 0x801b5e14] # excludes __sinit_RaceInfo_cpp and __dt__8RaceInfoFv
#.ctors: [0x8031628c, 0x80316290] #.ctors: [0x8031628c, 0x80316290]

View File

@ -587,6 +587,9 @@ src/Kaneshige/RaceMgr.cpp:
.sbss: [0x803d5628, 0x803d5630] .sbss: [0x803d5628, 0x803d5630]
.sdata2: [0x803d8740, 0x803d8838] .sdata2: [0x803d8740, 0x803d8838]
src/Kaneshige/Centerline.cpp:
.text: [0x8018b004, 0x8018b298]
src/Kaneshige/RaceInfo.cpp: src/Kaneshige/RaceInfo.cpp:
.text: [0x8018b298, 0x8018b954] # exclude sinit and dtor .text: [0x8018b298, 0x8018b954] # exclude sinit and dtor
.rodata: [0x8033d518, 0x8033d558] .rodata: [0x8033d518, 0x8033d558]

View File

@ -2250,6 +2250,15 @@ global:
0x80355b3c: __vt__8LightObj 0x80355b3c: __vt__8LightObj
0x803d5638: sLightManager__8LightMgr 0x803d5638: sLightManager__8LightMgr
# CenterLine.cpp
0x8018b004: __ct__7CLPointFv
0x8018b038: setPrevPoint__7CLPointFP7CLPoint
0x8018b078: setNextPoint__7CLPointFP7CLPoint
0x8018b0b8: getPrevPointNumber__7CLPointFv
0x8018b0ec: getNextPointNumber__7CLPointFv
0x8018b120: getBrosPointNumber__7CLPointFv
0x8018b1d4: getBrosPoint__7CLPointFi
# RaceInfo.cpp # RaceInfo.cpp
0x8018b298: reset__8RaceInfoFv 0x8018b298: reset__8RaceInfoFv
0x8018b3d8: setConsoleTarget__8RaceInfoFiib 0x8018b3d8: setConsoleTarget__8RaceInfoFiib

View File

@ -1,19 +1,43 @@
#ifndef CENTERLINE_H #ifndef CENTERLINE_H
#define CENTERLINE_H #define CENTERLINE_H
#include <JSystem/JGeometry.h>
#include <JSystem/JUtility/JUTDbg.h>
#include "Kaneshige/Course/CrsData.h"
class CLPoint class CLPoint
{ {
public: public:
CLPoint(); CLPoint();
void setPrevPoint(CLPoint *); bool setPrevPoint(CLPoint *);
void setNextPoint(CLPoint *); bool setNextPoint(CLPoint *);
int getPrevPointNumber(); int getPrevPointNumber();
int getNextPointNumber(); int getNextPointNumber();
int getBrosPointNumber(); int getBrosPointNumber();
int getBrosPoint(int); CLPoint *getBrosPoint(int);
// Inline
CLPoint *getPrevPoint(int divNo)
{
#line 84
JUT_ASSERT_F(mNextPoints[divNo], "P:%5.3f,%5.3f,%5.3f:%d", mPointData->mPos.x, mPointData->mPos.y, mPointData->mPos.z, divNo);
JUT_MINMAX_ASSERT(0, divNo, 4);
return mPrevPoints[divNo];
}
CLPoint *getNextPoint(int divNo)
{
JUT_ASSERT_F(mNextPoints[divNo], "N:%5.3f,%5.3f,%5.3f:%d", mPointData->mPos.x, mPointData->mPos.y, mPointData->mPos.z, divNo);
JUT_MINMAX_ASSERT(0, divNo, 4);
return mNextPoints[divNo];
}
CLPoint *getDivPoint() { return mDivPoint; }
private: private:
// TODO u16 mKind;
}; CrsData::SCLPoint *mPointData;
CLPoint *mPrevPoints[4];
CLPoint *mNextPoints[4];
CLPoint *mDivPoint;
}; // Size: 0x2c
#endif #endif

View File

@ -78,6 +78,25 @@ public:
u8 _70[0xc]; u8 _70[0xc];
}; };
// https://mkdd.miraheze.org/wiki/BOL_(File_Format)#Section_1
struct SCLPoint
{
//SCLPoint() : mPos() { }
JGeometry::TVec3f mPos;
u16 mDriftDir;
s16 mGroupID;
f32 mScale;
char mSwerve;
u8 mGroupSetting;
u8 mUniqueGroupID;
u8 mDriftAcuteness;
u8 mDriftDuration;
u8 mDriftSupplement;
u8 mIsNoMushroomZone;
u8 pad[5];
}; // Size: 0x20
struct SObject struct SObject
{ {
// TODO // TODO

View File

@ -18,7 +18,7 @@ public:
void DoSearchRescueTarget(CLPoint *); void DoSearchRescueTarget(CLPoint *);
private: private:
// TODO CLPoint *mTargetPoint;
}; };
#endif #endif

View File

@ -0,0 +1,119 @@
#include "Kaneshige/CenterLine.h"
CLPoint::CLPoint()
{
mKind = 0;
mPointData = nullptr;
mDivPoint = nullptr;
for (int i = 0; i < 4; i++)
{
mPrevPoints[i] = nullptr;
mNextPoints[i] = nullptr;
}
}
bool CLPoint::setPrevPoint(CLPoint *prev)
{
bool ret = false;
for (int i = 0; i < 4; i++)
{
if (mPrevPoints[i] == nullptr)
{
mPrevPoints[i] = prev;
ret = true;
break;
}
}
return ret;
}
bool CLPoint::setNextPoint(CLPoint *next)
{
bool ret = false;
for (int i = 0; i < 4; i++)
{
if (mNextPoints[i] == nullptr)
{
mNextPoints[i] = next;
ret = true;
break;
}
}
return ret;
}
int CLPoint::getPrevPointNumber()
{
int cnt = 0;
for (int i = 0; i < 4; i++)
{
if (mPrevPoints[i] != nullptr)
{
cnt++;
}
}
return cnt;
}
int CLPoint::getNextPointNumber()
{
int cnt = 0;
for (int i = 0; i < 4; i++)
{
if (mNextPoints[i] != nullptr)
{
cnt++;
}
}
return cnt;
}
int CLPoint::getBrosPointNumber()
{
int cnt = 0;
int prevPointCnt = getPrevPointNumber();
for (int i = 0; i < prevPointCnt; i++)
{
CLPoint *prev = getPrevPoint(i);
int nextCnt = prev->getNextPointNumber();
for (int j = 0; j < nextCnt; j++)
{
if (prev->getNextPoint(j) != this)
{
cnt++;
}
}
}
return cnt;
}
CLPoint *CLPoint::getBrosPoint(int cnt)
{
int brosPoints = 0;
int prevPointCnt = getPrevPointNumber();;
for (int i = 0; i < prevPointCnt; i++)
{
CLPoint *prev = getPrevPoint(i);
int nextCnt = prev->getNextPointNumber();
for (int j = 0; j < nextCnt; j++)
{
CLPoint *next = prev->getNextPoint(j);
if (next != this)
{
if (brosPoints == cnt)
{
return next;
}
brosPoints++;
}
}
}
return nullptr;
}

View File

@ -1,5 +1,7 @@
#include "Kaneshige/Course/Course.h" #include "Kaneshige/Course/Course.h"
// WIP, not actively working on
void Course::Sector::calcGeneration(Course::Sector * sector) { void Course::Sector::calcGeneration(Course::Sector * sector) {
Sector * cur; Sector * cur;