예제 #1
0
void CRoomFlags::setRandomLocation(int classNum, bool flag) {
	uint minRoom, elevNum, maxRoom, maxFloor, minFloor;

	do {
		switch (classNum) {
		case 1:
			minFloor = 2;
			maxFloor = 19;
			minRoom = 1;
			maxRoom = 3;
			elevNum = g_vm->getRandomNumber(flag ? 2 : 3);
			break;

		case 2:
			minFloor = 20;
			maxFloor = 27;
			elevNum = g_vm->getRandomNumber(flag ? 2 : 3);
			minRoom = 1;
			maxRoom = ((elevNum - 1) & 1) ? 3 : 4;
			break;

		case 3:
			minRoom = 1;
			minFloor = 28;
			maxFloor = 38;
			maxRoom = 18;
			elevNum = g_vm->getRandomNumber(1);
			if (elevNum == 1)
				elevNum = 2;
			break;

		default:
			return;
		}

		uint floorNum = minFloor + g_vm->getRandomNumber(maxFloor - minFloor);
		uint roomNum = minRoom + g_vm->getRandomNumber(maxRoom - minRoom);
		setElevatorBits(elevNum);
		setRoomBits(roomNum);
		setFloorNum(floorNum);
	} while (_data == 0x59706);
}
예제 #2
0
void CRoomFlags::setRandomLocation(PassengerClass classNum, bool flag) {
	uint minRoom, elevNum, maxRoom, maxFloor, minFloor;

	do {
		switch (classNum) {
		case FIRST_CLASS:
			minFloor = 2;
			maxFloor = 19;
			minRoom = 1;
			maxRoom = 3;
			elevNum = g_vm->getRandomNumber(flag ? 2 : 3);
			break;

		case SECOND_CLASS:
			minFloor = 20;
			maxFloor = 27;
			elevNum = g_vm->getRandomNumber(flag ? 2 : 3);
			minRoom = 1;
			maxRoom = ((elevNum - 1) & 1) ? 3 : 4;
			break;

		case THIRD_CLASS:
			minRoom = 1;
			minFloor = 28;
			maxFloor = 38;
			maxRoom = 18;
			elevNum = g_vm->getRandomNumber(1) ? 2 : 0;
			break;

		default:
			return;
		}

		uint floorNum = minFloor + g_vm->getRandomNumber(maxFloor - minFloor);
		uint roomNum = minRoom + g_vm->getRandomNumber(maxRoom - minRoom);
		setElevatorBits(elevNum);
		setRoomBits(roomNum);
		setFloorNum(floorNum);
		setPassengerClassBits(classNum);
	} while (_data == 0x59706);
}
예제 #3
0
void CRoomFlags::changeClass(PassengerClass newClassNum) {
	uint floorNum = getFloorNum();
	uint roomNum = getRoomNum();
	uint elevatorNum = getElevatorNum();
	PassengerClass classNum = getPassengerClassNum();
	uint v10, v11, v12, v13;

	switch (classNum) {
	case FIRST_CLASS:
		v10 = 2;
		v11 = 19;
		v12 = 1;
		v13 = 3;
		break;

	case SECOND_CLASS:
		v10 = 20;
		v11 = 27;
		v12 = 1;
		v13 = (elevatorNum & 1) ? 3 : 4;
		break;

	case THIRD_CLASS:
		v10 = 28;
		v11 = 38;
		v12 = 1;
		v13 = 18;
		break;

	default:
		v10 = 0;
		v11 = 0;
		v12 = 0;
		v13 = 0;
		break;
	}

	// Perform action to change room or floor
	switch (newClassNum) {
	case FIRST_CLASS:
		if (--roomNum < v12)
			roomNum = v12;
		break;

	case SECOND_CLASS:
		if (++roomNum > v13)
			roomNum = v13;
		break;

	case THIRD_CLASS:
		if (--floorNum < v10)
			floorNum = v10;
		break;

	case UNCHECKED:
		if (++floorNum > v11)
			floorNum = v11;

	default:
		break;
	}

	// Set new floor and room
	setFloorNum(floorNum);
	setRoomBits(roomNum);
}
예제 #4
0
void CRoomFlags::changeLocation(int action) {
	uint floorNum = getFloorNum();
	uint roomNum = getRoomNum();
	uint elevatorNum = getElevatorNum();
	uint classNum = getPassengerClassNum();
	uint v10, v11, v12, v13;

	switch (classNum) {
	case 1:
		v10 = 2;
		v11 = 19;
		v12 = 1;
		v13 = 3;
		break;

	case 2:
		v10 = 20;
		v11 = 27;
		v12 = 1;
		v13 = (elevatorNum & 1) ? 3 : 4;
		break;

	case 3:
		v10 = 28;
		v11 = 38;
		v12 = 1;
		v13 = 18;
		break;

	default:
		v10 = 0;
		v11 = 0;
		v12 = 0;
		v13 = 0;
		break;
	}

	// Perform action to change room or floor
	switch (action) {
	case 1:
		if (--roomNum < v12)
			roomNum = v12;
		break;

	case 2:
		if (++roomNum > v13)
			roomNum = v13;
		break;

	case 3:
		if (--floorNum < v10)
			floorNum = v10;
		break;

	case 4:
		if (++floorNum > v11)
			floorNum = v11;
	}

	// Set new floor and room
	setFloorNum(floorNum);
	setRoomBits(roomNum);
}