Expose lightmap defaults in mapinfo's gameinfo

This commit is contained in:
RaveYard 2024-05-06 15:04:25 +02:00
commit 9564de3f16
4 changed files with 32 additions and 5 deletions

View file

@ -77,6 +77,10 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, defaultdropstyle)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, normforwardmove)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, normsidemove)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mHideParTimes)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, forceLightmaps)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, defaultSunColor)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, defaultSunDirection)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, defaultLightmapSampleDistance)
const char *GameNames[17] =
{
@ -207,6 +211,19 @@ const char* GameInfoBorders[] =
gameinfo.key[1] = sc.Float; \
}
#define GAMEINFOKEY_THREEDOUBLES(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
sc.MustGetValue(true); \
gameinfo.key[0] = sc.Float; \
sc.MustGetToken(','); \
sc.MustGetValue(true); \
gameinfo.key[1] = sc.Float; \
sc.MustGetToken(','); \
sc.MustGetValue(true); \
gameinfo.key[2] = sc.Float; \
}
#define GAMEINFOKEY_COLOR(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
@ -460,7 +477,9 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_TWODOUBLES(normsidemove, "normsidemove")
GAMEINFOKEY_BOOL(nomergepickupmsg, "nomergepickupmsg")
GAMEINFOKEY_BOOL(mHideParTimes, "hidepartimes")
GAMEINFOKEY_BOOL(forceLightmaps, "forcelightmaps")
GAMEINFOKEY_THREEDOUBLES(defaultSunColor, "defaultsuncolor")
GAMEINFOKEY_THREEDOUBLES(defaultSunDirection, "defaultSunDirection")
else
{
DPrintf(DMSG_ERROR, "Unknown GAMEINFO key \"%s\" found in %s:%i\n", nextKey.GetChars(), sc.ScriptName.GetChars(), sc.Line);

View file

@ -215,6 +215,10 @@ struct gameinfo_t
bool nomergepickupmsg;
bool mHideParTimes;
CutsceneDef IntroScene;
bool forceLightmaps = false;
FVector3 defaultSunColor = FVector3(1.f, 1.f, 1.f);
FVector3 defaultSunDirection = FVector3(0.45f, 0.3f, 0.9f);
int defaultLightmapSampleDistance = 16;
const char *GetFinalePage(unsigned int num) const;
};

View file

@ -3205,10 +3205,10 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position)
const int *oldvertextable = nullptr;
// Reset defaults for lightmapping
Level->SunColor = FVector3(1.f, 1.f, 1.f);
Level->SunDirection = FVector3(0.45f, 0.3f, 0.9f);
Level->LightmapSampleDistance = 16;
Level->lightmaps = false;
Level->SunColor = gameinfo.defaultSunColor;
Level->SunDirection = gameinfo.defaultSunDirection;
Level->LightmapSampleDistance = gameinfo.defaultLightmapSampleDistance;
Level->lightmaps = gameinfo.forceLightmaps;
// note: most of this ordering is important
ForceNodeBuild = gennodes;

View file

@ -107,6 +107,10 @@ extend struct GameInfoStruct
native double normforwardmove[2];
native double normsidemove[2];
native bool mHideParTimes;
native bool forceLightmaps;
native FVector3 defaultSunColor;
native FVector3 defaultSunDirection;
native int defaultLightmapSampleDistance;
}
extend class Object