mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 05:01:41 +00:00
- 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. SVN r35 (trunk)
This commit is contained in:
parent
4982558bbf
commit
735e6d72c4
17 changed files with 360 additions and 284 deletions
3
Makefile
3
Makefile
|
@ -1,6 +1,5 @@
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (Windows_NT,$(OS))
|
||||||
include Makefile.mgw
|
include Makefile.mgw
|
||||||
else
|
else
|
||||||
all:
|
include Makefile.linux
|
||||||
@echo Building with MinGW requires Windows NT
|
|
||||||
endif
|
endif
|
||||||
|
|
91
Makefile.linux
Normal file
91
Makefile.linux
Normal file
|
@ -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
|
|
@ -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)
|
April 12, 2006 (Changes by Graf Zahl)
|
||||||
- Fixed: SAVEVER was still 231 although MINSAVEVER was 232.
|
- Fixed: SAVEVER was still 231 although MINSAVEVER was 232.
|
||||||
- Fixed: Decal spreading used an incorrect z-coordinate. It has to use
|
- Fixed: Decal spreading used an incorrect z-coordinate. It has to use
|
||||||
|
|
110
src/decallib.cpp
110
src/decallib.cpp
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
FDecalLib DecalLibrary;
|
FDecalLib DecalLibrary;
|
||||||
|
|
||||||
static int ReadScale ();
|
static fixed_t ReadScale ();
|
||||||
static TArray<BYTE> DecalTranslations;
|
static TArray<BYTE> DecalTranslations;
|
||||||
extern TArray<char*> DecalNames;
|
extern TArray<char*> DecalNames;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ struct FDecalAnimator
|
||||||
{
|
{
|
||||||
FDecalAnimator (const char *name);
|
FDecalAnimator (const char *name);
|
||||||
virtual ~FDecalAnimator ();
|
virtual ~FDecalAnimator ();
|
||||||
virtual DThinker *CreateThinker (DBaseDecal *actor) const = 0;
|
virtual DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const = 0;
|
||||||
|
|
||||||
char *Name;
|
char *Name;
|
||||||
};
|
};
|
||||||
|
@ -122,7 +122,7 @@ void DDecalThinker::Serialize (FArchive &arc)
|
||||||
struct FDecalFaderAnim : public FDecalAnimator
|
struct FDecalFaderAnim : public FDecalAnimator
|
||||||
{
|
{
|
||||||
FDecalFaderAnim (const char *name) : FDecalAnimator (name) {}
|
FDecalFaderAnim (const char *name) : FDecalAnimator (name) {}
|
||||||
DThinker *CreateThinker (DBaseDecal *actor) const;
|
DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const;
|
||||||
|
|
||||||
int DecayStart;
|
int DecayStart;
|
||||||
int DecayTime;
|
int DecayTime;
|
||||||
|
@ -146,7 +146,7 @@ private:
|
||||||
struct FDecalColorerAnim : public FDecalAnimator
|
struct FDecalColorerAnim : public FDecalAnimator
|
||||||
{
|
{
|
||||||
FDecalColorerAnim (const char *name) : FDecalAnimator (name) {}
|
FDecalColorerAnim (const char *name) : FDecalAnimator (name) {}
|
||||||
DThinker *CreateThinker (DBaseDecal *actor) const;
|
DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const;
|
||||||
|
|
||||||
int DecayStart;
|
int DecayStart;
|
||||||
int DecayTime;
|
int DecayTime;
|
||||||
|
@ -172,11 +172,11 @@ private:
|
||||||
struct FDecalStretcherAnim : public FDecalAnimator
|
struct FDecalStretcherAnim : public FDecalAnimator
|
||||||
{
|
{
|
||||||
FDecalStretcherAnim (const char *name) : FDecalAnimator (name) {}
|
FDecalStretcherAnim (const char *name) : FDecalAnimator (name) {}
|
||||||
DThinker *CreateThinker (DBaseDecal *actor) const;
|
DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const;
|
||||||
|
|
||||||
int StretchStart;
|
int StretchStart;
|
||||||
int StretchTime;
|
int StretchTime;
|
||||||
int GoalX, GoalY;
|
fixed_t GoalX, GoalY;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DDecalStretcher : public DDecalThinker
|
class DDecalStretcher : public DDecalThinker
|
||||||
|
@ -189,10 +189,10 @@ public:
|
||||||
|
|
||||||
int TimeToStart;
|
int TimeToStart;
|
||||||
int TimeToStop;
|
int TimeToStop;
|
||||||
BYTE GoalX;
|
fixed_t GoalX;
|
||||||
BYTE StartX;
|
fixed_t StartX;
|
||||||
BYTE GoalY;
|
fixed_t GoalY;
|
||||||
BYTE StartY;
|
fixed_t StartY;
|
||||||
bool bStretchX;
|
bool bStretchX;
|
||||||
bool bStretchY;
|
bool bStretchY;
|
||||||
bool bStarted;
|
bool bStarted;
|
||||||
|
@ -203,11 +203,11 @@ private:
|
||||||
struct FDecalSliderAnim : public FDecalAnimator
|
struct FDecalSliderAnim : public FDecalAnimator
|
||||||
{
|
{
|
||||||
FDecalSliderAnim (const char *name) : FDecalAnimator (name) {}
|
FDecalSliderAnim (const char *name) : FDecalAnimator (name) {}
|
||||||
DThinker *CreateThinker (DBaseDecal *actor) const;
|
DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const;
|
||||||
|
|
||||||
int SlideStart;
|
int SlideStart;
|
||||||
int SlideTime;
|
int SlideTime;
|
||||||
fixed_t DistX, DistY;
|
fixed_t /*DistX,*/ DistY;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DDecalSlider : public DDecalThinker
|
class DDecalSlider : public DDecalThinker
|
||||||
|
@ -220,7 +220,7 @@ public:
|
||||||
|
|
||||||
int TimeToStart;
|
int TimeToStart;
|
||||||
int TimeToStop;
|
int TimeToStop;
|
||||||
fixed_t DistX;
|
/* fixed_t DistX; */
|
||||||
fixed_t DistY;
|
fixed_t DistY;
|
||||||
fixed_t StartX;
|
fixed_t StartX;
|
||||||
fixed_t StartY;
|
fixed_t StartY;
|
||||||
|
@ -232,7 +232,7 @@ private:
|
||||||
struct FDecalCombinerAnim : public FDecalAnimator
|
struct FDecalCombinerAnim : public FDecalAnimator
|
||||||
{
|
{
|
||||||
FDecalCombinerAnim (const char *name) : FDecalAnimator (name) {}
|
FDecalCombinerAnim (const char *name) : FDecalAnimator (name) {}
|
||||||
DThinker *CreateThinker (DBaseDecal *actor) const;
|
DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const;
|
||||||
|
|
||||||
int FirstAnimator;
|
int FirstAnimator;
|
||||||
int NumAnimators;
|
int NumAnimators;
|
||||||
|
@ -328,7 +328,7 @@ void FDecalLib::DelTree (FDecalBase *root)
|
||||||
void FDecalLib::ReadAllDecals ()
|
void FDecalLib::ReadAllDecals ()
|
||||||
{
|
{
|
||||||
int lump, lastlump = 0;
|
int lump, lastlump = 0;
|
||||||
size_t i;
|
unsigned int i;
|
||||||
|
|
||||||
while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1)
|
while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1)
|
||||||
{
|
{
|
||||||
|
@ -432,7 +432,7 @@ void FDecalLib::ParseDecal ()
|
||||||
|
|
||||||
memset (&newdecal, 0, sizeof(newdecal));
|
memset (&newdecal, 0, sizeof(newdecal));
|
||||||
newdecal.PicNum = 0xffff;
|
newdecal.PicNum = 0xffff;
|
||||||
newdecal.ScaleX = newdecal.ScaleY = 63;
|
newdecal.ScaleX = newdecal.ScaleY = FRACUNIT;
|
||||||
newdecal.RenderFlags = RF_WALLSPRITE;
|
newdecal.RenderFlags = RF_WALLSPRITE;
|
||||||
newdecal.RenderStyle = STYLE_Normal;
|
newdecal.RenderStyle = STYLE_Normal;
|
||||||
newdecal.Alpha = 0x8000;
|
newdecal.Alpha = 0x8000;
|
||||||
|
@ -555,6 +555,7 @@ void FDecalLib::ParseDecalGroup ()
|
||||||
if (SC_Compare ("}"))
|
if (SC_Compare ("}"))
|
||||||
{
|
{
|
||||||
group->Name = copystring (groupName);
|
group->Name = copystring (groupName);
|
||||||
|
group->SpawnID = decalNum;
|
||||||
AddDecal (group);
|
AddDecal (group);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -652,7 +653,7 @@ void FDecalLib::ParseFader ()
|
||||||
void FDecalLib::ParseStretcher ()
|
void FDecalLib::ParseStretcher ()
|
||||||
{
|
{
|
||||||
char stretcherName[64];
|
char stretcherName[64];
|
||||||
int goalX = -1, goalY = -1;
|
fixed_t goalX = -1, goalY = -1;
|
||||||
int startTime = 0, takeTime = 0;
|
int startTime = 0, takeTime = 0;
|
||||||
|
|
||||||
SC_MustGetString ();
|
SC_MustGetString ();
|
||||||
|
@ -715,12 +716,12 @@ void FDecalLib::ParseSlider ()
|
||||||
SC_MustGetString ();
|
SC_MustGetString ();
|
||||||
if (SC_Compare ("}"))
|
if (SC_Compare ("}"))
|
||||||
{
|
{
|
||||||
if ((distX | distY) != 0)
|
if ((/*distX |*/ distY) != 0)
|
||||||
{
|
{
|
||||||
FDecalSliderAnim *slider = new FDecalSliderAnim (sliderName);
|
FDecalSliderAnim *slider = new FDecalSliderAnim (sliderName);
|
||||||
slider->SlideStart = startTime;
|
slider->SlideStart = startTime;
|
||||||
slider->SlideTime = takeTime;
|
slider->SlideTime = takeTime;
|
||||||
slider->DistX = distX;
|
/*slider->DistX = distX;*/
|
||||||
slider->DistY = distY;
|
slider->DistY = distY;
|
||||||
Animators.Push (slider);
|
Animators.Push (slider);
|
||||||
}
|
}
|
||||||
|
@ -740,6 +741,7 @@ void FDecalLib::ParseSlider ()
|
||||||
{
|
{
|
||||||
SC_MustGetFloat ();
|
SC_MustGetFloat ();
|
||||||
distX = (fixed_t)(sc_Float * FRACUNIT);
|
distX = (fixed_t)(sc_Float * FRACUNIT);
|
||||||
|
Printf ("DistX in slider decal %s is unsupported\n", sliderName);
|
||||||
}
|
}
|
||||||
else if (SC_Compare ("DistY"))
|
else if (SC_Compare ("DistY"))
|
||||||
{
|
{
|
||||||
|
@ -994,28 +996,28 @@ FDecalBase::~FDecalBase ()
|
||||||
delete[] Name;
|
delete[] Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDecalTemplate::ApplyToDecal (DBaseDecal *actor) const
|
void FDecalTemplate::ApplyToDecal (DBaseDecal *decal, side_t *wall) const
|
||||||
{
|
{
|
||||||
if (RenderStyle == STYLE_Shaded)
|
if (RenderStyle == STYLE_Shaded)
|
||||||
{
|
{
|
||||||
actor->SetShade (ShadeColor);
|
decal->SetShade (ShadeColor);
|
||||||
}
|
}
|
||||||
actor->Translation = Translation;
|
decal->Translation = Translation;
|
||||||
actor->XScale = ScaleX;
|
decal->ScaleX = ScaleX;
|
||||||
actor->YScale = ScaleY;
|
decal->ScaleY = ScaleY;
|
||||||
actor->PicNum = PicNum;
|
decal->PicNum = PicNum;
|
||||||
actor->Alpha = Alpha << 1;
|
decal->Alpha = Alpha << 1;
|
||||||
actor->RenderStyle = RenderStyle;
|
decal->RenderStyle = RenderStyle;
|
||||||
actor->RenderFlags = (RenderFlags & ~(DECAL_RandomFlipX|DECAL_RandomFlipY)) |
|
decal->RenderFlags = (RenderFlags & ~(DECAL_RandomFlipX|DECAL_RandomFlipY)) |
|
||||||
(actor->RenderFlags & (RF_RELMASK|RF_CLIPMASK|RF_INVISIBLE|RF_ONESIDED));
|
(decal->RenderFlags & (RF_RELMASK|RF_CLIPMASK|RF_INVISIBLE|RF_ONESIDED));
|
||||||
if (RenderFlags & (DECAL_RandomFlipX|DECAL_RandomFlipY))
|
if (RenderFlags & (DECAL_RandomFlipX|DECAL_RandomFlipY))
|
||||||
{
|
{
|
||||||
actor->RenderFlags ^= pr_decal() &
|
decal->RenderFlags ^= pr_decal() &
|
||||||
((RenderFlags & (DECAL_RandomFlipX|DECAL_RandomFlipY)) >> 8);
|
((RenderFlags & (DECAL_RandomFlipX|DECAL_RandomFlipY)) >> 8);
|
||||||
}
|
}
|
||||||
if (Animator != NULL)
|
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);
|
DDecalFader *fader = new DDecalFader (actor);
|
||||||
|
|
||||||
|
@ -1178,7 +1180,7 @@ void DDecalStretcher::Serialize (FArchive &arc)
|
||||||
<< bStarted;
|
<< bStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
DThinker *FDecalStretcherAnim::CreateThinker (DBaseDecal *actor) const
|
DThinker *FDecalStretcherAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const
|
||||||
{
|
{
|
||||||
DDecalStretcher *thinker = new DDecalStretcher (actor);
|
DDecalStretcher *thinker = new DDecalStretcher (actor);
|
||||||
|
|
||||||
|
@ -1221,11 +1223,11 @@ void DDecalStretcher::Tick ()
|
||||||
{
|
{
|
||||||
if (bStretchX)
|
if (bStretchX)
|
||||||
{
|
{
|
||||||
TheDecal->XScale = GoalX;
|
TheDecal->ScaleX = GoalX;
|
||||||
}
|
}
|
||||||
if (bStretchY)
|
if (bStretchY)
|
||||||
{
|
{
|
||||||
TheDecal->YScale = GoalY;
|
TheDecal->ScaleY = GoalY;
|
||||||
}
|
}
|
||||||
Destroy ();
|
Destroy ();
|
||||||
return;
|
return;
|
||||||
|
@ -1233,19 +1235,19 @@ void DDecalStretcher::Tick ()
|
||||||
if (!bStarted)
|
if (!bStarted)
|
||||||
{
|
{
|
||||||
bStarted = true;
|
bStarted = true;
|
||||||
StartX = TheDecal->XScale;
|
StartX = TheDecal->ScaleX;
|
||||||
StartY = TheDecal->YScale;
|
StartY = TheDecal->ScaleY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int distance = level.maptime - TimeToStart;
|
int distance = level.maptime - TimeToStart;
|
||||||
int maxDistance = TimeToStop - TimeToStart;
|
int maxDistance = TimeToStop - TimeToStart;
|
||||||
if (bStretchX)
|
if (bStretchX)
|
||||||
{
|
{
|
||||||
TheDecal->XScale = StartX + Scale (GoalX - StartX, distance, maxDistance);
|
TheDecal->ScaleX = StartX + Scale (GoalX - StartX, distance, maxDistance);
|
||||||
}
|
}
|
||||||
if (bStretchY)
|
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);
|
Super::Serialize (arc);
|
||||||
arc << TimeToStart
|
arc << TimeToStart
|
||||||
<< TimeToStop
|
<< TimeToStop
|
||||||
<< DistX
|
/*<< DistX*/
|
||||||
<< DistY
|
<< DistY
|
||||||
<< StartX
|
/*<< StartX*/
|
||||||
<< StartY
|
<< StartY
|
||||||
<< bStarted;
|
<< bStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
DThinker *FDecalSliderAnim::CreateThinker (DBaseDecal *actor) const
|
DThinker *FDecalSliderAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const
|
||||||
{
|
{
|
||||||
DDecalSlider *thinker = new DDecalSlider (actor);
|
DDecalSlider *thinker = new DDecalSlider (actor);
|
||||||
|
|
||||||
thinker->TimeToStart = level.maptime + SlideStart;
|
thinker->TimeToStart = level.maptime + SlideStart;
|
||||||
thinker->TimeToStop = thinker->TimeToStart + SlideTime;
|
thinker->TimeToStop = thinker->TimeToStart + SlideTime;
|
||||||
thinker->DistX = DistX;
|
/*thinker->DistX = DistX;*/
|
||||||
thinker->DistY = DistY;
|
thinker->DistY = DistY;
|
||||||
thinker->bStarted = false;
|
thinker->bStarted = false;
|
||||||
return thinker;
|
return thinker;
|
||||||
|
@ -1289,30 +1291,30 @@ void DDecalSlider::Tick ()
|
||||||
if (!bStarted)
|
if (!bStarted)
|
||||||
{
|
{
|
||||||
bStarted = true;
|
bStarted = true;
|
||||||
StartX = TheDecal->x;
|
/*StartX = TheDecal->LeftDistance;*/
|
||||||
StartY = TheDecal->z;
|
StartY = TheDecal->Z;
|
||||||
}
|
}
|
||||||
if (level.maptime >= TimeToStop)
|
if (level.maptime >= TimeToStop)
|
||||||
{
|
{
|
||||||
TheDecal->x = StartX + DistX;
|
/*TheDecal->LeftDistance = StartX + DistX;*/
|
||||||
TheDecal->z = StartY + DistY;
|
TheDecal->Z = StartY + DistY;
|
||||||
Destroy ();
|
Destroy ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int distance = level.maptime - TimeToStart;
|
int distance = level.maptime - TimeToStart;
|
||||||
int maxDistance = TimeToStop - TimeToStart;
|
int maxDistance = TimeToStop - TimeToStart;
|
||||||
TheDecal->x = StartX + Scale (DistX, distance, maxDistance);
|
/*TheDecal->LeftDistance = StartX + Scale (DistX, distance, maxDistance);*/
|
||||||
TheDecal->z = StartY + Scale (DistY, 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;
|
DThinker *thinker = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < NumAnimators; ++i)
|
for (int i = 0; i < NumAnimators; ++i)
|
||||||
{
|
{
|
||||||
thinker = AnimatorList[FirstAnimator+i]->CreateThinker (actor);
|
thinker = AnimatorList[FirstAnimator+i]->CreateThinker (actor, wall);
|
||||||
}
|
}
|
||||||
return thinker;
|
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);
|
DDecalColorer *Colorer = new DDecalColorer (actor);
|
||||||
|
|
||||||
|
@ -1391,8 +1393,8 @@ DThinker *FDecalColorerAnim::CreateThinker (DBaseDecal *actor) const
|
||||||
return Colorer;
|
return Colorer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ReadScale ()
|
static fixed_t ReadScale ()
|
||||||
{
|
{
|
||||||
SC_MustGetFloat ();
|
SC_MustGetFloat ();
|
||||||
return clamp ((int)(sc_Float * 64.f), 1, 256) - 1;
|
return fixed_t(clamp (sc_Float * FRACUNIT, 256.f, 256.f*FRACUNIT));
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ class FDecalTemplate;
|
||||||
struct FDecalAnimator;
|
struct FDecalAnimator;
|
||||||
struct TypeInfo;
|
struct TypeInfo;
|
||||||
class DBaseDecal;
|
class DBaseDecal;
|
||||||
|
struct side_s;
|
||||||
|
|
||||||
class FDecalBase
|
class FDecalBase
|
||||||
{
|
{
|
||||||
|
@ -67,12 +68,12 @@ class FDecalTemplate : public FDecalBase
|
||||||
public:
|
public:
|
||||||
FDecalTemplate () : Translation (0) {}
|
FDecalTemplate () : Translation (0) {}
|
||||||
|
|
||||||
void ApplyToDecal (DBaseDecal *actor) const;
|
void ApplyToDecal (DBaseDecal *actor, side_s *wall) const;
|
||||||
const FDecalTemplate *GetDecal () const;
|
const FDecalTemplate *GetDecal () const;
|
||||||
|
|
||||||
|
fixed_t ScaleX, ScaleY;
|
||||||
DWORD ShadeColor;
|
DWORD ShadeColor;
|
||||||
WORD Translation;
|
WORD Translation;
|
||||||
BYTE ScaleX, ScaleY;
|
|
||||||
BYTE RenderStyle;
|
BYTE RenderStyle;
|
||||||
WORD PicNum;
|
WORD PicNum;
|
||||||
WORD RenderFlags;
|
WORD RenderFlags;
|
||||||
|
|
|
@ -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<DThinker *>(node);
|
||||||
|
}
|
||||||
|
|
||||||
void DThinker::ChangeStatNum (int statnum)
|
void DThinker::ChangeStatNum (int statnum)
|
||||||
{
|
{
|
||||||
if ((unsigned)statnum > MAX_STATNUM)
|
if ((unsigned)statnum > MAX_STATNUM)
|
||||||
|
|
|
@ -68,6 +68,8 @@ public:
|
||||||
static void DestroyMostThinkers ();
|
static void DestroyMostThinkers ();
|
||||||
static void SerializeAll (FArchive &arc, bool keepPlayers);
|
static void SerializeAll (FArchive &arc, bool keepPlayers);
|
||||||
|
|
||||||
|
static DThinker *FirstThinker (int statnum);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void DestroyThinkersInList (Node *first);
|
static void DestroyThinkersInList (Node *first);
|
||||||
static void DestroyMostThinkersInList (List &list, int stat);
|
static void DestroyMostThinkersInList (List &list, int stat);
|
||||||
|
|
|
@ -49,8 +49,6 @@ static const FDecalTemplate *SpreadTemplate;
|
||||||
static TArray<side_t *> SpreadStack;
|
static TArray<side_t *> SpreadStack;
|
||||||
|
|
||||||
static int ImpactCount;
|
static int ImpactCount;
|
||||||
static DImpactDecal *FirstImpact; // (but not the Second or Third Impact :-)
|
|
||||||
static DImpactDecal *LastImpact;
|
|
||||||
|
|
||||||
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
|
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
|
||||||
|
|
||||||
|
@ -62,33 +60,38 @@ IMPLEMENT_CLASS (DImpactDecal)
|
||||||
|
|
||||||
DBaseDecal::DBaseDecal ()
|
DBaseDecal::DBaseDecal ()
|
||||||
: DThinker(STAT_DECAL),
|
: DThinker(STAT_DECAL),
|
||||||
WallNext(0), WallPrev(0), x(0), y(0), z(0), AlphaColor(0), Translation(0), PicNum(0xFFFF),
|
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
|
||||||
RenderFlags(0), XScale(8), YScale(8), RenderStyle(0), LeftDistance(0), Alpha(0)
|
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),
|
: DThinker(STAT_DECAL),
|
||||||
WallNext(0), WallPrev(0), x(x), y(y), z(z), AlphaColor(0), Translation(0), PicNum(0xFFFF),
|
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
|
||||||
RenderFlags(0), XScale(8), YScale(8), RenderStyle(0), LeftDistance(0), Alpha(0)
|
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)
|
DBaseDecal::DBaseDecal (const AActor *basis)
|
||||||
: DThinker(STAT_DECAL),
|
: DThinker(STAT_DECAL),
|
||||||
WallNext(0), WallPrev(0), x(basis->x), y(basis->y), z(basis->z), AlphaColor(basis->alphacolor),
|
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->z), ScaleX(basis->xscale<<10), ScaleY(basis->yscale<<10),
|
||||||
Translation(basis->Translation), PicNum(basis->picnum), RenderFlags(basis->renderflags),
|
Alpha(basis->alpha), AlphaColor(basis->alphacolor), Translation(basis->Translation), PicNum(basis->picnum),
|
||||||
XScale(basis->xscale), YScale(basis->yscale), RenderStyle(basis->RenderStyle), LeftDistance(0),
|
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
|
||||||
Alpha(basis->alpha)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DBaseDecal::DBaseDecal (const DBaseDecal *basis)
|
DBaseDecal::DBaseDecal (const DBaseDecal *basis)
|
||||||
: DThinker(STAT_DECAL),
|
: DThinker(STAT_DECAL),
|
||||||
WallNext(0), WallPrev(0), x(basis->x), y(basis->y), z(basis->z), AlphaColor(basis->AlphaColor),
|
WallNext(0), WallPrev(0), LeftDistance(basis->LeftDistance), Z(basis->Z), ScaleX(basis->ScaleX),
|
||||||
Translation(basis->Translation), PicNum(basis->PicNum), RenderFlags(basis->RenderFlags),
|
ScaleY(basis->ScaleY), Alpha(basis->Alpha), AlphaColor(basis->AlphaColor), Translation(basis->Translation),
|
||||||
XScale(basis->XScale), YScale(basis->YScale), RenderStyle(basis->RenderStyle), LeftDistance(0),
|
PicNum(basis->PicNum), RenderFlags(basis->RenderFlags), RenderStyle(basis->RenderStyle)
|
||||||
Alpha(basis->Alpha)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,15 +114,15 @@ void DBaseDecal::Remove ()
|
||||||
void DBaseDecal::Serialize (FArchive &arc)
|
void DBaseDecal::Serialize (FArchive &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
arc << x << y << z
|
arc << LeftDistance
|
||||||
|
<< Z
|
||||||
|
<< ScaleX << ScaleY
|
||||||
|
<< Alpha
|
||||||
<< AlphaColor
|
<< AlphaColor
|
||||||
<< Translation
|
<< Translation
|
||||||
<< PicNum
|
<< PicNum
|
||||||
<< RenderFlags
|
<< RenderFlags
|
||||||
<< XScale << YScale
|
<< RenderStyle;
|
||||||
<< RenderStyle
|
|
||||||
<< LeftDistance
|
|
||||||
<< Alpha;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first)
|
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];
|
line_t *line = &lines[wall->linenum];
|
||||||
DWORD wallnum = DWORD(wall - sides);
|
DWORD wallnum = DWORD(wall - sides);
|
||||||
vertex_t *v1, *v2;
|
vertex_t *v1, *v2;
|
||||||
|
@ -190,12 +182,8 @@ void DBaseDecal::FixForSide (side_t *wall)
|
||||||
fixed_t dx = v2->x - v1->x;
|
fixed_t dx = v2->x - v1->x;
|
||||||
fixed_t dy = v2->y - v1->y;
|
fixed_t dy = v2->y - v1->y;
|
||||||
|
|
||||||
while (decal != NULL)
|
ox = v1->x + MulScale30 (LeftDistance, dx);
|
||||||
{
|
oy = v1->y + MulScale30 (LeftDistance, dy);
|
||||||
decal->x = v1->x + MulScale2 (decal->LeftDistance, dx);
|
|
||||||
decal->y = v1->y + MulScale2 (decal->LeftDistance, dy);
|
|
||||||
decal = decal->WallNext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBaseDecal::SetShade (DWORD rgb)
|
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.
|
// 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
|
// Stick the decal at the end of the chain so it appears on top
|
||||||
DBaseDecal *next, **prev;
|
DBaseDecal *next, **prev;
|
||||||
|
@ -251,31 +239,31 @@ int DBaseDecal::StickToWall (side_t *wall)
|
||||||
{
|
{
|
||||||
RenderFlags |= RF_RELMID;
|
RenderFlags |= RF_RELMID;
|
||||||
if (line->flags & ML_DONTPEGBOTTOM)
|
if (line->flags & ML_DONTPEGBOTTOM)
|
||||||
z -= front->floortexz;
|
Z -= front->floortexz;
|
||||||
else
|
else
|
||||||
z -= front->ceilingtexz;
|
Z -= front->ceilingtexz;
|
||||||
tex = wall->midtexture;
|
tex = wall->midtexture;
|
||||||
}
|
}
|
||||||
else if (back->floorplane.ZatPoint (x, y) >= z)
|
else if (back->floorplane.ZatPoint (x, y) >= Z)
|
||||||
{
|
{
|
||||||
RenderFlags |= RF_RELLOWER|RF_CLIPLOWER;
|
RenderFlags |= RF_RELLOWER|RF_CLIPLOWER;
|
||||||
if (line->flags & ML_DONTPEGBOTTOM)
|
if (line->flags & ML_DONTPEGBOTTOM)
|
||||||
z -= front->ceilingtexz;
|
Z -= front->ceilingtexz;
|
||||||
else
|
else
|
||||||
z -= back->floortexz;
|
Z -= back->floortexz;
|
||||||
tex = wall->bottomtexture;
|
tex = wall->bottomtexture;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RenderFlags |= RF_RELUPPER|RF_CLIPUPPER;
|
RenderFlags |= RF_RELUPPER|RF_CLIPUPPER;
|
||||||
if (line->flags & ML_DONTPEGTOP)
|
if (line->flags & ML_DONTPEGTOP)
|
||||||
z -= front->ceilingtexz;
|
Z -= front->ceilingtexz;
|
||||||
else
|
else
|
||||||
z -= back->ceilingtexz;
|
Z -= back->ceilingtexz;
|
||||||
tex = wall->toptexture;
|
tex = wall->toptexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalcFracPos (wall);
|
CalcFracPos (wall, x, y);
|
||||||
|
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
@ -303,38 +291,38 @@ fixed_t DBaseDecal::GetRealZ (const side_t *wall) const
|
||||||
switch (RenderFlags & RF_RELMASK)
|
switch (RenderFlags & RF_RELMASK)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return z;
|
return Z;
|
||||||
case RF_RELUPPER:
|
case RF_RELUPPER:
|
||||||
if (curline->linedef->flags & ML_DONTPEGTOP)
|
if (curline->linedef->flags & ML_DONTPEGTOP)
|
||||||
{
|
{
|
||||||
return z + front->ceilingtexz;
|
return Z + front->ceilingtexz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return z + back->ceilingtexz;
|
return Z + back->ceilingtexz;
|
||||||
}
|
}
|
||||||
case RF_RELLOWER:
|
case RF_RELLOWER:
|
||||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||||
{
|
{
|
||||||
return z + front->ceilingtexz;
|
return Z + front->ceilingtexz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return z + back->floortexz;
|
return Z + back->floortexz;
|
||||||
}
|
}
|
||||||
case RF_RELMID:
|
case RF_RELMID:
|
||||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||||
{
|
{
|
||||||
return z + front->floortexz;
|
return Z + front->floortexz;
|
||||||
}
|
}
|
||||||
else
|
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];
|
line_t *line = &lines[wall->linenum];
|
||||||
DWORD wallnum = DWORD(wall - sides);
|
DWORD wallnum = DWORD(wall - sides);
|
||||||
|
@ -356,11 +344,11 @@ void DBaseDecal::CalcFracPos (side_t *wall)
|
||||||
|
|
||||||
if (abs(dx) > abs(dy))
|
if (abs(dx) > abs(dy))
|
||||||
{
|
{
|
||||||
LeftDistance = SafeDivScale2 (x - v1->x, dx);
|
LeftDistance = SafeDivScale30 (x - v1->x, dx);
|
||||||
}
|
}
|
||||||
else if (dy != 0)
|
else if (dy != 0)
|
||||||
{
|
{
|
||||||
LeftDistance = SafeDivScale2 (y - v1->y, dy);
|
LeftDistance = SafeDivScale30 (y - v1->y, dy);
|
||||||
}
|
}
|
||||||
else
|
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;
|
FTexture *tex;
|
||||||
vertex_t *v1;
|
vertex_t *v1;
|
||||||
fixed_t rorg, ldx, ldy;
|
fixed_t rorg, ldx, ldy;
|
||||||
int xscale, yscale;
|
|
||||||
|
|
||||||
GetWallStuff (wall, v1, ldx, ldy);
|
GetWallStuff (wall, v1, ldx, ldy);
|
||||||
rorg = Length (x - v1->x, y - v1->y);
|
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];
|
tex = TexMan[PicNum];
|
||||||
int dwidth = tex->GetWidth ();
|
int dwidth = tex->GetWidth ();
|
||||||
|
|
||||||
xscale = (XScale + 1) << (FRACBITS - 6);
|
DecalWidth = dwidth * ScaleX;
|
||||||
yscale = (YScale + 1) << (FRACBITS - 6);
|
DecalLeft = tex->LeftOffset * ScaleX;
|
||||||
|
|
||||||
DecalWidth = dwidth * xscale;
|
|
||||||
DecalLeft = tex->LeftOffset * xscale;
|
|
||||||
DecalRight = DecalWidth - DecalLeft;
|
DecalRight = DecalWidth - DecalLeft;
|
||||||
SpreadSource = this;
|
SpreadSource = this;
|
||||||
SpreadTemplate = tpl;
|
SpreadTemplate = tpl;
|
||||||
SpreadZ = spread_z;
|
SpreadZ = z;
|
||||||
|
|
||||||
|
|
||||||
// Try spreading left first
|
// Try spreading left first
|
||||||
SpreadLeft (rorg - DecalLeft, v1, wall);
|
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 *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)
|
if (decal != NULL)
|
||||||
{
|
{
|
||||||
decal->StickToWall (wall);
|
decal->StickToWall (wall, ix, iy);
|
||||||
tpl->ApplyToDecal (decal);
|
tpl->ApplyToDecal (decal, wall);
|
||||||
decal->AlphaColor = AlphaColor;
|
decal->AlphaColor = AlphaColor;
|
||||||
decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) |
|
decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) |
|
||||||
(this->RenderFlags & ~RF_DECALMASK);
|
(this->RenderFlags & ~RF_DECALMASK);
|
||||||
|
@ -551,7 +534,11 @@ CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE)
|
||||||
{
|
{
|
||||||
while (ImpactCount > self)
|
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 ())
|
if (arc.IsLoading ())
|
||||||
{
|
{
|
||||||
ImpactCount = 0;
|
ImpactCount = 0;
|
||||||
FirstImpact = LastImpact = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,31 +566,27 @@ void DImpactDecal::Serialize (FArchive &arc)
|
||||||
}
|
}
|
||||||
|
|
||||||
DImpactDecal::DImpactDecal ()
|
DImpactDecal::DImpactDecal ()
|
||||||
: ImpactNext(0), ImpactPrev(0)
|
|
||||||
{
|
{
|
||||||
Link();
|
ChangeStatNum (STAT_AUTODECAL);
|
||||||
|
ImpactCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
DImpactDecal::DImpactDecal (fixed_t x, fixed_t y, fixed_t z)
|
DImpactDecal::DImpactDecal (fixed_t z)
|
||||||
: DBaseDecal (x, y, z),
|
: DBaseDecal (STAT_AUTODECAL, z)
|
||||||
ImpactNext(0), ImpactPrev(0)
|
|
||||||
{
|
|
||||||
Link();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DImpactDecal::Link ()
|
|
||||||
{
|
{
|
||||||
ImpactCount++;
|
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)
|
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);
|
StaticCreate (tpl->LowerDecal->GetDecal(), x, y, z, wall);
|
||||||
}
|
}
|
||||||
if (ImpactCount >= cl_maxdecals)
|
DImpactDecal::CheckMax();
|
||||||
{
|
decal = new DImpactDecal (z);
|
||||||
FirstImpact->Destroy ();
|
|
||||||
}
|
|
||||||
|
|
||||||
decal = new DImpactDecal (x, y, z);
|
int stickypic = decal->StickToWall (wall, x, y);
|
||||||
|
|
||||||
int stickypic = decal->StickToWall (wall);
|
|
||||||
FTexture *tex = TexMan[stickypic];
|
FTexture *tex = TexMan[stickypic];
|
||||||
|
|
||||||
if (tex != NULL && tex->bNoDecals)
|
if (tex != NULL && tex->bNoDecals)
|
||||||
|
@ -650,7 +628,7 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tpl->ApplyToDecal (decal);
|
tpl->ApplyToDecal (decal, wall);
|
||||||
if (color != 0)
|
if (color != 0)
|
||||||
{
|
{
|
||||||
decal->SetShade (color.r, color.g, color.b);
|
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
|
// 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;
|
return decal;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_t iy, fixed_t iz, side_t *wall) const
|
DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_t iy, fixed_t iz, side_t *wall) const
|
||||||
{
|
{
|
||||||
if (ImpactCount >= cl_maxdecals)
|
DImpactDecal::CheckMax();
|
||||||
{
|
DImpactDecal *decal = new DImpactDecal(iz);
|
||||||
FirstImpact->Destroy ();
|
|
||||||
}
|
|
||||||
DImpactDecal *decal = new DImpactDecal(ix, iy, iz);
|
|
||||||
if (decal != NULL)
|
if (decal != NULL)
|
||||||
{
|
{
|
||||||
decal->StickToWall (wall);
|
decal->StickToWall (wall, ix, iy);
|
||||||
tpl->ApplyToDecal (decal);
|
tpl->ApplyToDecal (decal, wall);
|
||||||
decal->AlphaColor = AlphaColor;
|
decal->AlphaColor = AlphaColor;
|
||||||
decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) |
|
decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) |
|
||||||
(this->RenderFlags & ~RF_DECALMASK);
|
(this->RenderFlags & ~RF_DECALMASK);
|
||||||
|
@ -687,23 +662,6 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixe
|
||||||
|
|
||||||
void DImpactDecal::Destroy ()
|
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--;
|
ImpactCount--;
|
||||||
Super::Destroy ();
|
Super::Destroy ();
|
||||||
}
|
}
|
||||||
|
@ -715,7 +673,7 @@ CCMD (countdecals)
|
||||||
|
|
||||||
CCMD (countdecalsreal)
|
CCMD (countdecalsreal)
|
||||||
{
|
{
|
||||||
TThinkerIterator<DImpactDecal> iterator (STAT_DECAL);
|
TThinkerIterator<DImpactDecal> iterator (STAT_AUTODECAL);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while (iterator.Next())
|
while (iterator.Next())
|
||||||
|
@ -760,7 +718,6 @@ class ADecal : public AActor
|
||||||
DECLARE_STATELESS_ACTOR (ADecal, AActor);
|
DECLARE_STATELESS_ACTOR (ADecal, AActor);
|
||||||
public:
|
public:
|
||||||
void BeginPlay ();
|
void BeginPlay ();
|
||||||
bool DoTrace (DBaseDecal *decal, angle_t angle, sector_t *sec);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_STATELESS_ACTOR (ADecal, Any, 9200, 0)
|
IMPLEMENT_STATELESS_ACTOR (ADecal, Any, 9200, 0)
|
||||||
|
@ -768,47 +725,45 @@ END_DEFAULTS
|
||||||
|
|
||||||
void ADecal::BeginPlay ()
|
void ADecal::BeginPlay ()
|
||||||
{
|
{
|
||||||
|
const FDecalTemplate *tpl;
|
||||||
|
FTraceResults trace;
|
||||||
|
DBaseDecal *decal;
|
||||||
|
side_t *wall;
|
||||||
|
|
||||||
Super::BeginPlay ();
|
Super::BeginPlay ();
|
||||||
|
|
||||||
// Find a wall to attach to, and set RenderFlags to keep
|
// If no decal is specified, don't try to create one.
|
||||||
// the decal at its current height. If the decal cannot find a wall
|
if (args[0] != 0 && (tpl = DecalLibrary.GetDecalByNum (args[0])) != 0)
|
||||||
// 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))
|
|
||||||
{
|
{
|
||||||
decal->Destroy();
|
// Look for a wall within 64 units behind the actor. If none can be
|
||||||
return;
|
// 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)
|
if (trace.HitType == TRACE_HitWall)
|
||||||
{
|
|
||||||
const FDecalTemplate *tpl = DecalLibrary.GetDecalByNum (args[0]);
|
|
||||||
if (tpl != NULL)
|
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
decal->x = trace.X;
|
DPrintf ("Decal actor at (%ld,%ld) does not have a good template\n", x>>FRACBITS, y>>FRACBITS);
|
||||||
decal->y = trace.Y;
|
|
||||||
decal->StickToWall (sides + trace.Line->sidenum[trace.Side]);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
// This actor doesn't need to stick around anymore.
|
||||||
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ struct Keygroup
|
||||||
|
|
||||||
bool check(AActor * owner)
|
bool check(AActor * owner)
|
||||||
{
|
{
|
||||||
for(size_t i=0;i<anykeylist.Size();i++)
|
for(unsigned int i=0;i<anykeylist.Size();i++)
|
||||||
{
|
{
|
||||||
if (anykeylist[i].check(owner)) return true;
|
if (anykeylist[i].check(owner)) return true;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ struct Lock
|
||||||
|
|
||||||
~Lock()
|
~Lock()
|
||||||
{
|
{
|
||||||
for(size_t i=0;i<keylist.Size();i++) delete keylist[i];
|
for(unsigned int i=0;i<keylist.Size();i++) delete keylist[i];
|
||||||
keylist.Clear();
|
keylist.Clear();
|
||||||
if (message) delete [] message;
|
if (message) delete [] message;
|
||||||
if (remotemsg) delete [] remotemsg;
|
if (remotemsg) delete [] remotemsg;
|
||||||
|
@ -71,7 +71,7 @@ struct Lock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else for(size_t i=0;i<keylist.Size();i++)
|
else for(unsigned int i=0;i<keylist.Size();i++)
|
||||||
{
|
{
|
||||||
if (!keylist[i]->check(owner)) return false;
|
if (!keylist[i]->check(owner)) return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,37 +55,37 @@ class DBaseDecal : public DThinker
|
||||||
DECLARE_CLASS (DBaseDecal, DThinker)
|
DECLARE_CLASS (DBaseDecal, DThinker)
|
||||||
public:
|
public:
|
||||||
DBaseDecal ();
|
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 AActor *actor);
|
||||||
DBaseDecal (const DBaseDecal *basis);
|
DBaseDecal (const DBaseDecal *basis);
|
||||||
|
|
||||||
void Serialize (FArchive &arc);
|
void Serialize (FArchive &arc);
|
||||||
void Destroy ();
|
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;
|
fixed_t GetRealZ (const side_s *wall) const;
|
||||||
void SetShade (DWORD rgb);
|
void SetShade (DWORD rgb);
|
||||||
void SetShade (int r, int g, int b);
|
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 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;
|
DBaseDecal *WallNext, **WallPrev;
|
||||||
|
|
||||||
fixed_t x, y, z;
|
fixed_t LeftDistance;
|
||||||
|
fixed_t Z;
|
||||||
|
fixed_t ScaleX, ScaleY;
|
||||||
|
fixed_t Alpha;
|
||||||
DWORD AlphaColor;
|
DWORD AlphaColor;
|
||||||
WORD Translation;
|
WORD Translation;
|
||||||
WORD PicNum;
|
WORD PicNum;
|
||||||
WORD RenderFlags;
|
WORD RenderFlags;
|
||||||
BYTE XScale, YScale;
|
|
||||||
BYTE RenderStyle;
|
BYTE RenderStyle;
|
||||||
fixed_t LeftDistance;
|
|
||||||
fixed_t Alpha;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual DBaseDecal *CloneSelf (const FDecalTemplate *tpl, fixed_t x, fixed_t y, fixed_t z, side_s *wall) const;
|
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 ();
|
void Remove ();
|
||||||
|
|
||||||
static void SpreadLeft (fixed_t r, vertex_s *v1, side_s *feelwall);
|
static void SpreadLeft (fixed_t r, vertex_s *v1, side_s *feelwall);
|
||||||
|
@ -96,7 +96,7 @@ class DImpactDecal : public DBaseDecal
|
||||||
{
|
{
|
||||||
DECLARE_CLASS (DImpactDecal, DBaseDecal)
|
DECLARE_CLASS (DImpactDecal, DBaseDecal)
|
||||||
public:
|
public:
|
||||||
DImpactDecal (fixed_t x, fixed_t y, fixed_t z);
|
DImpactDecal (fixed_t z);
|
||||||
DImpactDecal (side_s *wall, const FDecalTemplate *templ);
|
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);
|
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);
|
void Serialize (FArchive &arc);
|
||||||
static void SerializeTime (FArchive &arc);
|
static void SerializeTime (FArchive &arc);
|
||||||
|
|
||||||
DImpactDecal *ImpactNext, *ImpactPrev;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DBaseDecal *CloneSelf (const FDecalTemplate *tpl, fixed_t x, fixed_t y, fixed_t z, side_s *wall) const;
|
DBaseDecal *CloneSelf (const FDecalTemplate *tpl, fixed_t x, fixed_t y, fixed_t z, side_s *wall) const;
|
||||||
|
static void CheckMax ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DImpactDecal();
|
DImpactDecal();
|
||||||
void Link();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AWaterSplashBase : public AActor
|
class AWaterSplashBase : public AActor
|
||||||
|
|
|
@ -820,10 +820,6 @@ void DoMovePolyobj (polyobj_t *po, int x, int y)
|
||||||
linedef->bbox[BOXBOTTOM] += y;
|
linedef->bbox[BOXBOTTOM] += y;
|
||||||
linedef->bbox[BOXLEFT] += x;
|
linedef->bbox[BOXLEFT] += x;
|
||||||
linedef->bbox[BOXRIGHT] += 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;
|
linedef->validcount = validcount;
|
||||||
}
|
}
|
||||||
for (veryTempSeg = po->segs; veryTempSeg != segList; veryTempSeg++)
|
for (veryTempSeg = po->segs; veryTempSeg != segList; veryTempSeg++)
|
||||||
|
@ -908,12 +904,7 @@ BOOL PO_RotatePolyobj (int num, angle_t angle)
|
||||||
if ((*segList)->linedef->validcount != validcount)
|
if ((*segList)->linedef->validcount != validcount)
|
||||||
{
|
{
|
||||||
UpdateSegBBox(*segList);
|
UpdateSegBBox(*segList);
|
||||||
line_t *line = (*segList)->linedef;
|
(*segList)->linedef->validcount = validcount;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (blocked)
|
if (blocked)
|
||||||
|
@ -932,12 +923,7 @@ BOOL PO_RotatePolyobj (int num, angle_t angle)
|
||||||
if ((*segList)->linedef->validcount != validcount)
|
if ((*segList)->linedef->validcount != validcount)
|
||||||
{
|
{
|
||||||
UpdateSegBBox(*segList);
|
UpdateSegBBox(*segList);
|
||||||
line_t *line = (*segList)->linedef;
|
(*segList)->linedef->validcount = validcount;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LinkPolyobj(po);
|
LinkPolyobj(po);
|
||||||
|
|
|
@ -124,7 +124,7 @@ FTexture *rw_pic;
|
||||||
static short *maskedtexturecol;
|
static short *maskedtexturecol;
|
||||||
static FTexture *WallSpriteTile;
|
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));
|
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
|
// [RH] Draw any decals bound to the seg
|
||||||
for (DBaseDecal *decal = curline->sidedef->AttachedDecals; decal != NULL; decal = decal->WallNext)
|
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++;
|
ds_p++;
|
||||||
|
@ -1766,11 +1766,11 @@ void PrepLWall (fixed_t *lwall, fixed_t walxrepeat)
|
||||||
// = 1: drawing masked textures (including sprites)
|
// = 1: drawing masked textures (including sprites)
|
||||||
// Currently, only pass = 0 is done or used
|
// 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 x1, x2;
|
||||||
int xscale, yscale;
|
fixed_t xscale, yscale;
|
||||||
fixed_t topoff;
|
fixed_t topoff;
|
||||||
byte flipx;
|
byte flipx;
|
||||||
fixed_t zpos;
|
fixed_t zpos;
|
||||||
|
@ -1781,47 +1781,47 @@ static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Determine actor z
|
// Determine actor z
|
||||||
zpos = decal->z;
|
zpos = decal->Z;
|
||||||
front = curline->frontsector;
|
front = curline->frontsector;
|
||||||
back = (curline->backsector != NULL) ? curline->backsector : curline->frontsector;
|
back = (curline->backsector != NULL) ? curline->backsector : curline->frontsector;
|
||||||
switch (decal->RenderFlags & RF_RELMASK)
|
switch (decal->RenderFlags & RF_RELMASK)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
zpos = decal->z;
|
zpos = decal->Z;
|
||||||
break;
|
break;
|
||||||
case RF_RELUPPER:
|
case RF_RELUPPER:
|
||||||
if (curline->linedef->flags & ML_DONTPEGTOP)
|
if (curline->linedef->flags & ML_DONTPEGTOP)
|
||||||
{
|
{
|
||||||
zpos = decal->z + front->ceilingtexz;
|
zpos = decal->Z + front->ceilingtexz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zpos = decal->z + back->ceilingtexz;
|
zpos = decal->Z + back->ceilingtexz;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RF_RELLOWER:
|
case RF_RELLOWER:
|
||||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||||
{
|
{
|
||||||
zpos = decal->z + front->ceilingtexz;
|
zpos = decal->Z + front->ceilingtexz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zpos = decal->z + back->floortexz;
|
zpos = decal->Z + back->floortexz;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RF_RELMID:
|
case RF_RELMID:
|
||||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||||
{
|
{
|
||||||
zpos = decal->z + front->floortexz;
|
zpos = decal->Z + front->floortexz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zpos = decal->z + front->ceilingtexz;
|
zpos = decal->Z + front->ceilingtexz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xscale = decal->XScale + 1;
|
xscale = decal->ScaleX;
|
||||||
yscale = decal->YScale + 1;
|
yscale = decal->ScaleY;
|
||||||
|
|
||||||
WallSpriteTile = TexMan(decal->PicNum);
|
WallSpriteTile = TexMan(decal->PicNum);
|
||||||
flipx = decal->RenderFlags & RF_XFLIP;
|
flipx = decal->RenderFlags & RF_XFLIP;
|
||||||
|
@ -1842,11 +1842,13 @@ static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass)
|
||||||
x1 *= xscale;
|
x1 *= xscale;
|
||||||
x2 *= 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;
|
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;
|
lx = decalx - FixedMul (x1, finecosine[ang]) - viewx;
|
||||||
lx2 = decal->x + MulScale6 (x2, finecosine[ang]) - viewx;
|
lx2 = decalx + FixedMul (x2, finecosine[ang]) - viewx;
|
||||||
ly = decal->y - MulScale6 (x1, finesine[ang]) - viewy;
|
ly = decaly - FixedMul (x1, finesine[ang]) - viewy;
|
||||||
ly2 = decal->y + MulScale6 (x2, finesine[ang]) - viewy;
|
ly2 = decaly + FixedMul (x2, finesine[ang]) - viewy;
|
||||||
|
|
||||||
WallTX1 = DMulScale20 (lx, viewsin, -ly, viewcos);
|
WallTX1 = DMulScale20 (lx, viewsin, -ly, viewcos);
|
||||||
WallTX2 = DMulScale20 (lx2, viewsin, -ly2, 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;
|
topoff = WallSpriteTile->TopOffset << FRACBITS;
|
||||||
dc_texturemid = topoff + SafeDivScale6 (zpos - viewz, yscale);
|
dc_texturemid = topoff + FixedDiv (zpos - viewz, yscale);
|
||||||
|
|
||||||
// Scale the texture size
|
|
||||||
rw_scalestep = MulScale6 (rw_scalestep, yscale);
|
|
||||||
|
|
||||||
// Clip sprite to drawseg
|
// Clip sprite to drawseg
|
||||||
if (x1 < clipper->x1)
|
if (x1 < clipper->x1)
|
||||||
|
@ -2035,7 +2034,8 @@ static void R_RenderDecal (DBaseDecal *decal, drawseg_t *clipper, int pass)
|
||||||
sprflipvert = false;
|
sprflipvert = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rw_offset = 16*FRACUNIT/yscale;
|
// rw_offset is used as the texture's vertical scale
|
||||||
|
rw_offset = SafeDivScale30(1, yscale);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
|
@ -531,7 +531,7 @@ int S_DupPlayerSound (const char *pclass, int gender, int refid, int aliasref)
|
||||||
|
|
||||||
static void S_ClearSoundData()
|
static void S_ClearSoundData()
|
||||||
{
|
{
|
||||||
size_t i;
|
unsigned int i;
|
||||||
|
|
||||||
S_sfx.Clear();
|
S_sfx.Clear();
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ enum
|
||||||
{ // Thinkers that don't actually think
|
{ // Thinkers that don't actually think
|
||||||
STAT_INFO, // An info queue
|
STAT_INFO, // An info queue
|
||||||
STAT_DECAL, // A decal
|
STAT_DECAL, // A decal
|
||||||
|
STAT_AUTODECAL, // A decal that can be automatically deleted
|
||||||
STAT_CORPSEPOINTER, // An entry in Hexen's corpse queue
|
STAT_CORPSEPOINTER, // An entry in Hexen's corpse queue
|
||||||
STAT_TRAVELLING, // An actor temporarily travelling to a new map
|
STAT_TRAVELLING, // An actor temporarily travelling to a new map
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,8 @@ inline char * MS_Strdup(const char * s)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
// [RH] Keep GCC quiet by not using offsetof on Actor types.
|
// [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_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)&((type*)1)->variable - 1 }
|
#define DEFINE_FLAG2(symbol, name, type, variable) { symbol, #name, (int)(size_t)&((type*)1)->variable - 1 }
|
||||||
|
|
||||||
struct flagdef
|
struct flagdef
|
||||||
{
|
{
|
||||||
|
@ -3344,7 +3344,7 @@ static const ActorProps *is_actorprop (const char *str)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
void FinishThingdef()
|
void FinishThingdef()
|
||||||
{
|
{
|
||||||
size_t i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0;i < TypeInfo::m_RuntimeActors.Size(); i++)
|
for (i = 0;i < TypeInfo::m_RuntimeActors.Size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -558,7 +558,7 @@ void WI_LoadBackground(bool isenterpic)
|
||||||
|
|
||||||
void WI_updateAnimatedBack()
|
void WI_updateAnimatedBack()
|
||||||
{
|
{
|
||||||
size_t i;
|
unsigned int i;
|
||||||
|
|
||||||
for(i=0;i<anims.Size();i++)
|
for(i=0;i<anims.Size();i++)
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,7 @@ void WI_updateAnimatedBack()
|
||||||
|
|
||||||
void WI_drawBackground()
|
void WI_drawBackground()
|
||||||
{
|
{
|
||||||
size_t i;
|
unsigned int i;
|
||||||
int animwidth=320; // For a flat fill or clear background scale animations to 320x200
|
int animwidth=320; // For a flat fill or clear background scale animations to 320x200
|
||||||
int animheight=200;
|
int animheight=200;
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ void WI_drawEL ()
|
||||||
|
|
||||||
int WI_MapToIndex (char *map)
|
int WI_MapToIndex (char *map)
|
||||||
{
|
{
|
||||||
size_t i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < lnodes.Size(); i++)
|
for (i = 0; i < lnodes.Size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -1089,7 +1089,7 @@ void WI_updateShowNextLoc ()
|
||||||
|
|
||||||
void WI_drawShowNextLoc(void)
|
void WI_drawShowNextLoc(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
unsigned int i;
|
||||||
|
|
||||||
WI_drawBackground();
|
WI_drawBackground();
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ bool FCDThread::Init ()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CD_Window = CreateWindow (
|
CD_Window = CreateWindow (
|
||||||
(LPCTSTR)(int)CD_WindowAtom,
|
(LPCTSTR)(INT_PTR)(int)CD_WindowAtom,
|
||||||
"ZDoom CD Player",
|
"ZDoom CD Player",
|
||||||
0,
|
0,
|
||||||
0, 0, 10, 10,
|
0, 0, 10, 10,
|
||||||
|
@ -192,7 +192,7 @@ bool FCDThread::Init ()
|
||||||
|
|
||||||
if (CD_Window == NULL)
|
if (CD_Window == NULL)
|
||||||
{
|
{
|
||||||
UnregisterClass ((LPCTSTR)(int)CD_WindowAtom, g_hInst);
|
UnregisterClass ((LPCTSTR)(INT_PTR)(int)CD_WindowAtom, g_hInst);
|
||||||
CD_WindowAtom = 0;
|
CD_WindowAtom = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ void FCDThread::Deinit ()
|
||||||
}
|
}
|
||||||
if (CD_WindowAtom)
|
if (CD_WindowAtom)
|
||||||
{
|
{
|
||||||
UnregisterClass ((LPCTSTR)(int)CD_WindowAtom, g_hInst);
|
UnregisterClass ((LPCTSTR)(INT_PTR)(int)CD_WindowAtom, g_hInst);
|
||||||
CD_WindowAtom = 0;
|
CD_WindowAtom = 0;
|
||||||
}
|
}
|
||||||
if (DeviceID)
|
if (DeviceID)
|
||||||
|
|
Loading…
Reference in a new issue