CL1A3Bomb::CL1A3Bomb and CManipOb::CManipOb

This commit is contained in:
krystalgamer 2024-07-15 17:50:21 +02:00
parent 9317a3be85
commit 870df8a924
19 changed files with 146 additions and 22 deletions

View File

@ -15,7 +15,7 @@ CBlackCat::CBlackCat(int* a2, int a3)
this->InitItem("bc2");
}
__int16 *v5 = this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
i16 *v5 = this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2)));
this->field_21E = 100;
this->RunAnim(0xC, 0, -1);

View File

@ -4,6 +4,8 @@
#include "panel.h"
#include "spool.h"
extern const char *gObjFile;
// @NotOk
// globals
CCarnage::CCarnage(int* a2, int a3)
@ -16,7 +18,7 @@ CCarnage::CCarnage(int* a2, int a3)
this->field_378 = 0;
this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2)));
this->InitItem("carnage");
this->AttachTo(reinterpret_cast<CBody**>(0x56E9900));

View File

@ -6,7 +6,7 @@
// globals
CCop::CCop(int* a2, int a3)
{
__int16 *v5 = this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
i16 *v5 = this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2)));
this->ShadowOn();
this->field_D0 = 50;
this->AttachTo(reinterpret_cast<CBody**>(0x56E9900));

View File

@ -32,7 +32,7 @@ CDocOc::CDocOc(int *a2, int a3)
Trig_GetPosition(&this->field_50C, LinksPointer[1]);
this->field_4A8 = reinterpret_cast<int>(
this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2))));
this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2))));
this->InitItem("docock");

View File

@ -190,7 +190,7 @@ void __inline CHostage::GetUp(void)
CHostage::CHostage(int* a2, int a3)
{
__int16 *afterAngles = this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
i16 *afterAngles = this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
this->AttachTo(reinterpret_cast<CBody**>(0x56E9900));
this->ShadowOn();

View File

@ -1 +1,24 @@
#include "l1a3bomb.h"
#include "l1a3bomb.h"
#include "validate.h"
u32 gBombRelated;
// @Ok
CL1A3Bomb::CL1A3Bomb(
u16* a2,
i32 a3)
: CManipOb(a2, a3)
{
this->field_128 = 0;
this->field_129 = 0;
gBombRelated = 4096;
}
void validate_CL1A3Bomb(void)
{
VALIDATE_SIZE(CL1A3Bomb, 0x12C);
VALIDATE(CL1A3Bomb, field_128, 0x128);
VALIDATE(CL1A3Bomb, field_129, 0x129);
}

View File

@ -3,4 +3,19 @@
#ifndef L1A3BOMB_H
#define L1A3BOMB_H
#endif
#include "export.h"
#include "manipob.h"
class CL1A3Bomb : public CManipOb
{
public:
EXPORT CL1A3Bomb(u16*, i32);
u8 field_128;
u8 field_129;
u8 padBottom[0x12C-0x129-1];
};
void validate_CL1A3Bomb(void);
#endif

View File

@ -70,6 +70,7 @@
#include "ai.h"
#include <cstring>
#include "spool.h"
#include "l1a3bomb.h"
// @Ok
void* CClass::operator new(size_t size)
@ -332,6 +333,7 @@ int main()
validate_CConstantLaser();
validate_CShellSymBurn();
validate_CExpandingBox();
validate_CL1A3Bomb();
puts("[*] Validation done!");

View File

@ -7,6 +7,63 @@
extern SPSXRegion PSXRegion[];
static i16 * const word_610C48 = (i16*)0x610C48;
extern const char *gObjFile;
extern u8 gObjFileRegion;
extern CBody* EnvironmentalObjectList[1];
// @Ok
CManipOb::CManipOb(
u16* a2,
i32 a3)
{
this->field_110 = 0;
this->field_114 = 0;
this->field_118 = 0;
this->InitItem(gObjFile);
this->AttachTo(&EnvironmentalObjectList[0]);
this->mFlags = this->mFlags & 0x0FFFD | 0x10;
this->field_38 = 401;
this->field_DE = a3;
this->field_78 = 12;
this->field_7A = 12;
this->field_79 = 12;
u32* v6 = reinterpret_cast<u32*>(
(reinterpret_cast<u32>(
this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(reinterpret_cast<i32*>(a2))))) + 3)
& 0xFFFFFFFC);
i32 *v8 = reinterpret_cast<i32*>(v6 + 1);
this->mModel = Spool_GetModel(*v6, gObjFileRegion);
if (*v8)
{
this->field_11C = Spool_FindEnviroItem(*v8++);
}
this->field_120 = reinterpret_cast<i32>(v8);
i32 *v10 = v8;
while (*v10++);
u16 v12 = *reinterpret_cast<u16*>(v10);
if (*reinterpret_cast<u16*>(v10) & 1)
this->field_10C |= 8;
if (v12 & 2)
{
this->field_10C |= 0x20;
}
this->field_108 = *(reinterpret_cast<u16*>(v10) + 1);
this->field_104 = *(reinterpret_cast<u16*>(v10) + 2);
}
// @NotOk
// @Test
@ -150,7 +207,16 @@ void validate_CManipOb(void)
VALIDATE(CManipOb, pVectors, 0xFC);
VALIDATE(CManipOb, field_100, 0x100);
VALIDATE(CManipOb, field_104, 0x104);
VALIDATE(CManipOb, field_108, 0x108);
VALIDATE(CManipOb, field_10C, 0x10C);
VALIDATE(CManipOb, field_110, 0x110);
VALIDATE(CManipOb, field_114, 0x114);
VALIDATE(CManipOb, field_118, 0x118);
VALIDATE(CManipOb, field_11C, 0x11C);
VALIDATE(CManipOb, field_120, 0x120);
VALIDATE(CManipOb, field_124, 0x124);
}

View File

@ -20,23 +20,30 @@ class CManipOb : public CBody
EXPORT void SendPulse(void);
EXPORT void Pickup(void);
EXPORT CManipOb(u16*, i32);
u8 padTop[0xf8-0xF4];
i32 mNumVectors;
CVector *pVectors;
i32 field_100;
u8 padAfter100[0x10C-0x100-4];
i16 field_104;
u8 padAfter104[2];
int field_10C;
u8 padAfter10C[0x11C-0x10C-4];
i16 field_108;
i32 field_10C;
i32 field_110;
i32 field_114;
i32 field_118;
CItem *field_11C;
u8 padAfter11C[0x124-0x11C-4];
unsigned char field_124;
unsigned char padBottom[0x128-0x124-1];
u32 field_120;
u8 field_124;
u8 padAfter124[0x128-0x124-1];
};
void validate_CManipOb(void);

2
mj.cpp
View File

@ -24,7 +24,7 @@ CMJ::CMJ(int* a2, __int16 a3)
{
this->InitItem("mj");
this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2)));
this->CycleAnim(0, 1);
this->mFlags |= 0x480;

View File

@ -33,7 +33,7 @@ typedef unsigned __int16 u16;
typedef unsigned int u32;
typedef char i8;
typedef short i16;
typedef __int16 i16;
typedef int i32;
#define INLINE __inline

4
ob.cpp
View File

@ -7,6 +7,8 @@
#include "ps2m3d.h"
#include "m3dutils.h"
const char *gObjFile;
// @Ok
CBody* CBody::FindBodyByNode(
i32 type,
@ -292,7 +294,7 @@ int* CBody::SquirtPos(int *params)
}
// @Ok
__int16* CBody::SquirtAngles(__int16* params)
i16* CBody::SquirtAngles(i16* params)
{
this->mAngles.vx = *params++;
this->mAngles.vy = *params++;

3
ob.h
View File

@ -13,7 +13,6 @@ struct SHitInfo;
static unsigned char * const Regions = (unsigned char*)0x006B2449;
static int *** const CItemRelatedList = (int***)0x006B2454;
static const char *gObjFile;
class CItem
{
@ -147,7 +146,7 @@ public:
EXPORT void InterleaveAI(void);
EXPORT int* SquirtPos(int*);
EXPORT __int16* SquirtAngles(__int16*);
EXPORT i16* SquirtAngles(i16*);
EXPORT void AttachXA(int, int);
EXPORT void StopMyXA(void);
EXPORT void UnSuspend(void);

View File

@ -10,7 +10,7 @@ static __int16 * const word_682B64 = (__int16*)0x682B64;
CRhino::CRhino(int* a2, int a3)
{
__int16 *v5 = this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
i16 *v5 = this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2)));
this->InitItem("rhino");
this->mFlags |= 0x480;

View File

@ -15,6 +15,12 @@ static const char SuitNames[5][32];
static const char SuitNames[5][32] = { 0 };
#endif
// @SMALLTODO
CItem* Spool_FindEnviroItem(u32)
{
return reinterpret_cast<CItem*>(0x15072024);
}
// @NotOk
// Change constants with proper variables
int Spool_FindRegion(const char *a1)

View File

@ -6,6 +6,7 @@
#include "export.h"
#include "texture.h"
#include "ob.h"
struct SPSXRegion {
// offset: 0000 (9 bytes)
@ -75,6 +76,7 @@ EXPORT void Spool_ClearAllPSXs(void);
EXPORT void ClearRegion(int, int);
EXPORT void Spool_RemoveUnusedTextures(void);
EXPORT void Spool_ClearPSX(const char*);
EXPORT CItem* Spool_FindEnviroItem(u32);
void validate_SPSXRegion(void);

View File

@ -616,7 +616,7 @@ void CThug::SetHitDirectionFlag(CVector* pVector)
// also a little out of order with the v6 | 1 thing :(
CThug::CThug(int *a2, int a3)
{
__int16 *v5 = this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
__int16 *v5 = this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2)));
this->field_3B8 = Trig_GetLevelId();

View File

@ -8,7 +8,7 @@
CTorch::CTorch(int* a2, int a3)
{
this->InitItem("torch");
__int16 *v5 = this->SquirtAngles(reinterpret_cast<__int16*>(this->SquirtPos(a2)));
__int16 *v5 = this->SquirtAngles(reinterpret_cast<i16*>(this->SquirtPos(a2)));
this->field_21E = 100;
this->field_330 = 2;