CCop::LookForPlayer

This commit is contained in:
krystalgamer 2024-07-24 19:05:33 +02:00
parent 49ed1b5c4f
commit a79bc6b02b
7 changed files with 150 additions and 3 deletions

View File

@ -13,6 +13,12 @@ EXPORT CBaddy* BaddyList;
extern i16** gTrigNodes;
// @SMALLTODO
void CBaddy::GetWaypointNearTarget(CVector*, i32, i32, CVector*)
{
printf("void CBaddy::GetWaypointNearTarget(CVector*, i32, i32, CVector*)");
}
// @NotOk
// check when pathcheck is done <3
i32 CBaddy::AddPointToPath(

View File

@ -48,6 +48,7 @@ public:
EXPORT void RunAppropriateAnim(void);
EXPORT i32 GetNextWaypoint(void);
EXPORT i32 AddPointToPath(CVector*, i32);
EXPORT void GetWaypointNearTarget(CVector*, i32, i32, CVector*);
EXPORT virtual int PlayerIsVisible(int);
EXPORT virtual void CreateCombatImpactEffect(CVector*, int);

95
cop.cpp
View File

@ -3,8 +3,92 @@
#include "ps2lowsfx.h"
#include "mem.h"
#include "utils.h"
#include "spidey.h"
extern CVector gGlobalNormal;
extern CPlayer *MechList;
// @Ok
void CCop::LookForPlayer(void)
{
CVector v5;
v5.vx = 0;
v5.vy = 0;
v5.vz = 0;
switch (this->dumbAssPad)
{
case 0:
this->Neutralize();
this->CycleAnim(this->field_298.Bytes[0], 1);
this->dumbAssPad++;
this->field_21D = Rnd(64);
this->field_1F8 = 0;
break;
case 1:
CVector *mPos;
if (this->field_1F8 < 64)
mPos = &MechList->mPos;
else
mPos = &this->mPos;
this->GetWaypointNearTarget(mPos, 409600, this->field_21D, &v5);
this->field_21D++;
if ( !this->PathCheck(&this->mPos, &v5, 0, 55)
&& (this->AddPointToPath(&v5, 0)
|| this->AddPointToPath(&this->mPos, 0)
&& this->AddPointToPath(&v5, 0)) )
{
this->field_31C.bothFlags = 24;
this->dumbAssPad = 0;
}
else
{
if ( this->field_1F8++ > 128 )
{
this->field_324 = 0;
this->field_31C.bothFlags = 2;
this->dumbAssPad = 0;
}
}
break;
default:
print_if_false(0, "Unknown substate!");
break;
}
}
// @SMALLTODO
void CCopBulletTracer::Move(void)
{
printf("void CCopBulletTracer::Move(void)");
}
// @SMALLTODO
void CCopBulletTracer::SetWidth(void)
{
printf("void CCopBulletTracer::SetWidth(void)");
}
// @SMALLTODO
CCopBulletTracer::CCopBulletTracer(CVector*, CVector*, CSuper*, SLineInfo*, u8, u8, u8)
{
printf("CCopBulletTracer::CCopBulletTracer(CVector*, CVector*, CSuper*, SLineInfo*, u8, u8, u8)");
}
// @Ok
CCopBulletTracer::~CCopBulletTracer(void)
{
if (this->field_3C)
delete this->field_3C;
if (this->field_40)
delete this->field_40;
this->field_3C = 0;
this->field_40 = 0;
}
// @Ok
CCopPing::CCopPing(CSuper* pHost, SHook* pHook)
@ -128,6 +212,9 @@ void CCop::ClearAttackFlags(void)
void validate_CCop(void){
VALIDATE_SIZE(CCop, 0x394);
VALIDATE(CCop, field_324, 0x324);
VALIDATE(CCop, field_340, 0x340);
VALIDATE(CCop, field_360, 0x360);
VALIDATE(CCop, field_364, 0x364);
@ -149,3 +236,11 @@ void validate_CCopPing(void)
VALIDATE(CCopPing, field_70, 0x70);
VALIDATE(CCopPing, field_78, 0x78);
}
void validate_CCopBulletTracer(void)
{
VALIDATE_SIZE(CCopBulletTracer, 0x48);
VALIDATE(CCopBulletTracer, field_3C, 0x3C);
VALIDATE(CCopBulletTracer, field_40, 0x40);
}

23
cop.h
View File

@ -7,6 +7,7 @@
#include "baddy.h"
#include "mem.h"
#include "m3dutils.h"
#include "weapons.h"
class CCop : public CBaddy {
@ -15,8 +16,10 @@ public:
EXPORT CCop(int*, int);
EXPORT void Victorious(void);
EXPORT void ClearAttackFlags(void);
EXPORT void LookForPlayer(void);
unsigned char copStartPad[0x1C];
i32 field_324;
u8 padAfter324[0x340-0x324-4];
int field_340;
unsigned char padAfter340[0x20 - 4];
@ -48,8 +51,26 @@ class CCopPing : public CSimpleAnim
SHook field_78;
};
class CCopBulletTracer : public CNonRenderedBit
{
public:
EXPORT CCopBulletTracer(CVector*, CVector*, CSuper*, SLineInfo*, u8, u8, u8);
EXPORT virtual ~CCopBulletTracer(void);
EXPORT void SetWidth(void);
EXPORT virtual void Move(void);
CGouradRibbon *field_3C;
CGouradRibbon *field_40;
u8 padBottom[0x48-0x40-4];
};
void validate_CCop(void);
void validate_CCopPing(void);
void validate_CCopBulletTracer(void);
EXPORT void Cop_CreateCop(const unsigned int *stack, unsigned int *result);

View File

@ -72,6 +72,7 @@
#include "spool.h"
#include "l1a3bomb.h"
#include "chunk.h"
#include "weapons.h"
// @Ok
void* CClass::operator new(size_t size)
@ -369,6 +370,8 @@ int main()
validate_CChopperMissile();
validate_CChunkControl();
validate_SChunkEntry();
validate_CGouradRibbon();
validate_CCopBulletTracer();
puts("[*] Validation done!");

View File

@ -1 +1,11 @@
#include "weapons.h"
#include "weapons.h"
// @SMALLTODO
CGouradRibbon::CGouradRibbon(i32, i32)
{
printf("CGouradRibbon::CGouradRibbon(i32, i32)");
}
void validate_CGouradRibbon(void)
{
}

View File

@ -3,4 +3,15 @@
#ifndef WEAPONS_H
#define WEAPONS_H
#endif
#include "bit.h"
#include "export.h"
class CGouradRibbon : public CSpecialDisplay
{
public:
EXPORT CGouradRibbon(i32, i32);
};
void validate_CGouradRibbon(void);
#endif