Changeset 183 for trunk/Start.pas
- Timestamp:
- May 4, 2020, 10:23:41 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Start.pas
r170 r183 8 8 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls, 9 9 Menus, Registry, DrawDlg, fgl, Protocol; 10 11 const12 // main actions13 nMainActions = 5;14 maConfig = 0;15 maManual = 1;16 maCredits = 2;17 maAIDev = 3;18 maWeb = 4;19 10 20 11 type … … 40 31 ); 41 32 42 TStartTab = ( 43 tbMain, 44 tbMap, 45 tbNew, 46 tbPrevious 47 ); 33 TStartTab = (tbMain, tbMap, tbNew, tbPrevious); 34 TMiniMode = (mmNone, mmPicture, mmMultiPlayer); 35 TMainAction = (maConfig, maManual, maCredits, maAIDev, maWeb, maNone); 36 TMainActionSet = set of TMainAction; 48 37 49 38 TMapArray = array[0 .. lxmax * lymax - 1] of Byte; … … 111 100 MiniWidth: Integer; 112 101 MiniHeight: Integer; 113 SelectedAction: Integer;114 102 Page: TStartPage; 115 103 ShowTab: TStartTab; … … 131 119 // BookDate: string; 132 120 PlayerSlots: TPlayerSlots; 133 MiniMode: (mmNone, mmPicture, mmMultiPlayer); 134 ActionsOffered: set of 0 .. nMainActions - 1; 135 TurnValid, Tracking: boolean; 121 MiniMode: TMiniMode; 122 ActionsOffered: TMainActionSet; 123 SelectedAction: TMainAction; 124 TurnValid: Boolean; 125 Tracking: Boolean; 136 126 DefaultAI: string; 137 127 procedure DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string); … … 237 227 LoadConfig; 238 228 239 ActionsOffered := [maManual, maCredits, maWeb]; 240 Include(ActionsOffered, maConfig); 229 ActionsOffered := [maConfig, maManual, maCredits, maWeb]; 241 230 if FileExists(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html') then 242 231 Include(ActionsOffered, maAIDev); … … 511 500 s: string; 512 501 Tab2: TStartTab; 502 MainAction: TMainAction; 513 503 begin 514 504 PaintBackground(self, 3, 3, TabOffset + 4 * TabSize - 4, TabHeight - 3); … … 600 590 if Page = pgMain then 601 591 begin 602 if SelectedAction >= 0then // mark selected action592 if SelectedAction >= maNone then // mark selected action 603 593 for i := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do 604 594 begin … … 607 597 w := wBuffer; 608 598 h := ActionPitch; 609 if yAction + SelectedAction* ActionPitch - 8 + h > ClientHeight - ActionBottomBorder599 if yAction + Integer(SelectedAction) * ActionPitch - 8 + h > ClientHeight - ActionBottomBorder 610 600 then 611 601 h := ClientHeight - ActionBottomBorder - 612 (yAction + SelectedAction* ActionPitch - 8);602 (yAction + Integer(SelectedAction) * ActionPitch - 8); 613 603 BitBltCanvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas, 614 ActionSideBorder + i * wBuffer, yAction + SelectedAction* ActionPitch604 ActionSideBorder + i * wBuffer, yAction + Integer(SelectedAction) * ActionPitch 615 605 - 8, SRCCOPY); 616 606 MakeBlue(LogoBuffer, 0, 0, w, h); 617 607 BitBlt(Canvas.Handle, ActionSideBorder + i * wBuffer, 618 yAction + SelectedAction* ActionPitch - 8, w, h,608 yAction + Integer(SelectedAction) * ActionPitch - 8, w, h, 619 609 LogoBuffer.Canvas.Handle, 0, 0, SRCCOPY); 620 610 end; 621 611 y := yAction; 622 for i := 0 to nMainActions - 1do612 for MainAction := Low(TMainActionSet) to High(TMainActionSet) do 623 613 begin 624 if iin ActionsOffered then625 case iof614 if MainAction in ActionsOffered then 615 case MainAction of 626 616 maConfig: 627 617 DrawAction(y, 25, 'ACTIONHEADER_CONFIG', 'ACTION_CONFIG'); … … 892 882 Difficulty[0] := Diff0; 893 883 894 SelectedAction := -1;884 SelectedAction := maNone; 895 885 if ShowTab = tbPrevious then 896 886 PreviewMap(StartLandMass); // avoid delay on first TabX change … … 1964 1954 x, y: integer); 1965 1955 var 1966 OldLoadTurn, NewSelectedAction: Integer; 1956 OldLoadTurn: Integer; 1957 NewSelectedAction: TMainAction; 1967 1958 begin 1968 1959 if Tracking then … … 1995 1986 (y >= yAction - 8) and (y < ClientHeight - ActionBottomBorder) then 1996 1987 begin 1997 NewSelectedAction := (y - (yAction - 8)) div ActionPitch;1998 if not (NewSelectedAction in ActionsOffered) then1999 NewSelectedAction := -1;1988 NewSelectedAction := TMainAction((y - (yAction - 8)) div ActionPitch); 1989 if not (NewSelectedAction in ActionsOffered) then 1990 NewSelectedAction := maNone; 2000 1991 end 2001 1992 else 2002 NewSelectedAction := -1;1993 NewSelectedAction := maNone; 2003 1994 if NewSelectedAction <> SelectedAction then 2004 1995 begin 2005 if SelectedAction >= 0then2006 SmartInvalidate(ActionSideBorder, yAction + SelectedAction* ActionPitch2007 - 8, ClientWidth - ActionSideBorder, yAction + ( SelectedAction+ 1) *1996 if SelectedAction <> maNone then 1997 SmartInvalidate(ActionSideBorder, yAction + Integer(SelectedAction) * ActionPitch 1998 - 8, ClientWidth - ActionSideBorder, yAction + (Integer(SelectedAction) + 1) * 2008 1999 ActionPitch - 8); 2009 2000 SelectedAction := NewSelectedAction; 2010 if SelectedAction >= 0then2011 SmartInvalidate(ActionSideBorder, yAction + SelectedAction* ActionPitch2012 - 8, ClientWidth - ActionSideBorder, yAction + ( SelectedAction+ 1) *2001 if SelectedAction <> maNone then 2002 SmartInvalidate(ActionSideBorder, yAction + Integer(SelectedAction) * ActionPitch 2003 - 8, ClientWidth - ActionSideBorder, yAction + (Integer(SelectedAction) + 1) * 2013 2004 ActionPitch - 8); 2014 2005 end;
Note:
See TracChangeset
for help on using the changeset viewer.