From 35552ce0cb82e919cab57331880dfe082260f697 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 25 Feb 2017 20:45:28 +0100 Subject: [PATCH] - added a Death.Sky state for missiles that gets used when they hit a sky plane. - fixed: The Alt HUD did not draw the crosshair in HUD off mode. --- src/d_main.cpp | 4 ++ src/g_shared/shared_hud.cpp | 4 -- src/namedef.h | 1 + src/p_local.h | 2 +- src/p_mobj.cpp | 70 +++++++++++++++++++++------------ wadsrc/static/zscript/actor.txt | 3 +- 6 files changed, 52 insertions(+), 32 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 02cbca73a..b430c7f04 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -810,6 +810,10 @@ void D_Display () { StatusBar->DrawBottomStuff (HUD_AltHud); if (DrawFSHUD || automapactive) DrawHUD(); + if (players[consoleplayer].camera && players[consoleplayer].camera->player) + { + StatusBar->DrawCrosshair(); + } StatusBar->Draw (HUD_AltHud); StatusBar->DrawTopStuff (HUD_AltHud); } diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index d39c16d88..7fea7b014 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -1136,10 +1136,6 @@ void DrawHUD() i=DrawAmmo(CPlayer, hudwidth-5, i); if (hud_showweapons) DrawWeapons(CPlayer, hudwidth - 5, i); DrawInventory(CPlayer, 144, hudheight-28); - if (CPlayer->camera && CPlayer->camera->player) - { - StatusBar->DrawCrosshair(); - } if (idmypos) DrawCoordinates(CPlayer); DrawTime(); diff --git a/src/namedef.h b/src/namedef.h index 105d29cdd..13e9096bc 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -654,6 +654,7 @@ xx(Goodbye) xx(Require) xx(Exclude) xx(Userstring) +xx(Sky) // Special menus xx(Mainmenu) diff --git a/src/p_local.h b/src/p_local.h index 89346328e..677de09fc 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -111,7 +111,7 @@ void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle); void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle); void P_RipperBlood (AActor *mo, AActor *bleeder); int P_GetThingFloorType (AActor *thing); -void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target); +void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target, bool onsky = false); AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassActor *type); AActor *P_SpawnMissile (AActor* source, AActor* dest, PClassActor *type, AActor* owner = NULL); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index fd0df678b..a908e115e 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1804,7 +1804,7 @@ bool AActor::Massacre () // //---------------------------------------------------------------------------- -void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) +void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target, bool onsky) { if (mo->flags3 & MF3_EXPLOCOUNT) { @@ -1832,11 +1832,15 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) } if (nextstate == NULL) nextstate = mo->FindState(NAME_Death); - if (line != NULL && line->special == Line_Horizon && !(mo->flags3 & MF3_SKYEXPLODE)) + if (onsky || (line != NULL && line->special == Line_Horizon)) { - // [RH] Don't explode missiles on horizon lines. - mo->Destroy (); - return; + if (!(mo->flags3 & MF3_SKYEXPLODE)) + { + // [RH] Don't explode missiles on horizon lines. + mo->Destroy(); + return; + } + nextstate = mo->FindState(NAME_Death, NAME_Sky); } if (line != NULL && cl_missiledecals) @@ -2557,26 +2561,32 @@ double P_XYMovement (AActor *mo, DVector2 scroll) } explode: // explode a missile - if (!(mo->flags3 & MF3_SKYEXPLODE)) - { + bool onsky = false; if (tm.ceilingline && tm.ceilingline->backsector && tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && mo->Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(mo->PosRelative(tm.ceilingline))) { - // Hack to prevent missiles exploding against the sky. - // Does not handle sky floors. - mo->Destroy (); - return Oldfloorz; + if (!(mo->flags3 & MF3_SKYEXPLODE)) + { + // Hack to prevent missiles exploding against the sky. + // Does not handle sky floors. + mo->Destroy(); + return Oldfloorz; + } + else onsky = true; } // [RH] Don't explode on horizon lines. if (mo->BlockingLine != NULL && mo->BlockingLine->special == Line_Horizon) { - mo->Destroy (); - return Oldfloorz; + if (!(mo->flags3 & MF3_SKYEXPLODE)) + { + mo->Destroy(); + return Oldfloorz; + } + else onsky = true; } - } - P_ExplodeMissile (mo, mo->BlockingLine, BlockingMobj); + P_ExplodeMissile (mo, mo->BlockingLine, BlockingMobj, onsky); return Oldfloorz; } else @@ -2955,15 +2965,20 @@ void P_ZMovement (AActor *mo, double oldfloorz) } else { - if (mo->floorpic == skyflatnum && !(mo->flags3 & MF3_SKYEXPLODE)) + bool onsky = false; + if (mo->floorpic == skyflatnum) { - // [RH] Just remove the missile without exploding it - // if this is a sky floor. - mo->Destroy (); - return; + if (!(mo->flags3 & MF3_SKYEXPLODE)) + { + // [RH] Just remove the missile without exploding it + // if this is a sky floor. + mo->Destroy(); + return; + } + else onsky = true; } P_HitFloor (mo); - P_ExplodeMissile (mo, NULL, NULL); + P_ExplodeMissile (mo, NULL, NULL, onsky); return; } } @@ -3056,12 +3071,17 @@ void P_ZMovement (AActor *mo, double oldfloorz) { return; } - if (mo->ceilingpic == skyflatnum && !(mo->flags3 & MF3_SKYEXPLODE)) + bool onsky = false; + if (mo->ceilingpic == skyflatnum) { - mo->Destroy (); - return; + if (!(mo->flags3 & MF3_SKYEXPLODE)) + { + mo->Destroy(); + return; + } + else onsky = true; } - P_ExplodeMissile (mo, NULL, NULL); + P_ExplodeMissile (mo, NULL, NULL, onsky); return; } } diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 815ffd479..2e9752b97 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -230,7 +230,6 @@ class Actor : Thinker native native deprecated double ScaleX; native deprecated double ScaleY; - //int ConversationRoot; // THe root of the current dialogue; //FStrifeDialogueNode *Conversation; // [RH] The dialogue to show when this actor is used.; @@ -368,7 +367,7 @@ class Actor : Thinker native native Vector3 PosRelative(sector sec); native void HandleSpawnFlags(); - native void ExplodeMissile(line lin = null, Actor target = null); + native void ExplodeMissile(line lin = null, Actor target = null, bool onsky = false); native void RestoreDamage(); native int SpawnHealth(); native void SetDamage(int dmg);