diff --git a/src/game.cc b/src/game.cc index bf12fd5..e77acd8 100644 --- a/src/game.cc +++ b/src/game.cc @@ -588,7 +588,7 @@ int gameHandleKey(int eventCode, bool isInCombatMode) showDialogBox(title, NULL, 0, 192, 116, _colorTable[32328], NULL, _colorTable[32328], 0); } else { soundPlayFile("ib1p1xx1"); - pipboyOpen(false); + pipboyOpen(PIPBOY_OPEN_INTENT_UNSPECIFIED); } } break; @@ -656,7 +656,7 @@ int gameHandleKey(int eventCode, bool isInCombatMode) showDialogBox(title, NULL, 0, 192, 116, _colorTable[32328], NULL, _colorTable[32328], 0); } else { soundPlayFile("ib1p1xx1"); - pipboyOpen(true); + pipboyOpen(PIPBOY_OPEN_INTENT_REST); } } break; diff --git a/src/pipboy.cc b/src/pipboy.cc index e883be5..0b3a0ed 100644 --- a/src/pipboy.cc +++ b/src/pipboy.cc @@ -187,7 +187,7 @@ typedef struct PipboyBomb { typedef void PipboyRenderProc(int a1); -static int pipboyWindowInit(bool forceRest); +static int pipboyWindowInit(int intent); static void pipboyWindowFree(); static void _pip_init_(); static void pipboyDrawNumber(int value, int digits, int x, int y); @@ -396,7 +396,7 @@ unsigned char _holo_flag; unsigned char _stat_flag; // 0x497004 -int pipboyOpen(bool forceRest) +int pipboyOpen(int intent) { if (!_wmMapPipboyActive()) { // You aren't wearing the pipboy! @@ -405,7 +405,8 @@ int pipboyOpen(bool forceRest) return 0; } - if (pipboyWindowInit(forceRest) == -1) { + intent = pipboyWindowInit(intent); + if (intent == -1) { return -1; } @@ -415,9 +416,9 @@ int pipboyOpen(bool forceRest) while (true) { int keyCode = _get_input(); - if (forceRest) { + if (intent == PIPBOY_OPEN_INTENT_REST) { keyCode = 504; - forceRest = false; + intent = PIPBOY_OPEN_INTENT_UNSPECIFIED; } mouseGetPositionInWindow(gPipboyWindow, &gPipboyMouseX, &gPipboyMouseY); @@ -470,7 +471,7 @@ int pipboyOpen(bool forceRest) } // 0x497228 -static int pipboyWindowInit(bool forceRest) +static int pipboyWindowInit(int intent) { gPipboyWindowIsoWasEnabled = isoDisable(); @@ -591,7 +592,7 @@ static int pipboyWindowInit(bool forceRest) y += 27; } - if (forceRest) { + if (intent == PIPBOY_OPEN_INTENT_REST) { if (!_critter_can_obj_dude_rest()) { blitBufferToBufferTrans( gPipboyFrmData[PIPBOY_FRM_LOGO], @@ -634,6 +635,8 @@ static int pipboyWindowInit(bool forceRest) const char* text = getmsg(&gPipboyMessageList, &gPipboyMessageListItem, 215); showDialogBox(text, NULL, 0, 192, 135, _colorTable[32328], 0, _colorTable[32328], DIALOG_BOX_LARGE); + + intent = PIPBOY_OPEN_INTENT_UNSPECIFIED; } } else { blitBufferToBufferTrans( @@ -681,7 +684,7 @@ static int pipboyWindowInit(bool forceRest) soundPlayFile("pipon"); windowRefresh(gPipboyWindow); - return 0; + return intent; } // 0x497828 diff --git a/src/pipboy.h b/src/pipboy.h index 6bfadcc..93d61b3 100644 --- a/src/pipboy.h +++ b/src/pipboy.h @@ -3,7 +3,12 @@ #include "db.h" -int pipboyOpen(bool forceRest); +typedef enum PipboyOpenIntent { + PIPBOY_OPEN_INTENT_UNSPECIFIED = 0, + PIPBOY_OPEN_INTENT_REST = 1, +} PipboyOpenIntent; + +int pipboyOpen(int intent); void pipboyInit(); void pipboyReset(); int pipboySave(File* stream);