diff --git a/Entities/MOSParticle.cpp b/Entities/MOSParticle.cpp
index ccff7f968..8fc9d7f30 100644
--- a/Entities/MOSParticle.cpp
+++ b/Entities/MOSParticle.cpp
@@ -151,6 +151,14 @@ namespace RTE {
if (m_pScreenEffect) { SetPostScreenEffectToDraw(); }
}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ void MOSParticle::Update() {
+ MOSprite::Update();
+
+ if (m_pScreenEffect) { SetPostScreenEffectToDraw(); }
+ }
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void MOSParticle::Draw(BITMAP *targetBitmap, const Vector &targetPos, DrawMode mode, bool onlyPhysical) const {
diff --git a/Entities/MOSParticle.h b/Entities/MOSParticle.h
index 5b8f8d35c..3d40c7dbb 100644
--- a/Entities/MOSParticle.h
+++ b/Entities/MOSParticle.h
@@ -130,6 +130,11 @@ namespace RTE {
/// Whether the MOSParticle should immediately halt any travel going on after this sinkage.
bool OnSink(HitData &hd) override { return false; }
+ ///
+ /// Updates this MOParticle. Supposed to be done every frame.
+ ///
+ void Update() override;
+
///
/// Draws this MOSParticle's current graphical representation to a BITMAP of choice.
///
diff --git a/Managers/PostProcessMan.cpp b/Managers/PostProcessMan.cpp
index e31b43c74..4eaef59c3 100644
--- a/Managers/PostProcessMan.cpp
+++ b/Managers/PostProcessMan.cpp
@@ -177,7 +177,7 @@ namespace RTE {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void PostProcessMan::AdjustEffectsPosToPlayerScreen(int playerScreen, BITMAP *targetBitmap, const Vector &targetBitmapOffset, std::list &screenRelativeEffectsList, std::list &screenRelativeGlowBoxesList) const {
+ void PostProcessMan::AdjustEffectsPosToPlayerScreen(int playerScreen, BITMAP *targetBitmap, const Vector &targetBitmapOffset, std::list &screenRelativeEffectsList, std::list &screenRelativeGlowBoxesList) {
int screenOcclusionOffsetX = g_CameraMan.GetScreenOcclusion(playerScreen).GetFloorIntX();
int screenOcclusionOffsetY = g_CameraMan.GetScreenOcclusion(playerScreen).GetFloorIntY();
int occludedOffsetX = targetBitmap->w + screenOcclusionOffsetX;
@@ -185,21 +185,21 @@ namespace RTE {
// Copy post effects received by client if in network mode
if (g_FrameMan.GetDrawNetworkBackBuffer()) {
- g_PostProcessMan.GetNetworkPostEffectsList(0, screenRelativeEffectsList);
+ GetNetworkPostEffectsList(0, screenRelativeEffectsList);
}
// Adjust for the player screen's position on the final buffer
for (const PostEffect &postEffect : screenRelativeEffectsList) {
// Make sure we won't be adding any effects to a part of the screen that is occluded by menus and such
if (postEffect.m_Pos.GetFloorIntX() > screenOcclusionOffsetX && postEffect.m_Pos.GetFloorIntY() > screenOcclusionOffsetY && postEffect.m_Pos.GetFloorIntX() < occludedOffsetX && postEffect.m_Pos.GetFloorIntY() < occludedOffsetY) {
- g_PostProcessMan.GetPostScreenEffectsList()->push_back(PostEffect(postEffect.m_Pos + targetBitmapOffset, postEffect.m_Bitmap, postEffect.m_BitmapHash, postEffect.m_Strength, postEffect.m_Angle));
+ m_PostSceneEffects.emplace_back(postEffect.m_Pos + targetBitmapOffset, postEffect.m_Bitmap, postEffect.m_BitmapHash, postEffect.m_Strength, postEffect.m_Angle);
}
}
// Adjust glow areas for the player screen's position on the final buffer
for (const Box &glowBox : screenRelativeGlowBoxesList) {
- g_PostProcessMan.GetPostScreenGlowBoxesList()->push_back(glowBox);
+ m_PostScreenGlowBoxes.push_back(glowBox);
// Adjust each added glow area for the player screen's position on the final buffer
- g_PostProcessMan.GetPostScreenGlowBoxesList()->back().m_Corner += targetBitmapOffset;
+ m_PostScreenGlowBoxes.back().m_Corner += targetBitmapOffset;
}
}
@@ -208,9 +208,6 @@ namespace RTE {
void PostProcessMan::RegisterPostEffect(const Vector &effectPos, BITMAP *effect, size_t hash, int strength, float angle) {
// These effects get applied when there's a drawn frame that followed one or more sim updates.
// They are not only registered on drawn sim updates; flashes and stuff could be missed otherwise if they occur on undrawn sim updates.
- if (effect && !effect->extra) {
- LazyInitBitmap(effect);
- }
if (effect && g_TimerMan.SimUpdatesSinceDrawn() >= 0) {
m_PostSceneEffects.push_back(PostEffect(effectPos, effect, hash, strength, angle));
@@ -516,7 +513,7 @@ namespace RTE {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void PostProcessMan::DrawPostScreenEffects() const {
+ void PostProcessMan::DrawPostScreenEffects() {
BITMAP *effectBitmap = nullptr;
float effectPosX = 0;
float effectPosY = 0;
@@ -530,6 +527,9 @@ namespace RTE {
for (const PostEffect &postEffect : m_PostScreenEffects) {
if (postEffect.m_Bitmap) {
+ if (!postEffect.m_Bitmap->extra) {
+ LazyInitBitmap(postEffect.m_Bitmap);
+ }
effectBitmap = postEffect.m_Bitmap;
effectStrength = postEffect.m_Strength / 255.f;
effectPosX = postEffect.m_Pos.m_X;
diff --git a/Managers/PostProcessMan.h b/Managers/PostProcessMan.h
index 558fc13c1..7fa4a8e89 100644
--- a/Managers/PostProcessMan.h
+++ b/Managers/PostProcessMan.h
@@ -95,16 +95,10 @@ namespace RTE {
/// The position of the specified player's draw screen on the backbuffer.
/// List of the specified player's accumulated post effects for this frame.
/// List of the specified player's accumulated glow boxes for this frame.
- void AdjustEffectsPosToPlayerScreen(int playerScreen, BITMAP *targetBitmap, const Vector &targetBitmapOffset, std::list &screenRelativeEffectsList, std::list &screenRelativeGlowBoxesList) const;
+ void AdjustEffectsPosToPlayerScreen(int playerScreen, BITMAP *targetBitmap, const Vector &targetBitmapOffset, std::list &screenRelativeEffectsList, std::list &screenRelativeGlowBoxesList);
#pragma endregion
#pragma region Post Effect Handling
- ///
- /// Gets the list of effects to apply at the end of each frame.
- ///
- /// The list of effects to apply at the end of each frame.
- std::list * GetPostScreenEffectsList() { return &m_PostScreenEffects; }
-
///
/// Registers a post effect to be added at the very last stage of 32bpp rendering by the FrameMan.
///
@@ -136,11 +130,6 @@ namespace RTE {
#pragma endregion
#pragma region Post Pixel Glow Handling
- ///
- /// Gets the list of areas that will be processed with glow.
- ///
- /// The list of areas that will be processed with glow.
- std::list * GetPostScreenGlowBoxesList() { return &m_PostScreenGlowBoxes; }
///
/// Registers a specific IntRect to be post-processed and have special pixel colors lit up by glow effects in it.
@@ -284,7 +273,7 @@ namespace RTE {
///
/// Draws all the glow effects registered for this frame. This is called from PostProcess().
///
- void DrawPostScreenEffects() const;
+ void DrawPostScreenEffects();
#pragma endregion
///
diff --git a/Managers/UInputMan.cpp b/Managers/UInputMan.cpp
index 8ac52353e..167784b56 100644
--- a/Managers/UInputMan.cpp
+++ b/Managers/UInputMan.cpp
@@ -651,16 +651,7 @@ namespace RTE {
return false;
}
if (IsInMultiplayerMode()) {
- if (whichPlayer < Players::PlayerOne || whichPlayer >= Players::MaxPlayerCount) {
- for (int player = Players::PlayerOne; player < Players::MaxPlayerCount; player++) {
- if (m_NetworkServerChangedMouseButtonState[player][whichButton]) {
- return m_NetworkServerChangedMouseButtonState[player][whichButton];
- }
- }
- return m_NetworkServerChangedMouseButtonState[Players::PlayerOne][whichButton];
- } else {
- return m_NetworkServerChangedMouseButtonState[whichPlayer][whichButton];
- }
+ return GetNetworkMouseButtonState(whichPlayer, whichButton, whichState);
}
switch (whichState) {
@@ -676,6 +667,30 @@ namespace RTE {
}
}
+ bool UInputMan::GetNetworkMouseButtonState(int whichPlayer, int whichButton, InputState whichState) const {
+
+ if (whichPlayer == Players::NoPlayer || whichPlayer >= Players::MaxPlayerCount) {
+ for (int player = Players::PlayerOne; player < Players::MaxPlayerCount; ++player) {
+ if (GetNetworkMouseButtonState(player, whichButton, whichState)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ switch (whichState) {
+ case InputState::Held:
+ return m_NetworkServerPreviousMouseButtonState[whichPlayer][whichButton];
+ case InputState::Pressed:
+ return m_NetworkServerPreviousMouseButtonState[whichPlayer][whichButton] && m_NetworkServerChangedMouseButtonState[whichPlayer][whichButton];
+ case InputState::Released:
+ return !m_NetworkServerPreviousMouseButtonState[whichPlayer][whichButton] && m_NetworkServerChangedMouseButtonState[whichPlayer][whichButton];
+ default:
+ RTEAbort("Undefined InputState value passed in. See InputState enumeration.");
+ return false;
+ }
+ }
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool UInputMan::GetJoystickButtonState(int whichJoy, int whichButton, InputState whichState) const {
diff --git a/Managers/UInputMan.h b/Managers/UInputMan.h
index b0d12f3aa..65d2950ad 100644
--- a/Managers/UInputMan.h
+++ b/Managers/UInputMan.h
@@ -757,6 +757,15 @@ namespace RTE {
/// Whether the mouse button is in the specified state or not.
bool GetMouseButtonState(int whichPlayer, int whichButton, InputState whichState) const;
+ ///
+ /// Gets whether a multiplayer mouse button is in the specified state.
+ ///
+ /// Which player to check for. See Players enumeration.
+ /// Which mouse button to check for. See MouseButtons enumeration.
+ /// Which state to check for. See InputState enumeration.
+ /// Whether the mouse button is in the specified state or not.
+ bool GetNetworkMouseButtonState(int whichPlayer, int whichButton, InputState whichState) const;
+
///
/// Gets whether a joystick button is in the specified state.
///