anchor.diff:    if FreeBuf = 0 then exit;//Don't play if there's no room left
   
     ID := word(SoundID);
  -  Assert(Waves[ID].IsLoaded);
  +  Assert(fWaves[ID].IsLoaded);
   
     //Stop previously playing sound and release buffer
  -  AlSourceStop(Sound[FreeBuf].ALSource);
  -  AlSourcei(Sound[FreeBuf].ALSource, AL_BUFFER, 0);
  +  AlSourceStop(fSound[FreeBuf].ALSource);
  +  AlSourcei(fSound[FreeBuf].ALSource, AL_BUFFER, 0);
   
     //Assign new data to buffer and assign it to source
  -  AlBufferData(Sound[FreeBuf].ALBuffer, AL_FORMAT_MONO8, @Waves[ID].Data[0], Waves[ID].Head.DataSize, Waves[ID].Head.SampleRate);
  +  AlBufferData(fSound[FreeBuf].ALBuffer, AL_FORMAT_MONO8, @fWaves[ID].Data[0], fWaves[ID].Head.DataSize, fWaves[ID].Head.SampleRate);
   
     //Set source properties
  -  AlSourcei(Sound[FreeBuf].ALSource, AL_BUFFER, Sound[FreeBuf].ALBuffer);
  -  AlSourcef(Sound[FreeBuf].ALSource, AL_PITCH, 1.0);
  -  AlSourcef(Sound[FreeBuf].ALSource, AL_GAIN, 1.0 * Volume * SoundGain);
  +  AlSourcei(fSound[FreeBuf].ALSource, AL_BUFFER, fSound[FreeBuf].ALBuffer);
  +  AlSourcef(fSound[FreeBuf].ALSource, AL_PITCH, 1.0);
  +  AlSourcef(fSound[FreeBuf].ALSource, AL_GAIN, 1.0 * Volume * fSoundGain);
     if Attenuated then begin
       Dif[1]:=Loc.X; Dif[2]:=Loc.Y; Dif[3]:=0;
  -    AlSourcefv(Sound[FreeBuf].ALSource, AL_POSITION, @Dif[1]);
  -    AlSourcei(Sound[FreeBuf].ALSource, AL_SOURCE_RELATIVE, AL_FALSE); //If Attenuated then it is not relative to the listener
  +    AlSourcefv(fSound[FreeBuf].ALSource, AL_POSITION, @Dif[1]);
  +    AlSourcei(fSound[FreeBuf].ALSource, AL_SOURCE_RELATIVE, AL_FALSE); //If Attenuated then it is not relative to the listener
     end else
     begin
       //For sounds that do not change over distance, set to SOURCE_RELATIVE and make the position be 0,0,0 which means it will follow the listener
       //Do not simply set position to the listener as the listener could change while the sound is playing
       Dif[1]:=0; Dif[2]:=0; Dif[3]:=0;
  -    AlSourcefv(Sound[FreeBuf].ALSource, AL_POSITION, @Dif[1]);
  -    AlSourcei(Sound[FreeBuf].ALSource, AL_SOURCE_RELATIVE, AL_TRUE); //Relative to the listener, meaning it follows us
  -  end;
  -  AlSourcef(Sound[FreeBuf].ALSource, AL_REFERENCE_DISTANCE, 4.0);
  -  AlSourcef(Sound[FreeBuf].ALSource, AL_MAX_DISTANCE, MAX_DISTANCE);
  -  AlSourcef(Sound[FreeBuf].ALSource, AL_ROLLOFF_FACTOR, 1.0);
  -  AlSourcei(Sound[FreeBuf].ALSource, AL_LOOPING, AL_FALSE);
  +    AlSourcefv(fSound[FreeBuf].ALSource, AL_POSITION, @Dif[1]);
  +    AlSourcei(fSound[FreeBuf].ALSource, AL_SOURCE_RELATIVE, AL_TRUE); //Relative to the listener, meaning it follows us
  +  end;
  +  AlSourcef(fSound[FreeBuf].ALSource, AL_REFERENCE_DISTANCE, 4.0);
  +  AlSourcef(fSound[FreeBuf].ALSource, AL_MAX_DISTANCE, MAX_DISTANCE);
  +  AlSourcef(fSound[FreeBuf].ALSource, AL_ROLLOFF_FACTOR, 1.0);
  +  AlSourcei(fSound[FreeBuf].ALSource, AL_LOOPING, AL_FALSE);
   
     //Start playing
  -  AlSourcePlay(Sound[FreeBuf].ALSource);
  -  Sound[FreeBuf].Name := SSoundFX[SoundID];
  -  Sound[FreeBuf].Position := Loc;
  -  Sound[FreeBuf].Duration := round(Waves[ID].Head.FileSize / Waves[ID].Head.BytesPerSecond * 1000);
  -  Sound[FreeBuf].PlaySince := GetTickCount;
  +  AlSourcePlay(fSound[FreeBuf].ALSource);
  +  fSound[FreeBuf].Name := SSoundFX[SoundID];
  +  fSound[FreeBuf].Position := Loc;
  +  fSound[FreeBuf].Duration := round(fWaves[ID].Head.FileSize / fWaves[ID].Head.BytesPerSecond * 1000);
  +  fSound[FreeBuf].PlaySince := GetTickCount;
   end;
   
   
   function TSoundLib.GetWarriorSoundFile(aUnitType:TUnitType; aSound:TSoundToPlay; aNumber:byte; aLocale:string=''):string;
   begin
  -  if not IsSoundInitialized then exit;
  +  if not fIsSoundInitialized then exit;
     if (aLocale = '') and (fGame <> nil) and (fGame.fGlobalSettings <> nil) then
       aLocale := fGame.fGlobalSettings.Locale;
     if not (aUnitType in [ut_Militia .. ut_Barbarian]) then
  
positive.code:   //Find free buffer and use it
    FreeBuf := 0;
    for i:=1 to MAX_SOUNDS do begin
      alGetSourcei(Sound[i].ALSource, AL_SOURCE_STATE, @ALState);
      if ALState<>AL_PLAYING then begin
        FreeBuf:=i;
        break;
  
negative.code:   Tab2:array[1..200]of smallint;
    i,Tmp:integer;
  begin
    if not fIsSoundInitialized then exit;
    if not CheckFileExists(ExeDir+'data\sfx\sounds.dat') then exit;
    AssignFile(f, ExeDir+'data\sfx\sounds.dat'); Reset(f,1);
  
  