mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-31 23:41:25 +00:00
models: ignore MDA tag before load
This commit is contained in:
parent
4981c8b972
commit
3f4efa05a1
8 changed files with 78 additions and 11 deletions
|
@ -150,6 +150,9 @@ Goals:
|
|||
* [x] MDR model format from Star Trek: Voyager – Elite Force,
|
||||
* [x] MDA entity format from Anachronox,
|
||||
* [ ] CTC entity format from Anachronox,
|
||||
* [ ] ATD texture format from Anachronox,
|
||||
* [ ] MDA model skin selection by tag,
|
||||
* [ ] SDEF/MDA dynamicaly allocate list of skins,
|
||||
* [ ] Support material load textures/textureinfo.dat from Anachronox,
|
||||
* [ ] Support textures/*/*.mat load from ReRelease,
|
||||
* [ ] Support textures/*/*_glow.png load from ReRelease,
|
||||
|
|
|
@ -3181,7 +3181,7 @@ Mod_LoadMinMaxUpdate(const char *mod_name, vec3_t mins, vec3_t maxs, void *extra
|
|||
|
||||
/*
|
||||
=================
|
||||
Mod_LoadModel
|
||||
Mod_LoadModelFile
|
||||
=================
|
||||
*/
|
||||
static void *
|
||||
|
|
|
@ -397,9 +397,10 @@ Mod_ReadFile(const char *path, void **buffer)
|
|||
static model_t *
|
||||
Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||
{
|
||||
char filename[256] = {0}, *tag;
|
||||
int i, modfilelen;
|
||||
model_t *mod;
|
||||
void *buf;
|
||||
int i, modfilelen;
|
||||
|
||||
if (!name[0])
|
||||
{
|
||||
|
@ -455,8 +456,18 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
|||
|
||||
strcpy(mod->name, name);
|
||||
|
||||
/* Anachronox has tags in model path*/
|
||||
strncpy(filename, name, sizeof(filename) - 1);
|
||||
tag = strstr(filename, ".mda!");
|
||||
if (tag)
|
||||
{
|
||||
tag += 4; /* strlen(.mda) */
|
||||
*tag = 0;
|
||||
tag ++;
|
||||
}
|
||||
|
||||
/* load the file */
|
||||
modfilelen = ri.Mod_LoadFile(mod->name, &buf);
|
||||
modfilelen = ri.Mod_LoadFile(filename, &buf);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
|
|
|
@ -398,9 +398,10 @@ Mod_ReadFile(const char *path, void **buffer)
|
|||
static gl3model_t *
|
||||
Mod_ForName(const char *name, gl3model_t *parent_model, qboolean crash)
|
||||
{
|
||||
char filename[256] = {0}, *tag;
|
||||
int i, modfilelen;
|
||||
gl3model_t *mod;
|
||||
void *buf;
|
||||
int i, modfilelen;
|
||||
|
||||
if (!name[0])
|
||||
{
|
||||
|
@ -456,8 +457,18 @@ Mod_ForName(const char *name, gl3model_t *parent_model, qboolean crash)
|
|||
|
||||
strcpy(mod->name, name);
|
||||
|
||||
/* Anachronox has tags in model path*/
|
||||
strncpy(filename, name, sizeof(filename) - 1);
|
||||
tag = strstr(filename, ".mda!");
|
||||
if (tag)
|
||||
{
|
||||
tag += 4; /* strlen(.mda) */
|
||||
*tag = 0;
|
||||
tag ++;
|
||||
}
|
||||
|
||||
/* load the file */
|
||||
modfilelen = ri.Mod_LoadFile(mod->name, &buf);
|
||||
modfilelen = ri.Mod_LoadFile(filename, &buf);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
|
|
|
@ -398,9 +398,10 @@ Mod_ReadFile(const char *path, void **buffer)
|
|||
static gl4model_t *
|
||||
Mod_ForName(const char *name, gl4model_t *parent_model, qboolean crash)
|
||||
{
|
||||
char filename[256] = {0}, *tag;
|
||||
int i, modfilelen;
|
||||
gl4model_t *mod;
|
||||
void *buf;
|
||||
int i, modfilelen;
|
||||
|
||||
if (!name[0])
|
||||
{
|
||||
|
@ -456,8 +457,18 @@ Mod_ForName(const char *name, gl4model_t *parent_model, qboolean crash)
|
|||
|
||||
strcpy(mod->name, name);
|
||||
|
||||
/* Anachronox has tags in model path*/
|
||||
strncpy(filename, name, sizeof(filename) - 1);
|
||||
tag = strstr(filename, ".mda!");
|
||||
if (tag)
|
||||
{
|
||||
tag += 4; /* strlen(.mda) */
|
||||
*tag = 0;
|
||||
tag ++;
|
||||
}
|
||||
|
||||
/* load the file */
|
||||
modfilelen = ri.Mod_LoadFile(mod->name, &buf);
|
||||
modfilelen = ri.Mod_LoadFile(filename, &buf);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
|
|
|
@ -405,9 +405,10 @@ Mod_ReadFile(const char *path, void **buffer)
|
|||
static model_t *
|
||||
Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||
{
|
||||
char filename[256] = {0}, *tag;
|
||||
int i, modfilelen;
|
||||
model_t *mod;
|
||||
void *buf;
|
||||
int i, modfilelen;
|
||||
|
||||
if (!name[0])
|
||||
{
|
||||
|
@ -463,8 +464,18 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
|||
|
||||
strcpy(mod->name, name);
|
||||
|
||||
/* Anachronox has tags in model path*/
|
||||
strncpy(filename, name, sizeof(filename) - 1);
|
||||
tag = strstr(filename, ".mda!");
|
||||
if (tag)
|
||||
{
|
||||
tag += 4; /* strlen(.mda) */
|
||||
*tag = 0;
|
||||
tag ++;
|
||||
}
|
||||
|
||||
/* load the file */
|
||||
modfilelen = ri.Mod_LoadFile(mod->name, &buf);
|
||||
modfilelen = ri.Mod_LoadFile(filename, &buf);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
|
|
|
@ -372,9 +372,10 @@ Mod_ReadFile(const char *path, void **buffer)
|
|||
static model_t *
|
||||
Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||
{
|
||||
char filename[256] = {0}, *tag;
|
||||
int i, modfilelen;
|
||||
model_t *mod;
|
||||
void *buf;
|
||||
int i, modfilelen;
|
||||
|
||||
if (!name[0])
|
||||
{
|
||||
|
@ -430,8 +431,18 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
|||
|
||||
strcpy(mod->name, name);
|
||||
|
||||
/* Anachronox has tags in model path*/
|
||||
strncpy(filename, name, sizeof(filename) - 1);
|
||||
tag = strstr(filename, ".mda!");
|
||||
if (tag)
|
||||
{
|
||||
tag += 4; /* strlen(.mda) */
|
||||
*tag = 0;
|
||||
tag ++;
|
||||
}
|
||||
|
||||
/* load the file */
|
||||
modfilelen = ri.Mod_LoadFile(mod->name, &buf);
|
||||
modfilelen = ri.Mod_LoadFile(filename, &buf);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
|
|
|
@ -2164,6 +2164,11 @@ DynamicSpawnInit(void)
|
|||
* max attenuation
|
||||
*/
|
||||
|
||||
|
||||
/* Fix path */
|
||||
Q_replacebackslash(dynamicentities[curr_pos].model_path);
|
||||
|
||||
/* go to next row */
|
||||
curr_pos ++;
|
||||
}
|
||||
|
||||
|
@ -2231,6 +2236,10 @@ DynamicSpawnInit(void)
|
|||
/* Additional field for cover for color from QUAKED */
|
||||
line = DynamicFloatParse(line, dynamicentities[curr_pos].color, 3, '|');
|
||||
|
||||
/* Fix path */
|
||||
Q_replacebackslash(dynamicentities[curr_pos].model_path);
|
||||
|
||||
/* go to next row */
|
||||
curr_pos ++;
|
||||
}
|
||||
curr += linesize;
|
||||
|
|
Loading…
Reference in a new issue