Clean out tree... misc changes

git-svn-id: https://svn.eduke32.com/eduke32@1465 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-07-24 02:31:34 +00:00
parent ce3d64d971
commit 98a359f3e1
21 changed files with 182 additions and 293 deletions

View file

@ -49,8 +49,6 @@ $(OBJ)/scriplib.$o: $(SRC)/jmact/scriplib.c $(SRC)/jmact/scriplib.h $(SRC)/jmact
$(OBJ)/audiolib_fxstub.$o: $(SRC)/jaudiolib/audiolib_fxstub.c $(SRC)/jaudiolib/fx_man.h $(OBJ)/audiolib_fxstub.$o: $(SRC)/jaudiolib/audiolib_fxstub.c $(SRC)/jaudiolib/fx_man.h
$(OBJ)/audiolib_musicstub.$o: $(SRC)/jaudiolib/audiolib_musicstub.c $(SRC)/jaudiolib/music.h $(OBJ)/audiolib_musicstub.$o: $(SRC)/jaudiolib/audiolib_musicstub.c $(SRC)/jaudiolib/music.h
$(OBJ)/audiolib_fx_fmod.$o: $(SRC)/jaudiolib/audiolib_fx_fmod.c $(SRC)/jaudiolib/fx_man_fmod.h $(INC)/duke3d.h
$(OBJ)/mv_mix.$o: $(SRC)/jaudiolib/mv_mix.nasm $(OBJ)/mv_mix.$o: $(SRC)/jaudiolib/mv_mix.nasm
$(OBJ)/mv_mix16.$o: $(SRC)/jaudiolib/mv_mix16.nasm $(OBJ)/mv_mix16.$o: $(SRC)/jaudiolib/mv_mix16.nasm
$(OBJ)/mvreverb.$o: $(SRC)/jaudiolib/mvreverb.nasm $(OBJ)/mvreverb.$o: $(SRC)/jaudiolib/mvreverb.nasm

View file

@ -61,7 +61,6 @@ JMACTOBJ=$(OBJ)\util_lib.$o \
AUDIOLIB_FX_STUB=$(OBJ)\jaudiolib_fxstub.$o AUDIOLIB_FX_STUB=$(OBJ)\jaudiolib_fxstub.$o
AUDIOLIB_MUSIC_STUB=$(OBJ)\jaudiolib_musicstub.$o AUDIOLIB_MUSIC_STUB=$(OBJ)\jaudiolib_musicstub.$o
#AUDIOLIB_FX=$(OBJ)\jaudiolib_fx_fmod.$o
AUDIOLIB_FX=$(OBJ)\mv_mix.$o \ AUDIOLIB_FX=$(OBJ)\mv_mix.$o \
$(OBJ)\mv_mix16.$o \ $(OBJ)\mv_mix16.$o \
$(OBJ)\mvreverb.$o \ $(OBJ)\mvreverb.$o \

View file

@ -410,13 +410,13 @@ typedef struct {
int32_t x, y, z; int32_t x, y, z;
} vec3_t; } vec3_t;
#pragma pack(pop)
typedef struct { typedef struct {
vec3_t pos; vec3_t pos;
int16_t hitsprite, hitwall, hitsect; int16_t hitsprite, hitwall, hitsect;
} hitdata_t; } hitdata_t;
#pragma pack(pop)
int32_t preinitengine(void); // a partial setup of the engine used for launch windows int32_t preinitengine(void); // a partial setup of the engine used for launch windows
int32_t initengine(void); int32_t initengine(void);
void uninitengine(void); void uninitengine(void);

View file

@ -5155,7 +5155,7 @@ void clearmidstatbar16(void)
void clearministatbar16(void) void clearministatbar16(void)
{ {
int32_t i, col = whitecol - 16; int32_t i, col = whitecol - 21;
char tempbuf[32]; char tempbuf[32];
begindrawing(); begindrawing();
@ -6065,7 +6065,7 @@ void showsectordata(int16_t sectnum)
row = 2; row = 2;
begindrawing(); begindrawing();
col = whitecol - 16; col = whitecol - 21;
for (i=ydim-(row*96)-STATUS2DSIZ+16; i<ydim-STATUS2DSIZ2-8; i++) for (i=ydim-(row*96)-STATUS2DSIZ+16; i<ydim-STATUS2DSIZ2-8; i++)
{ {
// drawline256(0, i<<12, xdim<<12, i<<12, col); // drawline256(0, i<<12, xdim<<12, i<<12, col);
@ -6153,7 +6153,7 @@ void showwalldata(int16_t wallnum)
row = 2; row = 2;
begindrawing(); begindrawing();
col = whitecol - 16; col = whitecol - 21;
for (i=ydim-(row*80)-STATUS2DSIZ+16; i<ydim-STATUS2DSIZ2-8; i++) for (i=ydim-(row*80)-STATUS2DSIZ+16; i<ydim-STATUS2DSIZ2-8; i++)
{ {
// drawline256(0, i<<12, xdim<<12, i<<12, col); // drawline256(0, i<<12, xdim<<12, i<<12, col);
@ -6243,7 +6243,7 @@ void showspritedata(int16_t spritenum)
row = 2; row = 2;
begindrawing(); begindrawing();
col = whitecol - 16; col = whitecol - 21;
for (i=ydim-(row*80)-STATUS2DSIZ+16; i<ydim-STATUS2DSIZ2-8; i++) for (i=ydim-(row*80)-STATUS2DSIZ+16; i<ydim-STATUS2DSIZ2-8; i++)
{ {
// drawline256(0, i<<12, xdim<<12, i<<12, col); // drawline256(0, i<<12, xdim<<12, i<<12, col);

View file

@ -17,7 +17,6 @@
#include "compat.h" #include "compat.h"
#include "baselayer.h" #include "baselayer.h"
//STL //STL
//#include <vector> //#include <vector>
//#include "buildqueue.h" //#include "buildqueue.h"
@ -28,6 +27,18 @@
#define PLATFORM_WIN32 1 #define PLATFORM_WIN32 1
#else #else
#define PLATFORM_UNIX 1 #define PLATFORM_UNIX 1
#include <sys/time.h>
static int32_t GetTickCount(void)
{
struct timeval tv;
int32_t ti;
if (gettimeofday(&tv,NULL) < 0) return 0;
// tv is sec.usec, GTC gives msec
ti = tv.tv_sec * 1000;
ti += tv.tv_usec / 1000;
return ti;
}
#endif #endif
#define UDP_NETWORKING 1 #define UDP_NETWORKING 1
@ -1209,10 +1220,8 @@ static int32_t connect_to_server(gcomtype *gcom, int32_t myip)
while (my_id == 0) /* player number is based on id, low to high. */ while (my_id == 0) /* player number is based on id, low to high. */
{ {
/* struct timeval tv; my_id = (unsigned short)GetTickCount();
gettimeofday(&tv, NULL); // my_id = (uint16_t) rand();
my_id = (unsigned short)tv.tv_usec; //HACK */
my_id = (uint16_t) rand();
} }
initprintf("network: Using 0x%X as client ID\n", my_id); initprintf("network: Using 0x%X as client ID\n", my_id);

View file

@ -1784,6 +1784,7 @@ static void polymer_freeboard(void)
} }
} }
#if 0
static void polymer_editorselect(void) static void polymer_editorselect(void)
{ {
// int32_t i, n; // int32_t i, n;
@ -1870,6 +1871,7 @@ static void polymer_editorselect(void)
searchit = 0; searchit = 0;
} }
} }
#endif // 0
// vvv --- improved editor aiming // vvv --- improved editor aiming
@ -5191,8 +5193,8 @@ static void polymer_initrendertargets(int32_t count)
bglTexImage2D(prrts[i].target, 0, GL_RGBA, prrts[i].xdim, prrts[i].ydim, 0, GL_RGBA, GL_SHORT, NULL); bglTexImage2D(prrts[i].target, 0, GL_RGBA, prrts[i].xdim, prrts[i].ydim, 0, GL_RGBA, GL_SHORT, NULL);
bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
} else { } else {
prrts[i].target = GL_TEXTURE_2D; prrts[i].target = GL_TEXTURE_2D;
prrts[i].xdim = 128 << pr_shadowdetail; prrts[i].xdim = 128 << pr_shadowdetail;
@ -5206,8 +5208,8 @@ static void polymer_initrendertargets(int32_t count)
bglTexImage2D(prrts[i].target, 0, GL_RGBA, prrts[i].xdim, prrts[i].ydim, 0, GL_RGBA, GL_SHORT, NULL); bglTexImage2D(prrts[i].target, 0, GL_RGBA, prrts[i].xdim, prrts[i].ydim, 0, GL_RGBA, GL_SHORT, NULL);
bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
} }
} }
@ -5217,8 +5219,8 @@ static void polymer_initrendertargets(int32_t count)
bglTexImage2D(prrts[i].target, 0, GL_DEPTH_COMPONENT, prrts[i].xdim, prrts[i].ydim, 0, GL_DEPTH_COMPONENT, GL_SHORT, NULL); bglTexImage2D(prrts[i].target, 0, GL_DEPTH_COMPONENT, prrts[i].xdim, prrts[i].ydim, 0, GL_DEPTH_COMPONENT, GL_SHORT, NULL);
bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST); bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST);
bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST); bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST);
bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
bglTexParameteri(prrts[i].target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); bglTexParameteri(prrts[i].target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
bglTexParameteri(prrts[i].target, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); bglTexParameteri(prrts[i].target, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
bglTexParameteri(prrts[i].target, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); bglTexParameteri(prrts[i].target, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA);

View file

@ -596,10 +596,6 @@
RelativePath=".\source\jaudiolib\fx_man.h" RelativePath=".\source\jaudiolib\fx_man.h"
> >
</File> </File>
<File
RelativePath=".\source\jaudiolib\fx_man_fmod.h"
>
</File>
<File <File
RelativePath=".\source\jaudiolib\interrup.h" RelativePath=".\source\jaudiolib\interrup.h"
> >
@ -656,10 +652,6 @@
<Filter <Filter
Name="Source Files" Name="Source Files"
> >
<File
RelativePath=".\source\jaudiolib\audiolib_fx_fmod.c"
>
</File>
<File <File
RelativePath=".\source\jaudiolib\audiolib_fxstub.c" RelativePath=".\source\jaudiolib\audiolib_fxstub.c"
> >

View file

@ -263,7 +263,7 @@ void G_PlayAnim(const char *fn,char t)
for (i=1; i<numframes; i++) for (i=1; i<numframes; i++)
{ {
if ((i > 4) && (totalclock > frametime + 45)) if ((i > 4) && (totalclock > frametime + 60))
{ {
OSD_Printf("WARNING: slowdown in %s, skipping playback\n",fn); OSD_Printf("WARNING: slowdown in %s, skipping playback\n",fn);
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;

View file

@ -312,12 +312,9 @@ struct savehead {
int32_t numplr,volnum,levnum,plrskl; int32_t numplr,volnum,levnum,plrskl;
char boardfn[BMAX_PATH]; char boardfn[BMAX_PATH];
}; };
#pragma pack(pop)
// the following struct is never saved off anywhere
// so we don't need to fuck with its packing
typedef struct { typedef struct {
int32_t camerax,cameray,cameraz; vec3_t camera;
int32_t const_visibility,uw_framerate; int32_t const_visibility,uw_framerate;
int32_t camera_time,folfvel,folavel,folx,foly,fola; int32_t camera_time,folfvel,folavel,folx,foly,fola;
int32_t reccnt,crosshairscale; int32_t reccnt,crosshairscale;
@ -343,15 +340,6 @@ typedef struct {
int16_t camerasprite,last_camsprite; int16_t camerasprite,last_camsprite;
int16_t last_level,secretlevel; int16_t last_level,secretlevel;
char overhead_on,last_overhead,showweapons;
char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,clipping;
char ridecule[10][40];
char savegame[10][22];
char pwlockout[128],rtsname[128];
char display_bonus_screen;
char show_level_text;
struct { struct {
int32_t UseJoystick; int32_t UseJoystick;
int32_t UseMouse; int32_t UseMouse;
@ -414,9 +402,16 @@ typedef struct {
int32_t LastUpdateCheck; int32_t LastUpdateCheck;
int32_t useprecache; int32_t useprecache;
} config; } config;
} user_defs;
#pragma pack(push,1) char overhead_on,last_overhead,showweapons;
char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,clipping;
char ridecule[10][40];
char savegame[10][22];
char pwlockout[128],rtsname[128];
char display_bonus_screen;
char show_level_text;
} user_defs;
typedef struct { typedef struct {
int32_t ox,oy,oz; int32_t ox,oy,oz;

View file

@ -236,7 +236,6 @@ extern void X_OnEvent(register int32_t iEventID, register int32_t sActor, regist
extern int32_t A_CheckSoundPlaying(int32_t i, int32_t num); extern int32_t A_CheckSoundPlaying(int32_t i, int32_t num);
extern int32_t S_CheckSoundPlaying(int32_t i, int32_t num); extern int32_t S_CheckSoundPlaying(int32_t i, int32_t num);
extern void A_StopSound(int32_t num, int32_t i);
extern void G_UpdatePlayerFromMenu(void); extern void G_UpdatePlayerFromMenu(void);
extern void Net_SendPlayerName(void); extern void Net_SendPlayerName(void);
extern void Net_SendUserMapName(void); extern void Net_SendUserMapName(void);

View file

@ -4086,9 +4086,9 @@ void G_SE40(int32_t smoothratio)
if (klabs(sector[sp->sectnum].floorz - sp->z) < klabs(sector[sprite[sprite2].sectnum].floorz - sprite[sprite2].z)) if (klabs(sector[sp->sectnum].floorz - sp->z) < klabs(sector[sprite[sprite2].sectnum].floorz - sprite[sprite2].z))
level = 1; level = 1;
x = ud.camerax - sp->x; x = ud.camera.x - sp->x;
y = ud.cameray - sp->y; y = ud.camera.y - sp->y;
z = ud.cameraz - (level ? sector[sp->sectnum].floorz : sector[sp->sectnum].ceilingz); z = ud.camera.z - (level ? sector[sp->sectnum].floorz : sector[sp->sectnum].ceilingz);
sect = sprite[sprite2].sectnum; sect = sprite[sprite2].sectnum;
updatesector(sprite[sprite2].x + x, sprite[sprite2].y + y, &sect); updatesector(sprite[sprite2].x + x, sprite[sprite2].y + y, &sect);
@ -4176,7 +4176,7 @@ void G_SE40(int32_t smoothratio)
} }
} }
G_DoSpriteAnimations(ud.camerax,ud.cameray,ud.cameraang,smoothratio); G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,smoothratio);
drawmasks(); drawmasks();
if (level) if (level)
@ -4325,18 +4325,18 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
if ((snum == myconnectindex) && (numplayers > 1)) if ((snum == myconnectindex) && (numplayers > 1))
{ {
ud.camerax = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio); ud.camera.x = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio);
ud.cameray = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio); ud.camera.y = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio);
ud.cameraz = omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio); ud.camera.z = omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio);
ud.cameraang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio); ud.cameraang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
ud.camerahoriz = omyhoriz+omyhorizoff+mulscale16((int32_t)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio); ud.camerahoriz = omyhoriz+omyhorizoff+mulscale16((int32_t)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio);
ud.camerasect = mycursectnum; ud.camerasect = mycursectnum;
} }
else else
{ {
ud.camerax = p->oposx+mulscale16((int32_t)(p->posx-p->oposx),smoothratio); ud.camera.x = p->oposx+mulscale16((int32_t)(p->posx-p->oposx),smoothratio);
ud.cameray = p->oposy+mulscale16((int32_t)(p->posy-p->oposy),smoothratio); ud.camera.y = p->oposy+mulscale16((int32_t)(p->posy-p->oposy),smoothratio);
ud.cameraz = p->oposz+mulscale16((int32_t)(p->posz-p->oposz),smoothratio); ud.camera.z = p->oposz+mulscale16((int32_t)(p->posz-p->oposz),smoothratio);
ud.cameraang = p->oang+mulscale16((int32_t)(((p->ang+1024-p->oang)&2047)-1024),smoothratio); ud.cameraang = p->oang+mulscale16((int32_t)(((p->ang+1024-p->oang)&2047)-1024),smoothratio);
ud.camerahoriz = p->ohoriz+p->ohorizoff+mulscale16((int32_t)(p->horiz+p->horizoff-p->ohoriz-p->ohorizoff),smoothratio); ud.camerahoriz = p->ohoriz+p->ohorizoff+mulscale16((int32_t)(p->horiz+p->horizoff-p->ohoriz-p->ohorizoff),smoothratio);
} }
@ -4346,21 +4346,21 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
{ {
ud.cameraang = p->ang+p->look_ang; ud.cameraang = p->ang+p->look_ang;
ud.camerahoriz = p->horiz+p->horizoff; ud.camerahoriz = p->horiz+p->horizoff;
ud.camerax = p->posx; ud.camera.x = p->posx;
ud.cameray = p->posy; ud.camera.y = p->posy;
ud.cameraz = p->posz; ud.camera.z = p->posz;
ud.camerasect = sprite[p->newowner].sectnum; ud.camerasect = sprite[p->newowner].sectnum;
smoothratio = 65536L; smoothratio = 65536L;
} }
else if (ud.viewbob) // if (p->over_shoulder_on == 0) else if (ud.viewbob) // if (p->over_shoulder_on == 0)
{ {
if (p->over_shoulder_on) if (p->over_shoulder_on)
ud.cameraz += (p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio))>>3; ud.camera.z += (p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio))>>3;
else ud.cameraz += p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio); else ud.camera.z += p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio);
} }
if (p->over_shoulder_on) if (p->over_shoulder_on)
{ {
ud.cameraz -= 3072; ud.camera.z -= 3072;
G_DoThirdPerson(p,(vec3_t *)&ud,&ud.camerasect,ud.cameraang,ud.camerahoriz); G_DoThirdPerson(p,(vec3_t *)&ud,&ud.camerasect,ud.cameraang,ud.camerahoriz);
} }
@ -4369,25 +4369,25 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
if (g_earthquakeTime > 0 && p->on_ground == 1) if (g_earthquakeTime > 0 && p->on_ground == 1)
{ {
ud.cameraz += 256-(((g_earthquakeTime)&1)<<9); ud.camera.z += 256-(((g_earthquakeTime)&1)<<9);
ud.cameraang += (2-((g_earthquakeTime)&2))<<2; ud.cameraang += (2-((g_earthquakeTime)&2))<<2;
} }
if (sprite[p->i].pal == 1) ud.cameraz -= (18<<8); if (sprite[p->i].pal == 1) ud.camera.z -= (18<<8);
if (p->newowner >= 0) if (p->newowner >= 0)
ud.camerahoriz = 100+sprite[p->newowner].shade; ud.camerahoriz = 100+sprite[p->newowner].shade;
else if (p->spritebridge == 0) else if (p->spritebridge == 0)
{ {
if (ud.cameraz < (p->truecz + (4<<8))) ud.cameraz = cz + (4<<8); if (ud.camera.z < (p->truecz + (4<<8))) ud.camera.z = cz + (4<<8);
else if (ud.cameraz > (p->truefz - (4<<8))) ud.cameraz = fz - (4<<8); else if (ud.camera.z > (p->truefz - (4<<8))) ud.camera.z = fz - (4<<8);
} }
if (ud.camerasect >= 0) if (ud.camerasect >= 0)
{ {
getzsofslope(ud.camerasect,ud.camerax,ud.cameray,&cz,&fz); getzsofslope(ud.camerasect,ud.camera.x,ud.camera.y,&cz,&fz);
if (ud.cameraz < cz+(4<<8)) ud.cameraz = cz+(4<<8); if (ud.camera.z < cz+(4<<8)) ud.camera.z = cz+(4<<8);
if (ud.cameraz > fz-(4<<8)) ud.cameraz = fz-(4<<8); if (ud.camera.z > fz-(4<<8)) ud.camera.z = fz-(4<<8);
} }
if (ud.camerahoriz > HORIZ_MAX) ud.camerahoriz = HORIZ_MAX; if (ud.camerahoriz > HORIZ_MAX) ud.camerahoriz = HORIZ_MAX;
@ -4406,19 +4406,19 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
i = 0; i = 0;
for (k=g_mirrorCount-1; k>=0; k--) for (k=g_mirrorCount-1; k>=0; k--)
{ {
j = klabs(wall[g_mirrorWall[k]].x-ud.camerax); j = klabs(wall[g_mirrorWall[k]].x-ud.camera.x);
j += klabs(wall[g_mirrorWall[k]].y-ud.cameray); j += klabs(wall[g_mirrorWall[k]].y-ud.camera.y);
if (j < dst) dst = j, i = k; if (j < dst) dst = j, i = k;
} }
if (wall[g_mirrorWall[i]].overpicnum == MIRROR) if (wall[g_mirrorWall[i]].overpicnum == MIRROR)
{ {
preparemirror(ud.camerax,ud.cameray,ud.cameraz,ud.cameraang,ud.camerahoriz,g_mirrorWall[i],g_mirrorSector[i],&tposx,&tposy,&tang); preparemirror(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,g_mirrorWall[i],g_mirrorSector[i],&tposx,&tposy,&tang);
j = visibility; j = visibility;
visibility = (j>>1) + (j>>2); visibility = (j>>1) + (j>>2);
drawrooms(tposx,tposy,ud.cameraz,tang,ud.camerahoriz,g_mirrorSector[i]+MAXSECTORS); drawrooms(tposx,tposy,ud.camera.z,tang,ud.camerahoriz,g_mirrorSector[i]+MAXSECTORS);
display_mirror = 1; display_mirror = 1;
G_DoSpriteAnimations(tposx,tposy,tang,smoothratio); G_DoSpriteAnimations(tposx,tposy,tang,smoothratio);
@ -4434,12 +4434,12 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
#ifdef POLYMER #ifdef POLYMER
if (getrendermode() == 4) if (getrendermode() == 4)
{ {
polymer_setanimatesprites(G_DoSpriteAnimations, ud.camerax,ud.cameray,ud.cameraang,smoothratio); polymer_setanimatesprites(G_DoSpriteAnimations, ud.camera.x,ud.camera.y,ud.cameraang,smoothratio);
} }
#endif #endif
G_SE40(smoothratio); G_SE40(smoothratio);
drawrooms(ud.camerax,ud.cameray,ud.cameraz,ud.cameraang,ud.camerahoriz,ud.camerasect); drawrooms(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,ud.camerasect);
// dupe the sprites touching the portal to the other sector // dupe the sprites touching the portal to the other sector
@ -4472,7 +4472,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
} }
} }
G_DoSpriteAnimations(ud.camerax,ud.cameray,ud.cameraang,smoothratio); G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,smoothratio);
drawing_ror = 0; drawing_ror = 0;
drawmasks(); drawmasks();
@ -11622,6 +11622,7 @@ MAIN_LOOP_RESTART:
if (getrendermode() >= 3) if (getrendermode() >= 3)
G_DrawBackground(); G_DrawBackground();
G_DisplayRest(i); G_DisplayRest(i);
S_Pan3D();
if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex) if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex)
{ {
@ -12785,7 +12786,6 @@ static int32_t G_DoMoveThings(void)
{ {
G_AnimateWalls(); G_AnimateWalls();
A_MoveCyclers(); A_MoveCyclers();
S_Pan3D();
} }
return 0; return 0;

View file

@ -103,6 +103,8 @@ int32_t g_numCompilerErrors,g_numCompilerWarnings;
extern char *duke3dgrpstring; extern char *duke3dgrpstring;
extern char *duke3ddef; extern char *duke3ddef;
extern int32_t g_maxSoundPos;
enum ScriptLabel_t enum ScriptLabel_t
{ {
LABEL_ANY = -1, LABEL_ANY = -1,
@ -1402,14 +1404,8 @@ static int32_t C_CheckEventSync(int32_t iEventID)
static inline int32_t ispecial(const char c) static inline int32_t ispecial(const char c)
{ {
if (c == 0x0a)
{
g_lineNumber++;
return 1;
}
if (c == ' ' || c == 0x0d || c == '(' || c == ')' || if (c == ' ' || c == 0x0d || c == '(' || c == ')' ||
c == ',' || c == ';') c == ',' || c == ';' || (c == 0x0a && ++g_lineNumber))
return 1; return 1;
return 0; return 0;
@ -2973,8 +2969,7 @@ static int32_t C_ParseCommand(void)
return 0; return 0;
case CON_QSPRINTF: case CON_QSPRINTF:
C_GetNextValue(LABEL_DEFINE); C_GetManyVars(2);
C_GetNextValue(LABEL_DEFINE);
j = 0; j = 0;
@ -5585,6 +5580,9 @@ repeatcase:
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
g_sounds[k].vo = *(g_scriptPtr-1); g_sounds[k].vo = *(g_scriptPtr-1);
g_scriptPtr--; g_scriptPtr--;
if (k > g_maxSoundPos)
g_maxSoundPos = k;
return 0; return 0;
case CON_ENDEVENT: case CON_ENDEVENT:

View file

@ -1061,7 +1061,7 @@ skip_check:
continue; continue;
} }
if (S_CheckSoundPlaying(vm.g_i,*insptr)) if (S_CheckSoundPlaying(vm.g_i,*insptr))
A_StopSound((int16_t)*insptr,vm.g_i); S_StopSound((int16_t)*insptr);
insptr++; insptr++;
continue; continue;
@ -2193,7 +2193,7 @@ nullquote:
case CON_STOPSOUNDVAR: case CON_STOPSOUNDVAR:
if ((j<0 || j>=MAXSOUNDS) /* && g_scriptSanityChecks */) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;} if ((j<0 || j>=MAXSOUNDS) /* && g_scriptSanityChecks */) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;}
if (S_CheckSoundPlaying(vm.g_i,j)) if (S_CheckSoundPlaying(vm.g_i,j))
A_StopSound((int16_t)j,vm.g_i); S_StopSound((int16_t)j);
break; break;
case CON_SOUNDVAR: case CON_SOUNDVAR:
if ((j<0 || j>=MAXSOUNDS) /* && g_scriptSanityChecks */) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;} if ((j<0 || j>=MAXSOUNDS) /* && g_scriptSanityChecks */) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;}
@ -3160,7 +3160,7 @@ nullquote:
case CON_QSPRINTF: case CON_QSPRINTF:
insptr++; insptr++;
{ {
int32_t dq = *insptr++, sq = *insptr++; int32_t dq = Gv_GetVarX(*insptr++), sq = Gv_GetVarX(*insptr++);
if ((ScriptQuotes[sq] == NULL || ScriptQuotes[dq] == NULL) /* && g_scriptSanityChecks */) if ((ScriptQuotes[sq] == NULL || ScriptQuotes[dq] == NULL) /* && g_scriptSanityChecks */)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[sq] ? dq : sq); OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[sq] ? dq : sq);

View file

@ -1449,9 +1449,9 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY); Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY); Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
Gv_NewVar("camerax",(intptr_t)&ud.camerax, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("camerax",(intptr_t)&ud.camera.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
Gv_NewVar("cameray",(intptr_t)&ud.cameray, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameray",(intptr_t)&ud.camera.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
Gv_NewVar("cameraz",(intptr_t)&ud.cameraz, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameraz",(intptr_t)&ud.camera.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK);
Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK);
Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK);
@ -1604,9 +1604,9 @@ void Gv_RefreshPointers(void)
aGameVars[Gv_GetVarIndex("gametype_flags")].val.lValue = (intptr_t)&GametypeFlags[ud.coop]; aGameVars[Gv_GetVarIndex("gametype_flags")].val.lValue = (intptr_t)&GametypeFlags[ud.coop];
aGameVars[Gv_GetVarIndex("framerate")].val.lValue = (intptr_t)&g_currentFrameRate; aGameVars[Gv_GetVarIndex("framerate")].val.lValue = (intptr_t)&g_currentFrameRate;
aGameVars[Gv_GetVarIndex("camerax")].val.lValue = (intptr_t)&ud.camerax; aGameVars[Gv_GetVarIndex("camerax")].val.lValue = (intptr_t)&ud.camera.x;
aGameVars[Gv_GetVarIndex("cameray")].val.lValue = (intptr_t)&ud.cameray; aGameVars[Gv_GetVarIndex("cameray")].val.lValue = (intptr_t)&ud.camera.y;
aGameVars[Gv_GetVarIndex("cameraz")].val.lValue = (intptr_t)&ud.cameraz; aGameVars[Gv_GetVarIndex("cameraz")].val.lValue = (intptr_t)&ud.camera.z;
aGameVars[Gv_GetVarIndex("cameraang")].val.lValue = (intptr_t)&ud.cameraang; aGameVars[Gv_GetVarIndex("cameraang")].val.lValue = (intptr_t)&ud.cameraang;
aGameVars[Gv_GetVarIndex("camerahoriz")].val.lValue = (intptr_t)&ud.camerahoriz; aGameVars[Gv_GetVarIndex("camerahoriz")].val.lValue = (intptr_t)&ud.camerahoriz;
aGameVars[Gv_GetVarIndex("camerasect")].val.lValue = (intptr_t)&ud.camerasect; aGameVars[Gv_GetVarIndex("camerasect")].val.lValue = (intptr_t)&ud.camerasect;

View file

@ -56,7 +56,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#define T_RIGHTQUIET 16 #define T_RIGHTQUIET 16
#define T_DEFAULT T_SIXTEENBIT_STEREO #define T_DEFAULT T_SIXTEENBIT_STEREO
#define MV_MaxPanPosition 31 #define MV_MaxPanPosition 127
#define MV_NumPanPositions ( MV_MaxPanPosition + 1 ) #define MV_NumPanPositions ( MV_MaxPanPosition + 1 )
#define MV_MaxTotalVolume 255 #define MV_MaxTotalVolume 255
//#define MV_MaxVolume 63 //#define MV_MaxVolume 63

View file

@ -67,10 +67,10 @@ static int32_t MV_ReverbDelay;
static VOLUME16 *MV_ReverbTable = NULL; static VOLUME16 *MV_ReverbTable = NULL;
//static signed short MV_VolumeTable[ MV_MaxVolume + 1 ][ 256 ]; //static signed short MV_VolumeTable[ MV_MaxVolume + 1 ][ 256 ];
static int16_t MV_VolumeTable[ 63 + 1 ][ 256 ]; static int16_t MV_VolumeTable[ 255 + 1 ][ 256 ];
//static Pan MV_PanTable[ MV_NumPanPositions ][ MV_MaxVolume + 1 ]; //static Pan MV_PanTable[ MV_NumPanPositions ][ MV_MaxVolume + 1 ];
static Pan MV_PanTable[ MV_NumPanPositions ][ 63 + 1 ]; static Pan MV_PanTable[ MV_NumPanPositions ][ 255 + 1 ];
static int32_t MV_Installed = FALSE; static int32_t MV_Installed = FALSE;
static int32_t MV_SoundCard = -1; static int32_t MV_SoundCard = -1;
@ -113,7 +113,7 @@ static void(*MV_CallBackFunc)(uint32_t) = NULL;
static void(*MV_RecordFunc)(char *ptr, int32_t length) = NULL; static void(*MV_RecordFunc)(char *ptr, int32_t length) = NULL;
static void(*MV_MixFunction)(VoiceNode *voice, int32_t buffer); static void(*MV_MixFunction)(VoiceNode *voice, int32_t buffer);
static int32_t MV_MaxVolume = 63; static int32_t MV_MaxVolume = 255;
char *MV_HarshClipTable; char *MV_HarshClipTable;
char *MV_MixDestination; char *MV_MixDestination;

View file

@ -4065,11 +4065,11 @@ void P_ProcessInput(int32_t snum)
p->holoduke_on = -1; p->holoduke_on = -1;
S_StopEnvSound(DUKE_JETPACK_IDLE,p->i); S_StopEnvSound(DUKE_JETPACK_IDLE,p->i);
if (p->scream_voice > FX_Ok) if (p->scream_voice >= FX_Ok)
{ {
FX_StopSound(p->scream_voice); FX_StopSound(p->scream_voice);
S_TestSoundCallback(DUKE_SCREAM); S_TestSoundCallback(DUKE_SCREAM);
p->scream_voice = FX_Ok; p->scream_voice = -1;
} }
if (s->pal != 1 && (s->cstat&32768) == 0) s->cstat = 0; if (s->pal != 1 && (s->cstat&32768) == 0) s->cstat = 0;
@ -4512,7 +4512,8 @@ void P_ProcessInput(int32_t snum)
// not jumping or crouching // not jumping or crouching
if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) && p->on_ground && (sector[psect].floorstat&2) && p->posz >= (fz-(i<<8)-(16<<8))) if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) &&
p->on_ground && (sector[psect].floorstat&2) && p->posz >= (fz-(i<<8)-(16<<8)))
p->posz = fz-(i<<8); p->posz = fz-(i<<8);
else else
{ {
@ -4522,7 +4523,7 @@ void P_ProcessInput(int32_t snum)
if (p->poszv > 2400 && p->falling_counter < 255) if (p->poszv > 2400 && p->falling_counter < 255)
{ {
p->falling_counter++; p->falling_counter++;
if (p->falling_counter == 38) if (p->falling_counter >= 38 && p->scream_voice == -1)
p->scream_voice = A_PlaySound(DUKE_SCREAM,pi); p->scream_voice = A_PlaySound(DUKE_SCREAM,pi);
} }
@ -4533,8 +4534,7 @@ void P_ProcessInput(int32_t snum)
else if (p->falling_counter > 9) else if (p->falling_counter > 9)
{ {
j = p->falling_counter; s->extra -= p->falling_counter-(krand()&3);
s->extra -= j-(krand()&3);
if (s->extra <= 0) if (s->extra <= 0)
{ {
A_PlaySound(SQUISHED,pi); A_PlaySound(SQUISHED,pi);
@ -4562,10 +4562,10 @@ void P_ProcessInput(int32_t snum)
else else
{ {
p->falling_counter = 0; p->falling_counter = 0;
if (p->scream_voice > FX_Ok) if (p->scream_voice >= FX_Ok)
{ {
FX_StopSound(p->scream_voice); FX_StopSound(p->scream_voice);
p->scream_voice = FX_Ok; p->scream_voice = -1;
} }
if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->poszv > (6144>>1)) if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->poszv > (6144>>1))

View file

@ -2680,29 +2680,9 @@ CHECKINV1:
p->inven_icon = dainv; p->inven_icon = dainv;
switch (dainv)
{ {
case 1: static const int32_t i[8] = { 3, 90, 91, 88, 101, 89, 6, 0 };
P_DoQuote(3,p); P_DoQuote(i[dainv], p);
break;
case 2:
P_DoQuote(90,p);
break;
case 3:
P_DoQuote(91,p);
break;
case 4:
P_DoQuote(88,p);
break;
case 5:
P_DoQuote(101,p);
break;
case 6:
P_DoQuote(89,p);
break;
case 7:
P_DoQuote(6,p);
break;
} }
} }
@ -2713,34 +2693,16 @@ CHECKINV1:
switch (j) switch (j)
{ {
case 0: case 0:
X_OnEvent(EVENT_WEAPKEY1,p->i,snum, -1);
break;
case 1: case 1:
X_OnEvent(EVENT_WEAPKEY2,p->i,snum, -1);
break;
case 2: case 2:
X_OnEvent(EVENT_WEAPKEY3,p->i,snum, -1);
break;
case 3: case 3:
X_OnEvent(EVENT_WEAPKEY4,p->i,snum, -1);
break;
case 4: case 4:
X_OnEvent(EVENT_WEAPKEY5,p->i,snum, -1);
break;
case 5: case 5:
X_OnEvent(EVENT_WEAPKEY6,p->i,snum, -1);
break;
case 6: case 6:
X_OnEvent(EVENT_WEAPKEY7,p->i,snum, -1);
break;
case 7: case 7:
X_OnEvent(EVENT_WEAPKEY8,p->i,snum, -1);
break;
case 8: case 8:
X_OnEvent(EVENT_WEAPKEY9,p->i,snum, -1);
break;
case 9: case 9:
X_OnEvent(EVENT_WEAPKEY10,p->i,snum, -1); X_OnEvent(EVENT_WEAPKEY1+j,p->i,snum, -1);
break; break;
case 10: case 10:
X_OnEvent(EVENT_PREVIOUSWEAPON,p->i,snum, -1); X_OnEvent(EVENT_PREVIOUSWEAPON,p->i,snum, -1);
@ -2750,17 +2712,16 @@ CHECKINV1:
break; break;
} }
if ((uint32_t) aGameVars[g_iReturnVarID].val.lValue != j) j = (uint32_t) aGameVars[g_iReturnVarID].val.lValue;
j = (uint32_t) aGameVars[g_iReturnVarID].val.lValue;
if (p->reloading == 1) if (p->reloading == 1)
j = -1; j = -1;
else if (j > 0 && p->kickback_pic == 1 && p->weapon_pos == 1) else if ((int32_t)j != -1 && p->kickback_pic == 1 && p->weapon_pos == 1)
{ {
p->wantweaponfire = j; p->wantweaponfire = j;
p->kickback_pic = 0; p->kickback_pic = 0;
} }
if (p->last_pissed_time <= (GAMETICSPERSEC*218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && sprite[p->i].xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0) if ((int32_t)j != -1 && p->last_pissed_time <= (GAMETICSPERSEC*218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && sprite[p->i].xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0)
{ {
// if( ( p->weapon_pos == 0 || ( p->holster_weapon && p->weapon_pos == -9 ) )) // if( ( p->weapon_pos == 0 || ( p->holster_weapon && p->weapon_pos == -9 ) ))
{ {
@ -2774,10 +2735,9 @@ CHECKINV1:
{ {
if (k == GROW_WEAPON) // JBF: this is handling next/previous with the grower selected if (k == GROW_WEAPON) // JBF: this is handling next/previous with the grower selected
{ {
if (j == (uint32_t)-1) if ((int32_t)j == -1)
k = 5; k = 5;
else k = 7; else k = 7;
} }
else else
{ {
@ -2824,9 +2784,10 @@ CHECKINV1:
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],p->i,snum); Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],p->i,snum);
Gv_SetVar(g_iWeaponVarID,j, p->i, snum); Gv_SetVar(g_iWeaponVarID,j, p->i, snum);
aGameVars[g_iReturnVarID].val.lValue = 0; aGameVars[g_iReturnVarID].val.lValue = j;
X_OnEvent(EVENT_SELECTWEAPON,p->i,snum, -1); X_OnEvent(EVENT_SELECTWEAPON,p->i,snum, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0) j = aGameVars[g_iReturnVarID].val.lValue;
if ((int32_t)j != -1 && j <= MAX_WEAPONS)
{ {
if (j == HANDBOMB_WEAPON && p->ammo_amount[HANDBOMB_WEAPON] == 0) if (j == HANDBOMB_WEAPON && p->ammo_amount[HANDBOMB_WEAPON] == 0)
{ {
@ -2879,95 +2840,42 @@ CHECKINV1:
else if ((int32_t)j >= 0 && p->gotweapon[j] && (uint32_t)p->curr_weapon != j) else if ((int32_t)j >= 0 && p->gotweapon[j] && (uint32_t)p->curr_weapon != j)
switch (j) switch (j)
{ {
case KNEE_WEAPON:
P_AddWeapon(p, KNEE_WEAPON);
break;
case PISTOL_WEAPON: case PISTOL_WEAPON:
if (p->ammo_amount[PISTOL_WEAPON] == 0)
if (p->show_empty_weapon == 0)
{
p->last_full_weapon = p->curr_weapon;
p->show_empty_weapon = 32;
}
P_AddWeapon(p, PISTOL_WEAPON);
break;
case SHOTGUN_WEAPON: case SHOTGUN_WEAPON:
if (p->ammo_amount[SHOTGUN_WEAPON] == 0 && p->show_empty_weapon == 0)
{
p->last_full_weapon = p->curr_weapon;
p->show_empty_weapon = 32;
}
P_AddWeapon(p, SHOTGUN_WEAPON);
break;
case CHAINGUN_WEAPON: case CHAINGUN_WEAPON:
if (p->ammo_amount[CHAINGUN_WEAPON] == 0 && p->show_empty_weapon == 0)
{
p->last_full_weapon = p->curr_weapon;
p->show_empty_weapon = 32;
}
P_AddWeapon(p, CHAINGUN_WEAPON);
break;
case RPG_WEAPON: case RPG_WEAPON:
if (p->ammo_amount[RPG_WEAPON] == 0)
if (p->show_empty_weapon == 0)
{
p->last_full_weapon = p->curr_weapon;
p->show_empty_weapon = 32;
}
P_AddWeapon(p, RPG_WEAPON);
break;
case DEVISTATOR_WEAPON: case DEVISTATOR_WEAPON:
if (p->ammo_amount[DEVISTATOR_WEAPON] == 0 && p->show_empty_weapon == 0)
{
p->last_full_weapon = p->curr_weapon;
p->show_empty_weapon = 32;
}
P_AddWeapon(p, DEVISTATOR_WEAPON);
break;
case FREEZE_WEAPON: case FREEZE_WEAPON:
if (p->ammo_amount[FREEZE_WEAPON] == 0 && p->show_empty_weapon == 0)
{
p->last_full_weapon = p->curr_weapon;
p->show_empty_weapon = 32;
}
P_AddWeapon(p, FREEZE_WEAPON);
break;
case GROW_WEAPON: case GROW_WEAPON:
case SHRINKER_WEAPON: case SHRINKER_WEAPON:
if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0) if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0)
{ {
p->show_empty_weapon = 32;
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
p->show_empty_weapon = 32;
} }
case KNEE_WEAPON:
P_AddWeapon(p, j); P_AddWeapon(p, j);
break; break;
case HANDREMOTE_WEAPON: case HANDREMOTE_WEAPON:
if (k >= 0) // Found in list of [1]'s if (k >= 0) // Found in list of [1]'s
{ {
p->curr_weapon = HANDREMOTE_WEAPON; p->curr_weapon = j;
p->last_weapon = -1; p->last_weapon = -1;
p->weapon_pos = 10; p->weapon_pos = 10;
} }
break; break;
case HANDBOMB_WEAPON: case HANDBOMB_WEAPON:
if (p->ammo_amount[HANDBOMB_WEAPON] > 0 && p->gotweapon[HANDBOMB_WEAPON])
P_AddWeapon(p, HANDBOMB_WEAPON);
break;
case TRIPBOMB_WEAPON: case TRIPBOMB_WEAPON:
if (p->ammo_amount[TRIPBOMB_WEAPON] > 0 && p->gotweapon[TRIPBOMB_WEAPON]) if (p->ammo_amount[j] > 0 && p->gotweapon[j])
P_AddWeapon(p, TRIPBOMB_WEAPON); P_AddWeapon(p, j);
break; break;
} }
} }
} }
} }
if (TEST_SYNC_KEY(sb_snum, SK_HOLODUKE) && p->newowner == -1) if (TEST_SYNC_KEY(sb_snum, SK_HOLODUKE) && p->newowner == -1)
{ {
if (p->holoduke_on == -1) if (p->holoduke_on == -1)
{ {
aGameVars[g_iReturnVarID].val.lValue = 0; aGameVars[g_iReturnVarID].val.lValue = 0;
@ -3044,11 +2952,11 @@ CHECKINV1:
if (p->jetpack_on) if (p->jetpack_on)
{ {
p->inven_icon = 4; p->inven_icon = 4;
if (p->scream_voice > FX_Ok) if (p->scream_voice >= FX_Ok)
{ {
FX_StopSound(p->scream_voice); FX_StopSound(p->scream_voice);
S_TestSoundCallback(DUKE_SCREAM); S_TestSoundCallback(DUKE_SCREAM);
p->scream_voice = FX_Ok; p->scream_voice = -1;
} }
A_PlaySound(DUKE_JETPACK_ON,p->i); A_PlaySound(DUKE_JETPACK_ON,p->i);

View file

@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define LOUDESTVOLUME 150 #define LOUDESTVOLUME 150
int32_t backflag,g_numEnvSoundsPlaying; int32_t backflag,g_numEnvSoundsPlaying,g_maxSoundPos = 0;
/* /*
=================== ===================
@ -302,7 +302,8 @@ int32_t S_LoadSound(uint32_t num)
int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos) int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
{ {
int32_t sndist, cx, cy, cz, j,k; vec3_t c;
int32_t sndist,j,k;
int32_t pitche,pitchs,cs; int32_t pitche,pitchs,cs;
int32_t voice, sndang, ca, pitch; int32_t voice, sndang, ca, pitch;
@ -340,40 +341,40 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
} }
else if (!(ud.config.VoiceToggle&1)) else if (!(ud.config.VoiceToggle&1))
return -1; return -1;
for (j=0; j<MAXSOUNDS; j++) for (j=g_maxSoundPos; j>=0; j--)
for (k=0; k<g_sounds[j].num; k++) for (k=0; k<g_sounds[j].num; k++)
if ((g_sounds[j].num > 0) && (g_sounds[j].m&4)) if ((g_sounds[j].num > 0) && (g_sounds[j].m&4))
return -1; return -1;
} }
cx = g_player[screenpeek].ps->oposx; Bmemcpy(&c, &ud.camera, sizeof(vec3_t));
cy = g_player[screenpeek].ps->oposy; cs = ud.camerasect;
cz = g_player[screenpeek].ps->oposz; ca = ud.cameraang;
cs = g_player[screenpeek].ps->cursectnum;
ca = g_player[screenpeek].ps->ang+g_player[screenpeek].ps->look_ang;
sndist = FindDistance3D((cx-pos->x),(cy-pos->y),(cz-pos->z)>>4); sndist = FindDistance3D((c.x-pos->x),(c.y-pos->y),(c.z-pos->z)>>4);
if (i >= 0 && (g_sounds[num].m&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)); sndist = divscale14(sndist,(SHT+1));
pitchs = g_sounds[num].ps;
pitche = g_sounds[num].pe;
cx = klabs(pitche-pitchs);
if (cx)
{
if (pitchs < pitche)
pitch = pitchs + (rand()%cx);
else pitch = pitche + (rand()%cx);
}
else pitch = pitchs;
sndist += g_sounds[num].vo; sndist += g_sounds[num].vo;
if (sndist < 0) sndist = 0; if (sndist < 0) sndist = 0;
if (cs > -1 && sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,SX,SY,SZ-(24<<8),SECT)) if (cs > -1 && sndist && PN != MUSICANDSFX && !cansee(c.x,c.y,c.z-(24<<8),cs,SX,SY,SZ-(24<<8),SECT))
sndist += sndist>>5; sndist += sndist>>5;
pitchs = g_sounds[num].ps;
pitche = g_sounds[num].pe;
j = klabs(pitche-pitchs);
if (j)
{
if (pitchs < pitche)
pitch = pitchs + (rand()%j);
else pitch = pitche + (rand()%j);
}
else pitch = pitchs;
switch (num) switch (num)
{ {
case PIPEBOMB_EXPLODE: case PIPEBOMB_EXPLODE:
@ -387,8 +388,10 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
default: default:
if (g_player[screenpeek].ps->cursectnum > -1 && sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0) if (g_player[screenpeek].ps->cursectnum > -1 && sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0)
pitch = -768; pitch = -768;
/*
if (sndist > 31444 && PN != MUSICANDSFX) if (sndist > 31444 && PN != MUSICANDSFX)
return -1; return -1;
*/
break; break;
} }
@ -408,7 +411,7 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
} }
else else
{ {
sndang = 2048 + ca - getangle(cx-pos->x,cy-pos->y); sndang = 2048 + ca - getangle(c.x-pos->x,c.y-pos->y);
sndang &= 2047; sndang &= 2047;
} }
@ -438,22 +441,22 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
if (*g_sounds[num].ptr == 'C') if (*g_sounds[num].ptr == 'C')
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); pitch,sndist>>4,sndist>>6,0,g_sounds[num].pr,num);
else if (*g_sounds[num].ptr == 'O') else if (*g_sounds[num].ptr == 'O')
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); pitch,sndist>>4,sndist>>6,0,g_sounds[num].pr,num);
else else
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); pitch,sndist>>4,sndist>>6,0,g_sounds[num].pr,num);
} }
else else
{ {
if (*g_sounds[num].ptr == 'C') if (*g_sounds[num].ptr == 'C')
voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>4,sndist>>6, g_sounds[num].pr, num);
else if (*g_sounds[num].ptr == 'O') else if (*g_sounds[num].ptr == 'O')
voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>4,sndist>>6, g_sounds[num].pr, num);
else else
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>4,sndist>>6, g_sounds[num].pr, num);
} }
if (voice >= FX_Ok) if (voice >= FX_Ok)
@ -555,20 +558,13 @@ int32_t A_PlaySound(uint32_t num, int32_t i)
return S_PlaySoundXYZ(num, i, (vec3_t *)&sprite[i]); return S_PlaySoundXYZ(num, i, (vec3_t *)&sprite[i]);
} }
void A_StopSound(int32_t num, int32_t i) inline void S_StopSound(int32_t num)
{ {
UNREFERENCED_PARAMETER(i); if (num >= 0 && num < MAXSOUNDS && g_sounds[num].num > 0)
if (num >= 0 && num < MAXSOUNDS) S_StopSound(num); {
} FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
S_TestSoundCallback(num);
void S_StopSound(int32_t num) }
{
if (num >= 0 && num < MAXSOUNDS)
if (g_sounds[num].num > 0)
{
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
S_TestSoundCallback(num);
}
} }
void S_StopEnvSound(int32_t num,int32_t i) void S_StopEnvSound(int32_t num,int32_t i)
@ -594,35 +590,34 @@ void S_StopEnvSound(int32_t num,int32_t i)
void S_Pan3D(void) void S_Pan3D(void)
{ {
int32_t sndist, sx, sy, sz, cx, cy, cz; vec3_t s, c;
int32_t sndist;
int32_t sndang,ca,j,k,i,cs; int32_t sndang,ca,j,k,i,cs;
g_numEnvSoundsPlaying = 0; g_numEnvSoundsPlaying = 0;
if (ud.camerasprite == -1) if (ud.camerasprite == -1)
{ {
cx = g_player[screenpeek].ps->oposx; Bmemcpy(&c, &ud.camera, sizeof(vec3_t));
cy = g_player[screenpeek].ps->oposy; cs = ud.camerasect;
cz = g_player[screenpeek].ps->oposz; ca = ud.cameraang;
cs = g_player[screenpeek].ps->cursectnum;
ca = g_player[screenpeek].ps->ang+g_player[screenpeek].ps->look_ang;
} }
else else
{ {
cx = sprite[ud.camerasprite].x; Bmemcpy(&c, &sprite[ud.camerasprite], sizeof(vec3_t));
cy = sprite[ud.camerasprite].y;
cz = sprite[ud.camerasprite].z;
cs = sprite[ud.camerasprite].sectnum; cs = sprite[ud.camerasprite].sectnum;
ca = sprite[ud.camerasprite].ang; ca = sprite[ud.camerasprite].ang;
} }
for (j=0; j<MAXSOUNDS; j++) for (k=0; k<g_sounds[j].num; k++) j = g_maxSoundPos;
do
{
for (k=g_sounds[j].num-1; k>=0; k--)
{ {
i = g_sounds[j].SoundOwner[k].i; i = g_sounds[j].SoundOwner[k].i;
sx = sprite[i].x; Bmemcpy(&s, &sprite[i], sizeof(vec3_t));
sy = sprite[i].y;
sz = sprite[i].z;
if (PN == APLAYER && sprite[i].yvel == screenpeek) if (PN == APLAYER && sprite[i].yvel == screenpeek)
{ {
@ -631,9 +626,9 @@ void S_Pan3D(void)
} }
else else
{ {
sndang = 2048 + ca - getangle(cx-sx,cy-sy); sndang = 2048 + ca - getangle(c.x-s.x,c.y-s.y);
sndang &= 2047; sndang &= 2047;
sndist = FindDistance3D((cx-sx),(cy-sy),(cz-sz)>>4); sndist = FindDistance3D((c.x-s.x),(c.y-s.y),(c.z-s.z)>>4);
if (i >= 0 && (g_sounds[j].m&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 = divscale14(sndist,(SHT+1));
} }
@ -641,7 +636,7 @@ void S_Pan3D(void)
sndist += g_sounds[j].vo; sndist += g_sounds[j].vo;
if (sndist < 0) sndist = 0; if (sndist < 0) sndist = 0;
if (cs > -1 && sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,sx,sy,sz-(24<<8),SECT)) if (cs > -1 && sndist && PN != MUSICANDSFX && !cansee(c.x,c.y,c.z-(24<<8),cs,s.x,s.y,s.z-(24<<8),SECT))
sndist += sndist>>5; sndist += sndist>>5;
if (PN == MUSICANDSFX && SLT < 999) if (PN == MUSICANDSFX && SLT < 999)
@ -654,12 +649,14 @@ void S_Pan3D(void)
case RPG_EXPLODE: case RPG_EXPLODE:
if (sndist > (6144)) sndist = (6144); if (sndist > (6144)) sndist = (6144);
break; break;
default: /*
default:
if (sndist > 31444 && PN != MUSICANDSFX) if (sndist > 31444 && PN != MUSICANDSFX)
{ {
S_StopSound(j); S_StopSound(j);
continue; continue;
} }
*/
} }
if (g_sounds[j].ptr == 0 && S_LoadSound(j) == 0) continue; if (g_sounds[j].ptr == 0 && S_LoadSound(j) == 0) continue;
@ -668,8 +665,9 @@ void S_Pan3D(void)
if (sndist < ((255-LOUDESTVOLUME)<<6)) if (sndist < ((255-LOUDESTVOLUME)<<6))
sndist = ((255-LOUDESTVOLUME)<<6); sndist = ((255-LOUDESTVOLUME)<<6);
FX_Pan3D(g_sounds[j].SoundOwner[k].voice,sndang>>6,sndist>>6); FX_Pan3D(g_sounds[j].SoundOwner[k].voice,sndang>>4,sndist>>6);
} }
} while (j--);
} }
void S_TestSoundCallback(uint32_t num) void S_TestSoundCallback(uint32_t num)
@ -703,8 +701,8 @@ void S_TestSoundCallback(uint32_t num)
} }
} }
g_sounds[num].num--; g_sounds[num].num--;
g_sounds[num].SoundOwner[tempk-1].i = -1; g_sounds[num].SoundOwner[tempk-1].i = -1;
} }
g_soundlocks[num]--; g_soundlocks[num]--;
@ -727,10 +725,8 @@ int32_t A_CheckSoundPlaying(int32_t i, int32_t num)
{ {
int32_t j; int32_t j;
num = clamp(num, 0, MAXSOUNDS); // FIXME if (num >= MAXSOUNDS || num < 0) return 0;
if (i == -1) return (g_sounds[num].num > 0);
if (i == -1)
return (g_sounds[num].num > 0);
if (g_sounds[num].num > 0) if (g_sounds[num].num > 0)
{ {
@ -746,7 +742,7 @@ int32_t A_CheckSoundPlaying(int32_t i, int32_t num)
int32_t S_CheckSoundPlaying(int32_t i, int32_t num) int32_t S_CheckSoundPlaying(int32_t i, int32_t num)
{ {
num = clamp(num, 0, MAXSOUNDS); // FIXME if (num >= MAXSOUNDS || num < 0) return 0;
if (i == -1) if (i == -1)
{ {

View file

@ -312,7 +312,7 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
} }
if (voice > FX_Ok) if (voice >= FX_Ok)
{ {
g_sounds[num].SoundOwner[g_sounds[num].num].i = i; g_sounds[num].SoundOwner[g_sounds[num].num].i = i;
g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice; g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice;
@ -392,7 +392,7 @@ void S_PlaySound(int32_t num)
voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num); voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
} }
if (voice > FX_Ok)// return; if (voice >= FX_Ok)// return;
{ {
g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice; g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice;
g_sounds[num].num++; g_sounds[num].num++;
@ -413,12 +413,6 @@ int32_t A_PlaySound(uint32_t num, int32_t i)
return S_PlaySoundXYZ(num,i, (vec3_t *)&sprite[i]); return S_PlaySoundXYZ(num,i, (vec3_t *)&sprite[i]);
} }
void A_StopSound(int32_t num, int32_t i)
{
UNREFERENCED_PARAMETER(i);
if (num >= 0 && num < MAXSOUNDS) S_StopSound(num);
}
void S_StopSound(int32_t num) void S_StopSound(int32_t num)
{ {
if (num >= 0 && num < MAXSOUNDS) if (num >= 0 && num < MAXSOUNDS)

View file

@ -26,7 +26,6 @@ void S_SoundShutdown(void);
int32_t S_PlaySoundXYZ(int32_t, int32_t, const vec3_t*); int32_t S_PlaySoundXYZ(int32_t, int32_t, const vec3_t*);
void S_PlaySound(int32_t); void S_PlaySound(int32_t);
int32_t A_PlaySound(uint32_t num, int32_t i); int32_t A_PlaySound(uint32_t num, int32_t i);
void A_StopSound(int32_t num, int32_t i);
void S_StopSound(int32_t num); void S_StopSound(int32_t num);
void S_StopEnvSound(int32_t num,int32_t i); void S_StopEnvSound(int32_t num,int32_t i);
void S_Pan3D(void); void S_Pan3D(void);