diff --git a/src/client/refresh/files/models.c b/src/client/refresh/files/models.c index 610fe2f2..ed07b477 100644 --- a/src/client/refresh/files/models.c +++ b/src/client/refresh/files/models.c @@ -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); } diff --git a/src/common/models.c b/src/common/models.c index f98c088f..348b588d 100644 --- a/src/common/models.c +++ b/src/common/models.c @@ -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); diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 0385ecf0..2a190b78 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -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)