RE and supports cloning of game objects

This commit is contained in:
theclub654 2024-01-12 20:34:23 -05:00
parent b16b4f2232
commit 9e85b9e48a
102 changed files with 566 additions and 201 deletions

View File

@ -2,7 +2,7 @@
void* NewAlarm()
{
return new ALARM;
return new ALARM{};
}
void InitAlarm(ALARM* palarm)
@ -37,7 +37,7 @@ void DeleteAlarm(LO* plo)
void* NewAlbrk()
{
return new ALBRK;
return new ALBRK{};
}
int GetAlbrkSize()

View File

@ -3,12 +3,14 @@ std::vector <GEOM*> allcollisionModels;
void* NewAlo()
{
return new ALO;
return new ALO{};
}
void InitAlo(ALO* palo)
{
InitDl(&palo->dlChild, 0x78);
//void* test = &palo->dleOid;
InitDl(&palo->dlChild, 0x38);
InitDl(&palo->dlFreeze, 0xD0);
InitLo(palo);
@ -78,41 +80,70 @@ void OnAloAdd(ALO* palo)
void OnAloRemove(ALO* palo)
{
if (palo->paloParent == nullptr)
{
if (palo->fRealClock != 0)
RemoveDlEntry(&palo->psw->dlMRDRealClock, palo);
else
{
RemoveDlEntry(&palo->psw->dlMRD, palo);
RemoveDlEntry(&palo->psw->dlBusy, palo);
if ((palo->pvtalo->grfcid & 0x2U) != 0)
{
RemoveDlEntry(&palo->psw->dlBusySo, palo);
}
palo->paloFreezeRoot = nullptr;
ClearDl(&palo->dlFreeze);
}
}
if (palo->pshadow != nullptr)
RemoveDlEntry(&palo->psw->dlShadow, palo->pshadow);
ResolveAlo(palo);
palo->paloRoot = nullptr;
}
void CloneAloHierarchy(ALO* palo, ALO* paloBase)
{
DLI firstParentPalo;
DLI parentPalo{};
// Storing the first parent ptr to child alo
firstParentPalo.m_pdl = &paloBase->dlChild;
// Storing the parent ptr to child ALO
parentPalo.m_pdl = &paloBase->dlChild;
// Storing the base offset to child alo
firstParentPalo.m_ibDle = paloBase->dlChild.ibDle;
// Storing the base offset to child ALO
parentPalo.m_ibDle = paloBase->dlChild.ibDle;
// Storing the parent ALO
firstParentPalo.m_pdliNext = s_pdliFirst;
parentPalo.m_pdliNext = s_pdliFirst;
// Keeping track of the first alo parent
s_pdliFirst = &firstParentPalo;
// Keeping track of the ALO parent
s_pdliFirst = &parentPalo;
// Storing ptr to next alo to clone
firstParentPalo.m_ppv = (void**)firstParentPalo.m_pdl;
// Storing ptr to next ALO to clone
parentPalo.m_ppv = (void**)parentPalo.m_pdl;
// Clones the parent alo
// Clones paloBase to palo
palo->pvtlo->pfnCloneLo(palo, paloBase);
// Loading next alo to clone
LO *plo = (LO*)*firstParentPalo.m_ppv;
/*firstParentPalo.m_ppv = (void**)plo + firstParentPalo.m_ibDle;
// Loading next ALO to clone
LO* plo = (LO*)*parentPalo.m_ppv;
// Loading up next ALO to clone after than one above
parentPalo.m_ppv = (void**) ((uint64_t)&plo->pvtlo + parentPalo.m_ibDle);
while (plo != 0)
while (plo != nullptr)
{
// Clones ALO object
PloCloneLo(plo, palo->psw, palo);
plo = (LO*)*firstParentPalo.m_ppv;
firstParentPalo.m_ppv = (void**)plo + firstParentPalo.m_ibDle;
}*/
plo = (LO*)*parentPalo.m_ppv;
parentPalo.m_ppv = (void**) ((uintptr_t)plo + parentPalo.m_ibDle);
}
s_pdliFirst = parentPalo.m_pdliNext;
}
void CloneAlo(ALO* palo, ALO* paloBase)
@ -160,7 +191,6 @@ void UpdateAloXfWorldHierarchy(ALO* palo)
void TranslateAloToPos(ALO* palo, glm::vec3 &ppos)
{
palo->xf.pos = ppos;
palo->pvtalo->pfnUpdateAloXfWorld(palo);
}

View File

@ -52,6 +52,7 @@ enum ACK
class ALO : public LO
{
public:
// Ptr to dleChild in LO
DL dlChild;
DLE dleBusy;
DLE dleMRD;

View File

@ -2,7 +2,7 @@
void* NewAseg()
{
return new ASEG;
return new ASEG{};
}
void InitAseg(ASEG* paseg)

View File

@ -2,7 +2,7 @@
void* NewBarrier()
{
return new BARRIER;
return new BARRIER{};
}
void InitBarrier(BARRIER* pbarrier)

View File

@ -383,7 +383,7 @@ struct VTMS
CID cid = CID_MS;
int grfcid = 3;
void*(*pfnNewSo) () = NewSo;
void*(*pfnNewMs) () = NewMs;
void (*pfnInitSo) (SO*) = InitSo;
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
void (*pfnAddLo) (LO*) = AddLo;
@ -413,8 +413,8 @@ struct VTMS
void (*pfnUnsubscribeLoStruct)(LO*, void*, void*) = UnsubscribeLoStruct;
void (*pfnGetSoParams)() = nullptr;
void (*pfnUpdateLoLiveEdit)() = nullptr;
int (*pfnGetMsSize) () = GetSoSize;
void (*pfnDeleteSo) (LO* plo) = DeleteSo;
int (*pfnGetMsSize) () = GetMsSize;
void (*pfnDeleteSo) (LO* plo) = DeleteMs;
void (*pfnProjectSoTransform)() = nullptr;
void (*pfnPresetSoAccel)() = nullptr;
void (*pfnTranslateSoToPos)(SO*, glm::vec3&) = TranslateSoToPos;

View File

@ -2,7 +2,7 @@
void* NewScan()
{
return new SCAN;
return new SCAN{};
}
int GetScanSize()

View File

@ -2,7 +2,7 @@
void* NewBlipg()
{
return new BLIPG;
return new BLIPG{};
}
void InitBlipg(BLIPG* pblipg)

View File

@ -2,7 +2,7 @@
void* NewBomb()
{
return new BOMB;
return new BOMB{};
}
void InitBomb(BOMB* pbomb)

View File

@ -2,7 +2,7 @@
void* NewBone()
{
return new BONE;
return new BONE{};
}
int GetBoneSize()
@ -37,7 +37,7 @@ void DeleteBone(LO* plo)
void* NewLBone()
{
return new LBONE;
return new LBONE{};
}
int GetLBoneSize()

View File

@ -2,7 +2,7 @@
void* NewBrk()
{
return new BRK;
return new BRK{};
}
void InitBrk(BRK* pbrk)
@ -42,7 +42,7 @@ void DeleteBrk(LO* plo)
void* NewBrkp()
{
return new BRKP;
return new BRKP{};
}
int GetBrkpSize()
@ -72,7 +72,7 @@ void DeleteBrkp(LO* plo)
void* NewBreak()
{
return new BREAK;
return new BREAK{};
}
void InitBreak(BREAK* pbreak)
@ -107,7 +107,7 @@ void DeleteBreak(LO* plo)
void* NewFragile()
{
return new FRAGILE;
return new FRAGILE{};
}
void InitFragile(FRAGILE* pfragile)
@ -142,7 +142,7 @@ void DeleteFragile(LO* plo)
void* NewZapbreak()
{
return new ZAPBREAK;
return new ZAPBREAK{};
}
int GetZapbreakSize()

View File

@ -2,7 +2,7 @@
void* NewButton()
{
return new BUTTON;
return new BUTTON{};
}
void InitButton(BUTTON* pbutton)
@ -42,7 +42,7 @@ void DeleteButton(LO* plo)
void* NewVolbtn()
{
return new VOLBTN;
return new VOLBTN{};
}
void InitVolbtn(VOLBTN* pvolbtn)

View File

@ -2,7 +2,7 @@
void* NewCan()
{
return new CAN;
return new CAN{};
}
void InitCan(CAN* pcan)

View File

@ -2,7 +2,7 @@
void* NewChkpnt()
{
return new CHKPNT;
return new CHKPNT{};
}
void InitChkpnt(CHKPNT* pchkpnt)

View File

@ -2,7 +2,7 @@
void* NewCm()
{
return new CM;
return new CM{};
}
void InitCm(CM* pcm)

View File

@ -2,7 +2,7 @@
void* NewCnvo()
{
return new CNVO;
return new CNVO{};
}
void InitCnvo(CNVO* pcnvo)

View File

@ -2,7 +2,7 @@
void* NewDprize()
{
return new DPRIZE;
return new DPRIZE{};
}
void InitDprize(DPRIZE *pdprize)
@ -49,7 +49,7 @@ void DeleteDprize(LO* plo)
void* NewCharm()
{
return new CHARM;
return new CHARM{};
}
void InitCharm(CHARM* pcharm)
@ -80,7 +80,7 @@ void DeleteCharm(LO* plo)
void* NewCoin()
{
return new COIN;
return new COIN{};
}
void InitCoin(COIN* pcoin)
@ -111,7 +111,7 @@ void DeleteCoin(LO* plo)
void* NewKey()
{
return new KEY;
return new KEY{};
}
void InitKey(KEY* pkey)
@ -142,7 +142,7 @@ void DeleteKey(LO* plo)
void* NewGold()
{
return new GOLD;
return new GOLD{};
}
void InitGold(GOLD* pgold)

View File

@ -2,7 +2,7 @@
void* NewCrfodb()
{
return new CRFODB;
return new CRFODB{};
}
void InitCrfodb(CRFODB* pcrfodb)
@ -37,7 +37,7 @@ void DeleteCrfodb(LO* plo)
void* NewCrfod()
{
return new CRFOD;
return new CRFOD{};
}
void OnCrfodAdd(CRFOD* pcrfod)
@ -73,7 +73,7 @@ void DeleteCrfod(LO* plo)
void* NewCrfodk()
{
return new CRFODK;
return new CRFODK{};
}
int GetCrfodkSize()
@ -103,7 +103,7 @@ void DeleteCrfodk(LO* plo)
void* NewCrbrain()
{
return new CRBRAIN;
return new CRBRAIN{};
}
void InitCrbrain(CRBRAIN* pcrbrain)

View File

@ -2,7 +2,7 @@
void* NewCycle()
{
return new CYCLE;
return new CYCLE{};
}
void InitCycle(CYCLE* pcycle)

View File

@ -2,7 +2,7 @@
void* NewDart()
{
return new DART;
return new DART{};
}
void InitDart(DART* pdart)

View File

@ -2,7 +2,7 @@
void* NewDartgun()
{
return new DARTGUN;
return new DARTGUN{};
}
void InitDartgun(DARTGUN* pdartgun)

View File

@ -75,6 +75,12 @@ void RenderSoSelf(SO* pso, CM* pcm, RO* pro);
int GetSoSize();
void DeleteSo(LO* plo);
// Merged Statics
class MS;
void*NewMs();
int GetMsSize();
void DeleteMs(LO* plo);
// Player Object
class PO;
void*NewPo();

View File

@ -2,7 +2,7 @@
void* NewDialog()
{
return new DIALOG;
return new DIALOG{};
}
void InitDialog(DIALOG* pdialog)

201
Sly1/dl.h
View File

@ -8,19 +8,103 @@ struct DL
union
{
// Stores the first ptr to data
void *pvFirst;
class LO *ploFirst;
class ALO *paloFirst;
class SO *psoFirst;
void* pvFirst;
class LO* ploFirst;
class ALO* paloFirst;
class SO* psoFirst;
class ASEGA* pasegaFirst;
class ACTSEG* pactsegFirst;
class AMB* pambFirst;
class EXC* pexcFirst;
class RIP* pripFirst;
class BLIP* pblipFirst;
class BLIPG* pblipgFirst;
class DZ* pdzFirst;
class TARGET* ptargetFirst;
class HND* phndFirst;
class ACT* pactFirst;
class IKH* pikhFirst;
class LIGHT* plightFirst;
class SHADOW* pshadowFirst;
class SHAPE* pshapeFirst;
class SMA* psmaFirst;
class PXR* ppxrFirst;
class HSHAPE* phshapeFirst;
class HPNT* phpntFirst;
class HBSK* phbskFirst;
class PIPE* ppipeFirst;
class PATHZONE* ppathzoneFirst;
class FLY* pflyFirst;
class DPRIZE* pdprizeFirst;
class RAT* pratFirst;
class RATHOLE* pratholeFirst;
class ROC* procFirst;
class ROH* prohFirst;
class ROST* prostFirst;
class DART* pdartFirst;
class SPIRE* pspireFirst;
class RAIL* prailFirst;
class LANDING* plandingFirst;
class LASEN* plasenFirst;
class FE* pfeFirst;
class EXPLSTE* pexplsteFirst;
class FADER* pfaderFirst;
class CRFOD* pcrfodFirst;
class JLOVOL* pjlovolFirst;
class EMITTER* pemitterFirst;
class MGCO* pmgcoFirst;
class JMT* pjmtFirst;
};
union
{
// Stores the last ptr to the last data in list
void *pvLast;
class LO *ploLast;
class ALO *paloLast;
class SO *psoLast;
void* pvLast;
class LO* ploLast;
class ALO* paloLast;
class SO* psoLast;
class ASEGA* pasegaLast;
class ACTSEG* pactsegLast;
class AMB* pambLast;
class EXC* pexcLast;
class RIP* pripLast;
class BLIP* pblipLast;
class BLIPG* pblipgLast;
class DZ* pdzLast;
class TARGET* ptargetLast;
class HND* phndLast;
class ACT* pactLast;
class IKH* pikhLast;
class LIGHT* plightLast;
class SHADOW* pshadowLast;
class SHAPE* pshapeLast;
class SMA* psmaLast;
class PXR* ppxrLast;
class HSHAPE* phshapeLast;
class HPNT* phpntLast;
class HBSK* phbskLast;
class PIPE* ppipeLast;
class PATHZONE* ppathzoneLast;
class FLY* pflyLast;
class DPRIZE* pdprizeLast;
class RAT* pratLast;
class RATHOLE* pratholeLast;
class ROC* procLast;
class ROH* prohLast;
class ROST* prostLast;
class DART* pdartLast;
class SPIRE* pspireLast;
class RAIL* prailLast;
class LANDING* plandingLast;
class LASEN* plasenLast;
class FE* pfeLast;
class EXPLSTE* pexplsteLast;
class FADER* pfaderLast;
class CRFOD* pcrfodLast;
class JLOVOL* pjlovolLast;
class EMITTER* pemitterLast;
class MGCO* pmgcoLast;
class JMT* pjmtLast;
};
// Base offset to DL entry (DLE)
@ -38,22 +122,105 @@ struct DLE
// Stores ptr to next data
void* pvNext;
class LO* ploNext;
class ALO *paloNext;
class SO *psoNext;
class ALO* paloNext;
class SO* psoNext;
class ASEGA* pasegaNext;
class ACTSEG* pactsegNext;
class AMB* pambNext;
class EXC* pexcNext;
class RIP* pripNext;
class BLIP* pblipNext;
class BLIPG* pblipgNext;
class DZ* pdzNext;
class TARGET* ptargetNext;
class HND* phndNext;
class ACT* pactNext;
class IKH* pikhNext;
class LIGHT* plightNext;
class SHADOW* pshadowNext;
class SHAPE* pshapeNext;
class SMA* psmaNext;
class PXR* ppxrNext;
class HSHAPE* phshapeNext;
class HPNT* phpntNext;
class HBSK* phbskNext;
class PIPE* ppipeNext;
class PATHZONE* ppathzoneNext;
class FLY* pflyNext;
class DPRIZE* pdprizeNext;
class RAT* pratNext;
class RATHOLE* pratholeNext;
class ROC* procNext;
class ROH* prohNext;
class ROST* prostNext;
class DART* pdartNext;
class SPIRE* pspireNext;
class RAIL* prailNext;
class LANDING* plandingNext;
class LASEN* plasenNext;
class FE* pfeNext;
class EXPLSTE* pexplsteNext;
class FADER* pfaderNext;
class CRFOD* pcrfodNext;
class JLOVOL* pjlovolNext;
class EMITTER* pemitterNext;
class MGCO* pmgcoNext;
class JMT* pjmtNext;
};
union
{
// Stores ptr to previous data
void *pvPrev;
class LO *ploPrev;
class ALO *paloPrev;
class SO *psoPrev;
void* pvPrev;
class LO* ploPrev;
class ALO* paloPrev;
class SO* psoPrev;
class ASEGA* pasegaPrev;
class ACTSEG* pactsegPrev;
class AMB* pambPrev;
class EXC* pexcPrev;
class RIP* pripPrev;
class BLIP* pblipPrev;
class BLIPG* pblipgPrev;
class DZ* pdzPrev;
class TARGET* ptargetPrev;
class HND* phndPrev;
class ACT* pactPrev;
class IKH* pikhPrev;
class LIGHT* plightPrev;
class SHADOW* pshadowPrev;
class SHAPE* pshapePrev;
class SMA* psmaPrev;
class PXR* ppxrPrev;
class HSHAPE* phshapePrev;
class HPNT* phpntPrev;
class HBSK* phbskPrev;
class PIPE* ppipePrev;
class PATHZONE* ppathzonePrev;
class FLY* pflyPrev;
class DPRIZE* pdprizePrev;
class RAT* pratPrev;
class RATHOLE* pratholePrev;
class ROC* procPrev;
class ROH* prohPrev;
class ROST* prostPrev;
class DART* pdartPrev;
class SPIRE* pspirePrev;
class RAIL* prailPrev;
class LANDING* plandingPrev;
class LASEN* plasenPrev;
class FE* pfePrev;
class EXPLSTE* pexplstePrev;
class FADER* pfaderPrev;
class CRFOD* pcrfodPrev;
class JLOVOL* pjlovolPrev;
class EMITTER* pemitterPrev;
class MGCO* pmgcoPrev;
class JMT* pjmtPrev;
};
};
// Used for loading parent objects
// Data list index
struct DLI
{
// List address value
@ -87,4 +254,4 @@ int FIsDlEmpty(DL *pdl);
// Global DLI pointer to a parent object
static DLI *s_pdliFirst = nullptr;
static DLI* s_pdliFirst{};

View File

@ -2,7 +2,7 @@
void* NewDsp()
{
return new DSP;
return new DSP{};
}
int GetDspSize()

View File

@ -2,7 +2,7 @@
void* NewDysh()
{
return new DYSH;
return new DYSH{};
}
void InitDysh(DYSH* pdysh)

View File

@ -2,7 +2,7 @@
void* NewExplo()
{
return new EXPLO;
return new EXPLO{};
}
void InitExplo(EXPLO* pexplo)
@ -61,7 +61,7 @@ void DeleteExplo(LO* plo)
void* NewEmitter()
{
return new EMITTER;
return new EMITTER{};
}
void InitEmitter(EMITTER* pemitter)
@ -157,7 +157,7 @@ void DeleteEmitter(LO* plo)
void* NewExpl()
{
return new EXPL;
return new EXPL{};
}
int GetExplSize()
@ -181,7 +181,7 @@ void DeleteExpl(LO* plo)
void* NewExpls()
{
return new EXPLS;
return new EXPLS{};
}
void InitExpls(EXPLS* pexpls)
@ -210,7 +210,7 @@ void DeleteExpls(LO* plo)
void* NewExplg()
{
return new EXPLG;
return new EXPLG{};
}
int GetExplgSize()

View File

@ -2,7 +2,7 @@
void* NewFlash()
{
return new FLASH;
return new FLASH{};
}
void InitFlash(FLASH* pflash)

View File

@ -2,7 +2,7 @@
void* NewFly()
{
return new FLY;
return new FLY{};
}
void InitFly(FLY* pfly)

View File

@ -2,7 +2,7 @@
void* NewFrzg()
{
return new FRZG;
return new FRZG{};
}
int GetFrzgSize()

View File

@ -2,7 +2,7 @@
void* NewGomer()
{
return new GOMER;
return new GOMER{};
}
void InitGomer(GOMER* pgomer)

View File

@ -2,7 +2,7 @@
void* NewHg()
{
return new HG;
return new HG{};
}
void InitHg(HG* phg)

View File

@ -2,7 +2,7 @@
void* NewHbsk()
{
return new HBSK;
return new HBSK{};
}
void InitHbsk(HBSK* phbsk)
@ -47,7 +47,7 @@ void DeleteHbsk(LO* plo)
void* NewHshape()
{
return new HSHAPE;
return new HSHAPE{};
}
void InitHshape(HSHAPE* phshape)
@ -81,7 +81,7 @@ void DeleteHshape(LO* plo)
void* NewHpnt()
{
return new HPNT;
return new HPNT{};
}
void InitHpnt(HPNT* phpnt)

View File

@ -2,7 +2,7 @@
void* NewHnd()
{
return new HND;
return new HND{};
}
void InitHnd(HND* phnd)

View File

@ -2,7 +2,7 @@
void* NewIkh()
{
return new IKH;
return new IKH{};
}
int GetIkhSize()
@ -32,7 +32,7 @@ void DeleteIkh(LO* plo)
void* NewLikh()
{
return new LIKH;
return new LIKH{};
}
int GetLikhSize()

View File

@ -7192,3 +7192,95 @@ Column 0 Sort=0v
RefScale=13
Column 0 Sort=0v
[Table][0x82D2E272,4]
RefScale=13
Column 0 Sort=0v
[Table][0x5110ECB1,4]
RefScale=13
Column 0 Sort=0v
[Table][0xC48B4B81,4]
RefScale=13
Column 0 Sort=0v
[Table][0x6841ABE1,4]
RefScale=13
Column 0 Sort=0v
[Table][0x2D9342A8,4]
RefScale=13
Column 0 Sort=0v
[Table][0x0E85DE49,4]
RefScale=13
Column 0 Sort=0v
[Table][0x0F38CC74,4]
RefScale=13
Column 0 Sort=0v
[Table][0xB63BCDE3,4]
RefScale=13
Column 0 Sort=0v
[Table][0x237C8575,4]
RefScale=13
Column 0 Sort=0v
[Table][0xE66D267A,4]
RefScale=13
Column 0 Sort=0v
[Table][0x2A41EE77,4]
RefScale=13
Column 0 Sort=0v
[Table][0x670AF996,4]
RefScale=13
Column 0 Sort=0v
[Table][0x7E8D6924,4]
RefScale=13
Column 0 Sort=0v
[Table][0x94B8EE69,4]
RefScale=13
Column 0 Sort=0v
[Table][0xBAFB71F5,4]
RefScale=13
Column 0 Sort=0v
[Table][0x6AC4F205,4]
RefScale=13
Column 0 Sort=0v
[Table][0x8BCBC8D7,4]
RefScale=13
Column 0 Sort=0v
[Table][0x93E35CBD,4]
RefScale=13
Column 0 Sort=0v
[Table][0xB5B05DDE,4]
RefScale=13
Column 0 Sort=0v
[Table][0xAE815506,4]
RefScale=13
Column 0 Sort=0v
[Table][0x129D04C6,4]
RefScale=13
Column 0 Sort=0v
[Table][0x022FBE8D,4]
RefScale=13
Column 0 Sort=0v
[Table][0x6F1DB431,4]
RefScale=13
Column 0 Sort=0v

View File

@ -2,7 +2,7 @@
void* NewJack()
{
return new JACK;
return new JACK{};
}
void InitJack(JACK* pjack)
@ -37,7 +37,7 @@ void DeleteJack(LO* plo)
void* NewJackb()
{
return new JACKB;
return new JACKB{};
}
void InitJackb(JACKB* pjackb)
@ -68,7 +68,7 @@ void DeleteJackb(LO* plo)
void* NewJackn()
{
return new JACKN;
return new JACKN{};
}
void InitJackn(JACKN* pjackn)
@ -104,7 +104,7 @@ void DeleteJackn(LO* plo)
void* NewJackf()
{
return new JACKF;
return new JACKF{};
}
void InitJackf(JACKF* pjackf)

View File

@ -2,7 +2,7 @@
void* NewJlovol()
{
return new JLOVOL;
return new JLOVOL{};
}
void InitJlovol(JLOVOL* pjlovol)
@ -37,7 +37,7 @@ void DeleteJlovol(LO* plo)
void* NewJlo()
{
return new JLO;
return new JLO{};
}
void InitJlo(JLO* pjlo)
@ -77,7 +77,7 @@ void DeleteJlo(LO* plo)
void* NewJloc()
{
return new JLOC;
return new JLOC{};
}
void InitJloc(JLOC* pjloc)

View File

@ -2,7 +2,7 @@
void* NewJp()
{
return new JP;
return new JP{};
}
void InitJp(JP* pjp)

View File

@ -2,7 +2,7 @@
void* NewJsg()
{
return new JSG;
return new JSG{};
}
void InitJsg(JSG* pjsg)

View File

@ -2,7 +2,7 @@
void* NewJt()
{
return new JT;
return new JT{};
}
void InitJt(JT* pjt)

View File

@ -2,7 +2,7 @@
void* NewJmt()
{
return new JMT;
return new JMT{};
}
int GetJmtSize()

View File

@ -2,7 +2,7 @@
void* NewKeyhole()
{
return new KEYHOLE;
return new KEYHOLE{};
}
void InitKeyhole(KEYHOLE *pkeyhole)

View File

@ -2,7 +2,7 @@
void* NewLanding()
{
return new LANDING;
return new LANDING{};
}
int GetLandingSize()

View File

@ -2,7 +2,7 @@
void* NewLgn()
{
return new LGN;
return new LGN{};
}
void InitLgn(LGN* plgn)
@ -42,7 +42,7 @@ void DeleteLgn(LO* plo)
void* NewLgnb()
{
return new LGNB;
return new LGNB{};
}
void InitLgnb(LGNB* plgnb)
@ -77,7 +77,7 @@ void DeleteLgnb(LO* plo)
void* NewSwp()
{
return new SWP;
return new SWP{};
}
void InitSwp(SWP* pswp)

View File

@ -2,7 +2,7 @@
void* NewLight()
{
return new LIGHT;
return new LIGHT{};
}
void InitLight(LIGHT* plight)
@ -48,6 +48,8 @@ void CloneLight(LIGHT* plight, LIGHT* plightBase)
void AddLightToSw(LIGHT* plight)
{
AppendDlEntry(&plight->psw->dlLight, plight);
plight->pvtalo->pfnUpdateAloXfWorld(plight);
}
void RemoveLightFromSw(LIGHT* plight)

View File

@ -2,7 +2,7 @@
void* NewLo()
{
return new LO;
return new LO{};
}
void InitLo(LO* plo)
@ -35,6 +35,7 @@ void AddLo(LO *plo)
// Returns if LO is in world or not
isFound = FIsLoInWorld(plo);
// Adds object to hierarchy
if (isFound != 0)
plo->pvtlo->pfnAddLoHierarchy(plo);
}
@ -67,8 +68,11 @@ void CloneLo(LO* plo, LO* ploBase)
LO* PloCloneLo(LO* plo, SW* psw, ALO* paloParent)
{
// Returns object to be cloned
LO* localObject = PloNew(plo->pvtbasic->cid, psw, paloParent, plo->oid, -1);
// Clones the base object and it's children
localObject->pvtlo->pfnCloneLoHierarchy(localObject, plo);
// Returns cloned object
return localObject;
}

View File

@ -56,6 +56,7 @@ struct SOP
struct PAR* apar;
struct SOP* psopNext;
};
// Proxy Source List
struct PSL
{
@ -64,6 +65,8 @@ struct PSL
// Vector container of the cloned LO's
std::vector <LO*> aploClone;
};
// Proxy Root
struct PXR
{
struct LO* plo;
@ -82,6 +85,8 @@ struct MRG
// The ALO object thats gonna be merged
struct ALO** apalo;
};
// Local Object
class LO : public BASIC
{
public:
@ -114,7 +119,7 @@ void AddLoHierarchy(LO* plo);
void RemoveLoHierarchy(LO* plo);
void CloneLoHierarchy(LO* plo, LO* ploBase);
void CloneLo(LO* plo, LO* ploBase);
LO* PloCloneLo(LO* plo, SW* psw, ALO* paloParent);
LO* PloCloneLo(LO* plo, SW* psw, ALO* paloParent);
void SendLoMessage(LO *plo, MSGID msgid, void *pv); // GOTTA COME BACK
void LoadLoFromBrx(LO *plo, CBinaryInputStream* pbis);
void RemoveLo(LO *plo); // GOTTA COME BACK
@ -128,7 +133,7 @@ void SubscribeLoObject(LO* plo, LO* ploTarget);
void UnsubscribeLoObject(LO* plo, LO* ploTarget);
void SubscribeLoStruct(LO* plo, void* pfnmq, void* pvContext);
void UnsubscribeLoStruct(LO* plo, void * pfnmq, void* pvContext);
int GetLoSize();
int GetLoSize();
void DeleteLo(LO* plo);
#include "sw.h"

View File

@ -2,7 +2,7 @@
void* NewMap()
{
return new MAP;
return new MAP{};
}
int GetMapSize()

View File

@ -2,7 +2,7 @@
void* NewMbg()
{
return new MBG;
return new MBG{};
}
void InitMbg(MBG *pmbg)
@ -42,7 +42,7 @@ void DeleteMbg(LO* plo)
void* NewBhg()
{
return new BHG;
return new BHG{};
}
void InitBhg(BHG *pbhg)
@ -77,7 +77,7 @@ void DeleteBhg(LO* plo)
void* NewScentmap()
{
return new SCENTMAP;
return new SCENTMAP{};
}
void InitScentmap(SCENTMAP* pscentmap)

View File

@ -2,7 +2,7 @@
void* NewMecha()
{
return new MECHA;
return new MECHA{};
}
void InitMecha(MECHA* pmecha)

View File

@ -2,7 +2,7 @@
void* NewMgv()
{
return new MGV;
return new MGV{};
}
void InitMgv(MGV* pmgv)

View File

@ -2,7 +2,7 @@
void* NewMissile()
{
return new MISSILE;
return new MISSILE{};
}
void InitMissile(MISSILE* pmissile)
@ -47,7 +47,7 @@ void DeleteMissile(LO* plo)
void* NewAccmiss()
{
return new ACCMISS;
return new ACCMISS{};
}
void InitAccmiss(ACCMISS* paccmiss)
@ -82,7 +82,7 @@ void DeleteAccmiss(LO* plo)
void* NewTarmiss()
{
return new TARMISS;
return new TARMISS{};
}
void InitTarmiss(TARMISS* ptarmiss)
@ -117,7 +117,7 @@ void DeleteTarmiss(LO* plo)
void* NewSplmiss()
{
return new SPLMISS;
return new SPLMISS{};
}
int GetSplmissSize()
@ -147,7 +147,7 @@ void DeleteSplmiss(LO* plo)
void* NewGroundmiss()
{
return new GROUNDMISS;
return new GROUNDMISS{};
}
void InitGroundmiss(GROUNDMISS* pgroundmiss)

View File

@ -2,7 +2,7 @@
void* NewMgc()
{
return new MGC;
return new MGC{};
}
void InitMgc(MGC* pmgc)

View File

@ -2,7 +2,7 @@
void* NewMrkv()
{
return new MRKV;
return new MRKV{};
}
void InitMrkv(MRKV* pmrkv)

View File

@ -1 +1,16 @@
#include "ms.h"
void* NewMs()
{
return new MS{};
}
int GetMsSize()
{
return sizeof(MS);
}
void DeleteMs(LO* plo)
{
delete (MS*)plo;
}

View File

@ -5,4 +5,8 @@
class MS : public SO
{
public:
};
};
void*NewMs();
int GetMsSize();
void DeleteMs(LO* plo);

View File

@ -2,7 +2,7 @@
void* NewMurray()
{
return new MURRAY;
return new MURRAY{};
}
void InitMurray(MURRAY* pmurray)

View File

@ -2,7 +2,7 @@
void* NewPathzone()
{
return new PATHZONE;
return new PATHZONE{};
}
int GetPathzoneSize()

View File

@ -2,7 +2,7 @@
void* NewPipe()
{
return new PIPE;
return new PIPE{};
}
void InitPipe(PIPE* ppipe)

View File

@ -2,7 +2,7 @@
void* NewPnt()
{
return new PNT;
return new PNT{};
}
int GetPntSize()

View File

@ -2,7 +2,7 @@
void* NewPo()
{
return new PO;
return new PO{};
}
void InitPo(PO* ppo)

View File

@ -22,7 +22,7 @@ class PO : public SO
struct ALO* paloUseCharm;
};
void* NewPo();
void*NewPo();
void InitPo(PO *ppo); //NOT FINISHED
void OnPoAdd(PO* ppo);
void ClonePo(PO* ppo, PO* ppoBase);

View File

@ -2,7 +2,7 @@
void* NewProxy()
{
return new PROXY;
return new PROXY{};
}
void InitProxy(PROXY *pproxy)
@ -20,7 +20,7 @@ void LoadProxyFromBrx(PROXY* pproxy, CBinaryInputStream* pbis)
{
std::vector <LO*> proxyObjs;
InitDl(&pproxy->dlProxyRoot, 0x470);
InitDl(&pproxy->dlProxyRoot, 0x16);
pproxy->xf.mat = pbis->ReadMatrix();
pproxy->xf.pos = pbis->ReadVector();
@ -31,7 +31,7 @@ void LoadProxyFromBrx(PROXY* pproxy, CBinaryInputStream* pbis)
for (int i = 0; i < numProxyObjs; i++)
{
LO* object = nullptr;
LO* object{};
// Loads class ID
CID cid = (CID)pbis->S16Read();
@ -39,7 +39,8 @@ void LoadProxyFromBrx(PROXY* pproxy, CBinaryInputStream* pbis)
{
// Loads proxy source index from file
uint16_t ipsl = pbis->S16Read();
// Returns proxy source based of proxy source index
// Returns proxy source object based of proxy source index
object = PloGetSwProxySource(pproxy->psw, ipsl);
}
else
@ -56,7 +57,16 @@ void LoadProxyFromBrx(PROXY* pproxy, CBinaryInputStream* pbis)
// Loads number of LO clones to make
uint16_t cploClone = pbis->S16Read();
// Adds proxy source to proxy source list
AddSwProxySource(pproxy->psw, object, cploClone);
}
PXR proxyRoot{};
proxyRoot.plo = object;
proxyRoot.oidProxyRoot = pproxy->oid;
proxyRoot.pchzProxyRoot = pproxy->pchzName;
object->ppxr = &proxyRoot;
AppendDlEntry(&pproxy->dlProxyRoot, &proxyRoot);
}
byte unk0 = pbis->U8Read();

View File

@ -2,7 +2,7 @@
void* NewPuffer()
{
return new PUFFER;
return new PUFFER{};
}
void InitPuffer(PUFFER* ppuffer)
@ -42,7 +42,7 @@ void DeletePuffer(LO* plo)
void* NewPuffb()
{
return new PUFFB;
return new PUFFB{};
}
int GetPuffbSize()
@ -68,7 +68,7 @@ void DeletePuffb(LO* plo)
void* NewPuffv()
{
return new PUFFV;
return new PUFFV{};
}
void InitPuffv(PUFFV* ppuffv)
@ -97,7 +97,7 @@ void DeletePuffv(LO* plo)
void* NewPuffc()
{
return new PUFFC;
return new PUFFC{};
}
int GetPuffcSize()
@ -127,7 +127,7 @@ void DeletePuffc(LO* plo)
void* NewPufft()
{
return new PUFFT;
return new PUFFT{};
}
int GetPufftSize()

View File

@ -2,7 +2,7 @@
void* NewVault()
{
return new VAULT;
return new VAULT{};
}
void InitVault(VAULT* pvault)
@ -37,7 +37,7 @@ void DeleteVault(LO* plo)
void* NewSprize()
{
return new SPRIZE;
return new SPRIZE{};
}
void InitSprize(SPRIZE* psprize)
@ -77,7 +77,7 @@ void DeleteSprize(LO* plo)
void* NewScprize()
{
return new SCPRIZE;
return new SCPRIZE{};
}
void InitScprize(SCPRIZE* pscprize)
@ -112,7 +112,7 @@ void DeleteScprize(LO* plo)
void* NewLifetkn()
{
return new LIFETKN;
return new LIFETKN{};
}
int GetLifetknSize()
@ -142,7 +142,7 @@ void DeleteLifetkn(LO* plo)
void* NewClue()
{
return new CLUE;
return new CLUE{};
}
void InitClue(CLUE* pclue)
@ -188,7 +188,7 @@ void DeleteClue(LO* plo)
void* NewLock()
{
return new LOCK;
return new LOCK{};
}
int GetLockSize()
@ -219,7 +219,7 @@ void DeleteLock(LO* plo)
void* NewLockg()
{
return new LOCKG;
return new LOCKG{};
}
int GetLockgSize()

View File

@ -2,7 +2,7 @@
void* NewRail()
{
return new RAIL;
return new RAIL{};
}
int GetRailSize()

View File

@ -2,7 +2,7 @@
void* NewRat()
{
return new RAT;
return new RAT{};
}
void InitRat(RAT* prat)
@ -53,7 +53,7 @@ void DeleteRat(LO* plo)
void* NewRathole()
{
return new RATHOLE;
return new RATHOLE{};
}
int GetRatholeSize()

View File

@ -2,7 +2,7 @@
void* NewRchm()
{
return new RCHM;
return new RCHM{};
}
void InitRchm(RCHM* prchm)

View File

@ -2,6 +2,8 @@
void RenderSw(SW *psw, CM *pcm)
{
glShader.Use();
DLI dlBusyDli;
// Loading SW object list

View File

@ -2,7 +2,7 @@
void* NewRipg()
{
return new RIPG;
return new RIPG{};
}
void InitRipg(RIPG *pripg)

View File

@ -2,7 +2,7 @@
void* NewRov()
{
return new ROV;
return new ROV{};
}
void InitRov(ROV* prov)
@ -42,7 +42,7 @@ void DeleteRov(LO* plo)
void* NewRoh()
{
return new ROH;
return new ROH{};
}
void InitRoh(ROH* proh)
@ -82,7 +82,7 @@ void DeleteRoh(LO* plo)
void* NewRoc()
{
return new ROC;
return new ROC{};
}
void InitRoc(ROC* proc)
@ -122,7 +122,7 @@ void DeleteRoc(LO* plo)
void* NewRost()
{
return new ROST;
return new ROST{};
}
void InitRost(ROST* prost)
@ -162,7 +162,7 @@ void DeleteRost(LO* plo)
void* NewRop()
{
return new ROP;
return new ROP{};
}
void InitRop(ROP* prop)
@ -202,7 +202,7 @@ void DeleteRop(LO* plo)
void* NewRob()
{
return new ROB;
return new ROB{};
}
void InitRob(ROB* prob)

View File

@ -2,7 +2,7 @@
void* NewRope()
{
return new ROPE;
return new ROPE{};
}
void InitRope(ROPE* prope)

View File

@ -2,7 +2,7 @@
void* NewRwm()
{
return new RWM;
return new RWM{};
}
void InitRwm(RWM* prwm)

View File

@ -2,7 +2,7 @@
void* NewSensor()
{
return new SENSOR;
return new SENSOR{};
}
void InitSensor(SENSOR* psensor)
@ -37,7 +37,7 @@ void DeleteSensor(LO* plo)
void* NewLasen()
{
return new LASEN;
return new LASEN{};
}
void InitLasen(LASEN* plasen)
@ -77,7 +77,7 @@ void DeleteLasen(LO* plo)
void* NewCamsen()
{
return new CAMSEN;
return new CAMSEN{};
}
void InitCamsen(CAMSEN* pcamsen)
@ -112,7 +112,7 @@ void DeleteCamsen(LO* plo)
void* NewPrsen()
{
return new PRSEN;
return new PRSEN{};
}
void InitPrsen(PRSEN* pprsen)

View File

@ -2,7 +2,7 @@
void* NewShape()
{
return new SHAPE;
return new SHAPE{};
}
void InitShape(SHAPE* pshape)

View File

@ -2,7 +2,7 @@
void* NewSky()
{
return new SKY;
return new SKY{};
}
int GetSkySize()

View File

@ -2,7 +2,7 @@
void* NewSm()
{
return new SM;
return new SM{};
}
int GetSmSize()
@ -55,7 +55,7 @@ void DeleteSm(LO* plo)
void* NewSma()
{
return new SMA;
return new SMA{};
}
int GetSmaSize()

View File

@ -2,7 +2,7 @@
void* NewSmartguard()
{
return new SMARTGUARD;
return new SMARTGUARD{};
}
void InitSmartGuard(SMARTGUARD* psmartguard)

View File

@ -2,7 +2,7 @@
void* NewSo()
{
return new SO;
return new SO{};
}
void InitSo(SO* pso)
@ -31,6 +31,17 @@ void OnSoAdd(SO *pso)
OnAloAdd(pso);
}
void OnSoRemove(SO* pso)
{
OnAloRemove(pso);
pso->psw->cpsoAll--;
if (pso->paloParent == nullptr)
{
RemoveDlEntry(&pso->psw->dlRoot, pso);
}
}
void CloneSo(SO* pso, SO* psoBase)
{
LO lo = *pso;

View File

@ -88,6 +88,7 @@ void*NewSo();
void InitSo(SO *pso); // NOT FINISHED
int GetSoSize();
void OnSoAdd(SO *pso); // NOT FINISHED
void OnSoRemove(SO* pso);
void CloneSo(SO* pso, SO* psoBase);
void ApplySoProxy(SO* pso, PROXY* pproxyApply);
void UpdateSoXfWorldHierarchy(SO* pso);

View File

@ -2,7 +2,7 @@
void* NewSpeaker()
{
return new SPEAKER;
return new SPEAKER{};
}
void InitSpeaker(SPEAKER* pspeaker)

View File

@ -2,7 +2,7 @@
void* NewSpire()
{
return new SPIRE;
return new SPIRE{};
}
int GetSpireSize()

View File

@ -2,7 +2,7 @@
void* NewSquish()
{
return new SQUISH;
return new SQUISH{};
}
int GetSquishSize()

View File

@ -2,7 +2,7 @@
void* NewStep()
{
return new STEP;
return new STEP{};
}
void InitStep(STEP* pstep)

View File

@ -2,7 +2,7 @@
void* NewSgg()
{
return new SGG;
return new SGG{};
}
void InitSgg(SGG* psgg)
@ -31,7 +31,7 @@ void DeleteSgg(LO* plo)
void* NewStepguard()
{
return new STEPGUARD;
return new STEPGUARD{};
}
void InitStepGuard(STEPGUARD* pstepguard)

View File

@ -2,7 +2,7 @@
void* NewSuv()
{
return new SUV;
return new SUV{};
}
void InitSuv(SUV* psuv)

View File

@ -8,7 +8,7 @@ extern std::vector <GEOM*> allcollisionModels;
void* NewSw()
{
return new SW;
return new SW{};
}
void InitSw(SW* psw)
@ -57,7 +57,7 @@ int GetSwSize()
void InitSwDlHash(SW* psw)
{
for (int i = 0; i < 0x200; i++)
InitDl(&psw->adlHash[i], 0x38);
InitDl(&psw->adlHash[i], 0x18);
}
void LoadSwFromBrx(SW* psw, CBinaryInputStream* pbis)
@ -111,20 +111,28 @@ void AddSwProxySource(SW* psw, LO* ploProxySource, int cploClone)
cploClone--;
PSL proxySourceList;
proxySourceList.cploCloneFree = cploClone;
proxySourceList.aploClone.resize(cploClone);
ALO* test = (ALO*)ploProxySource;
for (int i = 0; i < cploClone; i++)
{
LO* clonedLocalObject = PloCloneLo(ploProxySource, psw, nullptr);
proxySourceList.aploClone[i] = clonedLocalObject;
}
psw->apsl.push_back(proxySourceList);
psw->cpsl++;
}
LO* PloGetSwProxySource(SW* psw, int ipsl)
{
return nullptr;
PSL psl = psw->apsl[ipsl];
int numClones = psl.cploCloneFree--;
numClones--;
psl.cploCloneFree = numClones;
return psl.aploClone[numClones];
}
void DeleteSw(SW* psw)

View File

@ -28,6 +28,7 @@ public:
int cpsoAll;
int cpsoRoot;
DL dlRoot;
// DL to dleChild in LO
DL dlChild;
DL dlMRD;
DL dlBusy;
@ -88,7 +89,7 @@ public:
// Number of proxy source list
int cpsl;
// Proxy source list
std::vector <PSL> apsl[128];
std::vector <PSL> apsl;
// Number of clue bottles for each level
int cclueAll;
// Number of check points for level

View File

@ -2,7 +2,7 @@
void* NewTail()
{
return new TAIL;
return new TAIL{};
}
void InitTail(TAIL* ptail)

View File

@ -2,7 +2,7 @@
void* NewTank()
{
return new TANK;
return new TANK{};
}
void InitTank(TANK* ptank)

View File

@ -2,12 +2,14 @@
void* NewTarget()
{
return new TARGET;
return new TARGET{};
}
void InitTarget(TARGET* ptarget)
{
InitXfm(ptarget);
ptarget->grftak = 0x1e;
ptarget->sRadiusTarget = 25.0;
}
int GetTargetSize()

View File

@ -2,7 +2,7 @@
void* NewTn()
{
return new TN;
return new TN{};
}
void InitTn(TN* ptn)
@ -20,6 +20,8 @@ void LoadTnFromBrx(TN* ptn, CBinaryInputStream* pbis)
ptn->xf.mat = pbis->ReadMatrix();
ptn->xf.pos = pbis->ReadVector();
ptn->pvtalo->pfnUpdateAloXfWorld(ptn);
LoadTbspFromBrx(pbis);
int8_t crvk = pbis->S8Read();

View File

@ -2,7 +2,7 @@
void* NewTurret()
{
return new TURRET;
return new TURRET{};
}
int GetTurretSize()

View File

@ -2,7 +2,7 @@
void* NewUbg()
{
return new UBG;
return new UBG{};
}
void InitUbg(UBG* pubg)
@ -42,7 +42,7 @@ void DeleteUbg(LO* plo)
void* NewUbp()
{
return new UBP;
return new UBP{};
}
int GetUbpSize()
@ -66,7 +66,7 @@ void DeleteUbp(LO* plo)
void* NewUbv()
{
return new UBV;
return new UBV{};
}
int GetUbvSize()

View File

@ -2,7 +2,7 @@
void* NewVismap()
{
return new VISMAP;
return new VISMAP{};
}
void InitVismap(VISMAP *pvismap)

View File

@ -2,7 +2,7 @@
void* NewWater()
{
return new WATER;
return new WATER{};
}
void InitWater(WATER* pwater)

View File

@ -2,7 +2,7 @@
void* NewWaypoint()
{
return new WAYPOINT;
return new WAYPOINT{};
}
void InitWaypoint(WAYPOINT* pwaypoint)

View File

@ -2,7 +2,7 @@
void* NewWm()
{
return new WM;
return new WM{};
}
int GetWmSize()

View File

@ -2,7 +2,7 @@
void* NewWr()
{
return new WR;
return new WR{};
}
void InitWr(WR* pwr)

Some files were not shown because too many files have changed in this diff Show More