# # xtank1.3d-sound-patches version 1.1 # # This sound patch to xtank1.3d will only work on Suns workstations # with sound support. # # Note: This is a patch to an original xtank1.3d _not_ a patch to the # previous sound patch. # # This is version 1.1 of the xtank-sound-patches. The following things # have been added/changed to the previous patch: # # - Sounds only play on your workstation if the source of the sound is # visible. (Thanks to Brian Stormont, brs@cs.brown.edu) # # - Different sounds for each type of explosion (electricity, dam0, dam1, # etc). (Thanks to Brian Stormont, brs@cs.brown.edu) # # - Sound for the 1960s style radar. A sound is played for each blip. # (Thanks to Brian Stormont, brs@cs.brown.edu) # # - Sound can be turned on/off in the settings-flags menu. # # This patch will only work on an original xtank1.3d (as far as I know) # For sounds to work you must also have the rplay package installed # on all machines using xtank, this means the server and clients. # If rplay is not installed on a client machine that client will not # receive any of the sounds. The rplay package along with the sound # files are available via anonymous ftp at sciences.sdsu.edu. # The Imakefile in the Src directory also is setup to link with the # librplay.a in /usr/local/lib. If you changed the directory where # librplay.a lives you will have to edit the Imakefile in Src. # # To apply the sound patch... # % cd your_xtank_directory (the one with Imakefile.Config) # % patch -p0 < sound-patches >& patchresults # # There is a new directory called Sound which contains a file # called list. This file contains a list of all the sound file names # that are to be used for the appropriate xtank sounds. # # Send problems/questions/comments to boyns@sciences.sdsu.edu. # # Mark # *** /dev/null Wed Jul 8 10:41:50 1992 --- Sounds/list Wed Jul 8 10:29:04 1992 *************** *** 0 **** --- 1,46 ---- + # + # This file contains the names of the sound files used for sounds. + # The numbers in the first column represent the number associated + # with the #defines in Src/Include/Sound.h. + # When adding new sounds changes must be made both to the Sound.h + # and this list. To change a sound just change the name here. + # + 0 click1.au # lmg + 1 click1.au # mg + 2 click1.au # hmg + 3 click1.au # lrifle + 4 click1.au # rifle + 5 click1.au # hrifle + 6 click1.au # lcannon + 7 click1.au # cannon + 8 click1.au # hcannon + 9 click1.au # lrocket + 10 click1.au # rocket + 11 click1.au # hrocket + 12 click1.au # acid + 13 click1.au # flame + 14 drip.au # mine + 15 Missle1.au # seeker + 16 click1.au # slick + 17 click1.au # procket + 18 click1.au # umissle + 19 click1.au # harm + 20 click1.au # disc + 21 bong.au # vehicle hit wall + 22 better_boing.au # vehicle hit vehicle + 23 arrp.au # bullet hit vehicle + 24 tap2.au # bullet hit wall + 25 boom.au # tank explosion + 26 arrp.au # gleam explosion + 27 arrp.au # dam0 explosion + 28 arrp.au # dam1 explosion + 29 arrp.au # dam2 explosion + 30 arrp.au # dam3 explosion + 31 arrp.au # dam4 explosion + 32 arrp.au # exhaust explosion + 33 arrp.au # electric explosion + 34 arrp.au # damage explosion + 35 sub_dive_horn.au # start + 36 game_over.au # end + 37 Sonar.au # sonar + 38 blip.au # blip *** /dev/null Wed Jul 8 10:41:50 1992 --- Src/Include/sound.h Wed Jul 8 10:27:52 1992 *************** *** 0 **** --- 1,66 ---- + #ifndef _sound_h + #define _sound_h + + /* + * This file contains the sound indexes into the sound table + * The indexes here must be consistent with those in the file Sounds/list + */ + + /* + * maximum number of sounds + */ + #define MAX_SOUNDS 128 + + /* + * sounds for all the types of weapons + */ + #define LMG_SOUND 0 + #define MG_SOUND 1 + #define HMG_SOUND 2 + #define LRIFLE_SOUND 3 + #define RIFLE_SOUND 4 + #define HRIFLE_SOUND 5 + #define LCANNON_SOUND 6 + #define CANNON_SOUND 7 + #define HCANNON_SOUND 8 + #define LROCKET_SOUND 9 + #define ROCKET_SOUND 10 + #define HROCKET_SOUND 11 + #define ACID_SOUND 12 + #define FLAME_SOUND 13 + #define MINE_SOUND 14 + #define SEEKER_SOUND 15 + #define SLICK_SOUND 16 + #define PROCKET_SOUND 17 + #define UMISSLE_SOUND 18 + #define HARM_SOUND 19 + #define DISC_SOUND 20 + /* + * things hitting things sounds + */ + #define VEHICLE_HIT_WALL_SOUND 21 + #define VEHICLE_HIT_VEHICLE_SOUND 22 + #define BULLET_HIT_VEHICLE_SOUND 23 + #define BULLET_HIT_WALL_SOUND 24 + /* + * explosion sounds + */ + #define TANK_EXPLOSION_SOUND 25 + #define GLEAM_EXPLOSION_SOUND 26 + #define DAM0_EXPLOSION_SOUND 27 + #define DAM1_EXPLOSION_SOUND 28 + #define DAM2_EXPLOSION_SOUND 29 + #define DAM3_EXPLOSION_SOUND 30 + #define DAM4_EXPLOSION_SOUND 31 + #define EXHAUST_EXPLOSION_SOUND 32 + #define ELECTRIC_EXPLOSION_SOUND 33 + #define DAMAGE_EXPLOSION_SOUND 34 + /* + * misc sounds + */ + #define START_SOUND 35 + #define END_SOUND 36 + #define SONAR_SOUND 37 + #define BLIP_SOUND 38 + + #endif _sound_h *** /dev/null Wed Jul 8 10:41:50 1992 --- Src/sound.c Mon Jul 6 11:34:55 1992 *************** *** 0 **** --- 1,206 ---- + #include "limits.h" + #include "xtank.h" + #include "graphics.h" + #include "gr.h" + #include "xtanklib.h" + #include "vehicle.h" + #include "globals.h" + #include "terminal.h" + #include "assert.h" + #include + #include + #include + #include + #include + #include + #ifdef SOUND + #include "sound.h" + + extern Terminal *terminal[]; + extern int num_terminals; + extern Settings settings; + + /* + * the sound table + */ + int sound_table[MAX_TERMINALS][MAX_SOUNDS]; + + /* + * initialize sound for the given terminal + */ + init_terminal_sound(t) + Terminal *t; + { + int index, id, bind_fd; + char *p, *rindex(); + char host[MAXHOSTNAMELEN], buf[MAXPATHLEN], name[MAXPATHLEN]; + Video *vidptr; + extern char pathname[], soundsdir[]; + char filename[MAXPATHLEN]; + FILE *fp; + + draw_text_rc(ANIM_WIN, 0, 1, "Initializing Sounds...", M_FONT, WHITE); + sync_output(TRUE); + + /* + * get the display hostname + */ + vidptr = (Video *)t->video; + sprintf(host, "%s", vidptr->display_name); + p = rindex(host, ':'); + *p = '\0'; + if (*host == '\0') { + strcat(host, "localhost"); + } + + /* + * initialize rplayd connection + */ + t->rplay_fd = rplay_init(host); + if (t->rplay_fd < 0) { + rplay_perror(host); + return -1; + } + + /* + * initialize rplaybindd connection + */ + bind_fd = rplaybind_init(host); + if (bind_fd < 0) { + rplay_perror(host); + close(t->rplay_fd); + t->rplay_fd = -1; + return -1; + } + + strcpy(filename, pathname); + strcat(filename, "/"); + strcat(filename, soundsdir); + strcat(filename, "/"); + strcat(filename, "list"); + + fp = fopen(filename, "r"); + if (fp == NULL) { + fprintf(stderr, "Could not open file %s.\n", filename); + exit(1); + } + + /* + * bind all the sounds in the sounds list to the host + * store the returned sound ids in the sound table + */ + while(fgets(buf, sizeof(buf), fp) != NULL) { + if (buf[0] == '#' || buf[0] == '\n') continue; + sscanf(buf, "%d %s", &index, name); + id = rplaybind(bind_fd, name); + if (id < 0) { + rplay_perror(host); + t->rplay_fd = -1; + return -1; + } + if (id == 0) { + fprintf(stderr, "%s not found at %s\n", name, host); + id = -1; + } + sound_table[t->num][index] = id; + } + + /* + * close the rplaybindd connection + */ + close(bind_fd); + + play_terminal(t, SONAR_SOUND); + + return 0; + } + + /* + * play a sound on a terminal + */ + play_terminal(t, index) + Terminal *t; + int index; + { + if (!settings.si.no_sound) { + if (t->rplay_fd > 0 && sound_table[t->num][index] > 0) + rplay(t->rplay_fd, sound_table[t->num][index]); + } + } + + /* + * play a sound on all terminals + */ + play_all(index) + int index; + { + if (!settings.si.no_sound) { + int x; + + for(x = 0; x < num_terminals; x++) + if (terminal[x]->rplay_fd > 0 && sound_table[terminal[x]->num][index] > 0) + rplay(terminal[x]->rplay_fd, sound_table[terminal[x]->num][index]); + } + } + + /* + * play a sound on the terminal "owning" or watching this tank + */ + play_owner(vehicle, index) + Vehicle *vehicle; + int index; + { + if (!settings.si.no_sound) { + int x, y; + + for (x = 0; x < vehicle->owner->num_players; x++) { + y = vehicle->owner->player[x]; + if (terminal[y]->rplay_fd > 0 && sound_table[terminal[y]->num][index] > 0) + rplay(terminal[y]->rplay_fd, sound_table[terminal[y]->num][index]); + } + } + } + + /* + * play a sound on the terminal that has this location in view + */ + play_in_view(loc, index) + Loc *loc; + int index; + { + if (!settings.si.no_sound) { + int x, dx, dy; + int t_x = loc->x; + int t_y = loc->y; + + for (x = 0; x < num_terminals; x++) { + dx = t_x - terminal[x]->loc.x; + dy = t_y - terminal[x]->loc.y; + if (dx >= 0 && dx <= ANIM_WIN_WIDTH && dy >= 0 && dy <= ANIM_WIN_HEIGHT && + terminal[x]->rplay_fd > 0 && sound_table[terminal[x]->num][index] > 0) + rplay(terminal[x]->rplay_fd, sound_table[terminal[x]->num][index]); + } + } + } + + /* + * play a sound on the terminal that has this location in view + */ + play_in_view_x_y(t_x, t_y, index) + int t_x; + int t_y; + int index; + { + if (!settings.si.no_sound) { + int x, dx, dy; + + for (x = 0; x < num_terminals; x++) { + dx = t_x - terminal[x]->loc.x; + dy = t_y - terminal[x]->loc.y; + if (dx >= 0 && dx <= ANIM_WIN_WIDTH && dy >= 0 && dy <= ANIM_WIN_HEIGHT && + terminal[x]->rplay_fd > 0 && sound_table[terminal[x]->num][index] > 0) + rplay(terminal[x]->rplay_fd, sound_table[terminal[x]->num][index]); + } + } + } + #endif SOUND Common subdirectories: ./Bin and ../xtank1.3d-sound/Bin Common subdirectories: ./Doc and ../xtank1.3d-sound/Doc Common subdirectories: ./Help and ../xtank1.3d-sound/Help diff -c -r ./Imakefile.Config ../xtank1.3d-sound/Imakefile.Config *** ./Imakefile.Config Sun Feb 9 21:28:45 1992 --- ../xtank1.3d-sound/Imakefile.Config Wed Jun 24 12:55:14 1992 *************** *** 152,162 **** /**/# recreate the bug!) /**/# Most sites should leave it undefined. /**/# /**/# Everybody needs to know the following global things about xtank DEFINES2 = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \ -DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \ ! -DCODE_SIZE=0x20000 -DSTACK_SIZE=0x8000 $(ARCH_DEFINES) DEFINES = -DXTANK_DIR=\"/src/pub/xtank\" $(DEFINES2) \ -DALLDEFINES="\"$(DEFINES2)\"" --- 152,167 ---- /**/# recreate the bug!) /**/# Most sites should leave it undefined. /**/# + /**/# -DSOUND + /**/# Enable only if you are using a Sun with sound support. + /**/# You must also have the rplay sound package for sound to work. + /**/# /**/# Everybody needs to know the following global things about xtank DEFINES2 = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \ -DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \ ! -DCODE_SIZE=0x20000 -DSTACK_SIZE=0x8000 $(ARCH_DEFINES) \ ! -DSOUND DEFINES = -DXTANK_DIR=\"/src/pub/xtank\" $(DEFINES2) \ -DALLDEFINES="\"$(DEFINES2)\"" Common subdirectories: ./Mazes and ../xtank1.3d-sound/Mazes Common subdirectories: ./Programs and ../xtank1.3d-sound/Programs Only in ../xtank1.3d-sound: Sounds Common subdirectories: ./Src and ../xtank1.3d-sound/Src Common subdirectories: ./Todo and ../xtank1.3d-sound/Todo Common subdirectories: ./Util and ../xtank1.3d-sound/Util Common subdirectories: ./Vehicles and ../xtank1.3d-sound/Vehicles diff -c -r ./Bin/xtank ../xtank1.3d-sound/Bin/xtank *** ./Bin/xtank Sat Feb 1 14:00:59 1992 --- ../xtank1.3d-sound/Bin/xtank Wed Jul 8 09:58:57 1992 *************** *** 3,8 **** --- 3,9 ---- XTANK_VEHICLES=Vehicles XTANK_MAZES=Mazes XTANK_PROGRAMS=Programs + XTANK_SOUNDS=Sounds # # rpotter thinks this is a kludge, I think it is funny! (lidl) Common subdirectories: ./Doc/Src and ../xtank1.3d-sound/Doc/Src Common subdirectories: ./Programs/Old and ../xtank1.3d-sound/Programs/Old Common subdirectories: ./Programs/Old/Old and ../xtank1.3d-sound/Programs/Old/Old Common subdirectories: ./Src/Fixed-Point and ../xtank1.3d-sound/Src/Fixed-Point diff -c -r ./Src/Imakefile ../xtank1.3d-sound/Src/Imakefile *** ./Src/Imakefile Sun Feb 9 21:46:14 1992 --- ../xtank1.3d-sound/Src/Imakefile Wed Jun 24 12:55:16 1992 *************** *** 17,23 **** objects.c program.c radar.c repair.c scroll.c setup.c \ setups.c status.c sysdep.c thread.c unix.c update.c \ util.c vdesign.c vehicle.c newfile.c vload.c \ ! version.c $(SRCS2) OBJS = 3d.o XMultiSync.o actions.o animate.o box.o collision.o \ console.o cosell.o display.o escher.o explosion.o \ file.o game.o gr.o graphics.o highlib.o hit.o icounter.o \ --- 17,23 ---- objects.c program.c radar.c repair.c scroll.c setup.c \ setups.c status.c sysdep.c thread.c unix.c update.c \ util.c vdesign.c vehicle.c newfile.c vload.c \ ! sound.c version.c $(SRCS2) OBJS = 3d.o XMultiSync.o actions.o animate.o box.o collision.o \ console.o cosell.o display.o escher.o explosion.o \ file.o game.o gr.o graphics.o highlib.o hit.o icounter.o \ *************** *** 26,32 **** objects.o program.o radar.o repair.o scroll.o setup.o \ setups.o status.o sysdep.o thread.o unix.o update.o \ util.o vdesign.o vehicle.o newfile.o vload.o \ ! version.o $(OBJS2) INCL = Include/bullet.h Include/common.h Include/cosell.h \ Include/disc.h Include/game.h Include/globals.h \ Include/gr.h Include/graphics.h Include/icounter.h \ --- 26,32 ---- objects.o program.o radar.o repair.o scroll.o setup.o \ setups.o status.o sysdep.o thread.o unix.o update.o \ util.o vdesign.o vehicle.o newfile.o vload.o \ ! sound.o version.o $(OBJS2) INCL = Include/bullet.h Include/common.h Include/cosell.h \ Include/disc.h Include/game.h Include/globals.h \ Include/gr.h Include/graphics.h Include/icounter.h \ *************** *** 40,46 **** Include/terminal.h Include/thread.h Include/tread-defs.h \ Include/types.h Include/vdesc.h Include/vehicle.h \ Include/vehicleparts.h Include/vstructs.h \ ! Include/weapon-defs.h Include/xtank.h Include/xtanklib.h XINCL = Include/Xlibos.h Include/x11.h /**/# Note that both x11.c and mazeconv.c are included in other .c files, --- 40,47 ---- Include/terminal.h Include/thread.h Include/tread-defs.h \ Include/types.h Include/vdesc.h Include/vehicle.h \ Include/vehicleparts.h Include/vstructs.h \ ! Include/weapon-defs.h Include/xtank.h Include/xtanklib.h \ ! Include/sound.h XINCL = Include/Xlibos.h Include/x11.h /**/# Note that both x11.c and mazeconv.c are included in other .c files, *************** *** 52,58 **** /**/# Everybody needs the following libraries ! EXTRA_LIBRARIES = -LPrograms -lxtankrobots -lm /**/# Start of System Dependent Things /**/# (e.g. libraries, linker flags and so forth) --- 53,59 ---- /**/# Everybody needs the following libraries ! EXTRA_LIBRARIES = -LPrograms -lxtankrobots -lm -L/usr/local/lib -lrplay /**/# Start of System Dependent Things /**/# (e.g. libraries, linker flags and so forth) *************** *** 89,95 **** #endif #ifdef SunArchitecture SYS_LIBRARIES = /usr/lib/debug/malloc.o -llwp ! CCOPTIONS = -Bstatic #ifdef SparcArchitecture /**/# Sun4 #else --- 90,96 ---- #endif #ifdef SunArchitecture SYS_LIBRARIES = /usr/lib/debug/malloc.o -llwp ! CCOPTIONS = /**/#-Bstatic #ifdef SparcArchitecture /**/# Sun4 #else Common subdirectories: ./Src/Include and ../xtank1.3d-sound/Src/Include Common subdirectories: ./Src/Objects and ../xtank1.3d-sound/Src/Objects Common subdirectories: ./Src/Old and ../xtank1.3d-sound/Src/Old Common subdirectories: ./Src/Programs and ../xtank1.3d-sound/Src/Programs diff -c -r ./Src/explosion.c ../xtank1.3d-sound/Src/explosion.c *** ./Src/explosion.c Sun Feb 9 21:45:40 1992 --- ../xtank1.3d-sound/Src/explosion.c Mon Jul 6 09:41:12 1992 *************** *** 13,20 **** #include "bullet.h" #include "graphics.h" #include "loc.h" - #define EXP_SPREAD 15 --- 13,22 ---- #include "bullet.h" #include "graphics.h" #include "loc.h" + #ifdef SOUND + #include "sound.h" + #endif SOUND #define EXP_SPREAD 15 *************** *** 32,37 **** --- 34,75 ---- if (eset->number >= MAX_EXPS) return; + + #ifdef SOUND + switch (type) { + case EXP_TANK: + play_in_view(loc, TANK_EXPLOSION_SOUND); + break; + case EXP_GLEAM: + play_in_view(loc, GLEAM_EXPLOSION_SOUND); + break; + case EXP_DAM0: + play_in_view(loc, DAM0_EXPLOSION_SOUND); + break; + case EXP_DAM1: + play_in_view(loc, DAM1_EXPLOSION_SOUND); + break; + case EXP_DAM2: + play_in_view(loc, DAM2_EXPLOSION_SOUND); + break; + case EXP_DAM3: + play_in_view(loc, DAM3_EXPLOSION_SOUND); + break; + case EXP_DAM4: + play_in_view(loc, DAM4_EXPLOSION_SOUND); + break; + case EXP_EXHAUST: + play_in_view(loc, EXHAUST_EXPLOSION_SOUND); + break; + case EXP_ELECTRIC: + play_in_view(loc, ELECTRIC_EXPLOSION_SOUND); + break; + default: + play_in_view(loc, DAMAGE_EXPLOSION_SOUND); + break; + } + #endif SOUND + e = eset->list[eset->number++]; e->x = (int) loc->x; e->y = (int) loc->y; *************** *** 58,63 **** --- 96,102 ---- int exp_dx, exp_dy; int i; + for (i = 0; i < num; i++) { exp_loc = *loc; exp_dx = rnd(EXP_SPREAD << 1) - EXP_SPREAD; diff -c -r ./Src/file.c ../xtank1.3d-sound/Src/file.c *** ./Src/file.c Sun Feb 9 21:45:41 1992 --- ../xtank1.3d-sound/Src/file.c Wed Jul 8 09:30:04 1992 *************** *** 120,125 **** --- 120,128 ---- char pathname[MAXPATHLEN]; char headersdir[MAXPATHLEN]; /* full name of directory to find headers in */ char vehiclesdir[MAXNAMLEN], mazesdir[MAXNAMLEN], programsdir[MAXNAMLEN]; + #ifdef SOUND + char soundsdir[MAXPATHLEN]; + #endif SOUND char username[MAX_STRING], displayname[256]; #ifdef NEED_AUX_FONT *************** *** 168,174 **** (void) strcpy(filename, "XVDIR:list"); #endif /* AMIGA */ ! draw_text_rc(ANIM_WIN, 0, 1, "Reading vehicle list...", M_FONT, WHITE); sync_output(TRUE); if ((file = fopen(filename, "r")) != NULL) { --- 171,177 ---- (void) strcpy(filename, "XVDIR:list"); #endif /* AMIGA */ ! draw_text_rc(ANIM_WIN, 0, 2, "Reading vehicle list...", M_FONT, WHITE); sync_output(TRUE); if ((file = fopen(filename, "r")) != NULL) { *************** *** 196,202 **** (void) strcpy(filename, "XMDIR:list"); #endif /* AMIGA */ ! draw_text_rc(ANIM_WIN, 0, 2, "Reading maze list...", M_FONT, WHITE); sync_output(TRUE); if ((file = fopen(filename, "r")) != NULL) { --- 199,205 ---- (void) strcpy(filename, "XMDIR:list"); #endif /* AMIGA */ ! draw_text_rc(ANIM_WIN, 0, 3, "Reading maze list...", M_FONT, WHITE); sync_output(TRUE); if ((file = fopen(filename, "r")) != NULL) { *************** *** 729,734 **** --- 732,740 ---- strcpy(vehiclesdir, (p = getenv("XTANK_VEHICLES")) ? p : "Vehicles"); strcpy(mazesdir, (p = getenv("XTANK_MAZES")) ? p : "Mazes"); strcpy(programsdir, (p = getenv("XTANK_PROGRAMS")) ? p : "Programs"); + #ifdef SOUND + strcpy(soundsdir, (p = getenv("XTANK_SOUNDS")) ? p : "Sounds"); + #endif SOUND if ((p = getenv("XTANK_HEADERS")) != NULL) { strcpy(headersdir, p); } else { diff -c -r ./Src/gr.c ../xtank1.3d-sound/Src/gr.c *** ./Src/gr.c Sun Feb 9 21:45:43 1992 --- ../xtank1.3d-sound/Src/gr.c Wed Jun 24 12:55:17 1992 *************** *** 134,139 **** --- 134,143 ---- /* Initialize 3D values for terminal */ init_terminal_3d(t); + #ifdef SOUND + init_terminal_sound(t); + #endif SOUND + return 0; } *************** *** 174,179 **** --- 178,188 ---- close_terminal(t) Terminal *t; { + #ifdef SOUND + if (t->rplay_fd > 0) { + close(t->rplay_fd); + } + #endif SOUND close_video((Video *) t->video); free((char *) t); } diff -c -r ./Src/hit.c ../xtank1.3d-sound/Src/hit.c *** ./Src/hit.c Sun Feb 9 21:45:45 1992 --- ../xtank1.3d-sound/Src/hit.c Mon Jul 6 09:29:07 1992 *************** *** 52,59 **** #include "terminal.h" #include "cosell.h" #include "globals.h" - extern Map real_map; extern Settings settings; --- 52,61 ---- #include "terminal.h" #include "cosell.h" #include "globals.h" + #ifdef SOUND + #include "sound.h" + #endif SOUND extern Map real_map; extern Settings settings; *************** *** 98,103 **** --- 100,109 ---- Side side; int has_ramplate1, has_ramplate2; + #ifdef SOUND + play_in_view(v1->loc, VEHICLE_HIT_VEHICLE_SOUND); + #endif SOUND + #ifdef GDEBUG int itemp1, itemp2; static FILE *statfile = NULL; *************** *** 196,201 **** --- 202,211 ---- int dx, dy, damage, damage1, damage2; int has_ramplate = FALSE; + #ifdef SOUND + play_in_view(v->loc, VEHICLE_HIT_WALL_SOUND); + #endif SOUND + #ifdef GDEBUG int itemp1, itemp2; static FILE *statfile = NULL; *************** *** 596,601 **** --- 606,614 ---- b->flags &= ~wl; /* tell all the combatants to update their map */ invalidate_maps(); + #ifdef SOUND + play_in_view_x_y(x, y, TANK_EXPLOSION_SOUND); + #endif SOUND } return damage; diff -c -r ./Src/init.c ../xtank1.3d-sound/Src/init.c *** ./Src/init.c Sun Feb 9 21:45:47 1992 --- ../xtank1.3d-sound/Src/init.c Mon Jul 6 11:37:06 1992 *************** *** 94,99 **** --- 94,102 ---- FALSE, /* Boolean no_nametags */ TRUE, /* Boolean team_score GHS */ FALSE, /* Boolean no_radar */ + #ifdef SOUND + FALSE, /* Boolean no_sound */ + #endif SOUND 10000, /* int winning_score GHS */ 20, /* int takeover_time */ diff -c -r ./Src/interface.c ../xtank1.3d-sound/Src/interface.c *** ./Src/interface.c Wed Feb 12 22:10:34 1992 --- ../xtank1.3d-sound/Src/interface.c Mon Jul 6 11:37:37 1992 *************** *** 205,211 **** "No wear", "Restart", "Commentator", "Full map", "Pay to Play", "Robots don't Win", "Scale Armor to Max", "No name tags", ! "Team Scoring","Disable RADAR" }, *programs_entries[MAX_PDESCS], *players_entries[MAX_TERMINALS]; --- 205,214 ---- "No wear", "Restart", "Commentator", "Full map", "Pay to Play", "Robots don't Win", "Scale Armor to Max", "No name tags", ! "Team Scoring","Disable RADAR", ! #ifdef SOUND ! "Disable Sound" ! #endif SOUND }, *programs_entries[MAX_PDESCS], *players_entries[MAX_TERMINALS]; *************** *** 293,300 **** menu_set_hil(&menu_sys, FLAGS_MENU, 10); if (settings.si.team_score) menu_set_hil(&menu_sys, FLAGS_MENU, 11); ! if (settings.si.no_radar) menu_set_hil(&menu_sys, FLAGS_MENU, 12); } --- 296,307 ---- menu_set_hil(&menu_sys, FLAGS_MENU, 10); if (settings.si.team_score) menu_set_hil(&menu_sys, FLAGS_MENU, 11); ! if (settings.si.no_radar) menu_set_hil(&menu_sys, FLAGS_MENU, 12); + #ifdef SOUND + if (settings.si.no_sound) + menu_set_hil(&menu_sys, FLAGS_MENU, 13); + #endif SOUND } *************** *** 729,734 **** --- 736,746 ---- case 12: settings.si.no_radar ^= TRUE; break; + #ifdef SOUND + case 13: + settings.si.no_sound ^= TRUE; + break; + #endif SOUND } } diff -c -r ./Src/lowlib.c ../xtank1.3d-sound/Src/lowlib.c *** ./Src/lowlib.c Sun Feb 9 21:45:52 1992 --- ../xtank1.3d-sound/Src/lowlib.c Wed Jul 8 10:04:36 1992 *************** *** 73,78 **** --- 73,81 ---- #include "cosell.h" #include "outpost.h" #include "globals.h" + #ifdef SOUND + #include "sound.h" + #endif SOUND extern Weapon_stat weapon_stat[]; extern Armor_stat armor_stat[]; *************** *** 684,689 **** --- 687,760 ---- #endif /* !NO_NEW_RADAR */ make_bullet(cv, &bloc, w->type, angle + PI / 100 * (50 - rnd(101)) / 50); } + + #ifdef SOUND + switch(w->type) { + case LMG: + play_in_view(cv->loc, LMG_SOUND); + break; + case MG: + play_in_view(cv->loc, MG_SOUND); + break; + case HMG: + play_in_view(cv->loc, HMG_SOUND); + break; + case LRIFLE: + play_in_view(cv->loc, LRIFLE_SOUND); + break; + case RIFLE: + play_in_view(cv->loc, RIFLE_SOUND); + break; + case HRIFLE: + play_in_view(cv->loc, HRIFLE_SOUND); + break; + case LCANNON: + play_in_view(cv->loc, LCANNON_SOUND); + break; + case CANNON: + play_in_view(cv->loc, CANNON_SOUND); + break; + case HCANNON: + play_in_view(cv->loc, HCANNON_SOUND); + break; + case LROCKET: + play_in_view(cv->loc, LROCKET_SOUND); + break; + case ROCKET: + play_in_view(cv->loc, ROCKET_SOUND); + break; + case HROCKET: + play_in_view(cv->loc, HROCKET_SOUND); + break; + case ACID: + play_in_view(cv->loc, ACID_SOUND); + break; + case FLAME: + play_in_view(cv->loc, FLAME_SOUND); + break; + case MINE: + play_in_view(cv->loc, MINE_SOUND); + break; + case SEEKER: + play_in_view(cv->loc, SEEKER_SOUND); + break; + case SLICK: + play_in_view(cv->loc, SLICK_SOUND); + break; + case PROCKET: + play_in_view(cv->loc, PROCKET_SOUND); + break; + case UMISSLE: + play_in_view(cv->loc, UMISSLE_SOUND); + break; + case HARM: + play_in_view(cv->loc, HARM_SOUND); + break; + case DISC: + play_in_view(cv->loc, DISC_SOUND); + break; + } + #endif SOUND } check_time(); diff -c -r ./Src/main.c ../xtank1.3d-sound/Src/main.c *** ./Src/main.c Sun Feb 9 21:45:53 1992 --- ../xtank1.3d-sound/Src/main.c Wed Jun 24 12:55:18 1992 *************** *** 252,257 **** --- 252,258 ---- debug("Opening graphics toolkit"); open_graphics(); + /* Parse command line for display names and make a terminal for each one */ debug("Making terminals"); if (argc - iNumOpts > 1) diff -c -r ./Src/radar.c ../xtank1.3d-sound/Src/radar.c *** ./Src/radar.c Sun Feb 9 21:46:03 1992 --- ../xtank1.3d-sound/Src/radar.c Wed Jul 8 10:08:55 1992 *************** *** 45,50 **** --- 45,53 ---- #include "map.h" #include "vehicle.h" #include "globals.h" + #ifdef SOUND + #include "sound.h" + #endif SOUND extern Map real_map; Boolean traceaction = FALSE; *************** *** 118,124 **** int init_x, init_y; int x, y; int i; ! r = (Radar *) record; switch (action) --- 121,127 ---- int init_x, init_y; int x, y; int i; ! r = (Radar *) record; switch (action) *************** *** 170,175 **** --- 173,181 ---- /* If there is a vehicle in this box, make a blip */ if (vehicle_flags) { + #ifdef SOUND + play_owner(v, BLIP_SOUND); + #endif SOUND b = &r->blip[r->num_blips++]; b->x = grid2map(x) + MAP_BOX_SIZE / 4; b->y = grid2map(y) + MAP_BOX_SIZE / 4; *************** *** 182,187 **** --- 188,194 ---- /* Increment the position counter modulo 24 */ if (++r->pos == 24) r->pos = 0; + /* Save the old sweeper position, and compute the new one */ r->old_start_x = r->start_x; diff -c -r ./Src/setup.c ../xtank1.3d-sound/Src/setup.c *** ./Src/setup.c Sun Feb 9 21:46:05 1992 --- ../xtank1.3d-sound/Src/setup.c Wed Jul 8 10:28:39 1992 *************** *** 55,60 **** --- 55,63 ---- #include "thread.h" #include "globals.h" #include "assert.h" + #ifdef SOUND + #include "sound.h" + #endif SOUND extern Map real_map; extern Boolean game_paused; *************** *** 279,287 **** --- 282,298 ---- game_running = True; + #ifdef SOUND + play_all(START_SOUND); + #endif SOUND + do { status = animate(); } while (status == GAME_RUNNING); + + #ifdef SOUND + play_all(END_SOUND); + #endif SOUND game_running = False; Only in ../xtank1.3d-sound/Src: sound.c diff -c -r ./Src/Include/settings.h ../xtank1.3d-sound/Src/Include/settings.h *** ./Src/Include/settings.h Tue Feb 4 00:03:13 1992 --- ../xtank1.3d-sound/Src/Include/settings.h Mon Jul 6 11:36:33 1992 *************** *** 18,23 **** --- 18,26 ---- Boolean no_nametags; /* whether vehicles are anonymous */ Boolean team_score; /* whether to use team scoring */ Boolean no_radar; /* turns everyone's radar off */ + #ifdef SOUND + Boolean no_sound; /* turns everyone's sound off */ + #endif SOUND int winning_score; /* score needed to win the game */ int takeover_time; /* how long you have to be in a square in order to capture it (in War game) */ Only in ../xtank1.3d-sound/Src/Include: sound.h diff -c -r ./Src/Include/terminal.h ../xtank1.3d-sound/Src/Include/terminal.h *** ./Src/Include/terminal.h Sat Jan 25 21:02:03 1992 --- ../xtank1.3d-sound/Src/Include/terminal.h Wed Jun 24 12:55:19 1992 *************** *** 52,57 **** --- 52,60 ---- Line line[MAX_LINES]; /* lines drawn on the screen */ Boolean observer; /* True if this terminal is not controlling a vehicle */ + #ifdef SOUND + int rplay_fd; + #endif SOUND } Terminal;