- Ported GZDoom's deep water splash code so that splashes are handled properly

in Boom maps with non-swimmable water.
- Changed ENDOOM CVAR so that there is an option to show only modified versions.


SVN r444 (trunk)
This commit is contained in:
Christoph Oelckers 2007-01-07 09:43:58 +00:00
parent 6b1bf235fd
commit 4510ccf849
7 changed files with 62 additions and 23 deletions

View file

@ -1,3 +1,8 @@
January 7, 2007 (Changes by Graf Zahl)
- Ported GZDoom's deep water splash code so that splashes are handled properly
in Boom maps with non-swimmable water.
- Changed ENDOOM CVAR so that there is an option to show only modified versions.
January 6, 2007
- Added simulation of Strife's startup screen.
- Switched from a 14-pixel tall VGA font to a 16-pixel tall one for the

View file

@ -677,6 +677,7 @@ public:
AActor *inext, **iprev;// Links to other mobjs in same bucket
AActor *goal; // Monster's goal if not chasing anything
BYTE waterlevel; // 0=none, 1=feet, 2=waist, 3=eyes
BYTE boomwaterlevel; // splash information for non-swimmable water sectors
BYTE MinMissileChance;// [RH] If a random # is > than this, then missile attack.
WORD SpawnFlags;
fixed_t meleerange;
@ -748,7 +749,7 @@ public:
int GetTics(FState * newstate);
bool SetState (FState *newstate);
bool SetStateNF (FState *newstate);
bool UpdateWaterLevel (fixed_t oldz);
bool UpdateWaterLevel (fixed_t oldz, bool splash=true);
FState *FindState (FName label) const;
FState *FindState (FName label, FName sublabel, bool exact = false) const;

View file

@ -81,7 +81,7 @@
#include "m_menu.h"
EXTERN_CVAR(Bool, nomonsterinterpolation)
EXTERN_CVAR(Bool, showendoom)
EXTERN_CVAR(Int, showendoom)
//
// defaulted values
//
@ -498,6 +498,12 @@ static value_t Wipes[] = {
{ 3.0, "Crossfade" }
};
static value_t Endoom[] = {
{ 0.0, "Off" },
{ 1.0, "On" },
{ 2.0, "Only modified" }
};
static menuitem_t VideoItems[] = {
{ more, "Message Options", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)StartMessagesMenu} },
{ more, "Automap Options", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)StartAutomapMenu} },
@ -511,7 +517,7 @@ static menuitem_t VideoItems[] = {
{ discrete, "Stretch status bar", {&st_scale}, {2.0}, {0.0}, {0.0}, {OnOff} },
{ discrete, "Screen wipe style", {&wipetype}, {4.0}, {0.0}, {0.0}, {Wipes} },
#ifdef _WIN32
{ discrete, "Show ENDOOM screen", {&showendoom}, {2.0}, {0.0}, {0.0}, {OnOff} },
{ discrete, "Show ENDOOM screen", {&showendoom}, {3.0}, {0.0}, {0.0}, {Endoom} },
{ discrete, "DirectDraw palette hack", {&vid_palettehack}, {2.0}, {0.0}, {0.0}, {OnOff} },
{ discrete, "Use attached surfaces", {&vid_attachedsurfaces},{2.0}, {0.0}, {0.0}, {OnOff} },
#endif

View file

@ -307,7 +307,7 @@ void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile ver
void P_TraceBleed (int damage, AActor *target); // random direction version
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, FName puff = NAME_BulletPuff); // [RH] Shoot a railgun
bool P_HitFloor (AActor *thing);
bool P_HitWater (AActor *thing, sector_t *sec);
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashz=FIXED_MIN);
bool P_CheckMissileSpawn (AActor *missile);
void P_PlaySpawnSound(AActor *missile, AActor *spawner);

View file

@ -400,6 +400,7 @@ void AActor::Serialize (FArchive &arc)
PrevX = x;
PrevY = y;
PrevZ = z;
UpdateWaterLevel(z, false);
}
}
@ -2858,10 +2859,7 @@ void AActor::Tick ()
Crash();
}
if (UpdateWaterLevel (oldz))
{
P_HitWater (this, Sector);
}
UpdateWaterLevel (oldz);
// [RH] Don't advance if predicting a player
if (player && (player->cheats & CF_PREDICTING))
@ -2918,9 +2916,11 @@ void AActor::Tick ()
//
//==========================================================================
bool AActor::UpdateWaterLevel (fixed_t oldz)
bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
{
BYTE lastwaterlevel = waterlevel;
fixed_t fh=FIXED_MIN;
bool reset=false;
waterlevel = 0;
@ -2938,8 +2938,8 @@ bool AActor::UpdateWaterLevel (fixed_t oldz)
const sector_t *hsec = Sector->heightsec;
if (hsec != NULL && !(hsec->MoreFlags & SECF_IGNOREHEIGHTSEC))
{
fixed_t fh = hsec->floorplane.ZatPoint (x, y);
if (hsec->MoreFlags & SECF_UNDERWATERMASK)
fh = hsec->floorplane.ZatPoint (x, y);
//if (hsec->MoreFlags & SECF_UNDERWATERMASK) // also check Boom-style non-swimmable sectors!
{
if (z < fh)
{
@ -2958,15 +2958,24 @@ bool AActor::UpdateWaterLevel (fixed_t oldz)
{
waterlevel = 3;
}
else
{
waterlevel=0;
}
}
else
{
return (oldz >= fh) && (z < fh);
}
// even non-swimmable deep water must be checked here to do the splashes correctly
// But the water level must be reset when this function returns!
if (!(hsec->MoreFlags&SECF_UNDERWATER)) reset=true;
}
}
return (lastwaterlevel == 0 && waterlevel != 0);
// some additional checks to make deep sectors à la Boom splash without setting
// the water flags.
if (boomwaterlevel == 0 && waterlevel != 0 && dosplash) P_HitWater(this, Sector, fh);
boomwaterlevel=waterlevel;
if (reset) waterlevel=lastwaterlevel;
return false; // we did the splash ourselves! ;)
}
//----------------------------------------------------------------------------
@ -3156,7 +3165,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
{
actor->floorclip = 0;
}
actor->UpdateWaterLevel (actor->z);
actor->UpdateWaterLevel (actor->z, false);
if (!SpawningMapThing)
{
actor->BeginPlay ();
@ -4110,7 +4119,7 @@ int P_GetThingFloorType (AActor *thing)
// Returns true if hit liquid and splashed, false if not.
//---------------------------------------------------------------------------
bool P_HitWater (AActor *thing, sector_t *sec)
bool P_HitWater (AActor * thing, sector_t * sec, fixed_t z)
{
if (thing->flags2 & MF2_FLOATBOB || thing->flags3 & MF3_DONTSPLASH)
return false;
@ -4122,6 +4131,9 @@ bool P_HitWater (AActor *thing, sector_t *sec)
FSplashDef *splash;
int terrainnum;
if (z==FIXED_MIN) z=thing->z;
// don't splash above the object
else if (z>thing->z+(thing->height>>1)) return false;
if (sec->heightsec == NULL ||
//!sec->heightsec->waterzone ||
(sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) ||
@ -4137,16 +4149,21 @@ bool P_HitWater (AActor *thing, sector_t *sec)
int splashnum = Terrains[terrainnum].Splash;
bool smallsplash = false;
const secplane_t *plane;
fixed_t z;
if (splashnum == -1)
return Terrains[terrainnum].IsLiquid;
// don't splash when touching an underwater floor
if (thing->waterlevel>=1 && z<=thing->floorz) return Terrains[terrainnum].IsLiquid;
plane = (sec->heightsec != NULL &&
//sec->heightsec->waterzone &&
!(sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))
? &sec->heightsec->floorplane : &sec->floorplane;
z = plane->ZatPoint (thing->x, thing->y);
// Don't splash for living things with small vertical velocities.
// There are levels where the constant splashing from the monsters gets extremely annoying
if ((thing->flags3&MF3_ISMONSTER || thing->player) && thing->momz>=-5*FRACUNIT) return Terrains[terrainnum].IsLiquid;
splash = &Splashes[splashnum];

View file

@ -171,7 +171,11 @@ bool (*ST_NetLoop)(bool (*timer_callback)(void *), void *userdata);
BITMAPINFO *StartupBitmap;
CVAR(Bool, showendoom, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Int, showendoom, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self < 0) self = 0;
else if (self > 2) self=2;
}
// PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -966,10 +970,9 @@ static void ST_Strife_DrawStuff (int old_laser, int new_laser)
// Shows an ENDOOM text screen
//
//==========================================================================
void ST_Endoom()
{
if (!showendoom) exit(0);
if (showendoom == 0) exit(0);
int endoom_lump = Wads.CheckNumForName (
gameinfo.gametype == GAME_Doom? "ENDOOM" :
@ -985,6 +988,12 @@ void ST_Endoom()
exit(0);
}
if (Wads.GetLumpFile(endoom_lump) == FWadCollection::IWAD_FILENUM && showendoom == 2)
{
// showendoom==2 means to show only lumps from PWADs.
exit(0);
}
font = ST_Util_LoadFont (TEXT_FONT_NAME);
if (font == NULL)
{

View file

@ -3,6 +3,7 @@
actor GibbedMarine 10
{
Game Doom
SpawnID 145
States
{
Spawn: