mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 19:02:45 +00:00
Okay, did a bunch of stuff. Getting ready to create a merge request, but not quite there yet.
* MF_AMBUSH is now MF2_AMBUSH, because it's something you turn on in a map editor, not with a SOC definition. * Where MF_AMBUSH was is now MF_PAPER. * MF_PAPER accesses all the stuff I did previously in this branch... * ...as well as turn on paper-thin collision detection between mobjs, which I've gotten working but isn't perfect but it's still good enough for non-solid objects!!
This commit is contained in:
parent
430d7cfbd2
commit
7786ef43e8
9 changed files with 99 additions and 38 deletions
|
@ -6691,7 +6691,7 @@ static const char *const MOBJFLAG_LIST[] = {
|
|||
"SHOOTABLE",
|
||||
"NOSECTOR",
|
||||
"NOBLOCKMAP",
|
||||
"AMBUSH",
|
||||
"PAPER",
|
||||
"PUSHABLE",
|
||||
"BOSS",
|
||||
"SPAWNCEILING",
|
||||
|
@ -6748,6 +6748,7 @@ static const char *const MOBJFLAG2_LIST[] = {
|
|||
"BOSSNOTRAP", // No Egg Trap after boss
|
||||
"BOSSFLEE", // Boss is fleeing!
|
||||
"BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
|
||||
"AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -1054,7 +1054,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
if (!OP_HeightOkay(player, false))
|
||||
return;
|
||||
|
||||
if (player->mo->target->flags & MF_AMBUSH)
|
||||
if (player->mo->target->flags2 & MF2_AMBUSH)
|
||||
angle = (UINT16)player->anotherflyangle;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2625,7 +2625,7 @@ for (i = cvar.value; i; --i) spawnchance[numchoices++] = type
|
|||
newbox = spawnchance[P_RandomKey(numchoices)];
|
||||
item = mobjinfo[newbox].damage;
|
||||
|
||||
remains->flags &= ~MF_AMBUSH;
|
||||
remains->flags2 &= ~MF2_AMBUSH;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -3444,7 +3444,7 @@ void A_BubbleSpawn(mobj_t *actor)
|
|||
}
|
||||
actor->flags2 &= ~MF2_DONTDRAW;
|
||||
|
||||
if (!(actor->flags & MF_AMBUSH))
|
||||
if (!(actor->flags2 & MF2_AMBUSH))
|
||||
{
|
||||
// Quick! Look through players!
|
||||
// Don't spawn bubbles unless a player is relatively close by (var2).
|
||||
|
@ -3492,7 +3492,7 @@ void A_FanBubbleSpawn(mobj_t *actor)
|
|||
if (!(actor->eflags & MFE_UNDERWATER))
|
||||
return;
|
||||
|
||||
if (!(actor->flags & MF_AMBUSH))
|
||||
if (!(actor->flags2 & MF2_AMBUSH))
|
||||
{
|
||||
// Quick! Look through players!
|
||||
// Don't spawn bubbles unless a player is relatively close by (var2).
|
||||
|
@ -4038,7 +4038,7 @@ void A_JetChase(mobj_t *actor)
|
|||
return;
|
||||
#endif
|
||||
|
||||
if (actor->flags & MF_AMBUSH)
|
||||
if (actor->flags2 & MF2_AMBUSH)
|
||||
return;
|
||||
|
||||
if (actor->z >= actor->waterbottom && actor->watertop > actor->floorz
|
||||
|
@ -4931,7 +4931,7 @@ void A_SlingAppear(mobj_t *actor)
|
|||
if (firsttime)
|
||||
{
|
||||
// This is the outermost link in the chain
|
||||
spawnee->flags |= MF_AMBUSH;
|
||||
spawnee->flags2 |= MF2_AMBUSH;
|
||||
firsttime = false;
|
||||
}
|
||||
|
||||
|
@ -5916,7 +5916,7 @@ void A_Boss2Chase(mobj_t *actor)
|
|||
{
|
||||
actor->watertop = -actor->watertop;
|
||||
actor->extravalue1 = 18;
|
||||
if (actor->flags & MF_AMBUSH)
|
||||
if (actor->flags2 & MF2_AMBUSH)
|
||||
actor->extravalue1 -= (actor->info->spawnhealth - actor->health)*2;
|
||||
actor->extravalue2 = actor->extravalue1;
|
||||
}
|
||||
|
@ -5942,7 +5942,7 @@ void A_Boss2Chase(mobj_t *actor)
|
|||
else
|
||||
{
|
||||
// Only speed up if you have the 'Deaf' flag.
|
||||
if (actor->flags & MF_AMBUSH)
|
||||
if (actor->flags2 & MF2_AMBUSH)
|
||||
speedvar = actor->health;
|
||||
else
|
||||
speedvar = actor->info->spawnhealth;
|
||||
|
@ -6533,7 +6533,7 @@ void A_BuzzFly(mobj_t *actor)
|
|||
if (LUA_CallAction("A_BuzzFly", actor))
|
||||
return;
|
||||
#endif
|
||||
if (actor->flags & MF_AMBUSH)
|
||||
if (actor->flags2 & MF2_AMBUSH)
|
||||
return;
|
||||
|
||||
if (actor->reactiontime)
|
||||
|
@ -6673,7 +6673,7 @@ void A_GuardChase(mobj_t *actor)
|
|||
return; // got a new target
|
||||
|
||||
// chase towards player
|
||||
if (--actor->movecount < 0 || !P_Move(actor, (actor->flags & MF_AMBUSH) ? actor->info->speed * 2 : actor->info->speed))
|
||||
if (--actor->movecount < 0 || !P_Move(actor, (actor->flags2 & MF2_AMBUSH) ? actor->info->speed * 2 : actor->info->speed))
|
||||
{
|
||||
P_NewChaseDir(actor);
|
||||
actor->movecount += 5; // Increase tics before change in direction allowed.
|
||||
|
|
|
@ -1327,7 +1327,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
case MT_SMALLMACECHAIN:
|
||||
case MT_BIGMACECHAIN:
|
||||
// Is this the last link in the chain?
|
||||
if (toucher->momz > 0 || !(special->flags & MF_AMBUSH)
|
||||
if (toucher->momz > 0 || !(special->flags2 & MF2_AMBUSH)
|
||||
|| (player->pflags & PF_ITEMHANG) || (player->pflags & PF_MACESPIN))
|
||||
return;
|
||||
|
||||
|
|
64
src/p_map.c
64
src/p_map.c
|
@ -498,6 +498,70 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
|
||||
return true; // didn't hit it
|
||||
|
||||
if (thing->flags & MF_PAPER)
|
||||
{
|
||||
fixed_t cosradius, sinradius;
|
||||
vertex_t v1, v2; // fake vertexes
|
||||
line_t junk; // fake linedef
|
||||
|
||||
cosradius = FixedMul(thing->radius, FINECOSINE(thing->angle>>ANGLETOFINESHIFT));
|
||||
sinradius = FixedMul(thing->radius, FINESINE(thing->angle>>ANGLETOFINESHIFT));
|
||||
|
||||
v1.x = thing->x - cosradius;
|
||||
v1.y = thing->y - sinradius;
|
||||
v2.x = thing->x + cosradius;
|
||||
v2.y = thing->y + sinradius;
|
||||
|
||||
junk.v1 = &v1;
|
||||
junk.v2 = &v2;
|
||||
junk.dx = v2.x - v1.x;
|
||||
junk.dy = v2.y - v1.y;
|
||||
|
||||
if (tmthing->flags & MF_PAPER)
|
||||
{
|
||||
cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT));
|
||||
sinradius = FixedMul(tmthing->radius, FINESINE(tmthing->angle>>ANGLETOFINESHIFT));
|
||||
if (P_PointOnLineSide(tmx - cosradius, tmy - sinradius, &junk)
|
||||
== P_PointOnLineSide(tmx + cosradius, tmy + sinradius, &junk))
|
||||
return true; // the line doesn't cross between collider's start or end
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((P_PointOnLineSide(tmx - tmthing->radius, tmy - tmthing->radius, &junk)
|
||||
== P_PointOnLineSide(tmx + tmthing->radius, tmy + tmthing->radius, &junk))
|
||||
&& (P_PointOnLineSide(tmx + tmthing->radius, tmy - tmthing->radius, &junk)
|
||||
== P_PointOnLineSide(tmx - tmthing->radius, tmy + tmthing->radius, &junk)))
|
||||
return true; // the line doesn't cross between either pair of opposite corners
|
||||
}
|
||||
}
|
||||
else if (tmthing->flags & MF_PAPER)
|
||||
{
|
||||
fixed_t cosradius, sinradius;
|
||||
vertex_t v1, v2; // fake vertexes
|
||||
line_t junk; // fake linedef
|
||||
|
||||
cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT));
|
||||
sinradius = FixedMul(tmthing->radius, FINESINE(tmthing->angle>>ANGLETOFINESHIFT));
|
||||
|
||||
v1.x = tmx - cosradius;
|
||||
v1.y = tmy - sinradius;
|
||||
v2.x = tmx + cosradius;
|
||||
v2.y = tmy + sinradius;
|
||||
|
||||
junk.v1 = &v1;
|
||||
junk.v2 = &v2;
|
||||
junk.dx = v2.x - v1.x;
|
||||
junk.dy = v2.y - v1.y;
|
||||
|
||||
// no need to check whether thing has MF_PAPER, since checked above
|
||||
|
||||
if ((P_PointOnLineSide(thing->x - thing->radius, thing->y - thing->radius, &junk)
|
||||
== P_PointOnLineSide(thing->x + thing->radius, thing->y + thing->radius, &junk))
|
||||
&& (P_PointOnLineSide(thing->x + thing->radius, thing->y - thing->radius, &junk)
|
||||
== P_PointOnLineSide(thing->x - thing->radius, thing->y + thing->radius, &junk)))
|
||||
return true; // the line doesn't cross between either pair of opposite corners
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
|
||||
|
|
30
src/p_mobj.c
30
src/p_mobj.c
|
@ -2653,7 +2653,7 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
&& abs(mom.y) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(mom.z) < FixedMul(STOPSPEED*3, mo->scale))
|
||||
{
|
||||
if (mo->flags & MF_AMBUSH)
|
||||
if (mo->flags2 & MF2_AMBUSH)
|
||||
{
|
||||
// If deafed, give the tumbleweed another random kick if it runs out of steam.
|
||||
mom.z += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale);
|
||||
|
@ -6582,7 +6582,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
|
||||
flame->angle = mobj->angle;
|
||||
|
||||
if (mobj->flags & MF_AMBUSH) // Wave up and down instead of side-to-side
|
||||
if (mobj->flags2 & MF2_AMBUSH) // Wave up and down instead of side-to-side
|
||||
flame->momz = mobj->fuse << (FRACBITS-2);
|
||||
else
|
||||
flame->angle += FixedAngle(mobj->fuse*FRACUNIT);
|
||||
|
@ -6617,7 +6617,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
strength -= ((20*FRACUNIT)/16)*mobj->movedir;
|
||||
|
||||
// If deaf'd, the object spawns on the ceiling.
|
||||
if (mobj->flags & MF_AMBUSH)
|
||||
if (mobj->flags2 & MF2_AMBUSH)
|
||||
{
|
||||
mobj->z = mobj->ceilingz-mobj->height;
|
||||
flame->momz = -strength;
|
||||
|
@ -7473,7 +7473,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
case MT_EGGMANBOX: // Eggman box
|
||||
case MT_GRAVITYBOX: // Gravity box
|
||||
case MT_QUESTIONBOX:
|
||||
if ((mobj->flags & MF_AMBUSH || mobj->flags2 & MF2_STRONGBOX) && mobj->type != MT_QUESTIONBOX)
|
||||
if ((mobj->flags2 & (MF2_AMBUSH|MF2_STRONGBOX)) && mobj->type != MT_QUESTIONBOX)
|
||||
{
|
||||
mobjtype_t spawnchance[64];
|
||||
INT32 numchoices = 0, i = 0;
|
||||
|
@ -7501,11 +7501,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
|
|||
i = P_RandomKey(numchoices); // Gotta love those random numbers!
|
||||
newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, spawnchance[i]);
|
||||
|
||||
// If the monitor respawns randomly, transfer the flag.
|
||||
if (mobj->flags & MF_AMBUSH)
|
||||
newmobj->flags |= MF_AMBUSH;
|
||||
|
||||
// Transfer flags2 (strongbox, objectflip)
|
||||
// Transfer flags2 (strongbox, objectflip, ambush)
|
||||
newmobj->flags2 = mobj->flags2;
|
||||
}
|
||||
else
|
||||
|
@ -9322,7 +9318,7 @@ ML_NOCLIMB : Direction not controllable
|
|||
if (firsttime)
|
||||
{
|
||||
// This is the outermost link in the chain
|
||||
spawnee->flags |= MF_AMBUSH;
|
||||
spawnee->flags2 |= MF2_AMBUSH;
|
||||
firsttime = false;
|
||||
}
|
||||
|
||||
|
@ -9394,7 +9390,7 @@ ML_NOCLIMB : Direction not controllable
|
|||
{
|
||||
// Inverted if uppermost bit is set
|
||||
if (mthing->angle & 16384)
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
|
||||
if (mthing->angle > 0)
|
||||
mobj->radius = (mthing->angle & 16383)*FRACUNIT;
|
||||
|
@ -9571,7 +9567,7 @@ ML_NOCLIMB : Direction not controllable
|
|||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum)
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
else if (mthing->type != mobjinfo[MT_AXIS].doomednum &&
|
||||
|
@ -9579,7 +9575,7 @@ ML_NOCLIMB : Direction not controllable
|
|||
mthing->type != mobjinfo[MT_AXISTRANSFERLINE].doomednum &&
|
||||
mthing->type != mobjinfo[MT_NIGHTSBUMPER].doomednum &&
|
||||
mthing->type != mobjinfo[MT_STARPOST].doomednum)
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
if (mthing->options & MTF_OBJECTSPECIAL)
|
||||
|
@ -9918,7 +9914,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
P_SetMobjState(mobj, mobj->info->seestate);
|
||||
|
||||
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
mthing->mobj = mobj;
|
||||
}
|
||||
// All manners of rings and coins
|
||||
|
@ -9992,7 +9988,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
}
|
||||
|
||||
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
mthing->mobj = mobj;
|
||||
}
|
||||
// ***
|
||||
|
@ -10048,7 +10044,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
|
||||
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||
if (mthing->options & MTF_AMBUSH)
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
}
|
||||
// Diagonal rings (handles both types)
|
||||
|
@ -10106,7 +10102,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
|
||||
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||
if (mthing->options & MTF_AMBUSH)
|
||||
mobj->flags |= MF_AMBUSH;
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
}
|
||||
// Rings of items (all six of them)
|
||||
|
|
|
@ -107,8 +107,8 @@ typedef enum
|
|||
MF_NOSECTOR = 1<<3,
|
||||
// Don't use the blocklinks (inert but displayable)
|
||||
MF_NOBLOCKMAP = 1<<4,
|
||||
// Not to be activated by sound, deaf monster.
|
||||
MF_AMBUSH = 1<<5,
|
||||
// Paper-thin. Drawn like a midtexture, has a flat collision bound.
|
||||
MF_PAPER = 1<<5,
|
||||
// You can push this object. It can activate switches and things by pushing it on top.
|
||||
MF_PUSHABLE = 1<<6,
|
||||
// Object is a boss.
|
||||
|
@ -151,10 +151,9 @@ typedef enum
|
|||
MF_PAIN = 1<<24,
|
||||
// This mobj will stick to any surface or solid object it touches.
|
||||
MF_STICKY = 1<<25,
|
||||
// NiGHTS hidden item. Goes to seestate and turns MF_SPECIAL when paralooped.
|
||||
// NiGHTS hidden item. Goes to seestate and turns MF_SPECIAL when paralooped.
|
||||
MF_NIGHTSITEM = 1<<26,
|
||||
// for chase camera, don't be blocked by things (partial clipping)
|
||||
// (need comma at end of this for SOC editor)
|
||||
MF_NOCLIPTHING = 1<<27,
|
||||
// Missile bounces like a grenade.
|
||||
MF_GRENADEBOUNCE = 1<<28,
|
||||
|
@ -192,6 +191,7 @@ typedef enum
|
|||
MF2_BOSSNOTRAP = 1<<24, // No Egg Trap after boss
|
||||
MF2_BOSSFLEE = 1<<25, // Boss is fleeing!
|
||||
MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.)
|
||||
MF2_AMBUSH = 1<<27, // Alternate behaviour typically set by MTF_AMBUSH
|
||||
// free: to and including 1<<31
|
||||
} mobjflag2_t;
|
||||
|
||||
|
|
|
@ -629,7 +629,7 @@ static void P_DeNightserizePlayer(player_t *player)
|
|||
if (!(mo2->type == MT_NIGHTSDRONE))
|
||||
continue;
|
||||
|
||||
if (mo2->flags & MF_AMBUSH)
|
||||
if (mo2->flags2 & MF2_AMBUSH)
|
||||
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_INSTAKILL);
|
||||
|
||||
break;
|
||||
|
@ -4964,7 +4964,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
|||
boolean transfer1last = false;
|
||||
boolean transfer2last = false;
|
||||
vertex_t vertices[4];
|
||||
fixed_t truexspeed = xspeed*(!(player->pflags & PF_TRANSFERTOCLOSEST) && player->mo->target->flags & MF_AMBUSH ? -1 : 1);
|
||||
fixed_t truexspeed = xspeed*(!(player->pflags & PF_TRANSFERTOCLOSEST) && player->mo->target->flags2 & MF2_AMBUSH ? -1 : 1);
|
||||
|
||||
// Find next waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
|
@ -5629,7 +5629,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
|
||||
// The 'ambush' flag says you should rotate
|
||||
// the other way around the axis.
|
||||
if (player->mo->target->flags & MF_AMBUSH)
|
||||
if (player->mo->target->flags2 & MF2_AMBUSH)
|
||||
backwardaxis = true;
|
||||
|
||||
player->angle_pos = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y);
|
||||
|
@ -7976,7 +7976,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
else if (player->mo->target)
|
||||
{
|
||||
if (player->mo->target->flags & MF_AMBUSH)
|
||||
if (player->mo->target->flags2 & MF2_AMBUSH)
|
||||
angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y);
|
||||
else
|
||||
angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->target->x, player->mo->target->y);
|
||||
|
|
|
@ -1119,7 +1119,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
fixed_t iscale;
|
||||
fixed_t scalestep; // toast '16
|
||||
fixed_t offset, offset2;
|
||||
boolean flatsprite = true; //(thing->flags2 & MF2_PAPER);
|
||||
boolean flatsprite = (thing->flags & MF_PAPER);
|
||||
|
||||
//SoM: 3/17/2000
|
||||
fixed_t gz, gzt;
|
||||
|
|
Loading…
Reference in a new issue