Esempio n. 1
0
bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
	init();
	initScreen();

	_vm->_draw->blitInvalidated();
	_vm->_video->retrace();

	EvilFish shark(*_objects, 320, 0, 14, 8, 9, 3);

	Common::List<ANIObject *> objects;

	objects.push_back(_water);
	objects.push_back(&shark);

	shark.enter(EvilFish::kDirectionLeft, 90);

	while (!_vm->_util->keyPressed() && !_vm->shouldQuit()) {
		int16 left, top, right, bottom;

		// Clear the previous animation frames
		for (Common::List<ANIObject *>::iterator o = objects.reverse_begin();
		     o != objects.end(); --o) {

			(*o)->clear(*_vm->_draw->_backSurface, left, top, right, bottom);
			_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
		}

		// Draw the current animation frames
		for (Common::List<ANIObject *>::iterator o = objects.begin();
		     o != objects.end(); ++o) {

			(*o)->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
			_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);

			(*o)->advance();
		}

		_vm->_draw->blitInvalidated();

		_vm->_util->waitEndFrame();
		_vm->_util->processInput();
	}

	deinit();
	return true;
}