summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libplum.c1
-rw-r--r--src/main.c6
-rw-r--r--src/player.c3
-rw-r--r--src/res/pacer.asebin865 -> 553 bytes
-rw-r--r--src/save.c9
5 files changed, 14 insertions, 5 deletions
diff --git a/src/libplum.c b/src/libplum.c
index 5be1668..789aba9 100644
--- a/src/libplum.c
+++ b/src/libplum.c
@@ -6,6 +6,7 @@
 #include <stdbool.h>
 #include <stdalign.h>
 #include <setjmp.h>
+void *aligned_alloc(size_t, size_t); // hack to make it build on mingw
 
 #ifndef PLUM_DEFS
 
diff --git a/src/main.c b/src/main.c
index 9c40876..f86ed0b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -535,8 +535,10 @@ void main_loop(void) {
 						size_t const start = touch.allocated;
 						touch.allocated = i + 1;
 						touch.positions = realloc(touch.positions, sizeof (struct touch_vec) * touch.allocated);
-						for (size_t index = start; index < i - 1; index++) {
-							touch.positions[index].active = 0;
+						if (i) { // hack for 0 - 1 = absurd-high number; all of RAM gets wiped
+							for (size_t index = start; index < i - 1; index++) {
+								touch.positions[index].active = 0;
+							}
 						}
 					}
 					touch.positions[i].active = 1;
diff --git a/src/player.c b/src/player.c
index e7dfd98..0bf09de 100644
--- a/src/player.c
+++ b/src/player.c
@@ -169,6 +169,9 @@ static int move(struct entity *self) {
 		self->facing = +1;
 	}
 	self->velocity.y += GRAVITY;
+	if (self->velocity.y > to_fixed(8)) {
+		self->hp = 0; // 'fell out of bounds' probably
+	}
 	// y collision
 	self->y += self->velocity.y;
 	collision_T const cy = collide(self);
diff --git a/src/res/pacer.ase b/src/res/pacer.ase
index 7d8e666..bd22044 100644
--- a/src/res/pacer.ase
+++ b/src/res/pacer.ase
Binary files differdiff --git a/src/save.c b/src/save.c
index 9baf981..faeb8d1 100644
--- a/src/save.c
+++ b/src/save.c
@@ -19,11 +19,14 @@ int game_save(FILE *file) {
 	return 0;
 }
 
+static char *level = NULL; // hack to not leak memory
+
 int game_load(FILE *file) {
 	size_t filesize, len;
-	char *filedata = util_loadFile(file, &filesize); // hack: we leak a tiny bit of memory here
+	char *filedata = util_loadFile(file, &filesize);
 	fclose(file);
-	char *level = filedata;
+	free(level);
+	level = filedata;
 	len = strnlen(filedata, filesize);
 	if (len == filesize) {
 		fputs("invalid save format\n", stderr);
@@ -43,6 +46,6 @@ int game_load(FILE *file) {
 		return 1;
 	}
 	player_property(next_entities.player, "y", filedata);
-	level = realloc(level, strlen(level) + 1);
+	level = realloc(level, strlen(level) + 1); // this line looks fucking stupid out of context
 	return game_load_level(level);
 }