Skip to content

Commit 388bd1e

Browse files
committed
Replaced SDL_Scancode back to int
xrGame/key_binding_registrator_script.cpp: reformat xrGame/xr_level_controller.cpp: reformat
1 parent 4412375 commit 388bd1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+536
-294
lines changed

src/xrEngine/IInputReceiver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void IInputReceiver::IR_OnDeactivate(void)
2828
int i;
2929
for (i = 0; i < CInput::COUNT_KB_BUTTONS; i++)
3030
if (IR_GetKeyState(i))
31-
IR_OnKeyboardRelease((SDL_Scancode)i);
31+
IR_OnKeyboardRelease(i);
3232

3333
for (i = 0; i < CInput::COUNT_MOUSE_BUTTONS; i++)
3434
if (IR_GetBtnState(i))

src/xrEngine/edit_actions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ void callback_base::on_key_press(line_edit_control* const control)
4545

4646
// -------------------------------------------------------------------------------------------------
4747

48-
type_pair::type_pair(SDL_Scancode dik, char c, char c_shift, bool b_translate) { init(dik, c, c_shift, b_translate); }
48+
type_pair::type_pair(int dik, char c, char c_shift, bool b_translate) { init(dik, c, c_shift, b_translate); }
4949
type_pair::~type_pair() {}
50-
void type_pair::init(SDL_Scancode dik, char c, char c_shift, bool b_translate)
50+
void type_pair::init(int dik, char c, char c_shift, bool b_translate)
5151
{
5252
m_translate = b_translate;
5353
m_dik = dik;

src/xrEngine/edit_actions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class callback_base : public base
5252
class type_pair : public base
5353
{
5454
public:
55-
type_pair(SDL_Scancode dik, char c, char c_shift, bool b_translate);
55+
type_pair(int dik, char c, char c_shift, bool b_translate);
5656
virtual ~type_pair();
57-
void init(SDL_Scancode dik, char c, char c_shift, bool b_translate);
57+
void init(int dik, char c, char c_shift, bool b_translate);
5858
virtual void on_key_press(line_edit_control* const control);
5959

6060
private:
61-
SDL_Scancode m_dik;
61+
int m_dik;
6262
bool m_translate;
6363
char m_char;
6464
char m_char_shift;

src/xrEngine/line_edit_control.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void line_edit_control::assign_char_pairs(init_mode mode)
359359
create_char_pair(SDL_SCANCODE_Z, 'z', 'Z', true);
360360
}
361361

362-
void line_edit_control::create_key_state(SDL_Scancode const dik, key_state state)
362+
void line_edit_control::create_key_state(int const dik, key_state state)
363363
{
364364
Base* prev = m_actions[dik];
365365
// if ( m_actions[dik] )
@@ -369,7 +369,7 @@ void line_edit_control::create_key_state(SDL_Scancode const dik, key_state state
369369
m_actions[dik] = new text_editor::key_state_base(state, prev);
370370
}
371371

372-
void line_edit_control::create_char_pair(SDL_Scancode const dik, char c, char c_shift, bool translate)
372+
void line_edit_control::create_char_pair(int const dik, char c, char c_shift, bool translate)
373373
{
374374
if (m_actions[dik])
375375
{
@@ -379,7 +379,7 @@ void line_edit_control::create_char_pair(SDL_Scancode const dik, char c, char c_
379379
m_actions[dik] = new text_editor::type_pair(dik, c, c_shift, translate);
380380
}
381381

382-
void line_edit_control::assign_callback(SDL_Scancode const dik, key_state state, Callback const& callback)
382+
void line_edit_control::assign_callback(int const dik, key_state state, Callback const& callback)
383383
{
384384
VERIFY(dik < SDL_NUM_SCANCODES);
385385
Base* prev_action = m_actions[dik];
@@ -405,7 +405,7 @@ void line_edit_control::set_edit(pcstr str)
405405

406406
// ========================================================
407407

408-
void line_edit_control::on_key_press(SDL_Scancode dik)
408+
void line_edit_control::on_key_press(int dik)
409409
{
410410
if (SDL_NUM_SCANCODES <= dik)
411411
{
@@ -451,7 +451,7 @@ void line_edit_control::on_key_press(SDL_Scancode dik)
451451

452452
// -------------------------------------------------------------------------------------------------
453453

454-
void line_edit_control::on_key_hold(SDL_Scancode dik)
454+
void line_edit_control::on_key_hold(int dik)
455455
{
456456
update_key_states();
457457
update_bufs();
@@ -478,7 +478,7 @@ void line_edit_control::on_key_hold(SDL_Scancode dik)
478478
}
479479
}
480480

481-
void line_edit_control::on_key_release(SDL_Scancode dik)
481+
void line_edit_control::on_key_release(int dik)
482482
{
483483
m_accel = 1.0f;
484484
m_rep_time = 0.0f;

src/xrEngine/line_edit_control.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ class ENGINE_API line_edit_control
5555
~line_edit_control();
5656

5757
void clear_states();
58-
void on_key_press(SDL_Scancode dik);
59-
void on_key_hold(SDL_Scancode dik);
60-
void on_key_release(SDL_Scancode dik);
58+
void on_key_press(int dik);
59+
void on_key_hold(int dik);
60+
void on_key_release(int dik);
6161
void on_frame();
6262

63-
void assign_callback(SDL_Scancode const dik, key_state state, Callback const& callback);
63+
void assign_callback(int const dik, key_state state, Callback const& callback);
6464

6565
void insert_character(char c);
6666

@@ -106,8 +106,8 @@ class ENGINE_API line_edit_control
106106
void xr_stdcall SwitchKL();
107107

108108
void assign_char_pairs(init_mode mode);
109-
void create_key_state(SDL_Scancode const dik, key_state state);
110-
void create_char_pair(SDL_Scancode const dik, char c, char c_shift, bool translate = false);
109+
void create_key_state(int const dik, key_state state);
110+
void create_char_pair(int const dik, char c, char c_shift, bool translate = false);
111111

112112
void clear_inserted();
113113
bool empty_inserted();

src/xrEngine/line_editor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace text_editor
1313
line_editor::line_editor(u32 str_buffer_size) : m_control(str_buffer_size) {}
1414
line_editor::~line_editor() {}
1515
void line_editor::on_frame() { m_control.on_frame(); }
16-
void line_editor::IR_OnKeyboardPress(int dik) {m_control.on_key_press((SDL_Scancode)dik); }
17-
void line_editor::IR_OnKeyboardHold(int dik) {m_control.on_key_hold((SDL_Scancode)dik); }
18-
void line_editor::IR_OnKeyboardRelease(int dik) {m_control.on_key_release((SDL_Scancode)dik); }
16+
void line_editor::IR_OnKeyboardPress(int dik) {m_control.on_key_press(dik); }
17+
void line_editor::IR_OnKeyboardHold(int dik) {m_control.on_key_hold(dik); }
18+
void line_editor::IR_OnKeyboardRelease(int dik) {m_control.on_key_release(dik); }
1919
} // namespace text_editor

src/xrGame/Level_input.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void CLevel::IR_OnKeyboardPress(int key)
122122

123123
bool b_ui_exist = !!CurrentGameUI();
124124

125-
EGameActions _curr = get_binded_action((SDL_Scancode) key);
125+
EGameActions _curr = get_binded_action(key);
126126

127127
#ifdef INPUT_CALLBACKS
128128
/* avo: script callback */
@@ -167,7 +167,7 @@ void CLevel::IR_OnKeyboardPress(int key)
167167
{
168168
if (b_ui_exist && CurrentGameUI()->TopInputReceiver())
169169
{
170-
if (CurrentGameUI()->IR_UIOnKeyboardPress((SDL_Scancode) key))
170+
if (CurrentGameUI()->IR_UIOnKeyboardPress(key))
171171
return; // special case for mp and main_menu
172172
CurrentGameUI()->TopInputReceiver()->HideDialog();
173173
}
@@ -183,7 +183,7 @@ void CLevel::IR_OnKeyboardPress(int key)
183183
if (!bReady || !b_ui_exist)
184184
return;
185185

186-
if (b_ui_exist && CurrentGameUI()->IR_UIOnKeyboardPress((SDL_Scancode) key))
186+
if (b_ui_exist && CurrentGameUI()->IR_UIOnKeyboardPress(key))
187187
return;
188188

189189
if (Device.Paused() && !IsDemoPlay()
@@ -193,7 +193,7 @@ void CLevel::IR_OnKeyboardPress(int key)
193193
)
194194
return;
195195

196-
if (game && game->OnKeyboardPress(get_binded_action((SDL_Scancode) key)))
196+
if (game && game->OnKeyboardPress(get_binded_action(key)))
197197
return;
198198

199199
if (_curr == kQUICK_SAVE && IsGameTypeSingle())
@@ -475,14 +475,14 @@ void CLevel::IR_OnKeyboardPress(int key)
475475
}
476476
#endif // MASTER_GOLD
477477

478-
if (bindConsoleCmds.execute((SDL_Scancode)key))
478+
if (bindConsoleCmds.execute(key))
479479
return;
480480

481481
if (CURRENT_ENTITY())
482482
{
483483
IInputReceiver* IR = smart_cast<IInputReceiver*>(smart_cast<CGameObject*>(CURRENT_ENTITY()));
484484
if (IR)
485-
IR->IR_OnKeyboardPress(get_binded_action((SDL_Scancode)key));
485+
IR->IR_OnKeyboardPress(get_binded_action(key));
486486
}
487487

488488
#ifdef _DEBUG
@@ -508,9 +508,9 @@ void CLevel::IR_OnKeyboardRelease(int key)
508508
/* avo: end */
509509
#endif
510510

511-
if (CurrentGameUI() && CurrentGameUI()->IR_UIOnKeyboardRelease((SDL_Scancode) key))
511+
if (CurrentGameUI() && CurrentGameUI()->IR_UIOnKeyboardRelease(key))
512512
return;
513-
if (game && game->OnKeyboardRelease(get_binded_action((SDL_Scancode)key)))
513+
if (game && game->OnKeyboardRelease(get_binded_action(key)))
514514
return;
515515
if (Device.Paused()
516516
#ifdef DEBUG
@@ -523,7 +523,7 @@ void CLevel::IR_OnKeyboardRelease(int key)
523523
{
524524
IInputReceiver* IR = smart_cast<IInputReceiver*>(smart_cast<CGameObject*>(CURRENT_ENTITY()));
525525
if (IR)
526-
IR->IR_OnKeyboardRelease(get_binded_action((SDL_Scancode)key));
526+
IR->IR_OnKeyboardRelease(get_binded_action(key));
527527
}
528528
}
529529

@@ -568,7 +568,7 @@ void CLevel::IR_OnKeyboardHold(int key)
568568

569569
#endif // DEBUG
570570

571-
if (CurrentGameUI() && CurrentGameUI()->IR_UIOnKeyboardHold((SDL_Scancode)key))
571+
if (CurrentGameUI() && CurrentGameUI()->IR_UIOnKeyboardHold(key))
572572
return;
573573
if (Device.Paused() && !Level().IsDemoPlay()
574574
#ifdef DEBUG
@@ -580,7 +580,7 @@ void CLevel::IR_OnKeyboardHold(int key)
580580
{
581581
IInputReceiver* IR = smart_cast<IInputReceiver*>(smart_cast<CGameObject*>(CURRENT_ENTITY()));
582582
if (IR)
583-
IR->IR_OnKeyboardHold(get_binded_action((SDL_Scancode)key));
583+
IR->IR_OnKeyboardHold(get_binded_action(key));
584584
}
585585
}
586586

@@ -594,7 +594,7 @@ void CLevel::IR_OnActivate()
594594
{
595595
if (IR_GetKeyState(i))
596596
{
597-
EGameActions action = get_binded_action((SDL_Scancode) i);
597+
EGameActions action = get_binded_action(i);
598598
switch (action)
599599
{
600600
case kFWD:

src/xrGame/MainMenu.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void CMainMenu::IR_OnKeyboardPress(int dik)
340340
if (!IsActive())
341341
return;
342342

343-
if (is_binded(kCONSOLE, (SDL_Scancode)dik))
343+
if (is_binded(kCONSOLE, dik))
344344
{
345345
Console->Show();
346346
return;
@@ -351,23 +351,23 @@ void CMainMenu::IR_OnKeyboardPress(int dik)
351351
return;
352352
}
353353

354-
CDialogHolder::IR_UIOnKeyboardPress((SDL_Scancode)dik);
354+
CDialogHolder::IR_UIOnKeyboardPress(dik);
355355
};
356356

357357
void CMainMenu::IR_OnKeyboardRelease(int dik)
358358
{
359359
if (!IsActive())
360360
return;
361361

362-
CDialogHolder::IR_UIOnKeyboardRelease((SDL_Scancode)dik);
362+
CDialogHolder::IR_UIOnKeyboardRelease(dik);
363363
};
364364

365365
void CMainMenu::IR_OnKeyboardHold(int dik)
366366
{
367367
if (!IsActive())
368368
return;
369369

370-
CDialogHolder::IR_UIOnKeyboardHold((SDL_Scancode)dik);
370+
CDialogHolder::IR_UIOnKeyboardHold(dik);
371371
};
372372

373373
void CMainMenu::IR_OnMouseWheel(int x, int y)

src/xrGame/UIDialogHolder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void CDialogHolder::CleanInternals()
239239
GetUICursor().Hide();
240240
}
241241

242-
bool CDialogHolder::IR_UIOnKeyboardPress(SDL_Scancode dik)
242+
bool CDialogHolder::IR_UIOnKeyboardPress(int dik)
243243
{
244244
CUIDialogWnd* TIR = TopInputReceiver();
245245
if (!TIR)
@@ -279,7 +279,7 @@ bool CDialogHolder::IR_UIOnKeyboardPress(SDL_Scancode dik)
279279
return true;
280280
}
281281

282-
bool CDialogHolder::IR_UIOnKeyboardRelease(SDL_Scancode dik)
282+
bool CDialogHolder::IR_UIOnKeyboardRelease(int dik)
283283
{
284284
CUIDialogWnd* TIR = TopInputReceiver();
285285
if (!TIR)
@@ -314,7 +314,7 @@ bool CDialogHolder::IR_UIOnKeyboardRelease(SDL_Scancode dik)
314314
return true;
315315
}
316316

317-
bool CDialogHolder::IR_UIOnKeyboardHold(SDL_Scancode dik)
317+
bool CDialogHolder::IR_UIOnKeyboardHold(int dik)
318318
{
319319
CUIDialogWnd* TIR = TopInputReceiver();
320320
if (!TIR)

src/xrGame/UIDialogHolder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class CDialogHolder : public pureFrame
5959
virtual void StartDialog(CUIDialogWnd* pDialog, bool bDoHideIndicators);
6060
virtual void StopDialog(CUIDialogWnd* pDialog);
6161
virtual bool IgnorePause() { return false; }
62-
virtual bool IR_UIOnKeyboardPress(SDL_Scancode dik);
63-
virtual bool IR_UIOnKeyboardRelease(SDL_Scancode dik);
62+
virtual bool IR_UIOnKeyboardPress(int dik);
63+
virtual bool IR_UIOnKeyboardRelease(int dik);
6464
virtual bool IR_UIOnMouseMove(int dx, int dy);
6565
virtual bool IR_UIOnMouseWheel(int x, int y);
66-
virtual bool IR_UIOnKeyboardHold(SDL_Scancode dik);
66+
virtual bool IR_UIOnKeyboardHold(int dik);
6767
};

0 commit comments

Comments
 (0)