mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 11:34:14 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
16624e174b
@ -34,6 +34,8 @@
|
|||||||
#include "Timecycle.h"
|
#include "Timecycle.h"
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
|
#include "Radar.h"
|
||||||
|
#include "Hud.h"
|
||||||
|
|
||||||
int CAnimViewer::animTxdSlot = 0;
|
int CAnimViewer::animTxdSlot = 0;
|
||||||
CEntity *CAnimViewer::pTarget = nil;
|
CEntity *CAnimViewer::pTarget = nil;
|
||||||
@ -70,7 +72,8 @@ CAnimViewer::Initialise(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gbModelViewer = true;
|
gbModelViewer = true;
|
||||||
|
CHud::m_Wants_To_Draw_Hud = false;
|
||||||
|
|
||||||
ThePaths.Init();
|
ThePaths.Init();
|
||||||
ThePaths.AllocatePathFindInfoMem(4500);
|
ThePaths.AllocatePathFindInfoMem(4500);
|
||||||
CCollision::Init();
|
CCollision::Init();
|
||||||
@ -90,6 +93,8 @@ CAnimViewer::Initialise(void) {
|
|||||||
CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE);
|
CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE);
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
CRenderer::Init();
|
CRenderer::Init();
|
||||||
|
CRadar::Initialise();
|
||||||
|
CRadar::LoadTextures();
|
||||||
CVehicleModelInfo::LoadVehicleColours();
|
CVehicleModelInfo::LoadVehicleColours();
|
||||||
CAnimManager::LoadAnimFiles();
|
CAnimManager::LoadAnimFiles();
|
||||||
CWorld::PlayerInFocus = 0;
|
CWorld::PlayerInFocus = 0;
|
||||||
@ -297,10 +302,15 @@ CAnimViewer::Update(void)
|
|||||||
|
|
||||||
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
|
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
|
||||||
nextModelId = LastPedModelId(modelId);
|
nextModelId = LastPedModelId(modelId);
|
||||||
|
AsciiToUnicode("Switched to peds", gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
} else {
|
} else {
|
||||||
// Start in mobile
|
// Start in mobile
|
||||||
if (pad->NewState.Square && !pad->OldState.Square)
|
if (pad->NewState.Square && !pad->OldState.Square) {
|
||||||
CVehicleModelInfo::LoadVehicleColours();
|
CVehicleModelInfo::LoadVehicleColours();
|
||||||
|
AsciiToUnicode("Carcols.dat reloaded", gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -309,12 +319,18 @@ CAnimViewer::Update(void)
|
|||||||
// Triangle in mobile
|
// Triangle in mobile
|
||||||
if (pad->NewState.Square && !pad->OldState.Square) {
|
if (pad->NewState.Square && !pad->OldState.Square) {
|
||||||
reloadIFP = 1;
|
reloadIFP = 1;
|
||||||
|
AsciiToUnicode("IFP reloaded", gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->NewState.Cross && !pad->OldState.Cross) {
|
} else if (pad->NewState.Cross && !pad->OldState.Cross) {
|
||||||
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
||||||
|
AsciiToUnicode("Animation restarted", gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->NewState.Circle && !pad->OldState.Circle) {
|
} else if (pad->NewState.Circle && !pad->OldState.Circle) {
|
||||||
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
|
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
|
||||||
|
AsciiToUnicode("Idle animation playing", gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->NewState.DPadUp && pad->OldState.DPadUp == 0) {
|
} else if (pad->NewState.DPadUp && pad->OldState.DPadUp == 0) {
|
||||||
animId--;
|
animId--;
|
||||||
@ -323,19 +339,33 @@ CAnimViewer::Update(void)
|
|||||||
}
|
}
|
||||||
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
||||||
|
|
||||||
|
sprintf(gString, "Current anim: %d", animId);
|
||||||
|
AsciiToUnicode(gString, gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) {
|
} else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) {
|
||||||
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
|
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
|
||||||
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
||||||
|
|
||||||
|
sprintf(gString, "Current anim: %d", animId);
|
||||||
|
AsciiToUnicode(gString, gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pad->NewState.Start && !pad->OldState.Start) {
|
if (pad->NewState.Start && !pad->OldState.Start) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
|
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
|
||||||
nextModelId = LastVehicleModelId(modelId);
|
nextModelId = LastVehicleModelId(modelId);
|
||||||
|
AsciiToUnicode("Switched to vehicles", gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
} else {
|
} else {
|
||||||
// if (CPad::GetPad(1)->NewState.LeftShoulder2)
|
// Originally it was GetPad(1)->LeftShoulder2
|
||||||
// CPedModelInfo::AnimatePedColModelSkinned(CModelInfo::ms_modelInfoPtrs[(pTarget + 96)], pTarget->GetClump()));
|
if (pad->NewState.Triangle) {
|
||||||
|
CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->GetHitColModel(), RpClumpGetFrame(pTarget->GetClump()));
|
||||||
|
AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
|
||||||
|
CMessages::AddMessage(gUString, 100, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,8 +374,17 @@ CAnimViewer::Update(void)
|
|||||||
|
|
||||||
if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) {
|
if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) {
|
||||||
nextModelId = FindMeAModelID(modelId, -1);
|
nextModelId = FindMeAModelID(modelId, -1);
|
||||||
|
|
||||||
|
sprintf(gString, "Current model ID: %d", nextModelId);
|
||||||
|
AsciiToUnicode(gString, gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->NewState.DPadRight && pad->OldState.DPadRight == 0) {
|
} else if (pad->NewState.DPadRight && pad->OldState.DPadRight == 0) {
|
||||||
nextModelId = FindMeAModelID(modelId, 1);
|
nextModelId = FindMeAModelID(modelId, 1);
|
||||||
|
|
||||||
|
sprintf(gString, "Current model ID: %d", nextModelId);
|
||||||
|
AsciiToUnicode(gString, gUString);
|
||||||
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
}
|
}
|
||||||
// There were extra codes here to let us change model id by 50, but xbox CPad struct is different, so I couldn't port.
|
// There were extra codes here to let us change model id by 50, but xbox CPad struct is different, so I couldn't port.
|
||||||
|
|
||||||
|
@ -22,13 +22,12 @@ enum eEventType
|
|||||||
EVENT_PED_SET_ON_FIRE,
|
EVENT_PED_SET_ON_FIRE,
|
||||||
EVENT_COP_SET_ON_FIRE,
|
EVENT_COP_SET_ON_FIRE,
|
||||||
EVENT_CAR_SET_ON_FIRE,
|
EVENT_CAR_SET_ON_FIRE,
|
||||||
EVENT_ASSAULT_NASTYWEAPON,
|
EVENT_ASSAULT_NASTYWEAPON, // not sure
|
||||||
EVENT_ASSAULT_NASTYWEAPON_POLICE,
|
|
||||||
EVENT_ICECREAM,
|
EVENT_ICECREAM,
|
||||||
EVENT_ATM,
|
EVENT_ATM,
|
||||||
EVENT_SHOPSTALL,
|
EVENT_SHOPSTALL, // used on graffitis
|
||||||
EVENT_SHOPWINDOW,
|
EVENT_SHOPWINDOW,
|
||||||
EVENT_LAST_EVENT
|
EVENT_LAST_EVENT // may be above one
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eEventEntity
|
enum eEventEntity
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
|
||||||
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
|
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
|
||||||
int32 &CStats::HeadShots = *(int32*)0x8F647C;
|
int32 &CStats::HeadsPopped = *(int32*)0x8F647C;
|
||||||
bool& CStats::CommercialPassed = *(bool*)0x8F4334;
|
bool& CStats::CommercialPassed = *(bool*)0x8F4334;
|
||||||
bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
|
bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
|
||||||
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
|
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
|
||||||
|
@ -4,7 +4,7 @@ class CStats
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static int32 &DaysPassed;
|
static int32 &DaysPassed;
|
||||||
static int32 &HeadShots;
|
static int32 &HeadsPopped;
|
||||||
static bool& CommercialPassed;
|
static bool& CommercialPassed;
|
||||||
static bool& IndustrialPassed;
|
static bool& IndustrialPassed;
|
||||||
static int32 &NumberKillFrenziesPassed;
|
static int32 &NumberKillFrenziesPassed;
|
||||||
|
@ -294,10 +294,14 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
|
|||||||
if(e->IsPed()){
|
if(e->IsPed()){
|
||||||
if(e->bUsesCollision ||
|
if(e->bUsesCollision ||
|
||||||
deadPeds && ((CPed*)e)->m_nPedState == PED_DEAD){
|
deadPeds && ((CPed*)e)->m_nPedState == PED_DEAD){
|
||||||
if(((CPed*)e)->UseGroundColModel())
|
if (((CPed*)e)->UseGroundColModel())
|
||||||
colmodel = &CTempColModels::ms_colModelPedGroundHit;
|
colmodel = &CTempColModels::ms_colModelPedGroundHit;
|
||||||
else
|
else
|
||||||
|
#ifdef ANIMATE_PED_COL_MODEL
|
||||||
|
colmodel = CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel(), RpClumpGetFrame(e->GetClump()));
|
||||||
|
#else
|
||||||
colmodel = ((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel();
|
colmodel = ((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel();
|
||||||
|
#endif
|
||||||
}else
|
}else
|
||||||
colmodel = nil;
|
colmodel = nil;
|
||||||
}else if(e->bUsesCollision)
|
}else if(e->bUsesCollision)
|
||||||
|
@ -130,3 +130,4 @@ enum Config {
|
|||||||
#define ASPECT_RATIO_SCALE
|
#define ASPECT_RATIO_SCALE
|
||||||
#define USE_DEBUG_SCRIPT_LOADER
|
#define USE_DEBUG_SCRIPT_LOADER
|
||||||
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher
|
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher
|
||||||
|
#define ANIMATE_PED_COL_MODEL
|
||||||
|
@ -121,9 +121,12 @@ TheModelViewer(void)
|
|||||||
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
|
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
|
||||||
255);
|
255);
|
||||||
|
|
||||||
|
CSprite2d::InitPerFrame();
|
||||||
|
CFont::InitPerFrame();
|
||||||
DefinedState();
|
DefinedState();
|
||||||
CVisibilityPlugins::InitAlphaEntityList();
|
CVisibilityPlugins::InitAlphaEntityList();
|
||||||
CAnimViewer::Render();
|
CAnimViewer::Render();
|
||||||
|
Render2dStuff();
|
||||||
DoRWStuffEndOfFrame();
|
DoRWStuffEndOfFrame();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -212,6 +212,7 @@ public:
|
|||||||
}
|
}
|
||||||
void SetRotate(float xAngle, float yAngle, float zAngle);
|
void SetRotate(float xAngle, float yAngle, float zAngle);
|
||||||
void Rotate(float x, float y, float z);
|
void Rotate(float x, float y, float z);
|
||||||
|
void RotateX(float x);
|
||||||
|
|
||||||
void Reorthogonalise(void);
|
void Reorthogonalise(void);
|
||||||
void CopyOnlyMatrix(CMatrix *other){
|
void CopyOnlyMatrix(CMatrix *other){
|
||||||
|
@ -40,6 +40,12 @@ CMatrix::Rotate(float x, float y, float z)
|
|||||||
*this = rot * *this;
|
*this = rot * *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CMatrix::RotateX(float x)
|
||||||
|
{
|
||||||
|
Rotate(x, 0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMatrix::Reorthogonalise(void)
|
CMatrix::Reorthogonalise(void)
|
||||||
{
|
{
|
||||||
|
@ -189,6 +189,45 @@ CPedModelInfo::CreateHitColModel(void)
|
|||||||
m_hitColModel = colmodel;
|
m_hitColModel = colmodel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CColModel*
|
||||||
|
CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame)
|
||||||
|
{
|
||||||
|
RwObjectNameAssociation nameAssoc;
|
||||||
|
RwObjectIdAssociation idAssoc;
|
||||||
|
RwMatrix* mat = RwMatrixCreate();
|
||||||
|
CColSphere* spheres = colmodel->spheres;
|
||||||
|
|
||||||
|
for (int i = 0; i < NUMPEDINFONODES; i++) {
|
||||||
|
RwFrame* f = nil;
|
||||||
|
if (m_pColNodeInfos[i].name) {
|
||||||
|
nameAssoc.name = m_pColNodeInfos[i].name;
|
||||||
|
nameAssoc.frame = nil;
|
||||||
|
RwFrameForAllChildren(frame, FindFrameFromNameCB, &nameAssoc);
|
||||||
|
f = nameAssoc.frame;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
idAssoc.id = m_pColNodeInfos[i].pedNode;
|
||||||
|
idAssoc.frame = nil;
|
||||||
|
RwFrameForAllChildren(frame, FindFrameFromIdCB, &idAssoc);
|
||||||
|
f = idAssoc.frame;
|
||||||
|
}
|
||||||
|
if (f) {
|
||||||
|
RwMatrixCopy(mat, RwFrameGetMatrix(f));
|
||||||
|
|
||||||
|
for (f = RwFrameGetParent(f); f; f = RwFrameGetParent(f)) {
|
||||||
|
RwMatrixTransform(mat, &f->modelling, rwCOMBINEPOSTCONCAT);
|
||||||
|
if (RwFrameGetParent(f) == frame)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
spheres[i].center.x = mat->pos.x + m_pColNodeInfos[i].x;
|
||||||
|
spheres[i].center.y = mat->pos.y + 0.0f;
|
||||||
|
spheres[i].center.z = mat->pos.z + m_pColNodeInfos[i].z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return colmodel;
|
||||||
|
}
|
||||||
|
|
||||||
class CPedModelInfo_ : public CPedModelInfo
|
class CPedModelInfo_ : public CPedModelInfo
|
||||||
{
|
{
|
||||||
|
@ -39,5 +39,6 @@ public:
|
|||||||
void SetLowDetailClump(RpClump*);
|
void SetLowDetailClump(RpClump*);
|
||||||
void CreateHitColModel(void);
|
void CreateHitColModel(void);
|
||||||
CColModel *GetHitColModel(void) { return m_hitColModel; }
|
CColModel *GetHitColModel(void) { return m_hitColModel; }
|
||||||
|
static CColModel *AnimatePedColModel(CColModel* colmodel, RwFrame* frame);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CPedModelInfo) == 0x54, "CPedModelInfo: error");
|
static_assert(sizeof(CPedModelInfo) == 0x54, "CPedModelInfo: error");
|
||||||
|
@ -442,13 +442,13 @@ void CParticleObject::UpdateClose(void)
|
|||||||
{
|
{
|
||||||
this->m_nFrameCounter = 0;
|
this->m_nFrameCounter = 0;
|
||||||
|
|
||||||
int32 randVal; // BUG: unitialised can be used ??!!
|
int32 randVal;
|
||||||
if ( this->m_nCreationChance != 0 )
|
if ( this->m_nCreationChance != 0 )
|
||||||
randVal = CGeneral::GetRandomNumber() % this->m_nCreationChance;
|
randVal = CGeneral::GetRandomNumber() % this->m_nCreationChance;
|
||||||
|
|
||||||
if ( randVal != 0 && this->m_nCreationChance > 0
|
if ( this->m_nCreationChance == 0
|
||||||
|| randVal == 0 && (this->m_nCreationChance & 128) != 0
|
|| randVal == 0 && this->m_nCreationChance < 0
|
||||||
|| this->m_nCreationChance == 0 )
|
|| randVal != 0 && this->m_nCreationChance > 0)
|
||||||
{
|
{
|
||||||
switch ( this->m_Type )
|
switch ( this->m_Type )
|
||||||
{
|
{
|
||||||
|
1172
src/peds/Ped.cpp
1172
src/peds/Ped.cpp
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@
|
|||||||
#include "WeaponInfo.h"
|
#include "WeaponInfo.h"
|
||||||
#include "Fire.h"
|
#include "Fire.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
|
#include "EventList.h"
|
||||||
|
|
||||||
struct CPathNode;
|
struct CPathNode;
|
||||||
|
|
||||||
@ -258,7 +259,7 @@ public:
|
|||||||
uint8 bIsAttacking : 1; // doesn't reset after fist fight, also stores (CTimer::GetTimeInMilliseconds() < m_lastHitTime)
|
uint8 bIsAttacking : 1; // doesn't reset after fist fight, also stores (CTimer::GetTimeInMilliseconds() < m_lastHitTime)
|
||||||
uint8 bIsPointingGunAt : 1;
|
uint8 bIsPointingGunAt : 1;
|
||||||
uint8 bIsLooking : 1;
|
uint8 bIsLooking : 1;
|
||||||
uint8 m_ped_flagA20 : 1; // "look" method? - probably missing in SA
|
uint8 bKeepTryingToLook : 1; // if we can't look somewhere due to unreachable angles
|
||||||
uint8 bIsRestoringLook : 1;
|
uint8 bIsRestoringLook : 1;
|
||||||
uint8 bIsAimingGun : 1;
|
uint8 bIsAimingGun : 1;
|
||||||
|
|
||||||
@ -278,10 +279,10 @@ public:
|
|||||||
uint8 bUpdateAnimHeading : 1;
|
uint8 bUpdateAnimHeading : 1;
|
||||||
uint8 bBodyPartJustCameOff : 1;
|
uint8 bBodyPartJustCameOff : 1;
|
||||||
uint8 m_ped_flagC40 : 1;
|
uint8 m_ped_flagC40 : 1;
|
||||||
uint8 m_ped_flagC80 : 1;
|
uint8 bFindNewNodeAfterStateRestore : 1;
|
||||||
|
|
||||||
uint8 m_ped_flagD1 : 1;
|
uint8 m_ped_flagD1 : 1; // so far only used for reaction type to fire/explosion
|
||||||
uint8 m_ped_flagD2 : 1; // seen an event
|
uint8 m_ped_flagD2 : 1; // set when event has been seen
|
||||||
uint8 m_ped_flagD4 : 1;
|
uint8 m_ped_flagD4 : 1;
|
||||||
uint8 m_ped_flagD8 : 1;
|
uint8 m_ped_flagD8 : 1;
|
||||||
uint8 bIsPedDieAnimPlaying : 1;
|
uint8 bIsPedDieAnimPlaying : 1;
|
||||||
@ -303,7 +304,7 @@ public:
|
|||||||
uint8 m_ped_flagF4 : 1;
|
uint8 m_ped_flagF4 : 1;
|
||||||
uint8 m_ped_flagF8 : 1;
|
uint8 m_ped_flagF8 : 1;
|
||||||
uint8 bWillBeQuickJacked : 1;
|
uint8 bWillBeQuickJacked : 1;
|
||||||
uint8 m_ped_flagF20 : 1;
|
uint8 m_ped_flagF20 : 1; // set when couldn't open locked car door
|
||||||
uint8 m_ped_flagF40 : 1;
|
uint8 m_ped_flagF40 : 1;
|
||||||
uint8 bDuckAndCover : 1;
|
uint8 bDuckAndCover : 1;
|
||||||
|
|
||||||
@ -329,7 +330,7 @@ public:
|
|||||||
uint8 bNoCriticalHits : 1; // if set, limbs won't came off
|
uint8 bNoCriticalHits : 1; // if set, limbs won't came off
|
||||||
uint8 m_ped_flagI4 : 1;
|
uint8 m_ped_flagI4 : 1;
|
||||||
uint8 bHasAlreadyBeenRecorded : 1;
|
uint8 bHasAlreadyBeenRecorded : 1;
|
||||||
uint8 bIsFell : 1;
|
uint8 bFallenDown : 1;
|
||||||
uint8 m_ped_flagI20 : 1;
|
uint8 m_ped_flagI20 : 1;
|
||||||
uint8 m_ped_flagI40 : 1;
|
uint8 m_ped_flagI40 : 1;
|
||||||
uint8 m_ped_flagI80 : 1;
|
uint8 m_ped_flagI80 : 1;
|
||||||
@ -367,7 +368,7 @@ public:
|
|||||||
int32 m_nPrevMoveState;
|
int32 m_nPrevMoveState;
|
||||||
eWaitState m_nWaitState;
|
eWaitState m_nWaitState;
|
||||||
uint32 m_nWaitTimer;
|
uint32 m_nWaitTimer;
|
||||||
void *m_pPathNodesStates[8]; // seems unused
|
void *m_pPathNodesStates[8]; // seems unused, probably leftover from VC
|
||||||
CVector2D m_stPathNodeStates[10];
|
CVector2D m_stPathNodeStates[10];
|
||||||
uint16 m_nPathNodes;
|
uint16 m_nPathNodes;
|
||||||
int16 m_nCurPathNode;
|
int16 m_nCurPathNode;
|
||||||
@ -601,7 +602,7 @@ public:
|
|||||||
void LineUpPedWithTrain(void);
|
void LineUpPedWithTrain(void);
|
||||||
void ExitCar(void);
|
void ExitCar(void);
|
||||||
void Fight(void);
|
void Fight(void);
|
||||||
bool FindBestCoordsFromNodes(CVector unused, CVector* a6);
|
bool FindBestCoordsFromNodes(CVector, CVector*);
|
||||||
void Wait(void);
|
void Wait(void);
|
||||||
void ProcessObjective(void);
|
void ProcessObjective(void);
|
||||||
bool SeekFollowingPath(CVector*);
|
bool SeekFollowingPath(CVector*);
|
||||||
@ -614,10 +615,20 @@ public:
|
|||||||
uint8 GetPedRadioCategory(uint32);
|
uint8 GetPedRadioCategory(uint32);
|
||||||
int GetWeaponSlot(eWeaponType);
|
int GetWeaponSlot(eWeaponType);
|
||||||
void GoToNearestDoor(CVehicle*);
|
void GoToNearestDoor(CVehicle*);
|
||||||
bool HaveReachedNextPointOnRoute(float a2);
|
bool HaveReachedNextPointOnRoute(float);
|
||||||
void Idle(void);
|
void Idle(void);
|
||||||
void InTheAir(void);
|
void InTheAir(void);
|
||||||
void SetLanding(void);
|
void SetLanding(void);
|
||||||
|
void InvestigateEvent(void);
|
||||||
|
bool IsPedDoingDriveByShooting(void);
|
||||||
|
bool IsRoomToBeCarJacked(void);
|
||||||
|
void SetInvestigateEvent(eEventType, CVector2D, float, uint16, float);
|
||||||
|
bool LookForInterestingNodes(void);
|
||||||
|
void LookForSexyCars(void);
|
||||||
|
void LookForSexyPeds(void);
|
||||||
|
void Mug(void);
|
||||||
|
void MoveHeadToLook(void);
|
||||||
|
void Pause(void);
|
||||||
|
|
||||||
// Static methods
|
// Static methods
|
||||||
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
|
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
|
||||||
@ -681,6 +692,8 @@ public:
|
|||||||
void EnterTrain(void);
|
void EnterTrain(void);
|
||||||
void ExitTrain(void);
|
void ExitTrain(void);
|
||||||
void Fall(void);
|
void Fall(void);
|
||||||
|
bool IsPedShootable(void);
|
||||||
|
void Look(void);
|
||||||
|
|
||||||
bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
|
bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
|
||||||
CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; }
|
CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; }
|
||||||
|
@ -2,14 +2,16 @@
|
|||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "PedIK.h"
|
#include "PedIK.h"
|
||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
|
#include "General.h"
|
||||||
|
|
||||||
WRAPPER bool CPedIK::PointGunInDirection(float phi, float theta) { EAXJMP(0x4ED9B0); }
|
WRAPPER bool CPedIK::PointGunInDirection(float phi, float theta) { EAXJMP(0x4ED9B0); }
|
||||||
WRAPPER bool CPedIK::PointGunAtPosition(CVector *position) { EAXJMP(0x4ED920); }
|
WRAPPER bool CPedIK::PointGunAtPosition(CVector *position) { EAXJMP(0x4ED920); }
|
||||||
WRAPPER void CPedIK::ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED2C0); }
|
WRAPPER void CPedIK::ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED2C0); }
|
||||||
WRAPPER void CPedIK::ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED140); }
|
WRAPPER void CPedIK::ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED140); }
|
||||||
|
|
||||||
// TODO: Hardcoded into exe, reverse it.
|
// TODO: These are hardcoded into exe, reverse it.
|
||||||
LimbMovementInfo &CPedIK::ms_torsoInfo = *(LimbMovementInfo*)0x5F9F8C;
|
LimbMovementInfo &CPedIK::ms_torsoInfo = *(LimbMovementInfo*)0x5F9F8C;
|
||||||
|
LimbMovementInfo &CPedIK::ms_headInfo = *(LimbMovementInfo*)0x5F9F5C;
|
||||||
|
|
||||||
CPedIK::CPedIK(CPed *ped)
|
CPedIK::CPedIK(CPed *ped)
|
||||||
{
|
{
|
||||||
@ -105,10 +107,10 @@ CPedIK::GetWorldMatrix(RwFrame *source, RwMatrix *destination)
|
|||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32
|
LimbMoveStatus
|
||||||
CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo)
|
CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo)
|
||||||
{
|
{
|
||||||
int result = 1;
|
LimbMoveStatus result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY;
|
||||||
|
|
||||||
// phi
|
// phi
|
||||||
|
|
||||||
@ -120,11 +122,12 @@ CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, Limb
|
|||||||
|
|
||||||
if (Abs(limb.phi - approxPhi) < moveInfo.yawD) {
|
if (Abs(limb.phi - approxPhi) < moveInfo.yawD) {
|
||||||
limb.phi = approxPhi;
|
limb.phi = approxPhi;
|
||||||
result = 2;
|
result = ANGLES_SET_EXACTLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limb.phi > moveInfo.maxYaw || limb.phi < moveInfo.minYaw) {
|
if (limb.phi > moveInfo.maxYaw || limb.phi < moveInfo.minYaw) {
|
||||||
limb.phi = clamp(limb.phi, moveInfo.minYaw, moveInfo.maxYaw);
|
limb.phi = clamp(limb.phi, moveInfo.minYaw, moveInfo.maxYaw);
|
||||||
result = 0;
|
result = ANGLES_SET_TO_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// theta
|
// theta
|
||||||
@ -138,11 +141,11 @@ CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, Limb
|
|||||||
if (Abs(limb.theta - approxTheta) < moveInfo.pitchD)
|
if (Abs(limb.theta - approxTheta) < moveInfo.pitchD)
|
||||||
limb.theta = approxTheta;
|
limb.theta = approxTheta;
|
||||||
else
|
else
|
||||||
result = 1;
|
result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY;
|
||||||
|
|
||||||
if (limb.theta > moveInfo.maxPitch || limb.theta < moveInfo.minPitch) {
|
if (limb.theta > moveInfo.maxPitch || limb.theta < moveInfo.minPitch) {
|
||||||
limb.theta = clamp(limb.theta, moveInfo.minPitch, moveInfo.maxPitch);
|
limb.theta = clamp(limb.theta, moveInfo.minPitch, moveInfo.maxPitch);
|
||||||
result = 0;
|
result = ANGLES_SET_TO_MAX;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -150,9 +153,71 @@ CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, Limb
|
|||||||
bool
|
bool
|
||||||
CPedIK::RestoreGunPosn(void)
|
CPedIK::RestoreGunPosn(void)
|
||||||
{
|
{
|
||||||
int limbStatus = MoveLimb(m_torsoOrient, 0.0f, 0.0f, ms_torsoInfo);
|
LimbMoveStatus limbStatus = MoveLimb(m_torsoOrient, 0.0f, 0.0f, ms_torsoInfo);
|
||||||
RotateTorso(m_ped->m_pFrames[PED_MID], &m_torsoOrient, false);
|
RotateTorso(m_ped->m_pFrames[PED_MID], &m_torsoOrient, false);
|
||||||
return limbStatus == 2;
|
return limbStatus == ANGLES_SET_EXACTLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CPedIK::LookInDirection(float phi, float theta)
|
||||||
|
{
|
||||||
|
bool success = true;
|
||||||
|
AnimBlendFrameData *frameData = m_ped->m_pFrames[PED_HEAD];
|
||||||
|
RwFrame *frame = frameData->frame;
|
||||||
|
RwMatrix *frameMat = RwFrameGetMatrix(frame);
|
||||||
|
|
||||||
|
if (!(frameData->flag & AnimBlendFrameData::IGNORE_ROTATION)) {
|
||||||
|
frameData->flag |= AnimBlendFrameData::IGNORE_ROTATION;
|
||||||
|
CPedIK::ExtractYawAndPitchLocal(frameMat, &m_headOrient.phi, &m_headOrient.theta);
|
||||||
|
}
|
||||||
|
|
||||||
|
RwMatrix *worldMat = RwMatrixCreate();
|
||||||
|
worldMat = CPedIK::GetWorldMatrix(RwFrameGetParent(frame), worldMat);
|
||||||
|
|
||||||
|
float alpha, beta;
|
||||||
|
CPedIK::ExtractYawAndPitchWorld(worldMat, &alpha, &beta);
|
||||||
|
RwMatrixDestroy(worldMat);
|
||||||
|
|
||||||
|
alpha += m_torsoOrient.phi;
|
||||||
|
float neededPhiTurn = CGeneral::LimitRadianAngle(phi - alpha);
|
||||||
|
beta *= cos(neededPhiTurn);
|
||||||
|
|
||||||
|
float neededThetaTurn = CGeneral::LimitRadianAngle(theta - beta);
|
||||||
|
LimbMoveStatus headStatus = CPedIK::MoveLimb(m_headOrient, neededPhiTurn, neededThetaTurn, ms_headInfo);
|
||||||
|
if (headStatus == ANGLES_SET_TO_MAX)
|
||||||
|
success = false;
|
||||||
|
|
||||||
|
if (headStatus != ANGLES_SET_EXACTLY && !(m_flags & LOOKING)) {
|
||||||
|
float remainingTurn = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur);
|
||||||
|
if (CPedIK::MoveLimb(m_torsoOrient, remainingTurn, theta, ms_torsoInfo))
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
CMatrix nextFrame = CMatrix(frameMat);
|
||||||
|
CVector framePos = nextFrame.GetPosition();
|
||||||
|
|
||||||
|
nextFrame.SetRotateZ(m_headOrient.theta);
|
||||||
|
nextFrame.RotateX(m_headOrient.phi);
|
||||||
|
nextFrame.GetPosition() += framePos;
|
||||||
|
nextFrame.UpdateRW();
|
||||||
|
|
||||||
|
if (!(m_flags & LOOKING))
|
||||||
|
RotateTorso(m_ped->m_pFrames[PED_MID], &m_torsoOrient, false);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CPedIK::LookAtPosition(CVector const &pos)
|
||||||
|
{
|
||||||
|
float phiToFace = CGeneral::GetRadianAngleBetweenPoints(
|
||||||
|
pos.x, pos.y,
|
||||||
|
m_ped->GetPosition().x, m_ped->GetPosition().y);
|
||||||
|
|
||||||
|
float thetaToFace = CGeneral::GetRadianAngleBetweenPoints(
|
||||||
|
pos.z, (m_ped->GetPosition() - pos).Magnitude2D(),
|
||||||
|
m_ped->GetPosition().z, 0.0f);
|
||||||
|
|
||||||
|
return LookInDirection(phiToFace, thetaToFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
@ -161,4 +226,6 @@ STARTPATCHES
|
|||||||
InjectHook(0x4EDDB0, &CPedIK::RotateTorso, PATCH_JUMP);
|
InjectHook(0x4EDDB0, &CPedIK::RotateTorso, PATCH_JUMP);
|
||||||
InjectHook(0x4ED440, &CPedIK::MoveLimb, PATCH_JUMP);
|
InjectHook(0x4ED440, &CPedIK::MoveLimb, PATCH_JUMP);
|
||||||
InjectHook(0x4EDD70, &CPedIK::RestoreGunPosn, PATCH_JUMP);
|
InjectHook(0x4EDD70, &CPedIK::RestoreGunPosn, PATCH_JUMP);
|
||||||
|
InjectHook(0x4ED620, &CPedIK::LookInDirection, PATCH_JUMP);
|
||||||
|
InjectHook(0x4ED590, &CPedIK::LookAtPosition, PATCH_JUMP);
|
||||||
ENDPATCHES
|
ENDPATCHES
|
@ -18,16 +18,21 @@ struct LimbMovementInfo {
|
|||||||
float pitchD;
|
float pitchD;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum LimbMoveStatus {
|
||||||
|
ANGLES_SET_TO_MAX, // because given angles were unreachable
|
||||||
|
ONE_ANGLE_COULDNT_BE_SET_EXACTLY, // because it can't be reached in a jiffy
|
||||||
|
ANGLES_SET_EXACTLY
|
||||||
|
};
|
||||||
|
|
||||||
class CPed;
|
class CPed;
|
||||||
|
|
||||||
class CPedIK
|
class CPedIK
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// TODO
|
|
||||||
enum {
|
enum {
|
||||||
FLAG_1 = 1,
|
FLAG_1 = 1,
|
||||||
FLAG_2 = 2, // related to looking somewhere
|
LOOKING = 2,
|
||||||
FLAG_4 = 4, // aims with arm
|
AIMS_WITH_ARM = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
CPed *m_ped;
|
CPed *m_ped;
|
||||||
@ -38,6 +43,7 @@ public:
|
|||||||
int32 m_flags;
|
int32 m_flags;
|
||||||
|
|
||||||
static LimbMovementInfo &ms_torsoInfo;
|
static LimbMovementInfo &ms_torsoInfo;
|
||||||
|
static LimbMovementInfo &ms_headInfo;
|
||||||
|
|
||||||
CPedIK(CPed *ped);
|
CPedIK(CPed *ped);
|
||||||
bool PointGunInDirection(float phi, float theta);
|
bool PointGunInDirection(float phi, float theta);
|
||||||
@ -47,7 +53,9 @@ public:
|
|||||||
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
||||||
void ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*);
|
void ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*);
|
||||||
void ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*);
|
void ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*);
|
||||||
uint32 MoveLimb(LimbOrientation &a1, float a2, float a3, LimbMovementInfo &a4);
|
LimbMoveStatus MoveLimb(LimbOrientation &a1, float a2, float a3, LimbMovementInfo &a4);
|
||||||
bool RestoreGunPosn(void);
|
bool RestoreGunPosn(void);
|
||||||
|
bool LookInDirection(float phi, float theta);
|
||||||
|
bool LookAtPosition(CVector const& pos);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");
|
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");
|
||||||
|
@ -57,8 +57,8 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|||||||
|
|
||||||
void CPlayerPed::ClearWeaponTarget()
|
void CPlayerPed::ClearWeaponTarget()
|
||||||
{
|
{
|
||||||
if (!m_nPedType) {
|
if (m_nPedType == PEDTYPE_PLAYER1) {
|
||||||
m_pPointGunAt = 0;
|
m_pPointGunAt = nil;
|
||||||
TheCamera.ClearPlayerWeaponMode();
|
TheCamera.ClearPlayerWeaponMode();
|
||||||
CWeaponEffects::ClearCrosshair();
|
CWeaponEffects::ClearCrosshair();
|
||||||
}
|
}
|
||||||
@ -79,12 +79,12 @@ CPlayerPed::SetWantedLevelNoDrop(int32 level)
|
|||||||
|
|
||||||
// I don't know the actual purpose of parameter
|
// I don't know the actual purpose of parameter
|
||||||
void
|
void
|
||||||
CPlayerPed::AnnoyPlayerPed(bool itsPolice)
|
CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity)
|
||||||
{
|
{
|
||||||
if (m_pedStats->m_temper < 52) {
|
if (m_pedStats->m_temper < 52) {
|
||||||
m_pedStats->m_temper++;
|
m_pedStats->m_temper++;
|
||||||
} else {
|
} else {
|
||||||
if (itsPolice) {
|
if (annoyedByPassingEntity) {
|
||||||
if (m_pedStats->m_temper < 55) {
|
if (m_pedStats->m_temper < 55) {
|
||||||
m_pedStats->m_temper++;
|
m_pedStats->m_temper++;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user