Skip to content

joystick support #189

@rodan

Description

@rodan

hello!

I'm working on a patch that would add joystick support for the game.

I'm confronted with the following facts:

  • the 'big stone' main menu expects a pointer position in the 0,0 .. 640,480 interval ignoring gameResW,H set in the ini file
  • the level selection map panel expects 0,0 .. 640,480 ignoring the ini file
  • during flight and any of the in-game panels the pointer position is expected in the 0,0 .. gameRes{Width, Height} interval, with a hardcoded 320,200 resting coordinate! this means that if I have a 1024x768 gameRes I can't reach any horizontal pixel over ~800 due to the hardcoded 320 'center' value which should have been 1024/2. which in turn means that I can't reach the last spell if the first one is currently selected.

none of these inconsistencies are noticeable when using a mouse - since the mouse can be moved to infinity in any direction, but a joystick has a limited movement arc. and ideally the entire arc has to map perfectly to the virtual canvas it controls.

so how should I treat the window size differences? and the hardcoded window center in flight mode?
what part of the reversed code can I force into submission?

dazed and confused,
peter

you can add a mouse coord debug output if you patch engine/Basic.cpp thusly:

diff --git a/remc2/engine/Basic.cpp b/remc2/engine/Basic.cpp
index 14e4652b7..b79378fe7 100644
--- a/remc2/engine/Basic.cpp
+++ b/remc2/engine/Basic.cpp
@@ -93,6 +93,8 @@ uint8_t* x_DWORD_18070C; // weak
 uint8_t* x_DWORD_180714; // weak
 uint8_t* x_DWORD_180718; // weak
 
+extern axis_2d x_WORD_E3760_mouse;
+
 //basic graphics
 
 char x_BYTE_D41CE = 0; // weak
@@ -1769,6 +1771,11 @@ void VGA_DrawPlayerCoordData(int x, int y)
                        " Yaw: " + std::to_string(rotData.yaw);
 
                VGA_Draw_stringXYtoBuffer(playerRotationStr.c_str(), x, y + 8, pdwScreenBuffer_351628, 'S');
+#if 1
+               axis_2d mouseData = x_WORD_E3760_mouse;
+               std::string mouseCoordStr = "x: " + std::to_string(mouseData.x) + " y: " + std::to_string(mouseData.y);
+               VGA_Draw_stringXYtoBuffer(mouseCoordStr.c_str(), x, y + 16, pdwScreenBuffer_351628, 'S');
+#endif
        }
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions