Modified SAGA engine to use DetectedGame::updateDesc (note: there is a new TODO in the saveload code now)

svn-id: r21171
This commit is contained in:
Max Horn 2006-03-09 13:22:30 +00:00
parent 783264fe28
commit aad520026c
3 changed files with 48 additions and 36 deletions

View file

@ -943,7 +943,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_DEMO_G, // Game id GID_ITE_DEMO_G, // Game id
"Inherit the Earth: Quest for the Orb (DOS Demo)", // Game title "Demo", // Game title
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, // Starting scene number ITE_DEFAULT_SCENE, // Starting scene number
&ITEDemo_Resources, &ITEDemo_Resources,
@ -966,7 +966,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_MACDEMO2, GID_ITE_MACDEMO2,
"Inherit the Earth: Quest for the Orb (MAC Demo)", "Demo",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -989,7 +989,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_MACDEMO1, GID_ITE_MACDEMO1,
"Inherit the Earth: Quest for the Orb (early MAC Demo)", "early Demo",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1012,7 +1012,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_MACCD_G, GID_ITE_MACCD_G,
"Inherit the Earth: Quest for the Orb (MAC CD)", "CD",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1035,7 +1035,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_MACCD, GID_ITE_MACCD,
"Inherit the Earth: Quest for the Orb (Wyrmkeep MAC CD)", "Wyrmkeep CD",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1059,7 +1059,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_LINDEMO, GID_ITE_LINDEMO,
"Inherit the Earth: Quest for the Orb (Linux Demo)", "Demo",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1082,7 +1082,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_WINDEMO2, GID_ITE_WINDEMO2,
"Inherit the Earth: Quest for the Orb (Win32 Demo)", "Demo",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1105,7 +1105,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_WINDEMO1, GID_ITE_WINDEMO1,
"Inherit the Earth: Quest for the Orb (early Win32 Demo)", "early Demo",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1128,7 +1128,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_MULTICD, GID_ITE_MULTICD,
"Inherit the Earth: Quest for the Orb (Multi-OS CD Version)", "Multi-OS CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1151,7 +1151,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_LINCD, GID_ITE_LINCD,
"Inherit the Earth: Quest for the Orb (Linux CD Version)", "CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1174,7 +1174,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_WINCD, GID_ITE_WINCD,
"Inherit the Earth: Quest for the Orb (Win32 CD Version)", "CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1197,7 +1197,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_CD_G, GID_ITE_CD_G,
"Inherit the Earth: Quest for the Orb (DOS CD Version)", "CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1220,7 +1220,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_CD_G2, GID_ITE_CD_G2,
"Inherit the Earth: Quest for the Orb (DOS CD Version)", "CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1243,7 +1243,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_CD_DE, GID_ITE_CD_DE,
"Inherit the Earth: Quest for the Orb (De DOS CD Version)", "CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1266,7 +1266,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_CD_DE2, GID_ITE_CD_DE2,
"Inherit the Earth: Quest for the Orb (De DOS CD Version)", "CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1289,7 +1289,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_CD, GID_ITE_CD,
"Inherit the Earth: Quest for the Orb (DOS CD Version)", "CD Version",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1312,7 +1312,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_DISK_DE, GID_ITE_DISK_DE,
"Inherit the Earth: Quest for the Orb (De DOS Floppy)", "Floppy",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1335,7 +1335,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_DISK_DE2, GID_ITE_DISK_DE2,
"Inherit the Earth: Quest for the Orb (De DOS Floppy)", "Floppy",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1358,7 +1358,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_DISK_G, GID_ITE_DISK_G,
"Inherit the Earth: Quest for the Orb (DOS Floppy)", "Floppy",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1381,7 +1381,7 @@ static GameDescription gameDescriptions[] = {
"ite", "ite",
GType_ITE, GType_ITE,
GID_ITE_DISK_G2, GID_ITE_DISK_G2,
"Inherit the Earth: Quest for the Orb (DOS Floppy)", "Floppy",
&ITE_DisplayInfo, &ITE_DisplayInfo,
ITE_DEFAULT_SCENE, ITE_DEFAULT_SCENE,
&ITE_Resources, &ITE_Resources,
@ -1404,7 +1404,7 @@ static GameDescription gameDescriptions[] = {
"ihnm", "ihnm",
GType_IHNM, GType_IHNM,
GID_IHNM_DEMO, GID_IHNM_DEMO,
"I Have No Mouth and I Must Scream (DOS Demo)", "Demo",
&IHNM_DisplayInfo, &IHNM_DisplayInfo,
0, 0,
&IHNM_Resources, &IHNM_Resources,
@ -1427,7 +1427,7 @@ static GameDescription gameDescriptions[] = {
"ihnm", "ihnm",
GType_IHNM, GType_IHNM,
GID_IHNM_CD, GID_IHNM_CD,
"I Have No Mouth and I Must Scream (DOS)", "",
&IHNM_DisplayInfo, &IHNM_DisplayInfo,
IHNM_DEFAULT_SCENE, IHNM_DEFAULT_SCENE,
&IHNM_Resources, &IHNM_Resources,
@ -1450,7 +1450,7 @@ static GameDescription gameDescriptions[] = {
"ihnm", "ihnm",
GType_IHNM, GType_IHNM,
GID_IHNM_CD_DE, GID_IHNM_CD_DE,
"I Have No Mouth and I Must Scream (DE DOS)", "",
&IHNM_DisplayInfo, &IHNM_DisplayInfo,
IHNM_DEFAULT_SCENE, IHNM_DEFAULT_SCENE,
&IHNM_Resources, &IHNM_Resources,
@ -1472,7 +1472,7 @@ static GameDescription gameDescriptions[] = {
"ihnm", "ihnm",
GType_IHNM, GType_IHNM,
GID_IHNM_CD_ES, GID_IHNM_CD_ES,
"I Have No Mouth and I Must Scream (Sp DOS)", "",
&IHNM_DisplayInfo, &IHNM_DisplayInfo,
IHNM_DEFAULT_SCENE, IHNM_DEFAULT_SCENE,
&IHNM_Resources, &IHNM_Resources,
@ -1494,7 +1494,7 @@ static GameDescription gameDescriptions[] = {
"ihnm", "ihnm",
GType_IHNM, GType_IHNM,
GID_IHNM_CD_RU, GID_IHNM_CD_RU,
"I Have No Mouth and I Must Scream (Ru DOS)", "",
&IHNM_DisplayInfo, &IHNM_DisplayInfo,
IHNM_DEFAULT_SCENE, IHNM_DEFAULT_SCENE,
&IHNM_Resources, &IHNM_Resources,
@ -1516,7 +1516,7 @@ static GameDescription gameDescriptions[] = {
"ihnm", "ihnm",
GType_IHNM, GType_IHNM,
GID_IHNM_CD_FR, GID_IHNM_CD_FR,
"I Have No Mouth and I Must Scream (Fr DOS)", "",
&IHNM_DisplayInfo, &IHNM_DisplayInfo,
IHNM_DEFAULT_SCENE, IHNM_DEFAULT_SCENE,
&IHNM_Resources, &IHNM_Resources,
@ -1567,7 +1567,7 @@ bool SagaEngine::initGame() {
language != Common::UNK_LANG) || language != Common::UNK_LANG) ||
(gameDescriptions[matches[i]].platform != platform && (gameDescriptions[matches[i]].platform != platform &&
platform != Common::kPlatformUnknown)) { platform != Common::kPlatformUnknown)) {
debug(2, "Purged (pass 2) %s", gameDescriptions[matches[i]].title); debug(2, "Purged (pass 2) %d (%s)", matches[i], gameDescriptions[matches[i]].extra);
matches[i] = -1; matches[i] = -1;
} }
else else
@ -1591,7 +1591,7 @@ bool SagaEngine::initGame() {
error("SagaEngine::loadGame wrong gameNumber"); error("SagaEngine::loadGame wrong gameNumber");
} }
debug(2, "Running %s", gameDescriptions[gameNumber].title); debug(2, "Running %d (%s)", gameNumber, gameDescriptions[gameNumber].extra);
_gameNumber = gameNumber; _gameNumber = gameNumber;
_gameDescription = &gameDescriptions[gameNumber]; _gameDescription = &gameDescriptions[gameNumber];
@ -1645,7 +1645,7 @@ DetectedGameList GAME_ProbeGame(const FSList &fslist, int **retmatches) {
if (gameMD5[j].id == gameDescriptions[matches[i]].gameId) if (gameMD5[j].id == gameDescriptions[matches[i]].gameId)
count++; count++;
if (count < maxcount) { if (count < maxcount) {
debug(2, "Purged: %s", gameDescriptions[matches[i]].title); debug(2, "Purged: %d (%s)", matches[i], gameDescriptions[matches[i]].extra);
matches[i] = -1; matches[i] = -1;
} }
} }
@ -1656,9 +1656,14 @@ DetectedGameList GAME_ProbeGame(const FSList &fslist, int **retmatches) {
for (i = 0; i < index; i++) for (i = 0; i < index; i++)
if (matches[i] != -1) { if (matches[i] != -1) {
GameDescription &g = gameDescriptions[matches[i]]; GameDescription &g = gameDescriptions[matches[i]];
detectedGames.push_back(DetectedGame(g.name, g.title, const char *title = 0;
g.language, if (g.gameType == GType_ITE)
g.platform)); title = "Inherit the Earth: Quest for the Orb";
else if (g.gameType == GType_IHNM)
title = "I Have No Mouth and I Must Scream";
DetectedGame dg(g.name, title, g.language, g.platform);
dg.updateDesc(g.extra);
detectedGames.push_back(dg);
} }
if (retmatches) { if (retmatches) {
@ -1757,7 +1762,7 @@ int detectGame(const FSList &fslist, bool mode, int start) {
} else { } else {
bool match = true; bool match = true;
debug(2, "Probing game: %s", gameDescriptions[game_n].title); debug(2, "Probing game: %d (%s)", game_n, gameDescriptions[game_n].extra);
for (int i = 0; i < ARRAYSIZE(gameMD5); i++) { for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
if (gameMD5[i].id == gameDescriptions[game_n].gameId) { if (gameMD5[i].id == gameDescriptions[game_n].gameId) {
@ -1772,7 +1777,7 @@ int detectGame(const FSList &fslist, bool mode, int start) {
if (!match) if (!match)
continue; continue;
debug(2, "Found game: %s", gameDescriptions[game_n].title); debug(2, "Found game: %d (%s)", game_n, gameDescriptions[game_n].extra);
return game_n; return game_n;
} }

View file

@ -500,7 +500,7 @@ struct GameDescription {
const char *name; const char *name;
SAGAGameType gameType; SAGAGameType gameType;
GameIds gameId; GameIds gameId;
const char *title; const char *extra;
GameDisplayInfo *gameDisplayInfo; GameDisplayInfo *gameDisplayInfo;
int startSceneNumber; int startSceneNumber;
GameResourceDescription *resourceDescription; GameResourceDescription *resourceDescription;

View file

@ -185,7 +185,14 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
// Original game title // Original game title
memset(title, 0, TITLESIZE); memset(title, 0, TITLESIZE);
strncpy(title, getGameDescription()->title, TITLESIZE); // TODO: This used to include the full title. I (Fingolfin) don't understand
// the purpose of saving this information here, which is why I am not
// changing it at the moment (it seems to *only* be used in a debug() call
// when loading). If desired, the full description string could be saved here
// again (as it used to be), ideally by computing it once and storing it in
// a member variable.
// If desired, I can implement it, it just didn't seem worth the effort.
strncpy(title, getGameDescription()->extra, TITLESIZE);
out->write(title, TITLESIZE); out->write(title, TITLESIZE);
// Surrounding scene // Surrounding scene