- moved all code related to global ACS variables to p_acs.cpp where it belongs.

- fixed: The nextmap and nextsecret CCMDs need to call G_DeferedInitNew instead of G_InitNew.
- merged MAPINFO branch back into trunk.

SVN r1393 (trunk)
This commit is contained in:
Christoph Oelckers 2009-02-03 19:11:43 +00:00
parent 0b95b47f87
commit 4bcd3faef8
51 changed files with 3021 additions and 2197 deletions

View file

@ -1,3 +1,17 @@
January 18, 2009 - February 3, 2009 (Changes by Graf Zahl)
- moved all code related to global ACS variables to p_acs.cpp where it belongs.
- fixed: The nextmap and nextsecret CCMDs need to call G_DeferedInitNew instead of G_InitNew.
- rewrote the MAPINFO parser:
* split level_info_t::flags into 2 DWORDS so that I don't have to deal with 64 bit values later.
* split off skill code into its own file
* created a parser class for MAPINFO
* replaced all uses of ReplaceString in level_info_t with FStrings and made the specialaction
data a TArray so that levelinfos can be handled without error prone maintenance functions.
* split of parser code from g_level.cpp
* const-ified parameters to F_StartFinale.
* Changed how G_MaybeLookupLevelName works and made it return an FString.
* removed 64 character limit on level names.
February 2, 2009
- Changed DECORATE replacements so that they aren't overridden by Dehacked.

View file

@ -478,6 +478,8 @@ add_executable( zdoom WIN32
g_game.cpp
g_hub.cpp
g_level.cpp
g_mapinfo.cpp
g_skill.cpp
gameconfigfile.cpp
gi.cpp
hu_scores.cpp

View file

@ -1784,7 +1784,7 @@ void AM_Drawer ()
if (!automapactive)
return;
bool allmap = (level.flags & LEVEL_ALLMAP) != 0;
bool allmap = (level.flags2 & LEVEL2_ALLMAP) != 0;
bool allthings = allmap && players[consoleplayer].mo->FindInventory<APowerScanner>() != NULL;
AM_initColors (viewactive);

View file

@ -41,11 +41,13 @@
#define CREG_SECTION "__DATA,creg"
#define GREG_SECTION "__DATA,greg"
#define MREG_SECTION "__DATA,mreg"
#define MREG_SECTION "__DATA,yreg"
#else
#define AREG_SECTION "areg"
#define CREG_SECTION "creg"
#define GREG_SECTION "greg"
#define MREG_SECTION "mreg"
#define GREG_SECTION "yreg"
#endif
#endif
@ -68,6 +70,10 @@ extern REGINFO GRegTail;
extern REGINFO MRegHead;
extern REGINFO MRegTail;
// List of MAPINFO map options
extern REGINFO YRegHead;
extern REGINFO YRegTail;
template<class T, REGINFO *_head, REGINFO *_tail>
class TAutoSegIteratorNoArrow
{

View file

@ -46,7 +46,7 @@
#if defined(_MSC_VER)
#pragma comment(linker, "/merge:.areg=.data /merge:.creg=.data /merge:.greg=.data /merge:.mreg=.data")
#pragma comment(linker, "/merge:.areg=.data /merge:.creg=.data /merge:.greg=.data /merge:.mreg=.data /merge:.yreg=.data")
#pragma data_seg(".areg$a")
void *ARegHead = 0;
@ -60,6 +60,9 @@ void *GRegHead = 0;
#pragma data_seg(".mreg$a")
void *MRegHead = 0;
#pragma data_seg(".yreg$a")
void *YRegHead = 0;
#pragma data_seg()
// We want visual styles support under XP
@ -87,6 +90,7 @@ void *ARegHead __attribute__((section(AREG_SECTION))) = 0;
void *CRegHead __attribute__((section(CREG_SECTION))) = 0;
void *GRegHead __attribute__((section(GREG_SECTION))) = 0;
void *MRegHead __attribute__((section(MREG_SECTION))) = 0;
void *YRegHead __attribute__((section(YREG_SECTION))) = 0;
#elif

View file

@ -49,6 +49,9 @@ void *GRegTail = 0;
#pragma data_seg(".mreg$z")
void *MRegTail = 0;
#pragma data_seg(".yreg$z")
void *YRegTail = 0;
#pragma data_seg()
@ -59,6 +62,7 @@ void *ARegTail __attribute__((section(AREG_SECTION))) = 0;
void *CRegTail __attribute__((section(CREG_SECTION))) = 0;
void *GRegTail __attribute__((section(GREG_SECTION))) = 0;
void *MRegTail __attribute__((section(MREG_SECTION))) = 0;
void *YRegTail __attribute__((section(YREG_SECTION))) = 0;
#elif

View file

@ -858,7 +858,7 @@ CCMD(nextmap)
if (next != NULL && strncmp(next, "enDSeQ", 6))
{
G_InitNew(next, false);
G_DeferedInitNew(next, false);
}
else
{
@ -879,7 +879,7 @@ CCMD(nextsecret)
if (next != NULL && strncmp(next, "enDSeQ", 6))
{
G_InitNew(next, false);
G_DeferedInitNew(next, false);
}
else
{

View file

@ -1317,7 +1317,7 @@ void C_FullConsole ()
if (gamestate != GS_STARTUP)
{
gamestate = GS_FULLCONSOLE;
level.music = NULL;
level.Music = "";
S_Start ();
P_FreeLevelData ();
V_SetBlend (0,0,0,0);

View file

@ -60,7 +60,7 @@ CUSTOM_CVAR (String, language, "auto", CVAR_ARCHIVE)
{
SetLanguageIDs ();
GStrings.LoadStrings (false);
G_MaybeLookupLevelName (NULL);
if (level.info != NULL) level.LevelName = level.info->LookupLevelName();
}
// [RH] Network arbitrator

View file

@ -86,8 +86,8 @@ void F_AdvanceSlideshow ();
//
// F_StartFinale
//
void F_StartFinale (char *music, int musicorder, int cdtrack, unsigned int cdid, char *flat, char *text,
INTBOOL textInLump, INTBOOL finalePic, INTBOOL lookupText, bool ending)
void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int cdid, const char *flat,
const char *text, INTBOOL textInLump, INTBOOL finalePic, INTBOOL lookupText, bool ending)
{
bool loopmusic = ending ? !(gameinfo.flags & GI_NOLOOPFINALEMUSIC) : true;
gameaction = ga_nothing;
@ -1026,7 +1026,7 @@ void F_StartSlideshow ()
V_SetBlend (0,0,0,0);
// The slideshow is determined solely by the map you're on.
if (!multiplayer && level.flags & LEVEL_DEATHSLIDESHOW)
if (!multiplayer && level.flags2 & LEVEL2_DEATHSLIDESHOW)
{
FinalePart = 14;
}
@ -1062,7 +1062,7 @@ void F_AdvanceSlideshow ()
{
case -99:
if (level.cdtrack == 0 || !S_ChangeCDMusic (level.cdtrack, level.cdid))
S_ChangeMusic (level.music, level.musicorder);
S_ChangeMusic (level.Music, level.musicorder);
gamestate = GS_LEVEL;
wipegamestate = GS_LEVEL;
P_ResumeConversation ();

View file

@ -42,8 +42,8 @@ void F_Ticker ();
void F_Drawer ();
void F_StartFinale (char *music, int musicorder, int cdtrack, unsigned int cdid, char *flat, char *text,
INTBOOL textInLump, INTBOOL finalePic, INTBOOL lookupText, bool ending);
void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int cdid, const char *flat,
const char *text, INTBOOL textInLump, INTBOOL finalePic, INTBOOL lookupText, bool ending);
void F_StartSlideshow ();

View file

@ -73,6 +73,7 @@
#include "cmdlib.h"
#include "d_net.h"
#include "d_event.h"
#include "p_acs.h"
#include <zlib.h>
@ -1129,7 +1130,7 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory
}
}
if (mode == FINISH_NoHub && !(level.flags & LEVEL_KEEPFULLINVENTORY))
if (mode == FINISH_NoHub && !(level.flags2 & LEVEL2_KEEPFULLINVENTORY))
{ // Reduce all owned (visible) inventory to 1 item each
for (item = p->mo->Inventory; item != NULL; item = item->Inventory)
{
@ -1429,7 +1430,7 @@ static void G_QueueBody (AActor *body)
//
void G_DoReborn (int playernum, bool freshbot)
{
if (!multiplayer && !(level.flags & LEVEL_ALLOWRESPAWN))
if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN))
{
if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()))
{ // Load game from the last point it was saved
@ -1579,128 +1580,6 @@ bool G_CheckSaveGameWads (PNGHandle *png, bool printwarn)
return true;
}
static void WriteVars (FILE *file, SDWORD *vars, size_t count, DWORD id)
{
size_t i, j;
for (i = 0; i < count; ++i)
{
if (vars[i] != 0)
break;
}
if (i < count)
{
// Find last non-zero var. Anything beyond the last stored variable
// will be zeroed at load time.
for (j = count-1; j > i; --j)
{
if (vars[j] != 0)
break;
}
FPNGChunkArchive arc (file, id);
for (i = 0; i <= j; ++i)
{
DWORD var = vars[i];
arc << var;
}
}
}
static void ReadVars (PNGHandle *png, SDWORD *vars, size_t count, DWORD id)
{
size_t len = M_FindPNGChunk (png, id);
size_t used = 0;
if (len != 0)
{
DWORD var;
size_t i;
FPNGChunkArchive arc (png->File->GetFile(), id, len);
used = len / 4;
for (i = 0; i < used; ++i)
{
arc << var;
vars[i] = var;
}
png->File->ResetFilePtr();
}
if (used < count)
{
memset (&vars[used], 0, (count-used)*4);
}
}
static void WriteArrayVars (FILE *file, FWorldGlobalArray *vars, unsigned int count, DWORD id)
{
unsigned int i, j;
// Find the first non-empty array.
for (i = 0; i < count; ++i)
{
if (vars[i].CountUsed() != 0)
break;
}
if (i < count)
{
// Find last non-empty array. Anything beyond the last stored array
// will be emptied at load time.
for (j = count-1; j > i; --j)
{
if (vars[j].CountUsed() != 0)
break;
}
FPNGChunkArchive arc (file, id);
arc.WriteCount (i);
arc.WriteCount (j);
for (; i <= j; ++i)
{
arc.WriteCount (vars[i].CountUsed());
FWorldGlobalArray::ConstIterator it(vars[i]);
const FWorldGlobalArray::Pair *pair;
while (it.NextPair (pair))
{
arc.WriteCount (pair->Key);
arc.WriteCount (pair->Value);
}
}
}
}
static void ReadArrayVars (PNGHandle *png, FWorldGlobalArray *vars, size_t count, DWORD id)
{
size_t len = M_FindPNGChunk (png, id);
unsigned int i, k;
for (i = 0; i < count; ++i)
{
vars[i].Clear ();
}
if (len != 0)
{
DWORD max, size;
FPNGChunkArchive arc (png->File->GetFile(), id, len);
i = arc.ReadCount ();
max = arc.ReadCount ();
for (; i <= max; ++i)
{
size = arc.ReadCount ();
for (k = 0; k < size; ++k)
{
SDWORD key, val;
key = arc.ReadCount();
val = arc.ReadCount();
vars[i].Insert (key, val);
}
}
png->File->ResetFilePtr();
}
}
void G_DoLoadGame ()
{
@ -1820,10 +1699,7 @@ void G_DoLoadGame ()
delete[] map;
savegamerestore = false;
ReadVars (png, ACS_WorldVars, NUM_WORLDVARS, MAKE_ID('w','v','A','r'));
ReadVars (png, ACS_GlobalVars, NUM_GLOBALVARS, MAKE_ID('g','v','A','r'));
ReadArrayVars (png, ACS_WorldArrays, NUM_WORLDVARS, MAKE_ID('w','a','R','r'));
ReadArrayVars (png, ACS_GlobalArrays, NUM_GLOBALVARS, MAKE_ID('g','a','R','r'));
P_ReadACSVars(png);
NextSkill = -1;
if (M_FindPNGChunk (png, MAKE_ID('s','n','X','t')) == 1)
@ -1985,7 +1861,7 @@ static void PutSaveComment (FILE *file)
// Get level name
//strcpy (comment, level.level_name);
mysnprintf(comment, countof(comment), "%s - %s", level.mapname, level.level_name);
mysnprintf(comment, countof(comment), "%s - %s", level.mapname, level.LevelName.GetChars());
len = (WORD)strlen (comment);
comment[len] = '\n';
@ -2069,10 +1945,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
FRandom::StaticWriteRNGState (stdfile);
P_WriteACSDefereds (stdfile);
WriteVars (stdfile, ACS_WorldVars, NUM_WORLDVARS, MAKE_ID('w','v','A','r'));
WriteVars (stdfile, ACS_GlobalVars, NUM_GLOBALVARS, MAKE_ID('g','v','A','r'));
WriteArrayVars (stdfile, ACS_WorldArrays, NUM_WORLDVARS, MAKE_ID('w','a','R','r'));
WriteArrayVars (stdfile, ACS_GlobalArrays, NUM_GLOBALVARS, MAKE_ID('g','a','R','r'));
P_WriteACSVars(stdfile);
if (NextSkill != -1)
{

View file

@ -72,7 +72,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryExplode)
S_Sound (mo, CHAN_BODY, "PotteryExplode", 1, ATTN_NORM);
if (self->args[0]>=0 && self->args[0]<=255 && SpawnableThings[self->args[0]])
{ // Spawn an item
if (!((level.flags & LEVEL_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
if (!((level.flags2 & LEVEL2_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
|| !(GetDefaultByType (SpawnableThings[self->args[0]])->flags3 & MF3_ISMONSTER))
{ // Only spawn monsters if not -nomonsters
Spawn (SpawnableThings[self->args[0]],
@ -290,7 +290,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
}
if (self->args[0]>=0 && self->args[0]<=255 && SpawnableThings[self->args[0]])
{ // Spawn an item
if (!((level.flags & LEVEL_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
if (!((level.flags2 & LEVEL2_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
|| !(GetDefaultByType (SpawnableThings[self->args[0]])->flags3 & MF3_ISMONSTER))
{ // Only spawn monsters if not -nomonsters
Spawn (SpawnableThings[self->args[0]],

View file

@ -127,17 +127,16 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
wbs->plyr[j].ssecret += hubdata[i].plyr[j].ssecret;
}
}
if (cluster->clustername)
if (cluster->ClusterName.IsNotEmpty())
{
if (cluster->flags & CLUSTER_LOOKUPNAME)
{
strncpy(level.level_name, GStrings(cluster->clustername), 64);
level.LevelName = GStrings(cluster->ClusterName);
}
else
{
strncpy(level.level_name, cluster->clustername, 64);
level.LevelName = cluster->ClusterName;
}
level.level_name[63]=0;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -36,90 +36,166 @@
#include "doomtype.h"
#include "doomdef.h"
#include "autosegs.h"
#include "sc_man.h"
#define NUM_WORLDVARS 256
#define NUM_GLOBALVARS 64
struct level_info_t;
struct cluster_info_t;
class FScanner;
#define LEVEL_NOINTERMISSION UCONST64(0x00000001)
#define LEVEL_NOINVENTORYBAR UCONST64(0x00000002) // This effects Doom only, since it's the only one without a standard inventory bar.
#define LEVEL_DOUBLESKY UCONST64(0x00000004)
#define LEVEL_HASFADETABLE UCONST64(0x00000008) // Level uses Hexen's fadetable mapinfo to get fog
#if defined(_MSC_VER)
#pragma data_seg(".yreg$u")
#pragma data_seg()
#define LEVEL_MAP07SPECIAL UCONST64(0x00000010)
#define LEVEL_BRUISERSPECIAL UCONST64(0x00000020)
#define LEVEL_CYBORGSPECIAL UCONST64(0x00000040)
#define LEVEL_SPIDERSPECIAL UCONST64(0x00000080)
#define MSVC_YSEG __declspec(allocate(".yreg$u"))
#define GCC_YSEG
#else
#define MSVC_YSEG
#define GCC_YSEG __attribute__((section(YREG_SECTION)))
#endif
#define LEVEL_SPECLOWERFLOOR UCONST64(0x00000100)
#define LEVEL_SPECOPENDOOR UCONST64(0x00000200)
#define LEVEL_SPECACTIONSMASK UCONST64(0x00000300)
#define LEVEL_MONSTERSTELEFRAG UCONST64(0x00000400)
#define LEVEL_ACTOWNSPECIAL UCONST64(0x00000800)
#define LEVEL_SNDSEQTOTALCTRL UCONST64(0x00001000)
#define LEVEL_FORCENOSKYSTRETCH UCONST64(0x00002000)
struct FMapInfoParser
{
enum EFormatType
{
FMT_Unknown,
FMT_Old,
FMT_New
};
#define LEVEL_CROUCH_NO UCONST64(0x00004000)
#define LEVEL_JUMP_NO UCONST64(0x00008000)
#define LEVEL_FREELOOK_NO UCONST64(0x00010000)
#define LEVEL_FREELOOK_YES UCONST64(0x00020000)
FScanner sc;
int format_type;
bool HexenHack;
// The absence of both of the following bits means that this level does not
// use falling damage (though damage can be forced with dmflags).
#define LEVEL_FALLDMG_ZD UCONST64(0x00040000) // Level uses ZDoom's falling damage
#define LEVEL_FALLDMG_HX UCONST64(0x00080000) // Level uses Hexen's falling damage
FMapInfoParser()
{
format_type = FMT_Unknown;
HexenHack = false;
}
#define LEVEL_HEADSPECIAL UCONST64(0x00100000) // Heretic episode 1/4
#define LEVEL_MINOTAURSPECIAL UCONST64(0x00200000) // Heretic episode 2/5
#define LEVEL_SORCERER2SPECIAL UCONST64(0x00400000) // Heretic episode 3
#define LEVEL_SPECKILLMONSTERS UCONST64(0x00800000)
bool ParseLookupName(FString &dest);
void ParseMusic(FString &name, int &order);
void ParseLumpOrTextureName(char *name);
#define LEVEL_STARTLIGHTNING UCONST64(0x01000000) // Automatically start lightning
#define LEVEL_FILTERSTARTS UCONST64(0x02000000) // Apply mapthing filtering to player starts
#define LEVEL_LOOKUPLEVELNAME UCONST64(0x04000000) // Level name is the name of a language string
#define LEVEL_HEXENFORMAT UCONST64(0x08000000) // Level uses the Hexen map format
void ParseCluster();
void ParseNextMap(char *mapname);
level_info_t *ParseMapHeader(level_info_t &defaultinfo);
void ParseMapDefinition(level_info_t &leveldef);
void ParseEpisodeInfo ();
void ParseSkill ();
void ParseMapInfo (int lump, level_info_t &gamedefaults);
#define LEVEL_SWAPSKIES UCONST64(0x10000000) // Used by lightning
#define LEVEL_NOALLIES UCONST64(0x20000000) // i.e. Inside Strife's front base
#define LEVEL_CHANGEMAPCHEAT UCONST64(0x40000000) // Don't display cluster messages
#define LEVEL_VISITED UCONST64(0x80000000) // Used for intermission map
void ParseOpenBrace();
bool ParseCloseBrace();
bool CheckAssign();
void ParseAssign();
void MustParseAssign();
void ParseComma();
bool CheckNumber();
bool CheckFloat();
void SkipToNext();
};
#define LEVEL_DEATHSLIDESHOW UCONST64(0x100000000) // Slideshow on death
#define LEVEL_ALLMAP UCONST64(0x200000000) // The player picked up a map on this level
#define DEFINE_MAP_OPTION(name, old) \
static void MapOptHandler_##name(FMapInfoParser &parse, level_info_t *info); \
static FMapOptInfo MapOpt_##name = \
{ #name, MapOptHandler_##name, old }; \
MSVC_YSEG FMapOptInfo *mapopt_##name GCC_YSEG = &MapOpt_##name; \
static void MapOptHandler_##name(FMapInfoParser &parse, level_info_t *info)
#define LEVEL_LAXMONSTERACTIVATION UCONST64(0x400000000) // Monsters can open doors depending on the door speed
#define LEVEL_LAXACTIVATIONMAPINFO UCONST64(0x800000000) // LEVEL_LAXMONSTERACTIVATION is not a default.
#define LEVEL_MISSILESACTIVATEIMPACT UCONST64(0x1000000000) // Missiles are the activators of SPAC_IMPACT events, not their shooters
#define LEVEL_FROZEN UCONST64(0x2000000000) // Game is frozen by a TimeFreezer
struct FMapOptInfo
{
const char *name;
void (*handler) (FMapInfoParser &parse, level_info_t *levelinfo);
bool old;
};
#define LEVEL_KEEPFULLINVENTORY UCONST64(0x4000000000) // doesn't reduce the amount of inventory items to 1
enum ELevelFlags
{
LEVEL_NOINTERMISSION = 0x00000001,
LEVEL_NOINVENTORYBAR = 0x00000002, // This effects Doom only, since it's the only one without a standard inventory bar.
LEVEL_DOUBLESKY = 0x00000004,
LEVEL_HASFADETABLE = 0x00000008, // Level uses Hexen's fadetable mapinfo to get fog
#define LEVEL_MUSICDEFINED UCONST64(0x8000000000) // a marker to disable the $map command in SNDINFO for this map
#define LEVEL_MONSTERFALLINGDAMAGE UCONST64(0x10000000000)
#define LEVEL_CLIPMIDTEX UCONST64(0x20000000000)
#define LEVEL_WRAPMIDTEX UCONST64(0x40000000000)
LEVEL_MAP07SPECIAL = 0x00000010,
LEVEL_BRUISERSPECIAL = 0x00000020,
LEVEL_CYBORGSPECIAL = 0x00000040,
LEVEL_SPIDERSPECIAL = 0x00000080,
#define LEVEL_CHECKSWITCHRANGE UCONST64(0x80000000000)
LEVEL_SPECLOWERFLOOR = 0x00000100,
LEVEL_SPECOPENDOOR = 0x00000200,
LEVEL_SPECACTIONSMASK = 0x00000300,
#define LEVEL_PAUSE_MUSIC_IN_MENUS UCONST64(0x100000000000)
#define LEVEL_TOTALINFIGHTING UCONST64(0x200000000000)
#define LEVEL_NOINFIGHTING UCONST64(0x400000000000)
LEVEL_MONSTERSTELEFRAG = 0x00000400,
LEVEL_ACTOWNSPECIAL = 0x00000800,
LEVEL_SNDSEQTOTALCTRL = 0x00001000,
LEVEL_FORCENOSKYSTRETCH = 0x00002000,
#define LEVEL_NOMONSTERS UCONST64(0x800000000000)
#define LEVEL_INFINITE_FLIGHT UCONST64(0x1000000000000)
LEVEL_CROUCH_NO = 0x00004000,
LEVEL_JUMP_NO = 0x00008000,
LEVEL_FREELOOK_NO = 0x00010000,
LEVEL_FREELOOK_YES = 0x00020000,
#define LEVEL_ALLOWRESPAWN UCONST64(0x2000000000000)
// The absence of both of the following bits means that this level does not
// use falling damage (though damage can be forced with dmflags,.
LEVEL_FALLDMG_ZD = 0x00040000, // Level uses ZDoom's falling damage
LEVEL_FALLDMG_HX = 0x00080000, // Level uses Hexen's falling damage
#define LEVEL_FORCETEAMPLAYON UCONST64(0x4000000000000)
#define LEVEL_FORCETEAMPLAYOFF UCONST64(0x8000000000000)
LEVEL_HEADSPECIAL = 0x00100000, // Heretic episode 1/4
LEVEL_MINOTAURSPECIAL = 0x00200000, // Heretic episode 2/5
LEVEL_SORCERER2SPECIAL = 0x00400000, // Heretic episode 3
LEVEL_SPECKILLMONSTERS = 0x00800000,
#define LEVEL_CONV_SINGLE_UNFREEZE UCONST64(0x10000000000000)
#define LEVEL_RAILINGHACK UCONST64(0x20000000000000) // but UDMF requires them to be separate to have more control
#define LEVEL_DUMMYSWITCHES UCONST64(0x40000000000000)
#define LEVEL_HEXENHACK UCONST64(0x80000000000000) // Level was defined in a Hexen style MAPINFO
LEVEL_STARTLIGHTNING = 0x01000000, // Automatically start lightning
LEVEL_FILTERSTARTS = 0x02000000, // Apply mapthing filtering to player starts
LEVEL_LOOKUPLEVELNAME = 0x04000000, // Level name is the name of a language string
LEVEL_HEXENFORMAT = 0x08000000, // Level uses the Hexen map format
#define LEVEL_SMOOTHLIGHTING UCONST64(0x100000000000000) // Level uses the smooth lighting feature.
LEVEL_SWAPSKIES = 0x10000000, // Used by lightning
LEVEL_NOALLIES = 0x20000000, // i.e. Inside Strife's front base
LEVEL_CHANGEMAPCHEAT = 0x40000000, // Don't display cluster messages
LEVEL_VISITED = 0x80000000, // Used for intermission map
// The flags QWORD is now split into 2 DWORDs
LEVEL2_DEATHSLIDESHOW = 0x00000001, // Slideshow on death
LEVEL2_ALLMAP = 0x00000002, // The player picked up a map on this level
LEVEL2_LAXMONSTERACTIVATION = 0x00000004, // Monsters can open doors depending on the door speed
LEVEL2_LAXACTIVATIONMAPINFO = 0x00000008, // LEVEL_LAXMONSTERACTIVATION is not a default.
LEVEL2_MISSILESACTIVATEIMPACT = 0x00000010, // Missiles are the activators of SPAC_IMPACT events, not their shooters
LEVEL2_FROZEN = 0x00000020, // Game is frozen by a TimeFreezer
LEVEL2_KEEPFULLINVENTORY = 0x00000040, // doesn't reduce the amount of inventory items to 1
LEVEL2_MUSICDEFINED = 0x00000080, // a marker to disable the $map command in SNDINFO for this map
LEVEL2_MONSTERFALLINGDAMAGE = 0x00000100,
LEVEL2_CLIPMIDTEX = 0x00000200,
LEVEL2_WRAPMIDTEX = 0x00000400,
LEVEL2_CHECKSWITCHRANGE = 0x00000800,
LEVEL2_PAUSE_MUSIC_IN_MENUS = 0x00001000,
LEVEL2_TOTALINFIGHTING = 0x00002000,
LEVEL2_NOINFIGHTING = 0x00004000,
LEVEL2_NOMONSTERS = 0x00008000,
LEVEL2_INFINITE_FLIGHT = 0x00010000,
LEVEL2_ALLOWRESPAWN = 0x00020000,
LEVEL2_FORCETEAMPLAYON = 0x00040000,
LEVEL2_FORCETEAMPLAYOFF = 0x00080000,
LEVEL2_CONV_SINGLE_UNFREEZE = 0x00100000,
LEVEL2_RAILINGHACK = 0x00200000, // but UDMF requires them to be separate to have more control
LEVEL2_DUMMYSWITCHES = 0x00400000,
LEVEL2_HEXENHACK = 0x00800000, // Level was defined in a Hexen style MAPINFO
LEVEL2_SMOOTHLIGHTING = 0x01000000, // Level uses the smooth lighting feature.
};
struct acsdefered_t;
@ -129,7 +205,6 @@ struct FSpecialAction
FName Type; // this is initialized before the actors...
BYTE Action;
int Args[5]; // must allow 16 bit tags for 666 & 667!
FSpecialAction *Next;
};
class FCompressedMemFile;
@ -161,13 +236,13 @@ struct level_info_t
int cluster;
int partime;
int sucktime;
QWORD flags;
char *music;
char *level_name;
DWORD flags;
DWORD flags2;
FString Music;
FString LevelName;
char fadetable[9];
SBYTE WallVertLight, WallHorizLight;
char f1[9];
// TheDefaultLevelInfo initializes everything above this line.
int musicorder;
FCompressedMemFile *snapshot;
DWORD snapshotVer;
@ -185,26 +260,41 @@ struct level_info_t
int airsupply;
DWORD compatflags;
DWORD compatmask;
char *translator; // for converting Doom-format linedef and sector types.
FString Translator; // for converting Doom-format linedef and sector types.
// Redirection: If any player is carrying the specified item, then
// you go to the RedirectMap instead of this one.
FName RedirectType;
char RedirectMap[9];
char *enterpic;
char *exitpic;
char *intermusic;
FString EnterPic;
FString ExitPic;
FString InterMusic;
int intermusicorder;
char *soundinfo;
char *sndseq;
FString SoundInfo;
FString SndSeq;
char bordertexture[9];
float teamdamage;
FSpecialAction * specialactions;
FOptionalMapinfoData *opdata;
TArray<FSpecialAction> specialactions;
level_info_t()
{
Reset();
}
~level_info_t()
{
ClearSnapshot();
ClearDefered();
}
void Reset();
bool isValid();
FString LookupLevelName ();
void ClearSnapshot();
void ClearDefered();
level_info_t *CheckLevelRedirect ();
};
@ -231,17 +321,18 @@ struct FLevelLocals
int clusterflags;
int levelnum;
int lumpnum;
char level_name[64]; // the descriptive name (Outer Base, etc)
FString LevelName;
char mapname[256]; // the server name (base1, etc)
char nextmap[9]; // go here when fraglimit is hit
char secretmap[9]; // map to go to when used secret exit
QWORD flags;
DWORD flags;
DWORD flags2;
DWORD fadeto; // The color the palette fades to (usually black)
DWORD outsidefog; // The fog for sectors with sky ceilings
char *music;
FString Music;
int musicorder;
int cdtrack;
unsigned int cdid;
@ -313,14 +404,17 @@ struct cluster_info_t
{
int cluster;
char finaleflat[9];
char *exittext;
char *entertext;
char *messagemusic;
FString ExitText;
FString EnterText;
FString MessageMusic;
int musicorder;
int flags;
int cdtrack;
char *clustername;
FString ClusterName;
unsigned int cdid;
void Reset();
};
// Cluster flags
@ -331,25 +425,12 @@ struct cluster_info_t
#define CLUSTER_LOOKUPEXITTEXT 0x00000010 // Exit text is the name of a language string
#define CLUSTER_LOOKUPENTERTEXT 0x00000020 // Enter text is the name of a language string
#define CLUSTER_LOOKUPNAME 0x00000040 // Name is the name of a language string
#define CLUSTER_LOOKUPCLUSTERNAME 0x00000080 // Cluster name is the name of a language string
extern FLevelLocals level;
extern TArray<level_info_t> wadlevelinfos;
extern SDWORD ACS_WorldVars[NUM_WORLDVARS];
extern SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
struct InitIntToZero
{
void Init(int &v)
{
v = 0;
}
};
typedef TMap<SDWORD, SDWORD, THashTraits<SDWORD>, InitIntToZero> FWorldGlobalArray;
extern FWorldGlobalArray ACS_WorldArrays[NUM_WORLDVARS];
extern FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS];
extern TArray<cluster_info_t> wadclusterinfos;
extern bool savegamerestore;
@ -382,8 +463,6 @@ void G_InitLevelLocals (void);
void G_AirControlChanged ();
const char *G_MaybeLookupLevelName (level_info_t *level);
cluster_info_t *FindClusterInfo (int cluster);
level_info_t *FindLevelInfo (const char *mapname);
level_info_t *FindLevelByNum (int num);
@ -392,9 +471,9 @@ level_info_t *CheckLevelRedirect (level_info_t *info);
FString CalcMapName (int episode, int level);
void G_ParseMapInfo (void);
void G_UnloadMapInfo ();
void G_ClearSnapshots (void);
void P_RemoveDefereds ();
void G_SnapshotLevel (void);
void G_UnSnapshotLevel (bool keepPlayers);
struct PNGHandle;

1849
src/g_mapinfo.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -951,7 +951,7 @@ void APowerFlight::InitEffect ()
void APowerFlight::Tick ()
{
// The Wings of Wrath only expire in multiplayer and non-hub games
if (!multiplayer && (level.flags & LEVEL_INFINITE_FLIGHT))
if (!multiplayer && (level.flags2 & LEVEL2_INFINITE_FLIGHT))
{
assert(EffectTics < INT_MAX); // I can't see a game lasting nearly two years, but...
EffectTics++;
@ -1364,7 +1364,7 @@ void APowerTimeFreezer::InitEffect( )
// Make sure the effect starts and ends on an even tic.
if ((level.time & 1) == 0)
{
level.flags |= LEVEL_FROZEN;
level.flags2 |= LEVEL2_FROZEN;
}
else
{
@ -1395,9 +1395,9 @@ void APowerTimeFreezer::DoEffect( )
|| (( EffectTics > 2*32 && EffectTics <= 3*32 ) && ((EffectTics + 1) & 7) != 0 )
|| (( EffectTics > 32 && EffectTics <= 2*32 ) && ((EffectTics + 1) & 3) != 0 )
|| (( EffectTics > 0 && EffectTics <= 1*32 ) && ((EffectTics + 1) & 1) != 0 ))
level.flags |= LEVEL_FROZEN;
level.flags2 |= LEVEL2_FROZEN;
else
level.flags &= ~LEVEL_FROZEN;
level.flags2 &= ~LEVEL2_FROZEN;
}
//===========================================================================
@ -1411,7 +1411,7 @@ void APowerTimeFreezer::EndEffect( )
int ulIdx;
// Allow other actors to move about freely once again.
level.flags &= ~LEVEL_FROZEN;
level.flags2 &= ~LEVEL2_FROZEN;
// Also, turn the music back on.
S_ResumeSound( );

View file

@ -1707,7 +1707,7 @@ IMPLEMENT_CLASS (AMapRevealer)
bool AMapRevealer::TryPickup (AActor *&toucher)
{
level.flags |= LEVEL_ALLMAP;
level.flags2 |= LEVEL2_ALLMAP;
GoAwayAndDie ();
return true;
}

View file

@ -56,6 +56,7 @@
#include "a_strifeglobal.h"
#include "g_level.h"
#include "v_palette.h"
#include "p_acs.h"
static FRandom pr_chainwiggle; //use the same method of chain wiggling as heretic.

View file

@ -46,6 +46,7 @@
#include "gi.h"
#include "i_system.h"
#include "g_level.h"
#include "p_acs.h"
SBarInfo *SBarInfoScript[2] = {NULL,NULL};

View file

@ -875,7 +875,7 @@ void DrawHUD()
}
}
mysnprintf(printstr, countof(printstr), "%s: %s", level.mapname, level.level_name);
mysnprintf(printstr, countof(printstr), "%s: %s", level.mapname, level.LevelName.GetChars());
screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, printstr,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);

View file

@ -1242,11 +1242,11 @@ void DBaseStatusBar::Draw (EHudState state)
{
i = mysnprintf (line, countof(line), "%s: ", level.mapname);
}
line[i] = TEXTCOLOR_ESCAPE;
line[i+1] = CR_GREY + 'A';
strcpy (&line[i+2], level.level_name);
FString mapname;
mapname.Format("%c%c%s", TEXTCOLOR_ESCAPE, CR_GREY + 'A', level.LevelName.GetChars());
screen->DrawText (SmallFont, highlight,
(SCREENWIDTH - SmallFont->StringWidth (line)*CleanXfac)/2, y, line,
(SCREENWIDTH - SmallFont->StringWidth (mapname)*CleanXfac)/2, y, mapname,
DTA_CleanNoMove, true, TAG_DONE);
if (!deathmatch)

354
src/g_skill.cpp Normal file
View file

@ -0,0 +1,354 @@
/*
** g_skill.cpp
** Skill level handling
**
**---------------------------------------------------------------------------
** Copyright 2008-2009 Christoph Oelckers
** Copyright 2008-2009 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include <ctype.h>
#include "doomstat.h"
#include "g_level.h"
#include "g_game.h"
#include "gi.h"
#include "templates.h"
#include "v_font.h"
TArray<FSkillInfo> AllSkills;
//==========================================================================
//
// ParseSkill
//
//==========================================================================
void FMapInfoParser::ParseSkill ()
{
FSkillInfo skill;
skill.AmmoFactor = FRACUNIT;
skill.DoubleAmmoFactor = 2*FRACUNIT;
skill.DropAmmoFactor = -1;
skill.DamageFactor = FRACUNIT;
skill.FastMonsters = false;
skill.DisableCheats = false;
skill.EasyBossBrain = false;
skill.AutoUseHealth = false;
skill.RespawnCounter = 0;
skill.RespawnLimit = 0;
skill.Aggressiveness = FRACUNIT;
skill.SpawnFilter = 0;
skill.ACSReturn = AllSkills.Size();
skill.MenuNameIsLump = false;
skill.MustConfirm = false;
skill.Shortcut = 0;
skill.TextColor = "";
sc.MustGetString();
skill.Name = sc.String;
ParseOpenBrace();
while (sc.GetString ())
{
if (sc.Compare ("ammofactor"))
{
ParseAssign();
sc.MustGetFloat ();
skill.AmmoFactor = FLOAT2FIXED(sc.Float);
}
else if (sc.Compare ("doubleammofactor"))
{
ParseAssign();
sc.MustGetFloat ();
skill.DoubleAmmoFactor = FLOAT2FIXED(sc.Float);
}
else if (sc.Compare ("dropammofactor"))
{
ParseAssign();
sc.MustGetFloat ();
skill.DropAmmoFactor = FLOAT2FIXED(sc.Float);
}
else if (sc.Compare ("damagefactor"))
{
ParseAssign();
sc.MustGetFloat ();
skill.DamageFactor = FLOAT2FIXED(sc.Float);
}
else if (sc.Compare ("fastmonsters"))
{
skill.FastMonsters = true;
}
else if (sc.Compare ("disablecheats"))
{
skill.DisableCheats = true;
}
else if (sc.Compare ("easybossbrain"))
{
skill.EasyBossBrain = true;
}
else if (sc.Compare("autousehealth"))
{
skill.AutoUseHealth = true;
}
else if (sc.Compare("respawntime"))
{
ParseAssign();
sc.MustGetFloat ();
skill.RespawnCounter = int(sc.Float*TICRATE);
}
else if (sc.Compare("respawnlimit"))
{
ParseAssign();
sc.MustGetNumber ();
skill.RespawnLimit = sc.Number;
}
else if (sc.Compare("Aggressiveness"))
{
ParseAssign();
sc.MustGetFloat ();
skill.Aggressiveness = FRACUNIT - FLOAT2FIXED(clamp(sc.Float, 0.,1.));
}
else if (sc.Compare("SpawnFilter"))
{
ParseAssign();
if (sc.CheckNumber())
{
if (sc.Number > 0) skill.SpawnFilter |= (1<<(sc.Number-1));
}
else
{
sc.MustGetString ();
if (sc.Compare("baby")) skill.SpawnFilter |= 1;
else if (sc.Compare("easy")) skill.SpawnFilter |= 2;
else if (sc.Compare("normal")) skill.SpawnFilter |= 4;
else if (sc.Compare("hard")) skill.SpawnFilter |= 8;
else if (sc.Compare("nightmare")) skill.SpawnFilter |= 16;
}
}
else if (sc.Compare("ACSReturn"))
{
ParseAssign();
sc.MustGetNumber ();
skill.ACSReturn = sc.Number;
}
else if (sc.Compare("Name"))
{
ParseAssign();
sc.MustGetString ();
skill.MenuName = sc.String;
skill.MenuNameIsLump = false;
}
else if (sc.Compare("PlayerClassName"))
{
ParseAssign();
sc.MustGetString ();
FName pc = sc.String;
ParseComma();
sc.MustGetString ();
skill.MenuNamesForPlayerClass[pc]=sc.String;
}
else if (sc.Compare("PicName"))
{
ParseAssign();
sc.MustGetString ();
skill.MenuName = sc.String;
skill.MenuNameIsLump = true;
}
else if (sc.Compare("MustConfirm"))
{
ParseAssign();
skill.MustConfirm = true;
if (sc.CheckToken(TK_StringConst))
{
skill.MustConfirmText = sc.String;
}
}
else if (sc.Compare("Key"))
{
ParseAssign();
sc.MustGetString();
skill.Shortcut = tolower(sc.String[0]);
}
else if (sc.Compare("TextColor"))
{
ParseAssign();
sc.MustGetString();
skill.TextColor.Format("[%s]", sc.String);
}
else if (!ParseCloseBrace())
{
// Unknown
sc.ScriptMessage("Unknown property '%s' found in skill definition\n", sc.String);
SkipToNext();
}
else
{
break;
}
}
for(unsigned int i = 0; i < AllSkills.Size(); i++)
{
if (AllSkills[i].Name == skill.Name)
{
AllSkills[i] = skill;
return;
}
}
AllSkills.Push(skill);
}
//==========================================================================
//
//
//
//==========================================================================
int G_SkillProperty(ESkillProperty prop)
{
if (AllSkills.Size() > 0)
{
switch(prop)
{
case SKILLP_AmmoFactor:
if (dmflags2 & DF2_YES_DOUBLEAMMO)
{
return AllSkills[gameskill].DoubleAmmoFactor;
}
return AllSkills[gameskill].AmmoFactor;
case SKILLP_DropAmmoFactor:
return AllSkills[gameskill].DropAmmoFactor;
case SKILLP_DamageFactor:
return AllSkills[gameskill].DamageFactor;
case SKILLP_FastMonsters:
return AllSkills[gameskill].FastMonsters || (dmflags & DF_FAST_MONSTERS);
case SKILLP_Respawn:
if (dmflags & DF_MONSTERS_RESPAWN && AllSkills[gameskill].RespawnCounter==0)
return TICRATE * (gameinfo.gametype != GAME_Strife ? 12 : 16);
return AllSkills[gameskill].RespawnCounter;
case SKILLP_RespawnLimit:
return AllSkills[gameskill].RespawnLimit;
case SKILLP_Aggressiveness:
return AllSkills[gameskill].Aggressiveness;
case SKILLP_DisableCheats:
return AllSkills[gameskill].DisableCheats;
case SKILLP_AutoUseHealth:
return AllSkills[gameskill].AutoUseHealth;
case SKILLP_EasyBossBrain:
return AllSkills[gameskill].EasyBossBrain;
case SKILLP_SpawnFilter:
return AllSkills[gameskill].SpawnFilter;
case SKILLP_ACSReturn:
return AllSkills[gameskill].ACSReturn;
}
}
return 0;
}
//==========================================================================
//
//
//
//==========================================================================
void G_VerifySkill()
{
if (gameskill >= (int)AllSkills.Size())
gameskill = AllSkills.Size()-1;
else if (gameskill < 0)
gameskill = 0;
}
//==========================================================================
//
//
//
//==========================================================================
FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
{
Name = other.Name;
AmmoFactor = other.AmmoFactor;
DoubleAmmoFactor = other.DoubleAmmoFactor;
DropAmmoFactor = other.DropAmmoFactor;
DamageFactor = other.DamageFactor;
FastMonsters = other.FastMonsters;
DisableCheats = other.DisableCheats;
AutoUseHealth = other.AutoUseHealth;
EasyBossBrain = other.EasyBossBrain;
RespawnCounter= other.RespawnCounter;
RespawnLimit= other.RespawnLimit;
Aggressiveness= other.Aggressiveness;
SpawnFilter = other.SpawnFilter;
ACSReturn = other.ACSReturn;
MenuName = other.MenuName;
MenuNamesForPlayerClass = other.MenuNamesForPlayerClass;
MenuNameIsLump = other.MenuNameIsLump;
MustConfirm = other.MustConfirm;
MustConfirmText = other.MustConfirmText;
Shortcut = other.Shortcut;
TextColor = other.TextColor;
return *this;
}
//==========================================================================
//
//
//
//==========================================================================
int FSkillInfo::GetTextColor() const
{
if (TextColor.IsEmpty())
{
return CR_UNTRANSLATED;
}
const BYTE *cp = (const BYTE *)TextColor.GetChars();
int color = V_ParseFontColor(cp, 0, 0);
if (color == CR_UNDEFINED)
{
Printf("Undefined color '%s' in definition of skill %s\n", TextColor.GetChars(), Name.GetChars());
color = CR_UNTRANSLATED;
}
return color;
}

View file

@ -106,7 +106,7 @@ IMPLEMENT_CLASS (AScanner)
bool AScanner::Use (bool pickup)
{
if (!(level.flags & LEVEL_ALLMAP))
if (!(level.flags2 & LEVEL2_ALLMAP))
{
if (Owner->CheckLocalView (consoleplayer))
{

View file

@ -236,7 +236,7 @@ void cht_DoCheat (player_t *player, int cheat)
if (i == 4)
{
level.flags ^= LEVEL_ALLMAP;
level.flags2 ^= LEVEL2_ALLMAP;
}
else if (player->mo != NULL && player->health >= 0)
{

View file

@ -69,6 +69,7 @@
#include "r_translate.h"
#include "sbarinfo.h"
#include "cmdlib.h"
#include "m_png.h"
extern FILE *Logfile;
@ -118,6 +119,222 @@ struct FBehavior::ArrayInfo
TArray<FBehavior *> FBehavior::StaticModules;
//============================================================================
//
// Global and world variables
//
//============================================================================
// ACS variables with world scope
SDWORD ACS_WorldVars[NUM_WORLDVARS];
FWorldGlobalArray ACS_WorldArrays[NUM_WORLDVARS];
// ACS variables with global scope
SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS];
//============================================================================
//
//
//
//============================================================================
void P_ClearACSVars(bool alsoglobal)
{
int i;
memset (ACS_WorldVars, 0, sizeof(ACS_WorldVars));
for (i = 0; i < NUM_WORLDVARS; ++i)
{
ACS_WorldArrays[i].Clear ();
}
if (alsoglobal)
{
memset (ACS_GlobalVars, 0, sizeof(ACS_GlobalVars));
for (i = 0; i < NUM_GLOBALVARS; ++i)
{
ACS_GlobalArrays[i].Clear ();
}
}
}
//============================================================================
//
//
//
//============================================================================
static void WriteVars (FILE *file, SDWORD *vars, size_t count, DWORD id)
{
size_t i, j;
for (i = 0; i < count; ++i)
{
if (vars[i] != 0)
break;
}
if (i < count)
{
// Find last non-zero var. Anything beyond the last stored variable
// will be zeroed at load time.
for (j = count-1; j > i; --j)
{
if (vars[j] != 0)
break;
}
FPNGChunkArchive arc (file, id);
for (i = 0; i <= j; ++i)
{
DWORD var = vars[i];
arc << var;
}
}
}
//============================================================================
//
//
//
//============================================================================
static void ReadVars (PNGHandle *png, SDWORD *vars, size_t count, DWORD id)
{
size_t len = M_FindPNGChunk (png, id);
size_t used = 0;
if (len != 0)
{
DWORD var;
size_t i;
FPNGChunkArchive arc (png->File->GetFile(), id, len);
used = len / 4;
for (i = 0; i < used; ++i)
{
arc << var;
vars[i] = var;
}
png->File->ResetFilePtr();
}
if (used < count)
{
memset (&vars[used], 0, (count-used)*4);
}
}
//============================================================================
//
//
//
//============================================================================
static void WriteArrayVars (FILE *file, FWorldGlobalArray *vars, unsigned int count, DWORD id)
{
unsigned int i, j;
// Find the first non-empty array.
for (i = 0; i < count; ++i)
{
if (vars[i].CountUsed() != 0)
break;
}
if (i < count)
{
// Find last non-empty array. Anything beyond the last stored array
// will be emptied at load time.
for (j = count-1; j > i; --j)
{
if (vars[j].CountUsed() != 0)
break;
}
FPNGChunkArchive arc (file, id);
arc.WriteCount (i);
arc.WriteCount (j);
for (; i <= j; ++i)
{
arc.WriteCount (vars[i].CountUsed());
FWorldGlobalArray::ConstIterator it(vars[i]);
const FWorldGlobalArray::Pair *pair;
while (it.NextPair (pair))
{
arc.WriteCount (pair->Key);
arc.WriteCount (pair->Value);
}
}
}
}
//============================================================================
//
//
//
//============================================================================
static void ReadArrayVars (PNGHandle *png, FWorldGlobalArray *vars, size_t count, DWORD id)
{
size_t len = M_FindPNGChunk (png, id);
unsigned int i, k;
for (i = 0; i < count; ++i)
{
vars[i].Clear ();
}
if (len != 0)
{
DWORD max, size;
FPNGChunkArchive arc (png->File->GetFile(), id, len);
i = arc.ReadCount ();
max = arc.ReadCount ();
for (; i <= max; ++i)
{
size = arc.ReadCount ();
for (k = 0; k < size; ++k)
{
SDWORD key, val;
key = arc.ReadCount();
val = arc.ReadCount();
vars[i].Insert (key, val);
}
}
png->File->ResetFilePtr();
}
}
//============================================================================
//
//
//
//============================================================================
void P_ReadACSVars(PNGHandle *png)
{
ReadVars (png, ACS_WorldVars, NUM_WORLDVARS, MAKE_ID('w','v','A','r'));
ReadVars (png, ACS_GlobalVars, NUM_GLOBALVARS, MAKE_ID('g','v','A','r'));
ReadArrayVars (png, ACS_WorldArrays, NUM_WORLDVARS, MAKE_ID('w','a','R','r'));
ReadArrayVars (png, ACS_GlobalArrays, NUM_GLOBALVARS, MAKE_ID('g','a','R','r'));
}
//============================================================================
//
//
//
//============================================================================
void P_WriteACSVars(FILE *stdfile)
{
WriteVars (stdfile, ACS_WorldVars, NUM_WORLDVARS, MAKE_ID('w','v','A','r'));
WriteVars (stdfile, ACS_GlobalVars, NUM_GLOBALVARS, MAKE_ID('g','v','A','r'));
WriteArrayVars (stdfile, ACS_WorldArrays, NUM_WORLDVARS, MAKE_ID('w','a','R','r'));
WriteArrayVars (stdfile, ACS_GlobalArrays, NUM_GLOBALVARS, MAKE_ID('g','a','R','r'));
}
//---- Inventory functions --------------------------------------//
//

View file

@ -36,6 +36,7 @@
#define __P_ACS_H__
#include "dobject.h"
#include "dthinker.h"
#include "doomtype.h"
#define LOCAL_SIZE 20
@ -44,6 +45,34 @@
class FFont;
class FileReader;
enum
{
NUM_WORLDVARS = 256,
NUM_GLOBALVARS = 64
};
struct InitIntToZero
{
void Init(int &v)
{
v = 0;
}
};
typedef TMap<SDWORD, SDWORD, THashTraits<SDWORD>, InitIntToZero> FWorldGlobalArray;
// ACS variables with world scope
extern SDWORD ACS_WorldVars[NUM_WORLDVARS];
extern FWorldGlobalArray ACS_WorldArrays[NUM_WORLDVARS];
// ACS variables with global scope
extern SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
extern FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS];
void P_ReadACSVars(PNGHandle *);
void P_WriteACSVars(FILE*);
void P_ClearACSVars(bool);
// The in-memory version
struct ScriptPtr
{

View file

@ -848,7 +848,7 @@ static void DrawConversationMenu ()
}
// [CW] Freeze the game depending on MAPINFO options.
if (ConversationPauseTic < gametic && !multiplayer && !(level.flags & LEVEL_CONV_SINGLE_UNFREEZE))
if (ConversationPauseTic < gametic && !multiplayer && !(level.flags2 & LEVEL2_CONV_SINGLE_UNFREEZE))
{
menuactive = MENU_On;
}

View file

@ -2652,9 +2652,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BossDeath)
// Do generic special death actions first
bool checked = false;
FSpecialAction *sa = level.info->specialactions;
while (sa)
for(unsigned i=0; i<level.info->specialactions.Size(); i++)
{
FSpecialAction *sa = &level.info->specialactions[i];
if (type == sa->Type || mytype == sa->Type)
{
if (!checked && !CheckBossDeath(self))
@ -2666,7 +2667,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_BossDeath)
LineSpecials[sa->Action](NULL, self, false,
sa->Args[0], sa->Args[1], sa->Args[2], sa->Args[3], sa->Args[4]);
}
sa = sa->Next;
}
// [RH] These all depend on the presence of level flags now

View file

@ -1296,8 +1296,8 @@ bool AActor::OkayToSwitchTarget (AActor *other)
int infight;
if (flags5 & MF5_NOINFIGHTING) infight=-1;
else if (level.flags & LEVEL_TOTALINFIGHTING) infight=1;
else if (level.flags & LEVEL_NOINFIGHTING) infight=-1;
else if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight=1;
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight=-1;
else infight = infighting;
if (infight < 0 && other->player == NULL && !IsHostile (other))

View file

@ -2489,7 +2489,7 @@ FUNC(LS_SetPlayerProperty)
}
else if (it->player - players == consoleplayer)
{
level.flags |= LEVEL_ALLMAP;
level.flags2 |= LEVEL2_ALLMAP;
}
}
else
@ -2504,7 +2504,7 @@ FUNC(LS_SetPlayerProperty)
}
else if (it->player - players == consoleplayer)
{
level.flags &= ~LEVEL_ALLMAP;
level.flags2 &= ~LEVEL2_ALLMAP;
}
}
}
@ -2525,7 +2525,7 @@ FUNC(LS_SetPlayerProperty)
}
else if (i == consoleplayer)
{
level.flags |= LEVEL_ALLMAP;
level.flags2 |= LEVEL2_ALLMAP;
}
}
else
@ -2540,7 +2540,7 @@ FUNC(LS_SetPlayerProperty)
}
else if (i == consoleplayer)
{
level.flags &= ~LEVEL_ALLMAP;
level.flags2 &= ~LEVEL2_ALLMAP;
}
}
}

View file

@ -672,7 +672,7 @@ bool PIT_CheckLine (line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
// better than Strife's handling of rails, which lets you jump into rails
// from either side. How long until somebody reports this as a bug and I'm
// forced to say, "It's not a bug. It's a feature?" Ugh.
(!(level.flags & LEVEL_RAILINGHACK) ||
(!(level.flags2 & LEVEL2_RAILINGHACK) ||
open.bottom == tm.thing->Sector->floorplane.ZatPoint (sx, sy)))
{
open.bottom += 32*FRACUNIT;
@ -870,8 +870,8 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
if (!thing->player && !tm.thing->target->player)
{
int infight;
if (level.flags & LEVEL_TOTALINFIGHTING) infight=1;
else if (level.flags & LEVEL_NOINFIGHTING) infight=-1;
if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight=1;
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight=-1;
else infight = infighting;
if (infight < 0)
@ -1412,7 +1412,7 @@ static void CheckForPushSpecial (line_t *line, int side, AActor *mobj)
}
else if (mobj->flags2 & MF2_IMPACT)
{
if ((level.flags & LEVEL_MISSILESACTIVATEIMPACT) ||
if ((level.flags2 & LEVEL2_MISSILESACTIVATEIMPACT) ||
!(mobj->flags & MF_MISSILE) ||
(mobj->target == NULL))
{

View file

@ -1828,7 +1828,7 @@ void P_MonsterFallingDamage (AActor *mo)
int damage;
int mom;
if (!(level.flags&LEVEL_MONSTERFALLINGDAMAGE))
if (!(level.flags2 & LEVEL2_MONSTERFALLINGDAMAGE))
return;
if (mo->floorsector->Flags & SECF_NOFALLINGDAMAGE)
return;
@ -2533,7 +2533,7 @@ void AActor::Tick ()
if (!(flags5 & MF5_NOTIMEFREEZE))
{
//Added by MC: Freeze mode.
if (bglobal.freeze || level.flags & LEVEL_FROZEN)
if (bglobal.freeze || level.flags2 & LEVEL2_FROZEN)
{
return;
}
@ -2572,7 +2572,7 @@ void AActor::Tick ()
}
// Apply freeze mode.
if (( level.flags & LEVEL_FROZEN ) && ( player == NULL || !( player->cheats & CF_TIMEFREEZE )))
if (( level.flags2 & LEVEL2_FROZEN ) && ( player == NULL || !( player->cheats & CF_TIMEFREEZE )))
{
return;
}
@ -3697,7 +3697,7 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer)
{ // Give all cards in death match mode.
p->mo->GiveDeathmatchInventory ();
}
else if ((multiplayer || (level.flags & LEVEL_ALLOWRESPAWN)) && state == PST_REBORN && oldactor != NULL)
else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) && state == PST_REBORN && oldactor != NULL)
{ // Special inventory handling for respawning in coop
p->mo->FilterCoopRespawnInventory (oldactor);
}
@ -4007,7 +4007,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
}
// don't spawn any monsters if -nomonsters
if (((level.flags & LEVEL_NOMONSTERS) || (dmflags & DF_NO_MONSTERS)) && info->flags3 & MF3_ISMONSTER )
if (((level.flags2 & LEVEL2_NOMONSTERS) || (dmflags & DF_NO_MONSTERS)) && info->flags3 & MF3_ISMONSTER )
{
return NULL;
}

View file

@ -466,7 +466,7 @@ void P_SerializeSounds (FArchive &arc)
{
if (!S_ChangeMusic (name, order))
if (level.cdtrack == 0 || !S_ChangeCDMusic (level.cdtrack, level.cdid))
S_ChangeMusic (level.music, level.musicorder);
S_ChangeMusic (level.Music, level.musicorder);
}
delete[] name;
}

View file

@ -1561,7 +1561,7 @@ void P_SetLineID (line_t *ld)
switch (ld->special)
{
case Line_SetIdentification:
if (!(level.flags & LEVEL_HEXENHACK))
if (!(level.flags2 & LEVEL2_HEXENHACK))
{
ld->id = ld->args[0] + 256 * ld->args[4];
ld->flags |= ld->args[1]<<16;
@ -1772,9 +1772,9 @@ void P_LoadLineDefs (MapData * map)
P_AdjustLine (ld);
P_SaveLineSpecial (ld);
if (level.flags & LEVEL_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags & LEVEL_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
if (level.flags & LEVEL_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
if (level.flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
}
delete[] mldf;
}
@ -1850,9 +1850,9 @@ void P_LoadLineDefs2 (MapData * map)
P_AdjustLine (ld);
P_SetLineID(ld);
P_SaveLineSpecial (ld);
if (level.flags & LEVEL_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags & LEVEL_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
if (level.flags & LEVEL_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
if (level.flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
// convert the activation type
ld->activation = 1 << GET_SPAC(ld->flags);
@ -3312,16 +3312,16 @@ void P_SetupLevel (char *lumpname, int position)
{
// We need translators only for Doom format maps.
// If none has been defined in a map use the game's default.
P_LoadTranslator(level.info->translator != NULL? (const char *)level.info->translator : gameinfo.translator);
P_LoadTranslator(!level.info->Translator.IsEmpty()? level.info->Translator.GetChars() : gameinfo.translator);
}
if (!map->HasBehavior || map->isText)
{
// Doom format and UDMF text maps get strict monster activation unless the mapinfo
// specifies differently.
if (!(level.flags & LEVEL_LAXACTIVATIONMAPINFO))
if (!(level.flags2 & LEVEL2_LAXACTIVATIONMAPINFO))
{
level.flags &= ~LEVEL_LAXMONSTERACTIVATION;
level.flags2 &= ~LEVEL2_LAXMONSTERACTIVATION;
}
}
@ -3330,9 +3330,9 @@ void P_SetupLevel (char *lumpname, int position)
// set compatibility flags
if (gameinfo.gametype == GAME_Strife)
{
level.flags |= LEVEL_RAILINGHACK;
level.flags2 |= LEVEL2_RAILINGHACK;
}
level.flags |= LEVEL_DUMMYSWITCHES;
level.flags2 |= LEVEL2_DUMMYSWITCHES;
}
FBehavior::StaticLoadDefaultModules ();

View file

@ -239,7 +239,7 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType)
}
// some old WADs use this method to create walls that change the texture when shot.
else if (activationType == SPAC_Impact && // only for shootable triggers
(level.flags & LEVEL_DUMMYSWITCHES) && // this is only a compatibility setting for an old hack!
(level.flags2 & LEVEL2_DUMMYSWITCHES) && // this is only a compatibility setting for an old hack!
!repeat && // only non-repeatable triggers
(special<Generic_Floor || special>Generic_Crusher) && // not for Boom's generalized linedefs
special && // not for lines without a special
@ -322,7 +322,7 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType)
// lax activation checks, monsters can also activate certain lines
// even without them being marked as monster activate-able. This is
// the default for non-Hexen maps in Hexen format.
if (!(level.flags & LEVEL_LAXMONSTERACTIVATION))
if (!(level.flags2 & LEVEL2_LAXMONSTERACTIVATION))
{
return false;
}

View file

@ -68,7 +68,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog,
kind = kind->ActorInfo->GetReplacement()->Class;
if ((GetDefaultByType (kind)->flags3 & MF3_ISMONSTER) &&
((dmflags & DF_NO_MONSTERS) || (level.flags & LEVEL_NOMONSTERS)))
((dmflags & DF_NO_MONSTERS) || (level.flags2 & LEVEL2_NOMONSTERS)))
return false;
if (tid == 0)
@ -204,7 +204,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
defflags3 = GetDefaultByType (kind)->flags3;
if ((defflags3 & MF3_ISMONSTER) &&
((dmflags & DF_NO_MONSTERS) || (level.flags & LEVEL_NOMONSTERS)))
((dmflags & DF_NO_MONSTERS) || (level.flags2 & LEVEL2_NOMONSTERS)))
return false;
if (tid == 0)

View file

@ -57,7 +57,7 @@ bool P_CheckTickerPaused ()
&& players[consoleplayer].viewz != 1
&& wipegamestate == gamestate)
{
S_PauseSound (!(level.flags & LEVEL_PAUSE_MUSIC_IN_MENUS));
S_PauseSound (!(level.flags2 & LEVEL2_PAUSE_MUSIC_IN_MENUS));
return true;
}
return false;
@ -111,7 +111,7 @@ void P_Ticker (void)
// Since things will be moving, it's okay to interpolate them in the renderer.
r_NoInterpolate = false;
if (!bglobal.freeze && !(level.flags & LEVEL_FROZEN))
if (!bglobal.freeze && !(level.flags2 & LEVEL2_FROZEN))
{
P_ThinkParticles (); // [RH] make the particles think
}
@ -126,7 +126,7 @@ void P_Ticker (void)
DThinker::RunThinkers ();
//if added by MC: Freeze mode.
if (!bglobal.freeze && !(level.flags & LEVEL_FROZEN))
if (!bglobal.freeze && !(level.flags2 & LEVEL2_FROZEN))
{
P_UpdateSpecials ();
P_RunEffects (); // [RH] Run particle effects

View file

@ -419,9 +419,9 @@ struct UDMFParser
ld->Alpha = FRACUNIT;
ld->id = -1;
ld->sidenum[0] = ld->sidenum[1] = NO_SIDE;
if (level.flags & LEVEL_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags & LEVEL_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
if (level.flags & LEVEL_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
if (level.flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
if (level.flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
@ -1124,19 +1124,19 @@ struct UDMFParser
case NAME_Doom:
namespace_bits = Dm;
P_LoadTranslator("xlat/doom_base.txt");
level.flags |= LEVEL_DUMMYSWITCHES;
level.flags2 |= LEVEL2_DUMMYSWITCHES;
floordrop = true;
break;
case NAME_Heretic:
namespace_bits = Ht;
P_LoadTranslator("xlat/heretic_base.txt");
level.flags |= LEVEL_DUMMYSWITCHES;
level.flags2 |= LEVEL2_DUMMYSWITCHES;
floordrop = true;
break;
case NAME_Strife:
namespace_bits = St;
P_LoadTranslator("xlat/strife_base.txt");
level.flags |= LEVEL_DUMMYSWITCHES|LEVEL_RAILINGHACK;
level.flags2 |= LEVEL2_DUMMYSWITCHES|LEVEL2_RAILINGHACK;
floordrop = true;
break;
default:

View file

@ -1148,7 +1148,7 @@ void APlayerPawn::Die (AActor *source, AActor *inflictor)
}
}
}
if (!multiplayer && (level.flags & LEVEL_DEATHSLIDESHOW))
if (!multiplayer && (level.flags2 & LEVEL2_DEATHSLIDESHOW))
{
F_StartSlideshow ();
}
@ -1876,7 +1876,7 @@ void P_DeathThink (player_t *player)
if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && !player->isbot))
{
player->cls = NULL; // Force a new class if the player is using a random class
player->playerstate = (multiplayer || (level.flags & LEVEL_ALLOWRESPAWN)) ? PST_REBORN : PST_ENTER;
player->playerstate = (multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) ? PST_REBORN : PST_ENTER;
if (player->mo->special1 > 2)
{
player->mo->special1 = 0;

View file

@ -1441,7 +1441,7 @@ int side_t::GetLightLevel (bool foggy, int baselight) const
{
if (!(Flags & WALLF_NOFAKECONTRAST))
{
if (((level.flags & LEVEL_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_smoothlighting) &&
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_smoothlighting) &&
lines[linenum].dx != 0)
{
baselight += int // OMG LEE KILLOUGH LIVES! :/

View file

@ -1071,9 +1071,9 @@ static void S_AddSNDINFO (int lump)
mysnprintf (temp, countof(temp), "MAP%02d", sc.Number);
info = FindLevelInfo (temp);
sc.MustGetString ();
if (info->mapname[0] && (!(info->flags & LEVEL_MUSICDEFINED)))
if (info->mapname[0] && (!(info->flags2 & LEVEL2_MUSICDEFINED)))
{
ReplaceString (&info->music, sc.String);
info->Music = sc.String;
}
}
break;

View file

@ -370,26 +370,18 @@ void S_Start ()
// Check for local sound definitions. Only reload if they differ
// from the previous ones.
const char *LocalSndInfo;
const char *LocalSndSeq;
FString LocalSndInfo;
FString LocalSndSeq;
// To be certain better check whether level is valid!
if (level.info && level.info->soundinfo)
if (level.info)
{
LocalSndInfo = level.info->soundinfo;
}
else
{
LocalSndInfo = "";
LocalSndInfo = level.info->SoundInfo;
}
if (level.info && level.info->sndseq)
if (level.info)
{
LocalSndSeq = level.info->sndseq;
}
else
{
LocalSndSeq = "";
LocalSndSeq = level.info->SndSeq;
}
bool parse_ss = false;
@ -420,11 +412,11 @@ void S_Start ()
{
parse_ss = true;
}
if (parse_ss)
{
S_ParseSndSeq(*LocalSndSeq? Wads.CheckNumForFullName(LocalSndSeq, true) : -1);
}
else
LastLocalSndInfo = LocalSndInfo;
LastLocalSndSeq = LocalSndSeq;
@ -442,7 +434,7 @@ void S_Start ()
if (!savegamerestore)
{
if (level.cdtrack == 0 || !S_ChangeCDMusic (level.cdtrack, level.cdid))
S_ChangeMusic (level.music, level.musicorder);
S_ChangeMusic (level.Music, level.musicorder);
}
}
@ -2170,7 +2162,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
{
if (gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL)
{
musicname = level.music;
musicname = level.Music;
order = level.musicorder;
}
else
@ -2433,9 +2425,9 @@ CCMD (idmus)
if ( (info = FindLevelInfo (map)) )
{
if (info->music)
if (info->Music.IsNotEmpty())
{
S_ChangeMusic (info->music, info->musicorder);
S_ChangeMusic (info->Music, info->musicorder);
Printf ("%s\n", GStrings("STSTR_MUS"));
}
}

View file

@ -22,6 +22,7 @@
#include "m_misc.h"
#include "templates.h"
#include "doomstat.h"
#include "v_text.h"
// MACROS ------------------------------------------------------------------
@ -752,16 +753,21 @@ void FScanner::UnGet ()
//
//==========================================================================
int FScanner::MatchString (const char **strings)
int FScanner::MatchString (const char **strings, size_t stride)
{
int i;
assert(stride % sizeof(const char*) == 0);
stride /= sizeof(const char*);
for (i = 0; *strings != NULL; i++)
{
if (Compare (*strings++))
if (Compare (*strings))
{
return i;
}
strings += stride;
}
return -1;
}
@ -772,11 +778,11 @@ int FScanner::MatchString (const char **strings)
//
//==========================================================================
int FScanner::MustMatchString (const char **strings)
int FScanner::MustMatchString (const char **strings, size_t stride)
{
int i;
i = MatchString (strings);
i = MatchString (strings, stride);
if (i == -1)
{
ScriptError (NULL);
@ -1007,7 +1013,7 @@ void STACK_ARGS FScanner::ScriptMessage (const char *message, ...)
va_end (arglist);
}
Printf ("Script error, \"%s\" line %d:\n%s\n", ScriptName.GetChars(),
Printf (TEXTCOLOR_RED"Script error, \"%s\" line %d:\n%s\n", ScriptName.GetChars(),
AlreadyGot? AlreadyGotLine : Line, composed.GetChars());
}

View file

@ -54,8 +54,8 @@ public:
void UnGet();
bool Compare(const char *text);
int MatchString(const char **strings);
int MustMatchString(const char **strings);
int MatchString(const char **strings, size_t stride = sizeof(char*));
int MustMatchString(const char **strings, size_t stride = sizeof(char*));
int GetMessageLine();
void ScriptError(const char *message, ...);

View file

@ -228,7 +228,6 @@ void I_Quit (void)
if (demorecording)
G_CheckDemoStatus();
G_ClearSnapshots ();
}

View file

@ -230,7 +230,7 @@ static FTexture* p; // Player graphic
static FTexture* lnames[2]; // Name graphics of each level (centered)
// [RH] Info to dynamically generate the level name graphics
static const char *lnametexts[2];
static FString lnametexts[2];
static FTexture *background;
@ -297,11 +297,11 @@ void WI_LoadBackground(bool isenterpic)
if (isenterpic)
{
level_info_t * li = FindLevelInfo(wbs->next);
if (li != NULL) lumpname = li->enterpic;
if (li != NULL) lumpname = li->EnterPic;
}
else
{
lumpname = level.info->exitpic;
lumpname = level.info->ExitPic;
}
// Try to get a default if nothing specified
@ -329,7 +329,7 @@ void WI_LoadBackground(bool isenterpic)
// If going from E1-E3 to E4 the default should be used, not the exit pic.
// Not if the exit pic is user defined!
if (level.info->exitpic != NULL && level.info->exitpic[0]!=0) return;
if (level.info->ExitPic.IsNotEmpty()) return;
// E1-E3 need special treatment when playing Doom 1.
if (gamemode!=commercial)
@ -712,6 +712,7 @@ int WI_DrawName(int y, const char *levelname)
lumph = BigFont->GetHeight() * CleanYfac;
p = levelname;
if (!p) return 0;
l = strlen(p);
if (!l) return 0;
@ -1885,8 +1886,8 @@ void WI_Ticker(void)
if (bcnt == 1)
{
// intermission music - use the defaults if none specified
if (level.info->intermusic != NULL)
S_ChangeMusic(level.info->intermusic, level.info->intermusicorder);
if (level.info->InterMusic.IsNotEmpty())
S_ChangeMusic(level.info->InterMusic, level.info->intermusicorder);
else if (gameinfo.gametype == GAME_Heretic)
S_ChangeMusic ("mus_intr");
else if (gameinfo.gametype == GAME_Hexen)
@ -1966,11 +1967,12 @@ void WI_loadData(void)
bstar = star;
}
// Use the local level structure which can be overridden by hubs if they eventually get names!
lnametexts[0] = level.level_name;
// Use the local level structure which can be overridden by hubs
lnametexts[0] = level.LevelName;
level_info_t *li = FindLevelInfo(wbs->next);
lnametexts[1] = li ? G_MaybeLookupLevelName(li) : NULL;
if (li) lnametexts[1] = li->LookupLevelName();
else lnametexts[1] = "";
WI_LoadBackground(false);
}

View file

@ -449,7 +449,6 @@ void I_Quit (void)
if (demorecording)
G_CheckDemoStatus();
G_ClearSnapshots ();
}

View file

@ -1110,6 +1110,7 @@ void FString::ReallocBuffer (size_t newlen)
#include <windows.h>
static HANDLE StringHeap;
const SIZE_T STRING_HEAP_SIZE = 64*1024;
#endif
FStringData *FStringData::Alloc (size_t strlen)
@ -1120,7 +1121,7 @@ FStringData *FStringData::Alloc (size_t strlen)
#ifdef _WIN32
if (StringHeap == NULL)
{
StringHeap = HeapCreate (0, 64*1024, 0);
StringHeap = HeapCreate (0, STRING_HEAP_SIZE, 0);
if (StringHeap == NULL)
{
throw std::bad_alloc();

View file

@ -624,6 +624,14 @@
RelativePath=".\src\g_level.cpp"
>
</File>
<File
RelativePath=".\src\g_mapinfo.cpp"
>
</File>
<File
RelativePath=".\src\g_skill.cpp"
>
</File>
<File
RelativePath=".\src\gameconfigfile.cpp"
>