mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 20:41:46 +00:00
Merge branch 'master' of http://git.magicalgirl.moe/STJr/SRB2Internal.git into shield-actions
This commit is contained in:
commit
b5a6bfe046
5 changed files with 25 additions and 7 deletions
|
|
@ -308,6 +308,23 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
|
|
||||||
model->header.numSkins = 1;
|
model->header.numSkins = 1;
|
||||||
|
|
||||||
|
#define MD2LIMITCHECK(field, max, msgname) \
|
||||||
|
if (field > max) \
|
||||||
|
{ \
|
||||||
|
CONS_Alert(CONS_ERROR, "md2_readModel: %s has too many " msgname " (# found: %d, maximum: %d)\n", filename, field, max); \
|
||||||
|
md2_freeModel (model); \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment if these are actually needed
|
||||||
|
// MD2LIMITCHECK(model->header.numSkins, MD2_MAX_SKINS, "skins")
|
||||||
|
// MD2LIMITCHECK(model->header.numTexCoords, MD2_MAX_TEXCOORDS, "texture coordinates")
|
||||||
|
MD2LIMITCHECK(model->header.numTriangles, MD2_MAX_TRIANGLES, "triangles")
|
||||||
|
MD2LIMITCHECK(model->header.numFrames, MD2_MAX_FRAMES, "frames")
|
||||||
|
MD2LIMITCHECK(model->header.numVertices, MD2_MAX_VERTICES, "vertices")
|
||||||
|
|
||||||
|
#undef MD2LIMITCHECK
|
||||||
|
|
||||||
// read skins
|
// read skins
|
||||||
fseek(file, model->header.offsetSkins, SEEK_SET);
|
fseek(file, model->header.offsetSkins, SEEK_SET);
|
||||||
if (model->header.numSkins > 0)
|
if (model->header.numSkins > 0)
|
||||||
|
|
@ -319,8 +336,6 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// read texture coordinates
|
// read texture coordinates
|
||||||
|
|
@ -334,8 +349,6 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// read triangles
|
// read triangles
|
||||||
|
|
@ -769,6 +782,7 @@ void HWR_InitMD2(void)
|
||||||
md2_playermodels[s].grpatch = NULL;
|
md2_playermodels[s].grpatch = NULL;
|
||||||
md2_playermodels[s].skin = -1;
|
md2_playermodels[s].skin = -1;
|
||||||
md2_playermodels[s].notfound = true;
|
md2_playermodels[s].notfound = true;
|
||||||
|
md2_playermodels[s].error = false;
|
||||||
}
|
}
|
||||||
for (i = 0; i < NUMSPRITES; i++)
|
for (i = 0; i < NUMSPRITES; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -777,6 +791,7 @@ void HWR_InitMD2(void)
|
||||||
md2_models[i].grpatch = NULL;
|
md2_models[i].grpatch = NULL;
|
||||||
md2_models[i].skin = -1;
|
md2_models[i].skin = -1;
|
||||||
md2_models[i].notfound = true;
|
md2_models[i].notfound = true;
|
||||||
|
md2_models[s].error = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the md2.dat file
|
// read the md2.dat file
|
||||||
|
|
@ -1378,6 +1393,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
else
|
else
|
||||||
md2 = &md2_models[spr->mobj->sprite];
|
md2 = &md2_models[spr->mobj->sprite];
|
||||||
|
|
||||||
|
if (md2->error)
|
||||||
|
return; // we already failed loading this before :(
|
||||||
if (!md2->model)
|
if (!md2->model)
|
||||||
{
|
{
|
||||||
//CONS_Debug(DBG_RENDER, "Loading MD2... (%s)", sprnames[spr->mobj->sprite]);
|
//CONS_Debug(DBG_RENDER, "Loading MD2... (%s)", sprnames[spr->mobj->sprite]);
|
||||||
|
|
@ -1391,6 +1408,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//CONS_Debug(DBG_RENDER, " FAILED\n");
|
//CONS_Debug(DBG_RENDER, " FAILED\n");
|
||||||
|
md2->error = true; // prevent endless fail
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ typedef struct
|
||||||
void *blendgrpatch;
|
void *blendgrpatch;
|
||||||
boolean notfound;
|
boolean notfound;
|
||||||
INT32 skin;
|
INT32 skin;
|
||||||
|
boolean error;
|
||||||
} md2_t;
|
} md2_t;
|
||||||
|
|
||||||
extern md2_t md2_models[NUMSPRITES];
|
extern md2_t md2_models[NUMSPRITES];
|
||||||
|
|
|
||||||
|
|
@ -11006,4 +11006,3 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo
|
||||||
P_SetScale(newmobj, mobj->scale);
|
P_SetScale(newmobj, mobj->scale);
|
||||||
return newmobj;
|
return newmobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1349,7 +1349,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
if (sortscale < linkscale)
|
if (sortscale < linkscale)
|
||||||
dispoffset *= -1; // if it's physically behind, make sure it's ordered behind (if dispoffset > 0)
|
dispoffset *= -1; // if it's physically behind, make sure it's ordered behind (if dispoffset > 0)
|
||||||
|
|
||||||
sortscale = linkscale; // now make sure it's linked
|
sortscale = linkscale; // now make sure it's linked
|
||||||
}
|
}
|
||||||
|
|
||||||
// PORTAL SPRITE CLIPPING
|
// PORTAL SPRITE CLIPPING
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ static Mix_Chunk *ds2chunk(void *stream)
|
||||||
break;
|
break;
|
||||||
default: // convert arbitrary hz to 44100.
|
default: // convert arbitrary hz to 44100.
|
||||||
step = 0;
|
step = 0;
|
||||||
frac = ((UINT32)freq << FRACBITS) / 44100;
|
frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation.
|
||||||
while (i < samples)
|
while (i < samples)
|
||||||
{
|
{
|
||||||
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
|
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue