Skip to content

Commit

Permalink
HOPKINS: Bugfixes to making menu selections, and quitting game
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 22, 2012
1 parent 1597aff commit e0c9eea
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 50 deletions.
8 changes: 5 additions & 3 deletions engines/hopkins/events.cpp
Expand Up @@ -95,7 +95,7 @@ int EventsManager::YMOUSE() {
souris_x = start_x + g_system->getEventManager()->getMousePos().x;
souris_y = g_system->getEventManager()->getMousePos().y;

return souris_x + ofset_souris_x;
return souris_y + ofset_souris_y;
}

bool EventsManager::BMOUSE() {
Expand Down Expand Up @@ -215,10 +215,12 @@ void EventsManager::pollEvents() {
return;

case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
souris_bb = true;
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:

souris_bb = false;
return;

default:
Expand Down
20 changes: 7 additions & 13 deletions engines/hopkins/hopkins.cpp
Expand Up @@ -841,7 +841,8 @@ void HopkinsEngine::PERSONAGE2(const Common::String &s1, const Common::String &s
}

void HopkinsEngine::REST_SYSTEM() {
warning("REST_SYSTEM");
quitGame();
_eventsManager.CONTROLE_MES();
}

void HopkinsEngine::PLAN_BETA() {
Expand Down Expand Up @@ -874,18 +875,11 @@ void HopkinsEngine::PUBQUIT() {
if (_eventsManager.BMOUSE() == 1)
mouseClicked = true;
} while (!mouseClicked && !g_system->getEventManager()->shouldQuit());

if ((unsigned int)(xp - 167) <= 302 && (unsigned int)(yp - 47) <= 387) {
warning("Try to Connect...");
_eventsManager.delay(25000);
// open_URL((int)"http://www.hopkinsfbi.com");

while (1) {
_globals.iRegul = 10;
_graphicsManager.VBL();
}
}
return _graphicsManager.FADE_OUTW();

// Original tried to open a web browser link here. Since ScummVM doesn't support
// that, it's being skipped in favour of simply exitting

_graphicsManager.FADE_OUTW();
}

void HopkinsEngine::COMPUT_HOPKINS(int a1) {
Expand Down
67 changes: 33 additions & 34 deletions engines/hopkins/menu.cpp
Expand Up @@ -22,6 +22,7 @@

#include "common/scummsys.h"
#include "common/events.h"
#include "common/util.h"
#include "hopkins/menu.h"
#include "hopkins/files.h"
#include "hopkins/hopkins.h"
Expand All @@ -36,18 +37,18 @@ void MenuManager::setParent(HopkinsEngine *vm) {
_vm = vm;
}

enum MenuSelection { MENU_NONE = 0, PLAY_GAME = 1, LOAD_GAME = 2, OPTIONS = 3, INTRODUCTION = 4, QUIT = 5 };

int MenuManager::MENU() {
byte *spriteData = NULL;
signed int menuIndex;
int v3;
int v4;
MenuSelection menuIndex;
Common::Point mousePos;
signed int v6;
signed __int16 v7;
signed __int16 v8;
signed __int16 v9;
signed __int16 v10;
__int16 v11;
signed int v12;

v6 = 0;
while (!g_system->getEventManager()->shouldQuit()) {
Expand Down Expand Up @@ -93,74 +94,72 @@ int MenuManager::MENU() {
for (;;) {
for (;;) {
_vm->_soundManager.WSOUND(28);
v12 = 0;

// Loop to make menu selection
bool selectionMade = false;
do {
if (g_system->getEventManager()->shouldQuit())
return -1;

menuIndex = 0;
v3 = _vm->_eventsManager.XMOUSE();
v4 = _vm->_eventsManager.YMOUSE();
menuIndex = MENU_NONE;
mousePos = Common::Point(_vm->_eventsManager.XMOUSE(), _vm->_eventsManager.YMOUSE());

if ((unsigned int)(v3 - 232) <= 176) {
if ((unsigned int)(v4 - 261) <= 23)
menuIndex = 1;
if ((unsigned int)(v4 - 293) <= 23)
menuIndex = 2;
if ((unsigned int)(v4 - 325) <= 22)
menuIndex = 3;
if ((unsigned int)(v4 - 356) <= 23)
menuIndex = 4;
if (ABS(mousePos.x - 232) <= 176) {
if (ABS(mousePos.y - 261) <= 23)
menuIndex = PLAY_GAME;
if (ABS(mousePos.y - 293) <= 23)
menuIndex = LOAD_GAME;
if (ABS(mousePos.y - 325) <= 22)
menuIndex = OPTIONS;
if (ABS(mousePos.y - 356) <= 23)
menuIndex = INTRODUCTION;

if ((unsigned int)(v4 - 388) <= 23)
menuIndex = 5;
if (ABS(mousePos.y - 388) <= 23)
menuIndex = QUIT;
}

switch (menuIndex) {
case 0:
case MENU_NONE:
v11 = 0;
v10 = 0;
v9 = 0;
v8 = 0;
v7 = 0;
break;
case 1:
case PLAY_GAME:
v11 = 1;
v10 = 0;
v9 = 0;
v8 = 0;
v7 = 0;
break;
case 2:
case LOAD_GAME:
v11 = 0;
v10 = 1;
v9 = 0;
v8 = 0;
v7 = 0;
break;
case 3:
case OPTIONS:
v11 = 0;
v10 = 0;
v9 = 1;
v8 = 0;
v7 = 0;
break;
case 4:
case INTRODUCTION:
v11 = 0;
v10 = 0;
v9 = 0;
v8 = 1;
v7 = 0;
break;
case 5:
case QUIT:
v11 = 0;
v10 = 0;
v9 = 0;
v8 = 0;
v7 = 1;
default:
break;
}

_vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, v11);
Expand All @@ -170,17 +169,17 @@ int MenuManager::MENU() {
_vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, v7 + 8);
_vm->_graphicsManager.VBL();

if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex > 0)
v12 = 1;
} while (v12 != 1);
if (_vm->_eventsManager.BMOUSE() == 1 && menuIndex != MENU_NONE)
selectionMade = 1;
} while (!selectionMade);

if (menuIndex == 1) {
if (menuIndex == PLAY_GAME) {
_vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 259, 10);
_vm->_graphicsManager.VBL();
_vm->_eventsManager.delay(200);
v6 = 1;
}
if (menuIndex != 2)
if (menuIndex != LOAD_GAME)
break;

_vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 291, 11);
Expand All @@ -206,15 +205,15 @@ int MenuManager::MENU() {

CHOICE_OPTION();
}
if (menuIndex == 4) {
if (menuIndex == INTRODUCTION) {
_vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 354, 13);
_vm->_graphicsManager.VBL();
_vm->_eventsManager.delay(200);
_vm->INTRORUN();
continue;
}

if ( menuIndex == 5 ) {
if ( menuIndex == QUIT) {
_vm->_graphicsManager.AFFICHE_SPEED(spriteData, 230, 386, 14);
_vm->_graphicsManager.VBL();
_vm->_eventsManager.delay(200);
Expand Down

0 comments on commit e0c9eea

Please sign in to comment.