aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-04-06 12:32:23 +0200
committerGitHub <noreply@github.com>2023-04-06 12:32:23 +0200
commitd1c00c98ca0f2ca498284e60fa057a610cc5c461 (patch)
treea2efebcb9917d7f4f3666a722338f50b9590e843 /src
parent1771aaa12736b4dbc24419270cf595de6d345969 (diff)
parent93e9426d5642dfab7a13d5a34873b296de1d9642 (diff)
Merge pull request #58 from UnavailableDev/dev
Dynamic tilemap
Diffstat (limited to 'src')
-rw-r--r--src/demo.c6
-rw-r--r--src/engine/animator.c34
-rw-r--r--src/engine/animator.h2
-rw-r--r--src/engine/bullet.c44
-rw-r--r--src/engine/enemy.c10
-rw-r--r--src/engine/enemy.h5
-rw-r--r--src/engine/enemy_ai.c99
-rw-r--r--src/engine/enemy_ai.h10
-rw-r--r--src/engine/entity.c31
-rw-r--r--src/engine/entity.h5
-rw-r--r--src/engine/level_const.c23
-rw-r--r--src/engine/level_const.h1
-rw-r--r--src/engine/player_controller.c4
-rw-r--r--src/engine/sprite_controller.c12
-rw-r--r--src/engine/sprite_controller.h92
-rw-r--r--src/engine/title_screen.c6
-rw-r--r--src/engine/types.h4
-rw-r--r--src/game_loop/gameplay.c82
-rw-r--r--src/game_loop/gameplay.h3
-rw-r--r--src/game_loop/shop.c48
-rw-r--r--src/game_loop/shop.h6
-rw-r--r--src/game_loop/starting_screen.c1
-rw-r--r--src/makefile15
-rw-r--r--src/ppu/consts.h6
-rw-r--r--src/ppu/ppu.c24
-rw-r--r--src/ppu/ppu.h3
-rw-r--r--src/ppusim/sim.c33
-rw-r--r--src/ppusim/sim.h4
-rw-r--r--src/static/.gitignore10
-rw-r--r--src/static/Source.cpp42
-rw-r--r--src/static/background/air.hex17
-rw-r--r--src/static/background/bricks.hex457
-rw-r--r--src/static/background/crates.hex39
-rw-r--r--src/static/background/shop_stall.hex202
-rw-r--r--src/static/epic.py41
-rw-r--r--src/static/foreground/bullet.hex58
-rw-r--r--src/static/foreground/gozer.hex39
-rw-r--r--src/static/hh.tiled-project12
-rw-r--r--src/static/makefile49
-rw-r--r--src/static/world.h1
-rw-r--r--src/static/world.hex514
-rw-r--r--src/stm32/setup.c4
-rw-r--r--src/tilemap.h7
43 files changed, 1938 insertions, 167 deletions
diff --git a/src/demo.c b/src/demo.c
index aae1729..20f8381 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -59,20 +59,22 @@ void hh_demo_loop(unsigned long frame) {
}
break;
case hh_e_state_shop:
- hh_shop(&hh_game_states);
+ hh_shop(&hh_game_states, &hh_game.shop);
break;
case hh_e_state_gameplay:
hh_gameplay(&hh_game, &hh_game_states);
break;
case hh_e_state_game_over:
- // todo:
+ // TODO:
// function: show game over screen
// function: after time goto high score
+ hh_game_states = hh_e_state_high_score;
break;
case hh_e_state_high_score:
// todo:
// fucntion: show all previously scored points
// function: button pressed goto starting screen
+ hh_game_states = hh_e_state_starting_screen;
break;
default:
hh_game_states = hh_e_state_starting_screen;
diff --git a/src/engine/animator.c b/src/engine/animator.c
index 1af8dde..e293eb1 100644
--- a/src/engine/animator.c
+++ b/src/engine/animator.c
@@ -16,40 +16,26 @@ void hh_animate_hit(hh_s_rendering* in, bool hit) {
}
void hh_animate(hh_s_rendering* in, uint16_t start, uint16_t end, uint8_t step) {
- if (in->fam.palette_index >= start && in->fam.palette_index < end) {
- in->fam.palette_index += step;
+ if (in->fam.tilemap_index >= start && in->fam.tilemap_index < end) {
+ in->fam.tilemap_index += step;
} else {// rollover
- in->fam.palette_index = start;
+ in->fam.tilemap_index = start;
}
}
-//TODO: if entity not inside of screen, don't update idx
-uint16_t hh_update_sprite(uint16_t idx, hh_entity* in, vec_cor cam) {
+//TODO: if entity not inside of screen, don't update idx (problems with old idx not being overwritten anymore)
+void hh_update_sprite(uint16_t *idx, hh_entity* in, vec_cor cam) {
hh_animate_hit(&in->render, in->is_hit);
hh_s_ppu_loc_fam_entry temp = in->render.fam;
for (int y = 0; y < CEILI(in->size.y,16); y++) {
temp.position_y = CLAMP(in->pos.y - cam.y + y*HH_PPU_SPRITE_HEIGHT, -16, HH_PPU_SCREEN_HEIGHT);
for (int x = 0; x < CEILI(in->size.x,16); x++) {
temp.position_x = CLAMP(in->pos.x - cam.x + x*HH_PPU_SPRITE_WIDTH, -16, HH_PPU_SCREEN_WIDTH);
- hh_ppu_update_foreground(++idx, temp);
- temp.tilemap_index++;
+ // if (temp.position_x != -16 && temp.position_y != -16) {// removes redundant sprites
+ hh_ppu_update_foreground(++*idx, temp);
+ temp.tilemap_index++;
+ // hh_animate(&in->render, start+counter,end+counter,4);
+ // }
}
}
- return idx;
}
-
-
-// void hh_update_sprite(hh_entity* in, vec_cor cam) {
-// hh_animate_hit(&in->render, in->is_hit);
-// // uint16_t idx = in->render.ppu_foreground_index;
-// uint16_t idx = 0;
-// hh_s_ppu_loc_fam_entry temp = in->render.fam;
-// for (int y = 0; y < CEILI(in->size.y,16); y++) {
-// temp.position_y = CLAMP(in->pos.y - cam.y + y*HH_PPU_SPRITE_HEIGHT, -16, HH_PPU_SCREEN_HEIGHT);
-// for (int x = 0; x < CEILI(in->size.x,16); x++) {
-// temp.position_x = CLAMP(in->pos.x - cam.x + x*HH_PPU_SPRITE_WIDTH, -16, HH_PPU_SCREEN_WIDTH);
-// hh_ppu_update_foreground(idx++, temp);
-// temp.tilemap_index++;
-// }
-// }
-// }
diff --git a/src/engine/animator.h b/src/engine/animator.h
index 10fa321..2f6e00d 100644
--- a/src/engine/animator.h
+++ b/src/engine/animator.h
@@ -11,4 +11,4 @@ void hh_animate_hit(hh_s_rendering*, bool hit);
void hh_animate(hh_s_rendering*, uint16_t start, uint16_t end, uint8_t step);
/** @brief passively updates sprite*/
-uint16_t hh_update_sprite(uint16_t idx, hh_entity* in, vec_cor cam);
+void hh_update_sprite(uint16_t* idx, hh_entity* in, vec_cor cam);
diff --git a/src/engine/bullet.c b/src/engine/bullet.c
index 55b20cc..3251472 100644
--- a/src/engine/bullet.c
+++ b/src/engine/bullet.c
@@ -18,13 +18,13 @@ hh_entity* hh_init_bullets(int size) {
.vel = (vec2){0,0},
.size = (vec2) { 13,16},
.render = {
- .frame0 = 84,
+ .frame0 = HH_TM_BULLET_OFFSET,
.palette = 3,
.fam = (hh_s_ppu_loc_fam_entry){
.horizontal_flip = false,
.vertical_flip = false,
.palette_index = 7,
- .tilemap_index = 84,
+ .tilemap_index = HH_TM_BULLET_OFFSET,
}
}
};
@@ -42,12 +42,47 @@ bool rising_edge(bool signal, bool* prev) {
return edge;
}
bool prev_signal = false;
+void hh_handle_bullet_direction(hh_entity* bullet){
+ bullet->vel = (vec2){0,0};
+ if (g_hh_controller_p1.dpad_left) {
+ if (g_hh_controller_p1.dpad_up) {
+ bullet->vel.x = -1;
+ bullet->vel.y = -1;
+ } else if (g_hh_controller_p1.dpad_down) {
+ bullet->vel.x = -1;
+ bullet->vel.y = 1;
+ } else {
+ bullet->vel.x = -1;
+ }
+ }else if (g_hh_controller_p1.dpad_right) {
+ if (g_hh_controller_p1.dpad_up) {
+ bullet->vel.x = 1;
+ bullet->vel.y = -1;
+ } else if (g_hh_controller_p1.dpad_down) {
+ bullet->vel.x = 1;
+ bullet->vel.y = 1;
+ } else {
+ bullet->vel.x = 1;
+ }
+ } else if (g_hh_controller_p1.dpad_up){
+ bullet->vel.y = -1;
+ } else if (g_hh_controller_p1.dpad_down){
+ bullet->vel.y = 1;
+ }
+ else{
+ bullet->vel.x = 1;
+ }
+ bullet->render.fam.horizontal_flip = (bullet->vel.x < 0);
+ bullet->render.fam.vertical_flip = (bullet->vel.y != 0);
+
+}
void hh_shoot_bullet(vec2 player, hh_entity* bullet){
vec2 temp;
if(rising_edge(g_hh_controller_p1.button_secondary,&prev_signal) && bullet->is_grounded){
bullet->is_grounded=false;
bullet->pos = player;
current_bullet = (current_bullet + 1) % bullets_size;
+ hh_handle_bullet_direction(bullet);
}
}
@@ -55,11 +90,10 @@ void hh_shoot_bullet(vec2 player, hh_entity* bullet){
void hh_update_bullet(hh_entity* bullet){
if(hh_background_collision_bulllet(*bullet)){
hh_bullet_death(bullet);
-
- // printf("x %d y %d\n",(bullet->pos.x-cam_pos.x),(bullet->pos.y-cam_pos.y));
}
else{
- bullet->pos.x += bullet->speed;
+ bullet->pos.x = bullet->pos.x + bullet->vel.x * bullet->speed;
+ bullet->pos.y = bullet->pos.y + bullet->vel.y * bullet->speed;
}
}
diff --git a/src/engine/enemy.c b/src/engine/enemy.c
index 186cfa0..4ed48a2 100644
--- a/src/engine/enemy.c
+++ b/src/engine/enemy.c
@@ -1,14 +1,9 @@
#include "engine/enemy.h"
-void hh_update_enemy(hh_entity* enemy, vec_cor cam_pos){
- //Bjorn functions
-
-}
-
-void hh_multiple_enemies( vec_cor cam_pos, hh_entity* enemies, int total_enemies){
+void hh_multiple_enemies(hh_entity* enemies, hh_entity player, vec_cor cam_pos, int total_enemies){
for(int i=0; i < total_enemies;i++){
- hh_update_enemy(&enemies[i] , cam_pos);
+ hh_update_enemy(&enemies[i] , player, cam_pos);
}
}
@@ -22,6 +17,7 @@ void hh_enemy_death_check(hh_entity* enemy){
enemy->hp--;
}
}
+
void hh_solve_hitted_enemies(hh_entity* enemies, int total_enemies){
for(int i = 0; i < total_enemies; i++){
if(enemies[i].is_hit){
diff --git a/src/engine/enemy.h b/src/engine/enemy.h
index 80498f5..c8a3f20 100644
--- a/src/engine/enemy.h
+++ b/src/engine/enemy.h
@@ -1,14 +1,13 @@
#pragma once
#include "player_controller.h"
#include "engine/sprite_controller.h"
+#include "engine/enemy_ai.h"
#include "types.h"
#include "input.h"
-/** @brief updates a single enemy locations TODO: Bjorn sets functions in here*/
-void hh_update_enemy(hh_entity* , vec_cor );
/** @brief calculates all the given enemies positions*/
-void hh_multiple_enemies( vec_cor cam_pos, hh_entity* enemies, int total_enemies);
+void hh_multiple_enemies(hh_entity* enemies, hh_entity player, vec_cor cam_pos, int total_enemies);
/** @brief checks if the enemy has zero hp else it takes hp from the enemy */
void hh_enemy_death_check(hh_entity* enemy);
diff --git a/src/engine/enemy_ai.c b/src/engine/enemy_ai.c
new file mode 100644
index 0000000..81d04d9
--- /dev/null
+++ b/src/engine/enemy_ai.c
@@ -0,0 +1,99 @@
+#include "engine/enemy_ai.h"
+
+int8_t hh_get_direction(int32_t player_x, int32_t enemy_x){
+ int movement_direction = player_x - enemy_x; // = player.pos.x - player.prev_pos.x;
+ if (movement_direction > 0) {
+ return 1; // move in positive direction
+ } else if (movement_direction < 0) {
+ return -1; // move in negative direction
+ } else {
+ return 0; // don't move
+ }
+}
+void hh_update_enemy_movement(hh_entity* enemy){
+ hh_entity enemy_new = {0};
+ enemy_new = *enemy;
+ enemy_new.vel = (vec2){
+ .x = enemy->vel.x,
+ .y = enemy->vel.y,
+ };
+
+ enemy_new.pos = (vec2){
+ .x = enemy->pos.x + enemy_new.vel.x,
+ .y = enemy->pos.y + enemy_new.vel.y,
+ };
+
+
+ *enemy = hh_background_collision ( *enemy, enemy_new);
+}
+void hh_slime_ai(hh_entity* enemy, hh_entity player){
+ int8_t direction = hh_get_direction(player.pos.x, enemy->pos.x);
+ if((player.pos.x - enemy->pos.x) >= -hunt_player && (player.pos.x - enemy->pos.x) <= hunt_player){
+ hh_movement_entity(enemy, direction);
+ }
+ hh_gravity_entity(enemy);
+ hh_update_enemy_movement(enemy);
+
+}
+
+void hh_jump_slime_ai(hh_entity* enemy, hh_entity player){
+ int8_t direction = hh_get_direction(player.pos.x, enemy->pos.x);
+ hh_gravity_entity(enemy);
+ if((player.pos.x - enemy->pos.x) >= -hunt_player && (player.pos.x - enemy->pos.x) <= hunt_player){
+ hh_movement_entity(enemy, direction);
+ // TODO: fix this if statement and make it cleaner. this makes the enemy jump when the player mets the condition
+ if((player.pos.y - enemy->pos.y) < -16 && (player.pos.y - enemy->pos.y) >= -100 && (player.pos.x - enemy->pos.x) >= -10 && (player.pos.x - enemy->pos.x) <= 10){
+ hh_jump_entity(enemy);
+ }
+ }
+
+ hh_update_enemy_movement(enemy);
+
+}
+#define terror_owl_attack_timer 100
+#define terror_owl_follow_player_delay 5
+#define terror_owl_attack_player_delay 12
+#define terror_owl_dive_speed 3
+#define delay_frames 2
+#define terror_owl_minimal_distance_from_player 100
+void hh_terror_owl_ai(hh_entity* enemy, hh_entity player){
+ static int count=0;
+ static int last_y_location=0;
+
+ if (count < terror_owl_attack_timer) {
+ // Move towards player position smoothly
+ int delta_x = (-50 + player.pos.x - enemy->pos.x) / terror_owl_follow_player_delay;
+ enemy->pos.x += delta_x;
+ enemy->pos.y = player.pos.y - terror_owl_minimal_distance_from_player;
+
+ count++;
+ last_y_location=player.pos.y;
+ } else {
+ if(enemy->pos.y <= last_y_location){
+ int delta_x = (player.pos.x - enemy->pos.x) / terror_owl_attack_player_delay;
+ enemy->pos.x += delta_x;
+ enemy->pos.y += terror_owl_dive_speed;
+ }
+ else{
+ count = 0;
+ }
+ }
+
+}
+void hh_update_enemy(hh_entity* enemy , hh_entity player, vec_cor cam_pos){
+ // static hh_e_entity_type type;
+ switch (enemy->object_type)
+ {
+ case slime:
+ hh_slime_ai(enemy,player);
+ break;
+ case jumping_slime:
+ hh_jump_slime_ai(enemy,player);
+ break;
+ case terror_owl:
+ hh_terror_owl_ai(enemy,player);
+ break;
+ default:
+ break;
+ }
+}
diff --git a/src/engine/enemy_ai.h b/src/engine/enemy_ai.h
new file mode 100644
index 0000000..d68f50f
--- /dev/null
+++ b/src/engine/enemy_ai.h
@@ -0,0 +1,10 @@
+#pragma once
+#include "player_controller.h"
+#include "engine/sprite_controller.h"
+#include "types.h"
+#include "input.h"
+#include <math.h>
+
+
+#define hunt_player 100
+void hh_update_enemy(hh_entity* enemy , hh_entity player, vec_cor cam_pos);
diff --git a/src/engine/entity.c b/src/engine/entity.c
index 1cb88be..eba6481 100644
--- a/src/engine/entity.c
+++ b/src/engine/entity.c
@@ -43,6 +43,7 @@ void hh_solve_collision(vec2 pos_environment, hh_entity* entity){
// entity->vel.x = 0;
// }
}
+
hh_entity hh_background_collision (hh_entity temp_old_entity,hh_entity temp_new_entity){
temp_new_entity.is_grounded = false;
@@ -119,6 +120,7 @@ bool hh_background_collision_bulllet (hh_entity temp_old_entity){
// temp_old_entity.vel = temp_new_entity.vel;
return false;
}
+
hh_entity hh_enemy_collision(hh_entity temp_player, hh_entity temp_enemy){
bool collide = hh_distance_circles( temp_player.pos, temp_enemy.pos, temp_player.radius, temp_enemy.radius);
@@ -138,7 +140,7 @@ hh_entity hh_enemy_collision(hh_entity temp_player, hh_entity temp_enemy){
temp_player.vel.x = 8;
}
// ghost mode / invulnerable or other things on hit
- // temp_player.hp--;
+ temp_player.hp--;
} else {
temp_player.is_hit = false;
@@ -170,14 +172,35 @@ void hh_jump_entity(hh_entity* object_1){
}
}
void hh_gravity_entity(hh_entity* object_1){
- if (object_1->is_grounded == false && object_1->vel.y < 6) {
+ if (object_1->is_grounded == false) {
object_1->vel.y += 1; //gravity
}
}
-void hh_hit_entity(hh_entity* object_1, int8_t* hit_timer, int8_t* direction){
+
+void hh_movement_entity(hh_entity* object_1, int8_t* direction){
+ if(direction != 0){
+ if(object_1->vel.x > -1 * object_1->speed && object_1->vel.x < object_1->speed) {
+ object_1->vel.x = object_1->vel.x + direction;
+ } else {
+ if (object_1->vel.x > 0) {
+ object_1->vel.x--;
+ } else if(object_1->vel.x < 0) {
+ object_1->vel.x++;
+ }
+ }
+ } else {
+ if (object_1->vel.x > 0) {
+ object_1->vel.x--;
+ } else if(object_1->vel.x < 0) {
+ object_1->vel.x++;
+ }
+ }
+
+}
+void hh_player_move_hit(hh_entity* object_1, int8_t* hit_timer, int8_t* direction){
if(object_1->is_hit == true){
hit_timer = 9;
- object_1->is_hit = false;
+ //object_1->is_hit = false;
}
if(hit_timer > -10){
hit_timer--;
diff --git a/src/engine/entity.h b/src/engine/entity.h
index fde9341..fb1c905 100644
--- a/src/engine/entity.h
+++ b/src/engine/entity.h
@@ -51,9 +51,12 @@ void hh_jump_entity(hh_entity* );
/** @brief looks if the player is grounded and if not it sets the position down */
void hh_gravity_entity(hh_entity* );
/** @brief if object is hit bounches in specific direction and moves the object */
-void hh_hit_entity(hh_entity* object_1, int8_t* hit_timer, int8_t* direction);
+void hh_player_move_hit(hh_entity* object_1, int8_t* hit_timer, int8_t* direction);
+
+void hh_movement_entity(hh_entity* object_1, int8_t* direction);
/** @brief specific bullet background collisions detection */
bool hh_background_collision_bulllet (hh_entity temp_old_entity);
/** @brief checks any entity has a hit on each othe*/
void hh_check_all_collisions(hh_entity* player, hh_entity* enemies, int total_enemies, hh_entity* bullets, int total_bullets, vec_cor cam_pos);
+
diff --git a/src/engine/level_const.c b/src/engine/level_const.c
index 896d0e0..2522814 100644
--- a/src/engine/level_const.c
+++ b/src/engine/level_const.c
@@ -4,7 +4,11 @@
hh_g_all_levels hh_init_game_levels(){
hh_g_all_levels levels;
- levels.current_level=0;
+ levels.current_level=1;
+
+ levels.shop.size.x=40;
+ levels.shop.size.y=15;
+ levels.shop.hh_level_completed=false;
levels.level[0].size.x=40;
levels.level[0].size.y=100;
@@ -14,9 +18,9 @@ hh_g_all_levels hh_init_game_levels(){
levels.level[1].size.y=28;
levels.level[1].hh_level_completed=false;
- FILE *fp = fopen("../test/bin/level1_test.bin", "rb");
+ FILE *fp = fopen("static/shop_new.bin", "rb");
if (fp == NULL) {
- printf("level1_test.bin not found!\n");
+ printf("shop_new.bin not found!\n");
return levels;
}
fseek(fp, 0, SEEK_END);
@@ -38,6 +42,19 @@ hh_g_all_levels hh_init_game_levels(){
fread(hh_game_level2, sizeof(int), size, lvl2);
fclose(lvl2);
+ FILE *shop = fopen("static/shop_new.bin", "rb");
+ if (shop == NULL) {
+ printf("shop.bin not found!\n");
+ return levels;
+ }
+ fseek(shop, 0, SEEK_END);
+ size = ftell(shop) / sizeof(int);
+ fseek(shop, (0 * sizeof(int)) + sizeof(int), SEEK_SET);
+ int* hh_game_shop = malloc(size * sizeof(int));
+ fread(hh_game_shop, sizeof(int), size, shop);
+ fclose(shop);
+
+ levels.shop.place = hh_game_shop;
levels.level[0].place = hh_game_level1;
levels.level[1].place = hh_game_level2;
diff --git a/src/engine/level_const.h b/src/engine/level_const.h
index 6275b72..a17993e 100644
--- a/src/engine/level_const.h
+++ b/src/engine/level_const.h
@@ -23,6 +23,7 @@ typedef struct {
typedef struct {
hh_level_entity level[2];
+ hh_level_entity shop;
int current_level;
diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c
index 83c5966..0148792 100644
--- a/src/engine/player_controller.c
+++ b/src/engine/player_controller.c
@@ -5,6 +5,8 @@
#include "engine/player_controller.h"
#include "input.h"
+#include "static/tilemap.h"
+
#include "engine/animator.h"
#include "engine/bullet.h"
void hh_player_actions(hh_entity* player){
@@ -16,7 +18,7 @@ void hh_player_actions(hh_entity* player){
int8_t direction_x = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right);
int8_t direction_y = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down);
- hh_hit_entity(player,hit_timer,direction_x);
+ hh_player_move_hit(player,hit_timer,direction_x);
hh_gravity_entity(player);
if(g_hh_controller_p1.button_primary){
hh_jump_entity(player);
diff --git a/src/engine/sprite_controller.c b/src/engine/sprite_controller.c
index b38b647..d386d0f 100644
--- a/src/engine/sprite_controller.c
+++ b/src/engine/sprite_controller.c
@@ -5,8 +5,18 @@
#include "ppu/consts.h"
#include "ppu/ppu.h"
+#include "static/tilemap.h"
+
+
uint8_t hh_get_palette(uint8_t tile_idx) {
- return hh_g_sprite_palette[tile_idx];
+ for (int i = 0; i < HH_TM_GROUPS; i++) {
+ if (hh_palette_lut[i] > tile_idx){
+ return hh_g_sprite_palette[i-1];
+ }
+ }
+
+ return 0; //not found
+ // return hh_g_sprite_palette[tile_idx];
}
void hh_setup_palettes(){
diff --git a/src/engine/sprite_controller.h b/src/engine/sprite_controller.h
index fc6d3d3..3693850 100644
--- a/src/engine/sprite_controller.h
+++ b/src/engine/sprite_controller.h
@@ -3,6 +3,8 @@
#include "ppu/types.h"
+#include "static/tilemap.h"
+
// handles sprites
// Bg sprites
@@ -11,27 +13,29 @@
//TODO: pack data inside of sprite_palette LUT
//HH_PPU_PALETTE_COUNT
-#define HH_SPRITE_COUNT 80
-#define HH_PAL_IDX_SKY 512
+
+#define HH_PAL_IDX_SKY 0
#define HH_PAL_IDX_BRICK 1
-const static uint8_t hh_g_sprite_palette[HH_SPRITE_COUNT] = {
- //TODO: make a buffer of 16 no-collider sprites (instead of the current 1)
- 0,1,1,1,1,1,1,1,1,1, //1+9
- 1,1,1,1,1,1,1,1,1,1, //6+4
- 1,1,1,1,1,1,1,1,1, //9
- 7,7,7,2,7,7,1,2,7,
- 7,7,7,7, //??
+#define HH_PAL_IDX_SLIME 2
+#define HH_PAL_IDX_CRATE 4
+#define HH_PAL_IDX_SHOP 5
+#define HH_PAL_IDX_TITLE_SCREEN_ICON 3
+#define HH_PAL_IDX_FONT 6
+#define HH_PAL_IDX_DEV 7
+const static uint8_t hh_g_sprite_palette[HH_TM_GROUPS] = {
+ HH_PAL_IDX_SKY,
+ HH_PAL_IDX_BRICK,
+ HH_PAL_IDX_CRATE,
+ HH_PAL_IDX_SHOP,
+ // HH_PAL_IDX_SHOP,
+ HH_PAL_IDX_TITLE_SCREEN_ICON,
+ HH_PAL_IDX_FONT,
+ HH_PAL_IDX_SKY,
+ HH_PAL_IDX_DEV,
+ HH_PAL_IDX_SLIME,
+ HH_PAL_IDX_DEV
+ // HH_PAL_IDX_FONT
- 7,6,6,6,6,6,6,6, //baskets
- 7,7,7,7,7,7,7,7,7,7, //shop
- 7,7,7,7,7, //shop
- 6,6,6,6,6, //(hi-)score
-
- 3,3,3,3,3,3, //title_screen icon
- 6,6,6,6,/*6,6,6,6,6,6, //title_screen large letters
- 6,6,6,6,*/
- //other palettes here:
- // [HH_PAL_IDX_SKY] = 0,
};
@@ -47,13 +51,13 @@ const static hh_ppu_loc_palette_table_t hh_g_palette = {
{0x0,0x0,0x0}},
{//Bricks
{0x1,0x2,0x3},//01
- {0xd,0x8,0xa},//24
{0x0,0x0,0x1},//25
{0x1,0x1,0x1},//26
{0x1,0x1,0x2},//27
{0x2,0x2,0x3},//28
{0x3,0x4,0x5},//29
- {0x5,0x1,0x7}},
+ {0x5,0x1,0x7},
+ {0xd,0x8,0xa}},//24
{//slime
{0x1,0x2,0x3},
{0x1,0x3,0x2},
@@ -69,27 +73,35 @@ const static hh_ppu_loc_palette_table_t hh_g_palette = {
{0x4,0x2,0x5},
{0x7,0x3,0x7},
{0xe,0xe,0xe},
- {0xe,0xe,0xe}, //elemental
- {0x0,0x0,0x0},
- {0x0,0x0,0x0}},
- {
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0}},
- {//elemental
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
+ {0x7,0x2,0x3}, //elemental
+ {0xc,0x5,0x3},
+ {0xe,0xc,0x7}},
+ {//crates
+ {0x5,0x7,0x7},
+ {0x3,0x1,0x2},
+ {0x6,0x2,0x2},
+ {0x7,0x4,0x4},
+ {0xa,0x7,0x5},
{0x0,0x0,0x0},
{0x0,0x0,0x0},
{0x0,0x0,0x0}},
+ {//shop
+ // {0x1,0x2,0x3},
+ // {0x0,0x0,0x1},
+ // {0x0,0x0,0x0},
+ // {0x0,0x0,0x0},
+ // {0x0,0x0,0x0},
+ // {0x0,0x0,0x0},
+ // {0x0,0x0,0x0},
+ // {0x0,0x0,0x0}},
+ {0x1, 0x2, 0x3},//0
+ {0x0, 0x0, 0x1},//1
+ {0x6, 0x2, 0x2},//2
+ {0x7, 0x4, 0x4},//3
+ {0xc, 0x9, 0x7},//4
+ {0xd, 0xb, 0x9},//5
+ {0x3, 0x4, 0x5},//6
+ {0x8, 0x9, 0x9}},
{//white
{0x1,0x2,0x3},
{0xf,0xf,0xf},
@@ -112,7 +124,9 @@ const static hh_ppu_loc_palette_table_t hh_g_palette = {
void hh_setup_palettes();
+//TODO: UPDATE THIS FUNCTION
/** @brief return palette index that belongs to tilemap index */
uint8_t hh_get_palette(uint8_t tile_idx);
+//TODO: UPDATE THIS FUNCTION
bool hh_colidable(uint8_t tile_idx);
diff --git a/src/engine/title_screen.c b/src/engine/title_screen.c
index 9c7ed48..1e9e586 100644
--- a/src/engine/title_screen.c
+++ b/src/engine/title_screen.c
@@ -2,6 +2,8 @@
#include "ppu/types.h"
#include "ppu/consts.h"
+#include "static/tilemap.h"
+
#include "engine/draw_screen.h"
#include "engine/entity.h"
@@ -12,7 +14,7 @@ void hh_init_title_screen(){
//send data
uint8_t idx = 0;
- const uint8_t tilemap_offset = 59;
+ const uint8_t tilemap_offset = HH_TM_TITLE_SCREEN_ICON_OFFSET;
int tiles_h = HH_PPU_BG_CANVAS_TILES_H;
int vp_h = HH_PPU_SCREEN_WIDTH/HH_PPU_SPRITE_WIDTH; //screen_h in tiles
int vert_offset = tiles_h*3;
@@ -45,7 +47,7 @@ void hh_init_title_screen(){
}
- const uint8_t letters_offset = 66;
+ const uint8_t letters_offset = HH_TM_TITLE_SCREEN_LETTERES_LARGE_OFFSET;
const int _size_hooded = 7, _size_v = 2;
// char* hh = "hooded";
diff --git a/src/engine/types.h b/src/engine/types.h
index 00b381b..8040e46 100644
--- a/src/engine/types.h
+++ b/src/engine/types.h
@@ -4,6 +4,9 @@
typedef uint8_t hh_ppu_fg_idx;
// typedef uint16_t hh_bg_idx;
+typedef enum {
+ slime, jumping_slime, terror_owl,
+}hh_e_all_objects_game_type;
typedef enum {
fire, ice, poison
@@ -31,6 +34,7 @@ typedef struct {
vec2 pos, vel, size;
bool is_grounded;
bool is_hit;
+ hh_e_all_objects_game_type object_type;
uint8_t radius;
int8_t hp;
int8_t speed;
diff --git a/src/game_loop/gameplay.c b/src/game_loop/gameplay.c
index da029f3..384ce40 100644
--- a/src/game_loop/gameplay.c
+++ b/src/game_loop/gameplay.c
@@ -1,5 +1,6 @@
#include "gameplay.h"
#include "engine/entity.h"
+#include "static/tilemap.h"
// player struct
@@ -12,59 +13,58 @@ void hh_gameplay(hh_g_all_levels* game, hh_e_game_state* hh_game_state){
.is_grounded = false,
.is_hit = false,
.radius = 8,
- .pos = (vec2){32,32},
- .size = (vec2){32,32},
+ .pos = (vec2){32,200},
+ .size = (vec2){16,32},
.vel = (vec2){0,0},
.render = {
- .frame0 = 3,
+ .frame0 = HH_TM_GOZER_OFFSET,
.palette = 3,
.fam = (hh_s_ppu_loc_fam_entry){
.horizontal_flip = false,
.vertical_flip = false,
.palette_index = 3,
- .tilemap_index = 80,
+ .tilemap_index = HH_TM_GOZER_OFFSET,
}
}
};
// enemy gets replaced here is just for reference
static hh_entity enemy={
+ .object_type = jumping_slime,
.hp = 4,
- .speed = 6,
+ .speed = 2,
.is_grounded = false,
.is_hit = false,
.radius = 8,
- .pos = (vec2){128,24},
+ .pos = (vec2){200,200},
.size = (vec2){16,16},
.vel = (vec2){0,0},
// .vec = (vec2){0,0},
.render = {
- .frame0 = 1,
- .palette = 7,
+ .frame0 = HH_TM_SLIME_OFFSET,
+ .palette = 2,
.fam = (hh_s_ppu_loc_fam_entry){
.horizontal_flip = false,
.vertical_flip = false,
- .palette_index = 7,
- .tilemap_index = 1,
+ .palette_index = 2,
+ .tilemap_index = HH_TM_SLIME_OFFSET,
}
}
};
- static int total_bullets = 5;
+ static int total_bullets = 15;
switch (gameplay)
{
case hh_e_setup_screen:
- printf("%d\n",game->current_level);
bullets = hh_init_bullets(total_bullets);
hh_setup_screen(game->level[game->current_level]);
gameplay = hh_e_play_level;
- enemy.hp=4;
break;
case hh_e_play_level:
- // TODO: here come all the different functions for the gameplay
- vec_cor cam_pos;//value in tiles
+
+ vec_cor cam_pos;
cam_pos = hh_draw_screen(player1.pos);
hh_player_actions(&player1);
hh_multiple_bullets(player1.pos,bullets);
- hh_multiple_enemies(cam_pos, &enemy,1);
+ hh_multiple_enemies(&enemy, player1, cam_pos, 1);
hh_check_all_collisions(&player1,&enemy,1,bullets,total_bullets,cam_pos);
hh_solve_hitted_enemies(&enemy,1);
hh_render_all_entities(&player1,bullets,&enemy,total_bullets,1, cam_pos);
@@ -74,19 +74,24 @@ void hh_gameplay(hh_g_all_levels* game, hh_e_game_state* hh_game_state){
if(game->level[game->current_level].hh_level_completed){
gameplay = hh_e_level_complete;
}
+ else if(player1.hp == 0){
+ gameplay = hh_e_game_over;
+ }
break;
case hh_e_level_complete:
- if(game->current_level < 3){
- game->current_level+=1;
- gameplay = hh_e_setup_screen;
- }
- else {
- gameplay = hh_e_game_over;
- }
+ // // TODO: from complete to shop or game_over
+ // if(game->current_level < 3){
+ // game->current_level+=1;
+ // gameplay = hh_e_setup_screen;
+ // }
+ // else {
+
+ // gameplay = hh_e_game_over;
+ // }
break;
case hh_e_game_over:
// todo make reset levels
- hh_reset_levels();
+ hh_reset_levels(&player1);
gameplay = hh_e_setup_screen;
*hh_game_state = hh_e_state_game_over;
break;
@@ -95,18 +100,39 @@ void hh_gameplay(hh_g_all_levels* game, hh_e_game_state* hh_game_state){
}
}
-void hh_reset_levels(){}
+void hh_reset_levels(hh_entity* player){
+ *player = (hh_entity){
+ .hp = 4,
+ .speed = 6,
+ .is_grounded = false,
+ .is_hit = false,
+ .radius = 16,
+ .pos = (vec2){32,32},
+ .size = (vec2){16,32},
+ .vel = (vec2){0,0},
+ .render = {
+ .frame0 = HH_TM_GOZER_OFFSET,
+ .palette = 3,
+ .fam = (hh_s_ppu_loc_fam_entry){
+ .horizontal_flip = false,
+ .vertical_flip = false,
+ .palette_index = 3,
+ .tilemap_index = HH_TM_GOZER_OFFSET,
+ }
+ }
+ };
+}
void hh_render_all_entities(hh_entity* player, hh_entity* bullets, hh_entity* enemies, int bullet_size, int enemy_size, vec_cor cam_pos){
int index = 0;
- hh_update_sprite(0 , player, cam_pos);
+ hh_update_sprite(&index , player, cam_pos);
for (int i = 0; i < bullet_size; i++) {
- hh_update_sprite(i+5,&bullets[i],cam_pos);
+ hh_update_sprite(&index,&bullets[i],cam_pos);
}
for (int i = 0; i < enemy_size; i++) {
- hh_update_sprite(i+5+bullet_size,&enemies[i],cam_pos);
+ hh_update_sprite(&index,&enemies[i],cam_pos);
}
}
diff --git a/src/game_loop/gameplay.h b/src/game_loop/gameplay.h
index 9d66c37..8adddb4 100644
--- a/src/game_loop/gameplay.h
+++ b/src/game_loop/gameplay.h
@@ -15,8 +15,9 @@ typedef enum {
hh_e_level_complete,
hh_e_game_over,
}hh_e_gameplay;
+
/** @brief resets all the levels the first condition */
-void hh_reset_levels();
+void hh_reset_levels(hh_entity* player);
/** @brief game loop function to handle the gameplay*/
void hh_gameplay(hh_g_all_levels* game, hh_e_game_state* hh_game_state);
/** @brief renders all the entities*/
diff --git a/src/game_loop/shop.c b/src/game_loop/shop.c
index ea75d46..da27524 100644
--- a/src/game_loop/shop.c
+++ b/src/game_loop/shop.c
@@ -2,37 +2,44 @@
#include "engine/maths.h"
#include "ppu/ppu.h"
-void hh_shop(hh_e_game_state* hh_game_state){
+void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop){
static hh_e_shop_states hh_e_shop = hh_e_shop_show;
static hh_e_upgrades upgrades[HH_SHOP_UPG_DISPLAY] = {0};
static uint8_t selected = 0;
+ static bool pressed_LR = false;
switch (hh_e_shop)
{
case hh_e_shop_show:
- hh_clear_screen();
- hh_clear_sprite();
+ // hh_clear_screen();
+ // hh_clear_sprite();
// TODO: make function to show shop
//hh_setup_shop();
+ hh_setup_screen(*level_shop);
hh_shop_init(&upgrades);
selected = HH_SHOP_UPG_DISPLAY/2;
- // hh_shop_display(selected, &upgrades);
+ hh_shop_display(selected, &upgrades);
hh_e_shop = hh_e_shop_main;
break;
case hh_e_shop_main:
if(g_hh_controller_p1.dpad_left || g_hh_controller_p1.dpad_right){
- hh_shift_selected(&selected,(g_hh_controller_p1.dpad_right?1:0),0,HH_SHOP_UPG_DISPLAY);
- // hh_shop_display(selected, &upgrades);
+ if (!pressed_LR) {
+ hh_shift_selected(&selected,(g_hh_controller_p1.dpad_right?1:0),0,HH_SHOP_UPG_DISPLAY-1);
+ hh_shop_display(selected, &upgrades);
+ }
+ pressed_LR = true;
+ } else {
+ pressed_LR = false;
+ }
+ if(g_hh_controller_p1.button_primary){
+ //apply selected upgrade
+ // hh_e_shop = hh_e_shop_end;
}
- // if(g_hh_controller_p1.button_primary){
- // //apply selected upgrade
- // hh_e_shop = hh_e_shop_end;
- // }
if(g_hh_controller_p1.button_secondary){//Quick exit
hh_e_shop = hh_e_shop_end;
}
break;
- case hh_e_shop_end:
+ case hh_e_shop_end: // delay?
hh_e_shop = hh_e_shop_show;
*hh_game_state = hh_e_state_gameplay;
break;
@@ -42,6 +49,10 @@ void hh_shop(hh_e_game_state* hh_game_state){
}
}
+uint8_t hh_shop_translate_upgrades(hh_e_upgrades upg) {
+ return upg+10;
+}
+
void hh_shop_init(hh_e_upgrades* in) {
for (int i = 0; i < HH_SHOP_UPG_DISPLAY; i++) {
in[i] = i%HH_SHOP_UPG_COUNT;
@@ -49,7 +60,7 @@ void hh_shop_init(hh_e_upgrades* in) {
}
void hh_shop_display(uint8_t selected, hh_e_upgrades* upgrades) {
- const vec_cor start = {48,16};
+ const vec_cor start = {104,144+16};
const uint8_t up = 8,
space = 24+8;
@@ -57,20 +68,19 @@ void hh_shop_display(uint8_t selected, hh_e_upgrades* upgrades) {
hh_ppu_update_foreground(i+16,
(hh_s_ppu_loc_fam_entry){
.horizontal_flip = false, .vertical_flip = false,
- .position_x = i*space+start.x, .position_y = start.y + (i==selected?up:0),
+ .position_x = i*space+start.x, .position_y = start.y + (i==selected?-up:0),
.palette_index = 7,
- .tilemap_index = 8
+ .tilemap_index = hh_shop_translate_upgrades(upgrades[i])
});
}
}
-void hh_shift_selected(uint8_t* pos, bool dir, uint8_t min, uint8_t max) {
+void hh_shift_selected(uint8_t *pos, bool dir, uint8_t min, uint8_t max) {
if (dir) {
- pos = CLAMP(++pos,min,max);
+ *pos = MIN(*pos+1,max);
} else {
- if (pos > 0) {
- pos--;
- }
+ *pos = MAX(*pos-1,min);
}
+ // printf("b: %d sel: %d\n",dir, *pos);
}
diff --git a/src/game_loop/shop.h b/src/game_loop/shop.h
index b0ad5e4..6f8f5a7 100644
--- a/src/game_loop/shop.h
+++ b/src/game_loop/shop.h
@@ -15,12 +15,14 @@ typedef enum {
} hh_e_shop_states;
/** @brief amount of upgrade types */
-#define HH_SHOP_UPG_COUNT 2
+#define HH_SHOP_UPG_COUNT 5
/** @brief count of visible upgrades in shop */
#define HH_SHOP_UPG_DISPLAY 4
/** @brief all possible upgrades */
typedef enum {
hh_e_upg_jump,
+ hh_e_upg_speed,
+ hh_e_upg_damage,
hh_e_upg_heal,
hh_e_upg_max_health,
} hh_e_upgrades;
@@ -32,4 +34,4 @@ void hh_shop_display(uint8_t selected, hh_e_upgrades* upgrades);
/** @brief moves 'cursor' through selection field */
void hh_shift_selected(uint8_t* pos, bool dir, uint8_t min, uint8_t max);
-void hh_shop(hh_e_game_state*);
+void hh_shop(hh_e_game_state* ,hh_level_entity* );
diff --git a/src/game_loop/starting_screen.c b/src/game_loop/starting_screen.c
index c11e4fc..d9f8ea6 100644
--- a/src/game_loop/starting_screen.c
+++ b/src/game_loop/starting_screen.c
@@ -11,6 +11,7 @@ bool hh_show_starting_screen(){
{
case hh_e_state_show:
hh_clear_screen();
+ hh_clear_sprite();
hh_init_title_screen();
hh_e_starting_screen = hh_e_state_input;
return false;
diff --git a/src/makefile b/src/makefile
index fdd8ab5..ada73b1 100644
--- a/src/makefile
+++ b/src/makefile
@@ -42,6 +42,7 @@ LOCAL_SRCS += main.c \
engine/title_screen.c \
engine/level_const.c \
engine/enemy.c \
+ engine/enemy_ai.c \
engine/animator.c \
game_loop/shop.c \
game_loop/gameplay.c \
@@ -83,7 +84,15 @@ $(TARGET).bin: $(TARGET).elf
PHONY += flash
flash: $(TARGET).bin
- st-flash --reset write $(TARGET).bin 0x08000000
+ st-flash --reset write $< 0x08000000
+
+# see definition of g_hh_tilemap_rom in stm32/setup.c
+PHONY += rom
+rom: static/tilemap.bin
+ st-flash --reset write $< 0x08033000
+
+static/tilemap.bin static/tilemap.h &:
+ $(MAKE) -C static all
%-ds.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
@@ -104,4 +113,8 @@ PHONY += clean
clean:
$(RM) $(TARGET).bin $(TARGET).elf $(OBJS)
+PHONY += distclean
+distclean: clean
+ $(MAKE) -C static clean
+
.PHONY: $(PHONY)
diff --git a/src/ppu/consts.h b/src/ppu/consts.h
index a27b7b7..d7caf5e 100644
--- a/src/ppu/consts.h
+++ b/src/ppu/consts.h
@@ -55,3 +55,9 @@
#define HH_PPU_VRAM_AUX_OFFSET ((hh_ppu_addr_t) 0xde00)
/** @brief auxiliary memory size in words */
#define HH_PPU_VRAM_AUX_SIZE ((hh_ppu_addr_t) 0x0002)
+
+/** @brief sprite size in bytes */
+#define HH_PPU_BYTE_SPRITE_SIZE (HH_PPU_VRAM_TMM_SPRITE_SIZE * sizeof(hh_ppu_data_t))
+/** @brief sprite size in 32-bit words (for stm) */
+#define HH_PPU_NATIVE_SPRITE_SIZE (HH_PPU_BYTE_SPRITE_SIZE / sizeof(uint32_t))
+
diff --git a/src/ppu/ppu.c b/src/ppu/ppu.c
index df14b9f..1f46b16 100644
--- a/src/ppu/ppu.c
+++ b/src/ppu/ppu.c
@@ -3,6 +3,7 @@
#include "ppu/consts.h"
#include "ppu/internals.h"
#include "ppu/ppu.h"
+#include "tilemap.h"
void hh_ppu_update_foreground(unsigned index, hh_s_ppu_loc_fam_entry e) {
hh_s_ppu_vram_data s = hh_ppu_2nat_fam(e);
@@ -46,3 +47,26 @@ void hh_ppu_update_color(unsigned palette_index, unsigned color_index, hh_ppu_rg
hh_ppu_vram_write(c);
free(c.data);
}
+
+void hh_ppu_load_tilemap() {
+ for (size_t sprite_idx = 0; sprite_idx < HH_TM_SIZE; sprite_idx++) {
+ for (size_t word_idx = 0; word_idx < HH_PPU_NATIVE_SPRITE_SIZE; word_idx++) {
+ uint32_t native_word = g_hh_tilemap_rom[word_idx + sprite_idx * HH_PPU_NATIVE_SPRITE_SIZE];
+ uint32_t native_word_bytes[4] = { // TODO: check endianness of stm32
+ (native_word >> 24) & 0xff,
+ (native_word >> 16) & 0xff,
+ (native_word >> 8) & 0xff,
+ (native_word >> 0) & 0xff,
+ };
+ uint16_t ppu_words[2] = {
+ (native_word_bytes[2] << 8) | (native_word_bytes[3] << 0),
+ (native_word_bytes[0] << 8) | (native_word_bytes[1] << 0),
+ };
+ hh_ppu_vram_write((hh_s_ppu_vram_data) {
+ .data = ppu_words,
+ .offset = HH_PPU_VRAM_TMM_OFFSET + sprite_idx * HH_PPU_VRAM_TMM_SPRITE_SIZE + word_idx * 2,
+ .size = 2,
+ });
+ }
+ }
+}
diff --git a/src/ppu/ppu.h b/src/ppu/ppu.h
index 75d97c1..46b58af 100644
--- a/src/ppu/ppu.h
+++ b/src/ppu/ppu.h
@@ -23,3 +23,6 @@ void hh_ppu_update_palette_table(hh_ppu_loc_palette_table_t table);
void hh_ppu_update_palette(unsigned palette_index, hh_ppu_loc_palette_data_t palette);
/** @brief update single color in palette */
void hh_ppu_update_color(unsigned palette_index, unsigned color_index, hh_ppu_rgb_color_t color);
+
+/** @brief copy g_hh_tilemap_rom into PPU vram */
+void hh_ppu_load_tilemap();
diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c
index 8b67acc..0f8d687 100644
--- a/src/ppusim/sim.c
+++ b/src/ppusim/sim.c
@@ -10,9 +10,11 @@
#include "ppusim/mem.h"
#include "ppusim/sim.h"
#include "ppusim/work.h"
+#include "tilemap.h"
SDL_Window *g_hh_window = NULL;
SDL_Renderer *g_hh_renderer = NULL;
+uint32_t* g_hh_tilemap_rom = NULL;
void hh_ppu_init() {
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
@@ -25,38 +27,27 @@ void hh_ppu_init() {
g_hh_ppusim_vram = malloc(sizeof(hh_ppu_data_t) * 0xffff);
memset(g_hh_ppusim_vram, 0x0000, 0xffff);
+ hh_ppusim_load_tilemap();
+
hh_ppu_load_tilemap();
}
-void hh_ppu_load_tilemap() {
- //TODO: remove magic file name here
- char* filename = "static/tiles.bin";
- FILE* fp = fopen(filename,"rb");
- if (!fp){
- fprintf(stderr,"Error: Failed to load tiles.");
- return;//error
- }
- int sprite_size = (HH_PPU_SPRITE_WIDTH * HH_PPU_SPRITE_HEIGHT);
- fseek(fp, 0, SEEK_END);//goto EOF
- int _size = ftell(fp)/sprite_size;
- fseek(fp, 0, 0);//goto start of file
+void hh_ppusim_load_tilemap() {
+ FILE* fp = fopen("static/tilemap.bin", "rb");
- for (int i = 0; i < _size; i++) {
- uint8_t data[sprite_size];
+ fseek(fp, 0, SEEK_END);
+ size_t file_size = ftell(fp);
+ rewind(fp);
- fread(data,sizeof(uint8_t),sprite_size,fp);
-
- hh_s_ppu_vram_data sprite = hh_ppu_2nat_sprite(data);
- sprite.offset = i*HH_PPU_VRAM_TMM_SPRITE_SIZE;
- hh_ppu_vram_write(sprite);
- free(sprite.data);
- }
+ g_hh_tilemap_rom = malloc(file_size);
+ fread(g_hh_tilemap_rom, file_size, 1, fp);
fclose(fp);
}
void hh_ppu_deinit() {
free(g_hh_ppusim_threads);
free(g_hh_ppusim_vram);
+ free(g_hh_tilemap_rom);
SDL_DestroyRenderer(g_hh_renderer);
SDL_DestroyWindow(g_hh_window);
diff --git a/src/ppusim/sim.h b/src/ppusim/sim.h
index 4d1d718..218d61d 100644
--- a/src/ppusim/sim.h
+++ b/src/ppusim/sim.h
@@ -5,5 +5,5 @@
/** @brief max framerate for PPUSIM */
#define HH_PPUSIM_FRAMERATE 60
-/** @brief pump tilemap from rom to ppu ram */
-void hh_ppu_load_tilemap(); //ppu sim?
+/** @brief load static/tilemap.bin into memory */
+void hh_ppusim_load_tilemap();
diff --git a/src/static/.gitignore b/src/static/.gitignore
new file mode 100644
index 0000000..746c28c
--- /dev/null
+++ b/src/static/.gitignore
@@ -0,0 +1,10 @@
+**/*.bin
+**/*.meta
+manifest.txt
+tilemap.h
+tiled/*
+tiled.mk
+*.tsx
+*.csv
+*.out
+*.tiled-session
diff --git a/src/static/Source.cpp b/src/static/Source.cpp
new file mode 100644
index 0000000..0bba7c6
--- /dev/null
+++ b/src/static/Source.cpp
@@ -0,0 +1,42 @@
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+
+int main(int argc, char** argv) {
+
+ std::ifstream f;
+ f.open("out.csv"); /* open file with filename as argument */
+ if (!f.is_open()) { /* validate file open for reading */
+ std::cerr << "error: file open failed '" << argv[1] << "'.\n";
+ return 0;
+ }
+
+
+ std::string line, val; /* string for line & value */
+ std::vector<std::vector<int>> array; /* vector of vector<int> */
+
+ while (std::getline(f, line)) { /* read each line */
+ std::vector<int> v; /* row vector v */
+ std::stringstream s(line); /* stringstream line */
+ while (getline(s, val, ',')) /* get each value (',' delimited) */
+ v.push_back(std::stoi(val)); /* add to row vector */
+ array.push_back(v); /* add row vector to array */
+ }
+
+ std::vector<int> flat_array; /* create 1D vector */
+ for (auto& row : array) { /* iterate over rows */
+ for (auto& val : row) /* iterate over vals */
+ flat_array.push_back(val); /* add to 1D vector */
+ }
+
+ int* array1d = flat_array.data(); /* get pointer to data */
+ int size = flat_array.size(); /* get size of 1D array */
+
+ std::ofstream out_file("out.bin", std::ios::binary); /* create binary file */
+ out_file.write((char*)&size, sizeof(size)); /* write size of 1D array to file */
+ out_file.write((char*)array1d, size * sizeof(int)); /* write 1D array to file */
+ out_file.close(); /* close file */
+
+ return 0;
+}
diff --git a/src/static/background/air.hex b/src/static/background/air.hex
new file mode 100644
index 0000000..5160cd6
--- /dev/null
+++ b/src/static/background/air.hex
@@ -0,0 +1,17 @@
+00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+
diff --git a/src/static/background/bricks.hex b/src/static/background/bricks.hex
new file mode 100644
index 0000000..717b91d
--- /dev/null
+++ b/src/static/background/bricks.hex
@@ -0,0 +1,457 @@
+;indices: 7
+;25 3a 5e
+;09 0a 14
+;10 14 1f
+;15 1d 28
+;20 2e 37
+;39 4a 50
+;57 72 77
+
+000000: 06 06 06 06 06 05 06 06 06 06 06 05 06 06 06 06
+000010: 06 05 05 05 05 03 05 05 05 05 05 03 05 05 05 05
+000020: 06 05 04 04 04 03 05 05 05 05 05 03 05 05 05 05
+000030: 06 04 04 04 04 02 02 02 02 02 02 02 02 02 02 02
+000040: 06 04 04 04 04 02 02 03 03 03 03 03 03 02 03 03
+000050: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+000060: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+000070: 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02 02
+000080: 06 06 04 04 04 04 04 02 02 02 03 03 03 03 02 02
+000090: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0000a0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+0000b0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+0000c0: 00 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03
+0000d0: 00 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03
+0000e0: 00 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03
+0000f0: 06 06 06 05 05 05 02 02 02 02 02 02 02 02 02 02
+000100: 06 06 06 05 06 06 06 06 06 06 06 05 06 06 06 06
+000110: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+000120: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+000130: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000140: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+000150: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+000160: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+000170: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000180: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+000190: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0001a0: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0001b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0001c0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+0001d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+0001e0: 02 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+0001f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000200: 06 06 06 05 06 06 06 06 06 06 05 06 06 06 06 06
+000210: 05 05 05 03 05 05 05 05 05 05 03 05 05 05 05 06
+000220: 05 05 05 03 05 05 05 05 05 05 03 04 04 05 05 06
+000230: 02 02 02 02 02 02 02 02 02 02 02 04 04 04 04 06
+000240: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 06
+000250: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+000260: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+000270: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+000280: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+000290: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0002a0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0002b0: 02 02 02 02 02 02 02 02 02 02 02 05 05 06 06 06
+0002c0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 06
+0002d0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 06
+0002e0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 05
+0002f0: 02 02 02 02 02 02 02 02 02 02 02 02 03 03 03 05
+000300: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+000310: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+000320: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 02 02
+000330: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+000340: 00 05 04 04 04 03 02 03 03 03 03 03 03 02 03 03
+000350: 00 05 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+000360: 00 04 04 04 04 02 03 03 03 03 03 02 02 02 02 03
+000370: 06 06 05 05 02 02 02 02 02 02 02 02 02 02 02 02
+000380: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+000390: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0003a0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+0003b0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+0003c0: 00 05 05 04 04 04 04 03 02 03 03 03 03 03 03 03
+0003d0: 00 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03
+0003e0: 00 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03
+0003f0: 00 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02
+000400: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+000410: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+000420: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+000430: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000440: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+000450: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+000460: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+000470: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000480: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+000490: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0004a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+0004b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0004c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+0004d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+0004e0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+0004f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000500: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+000510: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+000520: 03 03 02 02 03 03 03 03 03 03 03 02 04 04 04 00
+000530: 02 02 02 02 02 02 02 02 02 02 02 02 02 06 06 06
+000540: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 06
+000550: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+000560: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+000570: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+000580: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+000590: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0005a0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0005b0: 02 02 02 02 02 02 02 02 02 02 02 03 03 06 06 06
+0005c0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 06
+0005d0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 05
+0005e0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 05
+0005f0: 02 02 02 02 02 02 02 02 02 02 02 02 03 03 03 05
+000600: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+000610: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+000620: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 02 02
+000630: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+000640: 00 05 04 04 04 03 02 03 03 03 03 03 03 02 03 03
+000650: 00 05 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+000660: 00 04 04 04 04 02 03 03 03 03 03 02 02 02 02 03
+000670: 06 06 05 05 02 02 02 02 02 02 02 02 02 02 02 02
+000680: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+000690: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0006a0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+0006b0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+0006c0: 00 05 05 04 04 04 04 04 04 04 04 02 02 02 02 04
+0006d0: 00 05 05 04 04 04 04 04 04 04 04 04 02 04 04 04
+0006e0: 00 06 05 05 05 04 04 04 04 04 04 04 03 04 04 04
+0006f0: 00 06 06 06 05 05 05 05 05 05 05 05 03 05 05 05
+000700: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+000710: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+000720: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+000730: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000740: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+000750: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+000760: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+000770: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000780: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+000790: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0007a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+0007b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0007c0: 04 04 04 04 04 04 04 04 03 03 03 04 04 04 04 04
+0007d0: 04 04 04 04 04 04 04 04 04 03 03 04 04 04 04 04
+0007e0: 04 04 04 04 04 04 04 04 04 03 04 04 04 04 04 04
+0007f0: 05 05 05 05 05 05 05 05 05 03 05 05 05 05 05 05
+000800: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+000810: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+000820: 03 03 02 02 03 03 03 03 03 03 03 02 04 04 04 00
+000830: 02 02 02 02 02 02 02 02 02 02 02 02 02 06 06 06
+000840: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 06
+000850: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+000860: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+000870: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+000880: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+000890: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0008a0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0008b0: 02 02 02 02 02 02 03 03 03 03 03 03 03 06 06 06
+0008c0: 04 04 03 03 03 04 04 04 04 04 04 04 04 04 05 06
+0008d0: 04 04 04 03 03 04 04 04 04 04 04 04 04 05 05 05
+0008e0: 04 04 04 03 04 04 04 04 04 04 04 05 05 05 05 06
+0008f0: 05 05 05 03 05 05 05 05 05 05 05 05 05 06 06 06
+000900: 06 06 06 06 06 05 06 06 06 06 06 05 06 06 06 06
+000910: 06 05 05 05 05 03 05 05 05 05 05 03 05 05 05 05
+000920: 06 05 04 04 04 03 05 05 05 05 05 03 05 05 05 05
+000930: 06 04 04 04 04 02 02 02 02 02 02 02 02 02 02 02
+000940: 06 04 04 04 04 02 02 03 03 03 03 03 03 02 03 03
+000950: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+000960: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+000970: 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02 02
+000980: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+000990: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0009a0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+0009b0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+0009c0: 00 05 05 04 04 04 04 04 04 04 04 02 02 02 02 04
+0009d0: 00 05 05 04 04 04 04 04 04 04 04 04 02 04 04 04
+0009e0: 00 06 05 05 05 04 04 04 04 04 04 04 03 04 04 04
+0009f0: 00 06 06 06 05 05 05 05 05 05 05 05 03 05 05 05
+000a00: 06 06 06 05 06 06 06 06 06 06 06 05 06 06 06 06
+000a10: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+000a20: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+000a30: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000a40: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+000a50: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+000a60: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+000a70: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000a80: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+000a90: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+000aa0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+000ab0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000ac0: 04 04 04 04 04 04 04 04 03 03 03 04 04 04 04 04
+000ad0: 04 04 04 04 04 04 04 04 04 03 03 04 04 04 04 04
+000ae0: 04 04 04 04 04 04 04 04 04 03 04 04 04 04 04 04
+000af0: 05 05 05 05 05 05 05 05 05 03 05 05 05 05 05 05
+000b00: 06 06 06 05 06 06 06 06 06 06 05 06 06 06 06 06
+000b10: 05 05 05 03 05 05 05 05 05 05 03 05 05 05 05 06
+000b20: 05 05 05 03 05 05 05 05 05 05 03 04 04 05 05 06
+000b30: 02 02 02 02 02 02 02 02 02 02 02 04 04 04 04 06
+000b40: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 06
+000b50: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+000b60: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+000b70: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+000b80: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+000b90: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+000ba0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+000bb0: 02 02 02 02 02 02 03 03 03 03 03 03 03 06 06 06
+000bc0: 04 04 03 03 03 04 04 04 04 04 04 04 04 04 05 06
+000bd0: 04 04 04 03 03 04 04 04 04 04 04 04 04 05 05 05
+000be0: 04 04 04 03 04 04 04 04 04 04 04 05 05 05 05 06
+000bf0: 05 05 05 03 05 05 05 05 05 05 05 05 05 06 06 06
+000c00: 06 06 06 06 06 05 06 06 06 06 05 06 06 06 06 06
+000c10: 06 05 05 05 05 03 05 05 05 05 03 05 05 05 05 06
+000c20: 06 05 04 04 04 03 05 05 05 05 03 04 04 05 05 06
+000c30: 06 04 04 04 04 02 02 02 02 02 02 04 04 04 04 06
+000c40: 06 04 04 04 04 02 02 03 03 03 02 04 04 04 04 06
+000c50: 05 04 04 04 04 02 03 03 03 03 02 04 04 04 04 05
+000c60: 05 04 04 04 04 02 03 03 03 03 02 04 04 04 04 05
+000c70: 03 03 03 03 03 02 02 02 02 02 02 03 03 03 03 05
+000c80: 06 06 04 04 04 04 04 02 04 04 04 04 04 05 05 00
+000c90: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+000ca0: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+000cb0: 05 03 03 03 03 03 02 02 02 02 02 05 05 06 06 06
+000cc0: 00 05 04 04 04 04 04 04 03 02 04 04 04 04 04 06
+000cd0: 00 05 04 04 04 04 04 04 03 02 04 04 04 04 04 06
+000ce0: 00 05 04 04 04 04 04 04 03 02 04 04 04 04 04 05
+000cf0: 06 06 06 05 05 05 02 02 02 02 02 02 03 03 03 05
+000d00: 06 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+000d10: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+000d20: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 04 00
+000d30: 05 03 03 03 03 03 02 02 02 02 02 02 02 06 06 06
+000d40: 00 05 04 04 04 03 02 03 03 02 04 04 04 04 04 06
+000d50: 00 05 04 04 04 02 03 03 03 02 04 04 04 04 04 05
+000d60: 00 04 04 04 04 02 03 03 03 02 03 04 04 04 04 05
+000d70: 06 06 05 05 02 02 02 02 02 02 02 03 03 03 03 05
+000d80: 06 04 04 04 04 04 04 02 04 04 04 04 04 05 05 00
+000d90: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+000da0: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+000db0: 05 03 03 03 03 03 02 02 02 02 02 03 03 06 06 06
+000dc0: 00 05 05 04 04 04 03 03 03 03 03 04 04 04 04 06
+000dd0: 00 05 04 04 04 04 03 03 03 03 04 04 04 04 04 05
+000de0: 00 05 04 04 04 03 03 03 03 03 04 04 04 04 04 05
+000df0: 00 05 03 03 03 03 03 02 02 02 02 02 03 03 03 05
+000e00: 06 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+000e10: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+000e20: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 04 00
+000e30: 05 03 03 03 03 03 02 02 02 02 02 02 02 06 06 06
+000e40: 00 05 04 04 04 03 02 03 03 02 04 04 04 04 04 06
+000e50: 00 05 04 04 04 02 03 03 03 02 04 04 04 04 04 05
+000e60: 00 04 04 04 04 02 03 03 03 02 04 04 04 04 04 05
+000e70: 06 06 05 05 02 02 02 02 02 02 02 03 03 03 03 05
+000e80: 06 04 04 04 04 04 04 02 04 04 04 04 04 05 05 00
+000e90: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+000ea0: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+000eb0: 05 03 03 03 03 03 02 02 03 03 03 03 03 06 06 06
+000ec0: 00 05 05 04 04 04 04 04 04 04 04 04 04 04 05 06
+000ed0: 00 05 05 04 04 04 04 04 04 04 04 04 04 05 05 05
+000ee0: 00 06 05 05 05 04 04 04 04 04 04 05 05 05 05 06
+000ef0: 00 06 06 06 05 05 05 05 05 05 05 05 05 06 06 06
+000f00: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+000f10: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+000f20: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+000f30: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000f40: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+000f50: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+000f60: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+000f70: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000f80: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+000f90: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+000fa0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+000fb0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000fc0: 02 02 02 03 03 03 03 03 03 02 03 03 03 04 04 04
+000fd0: 03 02 03 03 03 03 03 03 03 02 03 03 04 04 04 04
+000fe0: 03 02 03 03 03 03 03 03 02 02 02 03 04 04 04 04
+000ff0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001000: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+001010: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+001020: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+001030: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001040: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+001050: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+001060: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+001070: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001080: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+001090: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0010a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+0010b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0010c0: 02 02 02 04 04 03 03 03 03 02 03 03 03 03 03 03
+0010d0: 04 02 04 04 04 04 03 03 03 02 03 03 03 03 03 03
+0010e0: 04 02 04 04 04 04 03 03 02 02 02 03 03 03 03 03
+0010f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001100: 03 03 02 02 02 03 03 03 03 03 03 02 02 05 05 05
+001110: 03 03 03 02 03 03 03 03 03 03 03 02 03 05 05 05
+001120: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 05 05
+001130: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001140: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+001150: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+001160: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+001170: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001180: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+001190: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0011a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+0011b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0011c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+0011d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+0011e0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+0011f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001200: 06 05 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+001210: 05 05 05 02 03 03 03 03 03 03 03 02 03 03 03 03
+001220: 05 05 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+001230: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001240: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+001250: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+001260: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+001270: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001280: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+001290: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0012a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+0012b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0012c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+0012d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+0012e0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+0012f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001300: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001310: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001320: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001330: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001340: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001350: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001360: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001370: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001380: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001390: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0013a0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0013b0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0013c0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0013d0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0013e0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0013f0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001400: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+001410: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+001420: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+001430: 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01 01
+001440: 03 03 03 03 02 02 03 03 02 02 02 02 02 01 02 02
+001450: 03 03 03 03 03 02 02 02 02 02 02 02 02 01 02 02
+001460: 03 03 03 03 03 01 02 02 02 02 02 02 01 01 01 02
+001470: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+001480: 02 03 03 03 02 02 02 01 02 02 02 02 02 02 01 01
+001490: 03 03 03 03 02 02 02 01 02 02 02 02 02 02 02 01
+0014a0: 03 03 03 03 02 02 01 01 01 01 02 02 02 02 01 01
+0014b0: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+0014c0: 02 02 02 03 03 02 02 02 02 01 02 02 02 01 01 01
+0014d0: 03 02 03 03 03 02 02 02 02 01 02 02 01 01 01 01
+0014e0: 03 02 03 03 03 03 02 02 01 01 01 02 01 01 01 01
+0014f0: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+001500: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+001510: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+001520: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+001530: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001540: 02 02 02 02 01 01 02 02 02 02 02 02 02 01 02 02
+001550: 02 02 02 02 02 01 02 02 02 02 02 02 02 01 02 02
+001560: 02 02 02 02 02 01 02 02 02 02 02 02 01 01 01 02
+001570: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001580: 01 02 02 02 02 02 02 01 02 02 02 02 02 02 01 01
+001590: 01 02 02 02 02 02 02 01 02 02 02 02 02 02 02 01
+0015a0: 01 02 02 02 01 01 01 01 01 01 02 02 02 02 02 01
+0015b0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0015c0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0015d0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0015e0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+0015f0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001600: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+001610: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+001620: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+001630: 01 01 01 01 02 02 02 02 02 02 02 02 02 02 02 02
+001640: 02 02 02 02 01 01 03 03 03 03 03 03 03 02 03 03
+001650: 02 02 02 02 02 01 02 02 03 03 03 03 03 02 03 03
+001660: 02 02 02 02 02 01 02 02 02 03 03 03 02 02 02 03
+001670: 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02 02
+001680: 01 02 02 02 02 02 02 01 02 02 03 03 03 03 02 02
+001690: 02 02 02 02 02 02 02 01 02 02 02 03 03 03 03 02
+0016a0: 02 02 02 02 02 02 01 01 01 01 02 03 03 03 03 02
+0016b0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+0016c0: 01 01 01 02 02 02 02 02 02 01 02 03 03 03 03 03
+0016d0: 01 01 02 02 02 02 02 02 02 01 02 03 03 03 03 03
+0016e0: 01 01 02 02 02 02 02 02 01 01 01 03 03 03 03 03
+0016f0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+001700: 03 03 02 02 02 02 02 02 02 02 02 01 01 01 01 01
+001710: 03 03 03 02 03 02 02 02 02 02 02 01 01 01 01 01
+001720: 03 03 03 02 03 02 02 02 02 02 01 01 01 01 01 01
+001730: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+001740: 03 03 03 03 02 01 02 02 02 02 02 02 01 01 01 01
+001750: 03 03 03 03 02 01 02 02 02 02 02 02 01 01 01 01
+001760: 03 03 03 03 02 01 02 02 02 02 02 01 01 01 01 01
+001770: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+001780: 02 03 03 03 02 02 02 01 02 02 02 01 01 01 01 01
+001790: 03 03 03 03 02 02 02 01 02 02 02 01 01 01 01 01
+0017a0: 03 03 03 03 02 02 01 01 01 01 02 01 01 01 01 01
+0017b0: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+0017c0: 02 02 02 03 02 02 02 02 02 01 02 02 01 01 01 01
+0017d0: 03 02 03 03 03 02 02 02 02 01 02 02 02 01 01 01
+0017e0: 03 02 03 03 02 02 02 02 01 01 01 02 02 01 01 01
+0017f0: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+001800: 01 01 01 01 01 02 02 02 02 02 02 02 02 03 03 03
+001810: 01 01 01 01 02 02 02 02 02 02 02 02 03 03 03 03
+001820: 01 01 01 01 02 02 02 02 02 02 02 02 02 03 03 03
+001830: 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02 02
+001840: 01 01 01 01 01 02 02 02 02 02 03 03 03 02 03 03
+001850: 01 01 01 01 01 02 02 02 02 02 03 03 03 02 03 03
+001860: 01 01 01 01 01 01 02 02 02 02 03 03 02 02 02 03
+001870: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+001880: 01 01 01 01 02 02 02 01 02 02 02 03 03 03 02 02
+001890: 01 01 01 01 02 02 02 01 02 02 02 03 03 03 03 02
+0018a0: 01 01 01 01 01 02 01 01 01 01 02 03 03 03 03 02
+0018b0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+0018c0: 01 01 01 01 01 02 02 02 02 01 02 03 03 03 03 03
+0018d0: 01 01 01 01 02 02 02 02 02 01 02 03 03 03 03 03
+0018e0: 01 01 01 01 02 02 02 02 01 01 02 03 03 03 03 03
+0018f0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+001900: 03 03 02 02 01 02 02 02 02 02 02 01 01 02 01 01
+001910: 03 03 03 02 02 02 02 02 02 02 02 01 02 02 02 01
+001920: 03 03 03 02 02 02 02 02 02 02 01 01 01 02 02 02
+001930: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+001940: 03 03 03 03 01 01 02 02 02 02 02 02 02 01 02 02
+001950: 03 03 03 03 02 01 02 02 02 02 02 02 02 01 02 02
+001960: 03 03 03 03 03 01 02 02 02 02 02 02 01 01 01 02
+001970: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+001980: 02 03 03 03 03 03 02 01 02 02 02 02 02 02 01 01
+001990: 03 03 03 03 03 03 03 02 02 02 02 02 02 02 02 01
+0019a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+0019b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0019c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+0019d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+0019e0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+0019f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001a00: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001a10: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001a20: 02 01 01 01 01 01 01 01 01 01 01 01 01 01 02 02
+001a30: 01 01 01 01 01 01 01 01 02 02 02 02 01 01 01 01
+001a40: 02 02 02 02 01 01 02 02 02 02 02 02 02 01 02 02
+001a50: 02 02 02 02 02 01 02 02 02 02 02 02 02 01 02 02
+001a60: 02 02 02 02 02 01 02 02 02 02 02 02 01 01 01 02
+001a70: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+001a80: 01 02 02 02 02 02 02 01 02 02 02 02 02 02 01 01
+001a90: 02 02 02 02 02 02 02 01 02 02 02 02 02 02 02 01
+001aa0: 03 03 02 02 02 02 01 01 01 01 02 02 02 02 02 01
+001ab0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001ac0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+001ad0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+001ae0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+001af0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001b00: 01 01 01 01 01 02 02 02 02 02 02 02 02 03 03 03
+001b10: 02 02 02 01 02 02 02 02 02 02 02 02 03 03 03 03
+001b20: 02 02 02 01 02 02 02 02 02 02 01 02 02 03 03 03
+001b30: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+001b40: 02 02 02 02 01 01 02 02 02 02 02 03 03 02 03 03
+001b50: 02 02 02 02 02 01 02 02 02 02 02 03 03 02 03 03
+001b60: 02 02 02 02 02 01 02 02 02 02 02 03 02 02 02 03
+001b70: 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02 02
+001b80: 01 02 02 02 02 02 02 01 02 02 03 03 03 03 02 02
+001b90: 02 02 02 02 02 02 02 01 02 03 03 03 03 03 03 02
+001ba0: 02 02 02 02 02 02 01 02 02 02 03 03 03 03 03 02
+001bb0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+001bc0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+001bd0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+001be0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+001bf0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 \ No newline at end of file
diff --git a/src/static/background/crates.hex b/src/static/background/crates.hex
new file mode 100644
index 0000000..3d8b332
--- /dev/null
+++ b/src/static/background/crates.hex
@@ -0,0 +1,39 @@
+;indices: 5
+;57 72 77
+;34 1c 27
+;60 2c 2c
+;7a 48 41
+;ad 77 57
+
+000000: 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+000010: 03 04 04 04 04 04 04 04 04 04 04 04 04 04 04 03
+000020: 03 03 03 04 01 01 01 01 01 01 01 01 04 03 03 03
+000030: 03 03 02 03 04 01 01 01 01 01 01 04 03 02 03 03
+000040: 03 03 01 02 03 04 01 01 01 01 04 03 02 01 03 03
+000050: 03 03 01 01 02 03 04 01 01 04 03 02 01 01 03 03
+000060: 03 03 01 01 01 02 03 04 04 03 02 01 01 01 03 03
+000070: 03 03 01 01 01 01 02 03 03 02 01 01 01 01 03 03
+000080: 03 03 01 01 01 01 04 03 03 04 01 01 01 01 03 03
+000090: 03 03 01 01 01 04 03 02 02 03 04 01 01 01 03 03
+0000a0: 03 03 01 01 04 03 02 01 01 02 03 04 01 01 03 03
+0000b0: 03 03 01 04 03 02 01 01 01 01 02 03 04 01 03 03
+0000c0: 03 03 04 03 02 01 01 01 01 01 01 02 03 04 03 03
+0000d0: 03 03 03 02 01 01 01 01 01 01 01 01 02 03 03 03
+0000e0: 03 02 02 02 02 02 02 02 02 02 02 02 02 02 02 03
+0000f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000100: 01 01 01 02 01 01 01 01 01 01 01 01 02 01 01 01
+000110: 01 03 03 01 03 03 03 03 03 03 03 03 01 03 03 01
+000120: 01 03 00 01 03 03 03 03 03 03 03 03 01 00 03 01
+000130: 01 03 03 01 04 04 04 04 04 04 04 04 01 03 03 01
+000140: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+000150: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+000160: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+000170: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+000180: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+000190: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+0001a0: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+0001b0: 01 03 03 01 02 02 01 02 02 01 02 02 01 03 03 01
+0001c0: 01 03 03 01 04 04 04 04 04 04 04 04 01 03 03 01
+0001d0: 01 03 00 01 03 03 03 03 03 03 03 03 01 00 03 01
+0001e0: 01 03 03 01 03 03 03 03 03 03 03 03 01 03 03 01
+0001f0: 01 01 01 02 01 01 01 01 01 01 01 01 02 01 01 01 \ No newline at end of file
diff --git a/src/static/background/shop_stall.hex b/src/static/background/shop_stall.hex
new file mode 100644
index 0000000..e156bd1
--- /dev/null
+++ b/src/static/background/shop_stall.hex
@@ -0,0 +1,202 @@
+;indices: 8
+;17 20 38
+;09 0a 14
+;60 2c 2c
+;7a 48 41
+;c0 94 73
+;d7 b5 94
+;39 4a 50
+;81 97 96
+
+000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
+0000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 05
+000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0001a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0001b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0001c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0001d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0001e0: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0001f0: 05 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+0002a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+0002b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+0002c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+0002d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+0002e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+0002f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04
+000300: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000310: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000320: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000330: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000340: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000350: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000360: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000370: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000380: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000390: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0003a0: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0003b0: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0003c0: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0003d0: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0003e0: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0003f0: 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000400: 05 01 04 05 05 05 05 05 05 05 05 05 05 05 05 05
+000410: 04 01 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+000420: 04 01 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000430: 04 01 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+000440: 04 01 02 02 02 02 02 02 02 02 02 02 03 03 03 03
+000450: 04 01 02 02 02 02 03 03 03 03 03 03 03 03 03 03
+000460: 04 01 02 02 03 03 03 03 03 03 03 03 03 03 03 03
+000470: 04 01 02 03 03 03 03 03 03 03 03 03 03 03 03 03
+000480: 04 01 02 03 03 03 03 03 03 03 03 03 03 03 03 03
+000490: 04 01 02 03 03 03 03 03 03 03 03 03 03 03 03 03
+0004a0: 04 01 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0004b0: 04 01 02 03 03 03 03 03 03 03 03 03 03 03 03 03
+0004c0: 04 01 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0004d0: 04 01 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0004e0: 04 01 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0004f0: 04 01 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+000500: 00 00 00 00 00 00 00 00 00 01 01 01 01 01 01 01
+000510: 00 00 00 00 00 00 00 00 01 04 04 04 04 04 04 04
+000520: 00 00 00 00 00 00 00 00 01 04 04 04 04 04 04 04
+000530: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+000540: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+000550: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+000560: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+000570: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+000580: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+000590: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+0005a0: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+0005b0: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+0005c0: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+0005d0: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+0005e0: 00 00 00 00 00 00 00 00 01 03 03 03 03 03 03 03
+0005f0: 00 00 00 00 00 00 00 00 00 01 01 01 01 01 01 01
+000600: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+000610: 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+000620: 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+000630: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+000640: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+000650: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+000660: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+000670: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+000680: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+000690: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0006a0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0006b0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0006c0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0006d0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0006e0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+0006f0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+000700: 05 05 05 05 05 05 05 05 05 05 05 05 05 04 01 05
+000710: 04 04 04 04 04 04 04 04 04 04 04 04 04 04 01 04
+000720: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 04
+000730: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 04
+000740: 03 03 03 03 02 02 02 02 02 02 02 02 02 02 01 04
+000750: 03 03 03 03 03 03 03 03 03 03 02 02 02 02 01 04
+000760: 03 03 03 03 03 03 03 03 03 03 03 03 02 02 01 04
+000770: 03 03 03 03 03 03 03 03 03 03 03 03 03 02 01 04
+000780: 03 03 03 03 03 03 03 03 03 03 03 03 03 02 01 04
+000790: 03 03 03 03 03 03 03 03 03 03 03 03 03 02 01 04
+0007a0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 01 04
+0007b0: 03 03 03 03 03 03 03 03 03 03 03 03 03 02 01 04
+0007c0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 01 04
+0007d0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 01 04
+0007e0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 01 04
+0007f0: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 01 04
+000800: 01 01 01 01 01 01 01 00 00 00 00 00 00 00 00 00
+000810: 04 04 04 04 04 04 04 01 00 00 00 00 00 00 00 00
+000820: 04 04 04 04 04 04 04 01 00 00 00 00 00 00 00 00
+000830: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+000840: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+000850: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+000860: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+000870: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+000880: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+000890: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+0008a0: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+0008b0: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+0008c0: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+0008d0: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+0008e0: 03 03 03 03 03 03 03 01 00 00 00 00 00 00 00 00
+0008f0: 01 01 01 01 01 01 01 00 00 00 00 00 00 00 00 00
+000900: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000910: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000920: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000930: 01 07 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000940: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000950: 01 07 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000960: 01 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07
+000970: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+000980: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000990: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+0009a0: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+0009b0: 01 07 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+0009c0: 01 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+0009d0: 01 07 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+0009e0: 01 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07
+0009f0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+000a00: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000a10: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000a20: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000a30: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000a40: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000a50: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000a60: 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07
+000a70: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+000a80: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000a90: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000aa0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000ab0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000ac0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000ad0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
+000ae0: 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07
+000af0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+000b00: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000b10: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000b20: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000b30: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 07 01
+000b40: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000b50: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 07 01
+000b60: 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 01
+000b70: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+000b80: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000b90: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000ba0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000bb0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 07 01
+000bc0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 01
+000bd0: 06 06 06 06 06 06 06 06 06 06 06 06 06 06 07 01
+000be0: 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 01
+000bf0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 \ No newline at end of file
diff --git a/src/static/epic.py b/src/static/epic.py
new file mode 100644
index 0000000..f00cf86
--- /dev/null
+++ b/src/static/epic.py
@@ -0,0 +1,41 @@
+#!/bin/python3
+import re
+
+# Read in the first file and extract the id and image filename for each tile
+tile_info = {}
+with open('dynamic.tsx', 'r') as f:
+ for line in f:
+ id_match = re.match(r'<tile id="(\d+)">', line.strip())
+ if id_match:
+ tile_id = int(id_match.group(1))
+ else:
+ image_match = re.search(r'source=".*?/(\w+_\d+\.png)"', line.strip())
+ if image_match:
+ image_filename = image_match.group(1)
+ tile_info[tile_id] = image_filename
+
+# Read in the second file and extract the size for each tile
+tile_sizes = {}
+with open('tilemap.h', 'r') as f:
+ for line in f:
+ size_match = re.match(r'#define HH_TM_(\w+)_OFFSET (\d+)', line.strip(), re.IGNORECASE)
+ if size_match:
+ tile_type = size_match.group(1).lower()
+ size = int(size_match.group(2))
+ tile_sizes[tile_type] = size
+
+# Read in the third file, update the values, and write to the output file
+with open('map.csv', 'r') as input_file, open('out.csv', 'w') as output_file:
+ for line in input_file:
+# #OK
+ tile_ids = [int(tile_id) for tile_id in line.strip().split(',')]
+ updated_tile_ids = []
+ for tile_id in tile_ids:
+ image_filename = re.match(r'(\w+)_(\d+)\.png', tile_info[tile_id])
+ tile_type = image_filename.group(1).lower()
+ offset = int(image_filename.group(2))
+ size = tile_sizes[tile_type]
+ updated_tile_id = offset + size
+ updated_tile_ids.append(str(updated_tile_id))
+ output_file.write(','.join(updated_tile_ids) + '\n')
+
diff --git a/src/static/foreground/bullet.hex b/src/static/foreground/bullet.hex
new file mode 100644
index 0000000..88f5b75
--- /dev/null
+++ b/src/static/foreground/bullet.hex
@@ -0,0 +1,58 @@
+;indices: 8
+;17 20 38
+;00 00 00
+;00 00 00
+;00 00 00
+;00 00 00
+;75 24 38
+;cf 57 3c
+;e8 c1 70
+
+000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000050: 00 00 00 00 00 00 00 00 00 05 00 05 05 05 00 00
+000060: 00 00 00 00 00 00 00 05 05 06 05 06 06 07 05 00
+000070: 00 00 00 00 00 00 05 06 05 05 06 06 07 07 07 05
+000080: 00 00 00 00 00 05 06 05 05 06 06 07 07 07 07 05
+000090: 00 00 00 00 00 00 05 05 06 05 06 06 06 07 05 00
+0000a0: 00 00 00 00 00 00 00 00 05 00 05 05 05 05 00 00
+0000b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000150: 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 00
+000160: 00 00 00 00 00 00 05 06 05 00 00 00 00 00 00 00
+000170: 00 00 00 00 00 00 05 05 06 05 00 00 00 00 00 00
+000180: 00 00 00 00 00 05 06 05 05 05 00 00 00 00 00 00
+000190: 00 00 00 00 00 00 05 06 05 06 05 00 00 00 00 00
+0001a0: 00 00 00 00 00 05 06 06 06 05 00 00 00 00 00 00
+0001b0: 00 00 00 00 00 05 06 07 06 06 05 00 00 00 00 00
+0001c0: 00 00 00 00 00 05 06 07 07 06 05 00 00 00 00 00
+0001d0: 00 00 00 00 00 05 07 07 07 07 05 00 00 00 00 00
+0001e0: 00 00 00 00 00 00 05 07 07 05 00 00 00 00 00 00
+0001f0: 00 00 00 00 00 00 00 05 05 00 00 00 00 00 00 00
+000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000270: 00 00 00 00 00 00 05 00 00 05 00 00 00 00 00 00
+000280: 00 00 00 00 00 00 00 05 05 06 05 00 00 00 00 00
+000290: 00 00 00 00 00 00 05 06 05 05 05 05 05 00 00 00
+0002a0: 00 00 00 00 00 00 00 05 05 06 06 05 06 05 00 00
+0002b0: 00 00 00 00 00 00 00 00 06 06 06 06 06 05 05 00
+0002c0: 00 00 00 00 00 00 00 00 00 05 06 06 06 07 07 05
+0002d0: 00 00 00 00 00 00 00 00 00 00 05 06 07 07 07 05
+0002e0: 00 00 00 00 00 00 00 00 00 00 00 05 05 07 07 05
+0002f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 05 05 00 \ No newline at end of file
diff --git a/src/static/foreground/gozer.hex b/src/static/foreground/gozer.hex
new file mode 100644
index 0000000..70a6b7f
--- /dev/null
+++ b/src/static/foreground/gozer.hex
@@ -0,0 +1,39 @@
+;indices: 5
+;17 20 38
+;10 14 1f
+;40 27 51
+;7a 36 7b
+;eb ed e9
+
+000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+000020: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00
+000030: 00 00 00 00 01 01 03 03 03 03 03 01 01 00 00 00
+000040: 00 00 00 01 03 03 03 03 03 03 03 03 03 01 00 00
+000050: 00 00 01 03 03 03 03 03 03 03 03 03 03 03 01 00
+000060: 00 01 03 03 03 03 03 03 02 02 02 02 02 02 03 01
+000070: 00 01 03 03 03 03 03 02 01 01 01 01 02 02 02 01
+000080: 01 03 03 02 03 03 02 01 01 01 01 01 01 01 01 01
+000090: 01 03 03 02 03 01 01 01 01 01 01 01 01 01 01 01
+0000a0: 03 03 02 03 03 01 01 01 01 01 04 01 01 04 01 01
+0000b0: 03 02 02 02 03 01 01 01 01 01 04 01 01 04 01 01
+0000c0: 02 01 00 01 02 01 01 01 01 01 04 01 01 04 01 00
+0000d0: 02 00 00 00 01 02 01 01 01 01 01 01 01 01 01 00
+0000e0: 00 00 00 00 01 02 01 01 01 01 01 01 01 01 00 00
+0000f0: 00 00 00 00 00 01 01 02 01 01 01 01 01 00 00 00
+000100: 00 00 00 00 00 00 00 01 02 02 02 01 00 00 00 00
+000110: 00 00 00 00 00 00 01 03 01 01 01 00 00 00 00 00
+000120: 00 00 00 00 00 00 01 03 03 03 01 00 00 00 00 00
+000130: 00 00 00 00 00 01 03 03 03 03 03 02 00 00 00 00
+000140: 00 00 00 00 00 01 03 03 03 03 03 02 00 00 01 01
+000150: 00 00 00 00 01 03 03 03 03 03 03 02 00 00 01 01
+000160: 00 00 00 00 01 03 03 03 03 03 03 03 02 00 00 00
+000170: 00 00 00 00 01 03 01 01 03 03 03 03 02 00 00 00
+000180: 00 00 00 00 01 02 01 01 03 03 03 03 03 01 00 00
+000190: 00 00 00 01 02 01 02 02 02 03 03 02 02 01 00 00
+0001a0: 00 00 00 01 02 02 01 02 02 02 02 02 02 01 00 00
+0001b0: 00 00 01 02 02 02 01 01 01 01 01 01 01 02 01 00
+0001c0: 00 00 01 02 02 01 01 01 02 02 01 01 02 02 01 00
+0001d0: 00 00 00 01 01 00 01 01 01 01 01 01 01 00 00 01
+0001e0: 00 00 00 00 00 00 01 01 00 00 01 01 00 00 00 00
+0001f0: 00 00 00 00 00 00 01 01 00 00 01 01 00 00 00 00 \ No newline at end of file
diff --git a/src/static/hh.tiled-project b/src/static/hh.tiled-project
new file mode 100644
index 0000000..2805678
--- /dev/null
+++ b/src/static/hh.tiled-project
@@ -0,0 +1,12 @@
+{
+ "automappingRulesFile": "",
+ "commands": [
+ ],
+ "compatibilityVersion": 1100,
+ "extensionsPath": "extensions",
+ "folders": [
+ "."
+ ],
+ "propertyTypes": [
+ ]
+}
diff --git a/src/static/makefile b/src/static/makefile
new file mode 100644
index 0000000..ba9b304
--- /dev/null
+++ b/src/static/makefile
@@ -0,0 +1,49 @@
+XXD := xxd
+TILEPACK := ../../scripts/tilepack
+MANIFEST2HEADER := ../../scripts/manifest2header.awk
+TILEDMK := ../../scripts/tiled.mk.awk
+TILEMAP2TILED := ../../scripts/tilemap2tiled
+
+INPUT += background/air.hex \
+ background/bricks.hex \
+ background/crates.hex \
+ background/shop_stall.hex \
+ background/title_screen_icon.hex \
+ foreground/title_screen_letteres_large.hex\
+ foreground/bullet.hex \
+ foreground/gozer.hex \
+ foreground/slime.hex \
+ foreground/font.hex
+ # world.hex
+USER_META += world.h
+
+OUT_BIN := $(patsubst %.hex,%.bin, $(INPUT))
+OUT_META := $(patsubst %.hex,%.meta, $(INPUT))
+
+.PHONY: all clean
+
+all: tilemap.bin tilemap.h
+
+%.bin: %.hex
+ sed 's/;.*//g' $< | $(XXD) -r | $(TILEPACK) > $@
+
+%.meta: %.bin
+ wc -c $< | tr '.' ' ' | awk '1 { print $$2" "$$1 / 104 }' > $@
+
+manifest.txt: $(OUT_BIN) $(OUT_META)
+ cat $(OUT_META) > $@
+
+tilemap.bin: manifest.txt $(OUT_BIN)
+ awk '1 { print $$1".bin" }' $< | xargs cat > $@
+
+tilemap.h: manifest.txt
+ $(MANIFEST2HEADER) $< > $@
+ cat $(USER_META) >> $@
+
+tiled.mk: manifest.txt
+ $(TILEDMK) < $< > $@
+
+include tiled.mk
+
+clean:
+ $(RM) -r $(OUT_BIN) $(OUT_META) manifest.txt tilemap.h tilemap.bin tiled.mk tiled
diff --git a/src/static/world.h b/src/static/world.h
new file mode 100644
index 0000000..081b157
--- /dev/null
+++ b/src/static/world.h
@@ -0,0 +1 @@
+#define HH_TM_WORLD_DUMMY_OFFSET (HH_TM_WORLD_OFFSET + 5)
diff --git a/src/static/world.hex b/src/static/world.hex
new file mode 100644
index 0000000..446f3dd
--- /dev/null
+++ b/src/static/world.hex
@@ -0,0 +1,514 @@
+;TODO split up file
+;Tilemap (all current tiles)
+0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0100: 06 06 06 06 06 05 06 06 06 06 06 05 06 06 06 06
+0110: 06 05 05 05 05 03 05 05 05 05 05 03 05 05 05 05
+0120: 06 05 04 04 04 03 05 05 05 05 05 03 05 05 05 05
+0130: 06 04 04 04 04 02 02 02 02 02 02 02 02 02 02 02
+0140: 06 04 04 04 04 02 02 03 03 03 03 03 03 02 03 03
+0150: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+0160: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+0170: 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02 02
+0180: 06 06 04 04 04 04 04 02 02 02 03 03 03 03 02 02
+0190: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+01a0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+01b0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+01c0: 00 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03
+01d0: 00 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03
+01e0: 00 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03
+01f0: 06 06 06 05 05 05 02 02 02 02 02 02 02 02 02 02
+0200: 06 06 06 05 06 06 06 06 06 06 06 05 06 06 06 06
+0210: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+0220: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+0230: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0240: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+0250: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+0260: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+0270: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0280: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0290: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+02a0: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+02b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+02c0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+02d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+02e0: 02 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+02f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0300: 06 06 06 05 06 06 06 06 06 06 05 06 06 06 06 06
+0310: 05 05 05 03 05 05 05 05 05 05 03 05 05 05 05 06
+0320: 05 05 05 03 05 05 05 05 05 05 03 04 04 05 05 06
+0330: 02 02 02 02 02 02 02 02 02 02 02 04 04 04 04 06
+0340: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 06
+0350: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+0360: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+0370: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+0380: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+0390: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+03a0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+03b0: 02 02 02 02 02 02 02 02 02 02 02 05 05 06 06 06
+03c0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 06
+03d0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 06
+03e0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 05
+03f0: 02 02 02 02 02 02 02 02 02 02 02 02 03 03 03 05
+0400: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0410: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0420: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 02 02
+0430: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+0440: 00 05 04 04 04 03 02 03 03 03 03 03 03 02 03 03
+0450: 00 05 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+0460: 00 04 04 04 04 02 03 03 03 03 03 02 02 02 02 03
+0470: 06 06 05 05 02 02 02 02 02 02 02 02 02 02 02 02
+0480: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0490: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+04a0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+04b0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+04c0: 00 05 05 04 04 04 04 03 02 03 03 03 03 03 03 03
+04d0: 00 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03
+04e0: 00 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03
+04f0: 00 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02
+0500: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+0510: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+0520: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+0530: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0540: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+0550: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+0560: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+0570: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0580: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+0590: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+05a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+05b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+05c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+05d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+05e0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+05f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0600: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+0610: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+0620: 03 03 02 02 03 03 03 03 03 03 03 02 04 04 04 00
+0630: 02 02 02 02 02 02 02 02 02 02 02 02 02 06 06 06
+0640: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 06
+0650: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+0660: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+0670: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+0680: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+0690: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+06a0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+06b0: 02 02 02 02 02 02 02 02 02 02 02 03 03 06 06 06
+06c0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 06
+06d0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 05
+06e0: 03 02 03 03 03 03 03 03 03 02 04 04 04 04 04 05
+06f0: 02 02 02 02 02 02 02 02 02 02 02 02 03 03 03 05
+0700: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0710: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0720: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 02 02
+0730: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+0740: 00 05 04 04 04 03 02 03 03 03 03 03 03 02 03 03
+0750: 00 05 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+0760: 00 04 04 04 04 02 03 03 03 03 03 02 02 02 02 03
+0770: 06 06 05 05 02 02 02 02 02 02 02 02 02 02 02 02
+0780: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0790: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+07a0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+07b0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+07c0: 00 05 05 04 04 04 04 04 04 04 04 02 02 02 02 04
+07d0: 00 05 05 04 04 04 04 04 04 04 04 04 02 04 04 04
+07e0: 00 06 05 05 05 04 04 04 04 04 04 04 03 04 04 04
+07f0: 00 06 06 06 05 05 05 05 05 05 05 05 03 05 05 05
+0800: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+0810: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+0820: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+0830: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0840: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+0850: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+0860: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+0870: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0880: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+0890: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+08a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+08b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+08c0: 04 04 04 04 04 04 04 04 03 03 03 04 04 04 04 04
+08d0: 04 04 04 04 04 04 04 04 04 03 03 04 04 04 04 04
+08e0: 04 04 04 04 04 04 04 04 04 03 04 04 04 04 04 04
+08f0: 05 05 05 05 05 05 05 05 05 03 05 05 05 05 05 05
+0900: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+0910: 03 03 03 02 03 03 03 03 03 03 03 02 04 04 05 00
+0920: 03 03 02 02 03 03 03 03 03 03 03 02 04 04 04 00
+0930: 02 02 02 02 02 02 02 02 02 02 02 02 02 06 06 06
+0940: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 06
+0950: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+0960: 03 03 03 03 03 02 03 03 03 02 04 04 04 04 04 05
+0970: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+0980: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+0990: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+09a0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+09b0: 02 02 02 02 02 02 03 03 03 03 03 03 03 06 06 06
+09c0: 04 04 03 03 03 04 04 04 04 04 04 04 04 04 05 06
+09d0: 04 04 04 03 03 04 04 04 04 04 04 04 04 05 05 05
+09e0: 04 04 04 03 04 04 04 04 04 04 04 05 05 05 05 06
+09f0: 05 05 05 03 05 05 05 05 05 05 05 05 05 06 06 06
+0a00: 06 06 06 06 06 05 06 06 06 06 06 05 06 06 06 06
+0a10: 06 05 05 05 05 03 05 05 05 05 05 03 05 05 05 05
+0a20: 06 05 04 04 04 03 05 05 05 05 05 03 05 05 05 05
+0a30: 06 04 04 04 04 02 02 02 02 02 02 02 02 02 02 02
+0a40: 06 04 04 04 04 02 02 03 03 03 03 03 03 02 03 03
+0a50: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+0a60: 05 04 04 04 04 02 03 03 03 03 03 03 03 02 03 03
+0a70: 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02 02
+0a80: 06 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0a90: 05 04 04 04 04 04 04 02 03 03 03 03 03 03 03 02
+0aa0: 05 04 04 04 04 04 04 02 02 03 03 03 03 03 03 02
+0ab0: 05 03 03 03 03 03 02 02 02 02 02 02 02 02 02 02
+0ac0: 00 05 05 04 04 04 04 04 04 04 04 02 02 02 02 04
+0ad0: 00 05 05 04 04 04 04 04 04 04 04 04 02 04 04 04
+0ae0: 00 06 05 05 05 04 04 04 04 04 04 04 03 04 04 04
+0af0: 00 06 06 06 05 05 05 05 05 05 05 05 03 05 05 05
+0b00: 06 06 06 05 06 06 06 06 06 06 06 05 06 06 06 06
+0b10: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+0b20: 05 05 05 03 05 05 05 05 05 05 05 03 05 05 05 05
+0b30: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0b40: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+0b50: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+0b60: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+0b70: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0b80: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+0b90: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+0ba0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+0bb0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+0bc0: 04 04 04 04 04 04 04 04 03 03 03 04 04 04 04 04
+0bd0: 04 04 04 04 04 04 04 04 04 03 03 04 04 04 04 04
+0be0: 04 04 04 04 04 04 04 04 04 03 04 04 04 04 04 04
+0bf0: 05 05 05 05 05 05 05 05 05 03 05 05 05 05 05 05
+0c00: 06 06 06 05 06 06 06 06 06 06 05 06 06 06 06 06
+0c10: 05 05 05 03 05 05 05 05 05 05 03 05 05 05 05 06
+0c20: 05 05 05 03 05 05 05 05 05 05 03 04 04 05 05 06
+0c30: 02 02 02 02 02 02 02 02 02 02 02 04 04 04 04 06
+0c40: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 06
+0c50: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+0c60: 03 03 03 03 03 02 03 03 03 03 02 04 04 04 04 05
+0c70: 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 05
+0c80: 03 03 03 03 03 03 03 02 04 04 04 04 04 05 05 00
+0c90: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0ca0: 03 03 03 03 03 03 03 02 04 04 04 04 04 04 05 00
+0cb0: 02 02 02 02 02 02 03 03 03 03 03 03 03 06 06 06
+0cc0: 04 04 03 03 03 04 04 04 04 04 04 04 04 04 05 06
+0cd0: 04 04 04 03 03 04 04 04 04 04 04 04 04 05 05 05
+0ce0: 04 04 04 03 04 04 04 04 04 04 04 05 05 05 05 06
+0cf0: 05 05 05 03 05 05 05 05 05 05 05 05 05 06 06 06
+0d00: 06 06 06 06 06 05 06 06 06 06 05 06 06 06 06 06
+0d10: 06 05 05 05 05 03 05 05 05 05 03 05 05 05 05 06
+0d20: 06 05 04 04 04 03 05 05 05 05 03 04 04 05 05 06
+0d30: 06 04 04 04 04 02 02 02 02 02 02 04 04 04 04 06
+0d40: 06 04 04 04 04 02 02 03 03 03 02 04 04 04 04 06
+0d50: 05 04 04 04 04 02 03 03 03 03 02 04 04 04 04 05
+0d60: 05 04 04 04 04 02 03 03 03 03 02 04 04 04 04 05
+0d70: 03 03 03 03 03 02 02 02 02 02 02 03 03 03 03 05
+0d80: 06 06 04 04 04 04 04 02 04 04 04 04 04 05 05 00
+0d90: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+0da0: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+0db0: 05 03 03 03 03 03 02 02 02 02 02 05 05 06 06 06
+0dc0: 00 05 04 04 04 04 04 04 03 02 04 04 04 04 04 06
+0dd0: 00 05 04 04 04 04 04 04 03 02 04 04 04 04 04 06
+0de0: 00 05 04 04 04 04 04 04 03 02 04 04 04 04 04 05
+0df0: 06 06 06 05 05 05 02 02 02 02 02 02 03 03 03 05
+0e00: 06 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+0e10: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+0e20: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 04 00
+0e30: 05 03 03 03 03 03 02 02 02 02 02 02 02 06 06 06
+0e40: 00 05 04 04 04 03 02 03 03 02 04 04 04 04 04 06
+0e50: 00 05 04 04 04 02 03 03 03 02 04 04 04 04 04 05
+0e60: 00 04 04 04 04 02 03 03 03 02 03 04 04 04 04 05
+0e70: 06 06 05 05 02 02 02 02 02 02 02 03 03 03 03 05
+0e80: 06 04 04 04 04 04 04 02 04 04 04 04 04 05 05 00
+0e90: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+0ea0: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+0eb0: 05 03 03 03 03 03 02 02 02 02 02 03 03 06 06 06
+0ec0: 00 05 05 04 04 04 03 03 03 03 03 04 04 04 04 06
+0ed0: 00 05 04 04 04 04 03 03 03 03 04 04 04 04 04 05
+0ee0: 00 05 04 04 04 03 03 03 03 03 04 04 04 04 04 05
+0ef0: 00 05 03 03 03 03 03 02 02 02 02 02 03 03 03 05
+0f00: 06 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+0f10: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 05 00
+0f20: 05 04 04 04 04 04 04 02 03 03 03 02 04 04 04 00
+0f30: 05 03 03 03 03 03 02 02 02 02 02 02 02 06 06 06
+0f40: 00 05 04 04 04 03 02 03 03 02 04 04 04 04 04 06
+0f50: 00 05 04 04 04 02 03 03 03 02 04 04 04 04 04 05
+0f60: 00 04 04 04 04 02 03 03 03 02 04 04 04 04 04 05
+0f70: 06 06 05 05 02 02 02 02 02 02 02 03 03 03 03 05
+0f80: 06 04 04 04 04 04 04 02 04 04 04 04 04 05 05 00
+0f90: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+0fa0: 05 04 04 04 04 04 04 02 04 04 04 04 04 04 05 00
+0fb0: 05 03 03 03 03 03 02 02 03 03 03 03 03 06 06 06
+0fc0: 00 05 05 04 04 04 04 04 04 04 04 04 04 04 05 06
+0fd0: 00 05 05 04 04 04 04 04 04 04 04 04 04 05 05 05
+0fe0: 00 06 05 05 05 04 04 04 04 04 04 05 05 05 05 06
+0ff0: 00 06 06 06 05 05 05 05 05 05 05 05 05 06 06 06
+1000: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+1010: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+1020: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+1030: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1040: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+1050: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+1060: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+1070: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1080: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+1090: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+10a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+10b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+10c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 04 04 04
+10d0: 03 02 03 03 03 03 03 03 03 02 03 03 04 04 04 04
+10e0: 03 02 03 03 03 03 03 03 02 02 02 03 04 04 04 04
+10f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1100: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+1110: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+1120: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+1130: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1140: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+1150: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+1160: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+1170: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1180: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+1190: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+11a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+11b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+11c0: 02 02 02 04 04 03 03 03 03 02 03 03 03 03 03 03
+11d0: 04 02 04 04 04 04 03 03 03 02 03 03 03 03 03 03
+11e0: 04 02 04 04 04 04 03 03 02 02 02 03 03 03 03 03
+11f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1200: 03 03 02 02 02 03 03 03 03 03 03 02 02 05 05 05
+1210: 03 03 03 02 03 03 03 03 03 03 03 02 03 05 05 05
+1220: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 05 05
+1230: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1240: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+1250: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+1260: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+1270: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1280: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+1290: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+12a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+12b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+12c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+12d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+12e0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+12f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1300: 06 05 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+1310: 05 05 05 02 03 03 03 03 03 03 03 02 03 03 03 03
+1320: 05 05 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+1330: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1340: 03 03 03 03 02 02 03 03 03 03 03 03 03 02 03 03
+1350: 03 03 03 03 03 02 03 03 03 03 03 03 03 02 03 03
+1360: 03 03 03 03 03 02 03 03 03 03 03 03 02 02 02 03
+1370: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1380: 02 03 03 03 03 03 03 02 03 03 03 03 03 03 02 02
+1390: 03 03 03 03 03 03 03 02 03 03 03 03 03 03 03 02
+13a0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+13b0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+13c0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+13d0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+13e0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+13f0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1400: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1410: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1420: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1430: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1440: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1450: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1460: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1470: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1480: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1490: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+14a0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+14b0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+14c0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+14d0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+14e0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+14f0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1500: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+1510: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+1520: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+1530: 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01 01
+1540: 03 03 03 03 02 02 03 03 02 02 02 02 02 01 02 02
+1550: 03 03 03 03 03 02 02 02 02 02 02 02 02 01 02 02
+1560: 03 03 03 03 03 01 02 02 02 02 02 02 01 01 01 02
+1570: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+1580: 02 03 03 03 02 02 02 01 02 02 02 02 02 02 01 01
+1590: 03 03 03 03 02 02 02 01 02 02 02 02 02 02 02 01
+15a0: 03 03 03 03 02 02 01 01 01 01 02 02 02 02 01 01
+15b0: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+15c0: 02 02 02 03 03 02 02 02 02 01 02 02 02 01 01 01
+15d0: 03 02 03 03 03 02 02 02 02 01 02 02 01 01 01 01
+15e0: 03 02 03 03 03 03 02 02 01 01 01 02 01 01 01 01
+15f0: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+1600: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+1610: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+1620: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+1630: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1640: 02 02 02 02 01 01 02 02 02 02 02 02 02 01 02 02
+1650: 02 02 02 02 02 01 02 02 02 02 02 02 02 01 02 02
+1660: 02 02 02 02 02 01 02 02 02 02 02 02 01 01 01 02
+1670: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1680: 01 02 02 02 02 02 02 01 02 02 02 02 02 02 01 01
+1690: 01 02 02 02 02 02 02 01 02 02 02 02 02 02 02 01
+16a0: 01 02 02 02 01 01 01 01 01 01 02 02 02 02 02 01
+16b0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+16c0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+16d0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+16e0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+16f0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1700: 03 03 02 02 02 03 03 03 03 03 03 02 02 03 03 03
+1710: 03 03 03 02 03 03 03 03 03 03 03 02 03 03 03 03
+1720: 03 03 03 02 03 03 03 03 03 03 02 02 02 03 03 03
+1730: 01 01 01 01 02 02 02 02 02 02 02 02 02 02 02 02
+1740: 02 02 02 02 01 01 03 03 03 03 03 03 03 02 03 03
+1750: 02 02 02 02 02 01 02 02 03 03 03 03 03 02 03 03
+1760: 02 02 02 02 02 01 02 02 02 03 03 03 02 02 02 03
+1770: 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02 02
+1780: 01 02 02 02 02 02 02 01 02 02 03 03 03 03 02 02
+1790: 02 02 02 02 02 02 02 01 02 02 02 03 03 03 03 02
+17a0: 02 02 02 02 02 02 01 01 01 01 02 03 03 03 03 02
+17b0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+17c0: 01 01 01 02 02 02 02 02 02 01 02 03 03 03 03 03
+17d0: 01 01 02 02 02 02 02 02 02 01 02 03 03 03 03 03
+17e0: 01 01 02 02 02 02 02 02 01 01 01 03 03 03 03 03
+17f0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+1800: 03 03 02 02 02 02 02 02 02 02 02 01 01 01 01 01
+1810: 03 03 03 02 03 02 02 02 02 02 02 01 01 01 01 01
+1820: 03 03 03 02 03 02 02 02 02 02 01 01 01 01 01 01
+1830: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+1840: 03 03 03 03 02 01 02 02 02 02 02 02 01 01 01 01
+1850: 03 03 03 03 02 01 02 02 02 02 02 02 01 01 01 01
+1860: 03 03 03 03 02 01 02 02 02 02 02 01 01 01 01 01
+1870: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+1880: 02 03 03 03 02 02 02 01 02 02 02 01 01 01 01 01
+1890: 03 03 03 03 02 02 02 01 02 02 02 01 01 01 01 01
+18a0: 03 03 03 03 02 02 01 01 01 01 02 01 01 01 01 01
+18b0: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+18c0: 02 02 02 03 02 02 02 02 02 01 02 02 01 01 01 01
+18d0: 03 02 03 03 03 02 02 02 02 01 02 02 02 01 01 01
+18e0: 03 02 03 03 02 02 02 02 01 01 01 02 02 01 01 01
+18f0: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+1900: 01 01 01 01 01 02 02 02 02 02 02 02 02 03 03 03
+1910: 01 01 01 01 02 02 02 02 02 02 02 02 03 03 03 03
+1920: 01 01 01 01 02 02 02 02 02 02 02 02 02 03 03 03
+1930: 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02 02
+1940: 01 01 01 01 01 02 02 02 02 02 03 03 03 02 03 03
+1950: 01 01 01 01 01 02 02 02 02 02 03 03 03 02 03 03
+1960: 01 01 01 01 01 01 02 02 02 02 03 03 02 02 02 03
+1970: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+1980: 01 01 01 01 02 02 02 01 02 02 02 03 03 03 02 02
+1990: 01 01 01 01 02 02 02 01 02 02 02 03 03 03 03 02
+19a0: 01 01 01 01 01 02 01 01 01 01 02 03 03 03 03 02
+19b0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+19c0: 01 01 01 01 01 02 02 02 02 01 02 03 03 03 03 03
+19d0: 01 01 01 01 02 02 02 02 02 01 02 03 03 03 03 03
+19e0: 01 01 01 01 02 02 02 02 01 01 02 03 03 03 03 03
+19f0: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+1a00: 03 03 02 02 01 02 02 02 02 02 02 01 01 02 01 01
+1a10: 03 03 03 02 02 02 02 02 02 02 02 01 02 02 02 01
+1a20: 03 03 03 02 02 02 02 02 02 02 01 01 01 02 02 02
+1a30: 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01
+1a40: 03 03 03 03 01 01 02 02 02 02 02 02 02 01 02 02
+1a50: 03 03 03 03 02 01 02 02 02 02 02 02 02 01 02 02
+1a60: 03 03 03 03 03 01 02 02 02 02 02 02 01 01 01 02
+1a70: 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01
+1a80: 02 03 03 03 03 03 02 01 02 02 02 02 02 02 01 01
+1a90: 03 03 03 03 03 03 03 02 02 02 02 02 02 02 02 01
+1aa0: 03 03 03 03 03 03 02 02 02 02 03 03 03 03 03 02
+1ab0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1ac0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+1ad0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+1ae0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+1af0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1b00: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1b10: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1b20: 02 01 01 01 01 01 01 01 01 01 01 01 01 01 02 02
+1b30: 01 01 01 01 01 01 01 01 02 02 02 02 01 01 01 01
+1b40: 02 02 02 02 01 01 02 02 02 02 02 02 02 01 02 02
+1b50: 02 02 02 02 02 01 02 02 02 02 02 02 02 01 02 02
+1b60: 02 02 02 02 02 01 02 02 02 02 02 02 01 01 01 02
+1b70: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+1b80: 01 02 02 02 02 02 02 01 02 02 02 02 02 02 01 01
+1b90: 02 02 02 02 02 02 02 01 02 02 02 02 02 02 02 01
+1ba0: 03 03 02 02 02 02 01 01 01 01 02 02 02 02 02 01
+1bb0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1bc0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+1bd0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+1be0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+1bf0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1c00: 01 01 01 01 01 02 02 02 02 02 02 02 02 03 03 03
+1c10: 02 02 02 01 02 02 02 02 02 02 02 02 03 03 03 03
+1c20: 02 02 02 01 02 02 02 02 02 02 01 02 02 03 03 03
+1c30: 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02
+1c40: 02 02 02 02 01 01 02 02 02 02 02 03 03 02 03 03
+1c50: 02 02 02 02 02 01 02 02 02 02 02 03 03 02 03 03
+1c60: 02 02 02 02 02 01 02 02 02 02 02 03 02 02 02 03
+1c70: 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02 02
+1c80: 01 02 02 02 02 02 02 01 02 02 03 03 03 03 02 02
+1c90: 02 02 02 02 02 02 02 01 02 03 03 03 03 03 03 02
+1ca0: 02 02 02 02 02 02 01 02 02 02 03 03 03 03 03 02
+1cb0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1cc0: 02 02 02 03 03 03 03 03 03 02 03 03 03 03 03 03
+1cd0: 03 02 03 03 03 03 03 03 03 02 03 03 03 03 03 03
+1ce0: 03 02 03 03 03 03 03 03 02 02 02 03 03 03 03 03
+1cf0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+1d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1d10: 00 00 01 01 01 01 01 00 00 00 01 01 01 00 00 00
+1d20: 00 00 00 00 01 00 00 00 00 01 00 00 00 01 00 00
+1d30: 00 00 00 00 01 00 00 00 00 01 00 00 00 01 00 00
+1d40: 00 00 00 00 01 00 00 00 00 01 00 00 00 01 00 00
+1d50: 00 00 00 00 01 00 00 00 00 01 00 00 00 01 00 00
+1d60: 00 00 00 00 01 00 00 00 00 00 01 01 01 00 00 00
+1d70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1d80: 00 00 01 01 01 01 00 00 00 00 01 01 01 00 00 00
+1d90: 00 00 01 00 00 00 01 00 00 01 00 00 00 01 00 00
+1da0: 00 00 01 00 00 00 01 00 00 01 00 00 00 01 00 00
+1db0: 00 00 01 00 00 00 01 00 00 01 00 00 00 01 00 00
+1dc0: 00 00 01 00 00 00 01 00 00 01 00 00 00 01 00 00
+1dd0: 00 00 01 01 01 01 00 00 00 00 01 01 01 00 00 00
+1de0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1df0: 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 00
+1e00: 00 00 00 00 00 00 00 01 01 01 00 00 00 00 00 00
+1e10: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00
+1e20: 00 00 00 00 00 01 01 01 01 01 01 01 00 00 00 00
+1e30: 00 00 00 00 00 01 01 01 01 01 01 01 00 00 00 00
+1e40: 00 00 00 00 00 01 01 01 01 01 01 01 00 00 00 00
+1e50: 00 00 00 00 00 01 01 01 01 01 01 01 00 00 00 00
+1e60: 00 00 00 00 00 01 01 01 01 01 01 01 00 00 00 00
+1e70: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00
+1e80: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00
+1e90: 00 00 00 00 00 00 00 01 01 01 00 00 00 00 00 00
+1ea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1eb0: 00 00 00 00 00 00 00 01 01 01 00 00 00 00 00 00
+1ec0: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00
+1ed0: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00
+1ee0: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00
+1ef0: 00 00 00 00 00 00 00 01 01 01 00 00 00 00 00 00
+1f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1f10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1f20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1f30: 00 00 00 00 00 01 01 01 01 01 01 00 00 00 00 00
+1f40: 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00 00
+1f50: 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00
+1f60: 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00
+1f70: 00 00 00 00 00 00 00 00 00 01 01 00 00 00 00 00
+1f80: 00 00 00 00 00 00 00 00 01 01 00 00 00 00 00 00
+1f90: 00 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00
+1fa0: 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00
+1fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+1fe0: 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00
+1ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/src/stm32/setup.c b/src/stm32/setup.c
index 2c3552b..2102347 100644
--- a/src/stm32/setup.c
+++ b/src/stm32/setup.c
@@ -8,6 +8,10 @@
#include "main.h"
#include "setup.h"
#include "ppu/ppu.h"
+#include "tilemap.h"
+
+// hex(0x0803_ffff - 0xd000 + 1) (stm32f091rc rm0091 table 5, flash memory organization)
+uint32_t* g_hh_tilemap_rom = 0x08033000;
UART_HandleTypeDef huart2 = {
.Instance = USART2,
diff --git a/src/tilemap.h b/src/tilemap.h
new file mode 100644
index 0000000..2f8b709
--- /dev/null
+++ b/src/tilemap.h
@@ -0,0 +1,7 @@
+#pragma once
+#include <stdint.h>
+
+#include "static/tilemap.h"
+
+extern uint32_t* g_hh_tilemap_rom;
+