mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Added ThruBits.
This commit is contained in:
parent
69da5c23a3
commit
60f0d35477
5 changed files with 34 additions and 4 deletions
|
@ -1008,6 +1008,7 @@ public:
|
||||||
double FloatSpeed;
|
double FloatSpeed;
|
||||||
|
|
||||||
// interaction info
|
// interaction info
|
||||||
|
uint32_t ThruBits;
|
||||||
FBlockNode *BlockNode; // links in blocks (if needed)
|
FBlockNode *BlockNode; // links in blocks (if needed)
|
||||||
struct sector_t *Sector;
|
struct sector_t *Sector;
|
||||||
subsector_t * subsector;
|
subsector_t * subsector;
|
||||||
|
|
|
@ -447,11 +447,14 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi
|
||||||
if (th == thing)
|
if (th == thing)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double blockdist = th->radius + tmf.thing->radius;
|
if ((th->flags2 | tmf.thing->flags2) & MF2_THRUACTORS)
|
||||||
if (fabs(th->X() - cres2.Position.X) >= blockdist || fabs(th->Y() - cres2.Position.Y) >= blockdist)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((th->flags2 | tmf.thing->flags2) & MF2_THRUACTORS)
|
if (th->ThruBits & tmf.thing->ThruBits)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double blockdist = th->radius + tmf.thing->radius;
|
||||||
|
if (fabs(th->X() - cres2.Position.X) >= blockdist || fabs(th->Y() - cres2.Position.Y) >= blockdist)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (tmf.thing->flags6 & MF6_THRUSPECIES && tmf.thing->GetSpecies() == th->GetSpecies())
|
if (tmf.thing->flags6 & MF6_THRUSPECIES && tmf.thing->GetSpecies() == th->GetSpecies())
|
||||||
|
@ -1301,6 +1304,9 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
|
||||||
if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS)
|
if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (thing->ThruBits & tm.thing->ThruBits)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY))
|
if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY))
|
||||||
return true; // can't hit thing
|
return true; // can't hit thing
|
||||||
|
|
||||||
|
@ -1994,6 +2000,10 @@ int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (actor->ThruBits & thing->ThruBits)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ((actor->flags6 & MF6_THRUSPECIES) && (thing->GetSpecies() == actor->GetSpecies()))
|
if ((actor->flags6 & MF6_THRUSPECIES) && (thing->GetSpecies() == actor->GetSpecies()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -4382,6 +4392,8 @@ struct Origin
|
||||||
bool MThruSpecies;
|
bool MThruSpecies;
|
||||||
bool ThruSpecies;
|
bool ThruSpecies;
|
||||||
bool ThruActors;
|
bool ThruActors;
|
||||||
|
bool UseThruBits;
|
||||||
|
uint32_t ThruBits;
|
||||||
};
|
};
|
||||||
|
|
||||||
static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
|
static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
|
||||||
|
@ -4407,6 +4419,9 @@ static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
|
||||||
return TRACE_Skip;
|
return TRACE_Skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->UseThruBits && (data->ThruBits & res.Actor->ThruBits))
|
||||||
|
return TRACE_Skip;
|
||||||
|
|
||||||
return TRACE_Stop;
|
return TRACE_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4482,7 +4497,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
{
|
{
|
||||||
TData.ThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_THRUSPECIES));
|
TData.ThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_THRUSPECIES));
|
||||||
TData.ThruActors = (puffDefaults && (puffDefaults->flags2 & MF2_THRUACTORS));
|
TData.ThruActors = (puffDefaults && (puffDefaults->flags2 & MF2_THRUACTORS));
|
||||||
|
TData.UseThruBits = true;
|
||||||
// [MC] Because this is a one-hit trace event, we need to spawn the puff, get the species
|
// [MC] Because this is a one-hit trace event, we need to spawn the puff, get the species
|
||||||
// and destroy it. Assume there is no species unless tempuff isn't NULL. We cannot get
|
// and destroy it. Assume there is no species unless tempuff isn't NULL. We cannot get
|
||||||
// a proper species the same way as puffDefaults flags it appears...
|
// a proper species the same way as puffDefaults flags it appears...
|
||||||
|
@ -4493,6 +4508,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
if (tempuff != NULL)
|
if (tempuff != NULL)
|
||||||
{
|
{
|
||||||
TData.PuffSpecies = tempuff->GetSpecies();
|
TData.PuffSpecies = tempuff->GetSpecies();
|
||||||
|
TData.ThruBits = tempuff->ThruBits;
|
||||||
tempuff->Destroy();
|
tempuff->Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4500,6 +4516,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
{
|
{
|
||||||
TData.ThruSpecies = false;
|
TData.ThruSpecies = false;
|
||||||
TData.ThruActors = false;
|
TData.ThruActors = false;
|
||||||
|
TData.UseThruBits = false;
|
||||||
}
|
}
|
||||||
// if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type.
|
// if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type.
|
||||||
// All other explicitly passed damage types (currenty only MDK) will be preserved.
|
// All other explicitly passed damage types (currenty only MDK) will be preserved.
|
||||||
|
@ -5102,6 +5119,8 @@ struct RailData
|
||||||
bool ThruSpecies;
|
bool ThruSpecies;
|
||||||
bool MThruSpecies;
|
bool MThruSpecies;
|
||||||
bool ThruActors;
|
bool ThruActors;
|
||||||
|
bool UseThruBits;
|
||||||
|
uint32_t ThruBits;
|
||||||
int limit;
|
int limit;
|
||||||
int count;
|
int count;
|
||||||
};
|
};
|
||||||
|
@ -5131,6 +5150,7 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
||||||
// 4. THRUGHOST on puff and the GHOST flag on the hit actor
|
// 4. THRUGHOST on puff and the GHOST flag on the hit actor
|
||||||
|
|
||||||
if ((data->ThruActors) ||
|
if ((data->ThruActors) ||
|
||||||
|
(data->UseThruBits && (data->ThruBits & res.Actor->ThruBits)) ||
|
||||||
(data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) ||
|
(data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) ||
|
||||||
(data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) ||
|
(data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) ||
|
||||||
(data->ThruGhosts && res.Actor->flags3 & MF3_GHOST))
|
(data->ThruGhosts && res.Actor->flags3 & MF3_GHOST))
|
||||||
|
@ -5228,12 +5248,14 @@ void P_RailAttack(FRailParams *p)
|
||||||
rail_data.ThruGhosts = !!(puffDefaults->flags2 & MF2_THRUGHOST);
|
rail_data.ThruGhosts = !!(puffDefaults->flags2 & MF2_THRUGHOST);
|
||||||
rail_data.ThruSpecies = !!(puffDefaults->flags6 & MF6_THRUSPECIES);
|
rail_data.ThruSpecies = !!(puffDefaults->flags6 & MF6_THRUSPECIES);
|
||||||
rail_data.ThruActors = !!(puffDefaults->flags2 & MF2_THRUACTORS);
|
rail_data.ThruActors = !!(puffDefaults->flags2 & MF2_THRUACTORS);
|
||||||
|
rail_data.UseThruBits = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rail_data.ThruGhosts = false;
|
rail_data.ThruGhosts = false;
|
||||||
rail_data.MThruSpecies = false;
|
rail_data.MThruSpecies = false;
|
||||||
rail_data.ThruActors = false;
|
rail_data.ThruActors = false;
|
||||||
|
rail_data.UseThruBits = false;
|
||||||
}
|
}
|
||||||
// used as damage inflictor
|
// used as damage inflictor
|
||||||
AActor *thepuff = NULL;
|
AActor *thepuff = NULL;
|
||||||
|
@ -5241,6 +5263,9 @@ void P_RailAttack(FRailParams *p)
|
||||||
if (puffclass != NULL) thepuff = Spawn(source->Level, puffclass, source->Pos(), ALLOW_REPLACE);
|
if (puffclass != NULL) thepuff = Spawn(source->Level, puffclass, source->Pos(), ALLOW_REPLACE);
|
||||||
rail_data.PuffSpecies = (thepuff != NULL) ? thepuff->GetSpecies() : NAME_None;
|
rail_data.PuffSpecies = (thepuff != NULL) ? thepuff->GetSpecies() : NAME_None;
|
||||||
|
|
||||||
|
if (thepuff)
|
||||||
|
rail_data.ThruBits = thepuff->ThruBits;
|
||||||
|
|
||||||
Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data);
|
Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data);
|
||||||
|
|
||||||
// Hurt anything the trace hit
|
// Hurt anything the trace hit
|
||||||
|
|
|
@ -349,6 +349,7 @@ void AActor::Serialize(FSerializer &arc)
|
||||||
A("spriteangle", SpriteAngle)
|
A("spriteangle", SpriteAngle)
|
||||||
A("spriterotation", SpriteRotation)
|
A("spriterotation", SpriteRotation)
|
||||||
("alternative", alternative)
|
("alternative", alternative)
|
||||||
|
A("thrubits", ThruBits)
|
||||||
A("cameraheight", CameraHeight)
|
A("cameraheight", CameraHeight)
|
||||||
A("camerafov", CameraFOV)
|
A("camerafov", CameraFOV)
|
||||||
A("tag", Tag)
|
A("tag", Tag)
|
||||||
|
|
|
@ -1945,6 +1945,7 @@ DEFINE_FIELD(AActor, RenderRequired)
|
||||||
DEFINE_FIELD(AActor, friendlyseeblocks)
|
DEFINE_FIELD(AActor, friendlyseeblocks)
|
||||||
DEFINE_FIELD(AActor, SpawnTime)
|
DEFINE_FIELD(AActor, SpawnTime)
|
||||||
DEFINE_FIELD(AActor, InventoryID)
|
DEFINE_FIELD(AActor, InventoryID)
|
||||||
|
DEFINE_FIELD(AActor, ThruBits)
|
||||||
DEFINE_FIELD_NAMED(AActor, ViewAngles.Yaw, viewangle)
|
DEFINE_FIELD_NAMED(AActor, ViewAngles.Yaw, viewangle)
|
||||||
DEFINE_FIELD_NAMED(AActor, ViewAngles.Pitch, viewpitch)
|
DEFINE_FIELD_NAMED(AActor, ViewAngles.Pitch, viewpitch)
|
||||||
DEFINE_FIELD_NAMED(AActor, ViewAngles.Roll, viewroll)
|
DEFINE_FIELD_NAMED(AActor, ViewAngles.Roll, viewroll)
|
||||||
|
|
|
@ -90,6 +90,7 @@ class Actor : Thinker native
|
||||||
native PlayerInfo Player;
|
native PlayerInfo Player;
|
||||||
native readonly vector3 Pos;
|
native readonly vector3 Pos;
|
||||||
native vector3 Prev;
|
native vector3 Prev;
|
||||||
|
native uint ThruBits;
|
||||||
native vector2 SpriteOffset;
|
native vector2 SpriteOffset;
|
||||||
native double spriteAngle;
|
native double spriteAngle;
|
||||||
native double spriteRotation;
|
native double spriteRotation;
|
||||||
|
@ -337,6 +338,7 @@ class Actor : Thinker native
|
||||||
property RenderHidden: RenderHidden;
|
property RenderHidden: RenderHidden;
|
||||||
property RenderRequired: RenderRequired;
|
property RenderRequired: RenderRequired;
|
||||||
property FriendlySeeBlocks: FriendlySeeBlocks;
|
property FriendlySeeBlocks: FriendlySeeBlocks;
|
||||||
|
property ThruBits: ThruBits;
|
||||||
|
|
||||||
// need some definition work first
|
// need some definition work first
|
||||||
//FRenderStyle RenderStyle;
|
//FRenderStyle RenderStyle;
|
||||||
|
|
Loading…
Reference in a new issue