2018-11-27 23:24:00 +00:00
//-----------------------------------------------------------------------------
2018-11-25 10:34:50 +00:00
//
// Copyright 2016-2018 Christoph Oelckers
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//-----------------------------------------------------------------------------
//
2018-11-27 23:11:06 +00:00
// VM thunks for internal functions.
2018-11-25 10:34:50 +00:00
//
2018-12-01 09:29:23 +00:00
// Important note about this file: Since everything in here is supposed to be called
// from JIT-compiled VM code it needs to be very careful about calling conventions.
// As a result none of the integer sized struct types may be used as function
// arguments, because current C++ calling conventions require them to be passed
// by reference. The JIT code, however will pass them by value so any direct native function
// taking such an argument needs to receive it as a naked int.
//
2018-11-25 10:34:50 +00:00
//-----------------------------------------------------------------------------
2019-01-31 18:38:04 +00:00
# include <time.h>
2018-11-25 10:34:50 +00:00
# include "vm.h"
# include "r_defs.h"
# include "g_levellocals.h"
# include "s_sound.h"
# include "p_local.h"
2018-12-01 09:29:23 +00:00
# include "v_font.h"
# include "gstrings.h"
2018-12-01 13:01:03 +00:00
# include "a_keys.h"
2018-12-01 15:53:54 +00:00
# include "sbar.h"
# include "doomstat.h"
# include "p_acs.h"
# include "a_pickups.h"
2018-12-04 17:16:01 +00:00
# include "a_specialspot.h"
# include "actorptrselect.h"
2018-12-04 22:12:16 +00:00
# include "a_weapons.h"
# include "d_player.h"
# include "p_setup.h"
2019-01-26 14:21:20 +00:00
# include "am_map.h"
2019-01-31 23:30:21 +00:00
# include "v_video.h"
2019-02-23 14:21:54 +00:00
# include "gi.h"
2020-04-11 10:53:45 +00:00
# include "utf8.h"
2019-04-13 08:26:55 +00:00
# include "fontinternals.h"
2019-02-23 14:21:54 +00:00
# include "intermission/intermission.h"
2020-04-11 11:48:55 +00:00
# include "menu/menu.h"
# include "c_cvars.h"
2020-04-11 15:59:15 +00:00
# include "c_bind.h"
2020-04-11 16:04:07 +00:00
# include "c_dispatch.h"
2020-04-11 16:23:15 +00:00
# include "s_music.h"
2020-04-11 17:00:07 +00:00
# include "texturemanager.h"
2018-11-25 10:34:50 +00:00
2018-12-02 11:24:51 +00:00
DVector2 AM_GetPosition ( ) ;
int Net_GetLatency ( int * ld , int * ad ) ;
2018-12-04 17:16:01 +00:00
void PrintPickupMessage ( bool localview , const FString & str ) ;
2018-12-04 22:12:16 +00:00
2020-04-11 17:34:08 +00:00
void SetCameraToTexture ( AActor * viewpoint , const FString & texturename , double fov ) ;
2019-04-13 08:26:55 +00:00
2020-04-11 17:34:08 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _TexMan , SetCameraToTexture , SetCameraToTexture )
2019-04-13 08:26:55 +00:00
{
PARAM_PROLOGUE ;
2020-04-11 17:34:08 +00:00
PARAM_OBJECT ( viewpoint , AActor ) ;
PARAM_STRING ( texturename ) ; // [ZZ] there is no point in having this as FTextureID because it's easier to refer to a cameratexture by name and it isn't executed too often to cache it.
PARAM_FLOAT ( fov ) ;
SetCameraToTexture ( viewpoint , texturename , fov ) ;
2018-12-04 17:16:01 +00:00
return 0 ;
}
2018-12-02 11:24:51 +00:00
2018-12-01 09:29:23 +00:00
//=====================================================================================
//
// sector_t exports
//
//=====================================================================================
2018-11-27 23:11:06 +00:00
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindLowestFloorSurrounding , FindLowestFloorSurrounding )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindLowestFloorSurrounding ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindHighestFloorSurrounding , FindHighestFloorSurrounding )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindHighestFloorSurrounding ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindNextHighestFloor , FindNextHighestFloor )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindNextHighestFloor ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindNextLowestFloor , FindNextLowestFloor )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindNextLowestFloor ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindNextLowestCeiling , FindNextLowestCeiling )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindNextLowestCeiling ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindNextHighestCeiling , FindNextHighestCeiling )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindNextHighestCeiling ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindLowestCeilingSurrounding , FindLowestCeilingSurrounding )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindLowestCeilingSurrounding ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:38:58 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindHighestCeilingSurrounding , FindHighestCeilingSurrounding )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:38:58 +00:00
double h = FindHighestCeilingSurrounding ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-29 16:55:56 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindMinSurroundingLight , FindMinSurroundingLight )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( min ) ;
2018-11-29 16:55:56 +00:00
auto h = FindMinSurroundingLight ( self , min ) ;
2018-11-27 23:11:06 +00:00
ACTION_RETURN_INT ( h ) ;
}
2018-11-29 16:55:56 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindHighestFloorPoint , FindHighestFloorPoint )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-29 16:55:56 +00:00
double h = FindHighestFloorPoint ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-28 23:27:09 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindLowestCeilingPoint , FindLowestCeilingPoint )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
vertex_t * v ;
2018-11-28 23:27:09 +00:00
double h = FindLowestCeilingPoint ( self , & v ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( v ) ;
return numret ;
}
2018-11-28 23:27:09 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , HighestCeilingAt , HighestCeilingAt )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
sector_t * s ;
2018-11-28 23:27:09 +00:00
double h = HighestCeilingAt ( self , x , y , & s ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( s ) ;
return numret ;
}
2018-11-28 23:27:09 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , LowestFloorAt , LowestFloorAt )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
sector_t * s ;
2018-11-28 23:27:09 +00:00
double h = LowestFloorAt ( self , x , y , & s ) ;
2018-11-27 23:11:06 +00:00
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( s ) ;
return numret ;
}
2018-11-28 20:40:25 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , NextHighestCeilingAt , NextHighestCeilingAt )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( bottomz ) ;
PARAM_FLOAT ( topz ) ;
PARAM_INT ( flags ) ;
sector_t * resultsec ;
F3DFloor * resultff ;
2018-11-28 20:40:25 +00:00
double resultheight = NextHighestCeilingAt ( self , x , y , bottomz , topz , flags , & resultsec , & resultff ) ;
if ( numret > 2 ) ret [ 2 ] . SetPointer ( resultff ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( resultsec ) ;
if ( numret > 0 ) ret [ 0 ] . SetFloat ( resultheight ) ;
2018-11-27 23:11:06 +00:00
return numret ;
}
2018-11-28 23:27:09 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , NextLowestFloorAt , NextLowestFloorAt )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( z ) ;
PARAM_INT ( flags ) ;
PARAM_FLOAT ( steph ) ;
sector_t * resultsec ;
F3DFloor * resultff ;
2018-11-28 23:27:09 +00:00
double resultheight = NextLowestFloorAt ( self , x , y , z , flags , steph , & resultsec , & resultff ) ;
2018-11-27 23:11:06 +00:00
2018-11-28 20:40:25 +00:00
if ( numret > 2 ) ret [ 2 ] . SetPointer ( resultff ) ;
if ( numret > 1 ) ret [ 1 ] . SetPointer ( resultsec ) ;
if ( numret > 0 ) ret [ 0 ] . SetFloat ( resultheight ) ;
2018-11-27 23:11:06 +00:00
return numret ;
}
2018-11-28 23:27:09 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetFriction , GetFriction )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( plane ) ;
double mf ;
double h = self - > GetFriction ( plane , & mf ) ;
if ( numret > 0 ) ret [ 0 ] . SetFloat ( h ) ;
if ( numret > 1 ) ret [ 1 ] . SetFloat ( mf ) ;
return numret ;
}
2018-11-28 23:27:09 +00:00
static void GetPortalDisplacement ( sector_t * sec , int plane , DVector2 * result )
2018-11-27 23:11:06 +00:00
{
2018-11-28 23:27:09 +00:00
* result = sec - > GetPortalDisplacement ( plane ) ;
2018-11-27 23:11:06 +00:00
}
2018-11-28 23:27:09 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetPortalDisplacement , GetPortalDisplacement )
2018-11-27 23:11:06 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_VEC2 ( self - > GetPortalDisplacement ( pos ) ) ;
}
2018-11-25 10:34:50 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindShortestTextureAround , FindShortestTextureAround )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_FLOAT ( FindShortestTextureAround ( self ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindShortestUpperAround , FindShortestUpperAround )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_FLOAT ( FindShortestUpperAround ( self ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindModelFloorSector , FindModelFloorSector )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_FLOAT ( fdh ) ;
auto h = FindModelFloorSector ( self , fdh ) ;
ACTION_RETURN_POINTER ( h ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , FindModelCeilingSector , FindModelCeilingSector )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_FLOAT ( fdh ) ;
auto h = FindModelCeilingSector ( self , fdh ) ;
ACTION_RETURN_POINTER ( h ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetColor , SetColor )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_COLOR ( color ) ;
PARAM_INT ( desat ) ;
SetColor ( self , color , desat ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetFade , SetFade )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_COLOR ( fade ) ;
SetFade ( self , fade ) ;
return 0 ;
}
2019-12-20 21:25:10 +00:00
static void SetSpecialColor ( sector_t * self , int num , int color )
2018-11-25 10:34:50 +00:00
{
if ( num > = 0 & & num < 5 )
{
self - > SetSpecialColor ( num , color ) ;
}
}
2018-11-25 12:35:32 +00:00
2018-11-25 10:34:50 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetSpecialColor , SetSpecialColor )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( num ) ;
PARAM_COLOR ( color ) ;
2019-12-20 21:25:10 +00:00
SetSpecialColor ( self , num , color ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2018-12-21 00:03:52 +00:00
static void SetAdditiveColor ( sector_t * self , int pos , int color )
{
if ( pos > = 0 & & pos < 5 )
{
self - > SetAdditiveColor ( pos , color ) ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetAdditiveColor , SetAdditiveColor )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_COLOR ( color ) ;
2018-12-23 03:02:20 +00:00
SetAdditiveColor ( self , pos , color ) ;
2018-12-21 00:03:52 +00:00
return 0 ;
}
2019-12-22 15:08:34 +00:00
static void SetColorization ( sector_t * self , int pos , int cname )
{
if ( pos > = 0 & & pos < 2 )
{
self - > SetTextureFx ( pos , TexMan . GetTextureManipulation ( ENamedName ( cname ) ) ) ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetColorization , SetColorization )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_INT ( color ) ;
SetColorization ( self , pos , color ) ;
return 0 ;
}
2018-11-25 10:34:50 +00:00
static void SetFogDensity ( sector_t * self , int dens )
{
self - > Colormap . FogDensity = dens ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetFogDensity , SetFogDensity )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( dens ) ;
self - > Colormap . FogDensity = dens ;
return 0 ;
}
2018-11-25 12:35:32 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , PlaneMoving , PlaneMoving )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
2018-11-25 12:35:32 +00:00
ACTION_RETURN_BOOL ( PlaneMoving ( self , pos ) ) ;
2018-11-25 10:34:50 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetFloorLight , GetFloorLight )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_INT ( self - > GetFloorLight ( ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetCeilingLight , GetCeilingLight )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_INT ( self - > GetCeilingLight ( ) ) ;
}
static sector_t * GetHeightSec ( sector_t * self )
{
return self - > GetHeightSec ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetHeightSec , GetHeightSec )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_POINTER ( self - > GetHeightSec ( ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetSpecial , GetSpecial )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_POINTER ( spec , secspecial_t ) ;
2018-11-25 12:35:32 +00:00
GetSpecial ( self , spec ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2018-11-25 12:35:32 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetSpecial , SetSpecial )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_POINTER ( spec , secspecial_t ) ;
2018-11-25 12:35:32 +00:00
SetSpecial ( self , spec ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2018-11-25 12:35:32 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , TransferSpecial , TransferSpecial )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_POINTER ( spec , sector_t ) ;
2018-11-25 12:35:32 +00:00
TransferSpecial ( self , spec ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2018-11-25 12:35:32 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetTerrain , GetTerrain )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
2018-11-25 12:35:32 +00:00
ACTION_RETURN_INT ( GetTerrain ( self , pos ) ) ;
2018-11-25 10:34:50 +00:00
}
2018-11-25 12:35:32 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , CheckPortalPlane , CheckPortalPlane )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( plane ) ;
self - > CheckPortalPlane ( plane ) ;
return 0 ;
}
2018-11-25 12:35:32 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , RemoveForceField , RemoveForceField )
2018-11-25 10:34:50 +00:00
{
2018-11-25 12:35:32 +00:00
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
RemoveForceField ( self ) ;
return 0 ;
2018-11-25 10:34:50 +00:00
}
2018-11-25 13:19:19 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , AdjustFloorClip , AdjustFloorClip )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
2018-11-25 13:19:19 +00:00
AdjustFloorClip ( self ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2019-01-29 00:30:41 +00:00
static sector_t * PointInSectorXY ( FLevelLocals * self , double x , double y )
{
return self - > PointInSector ( x , y ) ;
}
2018-11-25 10:34:50 +00:00
2019-01-29 00:30:41 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , PointInSector , PointInSectorXY )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
ACTION_RETURN_POINTER ( PointInSectorXY ( self , x , y ) ) ;
}
2018-11-25 13:19:19 +00:00
2019-01-29 00:30:41 +00:00
static void SetXOffset ( sector_t * self , int pos , double o )
{
self - > SetXOffset ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetXOffset , SetXOffset )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
2018-11-25 10:34:50 +00:00
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
self - > SetXOffset ( pos , o ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static void AddXOffset ( sector_t * self , int pos , double o )
{
self - > AddXOffset ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , AddXOffset , AddXOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
self - > AddXOffset ( pos , o ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static double GetXOffset ( sector_t * self , int pos )
{
return self - > GetXOffset ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetXOffset , GetXOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_FLOAT ( self - > GetXOffset ( pos ) ) ;
}
2018-11-25 13:19:19 +00:00
static void SetYOffset ( sector_t * self , int pos , double o )
{
self - > SetYOffset ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetYOffset , SetYOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
self - > SetXOffset ( pos , o ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static void AddYOffset ( sector_t * self , int pos , double o )
{
self - > AddYOffset ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , AddYOffset , AddYOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
2018-11-25 13:19:19 +00:00
self - > AddYOffset ( pos , o ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2018-11-25 13:19:19 +00:00
static double GetYOffset ( sector_t * self , int pos )
{
return self - > GetYOffset ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetYOffset , GetYOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_BOOL ( addbase ) ;
ACTION_RETURN_FLOAT ( self - > GetYOffset ( pos , addbase ) ) ;
}
2018-11-25 13:19:19 +00:00
static void SetXScale ( sector_t * self , int pos , double o )
{
self - > SetXScale ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetXScale , SetXScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
self - > SetXScale ( pos , o ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static double GetXScale ( sector_t * self , int pos )
{
return self - > GetXScale ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetXScale , GetXScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_FLOAT ( self - > GetXScale ( pos ) ) ;
}
2018-11-25 13:19:19 +00:00
static void SetYScale ( sector_t * self , int pos , double o )
{
self - > SetYScale ( pos , o ) ;
}
2018-11-29 16:55:56 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetYScale , SetYScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
self - > SetYScale ( pos , o ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static double GetYScale ( sector_t * self , int pos )
{
return self - > GetYScale ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetYScale , GetYScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_FLOAT ( self - > GetYScale ( pos ) ) ;
}
2018-11-25 13:19:19 +00:00
static void SetAngle ( sector_t * self , int pos , double o )
{
self - > SetAngle ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetAngle , SetAngle )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_ANGLE ( o ) ;
self - > SetAngle ( pos , o ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static double GetAngle ( sector_t * self , int pos , bool addbase )
{
return self - > GetAngle ( pos , addbase ) . Degrees ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetAngle , GetAngle )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_BOOL ( addbase ) ;
ACTION_RETURN_FLOAT ( self - > GetAngle ( pos , addbase ) . Degrees ) ;
}
2018-11-25 13:19:19 +00:00
static void SetBase ( sector_t * self , int pos , double o , double a )
{
self - > SetBase ( pos , o , a ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetBase , SetBase )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
PARAM_ANGLE ( a ) ;
self - > SetBase ( pos , o , a ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static void SetAlpha ( sector_t * self , int pos , double o )
{
self - > SetAlpha ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetAlpha , SetAlpha )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
self - > SetAlpha ( pos , o ) ;
return 0 ;
}
2018-11-25 13:19:19 +00:00
static double GetAlpha ( sector_t * self , int pos )
{
return self - > GetAlpha ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetAlpha , GetAlpha )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_FLOAT ( self - > GetAlpha ( pos ) ) ;
}
2018-11-25 13:19:19 +00:00
static int GetFlags ( sector_t * self , int pos )
{
return self - > GetFlags ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetFlags , GetFlags )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_INT ( self - > GetFlags ( pos ) ) ;
}
2018-11-25 13:19:19 +00:00
static int GetVisFlags ( sector_t * self , int pos )
{
return self - > GetVisFlags ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetVisFlags , GetVisFlags )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_INT ( self - > GetVisFlags ( pos ) ) ;
}
2018-11-25 13:19:19 +00:00
static void ChangeFlags ( sector_t * self , int pos , int a , int o )
{
self - > ChangeFlags ( pos , a , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , ChangeFlags , ChangeFlags )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_INT ( a ) ;
PARAM_INT ( o ) ;
self - > ChangeFlags ( pos , a , o ) ;
return 0 ;
}
2018-11-25 14:14:48 +00:00
static void SetPlaneLight ( sector_t * self , int pos , int o )
{
self - > SetPlaneLight ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetPlaneLight , SetPlaneLight )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_INT ( o ) ;
self - > SetPlaneLight ( pos , o ) ;
return 0 ;
}
2018-11-25 14:14:48 +00:00
static int GetPlaneLight ( sector_t * self , int pos )
{
return self - > GetPlaneLight ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetPlaneLight , GetPlaneLight )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_INT ( self - > GetPlaneLight ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static void SetTexture ( sector_t * self , int pos , int o , bool adj )
{
self - > SetTexture ( pos , FSetTextureID ( o ) , adj ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetTexture , SetTexture )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_INT ( o ) ;
PARAM_BOOL ( adj ) ;
self - > SetTexture ( pos , FSetTextureID ( o ) , adj ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static int GetSectorTexture ( sector_t * self , int pos )
2018-11-25 14:14:48 +00:00
{
return self - > GetTexture ( pos ) . GetIndex ( ) ;
}
2018-11-25 15:12:15 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetTexture , GetSectorTexture )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_INT ( self - > GetTexture ( pos ) . GetIndex ( ) ) ;
}
2018-11-25 14:14:48 +00:00
static void SetPlaneTexZ ( sector_t * self , int pos , double o , bool )
{
self - > SetPlaneTexZ ( pos , o , true ) ; // not setting 'dirty' here is a guaranteed cause for problems.
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetPlaneTexZ , SetPlaneTexZ )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
PARAM_BOOL ( dirty ) ;
self - > SetPlaneTexZ ( pos , o , true ) ; // not setting 'dirty' here is a guaranteed cause for problems.
return 0 ;
}
2018-11-25 14:14:48 +00:00
static double GetPlaneTexZ ( sector_t * self , int pos )
{
return self - > GetPlaneTexZ ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetPlaneTexZ , GetPlaneTexZ )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_FLOAT ( self - > GetPlaneTexZ ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static void SetLightLevel ( sector_t * self , int o )
{
self - > SetLightLevel ( o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetLightLevel , SetLightLevel )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( o ) ;
self - > SetLightLevel ( o ) ;
return 0 ;
}
2018-11-25 14:14:48 +00:00
static void ChangeLightLevel ( sector_t * self , int o )
{
self - > ChangeLightLevel ( o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , ChangeLightLevel , ChangeLightLevel )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( o ) ;
self - > ChangeLightLevel ( o ) ;
return 0 ;
}
2018-11-25 14:14:48 +00:00
static int GetLightLevel ( sector_t * self )
{
return self - > GetLightLevel ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetLightLevel , GetLightLevel )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_INT ( self - > GetLightLevel ( ) ) ;
}
2018-11-25 14:14:48 +00:00
static int PortalBlocksView ( sector_t * self , int pos )
{
return self - > PortalBlocksView ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , PortalBlocksView , PortalBlocksView )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_BOOL ( self - > PortalBlocksView ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static int PortalBlocksSight ( sector_t * self , int pos )
{
return self - > PortalBlocksSight ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , PortalBlocksSight , PortalBlocksSight )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_BOOL ( self - > PortalBlocksSight ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static int PortalBlocksMovement ( sector_t * self , int pos )
{
return self - > PortalBlocksMovement ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , PortalBlocksMovement , PortalBlocksMovement )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_BOOL ( self - > PortalBlocksMovement ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static int PortalBlocksSound ( sector_t * self , int pos )
{
return self - > PortalBlocksSound ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , PortalBlocksSound , PortalBlocksSound )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_BOOL ( self - > PortalBlocksSound ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static int PortalIsLinked ( sector_t * self , int pos )
{
return self - > PortalIsLinked ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , PortalIsLinked , PortalIsLinked )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_BOOL ( self - > PortalIsLinked ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static void ClearPortal ( sector_t * self , int pos )
{
self - > ClearPortal ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , ClearPortal , ClearPortal )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
self - > ClearPortal ( pos ) ;
return 0 ;
}
2018-11-25 14:14:48 +00:00
static double GetPortalPlaneZ ( sector_t * self , int pos )
{
return self - > GetPortalPlaneZ ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetPortalPlaneZ , GetPortalPlaneZ )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_FLOAT ( self - > GetPortalPlaneZ ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static int GetPortalType ( sector_t * self , int pos )
2018-11-25 10:34:50 +00:00
{
2018-11-25 14:14:48 +00:00
return self - > GetPortalType ( pos ) ;
2018-11-25 10:34:50 +00:00
}
2018-11-25 14:14:48 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetPortalType , GetPortalType )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_INT ( self - > GetPortalType ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static int GetOppositePortalGroup ( sector_t * self , int pos )
{
return self - > GetOppositePortalGroup ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetOppositePortalGroup , GetOppositePortalGroup )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_INT ( self - > GetOppositePortalGroup ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static double CenterFloor ( sector_t * self )
{
return self - > CenterFloor ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , CenterFloor , CenterFloor )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_FLOAT ( self - > CenterFloor ( ) ) ;
}
2018-11-25 14:14:48 +00:00
static double CenterCeiling ( sector_t * self )
{
return self - > CenterCeiling ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , CenterCeiling , CenterCeiling )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_FLOAT ( self - > CenterCeiling ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static int SectorIndex ( sector_t * self )
2018-11-25 14:14:48 +00:00
{
2019-01-05 23:41:46 +00:00
return self - > Index ( ) ;
2018-11-25 14:14:48 +00:00
}
2018-11-25 15:12:15 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , Index , SectorIndex )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
2018-11-25 15:12:15 +00:00
ACTION_RETURN_INT ( SectorIndex ( self ) ) ;
2018-11-25 14:14:48 +00:00
}
static void SetEnvironmentID ( sector_t * self , int envnum )
{
2019-01-27 18:16:14 +00:00
self - > Level - > Zones [ self - > ZoneNumber ] . Environment = S_FindEnvironment ( envnum ) ;
2018-11-25 10:34:50 +00:00
}
2018-11-25 14:14:48 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetEnvironmentID , SetEnvironmentID )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( envnum ) ;
2018-11-25 14:14:48 +00:00
SetEnvironmentID ( self , envnum ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2018-11-25 14:14:48 +00:00
static void SetEnvironment ( sector_t * self , const FString & env )
{
2019-01-27 18:16:14 +00:00
self - > Level - > Zones [ self - > ZoneNumber ] . Environment = S_FindEnvironment ( env ) ;
2018-11-25 14:14:48 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetEnvironment , SetEnvironment )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_STRING ( env ) ;
2018-11-25 14:14:48 +00:00
SetEnvironment ( self , env ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2018-11-25 14:14:48 +00:00
static double GetGlowHeight ( sector_t * self , int pos )
{
return self - > GetGlowHeight ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetGlowHeight , GetGlowHeight )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_FLOAT ( self - > GetGlowHeight ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static double GetGlowColor ( sector_t * self , int pos )
{
return self - > GetGlowColor ( pos ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetGlowColor , GetGlowColor )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
ACTION_RETURN_INT ( self - > GetGlowColor ( pos ) ) ;
}
2018-11-25 14:14:48 +00:00
static void SetGlowHeight ( sector_t * self , int pos , double o )
{
self - > SetGlowHeight ( pos , float ( o ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetGlowHeight , SetGlowHeight )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_FLOAT ( o ) ;
self - > SetGlowHeight ( pos , float ( o ) ) ;
return 0 ;
}
2018-11-25 14:14:48 +00:00
static void SetGlowColor ( sector_t * self , int pos , int o )
{
self - > SetGlowColor ( pos , o ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , SetGlowColor , SetGlowColor )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( pos ) ;
PARAM_COLOR ( o ) ;
self - > SetGlowColor ( pos , o ) ;
return 0 ;
}
2019-09-16 15:30:39 +00:00
static F3DFloor * Get3DFloor ( sector_t * self , unsigned int index )
2019-08-04 13:55:17 +00:00
{
2019-09-16 15:30:39 +00:00
if ( index > = self - > e - > XFloor . ffloors . Size ( ) )
2019-08-04 13:55:17 +00:00
return nullptr ;
return self - > e - > XFloor . ffloors [ index ] ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , Get3DFloor , Get3DFloor )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( index ) ;
ACTION_RETURN_POINTER ( Get3DFloor ( self , index ) ) ;
}
static int Get3DFloorCount ( sector_t * self )
{
return self - > e - > XFloor . ffloors . Size ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , Get3DFloorCount , Get3DFloorCount )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_INT ( self - > e - > XFloor . ffloors . Size ( ) ) ;
}
2019-09-16 15:30:39 +00:00
static sector_t * GetAttached ( sector_t * self , unsigned int index )
2019-08-04 13:55:17 +00:00
{
2019-09-16 15:30:39 +00:00
if ( index > = self - > e - > XFloor . attached . Size ( ) )
2019-08-04 13:55:17 +00:00
return nullptr ;
return self - > e - > XFloor . attached [ index ] ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetAttached , GetAttached )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
PARAM_INT ( index ) ;
ACTION_RETURN_POINTER ( GetAttached ( self , index ) ) ;
}
static int GetAttachedCount ( sector_t * self )
{
return self - > e - > XFloor . attached . Size ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Sector , GetAttachedCount , GetAttachedCount )
{
PARAM_SELF_STRUCT_PROLOGUE ( sector_t ) ;
ACTION_RETURN_INT ( self - > e - > XFloor . attached . Size ( ) ) ;
}
static int Get3DFloorTexture ( F3DFloor * self , int pos )
{
if ( pos )
return self - > bottom . texture - > GetIndex ( ) ;
return self - > top . texture - > GetIndex ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _F3DFloor , GetTexture , Get3DFloorTexture )
{
PARAM_SELF_STRUCT_PROLOGUE ( F3DFloor ) ;
PARAM_INT ( pos ) ;
if ( pos )
ACTION_RETURN_INT ( self - > bottom . texture - > GetIndex ( ) ) ;
ACTION_RETURN_INT ( self - > top . texture - > GetIndex ( ) ) ;
}
2018-11-25 10:34:50 +00:00
//===========================================================================
//
// line_t exports
//
//===========================================================================
2018-11-25 15:12:15 +00:00
static int isLinePortal ( line_t * self )
{
return self - > isLinePortal ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Line , isLinePortal , isLinePortal )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( line_t ) ;
ACTION_RETURN_BOOL ( self - > isLinePortal ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static int isVisualPortal ( line_t * self )
{
return self - > isVisualPortal ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Line , isVisualPortal , isVisualPortal )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( line_t ) ;
ACTION_RETURN_BOOL ( self - > isVisualPortal ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static line_t * getPortalDestination ( line_t * self )
{
return self - > getPortalDestination ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Line , getPortalDestination , getPortalDestination )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( line_t ) ;
ACTION_RETURN_POINTER ( self - > getPortalDestination ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static int getPortalAlignment ( line_t * self )
{
return self - > getPortalAlignment ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Line , getPortalAlignment , getPortalAlignment )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( line_t ) ;
ACTION_RETURN_INT ( self - > getPortalAlignment ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static int LineIndex ( line_t * self )
2018-11-25 10:34:50 +00:00
{
2019-01-05 23:41:46 +00:00
return self - > Index ( ) ;
2018-11-25 15:12:15 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Line , Index , LineIndex )
{
PARAM_SELF_STRUCT_PROLOGUE ( line_t ) ;
ACTION_RETURN_INT ( LineIndex ( self ) ) ;
2018-11-25 10:34:50 +00:00
}
//===========================================================================
//
2018-12-01 09:29:23 +00:00
// side_t exports
2018-11-25 10:34:50 +00:00
//
//===========================================================================
2018-11-25 15:12:15 +00:00
static int GetSideTexture ( side_t * self , int which )
{
return self - > GetTexture ( which ) . GetIndex ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , GetTexture , GetSideTexture )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
ACTION_RETURN_INT ( self - > GetTexture ( which ) . GetIndex ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static void SetSideTexture ( side_t * self , int which , int tex )
{
self - > SetTexture ( which , FSetTextureID ( tex ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetTexture , SetSideTexture )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_INT ( tex ) ;
self - > SetTexture ( which , FSetTextureID ( tex ) ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static void SetTextureXOffset ( side_t * self , int which , double ofs )
{
self - > SetTextureXOffset ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetTextureXOffset , SetTextureXOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > SetTextureXOffset ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static void AddTextureXOffset ( side_t * self , int which , double ofs )
{
self - > AddTextureXOffset ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , AddTextureXOffset , AddTextureXOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > AddTextureXOffset ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static double GetTextureXOffset ( side_t * self , int which )
{
return self - > GetTextureXOffset ( which ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , GetTextureXOffset , GetTextureXOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
ACTION_RETURN_FLOAT ( self - > GetTextureXOffset ( which ) ) ;
}
2018-11-25 15:12:15 +00:00
static void SetTextureYOffset ( side_t * self , int which , double ofs )
{
self - > SetTextureYOffset ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetTextureYOffset , SetTextureYOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > SetTextureYOffset ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static void AddTextureYOffset ( side_t * self , int which , double ofs )
{
self - > AddTextureYOffset ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , AddTextureYOffset , AddTextureYOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > AddTextureYOffset ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static double GetTextureYOffset ( side_t * self , int which )
{
return self - > GetTextureYOffset ( which ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , GetTextureYOffset , GetTextureYOffset )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
ACTION_RETURN_FLOAT ( self - > GetTextureYOffset ( which ) ) ;
}
2018-11-25 15:12:15 +00:00
static void SetTextureXScale ( side_t * self , int which , double ofs )
{
self - > SetTextureXScale ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetTextureXScale , SetTextureXScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > SetTextureXScale ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static void MultiplyTextureXScale ( side_t * self , int which , double ofs )
{
self - > MultiplyTextureXScale ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , MultiplyTextureXScale , MultiplyTextureXScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > MultiplyTextureXScale ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static double GetTextureXScale ( side_t * self , int which )
{
return self - > GetTextureXScale ( which ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , GetTextureXScale , GetTextureXScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
ACTION_RETURN_FLOAT ( self - > GetTextureXScale ( which ) ) ;
}
2018-11-25 15:12:15 +00:00
static void SetTextureYScale ( side_t * self , int which , double ofs )
{
self - > SetTextureYScale ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetTextureYScale , SetTextureYScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > SetTextureYScale ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static void MultiplyTextureYScale ( side_t * self , int which , double ofs )
{
self - > MultiplyTextureYScale ( which , ofs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , MultiplyTextureYScale , MultiplyTextureYScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
PARAM_FLOAT ( ofs ) ;
self - > MultiplyTextureYScale ( which , ofs ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static double GetTextureYScale ( side_t * self , int which )
{
return self - > GetTextureYScale ( which ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , GetTextureYScale , GetTextureYScale )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( which ) ;
ACTION_RETURN_FLOAT ( self - > GetTextureYScale ( which ) ) ;
}
2018-11-25 15:12:15 +00:00
static vertex_t * GetSideV1 ( side_t * self )
{
return self - > V1 ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , V1 , GetSideV1 )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
ACTION_RETURN_POINTER ( self - > V1 ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static vertex_t * GetSideV2 ( side_t * self )
{
return self - > V2 ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , V2 , GetSideV2 )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
ACTION_RETURN_POINTER ( self - > V2 ( ) ) ;
}
2019-12-20 21:25:10 +00:00
static void SetSideSpecialColor ( side_t * self , int tier , int position , int color )
2018-11-25 15:12:15 +00:00
{
if ( tier > = 0 & & tier < 3 & & position > = 0 & & position < 2 )
{
self - > SetSpecialColor ( tier , position , color ) ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetSpecialColor , SetSideSpecialColor )
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( tier ) ;
PARAM_INT ( position ) ;
PARAM_COLOR ( color ) ;
2019-12-20 21:25:10 +00:00
SetSideSpecialColor ( self , tier , position , color ) ;
2018-11-25 15:12:15 +00:00
return 0 ;
}
2018-12-21 00:03:52 +00:00
static int GetSideAdditiveColor ( side_t * self , int tier )
{
if ( tier > = 0 & & tier < 3 )
{
return self - > GetAdditiveColor ( tier , self - > sector ) ;
}
return 0 ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , GetAdditiveColor , GetSideAdditiveColor )
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( tier ) ;
ACTION_RETURN_INT ( GetSideAdditiveColor ( self , tier ) ) ;
return 0 ;
}
2018-12-23 06:36:25 +00:00
static void SetSideAdditiveColor ( side_t * self , int tier , int color )
2018-12-21 00:03:52 +00:00
{
if ( tier > = 0 & & tier < 3 )
{
2018-12-23 06:36:25 +00:00
self - > SetAdditiveColor ( tier , color ) ;
2018-12-21 00:03:52 +00:00
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetAdditiveColor , SetSideAdditiveColor )
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( tier ) ;
PARAM_COLOR ( color ) ;
2018-12-23 06:36:25 +00:00
SetSideAdditiveColor ( self , tier , color ) ;
return 0 ;
}
static void EnableSideAdditiveColor ( side_t * self , int tier , bool enable )
{
if ( tier > = 0 & & tier < 3 )
{
self - > EnableAdditiveColor ( tier , enable ) ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , EnableAdditiveColor , EnableSideAdditiveColor )
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( tier ) ;
PARAM_BOOL ( enable ) ;
EnableSideAdditiveColor ( self , tier , enable ) ;
2018-12-21 00:03:52 +00:00
return 0 ;
}
2019-12-22 15:08:34 +00:00
static void SetWallColorization ( side_t * self , int pos , int cname )
{
2020-02-08 04:56:46 +00:00
if ( pos > = 0 & & pos < 3 )
2019-12-22 15:08:34 +00:00
{
self - > SetTextureFx ( pos , TexMan . GetTextureManipulation ( ENamedName ( cname ) ) ) ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , SetColorization , SetWallColorization )
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
PARAM_INT ( pos ) ;
PARAM_INT ( color ) ;
SetWallColorization ( self , pos , color ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static int SideIndex ( side_t * self )
{
2019-01-05 23:41:46 +00:00
return self - > Index ( ) ;
2018-11-25 15:12:15 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Side , Index , SideIndex )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( side_t ) ;
2018-11-25 15:12:15 +00:00
ACTION_RETURN_INT ( SideIndex ( self ) ) ;
2018-11-25 10:34:50 +00:00
}
//=====================================================================================
//
2018-12-01 09:29:23 +00:00
// vertex_t exports
2018-11-25 10:34:50 +00:00
//
//=====================================================================================
2018-11-25 15:12:15 +00:00
static int VertexIndex ( vertex_t * self )
2018-11-25 10:34:50 +00:00
{
2019-01-05 23:41:46 +00:00
return self - > Index ( ) ;
2018-11-25 10:34:50 +00:00
}
2018-11-25 15:12:15 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Vertex , Index , VertexIndex )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( vertex_t ) ;
2018-11-25 15:12:15 +00:00
ACTION_RETURN_INT ( VertexIndex ( self ) ) ;
2018-11-25 10:34:50 +00:00
}
2018-12-01 09:29:23 +00:00
//=====================================================================================
//
// TexMan exports
//
//=====================================================================================
2019-02-23 14:21:54 +00:00
static int IsJumpingAllowed ( FLevelLocals * self )
{
return self - > IsJumpingAllowed ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , IsJumpingAllowed , IsJumpingAllowed )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
ACTION_RETURN_BOOL ( self - > IsJumpingAllowed ( ) ) ;
}
//==========================================================================
//
//
//==========================================================================
static int IsCrouchingAllowed ( FLevelLocals * self )
{
return self - > IsCrouchingAllowed ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , IsCrouchingAllowed , IsCrouchingAllowed )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
ACTION_RETURN_BOOL ( self - > IsCrouchingAllowed ( ) ) ;
}
//==========================================================================
//
//
//==========================================================================
static int IsFreelookAllowed ( FLevelLocals * self )
{
return self - > IsFreelookAllowed ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , IsFreelookAllowed , IsFreelookAllowed )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
ACTION_RETURN_BOOL ( self - > IsFreelookAllowed ( ) ) ;
}
//==========================================================================
//
// ZScript counterpart to ACS ChangeSky, uses TextureIDs
//
//==========================================================================
DEFINE_ACTION_FUNCTION ( FLevelLocals , ChangeSky )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_INT ( sky1 ) ;
PARAM_INT ( sky2 ) ;
self - > skytexture1 = FSetTextureID ( sky1 ) ;
self - > skytexture2 = FSetTextureID ( sky2 ) ;
InitSkyMap ( self ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( FLevelLocals , StartIntermission )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_NAME ( seq ) ;
PARAM_INT ( state ) ;
F_StartIntermission ( seq , ( uint8_t ) state ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
// This is needed to convert the strings to char pointers.
2019-01-27 20:59:19 +00:00
static void ReplaceTextures ( FLevelLocals * self , const FString & from , const FString & to , int flags )
2018-11-25 15:12:15 +00:00
{
2019-01-27 20:59:19 +00:00
self - > ReplaceTextures ( from , to , flags ) ;
2018-11-25 15:12:15 +00:00
}
2019-01-27 20:59:19 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , ReplaceTextures , ReplaceTextures )
2018-11-25 10:34:50 +00:00
{
2019-01-27 20:59:19 +00:00
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
2018-11-25 10:34:50 +00:00
PARAM_STRING ( from ) ;
PARAM_STRING ( to ) ;
PARAM_INT ( flags ) ;
2019-01-27 20:59:19 +00:00
self - > ReplaceTextures ( from , to , flags ) ;
2018-11-25 10:34:50 +00:00
return 0 ;
}
2020-04-11 17:00:07 +00:00
static int CheckForTexture ( const FString & name , int type , int flags )
{
return TexMan . CheckForTexture ( name , static_cast < ETextureType > ( type ) , flags ) . GetIndex ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _TexMan , CheckForTexture , CheckForTexture )
{
PARAM_PROLOGUE ;
PARAM_STRING ( name ) ;
PARAM_INT ( type ) ;
PARAM_INT ( flags ) ;
ACTION_RETURN_INT ( CheckForTexture ( name , type , flags ) ) ;
}
//==========================================================================
//
//
//
//==========================================================================
DEFINE_ACTION_FUNCTION ( _TexMan , GetName )
{
PARAM_PROLOGUE ;
PARAM_INT ( texid ) ;
2020-04-14 18:45:26 +00:00
auto tex = TexMan . GameByIndex ( texid ) ;
2020-04-11 17:00:07 +00:00
FString retval ;
if ( tex ! = nullptr )
{
if ( tex - > GetName ( ) . IsNotEmpty ( ) ) retval = tex - > GetName ( ) ;
else
{
// Textures for full path names do not have their own name, they merely link to the source lump.
auto lump = tex - > GetSourceLump ( ) ;
if ( fileSystem . GetLinkedTexture ( lump ) = = tex )
retval = fileSystem . GetFileFullName ( lump ) ;
}
}
ACTION_RETURN_STRING ( retval ) ;
}
//==========================================================================
//
//
//
//==========================================================================
static int GetTextureSize ( int texid , int * py )
{
2020-04-14 18:45:26 +00:00
auto tex = TexMan . GameByIndex ( texid ) ;
2020-04-11 17:00:07 +00:00
int x , y ;
if ( tex ! = nullptr )
{
2020-04-14 18:45:26 +00:00
x = int ( 0.5 + tex - > GetDisplayWidth ( ) ) ;
y = int ( 0.5 + tex - > GetDisplayHeight ( ) ) ;
2020-04-11 17:00:07 +00:00
}
else x = y = - 1 ;
if ( py ) * py = y ;
return x ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _TexMan , GetSize , GetTextureSize )
{
PARAM_PROLOGUE ;
PARAM_INT ( texid ) ;
int x , y ;
x = GetTextureSize ( texid , & y ) ;
if ( numret > 0 ) ret [ 0 ] . SetInt ( x ) ;
if ( numret > 1 ) ret [ 1 ] . SetInt ( y ) ;
return MIN ( numret , 2 ) ;
}
//==========================================================================
//
//
//
//==========================================================================
static void GetScaledSize ( int texid , DVector2 * pvec )
{
2020-04-14 18:45:26 +00:00
auto tex = TexMan . GameByIndex ( texid ) ;
2020-04-11 17:00:07 +00:00
double x , y ;
if ( tex ! = nullptr )
{
2020-04-14 18:45:26 +00:00
x = tex - > GetDisplayWidth ( ) ;
y = tex - > GetDisplayHeight ( ) ;
2020-04-11 17:00:07 +00:00
}
else x = y = - 1 ;
if ( pvec )
{
pvec - > X = x ;
pvec - > Y = y ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _TexMan , GetScaledSize , GetScaledSize )
{
PARAM_PROLOGUE ;
PARAM_INT ( texid ) ;
DVector2 vec ;
GetScaledSize ( texid , & vec ) ;
ACTION_RETURN_VEC2 ( vec ) ;
}
//==========================================================================
//
//
//
//==========================================================================
static void GetScaledOffset ( int texid , DVector2 * pvec )
{
2020-04-14 18:45:26 +00:00
auto tex = TexMan . GameByIndex ( texid ) ;
2020-04-11 17:00:07 +00:00
double x , y ;
if ( tex ! = nullptr )
{
2020-04-14 18:45:26 +00:00
x = tex - > GetDisplayLeftOffset ( ) ;
y = tex - > GetDisplayTopOffset ( ) ;
2020-04-11 17:00:07 +00:00
}
else x = y = - 1 ;
if ( pvec )
{
pvec - > X = x ;
pvec - > Y = y ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( _TexMan , GetScaledOffset , GetScaledOffset )
{
PARAM_PROLOGUE ;
PARAM_INT ( texid ) ;
DVector2 vec ;
GetScaledOffset ( texid , & vec ) ;
ACTION_RETURN_VEC2 ( vec ) ;
}
//==========================================================================
//
//
//
//==========================================================================
static int CheckRealHeight ( int texid )
{
2020-04-14 18:45:26 +00:00
auto tex = TexMan . GameByIndex ( texid ) ;
2020-04-11 17:00:07 +00:00
if ( tex ! = nullptr ) return tex - > CheckRealHeight ( ) ;
else return - 1 ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _TexMan , CheckRealHeight , CheckRealHeight )
{
PARAM_PROLOGUE ;
PARAM_INT ( texid ) ;
ACTION_RETURN_INT ( CheckRealHeight ( texid ) ) ;
}
bool OkForLocalization ( FTextureID texnum , const char * substitute ) ;
static int OkForLocalization_ ( int index , const FString & substitute )
{
return OkForLocalization ( FSetTextureID ( index ) , substitute ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _TexMan , OkForLocalization , OkForLocalization_ )
{
PARAM_PROLOGUE ;
PARAM_INT ( name ) ;
PARAM_STRING ( subst )
ACTION_RETURN_INT ( OkForLocalization_ ( name , subst ) ) ;
}
2018-12-10 23:01:45 +00:00
2018-11-25 15:12:15 +00:00
//=====================================================================================
//
2018-12-01 09:29:23 +00:00
// secplane_t exports
2018-11-25 15:12:15 +00:00
//
//=====================================================================================
static int isSlope ( secplane_t * self )
{
return ! self - > normal . XY ( ) . isZero ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , isSlope , isSlope )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
ACTION_RETURN_BOOL ( ! self - > normal . XY ( ) . isZero ( ) ) ;
}
2018-11-25 15:12:15 +00:00
static int PointOnSide ( const secplane_t * self , double x , double y , double z )
{
return self - > PointOnSide ( DVector3 ( x , y , z ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , PointOnSide , PointOnSide )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( z ) ;
ACTION_RETURN_INT ( self - > PointOnSide ( DVector3 ( x , y , z ) ) ) ;
}
2018-11-25 15:12:15 +00:00
static double ZatPoint ( const secplane_t * self , double x , double y )
{
return self - > ZatPoint ( x , y ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , ZatPoint , ZatPoint )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
ACTION_RETURN_FLOAT ( self - > ZatPoint ( x , y ) ) ;
}
2018-11-25 15:12:15 +00:00
static double ZatPointDist ( const secplane_t * self , double x , double y , double d )
{
return ( d + self - > normal . X * x + self - > normal . Y * y ) * self - > negiC ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , ZatPointDist , ZatPointDist )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( d ) ;
2018-11-25 15:12:15 +00:00
ACTION_RETURN_FLOAT ( ZatPointDist ( self , x , y , d ) ) ;
2018-11-25 10:34:50 +00:00
}
2018-11-25 15:12:15 +00:00
static int isPlaneEqual ( const secplane_t * self , const secplane_t * other )
{
return * self = = * other ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , isEqual , isPlaneEqual )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_POINTER ( other , secplane_t ) ;
ACTION_RETURN_BOOL ( * self = = * other ) ;
}
2018-11-25 15:12:15 +00:00
static void ChangeHeight ( secplane_t * self , double hdiff )
{
self - > ChangeHeight ( hdiff ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , ChangeHeight , ChangeHeight )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_FLOAT ( hdiff ) ;
self - > ChangeHeight ( hdiff ) ;
return 0 ;
}
2018-11-25 15:12:15 +00:00
static double GetChangedHeight ( const secplane_t * self , double hdiff )
{
return self - > GetChangedHeight ( hdiff ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , GetChangedHeight , GetChangedHeight )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_FLOAT ( hdiff ) ;
ACTION_RETURN_FLOAT ( self - > GetChangedHeight ( hdiff ) ) ;
}
2018-11-25 15:12:15 +00:00
static double HeightDiff ( const secplane_t * self , double oldd , double newd )
2018-11-25 10:34:50 +00:00
{
if ( newd ! = 1e37 )
{
2018-11-25 15:12:15 +00:00
return self - > HeightDiff ( oldd ) ;
2018-11-25 10:34:50 +00:00
}
else
{
2018-11-25 15:12:15 +00:00
return self - > HeightDiff ( oldd , newd ) ;
2018-11-25 10:34:50 +00:00
}
}
2018-11-25 15:12:15 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , HeightDiff , HeightDiff )
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_FLOAT ( oldd ) ;
PARAM_FLOAT ( newd ) ;
ACTION_RETURN_FLOAT ( HeightDiff ( self , oldd , newd ) ) ;
}
static double PointToDist ( const secplane_t * self , double x , double y , double z )
{
return self - > PointToDist ( DVector2 ( x , y ) , z ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _Secplane , PointToDist , PointToDist )
2018-11-25 10:34:50 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( secplane_t ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( z ) ;
ACTION_RETURN_FLOAT ( self - > PointToDist ( DVector2 ( x , y ) , z ) ) ;
}
2018-12-01 09:29:23 +00:00
//=====================================================================================
//
// FFont exports
//
//=====================================================================================
static FFont * GetFont ( int name )
{
return V_GetFont ( FName ( ENamedName ( name ) ) . GetChars ( ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , GetFont , GetFont )
{
PARAM_PROLOGUE ;
PARAM_INT ( name ) ;
ACTION_RETURN_POINTER ( GetFont ( name ) ) ;
}
static FFont * FindFont ( int name )
{
return FFont : : FindFont ( FName ( ENamedName ( name ) ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , FindFont , FindFont )
{
PARAM_PROLOGUE ;
PARAM_NAME ( name ) ;
ACTION_RETURN_POINTER ( FFont : : FindFont ( name ) ) ;
}
static int GetCharWidth ( FFont * font , int code )
{
return font - > GetCharWidth ( code ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , GetCharWidth , GetCharWidth )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
PARAM_INT ( code ) ;
ACTION_RETURN_INT ( self - > GetCharWidth ( code ) ) ;
}
static int GetHeight ( FFont * font )
{
return font - > GetHeight ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , GetHeight , GetHeight )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
ACTION_RETURN_INT ( self - > GetHeight ( ) ) ;
}
2019-07-14 10:44:42 +00:00
static int GetDisplacement ( FFont * font )
{
return font - > GetDisplacement ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , GetDisplacement , GetDisplacement )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
ACTION_RETURN_INT ( self - > GetDisplacement ( ) ) ;
}
2018-12-01 09:29:23 +00:00
double GetBottomAlignOffset ( FFont * font , int c ) ;
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , GetBottomAlignOffset , GetBottomAlignOffset )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
PARAM_INT ( code ) ;
ACTION_RETURN_FLOAT ( GetBottomAlignOffset ( self , code ) ) ;
}
static int StringWidth ( FFont * font , const FString & str )
{
const char * txt = str [ 0 ] = = ' $ ' ? GStrings ( & str [ 1 ] ) : str . GetChars ( ) ;
return font - > StringWidth ( txt ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , StringWidth , StringWidth )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
PARAM_STRING ( str ) ;
ACTION_RETURN_INT ( StringWidth ( self , str ) ) ;
}
2019-07-30 08:52:24 +00:00
static int GetMaxAscender ( FFont * font , const FString & str )
{
const char * txt = str [ 0 ] = = ' $ ' ? GStrings ( & str [ 1 ] ) : str . GetChars ( ) ;
return font - > GetMaxAscender ( txt ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , GetMaxAscender , GetMaxAscender )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
PARAM_STRING ( str ) ;
ACTION_RETURN_INT ( GetMaxAscender ( self , str ) ) ;
}
2019-04-22 07:08:43 +00:00
static int CanPrint ( FFont * font , const FString & str )
{
const char * txt = str [ 0 ] = = ' $ ' ? GStrings ( & str [ 1 ] ) : str . GetChars ( ) ;
return font - > CanPrint ( txt ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , CanPrint , CanPrint )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
PARAM_STRING ( str ) ;
ACTION_RETURN_INT ( CanPrint ( self , str ) ) ;
}
2018-12-01 13:23:27 +00:00
static int FindFontColor ( int name )
{
return V_FindFontColor ( ENamedName ( name ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , FindFontColor , FindFontColor )
2018-12-01 09:29:23 +00:00
{
PARAM_PROLOGUE ;
PARAM_NAME ( code ) ;
ACTION_RETURN_INT ( ( int ) V_FindFontColor ( code ) ) ;
}
static void GetCursor ( FFont * font , FString * result )
{
* result = font - > GetCursor ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FFont , GetCursor , GetCursor )
{
PARAM_SELF_STRUCT_PROLOGUE ( FFont ) ;
ACTION_RETURN_STRING ( FString ( self - > GetCursor ( ) ) ) ;
}
2018-12-04 22:12:16 +00:00
//=====================================================================================
//
// 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 ;
2019-01-03 21:05:49 +00:00
PARAM_OBJECT ( pawn , AActor ) ;
2018-12-04 22:12:16 +00:00
FWeaponSlots : : SetupWeaponSlots ( pawn ) ;
return 0 ;
}
2018-12-04 17:16:01 +00:00
//=====================================================================================
//
// SpotState exports
//
//=====================================================================================
2018-12-04 17:21:48 +00:00
static void AddSpot ( DSpotState * state , AActor * spot )
2018-12-04 17:16:01 +00:00
{
2018-12-04 17:21:48 +00:00
state - > AddSpot ( spot ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DSpotState , AddSpot , AddSpot )
{
PARAM_SELF_PROLOGUE ( DSpotState ) ;
PARAM_OBJECT ( spot , AActor ) ;
self - > AddSpot ( spot ) ;
return 0 ;
}
static void RemoveSpot ( DSpotState * state , AActor * spot )
{
state - > RemoveSpot ( spot ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DSpotState , RemoveSpot , RemoveSpot )
{
PARAM_SELF_PROLOGUE ( DSpotState ) ;
PARAM_OBJECT ( spot , AActor ) ;
self - > RemoveSpot ( spot ) ;
return 0 ;
2018-12-04 17:16:01 +00:00
}
static AActor * GetNextInList ( DSpotState * self , PClassActor * type , int skipcounter )
{
return self - > GetNextInList ( type , skipcounter ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DSpotState , GetNextInList , GetNextInList )
{
PARAM_SELF_PROLOGUE ( DSpotState ) ;
PARAM_CLASS ( type , AActor ) ;
PARAM_INT ( skipcounter ) ;
ACTION_RETURN_OBJECT ( self - > GetNextInList ( type , skipcounter ) ) ;
}
static AActor * GetSpotWithMinMaxDistance ( DSpotState * self , PClassActor * type , double x , double y , double mindist , double maxdist )
{
return self - > GetSpotWithMinMaxDistance ( type , x , y , mindist , maxdist ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DSpotState , GetSpotWithMinMaxDistance , GetSpotWithMinMaxDistance )
{
PARAM_SELF_PROLOGUE ( DSpotState ) ;
PARAM_CLASS ( type , AActor ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( mindist ) ;
PARAM_FLOAT ( maxdist ) ;
ACTION_RETURN_OBJECT ( self - > GetSpotWithMinMaxDistance ( type , x , y , mindist , maxdist ) ) ;
}
static AActor * GetRandomSpot ( DSpotState * self , PClassActor * type , bool onlyonce )
{
return self - > GetRandomSpot ( type , onlyonce ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DSpotState , GetRandomSpot , GetRandomSpot )
{
PARAM_SELF_PROLOGUE ( DSpotState ) ;
PARAM_CLASS ( type , AActor ) ;
PARAM_BOOL ( onlyonce ) ;
ACTION_RETURN_POINTER ( self - > GetRandomSpot ( type , onlyonce ) ) ;
}
2018-12-01 15:53:54 +00:00
//=====================================================================================
//
// Statusbar exports
//
//=====================================================================================
static void SBar_SetSize ( DBaseStatusBar * self , int rt , int vw , int vh , int hvw , int hvh )
{
self - > SetSize ( rt , vw , vh , hvw , hvh ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , SetSize , SBar_SetSize )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_INT ( rt ) ;
PARAM_INT ( vw ) ;
PARAM_INT ( vh ) ;
PARAM_INT ( hvw ) ;
PARAM_INT ( hvh ) ;
self - > SetSize ( rt , vw , vh , hvw , hvh ) ;
return 0 ;
}
static void SBar_GetHUDScale ( DBaseStatusBar * self , DVector2 * result )
{
* result = self - > GetHUDScale ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetHUDScale , SBar_GetHUDScale )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
ACTION_RETURN_VEC2 ( self - > GetHUDScale ( ) ) ;
}
static void BeginStatusBar ( DBaseStatusBar * self , bool fs , int w , int h , int r )
{
self - > BeginStatusBar ( w , h , r , fs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , BeginStatusBar , BeginStatusBar )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_BOOL ( fs ) ;
PARAM_INT ( w ) ;
PARAM_INT ( h ) ;
PARAM_INT ( r ) ;
self - > BeginStatusBar ( w , h , r , fs ) ;
return 0 ;
}
static void BeginHUD ( DBaseStatusBar * self , double a , bool fs , int w , int h )
{
self - > BeginHUD ( w , h , a , fs ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , BeginHUD , BeginHUD )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_FLOAT ( a ) ;
PARAM_BOOL ( fs ) ;
PARAM_INT ( w ) ;
PARAM_INT ( h ) ;
self - > BeginHUD ( w , h , a , fs ) ;
return 0 ;
}
static void UpdateScreenGeometry ( DBaseStatusBar * )
{
setsizeneeded = true ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , UpdateScreenGeometry , UpdateScreenGeometry )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
setsizeneeded = true ;
return 0 ;
}
static void SBar_Tick ( DBaseStatusBar * self )
{
self - > Tick ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , Tick , SBar_Tick )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
self - > Tick ( ) ;
return 0 ;
}
static void SBar_AttachMessage ( DBaseStatusBar * self , DHUDMessageBase * msg , unsigned id , int layer )
{
self - > AttachMessage ( msg , id , layer ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , AttachMessage , SBar_AttachMessage )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_OBJECT ( msg , DHUDMessageBase ) ;
PARAM_UINT ( id ) ;
PARAM_INT ( layer ) ;
self - > AttachMessage ( msg , id , layer ) ;
return 0 ;
}
static void SBar_DetachMessage ( DBaseStatusBar * self , DHUDMessageBase * msg )
{
self - > DetachMessage ( msg ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , DetachMessage , SBar_DetachMessage )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_OBJECT ( msg , DHUDMessageBase ) ;
ACTION_RETURN_OBJECT ( self - > DetachMessage ( msg ) ) ;
}
static void SBar_DetachMessageID ( DBaseStatusBar * self , unsigned id )
{
self - > DetachMessage ( id ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , DetachMessageID , SBar_DetachMessageID )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_INT ( id ) ;
ACTION_RETURN_OBJECT ( self - > DetachMessage ( id ) ) ;
}
static void SBar_DetachAllMessages ( DBaseStatusBar * self )
{
self - > DetachAllMessages ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , DetachAllMessages , SBar_DetachAllMessages )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
self - > DetachAllMessages ( ) ;
return 0 ;
}
static void SBar_Draw ( DBaseStatusBar * self , int state , double ticFrac )
{
self - > Draw ( ( EHudState ) state , ticFrac ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , Draw , SBar_Draw )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_INT ( state ) ;
PARAM_FLOAT ( ticFrac ) ;
self - > Draw ( ( EHudState ) state , ticFrac ) ;
return 0 ;
}
static void SetMugshotState ( DBaseStatusBar * self , const FString & statename , bool wait , bool reset )
{
self - > mugshot . SetState ( statename , wait , reset ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , SetMugshotState , SetMugshotState )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_STRING ( statename ) ;
PARAM_BOOL ( wait ) ;
PARAM_BOOL ( reset ) ;
self - > mugshot . SetState ( statename , wait , reset ) ;
return 0 ;
}
static void SBar_ScreenSizeChanged ( DBaseStatusBar * self )
{
self - > ScreenSizeChanged ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , ScreenSizeChanged , SBar_ScreenSizeChanged )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
self - > ScreenSizeChanged ( ) ;
return 0 ;
}
static double StatusbarToRealCoords ( DBaseStatusBar * self , double x , double y , double w , double h , double * py , double * pw , double * ph )
{
self - > StatusbarToRealCoords ( x , y , w , h ) ;
* py = y ;
* pw = w ;
* ph = h ;
return x ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , StatusbarToRealCoords , StatusbarToRealCoords )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( w ) ;
PARAM_FLOAT ( h ) ;
self - > StatusbarToRealCoords ( x , y , w , h ) ;
if ( numret > 0 ) ret [ 0 ] . SetFloat ( x ) ;
if ( numret > 1 ) ret [ 1 ] . SetFloat ( y ) ;
if ( numret > 2 ) ret [ 2 ] . SetFloat ( w ) ;
if ( numret > 3 ) ret [ 3 ] . SetFloat ( h ) ;
return MIN ( 4 , numret ) ;
}
static int GetTopOfStatusbar ( DBaseStatusBar * self )
{
return self - > GetTopOfStatusbar ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetTopOfStatusbar , GetTopOfStatusbar )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
ACTION_RETURN_INT ( self - > GetTopOfStatusbar ( ) ) ;
}
void SBar_DrawTexture ( DBaseStatusBar * self , int texid , double x , double y , int flags , double alpha , double w , double h , double scaleX , double scaleY )
{
2020-04-11 17:46:57 +00:00
if ( ! twod - > HasBegun2D ( ) ) ThrowAbortException ( X_OTHER , " Attempt to draw to screen outside a draw function " ) ;
2018-12-01 15:53:54 +00:00
self - > DrawGraphic ( FSetTextureID ( texid ) , x , y , flags , alpha , w , h , scaleX , scaleY ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , DrawTexture , SBar_DrawTexture )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_INT ( texid ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_INT ( flags ) ;
PARAM_FLOAT ( alpha ) ;
PARAM_FLOAT ( w ) ;
PARAM_FLOAT ( h ) ;
PARAM_FLOAT ( scaleX ) ;
PARAM_FLOAT ( scaleY ) ;
SBar_DrawTexture ( self , texid , x , y , flags , alpha , w , h , scaleX , scaleY ) ;
return 0 ;
}
void SBar_DrawImage ( DBaseStatusBar * self , const FString & texid , double x , double y , int flags , double alpha , double w , double h , double scaleX , double scaleY )
{
2020-04-11 17:46:57 +00:00
if ( ! twod - > HasBegun2D ( ) ) ThrowAbortException ( X_OTHER , " Attempt to draw to screen outside a draw function " ) ;
2018-12-01 15:53:54 +00:00
self - > DrawGraphic ( TexMan . CheckForTexture ( texid , ETextureType : : Any ) , x , y , flags , alpha , w , h , scaleX , scaleY ) ;
}
2018-12-04 17:16:01 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , DrawImage , SBar_DrawImage )
2018-12-01 15:53:54 +00:00
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_STRING ( texid ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_INT ( flags ) ;
PARAM_FLOAT ( alpha ) ;
PARAM_FLOAT ( w ) ;
PARAM_FLOAT ( h ) ;
PARAM_FLOAT ( scaleX ) ;
PARAM_FLOAT ( scaleY ) ;
SBar_DrawImage ( self , texid , x , y , flags , alpha , w , h , scaleX , scaleY ) ;
return 0 ;
}
2019-11-14 15:51:06 +00:00
void SBar_DrawString ( DBaseStatusBar * self , DHUDFont * font , const FString & string , double x , double y , int flags , int trans , double alpha , int wrapwidth , int linespacing , double scaleX , double scaleY ) ;
2018-12-01 15:53:54 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , DrawString , SBar_DrawString )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_POINTER_NOT_NULL ( font , DHUDFont ) ;
PARAM_STRING ( string ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_INT ( flags ) ;
PARAM_INT ( trans ) ;
PARAM_FLOAT ( alpha ) ;
PARAM_INT ( wrapwidth ) ;
PARAM_INT ( linespacing ) ;
2019-11-14 15:51:06 +00:00
PARAM_FLOAT ( scaleX ) ;
PARAM_FLOAT ( scaleY ) ;
SBar_DrawString ( self , font , string , x , y , flags , trans , alpha , wrapwidth , linespacing , scaleX , scaleY ) ;
2018-12-01 15:53:54 +00:00
return 0 ;
}
static double SBar_TransformRect ( DBaseStatusBar * self , double x , double y , double w , double h , int flags , double * py , double * pw , double * ph )
{
self - > TransformRect ( x , y , w , h , flags ) ;
* py = y ;
* pw = w ;
* ph = h ;
return x ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , TransformRect , SBar_TransformRect )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( w ) ;
PARAM_FLOAT ( h ) ;
PARAM_INT ( flags ) ;
self - > TransformRect ( x , y , w , h , flags ) ;
if ( numret > 0 ) ret [ 0 ] . SetFloat ( x ) ;
if ( numret > 1 ) ret [ 1 ] . SetFloat ( y ) ;
if ( numret > 2 ) ret [ 2 ] . SetFloat ( w ) ;
if ( numret > 3 ) ret [ 3 ] . SetFloat ( h ) ;
return MIN ( 4 , numret ) ;
}
static void SBar_Fill ( DBaseStatusBar * self , int color , double x , double y , double w , double h , int flags )
{
2020-04-11 17:46:57 +00:00
if ( ! twod - > HasBegun2D ( ) ) ThrowAbortException ( X_OTHER , " Attempt to draw to screen outside a draw function " ) ;
2018-12-01 15:53:54 +00:00
self - > Fill ( color , x , y , w , h , flags ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , Fill , SBar_Fill )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_COLOR ( color ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( w ) ;
PARAM_FLOAT ( h ) ;
PARAM_INT ( flags ) ;
SBar_Fill ( self , color , x , y , w , h , flags ) ;
return 0 ;
}
2018-12-04 18:14:14 +00:00
static void SBar_SetClipRect ( DBaseStatusBar * self , double x , double y , double w , double h , int flags )
2018-12-01 15:53:54 +00:00
{
self - > SetClipRect ( x , y , w , h , flags ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , SetClipRect , SBar_SetClipRect )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( w ) ;
PARAM_FLOAT ( h ) ;
PARAM_INT ( flags ) ;
self - > SetClipRect ( x , y , w , h , flags ) ;
return 0 ;
}
static void GetGlobalACSString ( int index , FString * result )
{
2019-02-01 23:24:43 +00:00
* result = primaryLevel - > Behaviors . LookupString ( ACS_GlobalVars [ index ] ) ;
2018-12-01 15:53:54 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetGlobalACSString , GetGlobalACSString )
{
PARAM_PROLOGUE ;
PARAM_INT ( index ) ;
2019-01-27 18:16:14 +00:00
FString res ;
GetGlobalACSString ( index , & res ) ;
ACTION_RETURN_STRING ( res ) ;
2018-12-01 15:53:54 +00:00
}
static void GetGlobalACSArrayString ( int arrayno , int index , FString * result )
{
2019-02-01 23:24:43 +00:00
* result = primaryLevel - > Behaviors . LookupString ( ACS_GlobalVars [ index ] ) ;
2018-12-01 15:53:54 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetGlobalACSArrayString , GetGlobalACSArrayString )
{
PARAM_PROLOGUE ;
PARAM_INT ( arrayno ) ;
PARAM_INT ( index ) ;
2019-01-27 18:16:14 +00:00
FString res ;
GetGlobalACSArrayString ( arrayno , index , & res ) ;
ACTION_RETURN_STRING ( res ) ;
2018-12-01 15:53:54 +00:00
}
static int GetGlobalACSValue ( int index )
{
return ( ACS_GlobalVars [ index ] ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetGlobalACSValue , GetGlobalACSValue )
{
PARAM_PROLOGUE ;
PARAM_INT ( index ) ;
ACTION_RETURN_INT ( ACS_GlobalVars [ index ] ) ;
}
static int GetGlobalACSArrayValue ( int arrayno , int index )
{
return ( ACS_GlobalArrays [ arrayno ] [ index ] ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetGlobalACSArrayValue , GetGlobalACSArrayValue )
{
PARAM_PROLOGUE ;
PARAM_INT ( arrayno ) ;
PARAM_INT ( index ) ;
ACTION_RETURN_INT ( ACS_GlobalArrays [ arrayno ] [ index ] ) ;
}
void FormatNumber ( int number , int minsize , int maxsize , int flags , const FString & prefix , FString * result ) ;
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , FormatNumber , FormatNumber )
{
PARAM_PROLOGUE ;
PARAM_INT ( number ) ;
PARAM_INT ( minsize ) ;
PARAM_INT ( maxsize ) ;
PARAM_INT ( flags ) ;
PARAM_STRING ( prefix ) ;
FString fmt ;
FormatNumber ( number , minsize , maxsize , flags , prefix , & fmt ) ;
ACTION_RETURN_STRING ( fmt ) ;
}
static void ReceivedWeapon ( DBaseStatusBar * self )
{
self - > mugshot . Grin ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , ReceivedWeapon , ReceivedWeapon )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
ReceivedWeapon ( self ) ;
return 0 ;
}
static int GetMugshot ( DBaseStatusBar * self , int accuracy , int stateflags , const FString & def_face )
{
auto tex = self - > mugshot . GetFace ( self - > CPlayer , def_face , accuracy , ( FMugShot : : StateFlags ) stateflags ) ;
2018-12-06 00:11:04 +00:00
return ( tex ? tex - > GetID ( ) . GetIndex ( ) : - 1 ) ;
2018-12-01 15:53:54 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetMugshot , GetMugshot )
{
PARAM_SELF_PROLOGUE ( DBaseStatusBar ) ;
PARAM_INT ( accuracy ) ;
PARAM_INT ( stateflags ) ;
PARAM_STRING ( def_face ) ;
ACTION_RETURN_INT ( GetMugshot ( self , accuracy , stateflags , def_face ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( DBaseStatusBar , GetInventoryIcon , GetInventoryIcon )
{
PARAM_PROLOGUE ;
2018-12-04 16:11:36 +00:00
PARAM_OBJECT ( item , AActor ) ;
2018-12-01 15:53:54 +00:00
PARAM_INT ( flags ) ;
int applyscale ;
2018-12-03 20:57:07 +00:00
FTextureID icon = FSetTextureID ( GetInventoryIcon ( item , flags , & applyscale ) ) ;
2018-12-01 15:53:54 +00:00
if ( numret > = 1 ) ret [ 0 ] . SetInt ( icon . GetIndex ( ) ) ;
if ( numret > = 2 ) ret [ 1 ] . SetInt ( applyscale ) ;
return MIN ( numret , 2 ) ;
}
//=====================================================================================
//
//
//
//=====================================================================================
2019-04-13 16:10:58 +00:00
DHUDFont * CreateHudFont ( FFont * fnt , int spac , int mono , int sx , int sy )
2018-12-01 15:53:54 +00:00
{
2019-04-13 16:10:58 +00:00
return ( Create < DHUDFont > ( fnt , spac , EMonospacing ( mono ) , sy , sy ) ) ;
2018-12-01 15:53:54 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( DHUDFont , Create , CreateHudFont )
{
PARAM_PROLOGUE ;
PARAM_POINTER ( fnt , FFont ) ;
PARAM_INT ( spac ) ;
2019-04-13 16:10:58 +00:00
PARAM_INT ( mono ) ;
2018-12-01 15:53:54 +00:00
PARAM_INT ( sx ) ;
PARAM_INT ( sy ) ;
2019-04-13 16:10:58 +00:00
ACTION_RETURN_POINTER ( Create < DHUDFont > ( fnt , spac , EMonospacing ( mono ) , sy , sy ) ) ;
2018-12-01 15:53:54 +00:00
}
//=====================================================================================
//
//
//
//=====================================================================================
2019-01-05 09:04:27 +00:00
DSpotState * GetSpotState ( FLevelLocals * self , int create )
{
if ( create & & self - > SpotState = = nullptr ) self - > SpotState = Create < DSpotState > ( ) ;
GC : : WriteBarrier ( self - > SpotState ) ;
return self - > SpotState ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , GetSpotState , GetSpotState )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_INT ( create ) ;
ACTION_RETURN_POINTER ( GetSpotState ( self , create ) ) ;
}
2019-01-25 17:16:18 +00:00
//---------------------------------------------------------------------------
//
// Format the map name, include the map label if wanted
//
//---------------------------------------------------------------------------
EXTERN_CVAR ( Int , am_showmaplabel )
2019-04-10 18:39:15 +00:00
void FormatMapName ( FLevelLocals * self , int cr , FString * result )
2018-12-01 15:53:54 +00:00
{
char mapnamecolor [ 3 ] = { ' \34 ' , char ( cr + ' A ' ) , 0 } ;
2019-01-25 17:16:18 +00:00
cluster_info_t * cluster = FindClusterInfo ( self - > cluster ) ;
bool ishub = ( cluster ! = nullptr & & ( cluster - > flags & CLUSTER_HUB ) ) ;
* result = " " ;
if ( am_showmaplabel = = 1 | | ( am_showmaplabel = = 2 & & ! ishub ) )
{
* result < < self - > MapName < < " : " ;
}
* result < < mapnamecolor < < self - > LevelName ;
2018-12-01 15:53:54 +00:00
}
2018-12-02 11:24:51 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , FormatMapName , FormatMapName )
2018-12-01 15:53:54 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_INT ( cr ) ;
FString rets ;
FormatMapName ( self , cr , & rets ) ;
ACTION_RETURN_STRING ( rets ) ;
}
2019-01-26 14:21:20 +00:00
static void GetAutomapPosition ( FLevelLocals * self , DVector2 * pos )
2018-12-02 11:24:51 +00:00
{
2019-01-26 14:21:20 +00:00
* pos = self - > automap - > GetPosition ( ) ;
2018-12-02 11:24:51 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , GetAutomapPosition , GetAutomapPosition )
{
2019-01-26 14:21:20 +00:00
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
DVector2 result ;
GetAutomapPosition ( self , & result ) ;
ACTION_RETURN_VEC2 ( result ) ;
2018-12-02 11:24:51 +00:00
}
2018-12-06 15:04:41 +00:00
static int ZGetUDMFInt ( FLevelLocals * self , int type , int index , int key )
2018-12-04 22:12:16 +00:00
{
2019-01-29 23:37:29 +00:00
return GetUDMFInt ( self , type , index , ENamedName ( key ) ) ;
2018-12-04 22:12:16 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , GetUDMFInt , ZGetUDMFInt )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_INT ( type ) ;
PARAM_INT ( index ) ;
PARAM_NAME ( key ) ;
2019-01-29 23:37:29 +00:00
ACTION_RETURN_INT ( GetUDMFInt ( self , type , index , key ) ) ;
2018-12-04 22:12:16 +00:00
}
2018-12-06 15:04:41 +00:00
static double ZGetUDMFFloat ( FLevelLocals * self , int type , int index , int key )
2018-12-04 22:12:16 +00:00
{
2019-01-29 23:37:29 +00:00
return GetUDMFFloat ( self , type , index , ENamedName ( key ) ) ;
2018-12-04 22:12:16 +00:00
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , GetUDMFFloat , ZGetUDMFFloat )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_INT ( type ) ;
PARAM_INT ( index ) ;
PARAM_NAME ( key ) ;
2019-01-29 23:37:29 +00:00
ACTION_RETURN_FLOAT ( GetUDMFFloat ( self , type , index , key ) ) ;
2018-12-04 22:12:16 +00:00
}
2018-12-06 15:04:41 +00:00
static void ZGetUDMFString ( FLevelLocals * self , int type , int index , int key , FString * result )
2018-12-04 22:12:16 +00:00
{
2019-01-29 23:37:29 +00:00
* result = GetUDMFString ( self , type , index , ENamedName ( key ) ) ;
2018-12-04 22:12:16 +00:00
}
2018-12-05 07:18:07 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , GetUDMFString , ZGetUDMFString )
2018-12-04 22:12:16 +00:00
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_INT ( type ) ;
PARAM_INT ( index ) ;
PARAM_NAME ( key ) ;
2019-01-29 23:37:29 +00:00
ACTION_RETURN_STRING ( GetUDMFString ( self , type , index , key ) ) ;
2018-12-04 22:12:16 +00:00
}
2018-12-19 17:41:53 +00:00
DEFINE_ACTION_FUNCTION ( FLevelLocals , GetChecksum )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
char md5string [ 33 ] ;
for ( int j = 0 ; j < 16 ; + + j )
{
2019-01-27 18:16:14 +00:00
sprintf ( md5string + j * 2 , " %02x " , self - > md5 [ j ] ) ;
2018-12-19 17:41:53 +00:00
}
ACTION_RETURN_STRING ( ( const char * ) md5string ) ;
}
2019-01-29 01:04:31 +00:00
static void Vec2Offset ( FLevelLocals * Level , double x , double y , double dx , double dy , bool absolute , DVector2 * result )
2018-12-21 12:52:30 +00:00
{
if ( absolute )
{
* result = ( DVector2 ( x + dx , y + dy ) ) ;
}
else
{
2019-01-29 01:04:31 +00:00
* result = Level - > GetPortalOffsetPosition ( x , y , dx , dy ) ;
2018-12-21 12:52:30 +00:00
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , Vec2Offset , Vec2Offset )
{
2019-01-29 01:04:31 +00:00
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
2018-12-21 12:52:30 +00:00
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( dx ) ;
PARAM_FLOAT ( dy ) ;
PARAM_BOOL ( absolute ) ;
DVector2 result ;
2019-01-29 01:04:31 +00:00
Vec2Offset ( self , x , y , dx , dy , absolute , & result ) ;
2018-12-21 12:52:30 +00:00
ACTION_RETURN_VEC2 ( result ) ;
}
2019-01-29 01:04:31 +00:00
static void Vec2OffsetZ ( FLevelLocals * Level , double x , double y , double dx , double dy , double atz , bool absolute , DVector3 * result )
2018-12-21 12:52:30 +00:00
{
if ( absolute )
{
* result = ( DVector3 ( x + dx , y + dy , atz ) ) ;
}
else
{
2019-01-29 01:51:06 +00:00
DVector2 v = Level - > GetPortalOffsetPosition ( x , y , dx , dy ) ;
2018-12-21 12:52:30 +00:00
* result = ( DVector3 ( v , atz ) ) ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , Vec2OffsetZ , Vec2OffsetZ )
{
2019-01-29 01:04:31 +00:00
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
2018-12-21 12:52:30 +00:00
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( dx ) ;
PARAM_FLOAT ( dy ) ;
PARAM_FLOAT ( atz ) ;
PARAM_BOOL ( absolute ) ;
DVector3 result ;
2019-01-29 01:04:31 +00:00
Vec2OffsetZ ( self , x , y , dx , dy , atz , absolute , & result ) ;
2018-12-21 12:52:30 +00:00
ACTION_RETURN_VEC3 ( result ) ;
}
2019-01-29 01:04:31 +00:00
static void Vec3Offset ( FLevelLocals * Level , double x , double y , double z , double dx , double dy , double dz , bool absolute , DVector3 * result )
2018-12-21 12:52:30 +00:00
{
if ( absolute )
{
* result = ( DVector3 ( x + dx , y + dy , z + dz ) ) ;
}
else
{
2019-01-29 01:04:31 +00:00
DVector2 v = Level - > GetPortalOffsetPosition ( x , y , dx , dy ) ;
2018-12-21 12:52:30 +00:00
* result = ( DVector3 ( v , z + dz ) ) ;
}
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , Vec3Offset , Vec3Offset )
{
2019-01-29 01:04:31 +00:00
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
2018-12-21 12:52:30 +00:00
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( z ) ;
PARAM_FLOAT ( dx ) ;
PARAM_FLOAT ( dy ) ;
PARAM_FLOAT ( dz ) ;
PARAM_BOOL ( absolute ) ;
DVector3 result ;
2019-01-29 01:04:31 +00:00
Vec3Offset ( self , x , y , z , dx , dy , dz , absolute , & result ) ;
2018-12-21 12:52:30 +00:00
ACTION_RETURN_VEC3 ( result ) ;
}
2019-01-29 01:04:31 +00:00
int IsPointInMap ( FLevelLocals * Level , double x , double y , double z ) ;
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , IsPointInLevel , IsPointInMap )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_FLOAT ( x ) ;
PARAM_FLOAT ( y ) ;
PARAM_FLOAT ( z ) ;
ACTION_RETURN_BOOL ( IsPointInMap ( self , x , y , z ) ) ;
}
template < typename T >
inline T VecDiff ( FLevelLocals * Level , const T & v1 , const T & v2 )
{
T result = v2 - v1 ;
if ( Level - > subsectors . Size ( ) > 0 )
{
const sector_t * sec1 = Level - > PointInSector ( v1 ) ;
const sector_t * sec2 = Level - > PointInSector ( v2 ) ;
if ( nullptr ! = sec1 & & nullptr ! = sec2 )
{
result + = Level - > Displacements . getOffset ( sec2 - > PortalGroup , sec1 - > PortalGroup ) ;
}
}
return result ;
}
void Vec2Diff ( FLevelLocals * Level , double x1 , double y1 , double x2 , double y2 , DVector2 * result )
{
* result = VecDiff ( Level , DVector2 ( x1 , y1 ) , DVector2 ( x2 , y2 ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , Vec2Diff , Vec2Diff )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_FLOAT ( x1 ) ;
PARAM_FLOAT ( y1 ) ;
PARAM_FLOAT ( x2 ) ;
PARAM_FLOAT ( y2 ) ;
ACTION_RETURN_VEC2 ( VecDiff ( self , DVector2 ( x1 , y1 ) , DVector2 ( x2 , y2 ) ) ) ;
}
void Vec3Diff ( FLevelLocals * Level , double x1 , double y1 , double z1 , double x2 , double y2 , double z2 , DVector3 * result )
{
* result = VecDiff ( Level , DVector3 ( x1 , y1 , z1 ) , DVector3 ( x2 , y2 , z2 ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , Vec3Diff , Vec3Diff )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_FLOAT ( x1 ) ;
PARAM_FLOAT ( y1 ) ;
PARAM_FLOAT ( z1 ) ;
PARAM_FLOAT ( x2 ) ;
PARAM_FLOAT ( y2 ) ;
PARAM_FLOAT ( z2 ) ;
ACTION_RETURN_VEC3 ( VecDiff ( self , DVector3 ( x1 , y1 , z1 ) , DVector3 ( x2 , y2 , z2 ) ) ) ;
}
void SphericalCoords ( FLevelLocals * self , double vpX , double vpY , double vpZ , double tX , double tY , double tZ , double viewYaw , double viewPitch , int absolute , DVector3 * result )
{
DVector3 viewpoint ( vpX , vpY , vpZ ) ;
DVector3 target ( tX , tY , tZ ) ;
auto vecTo = absolute ? target - viewpoint : VecDiff ( self , viewpoint , target ) ;
* result = ( DVector3 (
deltaangle ( vecTo . Angle ( ) , viewYaw ) . Degrees ,
deltaangle ( vecTo . Pitch ( ) , viewPitch ) . Degrees ,
vecTo . Length ( )
) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , SphericalCoords , SphericalCoords )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_FLOAT ( viewpointX ) ;
PARAM_FLOAT ( viewpointY ) ;
PARAM_FLOAT ( viewpointZ ) ;
PARAM_FLOAT ( targetX ) ;
PARAM_FLOAT ( targetY ) ;
PARAM_FLOAT ( targetZ ) ;
PARAM_FLOAT ( viewYaw ) ;
PARAM_FLOAT ( viewPitch ) ;
PARAM_BOOL ( absolute ) ;
DVector3 result ;
2019-06-29 16:39:02 +00:00
SphericalCoords ( self , viewpointX , viewpointY , viewpointZ , targetX , targetY , targetZ , viewYaw , viewPitch , absolute , & result ) ;
2019-01-29 01:04:31 +00:00
ACTION_RETURN_VEC3 ( result ) ;
}
2019-01-28 19:15:48 +00:00
static int isFrozen ( FLevelLocals * self )
{
return self - > isFrozen ( ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , isFrozen , isFrozen )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
2019-07-07 12:31:06 +00:00
ACTION_RETURN_INT ( isFrozen ( self ) ) ;
2019-01-28 19:15:48 +00:00
}
void setFrozen ( FLevelLocals * self , int on )
{
self - > frozenstate = ( self - > frozenstate & ~ 1 ) | ! ! on ;
}
2018-12-21 12:52:30 +00:00
2019-01-28 19:15:48 +00:00
DEFINE_ACTION_FUNCTION_NATIVE ( FLevelLocals , setFrozen , setFrozen )
{
PARAM_SELF_STRUCT_PROLOGUE ( FLevelLocals ) ;
PARAM_BOOL ( on ) ;
setFrozen ( self , on ) ;
return 0 ;
}
2018-12-21 12:52:30 +00:00
2018-12-04 22:12:16 +00:00
//=====================================================================================
//
//
//
//=====================================================================================
2018-12-02 11:24:51 +00:00
static int GetRealTime ( )
{
time_t now ;
time ( & now ) ;
struct tm * timeinfo = localtime ( & now ) ;
return timeinfo ? timeinfo - > tm_sec + timeinfo - > tm_min * 60 + timeinfo - > tm_hour * 3600 : 0 ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _AltHUD , GetRealTime , GetRealTime )
{
PARAM_PROLOGUE ;
ACTION_RETURN_INT ( GetRealTime ( ) ) ;
}
DEFINE_ACTION_FUNCTION_NATIVE ( _AltHUD , GetLatency , Net_GetLatency )
{
PARAM_PROLOGUE ;
int ld , ad ;
int severity = Net_GetLatency ( & ld , & ad ) ;
if ( numret > 0 ) ret [ 0 ] . SetInt ( severity ) ;
if ( numret > 1 ) ret [ 1 ] . SetInt ( ld ) ;
if ( numret > 2 ) ret [ 2 ] . SetInt ( ad ) ;
return numret ;
}
2020-04-11 11:26:42 +00:00
//==========================================================================
//
// file system
//
//==========================================================================
2020-04-11 11:27:19 +00:00
DEFINE_ACTION_FUNCTION ( _Wads , GetNumEntries )
2020-04-11 11:26:42 +00:00
{
PARAM_PROLOGUE ;
2020-04-11 11:27:19 +00:00
ACTION_RETURN_INT ( fileSystem . GetNumEntries ( ) ) ;
2020-04-11 11:26:42 +00:00
}
DEFINE_ACTION_FUNCTION ( _Wads , CheckNumForName )
{
PARAM_PROLOGUE ;
PARAM_STRING ( name ) ;
PARAM_INT ( ns ) ;
PARAM_INT ( wadnum ) ;
PARAM_BOOL ( exact ) ;
ACTION_RETURN_INT ( fileSystem . CheckNumForName ( name , ns , wadnum , exact ) ) ;
}
DEFINE_ACTION_FUNCTION ( _Wads , CheckNumForFullName )
{
PARAM_PROLOGUE ;
PARAM_STRING ( name ) ;
ACTION_RETURN_INT ( fileSystem . CheckNumForFullName ( name ) ) ;
}
DEFINE_ACTION_FUNCTION ( _Wads , FindLump )
{
PARAM_PROLOGUE ;
PARAM_STRING ( name ) ;
PARAM_INT ( startlump ) ;
PARAM_INT ( ns ) ;
2020-04-11 11:27:19 +00:00
const bool isLumpValid = startlump > = 0 & & startlump < fileSystem . GetNumEntries ( ) ;
2020-04-11 11:26:42 +00:00
ACTION_RETURN_INT ( isLumpValid ? fileSystem . FindLump ( name , & startlump , 0 ! = ns ) : - 1 ) ;
}
DEFINE_ACTION_FUNCTION ( _Wads , GetLumpName )
{
PARAM_PROLOGUE ;
PARAM_INT ( lump ) ;
FString lumpname ;
2020-04-11 11:27:19 +00:00
fileSystem . GetFileShortName ( lumpname , lump ) ;
2020-04-11 11:26:42 +00:00
ACTION_RETURN_STRING ( lumpname ) ;
}
DEFINE_ACTION_FUNCTION ( _Wads , GetLumpFullName )
{
PARAM_PROLOGUE ;
PARAM_INT ( lump ) ;
2020-04-11 11:27:19 +00:00
ACTION_RETURN_STRING ( fileSystem . GetFileFullName ( lump ) ) ;
2020-04-11 11:26:42 +00:00
}
DEFINE_ACTION_FUNCTION ( _Wads , GetLumpNamespace )
{
PARAM_PROLOGUE ;
PARAM_INT ( lump ) ;
2020-04-11 11:27:19 +00:00
ACTION_RETURN_INT ( fileSystem . GetFileNamespace ( lump ) ) ;
2020-04-11 11:26:42 +00:00
}
DEFINE_ACTION_FUNCTION ( _Wads , ReadLump )
{
PARAM_PROLOGUE ;
PARAM_INT ( lump ) ;
2020-04-11 11:27:19 +00:00
const bool isLumpValid = lump > = 0 & & lump < fileSystem . GetNumEntries ( ) ;
ACTION_RETURN_STRING ( isLumpValid ? fileSystem . ReadFile ( lump ) . GetString ( ) : FString ( ) ) ;
2020-04-11 11:26:42 +00:00
}
2020-04-11 11:48:55 +00:00
//==========================================================================
//
// CVARs
//
//==========================================================================
DEFINE_ACTION_FUNCTION ( _CVar , GetInt )
{
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
auto v = self - > GetGenericRep ( CVAR_Int ) ;
ACTION_RETURN_INT ( v . Int ) ;
}
DEFINE_ACTION_FUNCTION ( _CVar , GetFloat )
{
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
auto v = self - > GetGenericRep ( CVAR_Float ) ;
ACTION_RETURN_FLOAT ( v . Float ) ;
}
DEFINE_ACTION_FUNCTION ( _CVar , GetString )
{
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
auto v = self - > GetGenericRep ( CVAR_String ) ;
ACTION_RETURN_STRING ( v . String ) ;
}
DEFINE_ACTION_FUNCTION ( _CVar , SetInt )
{
// Only menus are allowed to change CVARs.
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
if ( ! ( self - > GetFlags ( ) & CVAR_MOD ) )
{
// Only menus are allowed to change non-mod CVARs.
if ( DMenu : : InMenu = = 0 )
{
ThrowAbortException ( X_OTHER , " Attempt to change CVAR '%s' outside of menu code " , self - > GetName ( ) ) ;
}
}
PARAM_INT ( val ) ;
UCVarValue v ;
v . Int = val ;
self - > SetGenericRep ( v , CVAR_Int ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( _CVar , SetFloat )
{
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
if ( ! ( self - > GetFlags ( ) & CVAR_MOD ) )
{
// Only menus are allowed to change non-mod CVARs.
if ( DMenu : : InMenu = = 0 )
{
ThrowAbortException ( X_OTHER , " Attempt to change CVAR '%s' outside of menu code " , self - > GetName ( ) ) ;
}
}
PARAM_FLOAT ( val ) ;
UCVarValue v ;
v . Float = ( float ) val ;
self - > SetGenericRep ( v , CVAR_Float ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( _CVar , SetString )
{
// Only menus are allowed to change CVARs.
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
if ( ! ( self - > GetFlags ( ) & CVAR_MOD ) )
{
// Only menus are allowed to change non-mod CVARs.
if ( DMenu : : InMenu = = 0 )
{
ThrowAbortException ( X_OTHER , " Attempt to change CVAR '%s' outside of menu code " , self - > GetName ( ) ) ;
}
}
PARAM_STRING ( val ) ;
UCVarValue v ;
v . String = val . GetChars ( ) ;
self - > SetGenericRep ( v , CVAR_String ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( _CVar , GetRealType )
{
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
ACTION_RETURN_INT ( self - > GetRealType ( ) ) ;
}
DEFINE_ACTION_FUNCTION ( _CVar , ResetToDefault )
{
PARAM_SELF_STRUCT_PROLOGUE ( FBaseCVar ) ;
if ( ! ( self - > GetFlags ( ) & CVAR_MOD ) )
{
// Only menus are allowed to change non-mod CVARs.
if ( DMenu : : InMenu = = 0 )
{
ThrowAbortException ( X_OTHER , " Attempt to change CVAR '%s' outside of menu code " , self - > GetName ( ) ) ;
}
}
self - > ResetToDefault ( ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( _CVar , FindCVar )
{
PARAM_PROLOGUE ;
PARAM_NAME ( name ) ;
ACTION_RETURN_POINTER ( FindCVar ( name . GetChars ( ) , nullptr ) ) ;
}
DEFINE_ACTION_FUNCTION ( _CVar , GetCVar )
{
PARAM_PROLOGUE ;
PARAM_NAME ( name ) ;
PARAM_POINTER ( plyr , player_t ) ;
ACTION_RETURN_POINTER ( GetCVar ( plyr ? int ( plyr - players ) : - 1 , name . GetChars ( ) ) ) ;
}
2020-04-11 15:59:15 +00:00
//=============================================================================
//
//
//
//=============================================================================
DEFINE_ACTION_FUNCTION ( FKeyBindings , SetBind )
{
PARAM_SELF_STRUCT_PROLOGUE ( FKeyBindings ) ;
PARAM_INT ( k ) ;
PARAM_STRING ( cmd ) ;
// Only menus are allowed to change bindings.
if ( DMenu : : InMenu = = 0 )
{
I_FatalError ( " Attempt to change key bindings outside of menu code to '%s' " , cmd . GetChars ( ) ) ;
}
self - > SetBind ( k , cmd ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( FKeyBindings , NameKeys )
{
PARAM_PROLOGUE ;
PARAM_INT ( k1 ) ;
PARAM_INT ( k2 ) ;
char buffer [ 120 ] ;
C_NameKeys ( buffer , k1 , k2 ) ;
ACTION_RETURN_STRING ( buffer ) ;
}
DEFINE_ACTION_FUNCTION ( FKeyBindings , GetKeysForCommand )
{
PARAM_SELF_STRUCT_PROLOGUE ( FKeyBindings ) ;
PARAM_STRING ( cmd ) ;
int k1 , k2 ;
self - > GetKeysForCommand ( cmd . GetChars ( ) , & k1 , & k2 ) ;
if ( numret > 0 ) ret [ 0 ] . SetInt ( k1 ) ;
if ( numret > 1 ) ret [ 1 ] . SetInt ( k2 ) ;
return MIN ( numret , 2 ) ;
}
DEFINE_ACTION_FUNCTION ( FKeyBindings , UnbindACommand )
{
PARAM_SELF_STRUCT_PROLOGUE ( FKeyBindings ) ;
PARAM_STRING ( cmd ) ;
// Only menus are allowed to change bindings.
if ( DMenu : : InMenu = = 0 )
{
I_FatalError ( " Attempt to unbind key bindings for '%s' outside of menu code " , cmd . GetChars ( ) ) ;
}
self - > UnbindACommand ( cmd ) ;
return 0 ;
}
2020-04-11 16:04:07 +00:00
// This is only accessible to the special menu item to run CCMDs.
DEFINE_ACTION_FUNCTION ( DOptionMenuItemCommand , DoCommand )
{
if ( CurrentMenu = = nullptr ) return 0 ;
PARAM_PROLOGUE ;
PARAM_STRING ( cmd ) ;
PARAM_BOOL ( unsafe ) ;
UnsafeExecutionScope scope ( unsafe ) ;
C_DoCommand ( cmd ) ;
return 0 ;
}
2020-04-11 16:06:52 +00:00
DEFINE_ACTION_FUNCTION ( _Console , MidPrint )
{
PARAM_PROLOGUE ;
PARAM_POINTER ( fnt , FFont ) ;
PARAM_STRING ( text ) ;
PARAM_BOOL ( bold ) ;
const char * txt = text [ 0 ] = = ' $ ' ? GStrings ( & text [ 1 ] ) : text . GetChars ( ) ;
C_MidPrint ( fnt , txt , bold ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( _Console , HideConsole )
{
C_HideConsole ( ) ;
return 0 ;
}
DEFINE_ACTION_FUNCTION ( _Console , Printf )
{
PARAM_PROLOGUE ;
PARAM_VA_POINTER ( va_reginfo ) // Get the hidden type information array
FString s = FStringFormat ( VM_ARGS_NAMES ) ;
Printf ( " %s \n " , s . GetChars ( ) ) ;
return 0 ;
}
2020-04-11 15:59:15 +00:00
2020-04-11 11:26:42 +00:00
2020-04-11 16:23:15 +00:00
DEFINE_ACTION_FUNCTION ( DObject , S_ChangeMusic )
{
PARAM_PROLOGUE ;
PARAM_STRING ( music ) ;
PARAM_INT ( order ) ;
PARAM_BOOL ( looping ) ;
PARAM_BOOL ( force ) ;
ACTION_RETURN_BOOL ( S_ChangeMusic ( music , order , looping , force ) ) ;
}
2020-04-11 11:26:42 +00:00
2018-12-21 12:52:30 +00:00
//==========================================================================
//
//
//
//==========================================================================
2019-02-02 16:29:13 +00:00
DEFINE_GLOBAL_NAMED ( currentVMLevel , level )
2018-12-21 12:52:30 +00:00
DEFINE_FIELD ( FLevelLocals , sectors )
DEFINE_FIELD ( FLevelLocals , lines )
DEFINE_FIELD ( FLevelLocals , sides )
DEFINE_FIELD ( FLevelLocals , vertexes )
DEFINE_FIELD ( FLevelLocals , sectorPortals )
DEFINE_FIELD ( FLevelLocals , time )
DEFINE_FIELD ( FLevelLocals , maptime )
DEFINE_FIELD ( FLevelLocals , totaltime )
DEFINE_FIELD ( FLevelLocals , starttime )
DEFINE_FIELD ( FLevelLocals , partime )
DEFINE_FIELD ( FLevelLocals , sucktime )
DEFINE_FIELD ( FLevelLocals , cluster )
DEFINE_FIELD ( FLevelLocals , clusterflags )
DEFINE_FIELD ( FLevelLocals , levelnum )
DEFINE_FIELD ( FLevelLocals , LevelName )
DEFINE_FIELD ( FLevelLocals , MapName )
DEFINE_FIELD ( FLevelLocals , NextMap )
DEFINE_FIELD ( FLevelLocals , NextSecretMap )
DEFINE_FIELD ( FLevelLocals , F1Pic )
2019-08-02 07:11:40 +00:00
DEFINE_FIELD ( FLevelLocals , AuthorName )
2018-12-21 12:52:30 +00:00
DEFINE_FIELD ( FLevelLocals , maptype )
DEFINE_FIELD ( FLevelLocals , Music )
DEFINE_FIELD ( FLevelLocals , musicorder )
DEFINE_FIELD ( FLevelLocals , skytexture1 )
DEFINE_FIELD ( FLevelLocals , skytexture2 )
DEFINE_FIELD ( FLevelLocals , skyspeed1 )
DEFINE_FIELD ( FLevelLocals , skyspeed2 )
DEFINE_FIELD ( FLevelLocals , total_secrets )
DEFINE_FIELD ( FLevelLocals , found_secrets )
DEFINE_FIELD ( FLevelLocals , total_items )
DEFINE_FIELD ( FLevelLocals , found_items )
DEFINE_FIELD ( FLevelLocals , total_monsters )
DEFINE_FIELD ( FLevelLocals , killed_monsters )
DEFINE_FIELD ( FLevelLocals , gravity )
DEFINE_FIELD ( FLevelLocals , aircontrol )
DEFINE_FIELD ( FLevelLocals , airfriction )
DEFINE_FIELD ( FLevelLocals , airsupply )
DEFINE_FIELD ( FLevelLocals , teamdamage )
DEFINE_FIELD ( FLevelLocals , fogdensity )
DEFINE_FIELD ( FLevelLocals , outsidefogdensity )
DEFINE_FIELD ( FLevelLocals , skyfog )
DEFINE_FIELD ( FLevelLocals , pixelstretch )
2020-01-20 20:45:49 +00:00
DEFINE_FIELD ( FLevelLocals , MusicVolume )
2018-12-21 12:52:30 +00:00
DEFINE_FIELD ( FLevelLocals , deathsequence )
2019-02-08 19:04:45 +00:00
DEFINE_FIELD_BIT ( FLevelLocals , frozenstate , frozen , 1 ) // still needed for backwards compatibility.
2019-02-09 08:17:57 +00:00
DEFINE_FIELD_NAMED ( FLevelLocals , i_compatflags , compatflags )
DEFINE_FIELD_NAMED ( FLevelLocals , i_compatflags2 , compatflags2 )
2019-01-28 19:15:48 +00:00
2018-12-21 12:52:30 +00:00
DEFINE_FIELD_BIT ( FLevelLocals , flags , noinventorybar , LEVEL_NOINVENTORYBAR )
DEFINE_FIELD_BIT ( FLevelLocals , flags , monsterstelefrag , LEVEL_MONSTERSTELEFRAG )
DEFINE_FIELD_BIT ( FLevelLocals , flags , actownspecial , LEVEL_ACTOWNSPECIAL )
DEFINE_FIELD_BIT ( FLevelLocals , flags , sndseqtotalctrl , LEVEL_SNDSEQTOTALCTRL )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , allmap , LEVEL2_ALLMAP )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , missilesactivateimpact , LEVEL2_MISSILESACTIVATEIMPACT )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , monsterfallingdamage , LEVEL2_MONSTERFALLINGDAMAGE )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , checkswitchrange , LEVEL2_CHECKSWITCHRANGE )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , polygrind , LEVEL2_POLYGRIND )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , allowrespawn , LEVEL2_ALLOWRESPAWN )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , nomonsters , LEVEL2_NOMONSTERS )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , infinite_flight , LEVEL2_INFINITE_FLIGHT )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , no_dlg_freeze , LEVEL2_CONV_SINGLE_UNFREEZE )
DEFINE_FIELD_BIT ( FLevelLocals , flags2 , keepfullinventory , LEVEL2_KEEPFULLINVENTORY )
DEFINE_FIELD_BIT ( FLevelLocals , flags3 , removeitems , LEVEL3_REMOVEITEMS )
2018-11-27 23:11:06 +00:00
DEFINE_FIELD_X ( Sector , sector_t , floorplane )
DEFINE_FIELD_X ( Sector , sector_t , ceilingplane )
DEFINE_FIELD_X ( Sector , sector_t , Colormap )
DEFINE_FIELD_X ( Sector , sector_t , SpecialColors )
2018-12-21 00:03:52 +00:00
DEFINE_FIELD_X ( Sector , sector_t , AdditiveColors )
2018-11-27 23:11:06 +00:00
DEFINE_FIELD_X ( Sector , sector_t , SoundTarget )
DEFINE_FIELD_X ( Sector , sector_t , special )
DEFINE_FIELD_X ( Sector , sector_t , lightlevel )
DEFINE_FIELD_X ( Sector , sector_t , seqType )
DEFINE_FIELD_X ( Sector , sector_t , sky )
DEFINE_FIELD_X ( Sector , sector_t , SeqName )
DEFINE_FIELD_X ( Sector , sector_t , centerspot )
DEFINE_FIELD_X ( Sector , sector_t , validcount )
DEFINE_FIELD_X ( Sector , sector_t , thinglist )
DEFINE_FIELD_X ( Sector , sector_t , friction )
DEFINE_FIELD_X ( Sector , sector_t , movefactor )
DEFINE_FIELD_X ( Sector , sector_t , terrainnum )
DEFINE_FIELD_X ( Sector , sector_t , floordata )
DEFINE_FIELD_X ( Sector , sector_t , ceilingdata )
DEFINE_FIELD_X ( Sector , sector_t , lightingdata )
2019-01-29 23:58:44 +00:00
DEFINE_FIELD_X ( Sector , sector_t , Level )
2018-11-27 23:11:06 +00:00
DEFINE_FIELD_X ( Sector , sector_t , interpolations )
DEFINE_FIELD_X ( Sector , sector_t , soundtraversed )
DEFINE_FIELD_X ( Sector , sector_t , stairlock )
DEFINE_FIELD_X ( Sector , sector_t , prevsec )
DEFINE_FIELD_X ( Sector , sector_t , nextsec )
DEFINE_FIELD_UNSIZED ( Sector , sector_t , Lines )
DEFINE_FIELD_X ( Sector , sector_t , heightsec )
DEFINE_FIELD_X ( Sector , sector_t , bottommap )
DEFINE_FIELD_X ( Sector , sector_t , midmap )
DEFINE_FIELD_X ( Sector , sector_t , topmap )
DEFINE_FIELD_X ( Sector , sector_t , touching_thinglist )
DEFINE_FIELD_X ( Sector , sector_t , sectorportal_thinglist )
DEFINE_FIELD_X ( Sector , sector_t , gravity )
DEFINE_FIELD_X ( Sector , sector_t , damagetype )
DEFINE_FIELD_X ( Sector , sector_t , damageamount )
DEFINE_FIELD_X ( Sector , sector_t , damageinterval )
DEFINE_FIELD_X ( Sector , sector_t , leakydamage )
DEFINE_FIELD_X ( Sector , sector_t , ZoneNumber )
DEFINE_FIELD_X ( Sector , sector_t , healthceiling )
DEFINE_FIELD_X ( Sector , sector_t , healthfloor )
DEFINE_FIELD_X ( Sector , sector_t , healthceilinggroup )
DEFINE_FIELD_X ( Sector , sector_t , healthfloorgroup )
DEFINE_FIELD_X ( Sector , sector_t , MoreFlags )
DEFINE_FIELD_X ( Sector , sector_t , Flags )
DEFINE_FIELD_X ( Sector , sector_t , SecActTarget )
DEFINE_FIELD_X ( Sector , sector_t , Portals )
DEFINE_FIELD_X ( Sector , sector_t , PortalGroup )
DEFINE_FIELD_X ( Sector , sector_t , sectornum )
DEFINE_FIELD_X ( Line , line_t , v1 )
DEFINE_FIELD_X ( Line , line_t , v2 )
DEFINE_FIELD_X ( Line , line_t , delta )
DEFINE_FIELD_X ( Line , line_t , flags )
DEFINE_FIELD_X ( Line , line_t , activation )
DEFINE_FIELD_X ( Line , line_t , special )
DEFINE_FIELD_X ( Line , line_t , args )
DEFINE_FIELD_X ( Line , line_t , alpha )
DEFINE_FIELD_X ( Line , line_t , sidedef )
DEFINE_FIELD_X ( Line , line_t , bbox )
DEFINE_FIELD_X ( Line , line_t , frontsector )
DEFINE_FIELD_X ( Line , line_t , backsector )
DEFINE_FIELD_X ( Line , line_t , validcount )
DEFINE_FIELD_X ( Line , line_t , locknumber )
DEFINE_FIELD_X ( Line , line_t , portalindex )
DEFINE_FIELD_X ( Line , line_t , portaltransferred )
DEFINE_FIELD_X ( Line , line_t , health )
DEFINE_FIELD_X ( Line , line_t , healthgroup )
DEFINE_FIELD_X ( Side , side_t , sector )
DEFINE_FIELD_X ( Side , side_t , linedef )
DEFINE_FIELD_X ( Side , side_t , Light )
DEFINE_FIELD_X ( Side , side_t , Flags )
DEFINE_FIELD_X ( Secplane , secplane_t , normal )
DEFINE_FIELD_X ( Secplane , secplane_t , D )
DEFINE_FIELD_X ( Secplane , secplane_t , negiC )
2019-08-04 13:55:17 +00:00
DEFINE_FIELD_NAMED_X ( F3DFloor , F3DFloor , bottom . plane , bottom ) ;
DEFINE_FIELD_NAMED_X ( F3DFloor , F3DFloor , top . plane , top ) ;
DEFINE_FIELD_X ( F3DFloor , F3DFloor , flags ) ;
DEFINE_FIELD_X ( F3DFloor , F3DFloor , master ) ;
DEFINE_FIELD_X ( F3DFloor , F3DFloor , model ) ;
DEFINE_FIELD_X ( F3DFloor , F3DFloor , target ) ;
DEFINE_FIELD_X ( F3DFloor , F3DFloor , alpha ) ;
2018-11-27 23:11:06 +00:00
DEFINE_FIELD_X ( Vertex , vertex_t , p )
2018-12-01 15:53:54 +00:00
DEFINE_FIELD ( DBaseStatusBar , RelTop ) ;
DEFINE_FIELD ( DBaseStatusBar , HorizontalResolution ) ;
DEFINE_FIELD ( DBaseStatusBar , VerticalResolution ) ;
DEFINE_FIELD ( DBaseStatusBar , Centering ) ;
DEFINE_FIELD ( DBaseStatusBar , FixedOrigin ) ;
DEFINE_FIELD ( DBaseStatusBar , CompleteBorder ) ;
DEFINE_FIELD ( DBaseStatusBar , CrosshairSize ) ;
DEFINE_FIELD ( DBaseStatusBar , Displacement ) ;
DEFINE_FIELD ( DBaseStatusBar , CPlayer ) ;
DEFINE_FIELD ( DBaseStatusBar , ShowLog ) ;
DEFINE_FIELD ( DBaseStatusBar , Alpha ) ;
DEFINE_FIELD ( DBaseStatusBar , drawOffset ) ;
DEFINE_FIELD ( DBaseStatusBar , drawClip ) ;
DEFINE_FIELD ( DBaseStatusBar , fullscreenOffsets ) ;
DEFINE_FIELD ( DBaseStatusBar , defaultScale ) ;
DEFINE_FIELD ( DBaseStatusBar , artiflashTick ) ;
DEFINE_FIELD ( DBaseStatusBar , itemflashFade ) ;
DEFINE_FIELD ( DHUDFont , mFont ) ;
DEFINE_GLOBAL ( StatusBar ) ;
2020-04-11 15:59:15 +00:00
DEFINE_GLOBAL ( Bindings )
DEFINE_GLOBAL ( AutomapBindings )
2020-04-11 16:23:15 +00:00
DEFINE_GLOBAL_NAMED ( mus_playing , musplaying ) ;
DEFINE_FIELD_X ( MusPlayingInfo , MusPlayingInfo , name ) ;
DEFINE_FIELD_X ( MusPlayingInfo , MusPlayingInfo , baseorder ) ;
DEFINE_FIELD_X ( MusPlayingInfo , MusPlayingInfo , loop ) ;
2020-04-11 17:34:08 +00:00