Example #1
0
void AGOSEngine::defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *itemPtr) {
	HitArea *ha;
	undefineBox(id);

	ha = findEmptyHitArea();
	ha->x = x;
	ha->y = y;
	ha->width = width;
	ha->height = height;
	ha->flags = flags | kBFBoxInUse;
	ha->id = ha->priority = id;
	ha->verb = verb;
	ha->itemPtr = itemPtr;

	if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
		ha->data = _hyperLink;
		ha->priority = 50;
	}

	_needHitAreaRecalc++;
}
Example #2
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();
}