Ejemplo n.º 1
0
int HiRes5Engine::o_checkItemTimeLimits(ScriptEnv &e) {
	OP_DEBUG_1("\tCHECK_ITEM_TIME_LIMITS(VARS[%d])", e.arg(1));

	bool lostAnItem = false;
	Common::List<Item>::iterator item;

	for (item = _state.items.begin(); item != _state.items.end(); ++item) {
		const byte room = item->room;
		const byte region = item->region;

		if (room == IDI_ANY || room == IDI_CUR_ROOM || (room == _state.room && region == _state.region)) {
			if (getVar(e.arg(1)) < _itemTimeLimits[item->id - 1]) {
				item->room = IDI_VOID_ROOM;
				lostAnItem = true;
			}
		}
	}

	if (lostAnItem) {
		printString(_gameStrings.itemTimeLimit);
		inputString();
	}

	return 1;
}
Ejemplo n.º 2
0
int AdlEngine_v2::o2_isRandomGT(ScriptEnv &e) {
	OP_DEBUG_1("\t&& RAND() > %d", e.arg(1));

	byte rnd = _random->getRandomNumber(255);

	if (rnd > e.arg(1))
		return 1;

	return -1;
}
Ejemplo n.º 3
0
int AdlEngine_v2::o2_isNounNotInRoom(ScriptEnv &e) {
	OP_DEBUG_1("\t&& NO_SUCH_ITEMS_IN_ROOM(%s)", itemRoomStr(e.arg(1)).c_str());

	Common::List<Item>::const_iterator item;

	for (item = _state.items.begin(); item != _state.items.end(); ++item)
		if (item->noun == e.getNoun() && (item->room == roomArg(e.arg(1))))
			return -1;

	return 1;
}
Ejemplo n.º 4
0
int AdlEngine_v3::o3_isNounNotInRoom(ScriptEnv &e) {
	OP_DEBUG_1("\t&& NO_SUCH_ITEMS_IN_ROOM(%s)", itemRoomStr(e.arg(1)).c_str());

	Common::List<Item>::const_iterator item;

	bool isAnItem = false;

	for (item = _state.items.begin(); item != _state.items.end(); ++item) {
		if (item->noun == e.getNoun()) {
			isAnItem = true;

			if (item->room == roomArg(e.arg(1)))
				return -1;
		}
	}

	return (isAnItem ? 1 : -1);
}
Ejemplo n.º 5
0
int AdlEngine_v2::o2_setRoomFromVar(ScriptEnv &e) {
	OP_DEBUG_1("\tROOM = VAR[%d]", e.arg(1));
	getCurRoom().curPicture = getCurRoom().picture;
	_state.room = getVar(e.arg(1));
	return 1;
}
Ejemplo n.º 6
0
int AdlEngine_v2::o2_setPic(ScriptEnv &e) {
	OP_DEBUG_1("\tSET_PIC(%d)", e.arg(1));

	getCurRoom().picture = getCurRoom().curPicture = _state.curPicture = e.arg(1);
	return 1;
}