Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-09-13 12:06:44 +03:00
commit 084efb1f14
22 changed files with 1444 additions and 762 deletions

View file

@ -657,7 +657,7 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
for (int i = CPools::GetBuildingPool()->GetSize() - 1; i >= 0; i--) {
CBuilding* pBuilding = CPools::GetBuildingPool()->GetSlot(i);
if (pBuilding && pBuilding->GetClump() != nil && pBuilding->bIsBIGBuilding && pBuilding->bStreamBIGBuilding) {
if (pBuilding && pBuilding->m_rwObject != nil && pBuilding->bIsBIGBuilding && pBuilding->bStreamBIGBuilding) {
if (pBuilding->bIsBIGBuilding)
CStreaming::RequestModel(pBuilding->GetModelIndex(), 0);
if (!pBuilding->bImBeingRendered)

View file

@ -57,4 +57,5 @@ public:
static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame);
static void AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int frame);
static void RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
static void DisableCutsceneShadows() { ms_useCutsceneShadows = false; }
};

View file

@ -293,6 +293,18 @@ cAudioManager::CalculateDistance(bool &distCalculated, float dist)
}
}
CVehicle *cAudioManager::FindVehicleOfPlayer()
{
CVehicle* vehicle = FindPlayerVehicle();
CPlayerPed* ped = FindPlayerPed();
if (vehicle == nil && ped != nil) {
CEntity *attachedTo = ped->m_attachedTo;
if (attachedTo && attachedTo->IsVehicle())
vehicle = (CVehicle*)attachedTo;
}
return vehicle;
}
void
cAudioManager::ProcessSpecial()
{
@ -3815,6 +3827,25 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
}
}
void
cAudioManager::SetPedTalkingStatus(CPed *ped, uint8 status)
{
if (ped != nil)
ped->m_canTalk = status;
}
void
cAudioManager::SetPlayersMood(uint8 mood, int32 time)
{
if (!m_bIsInitialised) return;
if (mood < MAX_PLAYER_MOODS) {
m_nPlayerMood = mood;
m_nPlayerMoodTimer = CTimer::GetTimeInMilliseconds() + time;
}
}
void
cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
{

View file

@ -216,6 +216,12 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
}
}
void
cAudioManager::SetMP3BoostVolume(uint8 volume) const
{
SampleManager.SetMP3BoostVolume(volume);
}
void
cAudioManager::SetEffectsMasterVolume(uint8 volume) const
{
@ -336,6 +342,15 @@ cAudioManager::GetCurrent3DProviderIndex() const
return -1;
}
int8
cAudioManager::AutoDetect3DProviders() const
{
if (m_bIsInitialised)
return SampleManager.AutoDetect3DProviders();
return -1;
}
int8
cAudioManager::SetCurrent3DProvider(uint8 which)
{
@ -420,6 +435,7 @@ cAudioManager::IsAudioInitialised() const
void
cAudioManager::ServiceSoundEffects()
{
field_5554++;
m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
if (m_nUserPause && !m_nPreviousUserPause) {
for (int32 i = 0; i < allChannels; i++)

View file

@ -196,9 +196,9 @@ public:
cAudioScriptObjectManager m_sAudioScriptObjectManager;
// miami
uint8 field_4B30;
uint8 m_bPlayerMood;
uint32 field_4B34;
uint8 m_bIsPlayerShutUp;
uint8 m_nPlayerMood;
uint32 m_nPlayerMoodTimer;
uint8 field_rest[4];
uint8 field_4B3C;
@ -269,6 +269,7 @@ public:
char *Get3DProviderName(uint8 id) const;
uint8 GetCDAudioDriveLetter() const;
int8 GetCurrent3DProviderIndex() const;
int8 AutoDetect3DProviders() const;
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
float GetCollisionOneShotRatio(int32 a, float b) const;
float GetCollisionRatio(float a, float b, float c, float d) const;
@ -386,6 +387,7 @@ public:
void SetDynamicAcousticModelingStatus(uint8 status);
void SetEffectsFadeVol(uint8 volume) const;
void SetEffectsMasterVolume(uint8 volume) const;
void SetMP3BoostVolume(uint8 volume) const;
void SetEntityStatus(int32 id, uint8 status);
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
@ -414,6 +416,10 @@ public:
bool UsesSiren(int32 model) const;
bool UsesSirenSwitching(int32 model) const;
CVehicle *FindVehicleOfPlayer();
void SetPedTalkingStatus(CPed *ped, uint8 status);
void SetPlayersMood(uint8 mood, int32 time);
#ifdef GTA_PC
// only used in pc
void AdjustSamplesVolume();

View file

@ -64,6 +64,15 @@ cDMAudio::SetMonoMode(uint8 mono)
AudioManager.SetMonoMode(mono);
}
void
cDMAudio::SetMP3BoostVolume(uint8 volume)
{
uint8 vol = volume;
if (vol > MAX_VOLUME) vol = MAX_VOLUME;
AudioManager.SetMP3BoostVolume(vol);
}
void
cDMAudio::SetEffectsMasterVolume(uint8 volume)
{
@ -112,70 +121,9 @@ cDMAudio::Get3DProviderName(uint8 id)
return AudioManager.Get3DProviderName(id);
}
// TODO(Miami): Content of this moved to cSampleManager or cAudioManager
int8 cDMAudio::AutoDetect3DProviders(void)
{
if (!AudioManager.IsAudioInitialised())
return -1;
int eax = -1, eax2 = -1, eax3 = -1, ds3dh = -1, ds3ds = -1;
for ( int32 i = 0; i < GetNum3DProvidersAvailable(); i++ )
{
char *providername = Get3DProviderName(i);
strupr(providername);
#if defined(AUDIO_OAL)
if (!strcmp(providername, "OPENAL SOFT")) {
SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
return i;
}
#else
if (!strcmp(providername, "CREATIVE LABS EAX 3 (TM)")) {
SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i) {
eax3 = i;
}
}
if (!strcmp(providername, "CREATIVE LABS EAX 2 (TM)")) {
SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
eax2 = i;
}
if (!strcmp(providername, "CREATIVE LABS EAX (TM)")) {
SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
eax = i;
}
if (!strcmp(providername, "DIRECTSOUND3D HARDWARE SUPPORT")) {
SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
ds3dh = i;
}
if (!strcmp(providername, "DIRECTSOUND3D SOFTWARE EMULATION")) {
SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
ds3ds = i;
}
#endif
}
if (eax3 != -1)
return eax3;
if (eax2 != -1)
return eax2;
if (eax != -1)
return eax;
if (ds3dh != -1)
return ds3dh;
if (ds3ds != -1)
return ds3ds;
return -1;
return AudioManager.AutoDetect3DProviders();
}
int8
@ -392,3 +340,45 @@ cDMAudio::SetRadioChannel(int8 radio, int32 pos)
{
MusicManager.SetRadioChannelByScript(radio, pos);
}
void
cDMAudio::SetStartingTrackPositions(uint8 isStartGame)
{
MusicManager.SetStartingTrackPositions(isStartGame);
}
float *
cDMAudio::GetListenTimeArray()
{
return MusicManager.GetListenTimeArray();
}
uint32
cDMAudio::GetFavouriteRadioStation()
{
return MusicManager.GetFavouriteRadioStation();
}
int32
cDMAudio::GetRadioPosition(uint32 station)
{
return MusicManager.GetRadioPosition(station);
}
void
cDMAudio::SetPedTalkingStatus(CPed *ped, uint8 status)
{
return AudioManager.SetPedTalkingStatus(ped, status);
}
void
cDMAudio::SetPlayersMood(uint8 mood, int32 time)
{
return AudioManager.SetPlayersMood(mood, time);
}
void
cDMAudio::ShutUpPlayerTalking(uint8 state)
{
AudioManager.m_bIsPlayerShutUp = state;
}

View file

@ -30,6 +30,7 @@ public:
void DestroyAllGameCreatedEntities(void);
void SetMonoMode(uint8 mono);
void SetMP3BoostVolume(uint8 volume);
void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume);
@ -90,5 +91,13 @@ public:
uint8 GetRadioInCar(void);
void SetRadioInCar(uint32 radio);
void SetRadioChannel(int8 radio, int32 pos);
void SetStartingTrackPositions(uint8 isStartGame);
float *GetListenTimeArray();
uint32 GetFavouriteRadioStation();
int32 GetRadioPosition(uint32 station);
void SetPedTalkingStatus(class CPed *ped, uint8 status);
void SetPlayersMood(uint8 mood, int32 time);
void ShutUpPlayerTalking(uint8 state);
};
extern cDMAudio DMAudio;

File diff suppressed because it is too large Load diff

View file

@ -11,41 +11,53 @@ public:
};
class CVehicle;
class CPed;
class cMusicManager
{
public:
bool m_bIsInitialised;
bool m_bDisabled;
uint8 m_nMusicMode;
uint32 m_nCurrentStreamedSound;
uint32 m_nPreviousStreamedSound;
bool m_bFrontendTrackFinished;
bool m_bPlayInFrontend;
bool m_bSetNextStation;
bool field_2;
uint8 m_nVolumeLatency;
uint8 m_nCurrentVolume;
uint8 m_nMaxVolume;
uint32 m_nAnnouncement;
bool m_bPreviousPlayerInCar;
bool m_bPlayerInCar;
bool m_bAnnouncementInProgress;
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;
uint32 m_nRadioStation;
int32 m_nRadioPosition;
uint8 m_nRadioStation;
uint32 m_nRadioPosition;
uint32 m_nRadioInCar;
uint32 m_nFrontendTrack;
uint32 m_nPlayingTrack;
uint8 m_nUpcomingMusicMode;
uint8 m_nMusicMode;
bool field_398E;
bool field_398F;
uint32 m_nStreamedTrack;
bool field_3994;
bool field_3995;
bool field_3996;
bool field_3997;
int8 field_3998;
bool field_3999;
bool field_399A;
uint8 m_nMusicModeToBeSet;
bool field_399C;
float aListenTimeArray[NUM_RADIOS];
float m_nLastTrackServiceTime;
public:
cMusicManager();
bool IsInitialised() { return m_bIsInitialised; }
uint32 GetMusicMode() { return m_nMusicMode; }
uint8 GetCurrentTrack() { return m_nCurrentStreamedSound; }
uint8 GetMusicMode() { return m_nMusicMode; }
uint32 GetCurrentTrack() { return m_nPlayingTrack; }
void ResetMusicAfterReload();
void SetStartingTrackPositions(uint8 isNewGameTimer);
bool Initialise();
void Terminate();
@ -60,21 +72,20 @@ public:
void PreloadCutSceneMusic(uint32);
void PlayPreloadedCutSceneMusic(void);
void StopCutSceneMusic(void);
uint8 GetRadioInCar(void);
uint32 GetRadioInCar(void);
void SetRadioInCar(uint32);
void SetRadioChannelByScript(uint8, int32);
void ResetMusicAfterReload();
void SetRadioChannelByScript(uint32, int32);
void ResetTimers(int32);
void Service();
void ServiceFrontEndMode();
void ServiceGameMode();
void ServiceAmbience();
void ServiceTrack();
void ServiceTrack(CVehicle *veh, CPed *ped);
bool UsesPoliceRadio(CVehicle *veh);
uint32 GetTrackStartPos(uint8);
bool UsesTaxiRadio(CVehicle *veh);
uint32 GetTrackStartPos(uint32 track);
void ComputeAmbienceVol(uint8 reset, uint8& outVolume);
bool ServiceAnnouncement();
@ -82,8 +93,21 @@ public:
uint32 GetCarTuning();
uint32 GetNextCarTuning();
bool ChangeRadioChannel();
void RecordRadioStats();
void SetUpCorrectAmbienceTrack();
float *GetListenTimeArray();
uint32 GetRadioPosition(uint32 station);
uint32 GetFavouriteRadioStation();
void SetMalibuClubTrackPos(uint8 pos);
void SetStripClubTrackPos(uint8 pos);
bool CheckForMusicInterruptions();
void Enable();
void Disable();
};
VALIDATE_SIZE(cMusicManager, 0x95C);
extern cMusicManager MusicManager;
extern bool g_bAnnouncementReadPosAlready; // we have a symbol of this so it was declared in .h
float GetHeightScale();

View file

@ -27,6 +27,15 @@ enum eMusicMode
MUSICMODE_DISABLED,
};
enum ePlayerMood
{
PLAYER_MOOD_CALM = 0,
PLAYER_MOOD_PISSED_OFF,
PLAYER_MOOD_ANGRY,
PLAYER_MOOD_WISECRACKING,
MAX_PLAYER_MOODS,
};
enum eStreamedSounds
{
STREAMED_SOUND_RADIO_WILD,
@ -1254,7 +1263,7 @@ enum eStreamedSounds
STREAMED_SOUND_MISSION_BUST_27,
STREAMED_SOUND_MISSION_BUST_28,
TOTAL_STREAMED_SOUNDS,
NO_STREAMED_SOUND,
NO_TRACK,
};
enum AudioEntityHandle {

View file

@ -117,15 +117,19 @@ class cSampleManager
{
uint8 m_nEffectsVolume;
uint8 m_nMusicVolume;
uint8 m_nMP3BoostVolume;
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];
char m_MiscomPath[260];
char m_SfxPath[260];
char m_StreamedAudioPath[188];
void *m_aChannels[18];
public:
@ -145,6 +149,8 @@ public:
int8 GetCurrent3DProviderIndex(void);
int8 SetCurrent3DProvider(uint8 which);
int8 AutoDetect3DProviders();
bool IsMP3RadioChannelAvailable(void);
@ -165,6 +171,7 @@ public:
void SetEffectsMasterVolume(uint8 nVolume);
void SetMusicMasterVolume (uint8 nVolume);
void SetMP3BoostVolume (uint8 nVolume);
void SetEffectsFadeVolume (uint8 nVolume);
void SetMusicFadeVolume (uint8 nVolume);
void SetMonoMode (uint8 nMode);
@ -213,6 +220,9 @@ public:
void Service(void);
#endif
bool InitialiseSampleBanks(void);
uint8 GetMusicVolume() const { return m_nMusicVolume; }
void SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nStream);
};
extern cSampleManager SampleManager;

View file

@ -61,6 +61,7 @@ char _mp3DirectoryPath[MAX_PATH];
HSTREAM mp3Stream [MAX_STREAMS];
int8 nStreamPan [MAX_STREAMS];
int8 nStreamVolume[MAX_STREAMS];
uint8 nStreamLoopedFlag[MAX_STREAMS];
uint32 _CurMP3Index;
int32 _CurMP3Pos;
bool _bIsMp3Active;
@ -407,6 +408,63 @@ cSampleManager::SetCurrent3DProvider(uint8 nProvider)
return curprovider;
}
int8
cSampleManager::AutoDetect3DProviders()
{
if (!AudioManager.IsAudioInitialised())
return -1;
int eax = -1, eax2 = -1, eax3 = -1, ds3dh = -1, ds3ds = -1;
for (uint32 i = 0; i < GetNum3DProvidersAvailable(); i++)
{
char* providername = Get3DProviderName(i);
if (!strcasecmp(providername, "CREATIVE LABS EAX (TM)")) {
AudioManager.SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
eax = i;
}
if (!strcasecmp(providername, "CREATIVE LABS EAX 2 (TM)")) {
AudioManager.SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
eax2 = i;
}
if (!strcasecmp(providername, "CREATIVE LABS EAX 3 (TM)")) {
AudioManager.SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i) {
eax3 = i;
}
}
if (!strcasecmp(providername, "DIRECTSOUND3D HARDWARE SUPPORT")) {
AudioManager.SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
ds3dh = i;
}
if (!strcasecmp(providername, "DIRECTSOUND3D SOFTWARE EMULATION")) {
AudioManager.SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
ds3ds = i;
}
}
if (eax3 != -1)
return eax3;
if (eax2 != -1)
return eax2;
if (eax != -1)
return eax;
if (ds3dh != -1)
return ds3dh;
if (ds3ds != -1)
return ds3ds;
return -1;
}
static bool
_ResolveLink(char const *path, char *out)
{
@ -1455,6 +1513,12 @@ cSampleManager::SetMusicMasterVolume(uint8 nVolume)
m_nMusicVolume = nVolume;
}
void
cSampleManager::SetMP3BoostVolume(uint8 nVolume)
{
m_nMP3BoostVolume = nVolume;
}
void
cSampleManager::SetEffectsFadeVolume(uint8 nVolume)
{
@ -2132,7 +2196,8 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
AIL_open_stream(DIG, filename, 0);
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(
mp3Stream[nStream], 1);
mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
nStreamLoopedFlag[nStream] = true;
AIL_set_stream_ms_position(
mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream],
@ -2387,4 +2452,12 @@ cSampleManager::InitialiseSampleBanks(void)
return true;
}
void
cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel)
{
if (m_bInitialised)
nStreamLoopedFlag[nChannel] = nLoopFlag;
}
#endif

View file

@ -113,6 +113,11 @@ cSampleManager::SetMusicMasterVolume(uint8 nVolume)
{
}
void
cSampleManager::SetMusicMasterVolume(uint8 nVolume)
{
}
void
cSampleManager::SetEffectsFadeVolume(uint8 nVolume)
{
@ -365,4 +370,14 @@ cSampleManager::InitialiseSampleBanks(void)
return true;
}
void
cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel)
{
}
int8 cSampleManager::AutoDetect3DProviders()
{
return -1;
}
#endif

View file

@ -131,6 +131,7 @@ uint32 nNumMP3s;
CStream *aStream[MAX_STREAMS];
uint8 nStreamPan [MAX_STREAMS];
uint8 nStreamVolume[MAX_STREAMS];
uint8 nStreamLoopedFlag[MAX_STREAMS];
///////////////////////////////////////////////////////////////
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
@ -468,6 +469,38 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
return curprovider;
}
int8
cSampleManager::AutoDetect3DProviders()
{
if (!AudioManager.IsAudioInitialised())
return -1;
int eax = -1, eax2 = -1, eax3 = -1, ds3dh = -1, ds3ds = -1;
for (uint32 i = 0; i < GetNum3DProvidersAvailable(); i++)
{
char* providername = Get3DProviderName(i);
if (!strcasecmp(providername, "OPENAL SOFT")) {
SetCurrent3DProvider(i);
if (GetCurrent3DProviderIndex() == i)
return i;
}
}
if (eax3 != -1)
return eax3;
if (eax2 != -1)
return eax2;
if (eax != -1)
return eax;
if (ds3dh != -1)
return ds3dh;
if (ds3ds != -1)
return ds3ds;
return -1;
}
bool
cSampleManager::IsMP3RadioChannelAvailable(void)
{
@ -729,6 +762,12 @@ cSampleManager::SetMusicMasterVolume(uint8 nVolume)
m_nMusicVolume = nVolume;
}
void
cSampleManager::SetMP3BoostVolume(uint8 nVolume)
{
m_nMP3BoostVolume = nVolume;
}
void
cSampleManager::SetEffectsFadeVolume(uint8 nVolume)
{
@ -1468,4 +1507,11 @@ cSampleManager::InitialiseSampleBanks(void)
return true;
}
void
cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel)
{
if (m_bInitialised)
nStreamLoopedFlag[nChannel] = nLoopFlag;
}
#endif

View file

@ -252,12 +252,15 @@ enum eScriptSounds : uint16 {
SCRIPT_SOUND_SAWMILL_LOOP_L,
SCRIPT_SOUND_38,
SCRIPT_SOUND_39,
SCRIPT_SOUND_LAUNDERETTE_LOOP_S,
SCRIPT_SOUND_LAUNDERETTE_LOOP_L,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_S,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_L,
SCRIPT_SOUND_CIPRIANI_RESAURANT_S,
SCRIPT_SOUND_CIPRIANI_RESAURANT_L,
// MIAMI: only these are true so far
SCRIPT_SOUND_MALIBU_1,
SCRIPT_SOUND_MALIBU_2,
SCRIPT_SOUND_MALIBU_3,
SCRIPT_SOUND_STRIPCLUB_1,
SCRIPT_SOUND_STRIPCLUB_2,
SCRIPT_SOUND_STRIPCLUB_3,
SCRIPT_SOUND_46_S,
SCRIPT_SOUND_47_L,
SCRIPT_SOUND_MARCO_BISTRO_S,

View file

@ -11935,7 +11935,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
return 0;
case COMMAND_SHUT_CHAR_UP:
CollectParameters(&m_nIp, 2);
debug("SHUT_CHAR_UP not implemented"); // TODO(MIAMI)
DMAudio.SetPedTalkingStatus(CPools::GetPedPool()->GetAt(ScriptParams[0]), ScriptParams[1] == 0);
return 0;
case COMMAND_SET_ENABLE_RC_DETONATE:
CollectParameters(&m_nIp, 1);
@ -12562,13 +12562,13 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_SHUT_PLAYER_UP:
{
CollectParameters(&m_nIp, 2);
debug("SHUT_PLAYER_UP is not implemented\n"); // TODO(MIAMI)
DMAudio.ShutUpPlayerTalking(!!ScriptParams[1]);
return 0;
}
case COMMAND_SET_PLAYER_MOOD:
{
CollectParameters(&m_nIp, 3);
debug("SET_PLAYER_MOOD is not implemented\n"); // TODO(MIAMI)
DMAudio.SetPlayersMood(ScriptParams[1], ScriptParams[2]);
return 0;
}
case COMMAND_REQUEST_COLLISION:
@ -13000,7 +13000,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
}
case COMMAND_DISABLE_CUTSCENE_SHADOWS:
{
debug("DISABLE_CUTSCENE_SHADOWS not implemented, skipping\n"); // TODO(MIAMI)
CCutsceneMgr::DisableCutsceneShadows();
return 0;
}
case COMMAND_HAS_GLASS_BEEN_SHATTERED_NEARBY:
@ -13185,7 +13185,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
return 0;
case COMMAND_REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE:
{
debug("REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE not implemented, skipping\n");
CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
return 0;
}
case COMMAND_IS_PLAYER_TOUCHING_VEHICLE:

View file

@ -286,12 +286,12 @@ class CTheScripts
static uint8 UseTextCommands;
static uint16 CommandsExecuted;
static uint16 ScriptsUpdated;
static uint8 RiotIntensity;
static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts;
static bool bPlayerIsInTheStatium;
public:
static uint8 RiotIntensity;
static bool bPlayerHasMetDebbieHarry;
public:
static void Init();
static void Process();

View file

@ -463,8 +463,7 @@ bool CGame::Initialise(const char* datFile)
#ifdef USE_TEXTURE_POOL
_TexturePoolsUnknown(true);
#endif
// TODO(Miami)
// DMAudio.SetStartingTrackPositions(1);
DMAudio.SetStartingTrackPositions(true);
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
return true;
}

View file

@ -4,6 +4,7 @@
#include "Text.h"
#include "World.h"
#include "Pad.h"
#include "DMAudio.h"
#include <climits>
@ -102,7 +103,7 @@ float CStats::LongestWheelieDist;
float CStats::LongestStoppieDist;
float CStats::Longest2WheelDist;
// --MIAMI: functions below are done except TODOs, but there are some to be moved from Frontend
// --MIAMI: functions below are done, but there are some to be moved from Frontend
void CStats::Init()
{
@ -198,9 +199,7 @@ void CStats::Init()
NoMoreHurricanes = 0;
ShowChaseStatOnScreen = 0;
abSonyCDs[0] = 0;
// TODO(Miami): Change this with PopulateFavoriteRadioStationList(); !!
for (int i = 0; i < NUM_RADIOS; i++)
FavoriteRadioStationList[i] = 0.0f;
PopulateFavoriteRadioStationList();
NumPropertyOwned = 0;
for (int i = 0; i < TOTAL_PROPERTIES; i++)
@ -471,6 +470,11 @@ void CStats::AddPropertyAsOwned(int32 id)
}
}
float CStats::GetFavoriteRadioStationList(int32 station)
{
return FavoriteRadioStationList[station];
}
void CStats::SaveStats(uint8 *buf, uint32 *size)
{
CheckPointReachedSuccessfully();
@ -652,7 +656,7 @@ void CStats::SaveStats(uint8 *buf, uint32 *size)
CopyToBuf(buf, TotalLegitimateKills);
CopyToBuf(buf, LastMissionPassedName);
CopyToBuf(buf, CheatedCount);
// TODO(Miami): Set favourite radio stations!!
PopulateFavoriteRadioStationList();
CopyToBuf(buf, FavoriteRadioStationList);
assert(buf - buf_start == *size);
@ -757,3 +761,11 @@ void CStats::LoadStats(uint8 *buf, uint32 size)
assert(buf - buf_start == size);
#undef CopyFromBuf
}
void
CStats::PopulateFavoriteRadioStationList()
{
float* pListenTimeArray = DMAudio.GetListenTimeArray();
for (int i = 0; i < NUM_RADIOS; i++)
FavoriteRadioStationList[i] = pListenTimeArray[i];
}

View file

@ -145,4 +145,6 @@ public:
static void LongestTimeInBloodRing(int32);
static void AddPropertyAsOwned(int32);
static void PopulateFavoriteRadioStationList();
static float GetFavoriteRadioStationList(int32);
};

View file

@ -41,7 +41,7 @@
#include "Fluff.h"
#define BLOCK_COUNT 20
#define SIZE_OF_SIMPLEVARS 0xD4
#define SIZE_OF_SIMPLEVARS 0xFC
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
@ -67,6 +67,28 @@ bool StillToFadeOut;
uint32 TimeStartedCountingForFade;
uint32 TimeToStayFadedBeforeFadeOut = 1750;
uint32 RadioStationPosition[NUM_RADIOS];
void
InitRadioStationPositionList()
{
for (int i = 0; i < NUM_RADIOS; i++)
RadioStationPosition[i] = 0;
}
uint32
GetSavedRadioStationPosition(int32 station)
{
return RadioStationPosition[station];
}
void
PopulateRadioStationPositionList()
{
for (int i = 0; i < NUM_RADIOS; i++)
RadioStationPosition[i] = DMAudio.GetRadioPosition(i);
}
#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));
@ -197,6 +219,8 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, CTimeCycle::m_ExtraColour);
WriteDataToBufferPointer(buf, CTimeCycle::m_bExtraColourOn);
WriteDataToBufferPointer(buf, CTimeCycle::m_ExtraColourInter);
PopulateRadioStationPositionList();
WriteDataToBufferPointer(buf, RadioStationPosition);
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
// Save scripts, block is nested within the same block as simple vars for some reason
@ -334,6 +358,7 @@ GenericLoad()
ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColour);
ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn);
ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter);
ReadDataFromBufferPointer(buf, RadioStationPosition);
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
#ifdef MISSION_REPLAY
WaitForSave = 0;

View file

@ -5,6 +5,9 @@
#define SLOT_COUNT (8)
void InitRadioStationPositionList();
uint32 GetSavedRadioStationPosition(int32 station);
void PopulateRadioStationPositionList();
bool GenericSave(int file);
bool GenericLoad();
bool ReadInSizeofSaveFileBuffer(int32 &file, uint32 &size);