Skip to content

Commit

Permalink
Add level filename to "Level Initializing" console message
Browse files Browse the repository at this point in the history
Fixes #242
  • Loading branch information
rafalh committed Aug 19, 2024
1 parent f8bed2a commit 2ae4397
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Version 1.8.1 (not released yet)
- Add Spawn Health/Armor settings for dedicated servers
- Add Kill Reward settings for dedicated servers
- Do not load unnecessary VPPs in dedicated server mode
- Add level filename to "Level Initializing" console message

Version 1.8.0 (released 2022-09-17)
-----------------------------------
Expand Down
11 changes: 11 additions & 0 deletions game_patch/misc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "../rf/os/os.h"
#include "../rf/misc.h"
#include "../rf/vmesh.h"
#include "../rf/level.h"
#include "../rf/file/file.h"
#include "../object/object.h"

Expand Down Expand Up @@ -388,6 +389,13 @@ CodeInjection game_set_file_paths_injection{
},
};

CallHook level_init_pre_console_output_hook{
0x00435ABB,
[]() {
rf::console::printf("-- Level Initializing: %s --", rf::level_filename_to_load.c_str());
},
};

void misc_init()
{
// Window title (client and server)
Expand Down Expand Up @@ -492,6 +500,9 @@ void misc_init()
// Add support for Bink videos in mods
game_set_file_paths_injection.install();

// Add level name to "-- Level Initializing --" message
level_init_pre_console_output_hook.install();

// Apply patches from other files
apply_main_menu_patches();
apply_save_restore_patches();
Expand Down
2 changes: 2 additions & 0 deletions game_patch/rf/level.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@ namespace rf
static auto& level_room_from_uid = addr_as_ref<GRoom*(int uid)>(0x0045E7C0);

static auto& level = addr_as_ref<LevelInfo>(0x00645FD8);
static auto& level_filename_to_load = addr_as_ref<String>(0x00646140);

}

0 comments on commit 2ae4397

Please sign in to comment.