4
|
1 |
(*
|
|
2 |
* Hedgewars, a worms-like game
|
47
|
3 |
* Copyright (c) 2004, 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
|
4
|
4 |
*
|
|
5 |
* Distributed under the terms of the BSD-modified licence:
|
|
6 |
*
|
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8 |
* of this software and associated documentation files (the "Software"), to deal
|
|
9 |
* with the Software without restriction, including without limitation the
|
|
10 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
11 |
* sell copies of the Software, and to permit persons to whom the Software is
|
|
12 |
* furnished to do so, subject to the following conditions:
|
|
13 |
*
|
|
14 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
15 |
* this list of conditions and the following disclaimer.
|
|
16 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
17 |
* this list of conditions and the following disclaimer in the documentation
|
|
18 |
* and/or other materials provided with the distribution.
|
|
19 |
* 3. The name of the author may not be used to endorse or promote products
|
|
20 |
* derived from this software without specific prior written permission.
|
|
21 |
*
|
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
23 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
24 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
25 |
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
27 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
28 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
29 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
30 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
31 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32 |
*)
|
|
33 |
|
|
34 |
unit uWorld;
|
|
35 |
interface
|
83
|
36 |
uses SDLh, uGears, uConsts;
|
4
|
37 |
{$INCLUDE options.inc}
|
|
38 |
const WorldDx: integer = -512;
|
|
39 |
WorldDy: integer = -256;
|
|
40 |
|
|
41 |
procedure InitWorld;
|
|
42 |
procedure DrawWorld(Lag: integer; Surface: PSDL_Surface);
|
83
|
43 |
procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
|
79
|
44 |
procedure MoveCamera;
|
4
|
45 |
|
|
46 |
{$IFDEF COUNTTICKS}
|
|
47 |
var cntTicks: LongWord;
|
|
48 |
{$ENDIF}
|
|
49 |
var FollowGear: PGear = nil;
|
6
|
50 |
WindBarWidth: integer = 0;
|
4
|
51 |
|
|
52 |
implementation
|
83
|
53 |
uses uStore, uMisc, uTeams, uIO, uConsole;
|
4
|
54 |
const RealTicks: Longword = 0;
|
|
55 |
Frames: Longword = 0;
|
|
56 |
FPS: Longword = 0;
|
|
57 |
CountTicks: Longword = 0;
|
|
58 |
prevPoint: TPoint = (X: 0; Y: 0);
|
|
59 |
|
|
60 |
type TCaptionStr = record
|
83
|
61 |
Surf: PSDL_Surface;
|
|
62 |
StorePos: Longword;
|
4
|
63 |
EndTime: LongWord;
|
|
64 |
end;
|
|
65 |
|
|
66 |
var cWaterSprCount: integer;
|
95
|
67 |
Captions: array[TCapGroup] of TCaptionStr;
|
4
|
68 |
|
|
69 |
procedure InitWorld;
|
|
70 |
begin
|
74
|
71 |
cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
|
|
72 |
cScreenEdgesDist:= Min(cScreenWidth div 4, cScreenHeight div 4);
|
|
73 |
SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
|
|
74 |
prevPoint.X:= cScreenWidth div 2;
|
|
75 |
prevPoint.Y:= cScreenHeight div 2;
|
|
76 |
WorldDx:= - 1024 + cScreenWidth div 2;
|
|
77 |
WorldDy:= - 512 + cScreenHeight div 2
|
4
|
78 |
end;
|
|
79 |
|
|
80 |
procedure DrawWorld(Lag: integer; Surface: PSDL_Surface);
|
|
81 |
var i, t: integer;
|
|
82 |
r: TSDL_Rect;
|
|
83 |
team: PTeam;
|
74
|
84 |
tdx, tdy: real;
|
80
|
85 |
|
82
|
86 |
procedure DrawRepeated(spr: TSprite; Shift: integer);
|
80
|
87 |
var i, w: integer;
|
|
88 |
begin
|
|
89 |
w:= SpritesData[spr].Width;
|
82
|
90 |
i:= Shift mod w;
|
80
|
91 |
if i > 0 then dec(i, w);
|
|
92 |
repeat
|
|
93 |
DrawSprite(spr, i, WorldDy + 1024 - SpritesData[spr].Height, 0, Surface);
|
|
94 |
inc(i, w)
|
|
95 |
until i > cScreenWidth
|
|
96 |
end;
|
|
97 |
|
4
|
98 |
begin
|
5
|
99 |
// Sky
|
4
|
100 |
inc(RealTicks, Lag);
|
|
101 |
r.h:= WorldDy;
|
|
102 |
if r.h > 0 then
|
|
103 |
begin
|
|
104 |
if r.h > cScreenHeight then r.h:= cScreenHeight;
|
|
105 |
r.x:= 0;
|
|
106 |
r.y:= 0;
|
|
107 |
r.w:= cScreenWidth;
|
|
108 |
SDL_FillRect(Surface, @r, cSkyColor)
|
|
109 |
end;
|
5
|
110 |
// background
|
82
|
111 |
DrawRepeated(sprSky, WorldDx * 3 div 8);
|
|
112 |
DrawRepeated(sprHorizont, WorldDx * 3 div 5);
|
4
|
113 |
|
5
|
114 |
// Waves
|
4
|
115 |
{$WARNINGS OFF}
|
56
|
116 |
for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx + (RealTicks shr 6) ) and $FF), cWaterLine + WorldDy - 64, 0, Surface);
|
|
117 |
for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx - (RealTicks shr 6) + 192) and $FF), cWaterLine + WorldDy - 48, 0, Surface);
|
4
|
118 |
{$WARNINGS ON}
|
|
119 |
|
|
120 |
DrawLand(WorldDx, WorldDy, Surface);
|
5
|
121 |
// Water
|
4
|
122 |
r.y:= WorldDy + cWaterLine + 32;
|
|
123 |
if r.y < cScreenHeight then
|
|
124 |
begin
|
23
|
125 |
if r.y < 0 then r.y:= 0;
|
4
|
126 |
r.h:= cScreenHeight - r.y;
|
|
127 |
r.x:= 0;
|
|
128 |
r.w:= cScreenWidth;
|
|
129 |
SDL_FillRect(Surface, @r, cWaterColor)
|
|
130 |
end;
|
|
131 |
|
|
132 |
DrawGears(Surface);
|
|
133 |
|
95
|
134 |
if CurrentTeam <> nil then
|
|
135 |
begin
|
|
136 |
team:= TeamsList;
|
|
137 |
while team<>nil do
|
4
|
138 |
begin
|
|
139 |
for i:= 0 to 7 do
|
|
140 |
with team.Hedgehogs[i] do
|
|
141 |
if Gear<>nil then
|
|
142 |
if Gear.State = 0 then
|
5
|
143 |
begin
|
95
|
144 |
t:= round(Gear.Y) - cHHRadius - 10 + WorldDy;
|
|
145 |
dec(t, HealthTag.h + 2);
|
|
146 |
DrawCentered(round(Gear.X) + WorldDx, t, HealthTag, Surface);
|
|
147 |
dec(t, NameTag.h + 2);
|
|
148 |
DrawCentered(round(Gear.X) + WorldDx, t, NameTag, Surface);
|
|
149 |
dec(t, Team.NameTag.h + 2);
|
|
150 |
DrawCentered(round(Gear.X) + WorldDx, t, Team.NameTag, Surface)
|
5
|
151 |
end else // Current hedgehog
|
4
|
152 |
begin
|
69
|
153 |
if (Gear.State and (gstMoving or gstDrowning or gstFalling)) = 0 then
|
4
|
154 |
if (Gear.State and gstHHThinking) <> 0 then
|
53
|
155 |
DrawGear(sQuestion, Round(Gear.X) - 10 + WorldDx, Round(Gear.Y) - cHHRadius - 34 + WorldDy, Surface)
|
4
|
156 |
else
|
69
|
157 |
if ShowCrosshair and ((Gear.State and gstAttacked) = 0) then
|
4
|
158 |
DrawCaption(Round(Gear.X + Sign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle)*60) + WorldDx,
|
39
|
159 |
Round(Gear.Y - Cos(Gear.Angle*pi/cMaxAngle)*60) + WorldDy - 4,
|
4
|
160 |
Team.CrossHairRect, Surface)
|
|
161 |
end;
|
|
162 |
team:= team.Next
|
|
163 |
end;
|
95
|
164 |
end;
|
|
165 |
|
4
|
166 |
|
5
|
167 |
// Waves
|
4
|
168 |
{$WARNINGS OFF}
|
56
|
169 |
for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx + (RealTicks shr 6) + 64) and $FF), cWaterLine + WorldDy - 32, 0, Surface);
|
|
170 |
for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx - (RealTicks shr 6) + 128) and $FF), cWaterLine + WorldDy - 16, 0, Surface);
|
|
171 |
for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx + (RealTicks shr 6) ) and $FF), cWaterLine + WorldDy , 0, Surface);
|
4
|
172 |
{$WARNINGS ON}
|
|
173 |
|
79
|
174 |
// Turn time
|
4
|
175 |
if TurnTimeLeft <> 0 then
|
|
176 |
begin
|
|
177 |
i:= Succ(Pred(TurnTimeLeft) div 1000);
|
|
178 |
if i>99 then t:= 112
|
|
179 |
else if i>9 then t:= 96
|
|
180 |
else t:= 80;
|
|
181 |
DrawSprite(sprFrame, t, cScreenHeight - 48, 1, Surface);
|
|
182 |
while i > 0 do
|
|
183 |
begin
|
|
184 |
dec(t, 32);
|
|
185 |
DrawSprite(sprBigDigit, t, cScreenHeight - 48, i mod 10, Surface);
|
|
186 |
i:= i div 10
|
|
187 |
end;
|
|
188 |
DrawSprite(sprFrame, t - 4, cScreenHeight - 48, 0, Surface);
|
|
189 |
end;
|
79
|
190 |
|
|
191 |
// Attack bar
|
4
|
192 |
if CurrentTeam <> nil then
|
|
193 |
case AttackBar of
|
|
194 |
1: begin
|
|
195 |
r:= StuffPoz[sPowerBar];
|
|
196 |
{$WARNINGS OFF}
|
|
197 |
r.w:= (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear.Power * 256) div cPowerDivisor;
|
|
198 |
{$WARNINGS ON}
|
|
199 |
DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface);
|
|
200 |
end;
|
74
|
201 |
2: with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
|
|
202 |
begin
|
|
203 |
tdx:= Sign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle);
|
|
204 |
tdy:= - Cos(Gear.Angle*pi/cMaxAngle);
|
|
205 |
for i:= (Gear.Power * 24) div cPowerDivisor downto 0 do
|
75
|
206 |
DrawSprite(sprPower, round(Gear.X + WorldDx + tdx * (24 + i * 2)) - 16,
|
|
207 |
round(Gear.Y + WorldDy + tdy * (24 + i * 2)) - 12,
|
74
|
208 |
i, Surface)
|
|
209 |
end
|
4
|
210 |
end;
|
|
211 |
|
5
|
212 |
// Target
|
4
|
213 |
if TargetPoint.X <> NoPointX then DrawSprite(sprTargetP, TargetPoint.X + WorldDx - 16, TargetPoint.Y + WorldDy - 16, 0, Surface);
|
|
214 |
|
|
215 |
// Captions
|
|
216 |
i:= 0;
|
|
217 |
while (i < cMaxCaptions) do
|
|
218 |
begin
|
|
219 |
with Captions[i] do
|
83
|
220 |
if EndTime > 0 then
|
95
|
221 |
DrawCentered(cScreenWidth div 2, 8 + i * (Surf.h + 2) + cConsoleYAdd, Surf, Surface);
|
4
|
222 |
inc(i)
|
|
223 |
end;
|
|
224 |
while (Captions[0].EndTime > 0) and (Captions[0].EndTime <= RealTicks) do
|
|
225 |
begin
|
83
|
226 |
SDL_FreeSurface(Captions[0].Surf);
|
95
|
227 |
Captions[0].Surf:= nil;
|
4
|
228 |
for i:= 1 to Pred(cMaxCaptions) do
|
|
229 |
Captions[Pred(i)]:= Captions[i];
|
|
230 |
Captions[Pred(cMaxCaptions)].EndTime:= 0
|
|
231 |
end;
|
|
232 |
|
47
|
233 |
// Teams Healths
|
|
234 |
team:= TeamsList;
|
|
235 |
while team <> nil do
|
|
236 |
begin
|
95
|
237 |
r.x:= cScreenWidth div 2 - team.NameTag.w - 3;
|
|
238 |
r.y:= team.DrawHealthY;
|
|
239 |
r.w:= team.NameTag.w;
|
|
240 |
r.h:= team.NameTag.h;
|
|
241 |
SDL_UpperBlit(team.NameTag, nil, Surface, @r);
|
47
|
242 |
r:= team.HealthRect;
|
83
|
243 |
r.w:= 2 + team.TeamHealth;
|
49
|
244 |
DrawFromStoreRect(cScreenWidth div 2,
|
|
245 |
Team.DrawHealthY,
|
47
|
246 |
@r, Surface);
|
83
|
247 |
inc(r.x, cTeamHealthWidth + 2);
|
|
248 |
r.w:= 3;
|
|
249 |
DrawFromStoreRect(cScreenWidth div 2 + team.TeamHealth + 2,
|
49
|
250 |
Team.DrawHealthY,
|
47
|
251 |
@r, Surface);
|
|
252 |
team:= team.Next
|
|
253 |
end;
|
|
254 |
|
5
|
255 |
// Lag alert
|
4
|
256 |
if isInLag then DrawSprite(sprLag, 32, 32 + cConsoleYAdd, (RealTicks shr 7) mod 7, Surface);
|
|
257 |
|
5
|
258 |
// Wind bar
|
|
259 |
DrawGear(sWindBar, cScreenWidth - 180, cScreenHeight - 30, Surface);
|
6
|
260 |
if WindBarWidth > 0 then
|
5
|
261 |
begin
|
|
262 |
with StuffPoz[sWindR] do
|
|
263 |
begin
|
6
|
264 |
{$WARNINGS OFF}
|
5
|
265 |
r.x:= x + 8 - (RealTicks shr 6) mod 8;
|
6
|
266 |
{$WARNINGS ON}
|
5
|
267 |
r.y:= y;
|
6
|
268 |
r.w:= WindBarWidth;
|
5
|
269 |
r.h:= 13;
|
|
270 |
end;
|
|
271 |
DrawSpriteFromRect(r, cScreenWidth - 103, cScreenHeight - 28, 13, 0, Surface);
|
|
272 |
end else
|
6
|
273 |
if WindBarWidth < 0 then
|
5
|
274 |
begin
|
|
275 |
with StuffPoz[sWindL] do
|
|
276 |
begin
|
6
|
277 |
{$WARNINGS OFF}
|
|
278 |
r.x:= x + (WindBarWidth + RealTicks shr 6) mod 8;
|
|
279 |
{$WARNINGS ON}
|
5
|
280 |
r.y:= y;
|
6
|
281 |
r.w:= - WindBarWidth;
|
5
|
282 |
r.h:= 13;
|
|
283 |
end;
|
6
|
284 |
DrawSpriteFromRect(r, cScreenWidth - 106 + WindBarWidth, cScreenHeight - 28, 13, 0, Surface);
|
5
|
285 |
end;
|
|
286 |
|
|
287 |
// Cursor
|
4
|
288 |
if isCursorVisible then DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface);
|
|
289 |
|
|
290 |
{$IFDEF COUNTTICKS}
|
|
291 |
DXOutText(10, 10, fnt16, inttostr(cntTicks), Surface);
|
|
292 |
{$ENDIF}
|
|
293 |
|
|
294 |
inc(Frames);
|
|
295 |
inc(CountTicks, Lag);
|
|
296 |
if CountTicks >= 1000 then
|
|
297 |
begin
|
|
298 |
FPS:= Frames;
|
|
299 |
Frames:= 0;
|
|
300 |
CountTicks:= 0;
|
|
301 |
end;
|
|
302 |
if cShowFPS then DXOutText(cScreenWidth - 50, 10, fnt16, inttostr(FPS) + ' fps', Surface)
|
|
303 |
end;
|
|
304 |
|
83
|
305 |
procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
|
4
|
306 |
var i, t, m, k: LongWord;
|
|
307 |
begin
|
83
|
308 |
if Group in [capgrpGameState, capgrpNetSay] then WriteLnToConsole(s);
|
4
|
309 |
i:= 0;
|
83
|
310 |
while (i < cMaxCaptions) and (Captions[i].Group <> Group) do inc(i);
|
4
|
311 |
if i < cMaxCaptions then
|
|
312 |
begin
|
95
|
313 |
SDL_FreeSurface(Captions[i].Surf);
|
4
|
314 |
while (i < Pred(cMaxCaptions)) do
|
|
315 |
begin
|
|
316 |
Captions[i]:= Captions[Succ(i)];
|
|
317 |
inc(i)
|
|
318 |
end;
|
|
319 |
Captions[Pred(cMaxCaptions)].EndTime:= 0
|
|
320 |
end;
|
|
321 |
|
|
322 |
if Captions[Pred(cMaxCaptions)].EndTime > 0 then
|
|
323 |
begin
|
95
|
324 |
SDL_FreeSurface(Captions[0].Surf);
|
4
|
325 |
m:= Pred(cMaxCaptions);
|
|
326 |
for i:= 1 to m do
|
|
327 |
Captions[Pred(i)]:= Captions[i];
|
|
328 |
Captions[m].EndTime:= 0
|
|
329 |
end else
|
|
330 |
begin
|
|
331 |
m:= 0;
|
|
332 |
while (m < cMaxCaptions)and(Captions[m].EndTime > 0) do inc(m)
|
|
333 |
end;
|
|
334 |
|
|
335 |
k:= 0;
|
|
336 |
for i:= 0 to Pred(cMaxCaptions) do
|
|
337 |
for t:= 0 to Pred(cMaxCaptions) do
|
83
|
338 |
if (Captions[t].EndTime > 0) and (Captions[t].StorePos = k) then inc(k);
|
4
|
339 |
|
95
|
340 |
Captions[m].Surf:= RenderString(s, Color, fntBig);
|
4
|
341 |
Captions[m].StorePos:= k;
|
|
342 |
Captions[m].Group:= Group;
|
|
343 |
Captions[m].EndTime:= RealTicks + 1200
|
|
344 |
end;
|
|
345 |
|
79
|
346 |
procedure MoveCamera;
|
4
|
347 |
const PrevSentPointTime: LongWord = 0;
|
|
348 |
var s: string[9];
|
|
349 |
begin
|
|
350 |
if not (CurrentTeam.ExtDriven and isCursorVisible) then SDL_GetMouseState(@CursorPoint.X, @CursorPoint.Y);
|
|
351 |
if (FollowGear <> nil) then
|
57
|
352 |
if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then
|
4
|
353 |
begin
|
|
354 |
FollowGear:= nil;
|
|
355 |
exit
|
|
356 |
end
|
|
357 |
else begin
|
71
|
358 |
CursorPoint.x:= (CursorPoint.x * 7 + (round(FollowGear.X + Sign(FollowGear.dX) * 100) + WorldDx)) div 8;
|
|
359 |
CursorPoint.y:= (CursorPoint.y * 7 + (round(FollowGear.Y) + WorldDy)) div 8
|
4
|
360 |
end;
|
|
361 |
|
|
362 |
if ((CursorPoint.X = prevPoint.X)and(CursorPoint.Y = prevpoint.Y)) then exit;
|
|
363 |
|
|
364 |
if isCursorVisible then
|
|
365 |
begin
|
|
366 |
if (not CurrentTeam.ExtDriven)and(GameTicks >= PrevSentPointTime + cSendCursorPosTime) then
|
|
367 |
begin
|
|
368 |
s[0]:= #9;
|
|
369 |
s[1]:= 'P';
|
95
|
370 |
PSmallInt(@s[2])^:= CursorPoint.X - WorldDx;
|
|
371 |
PSmallInt(@s[4])^:= CursorPoint.Y - WorldDy;
|
4
|
372 |
SendIPC(s);
|
|
373 |
PrevSentPointTime:= GameTicks
|
|
374 |
end;
|
|
375 |
end;
|
|
376 |
if isCursorVisible or (FollowGear <> nil) then
|
|
377 |
begin
|
|
378 |
if CursorPoint.X < cScreenEdgesDist then
|
|
379 |
begin
|
|
380 |
WorldDx:= WorldDx - CursorPoint.X + cScreenEdgesDist;
|
|
381 |
CursorPoint.X:= cScreenEdgesDist
|
|
382 |
end else
|
|
383 |
if CursorPoint.X > cScreenWidth - cScreenEdgesDist then
|
|
384 |
begin
|
|
385 |
WorldDx:= WorldDx - CursorPoint.X + cScreenWidth - cScreenEdgesDist;
|
|
386 |
CursorPoint.X:= cScreenWidth - cScreenEdgesDist
|
|
387 |
end;
|
|
388 |
if CursorPoint.Y < cScreenEdgesDist then
|
|
389 |
begin
|
|
390 |
WorldDy:= WorldDy - CursorPoint.Y + cScreenEdgesDist;
|
|
391 |
CursorPoint.Y:= cScreenEdgesDist
|
|
392 |
end else
|
|
393 |
if CursorPoint.Y > cScreenHeight - cScreenEdgesDist then
|
|
394 |
begin
|
|
395 |
WorldDy:= WorldDy - CursorPoint.Y + cScreenHeight - cScreenEdgesDist;
|
|
396 |
CursorPoint.Y:= cScreenHeight - cScreenEdgesDist
|
|
397 |
end;
|
|
398 |
end else
|
|
399 |
begin
|
70
|
400 |
WorldDx:= WorldDx - CursorPoint.X + prevPoint.X;
|
|
401 |
WorldDy:= WorldDy - CursorPoint.Y + prevPoint.Y;
|
4
|
402 |
CursorPoint.X:= (cScreenWidth shr 1);
|
|
403 |
CursorPoint.Y:= (cScreenHeight shr 1);
|
|
404 |
end;
|
|
405 |
SDL_WarpMouse(CursorPoint.X, CursorPoint.Y);
|
|
406 |
prevPoint:= CursorPoint;
|
75
|
407 |
if WorldDy < cScreenHeight - cWaterLine - cVisibleWater then WorldDy:= cScreenHeight - cWaterLine - cVisibleWater;
|
4
|
408 |
if WorldDy > 2048 then WorldDy:= 2048;
|
|
409 |
if WorldDx < -2048 then WorldDx:= -2048;
|
|
410 |
if WorldDx > cScreenWidth then WorldDx:= cScreenWidth;
|
|
411 |
end;
|
|
412 |
|
|
413 |
initialization
|
|
414 |
FillChar(Captions, sizeof(Captions), 0)
|
|
415 |
|
|
416 |
end.
|