Skip to content

Commit

Permalink
CThug::TryAddingCollidePointToPath
Browse files Browse the repository at this point in the history
  • Loading branch information
krystalgamer committed Jun 9, 2024
1 parent b6f0326 commit 92fc1e0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
21 changes: 21 additions & 0 deletions thug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "m3dutils.h"
#include "message.h"
#include "ps2lowsfx.h"
#include "utils.h"

// @NotOk
// Globals
Expand Down Expand Up @@ -256,6 +257,26 @@ void __inline CThug::StopShooting(void)
}
}

// @TODO
i32 CThug::AddPointToPath(CVector*, i32)
{
return 0x09062024;
}

// @Ok
i32 CThug::TryAddingCollidePointToPath(CVector* pVector)
{
if (Utils_CrapDist(*pVector, this->mPos) < 0x64)
return 0;

CVector v5 = *pVector - this->mPos;
v5 >>= 0xC;
v5 *= 0xE74;
v5 += this->mPos;
return this->AddPointToPath(&v5, 0);
}


void validate_CThug(void){

VALIDATE_SIZE(CThug, 0x3C0);
Expand Down
2 changes: 2 additions & 0 deletions thug.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class CThug : public CBaddy {
EXPORT void DieAfterFlyingAcrossRoom(void);
EXPORT void RunAppropriateHitAnim(void);
EXPORT void StopShooting(void);
EXPORT i32 AddPointToPath(CVector*, i32);
EXPORT i32 TryAddingCollidePointToPath(CVector*);

EXPORT virtual void SetThugType(int);

Expand Down
17 changes: 9 additions & 8 deletions utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
#include <cmath>


int Utils_CrapDist(const CVector& a,const CVector& b){
// @NotOk
// @Test
u32 Utils_CrapDist(const CVector& a,const CVector& b){


int dX = a.vx - b.vx;
int dY = a.vy - b.vy;
int dZ = a.vz - b.vz;
i32 dX = a.vx - b.vx;
i32 dY = a.vy - b.vy;
i32 dZ = a.vz - b.vz;

if (dX < 0) {
dX = -dX;
Expand Down Expand Up @@ -46,7 +48,9 @@ int Utils_CrapDist(const CVector& a,const CVector& b){
return ((dZ >> 1) + dX + (dY >>2)) >> 12;
}

int Utils_CrapXZDist(const CVector& a,const CVector& b) {
// @NotOk
// @Test
u32 Utils_CrapXZDist(const CVector& a,const CVector& b) {
CVector tmp = a;
tmp.vy = b.vy;
return Utils_CrapDist(tmp, b);
Expand All @@ -62,9 +66,6 @@ int Utils_CompareStrings(const char* left, const char* right) {
return 0;
}




if (right != NULL){

char currLeft = *left;
Expand Down
4 changes: 2 additions & 2 deletions utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "ob.h"


EXPORT int Utils_CrapDist(const CVector& a,const CVector& b);
EXPORT int Utils_CrapXZDist(const CVector& a,const CVector& b);
EXPORT u32 Utils_CrapDist(const CVector& a,const CVector& b);
EXPORT u32 Utils_CrapXZDist(const CVector& a,const CVector& b);
EXPORT int Utils_CompareStrings(const char* left, const char* right);
EXPORT int Utils_ArcCos(int val);
EXPORT int Utils_CopyString(const char*, char*, int);
Expand Down

0 comments on commit 92fc1e0

Please sign in to comment.