diff --git a/src/r_sky.cpp b/src/r_sky.cpp index d93ee59f2..993456a66 100644 --- a/src/r_sky.cpp +++ b/src/r_sky.cpp @@ -69,8 +69,8 @@ void R_InitSkyMap () int skyheight; FTexture *skytex1, *skytex2; - skytex1 = TexMan[sky1texture]; - skytex2 = TexMan[sky2texture]; + skytex1 = TexMan(sky1texture, true); + skytex2 = TexMan(sky2texture, true); if (skytex1 == NULL) return; @@ -107,9 +107,8 @@ void R_InitSkyMap () } else if (skyheight > 200) { - skytexturemid = (200 - skyheight) << FRACBITS; + skytexturemid = FixedMul((200 - skyheight) << FRACBITS, skytex1->yScale); } - skytexturemid = FixedMul(skytexturemid, skytex1->yScale); if (viewwidth != 0 && viewheight != 0) { diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 1abbab29f..6fdac54c2 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -51,11 +51,16 @@ #include "farchive.h" #include "v_video.h" #include "r_renderer.h" +#include "r_sky.h" #include "textures/textures.h" FTextureManager TexMan; -CVAR(Bool, vid_nopalsubstitutions, false, CVAR_ARCHIVE) +CUSTOM_CVAR(Bool, vid_nopalsubstitutions, false, CVAR_ARCHIVE) +{ + // This is in case the sky texture has been substituted. + R_InitSkyMap (); +} //========================================================================== // @@ -1026,13 +1031,13 @@ void FTextureManager::InitPalettedVersions() FTextureID pic1 = CheckForTexture(sc.String, FTexture::TEX_Any); if (!pic1.isValid()) { - sc.ScriptMessage("Unknown texture %s to replace"); + sc.ScriptMessage("Unknown texture %s to replace", sc.String); } sc.MustGetString(); FTextureID pic2 = CheckForTexture(sc.String, FTexture::TEX_Any); if (!pic2.isValid()) { - sc.ScriptMessage("Unknown texture %s to use as replacement"); + sc.ScriptMessage("Unknown texture %s to use as replacement", sc.String); } if (pic1.isValid() && pic2.isValid()) { diff --git a/src/v_font.cpp b/src/v_font.cpp index c1923e4ac..6bb130716 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -1073,7 +1073,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) FontHeight = data[4] + data[5]*256; FirstChar = data[6]; LastChar = data[7]; - ActiveColors = data[10]; + ActiveColors = data[10]+1; PatchRemap = NULL; RescalePalette = data[9] == 0; @@ -1125,9 +1125,9 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) SpaceWidth = totalwidth * 2 / (3 * count); } - memcpy(PaletteData, palette, (ActiveColors+1)*3); + memcpy(PaletteData, palette, ActiveColors*3); - data_p = palette + (ActiveColors+1)*3; + data_p = palette + ActiveColors*3; for (i = 0; i < count; ++i) {