mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 05:30:48 +00:00
Add MD2_INDENT and MD2_VERSION so we can cleanly check that it's a valid MD2 from magic number/version
This commit is contained in:
parent
43cdcc94f9
commit
b00c680437
2 changed files with 7 additions and 2 deletions
|
@ -298,8 +298,8 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
// initialize model and read header
|
// initialize model and read header
|
||||||
|
|
||||||
if (fread(&model->header, sizeof (model->header), 1, file) != 1
|
if (fread(&model->header, sizeof (model->header), 1, file) != 1
|
||||||
|| model->header.magic !=
|
|| model->header.magic != MD2_IDENT
|
||||||
(INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I'))
|
|| model->header.version != MD2_VERSION)
|
||||||
{
|
{
|
||||||
fclose(file);
|
fclose(file);
|
||||||
free(model);
|
free(model);
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
|
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
|
|
||||||
|
// magic number "IDP2" or 844121161
|
||||||
|
#define MD2_IDENT (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I')
|
||||||
|
// model version
|
||||||
|
#define MD2_VERSION 8
|
||||||
|
|
||||||
#define MD2_MAX_TRIANGLES 8192
|
#define MD2_MAX_TRIANGLES 8192
|
||||||
#define MD2_MAX_VERTICES 4096
|
#define MD2_MAX_VERTICES 4096
|
||||||
#define MD2_MAX_TEXCOORDS 4096
|
#define MD2_MAX_TEXCOORDS 4096
|
||||||
|
|
Loading…
Reference in a new issue