- Fixed: The save percentage for Doom's green armor was slightly too low

which caused roundoff errors that made it less than 1/3 effective.
- Added support for "RRGGBB" strings to V_GetColor.
- Fixed: Desaturation maps for the TEXTURES lump were calculated incorrectly.
- Changed GetSpriteIndex to cache the last used sprite name so that the code
  using this function doesn't have to do it itself.
- Moved some more code for the state parser into p_states.cpp.
- Fixed: TDeletingArray should not try to delete NULL pointers.

SVN r1312 (trunk)
This commit is contained in:
Christoph Oelckers 2008-12-07 12:11:59 +00:00
commit 081658d3d5
24 changed files with 1978 additions and 1901 deletions

View file

@ -1601,9 +1601,13 @@ ExpVal FxAbs::EvalExpression (AActor *self)
FxRandom::FxRandom(FRandom * r, FxExpression *mi, FxExpression *ma, const FScriptPosition &pos)
: FxExpression(pos)
{
if (mi != NULL && ma != NULL)
{
min = new FxIntCast(mi);
max = new FxIntCast(ma);
}
else min = max = NULL;
rng = r;
min = new FxIntCast(mi);
max = new FxIntCast(ma);
ValueType = VAL_Int;
}
@ -1646,18 +1650,26 @@ FxExpression *FxRandom::Resolve(FCompileContext &ctx)
ExpVal FxRandom::EvalExpression (AActor *self)
{
int minval = min->EvalExpression (self).GetInt();
int maxval = max->EvalExpression (self).GetInt();
ExpVal val;
val.Type = VAL_Int;
if (maxval < minval)
if (min != NULL && max != NULL)
{
swap (maxval, minval);
}
int minval = min->EvalExpression (self).GetInt();
int maxval = max->EvalExpression (self).GetInt();
val.Int = (*rng)(maxval - minval + 1) + minval;
if (maxval < minval)
{
swap (maxval, minval);
}
val.Int = (*rng)(maxval - minval + 1) + minval;
}
else
{
val.Int = (*rng)();
}
return val;
}