mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-21 20:21:09 +00:00
models: check mda before md2 on load
This commit is contained in:
parent
6ba618fc42
commit
105b019130
3 changed files with 38 additions and 17 deletions
|
@ -2894,6 +2894,17 @@ Mod_LoadModel_MDA_Text(const char *mod_name, char *curr_buff,
|
|||
{
|
||||
void *extradata, *base;
|
||||
int base_size;
|
||||
char *curr;
|
||||
|
||||
curr = base_model;
|
||||
while (*curr)
|
||||
{
|
||||
if (*curr == '\\')
|
||||
{
|
||||
*curr = '/';
|
||||
}
|
||||
curr++;
|
||||
}
|
||||
|
||||
base_size = read_file(base_model, (void **)&base);
|
||||
if (base_size <= 0)
|
||||
|
@ -3250,12 +3261,13 @@ Mod_ReLoadSkins(struct image_s **skins, findimage_t find_image, loadimage_t load
|
|||
else if (type == mod_alias)
|
||||
{
|
||||
dmdx_t *pheader;
|
||||
int i;
|
||||
|
||||
pheader = (dmdx_t *)extradata;
|
||||
if (pheader->ofs_imgbit && load_image)
|
||||
{
|
||||
byte* images = (byte *)pheader + pheader->ofs_imgbit;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pheader->num_skins; i++)
|
||||
{
|
||||
skins[i] = load_image(
|
||||
|
@ -3269,7 +3281,9 @@ Mod_ReLoadSkins(struct image_s **skins, findimage_t find_image, loadimage_t load
|
|||
}
|
||||
else
|
||||
{
|
||||
for (i=0; i < pheader->num_skins; i++)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pheader->num_skins; i++)
|
||||
{
|
||||
skins[i] = find_image((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, it_skin);
|
||||
}
|
||||
|
|
|
@ -287,16 +287,6 @@ Mod_LoadFileWithoutExt(const char *namewe, void **buffer, const char* ext)
|
|||
return filesize;
|
||||
}
|
||||
|
||||
/* Check Quake 2 model */
|
||||
Q_strlcpy(newname + tlen, ".md2", sizeof(newname));
|
||||
filesize = FS_LoadFile(newname, buffer);
|
||||
if (filesize > 0)
|
||||
{
|
||||
Com_DPrintf("%s: %s loaded as md2 (Quake 2/Anachronox)\n",
|
||||
__func__, namewe);
|
||||
return filesize;
|
||||
}
|
||||
|
||||
/* Check Anachronox model definition */
|
||||
Q_strlcpy(newname + tlen, ".mda", sizeof(newname));
|
||||
filesize = FS_LoadFile(newname, buffer);
|
||||
|
@ -307,6 +297,16 @@ Mod_LoadFileWithoutExt(const char *namewe, void **buffer, const char* ext)
|
|||
return filesize;
|
||||
}
|
||||
|
||||
/* Check Quake 2 model */
|
||||
Q_strlcpy(newname + tlen, ".md2", sizeof(newname));
|
||||
filesize = FS_LoadFile(newname, buffer);
|
||||
if (filesize > 0)
|
||||
{
|
||||
Com_DPrintf("%s: %s loaded as md2 (Quake 2/Anachronox)\n",
|
||||
__func__, namewe);
|
||||
return filesize;
|
||||
}
|
||||
|
||||
/* Check Kingpin model */
|
||||
Q_strlcpy(newname + tlen, ".mdx", sizeof(newname));
|
||||
filesize = FS_LoadFile(newname, buffer);
|
||||
|
|
|
@ -214,12 +214,15 @@ ED_CallSpawn(edict_t *ent)
|
|||
}
|
||||
}
|
||||
|
||||
i = DynamicSpawnSearch(ent->classname);
|
||||
if (i >= 0)
|
||||
if (dynamicentities && ndynamicentities)
|
||||
{
|
||||
DynamicSpawn(ent, &dynamicentities[i]);
|
||||
i = DynamicSpawnSearch(ent->classname);
|
||||
if (i >= 0)
|
||||
{
|
||||
DynamicSpawn(ent, &dynamicentities[i]);
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gi.dprintf("%s doesn't have a spawn function\n", ent->classname);
|
||||
|
@ -1715,11 +1718,12 @@ DynamicIntParse(char *line, int *field)
|
|||
static char *
|
||||
DynamicFloatParse(char *line, float *field, int size)
|
||||
{
|
||||
char *next_section;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
char *next_section;
|
||||
|
||||
next_section = strchr(line, '|');
|
||||
if (next_section)
|
||||
{
|
||||
|
@ -1750,6 +1754,9 @@ DynamicSpawnInit(void)
|
|||
buf = NULL;
|
||||
len = 0;
|
||||
|
||||
dynamicentities = NULL;
|
||||
ndynamicentities = 0;
|
||||
|
||||
/* load the file */
|
||||
len = gi.FS_LoadFile("models/entity.dat", (void **)&raw);
|
||||
if (len > 1)
|
||||
|
|
Loading…
Reference in a new issue