Beispiel #1
0
void AGOSEngine::unlightMenuStrip() {
    byte *src;
    int w, h, i;

    mouseOff();

    Graphics::Surface *screen = _system->lockScreen();
    src = (byte *)screen->pixels + 8 * screen->pitch + 272;
    w = 48;
    h = 82;

    do {
        for (i = 0; i != w; ++i) {
            if (src[i] != 0)
                src[i] = 14;
        }
        src += screen->pitch;
    } while (--h);

    for (i = 120; i != 130; i++)
        disableBox(i);

    _system->unlockScreen();

    mouseOn();
}
Beispiel #2
0
void AGOSEngine::o_doIcons() {
	// 114
	Item *item = getNextItemPtr();
	uint num = getVarOrByte();
	mouseOff();
	drawIconArray(num, item, 0, 0);
	mouseOn();
}
Beispiel #3
0
void AGOSEngine::inventoryUp(WindowBlock *window) {
	if (window->iconPtr->line == 0)
		return;

	mouseOff();
	uint index = getWindowNum(window);
	drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
	mouseOn();
}
Beispiel #4
0
void AGOSEngine::o_cls() {
	// 103
	mouseOff();
	removeIconArray(_curWindow);
	showMessageFormat("\x0C");
	_oracleMaxScrollY = 0;
	_noOracleScroll = 0;
	mouseOn();
}
Beispiel #5
0
void AGOSEngine_Elvira2::oe2_drawItem() {
	// 113: draw item
	Item *i = getNextItemPtr();
	int a = getVarOrByte();
	int x = getVarOrWord();
	int y = getVarOrWord();
	mouseOff();
	drawIcon(_windowArray[a % 8], itemGetIconNumber(i), x, y);
	mouseOn();
}
Beispiel #6
0
void AGOSEngine::tidyIconArray(uint i) {
	WindowBlock *window;

	if (_fcsData2[i]) {
		mouseOff();
		window = _windowArray[i];
		drawIconArray(i, window->iconPtr->itemRef, window->iconPtr->line, window->iconPtr->classMask);
		_fcsData2[i] = 0;
		mouseOn();
	}
}
Beispiel #7
0
void AGOSEngine::o_doClassIcons() {
	// 126: do class icons
	Item *item = getNextItemPtr();
	uint num = getVarOrByte();
	uint a = getVarOrByte();

	mouseOff();
	if (getGameType() == GType_ELVIRA1)
		drawIconArray(num, item, 0, a);
	else
		drawIconArray(num, item, 0, 1 << a);
	mouseOn();
}
Beispiel #8
0
void AGOSEngine::lightMenuStrip(int a) {
    mouseOff();
    unlightMenuStrip();

    for (int i = 0; i != 10; i++) {
        if (a & (1 << i)) {
            enableBox(120 + i);
            lightMenuBox(120 + i);
        }
    }

    mouseOn();
}
Beispiel #9
0
void AGOSEngine_Elvira2::printStats() {
	WindowBlock *window = _dummyWindow;
	int val;
	const uint8 y = (getPlatform() == Common::kPlatformAtariST) ? 132 : 134;

	window->flags = 1;

	mouseOff();

	// Level
	val = _variableArray[20];
	if (val < -99)
		val = -99;
	if (val > 99)
		val = 99;
	writeChar(window, 10, y, 0, val);

	// PP
	val = _variableArray[22];
	if (val < -99)
		val = -99;
	if (val > 99)
		val = 99;
	writeChar(window, 16, y, 6, val);

	// HP
	val = _variableArray[23];
	if (val < -99)
		val = -99;
	if (val > 99)
		val = 99;
	writeChar(window, 23, y, 4, val);

	// Experience
	val = _variableArray[21];
	if (val < -99)
		val = -99;
	if (val > 9999)
		val = 9999;
	writeChar(window, 30, y, 6, val / 100);
	writeChar(window, 32, y, 2, val % 100);

	mouseOn();
}
Beispiel #10
0
void AGOSEngine_FeebleDemo::waitForSpace() {
    const char *message;

    if (_language == Common::DE_DEU) {
        message = "Dr\x81""cken Sie die <Leertaste>, um fortzufahren...";
    } else {
        message = "Press <SPACE> to continue...";
    }

    windowPutChar(_textWindow, 12);
    for (; *message; message++)
        windowPutChar(_textWindow, *message);

    mouseOff();
    do {
        delay(1);
    } while (!shouldQuit() && (_keyPressed.keycode != Common::KEYCODE_SPACE));
    _keyPressed.reset();
    mouseOn();
}
Beispiel #11
0
void AGOSEngine::itemChildrenChanged(Item *item) {
	int i;
	WindowBlock *window;

	if (_noParentNotify)
		return;

	mouseOff();

	for (i = 0; i != 8; i++) {
		window = _windowArray[i];
		if (window && window->iconPtr && window->iconPtr->itemRef == item) {
			if (_fcsData1[i]) {
				_fcsData2[i] = true;
			} else {
				_fcsData2[i] = false;
				drawIconArray(i, item, window->iconPtr->line, window->iconPtr->classMask);
			}
		}
	}

	mouseOn();
}
Beispiel #12
0
void AGOSEngine::lightMenuBox(uint hitarea) {
    HitArea *ha = findBox(hitarea);
    byte *src;
    int w, h, i;

    mouseOff();

    Graphics::Surface *screen = _system->lockScreen();
    src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x;
    w = ha->width;
    h = ha->height;

    do {
        for (i = 0; i != w; ++i) {
            if (src[i] == 14)
                src[i] = 15;
        }
        src += screen->pitch;
    } while (--h);

    _system->unlockScreen();

    mouseOn();
}
Beispiel #13
0
void AGOSEngine::inventoryDown(WindowBlock *window) {
	mouseOff();
	uint index = getWindowNum(window);
	drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
	mouseOn();
}
Beispiel #14
0
// Elvira 1 specific
void AGOSEngine::drawMenuStrip(uint windowNum, uint menuNum) {
    WindowBlock *window = _windowArray[windowNum % 8];

    mouseOff();

    byte *srcPtr = _menuBase;
    int menu = (menuNum != 0) ? menuNum * 4 + 1 : 0;

    while (menu--) {
        if (READ_LE_UINT16(srcPtr) != 0xFFFF) {
            srcPtr += 2;
            while (*srcPtr != 0)
                srcPtr++;
            srcPtr++;
        } else {
            srcPtr += 2;
        }
    }

    clearWindow(window);

    int newline = 0;
    while (READ_LE_UINT16(srcPtr) != 0xFFFF) {
        byte *tmp = srcPtr;
        srcPtr += 2;

        if (newline != 0) {
            windowPutChar(window, 10);
        }

        uint len = 0;
        while (*srcPtr != 0 && *srcPtr != 1) {
            len++;
            srcPtr++;
        }
        if (*srcPtr == 1)
            srcPtr++;

        uint maxLen = window->textMaxLength - len;

        if (window->flags & 1)
            window->textColumnOffset += 4;

        maxLen /= 2;
        while (maxLen--)
            windowPutChar(window, 32);

        srcPtr = tmp;
        uint verb = READ_BE_UINT16(srcPtr);
        srcPtr += 2;

        while (*srcPtr != 0) {
            windowPutChar(window, *srcPtr++);
        }
        srcPtr++;

        if (verb != 0xFFFE) {
            HitArea *ha = findEmptyHitArea();
            ha->x = window->x * 8 + 3;
            ha->y = window->textRow * 8 + window->y;
            ha->data = menuNum;
            ha->width = window->width * 8 - 6;
            ha->height = 7;
            ha->flags = kBFBoxInUse | kBFInvertTouch;
            ha->id = 30000;
            ha->priority = 1;
            ha->verb = verb;
        }

        newline = 0xFFFF;
    }

    mouseOn();
}
Beispiel #15
0
int CruiseEngine::processInput() {
	int16 mouseX = 0;
	int16 mouseY = 0;
	int16 button = 0;

	/*if (inputSub1keyboad())
	 * {
	 * return 1;
	 * } */

	button = 0;

	if (sysKey != -1) {
		button = sysKey;
		mouseX = sysX;
		mouseY = sysY;
		sysKey = -1;
	} else if (automaticMode == 0) {
		getMouseStatus(&main10, &mouseX, &button, &mouseY);
	}

	if (!button) {
		buttonDown = 0;
	}

	// Check for Exit 'X' key
	if (keyboardCode == Common::KEYCODE_x)
		return 1;

	// Check for Pause 'P' key
	if (keyboardCode == Common::KEYCODE_p) {
		keyboardCode = Common::KEYCODE_INVALID;
		_vm->pauseEngine(true);
		mouseOff();

		bool pausedButtonDown = false;
		while (!_vm->shouldQuit()) {
			manageEvents();
			getMouseStatus(&main10, &mouseX, &button, &mouseY);

			if (button) pausedButtonDown = true;
			else if (pausedButtonDown)
				// Button released, so exit pause
				break;
			else if (keyboardCode != Common::KEYCODE_INVALID)
				break;

			g_system->delayMillis(10);
		}

		if (keyboardCode == Common::KEYCODE_x)
			// Exit the game
			return 1;

		keyboardCode = Common::KEYCODE_INVALID;
		_vm->pauseEngine(false);
		mouseOn();
		return 0;
	}

	// Player Menu - test for both buttons or the F10 key
	if (((button & CRS_MB_BOTH) == CRS_MB_BOTH) || (keyboardCode == Common::KEYCODE_F10)) {
		changeCursor(CURSOR_NORMAL);
		keyboardCode = Common::KEYCODE_INVALID;
		return (playerMenu(mouseX, mouseY));
	}

	if (userWait) {
		// Check for left mouse button click or Space to end user waiting
		if ((keyboardCode == Common::KEYCODE_SPACE) || (button == CRS_MB_LEFT))
			userWait = 0;

		keyboardCode = Common::KEYCODE_INVALID;
		return 0;
	}

	// Handle any changes in game speed
	if (_speedFlag) {
		if ((keyboardCode == Common::KEYCODE_KP_PLUS) && (_gameSpeed >= 30)) {
			_gameSpeed -= 10;
			keyboardCode = Common::KEYCODE_INVALID;
		}
		if ((keyboardCode == Common::KEYCODE_KP_MINUS) && (_gameSpeed <= 200)) {
			_gameSpeed += 10;
			keyboardCode = Common::KEYCODE_INVALID;
		}
	}

	if (!userEnabled) {
		return 0;
	}

	if ((currentActiveMenu != -1) && menuTable[currentActiveMenu]) {
		updateMenuMouse(mouseX, mouseY, menuTable[currentActiveMenu]);
	}

	if (dialogueEnabled) {

		if (menuDown || selectDown || linkedRelation) {
			closeAllMenu();
			menuDown = 0;
			selectDown = 0;
			currentActiveMenu = -1;
			changeCursor(CURSOR_NORMAL);
		}

		if ((menuTable[0] == NULL) && (!buttonDown)) {
			int dialogFound = createDialog(dialogueOvl, dialogueObj, xdial, 0);

			if (menuTable[0]) {
				if (dialogFound) {
					currentActiveMenu = 0;
				} else {
					freeMenu(menuTable[0]);
					menuTable[0] = NULL;
					currentActiveMenu = -1;
				}
			} else {
				menuDown = 0;
			}
		} else {
			if ((button & CRS_MB_LEFT) && (buttonDown == 0)) {
				if (menuTable[0]) {
					callRelation(getSelectedEntryInMenu(menuTable[0]), dialogueObj);

					freeMenu(menuTable[0]);
					menuTable[0] = NULL;

					if (linkedMsgList) {
						ASSERT(0);
						//					freeMsgList(linkedMsgList);
					}

					linkedMsgList = NULL;
					linkedRelation = NULL;

					changeCursor(CURSOR_NORMAL);
					currentActiveMenu = -1;
				}
				buttonDown = 1;
			}
		}

	} else if ((button & CRS_MB_LEFT) && (buttonDown == 0)) {
		// left click
		buttonDown = 1;

		// is there a relation
		if (linkedRelation) {
			// call sub relation when clicking on an object
			if (menuDown == 0) {
				if (menuTable[0]) {
					int objOvl;
					int objIdx;
					int objType;

					objType = findObject(mouseX, mouseY, &objOvl, &objIdx);

					if (objType != -1) {
						callSubRelation(linkedRelation, objOvl, objIdx);
					}
					freeMenu(menuTable[0]);
					menuTable[0] = NULL;
				}

				if (linkedMsgList) {
//					freeMsgList(linkedMsgList);
				}
				linkedMsgList = NULL;
				linkedRelation = NULL;
				changeCursor(CURSOR_NORMAL);
			} else { // call sub relation when clicking in inventory
				if (menuTable[0] && menuTable[1]) {
					menuElementSubStruct * p0 = getSelectedEntryInMenu(menuTable[1]);

					if (p0)
						callSubRelation(linkedRelation, p0->ovlIdx, p0->header);

					closeAllMenu();
					changeCursor(CURSOR_NORMAL);
				}
			}
			selectDown = 0;
			menuDown = 0;
		} else {
			// manage click on object menu
			if (menuDown == 0) {
				// Handle left click on an object
				if (menuTable[0] == 0) {
					int objOvl;
					int objIdx;
					int objType;

					objType = findObject(mouseX, mouseY, &objOvl, &objIdx);

					if (objType != -1) {
						int relation = findRelation(objOvl, objIdx, mouseX, mouseY);
						if (menuTable[0]) {
							if (relation) {
								currentActiveMenu = 0;
								selectDown = 1;
							} else {
								// object has a name but no relation, just move the character
								freeMenu(menuTable[0]);
								menuTable[0] = NULL;

								aniX = mouseX;
								aniY = mouseY;
								animationStart = true;
							}
						} else {
							aniX = mouseX;
							aniY = mouseY;
							animationStart = true;
						}
					} else {
						// No object found, we move the character to the cursor
						aniX = mouseX;
						aniY = mouseY;
						animationStart = true;
					}
				} else {
					// handle click in menu
					if (menuTable[0]) {
						menuElementSubStruct *pMenuElementSub = getSelectedEntryInMenu(menuTable[0]);

						callRelation(pMenuElementSub, -1);

						// if there is a linked relation, close menu
						if (!linkedRelation) {
							freeMenu(menuTable[0]);
							menuTable[0] = NULL;
							changeCursor(CURSOR_NORMAL);
						} else { // else create the message for the linked relation
							char text[80];
							strcpy(text, menuTable[0]->stringPtr);
							strcat(text, ":");
							strcat(text, currentMenuElement->string);
							linkedMsgList = renderText(320, (const char *)text);
							changeCursor(CURSOR_CROSS);
						}
					}

					currentActiveMenu = -1;
					selectDown = 0;
				}
			} else {
				// Handle left click in inventory
				if (processInventory()) {
					currentActiveMenu = 0;
					selectDown = 1;
					menuDown = 0;
				} else {
					currentActiveMenu = -1;
					menuDown = 0;
				}
			}
		}
	} else if ((button & CRS_MB_RIGHT) || (keyboardCode == Common::KEYCODE_F9)) {
		if (buttonDown == 0) {
			keyboardCode = Common::KEYCODE_INVALID;

			// close object menu if there is no linked relation
			if ((linkedRelation == 0) && (menuTable[0])) {
				freeMenu(menuTable[0]);
				menuTable[0] = NULL;
				selectDown = 0;
				menuDown = 0;
				currentActiveMenu = -1;
			}

			if ((!selectDown) && (!menuDown) && (menuTable[1] == NULL)) {
				buildInventory(mouseX, mouseY);

				if (menuTable[1]) {
					currentActiveMenu = 1;
					menuDown = 1;
				} else {
					menuDown = 1;
				}
			}
			buttonDown = 1;
		}
	}

	return 0;
}