mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- Changed pickup sounds of local player to unpaused to resolve problems with
the time freezer and make them behave better. - Fixed: When sounds are paused not all newly started sounds should actually be played. - Fixed: SBARINFO had no means to check if a weapon uses any ammo at all and as a result the inventory icon was misplaced if a no-ammo weapon was selected. SVN r1343 (trunk)
This commit is contained in:
parent
ee8ce6c1e1
commit
6a321fd8f5
11 changed files with 167 additions and 46 deletions
|
@ -1,4 +1,16 @@
|
|||
January 1, 2009 (Changes by Graf Zahl)
|
||||
- Changed pickup sounds of local player to unpaused to resolve problems with
|
||||
the time freezer and make them behave better.
|
||||
- Fixed: When sounds are paused not all newly started sounds should actually
|
||||
be played.
|
||||
- Fixed: SBARINFO had no means to check if a weapon uses any ammo at all and
|
||||
as a result the inventory icon was misplaced if a no-ammo weapon was selected.
|
||||
|
||||
December 31, 2008 (Changes by Graf Zahl)
|
||||
- Fixed: P_CheckMissileSpawn and AFastProjectile didn't adjust their
|
||||
calculations for missiles with small radii.
|
||||
- Added a new aiming mode to A_CustomRailgun to aim directly at the target
|
||||
from the actual point the shot originates from.
|
||||
- Added a constant name for Skulltag's 128 flag for A_SpawnItemEx. For
|
||||
compatibility ZDoom needs to define this name, too, even though it doesn't
|
||||
use it.
|
||||
|
|
|
@ -29,18 +29,35 @@ void AFastProjectile::Tick ()
|
|||
// [RH] Ripping is a little different than it was in Hexen
|
||||
FCheckPosition tm(!!(flags2 & MF2_RIP));
|
||||
|
||||
int shift = 3;
|
||||
int count = 8;
|
||||
if (radius > 0)
|
||||
{
|
||||
while ( ((momx >> shift) > radius) || ((momy >> shift) > radius))
|
||||
{
|
||||
// we need to take smaller steps.
|
||||
shift++;
|
||||
count<<=1;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle movement
|
||||
if (momx || momy || (z != floorz) || momz)
|
||||
{
|
||||
xfrac = momx>>3;
|
||||
yfrac = momy>>3;
|
||||
zfrac = momz>>3;
|
||||
xfrac = momx>>shift;
|
||||
yfrac = momy>>shift;
|
||||
zfrac = momz>>shift;
|
||||
changexy = xfrac || yfrac;
|
||||
for (i = 0; i < 8; i++)
|
||||
int ripcount = count >> 3;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (changexy)
|
||||
{
|
||||
tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen
|
||||
if (--ripcount <= 0)
|
||||
{
|
||||
tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen
|
||||
ripcount = count >> 3;
|
||||
}
|
||||
if (!P_TryMove (this, x + xfrac,y + yfrac, true, false, tm))
|
||||
{ // Blocked move
|
||||
P_ExplodeMissile (this, BlockingLine, BlockingMobj);
|
||||
|
|
|
@ -972,6 +972,7 @@ const char *AInventory::PickupMessage ()
|
|||
void AInventory::PlayPickupSound (AActor *toucher)
|
||||
{
|
||||
float atten;
|
||||
int chan;
|
||||
|
||||
if (ItemFlags & IF_NOATTENPICKUPSOUND)
|
||||
{
|
||||
|
@ -988,7 +989,16 @@ void AInventory::PlayPickupSound (AActor *toucher)
|
|||
{
|
||||
atten = ATTN_NORM;
|
||||
}
|
||||
S_Sound (toucher, CHAN_PICKUP, PickupSound, 1, atten);
|
||||
|
||||
if (toucher != NULL && toucher->CheckLocalView(consoleplayer))
|
||||
{
|
||||
chan = CHAN_PICKUP|CHAN_NOPAUSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
chan = CHAN_PICKUP;
|
||||
}
|
||||
S_Sound (toucher, chan, PickupSound, 1, atten);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -330,6 +330,7 @@ enum //Bar key words
|
|||
SBARINFO_PLAYERCLASS,
|
||||
SBARINFO_ASPECTRATIO,
|
||||
SBARINFO_ISSELECTED,
|
||||
SBARINFO_USESAMMO,
|
||||
SBARINFO_USESSECONDARYAMMO,
|
||||
SBARINFO_HASWEAPONPIECE,
|
||||
SBARINFO_INVENTORYBARNOTVISIBLE,
|
||||
|
|
|
@ -1270,6 +1270,13 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
|||
}
|
||||
}
|
||||
break;
|
||||
case SBARINFO_USESAMMO:
|
||||
if ((CPlayer->ReadyWeapon->AmmoType1 != NULL || CPlayer->ReadyWeapon->AmmoType2 != NULL) ^
|
||||
!!(cmd.flags & SBARINFOEVENT_NOT))
|
||||
{
|
||||
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||
}
|
||||
break;
|
||||
case SBARINFO_USESSECONDARYAMMO:
|
||||
if((CPlayer->ReadyWeapon->AmmoType2 != NULL && CPlayer->ReadyWeapon->AmmoType2 != CPlayer->ReadyWeapon->AmmoType1 && !(cmd.flags & SBARINFOEVENT_NOT)) ||
|
||||
(CPlayer->ReadyWeapon->AmmoType2 == NULL && cmd.flags & SBARINFOEVENT_NOT))
|
||||
|
|
|
@ -103,6 +103,7 @@ static const char *SBarInfoRoutineLevel[] =
|
|||
"playerclass",
|
||||
"aspectratio",
|
||||
"isselected",
|
||||
"usesammo",
|
||||
"usessecondaryammo",
|
||||
"hasweaponpiece",
|
||||
"inventorybarnotvisible",
|
||||
|
@ -1224,12 +1225,13 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
|
|||
this->ParseSBarInfoBlock(sc, cmd.subBlock);
|
||||
break;
|
||||
case SBARINFO_USESSECONDARYAMMO:
|
||||
case SBARINFO_USESAMMO:
|
||||
if(sc.CheckToken(TK_Identifier))
|
||||
{
|
||||
if(sc.Compare("not"))
|
||||
cmd.flags |= SBARINFOEVENT_NOT;
|
||||
else
|
||||
sc.ScriptError("Exspected 'not' got '%s' instead.", sc.String);
|
||||
sc.ScriptError("Expected 'not' got '%s' instead.", sc.String);
|
||||
}
|
||||
sc.MustGetToken('{');
|
||||
cmd.subBlock.fullScreenOffsets = block.fullScreenOffsets;
|
||||
|
|
|
@ -4356,6 +4356,8 @@ bool P_HitFloor (AActor *thing)
|
|||
|
||||
bool P_CheckMissileSpawn (AActor* th)
|
||||
{
|
||||
int shift, count = 1;
|
||||
|
||||
// [RH] Don't decrement tics if they are already less than 1
|
||||
if ((th->flags4 & MF4_RANDOMIZE) && th->tics > 0)
|
||||
{
|
||||
|
@ -4367,40 +4369,56 @@ bool P_CheckMissileSpawn (AActor* th)
|
|||
// move a little forward so an angle can be computed if it immediately explodes
|
||||
if (th->Speed >= 100*FRACUNIT)
|
||||
{ // Ultra-fast ripper spawning missile
|
||||
th->x += th->momx>>3;
|
||||
th->y += th->momy>>3;
|
||||
th->z += th->momz>>3;
|
||||
shift = 3;
|
||||
}
|
||||
else
|
||||
{ // Normal missile
|
||||
th->x += th->momx>>1;
|
||||
th->y += th->momy>>1;
|
||||
th->z += th->momz>>1;
|
||||
shift = 1;
|
||||
}
|
||||
|
||||
// killough 3/15/98: no dropoff (really = don't care for missiles)
|
||||
|
||||
if (!P_TryMove (th, th->x, th->y, false))
|
||||
if (th->radius > 0)
|
||||
{
|
||||
// [RH] Don't explode ripping missiles that spawn inside something
|
||||
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
|
||||
while ( ((th->momx >> shift) > th->radius) || ((th->momy >> shift) > th->radius))
|
||||
{
|
||||
// If this is a monster spawned by A_CustomMissile subtract it from the counter.
|
||||
if (th->CountsAsKill())
|
||||
// we need to take smaller steps but to produce the same end result
|
||||
// we have to do more of them.
|
||||
shift++;
|
||||
count<<=1;
|
||||
}
|
||||
}
|
||||
|
||||
FCheckPosition tm(!!(th->flags2 & MF2_RIP));
|
||||
|
||||
for(int i=0; i<count; i++)
|
||||
{
|
||||
th->x += th->momx>>shift;
|
||||
th->y += th->momy>>shift;
|
||||
th->z += th->momz>>shift;
|
||||
|
||||
// killough 3/15/98: no dropoff (really = don't care for missiles)
|
||||
|
||||
if (!P_TryMove (th, th->x, th->y, false, false, tm))
|
||||
{
|
||||
// [RH] Don't explode ripping missiles that spawn inside something
|
||||
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
|
||||
{
|
||||
th->flags&=~MF_COUNTKILL;
|
||||
level.total_monsters--;
|
||||
// If this is a monster spawned by A_CustomMissile subtract it from the counter.
|
||||
if (th->CountsAsKill())
|
||||
{
|
||||
th->flags&=~MF_COUNTKILL;
|
||||
level.total_monsters--;
|
||||
}
|
||||
// [RH] Don't explode missiles that spawn on top of horizon lines
|
||||
if (th->BlockingLine != NULL && th->BlockingLine->special == Line_Horizon)
|
||||
{
|
||||
th->Destroy ();
|
||||
}
|
||||
else
|
||||
{
|
||||
P_ExplodeMissile (th, NULL, th->BlockingMobj);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// [RH] Don't explode missiles that spawn on top of horizon lines
|
||||
if (th->BlockingLine != NULL && th->BlockingLine->special == Line_Horizon)
|
||||
{
|
||||
th->Destroy ();
|
||||
}
|
||||
else
|
||||
{
|
||||
P_ExplodeMissile (th, NULL, th->BlockingMobj);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -112,6 +112,7 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor);
|
|||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static bool SoundPaused; // whether sound is paused
|
||||
static bool MusicPaused; // whether music is paused
|
||||
static MusPlayingInfo mus_playing; // music currently being played
|
||||
static FString LastSong; // last music that was played
|
||||
|
@ -1000,6 +1001,13 @@ static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyO
|
|||
}
|
||||
}
|
||||
|
||||
// sound is paused and a non-looped sound is being started.
|
||||
// Such a sound would play right after unpausing which wouldn't sound right.
|
||||
if (!(chanflags & CHAN_LOOP) && !(chanflags & (CHAN_UI|CHAN_NOPAUSE)) && SoundPaused)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Vary the sfx pitches.
|
||||
if (sfx->PitchMask != 0)
|
||||
{
|
||||
|
@ -1604,6 +1612,7 @@ void S_PauseSound (bool notmusic)
|
|||
I_PauseSong (mus_playing.handle);
|
||||
MusicPaused = true;
|
||||
}
|
||||
SoundPaused = true;
|
||||
GSnd->SetSfxPaused (true, 0);
|
||||
}
|
||||
|
||||
|
@ -1621,6 +1630,7 @@ void S_ResumeSound ()
|
|||
I_ResumeSong (mus_playing.handle);
|
||||
MusicPaused = false;
|
||||
}
|
||||
SoundPaused = false;
|
||||
GSnd->SetSfxPaused (false, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1073,6 +1073,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
|||
// also for monsters
|
||||
//
|
||||
//==========================================================================
|
||||
enum
|
||||
{
|
||||
CRF_DONTAIM = 0,
|
||||
CRF_AIMPARALLEL = 1,
|
||||
CRF_AIMDIRECT = 2
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
||||
{
|
||||
|
@ -1082,10 +1088,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
ACTION_PARAM_COLOR(Color1, 2);
|
||||
ACTION_PARAM_COLOR(Color2, 3);
|
||||
ACTION_PARAM_BOOL(Silent, 4);
|
||||
ACTION_PARAM_BOOL(aim, 5);
|
||||
ACTION_PARAM_INT(aim, 5);
|
||||
ACTION_PARAM_FLOAT(MaxDiff, 6);
|
||||
ACTION_PARAM_CLASS(PuffType, 7);
|
||||
|
||||
fixed_t saved_x = self->x;
|
||||
fixed_t saved_y = self->y;
|
||||
angle_t saved_angle = self->angle;
|
||||
|
||||
if (aim && self->target == NULL)
|
||||
{
|
||||
return;
|
||||
|
@ -1098,12 +1108,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
|
||||
self->flags &= ~MF_AMBUSH;
|
||||
|
||||
|
||||
if (aim)
|
||||
{
|
||||
|
||||
self->angle = R_PointToAngle2 (self->x,
|
||||
self->y,
|
||||
self->target->x,
|
||||
self->target->y);
|
||||
|
||||
}
|
||||
|
||||
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
|
||||
|
@ -1111,18 +1124,37 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
// Let the aim trail behind the player
|
||||
if (aim)
|
||||
{
|
||||
self->angle = R_PointToAngle2 (self->x,
|
||||
self->y,
|
||||
saved_angle = self->angle = R_PointToAngle2 (self->x, self->y,
|
||||
self->target->x - self->target->momx * 3,
|
||||
self->target->y - self->target->momy * 3);
|
||||
|
||||
if (aim == CRF_AIMDIRECT)
|
||||
{
|
||||
// Tricky: We must offset to the angle of the current position
|
||||
// but then change the angle again to ensure proper aim.
|
||||
self->x += Spawnofs_XY * finecosine[self->angle];
|
||||
self->y += Spawnofs_XY * finesine[self->angle];
|
||||
Spawnofs_XY = 0;
|
||||
self->angle = R_PointToAngle2 (self->x, self->y,
|
||||
self->target->x - self->target->momx * 3,
|
||||
self->target->y - self->target->momy * 3);
|
||||
}
|
||||
|
||||
if (self->target->flags & MF_SHADOW)
|
||||
{
|
||||
self->angle += pr_crailgun.Random2() << 21;
|
||||
angle_t rnd = pr_crailgun.Random2() << 21;
|
||||
self->angle += rnd;
|
||||
saved_angle = rnd;
|
||||
}
|
||||
}
|
||||
|
||||
angle_t angle = (self->angle - ANG90) >> ANGLETOFINESHIFT;
|
||||
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, Silent, PuffType);
|
||||
|
||||
self->x = saved_x;
|
||||
self->y = saved_y;
|
||||
self->angle = saved_angle;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -1528,7 +1528,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
|
|||
// Yuck! What was I thinking when I decided to prepend "Power" to the name?
|
||||
// Now it's too late to change it...
|
||||
const PClass *cls = PClass::FindClass(str);
|
||||
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
|
||||
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(APowerup)))
|
||||
{
|
||||
FString st;
|
||||
st.Format("%s%s", strnicmp(str, "power", 5)? "Power" : "", str);
|
||||
|
|
|
@ -26,22 +26,34 @@ statusbar fullscreen, fullscreenoffsets // ZDoom HUD
|
|||
drawimage ammoicon1, -14, -4, centerbottom;
|
||||
drawnumber 3, HUDFONT_DOOM, untranslated, ammo1, drawshadow, -25, -20;
|
||||
|
||||
//secondary ammo and inventory
|
||||
usessecondaryammo
|
||||
usesammo
|
||||
{
|
||||
drawimage ammoicon2, -14, -22, centerbottom;
|
||||
drawnumber 3, HUDFONT_DOOM, untranslated, ammo2, drawshadow, -25, -38;
|
||||
inventorybarnotvisible
|
||||
//secondary ammo and inventory
|
||||
usessecondaryammo
|
||||
{
|
||||
drawselectedinventory centerbottom, drawshadow, alwaysshowcounter, HUDFONT_DOOM, -14, -39, -26, -56, untranslated;
|
||||
drawimage ammoicon2, -14, -22, centerbottom;
|
||||
drawnumber 3, HUDFONT_DOOM, untranslated, ammo2, drawshadow, -25, -38;
|
||||
inventorybarnotvisible
|
||||
{
|
||||
drawselectedinventory centerbottom, drawshadow, alwaysshowcounter, HUDFONT_DOOM, -14, -39, -26, -56, untranslated;
|
||||
}
|
||||
}
|
||||
//no secondary ammo
|
||||
usessecondaryammo not
|
||||
{
|
||||
inventorybarnotvisible
|
||||
{
|
||||
drawselectedinventory centerbottom, drawshadow, alwaysshowcounter, HUDFONT_DOOM, -14, -21, -26, -38, untranslated;
|
||||
}
|
||||
}
|
||||
}
|
||||
//no secondary ammo
|
||||
usessecondaryammo not
|
||||
|
||||
// no ammo but inventory
|
||||
usesammo not
|
||||
{
|
||||
inventorybarnotvisible
|
||||
{
|
||||
drawselectedinventory centerbottom, drawshadow, alwaysshowcounter, HUDFONT_DOOM, -14, -21, -26, -38, untranslated;
|
||||
drawselectedinventory centerbottom, drawshadow, alwaysshowcounter, HUDFONT_DOOM, -14, -3, -26, -20, untranslated;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue