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

This commit is contained in:
terminx 2007-09-11 05:26:38 +00:00
parent 997883a2f9
commit 2376ac3806
14 changed files with 343 additions and 367 deletions

View File

@ -649,10 +649,6 @@
RelativePath=".\source\startwin.game.h"
>
</File>
<File
RelativePath=".\source\wtf.h"
>
</File>
</Filter>
</Filter>
<Filter

View File

@ -379,7 +379,7 @@ SKIPWALLCHECK:
if (s->picnum == RPG && sj->extra > 0)
hittype[j].picnum = RPG;
else if (checkspriteflags(i,SPRITE_FLAG_PROJECTILE) && thisprojectile[i].workslike & PROJECTILE_FLAG_RADIUS_PICNUM && sj->extra > 0)
else if (checkspriteflags(i,SPRITE_FLAG_PROJECTILE) && hittype[i].projectile.workslike & PROJECTILE_FLAG_RADIUS_PICNUM && sj->extra > 0)
hittype[j].picnum = s->picnum;
else
{
@ -877,7 +877,7 @@ int ifhitbyweapon(int sn)
}
}
if (checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE) && (thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG))
if (checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE) && (hittype[sn].projectile.workslike & PROJECTILE_FLAG_RPG))
{
g_player[p].ps->posxv +=
hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<2;
@ -1203,10 +1203,10 @@ static void movefx(void)
}
else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && ud.config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz)
{
if ((soundm[s->lotag]&2))
if ((g_sounds[s->lotag].m&2))
{
x = dist(&sprite[g_player[screenpeek].ps->i],s);
if (x < ht && T1 == 0 && FX_VoiceAvailable(soundpr[s->lotag]-1))
if (x < ht && T1 == 0 && FX_VoiceAvailable(g_sounds[s->lotag].pr-1))
{
if (numenvsnds == ud.config.NumVoices)
{
@ -1231,7 +1231,7 @@ static void movefx(void)
stopenvsound(s->lotag,i);
}
}
if ((soundm[s->lotag]&16))
if ((g_sounds[s->lotag].m&16))
{
if (T5 > 0) T5--;
else for (p=connecthead;p>=0;p=connectpoint2[p])
@ -2353,30 +2353,30 @@ static void moveweapons(void)
{
/* Custom projectiles. This is a big hack. */
if (thisprojectile[i].pal >= 0)
s->pal=thisprojectile[i].pal;
if (hittype[i].projectile.pal >= 0)
s->pal=hittype[i].projectile.pal;
if (thisprojectile[i].workslike & PROJECTILE_FLAG_KNEE)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_KNEE)
KILLIT(i);
if (thisprojectile[i].workslike & PROJECTILE_FLAG_RPG)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_RPG)
{
// if (thisprojectile[i].workslike & COOLEXPLOSION1)
// if( Sound[WIERDSHOT_FLY].num == 0 )
// if (hittype[i].projectile.workslike & COOLEXPLOSION1)
// if( g_sounds[WIERDSHOT_FLY].num == 0 )
// spritesound(WIERDSHOT_FLY,i);
p = -1;
if (thisprojectile[i].workslike & PROJECTILE_FLAG_COOLEXPLOSION1)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_COOLEXPLOSION1)
{
s->shade++;
if (s->shade >= 40) KILLIT(i);
}
if (thisprojectile[i].drop)
s->zvel -= thisprojectile[i].drop;
if (hittype[i].projectile.drop)
s->zvel -= hittype[i].projectile.drop;
if (thisprojectile[i].workslike & PROJECTILE_FLAG_SPIT)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_SPIT)
if (s->zvel < 6144)
s->zvel += gc-112;
@ -2396,27 +2396,27 @@ static void moveweapons(void)
getglobalz(i);
qq = CLIPMASK1;
if (thisprojectile[i].trail > -1)
if (hittype[i].projectile.trail > -1)
{
for (f=0;f<=thisprojectile[i].tnum;f++)
for (f=0;f<=hittype[i].projectile.tnum;f++)
{
j = spawn(i,thisprojectile[i].trail);
if (thisprojectile[i].toffset != 0)
sprite[j].z += (thisprojectile[i].toffset<<8);
if (thisprojectile[i].txrepeat >= 0)
sprite[j].xrepeat=thisprojectile[i].txrepeat;
if (thisprojectile[i].tyrepeat >= 0)
sprite[j].yrepeat=thisprojectile[i].tyrepeat;
j = spawn(i,hittype[i].projectile.trail);
if (hittype[i].projectile.toffset != 0)
sprite[j].z += (hittype[i].projectile.toffset<<8);
if (hittype[i].projectile.txrepeat >= 0)
sprite[j].xrepeat=hittype[i].projectile.txrepeat;
if (hittype[i].projectile.tyrepeat >= 0)
sprite[j].yrepeat=hittype[i].projectile.tyrepeat;
}
}
for (f=1;f<=thisprojectile[i].velmult;f++)
for (f=1;f<=hittype[i].projectile.velmult;f++)
j = movesprite(i,
(k*(sintable[(s->ang+512)&2047]))>>14,
(k*(sintable[s->ang&2047]))>>14,ll,qq);
if (!(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0)
if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0)
if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256)
j = 49152|s->yvel;
@ -2425,69 +2425,69 @@ static void moveweapons(void)
KILLIT(i);
}
if (thisprojectile[i].workslike & PROJECTILE_FLAG_TIMED && thisprojectile[i].range > 0)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_TIMED && hittype[i].projectile.range > 0)
{
if (!(hittype[i].temp_data[8]))
hittype[i].temp_data[8] = 1;
else
hittype[i].temp_data[8]++;
if (hittype[i].temp_data[8] > thisprojectile[i].range)
if (hittype[i].temp_data[8] > hittype[i].projectile.range)
{
if (thisprojectile[i].workslike & PROJECTILE_FLAG_EXPLODEONTIMER)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_EXPLODEONTIMER)
{
if (thisprojectile[i].spawns >= 0)
if (hittype[i].projectile.spawns >= 0)
{
k = spawn(i,thisprojectile[i].spawns);
k = spawn(i,hittype[i].projectile.spawns);
sprite[k].x = dax;
sprite[k].y = day;
sprite[k].z = daz;
if (thisprojectile[i].sxrepeat > 4) sprite[k].xrepeat=thisprojectile[i].sxrepeat;
if (thisprojectile[i].syrepeat > 4) sprite[k].yrepeat=thisprojectile[i].syrepeat;
if (hittype[i].projectile.sxrepeat > 4) sprite[k].xrepeat=hittype[i].projectile.sxrepeat;
if (hittype[i].projectile.syrepeat > 4) sprite[k].yrepeat=hittype[i].projectile.syrepeat;
}
if (thisprojectile[i].isound > -1)
spritesound(thisprojectile[i].isound,i);
if (hittype[i].projectile.isound > -1)
spritesound(hittype[i].projectile.isound,i);
s->extra=thisprojectile[i].extra;
s->extra=hittype[i].projectile.extra;
if (thisprojectile[i].extra_rand > 0)
s->extra += (TRAND&thisprojectile[i].extra_rand);
if (hittype[i].projectile.extra_rand > 0)
s->extra += (TRAND&hittype[i].projectile.extra_rand);
x = s->extra;
hitradius(i,thisprojectile[i].hitradius, x>>2,x>>1,x-(x>>2),x);
hitradius(i,hittype[i].projectile.hitradius, x>>2,x>>1,x-(x>>2),x);
}
KILLIT(i);
}
}
if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)
{
/* if(s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0)
Did this cause the bug with prematurely exploding projectiles? */
if (s->yvel < 1)
{
if (thisprojectile[i].spawns >= 0)
if (hittype[i].projectile.spawns >= 0)
{
k = spawn(i,thisprojectile[i].spawns);
k = spawn(i,hittype[i].projectile.spawns);
sprite[k].x = dax;
sprite[k].y = day;
sprite[k].z = daz;
if (thisprojectile[i].sxrepeat > 4) sprite[k].xrepeat=thisprojectile[i].sxrepeat;
if (thisprojectile[i].syrepeat > 4) sprite[k].yrepeat=thisprojectile[i].syrepeat;
if (hittype[i].projectile.sxrepeat > 4) sprite[k].xrepeat=hittype[i].projectile.sxrepeat;
if (hittype[i].projectile.syrepeat > 4) sprite[k].yrepeat=hittype[i].projectile.syrepeat;
}
if (thisprojectile[i].isound > -1)
spritesound(thisprojectile[i].isound,i);
if (hittype[i].projectile.isound > -1)
spritesound(hittype[i].projectile.isound,i);
s->extra=thisprojectile[i].extra;
s->extra=hittype[i].projectile.extra;
if (thisprojectile[i].extra_rand > 0)
s->extra += (TRAND&thisprojectile[i].extra_rand);
if (hittype[i].projectile.extra_rand > 0)
s->extra += (TRAND&hittype[i].projectile.extra_rand);
x = s->extra;
hitradius(i,thisprojectile[i].hitradius, x>>2,x>>1,x-(x>>2),x);
hitradius(i,hittype[i].projectile.hitradius, x>>2,x>>1,x-(x>>2),x);
KILLIT(i);
}
@ -2495,7 +2495,7 @@ static void moveweapons(void)
}
if ((j&49152) != 49152)
if (!(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS))
if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS))
{
if (s->z < hittype[i].ceilingz)
{
@ -2512,7 +2512,7 @@ static void moveweapons(void)
}
}
/* if(thisprojectile[i].workslike & 8192)
/* if(hittype[i].projectile.workslike & 8192)
{
for(k=-3;k<2;k++)
{
@ -2530,12 +2530,12 @@ static void moveweapons(void)
}
else */
if (thisprojectile[i].workslike & PROJECTILE_FLAG_WATERBUBBLES && sector[s->sectnum].lotag == 2 && rnd(140))
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_WATERBUBBLES && sector[s->sectnum].lotag == 2 && rnd(140))
spawn(i,WATERBUBBLE);
if (j != 0)
{
if (thisprojectile[i].workslike & PROJECTILE_FLAG_COOLEXPLOSION1)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_COOLEXPLOSION1)
{
/* if( (j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER)
goto BOLT; */
@ -2547,7 +2547,7 @@ static void moveweapons(void)
{
j &= (MAXSPRITES-1);
/* if(thisprojectile[i].workslike & PROJECTILE_FLAG_FREEZEBLAST && sprite[j].pal == 1 )
/* if(hittype[i].projectile.workslike & PROJECTILE_FLAG_FREEZEBLAST && sprite[j].pal == 1 )
if( badguy(&sprite[j]) || sprite[j].picnum == APLAYER )
{
j = spawn(i,TRANSPORTERSTAR);
@ -2558,17 +2558,17 @@ static void moveweapons(void)
KILLIT(i);
}*/
if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFSPRITES)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFSPRITES)
{
s->yvel--;
k = getangle(sprite[j].x-s->x,sprite[j].y-s->y)+(sprite[j].cstat&16?0:512);
s->ang = ((k<<1) - s->ang)&2047;
if (thisprojectile[i].bsound > -1)
spritesound(thisprojectile[i].bsound,i);
if (hittype[i].projectile.bsound > -1)
spritesound(hittype[i].projectile.bsound,i);
if (thisprojectile[i].workslike & PROJECTILE_FLAG_LOSESVELOCITY)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_LOSESVELOCITY)
{
s->xvel=s->xvel>>1;
s->zvel=s->zvel>>1;
@ -2583,7 +2583,7 @@ static void moveweapons(void)
p = sprite[j].yvel;
spritesound(PISTOL_BODYHIT,j);
if (thisprojectile[i].workslike & PROJECTILE_FLAG_SPIT)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_SPIT)
{
g_player[p].ps->horiz += 32;
g_player[p].ps->return_to_center = 8;
@ -2605,26 +2605,26 @@ static void moveweapons(void)
}
}
if (thisprojectile[i].workslike & PROJECTILE_FLAG_RPG_IMPACT)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_RPG_IMPACT)
{
hittype[j].owner = s->owner;
hittype[j].picnum = s->picnum;
hittype[j].extra += thisprojectile[i].extra;
hittype[j].extra += hittype[i].projectile.extra;
if (thisprojectile[i].spawns >= 0)
if (hittype[i].projectile.spawns >= 0)
{
k = spawn(i,thisprojectile[i].spawns);
k = spawn(i,hittype[i].projectile.spawns);
sprite[k].x = dax;
sprite[k].y = day;
sprite[k].z = daz;
if (thisprojectile[i].sxrepeat > 4) sprite[k].xrepeat=thisprojectile[i].sxrepeat;
if (thisprojectile[i].syrepeat > 4) sprite[k].yrepeat=thisprojectile[i].syrepeat;
if (hittype[i].projectile.sxrepeat > 4) sprite[k].xrepeat=hittype[i].projectile.sxrepeat;
if (hittype[i].projectile.syrepeat > 4) sprite[k].yrepeat=hittype[i].projectile.syrepeat;
}
if (thisprojectile[i].isound > -1)
spritesound(thisprojectile[i].isound,i);
if (hittype[i].projectile.isound > -1)
spritesound(hittype[i].projectile.isound,i);
KILLIT(i);
@ -2635,7 +2635,7 @@ static void moveweapons(void)
{
j &= (MAXWALLS-1);
if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFMIRRORS && (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFMIRRORS && (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
{
k = getangle(
wall[wall[j].point2].x-wall[j].x,
@ -2650,7 +2650,7 @@ static void moveweapons(void)
setsprite(i,dax,day,daz);
checkhitwall(i,j,s->x,s->y,s->z,s->picnum);
if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)
{
if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR)
s->yvel--;
@ -2660,10 +2660,10 @@ static void moveweapons(void)
wall[wall[j].point2].y-wall[j].y);
s->ang = ((k<<1) - s->ang)&2047;
if (thisprojectile[i].bsound > -1)
spritesound(thisprojectile[i].bsound,i);
if (hittype[i].projectile.bsound > -1)
spritesound(hittype[i].projectile.bsound,i);
if (thisprojectile[i].workslike & PROJECTILE_FLAG_LOSESVELOCITY)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_LOSESVELOCITY)
{
s->xvel=s->xvel>>1;
s->zvel=s->zvel>>1;
@ -2685,7 +2685,7 @@ static void moveweapons(void)
checkhitceiling(s->sectnum);
}
if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)
{
bounce(i);
ssp(i,qq);
@ -2696,10 +2696,10 @@ static void moveweapons(void)
s->yrepeat -= 2;*/
s->yvel--;
if (thisprojectile[i].bsound > -1)
spritesound(thisprojectile[i].bsound,i);
if (hittype[i].projectile.bsound > -1)
spritesound(hittype[i].projectile.bsound,i);
if (thisprojectile[i].workslike & PROJECTILE_FLAG_LOSESVELOCITY)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_LOSESVELOCITY)
{
s->xvel=s->xvel>>1;
s->zvel=s->zvel>>1;
@ -2709,17 +2709,17 @@ static void moveweapons(void)
}
}
if (thisprojectile[i].workslike & PROJECTILE_FLAG_RPG)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_RPG)
{
if (thisprojectile[i].spawns > 0)
if (hittype[i].projectile.spawns > 0)
{
k = spawn(i,thisprojectile[i].spawns);
k = spawn(i,hittype[i].projectile.spawns);
sprite[k].x = dax;
sprite[k].y = day;
sprite[k].z = daz;
if (thisprojectile[i].sxrepeat > 4) sprite[k].xrepeat=thisprojectile[i].sxrepeat;
if (thisprojectile[i].syrepeat > 4) sprite[k].yrepeat=thisprojectile[i].syrepeat;
if (hittype[i].projectile.sxrepeat > 4) sprite[k].xrepeat=hittype[i].projectile.sxrepeat;
if (hittype[i].projectile.syrepeat > 4) sprite[k].yrepeat=hittype[i].projectile.syrepeat;
}
/* if(s->xrepeat < 10)
{
@ -2740,7 +2740,7 @@ static void moveweapons(void)
}
if (thisprojectile[i].workslike & PROJECTILE_FLAG_HITSCAN)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_HITSCAN)
{
p = findplayer(s,&x);
execute(i,p,x);
@ -2748,26 +2748,26 @@ static void moveweapons(void)
}
if (thisprojectile[i].workslike & PROJECTILE_FLAG_RPG)
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_RPG)
{
if (thisprojectile[i].isound > -1)
spritesound(thisprojectile[i].isound,i);
if (hittype[i].projectile.isound > -1)
spritesound(hittype[i].projectile.isound,i);
/* if(s->xrepeat >= 10)
{*/
s->extra=thisprojectile[i].extra;
if (thisprojectile[i].extra_rand > 0)
s->extra += (TRAND&thisprojectile[i].extra_rand);
s->extra=hittype[i].projectile.extra;
if (hittype[i].projectile.extra_rand > 0)
s->extra += (TRAND&hittype[i].projectile.extra_rand);
x = s->extra;
hitradius(i,thisprojectile[i].hitradius, x>>2,x>>1,x-(x>>2),x);
hitradius(i,hittype[i].projectile.hitradius, x>>2,x>>1,x-(x>>2),x);
/* }
else
{
x = s->extra+(global_random&3);
hitradius( i,(thisprojectile[i].hitradius>>1),x>>2,x>>1,x-(x>>2),x);
hitradius( i,(hittype[i].projectile.hitradius>>1),x>>2,x>>1,x-(x>>2),x);
}*/
// if (!(thisprojectile[i].workslike & PROJECTILE_FLAG_COOLEXPLOSION1))
// if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_COOLEXPLOSION1))
KILLIT(i);
}
}

View File

@ -4350,8 +4350,8 @@ static void Keys2d(void)
*/
Bsprintf(tempbuf, "Mapster32"VERSION"");
printext16(9L,ydim-STATUS2DSIZ+9L,4,-1,tempbuf,0);
printext16(8L,ydim-STATUS2DSIZ+8L,12,-1,tempbuf,0);
printext16(9L,ydim2d-STATUS2DSIZ+9L,4,-1,tempbuf,0);
printext16(8L,ydim2d-STATUS2DSIZ+8L,12,-1,tempbuf,0);
if ((totalclock > getmessagetimeoff) && (totalclock > (lastpm16time + 120*3)))
{

View File

@ -106,7 +106,7 @@ extern int g_ScriptVersion, g_Shareware, g_GameType;
// #define GC (TICSPERFRAME*44)
#define NUM_SOUNDS 1500
#define NUM_SOUNDS 1536
/*
#pragma aux sgn =\
@ -312,8 +312,13 @@ extern long movefifosendplc;
typedef struct {
char *ptr;
volatile char lock;
int length, num;
} SAMPLE;
int length, num;
SOUNDOWNER SoundOwner[4];
char *filename;
short ps,pe,vo;
char pr,m;
long soundsiz;
} sound_t;
typedef struct {
short wallnum;
@ -521,10 +526,9 @@ extern char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES];
extern char ready2send;
//extern fx_device device;
extern SAMPLE Sound[ NUM_SOUNDS ];
extern SOUNDOWNER SoundOwner[NUM_SOUNDS][4];
extern sound_t g_sounds[ NUM_SOUNDS ];
extern char sounds[NUM_SOUNDS][BMAX_PATH];
// extern char sounds[NUM_SOUNDS][BMAX_PATH];
// JBF 20040531: adding 16 extra to the script so we have some leeway
// to (hopefully) safely abort when hitting the limit
@ -540,7 +544,24 @@ extern char music_select;
extern char env_music_fn[MAXVOLUMES+1][BMAX_PATH];
extern short camsprite;
typedef struct {
int workslike, extra, cstat, extra_rand, hitradius, range;
short spawns, sound, isound, vel, decal, trail, tnum, drop, clipdist, offset, bounces, bsound, toffset;
signed char sxrepeat, syrepeat, txrepeat, tyrepeat, shade, xrepeat, yrepeat, pal, velmult;
} proj_struct;
// extern char gotz;
typedef struct {
/* long x;
long y;
long z; */
short ang, oldang, angdir, angdif;
} spriteinterpolate;
spriteinterpolate sprpos[MAXSPRITES];
typedef struct {
char cgg;
short picnum,ang,extra,owner,movflag;
@ -548,18 +569,11 @@ typedef struct {
short timetosleep;
long floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz;
long temp_data[10];
} weaponhit;
int flags;
proj_struct projectile;
} actordata_t;
extern weaponhit hittype[MAXSPRITES];
typedef struct {
long x;
long y;
long z;
short ang, oldang, angdir, angdif;
} spriteinterpolate;
extern spriteinterpolate sprpos[MAXSPRITES];
extern actordata_t hittype[MAXSPRITES];
extern input loc;
extern input recsync[RECSYNCBUFSIZ];
@ -592,9 +606,6 @@ extern short mirrorwall[64], mirrorsector[64], mirrorcnt;
#include "funct.h"
extern int screencapt;
extern short soundps[NUM_SOUNDS],soundpe[NUM_SOUNDS],soundvo[NUM_SOUNDS];
extern char soundpr[NUM_SOUNDS],soundm[NUM_SOUNDS];
extern long soundsiz[NUM_SOUNDS];
extern char volume_names[MAXVOLUMES][33];
extern char skill_names[5][33];
@ -806,13 +817,14 @@ typedef struct {
unsigned long dwFlags;
long *plValues; // array of values when 'per-player', or 'per-actor'
} MATTGAMEVAR;
long lDefault;
char bReset;
} gamevar_t;
extern MATTGAMEVAR aGameVars[MAXGAMEVARS];
extern MATTGAMEVAR aDefaultGameVars[MAXGAMEVARS];
extern gamevar_t aGameVars[MAXGAMEVARS];
extern int iGameVarCount;
extern int spriteflags[MAXTILES], actorspriteflags[MAXSPRITES];
extern int spriteflags[MAXTILES];
enum spriteflags {
SPRITE_FLAG_SHADOW = 1,
@ -912,13 +924,7 @@ enum projectileflags {
PROJECTILE_FLAG_ACCURATE_AUTOAIM = 131072
};
typedef struct {
int workslike, extra, cstat, extra_rand, hitradius, range;
short spawns, sound, isound, vel, decal, trail, tnum, drop, clipdist, offset, bounces, bsound, toffset;
signed char sxrepeat, syrepeat, txrepeat, tyrepeat, shade, xrepeat, yrepeat, pal, velmult;
} proj_struct;
extern proj_struct projectile[MAXTILES], thisprojectile[MAXSPRITES], defaultprojectile[MAXTILES];
extern proj_struct projectile[MAXTILES], defaultprojectile[MAXTILES];
// logo control

View File

@ -1455,7 +1455,7 @@ int inventory(spritetype *s)
inline int checkspriteflags(int iActor, int iType)
{
if ((spriteflags[sprite[iActor].picnum]^actorspriteflags[iActor]) & iType) return 1;
if ((spriteflags[sprite[iActor].picnum]^hittype[iActor].flags) & iType) return 1;
return 0;
}
@ -4180,7 +4180,7 @@ static void dumpdebugdata(void)
{
if (aGameVars[i].dwFlags & (GAMEVAR_FLAG_PERACTOR))
{
if (aGameVars[i].plValues[j] != aDefaultGameVars[i].lValue)
if (aGameVars[i].plValues[j] != aGameVars[i].lDefault)
{
fprintf(fp,"gamevar %s ",aGameVars[i].szLabel);
fprintf(fp,"%ld",aGameVars[i].plValues[j]);
@ -4262,11 +4262,8 @@ int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_
T1=T3=T4=T6=T7=T8=T9=0;
actorspriteflags[i] = 0;
hittype[i].flags = 0;
sprpos[i].x = sprite[i].x;
sprpos[i].y = sprite[i].y;
sprpos[i].z = sprite[i].z;
sprpos[i].ang = sprpos[i].oldang = sprite[i].ang;
if (actorscrptr[s_pn])
@ -4296,7 +4293,7 @@ int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_
}
*/
ResetActorGameVars(i);
actorspriteflags[i] = 0;
hittype[i].flags = 0;
OnEvent(EVENT_EGS,i, findplayer(&sprite[i],&p), p);
return(i);
}
@ -4396,11 +4393,8 @@ int spawn(int j, int pn)
T1 = T2 = T3 = T4 = T5 = T6 = T7 = T8 = T9 = 0;
actorspriteflags[i] = 0;
hittype[i].flags = 0;
sprpos[i].x = sprite[i].x;
sprpos[i].y = sprite[i].y;
sprpos[i].z = sprite[i].z;
sprpos[i].ang = sprpos[i].oldang = sprite[i].ang;
if (PN != SPEAKER && PN != LETTER && PN != DUCK && PN != TARGET && PN != TRIPBOMB && PN != VIEWSCREEN && PN != VIEWSCREEN2 && (CS&48))
@ -6784,12 +6778,6 @@ PALONLY:
if (actorscrptr[s->picnum])
{
#if 0
t->x = sprpos[i].x+mulscale16((long)(s->x-sprpos[i].x),smoothratio);
t->y = sprpos[i].y+mulscale16((long)(s->y-sprpos[i].y),smoothratio);
t->z = sprpos[i].z+mulscale16((long)(s->z-sprpos[i].z),smoothratio);
t->ang = sprpos[i].ang+mulscale16((long)(s->ang-sprpos[i].ang),smoothratio);
#endif
if (ud.angleinterpolation)
{
if (sprpos[i].ang != sprpos[i].oldang)
@ -9296,8 +9284,6 @@ static void freeconmem(void)
{
if (aGameVars[i].szLabel != NULL)
Bfree(aGameVars[i].szLabel);
if (aDefaultGameVars[i].szLabel != NULL)
Bfree(aDefaultGameVars[i].szLabel);
if (aGameVars[i].plValues != NULL)
Bfree(aGameVars[i].plValues);
}
@ -9310,6 +9296,12 @@ static void freeconmem(void)
Bfree(g_player[i].sync);
}
for (i=NUM_SOUNDS-1;i>=0;i--)
{
if (g_sounds[i].filename != NULL)
Bfree(g_sounds[i].filename);
}
if (label != NULL)
Bfree(label);
if (labelcode != NULL)

View File

@ -79,11 +79,9 @@ long *actorLoadEventScrptr[MAXTILES];
long *apScriptGameEvent[MAXGAMEEVENTS];
long *parsing_event=NULL;
MATTGAMEVAR aGameVars[MAXGAMEVARS];
gamevar_t aGameVars[MAXGAMEVARS];
int iGameVarCount=0;
MATTGAMEVAR aDefaultGameVars[MAXGAMEVARS]; // the 'original' values
extern long qsetmode;
char *textptr;
@ -4372,9 +4370,17 @@ repeatcase:
i = 0;
skipcomments();
if (g_sounds[k].filename == NULL)
g_sounds[k].filename = Bcalloc(BMAX_PATH,sizeof(char));
if (!g_sounds[k].filename)
{
Bsprintf(tempbuf,"Failed allocating %d byte buffer.",sizeof(char) * BMAX_PATH);
gameexit(tempbuf);
}
while (*textptr != ' ' || *textptr == '\t')
{
sounds[k][i] = *textptr;
g_sounds[k].filename[i] = *textptr;
textptr++,i++;
if (i >= BMAX_PATH)
{
@ -4384,22 +4390,22 @@ repeatcase:
break;
}
}
sounds[k][i] = '\0';
g_sounds[k].filename[i] = '\0';
transnum(LABEL_DEFINE);
soundps[k] = *(scriptptr-1);
g_sounds[k].ps = *(scriptptr-1);
scriptptr--;
transnum(LABEL_DEFINE);
soundpe[k] = *(scriptptr-1);
g_sounds[k].pe = *(scriptptr-1);
scriptptr--;
transnum(LABEL_DEFINE);
soundpr[k] = *(scriptptr-1);
g_sounds[k].pr = *(scriptptr-1);
scriptptr--;
transnum(LABEL_DEFINE);
soundm[k] = *(scriptptr-1);
g_sounds[k].m = *(scriptptr-1);
scriptptr--;
transnum(LABEL_DEFINE);
soundvo[k] = *(scriptptr-1);
g_sounds[k].vo = *(scriptptr-1);
scriptptr--;
return 0;

View File

@ -723,198 +723,198 @@ static void DoThisProjectile(int iSet, int lVar1, int lLabelID, int lVar2)
{
case PROJ_WORKSLIKE:
if (iSet)
thisprojectile[proj].workslike=lValue;
hittype[proj].projectile.workslike=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].workslike, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.workslike, g_i, g_p);
break;
case PROJ_SPAWNS:
if (iSet)
thisprojectile[proj].spawns=lValue;
hittype[proj].projectile.spawns=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].spawns, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.spawns, g_i, g_p);
break;
case PROJ_SXREPEAT:
if (iSet)
thisprojectile[proj].sxrepeat=lValue;
hittype[proj].projectile.sxrepeat=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].sxrepeat, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.sxrepeat, g_i, g_p);
break;
case PROJ_SYREPEAT:
if (iSet)
thisprojectile[proj].syrepeat=lValue;
hittype[proj].projectile.syrepeat=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].syrepeat, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.syrepeat, g_i, g_p);
break;
case PROJ_SOUND:
if (iSet)
thisprojectile[proj].sound=lValue;
hittype[proj].projectile.sound=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].sound, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.sound, g_i, g_p);
break;
case PROJ_ISOUND:
if (iSet)
thisprojectile[proj].isound=lValue;
hittype[proj].projectile.isound=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].isound, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.isound, g_i, g_p);
break;
case PROJ_VEL:
if (iSet)
thisprojectile[proj].vel=lValue;
hittype[proj].projectile.vel=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].vel, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.vel, g_i, g_p);
break;
case PROJ_EXTRA:
if (iSet)
thisprojectile[proj].extra=lValue;
hittype[proj].projectile.extra=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].extra, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.extra, g_i, g_p);
break;
case PROJ_DECAL:
if (iSet)
thisprojectile[proj].decal=lValue;
hittype[proj].projectile.decal=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].decal, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.decal, g_i, g_p);
break;
case PROJ_TRAIL:
if (iSet)
thisprojectile[proj].trail=lValue;
hittype[proj].projectile.trail=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].trail, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.trail, g_i, g_p);
break;
case PROJ_TXREPEAT:
if (iSet)
thisprojectile[proj].txrepeat=lValue;
hittype[proj].projectile.txrepeat=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].txrepeat, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.txrepeat, g_i, g_p);
break;
case PROJ_TYREPEAT:
if (iSet)
thisprojectile[proj].tyrepeat=lValue;
hittype[proj].projectile.tyrepeat=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].tyrepeat, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.tyrepeat, g_i, g_p);
break;
case PROJ_TOFFSET:
if (iSet)
thisprojectile[proj].toffset=lValue;
hittype[proj].projectile.toffset=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].toffset, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.toffset, g_i, g_p);
break;
case PROJ_TNUM:
if (iSet)
thisprojectile[proj].tnum=lValue;
hittype[proj].projectile.tnum=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].tnum, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.tnum, g_i, g_p);
break;
case PROJ_DROP:
if (iSet)
thisprojectile[proj].drop=lValue;
hittype[proj].projectile.drop=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].drop, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.drop, g_i, g_p);
break;
case PROJ_CSTAT:
if (iSet)
thisprojectile[proj].cstat=lValue;
hittype[proj].projectile.cstat=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].cstat, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.cstat, g_i, g_p);
break;
case PROJ_CLIPDIST:
if (iSet)
thisprojectile[proj].clipdist=lValue;
hittype[proj].projectile.clipdist=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].clipdist, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.clipdist, g_i, g_p);
break;
case PROJ_SHADE:
if (iSet)
thisprojectile[proj].shade=lValue;
hittype[proj].projectile.shade=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].shade, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.shade, g_i, g_p);
break;
case PROJ_XREPEAT:
if (iSet)
thisprojectile[proj].xrepeat=lValue;
hittype[proj].projectile.xrepeat=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].xrepeat, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.xrepeat, g_i, g_p);
break;
case PROJ_YREPEAT:
if (iSet)
thisprojectile[proj].yrepeat=lValue;
hittype[proj].projectile.yrepeat=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].yrepeat, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.yrepeat, g_i, g_p);
break;
case PROJ_PAL:
if (iSet)
thisprojectile[proj].pal=lValue;
hittype[proj].projectile.pal=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].pal, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.pal, g_i, g_p);
break;
case PROJ_EXTRA_RAND:
if (iSet)
thisprojectile[proj].extra_rand=lValue;
hittype[proj].projectile.extra_rand=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].extra_rand, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.extra_rand, g_i, g_p);
break;
case PROJ_HITRADIUS:
if (iSet)
thisprojectile[proj].hitradius=lValue;
hittype[proj].projectile.hitradius=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].hitradius, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.hitradius, g_i, g_p);
break;
case PROJ_VEL_MULT:
if (iSet)
thisprojectile[proj].velmult=lValue;
hittype[proj].projectile.velmult=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].velmult, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.velmult, g_i, g_p);
break;
case PROJ_OFFSET:
if (iSet)
thisprojectile[proj].offset=lValue;
hittype[proj].projectile.offset=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].offset, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.offset, g_i, g_p);
break;
case PROJ_BOUNCES:
if (iSet)
thisprojectile[proj].bounces=lValue;
hittype[proj].projectile.bounces=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].bounces, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.bounces, g_i, g_p);
break;
case PROJ_BSOUND:
if (iSet)
thisprojectile[proj].bsound=lValue;
hittype[proj].projectile.bsound=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].bsound, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.bsound, g_i, g_p);
break;
case PROJ_RANGE:
if (iSet)
thisprojectile[proj].range=lValue;
hittype[proj].projectile.range=lValue;
else
SetGameVarID(lVar2, thisprojectile[proj].range, g_i, g_p);
SetGameVarID(lVar2, hittype[proj].projectile.range, g_i, g_p);
break;
default:
@ -6429,7 +6429,7 @@ static int parse(void)
case CON_IFNOSOUNDS:
for (j=1;j<NUM_SOUNDS;j++)
if (SoundOwner[j][0].i == g_i)
if (g_sounds[j].SoundOwner[0].i == g_i)
break;
parseifelse(j == NUM_SOUNDS);
@ -6437,7 +6437,7 @@ static int parse(void)
case CON_SPRITEFLAGS:
insptr++;
actorspriteflags[g_i] = GetGameVarID(*insptr++, g_i, g_p);
hittype[g_i].flags = GetGameVarID(*insptr++, g_i, g_p);
break;
case CON_GETCURRADDRESS:
@ -6548,13 +6548,6 @@ void execute(int iActor,int iPlayer,long lDist)
{
move();
#if 0
sprpos[g_i].x = g_sp->x;
sprpos[g_i].y = g_sp->y;
sprpos[g_i].z = g_sp->z;
sprpos[g_i].ang = g_sp->ang;
#endif
if (ud.angleinterpolation)
{
temp = (g_sp->ang & 2047) - sprpos[g_i].ang;

View File

@ -37,15 +37,16 @@ static void FreeGameVars(void)
// AddLog("FreeGameVars");
for (i=0;i<MAXGAMEVARS;i++)
{
aGameVars[i].lValue=0;
if (aGameVars[i].szLabel)
Bfree(aGameVars[i].szLabel);
aGameVars[i].szLabel=NULL;
aGameVars[i].dwFlags=0;
// aGameVars[i].lValue=0;
// if (aGameVars[i].szLabel)
//Bfree(aGameVars[i].szLabel);
// aGameVars[i].szLabel=NULL;
// aGameVars[i].dwFlags=0;
if (aGameVars[i].plValues)
Bfree(aGameVars[i].plValues);
aGameVars[i].plValues=NULL;
aGameVars[i].bReset=1;
}
iGameVarCount=0;
return;
@ -63,15 +64,13 @@ static void ClearGameVars(void)
aGameVars[i].lValue=0;
if (aGameVars[i].szLabel)
Bfree(aGameVars[i].szLabel);
if (aDefaultGameVars[i].szLabel)
Bfree(aDefaultGameVars[i].szLabel);
aGameVars[i].szLabel=NULL;
aDefaultGameVars[i].szLabel=NULL;
aGameVars[i].dwFlags=0;
if (aGameVars[i].plValues)
Bfree(aGameVars[i].plValues);
aGameVars[i].plValues=NULL;
aGameVars[i].bReset=1;
}
iGameVarCount=0;
return;
@ -91,7 +90,7 @@ int ReadGameVars(long fil)
if (kdfread(&iGameVarCount,sizeof(iGameVarCount),1,fil) != 1) goto corrupt;
for (i=0;i<iGameVarCount;i++)
{
if (kdfread(&(aGameVars[i]),sizeof(MATTGAMEVAR),1,fil) != 1) goto corrupt;
if (kdfread(&(aGameVars[i]),sizeof(gamevar_t),1,fil) != 1) goto corrupt;
aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(char));
if (kdfread(aGameVars[i].szLabel,sizeof(char) * MAXVARLABEL, 1, fil) != 1) goto corrupt;
}
@ -178,7 +177,7 @@ void SaveGameVars(FILE *fil)
for (i=0;i<iGameVarCount;i++)
{
dfwrite(&(aGameVars[i]),sizeof(MATTGAMEVAR),1,fil);
dfwrite(&(aGameVars[i]),sizeof(gamevar_t),1,fil);
dfwrite(aGameVars[i].szLabel,sizeof(char) * MAXVARLABEL, 1, fil);
}
@ -279,8 +278,8 @@ void ResetGameVars(void)
// aDefaultGameVars[i].lValue
// );
//AddLog(g_szBuf);
if (aDefaultGameVars[i].szLabel != NULL)
AddGameVar(aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue,aDefaultGameVars[i].dwFlags);
if (aGameVars[i].szLabel != NULL && aGameVars[i].bReset)
AddGameVar(aGameVars[i].szLabel,aGameVars[i].lValue,aGameVars[i].dwFlags);
}
}
@ -300,7 +299,7 @@ int AddGameVar(const char *pszLabel, long lValue, unsigned long dwFlags)
}
for (i=0;i<iGameVarCount;i++)
{
if (aGameVars[i].szLabel != NULL)
if (aGameVars[i].szLabel != NULL && !aGameVars[i].bReset)
{
if (Bstrcmp(pszLabel,aGameVars[i].szLabel) == 0)
{
@ -343,22 +342,18 @@ int AddGameVar(const char *pszLabel, long lValue, unsigned long dwFlags)
//}
// if existing is system, they only get to change default value....
aGameVars[i].lValue=lValue;
aDefaultGameVars[i].lValue=lValue;
aGameVars[i].lDefault=lValue;
}
else
{
if (aGameVars[i].szLabel == NULL)
aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(char));
Bstrcpy(aGameVars[i].szLabel,pszLabel);
if (aGameVars[i].szLabel != pszLabel)
Bstrcpy(aGameVars[i].szLabel,pszLabel);
aGameVars[i].dwFlags=dwFlags;
aGameVars[i].lValue=lValue;
if (aDefaultGameVars[i].szLabel == NULL)
{
aDefaultGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(char));
Bstrcpy(aDefaultGameVars[i].szLabel,pszLabel);
}
aDefaultGameVars[i].dwFlags=dwFlags;
aDefaultGameVars[i].lValue=lValue;
aGameVars[i].lDefault=lValue;
aGameVars[i].bReset=0;
}
if (i==iGameVarCount)
@ -403,7 +398,7 @@ void ResetActorGameVars(int iActor)
if ((aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR) && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_NODEFAULT))
{
// OSD_Printf("reset %s (%d) to %s (%d)\n",aGameVars[i].szLabel,aGameVars[i].plValues[iActor],aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue);
aGameVars[i].plValues[iActor]=aDefaultGameVars[i].lValue;
aGameVars[i].plValues[iActor]=aGameVars[i].lDefault;
}
}

View File

@ -33,8 +33,7 @@ long neartaghitdist,lockclock,start_armour_amount;
long gc=176;
// long temp_data[MAXSPRITES][6];
weaponhit hittype[MAXSPRITES];
spriteinterpolate sprpos[MAXSPRITES];
actordata_t hittype[MAXSPRITES];
short spriteq[1024],spriteqloc,spriteqamount=64;
animwalltype animwall[MAXANIMWALLS];
@ -65,12 +64,6 @@ char gametype_names[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY"
int gametype_flags[MAXGAMETYPES] = {4+8+16+1024+2048+16384,1+2+32+64+128+256+512+4096+8192+32768,2+4+8+16+16384,4+8+16+1024+2048+16384+65536+131072,2+4+8+16+16384+65536+131072};
char num_gametypes = 5;
long soundsiz[NUM_SOUNDS];
short soundps[NUM_SOUNDS],soundpe[NUM_SOUNDS],soundvo[NUM_SOUNDS];
char soundm[NUM_SOUNDS],soundpr[NUM_SOUNDS];
char sounds[NUM_SOUNDS][BMAX_PATH];
short title_zoom;
int framerate;
@ -80,8 +73,7 @@ char num_volumes = 3;
short timer=120;
//fx_device device;
SAMPLE Sound[ NUM_SOUNDS ];
SOUNDOWNER SoundOwner[NUM_SOUNDS][4];
sound_t g_sounds[ NUM_SOUNDS ];
char numplayersprites,loadfromgrouponly=0,earthquaketime;
@ -176,7 +168,7 @@ long *curipos[MAXINTERPOLATIONS];
int nextvoxid = 0;
int spriteflags[MAXTILES], actorspriteflags[MAXSPRITES];
int spriteflags[MAXTILES];
proj_struct projectile[MAXTILES], thisprojectile[MAXSPRITES], defaultprojectile[MAXTILES];

View File

@ -494,7 +494,7 @@ int shoot(int i,int atwith)
if (hitwall >= 0 || hitspr >= 0)
{
j = EGS(hitsect,hitx,hity,hitz,atwith,-15,0,0,sa,32,0,i,4);
thisprojectile[j].workslike = projectile[sprite[j].picnum].workslike;
hittype[j].projectile.workslike = projectile[sprite[j].picnum].workslike;
sprite[j].extra = projectile[atwith].extra;
if (projectile[atwith].extra_rand > 0)
sprite[j].extra += (TRAND&projectile[atwith].extra_rand);
@ -963,7 +963,7 @@ DOSKIPBULLETHOLE:
if (projectile[atwith].clipdist >= 0) sprite[j].clipdist = projectile[atwith].clipdist;
else sprite[j].clipdist = 40;
Bmemcpy(&thisprojectile[j], &projectile[sprite[j].picnum], sizeof(projectile[sprite[j].picnum]));
Bmemcpy(&hittype[j].projectile, &projectile[sprite[j].picnum], sizeof(projectile[sprite[j].picnum]));
// sa = s->ang+32-(TRAND&63);
// zvel = oldzvel+512-(TRAND&1023);

View File

@ -278,20 +278,20 @@ static int getsound(unsigned int num)
if (num >= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0;
if (ud.config.FXDevice < 0) return 0;
if (!sounds[num][0]) return 0;
fp = kopen4load(sounds[num],loadfromgrouponly);
if (!g_sounds[num].filename) return 0;
fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
if (fp == -1) return 0;
l = kfilelength(fp);
soundsiz[num] = l;
g_sounds[num].soundsiz = l;
if ((ud.level_number == 0 && ud.volume_number == 0 && (num == 189 || num == 232 || num == 99 || num == 233 || num == 17)) ||
(l < 12288))
{
Sound[num].lock = 199;
allocache((long *)&Sound[num].ptr,l,(char *)&Sound[num].lock);
if (Sound[num].ptr != NULL)
kread(fp, Sound[num].ptr , l);
g_sounds[num].lock = 199;
allocache((long *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock);
if (g_sounds[num].ptr != NULL)
kread(fp, g_sounds[num].ptr , l);
}
kclose(fp);
return 1;
@ -305,7 +305,7 @@ static void precachenecessarysounds(void)
j = 0;
for (i=0;i<NUM_SOUNDS;i++)
if (Sound[i].ptr == 0)
if (g_sounds[i].ptr == 0)
{
j++;
if ((j&7) == 0)

View File

@ -293,7 +293,7 @@ int loadplayer(int spot)
}
if (kdfread(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&hittype[0],sizeof(weaponhit),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&hittype[0],sizeof(actordata_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
for (i=0;i<MAXSPRITES;i++)
{
@ -352,10 +352,8 @@ int loadplayer(int spot)
if (kdfread(&projectile[0],sizeof(proj_struct),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&defaultprojectile[0],sizeof(proj_struct),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&thisprojectile[0],sizeof(proj_struct),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&spriteflags[0],sizeof(spriteflags[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&actorspriteflags[0],sizeof(actorspriteflags[0]),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
@ -694,7 +692,7 @@ int saveplayer(int spot)
}
dfwrite(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil);
dfwrite(&hittype[0],sizeof(weaponhit),MAXSPRITES,fil);
dfwrite(&hittype[0],sizeof(actordata_t),MAXSPRITES,fil);
for (i=0;i<MAXSPRITES;i++)
{
@ -748,10 +746,8 @@ int saveplayer(int spot)
dfwrite(&projectile[0],sizeof(proj_struct),MAXTILES,fil);
dfwrite(&defaultprojectile[0],sizeof(proj_struct),MAXTILES,fil);
dfwrite(&thisprojectile[0],sizeof(proj_struct),MAXSPRITES,fil);
dfwrite(&spriteflags[0],sizeof(spriteflags[0]),MAXTILES,fil);
dfwrite(&actorspriteflags[0],sizeof(actorspriteflags[0]),MAXSPRITES,fil);
dfwrite(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil);

View File

@ -46,7 +46,7 @@ int callsound(int sn,int whatsprite)
if (T1 == 0)
{
if ((soundm[SLT]&16) == 0)
if ((g_sounds[SLT].m&16) == 0)
{
if (SLT)
{
@ -63,7 +63,7 @@ int callsound(int sn,int whatsprite)
else if (SHT < NUM_SOUNDS)
{
if (SHT) spritesound(SHT,whatsprite);
if ((soundm[SLT]&1) || (SHT && SHT != SLT))
if ((g_sounds[SLT].m&1) || (SHT && SHT != SLT))
stopspritesound(SLT,T6);
T6 = whatsprite;
T1 = 0;
@ -1576,7 +1576,7 @@ int checkhitswitch(int snum,long w,int switchtype)
}
else if (hitag != 0)
{
if (switchtype == 1 && (soundm[hitag]&4) == 0)
if (switchtype == 1 && (g_sounds[hitag].m&4) == 0)
xyzsound(hitag,w,sx,sy,g_player[snum].ps->posz);
else spritesound(hitag,g_player[snum].ps->i);
}
@ -1623,7 +1623,7 @@ void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith)
wal = &wall[dawallnum];
if (wal->overpicnum == MIRROR && checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (thisprojectile[spr].workslike & PROJECTILE_FLAG_RPG))
if (wal->overpicnum == MIRROR && checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (hittype[spr].projectile.workslike & PROJECTILE_FLAG_RPG))
{
lotsofglass(spr,dawallnum,70);
wal->cstat &= ~16;
@ -2025,7 +2025,7 @@ void checkhitsprite(int i,int sn)
i &= (MAXSPRITES-1);
if (checkspriteflags(sn,SPRITE_FLAG_PROJECTILE))
if (thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG)
if (hittype[sn].projectile.workslike & PROJECTILE_FLAG_RPG)
rpg = 1;
switchpicnum = PN;
if ((PN > WATERFOUNTAIN)&&(PN < WATERFOUNTAIN+3))

View File

@ -233,22 +233,22 @@ int loadsound(unsigned int num)
if (num >= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0;
if (ud.config.FXDevice < 0) return 0;
fp = kopen4load(sounds[num],loadfromgrouponly);
fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
if (fp == -1)
{
// Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num);
// FTA(113,g_player[myconnectindex].ps);
initprintf("Sound %s(#%d) not found.\n",sounds[num],num);
initprintf("Sound %s(#%d) not found.\n",g_sounds[num].filename,num);
return 0;
}
l = kfilelength(fp);
soundsiz[num] = l;
g_sounds[num].soundsiz = l;
Sound[num].lock = 200;
g_sounds[num].lock = 200;
allocache((long *)&Sound[num].ptr,l,(char *)&Sound[num].lock);
kread(fp, Sound[num].ptr , l);
allocache((long *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock);
kread(fp, g_sounds[num].ptr , l);
kclose(fp);
return 1;
}
@ -263,28 +263,28 @@ int xyzsound(int num,int i,long x,long y,long z)
if (num >= NUM_SOUNDS ||
ud.config.FXDevice < 0 ||
((soundm[num]&8) && ud.lockout) ||
((g_sounds[num].m&8) && ud.lockout) ||
ud.config.SoundToggle == 0 ||
Sound[num].num > 3 ||
FX_VoiceAvailable(soundpr[num]) == 0 ||
g_sounds[num].num > 3 ||
FX_VoiceAvailable(g_sounds[num].pr) == 0 ||
(g_player[myconnectindex].ps->timebeforeexit > 0 && g_player[myconnectindex].ps->timebeforeexit <= 26*3) ||
g_player[myconnectindex].ps->gm&MODE_MENU) return -1;
if (soundm[num]&128)
if (g_sounds[num].m&128)
{
sound(num);
return 0;
}
if (soundm[num]&4)
if (g_sounds[num].m&4)
{
if (ud.config.VoiceToggle==0)
return -1;
else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && ud.config.VoiceToggle!=2)
return -1;
for (j=0;j<NUM_SOUNDS;j++)
for (k=0;k<Sound[j].num;k++)
if ((Sound[j].num > 0) && (soundm[j]&4))
for (k=0;k<g_sounds[j].num;k++)
if ((g_sounds[j].num > 0) && (g_sounds[j].m&4))
return -1;
}
@ -296,11 +296,11 @@ int xyzsound(int num,int i,long x,long y,long z)
sndist = FindDistance3D((cx-x),(cy-y),(cz-z)>>4);
if (i >= 0 && (soundm[num]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
if (i >= 0 && (g_sounds[num].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
sndist = divscale14(sndist,(SHT+1));
pitchs = soundps[num];
pitche = soundpe[num];
pitchs = g_sounds[num].ps;
pitche = g_sounds[num].pe;
cx = klabs(pitche-pitchs);
if (cx)
@ -311,7 +311,7 @@ int xyzsound(int num,int i,long x,long y,long z)
}
else pitch = pitchs;
sndist += soundvo[num];
sndist += g_sounds[num].vo;
if (sndist < 0) sndist = 0;
if (sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,SX,SY,SZ-(24<<8),SECT))
sndist += sndist>>5;
@ -327,7 +327,7 @@ int xyzsound(int num,int i,long x,long y,long z)
pitch -= 1024;
break;
default:
if (sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (soundm[num]&4) == 0)
if (sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0)
pitch = -768;
if (sndist > 31444 && PN != MUSICANDSFX)
return -1;
@ -336,10 +336,10 @@ int xyzsound(int num,int i,long x,long y,long z)
if (g_player[screenpeek].ps->sound_pitch) pitch += g_player[screenpeek].ps->sound_pitch;
if (Sound[num].num > 0 && PN != MUSICANDSFX)
if (g_sounds[num].num > 0 && PN != MUSICANDSFX)
{
if (SoundOwner[num][0].i == i) stopsound(num);
else if (Sound[num].num > 1) stopsound(num);
if (g_sounds[num].SoundOwner[0].i == i) stopsound(num);
else if (g_sounds[num].num > 1) stopsound(num);
else if (badguy(&sprite[i]) && sprite[i].extra <= 0) stopsound(num);
}
@ -354,52 +354,52 @@ int xyzsound(int num,int i,long x,long y,long z)
sndang &= 2047;
}
if (Sound[num].ptr == 0)
if (g_sounds[num].ptr == 0)
{
if (loadsound(num) == 0) return 0;
}
else
{
if (Sound[num].lock < 200)
Sound[num].lock = 200;
else Sound[num].lock++;
if (g_sounds[num].lock < 200)
g_sounds[num].lock = 200;
else g_sounds[num].lock++;
}
if (soundm[num]&16) sndist = 0;
if (g_sounds[num].m&16) sndist = 0;
if (sndist < ((255-LOUDESTVOLUME)<<6))
sndist = ((255-LOUDESTVOLUME)<<6);
if (soundm[num]&1)
if (g_sounds[num].m&1)
{
unsigned short start;
if (Sound[num].num > 0) return -1;
if (g_sounds[num].num > 0) return -1;
start = *(unsigned short *)(Sound[num].ptr + 0x14);
start = *(unsigned short *)(g_sounds[num].ptr + 0x14);
if (*Sound[num].ptr == 'C')
voice = FX_PlayLoopedVOC(Sound[num].ptr, start, start + soundsiz[num],
pitch,sndist>>6,sndist>>6,0,soundpr[num],num);
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
else
voice = FX_PlayLoopedWAV(Sound[num].ptr, start, start + soundsiz[num],
pitch,sndist>>6,sndist>>6,0,soundpr[num],num);
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
}
else
{
if (*Sound[num].ptr == 'C')
voice = FX_PlayVOC3D(Sound[ num ].ptr,pitch,sndang>>6,sndist>>6, soundpr[num], num);
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
else
voice = FX_PlayWAV3D(Sound[ num ].ptr,pitch,sndang>>6,sndist>>6, soundpr[num], num);
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
}
if (voice > FX_Ok)
{
SoundOwner[num][Sound[num].num].i = i;
SoundOwner[num][Sound[num].num].voice = voice;
Sound[num].num++;
g_sounds[num].SoundOwner[g_sounds[num].num].i = i;
g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice;
g_sounds[num].num++;
}
else Sound[num].lock--;
else g_sounds[num].lock--;
return (voice);
}
@ -411,17 +411,17 @@ void sound(int num)
if (ud.config.FXDevice < 0) return;
if (ud.config.SoundToggle==0) return;
if (ud.config.VoiceToggle==0 && (soundm[num]&4)) return;
if ((soundm[num]&8) && ud.lockout) return;
if (FX_VoiceAvailable(soundpr[num]) == 0) return;
if (num > NUM_SOUNDS-1 || !sounds[num])
if (ud.config.VoiceToggle==0 && (g_sounds[num].m&4)) return;
if ((g_sounds[num].m&8) && ud.lockout) return;
if (FX_VoiceAvailable(g_sounds[num].pr) == 0) return;
if (num > NUM_SOUNDS-1 || !g_sounds[num].filename)
{
OSD_Printf("WARNING: invalid sound #%d\n",num);
return;
}
pitchs = soundps[num];
pitche = soundpe[num];
pitchs = g_sounds[num].ps;
pitche = g_sounds[num].pe;
cx = klabs(pitche-pitchs);
if (cx)
@ -432,42 +432,42 @@ void sound(int num)
}
else pitch = pitchs;
if (Sound[num].ptr == 0)
if (g_sounds[num].ptr == 0)
{
if (loadsound(num) == 0) return;
}
else
{
if (Sound[num].lock < 200)
Sound[num].lock = 200;
else Sound[num].lock++;
if (g_sounds[num].lock < 200)
g_sounds[num].lock = 200;
else g_sounds[num].lock++;
}
if (soundm[num]&1)
if (g_sounds[num].m&1)
{
if (*Sound[num].ptr == 'C')
if (*g_sounds[num].ptr == 'C')
{
start = (long)*(unsigned short *)(Sound[num].ptr + 0x14);
voice = FX_PlayLoopedVOC(Sound[num].ptr, start, start + soundsiz[num],
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,soundpr[num],num);
start = (long)*(unsigned short *)(g_sounds[num].ptr + 0x14);
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
else
{
start = (long)*(unsigned short *)(Sound[num].ptr + 0x14);
voice = FX_PlayLoopedWAV(Sound[num].ptr, start, start + soundsiz[num],
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,soundpr[num],num);
start = (long)*(unsigned short *)(g_sounds[num].ptr + 0x14);
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
}
else
{
if (*Sound[num].ptr == 'C')
voice = FX_PlayVOC3D(Sound[ num ].ptr, pitch,0,255-LOUDESTVOLUME,soundpr[num], num);
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayVOC3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
else
voice = FX_PlayWAV3D(Sound[ num ].ptr, pitch,0,255-LOUDESTVOLUME,soundpr[num], num);
voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
}
if (voice > FX_Ok) return;
Sound[num].lock--;
g_sounds[num].lock--;
}
int spritesound(unsigned int num, int i)
@ -483,9 +483,9 @@ void stopspritesound(int num, int i)
void stopsound(int num)
{
if (Sound[num].num > 0)
if (g_sounds[num].num > 0)
{
FX_StopSound(SoundOwner[num][Sound[num].num-1].voice);
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
testcallback(num);
}
}
@ -494,13 +494,13 @@ void stopenvsound(int num,int i)
{
int j, k;
if (Sound[num].num > 0)
if (g_sounds[num].num > 0)
{
k = Sound[num].num;
k = g_sounds[num].num;
for (j=0;j<k;j++)
if (SoundOwner[num][j].i == i)
if (g_sounds[num].SoundOwner[j].i == i)
{
FX_StopSound(SoundOwner[num][j].voice);
FX_StopSound(g_sounds[num].SoundOwner[j].voice);
break;
}
}
@ -530,9 +530,9 @@ void pan3dsound(void)
ca = sprite[ud.camerasprite].ang;
}
for (j=0;j<NUM_SOUNDS;j++) for (k=0;k<Sound[j].num;k++)
for (j=0;j<NUM_SOUNDS;j++) for (k=0;k<g_sounds[j].num;k++)
{
i = SoundOwner[j][k].i;
i = g_sounds[j].SoundOwner[k].i;
sx = sprite[i].x;
sy = sprite[i].y;
@ -548,11 +548,11 @@ void pan3dsound(void)
sndang = 2048 + ca - getangle(cx-sx,cy-sy);
sndang &= 2047;
sndist = FindDistance3D((cx-sx),(cy-sy),(cz-sz)>>4);
if (i >= 0 && (soundm[j]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
if (i >= 0 && (g_sounds[j].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9)
sndist = divscale14(sndist,(SHT+1));
}
sndist += soundvo[j];
sndist += g_sounds[j].vo;
if (sndist < 0) sndist = 0;
if (sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,sx,sy,sz-(24<<8),SECT))
@ -576,13 +576,13 @@ void pan3dsound(void)
}
}
if (Sound[j].ptr == 0 && loadsound(j) == 0) continue;
if (soundm[j]&16) sndist = 0;
if (g_sounds[j].ptr == 0 && loadsound(j) == 0) continue;
if (g_sounds[j].m&16) sndist = 0;
if (sndist < ((255-LOUDESTVOLUME)<<6))
sndist = ((255-LOUDESTVOLUME)<<6);
FX_Pan3D(SoundOwner[j][k].voice,sndang>>6,sndist>>6);
FX_Pan3D(g_sounds[j].SoundOwner[k].voice,sndang>>6,sndist>>6);
}
}
@ -597,31 +597,31 @@ void testcallback(unsigned long num)
return;
}
tempk = Sound[num].num;
tempk = g_sounds[num].num;
if (tempk > 0)
{
if ((soundm[num]&16) == 0)
if ((g_sounds[num].m&16) == 0)
for (tempj=0;tempj<tempk;tempj++)
{
tempi = SoundOwner[num][tempj].i;
tempi = g_sounds[num].SoundOwner[tempj].i;
if (sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999)
{
hittype[tempi].temp_data[0] = 0;
if ((tempj + 1) < tempk)
{
SoundOwner[num][tempj].voice = SoundOwner[num][tempk-1].voice;
SoundOwner[num][tempj].i = SoundOwner[num][tempk-1].i;
g_sounds[num].SoundOwner[tempj].voice = g_sounds[num].SoundOwner[tempk-1].voice;
g_sounds[num].SoundOwner[tempj].i = g_sounds[num].SoundOwner[tempk-1].i;
}
break;
}
}
Sound[num].num--;
SoundOwner[num][tempk-1].i = -1;
g_sounds[num].num--;
g_sounds[num].SoundOwner[tempk-1].i = -1;
}
Sound[num].lock--;
g_sounds[num].lock--;
}
void clearsoundlocks(void)
@ -629,8 +629,8 @@ void clearsoundlocks(void)
long i;
for (i=0;i<NUM_SOUNDS;i++)
if (Sound[i].lock >= 200)
Sound[i].lock = 199;
if (g_sounds[i].lock >= 200)
g_sounds[i].lock = 199;
for (i=0;i<11;i++)
if (lumplockbyte[i] >= 200)
@ -640,16 +640,16 @@ void clearsoundlocks(void)
int isspritemakingsound(int i, int num)
{
if (num < 0) num=0; // FIXME
return (Sound[num].num > 0);
return (g_sounds[num].num > 0);
}
int issoundplaying(int i, int num)
{
if (i == -1)
{
if (Sound[num].lock == 200)
if (g_sounds[num].lock == 200)
return 1;
return 0;
}
return(Sound[num].num);
return(g_sounds[num].num);
}