git-svn-id: https://svn.eduke32.com/eduke32@949 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-08-09 10:16:18 +00:00
parent ff18979277
commit 3f9daa6c44
5 changed files with 64 additions and 84 deletions

View file

@ -383,12 +383,13 @@ SKIPWALLCHECK:
if (s->picnum != SHRINKSPARK)
{
if (d < r/3)
k = (r/3);
if (d < k)
{
if (hp4 == hp3) hp4++;
hittype[j].extra = hp3 + (TRAND%(hp4-hp3));
}
else if (d < 2*r/3)
else if (d < (k<<1))
{
if (hp3 == hp2) hp3++;
hittype[j].extra = hp2 + (TRAND%(hp3-hp2));
@ -527,19 +528,17 @@ int movesprite(int spritenum, int xchange, int ychange, int zchange, unsigned in
daz = sprite[spritenum].z + ((zchange*TICSPERFRAME)>>3);
if ((daz > hittype[spritenum].ceilingz) && (daz <= hittype[spritenum].floorz))
sprite[spritenum].z = daz;
else
if (retval == 0)
return(16384+dasectnum);
else if (retval == 0)
return(16384+dasectnum);
return(retval);
}
inline int ssp(int i,unsigned int cliptype) //The set sprite function
{
return (movesprite(i,
(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14,
(sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,sprite[i].zvel,
cliptype)==0);
return (movesprite(i,(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14,
(sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,sprite[i].zvel,
cliptype)==0);
}
#undef deletesprite
@ -547,8 +546,8 @@ void deletespriteEVENT(int s)
{
if (apScriptGameEvent[EVENT_KILLIT])
{
int p;
int pl=findplayer(&sprite[s],&p);
static int p, pl;
pl=findplayer(&sprite[s],&p);
SetGameVarID(g_iReturnVarID,0, -1, -1);
OnEvent(EVENT_KILLIT, s, pl, p);
if (GetGameVarID(g_iReturnVarID, -1, -1))

View file

@ -3452,7 +3452,7 @@ void SetCrosshairColor(int r, int g, int b)
hictinting[CROSSHAIR_PAL].r = crosshair_colors.r;
hictinting[CROSSHAIR_PAL].g = crosshair_colors.g;
hictinting[CROSSHAIR_PAL].b = crosshair_colors.b;
hictinting[CROSSHAIR_PAL].f = 1;
hictinting[CROSSHAIR_PAL].f = 17;
invalidatetile(CROSSHAIR, -1, -1);
}
@ -5416,9 +5416,10 @@ int spawn(int j, int pn)
a = g_player[snum].ps->ang-(TRAND&63)+8; //Fine tune
T1 = TRAND&1;
sp->z = (3<<8)+g_player[snum].ps->pyoff+g_player[snum].ps->posz-
((g_player[snum].ps->horizoff+g_player[snum].ps->horiz-100)<<4);
if (sp->picnum == SHOTGUNSHELL)
sp->z = (6<<8)+g_player[snum].ps->pyoff+g_player[snum].ps->posz-((g_player[snum].ps->horizoff+g_player[snum].ps->horiz-100)<<4);
else sp->z = (3<<8)+g_player[snum].ps->pyoff+g_player[snum].ps->posz-((g_player[snum].ps->horizoff+g_player[snum].ps->horiz-100)<<4);
sp->z += (3<<8);
sp->zvel = -(TRAND&255);
}
else

View file

@ -6679,7 +6679,8 @@ case CON_CHANGESPRITESECT:
index=GetGameVarID(*insptr++,g_i,g_p);
if ((index < aGameArrays[lVarID].size)&&(index>=0))
{
OSD_Printf(OSDTEXT_GREEN "CON_ADDLOGVAR: L=%d %s[%d] =%d\n",line_num, aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]);
OSD_Printf(OSDTEXT_GREEN "CON_ADDLOGVAR: L=%d %s[%d] =%d\n",line_num,
aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]);
break;
}
else
@ -7096,14 +7097,15 @@ case CON_CHANGESPRITESECT:
insptr++;
if (j >=0 && j < ud.multimode)
if (j < 0 || j >= ud.multimode)
{
if (tw == CON_CHECKAVAILWEAPON)
checkavailweapon(g_player[j].ps);
else checkavailinven(g_player[j].ps);
}
else
OSD_Printf(CON_ERROR "CON_CHECKAVAILWEAPON/CON_CHECKAVAILINVEN: Invalid player ID %d\n",line_num,j);
break;
}
if (tw == CON_CHECKAVAILWEAPON)
checkavailweapon(g_player[j].ps);
else checkavailinven(g_player[j].ps);
break;
@ -7181,7 +7183,11 @@ case CON_CHANGESPRITESECT:
case CON_DIVVAR:
insptr++;
if (*(insptr+1) == 0)
gameexit("CON_DIVVAR: Divide by zero.");
{
OSD_Printf(CON_ERROR "CON_DIVVAR: Divide by zero.\n",line_num);
insptr += 2;
break;
}
SetGameVarID(*insptr, GetGameVarID(*insptr, g_i, g_p) / *(insptr+1), g_i, g_p);
insptr += 2;
break;
@ -7189,7 +7195,11 @@ case CON_CHANGESPRITESECT:
case CON_MODVAR:
insptr++;
if (*(insptr+1) == 0)
gameexit("CON_MODVAR: Mod by zero.");
{
OSD_Printf(CON_ERROR "CON_MODVAR: Mod by zero.\n",line_num);
insptr += 2;
break;
}
SetGameVarID(*insptr,GetGameVarID(*insptr, g_i, g_p)%*(insptr+1), g_i, g_p);
insptr += 2;
break;
@ -7255,8 +7265,10 @@ case CON_CHANGESPRITESECT:
int l2=GetGameVarID(*insptr++, g_i, g_p);
if (l2==0)
gameexit("CON_DIVVARVAR: Divide by zero.");
{
OSD_Printf(CON_ERROR "CON_DIVVARVAR: Divide by zero.\n",line_num);
break;
}
SetGameVarID(j, GetGameVarID(j, g_i, g_p)/l2 , g_i, g_p);
break;
}
@ -7268,7 +7280,10 @@ case CON_CHANGESPRITESECT:
int l2=GetGameVarID(*insptr++, g_i, g_p);
if (l2==0)
gameexit("CON_MODVARVAR: Mod by zero.");
{
OSD_Printf(CON_ERROR "CON_MODVARVAR: Mod by zero.\n",line_num);
break;
}
SetGameVarID(j, GetGameVarID(j, g_i, g_p) % l2, g_i, g_p);
break;
@ -7691,7 +7706,11 @@ case CON_CHANGESPRITESECT:
break;
default:
OSD_Printf("fatal error: default processing: previous five values: %d, %d, %d, %d, %d, currrent opcode: %d, next five values: %d, %d, %d, %d, %d\ncurrent actor: %d (%d)\n",*(insptr-5),*(insptr-4),*(insptr-3),*(insptr-2),*(insptr-1),*insptr,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5),g_i,g_sp->picnum);
OSD_Printf("fatal error: default processing: previous five values: %d, %d, %d, %d, %d, "
"currrent opcode: %d, next five values: %d, %d, %d, %d, %d\ncurrent actor: %d (%d)\n",
*(insptr-5),*(insptr-4),*(insptr-3),*(insptr-2),*(insptr-1),*insptr,*(insptr+1),
*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5),g_i,g_sp->picnum);
gameexit("An error has occurred in the EDuke32 CON executor.\n\n"
"If you are an end user, please e-mail the file eduke32.log\n"
"along with links to any mods you're using to terminx@gmail.com.\n\n"

View file

@ -32,58 +32,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "types.h"
#include "compat.h"
#include "pragmas.h"
#if 0
// Ken's reverse-engineering job
int32 FindDistance2D(int32 x, int32 y)
// I wonder if it's faster to use Ken's functions here...
int FindDistance2D(int x, int y)
{
int32 i;
x = labs(x);
y = labs(y);
if (!x) return(y);
if (!y) return(x);
if (y < x) { i = x; x = y; y = i; } //swap x, y
x += (x>>1);
return ((x>>6)+(x>>2)+y-(y>>5)-(y>>7)); //handle 1 octant
}
int t;
// My abomination
#define square(x) ((x)*(x))
/*
int32 FindDistance2D(int32 dx, int32 dy)
{
// return (int32)floor(sqrt((double)(sqr(dx)+sqr(dy))));
return ksqrt(square(dx)+square(dy));
}
*/
int32 FindDistance3D(int32 dx, int32 dy, int32 dz)
{
// return (int32)floor(sqrt((double)(sqr(dx)+sqr(dy)+sqr(dz))));
return ksqrt(square(dx)+square(dy)+square(dz));
}
#else
#include <stdlib.h>
// This extracted from the Rise of the Triad source RT_UTIL.C :-|
#define SWAP(a,b) \
{ \
a=(a)^(b); \
b=(a)^(b); \
a=(a)^(b); \
}
int32 FindDistance2D(int32 x, int32 y)
{
int32 t;
x= abs(x); /* absolute values */
y= abs(y);
x= klabs(x); /* absolute values */
y= klabs(y);
if (x<y)
SWAP(x,y);
swaplong(&x,&y);
t = y + (y>>1);
@ -91,22 +53,21 @@ int32 FindDistance2D(int32 x, int32 y)
}
int32 FindDistance3D(int32 x, int32 y, int32 z)
int FindDistance3D(int x, int y, int z)
{
int32 t;
int t;
x= abs(x); /* absolute values */
y= abs(y);
z= abs(z);
x= klabs(x); /* absolute values */
y= klabs(y);
z= klabs(z);
if (x<y)
SWAP(x,y);
swaplong(&x,&y);
if (x<z)
SWAP(x,z);
swaplong(&x,&z);
t = y + z;
return (x - (x>>4) + (t>>2) + (t>>3));
}
#endif

View file

@ -27,8 +27,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
//-------------------------------------------------------------------------
extern int32 FindDistance2D(int32 dx, int32 dy);
extern int32 FindDistance3D(int32 dx, int32 dy, int32 dz);
extern int32 FindDistance2D(int dx, int dy);
extern int32 FindDistance3D(int dx, int dy, int dz);
extern int32 FindDistance3D_HP(int32 dx, int32 dy, int32 dz);
extern int32 ArcTangentAppx(int32 dx, int32 dy);