Skip to content

Commit

Permalink
Revert new mouse button type
Browse files Browse the repository at this point in the history
  • Loading branch information
andrikpowell committed Dec 1, 2024
1 parent 2b4e71f commit 3e0e792
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 47 deletions.
22 changes: 4 additions & 18 deletions prboom2/src/SDL/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,13 @@ int I_SDLtoDoomMouseState(Uint32 buttonstate)
;
}

static event_t delay_event;

static void I_GetEvent(void)
{
event_t event;

SDL_Event SDLEvent;
SDL_Event *Event = &SDLEvent;

I_DelayEvent();

while (SDL_PollEvent(Event))
{
switch (Event->type) {
Expand Down Expand Up @@ -386,12 +382,12 @@ static void I_GetEvent(void)

// post a button down event
event.data1.i = button;
event.type = ev_mouseb_down;
event.type = ev_keydown;
D_PostEvent(&event);

// hold button for one tic, required for checks in G_BuildTiccmd
delay_event.data1.i = button;
delay_event.type = ev_mouseb_up;
event.data1.i = button;
event.type = ev_keyup;
D_PostEvent(&event);
}
break;

Expand Down Expand Up @@ -433,16 +429,6 @@ static void I_GetEvent(void)
}
}

// Pulled from Woof
void I_DelayEvent(void)
{
if (delay_event.data1.i)
{
D_PostEvent(&delay_event);
delay_event.data1.i = 0;
}
}

//
// I_StartTic
//
Expand Down
6 changes: 3 additions & 3 deletions prboom2/src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ dboolean AM_Responder
}
else if (
dsda_InputActivated(dsda_input_map_zoomout) ||
(map_wheel_zoom && ev->type == ev_mouseb_down && ev->data1.i == KEYD_MWHEELDOWN)
(map_wheel_zoom && ev->type == ev_keydown && ev->data1.i == KEYD_MWHEELDOWN)
)
{
mtof_zoommul = M_ZOOMOUT;
Expand All @@ -1085,7 +1085,7 @@ dboolean AM_Responder
}
else if (
dsda_InputActivated(dsda_input_map_zoomin) ||
(map_wheel_zoom && ev->type == ev_mouseb_down && ev->data1.i == KEYD_MWHEELUP)
(map_wheel_zoom && ev->type == ev_keydown && ev->data1.i == KEYD_MWHEELUP)
)
{
mtof_zoommul = M_ZOOMIN;
Expand Down Expand Up @@ -1164,7 +1164,7 @@ dboolean AM_Responder
dsda_InputDeactivated(dsda_input_map_zoomout) ||
dsda_InputDeactivated(dsda_input_map_zoomin) ||
(
map_wheel_zoom && ev->type == ev_mouseb_up &&
map_wheel_zoom && ev->type == ev_keyup &&
(ev->data1.i == KEYD_MWHEELDOWN || ev->data1.i == KEYD_MWHEELUP)
)
)
Expand Down
2 changes: 0 additions & 2 deletions prboom2/src/d_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ typedef enum
{
ev_keydown,
ev_keyup,
ev_mouseb_down,
ev_mouseb_up,
ev_mouse,
ev_mousemotion,
ev_joystick,
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void D_PostEvent(event_t *ev)
// use key is used for seeing the current frame
if (
!dsda_InputActivated(dsda_input_use) && !dsda_InputActivated(dsda_input_demo_skip) &&
(ev->type == ev_keydown || ev->type == ev_keyup || ev->type == ev_mouseb_down || ev->type == ev_mouseb_up) // is this condition important?
(ev->type == ev_keydown || ev->type == ev_keyup) // is this condition important?
)
{
return;
Expand Down
12 changes: 0 additions & 12 deletions prboom2/src/dsda/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ void dsda_InputTrackEvent(event_t* ev) {
case ev_keyup:
dsda_InputTrackKeyUp(ev);
break;
case ev_mouseb_down:
dsda_InputTrackKeyDown(ev);
break;
case ev_mouseb_up:
dsda_InputTrackKeyUp(ev);
break;
case ev_mouse:
dsda_InputTrackButtons(mousebuttons, MAX_MOUSE_BUTTONS, ev);
break;
Expand Down Expand Up @@ -148,12 +142,6 @@ void dsda_InputTrackGameEvent(event_t* ev) {
case ev_keyup:
dsda_InputTrackGameKeyUp(ev);
break;
case ev_mouseb_down:
dsda_InputTrackGameKeyDown(ev);
break;
case ev_mouseb_up:
dsda_InputTrackGameKeyUp(ev);
break;
case ev_mouse:
dsda_InputTrackGameButtons(mousebuttons, MAX_MOUSE_BUTTONS, ev);
break;
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void F_CastTicker (void)

dboolean F_CastResponder (event_t* ev)
{
if (ev->type != ev_keydown && ev->type != ev_mouseb_down)
if (ev->type != ev_keydown)
return false;

if (castdeath)
Expand Down
6 changes: 0 additions & 6 deletions prboom2/src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,12 +1380,6 @@ dboolean G_Responder (event_t* ev)
case ev_keydown:
return true; // eat key down events

case ev_mouseb_up:
return true;

case ev_mouseb_down:
return true;

case ev_mousemotion:
{
double value;
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/heretic/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dboolean F_BlockingInput(void)

dboolean Heretic_F_Responder(event_t * event)
{
if (event->type != ev_keydown && event->type != ev_mouseb_down)
if (event->type != ev_keydown)
{
return false;
}
Expand Down
1 change: 0 additions & 1 deletion prboom2/src/i_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void I_SetPalette(int pal); /* CPhipps - pass down palette number */
void I_QueueFrameCapture(void);
void I_QueueScreenshot(void);
void I_HandleCapture(void);
void I_DelayEvent(void);

void I_FinishUpdate (void);

Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5624,14 +5624,14 @@ int M_EventToCharacter(event_t* ev)
}
}
}
else if (ev->type == ev_keydown || ev->type == ev_mouseb_down)
else if (ev->type == ev_keydown)
{
if (ev->data1.i == KEYD_RSHIFT) // phares 4/11/98
shiftdown = true;

return ev->data1.i;
}
else if (ev->type == ev_keyup || ev->type == ev_mouseb_up)
else if (ev->type == ev_keyup)
{
if (ev->data1.i == KEYD_RSHIFT) // phares 4/11/98
shiftdown = false;
Expand Down

0 comments on commit 3e0e792

Please sign in to comment.