30 |
30 |
31 procedure DrawWorld(Lag: LongInt); |
31 procedure DrawWorld(Lag: LongInt); |
32 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
32 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
33 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
33 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
34 procedure HideMission; |
34 procedure HideMission; |
|
35 procedure SetAmmoTexts(ammoType: TAmmoType; name: ansistring; caption: ansistring; description: ansistring); |
35 procedure ShakeCamera(amount: LongInt); |
36 procedure ShakeCamera(amount: LongInt); |
36 procedure InitCameraBorders; |
37 procedure InitCameraBorders; |
37 procedure InitTouchInterface; |
38 procedure InitTouchInterface; |
38 procedure SetUtilityWidgetState(ammoType: TAmmoType); |
39 procedure SetUtilityWidgetState(ammoType: TAmmoType); |
39 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean); |
40 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean); |
167 |
169 |
168 // if special game flags/settings are changed, add them to the game mode notice window and then show it |
170 // if special game flags/settings are changed, add them to the game mode notice window and then show it |
169 g:= ''; // no text/things to note yet |
171 g:= ''; // no text/things to note yet |
170 |
172 |
171 // add custom goals from lua script if there are any |
173 // add custom goals from lua script if there are any |
172 if LuaGoals <> '' then |
174 if LuaGoals <> ansistring('') then |
173 g:= LuaGoals + '|'; |
175 g:= LuaGoals + '|'; |
174 |
176 |
175 // check different game flags (goals/game modes first for now) |
177 // check different game flags |
|
178 g:= AddGoal(g, gfPlaceHog, gidPlaceHog); // placement? |
176 g:= AddGoal(g, gfKing, gidKing); // king? |
179 g:= AddGoal(g, gfKing, gidKing); // king? |
|
180 if ((GameFlags and gfKing) <> 0) and ((GameFlags and gfPlaceHog) = 0) then |
|
181 g:= AddGoal(g, gfAny, gidPlaceKing); |
177 g:= AddGoal(g, gfTagTeam, gidTagTeam); // tag team mode? |
182 g:= AddGoal(g, gfTagTeam, gidTagTeam); // tag team mode? |
178 |
183 g:= AddGoal(g, gfSharedAmmo, gidSharedAmmo); // shared ammo? |
179 // other important flags |
184 g:= AddGoal(g, gfPerHogAmmo, gidPerHogAmmo); |
180 g:= AddGoal(g, gfForts, gidForts); // forts? |
185 g:= AddGoal(g, gfMoreWind, gidMoreWind); |
181 g:= AddGoal(g, gfLowGravity, gidLowGravity); // low gravity? |
186 g:= AddGoal(g, gfLowGravity, gidLowGravity); // low gravity? |
182 g:= AddGoal(g, gfInvulnerable, gidInvulnerable); // invulnerability? |
187 g:= AddGoal(g, gfSolidLand, gidSolidLand); // solid land? |
183 g:= AddGoal(g, gfVampiric, gidVampiric); // vampirism? |
|
184 g:= AddGoal(g, gfKarma, gidKarma); // karma? |
|
185 g:= AddGoal(g, gfPlaceHog, gidPlaceHog); // placement? |
|
186 g:= AddGoal(g, gfArtillery, gidArtillery); // artillery? |
188 g:= AddGoal(g, gfArtillery, gidArtillery); // artillery? |
187 g:= AddGoal(g, gfSolidLand, gidSolidLand); // solid land? |
|
188 g:= AddGoal(g, gfSharedAmmo, gidSharedAmmo); // shared ammo? |
|
189 g:= AddGoal(g, gfResetHealth, gidResetHealth); |
|
190 g:= AddGoal(g, gfAISurvival, gidAISurvival); |
|
191 g:= AddGoal(g, gfInfAttack, gidInfAttack); |
189 g:= AddGoal(g, gfInfAttack, gidInfAttack); |
192 g:= AddGoal(g, gfResetWeps, gidResetWeps); |
190 g:= AddGoal(g, gfResetWeps, gidResetWeps); |
193 g:= AddGoal(g, gfPerHogAmmo, gidPerHogAmmo); |
191 g:= AddGoal(g, gfResetHealth, gidResetHealth); |
|
192 g:= AddGoal(g, gfKarma, gidKarma); // karma? |
|
193 g:= AddGoal(g, gfVampiric, gidVampiric); // vampirism? |
|
194 g:= AddGoal(g, gfInvulnerable, gidInvulnerable); // invulnerability? |
|
195 g:= AddGoal(g, gfAISurvival, gidAISurvival); |
194 |
196 |
195 // modified damage modificator? |
197 // modified damage modificator? |
196 if cDamagePercent <> 100 then |
198 if cDamagePercent <> 100 then |
197 g:= AddGoal(g, gfAny, gidDamageModifier, cDamagePercent); |
199 g:= AddGoal(g, gfAny, gidDamageModifier, cDamagePercent); |
198 |
200 |
1191 HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
1196 HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
1192 |
1197 |
1193 // background |
1198 // background |
1194 ChangeDepth(RM, cStereo_Sky); |
1199 ChangeDepth(RM, cStereo_Sky); |
1195 if SuddenDeathDmg then |
1200 if SuddenDeathDmg then |
1196 Tint(SDTint, SDTint, SDTint, $FF); |
1201 Tint(SDTint.r, SDTint.g, SDTint.b, SDTint.a); |
1197 DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); |
1202 DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); |
1198 ChangeDepth(RM, -cStereo_Horizon); |
1203 ChangeDepth(RM, -cStereo_Horizon); |
1199 DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
1204 DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
1200 if SuddenDeathDmg then |
1205 if SuddenDeathDmg then |
1201 untint; |
1206 untint; |
1321 DrawWaves( -1, 25 + WorldDx div 3, - offsetY div 10, 59, 0); |
1326 DrawWaves( -1, 25 + WorldDx div 3, - offsetY div 10, 59, 0); |
1322 end |
1327 end |
1323 else |
1328 else |
1324 DrawWaves(-1, 50, cWaveHeight div 2, cWaveHeight div 2, 0); |
1329 DrawWaves(-1, 50, cWaveHeight div 2, cWaveHeight div 2, 0); |
1325 |
1330 |
|
1331 DrawGearsTimers; |
|
1332 |
1326 // everything after this ChangeDepth will be drawn outside the screen |
1333 // everything after this ChangeDepth will be drawn outside the screen |
1327 // note: negative parallax gears should last very little for a smooth stereo effect |
1334 // note: negative parallax gears should last very little for a smooth stereo effect |
1328 ChangeDepth(RM, cStereo_Outside); |
1335 ChangeDepth(RM, cStereo_Outside); |
1329 |
1336 |
1330 if replicateToLeft then |
1337 if replicateToLeft then |
1439 t:= 80; |
1446 t:= 80; |
1440 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
1447 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
1441 while i > 0 do |
1448 while i > 0 do |
1442 begin |
1449 begin |
1443 dec(t, 32); |
1450 dec(t, 32); |
1444 DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10); |
1451 if isPaused or (not IsClockRunning()) then |
|
1452 spr := sprBigDigitGray |
|
1453 else if (ReadyTimeLeft <> 0) then |
|
1454 spr := sprBigDigitGreen |
|
1455 else if IsGetAwayTime then |
|
1456 spr := sprBigDigitRed |
|
1457 else |
|
1458 spr := sprBigDigit; |
|
1459 DrawSprite(spr, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10); |
1445 i:= i div 10 |
1460 i:= i div 10 |
1446 end; |
1461 end; |
1447 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
1462 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
1448 end; |
1463 end; |
1449 |
1464 |
1503 r.w:= - WindBarWidth; |
1518 r.w:= - WindBarWidth; |
1504 r.h:= 13; |
1519 r.h:= 13; |
1505 DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
1520 DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
1506 end |
1521 end |
1507 end; |
1522 end; |
|
1523 |
|
1524 {$IFNDEF USE_TOUCH_INTERFACE} |
|
1525 // Indicators for global effects (extra damage, low gravity) |
|
1526 // TODO: Add support for touch interface (need to find out correct offset) |
|
1527 if UIDisplay <> uiNone then |
|
1528 begin |
|
1529 offsetX:= 45; |
|
1530 offsetY:= 51; |
|
1531 |
|
1532 if cDamageModifier = _1_5 then |
|
1533 begin |
|
1534 DrawTextureF(ropeIconTex, 1, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, 0, 1, 32, 32); |
|
1535 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.90, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, ord(amExtraDamage) - 1, 1, 32, 32); |
|
1536 offsetX := offsetX + 33 |
|
1537 end; |
|
1538 if (cLowGravity) or ((GameFlags and gfLowGravity) <> 0) then |
|
1539 begin |
|
1540 DrawTextureF(ropeIconTex, 1, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, 0, 1, 32, 32); |
|
1541 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.90, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, ord(amLowGravity) - 1, 1, 32, 32); |
|
1542 end; |
|
1543 end; |
|
1544 {$ENDIF} |
1508 |
1545 |
1509 // AmmoMenu |
1546 // AmmoMenu |
1510 if bShowAmmoMenu and ((AMState = AMHidden) or (AMState = AMHiding)) then |
1547 if bShowAmmoMenu and ((AMState = AMHidden) or (AMState = AMHiding)) then |
1511 begin |
1548 begin |
1512 if (AMState = AMHidden) then |
1549 if (AMState = AMHidden) then |
1915 procedure HideMission; |
1952 procedure HideMission; |
1916 begin |
1953 begin |
1917 missionTimer:= 0; |
1954 missionTimer:= 0; |
1918 end; |
1955 end; |
1919 |
1956 |
|
1957 procedure SetAmmoTexts(ammoType: TAmmoType; name: ansistring; caption: ansistring; description: ansistring); |
|
1958 var |
|
1959 ammoStrId: TAmmoStrId; |
|
1960 ammoStr: ansistring; |
|
1961 tmpsurf: PSDL_Surface; |
|
1962 begin |
|
1963 ammoStrId := Ammoz[ammoType].NameId; |
|
1964 |
|
1965 trluaammo[ammoStrId] := name; |
|
1966 if length(trluaammo[ammoStrId]) > 0 then |
|
1967 ammoStr:= trluaammo[ammoStrId] |
|
1968 else |
|
1969 ammoStr:= trammo[ammoStrId]; |
|
1970 |
|
1971 if checkFails(length(ammoStr) > 0,'No default text/translation found for ammo type #' + intToStr(ord(ammoType)) + '!',true) then exit; |
|
1972 |
|
1973 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(ammoStr,fnt16)].Handle, PChar(ammoStr), cWhiteColorChannels); |
|
1974 if checkFails(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ammoType)) + ' failed!',true) then exit; |
|
1975 tmpsurf:= doSurfaceConversion(tmpsurf); |
|
1976 FreeAndNilTexture(Ammoz[ammoType].NameTex); |
|
1977 Ammoz[ammoType].NameTex:= Surface2Tex(tmpsurf, false); |
|
1978 SDL_FreeSurface(tmpsurf); |
|
1979 |
|
1980 trluaammoc[ammoStrId] := caption; |
|
1981 trluaammod[ammoStrId] := description; |
|
1982 end; |
|
1983 |
1920 procedure ShakeCamera(amount: LongInt); |
1984 procedure ShakeCamera(amount: LongInt); |
1921 begin |
1985 begin |
1922 if isCursorVisible then |
1986 if isCursorVisible then |
1923 exit; |
1987 exit; |
1924 amount:= Max(1, round(amount*zoom/2)); |
1988 amount:= Max(1, round(amount*zoom/2)); |