Skip to content

Commit

Permalink
Merge pull request #266 from yaz0r/master
Browse files Browse the repository at this point in the history
Fix system menu in OS
  • Loading branch information
yaz0r committed Aug 14, 2012
2 parents 54e6283 + 92df76f commit 8fff7e2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
2 changes: 2 additions & 0 deletions engines/cine/cine.cpp
Expand Up @@ -189,6 +189,8 @@ void CineEngine::initialize() {
g_cine->_messageTable.clear();
resetObjectTable();

disableSystemMenu = 1;

var8 = 0;

var2 = var3 = var4 = var5 = 0;
Expand Down
15 changes: 9 additions & 6 deletions engines/cine/gfx.cpp
Expand Up @@ -249,14 +249,17 @@ void FWRenderer::drawCommand() {
unsigned int i;
int x = 10, y = _cmdY;

drawPlainBox(x, y, 301, 11, 0);
drawBorder(x - 1, y - 1, 302, 12, 2);
if(disableSystemMenu == 0)
{
drawPlainBox(x, y, 301, 11, 0);
drawBorder(x - 1, y - 1, 302, 12, 2);

x += 2;
y += 2;
x += 2;
y += 2;

for (i = 0; i < _cmd.size(); i++) {
x = drawChar(_cmd[i], x, y);
for (i = 0; i < _cmd.size(); i++) {
x = drawChar(_cmd[i], x, y);
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions engines/cine/main_loop.cpp
Expand Up @@ -121,7 +121,7 @@ static void processEvent(Common::Event &event) {
}
break;
case Common::KEYCODE_F10:
if (!disableSystemMenu && !inMenu) {
if (!inMenu) {
g_cine->makeSystemMenu();
}
break;
Expand Down Expand Up @@ -384,8 +384,8 @@ void CineEngine::mainLoop(int bootScriptIdx) {
playerAction = false;

_messageLen <<= 3;
if (_messageLen < 0x800)
_messageLen = 0x800;
if (_messageLen < 800)
_messageLen = 800;

do {
manageEvents();
Expand Down
2 changes: 1 addition & 1 deletion engines/cine/script_fw.cpp
Expand Up @@ -1861,7 +1861,7 @@ int FWScript::o1_disableSystemMenu() {
byte param = getNextByte();

debugC(5, kCineDebugScript, "Line: %d: disableSystemMenu(%d)", _line, param);
disableSystemMenu = (param != 0);
disableSystemMenu = param;
return 0;
}

Expand Down
21 changes: 12 additions & 9 deletions engines/cine/various.cpp
Expand Up @@ -36,7 +36,7 @@

namespace Cine {

bool disableSystemMenu = false;
int16 disableSystemMenu = 0;
bool inMenu;

int16 commandVar3[4];
Expand Down Expand Up @@ -341,7 +341,7 @@ void CineEngine::makeSystemMenu() {
int16 mouseX, mouseY, mouseButton;
int16 selectedSave;

if (!disableSystemMenu) {
if (disableSystemMenu != 1) {
inMenu = true;

do {
Expand Down Expand Up @@ -544,14 +544,16 @@ int16 buildObjectListCommand(int16 param) {

int16 selectSubObject(int16 x, int16 y, int16 param) {
int16 listSize = buildObjectListCommand(param);
int16 selectedObject;
int16 selectedObject = -1;
bool osExtras = g_cine->getGameType() == Cine::GType_OS;

if (!listSize) {
return -2;
}

selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140, osExtras);
if (disableSystemMenu == 0) {
selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140, osExtras);
}

if (selectedObject == -1)
return -1;
Expand Down Expand Up @@ -691,9 +693,6 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
int16 var_4;
SelectionMenu *menu;

if (disableSystemMenu)
return -1;

paramY = (height * 9) + 10;

if (X + width > 319) {
Expand Down Expand Up @@ -810,14 +809,18 @@ void makeActionMenu() {
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);

if (g_cine->getGameType() == Cine::GType_OS) {
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true);
if(disableSystemMenu == 0) {
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true);
}

if (playerCommand >= 8000) {
playerCommand -= 8000;
canUseOnObject = canUseOnItemTable[playerCommand];
}
} else {
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
if(disableSystemMenu == 0) {
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
}
}

inMenu = false;
Expand Down
2 changes: 1 addition & 1 deletion engines/cine/various.h
Expand Up @@ -41,7 +41,7 @@ void makeActionMenu();
void waitPlayerInput();
void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4);

extern bool disableSystemMenu;
extern int16 disableSystemMenu;
extern bool inMenu;

extern CommandeType currentSaveName[10];
Expand Down

0 comments on commit 8fff7e2

Please sign in to comment.