Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Nov 26, 2024
1 parent 0e57931 commit 2dc8ba2
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 47 deletions.
2 changes: 1 addition & 1 deletion config/tracks.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 21 additions & 17 deletions data/sounds/sounds1.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// meh, not really used and will crash w/o:
// trigger_source ..
// pitch_source ..

// engines
//------------------------------------------------
engine
Expand Down Expand Up @@ -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
Expand All @@ -125,7 +129,7 @@ water_cont

mud1
{
trigger_source shift
trigger_source shift
start_sound unpitched mud1.wav
}
mud_cont
Expand All @@ -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
}

Expand Down Expand Up @@ -271,6 +275,6 @@ ambient/1
// test--
shift/1
{
trigger_source shift
trigger_source shift
start_sound unpitched check.wav
}
15 changes: 8 additions & 7 deletions src/game/Game_Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions src/road/PaceNotesGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -575,7 +575,7 @@ void PaceNotes::Rebuild(SplineRoad* road, Scene* sc, bool reversed)
//LogO("SS "+toStr(vPS[i].id));
}
Reset();
#endif
#endif

CreateHR();

Expand Down
4 changes: 2 additions & 2 deletions src/road/Road_Rebuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 17 additions & 18 deletions src/sound/SoundScriptManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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>() == SimState::RUNNING ||
// Audio::sim_state->getEnum<SimState>() == 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();
Expand Down Expand Up @@ -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())
Expand All @@ -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))
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -467,7 +467,6 @@ SoundScriptInstancePtr SoundScriptManager::createInstance(
{
inst->start();
}

return inst;
}

Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 2dc8ba2

Please sign in to comment.