ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/sounds.C
(Generate patch)

Comparing deliantra/server/socket/sounds.C (file contents):
Revision 1.3 by root, Sun Sep 10 13:43:34 2006 UTC vs.
Revision 1.7 by root, Thu Dec 14 01:21:58 2006 UTC

1
2/*
3 * static char *rcsid_sound_c =
4 * "$Id: sounds.C,v 1.3 2006/09/10 13:43:34 root Exp $";
5 */
6
7/* Send bug reports to Raphael Quinet (quinet@montefiore.ulg.ac.be) */ 1/* Send bug reports to Raphael Quinet (quinet@montefiore.ulg.ac.be) */
8 2
9/** 3/**
10 * \file 4 * \file
11 * Sound-related functions. 5 * Sound-related functions.
29 */ 23 */
30void 24void
31play_sound_player_only (player *pl, short soundnum, sint8 x, sint8 y) 25play_sound_player_only (player *pl, short soundnum, sint8 x, sint8 y)
32{ 26{
33 char soundtype; 27 char soundtype;
34 SockList sl;
35 28
36 if (!pl->socket.sound) 29 if (!pl->socket.sound)
37 return; 30 return;
31
38 /* Do some quick conversion to the sound type we want. */ 32 /* Do some quick conversion to the sound type we want. */
39 if (soundnum >= SOUND_CAST_SPELL_0) 33 if (soundnum >= SOUND_CAST_SPELL_0)
40 { 34 {
41 soundtype = SOUND_SPELL; 35 soundtype = SOUND_SPELL;
42 soundnum -= SOUND_CAST_SPELL_0; 36 soundnum -= SOUND_CAST_SPELL_0;
43 } 37 }
44 else 38 else
45 soundtype = SOUND_NORMAL; 39 soundtype = SOUND_NORMAL;
46 40
47 sl.buf = (unsigned char *) malloc (MAXSOCKBUF); 41 packet sl;
48 strcpy ((char *) sl.buf, "sound "); 42
49 sl.len = strlen ((char *) sl.buf); 43 sl << "sound "
50 SockList_AddChar (&sl, x); 44 << uint8 (x)
51 SockList_AddChar (&sl, y); 45 << uint8 (y)
52 SockList_AddShort (&sl, soundnum); 46 << uint16 (soundnum)
53 SockList_AddChar (&sl, soundtype); 47 << uint8 (soundtype);
48
54 Send_With_Handling (&pl->socket, &sl); 49 Send_With_Handling (&pl->socket, &sl);
55 free (sl.buf);
56} 50}
57 51
58#define POW2(x) ((x) * (x)) 52#define POW2(x) ((x) * (x))
59 53
60/** Plays some sound on map at x,y. */ 54/** Plays some sound on map at x,y. */
61void 55void
62play_sound_map (mapstruct *map, int x, int y, short sound_num) 56play_sound_map (maptile *map, int x, int y, short sound_num)
63{ 57{
64 player *pl; 58 player *pl;
65 59
66 if (sound_num >= NROF_SOUNDS) 60 if (sound_num >= NROF_SOUNDS)
67 { 61 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines