From 65e8563cf44235725ef0f198f48956eca9f467cf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 11:33:59 +0200 Subject: [PATCH 01/29] replaced all character arrays for lump/texture names in the level_info_t and FLevelLocals structures with FStrings as first preparation for allowing long texture names. --- src/am_map.cpp | 10 ++++++++-- src/c_cmds.cpp | 11 +++++++++-- src/fragglescript/t_load.cpp | 5 +---- src/g_level.cpp | 32 ++++++++++++++------------------ src/g_level.h | 17 +++++++++-------- src/g_mapinfo.cpp | 32 +++++++++++++++----------------- src/menu/readthis.cpp | 6 +++--- src/p_acs.cpp | 6 ++---- src/textures/texturemanager.cpp | 2 +- src/v_draw.cpp | 4 ++-- src/version.h | 2 +- 11 files changed, 65 insertions(+), 62 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index e52d39211..904593dfb 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1316,8 +1316,14 @@ bool AM_clearMarks () void AM_LevelInit () { - const char *autopage = level.info->mapbg[0] == 0? "AUTOPAGE" : (const char*)&level.info->mapbg[0]; - mapback = TexMan.CheckForTexture(autopage, FTexture::TEX_MiscPatch); + if (level.info->MapBackground.Len() == 0) + { + mapback = TexMan.CheckForTexture("AUTOPAGE", FTexture::TEX_MiscPatch); + } + else + { + mapback = TexMan.CheckForTexture(level.info->MapBackground, FTexture::TEX_MiscPatch); + } AM_clearMarks(); diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 0e7adb8ef..7b6f1d195 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -946,8 +946,15 @@ CCMD(changesky) sky1name = argv[1]; if (sky1name[0] != 0) { - strncpy (level.skypic1, sky1name, 8); - sky1texture = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); + FTextureID newsky = TexMan.GetTexture(sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst); + if (newsky.Exists()) + { + sky1texture = level.skytexture1 = newsky; + } + else + { + Printf("changesky: Texture '%s' not found\n", sky1name); + } } R_InitSkyMap (); } diff --git a/src/fragglescript/t_load.cpp b/src/fragglescript/t_load.cpp index d9b4f2d04..49458c4be 100644 --- a/src/fragglescript/t_load.cpp +++ b/src/fragglescript/t_load.cpp @@ -183,10 +183,7 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc) sc.MustGetStringName("="); sc.MustGetString(); - strncpy(level.skypic1, sc.String, 8); - strncpy(level.skypic2, sc.String, 8); - level.skypic1[8]=level.skypic2[8]=0; - sky2texture = sky1texture = TexMan.GetTexture (sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); + sky2texture = sky1texture = level.skytexture1 = level.skytexture2 = TexMan.GetTexture (sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); R_InitSkyMap (); } else if (sc.Compare("interpic")) diff --git a/src/g_level.cpp b/src/g_level.cpp index 7b37ad471..814bafcfb 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -870,8 +870,8 @@ void G_DoLoadLevel (int position, bool autosave) // DOOM determines the sky texture to be used // depending on the current episode and the game version. // [RH] Fetch sky parameters from FLevelLocals. - sky1texture = TexMan.GetTexture (level.skypic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); - sky2texture = TexMan.GetTexture (level.skypic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); + sky1texture = level.skytexture1; + sky2texture = level.skytexture2; // [RH] Set up details about sky rendering R_InitSkyMap (); @@ -1222,15 +1222,16 @@ void G_InitLevelLocals () level.info = info; level.skyspeed1 = info->skyspeed1; level.skyspeed2 = info->skyspeed2; - strncpy (level.skypic2, info->skypic2, 8); + level.skytexture1 = TexMan.GetTexture(info->SkyPic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst); + level.skytexture2 = TexMan.GetTexture(info->SkyPic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst); level.fadeto = info->fadeto; level.cdtrack = info->cdtrack; level.cdid = info->cdid; level.FromSnapshot = false; if (level.fadeto == 0) { - R_SetDefaultColormap (info->fadetable); - if (strnicmp (info->fadetable, "COLORMAP", 8) != 0) + R_SetDefaultColormap (info->FadeTable); + if (strnicmp (info->FadeTable, "COLORMAP", 8) != 0) { level.flags |= LEVEL_HASFADETABLE; } @@ -1277,11 +1278,6 @@ void G_InitLevelLocals () level.nextmap[10] = 0; strncpy (level.secretmap, info->secretmap, 10); level.secretmap[10] = 0; - strncpy (level.skypic1, info->skypic1, 8); - level.skypic1[8] = 0; - if (!level.skypic2[0]) - strncpy (level.skypic2, level.skypic1, 8); - level.skypic2[8] = 0; compatflags.Callback(); compatflags2.Callback(); @@ -1406,18 +1402,18 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) if (!hubLoad) level.totaltime = i; - if (arc.IsStoring ()) + if (SaveVersion >= 4507) { - arc.WriteName (level.skypic1); - arc.WriteName (level.skypic2); + arc << level.skytexture1 << level.skytexture2; } else { - strncpy (level.skypic1, arc.ReadName(), 8); - strncpy (level.skypic2, arc.ReadName(), 8); - sky1texture = TexMan.GetTexture (level.skypic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); - sky2texture = TexMan.GetTexture (level.skypic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); - R_InitSkyMap (); + sky1texture = TexMan.GetTexture (arc.ReadName(), FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); + sky2texture = TexMan.GetTexture (arc.ReadName(), FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); + } + if (arc.IsLoading()) + { + R_InitSkyMap(); } G_AirControlChanged (); diff --git a/src/g_level.h b/src/g_level.h index 4a84e6871..43644a279 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -38,6 +38,7 @@ #include "doomdef.h" #include "sc_man.h" #include "s_sound.h" +#include "textures/textures.h" struct level_info_t; struct cluster_info_t; @@ -272,12 +273,12 @@ struct level_info_t char pname[9]; char nextmap[11]; char secretmap[11]; - char skypic1[9]; - char skypic2[9]; - char fadetable[9]; - char f1[9]; - char bordertexture[9]; - char mapbg[9]; + FString SkyPic1; + FString SkyPic2; + FString FadeTable; + FString F1Pic; + FString BorderTexture; + FString MapBackground; int cluster; int partime; @@ -406,8 +407,8 @@ struct FLevelLocals int cdtrack; unsigned int cdid; int nextmusic; // For MUSINFO purposes - char skypic1[9]; - char skypic2[9]; + FTextureID skytexture1; + FTextureID skytexture2; float skyspeed1; // Scrolling speed of sky textures, in pixels per ms float skyspeed2; diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 04617a068..d8e12e9e4 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -94,8 +94,7 @@ level_info_t *FindLevelInfo (const char *mapname, bool allowdefault) { if (TheDefaultLevelInfo.LevelName.IsEmpty()) { - uppercopy(TheDefaultLevelInfo.skypic1, "SKY1"); - uppercopy(TheDefaultLevelInfo.skypic2, "SKY1"); + TheDefaultLevelInfo.SkyPic2 = TheDefaultLevelInfo.SkyPic1 = "SKY1"; TheDefaultLevelInfo.LevelName = "Unnamed"; } return &TheDefaultLevelInfo; @@ -226,13 +225,12 @@ void P_RemoveDefereds (void) void level_info_t::Reset() { mapname[0] = 0; - mapbg[0] = 0; + MapBackground = ""; levelnum = 0; pname[0] = 0; nextmap[0] = 0; secretmap[0] = 0; - strcpy (skypic1, "-NOFLAT-"); - strcpy (skypic2, "-NOFLAT-"); + SkyPic1 = SkyPic2 = "-NOFLAT-"; cluster = 0; partime = 0; sucktime = 0; @@ -243,10 +241,10 @@ void level_info_t::Reset() flags2 = LEVEL2_LAXMONSTERACTIVATION; Music = ""; LevelName = ""; - strcpy (fadetable, "COLORMAP"); + FadeTable = "COLORMAP"; WallHorizLight = -8; WallVertLight = +8; - f1[0] = 0; + F1Pic = ""; musicorder = 0; snapshot = NULL; snapshotVer = 0; @@ -271,7 +269,7 @@ void level_info_t::Reset() intermusicorder = 0; SoundInfo = ""; SndSeq = ""; - bordertexture[0] = 0; + BorderTexture = ""; teamdamage = 0.f; specialactions.Clear(); DefaultEnvironment = 0; @@ -850,7 +848,7 @@ DEFINE_MAP_OPTION(cluster, true) DEFINE_MAP_OPTION(sky1, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->skypic1); + parse.ParseLumpOrTextureName(info->SkyPic1); if (parse.CheckFloat()) { if (parse.HexenHack) @@ -864,7 +862,7 @@ DEFINE_MAP_OPTION(sky1, true) DEFINE_MAP_OPTION(sky2, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->skypic2); + parse.ParseLumpOrTextureName(info->SkyPic2); if (parse.CheckFloat()) { if (parse.HexenHack) @@ -879,7 +877,7 @@ DEFINE_MAP_OPTION(sky2, true) DEFINE_MAP_OPTION(skybox, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->skypic1); + parse.ParseLumpOrTextureName(info->SkyPic1); info->skyspeed1 = 0; } @@ -939,7 +937,7 @@ DEFINE_MAP_OPTION(intermusic, true) DEFINE_MAP_OPTION(fadetable, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->fadetable); + parse.ParseLumpOrTextureName(info->FadeTable); } DEFINE_MAP_OPTION(evenlighting, true) @@ -1122,13 +1120,13 @@ DEFINE_MAP_OPTION(slideshow, false) DEFINE_MAP_OPTION(bordertexture, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->bordertexture); + parse.ParseLumpOrTextureName(info->BorderTexture); } DEFINE_MAP_OPTION(f1, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->f1); + parse.ParseLumpOrTextureName(info->F1Pic); } DEFINE_MAP_OPTION(teamdamage, true) @@ -1141,7 +1139,7 @@ DEFINE_MAP_OPTION(teamdamage, true) DEFINE_MAP_OPTION(mapbackground, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->mapbg); + parse.ParseLumpOrTextureName(info->MapBackground); } DEFINE_MAP_OPTION(defaultenvironment, false) @@ -1789,9 +1787,9 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i ParseMapDefinition(*levelinfo); // When the second sky is -NOFLAT-, make it a copy of the first sky - if (strcmp (levelinfo->skypic2, "-NOFLAT-") == 0) + if (!levelinfo->SkyPic2.CompareNoCase("-NOFLAT-")) { - strcpy (levelinfo->skypic2, levelinfo->skypic1); + levelinfo->SkyPic2 = levelinfo->SkyPic1; } SetLevelNum (levelinfo, levelinfo->levelnum); // Wipe out matching levelnums from other maps. } diff --git a/src/menu/readthis.cpp b/src/menu/readthis.cpp index 197981ad3..a00843440 100644 --- a/src/menu/readthis.cpp +++ b/src/menu/readthis.cpp @@ -82,9 +82,9 @@ void DReadThisMenu::Drawer() fixed_t alpha; // Did the mapper choose a custom help page via MAPINFO? - if ((level.info != NULL) && level.info->f1[0] != 0) + if ((level.info != NULL) && level.info->F1Pic.Len() != 0) { - tex = TexMan.FindTexture(level.info->f1); + tex = TexMan.FindTexture(level.info->F1Pic); mScreen = 1; } @@ -122,7 +122,7 @@ bool DReadThisMenu::MenuEvent(int mkey, bool fromcontroller) S_Sound (CHAN_VOICE | CHAN_UI, "menu/choose", snd_menuvolume, ATTN_NONE); mScreen++; mInfoTic = gametic; - if ((level.info != NULL && level.info->f1[0] != 0) || mScreen > int(gameinfo.infoPages.Size())) + if ((level.info != NULL && level.info->F1Pic.Len() != 0) || mScreen > int(gameinfo.infoPages.Size())) { Close(); } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 50dd2733b..04aecaed1 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8348,13 +8348,11 @@ scriptwait: sky2name = FBehavior::StaticLookupString (STACK(1)); if (sky1name[0] != 0) { - strncpy (level.skypic1, sky1name, 8); - sky1texture = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); + sky1texture = level.skytexture1 = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); } if (sky2name[0] != 0) { - strncpy (level.skypic2, sky2name, 8); - sky2texture = TexMan.GetTexture (sky2name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); + sky2texture = level.skytexture2 = TexMan.GetTexture (sky2name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); } R_InitSkyMap (); sp -= 2; diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 48f3ff9e0..cdacb95bd 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1004,7 +1004,7 @@ void FTextureManager::Init() { if (wadlevelinfos[i].flags & LEVEL_DOUBLESKY) { - FTextureID picnum = CheckForTexture (wadlevelinfos[i].skypic1, FTexture::TEX_Wall, false); + FTextureID picnum = CheckForTexture (wadlevelinfos[i].SkyPic1, FTexture::TEX_Wall, false); if (picnum.isValid()) { Textures[picnum.GetIndex()].Texture->SetFrontSkyLayer (); diff --git a/src/v_draw.cpp b/src/v_draw.cpp index cd07b44a1..8472637a2 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1444,9 +1444,9 @@ void V_DrawBorder (int x1, int y1, int x2, int y2) { FTextureID picnum; - if (level.info != NULL && level.info->bordertexture[0] != 0) + if (level.info != NULL && level.info->BorderTexture.Len() != 0) { - picnum = TexMan.CheckForTexture (level.info->bordertexture, FTexture::TEX_Flat); + picnum = TexMan.CheckForTexture (level.info->BorderTexture, FTexture::TEX_Flat); } else { diff --git a/src/version.h b/src/version.h index 27bfe1021..1b4457655 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4506 +#define SAVEVER 4507 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) From fedf9c6a5ba40e4166b9da6874a7454a174d38fc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 11:39:25 +0200 Subject: [PATCH 02/29] fixed: if we allow long names for the fade table we must also check for them when the colormap gets loaded. --- src/r_data/colormaps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_data/colormaps.cpp b/src/r_data/colormaps.cpp index c3004a4da..b7e1b904b 100644 --- a/src/r_data/colormaps.cpp +++ b/src/r_data/colormaps.cpp @@ -396,7 +396,7 @@ void R_SetDefaultColormap (const char *name) BYTE unremap[256]; BYTE remap[256]; - lump = Wads.CheckNumForName (name, ns_colormaps); + lump = Wads.CheckNumForFullName (name, true, ns_colormaps); if (lump == -1) lump = Wads.CheckNumForName (name, ns_global); From e718a72b4d3891f1207ab66fe081eb8c733af23b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 11:53:08 +0200 Subject: [PATCH 03/29] fixed: skies should be loaded into the FLevelLocals struct not into the global variables of the renderer. --- src/g_level.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 814bafcfb..47ad66998 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1408,8 +1408,8 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) } else { - sky1texture = TexMan.GetTexture (arc.ReadName(), FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); - sky2texture = TexMan.GetTexture (arc.ReadName(), FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst); + level.skytexture1 = TexMan.GetTexture(arc.ReadName(), FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst); + level.skytexture2 = TexMan.GetTexture(arc.ReadName(), FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst); } if (arc.IsLoading()) { From a05e62f3f7b4d690ebe5398a5c76c7c796bfad36 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 12:44:17 +0200 Subject: [PATCH 04/29] - changed storage of lump and texture names in gameinfo to allow long names (with the exception of view border elements.) --- src/c_console.cpp | 2 +- src/d_main.cpp | 4 ++-- src/g_shared/a_armor.cpp | 4 ++-- src/gi.cpp | 20 +++++++++----------- src/gi.h | 18 +++++++++--------- src/intermission/intermission.cpp | 2 +- src/v_draw.cpp | 2 +- src/wi_stuff.cpp | 4 ++-- src/win32/st_start.cpp | 4 ++-- 9 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index b21c8c3a6..396b2dfce 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -303,7 +303,7 @@ void C_InitConback() if (!conback.isValid()) { - conback = TexMan.GetTexture (gameinfo.titlePage, FTexture::TEX_MiscPatch); + conback = TexMan.GetTexture (gameinfo.TitlePage, FTexture::TEX_MiscPatch); conshade = MAKEARGB(175,0,0,0); conline = true; } diff --git a/src/d_main.cpp b/src/d_main.cpp index 9f332c68d..93e6368c1 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1234,7 +1234,7 @@ void D_DoAdvanceDemo (void) static char demoname[8] = "DEMO1"; static int democount = 0; static int pagecount; - const char *pagename = NULL; + FString pagename; advancedemo = false; @@ -1299,7 +1299,7 @@ void D_DoAdvanceDemo (void) default: case 0: gamestate = GS_DEMOSCREEN; - pagename = gameinfo.titlePage; + pagename = gameinfo.TitlePage; pagetic = (int)(gameinfo.titleTime * TICRATE); S_ChangeMusic (gameinfo.titleMusic, gameinfo.titleOrder, false); demosequence = 3; diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index 664a56307..6b90a6a78 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -42,9 +42,9 @@ void ABasicArmor::Tick () AbsorbCount = 0; if (!Icon.isValid()) { - const char *icon = gameinfo.ArmorIcon1; + FString icon = gameinfo.ArmorIcon1; - if (SavePercent >= gameinfo.Armor2Percent && gameinfo.ArmorIcon2[0] != 0) + if (SavePercent >= gameinfo.Armor2Percent && gameinfo.ArmorIcon2.Len() != 0) icon = gameinfo.ArmorIcon2; if (icon[0] != 0) diff --git a/src/gi.cpp b/src/gi.cpp index d9d58dc9e..851a61fb8 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -271,16 +271,14 @@ void FMapInfoParser::ParseGameInfo() else if(nextKey.CompareNoCase("armoricons") == 0) { sc.MustGetToken(TK_StringConst); - strncpy(gameinfo.ArmorIcon1, sc.String, 8); - gameinfo.ArmorIcon1[8] = 0; + gameinfo.ArmorIcon1 = sc.String; if (sc.CheckToken(',')) { sc.MustGetToken(TK_FloatConst); gameinfo.Armor2Percent = FLOAT2FIXED(sc.Float); sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); - strncpy(gameinfo.ArmorIcon2, sc.String, 8); - gameinfo.ArmorIcon2[8] = 0; + gameinfo.ArmorIcon2 = sc.String; } } else if(nextKey.CompareNoCase("maparrow") == 0) @@ -295,7 +293,7 @@ void FMapInfoParser::ParseGameInfo() else gameinfo.mCheatMapArrow = ""; } // Insert valid keys here. - GAMEINFOKEY_CSTRING(titlePage, "titlePage", 8) + GAMEINFOKEY_STRING(TitlePage, "titlePage") GAMEINFOKEY_STRINGARRAY(creditPages, "addcreditPage", 8, false) GAMEINFOKEY_STRINGARRAY(creditPages, "CreditPage", 8, true) GAMEINFOKEY_STRINGARRAY(PlayerClasses, "addplayerclasses", 0, false) @@ -306,17 +304,17 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_FLOAT(pageTime, "pageTime") GAMEINFOKEY_STRING(chatSound, "chatSound") GAMEINFOKEY_MUSIC(finaleMusic, finaleOrder, "finaleMusic") - GAMEINFOKEY_CSTRING(finaleFlat, "finaleFlat", 8) + GAMEINFOKEY_STRING(FinaleFlat, "finaleFlat") GAMEINFOKEY_STRINGARRAY(finalePages, "finalePage", 8, true) GAMEINFOKEY_STRINGARRAY(infoPages, "addinfoPage", 8, false) GAMEINFOKEY_STRINGARRAY(infoPages, "infoPage", 8, true) - GAMEINFOKEY_CSTRING(PauseSign, "pausesign", 8) + GAMEINFOKEY_STRING(PauseSign, "pausesign") GAMEINFOKEY_STRING(quitSound, "quitSound") - GAMEINFOKEY_CSTRING(borderFlat, "borderFlat", 8) + GAMEINFOKEY_STRING(BorderFlat, "borderFlat") GAMEINFOKEY_FIXED(telefogheight, "telefogheight") GAMEINFOKEY_FIXED(gibfactor, "gibfactor") GAMEINFOKEY_INT(defKickback, "defKickback") - GAMEINFOKEY_CSTRING(SkyFlatName, "SkyFlatName", 8) + GAMEINFOKEY_STRING(SkyFlatName, "SkyFlatName") GAMEINFOKEY_STRING(translator, "translator") GAMEINFOKEY_COLOR(pickupcolor, "pickupcolor") GAMEINFOKEY_COLOR(defaultbloodcolor, "defaultbloodcolor") @@ -336,7 +334,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultdropstyle, "defaultdropstyle") - GAMEINFOKEY_CSTRING(Endoom, "endoom", 8) + GAMEINFOKEY_STRING(Endoom, "endoom") GAMEINFOKEY_INT(player5start, "player5start") GAMEINFOKEY_STRINGARRAY(quitmessages, "addquitmessages", 0, false) GAMEINFOKEY_STRINGARRAY(quitmessages, "quitmessages", 0, true) @@ -347,7 +345,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_STRING(mFontColorHeader, "menufontcolor_header") GAMEINFOKEY_STRING(mFontColorHighlight, "menufontcolor_highlight") GAMEINFOKEY_STRING(mFontColorSelection, "menufontcolor_selection") - GAMEINFOKEY_CSTRING(mBackButton, "menubackbutton", 8) + GAMEINFOKEY_STRING(mBackButton, "menubackbutton") GAMEINFOKEY_INT(TextScreenX, "textscreenx") GAMEINFOKEY_INT(TextScreenY, "textscreeny") GAMEINFOKEY_STRING(DefaultEndSequence, "defaultendsequence") diff --git a/src/gi.h b/src/gi.h index 6b887e1dd..9965b1dd1 100644 --- a/src/gi.h +++ b/src/gi.h @@ -78,7 +78,7 @@ struct gameinfo_t EGameType gametype; FString ConfigName; - char titlePage[9]; + FString TitlePage; bool drawreadthis; bool noloopfinalemusic; bool intermissioncounter; @@ -98,13 +98,13 @@ struct gameinfo_t FString chatSound; FString finaleMusic; int finaleOrder; - char finaleFlat[9]; - char borderFlat[9]; - char SkyFlatName[9]; - char ArmorIcon1[9]; - char ArmorIcon2[9]; - char PauseSign[9]; - char Endoom[9]; + FString FinaleFlat; + FString BorderFlat; + FString SkyFlatName; + FString ArmorIcon1; + FString ArmorIcon2; + FString PauseSign; + FString Endoom; fixed_t Armor2Percent; FString quitSound; gameborder_t *border; @@ -133,7 +133,7 @@ struct gameinfo_t FName mFontColorHeader; FName mFontColorHighlight; FName mFontColorSelection; - char mBackButton[9]; + FString mBackButton; fixed_t gibfactor; int TextScreenX; int TextScreenY; diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 91090e432..2a52df58a 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -104,7 +104,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first) } else { - texname = gameinfo.titlePage; + texname = gameinfo.TitlePage.GetChars(); } } else if (*texname == '$') diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 8472637a2..ecd50ec73 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1450,7 +1450,7 @@ void V_DrawBorder (int x1, int y1, int x2, int y2) } else { - picnum = TexMan.CheckForTexture (gameinfo.borderFlat, FTexture::TEX_Flat); + picnum = TexMan.CheckForTexture (gameinfo.BorderFlat, FTexture::TEX_Flat); } if (picnum.isValid()) diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 7aef939b1..0cf5e7b77 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -314,7 +314,7 @@ static bool IsExMy(const char * name) void WI_LoadBackground(bool isenterpic) { - const char * lumpname = NULL; + const char *lumpname; char buffer[10]; in_anim_t an; lnode_t pt; @@ -399,7 +399,7 @@ void WI_LoadBackground(bool isenterpic) default: // Strife doesn't have an intermission pic so choose something neutral. if (isenterpic) return; - lumpname = gameinfo.borderFlat; + lumpname = gameinfo.BorderFlat; break; } } diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index 7ffe846e6..04b52925e 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -1086,12 +1086,12 @@ void ST_Endoom() { if (showendoom == 0) exit(0); - if (gameinfo.Endoom[0] == 0) + if (gameinfo.Endoom.Len() == 0) { exit(0); } - int endoom_lump = Wads.CheckNumForName (gameinfo.Endoom); + int endoom_lump = Wads.CheckNumForFullName (gameinfo.Endoom, true); BYTE endoom_screen[4000]; BYTE *font; From a22670626c1b81a7bb97a2742741f50d7541cd75 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 13:40:02 +0200 Subject: [PATCH 05/29] - expanded names for view border elements. Also fixed the horribly bad implementation of custom borders which modified the DoomBorder elements without ever checking the game being used. --- src/g_shared/shared_sbar.cpp | 12 ++++++------ src/gi.cpp | 29 +++++++++++++---------------- src/gi.h | 33 +++++++++++++++++++++++++++++++-- src/v_draw.cpp | 14 +++++++------- 4 files changed, 57 insertions(+), 31 deletions(-) diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 547f6534e..7e8e660ee 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1090,12 +1090,12 @@ void DBaseStatusBar::RefreshBackground () const if (setblocks >= 10) { - const gameborder_t *border = gameinfo.border; - FTexture *p; - - p = TexMan[border->b]; - screen->FlatFill(0, y, x, y + p->GetHeight(), p, true); - screen->FlatFill(x2, y, SCREENWIDTH, y + p->GetHeight(), p, true); + FTexture *p = TexMan[gameinfo.Border.b]; + if (p != NULL) + { + screen->FlatFill(0, y, x, y + p->GetHeight(), p, true); + screen->FlatFill(x2, y, SCREENWIDTH, y + p->GetHeight(), p, true); + } } } } diff --git a/src/gi.cpp b/src/gi.cpp index 851a61fb8..8ab935854 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -51,7 +51,7 @@ const char *GameNames[17] = }; -static gameborder_t DoomBorder = +static staticgameborder_t DoomBorder = { 8, 8, "brdr_tl", "brdr_t", "brdr_tr", @@ -59,7 +59,7 @@ static gameborder_t DoomBorder = "brdr_bl", "brdr_b", "brdr_br" }; -static gameborder_t HereticBorder = +static staticgameborder_t HereticBorder = { 4, 16, "bordtl", "bordt", "bordtr", @@ -67,7 +67,7 @@ static gameborder_t HereticBorder = "bordbl", "bordb", "bordbr" }; -static gameborder_t StrifeBorder = +static staticgameborder_t StrifeBorder = { 8, 8, "brdr_tl", "brdr_t", "brdr_tr", @@ -231,40 +231,37 @@ void FMapInfoParser::ParseGameInfo() } else if(nextKey.CompareNoCase("border") == 0) { - if(sc.CheckToken(TK_Identifier)) + staticgameborder_t *b; + if (sc.CheckToken(TK_Identifier)) { switch(sc.MustMatchString(GameInfoBorders)) { default: - gameinfo.border = &DoomBorder; + b = &DoomBorder; break; case 1: - gameinfo.border = &HereticBorder; + b = &HereticBorder; break; case 2: - gameinfo.border = &StrifeBorder; + b = &StrifeBorder; break; } + gameinfo.Border = *b; } else { // border = {size, offset, tr, t, tl, r, l ,br, b, bl}; - char *graphics[8] = {DoomBorder.tr, DoomBorder.t, DoomBorder.tl, DoomBorder.r, DoomBorder.l, DoomBorder.br, DoomBorder.b, DoomBorder.bl}; + FString *graphics[8] = { &gameinfo.Border.tr, &gameinfo.Border.t, &gameinfo.Border.tl, &gameinfo.Border.r, &gameinfo.Border.l, &gameinfo.Border.br, &gameinfo.Border.b, &gameinfo.Border.bl }; sc.MustGetToken(TK_IntConst); - DoomBorder.offset = sc.Number; + gameinfo.Border.offset = sc.Number; sc.MustGetToken(','); sc.MustGetToken(TK_IntConst); - DoomBorder.size = sc.Number; + gameinfo.Border.size = sc.Number; for(int i = 0;i < 8;i++) { sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); - int len = int(strlen(sc.String)); - if(len > 8) - sc.ScriptError("Border graphic can not be more than 8 characters long.\n"); - memcpy(graphics[i], sc.String, len); - if(len < 8) // end with a null byte if the string is less than 8 chars. - graphics[i][len] = 0; + (*graphics[i]) = sc.String; } } } diff --git a/src/gi.h b/src/gi.h index 9965b1dd1..a1a03b2de 100644 --- a/src/gi.h +++ b/src/gi.h @@ -52,7 +52,7 @@ extern const char *GameNames[17]; -struct gameborder_t +struct staticgameborder_t { BYTE offset; BYTE size; @@ -66,6 +66,35 @@ struct gameborder_t char br[8]; }; +struct gameborder_t +{ + BYTE offset; + BYTE size; + FString tl; + FString t; + FString tr; + FString l; + FString r; + FString bl; + FString b; + FString br; + + gameborder_t &operator=(staticgameborder_t &other) + { + offset = other.offset; + size = other.size; + tl = other.tl; + t = other.t; + tr = other.tr; + l = other.l; + r = other.r; + bl = other.bl; + b = other.b; + br = other.br; + return *this; + } +}; + struct FGIFont { FName fontname; @@ -107,7 +136,7 @@ struct gameinfo_t FString Endoom; fixed_t Armor2Percent; FString quitSound; - gameborder_t *border; + gameborder_t Border; int telefogheight; int defKickback; FString translator; diff --git a/src/v_draw.cpp b/src/v_draw.cpp index ecd50ec73..5db99e674 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1407,7 +1407,7 @@ void V_SetBorderNeedRefresh() void V_DrawFrame (int left, int top, int width, int height) { FTexture *p; - const gameborder_t *border = gameinfo.border; + const gameborder_t *border = &gameinfo.Border; // Sanity check for incomplete gameinfo if (border == NULL) return; @@ -1513,28 +1513,28 @@ static void V_DrawTopBorder () if (viewwidth == SCREENWIDTH) return; - offset = gameinfo.border->offset; + offset = gameinfo.Border.offset; if (viewwindowy < 34) { V_DrawBorder (0, 0, viewwindowx, 34); V_DrawBorder (viewwindowx, 0, viewwindowx + viewwidth, viewwindowy); V_DrawBorder (viewwindowx + viewwidth, 0, SCREENWIDTH, 34); - p = TexMan(gameinfo.border->t); + p = TexMan(gameinfo.Border.t); screen->FlatFill(viewwindowx, viewwindowy - p->GetHeight(), viewwindowx + viewwidth, viewwindowy, p, true); - p = TexMan(gameinfo.border->l); + p = TexMan(gameinfo.Border.l); screen->FlatFill(viewwindowx - p->GetWidth(), viewwindowy, viewwindowx, 35, p, true); - p = TexMan(gameinfo.border->r); + p = TexMan(gameinfo.Border.r); screen->FlatFill(viewwindowx + viewwidth, viewwindowy, viewwindowx + viewwidth + p->GetWidth(), 35, p, true); - p = TexMan(gameinfo.border->tl); + p = TexMan(gameinfo.Border.tl); screen->DrawTexture (p, viewwindowx - offset, viewwindowy - offset, TAG_DONE); - p = TexMan(gameinfo.border->tr); + p = TexMan(gameinfo.Border.tr); screen->DrawTexture (p, viewwindowx + viewwidth, viewwindowy - offset, TAG_DONE); } else From ebd6c18bef6ed7e2508d8ee14cb3b65d1fe587fb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 15:32:54 +0200 Subject: [PATCH 06/29] - missed one texture name field in level_info_t. --- src/g_level.cpp | 4 ++-- src/g_level.h | 2 +- src/g_mapinfo.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 47ad66998..c3e78d223 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -656,7 +656,7 @@ void G_DoCompleted (void) AM_Stop (); wminfo.finished_ep = level.cluster - 1; - wminfo.LName0 = TexMan[TexMan.CheckForTexture(level.info->pname, FTexture::TEX_MiscPatch)]; + wminfo.LName0 = TexMan[TexMan.CheckForTexture(level.info->PName, FTexture::TEX_MiscPatch)]; wminfo.current = level.mapname; if (deathmatch && @@ -677,7 +677,7 @@ void G_DoCompleted (void) else { wminfo.next = nextinfo->mapname; - wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->pname, FTexture::TEX_MiscPatch)]; + wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->PName, FTexture::TEX_MiscPatch)]; } } diff --git a/src/g_level.h b/src/g_level.h index 43644a279..85a2ff0e4 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -270,9 +270,9 @@ struct level_info_t int levelnum; char mapname[9]; - char pname[9]; char nextmap[11]; char secretmap[11]; + FString PName; FString SkyPic1; FString SkyPic2; FString FadeTable; diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index d8e12e9e4..c261e2f33 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -227,7 +227,7 @@ void level_info_t::Reset() mapname[0] = 0; MapBackground = ""; levelnum = 0; - pname[0] = 0; + PName = ""; nextmap[0] = 0; secretmap[0] = 0; SkyPic1 = SkyPic2 = "-NOFLAT-"; @@ -898,7 +898,7 @@ DEFINE_MAP_OPTION(outsidefog, true) DEFINE_MAP_OPTION(titlepatch, true) { parse.ParseAssign(); - parse.ParseLumpOrTextureName(info->pname); + parse.ParseLumpOrTextureName(info->PName); } DEFINE_MAP_OPTION(partime, true) From ca4179caa3486052a3faac818225cf3dd0d8849b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 20:51:16 +0200 Subject: [PATCH 07/29] - allow texture lookup by full path names. Due to technical limitations this may result in double textures if the same graphics lump is also referenced by its short texture name. --- src/g_shared/sbarinfo_commands.cpp | 2 +- src/resourcefiles/resourcefile.h | 3 ++ src/textures/animations.cpp | 4 +- src/textures/multipatchtexture.cpp | 16 +------- src/textures/texture.cpp | 2 + src/textures/texturemanager.cpp | 64 ++++++++++++++++++------------ src/textures/textures.h | 5 +-- src/v_font.cpp | 13 ------ src/w_wad.cpp | 31 +++++++++++++++ src/w_wad.h | 4 ++ 10 files changed, 84 insertions(+), 60 deletions(-) diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index fcd9bae7d..a1912b21e 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -300,7 +300,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl if (flags & DI_ALTERNATEONFAIL) { - SetTruth(texture == NULL || !(texture->GetID().isValid()), block, statusBar); + SetTruth(texture == NULL || texture->UseType == FTexture::TEX_Null, block, statusBar); } } protected: diff --git a/src/resourcefiles/resourcefile.h b/src/resourcefiles/resourcefile.h index e531ddbb3..517b5eef4 100644 --- a/src/resourcefiles/resourcefile.h +++ b/src/resourcefiles/resourcefile.h @@ -6,6 +6,7 @@ #include "files.h" class FResourceFile; +class FTexture; struct FResourceLump { @@ -24,6 +25,7 @@ struct FResourceLump SBYTE RefCount; char * Cache; FResourceFile * Owner; + FTexture * LinkedTexture; int Namespace; FResourceLump() @@ -35,6 +37,7 @@ struct FResourceLump RefCount = 0; Namespace = 0; // ns_global *Name = 0; + LinkedTexture = NULL; } virtual ~FResourceLump(); diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index 433baa874..3601646a0 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -551,7 +551,7 @@ void FTextureManager::ParseTime (FScanner &sc, DWORD &min, DWORD &max) void FTextureManager::ParseWarp(FScanner &sc) { - const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny; + const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny | TEXMAN_ShortNameOnly; bool isflat = false; bool type2 = sc.Compare ("warp2"); // [GRB] sc.MustGetString (); @@ -616,7 +616,7 @@ void FTextureManager::ParseWarp(FScanner &sc) void FTextureManager::ParseCameraTexture(FScanner &sc) { - const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny; + const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny | TEXMAN_ShortNameOnly; int width, height; int fitwidth, fitheight; FString picname; diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 4f327309d..124add5db 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -1001,21 +1001,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, bool silent, i if (!texno.isValid()) { - int lumpnum = Wads.CheckNumForFullName(sc.String); - if (lumpnum >= 0) - { - texno = TexMan.FindTextureByLumpNum(lumpnum); - if (texno.isValid ()) - { - part.Texture = TexMan[texno]; - } - else - { - part.Texture = FTexture::CreateTexture("", lumpnum, usetype); - TexMan.AddTexture(part.Texture); - } - } - else if (strlen(sc.String) <= 8 && !strpbrk(sc.String, "./")) + if (strlen(sc.String) <= 8 && !strpbrk(sc.String, "./")) { int lumpnum = Wads.CheckNumForName(sc.String, usetype == TEX_MiscPatch? ns_graphics : ns_patches); if (lumpnum >= 0) diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 0434aaaa4..f41f1902d 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -167,6 +167,8 @@ FTexture::FTexture (const char *name, int lumpnum) FTexture::~FTexture () { + FTexture *link = Wads.GetLinkedTexture(SourceLump); + if (link == this) Wads.SetLinkedTexture(SourceLump, NULL); KillNative(); } diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index cdacb95bd..0af15d7af 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -224,6 +224,35 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF return FTextureID(firstfound); } + + if (!(flags & TEXMAN_ShortNameOnly)) + { + // We intentionally only look for textures in subdirectories. + // Any graphic being placed in the zip's root directory can not be found by this. + if (strchr(name, '/')) + { + FTexture *const NO_TEXTURE = (FTexture*)-1; + int lump = Wads.CheckNumForFullName(name); + if (lump != NULL) + { + FTexture *tex = Wads.GetLinkedTexture(lump); + if (tex == NO_TEXTURE) return FTextureID(-1); + if (tex != NULL) return tex->id; + tex = FTexture::CreateTexture("", lump, FTexture::TEX_Override); + if (tex != NULL) + { + Wads.SetLinkedTexture(lump, tex); + return AddTexture(tex); + } + else + { + // mark this lump as having no valid texture so that we don't have to retry creating one later. + Wads.SetLinkedTexture(lump, NO_TEXTURE); + } + } + } + } + return FTextureID(-1); } @@ -273,30 +302,6 @@ int FTextureManager::ListTextures (const char *name, TArray &list) return list.Size(); } -//========================================================================== -// -// FTextureManager :: FindTextureByLumpNum -// -//========================================================================== - -FTextureID FTextureManager::FindTextureByLumpNum (int lumpnum) -{ - if (lumpnum < 0) - { - return FTextureID(-1); - } - // This can't use hashing because using ReplaceTexture would break the hash chains. :( - for(unsigned i = 0; i SourceLump == lumpnum) - { - return FTextureID(i); - } - } - return FTextureID(-1); -} - - //========================================================================== // // FTextureManager :: GetTextures @@ -1093,8 +1098,15 @@ void FTextureManager::WriteTexture (FArchive &arc, int picnum) pic = Textures[picnum].Texture; } - arc.WriteName (pic->Name); - arc.WriteCount (pic->UseType); + if (Wads.GetLinkedTexture(pic->SourceLump) == pic) + { + arc.WriteName(Wads.GetLumpFullName(pic->SourceLump)); + } + else + { + arc.WriteName(pic->Name); + } + arc.WriteCount(pic->UseType); } //========================================================================== diff --git a/src/textures/textures.h b/src/textures/textures.h index 2992d8a46..8c41ee844 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -217,7 +217,6 @@ public: virtual int GetSourceLump() { return SourceLump; } virtual FTexture *GetRedirect(bool wantwarped); virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override - FTextureID GetID() const { return id; } virtual void Unload () = 0; @@ -363,12 +362,12 @@ public: TEXMAN_TryAny = 1, TEXMAN_Overridable = 2, TEXMAN_ReturnFirst = 4, - TEXMAN_AllowSkins = 8 + TEXMAN_AllowSkins = 8, + TEXMAN_ShortNameOnly = 16 }; FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny); FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0); - FTextureID FindTextureByLumpNum (int lumpnum); int ListTextures (const char *name, TArray &list); void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false); diff --git a/src/v_font.cpp b/src/v_font.cpp index abd7f494c..5fc2994fb 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -2193,19 +2193,6 @@ void V_InitCustomFonts() FTexture **p = &lumplist[*(unsigned char*)sc.String]; sc.MustGetString(); FTextureID texid = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch); - if (!texid.Exists()) - { - int lumpno = Wads.CheckNumForFullName (sc.String); - if (lumpno >= 0) - { - texid = TexMan.FindTextureByLumpNum(lumpno); - if (!texid.Exists()) - { - FTexture *tex = FTexture::CreateTexture("", lumpno, FTexture::TEX_MiscPatch); - texid = TexMan.AddTexture(tex); - } - } - } if (texid.Exists()) { *p = TexMan[texid]; diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 11a9b4213..c351de6f8 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -548,6 +548,37 @@ int FWadCollection::GetNumForFullName (const char *name) return i; } +//========================================================================== +// +// link a texture with a given lump +// +//========================================================================== + +void FWadCollection::SetLinkedTexture(int lump, FTexture *tex) +{ + if ((size_t)lump < NumLumps) + { + FResourceLump *reslump = LumpInfo[lump].lump; + reslump->LinkedTexture = tex; + } +} + +//========================================================================== +// +// retrieve linked texture +// +//========================================================================== + +FTexture *FWadCollection::GetLinkedTexture(int lump) +{ + if ((size_t)lump < NumLumps) + { + FResourceLump *reslump = LumpInfo[lump].lump; + return reslump->LinkedTexture; + } + return NULL; +} + //========================================================================== // // W_LumpLength diff --git a/src/w_wad.h b/src/w_wad.h index e0b21b66c..530182147 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -29,6 +29,7 @@ class FResourceFile; struct FResourceLump; +class FTexture; struct wadinfo_t { @@ -171,6 +172,9 @@ public: int CheckNumForFullName (const char *name, int wadfile); int GetNumForFullName (const char *name); + void SetLinkedTexture(int lump, FTexture *tex); + FTexture *GetLinkedTexture(int lump); + void ReadLump (int lump, void *dest); FMemLump ReadLump (int lump); From 30f57c0b8e31dbc703d15180614837a43de08177 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 21:16:06 +0200 Subject: [PATCH 08/29] - added new renderstyles AddStencil and AddShaded. --- src/g_shared/a_artifacts.cpp | 16 ++++++++++++++-- src/namedef.h | 2 ++ src/p_acs.cpp | 2 ++ src/p_udmf.cpp | 6 ++++++ src/r_data/renderstyle.cpp | 28 ++++++++++++++++------------ src/r_data/renderstyle.h | 2 ++ src/thingdef/thingdef_properties.cpp | 4 ++-- 7 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 2ef2b03c5..8891c8674 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -605,7 +605,13 @@ void APowerInvisibility::DoEffect () case (NAME_Stencil): Owner->RenderStyle = STYLE_Stencil; break; - case (NAME_None): + case (NAME_AddStencil) : + Owner->RenderStyle = STYLE_AddStencil; + break; + case (NAME_TranslucentStencil) : + Owner->RenderStyle = STYLE_TranslucentStencil; + break; + case (NAME_None) : case (NAME_Cumulative): case (NAME_Translucent): Owner->RenderStyle = STYLE_Translucent; @@ -685,7 +691,13 @@ int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis) case (NAME_Stencil): vis->RenderStyle = STYLE_Stencil; break; - case (NAME_None): + case (NAME_TranslucentStencil) : + vis->RenderStyle = STYLE_TranslucentStencil; + break; + case (NAME_AddStencil) : + vis->RenderStyle = STYLE_AddStencil; + break; + case (NAME_None) : case (NAME_Cumulative): case (NAME_Translucent): default: diff --git a/src/namedef.h b/src/namedef.h index 017f29932..ba6de104d 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -30,6 +30,7 @@ xx(Cumulative) xx(Fuzzy) xx(Opaque) xx(Stencil) +xx(AddStencil) // Render styles xx(Normal) @@ -37,6 +38,7 @@ xx(SoulTrans) xx(OptFuzzy) xx(Add) xx(Shaded) +xx(AddShaded) xx(TranslucentStencil) xx(Shadow) xx(Subtract) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 04aecaed1..2929bb74b 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3542,6 +3542,8 @@ static const int LegacyRenderStyleIndices[] = 3, // STYLE_SoulTrans, 4, // STYLE_OptFuzzy, 5, // STYLE_Stencil, + 6, // STYLE_AddStencil + 7, // STYLE_AddShaded 64, // STYLE_Translucent 65, // STYLE_Add, 66, // STYLE_Shaded, diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 6af777b36..2fa968502 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -658,6 +658,9 @@ public: case NAME_Stencil: th->RenderStyle = STYLE_Stencil; break; + case NAME_AddStencil: + th->RenderStyle = STYLE_AddStencil; + break; case NAME_Translucent: th->RenderStyle = STYLE_Translucent; break; @@ -668,6 +671,9 @@ public: case NAME_Shaded: th->RenderStyle = STYLE_Shaded; break; + case NAME_AddShaded: + th->RenderStyle = STYLE_AddShaded; + break; case NAME_TranslucentStencil: th->RenderStyle = STYLE_TranslucentStencil; break; diff --git a/src/r_data/renderstyle.cpp b/src/r_data/renderstyle.cpp index 660cd8f09..81524aabb 100644 --- a/src/r_data/renderstyle.cpp +++ b/src/r_data/renderstyle.cpp @@ -47,18 +47,20 @@ CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE) #ifndef __APPLE__ FRenderStyle LegacyRenderStyles[STYLE_Count] = { - /* STYLE_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }}, - /* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }}, - /* STYLE_Fuzzy */ {{ STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }}, - /* STYLE_SoulTrans */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha }}, - /* STYLE_OptFuzzy */ {{ STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }}, - /* STYLE_Stencil */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed }}, - /* STYLE_Translucent */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }}, - /* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }}, - /* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }}, -/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }}, - /* STYLE_Shadow */ {{ STYLEOP_Shadow, 0, 0, 0 }}, - /* STYLE_Subtract*/ {{ STYLEOP_RevSub, STYLEALPHA_Src, STYLEALPHA_One, 0 }}, + { { STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 } }, /* STYLE_None */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 } }, /* STYLE_Normal */ + { { STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 } }, /* STYLE_Fuzzy */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha } }, /* STYLE_SoulTrans */ + { { STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 } }, /* STYLE_OptFuzzy */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed } }, /* STYLE_Stencil */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 } }, /* STYLE_Translucent */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 } }, /* STYLE_Add */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed } }, /* STYLE_Shaded */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed } }, /* STYLE_TranslucentStencil */ + { { STYLEOP_Shadow, 0, 0, 0 } }, /* STYLE_Shadow */ + { { STYLEOP_RevSub, STYLEALPHA_Src, STYLEALPHA_One, 0 } }, /* STYLE_Subtract*/ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_ColorIsFixed } }, /* STYLE_AddStencil */ + { { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed } }, /* STYLE_AddShaded */ }; #else FRenderStyle LegacyRenderStyles[STYLE_Count]; @@ -77,6 +79,8 @@ static const BYTE Styles[STYLE_Count * 4] = STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed, STYLEOP_Shadow, 0, 0, 0, STYLEOP_RevSub, STYLEALPHA_Src, STYLEALPHA_One, 0, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_Alpha1 | STYLEF_ColorIsFixed, + STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed, }; static struct LegacyInit diff --git a/src/r_data/renderstyle.h b/src/r_data/renderstyle.h index bd589e8c7..3d617eff2 100644 --- a/src/r_data/renderstyle.h +++ b/src/r_data/renderstyle.h @@ -50,6 +50,8 @@ enum ERenderStyle STYLE_TranslucentStencil, STYLE_Shadow, STYLE_Subtract, // Actually this is 'reverse subtract' but this is what normal people would expect by 'subtract'. + STYLE_AddStencil, // Fill image interior with alphacolor + STYLE_AddShaded, // Treat patch data as alpha values for alphacolor STYLE_Count }; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 4e4fb4218..3b61bedca 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -797,12 +797,12 @@ DEFINE_PROPERTY(renderstyle, S, Actor) PROP_STRING_PARM(str, 0); static const char * renderstyles[]={ "NONE", "NORMAL", "FUZZY", "SOULTRANS", "OPTFUZZY", "STENCIL", - "TRANSLUCENT", "ADD", "SHADED", "SHADOW", "SUBTRACT", NULL }; + "TRANSLUCENT", "ADD", "SHADED", "SHADOW", "SUBTRACT", "ADDSTENCIL", "ADDSHADED", NULL }; static const int renderstyle_values[]={ STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy, STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded, - STYLE_Shadow, STYLE_Subtract}; + STYLE_Shadow, STYLE_Subtract, STYLE_AddStencil, STYLE_AddShaded}; // make this work for old style decorations, too. if (!strnicmp(str, "style_", 6)) str+=6; From e49e926bd95a95f963859878fbb2d2fdc074b60d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 21:26:51 +0200 Subject: [PATCH 09/29] - added option to ASectorAction to remove itself upon triggering by setting the STANDSTILL flag on the map thing. --- src/g_shared/a_sectoraction.cpp | 84 +++++++++++++++++++-------------- src/r_defs.h | 5 +- 2 files changed, 51 insertions(+), 38 deletions(-) diff --git a/src/g_shared/a_sectoraction.cpp b/src/g_shared/a_sectoraction.cpp index ed73b5ae7..570818e19 100644 --- a/src/g_shared/a_sectoraction.cpp +++ b/src/g_shared/a_sectoraction.cpp @@ -82,10 +82,22 @@ void ASectorAction::Deactivate (AActor *source) flags2 |= MF2_DORMANT; // Projectiles can trigger } -bool ASectorAction::TriggerAction (AActor *triggerer, int activationType) +bool ASectorAction::TriggerAction(AActor *triggerer, int activationType) +{ + if (DoTriggerAction(triggerer, activationType)) + { + if (flags4 & MF4_STANDSTILL) + { + Destroy(); + } + } + return false; +} + +bool ASectorAction::DoTriggerAction (AActor *triggerer, int activationType) { if (tracer != NULL) - return barrier_cast(tracer)->TriggerAction (triggerer, activationType); + return barrier_cast(tracer)->DoTriggerAction (triggerer, activationType); else return false; } @@ -93,7 +105,7 @@ bool ASectorAction::TriggerAction (AActor *triggerer, int activationType) bool ASectorAction::CheckTrigger (AActor *triggerer) const { if (special && - (triggerer->player || + ((triggerer->player && !(flags & MF_FRIENDLY)) || ((flags & MF_AMBUSH) && (triggerer->flags2 & MF2_MCROSS)) || ((flags2 & MF2_DORMANT) && (triggerer->flags2 & MF2_PCROSS)))) { @@ -110,16 +122,16 @@ class ASecActEnter : public ASectorAction { DECLARE_CLASS (ASecActEnter, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActEnter) -bool ASecActEnter::TriggerAction (AActor *triggerer, int activationType) +bool ASecActEnter::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_Enter) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when leaving sector -------------------------------------------- @@ -128,16 +140,16 @@ class ASecActExit : public ASectorAction { DECLARE_CLASS (ASecActExit, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActExit) -bool ASecActExit::TriggerAction (AActor *triggerer, int activationType) +bool ASecActExit::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_Exit) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when hitting sector's floor ------------------------------------ @@ -146,7 +158,7 @@ class ASecActHitFloor : public ASectorAction { DECLARE_CLASS (ASecActHitFloor, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; // Skull Tag uses 9999 for a special that is triggered whenever @@ -154,10 +166,10 @@ public: IMPLEMENT_CLASS (ASecActHitFloor) -bool ASecActHitFloor::TriggerAction (AActor *triggerer, int activationType) +bool ASecActHitFloor::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_HitFloor) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when hitting sector's ceiling ---------------------------------- @@ -166,16 +178,16 @@ class ASecActHitCeil : public ASectorAction { DECLARE_CLASS (ASecActHitCeil, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActHitCeil) -bool ASecActHitCeil::TriggerAction (AActor *triggerer, int activationType) +bool ASecActHitCeil::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_HitCeiling) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when using inside sector --------------------------------------- @@ -184,16 +196,16 @@ class ASecActUse : public ASectorAction { DECLARE_CLASS (ASecActUse, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActUse) -bool ASecActUse::TriggerAction (AActor *triggerer, int activationType) +bool ASecActUse::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_Use) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when using a sector's wall ------------------------------------- @@ -202,16 +214,16 @@ class ASecActUseWall : public ASectorAction { DECLARE_CLASS (ASecActUseWall, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActUseWall) -bool ASecActUseWall::TriggerAction (AActor *triggerer, int activationType) +bool ASecActUseWall::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_UseWall) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when eyes go below fake floor ---------------------------------- @@ -220,16 +232,16 @@ class ASecActEyesDive : public ASectorAction { DECLARE_CLASS (ASecActEyesDive, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActEyesDive) -bool ASecActEyesDive::TriggerAction (AActor *triggerer, int activationType) +bool ASecActEyesDive::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_EyesDive) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when eyes go above fake floor ---------------------------------- @@ -238,16 +250,16 @@ class ASecActEyesSurface : public ASectorAction { DECLARE_CLASS (ASecActEyesSurface, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActEyesSurface) -bool ASecActEyesSurface::TriggerAction (AActor *triggerer, int activationType) +bool ASecActEyesSurface::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_EyesSurface) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when eyes go below fake floor ---------------------------------- @@ -256,16 +268,16 @@ class ASecActEyesBelowC : public ASectorAction { DECLARE_CLASS (ASecActEyesBelowC, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActEyesBelowC) -bool ASecActEyesBelowC::TriggerAction (AActor *triggerer, int activationType) +bool ASecActEyesBelowC::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_EyesBelowC) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when eyes go above fake floor ---------------------------------- @@ -274,16 +286,16 @@ class ASecActEyesAboveC : public ASectorAction { DECLARE_CLASS (ASecActEyesAboveC, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActEyesAboveC) -bool ASecActEyesAboveC::TriggerAction (AActor *triggerer, int activationType) +bool ASecActEyesAboveC::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_EyesAboveC) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } // Triggered when eyes go below fake floor ---------------------------------- @@ -292,14 +304,14 @@ class ASecActHitFakeFloor : public ASectorAction { DECLARE_CLASS (ASecActHitFakeFloor, ASectorAction) public: - bool TriggerAction (AActor *triggerer, int activationType); + bool DoTriggerAction (AActor *triggerer, int activationType); }; IMPLEMENT_CLASS (ASecActHitFakeFloor) -bool ASecActHitFakeFloor::TriggerAction (AActor *triggerer, int activationType) +bool ASecActHitFakeFloor::DoTriggerAction (AActor *triggerer, int activationType) { bool didit = (activationType & SECSPAC_HitFakeFloor) ? CheckTrigger (triggerer) : false; - return didit | Super::TriggerAction (triggerer, activationType); + return didit | Super::DoTriggerAction (triggerer, activationType); } diff --git a/src/r_defs.h b/src/r_defs.h index c2f3e5b34..2e9c0876b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -198,9 +198,10 @@ public: void BeginPlay (); void Activate (AActor *source); void Deactivate (AActor *source); - virtual bool TriggerAction (AActor *triggerer, int activationType); + bool TriggerAction(AActor *triggerer, int activationType); protected: - bool CheckTrigger (AActor *triggerer) const; + virtual bool DoTriggerAction(AActor *triggerer, int activationType); + bool CheckTrigger(AActor *triggerer) const; }; class ASkyViewpoint; From 24886b6734523df3c5b8847afb3465465299f839 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 May 2014 23:16:13 +0200 Subject: [PATCH 10/29] - removed the last static character arrays from FLevelLocals. --- src/c_cmds.cpp | 19 +++++--------- src/d_net.cpp | 2 +- src/fragglescript/t_load.cpp | 6 ++--- src/g_game.cpp | 8 +++--- src/g_hexen/a_heresiarch.cpp | 2 +- src/g_level.cpp | 41 +++++++++++++----------------- src/g_level.h | 6 ++--- src/g_shared/sbarinfo_commands.cpp | 2 +- src/g_shared/shared_sbar.cpp | 2 +- src/p_acs.cpp | 12 ++++----- src/p_lnspec.cpp | 10 ++++---- src/p_setup.cpp | 2 +- src/p_setup.h | 2 +- src/p_spec.h | 4 +-- src/st_stuff.cpp | 2 +- src/statistics.cpp | 5 ++-- src/win32/i_main.cpp | 6 +---- src/zstring.h | 4 +++ 18 files changed, 61 insertions(+), 74 deletions(-) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 7b6f1d195..89005dbc7 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -986,14 +986,10 @@ CCMD(nextmap) TEXTCOLOR_NORMAL " is for single-player only.\n"); return; } - char *next = NULL; - if (*level.nextmap) - next = level.nextmap; - - if (next != NULL && strncmp(next, "enDSeQ", 6)) + if (level.NextMap.Len() > 0 && level.NextMap.Compare("enDSeQ", 6)) { - G_DeferedInitNew(next); + G_DeferedInitNew(level.NextMap); } else { @@ -1016,12 +1012,9 @@ CCMD(nextsecret) } char *next = NULL; - if (*level.secretmap) - next = level.secretmap; - - if (next != NULL && strncmp(next, "enDSeQ", 6)) + if (level.NextSecretMap.Len() > 0 && level.NextSecretMap.Compare("enDSeQ", 6)) { - G_DeferedInitNew(next); + G_DeferedInitNew(level.NextSecretMap); } else { @@ -1107,8 +1100,8 @@ static void PrintSecretString(const char *string, bool thislevel) CCMD(secret) { - const char *mapname = argv.argc() < 2? level.mapname : argv[1]; - bool thislevel = !stricmp(mapname, level.mapname); + const char *mapname = argv.argc() < 2? level.MapName.GetChars() : argv[1]; + bool thislevel = !stricmp(mapname, level.MapName); bool foundsome = false; int lumpno=Wads.CheckNumForName("SECRETS"); diff --git a/src/d_net.cpp b/src/d_net.cpp index 170e9ed12..a2e0798b2 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2573,7 +2573,7 @@ static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, int arg[i] = argval; } } - P_StartScript(pawn, NULL, snum, level.mapname, arg, MIN(countof(arg), argn), ACS_NET | always); + P_StartScript(pawn, NULL, snum, level.MapName, arg, MIN(countof(arg), argn), ACS_NET | always); } void Net_SkipCommand (int type, BYTE **stream) diff --git a/src/fragglescript/t_load.cpp b/src/fragglescript/t_load.cpp index 49458c4be..eedb68f7c 100644 --- a/src/fragglescript/t_load.cpp +++ b/src/fragglescript/t_load.cpp @@ -202,15 +202,13 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc) { sc.MustGetStringName("="); sc.MustGetString(); - strncpy(level.nextmap, sc.String, 8); - level.nextmap[8]=0; + level.NextMap = sc.String; } else if (sc.Compare("nextsecret")) { sc.MustGetStringName("="); sc.MustGetString(); - strncpy(level.secretmap, sc.String, 8); - level.secretmap[8]=0; + level.NextSecretMap = sc.String; } else if (sc.Compare("drown")) { diff --git a/src/g_game.cpp b/src/g_game.cpp index 7875d9c3b..045b331bf 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1621,7 +1621,7 @@ void G_DoReborn (int playernum, bool freshbot) { // Reload the level from scratch bool indemo = demoplayback; BackupSaveName = ""; - G_InitNew (level.mapname, false); + G_InitNew (level.MapName, false); demoplayback = indemo; // gameaction = ga_loadlevel; } @@ -2027,7 +2027,7 @@ static void PutSaveComment (FILE *file) // Get level name //strcpy (comment, level.level_name); - mysnprintf(comment, countof(comment), "%s - %s", level.mapname, level.LevelName.GetChars()); + mysnprintf(comment, countof(comment), "%s - %s", level.MapName.GetChars(), level.LevelName.GetChars()); len = (WORD)strlen (comment); comment[len] = '\n'; @@ -2088,7 +2088,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio M_AppendPNGText (stdfile, "Engine", GAMESIG); M_AppendPNGText (stdfile, "ZDoom Save Version", SAVESIG); M_AppendPNGText (stdfile, "Title", description); - M_AppendPNGText (stdfile, "Current Map", level.mapname); + M_AppendPNGText (stdfile, "Current Map", level.MapName); PutSaveWads (stdfile); PutSaveComment (stdfile); @@ -2289,7 +2289,7 @@ void G_BeginRecording (const char *startmap) if (startmap == NULL) { - startmap = level.mapname; + startmap = level.MapName; } demo_p = demobuffer; diff --git a/src/g_hexen/a_heresiarch.cpp b/src/g_hexen/a_heresiarch.cpp index b5bbced2f..15e6da9c1 100644 --- a/src/g_hexen/a_heresiarch.cpp +++ b/src/g_hexen/a_heresiarch.cpp @@ -88,7 +88,7 @@ void AHeresiarch::Die (AActor *source, AActor *inflictor, int dmgflags) if (script != 0) { - P_StartScript (this, NULL, script, level.mapname, NULL, 0, 0); + P_StartScript (this, NULL, script, level.MapName, NULL, 0, 0); } } diff --git a/src/g_level.cpp b/src/g_level.cpp index c3e78d223..7cbbef6e0 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -445,10 +445,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel) bglobal.Init (); } - if (mapname != level.mapname) - { - strcpy (level.mapname, mapname); - } + level.MapName = mapname; if (bTitleLevel) { gamestate = GS_TITLELEVEL; @@ -491,9 +488,9 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill { // end the game levelname = NULL; - if (!strncmp(level.nextmap, "enDSeQ",6)) + if (!level.NextMap.Compare("enDSeQ",6)) { - levelname = level.nextmap; // If there is already an end sequence please leave it alone! + nextlevel = level.NextMap; // If there is already an end sequence please leave it alone! } else { @@ -596,18 +593,18 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill const char *G_GetExitMap() { - return level.nextmap; + return level.NextMap; } const char *G_GetSecretExitMap() { - const char *nextmap = level.nextmap; + const char *nextmap = level.NextMap; - if (level.secretmap[0] != 0) + if (level.NextSecretMap.Len() > 0) { - if (P_CheckMapData(level.secretmap)) + if (P_CheckMapData(level.NextSecretMap)) { - nextmap = level.secretmap; + nextmap = level.NextSecretMap; } } return nextmap; @@ -641,7 +638,7 @@ void G_DoCompleted (void) if (gamestate == GS_TITLELEVEL) { - strncpy (level.mapname, nextlevel, 255); + level.MapName = nextlevel; G_DoLoadLevel (startpos, false); startpos = 0; viewactive = true; @@ -650,20 +647,20 @@ void G_DoCompleted (void) // [RH] Mark this level as having been visited if (!(level.flags & LEVEL_CHANGEMAPCHEAT)) - FindLevelInfo (level.mapname)->flags |= LEVEL_VISITED; + FindLevelInfo (level.MapName)->flags |= LEVEL_VISITED; if (automapactive) AM_Stop (); wminfo.finished_ep = level.cluster - 1; wminfo.LName0 = TexMan[TexMan.CheckForTexture(level.info->PName, FTexture::TEX_MiscPatch)]; - wminfo.current = level.mapname; + wminfo.current = level.MapName; if (deathmatch && (dmflags & DF_SAME_LEVEL) && !(level.flags & LEVEL_CHANGEMAPCHEAT)) { - wminfo.next = level.mapname; + wminfo.next = level.MapName; wminfo.LName1 = wminfo.LName0; } else @@ -850,7 +847,7 @@ void G_DoLoadLevel (int position, bool autosave) "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" "\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n" TEXTCOLOR_BOLD "%s - %s\n\n", - level.mapname, level.LevelName.GetChars()); + level.MapName.GetChars(), level.LevelName.GetChars()); if (wipegamestate == GS_LEVEL) wipegamestate = GS_FORCEWIPE; @@ -899,7 +896,7 @@ void G_DoLoadLevel (int position, bool autosave) } level.maptime = 0; - P_SetupLevel (level.mapname, position); + P_SetupLevel (level.MapName, position); AM_LevelInit(); @@ -1056,7 +1053,7 @@ void G_DoWorldDone (void) } else { - strncpy (level.mapname, nextlevel, 255); + level.MapName = nextlevel; } G_StartTravel (); G_DoLoadLevel (startpos, true); @@ -1217,7 +1214,7 @@ void G_InitLevelLocals () level.flags = 0; level.flags2 = 0; - info = FindLevelInfo (level.mapname); + info = FindLevelInfo (level.MapName); level.info = info; level.skyspeed1 = info->skyspeed1; @@ -1274,10 +1271,8 @@ void G_InitLevelLocals () level.musicorder = info->musicorder; level.LevelName = level.info->LookupLevelName(); - strncpy (level.nextmap, info->nextmap, 10); - level.nextmap[10] = 0; - strncpy (level.secretmap, info->secretmap, 10); - level.secretmap[10] = 0; + level.NextMap = info->nextmap; + level.NextSecretMap = info->secretmap; compatflags.Callback(); compatflags2.Callback(); diff --git a/src/g_level.h b/src/g_level.h index 85a2ff0e4..cd1e9e60d 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -391,9 +391,9 @@ struct FLevelLocals int levelnum; int lumpnum; FString LevelName; - char mapname[256]; // the lump name (E1M1, MAP01, etc) - char nextmap[11]; // go here when using the regular exit - char secretmap[11]; // map to go to when used secret exit + FString MapName; // the lump name (E1M1, MAP01, etc) + FString NextMap; // go here when using the regular exit + FString NextSecretMap; // map to go to when used secret exit EMapType maptype; DWORD flags; diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index a1912b21e..629c31cb4 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -830,7 +830,7 @@ class CommandDrawString : public SBarInfoCommand if(level.lumpnum != cache) { cache = level.lumpnum; - str = level.mapname; + str = level.MapName; str.ToUpper(); RealignString(); } diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 7e8e660ee..6b2f609b7 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -131,7 +131,7 @@ void ST_FormatMapName(FString &mapname, const char *mapnamecolor) if (am_showmaplabel == 1 || (am_showmaplabel == 2 && !ishub)) { - mapname << level.mapname << ": "; + mapname << level.MapName << ": "; } mapname << mapnamecolor << level.LevelName; } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2929bb74b..bd8c53edf 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -6981,7 +6981,7 @@ scriptwait: break; case PRINTNAME_LEVEL: - work += level.mapname; + work += level.MapName; break; case PRINTNAME_SKILL: @@ -8950,7 +8950,7 @@ EXTERN_CVAR (Bool, sv_cheats) int P_StartScript (AActor *who, line_t *where, int script, const char *map, const int *args, int argcount, int flags) { - if (map == NULL || 0 == strnicmp (level.mapname, map, 8)) + if (map == NULL || 0 == strnicmp (level.MapName, map, 8)) { FBehavior *module = NULL; const ScriptPtr *scriptdata; @@ -9003,17 +9003,17 @@ int P_StartScript (AActor *who, line_t *where, int script, const char *map, cons return false; } -void P_SuspendScript (int script, char *map) +void P_SuspendScript (int script, const char *map) { - if (strnicmp (level.mapname, map, 8)) + if (strnicmp (level.MapName, map, 8)) addDefered (FindLevelInfo (map), acsdefered_t::defsuspend, script, NULL, 0, NULL); else SetScriptState (script, DLevelScript::SCRIPT_Suspended); } -void P_TerminateScript (int script, char *map) +void P_TerminateScript (int script, const char *map) { - if (strnicmp (level.mapname, map, 8)) + if (strnicmp (level.MapName, map, 8)) addDefered (FindLevelInfo (map), acsdefered_t::defterminate, script, NULL, 0, NULL); else SetScriptState (script, DLevelScript::SCRIPT_PleaseRemove); diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 12c877116..d94a16fbb 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1644,7 +1644,7 @@ FUNC(LS_ACS_Execute) if (arg1 == 0) { - mapname = level.mapname; + mapname = level.MapName; } else if ((info = FindLevelByNum(arg1)) != NULL) { @@ -1667,7 +1667,7 @@ FUNC(LS_ACS_ExecuteAlways) if (arg1 == 0) { - mapname = level.mapname; + mapname = level.MapName; } else if ((info = FindLevelByNum(arg1)) != NULL) { @@ -1707,7 +1707,7 @@ FUNC(LS_ACS_ExecuteWithResult) int args[4] = { arg1, arg2, arg3, arg4 }; int flags = (backSide ? ACS_BACKSIDE : 0) | ACS_ALWAYS | ACS_WANTRESULT; - return P_StartScript (it, ln, arg0, level.mapname, args, 4, flags); + return P_StartScript (it, ln, arg0, level.MapName, args, 4, flags); } FUNC(LS_ACS_Suspend) @@ -1716,7 +1716,7 @@ FUNC(LS_ACS_Suspend) level_info_t *info; if (arg1 == 0) - P_SuspendScript (arg0, level.mapname); + P_SuspendScript (arg0, level.MapName); else if ((info = FindLevelByNum (arg1)) ) P_SuspendScript (arg0, info->mapname); @@ -1729,7 +1729,7 @@ FUNC(LS_ACS_Terminate) level_info_t *info; if (arg1 == 0) - P_TerminateScript (arg0, level.mapname); + P_TerminateScript (arg0, level.MapName); else if ((info = FindLevelByNum (arg1)) ) P_TerminateScript (arg0, info->mapname); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index c564d1aa7..4f1329f85 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3559,7 +3559,7 @@ void P_FreeExtraLevelData() // // [RH] position indicates the start spot to spawn at -void P_SetupLevel (char *lumpname, int position) +void P_SetupLevel (const char *lumpname, int position) { cycle_t times[20]; FMapThing *buildthings; diff --git a/src/p_setup.h b/src/p_setup.h index 4a41a76f9..ee26f4c57 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -103,7 +103,7 @@ bool P_CheckMapData(const char * mapname); // [RH] The only parameter used is mapname, so I removed playermask and skill. // On September 1, 1998, I added the position to indicate which set // of single-player start spots should be spawned in the level. -void P_SetupLevel (char *mapname, int position); +void P_SetupLevel (const char *mapname, int position); void P_FreeLevelData(); void P_FreeExtraLevelData(); diff --git a/src/p_spec.h b/src/p_spec.h index 57d216972..f8dad701b 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -902,8 +902,8 @@ bool EV_TeleportSector (int tag, int source_tid, int dest_tid, bool fog, int gro #define ACS_NET 8 int P_StartScript (AActor *who, line_t *where, int script, const char *map, const int *args, int argcount, int flags); -void P_SuspendScript (int script, char *map); -void P_TerminateScript (int script, char *map); +void P_SuspendScript (int script, const char *map); +void P_TerminateScript (int script, const char *map); void P_DoDeferedScripts (void); // diff --git a/src/st_stuff.cpp b/src/st_stuff.cpp index 8679e967c..84982300c 100644 --- a/src/st_stuff.cpp +++ b/src/st_stuff.cpp @@ -484,7 +484,7 @@ static bool Cht_ChangeStartSpot (cheatseq_t *cheat) { char cmd[64]; - mysnprintf (cmd, countof(cmd), "changemap %s %c", level.mapname, cheat->Args[0]); + mysnprintf (cmd, countof(cmd), "changemap %s %c", level.MapName.GetChars(), cheat->Args[0]); C_DoCommand (cmd); return true; } diff --git a/src/statistics.cpp b/src/statistics.cpp index 81cd88983..acd8440e8 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -408,12 +408,13 @@ static void StoreLevelStats() { for(i=0;i Date: Wed, 14 May 2014 00:52:16 +0200 Subject: [PATCH 11/29] - removed 8 character limit for map names. --- src/g_level.cpp | 26 +++++++++++---------- src/g_level.h | 10 ++++---- src/g_mapinfo.cpp | 59 +++++++++++++++++++++++------------------------ src/p_acs.cpp | 2 +- src/p_lnspec.cpp | 10 ++++---- src/p_setup.cpp | 5 ++-- src/zstring.cpp | 9 +++++++- src/zstring.h | 1 + 8 files changed, 66 insertions(+), 56 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 7cbbef6e0..74a92edb5 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -506,12 +506,14 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill if (nextredir != NULL) { nextinfo = nextredir; - levelname = nextinfo->mapname; } } + nextlevel = nextinfo->MapName; + } + else + { + nextlevel = levelname; } - - if (levelname != NULL) nextlevel = levelname; if (nextSkill != -1) NextSkill = nextSkill; @@ -673,7 +675,7 @@ void G_DoCompleted (void) } else { - wminfo.next = nextinfo->mapname; + wminfo.next = nextinfo->MapName; wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->PName, FTexture::TEX_MiscPatch)]; } } @@ -1271,8 +1273,8 @@ void G_InitLevelLocals () level.musicorder = info->musicorder; level.LevelName = level.info->LookupLevelName(); - level.NextMap = info->nextmap; - level.NextSecretMap = info->secretmap; + level.NextMap = info->NextMap; + level.NextSecretMap = info->NextSecretMap; compatflags.Callback(); compatflags2.Callback(); @@ -1616,7 +1618,7 @@ static void writeMapName (FArchive &arc, const char *name) static void writeSnapShot (FArchive &arc, level_info_t *i) { arc << i->snapshotVer; - writeMapName (arc, i->mapname); + writeMapName (arc, i->MapName); i->snapshot->Serialize (arc); } @@ -1654,7 +1656,7 @@ void G_WriteSnapshots (FILE *file) { arc = new FPNGChunkArchive (file, VIST_ID); } - writeMapName (*arc, wadlevelinfos[i].mapname); + writeMapName (*arc, wadlevelinfos[i].MapName); } } @@ -1793,7 +1795,7 @@ CCMD(listsnapshots) { unsigned int comp, uncomp; snapshot->GetSizes(comp, uncomp); - Printf("%s (%u -> %u bytes)\n", wadlevelinfos[i].mapname, comp, uncomp); + Printf("%s (%u -> %u bytes)\n", wadlevelinfos[i].MapName.GetChars(), comp, uncomp); } } } @@ -1805,7 +1807,7 @@ CCMD(listsnapshots) static void writeDefereds (FArchive &arc, level_info_t *i) { - writeMapName (arc, i->mapname); + writeMapName (arc, i->MapName); arc << i->defered; } @@ -1917,11 +1919,11 @@ CCMD(listmaps) for(unsigned i = 0; i < wadlevelinfos.Size(); i++) { level_info_t *info = &wadlevelinfos[i]; - MapData *map = P_OpenMapData(info->mapname, true); + MapData *map = P_OpenMapData(info->MapName, true); if (map != NULL) { - Printf("%s: '%s' (%s)\n", info->mapname, info->LookupLevelName().GetChars(), + Printf("%s: '%s' (%s)\n", info->MapName.GetChars(), info->LookupLevelName().GetChars(), Wads.GetWadName(Wads.GetLumpFile(map->lumpnum))); delete map; } diff --git a/src/g_level.h b/src/g_level.h index cd1e9e60d..ebd52c8f6 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -83,7 +83,7 @@ struct FMapInfoParser void ParseLumpOrTextureName(FString &name); void ParseCluster(); - void ParseNextMap(char *mapname); + void ParseNextMap(FString &mapname); level_info_t *ParseMapHeader(level_info_t &defaultinfo); void ParseMapDefinition(level_info_t &leveldef); void ParseGameInfo(); @@ -269,9 +269,9 @@ struct level_info_t { int levelnum; - char mapname[9]; - char nextmap[11]; - char secretmap[11]; + FString MapName; + FString NextMap; + FString NextSecretMap; FString PName; FString SkyPic1; FString SkyPic2; @@ -313,7 +313,7 @@ struct level_info_t // Redirection: If any player is carrying the specified item, then // you go to the RedirectMap instead of this one. FName RedirectType; - char RedirectMap[9]; + FString RedirectMapName; FString EnterPic; FString ExitPic; diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index c261e2f33..874a659c6 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -71,9 +71,10 @@ extern TMap HexenMusic; static int FindWadLevelInfo (const char *name) { for (unsigned int i = 0; i < wadlevelinfos.Size(); i++) - if (!strnicmp (name, wadlevelinfos[i].mapname, 8)) + { + if (!wadlevelinfos[i].MapName.CompareNoCase(name)) return i; - + } return -1; } @@ -144,7 +145,7 @@ bool CheckWarpTransMap (FString &mapname, bool substitute) level_info_t *lev = FindLevelByWarpTrans (atoi (&mapname[4])); if (lev != NULL) { - mapname = lev->mapname; + mapname = lev->MapName; return true; } else if (substitute) @@ -224,12 +225,12 @@ void P_RemoveDefereds (void) void level_info_t::Reset() { - mapname[0] = 0; + MapName = ""; MapBackground = ""; levelnum = 0; PName = ""; - nextmap[0] = 0; - secretmap[0] = 0; + NextMap = ""; + NextSecretMap = ""; SkyPic1 = SkyPic2 = "-NOFLAT-"; cluster = 0; partime = 0; @@ -262,7 +263,7 @@ void level_info_t::Reset() compatmask = compatmask2 = 0; Translator = ""; RedirectType = 0; - RedirectMap[0] = 0; + RedirectMapName = ""; EnterPic = ""; ExitPic = ""; InterMusic = ""; @@ -299,17 +300,17 @@ FString level_info_t::LookupLevelName() char checkstring[32]; // Strip out the header from the localized string - if (mapname[0] == 'E' && mapname[2] == 'M') + if (MapName.Len() > 3 && MapName[0] == 'E' && MapName[2] == 'M') { - mysnprintf (checkstring, countof(checkstring), "%s: ", mapname); + mysnprintf (checkstring, countof(checkstring), "%s: ", MapName); } - else if (mapname[0] == 'M' && mapname[1] == 'A' && mapname[2] == 'P') + else if (MapName.Len() > 3 && MapName[0] == 'M' && MapName[1] == 'A' && MapName[2] == 'P') { - mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(mapname + 3)); + mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[3])); } - else if (mapname[0] == 'L' && mapname[1] == 'E' && mapname[2] == 'V' && mapname[3] == 'E' && mapname[4] == 'L') + else if (MapName.Len() > 5 && MapName[0] == 'L' && MapName[1] == 'E' && MapName[2] == 'V' && MapName[3] == 'E' && MapName[4] == 'L') { - mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(mapname + 5)); + mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[5])); } thename = strstr (lookedup, checkstring); if (thename == NULL) @@ -372,9 +373,9 @@ level_info_t *level_info_t::CheckLevelRedirect () if (playeringame[i] && players[i].mo->FindInventory (type)) { // check for actual presence of the map. - if (P_CheckMapData(RedirectMap)) + if (P_CheckMapData(RedirectMapName)) { - return FindLevelInfo(RedirectMap); + return FindLevelInfo(RedirectMapName); } break; } @@ -391,7 +392,7 @@ level_info_t *level_info_t::CheckLevelRedirect () bool level_info_t::isValid() { - return mapname[0] != 0 || this == &TheDefaultLevelInfo; + return MapName.Len() != 0 || this == &TheDefaultLevelInfo; } //========================================================================== @@ -764,29 +765,27 @@ void FMapInfoParser::ParseCluster() // //========================================================================== -void FMapInfoParser::ParseNextMap(char *mapname) +void FMapInfoParser::ParseNextMap(FString &mapname) { if (sc.CheckNumber()) { if (HexenHack) { - mysnprintf (mapname, 9, "&wt@%02d", sc.Number); + mapname.Format("&wt@%02d", sc.Number); } else { - mysnprintf (mapname, 9, "MAP%02d", sc.Number); + mapname.Format("MAP%02d", sc.Number); } } else { - *mapname = 0; sc.MustGetString(); - strncpy (mapname, sc.String, 8); - mapname[8] = 0; + mapname = sc.String; FName seq = CheckEndSequence(); if (seq != NAME_None) { - mysnprintf(mapname, 11, "enDSeQ%04x", int(seq)); + mapname.Format("enDSeQ%04x", int(seq)); } } } @@ -807,19 +806,19 @@ DEFINE_MAP_OPTION(levelnum, true) DEFINE_MAP_OPTION(next, true) { parse.ParseAssign(); - parse.ParseNextMap(info->nextmap); + parse.ParseNextMap(info->NextMap); } DEFINE_MAP_OPTION(secretnext, true) { parse.ParseAssign(); - parse.ParseNextMap(info->secretmap); + parse.ParseNextMap(info->NextSecretMap); } DEFINE_MAP_OPTION(secret, true) // Just an alias for secretnext, for Vavoom compatibility { parse.ParseAssign(); - parse.ParseNextMap(info->secretmap); + parse.ParseNextMap(info->NextSecretMap); } DEFINE_MAP_OPTION(cluster, true) @@ -1072,7 +1071,7 @@ DEFINE_MAP_OPTION(redirect, true) parse.sc.MustGetString(); info->RedirectType = parse.sc.String; parse.ParseComma(); - parse.ParseLumpOrTextureName(info->RedirectMap); + parse.ParseNextMap(info->RedirectMapName); } DEFINE_MAP_OPTION(sndseq, true) @@ -1522,8 +1521,8 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo) } - uppercopy (levelinfo->mapname, mapname); - levelinfo->mapname[8] = 0; + levelinfo->MapName = mapname; + levelinfo->MapName.ToUpper(); sc.MustGetString (); if (sc.String[0] == '$') { @@ -1543,7 +1542,7 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo) // Set up levelnum now so that you can use Teleport_NewMap specials // to teleport to maps with standard names without needing a levelnum. - levelinfo->levelnum = GetDefaultLevelNum(levelinfo->mapname); + levelinfo->levelnum = GetDefaultLevelNum(levelinfo->MapName); // Does this map have a song defined via SNDINFO's $map command? // Set that as this map's default music if it does. diff --git a/src/p_acs.cpp b/src/p_acs.cpp index bd8c53edf..9469da06e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8942,7 +8942,7 @@ static void addDefered (level_info_t *i, acsdefered_t::EType type, int script, c def->playernum = -1; } i->defered = def; - DPrintf ("%s on map %s deferred\n", ScriptPresentation(script).GetChars(), i->mapname); + DPrintf ("%s on map %s deferred\n", ScriptPresentation(script).GetChars(), i->MapName.GetChars()); } } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index d94a16fbb..7cb5ca7e6 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -863,7 +863,7 @@ FUNC(LS_Teleport_NewMap) if (info && CheckIfExitIsGood (it, info)) { - G_ChangeLevel(info->mapname, arg1, arg2 ? CHANGELEVEL_KEEPFACING : 0); + G_ChangeLevel(info->MapName, arg1, arg2 ? CHANGELEVEL_KEEPFACING : 0); return true; } } @@ -1648,7 +1648,7 @@ FUNC(LS_ACS_Execute) } else if ((info = FindLevelByNum(arg1)) != NULL) { - mapname = info->mapname; + mapname = info->MapName; } else { @@ -1671,7 +1671,7 @@ FUNC(LS_ACS_ExecuteAlways) } else if ((info = FindLevelByNum(arg1)) != NULL) { - mapname = info->mapname; + mapname = info->MapName; } else { @@ -1718,7 +1718,7 @@ FUNC(LS_ACS_Suspend) if (arg1 == 0) P_SuspendScript (arg0, level.MapName); else if ((info = FindLevelByNum (arg1)) ) - P_SuspendScript (arg0, info->mapname); + P_SuspendScript (arg0, info->MapName); return true; } @@ -1731,7 +1731,7 @@ FUNC(LS_ACS_Terminate) if (arg1 == 0) P_TerminateScript (arg0, level.MapName); else if ((info = FindLevelByNum (arg1)) ) - P_TerminateScript (arg0, info->mapname); + P_TerminateScript (arg0, info->MapName); return true; } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4f1329f85..c2aa47faa 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -272,11 +272,12 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck) FString fmt; int lump_wad; int lump_map; - int lump_name; + int lump_name = -1; // Check for both *.wad and *.map in order to load Build maps // as well. The higher one will take precedence. - lump_name = Wads.CheckNumForName(mapname); + // Names with more than 8 characters will only be checked as .wad and .map. + if (strlen(mapname) <= 8) lump_name = Wads.CheckNumForName(mapname); fmt.Format("maps/%s.wad", mapname); lump_wad = Wads.CheckNumForFullName(fmt); fmt.Format("maps/%s.map", mapname); diff --git a/src/zstring.cpp b/src/zstring.cpp index dc171f398..14d19f46f 100644 --- a/src/zstring.cpp +++ b/src/zstring.cpp @@ -349,7 +349,14 @@ FString &FString::AppendCStrPart (const char *tail, size_t tailLen) return *this; } -void FString::Truncate (long newlen) +FString &FString::CopyCStrPart(const char *tail, size_t tailLen) +{ + ReallocBuffer(tailLen); + StrCopy(Chars, tail, tailLen); + return *this; +} + +void FString::Truncate(long newlen) { if (newlen >= 0 && newlen < (long)Len()) { diff --git a/src/zstring.h b/src/zstring.h index 874417a09..1736f3421 100644 --- a/src/zstring.h +++ b/src/zstring.h @@ -167,6 +167,7 @@ public: FString &operator += (char tail); FString &operator += (const FName &name) { return *this += name.GetChars(); } FString &AppendCStrPart (const char *tail, size_t tailLen); + FString &CopyCStrPart(const char *tail, size_t tailLen); FString &operator << (const FString &tail) { return *this += tail; } FString &operator << (const char *tail) { return *this += tail; } From 8c052818b7acdc428a590a0c0cd8922d5c7aeb94 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 10:27:40 +0200 Subject: [PATCH 12/29] - fixed: long texture name lookup did not work with TEXMAN_TryAny. --- src/textures/texturemanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 0af15d7af..9ff67803d 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -220,8 +220,8 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF { if (firsttype == FTexture::TEX_Null) return FTextureID(0); if (firsttype == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return FTextureID(0); + return FTextureID(firstfound); } - return FTextureID(firstfound); } From 47a9dab56d74fe021f454bccec91e57715f6db94 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 12:16:33 +0200 Subject: [PATCH 13/29] - allow setting sector planes' plane equations directly from UDMF. --- specs/udmf_zdoom.txt | 14 +++++++++- src/namedef.h | 9 ++++++ src/p_udmf.cpp | 65 ++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 81 insertions(+), 7 deletions(-) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index d7face672..1128b2e55 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -37,7 +37,7 @@ In addition to the base specification ZDoom recognizes the following lumps between the TEXTMAP and ENDMAP lumps: BEHAVIOR = contains compiled ACS code - DIALOGUE = contains compiled Strife conversation scripts. + DIALOGUE = contains compiled Strife or USDF conversation scripts. ZNODES = Nodes (must be stored as extended GL nodes. Compression is allowed but deprecated for portability reasons.) BLOCKMAP = blockmap. It is recommended not to include this lump in UDMF maps. @@ -166,6 +166,14 @@ Note: All fields default to false unless mentioned otherwise. yscaleceiling = ; // Y texture scale of ceiling texture, Default = 1.0. rotationfloor = ; // Rotation of floor texture in degrees, Default = 0.0. rotationceiling = ; // Rotation of ceiling texture in degrees, Default = 0.0. + ceilingplane_a = ; // Define the plane equation for the sector's ceiling. Default is a horizontal plane at 'heightceiling'. + ceilingplane_b = ; // 'heightceiling' will still be used to calculate texture alignment. + ceilingplane_c = ; // The plane equation will only be used if all 4 values are given. + ceilingplane_d = ; + floorplane_a = ; // Define the plane equation for the sector's floor. Default is a horizontal plane at 'heightfloor'. + floorplane_b = ; // 'heightfloor' will still be used to calculate texture alignment. + floorplane_c = ; // The plane equation will only be used if all 4 values are given. + floorplane_d = ; lightfloor = ; // The floor's light level. Default is 0. lightceiling = ; // The ceiling's light level. Default is 0. lightfloorabsolute = ; // true = 'lightfloor' is an absolute value. Default is @@ -355,6 +363,10 @@ Added waterzone sector property. 1.22 12.04.2014 Added transparent line property (to be folded back to core UDMF standard), and health, score, renderstyle, fillcolor, alpha, scale, scalex, scaley, pitch and roll thing properties. +1.24 14.05.2014 +Added plane equations for sector slopes. (Please read carefully to ensure proper use!) +Changed language describing the DIALOGUE lump to mention USDF as an option. + =============================================================================== EOF =============================================================================== diff --git a/src/namedef.h b/src/namedef.h index ba6de104d..a4c8da638 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -488,6 +488,15 @@ xx(blockhitscan) xx(Renderstyle) +xx(ceilingplane_a) +xx(ceilingplane_b) +xx(ceilingplane_c) +xx(ceilingplane_d) +xx(floorplane_a) +xx(floorplane_b) +xx(floorplane_c) +xx(floorplane_d) + // USDF keywords xx(Amount) xx(Text) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 2fa968502..0c380160d 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1245,6 +1245,7 @@ public: int lightcolor = -1; int fadecolor = -1; int desaturation = -1; + int fplaneflags = 0, cplaneflags = 0; memset(sec, 0, sizeof(*sec)); sec->lightlevel = 160; @@ -1446,6 +1447,48 @@ public: Flag(sec->MoreFlags, SECF_UNDERWATER, key); break; + case NAME_floorplane_a: + fplaneflags |= 1; + sec->floorplane.a = CheckFixed(key); + break; + + case NAME_floorplane_b: + fplaneflags |= 2; + sec->floorplane.b = CheckFixed(key); + break; + + case NAME_floorplane_c: + fplaneflags |= 4; + sec->floorplane.c = CheckFixed(key); + sec->floorplane.ic = FixedDiv(FRACUNIT, sec->floorplane.c); + break; + + case NAME_floorplane_d: + fplaneflags |= 8; + sec->floorplane.d = CheckFixed(key); + break; + + case NAME_ceilingplane_a: + cplaneflags |= 1; + sec->ceilingplane.a = CheckFixed(key); + break; + + case NAME_ceilingplane_b: + cplaneflags |= 2; + sec->ceilingplane.b = CheckFixed(key); + break; + + case NAME_ceilingplane_c: + cplaneflags |= 4; + sec->ceilingplane.c = CheckFixed(key); + sec->ceilingplane.ic = FixedDiv(FRACUNIT, sec->ceilingplane.c); + break; + + case NAME_ceilingplane_d: + cplaneflags |= 8; + sec->ceilingplane.d = CheckFixed(key); + break; + default: break; } @@ -1457,12 +1500,22 @@ public: } sec->secretsector = !!(sec->special&SECRET_MASK); - sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor); - sec->floorplane.c = FRACUNIT; - sec->floorplane.ic = FRACUNIT; - sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); - sec->ceilingplane.c = -FRACUNIT; - sec->ceilingplane.ic = -FRACUNIT; + + // Reset the planes to their defaults if not all of the plane equation's parameters were found. + if (fplaneflags != 15) + { + sec->floorplane.a = sec->floorplane.b = 0; + sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor); + sec->floorplane.c = FRACUNIT; + sec->floorplane.ic = FRACUNIT; + } + if (cplaneflags != 15) + { + sec->ceilingplane.a = sec->ceilingplane.b = 0; + sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling); + sec->ceilingplane.c = -FRACUNIT; + sec->ceilingplane.ic = -FRACUNIT; + } if (lightcolor == -1 && fadecolor == -1 && desaturation == -1) { From 388f09f786d5ab3927d3bb6d76895b043a18bdb6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 12:54:03 +0200 Subject: [PATCH 14/29] - fixed: In Heretic corpses do not get crunched to gibs, they just get their size reduced to 0. Handled by a new gameinfo flag. This also gets set for Chex quest which has the gib sprite replaced by something different. Using a Crush state will override this global flag. --- src/gi.cpp | 1 + src/gi.h | 1 + src/p_mobj.cpp | 10 ++++++++++ wadsrc/static/mapinfo/chex.txt | 1 + wadsrc/static/mapinfo/heretic.txt | 1 + 5 files changed, 14 insertions(+) diff --git a/src/gi.cpp b/src/gi.cpp index 8ab935854..4e64dd425 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -323,6 +323,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic") GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis") GAMEINFOKEY_BOOL(swapmenu, "swapmenu") + GAMEINFOKEY_BOOL(dontcrunchcorpses, "dontcrunchcorpses") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_COLOR(dimcolor, "dimcolor") diff --git a/src/gi.h b/src/gi.h index a1a03b2de..bbfbe73ff 100644 --- a/src/gi.h +++ b/src/gi.h @@ -113,6 +113,7 @@ struct gameinfo_t bool intermissioncounter; bool nightmarefast; bool swapmenu; + bool dontcrunchcorpses; TArray creditPages; TArray finalePages; TArray infoPages; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index c6a7fd35c..72679ef71 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1010,6 +1010,16 @@ bool AActor::Grind(bool items) if ((flags & MF_CORPSE) && !(flags3 & MF3_DONTGIB) && (health <= 0)) { FState * state = FindState(NAME_Crush); + + // In Heretic and Chex Quest we don't change the actor's sprite, just its size. + if (state == NULL && gameinfo.dontcrunchcorpses) + { + flags &= ~MF_SOLID; + flags3 |= MF3_DONTGIB; + height = radius = 0; + return false; + } + bool isgeneric = false; // ZDoom behavior differs from standard as crushed corpses cannot be raised. // The reason for the change was originally because of a problem with players, diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index edc5b4f29..e29eeeb4d 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -40,6 +40,7 @@ gameinfo definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 + dontcrunchcorpses = 1 endoom = "ENDOOM" player5start = 4001 drawreadthis = true diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 196e81c50..d372466f5 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -56,6 +56,7 @@ gameinfo nightmarefast = true pausesign = "PAUSED" gibfactor = 0.5 + dontcrunchcorpses = true cursorpic = "herecurs" textscreenx = 20 textscreeny = 5 From 51ed68dc7243cf00c285526a8009a2fa2d4c427d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 13:02:04 +0200 Subject: [PATCH 15/29] - forgot to save this... --- wadsrc/static/mapinfo/chex.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index e29eeeb4d..1edaf9256 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -40,7 +40,7 @@ gameinfo definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 - dontcrunchcorpses = 1 + dontcrunchcorpses = true endoom = "ENDOOM" player5start = 4001 drawreadthis = true From 85fb8c4326a0f5ca010f0495275d04ccd4d8860e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 13:04:47 +0200 Subject: [PATCH 16/29] - fixed: _M_X64 macro was misnamed _M_IX64. --- src/nodebuild.h | 2 +- src/x86.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nodebuild.h b/src/nodebuild.h index 81c7b1345..ce68c4682 100644 --- a/src/nodebuild.h +++ b/src/nodebuild.h @@ -347,7 +347,7 @@ inline int FNodeBuilder::ClassifyLine (node_t &node, const FPrivVert *v1, const #ifdef DISABLE_SSE return ClassifyLine2 (node, v1, v2, sidev); #else -#if defined(__SSE2__) || defined(_M_IX64) +#if defined(__SSE2__) || defined(_M_X64) // If compiling with SSE2 support everywhere, just use the SSE2 version. return ClassifyLineSSE2 (node, v1, v2, sidev); #elif defined(_MSC_VER) && _MSC_VER < 1300 diff --git a/src/x86.cpp b/src/x86.cpp index ec36aae93..89d88333d 100644 --- a/src/x86.cpp +++ b/src/x86.cpp @@ -299,7 +299,7 @@ void DoBlending_SSE2(const PalEntry *from, PalEntry *to, int count, int r, int g } #endif -#if defined(__amd64__) || defined(_M_IX64) +#if defined(__amd64__) || defined(_M_X64) long long color; blending256 = _mm_set_epi64x(0x10001000100ll, 0x10001000100ll); From 802a47876602251c9c7ec6bd7f63da21c3d24165 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 14:03:15 +0200 Subject: [PATCH 17/29] - Heretic doesn't really need dontcrunchcorpses because there was already some alternative handling for that situation. --- wadsrc/static/mapinfo/heretic.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index d372466f5..196e81c50 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -56,7 +56,6 @@ gameinfo nightmarefast = true pausesign = "PAUSED" gibfactor = 0.5 - dontcrunchcorpses = true cursorpic = "herecurs" textscreenx = 20 textscreeny = 5 From 2944e4f6ae8601ca567baafbe9b6e80daae138a3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 14:08:14 +0200 Subject: [PATCH 18/29] - fixed some Linux issues with recent changes. --- src/sdl/i_main.cpp | 6 +----- src/textures/texturemanager.cpp | 2 +- src/wi_stuff.cpp | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index 1736305d8..db6979330 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -172,11 +172,7 @@ static int DoomSpecificInfo (char *buffer, char *end) } else { - char name[9]; - - strncpy (name, level.mapname, 8); - name[8] = 0; - p += snprintf (buffer+p, size-p, "\n\nCurrent map: %s", name); + p += snprintf (buffer+p, size-p, "\n\nCurrent map: %s", level.MapName); if (!viewactive) { diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 9ff67803d..aa9ef706b 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -233,7 +233,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF { FTexture *const NO_TEXTURE = (FTexture*)-1; int lump = Wads.CheckNumForFullName(name); - if (lump != NULL) + if (lump >= 0) { FTexture *tex = Wads.GetLinkedTexture(lump); if (tex == NO_TEXTURE) return FTextureID(-1); diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 0cf5e7b77..982668566 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -314,7 +314,7 @@ static bool IsExMy(const char * name) void WI_LoadBackground(bool isenterpic) { - const char *lumpname; + const char *lumpname = NULL; char buffer[10]; in_anim_t an; lnode_t pt; From adcdc11360c9672105c9c8fabb989247d1f2cd40 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 15:44:05 +0200 Subject: [PATCH 19/29] - GCC compile fix. --- src/sdl/i_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index db6979330..3c721ae51 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -172,7 +172,7 @@ static int DoomSpecificInfo (char *buffer, char *end) } else { - p += snprintf (buffer+p, size-p, "\n\nCurrent map: %s", level.MapName); + p += snprintf (buffer+p, size-p, "\n\nCurrent map: %s", level.MapName.GetChars()); if (!viewactive) { From e3cd144af9692192accb853691a6ccf4a6d5ae2d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2014 17:27:22 +0200 Subject: [PATCH 20/29] - one last GCC compile problem. --- src/g_mapinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 874a659c6..7203fdb51 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -302,7 +302,7 @@ FString level_info_t::LookupLevelName() // Strip out the header from the localized string if (MapName.Len() > 3 && MapName[0] == 'E' && MapName[2] == 'M') { - mysnprintf (checkstring, countof(checkstring), "%s: ", MapName); + mysnprintf (checkstring, countof(checkstring), "%s: ", MapName.GetChars()); } else if (MapName.Len() > 3 && MapName[0] == 'M' && MapName[1] == 'A' && MapName[2] == 'P') { From 03d4f23a6e94b9c6d89ac3dcea2b187014d1384c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 15 May 2014 19:27:22 +0200 Subject: [PATCH 21/29] - made adjustments to the texture loading code to account for the recent changes to handle long texture names. --- src/gl/models/gl_models.cpp | 9 +------ src/gl/textures/gl_material.cpp | 2 +- src/gl/textures/gl_skyboxtexture.cpp | 10 +++---- src/gl/textures/gl_texture.cpp | 40 +++++----------------------- src/gl/utility/gl_clock.cpp | 2 +- 5 files changed, 14 insertions(+), 49 deletions(-) diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 39668cd02..808cbff95 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -141,14 +141,7 @@ FTexture * LoadSkin(const char * path, const char * fn) int texlump = FindGFXFile(buffer); if (texlump>=0) { - FTextureID texno = TexMan.FindTextureByLumpNum(texlump); - if (!texno.isValid()) - { - FTexture *tex = FTexture::CreateTexture("", texlump, FTexture::TEX_Override); - TexMan.AddTexture(tex); - return tex; - } - return TexMan[texno]; + return TexMan.FindTexture(Wads.GetLumpFullName(texlump), FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny); } else { diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 9cb3ef523..008e6e8cd 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -855,7 +855,7 @@ void FMaterial::Bind(int cm, int clampmode, int translation, int overrideshader) FTexture *layer; if (mTextureLayers[i].animated) { - FTextureID id = mTextureLayers[i].texture->GetID(); + FTextureID id = mTextureLayers[i].texture->id; layer = TexMan(id); ValidateSysTexture(layer, false); } diff --git a/src/gl/textures/gl_skyboxtexture.cpp b/src/gl/textures/gl_skyboxtexture.cpp index f9918dff2..2db39c7a0 100644 --- a/src/gl/textures/gl_skyboxtexture.cpp +++ b/src/gl/textures/gl_skyboxtexture.cpp @@ -205,15 +205,13 @@ void gl_ParseVavoomSkybox() sc.MustGetString(); maplump = Wads.CheckNumForFullName(sc.String, true); - if (maplump==-1) - Printf("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name); - FTextureID tex = TexMan.FindTextureByLumpNum(maplump); - if (!tex.isValid()) + FTexture *tex = TexMan.FindTexture(sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_TryAny); + if (tex != NULL) { - tex = TexMan.CreateTexture(maplump, FTexture::TEX_MiscPatch); + Printf("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name); } - sb->faces[facecount] = TexMan[tex]; + sb->faces[facecount] = tex; sc.MustGetStringName("}"); } facecount++; diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index 68c33f125..29cafe27b 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -696,8 +696,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) bool disable_fullbright=false; bool thiswad = false; bool iwad = false; - int maplump = -1; - FString maplumpname; + FTexture *bmtex = NULL; sc.MustGetString(); if (sc.Compare("texture")) type = FTexture::TEX_Wall; @@ -734,17 +733,15 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) { sc.MustGetString(); - if (maplump >= 0) + if (bmtex != NULL) { Printf("Multiple brightmap definitions in texture %s\n", tex? tex->Name : "(null)"); } - maplump = Wads.CheckNumForFullName(sc.String, true); + bmtex = TexMan.FindTexture(sc.String, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny); - if (maplump==-1) + if (bmtex == NULL) Printf("Brightmap '%s' not found in texture '%s'\n", sc.String, tex? tex->Name : "(null)"); - - maplumpname = sc.String; } } if (!tex) @@ -764,7 +761,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) if (!useme) return; } - if (maplump != -1) + if (bmtex != NULL) { if (tex->bWarped != 0) { @@ -772,31 +769,8 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) return; } - // Brightmap textures are stored in the texture manager so that multiple - // instances of the same textures can be avoided. - FTexture *brightmap; - FTextureID brightmapId = TexMan.FindTextureByLumpNum(maplump); - - if (!brightmapId.isValid()) - { - // a texture for this lump has not been created yet. - brightmap = FTexture::CreateTexture(maplump, tex->UseType); - if (!brightmap) - { - Printf("Unable to create texture from '%s' in brightmap definition for '%s'\n", - maplumpname.GetChars(), tex->Name); - return; - } - brightmap->gl_info.bBrightmap = true; - brightmap->Name[0] = 0; // brightmaps don't have names - TexMan.AddTexture(brightmap); - } - else - { - brightmap = TexMan[brightmapId]; - } - - tex->gl_info.Brightmap = brightmap; + bmtex->gl_info.bBrightmap = true; + tex->gl_info.Brightmap = bmtex; } tex->gl_info.bBrightmapDisablesFullbright = disable_fullbright; } diff --git a/src/gl/utility/gl_clock.cpp b/src/gl/utility/gl_clock.cpp index 7ad32f8ee..7759f5582 100644 --- a/src/gl/utility/gl_clock.cpp +++ b/src/gl/utility/gl_clock.cpp @@ -183,7 +183,7 @@ void CheckBench() FString compose; compose.Format("Map %s: \"%s\",\nx = %1.4f, y = %1.4f, z = %1.4f, angle = %1.4f, pitch = %1.4f\n", - level.mapname, level.LevelName.GetChars(), FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz), + level.MapName.GetChars(), level.LevelName.GetChars(), FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz), ANGLE_TO_FLOAT(viewangle), ANGLE_TO_FLOAT(viewpitch)); AppendRenderStats(compose); From bf6a193e5bc3806131e0f7b9493274003c142bed Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 15 May 2014 20:29:36 +0200 Subject: [PATCH 22/29] - fixed: The episode parser was still truncating its map names to 8 characters. --- src/g_level.h | 2 +- src/g_mapinfo.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/g_level.h b/src/g_level.h index ebd52c8f6..0cd366798 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -79,7 +79,7 @@ struct FMapInfoParser bool ParseLookupName(FString &dest); void ParseMusic(FString &name, int &order); - void ParseLumpOrTextureName(char *name); + //void ParseLumpOrTextureName(char *name); void ParseLumpOrTextureName(FString &name); void ParseCluster(); diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 7203fdb51..b7aa77e1c 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -622,12 +622,14 @@ bool FMapInfoParser::ParseLookupName(FString &dest) // //========================================================================== +/* void FMapInfoParser::ParseLumpOrTextureName(char *name) { sc.MustGetString(); uppercopy(name, sc.String); name[8]=0; } +*/ void FMapInfoParser::ParseLumpOrTextureName(FString &name) { @@ -1572,7 +1574,7 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo) void FMapInfoParser::ParseEpisodeInfo () { unsigned int i; - char map[9]; + FString map; FString pic; FString name; bool remove = false; @@ -1583,15 +1585,14 @@ void FMapInfoParser::ParseEpisodeInfo () // Get map name sc.MustGetString (); - uppercopy (map, sc.String); - map[8] = 0; + map = sc.String; if (sc.CheckString ("teaser")) { sc.MustGetString (); if (gameinfo.flags & GI_SHAREWARE) { - uppercopy (map, sc.String); + map = sc.String; } } From 25f4af734fa73006fa48c6463ce09c9b84aa1368 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 16 May 2014 10:56:23 +0200 Subject: [PATCH 23/29] - fixed: ACS's check...Texture functions must use the same search flags as the texture initialization code in p_setup.cpp and p_udmf.cpp. It also should not create textures that don't exist yet. We are only doing a comparison so it's not relevant if the texture exists or not. --- src/p_acs.cpp | 4 +++- src/textures/texturemanager.cpp | 1 + src/textures/textures.h | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 9469da06e..981870a36 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3944,7 +3944,9 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b { return 0; } - FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string)); + FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string), FTexture::TEX_Flat, + FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_DontCreate); + if (tex == NULL) { // If the texture we want to check against doesn't exist, then // they're obviously not the same. diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index aa9ef706b..6fb963e42 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -238,6 +238,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF FTexture *tex = Wads.GetLinkedTexture(lump); if (tex == NO_TEXTURE) return FTextureID(-1); if (tex != NULL) return tex->id; + if (flags & TEXMAN_DontCreate) return FTextureID(-1); // we only want to check, there's no need to create a texture if we don't have one yet. tex = FTexture::CreateTexture("", lump, FTexture::TEX_Override); if (tex != NULL) { diff --git a/src/textures/textures.h b/src/textures/textures.h index 8c41ee844..15c9bce5c 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -363,7 +363,8 @@ public: TEXMAN_Overridable = 2, TEXMAN_ReturnFirst = 4, TEXMAN_AllowSkins = 8, - TEXMAN_ShortNameOnly = 16 + TEXMAN_ShortNameOnly = 16, + TEXMAN_DontCreate = 32 }; FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny); From d3dcc04666f8179b16ef4fd8624ac68ec441f3b8 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 17 May 2014 00:35:27 +1200 Subject: [PATCH 24/29] Fix nettic run-out at end of demo playback --- src/d_net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index a2e0798b2..f1b476108 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1054,7 +1054,7 @@ void NetUpdate (void) if (demoplayback) { - nettics[0] = (maketic / ticdup); + resendto[0] = nettics[0] = (maketic / ticdup); return; // Don't touch netcmd data while playing a demo, as it'll already exist. } From e92032e8ffe73da1ce3fe61c94fc2f7e447a09d7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 16 May 2014 22:48:37 +0200 Subject: [PATCH 25/29] - fixed: The map setup code was still truncating texture names in several places. --- src/doomdata.h | 8 ++++++++ src/p_setup.cpp | 50 ++++++++++++++++++++++++------------------------- src/p_udmf.cpp | 26 ++++++++++++------------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/src/doomdata.h b/src/doomdata.h index 9cedf8cdc..215c2a263 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -85,6 +85,14 @@ struct mapsidedef_t short sector; // Front sector, towards viewer. }; +struct intmapsidedef_t +{ + FString toptexture; + FString bottomtexture; + FString midtexture; +}; + + // A LineDef, as used for editing, and as input to the BSP builder. struct maplinedef_t { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index c2aa47faa..a6462f31c 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -577,13 +577,11 @@ void MapData::GetChecksum(BYTE cksum[16]) // //=========================================================================== -static void SetTexture (side_t *side, int position, const char *name8, FMissingTextureTracker &track) +static void SetTexture (side_t *side, int position, const char *name, FMissingTextureTracker &track) { static const char *positionnames[] = { "top", "middle", "bottom" }; static const char *sidenames[] = { "first", "second" }; - char name[9]; - strncpy (name, name8, 8); - name[8] = 0; + FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny); @@ -619,12 +617,17 @@ static void SetTexture (side_t *side, int position, const char *name8, FMissingT // //=========================================================================== -void SetTexture (sector_t *sector, int index, int position, const char *name8, FMissingTextureTracker &track) +void SetTexture (sector_t *sector, int index, int position, const char *name, FMissingTextureTracker &track, bool truncate) { static const char *positionnames[] = { "floor", "ceiling" }; - char name[9]; - strncpy (name, name8, 8); - name[8] = 0; + char name8[9]; + if (truncate) + { + strncpy(name8, name, 8); + name8[8] = 0; + name = name8; + } + FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny); @@ -674,11 +677,8 @@ static void SummarizeMissingTextures(const FMissingTextureTracker &missing) // //=========================================================================== -static void SetTexture (side_t *side, int position, DWORD *blend, char *name8) +static void SetTexture (side_t *side, int position, DWORD *blend, const char *name) { - char name[9]; - strncpy (name, name8, 8); - name[8] = 0; FTextureID texture; if ((*blend = R_ColormapNumForName (name)) == 0) { @@ -705,12 +705,9 @@ static void SetTexture (side_t *side, int position, DWORD *blend, char *name8) side->SetTexture(position, texture); } -static void SetTextureNoErr (side_t *side, int position, DWORD *color, char *name8, bool *validcolor, bool isFog) +static void SetTextureNoErr (side_t *side, int position, DWORD *color, const char *name, bool *validcolor, bool isFog) { - char name[9]; FTextureID texture; - strncpy (name, name8, 8); - name[8] = 0; *validcolor = false; texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny); @@ -1515,8 +1512,8 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex) ss->ceilingplane.d = ss->GetPlaneTexZ(sector_t::ceiling); ss->ceilingplane.c = -FRACUNIT; ss->ceilingplane.ic = -FRACUNIT; - SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex); - SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex); + SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true); + SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true); ss->lightlevel = LittleShort(ms->lightlevel); if (map->HasBehavior) ss->special = LittleShort(ms->special); @@ -2473,11 +2470,8 @@ int P_DetermineTranslucency (int lumpnum) return newcolor.r; } -void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &missingtex) +void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &missingtex) { - char name[9]; - name[8] = 0; - switch (special) { case Transfer_Heights: // variable colormap via 242 linedef @@ -2503,7 +2497,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside SetTextureNoErr (sd, side_t::bottom, &fog, msd->bottomtexture, &foggood, true); SetTextureNoErr (sd, side_t::top, &color, msd->toptexture, &colorgood, false); - strncpy (name, msd->midtexture, 8); SetTexture(sd, side_t::mid, msd->midtexture, missingtex); if (colorgood | foggood) @@ -2534,8 +2527,7 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside case Sector_Set3DFloor: if (msd->toptexture[0]=='#') { - strncpy (name, msd->toptexture, 8); - sd->SetTexture(side_t::top, FNullTextureID() +(-strtol(name+1, NULL, 10))); // store the alpha as a negative texture index + sd->SetTexture(side_t::top, FNullTextureID() +(-strtol(&msd->toptexture[1], NULL, 10))); // store the alpha as a negative texture index // This will be sorted out by the 3D-floor code later. } else @@ -2629,7 +2621,13 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex) { sd->sector = sec = §ors[LittleShort(msd->sector)]; } - P_ProcessSideTextures(!map->HasBehavior, sd, sec, msd, + + intmapsidedef_t imsd; + imsd.toptexture.CopyCStrPart(msd->toptexture, 8); + imsd.midtexture.CopyCStrPart(msd->midtexture, 8); + imsd.bottomtexture.CopyCStrPart(msd->bottomtexture, 8); + + P_ProcessSideTextures(!map->HasBehavior, sd, sec, &imsd, sidetemp[i].a.special, sidetemp[i].a.tag, &sidetemp[i].a.alpha, missingtex); } delete[] msdf; diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 0c380160d..19dfdf08c 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -118,8 +118,8 @@ enum // namespace for each game }; -void SetTexture (sector_t *sector, int index, int position, const char *name8, FMissingTextureTracker &); -void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &); +void SetTexture (sector_t *sector, int index, int position, const char *name, FMissingTextureTracker &, bool truncate); +void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &); void P_AdjustLine (line_t *ld); void P_FinishLoadingLineDef(line_t *ld, int alpha); void SpawnMapThing(int index, FMapThing *mt, int position); @@ -394,7 +394,7 @@ class UDMFParser : public UDMFParserBase TArray ParsedLines; TArray ParsedSides; - TArray ParsedSideTextures; + TArray ParsedSideTextures; TArray ParsedSectors; TArray ParsedVertices; TArray ParsedVertexDatas; @@ -1089,14 +1089,14 @@ public: // //=========================================================================== - void ParseSidedef(side_t *sd, mapsidedef_t *sdt, int index) + void ParseSidedef(side_t *sd, intmapsidedef_t *sdt, int index) { fixed_t texofs[2]={0,0}; memset(sd, 0, sizeof(*sd)); - strncpy(sdt->bottomtexture, "-", 8); - strncpy(sdt->toptexture, "-", 8); - strncpy(sdt->midtexture, "-", 8); + sdt->bottomtexture = "-"; + sdt->toptexture = "-"; + sdt->midtexture = "-"; sd->SetTextureXScale(FRACUNIT); sd->SetTextureYScale(FRACUNIT); @@ -1115,15 +1115,15 @@ public: continue; case NAME_Texturetop: - strncpy(sdt->toptexture, CheckString(key), 8); + sdt->toptexture = CheckString(key); continue; case NAME_Texturebottom: - strncpy(sdt->bottomtexture, CheckString(key), 8); + sdt->bottomtexture = CheckString(key); continue; case NAME_Texturemiddle: - strncpy(sdt->midtexture, CheckString(key), 8); + sdt->midtexture = CheckString(key); continue; case NAME_Sector: @@ -1287,11 +1287,11 @@ public: continue; case NAME_Texturefloor: - SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex); + SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex, false); continue; case NAME_Textureceiling: - SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex); + SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex, false); continue; case NAME_Lightlevel: @@ -1799,7 +1799,7 @@ public: else if (sc.Compare("sidedef")) { side_t si; - mapsidedef_t st; + intmapsidedef_t st; ParseSidedef(&si, &st, ParsedSides.Size()); ParsedSides.Push(si); ParsedSideTextures.Push(st); From ff7913ace8156cd8bfda3533f3afcb77897d1646 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 17 May 2014 09:46:58 +0200 Subject: [PATCH 26/29] - fixed: When a level gets loaded the renderer's sky variables need to be set. --- src/g_level.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/g_level.cpp b/src/g_level.cpp index 74a92edb5..8c97a399c 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1410,6 +1410,8 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) } if (arc.IsLoading()) { + sky1texture = level.skytexture1; + sky2texture = level.skytexture2; R_InitSkyMap(); } From 26b1abe3dab611001b49ce717853b0accd8c5516 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 18 May 2014 18:37:34 +1200 Subject: [PATCH 27/29] Fix netgame arbitration with long map lump names --- src/d_net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index f1b476108..1600d9102 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1385,7 +1385,7 @@ bool DoArbitrate (void *userdata) stream = &netbuffer[4]; s = ReadString (&stream); - startmap = FString(s, 8); + startmap = FString(s, strlen(s)); delete[] s; rngseed = ReadLong (&stream); C_ReadCVars (&stream); From cfef89486740cdfca0682dcc60caf2b3cdb5bbc9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 18 May 2014 09:41:13 +0200 Subject: [PATCH 28/29] This can be done better... --- src/d_net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 1600d9102..60a2b61c4 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1385,7 +1385,7 @@ bool DoArbitrate (void *userdata) stream = &netbuffer[4]; s = ReadString (&stream); - startmap = FString(s, strlen(s)); + startmap = s; delete[] s; rngseed = ReadLong (&stream); C_ReadCVars (&stream); From 4acc04ce68f37a1340de81f0d754fe8951fa47ca Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 18 May 2014 10:05:35 +0200 Subject: [PATCH 29/29] - don't truncate map names stored in demos. --- src/g_game.cpp | 28 +++++++++++++++++----------- src/version.h | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 045b331bf..65fa5733d 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2302,11 +2302,10 @@ void G_BeginRecording (const char *startmap) WriteWord (DEMOGAMEVERSION, &demo_p); // Write ZDoom version *demo_p++ = 2; // Write minimum version needed to use this demo. *demo_p++ = 3; // (Useful?) - for (i = 0; i < 8; i++) // Write name of map demo was recorded on. - { - *demo_p++ = startmap[i]; - } - WriteLong (rngseed, &demo_p); // Write RNG seed + + strcpy((char*)demo_p, startmap); // Write name of map demo was recorded on. + demo_p += strlen(startmap) + 1; + WriteLong(rngseed, &demo_p); // Write RNG seed *demo_p++ = consoleplayer; FinishChunk (&demo_p); @@ -2385,7 +2384,7 @@ CCMD (timedemo) // [RH] Process all the information in a FORM ZDEM // until a BODY chunk is entered. -bool G_ProcessIFFDemo (char *mapname) +bool G_ProcessIFFDemo (FString &mapname) { bool headerHit = false; bool bodyHit = false; @@ -2441,9 +2440,16 @@ bool G_ProcessIFFDemo (char *mapname) Printf ("Demo requires a newer version of ZDoom!\n"); return true; } - memcpy (mapname, demo_p, 8); // Read map name - mapname[8] = 0; - demo_p += 8; + if (demover >= 0x21a) + { + mapname = (char*)demo_p; + demo_p += mapname.Len() + 1; + } + else + { + mapname = FString((char*)demo_p, 8); + demo_p += 8; + } rngseed = ReadLong (&demo_p); // Only reset the RNG if this demo is not in conjunction with a savegame. if (mapname[0] != 0) @@ -2525,7 +2531,7 @@ bool G_ProcessIFFDemo (char *mapname) void G_DoPlayDemo (void) { - char mapname[9]; + FString mapname; int demolump; gameaction = ga_nothing; @@ -2578,7 +2584,7 @@ void G_DoPlayDemo (void) // don't spend a lot of time in loadlevel precache = false; demonew = true; - if (mapname[0] != 0) + if (mapname.Len() != 0) { G_InitNew (mapname, false); } diff --git a/src/version.h b/src/version.h index 1b4457655..8e853057a 100644 --- a/src/version.h +++ b/src/version.h @@ -61,7 +61,7 @@ const char *GetVersionString(); // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. // Otherwise, it should be safe to leave it alone. -#define DEMOGAMEVERSION 0x219 +#define DEMOGAMEVERSION 0x21A // Minimum demo version we can play. // Bump it whenever you change or remove existing DEM_ commands.