- 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
- Moved the vid_fps display to the upper-right of the screen.
- The stat display can now show multiple stats at once.

View File

@ -2043,38 +2043,10 @@ showme:
void DLevelScript::DoSetFont (int fontnum)
{
const char *fontname = FBehavior::StaticLookupString (fontnum);
activefont = FFont::FindFont (fontname);
activefont = V_GetFont (fontname);
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)
{

View File

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

View File

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

View File

@ -563,6 +563,9 @@ bool AActor::SetState (FState *newstate)
CallingState = newstate;
newstate->GetAction() (this);
// Check whether the called action function resulted in destroying the actor
if (ObjectFlags & OF_MassDestruction) return false;
}
newstate = newstate->GetNextState();
} 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.
mobj->ObtainInventory (oldactor);
FBehavior::StaticStopMyScripts (oldactor); // cancel all ENTER/RESPAWN scripts for the voodoo doll
}
// [GRB] Reset skin

View File

@ -802,7 +802,7 @@ void R_UpdateAnimations (DWORD mstime)
}
// Scroll the sky
double ms = mstime * FRACUNIT;
double ms = (double)mstime * FRACUNIT;
sky1pos = fixed_t(fmod (ms * level.skyspeed1, double(TexMan[sky1texture]->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_ThrowGrenade, "Mxxxy" )
FUNC(A_SelectWeapon, "M")
FUNC(A_Print, "T")
FUNC(A_Print, "Txt")
FUNC(A_SetTranslucent, "Xx")
FUNC(A_FadeIn, "x")
FUNC(A_FadeOut, "x")
@ -712,7 +712,7 @@ AFuncDesc AFTable[]=
FUNC(A_GiveToTarget, "Mx" )
FUNC(A_TakeFromTarget, "Mx" )
FUNC(A_CountdownArg, "X")
FUNC(A_CustomMeleeAttack, "XXXsty" )
FUNC(A_CustomMeleeAttack, "Xsty" )
FUNC(A_Burst, "M")
FUNC(A_RadiusThrust, "xxy")
{"A_Explode", A_ExplodeParms, "xxy" },
@ -2414,8 +2414,8 @@ static void ActorDamage (AActor *defaults, Baggage &bag)
if (SC_CheckString ("("))
{
SC_UnGet();
defaults->Damage = 0x40000000 | ParseExpression (false);
SC_MustGetStringName(")");
}
else
{

View File

@ -64,13 +64,13 @@
#include "a_sharedglobal.h"
#include "a_doomglobal.h"
#include "thingdef.h"
#include "v_video.h"
static FRandom pr_camissile ("CustomActorfire");
static FRandom pr_camelee ("CustomMelee");
static FRandom pr_cabullet ("CustomBullet");
static FRandom pr_cajump ("CustomJump");
static FRandom pr_custommelee ("CustomMelee2");
static FRandom pr_cwbullet ("CustomWpBullet");
static FRandom pr_cwjump ("CustomWpJump");
static FRandom pr_cwpunch ("CustomWpPunch");
@ -750,15 +750,13 @@ void A_CustomBulletAttack (AActor *self)
//==========================================================================
void A_CustomMeleeAttack (AActor *self)
{
int index=CheckIndex(6);
int index=CheckIndex(4);
if (index<0) return;
int Multiplier = EvalExpressionI (StateParameters[index], self);
int Modulus = EvalExpressionI (StateParameters[index+1], self);
int Adder = EvalExpressionI (StateParameters[index+2], self);
int MeleeSound=StateParameters[index+3];
ENamedName DamageType = (ENamedName)StateParameters[index+4];
bool bleed = EvalExpressionN (StateParameters[index+5], self);
int damage = EvalExpressionI (StateParameters[index], self);
int MeleeSound=StateParameters[index+1];
ENamedName DamageType = (ENamedName)StateParameters[index+2];
bool bleed = EvalExpressionN (StateParameters[index+3], self);
int mod;
// 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);
if (self->CheckMeleeRange ())
{
int damage = ((pr_custommelee()%Modulus)*Multiplier)+Adder;
if (MeleeSound) S_SoundID (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM);
P_DamageMobj (self->target, self, self, damage, MOD_HIT);
if (bleed) P_TraceBleed (damage, self->target, self);
@ -1367,15 +1364,35 @@ void A_SelectWeapon(AActor * actor)
// A_Print
//
//===========================================================================
EXTERN_CVAR(Float, con_midtime)
void A_Print(AActor * actor)
{
int index=CheckIndex(1, NULL);
int index=CheckIndex(3, NULL);
if (index<0) return;
if (actor->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());
screen->SetFont(oldfont);
con_midtime = saved;
}
}

View File

@ -164,6 +164,39 @@ static TArray<TranslationMap> TranslationLookup;
// CODE --------------------------------------------------------------------
FFont * V_GetFont(const char *name)
{
FFont *font = FFont::FindFont (name);
if (font == NULL)
{
int lump = Wads.CheckNumForName (name);
if (lump != -1)
{
char head[3];
{
FWadLump lumpy = Wads.OpenLumpNum (lump);
lumpy.Read (head, 3);
}
if (head[0] == 'F' && head[1] == 'O' && head[2] == 'N')
{
font = new FSingleLumpFont (name, lump);
}
}
if (font == NULL)
{
int picnum = TexMan.CheckForTexture (name, FTexture::TEX_Any);
if (picnum <= 0)
{
picnum = TexMan.AddPatch (name);
}
if (picnum > 0)
{
font = new FSingleLumpFont (name, -1);
}
}
}
return font;
}
//==========================================================================
//
// SerializeFFontPtr
@ -181,39 +214,11 @@ FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font)
char *name = NULL;
arc << name;
font = FFont::FindFont (name);
font = V_GetFont(name);
if (font == NULL)
{
int lump = Wads.CheckNumForName (name);
if (lump != -1)
{
char head[3];
{
FWadLump lumpy = Wads.OpenLumpNum (lump);
lumpy.Read (head, 3);
}
if (head[0] == 'F' && head[1] == 'O' && head[2] == 'N')
{
font = new FSingleLumpFont (name, lump);
}
}
if (font == NULL)
{
int picnum = TexMan.CheckForTexture (name, FTexture::TEX_Any);
if (picnum <= 0)
{
picnum = TexMan.AddPatch (name);
}
if (picnum > 0)
{
font = new FSingleLumpFont (name, -1);
}
}
if (font == NULL)
{
Printf ("Could not load font %s\n", name);
font = SmallFont;
}
Printf ("Could not load font %s\n", name);
font = SmallFont;
}
delete[] name;
}

View File

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

View File

@ -30,7 +30,7 @@ ACTOR Beggar : StrifeHumanoid
Loop
Melee:
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 D 8 A_SentinelRefire
Loop

View File

@ -29,7 +29,7 @@ ACTOR Peasant : StrifeHumanoid
Loop
Melee:
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
Goto See
Pain: