From 4510ccf8490f4ed462752e1866898d1cf4ee0af0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jan 2007 09:43:58 +0000 Subject: [PATCH] - 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) --- docs/rh-log.txt | 5 +++ src/actor.h | 3 +- src/m_options.cpp | 10 ++++-- src/p_local.h | 2 +- src/p_mobj.cpp | 49 +++++++++++++++++++---------- src/win32/st_start.cpp | 15 +++++++-- wadsrc/decorate/doom/deadthings.txt | 1 + 7 files changed, 62 insertions(+), 23 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 94ce9d96f8..0e4a55b774 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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 diff --git a/src/actor.h b/src/actor.h index 10a6794823..888d7b1828 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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; diff --git a/src/m_options.cpp b/src/m_options.cpp index 4723b8816a..2bdef69c4a 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -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 diff --git a/src/p_local.h b/src/p_local.h index ab675d8541..145e28ea34 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 6c1fc43077..29e408e39d 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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]; diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index 2cd0b1c9c8..7fc453a785 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -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) { diff --git a/wadsrc/decorate/doom/deadthings.txt b/wadsrc/decorate/doom/deadthings.txt index a1446a2f3c..8b285c09e2 100644 --- a/wadsrc/decorate/doom/deadthings.txt +++ b/wadsrc/decorate/doom/deadthings.txt @@ -3,6 +3,7 @@ actor GibbedMarine 10 { Game Doom + SpawnID 145 States { Spawn: