mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Fix sprite[] access with indices > MAXSPRITES in Polymer model drawing code.
Internally, updateanimation() now takes a third parameter 'lpal'. git-svn-id: https://svn.eduke32.com/eduke32@2277 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
775eff0344
commit
d95511ed1d
3 changed files with 8 additions and 9 deletions
|
@ -204,7 +204,7 @@ typedef struct
|
|||
|
||||
EXTERN mdmodel_t **models;
|
||||
|
||||
void updateanimation(md2model_t *m, const spritetype *tspr);
|
||||
void updateanimation(md2model_t *m, const spritetype *tspr, uint8_t lpal);
|
||||
int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf);
|
||||
void mdinit(void);
|
||||
void freeallmodels(void);
|
||||
|
|
|
@ -919,12 +919,11 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
|||
}
|
||||
|
||||
//Note: even though it says md2model, it works for both md2model&md3model
|
||||
void updateanimation(md2model_t *m, const spritetype *tspr)
|
||||
void updateanimation(md2model_t *m, const spritetype *tspr, uint8_t lpal)
|
||||
{
|
||||
mdanim_t *anim;
|
||||
int32_t i, j, k;
|
||||
int32_t fps;
|
||||
char lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal;
|
||||
|
||||
if (m->numframes < 2)
|
||||
{
|
||||
|
@ -1905,14 +1904,14 @@ static int32_t md3draw(md3model_t *m, const spritetype *tspr)
|
|||
void *vbotemp;
|
||||
point3d *vertexhandle = NULL;
|
||||
uint16_t *indexhandle;
|
||||
char lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal;
|
||||
uint8_t lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal;
|
||||
|
||||
if (r_vbos && (m->vbos == NULL))
|
||||
mdloadvbos(m);
|
||||
|
||||
// if ((tspr->cstat&48) == 32) return 0;
|
||||
|
||||
updateanimation((md2model_t *)m,tspr);
|
||||
updateanimation((md2model_t *)m, tspr, lpal);
|
||||
|
||||
//create current&next frame's vertex list from whole list
|
||||
|
||||
|
|
|
@ -3896,7 +3896,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
|||
mdskinmap_t* sk;
|
||||
float *v0, *v1;
|
||||
md3surf_t *s;
|
||||
char lpal, targetpal, usinghighpal, foundpalskin;
|
||||
char targetpal, usinghighpal, foundpalskin;
|
||||
float spos2[3], spos[3], tspos[3], lpos[3], tlpos[3], vec[3], mat[4][4];
|
||||
float ang;
|
||||
float scale;
|
||||
|
@ -3909,10 +3909,10 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
|||
char modellightcount;
|
||||
uint8_t curpriority;
|
||||
|
||||
m = (md3model_t*)models[tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].modelid];
|
||||
updateanimation((md2model_t *)m,tspr);
|
||||
uint8_t lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal;
|
||||
|
||||
lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal;
|
||||
m = (md3model_t*)models[tile2model[Ptile2tile(tspr->picnum,lpal)].modelid];
|
||||
updateanimation((md2model_t *)m,tspr,lpal);
|
||||
|
||||
if ((pr_vbos > 1) && (m->indices == NULL))
|
||||
polymer_loadmodelvbos(m);
|
||||
|
|
Loading…
Reference in a new issue