GRIM: Post branch merge fixes.

This commit is contained in:
Pawel Kolodziejski 2020-10-07 19:50:27 +02:00
parent 6e619ca714
commit 3d74c3dd4d
12 changed files with 54 additions and 44 deletions

View File

@ -109,6 +109,11 @@ static Common::String generatePreferredTarget(const ADGameDescription *desc) {
res = res + "-cd";
}
// ResidualVM - start:
if (desc->flags & ADGF_REMASTERED) {
res = res + "-remastered";
}
// ResidualVM end
if (desc->platform != Common::kPlatformDOS && desc->platform != Common::kPlatformUnknown && !(desc->flags & ADGF_DROPPLATFORM)) {
res = res + "-" + getPlatformAbbrev(desc->platform);
}

View File

@ -67,6 +67,7 @@ struct ADGameFileDescription {
enum ADGameFlags {
ADGF_NO_FLAGS = 0,
ADGF_REMASTERED = (1 << 19), ///< add "-remastered' to gameid // ResidualVM
ADGF_AUTOGENTARGET = (1 << 20), ///< automatically generate gameid from extra
ADGF_UNSTABLE = (1 << 21), ///< flag to designate not yet officially-supported games that are not fit for public testing
ADGF_TESTING = (1 << 22), ///< flag to designate not yet officially-supported games that are fit for public testing
@ -77,8 +78,7 @@ enum ADGameFlags {
ADGF_DROPLANGUAGE = (1 << 27), ///< don't add language to gameid
ADGF_DROPPLATFORM = (1 << 28), ///< don't add platform to gameid
ADGF_CD = (1 << 29), ///< add "-cd" to gameid
ADGF_DEMO = (1 << 30), ///< add "-demo" to gameid
ADGF_REMASTERED = (1 << 31) ///< remastered
ADGF_DEMO = (1 << 30) ///< add "-demo" to gameid
};
struct ADGameDescription {

View File

@ -333,7 +333,7 @@ static const GrimGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_REMASTERED,
GUIO1(GAMEOPTION_LOAD_DATAUSR)
GUI_OPTIONS_GRIME
},
GType_GRIM
},

View File

@ -85,8 +85,6 @@ void Font::load(const Common::String &filename, Common::SeekableReadStream *data
g_driver->createFont(this);
}
uint16 Font::getCharIndex(unsigned char c) const {
uint16 c2 = uint16(c);

View File

@ -93,8 +93,7 @@ private:
void *_userData;
};
class FontTTF : public Font
{
class FontTTF : public Font {
public:
void loadTTF(const Common::String &filename, Common::SeekableReadStream *data, int size);

View File

@ -1432,6 +1432,9 @@ struct TextObjectUserData {
};
void GfxOpenGL::createTextObject(TextObject *text) {
if (g_grim->getGameType() != GType_GRIM || !(g_grim->getGameFlags() & ADGF_REMASTERED))
return;
//error("Could not get font userdata");
const Font *font = text->getFont();
const FontTTF *f = static_cast<const FontTTF *>(font);
@ -1463,7 +1466,6 @@ void GfxOpenGL::createTextObject(TextObject *text) {
ud->_texids = texids;
text->setUserData(ud);
}
void GfxOpenGL::drawTextObject(const TextObject *text) {
@ -1589,7 +1591,7 @@ void GfxOpenGL::drawTextObject(const TextObject *text) {
}
void GfxOpenGL::destroyTextObject(TextObject *text) {
TextObjectUserData *ud = (TextObjectUserData *)text->getUserData();
TextObjectUserData *ud = (TextObjectUserData *)const_cast<void *>(text->getUserData());
glDeleteTextures(text->getNumLines(), ud->_texids);
delete ud;
}

View File

@ -380,7 +380,11 @@ Common::Error GrimEngine::run() {
g_sound = new SoundPlayer();
bool fullscreen = ConfMan.getBool("fullscreen");
g_driver->setupScreen(640, 480, fullscreen);
if (getGameType() == GType_GRIM && (g_grim->getGameFlags() & ADGF_REMASTERED)) {
g_driver = createRenderer(1600, 900, fullscreen);
} else {
g_driver = createRenderer(640, 480, fullscreen);
}
if (getGameType() == GType_MONKEY4 && SearchMan.hasFile("AMWI.m4b")) {
// Play EMI Mac Aspyr logo
@ -1114,8 +1118,6 @@ void GrimEngine::mainLoop() {
}
}
if (_mode != PauseMode) {
// Draw the display scene before doing the luaUpdate.
// This give a large performance boost as OpenGL stores commands
@ -1301,7 +1303,7 @@ void GrimEngine::restoreGRIM() {
}
void GrimEngine::storeSaveGameMetadata(SaveGame *state) {
if (!g_grim->getGameFlags() & ADGF_REMASTERED) {
if (!(g_grim->getGameFlags() & ADGF_REMASTERED)) {
return;
}
state->beginSection('META');

View File

@ -33,7 +33,6 @@ namespace Grim {
Localizer *g_localizer = nullptr;
Localizer::Localizer() {
// To avoid too wide lines further below, we just name these here.
bool isAnyDemo = g_grim->getGameFlags() & ADGF_DEMO;

View File

@ -243,14 +243,14 @@ int32 luaD_call(StkId base, int32 nResults) {
// when in year 4 bi.exit() calls bi.book.act:free(). But bi.book.act is nil,
// hence it enters this branch and the error blocks the game.
// Now we try instead to survive and go on with the function.
/*lua_Task *t = lua_state->task;
lua_Task *t = lua_state->task;
lua_state->task = t->next;
lua_state->some_task = tmpTask;
luaM_free(t);
warning("Lua: call expression not a function");
return 1;*/
lua_error("call expression not a function");
return 1;
// lua_error("call expression not a function");
}
luaD_callTM(im, (lua_state->stack.top - lua_state->stack.stack) - (base - 1), nResults);
continue;

View File

@ -174,7 +174,7 @@ void Lua_Remastered::QueryActiveHotspots() {
assert(lua_isnumber(param));
warning("Stub function: QueryActiveHotspots(%d)", lua_getnumber(param));
warning("Stub function: QueryActiveHotspots(%f)", lua_getnumber(param));
// TODO: Handle coord scaling better
float scaleX = 1920.0f/1600;
@ -239,7 +239,7 @@ void Lua_Remastered::SetCursor() {
assert(lua_isnumber(param1));
warning("Stub function: SetCursor(%d)", lua_getnumber(param1));
warning("Stub function: SetCursor(%f)", lua_getnumber(param1));
}
void Lua_Remastered::GetPlatform() {
@ -469,7 +469,7 @@ void Lua_Remastered::FindSaveGames() {
Common::String str1;
Common::String str2;
int x;
int32 dataSize = savedState->beginSection('META');
/*int32 dataSize = */savedState->beginSection('META');
char str[200] = {};
int32 strSize = 0;
@ -582,10 +582,10 @@ void Lua_Remastered::ReadRegistryIntValue() {
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); }

View File

@ -36,10 +36,10 @@ public:
protected:
// Overrides from Lua_V1
DECLARE_LUA_OPCODE(GetFontDimensions);
DECLARE_LUA_OPCODE(GetTextObjectDimensions);
DECLARE_LUA_OPCODE(Load);
DECLARE_LUA_OPCODE(Save);
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);

View File

@ -80,7 +80,10 @@ ResourceLoader::ResourceLoader() {
Common::ArchiveMemberList files, updFiles;
//Load the update from the executable, if needed
const char *updateFilename = NULL;//g_grim->getUpdateFilename();
const char *updateFilename = nullptr;
if (g_grim->getGameType() == GType_GRIM && !(g_grim->getGameFlags() & ADGF_REMASTERED)) {
updateFilename = g_grim->getUpdateFilename();
}
if (updateFilename) {
Common::File *updStream = new Common::File();
if (updStream && updStream->open(updateFilename)) {
@ -365,6 +368,7 @@ Costume *ResourceLoader::loadCostume(const Common::String &filename, Actor *owne
Font *ResourceLoader::loadFont(const Common::String &filename) {
Common::SeekableReadStream *stream;
if (g_grim->getGameType() == GType_GRIM && (g_grim->getGameFlags() & ADGF_REMASTERED)) {
Common::String name = "FontsHD/" + filename + ".txt";
stream = openNewStreamFile(name, true);
if (stream) {
@ -385,6 +389,7 @@ Font *ResourceLoader::loadFont(const Common::String &filename) {
result->loadTTF(font, stream, s);
return result;
}
}
stream = openNewStreamFile(filename.c_str(), true);
if (!stream)