summaryrefslogtreecommitdiff
path: root/src/modules/sparkler/rocket.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-02-03 13:06:26 -0800
committerVito Caputo <vcaputo@gnugeneration.com>2017-02-03 13:06:26 -0800
commit91e5956932d17de17c0c75be20c834cf7a6c6ed9 (patch)
tree19bb0846dbcb091b3a28949605733bc431f45917 /src/modules/sparkler/rocket.c
parentc2e4a7977349f5b4b69cc39829c50512a9503f15 (diff)
rototiller: extricate draw_pixel() bounds checking
If a z-buffer is added these checks will need to be done independent from and prior to drawing. Also it's silly to makergb() pixels which can't be drawn.
Diffstat (limited to 'src/modules/sparkler/rocket.c')
-rw-r--r--src/modules/sparkler/rocket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/modules/sparkler/rocket.c b/src/modules/sparkler/rocket.c
index 6b9dc5e..2088cc7 100644
--- a/src/modules/sparkler/rocket.c
+++ b/src/modules/sparkler/rocket.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include "draw.h"
+#include "fb.h"
#include "particle.h"
#include "particles.h"
@@ -122,10 +123,14 @@ static void rocket_draw(particles_t *particles, particle_t *p, int x, int y, fb_
{
rocket_ctxt_t *ctxt = p->ctxt;
- if (!draw_pixel(f, x, y, 0xff0000)) {
+ if (!fb_fragment_contains(f, x, y)) {
/* kill off parts that wander off screen */
ctxt->longevity = 0;
+
+ return;
}
+
+ draw_pixel(f, x, y, 0xff0000);
}
© All Rights Reserved