diff --git a/Source/Activities/AreaEditor.cpp b/Source/Activities/AreaEditor.cpp index ff6f91035..f3046ae0d 100644 --- a/Source/Activities/AreaEditor.cpp +++ b/Source/Activities/AreaEditor.cpp @@ -371,7 +371,7 @@ void AreaEditor::Update() { } // Open the save scene dialog to ask user where to save it then else { - m_PreviousMode = m_PreviousMode; + m_PreviousMode = m_EditorMode; m_EditorMode = EditorActivity::SAVEDIALOG; m_ModeChange = true; } diff --git a/Source/Activities/AssemblyEditor.cpp b/Source/Activities/AssemblyEditor.cpp index 3d103e407..ce8282ae9 100644 --- a/Source/Activities/AssemblyEditor.cpp +++ b/Source/Activities/AssemblyEditor.cpp @@ -296,7 +296,7 @@ void AssemblyEditor::Update() { } // Open the save scene dialog to ask user where to save it then else { - m_PreviousMode = m_PreviousMode; + m_PreviousMode = m_EditorMode; m_EditorMode = EditorActivity::SAVEDIALOG; m_ModeChange = true; } diff --git a/Source/Activities/GibEditor.cpp b/Source/Activities/GibEditor.cpp index 50ff6ebfc..ca3f16c6b 100644 --- a/Source/Activities/GibEditor.cpp +++ b/Source/Activities/GibEditor.cpp @@ -462,7 +462,7 @@ void GibEditor::Update() { } // Open the save object dialog to ask user where to save it then else { - m_PreviousMode = m_PreviousMode; + m_PreviousMode = m_EditorMode; m_EditorMode = EditorActivity::SAVEDIALOG; m_ModeChange = true; } diff --git a/Source/Activities/MultiplayerServerLobby.cpp b/Source/Activities/MultiplayerServerLobby.cpp index 07cff8c9d..c8c38e482 100644 --- a/Source/Activities/MultiplayerServerLobby.cpp +++ b/Source/Activities/MultiplayerServerLobby.cpp @@ -1048,11 +1048,8 @@ void MultiplayerServerLobby::DrawGUI(BITMAP* pTargetBitmap, const Vector& target m_pRootBox->SetPositionAbs(0, 0); // We need to manually draw UI's to intermediate buffer first, then to the player's backbuffer to make it centered on each player's screen. - for (int i = 0; i < 4; i++) { - if (i < c_MaxClients) - finalDestBitmap = g_FrameMan.GetNetworkBackBufferIntermediateGUI8Current(i); - else - finalDestBitmap = pTargetBitmap; + for (int i = 0; i < c_MaxClients; i++) { + finalDestBitmap = g_FrameMan.GetNetworkBackBufferIntermediateGUI8Current(i); AllegroScreen drawScreen(drawBitmap); m_pGUIController->Draw(&drawScreen); diff --git a/Source/Activities/SceneEditor.cpp b/Source/Activities/SceneEditor.cpp index 6680766a7..fc502f9a1 100644 --- a/Source/Activities/SceneEditor.cpp +++ b/Source/Activities/SceneEditor.cpp @@ -418,7 +418,7 @@ void SceneEditor::Update() { } // Open the save scene dialog to ask user where to save it then else { - m_PreviousMode = m_PreviousMode; + m_PreviousMode = m_EditorMode; m_EditorMode = EditorActivity::SAVEDIALOG; m_ModeChange = true; } diff --git a/Source/Entities/ACRocket.cpp b/Source/Entities/ACRocket.cpp index 64e01570a..2b922ff02 100644 --- a/Source/Entities/ACRocket.cpp +++ b/Source/Entities/ACRocket.cpp @@ -349,20 +349,11 @@ void ACRocket::PreControllerUpdate() { m_Paths[RIGHT][m_GearState].SetHFlip(m_HFlipped); m_Paths[LEFT][m_GearState].SetHFlip(!m_HFlipped); - if (!m_LimbPushForcesAndCollisionsDisabled) { - if (m_pRLeg) { - m_pRFootGroup->PushAsLimb(m_Pos.GetFloored() + RotateOffset(m_pRLeg->GetParentOffset()), m_pRLeg->GetMaxLength(), m_Vel, m_Rotation, m_Paths[RIGHT][m_GearState], deltaTime, nullptr, true); - } - if (m_pLLeg) { - m_pLFootGroup->PushAsLimb(m_Pos.GetFloored() + RotateOffset(m_pLLeg->GetParentOffset()), m_pLLeg->GetMaxLength(), m_Vel, m_Rotation, m_Paths[LEFT][m_GearState], deltaTime, nullptr, true); - } - } else { - if (m_pRLeg) { - m_pRFootGroup->PushAsLimb(m_Pos.GetFloored() + RotateOffset(m_pRLeg->GetParentOffset()), m_pRLeg->GetMaxLength(), m_Vel, m_Rotation, m_Paths[RIGHT][m_GearState], deltaTime, nullptr, true); - } - if (m_pLLeg) { - m_pLFootGroup->PushAsLimb(m_Pos.GetFloored() + RotateOffset(m_pLLeg->GetParentOffset()), m_pLLeg->GetMaxLength(), m_Vel, m_Rotation, m_Paths[LEFT][m_GearState], deltaTime, nullptr, true); - } + if (m_pRLeg) { + m_pRFootGroup->PushAsLimb(m_Pos.GetFloored() + RotateOffset(m_pRLeg->GetParentOffset()), m_pRLeg->GetMaxLength(), m_Vel, m_Rotation, m_Paths[RIGHT][m_GearState], deltaTime, nullptr, true); + } + if (m_pLLeg) { + m_pLFootGroup->PushAsLimb(m_Pos.GetFloored() + RotateOffset(m_pLLeg->GetParentOffset()), m_pLLeg->GetMaxLength(), m_Vel, m_Rotation, m_Paths[LEFT][m_GearState], deltaTime, nullptr, true); } } diff --git a/Source/Entities/ACraft.cpp b/Source/Entities/ACraft.cpp index f43c42db5..403165bf8 100644 --- a/Source/Entities/ACraft.cpp +++ b/Source/Entities/ACraft.cpp @@ -405,9 +405,6 @@ bool ACraft::HandlePieCommand(PieSliceType pieSliceIndex) { } else if (pieSliceIndex == PieSliceType::Sentry) { m_AIMode = AIMODE_SENTRY; m_DeliveryState = FALL; - } else if (pieSliceIndex == PieSliceType::Return) { - m_AIMode = AIMODE_RETURN; - m_DeliveryState = LAUNCH; } else if (pieSliceIndex == PieSliceType::GoTo) { m_AIMode = AIMODE_GOTO; m_DeliveryState = FALL; @@ -552,7 +549,6 @@ void ACraft::DropAllInventory() { m_Inventory.erase(exitee); // Reset timer interval and quit until next one is due m_ExitTimer.Reset(); - break; } else { (*exitee)->SetVel(m_Vel + exitVel * antiGravBoost); (*exitee)->SetAngularVel(5.0F * RandomNormalNum()); @@ -566,9 +562,7 @@ void ACraft::DropAllInventory() { m_Inventory.erase(exitee); // Reset timer interval and quit until next one is due m_ExitTimer.Reset(); - break; } - droppedSomething = true; } if (m_Inventory.empty()) { diff --git a/Source/Entities/Attachable.cpp b/Source/Entities/Attachable.cpp index 702614ef9..a6e0ee4ab 100644 --- a/Source/Entities/Attachable.cpp +++ b/Source/Entities/Attachable.cpp @@ -381,23 +381,25 @@ void Attachable::Update() { m_Team = m_Parent->GetTeam(); MOSRotating* rootParentAsMOSR = dynamic_cast(GetRootParent()); - float currentRotAngleOffset = (GetRotAngle() * GetFlipFactor()) - rootParentAsMOSR->GetRotAngle(); - if (rootParentAsMOSR && CanCollideWithTerrain()) { - // Note: This safety check exists to ensure the parent's AtomGroup contains this Attachable's Atoms in a subgroup. Hardcoded Attachables need this in order to work, since they're cloned before their parent's AtomGroup exists. - if (!rootParentAsMOSR->GetAtomGroup()->ContainsSubGroup(m_AtomSubgroupID)) { - AddOrRemoveAtomsFromRootParentAtomGroup(true, false); - } + if (rootParentAsMOSR) { + float currentRotAngleOffset = (GetRotAngle() * GetFlipFactor()) - rootParentAsMOSR->GetRotAngle(); + if (CanCollideWithTerrain()) { + // Note: This safety check exists to ensure the parent's AtomGroup contains this Attachable's Atoms in a subgroup. Hardcoded Attachables need this in order to work, since they're cloned before their parent's AtomGroup exists. + if (!rootParentAsMOSR->GetAtomGroup()->ContainsSubGroup(m_AtomSubgroupID)) { + AddOrRemoveAtomsFromRootParentAtomGroup(true, false); + } - if (std::abs(currentRotAngleOffset - m_PrevRotAngleOffset) > 0.01745F) { // Update for 1 degree differences - Matrix atomRotationForSubgroup(rootParentAsMOSR->FacingAngle(GetRotAngle()) - rootParentAsMOSR->FacingAngle(rootParentAsMOSR->GetRotAngle())); - Vector atomOffsetForSubgroup(g_SceneMan.ShortestDistance(rootParentAsMOSR->GetPos(), m_Pos, g_SceneMan.SceneWrapsX()).FlipX(rootParentAsMOSR->IsHFlipped())); - Matrix rootParentAngleToUse(rootParentAsMOSR->GetRotAngle() * rootParentAsMOSR->GetFlipFactor()); - atomOffsetForSubgroup /= rootParentAngleToUse; - rootParentAsMOSR->GetAtomGroup()->UpdateSubAtoms(GetAtomSubgroupID(), atomOffsetForSubgroup, atomRotationForSubgroup); + if (std::abs(currentRotAngleOffset - m_PrevRotAngleOffset) > 0.01745F) { // Update for 1 degree differences + Matrix atomRotationForSubgroup(rootParentAsMOSR->FacingAngle(GetRotAngle()) - rootParentAsMOSR->FacingAngle(rootParentAsMOSR->GetRotAngle())); + Vector atomOffsetForSubgroup(g_SceneMan.ShortestDistance(rootParentAsMOSR->GetPos(), m_Pos, g_SceneMan.SceneWrapsX()).FlipX(rootParentAsMOSR->IsHFlipped())); + Matrix rootParentAngleToUse(rootParentAsMOSR->GetRotAngle() * rootParentAsMOSR->GetFlipFactor()); + atomOffsetForSubgroup /= rootParentAngleToUse; + rootParentAsMOSR->GetAtomGroup()->UpdateSubAtoms(GetAtomSubgroupID(), atomOffsetForSubgroup, atomRotationForSubgroup); + } } + m_PrevRotAngleOffset = currentRotAngleOffset; } m_DeepCheck = false; - m_PrevRotAngleOffset = currentRotAngleOffset; } MOSRotating::Update(); diff --git a/Source/Entities/MOSParticle.cpp b/Source/Entities/MOSParticle.cpp index 848c77f08..7a1aa246d 100644 --- a/Source/Entities/MOSParticle.cpp +++ b/Source/Entities/MOSParticle.cpp @@ -126,12 +126,6 @@ void MOSParticle::Travel() { m_Atom->ClearMOIDIgnoreList(); if (m_SpriteAnimMode == ONCOLLIDE) { - // Change angular velocity after collision. - if (hitCount >= 1) { - m_AngularVel *= 0.5F * velMag * RandomNormalNum(); - m_AngularVel = -m_AngularVel; - } - // TODO: Rework this so it's less incomprehensible black magic math and not driven by AngularVel. double newFrame = m_Rotation.GetRadAngle(); diff --git a/Source/Entities/MOSprite.cpp b/Source/Entities/MOSprite.cpp index ef43a25f8..4d7e492f8 100644 --- a/Source/Entities/MOSprite.cpp +++ b/Source/Entities/MOSprite.cpp @@ -269,8 +269,6 @@ bool MOSprite::HitTestAtPixel(int pixelX, int pixelY, bool validOnly) const { } void MOSprite::SetFrame(unsigned int newFrame) { - if (newFrame < 0) - newFrame = 0; if (newFrame >= m_FrameCount) newFrame = m_FrameCount - 1; diff --git a/Source/GUI/GUIBanner.cpp b/Source/GUI/GUIBanner.cpp index d0b435c66..ced62b19c 100644 --- a/Source/GUI/GUIBanner.cpp +++ b/Source/GUI/GUIBanner.cpp @@ -20,7 +20,6 @@ GUIBanner::GUIBanner() { m_BannerPosY = 240; m_FlySpeed = 1500; m_FlySpacing = 100; - m_BannerChars.clear(); m_AnimMode = BLINKING; m_AnimState = NOTSTARTED; m_TotalAnimTimer.Reset(); @@ -328,8 +327,6 @@ void GUIBanner::Draw(BITMAP* pTargetBitmap) { } if (c == '\t') { } - if (c < 0) - c += m_CharIndexCap; if (c < 32 || c >= m_CharIndexCap) continue; @@ -362,8 +359,6 @@ int GUIBanner::CalculateWidth(const std::string text, FontMode mode) const { */ continue; } - if (c < 0) - c += m_CharIndexCap; if (c < 32 || c >= m_CharIndexCap) continue; diff --git a/Source/GUI/GUIFont.cpp b/Source/GUI/GUIFont.cpp index 717afd4e7..d97be5c8a 100644 --- a/Source/GUI/GUIFont.cpp +++ b/Source/GUI/GUIFont.cpp @@ -134,9 +134,6 @@ void GUIFont::Draw(GUIBitmap* Bitmap, int X, int Y, const std::string& Text, uns if (c == '\t') { X += m_Characters[' '].m_Width * 4; } - if (c < 0) { - c += m_CharIndexCap; - } if (c < 32 || c >= m_CharIndexCap) { continue; } @@ -270,9 +267,6 @@ int GUIFont::CalculateWidth(const std::string& Text) { Width = 0; continue; } - if (c < 0) { - c += m_CharIndexCap; - } if (c < 32 || c >= m_CharIndexCap) { continue; diff --git a/Source/Menus/MetagameGUI.cpp b/Source/Menus/MetagameGUI.cpp index 9295e6018..5ef6109db 100644 --- a/Source/Menus/MetagameGUI.cpp +++ b/Source/Menus/MetagameGUI.cpp @@ -157,7 +157,7 @@ void MetagameGUI::Clear() { m_AnimMetaPlayer = Players::NoPlayer; m_AnimDefenseTeam = Activity::NoTeam; m_AnimActivityChange = false; - Scene* m_pAnimScene = 0; + m_pAnimScene = 0; m_AnimRatio = 0; m_AnimProgress = 0; m_AnimTotalFunds = 0; @@ -4965,24 +4965,19 @@ void MetagameGUI::UpdatePostBattleResidents(float progress) { m_apPlayerBrainTravelLabel[mp]->SetVisible(progress <= 0); if (progress <= 0) { - // Death mask - if (progress > 0) - std::snprintf(str, sizeof(str), "%c", -26); // Brain with line blinking over it and the funds still showing - else { - if (quadIndex <= 1) { - if (m_aAnimDestroyed[mp]) - std::snprintf(str, sizeof(str), "%c %.0f oz ", -58, m_aBattleFunds[mp]); - else - std::snprintf(str, sizeof(str), "%c %.0f oz %c%c", -58, m_aBattleFunds[mp], m_aBattleAttacker[mp] ? -46 : -47, -26); - // std::snprintf(str, sizeof(str), "%c %.0f oz %c", -58, m_aBattleFunds[mp], m_AnimTimer2.AlternateReal(200) ? -39 : -26); - } else { - if (m_aAnimDestroyed[mp]) - std::snprintf(str, sizeof(str), " %c %.0f oz", -58, m_aBattleFunds[mp]); - else - std::snprintf(str, sizeof(str), "%c%c %c %.0f oz", m_aAnimDestroyed[mp] ? ' ' : -26, m_aBattleAttacker[mp] ? -46 : -47, -58, m_aBattleFunds[mp]); - // std::snprintf(str, sizeof(str), "%c %c %.0f oz", m_AnimTimer2.AlternateReal(200) ? -39 : -26, -58, m_aBattleFunds[mp]); - } + if (quadIndex <= 1) { + if (m_aAnimDestroyed[mp]) + std::snprintf(str, sizeof(str), "%c %.0f oz ", -58, m_aBattleFunds[mp]); + else + std::snprintf(str, sizeof(str), "%c %.0f oz %c%c", -58, m_aBattleFunds[mp], m_aBattleAttacker[mp] ? -46 : -47, -26); + // std::snprintf(str, sizeof(str), "%c %.0f oz %c", -58, m_aBattleFunds[mp], m_AnimTimer2.AlternateReal(200) ? -39 : -26); + } else { + if (m_aAnimDestroyed[mp]) + std::snprintf(str, sizeof(str), " %c %.0f oz", -58, m_aBattleFunds[mp]); + else + std::snprintf(str, sizeof(str), "%c%c %c %.0f oz", m_aAnimDestroyed[mp] ? ' ' : -26, m_aBattleAttacker[mp] ? -46 : -47, -58, m_aBattleFunds[mp]); + // std::snprintf(str, sizeof(str), "%c %c %.0f oz", m_AnimTimer2.AlternateReal(200) ? -39 : -26, -58, m_aBattleFunds[mp]); } m_apPlayerBrainTravelLabel[mp]->SetText(str); m_apPlayerBrainTravelLabel[mp]->SetToolTip("The specific brain that is being sent in to attack this place, and the funds he has been budgeted to do so with."); @@ -5634,7 +5629,7 @@ void MetagameGUI::PlayerTextIndication(int metaPlayer, std::string text, const V void MetagameGUI::FundsChangeIndication(int metaPlayer, float change, const Vector& screenPos, double animLengthMS) { char str[256]; - std::snprintf(str, sizeof(str), change >= 1.0 ? "%c +%.0f oz" : (change <= -1.0 ? "%c %.0f oz" : "%c %.0f oz"), -58, change); + std::snprintf(str, sizeof(str), change >= 1.0 ? "%c +%.0f oz" : "%c %.0f oz", -58, change); m_apFundsChangeLabel[metaPlayer]->SetText(str); m_apFundsChangeLabel[metaPlayer]->SetHAlignment(GUIFont::Right); m_apFundsChangeLabel[metaPlayer]->SetVAlignment(GUIFont::Top); diff --git a/Source/Menus/MetagameGUI.h b/Source/Menus/MetagameGUI.h index 50b005f43..309bff47a 100644 --- a/Source/Menus/MetagameGUI.h +++ b/Source/Menus/MetagameGUI.h @@ -93,6 +93,8 @@ namespace RTE { m_ChannelHeight = channelHeight; m_CircleSize = circleSize; m_Square = squareSite; + m_FundsAmount = 0.f; + m_FundsTarget = 0.f; } }; diff --git a/Source/Menus/SceneEditorGUI.cpp b/Source/Menus/SceneEditorGUI.cpp index 7e2b61bc0..c16e25183 100644 --- a/Source/Menus/SceneEditorGUI.cpp +++ b/Source/Menus/SceneEditorGUI.cpp @@ -529,7 +529,7 @@ void SceneEditorGUI::Update() { } // Apply the team to the current actor, if applicable - if (m_pCurrentObject && m_DrawCurrentObject) { + if (m_DrawCurrentObject) { // Set the team of SceneObject based on what's been selected // Only if full featured mode, otherwise it's based on the controller when placed if (m_FeatureSet == ONLOADEDIT)