Merge branch 'master' of github.com:gtamodding/re3

This commit is contained in:
aap
2020-04-23 22:10:46 +02:00
50 changed files with 5410 additions and 7459 deletions

View File

@ -1,4 +1,3 @@
#define WITHWINDOWS // just for VK_SPACE
#include "common.h"
#include "General.h"
@ -416,7 +415,7 @@ CCutsceneMgr::Update(void)
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|| CPad::GetPad(0)->GetEnterJustDown()
|| CPad::GetPad(0)->GetCharJustDown(VK_SPACE))
|| CPad::GetPad(0)->GetCharJustDown(' '))
FinishCutscene();
}
}

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 OPENAL
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 Stre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DIO\\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"
};

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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P3",
"AUDIO\\ammu_a.MP3",
"AUDIO\\ammu_b.MP3",
"AUDIO\\ammu_c.MP3",
"AUDIO\\door_1.MP3",
"AUDIO\\door_2.MP3",
"AUDIO\\door_3.MP3",
"AUDIO\\door_4.MP3",
"AUDIO\\door_5.MP3",
"AUDIO\\door_6.MP3",
"AUDIO\\t3_a.MP3",
"AUDIO\\t3_b.MP3",
"AUDIO\\t3_c.MP3",
"AUDIO\\k1_b.MP3",
"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",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"AUDIO\\a5_a.WAV",
"AUDIO\\a4_a.WAV",
"AUDIO\\a4_b.WAV",
"AUDIO\\a4_c.WAV",
"AUDIO\\a4_d.WAV",
"AUDIO\\k1_a.WAV",
"AUDIO\\k3_a.WAV",
"AUDIO\\r1_a.WAV",
"AUDIO\\r2_a.WAV",
"AUDIO\\r2_b.WAV",
"AUDIO\\r2_c.WAV",
"AUDIO\\r2_d.WAV",
"AUDIO\\r2_e.WAV",
"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

@ -1,7 +1,6 @@
#define WITHWINDOWS // for our script loading hack
#include "common.h"
#include "Script.h"
#include "ScriptCommands.h"

View File

@ -1,4 +1,4 @@
#include <windows.h>
#define WITHWINDOWS
#include "common.h"
#include "CdStream.h"

View File

@ -1,7 +1,5 @@
#pragma warning( push )
#pragma warning( disable : 4005)
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma warning( pop )
#include "common.h"
#include "win.h"

View File

@ -1,4 +1,4 @@
#include <windows.h>
#define WITHWINDOWS
#include "common.h"
#include "DMAudio.h"

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

@ -1,6 +1,6 @@
#include <direct.h>
#include <csignal>
#include <windows.h>
#define WITHWINDOWS
#include "common.h"
#include "patcher.h"
#include "Renderer.h"
@ -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

@ -1642,9 +1642,9 @@ CShadows::RenderExtraPlayerShadows(void)
int32 nColorStrength;
if ( fLightDist < fRadius*0.5f )
nColorStrength = CTimeCycle::GetLightShadowStrength();
nColorStrength = (5*CTimeCycle::GetLightShadowStrength()/8);
else
nColorStrength = int32(CTimeCycle::GetLightShadowStrength() * fMult);
nColorStrength = int32((5*CTimeCycle::GetLightShadowStrength()/8) * fMult);
float fInv = 1.0f / fLightDist;
vecLight.x *= fInv;

View File

@ -1,9 +1,6 @@
#pragma warning( push )
#pragma warning( disable : 4005)
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma warning( pop )
#define WITHWINDOWS
#include "common.h"
#include "win.h"

View File

@ -1,5 +1,6 @@
#define WITHWINDOWS
#include "common.h"
#define USEALTERNATIVEWINFUNCS
#include "crossplatform.h"
#include "main.h"
#include "AudioScriptObject.h"

View File

@ -1,5 +1,6 @@
#define WITHWINDOWS
#include "common.h"
#define USEALTERNATIVEWINFUNCS
#include "crossplatform.h"
#include "FileMgr.h"
#include "GenericGameStorage.h"
@ -94,7 +95,7 @@ C_PcSave::PopulateSlotInfo()
struct {
int size;
wchar FileName[24];
_SYSTEMTIME SaveDateTime;
SYSTEMTIME SaveDateTime;
} header;
sprintf(savename, "%s%i%s", DefaultPCSaveFileName, i + 1, ".b");
int file = CFileMgr::OpenFile(savename, "rb");
@ -110,8 +111,8 @@ C_PcSave::PopulateSlotInfo()
}
if (Slots[i + 1] == SLOT_OK) {
if (CheckDataNotCorrupt(i, savename)) {
_SYSTEMTIME st;
memcpy(&st, &header.SaveDateTime, sizeof(_SYSTEMTIME));
SYSTEMTIME st;
memcpy(&st, &header.SaveDateTime, sizeof(SYSTEMTIME));
const char *month;
switch (st.wMonth)
{

View File

@ -0,0 +1,81 @@
#include "common.h"
#define USEALTERNATIVEWINFUNCS
#include "crossplatform.h"
// For internal use
// wMilliseconds is not needed
void tmToSystemTime(const tm *tm, SYSTEMTIME *out) {
out->wYear = tm->tm_year + 1900;
out->wMonth = tm->tm_mon + 1;
out->wDayOfWeek = tm->tm_wday;
out->wDay = tm->tm_mday;
out->wHour = tm->tm_hour;
out->wMinute = tm->tm_min;
out->wSecond = tm->tm_sec;
}
void GetLocalTime_CP(SYSTEMTIME *out) {
time_t timestamp = time(nil);
tm *localTm = localtime(&timestamp);
tmToSystemTime(localTm, out);
}
#if !defined _WIN32 || defined __MINGW32__
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
char newpathname[32];
strncpy(newpathname, pathname, 32);
char* path = strtok(newpathname, "\\*");
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
// Both w/ extension and w/o extension is ok
if (strlen(path) + 2 != strlen(pathname))
strncpy(firstfile->extension, strtok(NULL, "\\*"), sizeof(firstfile->extension));
else
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
HANDLE d;
if ((d = opendir(path)) == NULL || !FindNextFile(d, firstfile))
return NULL;
return d;
}
bool FindNextFile(HANDLE d, WIN32_FIND_DATA* finddata) {
dirent *file;
static struct stat fileStats;
static char path[PATH_MAX], relativepath[NAME_MAX + sizeof(finddata->folder) + 1];
int extensionLen = strlen(finddata->extension);
while ((file = readdir(d)) != NULL) {
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG) &&
(extensionLen == 0 || strncmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
realpath(relativepath, path);
stat(path, &fileStats);
strncpy(finddata->cFileName, file->d_name, sizeof(finddata->cFileName));
finddata->ftLastWriteTime = fileStats.st_mtime;
return true;
}
}
return false;
}
void GetDateFormat(int unused1, int unused2, SYSTEMTIME* in, int unused3, char* out, int size) {
tm linuxTime;
linuxTime.tm_year = in->wYear - 1900;
linuxTime.tm_mon = in->wMonth - 1;
linuxTime.tm_wday = in->wDayOfWeek;
linuxTime.tm_mday = in->wDay;
linuxTime.tm_hour = in->wHour;
linuxTime.tm_min = in->wMinute;
linuxTime.tm_sec = in->wSecond;
strftime(out, size, nl_langinfo(D_FMT), &linuxTime);
}
void FileTimeToSystemTime(time_t* writeTime, SYSTEMTIME* out) {
tm *ptm = gmtime(writeTime);
tmToSystemTime(ptm, out);
}
#endif

65
src/skel/crossplatform.h Normal file
View File

@ -0,0 +1,65 @@
#include <time.h>
#ifndef MAX_PATH
#if !defined _WIN32 || defined __MINGW32__
#define MAX_PATH PATH_MAX
#else
#define MAX_PATH 260
#endif
#endif
// Mostly wrappers around Windows functions
// TODO: Remove USEALTERNATIVEWINFUNCS and don't use it anywhere when re3 becomes fully cross-platform, this is for testing
// Codes compatible with Windows and Linux
#if defined USEALTERNATIVEWINFUNCS || !defined _WIN32 || defined __MINGW32__
#define DeleteFile unlink
// Needed for save games
struct SYSTEMTIME {
uint16 wYear;
uint16 wMonth;
uint16 wDayOfWeek;
uint16 wDay;
uint16 wHour;
uint16 wMinute;
uint16 wSecond;
uint16 wMilliseconds;
};
#define GetLocalTime GetLocalTime_CP
#else
#include <Windows.h>
#endif
void GetLocalTime_CP(SYSTEMTIME* out);
// Only runs on GNU/POSIX/etc.
#if !defined _WIN32 || defined __MINGW32__
#define OutputDebugString(s) re3_debug("[DBG-2]: " s "\n")
#include <iostream>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <langinfo.h>
typedef DIR* HANDLE;
#define INVALID_HANDLE_VALUE NULL
#define FindClose closedir
#define LOCALE_USER_DEFAULT 0
#define DATE_SHORTDATE 0
struct WIN32_FIND_DATA {
char extension[32]; // for searching
char folder[32]; // for searching
char cFileName[256]; // because tSkinInfo has it 256
time_t ftLastWriteTime;
};
HANDLE FindFirstFile(char*, WIN32_FIND_DATA*);
bool FindNextFile(HANDLE, WIN32_FIND_DATA*);
void FileTimeToSystemTime(time_t*, SYSTEMTIME*);
void GetDateFormat(int, int, SYSTEMTIME*, int, char*, int);
#endif

View File

@ -2,18 +2,12 @@
#include "skeleton.h"
#include "events.h"
//#include "main.h"
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include "common.h"
#include "Pad.h"
#include "ControllerConfig.h"
#include "Frontend.h"
#include "Camera.h"
/*
*****************************************************************************
*/

View File

@ -1986,7 +1986,7 @@ WinMain(HINSTANCE instance,
++gGameState;
else if ( CPad::GetPad(0)->GetEnterJustDown() )
++gGameState;
else if ( CPad::GetPad(0)->GetCharJustDown(VK_SPACE) )
else if ( CPad::GetPad(0)->GetCharJustDown(' ') )
++gGameState;
else if ( CPad::GetPad(0)->GetAltJustDown() )
++gGameState;
@ -2022,7 +2022,7 @@ WinMain(HINSTANCE instance,
++gGameState;
else if ( CPad::GetPad(0)->GetEnterJustDown() )
++gGameState;
else if ( CPad::GetPad(0)->GetCharJustDown(VK_SPACE) )
else if ( CPad::GetPad(0)->GetCharJustDown(' ') )
++gGameState;
else if ( CPad::GetPad(0)->GetAltJustDown() )
++gGameState;

View File

@ -5,6 +5,11 @@
#define RSREGSETBREAKALLOC(_name) /* No op */
#endif /* (!defined(RSREGSETBREAKALLOC)) */
#ifndef _INC_WINDOWS
#define _X86_
#include <windef.h>
#endif
enum eGameState
{
GS_START_UP = 0,
@ -17,7 +22,9 @@ enum eGameState
GS_FRONTEND,
GS_INIT_PLAYING_GAME,
GS_PLAYING_GAME,
#ifndef MASTER
GS_ANIMVIEWER,
#endif
};
enum eWinVersion
@ -33,6 +40,7 @@ extern DWORD _dwOperatingSystemVersion;
extern RwUInt32 gGameState;
#ifdef __DINPUT_INCLUDED__
/* platform specfic global data */
typedef struct
{
@ -86,6 +94,7 @@ public:
};
extern CJoySticks AllValidWinJoys;
#endif
#ifdef __cplusplus
extern "C"
@ -97,6 +106,7 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
RwBool IsForegroundApp();
#ifdef __DINPUT_INCLUDED__
HRESULT _InputInitialise();
HRESULT _InputInitialiseMouse();
HRESULT CapturePad(RwInt32 padID);
@ -110,6 +120,7 @@ BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs);;
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);
BOOL _InputIsExtended(INT flag);
#endif
void InitialiseLanguage();
RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode);

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;

View File

@ -1002,21 +1002,15 @@ void
DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle)
{
if (pVehicle->pDriver) {
#ifndef FIX_BUGS
// this just isn't fair
CDarkel::RegisterKillByPlayer(pVehicle->pDriver, WEAPONTYPE_UNIDENTIFIED);
#endif
pVehicle->pDriver->FlagToDestroyWhenNextProcessed();
}
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) {
if (pVehicle->pPassengers[i]) {
#ifndef FIX_BUGS
// this just isn't fair
CDarkel::RegisterKillByPlayer(pVehicle->pPassengers[i], WEAPONTYPE_UNIDENTIFIED);
#endif
pVehicle->pPassengers[i]->FlagToDestroyWhenNextProcessed();
}
}
CWorld::Remove(pVehicle);
delete pVehicle;
}
}