From 9f2341fa7aca39f7e9cbf6b7360b58c7fe4c6b2d Mon Sep 17 00:00:00 2001 From: kdx Date: Sun, 26 Mar 2023 20:07:40 +0200 Subject: done --- src/alarm.c | 11 +++++++++++ src/box.c | 6 ++++++ src/window.c | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/src/alarm.c b/src/alarm.c index 95fb6b0..35b91b0 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -2,6 +2,17 @@ #include "lzr.h" #include "entityimpl.h" +extern int destructibles, des_x, des_y; + +IMPL(update) { + this->pos[0] = -100; + this->pos[1] = -100; + if (destructibles == 0) { + this->pos[0] = des_x; + this->pos[1] = des_y; + } +} + IMPL(draw) { const LZR_ImageDrawSettings stg = {0, 0, -1, -1, 1.0, 1.0, 0.0, true, false, false}; diff --git a/src/box.c b/src/box.c index df4b9c7..dcb7672 100644 --- a/src/box.c +++ b/src/box.c @@ -1,6 +1,8 @@ #include "entityimpl.h" #include "lzr.h" +extern int destructibles, des_x, des_y; + IMPL(draw) { const LZR_ImageDrawSettings stg = {0, 0, -1, -1, 1.0, 1.0, 0.0, true, false, false}; @@ -14,11 +16,15 @@ IMPL(smash) { if (this->broken) { this->type = 0; this->smash = NULL; + destructibles -= 1; + des_x = this->pos[0]; + des_y = this->pos[1]; } this->broken = 1; } IMPL_INIT(box) { + destructibles += 1; this->width = this->height = 64; this->broken = 0; } diff --git a/src/window.c b/src/window.c index 38a92a1..a57f2eb 100644 --- a/src/window.c +++ b/src/window.c @@ -1,6 +1,8 @@ #include "entityimpl.h" #include "lzr.h" +int destructibles = 0, des_x, des_y; + IMPL(draw) { const LZR_ImageDrawSettings stg = {0, 0, -1, -1, 1.0, 1.0, 0.0, true, false, false}; @@ -13,8 +15,12 @@ IMPL(smash) { LZR_PlaySound(1); this->broken = 1; this->smash = NULL; + destructibles -= 1; + des_x = this->pos[0]; + des_y = this->pos[1]; } IMPL_INIT(window) { + destructibles += 1; this->width = this->height = 64; } -- cgit v1.2.3