1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-24 17:55:29 +00:00

sync with upstream

This commit is contained in:
Nikolay Korolev 2020-02-15 14:54:46 +03:00
commit a361fc0ff5
33 changed files with 2027 additions and 937 deletions

View file

@ -63,7 +63,6 @@ CMotionBlurStreaks
CObject
CPacManPickups
CPedPath
CPlayerPed
CPopulation
CRadar
CRecordDataForChase

View file

@ -150,8 +150,8 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_counter = counter;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false;
m_sQueueSample.field_16 = 7;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
@ -163,8 +163,8 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
m_sQueueSample.m_fSoundIntensity = 60.0f;
m_sQueueSample.field_56 = 0;
m_sQueueSample.field_76 = 5;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
@ -269,8 +269,8 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
m_sQueueSample.m_counter = counter++;
if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false;
m_sQueueSample.field_16 = 11;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
@ -279,8 +279,8 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
m_sQueueSample.field_48 = 4.0f;
m_sQueueSample.m_fSoundIntensity = 60.0f;
m_sQueueSample.field_56 = 1;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
@ -320,8 +320,8 @@ cAudioManager::ServiceCollisions()
if (!someArr2[i]) {
m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = 0;
m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = 0;
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);

File diff suppressed because it is too large Load diff

View file

@ -140,7 +140,7 @@ public:
int32 m_counter;
int32 m_nSampleIndex;
uint8 m_bBankIndex;
uint8 m_bIsDistant;
bool m_bIsDistant;
uint8 field_14;
uint8 field_15;
int32 field_16;
@ -164,9 +164,9 @@ public:
uint8 field_58;
uint8 field_59;
CVector m_vecPos;
uint8 m_bReverbFlag;
bool m_bReverbFlag;
uint8 m_bLoopsRemaining;
uint8 m_bRequireReflection;
bool m_bRequireReflection;
uint8 m_bOffset;
int32 field_76;
uint8 m_bIsProcessed;
@ -337,6 +337,7 @@ public:
uint32 GetFrameCounter() const { return m_nTimeOfRecentCrime; }
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_bPlayStatus == 1; }
// "Should" be in alphabetic order, except "getXTalkSfx"
void AddDetailsToRequestedOrderList(uint8 sample); /// ok (check once more)

View file

@ -301,7 +301,7 @@ cDMAudio::ClearMissionAudio(void)
AudioManager.ClearMissionAudio();
}
int32
uint8
cDMAudio::GetRadioInCar(void)
{
return MusicManager.GetRadioInCar();

View file

@ -253,7 +253,7 @@ public:
bool IsMissionAudioSampleFinished(void);
void ClearMissionAudio(void);
int32 GetRadioInCar(void);
uint8 GetRadioInCar(void);
void SetRadioInCar(uint32 radio);
void SetRadioChannel(int8 radio, int32 pos);
};

View file

@ -1,5 +1,8 @@
#include "common.h"
#include <time.h>
#include "MusicManager.h"
#include "AudioManager.h"
#include "ControllerConfig.h"
#include "Camera.h"
#include "Font.h"
#include "Hud.h"
@ -15,35 +18,51 @@ cMusicManager &MusicManager = *(cMusicManager *)0x8F3964;
int32 &gNumRetunePresses = *(int32 *)0x650B80;
wchar *pCurrentStation = (wchar *)0x650B9C;
uint8 &cDisplay = *(uint8 *)0x650BA1;
int32 &gRetuneCounter = *(int32*)0x650B84;
bool& bHasStarted = *(bool*)0x650B7C;
cMusicManager::cMusicManager()
{
m_bIsInitialised = false;
m_bDisabled = false;
m_nMusicMode = MUSICMODE_DISABLED;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_bFrontendTrackFinished = false;
m_bPlayInFrontend = false;
m_bSetNextStation = false;
m_nAnnouncement = NO_STREAMED_SOUND;
m_bPreviousPlayerInCar = false;
m_bPlayerInCar = false;
m_bAnnouncementInProgress = false;
m_bDontServiceAmbienceTrack = false;
bHasStarted = false;
}
bool
cMusicManager::PlayerInCar()
{
if(!FindPlayerVehicle())
return false;
else {
int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState;
if(State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED)
return false;
int32 State = FindPlayerPed()->m_nPedState;
switch(FindPlayerVehicle()->m_modelIndex) {
case MI_FIRETRUCK:
case MI_AMBULAN:
case MI_MRWHOOP:
case MI_PREDATOR:
case MI_TRAIN:
case MI_SPEEDER:
case MI_REEFER:
case MI_GHOST: return false;
default: return true;
}
if(State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED)
return false;
switch(FindPlayerVehicle()->m_modelIndex) {
case MI_FIRETRUCK:
case MI_AMBULAN:
case MI_MRWHOOP:
case MI_PREDATOR:
case MI_TRAIN:
case MI_SPEEDER:
case MI_REEFER:
case MI_GHOST: return false;
default: return true;
}
}
#if 0
WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
#else
void
cMusicManager::DisplayRadioStationName()
{
@ -51,13 +70,13 @@ cMusicManager::DisplayRadioStationName()
int8 gStreamedSound;
int8 gRetuneCounter;
if(!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && cMusicManager::PlayerInCar() &&
if(!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && PlayerInCar() &&
!CReplay::IsPlayingBack()) {
if(MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)
if(m_bPlayerInCar && !m_bPreviousPlayerInCar)
pCurrentStation = nil;
if(SampleManager.IsMP3RadioChannelAvailable()) {
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
gStreamedSound = m_nCurrentStreamedSound;
if(gStreamedSound == STREAMED_SOUND_CITY_AMBIENT ||
gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) {
@ -74,15 +93,15 @@ cMusicManager::DisplayRadioStationName()
if(pRetune == POLICE_RADIO) {
pRetune = RADIO_OFF;
} else if(pRetune > POLICE_RADIO) {
pRetune = pRetune - 11;
pRetune = pRetune - RADIO_OFF;
}
} else {
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
gStreamedSound = m_nCurrentStreamedSound;
pRetune = gNumRetunePresses + gStreamedSound;
if(pRetune >= USERTRACK) {
gRetuneCounter = gNumRetunePresses;
pRetune = MusicManager.m_nCurrentStreamedSound;
pRetune = m_nCurrentStreamedSound;
if(gStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
pRetune = RADIO_OFF;
@ -119,13 +138,13 @@ cMusicManager::DisplayRadioStationName()
if(pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) { return; }
if(string && pCurrentStation != string ||
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER &&
MusicManager.m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) {
m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER &&
m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) {
pCurrentStation = string;
cDisplay = 60;
} else {
if(!cDisplay) return;
--cDisplay;
if(cDisplay == 0) return;
cDisplay--;
}
CFont::SetJustifyOff();
@ -147,97 +166,769 @@ cMusicManager::DisplayRadioStationName()
CFont::DrawFonts();
}
}
#endif
WRAPPER
void
bool
cMusicManager::Initialise()
{
EAXJMP(0x57CF70);
int pos;
if (!IsInitialised()) {
time_t timevalue = time(0);
if (timevalue == -1) {
pos = AudioManager.GetRandomNumber(0);
} else {
tm *pTm = localtime(&timevalue);
if (pTm->tm_sec == 0)
pTm->tm_sec = AudioManager.GetRandomNumber(0);
if (pTm->tm_min == 0)
pTm->tm_min = AudioManager.GetRandomNumber(1);
if (pTm->tm_hour == 0)
pTm->tm_hour = AudioManager.GetRandomNumber(2);
if (pTm->tm_mday == 0)
pTm->tm_mday = AudioManager.GetRandomNumber(3);
if (pTm->tm_mon == 0)
pTm->tm_mon = AudioManager.GetRandomNumber(4);
if (pTm->tm_year == 0)
pTm->tm_year = AudioManager.GetRandomNumber(3);
if (pTm->tm_wday == 0)
pTm->tm_wday = AudioManager.GetRandomNumber(2);
pos = pTm->tm_yday
* pTm->tm_wday
* pTm->tm_year
* pTm->tm_mon
* pTm->tm_mday
* pTm->tm_hour * pTm->tm_hour
* pTm->tm_min * pTm->tm_min
* pTm->tm_sec * pTm->tm_sec * pTm->tm_sec * pTm->tm_sec;
}
for (int i = 0; i < TOTAL_STREAMED_SOUNDS; i++) {
m_aTracks[i].m_nLength = SampleManager.GetStreamedFileLength(i);
m_aTracks[i].m_nPosition = pos * AudioManager.GetRandomNumber(i % 5) % m_aTracks[i].m_nLength;
m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
m_bResetTimers = false;
m_nResetTime = 0;
m_nTimer = m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode();
m_bDoTrackService = false;
m_bIgnoreTimeDelay = false;
m_bRadioSetByScript = false;
m_nRadioStation = HEAD_RADIO;
m_nRadioPosition = -1;
m_nRadioInCar = NO_STREAMED_SOUND;
gNumRetunePresses = 0;
gRetuneCounter = 0;
m_bIsInitialised = true;
}
return m_bIsInitialised;
}
WRAPPER
void
cMusicManager::Terminate()
{
EAXJMP(0x57D140);
if (!IsInitialised()) return;
if (SampleManager.IsStreamPlaying(0)) {
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
}
m_bIsInitialised = false;
}
WRAPPER
void
cMusicManager::ChangeMusicMode(int32 mode)
cMusicManager::ChangeMusicMode(uint8 mode)
{
EAXJMP(0x57D310);
if (!IsInitialised()) return;
uint8 mode2;
switch (mode)
{
case MUSICMODE_FRONTEND: mode2 = MUSICMODE_FRONTEND; break;
case MUSICMODE_GAME: mode2 = MUSICMODE_GAME; break;
case MUSICMODE_CUTSCENE: mode2 = MUSICMODE_CUTSCENE; break;
case MUSICMODE_DISABLE: mode2 = MUSICMODE_DISABLED; break;
default: return;
}
if (mode2 != m_nMusicMode || mode == MUSICMODE_FRONTEND && mode2 == MUSICMODE_FRONTEND) {
switch (mode)
{
case MUSICMODE_FRONTEND:
case MUSICMODE_GAME:
case MUSICMODE_CUTSCENE:
case MUSICMODE_DISABLED:
if (SampleManager.IsStreamPlaying(0)) {
if (m_nCurrentStreamedSound < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
SampleManager.StopStreamedFile(0);
}
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_bFrontendTrackFinished = false;
m_bPlayInFrontend = false;
m_bSetNextStation = false;
m_bPreviousPlayerInCar = false;
m_bPlayerInCar = false;
m_bAnnouncementInProgress = false;
m_nTimer = m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode();
m_bDoTrackService = false;
m_bIgnoreTimeDelay = true;
m_bDontServiceAmbienceTrack = false;
m_nMusicMode = mode2;
break;
default: return;
}
}
}
WRAPPER
void
cMusicManager::StopFrontEndTrack()
{
EAXJMP(0x57E3D0);
}
WRAPPER void
cMusicManager::PlayAnnouncement(uint8)
{
EAXJMP(0x57E430);
}
WRAPPER void
cMusicManager::PlayFrontEndTrack(uint8, uint8)
{
EAXJMP(0x57E2E0);
}
WRAPPER void
cMusicManager::PreloadCutSceneMusic(uint8)
{
EAXJMP(0x57E210);
}
WRAPPER void
cMusicManager::PlayPreloadedCutSceneMusic(void)
{
EAXJMP(0x57E290);
}
WRAPPER void
cMusicManager::StopCutSceneMusic(void)
{
EAXJMP(0x57E2B0);
}
WRAPPER int32
uint8
cMusicManager::GetRadioInCar(void)
{
EAXJMP(0x57D1D0);
if (!m_bIsInitialised) return HEAD_RADIO;
if (PlayerInCar()) {
CVehicle *veh = FindPlayerVehicle();
if (veh != nil){
if (UsesPoliceRadio(veh)) {
if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_bUserPause)
return POLICE_RADIO;
return m_nRadioInCar;
} else return veh->m_nRadioStation;
}
}
if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_bUserPause)
return RADIO_OFF;
return m_nRadioInCar;
}
WRAPPER void
cMusicManager::SetRadioInCar(uint32)
void
cMusicManager::SetRadioInCar(uint32 station)
{
EAXJMP(0x57D2C0);
if (m_bIsInitialised) {
if (!PlayerInCar()) {
m_nRadioInCar = station;
return;
}
CVehicle *veh = FindPlayerVehicle();
if (veh == nil) return;
if (UsesPoliceRadio(veh))
m_nRadioInCar = station;
else
veh->m_nRadioStation = station;
}
}
WRAPPER void
cMusicManager::SetRadioChannelByScript(uint8, int32)
void
cMusicManager::SetRadioChannelByScript(uint8 station, int32 pos)
{
EAXJMP(0x57D180);
if (m_bIsInitialised && station < RADIO_OFF) {
m_bRadioSetByScript = true;
m_nRadioStation = station;
m_nRadioPosition = pos == -1 ? -1 : pos % m_aTracks[station].m_nLength;
}
}
WRAPPER
void
cMusicManager::ResetMusicAfterReload()
{
EAXJMP(0x57CF30);
m_bRadioSetByScript = false;
m_nRadioStation = 0;
m_nRadioPosition = -1;
m_nAnnouncement = NO_STREAMED_SOUND;
m_bAnnouncementInProgress = false;
m_bSetNextStation = false;
gRetuneCounter = 0;
gNumRetunePresses = 0;
}
WRAPPER
void cMusicManager::ResetTimers(int32) { EAXJMP(0x57D420); }
WRAPPER
void
cMusicManager::ResetTimers(int32 time)
{
m_bResetTimers = true;
m_nResetTime = time;
}
void
cMusicManager::Service()
{
EAXJMP(0x57D440);
if (m_bResetTimers) {
m_bResetTimers = false;
m_nLastTrackServiceTime = m_nResetTime;
}
if (!m_bIsInitialised || m_bDisabled) return;
if (m_nMusicMode == MUSICMODE_CUTSCENE) {
SampleManager.SetStreamedVolumeAndPan(AudioManager.maxVolume, 63, 1, 0);
return;
}
m_nTimer = CTimer::GetTimeInMillisecondsPauseMode();
if (m_nTimer > (m_nLastTrackServiceTime + 2000) || m_bIgnoreTimeDelay) {
m_bIgnoreTimeDelay = false;
m_bDoTrackService = true;
m_nLastTrackServiceTime = m_nTimer;
} else m_bDoTrackService = false;
if (m_nCurrentStreamedSound == NO_STREAMED_SOUND && SampleManager.IsStreamPlaying(0))
SampleManager.StopStreamedFile(0);
else switch (m_nMusicMode) {
case MUSICMODE_FRONTEND: ServiceFrontEndMode(); break;
case MUSICMODE_GAME: ServiceGameMode(); break;
}
}
void
cMusicManager::ServiceFrontEndMode()
{
if (m_nCurrentStreamedSound < TOTAL_STREAMED_SOUNDS) {
if (m_bFrontendTrackFinished) {
if (!SampleManager.IsStreamPlaying(0)) {
switch (m_nCurrentStreamedSound)
{
case STREAMED_SOUND_MISSION_COMPLETED:
if (!AudioManager.m_bUserPause)
ChangeMusicMode(MUSICMODE_GAME);
break;
case STREAMED_SOUND_GAME_COMPLETED:
ChangeMusicMode(MUSICMODE_GAME);
break;
default:
break;
}
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
}
} else if (bHasStarted) {
if (!SampleManager.IsStreamPlaying(0))
SampleManager.StartStreamedFile(m_nCurrentStreamedSound, 0, 0);
} else {
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, m_nCurrentStreamedSound < STREAMED_SOUND_RADIO_POLICE ? GetTrackStartPos(m_nCurrentStreamedSound) : 0, 0))
return;
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
if (m_bPlayInFrontend) bHasStarted = true;
else m_bFrontendTrackFinished = true;
}
}
if (SampleManager.IsStreamPlaying(0))
SampleManager.SetStreamedVolumeAndPan((CPad::GetPad(0)->bDisplayNoControllerMessage || CPad::GetPad(0)->bObsoleteControllerMessage) ? 0 : 100, 63, 0, 0);
}
void
cMusicManager::ServiceGameMode()
{
bool bRadioOff = false;
static int8 nFramesSinceCutsceneEnded = -1;
m_bPreviousPlayerInCar = m_bPlayerInCar;
m_bPlayerInCar = PlayerInCar();
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
if (m_bPlayerInCar) {
if (FindPlayerPed() != nil
&& !FindPlayerPed()->DyingOrDead()
&& CPad::GetPad(0)->ChangeStationJustDown()
&& !CReplay::IsPlayingBack()
&& FindPlayerVehicle() != nil
&& !UsesPoliceRadio(FindPlayerVehicle())) {
gRetuneCounter = 30;
gNumRetunePresses++;
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 1.0f);
if (SampleManager.IsMP3RadioChannelAvailable()) {
if (gNumRetunePresses > RADIO_OFF)
gNumRetunePresses -= RADIO_OFF;
}
}
} else {
nFramesSinceCutsceneEnded = -1;
}
if (AudioManager.m_bPreviousUserPause)
m_bPreviousPlayerInCar = false;
if (!m_bPlayerInCar) {
if (m_bPreviousPlayerInCar) {
if (m_nCurrentStreamedSound != STREAMED_SOUND_RADIO_POLICE)
m_nRadioInCar = m_nCurrentStreamedSound;
}
ServiceAmbience();
return;
}
if (m_bPreviousPlayerInCar) {
if (m_nAnnouncement < TOTAL_STREAMED_SOUNDS
&& (m_nCurrentStreamedSound < STREAMED_SOUND_CITY_AMBIENT || m_bAnnouncementInProgress)
&& ServiceAnnouncement())
{
if (m_bAnnouncementInProgress) {
m_bSetNextStation = false;
return;
}
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = GetCarTuning();
}
if (SampleManager.IsMP3RadioChannelAvailable()
&& m_nCurrentStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER
&& ControlsManager.GetIsKeyboardKeyJustDown(rsF9))
{
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = STREAMED_SOUND_RADIO_MP3_PLAYER;
if (FindPlayerVehicle() != nil)
FindPlayerVehicle()->m_nRadioStation = STREAMED_SOUND_RADIO_MP3_PLAYER;
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 1.0f);
gRetuneCounter = 0;
gNumRetunePresses = 0;
m_bSetNextStation = false;
}
if (gNumRetunePresses) {
if (gRetuneCounter != 0) gRetuneCounter--;
else m_bSetNextStation = true;
}
if (gRetuneCounter)
AudioManager.DoPoliceRadioCrackle();
if (m_bSetNextStation) {
m_bSetNextStation = false;
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = GetNextCarTuning();
if (m_nCurrentStreamedSound == STREAMED_SOUND_CITY_AMBIENT || m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
bRadioOff = true;
if (m_nPreviousStreamedSound == STREAMED_SOUND_CITY_AMBIENT || m_nPreviousStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 0.0f);
}
if (m_nCurrentStreamedSound < STREAMED_SOUND_CITY_AMBIENT) {
if (ChangeRadioChannel()) {
ServiceTrack();
} else {
m_bPlayerInCar = false;
if (FindPlayerVehicle())
FindPlayerVehicle()->m_nRadioStation = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
}
if (CTimer::GetIsSlowMotionActive()) {
if (TheCamera.pTargetEntity != nil) {
float dist = (TheCamera.pTargetEntity->GetPosition() - TheCamera.GetPosition()).MagnitudeSqr();
if (dist >= 3025.0f) {
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
} else if (dist >= 100.0f) {
int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f);
int8 pan;
if (AudioManager.IsMissionAudioPlaying())
volume /= 4;
if (volume != 0) {
CVector trVec;
AudioManager.TranslateEntity(&TheCamera.pTargetEntity->GetPosition(), &trVec);
pan = AudioManager.ComputePan(55.0f, &trVec);
} else {
pan = 0;
}
if (gRetuneCounter)
volume /= 4;
SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0);
} else if (AudioManager.IsMissionAudioPlaying()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
} else if (gRetuneCounter) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
} else {
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
}
}
} else if (AudioManager.IsMissionAudioPlaying()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
nFramesSinceCutsceneEnded = 0;
} else {
int8 volume;
if (nFramesSinceCutsceneEnded == -1) {
volume = 100;
} else if (nFramesSinceCutsceneEnded >= 20) {
if (nFramesSinceCutsceneEnded >= 40) {
nFramesSinceCutsceneEnded = -1;
volume = 100;
} else {
volume = 3 * (nFramesSinceCutsceneEnded - 20) + 25;
nFramesSinceCutsceneEnded++;
}
} else {
nFramesSinceCutsceneEnded++;
volume = 25;
}
if (gRetuneCounter) volume /= 4;
SampleManager.SetStreamedVolumeAndPan(volume, 63, 0, 0);
}
return;
}
if (bRadioOff) {
m_nCurrentStreamedSound = m_nPreviousStreamedSound;
if (FindPlayerVehicle() != nil)
FindPlayerVehicle()->m_nRadioStation = RADIO_OFF;
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_NO_RADIO, 0.0f);
}
ServiceAmbience();
return;
}
if (m_bRadioSetByScript) {
if (UsesPoliceRadio(FindPlayerVehicle())) {
m_nCurrentStreamedSound = STREAMED_SOUND_RADIO_POLICE;
} else {
m_nCurrentStreamedSound = m_nRadioStation;
if (FindPlayerVehicle()->m_nRadioStation == m_nCurrentStreamedSound) {
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
SampleManager.StopStreamedFile(0);
}
if (m_nRadioPosition != -1) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = m_nRadioPosition;
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
}
} else {
m_nCurrentStreamedSound = GetCarTuning();
}
if (m_nCurrentStreamedSound >= RADIO_OFF) {
ServiceAmbience();
return;
}
if (ChangeRadioChannel()) {
if (m_bRadioSetByScript) {
m_bRadioSetByScript = false;
FindPlayerVehicle()->m_nRadioStation = m_nCurrentStreamedSound;
}
} else {
m_bPlayerInCar = false;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
}
}
void
cMusicManager::StopFrontEndTrack()
{
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_FRONTEND && m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
m_nPreviousStreamedSound = NO_STREAMED_SOUND;
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
}
}
void
cMusicManager::PlayAnnouncement(uint8 announcement)
{
if (IsInitialised() && !m_bDisabled && !m_bAnnouncementInProgress)
m_nAnnouncement = announcement;
}
void
cMusicManager::PlayFrontEndTrack(uint8 track, uint8 bPlayInFrontend)
{
if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS) {
if (m_nMusicMode == MUSICMODE_GAME) {
if (m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
if (m_bAnnouncementInProgress) {
m_nAnnouncement = NO_STREAMED_SOUND;
m_bAnnouncementInProgress = false;
}
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
SampleManager.StopStreamedFile(0);
} else if (m_nMusicMode == MUSICMODE_FRONTEND) {
if (m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
SampleManager.StopStreamedFile(0);
}
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = track;
m_bPlayInFrontend = !!bPlayInFrontend;
m_bFrontendTrackFinished = false;
m_bDoTrackService = true;
bHasStarted = false;
if (m_nCurrentStreamedSound < STREAMED_SOUND_RADIO_POLICE) {
gRetuneCounter = 0;
gNumRetunePresses = 0;
}
}
}
void
cMusicManager::PreloadCutSceneMusic(uint8 track)
{
if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS && m_nMusicMode == MUSICMODE_CUTSCENE) {
AudioManager.ResetPoliceRadio();
while (SampleManager.IsStreamPlaying(0))
SampleManager.StopStreamedFile(0);
SampleManager.PreloadStreamedFile(track, 0);
SampleManager.SetStreamedVolumeAndPan(AudioManager.maxVolume, 63, 1, 0);
m_nCurrentStreamedSound = track;
}
}
void
cMusicManager::PlayPreloadedCutSceneMusic(void)
{
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE)
SampleManager.StartPreloadedStreamedFile(0);
}
void
cMusicManager::StopCutSceneMusic(void)
{
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE) {
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
}
}
uint32
cMusicManager::GetTrackStartPos(uint8 track)
{
uint32 result;
uint32 timer = m_aTracks[track].m_nLastPosCheckTimer;
if (CTimer::GetTimeInMillisecondsPauseMode() <= timer) {
result = m_aTracks[track].m_nPosition;
m_aTracks[track].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
} else
result = min(CTimer::GetTimeInMillisecondsPauseMode() - timer, 90000) + m_aTracks[track].m_nPosition;
if (result > m_aTracks[track].m_nLength) result %= m_aTracks[track].m_nLength;
return result;
}
bool
cMusicManager::UsesPoliceRadio(CVehicle *veh)
{
switch (veh->GetModelIndex())
{
case MI_FBICAR:
case MI_POLICE:
case MI_ENFORCER:
case MI_PREDATOR:
case MI_RHINO:
case MI_BARRACKS:
return true;
}
return false;
}
void
cMusicManager::ServiceAmbience()
{
uint8 volume;
if (m_bAnnouncementInProgress) {
m_nAnnouncement = NO_STREAMED_SOUND;
m_bAnnouncementInProgress = false;
}
if (m_nCurrentStreamedSound < STREAMED_SOUND_CITY_AMBIENT) {
if (SampleManager.IsStreamPlaying(0)) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
return;
}
m_nCurrentStreamedSound = STREAMED_SOUND_CITY_AMBIENT;
}
if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING && !SampleManager.IsStreamPlaying(0)) {
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
return;
}
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = TheCamera.DistanceToWater <= 45.0f ? STREAMED_SOUND_WATER_AMBIENT : STREAMED_SOUND_CITY_AMBIENT;
if (m_nCurrentStreamedSound == m_nPreviousStreamedSound) {
ComputeAmbienceVol(false, volume);
SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0);
if (m_bDontServiceAmbienceTrack) {
if (SampleManager.IsStreamPlaying(0))
m_bDontServiceAmbienceTrack = false;
} else ServiceTrack();
} else {
if (m_nPreviousStreamedSound < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nPreviousStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nPreviousStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
}
uint32 pos = GetTrackStartPos(m_nCurrentStreamedSound);
SampleManager.SetStreamedVolumeAndPan(0, 63, 1, 0);
if (SampleManager.StartStreamedFile(m_nCurrentStreamedSound, pos, 0)) {
ComputeAmbienceVol(true, volume);
SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0);
m_bDontServiceAmbienceTrack = true;
} else
m_nCurrentStreamedSound = NO_STREAMED_SOUND;
}
}
void
cMusicManager::ComputeAmbienceVol(uint8 reset, uint8 &outVolume)
{
static float fVol = 0.0f;
if (reset)
fVol = 0.0f;
else if (fVol < 60.0f)
fVol += 1.0f;
if (TheCamera.DistanceToWater > 70.0f)
outVolume = fVol;
else if (TheCamera.DistanceToWater > 45.0f)
outVolume = (TheCamera.DistanceToWater - 45.0f) / 25.0f * fVol;
else if (TheCamera.DistanceToWater > 20.0f)
outVolume = (45.0f - TheCamera.DistanceToWater) / 25.0f * fVol;
else
outVolume = fVol;
}
void
cMusicManager::ServiceTrack()
{
if (m_bDoTrackService) {
if (!SampleManager.IsStreamPlaying(0))
SampleManager.StartStreamedFile(m_nCurrentStreamedSound, 0, 0);
}
}
bool
cMusicManager::ServiceAnnouncement()
{
static int8 cCheck = 0;
if (m_bAnnouncementInProgress) {
if (!SampleManager.IsStreamPlaying(0)) {
m_nAnnouncement = NO_STREAMED_SOUND;
m_bAnnouncementInProgress = false;
}
return true;
}
if (++cCheck >= 30) {
cCheck = 0;
int pos = SampleManager.GetStreamedFilePosition(0);
if (SampleManager.IsStreamPlaying(0)) {
if (m_nCurrentStreamedSound != NO_STREAMED_SOUND) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = pos;
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
}
}
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) {
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0);
m_bAnnouncementInProgress = true;
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = m_nAnnouncement;
return true;
}
if (cCheck != 0) cCheck--;
else cCheck = 30;
return false;
}
return false;
}
uint8
cMusicManager::GetCarTuning()
{
CVehicle *veh = FindPlayerVehicle();
if (veh == nil) return RADIO_OFF;
if (UsesPoliceRadio(veh)) return POLICE_RADIO;
if (veh->m_nRadioStation == USERTRACK && !SampleManager.IsMP3RadioChannelAvailable())
veh->m_nRadioStation = AudioManager.GetRandomNumber(2) % USERTRACK;
return veh->m_nRadioStation;
}
uint8
cMusicManager::GetNextCarTuning()
{
CVehicle *veh = FindPlayerVehicle();
if (veh == nil) return RADIO_OFF;
if (UsesPoliceRadio(veh)) return POLICE_RADIO;
if (gNumRetunePresses != 0) {
if (SampleManager.IsMP3RadioChannelAvailable()) {
if (veh->m_nRadioStation == RADIO_OFF)
veh->m_nRadioStation = POLICE_RADIO;
veh->m_nRadioStation += gNumRetunePresses;
if (veh->m_nRadioStation == POLICE_RADIO)
veh->m_nRadioStation = RADIO_OFF;
else if (veh->m_nRadioStation > POLICE_RADIO)
veh->m_nRadioStation -= RADIO_OFF;
} else if (gNumRetunePresses + veh->m_nRadioStation >= USERTRACK) {
while (gNumRetunePresses) {
if (veh->m_nRadioStation == RADIO_OFF)
veh->m_nRadioStation = HEAD_RADIO;
else if (veh->m_nRadioStation < USERTRACK)
++veh->m_nRadioStation;
if (veh->m_nRadioStation == USERTRACK)
veh->m_nRadioStation = RADIO_OFF;
--gNumRetunePresses;
}
} else
veh->m_nRadioStation += gNumRetunePresses;
gNumRetunePresses = 0;
}
return veh->m_nRadioStation;
}
bool
cMusicManager::ChangeRadioChannel()
{
if (m_nCurrentStreamedSound != m_nPreviousStreamedSound) {
if (m_nPreviousStreamedSound < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nPreviousStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nPreviousStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
SampleManager.StopStreamedFile(0);
}
if (SampleManager.IsStreamPlaying(0))
return false;
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0))
return false;
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0);
}
return true;
}
STARTPATCHES
InjectHook(0x57E4B0, &cMusicManager::PlayerInCar, PATCH_JUMP);
InjectHook(0x57E6D0, &cMusicManager::DisplayRadioStationName, PATCH_JUMP);
InjectHook(0x57CF70, &cMusicManager::Initialise, PATCH_JUMP);
InjectHook(0x57D140, &cMusicManager::Terminate, PATCH_JUMP);
InjectHook(0x57D1D0, &cMusicManager::GetRadioInCar, PATCH_JUMP);
InjectHook(0x57D2C0, &cMusicManager::SetRadioInCar, PATCH_JUMP);
InjectHook(0x57D180, &cMusicManager::SetRadioChannelByScript, PATCH_JUMP);
InjectHook(0x57CF30, &cMusicManager::ResetMusicAfterReload, PATCH_JUMP);
InjectHook(0x57E6A0, &cMusicManager::UsesPoliceRadio, PATCH_JUMP);
InjectHook(0x57D310, &cMusicManager::ChangeMusicMode, PATCH_JUMP);
InjectHook(0x57D420, &cMusicManager::ResetTimers, PATCH_JUMP);
InjectHook(0x57D440, &cMusicManager::Service, PATCH_JUMP);
InjectHook(0x57D530, &cMusicManager::ServiceFrontEndMode, PATCH_JUMP);
InjectHook(0x57E3D0, &cMusicManager::StopFrontEndTrack, PATCH_JUMP);
InjectHook(0x57E430, &cMusicManager::PlayAnnouncement, PATCH_JUMP);
InjectHook(0x57E2E0, &cMusicManager::PlayFrontEndTrack, PATCH_JUMP);
InjectHook(0x57E210, &cMusicManager::PreloadCutSceneMusic, PATCH_JUMP);
InjectHook(0x57E290, &cMusicManager::PlayPreloadedCutSceneMusic, PATCH_JUMP);
InjectHook(0x57E2B0, &cMusicManager::StopCutSceneMusic, PATCH_JUMP);
InjectHook(0x57E450, &cMusicManager::GetTrackStartPos, PATCH_JUMP);
InjectHook(0x57D690, &cMusicManager::ServiceGameMode, PATCH_JUMP);
InjectHook(0x57DCB0, &cMusicManager::ServiceAmbience, PATCH_JUMP);
InjectHook(0x57DEA0, &cMusicManager::ComputeAmbienceVol, PATCH_JUMP);
InjectHook(0x57E100, &cMusicManager::ServiceTrack, PATCH_JUMP);
InjectHook(0x57DFC0, &cMusicManager::ServiceAnnouncement, PATCH_JUMP);
InjectHook(0x57E530, &cMusicManager::GetCarTuning, PATCH_JUMP);
InjectHook(0x57E5A0, &cMusicManager::GetNextCarTuning, PATCH_JUMP);
InjectHook(0x57E130, &cMusicManager::ChangeRadioChannel, PATCH_JUMP);
ENDPATCHES

View file

@ -2,7 +2,7 @@
#include "audio_enums.h"
class tMP3Sample
class tStreamedSample
{
public:
uint32 m_nLength;
@ -10,52 +10,46 @@ public:
uint32 m_nLastPosCheckTimer;
};
class CVehicle;
class cMusicManager
{
public:
bool m_bIsInitialised;
uint8 field_1;
bool m_bDisabled;
uint8 m_nMusicMode;
uint8 m_nCurrentStreamedSound;
uint8 m_nPreviousStreamedSound;
uint8 field_5;
uint8 field_6;
uint8 field_7;
bool m_bAnnouncement;
bool m_bFrontendTrackFinished;
bool m_bPlayInFrontend;
bool m_bSetNextStation;
uint8 m_nAnnouncement;
bool m_bPreviousPlayerInCar;
bool m_bPlayerInCar;
bool m_bAnnouncementInProgress;
tMP3Sample m_asMP3Samples[TOTAL_STREAMED_SOUNDS];
uint8 field_2364;
uint8 field_2365;
uint8 field_2366;
uint8 field_2367;
uint32 field_2368;
uint32 field_2372;
uint32 field_2376;
uint8 field_2380;
uint8 field_2381;
uint8 field_2382;
tStreamedSample m_aTracks[TOTAL_STREAMED_SOUNDS];
bool m_bResetTimers;
uint32 m_nResetTime;
uint32 m_nLastTrackServiceTime;
uint32 m_nTimer;
bool m_bDoTrackService;
bool m_bIgnoreTimeDelay;
bool m_bDontServiceAmbienceTrack;
bool m_bRadioSetByScript;
uint8 m_nRadioStation;
uint8 field_2385;
uint8 field_2386;
uint8 field_2387;
uint32 m_nRadioPosition;
bool m_bRadioInCar;
uint8 field_2393;
uint8 field_2394;
uint8 field_2395;
int32 m_nRadioPosition;
uint8 m_nRadioInCar;
public:
cMusicManager();
bool IsInitialised() { return m_bIsInitialised; }
uint32 GetMusicMode() { return m_nMusicMode; }
uint8 GetCurrentTrack() { return m_nCurrentStreamedSound; }
void Initialise();
bool Initialise();
void Terminate();
void ChangeMusicMode(int32 mode);
void ChangeMusicMode(uint8 mode);
void StopFrontEndTrack();
bool PlayerInCar();
@ -66,7 +60,7 @@ public:
void PreloadCutSceneMusic(uint8);
void PlayPreloadedCutSceneMusic(void);
void StopCutSceneMusic(void);
int32 GetRadioInCar(void);
uint8 GetRadioInCar(void);
void SetRadioInCar(uint32);
void SetRadioChannelByScript(uint8, int32);
@ -74,6 +68,20 @@ public:
void ResetTimers(int32);
void Service();
void ServiceFrontEndMode();
void ServiceGameMode();
void ServiceAmbience();
void ServiceTrack();
bool UsesPoliceRadio(CVehicle *veh);
uint32 GetTrackStartPos(uint8);
void ComputeAmbienceVol(uint8 reset, uint8& outVolume);
bool ServiceAnnouncement();
uint8 GetCarTuning();
uint8 GetNextCarTuning();
bool ChangeRadioChannel();
};
static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error");

View file

@ -124,8 +124,8 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
m_sQueueSample.m_counter = 0;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIsDistant = 1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = true;
m_sQueueSample.field_16 = 10;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_bVolume = m_anRandomTable[2] % 20 + 15;
@ -134,10 +134,10 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.field_56 = 0;
m_sQueueSample.m_bReverbFlag = 0;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bOffset = 63;
m_sQueueSample.field_76 = 3;
m_sQueueSample.m_bRequireReflection = 0;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}

View file

@ -21,210 +21,210 @@ enum eMusicMode
MUSICMODE_FRONTEND = 0,
MUSICMODE_GAME,
MUSICMODE_CUTSCENE,
MUSICMODE_OFF,
MUSICMODE_4,
MUSICMODE_DISABLE,
MUSICMODE_DISABLED,
};
enum eStreamedSounds
{
STREAMED_SOUND_RADIO_HEAD = 0,
STREAMED_SOUND_RADIO_CLASSIC = 1,
STREAMED_SOUND_RADIO_KJAH = 2,
STREAMED_SOUND_RADIO_RISE = 3,
STREAMED_SOUND_RADIO_LIPS = 4,
STREAMED_SOUND_RADIO_GAME = 5,
STREAMED_SOUND_RADIO_MSX = 6,
STREAMED_SOUND_RADIO_FLASH = 7,
STREAMED_SOUND_RADIO_CHAT = 8,
STREAMED_SOUND_RADIO_MP3_PLAYER = 9,
STREAMED_SOUND_RADIO_POLICE = 10,
STREAMED_SOUND_CITY_AMBIENT = 11,
STREAMED_SOUND_WATER_AMBIENT = 12,
STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN = 13,
STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN = 14,
STREAMED_SOUND_NEWS_INTRO = 15,
STREAMED_SOUND_BANK_INTRO = 16,
STREAMED_SOUND_CUTSCENE_LUIGI1_LG = 17,
STREAMED_SOUND_CUTSCENE_LUIGI2_DSB = 18,
STREAMED_SOUND_CUTSCENE_LUIGI3_DM = 19,
STREAMED_SOUND_CUTSCENE_LUIGI4_PAP = 20,
STREAMED_SOUND_CUTSCENE_LUIGI5_TFB = 21,
STREAMED_SOUND_CUTSCENE_JOEY0_DM2 = 22,
STREAMED_SOUND_CUTSCENE_JOEY1_LFL = 23,
STREAMED_SOUND_CUTSCENE_JOEY2_KCL = 24,
STREAMED_SOUND_CUTSCENE_JOEY3_VH = 25,
STREAMED_SOUND_CUTSCENE_JOEY4_ETH = 26,
STREAMED_SOUND_CUTSCENE_JOEY5_DST = 27,
STREAMED_SOUND_CUTSCENE_JOEY6_TBJ = 28,
STREAMED_SOUND_CUTSCENE_TONI1_TOL = 29,
STREAMED_SOUND_CUTSCENE_TONI2_TPU = 30,
STREAMED_SOUND_CUTSCENE_TONI3_MAS = 31,
STREAMED_SOUND_CUTSCENE_TONI4_TAT = 32,
STREAMED_SOUND_CUTSCENE_TONI5_BF = 33,
STREAMED_SOUND_CUTSCENE_SAL0_MAS = 34,
STREAMED_SOUND_CUTSCENE_SAL1_PF = 35,
STREAMED_SOUND_CUTSCENE_SAL2_CTG = 36,
STREAMED_SOUND_CUTSCENE_SAL3_RTC = 37,
STREAMED_SOUND_CUTSCENE_SAL5_LRQ = 38,
STREAMED_SOUND_CUTSCENE_SAL4_BDBA = 39,
STREAMED_SOUND_CUTSCENE_SAL4_BDBB = 40,
STREAMED_SOUND_CUTSCENE_SAL2_CTG2 = 41,
STREAMED_SOUND_CUTSCENE_SAL4_BDBD = 42,
STREAMED_SOUND_CUTSCENE_SAL5_LRQB = 43,
STREAMED_SOUND_CUTSCENE_SAL5_LRQC = 44,
STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO = 45,
STREAMED_SOUND_CUTSCENE_ASUKA_2_PP = 46,
STREAMED_SOUND_CUTSCENE_ASUKA_3_SS = 47,
STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR = 48,
STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT = 49,
STREAMED_SOUND_CUTSCENE_KENJI1_KBO = 50,
STREAMED_SOUND_CUTSCENE_KENJI2_GIS = 51,
STREAMED_SOUND_CUTSCENE_KENJI3_DS = 52,
STREAMED_SOUND_CUTSCENE_KENJI4_SHI = 53,
STREAMED_SOUND_CUTSCENE_KENJI5_SD = 54,
STREAMED_SOUND_CUTSCENE_RAY0_PDR2 = 55,
STREAMED_SOUND_CUTSCENE_RAY1_SW = 56,
STREAMED_SOUND_CUTSCENE_RAY2_AP = 57,
STREAMED_SOUND_CUTSCENE_RAY3_ED = 58,
STREAMED_SOUND_CUTSCENE_RAY4_GF = 59,
STREAMED_SOUND_CUTSCENE_RAY5_PB = 60,
STREAMED_SOUND_CUTSCENE_RAY6_MM = 61,
STREAMED_SOUND_CUTSCENE_DONALD1_STOG = 62,
STREAMED_SOUND_CUTSCENE_DONALD2_KK = 63,
STREAMED_SOUND_CUTSCENE_DONALD3_ADO = 64,
STREAMED_SOUND_CUTSCENE_DONALD5_ES = 65,
STREAMED_SOUND_CUTSCENE_DONALD7_MLD = 66,
STREAMED_SOUND_CUTSCENE_DONALD4_GTA = 67,
STREAMED_SOUND_CUTSCENE_DONALD4_GTA2 = 68,
STREAMED_SOUND_CUTSCENE_DONALD6_STS = 69,
STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT = 70,
STREAMED_SOUND_CUTSCENE_ASUKA7_ETG = 71,
STREAMED_SOUND_CUTSCENE_ASUKA8_PS = 72,
STREAMED_SOUND_CUTSCENE_ASUKA9_ASD = 73,
STREAMED_SOUND_CUTSCENE_KENJI4_SHI2 = 74,
STREAMED_SOUND_CUTSCENE_CATALINA1_TEX = 75,
STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 = 76,
STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 = 77,
STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3 = 78,
STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4 = 79,
STREAMED_SOUND_CUTSCENE_YARDIE_PH1 = 80,
STREAMED_SOUND_CUTSCENE_YARDIE_PH2 = 81,
STREAMED_SOUND_CUTSCENE_YARDIE_PH3 = 82,
STREAMED_SOUND_CUTSCENE_YARDIE_PH4 = 83,
STREAMED_SOUND_CUTSCENE_HOODS_PH1 = 84,
STREAMED_SOUND_CUTSCENE_HOODS_PH2 = 85,
STREAMED_SOUND_CUTSCENE_HOODS_PH3 = 86,
STREAMED_SOUND_CUTSCENE_HOODS_PH4 = 87,
STREAMED_SOUND_CUTSCENE_HOODS_PH5 = 88,
STREAMED_SOUND_CUTSCENE_MARTY_PH1 = 89,
STREAMED_SOUND_CUTSCENE_MARTY_PH2 = 90,
STREAMED_SOUND_CUTSCENE_MARTY_PH3 = 91,
STREAMED_SOUND_CUTSCENE_MARTY_PH4 = 92,
STREAMED_SOUND_MISSION_COMPLETED = 93,
STREAMED_SOUND_GAME_COMPLETED = 94,
STREAMED_SOUND_MISSION_LIB_A1 = 95,
STREAMED_SOUND_MISSION_LIB_A2 = 96,
STREAMED_SOUND_MISSION_LIB_A = 97,
STREAMED_SOUND_MISSION_LIB_B = 98,
STREAMED_SOUND_MISSION_LIB_C = 99,
STREAMED_SOUND_MISSION_LIB_D = 100,
STREAMED_SOUND_MISSION_L2_A = 101,
STREAMED_SOUND_MISSION_J4T_1 = 102,
STREAMED_SOUND_MISSION_J4T_2 = 103,
STREAMED_SOUND_MISSION_J4T_3 = 104,
STREAMED_SOUND_MISSION_J4T_4 = 105,
STREAMED_SOUND_MISSION_J4_A = 106,
STREAMED_SOUND_MISSION_J4_B = 107,
STREAMED_SOUND_MISSION_J4_C = 108,
STREAMED_SOUND_MISSION_J4_D = 109,
STREAMED_SOUND_MISSION_J4_E = 110,
STREAMED_SOUND_MISSION_J4_F = 111,
STREAMED_SOUND_MISSION_J6_1 = 112,
STREAMED_SOUND_MISSION_J6_A = 113,
STREAMED_SOUND_MISSION_J6_B = 114,
STREAMED_SOUND_MISSION_J6_C = 115,
STREAMED_SOUND_MISSION_J6_D = 116,
STREAMED_SOUND_MISSION_T4_A = 117,
STREAMED_SOUND_MISSION_S1_A = 118,
STREAMED_SOUND_MISSION_S1_A1 = 119,
STREAMED_SOUND_MISSION_S1_B = 120,
STREAMED_SOUND_MISSION_S1_C = 121,
STREAMED_SOUND_MISSION_S1_C1 = 122,
STREAMED_SOUND_MISSION_S1_D = 123,
STREAMED_SOUND_MISSION_S1_E = 124,
STREAMED_SOUND_MISSION_S1_F = 125,
STREAMED_SOUND_MISSION_S1_G = 126,
STREAMED_SOUND_MISSION_S1_H = 127,
STREAMED_SOUND_MISSION_S1_I = 128,
STREAMED_SOUND_MISSION_S1_J = 129,
STREAMED_SOUND_MISSION_S1_K = 130,
STREAMED_SOUND_MISSION_S1_L = 131,
STREAMED_SOUND_MISSION_S3_A = 132,
STREAMED_SOUND_MISSION_S3_B = 133,
STREAMED_SOUND_MISSION_EL3_A = 134,
STREAMED_SOUND_MISSION_MF1_A = 135,
STREAMED_SOUND_MISSION_MF2_A = 136,
STREAMED_SOUND_MISSION_MF3_A = 137,
STREAMED_SOUND_MISSION_MF3_B = 138,
STREAMED_SOUND_MISSION_MF3_B1 = 139,
STREAMED_SOUND_MISSION_MF3_C = 140,
STREAMED_SOUND_MISSION_MF4_A = 141,
STREAMED_SOUND_MISSION_MF4_B = 142,
STREAMED_SOUND_MISSION_MF4_C = 143,
STREAMED_SOUND_MISSION_A1_A = 144,
STREAMED_SOUND_MISSION_A3_A = 145,
STREAMED_SOUND_MISSION_A5_A = 146,
STREAMED_SOUND_MISSION_A4_A = 147,
STREAMED_SOUND_MISSION_A4_B = 148,
STREAMED_SOUND_MISSION_A4_C = 149,
STREAMED_SOUND_MISSION_A4_D = 150,
STREAMED_SOUND_MISSION_K1_A = 151,
STREAMED_SOUND_MISSION_K3_A = 152,
STREAMED_SOUND_MISSION_R1_A = 153,
STREAMED_SOUND_MISSION_R2_A = 154,
STREAMED_SOUND_MISSION_R2_B = 155,
STREAMED_SOUND_MISSION_R2_C = 156,
STREAMED_SOUND_MISSION_R2_D = 157,
STREAMED_SOUND_MISSION_R2_E = 158,
STREAMED_SOUND_MISSION_R2_F = 159,
STREAMED_SOUND_MISSION_R2_G = 160,
STREAMED_SOUND_MISSION_R2_H = 161,
STREAMED_SOUND_MISSION_R5_A = 162,
STREAMED_SOUND_MISSION_R6_A = 163,
STREAMED_SOUND_MISSION_R6_A1 = 164,
STREAMED_SOUND_MISSION_R6_B = 165,
STREAMED_SOUND_MISSION_LO2_A = 166,
STREAMED_SOUND_MISSION_LO6_A = 167,
STREAMED_SOUND_MISSION_YD2_A = 168,
STREAMED_SOUND_MISSION_YD2_B = 169,
STREAMED_SOUND_MISSION_YD2_C = 170,
STREAMED_SOUND_MISSION_YD2_C1 = 171,
STREAMED_SOUND_MISSION_YD2_D = 172,
STREAMED_SOUND_MISSION_YD2_E = 173,
STREAMED_SOUND_MISSION_YD2_F = 174,
STREAMED_SOUND_MISSION_YD2_G = 175,
STREAMED_SOUND_MISSION_YD2_H = 176,
STREAMED_SOUND_MISSION_YD2_ASS = 177,
STREAMED_SOUND_MISSION_YD2_OK = 178,
STREAMED_SOUND_MISSION_H5_A = 179,
STREAMED_SOUND_MISSION_H5_B = 180,
STREAMED_SOUND_MISSION_H5_C = 181,
STREAMED_SOUND_MISSION_AMMU_A = 182,
STREAMED_SOUND_MISSION_AMMU_B = 183,
STREAMED_SOUND_MISSION_AMMU_C = 184,
STREAMED_SOUND_MISSION_DOOR_1 = 185,
STREAMED_SOUND_MISSION_DOOR_2 = 186,
STREAMED_SOUND_MISSION_DOOR_3 = 187,
STREAMED_SOUND_MISSION_DOOR_4 = 188,
STREAMED_SOUND_MISSION_DOOR_5 = 189,
STREAMED_SOUND_MISSION_DOOR_6 = 190,
STREAMED_SOUND_MISSION_T3_A = 191,
STREAMED_SOUND_MISSION_T3_B = 192,
STREAMED_SOUND_MISSION_T3_C = 193,
STREAMED_SOUND_MISSION_K1_B = 194,
STREAMED_SOUND_MISSION_CAT1 = 195,
TOTAL_STREAMED_SOUNDS = 196,
NO_STREAMED_SOUND = 197,
STREAMED_SOUND_RADIO_HEAD,
STREAMED_SOUND_RADIO_CLASSIC,
STREAMED_SOUND_RADIO_KJAH,
STREAMED_SOUND_RADIO_RISE,
STREAMED_SOUND_RADIO_LIPS,
STREAMED_SOUND_RADIO_GAME,
STREAMED_SOUND_RADIO_MSX,
STREAMED_SOUND_RADIO_FLASH,
STREAMED_SOUND_RADIO_CHAT,
STREAMED_SOUND_RADIO_MP3_PLAYER,
STREAMED_SOUND_RADIO_POLICE,
STREAMED_SOUND_CITY_AMBIENT,
STREAMED_SOUND_WATER_AMBIENT,
STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN,
STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN,
STREAMED_SOUND_NEWS_INTRO,
STREAMED_SOUND_BANK_INTRO,
STREAMED_SOUND_CUTSCENE_LUIGI1_LG,
STREAMED_SOUND_CUTSCENE_LUIGI2_DSB,
STREAMED_SOUND_CUTSCENE_LUIGI3_DM,
STREAMED_SOUND_CUTSCENE_LUIGI4_PAP,
STREAMED_SOUND_CUTSCENE_LUIGI5_TFB,
STREAMED_SOUND_CUTSCENE_JOEY0_DM2,
STREAMED_SOUND_CUTSCENE_JOEY1_LFL,
STREAMED_SOUND_CUTSCENE_JOEY2_KCL,
STREAMED_SOUND_CUTSCENE_JOEY3_VH,
STREAMED_SOUND_CUTSCENE_JOEY4_ETH,
STREAMED_SOUND_CUTSCENE_JOEY5_DST,
STREAMED_SOUND_CUTSCENE_JOEY6_TBJ,
STREAMED_SOUND_CUTSCENE_TONI1_TOL,
STREAMED_SOUND_CUTSCENE_TONI2_TPU,
STREAMED_SOUND_CUTSCENE_TONI3_MAS,
STREAMED_SOUND_CUTSCENE_TONI4_TAT,
STREAMED_SOUND_CUTSCENE_TONI5_BF,
STREAMED_SOUND_CUTSCENE_SAL0_MAS,
STREAMED_SOUND_CUTSCENE_SAL1_PF,
STREAMED_SOUND_CUTSCENE_SAL2_CTG,
STREAMED_SOUND_CUTSCENE_SAL3_RTC,
STREAMED_SOUND_CUTSCENE_SAL5_LRQ,
STREAMED_SOUND_CUTSCENE_SAL4_BDBA,
STREAMED_SOUND_CUTSCENE_SAL4_BDBB,
STREAMED_SOUND_CUTSCENE_SAL2_CTG2,
STREAMED_SOUND_CUTSCENE_SAL4_BDBD,
STREAMED_SOUND_CUTSCENE_SAL5_LRQB,
STREAMED_SOUND_CUTSCENE_SAL5_LRQC,
STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO,
STREAMED_SOUND_CUTSCENE_ASUKA_2_PP,
STREAMED_SOUND_CUTSCENE_ASUKA_3_SS,
STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR,
STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT,
STREAMED_SOUND_CUTSCENE_KENJI1_KBO,
STREAMED_SOUND_CUTSCENE_KENJI2_GIS,
STREAMED_SOUND_CUTSCENE_KENJI3_DS,
STREAMED_SOUND_CUTSCENE_KENJI4_SHI,
STREAMED_SOUND_CUTSCENE_KENJI5_SD,
STREAMED_SOUND_CUTSCENE_RAY0_PDR2,
STREAMED_SOUND_CUTSCENE_RAY1_SW,
STREAMED_SOUND_CUTSCENE_RAY2_AP,
STREAMED_SOUND_CUTSCENE_RAY3_ED,
STREAMED_SOUND_CUTSCENE_RAY4_GF,
STREAMED_SOUND_CUTSCENE_RAY5_PB,
STREAMED_SOUND_CUTSCENE_RAY6_MM,
STREAMED_SOUND_CUTSCENE_DONALD1_STOG,
STREAMED_SOUND_CUTSCENE_DONALD2_KK,
STREAMED_SOUND_CUTSCENE_DONALD3_ADO,
STREAMED_SOUND_CUTSCENE_DONALD5_ES,
STREAMED_SOUND_CUTSCENE_DONALD7_MLD,
STREAMED_SOUND_CUTSCENE_DONALD4_GTA,
STREAMED_SOUND_CUTSCENE_DONALD4_GTA2,
STREAMED_SOUND_CUTSCENE_DONALD6_STS,
STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT,
STREAMED_SOUND_CUTSCENE_ASUKA7_ETG,
STREAMED_SOUND_CUTSCENE_ASUKA8_PS,
STREAMED_SOUND_CUTSCENE_ASUKA9_ASD,
STREAMED_SOUND_CUTSCENE_KENJI4_SHI2,
STREAMED_SOUND_CUTSCENE_CATALINA1_TEX,
STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1,
STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2,
STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3,
STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4,
STREAMED_SOUND_CUTSCENE_YARDIE_PH1,
STREAMED_SOUND_CUTSCENE_YARDIE_PH2,
STREAMED_SOUND_CUTSCENE_YARDIE_PH3,
STREAMED_SOUND_CUTSCENE_YARDIE_PH4,
STREAMED_SOUND_CUTSCENE_HOODS_PH1,
STREAMED_SOUND_CUTSCENE_HOODS_PH2,
STREAMED_SOUND_CUTSCENE_HOODS_PH3,
STREAMED_SOUND_CUTSCENE_HOODS_PH4,
STREAMED_SOUND_CUTSCENE_HOODS_PH5,
STREAMED_SOUND_CUTSCENE_MARTY_PH1,
STREAMED_SOUND_CUTSCENE_MARTY_PH2,
STREAMED_SOUND_CUTSCENE_MARTY_PH3,
STREAMED_SOUND_CUTSCENE_MARTY_PH4,
STREAMED_SOUND_MISSION_COMPLETED,
STREAMED_SOUND_GAME_COMPLETED,
STREAMED_SOUND_MISSION_LIB_A1,
STREAMED_SOUND_MISSION_LIB_A2,
STREAMED_SOUND_MISSION_LIB_A,
STREAMED_SOUND_MISSION_LIB_B,
STREAMED_SOUND_MISSION_LIB_C,
STREAMED_SOUND_MISSION_LIB_D,
STREAMED_SOUND_MISSION_L2_A,
STREAMED_SOUND_MISSION_J4T_1,
STREAMED_SOUND_MISSION_J4T_2,
STREAMED_SOUND_MISSION_J4T_3,
STREAMED_SOUND_MISSION_J4T_4,
STREAMED_SOUND_MISSION_J4_A,
STREAMED_SOUND_MISSION_J4_B,
STREAMED_SOUND_MISSION_J4_C,
STREAMED_SOUND_MISSION_J4_D,
STREAMED_SOUND_MISSION_J4_E,
STREAMED_SOUND_MISSION_J4_F,
STREAMED_SOUND_MISSION_J6_1,
STREAMED_SOUND_MISSION_J6_A,
STREAMED_SOUND_MISSION_J6_B,
STREAMED_SOUND_MISSION_J6_C,
STREAMED_SOUND_MISSION_J6_D,
STREAMED_SOUND_MISSION_T4_A,
STREAMED_SOUND_MISSION_S1_A,
STREAMED_SOUND_MISSION_S1_A1,
STREAMED_SOUND_MISSION_S1_B,
STREAMED_SOUND_MISSION_S1_C,
STREAMED_SOUND_MISSION_S1_C1,
STREAMED_SOUND_MISSION_S1_D,
STREAMED_SOUND_MISSION_S1_E,
STREAMED_SOUND_MISSION_S1_F,
STREAMED_SOUND_MISSION_S1_G,
STREAMED_SOUND_MISSION_S1_H,
STREAMED_SOUND_MISSION_S1_I,
STREAMED_SOUND_MISSION_S1_J,
STREAMED_SOUND_MISSION_S1_K,
STREAMED_SOUND_MISSION_S1_L,
STREAMED_SOUND_MISSION_S3_A,
STREAMED_SOUND_MISSION_S3_B,
STREAMED_SOUND_MISSION_EL3_A,
STREAMED_SOUND_MISSION_MF1_A,
STREAMED_SOUND_MISSION_MF2_A,
STREAMED_SOUND_MISSION_MF3_A,
STREAMED_SOUND_MISSION_MF3_B,
STREAMED_SOUND_MISSION_MF3_B1,
STREAMED_SOUND_MISSION_MF3_C,
STREAMED_SOUND_MISSION_MF4_A,
STREAMED_SOUND_MISSION_MF4_B,
STREAMED_SOUND_MISSION_MF4_C,
STREAMED_SOUND_MISSION_A1_A,
STREAMED_SOUND_MISSION_A3_A,
STREAMED_SOUND_MISSION_A5_A,
STREAMED_SOUND_MISSION_A4_A,
STREAMED_SOUND_MISSION_A4_B,
STREAMED_SOUND_MISSION_A4_C,
STREAMED_SOUND_MISSION_A4_D,
STREAMED_SOUND_MISSION_K1_A,
STREAMED_SOUND_MISSION_K3_A,
STREAMED_SOUND_MISSION_R1_A,
STREAMED_SOUND_MISSION_R2_A,
STREAMED_SOUND_MISSION_R2_B,
STREAMED_SOUND_MISSION_R2_C,
STREAMED_SOUND_MISSION_R2_D,
STREAMED_SOUND_MISSION_R2_E,
STREAMED_SOUND_MISSION_R2_F,
STREAMED_SOUND_MISSION_R2_G,
STREAMED_SOUND_MISSION_R2_H,
STREAMED_SOUND_MISSION_R5_A,
STREAMED_SOUND_MISSION_R6_A,
STREAMED_SOUND_MISSION_R6_A1,
STREAMED_SOUND_MISSION_R6_B,
STREAMED_SOUND_MISSION_LO2_A,
STREAMED_SOUND_MISSION_LO6_A,
STREAMED_SOUND_MISSION_YD2_A,
STREAMED_SOUND_MISSION_YD2_B,
STREAMED_SOUND_MISSION_YD2_C,
STREAMED_SOUND_MISSION_YD2_C1,
STREAMED_SOUND_MISSION_YD2_D,
STREAMED_SOUND_MISSION_YD2_E,
STREAMED_SOUND_MISSION_YD2_F,
STREAMED_SOUND_MISSION_YD2_G,
STREAMED_SOUND_MISSION_YD2_H,
STREAMED_SOUND_MISSION_YD2_ASS,
STREAMED_SOUND_MISSION_YD2_OK,
STREAMED_SOUND_MISSION_H5_A,
STREAMED_SOUND_MISSION_H5_B,
STREAMED_SOUND_MISSION_H5_C,
STREAMED_SOUND_MISSION_AMMU_A,
STREAMED_SOUND_MISSION_AMMU_B,
STREAMED_SOUND_MISSION_AMMU_C,
STREAMED_SOUND_MISSION_DOOR_1,
STREAMED_SOUND_MISSION_DOOR_2,
STREAMED_SOUND_MISSION_DOOR_3,
STREAMED_SOUND_MISSION_DOOR_4,
STREAMED_SOUND_MISSION_DOOR_5,
STREAMED_SOUND_MISSION_DOOR_6,
STREAMED_SOUND_MISSION_T3_A,
STREAMED_SOUND_MISSION_T3_B,
STREAMED_SOUND_MISSION_T3_C,
STREAMED_SOUND_MISSION_K1_B,
STREAMED_SOUND_MISSION_CAT1,
TOTAL_STREAMED_SOUNDS,
NO_STREAMED_SOUND,
};
enum AudioEntityHandle {

View file

@ -17,6 +17,7 @@ enum
SAMPLEBANK_MAIN,
SAMPLEBANK_PED,
MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID
};
#define MAX_PEDSFX 7

View file

@ -93,7 +93,7 @@ int32 CGarages::QueryCarsCollected(int16 garage)
void CGarages::GivePlayerDetonator()
{
FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR, 1);
FindPlayerPed()->m_weapons[FindPlayerPed()->GetWeaponSlot(WEAPONTYPE_DETONATOR)].m_eWeaponState = WEAPONSTATE_READY;
FindPlayerPed()->GetWeapon(FindPlayerPed()->GetWeaponSlot(WEAPONTYPE_DETONATOR)).m_eWeaponState = WEAPONSTATE_READY;
}
WRAPPER bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) { EAXJMP(0x426D50); }

View file

@ -515,6 +515,7 @@ int m_iModeObbeCamIsInForCar;
void dtor(void) { this->CCamera::~CCamera(); }
};
static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error");
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error");
static_assert(offsetof(CCamera, m_uiNumberOfTrainCamNodes) == 0x84, "CCamera: error");

View file

@ -116,6 +116,8 @@ public:
#ifdef __DINPUT_INCLUDED__
DIJOYSTATE2 m_OldState;
DIJOYSTATE2 m_NewState;
#else
uint8 ___padd[0x110 * 2];
#endif
wchar m_aActionNames[MAX_CONTROLLERACTIONS][ACTIONNAME_LENGTH];
bool m_aButtonStates[MAX_BUTTONS];

View file

@ -448,7 +448,7 @@ void CMenuManager::Draw()
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
case MENUPAGE_SAVE_OVERWRITE_CONFIRM:
if (Slots[m_nCurrSaveSlot] == SLOT_EMPTY)
if (Slots[m_nCurrSaveSlot + 1] == SLOT_EMPTY)
str = TheText.Get("FESZ_QZ");
else
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);

View file

@ -389,6 +389,8 @@ public:
bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
bool GetStartJustDown() { return !!(NewState.Start && !OldState.Start); }
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
bool GetTriangle() { return !!NewState.Triangle; }
bool GetCircle() { return !!NewState.Circle; }

View file

@ -13,6 +13,7 @@ int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714; // 6
int32 &CWanted::nMaximumWantedLevel = *(int32*)0x5F7718; // 6400
WRAPPER void CWanted::Reset() { EAXJMP(0x4AD790) };
WRAPPER void CWanted::Update() { EAXJMP(0x4AD7B0) };
void
CWanted::Initialise()

View file

@ -78,6 +78,7 @@ public:
void ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare);
void UpdateWantedLevel();
void Reset();
void Update();
bool IsIgnored(void) { return m_bIgnoredByCops || m_bIgnoredByEveryone; }

View file

@ -866,10 +866,9 @@ CVehicle*
FindPlayerVehicle(void)
{
CPlayerPed *ped = FindPlayerPed();
if(ped->InVehicle())
if(ped && ped->InVehicle())
return ped->m_pMyVehicle;
else
return nil;
return nil;
}
CVehicle*

View file

@ -462,7 +462,7 @@ CCullZone::DoStuffEnteringZone_OneBuilding(uint16 i)
}else{
i -= 6000;
for(j = 0; j < 3; j++)
DoStuffLeavingZone_OneBuilding(CCullZones::aIndices[i+j]);
DoStuffEnteringZone_OneBuilding(CCullZones::aIndices[i+j]);
}
}
@ -481,7 +481,7 @@ CCullZone::DoStuffEnteringZone_OneTreadablePlus10m(uint16 i)
}else{
i -= 6000;
for(j = 0; j < 3; j++)
DoStuffLeavingZone_OneBuilding(CCullZones::aIndices[i+j]);
DoStuffEnteringZone_OneTreadablePlus10m(CCullZones::aIndices[i+j]);
}
}
@ -499,7 +499,7 @@ CCullZone::DoStuffEnteringZone_OneTreadable(uint16 i)
}else{
i -= 6000;
for(j = 0; j < 3; j++)
DoStuffLeavingZone_OneBuilding(CCullZones::aIndices[i+j]);
DoStuffEnteringZone_OneTreadable(CCullZones::aIndices[i+j]);
}
}

View file

@ -350,7 +350,6 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
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);

View file

@ -273,7 +273,6 @@ static char WaitStateText[][16] = {
};
#ifdef TOGGLEABLE_BETA_FEATURES
bool CPed::bUnusedFightThingOnPlayer = false;
bool CPed::bPopHeadsOnHeadshot = false;
bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
#endif
@ -719,7 +718,7 @@ CheckForPedsOnGroundToAttack(CPed *attacker, CPed **pedOnGround)
}
if (pedOnGround)
* pedOnGround = currentPed;
*pedOnGround = currentPed;
return stateToReturn;
}
@ -1068,6 +1067,7 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
if (attackAssoc) {
switch (attackAssoc->animId) {
case ANIM_WEAPON_START_THROW:
// what?!
if ((!ped->IsPlayer() || ((CPlayerPed*)ped)->m_bHaveTargetSelected) && ped->IsPlayer()) {
attackAssoc->blendDelta = -1000.0f;
newAnim = CAnimManager::AddAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_WEAPON_THROWU);
@ -1929,13 +1929,13 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
float limitedDest = CGeneral::LimitRadianAngle(m_fRotationDest);
float timeUntilStateChange = (m_nPedStateTimer - CTimer::GetTimeInMilliseconds())/600.0f;
m_vecOffsetSeek.z = 0.0f;
if (timeUntilStateChange <= 0.0f) {
m_vecOffsetSeek.x = 0.0f;
m_vecOffsetSeek.y = 0.0f;
} else {
neededPos -= timeUntilStateChange * m_vecOffsetSeek;
}
m_vecOffsetSeek.z = 0.0f;
neededPos -= timeUntilStateChange * m_vecOffsetSeek;
if (PI + m_fRotationCur < limitedDest) {
limitedDest -= 2 * PI;
@ -2120,18 +2120,16 @@ CPed::SortPeds(CPed **list, int min, int max)
int left = max;
int right;
for(right = min; right <= left; ){
// Those 1.0s are my addition to make sure loop always run for first time.
for (float rightDist = middleDist-1.0f; middleDist > rightDist; right++) {
float rightDist, leftDist;
do {
rightDiff = GetPosition() - list[right]->GetPosition();
rightDist = rightDiff.Magnitude();
}
right--;
} while (middleDist > rightDist && ++right);
for (float leftDist = middleDist+1.0f; middleDist < leftDist; left--) {
do {
leftDiff = GetPosition() - list[left]->GetPosition();
leftDist = leftDiff.Magnitude();
}
left++;
} while (middleDist < leftDist && left--);
if (right <= left) {
CPed *ped = list[right];
@ -4536,7 +4534,7 @@ CPed::SetEvasiveDive(CPhysical *reason, uint8 onlyRandomJump)
}
} else {
if (IsPlayer()) {
((CPlayerPed*)this)->m_bShouldEvade = 5;
((CPlayerPed*)this)->m_nEvadeAmount = 5;
((CPlayerPed*)this)->m_pEvadingFrom = reason;
reason->RegisterReference((CEntity**) &((CPlayerPed*)this)->m_pEvadingFrom);
return;
@ -4827,10 +4825,6 @@ CPed::StartFightAttack(uint8 buttonPressure)
animAssoc->SetFinishCallback(FinishFightMoveCB, this);
m_fightState = FIGHTSTATE_NO_MOVE;
m_takeAStepAfterAttack = false;
#ifdef TOGGLEABLE_BETA_FEATURES
m_takeAStepAfterAttack = IsPlayer() && bUnusedFightThingOnPlayer;
#endif
bIsAttacking = true;
if (IsPlayer())
@ -11064,6 +11058,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
int padNo;
if (ped->IsPlayer()) {
// BUG? This will cause crash if m_nPedType is bigger then 1, there are only 2 pads
switch (ped->m_nPedType) {
case PEDTYPE_PLAYER1:
padNo = 0;
@ -11077,9 +11072,6 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
case PEDTYPE_PLAYER4:
padNo = 3;
break;
default:
// FIX: that was "break"
return;
}
CPad *pad = CPad::GetPad(padNo);
@ -11179,6 +11171,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
int padNo;
if (ped->IsPlayer()) {
// BUG? This will cause crash if m_nPedType is bigger then 1, there are only 2 pads
switch (ped->m_nPedType) {
case PEDTYPE_PLAYER1:
padNo = 0;
@ -11192,9 +11185,6 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
case PEDTYPE_PLAYER4:
padNo = 3;
break;
default:
// FIX: that was "break"
return;
}
CPad* pad = CPad::GetPad(padNo);
bool engineIsIntact = false;
@ -11421,6 +11411,34 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (!veh)
return;
#ifdef VC_PED_PORTS
// Situation of entering car as a driver while there is already a driver exiting atm.
CPed *driver = veh->pDriver;
if (driver && driver->m_nPedState == PED_DRIVING && !veh->bIsBus && driver->m_objective == OBJECTIVE_LEAVE_VEHICLE
&& (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK)) {
if (!ped->IsPlayer() && (ped->CharCreatedBy != MISSION_CHAR || driver->IsPlayer())) {
ped->QuitEnteringCar();
return;
}
if (driver->CharCreatedBy == MISSION_CHAR) {
PedSetOutCarCB(nil, veh->pDriver);
if (driver->m_pMyVehicle) {
driver->PositionPedOutOfCollision();
} else {
driver->m_pMyVehicle = veh;
driver->PositionPedOutOfCollision();
driver->m_pMyVehicle = nil;
}
veh->pDriver = nil;
} else {
driver->SetDead();
driver->FlagToDestroyWhenNextProcessed();
veh->pDriver = nil;
}
}
#endif
if (!ped->IsNotInWreckedVehicle() || ped->DyingOrDead())
return;
@ -11450,7 +11468,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->IsBoat()) {
if (ped->IsPlayer()) {
#ifdef VC_PED_PORTS
#if defined(FIX_BUGS) || defined(VC_PED_PORTS)
CCarCtrl::RegisterVehicleOfInterest(veh);
#endif
if (veh->m_status == STATUS_SIMPLE) {
@ -11503,7 +11521,10 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
#endif
}
}
} else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
}
// This shouldn't happen at all. Passengers can't enter with PED_CARJACK. Even though they did, we shouldn't call AddPassenger in here and SetDriver in below.
#ifndef VC_PED_PORTS
else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (ped->m_nPedState == PED_CARJACK) {
veh->AddPassenger(ped, 0);
ped->m_nPedState = PED_DRIVING;
@ -11513,6 +11534,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->AutoPilot.m_nCruiseSpeed = 17;
}
}
#endif
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK) {
veh->SetDriver(ped);
@ -11576,6 +11598,10 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->m_prevObjective = OBJECTIVE_NONE;
ped->RestorePreviousObjective();
#ifdef VC_PED_PORTS
if(veh->pDriver && ped->CharCreatedBy == RANDOM_CHAR)
veh->AutoPilot.m_nCruiseSpeed = 17;
#endif
}
veh->m_nGettingInFlags &= ~GetCarDoorFlag(ped->m_vehEnterType);
@ -13102,13 +13128,21 @@ CPed::ProcessObjective(void)
m_objectiveTimer = 0;
}
}
// fall through
}
case OBJECTIVE_ENTER_CAR_AS_DRIVER:
{
if (!m_carInObjective || bInVehicle) {
bObjectiveCompleted = true;
bScriptObjectiveCompleted = true;
RestorePreviousState();
#ifdef VC_PED_PORTS
if (bInVehicle && m_pMyVehicle != m_carInObjective) {
SetExitCar(m_pMyVehicle, 0);
} else
#endif
{
bObjectiveCompleted = true;
bScriptObjectiveCompleted = true;
RestorePreviousState();
}
} else {
if (m_leaveCarTimer > CTimer::GetTimeInMilliseconds()) {
SetMoveState(PEDMOVE_STILL);

View file

@ -530,8 +530,8 @@ public:
void AimGun(void);
void KillPedWithCar(CVehicle *veh, float impulse);
void Say(uint16 audio);
void SetLookFlag(CEntity *target, bool unknown);
void SetLookFlag(float direction, bool unknown);
void SetLookFlag(CEntity *target, bool keepTryingToLook);
void SetLookFlag(float direction, bool keepTryingToLook);
void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2);
void SetDead(void);
@ -824,7 +824,6 @@ public:
static CPedAudioData (&CommentWaitTime)[38];
#ifdef TOGGLEABLE_BETA_FEATURES
static bool bUnusedFightThingOnPlayer;
static bool bPopHeadsOnHeadshot;
static bool bMakePedsRunToPhonesToReportCrimes;
#endif

View file

@ -11,13 +11,13 @@
#include "Darkel.h"
#include "CarCtrl.h"
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
CPlayerPed::~CPlayerPed()
{
delete m_pWanted;
}
WRAPPER void CPlayerPed::ProcessControl(void) { EAXJMP(0x4EFD90); }
CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
{
m_fMoveSpeed = 0.0f;
@ -30,13 +30,13 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_currentWeapon = WEAPONTYPE_UNARMED;
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
m_nSpeedTimer = 0;
m_bSpeedTimerFlag = 0;
m_bSpeedTimerFlag = false;
m_pPointGunAt = nil;
m_nPedState = PED_IDLE;
m_fMaxStamina = 150.0f;
m_fCurrentStamina = m_fMaxStamina;
m_fStaminaProgress = 0.0f;
m_bShouldEvade = 0;
m_nEvadeAmount = 0;
field_1367 = 0;
m_nShotDelay = 0;
field_1376 = 0.0f;
@ -230,7 +230,7 @@ CPlayerPed::SetInitialState(void)
m_animGroup = ASSOCGRP_PLAYER;
m_fMoveSpeed = 0.0f;
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
m_bShouldEvade = false;
m_nEvadeAmount = 0;
m_pEvadingFrom = nil;
bIsPedDieAnimPlaying = false;
SetRealMoveAnim();
@ -651,19 +651,19 @@ CPlayerPed::PlayerControlFighter(CPad *padUsed)
{
float leftRight = padUsed->GetPedWalkLeftRight();
float upDown = padUsed->GetPedWalkUpDown();
float padMove = Sqrt(upDown * upDown + leftRight * leftRight);
float padMove = CVector2D(leftRight, upDown).Magnitude();
if (padMove > 0.0f) {
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown) - TheCamera.Orientation;
m_takeAStepAfterAttack = padMove > 120.0f;
if (padUsed->GetSprint() && padMove > 60.0f)
m_takeAStepAfterAttack = padMove > 2 * PAD_MOVE_TO_GAME_WORLD_MOVE;
if (padUsed->GetSprint() && padMove > 1 * PAD_MOVE_TO_GAME_WORLD_MOVE)
bIsAttacking = false;
}
if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy && padUsed->JumpJustDown()) {
if (m_bShouldEvade && m_pEvadingFrom) {
if (m_nEvadeAmount != 0 && m_pEvadingFrom) {
SetEvasiveDive((CPhysical*)m_pEvadingFrom, 1);
m_bShouldEvade = false;
m_nEvadeAmount = 0;
m_pEvadingFrom = nil;
} else {
SetJump();
@ -676,8 +676,8 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed)
{
float leftRight = padUsed->GetPedWalkLeftRight();
float upDown = padUsed->GetPedWalkUpDown();
float padMove = Sqrt(upDown * upDown + leftRight * leftRight);
float padMoveInGameUnit = padMove / 60.0f;
float padMove = CVector2D(leftRight, upDown).Magnitude();
float padMoveInGameUnit = padMove / PAD_MOVE_TO_GAME_WORLD_MOVE;
if (padMoveInGameUnit > 0.0f) {
m_fRotationDest = CGeneral::LimitRadianAngle(TheCamera.Orientation);
m_fMoveSpeed = min(padMoveInGameUnit, 0.07f * CTimer::GetTimeStep() + m_fMoveSpeed);
@ -710,9 +710,9 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed)
&& padUsed->JumpJustDown() && m_nPedState != PED_JUMP) {
ClearAttack();
ClearWeaponTarget();
if (m_bShouldEvade && m_pEvadingFrom) {
if (m_nEvadeAmount != 0 && m_pEvadingFrom) {
SetEvasiveDive((CPhysical*)m_pEvadingFrom, 1);
m_bShouldEvade = false;
m_nEvadeAmount = 0;
m_pEvadingFrom = nil;
} else {
SetJump();
@ -1066,18 +1066,364 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
m_bHasLockOnTarget = m_pPointGunAt != nil;
}
void
CPlayerPed::PlayerControlZelda(CPad *padUsed)
{
bool doSmoothSpray = DoWeaponSmoothSpray();
float camOrientation = TheCamera.Orientation;
float leftRight = padUsed->GetPedWalkLeftRight();
float upDown = padUsed->GetPedWalkUpDown();
float padMoveInGameUnit;
bool smoothSprayWithoutMove = false;
if (doSmoothSpray && upDown > 0.0f) {
padMoveInGameUnit = 0.0f;
smoothSprayWithoutMove = true;
} else {
padMoveInGameUnit = CVector2D(leftRight, upDown).Magnitude() / PAD_MOVE_TO_GAME_WORLD_MOVE;
}
if (padMoveInGameUnit > 0.0f || smoothSprayWithoutMove) {
float padHeading = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown);
float neededTurn = CGeneral::LimitRadianAngle(padHeading - camOrientation);
if (doSmoothSpray) {
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER || GetWeapon()->m_eWeaponType == WEAPONTYPE_COLT45
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_UZI)
m_fRotationDest = m_fRotationCur - leftRight / 128.0f * (PI / 80.0f) * CTimer::GetTimeStep();
else
m_fRotationDest = m_fRotationCur - leftRight / 128.0f * (PI / 128.0f) * CTimer::GetTimeStep();
} else {
m_fRotationDest = neededTurn;
}
float maxAcc = 0.07f * CTimer::GetTimeStep();
m_fMoveSpeed = min(padMoveInGameUnit, m_fMoveSpeed + maxAcc);
} else {
m_fMoveSpeed = 0.0f;
}
if (m_nPedState == PED_JUMP) {
if (bIsInTheAir) {
if (bUsesCollision && !bHitSteepSlope &&
(!bHitSomethingLastFrame || m_vecDamageNormal.z > 0.6f)
&& m_fDistanceTravelled < CTimer::GetTimeStep() * 0.02 && m_vecMoveSpeed.MagnitudeSqr() < 0.01f) {
float angleSin = Sin(m_fRotationCur); // originally sin(DEGTORAD(RADTODEG(m_fRotationCur))) o_O
float angleCos = Cos(m_fRotationCur);
ApplyMoveForce(-angleSin * 3.0f, 3.0f * angleCos, 0.05f);
}
} else if (bIsLanding) {
m_fMoveSpeed = 0.0f;
}
}
if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy)
&& padUsed->GetSprint()) {
m_nMoveState = PEDMOVE_SPRINT;
}
if (m_nPedState != PED_FIGHT)
SetRealMoveAnim();
if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy)
&& padUsed->JumpJustDown() && m_nPedState != PED_JUMP) {
ClearAttack();
ClearWeaponTarget();
if (m_nEvadeAmount != 0 && m_pEvadingFrom) {
SetEvasiveDive((CPhysical*)m_pEvadingFrom, 1);
m_nEvadeAmount = 0;
m_pEvadingFrom = nil;
} else {
SetJump();
}
}
}
void
CPlayerPed::ProcessControl(void)
{
if (m_nEvadeAmount != 0)
--m_nEvadeAmount;
if (m_nEvadeAmount == 0)
m_pEvadingFrom = nil;
if (m_pCurrentPhysSurface && m_pCurrentPhysSurface->IsVehicle() && ((CVehicle*)m_pCurrentPhysSurface)->IsBoat()) {
bTryingToReachDryLand = true;
} else if (!(((uint8)CTimer::GetFrameCounter() + m_randomSeed) & 0xF)) {
CVehicle *nearVeh = (CVehicle*)CWorld::TestSphereAgainstWorld(GetPosition(), 7.0f, nil,
false, true, false, false, false, false);
if (nearVeh && nearVeh->IsBoat())
bTryingToReachDryLand = true;
else
bTryingToReachDryLand = false;
}
CPed::ProcessControl();
if (bWasPostponed)
return;
CPad *padUsed = CPad::GetPad(0);
m_pWanted->Update();
CEntity::PruneReferences();
if (m_nMoveState != PEDMOVE_RUN && m_nMoveState != PEDMOVE_SPRINT)
RestoreSprintEnergy(1.0f);
else if (m_nMoveState == PEDMOVE_RUN)
RestoreSprintEnergy(0.3f);
if (m_nPedState == PED_DEAD) {
ClearWeaponTarget();
return;
}
if (m_nPedState == PED_DIE) {
ClearWeaponTarget();
if (CTimer::GetTimeInMilliseconds() > (uint32)m_bloodyFootprintCount + 4000)
SetDead();
return;
}
if (m_nPedState == PED_DRIVING && m_objective != OBJECTIVE_LEAVE_VEHICLE) {
if (m_pMyVehicle->IsCar() && ((CAutomobile*)m_pMyVehicle)->Damage.GetDoorStatus(DOOR_FRONT_LEFT) == DOOR_STATUS_SWINGING) {
CAnimBlendAssociation *rollDoorAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLDOOR);
if (!rollDoorAssoc) {
rollDoorAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLDOOR_LOW);
}
// These comparisons are wrong, they return uint16
if (m_pMyVehicle->m_nGettingOutFlags & CAR_DOOR_FLAG_LF || rollDoorAssoc || padUsed
&& (padUsed->GetAccelerate() != 0.0f || padUsed->GetSteeringLeftRight() != 0.0f
|| padUsed->GetBrake() != 0.0f)) {
if (rollDoorAssoc)
m_pMyVehicle->ProcessOpenDoor(CAR_DOOR_LF, ANIM_CAR_ROLLDOOR, rollDoorAssoc->currentTime);
} else {
m_pMyVehicle->m_nGettingOutFlags |= CAR_DOOR_FLAG_LF;
if (m_pMyVehicle->bLowVehicle)
rollDoorAssoc = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ROLLDOOR_LOW);
else
rollDoorAssoc = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ROLLDOOR);
rollDoorAssoc->SetFinishCallback(PedAnimDoorCloseRollingCB, this);
}
}
return;
}
if (m_objective == OBJECTIVE_NONE)
m_nMoveState = PEDMOVE_STILL;
if (bIsLanding)
RunningLand(padUsed);
if (padUsed && padUsed->WeaponJustDown() && m_nPedState != PED_SNIPER_MODE) {
// ...Really?
eWeaponType playerWeapon = FindPlayerPed()->GetWeapon()->m_eWeaponType;
if (playerWeapon == WEAPONTYPE_SNIPERRIFLE) {
DMAudio.PlayFrontEndSound(SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM, 0);
} else if (playerWeapon == WEAPONTYPE_ROCKETLAUNCHER) {
DMAudio.PlayFrontEndSound(SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM, 0);
}
}
switch (m_nPedState) {
case PED_NONE:
case PED_IDLE:
case PED_FLEE_POS:
case PED_FLEE_ENTITY:
case PED_ATTACK:
case PED_FIGHT:
case PED_AIM_GUN:
if (!RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_FLAG400)) {
if (TheCamera.Cams[0].Using3rdPersonMouseCam()) {
if (padUsed)
PlayerControl1stPersonRunAround(padUsed);
} else if (m_nPedState == PED_FIGHT) {
if (padUsed)
PlayerControlFighter(padUsed);
} else if (padUsed) {
PlayerControlZelda(padUsed);
}
}
if (IsPedInControl() && padUsed)
ProcessPlayerWeapon(padUsed);
break;
case PED_LOOK_ENTITY:
case PED_LOOK_HEADING:
case PED_WANDER_RANGE:
case PED_WANDER_PATH:
case PED_PURSUE:
case PED_FOLLOW_PATH:
case PED_ROCKET_ODE:
case PED_DUMMY:
case PED_PAUSE:
case PED_FACE_PHONE:
case PED_MAKE_CALL:
case PED_CHAT:
case PED_MUG:
case PED_AI_CONTROL:
case PED_FOLLOW_ROUTE:
case PED_CPR:
case PED_SOLICIT:
case PED_BUY_ICECREAM:
case PED_INVESTIGATE:
case PED_STEP_AWAY:
case PED_ON_FIRE:
case PED_UNKNOWN:
case PED_STATES_NO_AI:
case PED_STAGGER:
case PED_DIVE_AWAY:
case PED_STATES_NO_ST:
case PED_ARREST_PLAYER:
case PED_DRIVING:
case PED_PASSENGER:
case PED_TAXI_PASSENGER:
case PED_OPEN_DOOR:
case PED_DIE:
case PED_DEAD:
case PED_HANDS_UP:
break;
case PED_SEEK_ENTITY:
m_vecSeekPos = m_pSeekTarget->GetPosition();
// fall through
case PED_SEEK_POS:
switch (m_nMoveState) {
case PEDMOVE_STILL:
m_fMoveSpeed = 1.0f;
break;
case PEDMOVE_RUN:
m_fMoveSpeed = 1.8f;
break;
case PEDMOVE_SPRINT:
m_fMoveSpeed = 2.5f;
break;
default:
m_fMoveSpeed = 0.0f;
break;
}
SetRealMoveAnim();
if (Seek()) {
RestorePreviousState();
SetMoveState(PEDMOVE_STILL);
}
break;
case PED_SNIPER_MODE:
if (FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_M16) {
if (padUsed)
PlayerControlM16(padUsed);
} else if (padUsed) {
PlayerControlSniper(padUsed);
}
break;
case PED_SEEK_CAR:
case PED_SEEK_IN_BOAT:
if (bVehEnterDoorIsBlocked || bKindaStayInSamePlace) {
m_fMoveSpeed = 0.0f;
} else {
m_fMoveSpeed = min(2.0f, 2.0f * (m_vecSeekPos - GetPosition()).Magnitude2D());
}
if (padUsed && !padUsed->ArePlayerControlsDisabled()) {
if (padUsed->GetTarget() || padUsed->GetLeftStickXJustDown() || padUsed->GetLeftStickYJustDown() ||
padUsed->GetDPadUpJustDown() || padUsed->GetDPadDownJustDown() || padUsed->GetDPadLeftJustDown() ||
padUsed->GetDPadRightJustDown()) {
RestorePreviousState();
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
RestorePreviousObjective();
}
}
}
if (padUsed && padUsed->GetSprint())
m_nMoveState = PEDMOVE_SPRINT;
SetRealMoveAnim();
break;
case PED_JUMP:
if (padUsed)
PlayerControlZelda(padUsed);
if (bIsLanding)
break;
// This has been added later it seems
return;
case PED_FALL:
case PED_GETUP:
case PED_ENTER_TRAIN:
case PED_EXIT_TRAIN:
case PED_CARJACK:
case PED_DRAG_FROM_CAR:
case PED_ENTER_CAR:
case PED_STEAL_CAR:
case PED_EXIT_CAR:
ClearWeaponTarget();
break;
case PED_ARRESTED:
if (m_nLastPedState == PED_DRAG_FROM_CAR && m_pVehicleAnim)
BeingDraggedFromCar();
break;
}
if (padUsed && IsPedShootable()) {
ProcessWeaponSwitch(padUsed);
GetWeapon()->Update(m_audioEntityId);
}
ProcessAnimGroups();
if (padUsed) {
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FOLLOWPED
&& TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_BEHIND) {
m_lookTimer = 0;
float camAngle = CGeneral::LimitRadianAngle(TheCamera.Cams[TheCamera.ActiveCam].Front.Heading());
float angleBetweenPlayerAndCam = Abs(camAngle - m_fRotationCur);
if (m_nPedState != PED_ATTACK
&& angleBetweenPlayerAndCam > DEGTORAD(30.0f) && angleBetweenPlayerAndCam < DEGTORAD(330.0f)) {
if (angleBetweenPlayerAndCam > DEGTORAD(150.0f) && angleBetweenPlayerAndCam < DEGTORAD(210.0f)) {
float rightTurnAngle = CGeneral::LimitRadianAngle(m_fRotationCur - DEGTORAD(150.0f));
float leftTurnAngle = CGeneral::LimitRadianAngle(DEGTORAD(150.0f) + m_fRotationCur);
if (m_fLookDirection != 999999.0f) {
if (Abs(rightTurnAngle - m_fLookDirection) < Abs(leftTurnAngle - m_fLookDirection))
camAngle = rightTurnAngle;
else
camAngle = leftTurnAngle;
} else {
camAngle = rightTurnAngle;
}
}
SetLookFlag(camAngle, true);
SetLookTimer(CTimer::GetTimeStepInMilliseconds() * 5.0f);
} else {
ClearLookFlag();
}
}
}
if (m_nMoveState == PEDMOVE_SPRINT && bIsLooking) {
ClearLookFlag();
SetLookTimer(250);
}
if (m_vecMoveSpeed.Magnitude2D() < 0.1f) {
if (m_nSpeedTimer) {
if (CTimer::GetTimeInMilliseconds() > m_nSpeedTimer)
m_bSpeedTimerFlag = true;
} else {
m_nSpeedTimer = CTimer::GetTimeInMilliseconds() + 500;
}
} else {
m_nSpeedTimer = 0;
m_bSpeedTimerFlag = false;
}
}
class CPlayerPed_ : public CPlayerPed
{
public:
CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); }
void dtor(void) { CPlayerPed::~CPlayerPed(); }
void SetMoveAnim_(void) { CPlayerPed::SetMoveAnim(); }
void ProcessControl_(void) { CPlayerPed::ProcessControl(); }
};
STARTPATCHES
InjectHook(0x4EF7E0, &CPlayerPed_::ctor, PATCH_JUMP);
InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP);
InjectHook(0x4F3760, &CPlayerPed_::SetMoveAnim_, PATCH_JUMP);
InjectHook(0x4EFD90, &CPlayerPed_::ProcessControl_, PATCH_JUMP);
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
InjectHook(0x4F3700, &CPlayerPed::AnnoyPlayerPed, PATCH_JUMP);
InjectHook(0x4F36C0, &CPlayerPed::GetPlayerInfoForThisPlayerPed, PATCH_JUMP);

View file

@ -15,9 +15,9 @@ public:
float m_fStaminaProgress;
int8 m_nSelectedWepSlot; // eWeaponType
bool m_bSpeedTimerFlag;
bool m_bShouldEvade;
uint8 m_nEvadeAmount;
int8 field_1367;
int32 m_nSpeedTimer;
uint32 m_nSpeedTimer;
int32 m_nShotDelay;
float field_1376; // m_fAttackButtonCounter?
bool m_bHaveTargetSelected; // may have better name
@ -75,6 +75,7 @@ public:
bool FindWeaponLockOnTarget(void);
void ProcessAnimGroups(void);
void ProcessPlayerWeapon(CPad*);
void PlayerControlZelda(CPad*);
static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32);

View file

@ -413,7 +413,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
// Make sure our atomic uses the right geometry and not
// that of an atomic for another draw distance.
if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj))
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), 0);
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?)
mi->IncreaseAlpha();
if(ent->m_rwObject == nil || !ent->bIsVisible)
return VIS_INVISIBLE;
@ -463,7 +463,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
assert(ent->m_rwObject);
RpAtomic *rwobj = (RpAtomic*)ent->m_rwObject;
if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj))
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), 0);
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?)
mi->IncreaseAlpha();
if(ent->m_rwObject == nil || !ent->bIsVisible)
return VIS_INVISIBLE;
@ -528,7 +528,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
// Make sure our atomic uses the right geometry and not
// that of an atomic for another draw distance.
if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj))
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), 0);
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?)
if(!ent->IsVisibleComplex())
return 0;
if(mi->m_drawLast){
@ -558,7 +558,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
assert(ent->m_rwObject);
RpAtomic *rwobj = (RpAtomic*)ent->m_rwObject;
if(RpAtomicGetGeometry(a) != RpAtomicGetGeometry(rwobj))
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), 0);
RpAtomicSetGeometry(rwobj, RpAtomicGetGeometry(a), rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?)
if(ent->IsVisibleComplex())
CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist);
return 0;

View file

@ -44,7 +44,7 @@ CVisibilityPlugins::Initialise(void)
m_alphaList.Init(20);
m_alphaList.head.item.sort = 0.0f;
m_alphaList.tail.item.sort = 100000000.0f;
m_alphaEntityList.Init(350); // TODO: set back to 150 when things are fixed
m_alphaEntityList.Init(150);
m_alphaEntityList.head.item.sort = 0.0f;
m_alphaEntityList.tail.item.sort = 100000000.0f;
}
@ -248,7 +248,7 @@ CVisibilityPlugins::RenderFadingAtomic(RpAtomic *atomic, float camdist)
RpGeometrySetFlags(geo, flags | rpGEOMETRYMODULATEMATERIALCOLOR);
RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)alpha);
if(geo != RpAtomicGetGeometry(atomic))
RpAtomicSetGeometry(atomic, geo, 0);
RpAtomicSetGeometry(atomic, geo, rpATOMICSAMEBOUNDINGSPHERE); // originally 5 (mistake?)
AtomicDefaultRenderCallBack(atomic);
RpGeometryForAllMaterials(geo, SetAlphaCB, (void*)255);
RpGeometrySetFlags(geo, flags);

View file

@ -28,8 +28,6 @@ char SaveFileNameJustSaved[260];
int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C;
CDate &CompileDateAndTime = *(CDate*)0x72BCB8;
C_PcSave &PcSaveHelper = *(C_PcSave*)0x8E2C60;
#define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to));
#define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from));

View file

@ -34,5 +34,4 @@ extern int (&Slots)[SLOT_COUNT+1];
extern char SaveFileNameJustSaved[260]; // 8F2570
const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET";
extern C_PcSave &PcSaveHelper;
const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET";

View file

@ -8,6 +8,8 @@
const char* _psGetUserFilesFolder();
C_PcSave &PcSaveHelper = *(C_PcSave*)0x8E2C60;
void
C_PcSave::SetSaveDirectory(const char *path)
{

View file

@ -36,3 +36,5 @@ public:
bool PcClassSaveRoutine(int32 a2, uint8 *data, uint32 size);
static void SetSaveDirectory(const char *path);
};
extern C_PcSave &PcSaveHelper;

View file

@ -2134,7 +2134,7 @@ _WinMain(HINSTANCE instance,
CPad::ResetCheats();
CPad::StopPadsShaking();
DMAudio.ChangeMusicMode(MUSICMODE_OFF);
DMAudio.ChangeMusicMode(MUSICMODE_DISABLE);
CTimer::Stop();

View file

@ -3885,6 +3885,9 @@ CAutomobile::IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset)
}
CVector dist = doorPos - seatPos;
// Removing that makes this func. return false for van doors.
doorPos.z += 0.5f;
float length = dist.Magnitude();
CVector pedPos = seatPos + dist*((length+0.6f)/length);
@ -4193,6 +4196,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data)
}
CColPoint aTempPedColPts[32]; // this name doesn't make any sense
// they probably copied it from Ped (both serves same purpose) and didn't change the name
CObject*
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)