summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Villareal2010-09-02 03:50:59 +0000
committerSamuel Villareal2010-09-02 03:50:59 +0000
commit415940729df099709b9ffc8bfdd3eb5a52b2823d (patch)
tree84ad205192e822a1683449fc207d12120b06d377 /src
parent87185424769c6c2dd8207f0b63dc787f98011496 (diff)
downloadchocolate-doom-415940729df099709b9ffc8bfdd3eb5a52b2823d.tar.gz
chocolate-doom-415940729df099709b9ffc8bfdd3eb5a52b2823d.tar.bz2
chocolate-doom-415940729df099709b9ffc8bfdd3eb5a52b2823d.zip
+ Thing z height clipping code added
+ Renamed MF_SKULLFLY to MF_BOUNCE + Updated P_ZMovement with Strife changes + Updates to PIT_CheckThing + Removed most references to MF_SKULLFLY Subversion-branch: /branches/strife-branch Subversion-revision: 1995
Diffstat (limited to 'src')
-rw-r--r--src/strife/p_enemy.c4
-rw-r--r--src/strife/p_inter.c10
-rw-r--r--src/strife/p_local.h1
-rw-r--r--src/strife/p_map.c94
-rw-r--r--src/strife/p_mobj.c90
-rw-r--r--src/strife/p_mobj.h5
6 files changed, 167 insertions, 37 deletions
diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index acae8479..09567e99 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -1454,7 +1454,7 @@ void A_FatAttack3 (mobj_t* actor)
void A_SkullAttack (mobj_t* actor)
{
- mobj_t* dest;
+/* mobj_t* dest;
angle_t an;
int dist;
@@ -1474,7 +1474,7 @@ void A_SkullAttack (mobj_t* actor)
if (dist < 1)
dist = 1;
- actor->momz = (dest->z+(dest->height>>1) - actor->z) / dist;
+ actor->momz = (dest->z+(dest->height>>1) - actor->z) / dist;*/
}
diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c
index 2258856e..ab94cd57 100644
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -682,7 +682,8 @@ P_KillMobj
mobjtype_t item;
mobj_t* mo;
- target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY);
+ // villsa [STRIFE] MF_SPECIAL is added in the check
+ target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_BOUNCE|MF_SPECIAL);
// villsa [STRIFE] unused
/*if (target->type != MT_SKULL)
@@ -808,10 +809,11 @@ P_DamageMobj
if (target->health <= 0)
return;
- if ( target->flags & MF_SKULLFLY )
+ // villsa [STRIFE] unused
+ /*if ( target->flags & MF_SKULLFLY )
{
target->momx = target->momy = target->momz = 0;
- }
+ }*/
player = target->player;
if (player && gameskill == sk_baby)
@@ -910,7 +912,7 @@ P_DamageMobj
}
if ( (P_Random () < target->info->painchance)
- && !(target->flags&MF_SKULLFLY) )
+ /*&& !(target->flags&MF_SKULLFLY)*/ ) // villsa [STRIFE] unused flag
{
target->flags |= MF_JUSTHIT; // fight back!
diff --git a/src/strife/p_local.h b/src/strife/p_local.h
index 3a6ef7aa..99cf755e 100644
--- a/src/strife/p_local.h
+++ b/src/strife/p_local.h
@@ -220,6 +220,7 @@ extern line_t* ceilingline;
boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
+boolean P_CheckPositionZ(mobj_t* thing, fixed_t z); // villsa [STRIFE]
boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
void P_SlideMove (mobj_t* mo);
boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
diff --git a/src/strife/p_map.c b/src/strife/p_map.c
index b581a32d..31366a36 100644
--- a/src/strife/p_map.c
+++ b/src/strife/p_map.c
@@ -312,9 +312,18 @@ boolean PIT_CheckThing (mobj_t* thing)
// don't clip against self
if (thing == tmthing)
return true;
+
+ // villsa [STRIFE] check thing z/height against tmthing's z
+ if(thing->height + thing->z < tmthing->z)
+ return true;
+
+ // villsa [STRIFE] check tmthing z/height against thing's z
+ if (tmthing->z + tmthing->height < thing->z)
+ return true;
+ // villsa [STRIFE] unused
// check for skulls slamming into things
- if (tmthing->flags & MF_SKULLFLY)
+ /*if (tmthing->flags & MF_SKULLFLY)
{
damage = ((P_Random()%8)+1)*tmthing->info->damage;
@@ -326,7 +335,7 @@ boolean PIT_CheckThing (mobj_t* thing)
P_SetMobjState (tmthing, tmthing->info->spawnstate);
return false; // stop moving
- }
+ }*/
// missiles can hit other things
@@ -378,11 +387,11 @@ boolean PIT_CheckThing (mobj_t* thing)
if (thing->flags & MF_SPECIAL)
{
solid = thing->flags&MF_SOLID;
- //if (tmflags&MF_PICKUP) // villsa [STRIFE] TODO - verify
- //{
+ if (tmthing->player) // villsa [STRIFE] no longer checks MF_PICKUP flag
+ {
// can remove thing
P_TouchSpecialThing (thing, tmthing);
- //}
+ }
return !solid;
}
@@ -563,6 +572,81 @@ P_TryMove
return true;
}
+//
+// P_CheckPositionZ
+// villsa [STRIFE] new function
+// Check colliding things on top of one another
+//
+
+boolean P_CheckPositionZ(mobj_t* thing, fixed_t height)
+{
+ fixed_t x;
+ fixed_t y;
+ fixed_t z;
+ int xl;
+ int xh;
+ int yl;
+ int yh;
+ int bx;
+ int by;
+ subsector_t* newsubsec;
+
+ x = thing->x;
+ y = thing->y;
+ z = thing->z;
+
+ thing->z = height;
+
+ tmthing = thing;
+ tmflags = thing->flags;
+ tmx = x;
+ tmy = y;
+
+ tmbbox[BOXTOP] = y + tmthing->radius;
+ tmbbox[BOXBOTTOM] = y - tmthing->radius;
+ tmbbox[BOXRIGHT] = x + tmthing->radius;
+ tmbbox[BOXLEFT] = x - tmthing->radius;
+
+ ceilingline = 0;
+ newsubsec = thing->subsector;
+
+ // The base floor / ceiling is from the subsector
+ // that contains the point.
+ // Any contacted lines the step closer together
+ // will adjust them.
+
+ tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
+ tmceilingz = newsubsec->sector->ceilingheight;
+
+ if(tmflags & MF_NOCLIP)
+ return true;
+
+ // Check things first, possibly picking things up.
+ // The bounding box is extended by MAXRADIUS
+ // because mobj_ts are grouped into mapblocks
+ // based on their origin point, and can overlap
+ // into adjacent blocks by up to MAXRADIUS units.
+
+ xl = (tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
+ xh = (tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
+ yl = (tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
+ yh = (tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
+
+ for(bx = xl; bx <= xh; bx++)
+ {
+ for(by = yl; by <= yh; by++)
+ {
+ if(!P_BlockThingsIterator(bx, by,PIT_CheckThing))
+ {
+ tmthing->z = z;
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
//
// P_ThingHeightClip
diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c
index 237d5142..8bb839c1 100644
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -95,10 +95,11 @@ void P_ExplodeMissile (mobj_t* mo)
P_SetMobjState (mo, mobjinfo[mo->type].deathstate);
- mo->tics -= P_Random()&3;
+ // villsa [STRIFE] unused
+ /*mo->tics -= P_Random()&3;
if (mo->tics < 1)
- mo->tics = 1;
+ mo->tics = 1;*/
mo->flags &= ~MF_MISSILE;
@@ -120,8 +121,9 @@ void P_XYMovement (mobj_t* mo)
player_t* player;
fixed_t xmove;
fixed_t ymove;
-
- if (!mo->momx && !mo->momy)
+
+ // villsa [STRIFE] unused
+ /*if (!mo->momx && !mo->momy)
{
if (mo->flags & MF_SKULLFLY)
{
@@ -132,7 +134,7 @@ void P_XYMovement (mobj_t* mo)
P_SetMobjState (mo, mo->info->spawnstate);
}
return;
- }
+ }*/
player = mo->player;
@@ -200,7 +202,7 @@ void P_XYMovement (mobj_t* mo)
return;
}
- if (mo->flags & (MF_MISSILE | MF_SKULLFLY) )
+ if (mo->flags & (MF_MISSILE | MF_BOUNCE) ) // villsa [STRIFE] replace skullfly flag with MF_BOUNCE
return; // no friction for missiles ever
if (mo->z > mo->floorz)
@@ -261,14 +263,24 @@ void P_ZMovement (mobj_t* mo)
}
// adjust height
- mo->z += mo->momz;
+ // villsa [STRIFE] check for things standing on top of other things
+ if(!P_CheckPositionZ(mo, mo->z + mo->momz))
+ {
+ if(mo->momz >= 0)
+ mo->ceilingz = mo->height + mo->z;
+ else
+ mo->floorz = mo->z;
+
+ }
+
+ //mo->z += mo->momz; // villsa [STRIFE] unused
if ( mo->flags & MF_FLOAT
&& mo->target)
{
// float down towards target if too close
- if ( !(mo->flags & MF_SKULLFLY)
- && !(mo->flags & MF_INFLOAT) )
+ if ( /*!(mo->flags & MF_SKULLFLY) // villsa [STRIFE] unused
+ &&*/ !(mo->flags & MF_INFLOAT) )
{
dist = P_AproxDistance (mo->x - mo->target->x,
mo->y - mo->target->y);
@@ -311,12 +323,19 @@ void P_ZMovement (mobj_t* mo)
// So we need to check that this is either retail or commercial
// (but not doom2)
- int correct_lost_soul_bounce = gameversion >= exe_ultimate;
+ //int correct_lost_soul_bounce = gameversion >= exe_ultimate;
- if (correct_lost_soul_bounce && mo->flags & MF_SKULLFLY)
+ if (/*correct_lost_soul_bounce &&*/ mo->flags & MF_BOUNCE)
{
// the skull slammed into something
- mo->momz = -mo->momz;
+ // villsa [STRIFE] affect reactiontime
+ // momz is also shifted by 1
+ mo->momz = -mo->momz >> 1;
+ mo->reactiontime >>= 1;
+
+ // villsa [STRIFE] get terrain type
+ if(P_GetTerrainType(mo) != FLOOR_SOLID)
+ mo->flags &= ~MF_FEETCLIPPED;
}
if (mo->momz < 0)
@@ -329,6 +348,14 @@ void P_ZMovement (mobj_t* mo)
// after hitting the ground (hard),
// and utter appropriate sound.
mo->player->deltaviewheight = mo->momz>>3;
+
+ // villsa [STRIFE] fall damage
+ if(mo->momz < -(20*FRACUNIT))
+ {
+ P_DamageMobj(mo, NULL, mo, (mo->momz >> 32) / -25000);
+ mo->player->centerview = 1;
+ }
+
S_StartSound (mo, sfx_oof);
}
mo->momz = 0;
@@ -342,13 +369,20 @@ void P_ZMovement (mobj_t* mo)
// hit by a raising floor this incorrectly reverses its Y momentum.
//
- if (!correct_lost_soul_bounce && mo->flags & MF_SKULLFLY)
- mo->momz = -mo->momz;
+ // villsa [STRIFE] unused
+ /*if (!correct_lost_soul_bounce && mo->flags & MF_SKULLFLY)
+ mo->momz = -mo->momz;*/
+ // villsa [STRIFE] also check for MF_BOUNCE
if ( (mo->flags & MF_MISSILE)
- && !(mo->flags & MF_NOCLIP) )
+ && !(mo->flags & (MF_NOCLIP|MF_BOUNCE)) )
{
- P_ExplodeMissile (mo);
+ // villsa [STRIFE] check against skies
+ if(mo->subsector->sector->ceilingpic == skyflatnum)
+ P_RemoveMobj(mo);
+ else
+ P_ExplodeMissile (mo);
+
return;
}
}
@@ -362,22 +396,32 @@ void P_ZMovement (mobj_t* mo)
if (mo->z + mo->height > mo->ceilingz)
{
+ // villsa [STRIFE] replace skullfly flag with MF_BOUNCE
+ if (mo->flags & MF_BOUNCE)
+ {
+ // villsa [STRIFE] affect reactiontime
+ // momz is also shifted by 1
+ mo->momz = -mo->momz >> 1;
+ mo->reactiontime >>= 1;
+ }
+
// hit the ceiling
if (mo->momz > 0)
mo->momz = 0;
{
mo->z = mo->ceilingz - mo->height;
}
-
- if (mo->flags & MF_SKULLFLY)
- { // the skull slammed into something
- mo->momz = -mo->momz;
- }
+ // villsa [STRIFE] also check for MF_BOUNCE
if ( (mo->flags & MF_MISSILE)
- && !(mo->flags & MF_NOCLIP) )
+ && !(mo->flags & (MF_NOCLIP|MF_BOUNCE)) )
{
- P_ExplodeMissile (mo);
+ // villsa [STRIFE] check against skies
+ if(mo->subsector->sector->ceilingpic == skyflatnum)
+ P_RemoveMobj(mo);
+ else
+ P_ExplodeMissile (mo);
+
return;
}
}
diff --git a/src/strife/p_mobj.h b/src/strife/p_mobj.h
index 50475f30..fcf963b2 100644
--- a/src/strife/p_mobj.h
+++ b/src/strife/p_mobj.h
@@ -203,9 +203,8 @@ typedef enum
// Not to be activated by sound, deaf monster.
MF_AMBUSH = 0x800000,
- // Special handling: skull in flight.
- // Neither a cacodemon nor a missile.
- MF_SKULLFLY = 0x1000000,
+ // villsa [STRIFE] flag used for bouncing projectiles
+ MF_BOUNCE = 0x1000000,
// Don't spawn this object
// in death match mode (e.g. key cards).