From 2dc8ba2f2317bf040e93dc23d8990345853acf15 Mon Sep 17 00:00:00 2001 From: cryham Date: Tue, 26 Nov 2024 17:26:31 +0100 Subject: [PATCH] cleanup --- config/tracks.ini | 2 +- data/sounds/sounds1.cfg | 38 ++++++++++++++++++-------------- src/game/Game_Update.cpp | 15 +++++++------ src/road/PaceNotesGen.cpp | 4 ++-- src/road/Road_Rebuild.cpp | 4 ++-- src/sound/SoundScriptManager.cpp | 35 ++++++++++++++--------------- 6 files changed, 51 insertions(+), 47 deletions(-) diff --git a/config/tracks.ini b/config/tracks.ini index e31b233b..ea0ccb53 100644 --- a/config/tracks.ini +++ b/config/tracks.ini @@ -80,7 +80,7 @@ 22,Sav5-LoopBasic v0.9 04/12/10 29/05/23 :SavannaDry |o0 c0 w0 ~0 J0 L3 P1 /2 s0 u0 n2 l2 !4 *3 T=61.0 a:CH 23,For4-OSquare v0.9 04/12/10 09/08/24 :ForestMntn |o0 c0 w0 ~1 J1 L0 P0 /0 s1 u0 n0 l3 !1 *3 T=75.6 a:CH -25,For6-Banked v0.9 05/12/10 09/08/24 :ForestMntn |o0 c0 w0 ~0 J0 L0 P0 /2 s2 u0 n1 l2 !2 *3 T=46.7 a:CryHam,rubberduck +25,For6-Banked v0.9 05/12/10 09/08/24 :ForestMntn |o0 c1 w0 ~0 J0 L0 P0 /2 s2 u0 n1 l2 !2 *3 T=46.7 a:CryHam,rubberduck 26,Des7-CrossJumps v0.9 05/12/10 05/08/24 :Desert |o0 c0 w0 ~0 J4 L0 P0 /2 s0 u0 n0 l4 !4 *3 T=88.8 a:CH 27,Des8-Technical v0.9 05/12/10 05/08/24 :Desert |o2 c0 w0 ~0 J2 L0 P0 /3 s0 u0 n0 l5 !4 *4 T=114.1 a:CH diff --git a/data/sounds/sounds1.cfg b/data/sounds/sounds1.cfg index b1846618..20e11ed2 100644 --- a/data/sounds/sounds1.cfg +++ b/data/sounds/sounds1.cfg @@ -1,3 +1,7 @@ +// meh, not really used and will crash w/o: +// trigger_source .. +// pitch_source .. + // engines //------------------------------------------------ engine @@ -104,17 +108,17 @@ wind // fluids ------ water1 { - trigger_source shift + trigger_source shift start_sound unpitched water1.wav } water2 { - trigger_source shift + trigger_source shift start_sound unpitched water2.wav } water3 { - trigger_source shift + trigger_source shift start_sound unpitched water3.wav } water_cont @@ -125,7 +129,7 @@ water_cont mud1 { - trigger_source shift + trigger_source shift start_sound unpitched mud1.wav } mud_cont @@ -139,62 +143,62 @@ mud_cont //------------------------------------------------ crash/01 { - trigger_source shift + trigger_source shift start_sound unpitched 01.wav } crash/02 { - trigger_source shift + trigger_source shift start_sound unpitched 02.wav } crash/03 { - trigger_source shift + trigger_source shift start_sound unpitched 03.wav } crash/04 { - trigger_source shift + trigger_source shift start_sound unpitched 04.wav } crash/05 { - trigger_source shift + trigger_source shift start_sound unpitched 05.wav } crash/06 { - trigger_source shift + trigger_source shift start_sound unpitched 06.wav } crash/07 { - trigger_source shift + trigger_source shift start_sound unpitched 07.wav } crash/08 { - trigger_source shift + trigger_source shift start_sound unpitched 08.wav } crash/09 { - trigger_source shift + trigger_source shift start_sound unpitched 09.wav } crash/10 { - trigger_source shift + trigger_source shift start_sound unpitched 10.wav } crash/11 { - trigger_source shift + trigger_source shift start_sound unpitched 11.wav } crash/12 { - trigger_source shift + trigger_source shift start_sound unpitched 12.wav } @@ -271,6 +275,6 @@ ambient/1 // test-- shift/1 { - trigger_source shift + trigger_source shift start_sound unpitched check.wav } diff --git a/src/game/Game_Update.cpp b/src/game/Game_Update.cpp index 25b13447..bd9cd313 100644 --- a/src/game/Game_Update.cpp +++ b/src/game/Game_Update.cpp @@ -178,19 +178,20 @@ void App::update( float dt ) { updatePoses(dt); - // 🔉 carModels[0]->cam - pGame->snd->update(dt, mCamera); // here? + // 🔉 update 3d audio listener position + // here?, carModels[0]->cam + pGame->snd->update(dt, mCamera); - /* test * - static float tm = 0.f; + // test crash > 256 // todo: not auto removed.. + /*static float tm = 0.f; tm += dt; if (tm > 0.04f) { tm = 0.f; - RoR::SoundScriptInstancePtr sound = pGame->snd->createInstance("shift1", -1); + SoundScriptInstancePtr sound = pGame->snd->createInstance("shift/1", -1); sound->setPosition(Ogre::Vector3::ZERO); - sound->start(); - sound->Release(); + sound->runOnce(); + // sound->Release(); }/**/ if (!carModels.empty()) diff --git a/src/road/PaceNotesGen.cpp b/src/road/PaceNotesGen.cpp index 80a4cfaa..9002eddc 100644 --- a/src/road/PaceNotesGen.cpp +++ b/src/road/PaceNotesGen.cpp @@ -559,7 +559,7 @@ void PaceNotes::Rebuild(SplineRoad* road, Scene* sc, bool reversed) ///: only real signs - #ifndef SR_EDITOR // game +#ifndef SR_EDITOR // game vPS.clear(); for (i=0; i < vPN.size(); ++i) if (vPN[i].use == 1) @@ -575,7 +575,7 @@ void PaceNotes::Rebuild(SplineRoad* road, Scene* sc, bool reversed) //LogO("SS "+toStr(vPS[i].id)); } Reset(); - #endif +#endif CreateHR(); diff --git a/src/road/Road_Rebuild.cpp b/src/road/Road_Rebuild.cpp index 1ef643fb..f57fcdc5 100644 --- a/src/road/Road_Rebuild.cpp +++ b/src/road/Road_Rebuild.cpp @@ -30,9 +30,9 @@ using std::vector; using std::min; using std::max; // bridge, Walls: - cross sections - // -// +y road pipe decor 1 decor 2 decor 3 +// y+ road pipe decor 1 decor 2 decor 3 // | 2-1 6-5 2-1\ /6-5 21--07 1/0\7 1-0 -// 0--+x | 0--7 | \ 07 / | | 2< >6 2| |7 +// 0--x+ | 0--7 | \ 07 / | | 2< >6 2| |7 // 3______4 \ / 34--56 3\4/5 3| |6 // 34 4_5 // 📏 wall front indices diff --git a/src/sound/SoundScriptManager.cpp b/src/sound/SoundScriptManager.cpp index 27cd7ce3..b28a8c5c 100644 --- a/src/sound/SoundScriptManager.cpp +++ b/src/sound/SoundScriptManager.cpp @@ -57,8 +57,8 @@ std::string Audio::audio_default_listener_efx_preset; std::string Audio::audio_force_listener_efx_preset; -SoundScriptManager::SoundScriptManager() : - disabled(true) +SoundScriptManager::SoundScriptManager() + : disabled(true) , loading_base(false) , instance_counter(0) , max_distance(500.0f) @@ -253,22 +253,22 @@ void SoundScriptManager::modulate(int actor_id, int mod, float value, int linkTy } void SoundScriptManager::update(float dt_sec, - Ogre::Camera* camera_node) - //Ogre::SceneNode* camera_node) + Camera* camera_node) + //SceneNode* camera_node) { // if (Audio::sim_state->getEnum() == SimState::RUNNING || // Audio::sim_state->getEnum() == SimState::EDITOR_MODE) { - // Ogre::SceneNode* camera_node = Audio::GetCameraManager()->GetCameraNode(); + // SceneNode* camera_node = Audio::GetCameraManager()->GetCameraNode(); static Vector3 last_camera_position; - Ogre::Vector3 camera_position = camera_node->getPosition(); + Vector3 camera_position = camera_node->getPosition(); Vector3 camera_velocity = (camera_position - last_camera_position) / dt_sec; last_camera_position = camera_position; - Ogre::Vector3 camera_up = camera_node->getOrientation() * Ogre::Vector3::UNIT_Y; - // Direction points down -Z by default (adapted from Ogre::Camera) - Ogre::Vector3 camera_direction = camera_node->getOrientation() * -Ogre::Vector3::UNIT_Z; + Vector3 camera_up = camera_node->getOrientation() * Vector3::UNIT_Y; + // Direction points down -Z by default (adapted from Camera) + Vector3 camera_direction = camera_node->getOrientation() * -Vector3::UNIT_Z; SetListener(camera_position, camera_direction, camera_up, camera_velocity); - Ogre::Vector3 listener_position = sound_manager->GetListenerPosition(); + Vector3 listener_position = sound_manager->GetListenerPosition(); // todo: audio new restore // const auto water = Audio::GetGameContext()->GetTerrain()->getWater(); @@ -339,7 +339,7 @@ void SoundScriptManager::SetListenerEnvironment(Vector3 listener_position) } } -const EFXEAXREVERBPROPERTIES* SoundScriptManager::GetReverbPresetAt(const Ogre::Vector3 position) const +const EFXEAXREVERBPROPERTIES* SoundScriptManager::GetReverbPresetAt(const Vector3 position) const { // for the listener we do additional checks if (position == sound_manager->GetListenerPosition()) @@ -362,7 +362,7 @@ const EFXEAXREVERBPROPERTIES* SoundScriptManager::GetReverbPresetAt(const Ogre:: { if (!collision_box.reverb_preset_name.empty()) { - const Ogre::AxisAlignedBox collision_box_aab = Ogre::AxisAlignedBox(collision_box.lo, collision_box.hi); + const AxisAlignedBox collision_box_aab = AxisAlignedBox(collision_box.lo, collision_box.hi); if (collision_box_aab.contains(position)) { @@ -415,7 +415,7 @@ SoundScriptTemplatePtr SoundScriptManager::createTemplate( } SoundScriptInstancePtr SoundScriptManager::createInstance( - Ogre::String templatename, int actor_id, int soundLinkType, int soundLinkItemId) + String templatename, int actor_id, int soundLinkType, int soundLinkItemId) { //first, search template SoundScriptTemplatePtr templ = NULL; @@ -467,7 +467,6 @@ SoundScriptInstancePtr SoundScriptManager::createInstance( { inst->start(); } - return inst; } @@ -580,7 +579,7 @@ void SoundScriptManager::parseScript(DataStreamPtr& stream, const String& groupN { // attribute // split params on space - Ogre::StringVector veclineparams = StringUtil::split(line, "\t ", 0); + StringVector veclineparams = StringUtil::split(line, "\t ", 0); if (!sst->setParameter(veclineparams)) { @@ -622,8 +621,8 @@ void SoundScriptManager::setEnabled(bool state) //===================================================================== -SoundScriptTemplate::SoundScriptTemplate(String name, String groupname, String filename, bool baseTemplate) : - base_template(baseTemplate) +SoundScriptTemplate::SoundScriptTemplate(String name, String groupname, String filename, bool baseTemplate) + : base_template(baseTemplate) , file_name(filename) , group_name(groupname) , free_sound(0) @@ -645,7 +644,7 @@ SoundScriptTemplate::SoundScriptTemplate(String name, String groupname, String f { } -bool SoundScriptTemplate::setParameter(Ogre::StringVector vec) +bool SoundScriptTemplate::setParameter(StringVector vec) { if (vec.empty()) return false;