summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-03-26 20:07:40 +0200
committerkdx <kikoodx@paranoici.org>2023-03-26 20:07:40 +0200
commit9f2341fa7aca39f7e9cbf6b7360b58c7fe4c6b2d (patch)
tree3c67749f3a591e6cdbbe1baaf807abd925b6f2eb
parentee3af3dadd0966add98747dd6cc2636c61f5b2cd (diff)
downloadjamdelaloose-9f2341fa7aca39f7e9cbf6b7360b58c7fe4c6b2d.tar.gz
done
-rw-r--r--src/alarm.c11
-rw-r--r--src/box.c6
-rw-r--r--src/window.c6
3 files changed, 23 insertions, 0 deletions
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;
}