XEEN: Control panel dialog now showing
This commit is contained in:
parent
68274d1cc6
commit
b1b0f6be2e
7 changed files with 137 additions and 138 deletions
|
@ -47,11 +47,12 @@ void ButtonContainer::restoreButtons() {
|
||||||
|
|
||||||
void ButtonContainer::addButton(const Common::Rect &bounds, int val,
|
void ButtonContainer::addButton(const Common::Rect &bounds, int val,
|
||||||
SpriteResource *sprites) {
|
SpriteResource *sprites) {
|
||||||
_buttons.push_back(UIButton(bounds, val, sprites, true));
|
_buttons.push_back(UIButton(bounds, val, _buttons.size() * 2, sprites, sprites != nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonContainer::addButton(const Common::Rect &bounds, int val) {
|
void ButtonContainer::addButton(const Common::Rect &bounds, int val,
|
||||||
_buttons.push_back(UIButton(bounds, val, nullptr, false));
|
uint frameNum, SpriteResource *sprites) {
|
||||||
|
_buttons.push_back(UIButton(bounds, val, frameNum, sprites, sprites != nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonContainer::addPartyButtons(XeenEngine *vm) {
|
void ButtonContainer::addPartyButtons(XeenEngine *vm) {
|
||||||
|
@ -106,7 +107,7 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) {
|
||||||
if (btn._draw && btn._value == _buttonValue) {
|
if (btn._draw && btn._value == _buttonValue) {
|
||||||
// Found the correct button
|
// Found the correct button
|
||||||
// Draw button depressed
|
// Draw button depressed
|
||||||
btn._sprites->draw(0, btnIndex * 2 + 1,
|
btn._sprites->draw(0, btn._frameNum + 1,
|
||||||
Common::Point(btn._bounds.left, btn._bounds.top));
|
Common::Point(btn._bounds.left, btn._bounds.top));
|
||||||
win.setBounds(btn._bounds);
|
win.setBounds(btn._bounds);
|
||||||
win.update();
|
win.update();
|
||||||
|
@ -116,7 +117,7 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) {
|
||||||
events.wait(2);
|
events.wait(2);
|
||||||
|
|
||||||
// Redraw button in it's original non-depressed form
|
// Redraw button in it's original non-depressed form
|
||||||
btn._sprites->draw(0, btnIndex * 2,
|
btn._sprites->draw(0, btn._frameNum,
|
||||||
Common::Point(btn._bounds.left, btn._bounds.top));
|
Common::Point(btn._bounds.left, btn._bounds.top));
|
||||||
win.setBounds(btn._bounds);
|
win.setBounds(btn._bounds);
|
||||||
win.update();
|
win.update();
|
||||||
|
@ -134,7 +135,7 @@ void ButtonContainer::drawButtons(XSurface *surface) {
|
||||||
for (uint btnIndex = 0; btnIndex < _buttons.size(); ++btnIndex) {
|
for (uint btnIndex = 0; btnIndex < _buttons.size(); ++btnIndex) {
|
||||||
UIButton &btn = _buttons[btnIndex];
|
UIButton &btn = _buttons[btnIndex];
|
||||||
if (btn._draw) {
|
if (btn._draw) {
|
||||||
btn._sprites->draw(*surface, btnIndex * 2,
|
btn._sprites->draw(*surface, btn._frameNum,
|
||||||
Common::Point(btn._bounds.left, btn._bounds.top));
|
Common::Point(btn._bounds.left, btn._bounds.top));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,14 @@ public:
|
||||||
Common::Rect _bounds;
|
Common::Rect _bounds;
|
||||||
SpriteResource *_sprites;
|
SpriteResource *_sprites;
|
||||||
int _value;
|
int _value;
|
||||||
|
uint _frameNum;
|
||||||
bool _draw;
|
bool _draw;
|
||||||
|
|
||||||
UIButton(const Common::Rect &bounds, int value, SpriteResource *sprites, bool draw) :
|
UIButton(const Common::Rect &bounds, int value, uint frameNum, SpriteResource *sprites, bool draw) :
|
||||||
_bounds(bounds), _value(value), _sprites(sprites), _draw(draw) {}
|
_bounds(bounds), _value(value), _frameNum(frameNum),
|
||||||
|
_sprites(sprites), _draw(draw) {}
|
||||||
|
|
||||||
UIButton() : _value(0), _sprites(nullptr), _draw(false) {}
|
UIButton() : _value(0), _frameNum(0), _sprites(nullptr), _draw(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ButtonContainer : public Cutscenes {
|
class ButtonContainer : public Cutscenes {
|
||||||
|
@ -89,9 +91,10 @@ public:
|
||||||
|
|
||||||
void restoreButtons();
|
void restoreButtons();
|
||||||
|
|
||||||
void addButton(const Common::Rect &bounds, int val, SpriteResource *sprites);
|
void addButton(const Common::Rect &bounds, int val,
|
||||||
|
SpriteResource *sprites = nullptr);
|
||||||
void addButton(const Common::Rect &bounds, int val);
|
void addButton(const Common::Rect &bounds, int val,
|
||||||
|
uint frameNum, SpriteResource *sprites = nullptr);
|
||||||
|
|
||||||
void addPartyButtons(XeenEngine *vm);
|
void addPartyButtons(XeenEngine *vm);
|
||||||
|
|
||||||
|
|
|
@ -50,125 +50,120 @@ int ControlPanel::execute() {
|
||||||
loadButtons();
|
loadButtons();
|
||||||
|
|
||||||
int result = 0, debugCtr = 0;
|
int result = 0, debugCtr = 0;
|
||||||
while (!g_vm->shouldQuit()) {
|
w.open();
|
||||||
w.open();
|
|
||||||
|
|
||||||
while (!g_vm->shouldQuit()) {
|
do {
|
||||||
Common::String btnText = getButtonText();
|
Common::String btnText = getButtonText();
|
||||||
Common::String text = Common::String::format(Res.CONTROL_PANEL_TEXT, btnText.c_str());
|
Common::String text = Common::String::format(Res.CONTROL_PANEL_TEXT, btnText.c_str());
|
||||||
|
|
||||||
|
drawButtons(&w);
|
||||||
|
w.writeString(text);
|
||||||
|
w.writeString("\xB""000\t000\x1");
|
||||||
|
w.update();
|
||||||
|
|
||||||
|
do {
|
||||||
|
events.updateGameCounter();
|
||||||
|
intf.draw3d(false, false);
|
||||||
|
w.writeString("\r");
|
||||||
drawButtons(&w);
|
drawButtons(&w);
|
||||||
w.writeString(text);
|
w.writeString(text);
|
||||||
w.writeString("\xB""000\t000\x1");
|
w.writeString("\v000\t000");
|
||||||
|
w.frame();
|
||||||
|
|
||||||
|
if (_debugFlag)
|
||||||
|
w.writeString(getTimeText());
|
||||||
|
|
||||||
|
w3.update();
|
||||||
w.update();
|
w.update();
|
||||||
|
|
||||||
do {
|
events.pollEventsAndWait();
|
||||||
events.updateGameCounter();
|
checkEvents(_vm);
|
||||||
intf.draw3d(false);
|
if (_vm->shouldQuit())
|
||||||
w.writeString("\r");
|
return 0;
|
||||||
drawButtons(&w);
|
} while (!_buttonValue && !events.timeElapsed());
|
||||||
w.writeString(text);
|
|
||||||
w.writeString("\v000\t000");
|
|
||||||
w.frame();
|
|
||||||
|
|
||||||
if (_debugFlag)
|
switch (_buttonValue) {
|
||||||
w.writeString(getTimeText());
|
case Common::KEYCODE_q:
|
||||||
|
if (Confirm::show(g_vm, Res.CONFIRM_QUIT)) {
|
||||||
|
g_vm->_quitMode = QMODE_QUIT;
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
w3.update();
|
case Common::KEYCODE_w:
|
||||||
w.update();
|
if (Confirm::show(g_vm, Res.MR_WIZARD)) {
|
||||||
|
w.close();
|
||||||
|
if (!windows[2]._enabled) {
|
||||||
|
sound.playFX(51);
|
||||||
|
|
||||||
events.pollEventsAndWait();
|
if (g_vm->getGameID() == GType_WorldOfXeen) {
|
||||||
checkEvents(_vm);
|
map._loadDarkSide = false;
|
||||||
if (_vm->shouldQuit())
|
map.load(28);
|
||||||
return 0;
|
party._mazeDirection = DIR_EAST;
|
||||||
if (!_buttonValue && !events.timeElapsed())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
switch (_buttonValue) {
|
|
||||||
case Common::KEYCODE_q:
|
|
||||||
if (Confirm::show(g_vm, Res.CONFIRM_QUIT)) {
|
|
||||||
g_vm->_quitMode = QMODE_QUIT;
|
|
||||||
result = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Common::KEYCODE_w:
|
|
||||||
if (Confirm::show(g_vm, Res.MR_WIZARD)) {
|
|
||||||
w.close();
|
|
||||||
if (!windows[2]._enabled) {
|
|
||||||
sound.playFX(51);
|
|
||||||
|
|
||||||
if (g_vm->getGameID() == GType_WorldOfXeen) {
|
|
||||||
map._loadDarkSide = false;
|
|
||||||
map.load(29);
|
|
||||||
party._mazeDirection = DIR_EAST;
|
|
||||||
} else {
|
|
||||||
map._loadDarkSide = true;
|
|
||||||
map.load(28);
|
|
||||||
party._mazeDirection = DIR_SOUTH;
|
|
||||||
}
|
|
||||||
party.moveToRunLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
party._gems = 0;
|
|
||||||
result = 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Common::KEYCODE_l:
|
|
||||||
if (_vm->_mode == MODE_COMBAT) {
|
|
||||||
ErrorScroll::show(_vm, Res.NO_LOADING_IN_COMBAT);
|
|
||||||
} else {
|
} else {
|
||||||
// Close dialog and show loading dialog
|
map._loadDarkSide = true;
|
||||||
result = 3;
|
map.load(29);
|
||||||
|
party._mazeDirection = DIR_SOUTH;
|
||||||
}
|
}
|
||||||
break;
|
party.moveToRunLocation();
|
||||||
|
|
||||||
case Common::KEYCODE_s:
|
|
||||||
if (_vm->_mode == MODE_COMBAT) {
|
|
||||||
ErrorScroll::show(_vm, Res.NO_SAVING_IN_COMBAT);
|
|
||||||
} else {
|
|
||||||
// Close dialog and show saving dialog
|
|
||||||
result = 4;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Common::KEYCODE_e:
|
|
||||||
// TODO: Toggle sound effects
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Common::KEYCODE_m:
|
|
||||||
// TODO: Toggle music
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Common::KEYCODE_ESCAPE:
|
|
||||||
result = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Goober cheat sequence
|
|
||||||
case Common::KEYCODE_g:
|
|
||||||
debugCtr = 1;
|
|
||||||
break;
|
|
||||||
case Common::KEYCODE_o:
|
|
||||||
debugCtr = (debugCtr == 1) ? 2 : 0;
|
|
||||||
break;
|
|
||||||
case Common::KEYCODE_b:
|
|
||||||
debugCtr = (debugCtr == 2) ? 3 : 0;
|
|
||||||
case Common::KEYCODE_r:
|
|
||||||
if (debugCtr == 3)
|
|
||||||
_debugFlag = true;
|
|
||||||
else
|
|
||||||
debugCtr = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} while (!result);
|
|
||||||
|
party._gems = 0;
|
||||||
|
result = 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Common::KEYCODE_l:
|
||||||
|
if (_vm->_mode == MODE_COMBAT) {
|
||||||
|
ErrorScroll::show(_vm, Res.NO_LOADING_IN_COMBAT);
|
||||||
|
} else {
|
||||||
|
// Close dialog and show loading dialog
|
||||||
|
result = 3;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Common::KEYCODE_s:
|
||||||
|
if (_vm->_mode == MODE_COMBAT) {
|
||||||
|
ErrorScroll::show(_vm, Res.NO_SAVING_IN_COMBAT);
|
||||||
|
} else {
|
||||||
|
// Close dialog and show saving dialog
|
||||||
|
result = 4;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Common::KEYCODE_e:
|
||||||
|
// TODO: Toggle sound effects
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Common::KEYCODE_m:
|
||||||
|
// TODO: Toggle music
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Common::KEYCODE_ESCAPE:
|
||||||
|
result = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Goober cheat sequence
|
||||||
|
case Common::KEYCODE_g:
|
||||||
|
debugCtr = 1;
|
||||||
|
break;
|
||||||
|
case Common::KEYCODE_o:
|
||||||
|
debugCtr = (debugCtr == 1 || debugCtr == 2) ? 2 : 0;
|
||||||
|
break;
|
||||||
|
case Common::KEYCODE_b:
|
||||||
|
debugCtr = (debugCtr == 2) ? 3 : 0;
|
||||||
|
break;
|
||||||
|
case Common::KEYCODE_r:
|
||||||
|
if (debugCtr == 3)
|
||||||
|
_debugFlag = true;
|
||||||
|
else
|
||||||
|
debugCtr = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
} while (!result);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
w.close();
|
w.close();
|
||||||
intf.drawParty(true);
|
intf.drawParty(true);
|
||||||
|
@ -185,18 +180,17 @@ int ControlPanel::execute() {
|
||||||
void ControlPanel::loadButtons() {
|
void ControlPanel::loadButtons() {
|
||||||
_iconSprites.load("cpanel.icn");
|
_iconSprites.load("cpanel.icn");
|
||||||
|
|
||||||
addButton(Common::Rect(214, 56, 244, 69), Common::KEYCODE_f);
|
addButton(Common::Rect(214, 56, 244, 69), Common::KEYCODE_f, 0, &_iconSprites);
|
||||||
addButton(Common::Rect(214, 75, 244, 88), Common::KEYCODE_m);
|
addButton(Common::Rect(214, 75, 244, 88), Common::KEYCODE_m, 0, &_iconSprites);
|
||||||
addButton(Common::Rect(135, 56, 165, 69), Common::KEYCODE_l, &_iconSprites);
|
addButton(Common::Rect(135, 56, 165, 69), Common::KEYCODE_l, 0, &_iconSprites);
|
||||||
addButton(Common::Rect(135, 75, 165, 88), Common::KEYCODE_s);
|
addButton(Common::Rect(135, 75, 165, 88), Common::KEYCODE_s, 0, &_iconSprites);
|
||||||
|
|
||||||
// For ScummVM we've merged both Save and Save As into a single
|
// For ScummVM we've merged both Save and Save As into a single
|
||||||
// save item, so we don't need this one
|
// save item, so we don't need this one
|
||||||
addButton(Common::Rect(), 0);
|
addButton(Common::Rect(), 0);
|
||||||
_buttons.end()->_draw = false;
|
|
||||||
|
|
||||||
addButton(Common::Rect(135, 94, 165, 107), Common::KEYCODE_q);
|
addButton(Common::Rect(135, 94, 165, 107), Common::KEYCODE_q, 0, &_iconSprites);
|
||||||
addButton(Common::Rect(175, 113, 205, 126), Common::KEYCODE_w);
|
addButton(Common::Rect(175, 113, 205, 126), Common::KEYCODE_w, 0, &_iconSprites);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::String ControlPanel::getButtonText() {
|
Common::String ControlPanel::getButtonText() {
|
||||||
|
@ -215,7 +209,7 @@ Common::String ControlPanel::getTimeText() const {
|
||||||
td.tm_hour == 0 || td.tm_hour == 12 ? 12 : (td.tm_hour % 12),
|
td.tm_hour == 0 || td.tm_hour == 12 ? 12 : (td.tm_hour % 12),
|
||||||
td.tm_min, td.tm_sec, (td.tm_hour >= 12) ? 'p' : 'c');
|
td.tm_min, td.tm_sec, (td.tm_hour >= 12) ? 'p' : 'c');
|
||||||
|
|
||||||
uint32 playtime = g_vm->_events->playTime();
|
uint32 playtime = g_vm->_events->playTime() / GAME_FRAME_RATE;
|
||||||
Common::String playtimeStr = Common::String::format("%d:%.2d:%.2d",
|
Common::String playtimeStr = Common::String::format("%d:%.2d:%.2d",
|
||||||
playtime / 3600, (playtime / 60) % 60, playtime % 60);
|
playtime / 3600, (playtime / 60) % 60, playtime % 60);
|
||||||
return Common::String::format(
|
return Common::String::format(
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
namespace Xeen {
|
namespace Xeen {
|
||||||
|
|
||||||
#define GAME_FRAME_RATE (1000 / 18.2)
|
#define GAME_FRAME_RATE (1000 / 50)
|
||||||
|
#define GAME_FRAME_TIME 50
|
||||||
|
|
||||||
class XeenEngine;
|
class XeenEngine;
|
||||||
|
|
||||||
|
|
|
@ -1674,20 +1674,21 @@ const char *const Resources::UNABLE_TO_PICK_LOCK = "\x3""c\v010%s was unable to
|
||||||
|
|
||||||
const char *const Resources::CONTROL_PANEL_TEXT =
|
const char *const Resources::CONTROL_PANEL_TEXT =
|
||||||
"\x1\xC""00\x3""c\xB""000\t000Control Panel\x3r"
|
"\x1\xC""00\x3""c\xB""000\t000Control Panel\x3r"
|
||||||
"\xB""022\t045\xC""06E\xC""dfx:\t124\xC""06S\xC""dave:"
|
"\xB""022\t045\xC""06L\xC""doad:\t124\xC""06E\xC""dfx:"
|
||||||
"\xB""041\t045\xC""06M\xC""dusic:\t124S\xC""06a\xC""dve:"
|
"\xB""041\t045\xC""06S\xC""dave:\t124\xC""06M\xC""dusic:"
|
||||||
"\xB""060\t045\xC""06L\xC""doad:\t124\xC""06Q\xC""duit:"
|
"\xB""060\t045\xC""06Q\xC""duit:"
|
||||||
"\xB""080\t084Mr \xC""06W\xC""dizard:%s\t000";
|
"\xB""080\t084Mr \xC""06W\xC""dizard:%s\t000\x1";
|
||||||
const char *const Resources::CONTROL_PANEL_BUTTONS =
|
const char *const Resources::CONTROL_PANEL_BUTTONS =
|
||||||
"\x3""c\xB""022\t062load\t141%s"
|
"\x3""c\f11"
|
||||||
|
"\xB""022\t062load\t141%s"
|
||||||
"\xB""041\t062save\t141%s"
|
"\xB""041\t062save\t141%s"
|
||||||
"\xB""060\t062exit"
|
"\xB""060\t062exit"
|
||||||
"\xB""079\t102Help\xC""d";
|
"\xB""079\t102Help\xC""d";
|
||||||
const char *const Resources::ON = "on";
|
const char *const Resources::ON = "\f15on\f11";
|
||||||
const char *const Resources::OFF = "off";
|
const char *const Resources::OFF = "\f32off\f11";
|
||||||
const char *const Resources::CONFIRM_QUIT = "Are you sure you want to quit?";
|
const char *const Resources::CONFIRM_QUIT = "Are you sure you want to quit?";
|
||||||
const char *const Resources::MR_WIZARD =
|
const char *const Resources::MR_WIZARD =
|
||||||
"Are you sure you want Mr.Wizard''s Help ?";
|
"Are you sure you want Mr.Wizard's Help ?";
|
||||||
const char *const Resources::NO_LOADING_IN_COMBAT =
|
const char *const Resources::NO_LOADING_IN_COMBAT =
|
||||||
"No Loading Allowed in Combat!";
|
"No Loading Allowed in Combat!";
|
||||||
const char *const Resources::NO_SAVING_IN_COMBAT =
|
const char *const Resources::NO_SAVING_IN_COMBAT =
|
||||||
|
|
|
@ -144,11 +144,11 @@ Common::Error XeenEngine::loadGameState(int slot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XeenEngine::canLoadGameStateCurrently() {
|
bool XeenEngine::canLoadGameStateCurrently() {
|
||||||
return true;
|
return _mode != MODE_COMBAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XeenEngine::canSaveGameStateCurrently() {
|
bool XeenEngine::canSaveGameStateCurrently() {
|
||||||
return true;
|
return _mode != MODE_COMBAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XeenEngine::playGame() {
|
void XeenEngine::playGame() {
|
||||||
|
|
|
@ -102,7 +102,6 @@ enum QuitMode {
|
||||||
struct XeenGameDescription;
|
struct XeenGameDescription;
|
||||||
|
|
||||||
#define XEEN_SAVEGAME_VERSION 1
|
#define XEEN_SAVEGAME_VERSION 1
|
||||||
#define GAME_FRAME_TIME 50
|
|
||||||
|
|
||||||
class XeenEngine : public Engine {
|
class XeenEngine : public Engine {
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue