mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
- moved UDMF custom properties into FLevelLocals.
This commit is contained in:
parent
f410762695
commit
ebdb2643c4
6 changed files with 32 additions and 42 deletions
|
@ -96,6 +96,7 @@ class DSectorMarker;
|
||||||
|
|
||||||
typedef TMap<int, int> FDialogueIDMap; // maps dialogue IDs to dialogue array index (for ACS)
|
typedef TMap<int, int> FDialogueIDMap; // maps dialogue IDs to dialogue array index (for ACS)
|
||||||
typedef TMap<FName, int> FDialogueMap; // maps actor class names to dialogue array index
|
typedef TMap<FName, int> FDialogueMap; // maps actor class names to dialogue array index
|
||||||
|
typedef TMap<int, FUDMFKeys> FUDMFKeyMap;
|
||||||
|
|
||||||
struct FLevelLocals
|
struct FLevelLocals
|
||||||
{
|
{
|
||||||
|
@ -435,6 +436,7 @@ public:
|
||||||
|
|
||||||
FBlockmap blockmap;
|
FBlockmap blockmap;
|
||||||
TArray<polyblock_t *> PolyBlockMap;
|
TArray<polyblock_t *> PolyBlockMap;
|
||||||
|
FUDMFKeyMap UDMFKeys[4];
|
||||||
|
|
||||||
// These are copies of the loaded map data that get used by the savegame code to skip unaltered fields
|
// These are copies of the loaded map data that get used by the savegame code to skip unaltered fields
|
||||||
// Without such a mechanism the savegame format would become too slow and large because more than 80-90% are normally still unaltered.
|
// Without such a mechanism the savegame format would become too slow and large because more than 80-90% are normally still unaltered.
|
||||||
|
|
|
@ -285,20 +285,6 @@ const char *UDMFParserBase::CheckString(const char *key)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
typedef TMap<int, FUDMFKeys> FUDMFKeyMap;
|
|
||||||
|
|
||||||
|
|
||||||
static FUDMFKeyMap UDMFKeys[4];
|
|
||||||
// Things must be handled differently
|
|
||||||
|
|
||||||
void P_ClearUDMFKeys()
|
|
||||||
{
|
|
||||||
for(int i=0;i<4;i++)
|
|
||||||
{
|
|
||||||
UDMFKeys[i].Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int udmfcmp(const void *a, const void *b)
|
static int udmfcmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
FUDMFKey *A = (FUDMFKey*)a;
|
FUDMFKey *A = (FUDMFKey*)a;
|
||||||
|
@ -346,11 +332,11 @@ FUDMFKey *FUDMFKeys::Find(FName key)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int GetUDMFInt(int type, int index, FName key)
|
int GetUDMFInt(FLevelLocals *Level, int type, int index, FName key)
|
||||||
{
|
{
|
||||||
assert(type >=0 && type <=3);
|
assert(type >=0 && type <=3);
|
||||||
|
|
||||||
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
FUDMFKeys *pKeys = Level->UDMFKeys[type].CheckKey(index);
|
||||||
|
|
||||||
if (pKeys != NULL)
|
if (pKeys != NULL)
|
||||||
{
|
{
|
||||||
|
@ -363,11 +349,11 @@ int GetUDMFInt(int type, int index, FName key)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetUDMFFloat(int type, int index, FName key)
|
double GetUDMFFloat(FLevelLocals *Level, int type, int index, FName key)
|
||||||
{
|
{
|
||||||
assert(type >=0 && type <=3);
|
assert(type >=0 && type <=3);
|
||||||
|
|
||||||
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
FUDMFKeys *pKeys = Level->UDMFKeys[type].CheckKey(index);
|
||||||
|
|
||||||
if (pKeys != NULL)
|
if (pKeys != NULL)
|
||||||
{
|
{
|
||||||
|
@ -380,11 +366,11 @@ double GetUDMFFloat(int type, int index, FName key)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString GetUDMFString(int type, int index, FName key)
|
FString GetUDMFString(FLevelLocals *Level, int type, int index, FName key)
|
||||||
{
|
{
|
||||||
assert(type >= 0 && type <= 3);
|
assert(type >= 0 && type <= 3);
|
||||||
|
|
||||||
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
FUDMFKeys *pKeys = Level->UDMFKeys[type].CheckKey(index);
|
||||||
|
|
||||||
if (pKeys != NULL)
|
if (pKeys != NULL)
|
||||||
{
|
{
|
||||||
|
@ -459,7 +445,7 @@ public:
|
||||||
}
|
}
|
||||||
void AddUserKey(FName key, int kind, int index)
|
void AddUserKey(FName key, int kind, int index)
|
||||||
{
|
{
|
||||||
FUDMFKeys &keyarray = UDMFKeys[kind][index];
|
FUDMFKeys &keyarray = Level->UDMFKeys[kind][index];
|
||||||
|
|
||||||
for(unsigned i=0; i < keyarray.Size(); i++)
|
for(unsigned i=0; i < keyarray.Size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5277,26 +5277,26 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
||||||
switch(funcIndex)
|
switch(funcIndex)
|
||||||
{
|
{
|
||||||
case ACSF_GetLineUDMFInt:
|
case ACSF_GetLineUDMFInt:
|
||||||
return GetUDMFInt(UDMF_Line, LineFromID(args[0]), Level->Behaviors.LookupString(args[1]));
|
return GetUDMFInt(Level, UDMF_Line, LineFromID(args[0]), Level->Behaviors.LookupString(args[1]));
|
||||||
|
|
||||||
case ACSF_GetLineUDMFFixed:
|
case ACSF_GetLineUDMFFixed:
|
||||||
return DoubleToACS(GetUDMFFloat(UDMF_Line, LineFromID(args[0]), Level->Behaviors.LookupString(args[1])));
|
return DoubleToACS(GetUDMFFloat(Level, UDMF_Line, LineFromID(args[0]), Level->Behaviors.LookupString(args[1])));
|
||||||
|
|
||||||
case ACSF_GetThingUDMFInt:
|
case ACSF_GetThingUDMFInt:
|
||||||
case ACSF_GetThingUDMFFixed:
|
case ACSF_GetThingUDMFFixed:
|
||||||
return 0; // Not implemented yet
|
return 0; // Not implemented yet
|
||||||
|
|
||||||
case ACSF_GetSectorUDMFInt:
|
case ACSF_GetSectorUDMFInt:
|
||||||
return GetUDMFInt(UDMF_Sector, Level->FindFirstSectorFromTag(args[0]), Level->Behaviors.LookupString(args[1]));
|
return GetUDMFInt(Level, UDMF_Sector, Level->FindFirstSectorFromTag(args[0]), Level->Behaviors.LookupString(args[1]));
|
||||||
|
|
||||||
case ACSF_GetSectorUDMFFixed:
|
case ACSF_GetSectorUDMFFixed:
|
||||||
return DoubleToACS(GetUDMFFloat(UDMF_Sector, Level->FindFirstSectorFromTag(args[0]), Level->Behaviors.LookupString(args[1])));
|
return DoubleToACS(GetUDMFFloat(Level, UDMF_Sector, Level->FindFirstSectorFromTag(args[0]), Level->Behaviors.LookupString(args[1])));
|
||||||
|
|
||||||
case ACSF_GetSideUDMFInt:
|
case ACSF_GetSideUDMFInt:
|
||||||
return GetUDMFInt(UDMF_Side, SideFromID(args[0], args[1]), Level->Behaviors.LookupString(args[2]));
|
return GetUDMFInt(Level, UDMF_Side, SideFromID(args[0], args[1]), Level->Behaviors.LookupString(args[2]));
|
||||||
|
|
||||||
case ACSF_GetSideUDMFFixed:
|
case ACSF_GetSideUDMFFixed:
|
||||||
return DoubleToACS(GetUDMFFloat(UDMF_Side, SideFromID(args[0], args[1]), Level->Behaviors.LookupString(args[2])));
|
return DoubleToACS(GetUDMFFloat(Level, UDMF_Side, SideFromID(args[0], args[1]), Level->Behaviors.LookupString(args[2])));
|
||||||
|
|
||||||
case ACSF_GetActorVelX:
|
case ACSF_GetActorVelX:
|
||||||
actor = Level->SingleActorFromTID(args[0], activator);
|
actor = Level->SingleActorFromTID(args[0], activator);
|
||||||
|
|
|
@ -74,8 +74,6 @@
|
||||||
#include "am_map.h"
|
#include "am_map.h"
|
||||||
#include "fragglescript/t_script.h"
|
#include "fragglescript/t_script.h"
|
||||||
|
|
||||||
void P_ClearUDMFKeys();
|
|
||||||
|
|
||||||
extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);
|
extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);
|
||||||
|
|
||||||
extern unsigned int R_OldBlend;
|
extern unsigned int R_OldBlend;
|
||||||
|
@ -261,6 +259,11 @@ void FLevelLocals::ClearLevelData()
|
||||||
killed_monsters = found_items = found_secrets =
|
killed_monsters = found_items = found_secrets =
|
||||||
wminfo.maxfrags = 0;
|
wminfo.maxfrags = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
UDMFKeys[i].Clear();
|
||||||
|
}
|
||||||
|
|
||||||
SN_StopAllSequences(this);
|
SN_StopAllSequences(this);
|
||||||
|
|
||||||
FStrifeDialogueNode *node;
|
FStrifeDialogueNode *node;
|
||||||
|
@ -345,7 +348,6 @@ void P_FreeLevelData ()
|
||||||
// [ZZ] delete per-map event handlers
|
// [ZZ] delete per-map event handlers
|
||||||
E_Shutdown(true);
|
E_Shutdown(true);
|
||||||
R_FreePastViewers();
|
R_FreePastViewers();
|
||||||
P_ClearUDMFKeys();
|
|
||||||
|
|
||||||
DThinker::DestroyAllThinkers ();
|
DThinker::DestroyAllThinkers ();
|
||||||
|
|
||||||
|
|
|
@ -153,9 +153,9 @@ struct maplinedef_t;
|
||||||
void P_LoadTranslator(const char *lumpname);
|
void P_LoadTranslator(const char *lumpname);
|
||||||
int P_TranslateSectorSpecial (int);
|
int P_TranslateSectorSpecial (int);
|
||||||
|
|
||||||
int GetUDMFInt(int type, int index, FName key);
|
int GetUDMFInt(FLevelLocals *Level, int type, int index, FName key);
|
||||||
double GetUDMFFloat(int type, int index, FName key);
|
double GetUDMFFloat(FLevelLocals *Level, int type, int index, FName key);
|
||||||
FString GetUDMFString(int type, int index, FName key);
|
FString GetUDMFString(FLevelLocals *Level, int type, int index, FName key);
|
||||||
|
|
||||||
void FixMinisegReferences();
|
void FixMinisegReferences();
|
||||||
void FixHoles();
|
void FixHoles();
|
||||||
|
|
|
@ -2554,7 +2554,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetAutomapPosition, GetAutomapPositi
|
||||||
|
|
||||||
static int ZGetUDMFInt(FLevelLocals *self, int type, int index, int key)
|
static int ZGetUDMFInt(FLevelLocals *self, int type, int index, int key)
|
||||||
{
|
{
|
||||||
return GetUDMFInt(type, index, ENamedName(key));
|
return GetUDMFInt(self,type, index, ENamedName(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFInt, ZGetUDMFInt)
|
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFInt, ZGetUDMFInt)
|
||||||
|
@ -2563,12 +2563,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFInt, ZGetUDMFInt)
|
||||||
PARAM_INT(type);
|
PARAM_INT(type);
|
||||||
PARAM_INT(index);
|
PARAM_INT(index);
|
||||||
PARAM_NAME(key);
|
PARAM_NAME(key);
|
||||||
ACTION_RETURN_INT(GetUDMFInt(type, index, key));
|
ACTION_RETURN_INT(GetUDMFInt(self, type, index, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
static double ZGetUDMFFloat(FLevelLocals *self, int type, int index, int key)
|
static double ZGetUDMFFloat(FLevelLocals *self, int type, int index, int key)
|
||||||
{
|
{
|
||||||
return GetUDMFFloat(type, index, ENamedName(key));
|
return GetUDMFFloat(self, type, index, ENamedName(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFFloat, ZGetUDMFFloat)
|
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFFloat, ZGetUDMFFloat)
|
||||||
|
@ -2577,12 +2577,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFFloat, ZGetUDMFFloat)
|
||||||
PARAM_INT(type);
|
PARAM_INT(type);
|
||||||
PARAM_INT(index);
|
PARAM_INT(index);
|
||||||
PARAM_NAME(key);
|
PARAM_NAME(key);
|
||||||
ACTION_RETURN_FLOAT(GetUDMFFloat(type, index, key));
|
ACTION_RETURN_FLOAT(GetUDMFFloat(self, type, index, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ZGetUDMFString(FLevelLocals *self, int type, int index, int key, FString *result)
|
static void ZGetUDMFString(FLevelLocals *self, int type, int index, int key, FString *result)
|
||||||
{
|
{
|
||||||
*result = GetUDMFString(type, index, ENamedName(key));
|
*result = GetUDMFString(self, type, index, ENamedName(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFString, ZGetUDMFString)
|
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFString, ZGetUDMFString)
|
||||||
|
@ -2591,7 +2591,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFString, ZGetUDMFString)
|
||||||
PARAM_INT(type);
|
PARAM_INT(type);
|
||||||
PARAM_INT(index);
|
PARAM_INT(index);
|
||||||
PARAM_NAME(key);
|
PARAM_NAME(key);
|
||||||
ACTION_RETURN_STRING(GetUDMFString(type, index, key));
|
ACTION_RETURN_STRING(GetUDMFString(self, type, index, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetChecksum)
|
DEFINE_ACTION_FUNCTION(FLevelLocals, GetChecksum)
|
||||||
|
|
Loading…
Reference in a new issue