mirror of
https://github.com/krystalgamer/spidey-decomp.git
synced 2024-11-26 23:00:30 +00:00
CManipOb::CalculateThrowPositionArray
This commit is contained in:
parent
f67709c9d7
commit
c0267e4ae5
1
.github/workflows/c-cpp.yml
vendored
1
.github/workflows/c-cpp.yml
vendored
@ -43,6 +43,7 @@ jobs:
|
||||
|
||||
build-mac:
|
||||
|
||||
if: false
|
||||
runs-on: macos-13
|
||||
|
||||
steps:
|
||||
|
47
manipob.cpp
47
manipob.cpp
@ -2,16 +2,53 @@
|
||||
#include "utils.h"
|
||||
#include "validate.h"
|
||||
#include "trig.h"
|
||||
#include "mem.h"
|
||||
|
||||
// @TODO
|
||||
void CManipOb::CalculateThrowPosition(CVector*, int)
|
||||
static i16 * const word_610C48 = (i16*)0x610C48;
|
||||
|
||||
// @NotOk
|
||||
// @Test
|
||||
// Globals
|
||||
void CManipOb::CalculateThrowPositionArray(CVector* pVector, int NumVectors)
|
||||
{
|
||||
|
||||
this->mNumVectors = NumVectors;
|
||||
|
||||
i32 v15 = (pVector->vx - this->mPos.vx) / NumVectors;
|
||||
i32 v16 = (pVector->vy - this->mPos.vy) / NumVectors;
|
||||
i32 v1 = (pVector->vz - this->mPos.vz) / NumVectors;
|
||||
|
||||
this->pVectors = reinterpret_cast<CVector*>(DCMem_New(12 * NumVectors, 0, 1, 0, 1));
|
||||
|
||||
|
||||
i32 v9 = v15 + this->mPos.vx;
|
||||
i32 v10 = v16 + this->mPos.vy;
|
||||
i32 v11 = v1 + this->mPos.vz;
|
||||
|
||||
i32 v17 = 2048 / (this->mNumVectors - 1);
|
||||
i32 v14 = 0;
|
||||
|
||||
i32 index = 0;
|
||||
while (index < this->mNumVectors)
|
||||
{
|
||||
this->pVectors[index].vx = v9;
|
||||
this->pVectors[index].vy = v10 - (word_610C48[2 * (v14 & 0xFFF)] << 8);
|
||||
this->pVectors[index].vz = v11;
|
||||
|
||||
v9 += v15;
|
||||
v10 += v16;
|
||||
v11 += v1;
|
||||
v14 += v17;
|
||||
index++;
|
||||
}
|
||||
|
||||
this->field_100 = 0;
|
||||
}
|
||||
|
||||
// @Ok
|
||||
void CManipOb::ThrowPos(CVector *a2, int a3)
|
||||
{
|
||||
this->CalculateThrowPosition(a2, a3);
|
||||
this->CalculateThrowPositionArray(a2, a3);
|
||||
|
||||
this->mFlags &= 0xF7FF;
|
||||
this->field_10C |= 1;
|
||||
@ -100,6 +137,10 @@ void validate_CManipOb(void)
|
||||
{
|
||||
VALIDATE_SIZE(CManipOb, 0x128);
|
||||
|
||||
VALIDATE(CManipOb, mNumVectors, 0xF8);
|
||||
VALIDATE(CManipOb, pVectors, 0xFC);
|
||||
VALIDATE(CManipOb, field_100, 0x100);
|
||||
|
||||
VALIDATE(CManipOb, field_10C, 0x10C);
|
||||
VALIDATE(CManipOb, field_124, 0x124);
|
||||
}
|
||||
|
11
manipob.h
11
manipob.h
@ -10,7 +10,7 @@
|
||||
class CManipOb : public CBody
|
||||
{
|
||||
public:
|
||||
EXPORT void CalculateThrowPosition(CVector*, int);
|
||||
EXPORT void CalculateThrowPositionArray(CVector*, int);
|
||||
EXPORT void ThrowPos(CVector *, int);
|
||||
EXPORT void Throw(CVector *);
|
||||
EXPORT void Smash(void);
|
||||
@ -20,7 +20,14 @@ class CManipOb : public CBody
|
||||
EXPORT void SendPulse(void);
|
||||
EXPORT void Pickup(void);
|
||||
|
||||
unsigned char padTop[0x10C-0xF4];
|
||||
u8 padTop[0xf8-0xF4];
|
||||
|
||||
i32 mNumVectors;
|
||||
CVector *pVectors;
|
||||
i32 field_100;
|
||||
|
||||
u8 padAfter100[0x10C-0x100-4];
|
||||
|
||||
int field_10C;
|
||||
unsigned char padAfter10C[0x124-0x10C-4];
|
||||
|
||||
|
15
vector.h
15
vector.h
@ -13,9 +13,10 @@
|
||||
class CVector
|
||||
{
|
||||
public:
|
||||
int vx;
|
||||
int vy;
|
||||
int vz;
|
||||
i32 vx;
|
||||
i32 vy;
|
||||
i32 vz;
|
||||
|
||||
EXPORT void KillSmall();
|
||||
EXPORT CVector* operator-=(const CVector& other);
|
||||
EXPORT CVector* operator>>=(const int& other);
|
||||
@ -49,14 +50,14 @@ EXPORT CVector operator>>(const CVector& lhs, const int& other);
|
||||
class CSVector{
|
||||
|
||||
public:
|
||||
short vx;
|
||||
short vy;
|
||||
short vz;
|
||||
i16 vx;
|
||||
i16 vy;
|
||||
i16 vz;
|
||||
|
||||
};
|
||||
|
||||
struct SVector {
|
||||
__int16 vx, vy, vz;
|
||||
i16 vx, vy, vz;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user