From 9b150257fb3e0eccaa75bad4dc9a54a8671687d7 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Wed, 5 Oct 2022 10:11:47 +0300 Subject: [PATCH] Rename some input functions --- src/animation.cc | 2 +- src/automap.cc | 2 +- src/character_editor.cc | 50 +++++++++++++++++------------------ src/character_selector.cc | 2 +- src/combat.cc | 4 +-- src/credits.cc | 8 +++--- src/cycle.cc | 2 +- src/dbox.cc | 18 ++++++------- src/elevator.cc | 6 ++--- src/endgame.cc | 20 +++++++------- src/game.cc | 4 +-- src/game_dialog.cc | 26 +++++++++--------- src/game_mouse.cc | 14 +++++----- src/game_movie.cc | 2 +- src/input.cc | 24 ++++++++--------- src/input.h | 12 ++++----- src/interface.cc | 20 +++++++------- src/interpreter.cc | 2 +- src/interpreter_lib.cc | 4 +-- src/inventory.cc | 36 ++++++++++++------------- src/kb.cc | 2 +- src/lips.cc | 2 +- src/loadsave.cc | 16 +++++------ src/main.cc | 18 ++++++------- src/map.cc | 2 +- src/mouse.cc | 14 +++++----- src/mouse_manager.cc | 2 +- src/movie.cc | 2 +- src/options.cc | 14 +++++----- src/palette.cc | 2 +- src/pipboy.cc | 38 +++++++++++++------------- src/selfrun.cc | 6 ++--- src/skilldex.cc | 4 +-- src/vcr.cc | 6 ++--- src/window.cc | 2 +- src/window_manager.cc | 4 +-- src/window_manager_private.cc | 6 ++--- src/worldmap.cc | 14 +++++----- 38 files changed, 206 insertions(+), 206 deletions(-) diff --git a/src/animation.cc b/src/animation.cc index a4fd889..122bd91 100644 --- a/src/animation.cc +++ b/src/animation.cc @@ -2787,7 +2787,7 @@ void _object_animate() Object* object = sad->obj; - unsigned int time = _get_time(); + unsigned int time = getTicks(); if (getTicksBetween(time, sad->animationTimestamp) < sad->ticksPerFrame) { continue; } diff --git a/src/automap.cc b/src/automap.cc index 6097b6e..189ef23 100644 --- a/src/automap.cc +++ b/src/automap.cc @@ -404,7 +404,7 @@ void automapShow(bool isInGame, bool isUsingScanner) // FIXME: There is minor bug in the interface - pressing H/L to toggle // high/low details does not update switch state. - int keyCode = _get_input(); + int keyCode = inputGetInput(); switch (keyCode) { case KEY_TAB: case KEY_ESCAPE: diff --git a/src/character_editor.cc b/src/character_editor.cc index 31f155f..eebd6f0 100644 --- a/src/character_editor.cc +++ b/src/character_editor.cc @@ -817,8 +817,8 @@ int characterEditorShow(bool isCreationMode) int rc = -1; while (rc == -1) { - _frame_time = _get_time(); - int keyCode = _get_input(); + _frame_time = getTicks(); + int keyCode = inputGetInput(); convertMouseWheelToArrowKey(&keyCode); @@ -1929,9 +1929,9 @@ static int _get_input_str(int win, int cancelKeyCode, char* text, int maxLength, int rc = 1; while (rc == 1) { - _frame_time = _get_time(); + _frame_time = getTicks(); - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == cancelKeyCode) { rc = 0; } else if (keyCode == KEY_RETURN) { @@ -2255,7 +2255,7 @@ static void characterEditorDrawBigNumber(int x, int y, int flags, int value, int if (flags & ANIMATE) { if (previousValue % 10 != ones) { - _frame_time = _get_time(); + _frame_time = getTicks(); blitBufferToBuffer(numbersGraphicBufferPtr + BIG_NUM_WIDTH * 11, BIG_NUM_WIDTH, BIG_NUM_HEIGHT, @@ -2276,7 +2276,7 @@ static void characterEditorDrawBigNumber(int x, int y, int flags, int value, int windowRefreshRect(windowHandle, &rect); if (previousValue / 10 != tens) { - _frame_time = _get_time(); + _frame_time = getTicks(); blitBufferToBuffer(numbersGraphicBufferPtr + BIG_NUM_WIDTH * 11, BIG_NUM_WIDTH, BIG_NUM_HEIGHT, @@ -3399,12 +3399,12 @@ static int characterEditorEditAge() } while (true) { - _frame_time = _get_time(); + _frame_time = getTicks(); change = 0; flags = 0; int v32 = 0; - keyCode = _get_input(); + keyCode = inputGetInput(); if (keyCode == KEY_RETURN || keyCode == 500) { if (keyCode != 500) { @@ -3462,7 +3462,7 @@ static int characterEditorEditAge() _repFtime = 4; while (true) { - _frame_time = _get_time(); + _frame_time = getTicks(); v33++; @@ -3512,7 +3512,7 @@ static int characterEditorEditAge() ; } - keyCode = _get_input(); + keyCode = inputGetInput(); if (keyCode == 503 || keyCode == 504 || _game_user_wants_to_quit != 0) { break; } @@ -3627,9 +3627,9 @@ static void characterEditorEditGender() _win_set_button_rest_state(btns[savedGender], 1, 0); while (true) { - _frame_time = _get_time(); + _frame_time = getTicks(); - int eventCode = _get_input(); + int eventCode = inputGetInput(); if (eventCode == KEY_RETURN || eventCode == 500) { if (eventCode == KEY_RETURN) { @@ -3692,7 +3692,7 @@ static void characterEditorAdjustPrimaryStat(int eventCode) bool cont = true; do { - _frame_time = _get_time(); + _frame_time = getTicks(); if (v11 <= 19.2) { v11++; } @@ -3747,7 +3747,7 @@ static void characterEditorAdjustPrimaryStat(int eventCode) while (getTicksSince(_frame_time) < 1000 / 24) { } } - } while (_get_input() != 518 && cont); + } while (inputGetInput() != 518 && cont); characterEditorDrawCard(); } @@ -3854,7 +3854,7 @@ static int characterEditorShowOptions() int rc = 0; while (rc == 0) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (_game_user_wants_to_quit != 0) { rc = 2; @@ -5161,7 +5161,7 @@ static void characterEditorHandleAdjustSkillButtonPressed(int keyCode) int repeatDelay = 0; for (;;) { - _frame_time = _get_time(); + _frame_time = getTicks(); if (repeatDelay <= dbl_5018F0) { repeatDelay++; } @@ -5244,7 +5244,7 @@ static void characterEditorHandleAdjustSkillButtonPressed(int keyCode) } } - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode != 522 && keyCode != 524 && rc != -1) { continue; } @@ -5954,7 +5954,7 @@ static int perkDialogHandleInput(int count, void (*refreshProc)()) int rc = 0; while (rc == 0) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); int v19 = 0; convertMouseWheelToArrowKey(&keyCode); @@ -6067,7 +6067,7 @@ static int perkDialogHandleInput(int count, void (*refreshProc)()) gPerkDialogPreviousCurrentLine = -2; do { - _frame_time = _get_time(); + _frame_time = getTicks(); if (v19 <= dbl_5019BE) { v19++; } @@ -6099,7 +6099,7 @@ static int perkDialogHandleInput(int count, void (*refreshProc)()) while (getTicksSince(_frame_time) < 1000 / _repFtime) { } } - } while (_get_input() != 574); + } while (inputGetInput() != 574); break; case 573: @@ -6108,7 +6108,7 @@ static int perkDialogHandleInput(int count, void (*refreshProc)()) if (count > 11) { do { - _frame_time = _get_time(); + _frame_time = getTicks(); if (v19 <= dbl_5019BE) { v19++; } @@ -6141,10 +6141,10 @@ static int perkDialogHandleInput(int count, void (*refreshProc)()) while (getTicksSince(_frame_time) < 1000 / _repFtime) { } } - } while (_get_input() != 575); + } while (inputGetInput() != 575); } else { do { - _frame_time = _get_time(); + _frame_time = getTicks(); if (v19 <= dbl_5019BE) { v19++; } @@ -6172,7 +6172,7 @@ static int perkDialogHandleInput(int count, void (*refreshProc)()) while (getTicksSince(_frame_time) < 1000 / _repFtime) { } } - } while (_get_input() != 575); + } while (inputGetInput() != 575); } break; case KEY_HOME: @@ -6193,7 +6193,7 @@ static int perkDialogHandleInput(int count, void (*refreshProc)()) break; default: if (getTicksSince(_frame_time) > 700) { - _frame_time = _get_time(); + _frame_time = getTicks(); gPerkDialogPreviousCurrentLine = -2; } break; diff --git a/src/character_selector.cc b/src/character_selector.cc index 675e755..1f570db 100644 --- a/src/character_selector.cc +++ b/src/character_selector.cc @@ -167,7 +167,7 @@ int characterSelectorOpen() break; } - int keyCode = _get_input(); + int keyCode = inputGetInput(); switch (keyCode) { case KEY_MINUS: diff --git a/src/combat.cc b/src/combat.cc index 731c944..aaac9d7 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -3141,7 +3141,7 @@ static int _combat_input() break; } - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (_action_explode_running()) { while (_combat_turn_running > 0) { _process_bk(); @@ -5581,7 +5581,7 @@ static int calledShotSelectHitLocation(Object* critter, int* hitLocation, int hi int eventCode; while (true) { - eventCode = _get_input(); + eventCode = inputGetInput(); if (eventCode == KEY_ESCAPE) { break; diff --git a/src/credits.cc b/src/credits.cc index d4bc2ef..7ba16e7 100644 --- a/src/credits.cc +++ b/src/credits.cc @@ -153,7 +153,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle) unsigned char* dest = intermediateBuffer + CREDITS_WINDOW_WIDTH * CREDITS_WINDOW_HEIGHT - CREDITS_WINDOW_WIDTH + (CREDITS_WINDOW_WIDTH - v19) / 2; unsigned char* src = stringBuffer; for (int index = 0; index < lineHeight; index++) { - if (_get_input() != -1) { + if (inputGetInput() != -1) { stop = true; break; } @@ -178,7 +178,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle) while (getTicksSince(tick) < CREDITS_WINDOW_SCROLLING_DELAY) { } - tick = _get_time(); + tick = getTicks(); windowRefresh(window); @@ -192,7 +192,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle) if (!stop) { for (int index = 0; index < CREDITS_WINDOW_HEIGHT; index++) { - if (_get_input() != -1) { + if (inputGetInput() != -1) { break; } @@ -216,7 +216,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle) while (getTicksSince(tick) < CREDITS_WINDOW_SCROLLING_DELAY) { } - tick = _get_time(); + tick = getTicks(); windowRefresh(window); } diff --git a/src/cycle.cc b/src/cycle.cc index 20b3a5c..a78e4ef 100644 --- a/src/cycle.cc +++ b/src/cycle.cc @@ -222,7 +222,7 @@ void colorCycleTicker() bool changed = false; unsigned char* palette = _getSystemPalette(); - unsigned int time = _get_time(); + unsigned int time = getTicks(); if (getTicksBetween(time, gColorCycleTimestamp1) >= COLOR_CYCLE_PERIOD_1 * gColorCycleSpeedFactor) { changed = true; diff --git a/src/dbox.cc b/src/dbox.cc index fee81d0..a04b041 100644 --- a/src/dbox.cc +++ b/src/dbox.cc @@ -498,7 +498,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i int rc = -1; while (rc == -1) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == 500) { rc = 1; @@ -698,8 +698,8 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen int rc = -1; while (rc == -1) { - unsigned int tick = _get_time(); - int keyCode = _get_input(); + unsigned int tick = getTicks(); + int keyCode = inputGetInput(); int scrollDirection = FILE_DIALOG_SCROLL_DIRECTION_NONE; int scrollCounter = 0; bool isScrolling = false; @@ -808,7 +808,7 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen unsigned int scrollDelay = 4; doubleClickSelectedFileIndex = -2; while (1) { - unsigned int scrollTick = _get_time(); + unsigned int scrollTick = getTicks(); scrollCounter += 1; if ((!isScrolling && scrollCounter == 1) || (isScrolling && scrollCounter > 14.4)) { isScrolling = true; @@ -860,7 +860,7 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen break; } - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == 505 || keyCode == 503) { break; } @@ -1085,8 +1085,8 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen int rc = -1; while (rc == -1) { - unsigned int tick = _get_time(); - int keyCode = _get_input(); + unsigned int tick = getTicks(); + int keyCode = inputGetInput(); int scrollDirection = FILE_DIALOG_SCROLL_DIRECTION_NONE; int scrollCounter = 0; bool isScrolling = false; @@ -1232,7 +1232,7 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen unsigned int scrollDelay = 4; doubleClickSelectedFileIndex = -2; while (1) { - unsigned int scrollTick = _get_time(); + unsigned int scrollTick = getTicks(); scrollCounter += 1; if ((!isScrolling && scrollCounter == 1) || (isScrolling && scrollCounter > 14.4)) { isScrolling = true; @@ -1301,7 +1301,7 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen break; } - int key = _get_input(); + int key = inputGetInput(); if (key == 505 || key == 503) { break; } diff --git a/src/elevator.cc b/src/elevator.cc index ea3f255..9b53429 100644 --- a/src/elevator.cc +++ b/src/elevator.cc @@ -394,7 +394,7 @@ int elevatorSelectLevel(int elevator, int* mapPtr, int* elevationPtr, int* tileP bool done = false; int keyCode; while (!done) { - keyCode = _get_input(); + keyCode = inputGetInput(); if (keyCode == KEY_ESCAPE) { done = true; } @@ -434,7 +434,7 @@ int elevatorSelectLevel(int elevator, int* mapPtr, int* elevationPtr, int* tileP float v41 = (float)keyCode * v42; float v44 = (float)(*elevationPtr) * v42; do { - unsigned int tick = _get_time(); + unsigned int tick = getTicks(); v44 += v43; blitBufferToBuffer( _elevatorFrmImages[ELEVATOR_FRM_GAUGE].getData() + v18 * (int)v44, @@ -450,7 +450,7 @@ int elevatorSelectLevel(int elevator, int* mapPtr, int* elevationPtr, int* tileP } } while ((v43 <= 0.0 || v44 < v41) && (v43 > 0.0 || v44 > v41)); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); } } diff --git a/src/endgame.cc b/src/endgame.cc index c1d5c24..2aa9557 100644 --- a/src/endgame.cc +++ b/src/endgame.cc @@ -240,7 +240,7 @@ void endgamePlayMovie() tickersAdd(_endgame_movie_bk_process); backgroundSoundSetEndCallback(_endgame_movie_callback); backgroundSoundLoad("akiss", 12, 14, 15); - coreDelayProcessingEvents(3000); + inputPauseForTocks(3000); // NOTE: Result is ignored. I guess there was some kind of switch for male // vs. female ending, but it was not implemented. @@ -371,7 +371,7 @@ static void endgameEndingRenderPanningScene(int direction, const char* narratorF windowRefresh(gEndgameEndingSlideshowWindow); - since = _get_time(); + since = getTicks(); bool v14; double v31; @@ -411,7 +411,7 @@ static void endgameEndingRenderPanningScene(int direction, const char* narratorF soundContinueAll(); - if (_get_input() != -1) { + if (inputGetInput() != -1) { // NOTE: Uninline. endgameEndingVoiceOverFree(); break; @@ -427,7 +427,7 @@ static void endgameEndingRenderPanningScene(int direction, const char* narratorF } while (mouseGetEvent() != 0) { - _get_input(); + inputGetInput(); } } @@ -458,17 +458,17 @@ static void endgameEndingRenderStaticScene(int fid, const char* narratorFileName paletteFadeTo(_cmap); - coreDelayProcessingEvents(500); + inputPauseForTocks(500); // NOTE: Uninline. endgameEndingVoiceOverReset(); - unsigned int referenceTime = _get_time(); + unsigned int referenceTime = getTicks(); tickersDisable(); int keyCode; while (true) { - keyCode = _get_input(); + keyCode = inputGetInput(); if (keyCode != -1) { break; } @@ -499,13 +499,13 @@ static void endgameEndingRenderStaticScene(int fid, const char* narratorFileName gEndgameEndingVoiceOverSubtitlesLoaded = false; if (keyCode == -1) { - coreDelayProcessingEvents(500); + inputPauseForTocks(500); } paletteFadeTo(gPaletteBlack); while (mouseGetEvent() != 0) { - _get_input(); + inputGetInput(); } } @@ -689,7 +689,7 @@ static void endgameEndingVoiceOverReset() } if (gEndgameEndingVoiceOverSubtitlesLoaded) { - gEndgameEndingSubtitlesReferenceTime = _get_time(); + gEndgameEndingSubtitlesReferenceTime = getTicks(); } } diff --git a/src/game.cc b/src/game.cc index 8310c0f..ffb73de 100644 --- a/src/game.cc +++ b/src/game.cc @@ -1149,11 +1149,11 @@ static void showHelp() colorPaletteLoad("art\\intrface\\helpscrn.pal"); paletteSetEntries(_cmap); - while (_get_input() == -1 && _game_user_wants_to_quit == 0) { + while (inputGetInput() == -1 && _game_user_wants_to_quit == 0) { } while (mouseGetEvent() != 0) { - _get_input(); + inputGetInput(); } paletteSetEntries(gPaletteBlack); diff --git a/src/game_dialog.cc b/src/game_dialog.cc index 5697e39..3999fc3 100644 --- a/src/game_dialog.cc +++ b/src/game_dialog.cc @@ -1442,7 +1442,7 @@ int gameDialogShowReview() gameDialogReviewWindowUpdate(win, v1); while (true) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == 17 || keyCode == 24 || keyCode == 324) { showQuitConfirmationDialog(); } @@ -1839,13 +1839,13 @@ int _gdProcess() _gdReplyTooBig = 1; } - unsigned int tick = _get_time(); + unsigned int tick = getTicks(); int pageCount = 0; int pageIndex = 0; int pageOffsets[10]; pageOffsets[0] = 0; for (;;) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); convertMouseWheelToArrowKey(&keyCode); @@ -1956,7 +1956,7 @@ int _gdProcess() break; } - tick = _get_time(); + tick = getTicks(); if (dword_58F4E0) { v18 = 1; @@ -2508,7 +2508,7 @@ void gameDialogWaitForFidgetToComplete() while (artGetFrameCount(gGameDialogFidgetFrm) > gGameDialogFidgetFrmCurrentFrame) { if (getTicksSince(gGameDialogFidgetLastUpdateTimestamp) >= gGameDialogFidgetUpdateDelay) { gameDialogRenderTalkingHead(gGameDialogFidgetFrm, gGameDialogFidgetFrmCurrentFrame); - gGameDialogFidgetLastUpdateTimestamp = _get_time(); + gGameDialogFidgetLastUpdateTimestamp = getTicks(); gGameDialogFidgetFrmCurrentFrame++; } } @@ -2554,7 +2554,7 @@ void _gdPlayTransition(int anim) while (frame < artGetFrameCount(headFrm)) { if (getTicksSince(time) >= delay) { gameDialogRenderTalkingHead(headFrm, frame); - time = _get_time(); + time = getTicks(); frame++; } } @@ -2801,7 +2801,7 @@ void gameDialogTicker() _can_start_new_fidget = true; } else { gameDialogRenderTalkingHead(gGameDialogFidgetFrm, gGameDialogFidgetFrmCurrentFrame); - gGameDialogFidgetLastUpdateTimestamp = _get_time(); + gGameDialogFidgetLastUpdateTimestamp = getTicks(); gGameDialogFidgetFrmCurrentFrame += 1; } } @@ -2901,7 +2901,7 @@ void _gdialog_scroll_subwin(int win, int a2, unsigned char* a3, unsigned char* a v7 += 10; v9 -= 10 * (GAME_DIALOG_WINDOW_WIDTH); - tick = _get_time(); + tick = getTicks(); while (getTicksSince(tick) < 33) { } } @@ -2936,7 +2936,7 @@ void _gdialog_scroll_subwin(int win, int a2, unsigned char* a3, unsigned char* a rect.top += 10; - tick = _get_time(); + tick = getTicks(); while (getTicksSince(tick) < 33) { } } @@ -3624,7 +3624,7 @@ void partyMemberControlWindowHandleEvents() bool done = false; while (!done) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode != -1) { if (keyCode == KEY_CTRL_Q || keyCode == KEY_CTRL_X || keyCode == KEY_F10) { showQuitConfirmationDialog(); @@ -3864,7 +3864,7 @@ void partyMemberCustomizationWindowHandleEvents() { bool done = false; while (!done) { - unsigned int keyCode = _get_input(); + unsigned int keyCode = inputGetInput(); if (keyCode != -1) { if (keyCode == KEY_CTRL_Q || keyCode == KEY_CTRL_X || keyCode == KEY_F10) { showQuitConfirmationDialog(); @@ -4066,7 +4066,7 @@ int _gdCustomSelect(int a1) bool done = false; unsigned int v53 = 0; while (!done) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == -1) { continue; } @@ -4107,7 +4107,7 @@ int _gdCustomSelect(int a1) continue; } - unsigned int timestamp = _get_time(); + unsigned int timestamp = getTicks(); if (newValue == value) { if (getTicksBetween(timestamp, v53) < 250) { _custom_current_selected[a1] = newValue; diff --git a/src/game_mouse.cc b/src/game_mouse.cc index e398eb6..7f12684 100644 --- a/src/game_mouse.cc +++ b/src/game_mouse.cc @@ -1019,7 +1019,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState) _gmouse_3d_hover_test = true; gGameMouseLastY = mouseY; gGameMouseLastX = mouseX; - _gmouse_3d_last_move_time = _get_time() - 250; + _gmouse_3d_last_move_time = getTicks() - 250; } return; } @@ -1141,7 +1141,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState) int v33 = mouseY; int actionIndex = 0; while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_UP) == 0) { - _get_input(); + inputGetInput(); if (_game_user_wants_to_quit != 0) { actionMenuItems[actionIndex] = 0; @@ -1170,7 +1170,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState) _gmouse_3d_hover_test = false; gGameMouseLastX = mouseX; gGameMouseLastY = mouseY; - _gmouse_3d_last_move_time = _get_time(); + _gmouse_3d_last_move_time = getTicks(); _mouse_set_position(mouseX, v33); @@ -1276,7 +1276,7 @@ int gameMouseSetCursor(int cursor) bool shouldUpdate = true; int frame = 0; if (cursor >= FIRST_GAME_MOUSE_ANIMATED_CURSOR) { - unsigned int tick = _get_time(); + unsigned int tick = getTicks(); if ((gGameMouseHexCursor->flags & OBJECT_HIDDEN) == 0) { gameMouseObjectsHide(); @@ -1395,7 +1395,7 @@ void gameMouseSetMode(int mode) gGameMouseMode = mode; _gmouse_3d_hover_test = false; - _gmouse_3d_last_move_time = _get_time(); + _gmouse_3d_last_move_time = getTicks(); tileWindowRefreshRect(&rect, gElevation); @@ -1563,7 +1563,7 @@ void gameMouseObjectsShow() } _gmouse_3d_hover_test = false; - _gmouse_3d_last_move_time = _get_time() - 250; + _gmouse_3d_last_move_time = getTicks() - 250; } // 0x44CE34 @@ -2027,7 +2027,7 @@ int gameMouseObjectsReset() gGameMouseLastX = -1; gGameMouseLastY = -1; _gmouse_3d_hover_test = false; - _gmouse_3d_last_move_time = _get_time(); + _gmouse_3d_last_move_time = getTicks(); gameMouseLoadItemHighlight(); return 0; diff --git a/src/game_movie.cc b/src/game_movie.cc index fde87ab..49da63f 100644 --- a/src/game_movie.cc +++ b/src/game_movie.cc @@ -252,7 +252,7 @@ int gameMoviePlay(int movie, int flags) int v11 = 0; int buttons; do { - if (!_moviePlaying() || _game_user_wants_to_quit || _get_input() != -1) { + if (!_moviePlaying() || _game_user_wants_to_quit || inputGetInput() != -1) { break; } diff --git a/src/input.cc b/src/input.cc index 9e7eeee..a8b76d9 100644 --- a/src/input.cc +++ b/src/input.cc @@ -117,7 +117,7 @@ static TickerListNode* gTickerListHead; static unsigned int gTickerLastTimestamp; // 0x4C8A70 -int coreInit(int a1) +int inputInit(int a1) { if (!directInputInit()) { return -1; @@ -159,7 +159,7 @@ int coreInit(int a1) } // 0x4C8B40 -void coreExit() +void inputExit() { _GNW95_input_init(); mouseFree(); @@ -175,7 +175,7 @@ void coreExit() } // 0x4C8B78 -int _get_input() +int inputGetInput() { int v3; @@ -377,7 +377,7 @@ static void pauseGame() int win = gPauseHandler(); - while (_get_input() != KEY_ESCAPE) { + while (inputGetInput() != KEY_ESCAPE) { } gPaused = false; @@ -606,24 +606,24 @@ void screenshotHandlerConfigure(int keyCode, ScreenshotHandler* handler) } // 0x4C9370 -unsigned int _get_time() +unsigned int getTicks() { return SDL_GetTicks(); } // 0x4C937C -void coreDelayProcessingEvents(unsigned int delay) +void inputPauseForTocks(unsigned int delay) { // NOTE: Uninline. - unsigned int start = _get_time(); - unsigned int end = _get_time(); + unsigned int start = getTicks(); + unsigned int end = getTicks(); // NOTE: Uninline. unsigned int diff = getTicksBetween(end, start); while (diff < delay) { _process_bk(); - end = _get_time(); + end = getTicks(); // NOTE: Uninline. diff = getTicksBetween(end, start); @@ -631,7 +631,7 @@ void coreDelayProcessingEvents(unsigned int delay) } // 0x4C93B8 -void coreDelay(unsigned int ms) +void inputBlockForTocks(unsigned int ms) { unsigned int start = SDL_GetTicks(); unsigned int diff; @@ -1123,7 +1123,7 @@ void _GNW95_process_message() if (gProgramIsActive && !keyboardIsDisabled()) { // NOTE: Uninline - int tick = _get_time(); + int tick = getTicks(); for (int key = 0; key < SDL_NUM_SCANCODES; key++) { RepeatInfo* ptr = &(_GNW95_key_time_stamps[key]); @@ -1165,7 +1165,7 @@ static void _GNW95_process_key(KeyboardData* data) } else { RepeatInfo* ptr = &(_GNW95_key_time_stamps[data->key]); if (data->down == 1) { - ptr->tick = _get_time(); + ptr->tick = getTicks(); ptr->repeatCount = 0; } else { ptr->tick = -1; diff --git a/src/input.h b/src/input.h index 2d09bbd..6728480 100644 --- a/src/input.h +++ b/src/input.h @@ -10,9 +10,9 @@ typedef void(TickerProc)(); typedef int(PauseHandler)(); typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, unsigned char* palette); -int coreInit(int a1); -void coreExit(); -int _get_input(); +int inputInit(int a1); +void inputExit(); +int inputGetInput(); void _process_bk(); void enqueueInputEvent(int a1); void inputEventQueueReset(); @@ -25,9 +25,9 @@ void pauseHandlerConfigure(int keyCode, PauseHandler* fn); void takeScreenshot(); int screenshotHandlerDefaultImpl(int width, int height, unsigned char* data, unsigned char* palette); void screenshotHandlerConfigure(int keyCode, ScreenshotHandler* handler); -unsigned int _get_time(); -void coreDelayProcessingEvents(unsigned int ms); -void coreDelay(unsigned int ms); +unsigned int getTicks(); +void inputPauseForTocks(unsigned int ms); +void inputBlockForTocks(unsigned int ms); unsigned int getTicksSince(unsigned int a1); unsigned int getTicksBetween(unsigned int a1, unsigned int a2); unsigned int _get_bk_time(); diff --git a/src/interface.cc b/src/interface.cc index 297e2ee..fd554ac 100644 --- a/src/interface.cc +++ b/src/interface.cc @@ -1366,7 +1366,7 @@ void interfaceBarEndButtonsShow(bool animated) windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); } - time = _get_time(); + time = getTicks(); frame++; } gameMouseRefresh(); @@ -1421,7 +1421,7 @@ void interfaceBarEndButtonsHide(bool animated) windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect); } - time = _get_time(); + time = getTicks(); frame--; } gameMouseRefresh(); @@ -1808,7 +1808,7 @@ static void interfaceBarSwapHandsAnimatePutAwayTakeOutSequence(int previousWeapo break; } - _get_input(); + inputGetInput(); } gameMouseSetCursor(MOUSE_CURSOR_NONE); @@ -2045,7 +2045,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i blitBufferToBuffer(upSrc, 9, 17, 360, onesDest, 640); _mouse_info(); gameMouseRefresh(); - coreDelay(delay); + inputBlockForTocks(delay); windowRefreshRect(gInterfaceBarWindow, &numbersRect); ones += v49; @@ -2054,7 +2054,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i blitBufferToBuffer(upSrc, 9, 17, 360, tensDest, 640); _mouse_info(); gameMouseRefresh(); - coreDelay(delay); + inputBlockForTocks(delay); windowRefreshRect(gInterfaceBarWindow, &numbersRect); tens += v49; @@ -2063,7 +2063,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i blitBufferToBuffer(upSrc, 9, 17, 360, hundredsDest, 640); _mouse_info(); gameMouseRefresh(); - coreDelay(delay); + inputBlockForTocks(delay); windowRefreshRect(gInterfaceBarWindow, &numbersRect); hundreds += v49; @@ -2075,19 +2075,19 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i blitBufferToBuffer(downSrc, 9, 17, 360, hundredsDest, 640); _mouse_info(); gameMouseRefresh(); - coreDelay(delay); + inputBlockForTocks(delay); windowRefreshRect(gInterfaceBarWindow, &numbersRect); } blitBufferToBuffer(downSrc, 9, 17, 360, tensDest, 640); - coreDelay(delay); + inputBlockForTocks(delay); windowRefreshRect(gInterfaceBarWindow, &numbersRect); } blitBufferToBuffer(downSrc, 9, 17, 360, onesDest, 640); _mouse_info(); gameMouseRefresh(); - coreDelay(delay); + inputBlockForTocks(delay); windowRefreshRect(gInterfaceBarWindow, &numbersRect); previousValue += change; @@ -2099,7 +2099,7 @@ static void interfaceRenderCounter(int x, int y, int previousValue, int value, i blitBufferToBuffer(previousValue >= 0 ? plusSrc : minusSrc, 6, 17, 360, signDest, 640); _mouse_info(); gameMouseRefresh(); - coreDelay(delay); + inputBlockForTocks(delay); windowRefreshRect(gInterfaceBarWindow, &numbersRect); } } diff --git a/src/interpreter.cc b/src/interpreter.cc index 3a44277..1cf6ced 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -172,7 +172,7 @@ static int _busy; // 0x4670A0 static unsigned int _defaultTimerFunc() { - return _get_time(); + return getTicks(); } // 0x4670B4 diff --git a/src/interpreter_lib.cc b/src/interpreter_lib.cc index bb42ff5..feb20c9 100644 --- a/src/interpreter_lib.cc +++ b/src/interpreter_lib.cc @@ -409,7 +409,7 @@ static void _interpretFadePaletteBK(unsigned char* oldPalette, unsigned char* ne int index; unsigned char palette[256 * 3]; - time = _get_time(); + time = getTicks(); previousTime = time; steps = (int)duration; step = 0; @@ -432,7 +432,7 @@ static void _interpretFadePaletteBK(unsigned char* oldPalette, unsigned char* ne _process_bk(); } - time = _get_time(); + time = getTicks(); delta = time - previousTime; } } diff --git a/src/inventory.cc b/src/inventory.cc index 5114044..bda12eb 100644 --- a/src/inventory.cc +++ b/src/inventory.cc @@ -588,7 +588,7 @@ void inventoryOpen() inventorySetCursor(INVENTORY_WINDOW_CURSOR_HAND); for (;;) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); // SFALL: Close with 'I'. if (keyCode == KEY_ESCAPE || keyCode == KEY_UPPERCASE_I || keyCode == KEY_LOWERCASE_I) { @@ -2096,7 +2096,7 @@ static void _display_body(int fid, int inventoryWindowType) artUnlock(handle); } - gInventoryWindowDudeRotationTimestamp = _get_time(); + gInventoryWindowDudeRotationTimestamp = getTicks(); } // 0x470A2C @@ -2351,7 +2351,7 @@ static void _inven_pickup(int keyCode, int a2) } do { - _get_input(); + inputGetInput(); _display_body(-1, INVENTORY_WINDOW_TYPE_NORMAL); } while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0); @@ -2622,7 +2622,7 @@ void inventoryOpenUseItemOn(Object* a1) _display_body(-1, INVENTORY_WINDOW_TYPE_USE_ITEM_ON); - int keyCode = _get_input(); + int keyCode = inputGetInput(); switch (keyCode) { case KEY_HOME: _stack_offset[_curr_stack] = 0; @@ -3687,7 +3687,7 @@ static void inventoryWindowOpenContextMenu(int keyCode, int inventoryWindowType) int mouseState; do { - _get_input(); + inputGetInput(); if (inventoryWindowType == INVENTORY_WINDOW_TYPE_NORMAL) { _display_body(-1, INVENTORY_WINDOW_TYPE_NORMAL); @@ -3807,7 +3807,7 @@ static void inventoryWindowOpenContextMenu(int keyCode, int inventoryWindowType) int menuItemIndex = 0; int previousMouseY = y; while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_UP) == 0) { - _get_input(); + inputGetInput(); if (inventoryWindowType == INVENTORY_WINDOW_TYPE_NORMAL) { _display_body(-1, INVENTORY_WINDOW_TYPE_NORMAL); @@ -4207,7 +4207,7 @@ int inventoryOpenLooting(Object* a1, Object* a2) break; } - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == KEY_CTRL_Q || keyCode == KEY_CTRL_X || keyCode == KEY_F10) { showQuitConfirmationDialog(); @@ -4540,7 +4540,7 @@ static int _move_inventory(Object* a1, int a2, Object* a3, bool a4) } do { - _get_input(); + inputGetInput(); } while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0); if (itemInventoryFrmImage.isLocked()) { @@ -4755,7 +4755,7 @@ static void _barter_move_inventory(Object* a1, int quantity, int a3, int a4, Obj } do { - _get_input(); + inputGetInput(); } while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0); if (itemInventoryFrmImage.isLocked()) { @@ -4837,7 +4837,7 @@ static void _barter_move_from_table_inventory(Object* a1, int quantity, int a3, } do { - _get_input(); + inputGetInput(); } while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0); if (itemInventoryFrmImage.isLocked()) { @@ -5051,7 +5051,7 @@ void inventoryOpenTrade(int win, Object* a2, Object* a3, Object* a4, int a5) break; } - keyCode = _get_input(); + keyCode = inputGetInput(); if (keyCode == KEY_CTRL_Q || keyCode == KEY_CTRL_X || keyCode == KEY_F10) { showQuitConfirmationDialog(); } @@ -5537,7 +5537,7 @@ static int inventoryQuantitySelect(int inventoryWindowType, Object* item, int ma bool v5 = false; for (;;) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == KEY_ESCAPE) { inventoryQuantityWindowFree(inventoryWindowType); return -1; @@ -5561,7 +5561,7 @@ static int inventoryQuantitySelect(int inventoryWindowType, Object* item, int ma if (value < max) { if (inventoryWindowType == INVENTORY_WINDOW_TYPE_MOVE_ITEMS) { if ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0) { - _get_time(); + getTicks(); unsigned int delay = 100; while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0) { @@ -5570,11 +5570,11 @@ static int inventoryQuantitySelect(int inventoryWindowType, Object* item, int ma } _draw_amount(value, inventoryWindowType); - _get_input(); + inputGetInput(); if (delay > 1) { delay--; - coreDelayProcessingEvents(delay); + inputPauseForTocks(delay); } } } else { @@ -5594,7 +5594,7 @@ static int inventoryQuantitySelect(int inventoryWindowType, Object* item, int ma if (value > min) { if (inventoryWindowType == INVENTORY_WINDOW_TYPE_MOVE_ITEMS) { if ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0) { - _get_time(); + getTicks(); unsigned int delay = 100; while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0) { @@ -5603,11 +5603,11 @@ static int inventoryQuantitySelect(int inventoryWindowType, Object* item, int ma } _draw_amount(value, inventoryWindowType); - _get_input(); + inputGetInput(); if (delay > 1) { delay--; - coreDelayProcessingEvents(delay); + inputPauseForTocks(delay); } } } else { diff --git a/src/kb.cc b/src/kb.cc index 7463d7b..fe5a58c 100644 --- a/src/kb.cc +++ b/src/kb.cc @@ -108,7 +108,7 @@ int keyboardInit() _kb_init_lock_status(); keyboardSetLayout(KEYBOARD_LAYOUT_QWERTY); - _kb_idle_start_time = _get_time(); + _kb_idle_start_time = getTicks(); return 0; } diff --git a/src/lips.cc b/src/lips.cc index 3174045..394a726 100644 --- a/src/lips.cc +++ b/src/lips.cc @@ -171,7 +171,7 @@ int lipsStart() int speechVolume = speechGetVolume(); soundSetVolume(gLipsData.sound, (int)(speechVolume * 0.69)); - _speechStartTime = _get_time(); + _speechStartTime = getTicks(); if (soundPlay(gLipsData.sound) != 0) { debugPrint("Failed play!\n"); diff --git a/src/loadsave.cc b/src/loadsave.cc index f83b11e..9a50bc9 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -471,8 +471,8 @@ int lsgSaveGame(int mode) int rc = -1; int v103 = -1; while (rc == -1) { - int tick = _get_time(); - int keyCode = _get_input(); + int tick = getTicks(); + int keyCode = inputGetInput(); int v37 = 0; int v102 = 0; @@ -884,8 +884,8 @@ int lsgLoadGame(int mode) int rc = -1; while (rc == -1) { while (rc == -1) { - int v37 = _get_time(); - int keyCode = _get_input(); + int v37 = getTicks(); + int keyCode = inputGetInput(); int v39 = 0; int v107 = 0; int v108 = -1; @@ -986,7 +986,7 @@ int lsgLoadGame(int mode) int v106 = 0; int v109 = 0; do { - int v45 = _get_time(); + int v45 = getTicks(); int v44 = v109 + 1; if ((v106 == 0 && v44 == 1) || (v106 == 1 && v109 > 14.4)) { @@ -1048,7 +1048,7 @@ int lsgLoadGame(int mode) while (getTicksSince(v45) < 1000 / 24) { } } - keyCode = _get_input(); + keyCode = inputGetInput(); } while (keyCode != 505 && keyCode != 503); } else { if (v39 != 0) { @@ -2127,9 +2127,9 @@ static int _get_input_str2(int win, int doneKeyCode, int cancelKeyCode, char* de int rc = 1; while (rc == 1) { - int tick = _get_time(); + int tick = getTicks(); - int keyCode = _get_input(); + int keyCode = inputGetInput(); if ((keyCode & 0x80000000) == 0) { v1++; } diff --git a/src/main.cc b/src/main.cc index eddd112..623a275 100644 --- a/src/main.cc +++ b/src/main.cc @@ -443,7 +443,7 @@ static void mainLoop(FpsLimiter& fpsLimiter) while (_game_user_wants_to_quit == 0) { fpsLimiter.mark(); - int keyCode = _get_input(); + int keyCode = inputGetInput(); gameHandleKey(keyCode, false); scriptsHandleRequests(); @@ -614,7 +614,7 @@ static void showDeath() } while (mouseGetEvent() != 0) { - _get_input(); + inputGetInput(); } keyboardReset(); @@ -665,12 +665,12 @@ static void showDeath() // SFALL: Fix the playback of the speech sound file for the death // screen. - coreDelay(100); + inputBlockForTocks(100); - unsigned int time = _get_time(); + unsigned int time = getTicks(); int keyCode; do { - keyCode = _get_input(); + keyCode = inputGetInput(); } while (keyCode == -1 && !_main_death_voiceover_done && getTicksSince(time) < delay); speechSetEndCallback(NULL); @@ -678,11 +678,11 @@ static void showDeath() speechDelete(); while (mouseGetEvent() != 0) { - _get_input(); + inputGetInput(); } if (keyCode == -1) { - coreDelayProcessingEvents(500); + inputPauseForTocks(500); } paletteFadeTo(gPaletteBlack); @@ -1016,13 +1016,13 @@ static int mainMenuWindowHandleEvents(FpsLimiter& fpsLimiter) mouseShowCursor(); } - unsigned int tick = _get_time(); + unsigned int tick = getTicks(); int rc = -1; while (rc == -1) { fpsLimiter.mark(); - int keyCode = _get_input(); + int keyCode = inputGetInput(); for (int buttonIndex = 0; buttonIndex < MAIN_MENU_BUTTON_COUNT; buttonIndex++) { if (keyCode == gMainMenuButtonKeyBindings[buttonIndex] || keyCode == toupper(gMainMenuButtonKeyBindings[buttonIndex])) { diff --git a/src/map.cc b/src/map.cc index a7290bb..870c0c0 100644 --- a/src/map.cc +++ b/src/map.cc @@ -590,7 +590,7 @@ int mapScroll(int dx, int dy) return -2; } - gIsoWindowScrollTimestamp = _get_time(); + gIsoWindowScrollTimestamp = getTicks(); int screenDx = dx * 32; int screenDy = dy * 24; diff --git a/src/mouse.cc b/src/mouse.cc index f930993..e73df7a 100644 --- a/src/mouse.cc +++ b/src/mouse.cc @@ -145,7 +145,7 @@ int mouseInit() gMouseCursorY = _scr_size.bottom / 2; _raw_x = _scr_size.right / 2; _raw_y = _scr_size.bottom / 2; - _mouse_idle_start_time = _get_time(); + _mouse_idle_start_time = getTicks(); return 0; } @@ -266,7 +266,7 @@ static void _mouse_anim() static unsigned int ticker = 0; if (getTicksSince(ticker) >= _mouse_speed) { - ticker = _get_time(); + ticker = getTicks(); if (++_mouse_curr_frame == _mouse_num_frames) { _mouse_curr_frame = 0; @@ -466,7 +466,7 @@ void _mouse_simulate_input(int delta_x, int delta_y, int buttons) } else { if (gMouseButtonsState == 0) { if (!_mouse_idling) { - _mouse_idle_start_time = _get_time(); + _mouse_idle_start_time = getTicks(); _mouse_idling = 1; } @@ -489,7 +489,7 @@ void _mouse_simulate_input(int delta_x, int delta_y, int buttons) if (getTicksSince(previousLeftButtonTimestamp) > BUTTON_REPEAT_TIME) { gMouseEvent |= MOUSE_EVENT_LEFT_BUTTON_DOWN; - previousLeftButtonTimestamp = _get_time(); + previousLeftButtonTimestamp = getTicks(); } } else { gMouseEvent |= MOUSE_EVENT_LEFT_BUTTON_UP; @@ -497,7 +497,7 @@ void _mouse_simulate_input(int delta_x, int delta_y, int buttons) } else { if ((buttons & 0x01) != 0) { gMouseEvent |= MOUSE_EVENT_LEFT_BUTTON_DOWN; - previousLeftButtonTimestamp = _get_time(); + previousLeftButtonTimestamp = getTicks(); } } @@ -506,7 +506,7 @@ void _mouse_simulate_input(int delta_x, int delta_y, int buttons) gMouseEvent |= MOUSE_EVENT_RIGHT_BUTTON_REPEAT; if (getTicksSince(previousRightButtonTimestamp) > BUTTON_REPEAT_TIME) { gMouseEvent |= MOUSE_EVENT_RIGHT_BUTTON_DOWN; - previousRightButtonTimestamp = _get_time(); + previousRightButtonTimestamp = getTicks(); } } else { gMouseEvent |= MOUSE_EVENT_RIGHT_BUTTON_UP; @@ -514,7 +514,7 @@ void _mouse_simulate_input(int delta_x, int delta_y, int buttons) } else { if (buttons & 0x02) { gMouseEvent |= MOUSE_EVENT_RIGHT_BUTTON_DOWN; - previousRightButtonTimestamp = _get_time(); + previousRightButtonTimestamp = getTicks(); } } diff --git a/src/mouse_manager.cc b/src/mouse_manager.cc index 166978d..d7b2ee1 100644 --- a/src/mouse_manager.cc +++ b/src/mouse_manager.cc @@ -58,7 +58,7 @@ int mouseManagerRateProviderDefaultImpl() // 0x48525C int mouseManagerTimeProviderDefaultImpl() { - return _get_time(); + return getTicks(); } // 0x485288 diff --git a/src/movie.cc b/src/movie.cc index e2f4766..e54b3e0 100644 --- a/src/movie.cc +++ b/src/movie.cc @@ -911,7 +911,7 @@ static bool _localMovieCallback() _movieCallback(); } - return _get_input() != -1; + return inputGetInput() != -1; } // 0x487AC8 diff --git a/src/options.cc b/src/options.cc index 0fda654..4a1d74d 100644 --- a/src/options.cc +++ b/src/options.cc @@ -471,7 +471,7 @@ int showOptionsWithInitialKeyCode(int initialKeyCode) int rc = -1; while (rc == -1) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); bool showPreferences = false; if (initialKeyCode != -1) { @@ -823,7 +823,7 @@ int showPause(bool a1) bool done = false; while (!done) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); switch (keyCode) { case KEY_PLUS: case KEY_EQUAL: @@ -1700,7 +1700,7 @@ static int _do_prefscreen() int rc = -1; while (rc == -1) { - int eventCode = _get_input(); + int eventCode = inputGetInput(); switch (eventCode) { case KEY_RETURN: @@ -1824,7 +1824,7 @@ static void _DoThing(int eventCode) if (valueChanged) { soundPlayFile("ib3p1xx1"); - coreDelay(70); + inputBlockForTocks(70); soundPlayFile("ib3lu1x1"); _UpdateThing(preferenceIndex); windowRefresh(gPreferencesWindow); @@ -1858,7 +1858,7 @@ static void _DoThing(int eventCode) if (valueChanged) { soundPlayFile("ib2p1xx1"); - coreDelay(70); + inputBlockForTocks(70); soundPlayFile("ib2lu1x1"); _UpdateThing(preferenceIndex); windowRefresh(gPreferencesWindow); @@ -1897,9 +1897,9 @@ static void _DoThing(int eventCode) int sfxVolumeExample = 0; int speechVolumeExample = 0; while (true) { - _get_input(); + inputGetInput(); - int tick = _get_time(); + int tick = getTicks(); mouseGetPositionInWindow(gPreferencesWindow, &x, &y); diff --git a/src/palette.cc b/src/palette.cc index ca1db5c..6f05c07 100644 --- a/src/palette.cc +++ b/src/palette.cc @@ -32,7 +32,7 @@ void paletteInit() memset(gPaletteWhite, 63, 256 * 3); memcpy(gPalette, _cmap, 256 * 3); - unsigned int tick = _get_time(); + unsigned int tick = getTicks(); if (backgroundSoundIsEnabled() || speechIsEnabled()) { colorPaletteSetTransitionCallback(soundContinueAll); } diff --git a/src/pipboy.cc b/src/pipboy.cc index b5f3e09..3afd5e5 100644 --- a/src/pipboy.cc +++ b/src/pipboy.cc @@ -412,10 +412,10 @@ int pipboyOpen(int intent) } mouseGetPositionInWindow(gPipboyWindow, &gPipboyPreviousMouseX, &gPipboyPreviousMouseY); - gPipboyLastEventTimestamp = _get_time(); + gPipboyLastEventTimestamp = getTicks(); while (true) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (intent == PIPBOY_OPEN_INTENT_REST) { keyCode = 504; @@ -425,14 +425,14 @@ int pipboyOpen(int intent) mouseGetPositionInWindow(gPipboyWindow, &gPipboyMouseX, &gPipboyMouseY); if (keyCode != -1 || gPipboyMouseX != gPipboyPreviousMouseX || gPipboyMouseY != gPipboyPreviousMouseY) { - gPipboyLastEventTimestamp = _get_time(); + gPipboyLastEventTimestamp = getTicks(); gPipboyPreviousMouseX = gPipboyMouseX; gPipboyPreviousMouseY = gPipboyMouseY; } else { - if (_get_time() - gPipboyLastEventTimestamp > PIPBOY_IDLE_TIMEOUT) { + if (getTicks() - gPipboyLastEventTimestamp > PIPBOY_IDLE_TIMEOUT) { pipboyRenderScreensaver(); - gPipboyLastEventTimestamp = _get_time(); + gPipboyLastEventTimestamp = getTicks(); mouseGetPositionInWindow(gPipboyWindow, &gPipboyPreviousMouseX, &gPipboyPreviousMouseY); } } @@ -906,7 +906,7 @@ static void pipboyWindowHandleStatus(int a1) pipboyWindowRenderQuestLocationList(a1); pipboyWindowRenderHolodiskList(-1); windowRefreshRect(gPipboyWindow, &gPipboyWindowContentRect); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); _stat_flag = 1; } else { if (gPipboyWindowHolodisksCount != 0 && gPipboyWindowHolodisksCount >= a1 && gPipboyMouseX > 429) { @@ -936,7 +936,7 @@ static void pipboyWindowHandleStatus(int a1) pipboyWindowRenderHolodiskList(a1); pipboyWindowRenderQuestLocationList(-1); windowRefreshRect(gPipboyWindow, &gPipboyWindowContentRect); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); pipboyWindowDestroyButtons(); pipboyRenderHolodiskText(); pipboyWindowCreateButtons(0, 0, true); @@ -973,7 +973,7 @@ static void pipboyWindowHandleStatus(int a1) pipboyDrawText(text2, PIPBOY_TEXT_ALIGNMENT_RIGHT_COLUMN_CENTER, _colorTable[992]); windowRefreshRect(gPipboyWindow, &gPipboyWindowContentRect); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); pipboyWindowHandleStatus(1024); } } else { @@ -997,7 +997,7 @@ static void pipboyWindowHandleStatus(int a1) pipboyDrawText(text2, PIPBOY_TEXT_ALIGNMENT_RIGHT_COLUMN_CENTER, _colorTable[992]); windowRefreshRect(gPipboyWindow, &gPipboyWindowContentRect); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); _view_page += 1; @@ -1027,7 +1027,7 @@ static void pipboyWindowHandleStatus(int a1) pipboyDrawText(text2, PIPBOY_TEXT_ALIGNMENT_RIGHT_COLUMN_CENTER, _colorTable[992]); windowRefreshRect(gPipboyWindow, &gPipboyWindowContentRect); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); _view_page -= 1; @@ -1060,7 +1060,7 @@ static void pipboyWindowHandleStatus(int a1) pipboyDrawText(text2, PIPBOY_TEXT_ALIGNMENT_RIGHT_COLUMN_CENTER, _colorTable[992]); windowRefreshRect(gPipboyWindow, &gPipboyWindowContentRect); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); if (_view_page <= 0) { pipboyWindowHandleStatus(1024); @@ -1078,7 +1078,7 @@ static void pipboyWindowHandleStatus(int a1) soundPlayFile("ib1p1xx1"); pipboyDrawBackButton(_colorTable[32747]); windowRefreshRect(gPipboyWindow, &gPipboyWindowContentRect); - coreDelayProcessingEvents(200); + inputPauseForTocks(200); pipboyWindowHandleStatus(1024); } @@ -1679,7 +1679,7 @@ static void pipboyHandleVideoArchive(int a1) fontSetCurrent(101); - gPipboyLastEventTimestamp = _get_time(); + gPipboyLastEventTimestamp = getTicks(); pipboyRenderVideoArchive(-1); } } @@ -1967,7 +1967,7 @@ static bool pipboyRest(int hours, int minutes, int duration) break; } - unsigned int start = _get_time(); + unsigned int start = getTicks(); unsigned int v6 = (unsigned int)((double)v5 / v4 * ((double)minutes * 600.0) + (double)gameTime); unsigned int nextEventTime = queueGetNextEventTime(); @@ -1987,7 +1987,7 @@ static bool pipboyRest(int hours, int minutes, int duration) if (!rc) { gameTimeSetTime(v6); - if (_get_input() == KEY_ESCAPE || _game_user_wants_to_quit != 0) { + if (inputGetInput() == KEY_ESCAPE || _game_user_wants_to_quit != 0) { rc = true; } @@ -2024,9 +2024,9 @@ static bool pipboyRest(int hours, int minutes, int duration) break; } - unsigned int start = _get_time(); + unsigned int start = getTicks(); - if (_get_input() == KEY_ESCAPE || _game_user_wants_to_quit != 0) { + if (inputGetInput() == KEY_ESCAPE || _game_user_wants_to_quit != 0) { rc = true; } @@ -2237,10 +2237,10 @@ static int pipboyRenderScreensaver() int v31 = 50; while (true) { - unsigned int time = _get_time(); + unsigned int time = getTicks(); mouseGetPositionInWindow(gPipboyWindow, &gPipboyMouseX, &gPipboyMouseY); - if (_get_input() != -1 || gPipboyPreviousMouseX != gPipboyMouseX || gPipboyPreviousMouseY != gPipboyMouseY) { + if (inputGetInput() != -1 || gPipboyPreviousMouseX != gPipboyMouseX || gPipboyPreviousMouseY != gPipboyMouseY) { break; } diff --git a/src/selfrun.cc b/src/selfrun.cc index 3490bd8..8598533 100644 --- a/src/selfrun.cc +++ b/src/selfrun.cc @@ -90,14 +90,14 @@ void selfrunPlaybackLoop(SelfrunData* selfrunData) } while (gSelfrunState == SELFRUN_STATE_PLAYING) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode != selfrunData->stopKeyCode) { gameHandleKey(keyCode, false); } } while (mouseGetEvent() != 0) { - _get_input(); + inputGetInput(); } if (cursorWasHidden) { @@ -156,7 +156,7 @@ void selfrunRecordingLoop(SelfrunData* selfrunData) bool done = false; while (!done) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == selfrunData->stopKeyCode) { vcrStop(); _game_user_wants_to_quit = 2; diff --git a/src/skilldex.cc b/src/skilldex.cc index d2ee49c..1f93845 100644 --- a/src/skilldex.cc +++ b/src/skilldex.cc @@ -116,7 +116,7 @@ int skilldexOpen() int rc = -1; while (rc == -1) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); // SFALL: Close with 'S'. if (keyCode == KEY_ESCAPE || keyCode == KEY_UPPERCASE_S || keyCode == KEY_LOWERCASE_S || keyCode == 500 || _game_user_wants_to_quit != 0) { @@ -130,7 +130,7 @@ int skilldexOpen() } if (rc != 0) { - coreDelay(1000 / 9); + inputBlockForTocks(1000 / 9); } skilldexWindowFree(); diff --git a/src/vcr.cc b/src/vcr.cc index f9e7d54..1bb3069 100644 --- a/src/vcr.cc +++ b/src/vcr.cc @@ -102,7 +102,7 @@ bool vcrRecord(const char* fileName) _vcr_counter = 1; _vcr_buffer_index++; - _vcr_start_time = _get_time(); + _vcr_start_time = getTicks(); keyboardReset(); gVcrState = VCR_STATE_RECORDING; @@ -151,7 +151,7 @@ bool vcrPlay(const char* fileName, unsigned int terminationFlags, VcrPlaybackCom gVcrTerminateFlags = 0; _vcr_counter = 0; _vcr_time = 0; - _vcr_start_time = _get_time(); + _vcr_start_time = getTicks(); gVcrState = VCR_STATE_PLAYING; stru_6AD940.time = 0; stru_6AD940.counter = 0; @@ -257,7 +257,7 @@ int vcrUpdate() mouseShowCursor(); keyboardReset(); gVcrTerminateFlags = gVcrRequestedTerminationFlags; - _vcr_start_time = _get_time(); + _vcr_start_time = getTicks(); _vcr_counter = 0; break; case VCR_ENTRY_TYPE_KEYBOARD_EVENT: diff --git a/src/window.cc b/src/window.cc index c724a69..05e32c3 100644 --- a/src/window.cc +++ b/src/window.cc @@ -491,7 +491,7 @@ bool _windowActivateRegion(const char* regionName, int a2) // 0x4B6ED0 int _getInput() { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == KEY_CTRL_Q || keyCode == KEY_CTRL_X || keyCode == KEY_F10) { showQuitConfirmationDialog(); } diff --git a/src/window_manager.cc b/src/window_manager.cc index 41e5cbc..69c1584 100644 --- a/src/window_manager.cc +++ b/src/window_manager.cc @@ -213,7 +213,7 @@ int windowManagerInit(VideoSystemInitProc* videoSystemInitProc, VideoSystemExitP _GNW_debug_init(); - if (coreInit(a3) == -1) { + if (inputInit(a3) == -1) { return WINDOW_MANAGER_ERR_INITIALIZING_INPUT; } @@ -292,7 +292,7 @@ void windowManagerExit(void) gVideoSystemExitProc(); } - coreExit(); + inputExit(); _GNW_rect_exit(); textFontsExit(); _colorsClose(); diff --git a/src/window_manager_private.cc b/src/window_manager_private.cc index 96708f9..d1a8db6 100644 --- a/src/window_manager_private.cc +++ b/src/window_manager_private.cc @@ -324,7 +324,7 @@ int _win_list_select_at(const char* title, char** items, int itemsLength, ListSe // Relative to `scrollOffset`. int previousSelectedItemIndex = -1; while (1) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); int mouseX; int mouseY; mouseGetPosition(&mouseX, &mouseY); @@ -662,7 +662,7 @@ int _win_msg(const char* string, int x, int y, int flags) windowRefresh(win); - while (_get_input() != KEY_ESCAPE) { + while (inputGetInput() != KEY_ESCAPE) { } windowDestroy(win); @@ -1025,7 +1025,7 @@ int _win_input_str(int win, char* dest, int maxLength, int x, int y, int textCol // decremented in the loop body when key is not handled. bool isFirstKey = true; for (; cursorPos <= maxLength; cursorPos++) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode != -1) { if (keyCode == KEY_ESCAPE) { dest[cursorPos] = '\0'; diff --git a/src/worldmap.cc b/src/worldmap.cc index 7366924..6bfbd71 100644 --- a/src/worldmap.cc +++ b/src/worldmap.cc @@ -2949,8 +2949,8 @@ static int wmWorldMapFunc(int a1) int rc = 0; for (;;) { - int keyCode = _get_input(); - unsigned int tick = _get_time(); + int keyCode = inputGetInput(); + unsigned int tick = getTicks(); int mouseX; int mouseY; @@ -3272,7 +3272,7 @@ static void wmCheckGameEvents() // 0x4C0634 static int wmRndEncounterOccurred() { - unsigned int v0 = _get_time(); + unsigned int v0 = getTicks(); if (getTicksBetween(v0, wmLastRndTime) < 1500) { return 0; } @@ -3308,7 +3308,7 @@ static int wmRndEncounterOccurred() return -1; } - coreDelay(200); + inputBlockForTocks(200); } wmGenData.encounterMapId = v26; @@ -3390,7 +3390,7 @@ static int wmRndEncounterOccurred() return -1; } - coreDelay(200); + inputBlockForTocks(200); } if (wmGenData.isInCar) { @@ -4414,7 +4414,7 @@ static int wmInterfaceInit() { int fid; - wmLastRndTime = _get_time(); + wmLastRndTime = getTicks(); // SFALL: Fix default worldmap font. // CE: This setting affects only city names. In Sfall it's configurable via @@ -5724,7 +5724,7 @@ static int wmTownMapFunc(int* mapIdxPtr) CityInfo* city = &(wmAreaInfoList[wmGenData.currentAreaId]); for (;;) { - int keyCode = _get_input(); + int keyCode = inputGetInput(); if (keyCode == KEY_CTRL_Q || keyCode == KEY_CTRL_X || keyCode == KEY_F10) { showQuitConfirmationDialog(); }