License update for 2008. (And also the extract-pot script, because it's stopped worki...
[dbw.git] / src / hub.cpp
blobc30e1b7fb3ad50d31e8ed500c71aed524ecbe57f
1 /*
2 Copyright © 2004 Parallel Realities
3 Copyright © 2007-2008 Kővágó Zoltán <DirtY.iCE.hu@gmail.com>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <sstream>
23 #include <boost/format.hpp>
25 #include "hub.h"
26 #include "gettext.hpp"
27 #include "font/fontengine.hpp"
28 #include "console/console.hpp"
30 void createStatsPanel(int page)
32 SDL_Surface *image = graphics.getSprite("infoPanel", true)->image[0];
34 graphics.drawRect(1, 1, image->w - 2, image->h - 2, graphics.black, graphics.white, image);
36 std::ostringstream oss;
37 const unsigned char size = font_manager.GetOldSize(0);
39 unsigned short x1 = 80;
40 unsigned short x2 = 270;
41 unsigned short x3 = 300;
42 unsigned short y = 25;
44 FontEngine::DrawLine("default", _("DirtY BLoB WaRs: statistics"), size, 200, y, "center_base", image);
45 y += 10;
47 Sprite *arrows = graphics.getSprite("HubArrows", true);
49 switch (page)
51 case 0:
52 FontEngine::DrawLine("default", _("Skill Level:"), size, x1, y += 20, "begin_base", image);
53 FontEngine::DrawLine("default", _(skill[game.skill]), size, x2, y, "begin_base", image);
55 FontEngine::DrawLine("default", _("Score:"), size, x1, y += 20, "begin_base", image);
56 FontEngine::DrawLine("default", (oss << game.score, oss.str()), size, x2, y, "begin_base", image);
57 oss.str("");
59 FontEngine::DrawLine("default", _("MIAs saved:"), font_manager.GetOldSize(0), x1, y += 20, "begin_base", image);
60 FontEngine::DrawLine("default", (oss << game.totalMIAsRescued, oss.str()), size, x2, y, "begin_base", image);
61 oss.str("");
63 FontEngine::DrawLine("default", _("Objectives completed:"), size, x1, y += 20, "begin_base", image);
64 FontEngine::DrawLine("default", (oss << game.totalObjectivesCompleted, oss.str()), size, x2, y, "begin_base", image);
65 oss.str("");
67 // Don't do this on Extreme or it will always say 100%
68 if (game.skill < 3)
70 FontEngine::DrawLine("default", _("Percentage complete:"), size, x1, y += 20, "begin_base", image);
71 FontEngine::DrawLine("default", (oss << gameData.getPercentageComplete() << "%", oss.str()), size, x2, y, "begin_base", image);
74 FontEngine::DrawLine("default", boost::str(boost::format(_("Total game time: %02d:%02d:%02d")) % game.totalHours % game.totalMinutes % game.totalSeconds),
75 size, 200, y += 110, "center_base", image);
77 break;
79 case 1:
80 FontEngine::DrawLine("default", _("Enemies defeated:"), size, x1, y += 20, "begin_base", image);
81 FontEngine::DrawLine("default", (oss << game.totalEnemiesDefeated, oss.str()), size, x2, y, "begin_base", image);
82 oss.str("");
84 FontEngine::DrawLine("default", _("Items collected:"), size, x1, y += 20, "begin_base", image);
85 FontEngine::DrawLine("default", (oss << game.totalItemsCollected, oss.str()), size, x2, y, "begin_base", image);
86 oss.str("");
88 FontEngine::DrawLine("default", _("Bonuses picked up:"), size, x1, y += 20, "begin_base", image);
89 FontEngine::DrawLine("default", (oss << game.totalBonusesCollected, oss.str()), size, x2, y, "begin_base", image);
90 oss.str("");
92 FontEngine::DrawLine("default", _("Best combo:"), size, x1, y += 20, "begin_base", image);
93 FontEngine::DrawLine("default", boost::str(boost::format(_("%1% hit", "%1% hits", game.maxComboHits)) % (int) game.maxComboHits), size, x2, y, "begin_base", image);
95 FontEngine::DrawLine("default", _("Missions started:"), size, x1, y += 20, "begin_base", image);
96 FontEngine::DrawLine("default", (oss << game.levelsStarted, oss.str()), size, x2, y, "begin_base", image);
97 oss.str("");
99 FontEngine::DrawLine("default", _("Continues used:"), size, x1, y += 20, "begin_base", image);
100 FontEngine::DrawLine("default", (oss << game.continuesUsed, oss.str()), size, x2, y, "begin_base", image);
101 oss.str("");
103 if ((game.continuesUsed > 0) && (game.levelsStarted > 0))
105 FontEngine::DrawLine("default", _("Average continue usage:"), size, x1, y += 20, "begin_base", image);
106 FontEngine::DrawLine("default", (oss << (game.continuesUsed / game.levelsStarted), oss.str()), size, x2, y, "begin_base", image);
107 oss.str("");
110 FontEngine::DrawLine("default", _("Escapes used:"), size, x1, y += 20, "begin_base", image);
111 FontEngine::DrawLine("default", (oss << game.escapes, oss.str()), size, x2, y, "begin_base", image);
113 break;
115 case 2:
117 x1 = 20;
118 x2 = 170;
119 x3 = 300;
121 FontEngine::DrawLine("default", _("Weapon"), size, x1, y += 20, "begin_base", image);
122 FontEngine::DrawLine("default", _("Ammo used"), size, x2, y, "begin_base", image);
123 FontEngine::DrawLine("default", _("Accuracy"), size, x3, y, "begin_base", image);
125 typedef std::pair<std::string, int> WeaponPair;
126 std::vector<WeaponPair> weapons;
127 weapons.push_back(WeaponPair(_("Pistol"), WP_PISTOL));
128 weapons.push_back(WeaponPair(_("Machine gun"), WP_MACHINEGUN));
129 weapons.push_back(WeaponPair(_("Laser cannon"), WP_LASER));
130 weapons.push_back(WeaponPair(_("Grenades"), WP_GRENADES));
131 weapons.push_back(WeaponPair(_("Spread gun"), WP_SPREAD));
133 y += 10;
135 for (std::vector<WeaponPair>::iterator iter = weapons.begin(); iter != weapons.end(); iter++)
137 FontEngine::DrawLine("default", iter->first, size, x1, y += 20, "begin_base", image);
138 FontEngine::DrawLine("default", (oss << game.bulletsFired[iter->second], oss.str()), size, x2, y, "begin_base", image);
139 oss.str("");
140 FontEngine::DrawLine("default", (oss << game.getWeaponAccuracy(iter->second) << "%", oss.str()), size, x3, y, "begin_base", image);
141 oss.str("");
145 FontEngine::DrawLine("default", _("Total"), size, x1, y += 30, "begin_base", image);
146 FontEngine::DrawLine("default", (oss << game.getTotalBulletsFired(), oss.str()), size, x2, y, "begin_base", image);
147 oss.str("");
148 FontEngine::DrawLine("default", (oss << game.getTotalAccuracy() << "%", oss.str()), size, x3, y, "begin_base", image);
151 FontEngine::DrawLine("default", _("Most used weapon"), size, x1, y += 50, "begin_base", image);
152 FontEngine::DrawLine("default", _(weapon[game.getMostUsedWeapon()].name), size, x2, y, "begin_base", image);
154 break;
157 graphics.blit(arrows->image[0], 150, 260, image, false);
158 graphics.blit(arrows->image[2], 200, 260, image, false);
160 if (page == 0)
161 graphics.blit(arrows->image[1], 150, 260, image, false);
163 if (page == 2)
164 graphics.blit(arrows->image[3], 200, 260, image, false);
167 void loadLevelBrief(char *levelName)
169 char briefLine[1024];
171 if (!engine.loadData("data/levelBrief"))
173 graphics.showErrorAndExit(_("Couldn't load mission briefing file (%s)"), "data/levelBrief");
176 char *line = strtok((char*)engine.dataBuffer, "\n");
177 bool collectData = false;
178 Video::PointSurface image = graphics.getSprite("infoPanel", true)->image[0];
180 int i = 0 ;
182 //graphics.clearChatString();
183 std::string text;
185 while (true)
187 if (collectData)
189 sscanf(line, "%[^\n\r]", briefLine);
191 if (strcmp(briefLine, "@EOF@") == 0)
192 break;
194 if (line[0] == '[')
195 break;
197 //graphics.createChatString(line);
198 text += " ";
199 text += line;
201 else
203 if (line[0] == '[')
205 sscanf(line, "%*c %[^]]", briefLine);
206 if (strcmp(briefLine, levelName) == 0)
207 collectData = true;
211 line = strtok(NULL, "\n");
212 if (line == NULL)
213 break;
215 i++;
217 // sanity check!
218 if (i == 10000)
219 break;
222 //graphics.drawChatString(image, 40);
223 debug << "Level brief is: " << text << std::endl;
224 Video::PointSurface rend_text(FontEngine::Renderer::RenderText(font_manager.GetFont("default"), text, font_manager.GetOldSize(0), 380));
225 image.BlitInto(Video::Point(10, 40), rend_text, rend_text["begin_base"]);
228 void createObjectivesPanel(char *levelName)
230 SDL_Surface *image = graphics.getSprite("infoPanel", true)->image[0];
232 Data *data = (Data*)gameData.dataList.getHead();
234 bool found = false;
236 graphics.drawRect(1, 1, image->w - 2, image->h - 2, graphics.black, graphics.white, image);
238 char string[100];
239 char levelMIAKey[100];
240 int x1 = 60;
241 int x2 = 260;
242 int y = 15;
244 sprintf(levelMIAKey, _("%s MIAs").c_str(), levelName);
246 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
248 //sprintf(string, _("Information for %s").c_str(), _(levelName).c_str());
249 //graphics.drawString(string, 200, y, true, image);
250 FontEngine::DrawLine("default", boost::str(boost::format(_("Information for '%1%'")) % _(levelName)), font_manager.GetOldSize(0), 200, y, "center_base", image);
251 y += 10;
253 while (data->next != NULL)
255 data = (Data*)data->next;
257 if ((strcmp(data->key, levelName) == 0) || (strstr(data->key, levelMIAKey)))
259 found = true;
261 if (strstr(data->key, "MIAs"))
263 // if it says 0 / 0 don't bother...
264 if (strcmp(data->value, "0 / 0"))
266 graphics.drawString(_("MIAs Rescued"), x1, y += 20, false, image);
267 sprintf(string, "%d / %d", data->current, data->target);
268 (data->isComplete()) ? graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00) : graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
269 graphics.drawString(string, x2, y, false, image);
272 else if (!strstr(data->value, "MIA_"))
274 if ((game.skill < 3) && (strstr(data->value, "L.R.T.S.")) && (!gameData.completedWorld))
276 graphics.drawString("???? ???????? ????", x1, y += 20, false, image);
278 else
280 strcpy(string, data->value);
282 if (strlen(string) >= 25)
284 int cut_char = 25;
285 // don't break unicode characters
286 while (((string[cut_char] >> 6) & 3) == 2)
288 cut_char--;
291 string[cut_char++] = '.';
292 string[cut_char++] = '.';
293 string[cut_char++] = '.';
294 string[cut_char] = '\0';
297 graphics.drawString(string, x1, y += 20, false, image);
300 if (data->target == 1)
302 sprintf(string, "%s", (data->isComplete()) ? _("Completed").c_str() : _("Incomplete").c_str());
304 else
306 sprintf(string, "%d / %d", data->current, data->target);
309 (data->isComplete()) ? graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00) : graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
310 graphics.drawString(string, x2, y, false, image);
314 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
317 if (!found)
318 loadLevelBrief(levelName);
321 void createMIAPanel(int start, int max)
323 char string[100];
324 char name[100];
325 int x1 = 20;
326 int x2 = 130;
327 int x3 = 310;
328 int y = 15;
330 int current = 0;
331 int end = 0;
333 SDL_Surface *image = graphics.getSprite("infoPanel", true)->image[0];
335 Data *data = (Data*)gameData.dataList.getHead();
337 graphics.drawRect(1, 1, image->w - 2, image->h - 2, graphics.black, graphics.white, image);
339 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
341 graphics.drawString(_("MIA Statistics"), 200, y, true, image);
343 graphics.drawString(_("Name"), x1, y += 20, false, image);
344 graphics.drawString(_("Location"), x2, y, false, image);
345 graphics.drawString(_("Status"), x3, y, false, image);
347 y += 10;
349 while (data->next != NULL)
351 data = (Data*)data->next;
353 if (strstr(data->value, "MIA_"))
355 if (current < start)
357 current++;
358 continue;
361 sprintf(name, "%s", data->value);
362 strtok(name, "_");
364 sprintf(string, "%s", strtok(NULL, "_"));
365 graphics.drawString(string, x1, y += 20, false, image);
367 graphics.drawString(data->key, x2, y, false, image);
369 if (data->isComplete())
371 sprintf(string, "%s", _("Found").c_str());
372 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
374 else
376 sprintf(string, "%s", _("Missing").c_str());
377 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
380 graphics.drawString(string, x3, y, false, image);
382 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
384 end++;
386 if (end == 9)
387 break;
391 Sprite *arrows = graphics.getSprite("HubArrows", true);
393 if (start > 0)
394 graphics.blit(arrows->image[0], 150, 260, image, false);
395 else
396 graphics.blit(arrows->image[1], 150, 260, image, false);
398 if ((end == 9) && (current + 9 < max))
399 graphics.blit(arrows->image[2], 200, 260, image, false);
400 else
401 graphics.blit(arrows->image[3], 200, 260, image, false);
404 bool requirementMet(char *requiredLevel)
406 if (engine.cheatLevels)
408 return true;
411 if (strcmp(requiredLevel, "@none@") == 0)
413 return true;
416 if (strstr(requiredLevel, "Stages"))
418 int stages = 0;
419 sscanf(requiredLevel, "%*s %d", &stages);
421 if (game.stagesCleared >= stages)
423 return true;
427 return gameData.requiredLevelCleared(requiredLevel);
430 int doHub()
432 SDL_FillRect(graphics.screen, NULL, graphics.black);
433 graphics.delay(1000);
435 graphics.free();
436 audio.free();
438 graphics.loadBackground("gfx/main/worldmap.png", false);
439 audio.loadMusic("music/forAFriend.mod");
441 graphics.quickSprite("cheatHeader", graphics.loadImage("gfx/main/cheats.png"));
442 graphics.quickSprite("optionsHeader", graphics.loadImage("gfx/main/options.png"));
443 graphics.quickSprite("keyHeader", graphics.loadImage("gfx/main/keyConfig.png"));
444 graphics.quickSprite("joystickHeader", graphics.loadImage("gfx/main/joystickConfig.png"));
445 graphics.quickSprite("optionsBackground", graphics.loadImage("gfx/main/optionsBackground.png"));
447 char string[80];
449 Sprite *cursor = graphics.addSprite("Cursor");
450 for (int i = 0 ; i < 6 ; i++)
452 sprintf(string, "gfx/main/cursor%d.png", i + 1);
453 cursor->setFrame(i, graphics.loadImage(string), 10);
456 Sprite *newTarget = graphics.addSprite("NewTarget");
457 Sprite *visitedTarget = graphics.addSprite("VisitedTarget");
459 for (int i = 0 ; i < 5 ; i++)
461 sprintf(string, "gfx/sprites/miaSignal%d.png", i + 1);
463 newTarget->setFrame(i, graphics.loadImage(string, -60, 0, 0), 15);
464 visitedTarget->setFrame(i, graphics.loadImage(string, 0, 0, 0), 15);
467 Sprite *hubIcons = graphics.addSprite("HubIcons");
468 for (int i = 0 ; i < 6 ; i++)
470 sprintf(string, "gfx/main/hubIcon%d.png", i + 1);
471 hubIcons->setFrame(i, graphics.loadImage(string), 60);
474 SDL_Surface *infoPanel = graphics.quickSprite("infoPanel", graphics.createSurface(400, 300));
476 Sprite *hubArrows = graphics.addSprite("HubArrows");
477 hubArrows->setFrame(0, graphics.loadImage("gfx/main/hubArrowLeft.png"), 60);
478 hubArrows->setFrame(1, graphics.loadImage("gfx/main/hubArrowLeft2.png"), 60);
479 hubArrows->setFrame(2, graphics.loadImage("gfx/main/hubArrowRight.png"), 60);
480 hubArrows->setFrame(3, graphics.loadImage("gfx/main/hubArrowRight2.png"), 60);
482 List hubList;
483 HubLevel *hubPoint;
485 engine.loadData("data/hub");
487 char *line = strtok((char*)engine.dataBuffer, "\n");
489 char name[50], level[50], requiredLevel[50];
490 int x, y;
492 char pos[50];
494 graphics.setFontSize(0);
495 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
497 int numberOfHubs = 0;
499 gameData.calculateWorldCompleted();
501 while (true)
503 sscanf(line, "%*c %[^\"] %*c %*c %[^\"] %*c %d %d %*c %[^\"] %*c", name, level, &x, &y, requiredLevel);
505 if (strcmp(name, "@EOF@") == 0)
507 break;
510 // don't show boss levels on Easy (they might be cheating!)
511 if (game.skill == 0)
513 if (strstr(name, "BioMech"))
515 line = strtok(NULL, "\n");
516 continue;
520 if (requirementMet(requiredLevel))
522 if (!gameData.levelPrefectlyCleared(name))
524 hubPoint = new HubLevel;
525 hubPoint->set(name, level, x, y);
526 hubPoint->levelNameImage = graphics.getString(_(name), false);
528 (!gameData.stagePreviouslyCleared(name)) ? hubPoint->target = newTarget : hubPoint->target = visitedTarget;
530 hubList.add(hubPoint);
531 numberOfHubs++;
535 line = strtok(NULL, "\n");
538 int rtn = -1;
540 strcpy(level, "@none@");
541 strcpy(game.stageName, "@none@");
543 bool showData = false;
544 bool showStats = false;
545 bool showMIAs = false;
547 int miaStart = 0;
548 int miaMax = 0;
549 int page = 0;
551 int labelX, labelY;
553 Data *data = (Data*)gameData.dataList.getHead();
555 while (data->next != NULL)
557 data = (Data*)data->next;
559 if (strstr(data->value, "MIA_"))
561 miaMax++;
565 bool validStage = false;
567 if ((numberOfHubs == 0) && (gameData.completedWorld))
569 game.setMapName("data/spaceStation");
570 strcpy(game.stageName, "Space Station");
571 createObjectivesPanel("Space Station");
572 showData = true;
573 showStats = showMIAs = false;
574 validStage = true;
576 // Wait wait wait... we're in easy mode. Game ends here.
577 if (game.skill == 0)
579 hubList.clear();
580 return SECTION_EASYOVER;
584 audio.playMusic();
586 int labelWidth = 0;
587 Uint32 frameLimit = SDL_GetTicks() + 16;
589 int mouseXDelta = 0;
590 int mouseYDelta = 0;
592 while (rtn == -1)
594 graphics.updateScreen();
595 graphics.drawBackground();
596 graphics.animateSprites();
598 if (validStage)
600 graphics.drawRect(bx + 10, by + 400, 620, 20, graphics.black, graphics.white, graphics.screen);
601 graphics.drawString(_("Selected Destination") + " : " + _(game.stageName), bx + 320, by + 409, true, graphics.screen);
604 graphics.drawRect(bx + 10, by + 430, 620, 40, graphics.black, graphics.white, graphics.screen);
606 /// DEBUG
607 sprintf(pos, "%.3d:%.3d", engine.getMouseX(), engine.getMouseY());
608 graphics.drawString(pos, bx + 320, by + 15, true, graphics.screen);
610 engine.getInput();
612 mouseXDelta = engine.getJoyX(8);
613 mouseYDelta = engine.getJoyY(8);
615 if (engine.isKey(KEY_RIGHT))
617 mouseXDelta = 5;
620 if (engine.isKey(KEY_LEFT))
622 mouseXDelta = -5;
625 if (engine.keyState[SDLK_DOWN])
627 mouseYDelta = 5;
630 if (engine.keyState[SDLK_UP])
632 mouseYDelta = -5;
635 if ((mouseXDelta != 0) || (mouseYDelta != 0))
637 engine.setMouse(engine.getMouseX() + (int)mouseXDelta, engine.getMouseY() + (int)mouseYDelta);
640 hubPoint = (HubLevel*)hubList.getHead();
642 // Collisions for Hub Points
643 while (hubPoint->next != NULL)
645 hubPoint = (HubLevel*)hubPoint->next;
647 graphics.blit(hubPoint->target->getCurrentFrame(), bx + hubPoint->x, by + hubPoint->y, graphics.screen, false);
649 if (Collision::collision(engine.getMouseX(), engine.getMouseY(), 1, 1, bx + hubPoint->x, by + hubPoint->y, 16, 16))
651 labelX = engine.getMouseX();
652 labelY = engine.getMouseY() - 20;
654 labelWidth = hubPoint->levelNameImage->w / 2;
656 Math::limitInt(&labelX, bx + 10 + labelWidth, bx + 630 - labelWidth);
658 graphics.blit(hubPoint->levelNameImage, labelX, labelY, graphics.screen, true);
660 if (engine.mouseLeft || engine.isKey(KEY_FIRE))
662 game.setMapName(hubPoint->filename);
663 game.setStageName(hubPoint->stageName);
664 validStage = true;
665 engine.mouseLeft = 0;
666 engine.clearKey(KEY_FIRE);
669 if (engine.mouseRight || engine.isKey(KEY_MAP))
671 game.setMapName(hubPoint->filename);
672 game.setStageName(hubPoint->stageName);
673 createObjectivesPanel(game.stageName);
674 showData = true;
675 showStats = false;
676 engine.mouseRight = 0;
677 engine.clearKey(KEY_MAP);
682 // Collisions for Panel
683 for (int i = ((1 - validStage) * 2) ; i < 6 ; i++)
685 graphics.blit(hubIcons->image[i], bx + 50 + (i * 100), by + 440, graphics.screen, false);
686 if (Collision::collision(engine.getMouseX(), engine.getMouseY(), 1, 1, bx + 50 + (i * 100), by + 440, hubIcons->image[i]->w, hubIcons->image[i]->h))
688 if (engine.mouseLeft || engine.isKey(KEY_FIRE))
690 switch (i)
692 case 0:
693 rtn = SECTION_GAME;
694 break;
695 case 1:
696 createObjectivesPanel(game.stageName);
697 showData = !showData;
698 showStats = showMIAs = false;
699 break;
700 case 2:
701 createMIAPanel(miaStart, miaMax);
702 showStats = showData = false;
703 showMIAs = !showMIAs;
704 break;
705 case 3:
706 createStatsPanel(page);
707 showStats = !showStats;
708 showData = showMIAs = false;
709 break;
710 case 4:
711 showOptions();
712 graphics.setFontSize(0);
713 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
714 break;
715 case 5:
716 rtn = SECTION_TITLE;
717 break;
720 engine.mouseLeft = false;
721 engine.keyState[SDLK_LCTRL] = 0;
726 // Collisions for Panel Buttons
727 if ((showMIAs) || (showStats))
729 // SDLK_LCTRL is the "fire" button.
730 if (engine.mouseLeft || engine.isKey(KEY_FIRE))
732 if (Collision::collision(engine.getMouseX(), engine.getMouseY(), 1, 1, bx + 270, by + 310, 32, 32))
734 if (showMIAs)
736 if (miaStart > 0)
738 Math::limitInt(&(miaStart -= 9), 0, miaMax);
739 createMIAPanel(miaStart, miaMax);
743 if (showStats)
745 Math::limitInt(&(--page), 0, 2);
746 createStatsPanel(page);
749 engine.mouseLeft = 0;
750 engine.clearKey(KEY_FIRE);
754 if (Collision::collision(engine.getMouseX(), engine.getMouseY(), 1, 1, bx + 320, by + 310, 32, 32))
756 if (showMIAs)
758 if (miaStart + 9 < miaMax)
760 Math::limitInt(&(miaStart += 9), 0, miaMax);
761 createMIAPanel(miaStart, miaMax);
765 if (showStats)
767 Math::limitInt(&(++page), 0, 2);
768 createStatsPanel(page);
771 engine.mouseLeft = 0;
772 engine.clearKey(KEY_FIRE);
777 if ((showData) || (showStats) || (showMIAs))
779 graphics.blit(infoPanel, bx + 320, by + 200, graphics.screen, true);
780 if (engine.mouseLeft || engine.isKey(KEY_FIRE))
782 showData = showStats = showMIAs = false;
786 graphics.blit(cursor->getCurrentFrame(), engine.getMouseX(), engine.getMouseY(), graphics.screen, true);
788 engine.delay(frameLimit);
789 frameLimit = SDL_GetTicks() + 16;
792 hubList.clear();
794 return rtn;