From 5e9355b1ffc4cc5639a7082a74069c182a273c98 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 23 Dec 2023 09:50:14 -0800 Subject: [PATCH] fix: shooting gallery bugs (#1347) fix: reset some more vars Co-authored-by: Aaron Kimbre --- dGame/Entity.cpp | 4 +++- dGame/dComponents/ShootingGalleryComponent.cpp | 2 ++ dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp | 7 +++++++ dZoneManager/Level.cpp | 2 +- dZoneManager/Zone.cpp | 4 ++-- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index a73e356f..38960d70 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -166,7 +166,9 @@ void Entity::Initialize() { if (!groupIDs.empty()) { m_Groups = GeneralUtils::SplitString(groupIDs, ';'); - m_Groups.erase(m_Groups.end() - 1); + if (!m_Groups.empty()) { + if (m_Groups.back().empty()) m_Groups.erase(m_Groups.end() - 1); + } } /** diff --git a/dGame/dComponents/ShootingGalleryComponent.cpp b/dGame/dComponents/ShootingGalleryComponent.cpp index 92208598..45cd9342 100644 --- a/dGame/dComponents/ShootingGalleryComponent.cpp +++ b/dGame/dComponents/ShootingGalleryComponent.cpp @@ -24,6 +24,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i outBitStream->Write(0); } else { outBitStream->Write(1); + outBitStream->Write(m_CurrentPlayerID); for (size_t i = 0; i < 10; i++) { outBitStream->Write(0.0f); } @@ -60,6 +61,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i outBitStream->Write(m_CurrentPlayerID); outBitStream->Write(m_DynamicParams.cannonTimeout); outBitStream->Write(m_DynamicParams.cannonFOV); + if (!isInitialUpdate) m_Dirty = false; } } diff --git a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp index b1d4abc4..2c520670 100644 --- a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp +++ b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp @@ -1040,6 +1040,13 @@ void SGCannon::ResetVars(Entity* self) { self->SetVar>(RewardsVariable, {}); self->SetVar(TotalScoreVariable, 0); + self->SetVar(u"m_curStreak", 0); + self->SetNetworkVar(u"SuperChargeBar", 0); + self->SetVar(u"LastSuperTotal", 0); + self->SetNetworkVar(u"SuperChargeBar", 0.0f); + self->SetNetworkVar(u"ShowStreak", 0); + self->SetNetworkVar(u"UnMarkAll", true); + const_cast&>(self->GetVar>(ActiveSpawnsVariable)).clear(); self->SetVar>(ActiveSpawnsVariable, {}); diff --git a/dZoneManager/Level.cpp b/dZoneManager/Level.cpp index ae44eb8f..60f69359 100644 --- a/dZoneManager/Level.cpp +++ b/dZoneManager/Level.cpp @@ -83,7 +83,7 @@ void Level::MakeSpawner(SceneObject obj) { if (data->GetKey() == u"groupID") { // Load object groups std::string groupStr = data->GetValueAsString(); spawnInfo.groups = GeneralUtils::SplitString(groupStr, ';'); - spawnInfo.groups.erase(spawnInfo.groups.end() - 1); + if (spawnInfo.groups.back().empty()) spawnInfo.groups.erase(spawnInfo.groups.end() - 1); } if (data->GetKey() == u"no_auto_spawn") { spawnInfo.noAutoSpawn = static_cast*>(data)->GetValue(); diff --git a/dZoneManager/Zone.cpp b/dZoneManager/Zone.cpp index 1e0c6077..d11d11dd 100644 --- a/dZoneManager/Zone.cpp +++ b/dZoneManager/Zone.cpp @@ -121,9 +121,9 @@ void Zone::LoadZoneIntoMemory() { } else if (data->GetKey() == u"groupID") { // Load object group std::string groupStr = data->GetValueAsString(); info.groups = GeneralUtils::SplitString(groupStr, ';'); - info.groups.erase(info.groups.end() - 1); + if (info.groups.back().empty()) info.groups.erase(info.groups.end() - 1); } else if (data->GetKey() == u"grpNameQBShowBricks") { - if (data->GetValueAsString() == "") continue; + if (data->GetValueAsString().empty()) continue; /*std::string groupStr = data->GetValueAsString(); info.groups.push_back(groupStr);*/ info.grpNameQBShowBricks = data->GetValueAsString();