Fix Barter button

This commit is contained in:
Alexander Batalov 2022-08-07 15:52:28 +03:00
parent ba2ae3c303
commit 0ec5306de5
1 changed files with 43 additions and 25 deletions

View File

@ -667,6 +667,9 @@ static void gameDialogRenderTalkingHead(Art* art, int frame);
static void gameDialogHighlightsInit(); static void gameDialogHighlightsInit();
static void gameDialogHighlightsExit(); static void gameDialogHighlightsExit();
static void gameDialogRedButtonsInit();
static void gameDialogRedButtonsExit();
// gdialog_init // gdialog_init
// 0x444D1C // 0x444D1C
int gameDialogInit() int gameDialogInit()
@ -937,6 +940,9 @@ int _gdialogInitFromScript(int headFid, int reaction)
_talk_need_to_center = 1; _talk_need_to_center = 1;
// CE: Fix Barter button.
gameDialogRedButtonsInit();
_gdCreateHeadWindow(); _gdCreateHeadWindow();
tickersAdd(gameDialogTicker); tickersAdd(gameDialogTicker);
_gdSetupFidget(headFid, reaction); _gdSetupFidget(headFid, reaction);
@ -980,6 +986,9 @@ int _gdialogExitFromScript()
_gdDestroyHeadWindow(); _gdDestroyHeadWindow();
// CE: Fix Barter button.
gameDialogRedButtonsExit();
fontSetCurrent(_oldFont); fontSetCurrent(_oldFont);
if (gGameDialogFidgetFrm != NULL) { if (gGameDialogFidgetFrm != NULL) {
@ -1732,30 +1741,13 @@ int _gdProcessInit()
goto err_2; goto err_2;
} }
// di_rdbt2.frm - dialog red button down // CE: Move red buttons init to `_gdialogInitFromScript`.
fid = buildFid(OBJ_TYPE_INTERFACE, 96, 0, 0, 0);
gGameDialogRedButtonUpFrmData = artLockFrameData(fid, 0, 0, &gGameDialogRedButtonUpFrmHandle);
if (gGameDialogRedButtonUpFrmData == NULL) {
goto err_3;
}
// di_rdbt1.frm - dialog red button up
fid = buildFid(OBJ_TYPE_INTERFACE, 95, 0, 0, 0);
gGameDialogRedButtonDownFrmData = artLockFrameData(fid, 0, 0, &gGameDialogRedButtonDownFrmHandle);
if (gGameDialogRedButtonDownFrmData == NULL) {
goto err_3;
}
_talkOldFont = fontGetCurrent(); _talkOldFont = fontGetCurrent();
fontSetCurrent(101); fontSetCurrent(101);
return 0; return 0;
err_3:
artUnlock(gGameDialogRedButtonUpFrmHandle);
gGameDialogRedButtonUpFrmHandle = NULL;
err_2: err_2:
windowDestroy(gGameDialogOptionsWindow); windowDestroy(gGameDialogOptionsWindow);
@ -1793,13 +1785,7 @@ int _gdProcessExit()
{ {
_gdProcessCleanup(); _gdProcessCleanup();
artUnlock(gGameDialogRedButtonDownFrmHandle); // CE: Move red buttons exit to `_gdialogExitFromScript`.
gGameDialogRedButtonDownFrmHandle = NULL;
gGameDialogRedButtonDownFrmData = NULL;
artUnlock(gGameDialogRedButtonUpFrmHandle);
gGameDialogRedButtonUpFrmHandle = NULL;
gGameDialogRedButtonUpFrmData = NULL;
windowDestroy(gGameDialogReplyWindow); windowDestroy(gGameDialogReplyWindow);
gGameDialogReplyWindow = -1; gGameDialogReplyWindow = -1;
@ -4635,3 +4621,35 @@ static void gameDialogHighlightsExit()
artUnlock(gGameDialogUpperHighlightFrmHandle); artUnlock(gGameDialogUpperHighlightFrmHandle);
artUnlock(gGameDialogLowerHighlightFrmHandle); artUnlock(gGameDialogLowerHighlightFrmHandle);
} }
static void gameDialogRedButtonsInit()
{
// di_rdbt2.frm - dialog red button down
int pressedFid = buildFid(OBJ_TYPE_INTERFACE, 96, 0, 0, 0);
gGameDialogRedButtonUpFrmData = artLockFrameData(pressedFid, 0, 0, &gGameDialogRedButtonUpFrmHandle);
if (gGameDialogRedButtonUpFrmData == NULL) {
gameDialogRedButtonsExit();
}
// di_rdbt1.frm - dialog red button up
int normalFid = buildFid(OBJ_TYPE_INTERFACE, 95, 0, 0, 0);
gGameDialogRedButtonDownFrmData = artLockFrameData(normalFid, 0, 0, &gGameDialogRedButtonDownFrmHandle);
if (gGameDialogRedButtonDownFrmData == NULL) {
gameDialogRedButtonsExit();
}
}
static void gameDialogRedButtonsExit()
{
if (gGameDialogRedButtonDownFrmHandle != NULL) {
artUnlock(gGameDialogRedButtonDownFrmHandle);
gGameDialogRedButtonDownFrmHandle = NULL;
gGameDialogRedButtonDownFrmData = NULL;
}
if (gGameDialogRedButtonUpFrmHandle != NULL) {
artUnlock(gGameDialogRedButtonUpFrmHandle);
gGameDialogRedButtonUpFrmHandle = NULL;
gGameDialogRedButtonUpFrmData = NULL;
}
}