- more direct native entry points.

This commit is contained in:
Christoph Oelckers 2018-12-04 23:12:16 +01:00
commit a3265c2963
12 changed files with 518 additions and 355 deletions

View file

@ -42,11 +42,24 @@
#include "a_pickups.h"
#include "a_specialspot.h"
#include "actorptrselect.h"
#include "a_weapons.h"
#include "d_player.h"
#include "p_setup.h"
#include "i_music.h"
DVector2 AM_GetPosition();
int Net_GetLatency(int *ld, int *ad);
void PrintPickupMessage(bool localview, const FString &str);
DEFINE_ACTION_FUNCTION_NATIVE(DObject, SetMusicVolume, I_SetMusicVolume)
{
PARAM_PROLOGUE;
PARAM_FLOAT(vol);
I_SetMusicVolume(vol);
return 0;
}
//=====================================================================================
//
// FString exports
@ -1877,6 +1890,64 @@ DEFINE_ACTION_FUNCTION_NATIVE(AKey, GetKeyType, P_GetKeyType)
ACTION_RETURN_POINTER(P_GetKeyType(num));
}
//=====================================================================================
//
// WeaponSlots exports
//
//=====================================================================================
static int LocateWeapon(FWeaponSlots *self, PClassActor *weap, int *pslot, int *pindex)
{
return self->LocateWeapon(weap, pslot, pindex);
}
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, LocateWeapon, LocateWeapon)
{
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
PARAM_CLASS(weap, AActor);
int slot = 0, index = 0;
bool retv = self->LocateWeapon(weap, &slot, &index);
if (numret >= 1) ret[0].SetInt(retv);
if (numret >= 2) ret[1].SetInt(slot);
if (numret >= 3) ret[2].SetInt(index);
return MIN(numret, 3);
}
static PClassActor *GetWeapon(FWeaponSlots *self, int slot, int index)
{
return self->GetWeapon(slot, index);
}
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, GetWeapon, GetWeapon)
{
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
PARAM_INT(slot);
PARAM_INT(index);
ACTION_RETURN_POINTER(self->GetWeapon(slot, index));
return 1;
}
static int SlotSize(FWeaponSlots *self, int slot)
{
return self->SlotSize(slot);
}
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, SlotSize, SlotSize)
{
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
PARAM_INT(slot);
ACTION_RETURN_INT(self->SlotSize(slot));
return 1;
}
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, SetupWeaponSlots, FWeaponSlots::SetupWeaponSlots)
{
PARAM_PROLOGUE;
PARAM_OBJECT(pawn, APlayerPawn);
FWeaponSlots::SetupWeaponSlots(pawn);
return 0;
}
//=====================================================================================
//
// SpotState exports
@ -2459,6 +2530,53 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetAutomapPosition, GetAutomapPositi
ACTION_RETURN_VEC2(AM_GetPosition());
}
static int ZGetUDMFInt(int type, int index, int key)
{
return GetUDMFInt(type, index, ENamedName(key));
}
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFInt, ZGetUDMFInt)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_INT(type);
PARAM_INT(index);
PARAM_NAME(key);
ACTION_RETURN_INT(GetUDMFInt(type, index, key));
}
static double ZGetUDMFFloat(int type, int index, int key)
{
return GetUDMFFloat(type, index, ENamedName(key));
}
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFFloat, ZGetUDMFFloat)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_INT(type);
PARAM_INT(index);
PARAM_NAME(key);
ACTION_RETURN_FLOAT(GetUDMFFloat(type, index, key));
}
static void ZGetUDMFString(int type, int index, int key, FString *result)
{
*result = GetUDMFString(type, index, ENamedName(key));
}
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFString, ZGetUDMFString)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_INT(type);
PARAM_INT(index);
PARAM_NAME(key);
ACTION_RETURN_STRING(GetUDMFString(type, index, key));
}
//=====================================================================================
//
//
//
//=====================================================================================
static int GetRealTime()
{
@ -2485,8 +2603,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_AltHUD, GetLatency, Net_GetLatency)
return numret;
}
DEFINE_FIELD_X(Sector, sector_t, floorplane)
DEFINE_FIELD_X(Sector, sector_t, ceilingplane)
DEFINE_FIELD_X(Sector, sector_t, Colormap)