Reorganize variables scope for goto (#23)
Co-authored-by: Alexander Batalov <alex.batalov@gmail.com>
This commit is contained in:
parent
6929e054a9
commit
14aa86c4b7
|
@ -240,6 +240,9 @@ int characterSelectorOpen()
|
||||||
// 0x4A7468
|
// 0x4A7468
|
||||||
bool characterSelectorWindowInit()
|
bool characterSelectorWindowInit()
|
||||||
{
|
{
|
||||||
|
int backgroundFid;
|
||||||
|
unsigned char* backgroundFrmData;
|
||||||
|
|
||||||
if (gCharacterSelectorWindow != -1) {
|
if (gCharacterSelectorWindow != -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -257,8 +260,8 @@ bool characterSelectorWindowInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheEntry* backgroundFrmHandle;
|
CacheEntry* backgroundFrmHandle;
|
||||||
int backgroundFid = buildFid(6, 174, 0, 0, 0);
|
backgroundFid = buildFid(6, 174, 0, 0, 0);
|
||||||
unsigned char* backgroundFrmData = artLockFrameData(backgroundFid, 0, 0, &backgroundFrmHandle);
|
backgroundFrmData = artLockFrameData(backgroundFid, 0, 0, &backgroundFrmHandle);
|
||||||
if (backgroundFrmData == NULL) {
|
if (backgroundFrmData == NULL) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define HELP_SCREEN_WIDTH (640)
|
#define HELP_SCREEN_WIDTH (640)
|
||||||
#define HELP_SCREEN_HEIGHT (480)
|
#define HELP_SCREEN_HEIGHT (480)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define GAME_DIALOG_WINDOW_WIDTH 640
|
#define GAME_DIALOG_WINDOW_WIDTH 640
|
||||||
#define GAME_DIALOG_WINDOW_HEIGHT 480
|
#define GAME_DIALOG_WINDOW_HEIGHT 480
|
||||||
|
@ -1539,6 +1540,10 @@ int gameDialogSetReviewOptionText(const char* string)
|
||||||
// 0x446288
|
// 0x446288
|
||||||
int _gdProcessInit()
|
int _gdProcessInit()
|
||||||
{
|
{
|
||||||
|
int upBtn;
|
||||||
|
int downBtn;
|
||||||
|
int optionsWindowX;
|
||||||
|
int optionsWindowY;
|
||||||
int fid;
|
int fid;
|
||||||
|
|
||||||
int replyWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2 + GAME_DIALOG_REPLY_WINDOW_X;
|
int replyWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2 + GAME_DIALOG_REPLY_WINDOW_X;
|
||||||
|
@ -1549,7 +1554,7 @@ int _gdProcessInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top part of the reply window - scroll up.
|
// Top part of the reply window - scroll up.
|
||||||
int upBtn = buttonCreate(gGameDialogReplyWindow, 1, 1, 377, 28, -1, -1, KEY_ARROW_UP, -1, NULL, NULL, NULL, 32);
|
upBtn = buttonCreate(gGameDialogReplyWindow, 1, 1, 377, 28, -1, -1, KEY_ARROW_UP, -1, NULL, NULL, NULL, 32);
|
||||||
if (upBtn == -1) {
|
if (upBtn == -1) {
|
||||||
goto err_1;
|
goto err_1;
|
||||||
}
|
}
|
||||||
|
@ -1558,7 +1563,7 @@ int _gdProcessInit()
|
||||||
buttonSetMouseCallbacks(upBtn, _reply_arrow_up, _reply_arrow_restore, 0, 0);
|
buttonSetMouseCallbacks(upBtn, _reply_arrow_up, _reply_arrow_restore, 0, 0);
|
||||||
|
|
||||||
// Bottom part of the reply window - scroll down.
|
// Bottom part of the reply window - scroll down.
|
||||||
int downBtn = buttonCreate(gGameDialogReplyWindow, 1, 29, 377, 28, -1, -1, KEY_ARROW_DOWN, -1, NULL, NULL, NULL, 32);
|
downBtn = buttonCreate(gGameDialogReplyWindow, 1, 29, 377, 28, -1, -1, KEY_ARROW_DOWN, -1, NULL, NULL, NULL, 32);
|
||||||
if (downBtn == -1) {
|
if (downBtn == -1) {
|
||||||
goto err_1;
|
goto err_1;
|
||||||
}
|
}
|
||||||
|
@ -1566,8 +1571,8 @@ int _gdProcessInit()
|
||||||
buttonSetCallbacks(downBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
buttonSetCallbacks(downBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||||
buttonSetMouseCallbacks(downBtn, _reply_arrow_down, _reply_arrow_restore, 0, 0);
|
buttonSetMouseCallbacks(downBtn, _reply_arrow_down, _reply_arrow_restore, 0, 0);
|
||||||
|
|
||||||
int optionsWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2 + GAME_DIALOG_OPTIONS_WINDOW_X;
|
optionsWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2 + GAME_DIALOG_OPTIONS_WINDOW_X;
|
||||||
int optionsWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_OPTIONS_WINDOW_Y;
|
optionsWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_OPTIONS_WINDOW_Y;
|
||||||
gGameDialogOptionsWindow = windowCreate(optionsWindowX, optionsWindowY, GAME_DIALOG_OPTIONS_WINDOW_WIDTH, GAME_DIALOG_OPTIONS_WINDOW_HEIGHT, 256, WINDOW_FLAG_0x04);
|
gGameDialogOptionsWindow = windowCreate(optionsWindowX, optionsWindowY, GAME_DIALOG_OPTIONS_WINDOW_WIDTH, GAME_DIALOG_OPTIONS_WINDOW_HEIGHT, 256, WINDOW_FLAG_0x04);
|
||||||
if (gGameDialogOptionsWindow == -1) {
|
if (gGameDialogOptionsWindow == -1) {
|
||||||
goto err_2;
|
goto err_2;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "window_manager.h"
|
#include "window_manager.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
// The width of connectors in the indicator box.
|
// The width of connectors in the indicator box.
|
||||||
//
|
//
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,9 @@ char _obj_seen[5001];
|
||||||
// 0x488780
|
// 0x488780
|
||||||
int objectsInit(unsigned char* buf, int width, int height, int pitch)
|
int objectsInit(unsigned char* buf, int width, int height, int pitch)
|
||||||
{
|
{
|
||||||
|
int dudeFid;
|
||||||
|
int eggFid;
|
||||||
|
|
||||||
memset(_obj_seen, 0, 5001);
|
memset(_obj_seen, 0, 5001);
|
||||||
dword_639D98 = width + 320;
|
dword_639D98 = width + 320;
|
||||||
_updateAreaPixelBounds = -320;
|
_updateAreaPixelBounds = -320;
|
||||||
|
@ -308,7 +311,7 @@ int objectsInit(unsigned char* buf, int width, int height, int pitch)
|
||||||
gObjectsWindowBufferSize = height * width;
|
gObjectsWindowBufferSize = height * width;
|
||||||
gObjectsWindowPitch = pitch;
|
gObjectsWindowPitch = pitch;
|
||||||
|
|
||||||
int dudeFid = buildFid(1, _art_vault_guy_num, 0, 0, 0);
|
dudeFid = buildFid(1, _art_vault_guy_num, 0, 0, 0);
|
||||||
objectCreateWithFidPid(&gDude, dudeFid, 0x1000000);
|
objectCreateWithFidPid(&gDude, dudeFid, 0x1000000);
|
||||||
|
|
||||||
gDude->flags |= OBJECT_FLAG_0x400;
|
gDude->flags |= OBJECT_FLAG_0x400;
|
||||||
|
@ -322,7 +325,7 @@ int objectsInit(unsigned char* buf, int width, int height, int pitch)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int eggFid = buildFid(6, 2, 0, 0, 0);
|
eggFid = buildFid(6, 2, 0, 0, 0);
|
||||||
objectCreateWithFidPid(&gEgg, eggFid, -1);
|
objectCreateWithFidPid(&gEgg, eggFid, -1);
|
||||||
gEgg->flags |= OBJECT_FLAG_0x400;
|
gEgg->flags |= OBJECT_FLAG_0x400;
|
||||||
gEgg->flags |= OBJECT_TEMPORARY;
|
gEgg->flags |= OBJECT_TEMPORARY;
|
||||||
|
|
Loading…
Reference in New Issue