Skip to content

Commit e9a23ad

Browse files
Merge branch 'browncoat-mission' of https://github.com/cortex-command-community/Cortex-Command-Community-Project into browncoat-mission
2 parents 843c122 + 613ab84 commit e9a23ad

File tree

18 files changed

+4579
-4606
lines changed

18 files changed

+4579
-4606
lines changed

Data/Base.rte/Shaders/PostProcess.frag

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#version 130
22

33
in vec2 textureUV;
4+
in vec4 vertexColor;
45

56
out vec4 FragColor;
67

@@ -18,5 +19,5 @@ vec4 texture2DAA(sampler2D tex, vec2 uv) {
1819
}
1920

2021
void main() {
21-
FragColor = texture2DAA(rteTexture, textureUV) * rteColor;
22+
FragColor = texture2DAA(rteTexture, textureUV) * rteColor * vertexColor;
2223
}

Data/Base.rte/Shaders/PostProcess.vert

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
in vec3 rteVertexPosition;
44
in vec2 rteVertexTexUV;
5+
in vec4 rteVertexColor;
56

67
out vec2 textureUV;
8+
out vec4 vertexColor;
79

810
uniform mat4 rteModel;
911
uniform mat4 rteProjection;
1012

1113
void main() {
1214
gl_Position = rteProjection * rteModel * vec4(rteVertexPosition, 1.0);
15+
vertexColor = rteVertexColor;
1316
textureUV = rteVertexTexUV;
1417
}

Data/Browncoats.rte/Scenes/Yskely Refineryv3.ini

Lines changed: 42 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -291033,160 +291033,76 @@ AddScene = Scene
291033291033
AddArea = Area
291034291034
AddBox = Box
291035291035
Corner = Vector
291036-
X = 623.801025
291037-
Y = 5274.319824
291038-
Width = 660.000000
291039-
Height = 273.000000
291040-
AddBox = Box
291041-
Corner = Vector
291042-
X = 1920.400024
291043-
Y = 5265.229980
291044-
Width = 422.000000
291045-
Height = 271.000000
291046-
AddBox = Box
291047-
Corner = Vector
291048-
X = 416.802002
291049-
Y = 4029.919922
291050-
Width = 2154.000000
291051-
Height = 1244.000000
291052-
AddBox = Box
291053-
Corner = Vector
291054-
X = 2554.330078
291055-
Y = 4354.120117
291056-
Width = 1194.000000
291057-
Height = 334.000000
291036+
X = 263.581696
291037+
Y = 3716.564453
291038+
Width = 3542.000000
291039+
Height = 1926.000000
291058291040
Name = Mission Stage Area 1
291059291041
AddArea = Area
291060291042
AddBox = Box
291061291043
Corner = Vector
291062-
X = 4146.089844
291063-
Y = 4365.990234
291064-
Width = 2198.000000
291065-
Height = 1826.000000
291044+
X = 4023.535156
291045+
Y = 4000.394775
291046+
Width = 3660.000000
291047+
Height = 2250.000000
291066291048
AddBox = Box
291067291049
Corner = Vector
291068-
X = 2507.290039
291069-
Y = 4474.390137
291070-
Width = 1668.000000
291071-
Height = 209.000000
291072-
AddBox = Box
291073-
Corner = Vector
291074-
X = 4001.780029
291075-
Y = 4672.830078
291076-
Width = 155.000000
291077-
Height = 507.000000
291078-
AddBox = Box
291079-
Corner = Vector
291080-
X = 6334.399902
291081-
Y = 4369.990234
291082-
Width = 1317.000000
291083-
Height = 1845.000000
291050+
X = 2476.004150
291051+
Y = 4001.848877
291052+
Width = 1559.000000
291053+
Height = 758.000000
291084291054
Name = Mission Stage Area 2
291085291055
AddArea = Area
291086291056
AddBox = Box
291087291057
Corner = Vector
291088-
X = 7395.410156
291089-
Y = 4539.390137
291090-
Width = 750.000000
291091-
Height = 621.000000
291058+
X = 8992.740234
291059+
Y = 4590.589844
291060+
Width = 19.000000
291061+
Height = 478.000000
291092291062
AddBox = Box
291093291063
Corner = Vector
291094-
X = 8122.540039
291095-
Y = 5049.959961
291096-
Width = 184.000000
291097-
Height = 106.000000
291064+
X = 12329.654297
291065+
Y = 2573.054199
291066+
Width = 3248.000000
291067+
Height = 2275.000000
291098291068
AddBox = Box
291099291069
Corner = Vector
291100-
X = 12292.500000
291101-
Y = 2593.550049
291070+
X = 10304.544922
291071+
Y = 4657.191406
291102291072
Width = 1744.000000
291103291073
Height = 2309.000000
291104291074
AddBox = Box
291105291075
Corner = Vector
291106-
X = 7394.520020
291107-
Y = 5159.470215
291108-
Width = 1613.000000
291109-
Height = 908.000000
291110-
AddBox = Box
291111-
Corner = Vector
291112-
X = 8144.810059
291113-
Y = 4403.490234
291114-
Width = 857.000000
291115-
Height = 657.000000
291116-
AddBox = Box
291117-
Corner = Vector
291118-
X = 9007.929688
291119-
Y = 4586.490234
291120-
Width = 3015.000000
291121-
Height = 2738.000000
291122-
AddBox = Box
291123-
Corner = Vector
291124-
X = 7688.520020
291125-
Y = 6064.569824
291126-
Width = 1322.000000
291127-
Height = 1691.000000
291128-
AddBox = Box
291129-
Corner = Vector
291130-
X = 12018.099609
291131-
Y = 4902.580078
291132-
Width = 1366.000000
291133-
Height = 883.000000
291076+
X = 11903.337891
291077+
Y = 4629.973633
291078+
Width = 1893.000000
291079+
Height = 1226.000000
291134291080
AddBox = Box
291135291081
Corner = Vector
291136-
X = 13963.000000
291137-
Y = 3208.260010
291138-
Width = 1196.000000
291139-
Height = 284.000000
291140-
AddBox = Box
291141-
Corner = Vector
291142-
X = 14002.900391
291143-
Y = 3879.060059
291144-
Width = 1493.000000
291145-
Height = 264.000000
291146-
AddBox = Box
291147-
Corner = Vector
291148-
X = 8508.839844
291149-
Y = 5037.290039
291150-
Width = 216.000000
291151-
Height = 142.000000
291082+
X = 8054.121094
291083+
Y = 3992.073730
291084+
Width = 2278.000000
291085+
Height = 3883.000000
291152291086
AddBox = Box
291153291087
Corner = Vector
291154-
X = 8992.740234
291155-
Y = 4590.589844
291156-
Width = 19.000000
291157-
Height = 478.000000
291158-
AddBox = Box
291159-
Corner = Vector
291160-
X = 7431.720215
291161-
Y = 4017.389893
291162-
Width = 718.000000
291163-
Height = 526.000000
291164-
AddBox = Box
291165-
Corner = Vector
291166-
X = 6153.939941
291167-
Y = 4525.890137
291168-
Width = 1256.000000
291169-
Height = 1411.000000
291088+
X = 6403.003418
291089+
Y = 3995.452393
291090+
Width = 1650.000000
291091+
Height = 2858.000000
291170291092
Name = Mission Stage Area 3
291171291093
AddArea = Area
291172291094
AddBox = Box
291173291095
Corner = Vector
291174-
X = 15030.700195
291175-
Y = 647.148987
291176-
Width = 4320.000000
291177-
Height = 4101.000000
291178-
AddBox = Box
291179-
Corner = Vector
291180-
X = 13891.900391
291181-
Y = 3267.649902
291182-
Width = 1154.000000
291183-
Height = 228.000000
291096+
X = 13651.100586
291097+
Y = 2569.848633
291098+
Width = 1607.000000
291099+
Height = 1973.000000
291184291100
AddBox = Box
291185291101
Corner = Vector
291186-
X = 13631.500000
291187-
Y = 3948.949951
291188-
Width = 1433.000000
291189-
Height = 198.000000
291102+
X = 14981.908203
291103+
Y = 670.928467
291104+
Width = 4527.000000
291105+
Height = 4277.000000
291190291106
Name = Mission Stage Area 4
291191291107
AddArea = Area
291192291108
AddBox = Box

Source/Entities/AHuman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ void AHuman::UpdateCrouching() {
14201420
}
14211421

14221422
float finalWalkPathYOffset = std::clamp(Lerp(0.0F, 1.0F, -m_WalkPathOffset.m_Y, desiredWalkPathYOffset, 0.3F), 0.0F, m_MaxWalkPathCrouchShift);
1423-
m_CrouchAmount = std::clamp(0.0F, 1.0F, finalWalkPathYOffset / m_MaxWalkPathCrouchShift - 0.5F); // because it's lerped, it never hits 1 exactly. thus the -0.5F
1423+
m_CrouchAmount = std::clamp(finalWalkPathYOffset / (m_MaxWalkPathCrouchShift - 0.1f), 0.0F, 1.0F); // because it's lerped, it never hits 1 exactly. thus the -0.1F
14241424
m_WalkPathOffset.m_Y = -finalWalkPathYOffset;
14251425

14261426
// Adjust our X offset to try to keep our legs under our centre-of-mass

Source/Entities/PieMenu.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ void PieMenu::Update() {
632632
}
633633

634634
void PieMenu::Draw(BITMAP* targetBitmap, const Vector& targetPos) const {
635+
rlZDepth(c_GuiDepth);
635636
Vector drawPos;
636637
CalculateDrawPosition(targetBitmap, targetPos, drawPos);
637638

@@ -656,6 +657,7 @@ void PieMenu::Draw(BITMAP* targetBitmap, const Vector& targetPos) const {
656657
if (m_ActiveSubPieMenu) {
657658
m_ActiveSubPieMenu->Draw(targetBitmap, targetPos);
658659
}
660+
rlZDepth(c_DefaultDrawDepth);
659661
}
660662

661663
void PieMenu::UpdateWobbling() {

Source/Entities/SLBackground.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void SLBackground::Clear() {
3838
m_FillColorRight = ColorKeys::g_MaskColor;
3939
m_FillColorUp = ColorKeys::g_MaskColor;
4040
m_FillColorDown = ColorKeys::g_MaskColor;
41+
m_ZOrder = c_BackgroundDepth;
4142

4243
m_IgnoreAutoScale = false;
4344
}
@@ -222,6 +223,7 @@ void SLBackground::Draw(const Box& targetDimensions, Box& targetBox, bool offset
222223
int targetBoxWidth = static_cast<int>(targetBox.GetWidth());
223224
int targetBoxHeight = static_cast<int>(targetBox.GetHeight());
224225

226+
rlZDepth(m_ZOrder);
225227
// Detect if non-wrapping layer dimensions can't cover the whole target area with its main bitmap. If so, fill in the gap with appropriate solid color sampled from the hanging edge.
226228
if (!m_WrapX && bitmapWidth <= targetBoxWidth) {
227229
if (m_FillColorLeft != ColorKeys::g_MaskColor && m_Offset.GetFloorIntX() != 0) {
@@ -239,4 +241,5 @@ void SLBackground::Draw(const Box& targetDimensions, Box& targetBox, bool offset
239241
DrawRectangle(targetBoxCornerX, targetBoxCornerY + bitmapHeight - m_Offset.m_Y, targetBoxWidth, targetBoxHeight - bitmapHeight + m_Offset.m_Y, {static_cast<unsigned char>(m_FillColorDown), 0, 0, 255});
240242
}
241243
}
244+
rlZDepth(c_DefaultDrawDepth);
242245
}

Source/Entities/SLTerrain.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ int SLTerrain::Create() {
4646

4747
if (!m_FGColorLayer.get()) {
4848
m_FGColorLayer = std::make_unique<SceneLayer>();
49+
m_FGColorLayer->SetZOrder(c_DefaultDrawDepth);
4950
}
5051
if (!m_BGColorLayer.get()) {
5152
m_BGColorLayer = std::make_unique<SceneLayer>();
53+
m_BGColorLayer->SetZOrder(c_TerrainBGDepth);
5254
}
5355

5456
return 0;
@@ -90,10 +92,12 @@ int SLTerrain::ReadProperty(const std::string_view& propName, Reader& reader) {
9092
MatchProperty("BackgroundTexture", { reader >> m_DefaultBGTextureFile; });
9193
MatchProperty("FGColorLayer", {
9294
m_FGColorLayer = std::make_unique<SceneLayer>();
95+
m_FGColorLayer->SetZOrder(c_DefaultDrawDepth);
9396
reader >> m_FGColorLayer.get();
9497
});
9598
MatchProperty("BGColorLayer", {
9699
m_BGColorLayer = std::make_unique<SceneLayer>();
100+
m_BGColorLayer->SetZOrder(c_TerrainBGDepth);
97101
reader >> m_BGColorLayer.get();
98102
});
99103
MatchProperty("AddTerrainFrosting", {

Source/Entities/SceneLayer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void SceneLayerImpl<TRACK_DRAWINGS, STATIC_TEXTURE>::Clear() {
4545
m_WrapY = true;
4646
m_OriginOffset.Reset();
4747
m_Offset.Reset();
48+
m_ZOrder = 0.0F;
4849
m_ScrollInfo.SetXY(1.0F, 1.0F);
4950
m_ScrollRatio.SetXY(1.0F, 1.0F);
5051
m_ScaleFactor.SetXY(1.0F, 1.0F);
@@ -510,6 +511,8 @@ void SceneLayerImpl<TRACK_DRAWINGS, STATIC_TEXTURE>::DrawTiled(const Box& target
510511
glUniform1i(maskedUniformLocation, 0);
511512
}
512513

514+
rlZDepth(m_ZOrder);
515+
513516
for (int tiledOffsetX = 0; tiledOffsetX < areaToCoverX;) {
514517
float destX = targetBox.GetCorner().GetFloorIntX() + tiledOffsetX - m_Offset.GetFloorIntX();
515518

@@ -537,6 +540,8 @@ void SceneLayerImpl<TRACK_DRAWINGS, STATIC_TEXTURE>::DrawTiled(const Box& target
537540
tiledOffsetX += bitmapWidth;
538541
}
539542

543+
rlZDepth(c_DefaultDrawDepth);
544+
540545
if (!m_DrawMasked) {
541546
rlDrawRenderBatchActive();
542547
int drawMaskedUniform = rlGetLocationUniform(rlGetShaderCurrent(), "drawMasked");

Source/Entities/SceneLayer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ namespace RTE {
100100
/// @param newOffset The new offset Vector.
101101
void SetOffset(const Vector& newOffset) { m_Offset = newOffset; }
102102

103+
/// Set the depth this scenelayer will be drawn at.
104+
/// @param z The depth to draw at, negative values are further to the front in the range c_NearDepth to c_FarDepth.
105+
void SetZOrder(float z) { m_ZOrder = z; }
106+
103107
/// Gets the scroll ratio that modifies the offset.
104108
/// @return A copy of the ratio.
105109
Vector GetScrollRatio() const { return m_ScrollRatio; }
@@ -222,6 +226,7 @@ namespace RTE {
222226

223227
Vector m_OriginOffset; //!< Offset of this SceneLayer off the top left edge of the screen.
224228
Vector m_Offset; //!< The current scrolled offset of this SceneLayer, before being adjusted with the origin offset.
229+
float m_ZOrder{0.0F}; //!< The depth this SceneLayer should be drawn at.
225230

226231
Vector m_ScrollInfo; //!< The initial scrolling ratio of this SceneLayer as set in INI. Used to calculate the actual scrolling ratios.
227232
Vector m_ScrollRatio; //!< The scrolling ratios of this SceneLayer, adjusted to the Scene, player screen dimensions and scaling factor as necessary.

Source/Managers/FrameMan.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@ void FrameMan::Draw() {
962962
if (IsInMultiplayerMode()) {
963963
PrepareFrameForNetwork();
964964
}
965-
rlDisableDepthTest();
965+
rlEnableDepthTest();
966+
rlZDepth(c_GuiDepth-1.0f);
966967
g_GLResourceMan.UpdateDynamicBitmap(m_BackBuffer8.get(), true);
967968
backgroundShader.Begin();
968969
backgroundShader.Enable();
@@ -972,6 +973,7 @@ void FrameMan::Draw() {
972973
DrawTexture(g_GLResourceMan.GetStaticTextureFromBitmap(m_BackBuffer8.get()), 0.0f, 0.0f, {255, 255, 255, 255});
973974
m_BackBuffer->End();
974975
backgroundShader.End();
976+
rlZDepth(0);
975977
if (g_ActivityMan.IsInActivity()) {
976978
g_PostProcessMan.PostProcess();
977979
}

0 commit comments

Comments
 (0)