︙ | | | ︙ | |
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
@autoreleasepool {
OFString *path =
[OFString stringWithFormat:@"packages/%@", name];
OFIRI *IRI = [Cube.sharedInstance.gameDataIRI
IRIByAppendingPathComponent:path];
#ifdef USE_MIXER
if (mod = Mix_LoadMUS(
IRI.fileSystemRepresentation.UTF8String)) {
Mix_PlayMusic(mod, -1);
Mix_VolumeMusic((musicvol * MAXVOL) / 255);
}
#else
if (mod = FMUSIC_LoadSong(
IRI.fileSystemRepresentation.UTF8String)) {
FMUSIC_PlaySong(mod);
FMUSIC_SetMasterVolume(mod, musicvol);
} else if (stream = FSOUND_Stream_Open(
IRI.fileSystemRepresentation.UTF8String,
FSOUND_LOOP_NORMAL, 0, 0)) {
int chan =
FSOUND_Stream_Play(FSOUND_FREE, stream);
|
|
|
>
|
|
>
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
@autoreleasepool {
OFString *path =
[OFString stringWithFormat:@"packages/%@", name];
OFIRI *IRI = [Cube.sharedInstance.gameDataIRI
IRIByAppendingPathComponent:path];
#ifdef USE_MIXER
if ((mod = Mix_LoadMUS(
IRI.fileSystemRepresentation.UTF8String)) !=
NULL) {
Mix_PlayMusic(mod, -1);
Mix_VolumeMusic((musicvol * MAXVOL) / 255);
}
#else
if ((mod = FMUSIC_LoadSong(
IRI.fileSystemRepresentation.UTF8String)) !=
NULL) {
FMUSIC_PlaySong(mod);
FMUSIC_SetMasterVolume(mod, musicvol);
} else if (stream = FSOUND_Stream_Open(
IRI.fileSystemRepresentation.UTF8String,
FSOUND_LOOP_NORMAL, 0, 0)) {
int chan =
FSOUND_Stream_Play(FSOUND_FREE, stream);
|
︙ | | | ︙ | |
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
#else
FSOUND_Close();
#endif
}
VAR(stereo, 0, 1, 1);
void
updatechanvol(int chan, OFVector3D *loc)
{
int vol = soundvol, pan = 255 / 2;
if (loc) {
vdist(dist, v, *loc, player1->o);
vol -= (int)(dist * 3 * soundvol /
255); // simple mono distance attenuation
if (stereo && (v.x != 0 || v.y != 0)) {
|
|
|
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
#else
FSOUND_Close();
#endif
}
VAR(stereo, 0, 1, 1);
static void
updatechanvol(int chan, const OFVector3D *loc)
{
int vol = soundvol, pan = 255 / 2;
if (loc) {
vdist(dist, v, *loc, player1->o);
vol -= (int)(dist * 3 * soundvol /
255); // simple mono distance attenuation
if (stereo && (v.x != 0 || v.y != 0)) {
|
︙ | | | ︙ | |
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
Mix_SetPanning(chan, 255 - pan, pan);
#else
FSOUND_SetVolume(chan, vol);
FSOUND_SetPan(chan, pan);
#endif
}
void
newsoundloc(int chan, OFVector3D *loc)
{
assert(chan >= 0 && chan < MAXCHAN);
soundlocs[chan].loc = *loc;
soundlocs[chan].inuse = true;
}
void
|
|
|
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
Mix_SetPanning(chan, 255 - pan, pan);
#else
FSOUND_SetVolume(chan, vol);
FSOUND_SetPan(chan, pan);
#endif
}
static void
newsoundloc(int chan, const OFVector3D *loc)
{
assert(chan >= 0 && chan < MAXCHAN);
soundlocs[chan].loc = *loc;
soundlocs[chan].inuse = true;
}
void
|
︙ | | | ︙ | |
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
addmsg(0, 2, SV_SOUND, n);
playsound(n);
}
int soundsatonce = 0, lastsoundmillis = 0;
void
playsound(int n, OFVector3D *loc)
{
if (nosound)
return;
if (!soundvol)
return;
if (lastmillis == lastsoundmillis)
soundsatonce++;
|
|
|
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
addmsg(0, 2, SV_SOUND, n);
playsound(n);
}
int soundsatonce = 0, lastsoundmillis = 0;
void
playsound(int n, const OFVector3D *loc)
{
if (nosound)
return;
if (!soundvol)
return;
if (lastmillis == lastsoundmillis)
soundsatonce++;
|
︙ | | | ︙ | |