Skip to content

Commit

Permalink
Fix rendering menu background if its height is lower than 480
Browse files Browse the repository at this point in the history
Resolves #113
  • Loading branch information
rafalh committed Jun 5, 2021
1 parent 19d81a0 commit 2acbfbe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Version 1.7.0 (not released yet)
- Remove limit of loaded skeletons (*.rfa) - fixes crash when loading L1S1 and then pdm-deathmatch-run-v2
- Remove memory corruption when too many skeletons/animations are added to a single character
- Optimize skeleton unlinking when character is destroyed
- Fix rendering menu background if its height is lower than 480 (for example AQuest Speedrun Edition mod)

Version 1.6.1 (released 2021-02-20)
-----------------------------------
Expand Down
7 changes: 7 additions & 0 deletions game_patch/graphics/gr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ void gr_bitmap_scaled_float(int bitmap_handle, float x, float y, float w, float
int bm_w, bm_h;
rf::bm::get_dimensions(bitmap_handle, &bm_w, &bm_h);

// For some reason original implementation do not allow UVs > 1
sw = std::min(sw, bm_w - sx);
sh = std::min(sh, bm_h - sy);
if (sw <= 0.0f || sh <= 0.0f) {
return;
}

rf::gr::Vertex verts[4];
rf::gr::Vertex* verts_ptrs[4] = {&verts[0], &verts[1], &verts[2], &verts[3]};
float sx_left = rf::gr::screen.offset_x + x - 0.5f;
Expand Down
2 changes: 1 addition & 1 deletion game_patch/misc/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "../rf/file/file.h"
#include "../rf/multi.h"
#include "../rf/sound/sound.h"
#include "../rf/os/frametime.h"
#include "../main/main.h"
#include "../graphics/gr.h"

Expand Down Expand Up @@ -161,7 +162,6 @@ FunHook<int(const int&, const int&)> server_list_cmp_func_hook{
},
};


CodeInjection menu_draw_background_injection{
0x00442D5C,
[](auto& regs) {
Expand Down

0 comments on commit 2acbfbe

Please sign in to comment.