mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 12:10:53 +00:00
- fixed maphack loader.
The duplicate 'currentSprite' variable prevented it from doing anything. Also cleaned up the interface a bit to avoid using a global variable for parameter passing. Fixes #279
This commit is contained in:
parent
9104fba3ec
commit
ad8654ed06
4 changed files with 11 additions and 10 deletions
|
@ -173,8 +173,6 @@ struct usermaphack_t
|
||||||
uint8_t md4[16]{};
|
uint8_t md4[16]{};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern usermaphack_t g_loadedMapHack;
|
|
||||||
|
|
||||||
EXTERN spriteext_t *spriteext;
|
EXTERN spriteext_t *spriteext;
|
||||||
EXTERN spritesmooth_t *spritesmooth;
|
EXTERN spritesmooth_t *spritesmooth;
|
||||||
|
|
||||||
|
@ -425,7 +423,7 @@ void initspritelists(void);
|
||||||
|
|
||||||
void engineLoadBoard(const char *filename, int flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
|
void engineLoadBoard(const char *filename, int flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
|
||||||
void loadMapBackup(const char* filename);
|
void loadMapBackup(const char* filename);
|
||||||
void G_LoadMapHack(const char* filename);
|
void G_LoadMapHack(const char* filename, const unsigned char*);
|
||||||
|
|
||||||
int32_t qloadkvx(int32_t voxindex, const char *filename);
|
int32_t qloadkvx(int32_t voxindex, const char *filename);
|
||||||
void vox_undefine(int32_t const);
|
void vox_undefine(int32_t const);
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
|
|
||||||
usermaphack_t g_loadedMapHack; // used only for the MD4 part
|
|
||||||
static TArray<usermaphack_t> usermaphacks;
|
static TArray<usermaphack_t> usermaphacks;
|
||||||
|
|
||||||
void AddUserMapHack(usermaphack_t& mhk)
|
void AddUserMapHack(usermaphack_t& mhk)
|
||||||
|
@ -59,7 +58,6 @@ static int32_t LoadMapHack(const char *filename)
|
||||||
while (sc.GetString())
|
while (sc.GetString())
|
||||||
{
|
{
|
||||||
FString token = sc.String;
|
FString token = sc.String;
|
||||||
int currentsprite = -1;
|
|
||||||
auto validateSprite = [&]()
|
auto validateSprite = [&]()
|
||||||
{
|
{
|
||||||
if (currentsprite < 0)
|
if (currentsprite < 0)
|
||||||
|
@ -201,7 +199,7 @@ static int32_t LoadMapHack(const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_LoadMapHack(const char* filename)
|
void G_LoadMapHack(const char* filename, const unsigned char* md4)
|
||||||
{
|
{
|
||||||
FString hack = StripExtension(filename) + ".mhk";
|
FString hack = StripExtension(filename) + ".mhk";
|
||||||
|
|
||||||
|
@ -209,7 +207,7 @@ void G_LoadMapHack(const char* filename)
|
||||||
{
|
{
|
||||||
for (auto& mhk : usermaphacks)
|
for (auto& mhk : usermaphacks)
|
||||||
{
|
{
|
||||||
if (!memcmp(g_loadedMapHack.md4, mhk.md4, 16))
|
if (!memcmp(md4, mhk.md4, 16))
|
||||||
{
|
{
|
||||||
LoadMapHack(mhk.mhkfile);
|
LoadMapHack(mhk.mhkfile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,7 +439,11 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
||||||
//Must be last.
|
//Must be last.
|
||||||
updatesector(pos->x, pos->y, cursectnum);
|
updatesector(pos->x, pos->y, cursectnum);
|
||||||
guniqhudid = 0;
|
guniqhudid = 0;
|
||||||
G_LoadMapHack(filename);
|
fr.Seek(0, FileReader::SeekSet);
|
||||||
|
auto buffer = fr.Read();
|
||||||
|
unsigned char md4[16];
|
||||||
|
md4once(buffer.Data(), buffer.Size(), md4);
|
||||||
|
G_LoadMapHack(filename, md4);
|
||||||
|
|
||||||
memcpy(wallbackup, wall, sizeof(wallbackup));
|
memcpy(wallbackup, wall, sizeof(wallbackup));
|
||||||
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
||||||
|
|
|
@ -979,8 +979,9 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
|
||||||
|
|
||||||
fr.Seek(0, FileReader::SeekSet);
|
fr.Seek(0, FileReader::SeekSet);
|
||||||
auto buffer = fr.Read();
|
auto buffer = fr.Read();
|
||||||
md4once(buffer.Data(), buffer.Size(), g_loadedMapHack.md4);
|
unsigned char md4[16];
|
||||||
G_LoadMapHack(mapname);
|
md4once(buffer.Data(), buffer.Size(), md4);
|
||||||
|
G_LoadMapHack(mapname, md4);
|
||||||
|
|
||||||
if (CalcCRC32(buffer.Data(), buffer.Size() -4) != nCRC)
|
if (CalcCRC32(buffer.Data(), buffer.Size() -4) != nCRC)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue