Initial commit
This commit is contained in:
171
engines/grim/remastered/commentary.cpp
Normal file
171
engines/grim/remastered/commentary.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/* 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/grim/remastered/commentary.h"
|
||||
#include "engines/grim/resource.h"
|
||||
#include "engines/grim/textsplit.h"
|
||||
#include "engines/grim/localize.h"
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
struct CommentLine {
|
||||
int _id;
|
||||
Common::String _line;
|
||||
int _start;
|
||||
int _end;
|
||||
};
|
||||
|
||||
class Comment {
|
||||
Common::String _name;
|
||||
Common::String _filename;
|
||||
Common::Array<CommentLine> _lines;
|
||||
bool _hasHeard; // TODO: Should be saved
|
||||
public:
|
||||
Comment(const Common::String &name, const Common::String &filename);
|
||||
Common::String getName() const;
|
||||
void addLine(int id, const Common::String &text, int start, int end);
|
||||
void play();
|
||||
bool hasHeard() const { return _hasHeard; }
|
||||
};
|
||||
|
||||
Comment::Comment(const Common::String &name, const Common::String &filename) : _name(name), _filename(filename), _hasHeard(false) {
|
||||
}
|
||||
|
||||
void Comment::addLine(int id, const Common::String &text, int start, int end) {
|
||||
CommentLine line;
|
||||
line._id = id;
|
||||
line._line = text;
|
||||
line._start = start;
|
||||
line._end = end;
|
||||
_lines.push_back(line);
|
||||
}
|
||||
|
||||
Common::String Comment::getName() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
void Comment::play() {
|
||||
for (uint i = 0; i < _lines.size(); i++) {
|
||||
Common::String text = g_localizer->localize(_lines[i]._line.c_str());
|
||||
warning("Line: %d Start: %d End: %d Id: %d Text: %s", i, _lines[i]._start, _lines[i]._end, _lines[i]._id, text.c_str());
|
||||
}
|
||||
_hasHeard = true;
|
||||
}
|
||||
|
||||
Commentary::Commentary() : _currentCommentary(nullptr) {
|
||||
loadCommentary();
|
||||
}
|
||||
|
||||
Commentary::~Commentary() {
|
||||
Common::HashMap<Common::String, Comment*>::iterator it = _comments.begin();
|
||||
for (; it != _comments.end(); ++it) {
|
||||
delete it->_value;
|
||||
}
|
||||
_comments.clear();
|
||||
}
|
||||
|
||||
void Commentary::loadCommentary() {
|
||||
Common::String defFilename = "commentary_def.txt";
|
||||
Common::SeekableReadStream *f = g_resourceloader->openNewStreamFile(defFilename);
|
||||
if (!f) {
|
||||
error("Commentary::loadCommentary: Unable to find commentary definition (%s)", defFilename.c_str());
|
||||
return;
|
||||
}
|
||||
TextSplitter ts(defFilename, f);
|
||||
|
||||
while (!ts.isEof()) {
|
||||
// Skip comments
|
||||
while (ts.checkString("#")) {
|
||||
ts.nextLine();
|
||||
}
|
||||
// Skip blank lines and trim input
|
||||
Common::String currentLine = ts.getCurrentLine();
|
||||
currentLine.trim();
|
||||
while (currentLine.size() == 0) {
|
||||
currentLine = ts.nextLine();
|
||||
currentLine.trim();
|
||||
}
|
||||
|
||||
Common::String name = currentLine;
|
||||
name.trim();
|
||||
Common::String filename = ts.nextLine();
|
||||
ts.nextLine();
|
||||
filename.trim();
|
||||
|
||||
Comment *c = new Comment(name, filename);
|
||||
|
||||
int numLines = 0;
|
||||
ts.scanString("\t%d", 1, &numLines);
|
||||
|
||||
char str[20] = {0};
|
||||
for (int i = 0; i < numLines; i++) {
|
||||
int id = 0;
|
||||
int start = 0;
|
||||
int end = 0;
|
||||
ts.scanString("%d\t%s\t%d\t%d", 4, &id, str, &start, &end);
|
||||
c->addLine(id, str, start, end);
|
||||
}
|
||||
|
||||
_comments.setVal(name, c);
|
||||
}
|
||||
}
|
||||
|
||||
Comment *Commentary::findCommentary(const Common::String &name) {
|
||||
Common::String lowerName = name;
|
||||
lowerName.toLowercase();
|
||||
if (!_comments.contains(lowerName)) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return _comments.getVal(lowerName);
|
||||
}
|
||||
}
|
||||
|
||||
void Commentary::playCurrentCommentary() {
|
||||
if (_currentCommentary != nullptr) {
|
||||
warning("Commentary::playCurrentCommentary, current is %s", _currentCommentary->getName().c_str());
|
||||
_currentCommentary->play();
|
||||
} else {
|
||||
warning("Commentary::playCurrentCommentary, no current commentary");
|
||||
}
|
||||
}
|
||||
|
||||
void Commentary::setCurrentCommentary(const Common::String &name) {
|
||||
warning("Commentary::setCurrentCommentary(%s)", name.c_str());
|
||||
_currentCommentary = findCommentary(name);
|
||||
if (_currentCommentary == nullptr) {
|
||||
warning("Commentary::setCurrentCommentary(%s) could not find commentary", name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool Commentary::hasHeardCommentary(const Common::String &name) const {
|
||||
Common::String lowerName = name;
|
||||
lowerName.toLowercase();
|
||||
if (!_comments.contains(lowerName)) {
|
||||
warning("Commentary::hasHeardCommentary(%s) could not find commentary", name.c_str());
|
||||
return false;
|
||||
} else {
|
||||
return _comments.getVal(lowerName)->hasHeard();
|
||||
}
|
||||
}
|
||||
|
||||
} // end of namespace Grim
|
||||
48
engines/grim/remastered/commentary.h
Normal file
48
engines/grim/remastered/commentary.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 GRIM_COMMENTARY
|
||||
#define GRIM_COMMENTARY
|
||||
|
||||
#include "common/str.h"
|
||||
#include "common/hash-str.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
class Comment;
|
||||
|
||||
class Commentary {
|
||||
// TODO: Case sensitivity
|
||||
Common::HashMap<Common::String, Comment*> _comments;
|
||||
Comment *_currentCommentary;
|
||||
Comment *findCommentary(const Common::String &name);
|
||||
void loadCommentary();
|
||||
public:
|
||||
Commentary();
|
||||
~Commentary();
|
||||
void playCurrentCommentary();
|
||||
void setCurrentCommentary(const Common::String &name);
|
||||
bool hasHeardCommentary(const Common::String &name) const;
|
||||
};
|
||||
|
||||
} // end of namespace Grim
|
||||
|
||||
#endif
|
||||
33
engines/grim/remastered/hotspot.cpp
Normal file
33
engines/grim/remastered/hotspot.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 "engines/grim/remastered/hotspot.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
Hotspot::Hotspot(const Common::String &name, int x, int y, int width, int height) :
|
||||
_name(name), _x(x), _y(y), _width(width), _height(height), _rect(Math::Vector2d(_x, _y), Math::Vector2d(_x + _width, _y + _height)) {
|
||||
}
|
||||
|
||||
Hotspot::~Hotspot() {
|
||||
}
|
||||
|
||||
}
|
||||
51
engines/grim/remastered/hotspot.h
Normal file
51
engines/grim/remastered/hotspot.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* 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 GRIM_HOTSPOT_H
|
||||
#define GRIM_HOTSPOT_H
|
||||
|
||||
#include "common/endian.h"
|
||||
|
||||
#include "engines/grim/pool.h"
|
||||
|
||||
#include "math/rect2d.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
class Hotspot : public PoolObject<Hotspot> {
|
||||
public:
|
||||
Hotspot(const Common::String &name, int x, int y, int width, int height);
|
||||
~Hotspot();
|
||||
|
||||
static int32 getStaticTag() { return MKTAG('H','O','T','S'); }
|
||||
|
||||
//private:
|
||||
Common::String _name;
|
||||
int _x;
|
||||
int _y;
|
||||
int _width;
|
||||
int _height;
|
||||
Math::Rect2d _rect;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
690
engines/grim/remastered/lua_remastered.cpp
Normal file
690
engines/grim/remastered/lua_remastered.cpp
Normal file
@@ -0,0 +1,690 @@
|
||||
/* 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 "common/endian.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/config-manager.h"
|
||||
|
||||
#include "engines/grim/remastered/lua_remastered.h"
|
||||
#include "engines/grim/remastered/overlay.h"
|
||||
#include "engines/grim/remastered/hotspot.h"
|
||||
#include "engines/grim/grim.h"
|
||||
#include "engines/grim/font.h"
|
||||
#include "engines/grim/resource.h"
|
||||
#include "engines/grim/registry.h"
|
||||
#include "engines/grim/localize.h"
|
||||
#include "engines/grim/lua/lauxlib.h"
|
||||
#include "engines/grim/lua/luadebug.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
void Lua_Remastered::WidescreenCorrectionFactor() {
|
||||
warning("Stub function: WidescreenCorrectionFactor, returns 1");
|
||||
lua_pushnumber(1);
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetFontDimensions() {
|
||||
// Taken from Lua_v2 and modified
|
||||
lua_Object fontObj = lua_getparam(1);
|
||||
if (!lua_isuserdata(fontObj))
|
||||
return;
|
||||
|
||||
Font *font = getfont(fontObj);
|
||||
|
||||
if (font) {
|
||||
int32 h = font->getKernedHeight();
|
||||
int32 w = font->getFontWidth();
|
||||
lua_pushnumber(w);
|
||||
lua_pushnumber(h);
|
||||
} else {
|
||||
warning("Lua_Remastered::GetFontDimensions for invalid font: returns 0,0");
|
||||
lua_pushnumber(0.f);
|
||||
lua_pushnumber(0.f);
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetTextObjectDimensions() {
|
||||
lua_Object textObj = lua_getparam(1);
|
||||
lua_Object coordsObj = lua_getparam(2);
|
||||
if (lua_isnumber(coordsObj)) {
|
||||
int val = lua_getnumber(coordsObj);
|
||||
warning("Stub function: GetTextObjectDimensions(%d)", val);
|
||||
}
|
||||
|
||||
if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
|
||||
TextObject *textObject = gettextobject(textObj);
|
||||
lua_pushnumber(textObject->getWidth()); // REMASTERED HACK
|
||||
lua_pushnumber(textObject->getBitmapHeight()); // REMASTERED HACK
|
||||
// If the line is rjustified getX does us no good
|
||||
lua_pushnumber(textObject->getLineX(0));
|
||||
lua_pushnumber(textObject->getY());
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::OverlayDimensions() {
|
||||
lua_Object overlayObj = lua_getparam(1);
|
||||
if (!lua_isuserdata(overlayObj) || lua_tag(overlayObj) != Overlay::getStaticTag())
|
||||
return;
|
||||
|
||||
Overlay *overlay = Overlay::getPool().getObject(lua_getuserdata(overlayObj));
|
||||
lua_pushnumber(overlay->getWidth());
|
||||
lua_pushnumber(overlay->getHeight());
|
||||
}
|
||||
|
||||
void Lua_Remastered::OverlayGetScreenSize() {
|
||||
warning("Stub function: OverlayGetScreenSize, returns 1920, 1080");
|
||||
lua_pushnumber(1920);
|
||||
lua_pushnumber(1080);
|
||||
}
|
||||
|
||||
void Lua_Remastered::OverlayCreate() {
|
||||
warning("Stub function: OverlayCreate not done");
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
lua_Object param2 = lua_getparam(2);
|
||||
lua_Object param3 = lua_getparam(3);
|
||||
lua_Object param4 = lua_getparam(4);
|
||||
if (!lua_isstring(param1) || !lua_isnumber(param2) || !lua_isnumber(param3) || !lua_istable(param4)) {
|
||||
return;
|
||||
}
|
||||
const char *overlayName = lua_getstring(param1);
|
||||
float x = lua_getnumber(param2);
|
||||
float y = lua_getnumber(param3);
|
||||
|
||||
lua_pushobject(param4);
|
||||
lua_pushstring("layer");
|
||||
lua_Object table = lua_gettable();
|
||||
float layer = lua_getnumber(table);
|
||||
|
||||
Overlay *overlay = g_resourceloader->loadOverlay(overlayName);
|
||||
|
||||
if (overlay) {
|
||||
overlay->setPos(x, y);
|
||||
overlay->setLayer(layer);
|
||||
lua_pushusertag(overlay->getId(), overlay->getTag());
|
||||
} else {
|
||||
lua_pushnil();
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::OverlayDestroy() {
|
||||
lua_Object actorObj = lua_getparam(1);
|
||||
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != Overlay::getStaticTag())
|
||||
return;
|
||||
|
||||
Overlay *overlay = Overlay::getPool().getObject(lua_getuserdata(actorObj));
|
||||
delete overlay;
|
||||
}
|
||||
|
||||
void Lua_Remastered::OverlayFade() {
|
||||
lua_Object overlayObj = lua_getparam(1);
|
||||
lua_Object fadeObj = lua_getparam(2);
|
||||
if (!lua_isuserdata(overlayObj) || lua_tag(overlayObj) != Overlay::getStaticTag())
|
||||
return;
|
||||
assert(lua_isnumber(fadeObj));
|
||||
|
||||
int fadeType = lua_getnumber(fadeObj);
|
||||
warning("Stub function: OverlayFade(%d)", fadeType);
|
||||
Overlay *overlay = Overlay::getPool().getObject(lua_getuserdata(overlayObj));
|
||||
|
||||
if (fadeType == 3) {
|
||||
delete overlay;
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::OverlayMove() {
|
||||
lua_Object overlayObj = lua_getparam(1);
|
||||
lua_Object param2 = lua_getparam(2);
|
||||
lua_Object param3 = lua_getparam(3);
|
||||
|
||||
if (!lua_isuserdata(overlayObj) || lua_tag(overlayObj) != Overlay::getStaticTag())
|
||||
return;
|
||||
|
||||
Overlay *overlay = Overlay::getPool().getObject(lua_getuserdata(overlayObj));
|
||||
float x = lua_getnumber(param2);
|
||||
float y = lua_getnumber(param3);
|
||||
overlay->setPos(x, y);
|
||||
}
|
||||
|
||||
void Lua_Remastered::QueryActiveHotspots() {
|
||||
lua_Object param = lua_getparam(1);
|
||||
|
||||
assert(lua_isnumber(param));
|
||||
|
||||
warning("Stub function: QueryActiveHotspots(%f)", lua_getnumber(param));
|
||||
|
||||
// TODO: Handle coord scaling better
|
||||
float scaleX = 1920.0f/1600;
|
||||
float scaleY = 1080.0f/900;
|
||||
Math::Vector2d pos(g_grim->_cursorX*scaleX, g_grim->_cursorY*scaleY);
|
||||
lua_Object result = lua_createtable();
|
||||
int count = 0;
|
||||
for (Hotspot *h : Hotspot::getPool()) {
|
||||
if (!h->_rect.containsPoint(pos)) {
|
||||
continue;
|
||||
}
|
||||
lua_Object inner = lua_createtable();
|
||||
|
||||
lua_pushobject(inner);
|
||||
lua_pushstring("type");
|
||||
lua_pushstring("normal");
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(inner);
|
||||
lua_pushstring("cursor");
|
||||
lua_pushnumber(0);
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(inner);
|
||||
lua_pushstring("id");
|
||||
lua_pushstring(h->_name.c_str());
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(inner);
|
||||
lua_pushstring("obj");
|
||||
lua_pushusertag(h->getId(), h->getTag());
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(result);
|
||||
lua_pushnumber(count++);
|
||||
lua_pushobject(inner);
|
||||
lua_settable();
|
||||
}
|
||||
|
||||
lua_pushobject(result);
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetLanguage() {
|
||||
warning("Stub function: GetLanguage, just guesswork");
|
||||
lua_pushnumber(g_grim->getLanguage());
|
||||
}
|
||||
|
||||
void Lua_Remastered::SaveRegistryToDisk() {
|
||||
warning("Guesswork: SaveRegistryToDisk");
|
||||
g_registry->save();
|
||||
ConfMan.flushToDisk(); // Since we can't consistently exit yet, we force a write for now
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetCursorPosition() {
|
||||
lua_pushnumber(g_grim->_cursorX);
|
||||
lua_pushnumber(g_grim->_cursorX);
|
||||
}
|
||||
|
||||
void Lua_Remastered::SetCursor() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
|
||||
assert(lua_isnumber(param1));
|
||||
|
||||
warning("Stub function: SetCursor(%f)", lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetPlatform() {
|
||||
warning("Stub function: GetPlatform, returns 1 (windows)");
|
||||
lua_pushnumber(1);
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetRemappedKeyName() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
|
||||
const char *str = "";
|
||||
if (lua_isstring(param1)) {
|
||||
str = lua_getstring(param1);
|
||||
}
|
||||
warning("Stub function: GetRemappedKeyName(%s), returns TODO", str);
|
||||
|
||||
lua_pushstring("TODO");
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetRemappedKeyHint() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
warning("Stub function: GetRemappedKeyHint(%s), returns key_empty.png", lua_getstring(param1));
|
||||
lua_pushstring("key_empty.png");
|
||||
}
|
||||
|
||||
void Lua_Remastered::ImSetCommentaryVol() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Stub function: ImSetCommentaryVol(%f)", lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::ImGetCommentaryVol() {
|
||||
warning("Stub function: ImGetCommentaryVol() returns 0");
|
||||
lua_pushnumber(0);
|
||||
}
|
||||
|
||||
void Lua_Remastered::SetLanguage() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Stub function: SetLanguage(%f)", lua_getnumber(param1));
|
||||
g_grim->setLanguage(lua_getnumber(param1));
|
||||
delete g_localizer;
|
||||
g_localizer = new Localizer();
|
||||
}
|
||||
|
||||
void Lua_Remastered::SetMouseSpeedScale() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Stub function: SetMouseSpeedScale(%f)", lua_getnumber(param1));
|
||||
}
|
||||
|
||||
// Commentary
|
||||
void Lua_Remastered::EnableCommentary() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Stub function: EnableCommentary(%f)", lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::SetCommentary() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isstring(param1));
|
||||
warning("Stub function: SetCommentary(%s)", lua_getstring(param1));
|
||||
g_grim->getCommentary()->setCurrentCommentary(lua_getstring(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::PlayCurrentCommentary() {
|
||||
warning("Stub function: PlayCurrentCommentary");
|
||||
g_grim->getCommentary()->playCurrentCommentary();
|
||||
}
|
||||
|
||||
void Lua_Remastered::HasHeardCommentary() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isstring(param1));
|
||||
bool hasHeard = g_grim->getCommentary()->hasHeardCommentary(lua_getstring(param1));
|
||||
warning("Remastered function: HasHeardCommentary(%s) returns %d", lua_getstring(param1), hasHeard);
|
||||
if (hasHeard) {
|
||||
lua_pushnumber(1);
|
||||
} else {
|
||||
lua_pushnil();
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::SetResolutionScaling() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Stub function: SetResolutionScaling(%f)", lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::IsConceptUnlocked() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Remastered function: IsConceptUnlocked(%f) returns %d", lua_getnumber(param1), g_grim->isConceptEnabled(lua_getnumber(param1)));
|
||||
if (g_grim->isConceptEnabled(lua_getnumber(param1))) {
|
||||
lua_pushnumber(1);
|
||||
} else {
|
||||
lua_pushnil();
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::UnlockConcept() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Remastered function: UnlockConcept(%f)", lua_getnumber(param1));
|
||||
g_grim->enableConcept(lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::UnlockCutscene() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Remastered function: UnlockCutscene(%f)", lua_getnumber(param1));
|
||||
g_grim->enableCutscene(lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::IsCutsceneUnlocked() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Remastered function: IsCutsceneUnlocked(%f) returns %d", lua_getnumber(param1), g_grim->isCutsceneEnabled(lua_getnumber(param1)));
|
||||
if (g_grim->isCutsceneEnabled(lua_getnumber(param1))) {
|
||||
lua_pushnumber(1);
|
||||
} else {
|
||||
lua_pushnil();
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::GetGameRenderMode() {
|
||||
warning("Stub function: GetGameRenderMode() - not all modes possible yet");
|
||||
lua_pushnumber(g_grim->getMode());
|
||||
}
|
||||
|
||||
void Lua_Remastered::SetGameRenderMode() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
if (lua_isnil(param1)) {
|
||||
warning("SetGameRenderMode(nil) - Should it be possible to call this with nil?");
|
||||
return;
|
||||
}
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Stub function: SetGameRenderMode(%f)", lua_getnumber(param1));
|
||||
g_grim->setMode((GrimEngine::EngineMode)(int)lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::AddHotspot() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
lua_Object param2 = lua_getparam(2);
|
||||
lua_Object param3 = lua_getparam(3);
|
||||
lua_Object param4 = lua_getparam(4);
|
||||
lua_Object param5 = lua_getparam(5);
|
||||
lua_Object param6 = lua_getparam(6);
|
||||
lua_Object param7 = lua_getparam(7);
|
||||
lua_Object param8 = lua_getparam(8);
|
||||
lua_Object param9 = lua_getparam(9);
|
||||
lua_Object param10 = lua_getparam(10);
|
||||
lua_Object param11 = lua_getparam(11);
|
||||
|
||||
assert(lua_isstring(param1));
|
||||
assert(lua_isnumber(param2));
|
||||
assert(lua_isnumber(param3));
|
||||
assert(lua_isnumber(param4));
|
||||
assert(lua_isnumber(param5));
|
||||
assert(lua_isnumber(param6));
|
||||
assert(lua_isnumber(param7));
|
||||
//assert(lua_isnumber(param8));
|
||||
assert(lua_isnumber(param11));
|
||||
|
||||
const char *p9str = "nil";
|
||||
const char *p10str = "nil";
|
||||
if (lua_isstring(param9)) {
|
||||
p9str = lua_getstring(param9);
|
||||
} else if (!lua_isnil(param9)) {
|
||||
assert(lua_isnil(param9));
|
||||
}
|
||||
|
||||
if (lua_isstring(param10)) {
|
||||
p10str = lua_getstring(param10);
|
||||
} else if (!lua_isnil(param10)) {
|
||||
assert(lua_isnil(param10));
|
||||
}
|
||||
warning("Stub function: AddHotspot(%s, %f, %f, %f, %f, %f, %f, %f, %s, %s, %f)", lua_getstring(param1), lua_getnumber(param2), lua_getnumber(param3), lua_getnumber(param4), lua_getnumber(param5), lua_getnumber(param6), lua_getnumber(param7), lua_getnumber(param8), p9str, p10str, lua_getnumber(param11));
|
||||
|
||||
Hotspot *hotspot = new Hotspot(lua_getstring(param1), lua_getnumber(param2), lua_getnumber(param3), lua_getnumber(param4), lua_getnumber(param5));
|
||||
|
||||
lua_pushusertag(hotspot->getId(), hotspot->getTag());
|
||||
|
||||
}
|
||||
|
||||
void Lua_Remastered::RemoveHotspot() {
|
||||
lua_Object hotspotObj = lua_getparam(1);
|
||||
Hotspot *hotspot = Hotspot::getPool().getObject(lua_getuserdata(hotspotObj));
|
||||
delete hotspot;
|
||||
}
|
||||
|
||||
void Lua_Remastered::GlobalSaveResolved() {
|
||||
warning("Stub function: GlobalSaveResolved() returns 1");
|
||||
lua_pushnumber(1);
|
||||
}
|
||||
|
||||
void Lua_Remastered::FindSaveGames() {
|
||||
warning("Stub function: FindSaveGames()");
|
||||
|
||||
Common::SaveFileManager *saveMan = g_grim->getSaveFileManager();
|
||||
Common::StringArray saveFiles = saveMan->listSavefiles("grim_r???.sav");
|
||||
|
||||
if (saveFiles.empty()) {
|
||||
lua_pushnil();
|
||||
return;
|
||||
}
|
||||
|
||||
lua_Object result = lua_createtable();
|
||||
|
||||
Common::StringArray::iterator it = saveFiles.begin();
|
||||
for (int i = 0; it != saveFiles.end(); ++it) {
|
||||
const char *filename = (*it).c_str();
|
||||
warning("Savefile: %s", filename);
|
||||
SaveGame *savedState = SaveGame::openForLoading(filename);
|
||||
|
||||
if (!savedState || !savedState->isCompatible()) {
|
||||
if (!savedState) {
|
||||
error("Savegame %s is invalid", filename);
|
||||
} else {
|
||||
error("Savegame %s is incompatible with this ScummVM build. Save version: %d.%d; current version: %d.%d",
|
||||
filename, savedState->saveMajorVersion(), savedState->saveMinorVersion(),
|
||||
SaveGame::SAVEGAME_MAJOR_VERSION, SaveGame::SAVEGAME_MINOR_VERSION);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int slot = atoi((*it).c_str() + 6);
|
||||
Common::String str1;
|
||||
Common::String str2;
|
||||
int x;
|
||||
/*int32 dataSize = */savedState->beginSection('META');
|
||||
char str[200] = {};
|
||||
int32 strSize = 0;
|
||||
|
||||
strSize = savedState->readLESint32();
|
||||
savedState->read(str, strSize);
|
||||
str1 = str;
|
||||
x = savedState->readLESint32();
|
||||
strSize = savedState->readLESint32();
|
||||
savedState->read(str, strSize);
|
||||
str2 = str;
|
||||
savedState->endSection();
|
||||
delete savedState;
|
||||
|
||||
lua_pushobject(result);
|
||||
lua_pushnumber(i++);
|
||||
|
||||
str2 = g_localizer->localize(str2.c_str());
|
||||
|
||||
lua_Object keyVal = lua_createtable();
|
||||
// The key-value-mapping:
|
||||
{
|
||||
|
||||
lua_pushobject(keyVal);
|
||||
lua_pushstring("slot");
|
||||
lua_pushnumber(slot);
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(keyVal);
|
||||
lua_pushstring("title");
|
||||
lua_pushstring(str2.c_str());
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(keyVal);
|
||||
lua_pushstring("timeDateString");
|
||||
lua_pushstring("Unknown");
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(keyVal);
|
||||
lua_pushstring("mural_info");
|
||||
lua_pushstring(str1.c_str());
|
||||
lua_settable();
|
||||
|
||||
lua_pushobject(keyVal);
|
||||
lua_pushstring("setIndex");
|
||||
lua_pushnumber(x);
|
||||
lua_settable();
|
||||
}
|
||||
lua_pushobject(keyVal);
|
||||
|
||||
lua_settable();
|
||||
}
|
||||
|
||||
lua_pushobject(result);
|
||||
}
|
||||
|
||||
|
||||
void Lua_Remastered::Load() {
|
||||
lua_Object fileName = lua_getparam(1);
|
||||
//lua_Object param2 = lua_getparam(2);
|
||||
|
||||
if (lua_isnil(fileName)) {
|
||||
g_grim->loadGame("");
|
||||
} else if (lua_isnumber(fileName)) {
|
||||
int slot = lua_getnumber(fileName);
|
||||
Common::String saveGameFilename = Common::String::format("grim_r%03d.sav", slot);
|
||||
g_grim->loadGame(saveGameFilename.c_str());
|
||||
} else if (lua_isstring(fileName)) { // Check for number before this
|
||||
g_grim->loadGame(lua_getstring(fileName));
|
||||
} else {
|
||||
warning("Load() fileName is wrong");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Lua_Remastered::Save() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
lua_Object param2 = lua_getparam(2);
|
||||
lua_Object param3 = lua_getparam(3);
|
||||
lua_Object param4 = lua_getparam(4);
|
||||
assert(lua_isnumber(param1));
|
||||
assert(lua_isstring(param2));
|
||||
assert(lua_isnumber(param3));
|
||||
assert(lua_isstring(param4));
|
||||
|
||||
int slot = lua_getnumber(param1);
|
||||
const char *p2Str = lua_getstring(param2);
|
||||
int p3Num = lua_getnumber(param3);
|
||||
const char *p4Str = lua_getstring(param4);
|
||||
|
||||
warning("REMASTERED save: %d, %s, %d, %s", slot, p2Str, p3Num, p4Str);
|
||||
Common::String saveGameFilename = Common::String::format("grim_r%03d.sav", slot);
|
||||
g_grim->setSaveMetaData(p2Str, p3Num, p4Str);
|
||||
g_grim->saveGame(saveGameFilename.c_str());
|
||||
}
|
||||
|
||||
void Lua_Remastered::ShowCursor() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isnumber(param1));
|
||||
warning("Stub function: ShowCursor(%f)", lua_getnumber(param1));
|
||||
}
|
||||
|
||||
void Lua_Remastered::ReadRegistryIntValue() {
|
||||
lua_Object param1 = lua_getparam(1);
|
||||
assert(lua_isstring(param1));
|
||||
warning("Stub function: ReadRegistryIntValue(%s) returns nil", lua_getstring(param1));
|
||||
lua_pushnil();
|
||||
}
|
||||
|
||||
// Stub function for builtin functions not yet implemented
|
||||
static void stubWarning(const char *funcName) {
|
||||
warning("Stub function: %s", funcName);
|
||||
}
|
||||
/*
|
||||
static void stubError(const char *funcName) {
|
||||
error("Stub function: %s", funcName);
|
||||
}*/
|
||||
|
||||
#define STUB_FUNC(name) void name() { stubWarning(#name); }
|
||||
#define STUB_FUNC2(name) void name() { stubError(#name); }
|
||||
|
||||
STUB_FUNC(Lua_Remastered::PreloadCursors)
|
||||
STUB_FUNC(Lua_Remastered::GetFindSaveGameStatus)
|
||||
STUB_FUNC(Lua_Remastered::InitiateFindSaveGames)
|
||||
STUB_FUNC(Lua_Remastered::AreAchievementsInstalled)
|
||||
STUB_FUNC(Lua_Remastered::UnlockAchievement)
|
||||
STUB_FUNC(Lua_Remastered::SetAdvancedLighting)
|
||||
STUB_FUNC(Lua_Remastered::IsPlayingCommentary)
|
||||
STUB_FUNC(Lua_Remastered::ClearCommentary)
|
||||
STUB_FUNC(Lua_Remastered::LoadRemappedKeys)
|
||||
STUB_FUNC(Lua_Remastered::StopCommentaryImmediately)
|
||||
STUB_FUNC(Lua_Remastered::DestroyAllUIButtonsImmediately)
|
||||
STUB_FUNC(Lua_Remastered::UpdateUIButtons)
|
||||
STUB_FUNC(Lua_Remastered::OverlayClearCache)
|
||||
STUB_FUNC(Lua_Remastered::LinkHotspot)
|
||||
STUB_FUNC(Lua_Remastered::UpdateHotspot)
|
||||
STUB_FUNC(Lua_Remastered::HideMouseCursor)
|
||||
STUB_FUNC(Lua_Remastered::UpdateMouseCursor)
|
||||
STUB_FUNC(Lua_Remastered::SetActorHKHackMode)
|
||||
STUB_FUNC(Lua_Remastered::CacheCurrentWalkVector)
|
||||
STUB_FUNC(Lua_Remastered::SetKeyMappingMode)
|
||||
STUB_FUNC(Lua_Remastered::ResetKeyMappingToDefault)
|
||||
STUB_FUNC(Lua_Remastered::SaveRemappedKeys)
|
||||
STUB_FUNC(Lua_Remastered::New)
|
||||
STUB_FUNC(Lua_Remastered::RemoveBorders)
|
||||
STUB_FUNC(Lua_Remastered::GetSaveStatus)
|
||||
STUB_FUNC(Lua_Remastered::StartCheckOfCrossSaveStatus)
|
||||
STUB_FUNC(Lua_Remastered::GetCrossSaveStatus)
|
||||
STUB_FUNC(Lua_Remastered::GetFloorWalkPos)
|
||||
STUB_FUNC(Lua_Remastered::CursorMovieEnabled)
|
||||
|
||||
struct luaL_reg remasteredMainOpcodes[] = {
|
||||
{ "GetPlatform", LUA_OPCODE(Lua_Remastered, GetPlatform) },
|
||||
{ "GetLanguage", LUA_OPCODE(Lua_Remastered, GetLanguage) },
|
||||
{ "PreloadCursors", LUA_OPCODE(Lua_Remastered, PreloadCursors) },
|
||||
{ "AreAchievementsInstalled", LUA_OPCODE(Lua_Remastered, AreAchievementsInstalled) },
|
||||
{ "UnlockAchievement", LUA_OPCODE(Lua_Remastered, UnlockAchievement) },
|
||||
{ "ImGetCommentaryVol", LUA_OPCODE(Lua_Remastered, ImGetCommentaryVol) },
|
||||
{ "ImSetCommentaryVol", LUA_OPCODE(Lua_Remastered, ImSetCommentaryVol) },
|
||||
{ "SetMouseSpeedScale", LUA_OPCODE(Lua_Remastered, SetMouseSpeedScale) },
|
||||
{ "SetResolutionScaling", LUA_OPCODE(Lua_Remastered, SetResolutionScaling) },
|
||||
{ "SetAdvancedLighting", LUA_OPCODE(Lua_Remastered, SetAdvancedLighting) },
|
||||
{ "SetLanguage", LUA_OPCODE(Lua_Remastered, SetLanguage) },
|
||||
{ "PlayCurrentCommentary", LUA_OPCODE(Lua_Remastered, PlayCurrentCommentary) },
|
||||
{ "IsPlayingCommentary", LUA_OPCODE(Lua_Remastered, IsPlayingCommentary) },
|
||||
{ "EnableCommentary", LUA_OPCODE(Lua_Remastered, EnableCommentary) },
|
||||
{ "ClearCommentary", LUA_OPCODE(Lua_Remastered, ClearCommentary) },
|
||||
{ "HasHeardCommentary", LUA_OPCODE(Lua_Remastered, HasHeardCommentary) },
|
||||
{ "SetCommentary", LUA_OPCODE(Lua_Remastered, SetCommentary) },
|
||||
{ "LoadRemappedKeys", LUA_OPCODE(Lua_Remastered, LoadRemappedKeys) },
|
||||
{ "GlobalSaveResolved", LUA_OPCODE(Lua_Remastered, GlobalSaveResolved) },
|
||||
{ "StopCommentaryImmediately", LUA_OPCODE(Lua_Remastered, StopCommentaryImmediately) },
|
||||
{ "ReadRegistryIntValue", LUA_OPCODE(Lua_Remastered, ReadRegistryIntValue) },
|
||||
{ "DestroyAllUIButtonsImmediately", LUA_OPCODE(Lua_Remastered, DestroyAllUIButtonsImmediately) },
|
||||
{ "UpdateUIButtons", LUA_OPCODE(Lua_Remastered, UpdateUIButtons) },
|
||||
{ "GetGameRenderMode", LUA_OPCODE(Lua_Remastered, GetGameRenderMode) },
|
||||
{ "SetGameRenderMode", LUA_OPCODE(Lua_Remastered, SetGameRenderMode) },
|
||||
{ "WidescreenCorrectionFactor", LUA_OPCODE(Lua_Remastered, WidescreenCorrectionFactor) },
|
||||
{ "OverlayCreate", LUA_OPCODE(Lua_Remastered, OverlayCreate) },
|
||||
{ "OverlayClearCache", LUA_OPCODE(Lua_Remastered, OverlayClearCache) },
|
||||
{ "OverlayDimensions", LUA_OPCODE(Lua_Remastered, OverlayDimensions) },
|
||||
{ "OverlayDestroy", LUA_OPCODE(Lua_Remastered, OverlayDestroy) },
|
||||
{ "OverlayFade", LUA_OPCODE(Lua_Remastered, OverlayFade) },
|
||||
{ "OverlayGetScreenSize", LUA_OPCODE(Lua_Remastered, OverlayGetScreenSize) },
|
||||
{ "OverlayMove", LUA_OPCODE(Lua_Remastered, OverlayMove) },
|
||||
{ "AddHotspot", LUA_OPCODE(Lua_Remastered, AddHotspot) },
|
||||
{ "LinkHotspot", LUA_OPCODE(Lua_Remastered, LinkHotspot) },
|
||||
{ "RemoveHotspot", LUA_OPCODE(Lua_Remastered, RemoveHotspot) },
|
||||
{ "UpdateHotspot", LUA_OPCODE(Lua_Remastered, UpdateHotspot) },
|
||||
{ "QueryActiveHotspots", LUA_OPCODE(Lua_Remastered, QueryActiveHotspots) },
|
||||
{ "HideMouseCursor", LUA_OPCODE(Lua_Remastered, HideMouseCursor) },
|
||||
{ "ShowCursor", LUA_OPCODE(Lua_Remastered, ShowCursor) },
|
||||
{ "UpdateMouseCursor", LUA_OPCODE(Lua_Remastered, UpdateMouseCursor) },
|
||||
{ "GetCursorPosition", LUA_OPCODE(Lua_Remastered, GetCursorPosition) },
|
||||
{ "SetCursor", LUA_OPCODE(Lua_Remastered, SetCursor) },
|
||||
{ "UnlockCutscene", LUA_OPCODE(Lua_Remastered, UnlockCutscene) },
|
||||
{ "IsCutsceneUnlocked", LUA_OPCODE(Lua_Remastered, IsCutsceneUnlocked) },
|
||||
{ "SetActorHKHackMode", LUA_OPCODE(Lua_Remastered, SetActorHKHackMode) },
|
||||
{ "CacheCurrentWalkVector", LUA_OPCODE(Lua_Remastered, CacheCurrentWalkVector) },
|
||||
{ "UnlockConcept", LUA_OPCODE(Lua_Remastered, UnlockConcept) },
|
||||
{ "IsConceptUnlocked", LUA_OPCODE(Lua_Remastered, IsConceptUnlocked) },
|
||||
{ "GetRemappedKeyHint", LUA_OPCODE(Lua_Remastered, GetRemappedKeyHint) },
|
||||
{ "SetKeyMappingMode", LUA_OPCODE(Lua_Remastered, SetKeyMappingMode) },
|
||||
{ "ResetKeyMappingToDefault", LUA_OPCODE(Lua_Remastered, ResetKeyMappingToDefault) },
|
||||
{ "SaveRemappedKeys", LUA_OPCODE(Lua_Remastered, SaveRemappedKeys) },
|
||||
{ "SaveRegistryToDisk", LUA_OPCODE(Lua_Remastered, SaveRegistryToDisk) },
|
||||
{ "InitiateFindSaveGames", LUA_OPCODE(Lua_Remastered, InitiateFindSaveGames) },
|
||||
{ "GetFindSaveGameStatus", LUA_OPCODE(Lua_Remastered, GetFindSaveGameStatus) },
|
||||
{ "FindSaveGames", LUA_OPCODE(Lua_Remastered, FindSaveGames) },
|
||||
{ "GetRemappedKeyName", LUA_OPCODE(Lua_Remastered, GetRemappedKeyName) },
|
||||
{ "New", LUA_OPCODE(Lua_Remastered, New) },
|
||||
{ "RemoveBorders", LUA_OPCODE(Lua_Remastered, RemoveBorders) },
|
||||
{ "GetSaveStatus", LUA_OPCODE(Lua_Remastered, GetSaveStatus) },
|
||||
{ "StartCheckOfCrossSaveStatus", LUA_OPCODE(Lua_Remastered, StartCheckOfCrossSaveStatus) },
|
||||
{ "GetCrossSaveStatus", LUA_OPCODE(Lua_Remastered, GetCrossSaveStatus) },
|
||||
{ "GetFloorWalkPos", LUA_OPCODE(Lua_Remastered, GetFloorWalkPos) },
|
||||
{ "CursorMovieEnabled", LUA_OPCODE(Lua_Remastered, CursorMovieEnabled) },
|
||||
};
|
||||
|
||||
void Lua_Remastered::registerOpcodes() {
|
||||
Lua_V1::registerOpcodes();
|
||||
|
||||
// Register main opcodes functions
|
||||
luaL_openlib(remasteredMainOpcodes, ARRAYSIZE(remasteredMainOpcodes));
|
||||
}
|
||||
|
||||
} // end of namespace Grim
|
||||
113
engines/grim/remastered/lua_remastered.h
Normal file
113
engines/grim/remastered/lua_remastered.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/* 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 GRIM_LUA_REMASTERED
|
||||
#define GRIM_LUA_REMASTERED
|
||||
|
||||
#include "engines/grim/lua_v1.h"
|
||||
#include "engines/grim/remastered/commentary.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
class Lua_Remastered : public Lua_V1 {
|
||||
public:
|
||||
typedef Lua_Remastered LuaClass;
|
||||
void registerOpcodes() override;
|
||||
|
||||
protected:
|
||||
|
||||
// Overrides from Lua_V1
|
||||
DECLARE_LUA_OPCODE(GetFontDimensions) override;
|
||||
DECLARE_LUA_OPCODE(GetTextObjectDimensions) override;
|
||||
DECLARE_LUA_OPCODE(Load) override;
|
||||
DECLARE_LUA_OPCODE(Save) override;
|
||||
|
||||
// Remastered
|
||||
DECLARE_LUA_OPCODE(GetPlatform);
|
||||
DECLARE_LUA_OPCODE(GetLanguage);
|
||||
DECLARE_LUA_OPCODE(PreloadCursors);
|
||||
DECLARE_LUA_OPCODE(ReadRegistryIntValue);
|
||||
DECLARE_LUA_OPCODE(WidescreenCorrectionFactor);
|
||||
DECLARE_LUA_OPCODE(InitiateFindSaveGames);
|
||||
DECLARE_LUA_OPCODE(FindSaveGames);
|
||||
DECLARE_LUA_OPCODE(GetFindSaveGameStatus);
|
||||
DECLARE_LUA_OPCODE(AreAchievementsInstalled);
|
||||
DECLARE_LUA_OPCODE(UnlockAchievement);
|
||||
DECLARE_LUA_OPCODE(ImGetCommentaryVol);
|
||||
DECLARE_LUA_OPCODE(ImSetCommentaryVol);
|
||||
DECLARE_LUA_OPCODE(SetMouseSpeedScale);
|
||||
DECLARE_LUA_OPCODE(SetResolutionScaling);
|
||||
DECLARE_LUA_OPCODE(SetAdvancedLighting);
|
||||
DECLARE_LUA_OPCODE(SetLanguage);
|
||||
DECLARE_LUA_OPCODE(PlayCurrentCommentary);
|
||||
DECLARE_LUA_OPCODE(IsPlayingCommentary);
|
||||
DECLARE_LUA_OPCODE(EnableCommentary);
|
||||
DECLARE_LUA_OPCODE(ClearCommentary);
|
||||
DECLARE_LUA_OPCODE(HasHeardCommentary);
|
||||
DECLARE_LUA_OPCODE(SetCommentary);
|
||||
DECLARE_LUA_OPCODE(LoadRemappedKeys);
|
||||
DECLARE_LUA_OPCODE(GlobalSaveResolved);
|
||||
DECLARE_LUA_OPCODE(StopCommentaryImmediately);
|
||||
DECLARE_LUA_OPCODE(DestroyAllUIButtonsImmediately);
|
||||
DECLARE_LUA_OPCODE(UpdateUIButtons);
|
||||
DECLARE_LUA_OPCODE(OverlayClearCache);
|
||||
DECLARE_LUA_OPCODE(GetGameRenderMode);
|
||||
DECLARE_LUA_OPCODE(SetGameRenderMode);
|
||||
DECLARE_LUA_OPCODE(OverlayMove);
|
||||
DECLARE_LUA_OPCODE(OverlayCreate);
|
||||
DECLARE_LUA_OPCODE(OverlayDestroy);
|
||||
DECLARE_LUA_OPCODE(OverlayFade);
|
||||
DECLARE_LUA_OPCODE(OverlayGetScreenSize);
|
||||
DECLARE_LUA_OPCODE(OverlayDimensions);
|
||||
DECLARE_LUA_OPCODE(AddHotspot);
|
||||
DECLARE_LUA_OPCODE(LinkHotspot);
|
||||
DECLARE_LUA_OPCODE(RemoveHotspot);
|
||||
DECLARE_LUA_OPCODE(UpdateHotspot);
|
||||
DECLARE_LUA_OPCODE(QueryActiveHotspots);
|
||||
DECLARE_LUA_OPCODE(HideMouseCursor);
|
||||
DECLARE_LUA_OPCODE(SetCursor);
|
||||
DECLARE_LUA_OPCODE(ShowCursor);
|
||||
DECLARE_LUA_OPCODE(UpdateMouseCursor);
|
||||
DECLARE_LUA_OPCODE(GetCursorPosition);
|
||||
DECLARE_LUA_OPCODE(UnlockCutscene);
|
||||
DECLARE_LUA_OPCODE(IsCutsceneUnlocked);
|
||||
DECLARE_LUA_OPCODE(SetActorHKHackMode);
|
||||
DECLARE_LUA_OPCODE(CacheCurrentWalkVector);
|
||||
DECLARE_LUA_OPCODE(UnlockConcept);
|
||||
DECLARE_LUA_OPCODE(IsConceptUnlocked);
|
||||
DECLARE_LUA_OPCODE(SaveRegistryToDisk);
|
||||
DECLARE_LUA_OPCODE(GetRemappedKeyName);
|
||||
DECLARE_LUA_OPCODE(GetRemappedKeyHint);
|
||||
DECLARE_LUA_OPCODE(SetKeyMappingMode);
|
||||
DECLARE_LUA_OPCODE(ResetKeyMappingToDefault);
|
||||
DECLARE_LUA_OPCODE(SaveRemappedKeys);
|
||||
DECLARE_LUA_OPCODE(New);
|
||||
DECLARE_LUA_OPCODE(RemoveBorders);
|
||||
DECLARE_LUA_OPCODE(GetSaveStatus);
|
||||
DECLARE_LUA_OPCODE(StartCheckOfCrossSaveStatus);
|
||||
DECLARE_LUA_OPCODE(GetCrossSaveStatus);
|
||||
DECLARE_LUA_OPCODE(GetFloorWalkPos);
|
||||
DECLARE_LUA_OPCODE(CursorMovieEnabled);
|
||||
};
|
||||
|
||||
} // end of namespace Grim
|
||||
|
||||
#endif
|
||||
55
engines/grim/remastered/overlay.cpp
Normal file
55
engines/grim/remastered/overlay.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/* 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 "image/png.h"
|
||||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
#include "engines/grim/remastered/overlay.h"
|
||||
#include "engines/grim/resource.h"
|
||||
#include "engines/grim/material.h"
|
||||
#include "engines/grim/gfx_base.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
Overlay::Overlay(const Common::String &filename, Common::SeekableReadStream *data) :
|
||||
_x(0), _y(0) {
|
||||
_material = g_resourceloader->loadMaterial(filename, nullptr, true);
|
||||
}
|
||||
|
||||
Overlay::~Overlay() {
|
||||
delete _material;
|
||||
}
|
||||
|
||||
void Overlay::draw() {
|
||||
_material->select();
|
||||
g_driver->drawOverlay(this);
|
||||
}
|
||||
|
||||
int Overlay::getWidth() const {
|
||||
return _material->getData()->_textures[0]->_width;
|
||||
}
|
||||
|
||||
int Overlay::getHeight() const {
|
||||
return _material->getData()->_textures[0]->_height;
|
||||
}
|
||||
|
||||
}
|
||||
55
engines/grim/remastered/overlay.h
Normal file
55
engines/grim/remastered/overlay.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* 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 GRIM_OVERLAY_H
|
||||
#define GRIM_OVERLAY_H
|
||||
|
||||
#include "common/endian.h"
|
||||
|
||||
#include "engines/grim/pool.h"
|
||||
|
||||
namespace Grim {
|
||||
|
||||
class Material;
|
||||
|
||||
class Overlay : public PoolObject<Overlay> {
|
||||
public:
|
||||
Overlay(const Common::String &filename, Common::SeekableReadStream *data);
|
||||
~Overlay();
|
||||
|
||||
void draw();
|
||||
void setPos(float x, float y) { _x = x; _y = y; }
|
||||
void setLayer(int layer) { _layer = layer; }
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
|
||||
static int32 getStaticTag() { return MKTAG('O','V','E','R'); }
|
||||
|
||||
//private:
|
||||
Material *_material;
|
||||
float _x;
|
||||
float _y;
|
||||
int _layer = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user