Skip to content

Commit

Permalink
Added, Visual mode: both Sky1 and Sky2 MAPINFO properties are now use…
Browse files Browse the repository at this point in the history
…d when creating classic skybox texture.
  • Loading branch information
m-x-d committed Mar 8, 2016
1 parent e561d13 commit 53a2344
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Source/Core/Data/DataManager.cs
Expand Up @@ -2588,10 +2588,29 @@ internal void SetupSkybox()
{
// Create classic texture
Vector2D scale;
Bitmap img = GetTextureBitmap(skytex, out scale);
if(img != null)
Bitmap sky1 = GetTextureBitmap(skytex, out scale);
if(sky1 != null)
{
skybox = MakeClassicSkyBox(img, scale);
// Double skies?
if(mapinfo.DoubleSky)
{
Bitmap sky2 = GetTextureBitmap(mapinfo.Sky2);
if(sky2 != null)
{
// Resize if needed
if(sky2.Width != sky1.Width || sky2.Height != sky1.Height)
ResizeImage(sky2, sky1.Width, sky1.Height);

// Combine both textures. Sky2 is below Sky1
using(Graphics g = Graphics.FromImage(sky2))
g.DrawImageUnscaled(sky1, 0, 0);

// Use the composite one
sky1 = sky2;
}
}

skybox = MakeClassicSkyBox(sky1, scale);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions Source/Core/GZBuilder/GZDoom/MapinfoParser.cs
Expand Up @@ -189,6 +189,16 @@ public bool Parse(TextResourceData data, string mapname, bool clearerrors)
if(mapinfo.OutsideFogDensity > 0 && (mapinfo.OutsideFogColor.Red > 0 || mapinfo.OutsideFogColor.Green > 0 || mapinfo.OutsideFogColor.Blue > 0))
mapinfo.HasOutsideFogColor = true;

if(!string.IsNullOrEmpty(mapinfo.Sky2) && !mapinfo.DoubleSky)
{
LogWarning("\"Sky2\" is defined without \"doublesky\" flag. It won't be shown ingame");
}
else if(string.IsNullOrEmpty(mapinfo.Sky2) && mapinfo.DoubleSky)
{
LogWarning("\"doublesky\" flag is defined without \"Sky2\" property.");
mapinfo.DoubleSky = false;
}

// All done
return !this.HasError;
}
Expand Down

0 comments on commit 53a2344

Please sign in to comment.