Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit c1a0903

Browse files
authored
Merge pull request #96 from cortex-command-community/FrameMan-Breakdown
FrameMan Breakdown
2 parents 1f3f768 + aff1339 commit c1a0903

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4069
-5339
lines changed

Activities/ActorEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void ActorEditor::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int wh
339339
}
340340

341341
// Clear out annoying blooms
342-
g_SceneMan.ClearPostEffects();
342+
g_PostProcessMan.ClearScenePostEffects();
343343

344344
m_pPicker->Draw(pTargetBitmap);
345345
m_pPieMenu->Draw(pTargetBitmap, targetPos);

Activities/EditorActivity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ int EditorActivity::Start()
209209
return error;
210210

211211
// Clear the post effects
212-
g_SceneMan.ClearPostEffects();
212+
g_PostProcessMan.ClearScenePostEffects();
213213

214214
// Clear the screen messages
215215
g_FrameMan.ClearScreenText();

Activities/EditorActivity.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "GUISound.h"
1818
#include "RTETools.h"
1919
#include "ActivityMan.h"
20+
#include "PostProcessMan.h"
2021

2122
namespace RTE
2223
{

Activities/GameActivity.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "ConsoleMan.h"
2121
#include "PresetMan.h"
2222
#include "DataModule.h"
23+
#include "PostProcessMan.h"
2324
#include "Controller.h"
2425
#include "Scene.h"
2526
#include "Actor.h"
@@ -2141,7 +2142,7 @@ void GameActivity::Update()
21412142

21422143
void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int which)
21432144
{
2144-
if (which < 0 || which >= MAXSCREENCOUNT)
2145+
if (which < 0 || which >= c_MaxScreenCount)
21452146
return;
21462147

21472148
char str[512];
@@ -2374,7 +2375,7 @@ void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int w
23742375
Vector center = m_ActorCursor[PoS] - targetPos;
23752376
circle(pTargetBitmap, center.m_X, center.m_Y, m_CursorTimer.AlternateReal(150) ? 6 : 8, g_YellowGlowColor);
23762377
// Add pixel glow area around it, in scene coordinates
2377-
g_SceneMan.RegisterGlowArea(m_ActorCursor[PoS], 10);
2378+
g_PostProcessMan.RegisterGlowArea(m_ActorCursor[PoS], 10);
23782379
/* Crosshairs
23792380
putpixel(pTargetBitmap, center.m_X, center.m_Y, g_YellowGlowColor);
23802381
hline(pTargetBitmap, center.m_X - 5, center.m_Y, center.m_X - 2, g_YellowGlowColor);
@@ -2391,7 +2392,7 @@ void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int w
23912392
circlefill(pTargetBitmap, center.m_X, center.m_Y, 2, g_YellowGlowColor);
23922393
// putpixel(pTargetBitmap, center.m_X, center.m_Y, g_YellowGlowColor);
23932394
// Add pixel glow area around it, in scene coordinates
2394-
g_SceneMan.RegisterGlowArea(m_ActorCursor[PoS], 10);
2395+
g_PostProcessMan.RegisterGlowArea(m_ActorCursor[PoS], 10);
23952396

23962397
// Draw a line from the last set waypoint to the cursor
23972398
if (m_pControlledActor[PoS] && g_MovableMan.IsActor(m_pControlledActor[PoS]))
@@ -2473,13 +2474,13 @@ void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int w
24732474
unwrappedPos = m_ActorCursor[PoS] + Vector(sceneWidth , 0);
24742475
else
24752476
unwrappedPos = m_ActorCursor[PoS] - Vector(sceneWidth , 0);
2476-
g_SceneMan.RegisterGlowArea(unwrappedPos, 10);
2477+
g_PostProcessMan.RegisterGlowArea(unwrappedPos, 10);
24772478
}
24782479
}
24792480
else
24802481
unwrappedPos = m_ActorCursor[PoS];
24812482

2482-
g_SceneMan.RegisterGlowArea(m_ActorCursor[PoS], 10);
2483+
g_PostProcessMan.RegisterGlowArea(m_ActorCursor[PoS], 10);
24832484

24842485
//Glowing dotted circle version
24852486
int dots = 2 * c_PI * radius / 25;//5 + (int)(radius / 10);
@@ -2519,7 +2520,7 @@ void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int w
25192520
}
25202521

25212522
circlefill(pTargetBitmap, dotDrawPos.m_X, dotDrawPos.m_Y, 1, g_YellowGlowColor);
2522-
g_SceneMan.RegisterGlowArea(dotPos, 3);
2523+
g_PostProcessMan.RegisterGlowArea(dotPos, 3);
25232524
}
25242525
}
25252526
}

Activities/MultiplayerServerLobby.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ namespace RTE {
350350
ContentFile defaultPreview("Base.rte/GUIs/DefaultPreview.bmp");
351351
m_pDefaultPreviewBitmap = defaultPreview.LoadAndReleaseBitmap();
352352

353-
clear_to_color(m_pScenePreviewBitmap, g_KeyColor);
353+
clear_to_color(m_pScenePreviewBitmap, g_MaskColor);
354354

355355
m_apPlayerIcons[0] = dynamic_cast<const Icon *>(g_PresetMan.GetEntityPreset("Icon", "Device Gamepad 1"));
356356
m_apPlayerIcons[1] = dynamic_cast<const Icon *>(g_PresetMan.GetEntityPreset("Icon", "Device Gamepad 2"));
@@ -1316,7 +1316,7 @@ namespace RTE {
13161316
BITMAP * drawBitmap = m_pUIDrawBitmap;
13171317
BITMAP * finalDestBitmap = 0;
13181318

1319-
clear_to_color(drawBitmap, g_KeyColor);
1319+
clear_to_color(drawBitmap, g_MaskColor);
13201320

13211321
// Store offset set for player 0
13221322
int baseOffsetX = m_pRootBox->GetXPos();

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Valid editor names are: `ActorEditor`, `GibEditor`, `SceneEditor`, `AreaEditor`
2222
YourKeyName = YourStringValue
2323
```
2424
`YourKeyName` is a string value and is not limited to just numbers.
25+
26+
- New `Settings.ini` property `AdvancedPerformanceStats = 0/1` to disable/enable the performance counter graphs (enabled by default).
2527

2628
### Changed
2729

@@ -54,6 +56,27 @@ They must be added using `... = SoundContainer`, and individual sounds for them
5456
...
5557
```
5658

59+
- `FrameMan` broken down to 4 managers. New managers are:
60+
`PerformanceMan` to handle all performance stats and measurements.
61+
`PostProcessMan` to handle all post-processing (glows).
62+
`PrimitiveMan` to handle all lua primitive drawing.
63+
64+
- Post-processing (glow effects) is now enabled at all times with no option to disable.
65+
66+
- All lua primitive draw calls are now called from `PrimitiveMan`.
67+
For example: `FrameMan:DrawLinePrimitive()` is now `PrimitiveMan:DrawLinePrimitive()`.
68+
69+
- Resolution multiplier properties (`NxWindowed` and `NxFullscreen`) in settings merged into a single property `ResolutionMultiplier`.
70+
71+
- Incompatible/bad resolution settings will be overriden at startup with messages expaining the issue instead of multiple mode switches and eventually a reset to default VGA.
72+
Reset to defaults (now 960x540) will happen only on horrible aspect ratio or if you managed to really destroy something.
73+
74+
- You can no longer toggle native fullscreen mode from the settings menu or ini. Instead, either select your desktop resolution at 1X mode or desktop resolution divided by 2 at 2X mode for borderless fullscreen windowed mode.
75+
Due to limitations in Allegro 4, changing the actual resolution from within the game still requires a restart.
76+
77+
- If the current game resolution is half the desktop resolution or less, you will be able to instantly switch between 1X and 2X resolution multiplier modes in the settings without screen flicker or delay.
78+
If the conditions are not met, the mode switch button will show `Unavailable`.
79+
5780
### Fixed
5881

5982
- Fixed LuaBind being all sorts of messed up. All lua bindings now work properly like they were before updating to the v141 toolset.
@@ -78,6 +101,18 @@ They must be added using `... = SoundContainer`, and individual sounds for them
78101

79102
- Removed all OSX/Linux related code and files because we don't care. See [Liberated Cortex](https://github.com/liberated-cortex) for working Linux port.
80103

104+
- Removed a bunch of low-level `FrameMan` lua bindings:
105+
`FrameMan:ResetSplitScreens`, `FrameMan:PPM` setter, `FrameMan:ResX/Y`, `FrameMan:HSplit/VSplit`, `FrameMan:GetPlayerFrameBufferWidth/Height`, `FrameMan:IsFullscreen`, `FrameMan:ToggleFullScreen`,
106+
`FrameMan:ClearBackbuffer8/32`, `FrameMan:ClearPostEffects`, `FrameMan:ResetFrameTimer`, `FrameMan:ShowPerformanceStats`.
107+
108+
- Native fullscreen mode has been removed due to poor performance compared to windowed/borderless mode and various input device issues.
109+
The version of Allegro we're running is pretty old now (released in 2007) and probably doesn't properly support/utilize newer features and APIs leading to these issues.
110+
The minimal amount of hardware acceleration CC has is still retained through Windows' DWM and that evidently does a better job.
111+
112+
- Removed now obsolete `Settings.ini` properties:
113+
Post-processing: `TrueColorMode`, `PostProcessing`, `PostPixelGlow`.
114+
Native fullscreen mode: `Fullscreen`, `NxWindowed`, `NxFullscreen`, `ForceSoftwareGfxDriver`, `ForceSafeGfxDriver`.
115+
81116
***
82117

83118
## [0.0.1.0] - 2020-01-27

Entities/AEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ void AEmitter::Draw(BITMAP *pTargetBitmap,
655655
emitPos.RadRotate(m_HFlipped ? c_PI + m_Rotation.GetRadAngle() - m_EmitAngle.GetRadAngle() : m_Rotation.GetRadAngle() + m_EmitAngle.GetRadAngle());
656656
emitPos = m_Pos + RotateOffset(m_EmissionOffset) + emitPos;
657657
if(!g_SceneMan.ObscuredPoint(emitPos))
658-
g_SceneMan.RegisterPostEffect(emitPos, m_pFlash->GetScreenEffect(), m_pFlash->GetScreenEffectHash(), 55 + 200 * PosRand(), m_pFlash->GetEffectRotAngle());
658+
g_PostProcessMan.RegisterPostEffect(emitPos, m_pFlash->GetScreenEffect(), m_pFlash->GetScreenEffectHash(), 55 + 200 * PosRand(), m_pFlash->GetEffectRotAngle());
659659
// g_SceneMan.RegisterPostEffect(emitPos, m_pFlash->GetScreenEffect(), 55 + (200 * PosRand() * ((float)1 - ((float)m_AgeTimer.GetElapsedSimTimeMS() / (float)m_Lifetime))));
660660
}
661661
}

Entities/AHuman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4534,7 +4534,7 @@ void AHuman::DrawThrowingReticule(BITMAP *pTargetBitmap, const Vector &targetPos
45344534
points[i] += m_pFGArm->GetParentOffset();
45354535

45364536
// Put the flickering glows on the reticule dots, in absolute scene coordinates
4537-
g_SceneMan.RegisterGlowDotEffect(points[i], YellowDot, 55 + 100 * PosRand());
4537+
g_PostProcessMan.RegisterGlowDotEffect(points[i], YellowDot, 55 + 100 * PosRand());
45384538

45394539
putpixel(pTargetBitmap, points[i].m_X - targetPos.m_X, points[i].m_Y - targetPos.m_Y, g_YellowGlowColor);
45404540
}

Entities/Actor.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "MOPixel.h"
2929
#include "Scene.h"
3030
#include "SettingsMan.h"
31+
#include "PerformanceMan.h"
3132

3233
#include "GUI/GUI.h"
3334
#include "GUI/GUIFont.h"
@@ -1291,9 +1292,9 @@ bool Actor::UpdateAIScripted() {
12911292

12921293
int status = !g_LuaMan.ExpressionIsTrue(m_ScriptPresetName, false) ? ReloadScripts() : 0;
12931294
status = (status >= 0 && !ObjectScriptsInitialized()) ? InitializeObjectScripts() : status;
1294-
g_FrameMan.StartPerformanceMeasurement(FrameMan::PERF_ACTORS_AI);
1295+
g_PerformanceMan.StartPerformanceMeasurement(PerformanceMan::PERF_ACTORS_AI);
12951296
status = (status >= 0) ? RunScriptedFunctionInAppropriateScripts("UpdateAI", false, true) : status;
1296-
g_FrameMan.StopPerformanceMeasurement(FrameMan::PERF_ACTORS_AI);
1297+
g_PerformanceMan.StopPerformanceMeasurement(PerformanceMan::PERF_ACTORS_AI);
12971298

12981299
return status >= 0;
12991300
}
@@ -1951,7 +1952,7 @@ void Actor::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
19511952
waypoint = (*vItr).first - targetPos;
19521953
circlefill(pTargetBitmap, waypoint.m_X, waypoint.m_Y, 2, g_YellowGlowColor);
19531954
// Add pixel glow area around it, in scene coordinates
1954-
g_SceneMan.RegisterGlowArea((*vItr).first, 5);
1955+
g_PostProcessMan.RegisterGlowArea((*vItr).first, 5);
19551956
}
19561957

19571958
// Draw line from the last movetarget on the current path to the first waypoint in queue after that
@@ -1979,7 +1980,7 @@ void Actor::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
19791980
waypoint = m_MovePath.back() - targetPos;
19801981
circlefill(pTargetBitmap, waypoint.m_X, waypoint.m_Y, 2, g_YellowGlowColor);
19811982
// Add pixel glow area around it, in scene coordinates
1982-
g_SceneMan.RegisterGlowArea(m_MovePath.back(), 5);
1983+
g_PostProcessMan.RegisterGlowArea(m_MovePath.back(), 5);
19831984
}
19841985
// If no points left on movepath, then draw straight line to the movetarget
19851986
else
@@ -1990,7 +1991,7 @@ void Actor::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
19901991
waypoint = m_MoveTarget - targetPos;
19911992
circlefill(pTargetBitmap, waypoint.m_X, waypoint.m_Y, 2, g_YellowGlowColor);
19921993
// Add pixel glow area around it, in scene coordinates
1993-
g_SceneMan.RegisterGlowArea(m_MoveTarget, 5);
1994+
g_PostProcessMan.RegisterGlowArea(m_MoveTarget, 5);
19941995
}
19951996
}
19961997

Entities/Arm.cpp

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -518,17 +518,7 @@ void Arm::Update()
518518
else
519519
{
520520
Vector handTarget = g_SceneMan.ShortestDistance(m_JointPos, m_TargetPoint);
521-
/*
522-
if (m_PresetName == "Player BG Arm") {
523-
char str[64];
524-
sprintf_s(str, sizeof(str), "TargetOffset: %f, %f", m_TargetPoint.m_X, m_TargetPoint.m_Y);
525-
g_FrameMan.DrawText(g_SceneMan.GetMOBitmap(), str, m_Pos + Vector(4, -140), false);
526-
sprintf_s(str, sizeof(str), "m_Pos: %f, %f", m_Pos.m_X, m_Pos.m_Y);
527-
g_FrameMan.DrawText(g_SceneMan.GetMOBitmap(), str, m_Pos + Vector(4, -120), false);
528-
sprintf_s(str, sizeof(str), "handTarget: %f, %f", handTarget.m_X, handTarget.m_Y);
529-
g_FrameMan.DrawText(g_SceneMan.GetMOBitmap(), str, m_Pos + Vector(4, -100), false);
530-
}
531-
*/
521+
532522
// Check if handTarget is within arm's length.
533523
// TEMP the +3 is a hack! improve
534524
if (handTarget.GetMagnitude() <= m_MaxLength || !m_WillIdle/* && handTarget.GetFloored() != m_HandOffset.GetFloored()*/)
@@ -647,15 +637,6 @@ void Arm::Draw(BITMAP *pTargetBitmap,
647637

648638
if (m_pHeldMO && ((!m_pHeldMO->IsHeldDevice() && !m_pHeldMO->IsThrownDevice()) || m_pHeldMO->IsDrawnAfterParent()))
649639
m_pHeldMO->Draw(pTargetBitmap, targetPos, mode, onlyPhysical);
650-
/*
651-
#ifdef DEBUG_BUILD
652-
if (m_PresetName == "Player BG Arm") {
653-
char str[64];
654-
sprintf_s(str, sizeof(str), "m_Pos in draw: %f, %f", m_Pos.m_X, m_Pos.m_Y);
655-
g_FrameMan.DrawText(pTargetBitmap, str, m_Pos + Vector(4, -80), false);
656-
}
657-
#endif
658-
*/
659640
}
660641

661642

@@ -680,15 +661,6 @@ void Arm::DrawHand(BITMAP *pTargetBitmap,
680661
draw_sprite(pTargetBitmap, m_pHand, handPos.m_X, handPos.m_Y);
681662
else
682663
draw_sprite_h_flip(pTargetBitmap, m_pHand, handPos.m_X, handPos.m_Y);
683-
/*
684-
#ifdef DEBUG_BUILD
685-
if (m_PresetName == "Player BG Arm") {
686-
char str[64];
687-
sprintf_s(str, sizeof(str), "HandPos in hand draw: %f, %f", handPos.m_X, handPos.m_Y);
688-
g_FrameMan.DrawText(pTargetBitmap, str, handPos + Vector(4, -40), false);
689-
}
690-
#endif
691-
*/
692664
}
693665

694666
} // namespace RTE

0 commit comments

Comments
 (0)