aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMax Horn2008-09-17 17:31:29 +0000
committerMax Horn2008-09-17 17:31:29 +0000
commita6dd4b7d4d8e3f5f4e63c20334f7f8b0ab9f0bef (patch)
tree60029a6455721025780f03cb472ae533dc202050 /base
parent2bcc5681d87dac00ad7ac53c5e4d91dc1201c73e (diff)
downloadscummvm-rg350-a6dd4b7d4d8e3f5f4e63c20334f7f8b0ab9f0bef.tar.gz
scummvm-rg350-a6dd4b7d4d8e3f5f4e63c20334f7f8b0ab9f0bef.tar.bz2
scummvm-rg350-a6dd4b7d4d8e3f5f4e63c20334f7f8b0ab9f0bef.zip
Moved base/game.* to engines/game.*
svn-id: r34589
Diffstat (limited to 'base')
-rw-r--r--base/game.cpp116
-rw-r--r--base/game.h210
-rw-r--r--base/module.mk1
3 files changed, 0 insertions, 327 deletions
diff --git a/base/game.cpp b/base/game.cpp
deleted file mode 100644
index 7dff13e5f2..0000000000
--- a/base/game.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "base/game.h"
-#include "base/plugins.h"
-#include "graphics/surface.h"
-
-
-const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list) {
- const PlainGameDescriptor *g = list;
- while (g->gameid) {
- if (0 == scumm_stricmp(gameid, g->gameid))
- return g;
- g++;
- }
- return 0;
-}
-
-void GameDescriptor::updateDesc(const char *extra) {
- // TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone.
- // We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or
- // the seperator (instead of '/' use ', ' or ' ').
- const bool hasCustomLanguage = (language() != Common::UNK_LANG);
- const bool hasCustomPlatform = (platform() != Common::kPlatformUnknown);
- const bool hasExtraDesc = (extra && extra[0]);
-
- // Adapt the description string if custom platform/language is set.
- if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) {
- Common::String descr = description();
-
- descr += " (";
- if (hasExtraDesc)
- descr += extra;
- if (hasCustomPlatform) {
- if (hasExtraDesc)
- descr += "/";
- descr += Common::getPlatformDescription(platform());
- }
- if (hasCustomLanguage) {
- if (hasExtraDesc || hasCustomPlatform)
- descr += "/";
- descr += Common::getLanguageDescription(language());
- }
- descr += ")";
- setVal("description", descr);
- }
-}
-
-void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) {
- if (_thumbnail.get() == t)
- return;
-
- _thumbnail = Common::SharedPtr<Graphics::Surface>(t, Graphics::SharedPtrSurfaceDeleter());
-}
-
-bool SaveStateDescriptor::getBool(const Common::String &key) const {
- if (contains(key)) {
- Common::String value = getVal(key);
- if (value.equalsIgnoreCase("true") ||
- value.equalsIgnoreCase("yes") ||
- value.equals("1"))
- return true;
- if (value.equalsIgnoreCase("false") ||
- value.equalsIgnoreCase("no") ||
- value.equals("0"))
- return false;
- error("SaveStateDescriptor: %s '%s' has unknown value '%s' for boolean '%s'",
- save_slot().c_str(), description().c_str(), value.c_str(), key.c_str());
- }
- return false;
-}
-
-void SaveStateDescriptor::setDeletableFlag(bool state) {
- setVal("is_deletable", state ? "true" : "false");
-}
-
-void SaveStateDescriptor::setSaveDate(int year, int month, int day) {
- char buffer[32];
- snprintf(buffer, 32, "%.2d.%.2d.%.4d", day, month, year);
- setVal("save_date", buffer);
-}
-
-void SaveStateDescriptor::setSaveTime(int hour, int min) {
- char buffer[32];
- snprintf(buffer, 32, "%.2d:%.2d", hour, min);
- setVal("save_time", buffer);
-}
-
-void SaveStateDescriptor::setPlayTime(int hours, int minutes) {
- char buffer[32];
- snprintf(buffer, 32, "%.2d:%.2d", hours, minutes);
- setVal("play_time", buffer);
-}
-
diff --git a/base/game.h b/base/game.h
deleted file mode 100644
index 8fd1b47422..0000000000
--- a/base/game.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef BASE_GAME_H
-#define BASE_GAME_H
-
-#include "common/str.h"
-#include "common/array.h"
-#include "common/hash-str.h"
-#include "common/ptr.h"
-
-namespace Graphics {
- struct Surface;
-}
-
-/**
- * A simple structure used to map gameids (like "monkey", "sword1", ...) to
- * nice human readable and descriptive game titles (like "The Secret of Monkey Island").
- * This is a plain struct to make it possible to declare NULL-terminated C arrays
- * consisting of PlainGameDescriptors.
- */
-struct PlainGameDescriptor {
- const char *gameid;
- const char *description;
-};
-
-/**
- * Given a list of PlainGameDescriptors, returns the first PlainGameDescriptor
- * matching the given gameid. If not match is found return 0.
- * The end of the list must marked by a PlainGameDescriptor with gameid equal to 0.
- */
-const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list);
-
-/**
- * A hashmap describing details about a given game. In a sense this is a refined
- * version of PlainGameDescriptor, as it also contains a gameid and a description string.
- * But in addition, platform and language settings, as well as arbitrary other settings,
- * can be contained in a GameDescriptor.
- * This is an essential part of the glue between the game engines and the launcher code.
- */
-class GameDescriptor : public Common::StringMap {
-public:
- GameDescriptor() {
- setVal("gameid", "");
- setVal("description", "");
- }
-
- GameDescriptor(const PlainGameDescriptor &pgd) {
- setVal("gameid", pgd.gameid);
- setVal("description", pgd.description);
- }
-
- GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l = Common::UNK_LANG,
- Common::Platform p = Common::kPlatformUnknown) {
- setVal("gameid", g);
- setVal("description", d);
- if (l != Common::UNK_LANG)
- setVal("language", Common::getLanguageCode(l));
- if (p != Common::kPlatformUnknown)
- setVal("platform", Common::getPlatformCode(p));
- }
-
- /**
- * Update the description string by appending (LANG/PLATFORM/EXTRA) to it.
- */
- void updateDesc(const char *extra = 0);
-
- Common::String &gameid() { return getVal("gameid"); }
- Common::String &description() { return getVal("description"); }
- const Common::String &gameid() const { return getVal("gameid"); }
- const Common::String &description() const { return getVal("description"); }
- Common::Language language() const { return contains("language") ? Common::parseLanguage(getVal("language")) : Common::UNK_LANG; }
- Common::Platform platform() const { return contains("platform") ? Common::parsePlatform(getVal("platform")) : Common::kPlatformUnknown; }
-
- const Common::String &preferredtarget() const {
- return contains("preferredtarget") ? getVal("preferredtarget") : getVal("gameid");
- }
-};
-
-/** List of games. */
-class GameList : public Common::Array<GameDescriptor> {
-public:
- GameList() {}
- GameList(const GameList &list) : Common::Array<GameDescriptor>(list) {}
- GameList(const PlainGameDescriptor *g) {
- while (g->gameid) {
- push_back(GameDescriptor(g->gameid, g->description));
- g++;
- }
- }
-};
-
-/**
- * A hashmap describing details about a given save state.
- * TODO
- * Guaranteed to contain save_slot, filename and description values.
- * Additional ideas: Playtime, creation date, thumbnail, ...
- */
-class SaveStateDescriptor : public Common::StringMap {
-protected:
- Common::SharedPtr<Graphics::Surface> _thumbnail; // can be 0
-
-public:
- SaveStateDescriptor() : _thumbnail() {
- setVal("save_slot", "-1"); // FIXME: default to 0 (first slot) or to -1 (invalid slot) ?
- setVal("description", "");
- setVal("filename", "");
- }
-
- SaveStateDescriptor(int s, const Common::String &d, const Common::String &f) : _thumbnail() {
- char buf[16];
- sprintf(buf, "%d", s);
- setVal("save_slot", buf);
- setVal("description", d);
- setVal("filename", f);
- }
-
- SaveStateDescriptor(const Common::String &s, const Common::String &d, const Common::String &f) : _thumbnail() {
- setVal("save_slot", s);
- setVal("description", d);
- setVal("filename", f);
- }
-
- /** The saveslot id, as it would be passed to the "-x" command line switch. */
- Common::String &save_slot() { return getVal("save_slot"); }
-
- /** The saveslot id, as it would be passed to the "-x" command line switch (read-only variant). */
- const Common::String &save_slot() const { return getVal("save_slot"); }
-
- /** A human readable description of the save state. */
- Common::String &description() { return getVal("description"); }
-
- /** A human readable description of the save state (read-only variant). */
- const Common::String &description() const { return getVal("description"); }
-
- /** The filename of the savestate, for use with the SaveFileManager API. */
- Common::String &filename() { return getVal("filename"); }
-
- /** The filename of the savestate, for use with the SaveFileManager API (read-only variant). */
- const Common::String &filename() const { return getVal("filename"); }
-
- /** Optional entries only included when querying via MetaEngine::querySaveMetaInfo */
-
- /**
- * Returns the value of a given key as boolean.
- * It accepts 'true', 'yes' and '1' for true and
- * 'false', 'no' and '0' for false.
- * (FIXME:) On unknown value it errors out ScummVM.
- * On unknown key it returns false as default.
- */
- bool getBool(const Common::String &key) const;
-
- /**
- * Sets the 'is_deletable' key, which indicates, if the
- * given savestate is safe for deletion.
- */
- void setDeletableFlag(bool state);
-
- /**
- * Return a thumbnail graphics surface representing the savestate visually
- * This is usually a scaled down version of the game graphics. The size
- * should be either 160x100 or 160x120 pixels, depending on the aspect
- * ratio of the game. If another ratio is required, contact the core team.
- */
- const Graphics::Surface *getThumbnail() const { return _thumbnail.get(); }
-
- void setThumbnail(Graphics::Surface *t);
-
- /**
- * Sets the 'save_date' key properly, based on the given values
- */
- void setSaveDate(int year, int month, int day);
-
- /**
- * Sets the 'save_time' key properly, based on the given values
- */
- void setSaveTime(int hour, int min);
-
- /**
- * Sets the 'play_time' key properly, based on the given values
- */
- void setPlayTime(int hours, int minutes);
-};
-
-/** List of savestates. */
-typedef Common::Array<SaveStateDescriptor> SaveStateList;
-
-#endif
diff --git a/base/module.mk b/base/module.mk
index dd89c5fb2d..f12a710920 100644
--- a/base/module.mk
+++ b/base/module.mk
@@ -3,7 +3,6 @@ MODULE := base
MODULE_OBJS := \
main.o \
commandLine.o \
- game.o \
plugins.o \
version.o