mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
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).
This commit is contained in:
parent
cab39973df
commit
e7b9e7e955
5 changed files with 40 additions and 11 deletions
|
@ -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__)
|
|
@ -192,6 +192,7 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
|||
PFunction *afd, FString statestring, FStateDefinitions *statedef);
|
||||
FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Baggage &bag, PPrototype *&proto, bool &endswithret);
|
||||
class FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag);
|
||||
FName CheckCastKludges(FName in);
|
||||
void AddImplicitReturn(class FxSequence *code, const PPrototype *proto, FScanner &sc);
|
||||
void SetImplicitArgs(TArray<PType *> *args, TArray<DWORD> *argflags, PClassActor *cls, DWORD funcflags);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -555,7 +555,9 @@ FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, B
|
|||
return call;
|
||||
}
|
||||
|
||||
PFunction *afd = dyn_cast<PFunction>(bag.Info->Symbols.FindSymbol(FName(sc.String, true), true));
|
||||
FName symname = FName(sc.String, true);
|
||||
symname = CheckCastKludges(symname);
|
||||
PFunction *afd = dyn_cast<PFunction>(bag.Info->Symbols.FindSymbol(symname, true));
|
||||
if (afd != NULL)
|
||||
{
|
||||
FArgumentList *args = new FArgumentList;
|
||||
|
@ -678,3 +680,24 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
|||
sc.MustGetStringName(")");
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CheckCastKludges
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FName CheckCastKludges(FName in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case NAME_Int:
|
||||
return NAME___decorate_internal_int__;
|
||||
case NAME_Bool:
|
||||
return NAME___decorate_internal_bool__;
|
||||
case NAME_State:
|
||||
return NAME___decorate_internal_state__;
|
||||
default:
|
||||
return in;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,6 @@ ACTOR Actor native //: Thinker
|
|||
native int CountInv(class<Inventory> 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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue