[Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.20,1.21 control.h,1.7,1.8 mouse.cpp,1.18,1.19 object.h,1.2,1.3
Robert G?ffringmann
lavosspawn at users.sourceforge.net
Sat Jan 3 22:32:01 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.19,1.20 control.h,1.6,1.7 screen.cpp,1.29,1.30 screen.h,1.10,1.11 sword1.cpp,1.26,1.27
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 control.h,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv4356/sword1
Modified Files:
control.cpp control.h mouse.cpp object.h
Log Message:
added control panel confirmation dialog.
Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- control.cpp 4 Jan 2004 05:21:22 -0000 1.20
+++ control.cpp 4 Jan 2004 06:31:29 -0000 1.21
@@ -69,6 +69,7 @@
BUTTON_SPEED,
BUTTON_VOLUME_PANEL,
BUTTON_TEXT,
+ BUTTON_CONFIRM,
//-
BUTTON_SCROLL_UP_FAST,
BUTTON_SCROLL_UP_SLOW,
@@ -83,7 +84,10 @@
BUTTON_SAVE_SELECT7,
BUTTON_SAVE_SELECT8,
BUTTON_SAVE_RESTORE_OKAY,
- BUTTON_SAVE_CANCEL
+ BUTTON_SAVE_CANCEL,
+//-
+ CONFIRM_OKAY,
+ CONFIRM_CANCEL
};
enum TextModes {
@@ -256,6 +260,8 @@
if (fullRefresh)
setupVolumePanel();
break;
+ default:
+ break;
}
if (fullRefresh) {
fullRefresh = false;
@@ -310,14 +316,24 @@
uint8 SwordControl::handleButtonClick(uint8 id, uint8 mode, uint8 *retVal) {
switch(mode) {
case BUTTON_MAIN_PANEL:
- if (id == BUTTON_RESTART)
- *retVal |= CONTROL_RESTART_GAME;
- else if ((id == BUTTON_RESTORE_PANEL) || (id == BUTTON_SAVE_PANEL) ||
+ if (id == BUTTON_RESTART) {
+ if (SwordEngine::_systemVars.deathScreenFlag) // if player is dead or has just started, don't ask for confirmation
+ *retVal |= CONTROL_RESTART_GAME;
+ else if (getConfirm(_lStrings[STR_RESTART]))
+ *retVal |= CONTROL_RESTART_GAME;
+ else
+ return mode;
+ } else if ((id == BUTTON_RESTORE_PANEL) || (id == BUTTON_SAVE_PANEL) ||
(id == BUTTON_DONE) || (id == BUTTON_VOLUME_PANEL))
return id;
else if (id == BUTTON_TEXT) {
SwordEngine::_systemVars.showText ^= 1;
_buttons[5]->setSelected(SwordEngine::_systemVars.showText);
+ } else if (id == BUTTON_QUIT) {
+ if (getConfirm(_lStrings[STR_QUIT]))
+ _system->quit();
+ else
+ return mode;
}
break;
case BUTTON_SAVE_PANEL:
@@ -424,6 +440,46 @@
createButtons(_volumeButtons, 1);
renderText(_lStrings[STR_DONE], _volumeButtons[0].x - 10, _volumeButtons[0].y, TEXT_RIGHT_ALIGN);
+}
+
+bool SwordControl::getConfirm(const uint8 *title) {
+ ControlButton *panel = new ControlButton( 0, 0, SR_CONFIRM, 0, _resMan, _screenBuf, _system);
+ panel->draw();
+ delete panel;
+ renderText(title, 320, 160, TEXT_CENTER);
+ ControlButton *buttons[2];
+ buttons[0] = new ControlButton( 260, 192 + 40, SR_BUTTON, 0, _resMan, _screenBuf, _system);
+ renderText(_lStrings[STR_OK], 640 - 260, 192 + 40, TEXT_RIGHT_ALIGN);
+ buttons[1] = new ControlButton( 260, 256 + 40, SR_BUTTON, 0, _resMan, _screenBuf, _system);
+ renderText(_lStrings[STR_CANCEL], 640 - 260, 256 + 40, TEXT_RIGHT_ALIGN);
+ uint8 retVal = 0;
+ uint8 clickVal = 0;
+ do {
+ buttons[0]->draw();
+ buttons[1]->draw();
+ _system->update_screen();
+ delay(1000 / 12);
+ if (_mouseState & BS1L_BUTTON_DOWN) {
+ if (buttons[0]->wasClicked(_mouseX, _mouseY))
+ clickVal = 1;
+ else if (buttons[1]->wasClicked(_mouseX, _mouseY))
+ clickVal = 2;
+ else
+ clickVal = 0;
+ if (clickVal)
+ buttons[clickVal - 1]->setSelected(1);
+ }
+ if ((_mouseState & BS1L_BUTTON_UP) && (clickVal)) {
+ if (buttons[clickVal - 1]->wasClicked(_mouseX, _mouseY))
+ retVal = clickVal;
+ else
+ buttons[clickVal - 1]->setSelected(0);
+ clickVal = 0;
+ }
+ } while (!retVal);
+ delete buttons[0];
+ delete buttons[1];
+ return retVal == 1;
}
bool SwordControl::keyAccepted(uint8 key) {
Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- control.h 4 Jan 2004 05:21:22 -0000 1.7
+++ control.h 4 Jan 2004 06:31:29 -0000 1.8
@@ -85,6 +85,7 @@
uint8 _selectedSavegame;
uint8 _saveNames[64][32];
uint8 _oldName[32];
+ uint8 _confirmMode;
uint8 getClicks(uint8 mode, uint8 *retVal);
uint8 handleButtonClick(uint8 id, uint8 mode, uint8 *retVal);
@@ -92,6 +93,7 @@
void setupMainPanel(void);
void setupSaveRestorePanel(bool saving);
void setupVolumePanel(void);
+ bool getConfirm(const uint8 *title);
void saveNameScroll(uint8 scroll, bool saving);
void saveNameSelect(uint8 id, bool saving);
Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mouse.cpp 1 Jan 2004 18:00:34 -0000 1.18
+++ mouse.cpp 4 Jan 2004 06:31:29 -0000 1.19
@@ -49,6 +49,7 @@
for (uint8 cnt = 0; cnt < 17; cnt++) // force res manager to keep mouse
_resMan->resOpen(MSE_POINTER + cnt); // cursors in memory all the time
+ _system->show_mouse(false);
createPointer(0, 0);
}
Index: object.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/object.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- object.h 18 Dec 2003 08:28:14 -0000 1.2
+++ object.h 4 Jan 2004 06:31:29 -0000 1.3
@@ -114,7 +114,7 @@
// mega size = 12340 bytes (+ 8 byte offset table + 20 byte header = 12368)
};
-struct _collisionData {
+struct CollisionData {
BsObject *compact;
int32 w[24];
int32 h[24];
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.19,1.20 control.h,1.6,1.7 screen.cpp,1.29,1.30 screen.h,1.10,1.11 sword1.cpp,1.26,1.27
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword1 control.h,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list