ps2 particles, sampman oal started

This commit is contained in:
Fire-Head
2020-04-23 11:24:03 +03:00
parent f754e05321
commit 75acd78190
33 changed files with 5139 additions and 2639 deletions

View File

@ -9548,6 +9548,9 @@ cAudioManager::ResetTimers(uint32 time)
SampleManager.SetEffectsFadeVolume(0);
SampleManager.SetMusicFadeVolume(0);
MusicManager.ResetMusicAfterReload();
#ifdef OPENAL
SampleManager.Service();
#endif
}
}
@ -9603,6 +9606,9 @@ cAudioManager::ServiceSoundEffects()
ProcessMissionAudio();
AdjustSamplesVolume();
ProcessActiveQueues();
#ifdef WITHMILES
SampleManager.Service();
#endif
for(int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) {
cAudioScriptObject *object =
(cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]]
@ -9983,7 +9989,7 @@ cAudioManager::Terminate()
m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
PreTerminateGameSpecificShutdown();
for(uint32 i = 0; i < DIGITALCHANNELS; i++) {
for(uint32 i = 0; i < MAX_SAMPLEBANKS; i++) {
if(SampleManager.IsSampleBankLoaded(i)) SampleManager.UnloadSampleBank(i);
}

View File

@ -581,6 +581,6 @@ public:
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
};
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
//dstatic_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
extern cAudioManager AudioManager;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,339 @@
#pragma once
#include "common.h"
#include "AudioSamples.h"
#define MAX_VOLUME 127
struct tSample {
int32 nOffset;
uint32 nSize;
int32 nFrequency;
int32 nLoopStart;
int32 nLoopEnd;
};
enum
{
SAMPLEBANK_MAIN,
SAMPLEBANK_PED,
MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID
};
#define MAX_PEDSFX 7
#define PED_BLOCKSIZE 79000
#define MAXPROVIDERS 64
#define MAXCHANNELS 28
#define MAXCHANNELS_SURROUND 24
#define MAX2DCHANNELS 1
#define CHANNEL2D MAXCHANNELS
#define MAX_MP3STREAMS 2
#define DIGITALRATE 32000
#define DIGITALBITS 16
#define DIGITALCHANNELS 2
#define MAX_DIGITAL_MIXER_CHANNELS 32
class cSampleManager
{
uint8 m_nEffectsVolume;
uint8 m_nMusicVolume;
uint8 m_nEffectsFadeVolume;
uint8 m_nMusicFadeVolume;
uint8 m_nMonoMode;
char unk;
char m_szCDRomRootPath[80];
bool m_bInitialised;
uint8 m_nNumberOfProviders;
char *m_aAudioProviders[MAXPROVIDERS];
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
public:
cSampleManager(void) :
m_nNumberOfProviders(0)
{ }
~cSampleManager(void)
{ }
void SetSpeakerConfig(int32 nConfig);
uint32 GetMaximumSupportedChannels(void);
uint32 GetNum3DProvidersAvailable() { return m_nNumberOfProviders; }
void SetNum3DProvidersAvailable(uint32 num) { m_nNumberOfProviders = num; }
char *Get3DProviderName(uint8 id) { return m_aAudioProviders[id]; }
void Set3DProviderName(uint8 id, char *name) { m_aAudioProviders[id] = name; }
int8 GetCurrent3DProviderIndex(void);
int8 SetCurrent3DProvider(uint8 which);
bool IsMP3RadioChannelAvailable(void);
void ReleaseDigitalHandle (void);
void ReacquireDigitalHandle(void);
bool Initialise(void);
void Terminate (void);
bool CheckForAnAudioFileOnCD(void);
char GetCDAudioDriveLetter (void);
void UpdateEffectsVolume(void);
void SetEffectsMasterVolume(uint8 nVolume);
void SetMusicMasterVolume (uint8 nVolume);
void SetEffectsFadeVolume (uint8 nVolume);
void SetMusicFadeVolume (uint8 nVolume);
bool LoadSampleBank (uint8 nBank);
void UnloadSampleBank (uint8 nBank);
bool IsSampleBankLoaded(uint8 nBank);
bool IsPedCommentLoaded(uint32 nComment);
bool LoadPedComment (uint32 nComment);
int32 _GetPedCommentSlot(uint32 nComment);
int32 GetSampleBaseFrequency (uint32 nSample);
int32 GetSampleLoopStartOffset(uint32 nSample);
int32 GetSampleLoopEndOffset (uint32 nSample);
uint32 GetSampleLength (uint32 nSample);
bool UpdateReverb(void);
void SetChannelReverbFlag (uint32 nChannel, uint8 nReverbFlag);
bool InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
void SetChannelPan (uint32 nChannel, uint32 nPan);
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
bool GetChannelUsedFlag (uint32 nChannel);
void StartChannel (uint32 nChannel);
void StopChannel (uint32 nChannel);
void PreloadStreamedFile (uint8 nFile, uint8 nStream);
void PauseStream (uint8 nPauseFlag, uint8 nStream);
void StartPreloadedStreamedFile (uint8 nStream);
bool StartStreamedFile (uint8 nFile, uint32 nPos, uint8 nStream);
void StopStreamedFile (uint8 nStream);
int32 GetStreamedFilePosition (uint8 nStream);
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream);
int32 GetStreamedFileLength (uint8 nStream);
bool IsStreamPlaying (uint8 nStream);
bool InitialiseSampleBanks(void);
};
extern cSampleManager SampleManager;
extern int32 BankStartOffset[MAX_SAMPLEBANKS];
static char StreamedNameTable[][25]=
{
"AUDIO\\HEAD.WAV",
"AUDIO\\CLASS.WAV",
"AUDIO\\KJAH.WAV",
"AUDIO\\RISE.WAV",
"AUDIO\\LIPS.WAV",
"AUDIO\\GAME.WAV",
"AUDIO\\MSX.WAV",
"AUDIO\\FLASH.WAV",
"AUDIO\\CHAT.WAV",
"AUDIO\\HEAD.WAV",
"AUDIO\\POLICE.WAV",
"AUDIO\\CITY.WAV",
"AUDIO\\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e.WAV",
"AUDIO\\yd2_f.WAV",
"AUDIO\\yd2_g.WAV",
"AUDIO\\yd2_h.WAV",
"AUDIO\\yd2_ass.WAV",
"AUDIO\\yd2_ok.WAV",
"AUDIO\\h5_a.WAV",
"AUDIO\\h5_b.WAV",
"AUDIO\\h5_c.WAV",
"AUDIO\\ammu_a.WAV",
"AUDIO\\ammu_b.WAV",
"AUDIO\\ammu_c.WAV",
"AUDIO\\door_1.WAV",
"AUDIO\\door_2.WAV",
"AUDIO\\door_3.WAV",
"AUDIO\\door_4.WAV",
"AUDIO\\door_5.WAV",
"AUDIO\\door_6.WAV",
"AUDIO\\t3_a.WAV",
"AUDIO\\t3_b.WAV",
"AUDIO\\t3_c.WAV",
"AUDIO\\k1_b.WAV",
"AUDIO\\cat1.WAV"
};

File diff suppressed because it is too large Load Diff

340
src/audio/openal/samp_oal.h Normal file
View File

@ -0,0 +1,340 @@
#pragma once
#include "common.h"
#include "AudioSamples.h"
#define MAX_VOLUME 127
//#define MAX_FREQ 22050
#define MAX_FREQ 32000
struct tSample {
int32 nOffset;
uint32 nSize;
int32 nFrequency;
int32 nLoopStart;
int32 nLoopEnd;
};
enum
{
SAMPLEBANK_MAIN,
SAMPLEBANK_PED,
MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID
};
#define MAX_PEDSFX 7
#define PED_BLOCKSIZE 79000
//#define MAXCHANNELS 21 android
#define MAXCHANNELS 28
#define MAX2DCHANNELS 1
#define CHANNEL2D MAXCHANNELS
#define MAX_STREAMS 2
struct ALCdevice_struct;
struct ALCcontext_struct;
typedef struct ALCdevice_struct ALCdevice;
typedef struct ALCcontext_struct ALCcontext;
class cSampleManager
{
int field_0;
ALCdevice *m_pDevice;
ALCcontext *m_pContext;
uint8 m_nEffectsVolume;
uint8 m_nMusicVolume;
uint8 m_nEffectsFadeVolume;
uint8 m_nMusicFadeVolume;
uint8 m_nMonoMode;
char _pad0[3];
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
public:
cSampleManager(void);
~cSampleManager(void);
void SetSpeakerConfig(int32 nConfig);
uint32 GetMaximumSupportedChannels(void);
uint32 GetNum3DProvidersAvailable();
void SetNum3DProvidersAvailable(uint32 num);
char *Get3DProviderName(uint8 id);
void Set3DProviderName(uint8 id, char *name);
int8 GetCurrent3DProviderIndex(void);
int8 SetCurrent3DProvider(uint8 which);
bool IsMP3RadioChannelAvailable(void);
void ReleaseDigitalHandle (void);
void ReacquireDigitalHandle(void);
bool Initialise(void);
void Terminate (void);
void UpdateSoundBuffers(void);
bool CheckForAnAudioFileOnCD(void);
char GetCDAudioDriveLetter (void);
void UpdateEffectsVolume(void);
void SetEffectsMasterVolume(uint8 nVolume);
void SetMusicMasterVolume (uint8 nVolume);
void SetEffectsFadeVolume (uint8 nVolume);
void SetMusicFadeVolume (uint8 nVolume);
void SetMonoMode (uint8 nMode);
bool LoadSampleBank (uint8 nBank);
void UnloadSampleBank (uint8 nBank);
bool IsSampleBankLoaded(uint8 nBank);
bool IsPedCommentLoaded(uint32 nComment);
bool LoadPedComment (uint32 nComment);
int32 GetBankContainingSound(uint32 offset);
int32 _GetPedCommentSlot(uint32 nComment);
int32 GetSampleBaseFrequency (uint32 nSample);
int32 GetSampleLoopStartOffset(uint32 nSample);
int32 GetSampleLoopEndOffset (uint32 nSample);
uint32 GetSampleLength (uint32 nSample);
bool UpdateReverb(void);
void SetChannelReverbFlag (uint32 nChannel, uint8 nReverbFlag);
bool InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
void SetChannelPan (uint32 nChannel, uint32 nPan);
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
bool GetChannelUsedFlag (uint32 nChannel);
void StartChannel (uint32 nChannel);
void StopChannel (uint32 nChannel);
void PreloadStreamedFile (uint8 nFile, uint8 nStream);
void PauseStream (uint8 nPauseFlag, uint8 nStream);
void StartPreloadedStreamedFile (uint8 nStream);
bool StartStreamedFile (uint8 nFile, uint32 nPos, uint8 nStream);
void StopStreamedFile (uint8 nStream);
int32 GetStreamedFilePosition (uint8 nStream);
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream);
int32 GetStreamedFileLength (uint8 nStream);
bool IsStreamPlaying (uint8 nStream);
void Service(void);
bool InitialiseSampleBanks(void);
};
extern cSampleManager SampleManager;
extern int32 BankStartOffset[MAX_SAMPLEBANKS];
static char StreamedNameTable[][25]=
{
"AUDIO\\HEAD.MP3",
"AUDIO\\CLASS.MP3",
"AUDIO\\KJAH.MP3",
"AUDIO\\RISE.MP3",
"AUDIO\\LIPS.MP3",
"AUDIO\\GAME.MP3",
"AUDIO\\MSX.MP3",
"AUDIO\\FLASH.MP3",
"AUDIO\\CHAT.MP3",
"AUDIO\\HEAD.MP3",
"AUDIO\\POLICE.MP3",
"AUDIO\\CITY.MP3",
"AUDIO\\WATER.MP3",
"AUDIO\\COMOPEN.MP3",
"AUDIO\\SUBOPEN.MP3",
"AUDIO\\JB.MP3",
"AUDIO\\BET.MP3",
"AUDIO\\L1_LG.MP3",
"AUDIO\\L2_DSB.MP3",
"AUDIO\\L3_DM.MP3",
"AUDIO\\L4_PAP.MP3",
"AUDIO\\L5_TFB.MP3",
"AUDIO\\J0_DM2.MP3",
"AUDIO\\J1_LFL.MP3",
"AUDIO\\J2_KCL.MP3",
"AUDIO\\J3_VH.MP3",
"AUDIO\\J4_ETH.MP3",
"AUDIO\\J5_DST.MP3",
"AUDIO\\J6_TBJ.MP3",
"AUDIO\\T1_TOL.MP3",
"AUDIO\\T2_TPU.MP3",
"AUDIO\\T3_MAS.MP3",
"AUDIO\\T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
"AUDIO\\cat1.MP3"
};

File diff suppressed because it is too large Load Diff

View File

@ -1,339 +1,7 @@
#pragma once
#include "common.h"
#include "AudioSamples.h"
#define MAX_VOLUME 127
struct tSample {
int32 nOffset;
uint32 nSize;
int32 nFrequency;
int32 nLoopStart;
int32 nLoopEnd;
};
enum
{
SAMPLEBANK_MAIN,
SAMPLEBANK_PED,
MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID
};
#define MAX_PEDSFX 7
#define PED_BLOCKSIZE 79000
#define MAXPROVIDERS 64
#define MAXCHANNELS 28
#define MAXCHANNELS_SURROUND 24
#define MAX2DCHANNELS 1
#define CHANNEL2D MAXCHANNELS
#define MAX_MP3STREAMS 2
#define DIGITALRATE 32000
#define DIGITALBITS 16
#define DIGITALCHANNELS 2
#define MAX_DIGITAL_MIXER_CHANNELS 32
class cSampleManager
{
uint8 m_nEffectsVolume;
uint8 m_nMusicVolume;
uint8 m_nEffectsFadeVolume;
uint8 m_nMusicFadeVolume;
uint8 m_nMonoMode;
char unk;
char m_szCDRomRootPath[80];
bool m_bInitialised;
uint8 m_nNumberOfProviders;
char *m_aAudioProviders[MAXPROVIDERS];
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
public:
cSampleManager(void) :
m_nNumberOfProviders(0)
{ }
~cSampleManager(void)
{ }
void SetSpeakerConfig(int32 nConfig);
uint32 GetMaximumSupportedChannels(void);
uint32 GetNum3DProvidersAvailable() { return m_nNumberOfProviders; }
void SetNum3DProvidersAvailable(uint32 num) { m_nNumberOfProviders = num; }
char *Get3DProviderName(uint8 id) { return m_aAudioProviders[id]; }
void Set3DProviderName(uint8 id, char *name) { m_aAudioProviders[id] = name; }
int8 GetCurrent3DProviderIndex(void);
int8 SetCurrent3DProvider(uint8 which);
bool IsMP3RadioChannelAvailable(void);
void ReleaseDigitalHandle (void);
void ReacquireDigitalHandle(void);
bool Initialise(void);
void Terminate (void);
bool CheckForAnAudioFileOnCD(void);
char GetCDAudioDriveLetter (void);
void UpdateEffectsVolume(void);
void SetEffectsMasterVolume(uint8 nVolume);
void SetMusicMasterVolume (uint8 nVolume);
void SetEffectsFadeVolume (uint8 nVolume);
void SetMusicFadeVolume (uint8 nVolume);
bool LoadSampleBank (uint8 nBank);
void UnloadSampleBank (uint8 nBank);
bool IsSampleBankLoaded(uint8 nBank);
bool IsPedCommentLoaded(uint32 nComment);
bool LoadPedComment (uint32 nComment);
int32 _GetPedCommentSlot(uint32 nComment);
int32 GetSampleBaseFrequency (uint32 nSample);
int32 GetSampleLoopStartOffset(uint32 nSample);
int32 GetSampleLoopEndOffset (uint32 nSample);
uint32 GetSampleLength (uint32 nSample);
bool UpdateReverb(void);
void SetChannelReverbFlag (uint32 nChannel, uint8 nReverbFlag);
bool InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
void SetChannelPan (uint32 nChannel, uint32 nPan);
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
bool GetChannelUsedFlag (uint32 nChannel);
void StartChannel (uint32 nChannel);
void StopChannel (uint32 nChannel);
void PreloadStreamedFile (uint8 nFile, uint8 nStream);
void PauseStream (uint8 nPauseFlag, uint8 nStream);
void StartPreloadedStreamedFile (uint8 nStream);
bool StartStreamedFile (uint8 nFile, uint32 nPos, uint8 nStream);
void StopStreamedFile (uint8 nStream);
int32 GetStreamedFilePosition (uint8 nStream);
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream);
int32 GetStreamedFileLength (uint8 nStream);
bool IsStreamPlaying (uint8 nStream);
bool InitialiseSampleBanks(void);
};
extern cSampleManager SampleManager;
extern int32 BankStartOffset[MAX_SAMPLEBANKS];
static char StreamedNameTable[][25]=
{
"AUDIO\\HEAD.WAV",
"AUDIO\\CLASS.WAV",
"AUDIO\\KJAH.WAV",
"AUDIO\\RISE.WAV",
"AUDIO\\LIPS.WAV",
"AUDIO\\GAME.WAV",
"AUDIO\\MSX.WAV",
"AUDIO\\FLASH.WAV",
"AUDIO\\CHAT.WAV",
"AUDIO\\HEAD.WAV",
"AUDIO\\POLICE.WAV",
"AUDIO\\CITY.WAV",
"AUDIO\\WATER.WAV",
"AUDIO\\COMOPEN.WAV",
"AUDIO\\SUBOPEN.WAV",
"AUDIO\\JB.MP3",
"AUDIO\\BET.MP3",
"AUDIO\\L1_LG.MP3",
"AUDIO\\L2_DSB.MP3",
"AUDIO\\L3_DM.MP3",
"AUDIO\\L4_PAP.MP3",
"AUDIO\\L5_TFB.MP3",
"AUDIO\\J0_DM2.MP3",
"AUDIO\\J1_LFL.MP3",
"AUDIO\\J2_KCL.MP3",
"AUDIO\\J3_VH.MP3",
"AUDIO\\J4_ETH.MP3",
"AUDIO\\J5_DST.MP3",
"AUDIO\\J6_TBJ.MP3",
"AUDIO\\T1_TOL.MP3",
"AUDIO\\T2_TPU.MP3",
"AUDIO\\T3_MAS.MP3",
"AUDIO\\T4_TAT.MP3",
"AUDIO\\T5_BF.MP3",
"AUDIO\\S0_MAS.MP3",
"AUDIO\\S1_PF.MP3",
"AUDIO\\S2_CTG.MP3",
"AUDIO\\S3_RTC.MP3",
"AUDIO\\S5_LRQ.MP3",
"AUDIO\\S4_BDBA.MP3",
"AUDIO\\S4_BDBB.MP3",
"AUDIO\\S2_CTG2.MP3",
"AUDIO\\S4_BDBD.MP3",
"AUDIO\\S5_LRQB.MP3",
"AUDIO\\S5_LRQC.MP3",
"AUDIO\\A1_SSO.WAV",
"AUDIO\\A2_PP.WAV",
"AUDIO\\A3_SS.WAV",
"AUDIO\\A4_PDR.WAV",
"AUDIO\\A5_K2FT.WAV",
"AUDIO\\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"AUDIO\\r2_f.WAV",
"AUDIO\\r2_g.WAV",
"AUDIO\\r2_h.WAV",
"AUDIO\\r5_a.WAV",
"AUDIO\\r6_a.WAV",
"AUDIO\\r6_a1.WAV",
"AUDIO\\r6_b.WAV",
"AUDIO\\lo2_a.WAV",
"AUDIO\\lo6_a.WAV",
"AUDIO\\yd2_a.WAV",
"AUDIO\\yd2_b.WAV",
"AUDIO\\yd2_c.WAV",
"AUDIO\\yd2_c1.WAV",
"AUDIO\\yd2_d.WAV",
"AUDIO\\yd2_e.WAV",
"AUDIO\\yd2_f.WAV",
"AUDIO\\yd2_g.WAV",
"AUDIO\\yd2_h.WAV",
"AUDIO\\yd2_ass.WAV",
"AUDIO\\yd2_ok.WAV",
"AUDIO\\h5_a.WAV",
"AUDIO\\h5_b.WAV",
"AUDIO\\h5_c.WAV",
"AUDIO\\ammu_a.WAV",
"AUDIO\\ammu_b.WAV",
"AUDIO\\ammu_c.WAV",
"AUDIO\\door_1.WAV",
"AUDIO\\door_2.WAV",
"AUDIO\\door_3.WAV",
"AUDIO\\door_4.WAV",
"AUDIO\\door_5.WAV",
"AUDIO\\door_6.WAV",
"AUDIO\\t3_a.WAV",
"AUDIO\\t3_b.WAV",
"AUDIO\\t3_c.WAV",
"AUDIO\\k1_b.WAV",
"AUDIO\\cat1.WAV"
};
#ifndef OPENAL
#include "miles\sampman_mss.h"
#else
#include "openal\samp_oal.h"
#endif

View File

@ -193,6 +193,11 @@ enum Config {
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
//#define USE_TXD_CDIMAGE // generate and load textures from txd.img
//#define USE_TEXTURE_POOL
//#define OPENAL
// Particle
//#define PC_PARTICLE
//#define PS2_ALTERNATIVE_CARSPLASH // unused on PS2
// Pad
#define XINPUT

View File

@ -372,7 +372,6 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", (int8*)&CPed::bMakePedsRunToPhonesToReportCrimes, nil);
#endif

View File

@ -169,7 +169,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{
pobj->m_ParticleType = PARTICLE_STEAM_NY;
pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 8;
break;
}
@ -187,7 +191,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{
pobj->m_ParticleType = PARTICLE_STEAM_NY;
pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 8;
break;
}
@ -205,7 +213,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{
pobj->m_ParticleType = PARTICLE_STEAM_NY;
pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 8;
pobj->m_Color = CRGBA(16, 16, 16, 255);
break;
@ -228,7 +240,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{
pobj->m_ParticleType = PARTICLE_CAR_SPLASH;
pobj->m_nNumEffectCycles = 0;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 1;
#else
pobj->m_nSkipFrames = 3;
#endif
pobj->m_nCreationChance = 0;
break;
}
@ -236,7 +252,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
case POBJECT_SPLASHES_AROUND:
{
pobj->m_ParticleType = PARTICLE_SPLASH;
#ifdef PC_PARTICLE
pobj->m_nNumEffectCycles = 15;
#else
pobj->m_nNumEffectCycles = 30;
#endif
pobj->m_nSkipFrames = 2;
pobj->m_nCreationChance = 0;
break;
@ -246,7 +266,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{
pobj->m_ParticleType = PARTICLE_FLAME;
pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 2;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 2;
pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f);
break;
@ -256,7 +280,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{
pobj->m_ParticleType = PARTICLE_FLAME;
pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 2;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 4;
pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f);
break;
@ -286,7 +314,11 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
{
pobj->m_ParticleType = PARTICLE_EXPLOSION_MEDIUM;
pobj->m_nNumEffectCycles = 1;
#ifdef PC_PARTICLE
pobj->m_nSkipFrames = 3;
#else
pobj->m_nSkipFrames = 1;
#endif
pobj->m_nCreationChance = 2;
pobj->m_fRandVal = 0.01f;
break;
@ -598,6 +630,7 @@ void CParticleObject::UpdateClose(void)
case POBJECT_PED_WATER_SPLASH:
{
#ifdef PC_PARTICLE
CRGBA colorsmoke(255, 255, 255, 196);
CVector pos = this->GetPosition();
@ -699,12 +732,69 @@ void CParticleObject::UpdateClose(void)
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL,
CGeneral::GetRandomNumberInRange(0.4f, 1.0f), this->m_Color);
}
#else
CVector pos;
CVector vel;
for ( int32 i = -2; i < 2; i++ )
{
pos = this->GetPosition();
pos += CVector(-0.75f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += -1.5 * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.75f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += 1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), -0.75, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += -1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), 0.75, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += 1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
}
for ( int32 i = 0; i < 4; i++ )
{
pos = this->GetPosition();
pos.x += CGeneral::GetRandomNumberInRange(-1.5f, 1.5f);
pos.y += CGeneral::GetRandomNumberInRange(-1.5f, 1.5f);
pos.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
vel = this->m_vecTarget;
CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color);
}
#endif
break;
}
case POBJECT_CAR_WATER_SPLASH:
{
#ifdef PC_PARTICLE
CRGBA colorsmoke(255, 255, 255, 196);
CVector pos = this->GetPosition();
@ -799,7 +889,65 @@ void CParticleObject::UpdateClose(void)
splashvel.z += CGeneral::GetRandomNumberInRange(0.26f, 0.53f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color);
}
#else
CVector pos;
CVector vel;
for ( int32 i = -3; i < 4; i++ )
{
pos = this->GetPosition();
pos += CVector(-1.5f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += -3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
pos = this->GetPosition();
pos += CVector(1.5f, 0.5f * float(i), 0.0f);
vel = this->m_vecTarget;
vel.x += 3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), -1.5f, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += -3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
pos = this->GetPosition();
pos += CVector(0.5f * float(i), 1.5f, 0.0f);
vel = this->m_vecTarget;
vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.y += 3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f);
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
}
for ( int32 i = 0; i < 8; i++ )
{
pos = this->GetPosition();
pos.x += CGeneral::GetRandomNumberInRange(-3.0f, 3.0f);
pos.y += CGeneral::GetRandomNumberInRange(-3.0f, 3.0f);
vel = this->m_vecTarget;
vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color);
}
#endif
break;
}

View File

@ -2019,7 +2019,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
}
static void
particleProduceFootDust(CPed *ped, CVector *pos, float size, int times)
particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times)
{
switch (ped->m_nSurfaceTouched)
{
@ -2028,7 +2028,7 @@ particleProduceFootDust(CPed *ped, CVector *pos, float size, int times)
case SURFACE_PAVEMENT:
case SURFACE_SAND:
for (int i = 0; i < times; ++i) {
CVector adjustedPos = *pos;
CVector adjustedPos = pos;
adjustedPos.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
adjustedPos.y += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
CParticle::AddParticle(PARTICLE_PEDFOOT_DUST, adjustedPos, CVector(0.0f, 0.0f, 0.0f), nil, size, CRGBA(0, 0, 0, 0), 0, 0, 0, 0);
@ -2040,16 +2040,27 @@ particleProduceFootDust(CPed *ped, CVector *pos, float size, int times)
}
static void
particleProduceFootSplash(CPed *ped, CVector *pos, float size, int times)
particleProduceFootSplash(CPed *ped, CVector const &pos, float size, int times)
{
#ifdef PC_PARTICLE
for (int i = 0; i < times; i++) {
CVector adjustedPos = *pos;
CVector adjustedPos = pos;
adjustedPos.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
adjustedPos.y += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
CVector direction = ped->GetForward() * -0.05f;
CParticle::AddParticle(PARTICLE_RAIN_SPLASHUP, adjustedPos, direction, nil, size, CRGBA(32, 32, 32, 32), 0, 0, CGeneral::GetRandomNumber() & 1, 200);
}
#else
for ( int32 i = 0; i < times; i++ )
{
CVector adjustedPos = pos;
adjustedPos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
adjustedPos.y += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
CParticle::AddParticle(PARTICLE_RAIN_SPLASHUP, adjustedPos, CVector(0.0f, 0.0f, 0.0f), nil, size, CRGBA(0, 0, 0, 0), 0, 0, CGeneral::GetRandomNumber() & 1, 200);
}
#endif
}
void
@ -2080,6 +2091,50 @@ CPed::PlayFootSteps(void)
}
}
#ifdef GTA_PS2_STUFF
CAnimBlendAssociation *runStopAsoc = NULL;
if ( IsPlayer() )
{
runStopAsoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_RUN_STOP);
if ( runStopAsoc == NULL )
runStopAsoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_RUN_STOP_R);
}
if ( runStopAsoc != NULL && runStopAsoc->blendAmount > 0.1f )
{
{
CVector pos(0.0f, 0.0f, 0.0f);
RwFrame *parent = m_pFrames[PED_FOOTL]->frame;
while( parent )
{
RwV3dTransformPoints(pos, pos, 1, RwFrameGetMatrix(parent));
parent = RwFrameGetParent(parent);
}
pos.z -= 0.1f;
pos += GetForward()*0.2f;
particleProduceFootDust(this, pos, 0.02f, 1);
}
{
CVector pos(0.0f, 0.0f, 0.0f);
RwFrame *parent = m_pFrames[PED_FOOTR]->frame;
while( parent )
{
RwV3dTransformPoints(pos, pos, 1, RwFrameGetMatrix(parent));
parent = RwFrameGetParent(parent);
}
pos.z -= 0.1f;
pos += GetForward()*0.2f;
particleProduceFootDust(this, pos, 0.02f, 1);
}
}
#endif
if (walkRunAssoc && walkRunAssocBlend > 0.5f && idleAssocBlend < 1.0f) {
float stepStart = 1 / 15.0f;
float stepEnd = walkRunAssoc->hierarchy->totalLength / 2.0f + stepStart;
@ -2121,9 +2176,15 @@ CPed::PlayFootSteps(void)
}
if (CWeather::Rain <= 0.1f || CCullZones::CamNoRain() || CCullZones::PlayerNoRain()) {
if(IsPlayer())
particleProduceFootDust(this, &footPos, 0.0f, 4);
} else if(stepPart == 2) {
particleProduceFootSplash(this, &footPos, 0.15f, 4);
particleProduceFootDust(this, footPos, 0.0f, 4);
}
#ifdef PC_PARTICLE
else if(stepPart == 2)
#else
else
#endif
{
particleProduceFootSplash(this, footPos, 0.15f, 4);
}
}
}
@ -2131,6 +2192,7 @@ CPed::PlayFootSteps(void)
if (m_nSurfaceTouched == SURFACE_PUDDLE) {
float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude();
if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) {
#ifdef PC_PARTICLE
float particleSize = pedSpeed * 2.0f;
if (particleSize < 0.25f)
@ -2149,6 +2211,12 @@ CPed::PlayFootSteps(void)
particleDir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.05f);
CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, particlePos, particleDir, nil, particleSize, CRGBA(255,255,255,255), 0, 0, 0, 0);
#else
CVector particlePos = (GetPosition() - 0.3f * GetUp()) + GetForward()*0.3f;
CVector particleDir = m_vecMoveSpeed * 0.45f;
particleDir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.05f);
CParticle::AddParticle(PARTICLE_PED_SPLASH, particlePos-CVector(0.0f, 0.0f, 1.2f), particleDir, nil, 0.0f, CRGBA(155, 185, 155, 255));
#endif
}
}
}
@ -15114,7 +15182,11 @@ CPed::ProcessBuoyancy(void)
bIsInTheAir = false;
}
pos.z = pos.z - 0.8f;
#ifdef PC_PARTICLE
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, pos, CVector(0.0f, 0.0f, 0.0f), 0.0f, 50, color, true);
#else
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, pos, CVector(0.0f, 0.0f, 0.0f), 0.0f, 50, CRGBA(0, 0, 0, 0), true);
#endif
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_nPedState = PED_IDLE;
return;
@ -15143,6 +15215,7 @@ CPed::ProcessBuoyancy(void)
} else {
m_vecMoveSpeed.z = -0.01f;
DMAudio.PlayOneShot(m_audioEntityId, SOUND_SPLASH, 0.0f);
#ifdef PC_PARTICLE
CVector aBitForward = 2.2f * m_vecMoveSpeed + GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(aBitForward, &level, false))
@ -15151,6 +15224,18 @@ CPed::ProcessBuoyancy(void)
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, aBitForward, CVector(0.0f, 0.0f, 0.1f), 0.0f, 200, color, true);
nGenerateRaindrops = CTimer::GetTimeInMilliseconds() + 80;
nGenerateWaterCircles = CTimer::GetTimeInMilliseconds() + 100;
#else
CVector aBitForward = 1.6f * m_vecMoveSpeed + GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(aBitForward, &level, false))
aBitForward.z = level + 0.5f;
CVector vel = m_vecMoveSpeed * 0.1f;
vel.z = 0.18f;
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, aBitForward, vel, 0.0f, 350, CRGBA(0, 0, 0, 0), true);
nGenerateRaindrops = CTimer::GetTimeInMilliseconds() + 300;
nGenerateWaterCircles = CTimer::GetTimeInMilliseconds() + 60;
#endif
}
}
} else
@ -15167,9 +15252,15 @@ CPed::ProcessBuoyancy(void)
if (pos.z != 0.0f) {
nGenerateWaterCircles = 0;
for(int i = 0; i < 4; i++) {
#ifdef PC_PARTICLE
pos.x += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
pos.y += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
CParticle::AddParticle(PARTICLE_RAIN_SPLASH_BIGGROW, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, color, 0, 0, 0, 0);
#else
pos.x += CGeneral::GetRandomNumberInRange(-2.5f, 2.5f);
pos.y += CGeneral::GetRandomNumberInRange(-2.5f, 2.5f);
CParticle::AddParticle(PARTICLE_RAIN_SPLASH_BIGGROW, pos+CVector(0.0f, 0.0f, 1.0f), CVector(0.0f, 0.0f, 0.0f));
#endif
}
}
}
@ -15181,9 +15272,17 @@ CPed::ProcessBuoyancy(void)
pos.z = level;
if (pos.z >= 0.0f) {
#ifdef PC_PARTICLE
pos.z += 0.25f;
#else
pos.z += 0.5f;
#endif
nGenerateRaindrops = 0;
#ifdef PC_PARTICLE
CParticleObject::AddObject(POBJECT_SPLASHES_AROUND, pos, CVector(0.0f, 0.0f, 0.0f), 4.5f, 1500, CRGBA(0,0,0,0), true);
#else
CParticleObject::AddObject(POBJECT_SPLASHES_AROUND, pos, CVector(0.0f, 0.0f, 0.0f), 4.5f, 2500, CRGBA(0,0,0,0), true);
#endif
}
}
}

View File

@ -12,9 +12,6 @@
#include "ParticleObject.h"
#include "Particle.h"
#ifdef TOGGLEABLE_BETA_FEATURES
bool CParticle::bEnableBannedParticles = false;
#endif
#define MAX_PARTICLES_ON_SCREEN (1000)
@ -388,8 +385,12 @@ void CParticle::Initialise()
gpFlame5Tex = RwTextureRead("flame5", nil);
#ifdef FIX_BUGS
gpFlame5Raster = RwTextureGetRaster(gpFlame5Tex);
#else
gpFlame5Raster = RwTextureGetRaster(gpFlame1Tex); // copy-paste bug ?
#endif
gpRainDropSmallTex = RwTextureRead("rainsmall", nil);
gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex);
@ -767,9 +768,8 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
{
if ( CTimer::GetIsPaused() )
return NULL;
#ifdef TOGGLEABLE_BETA_FEATURES
if(!bEnableBannedParticles)
#endif
#ifdef PC_PARTICLE
if ( ( type == PARTICLE_ENGINE_SMOKE
|| type == PARTICLE_ENGINE_SMOKE2
|| type == PARTICLE_ENGINE_STEAM
@ -782,6 +782,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
{
return nil;
}
#endif
CParticle *pParticle = m_pUnusedListHead;
@ -853,6 +854,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
pParticle->m_nRotation = nRotation;
// PC only
if ( pParticle->m_nRotation >= 360 )
pParticle->m_nRotation -= 360;
else if ( pParticle->m_nRotation < 0 )
@ -1348,12 +1350,13 @@ void CParticle::Update()
particle->m_nAlpha = clamp(particle->m_nAlpha - psystem->m_nFadeAlphaAmount,
0, 255);
#ifdef PC_PARTICLE
if ( particle->m_nAlpha == 0 )
{
bRemoveParticle = true;
continue;
}
#endif
}
else
++particle->m_nFadeAlphaTimer;
@ -1448,18 +1451,15 @@ void CParticle::Render()
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
#ifdef PC_PARTICLE
bool particleBanned = false;
#endif
CParticle *particle = psystem->m_pParticles;
RwRaster **frames = psystem->m_ppRaster;
#ifdef PC_PARTICLE
tParticleType type = psystem->m_Type;
#ifdef TOGGLEABLE_BETA_FEATURES
if (!bEnableBannedParticles)
#endif
if ( type == PARTICLE_ENGINE_SMOKE
|| type == PARTICLE_ENGINE_SMOKE2
|| type == PARTICLE_ENGINE_STEAM
@ -1471,7 +1471,8 @@ void CParticle::Render()
{
particleBanned = true;
}
#endif
if ( particle )
{
if ( (flags & DRAW_OPAQUE) != (psystem->Flags & DRAW_OPAQUE)
@ -1512,10 +1513,11 @@ void CParticle::Render()
while ( particle != nil )
{
bool canDraw = true;
#ifdef PC_PARTICLE
if ( particle->m_nAlpha == 0 )
canDraw = false;
#endif
if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil )
{
RwRaster *curFrame = frames[particle->m_nCurrentFrame];
@ -1538,7 +1540,7 @@ void CParticle::Render()
particle->m_fSize * 63.0f,
particle->m_Color,
particle->m_nColorIntensity,
(float)particle->m_nRotation,
(float)particle->m_nRotation, //DEGTORAD((float)particle->m_nRotation) ps2
particle->m_nAlpha);
}
else
@ -1564,8 +1566,10 @@ void CParticle::Render()
if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
{
#ifdef PC_PARTICLE
if ( (!particleBanned || SCREEN_WIDTH * fParticleScaleLimit >= w)
&& SCREEN_HEIGHT * fParticleScaleLimit >= h )
#endif
{
if ( particle->m_nRotation != 0 )
{
@ -1576,7 +1580,7 @@ void CParticle::Render()
particle->m_Color.blue,
particle->m_nColorIntensity,
1.0f / coors.z,
float(particle->m_nRotation),
float(particle->m_nRotation), // DEGTORAD((float)particle->m_nRotation) ps2
particle->m_nAlpha);
}
else if ( psystem->Flags & SCREEN_TRAIL )
@ -1601,7 +1605,6 @@ void CParticle::Render()
fTrailLength = fDist;
//Float fRot = Atan2( vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
float fRot = Asin(vecDist.x / fDist);
fRotation = fRot;
@ -1653,7 +1656,6 @@ void CParticle::Render()
fTrailLength = fDist;
//Float fRot = Atan2(vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
float fRot = Asin(vecDist.x / fDist);
fRotation = fRot;

View File

@ -89,10 +89,6 @@ public:
static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize);
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
#ifdef TOGGLEABLE_BETA_FEATURES
static bool bEnableBannedParticles;
#endif
};
VALIDATE_SIZE(CParticle, 0x68);

View File

@ -8,8 +8,7 @@ cParticleSystemMgr mod_ParticleSystemManager;
const char *ParticleFilename = "PARTICLE.CFG";
//cParticleSystemMgr::cParticleSystemMgr()
void cParticleSystemMgr::ctor()
cParticleSystemMgr::cParticleSystemMgr()
{
memset(this, 0, sizeof(*this));
}

View File

@ -118,11 +118,11 @@ class cParticleSystemMgr
public:
tParticleSystemData m_aParticles[MAX_PARTICLES];
cParticleSystemMgr() { ctor(); } void ctor();
cParticleSystemMgr();
void Initialise();
void LoadParticleData();
//void RangeCheck(tParticleSystemData *pData);
void RangeCheck(tParticleSystemData *pData) { }
};
VALIDATE_SIZE(cParticleSystemMgr, 0x2420);

View File

@ -2848,6 +2848,7 @@ CAutomobile::ProcessBuoyancy(void)
static uint32 nGenerateWaterCircles = 0;
if(initialSpeed.z < -0.3f && impulse.z > 0.3f){
#if defined(PC_PARTICLE) || defined (PS2_ALTERNATIVE_CARSPLASH)
RwRGBA color;
color.red = (0.5f * CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed())*0.45f*255;
color.green = (0.5f * CTimeCycle::GetDirectionalGreen() + CTimeCycle::GetAmbientGreen())*0.45f*255;
@ -2856,6 +2857,30 @@ CAutomobile::ProcessBuoyancy(void)
CParticleObject::AddObject(POBJECT_CAR_WATER_SPLASH, GetPosition(),
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.15f, 0.3f)),
0.0f, 75, color, true);
#else
CVector pos = (initialSpeed * 2.0f) + (GetPosition() + point);
for ( int32 i = 0; i < 360; i += 4 )
{
float fSin = Sin(float(i));
float fCos = Cos(float(i));
CVector dir(fSin*0.01f, fCos*0.01f, CGeneral::GetRandomNumberInRange(0.25f, 0.45f));
CParticle::AddParticle(PARTICLE_CAR_SPLASH,
pos + CVector(fSin*4.5f, fCos*4.5f, 0.0f),
dir, NULL, 0.0f, CRGBA(225, 225, 255, 180));
for ( int32 j = 0; j < 3; j++ )
{
float fMul = 1.5f * float(j + 1);
CParticle::AddParticle(PARTICLE_CAR_SPLASH,
pos + CVector(fSin * fMul, fCos * fMul, 0.0f),
dir, NULL, 0.0f, CRGBA(225, 225, 255, 180));
}
}
#endif
nGenerateRaindrops = CTimer::GetTimeInMilliseconds() + 300;
nGenerateWaterCircles = CTimer::GetTimeInMilliseconds() + 60;
@ -2909,9 +2934,16 @@ CAutomobile::ProcessBuoyancy(void)
CVector pos = m_aWheelColPoints[i].point + 0.3f*GetUp() - GetPosition();
CVector vSpeed = GetSpeed(pos);
vSpeed.z = 0.0f;
#ifdef GTA_PS2_STUFF
// ps2 puddle physics
CVector moveForce = CTimer::GetTimeStep() * (m_fMass * (vSpeed * -0.003f));
ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
#endif
float fSpeed = vSpeed.MagnitudeSqr();
#ifdef PC_PARTICLE
if(fSpeed > sq(0.05f)){
fSpeed = Sqrt(fSpeed);
float size = Min((fSpeed < 0.15f ? 0.25f : 0.75f)*fSpeed, 0.6f);
CVector right = 0.2f*fSpeed*GetRight() + 0.2f*vSpeed;
@ -2924,10 +2956,39 @@ CAutomobile::ProcessBuoyancy(void)
CParticle::AddParticle(PARTICLE_RUBBER_SMOKE,
pos + GetPosition(), -0.6f*right,
nil, size, smokeCol, 0, 0, 0, 0);
if((CTimer::GetFrameCounter() & 0xF) == 0)
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_SPLASH, 2000.0f*fSpeed);
}
#else
if ( ( (CTimer::GetFrameCounter() + i) & 3 ) == 0 )
{
if(fSpeed > sq(0.05f))
{
fSpeed = Sqrt(fSpeed);
CRGBA color(155, 185, 155, 255);
float boxY = GetColModel()->boundingBox.max.y;
CVector right = 0.5f * GetRight();
if ( i == 2 )
{
CParticle::AddParticle(PARTICLE_PED_SPLASH,
GetPosition() + (boxY * GetForward()) + right,
0.75f*m_vecMoveSpeed, NULL, 0.0f, color);
}
else if ( i == 0 )
{
CParticle::AddParticle(PARTICLE_PED_SPLASH,
GetPosition() + (boxY * GetForward()) - right,
0.75f*m_vecMoveSpeed, NULL, 0.0f, color);
}
if((CTimer::GetFrameCounter() & 0xF) == 0)
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_SPLASH, 2000.0f*fSpeed);
}
}
#endif
}
}
}
@ -3486,14 +3547,29 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
}
return 0;
default:
// Is this even visible?
if(CWeather::WetRoads > 0.01f && CTimer::GetFrameCounter() & 1){
CParticle::AddParticle(PARTICLE_WATERSPRAY,
if ( CWeather::WetRoads > 0.01f
#ifdef PC_PARTICLE
&& CTimer::GetFrameCounter() & 1
#endif
)
{
CParticle::AddParticle(
#ifdef FIX_BUGS
PARTICLE_WHEEL_WATER,
#else
PARTICLE_WATERSPRAY,
#endif
colpoint->point + CVector(0.0f, 0.0f, 0.25f+0.25f),
CVector(0.0f, 0.0f, 1.0f), nil,
#ifdef PC_PARTICLE
CVector(0.0f, 0.0f, 1.0f),
#else
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.005f, 0.04f)),
#endif
nil,
CGeneral::GetRandomNumberInRange(0.1f, 0.5f), waterCol);
return 0;
}
return 1;
}
}

View File

@ -340,27 +340,46 @@ CBoat::ProcessControl(void)
else
jetPos.z = 0.0f;
#ifdef PC_PARTICLE
CVector wakePos = GetPosition() + sternPos;
wakePos.z -= 0.65f;
#else
CVector wakePos = GetPosition() + sternPos;
wakePos.z = -0.3f;
#endif
CVector wakeDir = 0.75f * jetDir;
CParticle::AddParticle(PARTICLE_BOAT_THRUSTJET, jetPos, jetDir, nil, 0.0f, jetColor);
#ifdef PC_PARTICLE
CParticle::AddParticle(PARTICLE_CAR_SPLASH, jetPos, 0.25f * jetDir, nil, 1.0f, splashColor,
CGeneral::GetRandomNumberInRange(0, 30),
CGeneral::GetRandomNumberInRange(0, 90), 3);
#endif
if(!cameraHack)
CParticle::AddParticle(PARTICLE_BOAT_WAKE, wakePos, wakeDir, nil, 0.0f, jetColor);
}else if((CTimer::GetFrameCounter() + m_randomSeed) & 1){
#ifdef PC_PARTICLE
jetDir.z = 0.018f;
jetDir.x *= 0.01f;
jetDir.y *= 0.01f;
propellerWorld.z += 1.5f;
CParticle::AddParticle(PARTICLE_BOAT_SPLASH, propellerWorld, jetDir, nil, 1.5f, jetColor);
#else
jetDir.z = 0.018f;
jetDir.x *= 0.03f;
jetDir.y *= 0.03f;
propellerWorld.z += 1.0f;
CParticle::AddParticle(PARTICLE_BOAT_SPLASH, propellerWorld, jetDir, nil, 0.0f, jetColor);
#endif
#ifdef PC_PARTICLE
CParticle::AddParticle(PARTICLE_CAR_SPLASH, propellerWorld, 0.1f * jetDir, nil, 0.5f, splashColor,
CGeneral::GetRandomNumberInRange(0, 30),
CGeneral::GetRandomNumberInRange(0, 90), 3);
#endif
}
}
}else if(!onLand){
@ -416,36 +435,66 @@ CBoat::ProcessControl(void)
}
// Spray particles on sides of boat
if(m_nDeltaVolumeUnderWater > 75){
#ifdef PC_PARTICLE
if(m_nDeltaVolumeUnderWater > 75)
#else
if(m_nDeltaVolumeUnderWater > 120)
#endif
{
float speed = m_vecMoveSpeed.Magnitude();
float splash1Size = speed;
float splash2Size = m_nDeltaVolumeUnderWater * 0.005f * 0.2f;
float splash2Size = float(m_nDeltaVolumeUnderWater) * 0.005f * 0.2f;
float front = 0.9f * GetColModel()->boundingBox.max.y;
if(splash1Size > 0.75f) splash1Size = 0.75f;
CVector dir, pos;
// right
#ifdef PC_PARTICLE
dir = -0.5f*m_vecMoveSpeed;
dir.z += 0.1f*speed;
dir += 0.5f*GetRight()*speed;
pos = front*GetForward() + 0.5f*GetRight() + GetPosition() + m_vecBuoyancePoint;
CWaterLevel::GetWaterLevel(pos, &pos.z, true);
#else
dir = 0.3f*m_vecMoveSpeed;
dir.z += 0.05f*speed;
dir += 0.5f*GetRight()*speed;
pos = (GetPosition() + m_vecBuoyancePoint) + (1.5f*GetRight());
#endif
#ifdef PC_PARTICLE
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, 0.75f * dir, nil, splash1Size, splashColor,
CGeneral::GetRandomNumberInRange(0, 30),
CGeneral::GetRandomNumberInRange(0, 90), 1);
CParticle::AddParticle(PARTICLE_BOAT_SPLASH, pos, dir, nil, splash2Size, jetColor);
#else
CParticle::AddParticle(PARTICLE_BOAT_SPLASH, pos, dir, nil, splash2Size);
#endif
// left
#ifdef PC_PARTICLE
dir = -0.5f*m_vecMoveSpeed;
dir.z += 0.1f*speed;
dir -= 0.5f*GetRight()*speed;
pos = front*GetForward() - 0.5f*GetRight() + GetPosition() + m_vecBuoyancePoint;
CWaterLevel::GetWaterLevel(pos, &pos.z, true);
#else
dir = 0.3f*m_vecMoveSpeed;
dir.z += 0.05f*speed;
dir -= 0.5f*GetRight()*speed;
pos = (GetPosition() + m_vecBuoyancePoint) - (1.5f*GetRight());
#endif
#ifdef PC_PARTICLE
CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, 0.75f * dir, nil, splash1Size, splashColor,
CGeneral::GetRandomNumberInRange(0, 30),
CGeneral::GetRandomNumberInRange(0, 90), 1);
CParticle::AddParticle(PARTICLE_BOAT_SPLASH, pos, dir, nil, splash2Size, jetColor);
#else
CParticle::AddParticle(PARTICLE_BOAT_SPLASH, pos, dir, nil, splash2Size);
#endif
}
m_fPrevVolumeUnderWater = m_fVolumeUnderWater;