From c845675b9b0ba0334fe172fb5a314e341afb64b7 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Fri, 30 Nov 2012 23:36:02 +0000 Subject: [PATCH] - Fixed: When using PALVERS on the sky, it used the scaling from the true color version. (Side Note: I changed a line that scales the sky position according to the y scaling factor. This is because a 2x high resolution sky at 2048x256 wasn't positioned the same as a 1024x128 unscaled version. I moved the expression to the > 200 height path only, but I'm not sure if it's even still needed.) - Fixed: PALVERS crashed with unknown textures since a value was never given for %s. - Fixed: FON2 loader didn't set ActiveColors correctly. SVN r3973 (trunk) --- src/r_sky.cpp | 7 +++---- src/textures/texturemanager.cpp | 11 ++++++++--- src/v_font.cpp | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) 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) {