mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- Used new functionality to avoid moving the puff around in SpawnDeepSplash.
- Fixed: P_RailAttack used the shooting actor or a default puff for some splash related actions. It should use the puff type passed to it as a parameter instead. - Changed splash handling in P_LineAttack to use the actual hit position to spawn the splash and not the puff's spawn position which is offset a little. - made some precision related changes to P_HitWater. The precise hit coordinate can now be passed as parameters. SVN r1350 (trunk)
This commit is contained in:
parent
3fe5db901c
commit
f7148b6b40
4 changed files with 42 additions and 56 deletions
|
@ -1,3 +1,12 @@
|
|||
January 4, 2009 (Changes by Graf Zahl)
|
||||
- Used new functionality to avoid moving the puff around in SpawnDeepSplash.
|
||||
- Fixed: P_RailAttack used the shooting actor or a default puff for some splash
|
||||
related actions. It should use the puff type passed to it as a parameter instead.
|
||||
- Changed splash handling in P_LineAttack to use the actual hit position to
|
||||
spawn the splash and not the puff's spawn position which is offset a little.
|
||||
- made some precision related changes to P_HitWater. The precise hit coordinate
|
||||
can now be passed as parameters.
|
||||
|
||||
January 3, 2009 (Changes by Graf Zahl)
|
||||
- Made spawning of floor- and ceiling huggers a little more intelligent.
|
||||
- Fixed: 'None' was no longer recognized as a NULL class name by the
|
||||
|
|
|
@ -389,7 +389,7 @@ void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile ver
|
|||
void P_TraceBleed (int damage, AActor *target); // random direction version
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, const PClass *puff = NULL); // [RH] Shoot a railgun
|
||||
bool P_HitFloor (AActor *thing);
|
||||
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashz=FIXED_MIN);
|
||||
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false);
|
||||
bool P_CheckMissileSpawn (AActor *missile);
|
||||
void P_PlaySpawnSound(AActor *missile, AActor *spawner);
|
||||
|
||||
|
|
|
@ -2724,7 +2724,12 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
|
|||
trace.Sector->heightsec == NULL &&
|
||||
trace.HitType == TRACE_HitFloor)
|
||||
{
|
||||
P_HitWater (puff, trace.Sector);
|
||||
// Using the puff's position is not accurate enough.
|
||||
// Instead make it splash at the actual hit position
|
||||
hitx = t1->x + FixedMul (vx, trace.Distance);
|
||||
hity = t1->y + FixedMul (vy, trace.Distance);
|
||||
hitz = shootz + FixedMul (vz, trace.Distance);
|
||||
P_HitWater (puff, P_PointInSector(hitx, hity), hitx, hity, hitz);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2998,6 +3003,8 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
FTraceResults trace;
|
||||
fixed_t shootz;
|
||||
|
||||
if (puffclass == NULL) puffclass = PClass::FindClass(NAME_BulletPuff);
|
||||
|
||||
pitch = (angle_t)(-source->pitch) >> ANGLETOFINESHIFT;
|
||||
angle = source->angle >> ANGLETOFINESHIFT;
|
||||
|
||||
|
@ -3040,39 +3047,16 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
trace.CrossedWater == NULL &&
|
||||
trace.Sector->heightsec == NULL)
|
||||
{
|
||||
fixed_t savex, savey, savez;
|
||||
fixed_t savefloor, saveceil, savedropoff;
|
||||
FTextureID savefloorpic;
|
||||
sector_t *savefloorsec;
|
||||
FTextureID saveceilingpic;
|
||||
sector_t *saveceilingsec;
|
||||
|
||||
savex = source->x;
|
||||
savey = source->y;
|
||||
savez = source->z;
|
||||
savefloor = source->floorz;
|
||||
saveceil = source->ceilingz;
|
||||
savedropoff = source->dropoffz;
|
||||
savefloorpic = source->floorpic;
|
||||
savefloorsec = source->floorsector;
|
||||
saveceilingpic = source->ceilingpic;
|
||||
saveceilingsec = source->ceilingsector;
|
||||
|
||||
source->SetOrigin (trace.X, trace.Y, trace.Z);
|
||||
P_HitWater (source, trace.Sector);
|
||||
source->SetOrigin (savex, savey, savez);
|
||||
|
||||
source->floorz = savefloor;
|
||||
source->ceilingz = saveceil;
|
||||
source->dropoffz = savedropoff;
|
||||
source->floorpic = savefloorpic;
|
||||
source->floorsector = savefloorsec;
|
||||
source->ceilingpic = saveceilingpic;
|
||||
source->ceilingsector = saveceilingsec;
|
||||
AActor *thepuff = Spawn (puffclass, trace.X, trace.Y, trace.Z, ALLOW_REPLACE);
|
||||
if (thepuff != NULL)
|
||||
{
|
||||
P_HitWater (thepuff, trace.Sector);
|
||||
thepuff->Destroy ();
|
||||
}
|
||||
}
|
||||
if (trace.CrossedWater)
|
||||
{
|
||||
AActor *thepuff = Spawn ("BulletPuff", 0, 0, 0, ALLOW_REPLACE);
|
||||
AActor *thepuff = Spawn (puffclass, 0, 0, 0, ALLOW_REPLACE);
|
||||
if (thepuff != NULL)
|
||||
{
|
||||
SpawnDeepSplash (source, trace, thepuff, vx, vy, vz, shootz);
|
||||
|
@ -3082,7 +3066,6 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
|
||||
// Now hurt anything the trace hit
|
||||
unsigned int i;
|
||||
if (puffclass == NULL) puffclass = PClass::FindClass(NAME_BulletPuff);
|
||||
AActor *puffDefaults = puffclass == NULL? NULL : GetDefaultByType (puffclass);
|
||||
FName damagetype = (puffDefaults == NULL || puffDefaults->DamageType == NAME_None) ? FName(NAME_Railgun) : puffDefaults->DamageType;
|
||||
|
||||
|
@ -4532,22 +4515,11 @@ static void SpawnDeepSplash (AActor *t1, const FTraceResults &trace, AActor *puf
|
|||
|
||||
if (hitdist >= 0 && hitdist <= trace.Distance)
|
||||
{
|
||||
fixed_t savex, savey, savez;
|
||||
fixed_t hitx = t1->x+FixedMul (vx, hitdist);
|
||||
fixed_t hity = t1->y+FixedMul (vy, hitdist);
|
||||
fixed_t hitz = shootz+FixedMul (vz, hitdist);
|
||||
|
||||
// Move the puff onto the water surface, splash, then move it back.
|
||||
if (puff == NULL)
|
||||
{
|
||||
puff = t1;
|
||||
}
|
||||
|
||||
savex = puff->x;
|
||||
savey = puff->y;
|
||||
savez = puff->z;
|
||||
puff->SetOrigin (t1->x+FixedMul (vx, hitdist),
|
||||
t1->y+FixedMul (vy, hitdist),
|
||||
shootz+FixedMul (vz, hitdist));
|
||||
P_HitWater (puff, puff->Sector);
|
||||
puff->SetOrigin (savex, savey, savez);
|
||||
P_HitWater (puff != NULL? puff:t1, P_PointInSector(hitx, hity), hitx, hity, hitz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3058,7 +3058,10 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
|
|||
|
||||
// some additional checks to make deep sectors like Boom's splash without setting
|
||||
// the water flags.
|
||||
if (boomwaterlevel == 0 && waterlevel != 0 && dosplash) P_HitWater(this, Sector, fh);
|
||||
if (boomwaterlevel == 0 && waterlevel != 0 && dosplash)
|
||||
{
|
||||
P_HitWater(this, Sector, FIXED_MIN, FIXED_MIN, fh, true);
|
||||
}
|
||||
boomwaterlevel=waterlevel;
|
||||
if (reset) waterlevel=lastwaterlevel;
|
||||
return false; // we did the splash ourselves! ;)
|
||||
|
@ -4214,7 +4217,7 @@ int P_GetThingFloorType (AActor *thing)
|
|||
// Returns true if hit liquid and splashed, false if not.
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool P_HitWater (AActor * thing, sector_t * sec, fixed_t z)
|
||||
bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool checkabove)
|
||||
{
|
||||
if (thing->flags2 & MF2_FLOATBOB || thing->flags3 & MF3_DONTSPLASH)
|
||||
return false;
|
||||
|
@ -4226,9 +4229,11 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t z)
|
|||
FSplashDef *splash;
|
||||
int terrainnum;
|
||||
|
||||
if (z==FIXED_MIN) z=thing->z;
|
||||
if (x == FIXED_MIN) x = thing->x;
|
||||
if (y == FIXED_MIN) y = thing->y;
|
||||
if (z == FIXED_MIN) z = thing->z;
|
||||
// don't splash above the object
|
||||
else if (z>thing->z+(thing->height>>1)) return false;
|
||||
if (checkabove && z > thing->z + (thing->height >> 1)) return false;
|
||||
if (sec->heightsec == NULL ||
|
||||
//!sec->heightsec->waterzone ||
|
||||
(sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) ||
|
||||
|
@ -4268,14 +4273,14 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t z)
|
|||
|
||||
if (smallsplash && splash->SmallSplash)
|
||||
{
|
||||
mo = Spawn (splash->SmallSplash, thing->x, thing->y, z, ALLOW_REPLACE);
|
||||
mo = Spawn (splash->SmallSplash, x, y, z, ALLOW_REPLACE);
|
||||
if (mo) mo->floorclip += splash->SmallSplashClip;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (splash->SplashChunk)
|
||||
{
|
||||
mo = Spawn (splash->SplashChunk, thing->x, thing->y, z, ALLOW_REPLACE);
|
||||
mo = Spawn (splash->SplashChunk, x, y, z, ALLOW_REPLACE);
|
||||
mo->target = thing;
|
||||
if (splash->ChunkXVelShift != 255)
|
||||
{
|
||||
|
@ -4289,7 +4294,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t z)
|
|||
}
|
||||
if (splash->SplashBase)
|
||||
{
|
||||
mo = Spawn (splash->SplashBase, thing->x, thing->y, z, ALLOW_REPLACE);
|
||||
mo = Spawn (splash->SplashBase, x, y, z, ALLOW_REPLACE);
|
||||
}
|
||||
if (thing->player && !splash->NoAlert)
|
||||
{
|
||||
|
@ -4304,7 +4309,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t z)
|
|||
}
|
||||
else
|
||||
{
|
||||
S_Sound (thing->x, thing->y, z, CHAN_ITEM, smallsplash ?
|
||||
S_Sound (x, y, z, CHAN_ITEM, smallsplash ?
|
||||
splash->SmallSplashSound : splash->NormalSplashSound,
|
||||
1, ATTN_IDLE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue