mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- exported GetUDMF methods to scripting.
This commit is contained in:
parent
8d7a64bd17
commit
6fef653aa1
4 changed files with 102 additions and 4 deletions
|
@ -118,8 +118,8 @@ void P_LoadTranslator(const char *lumpname);
|
||||||
void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid = -1);
|
void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid = -1);
|
||||||
int P_TranslateSectorSpecial (int);
|
int P_TranslateSectorSpecial (int);
|
||||||
|
|
||||||
int GetUDMFInt(int type, int index, const char *key);
|
int GetUDMFInt(int type, int index, FName key);
|
||||||
double GetUDMFFloat(int type, int index, const char *key);
|
double GetUDMFFloat(int type, int index, FName key);
|
||||||
|
|
||||||
bool P_LoadGLNodes(MapData * map);
|
bool P_LoadGLNodes(MapData * map);
|
||||||
bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime);
|
bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime);
|
||||||
|
|
|
@ -342,7 +342,7 @@ FUDMFKey *FUDMFKeys::Find(FName key)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int GetUDMFInt(int type, int index, const char *key)
|
int GetUDMFInt(int type, int index, FName key)
|
||||||
{
|
{
|
||||||
assert(type >=0 && type <=3);
|
assert(type >=0 && type <=3);
|
||||||
|
|
||||||
|
@ -359,7 +359,16 @@ int GetUDMFInt(int type, int index, const char *key)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetUDMFFloat(int type, int index, const char *key)
|
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFInt)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||||
|
PARAM_INT(type);
|
||||||
|
PARAM_INT(index);
|
||||||
|
PARAM_NAME(key);
|
||||||
|
ACTION_RETURN_INT(GetUDMFInt(type, index, key));
|
||||||
|
}
|
||||||
|
|
||||||
|
double GetUDMFFloat(int type, int index, FName key)
|
||||||
{
|
{
|
||||||
assert(type >=0 && type <=3);
|
assert(type >=0 && type <=3);
|
||||||
|
|
||||||
|
@ -376,6 +385,41 @@ double GetUDMFFloat(int type, int index, const char *key)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFFloat)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||||
|
PARAM_INT(type);
|
||||||
|
PARAM_INT(index);
|
||||||
|
PARAM_NAME(key);
|
||||||
|
ACTION_RETURN_FLOAT(GetUDMFFloat(type, index, key));
|
||||||
|
}
|
||||||
|
|
||||||
|
FString GetUDMFString(int type, int index, FName key)
|
||||||
|
{
|
||||||
|
assert(type >= 0 && type <= 3);
|
||||||
|
|
||||||
|
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
||||||
|
|
||||||
|
if (pKeys != NULL)
|
||||||
|
{
|
||||||
|
FUDMFKey *pKey = pKeys->Find(key);
|
||||||
|
if (pKey != NULL)
|
||||||
|
{
|
||||||
|
return pKey->StringVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFString)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||||
|
PARAM_INT(type);
|
||||||
|
PARAM_INT(index);
|
||||||
|
PARAM_NAME(key);
|
||||||
|
ACTION_RETURN_STRING(GetUDMFString(type, index, key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
|
|
@ -418,6 +418,14 @@ class SpotState : Object native
|
||||||
|
|
||||||
struct LevelLocals native
|
struct LevelLocals native
|
||||||
{
|
{
|
||||||
|
enum EUDMF
|
||||||
|
{
|
||||||
|
UDMF_Line,
|
||||||
|
UDMF_Side,
|
||||||
|
UDMF_Sector,
|
||||||
|
//UDMF_Thing // not implemented
|
||||||
|
};
|
||||||
|
|
||||||
native readonly int time;
|
native readonly int time;
|
||||||
native readonly int maptime;
|
native readonly int maptime;
|
||||||
native readonly int totaltime;
|
native readonly int totaltime;
|
||||||
|
@ -457,6 +465,11 @@ struct LevelLocals native
|
||||||
native bool frozen;
|
native bool frozen;
|
||||||
native bool infinite_flight;
|
native bool infinite_flight;
|
||||||
// level_info_t *info cannot be done yet.
|
// level_info_t *info cannot be done yet.
|
||||||
|
|
||||||
|
native String GetUDMFString(int type, int index, Name key);
|
||||||
|
native int GetUDMFInt(int type, int index, Name key);
|
||||||
|
native double GetUDMFFloat(int type, int index, Name key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct StringTable native
|
struct StringTable native
|
||||||
|
|
|
@ -84,6 +84,20 @@ struct Side native
|
||||||
native Vertex V2();
|
native Vertex V2();
|
||||||
|
|
||||||
native int Index();
|
native int Index();
|
||||||
|
|
||||||
|
int GetUDMFInt(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFInt(LevelLocals.UDMF_Side, Index(), nm);
|
||||||
|
}
|
||||||
|
double GetUDMFFloat(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFFloat(LevelLocals.UDMF_Side, Index(), nm);
|
||||||
|
}
|
||||||
|
String GetUDMFString(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFString(LevelLocals.UDMF_Side, Index(), nm);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Line native
|
struct Line native
|
||||||
|
@ -142,6 +156,19 @@ struct Line native
|
||||||
native Line getPortalDestination();
|
native Line getPortalDestination();
|
||||||
native int getPortalAlignment();
|
native int getPortalAlignment();
|
||||||
native int Index();
|
native int Index();
|
||||||
|
|
||||||
|
int GetUDMFInt(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFInt(LevelLocals.UDMF_Line, Index(), nm);
|
||||||
|
}
|
||||||
|
double GetUDMFFloat(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFFloat(LevelLocals.UDMF_Line, Index(), nm);
|
||||||
|
}
|
||||||
|
String GetUDMFString(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFString(LevelLocals.UDMF_Line, Index(), nm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SecPlane native
|
struct SecPlane native
|
||||||
|
@ -398,4 +425,18 @@ struct Sector native
|
||||||
{
|
{
|
||||||
Flags &= ~SECF_SECRET;
|
Flags &= ~SECF_SECRET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetUDMFInt(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFInt(LevelLocals.UDMF_Sector, Index(), nm);
|
||||||
|
}
|
||||||
|
double GetUDMFFloat(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFFloat(LevelLocals.UDMF_Sector, Index(), nm);
|
||||||
|
}
|
||||||
|
String GetUDMFString(Name nm)
|
||||||
|
{
|
||||||
|
return Level.GetUDMFString(LevelLocals.UDMF_Sector, Index(), nm);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue