mirror of
https://github.com/SwareJonge/mkdd.git
synced 2024-12-01 01:00:43 +00:00
update some old code
This commit is contained in:
parent
c12cd67cae
commit
1848f96c6b
@ -195,7 +195,7 @@ namespace JMath
|
||||
u32 seed;
|
||||
};
|
||||
template <typename T>
|
||||
class TRandom_ : TRandom_fast_
|
||||
class TRandom_ : public TRandom_fast_
|
||||
{
|
||||
public:
|
||||
TRandom_(u32 num) : TRandom_fast_(num){};
|
||||
|
@ -39,7 +39,8 @@ enum ECharID
|
||||
TOAD = 17,
|
||||
TOADETTE = 18,
|
||||
KING_BOO = 19,
|
||||
PETEY = 20
|
||||
PETEY = 20,
|
||||
cCharIDMax = 21
|
||||
};
|
||||
|
||||
enum EKartID {
|
||||
|
@ -11,11 +11,11 @@ public:
|
||||
void makeCRCTable();
|
||||
u32 getCRC(u8 *pBegin, u8 *pEndNext);
|
||||
|
||||
class FilePart {
|
||||
enum FilePart {
|
||||
|
||||
};
|
||||
|
||||
virtual void setPart(FilePart *); // 08
|
||||
virtual void setPart(FilePart); // 08
|
||||
virtual void fetch(); // 0C
|
||||
virtual void store(); // 10
|
||||
virtual void setCheckData(long, long); // 14
|
||||
|
32
include/Osako/SystemFIle.cpp
Normal file
32
include/Osako/SystemFIle.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef SYSTEMFILE_H
|
||||
#define SYSTEMFILE_H
|
||||
#include "Osako/SaveFile.h"
|
||||
|
||||
class SystemFile : public SaveFile {
|
||||
SystemFile();
|
||||
|
||||
virtual void setPart(FilePart *); // 08
|
||||
virtual void fetch(); // 0C
|
||||
virtual void store(); // 10
|
||||
virtual void setCheckData(long, long); // 14
|
||||
virtual void checkData(); // 18
|
||||
virtual int getAccessWay(); // 1C
|
||||
virtual char *getFileName(); // 20
|
||||
virtual int getFileNo(); // 24
|
||||
virtual int getBannerFormat(); // 28
|
||||
virtual long getCommentOffset(); // 2C
|
||||
virtual int getIconNum(); // 30
|
||||
virtual int getIconOffset(); // 34
|
||||
virtual int getIconFormat(); // 38
|
||||
virtual int getIconSpeed(); // 3C
|
||||
virtual int getIconAnim(); // 40
|
||||
virtual u8 *getBuf(); // 44
|
||||
virtual long getFileSize(); // 48
|
||||
virtual long getLength(); // 4C
|
||||
virtual long getOffset(); // 50
|
||||
virtual ~SystemFile(); // 54
|
||||
};
|
||||
|
||||
extern SystemFile gSystemFile;
|
||||
|
||||
#endif
|
@ -5,7 +5,10 @@
|
||||
#include "types.h"
|
||||
|
||||
struct TARecord {
|
||||
TARecord(); // inline
|
||||
TARecord() {
|
||||
mKartID = 0xff;
|
||||
mTime.reset();
|
||||
}
|
||||
TARecord(u8, u8, u8, u8);
|
||||
void setName(const char *);
|
||||
void setStatus(u8, u8, u8, u8);
|
||||
|
@ -6,28 +6,26 @@
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
#include "JSystem/JGeometry.h"
|
||||
|
||||
class stRandom : public JMath::TRandom_fast_ {
|
||||
public:
|
||||
static stRandom* sRndMgr[6];
|
||||
static stRandom* sMgr; // not sure if this get's accesssed by something else, more research needed
|
||||
struct stRandom : public JMath::TRandom_fast_ {
|
||||
stRandom() : JMath::TRandom_fast_(0) {
|
||||
permission = true;
|
||||
sMgr = this;
|
||||
};
|
||||
|
||||
static void createAllRandom();
|
||||
|
||||
u32 getRandomMax(u32 max);
|
||||
f32 getArbitUnitVec(JGeometry::TVec3<f32>&, f32, f32);
|
||||
f32 getArbitUnitVecSimple(JGeometry::TVec3<f32>&, f32);
|
||||
f32 getArbitUnitVecXZ(JGeometry::TVec3<f32>&, f32);
|
||||
private:
|
||||
u16 _0x4; // sin
|
||||
u16 _0x6; // cos
|
||||
void getArbitUnitVec(JGeometry::TVec3<f32> &, f32, f32);
|
||||
void getArbitUnitVecSimple(JGeometry::TVec3<f32> &, f32);
|
||||
void getArbitUnitVecXZ(JGeometry::TVec3<f32>&, f32);
|
||||
|
||||
static stRandom *sRndMgr[6];
|
||||
static stRandom *sMgr; // not sure if this get's accesssed by something else, more research needed
|
||||
|
||||
s16 _0x4; // sin
|
||||
s16 _0x6; // cos
|
||||
f32 _0x8; // angle?
|
||||
u8 _0xC[4]; // unknown
|
||||
u32 randomSeed;
|
||||
public:
|
||||
bool permission;
|
||||
// padding bytes
|
||||
};
|
||||
|
@ -266,7 +266,8 @@ void RaceInfo::setRaceLevel(ERaceLevel raceLvl)
|
||||
void RaceInfo::shuffleRandomSeed()
|
||||
{
|
||||
JMath::TRandom_<JMath::TRandom_fast_> rndm(mRandomSeed);
|
||||
mRandomSeed = ((JMath::TRandom_fast_)rndm).get();
|
||||
mRandomSeed = rndm.get();
|
||||
// randomSeed = JMath::TRandom_<JMath::TRandom_fast_>(randomSeed).get();
|
||||
}
|
||||
|
||||
void RaceInfo::shuffleStartNo()
|
||||
@ -275,7 +276,7 @@ void RaceInfo::shuffleStartNo()
|
||||
|
||||
for (u32 i = 0; i < (u32)getKartNumber(); i++)
|
||||
{
|
||||
u32 dst = i + (((JMath::TRandom_fast_)rndm).get() % (getKartNumber() - i));
|
||||
u32 dst = i + (rndm.get() % (getKartNumber() - i));
|
||||
JUT_MAX_ASSERT(751, dst, getKartNumber());
|
||||
s32 playerStartIdx = mStartPosIndex[i];
|
||||
mStartPosIndex[i] = mStartPosIndex[dst];
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
void stRandom::createAllRandom() {
|
||||
for (u32 i = 0; i < 6; i++) {
|
||||
stRandom::sRndMgr[i] = new stRandom();
|
||||
sRndMgr[i] = new stRandom();
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,41 +15,32 @@ u32 stRandom::getRandomMax(u32 max) {
|
||||
return ((max + 1) * get_ufloat_1());
|
||||
}
|
||||
|
||||
f32 stRandom::getArbitUnitVec(JGeometry::TVec3<f32>& p1, f32 p2, f32 p3) {
|
||||
void stRandom::getArbitUnitVec(JGeometry::TVec3<f32>& dst, f32 p2, f32 p3) {
|
||||
_0x4 = p2 * (32767.0f * (2.0f * get_ufloat_1() - 1.0f));
|
||||
_0x6 = p3 * (32767.0f * (2.0f * get_ufloat_1() - 1.0f));
|
||||
|
||||
_0x8 = JMath::sincosTable_.sinShort(_0x4);
|
||||
// according to ghidra it shifts 2 bytes to the right and doe an AND operation with 0x3ff8
|
||||
p1.x = _0x8 * JMath::sincosTable_.cosShort(_0x6);
|
||||
f32 ret = _0x8;
|
||||
p1.y = _0x8 * JMath::sincosTable_.sinShort(_0x6);
|
||||
p1.z = JMath::sincosTable_.cosShort(_0x4);
|
||||
return ret;
|
||||
_0x8 = JMASSin(_0x4);
|
||||
|
||||
dst.x = _0x8 * JMASCos(_0x6);
|
||||
dst.y = _0x8 * JMASSin(_0x6);
|
||||
dst.z = JMASCos(_0x4);
|
||||
}
|
||||
|
||||
f32 stRandom::getArbitUnitVecSimple(JGeometry::TVec3<f32>& p1, f32 p2) {
|
||||
f32 _1f = 1.0f; // for some reason this has to be declared as a variable
|
||||
|
||||
_0x4 = p2 * (2.0f * (32767.0f * get_ufloat_1() - _1f));
|
||||
_0x6 = _1f * (2.0f * (32767.0f * get_ufloat_1() - _1f));
|
||||
_0x8 = JMath::sincosTable_.sinShort(_0x4);
|
||||
|
||||
p1.x = _0x8 * JMath::sincosTable_.cosShort(_0x6);
|
||||
f32 ret = _0x8;
|
||||
p1.y = _0x8 * JMath::sincosTable_.sinShort(_0x6);
|
||||
p1.z = JMath::sincosTable_.cosShort(_0x4);
|
||||
return ret;
|
||||
// inline auto
|
||||
void stRandom::getArbitUnitVecSimple(JGeometry::TVec3<f32> &dst, f32 p2) {
|
||||
getArbitUnitVec(dst, p2, 1.0f);
|
||||
}
|
||||
|
||||
f32 stRandom::getArbitUnitVecXZ(JGeometry::TVec3<f32>& p1, f32 p2) {
|
||||
void stRandom::getArbitUnitVecXZ(JGeometry::TVec3<f32>& dst, f32 p2) {
|
||||
_0x4 = p2 * (32767.0f * (2.0f * get_ufloat_1() - 1.0f));
|
||||
|
||||
f32 ret = JMath::sincosTable_.sinShort(_0x4);
|
||||
p1.x = ret;
|
||||
p1.y = 0.0;
|
||||
p1.z = JMath::sincosTable_.cosShort(_0x4);
|
||||
return ret;
|
||||
dst.x = JMASSin(_0x4);
|
||||
dst.y = 0.0;
|
||||
dst.z = JMASCos(_0x4);
|
||||
}
|
||||
|
||||
stRandom *stGetRnd() {
|
||||
return stRandom::sMgr;
|
||||
}
|
||||
|
||||
stRandom *stGetRnd(u32 idx) {
|
||||
@ -58,5 +49,5 @@ stRandom *stGetRnd(u32 idx) {
|
||||
}
|
||||
|
||||
void stSetRndPermission(u32 idx, bool perm) {
|
||||
stRandom::sRndMgr[idx]->permission = perm; // i'm actually not sure at all if this is inlined,
|
||||
stRandom::sRndMgr[idx]->permission = perm;
|
||||
}
|
Loading…
Reference in New Issue
Block a user