prepare changes for KartChkUsrPage::draw

This commit is contained in:
SwareJonge 2022-07-30 22:37:58 +02:00
parent a53474d92a
commit 4b1d41613e
10 changed files with 283 additions and 24 deletions

View File

@ -45,6 +45,15 @@ global:
0x80069af4: getSDevice__12JUTAssertionFv
0x80069bd8: showAssert_f__12JUTAssertionFUlPCciPCce
# JUTDbPrint.cpp
0x8006b8c0: start__10JUTDbPrintFP7JUTFontP7JKRHeap
0x8006b964: changeFont__10JUTDbPrintFP7JUTFont
0x8006b97c: flush__10JUTDbPrintFv
0x8006b9b4: flush__10JUTDbPrintFiiii
0x8006bb10: drawString__10JUTDbPrintFiiiPCUc
0x8006bbf8: JUTReport__FiiPCce
0x8006bd1c: JUTReport__FiiiPCce
# JSUList.cpp
0x80078b2c: __ct__10JSUPtrLinkFPv
0x80078b44: __dt__10JSUPtrLinkFv

View File

@ -19,6 +19,7 @@ namespace JGeometry {
void add(const TVec3& operand);
void div(f32 divisor);
f32 dot(const TVec3& operand) const;
f32 length() const;
void negate();
void scale(f32 scale);
void scale(f32 scale, const TVec3& operand);

View File

@ -0,0 +1,26 @@
#ifndef COURSE_H
#define COURSE_H
#include "types.h"
class Course
{
public:
class Sector
{
public:
s32 isMainSector();
u8 getGeneration();
};
f32 getTrackSectorDist()
{
return mTrackSectorDist;
}
private:
u8 _0[0x514];
f32 mTrackSectorDist;
};
#endif

View File

@ -0,0 +1,33 @@
#ifndef CRSAREA_H
#define CRSAREA_H
#include "types.h"
#include "JSystem/JGeometry.h"
class CrsArea
{
public:
CrsArea();
void searchCamera(JGeometry::TVec3<f32> const &);
void searchLight(JGeometry::TVec3<f32> const &);
void searchRoof(JGeometry::TVec3<f32> const &);
void searchShadow(JGeometry::TVec3<f32> const &);
s32 getCameraID() const;
f32 getEchoRate();
s16 getLightParamID();
f32 getRate() const {
return mRate;
}
f32 getShadowRate() const {
return getRate();
}
private:
JGeometry::TVec3<f32> _0; // documented as "pos" in ghidra
void *mArea;
f32 mRate;
};
#endif

View File

@ -0,0 +1,70 @@
#ifndef CRSDATA_H
#define CRSDATA_H
#include "types.h"
#include "JSystem/JGeometry.h"
// add this to JSystem
struct TColor
{
u8 r;
u8 g;
u8 b;
u8 a;
};
class CrsData
{
public:
struct SOblHeader
{
char mMagic[4];
u8 mShaking;
u8 mAmbientColor[3];
TColor mLightColor;
JGeometry::TVec3<f32> mLightOffsetPos;
u8 mTotalLapNum;
u8 mCourseID;
u16 mCLPointNum;
u16 mCheckPathNum;
u16 ObjEntries;
u16 mAreaNum;
u16 mCameraNum;
u16 mPathNum;
u16 mJugemPointNum;
u8 mFogType;
u8 mFogColor[3];
f32 mFogStartZ;
f32 mFogEndZ;
u8 mTexLodBiasOn;
u8 mDummyStartLineOn;
u8 mSnowEnabled;
u8 mShadowDepth;
u8 mShadowColor[3];
u8 mStartPointNum;
u8 mSkyFollow;
u8 mLightParamNum;
u8 mMGParamNum;
u32 fileStart;
u32 mCLPointOffset;
u32 mCheckPathOffset;
u32 mPathOffset;
u32 mPointOffset;
u32 objectsOffset;
u32 mStartPointOffset;
u32 mAreaOffset;
u32 mCameraOffset;
u32 mJugemPointOffset;
u32 mLightParamOffset;
u32 mMGParamOffset;
u8 _70[0xc];
};
private:
void *BCO;
SOblHeader *BOL;
void *objList;
};
#endif

View File

@ -0,0 +1,46 @@
#ifndef CRSGROUND_H
#define CRSGROUND_H
#include "types.h"
#include "JSystem/JGeometry.h"
#include "Kaneshige/Course/Course.h"
class CrsGround
{
public:
CrsGround(Course *course = nullptr);
void reset();
void search(JGeometry::TVec3<f32> const &);
u8 getAddThickness(void) const;
void getVelocity(JGeometry::TVec3<f32> *) const;
s32 getMaterial() const;
s32 getAttrIndex() const;
s32 getAttribute() const;
u8 getSpiralCode() const;
u8 getSplashCode() const;
f32 getSplashHeight();
u8 getStaggerCode() const;
u8 getCameraCode() const;
private:
Course *mCourse;
JGeometry::TVec3<f32> _0x4;
JGeometry::TVec3<f32> _0x10;
bool _0x1c;
u8 _0x1d;
void *mGround;
void *mGeoObj;
JGeometry::TVec3<f32> mNormal;
JGeometry::TVec3<f32> mVelocity;
JGeometry::TVec3<f32> _0x40;
s32 _0x4c;
s32 _0x50;
s32 mMaterial;
f32 mHeight;
f32 _0x5C;
};
#endif

View File

@ -9,19 +9,32 @@
#include "Kaneshige/KartInfo.h"
#include "Kaneshige/RaceTime.h"
#include "Kaneshige/SysDebug.h"
#include "Osako/kartPad.h"
#include "Kaneshige/Course/Course.h"
#include "Osako/kartPad.h"
//#include "JugemPoint.h"
//#include "Course.h"
class KartChecker {
class KartChecker
{
public:
KartChecker(int, KartInfo *, int, int);
void KartChecker::printPass(int x, int y)
int getRank() const
{
return mRank;
}
bool isBestTotalTimeRenewal(int);
bool isBestLapTimeRenewal();
bool isLapRenewal() const
{
return mLapRenewal;
}
void printPass(int x, int y)
{
for (int i = 0; i < bitfieldCnt; i++)
{
@ -75,37 +88,37 @@ public:
void createGamePad(KartInfo *);
void reset();
private:
// private: // i'm not really sure how else KartChkUsrPage got acces to this
u16 raceFlags;
s16 kartIndex;
s32 sectorCount;
s32 bitfieldCnt;
s32 trackLapCount;
s32 _0x10; // i think this stores the index of the fastest lap
RaceTime* laptimes1;
RaceTime* laptimes2;
RaceTime *laptimes1;
RaceTime *laptimes2;
s32 playerKartColor;
KartGamePad* kartGamePad1;
KartGamePad *kartGamePad1;
KartGamePad *kartGamePad2;
bool mLapRenewal;
bool mRaceEnd;
u8 _0x2a; // only seems to get set in the constructor
u8 _0x2b; // probably padding
s32 lapIndex;
s32 mLap;
f32 sectorProgression;
s32 warpState;
s32 _0x38;
s32 sectorIndex;
void * sector1;
void * sector2;
f32 lapProgession;
f32 prevlapProgession;
Course::Sector *sector1;
Course::Sector *sector2;
f32 lapProgression;
f32 prevlapProgression;
f32 lapProgression2; // might be max Lap Progression
f32 raceProgression;
s32* cpBitfields; // seems to store what checkpoint have been passed
s32 *cpBitfields; // seems to store what checkpoint have been passed
JGeometry::TVec3<f32> curPos;
JGeometry::TVec3<f32> prevPos;
void * jugemPoint;
void *jugemPoint;
bool _0x78; // true = in race | false = finished
u8 _0x79[3];
s32 curFrame;
@ -129,8 +142,10 @@ private:
class KartChkUsrPage : public SysDbUsrPage
{
public:
public:
KartChkUsrPage(KartChecker *kartChecker);
virtual ~KartChkUsrPage();
virtual void draw();
private:
KartChecker *mKartChecker;

View File

@ -9,6 +9,8 @@
#include "Kaneshige/RaceTime.h"
#include "Kaneshige/KartChecker.h"
#include "Kaneshige/Course/Course.h"
class RaceMgr : JKRDisposer {
public:
RaceMgr(RaceInfo *);
@ -23,7 +25,7 @@ public:
class Console {
public:
Console();
void changeTargetNo(s32, bool);
void changeTargetNo(int, bool);
private:
s32 _0x0;
u8 _0x4;
@ -35,6 +37,10 @@ public:
return sRaceManager;
}*/
Course * getCourse() const; /*
return course;
*/
ERaceMode getRaceMode() const; /*{
return raceInfo->getRaceMode();
}*/
@ -54,7 +60,7 @@ private:
RaceInfo * raceInfo;
void * raceBGMPlayer;
Console * console;
void * course;
Course * course;
KartChecker * kartChecker[8];
void * kartLoader[8];
void * staffRoll2D;
@ -71,8 +77,10 @@ private:
s16 proctime2;
s16 proctime3;
s16 proctime4;
};
Course * RCMGetCourse() { // might be inline off, auto?(Kameda)
return RaceMgr::getManager()->getCourse();
}
#endif // RACEMGR_H

View File

@ -1,4 +1,4 @@
#include "Kaneshige/GeoRabbitMark.h"
/*#include "Kaneshige/GeoRabbitMark.h"
u16 GeoRabbitMark::sSupervisorCreateNum;
GeoRabbitMark * GeoRabbitMark::sSupervisor;
GeoRabbitMark * GeoRabbitMark::sSupervisor;*/

View File

@ -3,11 +3,62 @@
#include "Kaneshige/RaceMgr.h"
#include "Kaneshige/GeoRabbitMark.h"
#include "Kaneshige/Course/CrsGround.h"
#include "Kaneshige/Course/CrsArea.h"
/*KartChkUsrPage::KartChkUsrPage(KartChecker *kartChecker)
{
mKartChecker = kartChecker;
}
void KartChkUsrPage::draw() {
CrsGround ground;
ground.search(mKartChecker->curPos);
JGeometry::TVec3<f32> vel;
ground.getVelocity(&vel);
CrsArea shadow;
shadow.searchShadow(mKartChecker->curPos);
CrsArea roof;
roof.searchRoof(mKartChecker->curPos);
CrsArea camera;
camera.searchCamera(mKartChecker->curPos);
CrsArea light;
light.searchLight(mKartChecker->curPos);
JUTReport(40, 80, "CRS: %f", RCMGetCourse()->getTrackSectorDist());
mKartChecker->printPass(80, 100);
JUTReport(280, 30, "ALL %08d", mKartChecker->sectorCount);
JUTReport(280,50, "LNEW %08X", mKartChecker->isLapRenewal());
JUTReport(280,70, "TAR %08d", mKartChecker->sectorIndex);
if(mKartChecker->sector2 ) {
JUTReport(280, 90, "CUR %08d:%f:%d", mKartChecker->sector2->isMainSector(), mKartChecker->sectorProgression,
mKartChecker->sector2->getGeneration());
}
JUTReport(280, 110, "U/T %f", mKartChecker->lapProgression);
JUTReport(280, 130, "TUD %f", mKartChecker->raceProgression);
JUTReport(280, 150, "LAP %4d", mKartChecker->mLap);
JUTReport(180, 170, "POS %8.3f,%8.3f,%8.3f", mKartChecker->curPos.x, mKartChecker->curPos.y, mKartChecker->curPos.z);
JUTReport(280,190, "GND %04d:%3d:%02x", ground.getAttribute(), ground.getAttrIndex(), ground.getMaterial());
JUTReport(280,210, "SPL%03d:SPI%03d", ground.getSplashCode(), ground.getSpiralCode());
JUTReport(280,230, "SPHT %8.3f", ground.getSplashHeight());
JUTReport(280,250, "ECHO %8.3f", roof.getEchoRate());
JUTReport(280,270, "CD:C%3d:S%3d", ground.getCameraCode(), ground.getStaggerCode());
JUTReport(280,290, "CAM %3d", camera.getCameraID());
JUTReport(280,310, "VEL %8.3f", vel.length());
JUTReport(280,330, "LIGHT%8.3f:%d", light.getRate() , light.getLightParamID());
JUTReport(280,350, "SHD %8.3f", shadow.getShadowRate());
JUTReport(280,370, "ADD %2d", ground.getAddThickness());
JUTReport(280,390, "LAP%1d:TOTAL%1d", mKartChecker->isBestLapTimeRenewal(), mKartChecker->isBestTotalTimeRenewal(0));
JUTReport(280,410, "RANK %1d", mKartChecker->getRank());
}*/
KartChecker::KartChecker(int kartNum, KartInfo *kartInfo, int sectorNum, int lapNum)
{
raceFlags = 0;