- Fixed: Cheats in demos must not access the weapon slots.

- Fixed: S_ChannelEnded didn't check for a NULL SfxInfo.
- Fixed: R_InitTables did a typecast to angle_t instead of fixed_t.
- Fixed: PowerProtection and PowerDamage applied their defaults incorrectly.
- Fixed: The damage type property didn't properly read its factor.


SVN r1257 (trunk)
This commit is contained in:
Christoph Oelckers 2008-10-07 18:21:03 +00:00
parent 7b82745665
commit 402d0e5fa1
6 changed files with 36 additions and 13 deletions

View File

@ -1,3 +1,12 @@
October 7, 2008 (Changes by Graf Zahl)
- Fixed: Cheats in demos must not access the weapon slots.
- Fixed: S_ChannelEnded didn't check for a NULL SfxInfo.
- Fixed: R_InitTables did a typecast to angle_t instead of fixed_t.
October 6, 2008 (Changes by Graf Zahl)
- Fixed: PowerProtection and PowerDamage applied their defaults incorrectly.
- Fixed: The damage type property didn't properly read its factor.
October 5, 2008 (Changes by Graf Zahl) October 5, 2008 (Changes by Graf Zahl)
- Finally has the right idea how to restore Doom's original clipping of projectiles - Finally has the right idea how to restore Doom's original clipping of projectiles
against decorations without breaking anything newer: against decorations without breaking anything newer:

View File

@ -1476,12 +1476,17 @@ void APowerDamage::ModifyDamage(int damage, FName damageType, int &newdamage, bo
if (!passive && damage > 0) if (!passive && damage > 0)
{ {
DmgFactors * df = GetClass()->ActorInfo->DamageFactors; DmgFactors * df = GetClass()->ActorInfo->DamageFactors;
if (df != NULL) if (df != NULL && df->CountUsed() != 0)
{ {
const fixed_t * pdf = df->CheckKey(damageType); const fixed_t * pdf = df->CheckKey(damageType);
if (pdf== NULL && damageType != NAME_None) pdf = df->CheckKey(NAME_None); if (pdf== NULL && damageType != NAME_None) pdf = df->CheckKey(NAME_None);
if (pdf == NULL) pdf = &def; }
else
{
pdf = &def;
}
if (pdf != NULL)
{
damage = newdamage = FixedMul(damage, *pdf); damage = newdamage = FixedMul(damage, *pdf);
if (*pdf > 0 && damage == 0) damage = newdamage = 1; // don't allow zero damage as result of an underflow if (*pdf > 0 && damage == 0) damage = newdamage = 1; // don't allow zero damage as result of an underflow
if (Owner != NULL && *pdf > FRACUNIT) S_Sound(Owner, 5, ActiveSound, 1.0f, ATTN_NONE); if (Owner != NULL && *pdf > FRACUNIT) S_Sound(Owner, 5, ActiveSound, 1.0f, ATTN_NONE);
@ -1530,12 +1535,15 @@ void APowerProtection::ModifyDamage(int damage, FName damageType, int &newdamage
if (passive && damage > 0) if (passive && damage > 0)
{ {
DmgFactors * df = GetClass()->ActorInfo->DamageFactors; DmgFactors * df = GetClass()->ActorInfo->DamageFactors;
if (df != NULL) if (df != NULL && df->CountUsed() != 0)
{ {
const fixed_t * pdf = df->CheckKey(damageType); const fixed_t * pdf = df->CheckKey(damageType);
if (pdf== NULL && damageType != NAME_None) pdf = df->CheckKey(NAME_None); if (pdf== NULL && damageType != NAME_None) pdf = df->CheckKey(NAME_None);
if (pdf == NULL) pdf = &def; }
else pdf = &def;
if (pdf != NULL)
{
damage = newdamage = FixedMul(damage, *pdf); damage = newdamage = FixedMul(damage, *pdf);
if (Owner != NULL && *pdf < FRACUNIT) S_Sound(Owner, 5, ActiveSound, 1.0f, ATTN_NONE); if (Owner != NULL && *pdf < FRACUNIT) S_Sound(Owner, 5, ActiveSound, 1.0f, ATTN_NONE);
} }

View File

@ -737,8 +737,10 @@ void cht_Give (player_t *player, const char *name, int amount)
// Give the weapon only if it belongs to the current game or // Give the weapon only if it belongs to the current game or
// is in a weapon slot. Unfortunately this check only works in // is in a weapon slot. Unfortunately this check only works in
// singleplayer games because the weapon slots are stored locally. // singleplayer games because the weapon slots are stored locally.
// In multiplayer games all weapons must be given. // In multiplayer games or demors all weapons must be given because the state of
if (multiplayer || type->ActorInfo->GameFilter == GAME_Any || // the weapon slots is not guaranteed to be the same when recording or playing back.
if (multiplayer || demorecording || demoplayback ||
type->ActorInfo->GameFilter == GAME_Any ||
(type->ActorInfo->GameFilter & gameinfo.gametype) || (type->ActorInfo->GameFilter & gameinfo.gametype) ||
LocalWeapons.LocateWeapon(type, NULL, NULL)) LocalWeapons.LocateWeapon(type, NULL, NULL))
{ {

View File

@ -370,16 +370,16 @@ void R_InitTables (void)
const double pimul = PI*2/FINEANGLES; const double pimul = PI*2/FINEANGLES;
// viewangle tangent table // viewangle tangent table
finetangent[0] = (angle_t)(FRACUNIT*tan ((0.5-FINEANGLES/4)*pimul)+0.5); finetangent[0] = (fixed_t)(FRACUNIT*tan ((0.5-FINEANGLES/4)*pimul)+0.5);
for (i = 1; i < FINEANGLES/2; i++) for (i = 1; i < FINEANGLES/2; i++)
{ {
finetangent[i] = (angle_t)(FRACUNIT*tan ((i-FINEANGLES/4)*pimul)+0.5); finetangent[i] = (fixed_t)(FRACUNIT*tan ((i-FINEANGLES/4)*pimul)+0.5);
} }
// finesine table // finesine table
for (i = 0; i < FINEANGLES/4; i++) for (i = 0; i < FINEANGLES/4; i++)
{ {
finesine[i] = (angle_t)(FRACUNIT * sin (i*pimul)); finesine[i] = (fixed_t)(FRACUNIT * sin (i*pimul));
} }
for (i = 0; i < FINEANGLES/4; i++) for (i = 0; i < FINEANGLES/4; i++)
{ {

View File

@ -1854,7 +1854,7 @@ void S_ChannelEnded(FISoundChannel *ichan)
{ {
evicted = true; evicted = true;
} }
else else if (schan->SfxInfo != NULL)
{ {
unsigned int pos = GSnd->GetPosition(schan); unsigned int pos = GSnd->GetPosition(schan);
unsigned int len = GSnd->GetSampleLength(schan->SfxInfo->data); unsigned int len = GSnd->GetSampleLength(schan->SfxInfo->data);
@ -1867,6 +1867,10 @@ void S_ChannelEnded(FISoundChannel *ichan)
evicted = (pos < len); evicted = (pos < len);
} }
} }
else
{
evicted = false;
}
if (!evicted) if (!evicted)
{ {
S_ReturnChannel(schan); S_ReturnChannel(schan);

View File

@ -1149,7 +1149,7 @@ DEFINE_PROPERTY(damagetype, S, Actor)
DEFINE_PROPERTY(damagefactor, SF, Actor) DEFINE_PROPERTY(damagefactor, SF, Actor)
{ {
PROP_STRING_PARM(str, 0); PROP_STRING_PARM(str, 0);
PROP_FIXED_PARM(id, 0); PROP_FIXED_PARM(id, 1);
if (bag.Info->DamageFactors == NULL) bag.Info->DamageFactors=new DmgFactors; if (bag.Info->DamageFactors == NULL) bag.Info->DamageFactors=new DmgFactors;