@@ -560,16 +560,16 @@ int S_CalculateSoundPriority(const fixed_t* pt, int channel, int attenuation)
560
560
return priority;
561
561
}
562
562
563
- static int ResolveSound (int soundid)
563
+ static size_t ResolveSound (size_t soundid)
564
564
{
565
565
const sfxinfo_t & sfx = S_sfx[soundid];
566
566
567
567
if (sfx.israndom )
568
568
{
569
569
while (S_sfx[soundid].israndom )
570
570
{
571
- std::vector<int >& list = S_rnd[soundid];
572
- soundid = list[P_Random () % static_cast < int >( list.size () )];
571
+ std::vector<size_t >& list = S_rnd[soundid];
572
+ soundid = list[P_Random () % list.size ()];
573
573
}
574
574
return soundid;
575
575
}
@@ -593,15 +593,15 @@ static void S_StartSound(fixed_t* pt, fixed_t x, fixed_t y, int channel,
593
593
return ;
594
594
595
595
// check for bogus sound #
596
- if (sfx_id < 1 || sfx_id > static_cast <int >(S_sfx.size ()) - 1 )
596
+ if (sfx_id < 0 || sfx_id > static_cast <int >(S_sfx.size ()) - 1 )
597
597
{
598
598
DPrintf (" Bad sfx #: %d\n " , sfx_id);
599
599
return ;
600
600
}
601
601
602
602
sfxinfo_t * sfxinfo = &S_sfx[sfx_id];
603
603
604
- while (sfxinfo->link != static_cast <int >(sfxinfo_t ::NO_LINK))
604
+ while (sfxinfo->link != static_cast <size_t >(sfxinfo_t ::NO_LINK))
605
605
{
606
606
sfx_id = ResolveSound (sfxinfo->link );
607
607
sfxinfo = &S_sfx[sfx_id];
@@ -610,7 +610,7 @@ static void S_StartSound(fixed_t* pt, fixed_t x, fixed_t y, int channel,
610
610
if (!sfxinfo->data )
611
611
{
612
612
I_LoadSound (sfxinfo);
613
- while (sfxinfo->link != static_cast <int >(sfxinfo_t ::NO_LINK))
613
+ while (sfxinfo->link != static_cast <size_t >(sfxinfo_t ::NO_LINK))
614
614
{
615
615
sfx_id = ResolveSound (sfxinfo->link );
616
616
sfxinfo = &S_sfx[sfx_id];
@@ -1202,7 +1202,7 @@ int S_FindSoundByLump(int lump)
1202
1202
return -1 ;
1203
1203
}
1204
1204
1205
- int S_AddSoundLump (const char *logicalname, int lump)
1205
+ size_t S_AddSoundLump (const char *logicalname, int lump)
1206
1206
{
1207
1207
sfxinfo_t & new_sfx = S_sfx.emplace_back ();
1208
1208
@@ -1220,7 +1220,7 @@ void S_ClearSoundLumps()
1220
1220
S_rnd.clear ();
1221
1221
}
1222
1222
1223
- int FindSoundNoHash (const char * logicalname)
1223
+ size_t FindSoundNoHash (const char * logicalname)
1224
1224
{
1225
1225
for (size_t i = 0 ; i < S_sfx.size (); i++)
1226
1226
if (iequals (logicalname, S_sfx[i].name ))
@@ -1229,24 +1229,24 @@ int FindSoundNoHash(const char* logicalname)
1229
1229
return S_sfx.size ();
1230
1230
}
1231
1231
1232
- int FindSoundTentative (const char * name)
1232
+ size_t FindSoundTentative (const char * name)
1233
1233
{
1234
- int id = FindSoundNoHash (name);
1235
- if (id == static_cast < int >( S_sfx.size () ))
1234
+ size_t id = FindSoundNoHash (name);
1235
+ if (id == S_sfx.size ())
1236
1236
{
1237
1237
id = S_AddSoundLump (name, -1 );
1238
1238
}
1239
1239
return id;
1240
1240
}
1241
1241
1242
- int S_AddSound (const char *logicalname, const char *lumpname)
1242
+ size_t S_AddSound (const char *logicalname, const char *lumpname)
1243
1243
{
1244
- int sfxid = FindSoundNoHash (logicalname);
1244
+ size_t sfxid = FindSoundNoHash (logicalname);
1245
1245
1246
1246
const int lump = lumpname ? W_CheckNumForName (lumpname) : -1 ;
1247
1247
1248
1248
// Otherwise, prepare a new one.
1249
- if (sfxid != static_cast < int >( S_sfx.size () ))
1249
+ if (sfxid != S_sfx.size ())
1250
1250
{
1251
1251
sfxinfo_t & sfx = S_sfx[sfxid];
1252
1252
@@ -1264,7 +1264,7 @@ int S_AddSound(const char *logicalname, const char *lumpname)
1264
1264
return sfxid;
1265
1265
}
1266
1266
1267
- void S_AddRandomSound (int owner, std::vector<int >& list)
1267
+ void S_AddRandomSound (size_t owner, std::vector<size_t >& list)
1268
1268
{
1269
1269
S_rnd[owner] = list;
1270
1270
S_sfx[owner].link = owner;
@@ -1395,22 +1395,22 @@ void S_ParseSndInfo()
1395
1395
else if (os.compareTokenNoCase (" alias" ))
1396
1396
{
1397
1397
os.mustScan ();
1398
- const int sfxfrom = S_AddSound (os.getToken ().c_str (), NULL );
1398
+ const size_t sfxfrom = S_AddSound (os.getToken ().c_str (), NULL );
1399
1399
os.mustScan ();
1400
1400
S_sfx[sfxfrom].link = FindSoundTentative (os.getToken ().c_str ());
1401
1401
}
1402
1402
else if (os.compareTokenNoCase (" random" ))
1403
1403
{
1404
- std::vector<int > list;
1404
+ std::vector<size_t > list;
1405
1405
1406
1406
os.mustScan ();
1407
- const int owner = S_AddSound (os.getToken ().c_str (), NULL );
1407
+ const size_t owner = S_AddSound (os.getToken ().c_str (), NULL );
1408
1408
1409
1409
os.mustScan ();
1410
1410
os.assertTokenIs (" {" );
1411
1411
while (os.scan () && !os.compareToken (" }" ))
1412
1412
{
1413
- const int sfxto = FindSoundTentative (os.getToken ().c_str ());
1413
+ const size_t sfxto = FindSoundTentative (os.getToken ().c_str ());
1414
1414
1415
1415
if (owner == sfxto)
1416
1416
{
0 commit comments