SAGA2: Rename class variables in msgbox.h

This commit is contained in:
Eugene Sandulenko 2022-09-26 16:39:16 +02:00
parent c2d795f63c
commit 1d5f9486b2
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 42 additions and 42 deletions

View File

@ -95,10 +95,10 @@ int16 MsgBox(const char *msg, const char *btnMsg1, const char *btnMsg2) {
return res;
}
char ErrorWindow::mbChs1Text[8];
char ErrorWindow::mbChs2Text[8];
uint8 ErrorWindow::numBtns = 0;
requestInfo ErrorWindow::rInfo;
char ErrorWindow::_mbChs1Text[8];
char ErrorWindow::_mbChs2Text[8];
uint8 ErrorWindow::_numBtns = 0;
requestInfo ErrorWindow::_rInfo;
APPFUNC(ErrorWindow::cmdMessageWindow) {
gWindow *win;
@ -118,48 +118,48 @@ APPFUNC(ErrorWindow::cmdMessageWindow) {
ErrorWindow::ErrorWindow(const char *msg, const char *btnMsg1, const char *btnMsg2)
: SimpleWindow(mbWindowRect, 0, msg, cmdMessageWindow) {
numBtns = 0;
_numBtns = 0;
if (btnMsg1) numBtns++;
if (btnMsg2) numBtns++;
if (btnMsg1) _numBtns++;
if (btnMsg2) _numBtns++;
// requester info struct
rInfo.result = -1;
rInfo.running = true;
_rInfo.result = -1;
_rInfo.running = true;
strcpy(mbChs1Text, "\x13");
strcpy(mbChs2Text, "\x1B");
strcpy(_mbChs1Text, "\x13");
strcpy(_mbChs2Text, "\x1B");
const char *eq;
// button one
if (btnMsg1) {
new SimpleButton(*this, butBox(numBtns, 0), btnMsg1, 0, cmdMessageWindow);
new SimpleButton(*this, butBox(_numBtns, 0), btnMsg1, 0, cmdMessageWindow);
if ((eq = strchr(btnMsg1, '_')) != nullptr) {
eq++;
if (eq)
mbChs1Text[strlen(mbChs1Text)] = *eq;
_mbChs1Text[strlen(_mbChs1Text)] = *eq;
}
}
// button two
if (btnMsg2) {
new SimpleButton(*this, butBox(numBtns, 1), btnMsg2, 1, cmdMessageWindow);
new SimpleButton(*this, butBox(_numBtns, 1), btnMsg2, 1, cmdMessageWindow);
if ((eq = strchr(btnMsg2, '_')) != nullptr) {
eq++;
if (eq)
mbChs2Text[strlen(mbChs2Text)] = *eq;
_mbChs2Text[strlen(_mbChs2Text)] = *eq;
}
}
userData = &rInfo;
userData = &_rInfo;
}
int16 ErrorWindow::getResult() {
open();
draw();
EventLoop(rInfo.running, true);
return rInfo.result;
EventLoop(_rInfo.running, true);
return _rInfo.result;
}
ErrorWindow::~ErrorWindow() {
@ -169,21 +169,21 @@ ErrorWindow::~ErrorWindow() {
void ErrorWindow::ErrorModeHandleKey(short key, short) {
if (strchr(mbChs2Text, tolower(key)) ||
strchr(mbChs2Text, toupper(key))) {
rInfo.result = 2;
rInfo.running = false;
if (strchr(_mbChs2Text, tolower(key)) ||
strchr(_mbChs2Text, toupper(key))) {
_rInfo.result = 2;
_rInfo.running = false;
return;
}
if (strchr(mbChs1Text, tolower(key)) ||
strchr(mbChs1Text, toupper(key))) {
rInfo.result = 1;
rInfo.running = false;
if (strchr(_mbChs1Text, tolower(key)) ||
strchr(_mbChs1Text, toupper(key))) {
_rInfo.result = 1;
_rInfo.running = false;
return;
}
if (numBtns < 2) {
rInfo.result = 1;
rInfo.running = false;
if (_numBtns < 2) {
_rInfo.result = 1;
_rInfo.running = false;
return;
}
}
@ -208,7 +208,7 @@ SimpleWindow::SimpleWindow(const Rect16 &r,
const char *stitle,
AppFunc *cmd)
: gWindow(r, ident, "", cmd) {
prevModeStackCtr = GameMode::getStack(prevModeStackPtr);
_prevModeStackCtr = GameMode::getStack(_prevModeStackPtr);
GameMode *gameModes[] = {&PlayMode, &TileMode, &SimpleMode};
GameMode::SetStack(gameModes, 3);
@ -216,7 +216,7 @@ SimpleWindow::SimpleWindow(const Rect16 &r,
}
SimpleWindow::~SimpleWindow() {
GameMode::SetStack(prevModeStackPtr, prevModeStackCtr);
GameMode::SetStack(_prevModeStackPtr, _prevModeStackCtr);
}
bool SimpleWindow::isModal() {
@ -340,7 +340,7 @@ void SimpleWindow::DrawOutlineFrame(gPort &port, const Rect16 &r, int16 fillColo
SimpleButton::SimpleButton(gWindow &win, const Rect16 &box, const char *title_, uint16 ident, AppFunc *cmd_)
: gControl(win, box, title_, ident, cmd_) {
window = &win;
_window = &win;
}
void SimpleButton::deactivate() {
@ -385,8 +385,8 @@ void SimpleButton::pointerDrag(gPanelMessage &msg) {
}
void SimpleButton::draw() {
gDisplayPort &port = window->windowPort;
Rect16 rect = window->getExtent();
gDisplayPort &port = _window->windowPort;
Rect16 rect = _window->getExtent();
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
@ -400,7 +400,7 @@ void SimpleButton::drawClipped(
gPort &port,
const Point16 &,
const Rect16 &) {
Rect16 base = window->getExtent();
Rect16 base = _window->getExtent();
Rect16 box = Rect16(_extent.x + 1,
_extent.y + 1,

View File

@ -42,8 +42,8 @@ extern GameMode ModalMode;
class SimpleWindow : public gWindow {
GameMode *prevModeStackPtr[Max_Modes];
int prevModeStackCtr;
GameMode *_prevModeStackPtr[Max_Modes];
int _prevModeStackCtr;
public:
@ -69,7 +69,7 @@ public:
};
class SimpleButton : public gControl {
gWindow *window;
gWindow *_window;
public:
SimpleButton(gWindow &, const Rect16 &, const char *, uint16, AppFunc *cmd = NULL);
@ -85,12 +85,12 @@ private:
};
class ErrorWindow : public SimpleWindow {
static char mbChs1Text[8];
static char mbChs2Text[8];
static uint8 numBtns;
static char _mbChs1Text[8];
static char _mbChs2Text[8];
static uint8 _numBtns;
public:
static requestInfo rInfo;
static requestInfo _rInfo;
ErrorWindow(const char *msg, const char *btnMsg1, const char *btnMsg2);
~ErrorWindow();
int16 getResult();