- MBF21: ported the code pointers to ZScript.

So far it's just the functions and some initial changes to Dehacked's parser. None of this is usable yet.
This commit is contained in:
Christoph Oelckers 2021-06-30 23:15:56 +02:00
commit c700682a36
18 changed files with 677 additions and 60 deletions

View file

@ -228,6 +228,7 @@ enum
DEPF_HEXENBOUNCE = 10,
DEPF_DOOMBOUNCE = 11,
DEPF_INTERHUBSTRIP = 12,
DEPF_HIGHERMPROB = 13,
};
// Types of old style decorations

View file

@ -397,6 +397,7 @@ static FFlagDef MoreFlagDefs[] =
DEFINE_DEPRECATED_FLAG(HERETICBOUNCE),
DEFINE_DEPRECATED_FLAG(HEXENBOUNCE),
DEFINE_DEPRECATED_FLAG(DOOMBOUNCE),
DEFINE_DEPRECATED_FLAG(HIGHERMPROB),
// Deprecated flags with no more existing functionality.
DEFINE_DUMMY_FLAG(FASTER, true), // obsolete, replaced by 'Fast' state flag

View file

@ -325,6 +325,10 @@ void HandleDeprecatedFlags(AActor *defaults, PClassActor *info, bool set, int in
defaults->IntVar(NAME_InterHubAmount) = set ? 0 : 1;
break;
case DEPF_HIGHERMPROB:
defaults->MinMissileChance = set ? 160 : 200;
break;
default:
break; // silence GCC
}
@ -384,6 +388,9 @@ bool CheckDeprecatedFlags(AActor *actor, PClassActor *info, int index)
case DEPF_INTERHUBSTRIP:
return !(actor->IntVar(NAME_InterHubAmount));
case DEPF_HIGHERMPROB:
return actor->MinMissileChance <= 160;
}
return false; // Any entirely unknown flag is not set

View file

@ -59,6 +59,7 @@
DVector2 AM_GetPosition();
int Net_GetLatency(int *ld, int *ad);
void PrintPickupMessage(bool localview, const FString &str);
bool P_CheckForResurrection(AActor* self, bool usevilestates, FState* state = nullptr, FSoundID sound = 0);
// FCheckPosition requires explicit construction and destruction when used in the VM
@ -328,6 +329,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, SetDamage, SetDamage)
return 0;
}
static double PitchFromVel(AActor* self)
{
return self->Vel.Pitch().Degrees;
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, PitchFromVel, PitchFromVel)
{
PARAM_SELF_PROLOGUE(AActor);
ACTION_RETURN_FLOAT(PitchFromVel(self));
}
// This combines all 3 variations of the internal function
static void VelFromAngle(AActor *self, double speed, double angle)
{
@ -1373,7 +1386,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, RoughMonsterSearch, P_RoughMonsterSearch)
PARAM_INT(distance);
PARAM_BOOL(onlyseekable);
PARAM_BOOL(frontonly);
ACTION_RETURN_OBJECT(P_RoughMonsterSearch(self, distance, onlyseekable, frontonly));
PARAM_FLOAT(fov);
ACTION_RETURN_OBJECT(P_RoughMonsterSearch(self, distance, onlyseekable, frontonly, fov));
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckSight, P_CheckSight)
@ -1576,15 +1590,17 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_ExtChase, A_ExtChase)
return 0;
}
int CheckForResurrection(AActor *self)
int CheckForResurrection(AActor *self, FState* state, int sound)
{
return P_CheckForResurrection(self, false);
return P_CheckForResurrection(self, false, state, sound);
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_CheckForResurrection, CheckForResurrection)
{
PARAM_SELF_PROLOGUE(AActor);
ACTION_RETURN_BOOL(P_CheckForResurrection(self, false));
PARAM_STATE(state);
PARAM_INT(sound);
ACTION_RETURN_BOOL(P_CheckForResurrection(self, false, state, sound));
}
static void ZS_Face(AActor *self, AActor *faceto, double max_turn, double max_pitch, double ang_offset, double pitch_offset, int flags, double z_add)