Skip to content
This repository has been archived by the owner on Dec 27, 2020. It is now read-only.

Commit

Permalink
- update to ZDoom r3205:
Browse files Browse the repository at this point in the history
    Fixed: The sign in Eternall.wad, map25 on line 2236 rendered at the wrong height because Doom ignored the Y locations of patches drawn on two-sided midtextures and always drew them at the top of the texture. Added a compatibility flag.
    Added FDARI's ACS savestring submission.
    Added optional fullthrustdistance to A_RadiusThrust to specify the distance at which thrust starts diminishing.
    Added r_shadercolormaps cvar. Set it to false to disable shaders for fixed colormap effects (e.g. invulnerability). This should only be necessary for SM1.4 cards with buggy drivers. I doubt the problem is very widespread. The one piece of SM1.4 hardware I obtained specifically for testing purposes has no problems using shaders for these effects.
    Added Gez's A_WolfAttack submission.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1213 b0f79afe-0144-0410-b225-9a4edf0717df
  • Loading branch information
Christoph Oelckers committed May 13, 2011
1 parent 84ef9ea commit da70509
Show file tree
Hide file tree
Showing 20 changed files with 277 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/compatibility.cpp
Expand Up @@ -120,6 +120,7 @@ static FCompatOption Options[] =
{ "hitscan", COMPATF_HITSCAN, 0 },
{ "lightlevel", COMPATF_LIGHT, 0 },
{ "polyobj", COMPATF_POLYOBJ, 0 },
{ "maskedmidtex", COMPATF_MASKEDMIDTEX, 0 },
{ NULL, 0, 0 }
};

Expand Down
3 changes: 2 additions & 1 deletion src/d_main.cpp
Expand Up @@ -546,7 +546,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT|COMPATF_SPRITESORT|
COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_NO_PASSMOBJ|COMPATF_LIMITPAIN|
COMPATF_DEHHEALTH|COMPATF_INVISIBILITY|COMPATF_CROSSDROPOFF|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|
COMPATF_WALLRUN|COMPATF_NOTOSSDROPS|COMPATF_LIGHT;
COMPATF_WALLRUN|COMPATF_NOTOSSDROPS|COMPATF_LIGHT|COMPATF_MASKEDMIDTEX;
break;

case 3: // Boom compat mode
Expand Down Expand Up @@ -602,6 +602,7 @@ CVAR (Flag, compat_spritesort, compatflags,COMPATF_SPRITESORT);
CVAR (Flag, compat_hitscan, compatflags,COMPATF_HITSCAN);
CVAR (Flag, compat_light, compatflags,COMPATF_LIGHT);
CVAR (Flag, compat_polyobj, compatflags,COMPATF_POLYOBJ);
CVAR (Flag, compat_maskedmidtex,compatflags,COMPATF_MASKEDMIDTEX);

//==========================================================================
//
Expand Down
1 change: 1 addition & 0 deletions src/doomdef.h
Expand Up @@ -332,6 +332,7 @@ enum
COMPATF_HITSCAN = 1 << 28, // Hitscans use original blockmap anf hit check code.
COMPATF_LIGHT = 1 << 29, // Find neighboring light level like Doom
COMPATF_POLYOBJ = 1 << 30, // Draw polyobjects the old fashioned way
COMPATF_MASKEDMIDTEX = 1 << 31, // Ignore compositing when drawing masked midtextures
};

// Emulate old bugs for select maps. These are not exposed by a cvar
Expand Down
1 change: 1 addition & 0 deletions src/g_mapinfo.cpp
Expand Up @@ -1271,6 +1271,7 @@ MapFlagHandlers[] =
{ "compat_spritesort", MITYPE_COMPATFLAG, COMPATF_SPRITESORT, 0 },
{ "compat_light", MITYPE_COMPATFLAG, COMPATF_LIGHT, 0 },
{ "compat_polyobj", MITYPE_COMPATFLAG, COMPATF_POLYOBJ, 0 },
{ "compat_maskedmidtex", MITYPE_COMPATFLAG, COMPATF_MASKEDMIDTEX, 0 },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },
Expand Down
11 changes: 10 additions & 1 deletion src/gl/scene/gl_walls.cpp
Expand Up @@ -1650,8 +1650,17 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)

/* mid texture */
bool drawfogboundary = gl_CheckFog(frontsector, backsector);
FTexture *tex = TexMan(seg->sidedef->GetTexture(side_t::mid));
if (tex != NULL)
{
if (i_compatflags & COMPATF_MASKEDMIDTEX)
{
tex = tex->GetRawTexture();
}
gltexture=FMaterial::ValidateTexture(tex);
}
else gltexture = NULL;

gltexture=FMaterial::ValidateTexture(seg->sidedef->GetTexture(side_t::mid), true);
if (gltexture || drawfogboundary)
{
DoMidTexture(seg, drawfogboundary, frontsector, backsector, realfront, realback,
Expand Down
58 changes: 57 additions & 1 deletion src/p_acs.cpp
Expand Up @@ -148,6 +148,22 @@ SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS];


//============================================================================
//
// On the fly strings
//
//============================================================================

#define LIB_ACSSTRINGS_ONTHEFLY 0x7fff
#define ACSSTRING_OR_ONTHEFLY (LIB_ACSSTRINGS_ONTHEFLY<<16)

TArray<FString>
ACS_StringsOnTheFly,
ACS_StringBuilderStack;

#define STRINGBUILDER_START(Builder) if (*Builder.GetChars() || ACS_StringBuilderStack.Size()) { ACS_StringBuilderStack.Push(Builder); Builder = ""; }
#define STRINGBUILDER_FINISH(Builder) if (!ACS_StringBuilderStack.Pop(Builder)) Builder = "";

//============================================================================
//
//
Expand Down Expand Up @@ -1738,6 +1754,14 @@ BYTE *FBehavior::NextChunk (BYTE *chunk) const
const char *FBehavior::StaticLookupString (DWORD index)
{
DWORD lib = index >> 16;

switch (lib)
{
case LIB_ACSSTRINGS_ONTHEFLY:
index &= 0xffff;
return (ACS_StringsOnTheFly.Size() > index) ? ACS_StringsOnTheFly[index].GetChars() : NULL;
}

if (lib >= (DWORD)StaticModules.Size())
{
return NULL;
Expand Down Expand Up @@ -1885,6 +1909,15 @@ void DACSThinker::Tick ()
script->RunScript ();
script = next;
}

ACS_StringsOnTheFly.Clear();

if (ACS_StringBuilderStack.Size())
{
int size = ACS_StringBuilderStack.Size();
ACS_StringBuilderStack.Clear();
I_Error("Error: %d garbage entries on ACS string builder stack.", size);
}
}

void DACSThinker::StopScriptsFor (AActor *actor)
Expand Down Expand Up @@ -4971,7 +5004,7 @@ int DLevelScript::RunScript ()
break;

case PCD_BEGINPRINT:
work = "";
STRINGBUILDER_START(work);
break;

case PCD_PRINTSTRING:
Expand Down Expand Up @@ -5145,6 +5178,7 @@ int DLevelScript::RunScript ()
if (pcd == PCD_ENDLOG)
{
Printf ("%s\n", work.GetChars());
STRINGBUILDER_FINISH(work);
}
else if (pcd != PCD_MOREHUDMESSAGE)
{
Expand All @@ -5163,6 +5197,7 @@ int DLevelScript::RunScript ()
{
C_MidPrint (activefont, work);
}
STRINGBUILDER_FINISH(work);
}
else
{
Expand Down Expand Up @@ -5260,6 +5295,7 @@ int DLevelScript::RunScript ()
}
}
}
STRINGBUILDER_FINISH(work);
sp = optstart-6;
break;

Expand Down Expand Up @@ -6677,6 +6713,23 @@ int DLevelScript::RunScript ()
sp -= 1;
}
break;

case PCD_SAVESTRING:
// Saves the string
{
unsigned int str_otf = ACS_StringsOnTheFly.Push(strbin1(work));
if (str_otf > 0xffff)
{
PushToStack(-1);
}
else
{
PushToStack((SDWORD)str_otf|ACSSTRING_OR_ONTHEFLY);
}
STRINGBUILDER_FINISH(work);
}
break;

}
}

Expand Down Expand Up @@ -6995,3 +7048,6 @@ void DACSThinker::DumpScriptStatus ()
script = script->next;
}
}

#undef STRINGBUILDER_START
#undef STRINGBUILDER_FINISH
3 changes: 2 additions & 1 deletion src/p_acs.h
Expand Up @@ -587,8 +587,9 @@ class DLevelScript : public DObject
PCD_PRINTBINARY,
/*350*/ PCD_PRINTHEX,
PCD_CALLFUNC,
PCD_SAVESTRING, // [FDARI]

/*351*/ PCODE_COMMAND_COUNT
/*353*/ PCODE_COMMAND_COUNT
};

// Some constants used by ACS scripts
Expand Down
2 changes: 1 addition & 1 deletion src/p_map.cpp
Expand Up @@ -4433,7 +4433,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b

if (!bombdodamage || !(bombspot->flags2 & MF2_NODMGTHRUST))
{
if (bombsource == NULL || !(bombsource->flags2 & MF2_NODMGTHRUST))
if (bombsource == NULL || !(bombsource->flags2 & MF2_NODMGTHRUST))
{
thrust = points * 0.5f / (double)thing->Mass;
if (bombsource == thing)
Expand Down
10 changes: 9 additions & 1 deletion src/r_main.cpp
Expand Up @@ -117,6 +117,7 @@ CVAR (String, r_viewsize, "", CVAR_NOSET)
CVAR (Int, r_polymost, 0, 0)
CVAR (Bool, r_deathcamera, false, CVAR_ARCHIVE)
CVAR (Int, r_clearbuffer, 0, 0)
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)

fixed_t r_BaseVisibility;
fixed_t r_WallVisibility;
Expand Down Expand Up @@ -1264,7 +1265,7 @@ void R_SetupFrame (AActor *actor)
if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size())
{
realfixedcolormap = &SpecialColormaps[player->fixedcolormap];
if (RenderTarget == screen && (DFrameBuffer *)screen->Accel2D)
if (RenderTarget == screen && (DFrameBuffer *)screen->Accel2D && r_shadercolormaps)
{
// Render everything fullbright. The copy to video memory will
// apply the special colormap, so it won't be restricted to the
Expand Down Expand Up @@ -1657,6 +1658,13 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
WallMirrors.Clear ();
interpolator.RestoreInterpolations ();
R_SetupBuffer ();

// If we don't want shadered colormaps, NULL it now so that the
// copy to the screen does not use a special colormap shader.
if (!r_shadercolormaps)
{
realfixedcolormap = NULL;
}
}

//==========================================================================
Expand Down
10 changes: 7 additions & 3 deletions src/r_segs.cpp
Expand Up @@ -240,6 +240,10 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
backsector = curline->backsector;

tex = TexMan(curline->sidedef->GetTexture(side_t::mid));
if (i_compatflags & COMPATF_MASKEDMIDTEX)
{
tex = tex->GetRawTexture();
}

// killough 4/13/98: get correct lightlevel for 2s normal textures
sec = R_FakeFlat (frontsector, &tempsec, NULL, NULL, false);
Expand Down Expand Up @@ -621,9 +625,9 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2)
if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorheight;
if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingheight;

// maybe not visible
if (sclipBottom >= frontsector->CenterCeiling()) return;
if (sclipTop <= frontsector->CenterFloor()) return;
// maybe not visible
if (sclipBottom >= frontsector->CenterCeiling()) return;
if (sclipTop <= frontsector->CenterFloor()) return;

if (fake3D & FAKE3D_DOWN2UP)
{ // bottom to viewz
Expand Down
11 changes: 9 additions & 2 deletions src/r_things.cpp
Expand Up @@ -68,7 +68,7 @@ extern fixed_t globaluclip, globaldclip;

EXTERN_CVAR (Bool, st_scale)
CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)

EXTERN_CVAR(Bool, r_shadercolormaps)

//
// Sprite rotation 0 is facing the viewer,
Expand Down Expand Up @@ -2288,7 +2288,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
// If not, then don't bother trying to identify it for
// hardware accelerated drawing.
if (vis->colormap < SpecialColormaps[0].Colormap ||
vis->colormap >= SpecialColormaps[SpecialColormaps.Size()].Colormap)
vis->colormap > SpecialColormaps.Last().Colormap)
{
noaccel = true;
}
Expand All @@ -2301,6 +2301,13 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
}
}
}
// If we're drawing with a special colormap, but shaders for them are disabled, do
// not accelerate.
if (!r_shadercolormaps && (vis->colormap >= SpecialColormaps[0].Colormap &&
vis->colormap <= SpecialColormaps.Last().Colormap))
{
noaccel = true;
}
// If the main colormap has fixed lights, and this sprite is being drawn with that
// colormap, disable acceleration so that the lights can remain fixed.
if (!noaccel &&
Expand Down
4 changes: 2 additions & 2 deletions src/svnrevision.h
Expand Up @@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.

#define ZD_SVN_REVISION_STRING "3198"
#define ZD_SVN_REVISION_NUMBER 3198
#define ZD_SVN_REVISION_STRING "3205"
#define ZD_SVN_REVISION_NUMBER 3205
27 changes: 23 additions & 4 deletions src/textures/multipatchtexture.cpp
Expand Up @@ -160,6 +160,8 @@ class FMultiPatchTexture : public FTexture

int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
int GetSourceLump() { return DefinitionLump; }
FTexture *GetRedirect(bool wantwarped);
FTexture *GetRawTexture();

protected:
BYTE *Pixels;
Expand All @@ -185,7 +187,6 @@ class FMultiPatchTexture : public FTexture
bool bTranslucentPatches:1;

void MakeTexture ();
FTexture *GetRedirect(bool wantwarped);

private:
void CheckForHacks ();
Expand Down Expand Up @@ -766,14 +767,32 @@ void FMultiPatchTexture::CheckForHacks ()

//==========================================================================
//
// FMultiPatchTexture :: TexPart :: TexPart
// FMultiPatchTexture :: GetRedirect
//
//==========================================================================

FTexture *FMultiPatchTexture::GetRedirect(bool wantwarped)
{
if (bRedirect) return Parts->Texture;
else return this;
return bRedirect ? Parts->Texture : this;
}

//==========================================================================
//
// FMultiPatchTexture :: GetRawTexture
//
// Doom ignored all compositing of mid-sided textures on two-sided lines.
// Since these textures had to be single-patch in Doom, that essentially
// means it ignores their Y offsets.
//
// If this texture is composed of only one patch, return that patch.
// Otherwise, return this texture, since Doom wouldn't have been able to
// draw it anyway.
//
//==========================================================================

FTexture *FMultiPatchTexture::GetRawTexture()
{
return NumParts == 1 ? Parts->Texture : this;
}

//==========================================================================
Expand Down
5 changes: 5 additions & 0 deletions src/textures/texture.cpp
Expand Up @@ -547,6 +547,11 @@ FTexture *FTexture::GetRedirect(bool wantwarped)
return this;
}

FTexture *FTexture::GetRawTexture()
{
return this;
}

void FTexture::SetScaledSize(int fitwidth, int fitheight)
{
xScale = FLOAT2FIXED(float(Width) / fitwidth);
Expand Down
1 change: 1 addition & 0 deletions src/textures/textures.h
Expand Up @@ -238,6 +238,7 @@ class FTexture
virtual bool UseBasePalette();
virtual int GetSourceLump() { return SourceLump; }
virtual FTexture *GetRedirect(bool wantwarped);
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
FTextureID GetID() const { return id; }

virtual void Unload () = 0;
Expand Down

0 comments on commit da70509

Please sign in to comment.