mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-05 10:35:54 +00:00
PlayerInfo functions reordered into original order, FindPlayer... functions moved to PlayerInfo, improved CVector <-> RwV3d conversion, small fixes
This commit is contained in:
parent
2903ebe296
commit
cfda5eb148
|
@ -499,7 +499,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
|
||||||
// transform line to model space
|
// transform line to model space
|
||||||
Invert(matrix, matTransform);
|
Invert(matrix, matTransform);
|
||||||
CVuVector newline[2];
|
CVuVector newline[2];
|
||||||
TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
|
TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
|
||||||
|
|
||||||
// If we don't intersect with the bounding box, no chance on the rest
|
// If we don't intersect with the bounding box, no chance on the rest
|
||||||
if(!TestLineBox(*(CColLine*)newline, model.boundingBox))
|
if(!TestLineBox(*(CColLine*)newline, model.boundingBox))
|
||||||
|
@ -1321,7 +1321,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
|
||||||
// transform line to model space
|
// transform line to model space
|
||||||
Invert(matrix, matTransform);
|
Invert(matrix, matTransform);
|
||||||
CVuVector newline[2];
|
CVuVector newline[2];
|
||||||
TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
|
TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
|
||||||
|
|
||||||
if(mindist < 1.0f)
|
if(mindist < 1.0f)
|
||||||
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
|
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
|
||||||
|
@ -1456,7 +1456,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
|
||||||
// transform line to model space
|
// transform line to model space
|
||||||
Invert(matrix, matTransform);
|
Invert(matrix, matTransform);
|
||||||
CVuVector newline[2];
|
CVuVector newline[2];
|
||||||
TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
|
TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
|
||||||
|
|
||||||
if(mindist < 1.0f)
|
if(mindist < 1.0f)
|
||||||
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
|
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
|
||||||
|
@ -1655,16 +1655,16 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
|
||||||
matAB *= matrixA;
|
matAB *= matrixA;
|
||||||
|
|
||||||
CVuVector bsphereAB; // bounding sphere of A in B space
|
CVuVector bsphereAB; // bounding sphere of A in B space
|
||||||
TransformPoint(bsphereAB, matAB, *(RwV3d*)modelA.boundingSphere.center); // inlined
|
TransformPoint(bsphereAB, matAB, modelA.boundingSphere.center); // inlined
|
||||||
bsphereAB.w = modelA.boundingSphere.radius;
|
bsphereAB.w = modelA.boundingSphere.radius;
|
||||||
if(!TestSphereBox(*(CColSphere*)&bsphereAB, modelB.boundingBox))
|
if(!TestSphereBox(*(CColSphere*)&bsphereAB, modelB.boundingBox))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// transform modelA's spheres and lines to B space
|
// transform modelA's spheres and lines to B space
|
||||||
TransformPoints(aSpheresA, modelA.numSpheres, matAB, (RwV3d*)&modelA.spheres->center, sizeof(CColSphere));
|
TransformPoints(aSpheresA, modelA.numSpheres, matAB, &modelA.spheres->center, sizeof(CColSphere));
|
||||||
for(i = 0; i < modelA.numSpheres; i++)
|
for(i = 0; i < modelA.numSpheres; i++)
|
||||||
aSpheresA[i].w = modelA.spheres[i].radius;
|
aSpheresA[i].w = modelA.spheres[i].radius;
|
||||||
TransformPoints(aLinesA, modelA.numLines*2, matAB, (RwV3d*)&modelA.lines->p0, sizeof(CColLine)/2);
|
TransformPoints(aLinesA, modelA.numLines*2, matAB, &modelA.lines->p0, sizeof(CColLine)/2);
|
||||||
|
|
||||||
// Test them against model B's bounding volumes
|
// Test them against model B's bounding volumes
|
||||||
int numSpheresA = 0;
|
int numSpheresA = 0;
|
||||||
|
@ -1681,7 +1681,7 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
|
||||||
matBA *= matrixB;
|
matBA *= matrixB;
|
||||||
|
|
||||||
// transform modelB's spheres to A space
|
// transform modelB's spheres to A space
|
||||||
TransformPoints(aSpheresB, modelB.numSpheres, matBA, (RwV3d*)&modelB.spheres->center, sizeof(CColSphere));
|
TransformPoints(aSpheresB, modelB.numSpheres, matBA, &modelB.spheres->center, sizeof(CColSphere));
|
||||||
for(i = 0; i < modelB.numSpheres; i++)
|
for(i = 0; i < modelB.numSpheres; i++)
|
||||||
aSpheresB[i].w = modelB.spheres[i].radius;
|
aSpheresB[i].w = modelB.spheres[i].radius;
|
||||||
|
|
||||||
|
|
|
@ -1218,10 +1218,10 @@ void CReplay::ProcessReplayCamera(void)
|
||||||
TheCamera.GetUp() = CVector(0.0f, 1.0f, 0.0f);
|
TheCamera.GetUp() = CVector(0.0f, 1.0f, 0.0f);
|
||||||
TheCamera.GetRight() = CVector(1.0f, 0.0f, 0.0f);
|
TheCamera.GetRight() = CVector(1.0f, 0.0f, 0.0f);
|
||||||
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
||||||
pm->pos = *(RwV3d*)&TheCamera.GetPosition();
|
pm->pos = TheCamera.GetPosition();
|
||||||
pm->at = *(RwV3d*)&TheCamera.GetForward();
|
pm->at = TheCamera.GetForward();
|
||||||
pm->up = *(RwV3d*)&TheCamera.GetUp();
|
pm->up = TheCamera.GetUp();
|
||||||
pm->right = *(RwV3d*)&TheCamera.GetRight();
|
pm->right = TheCamera.GetRight();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case REPLAYCAMMODE_FIXED:
|
case REPLAYCAMMODE_FIXED:
|
||||||
|
@ -1237,10 +1237,10 @@ void CReplay::ProcessReplayCamera(void)
|
||||||
TheCamera.GetMatrix().GetUp() = up;
|
TheCamera.GetMatrix().GetUp() = up;
|
||||||
TheCamera.GetMatrix().GetRight() = right;
|
TheCamera.GetMatrix().GetRight() = right;
|
||||||
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
||||||
pm->pos = *(RwV3d*)&TheCamera.GetMatrix().GetPosition();
|
pm->pos = TheCamera.GetMatrix().GetPosition();
|
||||||
pm->at = *(RwV3d*)&TheCamera.GetMatrix().GetForward();
|
pm->at = TheCamera.GetMatrix().GetForward();
|
||||||
pm->up = *(RwV3d*)&TheCamera.GetMatrix().GetUp();
|
pm->up = TheCamera.GetMatrix().GetUp();
|
||||||
pm->right = *(RwV3d*)&TheCamera.GetMatrix().GetRight();
|
pm->right = TheCamera.GetMatrix().GetRight();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1840,10 +1840,10 @@ void CReplay::ProcessLookAroundCam(void)
|
||||||
TheCamera.GetRight() = right;
|
TheCamera.GetRight() = right;
|
||||||
TheCamera.SetPosition(camera_pt);
|
TheCamera.SetPosition(camera_pt);
|
||||||
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
||||||
pm->pos = *(RwV3d*)&TheCamera.GetPosition();
|
pm->pos = TheCamera.GetPosition();
|
||||||
pm->at = *(RwV3d*)&TheCamera.GetForward();
|
pm->at = TheCamera.GetForward();
|
||||||
pm->up = *(RwV3d*)&TheCamera.GetUp();
|
pm->up = TheCamera.GetUp();
|
||||||
pm->right = *(RwV3d*)&TheCamera.GetRight();
|
pm->right = TheCamera.GetRight();
|
||||||
TheCamera.CalculateDerivedValues();
|
TheCamera.CalculateDerivedValues();
|
||||||
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
|
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
|
||||||
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
||||||
|
|
|
@ -999,7 +999,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||||
CVector vTestedPos(pTestedPed->GetPosition().x, pTestedPed->GetPosition().y, pTestedPed->GetPosition().z + 0.4);
|
CVector vTestedPos(pTestedPed->GetPosition().x, pTestedPed->GetPosition().y, pTestedPed->GetPosition().z + 0.4);
|
||||||
CVector vScreenPos;
|
CVector vScreenPos;
|
||||||
float w, h;
|
float w, h;
|
||||||
if (CSprite::CalcScreenCoors(vTestedPos, vScreenPos, &w, &h, false)) {
|
if (CSprite::CalcScreenCoors(vTestedPos, &vScreenPos, &w, &h, false)) {
|
||||||
CVector2D vCrosshairPosition(CCamera::m_f3rdPersonCHairMultX * RsGlobal.maximumWidth, CCamera::m_f3rdPersonCHairMultY * RsGlobal.maximumHeight);
|
CVector2D vCrosshairPosition(CCamera::m_f3rdPersonCHairMultX * RsGlobal.maximumWidth, CCamera::m_f3rdPersonCHairMultY * RsGlobal.maximumHeight);
|
||||||
float fScreenDistance = ((CVector2D)vScreenPos - vCrosshairPosition).Magnitude();
|
float fScreenDistance = ((CVector2D)vScreenPos - vCrosshairPosition).Magnitude();
|
||||||
if (SCREEN_STRETCH_X(0.45f) > fScreenDistance / w) {
|
if (SCREEN_STRETCH_X(0.45f) > fScreenDistance / w) {
|
||||||
|
|
|
@ -2703,7 +2703,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
|
||||||
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(CamTargetEntity->GetClump());
|
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(CamTargetEntity->GetClump());
|
||||||
int32 idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_HEAD));
|
int32 idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_HEAD));
|
||||||
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
|
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
|
||||||
RwV3dTransformPoints((RwV3d*)&HeadPos, (RwV3d*)&HeadPos, 1, &mats[idx]);
|
RwV3dTransformPoints(&HeadPos, &HeadPos, 1, &mats[idx]);
|
||||||
RwV3d scl = { 0.0f, 0.0f, 0.0f };
|
RwV3d scl = { 0.0f, 0.0f, 0.0f };
|
||||||
RwMatrixScale(&mats[idx], &scl, rwCOMBINEPRECONCAT);
|
RwMatrixScale(&mats[idx], &scl, rwCOMBINEPRECONCAT);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
#include "CarCtrl.h"
|
||||||
#include "Cranes.h"
|
#include "Cranes.h"
|
||||||
#include "Darkel.h"
|
#include "Darkel.h"
|
||||||
#include "Explosion.h"
|
#include "Explosion.h"
|
||||||
|
@ -34,93 +35,10 @@
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
#include "GameLogic.h"
|
#include "GameLogic.h"
|
||||||
|
|
||||||
|
// --MIAMI: File done
|
||||||
|
|
||||||
CVector lastPlayerPos;
|
CVector lastPlayerPos;
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::SetPlayerSkin(char *skin)
|
|
||||||
{
|
|
||||||
strncpy(m_aSkinName, skin, 32);
|
|
||||||
LoadPlayerSkin();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
const CVector &
|
|
||||||
CPlayerInfo::GetPos()
|
|
||||||
{
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
if (!m_pPed)
|
|
||||||
return TheCamera.GetPosition();
|
|
||||||
#endif
|
|
||||||
if (m_pPed->InVehicle())
|
|
||||||
return m_pPed->m_pMyVehicle->GetPosition();
|
|
||||||
return m_pPed->GetPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::LoadPlayerSkin()
|
|
||||||
{
|
|
||||||
DeletePlayerSkin();
|
|
||||||
|
|
||||||
m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::DeletePlayerSkin()
|
|
||||||
{
|
|
||||||
if (m_pSkinTexture) {
|
|
||||||
RwTextureDestroy(m_pSkinTexture);
|
|
||||||
m_pSkinTexture = nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::KillPlayer()
|
|
||||||
{
|
|
||||||
if (m_WBState != WBSTATE_PLAYING) return;
|
|
||||||
|
|
||||||
m_WBState = WBSTATE_WASTED;
|
|
||||||
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
|
||||||
CDarkel::ResetOnPlayerDeath();
|
|
||||||
CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
|
|
||||||
CStats::TimesDied++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::ArrestPlayer()
|
|
||||||
{
|
|
||||||
if (m_WBState != WBSTATE_PLAYING) return;
|
|
||||||
|
|
||||||
m_WBState = WBSTATE_BUSTED;
|
|
||||||
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
|
||||||
m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
|
|
||||||
CDarkel::ResetOnPlayerDeath();
|
|
||||||
CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
|
|
||||||
CStats::TimesArrested++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool
|
|
||||||
CPlayerInfo::IsPlayerInRemoteMode()
|
|
||||||
{
|
|
||||||
return m_pRemoteVehicle || m_bInRemoteMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlayerInfo::PlayerFailedCriticalMission()
|
|
||||||
{
|
|
||||||
if (m_WBState != WBSTATE_PLAYING)
|
|
||||||
return;
|
|
||||||
m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
|
|
||||||
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
|
||||||
CDarkel::ResetOnPlayerDeath();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
void
|
||||||
CPlayerInfo::Clear(void)
|
CPlayerInfo::Clear(void)
|
||||||
{
|
{
|
||||||
|
@ -181,192 +99,6 @@ CPlayerInfo::Clear(void)
|
||||||
m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
|
m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::BlowUpRCBuggy(bool actually)
|
|
||||||
{
|
|
||||||
if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CRemote::TakeRemoteControlledCarFromPlayer(actually);
|
|
||||||
if (actually)
|
|
||||||
m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
|
|
||||||
{
|
|
||||||
if (!car || car == m_pPed->m_pMyVehicle) {
|
|
||||||
if (m_pPed->EnteringCar())
|
|
||||||
m_pPed->QuitEnteringCar();
|
|
||||||
}
|
|
||||||
if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
|
|
||||||
m_pPed->ClearObjective();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::MakePlayerSafe(bool toggle)
|
|
||||||
{
|
|
||||||
if (toggle) {
|
|
||||||
m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
|
|
||||||
CWorld::StopAllLawEnforcersInTheirTracks();
|
|
||||||
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
|
|
||||||
CPad::StopPadsShaking();
|
|
||||||
m_pPed->bBulletProof = true;
|
|
||||||
m_pPed->bFireProof = true;
|
|
||||||
m_pPed->bCollisionProof = true;
|
|
||||||
m_pPed->bMeleeProof = true;
|
|
||||||
m_pPed->bOnlyDamagedByPlayer = true;
|
|
||||||
m_pPed->bExplosionProof = true;
|
|
||||||
m_pPed->m_bCanBeDamaged = false;
|
|
||||||
((CPlayerPed*)m_pPed)->ClearAdrenaline();
|
|
||||||
CancelPlayerEnteringCars(nil);
|
|
||||||
gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
|
|
||||||
CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
|
|
||||||
CProjectileInfo::RemoveAllProjectiles();
|
|
||||||
CWorld::SetAllCarsCanBeDamaged(false);
|
|
||||||
CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
|
|
||||||
CReplay::DisableReplays();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
|
|
||||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
|
|
||||||
m_pPed->bBulletProof = false;
|
|
||||||
m_pPed->bFireProof = false;
|
|
||||||
m_pPed->bCollisionProof = false;
|
|
||||||
m_pPed->bMeleeProof = false;
|
|
||||||
m_pPed->bOnlyDamagedByPlayer = false;
|
|
||||||
m_pPed->bExplosionProof = false;
|
|
||||||
m_pPed->m_bCanBeDamaged = true;
|
|
||||||
CWorld::SetAllCarsCanBeDamaged(true);
|
|
||||||
CReplay::EnableReplays();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool
|
|
||||||
CPlayerInfo::IsRestartingAfterDeath()
|
|
||||||
{
|
|
||||||
return m_WBState == WBSTATE_WASTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool
|
|
||||||
CPlayerInfo::IsRestartingAfterArrest()
|
|
||||||
{
|
|
||||||
return m_WBState == WBSTATE_BUSTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
// lastCloseness is passed to other calls of this function
|
|
||||||
void
|
|
||||||
CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
|
|
||||||
{
|
|
||||||
// This dist used for determining the angle to face
|
|
||||||
CVector2D dist(carToTest->GetPosition() - player->GetPosition());
|
|
||||||
float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
|
|
||||||
while (neededTurn >= PI) {
|
|
||||||
neededTurn -= 2 * PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (neededTurn < -PI) {
|
|
||||||
neededTurn += 2 * PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This dist used for evaluating cars' distances, weird...
|
|
||||||
// Accounts inverted needed turn (or needed turn in long way) and car dist.
|
|
||||||
float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
|
|
||||||
if (closeness > *lastCloseness) {
|
|
||||||
*lastCloseness = closeness;
|
|
||||||
*closestCarOutput = (CVehicle*)carToTest;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
|
|
||||||
{
|
|
||||||
// Interesting
|
|
||||||
*size = sizeof(CPlayerInfo);
|
|
||||||
|
|
||||||
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
|
|
||||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio);
|
|
||||||
#undef CopyToBuf
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
|
|
||||||
{
|
|
||||||
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
|
|
||||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio)
|
|
||||||
#undef CopyFromBuf
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void
|
|
||||||
CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
|
|
||||||
{
|
|
||||||
for (CPtrNode* node = carList.first; node; node = node->next) {
|
|
||||||
CVehicle *car = (CVehicle*)node->item;
|
|
||||||
if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
|
|
||||||
if (!car->bUsesCollision || !car->IsVehicle())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
car->m_scanCode = CWorld::GetCurrentScanCode();
|
|
||||||
if (car->GetStatus() != STATUS_WRECKED && car->GetStatus() != STATUS_TRAIN_MOVING
|
|
||||||
&& (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
|
|
||||||
CVector carCentre = car->GetBoundCentre();
|
|
||||||
|
|
||||||
if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f || car->IsCar() && carCentre.z < ped->GetPosition().z && ped->GetPosition().z - 4.f < carCentre.z) {
|
|
||||||
float dist = (ped->GetPosition() - carCentre).Magnitude2D();
|
|
||||||
if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
|
|
||||||
EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CPlayerInfo::Process(void)
|
CPlayerInfo::Process(void)
|
||||||
{
|
{
|
||||||
|
@ -796,3 +528,355 @@ CPlayerInfo::Process(void)
|
||||||
m_nMoney = Min(999999999, m_nMoney);
|
m_nMoney = Min(999999999, m_nMoney);
|
||||||
m_nVisibleMoney = Min(999999999, m_nVisibleMoney);
|
m_nVisibleMoney = Min(999999999, m_nVisibleMoney);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CPlayerInfo::IsPlayerInRemoteMode()
|
||||||
|
{
|
||||||
|
return m_pRemoteVehicle || m_bInRemoteMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
|
||||||
|
{
|
||||||
|
// Interesting
|
||||||
|
*size = sizeof(CPlayerInfo);
|
||||||
|
|
||||||
|
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
|
||||||
|
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio);
|
||||||
|
#undef CopyToBuf
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
|
||||||
|
{
|
||||||
|
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
|
||||||
|
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio)
|
||||||
|
#undef CopyFromBuf
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
|
||||||
|
{
|
||||||
|
for (CPtrNode* node = carList.first; node; node = node->next) {
|
||||||
|
CVehicle *car = (CVehicle*)node->item;
|
||||||
|
if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
|
||||||
|
if (!car->bUsesCollision || !car->IsVehicle())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
car->m_scanCode = CWorld::GetCurrentScanCode();
|
||||||
|
if (car->GetStatus() != STATUS_WRECKED && car->GetStatus() != STATUS_TRAIN_MOVING
|
||||||
|
&& (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
|
||||||
|
CVector carCentre = car->GetBoundCentre();
|
||||||
|
|
||||||
|
if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f || car->IsCar() && carCentre.z < ped->GetPosition().z && ped->GetPosition().z - 4.f < carCentre.z) {
|
||||||
|
float dist = (ped->GetPosition() - carCentre).Magnitude2D();
|
||||||
|
if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
|
||||||
|
EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// lastCloseness is passed to other calls of this function
|
||||||
|
void
|
||||||
|
CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
|
||||||
|
{
|
||||||
|
// This dist used for determining the angle to face
|
||||||
|
CVector2D dist(carToTest->GetPosition() - player->GetPosition());
|
||||||
|
float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
|
||||||
|
while (neededTurn >= PI) {
|
||||||
|
neededTurn -= 2 * PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (neededTurn < -PI) {
|
||||||
|
neededTurn += 2 * PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This dist used for evaluating cars' distances, weird...
|
||||||
|
// Accounts inverted needed turn (or needed turn in long way) and car dist.
|
||||||
|
float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
|
||||||
|
if (closeness > *lastCloseness) {
|
||||||
|
*lastCloseness = closeness;
|
||||||
|
*closestCarOutput = (CVehicle*)carToTest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const CVector &
|
||||||
|
CPlayerInfo::GetPos()
|
||||||
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (!m_pPed)
|
||||||
|
return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
|
if (m_pPed->InVehicle())
|
||||||
|
return m_pPed->m_pMyVehicle->GetPosition();
|
||||||
|
return m_pPed->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector
|
||||||
|
FindPlayerCoors(void)
|
||||||
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
|
CPlayerPed *ped = FindPlayerPed();
|
||||||
|
if(ped->InVehicle())
|
||||||
|
return ped->m_pMyVehicle->GetPosition();
|
||||||
|
else
|
||||||
|
return ped->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
const CVector &
|
||||||
|
FindPlayerSpeed(void)
|
||||||
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return vecTmpVector;
|
||||||
|
#endif
|
||||||
|
CPlayerPed *ped = FindPlayerPed();
|
||||||
|
if(ped->InVehicle())
|
||||||
|
return ped->m_pMyVehicle->m_vecMoveSpeed;
|
||||||
|
else
|
||||||
|
return ped->m_vecMoveSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVehicle *
|
||||||
|
FindPlayerVehicle(void)
|
||||||
|
{
|
||||||
|
CPlayerPed *ped = FindPlayerPed();
|
||||||
|
if(ped && ped->InVehicle()) return ped->m_pMyVehicle;
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEntity *
|
||||||
|
FindPlayerEntity(void)
|
||||||
|
{
|
||||||
|
CPlayerPed *ped = FindPlayerPed();
|
||||||
|
if(ped->InVehicle())
|
||||||
|
return ped->m_pMyVehicle;
|
||||||
|
else
|
||||||
|
return ped;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVehicle *
|
||||||
|
FindPlayerTrain(void)
|
||||||
|
{
|
||||||
|
if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
|
||||||
|
return FindPlayerVehicle();
|
||||||
|
else
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlayerPed *
|
||||||
|
FindPlayerPed(void)
|
||||||
|
{
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CVector &
|
||||||
|
FindPlayerCentreOfWorld(int32 player)
|
||||||
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
|
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
||||||
|
if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
|
||||||
|
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
|
||||||
|
return CWorld::Players[player].m_pPed->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
const CVector &
|
||||||
|
FindPlayerCentreOfWorld_NoSniperShift(void)
|
||||||
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
|
||||||
|
#endif
|
||||||
|
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
||||||
|
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
|
||||||
|
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
|
||||||
|
return FindPlayerPed()->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
FindPlayerHeading(void)
|
||||||
|
{
|
||||||
|
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
|
||||||
|
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading();
|
||||||
|
return FindPlayerPed()->GetForward().Heading();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CPlayerInfo::IsRestartingAfterDeath()
|
||||||
|
{
|
||||||
|
return m_WBState == WBSTATE_WASTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CPlayerInfo::IsRestartingAfterArrest()
|
||||||
|
{
|
||||||
|
return m_WBState == WBSTATE_BUSTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::KillPlayer()
|
||||||
|
{
|
||||||
|
if (m_WBState != WBSTATE_PLAYING) return;
|
||||||
|
|
||||||
|
m_WBState = WBSTATE_WASTED;
|
||||||
|
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
||||||
|
CDarkel::ResetOnPlayerDeath();
|
||||||
|
CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
|
||||||
|
CStats::TimesDied++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::ArrestPlayer()
|
||||||
|
{
|
||||||
|
if (m_WBState != WBSTATE_PLAYING) return;
|
||||||
|
|
||||||
|
m_WBState = WBSTATE_BUSTED;
|
||||||
|
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
||||||
|
m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
|
||||||
|
CDarkel::ResetOnPlayerDeath();
|
||||||
|
CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
|
||||||
|
CStats::TimesArrested++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::PlayerFailedCriticalMission()
|
||||||
|
{
|
||||||
|
if (m_WBState != WBSTATE_PLAYING)
|
||||||
|
return;
|
||||||
|
m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
|
||||||
|
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
||||||
|
CDarkel::ResetOnPlayerDeath();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
|
||||||
|
{
|
||||||
|
if (!car || car == m_pPed->m_pMyVehicle) {
|
||||||
|
if (m_pPed->EnteringCar())
|
||||||
|
m_pPed->QuitEnteringCar();
|
||||||
|
}
|
||||||
|
if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
|
||||||
|
m_pPed->ClearObjective();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::MakePlayerSafe(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle) {
|
||||||
|
m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
|
||||||
|
CWorld::StopAllLawEnforcersInTheirTracks();
|
||||||
|
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
|
||||||
|
CPad::StopPadsShaking();
|
||||||
|
m_pPed->bBulletProof = true;
|
||||||
|
m_pPed->bFireProof = true;
|
||||||
|
m_pPed->bCollisionProof = true;
|
||||||
|
m_pPed->bMeleeProof = true;
|
||||||
|
m_pPed->bOnlyDamagedByPlayer = true;
|
||||||
|
m_pPed->bExplosionProof = true;
|
||||||
|
m_pPed->m_bCanBeDamaged = false;
|
||||||
|
((CPlayerPed*)m_pPed)->ClearAdrenaline();
|
||||||
|
CancelPlayerEnteringCars(nil);
|
||||||
|
gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
|
||||||
|
CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
|
||||||
|
CProjectileInfo::RemoveAllProjectiles();
|
||||||
|
CWorld::SetAllCarsCanBeDamaged(false);
|
||||||
|
CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
|
||||||
|
CReplay::DisableReplays();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
|
||||||
|
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
|
||||||
|
m_pPed->bBulletProof = false;
|
||||||
|
m_pPed->bFireProof = false;
|
||||||
|
m_pPed->bCollisionProof = false;
|
||||||
|
m_pPed->bMeleeProof = false;
|
||||||
|
m_pPed->bOnlyDamagedByPlayer = false;
|
||||||
|
m_pPed->bExplosionProof = false;
|
||||||
|
m_pPed->m_bCanBeDamaged = true;
|
||||||
|
CWorld::SetAllCarsCanBeDamaged(true);
|
||||||
|
CReplay::EnableReplays();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::BlowUpRCBuggy(bool actually)
|
||||||
|
{
|
||||||
|
if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CRemote::TakeRemoteControlledCarFromPlayer(actually);
|
||||||
|
if (actually)
|
||||||
|
m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GTA_PC
|
||||||
|
void
|
||||||
|
CPlayerInfo::SetPlayerSkin(const char *skin)
|
||||||
|
{
|
||||||
|
strncpy(m_aSkinName, skin, 32);
|
||||||
|
LoadPlayerSkin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::LoadPlayerSkin()
|
||||||
|
{
|
||||||
|
DeletePlayerSkin();
|
||||||
|
|
||||||
|
m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerInfo::DeletePlayerSkin()
|
||||||
|
{
|
||||||
|
if (m_pSkinTexture) {
|
||||||
|
RwTextureDestroy(m_pSkinTexture);
|
||||||
|
m_pSkinTexture = nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -84,13 +84,12 @@ public:
|
||||||
bool m_bDriveByAllowed;
|
bool m_bDriveByAllowed;
|
||||||
uint8 m_nBustedAudioStatus;
|
uint8 m_nBustedAudioStatus;
|
||||||
int16 m_nCurrentBustedAudio;
|
int16 m_nCurrentBustedAudio;
|
||||||
|
#ifdef GTA_PC
|
||||||
char m_aSkinName[32];
|
char m_aSkinName[32];
|
||||||
RwTexture *m_pSkinTexture;
|
RwTexture *m_pSkinTexture;
|
||||||
|
#endif
|
||||||
|
|
||||||
void MakePlayerSafe(bool);
|
void MakePlayerSafe(bool);
|
||||||
void LoadPlayerSkin();
|
|
||||||
void DeletePlayerSkin();
|
|
||||||
void SetPlayerSkin(char* skin);
|
|
||||||
const CVector &GetPos();
|
const CVector &GetPos();
|
||||||
void Process(void);
|
void Process(void);
|
||||||
void KillPlayer(void);
|
void KillPlayer(void);
|
||||||
|
@ -107,5 +106,19 @@ public:
|
||||||
void SavePlayerInfo(uint8 *buf, uint32* size);
|
void SavePlayerInfo(uint8 *buf, uint32* size);
|
||||||
void FindClosestCarSectorList(CPtrList&, CPed*, float, float, float, float, float*, CVehicle**);
|
void FindClosestCarSectorList(CPtrList&, CPed*, float, float, float, float, float*, CVehicle**);
|
||||||
|
|
||||||
~CPlayerInfo() { };
|
#ifdef GTA_PC
|
||||||
|
void LoadPlayerSkin();
|
||||||
|
void SetPlayerSkin(const char *skin);
|
||||||
|
void DeletePlayerSkin();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CPlayerPed *FindPlayerPed(void);
|
||||||
|
CVehicle *FindPlayerVehicle(void);
|
||||||
|
CVehicle *FindPlayerTrain(void);
|
||||||
|
CEntity *FindPlayerEntity(void);
|
||||||
|
CVector FindPlayerCoors(void);
|
||||||
|
const CVector &FindPlayerSpeed(void);
|
||||||
|
const CVector &FindPlayerCentreOfWorld(int32 player);
|
||||||
|
const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
|
||||||
|
float FindPlayerHeading(void);
|
|
@ -1399,102 +1399,6 @@ CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList &list, const CVec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlayerPed *
|
|
||||||
FindPlayerPed(void)
|
|
||||||
{
|
|
||||||
return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
|
||||||
}
|
|
||||||
|
|
||||||
CVehicle *
|
|
||||||
FindPlayerVehicle(void)
|
|
||||||
{
|
|
||||||
CPlayerPed *ped = FindPlayerPed();
|
|
||||||
if(ped && ped->InVehicle()) return ped->m_pMyVehicle;
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
CVehicle *
|
|
||||||
FindPlayerTrain(void)
|
|
||||||
{
|
|
||||||
if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
|
|
||||||
return FindPlayerVehicle();
|
|
||||||
else
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
CEntity *
|
|
||||||
FindPlayerEntity(void)
|
|
||||||
{
|
|
||||||
CPlayerPed *ped = FindPlayerPed();
|
|
||||||
if(ped->InVehicle())
|
|
||||||
return ped->m_pMyVehicle;
|
|
||||||
else
|
|
||||||
return ped;
|
|
||||||
}
|
|
||||||
|
|
||||||
CVector
|
|
||||||
FindPlayerCoors(void)
|
|
||||||
{
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
if (CReplay::IsPlayingBack())
|
|
||||||
return TheCamera.GetPosition();
|
|
||||||
#endif
|
|
||||||
CPlayerPed *ped = FindPlayerPed();
|
|
||||||
if(ped->InVehicle())
|
|
||||||
return ped->m_pMyVehicle->GetPosition();
|
|
||||||
else
|
|
||||||
return ped->GetPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
CVector &
|
|
||||||
FindPlayerSpeed(void)
|
|
||||||
{
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
|
|
||||||
if (CReplay::IsPlayingBack())
|
|
||||||
return vecTmpVector;
|
|
||||||
#endif
|
|
||||||
CPlayerPed *ped = FindPlayerPed();
|
|
||||||
if(ped->InVehicle())
|
|
||||||
return ped->m_pMyVehicle->m_vecMoveSpeed;
|
|
||||||
else
|
|
||||||
return ped->m_vecMoveSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CVector &
|
|
||||||
FindPlayerCentreOfWorld(int32 player)
|
|
||||||
{
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
|
|
||||||
#endif
|
|
||||||
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
|
||||||
if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
|
|
||||||
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
|
|
||||||
return CWorld::Players[player].m_pPed->GetPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
const CVector &
|
|
||||||
FindPlayerCentreOfWorld_NoSniperShift(void)
|
|
||||||
{
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
|
|
||||||
#endif
|
|
||||||
if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
|
|
||||||
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
|
||||||
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
|
|
||||||
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
|
|
||||||
return FindPlayerPed()->GetPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
|
||||||
FindPlayerHeading(void)
|
|
||||||
{
|
|
||||||
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
|
||||||
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
|
|
||||||
if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading();
|
|
||||||
return FindPlayerPed()->GetForward().Heading();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2)
|
CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,15 +178,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
|
extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
|
||||||
|
|
||||||
class CPlayerPed;
|
|
||||||
class CVehicle;
|
|
||||||
CPlayerPed *FindPlayerPed(void);
|
|
||||||
CVehicle *FindPlayerVehicle(void);
|
|
||||||
CVehicle *FindPlayerTrain(void);
|
|
||||||
CEntity *FindPlayerEntity(void);
|
|
||||||
CVector FindPlayerCoors(void);
|
|
||||||
CVector &FindPlayerSpeed(void);
|
|
||||||
const CVector &FindPlayerCentreOfWorld(int32 player);
|
|
||||||
const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
|
|
||||||
float FindPlayerHeading(void);
|
|
||||||
|
|
|
@ -384,9 +384,9 @@ ScreenDroplets::ProcessCameraMovement(void)
|
||||||
ms_prevCamUp = camUp;
|
ms_prevCamUp = camUp;
|
||||||
ms_prevCamPos = camPos;
|
ms_prevCamPos = camPos;
|
||||||
|
|
||||||
ms_screenMoveDelta.x = -RwV3dDotProduct(&camMat->right, (RwV3d*)&ms_camMoveDelta);
|
ms_screenMoveDelta.x = -RwV3dDotProduct(&camMat->right, &ms_camMoveDelta);
|
||||||
ms_screenMoveDelta.y = RwV3dDotProduct(&camMat->up, (RwV3d*)&ms_camMoveDelta);
|
ms_screenMoveDelta.y = RwV3dDotProduct(&camMat->up, &ms_camMoveDelta);
|
||||||
ms_screenMoveDelta.z = RwV3dDotProduct(&camMat->at, (RwV3d*)&ms_camMoveDelta);
|
ms_screenMoveDelta.z = RwV3dDotProduct(&camMat->at, &ms_camMoveDelta);
|
||||||
ms_screenMoveDelta *= 10.0f;
|
ms_screenMoveDelta *= 10.0f;
|
||||||
ms_screenMoveDist = ms_screenMoveDelta.Magnitude2D();
|
ms_screenMoveDist = ms_screenMoveDelta.Magnitude2D();
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,6 @@ public:
|
||||||
void UpdateRW(void);
|
void UpdateRW(void);
|
||||||
void operator=(CMatrix const &rhs);
|
void operator=(CMatrix const &rhs);
|
||||||
CMatrix &operator+=(CMatrix const &rhs);
|
CMatrix &operator+=(CMatrix const &rhs);
|
||||||
#ifdef RWCORE_H
|
|
||||||
operator RwMatrix (void) const {
|
|
||||||
return m_matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator RwMatrix *(void) {
|
|
||||||
return &m_matrix;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
CMatrix &operator*=(CMatrix const &rhs);
|
CMatrix &operator*=(CMatrix const &rhs);
|
||||||
|
|
||||||
const CVector &GetPosition(void) const { return *(CVector*)&m_matrix.pos; }
|
const CVector &GetPosition(void) const { return *(CVector*)&m_matrix.pos; }
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CVector
|
class CVector : public RwV3d
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float x, y, z;
|
|
||||||
CVector(void) {}
|
CVector(void) {}
|
||||||
CVector(float x, float y, float z) : x(x), y(y), z(z) {}
|
CVector(float x, float y, float z)
|
||||||
#ifdef RWCORE_H
|
{
|
||||||
CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
|
this->x = x;
|
||||||
|
this->y = y;
|
||||||
operator RwV3d (void) const {
|
this->z = z;
|
||||||
RwV3d vecRw = { this->x, this->y, this->z };
|
|
||||||
return vecRw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
operator RwV3d *(void) {
|
CVector(const RwV3d &v)
|
||||||
return (RwV3d*)this;
|
{
|
||||||
|
x = v.x;
|
||||||
|
y = v.y;
|
||||||
|
z = v.z;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
// (0,1,0) means no rotation. So get right vector and its atan
|
// (0,1,0) means no rotation. So get right vector and its atan
|
||||||
float Heading(void) const { return Atan2(-x, y); }
|
float Heading(void) const { return Atan2(-x, y); }
|
||||||
float Magnitude(void) const { return Sqrt(x*x + y*y + z*z); }
|
float Magnitude(void) const { return Sqrt(x*x + y*y + z*z); }
|
||||||
|
|
|
@ -8,18 +8,7 @@ public:
|
||||||
CVuVector(float x, float y, float z) : CVector(x, y, z) {}
|
CVuVector(float x, float y, float z) : CVector(x, y, z) {}
|
||||||
CVuVector(float x, float y, float z, float w) : CVector(x, y, z), w(w) {}
|
CVuVector(float x, float y, float z, float w) : CVector(x, y, z), w(w) {}
|
||||||
CVuVector(const CVector &v) : CVector(v.x, v.y, v.z) {}
|
CVuVector(const CVector &v) : CVector(v.x, v.y, v.z) {}
|
||||||
#ifdef RWCORE_H
|
CVuVector(const RwV3d &v) : CVector(v) {}
|
||||||
CVuVector(const RwV3d &v) : CVector(v.x, v.y, v.z) {}
|
|
||||||
|
|
||||||
operator RwV3d (void) const {
|
|
||||||
RwV3d vecRw = { this->x, this->y, this->z };
|
|
||||||
return vecRw;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator RwV3d *(void) {
|
|
||||||
return (RwV3d*)this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
void Normalise(void) {
|
void Normalise(void) {
|
||||||
float sq = MagnitudeSqr();
|
float sq = MagnitudeSqr();
|
||||||
|
|
|
@ -549,7 +549,7 @@ CVehicleModelInfo::PreprocessHierarchy(void)
|
||||||
|
|
||||||
if(desc[i].flags & VEHICLE_FLAG_POS){
|
if(desc[i].flags & VEHICLE_FLAG_POS){
|
||||||
f = assoc.frame;
|
f = assoc.frame;
|
||||||
rwvec = (RwV3d*)&m_positions[desc[i].hierId];
|
rwvec = &m_positions[desc[i].hierId];
|
||||||
*rwvec = *RwMatrixGetPos(RwFrameGetMatrix(f));
|
*rwvec = *RwMatrixGetPos(RwFrameGetMatrix(f));
|
||||||
for(f = RwFrameGetParent(f); f; f = RwFrameGetParent(f))
|
for(f = RwFrameGetParent(f); f; f = RwFrameGetParent(f))
|
||||||
RwV3dTransformPoints(rwvec, rwvec, 1, RwFrameGetMatrix(f));
|
RwV3dTransformPoints(rwvec, rwvec, 1, RwFrameGetMatrix(f));
|
||||||
|
|
|
@ -264,7 +264,7 @@ CCopPed::ArrestPlayer(void)
|
||||||
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f);
|
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f);
|
||||||
|
|
||||||
CVector suspMidPos;
|
CVector suspMidPos;
|
||||||
suspect->m_pedIK.GetComponentPosition(*(RwV3d *)&suspMidPos, PED_MID);
|
suspect->m_pedIK.GetComponentPosition(suspMidPos, PED_MID);
|
||||||
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y,
|
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y,
|
||||||
GetPosition().x, GetPosition().y);
|
GetPosition().x, GetPosition().y);
|
||||||
|
|
||||||
|
|
|
@ -230,8 +230,8 @@ CEmergencyPed::MedicAI(void)
|
||||||
if (nearestAccident) {
|
if (nearestAccident) {
|
||||||
m_pRevivedPed = nearestAccident->m_pVictim;
|
m_pRevivedPed = nearestAccident->m_pVictim;
|
||||||
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
|
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
||||||
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
|
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
|
||||||
bIsRunning = true;
|
bIsRunning = true;
|
||||||
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
||||||
|
@ -270,8 +270,8 @@ CEmergencyPed::MedicAI(void)
|
||||||
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
||||||
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
|
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
|
||||||
bIsRunning = true;
|
bIsRunning = true;
|
||||||
--m_pAttendedAccident->m_nMedicsAttending;
|
--m_pAttendedAccident->m_nMedicsAttending;
|
||||||
|
@ -324,8 +324,8 @@ CEmergencyPed::MedicAI(void)
|
||||||
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
|
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
|
||||||
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
||||||
else {
|
else {
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
||||||
midPos = (headPos + midPos) * 0.5f;
|
midPos = (headPos + midPos) * 0.5f;
|
||||||
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
||||||
midPos.x, midPos.y,
|
midPos.x, midPos.y,
|
||||||
|
@ -346,8 +346,8 @@ CEmergencyPed::MedicAI(void)
|
||||||
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
||||||
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
||||||
midPos = (headPos + midPos) * 0.5f;
|
midPos = (headPos + midPos) * 0.5f;
|
||||||
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
||||||
midPos.x, midPos.y,
|
midPos.x, midPos.y,
|
||||||
|
|
|
@ -1119,7 +1119,7 @@ public:
|
||||||
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
|
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
|
||||||
int32 idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID);
|
int32 idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID);
|
||||||
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
|
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
|
||||||
RwV3dTransformPoints((RwV3d*)&pos, (RwV3d*)&pos, 1, &mats[idx]);
|
RwV3dTransformPoints(&pos, &pos, 1, &mats[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set by 0482:set_threat_reaction_range_multiplier opcode
|
// set by 0482:set_threat_reaction_range_multiplier opcode
|
||||||
|
|
|
@ -2151,7 +2151,7 @@ CPed::FightStrike(CVector &touchedNodePos, bool fightWithWeapon)
|
||||||
if (m_fightState == FIGHTSTATE_NO_MOVE)
|
if (m_fightState == FIGHTSTATE_NO_MOVE)
|
||||||
m_fightState = FIGHTSTATE_1;
|
m_fightState = FIGHTSTATE_1;
|
||||||
|
|
||||||
m_vecHitLastPos = *touchedNodePos;
|
m_vecHitLastPos = touchedNodePos;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ public:
|
||||||
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
|
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
|
||||||
bool PointGunAtPosition(CVector const& position);
|
bool PointGunAtPosition(CVector const& position);
|
||||||
void GetComponentPosition(RwV3d &pos, uint32 node);
|
void GetComponentPosition(RwV3d &pos, uint32 node);
|
||||||
void GetComponentPosition(CVector &pos, uint32 node) { GetComponentPosition(*(RwV3d*)pos, node); }
|
|
||||||
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
||||||
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
|
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
|
||||||
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);
|
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);
|
||||||
|
|
|
@ -1436,7 +1436,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||||
if (m_pPointGunAt) {
|
if (m_pPointGunAt) {
|
||||||
CVector markPos;
|
CVector markPos;
|
||||||
if (m_pPointGunAt->IsPed()) {
|
if (m_pPointGunAt->IsPed()) {
|
||||||
((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition(*(RwV3d *)&markPos, PED_MID);
|
((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition(markPos, PED_MID);
|
||||||
} else {
|
} else {
|
||||||
markPos = m_pPointGunAt->GetPosition();
|
markPos = m_pPointGunAt->GetPosition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ CClouds::Render(void)
|
||||||
CSprite::InitSpriteBuffer();
|
CSprite::InitSpriteBuffer();
|
||||||
|
|
||||||
float minute = CClock::GetHours()*60 + CClock::GetMinutes() + CClock::GetSeconds()/60.0f;
|
float minute = CClock::GetHours()*60 + CClock::GetMinutes() + CClock::GetSeconds()/60.0f;
|
||||||
RwV3d campos = *(RwV3d*)&TheCamera.GetPosition();
|
RwV3d campos = TheCamera.GetPosition();
|
||||||
|
|
||||||
// Moon
|
// Moon
|
||||||
float moonfadeout = Abs(minute - 180.0f); // fully visible at 3AM
|
float moonfadeout = Abs(minute - 180.0f); // fully visible at 3AM
|
||||||
|
|
|
@ -271,7 +271,7 @@ CCoronas::Render(void)
|
||||||
|
|
||||||
CVector spriteCoors;
|
CVector spriteCoors;
|
||||||
float spritew, spriteh;
|
float spritew, spriteh;
|
||||||
if(!CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){
|
if(!CSprite::CalcScreenCoors(aCoronas[i].coors, &spriteCoors, &spritew, &spriteh, true)){
|
||||||
aCoronas[i].offScreen = true;
|
aCoronas[i].offScreen = true;
|
||||||
aCoronas[i].sightClear = false;
|
aCoronas[i].sightClear = false;
|
||||||
}else{
|
}else{
|
||||||
|
@ -478,7 +478,7 @@ CCoronas::RenderReflections(void)
|
||||||
|
|
||||||
CVector spriteCoors;
|
CVector spriteCoors;
|
||||||
float spritew, spriteh;
|
float spritew, spriteh;
|
||||||
if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
|
if(CSprite::CalcScreenCoors(coors, &spriteCoors, &spritew, &spriteh, true)) {
|
||||||
float drawDist = 0.75f * aCoronas[i].drawDist;
|
float drawDist = 0.75f * aCoronas[i].drawDist;
|
||||||
drawDist = Min(drawDist, 55.0f);
|
drawDist = Min(drawDist, 55.0f);
|
||||||
if(spriteCoors.z < drawDist){
|
if(spriteCoors.z < drawDist){
|
||||||
|
@ -669,7 +669,7 @@ CCoronas::DoSunAndMoon(void)
|
||||||
|
|
||||||
CVector spriteCoors;
|
CVector spriteCoors;
|
||||||
float spritew, spriteh;
|
float spritew, spriteh;
|
||||||
if(CSprite::CalcScreenCoors(sunCoors, spriteCoors, &spritew, &spriteh, true)){
|
if(CSprite::CalcScreenCoors(sunCoors, &spriteCoors, &spritew, &spriteh, true)) {
|
||||||
SunScreenX = spriteCoors.x;
|
SunScreenX = spriteCoors.x;
|
||||||
SunScreenY = spriteCoors.y;
|
SunScreenY = spriteCoors.y;
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -756,7 +756,7 @@ void CScrollBar::Render()
|
||||||
// Render main coronas
|
// Render main coronas
|
||||||
if (m_MessageBar[i] & (1 << j))
|
if (m_MessageBar[i] & (1 << j))
|
||||||
{
|
{
|
||||||
if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
|
if (CSprite::CalcScreenCoors(coronaCoord, &screenCoord, &screenW, &screenH, true))
|
||||||
{
|
{
|
||||||
CSprite::RenderBufferedOneXLUSprite(
|
CSprite::RenderBufferedOneXLUSprite(
|
||||||
screenCoord.x, screenCoord.y, screenCoord.z,
|
screenCoord.x, screenCoord.y, screenCoord.z,
|
||||||
|
@ -768,7 +768,7 @@ void CScrollBar::Render()
|
||||||
// Render smaller and faded coronas for a trailing effect
|
// Render smaller and faded coronas for a trailing effect
|
||||||
else if (m_MessageBar[i - 1] & (1 << j))
|
else if (m_MessageBar[i - 1] & (1 << j))
|
||||||
{
|
{
|
||||||
if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
|
if (CSprite::CalcScreenCoors(coronaCoord, &screenCoord, &screenW, &screenH, true))
|
||||||
{
|
{
|
||||||
CSprite::RenderBufferedOneXLUSprite(
|
CSprite::RenderBufferedOneXLUSprite(
|
||||||
screenCoord.x, screenCoord.y, screenCoord.z,
|
screenCoord.x, screenCoord.y, screenCoord.z,
|
||||||
|
|
|
@ -941,7 +941,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
|
||||||
CVector screen;
|
CVector screen;
|
||||||
float w, h;
|
float w, h;
|
||||||
|
|
||||||
if ( !CSprite::CalcScreenCoors(vecPos, screen, &w, &h, true) )
|
if ( !CSprite::CalcScreenCoors(vecPos, &screen, &w, &h, true) )
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
pParticle->m_vecPosition = screen;
|
pParticle->m_vecPosition = screen;
|
||||||
|
@ -2034,7 +2034,7 @@ void CParticle::Render()
|
||||||
float w;
|
float w;
|
||||||
float h;
|
float h;
|
||||||
|
|
||||||
if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
|
if ( CSprite::CalcScreenCoors(particle->m_vecPosition, &coors, &w, &h, true) )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( i == PARTICLE_ENGINE_STEAM
|
if ( i == PARTICLE_ENGINE_STEAM
|
||||||
|
@ -2189,7 +2189,7 @@ void CParticle::Render()
|
||||||
float fTrailLength;
|
float fTrailLength;
|
||||||
CVector vecScreenPosition;
|
CVector vecScreenPosition;
|
||||||
|
|
||||||
if ( CSprite::CalcScreenCoors(vecPrevPos, vecScreenPosition, &fTrailLength, &fRotation, true) )
|
if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) )
|
||||||
{
|
{
|
||||||
CVector2D vecDist
|
CVector2D vecDist
|
||||||
(
|
(
|
||||||
|
|
|
@ -239,7 +239,7 @@ CPointLights::RenderFogEffect(void)
|
||||||
// more intensity the closer to line
|
// more intensity the closer to line
|
||||||
intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH);
|
intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH);
|
||||||
|
|
||||||
if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
|
if(CSprite::CalcScreenCoors(fogcoors, &spriteCoors, &spritew, &spriteh, true)) {
|
||||||
float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x2000;
|
float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x2000;
|
||||||
float size = FogSizes[r>>1];
|
float size = FogSizes[r>>1];
|
||||||
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||||
|
@ -287,7 +287,7 @@ CPointLights::RenderFogEffect(void)
|
||||||
intensity *= 1.0f - sq(lightdist / FOG_AREA_RADIUS);
|
intensity *= 1.0f - sq(lightdist / FOG_AREA_RADIUS);
|
||||||
|
|
||||||
CVector fogcoors(xi, yi, groundZ + 1.6f);
|
CVector fogcoors(xi, yi, groundZ + 1.6f);
|
||||||
if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
|
if(CSprite::CalcScreenCoors(fogcoors, &spriteCoors, &spritew, &spriteh, true)) {
|
||||||
float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x4000;
|
float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x4000;
|
||||||
float size = FogSizes[r>>1];
|
float size = FogSizes[r>>1];
|
||||||
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||||
|
|
|
@ -1302,7 +1302,7 @@ CRenderer::ScanWorld(void)
|
||||||
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
|
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
|
||||||
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
|
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
|
||||||
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
|
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
|
||||||
RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
|
RwV3dTransformPoints(vectors, vectors, 9, cammatrix);
|
||||||
|
|
||||||
m_loadingPriority = false;
|
m_loadingPriority = false;
|
||||||
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
|
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
|
||||||
|
@ -1422,7 +1422,7 @@ CRenderer::RequestObjectsInFrustum(void)
|
||||||
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
|
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
|
||||||
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
|
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
|
||||||
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
|
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
|
||||||
RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
|
RwV3dTransformPoints(vectors, vectors, 9, cammatrix);
|
||||||
|
|
||||||
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
|
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
|
|
|
@ -2229,7 +2229,7 @@ CShadows::CastShadowEntityXYZ(CEntity *pEntity, CVector *pPosn,
|
||||||
sphere.Set(2.0f, center);
|
sphere.Set(2.0f, center);
|
||||||
|
|
||||||
RwV3d point;
|
RwV3d point;
|
||||||
RwV3dTransformPoints(&point, center, 1, &invMatrix);
|
RwV3dTransformPoints(&point, ¢er, 1, &invMatrix);
|
||||||
|
|
||||||
CColSphere colSphere;
|
CColSphere colSphere;
|
||||||
colSphere.Set(2.0f, CVector(point), 0, 0);
|
colSphere.Set(2.0f, CVector(point), 0, 0);
|
||||||
|
@ -2252,7 +2252,7 @@ CShadows::CastShadowEntityXYZ(CEntity *pEntity, CVector *pPosn,
|
||||||
p[1] += offset;
|
p[1] += offset;
|
||||||
p[2] += offset;
|
p[2] += offset;
|
||||||
|
|
||||||
if ( !ShadowRenderTriangleCB((RwV3d *)p, n, &proj) )
|
if ( !ShadowRenderTriangleCB(p, &n, &proj) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -1597,7 +1597,7 @@ CBike::PreRender(void)
|
||||||
CVector forkAxis(0.0f, Sin(DEGTORAD(mi->m_bikeSteerAngle)), -Cos(DEGTORAD(mi->m_bikeSteerAngle)));
|
CVector forkAxis(0.0f, Sin(DEGTORAD(mi->m_bikeSteerAngle)), -Cos(DEGTORAD(mi->m_bikeSteerAngle)));
|
||||||
forkAxis.Normalise(); // as if that's not already the case
|
forkAxis.Normalise(); // as if that's not already the case
|
||||||
CQuaternion quat;
|
CQuaternion quat;
|
||||||
quat.Set((RwV3d*)&forkAxis, -m_fWheelAngle);
|
quat.Set(&forkAxis, -m_fWheelAngle);
|
||||||
quat.Get(rot.m_attachment);
|
quat.Get(rot.m_attachment);
|
||||||
rot.Update();
|
rot.Update();
|
||||||
|
|
||||||
|
|
|
@ -443,7 +443,7 @@ CBoat::ProcessControl(void)
|
||||||
CVector wakePos = GetPosition() + sternPos;
|
CVector wakePos = GetPosition() + sternPos;
|
||||||
// no actual particles for player...
|
// no actual particles for player...
|
||||||
}else if(IsVisible() && ((CTimer::GetFrameCounter() + m_randomSeed) & 1) &&
|
}else if(IsVisible() && ((CTimer::GetFrameCounter() + m_randomSeed) & 1) &&
|
||||||
CVisibilityPlugins::GetDistanceSquaredFromCamera((RwV3d*)&propellerWorld) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
|
CVisibilityPlugins::GetDistanceSquaredFromCamera(&propellerWorld) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
|
||||||
jetDir.z = 0.015f;
|
jetDir.z = 0.015f;
|
||||||
jetDir.x *= 3.5f;
|
jetDir.x *= 3.5f;
|
||||||
jetDir.y *= 3.5f;
|
jetDir.y *= 3.5f;
|
||||||
|
@ -613,7 +613,7 @@ CBoat::ProcessControl(void)
|
||||||
splashDir.z += 0.0003f*m_nDeltaVolumeUnderWater;
|
splashDir.z += 0.0003f*m_nDeltaVolumeUnderWater;
|
||||||
CWaterLevel::GetWaterLevel(splashPos, &waterLevel, true);
|
CWaterLevel::GetWaterLevel(splashPos, &waterLevel, true);
|
||||||
if(splashPos.z-waterLevel < 3.0f &&
|
if(splashPos.z-waterLevel < 3.0f &&
|
||||||
CVisibilityPlugins::GetDistanceSquaredFromCamera((RwV3d*)&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
|
CVisibilityPlugins::GetDistanceSquaredFromCamera(&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
|
||||||
splashPos.z = waterLevel + 0.1f;
|
splashPos.z = waterLevel + 0.1f;
|
||||||
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashPos, 0.75f*splashDir, nil, splashSize+0.1f, splashColor,
|
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashPos, 0.75f*splashDir, nil, splashSize+0.1f, splashColor,
|
||||||
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
|
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
|
||||||
|
@ -670,7 +670,7 @@ CBoat::ProcessControl(void)
|
||||||
splashDir.z += 0.0003f*m_nDeltaVolumeUnderWater;
|
splashDir.z += 0.0003f*m_nDeltaVolumeUnderWater;
|
||||||
CWaterLevel::GetWaterLevel(splashPos, &waterLevel, true);
|
CWaterLevel::GetWaterLevel(splashPos, &waterLevel, true);
|
||||||
if(splashPos.z-waterLevel < 3.0f &&
|
if(splashPos.z-waterLevel < 3.0f &&
|
||||||
CVisibilityPlugins::GetDistanceSquaredFromCamera((RwV3d*)&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
|
CVisibilityPlugins::GetDistanceSquaredFromCamera(&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
|
||||||
splashPos.z = waterLevel + 0.1f;
|
splashPos.z = waterLevel + 0.1f;
|
||||||
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashPos, 0.75f*splashDir, nil, splashSize+0.1f, splashColor,
|
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashPos, 0.75f*splashDir, nil, splashSize+0.1f, splashColor,
|
||||||
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
|
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
|
||||||
|
|
|
@ -220,7 +220,7 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
|
||||||
} else if (veh->IsComponentPresent(CAR_BOOT)) {
|
} else if (veh->IsComponentPresent(CAR_BOOT)) {
|
||||||
veh->GetComponentWorldPosition(CAR_BOOT, componentPos);
|
veh->GetComponentWorldPosition(CAR_BOOT, componentPos);
|
||||||
}
|
}
|
||||||
if (componentPos != nil) {
|
if (componentPos.x != 0.0f) {
|
||||||
int rn = (CGeneral::GetRandomNumber() & 1) + 1;
|
int rn = (CGeneral::GetRandomNumber() & 1) + 1;
|
||||||
for (int i = 0; i < rn; i++)
|
for (int i = 0; i < rn; i++)
|
||||||
CParticle::AddJetExplosion(componentPos, (CGeneral::GetRandomNumber() & 7) / 7.0f + 1.5f, 0.5f);
|
CParticle::AddJetExplosion(componentPos, (CGeneral::GetRandomNumber() & 7) / 7.0f + 1.5f, 0.5f);
|
||||||
|
|
|
@ -506,7 +506,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
||||||
if ( victimPed->bUsesCollision || victimPed->Dead() || victimPed->Driving() )
|
if ( victimPed->bUsesCollision || victimPed->Dead() || victimPed->Driving() )
|
||||||
{
|
{
|
||||||
CVector victimPedPos = victimPed->GetPosition();
|
CVector victimPedPos = victimPed->GetPosition();
|
||||||
if ( SQR(victimPedRadius) > (victimPedPos-(*fireSource)).MagnitudeSqr() )
|
if ( SQR(victimPedRadius) > (victimPedPos-fireSource).MagnitudeSqr() )
|
||||||
{
|
{
|
||||||
CVector collisionDist;
|
CVector collisionDist;
|
||||||
CColModel* victimPedCol = &CTempColModels::ms_colModelPed1;
|
CColModel* victimPedCol = &CTempColModels::ms_colModelPed1;
|
||||||
|
@ -528,9 +528,9 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
|
||||||
CColSphere *sphere = &victimPedCol->spheres[s];
|
CColSphere *sphere = &victimPedCol->spheres[s];
|
||||||
|
|
||||||
if (useLocalPos)
|
if (useLocalPos)
|
||||||
collisionDist = sphere->center - (*fireSource);
|
collisionDist = sphere->center - fireSource;
|
||||||
else
|
else
|
||||||
collisionDist = victimPedPos + sphere->center - (*fireSource);
|
collisionDist = victimPedPos + sphere->center - fireSource;
|
||||||
|
|
||||||
if ( SQR(sphere->radius + info->m_fRadius) > collisionDist.MagnitudeSqr() )
|
if ( SQR(sphere->radius + info->m_fRadius) > collisionDist.MagnitudeSqr() )
|
||||||
{
|
{
|
||||||
|
@ -873,7 +873,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
||||||
CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt;
|
CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt;
|
||||||
if ( threatAttack->IsPed() )
|
if ( threatAttack->IsPed() )
|
||||||
{
|
{
|
||||||
threatAttack->m_pedIK.GetComponentPosition(*(RwV3d *)&target, PED_MID);
|
threatAttack->m_pedIK.GetComponentPosition(target, PED_MID);
|
||||||
threatAttack->ReactToPointGun(shooter);
|
threatAttack->ReactToPointGun(shooter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1703,7 +1703,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
||||||
{
|
{
|
||||||
CVector pos;
|
CVector pos;
|
||||||
if (shooterPed->m_pPointGunAt->IsPed()) {
|
if (shooterPed->m_pPointGunAt->IsPed()) {
|
||||||
((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition(*(RwV3d *)&pos, PED_MID);
|
((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition(pos, PED_MID);
|
||||||
} else {
|
} else {
|
||||||
pos = ((CPed*)shooterPed->m_pPointGunAt)->GetPosition();
|
pos = ((CPed*)shooterPed->m_pPointGunAt)->GetPosition();
|
||||||
}
|
}
|
||||||
|
@ -2167,7 +2167,7 @@ CWeapon::LaserScopeDot(CVector *pOutPos, float *pOutSize)
|
||||||
CVector pos = foundCol.point;
|
CVector pos = foundCol.point;
|
||||||
float w, h;
|
float w, h;
|
||||||
|
|
||||||
if ( CSprite::CalcScreenCoors(foundCol.point, pos, &w, &h, true) )
|
if ( CSprite::CalcScreenCoors(foundCol.point, &pos, &w, &h, true) )
|
||||||
{
|
{
|
||||||
*pOutPos = pos;
|
*pOutPos = pos;
|
||||||
*pOutSize = w * 0.05f;
|
*pOutSize = w * 0.05f;
|
||||||
|
@ -2262,7 +2262,7 @@ CWeapon::TakePhotograph(CEntity *shooter)
|
||||||
CVector pos;
|
CVector pos;
|
||||||
float w, h;
|
float w, h;
|
||||||
|
|
||||||
if ( CSprite::CalcScreenCoors(pedPos, pos, &w, &h, false) )
|
if ( CSprite::CalcScreenCoors(pedPos, &pos, &w, &h, false) )
|
||||||
{
|
{
|
||||||
if ( SCREEN_WIDTH * 0.1f < pos.x && SCREEN_WIDTH * 0.9f > pos.x
|
if ( SCREEN_WIDTH * 0.1f < pos.x && SCREEN_WIDTH * 0.9f > pos.x
|
||||||
&& SCREEN_HEIGHT * 0.1f < pos.y && SCREEN_HEIGHT * 0.9f > pos.y )
|
&& SCREEN_HEIGHT * 0.1f < pos.y && SCREEN_HEIGHT * 0.9f > pos.y )
|
||||||
|
|
Loading…
Reference in a new issue