diff --git a/src/harness/CMakeLists.txt b/src/harness/CMakeLists.txt index 8e2a3fd22..595f75b05 100644 --- a/src/harness/CMakeLists.txt +++ b/src/harness/CMakeLists.txt @@ -16,6 +16,10 @@ target_include_directories(harness include ) +if(DETHRACE_FIX_BUGS) + target_compile_definitions(harness PRIVATE DETHRACE_FIX_BUGS) +endif() + target_link_libraries(harness PRIVATE brender compile_with_werror) if(WIN32) @@ -70,6 +74,8 @@ if (IO_PLATFORM STREQUAL "SDL_OpenGL") renderers/gl/stored_context.c renderers/gl/stored_context.h ) + target_include_directories(harness PRIVATE "${dethrace_SOURCE_DIR}/src/DETHRACE/common") + target_include_directories(harness PRIVATE "${dethrace_SOURCE_DIR}/src/S3/include") target_link_libraries(harness PRIVATE SDL2::SDL2 glad) endif() diff --git a/src/harness/io_platforms/sdl_gl.c b/src/harness/io_platforms/sdl_gl.c index 8cb94f86f..eebefdc3e 100644 --- a/src/harness/io_platforms/sdl_gl.c +++ b/src/harness/io_platforms/sdl_gl.c @@ -10,6 +10,10 @@ #include "harness/config.h" #include "harness/trace.h" +#include "globvars.h" +#include "grafdata.h" +#include "pd/sys.h" + #define ARRAY_LEN(array) (sizeof((array)) / sizeof((array)[0])) int scancode_map[123]; @@ -308,6 +312,15 @@ void Input_GetMousePosition(int* pX, int* pY) { *pY -= vp_y; *pX *= sdl_window_scale.x; *pY *= sdl_window_scale.y; + +#if defined(DETHRACE_FIX_BUGS) + // In hires mode (640x480), the menus are still rendered at (320x240), + // so prescale the cursor coordinates accordingly. + *pX *= gGraf_specs[gGraf_data_index].phys_width; + *pX /= gGraf_specs[gReal_graf_data_index].phys_width; + *pY *= gGraf_specs[gGraf_data_index].phys_height; + *pY /= gGraf_specs[gReal_graf_data_index].phys_height; +#endif } void Input_GetMouseButtons(int* pButton1, int* pButton2) {