mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
NEVERHOOD: Merge some code in the save/load menus
This commit is contained in:
parent
bdac28929f
commit
dc459b5f67
@ -542,11 +542,6 @@ void TextLabelWidget::clear() {
|
||||
updateBounds();
|
||||
}
|
||||
|
||||
void TextLabelWidget::onClick() {
|
||||
Widget::onClick();
|
||||
// TODO? Click handler
|
||||
}
|
||||
|
||||
void TextLabelWidget::setString(const byte *string, int stringLen) {
|
||||
_string = string;
|
||||
_stringLen = stringLen;
|
||||
@ -909,13 +904,11 @@ uint32 SaveGameMenu::handleMessage(int messageNum, const MessageParam ¶m, En
|
||||
setCurrWidget(_textEditWidget);
|
||||
break;
|
||||
case 0x000B:
|
||||
if (param.asInteger() == Common::KEYCODE_RETURN) {
|
||||
((MenuModule*)_parentModule)->setSavegameInfo(_textEditWidget->getString(),
|
||||
_listBox->getCurrIndex(), _textEditWidget->isModified());
|
||||
leaveScene(0);
|
||||
} else if (param.asInteger() == Common::KEYCODE_ESCAPE) {
|
||||
if (param.asInteger() == Common::KEYCODE_RETURN)
|
||||
performSaveGame();
|
||||
else if (param.asInteger() == Common::KEYCODE_ESCAPE)
|
||||
leaveScene(1);
|
||||
} else {
|
||||
else {
|
||||
sendMessage(_textEditWidget, 0x000B, param.asInteger());
|
||||
setCurrWidget(_textEditWidget);
|
||||
}
|
||||
@ -924,10 +917,7 @@ uint32 SaveGameMenu::handleMessage(int messageNum, const MessageParam ¶m, En
|
||||
// Handle menu button click
|
||||
switch (param.asInteger()) {
|
||||
case 0:
|
||||
// TODO Same handling as Return, merge
|
||||
((MenuModule*)_parentModule)->setSavegameInfo(_textEditWidget->getString(),
|
||||
_listBox->getCurrIndex(), _textEditWidget->isModified());
|
||||
leaveScene(0);
|
||||
performSaveGame();
|
||||
break;
|
||||
case 1:
|
||||
leaveScene(1);
|
||||
@ -950,6 +940,12 @@ uint32 SaveGameMenu::handleMessage(int messageNum, const MessageParam ¶m, En
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SaveGameMenu::performSaveGame() {
|
||||
((MenuModule*)_parentModule)->setSavegameInfo(_textEditWidget->getString(),
|
||||
_listBox->getCurrIndex(), _textEditWidget->isModified());
|
||||
leaveScene(0);
|
||||
}
|
||||
|
||||
LoadGameMenu::LoadGameMenu(NeverhoodEngine *vm, Module *parentModule, Common::StringArray *savegameList)
|
||||
: WidgetScene(vm, parentModule), _savegameList(savegameList) {
|
||||
|
||||
@ -1020,20 +1016,16 @@ uint32 LoadGameMenu::handleMessage(int messageNum, const MessageParam ¶m, En
|
||||
Scene::handleMessage(messageNum, param, sender);
|
||||
switch (messageNum) {
|
||||
case 0x000B:
|
||||
if (param.asInteger() == Common::KEYCODE_RETURN) {
|
||||
((MenuModule*)_parentModule)->setLoadgameInfo(_listBox->getCurrIndex());
|
||||
leaveScene(0);
|
||||
} else if (param.asInteger() == Common::KEYCODE_ESCAPE) {
|
||||
if (param.asInteger() == Common::KEYCODE_RETURN)
|
||||
performLoadGame();
|
||||
else if (param.asInteger() == Common::KEYCODE_ESCAPE)
|
||||
leaveScene(1);
|
||||
}
|
||||
break;
|
||||
case 0x2000:
|
||||
// Handle menu button click
|
||||
switch (param.asInteger()) {
|
||||
case 0:
|
||||
// TODO Same handling as Return, merge
|
||||
((MenuModule*)_parentModule)->setLoadgameInfo(_listBox->getCurrIndex());
|
||||
leaveScene(0);
|
||||
performLoadGame();
|
||||
break;
|
||||
case 1:
|
||||
leaveScene(1);
|
||||
@ -1056,6 +1048,11 @@ uint32 LoadGameMenu::handleMessage(int messageNum, const MessageParam ¶m, En
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LoadGameMenu::performLoadGame() {
|
||||
((MenuModule*)_parentModule)->setLoadgameInfo(_listBox->getCurrIndex());
|
||||
leaveScene(0);
|
||||
}
|
||||
|
||||
QueryOverwriteMenu::QueryOverwriteMenu(NeverhoodEngine *vm, Module *parentModule, const Common::String &description)
|
||||
: Scene(vm, parentModule) {
|
||||
|
||||
@ -1081,7 +1078,7 @@ QueryOverwriteMenu::QueryOverwriteMenu(NeverhoodEngine *vm, Module *parentModule
|
||||
}
|
||||
|
||||
// Draw the query text to the background, each text line is centered
|
||||
// NOTE The original had this in its own class
|
||||
// NOTE The original had this text in its own class
|
||||
FontSurface *fontSurface = new FontSurface(_vm, calcHash("bgQueryTinyAlphabet"), 32, 7, 32, 11, 17);
|
||||
Common::StringArray textLines;
|
||||
textLines.push_back(description);
|
||||
|
@ -126,7 +126,6 @@ public:
|
||||
TextLabelWidget(NeverhoodEngine *vm, int16 x, int16 y, int16 itemID, WidgetScene *parentScene,
|
||||
int baseObjectPriority, int baseSurfacePriority,
|
||||
const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, FontSurface *fontSurface);
|
||||
virtual void onClick();
|
||||
virtual void addSprite();
|
||||
virtual int16 getWidth();
|
||||
virtual int16 getHeight();
|
||||
@ -222,6 +221,7 @@ protected:
|
||||
Common::String _savegameDescription;
|
||||
void update();
|
||||
uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender);
|
||||
void performSaveGame();
|
||||
};
|
||||
|
||||
class LoadGameMenu : public WidgetScene {
|
||||
@ -236,6 +236,7 @@ protected:
|
||||
TextEditWidget *_textEditWidget;
|
||||
Common::String _savegameDescription;
|
||||
uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender);
|
||||
void performLoadGame();
|
||||
};
|
||||
|
||||
class QueryOverwriteMenu : public Scene {
|
||||
|
Loading…
x
Reference in New Issue
Block a user