From ac092732fc2e79902d85706e117da95163dd3c9f Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 9 Jan 2021 09:42:24 +0000 Subject: Added compression to the map --- game/data/Makefile | 2 +- game/src/Makefile | 2 +- game/src/game.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'game') diff --git a/game/data/Makefile b/game/data/Makefile index f79ae33..22d26c2 100644 --- a/game/data/Makefile +++ b/game/data/Makefile @@ -13,7 +13,7 @@ $(OUTPUT)/enemy.h: enemy.png ../../tools/png2sprites.py -i enemy_sprite $< > $@ $(OUTPUT)/map.h: map.json map_conf.json - ../../tools/map.py --max-ents 11 --room-height 21 map.json map > $@ + ../../tools/map.py --aplib --max-ents 11 --room-height 21 map.json map > $@ .PHONY: all clean clean: diff --git a/game/src/Makefile b/game/src/Makefile index 32354fd..f05d1fa 100644 --- a/game/src/Makefile +++ b/game/src/Makefile @@ -10,7 +10,7 @@ ROM_MAX = 8000 OUTPUT = ../build OBJS = $(patsubst %.c,$(OUTPUT)/%.rel,$(wildcard *.c)) $(OUTPUT)/akm.rel UBOX_LIBS = $(wildcard ../../lib/*.lib) -LIBS = -lubox -lspman -lmplayer +LIBS = -lubox -lspman -lmplayer -lap CC = sdcc AS = sdasz80 diff --git a/game/src/game.c b/game/src/game.c index f5f5970..5bfeffb 100644 --- a/game/src/game.c +++ b/game/src/game.c @@ -4,6 +4,7 @@ #include "ubox.h" #include "spman.h" #include "mplayer.h" +#include "ap.h" #include "helpers.h" #include "main.h" @@ -383,9 +384,9 @@ void run_game() // we only have one map, select it cur_map = map[0]; - // copy map data into RAM, we will modify it + // uncompress map data into RAM, we will modify it // map data starts on byte 3 (skip map data size and entities size) - memcpy(cur_map_data, cur_map + 3, MAP_W * MAP_H); + ap_uncompress(cur_map_data, cur_map + 3); // init entities before drawing init_map_entities(); -- cgit v1.2.3