diff --git a/Makefile.linux b/Makefile.linux index 6e0d4e491..5a0fbc247 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -10,26 +10,26 @@ else CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing -O2 -fomit-frame-pointer CXXFLAGS ?= -fno-rtti endif -ifdef GC - CFLAGS += -ffunction-sections - LDFLAGS += -Wl,--gc-sections -endif +#ifdef GC +# CFLAGS += -ffunction-sections +# LDFLAGS += -Wl,--gc-sections +#endif CFLAGS += -MMD -DHAVE_FILELENGTH -D__forceinline=inline `sdl-config --cflags` `pkg-config gtk+-2.0 --cflags` CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR LDFLAGS += snes_spc/libsnes_spc.a -lz -ljpeg -lfmodex `sdl-config --libs` `pkg-config gtk+-2.0 --libs` NASMFLAGS += -f elf -DM_TARGET_LINUX -SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/) +SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/ xlat/) VPATH = $(SRCDIRS) INCLUDES = $(addprefix -I,$(SRCDIRS)) -INCLUDES += snes_spc/snes_spc/ /usr/local/include/fmodex/ +INCLUDES += -Isnes_spc/snes_spc/ -I/usr/include/fmodex/ CFLAGS += $(INCLUDES) RELEASEOBJ ?= releaseobj DEBUGOBJ ?= debugobj -CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS))) src/xlat/parse_xlat.cpp -CSRCS = $(wildcard $(addsuffix *.c,$(SRCDIRS))) +CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS))) +CSRCS = $(filter-out src/xlat/xlat_parser.c, $(wildcard $(addsuffix *.c,$(SRCDIRS)))) ifdef NOASM CFLAGS += -DNOASM else @@ -64,9 +64,9 @@ COBJS = $(addprefix $(OBJDIR)/,$(CPPOBJFILES) $(COBJFILES)) DEPS = $(patsubst %.o,%.d,$(COBJS)) OBJS = $(addprefix $(OBJDIR)/,$(AOBJFILES)) $(COBJS) -all: $(ZDOOMBIN) snes_spc/libsnes_spc.a toolsandpk3 zdoom.pk3 +all: $(ZDOOMBIN) toolsandpk3 zdoom.pk3 -$(ZDOOMBIN): ccdv updaterev $(OBJDIR) $(OBJS) +$(ZDOOMBIN): ccdv updaterev $(OBJDIR) $(OBJS) snes_spc/libsnes_spc.a $(CCDV) $(CXX) $(LDFLAGS) $(OBJDIR)/autostart.o \ $(filter-out %/autostart.o %/autozend.o,$(OBJS)) \ $(OBJDIR)/autozend.o -o $(ZDOOMBIN) @@ -88,17 +88,13 @@ $(OBJDIR)/nodebuild_classify_sse2.o: nodebuild_classify_sse2.cpp $(OBJDIR)/fmopl.o: src/oplsynth/fmopl.cpp $(CCDV) $(CXX) $(CXXFLAGS) -fno-tree-dominator-opts -fno-tree-fre -c -o $@ $< -src/xlat/xlat_parser.c: src/xlat/xlat_parser.y - $(CCDV) $(LEMON) -s src/xlat/xlat_parser.y - -# Dunno why make isn't picking this stuff up automatically for this file. -$(OBJDIR)/parse_xlat.o: src/xlat/parse_xlat.cpp src/xlat/xlat.h src/xlat/xlat_parser.c src/xlat/xlat_parser.h - $(CCDV) $(CXX) $(CXXFLAGS) -o $@ -c $< +src/xlat/xlat_parser.c: tools/lemon/lemon src/xlat/xlat_parser.y + $(CCDV) tools/lemon/lemon -s src/xlat/xlat_parser.y $(OBJDIR): mkdir $(OBJDIR) -toolsandpk3: ccdv tools/makewad/makewad tools/dehsupp/dehsupp +toolsandpk3: ccdv tools/makewad/makewad tools/dehsupp/dehsupp tools/lemon/lemon $(MAKE) -C wadsrc/ zdoom.pk3: toolsandpk3 @@ -113,6 +109,8 @@ tools/makewad/makewad: tools/dehsupp/dehsupp: $(MAKE) -C tools/dehsupp/ +tools/lemon/lemon: + $(MAKE) -C tools/lemon/ updaterev: tools/updaterevision/updaterevision @tools/updaterevision/updaterevision . src/svnrevision.h diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 86a6bd539..1585e9524 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,28 @@ +March 22, 2008 (Changes by Graf Zahl) +- Fixed: The serializer for side_t::part never read the texture information + from a savegame. +- Fixed: side_t::StopInterpolation called setinterpolation instead of + stopinterpolation. Also moved the clearinterpolation call in + P_SetupLevel after the P_FreeLevelData to make absolutely sure that + nothing in there can leave an interpolator behind by accident. +- Applied Linux fixes by Jim. +SBARINFO update by Blzut3: +- Fixed: the playerclass command needed a null pointer check to prevent + crashing on respawn. +- Fixed: Mug Shot states were not reset on respawn. +- Removed keepoffsets flag since apparently it was keeping the offsets by + default. The means that the only thing not affected by the offsets was using + nullimage as a background. Since I wasn't able to get a result I liked I'm + going to say that if you want a black background with high res positioning + you will have to create your own bar image. Maybe I'll fix it some other + time. +- Added: monospacefonts variable which allows for all of the fonts to be + monospaced by a specified character (from their fontset of corse). +- Made SBarInfo recognize the bar names for the Strife popups but they don't + do anything beyond that. The names are: popuplog, popupkeys, and popupstatus. +- Started converting the drawing routine to be more flexable towards high + resolution status bars. (Only did one call so far.) + March 21, 2008 - Fixed: Actor-less sounds that aren't played on CHAN_AUTO should still be subject to channel overriding. diff --git a/src/g_shared/sbarinfo.h b/src/g_shared/sbarinfo.h index 9f0d49528..548961a92 100644 --- a/src/g_shared/sbarinfo.h +++ b/src/g_shared/sbarinfo.h @@ -1,9 +1,46 @@ +/* +** sbarinfo.h +** +** Header for custom status bar definitions. +** +**--------------------------------------------------------------------------- +** Copyright 2008 Braden Obrzut +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**--------------------------------------------------------------------------- +** +*/ + #ifndef __SBarInfo_SBAR_H__ #define __SBarInfo_SBAR_H__ #include "tarray.h" #include "v_collection.h" +#define NUMHUDS 9 + class FBarTexture; class FScanner; @@ -44,11 +81,12 @@ struct SBarInfoCommand struct SBarInfo { TArray Images; - SBarInfoBlock huds[6]; + SBarInfoBlock huds[NUMHUDS]; bool automapbar; bool interpolateHealth; bool interpolateArmor; bool completeBorder; + char spacingCharacter; int interpolationSpeed; int armorInterpolationSpeed; int height; @@ -71,7 +109,7 @@ struct SBarInfo extern SBarInfo *SBarInfoScript; -//Mug Shot scripting structs. All functions are defined in sbarinfo_parser.cpp +//Mug Shot scripting structs. struct MugShotState; struct MugShotFrame @@ -166,7 +204,6 @@ enum //drawbar flags (will go into special2) DRAWBAR_HORIZONTAL = 1, DRAWBAR_REVERSE = 2, DRAWBAR_COMPAREDEFAULTS = 4, - DRAWBAR_KEEPOFFSETS = 8, }; enum //drawselectedinventory flags @@ -223,6 +260,7 @@ enum //Key words SBARINFO_INTERPOLATEHEALTH, SBARINFO_INTERPOLATEARMOR, SBARINFO_COMPLETEBORDER, + SBARINFO_MONOSPACEFONTS, SBARINFO_STATUSBAR, SBARINFO_MUGSHOT, }; @@ -235,6 +273,9 @@ enum //Bar types STBAR_AUTOMAP, STBAR_INVENTORY, STBAR_INVENTORYFULLSCREEN, + STBAR_POPUPLOG, + STBAR_POPUPKEYS, + STBAR_POPUPSTATUS, }; enum //Bar key words diff --git a/src/g_shared/sbarinfo_display.cpp b/src/g_shared/sbarinfo_display.cpp index 5e9ddbdb5..b65d02511 100644 --- a/src/g_shared/sbarinfo_display.cpp +++ b/src/g_shared/sbarinfo_display.cpp @@ -1,3 +1,38 @@ +/* +** sbarinfo_display.cpp +** +** Contains all functions required for the display of custom statusbars. +** +**--------------------------------------------------------------------------- +** Copyright 2008 Braden Obrzut +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**--------------------------------------------------------------------------- +** +*/ + #include "doomtype.h" #include "doomstat.h" #include "v_font.h" @@ -238,7 +273,7 @@ DSBarInfo::~DSBarInfo () void DSBarInfo::Draw (EHudState state) { DBaseStatusBar::Draw(state); - int hud = 2; + int hud = STBAR_NORMAL; if(state == HUD_StatusBar) { if(SBarInfoScript->completeBorder) //Fill the statusbar with the border before we draw. @@ -250,20 +285,20 @@ void DSBarInfo::Draw (EHudState state) } if(SBarInfoScript->automapbar && automapactive) { - hud = 3; + hud = STBAR_AUTOMAP; } else { - hud = 2; + hud = STBAR_NORMAL; } } else if(state == HUD_Fullscreen) { - hud = 1; + hud = STBAR_FULLSCREEN; } else { - hud = 0; + hud = STBAR_NONE; } if(SBarInfoScript->huds[hud].forceScaled) //scale the statusbar { @@ -274,9 +309,9 @@ void DSBarInfo::Draw (EHudState state) if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR)) { if(state == HUD_StatusBar) - doCommands(SBarInfoScript->huds[4]); + doCommands(SBarInfoScript->huds[STBAR_INVENTORY]); else if(state == HUD_Fullscreen) - doCommands(SBarInfoScript->huds[5]); + doCommands(SBarInfoScript->huds[STBAR_INVENTORYFULLSCREEN]); } } @@ -291,6 +326,7 @@ void DSBarInfo::NewGame () void DSBarInfo::AttachToPlayer (player_t *player) { player_t *oldplayer = CPlayer; + currentState = NULL; DBaseStatusBar::AttachToPlayer(player); } @@ -823,11 +859,6 @@ void DSBarInfo::doCommands(SBarInfoBlock &block) { screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true); } - if(cmd.special2 & DRAWBAR_KEEPOFFSETS) - { - x += fg->LeftOffset; - y += fg->TopOffset; - } if(cmd.special3 != 0) { @@ -856,17 +887,13 @@ void DSBarInfo::doCommands(SBarInfoBlock &block) // Calc clipping rect for background cx = cmd.x + ST_X + cmd.special3; cy = cmd.y + ST_Y + cmd.special3; - cw = fg->GetScaledWidth() - cmd.special3 * 2; - ch = fg->GetScaledHeight() - cmd.special3 * 2; + cw = fg->GetScaledWidth() - fg->GetScaledLeftOffset() - cmd.special3 * 2; + ch = fg->GetScaledHeight() - fg->GetScaledTopOffset() - cmd.special3 * 2; if (Scaled) { screen->VirtualToRealCoordsInt(cx, cy, cw, ch, 320, 200, true); } - if(cmd.special2 & DRAWBAR_KEEPOFFSETS) - { - cx += fg->LeftOffset; - cy += fg->TopOffset; - } + if (horizontal) { if ((cmd.special3 != 0 && reverse) || (cmd.special3 == 0 && !reverse)) @@ -1011,6 +1038,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block) break; case SBARINFO_PLAYERCLASS: { + if(CPlayer->cls == NULL) break; //No class so we can not continue int spawnClass = CPlayer->cls->ClassIndex; if(cmd.special == spawnClass || cmd.special2 == spawnClass || cmd.special3 == spawnClass) { @@ -1077,7 +1105,17 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int flags) if((flags & DRAWIMAGE_TRANSLATABLE)) DrawImage(texture, x, y, getTranslation()); else - DrawImage(texture, x, y); + { + x += ST_X; + y += ST_Y; + int w = texture->GetScaledWidth(); + int h = texture->GetScaledHeight(); + screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true); + screen->DrawTexture(texture, x, y, + DTA_DestWidth, w, + DTA_DestHeight, h, + TAG_DONE); + } } void DSBarInfo::DrawString(const char* str, int x, int y, EColorRange translation, int spacing) @@ -1091,16 +1129,23 @@ void DSBarInfo::DrawString(const char* str, int x, int y, EColorRange translatio str++; continue; } - int width = drawingFont->GetCharWidth((int) *str); + int width; + if(SBarInfoScript->spacingCharacter == '\0') //No monospace? + width = drawingFont->GetCharWidth((int) *str); + else + width = drawingFont->GetCharWidth((int) SBarInfoScript->spacingCharacter); FTexture* character = drawingFont->GetChar((int) *str, &width); if(character == NULL) //missing character. { str++; continue; } - x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size + if(SBarInfoScript->spacingCharacter == '\0') //If we are monospaced lets use the offset + x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size DrawImage(character, x, y, drawingFont->GetColorTranslation(translation)); - x += width + spacing - (character->LeftOffset+1); + x += width + spacing; + if(SBarInfoScript->spacingCharacter == '\0') + x -= (character->LeftOffset+1); str++; } } @@ -1112,7 +1157,10 @@ void DSBarInfo::DrawNumber(int num, int len, int x, int y, EColorRange translati int maxval = (int) ceil(pow(10., len))-1; num = clamp(num, -maxval, maxval); value.Format("%d", num); - x -= int(drawingFont->StringWidth(value)+(spacing * value.Len())); + if(SBarInfoScript->spacingCharacter == '\0') + x -= int(drawingFont->StringWidth(value)+(spacing * value.Len())); + else //monospaced so just multiplay the character size + x -= int((drawingFont->GetCharWidth((int) SBarInfoScript->spacingCharacter) + spacing) * value.Len()); DrawString(value, x, y, translation, spacing); } diff --git a/src/g_shared/sbarinfo_parser.cpp b/src/g_shared/sbarinfo_parser.cpp index 4c0531be5..51be9a513 100644 --- a/src/g_shared/sbarinfo_parser.cpp +++ b/src/g_shared/sbarinfo_parser.cpp @@ -1,3 +1,38 @@ +/* +** sbarinfo_parser.cpp +** +** Reads custom status bar definitions. +** +**--------------------------------------------------------------------------- +** Copyright 2008 Braden Obrzut +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**--------------------------------------------------------------------------- +** +*/ + #include "doomtype.h" #include "doomstat.h" #include "sc_man.h" @@ -21,6 +56,7 @@ static const char *SBarInfoTopLevel[] = "interpolatehealth", "interpolatearmor", "completeborder", + "monospacefonts", "statusbar", "mugshot", NULL @@ -34,6 +70,9 @@ static const char *StatusBars[] = "automap", "inventory", "inventoryfullscreen", + "popuplog", + "popupkeys", + "popupstatus", NULL }; @@ -175,6 +214,22 @@ void SBarInfo::ParseSBarInfo(int lump) } sc.MustGetToken(';'); break; + case SBARINFO_MONOSPACEFONTS: + if(sc.CheckToken(TK_True)) + { + sc.MustGetToken(','); + sc.MustGetToken(TK_StringConst); + spacingCharacter = sc.String[0]; + } + else + { + sc.MustGetToken(TK_False); + spacingCharacter = '\0'; + sc.MustGetToken(','); + sc.MustGetToken(TK_StringConst); //Don't tell anyone we're just ignoring this ;) + } + sc.MustGetToken(';'); + break; case SBARINFO_STATUSBAR: { if(!baseSet) //If the user didn't explicitly define a base, do so now. @@ -699,8 +754,6 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block) { if(sc.Compare("reverse")) cmd.special2 += DRAWBAR_REVERSE; - else if(sc.Compare("keepoffsets")) - cmd.special2 += DRAWBAR_KEEPOFFSETS; else sc.ScriptError("Unkown flag '%s'.", sc.String); if(!sc.CheckToken('|')) @@ -994,11 +1047,12 @@ void SBarInfo::Init() interpolationSpeed = 8; armorInterpolationSpeed = 8; height = 0; + spacingCharacter = '\0'; } SBarInfo::~SBarInfo() { - for (size_t i = 0; i < countof(huds); ++i) + for (size_t i = 0; i < NUMHUDS; ++i) { huds[i].commands.Clear(); } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4dccdcb86..b0c1146de 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3520,7 +3520,6 @@ void P_SetupLevel (char *lumpname, int position) wminfo.partime = 180; - clearinterpolations(); // [RH] Nothing to interpolate on a fresh level. FCanvasTextureInfo::EmptyList (); R_FreePastViewers (); @@ -3561,6 +3560,7 @@ void P_SetupLevel (char *lumpname, int position) // Free all level data from the previous map P_FreeLevelData (); + clearinterpolations(); // [RH] Nothing to interpolate on a fresh level. MapData * map = P_OpenMapData(lumpname); if (map == NULL) diff --git a/src/r_defs.h b/src/r_defs.h index 723c1646a..8cd5497dd 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -526,7 +526,7 @@ struct side_t } void StopInterpolation(int position) { - setinterpolation(EInterpType(INTERP_WallPanning_Top+position), this); + stopinterpolation(EInterpType(INTERP_WallPanning_Top+position), this); } }; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 5abc48dcb..b785c8b15 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -263,21 +263,23 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) dc_texturemid = MIN (frontsector->ceilingtexz, backsector->ceilingtexz); } - fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid); - if (tex->bWorldPanning) - { - // rowoffset is added before the MulScale3 so that the masked texture will - // still be positioned in world units rather than texels. - dc_texturemid += rowoffset - viewz; - textop = dc_texturemid; - dc_texturemid = MulScale16 (dc_texturemid, tex->yScale); - } - else - { - // rowoffset is added outside the multiply so that it positions the texture - // by texels instead of world units. - textop = dc_texturemid - viewz + SafeDivScale16 (rowoffset, tex->yScale); - dc_texturemid = MulScale16 (dc_texturemid - viewz, tex->yScale) + rowoffset; + { // encapsilate the lifetime of rowoffset + fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid); + if (tex->bWorldPanning) + { + // rowoffset is added before the MulScale3 so that the masked texture will + // still be positioned in world units rather than texels. + dc_texturemid += rowoffset - viewz; + textop = dc_texturemid; + dc_texturemid = MulScale16 (dc_texturemid, tex->yScale); + } + else + { + // rowoffset is added outside the multiply so that it positions the texture + // by texels instead of world units. + textop = dc_texturemid - viewz + SafeDivScale16 (rowoffset, tex->yScale); + dc_texturemid = MulScale16 (dc_texturemid - viewz, tex->yScale) + rowoffset; + } } if (fixedlightlev) @@ -1452,16 +1454,13 @@ int side_t::GetLightLevel (bool foggy, int baselight) const FArchive &operator<< (FArchive &arc, side_t::part &p) { arc << p.xoffset << p.yoffset;// << p.Light; - if (arc.IsStoring()) + if (arc.IsStoring ()) { - if (arc.IsStoring ()) - { - TexMan.WriteTexture (arc, p.texture); - } - else - { - p.texture = TexMan.ReadTexture (arc); - } + TexMan.WriteTexture (arc, p.texture); + } + else + { + p.texture = TexMan.ReadTexture (arc); } return arc; }