CPlayer::DecreaseWebbing

This commit is contained in:
krystalgamer 2024-05-11 16:08:12 +02:00
parent a8a6b01d51
commit d984f20bff
9 changed files with 131 additions and 3 deletions

6
ps2lowsfx.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "ps2lowsfx.h"
// @TODO
void SFX_PlayPos(unsigned int, CVector*, int)
{}

13
ps2lowsfx.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#ifndef PS2LOWSFX_H
#define PS2LOWSFX_H
#include "export.h"
#include "vector.h"
EXPORT void SFX_PlayPos(unsigned int, CVector*, int);
#endif

View File

@ -5,3 +5,9 @@
void Redbook_XAStop(void)
{
}
// @TODO
int Redbook_XAPlay(int, int, int)
{
return 0x1235959;
}

View File

@ -7,5 +7,6 @@
EXPORT void Redbook_XAStop(void);
EXPORT int Redbook_XAPlay(int, int, int);
#endif

View File

@ -204,6 +204,10 @@ SOURCE=.\ps2funcs.cpp
# End Source File
# Begin Source File
SOURCE=.\ps2lowsfx.cpp
# End Source File
# Begin Source File
SOURCE=.\ps2m3d.cpp
# End Source File
# Begin Source File
@ -408,6 +412,10 @@ SOURCE=.\ps2funcs.h
# End Source File
# Begin Source File
SOURCE=.\ps2lowsfx.h
# End Source File
# Begin Source File
SOURCE=.\ps2m3d.h
# End Source File
# Begin Source File

View File

@ -5,6 +5,9 @@
#include "screen.h"
#include "ps2funcs.h"
#include <cmath>
#include "ps2lowsfx.h"
#include "ps2redbook.h"
#include "utils.h"
// @Ok
void CPlayer::SetIgnoreInputTimer(int a2)
@ -172,13 +175,85 @@ void CPlayer::SetTargetTorsoAngle(__int16, int)
{
}
static int * const dword_60CFE8 = (int*)0x60CFE8;
static int * const dword_54D474 = (int*)0x54D474;
static char * const byte_682770 = (char*)0x682770;
extern int CurrentSuit;
// @NotOk
// Globals
// The part with >> 12 has a jump in the original rather than it's perfect
char CPlayer::DecreaseWebbing(int a2)
{
if (!this->field_1AC &&
!*dword_60CFE8 &&
CurrentSuit != 3 &&
CurrentSuit != 4)
{
int v3;
int v4;
int tmpDword = *dword_54D474;
if (!tmpDword)
{
v3 = a2 << 7;
v4 = v3 >> 12;
}
else if (tmpDword == 1)
{
v3 = a2 << 11;
v4 = v3 >> 12;
}
int v5 = this->field_5D4;
if (v5 > v4)
{
this->field_5D4 = v5 - v4;
return 1;
}
int v7 = this->field_5D8;
if (v7)
{
this->field_5D4 = v5 - v4 + 4096;
this->field_5D8 = v7 - 1;
SFX_PlayPos(0x1E, &this->mPos, 0);
this->field_5E8 = 0;
return 1;
}
if (!this->field_E10)
{
if (!*byte_682770)
{
Redbook_XAPlay(33, Rnd(3) + 2, 0);
}
this->field_5E8 = 0;
return 0;
}
return 1;
}
return 1;
}
void validate_CPlayer(void)
{
VALIDATE_SIZE(CPlayer, 0xEFC);
VALIDATE(CPlayer, field_1AC, 0x1AC);
VALIDATE(CPlayer, field_56C, 0x56C);
VALIDATE(CPlayer, field_5D4, 0x5D4);
VALIDATE(CPlayer, field_5D8, 0x5D8);
VALIDATE(CPlayer, field_5E8, 0x5E8);
VALIDATE(CPlayer, field_89C, 0x89C);
VALIDATE(CPlayer, field_8E9, 0x8E9);
@ -192,6 +267,7 @@ void validate_CPlayer(void)
VALIDATE(CPlayer, field_DE4, 0xDE4);
VALIDATE(CPlayer, field_E10, 0xE10);
VALIDATE(CPlayer, field_E12, 0xE12);
VALIDATE(CPlayer, field_E18, 0xE18);
}

View File

@ -11,10 +11,19 @@ class CPlayer : public CSuper
{
public:
unsigned char padTopPlayer[0x56C-0x194];
unsigned char padTopPlayer[0x1AC-0x194];
char field_1AC;
unsigned char padAfter1AC[0x56C-0x1AC-1];
int field_56C;
unsigned char padAfter56C[0x89C-0x56C-4];
unsigned char padAfter56C[0x5D4-0x56C-4];
int field_5D4;
int field_5D8;
unsigned char padAfter5D8[0x5E8-0x5D8-4];
char field_5E8;
unsigned char padAfter5E8[0x89C-0x5E8-4];
MATRIX field_89C;
unsigned char padAfter89C[0x8E9-0x89C-sizeof(MATRIX)];
@ -36,8 +45,9 @@ class CPlayer : public CSuper
unsigned char padAfterCE4[0xDE4-0xCE4-4];
char field_DE4;
unsigned char padAfterDE4[0xE12-0xDE4-1];
unsigned char padAfterDE4[0xE10-0xDE4-1];
char field_E10;
__int16 field_E12;
unsigned char padAfterE12[4];
@ -55,6 +65,7 @@ class CPlayer : public CSuper
EXPORT __int16 GetEffectiveHeading(void);
EXPORT void SetTargetTorsoAngle(__int16, int);
EXPORT char DecreaseWebbing(int);
};
void validate_CPlayer(void);

View File

@ -138,3 +138,9 @@ int Utils_CopyString(const char* src, char* dst, int maxSize)
*dst = 0;
return total;
}
// @TODO
int Rnd(int)
{
return 0x420420;
}

View File

@ -9,3 +9,4 @@ EXPORT int 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);
EXPORT int Rnd(int);