This commit is contained in:
Christoph Oelckers 2014-05-13 12:00:37 +02:00
commit a05e584b81
12 changed files with 66 additions and 63 deletions

View file

@ -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();

View file

@ -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 ();
}

View file

@ -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"))

View file

@ -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 ();
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())
{
R_InitSkyMap();
}
G_AirControlChanged ();

View file

@ -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;

View file

@ -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.
}

View file

@ -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();
}

View file

@ -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;

View file

@ -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);

View file

@ -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 ();

View file

@ -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
{

View file

@ -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)