diff --git a/Makefile b/Makefile index 79d78f295..fa0811534 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ ifeq (Windows_NT,$(OS)) include Makefile.mgw else -all: - @echo Building with MinGW requires Windows NT +include Makefile.linux endif diff --git a/Makefile.linux b/Makefile.linux new file mode 100644 index 000000000..4065ce219 --- /dev/null +++ b/Makefile.linux @@ -0,0 +1,91 @@ +# created on 4/12/2006 by James Bentler +CXX ?= g++ +CPPFLAGS ?= -Wall -Wno-unused -O2 -fomit-frame-pointer +CXXFLAGS += -DHAVE_FILELENGTH -D__forceinline=inline -Izlib -IFLAC `sdl-config --cflags` +CXXFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp +LDFLAGS += -lFLAC++ -lFLAC -lz -lfmod `sdl-config --libs` + +NASM ?= nasm +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/) +INCLUDES = $(addprefix -I,$(SRCDIRS)) +CXXFLAGS += $(INCLUDES) + +RELEASEOBJ ?= releaseobj +DEBUGOBJ ?= debugobj + +CSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS))) +ASRCS = $(wildcard src/*.nas) +SRCS = $(ASRCS) $(CSRCS) +COBJFILES = $(notdir $(patsubst %.cpp,%.o,$(CSRCS))) +AOBJFILES = $(notdir $(patsubst %.nas,%.o,$(ASRCS))) + +ZDOOM = zdoom +ZDOOMDEBUG = zdoomd + +ifndef DEBUG + OBJDIR = $(RELEASEOBJ) + CXXFLAGS += -DNDEBUG + ZDOOMBIN = $(ZDOOM) +else + OBJDIR = $(DEBUGOBJ) + CXXFLAGS += -g + ZDOOMBIN = $(ZDOOMDEBUG) +endif + +COBJS = $(addprefix $(OBJDIR)/,$(COBJFILES)) +DEPS = $(patsubst %.o,%.d,$(COBJS)) +OBJS = $(addprefix $(OBJDIR)/,$(AOBJFILES)) $(COBJS) + +# rule pattern for dependencies +define DEPBUILD_PATTERN +_dep_: _src_ + echo "_dep_: _src_" + $(CXX) _src_ -MM $(CXXFLAGS) -MT "$$(patsubst %.d,%.o,_dep_) _dep_" -MF _dep_ +-include _dep_ + +endef + +# rule pattern for assembly files +define ASMBUILD_PATTERN +_obj_: _src_ + echo "_obj_: _src_" + $(NASM) -o _obj_ $(NASMFLAGS) _src_ + +endef + +all: $(ZDOOMBIN) zdoom.wad + +$(ZDOOMBIN): $(DEPS) $(OBJDIR) $(OBJS) + $(CXX) $(LDFLAGS) $(OBJS) -o $(ZDOOMBIN) + +# textually substitute in the _obj_ and the _src_ it depends on to create rules +$(foreach src,$(ASRCS), $(eval $(subst _src_,$(src),$(subst \ +_obj_,$(OBJDIR)/$(patsubst %.nas,%.o,$(notdir $$$(src))),$(ASMBUILD_PATTERN))))) + +# textually substitute in the _dep_ and the _src_ it depends on to create rules +$(foreach src,$(CSRCS), $(eval $(subst _src_,$(src),$(subst \ +_dep_,$(OBJDIR)/$(patsubst %.cpp,%.d,$(notdir $$$(src))),$(DEPBUILD_PATTERN))))) + +$(OBJDIR)/%.o: + $(CXX) -c $(CXXFLAGS) -o $@ -c $< + +-include $(DEPS) + +$(OBJDIR): + mkdir -p $(OBJDIR) + +zdoom.wad: + make -C wadsrc/ -f Makefile + +.PHONY : clean cleandeps cleanobjs + +clean: + rm -f $(RELEASEOBJ)/* $(DEBUGOBJ)/* $(ZDOOMDEBUG) $(ZDOOM) + +cleandeps: + rm -f $(RELEASEOBJ)/*.d $(DEBUGOBJ)/*.d + +cleanobjs: + rm -f $(RELEASEOBJ)/*.o $(DEBUGOBJ)/*.o diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 21849c66c..51be3d954 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,24 @@ +April 12, 2006 +- Added Jim's Makefile.linux; +- Changed: Decal scales now use full precision fixed point numbers. +- Changed: Keeping impact decals in their own statlist is enough to keep track + of them for when one needs to be destroyed. There's no need to maintain a + separate list for them. +- Fixed: Decal actors did not spread their decals across neighboring walls. +- Fixed: Decal groups did not initialize their IDs and could not be reliably + used with the decal actor. +- Fixed: Decals on moving polyobjects were not interpolated. R_RenderDecal() + now uses the decal's LeftDistance to calculate its visible location, so it + always stays in sync with the wall's vertices. This also lets me dump some + code from the polyobjects that maintained the decals' (x, y) coordinates. + Also, the decals' x and y information is redundant and can be removed. + Doing this revealed a bug with slider decals and horizontal sliding: + That is, it didn't work at all. I have opted to simply remove the horizontal + sliding support so that I don't have to worry about what happens when a + decal slides across the edge of a wall. +- Fixed: DBaseDecal::LeftDistance was calculated as a 30.2 fixed point number. + It should be 2.30 fixed point. + April 12, 2006 (Changes by Graf Zahl) - Fixed: SAVEVER was still 231 although MINSAVEVER was 232. - Fixed: Decal spreading used an incorrect z-coordinate. It has to use diff --git a/src/decallib.cpp b/src/decallib.cpp index f61d80fdb..993d9b766 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -47,7 +47,7 @@ FDecalLib DecalLibrary; -static int ReadScale (); +static fixed_t ReadScale (); static TArray DecalTranslations; extern TArray DecalNames; @@ -90,7 +90,7 @@ struct FDecalAnimator { FDecalAnimator (const char *name); virtual ~FDecalAnimator (); - virtual DThinker *CreateThinker (DBaseDecal *actor) const = 0; + virtual DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const = 0; char *Name; }; @@ -122,7 +122,7 @@ void DDecalThinker::Serialize (FArchive &arc) struct FDecalFaderAnim : public FDecalAnimator { FDecalFaderAnim (const char *name) : FDecalAnimator (name) {} - DThinker *CreateThinker (DBaseDecal *actor) const; + DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const; int DecayStart; int DecayTime; @@ -146,7 +146,7 @@ private: struct FDecalColorerAnim : public FDecalAnimator { FDecalColorerAnim (const char *name) : FDecalAnimator (name) {} - DThinker *CreateThinker (DBaseDecal *actor) const; + DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const; int DecayStart; int DecayTime; @@ -172,11 +172,11 @@ private: struct FDecalStretcherAnim : public FDecalAnimator { FDecalStretcherAnim (const char *name) : FDecalAnimator (name) {} - DThinker *CreateThinker (DBaseDecal *actor) const; + DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const; int StretchStart; int StretchTime; - int GoalX, GoalY; + fixed_t GoalX, GoalY; }; class DDecalStretcher : public DDecalThinker @@ -189,10 +189,10 @@ public: int TimeToStart; int TimeToStop; - BYTE GoalX; - BYTE StartX; - BYTE GoalY; - BYTE StartY; + fixed_t GoalX; + fixed_t StartX; + fixed_t GoalY; + fixed_t StartY; bool bStretchX; bool bStretchY; bool bStarted; @@ -203,11 +203,11 @@ private: struct FDecalSliderAnim : public FDecalAnimator { FDecalSliderAnim (const char *name) : FDecalAnimator (name) {} - DThinker *CreateThinker (DBaseDecal *actor) const; + DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const; int SlideStart; int SlideTime; - fixed_t DistX, DistY; + fixed_t /*DistX,*/ DistY; }; class DDecalSlider : public DDecalThinker @@ -220,7 +220,7 @@ public: int TimeToStart; int TimeToStop; - fixed_t DistX; +/* fixed_t DistX; */ fixed_t DistY; fixed_t StartX; fixed_t StartY; @@ -232,7 +232,7 @@ private: struct FDecalCombinerAnim : public FDecalAnimator { FDecalCombinerAnim (const char *name) : FDecalAnimator (name) {} - DThinker *CreateThinker (DBaseDecal *actor) const; + DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const; int FirstAnimator; int NumAnimators; @@ -328,7 +328,7 @@ void FDecalLib::DelTree (FDecalBase *root) void FDecalLib::ReadAllDecals () { int lump, lastlump = 0; - size_t i; + unsigned int i; while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1) { @@ -432,7 +432,7 @@ void FDecalLib::ParseDecal () memset (&newdecal, 0, sizeof(newdecal)); newdecal.PicNum = 0xffff; - newdecal.ScaleX = newdecal.ScaleY = 63; + newdecal.ScaleX = newdecal.ScaleY = FRACUNIT; newdecal.RenderFlags = RF_WALLSPRITE; newdecal.RenderStyle = STYLE_Normal; newdecal.Alpha = 0x8000; @@ -555,6 +555,7 @@ void FDecalLib::ParseDecalGroup () if (SC_Compare ("}")) { group->Name = copystring (groupName); + group->SpawnID = decalNum; AddDecal (group); break; } @@ -652,7 +653,7 @@ void FDecalLib::ParseFader () void FDecalLib::ParseStretcher () { char stretcherName[64]; - int goalX = -1, goalY = -1; + fixed_t goalX = -1, goalY = -1; int startTime = 0, takeTime = 0; SC_MustGetString (); @@ -715,12 +716,12 @@ void FDecalLib::ParseSlider () SC_MustGetString (); if (SC_Compare ("}")) { - if ((distX | distY) != 0) + if ((/*distX |*/ distY) != 0) { FDecalSliderAnim *slider = new FDecalSliderAnim (sliderName); slider->SlideStart = startTime; slider->SlideTime = takeTime; - slider->DistX = distX; + /*slider->DistX = distX;*/ slider->DistY = distY; Animators.Push (slider); } @@ -740,6 +741,7 @@ void FDecalLib::ParseSlider () { SC_MustGetFloat (); distX = (fixed_t)(sc_Float * FRACUNIT); + Printf ("DistX in slider decal %s is unsupported\n", sliderName); } else if (SC_Compare ("DistY")) { @@ -994,28 +996,28 @@ FDecalBase::~FDecalBase () delete[] Name; } -void FDecalTemplate::ApplyToDecal (DBaseDecal *actor) const +void FDecalTemplate::ApplyToDecal (DBaseDecal *decal, side_t *wall) const { if (RenderStyle == STYLE_Shaded) { - actor->SetShade (ShadeColor); + decal->SetShade (ShadeColor); } - actor->Translation = Translation; - actor->XScale = ScaleX; - actor->YScale = ScaleY; - actor->PicNum = PicNum; - actor->Alpha = Alpha << 1; - actor->RenderStyle = RenderStyle; - actor->RenderFlags = (RenderFlags & ~(DECAL_RandomFlipX|DECAL_RandomFlipY)) | - (actor->RenderFlags & (RF_RELMASK|RF_CLIPMASK|RF_INVISIBLE|RF_ONESIDED)); + decal->Translation = Translation; + decal->ScaleX = ScaleX; + decal->ScaleY = ScaleY; + decal->PicNum = PicNum; + decal->Alpha = Alpha << 1; + decal->RenderStyle = RenderStyle; + decal->RenderFlags = (RenderFlags & ~(DECAL_RandomFlipX|DECAL_RandomFlipY)) | + (decal->RenderFlags & (RF_RELMASK|RF_CLIPMASK|RF_INVISIBLE|RF_ONESIDED)); if (RenderFlags & (DECAL_RandomFlipX|DECAL_RandomFlipY)) { - actor->RenderFlags ^= pr_decal() & + decal->RenderFlags ^= pr_decal() & ((RenderFlags & (DECAL_RandomFlipX|DECAL_RandomFlipY)) >> 8); } if (Animator != NULL) { - Animator->CreateThinker (actor); + Animator->CreateThinker (decal, wall); } } @@ -1152,7 +1154,7 @@ void DDecalFader::Tick () } } -DThinker *FDecalFaderAnim::CreateThinker (DBaseDecal *actor) const +DThinker *FDecalFaderAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const { DDecalFader *fader = new DDecalFader (actor); @@ -1178,7 +1180,7 @@ void DDecalStretcher::Serialize (FArchive &arc) << bStarted; } -DThinker *FDecalStretcherAnim::CreateThinker (DBaseDecal *actor) const +DThinker *FDecalStretcherAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const { DDecalStretcher *thinker = new DDecalStretcher (actor); @@ -1221,11 +1223,11 @@ void DDecalStretcher::Tick () { if (bStretchX) { - TheDecal->XScale = GoalX; + TheDecal->ScaleX = GoalX; } if (bStretchY) { - TheDecal->YScale = GoalY; + TheDecal->ScaleY = GoalY; } Destroy (); return; @@ -1233,19 +1235,19 @@ void DDecalStretcher::Tick () if (!bStarted) { bStarted = true; - StartX = TheDecal->XScale; - StartY = TheDecal->YScale; + StartX = TheDecal->ScaleX; + StartY = TheDecal->ScaleY; } int distance = level.maptime - TimeToStart; int maxDistance = TimeToStop - TimeToStart; if (bStretchX) { - TheDecal->XScale = StartX + Scale (GoalX - StartX, distance, maxDistance); + TheDecal->ScaleX = StartX + Scale (GoalX - StartX, distance, maxDistance); } if (bStretchY) { - TheDecal->YScale = StartY + Scale (GoalY - StartY, distance, maxDistance); + TheDecal->ScaleY = StartY + Scale (GoalY - StartY, distance, maxDistance); } } @@ -1256,20 +1258,20 @@ void DDecalSlider::Serialize (FArchive &arc) Super::Serialize (arc); arc << TimeToStart << TimeToStop - << DistX + /*<< DistX*/ << DistY - << StartX + /*<< StartX*/ << StartY << bStarted; } -DThinker *FDecalSliderAnim::CreateThinker (DBaseDecal *actor) const +DThinker *FDecalSliderAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const { DDecalSlider *thinker = new DDecalSlider (actor); thinker->TimeToStart = level.maptime + SlideStart; thinker->TimeToStop = thinker->TimeToStart + SlideTime; - thinker->DistX = DistX; + /*thinker->DistX = DistX;*/ thinker->DistY = DistY; thinker->bStarted = false; return thinker; @@ -1289,30 +1291,30 @@ void DDecalSlider::Tick () if (!bStarted) { bStarted = true; - StartX = TheDecal->x; - StartY = TheDecal->z; + /*StartX = TheDecal->LeftDistance;*/ + StartY = TheDecal->Z; } if (level.maptime >= TimeToStop) { - TheDecal->x = StartX + DistX; - TheDecal->z = StartY + DistY; + /*TheDecal->LeftDistance = StartX + DistX;*/ + TheDecal->Z = StartY + DistY; Destroy (); return; } int distance = level.maptime - TimeToStart; int maxDistance = TimeToStop - TimeToStart; - TheDecal->x = StartX + Scale (DistX, distance, maxDistance); - TheDecal->z = StartY + Scale (DistY, distance, maxDistance); + /*TheDecal->LeftDistance = StartX + Scale (DistX, distance, maxDistance);*/ + TheDecal->Z = StartY + Scale (DistY, distance, maxDistance); } -DThinker *FDecalCombinerAnim::CreateThinker (DBaseDecal *actor) const +DThinker *FDecalCombinerAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const { DThinker *thinker = NULL; for (int i = 0; i < NumAnimators; ++i) { - thinker = AnimatorList[FirstAnimator+i]->CreateThinker (actor); + thinker = AnimatorList[FirstAnimator+i]->CreateThinker (actor, wall); } return thinker; } @@ -1380,7 +1382,7 @@ void DDecalColorer::Tick () } } -DThinker *FDecalColorerAnim::CreateThinker (DBaseDecal *actor) const +DThinker *FDecalColorerAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const { DDecalColorer *Colorer = new DDecalColorer (actor); @@ -1391,8 +1393,8 @@ DThinker *FDecalColorerAnim::CreateThinker (DBaseDecal *actor) const return Colorer; } -static int ReadScale () +static fixed_t ReadScale () { SC_MustGetFloat (); - return clamp ((int)(sc_Float * 64.f), 1, 256) - 1; + return fixed_t(clamp (sc_Float * FRACUNIT, 256.f, 256.f*FRACUNIT)); } diff --git a/src/decallib.h b/src/decallib.h index f50195a50..4994695cb 100644 --- a/src/decallib.h +++ b/src/decallib.h @@ -44,6 +44,7 @@ class FDecalTemplate; struct FDecalAnimator; struct TypeInfo; class DBaseDecal; +struct side_s; class FDecalBase { @@ -67,12 +68,12 @@ class FDecalTemplate : public FDecalBase public: FDecalTemplate () : Translation (0) {} - void ApplyToDecal (DBaseDecal *actor) const; + void ApplyToDecal (DBaseDecal *actor, side_s *wall) const; const FDecalTemplate *GetDecal () const; + fixed_t ScaleX, ScaleY; DWORD ShadeColor; WORD Translation; - BYTE ScaleX, ScaleY; BYTE RenderStyle; WORD PicNum; WORD RenderFlags; diff --git a/src/dthinker.cpp b/src/dthinker.cpp index 747bd62a7..d1e45196d 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -170,6 +170,26 @@ void DThinker::PostBeginPlay () { } +DThinker *DThinker::FirstThinker (int statnum) +{ + Node *node; + + if ((unsigned)statnum > MAX_STATNUM) + { + statnum = MAX_STATNUM; + } + node = Thinkers[statnum].Head; + if (node->Succ == NULL) + { + node = FreshThinkers[statnum].Head; + if (node->Succ == NULL) + { + return NULL; + } + } + return static_cast(node); +} + void DThinker::ChangeStatNum (int statnum) { if ((unsigned)statnum > MAX_STATNUM) diff --git a/src/dthinker.h b/src/dthinker.h index 0339114ce..25db5403a 100644 --- a/src/dthinker.h +++ b/src/dthinker.h @@ -68,6 +68,8 @@ public: static void DestroyMostThinkers (); static void SerializeAll (FArchive &arc, bool keepPlayers); + static DThinker *FirstThinker (int statnum); + private: static void DestroyThinkersInList (Node *first); static void DestroyMostThinkersInList (List &list, int stat); diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index de0dbdbc6..946054610 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -49,8 +49,6 @@ static const FDecalTemplate *SpreadTemplate; static TArray SpreadStack; static int ImpactCount; -static DImpactDecal *FirstImpact; // (but not the Second or Third Impact :-) -static DImpactDecal *LastImpact; CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE) @@ -62,33 +60,38 @@ IMPLEMENT_CLASS (DImpactDecal) DBaseDecal::DBaseDecal () : DThinker(STAT_DECAL), - WallNext(0), WallPrev(0), x(0), y(0), z(0), AlphaColor(0), Translation(0), PicNum(0xFFFF), - RenderFlags(0), XScale(8), YScale(8), RenderStyle(0), LeftDistance(0), Alpha(0) + WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT), + AlphaColor(0), Translation(0), PicNum(0xFFFF), RenderFlags(0), RenderStyle(0) { } -DBaseDecal::DBaseDecal (fixed_t x, fixed_t y, fixed_t z) +DBaseDecal::DBaseDecal (fixed_t z) : DThinker(STAT_DECAL), - WallNext(0), WallPrev(0), x(x), y(y), z(z), AlphaColor(0), Translation(0), PicNum(0xFFFF), - RenderFlags(0), XScale(8), YScale(8), RenderStyle(0), LeftDistance(0), Alpha(0) + WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT), + AlphaColor(0), Translation(0), PicNum(0xFFFF), RenderFlags(0), RenderStyle(0) +{ +} + +DBaseDecal::DBaseDecal (int statnum, fixed_t z) +: DThinker(statnum), + WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT), + AlphaColor(0), Translation(0), PicNum(0xFFFF), RenderFlags(0), RenderStyle(0) { } DBaseDecal::DBaseDecal (const AActor *basis) : DThinker(STAT_DECAL), - WallNext(0), WallPrev(0), x(basis->x), y(basis->y), z(basis->z), AlphaColor(basis->alphacolor), - Translation(basis->Translation), PicNum(basis->picnum), RenderFlags(basis->renderflags), - XScale(basis->xscale), YScale(basis->yscale), RenderStyle(basis->RenderStyle), LeftDistance(0), - Alpha(basis->alpha) + WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->z), ScaleX(basis->xscale<<10), ScaleY(basis->yscale<<10), + Alpha(basis->alpha), AlphaColor(basis->alphacolor), Translation(basis->Translation), PicNum(basis->picnum), + RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle) { } DBaseDecal::DBaseDecal (const DBaseDecal *basis) : DThinker(STAT_DECAL), - WallNext(0), WallPrev(0), x(basis->x), y(basis->y), z(basis->z), AlphaColor(basis->AlphaColor), - Translation(basis->Translation), PicNum(basis->PicNum), RenderFlags(basis->RenderFlags), - XScale(basis->XScale), YScale(basis->YScale), RenderStyle(basis->RenderStyle), LeftDistance(0), - Alpha(basis->Alpha) + WallNext(0), WallPrev(0), LeftDistance(basis->LeftDistance), Z(basis->Z), ScaleX(basis->ScaleX), + ScaleY(basis->ScaleY), Alpha(basis->Alpha), AlphaColor(basis->AlphaColor), Translation(basis->Translation), + PicNum(basis->PicNum), RenderFlags(basis->RenderFlags), RenderStyle(basis->RenderStyle) { } @@ -111,15 +114,15 @@ void DBaseDecal::Remove () void DBaseDecal::Serialize (FArchive &arc) { Super::Serialize (arc); - arc << x << y << z + arc << LeftDistance + << Z + << ScaleX << ScaleY + << Alpha << AlphaColor << Translation << PicNum << RenderFlags - << XScale << YScale - << RenderStyle - << LeftDistance - << Alpha; + << RenderStyle; } void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first) @@ -159,19 +162,8 @@ void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first) } } -void DBaseDecal::MoveChain (DBaseDecal *first, fixed_t x, fixed_t y) +void DBaseDecal::GetXY (side_t *wall, fixed_t &ox, fixed_t &oy) const { - while (first != NULL) - { - first->x += x; - first->y += y; - first = (DBaseDecal *)first->WallNext; - } -} - -void DBaseDecal::FixForSide (side_t *wall) -{ - DBaseDecal *decal = wall->AttachedDecals; line_t *line = &lines[wall->linenum]; DWORD wallnum = DWORD(wall - sides); vertex_t *v1, *v2; @@ -190,12 +182,8 @@ void DBaseDecal::FixForSide (side_t *wall) fixed_t dx = v2->x - v1->x; fixed_t dy = v2->y - v1->y; - while (decal != NULL) - { - decal->x = v1->x + MulScale2 (decal->LeftDistance, dx); - decal->y = v1->y + MulScale2 (decal->LeftDistance, dy); - decal = decal->WallNext; - } + ox = v1->x + MulScale30 (LeftDistance, dx); + oy = v1->y + MulScale30 (LeftDistance, dy); } void DBaseDecal::SetShade (DWORD rgb) @@ -210,7 +198,7 @@ void DBaseDecal::SetShade (int r, int g, int b) } // Returns the texture the decal stuck to. -int DBaseDecal::StickToWall (side_t *wall) +int DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y) { // Stick the decal at the end of the chain so it appears on top DBaseDecal *next, **prev; @@ -251,31 +239,31 @@ int DBaseDecal::StickToWall (side_t *wall) { RenderFlags |= RF_RELMID; if (line->flags & ML_DONTPEGBOTTOM) - z -= front->floortexz; + Z -= front->floortexz; else - z -= front->ceilingtexz; + Z -= front->ceilingtexz; tex = wall->midtexture; } - else if (back->floorplane.ZatPoint (x, y) >= z) + else if (back->floorplane.ZatPoint (x, y) >= Z) { RenderFlags |= RF_RELLOWER|RF_CLIPLOWER; if (line->flags & ML_DONTPEGBOTTOM) - z -= front->ceilingtexz; + Z -= front->ceilingtexz; else - z -= back->floortexz; + Z -= back->floortexz; tex = wall->bottomtexture; } else { RenderFlags |= RF_RELUPPER|RF_CLIPUPPER; if (line->flags & ML_DONTPEGTOP) - z -= front->ceilingtexz; + Z -= front->ceilingtexz; else - z -= back->ceilingtexz; + Z -= back->ceilingtexz; tex = wall->toptexture; } - CalcFracPos (wall); + CalcFracPos (wall, x, y); return tex; } @@ -303,38 +291,38 @@ fixed_t DBaseDecal::GetRealZ (const side_t *wall) const switch (RenderFlags & RF_RELMASK) { default: - return z; + return Z; case RF_RELUPPER: if (curline->linedef->flags & ML_DONTPEGTOP) { - return z + front->ceilingtexz; + return Z + front->ceilingtexz; } else { - return z + back->ceilingtexz; + return Z + back->ceilingtexz; } case RF_RELLOWER: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - return z + front->ceilingtexz; + return Z + front->ceilingtexz; } else { - return z + back->floortexz; + return Z + back->floortexz; } case RF_RELMID: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - return z + front->floortexz; + return Z + front->floortexz; } else { - return z + front->ceilingtexz; + return Z + front->ceilingtexz; } } } -void DBaseDecal::CalcFracPos (side_t *wall) +void DBaseDecal::CalcFracPos (side_t *wall, fixed_t x, fixed_t y) { line_t *line = &lines[wall->linenum]; DWORD wallnum = DWORD(wall - sides); @@ -356,11 +344,11 @@ void DBaseDecal::CalcFracPos (side_t *wall) if (abs(dx) > abs(dy)) { - LeftDistance = SafeDivScale2 (x - v1->x, dx); + LeftDistance = SafeDivScale30 (x - v1->x, dx); } else if (dy != 0) { - LeftDistance = SafeDivScale2 (y - v1->y, dy); + LeftDistance = SafeDivScale30 (y - v1->y, dy); } else { @@ -493,12 +481,11 @@ void DBaseDecal::SpreadRight (fixed_t r, side_t *feelwall, fixed_t wallsize) } } -void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t spread_z) +void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t x, fixed_t y, fixed_t z) { FTexture *tex; vertex_t *v1; fixed_t rorg, ldx, ldy; - int xscale, yscale; GetWallStuff (wall, v1, ldx, ldy); rorg = Length (x - v1->x, y - v1->y); @@ -506,16 +493,12 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t spread tex = TexMan[PicNum]; int dwidth = tex->GetWidth (); - xscale = (XScale + 1) << (FRACBITS - 6); - yscale = (YScale + 1) << (FRACBITS - 6); - - DecalWidth = dwidth * xscale; - DecalLeft = tex->LeftOffset * xscale; + DecalWidth = dwidth * ScaleX; + DecalLeft = tex->LeftOffset * ScaleX; DecalRight = DecalWidth - DecalLeft; SpreadSource = this; SpreadTemplate = tpl; - SpreadZ = spread_z; - + SpreadZ = z; // Try spreading left first SpreadLeft (rorg - DecalLeft, v1, wall); @@ -529,11 +512,11 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t spread DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_t iy, fixed_t iz, side_t *wall) const { - DBaseDecal *decal = new DBaseDecal(ix, iy, iz); + DBaseDecal *decal = new DBaseDecal(iz); if (decal != NULL) { - decal->StickToWall (wall); - tpl->ApplyToDecal (decal); + decal->StickToWall (wall, ix, iy); + tpl->ApplyToDecal (decal, wall); decal->AlphaColor = AlphaColor; decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) | (this->RenderFlags & ~RF_DECALMASK); @@ -551,7 +534,11 @@ CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE) { while (ImpactCount > self) { - FirstImpact->Destroy (); + DThinker *thinker = DThinker::FirstThinker (STAT_AUTODECAL); + if (thinker != NULL) + { + thinker->Destroy(); + } } } } @@ -570,7 +557,6 @@ void DImpactDecal::SerializeTime (FArchive &arc) if (arc.IsLoading ()) { ImpactCount = 0; - FirstImpact = LastImpact = NULL; } } @@ -580,31 +566,27 @@ void DImpactDecal::Serialize (FArchive &arc) } DImpactDecal::DImpactDecal () -: ImpactNext(0), ImpactPrev(0) { - Link(); + ChangeStatNum (STAT_AUTODECAL); + ImpactCount++; } -DImpactDecal::DImpactDecal (fixed_t x, fixed_t y, fixed_t z) -: DBaseDecal (x, y, z), - ImpactNext(0), ImpactPrev(0) -{ - Link(); -} - -void DImpactDecal::Link () +DImpactDecal::DImpactDecal (fixed_t z) +: DBaseDecal (STAT_AUTODECAL, z) { ImpactCount++; - ImpactPrev = LastImpact; - if (ImpactPrev != NULL) +} + +void DImpactDecal::CheckMax () +{ + if (ImpactCount >= cl_maxdecals) { - ImpactPrev->ImpactNext = this; + DThinker *thinker = DThinker::FirstThinker (STAT_AUTODECAL); + if (thinker != NULL) + { + thinker->Destroy(); + } } - else - { - FirstImpact = this; - } - LastImpact = this; } DImpactDecal *DImpactDecal::StaticCreate (const char *name, fixed_t x, fixed_t y, fixed_t z, side_t *wall, PalEntry color) @@ -630,14 +612,10 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x, { StaticCreate (tpl->LowerDecal->GetDecal(), x, y, z, wall); } - if (ImpactCount >= cl_maxdecals) - { - FirstImpact->Destroy (); - } + DImpactDecal::CheckMax(); + decal = new DImpactDecal (z); - decal = new DImpactDecal (x, y, z); - - int stickypic = decal->StickToWall (wall); + int stickypic = decal->StickToWall (wall, x, y); FTexture *tex = TexMan[stickypic]; if (tex != NULL && tex->bNoDecals) @@ -650,7 +628,7 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x, return NULL; } - tpl->ApplyToDecal (decal); + tpl->ApplyToDecal (decal, wall); if (color != 0) { decal->SetShade (color.r, color.g, color.b); @@ -662,22 +640,19 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x, } // Spread decal to nearby walls if it does not all fit on this one - decal->Spread (tpl, wall, z); + decal->Spread (tpl, wall, x, y, z); } return decal; } DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_t iy, fixed_t iz, side_t *wall) const { - if (ImpactCount >= cl_maxdecals) - { - FirstImpact->Destroy (); - } - DImpactDecal *decal = new DImpactDecal(ix, iy, iz); + DImpactDecal::CheckMax(); + DImpactDecal *decal = new DImpactDecal(iz); if (decal != NULL) { - decal->StickToWall (wall); - tpl->ApplyToDecal (decal); + decal->StickToWall (wall, ix, iy); + tpl->ApplyToDecal (decal, wall); decal->AlphaColor = AlphaColor; decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) | (this->RenderFlags & ~RF_DECALMASK); @@ -687,23 +662,6 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixe void DImpactDecal::Destroy () { - if (ImpactPrev != NULL) - { - ImpactPrev->ImpactNext = ImpactNext; - } - if (ImpactNext != NULL) - { - ImpactNext->ImpactPrev = ImpactPrev; - } - if (LastImpact == this) - { - LastImpact = ImpactPrev; - } - if (FirstImpact == this) - { - FirstImpact = ImpactNext; - } - ImpactCount--; Super::Destroy (); } @@ -715,7 +673,7 @@ CCMD (countdecals) CCMD (countdecalsreal) { - TThinkerIterator iterator (STAT_DECAL); + TThinkerIterator iterator (STAT_AUTODECAL); int count = 0; while (iterator.Next()) @@ -760,7 +718,6 @@ class ADecal : public AActor DECLARE_STATELESS_ACTOR (ADecal, AActor); public: void BeginPlay (); - bool DoTrace (DBaseDecal *decal, angle_t angle, sector_t *sec); }; IMPLEMENT_STATELESS_ACTOR (ADecal, Any, 9200, 0) @@ -768,47 +725,45 @@ END_DEFAULTS void ADecal::BeginPlay () { + const FDecalTemplate *tpl; + FTraceResults trace; + DBaseDecal *decal; + side_t *wall; + Super::BeginPlay (); - // Find a wall to attach to, and set RenderFlags to keep - // the decal at its current height. If the decal cannot find a wall - // within 64 units, it destroys itself. - // - // Subclasses can set special1 if they don't want this sticky logic. - - DBaseDecal *decal = new DBaseDecal (this); - - if (!DoTrace (decal, angle, Sector)) + // If no decal is specified, don't try to create one. + if (args[0] != 0 && (tpl = DecalLibrary.GetDecalByNum (args[0])) != 0) { - decal->Destroy(); - return; - } + // Look for a wall within 64 units behind the actor. If none can be + // found, then no decal is created, and this actor is destroyed + // without effectively doing anything. + Trace (x, y, z, Sector, + finecosine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], + finesine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], 0, + 64*FRACUNIT, 0, 0, NULL, trace, TRACE_NoSky); - if (args[0] != 0) - { - const FDecalTemplate *tpl = DecalLibrary.GetDecalByNum (args[0]); - if (tpl != NULL) + if (trace.HitType == TRACE_HitWall) { - tpl->ApplyToDecal (decal); + decal = new DBaseDecal (this); + wall = sides + trace.Line->sidenum[trace.Side]; + decal->StickToWall (wall, trace.X, trace.Y); + tpl->ApplyToDecal (decal, wall); + // Spread decal to nearby walls if it does not all fit on this one + if (cl_spreaddecals) + { + decal->Spread (tpl, wall, trace.X, trace.Y, z); + } + } + else + { + DPrintf ("Could not find a wall to stick decal to at (%ld,%ld)\n", x>>FRACBITS, y>>FRACBITS); } } -} - -bool ADecal::DoTrace (DBaseDecal *decal, angle_t angle, sector_t *sec) -{ - FTraceResults trace; - - Trace (x, y, z, sec, - finecosine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], - finesine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], 0, - 64*FRACUNIT, 0, 0, NULL, trace, TRACE_NoSky); - - if (trace.HitType == TRACE_HitWall) + else { - decal->x = trace.X; - decal->y = trace.Y; - decal->StickToWall (sides + trace.Line->sidenum[trace.Side]); - return true; + DPrintf ("Decal actor at (%ld,%ld) does not have a good template\n", x>>FRACBITS, y>>FRACBITS); } - return false; + // This actor doesn't need to stick around anymore. + Destroy(); } diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp index 444100e60..c14b7493f 100644 --- a/src/g_shared/a_keys.cpp +++ b/src/g_shared/a_keys.cpp @@ -28,7 +28,7 @@ struct Keygroup bool check(AActor * owner) { - for(size_t i=0;icheck(owner)) return false; } diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index b83ca0171..40ea81e3e 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -55,37 +55,37 @@ class DBaseDecal : public DThinker DECLARE_CLASS (DBaseDecal, DThinker) public: DBaseDecal (); - DBaseDecal (fixed_t x, fixed_t y, fixed_t z); + DBaseDecal (fixed_t z); + DBaseDecal (int statnum, fixed_t z); DBaseDecal (const AActor *actor); DBaseDecal (const DBaseDecal *basis); void Serialize (FArchive &arc); void Destroy (); - int StickToWall (side_s *wall); + int StickToWall (side_s *wall, fixed_t x, fixed_t y); fixed_t GetRealZ (const side_s *wall) const; void SetShade (DWORD rgb); void SetShade (int r, int g, int b); - void Spread (const FDecalTemplate *tpl, side_s *wall, fixed_t spread_z); + void Spread (const FDecalTemplate *tpl, side_s *wall, fixed_t x, fixed_t y, fixed_t z); + void GetXY (side_s *side, fixed_t &x, fixed_t &y) const; static void SerializeChain (FArchive &arc, DBaseDecal **firstptr); - static void MoveChain (DBaseDecal *first, fixed_t x, fixed_t y); - static void FixForSide (side_s *side); DBaseDecal *WallNext, **WallPrev; - fixed_t x, y, z; + fixed_t LeftDistance; + fixed_t Z; + fixed_t ScaleX, ScaleY; + fixed_t Alpha; DWORD AlphaColor; WORD Translation; WORD PicNum; WORD RenderFlags; - BYTE XScale, YScale; BYTE RenderStyle; - fixed_t LeftDistance; - fixed_t Alpha; protected: virtual DBaseDecal *CloneSelf (const FDecalTemplate *tpl, fixed_t x, fixed_t y, fixed_t z, side_s *wall) const; - void CalcFracPos (side_s *wall); + void CalcFracPos (side_s *wall, fixed_t x, fixed_t y); void Remove (); static void SpreadLeft (fixed_t r, vertex_s *v1, side_s *feelwall); @@ -96,7 +96,7 @@ class DImpactDecal : public DBaseDecal { DECLARE_CLASS (DImpactDecal, DBaseDecal) public: - DImpactDecal (fixed_t x, fixed_t y, fixed_t z); + DImpactDecal (fixed_t z); DImpactDecal (side_s *wall, const FDecalTemplate *templ); static DImpactDecal *StaticCreate (const char *name, fixed_t x, fixed_t y, fixed_t z, side_s *wall, PalEntry color=0); @@ -108,14 +108,12 @@ public: void Serialize (FArchive &arc); static void SerializeTime (FArchive &arc); - DImpactDecal *ImpactNext, *ImpactPrev; - protected: DBaseDecal *CloneSelf (const FDecalTemplate *tpl, fixed_t x, fixed_t y, fixed_t z, side_s *wall) const; + static void CheckMax (); private: DImpactDecal(); - void Link(); }; class AWaterSplashBase : public AActor diff --git a/src/po_man.cpp b/src/po_man.cpp index 1f6a06732..27b8c2b70 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -820,10 +820,6 @@ void DoMovePolyobj (polyobj_t *po, int x, int y) linedef->bbox[BOXBOTTOM] += y; linedef->bbox[BOXLEFT] += x; linedef->bbox[BOXRIGHT] += x; - if (linedef->sidenum[0] != NO_SIDE) - DBaseDecal::MoveChain (sides[linedef->sidenum[0]].AttachedDecals, x, y); - if (linedef->sidenum[1] != NO_SIDE) - DBaseDecal::MoveChain (sides[linedef->sidenum[1]].AttachedDecals, x, y); linedef->validcount = validcount; } for (veryTempSeg = po->segs; veryTempSeg != segList; veryTempSeg++) @@ -908,12 +904,7 @@ BOOL PO_RotatePolyobj (int num, angle_t angle) if ((*segList)->linedef->validcount != validcount) { UpdateSegBBox(*segList); - line_t *line = (*segList)->linedef; - if (line->sidenum[0] != NO_SIDE) - DBaseDecal::FixForSide (&sides[line->sidenum[0]]); - if (line->sidenum[1] != NO_SIDE) - DBaseDecal::FixForSide (&sides[line->sidenum[1]]); - line->validcount = validcount; + (*segList)->linedef->validcount = validcount; } } if (blocked) @@ -932,12 +923,7 @@ BOOL PO_RotatePolyobj (int num, angle_t angle) if ((*segList)->linedef->validcount != validcount) { UpdateSegBBox(*segList); - line_t *line = (*segList)->linedef; - if (line->sidenum[0] != NO_SIDE) - DBaseDecal::FixForSide (&sides[line->sidenum[0]]); - if (line->sidenum[1] != NO_SIDE) - DBaseDecal::FixForSide (&sides[line->sidenum[1]]); - line->validcount = validcount; + (*segList)->linedef->validcount = validcount; } } LinkPolyobj(po); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index c58745dd3..93ca55c05 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -124,7 +124,7 @@ FTexture *rw_pic; static short *maskedtexturecol; static FTexture *WallSpriteTile; -static void R_RenderDecal (DBaseDecal *first, drawseg_t *clipper, int pass); +static void R_RenderDecal (side_t *wall, DBaseDecal *first, drawseg_t *clipper, int pass); static void WallSpriteColumn (void (*drawfunc)(const BYTE *column, const FTexture::Span *spans)); //============================================================================= @@ -1336,7 +1336,7 @@ void R_StoreWallRange (int start, int stop) // [RH] Draw any decals bound to the seg for (DBaseDecal *decal = curline->sidedef->AttachedDecals; decal != NULL; decal = decal->WallNext) { - R_RenderDecal (decal, ds_p, 0); + R_RenderDecal (curline->sidedef, decal, ds_p, 0); } ds_p++; @@ -1766,11 +1766,11 @@ void PrepLWall (fixed_t *lwall, fixed_t walxrepeat) // = 1: drawing masked textures (including sprites) // Currently, only pass = 0 is done or used -static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass) +static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, int pass) { - fixed_t lx, ly, lx2, ly2; + fixed_t lx, ly, lx2, ly2, decalx, decaly; int x1, x2; - int xscale, yscale; + fixed_t xscale, yscale; fixed_t topoff; byte flipx; fixed_t zpos; @@ -1781,47 +1781,47 @@ static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass) return; // Determine actor z - zpos = decal->z; + zpos = decal->Z; front = curline->frontsector; back = (curline->backsector != NULL) ? curline->backsector : curline->frontsector; switch (decal->RenderFlags & RF_RELMASK) { default: - zpos = decal->z; + zpos = decal->Z; break; case RF_RELUPPER: if (curline->linedef->flags & ML_DONTPEGTOP) { - zpos = decal->z + front->ceilingtexz; + zpos = decal->Z + front->ceilingtexz; } else { - zpos = decal->z + back->ceilingtexz; + zpos = decal->Z + back->ceilingtexz; } break; case RF_RELLOWER: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - zpos = decal->z + front->ceilingtexz; + zpos = decal->Z + front->ceilingtexz; } else { - zpos = decal->z + back->floortexz; + zpos = decal->Z + back->floortexz; } break; case RF_RELMID: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - zpos = decal->z + front->floortexz; + zpos = decal->Z + front->floortexz; } else { - zpos = decal->z + front->ceilingtexz; + zpos = decal->Z + front->ceilingtexz; } } - xscale = decal->XScale + 1; - yscale = decal->YScale + 1; + xscale = decal->ScaleX; + yscale = decal->ScaleY; WallSpriteTile = TexMan(decal->PicNum); flipx = decal->RenderFlags & RF_XFLIP; @@ -1842,11 +1842,13 @@ static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass) x1 *= xscale; x2 *= xscale; + decal->GetXY (wall, decalx, decaly); + angle_t ang = R_PointToAngle2 (curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y) >> ANGLETOFINESHIFT; - lx = decal->x - MulScale6 (x1, finecosine[ang]) - viewx; - lx2 = decal->x + MulScale6 (x2, finecosine[ang]) - viewx; - ly = decal->y - MulScale6 (x1, finesine[ang]) - viewy; - ly2 = decal->y + MulScale6 (x2, finesine[ang]) - viewy; + lx = decalx - FixedMul (x1, finecosine[ang]) - viewx; + lx2 = decalx + FixedMul (x2, finecosine[ang]) - viewx; + ly = decaly - FixedMul (x1, finesine[ang]) - viewy; + ly2 = decaly + FixedMul (x2, finesine[ang]) - viewy; WallTX1 = DMulScale20 (lx, viewsin, -ly, viewcos); WallTX2 = DMulScale20 (lx2, viewsin, -ly2, viewcos); @@ -1974,10 +1976,7 @@ static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass) } topoff = WallSpriteTile->TopOffset << FRACBITS; - dc_texturemid = topoff + SafeDivScale6 (zpos - viewz, yscale); - - // Scale the texture size - rw_scalestep = MulScale6 (rw_scalestep, yscale); + dc_texturemid = topoff + FixedDiv (zpos - viewz, yscale); // Clip sprite to drawseg if (x1 < clipper->x1) @@ -2035,7 +2034,8 @@ static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass) sprflipvert = false; } - rw_offset = 16*FRACUNIT/yscale; + // rw_offset is used as the texture's vertical scale + rw_offset = SafeDivScale30(1, yscale); do { diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 752b984bb..79932573f 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -531,7 +531,7 @@ int S_DupPlayerSound (const char *pclass, int gender, int refid, int aliasref) static void S_ClearSoundData() { - size_t i; + unsigned int i; S_sfx.Clear(); diff --git a/src/statnums.h b/src/statnums.h index be7d1cda9..4e286fa5d 100644 --- a/src/statnums.h +++ b/src/statnums.h @@ -40,6 +40,7 @@ enum { // Thinkers that don't actually think STAT_INFO, // An info queue STAT_DECAL, // A decal + STAT_AUTODECAL, // A decal that can be automatically deleted STAT_CORPSEPOINTER, // An entry in Hexen's corpse queue STAT_TRAVELLING, // An actor temporarily travelling to a new map diff --git a/src/thingdef.cpp b/src/thingdef.cpp index 82db8d481..4b2e37bfb 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -91,8 +91,8 @@ inline char * MS_Strdup(const char * s) //========================================================================== // [RH] Keep GCC quiet by not using offsetof on Actor types. -#define DEFINE_FLAG(prefix, name, type, variable) { prefix##_##name, #name, (int)&((type*)1)->variable - 1 } -#define DEFINE_FLAG2(symbol, name, type, variable) { symbol, #name, (int)&((type*)1)->variable - 1 } +#define DEFINE_FLAG(prefix, name, type, variable) { prefix##_##name, #name, (int)(size_t)&((type*)1)->variable - 1 } +#define DEFINE_FLAG2(symbol, name, type, variable) { symbol, #name, (int)(size_t)&((type*)1)->variable - 1 } struct flagdef { @@ -3344,7 +3344,7 @@ static const ActorProps *is_actorprop (const char *str) //========================================================================== void FinishThingdef() { - size_t i; + unsigned int i; for (i = 0;i < TypeInfo::m_RuntimeActors.Size(); i++) { diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index d376236ea..4630d0f4a 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -558,7 +558,7 @@ void WI_LoadBackground(bool isenterpic) void WI_updateAnimatedBack() { - size_t i; + unsigned int i; for(i=0;i