- Sync scriptbranch with trunk.
SVN r2269 (scripting)
This commit is contained in:
commit
42ac75e894
127 changed files with 2532 additions and 958 deletions
115
src/p_map.cpp
115
src/p_map.cpp
|
|
@ -2807,8 +2807,7 @@ struct aim_t
|
|||
AActor * linetarget;
|
||||
AActor * thing_friend, * thing_other;
|
||||
angle_t pitch_friend, pitch_other;
|
||||
bool notsmart;
|
||||
bool check3d;
|
||||
int flags;
|
||||
#ifdef _3DFLOORS
|
||||
sector_t * lastsector;
|
||||
secplane_t * lastfloorplane;
|
||||
|
|
@ -2819,7 +2818,7 @@ struct aim_t
|
|||
bool AimTraverse3DFloors(const divline_t &trace, intercept_t * in);
|
||||
#endif
|
||||
|
||||
void AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, bool checknonshootable = false, AActor *target=NULL);
|
||||
void AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, AActor *target=NULL);
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -2936,7 +2935,7 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in)
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, bool checknonshootable, AActor *target)
|
||||
void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, AActor *target)
|
||||
{
|
||||
FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES|PT_ADDTHINGS);
|
||||
intercept_t *in;
|
||||
|
|
@ -2994,18 +2993,23 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
if (target != NULL && th != target)
|
||||
continue; // only care about target, and you're not it
|
||||
|
||||
if (!checknonshootable) // For info CCMD, ignore stuff about GHOST and SHOOTABLE flags
|
||||
// If we want to start a conversation anything that has one should be
|
||||
// found, regardless of other settings.
|
||||
if (!(flags & ALF_CHECKCONVERSATION) || th->Conversation == NULL)
|
||||
{
|
||||
if (!(th->flags&MF_SHOOTABLE))
|
||||
continue; // corpse or something
|
||||
|
||||
// check for physical attacks on a ghost
|
||||
if ((th->flags3 & MF3_GHOST) &&
|
||||
shootthing->player && // [RH] Be sure shootthing is a player
|
||||
shootthing->player->ReadyWeapon &&
|
||||
(shootthing->player->ReadyWeapon->flags2 & MF2_THRUGHOST))
|
||||
if (!(flags & ALF_CHECKNONSHOOTABLE)) // For info CCMD, ignore stuff about GHOST and SHOOTABLE flags
|
||||
{
|
||||
continue;
|
||||
if (!(th->flags&MF_SHOOTABLE))
|
||||
continue; // corpse or something
|
||||
|
||||
// check for physical attacks on a ghost
|
||||
if ((th->flags3 & MF3_GHOST) &&
|
||||
shootthing->player && // [RH] Be sure shootthing is a player
|
||||
shootthing->player->ReadyWeapon &&
|
||||
(shootthing->player->ReadyWeapon->flags2 & MF2_THRUGHOST))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
dist = FixedMul (attackrange, in->frac);
|
||||
|
|
@ -3053,7 +3057,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
if (crossedffloors)
|
||||
{
|
||||
// if 3D floors were in the way do an extra visibility check for safety
|
||||
if (!P_CheckSight(shootthing, th, 1))
|
||||
if (!P_CheckSight(shootthing, th, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY))
|
||||
{
|
||||
// the thing can't be seen so we can safely exclude its range from our aiming field
|
||||
if (thingtoppitch<toppitch)
|
||||
|
|
@ -3079,7 +3083,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
|
||||
thingpitch = thingtoppitch/2 + thingbottompitch/2;
|
||||
|
||||
if (check3d)
|
||||
if (flags & ALF_CHECK3D)
|
||||
{
|
||||
// We need to do a 3D distance check here because this is nearly always used in
|
||||
// combination with P_LineAttack. P_LineAttack uses 3D distance but FPathTraverse
|
||||
|
|
@ -3096,7 +3100,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
}
|
||||
}
|
||||
|
||||
if (sv_smartaim && !notsmart)
|
||||
if (sv_smartaim != 0 && !(flags & ALF_FORCENOSMART))
|
||||
{
|
||||
// try to be a little smarter about what to aim at!
|
||||
// In particular avoid autoaiming at friends amd barrels.
|
||||
|
|
@ -3131,11 +3135,6 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
aimpitch = thingpitch;
|
||||
return;
|
||||
}
|
||||
if (checknonshootable)
|
||||
{
|
||||
linetarget = th;
|
||||
aimpitch = thingpitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3145,15 +3144,16 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, bool forcenosmart, bool check3d, bool checknonshootable, AActor *target)
|
||||
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange,
|
||||
int flags, AActor *target)
|
||||
{
|
||||
fixed_t x2;
|
||||
fixed_t y2;
|
||||
aim_t aim;
|
||||
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
aim.flags = flags;
|
||||
aim.shootthing = t1;
|
||||
aim.check3d = check3d;
|
||||
|
||||
x2 = t1->x + (distance>>FRACBITS)*finecosine[angle];
|
||||
y2 = t1->y + (distance>>FRACBITS)*finesine[angle];
|
||||
|
|
@ -3194,7 +3194,6 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
|
|||
}
|
||||
aim.toppitch = t1->pitch - vrange;
|
||||
aim.bottompitch = t1->pitch + vrange;
|
||||
aim.notsmart = forcenosmart;
|
||||
|
||||
aim.attackrange = distance;
|
||||
aim.linetarget = NULL;
|
||||
|
|
@ -3223,7 +3222,7 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
|
|||
}
|
||||
#endif
|
||||
|
||||
aim.AimTraverse (t1->x, t1->y, x2, y2, checknonshootable, target);
|
||||
aim.AimTraverse (t1->x, t1->y, x2, y2, target);
|
||||
|
||||
if (!aim.linetarget)
|
||||
{
|
||||
|
|
@ -3239,7 +3238,9 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
|
|||
}
|
||||
}
|
||||
if (pLineTarget)
|
||||
{
|
||||
*pLineTarget = aim.linetarget;
|
||||
}
|
||||
return aim.linetarget ? aim.aimpitch : t1->pitch;
|
||||
}
|
||||
|
||||
|
|
@ -3588,7 +3589,7 @@ void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *actor, a
|
|||
{
|
||||
if (bleedtrace.HitType == TRACE_HitWall)
|
||||
{
|
||||
PalEntry bloodcolor = actor->GetClass()->BloodColor;
|
||||
PalEntry bloodcolor = actor->GetBloodColor();
|
||||
if (bloodcolor != 0)
|
||||
{
|
||||
bloodcolor.r>>=1; // the full color is too bright for blood decals
|
||||
|
|
@ -3921,13 +3922,13 @@ bool P_TalkFacing(AActor *player)
|
|||
{
|
||||
AActor *linetarget;
|
||||
|
||||
P_AimLineAttack(player, player->angle, TALKRANGE, &linetarget, ANGLE_1*35, true);
|
||||
P_AimLineAttack(player, player->angle, TALKRANGE, &linetarget, ANGLE_1*35, ALF_FORCENOSMART|ALF_CHECKCONVERSATION);
|
||||
if (linetarget == NULL)
|
||||
{
|
||||
P_AimLineAttack(player, player->angle + (ANGLE_90 >> 4), TALKRANGE, &linetarget, ANGLE_1*35, true);
|
||||
P_AimLineAttack(player, player->angle + (ANGLE_90 >> 4), TALKRANGE, &linetarget, ANGLE_1*35, ALF_FORCENOSMART|ALF_CHECKCONVERSATION);
|
||||
if (linetarget == NULL)
|
||||
{
|
||||
P_AimLineAttack(player, player->angle - (ANGLE_90 >> 4), TALKRANGE, &linetarget, ANGLE_1*35, true);
|
||||
P_AimLineAttack(player, player->angle - (ANGLE_90 >> 4), TALKRANGE, &linetarget, ANGLE_1*35, ALF_FORCENOSMART|ALF_CHECKCONVERSATION);
|
||||
if (linetarget == NULL)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -4327,7 +4328,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
|
|||
}
|
||||
points *= thing->GetClass()->RDFactor/(float)FRACUNIT;
|
||||
|
||||
if (points > 0.f && P_CheckSight (thing, bombspot, 1))
|
||||
if (points > 0.f && P_CheckSight (thing, bombspot, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY))
|
||||
{ // OK to damage; target is in direct path
|
||||
float velz;
|
||||
float thrust;
|
||||
|
|
@ -4385,7 +4386,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
|
|||
if (dist >= bombdistance)
|
||||
continue; // out of range
|
||||
|
||||
if (P_CheckSight (thing, bombspot, 1))
|
||||
if (P_CheckSight (thing, bombspot, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY))
|
||||
{ // OK to damage; target is in direct path
|
||||
dist = clamp<int>(dist - fulldamagedistance, 0, dist);
|
||||
int damage = Scale (bombdamage, bombdistance-dist, bombdistance);
|
||||
|
|
@ -4595,34 +4596,40 @@ void P_DoCrunch (AActor *thing, FChangePosition *cpos)
|
|||
P_DamageMobj (thing, NULL, NULL, cpos->crushchange, NAME_Crush);
|
||||
|
||||
// spray blood in a random direction
|
||||
if ((!(thing->flags&MF_NOBLOOD)) &&
|
||||
(!(thing->flags2&(MF2_INVULNERABLE|MF2_DORMANT))))
|
||||
if (!(thing->flags2&(MF2_INVULNERABLE|MF2_DORMANT)))
|
||||
{
|
||||
PalEntry bloodcolor = thing->GetClass()->BloodColor;
|
||||
PClassActor *bloodcls = PClass::FindActor(thing->GetClass()->BloodType);
|
||||
|
||||
P_TraceBleed (cpos->crushchange, thing);
|
||||
if (cl_bloodtype <= 1 && bloodcls != NULL)
|
||||
if (!(thing->flags&MF_NOBLOOD))
|
||||
{
|
||||
AActor *mo;
|
||||
|
||||
mo = Spawn (bloodcls, thing->x, thing->y,
|
||||
thing->z + thing->height/2, ALLOW_REPLACE);
|
||||
|
||||
mo->velx = pr_crunch.Random2 () << 12;
|
||||
mo->vely = pr_crunch.Random2 () << 12;
|
||||
if (bloodcolor != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
PalEntry bloodcolor = thing->GetBloodColor();
|
||||
PClassActor *bloodcls = thing->GetBloodType();
|
||||
|
||||
P_TraceBleed (cpos->crushchange, thing);
|
||||
if (cl_bloodtype <= 1 && bloodcls != NULL)
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
AActor *mo;
|
||||
|
||||
mo = Spawn (bloodcls, thing->x, thing->y,
|
||||
thing->z + thing->height/2, ALLOW_REPLACE);
|
||||
|
||||
mo->velx = pr_crunch.Random2 () << 12;
|
||||
mo->vely = pr_crunch.Random2 () << 12;
|
||||
if (bloodcolor != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
}
|
||||
}
|
||||
if (cl_bloodtype >= 1)
|
||||
{
|
||||
angle_t an;
|
||||
|
||||
an = (M_Random () - 128) << 24;
|
||||
P_DrawSplash2 (32, thing->x, thing->y,
|
||||
thing->z + thing->height/2, an, 2, bloodcolor);
|
||||
}
|
||||
}
|
||||
if (cl_bloodtype >= 1)
|
||||
if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound))
|
||||
{
|
||||
angle_t an;
|
||||
|
||||
an = (M_Random () - 128) << 24;
|
||||
P_DrawSplash2 (32, thing->x, thing->y,
|
||||
thing->z + thing->height/2, an, 2, bloodcolor);
|
||||
S_Sound(thing, CHAN_VOICE, thing->CrushPainSound, 1.f, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue