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
/*.map
/*.mhk
/platform/Windows/*.map
*.pdb
.vs/
@ -40,7 +41,10 @@ texturecache
/*.grp
/*.rts
/*.art
/*.ar_
/*.con
/*.SMK
/*.WAV
/platform/Windows/*.con
*.memmap
*.sdf

View file

@ -503,6 +503,32 @@ void EndLevel(void)
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];
int gHealthTemp[kMaxPlayers];
@ -575,6 +601,8 @@ void StartLevel(GAMEOPTIONS *gameOptions)
gQuitGame = true;
return;
}
char levelName[BMAX_PATH];
G_LoadMapHack(levelName, gameOptions->zLevelName);
wsrand(gameOptions->uMapCRC);
gKillMgr.Clear();
gSecretMgr.Clear();