Skip to content

Commit

Permalink
Single commit - destructible geometry feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZYZX committed Oct 31, 2018
1 parent 952ffb2 commit 9592d41
Show file tree
Hide file tree
Showing 18 changed files with 898 additions and 57 deletions.
31 changes: 20 additions & 11 deletions specs/udmf_zdoom.txt
Expand Up @@ -141,6 +141,11 @@ Note: All <bool> fields default to false unless mentioned otherwise.
// 13: Portal line.
revealed = <bool>; // true = line is initially visible on automap.

health = <int>; // Amount of hitpoints for this line.
healthgroup = <int>; // ID of destructible object to synchronize hitpoints (optional, default is 0)
damagespecial = <bool>; // This line will call special if having health>0 and receiving damage
deathspecial = <bool>; // This line will call special if health was reduced to 0

* Note about arg0str

For lines with ACS specials (80-86 and 226), if arg0str is present and non-null, it
Expand Down Expand Up @@ -248,17 +253,21 @@ Note: All <bool> fields default to false unless mentioned otherwise.
color_sprites = <int>; // Material color of sprites in sector. Default is white (0xffffff)


portal_ceil_blocksound = <bool> // ceiling portal blocks sound.
portal_ceil_disabled = <bool> // ceiling portal disabled.
portal_ceil_nopass = <bool> // ceiling portal blocks movement if true.
portal_ceil_norender = <bool> // ceiling portal not rendered.
portal_ceil_overlaytype = <string> // defines translucency style, can either be "translucent" or "additive". Default is "translucent".
portal_floor_blocksound = <bool> // floor portal blocks sound.
portal_floor_disabled = <bool> // floor portal disabled.
portal_floor_nopass = <bool> // ceiling portal blocks movement if true.
portal_floor_norender = <bool> // ceiling portal not rendered.
portal_floor_overlaytype = <string> // defines translucency style, can either be "translucent" or "additive". Default is "translucent".

portal_ceil_blocksound = <bool>; // ceiling portal blocks sound.
portal_ceil_disabled = <bool>; // ceiling portal disabled.
portal_ceil_nopass = <bool>; // ceiling portal blocks movement if true.
portal_ceil_norender = <bool>; // ceiling portal not rendered.
portal_ceil_overlaytype = <string>; // defines translucency style, can either be "translucent" or "additive". Default is "translucent".
portal_floor_blocksound = <bool>; // floor portal blocks sound.
portal_floor_disabled = <bool>; // floor portal disabled.
portal_floor_nopass = <bool>; // ceiling portal blocks movement if true.
portal_floor_norender = <bool>; // ceiling portal not rendered.
portal_floor_overlaytype = <string>; // defines translucency style, can either be "translucent" or "additive". Default is "translucent".

healthfloor = <int>; // Amount of hitpoints for this sector (includes floor and bottom-outside linedef sides)
healthfloorgroup = <int>; // ID of destructible object to synchronize hitpoints (optional, default is 0)
healthceiling = <int>; // Amount of hitpoints for this sector (includes ceiling and top-outside linedef sides)
healthceilinggroup = <int>; // ID of destructible object to synchronize hitpoints (optional, default is 0)

* Note about dropactors

Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Expand Up @@ -956,6 +956,7 @@ set (PCH_SOURCES
p_actionfunctions.cpp
p_ceiling.cpp
p_conversation.cpp
p_destructible.cpp
p_doors.cpp
p_effect.cpp
p_enemy.cpp
Expand Down
2 changes: 2 additions & 0 deletions src/actionspecials.h
Expand Up @@ -152,6 +152,8 @@ DEFINE_SPECIAL(Sector_Set3DFloor, 160, -1, -1, 5)
DEFINE_SPECIAL(Sector_SetContents, 161, -1, -1, 3)

// [RH] Begin new specials for ZDoom
DEFINE_SPECIAL(Line_SetHealth, 150, 2, 2, 2)
DEFINE_SPECIAL(Sector_SetHealth, 151, 3, 3, 3)
DEFINE_SPECIAL(Ceiling_CrushAndRaiseDist, 168, 3, 5, 5)
DEFINE_SPECIAL(Generic_Crusher2, 169, 5, 5, 5)
DEFINE_SPECIAL(Sector_SetCeilingScale2, 170, 3, 3, 3)
Expand Down
2 changes: 2 additions & 0 deletions src/doomdata.h
Expand Up @@ -191,6 +191,8 @@ enum SPAC
SPAC_MUse = 1<<8, // monsters can use
SPAC_MPush = 1<<9, // monsters can push
SPAC_UseBack = 1<<10, // Can be used from the backside
SPAC_Damage = 1<<11, // [ZZ] when linedef receives damage
SPAC_Death = 1<<12, // [ZZ] when linedef receives damage and has 0 health

SPAC_PlayerActivate = (SPAC_Cross|SPAC_Use|SPAC_Impact|SPAC_Push|SPAC_AnyCross|SPAC_UseThrough|SPAC_UseBack),
};
Expand Down
5 changes: 5 additions & 0 deletions src/g_levellocals.h
Expand Up @@ -40,6 +40,8 @@
#include "r_defs.h"
#include "portal.h"
#include "p_blockmap.h"
#include "p_local.h"
#include "p_destructible.h"

struct FLevelLocals
{
Expand Down Expand Up @@ -96,6 +98,9 @@ struct FLevelLocals

TArray<zone_t> Zones;

// [ZZ] Destructible geometry information
TMap<int, FHealthGroup> healthGroups;

FBlockmap blockmap;

// These are copies of the loaded map data that get used by the savegame code to skip unaltered fields
Expand Down
8 changes: 8 additions & 0 deletions src/namedef.h
Expand Up @@ -668,6 +668,14 @@ xx(Prev)
xx(Children)
xx(Owner)

xx(HealthFloor)
xx(HealthCeiling)
xx(DamageSpecial)
xx(DeathSpecial)
xx(HealthFloorGroup)
xx(HealthCeilingGroup)
xx(HealthGroup)

// USDF keywords
xx(Amount)
xx(Text)
Expand Down
40 changes: 40 additions & 0 deletions src/p_acs.cpp
Expand Up @@ -4975,6 +4975,8 @@ enum EACSFunctions
ACSF_Ceil,
ACSF_ScriptCall,
ACSF_StartSlideshow,
ACSF_GetSectorHealth,
ACSF_GetLineHealth,

// Eternity's
ACSF_GetLineX = 300,
Expand Down Expand Up @@ -6841,6 +6843,44 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
G_StartSlideshow(FName(FBehavior::StaticLookupString(args[0])));
break;

case ACSF_GetSectorHealth:
{
int part = args[1];
FSectorTagIterator it(args[0]);
int s = it.Next();
if (s < 0)
return 0;
sector_t* ss = &level.sectors[s];
FHealthGroup* grp;
if (part == SECPART_Ceiling)
{
return (ss->healthceilinggroup && (grp = P_GetHealthGroup(ss->healthceilinggroup)))
? grp->health : ss->healthceiling;
}
else if (part == SECPART_Floor)
{
return (ss->healthfloorgroup && (grp = P_GetHealthGroup(ss->healthfloorgroup)))
? grp->health : ss->healthfloor;
}
return 0;
}

case ACSF_GetLineHealth:
{
FLineIdIterator it(args[0]);
int l = it.Next();
if (l < 0)
return 0;
line_t* ll = &level.lines[l];
if (ll->healthgroup > 0)
{
FHealthGroup* grp = P_GetHealthGroup(ll->healthgroup);
if (grp) return grp->health;
}

return ll->health;
}

case ACSF_GetLineX:
case ACSF_GetLineY:
{
Expand Down

0 comments on commit 9592d41

Please sign in to comment.