Пример #1
0
uint32 Scene1609::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case 0x0001:
		if (param.asPoint().x <= 20 || param.asPoint().x >= 620)
			leaveScene(0);
		break;
	case 0x2000:
		if (!_isSolved) {
			if (_changeCurrentSymbol)
				_asSymbols[_symbolPosition]->change(_currentSymbolIndex + 12, false);
			_asSymbols[_symbolPosition]->stopSymbolSound();
			_symbolPosition++;
			if (_symbolPosition >= 12) {
				if (testVars()) {
					playSound(0);
					setGlobalVar(V_CODE_SYMBOLS_SOLVED, 1);
					_isSolved = true;
				} else {
					_symbolPosition = 0;
					for (int i = 0; i < 12; i++)
						_asSymbols[i]->hide();
				}
			}
			_changeCurrentSymbol = true;
			_countdown1 = 1;
		}
		break;
	}
	return 0;
}
Пример #2
0
uint32 Mouse::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	debug(7, "Mouse::handleMessage(%04X)", messageNum);
	uint32 messageResult = Sprite::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case 0x2064:
		_x = param.asPoint().x;
		_y = param.asPoint().y;
		switch (_type) {
		case 1:
			if (_x >= 320)
				messageResult = 1;
			else
				messageResult = 0;
			break;
		case 2:
		default:
			if (_x < 100)
				messageResult = 0;
			else if (_x > 540)
				messageResult = 1;
			else
				messageResult = 2;
			break;
		case 3:
			if (_x < 100)
				messageResult = 0;
			else if (_x > 540)
				messageResult = 1;
			else
				messageResult = 4;
			break;
		case 4:
			if (_x < 100)
				messageResult = 0;
			else if (_x > 540)
				messageResult = 1;
			else if (_y >= 150)
				messageResult = 2;
			else
				messageResult = 3;
			break;
		case 5:
			if (_y >= 240)
				messageResult = 4;
			else
				messageResult = 3;
			break;
		}
		break;
	case 0x4002:
		_x = param.asPoint().x;
		_y = param.asPoint().y;
		updateCursorNum();
		updateBounds();
		break;
	}
	return messageResult;
}
Пример #3
0
uint32 StaticScene::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
    Scene::handleMessage(messageNum, param, sender);
    switch (messageNum) {
    case 0x0001:
        if (param.asPoint().x <= 20 || param.asPoint().x >= 620)
            leaveScene(0);
        break;
    }
    return 0;
}
Пример #4
0
uint32 Scene1202::hmSolved(int messageNum, const MessageParam &param, Entity *sender) {
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case NM_MOUSE_CLICK:
		if (param.asPoint().x <= 20 || param.asPoint().x >= 620)
			leaveScene(0);
		break;
	}
	return 0;
}
Пример #5
0
uint32 Scene1202::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	uint32 messageResult = 0;
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case NM_MOUSE_CLICK:
		if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) && !_isPuzzleSolved)
			leaveScene(0);
		break;
	case NM_ANIMATION_UPDATE:
		_clickedIndex = (int)param.asInteger();
		break;
	case NM_POSITION_CHANGE:
		_counter--;
		break;
	}
	return messageResult;
}
Пример #6
0
uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam &param) {
	uint32 messageResult = 0;
	switch (messageNum) {
	case NM_ANIMATION_UPDATE:
		_isSittingInTeleporter = param.asInteger() != 0;
		messageResult = 1;
		break;
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case NM_KLAYMEN_STAND_IDLE:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stSitIdleTeleporter);
		else
			GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4804:
		if (param.asInteger() != 0) {
			_destX = param.asInteger();
			GotoState(&Klaymen::stWalkingFirst);
		} else
			GotoState(&Klaymen::stPeekWall);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case NM_KLAYMEN_TURN_TO_USE:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stTurnToUseInTeleporter);
		break;
	case NM_KLAYMEN_RETURN_FROM_USE:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stReturnFromUseInTeleporter);
		break;
	case 0x4834:
		GotoState(&Klaymen::stStepOver);
		break;
	case 0x4835:
		sendMessage(_parentScene, 0x2000, 1);
		_isSittingInTeleporter = true;
		GotoState(&Klaymen::stSitInTeleporter);
		break;
	case 0x4836:
		sendMessage(_parentScene, 0x2000, 0);
		_isSittingInTeleporter = false;
		GotoState(&Klaymen::stGetUpFromTeleporter);
		break;
	case 0x483D:
		teleporterAppear(0x2C2A4A1C);
		break;
	case 0x483E:
		teleporterDisappear(0x3C2E4245);
		break;
	}
	return messageResult;
}
Пример #7
0
uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam &param) {
	switch (messageNum) {
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4812:
		if (param.asInteger() == 2)
			GotoState(&Klaymen::stPickUpNeedle);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stPickUpTube);
		else
			GotoState(&Klaymen::stPickUpGeneric);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case 0x481F:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stTurnAwayFromUse);
		else if (param.asInteger() == 0)
			GotoState(&Klaymen::stTurnToUseHalf);
		else
			GotoState(&Klaymen::stWonderAbout);
		break;
	case 0x483F:
		startSpecialWalkRight(param.asInteger());
		break;
	case 0x4840:
		startSpecialWalkLeft(param.asInteger());
		break;
	}
	return 0;
}
Пример #8
0
uint32 Scene::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
    switch (messageNum) {
    case 0x0000: // mouse moved
        if (_mouseCursor && _mouseCursor->hasMessageHandler())
            sendMessage(_mouseCursor, 0x4002, param);
        break;
    case 0x0001: // mouse clicked
        _mouseClicked = true;
        _mouseClickPos = param.asPoint();
        break;
    case 0x0006:
        sendMessage(_parentModule, 0x1009, param);
        break;
    case 0x1006:
        // Sent by Klaymen when its animation sequence has finished
        if (_isKlaymenBusy) {
            _isKlaymenBusy = false;
            if (_messageListIndex == _messageListCount) {
                // If the current message list was processed completely,
                // sent Klaymen into the idle state.
                sendMessage(_klaymen, 0x4004, 0);
            } else {
                // Else continue with the next message in the current message list
                processMessageList();
            }
        }
        break;
    case 0x1007:
        // This isn't sent by any code, check if it's in a message list
        // This cancels the current message list and sets Klaymen into the idle state.
        if (_isKlaymenBusy) {
            _isKlaymenBusy = false;
            _messageList = NULL;
            sendMessage(_klaymen, 0x4004, 0);
        }
        break;
    case 0x101D:
        // Hide the mouse cursor
        if (_mouseCursor) {
            _mouseCursorWasVisible = _mouseCursor->getSurface()->getVisible();
            _mouseCursor->getSurface()->setVisible(false);
        }
        break;
    case 0x101E:
        // Show the mouse cursor
        if (_mouseCursorWasVisible && _mouseCursor) {
            _mouseCursor->getSurface()->setVisible(true);
        }
        break;
    case 0x1022:
        // Set the sender's surface priority
        setSurfacePriority(((Sprite*)sender)->getSurface(), param.asInteger());
        break;
    }
    return 0;
}
Пример #9
0
uint32 Scene2609::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case 0x0001:
		if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) && !_isBusy)
			leaveScene(0);
		break;
	case 0x2000:
		_isBusy = true;
		break;
	case 0x2001:
		_isBusy = false;
		sendMessage(_asWater, 0x2001, 0);
		break;
	case 0x2002:
		_isBusy = false;
		sendMessage(_asWater, 0x2002, 0);
		break;
	}
	return 0;
}
Пример #10
0
uint32 Scene2609::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case NM_MOUSE_CLICK:
		if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) && !_isBusy)
			leaveScene(0);
		break;
	case NM_ANIMATION_UPDATE:
		_isBusy = true;
		break;
	case 0x2001:
		_isBusy = false;
		sendMessage(_asWater, 0x2001, 0);
		break;
	case NM_POSITION_CHANGE:
		_isBusy = false;
		sendMessage(_asWater, NM_POSITION_CHANGE, 0);
		break;
	}
	return 0;
}
Пример #11
0
uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	Scene::handleMessage(messageNum, param, sender);
	if (!_inputDisabled) {
		switch (messageNum) {
		case 0x0001:
			if (param.asPoint().x <= 20 || param.asPoint().x >= 620) {
				sendMessage(_parentModule, 0x1009, 0);
			} else if (!_dropKey &&
				param.asPoint().x > 38 && param.asPoint().x < 598 &&
				param.asPoint().y > 400 && param.asPoint().y < 460) {
				
				_diskSlots[_diskIndex]->stop();
				_diskIndex = (param.asPoint().x - 38) / 28;
				_diskSlots[_diskIndex]->activate();
				if (_updateStatus == kUSPlaying) {
					if (_diskAvailable[_diskIndex])
						playDisk();
					else
						playStatic();
				}
			}
			break;
		case 0x2000:
			tuneIn();
			break;			
		case 0x2001:
			stop();
			break;			
		}
	}
	return 0;
}
Пример #12
0
uint32 Scene2901::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case 0x0001:
		if (param.asPoint().x <= 20 || param.asPoint().x >= 620)
			leaveScene((uint32)-1);
		break;
	case 0x2000:
		if (_currLocationButtonNum != _selectedButtonNum)
			leaveScene(_selectedButtonNum);
		break;
	case 0x2001:
		if (_currLocationButtonNum == _selectedButtonNum)
			_selectedButtonNum = _currWhirlButtonNum;
		_ssLocationButtonLights[_selectedButtonNum]->hide();
		_selectedButtonNum = param.asInteger();
		if (!getSubVar(V_TELEPORTER_DEST_AVAILABLE, _selectedButtonNum))
			_selectedButtonNum = _currLocationButtonNum;
		break;
	}
	return 0;
}
Пример #13
0
uint32 Scene1907::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case NM_MOUSE_CLICK:
		if ((param.asPoint().x <= 20 || param.asPoint().x >= 620) &&
			!_hasPlugInFailed && _moveDownCountdown == 0 && _moveUpCountdown == 0 && _countdown3 == 0) {
			leaveScene(0);
		}
		break;
	case NM_ANIMATION_UPDATE:
		if (getGlobalVar(V_STAIRS_DOWN)) {
			playSound(0);
			for (int i = 0; i < 9; i++)
				_asSymbols[i]->moveUp();
			_ssUpDownButton->setToUpPosition();
			setGlobalVar(V_STAIRS_DOWN, 0);
		} else {
			if (!getGlobalVar(V_WALL_BROKEN)) {
				playSound(2);
				_countdown3 = 5;
			} else {
				playSound(1);
				_ssUpDownButton->setToDownPosition();
				setGlobalVar(V_STAIRS_DOWN, 1);
			}
			_moveDownCountdown = 1;
			_currMovingSymbolIndex = 8;
		}
		break;
	case 0x2001:
		playSound(3);
		setGlobalVar(V_STAIRS_PUZZLE_SOLVED, 1);
		break;
	}
	return 0;
}
Пример #14
0
uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam &param) {
	switch (messageNum) {
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4804:
		GotoState(&KmScene1305::stCrashDown);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	}
	return 0;
}
Пример #15
0
uint32 NavigationScene::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
    switch (messageNum) {
    case 0x0000:
        if (_interactive)
            sendMessage(_mouseCursor, 0x4002, param);
        break;
    case 0x0001:
        if (_interactive)
            handleNavigation(param.asPoint());
        break;
    case 0x0009:
        if (!_interactive)
            _smackerDone = true;
        break;
    case 0x3002:
        _smackerDone = true;
        break;
    }
    return 0;
}
Пример #16
0
uint32 KmScene2403::xHandleMessage(int messageNum, const MessageParam &param) {
	uint32 messageResult = 0;
	switch (messageNum) {
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x480D:
		GotoState(&Klaymen::stPullCord);
		break;
	case 0x4812:
		GotoState(&Klaymen::stPickUpGeneric);
		break;
	case 0x4816:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stPressButton);
		else if (param.asInteger() == 2)
			GotoState(&Klaymen::stPressFloorButton);
		else
			GotoState(&Klaymen::stPressButtonSide);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case 0x481F:
		if (param.asInteger() == 0)
			GotoState(&Klaymen::stWonderAboutHalf);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stWonderAboutAfter);
		else if (param.asInteger() == 3)
			GotoState(&Klaymen::stTurnToUseHalf);
		else if (param.asInteger() == 4)
			GotoState(&Klaymen::stTurnAwayFromUse);
		else
			GotoState(&Klaymen::stWonderAbout);
		break;
	case 0x4820:
		sendMessage(_parentScene, 0x2000, 0);
		GotoState(&Klaymen::stContinueClimbLadderUp);
		break;
	case 0x4821:
		sendMessage(_parentScene, 0x2000, 0);
		_destY = param.asInteger();
		GotoState(&Klaymen::stStartClimbLadderDown);
		break;
	case 0x4822:
		sendMessage(_parentScene, 0x2000, 0);
		_destY = param.asInteger();
		GotoState(&Klaymen::stStartClimbLadderUp);
		break;
	case 0x4823:
		sendMessage(_parentScene, 0x2001, 0);
		GotoState(&Klaymen::stClimbLadderHalf);
		break;
	case 0x482D:
		setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
		gotoNextStateExt();
		break;
	case 0x483F:
		startSpecialWalkRight(param.asInteger());
		break;
	case 0x4840:
		startSpecialWalkLeft(param.asInteger());
		break;
	}
	return messageResult;
}
Пример #17
0
uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam &param) {
	uint32 messageResult = 0;
	switch (messageNum) {
	case NM_ANIMATION_UPDATE:
		_isSittingInTeleporter = param.asInteger() != 0;
		messageResult = 1;
		break;
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case NM_KLAYMEN_STAND_IDLE:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stSitIdleTeleporter);
		else
			GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4811:
		GotoState(&KmScene2101::stHitByDoor);
		break;
	case NM_KLAYMEN_PICKUP:
		if (param.asInteger() == 2)
			GotoState(&Klaymen::stPickUpNeedle);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stPickUpTube);
		else
			GotoState(&Klaymen::stPickUpGeneric);
		break;
	case NM_KLAYMEN_PRESS_BUTTON:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stPressButton);
		else if (param.asInteger() == 2)
			GotoState(&Klaymen::stPressFloorButton);
		else
			GotoState(&Klaymen::stPressButtonSide);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case NM_KLAYMEN_TURN_TO_USE:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stTurnToUseInTeleporter);
		break;
	case NM_KLAYMEN_RETURN_FROM_USE:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stReturnFromUseInTeleporter);
		break;
	case 0x4834:
		GotoState(&Klaymen::stStepOver);
		break;
	case 0x4835:
		sendMessage(_parentScene, 0x2000, 1);
		_isSittingInTeleporter = true;
		GotoState(&Klaymen::stSitInTeleporter);
		break;
	case 0x4836:
		sendMessage(_parentScene, 0x2000, 0);
		_isSittingInTeleporter = false;
		GotoState(&Klaymen::stGetUpFromTeleporter);
		break;
	case 0x483D:
		teleporterAppear(0xFF290E30);
		break;
	case 0x483E:
		teleporterDisappear(0x9A28CA1C);
		break;
	}
	return messageResult;
}
Пример #18
0
uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam &param) {
	uint32 messageResult = 0;
	switch (messageNum) {
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4816:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stPressButton);
		else if (param.asInteger() == 2)
			GotoState(&Klaymen::stPressFloorButton);
		else
			GotoState(&Klaymen::stPressButtonSide);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case 0x481F:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stTurnAwayFromUse);
		else if (param.asInteger() == 0)
			GotoState(&Klaymen::stTurnToUseHalf);
		else
			GotoState(&Klaymen::stWonderAbout);
		break;
	case 0x482D:
		setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
		gotoNextStateExt();
		break;
	case 0x482E:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stWalkToFrontNoStep);
		else
			GotoState(&Klaymen::stWalkToFront);
		break;
	case 0x482F:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stTurnToFront);
		else
			GotoState(&Klaymen::stTurnToBack);
		break;
	case 0x4832:
		GotoState(&Klaymen::stUseTube);
		break;
	case 0x4833:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stWonderAbout);
		else {
			_spitPipeIndex = sendMessage(_parentScene, 0x2000, 0);
			GotoState(&KmScene2401::stTrySpitIntoPipe);
		}
		break;
	case 0x483F:
		startSpecialWalkRight(param.asInteger());
		break;
	case 0x4840:
		startSpecialWalkLeft(param.asInteger());
		break;
	}
	return messageResult;
}
Пример #19
0
uint32 KmScene2402::xHandleMessage(int messageNum, const MessageParam &param) {
	uint32 messageResult = 0;
	switch (messageNum) {
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		if (!getGlobalVar(V_TV_JOKE_TOLD))
			GotoState(&Klaymen::stStandWonderAbout);
		else
			GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4804:
		if (param.asInteger() != 0) {
			_destX = param.asInteger();
			GotoState(&Klaymen::stWalkingFirst);
		} else
			GotoState(&Klaymen::stPeekWall);
		break;
	case 0x4812:
		GotoState(&Klaymen::stPickUpGeneric);
		break;
	case 0x4816:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stPressButton);
		else if (param.asInteger() == 2)
			GotoState(&Klaymen::stPressFloorButton);
		else
			GotoState(&Klaymen::stPressButtonSide);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case 0x481F:
		if (param.asInteger() == 0)
			GotoState(&Klaymen::stWonderAboutHalf);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stWonderAboutAfter);
		else if (param.asInteger() == 3)
			GotoState(&Klaymen::stTurnToUseHalf);
		else if (param.asInteger() == 4)
			GotoState(&Klaymen::stTurnAwayFromUse);
		else
			GotoState(&Klaymen::stWonderAbout);
		break;
	case 0x483F:
		startSpecialWalkRight(param.asInteger());
		break;
	case 0x4840:
		startSpecialWalkLeft(param.asInteger());
		break;
	}
	return messageResult;
}
Пример #20
0
uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam &param) {
	switch (messageNum) {
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x480A:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject);
		else
			GotoState(&Klaymen::stMoveObjectFaceObject);
		break;
	case 0x480D:
		GotoState(&Klaymen::stUseLever);
		break;
	case 0x4812:
		if (param.asInteger() == 2)
			GotoState(&Klaymen::stPickUpNeedle);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stPickUpTube);
		else
			GotoState(&Klaymen::stPickUpGeneric);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481A:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stInsertKey);
		else
			GotoState(&Klaymen::stInsertDisk);
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case 0x481D:
		GotoState(&Klaymen::stTurnToUse);
		break;
	case 0x481E:
		GotoState(&Klaymen::stReturnFromUse);
		break;
	case 0x4827:
		GotoState(&Klaymen::stReleaseLever);
		break;
	case 0x4834:
		GotoState(&Klaymen::stStepOver);
		break;
	case 0x483F:
		startSpecialWalkRight(param.asInteger());
		break;
	case 0x4840:
		startSpecialWalkLeft(param.asInteger());
		break;
	}
	return 0;
}
Пример #21
0
uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam &param) {
	uint32 messageResult = 0;
	switch (messageNum) {
	case 0x2000:
		_isSittingInTeleporter = param.asInteger() != 0;
		messageResult = 1;
		break;
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stSitIdleTeleporter);
		else
			GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4812:
		if (param.asInteger() == 2)
			GotoState(&Klaymen::stPickUpNeedle);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stPickUpTube);
		else
			GotoState(&Klaymen::stPickUpGeneric);
		break;
	case 0x4816:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stPressButton);
		else if (param.asInteger() == 2)
			GotoState(&Klaymen::stPressFloorButton);
		else
			GotoState(&Klaymen::stPressButtonSide);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481A:
		GotoState(&Klaymen::stInsertDisk);
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case 0x481D:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stTurnToUseInTeleporter);
		else
			GotoState(&Klaymen::stTurnToUse);
		break;
	case 0x481E:
		if (_isSittingInTeleporter)
			GotoState(&Klaymen::stReturnFromUseInTeleporter);
		else
			GotoState(&Klaymen::stReturnFromUse);
		break;
	case 0x481F:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stWonderAboutAfter);
		else if (param.asInteger() == 0)
			GotoState(&Klaymen::stWonderAboutHalf);
		else if (param.asInteger() == 4)
			GotoState(&Klaymen::stTurnAwayFromUse);
		else if (param.asInteger() == 3)
			GotoState(&Klaymen::stTurnToUseHalf);
		else
			GotoState(&Klaymen::stWonderAbout);
		break;
	case 0x482D:
		setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0);
		gotoNextStateExt();
		break;
	case 0x482E:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stWalkToFrontNoStep);
		else
			GotoState(&Klaymen::stWalkToFront);
		break;
	case 0x482F:
		if (param.asInteger() == 1)
			GotoState(&Klaymen::stTurnToFront);
		else
			GotoState(&Klaymen::stTurnToBack);
		break;
	case 0x4834:
		GotoState(&Klaymen::stStepOver);
		break;
	case 0x4835:
		sendMessage(_parentScene, 0x2000, 1);
		_isSittingInTeleporter = true;
		GotoState(&Klaymen::stSitInTeleporter);
		break;
	case 0x4836:
		sendMessage(_parentScene, 0x2000, 0);
		_isSittingInTeleporter = false;
		GotoState(&Klaymen::stGetUpFromTeleporter);
		break;
	case 0x483D:
		teleporterAppear(0xEE084A04);
		break;
	case 0x483E:
		teleporterDisappear(0xB86A4274);
		break;
	case 0x483F:
		startSpecialWalkRight(param.asInteger());
		break;
	case 0x4840:
		startSpecialWalkLeft(param.asInteger());
		break;
	}
	return messageResult;
}
Пример #22
0
uint32 Scene1105::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
	uint32 messageResult = 0;
	Scene::handleMessage(messageNum, param, sender);
	switch (messageNum) {
	case 0x0001:
		if (param.asPoint().x <= 20 || param.asPoint().x >= 620) {
			if (!_isActionButtonClicked && _backgroundIndex == 0) {
				if (_isPanelOpen) {
					_isPanelOpen = false;
					_backgroundIndex = 15;
					SetUpdateHandler(&Scene1105::upClosePanel);
				} else
					_isClosePanelDone = true;
				_leaveResult = 0;
			}
		}
		break;
	case 0x2001:
		showMouse(false);
		_backgroundIndex = 24;
		SetUpdateHandler(&Scene1105::upOpenPanel);
		break;
	case 0x2003:
		_backgroundIndex = 24;
		_leaveResult = 1;
		SetUpdateHandler(&Scene1105::upClosePanel);
		break;
	case 0x4807:
		if (sender == _ssActionButton) {
			if (getSubVar(VA_GOOD_DICE_NUMBERS, 0) == getSubVar(VA_CURR_DICE_NUMBERS, 0) &&
				getSubVar(VA_GOOD_DICE_NUMBERS, 1) == getSubVar(VA_CURR_DICE_NUMBERS, 1) &&
				getSubVar(VA_GOOD_DICE_NUMBERS, 2) == getSubVar(VA_CURR_DICE_NUMBERS, 2)) {
				setGlobalVar(V_ROBOT_TARGET, 1);
				playSound(2);
				_doMoveTeddy = true;
			} else {
				sendMessage(_asTeddyBear, 0x2002, 0);
			}
			showMouse(false);
			_isActionButtonClicked = true;
		}
		break;
	case 0x4826:
		if (_isPanelOpen) {
			if (sender == _ssActionButton) {
				sendMessage(_ssActionButton, 0x480B, 0);
				_isPanelOpen = false;
			} else if (!getGlobalVar(V_ROBOT_TARGET)) {
				if (sender == _ssSymbol1UpButton) {
					if (getSubVar(VA_CURR_DICE_NUMBERS, 0) < 9) {
						incSubVar(VA_CURR_DICE_NUMBERS, 0, +1);
						sendMessage(_ssSymbol1UpButton, 0x480B, 0);
						sendMessage(_ssSymbolDice[0], 0x2000, 0);
					}
				} else if (sender == _ssSymbol1DownButton) {
					if (getSubVar(VA_CURR_DICE_NUMBERS, 0) > 1) {
						incSubVar(VA_CURR_DICE_NUMBERS, 0, -1);
						sendMessage(_ssSymbol1DownButton, 0x480B, 0);
						sendMessage(_ssSymbolDice[0], 0x2000, 0);
					}
				} else if (sender == _ssSymbol2UpButton) {
					if (getSubVar(VA_CURR_DICE_NUMBERS, 1) < 9) {
						incSubVar(VA_CURR_DICE_NUMBERS, 1, +1);
						sendMessage(_ssSymbol2UpButton, 0x480B, 0);
						sendMessage(_ssSymbolDice[1], 0x2000, 0);
					}
				} else if (sender == _ssSymbol2DownButton) {
					if (getSubVar(VA_CURR_DICE_NUMBERS, 1) > 1) {
						incSubVar(VA_CURR_DICE_NUMBERS, 1, -1);
						sendMessage(_ssSymbol2DownButton, 0x480B, 0);
						sendMessage(_ssSymbolDice[1], 0x2000, 0);
					}
				} else if (sender == _ssSymbol3UpButton) {
					if (getSubVar(VA_CURR_DICE_NUMBERS, 2) < 9) {
						incSubVar(VA_CURR_DICE_NUMBERS, 2, +1);
						sendMessage(_ssSymbol3UpButton, 0x480B, 0);
						sendMessage(_ssSymbolDice[2], 0x2000, 0);
					}
				} else if (sender == _ssSymbol3DownButton) {
					if (getSubVar(VA_CURR_DICE_NUMBERS, 2) > 1) {
						incSubVar(VA_CURR_DICE_NUMBERS, 2, -1);
						sendMessage(_ssSymbol3DownButton, 0x480B, 0);
						sendMessage(_ssSymbolDice[2], 0x2000, 0);
					}
				}
			}
		}
		break;
	}
	return messageResult;
}
Пример #23
0
uint32 KmScene2406::xHandleMessage(int messageNum, const MessageParam &param) {
	uint32 messageResult = 0;
	switch (messageNum) {
	case 0x4001:
	case 0x4800:
		startWalkToX(param.asPoint().x, false);
		break;
	case 0x4004:
		GotoState(&Klaymen::stTryStandIdle);
		break;
	case 0x4804:
		if (param.asInteger() != 0) {
			_destX = param.asInteger();
			GotoState(&Klaymen::stWalkingFirst);
		} else
			GotoState(&Klaymen::stPeekWall);
		break;
	case 0x4812:
		if (param.asInteger() == 2)
			GotoState(&Klaymen::stPickUpNeedle);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stPickUpTube);
		else
			GotoState(&Klaymen::stPickUpGeneric);
		break;
	case 0x4817:
		setDoDeltaX(param.asInteger());
		gotoNextStateExt();
		break;
	case 0x481A:
		GotoState(&Klaymen::stInsertDisk);
		break;
	case 0x481B:
		if (param.asPoint().y != 0)
			startWalkToXDistance(param.asPoint().y, param.asPoint().x);
		else
			startWalkToAttachedSpriteXDistance(param.asPoint().x);
		break;
	case 0x481D:
		GotoState(&Klaymen::stTurnToUse);
		break;
	case 0x481E:
		GotoState(&Klaymen::stReturnFromUse);
		break;
	case 0x481F:
		if (param.asInteger() == 0)
			GotoState(&Klaymen::stWonderAboutHalf);
		else if (param.asInteger() == 1)
			GotoState(&Klaymen::stWonderAboutAfter);
		else if (param.asInteger() == 3)
			GotoState(&Klaymen::stTurnToUseHalf);
		else if (param.asInteger() == 4)
			GotoState(&Klaymen::stTurnAwayFromUse);
		else
			GotoState(&Klaymen::stWonderAbout);
		break;
	case 0x4820:
		sendMessage(_parentScene, 0x2000, 0);
		GotoState(&Klaymen::stContinueClimbLadderUp);
		break;
	case 0x4821:
		sendMessage(_parentScene, 0x2000, 0);
		_destY = param.asInteger();
		GotoState(&Klaymen::stStartClimbLadderDown);
		break;
	case 0x4822:
		sendMessage(_parentScene, 0x2000, 0);
		_destY = param.asInteger();
		GotoState(&Klaymen::stStartClimbLadderUp);
		break;
	case 0x4823:
		sendMessage(_parentScene, 0x2001, 0);
		GotoState(&Klaymen::stClimbLadderHalf);
		break;
	case 0x483F:
		startSpecialWalkRight(param.asInteger());
		break;
	case 0x4840:
		startSpecialWalkLeft(param.asInteger());
		break;
	}
	return messageResult;
}