fix: shooting gallery bugs (#1347)

fix: reset some more vars

Co-authored-by: Aaron Kimbre <aronwk.aaron@gmail.com>
This commit is contained in:
David Markowitz 2023-12-23 09:50:14 -08:00 committed by GitHub
parent 6b9798595e
commit 5e9355b1ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 4 deletions

View File

@ -166,7 +166,9 @@ void Entity::Initialize() {
if (!groupIDs.empty()) { if (!groupIDs.empty()) {
m_Groups = GeneralUtils::SplitString(groupIDs, ';'); 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);
}
} }
/** /**

View File

@ -24,6 +24,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i
outBitStream->Write<uint32_t>(0); outBitStream->Write<uint32_t>(0);
} else { } else {
outBitStream->Write<uint32_t>(1); outBitStream->Write<uint32_t>(1);
outBitStream->Write<LWOOBJID>(m_CurrentPlayerID);
for (size_t i = 0; i < 10; i++) { for (size_t i = 0; i < 10; i++) {
outBitStream->Write<float_t>(0.0f); outBitStream->Write<float_t>(0.0f);
} }
@ -60,6 +61,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i
outBitStream->Write<LWOOBJID>(m_CurrentPlayerID); outBitStream->Write<LWOOBJID>(m_CurrentPlayerID);
outBitStream->Write<float_t>(m_DynamicParams.cannonTimeout); outBitStream->Write<float_t>(m_DynamicParams.cannonTimeout);
outBitStream->Write<float_t>(m_DynamicParams.cannonFOV); outBitStream->Write<float_t>(m_DynamicParams.cannonFOV);
if (!isInitialUpdate) m_Dirty = false;
} }
} }

View File

@ -1040,6 +1040,13 @@ void SGCannon::ResetVars(Entity* self) {
self->SetVar<std::vector<LOT>>(RewardsVariable, {}); self->SetVar<std::vector<LOT>>(RewardsVariable, {});
self->SetVar<uint32_t>(TotalScoreVariable, 0); self->SetVar<uint32_t>(TotalScoreVariable, 0);
self->SetVar<uint32_t>(u"m_curStreak", 0);
self->SetNetworkVar<float>(u"SuperChargeBar", 0);
self->SetVar<uint32_t>(u"LastSuperTotal", 0);
self->SetNetworkVar<float>(u"SuperChargeBar", 0.0f);
self->SetNetworkVar<bool>(u"ShowStreak", 0);
self->SetNetworkVar<bool>(u"UnMarkAll", true);
const_cast<std::vector<SGEnemy>&>(self->GetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable)).clear(); const_cast<std::vector<SGEnemy>&>(self->GetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable)).clear();
self->SetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable, {}); self->SetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable, {});

View File

@ -83,7 +83,7 @@ void Level::MakeSpawner(SceneObject obj) {
if (data->GetKey() == u"groupID") { // Load object groups if (data->GetKey() == u"groupID") { // Load object groups
std::string groupStr = data->GetValueAsString(); std::string groupStr = data->GetValueAsString();
spawnInfo.groups = GeneralUtils::SplitString(groupStr, ';'); 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") { if (data->GetKey() == u"no_auto_spawn") {
spawnInfo.noAutoSpawn = static_cast<LDFData<bool>*>(data)->GetValue(); spawnInfo.noAutoSpawn = static_cast<LDFData<bool>*>(data)->GetValue();

View File

@ -121,9 +121,9 @@ void Zone::LoadZoneIntoMemory() {
} else if (data->GetKey() == u"groupID") { // Load object group } else if (data->GetKey() == u"groupID") { // Load object group
std::string groupStr = data->GetValueAsString(); std::string groupStr = data->GetValueAsString();
info.groups = GeneralUtils::SplitString(groupStr, ';'); 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") { } else if (data->GetKey() == u"grpNameQBShowBricks") {
if (data->GetValueAsString() == "") continue; if (data->GetValueAsString().empty()) continue;
/*std::string groupStr = data->GetValueAsString(); /*std::string groupStr = data->GetValueAsString();
info.groups.push_back(groupStr);*/ info.groups.push_back(groupStr);*/
info.grpNameQBShowBricks = data->GetValueAsString(); info.grpNameQBShowBricks = data->GetValueAsString();