From 3b0f96df4c8fec82e5b4b75e80991c073bcf8177 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 14 Jun 2008 17:42:06 +0000 Subject: Add a helpful message for people trying to play with the wrong IWAD. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1147 --- src/g_game.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/g_game.c b/src/g_game.c index 924b91eb..fc644778 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1920,7 +1920,45 @@ void G_DeferedPlayDemo (char* name) defdemoname = name; gameaction = ga_playdemo; } - + +// Generate a string describing a demo version + +static char *DemoVersionDescription(int version) +{ + static char resultbuf[16]; + + switch (version) + { + case 104: + return "v1.4"; + case 105: + return "v1.5"; + case 106: + return "v1.6/v1.666"; + case 107: + return "v1.7/v1.7a"; + case 108: + return "v1.8"; + case 109: + return "v1.9"; + default: + break; + } + + // Unknown version. Perhaps this is a pre-v1.4 IWAD? If the version + // byte is in the range 0-4 then it can be a v1.0-v1.2 demo. + + if (version >= 0 && version <= 4) + { + return "v1.0/v1.1/v1.2"; + } + else + { + sprintf(resultbuf, "%i.%i (unknown)", version / 100, version % 100); + return resultbuf; + } +} + void G_DoPlayDemo (void) { skill_t skill; @@ -1943,12 +1981,16 @@ void G_DoPlayDemo (void) } else { - char errorbuf[80]; - - sprintf(errorbuf, "Demo is from a different game version! (read %i, should be %i)\n", - demoversion, DOOM_VERSION); - - I_Error(errorbuf); + char *message = "Demo is from a different game version!\n" + "(read %i, should be %i)\n" + "\n" + "*** You may need to upgrade your version " + "of Doom to v1.9. ***\n" + " See: http://doomworld.com/files/patches.shtml\n" + " This appears to be %s."; + + I_Error(message, demoversion, DOOM_VERSION, + DemoVersionDescription(demoversion)); } skill = *demo_p++; -- cgit v1.2.3