hedgewars/uWorld.pas
changeset 15046 0730c68fdf97
parent 15044 76003912e31d
child 15052 1a754860b0e5
equal deleted inserted replaced
15045:9f6e3be10e96 15046:0730c68fdf97
   113       AMSlotSize = 48;
   113       AMSlotSize = 48;
   114 {$ELSE}
   114 {$ELSE}
   115       AMSlotSize = 32;
   115       AMSlotSize = 32;
   116 {$ENDIF}
   116 {$ENDIF}
   117       AMSlotPadding = (AMSlotSize - 32) shr 1;
   117       AMSlotPadding = (AMSlotSize - 32) shr 1;
       
   118 
       
   119 {$IFDEF USE_LANDSCAPE_AMMOMENU}
       
   120       amNumOffsetX = 0;
       
   121       {$IFDEF USE_AM_NUMCOLUMN}
       
   122       amNumOffsetY = AMSlotSize;
       
   123       {$ELSE}
       
   124       amNumOffsetY = 0;
       
   125       {$ENDIF}
       
   126 {$ELSE}
       
   127       amNumOffsetY = 0;
       
   128       {$IFDEF USE_AM_NUMCOLUMN}
       
   129       amNumOffsetX = AMSlotSize;
       
   130       {$ELSE}
       
   131       amNumOffsetX = 0;
       
   132       {$ENDIF}
       
   133 {$ENDIF}
   118 
   134 
   119       cSendCursorPosTime = 50;
   135       cSendCursorPosTime = 50;
   120       cCursorEdgesDist   = 100;
   136       cCursorEdgesDist   = 100;
   121 
   137 
   122 // helper functions to create the goal/game mode string
   138 // helper functions to create the goal/game mode string
   642     // No "appear" animation in low quality or playing with very short turn time.
   658     // No "appear" animation in low quality or playing with very short turn time.
   643     if ((cReducedQuality and rqSlowMenu) <> 0) or (cHedgehogTurnTime <= 10000) then
   659     if ((cReducedQuality and rqSlowMenu) <> 0) or (cHedgehogTurnTime <= 10000) then
   644         begin
   660         begin
   645         AMShiftX:= 0;
   661         AMShiftX:= 0;
   646         AMShiftY:= 0;
   662         AMShiftY:= 0;
       
   663         CursorPoint.X:= AmmoRect.x + AmmoRect.w - 3;
       
   664         CursorPoint.Y:= cScreenHeight - AmmoRect.y - amNumOffsetY - 1;
   647         AMState:= AMShowing;
   665         AMState:= AMShowing;
   648         end
   666         end
   649     // "Appear" animation
   667     // "Appear" animation
   650     else
   668     else
   651         if AMAnimState < 1 then
   669         if AMAnimState < 1 then
   657             end
   675             end
   658         else
   676         else
   659             begin
   677             begin
   660             AMShiftX:= 0;
   678             AMShiftX:= 0;
   661             AMShiftY:= 0;
   679             AMShiftY:= 0;
   662             CursorPoint.X:= AmmoRect.x + AmmoRect.w;
   680             CursorPoint.X:= AmmoRect.x + AmmoRect.w - 3;
   663             CursorPoint.Y:= AmmoRect.y;
   681             CursorPoint.Y:= cScreenHeight - AmmoRect.y - amNumOffsetY - 1;
   664             AMState:= AMShowing;
   682             AMState:= AMShowing;
   665             end;
   683             end;
   666     end;
   684     end;
   667 if AMState = AMHiding then // hide ammo menu
   685 if AMState = AMHiding then // hide ammo menu
   668     begin
   686     begin
   669     // No "disappear" animation (see above)
   687     // No "disappear" animation (see above)
   670     if ((cReducedQuality and rqSlowMenu) <> 0) or (cHedgehogTurnTime <= 10000) then
   688     if ((cReducedQuality and rqSlowMenu) <> 0) or (cHedgehogTurnTime <= 10000) then
   671         begin
   689         begin
   672         AMShiftX:= AMShiftTargetX;
   690         AMShiftX:= AMShiftTargetX;
   673         AMShiftY:= AMShiftTargetY;
   691         AMShiftY:= AMShiftTargetY;
       
   692         prevPoint:= CursorPoint;
   674         AMState:= AMHidden;
   693         AMState:= AMHidden;
   675         end
   694         end
   676     // "Disappear" animation
   695     // "Disappear" animation
   677     else
   696     else
   678         if AMAnimState < 1 then
   697         if AMAnimState < 1 then
   685          else
   704          else
   686             begin
   705             begin
   687             AMShiftX:= AMShiftTargetX;
   706             AMShiftX:= AMShiftTargetX;
   688             AMShiftY:= AMShiftTargetY;
   707             AMShiftY:= AMShiftTargetY;
   689             prevPoint:= CursorPoint;
   708             prevPoint:= CursorPoint;
   690             //prevTargetPoint:= TargetCursorPoint;
       
   691             AMState:= AMHidden;
   709             AMState:= AMHidden;
   692             end;
   710             end;
   693     end;
   711     end;
   694 
   712 
   695 DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex);
   713 DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex);
  1972 end;
  1990 end;
  1973 
  1991 
  1974 var PrevSentPointTime: LongWord = 0;
  1992 var PrevSentPointTime: LongWord = 0;
  1975 
  1993 
  1976 procedure MoveCamera;
  1994 procedure MoveCamera;
  1977 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY, dstX: LongInt;
  1995 var EdgesDist, wdy, shs,z, dstX: LongInt;
  1978     inbtwnTrgtAttks: Boolean;
  1996     inbtwnTrgtAttks: Boolean;
  1979 begin
  1997 begin
  1980 {$IFNDEF MOBILE}
  1998 {$IFNDEF MOBILE}
  1981 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then
  1999 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then
  1982     uCursor.updatePosition();
  2000     uCursor.updatePosition();
  2029 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then
  2047 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then
  2030     exit;
  2048     exit;
  2031 
  2049 
  2032 if (AMState = AMShowingUp) or (AMState = AMShowing) then
  2050 if (AMState = AMShowingUp) or (AMState = AMShowing) then
  2033 begin
  2051 begin
  2034 {$IFDEF USE_LANDSCAPE_AMMOMENU}
       
  2035     amNumOffsetX:= 0;
       
  2036     {$IFDEF USE_AM_NUMCOLUMN}
       
  2037     amNumOffsetY:= AMSlotSize;
       
  2038     {$ELSE}
       
  2039     amNumOffsetY:= 0;
       
  2040     {$ENDIF}
       
  2041 {$ELSE}
       
  2042     amNumOffsetY:= 0;
       
  2043     {$IFDEF USE_AM_NUMCOLUMN}
       
  2044     amNumOffsetX:= AMSlotSize;
       
  2045     {$ELSE}
       
  2046     amNumOffsetX:= 0;
       
  2047     {$ENDIF}
       
  2048 
       
  2049 {$ENDIF}
       
  2050     if CursorPoint.X < AmmoRect.x + amNumOffsetX + 3 then//check left
  2052     if CursorPoint.X < AmmoRect.x + amNumOffsetX + 3 then//check left
  2051         CursorPoint.X:= AmmoRect.x + amNumOffsetX + 3;
  2053         CursorPoint.X:= AmmoRect.x + amNumOffsetX + 3;
  2052     if CursorPoint.X > AmmoRect.x + AmmoRect.w - 3 then//check right
  2054     if CursorPoint.X > AmmoRect.x + AmmoRect.w - 3 then//check right
  2053         CursorPoint.X:= AmmoRect.x + AmmoRect.w - 3;
  2055         CursorPoint.X:= AmmoRect.x + AmmoRect.w - 3;
  2054     if CursorPoint.Y > cScreenHeight - AmmoRect.y -amNumOffsetY - 1 then//check top
  2056     if CursorPoint.Y > cScreenHeight - AmmoRect.y -amNumOffsetY - 1 then//check top