From 09438266c3987c89a1e7f0abf9042dd3528ac343 Mon Sep 17 00:00:00 2001 From: kdx Date: Sun, 26 Mar 2023 07:26:47 +0000 Subject: overengineer entityimpl a bit more --- src/deathpart.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/deathpart.c') diff --git a/src/deathpart.c b/src/deathpart.c index bdc3cdf..3a94ac8 100644 --- a/src/deathpart.c +++ b/src/deathpart.c @@ -3,6 +3,16 @@ #include "entityimpl.h" #include +IMPL_INIT(deathpart) { + this->ignore_solids = true; + this->vel[0] = (float)(rand() % 1024) / 1024; + this->vel[1] = -(float)(rand() % 1024) / 512; + this->vel[0] *= this->vel[0]; + if (rand() % 2) + this->vel[0] *= -1; + this->width = 1 + rand() % 2; +} + IMPL(update) { if (this->deathpart.skip == 0) { this->vel[1] *= AIR_RESISTANCE; @@ -21,13 +31,3 @@ IMPL(draw) { (void)LZY_DrawRect(this->pos[0], this->pos[1], this->width, this->width); } - -IMPL_INIT(deathpart) { - this->ignore_solids = true; - this->vel[0] = (float)(rand() % 1024) / 1024; - this->vel[1] = -(float)(rand() % 1024) / 512; - this->vel[0] *= this->vel[0]; - if (rand() % 2) - this->vel[0] *= -1; - this->width = 1 + rand() % 2; -} IMPL_END -- cgit v1.2.3