mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-09 04:16:34 +00:00
XEEN: Further numeric fixes for dialog with Gremlin King
This commit is contained in:
parent
2888953c7b
commit
fa9218f2d2
@ -215,7 +215,7 @@ int NumericInput::execute(int maxLength, int maxWidth) {
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
int Choose123::show(XeenEngine *vm, int numOptions) {
|
||||
int Choose123::show(XeenEngine *vm, uint numOptions) {
|
||||
assert(numOptions <= 3);
|
||||
Choose123 *dlg = new Choose123(vm);
|
||||
int result = dlg->execute(numOptions);
|
||||
@ -224,7 +224,7 @@ int Choose123::show(XeenEngine *vm, int numOptions) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int Choose123::execute(int numOptions) {
|
||||
int Choose123::execute(uint numOptions) {
|
||||
EventsManager &events = *_vm->_events;
|
||||
Interface &intf = *_vm->_interface;
|
||||
LocationManager &loc = *_vm->_locations;
|
||||
@ -258,20 +258,11 @@ int Choose123::execute(int numOptions) {
|
||||
return 0;
|
||||
} while (!_buttonValue);
|
||||
|
||||
switch (_buttonValue) {
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
if (_buttonValue == Common::KEYCODE_ESCAPE) {
|
||||
result = 0;
|
||||
break;
|
||||
case Common::KEYCODE_1:
|
||||
case Common::KEYCODE_2:
|
||||
case Common::KEYCODE_3: {
|
||||
int v = _buttonValue - Common::KEYCODE_1 + 1;
|
||||
if (v <= numOptions)
|
||||
result = v;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
} else if (_buttonValue >= Common::KEYCODE_1 && _buttonValue < (Common::KEYCODE_1 + (int)numOptions)) {
|
||||
_buttonValue -= Common::KEYCODE_0;
|
||||
result = (_buttonValue == numOptions) ? 0 : _buttonValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,15 +272,17 @@ int Choose123::execute(int numOptions) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void Choose123::loadButtons(int numOptions) {
|
||||
void Choose123::loadButtons(uint numOptions) {
|
||||
assert(numOptions > 0 && numOptions <= 9);
|
||||
_iconSprites.load("choose.icn");
|
||||
const int XPOS[3] = { 235, 260, 286 };
|
||||
const int YPOS[3] = { 75, 96, 117 };
|
||||
|
||||
if (numOptions >= 1)
|
||||
addButton(Common::Rect(235, 75, 259, 95), Common::KEYCODE_1, &_iconSprites);
|
||||
if (numOptions >= 2)
|
||||
addButton(Common::Rect(260, 75, 284, 95), Common::KEYCODE_2, &_iconSprites);
|
||||
if (numOptions >= 3)
|
||||
addButton(Common::Rect(286, 75, 311, 95), Common::KEYCODE_3, &_iconSprites);
|
||||
for (uint idx = 0; idx < numOptions; ++idx) {
|
||||
Common::Rect r(24, 20);
|
||||
r.moveTo(XPOS[idx % 3], YPOS[idx / 3]);
|
||||
addButton(r, Common::KEYCODE_1 + idx, &_iconSprites);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
@ -82,11 +82,11 @@ private:
|
||||
|
||||
Choose123(XeenEngine *vm) : ButtonContainer(vm) {}
|
||||
|
||||
int execute(int numOptions);
|
||||
int execute(uint numOptions);
|
||||
|
||||
void loadButtons(int numOptions);
|
||||
void loadButtons(uint numOptions);
|
||||
public:
|
||||
static int show(XeenEngine *vm, int numOptions);
|
||||
static int show(XeenEngine *vm, uint numOptions);
|
||||
};
|
||||
|
||||
class HowMuch : public ButtonContainer {
|
||||
|
@ -1318,7 +1318,7 @@ bool Scripts::cmdCheckProtection(ParamsIterator ¶ms) {
|
||||
bool Scripts::cmdChooseNumeric(ParamsIterator ¶ms) {
|
||||
int choice = Choose123::show(_vm, params.readByte());
|
||||
if (choice) {
|
||||
_lineNum = _event->_parameters[choice - 1];
|
||||
_lineNum = _event->_parameters[choice];
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user