mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Expanded the args for MAPINFO special actions to 32 bit integers as in
the rest of the game. - Fixed: The specialaction list was not copied properly when transferred from the defaultinfo. - Fixed: The defaultinfo for MAPINFO wasn't cleared fully after MAPINFO parsing was completed. - Made Doom-format linedef translators a map property so that it's easier to define replacements or extensions. SVN r843 (trunk)
This commit is contained in:
parent
3237c6b4e8
commit
969cc1f6f9
7 changed files with 88 additions and 54 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
March 23, 2008 (Changes by Graf Zahl)
|
||||||
|
- Expanded the args for MAPINFO special actions to 32 bit integers as in
|
||||||
|
the rest of the game.
|
||||||
|
- Fixed: The specialaction list was not copied properly when transferred
|
||||||
|
from the defaultinfo.
|
||||||
|
- Fixed: The defaultinfo for MAPINFO wasn't cleared fully after MAPINFO
|
||||||
|
parsing was completed.
|
||||||
|
- Made Doom-format linedef translators a map property so that it's easier
|
||||||
|
to define replacements or extensions.
|
||||||
|
|
||||||
March 22, 2008
|
March 22, 2008
|
||||||
- Changed MIDI playback to not bother playing super short songs that don't
|
- Changed MIDI playback to not bother playing super short songs that don't
|
||||||
contain enough music to fill the initial output buffers.
|
contain enough music to fill the initial output buffers.
|
||||||
|
|
|
@ -309,6 +309,7 @@ static const char *MapInfoMapLevel[] =
|
||||||
"teamplayoff",
|
"teamplayoff",
|
||||||
"checkswitchrange",
|
"checkswitchrange",
|
||||||
"nocheckswitchrange",
|
"nocheckswitchrange",
|
||||||
|
"translator",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -458,6 +459,7 @@ MapHandlers[] =
|
||||||
{ MITYPE_SCFLAGS, LEVEL_FORCETEAMPLAYOFF, ~LEVEL_FORCETEAMPLAYON },
|
{ MITYPE_SCFLAGS, LEVEL_FORCETEAMPLAYOFF, ~LEVEL_FORCETEAMPLAYON },
|
||||||
{ MITYPE_SETFLAG, LEVEL_CHECKSWITCHRANGE, 0 },
|
{ MITYPE_SETFLAG, LEVEL_CHECKSWITCHRANGE, 0 },
|
||||||
{ MITYPE_CLRFLAG, LEVEL_CHECKSWITCHRANGE, 0 },
|
{ MITYPE_CLRFLAG, LEVEL_CHECKSWITCHRANGE, 0 },
|
||||||
|
{ MITYPE_STRING, lioffset(translator), 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *MapInfoClusterLevel[] =
|
static const char *MapInfoClusterLevel[] =
|
||||||
|
@ -605,6 +607,20 @@ void G_ParseMapInfo ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FSpecialAction *CopySpecialActions(FSpecialAction *spec)
|
||||||
|
{
|
||||||
|
FSpecialAction **pSpec = &spec;
|
||||||
|
|
||||||
|
while (*pSpec)
|
||||||
|
{
|
||||||
|
FSpecialAction *newspec = new FSpecialAction;
|
||||||
|
*newspec = **pSpec;
|
||||||
|
*pSpec = newspec;
|
||||||
|
pSpec = &newspec->Next;
|
||||||
|
}
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
|
||||||
static void G_DoParseMapInfo (int lump)
|
static void G_DoParseMapInfo (int lump)
|
||||||
{
|
{
|
||||||
level_info_t defaultinfo;
|
level_info_t defaultinfo;
|
||||||
|
@ -624,8 +640,7 @@ static void G_DoParseMapInfo (int lump)
|
||||||
switch (sc.MustMatchString (MapInfoTopLevel))
|
switch (sc.MustMatchString (MapInfoTopLevel))
|
||||||
{
|
{
|
||||||
case MITL_DEFAULTMAP:
|
case MITL_DEFAULTMAP:
|
||||||
if (defaultinfo.music != NULL) delete [] defaultinfo.music;
|
ClearLevelInfoStrings(&defaultinfo);
|
||||||
if (defaultinfo.intermusic != NULL) delete [] defaultinfo.intermusic;
|
|
||||||
SetLevelDefaults (&defaultinfo);
|
SetLevelDefaults (&defaultinfo);
|
||||||
ParseMapInfoLower (sc, MapHandlers, MapInfoMapLevel, &defaultinfo, NULL, defaultinfo.flags);
|
ParseMapInfoLower (sc, MapHandlers, MapInfoMapLevel, &defaultinfo, NULL, defaultinfo.flags);
|
||||||
break;
|
break;
|
||||||
|
@ -668,6 +683,11 @@ static void G_DoParseMapInfo (int lump)
|
||||||
{
|
{
|
||||||
levelinfo->intermusic = copystring (levelinfo->intermusic);
|
levelinfo->intermusic = copystring (levelinfo->intermusic);
|
||||||
}
|
}
|
||||||
|
if (levelinfo->translator != NULL)
|
||||||
|
{
|
||||||
|
levelinfo->translator = copystring (levelinfo->translator);
|
||||||
|
}
|
||||||
|
levelinfo->specialactions = CopySpecialActions(levelinfo->specialactions);
|
||||||
if (HexenHack)
|
if (HexenHack)
|
||||||
{
|
{
|
||||||
levelinfo->WallHorizLight = levelinfo->WallVertLight = 0;
|
levelinfo->WallHorizLight = levelinfo->WallVertLight = 0;
|
||||||
|
@ -773,14 +793,7 @@ static void G_DoParseMapInfo (int lump)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (defaultinfo.music != NULL)
|
ClearLevelInfoStrings(&defaultinfo);
|
||||||
{
|
|
||||||
delete [] defaultinfo.music;
|
|
||||||
}
|
|
||||||
if (defaultinfo.intermusic != NULL)
|
|
||||||
{
|
|
||||||
delete [] defaultinfo.intermusic;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClearLevelInfoStrings(level_info_t *linfo)
|
static void ClearLevelInfoStrings(level_info_t *linfo)
|
||||||
|
@ -800,6 +813,11 @@ static void ClearLevelInfoStrings(level_info_t *linfo)
|
||||||
delete[] linfo->level_name;
|
delete[] linfo->level_name;
|
||||||
linfo->level_name = NULL;
|
linfo->level_name = NULL;
|
||||||
}
|
}
|
||||||
|
if (linfo->translator != NULL)
|
||||||
|
{
|
||||||
|
delete[] linfo->translator;
|
||||||
|
linfo->translator = NULL;
|
||||||
|
}
|
||||||
for (FSpecialAction *spac = linfo->specialactions; spac != NULL; )
|
for (FSpecialAction *spac = linfo->specialactions; spac != NULL; )
|
||||||
{
|
{
|
||||||
FSpecialAction *next = spac->Next;
|
FSpecialAction *next = spac->Next;
|
||||||
|
|
|
@ -124,7 +124,7 @@ struct FSpecialAction
|
||||||
{
|
{
|
||||||
FName Type; // this is initialized before the actors...
|
FName Type; // this is initialized before the actors...
|
||||||
BYTE Action;
|
BYTE Action;
|
||||||
WORD Args[5]; // must allow 16 bit tags for 666 & 667!
|
int Args[5]; // must allow 16 bit tags for 666 & 667!
|
||||||
FSpecialAction *Next;
|
FSpecialAction *Next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,6 +163,7 @@ struct level_info_s
|
||||||
int airsupply;
|
int airsupply;
|
||||||
DWORD compatflags;
|
DWORD compatflags;
|
||||||
DWORD compatmask;
|
DWORD compatmask;
|
||||||
|
char *translator; // for converting Doom-format linedef and sector types.
|
||||||
|
|
||||||
// Redirection: If any player is carrying the specified item, then
|
// Redirection: If any player is carrying the specified item, then
|
||||||
// you go to the RedirectMap instead of this one.
|
// you go to the RedirectMap instead of this one.
|
||||||
|
|
33
src/gi.cpp
33
src/gi.cpp
|
@ -94,7 +94,8 @@ gameinfo_t HexenGameInfo =
|
||||||
GAME_Hexen,
|
GAME_Hexen,
|
||||||
150,
|
150,
|
||||||
"F_SKY",
|
"F_SKY",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/heretic.txt", // not really correct but this was used before.
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t HexenDKGameInfo =
|
gameinfo_t HexenDKGameInfo =
|
||||||
|
@ -122,7 +123,8 @@ gameinfo_t HexenDKGameInfo =
|
||||||
GAME_Hexen,
|
GAME_Hexen,
|
||||||
150,
|
150,
|
||||||
"F_SKY",
|
"F_SKY",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/heretic.txt", // not really correct but this was used before.
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t HereticGameInfo =
|
gameinfo_t HereticGameInfo =
|
||||||
|
@ -150,7 +152,8 @@ gameinfo_t HereticGameInfo =
|
||||||
GAME_Heretic,
|
GAME_Heretic,
|
||||||
150,
|
150,
|
||||||
"F_SKY1",
|
"F_SKY1",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/heretic.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t HereticSWGameInfo =
|
gameinfo_t HereticSWGameInfo =
|
||||||
|
@ -178,7 +181,8 @@ gameinfo_t HereticSWGameInfo =
|
||||||
GAME_Heretic,
|
GAME_Heretic,
|
||||||
150,
|
150,
|
||||||
"F_SKY1",
|
"F_SKY1",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/heretic.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t SharewareGameInfo =
|
gameinfo_t SharewareGameInfo =
|
||||||
|
@ -206,7 +210,8 @@ gameinfo_t SharewareGameInfo =
|
||||||
GAME_Doom,
|
GAME_Doom,
|
||||||
100,
|
100,
|
||||||
"F_SKY1",
|
"F_SKY1",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/doom.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t RegisteredGameInfo =
|
gameinfo_t RegisteredGameInfo =
|
||||||
|
@ -234,7 +239,8 @@ gameinfo_t RegisteredGameInfo =
|
||||||
GAME_Doom,
|
GAME_Doom,
|
||||||
100,
|
100,
|
||||||
"F_SKY1",
|
"F_SKY1",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/doom.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t RetailGameInfo =
|
gameinfo_t RetailGameInfo =
|
||||||
|
@ -262,7 +268,8 @@ gameinfo_t RetailGameInfo =
|
||||||
GAME_Doom,
|
GAME_Doom,
|
||||||
100,
|
100,
|
||||||
"F_SKY1",
|
"F_SKY1",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/doom.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t CommercialGameInfo =
|
gameinfo_t CommercialGameInfo =
|
||||||
|
@ -290,7 +297,8 @@ gameinfo_t CommercialGameInfo =
|
||||||
GAME_Doom,
|
GAME_Doom,
|
||||||
100,
|
100,
|
||||||
"F_SKY1",
|
"F_SKY1",
|
||||||
24*FRACUNIT
|
24*FRACUNIT,
|
||||||
|
"xlat/doom.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t StrifeGameInfo =
|
gameinfo_t StrifeGameInfo =
|
||||||
|
@ -318,7 +326,8 @@ gameinfo_t StrifeGameInfo =
|
||||||
GAME_Strife,
|
GAME_Strife,
|
||||||
150,
|
150,
|
||||||
"F_SKY001",
|
"F_SKY001",
|
||||||
16*FRACUNIT
|
16*FRACUNIT,
|
||||||
|
"xlat/strife.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t StrifeTeaserGameInfo =
|
gameinfo_t StrifeTeaserGameInfo =
|
||||||
|
@ -346,7 +355,8 @@ gameinfo_t StrifeTeaserGameInfo =
|
||||||
GAME_Strife,
|
GAME_Strife,
|
||||||
150,
|
150,
|
||||||
"F_SKY001",
|
"F_SKY001",
|
||||||
16*FRACUNIT
|
16*FRACUNIT,
|
||||||
|
"xlat/strife.txt",
|
||||||
};
|
};
|
||||||
|
|
||||||
gameinfo_t StrifeTeaser2GameInfo =
|
gameinfo_t StrifeTeaser2GameInfo =
|
||||||
|
@ -374,5 +384,6 @@ gameinfo_t StrifeTeaser2GameInfo =
|
||||||
GAME_Strife,
|
GAME_Strife,
|
||||||
150,
|
150,
|
||||||
"F_SKY001",
|
"F_SKY001",
|
||||||
16*FRACUNIT
|
16*FRACUNIT,
|
||||||
|
"xlat/strife.txt",
|
||||||
};
|
};
|
||||||
|
|
1
src/gi.h
1
src/gi.h
|
@ -113,6 +113,7 @@ typedef struct
|
||||||
int defKickback;
|
int defKickback;
|
||||||
char SkyFlatName[9];
|
char SkyFlatName[9];
|
||||||
fixed_t StepHeight;
|
fixed_t StepHeight;
|
||||||
|
const char *translator;
|
||||||
} gameinfo_t;
|
} gameinfo_t;
|
||||||
|
|
||||||
extern gameinfo_t gameinfo;
|
extern gameinfo_t gameinfo;
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
extern void P_SpawnMapThing (mapthing2_t *mthing, int position);
|
extern void P_SpawnMapThing (mapthing2_t *mthing, int position);
|
||||||
extern bool P_LoadBuildMap (BYTE *mapdata, size_t len, mapthing2_t **things, int *numthings);
|
extern bool P_LoadBuildMap (BYTE *mapdata, size_t len, mapthing2_t **things, int *numthings);
|
||||||
|
|
||||||
|
extern void P_LoadTranslator(const char *lump);
|
||||||
extern void P_TranslateLineDef (line_t *ld, maplinedef_t *mld);
|
extern void P_TranslateLineDef (line_t *ld, maplinedef_t *mld);
|
||||||
extern void P_TranslateTeleportThings (void);
|
extern void P_TranslateTeleportThings (void);
|
||||||
extern int P_TranslateSectorSpecial (int);
|
extern int P_TranslateSectorSpecial (int);
|
||||||
|
@ -3605,6 +3606,10 @@ void P_SetupLevel (char *lumpname, int position)
|
||||||
{
|
{
|
||||||
level.flags &= ~LEVEL_LAXMONSTERACTIVATION;
|
level.flags &= ~LEVEL_LAXMONSTERACTIVATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
FBehavior::StaticLoadDefaultModules ();
|
FBehavior::StaticLoadDefaultModules ();
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "xlat_parser.h"
|
#include "xlat_parser.h"
|
||||||
#include "xlat.h"
|
#include "xlat.h"
|
||||||
|
|
||||||
|
static FString LastTranslator;
|
||||||
TAutoGrowArray<FLineTrans> SimpleLineTranslations;
|
TAutoGrowArray<FLineTrans> SimpleLineTranslations;
|
||||||
FBoomTranslator Boomish[MAX_BOOMISH];
|
FBoomTranslator Boomish[MAX_BOOMISH];
|
||||||
int NumBoomish;
|
int NumBoomish;
|
||||||
|
@ -462,8 +463,17 @@ void ParseXlatLump(const char *lumpname, void *pParser, XlatParseContext *contex
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void ParseXlat(const char *lumpname)
|
void P_LoadTranslator(const char *lumpname)
|
||||||
{
|
{
|
||||||
|
// Only read the lump if it differs from the previous one.
|
||||||
|
if (LastTranslator.CompareNoCase(lumpname))
|
||||||
|
{
|
||||||
|
// Clear the old data before parsing the lump.
|
||||||
|
SimpleLineTranslations.Clear();
|
||||||
|
NumBoomish = 0;
|
||||||
|
SectorTranslations.Clear();
|
||||||
|
SectorMasks.Clear();
|
||||||
|
|
||||||
void *pParser = XlatParseAlloc(malloc);
|
void *pParser = XlatParseAlloc(malloc);
|
||||||
|
|
||||||
XlatParseContext context;
|
XlatParseContext context;
|
||||||
|
@ -473,28 +483,6 @@ void ParseXlat(const char *lumpname)
|
||||||
tok.val=0;
|
tok.val=0;
|
||||||
XlatParse(pParser, 0, tok, &context);
|
XlatParse(pParser, 0, tok, &context);
|
||||||
XlatParseFree(pParser, free);
|
XlatParseFree(pParser, free);
|
||||||
}
|
LastTranslator = lumpname;
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
AT_GAME_SET(Translators)
|
|
||||||
{
|
|
||||||
if (gameinfo.gametype == GAME_Doom)
|
|
||||||
{
|
|
||||||
ParseXlat("xlat/doom.txt");
|
|
||||||
}
|
|
||||||
else if (gameinfo.gametype == GAME_Strife)
|
|
||||||
{
|
|
||||||
ParseXlat("xlat/strife.txt");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ParseXlat("xlat/heretic.txt");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue