[Scummvm-cvs-logs] CVS: scummvm/saga game.cpp,1.67,1.68 input.cpp,1.42,1.43 interface.cpp,1.95,1.96 interface.h,1.52,1.53 isomap.cpp,1.47,1.48 render.cpp,1.59,1.60 saga.cpp,1.112,1.113 saga.h,1.95,1.96
Andrew Kurushin
h00ligan at users.sourceforge.net
Sun May 29 08:41:14 CEST 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22464
Modified Files:
game.cpp input.cpp interface.cpp interface.h isomap.cpp
render.cpp saga.cpp saga.h
Log Message:
implemented DOS version 1 pixel clipping
game options WIP3
Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- game.cpp 28 May 2005 11:06:55 -0000 1.67
+++ game.cpp 29 May 2005 15:39:34 -0000 1.68
@@ -84,29 +84,41 @@
{kPanelButtonOption, 241,98, 57,17, kTextSave,'s',0, 0,0,0}, //save
{kPanelButtonOptionSaveFiles, 166,20, 112,74, 0,'-',0, 0,0,0}, //savefiles
- {kPanelButtonOptionText,114,4, 0,0, kTextGameOptions,'-',0, 0,0,0}, // text: game options
+ {kPanelButtonOptionText,114-8,4, 0,0, kTextGameOptions,'-',0, 0,0,0}, // text: game options
{kPanelButtonOptionText,10,22, 0,0, kTextReadingSpeed,'-',0, 0,0,0}, // text: read speed
{kPanelButtonOptionText,73,41, 0,0, kTextMusic,'-',0, 0,0,0}, // text: music
{kPanelButtonOptionText,69,60, 0,0, kTextSound,'-',0, 0,0,0}, // text: noise
};
static PanelButton ITE_QuitPanelButtons[] = {
- {kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+ {kPanelButtonQuit, 11,17, 60,16, kTextQuit,'q',0, 0,0,0},
+ {kPanelButtonQuit, 121,17, 60,16, kTextCancel,'c',0, 0,0,0},
+ {kPanelButtonQuitText, -1,5, 0,0, kTextQuitTheGameQuestion,'-',0, 0,0,0},
};
static PanelButton ITE_LoadPanelButtons[] = {
- {kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+ {kPanelButtonLoad, 101,19, 60,16, kTextOK,'o',0, 0,0,0},
+ {kPanelButtonLoadText, -1,5, 0,0, kTextLoadSuccessful,'-',0, 0,0,0},
};
static PanelButton ITE_SavePanelButtons[] = {
- {kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+ {kPanelButtonSave, 11,37, 60,16, kTextSave,'s',0, 0,0,0},
+ {kPanelButtonSave, 101,37, 60,16, kTextCancel,'c',0, 0,0,0},
+ {kPanelButtonSaveEdit, 26,17, 119,17, 0,'-',0, 0,0,0},
+ {kPanelButtonSaveText, -1,5, 0,0, kTextEnterSaveGameName,'-',0, 0,0,0},
};
+/*
+static PanelButton ITE_ProtectionPanelButtons[] = {
+ {kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+};*/
+
static GameDisplayInfo ITE_DisplayInfo = {
320, 200, // logical width&height
35, // scene path y offset
137, // scene height
+ 137, // clipped scene height
0, // status x offset
137, // status y offset
@@ -115,7 +127,7 @@
2, // status text y offset
186, // status text color
15, // status BG color
- 308,138, // save reminder pos
+ 308,137, // save reminder pos
12,12, // save reminder w & h
6,7, // save reminder sprite numbers
@@ -144,15 +156,19 @@
ARRAYSIZE(ITE_OptionPanelButtons),
ITE_OptionPanelButtons,
- 0, 0, // quit panel offsets
+ 64,54, // quit panel offsets
+ 192,38, // quit panel width & height
ARRAYSIZE(ITE_QuitPanelButtons),
ITE_QuitPanelButtons,
- 0, 0, // load panel offsets
+ 74, 53, // load panel offsets
+ 172, 40, // load panel width & height
ARRAYSIZE(ITE_LoadPanelButtons),
ITE_LoadPanelButtons,
- 0, 0, // save panel offsets
+ 2, // save edit index
+ 74, 44, // save panel offsets
+ 172, 58, // save panel width & height
ARRAYSIZE(ITE_SavePanelButtons),
ITE_SavePanelButtons
};
@@ -302,6 +318,7 @@
0, // scene path y offset
304, // scene height
+ 304, // clipped scene height
0, // status x offset
304, // status y offset
@@ -340,15 +357,19 @@
ARRAYSIZE(IHNM_OptionPanelButtons),
IHNM_OptionPanelButtons,
- 0, 0, // quit panel offsets
+ 0,0, // quit panel offsets
+ 0,0, // quit panel width & height
ARRAYSIZE(IHNM_QuitPanelButtons),
IHNM_QuitPanelButtons,
0, 0, // load panel offsets
+ 0, 0, // load panel width & height
ARRAYSIZE(IHNM_LoadPanelButtons),
IHNM_LoadPanelButtons,
+ -1, // save edit index
0, 0, // save panel offsets
+ 0, 0, // save panel width & height
ARRAYSIZE(IHNM_SavePanelButtons),
IHNM_SavePanelButtons
};
@@ -1004,6 +1025,15 @@
debug(0, "Opened resource file: %s", gameFileName);
_gameFileContexts[i] = loadContext;
}
+
+
+ if (_vm->getGameId() == GID_ITE_DISK_G) {
+ //DOS ITE version clips scene height by 1
+ _gameDisplayInfo.clippedSceneHeight--;
+ _gameDisplayInfo.statusYOffset--;
+ _gameDisplayInfo.mainPanelYOffset--;
+ _gameDisplayInfo.conversePanelYOffset--;
+ }
return SUCCESS;
}
Index: input.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/input.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- input.cpp 28 May 2005 11:06:55 -0000 1.42
+++ input.cpp 29 May 2005 15:39:34 -0000 1.43
@@ -57,18 +57,18 @@
_interface->draw();
break;
- case 269:
+/* case 269:
case 270:
case 273:
case 274:
case 275:
case 276:
if (_vm->_scene->getFlags() & kSceneFlagISO) {
-/* _vm->_isoMap->_viewDiff += (event.kbd.keycode == 270) - (event.kbd.keycode == 269);
+ _vm->_isoMap->_viewDiff += (event.kbd.keycode == 270) - (event.kbd.keycode == 269);
_vm->_isoMap->_viewScroll.y += (_vm->_isoMap->_viewDiff * (event.kbd.keycode == 274) - _vm->_isoMap->_viewDiff * (event.kbd.keycode == 273));
- _vm->_isoMap->_viewScroll.x += (_vm->_isoMap->_viewDiff * (event.kbd.keycode == 275) - _vm->_isoMap->_viewDiff * (event.kbd.keycode == 276));*/
+ _vm->_isoMap->_viewScroll.x += (_vm->_isoMap->_viewDiff * (event.kbd.keycode == 275) - _vm->_isoMap->_viewDiff * (event.kbd.keycode == 276));
}
- break;
+ break;*/
case 282: // F1
_render->toggleFlag(RF_SHOW_FPS);
_vm->_actor->_handleActionDiv = (_vm->_actor->_handleActionDiv == 15) ? 50 : 15;
Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- interface.cpp 28 May 2005 11:06:55 -0000 1.95
+++ interface.cpp 29 May 2005 15:39:34 -0000 1.96
@@ -151,6 +151,31 @@
_optionSaveFileSlider = _optionPanel.getButton(_vm->getDisplayInfo().optionSaveFileSliderIndex);
_optionSaveFilePanel = _optionPanel.getButton(_vm->getDisplayInfo().optionSaveFilePanelIndex);
+ _quitPanel.x = _vm->getDisplayInfo().quitPanelXOffset;
+ _quitPanel.y = _vm->getDisplayInfo().quitPanelYOffset;
+ _quitPanel.imageWidth = _vm->getDisplayInfo().quitPanelWidth;
+ _quitPanel.imageHeight = _vm->getDisplayInfo().quitPanelHeight;
+ _quitPanel.buttons = _vm->getDisplayInfo().quitPanelButtons;
+ _quitPanel.buttonsCount = _vm->getDisplayInfo().quitPanelButtonsCount;
+ _quitPanel.currentButton = NULL;
+
+ _loadPanel.x = _vm->getDisplayInfo().loadPanelXOffset;
+ _loadPanel.y = _vm->getDisplayInfo().loadPanelYOffset;
+ _loadPanel.imageWidth = _vm->getDisplayInfo().loadPanelWidth;
+ _loadPanel.imageHeight = _vm->getDisplayInfo().loadPanelHeight;
+ _loadPanel.buttons = _vm->getDisplayInfo().loadPanelButtons;
+ _loadPanel.buttonsCount = _vm->getDisplayInfo().loadPanelButtonsCount;
+ _loadPanel.currentButton = NULL;
+
+ _savePanel.x = _vm->getDisplayInfo().savePanelXOffset;
+ _savePanel.y = _vm->getDisplayInfo().savePanelYOffset;
+ _savePanel.imageWidth = _vm->getDisplayInfo().savePanelWidth;
+ _savePanel.imageHeight = _vm->getDisplayInfo().savePanelHeight;
+ _savePanel.buttons = _vm->getDisplayInfo().savePanelButtons;
+ _savePanel.buttonsCount = _vm->getDisplayInfo().savePanelButtonsCount;
+ _saveEdit = _savePanel.getButton(_vm->getDisplayInfo().saveEditIndex);
+ _savePanel.currentButton = NULL;
+
_active = false;
_panelMode = _lockedMode = kPanelNull;
_savedMode = -1;
@@ -167,6 +192,7 @@
_saveReminderState = 0;
_optionSaveFileTop = 0;
+ _optionSaveFileTitleNumber = 0;
_inventory = (uint16 *)calloc(_inventorySize, sizeof(uint16));
if (_inventory == NULL) {
@@ -249,20 +275,37 @@
else
_panelMode = mode;
- if (_panelMode == kPanelMain) {
- _mainPanel.currentButton = NULL;
- } else {
- if (_panelMode == kPanelConverse) {
+ switch(_panelMode) {
+ case(kPanelMain):
+ _mainPanel.currentButton = NULL;
+ break;
+ case(kPanelConverse):
_conversePanel.currentButton = NULL;
converseDisplayText();
- } else {
- if (_panelMode == kPanelOption) {
- _optionPanel.currentButton = NULL;
- _vm->fillSaveList();
- calcOptionSaveSlider();
- _optionSaveFileTitleNumber = 0;
+ break;
+ case(kPanelOption):
+ _optionPanel.currentButton = NULL;
+ _vm->fillSaveList();
+ calcOptionSaveSlider();
+ if (_optionSaveFileTitleNumber >= _vm->getDisplayInfo().optionSaveFileVisible) {
+ _optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1;
}
- }
+ break;
+ case(kPanelLoad):
+ _loadPanel.currentButton = NULL;
+ break;
+ case(kPanelQuit):
+ _quitPanel.currentButton = NULL;
+ break;
+ case(kPanelSave):
+ _savePanel.currentButton = NULL;
+ _textInputMaxWidth = _saveEdit->width - 9;
+ _textInput = true;
+ _textInputString[0] = 0;
+ strcpy(_textInputString, "test1");
+ _textInputStringLength = strlen(_textInputString);
+ _textInputPos = _textInputStringLength + 1;
+ break;
}
draw();
@@ -297,6 +340,49 @@
}
}
break;
+ case kPanelSave:
+ if (_textInput) {
+ processTextInput(ascii);
+ } else {
+ if (ascii == 27) {// Esc
+ ascii = 'c'; //cancel
+ }
+ for (i = 0; i < _savePanel.buttonsCount; i++) {
+ panelButton = &_savePanel.buttons[i];
+ if(panelButton->type == kPanelButtonSave) {
+ if (panelButton->ascii == ascii) {
+ setSave(panelButton);
+ return true;
+ }
+ }
+ }
+ }
+ break;
+ case kPanelQuit:
+ if (ascii == 27) {// Esc
+ ascii = 'c'; //cancel
+ }
+ for (i = 0; i < _quitPanel.buttonsCount; i++) {
+ panelButton = &_quitPanel.buttons[i];
+ if(panelButton->type == kPanelButtonQuit) {
+ if (panelButton->ascii == ascii) {
+ setQuit(panelButton);
+ return true;
+ }
+ }
+ }
+ break;
+ case kPanelLoad:
+ for (i = 0; i < _loadPanel.buttonsCount; i++) {
+ panelButton = &_loadPanel.buttons[i];
+ if(panelButton->type == kPanelButtonLoad) {
+ if (panelButton->ascii == ascii) {
+ setLoad(panelButton);
+ return true;
+ }
+ }
+ }
+ break;
case kPanelMain:
for (i = 0; i < _mainPanel.buttonsCount; i++) {
panelButton = &_mainPanel.buttons[i];
@@ -412,8 +498,8 @@
if (_panelMode == kPanelMain) {
- origin.x = 0;
- origin.y = _vm->getDisplayHeight() - _mainPanel.imageHeight;
+ origin.x = _mainPanel.x;
+ origin.y = _mainPanel.y;
bufToSurface(backBuffer, _mainPanel.image, _mainPanel.imageWidth, _mainPanel.imageHeight, NULL, &origin);
for (i = 0; i < kVerbTypesMax; i++) {
@@ -424,8 +510,8 @@
} else {
if (_panelMode == kPanelConverse) {
- origin.x = 0;
- origin.y = _vm->getDisplayHeight() - _mainPanel.imageHeight;
+ origin.x = _conversePanel.x;
+ origin.y = _conversePanel.y;
bufToSurface(backBuffer, _conversePanel.image, _conversePanel.imageWidth,
_conversePanel.imageHeight, NULL, &origin);
@@ -495,6 +581,22 @@
_optionSaveRectBottom.right--;
}
+void Interface::drawPanelText(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton) {
+ const char *text;
+ int textWidth;
+ Rect rect;
+
+ text = _vm->getTextString(panelButton->id);
+ panel->calcPanelButtonRect(panelButton, rect);
+ if (panelButton->xOffset < 0) {
+ textWidth = _vm->_font->getStringWidth(MEDIUM_FONT_ID, text, 0, 0);
+ rect.left += 2 + (panel->imageWidth - 1 - textWidth) / 2;
+ }
+
+ _vm->_font->draw(MEDIUM_FONT_ID, ds, text, 0, rect.left , rect.top + 1,
+ _vm->getDisplayInfo().verbTextColor, _vm->getDisplayInfo().verbTextShadowColor, FONT_SHADOW);
+}
+
void Interface::drawOption() {
const char *text;
SURFACE *backBuffer;
@@ -517,13 +619,10 @@
for (i = 0; i < _optionPanel.buttonsCount; i++) {
panelButton = &_optionPanel.buttons[i];
if(panelButton->type == kPanelButtonOption) {
- drawOptionPanelButtonText(backBuffer, panelButton);
+ drawPanelButtonText(backBuffer, &_optionPanel, panelButton);
}
if (panelButton->type == kPanelButtonOptionText) {
- text = _vm->getTextString(panelButton->id);
- _optionPanel.calcPanelButtonRect(panelButton, rect);
- _vm->_font->draw(MEDIUM_FONT_ID, backBuffer, text, 0, rect.left , rect.top,
- _vm->getDisplayInfo().verbTextColor, _vm->getDisplayInfo().verbTextShadowColor, FONT_SHADOW); //TODO: create Option button colors constant
+ drawPanelText(backBuffer, &_optionPanel, panelButton);
}
}
@@ -531,13 +630,14 @@
drawRect(backBuffer, _optionSaveRectTop, kITEColorDarkGrey);
}
- drawButtonBox(backBuffer, _optionSaveRectSlider, true, _optionSaveFileSlider->state > 0);
+ drawButtonBox(backBuffer, _optionSaveRectSlider, kSlider, _optionSaveFileSlider->state > 0);
if(_optionSaveRectBottom.height() > 0) {
drawRect(backBuffer, _optionSaveRectBottom, kITEColorDarkGrey);
}
_optionPanel.calcPanelButtonRect(_optionSaveFilePanel, rect);
+ rect.top++;
rect2 = rect;
fontHeight = _vm->_font->getHeight(SMALL_FONT_ID);
for (j = 0; j < _vm->getDisplayInfo().optionSaveFileVisible; j++) {
@@ -560,13 +660,297 @@
}
-void Interface::handleOptionUpdate(const Point& mousePoint) {
+void Interface::drawQuit() {
+ SURFACE *backBuffer;
+ Rect rect;
int i;
- int16 mouseY;
+ PanelButton *panelButton;
+
+ backBuffer = _vm->_gfx->getBackBuffer();
+
+ _quitPanel.getRect(rect);
+ drawButtonBox(backBuffer, rect, kButton, false);
+ for (i = 0; i < _quitPanel.buttonsCount; i++) {
+ panelButton = &_quitPanel.buttons[i];
+ if(panelButton->type == kPanelButtonQuit) {
+ drawPanelButtonText(backBuffer, &_quitPanel, panelButton);
+ }
+ if(panelButton->type == kPanelButtonQuitText) {
+ drawPanelText(backBuffer, &_quitPanel, panelButton);
+ }
+ }
+}
+
+void Interface::handleQuitUpdate(const Point& mousePoint) {
+ Rect rect;
+ bool releasedButton;
+
+ _quitPanel.currentButton = quitHitTest(mousePoint);
+ releasedButton = (_quitPanel.currentButton != NULL) && (_quitPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
+
+ if (!_vm->mouseButtonPressed()) {
+ _quitPanel.zeroAllButtonState();
+ }
+
+ if (releasedButton) {
+ setQuit(_quitPanel.currentButton);
+ }
+}
+
+void Interface::handleQuitClick(const Point& mousePoint) {
+ _quitPanel.currentButton = quitHitTest(mousePoint);
+
+ _quitPanel.zeroAllButtonState();
+
+ if (_quitPanel.currentButton == NULL) {
+ return;
+ }
+
+ _quitPanel.currentButton->state = 1;
+}
+
+void Interface::setQuit(PanelButton *panelButton) {
+ _quitPanel.currentButton = NULL;
+ switch (panelButton->id) {
+ case kTextCancel:
+ setMode(kPanelOption);
+ break;
+ case kTextQuit:
+ _vm->shutDown();
+ break;
+ }
+}
+
+void Interface::drawLoad() {
+ SURFACE *backBuffer;
+ Rect rect;
+ int i;
+ PanelButton *panelButton;
+
+ backBuffer = _vm->_gfx->getBackBuffer();
+
+ _loadPanel.getRect(rect);
+ drawButtonBox(backBuffer, rect, kButton, false);
+ for (i = 0; i < _loadPanel.buttonsCount; i++) {
+ panelButton = &_loadPanel.buttons[i];
+ if(panelButton->type == kPanelButtonLoad) {
+ drawPanelButtonText(backBuffer, &_loadPanel, panelButton);
+ }
+ if(panelButton->type == kPanelButtonLoadText) {
+ drawPanelText(backBuffer, &_loadPanel, panelButton);
+ }
+ }
+}
+
+void Interface::handleLoadUpdate(const Point& mousePoint) {
+ Rect rect;
+ bool releasedButton;
+
+ _loadPanel.currentButton = loadHitTest(mousePoint);
+ releasedButton = (_loadPanel.currentButton != NULL) && (_loadPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
+
+ if (!_vm->mouseButtonPressed()) {
+ _loadPanel.zeroAllButtonState();
+ }
+
+ if (releasedButton) {
+ setLoad(_loadPanel.currentButton);
+ }
+}
+
+void Interface::handleLoadClick(const Point& mousePoint) {
+ _loadPanel.currentButton = loadHitTest(mousePoint);
+
+ _loadPanel.zeroAllButtonState();
+
+ if (_loadPanel.currentButton == NULL) {
+ return;
+ }
+
+ _loadPanel.currentButton->state = 1;
+}
+
+void Interface::setLoad(PanelButton *panelButton) {
+ _loadPanel.currentButton = NULL;
+ switch (panelButton->id) {
+ case kTextOK:
+ setMode(kPanelMain);
+ break;
+ }
+}
+
+void Interface::processTextInput(uint16 ascii) {
+ char ch[2];
+ char tempString[SAVE_TITLE_SIZE];
+ uint tempWidth;
+ memset(tempString, 0, SAVE_TITLE_SIZE);
+ ch[1] = 0;
+
+ switch (ascii) {
+ case(8): // backspace
+ if (_textInputPos <= 1) {
+ break;
+ }
+ _textInputPos--;
+ case(127): // del
+ if (_textInputPos <= _textInputStringLength) {
+ if (_textInputPos != 1) {
+ strncpy(tempString, _textInputString, _textInputPos - 1);
+ }
+ if (_textInputPos != _textInputStringLength) {
+ strncat(tempString, &_textInputString[_textInputPos], _textInputStringLength - _textInputPos);
+ }
+ strcpy(_textInputString, tempString);
+ _textInputStringLength = strlen(_textInputString);
+ }
+ break;
+ case(276): // left
+ if (_textInputPos > 1) {
+ _textInputPos--;
+ }
+ break;
+ case(275): // right
+ if (_textInputPos <= _textInputStringLength) {
+ _textInputPos++;
+ }
+ break;
+ default:
+ if (((ascii >= 'a') && (ascii <='z')) ||
+ ((ascii >= '0') && (ascii <='9')) ||
+ ((ascii >= 'A') && (ascii <='Z'))) {
+ if (_textInputStringLength < SAVE_TITLE_SIZE - 1) {
+ ch[0] = ascii;
+ tempWidth = _vm->_font->getStringWidth(SMALL_FONT_ID, ch, 0, 0);
+ tempWidth += _vm->_font->getStringWidth(SMALL_FONT_ID, _textInputString, 0, 0);
+ if (tempWidth > _textInputMaxWidth) {
+ break;
+ }
+ if (_textInputPos != 1) {
+ strncpy(tempString, _textInputString, _textInputPos - 1);
+ strcat(tempString, ch);
+ }
+ if ((_textInputStringLength == 0) || (_textInputPos == 1)) {
+ strcpy(tempString, ch);
+ }
+ if ((_textInputStringLength != 0) && (_textInputPos != _textInputStringLength)) {
+ strncat(tempString, &_textInputString[_textInputPos - 1], _textInputStringLength - _textInputPos + 1);
+ }
+
+ strcpy(_textInputString, tempString);
+ _textInputStringLength = strlen(_textInputString);
+ _textInputPos++;
+ }
+ }
+ break;
+ }
+}
+
+void Interface::drawTextInput(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton) {
+ Rect rect;
+ Point drawPoint;
+ char ch[2];
+ int fgColor;
+ uint i;
+
+ ch[1] = 0;
+ panel->calcPanelButtonRect(panelButton, rect);
+ drawButtonBox(ds, rect, kEdit, _textInput);
+ rect.left += 4;
+ rect.top += 4;
+ rect.setHeight(_vm->_font->getHeight(SMALL_FONT_ID));
+
+ i = 0;
+ while ((ch[0] = _textInputString[i++]) != 0) {
+ rect.setWidth(_vm->_font->getStringWidth(SMALL_FONT_ID, ch, 0, 0));
+ if ((i == _textInputPos) && _textInput) {
+ fgColor = kITEColorBlack;
+ ds->fillRect(rect, kITEColorWhite);
+ } else {
+ fgColor = kITEColorWhite;
+ }
+ _vm->_font->draw(SMALL_FONT_ID, ds, ch, 0, rect.left,
+ rect.top + 1, fgColor, 0, 0);
+ rect.left += rect.width();
+ }
+ if (_textInput && (_textInputPos >= i)) {
+ ch[0] = ' ';
+ rect.setWidth(_vm->_font->getStringWidth(SMALL_FONT_ID, ch, 0, 0));
+ ds->fillRect(rect, kITEColorWhite);
+ }
+}
+
+void Interface::drawSave() {
+ SURFACE *backBuffer;
Rect rect;
+ int i;
+ PanelButton *panelButton;
+
+ backBuffer = _vm->_gfx->getBackBuffer();
+
+ _savePanel.getRect(rect);
+ drawButtonBox(backBuffer, rect, kButton, false);
+ for (i = 0; i < _savePanel.buttonsCount; i++) {
+ panelButton = &_savePanel.buttons[i];
+ if(panelButton->type == kPanelButtonSave) {
+ drawPanelButtonText(backBuffer, &_savePanel, panelButton);
+ }
+ if(panelButton->type == kPanelButtonSaveText) {
+ drawPanelText(backBuffer, &_savePanel, panelButton);
+ }
+ }
+
+ drawTextInput(backBuffer, &_savePanel, _saveEdit);
+}
+
+void Interface::handleSaveUpdate(const Point& mousePoint) {
+ Rect rect;
+ bool releasedButton;
+
+ _savePanel.currentButton = saveHitTest(mousePoint);
+ releasedButton = (_savePanel.currentButton != NULL) &&
+ (_savePanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
+
+ if (!_vm->mouseButtonPressed()) {
+ _savePanel.zeroAllButtonState();
+ }
+
+ if (releasedButton) {
+ setSave(_savePanel.currentButton);
+ }
+}
+
+void Interface::handleSaveClick(const Point& mousePoint) {
+ _savePanel.currentButton = saveHitTest(mousePoint);
+
+ _savePanel.zeroAllButtonState();
+
+ if (_savePanel.currentButton == NULL) {
+ _textInput = false;
+ return;
+ }
+
+ _savePanel.currentButton->state = 1;
+ if (_savePanel.currentButton == _saveEdit) {
+ _textInput = true;
+ }
+}
+
+void Interface::setSave(PanelButton *panelButton) {
+/* _savePanel.currentButton = NULL;
+ switch (panelButton->id) {
+ case kTextOK:
+ setMode(kPanelMain);
+ break;
+ }*/
+}
+
+void Interface::handleOptionUpdate(const Point& mousePoint) {
+ int16 mouseY;
+ Rect rect;
int totalFiles = _vm->getSaveFileNameCount();
int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
-
+ bool releasedButton;
+
if (_vm->mouseButtonPressed()) {
if (_optionSaveFileSlider->state > 0) {
_optionPanel.calcPanelButtonRect(_optionSaveFileSlider, rect);
@@ -586,29 +970,23 @@
}
_optionPanel.currentButton = optionHitTest(mousePoint);
- bool releasedButton = (_optionPanel.currentButton != NULL) && (_optionPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
-
+ releasedButton = (_optionPanel.currentButton != NULL) && (_optionPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
+
if (!_vm->mouseButtonPressed()) {
- for (i = 0; i < _optionPanel.buttonsCount; i++) {
- _optionPanel.buttons[i].state = 0;
- }
+ _optionPanel.zeroAllButtonState();
}
if (releasedButton) {
setOption(_optionPanel.currentButton);
}
-
}
void Interface::handleOptionClick(const Point& mousePoint) {
- int i;
Rect rect;
_optionPanel.currentButton = optionHitTest(mousePoint);
- for (i = 0; i < _optionPanel.buttonsCount; i++) {
- _optionPanel.buttons[i].state = 0;
- }
+ _optionPanel.zeroAllButtonState();
if (_optionPanel.currentButton == NULL) {
return;
@@ -634,9 +1012,7 @@
if (_optionPanel.currentButton == _optionSaveFilePanel) {
_optionPanel.calcPanelButtonRect(_optionSaveFilePanel, rect);
_optionSaveFileTitleNumber = (mousePoint.y - rect.top) / (_vm->_font->getHeight(SMALL_FONT_ID) + 1);
- if (_optionSaveFileTitleNumber < 0) {
- _optionSaveFileTitleNumber = 0;
- }
+
if (_optionSaveFileTitleNumber >= _vm->getDisplayInfo().optionSaveFileVisible) {
_optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1;
}
@@ -652,13 +1028,21 @@
void Interface::setOption(PanelButton *panelButton) {
+ _optionPanel.currentButton = NULL;
switch (panelButton->id) {
case kTextContinuePlaying:
setMode(kPanelMain);
break;
case kTextQuitGame:
- _vm->shutDown();
- break;
+ setMode(kPanelQuit);
+ break;
+ case kTextLoad:
+ //todo: load
+ setMode(kPanelLoad);
+ break;
+ case kTextSave:
+ setMode(kPanelSave);
+ break;
}
}
@@ -719,6 +1103,41 @@
}
}
+ if (_panelMode == kPanelQuit) {
+ if (updateFlag & UPDATE_MOUSEMOVE) {
+
+ handleQuitUpdate(mousePoint);
+
+ } else {
+ if (updateFlag & UPDATE_MOUSECLICK) {
+ handleQuitClick(mousePoint);
+ }
+ }
+ }
+
+ if (_panelMode == kPanelLoad) {
+ if (updateFlag & UPDATE_MOUSEMOVE) {
+
+ handleLoadUpdate(mousePoint);
+
+ } else {
+ if (updateFlag & UPDATE_MOUSECLICK) {
+ handleLoadClick(mousePoint);
+ }
+ }
+ }
+
+ if (_panelMode == kPanelSave) {
+ if (updateFlag & UPDATE_MOUSEMOVE) {
+
+ handleSaveUpdate(mousePoint);
+
+ } else {
+ if (updateFlag & UPDATE_MOUSECLICK) {
+ handleSaveClick(mousePoint);
+ }
+ }
+ }
_lastMousePoint = mousePoint;
}
@@ -755,7 +1174,7 @@
else
color = _statusOnceColor;
- _vm->_font->draw(SMALL_FONT_ID, backBuffer, _statusText, 0, _vm->getDisplayInfo().statusXOffset + (_vm->getDisplayInfo().statusWidth / 2) - (string_w / 2),
+ _vm->_font->draw(SMALL_FONT_ID, backBuffer, _statusText, 0, _vm->getDisplayInfo().statusXOffset + (_vm->getDisplayInfo().statusWidth - string_w) / 2,
_vm->getDisplayInfo().statusYOffset + _vm->getDisplayInfo().statusTextY, color, 0, 0);
if (_saveReminderState > 0) {
@@ -995,35 +1414,51 @@
draw();
}
-void Interface::drawButtonBox(SURFACE *ds, const Rect& rect, bool slider, bool down) {
+void Interface::drawButtonBox(SURFACE *ds, const Rect& rect, ButtonKind kind, bool down) {
byte cornerColor;
byte frameColor;
byte fillColor;
byte solidColor;
byte odl, our, idl, iur;
- if (slider) {
- cornerColor = 0x8b;
- frameColor = kITEColorBlack;
- fillColor = kITEColorLightBlue96;
- odl = kITEColorDarkBlue8a;
- our = kITEColorLightBlue92;
- idl = 0x89;
- iur = 0x94;
- solidColor = down ? kITEColorLightBlue94 : kITEColorLightBlue96;
- } else {
- cornerColor = 0x8b;
- frameColor = kITEColorBlack;
- solidColor = fillColor = kITEColorLightBlue96;
- odl = kITEColorDarkBlue8a;
- our = kITEColorLightBlue94;
- idl = 0x97;
- iur = 0x95;
- if (down) {
- SWAP(odl, our);
- SWAP(idl, iur);
- }
-
+ switch (kind ) {
+ case( kSlider):
+ cornerColor = 0x8b;
+ frameColor = kITEColorBlack;
+ fillColor = kITEColorLightBlue96;
+ odl = kITEColorDarkBlue8a;
+ our = kITEColorLightBlue92;
+ idl = 0x89;
+ iur = 0x94;
+ solidColor = down ? kITEColorLightBlue94 : kITEColorLightBlue96;
+ break;
+ case( kEdit):
+ cornerColor = kITEColorLightBlue96;
+ frameColor = kITEColorLightBlue96;
+ fillColor = kITEColorLightBlue96;
+ our = kITEColorDarkBlue8a;
+ odl = kITEColorLightBlue94;
+ iur = 0x97;
+ idl = 0x95;
+ if (down) {
+ solidColor = kITEColorBlue;
+ } else {
+ solidColor = kITEColorDarkGrey0C;
+ }
+ break;
+ default:
+ cornerColor = 0x8b;
+ frameColor = kITEColorBlack;
+ solidColor = fillColor = kITEColorLightBlue96;
+ odl = kITEColorDarkBlue8a;
+ our = kITEColorLightBlue94;
+ idl = 0x97;
+ iur = 0x95;
+ if (down) {
+ SWAP(odl, our);
+ SWAP(idl, iur);
+ }
+ break;
}
int x = rect.left;
@@ -1073,7 +1508,7 @@
ds->fillRect(fill, solidColor);
}
-void Interface::drawOptionPanelButtonText(SURFACE *ds, PanelButton *panelButton) {
+void Interface::drawPanelButtonText(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton) {
const char *text;
int textId;
int textWidth;
@@ -1099,19 +1534,20 @@
textWidth = _vm->_font->getStringWidth(MEDIUM_FONT_ID, text, 0, 0);
textHeight = _vm->_font->getHeight(MEDIUM_FONT_ID);
- point.x = _optionPanel.x + panelButton->xOffset + (panelButton->width / 2) - (textWidth / 2);
- point.y = _optionPanel.y + panelButton->yOffset + (panelButton->height / 2) - (textHeight / 2);
+ point.x = panel->x + panelButton->xOffset + (panelButton->width / 2) - (textWidth / 2);
+ point.y = panel->y + panelButton->yOffset + (panelButton->height / 2) - (textHeight / 2);
- if (panelButton == _optionPanel.currentButton) {
- textColor = _vm->getDisplayInfo().verbTextActiveColor; //TODO: create Option button colors constant
+ if (panelButton == panel->currentButton) {
+ textColor = _vm->getDisplayInfo().verbTextActiveColor;
} else {
- textColor = _vm->getDisplayInfo().verbTextColor; //TODO: create Option button colors constant
+ textColor = _vm->getDisplayInfo().verbTextColor;
}
- _optionPanel.calcPanelButtonRect(panelButton, rect);
- drawButtonBox(ds, rect, false, panelButton->state > 0);
+ panel->calcPanelButtonRect(panelButton, rect);
+ drawButtonBox(ds, rect, kButton, panelButton->state > 0);
- _vm->_font->draw(MEDIUM_FONT_ID, ds, text, 0, point.x , point.y, textColor, _vm->getDisplayInfo().verbTextShadowColor, FONT_SHADOW); //TODO: create Option button colors constant
+ _vm->_font->draw(MEDIUM_FONT_ID, ds, text, 0, point.x , point.y,
+ textColor, _vm->getDisplayInfo().verbTextShadowColor, FONT_SHADOW);
}
void Interface::drawPanelButtonArrow(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton) {
@@ -1149,7 +1585,7 @@
textWidth = _vm->_font->getStringWidth(SMALL_FONT_ID, text, 0, 0);
- point.x = _mainPanel.x + panelButton->xOffset + (panelButton->width / 2) - (textWidth / 2);
+ point.x = _mainPanel.x + panelButton->xOffset + 1 + (panelButton->width - 1 - textWidth) / 2;
point.y = _mainPanel.y + panelButton->yOffset + 1;
_vm->_font->draw(SMALL_FONT_ID, ds, text, 0, point.x , point.y, textColor, textShadowColor, (textShadowColor != 0) ? FONT_SHADOW : 0);
Index: interface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- interface.h 28 May 2005 11:06:55 -0000 1.52
+++ interface.h 29 May 2005 15:39:35 -0000 1.53
@@ -58,7 +58,7 @@
kPanelNull,
kPanelMain,
kPanelOption,
- kPanelTextBox,
+ kPanelSave, //ex- kPanelTextBox,
kPanelQuit,
kPanelError,
kPanelLoad,
@@ -83,13 +83,30 @@
PanelButton *buttons;
SpriteList sprites;
+ InterfacePanel() {
+ x = y = 0;
+ image = NULL;
+ imageLength = 0;
+ imageWidth = imageHeight = 0;
+ currentButton = NULL;
+ buttonsCount = 0;
+ buttons = NULL;
+ }
+
PanelButton *getButton(int index) {
if ((index >= 0) && (index < buttonsCount)) {
return &buttons[index];
}
return NULL;
}
-
+
+ void getRect(Rect &rect) {
+ rect.left = x;
+ rect.right = rect.left + imageWidth;
+ rect.top = y;
+ rect.bottom = rect.top + imageHeight;
+ }
+
void calcPanelButtonRect(const PanelButton* panelButton, Rect &rect) {
rect.left = x + panelButton->xOffset;
rect.right = rect.left + panelButton->width;
@@ -115,6 +132,14 @@
return NULL;
}
+ void zeroAllButtonState() {
+ int i;
+ for (i = 0; i < buttonsCount; i++) {
+ buttons[i].state = 0;
+ }
+ }
+
+
};
@@ -177,6 +202,9 @@
}
void draw();
void drawOption();
+ void drawQuit();
+ void drawLoad();
+ void drawSave();
void update(const Point& mousePoint, int updateFlag);
void drawStatusBar();
void setVerbState(int verb, int state);
@@ -230,17 +258,46 @@
void handleOptionUpdate(const Point& mousePoint); // option panel update
void handleOptionClick(const Point& mousePoint); // option panel click
+ PanelButton *quitHitTest(const Point& mousePoint) {
+ return _quitPanel.hitTest(mousePoint, kPanelAllButtons);
+ }
+ void handleQuitUpdate(const Point& mousePoint); // quit panel update
+ void handleQuitClick(const Point& mousePoint); // quit panel click
+
+ PanelButton *loadHitTest(const Point& mousePoint) {
+ return _loadPanel.hitTest(mousePoint, kPanelAllButtons);
+ }
+ void handleLoadUpdate(const Point& mousePoint); // load panel update
+ void handleLoadClick(const Point& mousePoint); // load panel click
+
+ PanelButton *saveHitTest(const Point& mousePoint) {
+ return _savePanel.hitTest(mousePoint, kPanelAllButtons);
+ }
+ void handleSaveUpdate(const Point& mousePoint); // save panel update
+ void handleSaveClick(const Point& mousePoint); // save panel click
+
void lockMode() { _lockedMode = _panelMode; }
void unlockMode() { _panelMode = _lockedMode; }
void setOption(PanelButton *panelButton);
+ void setQuit(PanelButton *panelButton);
+ void setLoad(PanelButton *panelButton);
+ void setSave(PanelButton *panelButton);
- void drawOptionPanelButtonText(SURFACE *ds, PanelButton *panelButton);
- void drawButtonBox(SURFACE *ds, const Rect &rect, bool slider, bool down);
+ void drawTextInput(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton);
+ void drawPanelText(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton);
+ void drawPanelButtonText(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton);
+ enum ButtonKind {
+ kButton,
+ kSlider,
+ kEdit
+ };
+ void drawButtonBox(SURFACE *ds, const Rect &rect, ButtonKind kind, bool down);
void drawPanelButtonArrow(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton);
void drawVerbPanelText(SURFACE *ds, PanelButton *panelButton, int textColor, int textShadowColor);
void drawVerbPanel(SURFACE *backBuffer, PanelButton* panelButton);
void calcOptionSaveSlider();
+ void processTextInput(uint16 ascii);
public:
void converseInit(void);
void converseClear(void);
@@ -275,6 +332,10 @@
InterfacePanel _optionPanel;
PanelButton * _optionSaveFileSlider;
PanelButton * _optionSaveFilePanel;
+ InterfacePanel _quitPanel;
+ InterfacePanel _loadPanel;
+ InterfacePanel _savePanel;
+ PanelButton * _saveEdit;
int _saveReminderState;
bool _active;
@@ -311,7 +372,12 @@
Rect _optionSaveRectTop;
Rect _optionSaveRectSlider;
Rect _optionSaveRectBottom;
-
+
+ bool _textInput;
+ char _textInputString[SAVE_TITLE_SIZE];
+ uint _textInputStringLength;
+ uint _textInputPos;
+ uint _textInputMaxWidth;
};
} // End of namespace Saga
Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- isomap.cpp 9 May 2005 18:00:38 -0000 1.47
+++ isomap.cpp 29 May 2005 15:39:35 -0000 1.48
@@ -379,7 +379,7 @@
int IsoMap::draw(SURFACE *ds) {
- Rect isoRect(_vm->getDisplayWidth(), _vm->getDisplayInfo().sceneHeight);
+ Rect isoRect(_vm->getDisplayWidth(), _vm->getClippedSceneHeight());
drawRect(ds, isoRect, 0);
_tileClip = isoRect;
drawTiles(ds, NULL);
@@ -399,7 +399,7 @@
int yAlign;
const byte *spriteBuffer;
Point spritePointer;
- Rect clip(_vm->getDisplayWidth(),_vm->getSceneHeight());
+ Rect clip(_vm->getDisplayWidth(),_vm->getClippedSceneHeight());
_vm->_sprite->getScaledSpriteBuffer(spriteList,spriteNumber,scale, width, height, xAlign, yAlign, spriteBuffer);
@@ -460,7 +460,7 @@
metaTileY.y = (view1.y * 16 - fineScroll.y) - (u0 + v0) * 64;
workAreaWidth = _vm->getDisplayWidth() + 128;
- workAreaHeight = _vm->getDisplayInfo().sceneHeight + 128 + 80;
+ workAreaHeight = _vm->getSceneHeight() + 128 + 80;
for (u1 = u0, v1 = v0; metaTileY.y < workAreaHeight; u1--, v1-- ) {
metaTileX = metaTileY;
Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- render.cpp 23 May 2005 02:23:33 -0000 1.59
+++ render.cpp 29 May 2005 15:39:35 -0000 1.60
@@ -136,8 +136,21 @@
}
}
- if (_vm->_interface->getMode() == kPanelOption) {
+ if ((_vm->_interface->getMode() == kPanelOption) ||
+ (_vm->_interface->getMode() == kPanelQuit) ||
+ (_vm->_interface->getMode() == kPanelLoad) ||
+ (_vm->_interface->getMode() == kPanelSave)) {
_vm->_interface->drawOption();
+
+ if (_vm->_interface->getMode() == kPanelQuit) {
+ _vm->_interface->drawQuit();
+ }
+ if (_vm->_interface->getMode() == kPanelLoad) {
+ _vm->_interface->drawLoad();
+ }
+ if (_vm->_interface->getMode() == kPanelSave) {
+ _vm->_interface->drawSave();
+ }
}
// Draw queued text strings
Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- saga.cpp 23 May 2005 18:53:35 -0000 1.112
+++ saga.cpp 29 May 2005 15:39:35 -0000 1.113
@@ -62,7 +62,7 @@
{0, 0, 0}
};
-static const char *interfaceTextStrings[][39] = {
+static const char *interfaceTextStrings[][42] = {
{
"Walk to", "Look At", "Pick Up", "Talk to", "Open",
"Close", "Use", "Give", "Options", "Test",
@@ -71,7 +71,8 @@
"Game Options", "Reading Speed", "Music", "Sound", "Cancel",
"Quit", "OK", "Mid", "Click",
"10%", "20%", "30%", "40%", "50%",
- "60%", "70%", "80%", "90%", "Max"
+ "60%", "70%", "80%", "90%", "Max", "Quit the Game?", "Load Successful!",
+ "Enter Save Game Name"
},
// German
{
@@ -82,7 +83,8 @@
"Spieleoptionen", "Lesegeschw.", "Musik", "Sound", "Abbr.",
"Beenden", NULL, "M", "Klick",
NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL, NULL, "Quit the Game?", "Load Successful!",
+ "Enter Save Game Name"
}
};
Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- saga.h 28 May 2005 11:06:55 -0000 1.95
+++ saga.h 29 May 2005 15:39:35 -0000 1.96
@@ -157,7 +157,16 @@
kPanelButtonOptionSaveFiles = 0x40,
kPanelButtonOptionText = 0x80,
- kPanelButtonReserved = 0x100,
+ kPanelButtonQuit = 0x100,
+ kPanelButtonQuitText = 0x200,
+
+ kPanelButtonLoad = 0x400,
+ kPanelButtonLoadText = 0x800,
+
+ kPanelButtonSave = 0x1000,
+ kPanelButtonSaveText = 0x2000,
+ kPanelButtonSaveEdit = 0x4000,
+
kPanelAllButtons = 0xFFFFF
};
@@ -200,7 +209,10 @@
kText70Percent,
kText80Percent,
kText90Percent,
- kTextMax
+ kTextMax,
+ kTextQuitTheGameQuestion,
+ kTextLoadSuccessful,
+ kTextEnterSaveGameName
};
struct IMAGE_HEADER {
@@ -346,6 +358,7 @@
int pathStartY;
int sceneHeight;
+ int clippedSceneHeight;
int statusXOffset;
int statusYOffset;
@@ -400,16 +413,23 @@
int quitPanelXOffset;
int quitPanelYOffset;
+ int quitPanelWidth;
+ int quitPanelHeight;
int quitPanelButtonsCount;
PanelButton *quitPanelButtons;
int loadPanelXOffset;
int loadPanelYOffset;
+ int loadPanelWidth;
+ int loadPanelHeight;
int loadPanelButtonsCount;
PanelButton *loadPanelButtons;
+ int saveEditIndex;
int savePanelXOffset;
int savePanelYOffset;
+ int savePanelWidth;
+ int savePanelHeight;
int savePanelButtonsCount;
PanelButton *savePanelButtons;
};
@@ -612,7 +632,8 @@
int getDisplayWidth() const { return _gameDisplayInfo.logicalWidth; }
int getDisplayHeight() const { return _gameDisplayInfo.logicalHeight;}
- int getSceneHeight() const { return _gameDisplayInfo.sceneHeight; }
+ int getSceneHeight() const { return _gameDisplayInfo.sceneHeight; }
+ int getClippedSceneHeight() const { return _gameDisplayInfo.clippedSceneHeight; }
const GameDisplayInfo & getDisplayInfo() { return _gameDisplayInfo; }
const char *getTextString(int textStringId);
More information about the Scummvm-git-logs
mailing list