-
Notifications
You must be signed in to change notification settings - Fork 2
/
GameSkillPanel.pas
203 lines (175 loc) · 5.28 KB
/
GameSkillPanel.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
{$include lem_directives.inc}
unit GameSkillPanel;
interface
uses
LemTypes,
Classes, GR32,
GameWindowInterface, GameBaseSkillPanel,
SharedGlobals;
type
TSkillPanelStandard = class(TBaseSkillPanel)
protected
function GetButtonList: TPanelButtonArray; override;
function PanelWidth: Integer; override;
function PanelHeight: Integer; override;
function MinimapRect: TRect; override;
function ReplayMarkRect: TRect; override;
function RescueCountRect: TRect; override;
procedure CreateNewInfoString; override;
function DrawStringLength: Integer; override;
function DrawStringTemplate: string; override;
function TimeLimitStartIndex: Integer; override;
function CursorInfoEndIndex: Integer; override;
function LemmingCountStartIndex: Integer; override;
function LemmingSavedStartIndex: Integer; override;
public
constructor CreateWithWindow(aOwner: TComponent; aGameWindow: IGameWindow); override;
destructor Destroy; override;
end;
implementation
uses
GameControl, LemCore;
constructor TSkillPanelStandard.CreateWithWindow(aOwner: TComponent; aGameWindow: IGameWindow);
begin
inherited;
end;
destructor TSkillPanelStandard.Destroy;
begin
inherited;
end;
function TSkillPanelStandard.PanelWidth: Integer;
begin
if GameParams.ShowMinimap then
Result := 888
else
Result := 672;
end;
function TSkillPanelStandard.PanelHeight: Integer;
begin
Result := 80;
end;
function TSkillPanelStandard.DrawStringLength: Integer;
begin
Result := 42;
end;
function TSkillPanelStandard.DrawStringTemplate: string;
begin
if GameParams.AmigaTheme then
Result := '..............' + // 0 Cursor info
'.' + ' ' + // 14 Replay mark
'.' + ' ' + // 16 Collectible icon
'OUT' + ' ...' + ' ' + // 18 Lemmings out // 22 LemAlive
'IN' + ' ...' + ' ' + // 26 Lemmings in (home) // 29 LemIn
'TIME' + ' .-..' // 34 Time // 39 Time limit
else
Result := '..............' + // 0 Cursor info
'.' + ' ' + // 14 Replay mark
'.' + ' ' + // 16 Collectible icon
#93 + '_...' + ' ' + // 18 Hatch icon // 19 LemHatch
#94 + '_...' + ' ' + // 24 Lem icon // 25 LemAlive
#95 + '_...' + ' ' + // 30 Exit icon // 31 LemIn
#97 + '_.-..'; // 36 Time icon // 37 Time Limit
end;
function TSkillPanelStandard.TimeLimitStartIndex: Integer;
begin
Result := 37;
end;
// First 2 digits = left & top of minimap frame
// Second 2 digits = width & height of minimap itself
function TSkillPanelStandard.MinimapRect: TRect;
begin
if GameParams.AmigaTheme then
Result := Rect(704, 4, 862, 72)
else
Result := Rect(710, 4, 880, 72);
end;
// Assigns a clickable rectangle to the replay "R" icon
function TSkillPanelStandard.ReplayMarkRect: TRect;
begin
Result := Rect(212, 4, 232, 32);
end;
// Assigns a non-clickable rectangle to the rescue count icon & digits
function TSkillPanelStandard.RescueCountRect: TRect;
var
LemmingsSaved, DigitCount: Integer;
begin
LemmingsSaved := Game.LemmingsSaved;
if LemmingsSaved >= 0 then // For positive numbers
begin
if LemmingsSaved < 10 then
DigitCount := 1
else if LemmingsSaved < 100 then
DigitCount := 2
else
DigitCount := 3;
end else
begin
if LemmingsSaved > -10 then // For negative numbers, including the '-' sign
DigitCount := 2
else
DigitCount := 3;
end;
if GameParams.AmigaTheme then
Result := Rect(418, 4, 466 + DigitCount * 16, 32)
else
Result := Rect(478, 4, 512 + DigitCount * 16, 32);
end;
procedure TSkillPanelStandard.CreateNewInfoString;
begin
if (Game.StateIsUnplayable and not Game.ShouldExitToPostview) then
SetPanelMessage(1);
if GameParams.AmigaTheme then
begin
SetInfoCursor(1);
SetReplayMark(14);
SetCollectibleIcon(16);
SetInfoLemAlive(22);
SetInfoLemIn(29);
SetInfoTime(38, 41);
end else begin
SetInfoCursor(1);
SetReplayMark(14);
SetCollectibleIcon(16);
SetInfoLemHatch(20);
SetInfoLemAlive(26);
SetExitIcon(31);
SetInfoLemIn(32);
SetTimeLimit(37);
SetInfoTime(38, 41);
end;
end;
function TSkillPanelStandard.GetButtonList: TPanelButtonArray;
var
i : Integer;
begin
SetLength(Result, 24);
Result[0] := spbSlower;
Result[1] := spbFaster;
for i := 2 to (0 + MAX_SKILL_TYPES_PER_LEVEL -1) do
Result[i] := Low(TSkillPanelButton); // Placeholder for any skill
Result[2 + MAX_SKILL_TYPES_PER_LEVEL] := spbPause;
Result[2 + MAX_SKILL_TYPES_PER_LEVEL + 1] := spbRewind;
Result[2 + MAX_SKILL_TYPES_PER_LEVEL + 2] := spbFastForward;
Result[2 + MAX_SKILL_TYPES_PER_LEVEL + 3] := spbRestart;
Result[2 + MAX_SKILL_TYPES_PER_LEVEL + 4] := spbNuke;
Result[2 + MAX_SKILL_TYPES_PER_LEVEL + 5] := spbSquiggle;
end;
function TSkillPanelStandard.CursorInfoEndIndex: Integer;
begin
Result := 13;
end;
function TSkillPanelStandard.LemmingCountStartIndex: Integer;
begin
if GameParams.AmigaTheme then
Result := 22
else
Result := 26;
end;
function TSkillPanelStandard.LemmingSavedStartIndex: Integer;
begin
if GameParams.AmigaTheme then
Result := 29
else
Result := 32;
end;
end.