mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Fix a bunch of noclip memory errors
git-svn-id: https://svn.eduke32.com/eduke32@918 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a9a1379278
commit
92d52d8071
5 changed files with 58 additions and 33 deletions
|
@ -593,6 +593,8 @@ int mdloadskin_trytexcache(char *fn, int len, int pal, char effect, texcachehead
|
|||
head->quality = B_LITTLE32(head->quality);
|
||||
|
||||
if (head->quality != r_downsize) goto failure;
|
||||
if ((head->flags & 4) && !glusetexcachecompression) goto failure;
|
||||
if (!(head->flags & 4) && glusetexcachecompression) goto failure;
|
||||
if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) goto failure;
|
||||
if (!glinfo.texnpot && (head->flags & 1)) goto failure;
|
||||
|
||||
|
@ -633,8 +635,6 @@ static int mdloadskin_cached(int fil, texcacheheader *head, int *doalloc, GLuint
|
|||
pict.ydim = B_LITTLE32(pict.ydim);
|
||||
pict.border = B_LITTLE32(pict.border);
|
||||
pict.depth = B_LITTLE32(pict.depth);
|
||||
pict.xdim >>= head->quality;
|
||||
pict.ydim >>= head->quality;
|
||||
|
||||
if (level == 0) { *xsiz = pict.xdim; *ysiz = pict.ydim; }
|
||||
|
||||
|
@ -849,9 +849,10 @@ int mdloadskin(md2model *m, int number, int pal, int surf)
|
|||
if (cachefil < 0)
|
||||
{
|
||||
// save off the compressed version
|
||||
cachead.xdim = osizx;
|
||||
cachead.ydim = osizy;
|
||||
cachead.quality = r_downsize;
|
||||
cachead.xdim = osizx>>cachead.quality;
|
||||
cachead.ydim = osizy>>cachead.quality;
|
||||
|
||||
i = 0;
|
||||
for (j=0;j<31;j++)
|
||||
{
|
||||
|
|
|
@ -1248,6 +1248,9 @@ int trytexcache(char *fn, int len, int dameth, char effect, texcacheheader *head
|
|||
head->flags = B_LITTLE32(head->flags);
|
||||
head->quality = B_LITTLE32(head->quality);
|
||||
|
||||
if ((head->flags & 4) && !glusetexcachecompression) goto failure;
|
||||
if (!(head->flags & 4) && glusetexcachecompression) goto failure;
|
||||
|
||||
if (head->quality != r_downsize) goto failure;
|
||||
if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) goto failure;
|
||||
if (!glinfo.texnpot && (head->flags & 1)) goto failure;
|
||||
|
@ -1705,9 +1708,9 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet
|
|||
if (cachefil < 0)
|
||||
{
|
||||
// save off the compressed version
|
||||
cachead.xdim = tsizx;
|
||||
cachead.ydim = tsizy;
|
||||
cachead.quality = r_downsize;
|
||||
cachead.xdim = tsizx>>cachead.quality;
|
||||
cachead.ydim = tsizy>>cachead.quality;
|
||||
x = 0;
|
||||
for (j=0;j<31;j++)
|
||||
{
|
||||
|
|
|
@ -3316,7 +3316,8 @@ void displayrest(int smoothratio)
|
|||
}
|
||||
|
||||
i = pp->cursectnum;
|
||||
|
||||
if (i > -1)
|
||||
{
|
||||
show2dsector[i>>3] |= (1<<(i&7));
|
||||
wal = &wall[sector[i].wallptr];
|
||||
for (j=sector[i].wallnum;j>0;j--,wal++)
|
||||
|
@ -3329,6 +3330,7 @@ void displayrest(int smoothratio)
|
|||
if (sector[i].ceilingz >= sector[i].floorz) continue;
|
||||
show2dsector[i>>3] |= (1<<(i&7));
|
||||
}
|
||||
}
|
||||
|
||||
if (ud.camerasprite == -1)
|
||||
{
|
||||
|
|
|
@ -2014,10 +2014,13 @@ void DoSpawn(player_struct *p)
|
|||
|
||||
void displaymasks(int snum)
|
||||
{
|
||||
int p = sector[g_player[snum].ps->cursectnum].floorpal;
|
||||
int p;
|
||||
|
||||
if (sprite[g_player[snum].ps->i].pal == 1)
|
||||
p = 1;
|
||||
else if (g_player[snum].ps->cursectnum > -1)
|
||||
p = sector[g_player[snum].ps->cursectnum].floorpal;
|
||||
else p = 0;
|
||||
|
||||
if (g_player[snum].ps->scuba_on)
|
||||
{
|
||||
|
@ -2167,6 +2170,7 @@ void displayweapon(int snum)
|
|||
pal = 1;
|
||||
else
|
||||
{
|
||||
if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
if (pal == 0)
|
||||
pal = p->palookup;
|
||||
|
@ -2215,6 +2219,7 @@ void displayweapon(int snum)
|
|||
pal = 1;
|
||||
else
|
||||
{
|
||||
if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
if (pal == 0)
|
||||
pal = p->palookup;
|
||||
|
@ -2238,8 +2243,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
weapon_xoffset += 8;
|
||||
gun_pos -= 10;
|
||||
|
@ -2267,7 +2273,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else pal = sector[p->cursectnum].floorpal;
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
weapon_xoffset -= sintable[(768+((*kb)<<7))&2047]>>11;
|
||||
gun_pos += sintable[(768+((*kb)<<7))&2047]>>11;
|
||||
|
@ -2294,8 +2302,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
|
||||
weapon_xoffset -= 8;
|
||||
|
@ -2379,8 +2388,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
if (*kb > 0)
|
||||
gun_pos -= sintable[(*kb)<<7]>>12;
|
||||
|
@ -2429,8 +2439,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
if ((*kb) < *aplWeaponTotalTime[PISTOL_WEAPON]+1)
|
||||
{
|
||||
|
@ -2484,8 +2495,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
if ((*kb))
|
||||
{
|
||||
|
@ -2520,8 +2532,9 @@ void displayweapon(int snum)
|
|||
static char remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0};
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
weapon_xoffset = -48;
|
||||
if ((*kb))
|
||||
|
@ -2540,8 +2553,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
if ((*kb) < (*aplWeaponTotalTime[DEVISTATOR_WEAPON]+1) && (*kb) > 0)
|
||||
{
|
||||
|
@ -2576,8 +2590,9 @@ void displayweapon(int snum)
|
|||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
|
||||
if ((*kb) < (aplWeaponTotalTime[p->curr_weapon][snum]+1) && (*kb) > 0)
|
||||
{
|
||||
|
@ -2604,9 +2619,11 @@ void displayweapon(int snum)
|
|||
{
|
||||
weapon_xoffset += 28;
|
||||
looking_arc += 18;
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
{
|
||||
if ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0)
|
||||
{
|
||||
|
@ -2647,8 +2664,9 @@ void displayweapon(int snum)
|
|||
looking_arc += 18;
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
else if (p->cursectnum > -1)
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
else pal = 0;
|
||||
if (((*kb) > 0) && ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum]))
|
||||
{
|
||||
if (sprite[p->i].pal != 1)
|
||||
|
@ -3155,7 +3173,7 @@ static int doincrements(player_struct *p)
|
|||
}
|
||||
}
|
||||
|
||||
if (p->scuba_on == 0 && sector[p->cursectnum].lotag == 2)
|
||||
if (p->cursectnum > -1 && p->scuba_on == 0 && sector[p->cursectnum].lotag == 2)
|
||||
{
|
||||
if (p->scuba_amount > 0)
|
||||
{
|
||||
|
@ -4368,7 +4386,7 @@ HORIZONLY:
|
|||
if (psectlotag == 1 || p->spritebridge == 1) i = (4L<<8);
|
||||
else i = (20L<<8);
|
||||
|
||||
if (sector[p->cursectnum].lotag == 2) k = 0;
|
||||
if (p->cursectnum > -1 && sector[p->cursectnum].lotag == 2) k = 0;
|
||||
else k = 1;
|
||||
|
||||
if (ud.clipping)
|
||||
|
@ -4422,7 +4440,7 @@ HORIZONLY:
|
|||
}
|
||||
}
|
||||
|
||||
if (truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
|
||||
if (p->cursectnum > -1 && truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
|
||||
if (!isspritemakingsound(pi,DUKE_ONWATER))
|
||||
spritesound(DUKE_ONWATER,pi);
|
||||
|
||||
|
|
|
@ -3188,6 +3188,7 @@ void checksectors(int snum)
|
|||
player_struct *p = g_player[snum].ps;
|
||||
short j,hitscanwall;
|
||||
|
||||
if (p->cursectnum > -1)
|
||||
switch (sector[p->cursectnum].lotag)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in a new issue