author | unc0rr |
Wed, 17 Nov 2010 22:07:03 +0300 | |
changeset 4367 | f4a0ec067601 |
parent 4359 | 83ef50815535 |
child 4368 | b89235e401e5 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
3236
4ab3917d7d44
Update (c) lines to 2010 as unc0rr requested - they all had varying values so I just took the first year mentioned, then tacked on -2010
nemo
parents:
3204
diff
changeset
|
3 |
* Copyright (c) 2004-2010 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
4 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
4 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
4 | 17 |
*) |
18 |
||
2630 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
4 | 21 |
unit uWorld; |
22 |
interface |
|
4357
a1fcfc341a52
Introduce unit uTypes in order to remove some cyclic unit dependencies
unC0Rr
parents:
4248
diff
changeset
|
23 |
uses SDLh, uGears, uConsts, uFloat, uRandom, uTypes; |
2630 | 24 |
|
4 | 25 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
26 |
var FollowGear: PGear; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
27 |
WindBarWidth: LongInt; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
28 |
bShowAmmoMenu: boolean; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
29 |
bSelected: boolean; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
30 |
bShowFinger: boolean; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
31 |
Frames: Longword; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
32 |
WaterColor, DeepWaterColor: TSDL_Color; |
3248 | 33 |
SkyOffset: LongInt; |
34 |
HorizontOffset: LongInt; |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
35 |
{$IFDEF COUNTTICKS} |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
36 |
cntTicks: LongWord; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
37 |
{$ENDIF} |
3463 | 38 |
cOffsetY: LongInt; |
3697 | 39 |
|
3038 | 40 |
procedure initModule; |
41 |
procedure freeModule; |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
42 |
|
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
43 |
procedure InitWorld; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
44 |
procedure DrawWorld(Lag: LongInt); |
2905 | 45 |
procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); |
46 |
procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
|
2786 | 47 |
procedure HideMission; |
3032 | 48 |
procedure ShakeCamera(amount: LongWord); |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3629
diff
changeset
|
49 |
procedure MoveCamera; |
4 | 50 |
|
51 |
implementation |
|
4359 | 52 |
uses |
53 |
uStore, |
|
54 |
uMisc, |
|
55 |
uTeams, |
|
56 |
uIO, |
|
57 |
uKeys, |
|
58 |
uLocale, |
|
59 |
uSound, |
|
60 |
uAmmos, |
|
61 |
uVisualGears, |
|
62 |
uChat, |
|
63 |
uLandTexture, |
|
64 |
GLunit, |
|
65 |
uVariables |
|
66 |
; |
|
1807 | 67 |
|
4 | 68 |
type TCaptionStr = record |
762 | 69 |
Tex: PTexture; |
4 | 70 |
EndTime: LongWord; |
71 |
end; |
|
72 |
||
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
73 |
var cWaveWidth, cWaveHeight: LongInt; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
74 |
Captions: array[TCapGroup] of TCaptionStr; |
3434 | 75 |
AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
76 |
tmpSurface: PSDL_Surface; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
77 |
fpsTexture: PTexture; |
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
78 |
timeTexture: PTexture; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
79 |
FPS: Longword; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
80 |
CountTicks: Longword; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
81 |
SoundTimerTicks: Longword; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
82 |
prevPoint: TPoint; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
83 |
amSel: TAmmoType = amNothing; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
84 |
missionTex: PTexture; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
85 |
missionTimer: LongInt; |
4 | 86 |
|
87 |
procedure InitWorld; |
|
2704
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
88 |
var i, t: LongInt; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
89 |
cp: PClan; |
2863 | 90 |
g: ansistring; |
91 |
||
2904 | 92 |
// helper functions to create the goal/game mode string |
2908 | 93 |
function AddGoal(s: ansistring; gf: longword; si: TGoalStrId; i: LongInt): ansistring; |
2905 | 94 |
var t: ansistring; |
2904 | 95 |
begin |
96 |
if (GameFlags and gf) <> 0 then |
|
97 |
begin |
|
98 |
t:= inttostr(i); |
|
99 |
s:= s + format(trgoal[si], t) + '|' |
|
100 |
end; |
|
101 |
AddGoal:= s; |
|
102 |
end; |
|
103 |
||
2908 | 104 |
function AddGoal(s: ansistring; gf: longword; si: TGoalStrId): ansistring; |
2863 | 105 |
begin |
2904 | 106 |
if (GameFlags and gf) <> 0 then |
107 |
s:= s + trgoal[si] + '|'; |
|
2863 | 108 |
AddGoal:= s; |
109 |
end; |
|
4 | 110 |
begin |
3764 | 111 |
missionTimer:= 0; |
2786 | 112 |
|
2704
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
113 |
if (GameFlags and gfRandomOrder) <> 0 then // shuffle them up a bit |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
114 |
begin |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
115 |
for i:= 0 to ClansCount * 4 do |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
116 |
begin |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
117 |
t:= GetRandom(ClansCount); |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
118 |
if t <> 0 then |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
119 |
begin |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
120 |
cp:= ClansArray[0]; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
121 |
ClansArray[0]:= ClansArray[t]; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
122 |
ClansArray[t]:= cp; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
123 |
ClansArray[t]^.ClanIndex:= t; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
124 |
ClansArray[0]^.ClanIndex:= 0; |
2856
cc70797a0b75
Adjust LocalClan when shuffling, set to -1 in case all local clans are bots.
nemo
parents:
2855
diff
changeset
|
125 |
if (LocalClan = t) then LocalClan:= 0 |
cc70797a0b75
Adjust LocalClan when shuffling, set to -1 in case all local clans are bots.
nemo
parents:
2855
diff
changeset
|
126 |
else if (LocalClan = 0) then LocalClan:= t |
2704
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
127 |
end; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
128 |
end; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
129 |
CurrentTeam:= ClansArray[0]^.Teams[0]; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
130 |
end; |
51cda17b7c3b
Rolling random numbers before land is generated is bad, m'kay? InitWorld probably not the best place for it.
nemo
parents:
2699
diff
changeset
|
131 |
|
2908 | 132 |
// if special game flags/settings are changed, add them to the game mode notice window and then show it |
2863 | 133 |
g:= ''; // no text/things to note yet |
2908 | 134 |
|
2958 | 135 |
// check different game flags (goals/game modes first for now) |
136 |
g:= AddGoal(g, gfKing, gidKing); // king? |
|
137 |
||
138 |
// other important flags |
|
139 |
g:= AddGoal(g, gfForts, gidForts); // forts? |
|
140 |
g:= AddGoal(g, gfLowGravity, gidLowGravity); // low gravity? |
|
141 |
g:= AddGoal(g, gfInvulnerable, gidInvulnerable); // invulnerability? |
|
142 |
g:= AddGoal(g, gfVampiric, gidVampiric); // vampirism? |
|
143 |
g:= AddGoal(g, gfKarma, gidKarma); // karma? |
|
144 |
g:= AddGoal(g, gfPlaceHog, gidPlaceHog); // placement? |
|
145 |
g:= AddGoal(g, gfArtillery, gidArtillery); // artillery? |
|
146 |
g:= AddGoal(g, gfSolidLand, gidSolidLand); // solid land? |
|
147 |
g:= AddGoal(g, gfSharedAmmo, gidSharedAmmo); // shared ammo? |
|
4132 | 148 |
g:= AddGoal(g, gfResetHealth, gidResetHealth); |
149 |
g:= AddGoal(g, gfAISurvival, gidAISurvival); |
|
150 |
g:= AddGoal(g, gfInfAttack, gidInfAttack); |
|
151 |
g:= AddGoal(g, gfResetWeps, gidResetWeps); |
|
152 |
g:= AddGoal(g, gfPerHogAmmo, gidPerHogAmmo); |
|
2958 | 153 |
|
2908 | 154 |
// modified damage modificator? |
155 |
if cDamagePercent <> 100 then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
156 |
g:= AddGoal(g, gfAny, gidDamageModifier, cDamagePercent); |
2908 | 157 |
|
3107 | 158 |
// fade in |
159 |
ScreenFade:= sfFromBlack; |
|
160 |
ScreenFadeValue:= sfMax; |
|
161 |
ScreenFadeSpeed:= 1; |
|
162 |
||
2908 | 163 |
// modified mine timers? |
4248 | 164 |
if cMinesTime <> 3 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
165 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
166 |
if cMinesTime = 0 then |
4003
ca0600ab38bf
disable gfMines and update variable names (landadds -> minesnum, cLandAdditions -> cLandMines)
koda
parents:
3976
diff
changeset
|
167 |
g:= AddGoal(g, gfAny, gidNoMineTimer) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
168 |
else if cMinesTime < 0 then |
4003
ca0600ab38bf
disable gfMines and update variable names (landadds -> minesnum, cLandAdditions -> cLandMines)
koda
parents:
3976
diff
changeset
|
169 |
g:= AddGoal(g, gfAny, gidRandomMineTimer) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
170 |
else |
4248 | 171 |
g:= AddGoal(g, gfAny, gidMineTimer, cMinesTime); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
172 |
end; |
2908 | 173 |
|
2863 | 174 |
// if the string has been set, show it for (default timeframe) seconds |
175 |
if g <> '' then ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0); |
|
176 |
||
1825 | 177 |
cWaveWidth:= SpritesData[sprWater].Width; |
2268
053eb81e60ee
little experiment to see if this improve appearance of laser/ufo/cake/laser guided missile - of course, can't actually see it until unc0rr restores waves
nemo
parents:
2226
diff
changeset
|
178 |
//cWaveHeight:= SpritesData[sprWater].Height; |
053eb81e60ee
little experiment to see if this improve appearance of laser/ufo/cake/laser guided missile - of course, can't actually see it until unc0rr restores waves
nemo
parents:
2226
diff
changeset
|
179 |
cWaveHeight:= 32; |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
180 |
|
284 | 181 |
cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); |
74 | 182 |
SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); |
2197 | 183 |
prevPoint.X:= 0; |
74 | 184 |
prevPoint.Y:= cScreenHeight div 2; |
1760 | 185 |
WorldDx:= - (LAND_WIDTH div 2) + cScreenWidth div 2; |
2139
5a083e71a71d
Properly decrement sniper rifle if timed out. Try to get camera position straight for once.
nemo
parents:
2119
diff
changeset
|
186 |
WorldDy:= - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); |
3434 | 187 |
AMSlotSize:= 33; |
188 |
{$IFDEF IPHONEOS} |
|
189 |
AMxOffset:= 10; |
|
3464 | 190 |
AMyOffset:= 10 + 123; // moved downwards |
3434 | 191 |
AMWidth:= (cMaxSlotAmmoIndex + 1) * AMSlotSize + AMxOffset; |
192 |
{$ELSE} |
|
193 |
AMxOffset:= 10; |
|
194 |
AMyOffset:= 60; |
|
195 |
AMWidth:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset; |
|
196 |
{$ENDIF} |
|
197 |
AMxShift:= AMWidth; |
|
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
198 |
SkyOffset:= 0; |
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
199 |
HorizontOffset:= 0; |
161 | 200 |
end; |
201 |
||
3405 | 202 |
|
956 | 203 |
procedure ShowAmmoMenu; |
161 | 204 |
const MENUSPEED = 15; |
3434 | 205 |
const BORDERSIZE = 2; |
206 |
var x, y, i, t, g: LongInt; |
|
207 |
Slot, Pos, STurns: LongInt; |
|
2855
7e6adeb57427
Show the ammo menu of the last local non-bot team when not local turn. needs testing
nemo
parents:
2851
diff
changeset
|
208 |
Ammo: PHHAmmo; |
161 | 209 |
begin |
3952
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3890
diff
changeset
|
210 |
if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then |
d6412423da45
moved some utilities to a separate column with round buttons
koda
parents:
3890
diff
changeset
|
211 |
bShowAmmoMenu:= false; |
3434 | 212 |
if bShowAmmoMenu then |
213 |
begin |
|
214 |
FollowGear:= nil; |
|
215 |
if AMxShift = AMWidth then prevPoint.X:= 0; |
|
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
216 |
if (cReducedQuality and rqSlowMenu) <> 0 then |
3434 | 217 |
AMxShift:= 0 |
218 |
else |
|
219 |
if AMxShift > MENUSPEED then |
|
220 |
dec(AMxShift, MENUSPEED) |
|
221 |
else |
|
222 |
AMxShift:= 0; |
|
223 |
end else |
|
224 |
begin |
|
225 |
if AMxShift = 0 then |
|
226 |
begin |
|
227 |
CursorPoint.X:= cScreenWidth shr 1; |
|
228 |
CursorPoint.Y:= cScreenHeight shr 1; |
|
229 |
prevPoint:= CursorPoint; |
|
230 |
SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y) |
|
231 |
end; |
|
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
232 |
if (cReducedQuality and rqSlowMenu) <> 0 then |
3434 | 233 |
AMxShift:= AMWidth |
234 |
else |
|
235 |
if AMxShift < (AMWidth - MENUSPEED) then |
|
236 |
inc(AMxShift, MENUSPEED) |
|
237 |
else |
|
238 |
AMxShift:= AMWidth; |
|
239 |
end; |
|
240 |
Ammo:= nil; |
|
241 |
if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then |
|
242 |
Ammo:= CurrentHedgehog^.Ammo |
|
243 |
else if (LocalAmmo <> -1) then |
|
244 |
Ammo:= GetAmmoByNum(LocalAmmo); |
|
245 |
Pos:= -1; |
|
246 |
if Ammo = nil then |
|
2971 | 247 |
begin |
3434 | 248 |
bShowAmmoMenu:= false; |
249 |
exit |
|
2971 | 250 |
end; |
3434 | 251 |
SlotsNum:= 0; |
252 |
x:= (cScreenWidth shr 1) - AMWidth + AMxShift; |
|
3395
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
253 |
|
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
254 |
{$IFDEF IPHONEOS} |
3434 | 255 |
Slot:= cMaxSlotIndex; |
3463 | 256 |
x:= x - cOffsetY; |
3464 | 257 |
y:= AMyOffset; |
3434 | 258 |
dec(y, BORDERSIZE); |
259 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
|
260 |
for i:= 0 to cMaxSlotAmmoIndex do |
|
261 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
|
262 |
DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
|
263 |
inc(y, BORDERSIZE); |
|
264 |
||
265 |
for i:= 0 to cMaxSlotIndex do |
|
266 |
if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
|
267 |
begin |
|
3961
cf0ca1ff6c1a
Constrain to <= to avoid a bug on bottom edge reported by Henek
nemo
parents:
3890
diff
changeset
|
268 |
if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y <= y + AMSlotSize) then Slot:= i; |
3434 | 269 |
inc(SlotsNum); |
270 |
DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
271 |
t:= 0; |
|
272 |
g:= 0; |
|
273 |
while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
|
274 |
begin |
|
275 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
276 |
if (Ammo^[i, t].AmmoType <> amNothing) then |
|
277 |
begin |
|
278 |
STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
|
279 |
||
280 |
if STurns >= 0 then |
|
281 |
begin |
|
282 |
DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
283 |
if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
|
284 |
end else |
|
285 |
DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
286 |
if (Slot = i) |
|
287 |
and (CursorPoint.X >= x + g * AMSlotSize) |
|
3967 | 288 |
and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
3434 | 289 |
begin |
290 |
if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
|
291 |
Pos:= t; |
|
292 |
end; |
|
293 |
inc(g) |
|
294 |
end; |
|
295 |
inc(t) |
|
296 |
end; |
|
297 |
for g:= g to cMaxSlotAmmoIndex do |
|
298 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
299 |
DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
|
300 |
inc(y, AMSlotSize); |
|
301 |
end; |
|
3697 | 302 |
|
3434 | 303 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
304 |
for i:= 0 to cMaxSlotAmmoIndex do |
|
305 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
|
306 |
DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); |
|
3395
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
307 |
{$ELSE} |
3434 | 308 |
Slot:= 0; |
309 |
y:= cScreenHeight - AMyOffset; |
|
310 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
|
311 |
for i:= 0 to cMaxSlotAmmoIndex + 1 do |
|
312 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
|
313 |
DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); |
|
314 |
dec(y, AMSlotSize); |
|
315 |
DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
316 |
for i:= 0 to cMaxSlotAmmoIndex do |
|
317 |
DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); |
|
318 |
DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1); |
|
319 |
DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
|
320 |
||
321 |
for i:= cMaxSlotIndex downto 0 do |
|
322 |
if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
|
323 |
begin |
|
3961
cf0ca1ff6c1a
Constrain to <= to avoid a bug on bottom edge reported by Henek
nemo
parents:
3890
diff
changeset
|
324 |
if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then Slot:= i; |
3434 | 325 |
dec(y, AMSlotSize); |
326 |
inc(SlotsNum); |
|
327 |
DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
328 |
DrawSprite(sprAMSlot, x, y, 1); |
|
329 |
DrawSprite(sprAMSlotKeys, x, y + 1, i); |
|
330 |
t:= 0; |
|
331 |
g:= 1; |
|
332 |
while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
|
333 |
begin |
|
334 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
335 |
if (Ammo^[i, t].AmmoType <> amNothing) then |
|
336 |
begin |
|
337 |
STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
|
338 |
||
339 |
if STurns >= 0 then |
|
340 |
begin |
|
341 |
DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
342 |
if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
|
343 |
end else |
|
344 |
DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
345 |
if (Slot = i) |
|
346 |
and (CursorPoint.X >= x + g * AMSlotSize) |
|
3967 | 347 |
and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
3434 | 348 |
begin |
349 |
if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
|
350 |
Pos:= t; |
|
351 |
end; |
|
352 |
inc(g) |
|
353 |
end; |
|
354 |
inc(t) |
|
355 |
end; |
|
356 |
for g:= g to cMaxSlotAmmoIndex + 1 do |
|
357 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
358 |
DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
|
359 |
end; |
|
3697 | 360 |
|
3434 | 361 |
dec(y, BORDERSIZE); |
362 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
|
363 |
for i:= 0 to cMaxSlotAmmoIndex + 1 do |
|
364 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
|
365 |
DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
|
3395
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
366 |
{$ENDIF} |
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
367 |
|
3434 | 368 |
if (Pos >= 0) then |
369 |
begin |
|
370 |
if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
|
3967 | 371 |
begin |
3434 | 372 |
if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
373 |
begin |
3434 | 374 |
amSel:= Ammo^[Slot, Pos].AmmoType; |
375 |
RenderWeaponTooltip(amSel) |
|
376 |
end; |
|
3697 | 377 |
|
3629
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
378 |
{$IFDEF IPHONEOS} |
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
379 |
DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
380 |
|
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
381 |
if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
382 |
DrawTexture(cScreenWidth div 2 + AMxOffset - 45, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
383 |
{$ELSE} |
3434 | 384 |
DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
385 |
if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
|
386 |
DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
|
3629
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
387 |
{$ENDIF} |
1529
3bc916b419cd
Don't hide ammo menu when user clicks on not yet available weapon
unc0rr
parents:
1439
diff
changeset
|
388 |
|
3434 | 389 |
if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
390 |
begin |
|
391 |
bShowAmmoMenu:= false; |
|
392 |
SetWeapon(Ammo^[Slot, Pos].AmmoType); |
|
393 |
bSelected:= false; |
|
394 |
FreeWeaponTooltip; |
|
395 |
exit |
|
3405 | 396 |
end; |
3967 | 397 |
end |
3434 | 398 |
end |
399 |
else |
|
400 |
FreeWeaponTooltip; |
|
3663
8c28abf427f5
reduce the number of keywords used and switch to BMP format for screenshots
koda
parents:
3641
diff
changeset
|
401 |
if (WeaponTooltipTex <> nil) and (AMxShift = 0) then |
3395
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
402 |
{$IFDEF IPHONEOS} |
3434 | 403 |
ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1); |
3395
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
404 |
{$ELSE} |
3434 | 405 |
ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); |
3395
095273ad0e08
adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents:
3390
diff
changeset
|
406 |
{$ENDIF} |
961
a9a349b2b3fa
Use turnsleft sprites to indicate turns left to activate ammo
unc0rr
parents:
956
diff
changeset
|
407 |
|
3434 | 408 |
bSelected:= false; |
409 |
if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
|
4 | 410 |
end; |
411 |
||
3104 | 412 |
procedure DrawWater(Alpha: byte; OffsetY: LongInt); |
1915 | 413 |
var VertexBuffer: array [0..3] of TVertex2f; |
414 |
r: TSDL_Rect; |
|
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
415 |
lw, lh: GLfloat; |
1915 | 416 |
begin |
3405 | 417 |
WaterColorArray[0].a := Alpha; |
418 |
WaterColorArray[1].a := Alpha; |
|
419 |
WaterColorArray[2].a := Alpha; |
|
420 |
WaterColorArray[3].a := Alpha; |
|
2269
00f5704f5f39
add extra semi-opaque layer of water to discolour objects in the water.
nemo
parents:
2268
diff
changeset
|
421 |
|
3463 | 422 |
lw:= cScreenWidth / cScaleFactor; |
423 |
lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16; |
|
3697 | 424 |
|
3405 | 425 |
// Water |
426 |
r.y:= OffsetY + WorldDy + cWaterLine; |
|
3463 | 427 |
if WorldDy < trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
428 |
begin |
3405 | 429 |
if r.y < 0 then |
430 |
r.y:= 0; |
|
1915 | 431 |
|
3405 | 432 |
glDisable(GL_TEXTURE_2D); |
433 |
VertexBuffer[0].X:= -lw; |
|
434 |
VertexBuffer[0].Y:= r.y; |
|
435 |
VertexBuffer[1].X:= lw; |
|
436 |
VertexBuffer[1].Y:= r.y; |
|
437 |
VertexBuffer[2].X:= lw; |
|
438 |
VertexBuffer[2].Y:= lh; |
|
439 |
VertexBuffer[3].X:= -lw; |
|
440 |
VertexBuffer[3].Y:= lh; |
|
1915 | 441 |
|
3641 | 442 |
glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
443 |
glEnableClientState(GL_COLOR_ARRAY); |
|
3405 | 444 |
glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]); |
1915 | 445 |
|
3405 | 446 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
2171
8208946331ba
Smaxx refactor of LoadImage to use flags, iphone changes by koda (mostly use of rgba instead of rgb)
nemo
parents:
2162
diff
changeset
|
447 |
|
3405 | 448 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1915 | 449 |
|
3405 | 450 |
glDisableClientState(GL_COLOR_ARRAY); |
3641 | 451 |
glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
3407 | 452 |
glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
3405 | 453 |
glEnable(GL_TEXTURE_2D); |
454 |
end; |
|
1915 | 455 |
end; |
456 |
||
3376 | 457 |
procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
458 |
var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
459 |
lw, waves, shift: GLfloat; |
2288 | 460 |
begin |
3463 | 461 |
lw:= cScreenWidth / cScaleFactor; |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
462 |
waves:= lw * 2 / cWaveWidth; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
463 |
|
3407 | 464 |
Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt, |
465 |
LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt, |
|
466 |
LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt, |
|
467 |
255 |
|
3089 | 468 |
); |
469 |
||
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
470 |
glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id); |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
471 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
472 |
VertexBuffer[0].X:= -lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
473 |
VertexBuffer[0].Y:= cWaterLine + WorldDy + dY; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
474 |
VertexBuffer[1].X:= lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
475 |
VertexBuffer[1].Y:= VertexBuffer[0].Y; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
476 |
VertexBuffer[2].X:= lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
477 |
VertexBuffer[2].Y:= VertexBuffer[0].Y + SpritesData[sprWater].Height; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
478 |
VertexBuffer[3].X:= -lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
479 |
VertexBuffer[3].Y:= VertexBuffer[2].Y; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
480 |
|
2374 | 481 |
shift:= - lw / cWaveWidth; |
2495 | 482 |
TextureBuffer[0].X:= shift + (( - WorldDx + LongInt(RealTicks shr 6) * Dir + dX) mod cWaveWidth) / (cWaveWidth - 1); |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
483 |
TextureBuffer[0].Y:= 0; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
484 |
TextureBuffer[1].X:= TextureBuffer[0].X + waves; |
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2434
diff
changeset
|
485 |
TextureBuffer[1].Y:= TextureBuffer[0].Y; |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2434
diff
changeset
|
486 |
TextureBuffer[2].X:= TextureBuffer[1].X; |
2553 | 487 |
TextureBuffer[2].Y:= SpritesData[sprWater].Texture^.ry; |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
488 |
TextureBuffer[3].X:= TextureBuffer[0].X; |
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2434
diff
changeset
|
489 |
TextureBuffer[3].Y:= TextureBuffer[2].Y; |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
490 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
491 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
492 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
493 |
glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
494 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
495 |
|
3390 | 496 |
Tint($FF, $FF, $FF, $FF); |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
497 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
498 |
{for i:= -1 to cWaterSprCount do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
499 |
DrawSprite(sprWater, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
500 |
i * cWaveWidth + ((WorldDx + (RealTicks shr 6) * Dir + dX) mod cWaveWidth) - (cScreenWidth div 2), |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
501 |
cWaterLine + WorldDy + dY, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
502 |
0)} |
2288 | 503 |
end; |
504 |
||
3089 | 505 |
procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt); |
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
506 |
var i, w, h, lw, lh, rw, rh, sw: LongInt; |
2426 | 507 |
begin |
3405 | 508 |
sw:= round(cScreenWidth / cScaleFactor); |
509 |
if (SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil) then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
510 |
begin |
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
511 |
w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale; |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
512 |
h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; |
3405 | 513 |
i:= Shift mod w; |
514 |
if i > 0 then dec(i, w); |
|
515 |
dec(i, w * (sw div w + 1)); |
|
516 |
repeat |
|
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
517 |
DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
3405 | 518 |
inc(i, w) |
519 |
until i > sw |
|
520 |
end |
|
521 |
else |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
522 |
begin |
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
523 |
w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale; |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
524 |
h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
525 |
lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale; |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
526 |
lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale; |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
527 |
rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale; |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
528 |
rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale; |
3405 | 529 |
dec(Shift, w div 2); |
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
530 |
DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
3697 | 531 |
|
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
532 |
i:= Shift - lw; |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
533 |
while i >= -sw - lw do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
534 |
begin |
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
535 |
DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
536 |
dec(i, lw); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
537 |
end; |
3697 | 538 |
|
3405 | 539 |
i:= Shift + w; |
540 |
while i <= sw do |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
541 |
begin |
3537
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
542 |
DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale); |
8f5b3108f29c
New approach to the low-res problem. Basically, we already have a 1024 minimum, and the tallest maps are restricting themselves to 2048 maximum. All backgrounds are scaled down 50%, then scaled up on draw. Saves memory, and backgrounds are already deliberately fuzzed for depth of field anyway.
nemo
parents:
3523
diff
changeset
|
543 |
inc(i, rw) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
544 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
545 |
end |
2426 | 546 |
end; |
547 |
||
548 |
||
956 | 549 |
procedure DrawWorld(Lag: LongInt); |
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
550 |
var i, t: LongInt; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
551 |
r: TSDL_Rect; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
552 |
tdx, tdy: Double; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
553 |
grp: TCapGroup; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
554 |
s: string[15]; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
555 |
highlight: Boolean; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
556 |
offset, offsetX, offsetY, ScreenBottom: LongInt; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
557 |
VertexBuffer: array [0..3] of TVertex2f; |
4 | 558 |
begin |
3811 | 559 |
if not isPaused then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
560 |
begin |
3523 | 561 |
if ZoomValue < zoom then |
3444 | 562 |
begin |
3523 | 563 |
zoom:= zoom - 0.002 * Lag; |
3697 | 564 |
if ZoomValue > zoom then |
3523 | 565 |
zoom:= ZoomValue |
3697 | 566 |
end |
3774 | 567 |
else |
3523 | 568 |
if ZoomValue > zoom then |
3444 | 569 |
begin |
3523 | 570 |
zoom:= zoom + 0.002 * Lag; |
571 |
if ZoomValue < zoom then |
|
572 |
zoom:= ZoomValue |
|
3611 | 573 |
end |
3444 | 574 |
end |
3611 | 575 |
else |
576 |
ZoomValue:= zoom; |
|
2376 | 577 |
|
3611 | 578 |
// Sky |
579 |
glClear(GL_COLOR_BUFFER_BIT); |
|
580 |
//glPushMatrix; |
|
581 |
//glScalef(1.0, 1.0, 1.0); |
|
756 | 582 |
|
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
583 |
if not isPaused then |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
584 |
MoveCamera; |
162 | 585 |
|
3611 | 586 |
if (cReducedQuality and rqNoBackground) = 0 then |
1812 | 587 |
begin |
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
588 |
// Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
589 |
ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
590 |
offsetY:= 10 * min(0, -145 - ScreenBottom); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
591 |
SkyOffset:= offsetY div 35 + cWaveHeight; |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
592 |
HorizontOffset:= SkyOffset; |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
593 |
if ScreenBottom > SkyOffset then |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
594 |
HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
595 |
|
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
596 |
// background |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
597 |
DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
598 |
DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
599 |
end; |
4 | 600 |
|
3611 | 601 |
DrawVisualGears(0); |
3697 | 602 |
|
3611 | 603 |
if (cReducedQuality and rq2DWater) = 0 then |
604 |
begin |
|
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
605 |
// Waves |
3697 | 606 |
DrawWater(255, SkyOffset); |
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
607 |
DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
608 |
DrawWaves( -1, 25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 48); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
609 |
DrawWaves( 1, 75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
610 |
DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24); |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
611 |
end |
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
612 |
else |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
613 |
DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0); |
4 | 614 |
|
3611 | 615 |
DrawLand(WorldDx, WorldDy); |
1911 | 616 |
|
3611 | 617 |
DrawWater(255, 0); |
4 | 618 |
|
1660 | 619 |
// Attack bar |
3611 | 620 |
if CurrentTeam <> nil then |
621 |
case AttackBar of |
|
1660 | 622 |
(* 1: begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
623 |
r:= StuffPoz[sPowerBar]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
624 |
{$WARNINGS OFF} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
625 |
r.w:= (CurrentHedgehog^.Gear^.Power * 256) div cPowerDivisor; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
626 |
{$WARNINGS ON} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
627 |
DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
628 |
end;*) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
629 |
2: with CurrentHedgehog^ do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
630 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
631 |
tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
632 |
tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
633 |
for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
634 |
DrawSprite(sprPower, |
4159
64e677349124
REmove stupid int64 conversions, provide real fixes to compiler hints
unc0rr
parents:
4132
diff
changeset
|
635 |
hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16, |
64e677349124
REmove stupid int64 conversions, provide real fixes to compiler hints
unc0rr
parents:
4132
diff
changeset
|
636 |
hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16, |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
637 |
i) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
638 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
639 |
end; |
1660 | 640 |
|
3611 | 641 |
DrawVisualGears(1); |
2713 | 642 |
|
3611 | 643 |
DrawGears; |
4 | 644 |
|
3611 | 645 |
DrawVisualGears(2); |
1045 | 646 |
|
3611 | 647 |
DrawWater(cWaterOpacity, 0); |
2269
00f5704f5f39
add extra semi-opaque layer of water to discolour objects in the water.
nemo
parents:
2268
diff
changeset
|
648 |
|
3611 | 649 |
// Waves |
650 |
DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12); |
|
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
651 |
|
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
652 |
if (cReducedQuality and rq2DWater) = 0 then |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
653 |
begin |
3594
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
654 |
//DrawWater(cWaterOpacity, - offsetY div 40); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
655 |
DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
656 |
DrawWater(cWaterOpacity, - offsetY div 20); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
657 |
DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
658 |
DrawWater(cWaterOpacity, - offsetY div 10); |
aeca3d8f1b29
turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend)
koda
parents:
3582
diff
changeset
|
659 |
DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
660 |
end |
3611 | 661 |
else |
662 |
DrawWaves(-1, 50, - (cWaveHeight shr 1), 0); |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
663 |
|
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
664 |
|
2288 | 665 |
{$WARNINGS OFF} |
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
666 |
// Target |
3104 | 667 |
if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then |
668 |
begin |
|
669 |
with PHedgehog(CurrentHedgehog)^ do |
|
670 |
begin |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3811
diff
changeset
|
671 |
if (CurAmmoType = amBee) then |
3110 | 672 |
DrawRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
673 |
else |
|
3104 | 674 |
DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
675 |
end; |
|
676 |
end; |
|
4 | 677 |
{$WARNINGS ON} |
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
678 |
|
3523 | 679 |
// this scale is used to keep the various widgets at the same dimension at all zoom levels |
680 |
SetScale(cDefaultZoomLevel); |
|
2724 | 681 |
|
682 |
||
683 |
// Turn time |
|
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
684 |
{$IFDEF IPHONEOS} |
3025 | 685 |
offsetX:= cScreenHeight - 13; |
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
686 |
{$ELSE} |
3025 | 687 |
offsetX:= 48; |
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
688 |
{$ENDIF} |
3463 | 689 |
offsetY:= cOffsetY; |
3890
e4b7b30232fd
Extend time limit to 9999, remove ready timer if time is over 999 and stop drawing time if it is over 999 (draws wrong over 999 anyway) - this has the effect of allowing an "unlimited" time appearance if turns are over a quarter hour or so. This can be used to add an unlimited time scheme or button to ipad
nemo
parents:
3836
diff
changeset
|
690 |
if ((TurnTimeLeft <> 0) and (TurnTimeLeft < 1000000)) or (ReadyTimeLeft <> 0) then |
3774 | 691 |
begin |
692 |
if ReadyTimeLeft <> 0 then |
|
693 |
i:= Succ(Pred(ReadyTimeLeft) div 1000) |
|
694 |
else |
|
695 |
i:= Succ(Pred(TurnTimeLeft) div 1000); |
|
696 |
||
4 | 697 |
if i>99 then t:= 112 |
698 |
else if i>9 then t:= 96 |
|
699 |
else t:= 80; |
|
3463 | 700 |
DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
4 | 701 |
while i > 0 do |
702 |
begin |
|
703 |
dec(t, 32); |
|
3463 | 704 |
DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10); |
4 | 705 |
i:= i div 10 |
706 |
end; |
|
3463 | 707 |
DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
4 | 708 |
end; |
79 | 709 |
|
2567 | 710 |
{$IFNDEF IPHONEOS} |
2428 | 711 |
// Timetrial |
712 |
if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
713 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
714 |
if TimeTrialStopTime = 0 then i:= RealTicks - TimeTrialStartTime else i:= TimeTrialStopTime - TimeTrialStartTime; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
715 |
t:= 272; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
716 |
// right frame |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
717 |
DrawSprite(sprFrame, -cScreenWidth div 2 + t, 8, 1); |
2428 | 718 |
dec(t, 32); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
719 |
// 1 ms |
3697 | 720 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
2428 | 721 |
dec(t, 32); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
722 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
723 |
// 10 ms |
2428 | 724 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
725 |
dec(t, 32); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
726 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
727 |
// 100 ms |
2428 | 728 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
729 |
dec(t, 16); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
730 |
// Point |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
731 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 11); |
2428 | 732 |
dec(t, 32); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
733 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
734 |
// 1 s |
2428 | 735 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
736 |
dec(t, 32); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
737 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
738 |
// 10s |
2428 | 739 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 6); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
740 |
dec(t, 16); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
741 |
// Point |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
742 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 10); |
2428 | 743 |
dec(t, 32); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
744 |
i:= i div 6; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
745 |
// 1 m |
2428 | 746 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
747 |
dec(t, 32); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
748 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
749 |
// 10 m |
2428 | 750 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
751 |
// left frame |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
752 |
DrawSprite(sprFrame, -cScreenWidth div 2 + t - 4, 8, 0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
753 |
end; |
2567 | 754 |
{$ENDIF} |
755 |
||
4 | 756 |
// Captions |
2567 | 757 |
{$IFDEF IPHONEOS} |
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
758 |
offset:= 40; |
2567 | 759 |
{$ELSE} |
2724 | 760 |
if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then offset:= 48 |
761 |
else offset:= 8; |
|
2567 | 762 |
{$ENDIF} |
2428 | 763 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
764 |
for grp:= Low(TCapGroup) to High(TCapGroup) do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
765 |
with Captions[grp] do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
766 |
if Tex <> nil then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
767 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
768 |
DrawCentered(0, offset, Tex); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
769 |
inc(offset, Tex^.h + 2); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
770 |
if EndTime <= RealTicks then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
771 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
772 |
FreeTexture(Tex); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
773 |
Tex:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
774 |
EndTime:= 0 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
775 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
776 |
end; |
4 | 777 |
|
47 | 778 |
// Teams Healths |
547 | 779 |
for t:= 0 to Pred(TeamsCount) do |
780 |
with TeamsArray[t]^ do |
|
47 | 781 |
begin |
2839 | 782 |
highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
3697 | 783 |
|
2747 | 784 |
if highlight then |
3445 | 785 |
Tint(Clan^.Color); |
2839 | 786 |
|
787 |
// draw name |
|
788 |
DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex); |
|
3697 | 789 |
|
2839 | 790 |
// draw flag |
791 |
DrawTexture(-14, cScreenHeight + DrawHealthY, FlagTex); |
|
3697 | 792 |
|
2839 | 793 |
// draw health bar |
690 | 794 |
r.x:= 0; |
795 |
r.y:= 0; |
|
547 | 796 |
r.w:= 2 + TeamHealthBarWidth; |
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
797 |
r.h:= HealthTex^.h; |
2747 | 798 |
DrawFromRect(14, cScreenHeight + DrawHealthY, @r, HealthTex); |
690 | 799 |
|
2839 | 800 |
// draw health bar's right border |
83 | 801 |
inc(r.x, cTeamHealthWidth + 2); |
802 |
r.w:= 3; |
|
2839 | 803 |
DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex); |
3770 | 804 |
|
805 |
// draw ai kill counter for gfAISurvival |
|
806 |
if (GameFlags and gfAISurvival) <> 0 then begin |
|
807 |
DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY, |
|
3773 | 808 |
AIKillsTex); |
3770 | 809 |
end; |
810 |
||
2839 | 811 |
// if highlighted, draw flag and other contents again to keep their colors |
812 |
// this approach should be faster than drawing all borders one by one tinted or not |
|
813 |
if highlight then |
|
814 |
begin |
|
3390 | 815 |
Tint($FF, $FF, $FF, $FF); |
690 | 816 |
|
2839 | 817 |
// draw name |
2747 | 818 |
r.x:= 2; |
819 |
r.y:= 2; |
|
2839 | 820 |
r.w:= NameTagTex^.w - 4; |
821 |
r.h:= NameTagTex^.h - 4; |
|
822 |
DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + 2, @r, NameTagTex); |
|
823 |
// draw flag |
|
2747 | 824 |
r.w:= 22; |
825 |
r.h:= 15; |
|
826 |
DrawFromRect(-12, cScreenHeight + DrawHealthY + 2, @r, FlagTex); |
|
2839 | 827 |
// draw health bar |
828 |
r.w:= TeamHealthBarWidth + 1; |
|
829 |
r.h:= HealthTex^.h - 4; |
|
830 |
DrawFromRect(16, cScreenHeight + DrawHealthY + 2, @r, HealthTex); |
|
2747 | 831 |
end; |
47 | 832 |
end; |
833 |
||
5 | 834 |
// Lag alert |
2567 | 835 |
if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
4 | 836 |
|
5 | 837 |
// Wind bar |
2567 | 838 |
{$IFDEF IPHONEOS} |
3405 | 839 |
offsetX:= cScreenHeight - 13; |
840 |
offsetY:= (cScreenWidth shr 1) + 74; |
|
2567 | 841 |
{$ELSE} |
3405 | 842 |
offsetX:= 30; |
843 |
offsetY:= 180; |
|
2567 | 844 |
{$ENDIF} |
3405 | 845 |
DrawSprite(sprWindBar, (cScreenWidth shr 1) - offsetY, cScreenHeight - offsetX, 0); |
846 |
if WindBarWidth > 0 then |
|
847 |
begin |
|
848 |
{$WARNINGS OFF} |
|
849 |
r.x:= 8 - (RealTicks shr 6) mod 8; |
|
850 |
{$WARNINGS ON} |
|
851 |
r.y:= 0; |
|
852 |
r.w:= WindBarWidth; |
|
853 |
r.h:= 13; |
|
854 |
DrawSpriteFromRect(sprWindR, r, (cScreenWidth shr 1) - offsetY + 77, cScreenHeight - offsetX + 2, 13, 0); |
|
855 |
end |
|
856 |
else |
|
857 |
if WindBarWidth < 0 then |
|
858 |
begin |
|
859 |
{$WARNINGS OFF} |
|
3407 | 860 |
r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8; |
3405 | 861 |
{$WARNINGS ON} |
862 |
r.y:= 0; |
|
863 |
r.w:= - WindBarWidth; |
|
864 |
r.h:= 13; |
|
865 |
DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
|
866 |
end; |
|
5 | 867 |
|
161 | 868 |
// AmmoMenu |
3434 | 869 |
if (AMxShift < AMWidth) or bShowAmmoMenu then ShowAmmoMenu; |
161 | 870 |
|
2287 | 871 |
// Cursor |
872 |
if isCursorVisible and bShowAmmoMenu then |
|
873 |
DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
|
942 | 874 |
|
2287 | 875 |
DrawChat; |
4 | 876 |
|
2567 | 877 |
if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture); |
878 |
if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture); |
|
3774 | 879 |
if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
880 |
begin |
3774 | 881 |
if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
882 |
if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
883 |
if missionTex <> nil then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
884 |
DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
885 |
end; |
2786 | 886 |
|
2724 | 887 |
// fps |
888 |
{$IFDEF IPHONEOS} |
|
3463 | 889 |
offsetX:= 8; |
2724 | 890 |
{$ELSE} |
3463 | 891 |
offsetX:= 10; |
2724 | 892 |
{$ENDIF} |
3463 | 893 |
offsetY:= cOffsetY; |
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
894 |
inc(Frames); |
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
895 |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
896 |
if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
897 |
if (GameType = gmtDemo) and (CountTicks >= 1000) then |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
898 |
begin |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
899 |
i:=GameTicks div 1000; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
900 |
t:= i mod 60; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
901 |
s:= inttostr(t); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
902 |
if t < 10 then s:= '0' + s; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
903 |
i:= i div 60; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
904 |
t:= i mod 60; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
905 |
s:= inttostr(t) + ':' + s; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
906 |
if t < 10 then s:= '0' + s; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
907 |
s:= inttostr(i div 60) + ':' + s; |
3697 | 908 |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
909 |
if timeTexture <> nil then |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
910 |
FreeTexture(timeTexture); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
911 |
timeTexture:= nil; |
3697 | 912 |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
913 |
tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
914 |
tmpSurface:= doSurfaceConversion(tmpSurface); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
915 |
timeTexture:= Surface2Tex(tmpSurface, false); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
916 |
SDL_FreeSurface(tmpSurface) |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
917 |
end; |
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
918 |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
919 |
if timeTexture <> nil then |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
920 |
DrawTexture((cScreenWidth shr 1) - 20 - timeTexture^.w - offsetY, offsetX + timeTexture^.h+5, timeTexture); |
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
921 |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
922 |
if cShowFPS then |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
923 |
begin |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
924 |
if CountTicks >= 1000 then |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
925 |
begin |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
926 |
FPS:= Frames; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
927 |
Frames:= 0; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
928 |
CountTicks:= 0; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
929 |
s:= inttostr(FPS) + ' fps'; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
930 |
if fpsTexture <> nil then |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
931 |
FreeTexture(fpsTexture); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
932 |
fpsTexture:= nil; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
933 |
tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
934 |
tmpSurface:= doSurfaceConversion(tmpSurface); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
935 |
fpsTexture:= Surface2Tex(tmpSurface, false); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
936 |
SDL_FreeSurface(tmpSurface) |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
937 |
end; |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
938 |
if fpsTexture <> nil then |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
939 |
DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture); |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
940 |
end; |
174 | 941 |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
942 |
if CountTicks >= 1000 then CountTicks:= 0; |
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
943 |
|
3695
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
944 |
// lag warning (?) |
c11abf387a7d
reverted stereo craziness - the experimental3D branch has been created for a reason
koda
parents:
3693
diff
changeset
|
945 |
inc(SoundTimerTicks, Lag); |
174 | 946 |
if SoundTimerTicks >= 50 then |
947 |
begin |
|
948 |
SoundTimerTicks:= 0; |
|
949 |
if cVolumeDelta <> 0 then |
|
950 |
begin |
|
951 |
str(ChangeVolume(cVolumeDelta), s); |
|
2619 | 952 |
AddCaption(Format(trmsg[sidVolume], s), cWhiteColor, capgrpVolume) |
174 | 953 |
end |
756 | 954 |
end; |
955 |
||
2724 | 956 |
if GameState = gsConfirm then |
3025 | 957 |
DrawCentered(0, (cScreenHeight shr 1), ConfirmTexture); |
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
958 |
|
3107 | 959 |
if ScreenFade <> sfNone then |
960 |
begin |
|
961 |
if not isFirstFrame then |
|
962 |
case ScreenFade of |
|
963 |
sfToBlack, sfToWhite: if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then |
|
964 |
inc(ScreenFadeValue, Lag * ScreenFadeSpeed) |
|
965 |
else |
|
3123 | 966 |
ScreenFadeValue:= sfMax; |
3107 | 967 |
sfFromBlack, sfFromWhite: if ScreenFadeValue - Lag * ScreenFadeSpeed > 0 then |
968 |
dec(ScreenFadeValue, Lag * ScreenFadeSpeed) |
|
969 |
else |
|
3123 | 970 |
ScreenFadeValue:= 0; |
3107 | 971 |
end; |
972 |
if ScreenFade <> sfNone then |
|
973 |
begin |
|
974 |
case ScreenFade of |
|
3376 | 975 |
sfToBlack, sfFromBlack: Tint(0, 0, 0, ScreenFadeValue * 255 div 1000); |
976 |
sfToWhite, sfFromWhite: Tint($FF, $FF, $FF, ScreenFadeValue * 255 div 1000); |
|
3107 | 977 |
end; |
3697 | 978 |
|
3113 | 979 |
VertexBuffer[0].X:= -cScreenWidth; |
980 |
VertexBuffer[0].Y:= cScreenHeight; |
|
981 |
VertexBuffer[1].X:= -cScreenWidth; |
|
982 |
VertexBuffer[1].Y:= 0; |
|
983 |
VertexBuffer[2].X:= cScreenWidth; |
|
984 |
VertexBuffer[2].Y:= 0; |
|
985 |
VertexBuffer[3].X:= cScreenWidth; |
|
986 |
VertexBuffer[3].Y:= cScreenHeight; |
|
3697 | 987 |
|
3376 | 988 |
glDisable(GL_TEXTURE_2D); |
3641 | 989 |
|
3113 | 990 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
991 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
3641 | 992 |
|
3376 | 993 |
glEnable(GL_TEXTURE_2D); |
3390 | 994 |
Tint($FF, $FF, $FF, $FF); |
3123 | 995 |
if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then ScreenFade:= sfNone |
3107 | 996 |
end |
997 |
end; |
|
998 |
||
3123 | 999 |
SetScale(zoom); |
1000 |
||
1001 |
// Cursor |
|
1002 |
if isCursorVisible then |
|
1003 |
begin |
|
1004 |
if not bShowAmmoMenu then |
|
3204 | 1005 |
begin |
3123 | 1006 |
with CurrentHedgehog^ do |
3582
4debed8656d7
fix segfault on HH-gear being 0 (e.g. after drowning) in cursor/target selection mode, thanks "ivze" for the heads-up!
sheepluva
parents:
3580
diff
changeset
|
1007 |
if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
3123 | 1008 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3811
diff
changeset
|
1009 |
i:= GetAmmoEntry(CurrentHedgehog^)^.Pos; |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3811
diff
changeset
|
1010 |
with Ammoz[CurAmmoType] do |
3123 | 1011 |
if PosCount > 1 then |
3204 | 1012 |
DrawSprite(PosSprite, CursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - CursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
3123 | 1013 |
end; |
3204 | 1014 |
DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
1015 |
end |
|
3123 | 1016 |
end; |
3107 | 1017 |
isFirstFrame:= false |
4 | 1018 |
end; |
1019 |
||
2905 | 1020 |
procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); |
4 | 1021 |
begin |
2142 | 1022 |
//if Group in [capgrpGameState] then WriteLnToConsole(s); |
3697 | 1023 |
if Captions[Group].Tex <> nil then |
3513
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1024 |
FreeTexture(Captions[Group].Tex); |
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1025 |
Captions[Group].Tex:= nil; |
2142 | 1026 |
|
3513
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1027 |
Captions[Group].Tex:= RenderStringTex(s, Color, fntBig); |
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1028 |
|
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1029 |
case Group of |
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1030 |
capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1031 |
else |
3513
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1032 |
Captions[Group].EndTime:= RealTicks + 1400 + LongWord(Captions[Group].Tex^.w) * 3; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1033 |
end; |
4 | 1034 |
end; |
1035 |
||
79 | 1036 |
procedure MoveCamera; |
2428 | 1037 |
var EdgesDist, wdy: LongInt; |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3629
diff
changeset
|
1038 |
PrevSentPointTime: LongWord = 0; |
4 | 1039 |
begin |
3551 | 1040 |
{$IFNDEF IPHONEOS} |
2970
011075f93746
Let's try this too (override following remote if in ammo menu)
nemo
parents:
2959
diff
changeset
|
1041 |
if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus then |
3551 | 1042 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1043 |
SDL_GetMouseState(@CursorPoint.X, @CursorPoint.Y); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1044 |
CursorPoint.X:= CursorPoint.X - (cScreenWidth shr 1); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1045 |
CursorPoint.Y:= cScreenHeight - CursorPoint.Y; |
3551 | 1046 |
end; |
1047 |
{$ENDIF} |
|
678 | 1048 |
|
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2747
diff
changeset
|
1049 |
if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1050 |
if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then |
3680 | 1051 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1052 |
FollowGear:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1053 |
prevPoint:= CursorPoint; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1054 |
exit |
3680 | 1055 |
end |
1056 |
else |
|
1057 |
begin |
|
2970
011075f93746
Let's try this too (override following remote if in ammo menu)
nemo
parents:
2959
diff
changeset
|
1058 |
CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8; |
011075f93746
Let's try this too (override following remote if in ammo menu)
nemo
parents:
2959
diff
changeset
|
1059 |
CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8; |
3680 | 1060 |
end; |
4 | 1061 |
|
2375 | 1062 |
wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1063 |
if WorldDy < wdy then WorldDy:= wdy; |
|
1064 |
||
2197 | 1065 |
if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; |
4 | 1066 |
|
3434 | 1067 |
if AMxShift < AMWidth then |
3680 | 1068 |
begin |
3463 | 1069 |
{$IFDEF IPHONEOS} |
3434 | 1070 |
if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1071 |
if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
|
1072 |
if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
|
1073 |
if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset; |
|
3463 | 1074 |
{$ELSE} |
3434 | 1075 |
if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize; |
1076 |
if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
|
1077 |
if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
|
1078 |
if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; |
|
3463 | 1079 |
{$ENDIF} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1080 |
prevPoint:= CursorPoint; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1081 |
if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1082 |
exit |
3680 | 1083 |
end; |
162 | 1084 |
|
4 | 1085 |
if isCursorVisible then |
3680 | 1086 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1087 |
if (not CurrentTeam^.ExtDriven) and (GameTicks >= PrevSentPointTime + cSendCursorPosTime) then |
3680 | 1088 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1089 |
SendIPCXY('P', CursorPoint.X - WorldDx, cScreenHeight - CursorPoint.Y - WorldDy); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1090 |
PrevSentPointTime:= GameTicks |
3680 | 1091 |
end; |
1092 |
EdgesDist:= cCursorEdgesDist |
|
1093 |
end |
|
1094 |
else |
|
1095 |
EdgesDist:= cGearScrEdgesDist; |
|
1096 |
||
1097 |
// this generates the border around the screen that moves the camera when cursor is near it |
|
1098 |
if isCursorVisible or (FollowGear <> nil) then |
|
1099 |
begin |
|
1100 |
if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
|
1101 |
begin |
|
1102 |
WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
|
1103 |
CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |
|
1104 |
end |
|
1105 |
else |
|
1106 |
if CursorPoint.X > cScreenWidth div 2 - EdgesDist then |
|
1107 |
begin |
|
1108 |
WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist; |
|
1109 |
CursorPoint.X:= cScreenWidth div 2 - EdgesDist |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1110 |
end; |
3680 | 1111 |
if CursorPoint.Y < EdgesDist then |
1112 |
begin |
|
1113 |
WorldDy:= WorldDy + CursorPoint.Y - EdgesDist; |
|
1114 |
CursorPoint.Y:= EdgesDist |
|
1115 |
end |
|
1116 |
else |
|
1117 |
if CursorPoint.Y > cScreenHeight - EdgesDist then |
|
1118 |
begin |
|
1119 |
WorldDy:= WorldDy + CursorPoint.Y - cScreenHeight + EdgesDist; |
|
1120 |
CursorPoint.Y:= cScreenHeight - EdgesDist |
|
1121 |
end; |
|
1122 |
end |
|
1123 |
else |
|
1124 |
if cHasFocus then |
|
1125 |
begin |
|
1126 |
WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
|
1127 |
WorldDy:= WorldDy + CursorPoint.Y - prevPoint.Y; |
|
1128 |
CursorPoint.X:= 0; |
|
1129 |
CursorPoint.Y:= cScreenHeight div 2; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1130 |
end; |
351 | 1131 |
|
3680 | 1132 |
// this moves the camera according to CursorPoint X and Y |
4 | 1133 |
prevPoint:= CursorPoint; |
2567 | 1134 |
if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); |
1760 | 1135 |
if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024; |
2375 | 1136 |
if WorldDy < wdy then WorldDy:= wdy; |
2426 | 1137 |
if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024; |
1138 |
if WorldDx > 1024 then WorldDx:= 1024; |
|
4 | 1139 |
end; |
1140 |
||
2905 | 1141 |
procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
2786 | 1142 |
var r: TSDL_Rect; |
1143 |
begin |
|
1144 |
r.w:= 32; |
|
1145 |
r.h:= 32; |
|
1146 |
||
1147 |
if time = 0 then time:= 5000; |
|
1148 |
missionTimer:= time; |
|
3697 | 1149 |
if missionTex <> nil then |
3513
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1150 |
FreeTexture(missionTex); |
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3483
diff
changeset
|
1151 |
missionTex:= nil; |
2786 | 1152 |
|
1153 |
if icon > -1 then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1154 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1155 |
r.x:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1156 |
r.y:= icon * 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1157 |
missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, MissionIcons, @r) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1158 |
end |
2786 | 1159 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1160 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1161 |
r.x:= ((-icon - 1) shr 5) * 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1162 |
r.y:= ((-icon - 1) mod 32) * 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1163 |
missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, SpritesData[sprAMAmmos].Surface, @r) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1164 |
end; |
2786 | 1165 |
end; |
1166 |
||
1167 |
procedure HideMission; |
|
1168 |
begin |
|
3045 | 1169 |
missionTimer:= 0; |
1170 |
if missionTex <> nil then FreeTexture(missionTex); |
|
2786 | 1171 |
end; |
1172 |
||
3032 | 1173 |
procedure ShakeCamera(amount: LongWord); |
1174 |
begin |
|
1175 |
amount:= max(1, amount); |
|
1176 |
WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2)); |
|
1177 |
WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2)); |
|
1178 |
end; |
|
1179 |
||
3038 | 1180 |
procedure initModule; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
1181 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1182 |
fpsTexture:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1183 |
FollowGear:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1184 |
WindBarWidth:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1185 |
bShowAmmoMenu:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1186 |
bSelected:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1187 |
bShowFinger:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1188 |
Frames:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1189 |
WorldDx:= -512; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1190 |
WorldDy:= -256; |
3697 | 1191 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1192 |
FPS:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1193 |
CountTicks:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1194 |
SoundTimerTicks:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1195 |
prevPoint.X:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1196 |
prevPoint.Y:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1197 |
missionTimer:= 0; |
3240 | 1198 |
missionTex:= nil; |
3463 | 1199 |
cOffsetY:= 0; |
3697 | 1200 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1201 |
FillChar(Captions, sizeof(Captions), 0) |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
1202 |
end; |
4 | 1203 |
|
3038 | 1204 |
procedure freeModule; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
1205 |
begin |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
1206 |
end; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
1207 |
|
4 | 1208 |
end. |