Ejemplo n.º 1
0
void Lua_V2::IsChorePlaying() {
	lua_Object choreObj = lua_getparam(1);

	if (!lua_isuserdata(choreObj) || lua_tag(choreObj) != MKTAG('C','H','O','R'))
		return;

	int chore = lua_getuserdata(choreObj);
	Chore *c = EMIChore::getPool().getObject(chore);

	if (c) {
		pushbool(c->isPlaying());
	} else {
		lua_pushnil();
	}
}
Ejemplo n.º 2
0
int EMICostume::update(uint time) {
	for (Common::List<Chore*>::iterator i = _playingChores.begin(); i != _playingChores.end(); ++i) {
		Chore *c = *i;
		c->update(time);

		for (int t = 0; t < c->_numTracks; ++t) {
			if (c->_tracks[t].component) {
				c->_tracks[t].component->update(time);
			}
		}

		if (!c->isPlaying()) {
			i = _playingChores.erase(i);
			--i;
		}
	}

	return 0;
}
Ejemplo n.º 3
0
void Lua_V2::AdvanceChore() {
	lua_Object choreObj = lua_getparam(1);
	lua_Object timeObj = lua_getparam(2);

	if (!lua_isuserdata(choreObj) || lua_tag(choreObj) != MKTAG('C','H','O','R') || !lua_isnumber(timeObj))
		return;

	int chore = lua_getuserdata(choreObj);
	float time = lua_getnumber(timeObj);
	Chore *c = EMIChore::getPool().getObject(chore);
	if (c) {
		if (!c->isPlaying()) {
			warning("AdvanceChore() called on stopped chore %s (%s)",
					c->getName(), c->getOwner()->getFilename().c_str());
			if (c->isLooping()) {
				c->getOwner()->playChoreLooping(c->getName());
			} else {
				c->getOwner()->playChore(c->getName());
			}
		}
		c->setTime(time * 1000);
	}
}