author | smaxx |
Wed, 18 Aug 2010 20:29:41 +0200 | |
branch | experimental3D |
changeset 3696 | 6009d8378422 |
parent 3692 | bbec1275e46f |
child 4004 | b1c2c2f6fc5e |
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 |
|
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
|
23 |
uses SDLh, uGears, uConsts, uFloat, uRandom; |
2630 | 24 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
25 |
var FollowGear: PGear; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
26 |
WindBarWidth: LongInt; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
27 |
bShowAmmoMenu: boolean; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
28 |
bSelected: boolean; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
29 |
bShowFinger: boolean; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
30 |
Frames: Longword; |
3696 | 31 |
AFRToggle: Boolean; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
32 |
WaterColor, DeepWaterColor: TSDL_Color; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
33 |
WorldDx: LongInt; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
34 |
WorldDy: LongInt; |
3248 | 35 |
SkyOffset: LongInt; |
36 |
HorizontOffset: LongInt; |
|
3696 | 37 |
bAFRRight: Boolean; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
38 |
{$IFDEF COUNTTICKS} |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
39 |
cntTicks: LongWord; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
40 |
{$ENDIF} |
3463 | 41 |
cOffsetY: LongInt; |
3405 | 42 |
|
3038 | 43 |
procedure initModule; |
44 |
procedure freeModule; |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
45 |
|
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
46 |
procedure InitWorld; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
47 |
procedure DrawWorld(Lag: LongInt); |
3692 | 48 |
procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
2905 | 49 |
procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); |
50 |
procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
|
2786 | 51 |
procedure HideMission; |
3032 | 52 |
procedure ShakeCamera(amount: LongWord); |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3629
diff
changeset
|
53 |
procedure MoveCamera; |
4 | 54 |
|
55 |
implementation |
|
3407 | 56 |
uses uStore, uMisc, uTeams, uIO, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit; |
1807 | 57 |
|
4 | 58 |
type TCaptionStr = record |
762 | 59 |
Tex: PTexture; |
4 | 60 |
EndTime: LongWord; |
61 |
end; |
|
62 |
||
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
63 |
var cWaveWidth, cWaveHeight: LongInt; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
64 |
Captions: array[TCapGroup] of TCaptionStr; |
3434 | 65 |
AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
66 |
tmpSurface: PSDL_Surface; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
67 |
fpsTexture: PTexture; |
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
68 |
timeTexture: PTexture; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
69 |
FPS: Longword; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
70 |
CountTicks: Longword; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
71 |
SoundTimerTicks: Longword; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
72 |
prevPoint: TPoint; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
73 |
amSel: TAmmoType = amNothing; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
74 |
missionTex: PTexture; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
75 |
missionTimer: LongInt; |
3692 | 76 |
stereoDepth: GLfloat = 0; |
77 |
||
78 |
const cStereo_Sky = 0.0750; |
|
79 |
cStereo_Horizon = 0.0250; |
|
80 |
cStereo_Water = 0.0125; |
|
4 | 81 |
|
82 |
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
|
83 |
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
|
84 |
cp: PClan; |
2863 | 85 |
g: ansistring; |
86 |
||
2904 | 87 |
// helper functions to create the goal/game mode string |
2908 | 88 |
function AddGoal(s: ansistring; gf: longword; si: TGoalStrId; i: LongInt): ansistring; |
2905 | 89 |
var t: ansistring; |
2904 | 90 |
begin |
91 |
if (GameFlags and gf) <> 0 then |
|
92 |
begin |
|
93 |
t:= inttostr(i); |
|
94 |
s:= s + format(trgoal[si], t) + '|' |
|
95 |
end; |
|
96 |
AddGoal:= s; |
|
97 |
end; |
|
98 |
||
2908 | 99 |
function AddGoal(s: ansistring; gf: longword; si: TGoalStrId): ansistring; |
2863 | 100 |
begin |
2904 | 101 |
if (GameFlags and gf) <> 0 then |
102 |
s:= s + trgoal[si] + '|'; |
|
2863 | 103 |
AddGoal:= s; |
104 |
end; |
|
4 | 105 |
begin |
3405 | 106 |
missionTimer:= 0; |
2786 | 107 |
|
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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
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
|
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 |
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
|
116 |
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
|
117 |
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
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
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
|
122 |
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
|
123 |
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
|
124 |
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
|
125 |
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
|
126 |
|
2908 | 127 |
// if special game flags/settings are changed, add them to the game mode notice window and then show it |
2863 | 128 |
g:= ''; // no text/things to note yet |
2908 | 129 |
|
2958 | 130 |
// check different game flags (goals/game modes first for now) |
131 |
g:= AddGoal(g, gfKing, gidKing); // king? |
|
132 |
||
133 |
// other important flags |
|
134 |
g:= AddGoal(g, gfForts, gidForts); // forts? |
|
135 |
g:= AddGoal(g, gfLowGravity, gidLowGravity); // low gravity? |
|
136 |
g:= AddGoal(g, gfInvulnerable, gidInvulnerable); // invulnerability? |
|
137 |
g:= AddGoal(g, gfVampiric, gidVampiric); // vampirism? |
|
138 |
g:= AddGoal(g, gfKarma, gidKarma); // karma? |
|
139 |
g:= AddGoal(g, gfPlaceHog, gidPlaceHog); // placement? |
|
140 |
g:= AddGoal(g, gfArtillery, gidArtillery); // artillery? |
|
141 |
g:= AddGoal(g, gfSolidLand, gidSolidLand); // solid land? |
|
142 |
g:= AddGoal(g, gfSharedAmmo, gidSharedAmmo); // shared ammo? |
|
143 |
||
2908 | 144 |
// modified damage modificator? |
145 |
if cDamagePercent <> 100 then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
146 |
g:= AddGoal(g, gfAny, gidDamageModifier, cDamagePercent); |
2908 | 147 |
|
3107 | 148 |
// fade in |
149 |
ScreenFade:= sfFromBlack; |
|
150 |
ScreenFadeValue:= sfMax; |
|
151 |
ScreenFadeSpeed:= 1; |
|
152 |
||
2908 | 153 |
// modified mine timers? |
154 |
if cMinesTime <> 3000 then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
155 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
156 |
if cMinesTime = 0 then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
157 |
g:= AddGoal(g, gfMines, gidNoMineTimer) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
158 |
else if cMinesTime < 0 then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
159 |
g:= AddGoal(g, gfMines, gidRandomMineTimer) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
160 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
161 |
g:= AddGoal(g, gfMines, gidMineTimer, cMinesTime div 1000); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
162 |
end; |
2908 | 163 |
|
2863 | 164 |
// if the string has been set, show it for (default timeframe) seconds |
165 |
if g <> '' then ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0); |
|
166 |
||
1825 | 167 |
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
|
168 |
//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
|
169 |
cWaveHeight:= 32; |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
170 |
|
284 | 171 |
cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); |
74 | 172 |
SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); |
2197 | 173 |
prevPoint.X:= 0; |
74 | 174 |
prevPoint.Y:= cScreenHeight div 2; |
1760 | 175 |
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
|
176 |
WorldDy:= - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); |
3434 | 177 |
AMSlotSize:= 33; |
178 |
{$IFDEF IPHONEOS} |
|
179 |
AMxOffset:= 10; |
|
3464 | 180 |
AMyOffset:= 10 + 123; // moved downwards |
3434 | 181 |
AMWidth:= (cMaxSlotAmmoIndex + 1) * AMSlotSize + AMxOffset; |
182 |
{$ELSE} |
|
183 |
AMxOffset:= 10; |
|
184 |
AMyOffset:= 60; |
|
185 |
AMWidth:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset; |
|
186 |
{$ENDIF} |
|
187 |
AMxShift:= AMWidth; |
|
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
188 |
SkyOffset:= 0; |
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
189 |
HorizontOffset:= 0; |
161 | 190 |
end; |
191 |
||
3405 | 192 |
|
956 | 193 |
procedure ShowAmmoMenu; |
161 | 194 |
const MENUSPEED = 15; |
3434 | 195 |
const BORDERSIZE = 2; |
196 |
var x, y, i, t, g: LongInt; |
|
197 |
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
|
198 |
Ammo: PHHAmmo; |
161 | 199 |
begin |
3434 | 200 |
if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then bShowAmmoMenu:= false; |
201 |
if bShowAmmoMenu then |
|
202 |
begin |
|
203 |
FollowGear:= nil; |
|
204 |
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
|
205 |
if (cReducedQuality and rqSlowMenu) <> 0 then |
3434 | 206 |
AMxShift:= 0 |
207 |
else |
|
208 |
if AMxShift > MENUSPEED then |
|
209 |
dec(AMxShift, MENUSPEED) |
|
210 |
else |
|
211 |
AMxShift:= 0; |
|
212 |
end else |
|
213 |
begin |
|
214 |
if AMxShift = 0 then |
|
215 |
begin |
|
216 |
CursorPoint.X:= cScreenWidth shr 1; |
|
217 |
CursorPoint.Y:= cScreenHeight shr 1; |
|
218 |
prevPoint:= CursorPoint; |
|
219 |
SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y) |
|
220 |
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
|
221 |
if (cReducedQuality and rqSlowMenu) <> 0 then |
3434 | 222 |
AMxShift:= AMWidth |
223 |
else |
|
224 |
if AMxShift < (AMWidth - MENUSPEED) then |
|
225 |
inc(AMxShift, MENUSPEED) |
|
226 |
else |
|
227 |
AMxShift:= AMWidth; |
|
228 |
end; |
|
229 |
Ammo:= nil; |
|
230 |
if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then |
|
231 |
Ammo:= CurrentHedgehog^.Ammo |
|
232 |
else if (LocalAmmo <> -1) then |
|
233 |
Ammo:= GetAmmoByNum(LocalAmmo); |
|
234 |
Pos:= -1; |
|
235 |
if Ammo = nil then |
|
2971 | 236 |
begin |
3434 | 237 |
bShowAmmoMenu:= false; |
238 |
exit |
|
2971 | 239 |
end; |
3434 | 240 |
SlotsNum:= 0; |
241 |
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
|
242 |
|
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
|
243 |
{$IFDEF IPHONEOS} |
3434 | 244 |
Slot:= cMaxSlotIndex; |
3463 | 245 |
x:= x - cOffsetY; |
3464 | 246 |
y:= AMyOffset; |
3434 | 247 |
dec(y, BORDERSIZE); |
248 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
|
249 |
for i:= 0 to cMaxSlotAmmoIndex do |
|
250 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
|
251 |
DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
|
252 |
inc(y, BORDERSIZE); |
|
253 |
||
254 |
for i:= 0 to cMaxSlotIndex do |
|
255 |
if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
|
256 |
begin |
|
257 |
if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y < y + AMSlotSize) then Slot:= i; |
|
258 |
inc(SlotsNum); |
|
259 |
DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
260 |
t:= 0; |
|
261 |
g:= 0; |
|
262 |
while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
|
263 |
begin |
|
264 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
265 |
if (Ammo^[i, t].AmmoType <> amNothing) then |
|
266 |
begin |
|
267 |
STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
|
268 |
||
269 |
if STurns >= 0 then |
|
270 |
begin |
|
271 |
DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
272 |
if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
|
273 |
end else |
|
274 |
DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
275 |
if (Slot = i) |
|
276 |
and (CursorPoint.X >= x + g * AMSlotSize) |
|
277 |
and (CursorPoint.X < x + (g + 1) * AMSlotSize) then |
|
278 |
begin |
|
279 |
if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
|
280 |
Pos:= t; |
|
281 |
end; |
|
282 |
inc(g) |
|
283 |
end; |
|
284 |
inc(t) |
|
285 |
end; |
|
286 |
for g:= g to cMaxSlotAmmoIndex do |
|
287 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
288 |
DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
|
289 |
inc(y, AMSlotSize); |
|
290 |
end; |
|
291 |
||
292 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
|
293 |
for i:= 0 to cMaxSlotAmmoIndex do |
|
294 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
|
295 |
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
|
296 |
{$ELSE} |
3434 | 297 |
Slot:= 0; |
298 |
y:= cScreenHeight - AMyOffset; |
|
299 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
|
300 |
for i:= 0 to cMaxSlotAmmoIndex + 1 do |
|
301 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
|
302 |
DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); |
|
303 |
dec(y, AMSlotSize); |
|
304 |
DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
305 |
for i:= 0 to cMaxSlotAmmoIndex do |
|
306 |
DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); |
|
307 |
DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1); |
|
308 |
DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
|
309 |
||
310 |
for i:= cMaxSlotIndex downto 0 do |
|
311 |
if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
|
312 |
begin |
|
313 |
if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y < y) then Slot:= i; |
|
314 |
dec(y, AMSlotSize); |
|
315 |
inc(SlotsNum); |
|
316 |
DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
|
317 |
DrawSprite(sprAMSlot, x, y, 1); |
|
318 |
DrawSprite(sprAMSlotKeys, x, y + 1, i); |
|
319 |
t:= 0; |
|
320 |
g:= 1; |
|
321 |
while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
|
322 |
begin |
|
323 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
324 |
if (Ammo^[i, t].AmmoType <> amNothing) then |
|
325 |
begin |
|
326 |
STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
|
327 |
||
328 |
if STurns >= 0 then |
|
329 |
begin |
|
330 |
DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
331 |
if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
|
332 |
end else |
|
333 |
DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
|
334 |
if (Slot = i) |
|
335 |
and (CursorPoint.X >= x + g * AMSlotSize) |
|
336 |
and (CursorPoint.X < x + (g + 1) * AMSlotSize) then |
|
337 |
begin |
|
338 |
if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
|
339 |
Pos:= t; |
|
340 |
end; |
|
341 |
inc(g) |
|
342 |
end; |
|
343 |
inc(t) |
|
344 |
end; |
|
345 |
for g:= g to cMaxSlotAmmoIndex + 1 do |
|
346 |
DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
|
347 |
DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
|
348 |
end; |
|
349 |
||
350 |
dec(y, BORDERSIZE); |
|
351 |
DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
|
352 |
for i:= 0 to cMaxSlotAmmoIndex + 1 do |
|
353 |
DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
|
354 |
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
|
355 |
{$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
|
356 |
|
3434 | 357 |
if (Pos >= 0) then |
358 |
begin |
|
359 |
if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
|
360 |
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
|
361 |
begin |
3434 | 362 |
amSel:= Ammo^[Slot, Pos].AmmoType; |
363 |
RenderWeaponTooltip(amSel) |
|
364 |
end; |
|
365 |
||
3629
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
366 |
{$IFDEF IPHONEOS} |
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
367 |
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
|
368 |
|
86212d2b116a
redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu
koda
parents:
3611
diff
changeset
|
369 |
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
|
370 |
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
|
371 |
{$ELSE} |
3434 | 372 |
DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
3405 | 373 |
|
3434 | 374 |
if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
375 |
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
|
376 |
{$ENDIF} |
1529
3bc916b419cd
Don't hide ammo menu when user clicks on not yet available weapon
unc0rr
parents:
1439
diff
changeset
|
377 |
|
3434 | 378 |
if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
379 |
begin |
|
380 |
bShowAmmoMenu:= false; |
|
381 |
SetWeapon(Ammo^[Slot, Pos].AmmoType); |
|
382 |
bSelected:= false; |
|
383 |
FreeWeaponTooltip; |
|
384 |
exit |
|
3405 | 385 |
end; |
3434 | 386 |
end |
387 |
else |
|
388 |
FreeWeaponTooltip; |
|
3663
8c28abf427f5
reduce the number of keywords used and switch to BMP format for screenshots
koda
parents:
3641
diff
changeset
|
389 |
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
|
390 |
{$IFDEF IPHONEOS} |
3434 | 391 |
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
|
392 |
{$ELSE} |
3434 | 393 |
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
|
394 |
{$ENDIF} |
961
a9a349b2b3fa
Use turnsleft sprites to indicate turns left to activate ammo
unc0rr
parents:
956
diff
changeset
|
395 |
|
3434 | 396 |
bSelected:= false; |
397 |
if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
|
4 | 398 |
end; |
399 |
||
3104 | 400 |
procedure DrawWater(Alpha: byte; OffsetY: LongInt); |
1915 | 401 |
var VertexBuffer: array [0..3] of TVertex2f; |
402 |
r: TSDL_Rect; |
|
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
403 |
lw, lh: GLfloat; |
1915 | 404 |
begin |
3405 | 405 |
WaterColorArray[0].a := Alpha; |
406 |
WaterColorArray[1].a := Alpha; |
|
407 |
WaterColorArray[2].a := Alpha; |
|
408 |
WaterColorArray[3].a := Alpha; |
|
2269
00f5704f5f39
add extra semi-opaque layer of water to discolour objects in the water.
nemo
parents:
2268
diff
changeset
|
409 |
|
3463 | 410 |
lw:= cScreenWidth / cScaleFactor; |
411 |
lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16; |
|
3405 | 412 |
|
413 |
// Water |
|
414 |
r.y:= OffsetY + WorldDy + cWaterLine; |
|
3463 | 415 |
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
|
416 |
begin |
3405 | 417 |
if r.y < 0 then |
418 |
r.y:= 0; |
|
1915 | 419 |
|
3405 | 420 |
glDisable(GL_TEXTURE_2D); |
421 |
VertexBuffer[0].X:= -lw; |
|
422 |
VertexBuffer[0].Y:= r.y; |
|
423 |
VertexBuffer[1].X:= lw; |
|
424 |
VertexBuffer[1].Y:= r.y; |
|
425 |
VertexBuffer[2].X:= lw; |
|
426 |
VertexBuffer[2].Y:= lh; |
|
427 |
VertexBuffer[3].X:= -lw; |
|
428 |
VertexBuffer[3].Y:= lh; |
|
1915 | 429 |
|
3641 | 430 |
glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
431 |
glEnableClientState(GL_COLOR_ARRAY); |
|
3405 | 432 |
glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]); |
1915 | 433 |
|
3405 | 434 |
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
|
435 |
|
3405 | 436 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1915 | 437 |
|
3405 | 438 |
glDisableClientState(GL_COLOR_ARRAY); |
3641 | 439 |
glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
3407 | 440 |
glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
3405 | 441 |
glEnable(GL_TEXTURE_2D); |
442 |
end; |
|
1915 | 443 |
end; |
444 |
||
3376 | 445 |
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
|
446 |
var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
447 |
lw, waves, shift: GLfloat; |
2288 | 448 |
begin |
3463 | 449 |
lw:= cScreenWidth / cScaleFactor; |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
450 |
waves:= lw * 2 / cWaveWidth; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
451 |
|
3407 | 452 |
Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt, |
453 |
LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt, |
|
454 |
LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt, |
|
455 |
255 |
|
3089 | 456 |
); |
457 |
||
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
458 |
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
|
459 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
460 |
VertexBuffer[0].X:= -lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
461 |
VertexBuffer[0].Y:= cWaterLine + WorldDy + dY; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
462 |
VertexBuffer[1].X:= lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
463 |
VertexBuffer[1].Y:= VertexBuffer[0].Y; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
464 |
VertexBuffer[2].X:= lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
465 |
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
|
466 |
VertexBuffer[3].X:= -lw; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
467 |
VertexBuffer[3].Y:= VertexBuffer[2].Y; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
468 |
|
2374 | 469 |
shift:= - lw / cWaveWidth; |
2495 | 470 |
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
|
471 |
TextureBuffer[0].Y:= 0; |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
472 |
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
|
473 |
TextureBuffer[1].Y:= TextureBuffer[0].Y; |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2434
diff
changeset
|
474 |
TextureBuffer[2].X:= TextureBuffer[1].X; |
2553 | 475 |
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
|
476 |
TextureBuffer[3].X:= TextureBuffer[0].X; |
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2434
diff
changeset
|
477 |
TextureBuffer[3].Y:= TextureBuffer[2].Y; |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
478 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
479 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
480 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
481 |
glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
482 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
483 |
|
3390 | 484 |
Tint($FF, $FF, $FF, $FF); |
2292
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
485 |
|
87af4ad0ec98
New waves rendering procedure based on using texture coodrinates > 1.0
unc0rr
parents:
2290
diff
changeset
|
486 |
{for i:= -1 to cWaterSprCount do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
487 |
DrawSprite(sprWater, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
488 |
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
|
489 |
cWaterLine + WorldDy + dY, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
490 |
0)} |
2288 | 491 |
end; |
492 |
||
3089 | 493 |
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
|
494 |
var i, w, h, lw, lh, rw, rh, sw: LongInt; |
2426 | 495 |
begin |
3405 | 496 |
sw:= round(cScreenWidth / cScaleFactor); |
497 |
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
|
498 |
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
|
499 |
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
|
500 |
h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; |
3405 | 501 |
i:= Shift mod w; |
502 |
if i > 0 then dec(i, w); |
|
503 |
dec(i, w * (sw div w + 1)); |
|
504 |
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
|
505 |
DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
3405 | 506 |
inc(i, w) |
507 |
until i > sw |
|
508 |
end |
|
509 |
else |
|
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; |
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
|
513 |
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
|
514 |
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
|
515 |
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
|
516 |
rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale; |
3405 | 517 |
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
|
518 |
DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
519 |
|
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
|
520 |
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
|
521 |
while i >= -sw - lw do |
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 |
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
|
524 |
dec(i, lw); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
525 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
526 |
|
3405 | 527 |
i:= Shift + w; |
528 |
while i <= sw do |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
529 |
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
|
530 |
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
|
531 |
inc(i, rw) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
532 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
533 |
end |
2426 | 534 |
end; |
535 |
||
536 |
||
956 | 537 |
procedure DrawWorld(Lag: LongInt); |
3692 | 538 |
var cc: array[0..3] of GLfloat; |
4 | 539 |
begin |
3523 | 540 |
if not isPaused then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
541 |
begin |
3523 | 542 |
if ZoomValue < zoom then |
3444 | 543 |
begin |
3523 | 544 |
zoom:= zoom - 0.002 * Lag; |
545 |
if ZoomValue > zoom then |
|
546 |
zoom:= ZoomValue |
|
547 |
end |
|
548 |
else |
|
549 |
if ZoomValue > zoom then |
|
3444 | 550 |
begin |
3523 | 551 |
zoom:= zoom + 0.002 * Lag; |
552 |
if ZoomValue < zoom then |
|
553 |
zoom:= ZoomValue |
|
3611 | 554 |
end |
3444 | 555 |
end |
3611 | 556 |
else |
557 |
ZoomValue:= zoom; |
|
2376 | 558 |
|
3611 | 559 |
// Sky |
560 |
glClear(GL_COLOR_BUFFER_BIT); |
|
561 |
//glPushMatrix; |
|
562 |
//glScalef(1.0, 1.0, 1.0); |
|
756 | 563 |
|
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
|
564 |
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
|
565 |
MoveCamera; |
162 | 566 |
|
3696 | 567 |
if cStereoMode = smNone then |
568 |
begin |
|
3692 | 569 |
glClear(GL_COLOR_BUFFER_BIT); |
570 |
DrawWorldStereo(Lag, rmDefault) |
|
3696 | 571 |
end |
572 |
else if (cStereoMode = smAFR) then |
|
573 |
begin |
|
574 |
AFRToggle:= not AFRToggle; |
|
575 |
glClear(GL_COLOR_BUFFER_BIT); |
|
576 |
if AFRToggle then |
|
577 |
DrawWorldStereo(Lag, rmLeftEye) |
|
578 |
else |
|
579 |
DrawWorldStereo(Lag, rmRightEye) |
|
580 |
end |
|
581 |
else if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) then |
|
582 |
begin |
|
3692 | 583 |
// create left fb |
584 |
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framel); |
|
585 |
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); |
|
586 |
DrawWorldStereo(Lag, rmLeftEye); |
|
587 |
||
588 |
// create right fb |
|
589 |
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framer); |
|
590 |
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); |
|
591 |
DrawWorldStereo(0, rmRightEye); |
|
592 |
||
593 |
// detatch drawing from fbs |
|
594 |
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
|
595 |
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); |
|
596 |
SetScale(cDefaultZoomLevel); |
|
597 |
||
598 |
// draw left frame |
|
599 |
glBindTexture(GL_TEXTURE_2D, texl); |
|
600 |
glBegin(GL_QUADS); |
|
3696 | 601 |
if cStereoMode = smHorizontal then |
602 |
begin |
|
603 |
glTexCoord2f(0.0, 0.0); |
|
604 |
glVertex2d(cScreenWidth / -2, cScreenHeight); |
|
605 |
glTexCoord2f(1.0, 0.0); |
|
606 |
glVertex2d(0, cScreenHeight); |
|
607 |
glTexCoord2f(1.0, 1.0); |
|
608 |
glVertex2d(0, 0); |
|
609 |
glTexCoord2f(0.0, 1.0); |
|
610 |
glVertex2d(cScreenWidth / -2, 0); |
|
611 |
end |
|
612 |
else |
|
613 |
begin |
|
614 |
glTexCoord2f(0.0, 0.0); |
|
615 |
glVertex2d(cScreenWidth / -2, cScreenHeight / 2); |
|
616 |
glTexCoord2f(1.0, 0.0); |
|
617 |
glVertex2d(cScreenWidth / 2, cScreenHeight / 2); |
|
618 |
glTexCoord2f(1.0, 1.0); |
|
619 |
glVertex2d(cScreenWidth / 2, 0); |
|
620 |
glTexCoord2f(0.0, 1.0); |
|
621 |
glVertex2d(cScreenWidth / -2, 0); |
|
622 |
end; |
|
3692 | 623 |
glEnd(); |
624 |
||
625 |
// draw right frame |
|
626 |
glBindTexture(GL_TEXTURE_2D, texr); |
|
627 |
glBegin(GL_QUADS); |
|
3696 | 628 |
if cStereoMode = smHorizontal then |
629 |
begin |
|
630 |
glTexCoord2f(0.0, 0.0); |
|
631 |
glVertex2d(0, cScreenHeight); |
|
632 |
glTexCoord2f(1.0, 0.0); |
|
633 |
glVertex2d(cScreenWidth / 2, cScreenHeight); |
|
634 |
glTexCoord2f(1.0, 1.0); |
|
635 |
glVertex2d(cScreenWidth / 2, 0); |
|
636 |
glTexCoord2f(0.0, 1.0); |
|
637 |
glVertex2d(0, 0); |
|
638 |
end |
|
639 |
else |
|
640 |
begin |
|
641 |
glTexCoord2f(0.0, 0.0); |
|
642 |
glVertex2d(cScreenWidth / -2, cScreenHeight); |
|
643 |
glTexCoord2f(1.0, 0.0); |
|
644 |
glVertex2d(cScreenWidth / 2, cScreenHeight); |
|
645 |
glTexCoord2f(1.0, 1.0); |
|
646 |
glVertex2d(cScreenWidth / 2, cScreenHeight / 2); |
|
647 |
glTexCoord2f(0.0, 1.0); |
|
648 |
glVertex2d(cScreenWidth / -2, cScreenHeight / 2); |
|
649 |
end; |
|
3692 | 650 |
glEnd(); |
651 |
SetScale(zoom); |
|
3696 | 652 |
end |
653 |
else |
|
654 |
begin |
|
655 |
// clear scene |
|
656 |
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
|
657 |
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); |
|
658 |
// draw left eye in red channel only |
|
659 |
if cStereoMode = smGreenRed then |
|
660 |
glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE) |
|
661 |
else if cStereoMode = smBlueRed then |
|
662 |
glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE) |
|
663 |
else if cStereoMode = smCyanRed then |
|
664 |
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE) |
|
665 |
else |
|
666 |
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE); |
|
667 |
DrawWorldStereo(Lag, rmLeftEye); |
|
668 |
// draw right eye in selected channel(s) only |
|
669 |
if cStereoMode = smRedGreen then |
|
670 |
glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE) |
|
671 |
else if cStereoMode = smRedBlue then |
|
672 |
glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE) |
|
673 |
else if cStereoMode = smRedCyan then |
|
674 |
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE) |
|
675 |
else |
|
676 |
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE); |
|
677 |
DrawWorldStereo(Lag, rmRightEye); |
|
678 |
end |
|
3692 | 679 |
end; |
680 |
||
681 |
procedure ChangeDepth(rm: TRenderMode; d: GLfloat); |
|
682 |
begin |
|
3696 | 683 |
d:= d / 5; |
3692 | 684 |
if rm = rmDefault then exit |
3696 | 685 |
else if rm = rmLeftEye then d:= -d; |
3692 | 686 |
stereoDepth:= stereoDepth + d; |
687 |
glMatrixMode(GL_PROJECTION); |
|
688 |
glTranslatef(d, 0, 0); |
|
689 |
glMatrixMode(GL_MODELVIEW) |
|
690 |
end; |
|
691 |
||
692 |
procedure ResetDepth(rm: TRenderMode); |
|
693 |
begin |
|
694 |
if rm = rmDefault then exit; |
|
695 |
glMatrixMode(GL_PROJECTION); |
|
696 |
glTranslatef(-stereoDepth, 0, 0); |
|
697 |
glMatrixMode(GL_MODELVIEW); |
|
698 |
stereoDepth:= 0; |
|
699 |
end; |
|
700 |
||
701 |
procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
|
702 |
var i, t: LongInt; |
|
703 |
r: TSDL_Rect; |
|
704 |
tdx, tdy: Double; |
|
705 |
grp: TCapGroup; |
|
706 |
s: string[15]; |
|
707 |
highlight: Boolean; |
|
708 |
offset, offsetX, offsetY, screenBottom: LongInt; |
|
709 |
scale: GLfloat; |
|
710 |
VertexBuffer: array [0..3] of TVertex2f; |
|
711 |
begin |
|
3611 | 712 |
if (cReducedQuality and rqNoBackground) = 0 then |
1812 | 713 |
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
|
714 |
// 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
|
715 |
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
|
716 |
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
|
717 |
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
|
718 |
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
|
719 |
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
|
720 |
HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
721 |
|
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
|
722 |
// background |
3688 | 723 |
ChangeDepth(RM, cStereo_Sky); |
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
|
724 |
DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); |
3688 | 725 |
ChangeDepth(RM, -cStereo_Horizon); |
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
|
726 |
DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
3611 | 727 |
end; |
4 | 728 |
|
3611 | 729 |
DrawVisualGears(0); |
730 |
||
731 |
if (cReducedQuality and rq2DWater) = 0 then |
|
732 |
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
|
733 |
// Waves |
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
|
734 |
DrawWater(255, SkyOffset); |
3688 | 735 |
ChangeDepth(RM, -cStereo_Water); |
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
|
736 |
DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64); |
3688 | 737 |
ChangeDepth(RM, -cStereo_Water); |
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
|
738 |
DrawWaves( -1, 25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 48); |
3688 | 739 |
ChangeDepth(RM, -cStereo_Water); |
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
|
740 |
DrawWaves( 1, 75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32); |
3688 | 741 |
ChangeDepth(RM, -cStereo_Water); |
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
|
742 |
DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24); |
3688 | 743 |
ResetDepth(RM); |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
744 |
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
|
745 |
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
|
746 |
DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0); |
4 | 747 |
|
3611 | 748 |
DrawLand(WorldDx, WorldDy); |
1911 | 749 |
|
3611 | 750 |
DrawWater(255, 0); |
4 | 751 |
|
1660 | 752 |
// Attack bar |
3611 | 753 |
if CurrentTeam <> nil then |
754 |
case AttackBar of |
|
1660 | 755 |
(* 1: begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
756 |
r:= StuffPoz[sPowerBar]; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
757 |
{$WARNINGS OFF} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
758 |
r.w:= (CurrentHedgehog^.Gear^.Power * 256) div cPowerDivisor; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
759 |
{$WARNINGS ON} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
760 |
DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
761 |
end;*) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
762 |
2: with CurrentHedgehog^ do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
763 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
764 |
tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
765 |
tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
766 |
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
|
767 |
DrawSprite(sprPower, |
3580 | 768 |
hwRound(Gear^.X) + GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Gear^.dX), Gear^.Angle) + round(WorldDx + tdx * (24 + i * 2)) - 16, |
769 |
hwRound(Gear^.Y) + GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Gear^.Angle) + round(WorldDy + tdy * (24 + i * 2)) - 16, |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
770 |
i) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
771 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
772 |
end; |
1660 | 773 |
|
3611 | 774 |
DrawVisualGears(1); |
2713 | 775 |
|
3611 | 776 |
DrawGears; |
4 | 777 |
|
3611 | 778 |
DrawVisualGears(2); |
1045 | 779 |
|
3611 | 780 |
DrawWater(cWaterOpacity, 0); |
2269
00f5704f5f39
add extra semi-opaque layer of water to discolour objects in the water.
nemo
parents:
2268
diff
changeset
|
781 |
|
3611 | 782 |
// Waves |
3688 | 783 |
ChangeDepth(RM, cStereo_Water); |
3611 | 784 |
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
|
785 |
|
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
|
786 |
if (cReducedQuality and rq2DWater) = 0 then |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
787 |
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
|
788 |
//DrawWater(cWaterOpacity, - offsetY div 40); |
3688 | 789 |
ChangeDepth(RM, cStereo_Water); |
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
|
790 |
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
|
791 |
DrawWater(cWaterOpacity, - offsetY div 20); |
3688 | 792 |
ChangeDepth(RM, cStereo_Water); |
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
|
793 |
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
|
794 |
DrawWater(cWaterOpacity, - offsetY div 10); |
3688 | 795 |
ChangeDepth(RM, cStereo_Water); |
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
|
796 |
DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); |
3688 | 797 |
ResetDepth(RM); |
3265
5fe62296fdea
- Parallax effect for horizont when water is out of sight
palewolf
parents:
3249
diff
changeset
|
798 |
end |
3611 | 799 |
else |
800 |
DrawWaves(-1, 50, - (cWaveHeight shr 1), 0); |
|
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
801 |
|
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
802 |
|
2288 | 803 |
{$WARNINGS OFF} |
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
804 |
// Target |
3104 | 805 |
if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then |
806 |
begin |
|
807 |
with PHedgehog(CurrentHedgehog)^ do |
|
808 |
begin |
|
3110 | 809 |
if (Ammo^[CurSlot, CurAmmo].AmmoType = amBee) then |
810 |
DrawRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
|
811 |
else |
|
3104 | 812 |
DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
813 |
end; |
|
814 |
end; |
|
4 | 815 |
{$WARNINGS ON} |
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
816 |
|
3523 | 817 |
// this scale is used to keep the various widgets at the same dimension at all zoom levels |
818 |
SetScale(cDefaultZoomLevel); |
|
2724 | 819 |
|
820 |
||
821 |
// Turn time |
|
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
822 |
{$IFDEF IPHONEOS} |
3025 | 823 |
offsetX:= cScreenHeight - 13; |
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
824 |
{$ELSE} |
3025 | 825 |
offsetX:= 48; |
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
826 |
{$ENDIF} |
3463 | 827 |
offsetY:= cOffsetY; |
4 | 828 |
if TurnTimeLeft <> 0 then |
829 |
begin |
|
830 |
i:= Succ(Pred(TurnTimeLeft) div 1000); |
|
831 |
if i>99 then t:= 112 |
|
832 |
else if i>9 then t:= 96 |
|
833 |
else t:= 80; |
|
3463 | 834 |
DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
4 | 835 |
while i > 0 do |
836 |
begin |
|
837 |
dec(t, 32); |
|
3463 | 838 |
DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10); |
4 | 839 |
i:= i div 10 |
840 |
end; |
|
3463 | 841 |
DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
4 | 842 |
end; |
79 | 843 |
|
2567 | 844 |
{$IFNDEF IPHONEOS} |
2428 | 845 |
// Timetrial |
846 |
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
|
847 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
848 |
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
|
849 |
t:= 272; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
850 |
// right frame |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
851 |
DrawSprite(sprFrame, -cScreenWidth div 2 + t, 8, 1); |
2428 | 852 |
dec(t, 32); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
853 |
// 1 ms |
2428 | 854 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
855 |
dec(t, 32); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
856 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
857 |
// 10 ms |
2428 | 858 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
859 |
dec(t, 32); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
860 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
861 |
// 100 ms |
2428 | 862 |
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
|
863 |
dec(t, 16); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
864 |
// Point |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
865 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 11); |
2428 | 866 |
dec(t, 32); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
867 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
868 |
// 1 s |
2428 | 869 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
870 |
dec(t, 32); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
871 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
872 |
// 10s |
2428 | 873 |
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
|
874 |
dec(t, 16); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
875 |
// Point |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
876 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 10); |
2428 | 877 |
dec(t, 32); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
878 |
i:= i div 6; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
879 |
// 1 m |
2428 | 880 |
DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
881 |
dec(t, 32); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
882 |
i:= i div 10; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
883 |
// 10 m |
2428 | 884 |
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
|
885 |
// left frame |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
886 |
DrawSprite(sprFrame, -cScreenWidth div 2 + t - 4, 8, 0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
887 |
end; |
2567 | 888 |
{$ENDIF} |
889 |
||
4 | 890 |
// Captions |
2567 | 891 |
{$IFDEF IPHONEOS} |
2803
1f446fc5c8ec
allow to compile engine as library with HWLIBRARY symbol
koda
parents:
2786
diff
changeset
|
892 |
offset:= 40; |
2567 | 893 |
{$ELSE} |
2724 | 894 |
if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then offset:= 48 |
895 |
else offset:= 8; |
|
2567 | 896 |
{$ENDIF} |
2428 | 897 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
898 |
for grp:= Low(TCapGroup) to High(TCapGroup) do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
899 |
with Captions[grp] do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
900 |
if Tex <> nil then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
901 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
902 |
DrawCentered(0, offset, Tex); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
903 |
inc(offset, Tex^.h + 2); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
904 |
if EndTime <= RealTicks then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
905 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
906 |
FreeTexture(Tex); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
907 |
Tex:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
908 |
EndTime:= 0 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
909 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
910 |
end; |
4 | 911 |
|
47 | 912 |
// Teams Healths |
547 | 913 |
for t:= 0 to Pred(TeamsCount) do |
914 |
with TeamsArray[t]^ do |
|
47 | 915 |
begin |
2839 | 916 |
highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
917 |
||
2747 | 918 |
if highlight then |
3445 | 919 |
Tint(Clan^.Color); |
2839 | 920 |
|
921 |
// draw name |
|
922 |
DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex); |
|
923 |
||
924 |
// draw flag |
|
925 |
DrawTexture(-14, cScreenHeight + DrawHealthY, FlagTex); |
|
926 |
||
927 |
// draw health bar |
|
690 | 928 |
r.x:= 0; |
929 |
r.y:= 0; |
|
547 | 930 |
r.w:= 2 + TeamHealthBarWidth; |
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
931 |
r.h:= HealthTex^.h; |
2747 | 932 |
DrawFromRect(14, cScreenHeight + DrawHealthY, @r, HealthTex); |
690 | 933 |
|
2839 | 934 |
// draw health bar's right border |
83 | 935 |
inc(r.x, cTeamHealthWidth + 2); |
936 |
r.w:= 3; |
|
2839 | 937 |
DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex); |
938 |
// if highlighted, draw flag and other contents again to keep their colors |
|
939 |
// this approach should be faster than drawing all borders one by one tinted or not |
|
940 |
if highlight then |
|
941 |
begin |
|
3390 | 942 |
Tint($FF, $FF, $FF, $FF); |
690 | 943 |
|
2839 | 944 |
// draw name |
2747 | 945 |
r.x:= 2; |
946 |
r.y:= 2; |
|
2839 | 947 |
r.w:= NameTagTex^.w - 4; |
948 |
r.h:= NameTagTex^.h - 4; |
|
949 |
DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + 2, @r, NameTagTex); |
|
950 |
// draw flag |
|
2747 | 951 |
r.w:= 22; |
952 |
r.h:= 15; |
|
953 |
DrawFromRect(-12, cScreenHeight + DrawHealthY + 2, @r, FlagTex); |
|
2839 | 954 |
// draw health bar |
955 |
r.w:= TeamHealthBarWidth + 1; |
|
956 |
r.h:= HealthTex^.h - 4; |
|
957 |
DrawFromRect(16, cScreenHeight + DrawHealthY + 2, @r, HealthTex); |
|
2747 | 958 |
end; |
47 | 959 |
end; |
960 |
||
5 | 961 |
// Lag alert |
2567 | 962 |
if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
4 | 963 |
|
5 | 964 |
// Wind bar |
2567 | 965 |
{$IFDEF IPHONEOS} |
3405 | 966 |
offsetX:= cScreenHeight - 13; |
967 |
offsetY:= (cScreenWidth shr 1) + 74; |
|
2567 | 968 |
{$ELSE} |
3405 | 969 |
offsetX:= 30; |
970 |
offsetY:= 180; |
|
2567 | 971 |
{$ENDIF} |
3405 | 972 |
DrawSprite(sprWindBar, (cScreenWidth shr 1) - offsetY, cScreenHeight - offsetX, 0); |
973 |
if WindBarWidth > 0 then |
|
974 |
begin |
|
975 |
{$WARNINGS OFF} |
|
976 |
r.x:= 8 - (RealTicks shr 6) mod 8; |
|
977 |
{$WARNINGS ON} |
|
978 |
r.y:= 0; |
|
979 |
r.w:= WindBarWidth; |
|
980 |
r.h:= 13; |
|
981 |
DrawSpriteFromRect(sprWindR, r, (cScreenWidth shr 1) - offsetY + 77, cScreenHeight - offsetX + 2, 13, 0); |
|
982 |
end |
|
983 |
else |
|
984 |
if WindBarWidth < 0 then |
|
985 |
begin |
|
986 |
{$WARNINGS OFF} |
|
3407 | 987 |
r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8; |
3405 | 988 |
{$WARNINGS ON} |
989 |
r.y:= 0; |
|
990 |
r.w:= - WindBarWidth; |
|
991 |
r.h:= 13; |
|
992 |
DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
|
993 |
end; |
|
5 | 994 |
|
161 | 995 |
// AmmoMenu |
3434 | 996 |
if (AMxShift < AMWidth) or bShowAmmoMenu then ShowAmmoMenu; |
161 | 997 |
|
2287 | 998 |
// Cursor |
999 |
if isCursorVisible and bShowAmmoMenu then |
|
1000 |
DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
|
942 | 1001 |
|
2287 | 1002 |
DrawChat; |
4 | 1003 |
|
2567 | 1004 |
if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture); |
1005 |
if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture); |
|
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
244
diff
changeset
|
1006 |
|
3304 | 1007 |
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
|
1008 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1009 |
if missionTimer > 0 then dec(missionTimer, Lag); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1010 |
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
|
1011 |
if missionTex <> nil then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1012 |
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
|
1013 |
end; |
2786 | 1014 |
|
2724 | 1015 |
// fps |
1016 |
{$IFDEF IPHONEOS} |
|
3463 | 1017 |
offsetX:= 8; |
2724 | 1018 |
{$ELSE} |
3463 | 1019 |
offsetX:= 10; |
2724 | 1020 |
{$ENDIF} |
3463 | 1021 |
offsetY:= cOffsetY; |
3692 | 1022 |
|
1023 |
// don't increment fps when drawing the right frame |
|
3696 | 1024 |
if (RM = rmDefault) or (RM = rmRightEye) then |
3692 | 1025 |
begin |
1026 |
inc(Frames); |
|
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
1027 |
|
3692 | 1028 |
if cShowFPS or (GameType = gmtDemo) then |
1029 |
inc(CountTicks, Lag); |
|
1030 |
if (GameType = gmtDemo) and (CountTicks >= 1000) then |
|
1031 |
begin |
|
1032 |
i:=GameTicks div 1000; |
|
1033 |
t:= i mod 60; |
|
1034 |
s:= inttostr(t); |
|
1035 |
if t < 10 then s:= '0' + s; |
|
1036 |
i:= i div 60; |
|
1037 |
t:= i mod 60; |
|
1038 |
s:= inttostr(t) + ':' + s; |
|
1039 |
if t < 10 then s:= '0' + s; |
|
1040 |
s:= inttostr(i div 60) + ':' + s; |
|
3407 | 1041 |
|
3692 | 1042 |
if timeTexture <> nil then |
1043 |
FreeTexture(timeTexture); |
|
1044 |
timeTexture:= nil; |
|
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
|
1045 |
|
3692 | 1046 |
tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
1047 |
tmpSurface:= doSurfaceConversion(tmpSurface); |
|
1048 |
timeTexture:= Surface2Tex(tmpSurface, false); |
|
1049 |
SDL_FreeSurface(tmpSurface) |
|
1050 |
end; |
|
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
1051 |
|
3692 | 1052 |
if timeTexture <> nil then |
1053 |
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
|
1054 |
|
3692 | 1055 |
if cShowFPS then |
1056 |
begin |
|
1057 |
if CountTicks >= 1000 then |
|
1058 |
begin |
|
1059 |
FPS:= Frames; |
|
1060 |
Frames:= 0; |
|
1061 |
CountTicks:= 0; |
|
1062 |
s:= inttostr(FPS) + ' fps'; |
|
1063 |
if fpsTexture <> nil then |
|
1064 |
FreeTexture(fpsTexture); |
|
1065 |
fpsTexture:= nil; |
|
1066 |
tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
|
1067 |
tmpSurface:= doSurfaceConversion(tmpSurface); |
|
1068 |
fpsTexture:= Surface2Tex(tmpSurface, false); |
|
1069 |
SDL_FreeSurface(tmpSurface) |
|
1070 |
end; |
|
1071 |
if fpsTexture <> nil then |
|
1072 |
DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture); |
|
1073 |
end; |
|
174 | 1074 |
|
3692 | 1075 |
if CountTicks >= 1000 then CountTicks:= 0; |
2850
f6f8db825ce7
A little clock for convenience in finding things in demos
nemo
parents:
2839
diff
changeset
|
1076 |
|
3692 | 1077 |
// lag warning (?) |
1078 |
inc(SoundTimerTicks, Lag); |
|
1079 |
end; |
|
1080 |
||
174 | 1081 |
if SoundTimerTicks >= 50 then |
1082 |
begin |
|
1083 |
SoundTimerTicks:= 0; |
|
1084 |
if cVolumeDelta <> 0 then |
|
1085 |
begin |
|
1086 |
str(ChangeVolume(cVolumeDelta), s); |
|
2619 | 1087 |
AddCaption(Format(trmsg[sidVolume], s), cWhiteColor, capgrpVolume) |
174 | 1088 |
end |
756 | 1089 |
end; |
1090 |
||
2724 | 1091 |
if GameState = gsConfirm then |
3025 | 1092 |
DrawCentered(0, (cScreenHeight shr 1), ConfirmTexture); |
2161
0c8634241fa4
Some work on zooming. Hedgewars are now unplayable.
unc0rr
parents:
2152
diff
changeset
|
1093 |
|
3107 | 1094 |
if ScreenFade <> sfNone then |
1095 |
begin |
|
1096 |
if not isFirstFrame then |
|
1097 |
case ScreenFade of |
|
1098 |
sfToBlack, sfToWhite: if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then |
|
1099 |
inc(ScreenFadeValue, Lag * ScreenFadeSpeed) |
|
1100 |
else |
|
3123 | 1101 |
ScreenFadeValue:= sfMax; |
3107 | 1102 |
sfFromBlack, sfFromWhite: if ScreenFadeValue - Lag * ScreenFadeSpeed > 0 then |
1103 |
dec(ScreenFadeValue, Lag * ScreenFadeSpeed) |
|
1104 |
else |
|
3123 | 1105 |
ScreenFadeValue:= 0; |
3107 | 1106 |
end; |
1107 |
if ScreenFade <> sfNone then |
|
1108 |
begin |
|
1109 |
case ScreenFade of |
|
3376 | 1110 |
sfToBlack, sfFromBlack: Tint(0, 0, 0, ScreenFadeValue * 255 div 1000); |
1111 |
sfToWhite, sfFromWhite: Tint($FF, $FF, $FF, ScreenFadeValue * 255 div 1000); |
|
3107 | 1112 |
end; |
3113 | 1113 |
|
1114 |
VertexBuffer[0].X:= -cScreenWidth; |
|
1115 |
VertexBuffer[0].Y:= cScreenHeight; |
|
1116 |
VertexBuffer[1].X:= -cScreenWidth; |
|
1117 |
VertexBuffer[1].Y:= 0; |
|
1118 |
VertexBuffer[2].X:= cScreenWidth; |
|
1119 |
VertexBuffer[2].Y:= 0; |
|
1120 |
VertexBuffer[3].X:= cScreenWidth; |
|
1121 |
VertexBuffer[3].Y:= cScreenHeight; |
|
1122 |
||
3376 | 1123 |
glDisable(GL_TEXTURE_2D); |
3641 | 1124 |
|
3113 | 1125 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1126 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
3641 | 1127 |
|
3376 | 1128 |
glEnable(GL_TEXTURE_2D); |
3390 | 1129 |
Tint($FF, $FF, $FF, $FF); |
3123 | 1130 |
if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then ScreenFade:= sfNone |
3107 | 1131 |
end |
1132 |
end; |
|
1133 |
||
3123 | 1134 |
SetScale(zoom); |
1135 |
||
1136 |
// Cursor |
|
1137 |
if isCursorVisible then |
|
1138 |
begin |
|
1139 |
if not bShowAmmoMenu then |
|
3204 | 1140 |
begin |
3123 | 1141 |
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
|
1142 |
if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
3123 | 1143 |
begin |
1144 |
i:= Ammo^[CurSlot, CurAmmo].Pos; |
|
1145 |
with Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType] do |
|
1146 |
if PosCount > 1 then |
|
3204 | 1147 |
DrawSprite(PosSprite, CursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - CursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
3123 | 1148 |
end; |
3204 | 1149 |
DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
1150 |
end |
|
3123 | 1151 |
end; |
3107 | 1152 |
isFirstFrame:= false |
4 | 1153 |
end; |
1154 |
||
2905 | 1155 |
procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); |
4 | 1156 |
begin |
2142 | 1157 |
//if Group in [capgrpGameState] then WriteLnToConsole(s); |
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
|
1158 |
if Captions[Group].Tex <> nil then |
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
|
1159 |
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
|
1160 |
Captions[Group].Tex:= nil; |
2142 | 1161 |
|
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
|
1162 |
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
|
1163 |
|
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
|
1164 |
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
|
1165 |
capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1166 |
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
|
1167 |
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
|
1168 |
end; |
4 | 1169 |
end; |
1170 |
||
79 | 1171 |
procedure MoveCamera; |
2428 | 1172 |
var EdgesDist, wdy: LongInt; |
3638
33ee433749ba
touch overlay reworked, improvements to zoom and confirmation
koda
parents:
3629
diff
changeset
|
1173 |
PrevSentPointTime: LongWord = 0; |
4 | 1174 |
begin |
3551 | 1175 |
{$IFNDEF IPHONEOS} |
2970
011075f93746
Let's try this too (override following remote if in ammo menu)
nemo
parents:
2959
diff
changeset
|
1176 |
if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus then |
3551 | 1177 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1178 |
SDL_GetMouseState(@CursorPoint.X, @CursorPoint.Y); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1179 |
CursorPoint.X:= CursorPoint.X - (cScreenWidth shr 1); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1180 |
CursorPoint.Y:= cScreenHeight - CursorPoint.Y; |
3551 | 1181 |
end; |
1182 |
{$ENDIF} |
|
678 | 1183 |
|
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2747
diff
changeset
|
1184 |
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
|
1185 |
if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1186 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1187 |
FollowGear:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1188 |
prevPoint:= CursorPoint; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1189 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1190 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1191 |
else begin |
2970
011075f93746
Let's try this too (override following remote if in ammo menu)
nemo
parents:
2959
diff
changeset
|
1192 |
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
|
1193 |
CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1194 |
end; |
4 | 1195 |
|
2375 | 1196 |
wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1197 |
if WorldDy < wdy then WorldDy:= wdy; |
|
1198 |
||
2197 | 1199 |
if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; |
4 | 1200 |
|
3434 | 1201 |
if AMxShift < AMWidth then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1202 |
begin |
3463 | 1203 |
{$IFDEF IPHONEOS} |
3434 | 1204 |
if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1205 |
if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
|
1206 |
if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
|
1207 |
if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset; |
|
3463 | 1208 |
{$ELSE} |
3434 | 1209 |
if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize; |
1210 |
if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
|
1211 |
if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
|
1212 |
if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; |
|
3463 | 1213 |
{$ENDIF} |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1214 |
prevPoint:= CursorPoint; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1215 |
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
|
1216 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1217 |
end; |
162 | 1218 |
|
4 | 1219 |
if isCursorVisible then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1220 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1221 |
if (not CurrentTeam^.ExtDriven) and (GameTicks >= PrevSentPointTime + cSendCursorPosTime) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1222 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1223 |
SendIPCXY('P', CursorPoint.X - WorldDx, cScreenHeight - CursorPoint.Y - WorldDy); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1224 |
PrevSentPointTime:= GameTicks |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1225 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1226 |
end; |
351 | 1227 |
|
4 | 1228 |
if isCursorVisible or (FollowGear <> nil) then |
1229 |
begin |
|
284 | 1230 |
if isCursorVisible then EdgesDist:= cCursorEdgesDist |
1231 |
else EdgesDist:= cGearScrEdgesDist; |
|
2197 | 1232 |
if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
4 | 1233 |
begin |
2197 | 1234 |
WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
1235 |
CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |
|
4 | 1236 |
end else |
2197 | 1237 |
if CursorPoint.X > cScreenWidth div 2 - EdgesDist then |
4 | 1238 |
begin |
2197 | 1239 |
WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist; |
2198 | 1240 |
CursorPoint.X:= cScreenWidth div 2 - EdgesDist |
4 | 1241 |
end; |
284 | 1242 |
if CursorPoint.Y < EdgesDist then |
4 | 1243 |
begin |
2197 | 1244 |
WorldDy:= WorldDy + CursorPoint.Y - EdgesDist; |
284 | 1245 |
CursorPoint.Y:= EdgesDist |
4 | 1246 |
end else |
284 | 1247 |
if CursorPoint.Y > cScreenHeight - EdgesDist then |
4 | 1248 |
begin |
2197 | 1249 |
WorldDy:= WorldDy + CursorPoint.Y - cScreenHeight + EdgesDist; |
284 | 1250 |
CursorPoint.Y:= cScreenHeight - EdgesDist |
4 | 1251 |
end; |
1252 |
end else |
|
308 | 1253 |
if cHasFocus then |
1254 |
begin |
|
70 | 1255 |
WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
2197 | 1256 |
WorldDy:= WorldDy + CursorPoint.Y - prevPoint.Y; |
2162 | 1257 |
CursorPoint.X:= 0; |
1258 |
CursorPoint.Y:= cScreenHeight div 2; |
|
308 | 1259 |
end; |
351 | 1260 |
|
4 | 1261 |
prevPoint:= CursorPoint; |
2567 | 1262 |
if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); |
1760 | 1263 |
if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024; |
2375 | 1264 |
if WorldDy < wdy then WorldDy:= wdy; |
2426 | 1265 |
if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024; |
1266 |
if WorldDx > 1024 then WorldDx:= 1024; |
|
4 | 1267 |
end; |
1268 |
||
2905 | 1269 |
procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
2786 | 1270 |
var r: TSDL_Rect; |
1271 |
begin |
|
1272 |
r.w:= 32; |
|
1273 |
r.h:= 32; |
|
1274 |
||
1275 |
if time = 0 then time:= 5000; |
|
1276 |
missionTimer:= time; |
|
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
|
1277 |
if missionTex <> nil then |
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
|
1278 |
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
|
1279 |
missionTex:= nil; |
2786 | 1280 |
|
1281 |
if icon > -1 then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1282 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1283 |
r.x:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1284 |
r.y:= icon * 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1285 |
missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, MissionIcons, @r) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1286 |
end |
2786 | 1287 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1288 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1289 |
r.x:= ((-icon - 1) shr 5) * 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1290 |
r.y:= ((-icon - 1) mod 32) * 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1291 |
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
|
1292 |
end; |
2786 | 1293 |
end; |
1294 |
||
1295 |
procedure HideMission; |
|
1296 |
begin |
|
3045 | 1297 |
missionTimer:= 0; |
1298 |
if missionTex <> nil then FreeTexture(missionTex); |
|
2786 | 1299 |
end; |
1300 |
||
3032 | 1301 |
procedure ShakeCamera(amount: LongWord); |
1302 |
begin |
|
1303 |
amount:= max(1, amount); |
|
1304 |
WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2)); |
|
1305 |
WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2)); |
|
1306 |
end; |
|
1307 |
||
3038 | 1308 |
procedure initModule; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
1309 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1310 |
fpsTexture:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1311 |
FollowGear:= nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1312 |
WindBarWidth:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1313 |
bShowAmmoMenu:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1314 |
bSelected:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1315 |
bShowFinger:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1316 |
Frames:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1317 |
WorldDx:= -512; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1318 |
WorldDy:= -256; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
1319 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1320 |
FPS:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1321 |
CountTicks:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1322 |
SoundTimerTicks:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1323 |
prevPoint.X:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1324 |
prevPoint.Y:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1325 |
missionTimer:= 0; |
3240 | 1326 |
missionTex:= nil; |
3463 | 1327 |
cOffsetY:= 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1328 |
|
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2931
diff
changeset
|
1329 |
FillChar(Captions, sizeof(Captions), 0) |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2682
diff
changeset
|
1330 |
end; |
4 | 1331 |
|
3038 | 1332 |
procedure freeModule; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
1333 |
begin |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
1334 |
end; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2713
diff
changeset
|
1335 |
|
4 | 1336 |
end. |