I should be (almost) done

This commit is contained in:
SwareJonge 2022-08-16 16:10:23 +02:00
parent 4b64852712
commit 223459f47a
14 changed files with 200 additions and 45 deletions

View File

@ -30,13 +30,13 @@ Kaneshige/KartInfo.cpp:
.data: [0x80395bf0, 0x80395c98]
.sdata2: [0x80419dc8, 0x80419dd0]
#Kaneshige/KartChecker.cpp:
#.text: [0x801a9040, 0x801ac5a0]
#.rodata: [0x80377378, 0x80377640]
#.data: [0x80395c98, 0x80395cd8]
#.sdata: [0x80414618, 0x80414628]
#.sbss: [0x804163a0, 0x804163a8]
#.sdata2: [0x80419dd0, 0x80419e18]
Kaneshige/KartChecker.cpp:
.text: [0x801a9040, 0x801ac5a0]
.rodata: [0x80377378, 0x80377640]
.data: [0x80395c98, 0x80395cd8]
.sdata: [0x80414618, 0x80414628]
.sbss: [0x804163a0, 0x804163a8]
.sdata2: [0x80419dd0, 0x80419e18]
Kaneshige/RaceInfo.cpp:
.text: [0x801b5098, 0x801b5e14] # excludes __sinit_RaceInfo_cpp and __dt__8RaceInfoFv

View File

@ -524,4 +524,6 @@ global:
# kartCtrlInfo.cpp
0x802f2994: GetBodyPos__8KartCtrlFiPQ29JGeometry8TVec3<f>
0x802f34dc: GetKartSoundMgr__8KartCtrlFi
0x802f34dc: GetKartSoundMgr__8KartCtrlFi
0x80416b50: gItemMgr__10ItemObjMgr

View File

@ -0,0 +1,14 @@
#ifndef GAMEAUDIOMAIN_H
#define GAMEAUDIOMAIN_H
#include "types.h"
namespace GameAudio {
class Main {
public:
static Main * getAudio();
void startSystemSe(u32);
};
}
#endif

View File

@ -4,6 +4,7 @@
#include "types.h"
#include "JSystem/JAudio/JAUSoundObject.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JMath/JMath.h"
namespace GameAudio
{

View File

@ -10,21 +10,21 @@ public:
virtual ~JKRHeap();
virtual void callAllDisposer();
virtual s32 getHeapType() = 0;
virtual void check() = 0;
virtual s32 getHeapType();
virtual void check();
virtual s32 dump_sort();
virtual JKRHeap* dump() = 0;
virtual void do_destroy() = 0;
virtual void* do_alloc(u32, s32) = 0;
virtual void do_free(void *) = 0;
virtual void do_freeAll() = 0;
virtual void do_freeTail() = 0;
virtual void do_fillFreeArea() = 0;
virtual s32 do_resize(void *, u32) = 0;
virtual s32 do_getSize(void *) = 0;
virtual s32 do_getFreeSize() = 0;
virtual s32 do_getMaxFreeBlock() = 0;
virtual s32 do_getTotalFreeSize() = 0;
virtual JKRHeap* dump();
virtual void do_destroy();
virtual void* do_alloc(u32, s32);
virtual void do_free(void *);
virtual void do_freeAll();
virtual void do_freeTail();
virtual void do_fillFreeArea();
virtual s32 do_resize(void *, u32);
virtual s32 do_getSize(void *);
virtual s32 do_getFreeSize();
virtual s32 do_getMaxFreeBlock();
virtual s32 do_getTotalFreeSize();
u32 initArena(char **, u32 *, s32);
JKRHeap* becomeSystemHeap();

View File

@ -8,16 +8,22 @@
class GeoRabbitMarkSupervisor
{
public:
void release();
void release();
int getRabbitKartNo();
short getWinFrame() const
{
return mWinFrame * 60;
return mWinTime * 60;
}
short getWinTime() const
{
return mWinTime;
}
void startWinnerEffect();
private:
u8 _0[0x40];
s16 mWinFrame;
s16 mWinTime;
};
class GeoRabbitMark

View File

@ -14,11 +14,18 @@
#include "Osako/kartPad.h"
#include "Sato/ItemObj.h"
#define MAX_FRAME 2147483
class KartChecker
{
public:
enum EBombEvent {
EVENT_1,
EVENT_2,
EVENT_3
};
KartChecker(int, KartInfo *, int, int);
void clrPass(int sectoridx)
@ -226,7 +233,7 @@ public:
bool isMaxTotalTime() const
{
return mTotalTime.isAvailable();
return !mTotalTime.isAvailable();
}
bool isUDValid();
@ -243,12 +250,32 @@ public:
int getRobberyItemNumber();
bool releaseRabbitMark();
bool isRabbit() const;
void calcRabbitTime();
static int sPlayerKartColorTable[];
static short sBombPointFull;
void resumeRabbitTimer() {
battleFlags &= 0xfffe;
}
bool tstStillRabbitTimer() const {
return battleFlags & 1;
}
void setBombEvent(KartChecker::EBombEvent, ItemObj *);
static int sPlayerKartColorTable[];
static short sBalForbiddenTime;
static short sBombPointDirect; // 1
static short sBombPointSpin; // 1
static short sBombPointIndirect; // 1
static short sBombPointAttacked; // -1
static short sBombPointFull; // 4
static short sBombPointFullS; // 3
static short sBombPointFullL; // 4
static short sBombPointCrushOneself;
// private: // i'm not really sure how else KartChkUsrPage got access to this
u16 raceFlags;
s16 mTargetKartNo;

View File

@ -58,7 +58,7 @@ public:
KartInfo * getKartInfo(int index);
KartLoader * getKartLoader(int index) {
KartLoader * getKartLoader(int index) const {
bool valid = false;
if(index >= 0 && index < 8)
valid = true;

31
include/Sato/ItemObj.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef ITEMOBJ_H
#define ITEMOBJ_H
#include "types.h"
class ItemObj {
public:
int getOwnerNum() const {
return mOwnerNum;
}
int getKartReaction() const {
return mKartReaction;
}
int getDirectHitKartNo() const {
return mDirectHitKartNo;
}
private:
u8 _0[0x120];
int mOwnerNum;
u8 _0x124[0x140 - 0x124];
int mKartReaction; // probably an enum
u8 _0x144[0x28c - 0x144];
int mDirectHitKartNo;
};
#endif

View File

@ -25,7 +25,7 @@ private:
unsigned char _0x4[0x828 - 0x4];
};
ItemObjMgr *GetItemObjMgr()
inline ItemObjMgr *GetItemObjMgr()
{
return ItemObjMgr::getItemObjMgr();
}

View File

@ -9,8 +9,8 @@ class KartCtrl
{
public:
static KartCtrl *getKartCtrl(); /*{
return mCtrl;
}*/
return mCtrl;
}*/
KartSound *getKartSound(int idx)
{
@ -18,8 +18,8 @@ public:
}
GameAudio::KartSoundMgr *GetKartSoundMgr(int idx); /* {
return getKartSound(idx)->mKartSoundMgr;
}*/
return getKartSound(idx)->mKartSoundMgr;
}*/
void GetBodyPos(int idx, JGeometry::TVec3<f32> *playerPos);
@ -29,7 +29,7 @@ private:
KartSound *mKartSounds[8];
};
KartCtrl *GetKartCtrl() {
inline KartCtrl *GetKartCtrl() {
return KartCtrl::getKartCtrl();
}

View File

@ -35,11 +35,6 @@ struct MTX34
float mMtx[3][4];
};
struct Vec
{
float x, y, z;
};
#define nullptr 0
#define null 0

View File

@ -1,11 +1,13 @@
#include "Inagaki/GameAudioMain.h"
#include "Kaneshige/KartChecker.h"
#include "Kaneshige/RaceInfo.h"
#include "Kaneshige/RaceMgr.h"
#include "Kaneshige/GeoRabbitMark.h"
#include "Kaneshige/Course/CrsGround.h"
#include "Kaneshige/Course/CrsArea.h"
#include "Sato/ItemObjMgr.h"
#include "Sato/ItemObj.h"
#include "Yamamoto/kartCtrl.h"
@ -78,6 +80,14 @@ void KartChkUsrPage::draw()
}
short KartChecker::sBalForbiddenTime = 180;
short KartChecker::sBombPointDirect = 1; // 1
short KartChecker::sBombPointSpin = 1; // 1
short KartChecker::sBombPointIndirect = 1; // 1
short KartChecker::sBombPointAttacked = -1; // -1
short KartChecker::sBombPointFull = 4; // 4
short KartChecker::sBombPointFullS = 3; // 3
short KartChecker::sBombPointFullL = 4; // 4
short KartChecker::sBombPointCrushOneself = 0;
// https://decomp.me/scratch/DJxMp
KartChecker::KartChecker(int kartNum, KartInfo *kartInfo, int sectorNum, int lapNum)
@ -955,7 +965,38 @@ bool KartChecker::incYourBombPoint(int idx, int pnt, int increment)
return RaceMgr::getManager()->getKartChecker(idx)->incMyBombPoint(pnt, increment);
}
// KartChecker::setBombEvent(KartChecker::EBombEvent, ItemObj *)
// https://decomp.me/scratch/Pl4Wz
void KartChecker::setBombEvent(KartChecker::EBombEvent bombEvent, ItemObj * itemObj) {
if(tstBombCtrl() && !isBombPointFull()) {
int ownerNum = -1;
if(itemObj != nullptr)
ownerNum = itemObj->getOwnerNum();
switch(bombEvent) {
case EVENT_1:
int increment = sBombPointCrushOneself;
if(ownerNum != mTargetKartNo)
increment = sBombPointAttacked;
if(increment != 0)
incMyBombPoint(-1, increment);
if(ownerNum != mTargetKartNo) {
if(itemObj->getKartReaction() != 8)
increment = sBombPointSpin;
else {
if(mTargetKartNo != itemObj->getDirectHitKartNo())
increment = sBombPointIndirect;
else
increment = sBombPointDirect;
}
incYourBombPoint(ownerNum, mTargetKartNo, increment);
}
break;
case EVENT_3:
incMyBombPoint(-1, -1);
break;
}
}
}
// https://decomp.me/scratch/uXEO9
int KartChecker::getRobberyItemNumber(void)
@ -985,9 +1026,47 @@ bool KartChecker::releaseRabbitMark()
return released;
}
// KartChecker::isRabbit()
// https://decomp.me/scratch/9G0Hj
bool KartChecker::isRabbit() const {
bool rabbit = false;
if(GeoRabbitMark::getSupervisor() != nullptr) {
GeoRabbitMarkSupervisor * supervisor = GeoRabbitMark::getSupervisor();
rabbit = supervisor->getWinFrame() > rabbitWinFrame;
}
return rabbit;
}
// KartChecker::calcRabbitTime()
void KartChecker::calcRabbitTime() {
GeoRabbitMarkSupervisor * supervisor = GeoRabbitMark::getSupervisor();
if(supervisor != nullptr) {
if(rabbitWinFrame > 0)
if(mTargetKartNo == supervisor->getRabbitKartNo()) {
if(!tstStillRabbitTimer()) {
rabbitWinFrame--;
RaceTime rabbitTime;
rabbitTime.setFrame(rabbitWinFrame);
int ms = rabbitTime.getUpwardMSec() / 1000;
if(!(rabbitTime.get() % 1000)) {
if(ms == 0)
GameAudio::Main::getAudio()->startSystemSe(0x20027);
else if(ms <= 10) {
GameAudio::Main::getAudio()->startSystemSe(0x20026);
}
else if((ms > 10) && ms <= GeoRabbitMark::getSupervisor()->getWinTime() - 2) {
GameAudio::Main::getAudio()->startSystemSe(0x20025);
}
}
}
}
else {
rabbitWinFrame = GeoRabbitMark::getSupervisor()->getWinFrame();
resumeRabbitTimer();
}
else {
supervisor->startWinnerEffect();
}
}
}
LapChecker::LapChecker() {
reset();

@ -1 +1 @@
Subproject commit 4c160f59bb9c4cd777d6bf058bf0000c630dea31
Subproject commit 0702b996b3a1e885c0aa41911f69735c4c6901e2