mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 17:40:00 +00:00
Cleanup
This commit is contained in:
parent
2fabbc3b4c
commit
01ac2929cd
|
@ -185,7 +185,7 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
|||
if(blendAmount <= 0.0f && blendDelta < 0.0f){
|
||||
// We're faded out and are not fading in
|
||||
blendAmount = 0.0f;
|
||||
blendDelta = Max(0.0f, blendDelta);
|
||||
blendDelta = max(0.0f, blendDelta);
|
||||
if(flags & ASSOC_DELETEFADEDOUT){
|
||||
if(callbackType == CB_FINISH || callbackType == CB_DELETE)
|
||||
callback(this, callbackArg);
|
||||
|
@ -197,7 +197,7 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
|||
if(blendAmount > 1.0f){
|
||||
// Maximally faded in, clamp values
|
||||
blendAmount = 1.0f;
|
||||
blendDelta = Min(0.0f, blendDelta);
|
||||
blendDelta = min(0.0f, blendDelta);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -36,7 +36,7 @@ CAnimBlendHierarchy::CalcTotalTime(void)
|
|||
float seqTime = 0.0f;
|
||||
for(j = 0; j < sequences[i].numFrames; j++)
|
||||
seqTime += sequences[i].GetKeyFrame(j)->deltaTime;
|
||||
totalTime = Max(totalTime, seqTime);
|
||||
totalTime = max(totalTime, seqTime);
|
||||
}
|
||||
totalLength = totalTime;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -49,8 +49,8 @@ public:
|
|||
uint8 field_89;
|
||||
uint8 field_90;
|
||||
uint8 field_91;
|
||||
|
||||
// no methods
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(tActiveSample) == 92, "tActiveSample: error");
|
||||
|
@ -88,8 +88,8 @@ public:
|
|||
float m_afVolume[4];
|
||||
uint8 m_Loops;
|
||||
uint8 field_25[3];
|
||||
|
||||
// no methods
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
|
||||
|
@ -104,8 +104,8 @@ public:
|
|||
uint8 m_bVolume;
|
||||
int8 field_25; // allocated time?
|
||||
uint8 gap_26[2];
|
||||
|
||||
// no methods
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(tPedComment) == 28, "tPedComment: error");
|
||||
|
@ -119,7 +119,7 @@ public:
|
|||
uint8 activeBank;
|
||||
uint8 gap_1163[1];
|
||||
|
||||
// reversed all methods
|
||||
// reversed all methods
|
||||
void Add(tPedComment *com); /// ok
|
||||
void Process(); /// ok
|
||||
};
|
||||
|
@ -142,8 +142,8 @@ public:
|
|||
CVector m_vecPosition;
|
||||
float m_fDistance;
|
||||
int32 m_nBaseVolume;
|
||||
|
||||
// no methods
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error");
|
||||
|
@ -157,6 +157,8 @@ public:
|
|||
uint8 m_bCollisionsInQueue;
|
||||
uint8 gap_811;
|
||||
cAudioCollision m_sQueue;
|
||||
|
||||
void AddCollisionToRequestedQueue(); // todo
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");
|
||||
|
@ -177,6 +179,7 @@ public:
|
|||
uint8 field_29;
|
||||
uint8 field_30;
|
||||
uint8 field_31;
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
|
||||
|
@ -188,7 +191,8 @@ class CPed;
|
|||
class cPedParams;
|
||||
class cTransmission;
|
||||
|
||||
class cAudioScriptObject {
|
||||
class cAudioScriptObject
|
||||
{
|
||||
public:
|
||||
int16 AudioId;
|
||||
char _pad0[2];
|
||||
|
@ -220,22 +224,14 @@ enum {
|
|||
MAX_REFLECTIONS,
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
enum AudioEntityHandle
|
||||
{
|
||||
AEHANDLE_NONE = -5,
|
||||
AEHANDLE_ERROR_NOAUDIOSYS = -4,
|
||||
AEHANDLE_ERROR_NOFREESLOT = -3,
|
||||
AEHANDLE_ERROR_NOENTITY = -2,
|
||||
enum AudioEntityHandle {
|
||||
AEHANDLE_NONE = -5,
|
||||
AEHANDLE_ERROR_NOAUDIOSYS = -4,
|
||||
AEHANDLE_ERROR_NOFREESLOT = -3,
|
||||
AEHANDLE_ERROR_NOENTITY = -2,
|
||||
AEHANDLE_ERROR_BADAUDIOTYPE = -1,
|
||||
};
|
||||
|
||||
#define AEHANDLE_IS_FAILED(h) ((h)<0)
|
||||
#define AEHANDLE_IS_OK(h) ((h)>=0)
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> Cleanup
|
||||
class cAudioManager
|
||||
{
|
||||
public:
|
||||
|
@ -285,22 +281,10 @@ public:
|
|||
uint8 field_19195; // time?
|
||||
uint32 m_FrameCounter;
|
||||
|
||||
<<<<<<< HEAD
|
||||
inline uint32 GetFrameCounter(void) { return m_FrameCounter; }
|
||||
float GetReflectionsDistance(int32 idx) { return m_afReflectionsDistances[idx]; }
|
||||
<<<<<<< HEAD
|
||||
int32 GetRandomNumber(int32 idx) { return m_anRandomTable[idx]; }
|
||||
=======
|
||||
int32 GetRandomTabe(int32 idx) { return m_anRandomTable[idx]; }
|
||||
|
||||
>>>>>>> Cleanup
|
||||
//
|
||||
=======
|
||||
// getters
|
||||
uint32 GetFrameCounter() const { return m_FrameCounter; }
|
||||
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
||||
int32 GetRandomTabe(int32 idx) const { return m_anRandomTable[idx]; }
|
||||
>>>>>>> More more more audio
|
||||
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
|
||||
|
||||
// "Should" be in alphabetic order, except "getXTalkSfx"
|
||||
void AddDetailsToRequestedOrderList(uint8 sample); /// ok
|
||||
|
@ -312,80 +296,22 @@ public:
|
|||
void AgeCrimes(); // todo
|
||||
|
||||
void CalculateDistance(bool *ptr, float dist); /// ok
|
||||
bool CheckForAnAudioFileOnCD() const; /// ok
|
||||
bool CheckForAnAudioFileOnCD() const; /// ok
|
||||
void ClearMissionAudio(); /// ok
|
||||
void ClearRequestedQueue(); /// ok
|
||||
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
|
||||
float speedMultiplier) const; /// ok
|
||||
int32 ComputePan(float, CVector *); // todo
|
||||
<<<<<<< HEAD
|
||||
uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance); /// ok
|
||||
int32 CreateEntity(int32 type, void *entity); /// ok
|
||||
=======
|
||||
float speedMultiplier) const; /// ok
|
||||
int32 ComputePan(float, CVector *); // todo
|
||||
uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance) const; /// ok
|
||||
int32 CreateEntity(int32 type, CPhysical *entity); /// ok
|
||||
>>>>>>> More more more audio
|
||||
int32 CreateEntity(int32 type, CPhysical *entity); /// ok
|
||||
|
||||
void DestroyAllGameCreatedEntities(); /// ok
|
||||
void DestroyEntity(int32 id); /// ok
|
||||
void DoJumboVolOffset() const; /// ok
|
||||
void DoPoliceRadioCrackle(); /// ok
|
||||
|
||||
void GenerateIntegerRandomNumberTable(); /// ok
|
||||
|
||||
void TranslateEntity(CVector *v1, CVector *v2) const ; /// ok
|
||||
|
||||
void ResetAudioLogicTimers(int32 timer); /// ok
|
||||
|
||||
void Terminate();
|
||||
uint8 GetNum3DProvidersAvailable() const;
|
||||
bool IsMP3RadioChannelAvailable() const;
|
||||
uint8 GetCDAudioDriveLetter() const;
|
||||
|
||||
void SetEffectsMasterVolume(uint8 volume) const;
|
||||
void SetMusicMasterVolume(uint8 volume) const;
|
||||
void SetEffectsFadeVolume(uint8 volume) const;
|
||||
void SetMusicFadeVolume(uint8 volume) const;
|
||||
|
||||
void SetSpeakerConfig(int32 conf) const;
|
||||
|
||||
bool SetupJumboEngineSound(uint8, int32); // todo
|
||||
void PreInitialiseGameSpecificSetup() const;
|
||||
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
||||
|
||||
bool UsesSiren(int32 model) const;
|
||||
bool UsesSirenSwitching(int32 model) const;
|
||||
|
||||
char *Get3DProviderName(uint8 id) const;
|
||||
|
||||
bool SetupJumboFlySound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboTaxiSound(uint8 vol); /// ok
|
||||
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
|
||||
|
||||
void SetMissionAudioLocation(float x, float y, float z);
|
||||
|
||||
void ResetPoliceRadio();
|
||||
|
||||
bool UsesReverseWarning(int32 model) const;
|
||||
|
||||
int32 RandomDisplacement(uint32 seed) const;
|
||||
|
||||
void ReleaseDigitalHandle() const;
|
||||
void ReacquireDigitalHandle() const;
|
||||
void SetDynamicAcousticModelingStatus(bool status);
|
||||
|
||||
bool IsAudioInitialised() const;
|
||||
|
||||
void SetEntityStatus(int32 id, bool status);
|
||||
|
||||
void Service();
|
||||
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
|
||||
|
||||
void DoJumboVolOffset() const;
|
||||
|
||||
int32 GetPedCommentSfx(CPed *ped, int32 sound);
|
||||
|
||||
// order from GetPedCommentSfx
|
||||
// functions returning talk sfx,
|
||||
// order from GetPedCommentSfx
|
||||
uint32 GetPlayerTalkSfx(int16 sound);
|
||||
uint32 GetCopTalkSfx(int16 sound);
|
||||
uint32 GetSwatTalkSfx(int16 sound);
|
||||
|
@ -462,15 +388,22 @@ public:
|
|||
|
||||
uint32 GetGenericMaleTalkSfx(int16 sound);
|
||||
uint32 GetGenericFemaleTalkSfx(int16 sound);
|
||||
// end of functions returning talk sfx
|
||||
|
||||
void GenerateIntegerRandomNumberTable(); /// ok
|
||||
char *Get3DProviderName(uint8 id) const;
|
||||
uint8 GetCDAudioDriveLetter() const;
|
||||
int8 GetCurrent3DProviderIndex() const; /// ok
|
||||
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // todo hook
|
||||
float GetCollisionOneShotRatio(uint32 a, float b) const; // todo hook
|
||||
float GetCollisionRatio(float a, float b, float c, float d) const; // todo hook
|
||||
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
|
||||
float GetCollisionOneShotRatio(uint32 a, float b) const; /// ok
|
||||
float GetCollisionRatio(float a, float b, float c, float d) const; /// ok
|
||||
float GetDistanceSquared(CVector *v) const; /// ok
|
||||
int32 GetJumboTaxiFreq() const; /// ok
|
||||
bool GetMissionAudioLoadingStatus() const; /// ok
|
||||
char GetMissionScriptPoliceAudioPlayingStatus() const; /// ok
|
||||
uint8 GetNum3DProvidersAvailable() const;
|
||||
int32 GetPedCommentSfx(CPed *ped, int32 sound);
|
||||
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
|
||||
float GetVehicleDriveWheelSkidValue(uint8 a1, CAutomobile *a2, cTransmission *a3,
|
||||
float a4); // todo
|
||||
int32 GetVehicleNonDriveWheelSkidValue(float a1, int a2, int a3, int a4, float a5); // todo
|
||||
|
@ -481,19 +414,22 @@ public:
|
|||
void InitialisePoliceRadio(); // todo
|
||||
void InitialisePoliceRadioZones(); // todo
|
||||
void InterrogateAudioEntities(); /// ok
|
||||
bool IsAudioInitialised() const; /// ok
|
||||
bool IsMissionAudioSampleFinished(); /// ok
|
||||
bool IsMP3RadioChannelAvailable() const;
|
||||
|
||||
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok
|
||||
|
||||
void PlayLoadedMissionAudio(); /// ok
|
||||
void PlayOneShot(int32 index, int16 sound, float vol); // todo
|
||||
uint32 PlaySuspectLastSeen(float x, float y, float z); // todo
|
||||
void PlayerJustGotInCar() const; /// ok
|
||||
void PlayerJustLeftCar() const; /// ok
|
||||
uint32 PlaySuspectLastSeen(float x, float y, float z); // todo
|
||||
void PlayerJustGotInCar() const; /// ok
|
||||
void PlayerJustLeftCar() const; /// ok
|
||||
void PostInitialiseGameSpecificSetup(); /// ok
|
||||
void PostTerminateGameSpecificShutdown(); /// ok
|
||||
void PreTerminateGameSpecificShutdown(); /// ok
|
||||
void PreloadMissionAudio(char *); // todo
|
||||
void PreInitialiseGameSpecificSetup() const;
|
||||
void PreloadMissionAudio(char *); // todo
|
||||
void PreTerminateGameSpecificShutdown(); /// ok
|
||||
/// processX - main logic of adding new sounds
|
||||
void ProcessActiveQueues(); // todo
|
||||
bool ProcessAirBrakes(cVehicleParams *params); /// ok
|
||||
|
@ -541,7 +477,7 @@ public:
|
|||
void ProcessPornCinema(uint8 sound); /// ok
|
||||
void ProcessProjectiles(); // todo requires CProjectileInfo
|
||||
void ProcessRainOnVehicle(cVehicleParams *params); /// ok
|
||||
void ProcessReverb() const; /// ok
|
||||
void ProcessReverb() const; /// ok
|
||||
bool ProcessReverseGear(cVehicleParams *a2); /// ok
|
||||
void ProcessSawMillScriptObject(uint8 sound); /// ok
|
||||
void ProcessScriptObject(int32 id); /// ok
|
||||
|
@ -558,11 +494,55 @@ public:
|
|||
// void ProcessVehicleSirenOrAlarm(void *);
|
||||
// void ProcessVehicleSkidding(void *);
|
||||
void ProcessWaterCannon(int32); // todo
|
||||
void ProcessWeather(int32 id); // todo
|
||||
bool ProcessWetRoadNoise(cVehicleParams *params); // todo hook
|
||||
void ProcessWeather(int32 id); /// ok
|
||||
bool ProcessWetRoadNoise(cVehicleParams *params); /// ok
|
||||
void ProcessWorkShopScriptObject(uint8 sound); /// ok
|
||||
|
||||
void SetupPedComments(cPedParams *params, uint32 sound); /// ok
|
||||
int32 RandomDisplacement(uint32 seed) const;
|
||||
void ReacquireDigitalHandle() const;
|
||||
void ReleaseDigitalHandle() const;
|
||||
int32 ReportCollision(CEntity *a2, CEntity *a3, uint8 a4, uint8 a5, float a6,
|
||||
float a7); // todo
|
||||
int32 ReportCrime(int a2, int *a3); // todo
|
||||
void ResetAudioLogicTimers(int32 timer); /// ok
|
||||
void ResetPoliceRadio();
|
||||
void ResetTimers(unsigned int a2); // todo
|
||||
|
||||
void Service(); // todo
|
||||
void ServiceCollisions(); // todo
|
||||
void ServicePoliceRadio(); // todo
|
||||
void ServicePoliceRadioChannel(int a2); // todo
|
||||
void ServiceSoundEffects(); // todo
|
||||
void SetCurrent3DProvider(uint8);
|
||||
void SetDynamicAcousticModelingStatus(bool status);
|
||||
void SetEffectsFadeVolume(uint8 volume) const;
|
||||
void SetEffectsMasterVolume(uint8 volume) const;
|
||||
void SetEntityStatus(int32 id, bool status);
|
||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(int32); // todo
|
||||
void SetMissionAudioLocation(float x, float y, float z);
|
||||
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
||||
void SetMonoMode(uint8); // todo
|
||||
void SetMusicFadeVolume(uint8 volume) const;
|
||||
void SetMusicMasterVolume(uint8 volume) const;
|
||||
void SetSpeakerConfig(int32 conf) const;
|
||||
void SetUpLoopingCollisionSound(int a2, int a3); // todo
|
||||
void SetUpOneShotCollisionSound(int a2); // todo
|
||||
void SetupCrimeReport(); // todo
|
||||
bool SetupJumboEngineSound(uint8, int32); // todo
|
||||
bool SetupJumboFlySound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboTaxiSound(uint8 vol); /// ok
|
||||
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
|
||||
void SetupPedComments(cPedParams *params, uint32 sound); /// ok
|
||||
void SetupSuspectLastSeenReport(); // todo
|
||||
|
||||
void Terminate();
|
||||
void TranslateEntity(CVector *v1, CVector *v2) const; /// ok
|
||||
|
||||
void UpdateGasPedalAudio(CAutomobile *automobile); // todo hook
|
||||
bool UsesReverseWarning(int32 model) const;
|
||||
bool UsesSiren(int32 model) const;
|
||||
bool UsesSirenSwitching(int32 model) const;
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
||||
|
|
549
src/audio/AudioManager.h.autosave
Normal file
549
src/audio/AudioManager.h.autosave
Normal file
|
@ -0,0 +1,549 @@
|
|||
#pragma once
|
||||
|
||||
#include "AudioSamples.h"
|
||||
#include "DMAudio.h"
|
||||
#include "common.h"
|
||||
|
||||
class tActiveSample
|
||||
{
|
||||
public:
|
||||
int32 m_nEntityIndex;
|
||||
int32 m_counter;
|
||||
int32 m_nSampleIndex;
|
||||
uint8 m_bBankIndex;
|
||||
uint8 m_bIsDistant;
|
||||
uint8 field_14;
|
||||
uint8 field_15;
|
||||
int32 field_16;
|
||||
int32 m_nFrequency;
|
||||
uint8 m_bVolume;
|
||||
uint8 field_25;
|
||||
uint8 field_26;
|
||||
uint8 field_27;
|
||||
float m_fDistance;
|
||||
int32 m_nLoopCount;
|
||||
int32 m_nLoopStart;
|
||||
int32 m_nLoopEnd;
|
||||
uint8 m_bEmittingVolume;
|
||||
uint8 field_45;
|
||||
uint8 field_46;
|
||||
uint8 field_47;
|
||||
float field_48;
|
||||
float m_fSoundIntensity;
|
||||
uint8 field_56;
|
||||
uint8 field_57;
|
||||
uint8 field_58;
|
||||
uint8 field_59;
|
||||
CVector m_vecPos;
|
||||
uint8 m_bReverbFlag;
|
||||
uint8 m_bLoopsRemaining;
|
||||
uint8 m_bRequireReflection;
|
||||
uint8 m_bOffset;
|
||||
int32 field_76;
|
||||
uint8 m_bIsProcessed;
|
||||
uint8 m_bLoopEnded;
|
||||
uint8 field_82;
|
||||
uint8 field_83;
|
||||
int32 calculatedVolume;
|
||||
uint8 field_88;
|
||||
uint8 field_89;
|
||||
uint8 field_90;
|
||||
uint8 field_91;
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(tActiveSample) == 92, "tActiveSample: error");
|
||||
|
||||
enum eAudioType : int32 {
|
||||
AUDIOTYPE_PHYSICAL = 0,
|
||||
AUDIOTYPE_EXPLOSION = 1,
|
||||
AUDIOTYPE_FIRE = 2,
|
||||
AUDIOTYPE_WEATHER = 3,
|
||||
AUDIOTYPE_CRANE = 4,
|
||||
AUDIOTYPE_SCRIPTOBJECT = 5,
|
||||
AUDIOTYPE_BRIDGE = 6,
|
||||
AUDIOTYPE_COLLISION = 7,
|
||||
AUDIOTYPE_FRONTEND = 8,
|
||||
AUDIOTYPE_PROJECTILE = 9,
|
||||
AUDIOTYPE_GARAGE = 10,
|
||||
AUDIOTYPE_FIREHYDRANT = 11,
|
||||
AUDIOTYPE_WATERCANNON = 12,
|
||||
AUDIOTYPE_POLICERADIO = 13,
|
||||
TOTAL_AUDIO_TYPES = 14,
|
||||
};
|
||||
|
||||
class CPhysical;
|
||||
class CAutomobile;
|
||||
|
||||
class tAudioEntity
|
||||
{
|
||||
public:
|
||||
eAudioType m_nType;
|
||||
void *m_pEntity;
|
||||
bool m_bIsUsed;
|
||||
uint8 m_bStatus;
|
||||
int16 m_awAudioEvent[4];
|
||||
uint8 gap_18[2];
|
||||
float m_afVolume[4];
|
||||
uint8 m_Loops;
|
||||
uint8 field_25[3];
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
|
||||
|
||||
class tPedComment
|
||||
{
|
||||
public:
|
||||
int32 m_nSampleIndex;
|
||||
int32 m_entityIndex;
|
||||
CVector m_vecPos;
|
||||
float m_fDistance;
|
||||
uint8 m_bVolume;
|
||||
int8 field_25; // allocated time?
|
||||
uint8 gap_26[2];
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(tPedComment) == 28, "tPedComment: error");
|
||||
|
||||
class cPedComments
|
||||
{
|
||||
public:
|
||||
tPedComment m_asPedComments[2][20];
|
||||
uint8 indexMap[2][20];
|
||||
uint8 nrOfCommentsInBank[2];
|
||||
uint8 activeBank;
|
||||
uint8 gap_1163[1];
|
||||
|
||||
// reversed all methods
|
||||
void Add(tPedComment *com); /// ok
|
||||
void Process(); /// ok
|
||||
};
|
||||
|
||||
static_assert(sizeof(cPedComments) == 1164, "cPedComments: error");
|
||||
|
||||
class CEntity;
|
||||
|
||||
class cAudioCollision
|
||||
{
|
||||
public:
|
||||
CEntity *m_pEntity1;
|
||||
CEntity *m_pEntity2;
|
||||
uint8 m_bSurface1;
|
||||
uint8 m_bSurface2;
|
||||
uint8 field_10;
|
||||
uint8 field_11;
|
||||
float m_fIntensity1;
|
||||
float m_fIntensity2;
|
||||
CVector m_vecPosition;
|
||||
float m_fDistance;
|
||||
int32 m_nBaseVolume;
|
||||
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error");
|
||||
|
||||
class cAudioCollisionManager
|
||||
{
|
||||
public:
|
||||
cAudioCollision m_asCollisions1[10];
|
||||
cAudioCollision m_asCollisions2[10];
|
||||
uint8 m_bIndicesTable[10];
|
||||
uint8 m_bCollisionsInQueue;
|
||||
uint8 gap_811;
|
||||
cAudioCollision m_sQueue;
|
||||
|
||||
void AddCollisionToRequestedQueue(); // todo
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");
|
||||
|
||||
class cMissionAudio
|
||||
{
|
||||
public:
|
||||
CVector m_vecPos;
|
||||
uint8 field_12;
|
||||
uint8 gap_13[3];
|
||||
int m_nSampleIndex;
|
||||
uint8 m_bLoadingStatus;
|
||||
uint8 m_bPlayStatus;
|
||||
uint8 field_22;
|
||||
uint8 field_23;
|
||||
int field_24;
|
||||
bool m_bIsPlayed;
|
||||
uint8 field_29;
|
||||
uint8 field_30;
|
||||
uint8 field_31;
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
|
||||
|
||||
class cVehicleParams;
|
||||
class CPlane;
|
||||
class CVehicle;
|
||||
class CPed;
|
||||
class cPedParams;
|
||||
class cTransmission;
|
||||
|
||||
class cAudioScriptObject {
|
||||
public:
|
||||
int16 AudioId;
|
||||
char _pad0[2];
|
||||
CVector Posn;
|
||||
int32 AudioEntity;
|
||||
|
||||
static void *operator new(size_t);
|
||||
static void *operator new(size_t, int);
|
||||
static void operator delete(void *, size_t);
|
||||
static void operator delete(void *, int);
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioScriptObject) == 20, "cAudioScriptObject: error");
|
||||
|
||||
enum {
|
||||
/*
|
||||
REFLECTION_YMAX = 0, top
|
||||
REFLECTION_YMIN = 1, bottom
|
||||
REFLECTION_XMIN = 2, left
|
||||
REFLECTION_XMAX = 3, right
|
||||
REFLECTION_ZMAX = 4,
|
||||
*/
|
||||
|
||||
REFLECTION_TOP = 0,
|
||||
REFLECTION_BOTTOM,
|
||||
REFLECTION_LEFT,
|
||||
REFLECTION_RIGHT,
|
||||
REFLECTION_UP,
|
||||
MAX_REFLECTIONS,
|
||||
};
|
||||
|
||||
enum AudioEntityHandle
|
||||
{
|
||||
AEHANDLE_NONE = -5,
|
||||
AEHANDLE_ERROR_NOAUDIOSYS = -4,
|
||||
AEHANDLE_ERROR_NOFREESLOT = -3,
|
||||
AEHANDLE_ERROR_NOENTITY = -2,
|
||||
AEHANDLE_ERROR_BADAUDIOTYPE = -1,
|
||||
};
|
||||
|
||||
class cAudioManager
|
||||
{
|
||||
public:
|
||||
bool m_bIsInitialised;
|
||||
uint8 field_1;
|
||||
uint8 field_2;
|
||||
uint8 m_bActiveSamples;
|
||||
uint8 field_4;
|
||||
bool m_bDynamicAcousticModelingStatus;
|
||||
uint8 field_6;
|
||||
uint8 field_7;
|
||||
float speedOfSound;
|
||||
bool m_bTimerJustReset;
|
||||
uint8 field_13;
|
||||
uint8 field_14;
|
||||
uint8 field_15;
|
||||
int32 m_nTimer;
|
||||
tActiveSample m_sQueueSample;
|
||||
uint8 m_bActiveSampleQueue;
|
||||
uint8 gap_109[3];
|
||||
tActiveSample m_asSamples[2][27];
|
||||
uint8 m_abSampleQueueIndexTable[2][27];
|
||||
uint8 m_bSampleRequestQueuesStatus[2];
|
||||
tActiveSample m_asActiveSamples[27];
|
||||
tAudioEntity m_asAudioEntities[200];
|
||||
int32 m_anAudioEntityIndices[200];
|
||||
int32 m_nAudioEntitiesTotal;
|
||||
CVector m_avecReflectionsPos[5];
|
||||
float m_afReflectionsDistances[5];
|
||||
int32 m_anScriptObjectEntityIndices[40];
|
||||
int32 m_nScriptObjectEntityTotal;
|
||||
cPedComments m_sPedComments;
|
||||
int32 m_nFireAudioEntity;
|
||||
int32 m_nWaterCannonEntity;
|
||||
int32 m_nPoliceChannelEntity;
|
||||
uint8 gap45B8[444];
|
||||
int32 m_nFrontEndEntity;
|
||||
int32 m_nCollisionEntity;
|
||||
cAudioCollisionManager m_sCollisionManager;
|
||||
int32 m_nProjectileEntity;
|
||||
int32 m_nBridgeEntity;
|
||||
cMissionAudio m_sMissionAudio;
|
||||
int32 m_anRandomTable[5];
|
||||
uint8 field_19192;
|
||||
uint8 m_bUserPause;
|
||||
uint8 m_bPreviousUserPause;
|
||||
uint8 field_19195; // time?
|
||||
uint32 m_FrameCounter;
|
||||
|
||||
// getters
|
||||
uint32 GetFrameCounter() const { return m_FrameCounter; }
|
||||
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
||||
int32 GetRandomTabe(int32 idx) const { return m_anRandomTable[idx]; }
|
||||
|
||||
// "Should" be in alphabetic order, except "getXTalkSfx"
|
||||
void AddDetailsToRequestedOrderList(uint8 sample); /// ok
|
||||
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
|
||||
uint8 counter, bool notLooping); /// ok
|
||||
void AddReflectionsToRequestedQueue(); /// ok (check value)
|
||||
void AddReleasingSounds(); // todo (difficult)
|
||||
void AddSampleToRequestedQueue(); /// ok
|
||||
void AgeCrimes(); // todo
|
||||
|
||||
void CalculateDistance(bool *ptr, float dist); /// ok
|
||||
bool CheckForAnAudioFileOnCD() const; /// ok
|
||||
void ClearMissionAudio(); /// ok
|
||||
void ClearRequestedQueue(); /// ok
|
||||
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
|
||||
float speedMultiplier) const; /// ok
|
||||
int32 ComputePan(float, CVector *); // todo
|
||||
uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance) const; /// ok
|
||||
int32 CreateEntity(int32 type, CPhysical *entity); /// ok
|
||||
|
||||
void DestroyAllGameCreatedEntities(); /// ok
|
||||
void DestroyEntity(int32 id); /// ok
|
||||
void DoJumboVolOffset() const; /// ok
|
||||
void DoPoliceRadioCrackle(); /// ok
|
||||
|
||||
// functions returning talk sfx,
|
||||
// order from GetPedCommentSfx
|
||||
uint32 GetPlayerTalkSfx(int16 sound);
|
||||
uint32 GetCopTalkSfx(int16 sound);
|
||||
uint32 GetSwatTalkSfx(int16 sound);
|
||||
uint32 GetFBITalkSfx(int16 sound);
|
||||
uint32 GetArmyTalkSfx(int16 sound);
|
||||
uint32 GetMedicTalkSfx(int16 sound);
|
||||
uint32 GetFiremanTalkSfx(int16 sound);
|
||||
uint32 GetNormalMaleTalkSfx(int16 sound);
|
||||
uint32 GetTaxiDriverTalkSfx(int16 sound);
|
||||
uint32 GetPimpTalkSfx(int16 sound);
|
||||
uint32 GetMafiaTalkSfx(int16 sound);
|
||||
uint32 GetTriadTalkSfx(int16 sound);
|
||||
uint32 GetDiabloTalkSfx(int16 sound);
|
||||
uint32 GetYakuzaTalkSfx(int16 sound);
|
||||
uint32 GetYardieTalkSfx(int16 sound);
|
||||
uint32 GetColumbianTalkSfx(int16 sound);
|
||||
uint32 GetHoodTalkSfx(int16 sound);
|
||||
uint32 GetBlackCriminalTalkSfx(int16 sound);
|
||||
uint32 GetWhiteCriminalTalkSfx(int16 sound);
|
||||
uint32 GetMaleNo2TalkSfx(int16 sound);
|
||||
uint32 GetBlackProjectMaleTalkSfx(int16 sound, int32 model);
|
||||
uint32 GetWhiteFatMaleTalkSfx(int16 sound);
|
||||
uint32 GetBlackFatMaleTalkSfx(int16 sound);
|
||||
uint32 GetBlackCasualFemaleTalkSfx(int16 sound);
|
||||
uint32 GetWhiteCasualFemaleTalkSfx(int16 sound);
|
||||
uint32 GetFemaleNo3TalkSfx(int16 sound);
|
||||
uint32 GetBlackFatFemaleTalkSfx(int16 sound);
|
||||
uint32 GetWhiteFatFemaleTalkSfx(int16 sound);
|
||||
uint32 GetBlackFemaleProstituteTalkSfx(int16 sound);
|
||||
uint32 GetWhiteFemaleProstituteTalkSfx(int16 sound);
|
||||
uint32 GetBlackProjectFemaleOldTalkSfx(int16 sound);
|
||||
uint32 GetBlackProjectFemaleYoungTalkSfx(int16 sound);
|
||||
uint32 GetChinatownMaleOldTalkSfx(int16 sound);
|
||||
uint32 GetChinatownMaleYoungTalkSfx(int16 sound);
|
||||
uint32 GetChinatownFemaleOldTalkSfx(int16 sound);
|
||||
uint32 GetChinatownFemaleYoungTalkSfx(int16 sound);
|
||||
uint32 GetLittleItalyMaleTalkSfx(int16 sound);
|
||||
uint32 GetLittleItalyFemaleOldTalkSfx(int16 sound);
|
||||
uint32 GetLittleItalyFemaleYoungTalkSfx(int16 sound);
|
||||
uint32 GetWhiteDockerMaleTalkSfx(int16 sound);
|
||||
uint32 GetBlackDockerMaleTalkSfx(int16 sound);
|
||||
uint32 GetScumMaleTalkSfx(int16 sound);
|
||||
uint32 GetScumFemaleTalkSfx(int16 sound);
|
||||
uint32 GetWhiteWorkerMaleTalkSfx(int16 sound);
|
||||
uint32 GetBlackWorkerMaleTalkSfx(int16 sound);
|
||||
uint32 GetBusinessMaleYoungTalkSfx(int16 sound, int32 model);
|
||||
uint32 GetBusinessMaleOldTalkSfx(int16 sound);
|
||||
uint32 GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model);
|
||||
uint32 GetBlackBusinessFemaleTalkSfx(int16 sound);
|
||||
uint32 GetSupermodelMaleTalkSfx(int16 sound);
|
||||
uint32 GetSupermodelFemaleTalkSfx(int16 sound);
|
||||
uint32 GetStewardMaleTalkSfx(int16 sound);
|
||||
uint32 GetStewardFemaleTalkSfx(int16 sound);
|
||||
uint32 GetFanMaleTalkSfx(int16 sound, int32 model);
|
||||
uint32 GetFanFemaleTalkSfx(int16 sound);
|
||||
uint32 GetHospitalMaleTalkSfx(int16 sound);
|
||||
uint32 GetHospitalFemaleTalkSfx(int16 sound);
|
||||
uint32 GetWhiteConstructionWorkerTalkSfx(int16 sound);
|
||||
uint32 GetBlackConstructionWorkerTalkSfx(int16 sound);
|
||||
uint32 GetShopperFemaleTalkSfx(int16 sound, int32 model);
|
||||
uint32 GetStudentMaleTalkSfx(int16 sound);
|
||||
uint32 GetStudentFemaleTalkSfx(int16 sound);
|
||||
uint32 GetCasualMaleOldTalkSfx(int16 sound);
|
||||
|
||||
uint32 GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound);
|
||||
uint32 GetEightTalkSfx(int16 sound);
|
||||
uint32 GetFrankieTalkSfx(int16 sound);
|
||||
uint32 GetMistyTalkSfx(int16 sound);
|
||||
uint32 GetOJGTalkSfx(int16 sound);
|
||||
uint32 GetCatatalinaTalkSfx(int16 sound);
|
||||
uint32 GetBomberTalkSfx(int16 sound);
|
||||
uint32 GetSecurityGuardTalkSfx(int16 sound);
|
||||
uint32 GetChunkyTalkSfx(int16 sound);
|
||||
|
||||
uint32 GetGenericMaleTalkSfx(int16 sound);
|
||||
uint32 GetGenericFemaleTalkSfx(int16 sound);
|
||||
// end of functions returning talk sfx
|
||||
|
||||
void GenerateIntegerRandomNumberTable(); /// ok
|
||||
char *Get3DProviderName(uint8 id) const;
|
||||
uint8 GetCDAudioDriveLetter() const;
|
||||
int8 GetCurrent3DProviderIndex() const; /// ok
|
||||
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
|
||||
float GetCollisionOneShotRatio(uint32 a, float b) const; /// ok
|
||||
float GetCollisionRatio(float a, float b, float c, float d) const; /// ok
|
||||
float GetDistanceSquared(CVector *v) const; /// ok
|
||||
int32 GetJumboTaxiFreq() const; /// ok
|
||||
bool GetMissionAudioLoadingStatus() const; /// ok
|
||||
char GetMissionScriptPoliceAudioPlayingStatus() const; /// ok
|
||||
uint8 GetNum3DProvidersAvailable() const;
|
||||
int32 GetPedCommentSfx(CPed *ped, int32 sound);
|
||||
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
|
||||
float GetVehicleDriveWheelSkidValue(uint8 a1, CAutomobile *a2, cTransmission *a3,
|
||||
float a4); // todo
|
||||
int32 GetVehicleNonDriveWheelSkidValue(float a1, int a2, int a3, int a4, float a5); // todo
|
||||
|
||||
bool HasAirBrakes(int32 model) const; /// ok
|
||||
|
||||
void Initialise(); /// ok
|
||||
void InitialisePoliceRadio(); // todo
|
||||
void InitialisePoliceRadioZones(); // todo
|
||||
void InterrogateAudioEntities(); /// ok
|
||||
bool IsAudioInitialised() const; /// ok
|
||||
bool IsMissionAudioSampleFinished(); /// ok
|
||||
bool IsMP3RadioChannelAvailable() const;
|
||||
|
||||
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok
|
||||
|
||||
void PlayLoadedMissionAudio(); /// ok
|
||||
void PlayOneShot(int32 index, int16 sound, float vol); // todo
|
||||
uint32 PlaySuspectLastSeen(float x, float y, float z); // todo
|
||||
void PlayerJustGotInCar() const; /// ok
|
||||
void PlayerJustLeftCar() const; /// ok
|
||||
void PostInitialiseGameSpecificSetup(); /// ok
|
||||
void PostTerminateGameSpecificShutdown(); /// ok
|
||||
void PreInitialiseGameSpecificSetup() const;
|
||||
void PreloadMissionAudio(char *); // todo
|
||||
void PreTerminateGameSpecificShutdown(); /// ok
|
||||
/// processX - main logic of adding new sounds
|
||||
void ProcessActiveQueues(); // todo
|
||||
bool ProcessAirBrakes(cVehicleParams *params); /// ok
|
||||
void ProcessAirportScriptObject(uint8 sound); /// ok
|
||||
bool ProcessBoatEngine(cVehicleParams *params); /// ok
|
||||
bool ProcessBoatMovingOverWater(cVehicleParams *params); /// ok
|
||||
void ProcessBridge(); /// ok
|
||||
void ProcessBridgeMotor(); /// ok
|
||||
void ProcessBridgeOneShots(); /// ok
|
||||
void ProcessBridgeWarning(); /// ok
|
||||
bool ProcessCarBombTick(cVehicleParams *params); /// ok
|
||||
void ProcessCesna(void *); // todo requires CPlane
|
||||
void ProcessCinemaScriptObject(uint8 sound); /// ok
|
||||
void ProcessCrane(); // todo requires CCrane
|
||||
void ProcessDocksScriptObject(uint8 sound); /// ok
|
||||
bool ProcessEngineDamage(cVehicleParams *params); /// ok
|
||||
void ProcessEntity(int32 sound); /// ok
|
||||
void ProcessExplosions(int32 explosion); /// ok
|
||||
void ProcessFireHydrant(); /// ok
|
||||
void ProcessFires(int32 entity); // todo requires gFireManager
|
||||
void ProcessFrontEnd(); /// ok
|
||||
void ProcessGarages(); // todo requires CGarages::aGarages
|
||||
bool ProcessHelicopter(cVehicleParams *params); /// ok
|
||||
void ProcessHomeScriptObject(uint8 sound); /// ok
|
||||
void ProcessJumbo(cVehicleParams *); /// ok
|
||||
void ProcessJumboAccel(CPlane *plane); /// ok
|
||||
void ProcessJumboDecel(CPlane *plane); /// ok
|
||||
void ProcessJumboFlying(); /// ok
|
||||
void ProcessJumboLanding(CPlane *plane); /// ok
|
||||
void ProcessJumboTakeOff(CPlane *plane); /// ok
|
||||
void ProcessJumboTaxi(); /// ok
|
||||
void ProcessLaunderetteScriptObject(uint8 sound); /// ok
|
||||
void ProcessLoopingScriptObject(uint8 sound); /// ok
|
||||
void ProcessMissionAudio(); /// ok
|
||||
void ProcessModelCarEngine(cVehicleParams *params); /// ok (check float comparisons)
|
||||
void ProcessOneShotScriptObject(uint8 sound); /// ok
|
||||
void ProcessPed(CPhysical *ped); /// ok
|
||||
void ProcessPedHeadphones(cPedParams *params); /// ok
|
||||
void ProcessPedOneShots(cPedParams *params); // todo later (weird)
|
||||
void ProcessPhysical(int32 id); /// ok
|
||||
void ProcessPlane(cVehicleParams *params); /// ok
|
||||
void ProcessPlayersVehicleEngine(cVehicleParams *params,
|
||||
CAutomobile *automobile); /// ok (check float comparisons)
|
||||
void ProcessPoliceCellBeatingScriptObject(uint8 sound); // todo
|
||||
void ProcessPornCinema(uint8 sound); /// ok
|
||||
void ProcessProjectiles(); // todo requires CProjectileInfo
|
||||
void ProcessRainOnVehicle(cVehicleParams *params); /// ok
|
||||
void ProcessReverb() const; /// ok
|
||||
bool ProcessReverseGear(cVehicleParams *a2); /// ok
|
||||
void ProcessSawMillScriptObject(uint8 sound); /// ok
|
||||
void ProcessScriptObject(int32 id); /// ok
|
||||
void ProcessShopScriptObject(uint8 sound); /// ok
|
||||
void ProcessSpecial(); /// ok
|
||||
bool ProcessTrainNoise(cVehicleParams *params); /// ok
|
||||
void ProcessVehicle(CVehicle *); // todo
|
||||
bool ProcessVehicleDoors(cVehicleParams *params); /// ok
|
||||
// bool ProcessVehicleEngine(void *);
|
||||
// void ProcessVehicleHorn(cVehicleParams *params);
|
||||
// void ProcessVehicleOneShots(void *);
|
||||
bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok
|
||||
bool ProcessVehicleRoadNoise(cVehicleParams *params); /// ok
|
||||
// void ProcessVehicleSirenOrAlarm(void *);
|
||||
// void ProcessVehicleSkidding(void *);
|
||||
void ProcessWaterCannon(int32); // todo
|
||||
void ProcessWeather(int32 id); /// ok
|
||||
bool ProcessWetRoadNoise(cVehicleParams *params); /// ok
|
||||
void ProcessWorkShopScriptObject(uint8 sound); /// ok
|
||||
|
||||
int32 RandomDisplacement(uint32 seed) const;
|
||||
void ReacquireDigitalHandle() const;
|
||||
void ReleaseDigitalHandle() const;
|
||||
int32 ReportCollision(CEntity *a2, CEntity *a3, uint8 a4, uint8 a5, float a6,
|
||||
float a7); // todo
|
||||
int32 ReportCrime(int a2, int *a3); // todo
|
||||
void ResetAudioLogicTimers(int32 timer); /// ok
|
||||
void ResetPoliceRadio();
|
||||
void ResetTimers(unsigned int a2); // todo
|
||||
|
||||
void Service(); // todo
|
||||
void ServiceCollisions(); // todo
|
||||
void ServicePoliceRadio(); // todo
|
||||
void ServicePoliceRadioChannel(int a2); // todo
|
||||
void ServiceSoundEffects(); // todo
|
||||
void SetDynamicAcousticModelingStatus(bool status);
|
||||
void SetEffectsFadeVolume(uint8 volume) const;
|
||||
void SetEffectsMasterVolume(uint8 volume) const;
|
||||
void SetEntityStatus(int32 id, bool status);
|
||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(int32); // todo
|
||||
void SetMissionAudioLocation(float x, float y, float z);
|
||||
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
||||
void SetMonoMode(uint8); // todo
|
||||
void SetMusicFadeVolume(uint8 volume) const;
|
||||
void SetMusicMasterVolume(uint8 volume) const;
|
||||
void SetSpeakerConfig(int32 conf) const;
|
||||
void SetUpLoopingCollisionSound(int a2, int a3); // todo
|
||||
void SetUpOneShotCollisionSound(int a2); // todo
|
||||
void SetupCrimeReport(); // todo
|
||||
bool SetupJumboEngineSound(uint8, int32); // todo
|
||||
bool SetupJumboFlySound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboTaxiSound(uint8 vol); /// ok
|
||||
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
|
||||
void SetupPedComments(cPedParams *params, uint32 sound); /// ok
|
||||
void SetupSuspectLastSeenReport(); // todo
|
||||
|
||||
void Terminate();
|
||||
void TranslateEntity(CVector *v1, CVector *v2) const; /// ok
|
||||
|
||||
void UpdateGasPedalAudio(CAutomobile *automobile); // todo hook
|
||||
bool UsesReverseWarning(int32 model) const;
|
||||
bool UsesSiren(int32 model) const;
|
||||
bool UsesSirenSwitching(int32 model) const;
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
||||
|
||||
extern cAudioManager &AudioManager;
|
|
@ -31,7 +31,7 @@ cDMAudio::Service(void)
|
|||
int32
|
||||
cDMAudio::CreateEntity(eAudioType type, void *UID)
|
||||
{
|
||||
return AudioManager.CreateEntity(type, UID);
|
||||
return AudioManager.CreateEntity(type, (CPhysical *)UID);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -82,7 +82,7 @@ cDMAudio::SetEffectsFadeVol(uint8 volume)
|
|||
uint8 vol = volume;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
||||
AudioManager.SetEffectsFadeVol(vol);
|
||||
AudioManager.SetEffectsFadeVolume(vol);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -91,7 +91,7 @@ cDMAudio::SetMusicFadeVol(uint8 volume)
|
|||
uint8 vol = volume;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
||||
AudioManager.SetMusicFadeVol(vol);
|
||||
AudioManager.SetMusicFadeVolume(vol);
|
||||
}
|
||||
|
||||
uint8
|
||||
|
@ -169,13 +169,13 @@ cDMAudio::IsAudioInitialised(void)
|
|||
void
|
||||
cDMAudio::ReportCrime(eCrimeType crime, CVector const &pos)
|
||||
{
|
||||
AudioManager.ReportCrime(crime, pos);
|
||||
AudioManager.ReportCrime(crime, &pos);
|
||||
}
|
||||
|
||||
int32
|
||||
cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject)
|
||||
{
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject);
|
||||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
AudioManager.SetEntityStatus(audioEntity, true);
|
||||
|
@ -192,7 +192,7 @@ cDMAudio::DestroyLoopingScriptObject(int32 audioEntity)
|
|||
void
|
||||
cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject)
|
||||
{
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject);
|
||||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
{
|
||||
|
|
|
@ -340,7 +340,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
if (distanceBetweenNodes / 2 < carLength)
|
||||
positionBetweenNodes = 0.5f;
|
||||
else
|
||||
positionBetweenNodes = Min(1.0f - carLength / distanceBetweenNodes, Max(carLength / distanceBetweenNodes, positionBetweenNodes));
|
||||
positionBetweenNodes = min(1.0f - carLength / distanceBetweenNodes, max(carLength / distanceBetweenNodes, positionBetweenNodes));
|
||||
pCar->AutoPilot.m_nNextDirection = (curNodeId >= nextNodeId) ? 1 : -1;
|
||||
if (pCurNode->numLinks == 1){
|
||||
/* Do not create vehicle if there is nowhere to go. */
|
||||
|
@ -793,10 +793,10 @@ CCarCtrl::FindMaximumSpeedForThisCarInTraffic(CVehicle* pVehicle)
|
|||
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
|
||||
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||
int xstart = Max(0, CWorld::GetSectorIndexX(left));
|
||||
int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
||||
int ystart = Max(0, CWorld::GetSectorIndexY(top));
|
||||
int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
||||
int xstart = max(0, CWorld::GetSectorIndexX(left));
|
||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
||||
int ystart = max(0, CWorld::GetSectorIndexY(top));
|
||||
int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
||||
assert(xstart <= xend);
|
||||
assert(ystart <= yend);
|
||||
|
||||
|
@ -827,10 +827,10 @@ CCarCtrl::ScanForPedDanger(CVehicle* pVehicle)
|
|||
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
|
||||
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||
int xstart = Max(0, CWorld::GetSectorIndexX(left));
|
||||
int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
||||
int ystart = Max(0, CWorld::GetSectorIndexY(top));
|
||||
int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
||||
int xstart = max(0, CWorld::GetSectorIndexX(left));
|
||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
||||
int ystart = max(0, CWorld::GetSectorIndexY(top));
|
||||
int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
||||
assert(xstart <= xend);
|
||||
assert(ystart <= yend);
|
||||
|
||||
|
@ -862,12 +862,12 @@ CCarCtrl::SlowCarOnRailsDownForTrafficAndLights(CVehicle* pVehicle)
|
|||
float curSpeed = pVehicle->AutoPilot.m_fMaxTrafficSpeed;
|
||||
if (maxSpeed >= curSpeed){
|
||||
if (maxSpeed > curSpeed)
|
||||
pVehicle->AutoPilot.ModifySpeed(Min(maxSpeed, curSpeed + 0.05f * CTimer::GetTimeStep()));
|
||||
pVehicle->AutoPilot.ModifySpeed(min(maxSpeed, curSpeed + 0.05f * CTimer::GetTimeStep()));
|
||||
}else{
|
||||
if (curSpeed == 0.0f)
|
||||
return;
|
||||
if (curSpeed >= 0.1f)
|
||||
pVehicle->AutoPilot.ModifySpeed(Max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
|
||||
pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
|
||||
else if (curSpeed != 0.0f) /* no need to check */
|
||||
pVehicle->AutoPilot.ModifySpeed(0.0f);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ void CCarGenerator::Setup(float x, float y, float z, float angle, int32 mi, int1
|
|||
m_bIsBlocking = false;
|
||||
m_vecInf = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.min;
|
||||
m_vecSup = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.max;
|
||||
m_fSize = Max(m_vecInf.Magnitude(), m_vecSup.Magnitude());
|
||||
m_fSize = max(m_vecInf.Magnitude(), m_vecSup.Magnitude());
|
||||
}
|
||||
|
||||
bool CCarGenerator::CheckForBlockage()
|
||||
|
|
|
@ -207,8 +207,8 @@ CPathFind::PreparePathData(void)
|
|||
numExtern++;
|
||||
if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes)
|
||||
numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
|
||||
maxX = Max(maxX, Abs(InfoForTileCars[k].x));
|
||||
maxY = Max(maxY, Abs(InfoForTileCars[k].y));
|
||||
maxX = max(maxX, Abs(InfoForTileCars[k].x));
|
||||
maxY = max(maxY, Abs(InfoForTileCars[k].y));
|
||||
}else if(InfoForTileCars[k].type == NodeTypeIntern)
|
||||
numIntern++;
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
|||
if(Abs(dx) < nearestDist){
|
||||
dy = tempnodes[k].pos.y - CoorsXFormed.y;
|
||||
if(Abs(dy) < nearestDist){
|
||||
nearestDist = Max(Abs(dx), Abs(dy));
|
||||
nearestDist = max(Abs(dx), Abs(dy));
|
||||
nearestId = k;
|
||||
}
|
||||
}
|
||||
|
@ -501,13 +501,13 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
|||
|
||||
// Find i inside path segment
|
||||
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)
|
||||
iseg++;
|
||||
|
||||
istart = 12*m_mapObjects[m_pathNodes[i].objectIndex]->m_modelIndex;
|
||||
// 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)
|
||||
continue;
|
||||
// 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);
|
||||
if (main){
|
||||
state->animId = main->animId;
|
||||
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->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));
|
||||
}else{
|
||||
state->animId = 3;
|
||||
state->time = 0;
|
||||
|
@ -375,9 +375,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||
}
|
||||
if (second) {
|
||||
state->secAnimId = second->animId;
|
||||
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->blendAmount = 255.0f / 2.0f * Max(0.0f, Min(2.0f, blend_amount));
|
||||
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->blendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, blend_amount));
|
||||
}else{
|
||||
state->secAnimId = 0;
|
||||
state->secTime = 0;
|
||||
|
@ -387,9 +387,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||
CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
|
||||
if (partial) {
|
||||
state->partAnimId = partial->animId;
|
||||
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->partBlendAmount = 255.0f / 2.0f * Max(0.0f, Min(2.0f, partial->blendAmount));
|
||||
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->partBlendAmount = 255.0f / 2.0f * max(0.0f, min(2.0f, partial->blendAmount));
|
||||
}else{
|
||||
state->partAnimId = 0;
|
||||
state->partAnimTime = 0;
|
||||
|
@ -408,9 +408,9 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainAssociation_N((RpClump*)ped->m_rwObject, i);
|
||||
if (assoc){
|
||||
state->aAnimId[i] = assoc->animId;
|
||||
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->aBlendAmount[i] = 255.0f / 2.0f * Max(0.0f, Min(2.0f, assoc->blendAmount));
|
||||
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->aBlendAmount[i] = 255.0f / 2.0f * max(0.0f, min(2.0f, assoc->blendAmount));
|
||||
state->aFlags[i] = assoc->flags;
|
||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||
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);
|
||||
if (assoc) {
|
||||
state->aAnimId2[i] = assoc->animId;
|
||||
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->aBlendAmount2[i] = 255.0f / 2.0f * Max(0.0f, Min(2.0f, assoc->blendAmount));
|
||||
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->aBlendAmount2[i] = 255.0f / 2.0f * max(0.0f, min(2.0f, assoc->blendAmount));
|
||||
state->aFlags2[i] = assoc->flags;
|
||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||
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->acceleration = vehicle->m_fGasPedal * 100.0f;
|
||||
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->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->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->velocityZ = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().z));
|
||||
vp->mi = vehicle->GetModelIndex();
|
||||
vp->primary_color = vehicle->m_currentColour1;
|
||||
vp->secondary_color = vehicle->m_currentColour2;
|
||||
|
@ -1501,9 +1501,9 @@ void CReplay::ProcessLookAroundCam(void)
|
|||
--FramesActiveLookAroundCam;
|
||||
fBetaAngleLookAroundCam += x_moved;
|
||||
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
|
||||
fAlphaAngleLookAroundCam = Max(0.1f, Min(1.5f, fAlphaAngleLookAroundCam + y_moved));
|
||||
fAlphaAngleLookAroundCam = max(0.1f, min(1.5f, fAlphaAngleLookAroundCam + y_moved));
|
||||
CVector camera_pt(
|
||||
fDistanceLookAroundCam * Sin(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
||||
fDistanceLookAroundCam * Cos(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
||||
|
|
|
@ -1987,7 +1987,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
|
|||
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
||||
car->m_status = STATUS_PHYSICS;
|
||||
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();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1999,7 +1999,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
|
|||
CCarCtrl::JoinCarWithRoadSystem(car);
|
||||
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||
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();
|
||||
return 0;
|
||||
}
|
||||
|
@ -2083,7 +2083,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
|
|||
CollectParameters(&m_nIp, 2);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
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;
|
||||
}
|
||||
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)
|
||||
*CurrentSpeed = TargetSpeed;
|
||||
|
||||
*CurrentValue += *CurrentSpeed * Min(10.0f, CTimer::GetTimeStep());
|
||||
*CurrentValue += *CurrentSpeed * min(10.0f, CTimer::GetTimeStep());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -697,7 +697,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
|
|||
// Process height offset to avoid peds and cars
|
||||
|
||||
float TargetZOffSet = m_fUnknownZOffSet + m_fDimensionOfHighestNearCar;
|
||||
TargetZOffSet = Max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
|
||||
TargetZOffSet = max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
|
||||
float TargetHeight = CameraTarget.z + TargetZOffSet - Source.z;
|
||||
|
||||
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;
|
||||
|
||||
Front = TargetCoors - Source;
|
||||
|
@ -991,7 +991,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
|
|||
}
|
||||
if(FoundCamRoof){
|
||||
// Camera is under something
|
||||
float roof = FoundRoofCenter ? Min(CamRoof, CarRoof) : CamRoof;
|
||||
float roof = FoundRoofCenter ? min(CamRoof, CarRoof) : CamRoof;
|
||||
// Same weirdness again?
|
||||
TargetAlpha = CGeneral::GetATanOfXY(CA_MAX_DISTANCE, roof - CamTargetZ - 1.5f);
|
||||
CamClear = false;
|
||||
|
@ -1249,7 +1249,7 @@ void
|
|||
CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
|
||||
{
|
||||
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;
|
||||
|
||||
|
|
|
@ -153,10 +153,10 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
|
|||
// on water we expect to be between levels
|
||||
multipleLevels = true;
|
||||
}else{
|
||||
xmin = Max(sx - 1, 0);
|
||||
xmax = Min(sx + 1, NUMSECTORS_X-1);
|
||||
ymin = Max(sy - 1, 0);
|
||||
ymax = Min(sy + 1, NUMSECTORS_Y-1);
|
||||
xmin = max(sx - 1, 0);
|
||||
xmax = min(sx + 1, NUMSECTORS_X-1);
|
||||
ymin = max(sy - 1, 0);
|
||||
ymax = min(sy + 1, NUMSECTORS_Y-1);
|
||||
|
||||
for(x = xmin; x <= xmax; x++)
|
||||
for(y = ymin; y <= ymax; y++){
|
||||
|
|
|
@ -1030,7 +1030,7 @@ int CMenuManager::FadeIn(int alpha)
|
|||
m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
|
||||
m_nCurrScreen == MENUPAGE_DELETING)
|
||||
return alpha;
|
||||
return Min(m_nMenuFadeAlpha, alpha);
|
||||
return min(m_nMenuFadeAlpha, alpha);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ void CIniFile::LoadIniFile()
|
|||
if (f){
|
||||
CFileMgr::ReadLine(f, gString, 200);
|
||||
sscanf(gString, "%f", &PedNumberMultiplier);
|
||||
PedNumberMultiplier = Min(3.0f, Max(0.5f, PedNumberMultiplier));
|
||||
PedNumberMultiplier = min(3.0f, max(0.5f, PedNumberMultiplier));
|
||||
CFileMgr::ReadLine(f, gString, 200);
|
||||
sscanf(gString, "%f", &CarNumberMultiplier);
|
||||
CarNumberMultiplier = Min(3.0f, Max(0.5f, CarNumberMultiplier));
|
||||
CarNumberMultiplier = min(3.0f, max(0.5f, CarNumberMultiplier));
|
||||
CFileMgr::CloseFile(f);
|
||||
}
|
||||
CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
|
||||
|
|
|
@ -299,10 +299,10 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
|
|||
{ if ( State1.button || State2.button ) ReconState.button = 255; }
|
||||
|
||||
#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) \
|
||||
{ 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) \
|
||||
{ _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());
|
||||
if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())){
|
||||
lodDistSq = sq(mi->GetLargestLodDistance());
|
||||
lodDistSq = Min(lodDistSq, sq(STREAM_DIST));
|
||||
lodDistSq = min(lodDistSq, sq(STREAM_DIST));
|
||||
pos = CVector2D(e->GetPosition());
|
||||
if(xmin < pos.x && pos.x < xmax &&
|
||||
ymin < pos.y && pos.y < ymax &&
|
||||
|
@ -2160,20 +2160,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||
if(Abs(TheCamera.GetForward().x) > Abs(TheCamera.GetForward().y)){
|
||||
// looking west/east
|
||||
|
||||
ymin = Max(iy - 10, 0);
|
||||
ymax = Min(iy + 10, NUMSECTORS_Y);
|
||||
ymin = max(iy - 10, 0);
|
||||
ymax = min(iy + 10, NUMSECTORS_Y);
|
||||
assert(ymin <= ymax);
|
||||
|
||||
// Delete a block of sectors that we know is behind the camera
|
||||
if(TheCamera.GetForward().x > 0){
|
||||
// looking east
|
||||
xmax = Max(ix - 2, 0);
|
||||
xmin = Max(ix - 10, 0);
|
||||
xmax = max(ix - 2, 0);
|
||||
xmin = max(ix - 10, 0);
|
||||
inc = 1;
|
||||
}else{
|
||||
// looking west
|
||||
xmax = Min(ix + 2, NUMSECTORS_X);
|
||||
xmin = Min(ix + 10, NUMSECTORS_X);
|
||||
xmax = min(ix + 2, NUMSECTORS_X);
|
||||
xmin = min(ix + 10, NUMSECTORS_X);
|
||||
inc = -1;
|
||||
}
|
||||
for(y = ymin; y <= ymax; y++){
|
||||
|
@ -2189,13 +2189,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||
// Now a block that intersects with the camera's frustum
|
||||
if(TheCamera.GetForward().x > 0){
|
||||
// looking east
|
||||
xmax = Max(ix + 10, 0);
|
||||
xmin = Max(ix - 2, 0);
|
||||
xmax = max(ix + 10, 0);
|
||||
xmin = max(ix - 2, 0);
|
||||
inc = 1;
|
||||
}else{
|
||||
// looking west
|
||||
xmax = Min(ix - 10, NUMSECTORS_X);
|
||||
xmin = Min(ix + 2, NUMSECTORS_X);
|
||||
xmax = min(ix - 10, NUMSECTORS_X);
|
||||
xmin = min(ix + 2, NUMSECTORS_X);
|
||||
inc = -1;
|
||||
}
|
||||
for(y = ymin; y <= ymax; y++){
|
||||
|
@ -2224,20 +2224,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||
}else{
|
||||
// looking north/south
|
||||
|
||||
xmin = Max(ix - 10, 0);
|
||||
xmax = Min(ix + 10, NUMSECTORS_X);
|
||||
xmin = max(ix - 10, 0);
|
||||
xmax = min(ix + 10, NUMSECTORS_X);
|
||||
assert(xmin <= xmax);
|
||||
|
||||
// Delete a block of sectors that we know is behind the camera
|
||||
if(TheCamera.GetForward().y > 0){
|
||||
// looking north
|
||||
ymax = Max(iy - 2, 0);
|
||||
ymin = Max(iy - 10, 0);
|
||||
ymax = max(iy - 2, 0);
|
||||
ymin = max(iy - 10, 0);
|
||||
inc = 1;
|
||||
}else{
|
||||
// looking south
|
||||
ymax = Min(iy + 2, NUMSECTORS_Y);
|
||||
ymin = Min(iy + 10, NUMSECTORS_Y);
|
||||
ymax = min(iy + 2, NUMSECTORS_Y);
|
||||
ymin = min(iy + 10, NUMSECTORS_Y);
|
||||
inc = -1;
|
||||
}
|
||||
for(x = xmin; x <= xmax; x++){
|
||||
|
@ -2253,13 +2253,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||
// Now a block that intersects with the camera's frustum
|
||||
if(TheCamera.GetForward().y > 0){
|
||||
// looking north
|
||||
ymax = Max(iy + 10, 0);
|
||||
ymin = Max(iy - 2, 0);
|
||||
ymax = max(iy + 10, 0);
|
||||
ymin = max(iy - 2, 0);
|
||||
inc = 1;
|
||||
}else{
|
||||
// looking south
|
||||
ymax = Min(iy - 10, NUMSECTORS_Y);
|
||||
ymin = Min(iy + 2, NUMSECTORS_Y);
|
||||
ymax = min(iy - 10, NUMSECTORS_Y);
|
||||
ymin = min(iy + 2, NUMSECTORS_Y);
|
||||
inc = -1;
|
||||
}
|
||||
for(x = xmin; x <= xmax; x++){
|
||||
|
|
|
@ -209,7 +209,7 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
|
|||
else
|
||||
sensitivity = m_fCrimeSensitivity;
|
||||
|
||||
wantedLevelDrop = Min(CCullZones::GetWantedLevelDrop(), 100);
|
||||
wantedLevelDrop = min(CCullZones::GetWantedLevelDrop(), 100);
|
||||
|
||||
chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
|
||||
if (policeDoesntCare)
|
||||
|
|
|
@ -195,8 +195,8 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
|||
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
|
||||
#define BIT(num) (1<<(num))
|
||||
|
||||
#define Max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define Min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
|
||||
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ DoFade(void)
|
|||
CRGBA fadeColor;
|
||||
CRect rect;
|
||||
int fadeValue = CDraw::FadeValue;
|
||||
float brightness = Min(CMenuManager::m_PrefsBrightness, 256);
|
||||
float brightness = min(CMenuManager::m_PrefsBrightness, 256);
|
||||
if(brightness <= 50)
|
||||
brightness = 50;
|
||||
if(FrontEndMenuManager.m_bMenuActive)
|
||||
|
|
|
@ -457,7 +457,7 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &
|
|||
{
|
||||
float compression = 1.0f - springRatio;
|
||||
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;
|
||||
ApplyMoveForce(springDir*impulse);
|
||||
ApplyTurnForce(springDir*impulse, point);
|
||||
|
@ -471,12 +471,12 @@ CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &poin
|
|||
{
|
||||
float speedA = DotProduct(speed, 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;
|
||||
|
||||
// what is this?
|
||||
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));
|
||||
if(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
|
||||
// not interested in how much B moves into A apparently?
|
||||
// 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
|
||||
if(speedA < speedB){
|
||||
if(!A->bHasHitWall)
|
||||
|
@ -1147,18 +1147,18 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
|||
CVector dir = A->GetPosition() - B->GetPosition();
|
||||
dir.Normalise();
|
||||
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;
|
||||
}else if(A->IsPed() && B->IsVehicle() && ((CVehicle*)B)->IsBoat()){
|
||||
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.Normalise();
|
||||
shift += dir * colpoints[mostColliding].depth / (1.0f - f);
|
||||
boat = B;
|
||||
}else if(B->IsPed() && A->IsVehicle() && ((CVehicle*)A)->IsBoat()){
|
||||
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.Normalise();
|
||||
B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f);
|
||||
|
@ -1246,7 +1246,7 @@ collision:
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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){
|
||||
CVector savedMoveFriction = A->m_vecMoveFriction;
|
||||
|
@ -1268,7 +1268,7 @@ collision:
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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])){
|
||||
A->bHasContacted = true;
|
||||
|
@ -1301,7 +1301,7 @@ collision:
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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])){
|
||||
A->bHasContacted = true;
|
||||
|
@ -1328,7 +1328,7 @@ collision:
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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])){
|
||||
A->bHasContacted = true;
|
||||
|
@ -1506,7 +1506,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||
float turnSpeedDiff = A->m_vecTurnSpeed.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{
|
||||
for(i = 0; i < numCollisions; i++){
|
||||
|
@ -1527,7 +1527,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||
float turnSpeedDiff = A->m_vecTurnSpeed.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;
|
||||
|
||||
|
@ -1545,7 +1545,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||
else if(A->GetUp().z > 0.3f)
|
||||
adhesion = 0.0f;
|
||||
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]))
|
||||
|
@ -1594,7 +1594,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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){
|
||||
CVector savedMoveFriction = A->m_vecMoveFriction;
|
||||
|
@ -1619,7 +1619,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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])){
|
||||
A->bHasContacted = true;
|
||||
|
@ -1655,7 +1655,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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])){
|
||||
A->bHasContacted = true;
|
||||
|
@ -1685,7 +1685,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).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])){
|
||||
A->bHasContacted = true;
|
||||
|
@ -1831,7 +1831,7 @@ CPhysical::ProcessCollision(void)
|
|||
|
||||
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
|
||||
if(ped->IsPlayer())
|
||||
n = Max(NUMSTEPS(0.2f), 2.0);
|
||||
n = max(NUMSTEPS(0.2f), 2.0);
|
||||
else
|
||||
n = NUMSTEPS(0.3f);
|
||||
step = savedTimeStep / n;
|
||||
|
@ -1852,7 +1852,7 @@ CPhysical::ProcessCollision(void)
|
|||
speedDown = Multiply3x3(GetMatrix(), speedDown);
|
||||
speedUp = GetSpeed(speedUp);
|
||||
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)){
|
||||
n = NUMSTEPS(0.3f);
|
||||
step = savedTimeStep / n;
|
||||
|
|
|
@ -1792,7 +1792,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||
neededPos.z = autoZPos.z;
|
||||
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) {
|
||||
adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f);
|
||||
adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f);
|
||||
|
||||
// Smoothly change ped position
|
||||
neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep);
|
||||
|
@ -1807,12 +1807,12 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||
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_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
|
||||
neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ;
|
||||
} 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;
|
||||
if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) {
|
||||
moveMult = Min(damageMult * 0.6f, 4.0f);
|
||||
moveMult = min(damageMult * 0.6f, 4.0f);
|
||||
} else {
|
||||
if (nearPed->m_nPedState != PED_DIE || damageMult >= 20) {
|
||||
moveMult = damageMult;
|
||||
} else {
|
||||
moveMult = Min(damageMult * 2.0f, 14.0f);
|
||||
moveMult = min(damageMult * 2.0f, 14.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5434,7 +5434,7 @@ CPed::CreateDeadPedWeaponPickups(void)
|
|||
pickupPos.z = CWorld::FindGroundZFor3DCoord(pickupPos.x, pickupPos.y, pickupPos.z, &found) + 0.5f;
|
||||
}
|
||||
if (found)
|
||||
CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, Min(weaponAmmo, AmmoForWeapon_OnStreet[weapon]));
|
||||
CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, min(weaponAmmo, AmmoForWeapon_OnStreet[weapon]));
|
||||
}
|
||||
ClearWeapons();
|
||||
}
|
||||
|
@ -5443,7 +5443,7 @@ void
|
|||
CPed::SetAttackTimer(uint32 time)
|
||||
{
|
||||
if (CTimer::GetTimeInMilliseconds() > m_attackTimer)
|
||||
m_attackTimer = Max(m_lastHitTime, CTimer::GetTimeInMilliseconds()) + time;
|
||||
m_attackTimer = max(m_lastHitTime, CTimer::GetTimeInMilliseconds()) + time;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -29,7 +29,7 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
|
|||
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
|
||||
foundColZ2 = foundCol.point.z;
|
||||
|
||||
zForPed = Max(foundColZ, foundColZ2);
|
||||
zForPed = max(foundColZ, foundColZ2);
|
||||
|
||||
if (zForPed > -99.0f)
|
||||
pos->z = 1.04f + zForPed;
|
||||
|
|
|
@ -388,7 +388,7 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
|
|||
ms_colourBottom.b = topblue;
|
||||
ms_colourBottom.a = alpha;
|
||||
|
||||
botpos = Min(SCREEN_HEIGHT, topedge);
|
||||
botpos = min(SCREEN_HEIGHT, topedge);
|
||||
CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos),
|
||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||
}
|
||||
|
@ -415,18 +415,18 @@ CClouds::RenderHorizon(void)
|
|||
if(ms_horizonZ > SCREEN_HEIGHT)
|
||||
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),
|
||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||
|
||||
// This is just weird
|
||||
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 ?
|
||||
SCREEN_HEIGHT :
|
||||
SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
|
||||
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),
|
||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ CCoronas::Update(void)
|
|||
int i;
|
||||
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;
|
||||
if(TheCamera.Cams[TheCamera.ActiveCam].LookingLeft) CamLook |= 1;
|
||||
|
@ -121,7 +121,7 @@ CCoronas::Update(void)
|
|||
if(LastCamLook != CamLook)
|
||||
bChangeBrightnessImmediately = 3;
|
||||
else
|
||||
bChangeBrightnessImmediately = Max(bChangeBrightnessImmediately-1, 0);
|
||||
bChangeBrightnessImmediately = max(bChangeBrightnessImmediately-1, 0);
|
||||
LastCamLook = CamLook;
|
||||
|
||||
for(i = 0; i < NUMCORONAS; i++)
|
||||
|
@ -309,7 +309,7 @@ CCoronas::Render(void)
|
|||
|
||||
// render corona itself
|
||||
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)
|
||||
spriteCoors.z = 0.95f * RwCameraGetFarClipPlane(Scene.camera);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aCoronas[i].texture));
|
||||
|
@ -320,7 +320,7 @@ CCoronas::Render(void)
|
|||
float f = 1.0f - aCoronas[i].someAngle*2.0f/PI;
|
||||
float wscale = 6.0f*sq(sq(sq(f))) + 0.5f;
|
||||
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,
|
||||
spritew * aCoronas[i].size * wscale,
|
||||
|
@ -467,7 +467,7 @@ CCoronas::RenderReflections(void)
|
|||
float spritew, spriteh;
|
||||
if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
|
||||
float drawDist = 0.75f * aCoronas[i].drawDist;
|
||||
drawDist = Min(drawDist, 50.0f);
|
||||
drawDist = min(drawDist, 50.0f);
|
||||
if(spriteCoors.z < drawDist){
|
||||
float fadeDistance = drawDist / 2.0f;
|
||||
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 ||
|
||||
!CWorld::GetIsLineOfSightClear(coors, TheCamera.GetPosition(), true, false, false, false, false, false))){
|
||||
// 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){
|
||||
// Same when off screen
|
||||
fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
||||
fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
||||
}else{
|
||||
// Visible
|
||||
if(alpha > fadeAlpha){
|
||||
// fade in
|
||||
fadeAlpha = Min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
|
||||
fadeAlpha = min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
|
||||
if(CCoronas::bChangeBrightnessImmediately)
|
||||
fadeAlpha = alpha;
|
||||
}else if(alpha < fadeAlpha){
|
||||
// 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
|
||||
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
|
||||
|
|
|
@ -37,9 +37,9 @@ SetLightsWithTimeOfDayColour(RpWorld *)
|
|||
AmbientLightColourForFrame.green = 1.0f;
|
||||
AmbientLightColourForFrame.blue = 1.0f;
|
||||
}
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = Min(1.0f, AmbientLightColourForFrame.red*1.3f);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = Min(1.0f, AmbientLightColourForFrame.green*1.3f);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = Min(1.0f, AmbientLightColourForFrame.blue*1.3f);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = min(1.0f, AmbientLightColourForFrame.red*1.3f);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = min(1.0f, AmbientLightColourForFrame.green*1.3f);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = min(1.0f, AmbientLightColourForFrame.blue*1.3f);
|
||||
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 f2 = 3.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
||||
|
||||
AmbientLightColourForFrame.red = Min(1.0f, AmbientLightColourForFrame.red * f2);
|
||||
AmbientLightColourForFrame.green = Min(1.0f, AmbientLightColourForFrame.green * f2);
|
||||
AmbientLightColourForFrame.blue = Min(1.0f, AmbientLightColourForFrame.blue * f2);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.red * f1);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.green * f1);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.blue * f1);
|
||||
AmbientLightColourForFrame.red = min(1.0f, AmbientLightColourForFrame.red * f2);
|
||||
AmbientLightColourForFrame.green = min(1.0f, AmbientLightColourForFrame.green * f2);
|
||||
AmbientLightColourForFrame.blue = min(1.0f, AmbientLightColourForFrame.blue * f2);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.red * f1);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.green * f1);
|
||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.blue * f1);
|
||||
#ifdef FIX_BUGS
|
||||
DirectionalLightColourForFrame.red = Min(1.0f, DirectionalLightColourForFrame.red * f1);
|
||||
DirectionalLightColourForFrame.green = Min(1.0f, DirectionalLightColourForFrame.green * f1);
|
||||
DirectionalLightColourForFrame.blue = Min(1.0f, DirectionalLightColourForFrame.blue * f1);
|
||||
DirectionalLightColourForFrame.red = min(1.0f, DirectionalLightColourForFrame.red * f1);
|
||||
DirectionalLightColourForFrame.green = min(1.0f, DirectionalLightColourForFrame.green * f1);
|
||||
DirectionalLightColourForFrame.blue = min(1.0f, DirectionalLightColourForFrame.blue * f1);
|
||||
#else
|
||||
DirectionalLightColourForFrame.red = min(1.0f, AmbientLightColourForFrame.red * 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;
|
||||
RwV3d *dir;
|
||||
|
||||
strength = Max(Max(red, green), blue);
|
||||
strength = max(max(red, green), blue);
|
||||
n = -1;
|
||||
if(NumExtraDirLightsInWorld < NUMEXTRADIRECTIONALS)
|
||||
n = NumExtraDirLightsInWorld;
|
||||
|
@ -221,7 +221,7 @@ AddAnExtraDirectionalLight(RpWorld *world, float dirx, float diry, float dirz, f
|
|||
RwFrameUpdateObjects(RpLightGetFrame(pExtraDirectionals[n]));
|
||||
RpLightSetFlags(pExtraDirectionals[n], rpLIGHTLIGHTATOMICS);
|
||||
LightStrengths[n] = strength;
|
||||
NumExtraDirLightsInWorld = Min(NumExtraDirLightsInWorld+1, NUMEXTRADIRECTIONALS);
|
||||
NumExtraDirLightsInWorld = min(NumExtraDirLightsInWorld+1, NUMEXTRADIRECTIONALS);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -91,7 +91,7 @@ void cParticleSystemMgr::LoadParticleData()
|
|||
break;
|
||||
|
||||
case CFG_PARAM_INITIAL_COLOR_VARIATION:
|
||||
entry->m_InitialColorVariation = Min(atoi(value), 100);
|
||||
entry->m_InitialColorVariation = min(atoi(value), 100);
|
||||
break;
|
||||
|
||||
case CFG_PARAM_FADE_DESTINATION_COLOR_R:
|
||||
|
|
|
@ -98,7 +98,7 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors)
|
|||
|
||||
if(aLights[i].type == LIGHT_DIRECTIONAL){
|
||||
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)
|
||||
|
|
|
@ -727,10 +727,10 @@ CShadows::RenderStoredShadows(void)
|
|||
float fStartY = shadowPos.y - fHeight;
|
||||
float fEndY = shadowPos.y + fHeight;
|
||||
|
||||
int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||
int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||
int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||
int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||
int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||
int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||
int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||
int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||
|
||||
CWorld::AdvanceCurrentScanCode();
|
||||
|
||||
|
@ -873,10 +873,10 @@ CShadows::GeneratePolysForStaticShadow(int16 nStaticShadowID)
|
|||
float fStartY = shadowPos.y - fHeight;
|
||||
float fEndY = shadowPos.y + fHeight;
|
||||
|
||||
int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||
int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||
int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||
int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||
int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||
int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||
int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||
int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||
|
||||
CWorld::AdvanceCurrentScanCode();
|
||||
|
||||
|
@ -1016,11 +1016,11 @@ CShadows::CastShadowEntity(CEntity *pEntity, float fStartX, float fStartY, floa
|
|||
Points[3].x = (fLengthRight - fFrontRight) - fSideRight;
|
||||
Points[3].y = (fLengthForward - fFrontForward) - fSideForward;
|
||||
|
||||
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 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 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 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 MaxZ = pPosn->z - pEntity->GetPosition().z;
|
||||
float MinZ = MaxZ - fZDistance;
|
||||
|
@ -1767,7 +1767,7 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur
|
|||
{
|
||||
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,
|
||||
2048, 0.2f, 0);
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ CTimeCycle::Update(void)
|
|||
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL);
|
||||
|
||||
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_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
|
||||
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
|
||||
|
@ -311,9 +311,9 @@ CTimeCycle::Update(void)
|
|||
|
||||
if(TheCamera.GetForward().z < -0.9f ||
|
||||
!CWeather::bScriptsForceRain && (CCullZones::PlayerNoRain() || CCullZones::CamNoRain() || CCutsceneMgr::IsRunning()))
|
||||
m_FogReduction = Min(m_FogReduction+1, 64);
|
||||
m_FogReduction = min(m_FogReduction+1, 64);
|
||||
else
|
||||
m_FogReduction = Max(m_FogReduction-1, 0);
|
||||
m_FogReduction = max(m_FogReduction-1, 0);
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
|
|
|
@ -979,7 +979,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
|
|||
SMALL_SECTOR_SIZE / 2,
|
||||
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 *geom = apGeomArray[nGeomUsed++];
|
||||
|
@ -1035,9 +1035,9 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
|
|||
|
||||
RwRGBAAssign(&wakeColor, &color);
|
||||
|
||||
wakeColor.red = Min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
|
||||
wakeColor.green = Min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
|
||||
wakeColor.blue = Min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
|
||||
wakeColor.red = min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
|
||||
wakeColor.green = min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
|
||||
wakeColor.blue = min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
|
||||
|
||||
RwRGBAAssign(&geomPreLights[9*i+j], &wakeColor);
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ CWaterLevel::CalcDistanceToWater(float fX, float fY)
|
|||
fSectorY + SMALL_SECTOR_SIZE - fY
|
||||
);
|
||||
|
||||
fDistSqr = Min(vecDist.MagnitudeSqr(), fDistSqr);
|
||||
fDistSqr = min(vecDist.MagnitudeSqr(), fDistSqr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -691,7 +691,7 @@ CAutomobile::ProcessControl(void)
|
|||
if(m_aSuspensionSpringRatio[i] < 1.0f)
|
||||
m_aWheelTimer[i] = 4.0f;
|
||||
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){
|
||||
m_nWheelsOnGround++;
|
||||
|
@ -1009,7 +1009,7 @@ CAutomobile::ProcessControl(void)
|
|||
|
||||
if(m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PHYSICS){
|
||||
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) &&
|
||||
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
|
||||
FlyingControl(FLIGHT_MODEL_DODO);
|
||||
|
@ -1017,7 +1017,7 @@ CAutomobile::ProcessControl(void)
|
|||
FlyingControl(FLIGHT_MODEL_HELI);
|
||||
}else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
|
||||
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)
|
||||
m_aWheelSpeed[0] += 0.0001f;
|
||||
if(m_aWheelSpeed[0] > 0.15f)
|
||||
|
@ -1129,10 +1129,10 @@ CAutomobile::ProcessControl(void)
|
|||
if(speed > sq(0.1f)){
|
||||
speed = Sqrt(speed);
|
||||
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);
|
||||
}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);
|
||||
}
|
||||
}
|
||||
|
@ -2588,7 +2588,7 @@ CAutomobile::HydraulicControl(void)
|
|||
float minz = pos.z + extendedLowerLimit - wheelRadius;
|
||||
if(minz < specialColModel->boundingBox.min.z)
|
||||
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)
|
||||
specialColModel->boundingSphere.radius = radius;
|
||||
|
||||
|
@ -2687,10 +2687,10 @@ CAutomobile::HydraulicControl(void)
|
|||
float front = -rear;
|
||||
float right = CPad::GetPad(0)->GetCarGunLeftRight()/128.0f;
|
||||
float left = -right;
|
||||
suspChange[CARWHEEL_FRONT_LEFT] = Max(front+left, 0.0f);
|
||||
suspChange[CARWHEEL_REAR_LEFT] = Max(rear+left, 0.0f);
|
||||
suspChange[CARWHEEL_FRONT_RIGHT] = Max(front+right, 0.0f);
|
||||
suspChange[CARWHEEL_REAR_RIGHT] = Max(rear+right, 0.0f);
|
||||
suspChange[CARWHEEL_FRONT_LEFT] = max(front+left, 0.0f);
|
||||
suspChange[CARWHEEL_REAR_LEFT] = max(rear+left, 0.0f);
|
||||
suspChange[CARWHEEL_FRONT_RIGHT] = max(front+right, 0.0f);
|
||||
suspChange[CARWHEEL_REAR_RIGHT] = max(rear+right, 0.0f);
|
||||
|
||||
if(m_hydraulicState < 100){
|
||||
// Lowered, move wheels up
|
||||
|
@ -2806,7 +2806,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||
ApplyTurnForce(impulse, point);
|
||||
|
||||
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 waterResistance = Pow(1.0f - 0.05f*impulseRatio, CTimer::GetTimeStep());
|
||||
m_vecMoveSpeed *= waterResistance;
|
||||
|
@ -2899,7 +2899,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||
float fSpeed = vSpeed.MagnitudeSqr();
|
||||
if(fSpeed > sq(0.05f)){
|
||||
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;
|
||||
|
||||
CParticle::AddParticle(PARTICLE_PED_SPLASH,
|
||||
|
@ -2981,11 +2981,11 @@ CAutomobile::DoDriveByShootings(void)
|
|||
|
||||
// TODO: what is this?
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -3133,7 +3133,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
|
|||
FindPlayerPed()->SetWantedLevelNoDrop(1);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -3286,7 +3286,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
|
|||
|
||||
if(m_pDamageEntity && m_pDamageEntity == FindPlayerVehicle() && impulse > 10.0f){
|
||||
int money = (doubleMoney ? 2 : 1) * impulse*pHandling->nMonetaryValue/1000000.0f;
|
||||
money = Min(money, 40);
|
||||
money = min(money, 40);
|
||||
if(money > 2){
|
||||
sprintf(gString, "$%d", money);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += money;
|
||||
|
@ -3989,7 +3989,7 @@ CAutomobile::SetupSuspensionLines(void)
|
|||
// adjust col model to include suspension lines
|
||||
if(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)
|
||||
colModel->boundingSphere.radius = radius;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ float CBoat::IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat)
|
|||
float fDist = vecDist.MagnitudeSqr();
|
||||
|
||||
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;
|
||||
|
|
|
@ -223,19 +223,19 @@ CHeli::ProcessControl(void)
|
|||
switch(m_heliStatus){
|
||||
case HELI_STATUS_HOVER:
|
||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||
m_fTargetZ = Max(groundZ, m_fTargetZ) + 8.0f;
|
||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 8.0f;
|
||||
break;
|
||||
case HELI_STATUS_SHOT_DOWN:
|
||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||
m_fTargetZ = Max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
||||
break;
|
||||
case HELI_STATUS_HOVER2:
|
||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||
m_fTargetZ = Max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
||||
break;
|
||||
default:
|
||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||
m_fTargetZ = Max(groundZ, m_fTargetZ) + 12.0f;
|
||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 12.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -994,7 +994,7 @@ CHeli::TestBulletCollision(CVector *line0, CVector *line1, CVector *bulletPos, i
|
|||
float distToHeli = (pHelis[i]->GetPosition() - *line0).Magnitude();
|
||||
CVector line = (*line1 - *line0);
|
||||
float lineLength = line.Magnitude();
|
||||
*bulletPos = *line0 + line*Max(1.0f, distToHeli-5.0f);
|
||||
*bulletPos = *line0 + line*max(1.0f, distToHeli-5.0f);
|
||||
|
||||
pHelis[i]->m_nBulletDamage += damage;
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
|||
right = -contactSpeedRight/wheelsOnGround;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ CVehicle::ProcessWheelRotation(tWheelState state, const CVector &fwd, const CVec
|
|||
void
|
||||
CVehicle::ExtinguishCarFire(void)
|
||||
{
|
||||
m_fHealth = Max(m_fHealth, 300.0f);
|
||||
m_fHealth = max(m_fHealth, 300.0f);
|
||||
if(m_pCarFire)
|
||||
m_pCarFire->Extinguish();
|
||||
if(IsCar()){
|
||||
|
@ -638,13 +638,13 @@ CVehicle::SetDriver(CPed *driver)
|
|||
|
||||
if(bFreebies && driver == FindPlayerPed()){
|
||||
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)
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
||||
else if(GetModelIndex() == MI_POLICE)
|
||||
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
|
||||
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)
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
||||
bFreebies = false;
|
||||
|
|
Loading…
Reference in a new issue