diff --git a/assets/opensb/interface.config.patch b/assets/opensb/interface.config.patch index d39e16d..b725639 100644 --- a/assets/opensb/interface.config.patch +++ b/assets/opensb/interface.config.patch @@ -21,5 +21,7 @@ "buttonClickSound" : [ "/sfx/interface/button/click.wav" ], "buttonReleaseSound" : [ "/sfx/interface/button/release.wav" ], "buttonHoverSound" : [ "/sfx/interface/button/hover.wav" ], - "buttonHoverOffSound" : [ "/sfx/interface/button/hover_off.wav" ] + "buttonHoverOffSound" : [ "/sfx/interface/button/hover_off.wav" ], + + "debugSpatialClearTime" : 0.0 } \ No newline at end of file diff --git a/source/core/StarLogging.cpp b/source/core/StarLogging.cpp index 55cd27d..b80ae6a 100644 --- a/source/core/StarLogging.cpp +++ b/source/core/StarLogging.cpp @@ -179,10 +179,15 @@ Deque SpatialLogger::getText(char const* space, bool and } void SpatialLogger::clear() { - MutexLocker locker(s_mutex); - s_lines.clear(); - s_points.clear(); - s_logText.clear(); + decltype(s_lines) lines; + decltype(s_points) points; + decltype(s_logText) logText; + { + MutexLocker locker(s_mutex); + lines = move(s_lines); + points = move(s_points); + logText = move(s_logText); + } // Move while locked to deallocate contents while unlocked. } Mutex SpatialLogger::s_mutex; diff --git a/source/frontend/StarChatBubbleSeparation.cpp b/source/frontend/StarChatBubbleSeparation.cpp index ba22ed5..65c9eb1 100644 --- a/source/frontend/StarChatBubbleSeparation.cpp +++ b/source/frontend/StarChatBubbleSeparation.cpp @@ -1,5 +1,5 @@ #include "StarChatBubbleSeparation.hpp" -#include "StarLogging.hpp" +//#include "StarLogging.hpp" namespace Star { diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp index 9d3c3a5..eb13a35 100644 --- a/source/frontend/StarMainInterface.cpp +++ b/source/frontend/StarMainInterface.cpp @@ -814,11 +814,10 @@ void MainInterface::render() { renderMonsterHealthBar(); renderSpecialDamageBar(); renderMainBar(); + renderDebug(); renderWindows(); renderCursor(); - - renderDebug(); } Vec2F MainInterface::cursorWorldPosition() const { diff --git a/source/frontend/StarTitleScreen.cpp b/source/frontend/StarTitleScreen.cpp index e2963f0..df0dcc4 100644 --- a/source/frontend/StarTitleScreen.cpp +++ b/source/frontend/StarTitleScreen.cpp @@ -30,6 +30,10 @@ TitleScreen::TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer) auto randomWorld = m_celestialDatabase->findRandomWorld(10, 50, [this](CelestialCoordinate const& coordinate) { return is(m_celestialDatabase->parameters(coordinate)->visitableParameters()); }).take(); + + if (auto name = m_celestialDatabase->name(randomWorld)) + Logger::info("Title world is {} @ CelestialWorld:{}", Text::stripEscapeCodes(*name), randomWorld); + SkyParameters skyParameters(randomWorld, m_celestialDatabase); m_skyBackdrop = make_shared(skyParameters, true); diff --git a/source/game/StarDamageManager.cpp b/source/game/StarDamageManager.cpp index be855aa..eaaa82a 100644 --- a/source/game/StarDamageManager.cpp +++ b/source/game/StarDamageManager.cpp @@ -80,6 +80,7 @@ void DamageManager::update() { for (auto& damageSource : causingEntity->damageSources()) { if (damageSource.trackSourceEntity) damageSource.translate(causingEntity->position()); + if (auto poly = damageSource.damageArea.ptr()) SpatialLogger::logPoly("world", *poly, Color::Orange.toRgba()); else if (auto line = damageSource.damageArea.ptr()) diff --git a/source/game/StarMonster.cpp b/source/game/StarMonster.cpp index 99b7e49..e9d78f8 100644 --- a/source/game/StarMonster.cpp +++ b/source/game/StarMonster.cpp @@ -479,9 +479,9 @@ void Monster::update(uint64_t) { m_networkedAnimatorDynamicTarget.updatePosition(position()); m_scriptedAnimator.update(); - } - SpatialLogger::logPoly("world", m_movementController->collisionBody(), {255, 0, 0, 255}); + SpatialLogger::logPoly("world", m_movementController->collisionBody(), { 255, 0, 0, 255 }); + } } void Monster::render(RenderCallback* renderCallback) { diff --git a/source/game/StarNpc.cpp b/source/game/StarNpc.cpp index bdeb7b5..75311a6 100644 --- a/source/game/StarNpc.cpp +++ b/source/game/StarNpc.cpp @@ -442,7 +442,8 @@ void Npc::update(uint64_t) { tickShared(); } - SpatialLogger::logPoly("world", m_movementController->collisionBody(), {0, 255, 0, 255}); + if (world()->isClient()) + SpatialLogger::logPoly("world", m_movementController->collisionBody(), {0, 255, 0, 255}); } void Npc::render(RenderCallback* renderCallback) { diff --git a/source/game/StarPlayer.cpp b/source/game/StarPlayer.cpp index be30cd4..1363af5 100644 --- a/source/game/StarPlayer.cpp +++ b/source/game/StarPlayer.cpp @@ -959,7 +959,9 @@ void Player::update(uint64_t) { else m_humanoid->setDance({}); - m_armor->setupHumanoidClothingDrawables(*m_humanoid, forceNude()); + bool isClient = world()->isClient(); + if (isClient) + m_armor->setupHumanoidClothingDrawables(*m_humanoid, forceNude()); m_tools->suppressItems(!canUseTool()); m_tools->tick(m_shifting, m_pendingMoves); @@ -971,7 +973,9 @@ void Player::update(uint64_t) { if (m_movementController->facingDirection() == Direction::Left) m_effectsAnimator->scaleTransformationGroup("flip", Vec2F(-1, 1)); - if (world()->isClient()) { + + + if (isClient) { m_effectsAnimator->update(WorldTimestep, &m_effectsAnimatorDynamicTarget); m_effectsAnimatorDynamicTarget.updatePosition(position() + m_techController->parentOffset()); } else { @@ -1009,7 +1013,8 @@ void Player::update(uint64_t) { m_pendingMoves.clear(); - SpatialLogger::logPoly("world", m_movementController->collisionBody(), isMaster() ? Color::Orange.toRgba() : Color::Yellow.toRgba()); + if (isClient) + SpatialLogger::logPoly("world", m_movementController->collisionBody(), isMaster() ? Color::Orange.toRgba() : Color::Yellow.toRgba()); } float Player::timeSinceLastGaveDamage() const { diff --git a/source/game/StarProjectile.cpp b/source/game/StarProjectile.cpp index ad92883..060c4e3 100644 --- a/source/game/StarProjectile.cpp +++ b/source/game/StarProjectile.cpp @@ -344,7 +344,8 @@ void Projectile::update(uint64_t) { tickShared(); } - SpatialLogger::logPoly("world", m_movementController->collisionBody(), Color::Red.toRgba()); + if (world()->isClient()) + SpatialLogger::logPoly("world", m_movementController->collisionBody(), Color::Red.toRgba()); } void Projectile::render(RenderCallback* renderCallback) { diff --git a/source/game/StarStagehand.cpp b/source/game/StarStagehand.cpp index 4ad3299..dad09a2 100644 --- a/source/game/StarStagehand.cpp +++ b/source/game/StarStagehand.cpp @@ -92,8 +92,12 @@ void Stagehand::update(uint64_t) { if (isMaster() && m_scripted) m_scriptComponent.update(m_scriptComponent.updateDt()); - SpatialLogger::logPoly("world", PolyF(metaBoundBox().translated(position())), {0, 255, 255, 255}); - SpatialLogger::logPoint("world", position(), {0, 255, 255, 255}); + if (world()->isClient()) { + auto boundBox = metaBoundBox().translated(position()); + SpatialLogger::logPoly("world", PolyF(boundBox), { 0, 255, 255, 255 }); + SpatialLogger::logLine("world", boundBox.min(), boundBox.max(), {0, 255, 255, 255}); + SpatialLogger::logLine("world", { boundBox.xMin(), boundBox.yMax() }, { boundBox.xMax(), boundBox.yMin() }, {0, 255, 255, 255}); + } } bool Stagehand::shouldDestroy() const { diff --git a/source/game/StarVehicle.cpp b/source/game/StarVehicle.cpp index 38755d5..83fc9e2 100644 --- a/source/game/StarVehicle.cpp +++ b/source/game/StarVehicle.cpp @@ -315,7 +315,8 @@ void Vehicle::update(uint64_t) { if (world()->isClient()) m_scriptedAnimator.update(); - SpatialLogger::logPoly("world", m_movementController.collisionBody(), {255, 255, 0, 255}); + if (world()->isClient()) + SpatialLogger::logPoly("world", m_movementController.collisionBody(), {255, 255, 0, 255}); } void Vehicle::render(RenderCallback* renderer) { diff --git a/source/game/items/StarActiveItem.cpp b/source/game/items/StarActiveItem.cpp index 80e0b3e..9e7ed3f 100644 --- a/source/game/items/StarActiveItem.cpp +++ b/source/game/items/StarActiveItem.cpp @@ -137,7 +137,8 @@ void ActiveItem::update(FireMode fireMode, bool shifting, HashSetisClient()) { + bool isClient = world()->isClient(); + if (isClient) { m_itemAnimator.update(WorldTimestep, &m_itemAnimatorDynamicTarget); m_scriptedAnimator.update(m_scriptedAnimator.updateDt()); } else { @@ -151,14 +152,17 @@ void ActiveItem::update(FireMode fireMode, bool shifting, HashSetposition()); - SpatialLogger::logPoly("world", shieldPoly, {255, 255, 0, 255}); + if (isClient) + SpatialLogger::logPoly("world", shieldPoly, {255, 255, 0, 255}); } - for (auto forceRegion : forceRegions()) { - if (auto dfr = forceRegion.ptr()) - SpatialLogger::logPoly("world", dfr->region, {155, 0, 255, 255}); - else if (auto rfr = forceRegion.ptr()) - SpatialLogger::logPoint("world", rfr->center, {155, 0, 255, 255}); + if (isClient) { + for (auto forceRegion : forceRegions()) { + if (auto dfr = forceRegion.ptr()) + SpatialLogger::logPoly("world", dfr->region, { 155, 0, 255, 255 }); + else if (auto rfr = forceRegion.ptr()) + SpatialLogger::logPoint("world", rfr->center, { 155, 0, 255, 255 }); + } } }