Cleanup
This commit is contained in:
parent
af5bd951ae
commit
458fc63f01
@ -185,7 +185,7 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
|||||||
if(blendAmount <= 0.0f && blendDelta < 0.0f){
|
if(blendAmount <= 0.0f && blendDelta < 0.0f){
|
||||||
// We're faded out and are not fading in
|
// We're faded out and are not fading in
|
||||||
blendAmount = 0.0f;
|
blendAmount = 0.0f;
|
||||||
blendDelta = Max(0.0, blendDelta);
|
blendDelta = max(0.0, blendDelta);
|
||||||
if(flags & ASSOC_DELETEFADEDOUT){
|
if(flags & ASSOC_DELETEFADEDOUT){
|
||||||
if(callbackType == CB_FINISH || callbackType == CB_DELETE)
|
if(callbackType == CB_FINISH || callbackType == CB_DELETE)
|
||||||
callback(this, callbackArg);
|
callback(this, callbackArg);
|
||||||
@ -197,7 +197,7 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
|||||||
if(blendAmount > 1.0f){
|
if(blendAmount > 1.0f){
|
||||||
// Maximally faded in, clamp values
|
// Maximally faded in, clamp values
|
||||||
blendAmount = 1.0f;
|
blendAmount = 1.0f;
|
||||||
blendDelta = Min(0.0, blendDelta);
|
blendDelta = min(0.0, blendDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,7 +36,7 @@ CAnimBlendHierarchy::CalcTotalTime(void)
|
|||||||
float seqTime = 0.0f;
|
float seqTime = 0.0f;
|
||||||
for(j = 0; j < sequences[i].numFrames; j++)
|
for(j = 0; j < sequences[i].numFrames; j++)
|
||||||
seqTime += sequences[i].GetKeyFrame(j)->deltaTime;
|
seqTime += sequences[i].GetKeyFrame(j)->deltaTime;
|
||||||
totalTime = Max(totalTime, seqTime);
|
totalTime = max(totalTime, seqTime);
|
||||||
}
|
}
|
||||||
totalLength = totalTime;
|
totalLength = totalTime;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -72,6 +72,7 @@ enum eAudioType : int32 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class CPhysical;
|
class CPhysical;
|
||||||
|
class CAutomobile;
|
||||||
|
|
||||||
class tAudioEntity
|
class tAudioEntity
|
||||||
{
|
{
|
||||||
@ -112,7 +113,7 @@ public:
|
|||||||
uint8 activeBank;
|
uint8 activeBank;
|
||||||
uint8 gap_1163[1];
|
uint8 gap_1163[1];
|
||||||
|
|
||||||
void Add(tPedComment *com); // test
|
void Add(tPedComment *com); /// ok
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(cPedComments) == 1164, "cPedComments: error");
|
static_assert(sizeof(cPedComments) == 1164, "cPedComments: error");
|
||||||
@ -191,8 +192,7 @@ public:
|
|||||||
|
|
||||||
static_assert(sizeof(cAudioScriptObject) == 20, "cAudioScriptObject: error");
|
static_assert(sizeof(cAudioScriptObject) == 20, "cAudioScriptObject: error");
|
||||||
|
|
||||||
enum
|
enum {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
REFLECTION_YMAX = 0, top
|
REFLECTION_YMAX = 0, top
|
||||||
REFLECTION_YMIN = 1, bottom
|
REFLECTION_YMIN = 1, bottom
|
||||||
@ -209,6 +209,7 @@ enum
|
|||||||
MAX_REFLECTIONS,
|
MAX_REFLECTIONS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
enum AudioEntityHandle
|
enum AudioEntityHandle
|
||||||
{
|
{
|
||||||
AEHANDLE_NONE = -5,
|
AEHANDLE_NONE = -5,
|
||||||
@ -222,6 +223,8 @@ enum AudioEntityHandle
|
|||||||
#define AEHANDLE_IS_OK(h) ((h)>=0)
|
#define AEHANDLE_IS_OK(h) ((h)>=0)
|
||||||
|
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> Cleanup
|
||||||
class cAudioManager
|
class cAudioManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -270,10 +273,15 @@ public:
|
|||||||
uint8 m_bPreviousUserPause;
|
uint8 m_bPreviousUserPause;
|
||||||
uint8 field_19195;
|
uint8 field_19195;
|
||||||
uint32 m_FrameCounter;
|
uint32 m_FrameCounter;
|
||||||
|
|
||||||
inline uint32 GetFrameCounter(void) { return m_FrameCounter; }
|
inline uint32 GetFrameCounter(void) { return m_FrameCounter; }
|
||||||
float GetReflectionsDistance(int32 idx) { return m_afReflectionsDistances[idx]; }
|
float GetReflectionsDistance(int32 idx) { return m_afReflectionsDistances[idx]; }
|
||||||
|
<<<<<<< HEAD
|
||||||
int32 GetRandomNumber(int32 idx) { return m_anRandomTable[idx]; }
|
int32 GetRandomNumber(int32 idx) { return m_anRandomTable[idx]; }
|
||||||
|
=======
|
||||||
|
int32 GetRandomTabe(int32 idx) { return m_anRandomTable[idx]; }
|
||||||
|
|
||||||
|
>>>>>>> Cleanup
|
||||||
//
|
//
|
||||||
|
|
||||||
void AddDetailsToRequestedOrderList(uint8 sample); /// ok
|
void AddDetailsToRequestedOrderList(uint8 sample); /// ok
|
||||||
@ -283,7 +291,7 @@ public:
|
|||||||
void AddReleasingSounds(); // todo (difficult)
|
void AddReleasingSounds(); // todo (difficult)
|
||||||
void AddSampleToRequestedQueue(); /// ok
|
void AddSampleToRequestedQueue(); /// ok
|
||||||
void AgeCrimes(); // todo
|
void AgeCrimes(); // todo
|
||||||
int8 GetCurrent3DProviderIndex(); /// ok
|
int8 GetCurrent3DProviderIndex(); /// ok
|
||||||
|
|
||||||
void CalculateDistance(bool *ptr, float dist); /// ok
|
void CalculateDistance(bool *ptr, float dist); /// ok
|
||||||
bool CheckForAnAudioFileOnCD(); /// ok
|
bool CheckForAnAudioFileOnCD(); /// ok
|
||||||
@ -461,55 +469,58 @@ public:
|
|||||||
uint32 GetGenericMaleTalkSfx(int16 sound);
|
uint32 GetGenericMaleTalkSfx(int16 sound);
|
||||||
uint32 GetGenericFemaleTalkSfx(int16 sound);
|
uint32 GetGenericFemaleTalkSfx(int16 sound);
|
||||||
|
|
||||||
|
void PlayOneShot(int32 index, int16 sound, float vol); // todo
|
||||||
|
|
||||||
void ProcessActiveQueues(); // todo
|
void ProcessActiveQueues(); // todo
|
||||||
bool ProcessAirBrakes(cVehicleParams *params); /// ok
|
bool ProcessAirBrakes(cVehicleParams *params); /// ok
|
||||||
void ProcessAirportScriptObject(uint8 sound); /// ok
|
void ProcessAirportScriptObject(uint8 sound); /// ok
|
||||||
bool ProcessBoatEngine(cVehicleParams *params); // todo requires CBoat
|
bool ProcessBoatEngine(cVehicleParams *params); /// ok
|
||||||
bool ProcessBoatMovingOverWater(cVehicleParams *params); // todo requires CBoat
|
bool ProcessBoatMovingOverWater(cVehicleParams *params); /// ok
|
||||||
void ProcessBridge(); // todo requires CBridge
|
void ProcessBridge(); /// ok
|
||||||
void ProcessBridgeMotor(); /// ok
|
void ProcessBridgeMotor(); /// ok
|
||||||
void ProcessBridgeOneShots(); // todo requires CBridge
|
void ProcessBridgeOneShots(); /// ok
|
||||||
void ProcessBridgeWarning(); /// ok
|
void ProcessBridgeWarning(); /// ok
|
||||||
bool ProcessCarBombTick(void *); // todo requires CVehicle
|
bool ProcessCarBombTick(cVehicleParams *params); /// ok
|
||||||
void ProcessCesna(void *); // todo requires CPlane
|
void ProcessCesna(void *); // todo requires CPlane
|
||||||
void ProcessCinemaScriptObject(uint8 sound); /// ok
|
void ProcessCinemaScriptObject(uint8 sound); /// ok
|
||||||
void ProcessCrane(); // todo requires CCrane
|
void ProcessCrane(); // todo requires CCrane
|
||||||
void ProcessDocksScriptObject(uint8 sound); /// ok
|
void ProcessDocksScriptObject(uint8 sound); /// ok
|
||||||
// bool ProcessEngineDamage(void *); //todo requires CVehicle
|
bool ProcessEngineDamage(cVehicleParams *params); /// ok
|
||||||
void ProcessEntity(int32 sound); /// ok
|
void ProcessEntity(int32 sound); /// ok
|
||||||
void ProcessExplosions(int32 explosion); // test
|
void ProcessExplosions(int32 explosion); /// ok
|
||||||
void ProcessFireHydrant(); /// ok
|
void ProcessFireHydrant(); /// ok
|
||||||
void ProcessFires(int32 entity); // todo requires gFireManager
|
void ProcessFires(int32 entity); // todo requires gFireManager
|
||||||
void ProcessFrontEnd(); /// ok
|
void ProcessFrontEnd(); /// ok
|
||||||
void ProcessGarages(); // todo requires CGarages::aGarages
|
void ProcessGarages(); // todo requires CGarages::aGarages
|
||||||
// bool ProcessHelicopter(void *); // todo requires CVehicle
|
bool ProcessHelicopter(cVehicleParams *params); /// ok
|
||||||
void ProcessHomeScriptObject(uint8 sound); /// ok
|
void ProcessHomeScriptObject(uint8 sound); /// ok
|
||||||
void ProcessJumbo(cVehicleParams *); /// ok
|
void ProcessJumbo(cVehicleParams *); /// ok
|
||||||
void ProcessJumboAccel(CPlane *plane); /// ok
|
void ProcessJumboAccel(CPlane *plane); /// ok
|
||||||
void ProcessJumboDecel(CPlane *plane); /// ok
|
void ProcessJumboDecel(CPlane *plane); /// ok
|
||||||
void ProcessJumboFlying(); /// ok
|
void ProcessJumboFlying(); /// ok
|
||||||
void ProcessJumboLanding(CPlane *plane); /// ok
|
void ProcessJumboLanding(CPlane *plane); /// ok
|
||||||
void ProcessJumboTakeOff(CPlane *plane); /// ok
|
void ProcessJumboTakeOff(CPlane *plane); /// ok
|
||||||
void ProcessJumboTaxi(); /// ok
|
void ProcessJumboTaxi(); /// ok
|
||||||
void ProcessLaunderetteScriptObject(uint8 sound); /// ok
|
void ProcessLaunderetteScriptObject(uint8 sound); /// ok
|
||||||
void ProcessLoopingScriptObject(uint8 sound); /// ok
|
void ProcessLoopingScriptObject(uint8 sound); /// ok
|
||||||
// void ProcessMissionAudio();
|
// void ProcessMissionAudio();
|
||||||
// void ProcessModelVehicle(void *);
|
void ProcessModelCarEngine(cVehicleParams *params); /// (check float comparisons)
|
||||||
void ProcessOneShotScriptObject(uint8 sound); // test
|
void ProcessOneShotScriptObject(uint8 sound); /// ok
|
||||||
void ProcessPed(CPhysical *ped); // test
|
void ProcessPed(CPhysical *ped); /// ok
|
||||||
void ProcessPedHeadphones(cPedParams *params); // test
|
void ProcessPedHeadphones(cPedParams *params); /// ok
|
||||||
void ProcessPedOneShots(cPedParams *params); // test, remove goto
|
void ProcessPedOneShots(cPedParams *params); /// ok
|
||||||
void ProcessPhysical(int32 id); /// ok
|
void ProcessPhysical(int32 id); /// ok
|
||||||
void ProcessPlane(void *); // todo
|
void ProcessPlane(cVehicleParams *params); /// ok
|
||||||
// void ProcessPlayersVehicleEngine(void *, void *);
|
void ProcessPlayersVehicleEngine(cVehicleParams *params,
|
||||||
void ProcessPoliceCellBeatingScriptObject(uint8 sound); // todo
|
CAutomobile *automobile); /// ok (check float comparisons)
|
||||||
void ProcessPornCinema(uint8 sound); /// ok
|
void ProcessPoliceCellBeatingScriptObject(uint8 sound); // todo
|
||||||
void ProcessProjectiles(); // todo
|
void ProcessPornCinema(uint8 sound); /// ok
|
||||||
// void ProcessRainOnVehicle(void *);
|
void ProcessProjectiles(); // todo requires CProjectileInfo
|
||||||
|
void ProcessRainOnVehicle(cVehicleParams *params); /// ok
|
||||||
// void ProcessReverb();
|
// void ProcessReverb();
|
||||||
// bool ProcessReverseGear(void *);
|
// bool ProcessReverseGear(void *);
|
||||||
void ProcessSawMillScriptObject(uint8 sound); /// ok
|
void ProcessSawMillScriptObject(uint8 sound); /// ok
|
||||||
void ProcessScriptObject(int32 id); // test
|
void ProcessScriptObject(int32 id); /// ok
|
||||||
void ProcessShopScriptObject(uint8 sound); /// ok
|
void ProcessShopScriptObject(uint8 sound); /// ok
|
||||||
void ProcessSpecial(); /// ok
|
void ProcessSpecial(); /// ok
|
||||||
// bool ProcessTrainNoise(void *);
|
// bool ProcessTrainNoise(void *);
|
||||||
@ -527,7 +538,7 @@ public:
|
|||||||
// bool ProcessWetRoadNoise(void *);
|
// bool ProcessWetRoadNoise(void *);
|
||||||
void ProcessWorkShopScriptObject(uint8 sound); /// ok
|
void ProcessWorkShopScriptObject(uint8 sound); /// ok
|
||||||
|
|
||||||
void SetupPedComments(cPedParams *params, uint32 sound); // todo hook
|
void SetupPedComments(cPedParams *params, uint32 sound); /// ok
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
cDMAudio &DMAudio = *(cDMAudio*)0x95CDBE;
|
cDMAudio &DMAudio = *(cDMAudio*)0x95CDBE;
|
||||||
|
|
||||||
|
#define AEHANDLE_IS_FAILED(h) ((h)<0)
|
||||||
|
#define AEHANDLE_IS_OK(h) ((h)>=0)
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::Initialise(void)
|
cDMAudio::Initialise(void)
|
||||||
|
@ -1,27 +1,24 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
|
||||||
|
enum bridgeStates {
|
||||||
|
STATE_BRIDGE_LOCKED,
|
||||||
|
STATE_LIFT_PART_IS_UP,
|
||||||
|
STATE_LIFT_PART_MOVING_DOWN,
|
||||||
|
STATE_LIFT_PART_IS_DOWN,
|
||||||
|
STATE_LIFT_PART_ABOUT_TO_MOVE_UP,
|
||||||
|
STATE_LIFT_PART_MOVING_UP
|
||||||
|
};
|
||||||
|
|
||||||
class CBridge
|
class CBridge
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
enum bridgeStates
|
|
||||||
{
|
|
||||||
STATE_BRIDGE_LOCKED,
|
|
||||||
STATE_LIFT_PART_IS_UP,
|
|
||||||
STATE_LIFT_PART_MOVING_DOWN,
|
|
||||||
STATE_LIFT_PART_IS_DOWN,
|
|
||||||
STATE_LIFT_PART_ABOUT_TO_MOVE_UP,
|
|
||||||
STATE_LIFT_PART_MOVING_UP
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static CEntity *&pLiftRoad, *&pLiftPart, *&pWeight;
|
static CEntity *&pLiftRoad, *&pLiftPart, *&pWeight;
|
||||||
static int &State, &OldState;
|
static int &State, &OldState;
|
||||||
static float &DefaultZLiftPart, &DefaultZLiftRoad, &DefaultZLiftWeight;
|
static float &DefaultZLiftPart, &DefaultZLiftRoad, &DefaultZLiftWeight;
|
||||||
static float& OldLift;
|
static float &OldLift;
|
||||||
static uint32& TimeOfBridgeBecomingOperational;
|
static uint32 &TimeOfBridgeBecomingOperational;
|
||||||
|
|
||||||
public:
|
|
||||||
static void Init();
|
static void Init();
|
||||||
static void Update();
|
static void Update();
|
||||||
static bool ShouldLightsBeFlashing();
|
static bool ShouldLightsBeFlashing();
|
||||||
|
@ -207,8 +207,8 @@ CPathFind::PreparePathData(void)
|
|||||||
numExtern++;
|
numExtern++;
|
||||||
if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes)
|
if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes)
|
||||||
numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
|
numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
|
||||||
maxX = Max(maxX, Abs(InfoForTileCars[k].x));
|
maxX = max(maxX, Abs(InfoForTileCars[k].x));
|
||||||
maxY = Max(maxY, Abs(InfoForTileCars[k].y));
|
maxY = max(maxY, Abs(InfoForTileCars[k].y));
|
||||||
}else if(InfoForTileCars[k].type == NodeTypeIntern)
|
}else if(InfoForTileCars[k].type == NodeTypeIntern)
|
||||||
numIntern++;
|
numIntern++;
|
||||||
}
|
}
|
||||||
@ -392,7 +392,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
|||||||
if(Abs(dx) < nearestDist){
|
if(Abs(dx) < nearestDist){
|
||||||
dy = tempnodes[k].pos.y - CoorsXFormed.y;
|
dy = tempnodes[k].pos.y - CoorsXFormed.y;
|
||||||
if(Abs(dy) < nearestDist){
|
if(Abs(dy) < nearestDist){
|
||||||
nearestDist = Max(Abs(dx), Abs(dy));
|
nearestDist = max(Abs(dx), Abs(dy));
|
||||||
nearestId = k;
|
nearestId = k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -501,13 +501,13 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
|||||||
|
|
||||||
// Find i inside path segment
|
// Find i inside path segment
|
||||||
iseg = 0;
|
iseg = 0;
|
||||||
for(j = Max(oldNumPathNodes, i-12); j < i; j++)
|
for(j = max(oldNumPathNodes, i-12); j < i; j++)
|
||||||
if(m_pathNodes[j].objectIndex == m_pathNodes[i].objectIndex)
|
if(m_pathNodes[j].objectIndex == m_pathNodes[i].objectIndex)
|
||||||
iseg++;
|
iseg++;
|
||||||
|
|
||||||
istart = 12*m_mapObjects[m_pathNodes[i].objectIndex]->m_modelIndex;
|
istart = 12*m_mapObjects[m_pathNodes[i].objectIndex]->m_modelIndex;
|
||||||
// Add links to other internal nodes
|
// Add links to other internal nodes
|
||||||
for(j = Max(oldNumPathNodes, i-12); j < Min(m_numPathNodes, i+12); j++){
|
for(j = max(oldNumPathNodes, i-12); j < min(m_numPathNodes, i+12); j++){
|
||||||
if(m_pathNodes[i].objectIndex != m_pathNodes[j].objectIndex || i == j)
|
if(m_pathNodes[i].objectIndex != m_pathNodes[j].objectIndex || i == j)
|
||||||
continue;
|
continue;
|
||||||
// N.B.: in every path segment, the externals have to be at the end
|
// N.B.: in every path segment, the externals have to be at the end
|
||||||
|
@ -366,8 +366,8 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
CAnimBlendAssociation* main = RpAnimBlendClumpGetMainAssociation((RpClump*)ped->m_rwObject, &second, &blend_amount);
|
CAnimBlendAssociation* main = RpAnimBlendClumpGetMainAssociation((RpClump*)ped->m_rwObject, &second, &blend_amount);
|
||||||
if (main){
|
if (main){
|
||||||
state->animId = main->animId;
|
state->animId = main->animId;
|
||||||
state->time = 255.0f / 4.0f * Max(0.0f, Min(4.0f, main->currentTime));
|
state->time = 255.0f / 4.0f * max(0.0f, min(4.0f, main->currentTime));
|
||||||
state->speed = 255.0f / 3.0f * Max(0.0f, Min(3.0f, main->speed));
|
state->speed = 255.0f / 3.0f * max(0.0f, min(3.0f, main->speed));
|
||||||
}else{
|
}else{
|
||||||
state->animId = 3;
|
state->animId = 3;
|
||||||
state->time = 0;
|
state->time = 0;
|
||||||
@ -375,9 +375,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
}
|
}
|
||||||
if (second) {
|
if (second) {
|
||||||
state->secAnimId = second->animId;
|
state->secAnimId = second->animId;
|
||||||
state->secTime = 255.0f / 4.0f * Max(0.0f, Min(4.0f, second->currentTime));
|
state->secTime = 255.0f / 4.0f * max(0.0f, min(4.0f, second->currentTime));
|
||||||
state->secSpeed = 255.0f / 3.0f * Max(0.0f, Min(3.0f, second->speed));
|
state->secSpeed = 255.0f / 3.0f * max(0.0f, min(3.0f, second->speed));
|
||||||
state->blendAmount = 255.0f / 2.0f * Max(0.0f, Min(2.0f, blend_amount));
|
state->blendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, blend_amount));
|
||||||
}else{
|
}else{
|
||||||
state->secAnimId = 0;
|
state->secAnimId = 0;
|
||||||
state->secTime = 0;
|
state->secTime = 0;
|
||||||
@ -387,9 +387,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
|
CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
|
||||||
if (partial) {
|
if (partial) {
|
||||||
state->partAnimId = partial->animId;
|
state->partAnimId = partial->animId;
|
||||||
state->partAnimTime = 255.0f / 4.0f * Max(0.0f, Min(4.0f, partial->currentTime));
|
state->partAnimTime = 255.0f / 4.0f * max(0.0f, min(4.0f, partial->currentTime));
|
||||||
state->partAnimSpeed = 255.0f / 3.0f * Max(0.0f, Min(3.0f, partial->speed));
|
state->partAnimSpeed = 255.0f / 3.0f * max(0.0f, min(3.0f, partial->speed));
|
||||||
state->partBlendAmount = 255.0f / 2.0f * Max(0.0f, Min(2.0f, partial->blendAmount));
|
state->partBlendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, partial->blendAmount));
|
||||||
}else{
|
}else{
|
||||||
state->partAnimId = 0;
|
state->partAnimId = 0;
|
||||||
state->partAnimTime = 0;
|
state->partAnimTime = 0;
|
||||||
@ -408,9 +408,9 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||||||
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainAssociation_N((RpClump*)ped->m_rwObject, i);
|
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainAssociation_N((RpClump*)ped->m_rwObject, i);
|
||||||
if (assoc){
|
if (assoc){
|
||||||
state->aAnimId[i] = assoc->animId;
|
state->aAnimId[i] = assoc->animId;
|
||||||
state->aCurTime[i] = 255.0f / 4.0f * Max(0.0f, Min(4.0f, assoc->currentTime));
|
state->aCurTime[i] = 255.0f / 4.0f * max(0.0f, min(4.0f, assoc->currentTime));
|
||||||
state->aSpeed[i] = 255.0f / 3.0f * Max(0.0f, Min(3.0f, assoc->speed));
|
state->aSpeed[i] = 255.0f / 3.0f * max(0.0f, min(3.0f, assoc->speed));
|
||||||
state->aBlendAmount[i] = 255.0f / 2.0f * Max(0.0f, Min(2.0f, assoc->blendAmount));
|
state->aBlendAmount[i] = 255.0f / 2.0f * max(0.0f, min(2.0f, assoc->blendAmount));
|
||||||
state->aFlags[i] = assoc->flags;
|
state->aFlags[i] = assoc->flags;
|
||||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||||
state->aFunctionCallbackID[i] = FindCBFunctionID(assoc->callback);
|
state->aFunctionCallbackID[i] = FindCBFunctionID(assoc->callback);
|
||||||
@ -431,9 +431,9 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||||||
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainPartialAssociation_N((RpClump*)ped->m_rwObject, i);
|
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainPartialAssociation_N((RpClump*)ped->m_rwObject, i);
|
||||||
if (assoc) {
|
if (assoc) {
|
||||||
state->aAnimId2[i] = assoc->animId;
|
state->aAnimId2[i] = assoc->animId;
|
||||||
state->aCurTime2[i] = 255.0f / 4.0f * Max(0.0f, Min(4.0f, assoc->currentTime));
|
state->aCurTime2[i] = 255.0f / 4.0f * max(0.0f, min(4.0f, assoc->currentTime));
|
||||||
state->aSpeed2[i] = 255.0f / 3.0f * Max(0.0f, Min(3.0f, assoc->speed));
|
state->aSpeed2[i] = 255.0f / 3.0f * max(0.0f, min(3.0f, assoc->speed));
|
||||||
state->aBlendAmount2[i] = 255.0f / 2.0f * Max(0.0f, Min(2.0f, assoc->blendAmount));
|
state->aBlendAmount2[i] = 255.0f / 2.0f * max(0.0f, min(2.0f, assoc->blendAmount));
|
||||||
state->aFlags2[i] = assoc->flags;
|
state->aFlags2[i] = assoc->flags;
|
||||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||||
state->aFunctionCallbackID2[i] = FindCBFunctionID(assoc->callback);
|
state->aFunctionCallbackID2[i] = FindCBFunctionID(assoc->callback);
|
||||||
@ -625,9 +625,9 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
|||||||
vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */
|
vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */
|
||||||
vp->acceleration = vehicle->m_fGasPedal * 100.0f;
|
vp->acceleration = vehicle->m_fGasPedal * 100.0f;
|
||||||
vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->Damage.m_panelStatus : 0;
|
vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->Damage.m_panelStatus : 0;
|
||||||
vp->velocityX = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().x)); /* 8000!? */
|
vp->velocityX = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().x)); /* 8000!? */
|
||||||
vp->velocityY = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().y));
|
vp->velocityY = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().y));
|
||||||
vp->velocityZ = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().z));
|
vp->velocityZ = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().z));
|
||||||
vp->mi = vehicle->GetModelIndex();
|
vp->mi = vehicle->GetModelIndex();
|
||||||
vp->primary_color = vehicle->m_currentColour1;
|
vp->primary_color = vehicle->m_currentColour1;
|
||||||
vp->secondary_color = vehicle->m_currentColour2;
|
vp->secondary_color = vehicle->m_currentColour2;
|
||||||
@ -1501,9 +1501,9 @@ void CReplay::ProcessLookAroundCam(void)
|
|||||||
--FramesActiveLookAroundCam;
|
--FramesActiveLookAroundCam;
|
||||||
fBetaAngleLookAroundCam += x_moved;
|
fBetaAngleLookAroundCam += x_moved;
|
||||||
if (CPad::NewMouseControllerState.LMB && CPad::NewMouseControllerState.RMB)
|
if (CPad::NewMouseControllerState.LMB && CPad::NewMouseControllerState.RMB)
|
||||||
fDistanceLookAroundCam = Max(3.0f, Min(15.0f, fDistanceLookAroundCam + 2.0f * y_moved));
|
fDistanceLookAroundCam = max(3.0f, min(15.0f, fDistanceLookAroundCam + 2.0f * y_moved));
|
||||||
else
|
else
|
||||||
fAlphaAngleLookAroundCam = Max(0.1f, Min(1.5f, fAlphaAngleLookAroundCam + y_moved));
|
fAlphaAngleLookAroundCam = max(0.1f, min(1.5f, fAlphaAngleLookAroundCam + y_moved));
|
||||||
CVector camera_pt(
|
CVector camera_pt(
|
||||||
fDistanceLookAroundCam * Sin(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
fDistanceLookAroundCam * Sin(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
||||||
fDistanceLookAroundCam * Cos(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
fDistanceLookAroundCam * Cos(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
||||||
|
@ -1987,7 +1987,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
|
|||||||
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
||||||
car->m_status = STATUS_PHYSICS;
|
car->m_status = STATUS_PHYSICS;
|
||||||
car->bEngineOn = true;
|
car->bEngineOn = true;
|
||||||
car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
|
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
|
||||||
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1999,7 +1999,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
|
|||||||
CCarCtrl::JoinCarWithRoadSystem(car);
|
CCarCtrl::JoinCarWithRoadSystem(car);
|
||||||
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||||
car->bEngineOn = true;
|
car->bEngineOn = true;
|
||||||
car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
|
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
|
||||||
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2083,7 +2083,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
|
|||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||||
assert(car);
|
assert(car);
|
||||||
car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
|
car->AutoPilot.m_nCruiseSpeed = min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CAR_DRIVING_STYLE:
|
case COMMAND_SET_CAR_DRIVING_STYLE:
|
||||||
|
@ -209,7 +209,7 @@ WellBufferMe(float Target, float *CurrentValue, float *CurrentSpeed, float MaxSp
|
|||||||
else if(TargetSpeed > 0.0f && *CurrentSpeed > TargetSpeed)
|
else if(TargetSpeed > 0.0f && *CurrentSpeed > TargetSpeed)
|
||||||
*CurrentSpeed = TargetSpeed;
|
*CurrentSpeed = TargetSpeed;
|
||||||
|
|
||||||
*CurrentValue += *CurrentSpeed * Min(10.0f, CTimer::GetTimeStep());
|
*CurrentValue += *CurrentSpeed * min(10.0f, CTimer::GetTimeStep());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -697,7 +697,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
|
|||||||
// Process height offset to avoid peds and cars
|
// Process height offset to avoid peds and cars
|
||||||
|
|
||||||
float TargetZOffSet = m_fUnknownZOffSet + m_fDimensionOfHighestNearCar;
|
float TargetZOffSet = m_fUnknownZOffSet + m_fDimensionOfHighestNearCar;
|
||||||
TargetZOffSet = Max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
|
TargetZOffSet = max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
|
||||||
float TargetHeight = CameraTarget.z + TargetZOffSet - Source.z;
|
float TargetHeight = CameraTarget.z + TargetZOffSet - Source.z;
|
||||||
|
|
||||||
if(TargetHeight > m_fCamBufferedHeight){
|
if(TargetHeight > m_fCamBufferedHeight){
|
||||||
@ -753,7 +753,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetCoors.z += Min(1.0f, m_fCamBufferedHeight/2.0f);
|
TargetCoors.z += min(1.0f, m_fCamBufferedHeight/2.0f);
|
||||||
m_cvecTargetCoorsForFudgeInter = TargetCoors;
|
m_cvecTargetCoorsForFudgeInter = TargetCoors;
|
||||||
|
|
||||||
Front = TargetCoors - Source;
|
Front = TargetCoors - Source;
|
||||||
@ -991,7 +991,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
|
|||||||
}
|
}
|
||||||
if(FoundCamRoof){
|
if(FoundCamRoof){
|
||||||
// Camera is under something
|
// Camera is under something
|
||||||
float roof = FoundRoofCenter ? Min(CamRoof, CarRoof) : CamRoof;
|
float roof = FoundRoofCenter ? min(CamRoof, CarRoof) : CamRoof;
|
||||||
// Same weirdness again?
|
// Same weirdness again?
|
||||||
TargetAlpha = CGeneral::GetATanOfXY(CA_MAX_DISTANCE, roof - CamTargetZ - 1.5f);
|
TargetAlpha = CGeneral::GetATanOfXY(CA_MAX_DISTANCE, roof - CamTargetZ - 1.5f);
|
||||||
CamClear = false;
|
CamClear = false;
|
||||||
@ -1249,7 +1249,7 @@ void
|
|||||||
CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
|
CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
|
||||||
{
|
{
|
||||||
CA_MAX_DISTANCE = BaseDist + 0.1f + TheCamera.CarZoomValueSmooth;
|
CA_MAX_DISTANCE = BaseDist + 0.1f + TheCamera.CarZoomValueSmooth;
|
||||||
CA_MIN_DISTANCE = Min(BaseDist*0.6f, 3.5f);
|
CA_MIN_DISTANCE = min(BaseDist*0.6f, 3.5f);
|
||||||
|
|
||||||
CVector Dist = Source - TargetCoors;
|
CVector Dist = Source - TargetCoors;
|
||||||
|
|
||||||
|
@ -153,10 +153,10 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
|
|||||||
// on water we expect to be between levels
|
// on water we expect to be between levels
|
||||||
multipleLevels = true;
|
multipleLevels = true;
|
||||||
}else{
|
}else{
|
||||||
xmin = Max(sx - 1, 0);
|
xmin = max(sx - 1, 0);
|
||||||
xmax = Min(sx + 1, NUMSECTORS_X-1);
|
xmax = min(sx + 1, NUMSECTORS_X-1);
|
||||||
ymin = Max(sy - 1, 0);
|
ymin = max(sy - 1, 0);
|
||||||
ymax = Min(sy + 1, NUMSECTORS_Y-1);
|
ymax = min(sy + 1, NUMSECTORS_Y-1);
|
||||||
|
|
||||||
for(x = xmin; x <= xmax; x++)
|
for(x = xmin; x <= xmax; x++)
|
||||||
for(y = ymin; y <= ymax; y++){
|
for(y = ymin; y <= ymax; y++){
|
||||||
|
@ -1030,7 +1030,7 @@ int CMenuManager::FadeIn(int alpha)
|
|||||||
m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
|
m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
|
||||||
m_nCurrScreen == MENUPAGE_DELETING)
|
m_nCurrScreen == MENUPAGE_DELETING)
|
||||||
return alpha;
|
return alpha;
|
||||||
return Min(m_nMenuFadeAlpha, alpha);
|
return min(m_nMenuFadeAlpha, alpha);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -299,10 +299,10 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
|
|||||||
{ if ( State1.button || State2.button ) ReconState.button = 255; }
|
{ if ( State1.button || State2.button ) ReconState.button = 255; }
|
||||||
|
|
||||||
#define _RECONCILE_AXIS_POSITIVE(axis) \
|
#define _RECONCILE_AXIS_POSITIVE(axis) \
|
||||||
{ if ( State1.axis >= 0 && State2.axis >= 0 ) ReconState.axis = Max(State1.axis, State2.axis); }
|
{ if ( State1.axis >= 0 && State2.axis >= 0 ) ReconState.axis = max(State1.axis, State2.axis); }
|
||||||
|
|
||||||
#define _RECONCILE_AXIS_NEGATIVE(axis) \
|
#define _RECONCILE_AXIS_NEGATIVE(axis) \
|
||||||
{ if ( State1.axis <= 0 && State2.axis <= 0 ) ReconState.axis = Min(State1.axis, State2.axis); }
|
{ if ( State1.axis <= 0 && State2.axis <= 0 ) ReconState.axis = min(State1.axis, State2.axis); }
|
||||||
|
|
||||||
#define _RECONCILE_AXIS(axis) \
|
#define _RECONCILE_AXIS(axis) \
|
||||||
{ _RECONCILE_AXIS_POSITIVE(axis); _RECONCILE_AXIS_NEGATIVE(axis); }
|
{ _RECONCILE_AXIS_POSITIVE(axis); _RECONCILE_AXIS_NEGATIVE(axis); }
|
||||||
|
@ -1940,7 +1940,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float
|
|||||||
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
|
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
|
||||||
if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())){
|
if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())){
|
||||||
lodDistSq = sq(mi->GetLargestLodDistance());
|
lodDistSq = sq(mi->GetLargestLodDistance());
|
||||||
lodDistSq = Min(lodDistSq, sq(STREAM_DIST));
|
lodDistSq = min(lodDistSq, sq(STREAM_DIST));
|
||||||
pos = CVector2D(e->GetPosition());
|
pos = CVector2D(e->GetPosition());
|
||||||
if(xmin < pos.x && pos.x < xmax &&
|
if(xmin < pos.x && pos.x < xmax &&
|
||||||
ymin < pos.y && pos.y < ymax &&
|
ymin < pos.y && pos.y < ymax &&
|
||||||
@ -2160,20 +2160,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
if(Abs(TheCamera.GetForward().x) > Abs(TheCamera.GetForward().y)){
|
if(Abs(TheCamera.GetForward().x) > Abs(TheCamera.GetForward().y)){
|
||||||
// looking west/east
|
// looking west/east
|
||||||
|
|
||||||
ymin = Max(iy - 10, 0);
|
ymin = max(iy - 10, 0);
|
||||||
ymax = Min(iy + 10, NUMSECTORS_Y);
|
ymax = min(iy + 10, NUMSECTORS_Y);
|
||||||
assert(ymin <= ymax);
|
assert(ymin <= ymax);
|
||||||
|
|
||||||
// Delete a block of sectors that we know is behind the camera
|
// Delete a block of sectors that we know is behind the camera
|
||||||
if(TheCamera.GetForward().x > 0){
|
if(TheCamera.GetForward().x > 0){
|
||||||
// looking east
|
// looking east
|
||||||
xmax = Max(ix - 2, 0);
|
xmax = max(ix - 2, 0);
|
||||||
xmin = Max(ix - 10, 0);
|
xmin = max(ix - 10, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking west
|
// looking west
|
||||||
xmax = Min(ix + 2, NUMSECTORS_X);
|
xmax = min(ix + 2, NUMSECTORS_X);
|
||||||
xmin = Min(ix + 10, NUMSECTORS_X);
|
xmin = min(ix + 10, NUMSECTORS_X);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(y = ymin; y <= ymax; y++){
|
for(y = ymin; y <= ymax; y++){
|
||||||
@ -2189,13 +2189,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
// Now a block that intersects with the camera's frustum
|
// Now a block that intersects with the camera's frustum
|
||||||
if(TheCamera.GetForward().x > 0){
|
if(TheCamera.GetForward().x > 0){
|
||||||
// looking east
|
// looking east
|
||||||
xmax = Max(ix + 10, 0);
|
xmax = max(ix + 10, 0);
|
||||||
xmin = Max(ix - 2, 0);
|
xmin = max(ix - 2, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking west
|
// looking west
|
||||||
xmax = Min(ix - 10, NUMSECTORS_X);
|
xmax = min(ix - 10, NUMSECTORS_X);
|
||||||
xmin = Min(ix + 2, NUMSECTORS_X);
|
xmin = min(ix + 2, NUMSECTORS_X);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(y = ymin; y <= ymax; y++){
|
for(y = ymin; y <= ymax; y++){
|
||||||
@ -2224,20 +2224,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
}else{
|
}else{
|
||||||
// looking north/south
|
// looking north/south
|
||||||
|
|
||||||
xmin = Max(ix - 10, 0);
|
xmin = max(ix - 10, 0);
|
||||||
xmax = Min(ix + 10, NUMSECTORS_X);
|
xmax = min(ix + 10, NUMSECTORS_X);
|
||||||
assert(xmin <= xmax);
|
assert(xmin <= xmax);
|
||||||
|
|
||||||
// Delete a block of sectors that we know is behind the camera
|
// Delete a block of sectors that we know is behind the camera
|
||||||
if(TheCamera.GetForward().y > 0){
|
if(TheCamera.GetForward().y > 0){
|
||||||
// looking north
|
// looking north
|
||||||
ymax = Max(iy - 2, 0);
|
ymax = max(iy - 2, 0);
|
||||||
ymin = Max(iy - 10, 0);
|
ymin = max(iy - 10, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking south
|
// looking south
|
||||||
ymax = Min(iy + 2, NUMSECTORS_Y);
|
ymax = min(iy + 2, NUMSECTORS_Y);
|
||||||
ymin = Min(iy + 10, NUMSECTORS_Y);
|
ymin = min(iy + 10, NUMSECTORS_Y);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(x = xmin; x <= xmax; x++){
|
for(x = xmin; x <= xmax; x++){
|
||||||
@ -2253,13 +2253,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
// Now a block that intersects with the camera's frustum
|
// Now a block that intersects with the camera's frustum
|
||||||
if(TheCamera.GetForward().y > 0){
|
if(TheCamera.GetForward().y > 0){
|
||||||
// looking north
|
// looking north
|
||||||
ymax = Max(iy + 10, 0);
|
ymax = max(iy + 10, 0);
|
||||||
ymin = Max(iy - 2, 0);
|
ymin = max(iy - 2, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking south
|
// looking south
|
||||||
ymax = Min(iy - 10, NUMSECTORS_Y);
|
ymax = min(iy - 10, NUMSECTORS_Y);
|
||||||
ymin = Min(iy + 2, NUMSECTORS_Y);
|
ymin = min(iy + 2, NUMSECTORS_Y);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(x = xmin; x <= xmax; x++){
|
for(x = xmin; x <= xmax; x++){
|
||||||
|
@ -209,7 +209,7 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
|
|||||||
else
|
else
|
||||||
sensitivity = m_fCrimeSensitivity;
|
sensitivity = m_fCrimeSensitivity;
|
||||||
|
|
||||||
wantedLevelDrop = Min(CCullZones::GetWantedLevelDrop(), 100);
|
wantedLevelDrop = min(CCullZones::GetWantedLevelDrop(), 100);
|
||||||
|
|
||||||
chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
|
chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
|
||||||
if (policeDoesntCare)
|
if (policeDoesntCare)
|
||||||
|
@ -453,7 +453,7 @@ DoFade(void)
|
|||||||
CRGBA fadeColor;
|
CRGBA fadeColor;
|
||||||
CRect rect;
|
CRect rect;
|
||||||
int fadeValue = CDraw::FadeValue;
|
int fadeValue = CDraw::FadeValue;
|
||||||
float brightness = Min(CMenuManager::m_PrefsBrightness, 256);
|
float brightness = min(CMenuManager::m_PrefsBrightness, 256);
|
||||||
if(brightness <= 50)
|
if(brightness <= 50)
|
||||||
brightness = 50;
|
brightness = 50;
|
||||||
if(FrontEndMenuManager.m_bMenuActive)
|
if(FrontEndMenuManager.m_bMenuActive)
|
||||||
|
@ -374,32 +374,6 @@ delayedPatches10(int a, int b)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
void __declspec(naked) HeadlightsFix()
|
|
||||||
{
|
|
||||||
static const float fMinusOne = -1.0f;
|
|
||||||
_asm
|
|
||||||
{
|
|
||||||
fld [esp+708h-690h]
|
|
||||||
fcomp fMinusOne
|
|
||||||
fnstsw ax
|
|
||||||
and ah, 5
|
|
||||||
cmp ah, 1
|
|
||||||
jnz HeadlightsFix_DontLimit
|
|
||||||
fld fMinusOne
|
|
||||||
fstp [esp+708h-690h]
|
|
||||||
|
|
||||||
HeadlightsFix_DontLimit:
|
|
||||||
fld [esp+708h-690h]
|
|
||||||
fabs
|
|
||||||
fld st
|
|
||||||
push 0x5382F2
|
|
||||||
retn
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
>>>>>>> More audio ped
|
|
||||||
const int re3_buffsize = 1024;
|
const int re3_buffsize = 1024;
|
||||||
static char re3_buff[re3_buffsize];
|
static char re3_buff[re3_buffsize];
|
||||||
|
|
||||||
|
@ -1,483 +0,0 @@
|
|||||||
#include <direct.h>
|
|
||||||
#include <csignal>
|
|
||||||
#include <windows.h>
|
|
||||||
#include "common.h"
|
|
||||||
#include "patcher.h"
|
|
||||||
#include "Renderer.h"
|
|
||||||
#include "Credits.h"
|
|
||||||
#include "Camera.h"
|
|
||||||
#include "Weather.h"
|
|
||||||
#include "Clock.h"
|
|
||||||
#include "World.h"
|
|
||||||
#include "Vehicle.h"
|
|
||||||
#include "ModelIndices.h"
|
|
||||||
#include "Streaming.h"
|
|
||||||
#include "PathFind.h"
|
|
||||||
#include "Boat.h"
|
|
||||||
#include "Heli.h"
|
|
||||||
#include "Automobile.h"
|
|
||||||
#include "Ped.h"
|
|
||||||
#include "debugmenu_public.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
std::vector<int32> usedAddresses;
|
|
||||||
|
|
||||||
void **rwengine = *(void***)0x5A10E1;
|
|
||||||
|
|
||||||
DebugMenuAPI gDebugMenuAPI;
|
|
||||||
|
|
||||||
WRAPPER void *gtanew(uint32 sz) { EAXJMP(0x5A0690); }
|
|
||||||
WRAPPER void gtadelete(void *p) { EAXJMP(0x5A07E0); }
|
|
||||||
|
|
||||||
// overload our own new/delete with GTA's functions
|
|
||||||
void *operator new(size_t sz) { return gtanew(sz); }
|
|
||||||
void operator delete(void *ptr) noexcept { gtadelete(ptr); }
|
|
||||||
|
|
||||||
#ifdef USE_PS2_RAND
|
|
||||||
unsigned __int64 myrand_seed = 1;
|
|
||||||
#else
|
|
||||||
unsigned long int myrand_seed = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
myrand(void)
|
|
||||||
{
|
|
||||||
#ifdef USE_PS2_RAND
|
|
||||||
// Use our own implementation of rand, stolen from PS2
|
|
||||||
myrand_seed = 0x5851F42D4C957F2D * myrand_seed + 1;
|
|
||||||
return ((myrand_seed >> 32) & 0x7FFFFFFF);
|
|
||||||
#else
|
|
||||||
// or original codewarrior rand
|
|
||||||
myrand_seed = myrand_seed * 1103515245 + 12345;
|
|
||||||
return((myrand_seed >> 16) & 0x7FFF);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
mysrand(unsigned int seed)
|
|
||||||
{
|
|
||||||
myrand_seed = seed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void (*DebugMenuProcess)(void);
|
|
||||||
void (*DebugMenuRender)(void);
|
|
||||||
static void stub(void) { }
|
|
||||||
|
|
||||||
void
|
|
||||||
DebugMenuInit(void)
|
|
||||||
{
|
|
||||||
if(DebugMenuLoad()){
|
|
||||||
DebugMenuProcess = (void(*)(void))GetProcAddress(gDebugMenuAPI.module, "DebugMenuProcess");
|
|
||||||
DebugMenuRender = (void(*)(void))GetProcAddress(gDebugMenuAPI.module, "DebugMenuRender");
|
|
||||||
}
|
|
||||||
if(DebugMenuProcess == nil || DebugMenuRender == nil){
|
|
||||||
DebugMenuProcess = stub;
|
|
||||||
DebugMenuRender = stub;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void WeaponCheat();
|
|
||||||
void HealthCheat();
|
|
||||||
void TankCheat();
|
|
||||||
void BlowUpCarsCheat();
|
|
||||||
void ChangePlayerCheat();
|
|
||||||
void MayhemCheat();
|
|
||||||
void EverybodyAttacksPlayerCheat();
|
|
||||||
void WeaponsForAllCheat();
|
|
||||||
void FastTimeCheat();
|
|
||||||
void SlowTimeCheat();
|
|
||||||
void MoneyCheat();
|
|
||||||
void ArmourCheat();
|
|
||||||
void WantedLevelUpCheat();
|
|
||||||
void WantedLevelDownCheat();
|
|
||||||
void SunnyWeatherCheat();
|
|
||||||
void CloudyWeatherCheat();
|
|
||||||
void RainyWeatherCheat();
|
|
||||||
void FoggyWeatherCheat();
|
|
||||||
void FastWeatherCheat();
|
|
||||||
void OnlyRenderWheelsCheat();
|
|
||||||
void ChittyChittyBangBangCheat();
|
|
||||||
void StrongGripCheat();
|
|
||||||
void NastyLimbsCheat();
|
|
||||||
|
|
||||||
DebugMenuEntry *carCol1;
|
|
||||||
DebugMenuEntry *carCol2;
|
|
||||||
|
|
||||||
void
|
|
||||||
SpawnCar(int id)
|
|
||||||
{
|
|
||||||
CVector playerpos;
|
|
||||||
CStreaming::RequestModel(id, 0);
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
if(CStreaming::HasModelLoaded(id)){
|
|
||||||
playerpos = FindPlayerCoors();
|
|
||||||
int node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false);
|
|
||||||
if(node < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CVehicle *v;
|
|
||||||
if(CModelInfo::IsBoatModel(id))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
v = new CAutomobile(id, RANDOM_VEHICLE);
|
|
||||||
|
|
||||||
v->bHasBeenOwnedByPlayer = true;
|
|
||||||
if(carCol1)
|
|
||||||
DebugMenuEntrySetAddress(carCol1, &v->m_currentColour1);
|
|
||||||
if(carCol2)
|
|
||||||
DebugMenuEntrySetAddress(carCol2, &v->m_currentColour2);
|
|
||||||
|
|
||||||
v->GetPosition() = ThePaths.m_pathNodes[node].pos;
|
|
||||||
v->GetPosition().z += 4.0f;
|
|
||||||
v->SetOrientation(0.0f, 0.0f, 3.49f);
|
|
||||||
v->m_status = STATUS_ABANDONED;
|
|
||||||
v->m_nDoorLock = CARLOCK_UNLOCKED;
|
|
||||||
CWorld::Add(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
LetThemFollowYou(void) {
|
|
||||||
CPed* player = (CPed*) FindPlayerPed();
|
|
||||||
for (int i = 0; i < player->m_numNearPeds; i++) {
|
|
||||||
|
|
||||||
CPed* nearPed = player->m_nearPeds[i];
|
|
||||||
if (nearPed && !nearPed->IsPlayer()) {
|
|
||||||
nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
|
|
||||||
nearPed->m_pedFormation = rand() & 7;
|
|
||||||
nearPed->bScriptObjectiveCompleted = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
FixCar(void)
|
|
||||||
{
|
|
||||||
CVehicle *veh = FindPlayerVehicle();
|
|
||||||
if(veh == nil)
|
|
||||||
return;
|
|
||||||
veh->m_fHealth = 1000.0f;
|
|
||||||
if(!veh->IsCar())
|
|
||||||
return;
|
|
||||||
((CAutomobile*)veh)->Damage.SetEngineStatus(0);
|
|
||||||
((CAutomobile*)veh)->Fix();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int engineStatus;
|
|
||||||
static void
|
|
||||||
SetEngineStatus(void)
|
|
||||||
{
|
|
||||||
CVehicle *veh = FindPlayerVehicle();
|
|
||||||
if(veh == nil)
|
|
||||||
return;
|
|
||||||
if(!veh->IsCar())
|
|
||||||
return;
|
|
||||||
((CAutomobile*)veh)->Damage.SetEngineStatus(engineStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ToggleComedy(void)
|
|
||||||
{
|
|
||||||
CVehicle *veh = FindPlayerVehicle();
|
|
||||||
if(veh == nil)
|
|
||||||
return;
|
|
||||||
veh->bComedyControls = !veh->bComedyControls;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
PlaceOnRoad(void)
|
|
||||||
{
|
|
||||||
CVehicle *veh = FindPlayerVehicle();
|
|
||||||
if(veh == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(veh->IsCar())
|
|
||||||
((CAutomobile*)veh)->PlaceOnRoadProperly();
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *carnames[] = {
|
|
||||||
"landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", "manana", "infernus", "blista", "pony",
|
|
||||||
"mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "kuruma", "bobcat", "mrwhoop", "bfinject", "corpse", "police", "enforcer",
|
|
||||||
"securica", "banshee", "predator", "bus", "rhino", "barracks", "train", "chopper", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit",
|
|
||||||
"bellyup", "mrwongs", "mafia", "yardie", "yakuza", "diablos", "columb", "hoods", "airtrain", "deaddodo", "speeder", "reefer", "panlant", "flatbed",
|
|
||||||
"yankee", "escape", "borgnine", "toyz", "ghost",
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::list<CTweakVar *> TweakVarsList;
|
|
||||||
static bool bAddTweakVarsNow = false;
|
|
||||||
static const char *pTweakVarsDefaultPath = NULL;
|
|
||||||
|
|
||||||
void CTweakVars::Add(CTweakVar *var)
|
|
||||||
{
|
|
||||||
TweakVarsList.push_back(var);
|
|
||||||
|
|
||||||
if ( bAddTweakVarsNow )
|
|
||||||
var->AddDBG(pTweakVarsDefaultPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CTweakVars::AddDBG(const char *path)
|
|
||||||
{
|
|
||||||
pTweakVarsDefaultPath = path;
|
|
||||||
|
|
||||||
for(auto i = TweakVarsList.begin(); i != TweakVarsList.end(); ++i)
|
|
||||||
(*i)->AddDBG(pTweakVarsDefaultPath);
|
|
||||||
|
|
||||||
bAddTweakVarsNow = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CTweakSwitch::AddDBG(const char *path)
|
|
||||||
{
|
|
||||||
DebugMenuEntry *e = DebugMenuAddVar(m_pPath == NULL ? path : m_pPath, m_pVarName, (int32_t *)m_pIntVar, m_pFunc, 1, m_nMin, m_nMax, m_aStr);
|
|
||||||
DebugMenuEntrySetWrap(e, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CTweakFunc::AddDBG (const char *path) { DebugMenuAddCmd (m_pPath == NULL ? path : m_pPath, m_pVarName, m_pFunc); }
|
|
||||||
void CTweakBool::AddDBG (const char *path) { DebugMenuAddVarBool8(m_pPath == NULL ? path : m_pPath, m_pVarName, (int8_t *)m_pBoolVar, NULL); }
|
|
||||||
void CTweakInt8::AddDBG (const char *path) { DebugMenuAddVar (m_pPath == NULL ? path : m_pPath, m_pVarName, (int8_t *)m_pIntVar, NULL, m_nStep, m_nLoawerBound, m_nUpperBound, NULL); }
|
|
||||||
void CTweakUInt8::AddDBG (const char *path) { DebugMenuAddVar (m_pPath == NULL ? path : m_pPath, m_pVarName, (uint8_t *)m_pIntVar, NULL, m_nStep, m_nLoawerBound, m_nUpperBound, NULL); }
|
|
||||||
void CTweakInt16::AddDBG (const char *path) { DebugMenuAddVar (m_pPath == NULL ? path : m_pPath, m_pVarName, (int16_t *)m_pIntVar, NULL, m_nStep, m_nLoawerBound, m_nUpperBound, NULL); }
|
|
||||||
void CTweakUInt16::AddDBG(const char *path) { DebugMenuAddVar (m_pPath == NULL ? path : m_pPath, m_pVarName, (uint16_t *)m_pIntVar, NULL, m_nStep, m_nLoawerBound, m_nUpperBound, NULL); }
|
|
||||||
void CTweakInt32::AddDBG (const char *path) { DebugMenuAddVar (m_pPath == NULL ? path : m_pPath, m_pVarName, (int32_t *)m_pIntVar, NULL, m_nStep, m_nLoawerBound, m_nUpperBound, NULL); }
|
|
||||||
void CTweakUInt32::AddDBG(const char *path) { DebugMenuAddVar (m_pPath == NULL ? path : m_pPath, m_pVarName, (uint32_t *)m_pIntVar, NULL, m_nStep, m_nLoawerBound, m_nUpperBound, NULL); }
|
|
||||||
void CTweakFloat::AddDBG (const char *path) { DebugMenuAddVar (m_pPath == NULL ? path : m_pPath, m_pVarName, (float *)m_pIntVar, NULL, m_nStep, m_nLoawerBound, m_nUpperBound); }
|
|
||||||
|
|
||||||
/*
|
|
||||||
static const char *wt[] = {
|
|
||||||
"Sunny", "Cloudy", "Rainy", "Foggy"
|
|
||||||
};
|
|
||||||
|
|
||||||
SETTWEAKPATH("TEST");
|
|
||||||
TWEAKSWITCH(CWeather::NewWeatherType, 0, 3, wt, NULL);
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
DebugMenuPopulate(void)
|
|
||||||
{
|
|
||||||
if(DebugMenuLoad()){
|
|
||||||
static const char *weathers[] = {
|
|
||||||
"Sunny", "Cloudy", "Rainy", "Foggy"
|
|
||||||
};
|
|
||||||
DebugMenuEntry *e;
|
|
||||||
e = DebugMenuAddVar("Time & Weather", "Current Hour", &CClock::GetHoursRef(), nil, 1, 0, 23, nil);
|
|
||||||
DebugMenuEntrySetWrap(e, true);
|
|
||||||
e = DebugMenuAddVar("Time & Weather", "Current Minute", &CClock::GetMinutesRef(),
|
|
||||||
[](){ CWeather::InterpolationValue = CClock::GetMinutes()/60.0f; }, 1, 0, 59, nil);
|
|
||||||
DebugMenuEntrySetWrap(e, true);
|
|
||||||
e = DebugMenuAddVar("Time & Weather", "Old Weather", (int16*)&CWeather::OldWeatherType, nil, 1, 0, 3, weathers);
|
|
||||||
DebugMenuEntrySetWrap(e, true);
|
|
||||||
e = DebugMenuAddVar("Time & Weather", "New Weather", (int16*)&CWeather::NewWeatherType, nil, 1, 0, 3, weathers);
|
|
||||||
DebugMenuEntrySetWrap(e, true);
|
|
||||||
DebugMenuAddVar("Time & Weather", "Wind", (float*)&CWeather::Wind, nil, 0.1f, 0.0f, 1.0f);
|
|
||||||
DebugMenuAddVar("Time & Weather", "Time scale", (float*)0x8F2C20, nil, 0.1f, 0.0f, 10.0f);
|
|
||||||
|
|
||||||
DebugMenuAddCmd("Cheats", "Weapons", WeaponCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Money", MoneyCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Health", HealthCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Wanted level up", WantedLevelUpCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Wanted level down", WantedLevelDownCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Tank", TankCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Blow up cars", BlowUpCarsCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Change player", ChangePlayerCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Mayhem", MayhemCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Everybody attacks player", EverybodyAttacksPlayerCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Weapons for all", WeaponsForAllCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Fast time", FastTimeCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Slow time", SlowTimeCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Armour", ArmourCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Sunny weather", SunnyWeatherCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Cloudy weather", CloudyWeatherCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Rainy weather", RainyWeatherCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Foggy weather", FoggyWeatherCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Fast weather", FastWeatherCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Only render wheels", OnlyRenderWheelsCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Chitty chitty bang bang", ChittyChittyBangBangCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat);
|
|
||||||
DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat);
|
|
||||||
|
|
||||||
static int spawnCarId = MI_LANDSTAL;
|
|
||||||
e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_GHOST, carnames);
|
|
||||||
DebugMenuEntrySetWrap(e, true);
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Car", [](){
|
|
||||||
if(spawnCarId == MI_TRAIN ||
|
|
||||||
spawnCarId == MI_CHOPPER ||
|
|
||||||
spawnCarId == MI_AIRTRAIN ||
|
|
||||||
spawnCarId == MI_DEADDODO ||
|
|
||||||
spawnCarId == MI_ESCAPE)
|
|
||||||
return;
|
|
||||||
SpawnCar(spawnCarId);
|
|
||||||
});
|
|
||||||
static uint8 dummy;
|
|
||||||
carCol1 = DebugMenuAddVar("Spawn", "First colour", &dummy, nil, 1, 0, 255, nil);
|
|
||||||
carCol2 = DebugMenuAddVar("Spawn", "Second colour", &dummy, nil, 1, 0, 255, nil);
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Kuruma", [](){ SpawnCar(MI_KURUMA); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
|
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
|
|
||||||
|
|
||||||
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
|
|
||||||
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
|
|
||||||
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
|
||||||
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
|
|
||||||
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
|
|
||||||
|
|
||||||
DebugMenuAddVarBool8("Debug", "Catalina Heli On", (int8*)&CHeli::CatalinaHeliOn, nil);
|
|
||||||
DebugMenuAddCmd("Debug", "Catalina Fly By", CHeli::StartCatalinaFlyBy);
|
|
||||||
DebugMenuAddCmd("Debug", "Catalina Take Off", CHeli::CatalinaTakeOff);
|
|
||||||
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)0x95CD43, nil);
|
|
||||||
|
|
||||||
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
|
|
||||||
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
|
|
||||||
|
|
||||||
DebugMenuAddCmd("Debug", "Make peds around you follow you", LetThemFollowYou);
|
|
||||||
#ifndef MASTER
|
|
||||||
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
|
|
||||||
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
|
|
||||||
|
|
||||||
CTweakVars::AddDBG("Debug");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
int (*RsEventHandler_orig)(int a, int b);
|
|
||||||
int
|
|
||||||
delayedPatches10(int a, int b)
|
|
||||||
{
|
|
||||||
DebugMenuInit();
|
|
||||||
DebugMenuPopulate();
|
|
||||||
|
|
||||||
return RsEventHandler_orig(a, b);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const int re3_buffsize = 1024;
|
|
||||||
static char re3_buff[re3_buffsize];
|
|
||||||
|
|
||||||
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
|
|
||||||
{
|
|
||||||
int nCode;
|
|
||||||
|
|
||||||
strcpy_s(re3_buff, re3_buffsize, "Assertion failed!" );
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "\n" );
|
|
||||||
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "File: ");
|
|
||||||
strcat_s(re3_buff, re3_buffsize, filename );
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "\n" );
|
|
||||||
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "Line: " );
|
|
||||||
_itoa_s( lineno, re3_buff + strlen(re3_buff), re3_buffsize - strlen(re3_buff), 10 );
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "\n");
|
|
||||||
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "Function: ");
|
|
||||||
strcat_s(re3_buff, re3_buffsize, func );
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "\n" );
|
|
||||||
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "Expression: ");
|
|
||||||
strcat_s(re3_buff, re3_buffsize, expr);
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "\n");
|
|
||||||
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "\n" );
|
|
||||||
strcat_s(re3_buff, re3_buffsize, "(Press Retry to debug the application)");
|
|
||||||
|
|
||||||
|
|
||||||
nCode = ::MessageBoxA(nil, re3_buff, "RE3 Assertion Failed!",
|
|
||||||
MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);
|
|
||||||
|
|
||||||
if (nCode == IDABORT)
|
|
||||||
{
|
|
||||||
raise(SIGABRT);
|
|
||||||
_exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nCode == IDRETRY)
|
|
||||||
{
|
|
||||||
__debugbreak();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nCode == IDIGNORE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
void re3_debug(char *format, ...)
|
|
||||||
{
|
|
||||||
va_list va;
|
|
||||||
va_start(va, format);
|
|
||||||
vsprintf_s(re3_buff, re3_buffsize, format, va);
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
printf("%s", re3_buff);
|
|
||||||
}
|
|
||||||
|
|
||||||
void re3_trace(const char *filename, unsigned int lineno, const char *func, char *format, ...)
|
|
||||||
{
|
|
||||||
char buff[re3_buffsize *2];
|
|
||||||
va_list va;
|
|
||||||
va_start(va, format);
|
|
||||||
vsprintf_s(re3_buff, re3_buffsize, format, va);
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
sprintf_s(buff, re3_buffsize * 2, "[%s.%s:%d]: %s", filename, func, lineno, re3_buff);
|
|
||||||
|
|
||||||
OutputDebugStringA(buff);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
patch()
|
|
||||||
{
|
|
||||||
StaticPatcher::Apply();
|
|
||||||
|
|
||||||
// Patch<float>(0x46BC61+6, 1.0f); // car distance
|
|
||||||
InjectHook(0x59E460, printf, PATCH_JUMP);
|
|
||||||
InjectHook(0x475E00, printf, PATCH_JUMP); // _Error
|
|
||||||
|
|
||||||
|
|
||||||
// InterceptCall(&open_script_orig, open_script, 0x438869);
|
|
||||||
|
|
||||||
// InterceptCall(&RsEventHandler_orig, delayedPatches10, 0x58275E);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
|
|
||||||
{
|
|
||||||
if(reason == DLL_PROCESS_ATTACH){
|
|
||||||
|
|
||||||
AllocConsole();
|
|
||||||
freopen("CONIN$", "r", stdin);
|
|
||||||
freopen("CONOUT$", "w", stdout);
|
|
||||||
freopen("CONOUT$", "w", stderr);
|
|
||||||
|
|
||||||
if (*(DWORD*)0x5C1E75 == 0xB85548EC) // 1.0
|
|
||||||
patch();
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
@ -457,7 +457,7 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &
|
|||||||
{
|
{
|
||||||
float compression = 1.0f - springRatio;
|
float compression = 1.0f - springRatio;
|
||||||
if(compression > 0.0f){
|
if(compression > 0.0f){
|
||||||
float step = Min(CTimer::GetTimeStep(), 3.0f);
|
float step = min(CTimer::GetTimeStep(), 3.0f);
|
||||||
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
|
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
|
||||||
ApplyMoveForce(springDir*impulse);
|
ApplyMoveForce(springDir*impulse);
|
||||||
ApplyTurnForce(springDir*impulse, point);
|
ApplyTurnForce(springDir*impulse, point);
|
||||||
@ -471,12 +471,12 @@ CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &poin
|
|||||||
{
|
{
|
||||||
float speedA = DotProduct(speed, springDir);
|
float speedA = DotProduct(speed, springDir);
|
||||||
float speedB = DotProduct(GetSpeed(point), springDir);
|
float speedB = DotProduct(GetSpeed(point), springDir);
|
||||||
float step = Min(CTimer::GetTimeStep(), 3.0f);
|
float step = min(CTimer::GetTimeStep(), 3.0f);
|
||||||
float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f;
|
float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f;
|
||||||
|
|
||||||
// what is this?
|
// what is this?
|
||||||
float a = m_fTurnMass / ((point.MagnitudeSqr() + 1.0f) * 2.0f * m_fMass);
|
float a = m_fTurnMass / ((point.MagnitudeSqr() + 1.0f) * 2.0f * m_fMass);
|
||||||
a = Min(a, 1.0f);
|
a = min(a, 1.0f);
|
||||||
float b = Abs(impulse / (speedB * m_fMass));
|
float b = Abs(impulse / (speedB * m_fMass));
|
||||||
if(a < b)
|
if(a < b)
|
||||||
impulse *= a/b;
|
impulse *= a/b;
|
||||||
@ -646,7 +646,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
|||||||
// positive if B is moving towards A
|
// positive if B is moving towards A
|
||||||
// not interested in how much B moves into A apparently?
|
// not interested in how much B moves into A apparently?
|
||||||
// only interested in cases where A collided into B
|
// only interested in cases where A collided into B
|
||||||
speedB = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
|
speedB = max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
|
||||||
// A has moved into B
|
// A has moved into B
|
||||||
if(speedA < speedB){
|
if(speedA < speedB){
|
||||||
if(!A->bHasHitWall)
|
if(!A->bHasHitWall)
|
||||||
@ -1147,18 +1147,18 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
|||||||
CVector dir = A->GetPosition() - B->GetPosition();
|
CVector dir = A->GetPosition() - B->GetPosition();
|
||||||
dir.Normalise();
|
dir.Normalise();
|
||||||
if(dir.z < 0.0f && dir.z < A->GetForward().z && dir.z < A->GetRight().z)
|
if(dir.z < 0.0f && dir.z < A->GetForward().z && dir.z < A->GetRight().z)
|
||||||
dir.z = Min(0.0f, Min(A->GetForward().z, A->GetRight().z));
|
dir.z = min(0.0f, min(A->GetForward().z, A->GetRight().z));
|
||||||
shift += dir * colpoints[mostColliding].depth * 0.5f;
|
shift += dir * colpoints[mostColliding].depth * 0.5f;
|
||||||
}else if(A->IsPed() && B->IsVehicle() && ((CVehicle*)B)->IsBoat()){
|
}else if(A->IsPed() && B->IsVehicle() && ((CVehicle*)B)->IsBoat()){
|
||||||
CVector dir = colpoints[mostColliding].normal;
|
CVector dir = colpoints[mostColliding].normal;
|
||||||
float f = Min(Abs(dir.z), 0.9f);
|
float f = min(Abs(dir.z), 0.9f);
|
||||||
dir.z = 0.0f;
|
dir.z = 0.0f;
|
||||||
dir.Normalise();
|
dir.Normalise();
|
||||||
shift += dir * colpoints[mostColliding].depth / (1.0f - f);
|
shift += dir * colpoints[mostColliding].depth / (1.0f - f);
|
||||||
boat = B;
|
boat = B;
|
||||||
}else if(B->IsPed() && A->IsVehicle() && ((CVehicle*)A)->IsBoat()){
|
}else if(B->IsPed() && A->IsVehicle() && ((CVehicle*)A)->IsBoat()){
|
||||||
CVector dir = colpoints[mostColliding].normal * -1.0f;
|
CVector dir = colpoints[mostColliding].normal * -1.0f;
|
||||||
float f = Min(Abs(dir.z), 0.9f);
|
float f = min(Abs(dir.z), 0.9f);
|
||||||
dir.z = 0.0f;
|
dir.z = 0.0f;
|
||||||
dir.Normalise();
|
dir.Normalise();
|
||||||
B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f);
|
B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f);
|
||||||
@ -1246,7 +1246,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
}
|
}
|
||||||
}else if(A->bHasContacted){
|
}else if(A->bHasContacted){
|
||||||
CVector savedMoveFriction = A->m_vecMoveFriction;
|
CVector savedMoveFriction = A->m_vecMoveFriction;
|
||||||
@ -1268,7 +1268,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1301,7 +1301,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1328,7 +1328,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1506,7 +1506,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
||||||
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
for(i = 0; i < numCollisions; i++){
|
for(i = 0; i < numCollisions; i++){
|
||||||
@ -1527,7 +1527,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
||||||
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
float adhesion = CSurfaceTable::GetAdhesiveLimit(aColPoints[i]) / numCollisions;
|
float adhesion = CSurfaceTable::GetAdhesiveLimit(aColPoints[i]) / numCollisions;
|
||||||
|
|
||||||
@ -1545,7 +1545,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
else if(A->GetUp().z > 0.3f)
|
else if(A->GetUp().z > 0.3f)
|
||||||
adhesion = 0.0f;
|
adhesion = 0.0f;
|
||||||
else
|
else
|
||||||
adhesion *= Min(5.0f, 0.03f*impulseA + 1.0f);
|
adhesion *= min(5.0f, 0.03f*impulseA + 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(A->ApplyFriction(adhesion, aColPoints[i]))
|
if(A->ApplyFriction(adhesion, aColPoints[i]))
|
||||||
@ -1594,7 +1594,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
}
|
}
|
||||||
}else if(A->bHasContacted){
|
}else if(A->bHasContacted){
|
||||||
CVector savedMoveFriction = A->m_vecMoveFriction;
|
CVector savedMoveFriction = A->m_vecMoveFriction;
|
||||||
@ -1619,7 +1619,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1655,7 +1655,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1685,7 +1685,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1831,7 +1831,7 @@ CPhysical::ProcessCollision(void)
|
|||||||
|
|
||||||
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
|
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
|
||||||
if(ped->IsPlayer())
|
if(ped->IsPlayer())
|
||||||
n = Max(NUMSTEPS(0.2f), 2.0);
|
n = max(NUMSTEPS(0.2f), 2.0);
|
||||||
else
|
else
|
||||||
n = NUMSTEPS(0.3f);
|
n = NUMSTEPS(0.3f);
|
||||||
step = savedTimeStep / n;
|
step = savedTimeStep / n;
|
||||||
@ -1852,7 +1852,7 @@ CPhysical::ProcessCollision(void)
|
|||||||
speedDown = Multiply3x3(GetMatrix(), speedDown);
|
speedDown = Multiply3x3(GetMatrix(), speedDown);
|
||||||
speedUp = GetSpeed(speedUp);
|
speedUp = GetSpeed(speedUp);
|
||||||
speedDown = GetSpeed(speedDown);
|
speedDown = GetSpeed(speedDown);
|
||||||
distSq = Max(speedUp.MagnitudeSqr(), speedDown.MagnitudeSqr()) * sq(CTimer::GetTimeStep());
|
distSq = max(speedUp.MagnitudeSqr(), speedDown.MagnitudeSqr()) * sq(CTimer::GetTimeStep());
|
||||||
if(distSq >= sq(0.3f)){
|
if(distSq >= sq(0.3f)){
|
||||||
n = NUMSTEPS(0.3f);
|
n = NUMSTEPS(0.3f);
|
||||||
step = savedTimeStep / n;
|
step = savedTimeStep / n;
|
||||||
|
@ -1792,7 +1792,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
neededPos.z = autoZPos.z;
|
neededPos.z = autoZPos.z;
|
||||||
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
} else if (neededPos.z <= currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) {
|
} else if (neededPos.z <= currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) {
|
||||||
adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f);
|
adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f);
|
||||||
|
|
||||||
// Smoothly change ped position
|
// Smoothly change ped position
|
||||||
neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep);
|
neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep);
|
||||||
@ -1807,12 +1807,12 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
if (m_pVehicleAnim &&
|
if (m_pVehicleAnim &&
|
||||||
(vehAnim == ANIM_CAR_GETIN_RHS || vehAnim == ANIM_CAR_GETIN_LOW_RHS || vehAnim == ANIM_CAR_GETIN_LHS || vehAnim == ANIM_CAR_GETIN_LOW_LHS
|
(vehAnim == ANIM_CAR_GETIN_RHS || vehAnim == ANIM_CAR_GETIN_LOW_RHS || vehAnim == ANIM_CAR_GETIN_LHS || vehAnim == ANIM_CAR_GETIN_LOW_LHS
|
||||||
|| vehAnim == ANIM_CAR_QJACK || vehAnim == ANIM_VAN_GETIN_L || vehAnim == ANIM_VAN_GETIN)) {
|
|| vehAnim == ANIM_CAR_QJACK || vehAnim == ANIM_VAN_GETIN_L || vehAnim == ANIM_VAN_GETIN)) {
|
||||||
adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f);
|
adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f);
|
||||||
|
|
||||||
// Smoothly change ped position
|
// Smoothly change ped position
|
||||||
neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ;
|
neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ;
|
||||||
} else if (m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK) {
|
} else if (m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK) {
|
||||||
neededPos.z = Max(currentZ, autoZPos.z);
|
neededPos.z = max(currentZ, autoZPos.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4771,12 +4771,12 @@ CPed::FightStrike(CVector &touchedNodePos)
|
|||||||
|
|
||||||
float moveMult;
|
float moveMult;
|
||||||
if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) {
|
if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) {
|
||||||
moveMult = Min(damageMult * 0.6f, 4.0f);
|
moveMult = min(damageMult * 0.6f, 4.0f);
|
||||||
} else {
|
} else {
|
||||||
if (nearPed->m_nPedState != PED_DIE || damageMult >= 20) {
|
if (nearPed->m_nPedState != PED_DIE || damageMult >= 20) {
|
||||||
moveMult = damageMult;
|
moveMult = damageMult;
|
||||||
} else {
|
} else {
|
||||||
moveMult = Min(damageMult * 2.0f, 14.0f);
|
moveMult = min(damageMult * 2.0f, 14.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
|
|||||||
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
|
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
|
||||||
foundColZ2 = foundCol.point.z;
|
foundColZ2 = foundCol.point.z;
|
||||||
|
|
||||||
zForPed = Max(foundColZ, foundColZ2);
|
zForPed = max(foundColZ, foundColZ2);
|
||||||
|
|
||||||
if (zForPed > -99.0f)
|
if (zForPed > -99.0f)
|
||||||
pos->z = 1.04f + zForPed;
|
pos->z = 1.04f + zForPed;
|
||||||
|
@ -97,16 +97,8 @@ CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity)
|
|||||||
class CPlayerPed_ : public CPlayerPed
|
class CPlayerPed_ : public CPlayerPed
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); }
|
CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); }
|
||||||
void dtor(void) { CPlayerPed::~CPlayerPed(); }
|
void dtor(void) { CPlayerPed::~CPlayerPed(); }
|
||||||
=======
|
|
||||||
void dtor(void) { this->~CPlayerPed(); }
|
|
||||||
>>>>>>> More audio ped
|
|
||||||
=======
|
|
||||||
void dtor(void) { CPlayerPed::~CPlayerPed(); }
|
|
||||||
>>>>>>> fix
|
|
||||||
};
|
};
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
@ -1,110 +0,0 @@
|
|||||||
#include "common.h"
|
|
||||||
#include "patcher.h"
|
|
||||||
#include "PlayerPed.h"
|
|
||||||
#include "Camera.h"
|
|
||||||
#include "WeaponEffects.h"
|
|
||||||
#include "ModelIndices.h"
|
|
||||||
|
|
||||||
CPlayerPed::~CPlayerPed()
|
|
||||||
{
|
|
||||||
delete m_pWanted;
|
|
||||||
}
|
|
||||||
|
|
||||||
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
|
|
||||||
WRAPPER void CPlayerPed::SetupPlayerPed(int32) { EAXJMP(0x4EFB60); }
|
|
||||||
WRAPPER void CPlayerPed::DeactivatePlayerPed(int32) { EAXJMP(0x4EFC00); }
|
|
||||||
WRAPPER void CPlayerPed::ReactivatePlayerPed(int32) { EAXJMP(0x4EFC20); }
|
|
||||||
WRAPPER void CPlayerPed::KeepAreaAroundPlayerClear(void) { EAXJMP(0x4F3460); }
|
|
||||||
WRAPPER void CPlayerPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); }
|
|
||||||
WRAPPER void CPlayerPed::SetInitialState(void) { EAXJMP(0x4EFC40); }
|
|
||||||
WRAPPER void CPlayerPed::SetMoveAnim(void) { EAXJMP(0x4F3760); }
|
|
||||||
WRAPPER void CPlayerPed::ProcessControl(void) { EAXJMP(0x4EFD90); }
|
|
||||||
|
|
||||||
CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|
||||||
{
|
|
||||||
m_fMoveSpeed = 0.0f;
|
|
||||||
SetModelIndex(MI_PLAYER);
|
|
||||||
SetInitialState();
|
|
||||||
|
|
||||||
m_pWanted = new CWanted();
|
|
||||||
m_pWanted->Initialise();
|
|
||||||
m_pArrestingCop = nil;
|
|
||||||
m_currentWeapon = WEAPONTYPE_UNARMED;
|
|
||||||
m_nSelectedWepSlot = 0;
|
|
||||||
m_nSpeedTimer = 0;
|
|
||||||
m_bSpeedTimerFlag = 0;
|
|
||||||
m_pPointGunAt = nil;
|
|
||||||
m_nPedState = PED_IDLE;
|
|
||||||
m_fMaxStamina = 150.0f;
|
|
||||||
m_fCurrentStamina = m_fMaxStamina;
|
|
||||||
m_fStaminaProgress = 0.0f;
|
|
||||||
m_bShouldEvade = 0;
|
|
||||||
field_1367 = 0;
|
|
||||||
m_nShotDelay = 0;
|
|
||||||
field_1376 = 0.0f;
|
|
||||||
field_1380 = 0;
|
|
||||||
m_bHasLockOnTarget = false;
|
|
||||||
m_bCanBeDamaged = true;
|
|
||||||
m_fWalkAngle = 0.0f;
|
|
||||||
m_fFPSMoveHeading = 0.0f;
|
|
||||||
m_nTargettableObjects[0] = m_nTargettableObjects[1] = m_nTargettableObjects[2] = m_nTargettableObjects[3] = -1;
|
|
||||||
field_1413 = 0;
|
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
m_vecSafePos[i] = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
field_1488[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPlayerPed::ClearWeaponTarget()
|
|
||||||
{
|
|
||||||
if (m_nPedType == PEDTYPE_PLAYER1) {
|
|
||||||
m_pPointGunAt = nil;
|
|
||||||
TheCamera.ClearPlayerWeaponMode();
|
|
||||||
CWeaponEffects::ClearCrosshair();
|
|
||||||
}
|
|
||||||
ClearPointGunAt();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlayerPed::SetWantedLevel(int32 level)
|
|
||||||
{
|
|
||||||
m_pWanted->SetWantedLevel(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlayerPed::SetWantedLevelNoDrop(int32 level)
|
|
||||||
{
|
|
||||||
m_pWanted->SetWantedLevelNoDrop(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
// I don't know the actual purpose of parameter
|
|
||||||
void
|
|
||||||
CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity)
|
|
||||||
{
|
|
||||||
if (m_pedStats->m_temper < 52) {
|
|
||||||
m_pedStats->m_temper++;
|
|
||||||
} else {
|
|
||||||
if (annoyedByPassingEntity) {
|
|
||||||
if (m_pedStats->m_temper < 55) {
|
|
||||||
m_pedStats->m_temper++;
|
|
||||||
} else {
|
|
||||||
m_pedStats->m_temper = 46;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CPlayerPed_ : public CPlayerPed
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); }
|
|
||||||
void dtor(void) { CPlayerPed::~CPlayerPed(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
STARTPATCHES
|
|
||||||
InjectHook(0x4EF7E0, &CPlayerPed_::ctor, PATCH_JUMP);
|
|
||||||
InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP);
|
|
||||||
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
|
|
||||||
InjectHook(0x4F3700, &CPlayerPed::AnnoyPlayerPed, PATCH_JUMP);
|
|
||||||
ENDPATCHES
|
|
@ -388,7 +388,7 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
|
|||||||
ms_colourBottom.b = topblue;
|
ms_colourBottom.b = topblue;
|
||||||
ms_colourBottom.a = alpha;
|
ms_colourBottom.a = alpha;
|
||||||
|
|
||||||
botpos = Min(SCREEN_HEIGHT, topedge);
|
botpos = min(SCREEN_HEIGHT, topedge);
|
||||||
CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos),
|
CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos),
|
||||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||||
}
|
}
|
||||||
@ -415,18 +415,18 @@ CClouds::RenderHorizon(void)
|
|||||||
if(ms_horizonZ > SCREEN_HEIGHT)
|
if(ms_horizonZ > SCREEN_HEIGHT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float z1 = Min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT);
|
float z1 = min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT);
|
||||||
CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1),
|
CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1),
|
||||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||||
|
|
||||||
// This is just weird
|
// This is just weird
|
||||||
float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT +
|
float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT +
|
||||||
SCREEN_HEIGHT/300.0f * Max(TheCamera.GetPosition().z, 0.0f);
|
SCREEN_HEIGHT/300.0f * max(TheCamera.GetPosition().z, 0.0f);
|
||||||
float b = TheCamera.GetUp().z < 0.0f ?
|
float b = TheCamera.GetUp().z < 0.0f ?
|
||||||
SCREEN_HEIGHT :
|
SCREEN_HEIGHT :
|
||||||
SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
|
SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
|
||||||
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
|
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
|
||||||
z2 = Min(z2, SCREEN_HEIGHT);
|
z2 = min(z2, SCREEN_HEIGHT);
|
||||||
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
|
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
|
||||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ CCoronas::Update(void)
|
|||||||
int i;
|
int i;
|
||||||
static int LastCamLook = 0;
|
static int LastCamLook = 0;
|
||||||
|
|
||||||
LightsMult = Min(LightsMult + 0.03f * CTimer::GetTimeStep(), 1.0f);
|
LightsMult = min(LightsMult + 0.03f * CTimer::GetTimeStep(), 1.0f);
|
||||||
|
|
||||||
int CamLook = 0;
|
int CamLook = 0;
|
||||||
if(TheCamera.Cams[TheCamera.ActiveCam].LookingLeft) CamLook |= 1;
|
if(TheCamera.Cams[TheCamera.ActiveCam].LookingLeft) CamLook |= 1;
|
||||||
@ -121,7 +121,7 @@ CCoronas::Update(void)
|
|||||||
if(LastCamLook != CamLook)
|
if(LastCamLook != CamLook)
|
||||||
bChangeBrightnessImmediately = 3;
|
bChangeBrightnessImmediately = 3;
|
||||||
else
|
else
|
||||||
bChangeBrightnessImmediately = Max(bChangeBrightnessImmediately-1, 0);
|
bChangeBrightnessImmediately = max(bChangeBrightnessImmediately-1, 0);
|
||||||
LastCamLook = CamLook;
|
LastCamLook = CamLook;
|
||||||
|
|
||||||
for(i = 0; i < NUMCORONAS; i++)
|
for(i = 0; i < NUMCORONAS; i++)
|
||||||
@ -309,7 +309,7 @@ CCoronas::Render(void)
|
|||||||
|
|
||||||
// render corona itself
|
// render corona itself
|
||||||
if(aCoronas[i].texture){
|
if(aCoronas[i].texture){
|
||||||
float fogscale = CWeather::Foggyness*Min(spriteCoors.z, 40.0f)/40.0f + 1.0f;
|
float fogscale = CWeather::Foggyness*min(spriteCoors.z, 40.0f)/40.0f + 1.0f;
|
||||||
if(CCoronas::aCoronas[i].id == SUN_CORE)
|
if(CCoronas::aCoronas[i].id == SUN_CORE)
|
||||||
spriteCoors.z = 0.95f * RwCameraGetFarClipPlane(Scene.camera);
|
spriteCoors.z = 0.95f * RwCameraGetFarClipPlane(Scene.camera);
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aCoronas[i].texture));
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aCoronas[i].texture));
|
||||||
@ -320,7 +320,7 @@ CCoronas::Render(void)
|
|||||||
float f = 1.0f - aCoronas[i].someAngle*2.0f/PI;
|
float f = 1.0f - aCoronas[i].someAngle*2.0f/PI;
|
||||||
float wscale = 6.0f*sq(sq(sq(f))) + 0.5f;
|
float wscale = 6.0f*sq(sq(sq(f))) + 0.5f;
|
||||||
float hscale = 0.35f - (wscale - 0.5f) * 0.06f;
|
float hscale = 0.35f - (wscale - 0.5f) * 0.06f;
|
||||||
hscale = Max(hscale, 0.15f);
|
hscale = max(hscale, 0.15f);
|
||||||
|
|
||||||
CSprite::RenderOneXLUSprite(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
CSprite::RenderOneXLUSprite(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||||
spritew * aCoronas[i].size * wscale,
|
spritew * aCoronas[i].size * wscale,
|
||||||
@ -467,7 +467,7 @@ CCoronas::RenderReflections(void)
|
|||||||
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, 50.0f);
|
drawDist = min(drawDist, 50.0f);
|
||||||
if(spriteCoors.z < drawDist){
|
if(spriteCoors.z < drawDist){
|
||||||
float fadeDistance = drawDist / 2.0f;
|
float fadeDistance = drawDist / 2.0f;
|
||||||
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
|
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
|
||||||
@ -546,25 +546,25 @@ CRegisteredCorona::Update(void)
|
|||||||
(CCoronas::SunBlockedByClouds && id == CCoronas::SUN_CORONA ||
|
(CCoronas::SunBlockedByClouds && id == CCoronas::SUN_CORONA ||
|
||||||
!CWorld::GetIsLineOfSightClear(coors, TheCamera.GetPosition(), true, false, false, false, false, false))){
|
!CWorld::GetIsLineOfSightClear(coors, TheCamera.GetPosition(), true, false, false, false, false, false))){
|
||||||
// Corona is blocked, fade out
|
// Corona is blocked, fade out
|
||||||
fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
||||||
}else if(offScreen){
|
}else if(offScreen){
|
||||||
// Same when off screen
|
// Same when off screen
|
||||||
fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
||||||
}else{
|
}else{
|
||||||
// Visible
|
// Visible
|
||||||
if(alpha > fadeAlpha){
|
if(alpha > fadeAlpha){
|
||||||
// fade in
|
// fade in
|
||||||
fadeAlpha = Min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
|
fadeAlpha = min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
|
||||||
if(CCoronas::bChangeBrightnessImmediately)
|
if(CCoronas::bChangeBrightnessImmediately)
|
||||||
fadeAlpha = alpha;
|
fadeAlpha = alpha;
|
||||||
}else if(alpha < fadeAlpha){
|
}else if(alpha < fadeAlpha){
|
||||||
// too visible, decrease alpha but not below alpha
|
// too visible, decrease alpha but not below alpha
|
||||||
fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), alpha);
|
fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
// darken scene when the sun is visible
|
// darken scene when the sun is visible
|
||||||
if(id == CCoronas::SUN_CORONA)
|
if(id == CCoronas::SUN_CORONA)
|
||||||
CCoronas::LightsMult = Max(CCoronas::LightsMult - CTimer::GetTimeStep()*0.06f, 0.6f);
|
CCoronas::LightsMult = max(CCoronas::LightsMult - CTimer::GetTimeStep()*0.06f, 0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove if invisible
|
// remove if invisible
|
||||||
|
@ -37,9 +37,9 @@ SetLightsWithTimeOfDayColour(RpWorld *)
|
|||||||
AmbientLightColourForFrame.green = 1.0f;
|
AmbientLightColourForFrame.green = 1.0f;
|
||||||
AmbientLightColourForFrame.blue = 1.0f;
|
AmbientLightColourForFrame.blue = 1.0f;
|
||||||
}
|
}
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = Min(1.0f, AmbientLightColourForFrame.red*1.3f);
|
AmbientLightColourForFrame_PedsCarsAndObjects.red = min(1.0f, AmbientLightColourForFrame.red*1.3f);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = Min(1.0f, AmbientLightColourForFrame.green*1.3f);
|
AmbientLightColourForFrame_PedsCarsAndObjects.green = min(1.0f, AmbientLightColourForFrame.green*1.3f);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = Min(1.0f, AmbientLightColourForFrame.blue*1.3f);
|
AmbientLightColourForFrame_PedsCarsAndObjects.blue = min(1.0f, AmbientLightColourForFrame.blue*1.3f);
|
||||||
RpLightSetColor(pAmbient, &AmbientLightColourForFrame);
|
RpLightSetColor(pAmbient, &AmbientLightColourForFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,16 +70,16 @@ SetLightsWithTimeOfDayColour(RpWorld *)
|
|||||||
float f1 = 2.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
float f1 = 2.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
||||||
float f2 = 3.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
float f2 = 3.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
||||||
|
|
||||||
AmbientLightColourForFrame.red = Min(1.0f, AmbientLightColourForFrame.red * f2);
|
AmbientLightColourForFrame.red = min(1.0f, AmbientLightColourForFrame.red * f2);
|
||||||
AmbientLightColourForFrame.green = Min(1.0f, AmbientLightColourForFrame.green * f2);
|
AmbientLightColourForFrame.green = min(1.0f, AmbientLightColourForFrame.green * f2);
|
||||||
AmbientLightColourForFrame.blue = Min(1.0f, AmbientLightColourForFrame.blue * f2);
|
AmbientLightColourForFrame.blue = min(1.0f, AmbientLightColourForFrame.blue * f2);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.red * f1);
|
AmbientLightColourForFrame_PedsCarsAndObjects.red = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.red * f1);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.green * f1);
|
AmbientLightColourForFrame_PedsCarsAndObjects.green = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.green * f1);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.blue * f1);
|
AmbientLightColourForFrame_PedsCarsAndObjects.blue = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.blue * f1);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
DirectionalLightColourForFrame.red = Min(1.0f, DirectionalLightColourForFrame.red * f1);
|
DirectionalLightColourForFrame.red = min(1.0f, DirectionalLightColourForFrame.red * f1);
|
||||||
DirectionalLightColourForFrame.green = Min(1.0f, DirectionalLightColourForFrame.green * f1);
|
DirectionalLightColourForFrame.green = min(1.0f, DirectionalLightColourForFrame.green * f1);
|
||||||
DirectionalLightColourForFrame.blue = Min(1.0f, DirectionalLightColourForFrame.blue * f1);
|
DirectionalLightColourForFrame.blue = min(1.0f, DirectionalLightColourForFrame.blue * f1);
|
||||||
#else
|
#else
|
||||||
DirectionalLightColourForFrame.red = min(1.0f, AmbientLightColourForFrame.red * f1);
|
DirectionalLightColourForFrame.red = min(1.0f, AmbientLightColourForFrame.red * f1);
|
||||||
DirectionalLightColourForFrame.green = min(1.0f, AmbientLightColourForFrame.green * f1);
|
DirectionalLightColourForFrame.green = min(1.0f, AmbientLightColourForFrame.green * f1);
|
||||||
@ -193,7 +193,7 @@ AddAnExtraDirectionalLight(RpWorld *world, float dirx, float diry, float dirz, f
|
|||||||
RwRGBAReal color;
|
RwRGBAReal color;
|
||||||
RwV3d *dir;
|
RwV3d *dir;
|
||||||
|
|
||||||
strength = Max(Max(red, green), blue);
|
strength = max(max(red, green), blue);
|
||||||
n = -1;
|
n = -1;
|
||||||
if(NumExtraDirLightsInWorld < NUMEXTRADIRECTIONALS)
|
if(NumExtraDirLightsInWorld < NUMEXTRADIRECTIONALS)
|
||||||
n = NumExtraDirLightsInWorld;
|
n = NumExtraDirLightsInWorld;
|
||||||
@ -221,7 +221,7 @@ AddAnExtraDirectionalLight(RpWorld *world, float dirx, float diry, float dirz, f
|
|||||||
RwFrameUpdateObjects(RpLightGetFrame(pExtraDirectionals[n]));
|
RwFrameUpdateObjects(RpLightGetFrame(pExtraDirectionals[n]));
|
||||||
RpLightSetFlags(pExtraDirectionals[n], rpLIGHTLIGHTATOMICS);
|
RpLightSetFlags(pExtraDirectionals[n], rpLIGHTLIGHTATOMICS);
|
||||||
LightStrengths[n] = strength;
|
LightStrengths[n] = strength;
|
||||||
NumExtraDirLightsInWorld = Min(NumExtraDirLightsInWorld+1, NUMEXTRADIRECTIONALS);
|
NumExtraDirLightsInWorld = min(NumExtraDirLightsInWorld+1, NUMEXTRADIRECTIONALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -91,7 +91,7 @@ void cParticleSystemMgr::LoadParticleData()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CFG_PARAM_INITIAL_COLOR_VARIATION:
|
case CFG_PARAM_INITIAL_COLOR_VARIATION:
|
||||||
entry->m_InitialColorVariation = Min(atoi(value), 100);
|
entry->m_InitialColorVariation = min(atoi(value), 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CFG_PARAM_FADE_DESTINATION_COLOR_R:
|
case CFG_PARAM_FADE_DESTINATION_COLOR_R:
|
||||||
|
@ -98,7 +98,7 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors)
|
|||||||
|
|
||||||
if(aLights[i].type == LIGHT_DIRECTIONAL){
|
if(aLights[i].type == LIGHT_DIRECTIONAL){
|
||||||
float dot = -DotProduct(dir, aLights[i].dir);
|
float dot = -DotProduct(dir, aLights[i].dir);
|
||||||
intensity *= Max((dot-0.5f)*2.0f, 0.0f);
|
intensity *= max((dot-0.5f)*2.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(intensity > 0.0f)
|
if(intensity > 0.0f)
|
||||||
|
@ -727,10 +727,10 @@ CShadows::RenderStoredShadows(void)
|
|||||||
float fStartY = shadowPos.y - fHeight;
|
float fStartY = shadowPos.y - fHeight;
|
||||||
float fEndY = shadowPos.y + fHeight;
|
float fEndY = shadowPos.y + fHeight;
|
||||||
|
|
||||||
int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||||
int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||||
int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||||
int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||||
|
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
|
|
||||||
@ -873,10 +873,10 @@ CShadows::GeneratePolysForStaticShadow(int16 nStaticShadowID)
|
|||||||
float fStartY = shadowPos.y - fHeight;
|
float fStartY = shadowPos.y - fHeight;
|
||||||
float fEndY = shadowPos.y + fHeight;
|
float fEndY = shadowPos.y + fHeight;
|
||||||
|
|
||||||
int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||||
int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||||
int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||||
int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||||
|
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
|
|
||||||
@ -1016,11 +1016,11 @@ CShadows::CastShadowEntity(CEntity *pEntity, float fStartX, float fStartY, floa
|
|||||||
Points[3].x = (fLengthRight - fFrontRight) - fSideRight;
|
Points[3].x = (fLengthRight - fFrontRight) - fSideRight;
|
||||||
Points[3].y = (fLengthForward - fFrontForward) - fSideForward;
|
Points[3].y = (fLengthForward - fFrontForward) - fSideForward;
|
||||||
|
|
||||||
float MinX = Min(Min(Points[0].x, Points[1].x), Min(Points[2].x, Points[3].x));
|
float MinX = min(min(Points[0].x, Points[1].x), min(Points[2].x, Points[3].x));
|
||||||
float MaxX = Max(Max(Points[0].x, Points[1].x), Max(Points[2].x, Points[3].x));
|
float MaxX = max(max(Points[0].x, Points[1].x), max(Points[2].x, Points[3].x));
|
||||||
|
|
||||||
float MinY = Min(Min(Points[0].y, Points[1].y), Min(Points[2].y, Points[3].y));
|
float MinY = min(min(Points[0].y, Points[1].y), min(Points[2].y, Points[3].y));
|
||||||
float MaxY = Max(Max(Points[0].y, Points[1].y), Max(Points[2].y, Points[3].y));
|
float MaxY = max(max(Points[0].y, Points[1].y), max(Points[2].y, Points[3].y));
|
||||||
|
|
||||||
float MaxZ = pPosn->z - pEntity->GetPosition().z;
|
float MaxZ = pPosn->z - pEntity->GetPosition().z;
|
||||||
float MinZ = MaxZ - fZDistance;
|
float MinZ = MaxZ - fZDistance;
|
||||||
@ -1767,7 +1767,7 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur
|
|||||||
{
|
{
|
||||||
ASSERT(pPosn != NULL);
|
ASSERT(pPosn != NULL);
|
||||||
|
|
||||||
C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, Max(fFrontX, -fSideY),
|
C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, max(fFrontX, -fSideY),
|
||||||
0, 128, 255, 128,
|
0, 128, 255, 128,
|
||||||
2048, 0.2f, 0);
|
2048, 0.2f, 0);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ CTimeCycle::Update(void)
|
|||||||
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL);
|
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL);
|
||||||
|
|
||||||
if(m_FogReduction != 0)
|
if(m_FogReduction != 0)
|
||||||
m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
|
m_fCurrentFarClip = max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
|
||||||
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
|
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
|
||||||
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
|
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
|
||||||
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
|
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
|
||||||
@ -311,9 +311,9 @@ CTimeCycle::Update(void)
|
|||||||
|
|
||||||
if(TheCamera.GetForward().z < -0.9f ||
|
if(TheCamera.GetForward().z < -0.9f ||
|
||||||
!CWeather::bScriptsForceRain && (CCullZones::PlayerNoRain() || CCullZones::CamNoRain() || CCutsceneMgr::IsRunning()))
|
!CWeather::bScriptsForceRain && (CCullZones::PlayerNoRain() || CCullZones::CamNoRain() || CCutsceneMgr::IsRunning()))
|
||||||
m_FogReduction = Min(m_FogReduction+1, 64);
|
m_FogReduction = min(m_FogReduction+1, 64);
|
||||||
else
|
else
|
||||||
m_FogReduction = Max(m_FogReduction-1, 0);
|
m_FogReduction = max(m_FogReduction-1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
@ -979,7 +979,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
|
|||||||
SMALL_SECTOR_SIZE / 2,
|
SMALL_SECTOR_SIZE / 2,
|
||||||
apBoatList) )
|
apBoatList) )
|
||||||
{
|
{
|
||||||
float fWakeColor = fAdd1 - Max(255.0f - float(color.blue + color.red + color.green) / 3, fAdd2);
|
float fWakeColor = fAdd1 - max(255.0f - float(color.blue + color.red + color.green) / 3, fAdd2);
|
||||||
|
|
||||||
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
|
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
|
||||||
RpGeometry *geom = apGeomArray[nGeomUsed++];
|
RpGeometry *geom = apGeomArray[nGeomUsed++];
|
||||||
@ -1035,9 +1035,9 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
|
|||||||
|
|
||||||
RwRGBAAssign(&wakeColor, &color);
|
RwRGBAAssign(&wakeColor, &color);
|
||||||
|
|
||||||
wakeColor.red = Min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
|
wakeColor.red = min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
|
||||||
wakeColor.green = Min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
|
wakeColor.green = min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
|
||||||
wakeColor.blue = Min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
|
wakeColor.blue = min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
|
||||||
|
|
||||||
RwRGBAAssign(&geomPreLights[9*i+j], &wakeColor);
|
RwRGBAAssign(&geomPreLights[9*i+j], &wakeColor);
|
||||||
|
|
||||||
@ -1114,7 +1114,7 @@ CWaterLevel::CalcDistanceToWater(float fX, float fY)
|
|||||||
fSectorY + SMALL_SECTOR_SIZE - fY
|
fSectorY + SMALL_SECTOR_SIZE - fY
|
||||||
);
|
);
|
||||||
|
|
||||||
fDistSqr = Min(vecDist.MagnitudeSqr(), fDistSqr);
|
fDistSqr = min(vecDist.MagnitudeSqr(), fDistSqr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,9 @@
|
|||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
<<<<<<< HEAD
|
|
||||||
#include "Clock.h"
|
#include "Clock.h"
|
||||||
#include "TimeCycle.h"
|
|
||||||
#include "ZoneCull.h"
|
|
||||||
=======
|
|
||||||
#include "Timecycle.h"
|
#include "Timecycle.h"
|
||||||
>>>>>>> More audio ped
|
#include "ZoneCull.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Darkel.h"
|
#include "Darkel.h"
|
||||||
#include "Rubbish.h"
|
#include "Rubbish.h"
|
||||||
@ -132,7 +128,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
|
|||||||
m_fGasPedal = 0.0f;
|
m_fGasPedal = 0.0f;
|
||||||
m_fBrakePedal = 0.0f;
|
m_fBrakePedal = 0.0f;
|
||||||
m_pSetOnFireEntity = nil;
|
m_pSetOnFireEntity = nil;
|
||||||
field_594 = 0;
|
m_fGasPedalAudio = 0;
|
||||||
bNotDamagedUpsideDown = false;
|
bNotDamagedUpsideDown = false;
|
||||||
bMoreResistantToDamage = false;
|
bMoreResistantToDamage = false;
|
||||||
m_fVelocityChangeForAudio = 0.0f;
|
m_fVelocityChangeForAudio = 0.0f;
|
||||||
@ -695,7 +691,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
if(m_aSuspensionSpringRatio[i] < 1.0f)
|
if(m_aSuspensionSpringRatio[i] < 1.0f)
|
||||||
m_aWheelTimer[i] = 4.0f;
|
m_aWheelTimer[i] = 4.0f;
|
||||||
else
|
else
|
||||||
m_aWheelTimer[i] = Max(m_aWheelTimer[i]-CTimer::GetTimeStep(), 0.0f);
|
m_aWheelTimer[i] = max(m_aWheelTimer[i]-CTimer::GetTimeStep(), 0.0f);
|
||||||
|
|
||||||
if(m_aWheelTimer[i] > 0.0f){
|
if(m_aWheelTimer[i] > 0.0f){
|
||||||
m_nWheelsOnGround++;
|
m_nWheelsOnGround++;
|
||||||
@ -1013,7 +1009,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
|
|
||||||
if(m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PHYSICS){
|
if(m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PHYSICS){
|
||||||
if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW)
|
if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW)
|
||||||
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f);
|
m_aWheelSpeed[0] = max(m_aWheelSpeed[0]-0.0005f, 0.0f);
|
||||||
}else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
|
}else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
|
||||||
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
|
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
|
||||||
FlyingControl(FLIGHT_MODEL_DODO);
|
FlyingControl(FLIGHT_MODEL_DODO);
|
||||||
@ -1021,7 +1017,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
FlyingControl(FLIGHT_MODEL_HELI);
|
FlyingControl(FLIGHT_MODEL_HELI);
|
||||||
}else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
|
}else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
|
||||||
if(CPad::GetPad(0)->GetCircleJustDown())
|
if(CPad::GetPad(0)->GetCircleJustDown())
|
||||||
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.03f, 0.0f);
|
m_aWheelSpeed[0] = max(m_aWheelSpeed[0]-0.03f, 0.0f);
|
||||||
if(m_aWheelSpeed[0] < 0.22f)
|
if(m_aWheelSpeed[0] < 0.22f)
|
||||||
m_aWheelSpeed[0] += 0.0001f;
|
m_aWheelSpeed[0] += 0.0001f;
|
||||||
if(m_aWheelSpeed[0] > 0.15f)
|
if(m_aWheelSpeed[0] > 0.15f)
|
||||||
@ -1133,10 +1129,10 @@ CAutomobile::ProcessControl(void)
|
|||||||
if(speed > sq(0.1f)){
|
if(speed > sq(0.1f)){
|
||||||
speed = Sqrt(speed);
|
speed = Sqrt(speed);
|
||||||
if(suspShake > 0.0f){
|
if(suspShake > 0.0f){
|
||||||
uint8 freq = Min(200.0f*suspShake*speed*2000.0f/m_fMass + 100.0f, 250.0f);
|
uint8 freq = min(200.0f*suspShake*speed*2000.0f/m_fMass + 100.0f, 250.0f);
|
||||||
CPad::GetPad(0)->StartShake(20000.0f*CTimer::GetTimeStep()/freq, freq);
|
CPad::GetPad(0)->StartShake(20000.0f*CTimer::GetTimeStep()/freq, freq);
|
||||||
}else{
|
}else{
|
||||||
uint8 freq = Min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 145.0f);
|
uint8 freq = min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 145.0f);
|
||||||
CPad::GetPad(0)->StartShake(5000.0f*CTimer::GetTimeStep()/freq, freq);
|
CPad::GetPad(0)->StartShake(5000.0f*CTimer::GetTimeStep()/freq, freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2590,7 +2586,7 @@ CAutomobile::HydraulicControl(void)
|
|||||||
float minz = pos.z + extendedLowerLimit - wheelRadius;
|
float minz = pos.z + extendedLowerLimit - wheelRadius;
|
||||||
if(minz < specialColModel->boundingBox.min.z)
|
if(minz < specialColModel->boundingBox.min.z)
|
||||||
specialColModel->boundingBox.min.z = minz;
|
specialColModel->boundingBox.min.z = minz;
|
||||||
float radius = Max(specialColModel->boundingBox.min.Magnitude(), specialColModel->boundingBox.max.Magnitude());
|
float radius = max(specialColModel->boundingBox.min.Magnitude(), specialColModel->boundingBox.max.Magnitude());
|
||||||
if(specialColModel->boundingSphere.radius < radius)
|
if(specialColModel->boundingSphere.radius < radius)
|
||||||
specialColModel->boundingSphere.radius = radius;
|
specialColModel->boundingSphere.radius = radius;
|
||||||
|
|
||||||
@ -2689,10 +2685,10 @@ CAutomobile::HydraulicControl(void)
|
|||||||
float front = -rear;
|
float front = -rear;
|
||||||
float right = CPad::GetPad(0)->GetCarGunLeftRight()/128.0f;
|
float right = CPad::GetPad(0)->GetCarGunLeftRight()/128.0f;
|
||||||
float left = -right;
|
float left = -right;
|
||||||
suspChange[CARWHEEL_FRONT_LEFT] = Max(front+left, 0.0f);
|
suspChange[CARWHEEL_FRONT_LEFT] = max(front+left, 0.0f);
|
||||||
suspChange[CARWHEEL_REAR_LEFT] = Max(rear+left, 0.0f);
|
suspChange[CARWHEEL_REAR_LEFT] = max(rear+left, 0.0f);
|
||||||
suspChange[CARWHEEL_FRONT_RIGHT] = Max(front+right, 0.0f);
|
suspChange[CARWHEEL_FRONT_RIGHT] = max(front+right, 0.0f);
|
||||||
suspChange[CARWHEEL_REAR_RIGHT] = Max(rear+right, 0.0f);
|
suspChange[CARWHEEL_REAR_RIGHT] = max(rear+right, 0.0f);
|
||||||
|
|
||||||
if(m_hydraulicState < 100){
|
if(m_hydraulicState < 100){
|
||||||
// Lowered, move wheels up
|
// Lowered, move wheels up
|
||||||
@ -2808,7 +2804,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||||||
ApplyTurnForce(impulse, point);
|
ApplyTurnForce(impulse, point);
|
||||||
|
|
||||||
CVector initialSpeed = m_vecMoveSpeed;
|
CVector initialSpeed = m_vecMoveSpeed;
|
||||||
float timeStep = Max(CTimer::GetTimeStep(), 0.01f);
|
float timeStep = max(CTimer::GetTimeStep(), 0.01f);
|
||||||
float impulseRatio = impulse.z / (GRAVITY * m_fMass * timeStep);
|
float impulseRatio = impulse.z / (GRAVITY * m_fMass * timeStep);
|
||||||
float waterResistance = Pow(1.0f - 0.05f*impulseRatio, CTimer::GetTimeStep());
|
float waterResistance = Pow(1.0f - 0.05f*impulseRatio, CTimer::GetTimeStep());
|
||||||
m_vecMoveSpeed *= waterResistance;
|
m_vecMoveSpeed *= waterResistance;
|
||||||
@ -2901,7 +2897,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||||||
float fSpeed = vSpeed.MagnitudeSqr();
|
float fSpeed = vSpeed.MagnitudeSqr();
|
||||||
if(fSpeed > sq(0.05f)){
|
if(fSpeed > sq(0.05f)){
|
||||||
fSpeed = Sqrt(fSpeed);
|
fSpeed = Sqrt(fSpeed);
|
||||||
float size = Min((fSpeed < 0.15f ? 0.25f : 0.75f)*fSpeed, 0.6f);
|
float size = min((fSpeed < 0.15f ? 0.25f : 0.75f)*fSpeed, 0.6f);
|
||||||
CVector right = 0.2f*fSpeed*GetRight() + 0.2f*vSpeed;
|
CVector right = 0.2f*fSpeed*GetRight() + 0.2f*vSpeed;
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_PED_SPLASH,
|
CParticle::AddParticle(PARTICLE_PED_SPLASH,
|
||||||
@ -2983,11 +2979,11 @@ CAutomobile::DoDriveByShootings(void)
|
|||||||
|
|
||||||
// TODO: what is this?
|
// TODO: what is this?
|
||||||
if(!lookingLeft && m_weaponDoorTimerLeft > 0.0f){
|
if(!lookingLeft && m_weaponDoorTimerLeft > 0.0f){
|
||||||
m_weaponDoorTimerLeft = Max(m_weaponDoorTimerLeft - CTimer::GetTimeStep()*0.1f, 0.0f);
|
m_weaponDoorTimerLeft = max(m_weaponDoorTimerLeft - CTimer::GetTimeStep()*0.1f, 0.0f);
|
||||||
ProcessOpenDoor(CAR_DOOR_LF, NUM_ANIMS, m_weaponDoorTimerLeft);
|
ProcessOpenDoor(CAR_DOOR_LF, NUM_ANIMS, m_weaponDoorTimerLeft);
|
||||||
}
|
}
|
||||||
if(!lookingRight && m_weaponDoorTimerRight > 0.0f){
|
if(!lookingRight && m_weaponDoorTimerRight > 0.0f){
|
||||||
m_weaponDoorTimerRight = Max(m_weaponDoorTimerRight - CTimer::GetTimeStep()*0.1f, 0.0f);
|
m_weaponDoorTimerRight = max(m_weaponDoorTimerRight - CTimer::GetTimeStep()*0.1f, 0.0f);
|
||||||
ProcessOpenDoor(CAR_DOOR_RF, NUM_ANIMS, m_weaponDoorTimerRight);
|
ProcessOpenDoor(CAR_DOOR_RF, NUM_ANIMS, m_weaponDoorTimerRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3135,7 +3131,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
|
|||||||
FindPlayerPed()->SetWantedLevelNoDrop(1);
|
FindPlayerPed()->SetWantedLevelNoDrop(1);
|
||||||
|
|
||||||
if(m_status == STATUS_PLAYER && impulse > 50.0f){
|
if(m_status == STATUS_PLAYER && impulse > 50.0f){
|
||||||
uint8 freq = Min(0.4f*impulse*2000.0f/m_fMass + 100.0f, 250.0f);
|
uint8 freq = min(0.4f*impulse*2000.0f/m_fMass + 100.0f, 250.0f);
|
||||||
CPad::GetPad(0)->StartShake(40000/freq, freq);
|
CPad::GetPad(0)->StartShake(40000/freq, freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3288,7 +3284,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
|
|||||||
|
|
||||||
if(m_pDamageEntity && m_pDamageEntity == FindPlayerVehicle() && impulse > 10.0f){
|
if(m_pDamageEntity && m_pDamageEntity == FindPlayerVehicle() && impulse > 10.0f){
|
||||||
int money = (doubleMoney ? 2 : 1) * impulse*pHandling->nMonetaryValue/1000000.0f;
|
int money = (doubleMoney ? 2 : 1) * impulse*pHandling->nMonetaryValue/1000000.0f;
|
||||||
money = Min(money, 40);
|
money = min(money, 40);
|
||||||
if(money > 2){
|
if(money > 2){
|
||||||
sprintf(gString, "$%d", money);
|
sprintf(gString, "$%d", money);
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += money;
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += money;
|
||||||
@ -3991,7 +3987,7 @@ CAutomobile::SetupSuspensionLines(void)
|
|||||||
// adjust col model to include suspension lines
|
// adjust col model to include suspension lines
|
||||||
if(colModel->boundingBox.min.z > colModel->lines[0].p1.z)
|
if(colModel->boundingBox.min.z > colModel->lines[0].p1.z)
|
||||||
colModel->boundingBox.min.z = colModel->lines[0].p1.z;
|
colModel->boundingBox.min.z = colModel->lines[0].p1.z;
|
||||||
float radius = Max(colModel->boundingBox.min.Magnitude(), colModel->boundingBox.max.Magnitude());
|
float radius = max(colModel->boundingBox.min.Magnitude(), colModel->boundingBox.max.Magnitude());
|
||||||
if(colModel->boundingSphere.radius < radius)
|
if(colModel->boundingSphere.radius < radius)
|
||||||
colModel->boundingSphere.radius = radius;
|
colModel->boundingSphere.radius = radius;
|
||||||
|
|
||||||
@ -4483,16 +4479,8 @@ CAutomobile::SetAllTaxiLights(bool set)
|
|||||||
class CAutomobile_ : public CAutomobile
|
class CAutomobile_ : public CAutomobile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
void ctor(int32 id, uint8 CreatedBy) { ::new (this) CAutomobile(id, CreatedBy); }
|
void ctor(int32 id, uint8 CreatedBy) { ::new (this) CAutomobile(id, CreatedBy); }
|
||||||
void dtor() { CAutomobile::~CAutomobile(); }
|
void dtor() { CAutomobile::~CAutomobile(); }
|
||||||
=======
|
|
||||||
void dtor() { this->~CAutomobile(); }
|
|
||||||
>>>>>>> More audio ped
|
|
||||||
=======
|
|
||||||
void dtor() { CAutomobile::~CAutomobile(); }
|
|
||||||
>>>>>>> fix
|
|
||||||
void SetModelIndex_(uint32 id) { CAutomobile::SetModelIndex(id); }
|
void SetModelIndex_(uint32 id) { CAutomobile::SetModelIndex(id); }
|
||||||
void ProcessControl_(void) { CAutomobile::ProcessControl(); }
|
void ProcessControl_(void) { CAutomobile::ProcessControl(); }
|
||||||
void Teleport_(CVector v) { CAutomobile::Teleport(v); }
|
void Teleport_(CVector v) { CAutomobile::Teleport(v); }
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -117,7 +117,7 @@ public:
|
|||||||
uint8 m_nWheelsOnGround;
|
uint8 m_nWheelsOnGround;
|
||||||
uint8 m_nDriveWheelsOnGround;
|
uint8 m_nDriveWheelsOnGround;
|
||||||
uint8 m_nDriveWheelsOnGroundPrev;
|
uint8 m_nDriveWheelsOnGroundPrev;
|
||||||
int32 field_594;
|
int32 m_fGasPedalAudio;
|
||||||
tWheelState m_aWheelState[4];
|
tWheelState m_aWheelState[4];
|
||||||
|
|
||||||
static bool &m_sAllTaxiLights;
|
static bool &m_sAllTaxiLights;
|
||||||
|
@ -61,7 +61,7 @@ float CBoat::IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat)
|
|||||||
float fDist = vecDist.MagnitudeSqr();
|
float fDist = vecDist.MagnitudeSqr();
|
||||||
|
|
||||||
if ( fDist < SQR(fMaxDist) )
|
if ( fDist < SQR(fMaxDist) )
|
||||||
return 1.0f - Min(fRangeMult * Sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
|
return 1.0f - min(fRangeMult * Sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
@ -1038,16 +1038,8 @@ void CHeli::ActivateHeli(bool activate) { ScriptHeliOn = activate; }
|
|||||||
class CHeli_ : public CHeli
|
class CHeli_ : public CHeli
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
void ctor(int32 id, uint8 CreatedBy) { ::new (this) CHeli(id, CreatedBy); }
|
void ctor(int32 id, uint8 CreatedBy) { ::new (this) CHeli(id, CreatedBy); }
|
||||||
void dtor(void) { CHeli::~CHeli(); }
|
void dtor(void) { CHeli::~CHeli(); }
|
||||||
=======
|
|
||||||
void dtor(void) { this->~CHeli(); }
|
|
||||||
>>>>>>> More audio ped
|
|
||||||
=======
|
|
||||||
void dtor(void) { CHeli::~CHeli(); }
|
|
||||||
>>>>>>> fix
|
|
||||||
};
|
};
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -968,16 +968,8 @@ bool CPlane::HasDropOffCesnaBeenShotDown(void) { return DropOffCesnaMissionStatu
|
|||||||
class CPlane_ : public CPlane
|
class CPlane_ : public CPlane
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
void ctor(int32 id, uint8 CreatedBy) { ::new (this) CPlane(id, CreatedBy); }
|
void ctor(int32 id, uint8 CreatedBy) { ::new (this) CPlane(id, CreatedBy); }
|
||||||
void dtor(void) { CPlane::~CPlane(); }
|
void dtor(void) { CPlane::~CPlane(); }
|
||||||
=======
|
|
||||||
void dtor(void) { this->~CPlane(); }
|
|
||||||
>>>>>>> More audio ped
|
|
||||||
=======
|
|
||||||
void dtor(void) { CPlane::~CPlane(); }
|
|
||||||
>>>>>>> fix
|
|
||||||
};
|
};
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
@ -1,985 +0,0 @@
|
|||||||
#include "common.h"
|
|
||||||
#include "main.h"
|
|
||||||
#include "patcher.h"
|
|
||||||
#include "General.h"
|
|
||||||
#include "ModelIndices.h"
|
|
||||||
#include "FileMgr.h"
|
|
||||||
#include "Streaming.h"
|
|
||||||
#include "Replay.h"
|
|
||||||
#include "Camera.h"
|
|
||||||
#include "Coronas.h"
|
|
||||||
#include "Particle.h"
|
|
||||||
#include "Explosion.h"
|
|
||||||
#include "World.h"
|
|
||||||
#include "HandlingMgr.h"
|
|
||||||
#include "Plane.h"
|
|
||||||
|
|
||||||
CPlaneNode *&pPathNodes = *(CPlaneNode**)0x8F1B68;
|
|
||||||
CPlaneNode *&pPath2Nodes = *(CPlaneNode**)0x885B8C;
|
|
||||||
CPlaneNode *&pPath3Nodes = *(CPlaneNode**)0x885B78;
|
|
||||||
CPlaneNode *&pPath4Nodes = *(CPlaneNode**)0x885AD8;
|
|
||||||
int32 &NumPathNodes = *(int32*)0x8F2BE4;
|
|
||||||
int32 &NumPath2Nodes = *(int32*)0x941498;
|
|
||||||
int32 &NumPath3Nodes = *(int32*)0x9414D8;
|
|
||||||
int32 &NumPath4Nodes = *(int32*)0x9412C8;
|
|
||||||
float &TotalLengthOfFlightPath = *(float*)0x8F2C6C;
|
|
||||||
float &TotalLengthOfFlightPath2 = *(float*)0x64CFBC;
|
|
||||||
float &TotalLengthOfFlightPath3 = *(float*)0x64CFD0;
|
|
||||||
float &TotalLengthOfFlightPath4 = *(float*)0x64CFDC;
|
|
||||||
float &TotalDurationOfFlightPath = *(float*)0x64CFB8;
|
|
||||||
float &TotalDurationOfFlightPath2 = *(float*)0x64CFC0;
|
|
||||||
float &TotalDurationOfFlightPath3 = *(float*)0x64CFD4;
|
|
||||||
float &TotalDurationOfFlightPath4 = *(float*)0x64CFE0;
|
|
||||||
float &LandingPoint = *(float*)0x8F2C7C;
|
|
||||||
float &TakeOffPoint = *(float*)0x8E28A4;
|
|
||||||
CPlaneInterpolationLine *aPlaneLineBits = (CPlaneInterpolationLine*)0x734168; //[6]
|
|
||||||
|
|
||||||
float *PlanePathPosition = (float*)0x8F5FC8; //[3]
|
|
||||||
float *OldPlanePathPosition = (float*)0x8F5FBC; //[3]
|
|
||||||
float *PlanePathSpeed = (float*)0x941538; //[3]
|
|
||||||
float *PlanePath2Position = (float*)0x64CFC4; //[3]
|
|
||||||
float &PlanePath3Position = *(float*)0x64CFD8;
|
|
||||||
float &PlanePath4Position = *(float*)0x64CFE4;
|
|
||||||
float *PlanePath2Speed = (float*)0x8F1A54; //[3]
|
|
||||||
float &PlanePath3Speed = *(float*)0x8F1A94;
|
|
||||||
float &PlanePath4Speed = *(float*)0x8F1AFC;
|
|
||||||
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
CESNA_STATUS_NONE, // doesn't even exist
|
|
||||||
CESNA_STATUS_FLYING,
|
|
||||||
CESNA_STATUS_DESTROYED,
|
|
||||||
CESNA_STATUS_LANDED,
|
|
||||||
};
|
|
||||||
|
|
||||||
int32 &CesnaMissionStatus = *(int32*)0x64CFE8;
|
|
||||||
int32 &CesnaMissionStartTime = *(int32*)0x64CFEC;
|
|
||||||
CPlane *&pDrugRunCesna = *(CPlane**)0x8F5F80;
|
|
||||||
int32 &DropOffCesnaMissionStatus = *(int32*)0x64CFF0;
|
|
||||||
int32 &DropOffCesnaMissionStartTime = *(int32*)0x64CFF4;
|
|
||||||
CPlane *&pDropOffCesna = *(CPlane**)0x8E2A38;
|
|
||||||
|
|
||||||
|
|
||||||
CPlane::CPlane(int32 id, uint8 CreatedBy)
|
|
||||||
: CVehicle(CreatedBy)
|
|
||||||
{
|
|
||||||
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id);
|
|
||||||
m_vehType = VEHICLE_TYPE_PLANE;
|
|
||||||
pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId);
|
|
||||||
SetModelIndex(id);
|
|
||||||
|
|
||||||
m_fMass = 100000000.0f;
|
|
||||||
m_fTurnMass = 100000000.0f;
|
|
||||||
m_fAirResistance = 0.9994f;
|
|
||||||
m_fElasticity = 0.05f;
|
|
||||||
|
|
||||||
bUsesCollision = false;
|
|
||||||
m_bHasBeenHit = false;
|
|
||||||
m_bIsDrugRunCesna = false;
|
|
||||||
m_bIsDropOffCesna = false;
|
|
||||||
|
|
||||||
m_status = STATUS_PLANE;
|
|
||||||
bIsBIGBuilding = true;
|
|
||||||
m_level = LEVEL_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlane::~CPlane()
|
|
||||||
{
|
|
||||||
DeleteRwObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::SetModelIndex(uint32 id)
|
|
||||||
{
|
|
||||||
CVehicle::SetModelIndex(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::DeleteRwObject(void)
|
|
||||||
{
|
|
||||||
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
|
|
||||||
m_matrix.Detach();
|
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
|
|
||||||
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
|
||||||
RpAtomicDestroy((RpAtomic*)m_rwObject);
|
|
||||||
RwFrameDestroy(f);
|
|
||||||
}
|
|
||||||
m_rwObject = nil;
|
|
||||||
}
|
|
||||||
CEntity::DeleteRwObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
// There's a LOT of copy and paste in here. Maybe this could be refactored somehow
|
|
||||||
void
|
|
||||||
CPlane::ProcessControl(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
CVector pos;
|
|
||||||
|
|
||||||
// Explosion
|
|
||||||
if(m_bHasBeenHit){
|
|
||||||
// BUG: since this is all based on frames, you can skip the explosion processing when you go into the menu
|
|
||||||
if(GetModelIndex() == MI_AIRTRAIN){
|
|
||||||
int frm = CTimer::GetFrameCounter() - m_nFrameWhenHit;
|
|
||||||
if(frm == 20){
|
|
||||||
static int nFrameGen;
|
|
||||||
CRGBA colors[8];
|
|
||||||
|
|
||||||
CExplosion::AddExplosion(nil, FindPlayerPed(), EXPLOSION_HELI, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), 0);
|
|
||||||
|
|
||||||
colors[0] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[1] = CRGBA(224, 230, 238, 255);
|
|
||||||
colors[2] = CRGBA(224, 230, 238, 255);
|
|
||||||
colors[3] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[4] = CRGBA(224, 230, 238, 255);
|
|
||||||
colors[5] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[6] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[7] = CRGBA(224, 230, 238, 255);
|
|
||||||
|
|
||||||
CVector dir;
|
|
||||||
for(i = 0; i < 40; i++){
|
|
||||||
dir.x = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f);
|
|
||||||
dir.y = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f);
|
|
||||||
dir.z = CGeneral::GetRandomNumberInRange(0.0f, 2.0f);
|
|
||||||
int rotSpeed = CGeneral::GetRandomNumberInRange(10, 30);
|
|
||||||
if(CGeneral::GetRandomNumber() & 1)
|
|
||||||
rotSpeed = -rotSpeed;
|
|
||||||
int f = ++nFrameGen & 3;
|
|
||||||
CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), dir,
|
|
||||||
nil, CGeneral::GetRandomNumberInRange(0.1f, 1.0f),
|
|
||||||
colors[nFrameGen], rotSpeed, 0, f, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(frm >= 40 && frm <= 80 && frm & 1){
|
|
||||||
if(frm & 1){
|
|
||||||
pos.x = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.2f;
|
|
||||||
pos.z = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.2f;
|
|
||||||
pos.y = frm - 40;
|
|
||||||
pos = GetMatrix() * pos;
|
|
||||||
}else{
|
|
||||||
pos.x = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.2f;
|
|
||||||
pos.z = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.2f;
|
|
||||||
pos.y = 40 - frm;
|
|
||||||
pos = GetMatrix() * pos;
|
|
||||||
}
|
|
||||||
CExplosion::AddExplosion(nil, FindPlayerPed(), EXPLOSION_HELI, pos, 0);
|
|
||||||
}
|
|
||||||
if(frm == 60)
|
|
||||||
bRenderScorched = true;
|
|
||||||
if(frm == 82){
|
|
||||||
TheCamera.SetFadeColour(255, 255, 255);
|
|
||||||
TheCamera.Fade(0.0f, FADE_OUT);
|
|
||||||
TheCamera.ProcessFade();
|
|
||||||
TheCamera.Fade(1.0f, FADE_IN);
|
|
||||||
FlagToDestroyWhenNextProcessed();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
int frm = CTimer::GetFrameCounter() - m_nFrameWhenHit;
|
|
||||||
if(frm == 20){
|
|
||||||
static int nFrameGen;
|
|
||||||
CRGBA colors[8];
|
|
||||||
|
|
||||||
CExplosion::AddExplosion(nil, FindPlayerPed(), EXPLOSION_HELI, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), 0);
|
|
||||||
|
|
||||||
colors[0] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[1] = CRGBA(224, 230, 238, 255);
|
|
||||||
colors[2] = CRGBA(224, 230, 238, 255);
|
|
||||||
colors[3] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[4] = CRGBA(252, 66, 66, 255);
|
|
||||||
colors[5] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[6] = CRGBA(0, 0, 0, 255);
|
|
||||||
colors[7] = CRGBA(252, 66, 66, 255);
|
|
||||||
|
|
||||||
for(i = 0; i < 40; i++){
|
|
||||||
int rotSpeed = CGeneral::GetRandomNumberInRange(30.0f, 20.0f);
|
|
||||||
if(CGeneral::GetRandomNumber() & 1)
|
|
||||||
rotSpeed = -rotSpeed;
|
|
||||||
int f = ++nFrameGen & 3;
|
|
||||||
CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f),
|
|
||||||
CVector(CGeneral::GetRandomNumberInRange(-2.0f, 2.0f),
|
|
||||||
CGeneral::GetRandomNumberInRange(-2.0f, 2.0f),
|
|
||||||
CGeneral::GetRandomNumberInRange(0.0f, 2.0f)),
|
|
||||||
nil, CGeneral::GetRandomNumberInRange(0.1f, 1.0f),
|
|
||||||
colors[nFrameGen], rotSpeed, 0, f, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(frm >= 40 && frm <= 60 && frm & 1){
|
|
||||||
if(frm & 1){
|
|
||||||
pos.x = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.1f;
|
|
||||||
pos.z = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.1f;
|
|
||||||
pos.y = (frm - 40)*0.3f;
|
|
||||||
pos = GetMatrix() * pos;
|
|
||||||
}else{
|
|
||||||
pos.x = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.1f;
|
|
||||||
pos.z = ((CGeneral::GetRandomNumber() & 0x3F) - 32) * 0.1f;
|
|
||||||
pos.y = (40 - frm)*0.3f;
|
|
||||||
pos = GetMatrix() * pos;
|
|
||||||
}
|
|
||||||
CExplosion::AddExplosion(nil, FindPlayerPed(), EXPLOSION_HELI, pos, 0);
|
|
||||||
}
|
|
||||||
if(frm == 30)
|
|
||||||
bRenderScorched = true;
|
|
||||||
if(frm == 61){
|
|
||||||
TheCamera.SetFadeColour(200, 200, 200);
|
|
||||||
TheCamera.Fade(0.0f, FADE_OUT);
|
|
||||||
TheCamera.ProcessFade();
|
|
||||||
TheCamera.Fade(1.0f, FADE_IN);
|
|
||||||
if(m_bIsDrugRunCesna){
|
|
||||||
CesnaMissionStatus = CESNA_STATUS_DESTROYED;
|
|
||||||
pDrugRunCesna = nil;
|
|
||||||
}
|
|
||||||
if(m_bIsDropOffCesna){
|
|
||||||
DropOffCesnaMissionStatus = CESNA_STATUS_DESTROYED;
|
|
||||||
pDropOffCesna = nil;
|
|
||||||
}
|
|
||||||
FlagToDestroyWhenNextProcessed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update plane position and speed
|
|
||||||
if(GetModelIndex() == MI_AIRTRAIN || !m_isFarAway || ((CTimer::GetFrameCounter() + m_randomSeed) & 7) == 0){
|
|
||||||
if(GetModelIndex() == MI_AIRTRAIN){
|
|
||||||
float pathPositionRear = PlanePathPosition[m_nPlaneId] - 30.0f;
|
|
||||||
if(pathPositionRear < 0.0f)
|
|
||||||
pathPositionRear += TotalLengthOfFlightPath;
|
|
||||||
float pathPosition = pathPositionRear + 30.0f;
|
|
||||||
|
|
||||||
float pitch = 0.0f;
|
|
||||||
float distSinceTakeOff = pathPosition - TakeOffPoint;
|
|
||||||
if(distSinceTakeOff <= 0.0f && distSinceTakeOff > -70.0f){
|
|
||||||
// shortly before take off
|
|
||||||
pitch = 1.0f - distSinceTakeOff/-70.0f;
|
|
||||||
}else if(distSinceTakeOff >= 0.0f && distSinceTakeOff < 100.0f){
|
|
||||||
// shortly after take off
|
|
||||||
pitch = 1.0f - distSinceTakeOff/100.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float distSinceLanding = pathPosition - LandingPoint;
|
|
||||||
if(distSinceLanding <= 0.0f && distSinceLanding > -200.0f){
|
|
||||||
// shortly before landing
|
|
||||||
pitch = 1.0f - distSinceLanding/-200.0f;
|
|
||||||
}else if(distSinceLanding >= 0.0f && distSinceLanding < 70.0f){
|
|
||||||
// shortly after landing
|
|
||||||
pitch = 1.0f - distSinceLanding/70.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Advance current node to appropriate position
|
|
||||||
float pos1, pos2;
|
|
||||||
int nextTrackNode = m_nCurPathNode + 1;
|
|
||||||
pos1 = pPathNodes[m_nCurPathNode].t;
|
|
||||||
if(nextTrackNode < NumPathNodes)
|
|
||||||
pos2 = pPathNodes[nextTrackNode].t;
|
|
||||||
else{
|
|
||||||
nextTrackNode = 0;
|
|
||||||
pos2 = TotalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
while(pathPositionRear < pos1 || pathPositionRear > pos2){
|
|
||||||
m_nCurPathNode = (m_nCurPathNode+1) % NumPathNodes;
|
|
||||||
nextTrackNode = m_nCurPathNode + 1;
|
|
||||||
pos1 = pPathNodes[m_nCurPathNode].t;
|
|
||||||
if(nextTrackNode < NumPathNodes)
|
|
||||||
pos2 = pPathNodes[nextTrackNode].t;
|
|
||||||
else{
|
|
||||||
nextTrackNode = 0;
|
|
||||||
pos2 = TotalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool bothOnGround = pPathNodes[m_nCurPathNode].bOnGround && pPathNodes[nextTrackNode].bOnGround;
|
|
||||||
if(PlanePathPosition[m_nPlaneId] >= LandingPoint && OldPlanePathPosition[m_nPlaneId] < LandingPoint)
|
|
||||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_PLANE_ON_GROUND, 0.0f);
|
|
||||||
float dist = pPathNodes[nextTrackNode].t - pPathNodes[m_nCurPathNode].t;
|
|
||||||
if(dist < 0.0f)
|
|
||||||
dist += TotalLengthOfFlightPath;
|
|
||||||
float f = (pathPositionRear - pPathNodes[m_nCurPathNode].t)/dist;
|
|
||||||
CVector posRear = (1.0f - f)*pPathNodes[m_nCurPathNode].p + f*pPathNodes[nextTrackNode].p;
|
|
||||||
|
|
||||||
// Same for the front
|
|
||||||
float pathPositionFront = pathPositionRear + 60.0f;
|
|
||||||
if(pathPositionFront > TotalLengthOfFlightPath)
|
|
||||||
pathPositionFront -= TotalLengthOfFlightPath;
|
|
||||||
int curPathNodeFront = m_nCurPathNode;
|
|
||||||
int nextPathNodeFront = curPathNodeFront + 1;
|
|
||||||
pos1 = pPathNodes[curPathNodeFront].t;
|
|
||||||
if(nextPathNodeFront < NumPathNodes)
|
|
||||||
pos2 = pPathNodes[nextPathNodeFront].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront = 0;
|
|
||||||
pos2 = TotalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
while(pathPositionFront < pos1 || pathPositionFront > pos2){
|
|
||||||
curPathNodeFront = (curPathNodeFront+1) % NumPathNodes;
|
|
||||||
nextPathNodeFront = curPathNodeFront + 1;
|
|
||||||
pos1 = pPathNodes[curPathNodeFront].t;
|
|
||||||
if(nextPathNodeFront < NumPathNodes)
|
|
||||||
pos2 = pPathNodes[nextPathNodeFront].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront = 0;
|
|
||||||
pos2 = TotalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dist = pPathNodes[nextPathNodeFront].t - pPathNodes[curPathNodeFront].t;
|
|
||||||
if(dist < 0.0f)
|
|
||||||
dist += TotalLengthOfFlightPath;
|
|
||||||
f = (pathPositionFront - pPathNodes[curPathNodeFront].t)/dist;
|
|
||||||
CVector posFront = (1.0f - f)*pPathNodes[curPathNodeFront].p + f*pPathNodes[nextPathNodeFront].p;
|
|
||||||
|
|
||||||
// And for another point 60 units in front of the plane, used to calculate roll
|
|
||||||
float pathPositionFront2 = pathPositionFront + 60.0f;
|
|
||||||
if(pathPositionFront2 > TotalLengthOfFlightPath)
|
|
||||||
pathPositionFront2 -= TotalLengthOfFlightPath;
|
|
||||||
int curPathNodeFront2 = m_nCurPathNode;
|
|
||||||
int nextPathNodeFront2 = curPathNodeFront2 + 1;
|
|
||||||
pos1 = pPathNodes[curPathNodeFront2].t;
|
|
||||||
if(nextPathNodeFront2 < NumPathNodes)
|
|
||||||
pos2 = pPathNodes[nextPathNodeFront2].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront2 = 0;
|
|
||||||
pos2 = TotalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
while(pathPositionFront2 < pos1 || pathPositionFront2 > pos2){
|
|
||||||
curPathNodeFront2 = (curPathNodeFront2+1) % NumPathNodes;
|
|
||||||
nextPathNodeFront2 = curPathNodeFront2 + 1;
|
|
||||||
pos1 = pPathNodes[curPathNodeFront2].t;
|
|
||||||
if(nextPathNodeFront2 < NumPathNodes)
|
|
||||||
pos2 = pPathNodes[nextPathNodeFront2].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront2 = 0;
|
|
||||||
pos2 = TotalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dist = pPathNodes[nextPathNodeFront2].t - pPathNodes[curPathNodeFront2].t;
|
|
||||||
if(dist < 0.0f)
|
|
||||||
dist += TotalLengthOfFlightPath;
|
|
||||||
f = (pathPositionFront2 - pPathNodes[curPathNodeFront2].t)/dist;
|
|
||||||
CVector posFront2 = (1.0f - f)*pPathNodes[curPathNodeFront2].p + f*pPathNodes[nextPathNodeFront2].p;
|
|
||||||
|
|
||||||
// Now set matrix
|
|
||||||
GetPosition() = (posRear + posFront)/2.0f;
|
|
||||||
GetPosition().z += 4.3f;
|
|
||||||
CVector fwd = posFront - posRear;
|
|
||||||
fwd.Normalise();
|
|
||||||
if(pitch != 0.0f){
|
|
||||||
fwd.z += 0.4f*pitch;
|
|
||||||
fwd.Normalise();
|
|
||||||
}
|
|
||||||
CVector fwd2 = posFront2 - posRear;
|
|
||||||
fwd2.Normalise();
|
|
||||||
CVector roll = CrossProduct(fwd, fwd2);
|
|
||||||
CVector right = CrossProduct(fwd, CVector(0.0f, 0.0f, 1.0f));
|
|
||||||
if(!bothOnGround)
|
|
||||||
right.z += 3.0f*roll.z;
|
|
||||||
right.Normalise();
|
|
||||||
CVector up = CrossProduct(right, fwd);
|
|
||||||
GetRight() = right;
|
|
||||||
GetUp() = up;
|
|
||||||
GetForward() = fwd;
|
|
||||||
|
|
||||||
// Set speed
|
|
||||||
m_vecMoveSpeed = fwd*PlanePathSpeed[m_nPlaneId]/60.0f;
|
|
||||||
m_fSpeed = PlanePathSpeed[m_nPlaneId]/60.0f;
|
|
||||||
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
m_isFarAway = !((posFront - TheCamera.GetPosition()).Magnitude2D() < sq(300.0f));
|
|
||||||
}else{
|
|
||||||
float planePathPosition;
|
|
||||||
float totalLengthOfFlightPath;
|
|
||||||
CPlaneNode *pathNodes;
|
|
||||||
float planePathSpeed;
|
|
||||||
int numPathNodes;
|
|
||||||
|
|
||||||
if(m_bIsDrugRunCesna){
|
|
||||||
planePathPosition = PlanePath3Position;
|
|
||||||
totalLengthOfFlightPath = TotalLengthOfFlightPath3;
|
|
||||||
pathNodes = pPath3Nodes;
|
|
||||||
planePathSpeed = PlanePath3Speed;
|
|
||||||
numPathNodes = NumPath3Nodes;
|
|
||||||
if(CesnaMissionStatus == CESNA_STATUS_LANDED){
|
|
||||||
pDrugRunCesna = false;
|
|
||||||
FlagToDestroyWhenNextProcessed();
|
|
||||||
}
|
|
||||||
}else if(m_bIsDropOffCesna){
|
|
||||||
planePathPosition = PlanePath4Position;
|
|
||||||
totalLengthOfFlightPath = TotalLengthOfFlightPath4;
|
|
||||||
pathNodes = pPath4Nodes;
|
|
||||||
planePathSpeed = PlanePath4Speed;
|
|
||||||
numPathNodes = NumPath4Nodes;
|
|
||||||
if(DropOffCesnaMissionStatus == CESNA_STATUS_LANDED){
|
|
||||||
pDropOffCesna = false;
|
|
||||||
FlagToDestroyWhenNextProcessed();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
planePathPosition = PlanePath2Position[m_nPlaneId];
|
|
||||||
totalLengthOfFlightPath = TotalLengthOfFlightPath2;
|
|
||||||
pathNodes = pPath2Nodes;
|
|
||||||
planePathSpeed = PlanePath2Speed[m_nPlaneId];
|
|
||||||
numPathNodes = NumPath2Nodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Advance current node to appropriate position
|
|
||||||
float pathPositionRear = planePathPosition - 10.0f;
|
|
||||||
if(pathPositionRear < 0.0f)
|
|
||||||
pathPositionRear += totalLengthOfFlightPath;
|
|
||||||
float pos1, pos2;
|
|
||||||
int nextTrackNode = m_nCurPathNode + 1;
|
|
||||||
pos1 = pathNodes[m_nCurPathNode].t;
|
|
||||||
if(nextTrackNode < numPathNodes)
|
|
||||||
pos2 = pathNodes[nextTrackNode].t;
|
|
||||||
else{
|
|
||||||
nextTrackNode = 0;
|
|
||||||
pos2 = totalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
while(pathPositionRear < pos1 || pathPositionRear > pos2){
|
|
||||||
m_nCurPathNode = (m_nCurPathNode+1) % numPathNodes;
|
|
||||||
nextTrackNode = m_nCurPathNode + 1;
|
|
||||||
pos1 = pathNodes[m_nCurPathNode].t;
|
|
||||||
if(nextTrackNode < numPathNodes)
|
|
||||||
pos2 = pathNodes[nextTrackNode].t;
|
|
||||||
else{
|
|
||||||
nextTrackNode = 0;
|
|
||||||
pos2 = totalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
float dist = pathNodes[nextTrackNode].t - pathNodes[m_nCurPathNode].t;
|
|
||||||
if(dist < 0.0f)
|
|
||||||
dist += totalLengthOfFlightPath;
|
|
||||||
float f = (pathPositionRear - pathNodes[m_nCurPathNode].t)/dist;
|
|
||||||
CVector posRear = (1.0f - f)*pathNodes[m_nCurPathNode].p + f*pathNodes[nextTrackNode].p;
|
|
||||||
|
|
||||||
// Same for the front
|
|
||||||
float pathPositionFront = pathPositionRear + 20.0f;
|
|
||||||
if(pathPositionFront > totalLengthOfFlightPath)
|
|
||||||
pathPositionFront -= totalLengthOfFlightPath;
|
|
||||||
int curPathNodeFront = m_nCurPathNode;
|
|
||||||
int nextPathNodeFront = curPathNodeFront + 1;
|
|
||||||
pos1 = pathNodes[curPathNodeFront].t;
|
|
||||||
if(nextPathNodeFront < numPathNodes)
|
|
||||||
pos2 = pathNodes[nextPathNodeFront].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront = 0;
|
|
||||||
pos2 = totalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
while(pathPositionFront < pos1 || pathPositionFront > pos2){
|
|
||||||
curPathNodeFront = (curPathNodeFront+1) % numPathNodes;
|
|
||||||
nextPathNodeFront = curPathNodeFront + 1;
|
|
||||||
pos1 = pathNodes[curPathNodeFront].t;
|
|
||||||
if(nextPathNodeFront < numPathNodes)
|
|
||||||
pos2 = pathNodes[nextPathNodeFront].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront = 0;
|
|
||||||
pos2 = totalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dist = pathNodes[nextPathNodeFront].t - pathNodes[curPathNodeFront].t;
|
|
||||||
if(dist < 0.0f)
|
|
||||||
dist += totalLengthOfFlightPath;
|
|
||||||
f = (pathPositionFront - pathNodes[curPathNodeFront].t)/dist;
|
|
||||||
CVector posFront = (1.0f - f)*pathNodes[curPathNodeFront].p + f*pathNodes[nextPathNodeFront].p;
|
|
||||||
|
|
||||||
// And for another point 60 units in front of the plane, used to calculate roll
|
|
||||||
float pathPositionFront2 = pathPositionFront + 30.0f;
|
|
||||||
if(pathPositionFront2 > totalLengthOfFlightPath)
|
|
||||||
pathPositionFront2 -= totalLengthOfFlightPath;
|
|
||||||
int curPathNodeFront2 = m_nCurPathNode;
|
|
||||||
int nextPathNodeFront2 = curPathNodeFront2 + 1;
|
|
||||||
pos1 = pathNodes[curPathNodeFront2].t;
|
|
||||||
if(nextPathNodeFront2 < numPathNodes)
|
|
||||||
pos2 = pathNodes[nextPathNodeFront2].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront2 = 0;
|
|
||||||
pos2 = totalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
while(pathPositionFront2 < pos1 || pathPositionFront2 > pos2){
|
|
||||||
curPathNodeFront2 = (curPathNodeFront2+1) % numPathNodes;
|
|
||||||
nextPathNodeFront2 = curPathNodeFront2 + 1;
|
|
||||||
pos1 = pathNodes[curPathNodeFront2].t;
|
|
||||||
if(nextPathNodeFront2 < numPathNodes)
|
|
||||||
pos2 = pathNodes[nextPathNodeFront2].t;
|
|
||||||
else{
|
|
||||||
nextPathNodeFront2 = 0;
|
|
||||||
pos2 = totalLengthOfFlightPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dist = pathNodes[nextPathNodeFront2].t - pathNodes[curPathNodeFront2].t;
|
|
||||||
if(dist < 0.0f)
|
|
||||||
dist += totalLengthOfFlightPath;
|
|
||||||
f = (pathPositionFront2 - pathNodes[curPathNodeFront2].t)/dist;
|
|
||||||
CVector posFront2 = (1.0f - f)*pathNodes[curPathNodeFront2].p + f*pathNodes[nextPathNodeFront2].p;
|
|
||||||
|
|
||||||
// Now set matrix
|
|
||||||
GetPosition() = (posRear + posFront)/2.0f;
|
|
||||||
GetPosition().z += 1.0f;
|
|
||||||
CVector fwd = posFront - posRear;
|
|
||||||
fwd.Normalise();
|
|
||||||
CVector fwd2 = posFront2 - posRear;
|
|
||||||
fwd2.Normalise();
|
|
||||||
CVector roll = CrossProduct(fwd, fwd2);
|
|
||||||
CVector right = CrossProduct(fwd, CVector(0.0f, 0.0f, 1.0f));
|
|
||||||
right.z += 3.0f*roll.z;
|
|
||||||
right.Normalise();
|
|
||||||
CVector up = CrossProduct(right, fwd);
|
|
||||||
GetRight() = right;
|
|
||||||
GetUp() = up;
|
|
||||||
GetForward() = fwd;
|
|
||||||
|
|
||||||
// Set speed
|
|
||||||
m_vecMoveSpeed = fwd*planePathSpeed/60.0f;
|
|
||||||
m_fSpeed = planePathSpeed/60.0f;
|
|
||||||
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
m_isFarAway = !((posFront - TheCamera.GetPosition()).Magnitude2D() < sq(300.0f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bIsInSafePosition = true;
|
|
||||||
GetMatrix().UpdateRW();
|
|
||||||
UpdateRwFrame();
|
|
||||||
|
|
||||||
// Handle streaming and such
|
|
||||||
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
|
|
||||||
if(m_isFarAway){
|
|
||||||
// Switch to LOD model
|
|
||||||
if(m_rwObject && RwObjectGetType(m_rwObject) == rpCLUMP){
|
|
||||||
DeleteRwObject();
|
|
||||||
if(mi->m_planeLodId != -1){
|
|
||||||
m_rwObject = CModelInfo::GetModelInfo(mi->m_planeLodId)->CreateInstance();
|
|
||||||
if(m_rwObject)
|
|
||||||
m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if(CStreaming::HasModelLoaded(GetModelIndex())){
|
|
||||||
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
|
|
||||||
// Get rid of LOD model
|
|
||||||
m_matrix.Detach();
|
|
||||||
if(m_rwObject){ // useless check
|
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
|
|
||||||
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
|
||||||
RpAtomicDestroy((RpAtomic*)m_rwObject);
|
|
||||||
RwFrameDestroy(f);
|
|
||||||
}
|
|
||||||
m_rwObject = nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Set high detail model
|
|
||||||
if(m_rwObject == nil){
|
|
||||||
int id = GetModelIndex();
|
|
||||||
m_modelIndex = -1;
|
|
||||||
SetModelIndex(id);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
CStreaming::RequestModel(GetModelIndex(), STREAMFLAGS_DEPENDENCY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::PreRender(void)
|
|
||||||
{
|
|
||||||
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
|
|
||||||
|
|
||||||
CVector lookVector = GetPosition() - TheCamera.GetPosition();
|
|
||||||
float camDist = lookVector.Magnitude();
|
|
||||||
if(camDist != 0.0f)
|
|
||||||
lookVector *= 1.0f/camDist;
|
|
||||||
else
|
|
||||||
lookVector = CVector(1.0f, 0.0f, 0.0f);
|
|
||||||
float behindness = DotProduct(lookVector, GetForward());
|
|
||||||
|
|
||||||
// Wing lights
|
|
||||||
if(behindness < 0.0f){
|
|
||||||
// in front of plane
|
|
||||||
CVector lightPos = mi->m_positions[PLANE_POS_LIGHT_RIGHT];
|
|
||||||
CVector lightR = GetMatrix() * lightPos;
|
|
||||||
CVector lightL = lightR;
|
|
||||||
lightL -= GetRight()*2.0f*lightPos.x;
|
|
||||||
|
|
||||||
float intensity = -0.6f*behindness + 0.4f;
|
|
||||||
float size = 1.0f - behindness;
|
|
||||||
|
|
||||||
if(behindness < -0.9f && camDist < 50.0f){
|
|
||||||
// directly in front
|
|
||||||
CCoronas::RegisterCorona((uintptr)this + 10, 255*intensity, 255*intensity, 255*intensity, 255,
|
|
||||||
lightL, size, 240.0f,
|
|
||||||
CCoronas::TYPE_NORMAL, CCoronas::FLARE_HEADLIGHTS, CCoronas::REFLECTION_ON,
|
|
||||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
|
|
||||||
CCoronas::RegisterCorona((uintptr)this + 11, 255*intensity, 255*intensity, 255*intensity, 255,
|
|
||||||
lightR, size, 240.0f,
|
|
||||||
CCoronas::TYPE_NORMAL, CCoronas::FLARE_HEADLIGHTS, CCoronas::REFLECTION_ON,
|
|
||||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
|
|
||||||
}else{
|
|
||||||
CCoronas::RegisterCorona((uintptr)this + 10, 255*intensity, 255*intensity, 255*intensity, 255,
|
|
||||||
lightL, size, 240.0f,
|
|
||||||
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
|
||||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
|
|
||||||
CCoronas::RegisterCorona((uintptr)this + 11, 255*intensity, 255*intensity, 255*intensity, 255,
|
|
||||||
lightR, size, 240.0f,
|
|
||||||
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
|
||||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tail light
|
|
||||||
if(CTimer::GetTimeInMilliseconds() & 0x200){
|
|
||||||
CVector pos = GetMatrix() * mi->m_positions[PLANE_POS_LIGHT_TAIL];
|
|
||||||
|
|
||||||
CCoronas::RegisterCorona((uintptr)this + 12, 255, 0, 0, 255,
|
|
||||||
pos, 1.0f, 120.0f,
|
|
||||||
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
|
||||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::Render(void)
|
|
||||||
{
|
|
||||||
CEntity::Render();
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CRUISE_SPEED (50.0f)
|
|
||||||
#define TAXI_SPEED (5.0f)
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::InitPlanes(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
CesnaMissionStatus = CESNA_STATUS_NONE;
|
|
||||||
|
|
||||||
// Jumbo
|
|
||||||
if(pPathNodes == nil){
|
|
||||||
pPathNodes = LoadPath("data\\paths\\flight.dat", NumPathNodes, TotalLengthOfFlightPath, true);
|
|
||||||
|
|
||||||
// Figure out which nodes are on ground
|
|
||||||
CColPoint colpoint;
|
|
||||||
CEntity *entity;
|
|
||||||
for(i = 0; i < NumPathNodes; i++){
|
|
||||||
if(CWorld::ProcessVerticalLine(pPathNodes[i].p, 1000.0f, colpoint, entity, true, false, false, false, true, false, nil)){
|
|
||||||
pPathNodes[i].p.z = colpoint.point.z;
|
|
||||||
pPathNodes[i].bOnGround = true;
|
|
||||||
}else
|
|
||||||
pPathNodes[i].bOnGround = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find lading and takeoff points
|
|
||||||
LandingPoint = -1.0f;
|
|
||||||
TakeOffPoint = -1.0f;
|
|
||||||
bool lastOnGround = pPathNodes[NumPathNodes-1].bOnGround;
|
|
||||||
for(i = 0; i < NumPathNodes; i++){
|
|
||||||
if(pPathNodes[i].bOnGround && !lastOnGround)
|
|
||||||
LandingPoint = pPathNodes[i].t;
|
|
||||||
else if(!pPathNodes[i].bOnGround && lastOnGround)
|
|
||||||
TakeOffPoint = pPathNodes[i].t;
|
|
||||||
lastOnGround = pPathNodes[i].bOnGround;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Animation
|
|
||||||
float time = 0.0f;
|
|
||||||
float position = 0.0f;
|
|
||||||
// Start on ground with slow speed
|
|
||||||
aPlaneLineBits[0].type = 1;
|
|
||||||
aPlaneLineBits[0].time = time;
|
|
||||||
aPlaneLineBits[0].position = position;
|
|
||||||
aPlaneLineBits[0].speed = TAXI_SPEED;
|
|
||||||
aPlaneLineBits[0].acceleration = 0.0f;
|
|
||||||
float dist = (TakeOffPoint-600.0f) - position;
|
|
||||||
time += dist/TAXI_SPEED;
|
|
||||||
position += dist;
|
|
||||||
|
|
||||||
// Accelerate to take off
|
|
||||||
aPlaneLineBits[1].type = 2;
|
|
||||||
aPlaneLineBits[1].time = time;
|
|
||||||
aPlaneLineBits[1].position = position;
|
|
||||||
aPlaneLineBits[1].speed = TAXI_SPEED;
|
|
||||||
aPlaneLineBits[1].acceleration = 33.0f/32.0f;
|
|
||||||
time += 600.0f/((CRUISE_SPEED+TAXI_SPEED)/2.0f);
|
|
||||||
position += 600.0f;
|
|
||||||
|
|
||||||
// Fly at cruise speed
|
|
||||||
aPlaneLineBits[2].type = 1;
|
|
||||||
aPlaneLineBits[2].time = time;
|
|
||||||
aPlaneLineBits[2].position = position;
|
|
||||||
aPlaneLineBits[2].speed = CRUISE_SPEED;
|
|
||||||
aPlaneLineBits[2].acceleration = 0.0f;
|
|
||||||
dist = LandingPoint - TakeOffPoint;
|
|
||||||
time += dist/CRUISE_SPEED;
|
|
||||||
position += dist;
|
|
||||||
|
|
||||||
// Brake after landing
|
|
||||||
aPlaneLineBits[3].type = 2;
|
|
||||||
aPlaneLineBits[3].time = time;
|
|
||||||
aPlaneLineBits[3].position = position;
|
|
||||||
aPlaneLineBits[3].speed = CRUISE_SPEED;
|
|
||||||
aPlaneLineBits[3].acceleration = -33.0f/32.0f;
|
|
||||||
time += 600.0f/((CRUISE_SPEED+TAXI_SPEED)/2.0f);
|
|
||||||
position += 600.0f;
|
|
||||||
|
|
||||||
// Taxi
|
|
||||||
aPlaneLineBits[4].type = 1;
|
|
||||||
aPlaneLineBits[4].time = time;
|
|
||||||
aPlaneLineBits[4].position = position;
|
|
||||||
aPlaneLineBits[4].speed = TAXI_SPEED;
|
|
||||||
aPlaneLineBits[4].acceleration = 0.0f;
|
|
||||||
time += (TotalLengthOfFlightPath - position)/TAXI_SPEED;
|
|
||||||
|
|
||||||
// end
|
|
||||||
aPlaneLineBits[5].time = time;
|
|
||||||
TotalDurationOfFlightPath = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dodo
|
|
||||||
if(pPath2Nodes == nil){
|
|
||||||
pPath2Nodes = LoadPath("data\\paths\\flight2.dat", NumPath2Nodes, TotalLengthOfFlightPath2, true);
|
|
||||||
TotalDurationOfFlightPath2 = TotalLengthOfFlightPath2/CRUISE_SPEED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mission Cesna
|
|
||||||
if(pPath3Nodes == nil){
|
|
||||||
pPath3Nodes = LoadPath("data\\paths\\flight3.dat", NumPath3Nodes, TotalLengthOfFlightPath3, false);
|
|
||||||
TotalDurationOfFlightPath3 = TotalLengthOfFlightPath3/CRUISE_SPEED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mission Cesna
|
|
||||||
if(pPath4Nodes == nil){
|
|
||||||
pPath4Nodes = LoadPath("data\\paths\\flight4.dat", NumPath4Nodes, TotalLengthOfFlightPath4, false);
|
|
||||||
TotalDurationOfFlightPath4 = TotalLengthOfFlightPath4/CRUISE_SPEED;
|
|
||||||
}
|
|
||||||
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
CStreaming::RequestModel(MI_AIRTRAIN, 0);
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
|
|
||||||
for(i = 0; i < 3; i++){
|
|
||||||
CPlane *plane = new CPlane(MI_AIRTRAIN, PERMANENT_VEHICLE);
|
|
||||||
plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
|
|
||||||
plane->m_status = STATUS_ABANDONED;
|
|
||||||
plane->bIsLocked = true;
|
|
||||||
plane->m_nPlaneId = i;
|
|
||||||
plane->m_nCurPathNode = 0;
|
|
||||||
CWorld::Add(plane);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CStreaming::RequestModel(MI_DEADDODO, 0);
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
|
|
||||||
for(i = 0; i < 3; i++){
|
|
||||||
CPlane *plane = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE);
|
|
||||||
plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
|
|
||||||
plane->m_status = STATUS_ABANDONED;
|
|
||||||
plane->bIsLocked = true;
|
|
||||||
plane->m_nPlaneId = i;
|
|
||||||
plane->m_nCurPathNode = 0;
|
|
||||||
CWorld::Add(plane);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::Shutdown(void)
|
|
||||||
{
|
|
||||||
delete[] pPathNodes;
|
|
||||||
delete[] pPath2Nodes;
|
|
||||||
delete[] pPath3Nodes;
|
|
||||||
delete[] pPath4Nodes;
|
|
||||||
pPathNodes = nil;
|
|
||||||
pPath2Nodes = nil;
|
|
||||||
pPath3Nodes = nil;
|
|
||||||
pPath4Nodes = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlaneNode*
|
|
||||||
CPlane::LoadPath(char const *filename, int32 &numNodes, float &totalLength, bool loop)
|
|
||||||
{
|
|
||||||
int bp, lp;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
CFileMgr::LoadFile(filename, work_buff, sizeof(work_buff), "r");
|
|
||||||
*gString = '\0';
|
|
||||||
for(bp = 0, lp = 0; work_buff[bp] != '\n'; bp++, lp++)
|
|
||||||
gString[lp] = work_buff[bp];
|
|
||||||
bp++;
|
|
||||||
gString[lp] = '\0';
|
|
||||||
sscanf(gString, "%d", &numNodes);
|
|
||||||
CPlaneNode *nodes = new CPlaneNode[numNodes];
|
|
||||||
|
|
||||||
for(i = 0; i < numNodes; i++){
|
|
||||||
*gString = '\0';
|
|
||||||
for(lp = 0; work_buff[bp] != '\n'; bp++, lp++)
|
|
||||||
gString[lp] = work_buff[bp];
|
|
||||||
bp++;
|
|
||||||
// BUG: game doesn't terminate string
|
|
||||||
gString[lp] = '\0';
|
|
||||||
sscanf(gString, "%f %f %f", &nodes[i].p.x, &nodes[i].p.y, &nodes[i].p.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate length of segments and path
|
|
||||||
totalLength = 0.0f;
|
|
||||||
for(i = 0; i < numNodes; i++){
|
|
||||||
nodes[i].t = totalLength;
|
|
||||||
float l = (nodes[(i+1) % numNodes].p - nodes[i].p).Magnitude2D();
|
|
||||||
if(!loop && i == numNodes-1)
|
|
||||||
l = 0.0f;
|
|
||||||
totalLength += l;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::UpdatePlanes(void)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
uint32 time;
|
|
||||||
float t, deltaT;
|
|
||||||
|
|
||||||
if(CReplay::IsPlayingBack())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Jumbo jets
|
|
||||||
time = CTimer::GetTimeInMilliseconds();
|
|
||||||
for(i = 0; i < 3; i++){
|
|
||||||
t = TotalDurationOfFlightPath * (float)(time & 0x7FFFF)/0x80000;
|
|
||||||
// find current frame
|
|
||||||
for(j = 0; t > aPlaneLineBits[j+1].time; j++);
|
|
||||||
|
|
||||||
OldPlanePathPosition[i] = PlanePathPosition[i];
|
|
||||||
deltaT = t - aPlaneLineBits[j].time;
|
|
||||||
switch(aPlaneLineBits[j].type){
|
|
||||||
case 0: // standing still
|
|
||||||
PlanePathPosition[i] = aPlaneLineBits[j].position;
|
|
||||||
PlanePathSpeed[i] = 0.0f;
|
|
||||||
break;
|
|
||||||
case 1: // moving with constant speed
|
|
||||||
PlanePathPosition[i] = aPlaneLineBits[j].position + aPlaneLineBits[j].speed*deltaT;
|
|
||||||
PlanePathSpeed[i] = (TotalDurationOfFlightPath*1000.0f/0x80000) * aPlaneLineBits[j].speed;
|
|
||||||
break;
|
|
||||||
case 2: // accelerating/braking
|
|
||||||
PlanePathPosition[i] = aPlaneLineBits[j].position + (aPlaneLineBits[j].speed + aPlaneLineBits[j].acceleration*deltaT)*deltaT;
|
|
||||||
PlanePathSpeed[i] = (TotalDurationOfFlightPath*1000.0f/0x80000)*aPlaneLineBits[j].speed + 2.0f*aPlaneLineBits[j].acceleration*deltaT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// time offset for each plane
|
|
||||||
time += 0x80000/3;
|
|
||||||
}
|
|
||||||
|
|
||||||
time = CTimer::GetTimeInMilliseconds();
|
|
||||||
|
|
||||||
t = TotalDurationOfFlightPath2/0x80000;
|
|
||||||
PlanePath2Position[0] = CRUISE_SPEED * (time & 0x7FFFF)*t;
|
|
||||||
PlanePath2Position[1] = CRUISE_SPEED * ((time + 0x80000/3) & 0x7FFFF)*t;
|
|
||||||
PlanePath2Position[2] = CRUISE_SPEED * ((time + 0x80000/3*2) & 0x7FFFF)*t;
|
|
||||||
PlanePath2Speed[0] = CRUISE_SPEED*t;
|
|
||||||
PlanePath2Speed[1] = CRUISE_SPEED*t;
|
|
||||||
PlanePath2Speed[2] = CRUISE_SPEED*t;
|
|
||||||
|
|
||||||
if(CesnaMissionStatus == CESNA_STATUS_FLYING){
|
|
||||||
PlanePath3Speed = CRUISE_SPEED*TotalDurationOfFlightPath3/0x20000;
|
|
||||||
PlanePath3Position = PlanePath3Speed * ((time - CesnaMissionStartTime) & 0x1FFFF);
|
|
||||||
if(time - CesnaMissionStartTime >= 128072)
|
|
||||||
CesnaMissionStatus = CESNA_STATUS_LANDED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(DropOffCesnaMissionStatus == CESNA_STATUS_FLYING){
|
|
||||||
PlanePath4Speed = CRUISE_SPEED*TotalDurationOfFlightPath4/0x80000;
|
|
||||||
PlanePath4Position = PlanePath4Speed * ((time - DropOffCesnaMissionStartTime) & 0x7FFFF);
|
|
||||||
if(time - DropOffCesnaMissionStartTime >= 521288)
|
|
||||||
DropOffCesnaMissionStatus = CESNA_STATUS_LANDED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
CPlane::TestRocketCollision(CVector *rocketPos)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
i = CPools::GetVehiclePool()->GetSize();
|
|
||||||
while(--i >= 0){
|
|
||||||
CPlane *plane = (CPlane*)CPools::GetVehiclePool()->GetSlot(i);
|
|
||||||
if(plane &&
|
|
||||||
#ifdef EXPLODING_AIRTRAIN
|
|
||||||
(plane->GetModelIndex() == MI_AIRTRAIN || plane->GetModelIndex() == MI_DODO) &&
|
|
||||||
#else
|
|
||||||
plane->GetModelIndex() != MI_AIRTRAIN && plane->GetModelIndex() == MI_DODO && // strange check
|
|
||||||
#endif
|
|
||||||
!plane->m_bHasBeenHit && (*rocketPos - plane->GetPosition()).Magnitude() < 25.0f){
|
|
||||||
plane->m_nFrameWhenHit = CTimer::GetFrameCounter();
|
|
||||||
plane->m_bHasBeenHit = true;
|
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->RegisterCrime_Immediately(CRIME_DESTROYED_CESSNA,
|
|
||||||
plane->GetPosition(), i+1983, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BUG: not in CPlane in the game
|
|
||||||
void
|
|
||||||
CPlane::CreateIncomingCesna(void)
|
|
||||||
{
|
|
||||||
if(CesnaMissionStatus == CESNA_STATUS_FLYING){
|
|
||||||
CWorld::Remove(pDrugRunCesna);
|
|
||||||
delete pDrugRunCesna;
|
|
||||||
pDrugRunCesna = nil;
|
|
||||||
}
|
|
||||||
pDrugRunCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE);
|
|
||||||
pDrugRunCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
|
|
||||||
pDrugRunCesna->m_status = STATUS_ABANDONED;
|
|
||||||
pDrugRunCesna->bIsLocked = true;
|
|
||||||
pDrugRunCesna->m_nPlaneId = 0;
|
|
||||||
pDrugRunCesna->m_nCurPathNode = 0;
|
|
||||||
pDrugRunCesna->m_bIsDrugRunCesna = true;
|
|
||||||
CWorld::Add(pDrugRunCesna);
|
|
||||||
|
|
||||||
CesnaMissionStatus = CESNA_STATUS_FLYING;
|
|
||||||
CesnaMissionStartTime = CTimer::GetTimeInMilliseconds();
|
|
||||||
printf("CPlane::CreateIncomingCesna(void)\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPlane::CreateDropOffCesna(void)
|
|
||||||
{
|
|
||||||
if(DropOffCesnaMissionStatus == CESNA_STATUS_FLYING){
|
|
||||||
CWorld::Remove(pDropOffCesna);
|
|
||||||
delete pDropOffCesna;
|
|
||||||
pDropOffCesna = nil;
|
|
||||||
}
|
|
||||||
pDropOffCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE);
|
|
||||||
pDropOffCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
|
|
||||||
pDropOffCesna->m_status = STATUS_ABANDONED;
|
|
||||||
pDropOffCesna->bIsLocked = true;
|
|
||||||
pDropOffCesna->m_nPlaneId = 0;
|
|
||||||
pDropOffCesna->m_nCurPathNode = 0;
|
|
||||||
pDropOffCesna->m_bIsDropOffCesna = true;
|
|
||||||
CWorld::Add(pDropOffCesna);
|
|
||||||
|
|
||||||
DropOffCesnaMissionStatus = CESNA_STATUS_FLYING;
|
|
||||||
DropOffCesnaMissionStartTime = CTimer::GetTimeInMilliseconds();
|
|
||||||
printf("CPlane::CreateDropOffCesna(void)\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
CVector CPlane::FindDrugPlaneCoordinates(void) { return pDrugRunCesna->GetPosition(); }
|
|
||||||
CVector CPlane::FindDropOffCesnaCoordinates(void) { return pDrugRunCesna->GetPosition(); }
|
|
||||||
bool CPlane::HasCesnaLanded(void) { return CesnaMissionStatus == CESNA_STATUS_LANDED; }
|
|
||||||
bool CPlane::HasCesnaBeenDestroyed(void) { return CesnaMissionStatus == CESNA_STATUS_DESTROYED; }
|
|
||||||
bool CPlane::HasDropOffCesnaBeenShotDown(void) { return DropOffCesnaMissionStatus == CESNA_STATUS_DESTROYED; }
|
|
||||||
|
|
||||||
|
|
||||||
class CPlane_ : public CPlane
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void ctor(int32 id, uint8 CreatedBy) { ::new (this) CPlane(id, CreatedBy); }
|
|
||||||
void dtor(void) { CPlane::~CPlane(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
STARTPATCHES
|
|
||||||
InjectHook(0x54B170, &CPlane_::ctor, PATCH_JUMP);
|
|
||||||
InjectHook(0x54B270, &CPlane_::dtor, PATCH_JUMP);
|
|
||||||
InjectHook(0x54B820, CPlane::InitPlanes, PATCH_JUMP);
|
|
||||||
InjectHook(0x54BCD0, CPlane::Shutdown, PATCH_JUMP);
|
|
||||||
InjectHook(0x54BD50, CPlane::LoadPath, PATCH_JUMP);
|
|
||||||
InjectHook(0x54BEC0, CPlane::UpdatePlanes, PATCH_JUMP);
|
|
||||||
InjectHook(0x54DE90, CPlane::TestRocketCollision, PATCH_JUMP);
|
|
||||||
InjectHook(0x54E000, CPlane::CreateIncomingCesna, PATCH_JUMP);
|
|
||||||
InjectHook(0x54E160, CPlane::CreateDropOffCesna, PATCH_JUMP);
|
|
||||||
ENDPATCHES
|
|
@ -97,8 +97,8 @@ CVehicle::CVehicle(uint8 CreatedBy)
|
|||||||
DMAudio.SetEntityStatus(m_audioEntityId, true);
|
DMAudio.SetEntityStatus(m_audioEntityId, true);
|
||||||
m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK;
|
m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK;
|
||||||
m_pCurGroundEntity = nil;
|
m_pCurGroundEntity = nil;
|
||||||
field_22A = 0;
|
m_bRainAudioCounter = 0;
|
||||||
field_22B = 0;
|
m_bRainSamplesCounter = 0;
|
||||||
m_comedyControlState = 0;
|
m_comedyControlState = 0;
|
||||||
m_aCollPolys[0].valid = false;
|
m_aCollPolys[0].valid = false;
|
||||||
m_aCollPolys[1].valid = false;
|
m_aCollPolys[1].valid = false;
|
||||||
@ -273,7 +273,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
|||||||
right = -contactSpeedRight/wheelsOnGround;
|
right = -contactSpeedRight/wheelsOnGround;
|
||||||
|
|
||||||
if(wheelStatus == WHEEL_STATUS_BURST){
|
if(wheelStatus == WHEEL_STATUS_BURST){
|
||||||
float fwdspeed = Min(contactSpeedFwd, 0.3f);
|
float fwdspeed = min(contactSpeedFwd, 0.3f);
|
||||||
right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,7 +363,7 @@ CVehicle::ProcessWheelRotation(tWheelState state, const CVector &fwd, const CVec
|
|||||||
void
|
void
|
||||||
CVehicle::ExtinguishCarFire(void)
|
CVehicle::ExtinguishCarFire(void)
|
||||||
{
|
{
|
||||||
m_fHealth = Max(m_fHealth, 300.0f);
|
m_fHealth = max(m_fHealth, 300.0f);
|
||||||
if(m_pCarFire)
|
if(m_pCarFire)
|
||||||
m_pCarFire->Extinguish();
|
m_pCarFire->Extinguish();
|
||||||
if(IsCar()){
|
if(IsCar()){
|
||||||
@ -638,13 +638,13 @@ CVehicle::SetDriver(CPed *driver)
|
|||||||
|
|
||||||
if(bFreebies && driver == FindPlayerPed()){
|
if(bFreebies && driver == FindPlayerPed()){
|
||||||
if(GetModelIndex() == MI_AMBULAN)
|
if(GetModelIndex() == MI_AMBULAN)
|
||||||
FindPlayerPed()->m_fHealth = Min(FindPlayerPed()->m_fHealth + 20.0f, 100.0f);
|
FindPlayerPed()->m_fHealth = min(FindPlayerPed()->m_fHealth + 20.0f, 100.0f);
|
||||||
else if(GetModelIndex() == MI_TAXI)
|
else if(GetModelIndex() == MI_TAXI)
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
||||||
else if(GetModelIndex() == MI_POLICE)
|
else if(GetModelIndex() == MI_POLICE)
|
||||||
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
|
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
|
||||||
else if(GetModelIndex() == MI_ENFORCER)
|
else if(GetModelIndex() == MI_ENFORCER)
|
||||||
driver->m_fArmour = Max(driver->m_fArmour, 100.0f);
|
driver->m_fArmour = max(driver->m_fArmour, 100.0f);
|
||||||
else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE)
|
else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE)
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
||||||
bFreebies = false;
|
bFreebies = false;
|
||||||
|
@ -191,8 +191,8 @@ public:
|
|||||||
eCarLock m_nDoorLock;
|
eCarLock m_nDoorLock;
|
||||||
int8 m_nLastWeaponDamage; // see eWeaponType, -1 if no damage
|
int8 m_nLastWeaponDamage; // see eWeaponType, -1 if no damage
|
||||||
int8 m_nRadioStation;
|
int8 m_nRadioStation;
|
||||||
int8 field_22A;
|
uint8 m_bRainAudioCounter;
|
||||||
int8 field_22B;
|
uint8 m_bRainSamplesCounter;
|
||||||
uint8 m_nCarHornTimer;
|
uint8 m_nCarHornTimer;
|
||||||
int8 field_22D;
|
int8 field_22D;
|
||||||
bool m_bSirenOrAlarm;
|
bool m_bSirenOrAlarm;
|
||||||
|
Loading…
Reference in New Issue
Block a user