hedgewars/uWorld.pas
branchhedgeroid
changeset 5530 25d4118056e1
parent 5502 0d1a1aeed00a
parent 5523 9ac5acc4f3e5
child 5619 2ec22ebeb6f5
equal deleted inserted replaced
5516:8710987d3484 5530:25d4118056e1
    31 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
    31 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
    32 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    32 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    33 procedure HideMission;
    33 procedure HideMission;
    34 procedure ShakeCamera(amount: LongWord);
    34 procedure ShakeCamera(amount: LongWord);
    35 procedure MoveCamera;
    35 procedure MoveCamera;
       
    36 procedure onFocusStateChanged;
    36 
    37 
    37 implementation
    38 implementation
    38 uses
    39 uses
    39     uStore,
    40     uStore,
    40     uMisc,
    41     uMisc,
    49     uVariables,
    50     uVariables,
    50     uUtils,
    51     uUtils,
    51     uTextures,
    52     uTextures,
    52     uRender,
    53     uRender,
    53     uCaptions,
    54     uCaptions,
    54     uCursor
    55     uCursor,
       
    56     uCommands
    55     ;
    57     ;
    56 
    58 
    57 var cWaveWidth, cWaveHeight: LongInt;
    59 var cWaveWidth, cWaveHeight: LongInt;
    58     AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt;
    60     AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt;
    59     tmpSurface: PSDL_Surface;
    61     tmpSurface: PSDL_Surface;
  1173 procedure MoveCamera;
  1175 procedure MoveCamera;
  1174 var EdgesDist, wdy, shs: LongInt;
  1176 var EdgesDist, wdy, shs: LongInt;
  1175     PrevSentPointTime: LongWord = 0;
  1177     PrevSentPointTime: LongWord = 0;
  1176 begin
  1178 begin
  1177 {$IFNDEF MOBILE}
  1179 {$IFNDEF MOBILE}
  1178 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus then
  1180 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus and (GameState <> gsConfirm) then
  1179     uCursor.updatePosition();
  1181     uCursor.updatePosition();
  1180 {$ENDIF}
  1182 {$ENDIF}
  1181 
  1183 
  1182 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then
  1184 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then
  1183     if (not autoCameraOn) or (abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4) then
  1185     if (not autoCameraOn) or (abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4) then
  1310     amount:= Max(1, amount);
  1312     amount:= Max(1, amount);
  1311     WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2));
  1313     WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2));
  1312     WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
  1314     WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
  1313 end;
  1315 end;
  1314 
  1316 
       
  1317 
       
  1318 procedure onFocusStateChanged;
       
  1319 begin
       
  1320 if (not cHasFocus) and (GameState <> gsConfirm) then
       
  1321     ParseCommand('quit', true);
       
  1322 end;
       
  1323 
       
  1324 
  1315 procedure initModule;
  1325 procedure initModule;
  1316 begin
  1326 begin
  1317     fpsTexture:= nil;
  1327     fpsTexture:= nil;
  1318     FollowGear:= nil;
  1328     FollowGear:= nil;
  1319     WindBarWidth:= 0;
  1329     WindBarWidth:= 0;