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

This commit is contained in:
terminx 2008-02-06 11:42:34 +00:00
parent 9e834f8e7f
commit b530c1ca75
5 changed files with 56 additions and 64 deletions

View file

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//-------------------------------------------------------------------------
#include "duke3d.h"
#include "gamedef.h"
extern int numenvsnds;
extern int actor_tog;
@ -192,7 +193,6 @@ void addweapon(player_struct *p,int weapon)
void checkavailinven(player_struct *p)
{
if (p->firstaid_amount > 0)
p->inven_icon = 1;
else if (p->steroids_amount > 0)
@ -544,9 +544,7 @@ int movesprite(int spritenum, int xchange, int ychange, int zchange, unsigned in
int ssp(int i,unsigned int cliptype) //The set sprite function
{
spritetype *s= &sprite[i];
int movetype;
movetype = movesprite(i,
int movetype = movesprite(i,
(s->xvel*(sintable[(s->ang+512)&2047]))>>14,
(s->xvel*(sintable[s->ang&2047]))>>14,s->zvel,
cliptype);
@ -554,15 +552,19 @@ int ssp(int i,unsigned int cliptype) //The set sprite function
return (movetype==0);
}
#undef deletesprite
void deletespriteEVENT(int s)
{
int p;
if (apScriptGameEvent[EVENT_KILLIT])
{
int p;
SetGameVarID(g_iReturnVarID,0, -1, -1);
OnEvent(EVENT_KILLIT, s, findplayer(&sprite[s],(int *)&p), p);
if (!GetGameVarID(g_iReturnVarID, -1, -1))deletesprite(s);
SetGameVarID(g_iReturnVarID,0, -1, -1);
OnEvent(EVENT_KILLIT, s, findplayer(&sprite[s],(int *)&p), p);
if (GetGameVarID(g_iReturnVarID, -1, -1))
return;
}
deletesprite(s);
}
#define deletesprite deletespriteEVENT
@ -7603,14 +7605,19 @@ void moveobjects(void)
movestandables(); //ST 6
for (;k<MAXSTATUS;k++)
if (apScriptGameEvent[EVENT_GAME])
{
int i = headspritestat[k];
while (i >= 0)
int i, p, j;
for (;k<MAXSTATUS;k++)
{
int p, j = nextspritestat[i];
OnEvent(EVENT_GAME,i, findplayer(&sprite[i],(int *)&p), p);
i = j;
i = headspritestat[k];
while (i >= 0)
{
j = nextspritestat[i];
OnEvent(EVENT_GAME,i, findplayer(&sprite[i],(int *)&p), p);
i = j;
}
}
}

View file

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

View file

@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "osdcmds.h"
#include "scriptfile.h"
#include "grpscan.h"
#include "gamedef.h"
//#include "crc32.h"
@ -4401,7 +4402,10 @@ int EGS(int whatsect,int s_x,int s_y,int s_z,int s_pn,int s_s,int s_xr,int s_yr,
*/
ResetActorGameVars(i);
hittype[i].flags = 0;
OnEvent(EVENT_EGS,i, findplayer(&sprite[i],&p), p);
if (apScriptGameEvent[EVENT_EGS])
OnEvent(EVENT_EGS,i, findplayer(&sprite[i],&p), p);
return(i);
}
@ -6328,7 +6332,9 @@ int spawn(int j, int pn)
break;
}
OnEvent(EVENT_SPAWN,i, findplayer(&sprite[i],&p), p);
if (apScriptGameEvent[EVENT_SPAWN])
OnEvent(EVENT_SPAWN,i, findplayer(&sprite[i],&p), p);
return i;
}

View file

@ -41,7 +41,7 @@ extern int *actorLoadEventScrptr[MAXTILES];
extern int *apScriptGameEvent[MAXGAMEEVENTS];
extern short otherp;
extern int otherp;
extern int g_currentweapon;
extern int g_gun_pos;
extern int g_looking_arc;

View file

@ -188,7 +188,7 @@ int isanearoperator(int lotag)
return 0;
}
int checkcursectnums(int sect)
inline int checkcursectnums(int sect)
{
int i;
for (i=connecthead;i>=0;i=connectpoint2[i])
@ -196,28 +196,21 @@ int checkcursectnums(int sect)
return -1;
}
int ldist(spritetype *s1,spritetype *s2)
inline int ldist(spritetype *s1,spritetype *s2)
{
int vx,vy,ret;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
ret = FindDistance2D(vx,vy);
return(ret?ret:1);
int ret = FindDistance2D(s1->x-s2->x, s1->y-s2->y);
return (ret?ret:1);
}
int dist(spritetype *s1,spritetype *s2)
inline int dist(spritetype *s1,spritetype *s2)
{
int vx,vy,vz;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
vz = s1->z - s2->z;
return(FindDistance3D(vx,vy,vz>>4));
return (FindDistance3D(s1->x-s2->x, s1->y-s2->y, (s1->z-s2->z)>>4));
}
int findplayer(spritetype *s,int *d)
{
int j, closest_player;
int x, closest;
int j, closest_player = 0;
int x, closest = 0x7fffffff;
if (ud.multimode < 2)
{
@ -225,9 +218,6 @@ int findplayer(spritetype *s,int *d)
return myconnectindex;
}
closest = 0x7fffffff;
closest_player = 0;
for (j=connecthead;j>=0;j=connectpoint2[j])
{
x = klabs(g_player[j].ps->oposx-s->x) + klabs(g_player[j].ps->oposy-s->y) + ((klabs(g_player[j].ps->oposz-s->z+(28<<8)))>>4);
@ -244,11 +234,8 @@ int findplayer(spritetype *s,int *d)
int findotherplayer(int p,int *d)
{
int j, closest_player;
int x, closest;
closest = 0x7fffffff;
closest_player = p;
int j, closest_player = p;
int x, closest = 0x7fffffff;
for (j=connecthead;j>=0;j=connectpoint2[j])
if (p != j && sprite[g_player[j].ps->i].extra > 0)
@ -336,10 +323,9 @@ void doanimations(void)
int getanimationgoal(int *animptr)
{
int i, j;
int i = animatecnt-1, j = -1;
j = -1;
for (i=animatecnt-1;i>=0;i--)
for (;i>=0;i--)
if (animptr == (int *)animateptr[i])
{
j = i;
@ -350,13 +336,12 @@ int getanimationgoal(int *animptr)
int setanimation(int animsect,int *animptr, int thegoal, int thevel)
{
int i, j;
int i = 0, j = animatecnt;
if (animatecnt >= MAXANIMATES-1)
return(-1);
j = animatecnt;
for (i=0;i<animatecnt;i++)
for (;i<animatecnt;i++)
if (animptr == animateptr[i])
{
j = i;
@ -380,12 +365,10 @@ int setanimation(int animsect,int *animptr, int thegoal, int thevel)
void animatecamsprite(void)
{
int i;
int i = camsprite;
if (camsprite <= 0) return;
i = camsprite;
if (T1 >= 11)
{
T1 = 0;
@ -406,9 +389,9 @@ void animatecamsprite(void)
void animatewalls(void)
{
int i, j, p, t;
int i, j, p = 0, t;
for (p=0;p < numanimwalls ;p++)
for (;p < numanimwalls ;p++)
// for(p=numanimwalls-1;p>=0;p--)
{
i = animwall[p].wallnum;
@ -1104,9 +1087,9 @@ void operatemasterswitches(int low)
void operateforcefields(int s, int low)
{
int i, p;
int i, p=numanimwalls;
for (p=numanimwalls;p>=0;p--)
for (;p>=0;p--)
{
i = animwall[p].wallnum;
@ -1134,12 +1117,10 @@ void operateforcefields(int s, int low)
int checkhitswitch(int snum,int w,int switchtype)
{
int switchpal, switchpicnum;
int i, x, lotag,hitag,picnum,correctdips,numdips;
int i, x, lotag,hitag,picnum,correctdips = 1, numdips = 0;
int sx,sy;
if (w < 0) return 0;
correctdips = 1;
numdips = 0;
if (switchtype == 1) // A wall sprite
{
@ -1619,9 +1600,7 @@ void checkhitwall(int spr,int dawallnum,int x,int y,int z,int atwith)
{
short sn = -1;
int j, i, darkestwall;
walltype *wal;
wal = &wall[dawallnum];
walltype *wal = &wall[dawallnum];
if (wal->overpicnum == MIRROR && checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (hittype[spr].projectile.workslike & PROJECTILE_FLAG_RPG))
{
@ -2020,7 +1999,7 @@ void checkhitsprite(int i,int sn)
short j;
int k, p, rpg=0;
spritetype *s;
int switchpicnum;
int switchpicnum = PN;
i &= (MAXSPRITES-1);