From 5dde70a618d723cee8727ea11f0a9711ee55bcc9 Mon Sep 17 00:00:00 2001 From: is-this-c <87069698+is-this-c@users.noreply.github.com> Date: Wed, 3 Dec 2025 11:00:11 +1300 Subject: [PATCH 1/3] Fix world hud strings (#198) * Fix world hud strings * Fix `rf::gr::text_2d_mode` * Move --------- Co-authored-by: Chris Parsons --- docs/CHANGELOG.md | 3 ++- game_patch/graphics/gr.cpp | 3 +++ game_patch/rf/gr/gr.h | 18 ++++++------------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 61187460a..b6597b983 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,7 +4,8 @@ Dash Faction Changelog Version 1.9.2 (not released yet) -------------------------------- [@is-this-c](https://github.com/is-this-c) -- Fix a potential crash after a client quits a game if Directd3D 11 is enabled +- Set `rf::gr::text_2d_mode` to ignore fog +- Fix a potential crash, after a client quits a game, if Directd3D 11 is enabled - Improve compatibility with Alpine Faction servers - Fix `PgUp`, `PgDown`, `End`, and `Home` on numeric keypads diff --git a/game_patch/graphics/gr.cpp b/game_patch/graphics/gr.cpp index 49c49067e..7c7c38f3c 100644 --- a/game_patch/graphics/gr.cpp +++ b/game_patch/graphics/gr.cpp @@ -330,4 +330,7 @@ void gr_apply_patch() windowed_cmd.register_cmd(); nearest_texture_filtering_cmd.register_cmd(); lod_distance_scale_cmd.register_cmd(); + + // Fix `rf::gr::text_2d_mode`. + AsmWriter{0x0050BB40}.push(rf::gr::FOG_NOT_ALLOWED); } diff --git a/game_patch/rf/gr/gr.h b/game_patch/rf/gr/gr.h index 76dbd3d93..4227eb9a9 100644 --- a/game_patch/rf/gr/gr.h +++ b/game_patch/rf/gr/gr.h @@ -52,8 +52,7 @@ namespace rf::gr }; static_assert(sizeof(Vertex) == 0x30); - enum TextureSource - { + enum TextureSource : uint8_t { TEXTURE_SOURCE_NONE = 0x0, TEXTURE_SOURCE_WRAP = 0x1, TEXTURE_SOURCE_CLAMP = 0x2, @@ -68,8 +67,7 @@ namespace rf::gr TEXTURE_SOURCE_MT_CLAMP_TRILIN = 0xB, }; - enum ColorSource - { + enum ColorSource : uint8_t { COLOR_SOURCE_VERTEX = 0x0, COLOR_SOURCE_TEXTURE = 0x1, COLOR_SOURCE_VERTEX_TIMES_TEXTURE = 0x2, @@ -77,16 +75,14 @@ namespace rf::gr COLOR_SOURCE_VERTEX_TIMES_TEXTURE_2X = 0x4, }; - enum AlphaSource - { + enum AlphaSource : uint8_t { ALPHA_SOURCE_VERTEX = 0x0, ALPHA_SOURCE_VERTEX_NONDARKENING = 0x1, ALPHA_SOURCE_TEXTURE = 0x2, ALPHA_SOURCE_VERTEX_TIMES_TEXTURE = 0x3, }; - enum AlphaBlend - { + enum AlphaBlend : uint8_t { ALPHA_BLEND_NONE = 0x0, ALPHA_BLEND_ADDITIVE = 0x1, ALPHA_BLEND_ALPHA_ADDITIVE = 0x2, @@ -97,8 +93,7 @@ namespace rf::gr ALPHA_BLEND_SWAPPED_SRC_DEST_COLOR = 0x7, }; - enum ZbufferType - { + enum ZbufferType : uint8_t { ZBUFFER_TYPE_NONE = 0x0, ZBUFFER_TYPE_READ = 0x1, ZBUFFER_TYPE_READ_EQUAL = 0x2, @@ -107,8 +102,7 @@ namespace rf::gr ZBUFFER_TYPE_FULL_ALPHA_TEST = 0x5, }; - enum FogType - { + enum FogType : uint8_t { FOG_ALLOWED = 0x0, FOG_ALLOWED_ADD2 = 0x1, FOG_ALLOWED_MULT2 = 0x2, From 57519e8ee66b907242a80d489665aa8c848bf299 Mon Sep 17 00:00:00 2001 From: is-this-c <87069698+is-this-c@users.noreply.github.com> Date: Mon, 8 Dec 2025 15:35:46 +1300 Subject: [PATCH 2/3] Fixes --- game_patch/graphics/gr.cpp | 2 +- game_patch/rf/gr/gr.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/game_patch/graphics/gr.cpp b/game_patch/graphics/gr.cpp index 7c7c38f3c..5ce721e73 100644 --- a/game_patch/graphics/gr.cpp +++ b/game_patch/graphics/gr.cpp @@ -332,5 +332,5 @@ void gr_apply_patch() lod_distance_scale_cmd.register_cmd(); // Fix `rf::gr::text_2d_mode`. - AsmWriter{0x0050BB40}.push(rf::gr::FOG_NOT_ALLOWED); + AsmWriter{0x0050BB40}.push(static_cast(rf::gr::FOG_NOT_ALLOWED)); } diff --git a/game_patch/rf/gr/gr.h b/game_patch/rf/gr/gr.h index 4227eb9a9..382e7ce71 100644 --- a/game_patch/rf/gr/gr.h +++ b/game_patch/rf/gr/gr.h @@ -52,7 +52,7 @@ namespace rf::gr }; static_assert(sizeof(Vertex) == 0x30); - enum TextureSource : uint8_t { + enum TextureSource { TEXTURE_SOURCE_NONE = 0x0, TEXTURE_SOURCE_WRAP = 0x1, TEXTURE_SOURCE_CLAMP = 0x2, @@ -67,7 +67,7 @@ namespace rf::gr TEXTURE_SOURCE_MT_CLAMP_TRILIN = 0xB, }; - enum ColorSource : uint8_t { + enum ColorSource { COLOR_SOURCE_VERTEX = 0x0, COLOR_SOURCE_TEXTURE = 0x1, COLOR_SOURCE_VERTEX_TIMES_TEXTURE = 0x2, @@ -75,14 +75,14 @@ namespace rf::gr COLOR_SOURCE_VERTEX_TIMES_TEXTURE_2X = 0x4, }; - enum AlphaSource : uint8_t { + enum AlphaSource { ALPHA_SOURCE_VERTEX = 0x0, ALPHA_SOURCE_VERTEX_NONDARKENING = 0x1, ALPHA_SOURCE_TEXTURE = 0x2, ALPHA_SOURCE_VERTEX_TIMES_TEXTURE = 0x3, }; - enum AlphaBlend : uint8_t { + enum AlphaBlend { ALPHA_BLEND_NONE = 0x0, ALPHA_BLEND_ADDITIVE = 0x1, ALPHA_BLEND_ALPHA_ADDITIVE = 0x2, @@ -93,7 +93,7 @@ namespace rf::gr ALPHA_BLEND_SWAPPED_SRC_DEST_COLOR = 0x7, }; - enum ZbufferType : uint8_t { + enum ZbufferType { ZBUFFER_TYPE_NONE = 0x0, ZBUFFER_TYPE_READ = 0x1, ZBUFFER_TYPE_READ_EQUAL = 0x2, @@ -102,7 +102,7 @@ namespace rf::gr ZBUFFER_TYPE_FULL_ALPHA_TEST = 0x5, }; - enum FogType : uint8_t { + enum FogType { FOG_ALLOWED = 0x0, FOG_ALLOWED_ADD2 = 0x1, FOG_ALLOWED_MULT2 = 0x2, From 42afba6f48e440d5b1a12e0902b2796c068a21af Mon Sep 17 00:00:00 2001 From: is-this-c <87069698+is-this-c@users.noreply.github.com> Date: Mon, 8 Dec 2025 15:39:19 +1300 Subject: [PATCH 3/3] Update CHANGELOG.md --- docs/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 64173f64e..1a7798fe8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,7 +7,6 @@ Version 1.9.2 (not released yet) - Set `rf::gr::text_2d_mode` to ignore fog - Fix `gr_d3d_bitmap`, so `gr_d3d_set_state` is called earlier - Fix a potential crash, after a client quits a game, if Directd3D 11 is enabled -- Fix a potential crash after a client quits a game if Directd3D 11 is enabled - Improve compatibility with Alpine Faction servers - Fix `PgUp`, `PgDown`, `End`, and `Home` on numeric keypads