Maphack support (#186)

# Conflicts:
#	.gitignore
This commit is contained in:
CommonLoon102 2019-09-22 07:55:57 +00:00 committed by Christoph Oelckers
parent 67472623fe
commit 3aa0ce5c3a
2 changed files with 32 additions and 0 deletions

4
.gitignore vendored
View file

@ -31,6 +31,7 @@ texturecache
*.manifest *.manifest
/*.map /*.map
/*.mhk
/platform/Windows/*.map /platform/Windows/*.map
*.pdb *.pdb
.vs/ .vs/
@ -40,7 +41,10 @@ texturecache
/*.grp /*.grp
/*.rts /*.rts
/*.art /*.art
/*.ar_
/*.con /*.con
/*.SMK
/*.WAV
/platform/Windows/*.con /platform/Windows/*.con
*.memmap *.memmap
*.sdf *.sdf

View file

@ -503,6 +503,32 @@ void EndLevel(void)
seqKillAll(); seqKillAll();
} }
int G_TryMapHack(const char* mhkfile)
{
int const failure = engineLoadMHK(mhkfile);
if (!failure)
initprintf("Loaded map hack file \"%s\"\n", mhkfile);
return failure;
}
void G_LoadMapHack(char* outbuf, const char* filename)
{
if (filename != NULL)
Bstrcpy(outbuf, filename);
append_ext_UNSAFE(outbuf, ".mhk");
if (G_TryMapHack(outbuf) && usermaphacks != NULL)
{
auto pMapInfo = (usermaphack_t*)bsearch(&g_loadedMapHack, usermaphacks, num_usermaphacks,
sizeof(usermaphack_t), compare_usermaphacks);
if (pMapInfo)
G_TryMapHack(pMapInfo->mhkfile);
}
}
PLAYER gPlayerTemp[kMaxPlayers]; PLAYER gPlayerTemp[kMaxPlayers];
int gHealthTemp[kMaxPlayers]; int gHealthTemp[kMaxPlayers];
@ -575,6 +601,8 @@ void StartLevel(GAMEOPTIONS *gameOptions)
gQuitGame = true; gQuitGame = true;
return; return;
} }
char levelName[BMAX_PATH];
G_LoadMapHack(levelName, gameOptions->zLevelName);
wsrand(gameOptions->uMapCRC); wsrand(gameOptions->uMapCRC);
gKillMgr.Clear(); gKillMgr.Clear();
gSecretMgr.Clear(); gSecretMgr.Clear();