2 Copyright (C) 2004 Parallel Realities
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
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.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 void doTimeRemaining()
25 map.remainingSeconds--;
27 if ((map.remainingMinutes == 0) && (map.remainingSeconds <= 10) && (map.remainingSeconds > 0))
29 audio.playSound(SND_CLOCK, CH_TOUCH);
32 if (map.remainingSeconds < 0)
34 if (map.remainingMinutes > 0)
36 map.remainingSeconds = 59;
37 map.remainingMinutes--;
41 if ((map.remainingSeconds == 0) && (map.remainingMinutes == 0))
45 Math::removeBit(&player.flags, ENT_FLIES);
46 game.setMissionOver(MIS_TIMEUP);
49 replayData.header.time++;
54 static Graphics::SurfaceCache healthCache;
55 static Graphics::SurfaceCache oxygenCache;
56 static Graphics::SurfaceCache jetpackCache;
58 graphics.setFontSize(0);
59 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
63 graphics.blit(graphics.infoBar, 0, 0, graphics.screen, false);
65 graphics.drawString(_("Health"), 50, 5, TXT_RIGHT, graphics.screen, healthCache);
67 for (int i = 0 ; i < MAX_HEALTH ; i++)
69 if (i < player.health)
70 graphics.blit(graphics.getSprite("HealthBlock", true)->getCurrentFrame(), 60 + (i * 15), 7, graphics.screen, false);
72 graphics.blit(graphics.getSprite("HealthBlockEmpty", true)->getCurrentFrame(), 60 + (i * 15), 7, graphics.screen, false);
75 if (player.health <= 3)
76 if (engine.getFrameLoop() < 30)
77 for (int i = 0 ; i < player.health ; i++)
78 graphics.blit(graphics.getSprite("WarningBlock", true)->getCurrentFrame(), 60 + (i * 15), 7, graphics.screen, false);
80 if ((!game.hasAquaLung) && (!engine.cheatExtras))
82 graphics.drawString(_("Oxygen"), 305, 5, TXT_RIGHT, graphics.screen, oxygenCache);
84 for (int i = 0 ; i < 7 ; i++)
86 if (i < player.oxygen)
87 graphics.blit(graphics.getSprite("OxygenBlock", true)->getCurrentFrame(), 315 + (i * 15), 7, graphics.screen, false);
89 graphics.blit(graphics.getSprite("OxygenBlockEmpty", true)->getCurrentFrame(), 315 + (i * 15), 7, graphics.screen, false);
92 if (player.oxygen <= 3)
93 if (engine.getFrameLoop() < 30)
94 for (int i = 0 ; i < player.oxygen ; i++)
95 graphics.blit(graphics.getSprite("WarningBlock", true)->getCurrentFrame(), 315 + (i * 15), 7, graphics.screen, false);
97 else if ((game.hasJetPack) || (engine.cheatExtras))
99 graphics.drawString(_("Jetpack"), 305, 5, TXT_RIGHT, graphics.screen, jetpackCache);
101 for (int i = 0 ; i < 7 ; i++)
104 graphics.blit(graphics.getSprite("OxygenBlock", true)->getCurrentFrame(), 315 + (i * 15), 7, graphics.screen, false);
106 graphics.blit(graphics.getSprite("OxygenBlockEmpty", true)->getCurrentFrame(), 315 + (i * 15), 7, graphics.screen, false);
109 if ((player.fuel < 3) && (!(player.flags & ENT_FLIES)))
110 if (engine.getFrameLoop() < 30)
111 for (int i = 0 ; i < player.fuel ; i++)
112 graphics.blit(graphics.getSprite("WarningBlock", true)->getCurrentFrame(), 315 + (i * 15), 7, graphics.screen, false);
115 if ((map.mainBossPart == NULL || strstr(engine.message, "Aqua") || strstr(engine.message, "Jet")) && (game.missionOverReason != MIS_GAMECOMPLETE))
117 if (engine.messageTime > -1)
119 switch (engine.messageType)
122 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
125 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
128 graphics.setFontColor(0xff, 0xaa, 0x00, 0x00, 0x00, 0x00);
131 graphics.setFontColor(0x00, 0xff, 0xff, 0x00, 0x00, 0x00);
134 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
138 static Graphics::SurfaceCache cache;
139 graphics.blit(graphics.infoBar, 0, 455, graphics.screen, false);
140 graphics.drawString(_(engine.message), 320, 466, true, graphics.screen, cache);
142 engine.messageTime--;
143 if (engine.messageTime == -1)
145 engine.messagePriority = -1;
146 engine.message[0] = 0;
149 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
154 if (map.mainBossPart != NULL)
156 graphics.blit(graphics.infoBar, 0, 455, graphics.screen, false);
158 static Graphics::SurfaceCache cache;
159 graphics.drawString(_(map.mainBossPart->name), 255, 460, TXT_RIGHT, graphics.screen, cache);
160 graphics.drawRect(265 - 1, 463 - 1, 200 + 2, 10 + 2, graphics.white, graphics.screen);
161 graphics.drawRect(265, 463, 200, 10, graphics.black, graphics.screen);
163 if (map.mainBossPart->health > 0)
165 graphics.drawRect(265, 463, (int)(map.mainBossPart->health * map.bossEnergyMeterBit), 10, graphics.red, graphics.screen);
170 static Graphics::SurfaceCache weaponCache;
171 snprintf(string, sizeof string, "%s %s", _("Weapon:"), _(player.currentWeapon->name));
172 graphics.drawString(string, 630, 5, TXT_RIGHT, graphics.screen, weaponCache);
176 snprintf(string, sizeof string, _("Time Remaining: %.2d:%.2d"), map.remainingMinutes, map.remainingSeconds);
177 graphics.blit(graphics.infoBar, 0, 25, graphics.screen, false);
179 if ((map.remainingMinutes > 0) || (map.remainingSeconds > 0))
181 if (map.remainingMinutes == 0)
183 if (map.remainingSeconds > 0)
185 if (map.remainingSeconds <= 10)
187 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
189 else if (map.remainingSeconds <= 30)
191 graphics.setFontColor(0xff, 0xff, 0x00, 0x00, 0x00, 0x00);
195 static Graphics::SurfaceCache cache;
196 graphics.drawString(string, 320, 35, TXT_CENTERED, graphics.screen, cache);
200 static Graphics::SurfaceCache cache;
201 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
202 graphics.setFontSize(3);
203 graphics.drawString(_("Mission Failed! Time Up!"), 320, 220, TXT_CENTERED, graphics.screen, cache);
204 graphics.setFontSize(0);
205 game.canContinue = 0;
223 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
226 snprintf(string, sizeof string, _("Position = %d:%d"), (int)player.x, (int)player.y);
227 graphics.drawString(string, 5, 25, false, graphics.screen);
230 graphics.drawString(_("*** PAUSED ***"), 320, y, TXT_CENTERED, graphics.screen);
232 graphics.drawString(_("MIAs in Area"), col1, y += 30, TXT_RIGHT, graphics.screen);
233 snprintf(string, sizeof string, "%d", map.totalMIAs - map.foundMIAs);
234 graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
236 graphics.drawString(_("Enemies Defeated"), col1, y += 20, TXT_RIGHT, graphics.screen);
237 snprintf(string, sizeof string, "%d", game.currentMissionEnemiesDefeated);
238 graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
240 graphics.drawString(_("Items Collected"), col1, y += 20, TXT_RIGHT, graphics.screen);
241 snprintf(string, sizeof string, "%d / %d", map.foundItems, map.totalItems);
242 graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
244 graphics.drawString(_("Best Combo"), col1, y += 20, TXT_RIGHT, graphics.screen);
245 snprintf(string, sizeof string, _("%d Hits"), game.maxComboHits);
246 graphics.drawString(string, col2, y, TXT_LEFT, graphics.screen);
248 graphics.drawString(_("++ Inventory ++"), 320, y += 40, TXT_CENTERED, graphics.screen);
251 // Do the objectives list
252 Objective *objective = (Objective*)map.objectiveList.getHead();
257 if (map.totalMIAs > 0)
259 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
260 snprintf(message, sizeof message, _("Rescue %d MIAs"), map.requiredMIAs);
261 graphics.drawString(message, col1, y, TXT_RIGHT, graphics.screen);
263 if (map.foundMIAs < map.requiredMIAs)
265 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
266 snprintf(message, sizeof message, "%d / %d", map.foundMIAs, map.requiredMIAs);
267 graphics.drawString(message, col2, y, TXT_LEFT, graphics.screen);
271 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
272 graphics.drawString(_("Completed"), col2, y, TXT_LEFT, graphics.screen);
276 while (objective->next != NULL)
278 objective = (Objective*)objective->next;
282 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
284 if ((game.skill < 3) && (strstr(objective->description, "L.R.T.S.")) && (!gameData.completedWorld))
286 graphics.drawString(_("???? ???????? ????"), col1, y, TXT_RIGHT, graphics.screen);
290 graphics.drawString(_(objective->description), col1, y, TXT_RIGHT, graphics.screen);
293 // this is a fake objective (for the 4th Ancient Tomb)
294 if (objective->targetValue == -1)
296 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
297 graphics.drawString(_("Incomplete"), col2, y, TXT_LEFT, graphics.screen);
299 else if (objective->currentValue < objective->targetValue)
301 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
302 if (objective->targetValue == 1)
304 graphics.drawString(_("Incomplete"), col2, y, TXT_LEFT, graphics.screen);
308 snprintf(message, sizeof message, "%d / %d", objective->currentValue, objective->targetValue);
309 graphics.drawString(message, col2, y, TXT_LEFT, graphics.screen);
312 if (!objective->required)
314 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
315 graphics.drawString(_("(optional)"), 450, y, TXT_LEFT, graphics.screen);
320 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
321 graphics.drawString(_("Completed"), col2, y, TXT_LEFT, graphics.screen);
325 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
329 snprintf(string, sizeof string, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
330 graphics.drawString(string, 320, 430, TXT_CENTERED, graphics.screen);
333 void doMusicInfo(unsigned int ticks)
335 if(!audio.songtitle[0])
338 if(ticks != (unsigned int)-1) {
339 if(ticks > 12000 || ticks < 5000)
342 unsigned int r = rand() & 0x3ff;
344 if(ticks - 5000 < r || 12000 - ticks < r)
348 graphics.setFontSize(0);
349 graphics.setFontColor(0xff, 0xff, 0xff, 0x40, 0x40, 0x40);
360 graphics.drawRect(x - w - 5, y - h - 5, w + 10, h + 10, graphics.darkGrey, graphics.screen);
364 text = graphics.getString(audio.songtitle, true);
369 graphics.blit(text, x - text->w, y, graphics.screen, false);
370 SDL_FreeSurface(text);
372 if(audio.songalbum[0])
374 graphics.setFontColor(0x80, 0xc0, 0xff, 0x40, 0x40, 0x40);
376 text = graphics.getString(audio.songalbum, true);
382 graphics.blit(text, x - text->w, y, graphics.screen, false);
383 SDL_FreeSurface(text);
386 if(audio.songartist[0])
388 graphics.setFontColor(0xff, 0xc0, 0x80, 0x40, 0x40, 0x40);
390 text = graphics.getString(audio.songartist, true);
396 graphics.blit(text, x - text->w, y, graphics.screen, false);
397 SDL_FreeSurface(text);
400 if(audio.songlicense >= 0)
402 SDL_Surface *icon = graphics.license[audio.songlicense];
409 graphics.blit(icon, x - icon->w, y, graphics.screen, false);