[Scummvm-cvs-logs] SF.net SVN: scummvm: [28554] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Aug 12 14:24:59 CEST 2007
Revision: 28554
http://scummvm.svn.sourceforge.net/scummvm/?rev=28554&view=rev
Author: peres001
Date: 2007-08-12 05:24:59 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Added menu options enum to BRA and some refactoring.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/parallaction.h
scummvm/trunk/engines/parallaction/parallaction_br.cpp
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2007-08-12 11:39:02 UTC (rev 28553)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2007-08-12 12:24:59 UTC (rev 28554)
@@ -585,9 +585,10 @@
Table *_audioCommandsNames;
const char **_audioCommandsNamesRes;
+ int _progress;
+
private:
void initResources();
- void initGame();
void initFonts();
void freeFonts();
Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp 2007-08-12 11:39:02 UTC (rev 28553)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp 2007-08-12 12:24:59 UTC (rev 28554)
@@ -31,6 +31,16 @@
namespace Parallaction {
+enum MenuOptions {
+ kMenuPart0 = 0,
+ kMenuPart1 = 1,
+ kMenuPart2 = 2,
+ kMenuPart3 = 3,
+ kMenuPart4 = 4,
+ kMenuLoadGame = 5,
+ kMenuQuit = 6
+};
+
int Parallaction_br::init() {
// Detect game
@@ -81,12 +91,17 @@
}
int Parallaction_br::go() {
+/*
+ splash("dyna");
+ splash("core");
+*/
+ // TODO: load progress value from special save game
+ _progress = 0;
- initGame();
-
// TODO: game loop :P
- showMenu();
+ int option = showMenu();
+ printf("option = %i\n", option);
return 0;
}
@@ -153,37 +168,56 @@
"PART 4"
};
+ MenuOptions options[7] = {
+ kMenuPart0,
+ kMenuPart1,
+ kMenuLoadGame,
+ kMenuQuit,
+ kMenuPart2,
+ kMenuPart3,
+ kMenuPart4
+ };
+
info = _disk->loadSlide("tbra");
_gfx->setPalette(info->palette);
_gfx->flatBlitCnv(&info->bg, 20, 50, Gfx::kBitFront);
- for (uint i = 0; i < 7; i++)
+ int availItems = 4 + _progress;
+
+ for (int i = 0; i < availItems; i++)
renderMenuItem(_menuItems[i], menuStrings[i]);
int selectedItem = -1, oldSelectedItem = -2;
setMousePointer(0);
- while (_mouseButtons != kMouseLeftUp) {
+ while (true) {
+ if ((_mouseButtons == kMouseLeftUp) && selectedItem > 0)
+ break;
+
updateInput();
if ((_mousePos.x > MENUITEMS_X) && (_mousePos.x < (MENUITEMS_X+MENUITEM_WIDTH)) && (_mousePos.y > MENUITEMS_Y)) {
selectedItem = (_mousePos.y - MENUITEMS_Y) / MENUITEM_HEIGHT;
+
+ if (!(selectedItem < availItems))
+ selectedItem = -1;
} else
selectedItem = -1;
+
if (selectedItem != oldSelectedItem) {
- if (selectedItem >= 0 && selectedItem < 7)
+ if (selectedItem >= 0 && selectedItem < availItems)
invertMenuItem(_menuItems[selectedItem]);
- if (oldSelectedItem >= 0 && oldSelectedItem < 7)
+ if (oldSelectedItem >= 0 && oldSelectedItem < availItems)
invertMenuItem(_menuItems[oldSelectedItem]);
Common::Rect r(MENUITEM_WIDTH, MENUITEM_HEIGHT);
- for (uint i = 0; i < 7; i++) {
+ for (int i = 0; i < availItems; i++) {
r.moveTo(MENUITEMS_X, MENUITEMS_Y + i * 20);
_gfx->copyRect(Gfx::kBitFront, r, (byte*)_menuItems[i].pixels, _menuItems[i].pitch);
}
@@ -200,22 +234,13 @@
info->bg.free();
delete info;
- for (uint i = 0; i < 7; i++)
+ for (int i = 0; i < availItems; i++)
_menuItems[i].free();
- return selectedItem;
+ return options[selectedItem];
}
-void Parallaction_br::initGame() {
- splash("dyna");
- splash("core");
-
- return;
-}
-
-
-
void Parallaction_br::initFonts() {
// TODO: find out which font is used for labels
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list