Cube  Diff

Differences From Artifact [577f0e91da]:

To Artifact [34f20331ba]:


124
125
126
127
128
129
130
131
132
133
134
135


136




137







138
139

140
141
142
143
144
145
146

#ifdef USE_MIXER
vector<Mix_Chunk *> samples;
#else
vector<FSOUND_SAMPLE *> samples;
#endif

cvector snames;

int
registersound(char *name)
{


	loopv(snames) if (strcmp(snames[i], name) == 0) return i;




	snames.add(newstring(name));







	samples.add(NULL);
	return samples.length() - 1;

}
COMMAND(registersound, ARG_1EST)

void
cleansound()
{
	if (nosound)







|


|

>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
|
|
>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

#ifdef USE_MIXER
vector<Mix_Chunk *> samples;
#else
vector<FSOUND_SAMPLE *> samples;
#endif

static OFMutableArray<OFString *> *snames;

int
registersound(char *name_)
{
	@autoreleasepool {
		OFString *name = @(name_);

		int i = 0;
		for (OFString *iter in snames) {
			if ([iter isEqual:name])
				return i;

			i++;
		}

		if (snames == nil)
			snames = [[OFMutableArray alloc] init];

		[snames addObject:name];
		samples.add(NULL);
		return samples.length() - 1;
	}
}
COMMAND(registersound, ARG_1EST)

void
cleansound()
{
	if (nosound)
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	if (n < 0 || n >= samples.length()) {
		conoutf(@"unregistered sound: %d", n);
		return;
	}

	if (!samples[n]) {
		OFString *path = [OFString
		    stringWithFormat:@"packages/sounds/%s.wav", snames[n]];
		OFIRI *IRI = [Cube.sharedInstance.gameDataIRI
		    IRIByAppendingPathComponent:path];

#ifdef USE_MIXER
		samples[n] =
		    Mix_LoadWAV(IRI.fileSystemRepresentation.UTF8String);
#else







|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
	if (n < 0 || n >= samples.length()) {
		conoutf(@"unregistered sound: %d", n);
		return;
	}

	if (!samples[n]) {
		OFString *path = [OFString
		    stringWithFormat:@"packages/sounds/%@.wav", snames[n]];
		OFIRI *IRI = [Cube.sharedInstance.gameDataIRI
		    IRIByAppendingPathComponent:path];

#ifdef USE_MIXER
		samples[n] =
		    Mix_LoadWAV(IRI.fileSystemRepresentation.UTF8String);
#else