Unified
Split
Showing
with
116 additions
and 155 deletions.
- +3 −0 engines/sludge/backdrop.cpp
- +4 −7 engines/sludge/builtin.cpp
- +7 −0 engines/sludge/graphics.cpp
- +4 −0 engines/sludge/graphics.h
- +3 −7 engines/sludge/loadsave.cpp
- +0 −3 engines/sludge/main_loop.cpp
- +69 −85 engines/sludge/savedata.cpp
- +20 −2 engines/sludge/savedata.h
- +3 −14 engines/sludge/sludger.cpp
- +3 −5 engines/sludge/transition.cpp
- +0 −32 engines/sludge/transition.h
| @@ -422,6 +422,7 @@ void GraphicsManager::saveLightMap(Common::WriteStream *stream) { | ||
| stream->writeByte(0); | ||
| } | ||
| stream->writeByte(_lightMapMode); | ||
| stream->writeByte(_fadeMode); | ||
| } | ||
|
|
||
| bool GraphicsManager::loadLightMap(int ssgVersion, Common::SeekableReadStream *stream) { | ||
| @@ -434,6 +435,8 @@ bool GraphicsManager::loadLightMap(int ssgVersion, Common::SeekableReadStream *s | ||
| _lightMapMode = stream->readByte() % 3; | ||
| } | ||
|
|
||
| _fadeMode = stream->readByte(); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| @@ -65,9 +65,6 @@ extern int numBIFNames, numUserFunc; | ||
| extern Common::String *allUserFunc; | ||
| extern Common::String *allBIFNames; | ||
|
|
||
| extern byte fadeMode; | ||
| extern uint16 saveEncoding; | ||
|
|
||
| int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1, // SAY->MOVEMOUSE | ||
| -1, 0, 0, -1, -1, 1, 1, 1, 1, 4, 1, 1, 2, 1,// FOCUS->REMOVEREGION | ||
| 2, 2, 0, 0, 2, // ANIMATE->SETSCALE | ||
| @@ -2203,7 +2200,7 @@ builtIn(transitionMode) { | ||
| int n; | ||
| if (!getValueType(n, SVT_INT, fun->stack->thisVar)) | ||
| return BR_ERROR; | ||
| fadeMode = n; | ||
| g_sludge->_gfxMan->setFadeMode(n); | ||
| trimStack(fun->stack); | ||
| setVariable(fun->reg, SVT_INT, 1); | ||
| return BR_CONTINUE; | ||
| @@ -2246,7 +2243,7 @@ builtIn(saveCustomData) { | ||
| fatal("First parameter isn't a stack"); | ||
| return BR_ERROR; | ||
| } | ||
| if (!stackToFile(fileName, fun->stack->thisVar)) | ||
| if (!CustomSaveHelper::stackToFile(fileName, fun->stack->thisVar)) | ||
| return BR_ERROR; | ||
| trimStack(fun->stack); | ||
| return BR_CONTINUE; | ||
| @@ -2271,7 +2268,7 @@ builtIn(loadCustomData) { | ||
| fun->reg.varData.theStack->first = NULL; | ||
| fun->reg.varData.theStack->last = NULL; | ||
| fun->reg.varData.theStack->timesUsed = 1; | ||
| if (!fileToStack(newText, fun->reg.varData.theStack)) | ||
| if (!CustomSaveHelper::fileToStack(newText, fun->reg.varData.theStack)) | ||
| return BR_ERROR; | ||
| return BR_CONTINUE; | ||
| } | ||
| @@ -2281,7 +2278,7 @@ builtIn(setCustomEncoding) { | ||
| int n; | ||
| if (!getValueType(n, SVT_INT, fun->stack->thisVar)) | ||
| return BR_ERROR; | ||
| saveEncoding = n; | ||
| CustomSaveHelper::_saveEncoding = n; | ||
| trimStack(fun->stack); | ||
| setVariable(fun->reg, SVT_INT, 1); | ||
| return BR_CONTINUE; | ||
| @@ -87,6 +87,11 @@ void GraphicsManager::init() { | ||
| // Thumbnail | ||
| _thumbWidth = 0; | ||
| _thumbHeight = 0; | ||
|
|
||
| // Transition | ||
| resetRandW(); | ||
| _brightnessLevel = 255; | ||
| _fadeMode = 2; | ||
| } | ||
|
|
||
| void GraphicsManager::kill() { | ||
| @@ -161,6 +166,8 @@ bool GraphicsManager::initGfx() { | ||
| void GraphicsManager::display() { | ||
| g_system->copyRectToScreen((byte *)_renderSurface.getPixels(), _renderSurface.pitch, 0, 0, _renderSurface.w, _renderSurface.h); | ||
| g_system->updateScreen(); | ||
| if (_brightnessLevel < 255) | ||
| fixBrightness(); | ||
| } | ||
|
|
||
| void GraphicsManager::clear() { | ||
| @@ -172,6 +172,9 @@ class GraphicsManager { | ||
|
|
||
| // Transition | ||
| void setBrightnessLevel(int brightnessLevel); | ||
| void setFadeMode(int fadeMode) { _fadeMode = fadeMode; }; | ||
| void fixBrightness(); | ||
| void resetRandW(); | ||
|
|
||
| private: | ||
| SludgeEngine *_vm; | ||
| @@ -230,6 +233,7 @@ class GraphicsManager { | ||
|
|
||
| // Transition | ||
| byte _brightnessLevel; | ||
| byte _fadeMode; | ||
| }; | ||
|
|
||
| } // End of namespace Sludge | ||
| @@ -37,6 +37,7 @@ | ||
| #include "sludge/objtypes.h" | ||
| #include "sludge/people.h" | ||
| #include "sludge/region.h" | ||
| #include "sludge/savedata.h" | ||
| #include "sludge/sludge.h" | ||
| #include "sludge/sludger.h" | ||
| #include "sludge/sound.h" | ||
| @@ -60,9 +61,7 @@ extern int numGlobals; // In sludger.cpp | ||
| extern Variable *globalVars; // In sludger.cpp | ||
| extern Floor *currentFloor; // In floor.cpp | ||
| extern FILETIME fileTime; // In sludger.cpp | ||
| extern byte fadeMode; // In transition.cpp | ||
| extern bool allowAnyFilename; | ||
| extern uint16 saveEncoding; // in savedata.cpp | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| // Globals (so we know what's saved already and what's a reference | ||
| @@ -403,13 +402,11 @@ bool saveGame(const Common::String &fname) { | ||
| g_sludge->_gfxMan->saveZBuffer(fp); | ||
| g_sludge->_gfxMan->saveLightMap(fp); | ||
|
|
||
| fp->writeByte(fadeMode); | ||
|
|
||
| g_sludge->_speechMan->save(fp); | ||
| saveStatusBars(fp); | ||
| g_sludge->_soundMan->saveSounds(fp); | ||
|
|
||
| fp->writeUint16BE(saveEncoding); | ||
| fp->writeUint16BE(CustomSaveHelper::_saveEncoding); | ||
|
|
||
| blur_saveSettings(fp); | ||
|
|
||
| @@ -539,12 +536,11 @@ bool loadGame(const Common::String &fname) { | ||
| return false; | ||
| } | ||
|
|
||
| fadeMode = fp->readByte(); | ||
| g_sludge->_speechMan->load(fp); | ||
| loadStatusBars(fp); | ||
| g_sludge->_soundMan->loadSounds(fp); | ||
|
|
||
| saveEncoding = fp->readUint16BE(); | ||
| CustomSaveHelper::_saveEncoding = fp->readUint16BE(); | ||
|
|
||
| if (ssgVersion >= VERSION(1, 6)) { | ||
| if (ssgVersion < VERSION(2, 0)) { | ||
| @@ -39,15 +39,12 @@ | ||
| #include "sludge/sludge.h" | ||
| #include "sludge/sludger.h" | ||
| #include "sludge/speech.h" | ||
| #include "sludge/transition.h" | ||
| #include "sludge/timing.h" | ||
|
|
||
| namespace Sludge { | ||
|
|
||
| extern VariableStack *noStack; | ||
|
|
||
| int dialogValue = 0; | ||
|
|
||
| int main_loop(Common::String filename) { | ||
|
|
||
| if (!initSludge(filename)) { | ||
Oops, something went wrong.