diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c5daa2696..8ed5a33ff 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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. diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index f65744249..a07fd1a50 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -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)); diff --git a/src/sc_man.cpp b/src/sc_man.cpp index b2226240a..b0e35fe30 100644 --- a/src/sc_man.cpp +++ b/src/sc_man.cpp @@ -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) { diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 9ab6b8a94..aa6e1be35 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -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("::"); diff --git a/src/thingdef_codeptr.cpp b/src/thingdef_codeptr.cpp index d6eb5c5c0..04b139ff5 100644 --- a/src/thingdef_codeptr.cpp +++ b/src/thingdef_codeptr.cpp @@ -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)