mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +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<FName, int> FDialogueMap; // maps actor class names to dialogue array index
|
||||
typedef TMap<int, FUDMFKeys> FUDMFKeyMap;
|
||||
|
||||
struct FLevelLocals
|
||||
{
|
||||
|
@ -435,6 +436,7 @@ public:
|
|||
|
||||
FBlockmap blockmap;
|
||||
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
|
||||
// Without such a mechanism the savegame format would become too slow and large because more than 80-90% are normally still unaltered.
|
||||
|
@ -464,7 +466,7 @@ public:
|
|||
|
||||
uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
|
||||
int time; // time in the hub
|
||||
int maptime; // time in the map
|
||||
int maptime; // time in the map
|
||||
int totaltime; // time in the game
|
||||
int starttime;
|
||||
int partime;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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);
|
||||
|
||||
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
||||
FUDMFKeys *pKeys = Level->UDMFKeys[type].CheckKey(index);
|
||||
|
||||
if (pKeys != NULL)
|
||||
{
|
||||
|
@ -363,11 +349,11 @@ int GetUDMFInt(int type, int index, FName key)
|
|||
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);
|
||||
|
||||
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
||||
FUDMFKeys *pKeys = Level->UDMFKeys[type].CheckKey(index);
|
||||
|
||||
if (pKeys != NULL)
|
||||
{
|
||||
|
@ -380,11 +366,11 @@ double GetUDMFFloat(int type, int index, FName key)
|
|||
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);
|
||||
|
||||
FUDMFKeys *pKeys = UDMFKeys[type].CheckKey(index);
|
||||
FUDMFKeys *pKeys = Level->UDMFKeys[type].CheckKey(index);
|
||||
|
||||
if (pKeys != NULL)
|
||||
{
|
||||
|
@ -459,7 +445,7 @@ public:
|
|||
}
|
||||
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++)
|
||||
{
|
||||
|
|
|
@ -5277,26 +5277,26 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
switch(funcIndex)
|
||||
{
|
||||
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:
|
||||
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_GetThingUDMFFixed:
|
||||
return 0; // Not implemented yet
|
||||
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
actor = Level->SingleActorFromTID(args[0], activator);
|
||||
|
@ -10680,8 +10680,8 @@ void ACSProfile(FLevelLocals *Level, FCommandLine &argv)
|
|||
static const char *sort_names[] = { "total", "min", "max", "avg", "runs" };
|
||||
static const uint8_t sort_match_len[] = { 1, 2, 2, 1, 1 };
|
||||
|
||||
TArray<ProfileCollector> ScriptProfiles, FuncProfiles;
|
||||
long limit = 10;
|
||||
TArray<ProfileCollector> ScriptProfiles, FuncProfiles;
|
||||
long limit = 10;
|
||||
int (*sorter)(const void *, const void *) = sort_by_total_instr;
|
||||
|
||||
assert(countof(sort_names) == countof(sort_match_len));
|
||||
|
|
|
@ -74,8 +74,6 @@
|
|||
#include "am_map.h"
|
||||
#include "fragglescript/t_script.h"
|
||||
|
||||
void P_ClearUDMFKeys();
|
||||
|
||||
extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);
|
||||
|
||||
extern unsigned int R_OldBlend;
|
||||
|
@ -261,6 +259,11 @@ void FLevelLocals::ClearLevelData()
|
|||
killed_monsters = found_items = found_secrets =
|
||||
wminfo.maxfrags = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
UDMFKeys[i].Clear();
|
||||
}
|
||||
|
||||
SN_StopAllSequences(this);
|
||||
|
||||
FStrifeDialogueNode *node;
|
||||
|
@ -345,7 +348,6 @@ void P_FreeLevelData ()
|
|||
// [ZZ] delete per-map event handlers
|
||||
E_Shutdown(true);
|
||||
R_FreePastViewers();
|
||||
P_ClearUDMFKeys();
|
||||
|
||||
DThinker::DestroyAllThinkers ();
|
||||
|
||||
|
|
|
@ -153,9 +153,9 @@ struct maplinedef_t;
|
|||
void P_LoadTranslator(const char *lumpname);
|
||||
int P_TranslateSectorSpecial (int);
|
||||
|
||||
int GetUDMFInt(int type, int index, FName key);
|
||||
double GetUDMFFloat(int type, int index, FName key);
|
||||
FString GetUDMFString(int type, int index, FName key);
|
||||
int GetUDMFInt(FLevelLocals *Level, int type, int index, FName key);
|
||||
double GetUDMFFloat(FLevelLocals *Level, int type, int index, FName key);
|
||||
FString GetUDMFString(FLevelLocals *Level, int type, int index, FName key);
|
||||
|
||||
void FixMinisegReferences();
|
||||
void FixHoles();
|
||||
|
|
|
@ -2554,7 +2554,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetAutomapPosition, GetAutomapPositi
|
|||
|
||||
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)
|
||||
|
@ -2563,12 +2563,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFInt, ZGetUDMFInt)
|
|||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
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)
|
||||
{
|
||||
return GetUDMFFloat(type, index, ENamedName(key));
|
||||
return GetUDMFFloat(self, type, index, ENamedName(key));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFFloat, ZGetUDMFFloat)
|
||||
|
@ -2577,12 +2577,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFFloat, ZGetUDMFFloat)
|
|||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
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)
|
||||
{
|
||||
*result = GetUDMFString(type, index, ENamedName(key));
|
||||
*result = GetUDMFString(self, type, index, ENamedName(key));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFString, ZGetUDMFString)
|
||||
|
@ -2591,7 +2591,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFString, ZGetUDMFString)
|
|||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
PARAM_NAME(key);
|
||||
ACTION_RETURN_STRING(GetUDMFString(type, index, key));
|
||||
ACTION_RETURN_STRING(GetUDMFString(self, type, index, key));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetChecksum)
|
||||
|
|
Loading…
Reference in a new issue