Mercurial > hg > forks > yadex
changeset 84:c518e08d5961
More logic cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 26 Sep 2011 18:17:57 +0300 |
parents | 002bc70a3982 |
children | dd99c66ed169 |
files | src/imgspect.cc src/levels.cc src/wads2.cc src/yadex.cc |
diffstat | 4 files changed, 26 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imgspect.cc Mon Sep 26 18:06:30 2011 +0300 +++ b/src/imgspect.cc Mon Sep 26 18:17:57 2011 +0300 @@ -40,10 +40,9 @@ int x, y; u8 grey; -// FIXME this is gross - if (!strncmp(cfg.Game, "doom", 4)) + if (cfg.GameId == IWAD_DOOM1 || cfg.GameId == IWAD_DOOM2) grey = 104; - else if (!strcmp(cfg.Game, "heretic")) + else if (cfg.GameId == IWAD_HERETIC) grey = 8; else {
--- a/src/levels.cc Mon Sep 26 18:06:30 2011 +0300 +++ b/src/levels.cc Mon Sep 26 18:17:57 2011 +0300 @@ -195,7 +195,7 @@ { offset = dir->dir.start; length = dir->dir.size; - if (cfg.MainWad == cfg.iwadnames[IWAD_HEXEN]) // Hexen mode + if (cfg.GameId == IWAD_HEXEN) // Hexen mode { NumThings = (int) (length / WAD_HEXEN_THING_BYTES); if ((i32) (NumThings * WAD_HEXEN_THING_BYTES) != length) @@ -231,7 +231,7 @@ rc = 1; if (cfg.error_res <= 3) goto byebye; } - if (cfg.MainWad == cfg.iwadnames[IWAD_HEXEN]) // Hexen mode + if (cfg.GameId == IWAD_HEXEN) // Hexen mode for (long n = 0; n < NumThings; n++) { u8 dummy2[6]; @@ -280,7 +280,7 @@ NumLineDefs = 0; else { - if (cfg.MainWad == cfg.iwadnames[IWAD_HEXEN]) // Hexen mode + if (cfg.GameId == IWAD_HEXEN) // Hexen mode { NumLineDefs = (int) (dir->dir.size / WAD_HEXEN_LINEDEF_BYTES); if ((i32) (NumLineDefs * WAD_HEXEN_LINEDEF_BYTES) != @@ -308,7 +308,7 @@ rc = 1; if (cfg.error_res <= 3) goto byebye; } - if (cfg.MainWad == cfg.iwadnames[IWAD_HEXEN]) // Hexen mode + if (cfg.GameId == IWAD_HEXEN) // Hexen mode for (long n = 0; n < NumLineDefs; n++) { u8 dummy[6]; @@ -1023,7 +1023,7 @@ size_t lump_size[WAD_LL__]; wad_level_lump_no_t l; - if (yg_level_format == YGLF_HEXEN || !strcmp(cfg.Game, "hexen")) + if (yg_level_format == YGLF_HEXEN || cfg.GameId == IWAD_HEXEN) { Notify(-1, -1, "I refuse to save. Hexen mode is still", "too badly broken. You would lose data.");
--- a/src/wads2.cc Mon Sep 26 18:06:30 2011 +0300 +++ b/src/wads2.cc Mon Sep 26 18:17:57 2011 +0300 @@ -84,10 +84,10 @@ if (FindMasterDir(cfg.MasterDir, "E2M1") == NULL && FindMasterDir(cfg.MasterDir, "MAP01") == NULL && FindMasterDir(cfg.MasterDir, "MAP33") == NULL - && strcmp(cfg.Game, "doom02") - && strcmp(cfg.Game, "doom04") - && strcmp(cfg.Game, "doom05") - && strcmp(cfg.Game, "doompr")) + && cfg.GameId != IWAD_DOOM02 + && cfg.GameId != IWAD_DOOM04 + && cfg.GameId != IWAD_DOOM05 + && cfg.GameId != IWAD_DOOMPR) { printf(" *-----------------------------------------------------*\n"); printf(" | Warning: this is the shareware version of the game. |\n"); @@ -608,13 +608,14 @@ else printf("Building a new Main Wad file \"%s\" (size approx 10 MB)\n", filename); + if (FindMasterDir(cfg.MasterDir, "E2M4") == NULL - && FindMasterDir(cfg.MasterDir, "MAP01") == NULL - && FindMasterDir(cfg.MasterDir, "MAP33") == NULL - && strcmp(cfg.Game, "doom02") - && strcmp(cfg.Game, "doom04") - && strcmp(cfg.Game, "doom05") - && strcmp(cfg.Game, "doompr")) + && FindMasterDir(cfg.MasterDir, "MAP02") == NULL + && FindMasterDir(cfg.MasterDir, "MAP32") == NULL + && cfg.GameId != IWAD_DOOM02 + && cfg.GameId != IWAD_DOOM04 + && cfg.GameId != IWAD_DOOM05 + && cfg.GameId != IWAD_DOOMPR) fatal_error("You were warned: you are not allowed to do this."); if ((file = fopen(filename, "wb")) == NULL)
--- a/src/yadex.cc Mon Sep 26 18:06:30 2011 +0300 +++ b/src/yadex.cc Mon Sep 26 18:17:57 2011 +0300 @@ -280,6 +280,7 @@ n + 1, n + 1); exit(1); } + cfg.GameId = n; cfg.MainWad = cfg.iwadnames[n]; } } @@ -360,16 +361,20 @@ if (cfg.welcome_message) print_welcome(stdout); - if (strcmp(cfg.Game, "hexen") == 0) + if (cfg.GameId == IWAD_HEXEN) + { printf ("WARNING: Hexen mode is experimental. Don't expect to be able to do any\n" "real Hexen editing with it. You can edit levels but you can't save them.\n" "And there might be other bugs... BE CAREFUL !\n\n"); - - if (strcmp(cfg.Game, "strife") == 0) + } + else + if (cfg.GameId == IWAD_STRIFE) + { printf ("WARNING: Strife mode is experimental. Many thing types, linedef types,\n" "etc. are missing or wrong. And be careful, there might be bugs.\n\n"); + } /* all systems go! */ MainLoop();