Add float casts to DECORATE for the sake of completeness

This commit is contained in:
Randy Heit 2016-03-01 11:36:15 -06:00
parent 55142078d8
commit c160121f45
5 changed files with 25 additions and 19 deletions

View file

@ -690,4 +690,5 @@ xx(Max_10_Exp)
xx(__decorate_internal_int__) xx(__decorate_internal_int__)
xx(__decorate_internal_bool__) xx(__decorate_internal_bool__)
xx(__decorate_internal_state__) xx(__decorate_internal_state__)
xx(__decorate_internal_float__)

View file

@ -360,8 +360,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth)
//=========================================================================== //===========================================================================
// //
// __decorate_internal_state__ // __decorate_internal_state__
// __decorate_internal_int__
// __decorate_internal_bool__
// __decorate_internal_float__
// //
// Returns the state passed in. // Placeholders for forcing DECORATE to cast numbers. If actually called,
// returns whatever was passed.
// //
//=========================================================================== //===========================================================================
@ -373,14 +377,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_state__)
ACTION_RETURN_STATE(returnme); ACTION_RETURN_STATE(returnme);
} }
//===========================================================================
//
// __decorate_internal_int__
//
// Returns the int passed in.
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_int__) DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_int__)
{ {
PARAM_PROLOGUE; PARAM_PROLOGUE;
@ -389,14 +385,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_int__)
ACTION_RETURN_INT(returnme); ACTION_RETURN_INT(returnme);
} }
//===========================================================================
//
// __decorate_internal_bool__
//
// Returns the bool passed in.
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_bool__) DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_bool__)
{ {
PARAM_PROLOGUE; PARAM_PROLOGUE;
@ -405,6 +393,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_bool__)
ACTION_RETURN_BOOL(returnme); ACTION_RETURN_BOOL(returnme);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_float__)
{
PARAM_PROLOGUE;
PARAM_OBJECT(self, AActor);
PARAM_FLOAT(returnme);
if (numret > 0)
{
ret->SetFloat(returnme);
return 1;
}
return 0;
}
//========================================================================== //==========================================================================
// //
// A_RearrangePointers // A_RearrangePointers

View file

@ -3420,7 +3420,8 @@ bool FxVMFunctionCall::CheckEmitCast(VMFunctionBuilder *build, bool returnit, Ex
FName funcname = Function->SymbolName; FName funcname = Function->SymbolName;
if (funcname == NAME___decorate_internal_int__ || if (funcname == NAME___decorate_internal_int__ ||
funcname == NAME___decorate_internal_bool__ || funcname == NAME___decorate_internal_bool__ ||
funcname == NAME___decorate_internal_state__) funcname == NAME___decorate_internal_state__ ||
funcname == NAME___decorate_internal_float__)
{ {
FxExpression *arg = (*ArgList)[0]; FxExpression *arg = (*ArgList)[0];
if (returnit) if (returnit)

View file

@ -711,6 +711,8 @@ FName CheckCastKludges(FName in)
return NAME___decorate_internal_bool__; return NAME___decorate_internal_bool__;
case NAME_State: case NAME_State:
return NAME___decorate_internal_state__; return NAME___decorate_internal_state__;
case NAME_Float:
return NAME___decorate_internal_float__;
default: default:
return in; return in;
} }

View file

@ -356,4 +356,5 @@ ACTOR Actor native //: Thinker
native state __decorate_internal_state__(state); native state __decorate_internal_state__(state);
native int __decorate_internal_int__(int); native int __decorate_internal_int__(int);
native bool __decorate_internal_bool__(bool); native bool __decorate_internal_bool__(bool);
native float __decorate_internal_float__(float);
} }