Skip to content

Commit

Permalink
Fixed: Model loading issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
danij committed Jun 8, 2009
1 parent 6e9388f commit 7ccccf2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
5 changes: 3 additions & 2 deletions doomsday/engine/portable/include/r_data.h
Expand Up @@ -316,8 +316,9 @@ doomtexturedef_t* R_GetDoomTextureDef(int num);

uint R_GetSkinNumForName(const char* path);
const skinname_t* R_GetSkinNameByIndex(uint id);
uint R_RegisterSkin(const char* skin, const char* modelfn, char* fullpath,
boolean isShinySkin, size_t fullpathlen);
uint R_RegisterSkin(char* fullpath, const char* skin,
const char* modelfn, boolean isShinySkin,
size_t len);
void R_DestroySkins(void); // Called at shutdown.

void R_InitAnimGroup(ded_group_t* def);
Expand Down
9 changes: 4 additions & 5 deletions doomsday/engine/portable/src/r_data.c
Expand Up @@ -1611,8 +1611,8 @@ void R_ExpandSkinName(char* expanded, const char* skin,
/**
* Registers a new skin name.
*/
uint R_RegisterSkin(const char* skin, const char* modelfn, char* fullpath,
boolean isShinySkin, size_t fullpathlen)
uint R_RegisterSkin(char* fullpath, const char* skin, const char* modelfn,
boolean isShinySkin, size_t len)
{
const char* formats[3] = { ".png", ".tga", ".pcx" };
filename_t buf, fn;
Expand All @@ -1636,9 +1636,8 @@ uint R_RegisterSkin(const char* skin, const char* modelfn, char* fullpath,
// Try PNG, TGA, PCX.
for(i = 0; i < 3 && idx == 0; ++i)
{
strncpy(ext, formats[i], FILENAME_T_MAXLEN);
R_ExpandSkinName(fullpath ? fullpath : buf, fn, modelfn,
fullpath? fullpathlen : FILENAME_T_MAXLEN);
strncpy(ext, formats[i], FILENAME_T_MAXLEN - (ext - fn));
R_ExpandSkinName(fullpath ? fullpath : buf, fn, modelfn, len);

idx = R_CreateSkinTex(fullpath ? fullpath : buf, isShinySkin);
}
Expand Down
19 changes: 7 additions & 12 deletions doomsday/engine/portable/src/r_model.c
Expand Up @@ -422,18 +422,13 @@ static void R_LoadModelDMD(DFILE *file, model_t *mo)

static void R_RegisterModelSkin(model_t* mdl, int index)
{
filename_t buf;

memset(buf, 0, sizeof(buf));
memcpy(buf, mdl->skins[index].name, 64);

mdl->skins[index].id = R_RegisterSkin(buf, mdl->fileName,
mdl->skins[index].name, false, FILENAME_T_MAXLEN);
mdl->skins[index].id = R_RegisterSkin(NULL, mdl->skins[index].name,
mdl->fileName, false, FILENAME_T_MAXLEN);

if(mdl->skins[index].id < 0)
{
// Not found!
VERBOSE(Con_Printf(" %s (#%i) not found.\n", buf, index));
{ // Not found!
VERBOSE(Con_Printf(" %s (#%i) not found.\n",
mdl->skins[index].name, index));
}
}

Expand Down Expand Up @@ -1016,8 +1011,8 @@ static void setupModel(ded_model_t *def)
sub->offset[k] = subdef->offset[k];

sub->alpha = (byte) (subdef->alpha * 255);
sub->shinySkin = R_RegisterSkin(subdef->shinySkin, subdef->filename.path,
NULL, true, DED_PATH_LEN);
sub->shinySkin = R_RegisterSkin(subdef->filename.path,
subdef->shinySkin, NULL, true, DED_PATH_LEN);

// Should we allow texture compression with this model?
if(sub->flags & MFF_NO_TEXCOMP)
Expand Down

0 comments on commit 7ccccf2

Please sign in to comment.