Exemplo n.º 1
0
bool AdResponseBox::listen(BaseScriptHolder *param1, uint32 param2) {
    UIObject *obj = (UIObject *)param1;

    switch (obj->_type) {
    case UI_BUTTON:
        if (scumm_stricmp(obj->getName(), "prev") == 0) {
            _scrollOffset--;
        } else if (scumm_stricmp(obj->getName(), "next") == 0) {
            _scrollOffset++;
        } else if (scumm_stricmp(obj->getName(), "response") == 0) {
            if (_waitingScript) {
                _waitingScript->_stack->pushInt(_responses[param2]->getID());
            }
            handleResponse(_responses[param2]);
            _waitingScript = nullptr;
            _gameRef->_state = GAME_RUNNING;
            ((AdGame *)_gameRef)->_stateEx = GAME_NORMAL;
            _ready = true;
            invalidateButtons();
            clearResponses();
        } else {
            return BaseObject::listen(param1, param2);
        }
        break;
    default:
        error("AdResponseBox::Listen - Unhandled enum");
    }

    return STATUS_OK;
}
Exemplo n.º 2
0
bool AdInventoryBox::listen(BaseScriptHolder *param1, uint32 param2) {
	UIObject *obj = (UIObject *)param1;

	switch (obj->_type) {
	case UI_BUTTON:
		if (scumm_stricmp(obj->getName(), "close") == 0) {
			_visible = false;
		} else if (scumm_stricmp(obj->getName(), "prev") == 0) {
			_scrollOffset -= _scrollBy;
			_scrollOffset = MAX<int32>(_scrollOffset, 0);
		} else if (scumm_stricmp(obj->getName(), "next") == 0) {
			_scrollOffset += _scrollBy;
		} else {
			return BaseObject::listen(param1, param2);
		}
		break;
	default:
		error("AdInventoryBox::Listen - Unhandled enum");
		break;
	}

	return STATUS_OK;
}