hedgewars/uGears.pas
changeset 7110 c91d33837b0d
parent 7068 b1b7eb9c8cc9
child 7135 4d863aadd0b2
equal deleted inserted replaced
7020:846cea23aea2 7110:c91d33837b0d
    59 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
    59 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
    60     uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
    60     uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
    61     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
    61     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
    62     uGearsHedgehog, uGearsUtils, uGearsList;
    62     uGearsHedgehog, uGearsUtils, uGearsList;
    63 
    63 
       
    64 var skipFlag: boolean;
    64 
    65 
    65 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
    66 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
    66 //procedure AmmoFlameWork(Ammo: PGear); forward;
    67 //procedure AmmoFlameWork(Ammo: PGear); forward;
    67 function  GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward;
    68 function  GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward;
    68 procedure SpawnBoxOfSmth; forward;
    69 procedure SpawnBoxOfSmth; forward;
    74     delay2: LongWord;
    75     delay2: LongWord;
    75     step: (stDelay, stChDmg, stSweep, stTurnReact,
    76     step: (stDelay, stChDmg, stSweep, stTurnReact,
    76     stAfterDelay, stChWin, stWater, stChWin2, stHealth,
    77     stAfterDelay, stChWin, stWater, stChWin2, stHealth,
    77     stSpawn, stNTurn);
    78     stSpawn, stNTurn);
    78     upd: Longword;
    79     upd: Longword;
       
    80     //SDMusic: shortstring;
    79 
    81 
    80 // For better maintainability the step handlers of gears are stored in
    82 // For better maintainability the step handlers of gears are stored in
    81 // separate files.
    83 // separate files.
    82 // Note: step handlers of gears that are hedgehogs are in a different file
    84 // Note: step handlers of gears that are hedgehogs are in a different file
    83 //       than the handlers for all other gears.
    85 //       than the handlers for all other gears.
   189 
   191 
   190 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   192 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   191     StepSoundChannel:= LoopSound(sndSteps)
   193     StepSoundChannel:= LoopSound(sndSteps)
   192 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then
   194 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then
   193     begin
   195     begin
   194     StopSound(StepSoundChannel);
   196     StopSoundChan(StepSoundChannel);
   195     StepSoundChannel:= -1
   197     StepSoundChannel:= -1
   196     end;
   198     end;
   197 
   199 
   198 if StepSoundTimer > 0 then
   200 if StepSoundTimer > 0 then
   199     dec(StepSoundTimer, 1);
   201     dec(StepSoundTimer, 1);
   311                     Ammoz[amTardis].Probability:= 0;
   313                     Ammoz[amTardis].Probability:= 0;
   312                     end;
   314                     end;
   313                 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   315                 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   314                 playSound(sndSuddenDeath);
   316                 playSound(sndSuddenDeath);
   315                 StopMusic //No SDMusic for now
   317                 StopMusic //No SDMusic for now
   316                     //MusicFN:= SDMusic;
   318                     //ChangeMusic(SDMusic)
   317                     //ChangeMusic
       
   318                     end
   319                     end
   319                 else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then
   320                 else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then
   320                     begin
   321                     begin
   321                     i:= cSuddenDTurns - TotalRounds;
   322                     i:= cSuddenDTurns - TotalRounds;
   322                     s:= inttostr(i);
   323                     s:= inttostr(i);
   419                 if (TurnTimeLeft = 5000)
   420                 if (TurnTimeLeft = 5000)
   420                 and (cHedgehogTurnTime >= 10000)
   421                 and (cHedgehogTurnTime >= 10000)
   421                 and (not PlacingHogs)
   422                 and (not PlacingHogs)
   422                 and (CurrentHedgehog^.Gear <> nil)
   423                 and (CurrentHedgehog^.Gear <> nil)
   423                 and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then
   424                 and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then
   424                     PlaySound(sndHurry, CurrentTeam^.voicepack);
   425                     PlaySoundV(sndHurry, CurrentTeam^.voicepack);
   425             if ReadyTimeLeft > 0 then
   426             if ReadyTimeLeft > 0 then
   426                 begin
   427                 begin
   427                 if (ReadyTimeLeft = 2000) and (LastVoice.snd = sndNone) then
   428                 if (ReadyTimeLeft = 2000) and (LastVoice.snd = sndNone) then
   428                     AddVoice(sndComeonthen, CurrentTeam^.voicepack);
   429                     AddVoice(sndComeonthen, CurrentTeam^.voicepack);
   429                 dec(ReadyTimeLeft)
   430                 dec(ReadyTimeLeft)
   443 
   444 
   444 if ((GameTicks and $FFFF) = $FFFF) then
   445 if ((GameTicks and $FFFF) = $FFFF) then
   445     begin
   446     begin
   446     if (not CurrentTeam^.ExtDriven) then
   447     if (not CurrentTeam^.ExtDriven) then
   447         begin
   448         begin
   448         SendIPC('#');
   449         SendIPC(_S'#');
   449         AddFileLog('hiTicks increment message sent')
   450         AddFileLog('hiTicks increment message sent')
   450         end;
   451         end;
   451 
   452 
   452     if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then
   453     if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then
   453         inc(hiTicks) // we do not recieve a message for this
   454         inc(hiTicks) // we do not recieve a message for this
  1158 
  1159 
  1159 procedure chSkip(var s: shortstring);
  1160 procedure chSkip(var s: shortstring);
  1160 begin
  1161 begin
  1161 s:= s; // avoid compiler hint
  1162 s:= s; // avoid compiler hint
  1162 if not CurrentTeam^.ExtDriven then
  1163 if not CurrentTeam^.ExtDriven then
  1163     SendIPC(',');
  1164     SendIPC(_S',');
  1164 uStats.Skipped;
  1165 uStats.Skipped;
  1165 skipFlag:= true
  1166 skipFlag:= true
  1166 end;
  1167 end;
  1167 
  1168 
  1168 procedure chHogSay(var s: shortstring);
  1169 procedure chHogSay(var s: shortstring);
  1324     //typed const
  1325     //typed const
  1325     delay:= 0;
  1326     delay:= 0;
  1326     delay2:= 0;
  1327     delay2:= 0;
  1327     step:= stDelay;
  1328     step:= stDelay;
  1328     upd:= 0;
  1329     upd:= 0;
       
  1330 
       
  1331     //SDMusic:= 'hell.ogg';
  1329 end;
  1332 end;
  1330 
  1333 
  1331 procedure freeModule;
  1334 procedure freeModule;
  1332 begin
  1335 begin
  1333     FreeGearsList();
  1336     FreeGearsList();