mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +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
|
||||
- Changed MIDI playback to not bother playing super short songs that don't
|
||||
contain enough music to fill the initial output buffers.
|
||||
|
|
|
@ -309,6 +309,7 @@ static const char *MapInfoMapLevel[] =
|
|||
"teamplayoff",
|
||||
"checkswitchrange",
|
||||
"nocheckswitchrange",
|
||||
"translator",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -458,6 +459,7 @@ MapHandlers[] =
|
|||
{ MITYPE_SCFLAGS, LEVEL_FORCETEAMPLAYOFF, ~LEVEL_FORCETEAMPLAYON },
|
||||
{ MITYPE_SETFLAG, LEVEL_CHECKSWITCHRANGE, 0 },
|
||||
{ MITYPE_CLRFLAG, LEVEL_CHECKSWITCHRANGE, 0 },
|
||||
{ MITYPE_STRING, lioffset(translator), 0 },
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
level_info_t defaultinfo;
|
||||
|
@ -624,8 +640,7 @@ static void G_DoParseMapInfo (int lump)
|
|||
switch (sc.MustMatchString (MapInfoTopLevel))
|
||||
{
|
||||
case MITL_DEFAULTMAP:
|
||||
if (defaultinfo.music != NULL) delete [] defaultinfo.music;
|
||||
if (defaultinfo.intermusic != NULL) delete [] defaultinfo.intermusic;
|
||||
ClearLevelInfoStrings(&defaultinfo);
|
||||
SetLevelDefaults (&defaultinfo);
|
||||
ParseMapInfoLower (sc, MapHandlers, MapInfoMapLevel, &defaultinfo, NULL, defaultinfo.flags);
|
||||
break;
|
||||
|
@ -668,6 +683,11 @@ static void G_DoParseMapInfo (int lump)
|
|||
{
|
||||
levelinfo->intermusic = copystring (levelinfo->intermusic);
|
||||
}
|
||||
if (levelinfo->translator != NULL)
|
||||
{
|
||||
levelinfo->translator = copystring (levelinfo->translator);
|
||||
}
|
||||
levelinfo->specialactions = CopySpecialActions(levelinfo->specialactions);
|
||||
if (HexenHack)
|
||||
{
|
||||
levelinfo->WallHorizLight = levelinfo->WallVertLight = 0;
|
||||
|
@ -773,14 +793,7 @@ static void G_DoParseMapInfo (int lump)
|
|||
|
||||
}
|
||||
}
|
||||
if (defaultinfo.music != NULL)
|
||||
{
|
||||
delete [] defaultinfo.music;
|
||||
}
|
||||
if (defaultinfo.intermusic != NULL)
|
||||
{
|
||||
delete [] defaultinfo.intermusic;
|
||||
}
|
||||
ClearLevelInfoStrings(&defaultinfo);
|
||||
}
|
||||
|
||||
static void ClearLevelInfoStrings(level_info_t *linfo)
|
||||
|
@ -800,6 +813,11 @@ static void ClearLevelInfoStrings(level_info_t *linfo)
|
|||
delete[] linfo->level_name;
|
||||
linfo->level_name = NULL;
|
||||
}
|
||||
if (linfo->translator != NULL)
|
||||
{
|
||||
delete[] linfo->translator;
|
||||
linfo->translator = NULL;
|
||||
}
|
||||
for (FSpecialAction *spac = linfo->specialactions; spac != NULL; )
|
||||
{
|
||||
FSpecialAction *next = spac->Next;
|
||||
|
|
|
@ -124,7 +124,7 @@ struct FSpecialAction
|
|||
{
|
||||
FName Type; // this is initialized before the actors...
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -163,6 +163,7 @@ struct level_info_s
|
|||
int airsupply;
|
||||
DWORD compatflags;
|
||||
DWORD compatmask;
|
||||
char *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.
|
||||
|
|
33
src/gi.cpp
33
src/gi.cpp
|
@ -94,7 +94,8 @@ gameinfo_t HexenGameInfo =
|
|||
GAME_Hexen,
|
||||
150,
|
||||
"F_SKY",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/heretic.txt", // not really correct but this was used before.
|
||||
};
|
||||
|
||||
gameinfo_t HexenDKGameInfo =
|
||||
|
@ -122,7 +123,8 @@ gameinfo_t HexenDKGameInfo =
|
|||
GAME_Hexen,
|
||||
150,
|
||||
"F_SKY",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/heretic.txt", // not really correct but this was used before.
|
||||
};
|
||||
|
||||
gameinfo_t HereticGameInfo =
|
||||
|
@ -150,7 +152,8 @@ gameinfo_t HereticGameInfo =
|
|||
GAME_Heretic,
|
||||
150,
|
||||
"F_SKY1",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/heretic.txt",
|
||||
};
|
||||
|
||||
gameinfo_t HereticSWGameInfo =
|
||||
|
@ -178,7 +181,8 @@ gameinfo_t HereticSWGameInfo =
|
|||
GAME_Heretic,
|
||||
150,
|
||||
"F_SKY1",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/heretic.txt",
|
||||
};
|
||||
|
||||
gameinfo_t SharewareGameInfo =
|
||||
|
@ -206,7 +210,8 @@ gameinfo_t SharewareGameInfo =
|
|||
GAME_Doom,
|
||||
100,
|
||||
"F_SKY1",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/doom.txt",
|
||||
};
|
||||
|
||||
gameinfo_t RegisteredGameInfo =
|
||||
|
@ -234,7 +239,8 @@ gameinfo_t RegisteredGameInfo =
|
|||
GAME_Doom,
|
||||
100,
|
||||
"F_SKY1",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/doom.txt",
|
||||
};
|
||||
|
||||
gameinfo_t RetailGameInfo =
|
||||
|
@ -262,7 +268,8 @@ gameinfo_t RetailGameInfo =
|
|||
GAME_Doom,
|
||||
100,
|
||||
"F_SKY1",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/doom.txt",
|
||||
};
|
||||
|
||||
gameinfo_t CommercialGameInfo =
|
||||
|
@ -290,7 +297,8 @@ gameinfo_t CommercialGameInfo =
|
|||
GAME_Doom,
|
||||
100,
|
||||
"F_SKY1",
|
||||
24*FRACUNIT
|
||||
24*FRACUNIT,
|
||||
"xlat/doom.txt",
|
||||
};
|
||||
|
||||
gameinfo_t StrifeGameInfo =
|
||||
|
@ -318,7 +326,8 @@ gameinfo_t StrifeGameInfo =
|
|||
GAME_Strife,
|
||||
150,
|
||||
"F_SKY001",
|
||||
16*FRACUNIT
|
||||
16*FRACUNIT,
|
||||
"xlat/strife.txt",
|
||||
};
|
||||
|
||||
gameinfo_t StrifeTeaserGameInfo =
|
||||
|
@ -346,7 +355,8 @@ gameinfo_t StrifeTeaserGameInfo =
|
|||
GAME_Strife,
|
||||
150,
|
||||
"F_SKY001",
|
||||
16*FRACUNIT
|
||||
16*FRACUNIT,
|
||||
"xlat/strife.txt",
|
||||
};
|
||||
|
||||
gameinfo_t StrifeTeaser2GameInfo =
|
||||
|
@ -374,5 +384,6 @@ gameinfo_t StrifeTeaser2GameInfo =
|
|||
GAME_Strife,
|
||||
150,
|
||||
"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;
|
||||
char SkyFlatName[9];
|
||||
fixed_t StepHeight;
|
||||
const char *translator;
|
||||
} gameinfo_t;
|
||||
|
||||
extern gameinfo_t gameinfo;
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
extern void P_SpawnMapThing (mapthing2_t *mthing, int position);
|
||||
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_TranslateTeleportThings (void);
|
||||
extern int P_TranslateSectorSpecial (int);
|
||||
|
@ -3605,6 +3606,10 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
{
|
||||
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 ();
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "xlat_parser.h"
|
||||
#include "xlat.h"
|
||||
|
||||
static FString LastTranslator;
|
||||
TAutoGrowArray<FLineTrans> SimpleLineTranslations;
|
||||
FBoomTranslator Boomish[MAX_BOOMISH];
|
||||
int NumBoomish;
|
||||
|
@ -462,39 +463,26 @@ void ParseXlatLump(const char *lumpname, void *pParser, XlatParseContext *contex
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void ParseXlat(const char *lumpname)
|
||||
void P_LoadTranslator(const char *lumpname)
|
||||
{
|
||||
void *pParser = XlatParseAlloc(malloc);
|
||||
|
||||
XlatParseContext context;
|
||||
|
||||
ParseXlatLump(lumpname, pParser, &context);
|
||||
XlatToken tok;
|
||||
tok.val=0;
|
||||
XlatParse(pParser, 0, tok, &context);
|
||||
XlatParseFree(pParser, free);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
AT_GAME_SET(Translators)
|
||||
{
|
||||
if (gameinfo.gametype == GAME_Doom)
|
||||
// Only read the lump if it differs from the previous one.
|
||||
if (LastTranslator.CompareNoCase(lumpname))
|
||||
{
|
||||
ParseXlat("xlat/doom.txt");
|
||||
}
|
||||
else if (gameinfo.gametype == GAME_Strife)
|
||||
{
|
||||
ParseXlat("xlat/strife.txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
ParseXlat("xlat/heretic.txt");
|
||||
// Clear the old data before parsing the lump.
|
||||
SimpleLineTranslations.Clear();
|
||||
NumBoomish = 0;
|
||||
SectorTranslations.Clear();
|
||||
SectorMasks.Clear();
|
||||
|
||||
void *pParser = XlatParseAlloc(malloc);
|
||||
|
||||
XlatParseContext context;
|
||||
|
||||
ParseXlatLump(lumpname, pParser, &context);
|
||||
XlatToken tok;
|
||||
tok.val=0;
|
||||
XlatParse(pParser, 0, tok, &context);
|
||||
XlatParseFree(pParser, free);
|
||||
LastTranslator = lumpname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue