mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Fixes for dividing by the result of ldist without checking for 0 first
git-svn-id: https://svn.eduke32.com/eduke32@959 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
79e2616dfc
commit
cf4e3930d5
2 changed files with 27 additions and 11 deletions
|
@ -434,13 +434,13 @@ static int osdcmd_setstatusbarscale(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
if (parm->numparms == 0)
|
if (parm->numparms == 0)
|
||||||
{
|
{
|
||||||
OSD_Printf("\"cl_statusbarscale\" is \"%d\"\n", ud.statusbarscale);
|
OSD_Printf("\"hud_scale\" is \"%d\"\n", ud.statusbarscale);
|
||||||
return OSDCMD_SHOWHELP;
|
return OSDCMD_SHOWHELP;
|
||||||
}
|
}
|
||||||
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||||
|
|
||||||
setstatusbarscale(Batol(parm->parms[0]));
|
setstatusbarscale(Batol(parm->parms[0]));
|
||||||
OSD_Printf("cl_statusbarscale %d\n", ud.statusbarscale);
|
OSD_Printf("hud_scale %d\n", ud.statusbarscale);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,7 +1319,7 @@ static int osdcmd_setcrosshairscale(const osdfuncparm_t *parm)
|
||||||
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||||
|
|
||||||
ud.crosshairscale = min(100,max(10,Batol(parm->parms[0])));
|
ud.crosshairscale = min(100,max(10,Batol(parm->parms[0])));
|
||||||
OSD_Printf("statusbarscale %d\n", ud.crosshairscale);
|
OSD_Printf("%s\n", parm->raw);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1339,6 +1339,7 @@ static int osdcmd_crosshaircolor(const osdfuncparm_t *parm)
|
||||||
g = atol(parm->parms[1]);
|
g = atol(parm->parms[1]);
|
||||||
b = atol(parm->parms[2]);
|
b = atol(parm->parms[2]);
|
||||||
SetCrosshairColor(r,g,b);
|
SetCrosshairColor(r,g,b);
|
||||||
|
OSD_Printf("%s\n", parm->raw);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,7 +1382,7 @@ int registerosdcommands(void)
|
||||||
|
|
||||||
OSD_RegisterFunction("bind","bind <key> <string>: associates a keypress with a string of console input. Type \"bind showkeys\" for a list of keys and \"listsymbols\" for a list of valid console commands.", osdcmd_bind);
|
OSD_RegisterFunction("bind","bind <key> <string>: associates a keypress with a string of console input. Type \"bind showkeys\" for a list of keys and \"listsymbols\" for a list of valid console commands.", osdcmd_bind);
|
||||||
|
|
||||||
OSD_RegisterFunction("cl_statusbarscale","cl_statusbarscale: changes the status bar scale", osdcmd_setstatusbarscale);
|
OSD_RegisterFunction("hud_scale","hud_scale: changes the hud scale", osdcmd_setstatusbarscale);
|
||||||
OSD_RegisterFunction("crosshairscale","crosshairscale: changes the crosshair scale", osdcmd_setcrosshairscale);
|
OSD_RegisterFunction("crosshairscale","crosshairscale: changes the crosshair scale", osdcmd_setcrosshairscale);
|
||||||
OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes crosshair color", osdcmd_crosshaircolor);
|
OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes crosshair color", osdcmd_crosshaircolor);
|
||||||
OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);
|
OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);
|
||||||
|
|
|
@ -617,7 +617,10 @@ int shoot(int i,int atwith)
|
||||||
{
|
{
|
||||||
j = findplayer(s,&x);
|
j = findplayer(s,&x);
|
||||||
sz -= (4<<8);
|
sz -= (4<<8);
|
||||||
zvel = ((g_player[j].ps->posz-sz) <<8) / (ldist(&sprite[g_player[j].ps->i], s));
|
hitx = ldist(&sprite[g_player[j].ps->i], s);
|
||||||
|
if (hitx == 0)
|
||||||
|
hitx++;
|
||||||
|
zvel = ((g_player[j].ps->posz-sz) <<8) / hitx;
|
||||||
if (s->picnum != BOSS1)
|
if (s->picnum != BOSS1)
|
||||||
{
|
{
|
||||||
zvel += 128-(TRAND&255);
|
zvel += 128-(TRAND&255);
|
||||||
|
@ -1190,7 +1193,10 @@ DOSKIPBULLETHOLE:
|
||||||
{
|
{
|
||||||
j = findplayer(s,&x);
|
j = findplayer(s,&x);
|
||||||
sz -= (4<<8);
|
sz -= (4<<8);
|
||||||
zvel = ((g_player[j].ps->posz-sz) <<8) / (ldist(&sprite[g_player[j].ps->i], s));
|
hitx = ldist(&sprite[g_player[j].ps->i], s);
|
||||||
|
if (hitx == 0)
|
||||||
|
hitx++;
|
||||||
|
zvel = ((g_player[j].ps->posz-sz) <<8) / hitx;
|
||||||
if (s->picnum != BOSS1)
|
if (s->picnum != BOSS1)
|
||||||
{
|
{
|
||||||
zvel += 128-(TRAND&255);
|
zvel += 128-(TRAND&255);
|
||||||
|
@ -1437,7 +1443,7 @@ SKIPBULLETHOLE:
|
||||||
sa += 16-(TRAND&31);
|
sa += 16-(TRAND&31);
|
||||||
hitx = ldist(&sprite[g_player[j].ps->i],s);
|
hitx = ldist(&sprite[g_player[j].ps->i],s);
|
||||||
if (hitx == 0) hitx++;
|
if (hitx == 0) hitx++;
|
||||||
zvel = (((g_player[j].ps->oposz - sz + (3<<8)))*vel) / hitx;
|
zvel = ((g_player[j].ps->oposz - sz + (3<<8))*vel) / hitx;
|
||||||
}
|
}
|
||||||
if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9];
|
if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9];
|
||||||
oldzvel = zvel;
|
oldzvel = zvel;
|
||||||
|
@ -1636,7 +1642,7 @@ SKIPBULLETHOLE:
|
||||||
else
|
else
|
||||||
sprite[j].clipdist = 40;
|
sprite[j].clipdist = 40;
|
||||||
|
|
||||||
break;
|
return j;
|
||||||
|
|
||||||
case HANDHOLDINGLASER__STATIC:
|
case HANDHOLDINGLASER__STATIC:
|
||||||
|
|
||||||
|
@ -1732,7 +1738,10 @@ SKIPBULLETHOLE:
|
||||||
dal -= (8<<8);
|
dal -= (8<<8);
|
||||||
|
|
||||||
}
|
}
|
||||||
zvel = ((sprite[j].z-sz-dal)<<8) / (ldist(&sprite[g_player[p].ps->i], &sprite[j]));
|
hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]);
|
||||||
|
if (hitx == 0)
|
||||||
|
hitx++;
|
||||||
|
zvel = ((sprite[j].z-sz-dal)<<8) / hitx;
|
||||||
sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
|
sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1748,7 +1757,10 @@ SKIPBULLETHOLE:
|
||||||
{
|
{
|
||||||
j = findplayer(s,&x);
|
j = findplayer(s,&x);
|
||||||
sz -= (4<<8);
|
sz -= (4<<8);
|
||||||
zvel = ((g_player[j].ps->posz-sz) <<8) / (ldist(&sprite[g_player[j].ps->i], s));
|
hitx = ldist(&sprite[g_player[j].ps->i], s);
|
||||||
|
if (hitx == 0)
|
||||||
|
hitx++;
|
||||||
|
zvel = ((g_player[j].ps->posz-sz) <<8) / hitx;
|
||||||
zvel += 128-(TRAND&255);
|
zvel += 128-(TRAND&255);
|
||||||
sa += 32-(TRAND&63);
|
sa += 32-(TRAND&63);
|
||||||
}
|
}
|
||||||
|
@ -1820,7 +1832,10 @@ SKIPBULLETHOLE:
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
{
|
{
|
||||||
dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1);
|
dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1);
|
||||||
zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / (ldist(&sprite[g_player[p].ps->i], &sprite[j]));
|
hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]);
|
||||||
|
if (hitx == 0)
|
||||||
|
hitx++;
|
||||||
|
zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / hitx;
|
||||||
sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
|
sa = getangle(sprite[j].x-sx,sprite[j].y-sy);
|
||||||
}
|
}
|
||||||
else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*98;
|
else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*98;
|
||||||
|
|
Loading…
Reference in a new issue