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