From e7b9e7e95509832f32dae330eb53e250d5a7eea3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 20 Feb 2016 22:05:17 -0600 Subject: [PATCH] Rename A_Int/A_Bool/A_State to int/bool/state - This is an effort to emphasize that these are just type casts. Now they look like function-style casts with no action function styling. They do no magic joojoo at all. The only reason they exist is because the DECORATE parser can only parse return statements that call a function, so these satisfy that requirement. i.e. *return int(666);* is identical to *return 666;* (if the parser could handle the latter). --- src/namedef.h | 4 ++++ src/thingdef/thingdef.h | 1 + src/thingdef/thingdef_codeptr.cpp | 12 ++++++------ src/thingdef/thingdef_states.cpp | 25 ++++++++++++++++++++++++- wadsrc/static/actors/actor.txt | 9 +++++---- 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/namedef.h b/src/namedef.h index e7af230254..323d6f29c4 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -673,3 +673,7 @@ xx(Max_Exp) xx(Mant_Dig) xx(Min_10_Exp) xx(Max_10_Exp) + +xx(__decorate_internal_int__) +xx(__decorate_internal_bool__) +xx(__decorate_internal_state__) \ No newline at end of file diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index f5f2d156c9..e2d8eb1f41 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -192,6 +192,7 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray *args, TArray *argflags, PClassActor *cls, DWORD funcflags); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 554ab0d64c..60e57f9a3f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -325,13 +325,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) //=========================================================================== // -// A_State +// __decorate_internal_state__ // // Returns the state passed in. // //=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_State) +DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_state__) { PARAM_PROLOGUE; PARAM_OBJECT(self, AActor); @@ -341,13 +341,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_State) //=========================================================================== // -// A_Int +// __decorate_internal_int__ // // Returns the int passed in. // //=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Int) +DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_int__) { PARAM_PROLOGUE; PARAM_OBJECT(self, AActor); @@ -357,13 +357,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Int) //=========================================================================== // -// A_Bool +// __decorate_internal_bool__ // // Returns the bool passed in. // //=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Bool) +DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_bool__) { PARAM_PROLOGUE; PARAM_OBJECT(self, AActor); diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index f90b34c47f..32a6b0913f 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -555,7 +555,9 @@ FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, B return call; } - PFunction *afd = dyn_cast(bag.Info->Symbols.FindSymbol(FName(sc.String, true), true)); + FName symname = FName(sc.String, true); + symname = CheckCastKludges(symname); + PFunction *afd = dyn_cast(bag.Info->Symbols.FindSymbol(symname, true)); if (afd != NULL) { FArgumentList *args = new FArgumentList; @@ -678,3 +680,24 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray itemtype, int ptr_select = AAPTR_DEFAULT); native float GetDistance(bool checkz, int ptr = AAPTR_DEFAULT); - native state A_State(state returnme); - native int A_Int(int returnme); - native bool A_Bool(bool returnme); - // Action functions // Meh, MBF redundant functions. Only for DeHackEd support. action native A_Turn(float angle = 0); @@ -353,4 +349,9 @@ ACTOR Actor native //: Thinker POL5 A -1 Stop } + + // Internal functions + native state __decorate_internal_state__(state); + native int __decorate_internal_int__(int); + native bool __decorate_internal_bool__(bool); }