mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- Add the bob offset to the missiles spawned by P_SpawnMissile(), P_SpawnMissileAngle(), P_SpawnMissileAngleSpeed(), A_MissileAttack, A_ComboAttack, A_BasicAttack, A_CustomMissile, A_CustomComboAttack, A_ThrowGrenade, A_SpawnDebris, and A_Burst.
- Add the bob offset to the value returned by GetActorZ. SVN r3795 (trunk)
This commit is contained in:
parent
56aeb85eee
commit
9c0b0dc774
3 changed files with 29 additions and 25 deletions
|
@ -6346,6 +6346,10 @@ scriptwait:
|
|||
{
|
||||
AActor *actor = SingleActorFromTID(STACK(1), activator);
|
||||
STACK(1) = actor == NULL ? 0 : (&actor->x)[pcd - PCD_GETACTORX];
|
||||
if (pcd == PCD_GETACTORZ)
|
||||
{
|
||||
pcd += actor->GetBobOffset();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -5291,7 +5291,7 @@ static fixed_t GetDefaultSpeed(const PClass *type)
|
|||
|
||||
AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type, AActor *owner)
|
||||
{
|
||||
return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT,
|
||||
return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT + source->GetBobOffset(),
|
||||
source, dest, type, true, owner);
|
||||
}
|
||||
|
||||
|
@ -5413,7 +5413,7 @@ AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const
|
|||
AActor *P_SpawnMissileAngle (AActor *source, const PClass *type,
|
||||
angle_t angle, fixed_t velz)
|
||||
{
|
||||
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT,
|
||||
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(),
|
||||
type, angle, velz, GetDefaultSpeed (type));
|
||||
}
|
||||
|
||||
|
@ -5456,7 +5456,7 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const PCl
|
|||
AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type,
|
||||
angle_t angle, fixed_t velz, fixed_t speed)
|
||||
{
|
||||
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT,
|
||||
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(),
|
||||
type, angle, velz, speed);
|
||||
}
|
||||
|
||||
|
|
|
@ -321,9 +321,9 @@ static void DoAttack (AActor *self, bool domelee, bool domissile,
|
|||
else if (domissile && MissileType != NULL)
|
||||
{
|
||||
// This seemingly senseless code is needed for proper aiming.
|
||||
self->z+=MissileHeight-32*FRACUNIT;
|
||||
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, MissileType, false);
|
||||
self->z-=MissileHeight-32*FRACUNIT;
|
||||
self->z += MissileHeight + self->GetBobOffset() - 32*FRACUNIT;
|
||||
AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, MissileType, false);
|
||||
self->z -= MissileHeight + self->GetBobOffset() - 32*FRACUNIT;
|
||||
|
||||
if (missile)
|
||||
{
|
||||
|
@ -880,32 +880,32 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
angle_t ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
|
||||
fixed_t x = Spawnofs_XY * finecosine[ang];
|
||||
fixed_t y = Spawnofs_XY * finesine[ang];
|
||||
fixed_t z = SpawnHeight - 32*FRACUNIT + (self->player? self->player->crouchoffset : 0);
|
||||
fixed_t z = SpawnHeight + self->GetBobOffset() - 32*FRACUNIT + (self->player? self->player->crouchoffset : 0);
|
||||
|
||||
switch (aimmode)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
// same adjustment as above (in all 3 directions this time) - for better aiming!
|
||||
self->x+=x;
|
||||
self->y+=y;
|
||||
self->z+=z;
|
||||
self->x += x;
|
||||
self->y += y;
|
||||
self->z += z;
|
||||
missile = P_SpawnMissileXYZ(self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false);
|
||||
self->x-=x;
|
||||
self->y-=y;
|
||||
self->z-=z;
|
||||
self->x -= x;
|
||||
self->y -= y;
|
||||
self->z -= z;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
missile = P_SpawnMissileXYZ(self->x+x, self->y+y, self->z+SpawnHeight, self, self->target, ti, false);
|
||||
missile = P_SpawnMissileXYZ(self->x+x, self->y+y, self->z + self->GetBobOffset() + SpawnHeight, self, self->target, ti, false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
self->x+=x;
|
||||
self->y+=y;
|
||||
missile = P_SpawnMissileAngleZSpeed(self, self->z+SpawnHeight, ti, self->angle, 0, GetDefaultByType(ti)->Speed, self, false);
|
||||
self->x-=x;
|
||||
self->y-=y;
|
||||
self->x += x;
|
||||
self->y += y;
|
||||
missile = P_SpawnMissileAngleZSpeed(self, self->z + self->GetBobOffset() + SpawnHeight, ti, self->angle, 0, GetDefaultByType(ti)->Speed, self, false);
|
||||
self->x -= x;
|
||||
self->y -= y;
|
||||
|
||||
flags |= CMF_ABSOLUTEPITCH;
|
||||
|
||||
|
@ -1120,9 +1120,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack)
|
|||
else if (ti)
|
||||
{
|
||||
// This seemingly senseless code is needed for proper aiming.
|
||||
self->z+=SpawnHeight-32*FRACUNIT;
|
||||
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false);
|
||||
self->z-=SpawnHeight-32*FRACUNIT;
|
||||
self->z += SpawnHeight + self->GetBobOffset() - 32*FRACUNIT;
|
||||
AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false);
|
||||
self->z -= SpawnHeight + self->GetBobOffset() - 32*FRACUNIT;
|
||||
|
||||
if (missile)
|
||||
{
|
||||
|
@ -1920,7 +1920,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade)
|
|||
AActor * bo;
|
||||
|
||||
bo = Spawn(missile, self->x, self->y,
|
||||
self->z - self->floorclip + zheight + 35*FRACUNIT + (self->player? self->player->crouchoffset : 0),
|
||||
self->z - self->floorclip + self->GetBobOffset() + zheight + 35*FRACUNIT + (self->player? self->player->crouchoffset : 0),
|
||||
ALLOW_REPLACE);
|
||||
if (bo)
|
||||
{
|
||||
|
@ -2263,7 +2263,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
|
|||
{
|
||||
mo = Spawn(debris, self->x+((pr_spawndebris()-128)<<12),
|
||||
self->y+((pr_spawndebris()-128)<<12),
|
||||
self->z+(pr_spawndebris()*self->height/256), ALLOW_REPLACE);
|
||||
self->z+(pr_spawndebris()*self->height/256+self->GetBobOffset()), ALLOW_REPLACE);
|
||||
if (mo && transfer_translation)
|
||||
{
|
||||
mo->Translation = self->Translation;
|
||||
|
@ -2570,7 +2570,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
|
|||
mo = Spawn(chunk,
|
||||
self->x + (((pr_burst()-128)*self->radius)>>7),
|
||||
self->y + (((pr_burst()-128)*self->radius)>>7),
|
||||
self->z + (pr_burst()*self->height/255), ALLOW_REPLACE);
|
||||
self->z + (pr_burst()*self->height/255 + self->GetBobOffset()), ALLOW_REPLACE);
|
||||
|
||||
if (mo)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue