2
2
3
3
bool foundIWAD = false;
4
4
bool wipeDone = true;
5
- AllButtons last_buttons [ 4 ] = { 0 };
5
+ CommonButtons last_buttons = { 0 };
6
6
7
- void handle_automap_input ( AllButtons buttons , int playerId )
7
+ void common_input ( CommonButtons buttons )
8
8
{
9
9
static int bigstate = 0 ;
10
+ m_paninc .y = 0 ;
11
+ m_paninc .x = 0 ;
10
12
11
- if (buttons .AutomapToggle && !last_buttons [playerId ].AutomapToggle )
13
+ if (buttons .ChangeGamma && !last_buttons .ChangeGamma )
14
+ {
15
+ dsda_CycleConfig (dsda_config_usegamma , true);
16
+ dsda_AddMessage (usegamma == 0 ? GAMMALVL0 :
17
+ usegamma == 1 ? GAMMALVL1 :
18
+ usegamma == 2 ? GAMMALVL2 :
19
+ usegamma == 3 ? GAMMALVL3 :
20
+ GAMMALVL4 );
21
+ }
22
+
23
+ if (buttons .AutomapToggle && !last_buttons .AutomapToggle )
12
24
{
13
25
if (automap_active )
14
26
{
@@ -19,19 +31,19 @@ void handle_automap_input(AllButtons buttons, int playerId)
19
31
AM_Start (true);
20
32
}
21
33
22
- if (buttons .AutomapFollow && !last_buttons [ playerId ] .AutomapFollow )
34
+ if (buttons .AutomapFollow && !last_buttons .AutomapFollow )
23
35
{
24
36
dsda_ToggleConfig (dsda_config_automap_follow , true);
25
37
dsda_AddMessage (automap_follow ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF );
26
38
}
27
39
28
- if (buttons .AutomapGrid && !last_buttons [ playerId ] .AutomapGrid )
40
+ if (buttons .AutomapGrid && !last_buttons .AutomapGrid )
29
41
{
30
42
dsda_ToggleConfig (dsda_config_automap_grid , true);
31
43
dsda_AddMessage (automap_grid ? AMSTR_GRIDON : AMSTR_GRIDOFF );
32
44
}
33
45
34
- if (buttons .AutomapMark && !last_buttons [ playerId ] .AutomapMark )
46
+ if (buttons .AutomapMark && !last_buttons .AutomapMark )
35
47
{
36
48
if (!raven )
37
49
{
@@ -40,13 +52,13 @@ void handle_automap_input(AllButtons buttons, int playerId)
40
52
}
41
53
}
42
54
43
- if (buttons .AutomapClearMarks && !last_buttons [ playerId ] .AutomapClearMarks )
55
+ if (buttons .AutomapClearMarks && !last_buttons .AutomapClearMarks )
44
56
{
45
57
AM_clearMarks ();
46
58
dsda_AddMessage (AMSTR_MARKSCLEARED );
47
59
}
48
60
49
- if (buttons .AutomapFullZoom && !last_buttons [ playerId ] .AutomapFullZoom )
61
+ if (buttons .AutomapFullZoom && !last_buttons .AutomapFullZoom )
50
62
{
51
63
bigstate = !bigstate ;
52
64
if (bigstate )
@@ -86,9 +98,11 @@ void handle_automap_input(AllButtons buttons, int playerId)
86
98
if (buttons .AutomapRight ) m_paninc .x += FTOM (map_pan_speed );
87
99
if (buttons .AutomapLeft ) m_paninc .x -= FTOM (map_pan_speed );
88
100
}
101
+
102
+ last_buttons = buttons ;
89
103
}
90
104
91
- void send_input (struct PackedPlayerInput * inputs , int playerId )
105
+ void player_input (struct PackedPlayerInput * inputs , int playerId )
92
106
{
93
107
local_cmds [playerId ].forwardmove = inputs -> RunSpeed ;
94
108
local_cmds [playerId ].sidemove = inputs -> StrafingSpeed ;
@@ -106,19 +120,6 @@ void send_input(struct PackedPlayerInput *inputs, int playerId)
106
120
local_cmds [playerId ].buttons |= BT_CHANGE ;
107
121
local_cmds [playerId ].buttons |= (inputs -> WeaponSelect - 1 ) << BT_WEAPONSHIFT ;
108
122
}
109
-
110
- if (inputs -> Buttons .ChangeGamma && !last_buttons [playerId ].ChangeGamma )
111
- {
112
- dsda_CycleConfig (dsda_config_usegamma , true);
113
- dsda_AddMessage (usegamma == 0 ? GAMMALVL0 :
114
- usegamma == 1 ? GAMMALVL1 :
115
- usegamma == 2 ? GAMMALVL2 :
116
- usegamma == 3 ? GAMMALVL3 :
117
- GAMMALVL4 );
118
- }
119
-
120
- handle_automap_input (inputs -> Buttons , playerId );
121
- last_buttons [playerId ] = inputs -> Buttons ;
122
123
}
123
124
124
125
ECL_EXPORT void dsda_get_audio (int * n , void * * buffer )
@@ -156,19 +157,17 @@ ECL_EXPORT void dsda_get_video(int *w, int *h, int *pitch, uint8_t **buffer, int
156
157
* paletteBuffer = _convertedPaletteBuffer ;
157
158
}
158
159
159
- ECL_EXPORT bool dsda_frame_advance (struct PackedPlayerInput * player1Inputs , struct PackedPlayerInput * player2Inputs , struct PackedPlayerInput * player3Inputs , struct PackedPlayerInput * player4Inputs , struct PackedRenderInfo * renderInfo )
160
+ ECL_EXPORT bool dsda_frame_advance (CommonButtons commonButtons , struct PackedPlayerInput * player1Inputs , struct PackedPlayerInput * player2Inputs , struct PackedPlayerInput * player3Inputs , struct PackedPlayerInput * player4Inputs , struct PackedRenderInfo * renderInfo )
160
161
{
161
162
// Setting inputs
162
163
headlessClearTickCommand ();
163
-
164
- m_paninc .y = 0 ;
165
- m_paninc .x = 0 ;
164
+ common_input (commonButtons );
166
165
167
166
// Setting Players inputs
168
- send_input (player1Inputs , 0 );
169
- send_input (player2Inputs , 1 );
170
- send_input (player3Inputs , 2 );
171
- send_input (player4Inputs , 3 );
167
+ player_input (player1Inputs , 0 );
168
+ player_input (player2Inputs , 1 );
169
+ player_input (player3Inputs , 2 );
170
+ player_input (player4Inputs , 3 );
172
171
173
172
// Enabling/Disabling rendering, as required
174
173
if ( renderInfo -> RenderVideo ) headlessEnableVideoRendering ();
0 commit comments