Skip to content

Commit 613ab84

Browse files
committed
Merge branch 'development' into browncoat-mission
2 parents 06946a7 + 34552e8 commit 613ab84

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
@@ -290897,160 +290897,76 @@ AddScene = Scene
290897290897
AddArea = Area
290898290898
AddBox = Box
290899290899
Corner = Vector
290900-
X = 623.801025
290901-
Y = 5274.319824
290902-
Width = 660.000000
290903-
Height = 273.000000
290904-
AddBox = Box
290905-
Corner = Vector
290906-
X = 1920.400024
290907-
Y = 5265.229980
290908-
Width = 422.000000
290909-
Height = 271.000000
290910-
AddBox = Box
290911-
Corner = Vector
290912-
X = 416.802002
290913-
Y = 4029.919922
290914-
Width = 2154.000000
290915-
Height = 1244.000000
290916-
AddBox = Box
290917-
Corner = Vector
290918-
X = 2554.330078
290919-
Y = 4354.120117
290920-
Width = 1194.000000
290921-
Height = 334.000000
290900+
X = 263.581696
290901+
Y = 3716.564453
290902+
Width = 3542.000000
290903+
Height = 1926.000000
290922290904
Name = Mission Stage Area 1
290923290905
AddArea = Area
290924290906
AddBox = Box
290925290907
Corner = Vector
290926-
X = 4146.089844
290927-
Y = 4365.990234
290928-
Width = 2198.000000
290929-
Height = 1826.000000
290908+
X = 4023.535156
290909+
Y = 4000.394775
290910+
Width = 3660.000000
290911+
Height = 2250.000000
290930290912
AddBox = Box
290931290913
Corner = Vector
290932-
X = 2507.290039
290933-
Y = 4474.390137
290934-
Width = 1668.000000
290935-
Height = 209.000000
290936-
AddBox = Box
290937-
Corner = Vector
290938-
X = 4001.780029
290939-
Y = 4672.830078
290940-
Width = 155.000000
290941-
Height = 507.000000
290942-
AddBox = Box
290943-
Corner = Vector
290944-
X = 6334.399902
290945-
Y = 4369.990234
290946-
Width = 1317.000000
290947-
Height = 1845.000000
290914+
X = 2476.004150
290915+
Y = 4001.848877
290916+
Width = 1559.000000
290917+
Height = 758.000000
290948290918
Name = Mission Stage Area 2
290949290919
AddArea = Area
290950290920
AddBox = Box
290951290921
Corner = Vector
290952-
X = 7395.410156
290953-
Y = 4539.390137
290954-
Width = 750.000000
290955-
Height = 621.000000
290922+
X = 8992.740234
290923+
Y = 4590.589844
290924+
Width = 19.000000
290925+
Height = 478.000000
290956290926
AddBox = Box
290957290927
Corner = Vector
290958-
X = 8122.540039
290959-
Y = 5049.959961
290960-
Width = 184.000000
290961-
Height = 106.000000
290928+
X = 12329.654297
290929+
Y = 2573.054199
290930+
Width = 3248.000000
290931+
Height = 2275.000000
290962290932
AddBox = Box
290963290933
Corner = Vector
290964-
X = 12292.500000
290965-
Y = 2593.550049
290934+
X = 10304.544922
290935+
Y = 4657.191406
290966290936
Width = 1744.000000
290967290937
Height = 2309.000000
290968290938
AddBox = Box
290969290939
Corner = Vector
290970-
X = 7394.520020
290971-
Y = 5159.470215
290972-
Width = 1613.000000
290973-
Height = 908.000000
290974-
AddBox = Box
290975-
Corner = Vector
290976-
X = 8144.810059
290977-
Y = 4403.490234
290978-
Width = 857.000000
290979-
Height = 657.000000
290980-
AddBox = Box
290981-
Corner = Vector
290982-
X = 9007.929688
290983-
Y = 4586.490234
290984-
Width = 3015.000000
290985-
Height = 2738.000000
290986-
AddBox = Box
290987-
Corner = Vector
290988-
X = 7688.520020
290989-
Y = 6064.569824
290990-
Width = 1322.000000
290991-
Height = 1691.000000
290992-
AddBox = Box
290993-
Corner = Vector
290994-
X = 12018.099609
290995-
Y = 4902.580078
290996-
Width = 1366.000000
290997-
Height = 883.000000
290940+
X = 11903.337891
290941+
Y = 4629.973633
290942+
Width = 1893.000000
290943+
Height = 1226.000000
290998290944
AddBox = Box
290999290945
Corner = Vector
291000-
X = 13963.000000
291001-
Y = 3208.260010
291002-
Width = 1196.000000
291003-
Height = 284.000000
291004-
AddBox = Box
291005-
Corner = Vector
291006-
X = 14002.900391
291007-
Y = 3879.060059
291008-
Width = 1493.000000
291009-
Height = 264.000000
291010-
AddBox = Box
291011-
Corner = Vector
291012-
X = 8508.839844
291013-
Y = 5037.290039
291014-
Width = 216.000000
291015-
Height = 142.000000
290946+
X = 8054.121094
290947+
Y = 3992.073730
290948+
Width = 2278.000000
290949+
Height = 3883.000000
291016290950
AddBox = Box
291017290951
Corner = Vector
291018-
X = 8992.740234
291019-
Y = 4590.589844
291020-
Width = 19.000000
291021-
Height = 478.000000
291022-
AddBox = Box
291023-
Corner = Vector
291024-
X = 7431.720215
291025-
Y = 4017.389893
291026-
Width = 718.000000
291027-
Height = 526.000000
291028-
AddBox = Box
291029-
Corner = Vector
291030-
X = 6153.939941
291031-
Y = 4525.890137
291032-
Width = 1256.000000
291033-
Height = 1411.000000
290952+
X = 6403.003418
290953+
Y = 3995.452393
290954+
Width = 1650.000000
290955+
Height = 2858.000000
291034290956
Name = Mission Stage Area 3
291035290957
AddArea = Area
291036290958
AddBox = Box
291037290959
Corner = Vector
291038-
X = 15030.700195
291039-
Y = 647.148987
291040-
Width = 4320.000000
291041-
Height = 4101.000000
291042-
AddBox = Box
291043-
Corner = Vector
291044-
X = 13891.900391
291045-
Y = 3267.649902
291046-
Width = 1154.000000
291047-
Height = 228.000000
290960+
X = 13651.100586
290961+
Y = 2569.848633
290962+
Width = 1607.000000
290963+
Height = 1973.000000
291048290964
AddBox = Box
291049290965
Corner = Vector
291050-
X = 13631.500000
291051-
Y = 3948.949951
291052-
Width = 1433.000000
291053-
Height = 198.000000
290966+
X = 14981.908203
290967+
Y = 670.928467
290968+
Width = 4527.000000
290969+
Height = 4277.000000
291054290970
Name = Mission Stage Area 4
291055290971
AddArea = Area
291056290972
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)