ComputeDopplerEffectedFrequency

This commit is contained in:
Filip Gawin 2019-07-08 21:44:32 +02:00
parent 2c647ef228
commit a04d8f24be
14 changed files with 1385 additions and 280 deletions

View File

@ -24,6 +24,7 @@ workspace "re3"
includedirs { "src/control" }
includedirs { "src/core" }
includedirs { "src/entities" }
includedirs { "src/math" }
includedirs { "src/modelinfo" }
includedirs { "src/objects" }
includedirs { "src/peds" }

View File

@ -1,6 +1,6 @@
#pragma once
#include "math/Quaternion.h"
#include "Quaternion.h"
// TODO: put them somewhere else?
struct KeyFrame {

File diff suppressed because it is too large Load Diff

View File

@ -146,8 +146,7 @@ public:
cAudioCollision m_sQueue;
};
static_assert(sizeof(cAudioCollisionManager) == 0x354,
"cAudioCollisionManager: error");
static_assert(sizeof(cAudioCollisionManager) == 0x354, "cAudioCollisionManager: error");
class cMissionAudio
{
@ -167,6 +166,8 @@ public:
char field_31;
};
class cVehicleParams;
static_assert(sizeof(cMissionAudio) == 0x20, "cMissionAudio: error");
class cAudioManager
@ -180,7 +181,7 @@ public:
bool m_bDynamicAcousticModelingStatus;
char field_6;
char field_7;
float field_8;
float speedOfSound;
bool m_bTimerJustReset;
char field_13;
char field_14;
@ -218,17 +219,39 @@ public:
char field_19195;
int m_nTimeOfRecentCrime;
void AddSampleToRequestedQueue();
void AddDetailsToRequestedOrderList(uint8 sample);
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
uint8 unk2, bool notLooping);
void AddReflectionsToRequestedQueue();
void AddReleasingSounds(); // todo
void AddSampleToRequestedQueue();
void AgeCrimes(); // todo
int8 AutoDetect3DProviders();
void CalculateDistance(bool *ptr, float dist);
bool CheckForAnAudioFileOnCD();
void ClearMissionAudio();
void ClearRequestedQueue();
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
float speedMultiplier);
int32 ComputePan(float, CVector *); // todo
uint32 ComputeVolume(int emittingVolume, float soundIntensity, float distance);
int32 CreateEntity(int32 type, CPhysical *entity);
void DestroyAllGameCreatedEntities(); // todo, needs cAudioScriptObject
void DestroyEntity(int32 id);
void DoPoliceRadioCrackle(); // todo hook
void GenerateIntegerRandomNumberTable();
float GetDistanceSquared(CVector *v); // todo hook
// done
void Initialise();
void PostInitialiseGameSpecificSetup();
void InitialisePoliceRadioZones(); // @todo
void ResetAudioLogicTimers(int32 timer); // @todo
void InitialisePoliceRadioZones(); // todo
void ResetAudioLogicTimers(int32 timer); // todo
void Terminate();
@ -236,7 +259,6 @@ public:
bool GetMissionAudioLoadingStatus();
uint8 GetNum3DProvidersAvailable();
int8 AutoDetect3DProviders();
bool IsMP3RadioChannelAvailable();
uint8 GetCDAudioDriveLetter();
@ -247,13 +269,10 @@ public:
void SetSpeakerConfig(int32 conf);
void ProcessJumboFlying();
bool SetupJumboEngineSound(uint8, int32); // todo
void PreInitialiseGameSpecificSetup();
void SetMissionScriptPoliceAudio(int32 sfx);
void CalculateDistance(bool *ptr, float dist);
bool UsesSiren(int32 model);
bool UsesSirenSwitching(int32 model);
@ -261,7 +280,6 @@ public:
uint8 Get3DProviderName(uint8 id);
void ProcessJumboTaxi();
bool SetupJumboFlySound(uint8); // todo
bool SetupJumboTaxiSound(uint8); // todo
bool SetupJumboWhineSound(uint8, int32); // todo
@ -274,27 +292,14 @@ public:
void InterrogateAudioEntities();
void ClearRequestedQueue();
// void AgeCrimes(); //todo
bool UsesReverseWarning(int32 model);
bool HasAirBrakes(int32 model);
int32 GetJumboTaxiFreq();
void ProcessPhysical(int32 id);
void ProcessVehicle(CPhysical *); // todo
void ProcessPed(CPhysical *); // todo
void ProcessPlane(void *); // todo
void ClearMissionAudio();
// void ProcessReverb(); // todo
bool IsMissionAudioSampleFinished();
void ProcessEntity(int32);
void InitialisePoliceRadio();
void InitialisePoliceRadio(); // todo
int32 RandomDisplacement(uint32 seed);
@ -304,21 +309,16 @@ public:
bool IsAudioInitialised() const;
int32 CreateEntity(int32 type, CPhysical *entity);
void DestroyEntity(int32 id);
void SetEntityStatus(int32 id, bool status);
void PreTerminateGameSpecificShutdown();
void PostTerminateGameSpecificShutdown();
void GenerateIntegerRandomNumberTable();
void PlayerJustGotInCar();
void PlayerJustLeftCar();
void Service();
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample,
uint32 maxOffset);
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset);
uint32 GetPlayerTalkSfx(int16 sound);
uint32 GetCopTalkSfx(int16 sound);
@ -396,6 +396,72 @@ public:
uint32 GetGenericMaleTalkSfx(int16 sound);
uint32 GetGenericFemaleTalkSfx(int16 sound);
void ProcessActiveQueues(); // todo
bool ProcessAirBrakes(cVehicleParams *params); // todo requires CVehicle
void ProcessAirportScriptObject(uint8 sound); // done
bool ProcessBoatEngine(cVehicleParams *params); // todo requires CVehicle
bool ProcessBoatMovingOverWater(cVehicleParams *params); // todo requires CVehicle
void ProcessBridge(); // todo
void ProcessBridgeMotor(); // done
void ProcessBridgeOneShots(); // todo requires CBridge
void ProcessBridgeWarning(); // done
bool ProcessCarBombTick(void *); // todo requires CVehicle
void ProcessCesna(void *); // todo requires CPlane
void ProcessCinemaScriptObject(uint8 sound); // done
void ProcessCrane(); // todo requires CCrane
void ProcessDocksScriptObject(uint8 sound); // done
// bool ProcessEngineDamage(void *); //todo requires CVehicle
void ProcessEntity(int32 sound); // done
void ProcessExplosions(int32 explosion); // todo requires CExplosion
void ProcessFireHydrant(); // done
void ProcessFires(int32 entity); // todo requires gFireManager
void ProcessFrontEnd(); // done
void ProcessGarages(); // todo
// bool ProcessHelicopter(void *); // todo requires CVehicle
void ProcessHomeScriptObject(uint8 sound);
// void ProcessJumbo(void *);
// void ProcessJumboAccel(void *);
// void ProcessJumboDecel(void *);
void ProcessJumboFlying();
// void ProcessJumboLanding(void *);
// void ProcessJumboTakeOff(void *);
void ProcessJumboTaxi(); // done
// void ProcessLaunderetteScriptObject(uint8 sound);
// void ProcessLoopingScriptObject(uint8 sound);
// void ProcessMissionAudio();
// void ProcessModelVehicle(void *);
// void ProcessOneShotScriptObject(uint8 sound);
void ProcessPed(CPhysical *p); // todo
// void ProcessPedHeadphones(void *);
// void ProcessPedOneShots(void *);
void ProcessPhysical(int32 id); // done
void ProcessPlane(void *); // todo
// void ProcessPlayersVehicleEngine(void *, void *);
// void ProcessPoliceCellBeatingScriptObject(uint8 sound);
// void ProcessPornCinema(uint8 sound);
void ProcessProjectiles(); // todo
// void ProcessRainOnVehicle(void *);
// void ProcessReverb();
// bool ProcessReverseGear(void *);
// void ProcessSawMillScriptObject(uint8 sound);
void ProcessScriptObject(int32 id); // todo
// void ProcessShopScriptObject(uint8 sound);
// void ProcessSpecial();
// bool ProcessTrainNoise(void *);
void ProcessVehicle(void *); // todo
// bool ProcessVehicleDoors(void *);
// bool ProcessVehicleEngine(void *);
// void ProcessVehicleHorn(void *);
// void ProcessVehicleOneShots(void *);
// bool ProcessVehicleReverseWarning(void *);
// bool ProcessVehicleRoadNoise(void *);
// void ProcessVehicleSirenOrAlarm(void *);
// void ProcessVehicleSkidding(void *);
void ProcessWaterCannon(int32); // todo
void ProcessWeather(int32 id); // todo
// bool ProcessWetRoadNoise(void *);
// void ProcessWorkShopScriptObject(uint8 sound);
};
static_assert(sizeof(cAudioManager) == 0x4B14, "cAudioManager: error");

View File

@ -3037,4 +3037,132 @@ enum eAudioSamples : uint32 {
AUDIO_SAMPLE_AMMUNATION_WELCOME_3 = 3031,
TOTAL_AUDIO_SAMPLES = 3032,
NO_SAMPLE = 3033,
};
};
enum eScriptSounds : int16
{
SCRIPT_SOUND_0 = 0,
SCRIPT_SOUND_1 = 1,
SCRIPT_SOUND_2 = 2,
SCRIPT_SOUND_3 = 3,
SCRIPT_SOUND_PARTY_1_LOOP_S = 4,
SCRIPT_SOUND_PARTY_1_LOOP_L = 5,
SCRIPT_SOUND_PARTY_2_LOOP_S = 6,
SCRIPT_SOUND_PARTY_2_LOOP_L = 7,
SCRIPT_SOUND_PARTY_3_LOOP_S = 8,
SCRIPT_SOUND_PARTY_3_LOOP_L = 9,
SCRIPT_SOUND_PARTY_4_LOOP_S = 10,
SCRIPT_SOUND_PARTY_4_LOOP_L = 11,
SCRIPT_SOUND_PARTY_5_LOOP_S = 12,
SCRIPT_SOUND_PARTY_5_LOOP_L = 13,
SCRIPT_SOUND_PARTY_6_LOOP_S = 14,
SCRIPT_SOUND_PARTY_6_LOOP_L = 15,
SCRIPT_SOUND_PARTY_7_LOOP_S = 16,
SCRIPT_SOUND_PARTY_7_LOOP_L = 17,
SCRIPT_SOUND_PARTY_8_LOOP_S = 18,
SCRIPT_SOUND_PARTY_8_LOOP_L = 19,
SCRIPT_SOUND_PARTY_9_LOOP_S = 20,
SCRIPT_SOUND_PARTY_9_LOOP_L = 21,
SCRIPT_SOUND_PARTY_10_LOOP_S = 22,
SCRIPT_SOUND_PARTY_10_LOOP_L = 23,
SCRIPT_SOUND_PARTY_11_LOOP_S = 24,
SCRIPT_SOUND_PARTY_11_LOOP_L = 25,
SCRIPT_SOUND_PARTY_12_LOOP_S = 26,
SCRIPT_SOUND_PARTY_12_LOOP_L = 27,
SCRIPT_SOUND_PARTY_13_LOOP_S = 28,
SCRIPT_SOUND_PARTY_13_LOOP_L = 29,
SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S = 30,
SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L = 31,
SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S = 32,
SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L = 33,
SCRIPT_SOUND_WORK_SHOP_LOOP_S = 34,
SCRIPT_SOUND_WORK_SHOP_LOOP_L = 35,
SCRIPT_SOUND_SAWMILL_LOOP_S = 36,
SCRIPT_SOUND_SAWMILL_LOOP_L = 37,
SCRIPT_SOUND_38 = 38,
SCRIPT_SOUND_39 = 39,
SCRIPT_SOUND_LAUNDERETTE_LOOP_S = 40,
SCRIPT_SOUND_LAUNDERETTE_LOOP_L = 41,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_S = 42,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43,
SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44,
SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45,
SCRIPT_SOUND_46 = 46,
SCRIPT_SOUND_47 = 47,
SCRIPT_SOUND_MARCO_BISTRO_S = 48,
SCRIPT_SOUND_MARCO_BISTRO_L = 49,
SCRIPT_SOUND_AIRPORT_LOOP_S = 50,
SCRIPT_SOUND_AIRPORT_LOOP_L = 51,
SCRIPT_SOUND_SHOP_LOOP_S = 52,
SCRIPT_SOUND_SHOP_LOOP_L = 53,
SCRIPT_SOUND_CINEMA_LOOP_S = 54,
SCRIPT_SOUND_CINEMA_LOOP_L = 55,
SCRIPT_SOUND_DOCKS_LOOP_S = 56,
SCRIPT_SOUND_DOCKS_LOOP_L = 57,
SCRIPT_SOUND_HOME_LOOP_S = 58,
SCRIPT_SOUND_HOME_LOOP_L = 59,
SCRIPT_SOUND_FRANKIE_PIANO = 60,
SCRIPT_SOUND_PARTY_1_LOOP = 61,
SCRIPT_SOUND_PORN_CINEMA_1_S = 62,
SCRIPT_SOUND_PORN_CINEMA_1_L = 63,
SCRIPT_SOUND_PORN_CINEMA_2_S = 64,
SCRIPT_SOUND_PORN_CINEMA_2_L = 65,
SCRIPT_SOUND_PORN_CINEMA_3_S = 66,
SCRIPT_SOUND_PORN_CINEMA_3_L = 67,
SCRIPT_SOUND_BANK_ALARM_LOOP_S = 68,
SCRIPT_SOUND_BANK_ALARM_LOOP_L = 69,
SCRIPT_SOUND_POLICE_BALL_LOOP_S = 70,
SCRIPT_SOUND_POLICE_BALL_LOOP_L = 71,
SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S = 72,
SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L = 73,
SCRIPT_SOUND_74 = 74,
SCRIPT_SOUND_75 = 75,
SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S = 76,
SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L = 77,
SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S = 78,
SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L = 79,
SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S = 80,
SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L = 81,
SCRIPT_SOUND_EVIDENCE_PICKUP = 82,
SCRIPT_SOUND_UNLOAD_GOLD = 83,
SCRIPT_SOUND_RAVE_1_LOOP_S = 84,
SCRIPT_SOUND_RAVE_1_LOOP_L = 85,
SCRIPT_SOUND_RAVE_2_LOOP_S = 86,
SCRIPT_SOUND_RAVE_2_LOOP_L = 87,
SCRIPT_SOUND_RAVE_3_LOOP_S = 88,
SCRIPT_SOUND_RAVE_3_LOOP_L = 89,
SCRIPT_SOUND_MISTY_SEX_S = 90,
SCRIPT_SOUND_MISTY_SEX_L = 91,
SCRIPT_SOUND_GATE_START_CLUNK = 92,
SCRIPT_SOUND_GATE_STOP_CLUNK = 93,
SCRIPT_SOUND_PART_MISSION_COMPLETE = 94,
SCRIPT_SOUND_CHUNKY_RUN_SHOUT = 95,
SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT = 96,
SCRIPT_SOUND_RACE_START_3 = 97,
SCRIPT_SOUND_RACE_START_2 = 98,
SCRIPT_SOUND_RACE_START_1 = 99,
SCRIPT_SOUND_RACE_START_GO = 100,
SCRIPT_SOUND_SWAT_PED_SHOUT = 101,
SCRIPT_SOUND_PRETEND_FIRE_LOOP = 102,
SCRIPT_SOUND_AMMUNATION_CHAT_1 = 103,
SCRIPT_SOUND_AMMUNATION_CHAT_2 = 104,
SCRIPT_SOUND_AMMUNATION_CHAT_3 = 105,
SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106,
SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107,
SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108,
SCRIPT_SOUND_109 = 109,
SCRIPT_SOUND_110 = 110,
SCRIPT_SOUND_111 = 111,
SCRIPT_SOUND_PAYPHONE_RINGING = 112,
SCRIPT_SOUND_113 = 113,
SCRIPT_SOUND_GLASS_BREAK_L = 114,
SCRIPT_SOUND_GLASS_BREAK_S = 115,
SCRIPT_SOUND_GLASS_CRACK = 116,
SCRIPT_SOUND_GLASS_LIGHT_BREAK = 117,
SCRIPT_SOUND_BOX_DESTROYED_1 = 118,
SCRIPT_SOUND_BOX_DESTROYED_2 = 119,
SCRIPT_SOUND_METAL_COLLISION = 120,
SCRIPT_SOUND_TIRE_COLLISION = 121,
SCRIPT_SOUND_GUNSHELL_DROP = 122,
SCRIPT_SOUND_GUNSHELL_DROP_SOFT = 123,
};

View File

@ -96,8 +96,8 @@ enum eSound : int16
SOUND_RAMPAGE_FAILED = 91,
SOUND_RAMPAGE_KILL = 92,
SOUND_RAMPAGE_CAR_BLOWN = 93,
_SOUND_EVIDENCE_PICKUP = 94,
_SOUND_UNLOAD_GOLD = 95,
SOUND_EVIDENCE_PICKUP = 94,
SOUND_UNLOAD_GOLD = 95,
SOUND_PAGER = 96,
SOUND_PED_DEATH = 97,
SOUND_PED_DAMAGE = 98,
@ -141,16 +141,16 @@ enum eSound : int16
SOUND_INJURED_PED_MALE_OUCH = 136,
SOUND_INJURED_PED_FEMALE = 137,
SOUND_8A = 138,
_SOUND_RACE_START_3 = 139,
_SOUND_RACE_START_2 = 140,
_SOUND_RACE_START_1 = 141,
_SOUND_RACE_START_GO = 142,
SOUND_RACE_START_3 = 139,
SOUND_RACE_START_2 = 140,
SOUND_RACE_START_1 = 141,
SOUND_RACE_START_GO = 142,
SOUND_SPLASH = 143,
SOUND_WATER_FALL = 144,
SOUND_SPLATTER = 145,
SOUND_CAR_PED_COLLISION = 146,
SOUND_CLOCK_TICK = 147,
_SOUND_PART_MISSION_COMPLETE = 148,
SOUND_PART_MISSION_COMPLETE = 148,
SOUND_FRONTEND_MENU_STARTING = 149,
SOUND_FRONTEND_MENU_COMPLETED = 150,
SOUND_FRONTEND_MENU_DENIED = 151,

View File

@ -1,6 +1,6 @@
#include "SampleManager.h"
#include "common.h"
#include "patcher.h"
#include "SampleManager.h"
CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0;
@ -8,10 +8,28 @@ uint32 &nNumOfMp3Files = *(uint32 *)0x95CC00;
uint8 &num3DProvidersAvailable = *(uint8 *)0x734237;
uint32 *asName3DProviders = (uint32 *)0x734238;
bool CSampleManager::IsMP3RadioChannelAvailable() {
bool
CSampleManager::IsMP3RadioChannelAvailable()
{
return nNumOfMp3Files != 0;
}
WRAPPER
bool
CSampleManager::CheckForAnAudioFileOnCD()
{
EAXJMP(0x566EA0);
}
WRAPPER
int32 CSampleManager::GetSampleBaseFrequency(int32) { EAXJMP(0x5672A0); }
WRAPPER
int32 CSampleManager::GetSampleLoopStartOffset(int32) { EAXJMP(0x5672C0); }
WRAPPER
int32 CSampleManager::GetSampleLoopEndOffset(int32) { EAXJMP(0x5672E0); }
WRAPPER
bool CSampleManager::IsSampleBankLoaded(uint8) { EAXJMP(0x567130); }

View File

@ -1,5 +1,7 @@
#pragma once
#include "common.h"
struct tSample {
int m_nOffset;
unsigned int m_nSize;
@ -11,6 +13,12 @@ struct tSample {
class CSampleManager
{
public:
bool CheckForAnAudioFileOnCD();
int32 GetSampleBaseFrequency(int32);
int32 GetSampleLoopStartOffset(int32);
int32 GetSampleLoopEndOffset(int32);
bool IsSampleBankLoaded(uint8);
void UnloadSampleBank(uint8);
void Terminate();

View File

@ -11,7 +11,7 @@
#include "FileMgr.h"
#include "Heli.h"
#include "main.h"
#include "math/Matrix.h"
#include "Matrix.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
#include "Object.h"
@ -25,7 +25,7 @@
#include "RpAnimBlend.h"
#include "RwHelper.h"
#include "CutsceneMgr.h"
#include "render/Skidmarks.h"
#include "Skidmarks.h"
#include "Streaming.h"
#include "Timer.h"
#include "Train.h"

View File

@ -441,6 +441,7 @@ int m_iModeObbeCamIsInForCar;
static bool &m_bUseMouse3rdPerson;
bool Get_Just_Switched_Status() { return m_bJust_Switched; }
CMatrix &GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
bool IsPointVisible(const CVector &center, const CMatrix *mat);

View File

@ -1,7 +1,7 @@
#include "common.h"
#include "main.h"
#include "patcher.h"
#include "math/Quaternion.h"
#include "Quaternion.h"
#include "ModelInfo.h"
#include "ModelIndices.h"
#include "TempColModels.h"

View File

@ -97,11 +97,11 @@ extern void **rwengine;
#define SCREEN_SCALE_AR(a) (a)
#endif
#include "math/maths.h"
#include "math/Vector.h"
#include "math/Vector2D.h"
#include "math/Matrix.h"
#include "math/Rect.h"
#include "maths.h"
#include "Vector.h"
#include "Vector2D.h"
#include "Matrix.h"
#include "Rect.h"
class CRGBA
{

View File

@ -13,11 +13,11 @@
#include "Glass.h"
#include "Clock.h"
#include "Weather.h"
#include "TimeCycle.h"
#include "Timecycle.h"
#include "Bridge.h"
#include "TrafficLights.h"
#include "Coronas.h"
#include "Pointlights.h"
#include "PointLights.h"
#include "Shadows.h"
#include "Pickups.h"
#include "SpecialFX.h"

View File

@ -320,3 +320,19 @@ inline uint8 GetVehDoorFlag(int32 carnode) {
return 0;
}
}
class cTransmission;
class cVehicleParams
{
public:
char m_bDistanceCalculated;
char gap_1[3];
float m_fDistance;
CVehicle *m_pVehicle;
cTransmission *m_pTransmission;
int m_nIndex;
float m_fVelocityChange;
};
static_assert(sizeof(cVehicleParams) == 0x18, "CVehicle: error");