- Fixed: The sky scrolling calculations caused an integer multiplication overflow.

- Fixed: Voodoo dolls should not start ENTER scripts.
- Fixed: ActorDamage must not parse the enclosing parentheses as part of the 
  expression. That will produce an error if a flag set or clear command immediately
  follows.
- Fixed: P_DamageMobj ignored MF2_NODMGTHRUST if the damaging object had no
  owner.
- Added a 'font' parameter to A_Print.
- Changed A_CustomMeleeAttack to take one damage parameter only. Since expressions
  can be used this value is not used as a factor for a random value but as
  a direct damage value instead.
- Fixed: AActor::SetState must check whether a called action function resulted
  in the actor's destruction. A_Jump constructs to a 0-length terminating
  state will hang if this isn't checked.



SVN r329 (trunk)
This commit is contained in:
Christoph Oelckers 2006-09-17 10:43:51 +00:00
parent b951721c1b
commit 782b8a3b92
12 changed files with 93 additions and 79 deletions

View file

@ -1,3 +1,19 @@
September 17, 2006 (Changes by Graf Zahl)
- Fixed: The sky scrolling calculations caused an integer multiplication overflow.
- Fixed: Voodoo dolls should not start ENTER scripts.
- Fixed: ActorDamage must not parse the enclosing parentheses as part of the
expression. That will produce an error if a flag set or clear command immediately
follows.
- Fixed: P_DamageMobj ignored MF2_NODMGTHRUST if the damaging object had no
owner.
- Added a 'font' parameter to A_Print.
- Changed A_CustomMeleeAttack to take one damage parameter only. Since expressions
can be used this value is not used as a factor for a random value but as
a direct damage value instead.
- Fixed: AActor::SetState must check whether a called action function resulted
in the actor's destruction. A_Jump constructs to a 0-length terminating
state will hang if this isn't checked.
September 13, 2006 September 13, 2006
- Moved the vid_fps display to the upper-right of the screen. - Moved the vid_fps display to the upper-right of the screen.
- The stat display can now show multiple stats at once. - The stat display can now show multiple stats at once.

View file

@ -2043,39 +2043,11 @@ showme:
void DLevelScript::DoSetFont (int fontnum) void DLevelScript::DoSetFont (int fontnum)
{ {
const char *fontname = FBehavior::StaticLookupString (fontnum); const char *fontname = FBehavior::StaticLookupString (fontnum);
activefont = FFont::FindFont (fontname); activefont = V_GetFont (fontname);
if (activefont == NULL) if (activefont == NULL)
{
int num = Wads.CheckNumForName (fontname);
if (num != -1)
{
char head[3];
{
FWadLump lump = Wads.OpenLumpNum (num);
lump.Read (head, 3);
}
if (head[0] == 'F' && head[1] == 'O' && head[2] == 'N')
{
activefont = new FSingleLumpFont (fontname, num);
}
}
if (activefont == NULL)
{
num = TexMan.CheckForTexture (fontname, FTexture::TEX_Any);
if (num <= 0)
{
num = TexMan.AddPatch(fontname);
}
if (num > 0)
{
activefont = new FSingleLumpFont (fontname, -1);
}
else
{ {
activefont = SmallFont; activefont = SmallFont;
} }
}
}
if (screen != NULL) if (screen != NULL)
{ {
screen->SetFont (activefont); screen->SetFont (activefont);

View file

@ -909,7 +909,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
// (i.e. Guantlets/Chainsaw) // (i.e. Guantlets/Chainsaw)
if (inflictor && inflictor != target // [RH] Not if hurting own self if (inflictor && inflictor != target // [RH] Not if hurting own self
&& !(target->flags & MF_NOCLIP) && !(target->flags & MF_NOCLIP)
&& (!source || !source->player || !(inflictor->flags2 & MF2_NODMGTHRUST))) && !(inflictor->flags2 & MF2_NODMGTHRUST))
{ {
int kickback; int kickback;

View file

@ -1426,7 +1426,6 @@ AActor *P_CheckOnmobj (AActor *thing)
oldz = thing->z; oldz = thing->z;
P_FakeZMovement (thing); P_FakeZMovement (thing);
good = P_TestMobjZ (thing, false); good = P_TestMobjZ (thing, false);
thing->z = oldz; thing->z = oldz;
return good ? NULL : onmobj; return good ? NULL : onmobj;

View file

@ -563,6 +563,9 @@ bool AActor::SetState (FState *newstate)
CallingState = newstate; CallingState = newstate;
newstate->GetAction() (this); newstate->GetAction() (this);
// Check whether the called action function resulted in destroying the actor
if (ObjectFlags & OF_MassDestruction) return false;
} }
newstate = newstate->GetNextState(); newstate = newstate->GetNextState();
} while (tics == 0); } while (tics == 0);
@ -3437,6 +3440,7 @@ void P_SpawnPlayer (mapthing2_t *mthing, bool startenterscripts)
{ {
// Move the voodoo doll's inventory to the new player. // Move the voodoo doll's inventory to the new player.
mobj->ObtainInventory (oldactor); mobj->ObtainInventory (oldactor);
FBehavior::StaticStopMyScripts (oldactor); // cancel all ENTER/RESPAWN scripts for the voodoo doll
} }
// [GRB] Reset skin // [GRB] Reset skin

View file

@ -802,7 +802,7 @@ void R_UpdateAnimations (DWORD mstime)
} }
// Scroll the sky // Scroll the sky
double ms = mstime * FRACUNIT; double ms = (double)mstime * FRACUNIT;
sky1pos = fixed_t(fmod (ms * level.skyspeed1, double(TexMan[sky1texture]->GetWidth() << FRACBITS))); sky1pos = fixed_t(fmod (ms * level.skyspeed1, double(TexMan[sky1texture]->GetWidth() << FRACBITS)));
sky2pos = fixed_t(fmod (ms * level.skyspeed2, double(TexMan[sky2texture]->GetWidth() << FRACBITS))); sky2pos = fixed_t(fmod (ms * level.skyspeed2, double(TexMan[sky2texture]->GetWidth() << FRACBITS)));
} }

View file

@ -685,7 +685,7 @@ AFuncDesc AFTable[]=
FUNC(A_SpawnItem, "Mxxyx" ) FUNC(A_SpawnItem, "Mxxyx" )
FUNC(A_ThrowGrenade, "Mxxxy" ) FUNC(A_ThrowGrenade, "Mxxxy" )
FUNC(A_SelectWeapon, "M") FUNC(A_SelectWeapon, "M")
FUNC(A_Print, "T") FUNC(A_Print, "Txt")
FUNC(A_SetTranslucent, "Xx") FUNC(A_SetTranslucent, "Xx")
FUNC(A_FadeIn, "x") FUNC(A_FadeIn, "x")
FUNC(A_FadeOut, "x") FUNC(A_FadeOut, "x")
@ -712,7 +712,7 @@ AFuncDesc AFTable[]=
FUNC(A_GiveToTarget, "Mx" ) FUNC(A_GiveToTarget, "Mx" )
FUNC(A_TakeFromTarget, "Mx" ) FUNC(A_TakeFromTarget, "Mx" )
FUNC(A_CountdownArg, "X") FUNC(A_CountdownArg, "X")
FUNC(A_CustomMeleeAttack, "XXXsty" ) FUNC(A_CustomMeleeAttack, "Xsty" )
FUNC(A_Burst, "M") FUNC(A_Burst, "M")
FUNC(A_RadiusThrust, "xxy") FUNC(A_RadiusThrust, "xxy")
{"A_Explode", A_ExplodeParms, "xxy" }, {"A_Explode", A_ExplodeParms, "xxy" },
@ -2414,8 +2414,8 @@ static void ActorDamage (AActor *defaults, Baggage &bag)
if (SC_CheckString ("(")) if (SC_CheckString ("("))
{ {
SC_UnGet();
defaults->Damage = 0x40000000 | ParseExpression (false); defaults->Damage = 0x40000000 | ParseExpression (false);
SC_MustGetStringName(")");
} }
else else
{ {

View file

@ -64,13 +64,13 @@
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "a_doomglobal.h" #include "a_doomglobal.h"
#include "thingdef.h" #include "thingdef.h"
#include "v_video.h"
static FRandom pr_camissile ("CustomActorfire"); static FRandom pr_camissile ("CustomActorfire");
static FRandom pr_camelee ("CustomMelee"); static FRandom pr_camelee ("CustomMelee");
static FRandom pr_cabullet ("CustomBullet"); static FRandom pr_cabullet ("CustomBullet");
static FRandom pr_cajump ("CustomJump"); static FRandom pr_cajump ("CustomJump");
static FRandom pr_custommelee ("CustomMelee2");
static FRandom pr_cwbullet ("CustomWpBullet"); static FRandom pr_cwbullet ("CustomWpBullet");
static FRandom pr_cwjump ("CustomWpJump"); static FRandom pr_cwjump ("CustomWpJump");
static FRandom pr_cwpunch ("CustomWpPunch"); static FRandom pr_cwpunch ("CustomWpPunch");
@ -750,15 +750,13 @@ void A_CustomBulletAttack (AActor *self)
//========================================================================== //==========================================================================
void A_CustomMeleeAttack (AActor *self) void A_CustomMeleeAttack (AActor *self)
{ {
int index=CheckIndex(6); int index=CheckIndex(4);
if (index<0) return; if (index<0) return;
int Multiplier = EvalExpressionI (StateParameters[index], self); int damage = EvalExpressionI (StateParameters[index], self);
int Modulus = EvalExpressionI (StateParameters[index+1], self); int MeleeSound=StateParameters[index+1];
int Adder = EvalExpressionI (StateParameters[index+2], self); ENamedName DamageType = (ENamedName)StateParameters[index+2];
int MeleeSound=StateParameters[index+3]; bool bleed = EvalExpressionN (StateParameters[index+3], self);
ENamedName DamageType = (ENamedName)StateParameters[index+4];
bool bleed = EvalExpressionN (StateParameters[index+5], self);
int mod; int mod;
// This needs to be redesigned once the customizable damage type system is working // This needs to be redesigned once the customizable damage type system is working
@ -773,7 +771,6 @@ void A_CustomMeleeAttack (AActor *self)
A_FaceTarget (self); A_FaceTarget (self);
if (self->CheckMeleeRange ()) if (self->CheckMeleeRange ())
{ {
int damage = ((pr_custommelee()%Modulus)*Multiplier)+Adder;
if (MeleeSound) S_SoundID (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM); if (MeleeSound) S_SoundID (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM);
P_DamageMobj (self->target, self, self, damage, MOD_HIT); P_DamageMobj (self->target, self, self, damage, MOD_HIT);
if (bleed) P_TraceBleed (damage, self->target, self); if (bleed) P_TraceBleed (damage, self->target, self);
@ -1367,15 +1364,35 @@ void A_SelectWeapon(AActor * actor)
// A_Print // A_Print
// //
//=========================================================================== //===========================================================================
EXTERN_CVAR(Float, con_midtime)
void A_Print(AActor * actor) void A_Print(AActor * actor)
{ {
int index=CheckIndex(1, NULL); int index=CheckIndex(3, NULL);
if (index<0) return; if (index<0) return;
if (actor->CheckLocalView (consoleplayer) || if (actor->CheckLocalView (consoleplayer) ||
(actor->target!=NULL && actor->target->CheckLocalView (consoleplayer))) (actor->target!=NULL && actor->target->CheckLocalView (consoleplayer)))
{ {
float time = EvalExpressionF (StateParameters[index+1], actor);
FName fontname = (ENamedName)StateParameters[index+2];
FFont * oldfont = screen->Font;
float saved = con_midtime;
if (fontname != NAME_None)
{
FFont * font = V_GetFont(fontname);
if (font != NULL) screen->SetFont(font);
}
if (time > 0)
{
con_midtime = time;
}
C_MidPrint(FName((ENamedName)StateParameters[index]).GetChars()); C_MidPrint(FName((ENamedName)StateParameters[index]).GetChars());
screen->SetFont(oldfont);
con_midtime = saved;
} }
} }

View file

@ -164,24 +164,9 @@ static TArray<TranslationMap> TranslationLookup;
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
//========================================================================== FFont * V_GetFont(const char *name)
//
// SerializeFFontPtr
//
//==========================================================================
FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font)
{ {
if (arc.IsStoring ()) FFont *font = FFont::FindFont (name);
{
arc << font->Name;
}
else
{
char *name = NULL;
arc << name;
font = FFont::FindFont (name);
if (font == NULL) if (font == NULL)
{ {
int lump = Wads.CheckNumForName (name); int lump = Wads.CheckNumForName (name);
@ -209,12 +194,32 @@ FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font)
font = new FSingleLumpFont (name, -1); font = new FSingleLumpFont (name, -1);
} }
} }
}
return font;
}
//==========================================================================
//
// SerializeFFontPtr
//
//==========================================================================
FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font)
{
if (arc.IsStoring ())
{
arc << font->Name;
}
else
{
char *name = NULL;
arc << name;
font = V_GetFont(name);
if (font == NULL) if (font == NULL)
{ {
Printf ("Could not load font %s\n", name); Printf ("Could not load font %s\n", name);
font = SmallFont; font = SmallFont;
} }
}
delete[] name; delete[] name;
} }
return arc; return arc;

View file

@ -152,5 +152,6 @@ extern FFont *SmallFont, *SmallFont2, *BigFont, *ConFont;
void V_InitCustomFonts (); void V_InitCustomFonts ();
void V_InitFontColors (); void V_InitFontColors ();
EColorRange V_FindFontColor (FName name); EColorRange V_FindFontColor (FName name);
FFont * V_GetFont(const char *);
#endif //__V_FONT_H__ #endif //__V_FONT_H__

View file

@ -30,7 +30,7 @@ ACTOR Beggar : StrifeHumanoid
Loop Loop
Melee: Melee:
BEGR D 8 BEGR D 8
BEGR D 8 A_CustomMeleeAttack(2, 5, 2) BEGR D 8 A_CustomMeleeAttack(2*random(1,5)+2)
BEGR E 1 A_Chase BEGR E 1 A_Chase
BEGR D 8 A_SentinelRefire BEGR D 8 A_SentinelRefire
Loop Loop

View file

@ -29,7 +29,7 @@ ACTOR Peasant : StrifeHumanoid
Loop Loop
Melee: Melee:
PEAS E 10 A_FaceTarget PEAS E 10 A_FaceTarget
PEAS F 8 A_CustomMeleeAttack(2, 5, 2) PEAS F 8 A_CustomMeleeAttack(2*random(1,5)+2)
PEAS E 8 PEAS E 8
Goto See Goto See
Pain: Pain: