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

This commit is contained in:
terminx 2008-08-09 12:29:23 +00:00
parent 18614505b1
commit 846c7701d4
4 changed files with 49 additions and 29 deletions

View file

@ -47,8 +47,8 @@ extern int isadoorwall(int dapic);
extern int isanunderoperator(int lotag); extern int isanunderoperator(int lotag);
extern int isanearoperator(int lotag); extern int isanearoperator(int lotag);
extern inline int checkcursectnums(int sect); extern inline int checkcursectnums(int sect);
extern inline int ldist(spritetype *s1,spritetype *s2); extern int ldist(spritetype *s1,spritetype *s2);
extern inline int dist(spritetype *s1,spritetype *s2); extern int dist(spritetype *s1,spritetype *s2);
extern int findplayer(spritetype *s,int *d); extern int findplayer(spritetype *s,int *d);
extern int findotherplayer(int p,int *d); extern int findotherplayer(int p,int *d);
extern void doanimations(void); extern void doanimations(void);

View file

@ -2025,7 +2025,7 @@ static void coolgaugetext(int snum)
if (sprite[p->i].pal == 1 && p->last_extra < 2) if (sprite[p->i].pal == 1 && p->last_extra < 2)
altdigitalnumber(40,-(200-22),1,-16,10+16); altdigitalnumber(40,-(200-22),1,-16,10+16);
else if (!althud_flashing || p->last_extra > 25 || totalclock&32) else if (!althud_flashing || p->last_extra > (p->max_player_health>>2) || totalclock&32)
altdigitalnumber(40,-(200-22),p->last_extra,-16,10+16); altdigitalnumber(40,-(200-22),p->last_extra,-16,10+16);
if (althud_shadows) if (althud_shadows)

View file

@ -7050,12 +7050,15 @@ static int parse(void)
int lSprite=GetGameVarID(*insptr++, g_i, g_p), lVar1=*insptr++; int lSprite=GetGameVarID(*insptr++, g_i, g_p), lVar1=*insptr++;
j=*insptr++; j=*insptr++;
if (lSprite < 0 || lSprite >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "CON_GETACTORVAR/CON_SETACTORVAR: invalid sprite ID %d\n",line_num,lSprite);
break;
}
if (tw == CON_SETACTORVAR) if (tw == CON_SETACTORVAR)
{ {
if (lSprite >= 0 && lSprite < MAXSPRITES)
SetGameVarID(lVar1, GetGameVarID(j, g_i, g_p), lSprite, g_p); SetGameVarID(lVar1, GetGameVarID(j, g_i, g_p), lSprite, g_p);
else
OSD_Printf(CON_ERROR "CON_SETACTORVAR: invalid sprite ID %d\n",line_num,lSprite);
break; break;
} }
SetGameVarID(j, GetGameVarID(lVar1, lSprite, g_p), g_i, g_p); SetGameVarID(j, GetGameVarID(lVar1, lSprite, g_p), g_i, g_p);
@ -7076,12 +7079,15 @@ static int parse(void)
{ {
int lVar1=*insptr++, lVar2=*insptr++; int lVar1=*insptr++, lVar2=*insptr++;
if (iPlayer < 0 || iPlayer >= ud.multimode)
{
OSD_Printf(CON_ERROR "CON_GETPLAYERVAR/CON_SETPLAYERVAR: invalid player ID %d\n",line_num,iPlayer);
break;
}
if (tw == CON_SETPLAYERVAR) if (tw == CON_SETPLAYERVAR)
{ {
if (iPlayer >= 0 && iPlayer < ud.multimode)
SetGameVarID(lVar1, GetGameVarID(lVar2, g_i, g_p), g_i, iPlayer); SetGameVarID(lVar1, GetGameVarID(lVar2, g_i, g_p), g_i, iPlayer);
else
OSD_Printf(CON_ERROR "CON_SETPLAYERVAR: invalid player ID %d\n",line_num,iPlayer);
break; break;
} }
SetGameVarID(lVar2, GetGameVarID(lVar1, g_i, iPlayer), g_i, g_p); SetGameVarID(lVar2, GetGameVarID(lVar1, g_i, iPlayer), g_i, g_p);
@ -7203,7 +7209,7 @@ static int parse(void)
int asize = GetGameVarID(*insptr++, g_i, g_p); int asize = GetGameVarID(*insptr++, g_i, g_p);
if (asize > 0) if (asize > 0)
{ {
OSD_Printf(OSDTEXT_GREEN "resizing array %s, old size %d new size %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize); OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize);
aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, sizeof(int) * asize); aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, sizeof(int) * asize);
aGameArrays[j].size = asize; aGameArrays[j].size = asize;
} }
@ -7441,16 +7447,16 @@ static int parse(void)
break; break;
case CON_STARTTRACK: case CON_STARTTRACK:
insptr++;
music_select=(ud.volume_number*MAXLEVELS)+(*(insptr++));
if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0],music_select);
break;
case CON_STARTTRACKVAR: case CON_STARTTRACKVAR:
insptr++; insptr++;
music_select=(ud.volume_number*MAXLEVELS)+(GetGameVarID(*(insptr++), g_i, g_p)); if (tw == CON_STARTTRACK) music_select=(ud.volume_number*MAXLEVELS)+(*(insptr++));
if (map[(unsigned char)music_select].musicfn != NULL) else music_select=(ud.volume_number*MAXLEVELS)+(GetGameVarID(*(insptr++), g_i, g_p));
if (map[(unsigned char)music_select].musicfn == NULL)
{
OSD_Printf(CON_ERROR "CON_STARTTRACK/CON_STARTTRACKVAR: null music for map %d\n",line_num,music_select);
insptr++;
break;
}
playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); playmusic(&map[(unsigned char)music_select].musicfn[0],music_select);
break; break;

View file

@ -196,18 +196,32 @@ inline int checkcursectnums(int sect)
return -1; return -1;
} }
inline int ldist(spritetype *s1,spritetype *s2) int ldist(spritetype *s1,spritetype *s2)
{ {
int i = FindDistance2D(s1->x-s2->x, s1->y-s2->y); int x= klabs(s1->x-s2->x);
if (!i) return 1; int y= klabs(s1->y-s2->y);
return i;
if (x<y) swaplong(&x,&y);
{
int t = y + (y>>1);
return (x - (x>>5) - (x>>7) + (t>>2) + (t>>6));
}
} }
inline int dist(spritetype *s1,spritetype *s2) int dist(spritetype *s1,spritetype *s2)
{ {
int i = FindDistance3D(s1->x-s2->x, s1->y-s2->y, (s1->z-s2->z)>>4); int x= klabs(s1->x-s2->x);
if (!i) return 1; int y= klabs(s1->y-s2->y);
return i; int z= klabs((s1->z-s2->z)>>4);
if (x<y) swaplong(&x,&y);
if (x<z) swaplong(&x,&z);
{
int t = y + z;
return (x - (x>>4) + (t>>2) + (t>>3));
}
} }
int findplayer(spritetype *s,int *d) int findplayer(spritetype *s,int *d)