mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
multiple files save-load implementation
svn-id: r18303
This commit is contained in:
parent
55f98f9b04
commit
d1ffc9df2d
@ -86,10 +86,8 @@ int SagaEngine::processInput() {
|
|||||||
_render->toggleFlag(RF_ACTOR_PATH_TEST);
|
_render->toggleFlag(RF_ACTOR_PATH_TEST);
|
||||||
break;
|
break;
|
||||||
case 288: // F7
|
case 288: // F7
|
||||||
save();
|
|
||||||
break;
|
break;
|
||||||
case 289: // F8
|
case 289: // F8
|
||||||
load();
|
|
||||||
break;
|
break;
|
||||||
case 9: // Tab
|
case 9: // Tab
|
||||||
_script->SThreadDebugStep();
|
_script->SThreadDebugStep();
|
||||||
|
@ -303,10 +303,8 @@ void Interface::setMode(int mode, bool force) {
|
|||||||
break;
|
break;
|
||||||
case(kPanelSave):
|
case(kPanelSave):
|
||||||
_savePanel.currentButton = NULL;
|
_savePanel.currentButton = NULL;
|
||||||
_textInputMaxWidth = _saveEdit->width - 9;
|
_textInputMaxWidth = _saveEdit->width - 10;
|
||||||
_textInput = true;
|
_textInput = true;
|
||||||
_textInputString[0] = 0;
|
|
||||||
strcpy(_textInputString, "test1");
|
|
||||||
_textInputStringLength = strlen(_textInputString);
|
_textInputStringLength = strlen(_textInputString);
|
||||||
_textInputPos = _textInputStringLength + 1;
|
_textInputPos = _textInputStringLength + 1;
|
||||||
_textInputRepeatPhase = 0;
|
_textInputRepeatPhase = 0;
|
||||||
@ -585,7 +583,7 @@ void Interface::draw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Interface::calcOptionSaveSlider() {
|
void Interface::calcOptionSaveSlider() {
|
||||||
int totalFiles = _vm->getSaveFileNameCount();
|
int totalFiles = _vm->getSaveFilesCount();
|
||||||
int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
|
int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
|
||||||
int height = _optionSaveFileSlider->height;
|
int height = _optionSaveFileSlider->height;
|
||||||
int sliderHeight;
|
int sliderHeight;
|
||||||
@ -686,11 +684,11 @@ void Interface::drawOption() {
|
|||||||
if (idx == _optionSaveFileTitleNumber) {
|
if (idx == _optionSaveFileTitleNumber) {
|
||||||
SWAP(bgColor, fgColor);
|
SWAP(bgColor, fgColor);
|
||||||
}
|
}
|
||||||
if (idx < _vm->getSaveFileNameCount()) {
|
if (idx < _vm->getSaveFilesCount()) {
|
||||||
rect2.top = rect.top + j * (fontHeight + 1);
|
rect2.top = rect.top + j * (fontHeight + 1);
|
||||||
rect2.bottom = rect2.top + fontHeight;
|
rect2.bottom = rect2.top + fontHeight;
|
||||||
backBuffer->fillRect(rect2, bgColor);
|
backBuffer->fillRect(rect2, bgColor);
|
||||||
text = _vm->getSaveFileName(idx);
|
text = _vm->getSaveFile(idx)->name;
|
||||||
_vm->_font->draw(SMALL_FONT_ID, backBuffer, text, 0,
|
_vm->_font->draw(SMALL_FONT_ID, backBuffer, text, 0,
|
||||||
rect.left + 1, rect2.top, fgColor, 0, 0);
|
rect.left + 1, rect2.top, fgColor, 0, 0);
|
||||||
}
|
}
|
||||||
@ -811,7 +809,7 @@ void Interface::handleLoadClick(const Point& mousePoint) {
|
|||||||
void Interface::setLoad(PanelButton *panelButton) {
|
void Interface::setLoad(PanelButton *panelButton) {
|
||||||
_loadPanel.currentButton = NULL;
|
_loadPanel.currentButton = NULL;
|
||||||
switch (panelButton->id) {
|
switch (panelButton->id) {
|
||||||
case kTextOK:
|
case kTextOK:
|
||||||
setMode(kPanelMain);
|
setMode(kPanelMain);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -827,6 +825,9 @@ void Interface::processTextInput(uint16 ascii) {
|
|||||||
textInputStartRepeat(ascii);
|
textInputStartRepeat(ascii);
|
||||||
|
|
||||||
switch (ascii) {
|
switch (ascii) {
|
||||||
|
case(27): // esc
|
||||||
|
_textInput = false;
|
||||||
|
break;
|
||||||
case(8): // backspace
|
case(8): // backspace
|
||||||
if (_textInputPos <= 1) {
|
if (_textInputPos <= 1) {
|
||||||
break;
|
break;
|
||||||
@ -947,6 +948,9 @@ void Interface::handleSaveUpdate(const Point& mousePoint) {
|
|||||||
bool releasedButton;
|
bool releasedButton;
|
||||||
|
|
||||||
_savePanel.currentButton = saveHitTest(mousePoint);
|
_savePanel.currentButton = saveHitTest(mousePoint);
|
||||||
|
|
||||||
|
validateSaveButtons();
|
||||||
|
|
||||||
releasedButton = (_savePanel.currentButton != NULL) &&
|
releasedButton = (_savePanel.currentButton != NULL) &&
|
||||||
(_savePanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
|
(_savePanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
|
||||||
|
|
||||||
@ -961,8 +965,10 @@ void Interface::handleSaveUpdate(const Point& mousePoint) {
|
|||||||
|
|
||||||
void Interface::handleSaveClick(const Point& mousePoint) {
|
void Interface::handleSaveClick(const Point& mousePoint) {
|
||||||
_savePanel.currentButton = saveHitTest(mousePoint);
|
_savePanel.currentButton = saveHitTest(mousePoint);
|
||||||
|
|
||||||
|
validateSaveButtons();
|
||||||
|
|
||||||
_savePanel.zeroAllButtonState();
|
_savePanel.zeroAllButtonState();
|
||||||
|
|
||||||
if (_savePanel.currentButton == NULL) {
|
if (_savePanel.currentButton == NULL) {
|
||||||
_textInput = false;
|
_textInput = false;
|
||||||
@ -976,18 +982,41 @@ void Interface::handleSaveClick(const Point& mousePoint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Interface::setSave(PanelButton *panelButton) {
|
void Interface::setSave(PanelButton *panelButton) {
|
||||||
/* _savePanel.currentButton = NULL;
|
_savePanel.currentButton = NULL;
|
||||||
|
uint titleNumber;
|
||||||
|
char *fileName;
|
||||||
switch (panelButton->id) {
|
switch (panelButton->id) {
|
||||||
case kTextOK:
|
case kTextSave:
|
||||||
setMode(kPanelMain);
|
if (_textInputStringLength == 0 ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!_vm->isSaveListFull() && (_optionSaveFileTitleNumber == 0)) {
|
||||||
|
if (_vm->locateSaveFile(_textInputString, titleNumber)) {
|
||||||
|
fileName = _vm->calcSaveFileName(_vm->getSaveFile(titleNumber)->slotNumber);
|
||||||
|
_vm->save(fileName, _textInputString);
|
||||||
|
_optionSaveFileTitleNumber = titleNumber;
|
||||||
|
} else {
|
||||||
|
fileName = _vm->calcSaveFileName(_vm->getNewSaveSlotNumber());
|
||||||
|
_vm->save(fileName, _textInputString);
|
||||||
|
_vm->fillSaveList();
|
||||||
|
calcOptionSaveSlider();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fileName = _vm->calcSaveFileName(_vm->getSaveFile(_optionSaveFileTitleNumber)->slotNumber);
|
||||||
|
_vm->save(fileName, _textInputString);
|
||||||
|
}
|
||||||
|
setMode(kPanelOption);
|
||||||
break;
|
break;
|
||||||
}*/
|
case kTextCancel:
|
||||||
|
setMode(kPanelOption);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interface::handleOptionUpdate(const Point& mousePoint) {
|
void Interface::handleOptionUpdate(const Point& mousePoint) {
|
||||||
int16 mouseY;
|
int16 mouseY;
|
||||||
Rect rect;
|
Rect rect;
|
||||||
int totalFiles = _vm->getSaveFileNameCount();
|
int totalFiles = _vm->getSaveFilesCount();
|
||||||
int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
|
int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible;
|
||||||
bool releasedButton;
|
bool releasedButton;
|
||||||
|
|
||||||
@ -1004,12 +1033,15 @@ void Interface::handleOptionUpdate(const Point& mousePoint) {
|
|||||||
(_optionSaveFileSlider->height - _optionSaveRectSlider.height());
|
(_optionSaveFileSlider->height - _optionSaveRectSlider.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
_optionSaveFileTop = clamp(0, _optionSaveFileTop, _vm->getSaveFileNameCount() - _vm->getDisplayInfo().optionSaveFileVisible);
|
_optionSaveFileTop = clamp(0, _optionSaveFileTop, _vm->getSaveFilesCount() - _vm->getDisplayInfo().optionSaveFileVisible);
|
||||||
calcOptionSaveSlider();
|
calcOptionSaveSlider();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_optionPanel.currentButton = optionHitTest(mousePoint);
|
_optionPanel.currentButton = optionHitTest(mousePoint);
|
||||||
|
|
||||||
|
validateOptionButtons();
|
||||||
|
|
||||||
releasedButton = (_optionPanel.currentButton != NULL) && (_optionPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
|
releasedButton = (_optionPanel.currentButton != NULL) && (_optionPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
|
||||||
|
|
||||||
if (!_vm->mouseButtonPressed()) {
|
if (!_vm->mouseButtonPressed()) {
|
||||||
@ -1026,6 +1058,8 @@ void Interface::handleOptionClick(const Point& mousePoint) {
|
|||||||
Rect rect;
|
Rect rect;
|
||||||
_optionPanel.currentButton = optionHitTest(mousePoint);
|
_optionPanel.currentButton = optionHitTest(mousePoint);
|
||||||
|
|
||||||
|
validateOptionButtons();
|
||||||
|
|
||||||
_optionPanel.zeroAllButtonState();
|
_optionPanel.zeroAllButtonState();
|
||||||
|
|
||||||
if (_optionPanel.currentButton == NULL) {
|
if (_optionPanel.currentButton == NULL) {
|
||||||
@ -1039,14 +1073,14 @@ void Interface::handleOptionClick(const Point& mousePoint) {
|
|||||||
if ((_optionSaveRectBottom.height() > 0) && (mousePoint.y >= _optionSaveRectBottom.top)) {
|
if ((_optionSaveRectBottom.height() > 0) && (mousePoint.y >= _optionSaveRectBottom.top)) {
|
||||||
_optionSaveFileTop += _vm->getDisplayInfo().optionSaveFileVisible;
|
_optionSaveFileTop += _vm->getDisplayInfo().optionSaveFileVisible;
|
||||||
} else {
|
} else {
|
||||||
if (_vm->getDisplayInfo().optionSaveFileVisible < _vm->getSaveFileNameCount()) {
|
if (_vm->getDisplayInfo().optionSaveFileVisible < _vm->getSaveFilesCount()) {
|
||||||
_optionSaveFileMouseOff = mousePoint.y - _optionSaveRectSlider.top;
|
_optionSaveFileMouseOff = mousePoint.y - _optionSaveRectSlider.top;
|
||||||
_optionPanel.currentButton->state = 1;
|
_optionPanel.currentButton->state = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_optionSaveFileTop = clamp(0, _optionSaveFileTop, _vm->getSaveFileNameCount() - _vm->getDisplayInfo().optionSaveFileVisible);
|
_optionSaveFileTop = clamp(0, _optionSaveFileTop, _vm->getSaveFilesCount() - _vm->getDisplayInfo().optionSaveFileVisible);
|
||||||
calcOptionSaveSlider();
|
calcOptionSaveSlider();
|
||||||
} else {
|
} else {
|
||||||
if (_optionPanel.currentButton == _optionSaveFilePanel) {
|
if (_optionPanel.currentButton == _optionSaveFilePanel) {
|
||||||
@ -1057,8 +1091,8 @@ void Interface::handleOptionClick(const Point& mousePoint) {
|
|||||||
_optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1;
|
_optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1;
|
||||||
}
|
}
|
||||||
_optionSaveFileTitleNumber += _optionSaveFileTop;
|
_optionSaveFileTitleNumber += _optionSaveFileTop;
|
||||||
if (_optionSaveFileTitleNumber >= _vm->getSaveFileNameCount()) {
|
if (_optionSaveFileTitleNumber >= _vm->getSaveFilesCount()) {
|
||||||
_optionSaveFileTitleNumber = _vm->getSaveFileNameCount() - 1;
|
_optionSaveFileTitleNumber = _vm->getSaveFilesCount() - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_optionPanel.currentButton->state = 1;
|
_optionPanel.currentButton->state = 1;
|
||||||
@ -1068,21 +1102,32 @@ void Interface::handleOptionClick(const Point& mousePoint) {
|
|||||||
|
|
||||||
|
|
||||||
void Interface::setOption(PanelButton *panelButton) {
|
void Interface::setOption(PanelButton *panelButton) {
|
||||||
|
char * fileName;
|
||||||
_optionPanel.currentButton = NULL;
|
_optionPanel.currentButton = NULL;
|
||||||
switch (panelButton->id) {
|
switch (panelButton->id) {
|
||||||
case kTextContinuePlaying:
|
case kTextContinuePlaying:
|
||||||
setMode(kPanelMain);
|
setMode(kPanelMain);
|
||||||
break;
|
break;
|
||||||
case kTextQuitGame:
|
case kTextQuitGame:
|
||||||
setMode(kPanelQuit);
|
setMode(kPanelQuit);
|
||||||
break;
|
break;
|
||||||
case kTextLoad:
|
case kTextLoad:
|
||||||
//todo: load
|
if (_vm->getSaveFilesCount() > 0) {
|
||||||
setMode(kPanelLoad);
|
if (_vm->isSaveListFull() || (_optionSaveFileTitleNumber > 0)) {
|
||||||
break;
|
fileName = _vm->calcSaveFileName(_vm->getSaveFile(_optionSaveFileTitleNumber)->slotNumber);
|
||||||
|
_vm->load(fileName);
|
||||||
|
setMode(kPanelLoad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case kTextSave:
|
case kTextSave:
|
||||||
setMode(kPanelSave);
|
if (!_vm->isSaveListFull() && (_optionSaveFileTitleNumber == 0)) {
|
||||||
break;
|
_textInputString[0] = 0;
|
||||||
|
} else {
|
||||||
|
strcpy(_textInputString, _vm->getSaveFile(_optionSaveFileTitleNumber)->name);
|
||||||
|
}
|
||||||
|
setMode(kPanelSave);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,6 +321,22 @@ private:
|
|||||||
}
|
}
|
||||||
return _verbTypeToPanelButton[verb];
|
return _verbTypeToPanelButton[verb];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void validateOptionButtons() {
|
||||||
|
if (!_vm->isSaveListFull() && (_optionSaveFileTitleNumber == 0) && (_optionPanel.currentButton != NULL)) {
|
||||||
|
if (_optionPanel.currentButton->id == kTextLoad) {
|
||||||
|
_optionPanel.currentButton = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void validateSaveButtons() {
|
||||||
|
if ((_textInputStringLength == 0) && (_savePanel.currentButton != NULL)) {
|
||||||
|
if (_savePanel.currentButton->id == kTextSave) {
|
||||||
|
_savePanel.currentButton = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SagaEngine *_vm;
|
SagaEngine *_vm;
|
||||||
|
|
||||||
|
34
saga/saga.h
34
saga/saga.h
@ -456,6 +456,11 @@ struct GameDescription {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SaveFileData {
|
||||||
|
char name[SAVE_TITLE_SIZE];
|
||||||
|
uint slotNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
inline int ticksToMSec(int tick) {
|
inline int ticksToMSec(int tick) {
|
||||||
return tick * 1000 / kScriptTimeTicksPerSecond;
|
return tick * 1000 / kScriptTimeTicksPerSecond;
|
||||||
@ -503,22 +508,20 @@ public:
|
|||||||
virtual ~SagaEngine();
|
virtual ~SagaEngine();
|
||||||
void shutDown() { _quit = true; }
|
void shutDown() { _quit = true; }
|
||||||
|
|
||||||
void save() { //TODO: remove
|
|
||||||
save("iteSCUMMVM.sav", "default");
|
|
||||||
}
|
|
||||||
void load() { //TODO: remove
|
|
||||||
load("iteSCUMMVM.sav");
|
|
||||||
}
|
|
||||||
void save(const char *fileName, const char *saveName);
|
void save(const char *fileName, const char *saveName);
|
||||||
void load(const char *fileName);
|
void load(const char *fileName);
|
||||||
void fillSaveList();
|
void fillSaveList();
|
||||||
char *calcSaveFileName(uint slotNumber);
|
char *calcSaveFileName(uint slotNumber);
|
||||||
char *getSaveFileName(uint idx);
|
|
||||||
bool saveListFull() const {
|
SaveFileData *getSaveFile(uint idx);
|
||||||
return _saveFileNamesMaxCount == _saveFileNamesCount;
|
uint getSaveSlotNumber(uint idx);
|
||||||
|
uint getNewSaveSlotNumber();
|
||||||
|
bool locateSaveFile(char *saveName, uint &titleNumber);
|
||||||
|
bool isSaveListFull() const {
|
||||||
|
return _saveFilesMaxCount == _saveFilesCount;
|
||||||
}
|
}
|
||||||
uint getSaveFileNameCount() const {
|
uint getSaveFilesCount() const {
|
||||||
return saveListFull() ? _saveFileNamesCount : _saveFileNamesCount + 1;
|
return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _soundEnabled;
|
int _soundEnabled;
|
||||||
@ -595,9 +598,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Common::String _targetName;
|
Common::String _targetName;
|
||||||
uint _saveFileNamesMaxCount;
|
|
||||||
uint _saveFileNamesCount;
|
uint _saveFilesMaxCount;
|
||||||
char _saveFileNames[MAX_SAVES][SAVE_TITLE_SIZE];
|
uint _saveFilesCount;
|
||||||
|
SaveFileData _saveFiles[MAX_SAVES];
|
||||||
|
bool _saveMarks[MAX_SAVES];
|
||||||
|
|
||||||
Point _mousePos;
|
Point _mousePos;
|
||||||
bool _leftMouseButtonPressed;
|
bool _leftMouseButtonPressed;
|
||||||
bool _rightMouseButtonPressed;
|
bool _rightMouseButtonPressed;
|
||||||
|
@ -48,7 +48,9 @@ struct SaveGameHeader {
|
|||||||
char name[SAVE_TITLE_SIZE];
|
char name[SAVE_TITLE_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
static char emptySlot[] = "[New Save Game]";
|
static SaveFileData emptySlot = {
|
||||||
|
"[New Save Game]", 0
|
||||||
|
};
|
||||||
|
|
||||||
//TODO:
|
//TODO:
|
||||||
// - delete savegame
|
// - delete savegame
|
||||||
@ -59,42 +61,72 @@ char* SagaEngine::calcSaveFileName(uint slotNumber) {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *SagaEngine::getSaveFileName(uint idx) {
|
SaveFileData *SagaEngine::getSaveFile(uint idx) {
|
||||||
if (idx >= MAX_SAVES) {
|
if (idx >= _saveFilesMaxCount) {
|
||||||
error("getSaveFileName wrong idx");
|
error("getSaveFileName wrong idx");
|
||||||
}
|
}
|
||||||
if (saveListFull()) {
|
if (isSaveListFull()) {
|
||||||
return _saveFileNames[idx];
|
return &_saveFiles[_saveFilesCount - idx - 1];
|
||||||
} else {
|
} else {
|
||||||
return (idx == 0) ? emptySlot : _saveFileNames[idx - 1];
|
return (idx == 0) ? &emptySlot : &_saveFiles[_saveFilesCount - idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SagaEngine::locateSaveFile(char *saveName, uint &titleNumber) {
|
||||||
|
uint i;
|
||||||
|
for (i = 0; i < _saveFilesCount; i++) {
|
||||||
|
if (strcmp(saveName, _saveFiles[i].name) == 0) {
|
||||||
|
if (isSaveListFull()) {
|
||||||
|
titleNumber = _saveFilesCount - i - 1;
|
||||||
|
} else {
|
||||||
|
titleNumber = _saveFilesCount - i;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint SagaEngine::getNewSaveSlotNumber() {
|
||||||
|
uint i;
|
||||||
|
uint saveCount;
|
||||||
|
if (isSaveListFull()) {
|
||||||
|
error("getNewSaveSlotNumber save list is full");
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
saveCount = 0;
|
||||||
|
while (saveCount < _saveFilesCount) {
|
||||||
|
if (_saveMarks[i++]) {
|
||||||
|
saveCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
void SagaEngine::fillSaveList() {
|
void SagaEngine::fillSaveList() {
|
||||||
int i;
|
int i;
|
||||||
bool marks[MAX_SAVES];
|
|
||||||
Common::InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
SaveGameHeader header;
|
SaveGameHeader header;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
name = calcSaveFileName(MAX_SAVES);
|
name = calcSaveFileName(MAX_SAVES);
|
||||||
name[strlen(name) - 2] = 0;
|
name[strlen(name) - 2] = 0;
|
||||||
_saveFileMan->listSavefiles(name, marks, MAX_SAVES);
|
_saveFileMan->listSavefiles(name, _saveMarks, MAX_SAVES);
|
||||||
|
|
||||||
_saveFileNamesMaxCount = 0;
|
_saveFilesMaxCount = 0;
|
||||||
for (i = 0; i < MAX_SAVES; i++) {
|
for (i = 0; i < MAX_SAVES; i++) {
|
||||||
if (marks[i]) {
|
if (_saveMarks[i]) {
|
||||||
_saveFileNamesMaxCount++;
|
_saveFilesMaxCount++;
|
||||||
}
|
}
|
||||||
_saveFileNames[i][0] = 0;
|
_saveFiles[i].name[0] = 0;
|
||||||
|
_saveFiles[i].slotNumber = (uint)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_saveFileNamesCount = 0;
|
_saveFilesCount = 0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < MAX_SAVES) {
|
while (i < MAX_SAVES) {
|
||||||
if (marks[i]) {
|
if (_saveMarks[i]) {
|
||||||
name = calcSaveFileName(i);
|
name = calcSaveFileName(i);
|
||||||
if (!(in = _saveFileMan->openForLoading(name))) {
|
if (!(in = _saveFileMan->openForLoading(name))) {
|
||||||
break;
|
break;
|
||||||
@ -104,19 +136,21 @@ void SagaEngine::fillSaveList() {
|
|||||||
if (header.type != MKID('SAGA')) {
|
if (header.type != MKID('SAGA')) {
|
||||||
error("SagaEngine::load wrong format");
|
error("SagaEngine::load wrong format");
|
||||||
}
|
}
|
||||||
strcpy(_saveFileNames[_saveFileNamesCount], header.name);
|
strcpy(_saveFiles[_saveFilesCount].name, header.name);
|
||||||
|
_saveFiles[_saveFilesCount].slotNumber = i;
|
||||||
delete in;
|
delete in;
|
||||||
_saveFileNamesCount++;
|
_saveFilesCount++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
/* 4debug
|
||||||
for (i = 0; i < MAX_SAVES; i++) {
|
for (i = 0; i < 14; i++) {
|
||||||
sprintf(_saveFileNames[i], "test%i",i);
|
sprintf(_saveFiles[i].name,"test%i", i);
|
||||||
}
|
_saveFiles[i].slotNumber = i;
|
||||||
|
}
|
||||||
_saveFileNamesCount = 14;
|
_saveFilesCount = 14;
|
||||||
|
_saveFilesMaxCount = 14;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -200,10 +234,6 @@ void SagaEngine::load(const char *fileName) {
|
|||||||
_scene->clearSceneQueue();
|
_scene->clearSceneQueue();
|
||||||
_scene->changeScene(insetSceneNumber, ACTOR_NO_ENTRANCE, kTransitionNoFade);
|
_scene->changeScene(insetSceneNumber, ACTOR_NO_ENTRANCE, kTransitionNoFade);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: When save/load screen will be implemented we should
|
|
||||||
// call these after that screen left by user
|
|
||||||
_interface->draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Saga
|
} // End of namespace Saga
|
||||||
|
Loading…
x
Reference in New Issue
Block a user