- Fixed: There was no working means to pass 'no state' to A_Chase.

Now 0 or an empty string will do that.
- Copied the empty string fix for SC_CheckNumber to SC_CheckFloat.

SVN r591 (trunk)
This commit is contained in:
Christoph Oelckers 2007-12-09 09:54:58 +00:00
parent 6a00173a12
commit b8827b1b86
5 changed files with 27 additions and 7 deletions

View file

@ -1,3 +1,8 @@
December 9, 2007 (Changes by Graf Zahl)
- Fixed: There was no working means to pass 'no state' to A_Chase.
Now 0 or an empty string will do that.
- Copied the empty string fix for SC_CheckNumber to SC_CheckFloat.
December 8, 2007
- Fixed: SECSPAC_EyesSurface and SECSPAC_EyesDive did not trigger due to
crouching motion.

View file

@ -2286,8 +2286,8 @@ void A_Chase (AActor *actor)
int flags = EvalExpressionI (StateParameters[index+2], actor);
if (flags & CHF_RESURRECT && P_CheckForResurrection(actor, false)) return;
FState *melee = StateParameters[index]==0? NULL : P_GetState(actor, CallingState, StateParameters[index]);
FState *missile = StateParameters[index+1]==0? NULL : P_GetState(actor, CallingState, StateParameters[index+1]);
FState *melee = P_GetState(actor, CallingState, StateParameters[index]);
FState *missile = P_GetState(actor, CallingState, StateParameters[index+1]);
A_DoChase(actor, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE),
!!(flags&CHF_NIGHTMAREFAST), !!(flags&CHF_DONTMOVE));

View file

@ -586,6 +586,12 @@ bool SC_CheckFloat (void)
//CheckOpen ();
if (SC_GetString())
{
if (sc_String[0] == 0)
{
SC_UnGet();
return false;
}
sc_Float = strtod (sc_String, &stopper);
if (*stopper != 0)
{

View file

@ -767,13 +767,13 @@ do_stop:
if (SC_CheckNumber())
{
if (strlen(statestring)>0)
if (sc_Number > 0 && strlen(statestring)>0)
{
SC_ScriptError("You cannot use A_Jump commands with a jump index on multistate definitions\n");
SC_ScriptError("You cannot use state jumps commands with a jump offset on multistate definitions\n");
}
v=sc_Number;
if (v<1)
if (v<0)
{
SC_ScriptError("Negative jump offsets are not allowed");
}
@ -790,6 +790,11 @@ do_stop:
v = -(int)JumpParameters.Size();
// This forces quotation marks around the state name.
SC_MustGetToken(TK_StringConst);
if (sc_String[0] == 0 || SC_Compare("None"))
{
v = 0; // an empty string means 'no state'.
break;
}
FString statestring = sc_String; // ParseStateString();
const PClass *stype=NULL;
int scope = statestring.IndexOf("::");

View file

@ -398,7 +398,11 @@ void A_BulletAttack (AActor *self)
FState *P_GetState(AActor *self, FState *CallingState, int offset)
{
if (offset>=0)
if (offset == 0)
{
return NULL; // 0 means 'no state'
}
else if (offset>0)
{
return CallingState + offset;
}
@ -410,7 +414,7 @@ FState *P_GetState(AActor *self, FState *CallingState, int offset)
const PClass *cls;
cls = classname==NAME_None? RUNTIME_TYPE(self) : PClass::FindClass(classname);
if (cls==NULL || cls->ActorInfo==NULL) return NULL; // shouldn't happen
int numnames = (int)JumpParameters[offset+1];
FState *jumpto = cls->ActorInfo->FindState(numnames, &JumpParameters[offset+2]);
if (jumpto == NULL)