mirror of
https://github.com/krystalgamer/spidey-decomp.git
synced 2024-11-23 05:19:43 +00:00
DCInitSinCosTable and rename FlatBitVelocities to rcossin_tbl
This commit is contained in:
parent
2c74dd09ca
commit
4fd561c0fc
7
bit.cpp
7
bit.cpp
@ -20,7 +20,6 @@ EXPORT i32 TotalBitUsage = 0;
|
||||
EXPORT CFlatBit *FlatBitList;
|
||||
EXPORT CSpecialDisplay *SpecialDisplayList;
|
||||
|
||||
SFlatBitVelocity FlatBitVelocities[FLATBIT_VELOCITIES_SIZE];
|
||||
|
||||
EXPORT CPixel* PixelList;
|
||||
|
||||
@ -1162,10 +1161,10 @@ void validate_CSpecialDisplay(void)
|
||||
|
||||
void validate_SFlatBitVelocity(void)
|
||||
{
|
||||
VALIDATE_SIZE(SFlatBitVelocity, 0x4);
|
||||
VALIDATE_SIZE(SSinCos, 0x4);
|
||||
|
||||
VALIDATE(SFlatBitVelocity, vxVel, 0x0);
|
||||
VALIDATE(SFlatBitVelocity, vzVel, 0x2);
|
||||
VALIDATE(SSinCos, sin, 0x0);
|
||||
VALIDATE(SSinCos, cos, 0x2);
|
||||
}
|
||||
|
||||
void validate_CCombatImpactRing(void)
|
||||
|
14
bit.h
14
bit.h
@ -8,9 +8,6 @@
|
||||
#include "texture.h"
|
||||
#include "ps2funcs.h"
|
||||
|
||||
#define FLATBIT_VELOCITIES_SIZE (4096)
|
||||
#define FLATBIT_VELOCITIES_MAX_INDEX (FLATBIT_VELOCITIES_SIZE-1)
|
||||
|
||||
EXPORT extern u32 SparkSize;
|
||||
EXPORT extern i32 gTimerRelated;
|
||||
|
||||
@ -41,12 +38,6 @@ struct SRibbonPoint {
|
||||
i32 Last3Scr;
|
||||
};
|
||||
|
||||
struct SFlatBitVelocity
|
||||
{
|
||||
i16 vxVel;
|
||||
i16 vzVel;
|
||||
};
|
||||
|
||||
class CBit
|
||||
{
|
||||
public:
|
||||
@ -380,11 +371,6 @@ EXPORT void Bit_Init(void);
|
||||
|
||||
EXPORT extern CTextBox* TextBoxList;
|
||||
|
||||
// @FIXME
|
||||
// that's not the name
|
||||
// it's something like rcosin_table
|
||||
EXPORT extern SFlatBitVelocity FlatBitVelocities[FLATBIT_VELOCITIES_SIZE];
|
||||
|
||||
EXPORT extern i32 gAnimTable[0x1D];
|
||||
|
||||
void validate_CFlatBit(void);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
extern CBody* ControlBaddyList;
|
||||
extern CBaddy* BaddyList;
|
||||
extern SFlatBitVelocity FlatBitVelocities[];
|
||||
extern SSinCos rcossin_tbl[];
|
||||
|
||||
extern i32 DifficultyLevel;
|
||||
extern i16 **gTrigNodes;
|
||||
@ -467,8 +467,8 @@ CBulletFrag::CBulletFrag(CVector* a2)
|
||||
i32 v3 = Rnd(4096);
|
||||
i32 v4 = Rnd(10) + 10;
|
||||
|
||||
this->mVel.vx = v4 * FlatBitVelocities[v3 & FLATBIT_VELOCITIES_MAX_INDEX].vxVel;
|
||||
this->mVel.vz = v4 * FlatBitVelocities[v3 & FLATBIT_VELOCITIES_MAX_INDEX].vzVel;
|
||||
this->mVel.vx = v4 * rcossin_tbl[v3 & FLATBIT_VELOCITIES_MAX_INDEX].sin;
|
||||
this->mVel.vz = v4 * rcossin_tbl[v3 & FLATBIT_VELOCITIES_MAX_INDEX].cos;
|
||||
|
||||
this->mVel.vy = -81920 - (Rnd(30) << 12);
|
||||
this->field_5A = 500;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "validate.h"
|
||||
|
||||
|
||||
extern SFlatBitVelocity FlatBitVelocities[];
|
||||
extern SSinCos rcossin_tbl[];
|
||||
|
||||
extern CBody* ControlBaddyList;
|
||||
|
||||
@ -30,9 +30,9 @@ void CChunkControl::AddChunk(CItem* pItem)
|
||||
i32 v4 = Rnd(4096) & 0xFFF;
|
||||
i32 v5 = Rnd(32) + 32;
|
||||
|
||||
entry->field_4.vx = v5 * FlatBitVelocities[v4].vxVel;
|
||||
entry->field_4.vx = v5 * rcossin_tbl[v4].sin;
|
||||
entry->field_4.vy = (-48 - Rnd(32)) << 12;
|
||||
entry->field_4.vz = v5 * FlatBitVelocities[v4].vzVel;
|
||||
entry->field_4.vz = v5 * rcossin_tbl[v4].cos;
|
||||
entry->field_14.vx = Rnd(512) - 256;
|
||||
entry->field_14.vy = Rnd(512) - 256;
|
||||
entry->field_14.vz = Rnd(512) - 256;
|
||||
|
10
effects.cpp
10
effects.cpp
@ -5,7 +5,7 @@
|
||||
#include "validate.h"
|
||||
|
||||
extern i32 CurrentSuit;
|
||||
extern SFlatBitVelocity FlatBitVelocities[];
|
||||
extern SSinCos rcossin_tbl[];
|
||||
|
||||
EXPORT i32 gTextureRelated;
|
||||
|
||||
@ -103,8 +103,8 @@ CBouncingRock::CBouncingRock(
|
||||
i32 v6 = Rnd(4096);
|
||||
i32 v7 = Rnd(10) + 10;
|
||||
i32 v8 = v6 & 0xFFF;
|
||||
this->mVel.vx = v7 * FlatBitVelocities[v8].vxVel;
|
||||
this->mVel.vz = v7 * FlatBitVelocities[v8].vzVel;
|
||||
this->mVel.vx = v7 * rcossin_tbl[v8].sin;
|
||||
this->mVel.vz = v7 * rcossin_tbl[v8].cos;
|
||||
|
||||
this->mVel.vy = -81920 - (Rnd(20) << 12);
|
||||
this->field_5A = 500;
|
||||
@ -229,8 +229,8 @@ CFootprint::CFootprint(CVector* pVector, i32 a3)
|
||||
this->mPosC.vy = pVector->vy;
|
||||
this->mPosD.vy = pVector->vy;
|
||||
|
||||
i32 vxVel = FlatBitVelocities[a3 & 0xFFF].vxVel;
|
||||
i32 vzVel = FlatBitVelocities[a3 & 0xFFF].vzVel;
|
||||
i32 vxVel = rcossin_tbl[a3 & 0xFFF].sin;
|
||||
i32 vzVel = rcossin_tbl[a3 & 0xFFF].cos;
|
||||
|
||||
this->mPos.vx = vxVel - vzVel;
|
||||
i32 v12 = vxVel + vzVel;
|
||||
|
@ -29,7 +29,7 @@ void M3dInit_InitAtStart(void)
|
||||
{
|
||||
for (i32 j = 0; j < 4096; j+=64)
|
||||
{
|
||||
*pWibble = (i * FlatBitVelocities[j].vxVel) >> 4;
|
||||
*pWibble = (i * rcossin_tbl[j].sin) >> 4;
|
||||
pWibble++;
|
||||
}
|
||||
}
|
||||
|
14
ps2funcs.cpp
14
ps2funcs.cpp
@ -7,6 +7,8 @@
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
SSinCos rcossin_tbl[FLATBIT_VELOCITIES_SIZE];
|
||||
|
||||
i32 gClutRelatedOne;
|
||||
i32 gClutRelatedTwo;
|
||||
|
||||
@ -585,3 +587,15 @@ void DCSetFatalError(i32)
|
||||
printf("void DCSetFatalError(i32)");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// @Ok
|
||||
void DCInitSinCosTable(void)
|
||||
{
|
||||
for (i32 i = 0; i < FLATBIT_VELOCITIES_SIZE; i++)
|
||||
{
|
||||
double v9 = (double)i * 0.001536096911877394;
|
||||
rcossin_tbl[i].sin = sin(v9) * 4096.0;
|
||||
rcossin_tbl[i].cos = cos(v9) * 4096.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
16
ps2funcs.h
16
ps2funcs.h
@ -6,6 +6,21 @@
|
||||
#include "export.h"
|
||||
#include "quat.h"
|
||||
|
||||
|
||||
struct SSinCos
|
||||
{
|
||||
i16 sin;
|
||||
i16 cos;
|
||||
};
|
||||
|
||||
#define FLATBIT_VELOCITIES_SIZE (4096)
|
||||
#define FLATBIT_VELOCITIES_MAX_INDEX (FLATBIT_VELOCITIES_SIZE-1)
|
||||
|
||||
// @FIXME
|
||||
// that's not the name
|
||||
// it's something like rcosin_table
|
||||
EXPORT extern SSinCos rcossin_tbl[FLATBIT_VELOCITIES_SIZE];
|
||||
|
||||
EXPORT extern i32 gClutRelatedOne;
|
||||
EXPORT extern i32 gClutRelatedTwo;
|
||||
|
||||
@ -106,6 +121,7 @@ EXPORT void MTC2(i32*, GTREGType);
|
||||
|
||||
|
||||
EXPORT void DCSetFatalError(i32);
|
||||
EXPORT void DCInitSinCosTable(void);
|
||||
|
||||
// @Ok
|
||||
INLINE static void DrawSync(void)
|
||||
|
Loading…
Reference in New Issue
Block a user