… | |
… | |
74 | i->second = face; |
74 | i->second = face; |
75 | else |
75 | else |
76 | ht.insert (std::make_pair (strdup (str), face)); |
76 | ht.insert (std::make_pair (strdup (str), face)); |
77 | } |
77 | } |
78 | |
78 | |
|
|
79 | //TODO: remove |
|
|
80 | // for gcfclient-compatibility, to vanish at some point |
|
|
81 | faceidx old_sound_index [SOUND_CAST_SPELL_0]; |
|
|
82 | |
79 | /* |
83 | /* |
80 | * Plays a sound for specified player only |
84 | * Plays a sound for specified player only |
81 | */ |
85 | */ |
82 | void |
86 | void |
83 | client::play_sound (faceidx sound, int dx, int dy) |
87 | client::play_sound (faceidx sound, int dx, int dy) |
84 | { |
88 | { |
85 | if (!sound) |
89 | if (!sound) |
86 | return; |
90 | return; |
87 | |
91 | |
88 | if (this->sound) |
|
|
89 | { |
|
|
90 | // gcfclient compatibility |
|
|
91 | |
|
|
92 | packet sl ("sound"); |
|
|
93 | |
|
|
94 | sl << uint8 (dx) |
|
|
95 | << uint8 (dy) |
|
|
96 | << uint16 (sound) |
|
|
97 | << uint8 (SOUND_NORMAL); |
|
|
98 | |
|
|
99 | send_packet (sl); |
|
|
100 | } |
|
|
101 | else if (fx_want [FT_SOUND]) |
92 | if (fx_want [FT_SOUND]) |
102 | { |
93 | { |
103 | // cfplus |
94 | // cfplus |
104 | send_face (sound); |
95 | send_face (sound); |
105 | flush_fx (); |
96 | flush_fx (); |
106 | |
97 | |
… | |
… | |
116 | |
107 | |
117 | *len = sl.cur - len; // patch in group length |
108 | *len = sl.cur - len; // patch in group length |
118 | |
109 | |
119 | send_packet (sl); |
110 | send_packet (sl); |
120 | } |
111 | } |
|
|
112 | else if (this->sound) |
|
|
113 | { |
|
|
114 | //TODO: remove, or make bearable |
|
|
115 | // gcfclient compatibility |
|
|
116 | |
|
|
117 | int gcfclient_sound; |
|
|
118 | for (gcfclient_sound = SOUND_CAST_SPELL_0; gcfclient_sound--; ) |
|
|
119 | if (old_sound_index [gcfclient_sound] == sound) |
|
|
120 | { |
|
|
121 | packet sl ("sound"); |
|
|
122 | |
|
|
123 | sl << uint8 (dx) |
|
|
124 | << uint8 (dy) |
|
|
125 | << uint16 (gcfclient_sound) |
|
|
126 | << uint8 (SOUND_NORMAL); |
|
|
127 | |
|
|
128 | send_packet (sl); |
|
|
129 | |
|
|
130 | break; |
|
|
131 | } |
|
|
132 | } |
121 | } |
133 | } |
122 | |
134 | |