From bf6304158509db2411446265934103c81ca14495 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 6 Jan 2009 00:03:18 +0000 Subject: [PATCH] - fixed: Parsing of color strings with 6 characters and spaces did not work. - fixed: State labels must be evaluated for the state's owner, not the calling actor. SVN r1354 (trunk) --- docs/rh-log.txt | 4 ++++ src/dobjtype.h | 2 +- src/info.h | 4 ++-- src/p_mobj.cpp | 2 +- src/p_pspr.cpp | 2 +- src/thingdef/thingdef.h | 18 +++++++++--------- src/thingdef/thingdef_codeptr.cpp | 2 +- src/thingdef/thingdef_expression.cpp | 2 +- src/v_video.cpp | 2 ++ 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 96e0f836f..b2269ee37 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +January 5, 2009 (Changes by Graf Zahl) +- fixed: Parsing of color strings with 6 characters and spaces did not work. +- fixed: State labels must be evaluated for the state's owner, not the calling actor. + January 4, 2009 (Changes by Graf Zahl) - Fixed: For map spawns any change to an actor's floor z-coordinate must be delayed until after its z-coordinate has been set. That means that for diff --git a/src/dobjtype.h b/src/dobjtype.h index 98092d60a..88defaefe 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -72,7 +72,7 @@ struct PSymbolVariable : public PSymbol // parameters passed. struct FState; struct StateCallData; -typedef void (*actionf_p)(AActor *self, FState *state, int parameters, StateCallData *statecall); +typedef void (*actionf_p)(AActor *self, AActor *stateowner, FState *state, int parameters, StateCallData *statecall); struct PSymbolActionFunction : public PSymbol { diff --git a/src/info.h b/src/info.h index 6debadfea..194546e48 100644 --- a/src/info.h +++ b/src/info.h @@ -104,11 +104,11 @@ struct FState if (setdefaultparams) ParameterIndex = 0; } } - inline bool CallAction(AActor *self, StateCallData *statecall = NULL) + inline bool CallAction(AActor *self, AActor *stateowner, StateCallData *statecall = NULL) { if (ActionFunc != NULL) { - ActionFunc(self, this, ParameterIndex-1, statecall); + ActionFunc(self, stateowner, this, ParameterIndex-1, statecall); return true; } else diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 385b2a8ea..f908bf2ce 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -520,7 +520,7 @@ bool AActor::SetState (FState *newstate) } } - if (newstate->CallAction(this)) + if (newstate->CallAction(this, this)) { // Check whether the called action function resulted in destroying the actor if (ObjectFlags & OF_EuthanizeMe) diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index dae12a868..1e1bdf2d6 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -99,7 +99,7 @@ void P_SetPsprite (player_t *player, int position, FState *state) if (player->mo != NULL) { - if (state->CallAction(player->mo)) + if (state->CallAction(player->mo, player->ReadyWeapon)) { if (!psp->state) { diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index d2d4d9214..14150d30a 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -351,26 +351,26 @@ struct StateCallData // Macros to handle action functions. These are here so that I don't have to // change every single use in case the parameters change. -#define DECLARE_ACTION(name) void AF_##name(AActor *self, FState *, int, StateCallData *); +#define DECLARE_ACTION(name) void AF_##name(AActor *self, AActor *stateowner, FState *, int, StateCallData *); // This distinction is here so that CALL_ACTION produces errors when trying to // access a function that requires parameters. #define DEFINE_ACTION_FUNCTION(cls, name) \ - void AF_##name (AActor *self, FState *, int, StateCallData *); \ + void AF_##name (AActor *self, AActor *stateowner, FState *, int, StateCallData *); \ static AFuncDesc info_##cls##_##name = { #name, AF_##name }; \ MSVC_ASEG AFuncDesc *infoptr_##cls##_##name GCC_ASEG = &info_##cls##_##name; \ - void AF_##name (AActor *self, FState *, int, StateCallData *statecall) + void AF_##name (AActor *self, AActor *stateowner, FState *, int, StateCallData *statecall) #define DEFINE_ACTION_FUNCTION_PARAMS(cls, name) \ - void AFP_##name (AActor *self, FState *CallingState, int ParameterIndex, StateCallData *statecall); \ + void AFP_##name (AActor *self, AActor *stateowner, FState *CallingState, int ParameterIndex, StateCallData *statecall); \ static AFuncDesc info_##cls##_##name = { #name, AFP_##name }; \ MSVC_ASEG AFuncDesc *infoptr_##cls##_##name GCC_ASEG = &info_##cls##_##name; \ - void AFP_##name (AActor *self, FState *CallingState, int ParameterIndex, StateCallData *statecall) + void AFP_##name (AActor *self, AActor *stateowner, FState *CallingState, int ParameterIndex, StateCallData *statecall) -#define DECLARE_PARAMINFO AActor *self, FState *CallingState, int ParameterIndex, StateCallData *statecall -#define PUSH_PARAMINFO self, CallingState, ParameterIndex, statecall +#define DECLARE_PARAMINFO AActor *self, AActor *stateowner, FState *CallingState, int ParameterIndex, StateCallData *statecall +#define PUSH_PARAMINFO self, stateowner, CallingState, ParameterIndex, statecall -#define CALL_ACTION(name,self) AF_##name(self, NULL, 0, NULL) +#define CALL_ACTION(name,self) AF_##name(self, self, NULL, 0, NULL) int EvalExpressionI (DWORD x, AActor *self); @@ -395,7 +395,7 @@ FName EvalExpressionName (DWORD x, AActor *self); #define ACTION_PARAM_CLASS(var,i) \ const PClass *var = EvalExpressionClass(ParameterIndex+i, self); #define ACTION_PARAM_STATE(var,i) \ - FState *var = EvalExpressionState(ParameterIndex+i, self); + FState *var = EvalExpressionState(ParameterIndex+i, stateowner); #define ACTION_PARAM_COLOR(var,i) \ PalEntry var = EvalExpressionCol(ParameterIndex+i, self); #define ACTION_PARAM_SOUND(var,i) \ diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 73345e061..f63441416 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -103,7 +103,7 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState * State) // Assume success. The code pointer will set this to false if necessary StateCall.State = State; StateCall.Result = true; - if (State->CallAction(actor, &StateCall)) + if (State->CallAction(actor, this, &StateCall)) { // collect all the results. Even one successful call signifies overall success. result |= StateCall.Result; diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index ddbf3851f..116b58544 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -2611,7 +2611,7 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx) CHECKRESOLVED(); if (names[0] == NAME_None) { - scope = ctx.cls; + scope = NULL; } else if (names[0] == NAME_Super) { diff --git a/src/v_video.cpp b/src/v_video.cpp index 32e70866b..c6710197c 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -465,9 +465,11 @@ int V_GetColorFromString (const DWORD *palette, const char *cstr) c[1] = (color & 0xff00) >> 8; c[2] = (color & 0xff); } + else goto normal; } else { +normal: // Treat it as a space-delemited hexadecimal string for (i = 0; i < 3; ++i) {