Exemple #1
0
/**
 * Functionality required by all event types on each iteration
 *
 * @param ticks Time
 * @param msps Ticks per step
 *
 * @return Animation
 */
EventType* Event::prepareStep (unsigned int ticks, int msps) {

	// Process the next event
	if (next) next = next->step(ticks, msps);

	// Get the event properties
	set = level->getEvent(gridX, gridY);

	// If the event has been removed from the grid, destroy it
	if (!set) return NULL;

	// If the event and its origin are off-screen, the event is not in the
	// process of self-destruction, remove it
	if (((animType & ~1) != E_LFINISHANIM) &&
		((x < viewX - F192) || (x > viewX + ITOF(viewW) + F192) ||
		(y < viewY - F160) || (y > viewY + ITOF(viewH) + F160)) &&
		((gridX < FTOT(viewX) - 1) ||
		(gridX > ITOT(FTOI(viewX) + viewW) + 1) ||
		(gridY < FTOT(viewY) - 1) ||
		(gridY > ITOT(FTOI(viewY) + viewH) + 1))) return NULL;

	return set;

}
Exemple #2
0
static int
vfs_vget_9p(struct mount *mp, ino64_t ino, vnode_t *vpp, vfs_context_t ctx)
{
	vnode_t vp;
	qid_9p qid;
	int e;

	TRACE();
	qid.path = ITOP(ino);
	qid.type = ITOT(ino);
	*vpp = NULL;
	if ((e=nget_9p(MTO9P(mp), NOFID, qid, NULL, &vp, NULL, ctx)))
		return e;
	nunlock_9p(NTO9P(vp));
	if ((e=vnode_get(vp)))
		return e;

	*vpp = vp;
	return 0;
}
Exemple #3
0
/**
 * Draw the layer.
 *
 * @param tileSet The tile set to use for non-flipped tiles
 * @param flippedTileSet The tile set to use for flipped tiles
 */
void JJ2Layer::draw (SDL_Surface* tileSet, SDL_Surface* flippedTileSet) {

	SDL_Rect src, dst;
	int vX, vY;
	int x, y;

	// Set tile drawing dimensions
	src.w = TTOI(1);
	src.h = TTOI(1);
	src.x = 0;


	// Calculate the layer view
	vX = FTOI(FTOI(viewX) * xSpeed);
	vY = FTOI(FTOI(viewY) * ySpeed);

	if (limit) {

		if (!tileX) {

			if (vX + canvasW > TTOI(width)) vX = TTOI(width) - canvasW;

		}

		if (!tileY) {

			vY -= canvasH - SH;
			if (vY + canvasH > TTOI(height)) vY = TTOI(height) - canvasH;

		}

	}

	for (y = 0; y <= ITOT(canvasH - 1) + 1; y++) {

		for (x = 0; x <= ITOT(canvasW - 1) + 1; x++) {

			dst.x = TTOI(x) - (vX & 31);
			dst.y = TTOI(y) - (vY & 31);
			src.y = TTOI(getTile(x + ITOT(vX), y + ITOT(vY)));
			if (src.y) SDL_BlitSurface(getFlipped(x + ITOT(vX), y + ITOT(vY))? flippedTileSet: tileSet, &src, canvas, &dst);

		}

	}

	return;

}