diff --git a/polymer/eduke32/eduke32.vcproj b/polymer/eduke32/eduke32.vcproj
index 6d07530ed..499642d9e 100644
--- a/polymer/eduke32/eduke32.vcproj
+++ b/polymer/eduke32/eduke32.vcproj
@@ -649,10 +649,6 @@
RelativePath=".\source\startwin.game.h"
>
-
-
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);
}
}
diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c
index e95f6a9f2..836ee8ec5 100644
--- a/polymer/eduke32/source/astub.c
+++ b/polymer/eduke32/source/astub.c
@@ -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)))
{
diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h
index 84d34d92b..7142845e9 100644
--- a/polymer/eduke32/source/duke3d.h
+++ b/polymer/eduke32/source/duke3d.h
@@ -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
diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c
index f6f344888..4d5e4c54d 100644
--- a/polymer/eduke32/source/game.c
+++ b/polymer/eduke32/source/game.c
@@ -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)
diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c
index 9f60f55bc..b11ab10d1 100644
--- a/polymer/eduke32/source/gamedef.c
+++ b/polymer/eduke32/source/gamedef.c
@@ -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;
diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c
index 950f683dc..0077dce4b 100644
--- a/polymer/eduke32/source/gameexec.c
+++ b/polymer/eduke32/source/gameexec.c
@@ -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;jx;
- 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;
diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c
index ddbec9c10..2e6dc56fe 100755
--- a/polymer/eduke32/source/gamevars.c
+++ b/polymer/eduke32/source/gamevars.c
@@ -37,15 +37,16 @@ static void FreeGameVars(void)
// AddLog("FreeGameVars");
for (i=0;i= 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);
diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c
index 2cb21916d..4d45c3866 100644
--- a/polymer/eduke32/source/premap.c
+++ b/polymer/eduke32/source/premap.c
@@ -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;iposz);
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))
diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c
index b299c2b25..62481b838 100644
--- a/polymer/eduke32/source/sounds.c
+++ b/polymer/eduke32/source/sounds.c
@@ -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 0) && (soundm[j]&4))
+ for (k=0;k 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>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= 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);
}