[Scummvm-cvs-logs] CVS: scummvm/sky compact.h,1.6,1.7 control.cpp,1.2,1.3 control.h,1.1,1.2 disk.cpp,1.30,1.31 disk.h,1.6,1.7 logic.cpp,1.101,1.102 module.mk,1.16,1.17 mouse.h,1.13,1.14 sky.cpp,1.63,1.64 sky.h,1.34,1.35 sound.cpp,1.16,1.17 text.h,1.20,1.21
Robert G?ffringmann
lavosspawn at users.sourceforge.net
Thu Jun 26 19:55:04 CEST 2003
Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv4838/sky
Modified Files:
compact.h control.cpp control.h disk.cpp disk.h logic.cpp
module.mk mouse.h sky.cpp sky.h sound.cpp text.h
Log Message:
some more loading & saving work (still unfinished)
Index: compact.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- compact.h 26 May 2003 19:55:28 -0000 1.6
+++ compact.h 27 Jun 2003 02:54:05 -0000 1.7
@@ -3214,6 +3214,24 @@
extern uint16 retina_scan_cdt[];
extern Compact forklift_cpt;
extern void *data_0[];
+ extern uint8 babs_auto[];
+ extern uint8 burke_auto[];
+ extern uint8 dan_auto[];
+ extern uint8 foreman_auto[];
+ extern uint8 full_ss_auto[];
+ extern uint8 gal_auto[];
+ extern uint8 jobs_auto[];
+ extern uint8 joey_auto[];
+ extern uint8 ken_auto[];
+ extern uint8 lamb_auto[];
+ extern uint8 loader_auto[];
+ extern uint8 medi_auto[];
+ extern uint8 monitor_auto[];
+ extern uint8 radman_auto[];
+ extern uint8 shades_auto[];
+ extern uint8 spu_auto[];
+ extern uint8 ss_auto[];
+ extern uint8 wit_auto[];
};
#endif
Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- control.cpp 22 Jun 2003 22:34:25 -0000 1.2
+++ control.cpp 27 Jun 2003 02:54:05 -0000 1.3
@@ -23,6 +23,7 @@
#include "sky/skydefs.h"
#include "sky/sky.h"
#include "common/file.h"
+#include "common/gameDetector.h"
SkyConResource::SkyConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen) {
@@ -161,6 +162,8 @@
memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
uint16 volY = (127 - _skyMusic->giveVolume()) / 4 + 59 - MPNL_Y; // volume slider's Y coordinate
+ uint16 spdY = 12 - (SkyState::_systemVars.gameSpeed / SPEED_MULTIPLY);
+ spdY += MPNL_Y + 93; // speed slider's initial position
_sprites.controlPanel = _skyDisk->loadFile(60500, NULL);
_sprites.button = _skyDisk->loadFile(60501, NULL);
@@ -176,7 +179,7 @@
//Main control panel: X Y Text OnClick
_controlPanel = createResource(_sprites.controlPanel, 1, 0, 0, 0, 0, DO_NOTHING, MAINPANEL);
_exitButton = createResource( _sprites.button, 3, 0, 16, 125, 50, EXIT, MAINPANEL);
- _slide = createResource( _sprites.slide2, 1, 0, 19, 99, 95, SPEED_SLIDE, MAINPANEL);
+ _slide = createResource( _sprites.slide2, 1, 0, 19,spdY, 95, SPEED_SLIDE, MAINPANEL);
_slide2 = createResource( _sprites.slide2, 1, 0, 19,volY, 14, MUSIC_SLIDE, MAINPANEL);
_slode = createResource( _sprites.slode2, 1, 0, 9, 49, 0, DO_NOTHING, MAINPANEL);
_restorePanButton = createResource( _sprites.button, 3, 0, 58, 19, 51, REST_GAME_PANEL, MAINPANEL);
@@ -187,7 +190,15 @@
_fxPanButton = createResource( _sprites.button, 3, 0, 58, 99, 86, TOGGLE_FX, MAINPANEL);
else
_fxPanButton = createResource( _sprites.button, 3, 2, 58, 99, 87, TOGGLE_FX, MAINPANEL);
- _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 35, TOGGLE_MS, MAINPANEL);
+
+ if (SkyState::isCDVersion()) { // CD Version: Toggle text/speech
+ if (SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT)
+ _musicPanButton = createResource( _sprites.button, 3, 2, 58, 119, 21, TOGGLE_TEXT, MAINPANEL);
+ else
+ _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 35, TOGGLE_TEXT, MAINPANEL);
+ } else { // disk version: toggle music on/off
+ _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 91, TOGGLE_MS, MAINPANEL);
+ }
_bodge = createResource( _sprites.musicBodge, 2, 1, 98, 115, 0, DO_NOTHING, MAINPANEL);
_yesNo = createResource( _sprites.yesNo, 1, 0, -2, 40, 0, DO_NOTHING, MAINPANEL);
@@ -287,6 +298,8 @@
_skyScreen->setPalette(60510);
drawMainPanel();
+
+ uint16 savedMouse = _skyMouse->giveCurrentMouseType();
_skyMouse->spriteMouse(MOUSE_NORMAL,0,0);
bool quitPanel = false;
@@ -328,6 +341,7 @@
_skyScreen->forceRefresh();
_skyScreen->setPalette((uint8*)SkyState::fetchCompact(SkyState::_systemVars.currentPalette));
removePanel();
+ _skyMouse->spriteMouse(savedMouse, 0, 0);
}
uint16 SkyControl::handleClick(SkyConResource *pButton) {
@@ -373,7 +387,8 @@
return shiftUp(SLOW);
case SPEED_SLIDE:
- return 0;
+ _mouseClicked = true;
+ return doSpeedSlide();
case MUSIC_SLIDE:
_mouseClicked = true;
@@ -385,6 +400,9 @@
case TOGGLE_MS:
return 0;
+ case TOGGLE_TEXT:
+ return toggleText(pButton);
+
case EXIT:
animClick(pButton);
return QUIT_PANEL;
@@ -395,6 +413,11 @@
case QUIT_TO_DOS:
animClick(pButton);
+ if (getYesNo()) {
+ showGameQuitMsg(false);
+ delay(1500);
+ _system->quit();
+ }
return 0;
default:
@@ -402,6 +425,36 @@
}
}
+bool SkyControl::getYesNo(void) {
+
+ _yesNo->drawToScreen(WITH_MASK);
+ bool retVal; bool quitPanel = false;
+ uint8 mouseType = MOUSE_NORMAL;
+ uint8 wantMouse = MOUSE_NORMAL;
+ while (!quitPanel) {
+ if (mouseType != wantMouse) {
+ mouseType = wantMouse;
+ _skyMouse->spriteMouse(mouseType, 0, 0);
+ }
+ _system->update_screen();
+ delay(50);
+ if ((_mouseY >= 83) && (_mouseY <= 110)) {
+ if ((_mouseX >= 77) && (_mouseX <= 114)) { // over 'yes'
+ wantMouse = MOUSE_CROSS;
+ if (_mouseClicked) {
+ quitPanel = true; retVal = true;
+ }
+ } else if ((_mouseX >= 156) && (_mouseX <= 193)) { // over 'no'
+ wantMouse = MOUSE_CROSS;
+ if (_mouseClicked) {
+ quitPanel = true; retVal = false;
+ }
+ } else wantMouse = MOUSE_NORMAL;
+ } else wantMouse = MOUSE_NORMAL;
+ }
+ return retVal;
+}
+
uint16 SkyControl::doMusicSlide(void) {
int ofsY = _slide2->_y - _mouseY;
@@ -428,6 +481,33 @@
return 0;
}
+uint16 SkyControl::doSpeedSlide(void) {
+
+ /*int ofsY = _slide->_y - _mouseY;
+ uint16 speedDelay = 12 - (_slide->_y - (MPNL_Y + 93));
+ speedDelay *= SPEED_MULTIPLY;
+ while (_mouseClicked) {
+ delay(50);
+ int newY = ofsY + _mouseY;
+ if (newY < MPNL_Y + 93) newY = MPNL_Y + 93;
+ if (newY > MPNL_Y + 104) newY = MPNL_Y + 104;
+ if (newY != _slide->_y) {
+ _slode->drawToScreen(NO_MASK);
+ _slide->setXY(_slide->_x, (uint16)newY);
+ _slide->drawToScreen(WITH_MASK);
+ _slide2->drawToScreen(WITH_MASK);
+ speedDelay = 12 - (newY - (MPNL_Y + 93));
+ speedDelay *= SPEED_MULTIPLY;
+ }
+ buttonControl(_slide);
+ _text->drawToScreen(WITH_MASK);
+ _system->update_screen();
+ }
+ SkyState::_systemVars.gameSpeed = speedDelay;
+ printf("New delay: %d\n",speedDelay);*/
+ return SPEED_CHANGED;
+}
+
uint16 SkyControl::toggleFx(SkyConResource *pButton) {
SkyState::_systemVars.systemFlags ^= SF_FX_OFF;
@@ -444,6 +524,24 @@
return TOGGLED;
}
+uint16 SkyControl::toggleText(SkyConResource *pButton) {
+
+ SkyState::_systemVars.systemFlags ^= SF_ALLOW_SPEECH;
+ if (SkyState::_systemVars.systemFlags & SF_ALLOW_SPEECH) {
+ pButton->_curSprite = 0;
+ pButton->_text = 0x7000 + 35;
+ SkyState::_systemVars.systemFlags &= ~SF_ALLOW_TEXT;
+ } else {
+ pButton->_curSprite = 2;
+ pButton->_text = 0x7000 + 21;
+ SkyState::_systemVars.systemFlags |= SF_ALLOW_TEXT;
+ }
+ pButton->drawToScreen(WITH_MASK);
+ buttonControl(pButton);
+ _system->update_screen();
+ return TOGGLED;
+}
+
uint16 SkyControl::shiftDown(uint8 speed) {
if (speed == SLOW) {
@@ -490,8 +588,6 @@
_quitButton->drawToScreen(NO_MASK);
loadSaveDescriptions(saveGameTexts);
- setUpGameSprites(saveGameTexts, textSprites, _firstText);
-
uint16 selectedGame = 0;
bool quitPanel = false;
@@ -499,6 +595,7 @@
uint16 clickRes = 0;
while (!quitPanel) {
if (refreshNames) {
+ setUpGameSprites(saveGameTexts, textSprites, _firstText);
showSprites(textSprites);
refreshNames = false;
}
@@ -512,6 +609,7 @@
clickRes = CANCEL_PRESSED;
quitPanel = true;
}
+
bool haveButton = false;
for (cnt = 0; cnt < 6; cnt++)
if (lookList[cnt]->isMouseOver(_mouseX, _mouseY)) {
@@ -522,15 +620,15 @@
_mouseClicked = false;
clickRes = handleClick(lookList[cnt]);
+
if ((clickRes == CANCEL_PRESSED) || (clickRes == GAME_SAVED) ||
(clickRes == GAME_RESTORED) || (clickRes == NO_DISK_SPACE))
quitPanel = true;
- if (clickRes == SHIFTED) {
- setUpGameSprites(saveGameTexts, textSprites, _firstText);
+ if (clickRes == SHIFTED)
refreshNames = true;
- }
}
}
+
if (_mouseClicked) {
if ((_mouseX >= GAME_NAME_X) && (_mouseX <= GAME_NAME_X + PAN_LINE_WIDTH) &&
(_mouseY >= GAME_NAME_Y) && (_mouseY <= GAME_NAME_Y + PAN_CHAR_HEIGHT * MAX_ON_SCREEN)) {
@@ -539,7 +637,6 @@
}
}
if (!haveButton) buttonControl(NULL);
-
}
for (cnt = 0; cnt < MAX_ON_SCREEN; cnt++)
@@ -589,6 +686,7 @@
while ((destPos[nameCnt + 5] = inPos[nameCnt]))
nameCnt++;
destPos += MAX_TEXT_LEN;
+ inPos += nameCnt + 1;
}
free(tmpBuf);
inf->close();
@@ -601,6 +699,162 @@
}
}
+uint16 SkyControl::saveGameToFile(char *fName) {
+
+ File *outf = new File();
+ if (!outf->open(fName, _savePath, File::kFileWriteMode)) {
+ delete outf;
+ return NO_DISK_SPACE;
+ }
+
+ uint8 *saveData = (uint8*)malloc(0x20000);
+ uint32 fSize = prepareSaveData(saveData);
+
+ if (outf->write(saveData, fSize) != fSize) {
+ free(saveData);
+ delete outf;
+ return NO_DISK_SPACE;
+ }
+ outf->close();
+ delete outf;
+ free(saveData);
+ return GAME_SAVED;
+}
+
+#define STOSD(ptr, val) { *(uint32*)(ptr) = TO_LE_32(val); (ptr) += 4; }
+#define STOSW(ptr, val) { *(uint16*)(ptr) = TO_LE_16(val); (ptr) += 2; }
+
+void SkyControl::stosMegaSet(uint8 **destPos, MegaSet *mega) {
+ STOSW(*destPos, mega->gridWidth);
+ STOSW(*destPos, mega->colOffset);
+ STOSW(*destPos, mega->colWidth);
+ STOSW(*destPos, mega->lastChr);
+ // anims, stands, turnTable
+}
+
+void SkyControl::stosCompact(uint8 **destPos, Compact *cpt) {
+ uint16 saveType = 0;
+ if (cpt->extCompact) {
+ saveType |= SAVE_EXT;
+ if (cpt->extCompact->megaSet0) saveType |= SAVE_MEGA0;
+ if (cpt->extCompact->megaSet1) saveType |= SAVE_MEGA1;
+ if (cpt->extCompact->megaSet2) saveType |= SAVE_MEGA2;
+ if (cpt->extCompact->megaSet3) saveType |= SAVE_MEGA3;
+ }
+ STOSW(*destPos, saveType);
+ STOSW(*destPos, cpt->logic);
+ STOSW(*destPos, cpt->status);
+ STOSW(*destPos, cpt->sync);
+ STOSW(*destPos, cpt->screen);
+ STOSW(*destPos, cpt->place);
+ // getToTable
+ STOSW(*destPos, cpt->xcood);
+ STOSW(*destPos, cpt->ycood);
+ STOSW(*destPos, cpt->frame);
+ STOSW(*destPos, cpt->cursorText);
+ STOSW(*destPos, cpt->mouseOn);
+ STOSW(*destPos, cpt->mouseOff);
+ STOSW(*destPos, cpt->mouseClick);
+ STOSW(*destPos, cpt->mouseRelX);
+ STOSW(*destPos, cpt->mouseRelY);
+ STOSW(*destPos, cpt->mouseSizeX);
+ STOSW(*destPos, cpt->mouseSizeY);
+ STOSW(*destPos, cpt->actionScript);
+ STOSW(*destPos, cpt->upFlag);
+ STOSW(*destPos, cpt->downFlag);
+ STOSW(*destPos, cpt->getToFlag);
+ STOSW(*destPos, cpt->flag);
+ STOSW(*destPos, cpt->mood);
+ // grafixProg
+ STOSW(*destPos, cpt->offset);
+ STOSW(*destPos, cpt->mode);
+ STOSW(*destPos, cpt->baseSub);
+ STOSW(*destPos, cpt->baseSub_off);
+ if (cpt->extCompact) {
+ STOSW(*destPos, cpt->extCompact->actionSub);
+ STOSW(*destPos, cpt->extCompact->actionSub_off);
+ STOSW(*destPos, cpt->extCompact->getToSub);
+ STOSW(*destPos, cpt->extCompact->getToSub_off);
+ STOSW(*destPos, cpt->extCompact->extraSub);
+ STOSW(*destPos, cpt->extCompact->extraSub_off);
+ STOSW(*destPos, cpt->extCompact->dir);
+ STOSW(*destPos, cpt->extCompact->stopScript);
+ STOSW(*destPos, cpt->extCompact->miniBump);
+ STOSW(*destPos, cpt->extCompact->leaving);
+ STOSW(*destPos, cpt->extCompact->atWatch);
+ STOSW(*destPos, cpt->extCompact->atWas);
+ STOSW(*destPos, cpt->extCompact->alt);
+ STOSW(*destPos, cpt->extCompact->request);
+ STOSW(*destPos, cpt->extCompact->spWidth_xx);
+ STOSW(*destPos, cpt->extCompact->spColour);
+ STOSW(*destPos, cpt->extCompact->spTextId);
+ STOSW(*destPos, cpt->extCompact->spTime);
+ STOSW(*destPos, cpt->extCompact->arAnimIndex);
+ // turnProg
+ STOSW(*destPos, cpt->extCompact->waitingFor);
+ STOSW(*destPos, cpt->extCompact->arTargetX);
+ STOSW(*destPos, cpt->extCompact->arTargetY);
+ // animScratch
+ STOSW(*destPos, cpt->extCompact->megaSet);
+
+ if (cpt->extCompact->megaSet0)
+ stosMegaSet(destPos, cpt->extCompact->megaSet0);
+ if (cpt->extCompact->megaSet1)
+ stosMegaSet(destPos, cpt->extCompact->megaSet1);
+ if (cpt->extCompact->megaSet2)
+ stosMegaSet(destPos, cpt->extCompact->megaSet2);
+ if (cpt->extCompact->megaSet3)
+ stosMegaSet(destPos, cpt->extCompact->megaSet3);
+ }
+}
+
+void SkyControl::stosAR(uint8 **destPos, uint8 *arData) {
+
+ uint16 *data = (uint16*)arData;
+ for (uint8 cnt = 0; cnt < 32; cnt++)
+ STOSW(*destPos, TO_LE_16(data[cnt]));
+}
+
+uint32 SkyControl::prepareSaveData(uint8 *destBuf) {
+
+ uint32 cnt;
+ memset(destBuf, 0, 4); // space for data size
+ uint8 *destPos = destBuf + 4;
+ memcpy(destPos, SAVE_HEADER, sizeof(SAVE_HEADER));
+ destPos += sizeof(SAVE_HEADER);
+ //STOSD(destPos, SkyLogic::_scriptVariables[CUR_SECTION]);
+ STOSD(destPos, _skyMusic->giveCurrentMusic());
+
+ //TODO: save queued sfx
+ STOSD(destPos, _skyText->giveCurrentCharSet());
+ STOSD(destPos, _skyMouse->giveCurrentMouseType());
+ STOSD(destPos, SkyState::_systemVars.currentPalette);
+ for (cnt = 0; cnt < 838; cnt++)
+ STOSD(destPos, SkyLogic::_scriptVariables[cnt]);
+ uint32 *loadedFilesList = _skyDisk->giveLoadedFilesList();
+
+ for (cnt = 0; cnt < 60; cnt++)
+ STOSD(destPos, loadedFilesList[cnt]);
+
+ for (cnt = 0; cnt < ARRAYSIZE(_saveLoadCpts); cnt++)
+ stosCompact(&destPos, _saveLoadCpts[cnt]);
+
+ for (cnt = 0; cnt < ARRAYSIZE(_saveLoadARs); cnt++)
+ stosAR(&destPos, _saveLoadARs[cnt]);
+
+ for (cnt = 0; cnt < 3; cnt++)
+ STOSW(destPos, SkyCompact::park_table[cnt]);
+
+ for (cnt = 0; cnt < 13; cnt++)
+ STOSW(destPos, SkyCompact::high_floor_table[cnt]);
+
+ *(uint32*)destBuf = TO_LE_32(destPos - destBuf); // save size
+ return destPos - destBuf;
+}
+
+#undef STOSD
+#undef STOSW
+
void SkyControl::delay(unsigned int amount) {
OSystem::Event event;
@@ -642,6 +896,8 @@
break;
case OSystem::EVENT_QUIT:
+ showGameQuitMsg(false);
+ delay(1500);
_system->quit();
break;
@@ -658,4 +914,42 @@
cur = _system->get_msecs();
} while (cur < start + amount);
+}
+
+void SkyControl::showGameQuitMsg(bool useScreen) {
+
+ uint8 *textBuf1 = (uint8*)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
+ uint8 *textBuf2 = (uint8*)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
+ char *vText1, *vText2;
+ uint8 *screenData;
+ if (useScreen)
+ screenData = _skyScreen->giveCurrent();
+ else
+ screenData = _screenBuf;
+ switch (SkyState::_systemVars.language) {
+ case DE_DEU: vText1 = VIG_DE1; vText2 = VIG_DE2; break;
+ case FR_FRA: vText1 = VIG_FR1; vText2 = VIG_FR2; break;
+ case IT_ITA: vText1 = VIG_IT1; vText2 = VIG_IT2; break;
+ case PT_BRA: vText1 = VIG_PT1; vText2 = VIG_PT2; break;
+ default: vText1 = VIG_EN1; vText2 = VIG_EN2; break;
+ }
+ _skyText->displayText(vText1, textBuf1, true, 320, 255);
+ _skyText->displayText(vText2, textBuf2, true, 320, 255);
+ uint8 *curLine1 = textBuf1 + sizeof(dataFileHeader);
+ uint8 *curLine2 = textBuf2 + sizeof(dataFileHeader);
+ uint8 *targetLine = screenData + GAME_SCREEN_WIDTH * 80;
+ for (uint8 cnty = 0; cnty < PAN_CHAR_HEIGHT; cnty++) {
+ for (uint16 cntx = 0; cntx < GAME_SCREEN_WIDTH; cntx++) {
+ if (curLine1[cntx])
+ targetLine[cntx] = curLine1[cntx];
+ if (curLine2[cntx])
+ (targetLine + 24 * GAME_SCREEN_WIDTH)[cntx] = curLine2[cntx];
+ }
+ curLine1 += GAME_SCREEN_WIDTH;
+ curLine2 += GAME_SCREEN_WIDTH;
+ targetLine += GAME_SCREEN_WIDTH;
+ }
+ _skyScreen->halvePalette();
+ _skyScreen->showScreen(screenData);
+ free(textBuf1); free(textBuf2);
}
Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- control.h 22 Jun 2003 21:42:59 -0000 1.1
+++ control.h 27 Jun 2003 02:54:05 -0000 1.2
@@ -71,9 +71,10 @@
#define MUSIC_SLIDE 11
#define TOGGLE_FX 12
#define TOGGLE_MS 13
-#define EXIT 14
-#define RESTART 15
-#define QUIT_TO_DOS 16
+#define TOGGLE_TEXT 14
+#define EXIT 15
+#define RESTART 16
+#define QUIT_TO_DOS 17
// onClick return codes
#define CANCEL_PRESSED 100
@@ -91,6 +92,17 @@
#define SLOW 0
#define FAST 1
+#define SPEED_MULTIPLY 8
+
+//-
+#define SAVE_EXT 1
+#define SAVE_MEGA0 2
+#define SAVE_MEGA1 4
+#define SAVE_MEGA2 8
+#define SAVE_MEGA3 16
+
+#define SAVE_HEADER "(C) Revolution Software Ltd 1993.\x00System 2 written by David Sykes and Tony Warriner\x0D\x0APortable implementation done by the ScummVM team\x0D\x0ASave File Revision 1\x00"
+
class SkyConResource {
public:
SkyConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen);
@@ -125,6 +137,7 @@
public:
SkyControl(SkyScreen *screen, SkyDisk *disk, SkyMouse *mouse, SkyText *text, SkyMusicBase *music, OSystem *system, const char *savePath);
void doControlPanel(void);
+ void showGameQuitMsg(bool useScreen = true);
private:
void initPanel(void);
@@ -136,12 +149,24 @@
void setUpGameSprites(uint8 *nameBuf, dataFileHeader **nameSprites, uint16 firstNum);
void showSprites(dataFileHeader **nameSprites);
void animClick(SkyConResource *pButton);
+ bool getYesNo(void);
uint16 doMusicSlide(void);
+ uint16 doSpeedSlide(void);
uint16 handleClick(SkyConResource *pButton);
uint16 toggleFx(SkyConResource *pButton);
+ uint16 toggleText(SkyConResource *pButton);
uint16 shiftDown(uint8 speed);
uint16 shiftUp(uint8 speed);
const char *_savePath;
+
+ uint16 saveGameToFile(char *fName);
+ void stosMegaSet(uint8 **destPos, MegaSet *mega);
+ void stosCompact(uint8 **destPos, Compact *cpt);
+ void stosAR(uint8 **destPos, uint8 *arData);
+ uint32 prepareSaveData(uint8 *destBuf);
+ uint16 restoreGameFromFile(char *fName);
+ static Compact *_saveLoadCpts[833]; // \ moved to sky/compacts/savedata.cpp
+ static uint8 *_saveLoadARs[18]; // /
uint16 saveRestorePanel(bool allowEdit);
Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- disk.cpp 9 Jun 2003 20:41:08 -0000 1.30
+++ disk.cpp 27 Jun 2003 02:54:05 -0000 1.31
@@ -340,6 +340,24 @@
_buildList[0] = 0;
}
+void SkyDisk::refreshFilesList(uint32 *list) {
+
+ uint8 cnt = 0;
+ while (_loadedFilesList[cnt]) {
+ if (SkyState::_itemList[_loadedFilesList[cnt] & 2047])
+ free(SkyState::_itemList[_loadedFilesList[cnt] & 2047]);
+ SkyState::_itemList[_loadedFilesList[cnt] & 2047] = NULL;
+ cnt++;
+ }
+ cnt = 0;
+ while (list[cnt]) {
+ _loadedFilesList[cnt] = list[cnt];
+ SkyState::_itemList[_loadedFilesList[cnt] & 2047] = (void**)loadFile((uint16)(_loadedFilesList[cnt] & 0x7FFF), NULL);
+ cnt++;
+ }
+ _loadedFilesList[cnt] = 0;
+}
+
void SkyDisk::fnMiniLoad(uint16 fileNum) {
uint16 cnt = 0;
Index: disk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- disk.h 2 Jun 2003 06:42:42 -0000 1.6
+++ disk.h 27 Jun 2003 02:54:05 -0000 1.7
@@ -24,7 +24,7 @@
#include "common/file.h"
-#define MAX_FILES_IN_LIST 60
+#define MAX_FILES_IN_LIST 60
struct PrefFile {
uint8 *data;
@@ -51,6 +51,8 @@
void fnCacheChip(uint32 list);
void fnCacheFiles(void);
void fnFlushBuffers(void);
+ uint32 *giveLoadedFilesList(void) { return _loadedFilesList; };
+ void refreshFilesList(uint32 *list);
protected:
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- logic.cpp 22 Jun 2003 21:42:59 -0000 1.101
+++ logic.cpp 27 Jun 2003 02:54:05 -0000 1.102
@@ -25,6 +25,7 @@
#include "sky/compact.h"
#include "sky/skydefs.h"
#include "sky/talks.h"
+#include "common/gameDetector.h"
uint32 SkyLogic::_scriptVariables[838];
@@ -1398,13 +1399,11 @@
_compact->mode += 4; // next level up
Compact *cpt = SkyState::fetchCompact(_compact->place);
if (!cpt) {
- // FIXME: This should never happen
warning("can't find _compact's getToTable. Place compact is NULL");
return false;
}
uint16 *getToTable = cpt->getToTable;
if (!getToTable) {
- // FIXME: This should never happen
warning("Place compact's getToTable is NULL!");
return false;
}
@@ -2338,6 +2337,15 @@
// startSpeech returns false if no speech file exists for that text
if (SkyState::isCDVersion())
speechUsed = _skySound->startSpeech((uint16)textNum);
+
+ // if sky is configured to speech-only return now - except if we're running another
+ // language than english
+ if (speechUsed && (!(SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT)) &&
+ (SkyState::_systemVars.language == EN_USA)) {
+ target->extCompact->spTime = 10;
+ target->logic = L_TALK;
+ return ;
+ }
//now form the text sprite
struct lowTextManager_t textInfo;
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/module.mk,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- module.mk 22 Jun 2003 21:42:59 -0000 1.16
+++ module.mk 27 Jun 2003 02:54:05 -0000 1.17
@@ -23,6 +23,7 @@
sky/music/gmmusic.o \
sky/music/mt32music.o \
sky/music/musicbase.o \
+ sky/compacts/savedata.o \
# Include common rules
include common.rules
Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/mouse.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mouse.h 9 Jun 2003 18:58:37 -0000 1.13
+++ mouse.h 27 Jun 2003 02:54:05 -0000 1.14
@@ -50,6 +50,7 @@
void waitMouseNotPressed(void);
uint16 giveMouseX(void) { return _aMouseX; };
uint16 giveMouseY(void) { return _aMouseY; };
+ uint16 giveCurrentMouseType(void) { return _mouseType2; };
protected:
Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- sky.cpp 22 Jun 2003 21:42:59 -0000 1.63
+++ sky.cpp 27 Jun 2003 02:54:05 -0000 1.64
@@ -75,50 +75,14 @@
_introTextSave = 0;
}
-void SkyState::showQuitMsg(void) {
-
- uint8 *textBuf1 = (uint8*)calloc(GAME_SCREEN_WIDTH * 14 + sizeof(struct dataFileHeader),1);
- uint8 *textBuf2 = (uint8*)calloc(GAME_SCREEN_WIDTH * 14 + sizeof(struct dataFileHeader),1);
- char *vText1, *vText2;
- uint8 *screenData = _skyScreen->giveCurrent();
- switch (_systemVars.language) {
- case DE_DEU: vText1 = VIG_DE1; vText2 = VIG_DE2; break;
- case FR_FRA: vText1 = VIG_FR1; vText2 = VIG_FR2; break;
- case IT_ITA: vText1 = VIG_IT1; vText2 = VIG_IT2; break;
- case PT_BRA: vText1 = VIG_PT1; vText2 = VIG_PT2; break;
- default: vText1 = VIG_EN1; vText2 = VIG_EN2; break;
- }
- _skyText->displayText(vText1, textBuf1, true, 320, 255);
- _skyText->displayText(vText2, textBuf2, true, 320, 255);
- uint8 *curLine1 = textBuf1 + sizeof(struct dataFileHeader);
- uint8 *curLine2 = textBuf2 + sizeof(struct dataFileHeader);
- uint8 *targetLine = screenData + GAME_SCREEN_WIDTH * 80;
- for (uint8 cnty = 0; cnty < 14; cnty++) {
- for (uint16 cntx = 0; cntx < GAME_SCREEN_WIDTH; cntx++) {
- if (curLine1[cntx])
- targetLine[cntx] = curLine1[cntx];
- if (curLine2[cntx])
- (targetLine + 24 * GAME_SCREEN_WIDTH)[cntx] = curLine2[cntx];
- }
- curLine1 += GAME_SCREEN_WIDTH;
- curLine2 += GAME_SCREEN_WIDTH;
- targetLine += GAME_SCREEN_WIDTH;
- }
- _skyScreen->halvePalette();
- _skyScreen->showScreen(screenData);
- free(textBuf1); free(textBuf2);
-}
-
SkyState::~SkyState() {
delete _skyLogic;
delete _skySound;
delete _skyMusic;
- showQuitMsg();
delete _skyText;
delete _skyMouse;
delete _skyScreen;
- delay(1500);
}
void SkyState::errorString(const char *buf1, char *buf2) {
@@ -140,7 +104,7 @@
loadBase0();
while (1) {
- delay(50);
+ delay(_systemVars.gameSpeed);
if ((_key_pressed == 27) || (_key_pressed == 63)) { // 27 = escape, 63 = F5
_key_pressed = 0;
_skyControl->doControlPanel();
@@ -171,7 +135,13 @@
else
_skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk);
}
+ if (isCDVersion())
+ _systemVars.systemFlags |= SF_ALLOW_SPEECH;
+ else
+ _systemVars.systemFlags |= SF_ALLOW_TEXT;
+
_systemVars.systemFlags |= SF_PLAY_VOCS;
+ _systemVars.gameSpeed = 50;
_skyText = new SkyText(_skyDisk);
_skyMouse = new SkyMouse(_system, _skyDisk);
@@ -302,6 +272,8 @@
break;
case OSystem::EVENT_QUIT:
+ _skyControl->showGameQuitMsg();
+ delay(1500);
_system->quit();
break;
Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- sky.h 22 Jun 2003 21:42:59 -0000 1.34
+++ sky.h 27 Jun 2003 02:54:05 -0000 1.35
@@ -45,10 +45,8 @@
uint32 gameVersion;
uint32 mouseFlag;
uint16 language;
- uint32 currentPalette; // I guess that's for saving.
- /* uint16 sfxVolume;
- uint16 musicVolume;
- uint16 gameSpeed; */
+ uint32 currentPalette;
+ uint16 gameSpeed;
};
class SkyLogic;
@@ -111,7 +109,6 @@
void introFx(uint32 *&cmdPtr);
void introVol(uint32 *&cmdPtr);
-
protected:
void logic_engine();
void delay(uint amount);
@@ -140,8 +137,6 @@
static int CDECL game_thread_proc(void *param);
void shutdown();
-
- void showQuitMsg(void);
};
#endif
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- sound.cpp 22 Jun 2003 21:42:59 -0000 1.16
+++ sound.cpp 27 Jun 2003 02:54:05 -0000 1.17
@@ -1148,6 +1148,8 @@
bool SkySound::startSpeech(uint16 textNum) {
+ if (!(SkyState::_systemVars.systemFlags & SF_ALLOW_SPEECH))
+ return false;
uint16 speechFileNum = _speechConvertTable[textNum >> 12] + (textNum & 0xFFF);
uint8 *speechData = _skyDisk->loadFile(speechFileNum + 50000, NULL);
Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- text.h 9 Jun 2003 02:33:27 -0000 1.20
+++ text.h 27 Jun 2003 02:54:05 -0000 1.21
@@ -45,6 +45,7 @@
void fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY);
void logicCursor(Compact *textCompact, uint16 mouseX, uint16 mouseY);
void changeTextSpriteColour(uint8 *sprData, uint8 newCol);
+ uint32 giveCurrentCharSet(void) { return _curCharSet; };
protected:
bool getTBit();
More information about the Scummvm-git-logs
mailing list