Initial commit
This commit is contained in:
3
engines/lilliput/configure.engine
Normal file
3
engines/lilliput/configure.engine
Normal file
@@ -0,0 +1,3 @@
|
||||
# This file is included from the main "configure" script
|
||||
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
|
||||
add_engine lilliput "Lilliput" no "" "" "" "midi"
|
||||
33
engines/lilliput/console.cpp
Normal file
33
engines/lilliput/console.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lilliput/console.h"
|
||||
#include "lilliput/lilliput.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
LilliputConsole::LilliputConsole(LilliputEngine *vm) : GUI::Debugger(), _vm(vm) {
|
||||
}
|
||||
|
||||
LilliputConsole::~LilliputConsole() {
|
||||
}
|
||||
|
||||
} // End of namespace Lilliput
|
||||
48
engines/lilliput/console.h
Normal file
48
engines/lilliput/console.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LILLIPUT_CONSOLE_H
|
||||
#define LILLIPUT_CONSOLE_H
|
||||
|
||||
#include "gui/debugger.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
class LilliputEngine;
|
||||
|
||||
class LilliputConsole : public GUI::Debugger {
|
||||
public:
|
||||
LilliputConsole(LilliputEngine *vm);
|
||||
~LilliputConsole(void) override;
|
||||
|
||||
private:
|
||||
LilliputEngine *_vm;
|
||||
bool Cmd_listScreens(int argc, const char **argv);
|
||||
bool Cmd_listObjects(int argc, const char **argv);
|
||||
bool Cmd_getObject(int argc, const char **argv);
|
||||
bool Cmd_getAllObjects(int argc, const char **argv);
|
||||
bool Cmd_gotoScreen(int argc, const char **argv);
|
||||
bool Cmd_boundaries(int argc, const char **argv);
|
||||
};
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
#endif
|
||||
3
engines/lilliput/credits.pl
Normal file
3
engines/lilliput/credits.pl
Normal file
@@ -0,0 +1,3 @@
|
||||
begin_section("Lilliput");
|
||||
add_person("Arnaud Boutonné", "Strangerke", "");
|
||||
end_section();
|
||||
141
engines/lilliput/detection.cpp
Normal file
141
engines/lilliput/detection.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "base/plugins.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
#include "lilliput/detection.h"
|
||||
#include "lilliput/lilliput.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
static const PlainGameDescriptor lilliputGames[] = {
|
||||
// Games
|
||||
{"robin", "The Adventures of Robin Hood"},
|
||||
{"rome", "Rome: Pathway to Power"},
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
static const DebugChannelDef debugFlagList[] = {
|
||||
{Lilliput::kDebugEngine, "Engine", "Engine debug level"},
|
||||
{Lilliput::kDebugScript, "Script", "Script debug level"},
|
||||
{Lilliput::kDebugSound, "Sound", "Sound debug level"},
|
||||
{Lilliput::kDebugEngineTBC, "EngineTBC", "Engine debug level"},
|
||||
{Lilliput::kDebugScriptTBC, "ScriptTBC", "Script debug level"},
|
||||
DEBUG_CHANNEL_END
|
||||
};
|
||||
|
||||
static const LilliputGameDescription gameDescriptions[] = {
|
||||
|
||||
// Robin Hood English
|
||||
{
|
||||
{
|
||||
"robin", nullptr,
|
||||
AD_ENTRY2s("erules.prg", "92aaf84693a8948497ad57864fa31c2a", 71010,
|
||||
"isomap.dta", "bad97eae03a4db3e99565e39b0b3c06a", 16384),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformDOS,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO0()
|
||||
},
|
||||
kGameTypeRobin
|
||||
},
|
||||
// Robin Hood French
|
||||
{
|
||||
{
|
||||
"robin", nullptr,
|
||||
AD_ENTRY2s("frules.prg", "cf076c5ebfe8b3571e74a6a46d79426f", 76660,
|
||||
"isomap.dta", "bad97eae03a4db3e99565e39b0b3c06a", 16384),
|
||||
Common::FR_FRA,
|
||||
Common::kPlatformDOS,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO0()
|
||||
},
|
||||
kGameTypeRobin
|
||||
},
|
||||
// Robin Hood German
|
||||
{
|
||||
{
|
||||
"robin", nullptr,
|
||||
AD_ENTRY2s("grules.prg", "b53b7353dc1e841b206a64851e7bc58c", 78050,
|
||||
"isomap.dta", "bad97eae03a4db3e99565e39b0b3c06a", 16384),
|
||||
Common::DE_DEU,
|
||||
Common::kPlatformDOS,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO0()
|
||||
},
|
||||
kGameTypeRobin
|
||||
},
|
||||
// Robin Hood Italian
|
||||
{
|
||||
{
|
||||
"robin", nullptr,
|
||||
AD_ENTRY2s("irules.prg", "4d69ed3cda1e1d73585905517ea705d1", 75654,
|
||||
"isomap.dta", "bad97eae03a4db3e99565e39b0b3c06a", 16384),
|
||||
Common::IT_ITA,
|
||||
Common::kPlatformDOS,
|
||||
ADGF_UNSTABLE,
|
||||
GUIO0()
|
||||
},
|
||||
kGameTypeRobin
|
||||
},
|
||||
// Rome Demo
|
||||
{
|
||||
{
|
||||
"rome", "Demo",
|
||||
AD_ENTRY2s("rules.prg", "bdf4173fe294cae627903d9731549cac", 746,
|
||||
"isomap.dta", "48eaaa382c4cb7a5c200ffc48c9bab1c", 16384),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformDOS,
|
||||
ADGF_UNSTABLE | ADGF_DEMO,
|
||||
GUIO0()
|
||||
},
|
||||
kGameTypeRome
|
||||
},
|
||||
{AD_TABLE_END_MARKER, kGameTypeNone}
|
||||
};
|
||||
|
||||
class LilliputMetaEngineDetection : public AdvancedMetaEngineDetection<LilliputGameDescription> {
|
||||
public:
|
||||
LilliputMetaEngineDetection() : AdvancedMetaEngineDetection(gameDescriptions, lilliputGames) {
|
||||
}
|
||||
|
||||
const char *getName() const override {
|
||||
return "lilliput";
|
||||
}
|
||||
|
||||
const char *getEngineName() const override {
|
||||
return "Lilliput";
|
||||
}
|
||||
|
||||
const char *getOriginalCopyright() const override {
|
||||
return "Lilliput (C) S.L.Grand, Brainware, 1991-1992";
|
||||
}
|
||||
|
||||
const DebugChannelDef *getDebugChannels() const override {
|
||||
return debugFlagList;
|
||||
}
|
||||
};
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
REGISTER_PLUGIN_STATIC(LILLIPUT_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, Lilliput::LilliputMetaEngineDetection);
|
||||
44
engines/lilliput/detection.h
Normal file
44
engines/lilliput/detection.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LILLIPUT_DETECTION_H
|
||||
#define LILLIPUT_DETECTION_H
|
||||
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
enum GameType {
|
||||
kGameTypeNone = 0,
|
||||
kGameTypeRobin,
|
||||
kGameTypeRome
|
||||
};
|
||||
|
||||
struct LilliputGameDescription {
|
||||
AD_GAME_DESCRIPTION_HELPERS(desc);
|
||||
|
||||
ADGameDescription desc;
|
||||
GameType gameType;
|
||||
};
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
#endif // LILLIPUT_DETECTION_H
|
||||
2846
engines/lilliput/lilliput.cpp
Normal file
2846
engines/lilliput/lilliput.cpp
Normal file
File diff suppressed because it is too large
Load Diff
374
engines/lilliput/lilliput.h
Normal file
374
engines/lilliput/lilliput.h
Normal file
@@ -0,0 +1,374 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LILLIPUT_LILLIPUT_H
|
||||
#define LILLIPUT_LILLIPUT_H
|
||||
|
||||
#include "lilliput/console.h"
|
||||
#include "lilliput/script.h"
|
||||
#include "lilliput/sound.h"
|
||||
#include "lilliput/stream.h"
|
||||
#include "lilliput/detection.h"
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/events.h"
|
||||
|
||||
#include "engines/engine.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Common {
|
||||
class RandomSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the namespace of the Lilliput engine.
|
||||
*
|
||||
* Status of this engine:
|
||||
* - Adventures of Robin Hood is mostly working without sound
|
||||
*
|
||||
* Games using this engine:
|
||||
* - Adventures of Robin Hood
|
||||
* - Rome: Pathway to Rome
|
||||
*/
|
||||
namespace Lilliput {
|
||||
|
||||
static const int kSavegameVersion = 1;
|
||||
|
||||
enum LilliputDebugChannels {
|
||||
kDebugEngine = 1,
|
||||
kDebugScript,
|
||||
kDebugSound,
|
||||
kDebugEngineTBC,
|
||||
kDebugScriptTBC,
|
||||
};
|
||||
|
||||
enum InterfaceHotspotStatus {
|
||||
kHotspotOff = 0,
|
||||
kHotspotDisabled = 1,
|
||||
kHotspotEnabled = 2,
|
||||
kHotspotSelected = 3
|
||||
};
|
||||
|
||||
#define kSeqNone 0
|
||||
#define kSeqNoInc 1 << 0
|
||||
#define kSeqRepeat 1 << 1
|
||||
|
||||
struct LilliputGameDescription;
|
||||
|
||||
struct SmallAnim {
|
||||
bool _active;
|
||||
Common::Point _pos;
|
||||
int16 _frameIndex[8];
|
||||
};
|
||||
|
||||
class LilliputEngine : public Engine {
|
||||
public:
|
||||
LilliputEngine(OSystem *syst, const LilliputGameDescription *gd);
|
||||
~LilliputEngine() override;
|
||||
|
||||
OSystem *_system;
|
||||
|
||||
Common::RandomSource *_rnd;
|
||||
LilliputScript *_scriptHandler;
|
||||
LilliputSound *_soundHandler;
|
||||
Graphics::Surface *_mainSurface;
|
||||
|
||||
SmallAnim _smallAnims[4];
|
||||
int _smallAnimsFrameIndex;
|
||||
|
||||
byte _handleOpcodeReturnCode;
|
||||
byte _keyDelay;
|
||||
byte _lastAnimationTick;
|
||||
byte _animationTick;
|
||||
Common::Point _nextDisplayCharacterPos;
|
||||
byte _int8Timer;
|
||||
Common::Event _lastKeyPressed;
|
||||
Common::EventType _lastEventType;
|
||||
byte _keyboard_nextIndex;
|
||||
byte _keyboard_oldIndex;
|
||||
Common::Event _keyboard_buffer[8];
|
||||
byte _byte12A05;
|
||||
bool _refreshScreenFlag;
|
||||
byte _byte16552;
|
||||
int8 _lastInterfaceHotspotIndex;
|
||||
byte _lastInterfaceHotspotButton; // Unused: set by 2 functions, but never used elsewhere
|
||||
byte _debugFlag; // Mostly useless, as the associated functions are empty
|
||||
byte _debugFlag2; // Unused byte, set by an opcode
|
||||
|
||||
byte _codeEntered[3];
|
||||
char _homeInDirLikelyhood[4];
|
||||
byte *_bufferIsoMap;
|
||||
byte *_bufferCubegfx;
|
||||
byte *_bufferMen;
|
||||
byte *_bufferMen2;
|
||||
byte *_bufferIsoChars;
|
||||
byte *_bufferIdeogram;
|
||||
byte *_normalCursor;
|
||||
byte *_greenCursor;
|
||||
byte _curPalette[768];
|
||||
byte _displayStringBuf[160];
|
||||
|
||||
bool _saveFlag;
|
||||
bool _displayMap;
|
||||
|
||||
int _word10800_ERULES;
|
||||
byte _numCharacters;
|
||||
Common::Point _currentScriptCharacterPos;
|
||||
int _nextCharacterIndex;
|
||||
int8 _waitingSignal;
|
||||
int8 _waitingSignalCharacterId;
|
||||
uint16 _newModesEvaluatedNumber;
|
||||
Common::Point _savedSurfaceUnderMousePos;
|
||||
bool _displayGreenHand;
|
||||
bool _isCursorGreenHand;
|
||||
int _currentDisplayCharacter;
|
||||
int _displayStringIndex;
|
||||
int _signalTimer;
|
||||
Common::Point _curCharacterTilePos;
|
||||
|
||||
int16 _mapSavedPixelIndex[40];
|
||||
byte _mapSavedPixel[40];
|
||||
int16 _characterSignals[40];
|
||||
int16 _signalArr[40];
|
||||
int16 _signalArray[30];
|
||||
|
||||
byte *_sequencesArr;
|
||||
int16 _currentScriptCharacter;
|
||||
Common::Point _characterPos[40];
|
||||
int8 _characterPosAltitude[40];
|
||||
int16 _characterFrameArray[40];
|
||||
int8 _characterCarried[40];
|
||||
int8 _characterBehindDist[40];
|
||||
byte _characterAboveDist[40];
|
||||
byte _spriteSizeArray[40];
|
||||
byte _characterDirectionArray[40];
|
||||
byte _characterMobility[40];
|
||||
byte _characterTypes[40];
|
||||
byte _characterBehaviour[40];
|
||||
Common::Point _characterHomePos[40];
|
||||
byte _characterVariables[1400 + 3120];
|
||||
byte *_currentCharacterAttributes;
|
||||
byte _poseArray[40 * 32];
|
||||
int *_packedStringIndex;
|
||||
int _packedStringNumb;
|
||||
char *_packedStrings;
|
||||
byte *_initScript;
|
||||
int _initScriptSize;
|
||||
byte *_menuScript;
|
||||
int _menuScriptSize;
|
||||
int *_arrayGameScriptIndex;
|
||||
int _gameScriptIndexSize;
|
||||
byte *_arrayGameScripts;
|
||||
byte _cubeFlags[60];
|
||||
byte _listNumb;
|
||||
int16 *_listIndex;
|
||||
byte *_listArr;
|
||||
int16 _rectNumb;
|
||||
Common::Rect _enclosureRect[40];
|
||||
Common::Point _keyPos[40];
|
||||
Common::Point _portalPos[40];
|
||||
int _interfaceHotspotNumb;
|
||||
byte _interfaceTwoStepAction[20];
|
||||
Common::Point _interfaceHotspots[20];
|
||||
Common::KeyCode _keyboardMapping[20];
|
||||
Common::Point _characterTargetPos[40];
|
||||
byte _savedSurfaceUnderMouse[16 * 16];
|
||||
byte _charactersToDisplay[40];
|
||||
Common::Point _characterRelativePos[40];
|
||||
Common::Point _characterDisplay[40];
|
||||
int8 _characterMagicPuffFrame[40];
|
||||
Common::Point _characterSubTargetPos[40];
|
||||
byte _specialCubes[40];
|
||||
byte _doorEntranceMask[4];
|
||||
byte _doorExitMask[4];
|
||||
byte _savedSurfaceGameArea1[176 * 256]; // 45056
|
||||
byte _savedSurfaceGameArea2[176 * 256]; // 45056
|
||||
byte _savedSurfaceGameArea3[176 * 256]; // 45056
|
||||
byte _savedSurfaceSpeech[16 * 252];
|
||||
|
||||
const LilliputGameDescription *_gameDescription;
|
||||
uint32 getFeatures() const;
|
||||
const char *getGameId() const;
|
||||
|
||||
void newInt8();
|
||||
void update();
|
||||
|
||||
void display16x16IndexedBuf(byte *buf, int index, Common::Point pos, bool transparent = true, bool updateScreen = true);
|
||||
void display16x16Buf(byte *buf, Common::Point pos, bool transparent = true, bool updateScreen = true);
|
||||
void fill16x16Rect(byte col, Common::Point pos);
|
||||
void saveSurfaceGameArea();
|
||||
void saveSurfaceSpeech();
|
||||
void displayInterfaceHotspots();
|
||||
void displayLandscape();
|
||||
void displaySpeechBubble();
|
||||
void displaySpeech(byte *buf);
|
||||
void initGameAreaDisplay();
|
||||
void displayIsometricBlock(byte *buf, int var1, int posX, int posY, int var3);
|
||||
void displayGameArea();
|
||||
void prepareGameArea();
|
||||
void displayRefreshScreen();
|
||||
void restoreSurfaceSpeech();
|
||||
void displayCharacterStatBar(int8 type, int16 averagePosX, int8 score, int16 posY);
|
||||
void displayCharacter(int index, Common::Point pos, int flags);
|
||||
void displayString(byte *buf, Common::Point pos);
|
||||
void displayChar(int index, int var1);
|
||||
void displaySmallAnims();
|
||||
void displaySmallIndexedAnim(byte index, byte subIndex);
|
||||
|
||||
void unselectInterfaceHotspots();
|
||||
void startNavigateFromMap();
|
||||
void resetSmallAnims();
|
||||
void paletteFadeOut();
|
||||
void paletteFadeIn();
|
||||
|
||||
void sortCharacters();
|
||||
void scrollToViewportCharacterTarget();
|
||||
void viewportScrollTo(Common::Point goalPos);
|
||||
void checkSpeechClosing();
|
||||
void updateCharPosSequence();
|
||||
void evaluateDirections(int index);
|
||||
byte homeInAvoidDeadEnds(int indexb, int indexs);
|
||||
void signalDispatcher(byte type, byte index, int var4);
|
||||
void sendMessageToCharacter(byte index, int var4);
|
||||
int16 checkEnclosure(Common::Point pos);
|
||||
int16 checkOuterEnclosure(Common::Point pos);
|
||||
byte sequenceSetMobility(int index, Common::Point var1);
|
||||
byte sequenceEnd(int index);
|
||||
void homeInPathFinding(int index);
|
||||
|
||||
void renderCharacters(byte *buf, Common::Point pos);
|
||||
|
||||
void checkNumericCode();
|
||||
void keyboard_handleInterfaceShortcuts(bool &forceReturnFl);
|
||||
byte sequenceCharacterHomeIn(int index, Common::Point param1);
|
||||
byte getDirection(Common::Point param1, Common::Point param2);
|
||||
void addCharToBuf(byte character);
|
||||
void numberToString(int param1);
|
||||
void handleCharacterTimers();
|
||||
byte sequenceMoveCharacter(int idx, int moveType, int poseType);
|
||||
void setCharacterPose(int idx, int poseIdx);
|
||||
void checkSpecialCubes();
|
||||
void checkInteractions();
|
||||
byte sequenceSetCharacterDirection(int index, int direction, int poseType);
|
||||
void handleSignals();
|
||||
void checkInterfaceActivationDelay();
|
||||
int16 checkObstacle(int x1, int y1, int x2, int y2);
|
||||
void displayCharactersOnMap();
|
||||
void restoreMapPoints();
|
||||
void displayHeroismIndicator();
|
||||
void handleGameMouseClick();
|
||||
void handleInterfaceHotspot(byte index, byte button);
|
||||
void checkInterfaceHotspots(bool &forceReturnFl);
|
||||
bool isMouseOverHotspot(Common::Point mousePos, Common::Point hotspotPos);
|
||||
void checkClickOnCharacter(Common::Point pos, bool &forceReturnFl);
|
||||
void checkClickOnGameArea(Common::Point pos);
|
||||
void displaySpeechBubbleTail(Common::Point displayPos);
|
||||
void displaySpeechBubbleTailLine(Common::Point pos, int var2);
|
||||
void displaySpeechLine(int vgaIndex, byte *srcBuf, int &bufIndex);
|
||||
void checkMapClosing(bool &forceReturnFl);
|
||||
void turnCharacter1(int index);
|
||||
void turnCharacter2(int index);
|
||||
void moveCharacterUp1(int index);
|
||||
void moveCharacterUp2(int index);
|
||||
void moveCharacterDown1(int index);
|
||||
void moveCharacterDown2(int index);
|
||||
void moveCharacterSpeed2(int index);
|
||||
void moveCharacterSpeed4(int index);
|
||||
void moveCharacterBack2(int index);
|
||||
void moveCharacterSpeed3(int index);
|
||||
void moveCharacterForward(int index, int16 speed);
|
||||
void checkCollision(int index, Common::Point pos, int direction);
|
||||
byte sequenceSeekMovingCharacter(int index, Common::Point var1);
|
||||
byte sequenceSound(int index, Common::Point var1);
|
||||
byte sequenceRepeat(int index, Common::Point var1, int tmpVal);
|
||||
void homeInChooseDirection(int index);
|
||||
|
||||
void initGame(const LilliputGameDescription *gd);
|
||||
byte *loadVGA(const Common::Path &filename, int fileSize, bool loadPal);
|
||||
byte *loadRaw(const Common::Path &filename, int filesize);
|
||||
void loadRules();
|
||||
|
||||
void displayVGAFile(const Common::Path &fileName);
|
||||
void initPalette();
|
||||
void fixPaletteEntries(uint8 *palette, int num);
|
||||
|
||||
GameType getGameType() const;
|
||||
Common::Platform getPlatform() const;
|
||||
|
||||
bool hasFeature(EngineFeature f) const override;
|
||||
const char *getCopyrightString() const;
|
||||
|
||||
Common::String getSavegameFilename(int slot);
|
||||
void syncSoundSettings() override;
|
||||
|
||||
Common::Point _mousePos;
|
||||
Common::Point _oldMousePos;
|
||||
Common::Point _mouseDisplayPos;
|
||||
int _mouseButton;
|
||||
bool _mouseClicked;
|
||||
Common::EventType _mousePreviousEventType;
|
||||
Common::Point _savedMousePosDivided;
|
||||
int _skipDisplayFlag1;
|
||||
int _skipDisplayFlag2;
|
||||
|
||||
byte _actionType;
|
||||
bool _delayedReactivationAction;
|
||||
int8 _selectedCharacterId;
|
||||
byte _numCharactersToDisplay;
|
||||
int16 _host;
|
||||
bool _shouldQuit;
|
||||
|
||||
void pollEvent();
|
||||
void setCurrentCharacter(int index);
|
||||
void unselectInterfaceButton();
|
||||
void moveCharacters();
|
||||
void setNextDisplayCharacter(int var1);
|
||||
void handleGameScripts();
|
||||
|
||||
// Added by Strangerke
|
||||
byte *getCharacterAttributesPtr(int16 index);
|
||||
|
||||
// Temporary stubs
|
||||
Common::Event _keyboard_getch();
|
||||
bool _keyboard_checkKeyboard();
|
||||
void _keyboard_resetKeyboardBuffer();
|
||||
|
||||
protected:
|
||||
Common::EventManager *_eventMan;
|
||||
int _lastTime;
|
||||
|
||||
// Engine APIs
|
||||
Common::Error run() override;
|
||||
void handleMenu();
|
||||
|
||||
private:
|
||||
static LilliputEngine *s_Engine;
|
||||
|
||||
GameType _gameType;
|
||||
Common::Platform _platform;
|
||||
|
||||
void initialize();
|
||||
};
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
#endif
|
||||
205
engines/lilliput/metaengine.cpp
Normal file
205
engines/lilliput/metaengine.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/advancedDetector.h"
|
||||
#include "common/system.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "graphics/thumbnail.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "lilliput/lilliput.h"
|
||||
#include "lilliput/detection.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
uint32 LilliputEngine::getFeatures() const {
|
||||
return _gameDescription->desc.flags;
|
||||
}
|
||||
|
||||
const char *LilliputEngine::getGameId() const {
|
||||
return _gameDescription->desc.gameId;
|
||||
}
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
class LilliputMetaEngine : public AdvancedMetaEngine<LilliputGameDescription> {
|
||||
public:
|
||||
const char *getName() const override {
|
||||
return "lilliput";
|
||||
}
|
||||
|
||||
Common::Error createInstance(OSystem *syst, Engine **engine, const LilliputGameDescription *gd) const override;
|
||||
bool hasFeature(MetaEngineFeature f) const override;
|
||||
|
||||
int getMaximumSaveSlot() const override;
|
||||
SaveStateList listSaves(const char *target) const override;
|
||||
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
|
||||
bool removeSaveState(const char *target, int slot) const override;
|
||||
Common::String getSavegameFile(int saveGameIdx, const char *target) const override {
|
||||
if (!target)
|
||||
target = getName();
|
||||
if (saveGameIdx == kSavegameFilePattern)
|
||||
return Common::String::format("%s-##.SAV", target);
|
||||
else
|
||||
return Common::String::format("%s-%02d.SAV", target, saveGameIdx);
|
||||
}
|
||||
};
|
||||
|
||||
Common::Error LilliputMetaEngine::createInstance(OSystem *syst, Engine **engine, const LilliputGameDescription *gd) const {
|
||||
*engine = new LilliputEngine(syst,gd);
|
||||
((LilliputEngine *)*engine)->initGame(gd);
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool LilliputMetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||
return
|
||||
(f == kSupportsListSaves) ||
|
||||
(f == kSupportsLoadingDuringStartup) ||
|
||||
(f == kSupportsDeleteSave) ||
|
||||
(f == kSavesSupportMetaInfo) ||
|
||||
(f == kSavesSupportThumbnail) ||
|
||||
(f == kSavesSupportCreationDate);
|
||||
}
|
||||
|
||||
int LilliputMetaEngine::getMaximumSaveSlot() const {
|
||||
return 99;
|
||||
}
|
||||
|
||||
SaveStateList LilliputMetaEngine::listSaves(const char *target) const {
|
||||
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
|
||||
Common::StringArray filenames;
|
||||
Common::String pattern = target;
|
||||
pattern += "-##.SAV";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
|
||||
SaveStateList saveList;
|
||||
char slot[3];
|
||||
int slotNum;
|
||||
|
||||
for (const auto &filename : filenames) {
|
||||
slot[0] = filename.c_str()[filename.size() - 6];
|
||||
slot[1] = filename.c_str()[filename.size() - 5];
|
||||
slot[2] = '\0';
|
||||
// Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot
|
||||
slotNum = atoi(slot);
|
||||
if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
|
||||
Common::InSaveFile *file = saveFileMan->openForLoading(filename);
|
||||
if (file) {
|
||||
int saveVersion = file->readByte();
|
||||
|
||||
if (saveVersion != kSavegameVersion) {
|
||||
warning("Savegame of incompatible version");
|
||||
delete file;
|
||||
continue;
|
||||
}
|
||||
|
||||
// read name
|
||||
uint16 nameSize = file->readUint16BE();
|
||||
if (nameSize >= 255) {
|
||||
delete file;
|
||||
continue;
|
||||
}
|
||||
char name[256];
|
||||
file->read(name, nameSize);
|
||||
name[nameSize] = 0;
|
||||
|
||||
saveList.push_back(SaveStateDescriptor(this, slotNum, name));
|
||||
delete file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
|
||||
return saveList;
|
||||
}
|
||||
|
||||
SaveStateDescriptor LilliputMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
||||
Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(getSavegameFile(slot, target));
|
||||
|
||||
if (file) {
|
||||
int saveVersion = file->readByte();
|
||||
|
||||
if (saveVersion != kSavegameVersion) {
|
||||
warning("Savegame of incompatible version");
|
||||
delete file;
|
||||
return SaveStateDescriptor();
|
||||
}
|
||||
|
||||
uint32 saveNameLength = file->readUint16BE();
|
||||
Common::String saveName;
|
||||
for (uint32 i = 0; i < saveNameLength; ++i) {
|
||||
char curChr = file->readByte();
|
||||
saveName += curChr;
|
||||
}
|
||||
|
||||
SaveStateDescriptor desc(this, slot, saveName);
|
||||
|
||||
Graphics::Surface *thumbnail;
|
||||
if (!Graphics::loadThumbnail(*file, thumbnail)) {
|
||||
delete file;
|
||||
return SaveStateDescriptor();
|
||||
}
|
||||
desc.setThumbnail(thumbnail);
|
||||
|
||||
uint32 saveDate = file->readUint32BE();
|
||||
uint16 saveTime = file->readUint16BE();
|
||||
|
||||
int day = (saveDate >> 24) & 0xFF;
|
||||
int month = (saveDate >> 16) & 0xFF;
|
||||
int year = saveDate & 0xFFFF;
|
||||
|
||||
desc.setSaveDate(year, month, day);
|
||||
|
||||
int hour = (saveTime >> 8) & 0xFF;
|
||||
int minutes = saveTime & 0xFF;
|
||||
|
||||
desc.setSaveTime(hour, minutes);
|
||||
|
||||
delete file;
|
||||
return desc;
|
||||
}
|
||||
return SaveStateDescriptor();
|
||||
}
|
||||
|
||||
bool LilliputMetaEngine::removeSaveState(const char *target, int slot) const {
|
||||
return g_system->getSavefileManager()->removeSavefile(getSavegameFile(slot, target));
|
||||
}
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(LILLIPUT)
|
||||
REGISTER_PLUGIN_DYNAMIC(LILLIPUT, PLUGIN_TYPE_ENGINE, Lilliput::LilliputMetaEngine);
|
||||
#else
|
||||
REGISTER_PLUGIN_STATIC(LILLIPUT, PLUGIN_TYPE_ENGINE, Lilliput::LilliputMetaEngine);
|
||||
#endif
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
void LilliputEngine::initGame(const LilliputGameDescription *gd) {
|
||||
_gameType = gd->gameType;
|
||||
_platform = gd->desc.platform;
|
||||
}
|
||||
|
||||
} // End of namespace Lilliput
|
||||
23
engines/lilliput/module.mk
Normal file
23
engines/lilliput/module.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
MODULE := engines/lilliput
|
||||
|
||||
MODULE_OBJS = \
|
||||
console.o \
|
||||
lilliput.o \
|
||||
metaengine.o \
|
||||
script.o \
|
||||
sound.o \
|
||||
stream.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
engines/lilliput
|
||||
|
||||
# This module can be built as a plugin
|
||||
ifeq ($(ENABLE_LILLIPUT), DYNAMIC_PLUGIN)
|
||||
PLUGIN := 1
|
||||
endif
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/rules.mk
|
||||
|
||||
# Detection objects
|
||||
DETECT_OBJS += $(MODULE)/detection.o
|
||||
3353
engines/lilliput/script.cpp
Normal file
3353
engines/lilliput/script.cpp
Normal file
File diff suppressed because it is too large
Load Diff
315
engines/lilliput/script.h
Normal file
315
engines/lilliput/script.h
Normal file
@@ -0,0 +1,315 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LILLIPUT_SCRIPT_H
|
||||
#define LILLIPUT_SCRIPT_H
|
||||
|
||||
#include "common/memstream.h"
|
||||
#include "common/stack.h"
|
||||
#include "common/random.h"
|
||||
#include "common/rect.h"
|
||||
|
||||
#include "lilliput/stream.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
class LilliputEngine;
|
||||
|
||||
enum kActionType {
|
||||
kActionNone = 0,
|
||||
kButtonPressed = 1,
|
||||
kButtonReleased = 2,
|
||||
kActionTalk = 3,
|
||||
kActionGoto = 4,
|
||||
kCubeSelected = 5,
|
||||
kCodeEntered = 6
|
||||
};
|
||||
|
||||
enum kValueType {
|
||||
kNone,
|
||||
kImmediateValue,
|
||||
kCompareOperation,
|
||||
kComputeOperation,
|
||||
kGetValue1,
|
||||
kgetPosFromScript
|
||||
};
|
||||
|
||||
struct OpCode {
|
||||
const char* _opName;
|
||||
int _numArgs;
|
||||
kValueType _arg1;
|
||||
kValueType _arg2;
|
||||
kValueType _arg3;
|
||||
kValueType _arg4;
|
||||
kValueType _arg5;
|
||||
};
|
||||
|
||||
struct EvaluatedMode {
|
||||
int _mode;
|
||||
int _priority;
|
||||
};
|
||||
|
||||
class LilliputScript {
|
||||
public:
|
||||
byte _heroismLevel;
|
||||
byte _speechTimer;
|
||||
|
||||
byte _characterScriptEnabled[40];
|
||||
int8 _interfaceHotspotStatus[20];
|
||||
Common::Point _characterTilePos[40];
|
||||
int8 _characterNextSequence[40];
|
||||
int8 _characterPose[40];
|
||||
byte _interfaceButtonActivationDelay[20];
|
||||
byte _array122C1[40];
|
||||
byte _characterSeek[40];
|
||||
int16 _interactions[40 * 40];
|
||||
|
||||
byte *_barAttrPtr;
|
||||
|
||||
Common::Point _viewportPos;
|
||||
int16 _viewportCharacterTarget;
|
||||
int16 _talkingCharacter;
|
||||
int _heroismBarX;
|
||||
int _heroismBarBottomY;
|
||||
|
||||
Common::Point _sequenceArr[640];
|
||||
byte _characterMapPixelColor[40];
|
||||
int8 _characterLastSequence[40];
|
||||
EvaluatedMode _newEvaluatedModes[32];
|
||||
|
||||
LilliputScript(LilliputEngine *vm);
|
||||
~LilliputScript();
|
||||
|
||||
void disasmScript(ScriptStream script);
|
||||
void listAllTexts();
|
||||
static Common::String getArgumentString(kValueType type, ScriptStream& script);
|
||||
void runScript(ScriptStream script);
|
||||
void runMenuScript(ScriptStream script);
|
||||
private:
|
||||
LilliputEngine *_vm;
|
||||
|
||||
ScriptStream *_currScript;
|
||||
Common::Stack<ScriptStream *> _scriptStack;
|
||||
|
||||
byte _byte16F05_ScriptHandler;
|
||||
byte _cubeSet;
|
||||
byte _lastRandomValue;
|
||||
byte _scriptForVal;
|
||||
byte _textVarNumber;
|
||||
byte _speechDisplaySpeed;
|
||||
|
||||
int16 _word16F00_characterId;
|
||||
int _currentSpeechId;
|
||||
int _word18821;
|
||||
int _monitoredCharacter;
|
||||
Common::Point _word1825E;
|
||||
|
||||
char _monitoredAttr[4];
|
||||
|
||||
int handleOpcode(ScriptStream *script);
|
||||
byte handleOpcodeType1(int curWord);
|
||||
void handleOpcodeType2(int curWord);
|
||||
|
||||
void enableCharacterScript(byte index, byte var1, byte *curBufPtr);
|
||||
void skipOpcodes(int var1);
|
||||
void copySequence(int index, byte *buf);
|
||||
void setSequence(int charIdx, int8 seqIdx);
|
||||
void checkSpeechAllowed(bool &forceReturnFl);
|
||||
void decodePackedText(char *buf);
|
||||
void startSpeech(int var);
|
||||
void displayNumber(byte var1, Common::Point pos);
|
||||
byte *getMapPtr(Common::Point val);
|
||||
byte *getCurrentCharacterVarFromScript();
|
||||
void sendSignal(int16 var1, byte var2h, byte characterId, int16 var4);
|
||||
void getSpeechVariant(int speechIndex, int speechVariant);
|
||||
void showSpeech();
|
||||
void formatSpeechString();
|
||||
Common::Point getCharacterTilePos(int index);
|
||||
int getPackedStringStartRelativeIndex(int index);
|
||||
|
||||
int16 getValue1();
|
||||
Common::Point getPosFromScript();
|
||||
|
||||
byte *getCharacterAttributesPtr();
|
||||
byte compareValues(int16 var1, uint16 oper, int16 var2);
|
||||
void computeOperation(byte *bufPtr, uint16 oper, int16 var2);
|
||||
|
||||
//Opcodes Type 1
|
||||
byte OC_checkCharacterGoalPos();
|
||||
byte OC_comparePos();
|
||||
byte OC_checkIsoMap3();
|
||||
byte OC_compareCharacterVariable();
|
||||
byte OC_CompareLastRandomValue();
|
||||
byte OC_getRandom();
|
||||
byte OC_for();
|
||||
byte OC_compCurrentSpeechId();
|
||||
byte OC_checkSaveFlag();
|
||||
byte OC_compScriptForVal();
|
||||
byte OC_isCarrying();
|
||||
byte OC_CompareCharacterVariables();
|
||||
byte OC_compareCoords_1();
|
||||
byte OC_compareCoords_2();
|
||||
byte OC_CompareDistanceFromCharacterToPositionWith();
|
||||
byte OC_compareRandomCharacterId();
|
||||
byte OC_IsCurrentCharacterIndex();
|
||||
byte OC_hasVisibilityLevel();
|
||||
byte OC_hasGainedVisibilityLevel();
|
||||
byte OC_hasReducedVisibilityLevel();
|
||||
byte OC_isHost();
|
||||
byte OC_isSequenceActive();
|
||||
byte OC_isSequenceFinished();
|
||||
byte OC_CompareMapValueWith();
|
||||
byte OC_IsCharacterValid();
|
||||
byte OC_CheckWaitingSignal();
|
||||
byte OC_CurrentCharacterVar0AndVar1Equals();
|
||||
byte OC_CurrentCharacterVar0Equals();
|
||||
byte OC_checkLastInterfaceHotspotIndexMenu13();
|
||||
byte OC_checkLastInterfaceHotspotIndexMenu2();
|
||||
byte OC_CompareNumberOfCharacterWithVar0Equals();
|
||||
byte OC_IsPositionInViewport();
|
||||
byte OC_CompareGameVariables();
|
||||
byte OC_skipNextOpcode();
|
||||
byte OC_CheckCurrentCharacterAttr2();
|
||||
byte OC_CheckCurrentCharacterType();
|
||||
byte OC_CheckCurrentCharacterAttr0And();
|
||||
byte OC_IsCurrentCharacterAttr0LessEqualThan();
|
||||
byte OC_isCarried();
|
||||
byte OC_CheckCurrentCharacterAttr1();
|
||||
byte OC_isCurrentCharacterSpecial();
|
||||
byte OC_CurrentCharacterAttr3Equals1();
|
||||
byte OC_checkCharacterDirection();
|
||||
byte OC_checkLastInterfaceHotspotIndex();
|
||||
byte OC_checkSelectedCharacter();
|
||||
byte OC_checkDelayedReactivation();
|
||||
byte OC_checkTargetReached();
|
||||
byte OC_checkFunctionKeyPressed();
|
||||
byte OC_checkCodeEntered();
|
||||
byte OC_checkViewPortCharacterTarget();
|
||||
|
||||
// Opcodes Type 2
|
||||
void OC_setWord18821();
|
||||
void OC_ChangeIsoMap();
|
||||
void OC_startSpeech();
|
||||
void OC_getComputedVariantSpeech();
|
||||
void OC_getRotatingVariantSpeech();
|
||||
void OC_startSpeechIfMute();
|
||||
void OC_getComputedVariantSpeechIfMute();
|
||||
void OC_startSpeechIfSilent();
|
||||
void OC_ComputeCharacterVariable();
|
||||
void OC_setAttributeToRandom();
|
||||
void OC_setCharacterPosition();
|
||||
void OC_DisableCharacter();
|
||||
void OC_saveAndQuit();
|
||||
void OC_nSkipOpcodes();
|
||||
void OC_startSpeech5();
|
||||
void OC_resetHandleOpcodeFlag();
|
||||
void OC_deleteSavegameAndQuit();
|
||||
void OC_incScriptForVal();
|
||||
void OC_computeChararacterAttr();
|
||||
void OC_setTextVarNumber();
|
||||
void OC_callScript();
|
||||
void OC_callScriptAndReturn();
|
||||
void OC_setCurrentScriptCharacterPos();
|
||||
void OC_initScriptFor();
|
||||
void OC_setCurrentCharacterSequence();
|
||||
void OC_setNextCharacterSequence();
|
||||
void OC_setHost();
|
||||
void OC_changeMapCube();
|
||||
void OC_setCharacterCarry();
|
||||
void OC_dropCarried();
|
||||
void OC_setCurrentCharacter();
|
||||
void OC_sendSeeSignal();
|
||||
void OC_sendHearSignal();
|
||||
void OC_sendVarSignal();
|
||||
void OC_sendBroadcastSignal();
|
||||
void OC_resetWaitingSignal();
|
||||
void OC_enableCurrentCharacterScript();
|
||||
void OC_IncCurrentCharacterVar1();
|
||||
void OC_setCurrentCharacterPos();
|
||||
void OC_setCurrentCharacterBehavior();
|
||||
void OC_changeCurrentCharacterSprite();
|
||||
void OC_getList();
|
||||
void OC_setList();
|
||||
void OC_setCharacterDirectionTowardsPos();
|
||||
void OC_turnCharacterTowardsAnother();
|
||||
void OC_setSeek();
|
||||
void OC_scrollAwayFromCharacter();
|
||||
void OC_skipNextVal();
|
||||
void OC_setCurrentCharacterAttr6();
|
||||
void OC_setCurrentCharacterPose();
|
||||
void OC_setCharacterScriptEnabled();
|
||||
void OC_setCurrentCharacterAttr2();
|
||||
void OC_clearCurrentCharacterAttr2();
|
||||
void OC_setCharacterProperties();
|
||||
void OC_setMonitoredCharacter();
|
||||
void OC_setNewPose();
|
||||
void OC_setCurrentCharacterDirection();
|
||||
void OC_setInterfaceHotspot();
|
||||
void OC_scrollViewPort();
|
||||
void OC_setViewPortPos();
|
||||
void OC_setCurrentCharacterAltitude();
|
||||
void OC_setModePriority();
|
||||
void setMode(EvaluatedMode newMode);
|
||||
void OC_setComputedModePriority();
|
||||
void OC_selectBestMode();
|
||||
void OC_magicPuffEntrance();
|
||||
void OC_spawnCharacterAtPos();
|
||||
void OC_CharacterVariableAddOrRemoveFlag();
|
||||
void OC_PaletteFadeOut();
|
||||
void OC_PaletteFadeIn();
|
||||
void OC_loadAndDisplayCubesGfx();
|
||||
void OC_setCurrentCharacterAttr3();
|
||||
void OC_setArray122C1();
|
||||
void OC_sub18367();
|
||||
void OC_enableCharacterScript();
|
||||
void OC_setRulesBuffer2Element();
|
||||
void OC_setDebugFlag();
|
||||
void OC_setDebugFlag2();
|
||||
void OC_waitForEvent();
|
||||
void OC_disableInterfaceHotspot();
|
||||
void OC_loadFileAerial();
|
||||
void OC_startSpeechIfSoundOff();
|
||||
void OC_sub1844A();
|
||||
void OC_displayNumericCharacterVariable();
|
||||
void OC_displayVGAFile();
|
||||
void OC_startSpeechWithoutSpeeker();
|
||||
void OC_displayTitleScreen();
|
||||
void OC_initGameAreaDisplay();
|
||||
void OC_displayCharacterStatBar();
|
||||
void OC_initSmallAnim();
|
||||
void OC_setCharacterHeroismBar();
|
||||
void OC_setCharacterHome();
|
||||
void OC_setViewPortCharacterTarget();
|
||||
void OC_showObject();
|
||||
void OC_playObjectSound();
|
||||
void OC_startLocationSound();
|
||||
void OC_stopObjectSound();
|
||||
void OC_stopLocationSound();
|
||||
void OC_toggleSound();
|
||||
void OC_playMusic();
|
||||
void OC_stopMusic();
|
||||
void OC_setCharacterMapColor();
|
||||
};
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
#endif
|
||||
|
||||
246
engines/lilliput/sound.cpp
Normal file
246
engines/lilliput/sound.cpp
Normal file
@@ -0,0 +1,246 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lilliput/lilliput.h"
|
||||
#include "lilliput/sound.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
static const byte _aliasArr[40] = {
|
||||
44, 0, 1, 2, 37, 3, 24, 45, 20, 19,
|
||||
16, 10, 11, 12, 41, 39, 40, 21, 22, 23,
|
||||
4, 5, 6, 52, 7, 8, 9, 33, 13, 14,
|
||||
15, 18, 26, 25, 38, 29, 36, 0xFF, 28, 40
|
||||
};
|
||||
|
||||
static const bool _loopArr[40] = {
|
||||
0, 0, 0, 1, 1, 1, 0, 1, 1, 1,
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 1, 1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const byte _soundType [40] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 0, 0, 1, 1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 1, 0, 0, 0
|
||||
};
|
||||
|
||||
LilliputSound::LilliputSound() {
|
||||
_unpackedFiles = nullptr;
|
||||
_unpackedSizes = nullptr;
|
||||
_fileNumb = 0;
|
||||
|
||||
_isGM = false;
|
||||
|
||||
MidiPlayer::createDriver();
|
||||
|
||||
int ret = _driver->open();
|
||||
if (ret == 0) {
|
||||
if (_nativeMT32)
|
||||
_driver->sendMT32Reset();
|
||||
else
|
||||
_driver->sendGMReset();
|
||||
|
||||
_driver->setTimerCallback(this, &timerCallback);
|
||||
}
|
||||
}
|
||||
|
||||
LilliputSound::~LilliputSound() {
|
||||
Audio::MidiPlayer::stop();
|
||||
|
||||
if (_unpackedFiles) {
|
||||
for (int i = 0; i < _fileNumb; i++)
|
||||
free(_unpackedFiles[i]);
|
||||
}
|
||||
free(_unpackedFiles);
|
||||
free(_unpackedSizes);
|
||||
}
|
||||
|
||||
byte LilliputSound::readByte(const byte *data, uint32 offset) {
|
||||
uint16 al = data[0x201 + (offset >> 1)];
|
||||
return data[1 + (offset & 1) + (al << 1)];
|
||||
}
|
||||
|
||||
uint32 LilliputSound::decode(const byte *src, byte *dst, uint32 len, uint32 start) {
|
||||
uint32 i = start;
|
||||
for (; i < len; ++i) {
|
||||
*dst++ = readByte(src, i);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void LilliputSound::loadMusic(const Common::Path &filename) {
|
||||
debugC(1, kDebugSound, "loadMusic(%s)", filename.toString().c_str());
|
||||
|
||||
Common::File f;
|
||||
|
||||
if (!f.open(filename))
|
||||
error("Missing music file %s", filename.toString().c_str());
|
||||
|
||||
_fileNumb = f.readUint16LE();
|
||||
|
||||
int *fileSizes = new int[_fileNumb + 1];
|
||||
for (int i = 0; i < _fileNumb; ++i)
|
||||
fileSizes[i] = f.readUint16LE();
|
||||
f.seek(0, SEEK_END);
|
||||
fileSizes[_fileNumb] = f.pos();
|
||||
|
||||
_unpackedFiles = new byte *[_fileNumb];
|
||||
_unpackedSizes = new uint16[_fileNumb];
|
||||
int pos = (_fileNumb + 1) * 2; // file number + file sizes
|
||||
for (int i = 0; i < _fileNumb; ++i) {
|
||||
int packedSize = fileSizes[i + 1] - fileSizes[i];
|
||||
byte *srcBuf = new byte[packedSize];
|
||||
f.seek(pos, SEEK_SET);
|
||||
f.read(srcBuf, packedSize);
|
||||
if (srcBuf[0] == 'c' || srcBuf[0] == 'C') {
|
||||
int shift = (srcBuf[0] == 'c') ? 1 : 0;
|
||||
_unpackedSizes[i] = (1 + packedSize - 0x201) * 2 - shift;
|
||||
byte *dstBuf = new byte[_unpackedSizes[i]];
|
||||
decode(srcBuf, dstBuf, _unpackedSizes[i], shift);
|
||||
_unpackedFiles[i] = dstBuf;
|
||||
} else {
|
||||
_unpackedSizes[i] = packedSize;
|
||||
byte *dstBuf = new byte[packedSize];
|
||||
for (int j = 0; j < packedSize; ++j)
|
||||
dstBuf[j] = srcBuf[j];
|
||||
_unpackedFiles[i] = dstBuf;
|
||||
}
|
||||
delete[] srcBuf;
|
||||
pos += packedSize;
|
||||
}
|
||||
|
||||
delete[] fileSizes;
|
||||
f.close();
|
||||
|
||||
/* Debug code
|
||||
for (int i = 0; i < _fileNumb; ++i) {
|
||||
Common::DumpFile dmp;
|
||||
Common::String name = Common::String::format("dmp%d.mid", i);
|
||||
dmp.open(name);
|
||||
dmp.write(_unpackedFiles[i], _unpackedSizes[i]);
|
||||
dmp.close();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void LilliputSound::send(uint32 b) {
|
||||
if (((b & 0xF0) == 0xC0) && !_isGM && !_nativeMT32) {
|
||||
b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8;
|
||||
}
|
||||
|
||||
Audio::MidiPlayer::send(b);
|
||||
}
|
||||
|
||||
void LilliputSound::sendToChannel(byte channel, uint32 b) {
|
||||
if (!_channelsTable[channel]) {
|
||||
_channelsTable[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
|
||||
// If a new channel is allocated during the playback, make sure
|
||||
// its volume is correctly initialized.
|
||||
if (_channelsTable[channel])
|
||||
_channelsTable[channel]->volume(_channelsVolume[channel] * _masterVolume / 255);
|
||||
}
|
||||
|
||||
if (_channelsTable[channel])
|
||||
_channelsTable[channel]->send(b);
|
||||
}
|
||||
|
||||
void LilliputSound::init() {
|
||||
debugC(1, kDebugSound, "LilliputSound::init()");
|
||||
|
||||
loadMusic("ROBIN.MUS");
|
||||
}
|
||||
|
||||
void LilliputSound::refresh() {
|
||||
debugC(1, kDebugSound, "LilliputSound::refresh()");
|
||||
}
|
||||
|
||||
void LilliputSound::playSound(int var1, Common::Point var2, Common::Point var3, Common::Point var4) {
|
||||
debugC(1, kDebugSound, "LilliputSound::playSound(%d, %d - %d, %d - %d, %d - %d)", var1, var2.x, var2.y, var3.x, var3.y, var4.x, var4.y);
|
||||
// warning("LilliputSound::playSound(%d, %d - %d, %d - %d, %d - %d)", var1, var2.x, var2.y, var3.x, var3.y, var4.x, var4.y);
|
||||
|
||||
// save camera (var2)
|
||||
if (_aliasArr[var1] == 0xFF) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (var3 == Common::Point(-1, -1)) {
|
||||
playMusic(var1);
|
||||
} else if (_soundType[var1] == 0) {
|
||||
warning("Transient");
|
||||
} else {
|
||||
warning("longterm");
|
||||
}
|
||||
}
|
||||
|
||||
void LilliputSound::playMusic(int var1) {
|
||||
int idx = _aliasArr[var1];
|
||||
bool loop = _loopArr[var1];
|
||||
|
||||
_isGM = true;
|
||||
|
||||
if (_parser)
|
||||
_parser->stopPlaying();
|
||||
|
||||
MidiParser *parser = MidiParser::createParser_SMF();
|
||||
if (parser->loadMusic(_unpackedFiles[idx], _unpackedSizes[idx])) {
|
||||
parser->setTrack(0);
|
||||
parser->setMidiDriver(this);
|
||||
parser->setTimerRate(_driver->getBaseTempo());
|
||||
parser->property(MidiParser::mpAutoLoop, loop);
|
||||
parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
|
||||
|
||||
_parser = parser;
|
||||
|
||||
syncVolume();
|
||||
|
||||
_isLooping = loop;
|
||||
_isPlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LilliputSound::stopSound(Common::Point pos) {
|
||||
debugC(1, kDebugSound, "LilliputSound::stopSound(%d - %d)", pos.x, pos.y);
|
||||
warning("LilliputSound::stopSound(%d - %d)", pos.x, pos.y);
|
||||
// FIXME: Audio::MidiPlayer::stop() call required?
|
||||
}
|
||||
|
||||
void LilliputSound::toggleOnOff() {
|
||||
debugC(1, kDebugSound, "LilliputSound::toggleOnOff()");
|
||||
warning("LilliputSound::toggleOnOff()");
|
||||
}
|
||||
|
||||
void LilliputSound::update() {
|
||||
debugC(1, kDebugSound, "LilliputSound::update()");
|
||||
warning("LilliputSound::update()");
|
||||
}
|
||||
|
||||
void LilliputSound::remove() {
|
||||
debugC(1, kDebugSound, "Lilliput::remove()");
|
||||
|
||||
_parser->stopPlaying();
|
||||
}
|
||||
|
||||
} // End of namespace
|
||||
68
engines/lilliput/sound.h
Normal file
68
engines/lilliput/sound.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LILLIPUT_SOUND_H
|
||||
#define LILLIPUT_SOUND_H
|
||||
|
||||
#include "audio/audiostream.h"
|
||||
#include "audio/decoders/wave.h"
|
||||
#include "audio/mididrv.h"
|
||||
#include "audio/midiparser.h"
|
||||
#include "audio/midiplayer.h"
|
||||
#include "audio/mixer.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
class LilliputEngine;
|
||||
|
||||
class LilliputSound: public Audio::MidiPlayer {
|
||||
public:
|
||||
LilliputSound();
|
||||
~LilliputSound() override;
|
||||
|
||||
void init();
|
||||
void refresh();
|
||||
void playSound(int var1, Common::Point var2, Common::Point var3, Common::Point var4);
|
||||
void stopSound(Common::Point pos);
|
||||
void toggleOnOff();
|
||||
void update();
|
||||
void remove();
|
||||
|
||||
private:
|
||||
int _fileNumb;
|
||||
byte **_unpackedFiles;
|
||||
uint16 *_unpackedSizes;
|
||||
bool _isGM;
|
||||
|
||||
uint32 decode(const byte *src, byte *dst, uint32 len, uint32 start);
|
||||
byte readByte(const byte *data, uint32 offset);
|
||||
|
||||
void loadMusic(const Common::Path &filename);
|
||||
void playMusic(int var1);
|
||||
|
||||
void send(uint32 b) override;
|
||||
void sendToChannel(byte channel, uint32 b) override;
|
||||
};
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
#endif
|
||||
|
||||
41
engines/lilliput/stream.cpp
Normal file
41
engines/lilliput/stream.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lilliput/stream.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
ScriptStream::ScriptStream(byte *buf, int bufSize) : Common::MemoryReadStream(buf, bufSize) {
|
||||
_orgPtr = buf;
|
||||
}
|
||||
|
||||
ScriptStream::~ScriptStream() {
|
||||
}
|
||||
|
||||
void ScriptStream::writeUint16LE(int value, int relativePos) {
|
||||
int writePos = pos() + relativePos;
|
||||
assert((writePos >= 0) && (writePos + 2 < size()));
|
||||
|
||||
Common::MemoryWriteStream tmpStream = Common::MemoryWriteStream(_orgPtr + writePos, size() - writePos);
|
||||
tmpStream.writeUint16LE(value);
|
||||
}
|
||||
|
||||
} // End of namespace Lilliput
|
||||
44
engines/lilliput/stream.h
Normal file
44
engines/lilliput/stream.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LILLIPUT_STREAM_H
|
||||
#define LILLIPUT_STREAM_H
|
||||
|
||||
#include "common/memstream.h"
|
||||
|
||||
namespace Lilliput {
|
||||
|
||||
class ScriptStream : public Common::MemoryReadStream {
|
||||
private:
|
||||
byte *_orgPtr;
|
||||
public:
|
||||
ScriptStream(ScriptStream &&other) : Common::MemoryReadStream(Common::move(other)), _orgPtr(other._orgPtr) {
|
||||
other._orgPtr = nullptr;
|
||||
}
|
||||
ScriptStream(byte *buf, int bufSize);
|
||||
~ScriptStream() override;
|
||||
|
||||
void writeUint16LE(int value, int relativePos = 0);
|
||||
};
|
||||
|
||||
} // End of namespace Lilliput
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user