From e47f7fa198229b8598b8ab03ef8b2483f7c685bc Mon Sep 17 00:00:00 2001 From: Flenk008 Date: Mon, 13 Mar 2023 13:24:44 +0100 Subject: Background collision Added background collision for player and other entities. Added gravity and jump functionailty --- .vscode/c_cpp_properties.json | 3 +- .vscode/launch.json | 2 +- .vscode/tasks.json | 69 +++++++++++--- src/demo.c | 208 +++++++++++++++++++++++++++++++++--------- src/entity.h | 17 +++- src/ppusim/input.c | 1 + 6 files changed, 241 insertions(+), 59 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 51f5ad0..3a0c430 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -2,7 +2,8 @@ "configurations": [ { "name": "src", - "compileCommands": "${workspaceFolder}/src/compile_commands.json" + "compileCommands": "${workspaceFolder}/src/compile_commands.json", + "configurationProvider": "ms-vscode.makefile-tools" } ], "version": 4 diff --git a/.vscode/launch.json b/.vscode/launch.json index 2f7561c..4ff91bb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,7 @@ "environment": [], "externalConsole": false, "MIMode": "gdb", - "preLaunchTask": "client/build", + "preLaunchTask": "build", "setupCommands": [ { "description": "Enable pretty-printing for gdb", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 53a235e..a670b0f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -16,13 +16,19 @@ "isDefault": false, "kind": "build" }, - "options": { "cwd": "${workspaceFolder}/src" }, + "options": { + "cwd": "${workspaceFolder}/src" + }, "windows": { "command": "make -j", - "args": [ "" ], + "args": [ + "" + ] }, "command": "make", - "args": [ "-j" ], + "args": [ + "-j" + ], "type": "shell" }, { @@ -32,13 +38,20 @@ "isDefault": false, "kind": "test" }, - "options": { "cwd": "${workspaceFolder}/src" }, + "options": { + "cwd": "${workspaceFolder}/src" + }, "windows": { "command": "make -j flash", - "args": [ "" ], + "args": [ + "" + ] }, "command": "make", - "args": [ "-j", "flash" ], + "args": [ + "-j", + "flash" + ], "type": "shell" }, { @@ -48,13 +61,19 @@ "isDefault": false, "kind": "test" }, - "options": { "cwd": "${workspaceFolder}/src" }, + "options": { + "cwd": "${workspaceFolder}/src" + }, "windows": { "command": "make compile_commands.json", - "args": [ "" ], + "args": [ + "" + ] }, "command": "make", - "args": [ "compile_commands" ], + "args": [ + "compile_commands" + ], "type": "shell" }, { @@ -64,14 +83,40 @@ "isDefault": false, "kind": "test" }, - "options": { "cwd": "${workspaceFolder}" }, + "options": { + "cwd": "${workspaceFolder}" + }, "windows": { "command": "make clean", - "args": [ "" ], + "args": [ + "" + ] }, "command": "make", - "args": [ "clean" ], + "args": [ + "clean" + ], "type": "shell" + }, + { + "type": "cppbuild", + "label": "C/C++: gcc.exe build active file", + "command": "C:\\msys64\\mingw64\\bin\\gcc.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "C:\\msys64\\mingw64\\bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "detail": "compiler: C:\\msys64\\mingw64\\bin\\gcc.exe" } ] } diff --git a/src/demo.c b/src/demo.c index baaf73d..f5d2e71 100644 --- a/src/demo.c +++ b/src/demo.c @@ -5,21 +5,36 @@ #include "input.h" #include "ppu/ppu.h" -#define HH_DEMO_BALL_COUNT 1 +#define HH_DEMO_BALL_COUNT 2 hh_s_ppu_loc_fam_entry g_hh_demo_balls[HH_DEMO_BALL_COUNT]; hh_s_entity_player g_hh_player_1 = { - .pos_x = 31000, // 0b0000 0001 0011 0110 - .pos_y = 21000, - .radius = 8, + .pos_x = 11000, + .pos_y = 5000, + .radius = 4, .speed = 100, + .air_speed = 80, .direction_x = 1, + .accelY = 0, .rotation = 8, .in_air = false, }; +hh_s_entity_enemy g_hh_enemy_1 = { + .pos_x = 16000, + .pos_y = 20000, + .radius = 4, + .speed = 100, + .direction_x = 1, + .accelY = 0, + .in_air = false, +}; + void hh_player_movement(); +int hh_background_collision_x(hh_s_entity_player tempEntity); +hh_s_entity_player hh_background_collision_y_player(hh_s_entity_player tempEntity); + uint16_t g_hh_pos_x; // 0b0000 0001 0011 0110 uint16_t g_hh_pos_y; uint8_t g_hh_left = 0; @@ -68,7 +83,7 @@ void hh_demo_loop(unsigned long frame) { hh_player_movement(); // input testing (no hitbox stuff) // g_hh_player_1.pos_x += ((-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right)) * g_hh_player_1.speed; // -1 = L || 1 == R - // g_hh_player_1.pos_y += ((-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down)) * g_hh_player_1.speed; // -1 = D || 1 == U + g_hh_player_1.pos_y += ((-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down)) * g_hh_player_1.speed; // -1 = D || 1 == U // adjust map size @@ -76,12 +91,14 @@ void hh_demo_loop(unsigned long frame) { g_hh_pos_y = g_hh_player_1.pos_y / 100; - - // update player sprite on ppu g_hh_demo_balls[0].position_x = g_hh_pos_x; g_hh_demo_balls[0].position_y = g_hh_pos_y; + + g_hh_demo_balls[1].position_x = 220; + g_hh_demo_balls[1].position_y = 220; hh_ppu_update_foreground(0, g_hh_demo_balls[0]); + hh_ppu_update_foreground(1, g_hh_demo_balls[1]); // set background pattern position hh_ppu_update_aux((hh_s_ppu_loc_aux){ @@ -107,6 +124,12 @@ void hh_player_movement() { int8_t directionX = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right); // -1 = L || 1 == R int8_t directionY = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down); // -1 = D || 1 == U + if(g_hh_controller_p1.button_primary == 1 && g_hh_player_1.accelY == 0 && g_hh_player_1.in_air == false) + { + g_hh_player_1.accelY = 25; + } + + uint8_t i, j; uint8_t rotation = 0; // 0-7 @@ -124,63 +147,162 @@ void hh_player_movement() { rotation++; } } - // direction calc - if (directionX != 0) // update direction if player is not idle + // X-axis calc + if (directionX != 0) // update direction and position if player is not idle { g_hh_player_1.direction_x = directionX; + g_hh_player_1.pos_x = hh_background_collision_x(g_hh_player_1); } - // collision map x-axis + + g_hh_player_1 = hh_background_collision_y_player(g_hh_player_1); + +} + + +int hh_background_collision_x(hh_s_entity_player tempEntity){ // tile calc including radius and direction for background coliision uint16_t tileColX; - uint16_t tileColY = (g_hh_player_1.pos_y / 100) / 16; + uint16_t tileColY = (tempEntity.pos_y / 100) / 8; ; // remaining space between grid and exact uint8_t modTileX; - uint8_t modTileY; - - if (g_hh_player_1.in_air == false && directionX != 0) { - if (directionX == 1) { - tileColX = ((g_hh_player_1.pos_x / 100) + g_hh_player_1.radius) / 16; - modTileX = (g_hh_player_1.pos_x + (100 * g_hh_player_1.radius)) % 1600; - } else if (directionX == -1) { - tileColX = ((g_hh_player_1.pos_x / 100) - g_hh_player_1.radius) / 16; - modTileX = (g_hh_player_1.pos_x - (100 * g_hh_player_1.radius)) % 1600; - } - if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + directionX] != 1) { - g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * g_hh_player_1.speed); // NEW x set - } - else if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + directionX] == 1) { + + if (tempEntity.direction_x == 1) { + tileColX = ((tempEntity.pos_x / 100) + tempEntity.radius) / 8; + modTileX = 800 -((tempEntity.pos_x + (100 * tempEntity.radius)) % 800); + } else if (tempEntity.direction_x == -1) { + tileColX = ((tempEntity.pos_x / 100) - tempEntity.radius )/ 8; + modTileX = (tempEntity.pos_x - (100 * tempEntity.radius)) % 800; + } + + tileColY = (( tempEntity.pos_y / 100) + tempEntity.radius) / 8; //bottom of player box + + if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + tempEntity.direction_x] != 1) { + tileColY = (( tempEntity.pos_y / 100) - tempEntity.radius) / 8; //bottom of player box + if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + tempEntity.direction_x] != 1) { + if(tempEntity.in_air== true){ + tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.air_speed); // 80% of max speed if in air + } else { + tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.speed); // 80% of max speed if in air + } + } else { + if(tempEntity.in_air == true){ + if (modTileX < tempEntity.air_speed) { + tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set + } else { + tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.air_speed); // + } + } else { + if (modTileX < g_hh_player_1.speed) { + tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set + } else { + tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * tempEntity.speed); // + } + } + } + } else if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + tempEntity.direction_x] == 1) { + if(tempEntity.in_air == true){ + if (modTileX < tempEntity.air_speed) { + tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set + } else { + tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * tempEntity.air_speed); // + } + } else { if (modTileX < g_hh_player_1.speed) { - g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * modTileX); // NEW x set + tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set } else { - g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * g_hh_player_1.speed); // NEW x set + tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.speed); // } } - - } else // if in air different all borders have to be checked - { } + + return tempEntity.pos_x; + +} + +hh_s_entity_player hh_background_collision_y_player(hh_s_entity_player tempEntity){ + + uint16_t tileColX; + uint16_t tileColY; + + + // remaining space between grid and exact + uint8_t modTileY; - if(directionY != 0) + if(g_hh_controller_p1.button_primary == 1 && tempEntity.accelY == 0 && tempEntity.in_air == false) { - // g_hh_player_1.pos_y = g_hh_player_1.pos_y + (directionY * g_hh_player_1.speed * 2); // NEW x set +// tempEntity.accelY = 25; } - // collision map floor (y-axis) (falling) - // if falling no jump press (implement) - /* - tileColY = (( g_hh_player_1.pos_y / 100) + g_hh_player_1.radius) / 16; //bottom of player box - modTileY = 1; - if(HH_DEMO_HITBOX_TILEMAP[tileColY+1][tileColX] != 1) //rework after jumping - { - g_hh_player_1.pos_y = g_hh_player_1.pos_y + 5 ;// NEW y set //makew var gravity - //playerStat = falling; //for later use of graphics/sound + + tileColY = (( tempEntity.pos_y / 100) + tempEntity.radius) / 8; //bottom of player box + tileColX = ((tempEntity.pos_x / 100) + tempEntity.radius) / 8; //right of player + modTileY = ((tempEntity.pos_y + (100 * tempEntity.radius)) % 800); //bottom of box + + //rework arfter jumping + if(tempEntity.accelY <= 0){ //falling + if(HH_DEMO_HITBOX_TILEMAP[tileColY+1][tileColX] != 1) {//check bottom right first + tileColX = ((tempEntity.pos_x / 100) - tempEntity.radius) / 8; + if(HH_DEMO_HITBOX_TILEMAP[tileColY+1][tileColX] != 1) { + tempEntity.in_air = true; + tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set + if (tempEntity.accelY > -35){ + tempEntity.accelY--; + } + } + else { + if(modTileY < tempEntity.accelY * -8) { + tempEntity.pos_y = tempEntity.pos_y + (modTileY) ;// NEW y set + } else { + tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set + } + tempEntity.in_air = false; + tempEntity.accelY = 0; + } + } + else { + if(modTileY < tempEntity.accelY * -8) { + tempEntity.pos_y = tempEntity.pos_y + (modTileY) ;// NEW y set + } else { + tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set + } + tempEntity.in_air = false; + tempEntity.accelY = 0; + } } - */ - // else if(HH_DEMO_HITBOX_TILEMAP[]) + else{ //jumping + tileColY = (( tempEntity.pos_y / 100) - tempEntity.radius) / 8; //top of player box + modTileY = 800 -((tempEntity.pos_y + (100 * tempEntity.radius)) % 800); //top of box + if(HH_DEMO_HITBOX_TILEMAP[tileColY-1][tileColX] != 1) {//check bottom right first + tileColX = ((tempEntity.pos_x / 100) - tempEntity.radius) / 8; + if(HH_DEMO_HITBOX_TILEMAP[tileColY-1][tileColX] != 1) { + tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set + tempEntity.in_air = true; + tempEntity.accelY--; + } else { + if(modTileY < tempEntity.accelY * -8) { + tempEntity.pos_y = tempEntity.pos_y - (modTileY) ;// NEW y set + } else { + tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ; + } + tempEntity.accelY = 0; + } + } + else { + if(modTileY < tempEntity.accelY * -8) { + tempEntity.pos_y = tempEntity.pos_y - (modTileY) ;// NEW y set //makew var gravity + } else { + tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set //makew var gravity + } + tempEntity.accelY = 0; + } + + } + + return tempEntity; } diff --git a/src/entity.h b/src/entity.h index 181182b..3684252 100644 --- a/src/entity.h +++ b/src/entity.h @@ -8,7 +8,20 @@ typedef struct { uint16_t pos_y; uint8_t radius; uint8_t rotation; //45 degrees steps 0 == right 2 == down 4 == left 6 == up - uint8_t direction_x; //direction where its looking at in case no input; - int8_t speed; //10 default L/R MODifier + int8_t direction_x; //direction where its looking at in case no input; + int8_t accelY; + int16_t speed; // default L/R MODifier + int16_t air_speed; // air L/R MODifier bool in_air; } hh_s_entity_player; + +typedef struct { + uint16_t pos_x; + uint16_t pos_y; + uint8_t radius; + uint8_t direction_x; //direction where its walking towards; + int8_t accelY; + int16_t speed; // default L/R MODifier + int16_t air_speed; + bool in_air; +} hh_s_entity_enemy; diff --git a/src/ppusim/input.c b/src/ppusim/input.c index 08bc382..4491a63 100644 --- a/src/ppusim/input.c +++ b/src/ppusim/input.c @@ -12,4 +12,5 @@ void hh_input_read() { g_hh_controller_p1.dpad_down = kb[SDL_SCANCODE_S]; g_hh_controller_p1.dpad_left = kb[SDL_SCANCODE_A]; g_hh_controller_p1.dpad_right = kb[SDL_SCANCODE_D]; + g_hh_controller_p1.button_primary = kb[SDL_SCANCODE_K]; } -- cgit v1.2.3 From a9ad8e0a8ac5346108f1e2c1a0bf9360fadc20da Mon Sep 17 00:00:00 2001 From: Flenk008 Date: Mon, 13 Mar 2023 18:02:59 +0100 Subject: Revert "Merge branch 'dev' of https://github.com/Flenk008/avans-arcade into dev" This reverts commit 4f489426e05fb3b296998b17859d8702cc4f37e1, reversing changes made to e47f7fa198229b8598b8ab03ef8b2483f7c685bc. --- features.md | 72 ----- src/.gitignore | 1 - src/engine/TODO/entity.c | 41 +++ src/engine/TODO/entity.h | 24 ++ src/engine/TODO/player_controller.h | 4 + src/engine/TODO/sprite_controller.h | 6 + src/engine/camera.c | 34 --- src/engine/camera.h | 6 - src/engine/draw_screen.c | 62 ----- src/engine/draw_screen.h | 16 +- src/engine/engine.c | 1 - src/engine/entity.c | 46 ---- src/engine/entity.h | 57 ---- src/engine/maths.c | 19 -- src/engine/maths.h | 7 +- src/engine/player_controller.c | 167 ------------ src/engine/player_controller.h | 7 - src/engine/sprite_controller.c | 22 -- src/engine/sprite_controller.h | 106 -------- src/makefile | 8 +- src/ppusim/sim.c | 11 +- test/bin/exportingPalettes.md | 4 - test/bin/test_file_read.c | 13 +- test/bin/tilemap.pip | 512 ------------------------------------ 24 files changed, 89 insertions(+), 1157 deletions(-) delete mode 100644 features.md create mode 100644 src/engine/TODO/entity.c create mode 100644 src/engine/TODO/entity.h create mode 100644 src/engine/TODO/player_controller.h create mode 100644 src/engine/TODO/sprite_controller.h delete mode 100644 src/engine/camera.c delete mode 100644 src/engine/camera.h delete mode 100644 src/engine/draw_screen.c delete mode 100644 src/engine/entity.c delete mode 100644 src/engine/entity.h delete mode 100644 src/engine/maths.c delete mode 100644 src/engine/player_controller.c delete mode 100644 src/engine/player_controller.h delete mode 100644 src/engine/sprite_controller.c delete mode 100644 src/engine/sprite_controller.h delete mode 100644 test/bin/exportingPalettes.md delete mode 100644 test/bin/tilemap.pip diff --git a/features.md b/features.md deleted file mode 100644 index d044232..0000000 --- a/features.md +++ /dev/null @@ -1,72 +0,0 @@ -Af/Cancelled/Implement in sprint 3 -Done -## Checkpoint room (shop) -| feature | status | -|-|-| -|Upgrade abilities|Implement in sprint 3| -|Interaction with shopkeeper|Implement in sprint 3| - -## Upgrades abilities -| feature | status | -|-|-| -|HP boost|Implement in sprint 3| -|Jump boost|Implement in sprint 3| -|Speed boost|Implement in sprint 3| -|Regular dash|Implement in sprint 3| -|Super punch|Implement in sprint 3| -|Smoke bomb|Implement in sprint 3| - -## Levels -| feature | status | -|-|-| -|Breakable blocks|Implement in sprint 3| -|Hidden secrets|Implement in sprint 3| -|Boss fights|Implement in sprint 3| -|Enemies|Implement in sprint 3| -|audio|Implement in sprint 3| - -## player (Gozer) -| feature | status | -|-|-| -|Move X-as|Done| -|Jump|Done| -|Special ability|Implement in sprint 3| -|Health|Implement in sprint 3| -|Currency/Scoreboard|Implement in sprint 3| - -## Enemy (Menneke) -| feature | status | -|-|-| -|Move X-as|Implement in sprint 3| -|Jump|Implement in sprint 3| -|Hunt player|Implement in sprint 3| -|Health (1 HP)|Implement in sprint 3| -|Currency/Scoreboard|Implement in sprint 3| - -## Enemy (Ventje) -| feature | status | -|-|-| -|Move X-as|Implement in sprint 3| -|Jump|Implement in sprint 3| -|Hunt player|Implement in sprint 3| -|Health (2 HP) |Implement in sprint 3| -|Splitting upon defeat|Implement in sprint 3| -|Currency/Scoreboard|Implement in sprint 3| - -## Enemy (Terror uil) -| feature | status | -|-|-| -|Movement|Implement in sprint 3| -|Hunt player|Implement in sprint 3| -|Health (1 HP) |Implement in sprint 3| -|Splitting upon defeat|Implement in sprint 3| -|Currency/Scoreboard|Implement in sprint 3| - -## Could have additions if time is enough -| feature | status | -|-|-| -|Multiplayer|Implement in sprint 3| -|Shared HP|Implement in sprint 3| -|Special ability|Implement in sprint 3| -|Health|Implement in sprint 3| -|Currency/Scoreboard|Implement in sprint 3| diff --git a/src/.gitignore b/src/.gitignore index 504b995..d8325cf 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -4,4 +4,3 @@ main.bin main main.exe static/ -*.bin diff --git a/src/engine/TODO/entity.c b/src/engine/TODO/entity.c new file mode 100644 index 0000000..fa550d5 --- /dev/null +++ b/src/engine/TODO/entity.c @@ -0,0 +1,41 @@ +#include + +#include "hh_entity.h" +#include "maths.h" + +/* + PLAYER: (pos on X) + ,___, + | | + | X | + |___| + +*/ + +bool hh_collision(vec2* pos1, vec2* pos2){ + if (pos2->x == CLAMP(pos2->x,pos1->x,pos1->x+1.0f)){// hit x + return true; + } + + if (pos2->y == CLAMP(pos2->y,pos1->y,pos1->y+0.99f)){// hit y + return true; + } + return false; +} + +void hh_solve_collision(vec2* pos_environment, hh_entity* entity){ + if (entity->vec.x > 0.0f){ + entity->pos.x = MIN(entity->pos.x,pos_environment->x-1.0f); + entity->vec.x = 0.0f; + } else if (entity->vec.x < 0.0f){ + entity->pos.x = MAX(entity->pos.x,pos_environment->x+1.0f); + entity->vec.x = 0.0f; + } else if (entity->vec.y > 0.0f){ + entity->pos.x = MIN(entity->pos.x,pos_environment->x-1.0f); + entity->vec.x = 0.0f; + } else if (entity->vec.y < 0.0f){ + entity->pos.x = MAX(entity->pos.x,pos_environment->x+1.0f); + entity->vec.x = 0.0f; + } +} + diff --git a/src/engine/TODO/entity.h b/src/engine/TODO/entity.h new file mode 100644 index 0000000..fdbeb8a --- /dev/null +++ b/src/engine/TODO/entity.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include "maths.h" + +typedef struct { + vec2 pos, vec; + bool is_grounded; + int8_t hp; + //armor/block? +}hh_entity; + +/// @brief detect for collision enity and eviroment +/// @param pos1 position of environment tile to be checked +/// @param pos2 position entity +/// @return true if collision between enity and environment +bool hh_collision(vec2* pos1, vec2* pos2); + +/// @brief solve collisions +/// @param environment position +/// @param entity position +/// @return solved new entity position +void hh_solve_collision(vec2* pos_environment, hh_entity* entity); diff --git a/src/engine/TODO/player_controller.h b/src/engine/TODO/player_controller.h new file mode 100644 index 0000000..1e9b86c --- /dev/null +++ b/src/engine/TODO/player_controller.h @@ -0,0 +1,4 @@ +#include "maths.h" +#include "hh_entity.h" + +// inputs diff --git a/src/engine/TODO/sprite_controller.h b/src/engine/TODO/sprite_controller.h new file mode 100644 index 0000000..c1fadff --- /dev/null +++ b/src/engine/TODO/sprite_controller.h @@ -0,0 +1,6 @@ +// handles sprites + +// Bg sprites + + +// Fg or entity sprites diff --git a/src/engine/camera.c b/src/engine/camera.c deleted file mode 100644 index e756bd4..0000000 --- a/src/engine/camera.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "engine/camera.h" - -#include "ppu/consts.h" - - -vec_cor hh_update_camera(vec_cen new, vec2 min, vec2 max){ - - //TODO: change floating point math to fix point math - //TODO: fix buggy y-axis ?? - - // new = vec_cen2cor(new,(vec2){.x=max.x/2,.y=max.y/2}); - new = vec_cen2cor((vec2){.x=new.x+(HH_PPU_SPRITE_WIDTH/2),.y=(new.y+(HH_PPU_SPRITE_HEIGHT/2))*2},(vec2){.x=max.x/2,.y=max.y/2}); - // new.x = new.x << HH_MATH_FIXED_POINT; - // new.y = new.y << HH_MATH_FIXED_POINT; - static vec_cor old; - // old.x = old.x << HH_MATH_FIXED_POINT; - // old.y = old.y << HH_MATH_FIXED_POINT; - - // int16_t some = 0; - // some = some <<= HH_MATH_FIXED_POINT-1; - - new.x = (int)((float)new.x*0.1f + (float)old.x*0.9f); - new.y = (int)((float)new.y*0.1f + (float)old.y*0.9f); - - // old.x = old.x >> HH_MATH_FIXED_POINT; - // old.y = old.y >> HH_MATH_FIXED_POINT; - - - old.x = CLAMP(new.x,min.x,max.x); - old.y = CLAMP(new.y,min.y,max.y); - - return old; -} - diff --git a/src/engine/camera.h b/src/engine/camera.h deleted file mode 100644 index b3ffb52..0000000 --- a/src/engine/camera.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include "engine/maths.h" - -vec_cor hh_update_camera(vec_cor new, vec2 min, vec2 max); - diff --git a/src/engine/draw_screen.c b/src/engine/draw_screen.c deleted file mode 100644 index c4f3389..0000000 --- a/src/engine/draw_screen.c +++ /dev/null @@ -1,62 +0,0 @@ -#include "engine/draw_screen.h" -#include "engine/sprite_controller.h" - -uint8_t hh_world_to_tile(vec2 pos){ - - FILE* level = fopen("../test/bin/level1_test.bin", "rb"); /* open binary file */ - if (!level) { /* check if file opened successfully */ - fprintf(stderr, "Error: Failed to open file.\n"); - return 0; - } - int index = ((pos.y/16)*40 + pos.x/16);//TODO: remove magic number(s) - fseek(level, (index * sizeof(int)) + sizeof(int), SEEK_SET); - int tile;// = (int*)malloc(sizeof(int)); - fread(&tile, sizeof(int), 1, level); // read 1 tile from binary - - fclose(level); - // int val = tile; - // free(tile); - return tile; -} - - -// remeber old value to know which part to update. -vec2 previousViewport = { .x = 0, .y = 0 }; -void hh_draw_screen(vec_cor viewport){ - if (viewport.x == previousViewport.x && viewport.y == previousViewport.y) return; - - hh_ppu_update_aux((hh_s_ppu_loc_aux){ - .bg_shift_x = viewport.x, - .bg_shift_y = viewport.y, - .fg_fetch = 0, - .sysreset = 0, - }); - - // update previous viewport values - previousViewport = viewport; -} - -void hh_setup_screen(){ - //(HH_map_size_X*HH_map_size_Y) - int size = 2400; // max X = 40 en max Y = 80 - FILE* level = fopen("../test/bin/level1_test.bin", "rb"); /* open binary file */ - if (!level) { /* check if file opened successfully */ - fprintf(stderr, "Error: Failed to open file.\n"); - return; - } - fseek(level, (0* sizeof(int)) + sizeof(int), SEEK_SET); - int* tile = (int*)malloc(size*sizeof(int)); - fread(tile, sizeof(int), size, level); // read 1 tile from binary - - fclose(level); - - for(int BAM_index = 0; BAM_index < size; BAM_index++){ - hh_ppu_update_background(BAM_index, (hh_s_ppu_loc_bam_entry){ - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = hh_get_palette(tile[BAM_index]), - .tilemap_index = tile[BAM_index], - }); - } - free(tile); -} diff --git a/src/engine/draw_screen.h b/src/engine/draw_screen.h index b181108..4af5865 100644 --- a/src/engine/draw_screen.h +++ b/src/engine/draw_screen.h @@ -3,19 +3,7 @@ // every function call for drawing the screen goes here. #include "engine/maths.h" -#include "ppu/ppu.h" -#include #include -#include - - -#define HH_map_size_X 80 -#define HH_map_size_Y 60 - -/** @brief return a single tile from world binary */ -uint8_t hh_world_to_tile(vec2 pos); -/** @brief shift to level if viewport changed position */ -void hh_draw_screen(vec2 viewport); -/** @brief send data to BAM memory from binary level */ -void hh_setup_screen(); +uint16_t hh_world_to_tile(vec2 pos); +void hh_draw_screen(vec2 viewport); \ No newline at end of file diff --git a/src/engine/engine.c b/src/engine/engine.c index 799ee7c..f3410a4 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -1,4 +1,3 @@ #include "engine/draw_screen.h" #include "engine/level.h" #include "engine/maths.h" -#include "engine/sprite_controller.h" diff --git a/src/engine/entity.c b/src/engine/entity.c deleted file mode 100644 index 153e7e1..0000000 --- a/src/engine/entity.c +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#include "engine/entity.h" -#include "engine/maths.h" - -/* - PLAYER: (pos on X) - ,___, - | | - | X | - |___| - -*/ - -bool hh_collision(vec_cor pos1, vec2 pos2){ - if (pos2.x == CLAMP(pos2.x, pos1.x, pos1.x+16)){// hit x - return true; - } - - if (pos2.y == CLAMP(pos2.y, pos1.y, pos1.y+16)){// hit y - return true; - } - return false; -} - -void hh_solve_collision(vec2 pos_environment, hh_entity* entity){ - if (!hh_collision(pos_environment,entity->pos)) - return; - - printf("BONK!/n"); - // if (entity->vel.y > 0){ - // entity->pos.y = MAX(entity->pos.y,pos_environment.y); - // entity->vel.y = 0; - // } else { - // entity->pos.y = MIN(entity->pos.y,pos_environment.y); - // entity->vel.y = 0; - // } - // if (entity->vel.x <= 0){ - // entity->pos.x = MIN(entity->pos.x,pos_environment.x-16); - // entity->vel.x = 0; - // } else { - // entity->pos.x = MAX(entity->pos.x,pos_environment.x+16); - // entity->vel.x = 0; - // } -} - diff --git a/src/engine/entity.h b/src/engine/entity.h deleted file mode 100644 index f45dae2..0000000 --- a/src/engine/entity.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include -#include - -#include "ppu/types.h" - -#include "engine/maths.h" - -typedef uint8_t hh_idx_t; - -typedef enum { - fire, ice, poison -}hh_e_damage_t; - -typedef struct { - hh_s_ppu_loc_fam_entry fam; //screen - hh_idx_t frame0; - hh_idx_t palette; - -}hh_s_rendering; - -typedef struct { - int8_t hp; - int8_t dmg; - hh_e_damage_t dmg_type; - int8_t speed_x, speed_y; - -} hh_s_atributes; - - -typedef struct { - vec2 pos, vel, vec; - bool is_grounded; - int8_t hp; - int8_t speed; - hh_s_rendering render; - //armor/block? -}hh_entity; - -typedef struct { - hh_entity p; - hh_s_atributes atr; -}hh_s_player; - - -/// @brief detect for collision enity and eviroment -/// @param pos1 position of environment tile to be checked -/// @param pos2 position entity -/// @return true if collision between enity and environment -bool hh_collision(vec2 pos1, vec2 pos2); - -/// @brief solve collisions -/// @param environment position -/// @param entity position -/// @return solved new entity position -void hh_solve_collision(vec2 pos_environment, hh_entity* entity); diff --git a/src/engine/maths.c b/src/engine/maths.c deleted file mode 100644 index 475bba2..0000000 --- a/src/engine/maths.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "engine/maths.h" - -vec2 vec_add(vec2 a, vec2 b){ - return (vec2){a.x + b.x, a.y + b.y}; -} - -vec_cor vec_cen2cor(vec_cen in, vec2 halfDistance){ - return (vec_cor){ - .x = in.x - halfDistance.x, - .y = in.y - halfDistance.y, - }; -} - -vec_cen vec_cor2cen(vec_cor in, vec2 halfDistance){ - return (vec_cen){ - .x = in.x + halfDistance.x, - .y = in.y + halfDistance.y, - }; -} diff --git a/src/engine/maths.h b/src/engine/maths.h index bef287e..c7f1b44 100644 --- a/src/engine/maths.h +++ b/src/engine/maths.h @@ -3,17 +3,12 @@ // #include typedef struct { - int32_t x,y; + uint32_t x,y; } vec2; typedef vec2 vec_cen;//centered typedef vec2 vec_cor;//left upper corner -vec2 vec_add(vec2 a, vec2 b); - -vec_cor vec_cen2cor(vec_cen in, vec2 halfDistance); -vec_cor vec_cor2cen(vec_cen in, vec2 halfDistance); - //fixed point at decimal 7lsb (world positions in pixels (with fixed decimal point)) #define HH_MATH_FIXED_POINT 7 diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c deleted file mode 100644 index 6735620..0000000 --- a/src/engine/player_controller.c +++ /dev/null @@ -1,167 +0,0 @@ -#include "ppu/types.h" -#include "engine/camera.h" -#include "engine/draw_screen.h" -#include "engine/sprite_controller.h" -#include "engine/player_controller.h" - -#include "demo.h" -#include - -#include "input.h" - -void hh_player_actions() { - static hh_entity player={ - .hp = 4, - .speed = 6, - .is_grounded = false, - .pos = (vec2){32,32}, - .vel = (vec2){0,0}, - .vec = (vec2){0,0}, - .render = { - .frame0 = 20, - .palette = 7, - .fam = (hh_s_ppu_loc_fam_entry){ - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = 7, - .tilemap_index = 2, - } - } - }, player_new = {0}; - - // hh_input_read(); - player.vel = (vec2){.x = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right), - .y = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down) }; - // const int8_t maa = 3; - // const int8_t mbb = -3; - // if (g_hh_controller_p1.dpad_up) - // - // if (g_hh_controller_p1.dpad_down) - // - // if (g_hh_controller_p1.dpad_left) { - // player.vel.x += mbb; - // // g_hh_demo_balls[0].horizontal_flip = true; - // } - // if (g_hh_controller_p1.dpad_right) { - // player.vel.x += maa; - // // g_hh_demo_balls[0].horizontal_flip = true; - // } - // if (g_hh_controller_p1.button_primary /*&& player.is_grounded*/) //JUMP - // player.vel.y += -6; - // // // if (g_hh_controller_p1.button_secondary) - - // player.render.fam.palette_index = 7; - // player.render.fam.tilemap_index = 7; - - // printf("%x ",player.render.fam.palette_index); - - // player.vel.y += 1; //gravity - - - //END OF VECTOR CHANGES - // player.vel.y = CLAMP(player.vel.y,-32,32); - // player.vel.x = CLAMP(player.vel.x,-32,32); - - player_new.pos = (vec2){ - .x = player.pos.x + player.vel.x, - .y = player.pos.y + player.vel.y, - }; - - - - // const uint8_t empty = 0; - // hh_s_tiles tiles[9]; - // const vec2 tile_offset[9] = { - // (vec2){-16,-16},(vec2){0,-16},(vec2){+16,-16}, - // (vec2){-16,0}, (vec2){0,0}, (vec2){+16,0}, - // (vec2){-16,+16},(vec2){0,+16},(vec2){+16,+16}, - // }; - // for (int i = 0; i < 9; i++) { - // vec2 temp_pos = vec_add(player.pos, tile_offset[i]); - // temp_pos =(vec2){ - // .x = temp_pos.x, - // .y = temp_pos.y, - // }; - // hh_s_tiles tile = { - // .pos = temp_pos, - // .idx = hh_world_to_tile(temp_pos) - // }; - // if(hh_colidable(tile.idx)) { - // tiles[i]=tile; - // // printf(" collidable near!"); - // } else { - // tiles[i].idx = 0; - // } - // } - /* - 012 - 345 - 678 - */ - // for (int i = 0; i < 9; i++) - // { - // if (tiles[i].idx != 0){ - // hh_solve_collision(tiles[i].pos, &player); - // } - // } - - player_new.is_grounded = false; - - // solves x collision - if (player.vel.x <= 0) { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player.pos.y + 0})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player.pos.y + 15}))) { - player_new.pos.x = (player_new.pos.x & ~15) + 16, - player_new.vel.x = 0; - } - } else { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player.pos.y + 0})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player.pos.y + 15}))) { - player_new.pos.x = player_new.pos.x & ~15, // <-- magic comma, NOT TOUCHY - player_new.vel.x = 0; - } - } - - //solves y collision - if (player.vel.y <= 0) { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 0})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 15}))) { - player_new.pos.y = (player_new.pos.y & ~15) + 16, - player_new.vel.y = 0; - } - } else { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 16})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player_new.pos.y + 15}))) { - player_new.pos.y = player_new.pos.y & ~15, - player_new.vel.y = 0; - player_new.is_grounded = true; - } - } - - player = player_new; - - vec_cor cam_pos;//value in tiles - // cam_pos = (vec2){0,0}; - cam_pos = hh_update_camera(player.pos,(vec2){0,0},(vec2){.x=20*16,.y=30*16});//TODO: remove magic number(s) - // printf("%i, %i:%i, %i\n",player.pos.x,player.pos.y,cam_pos.x,cam_pos.y); - hh_draw_screen(cam_pos); - // update player sprite on ppu - player.render.fam.position_x = (player.pos.x-cam_pos.x); - player.render.fam.position_y = (player.pos.y-cam_pos.y); - - - player.render.fam.tilemap_index = 2;//TODO: these two lines should be redundant - player.render.fam.palette_index = 7; - hh_ppu_update_foreground(0, player.render.fam); - - - hh_s_ppu_loc_fam_entry sprite = { - .position_x = 16, - .position_y = 16, - .palette_index = 7, - .tilemap_index = 2, - }; - hh_ppu_update_foreground(1, sprite); - -} - diff --git a/src/engine/player_controller.h b/src/engine/player_controller.h deleted file mode 100644 index 400c18e..0000000 --- a/src/engine/player_controller.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include "engine/maths.h" -#include "engine/entity.h" -// inputs - -void hh_player_actions(); diff --git a/src/engine/sprite_controller.c b/src/engine/sprite_controller.c deleted file mode 100644 index 5d93cf8..0000000 --- a/src/engine/sprite_controller.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include "engine/sprite_controller.h" -#include "ppu/types.h" -#include "ppu/consts.h" -#include "ppu/ppu.h" - -uint8_t hh_get_palette(uint8_t tile_idx) { - return hh_g_sprite_palette[tile_idx]; -} - -void hh_setup_palettes(){ - for (int idx = 0; idx < HH_PPU_PALETTE_COUNT; idx++) { - for (int col = 0; col < HH_PPU_PALETTE_COLOR_COUNT; col++) { - hh_ppu_update_color(idx,col,hh_g_palette[idx][col]); - } - } -} - -bool hh_colidable(uint8_t tile_idx){ - return (hh_get_palette(tile_idx) != 0); -} diff --git a/src/engine/sprite_controller.h b/src/engine/sprite_controller.h deleted file mode 100644 index 001a459..0000000 --- a/src/engine/sprite_controller.h +++ /dev/null @@ -1,106 +0,0 @@ -#pragma once -#include - -#include "ppu/types.h" - -// handles sprites - -// Bg sprites - -// Fg or entity sprites - -//TODO: pack data inside of sprite_palette LUT -//HH_PPU_PALETTE_COUNT -#define HH_SPRITE_COUNT 40 -#define HH_PAL_IDX_SKY 0 -#define HH_PAL_IDX_BRICK 1 -const static uint8_t hh_g_sprite_palette[HH_SPRITE_COUNT] = { - 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 - //other palettes here: -}; - - -const static hh_ppu_loc_palette_table_t hh_g_palette = { - {//palette info here - {0x1,0x2,0x3}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {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}}, - {//slime - {0x1,0x2,0x3}, - {0x1,0x3,0x2}, - {0x4,0x8,0x3}, - {0x7,0xa,0x4}, - {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}, - {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}}, - { - {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}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}}, - { - {0x0,0xf,0xf}, - {0xf,0xf,0xf}, - {0xf,0x0,0xf}, - {0xf,0xf,0x0}, - {0xf,0x0,0x0}, - {0x0,0xf,0x0}, - {0x0,0x0,0xf}, - {0x0,0x0,0x0}} -}; - -void hh_setup_palettes(); - -/** @brief return palette index that belongs to tilemap index */ -uint8_t hh_get_palette(uint8_t tile_idx); - -bool hh_colidable(uint8_t tile_idx); diff --git a/src/makefile b/src/makefile index d7d9087..96751fb 100644 --- a/src/makefile +++ b/src/makefile @@ -31,13 +31,7 @@ LOCAL_SRCS += main.c \ ppu/internals.c \ ppu/ppu.c \ demo.c \ - engine/engine.c \ - engine/sprite_controller.c \ - engine/player_controller.c \ - engine/draw_screen.c \ - engine/camera.c \ - engine/maths.c \ - engine/entity.c + engine/engine.c CFLAGS += $(SHARED_FLAGS) LFLAGS += $(SHARED_FLAGS) diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c index a5fec45..1fceb82 100644 --- a/src/ppusim/sim.c +++ b/src/ppusim/sim.c @@ -29,21 +29,20 @@ void hh_ppu_init() { } void hh_ppu_load_tilemap() { - char* filename = "../test/bin/tiles.bin"; + char* filename = "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; + int _size = ftell(fp)/HH_PPU_VRAM_TMM_SPRITE_SIZE; fseek(fp, 0, 0);//goto start of file for (int i = 0; i < _size; i++) { - uint8_t data[sprite_size]; + uint8_t data[HH_PPU_VRAM_TMM_SPRITE_SIZE]; - fread(data,sizeof(uint8_t),sprite_size,fp); + fread(data,HH_PPU_VRAM_TMM_SPRITE_SIZE,1,fp); hh_s_ppu_vram_data sprite = hh_ppu_2nat_sprite(data); sprite.offset = i*HH_PPU_VRAM_TMM_SPRITE_SIZE; diff --git a/test/bin/exportingPalettes.md b/test/bin/exportingPalettes.md deleted file mode 100644 index be4a354..0000000 --- a/test/bin/exportingPalettes.md +++ /dev/null @@ -1,4 +0,0 @@ -```sh -cat test.src|head -n 46 | awk '{printf "%02x: {0x%x,0x%x,0x%x}\n",NR,$1/2,$2/2,$3/2 }' > hex_palettes -``` - diff --git a/test/bin/test_file_read.c b/test/bin/test_file_read.c index df93395..b3357ce 100644 --- a/test/bin/test_file_read.c +++ b/test/bin/test_file_read.c @@ -16,22 +16,19 @@ void printData(uint8_t* in) { } void hh_ppu_load_tilemap() { - - - char* filename = "slime.bin"; + char* filename = "tiles.bin"; FILE* fp = fopen(filename,"rb"); if (!fp){ return;//error } - int sprite_size = (16 * 16); fseek(fp, 0, SEEK_END); - int _size = ftell(fp)/sprite_size; - rewind(fp); + int _size = ftell(fp)/HH_PPU_VRAM_TMM_SPRITE_SIZE; + fseek(fp, 0, 0); // printf("%i",_size); for (int i = 0; i < _size; i++) { - uint8_t data[sprite_size]; - fread(data,1,sprite_size,fp); + uint8_t data[HH_PPU_VRAM_TMM_SPRITE_SIZE]; + fread(data,HH_PPU_VRAM_TMM_SPRITE_SIZE,1,fp); printData(data); } diff --git a/test/bin/tilemap.pip b/test/bin/tilemap.pip deleted file mode 100644 index c0c646e..0000000 --- a/test/bin/tilemap.pip +++ /dev/null @@ -1,512 +0,0 @@ -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 -- cgit v1.2.3 From 91c9d1c9fc13cf163c6262437de16c992dadaa5b Mon Sep 17 00:00:00 2001 From: Flenk008 Date: Mon, 13 Mar 2023 18:03:21 +0100 Subject: Revert "Background collision" This reverts commit e47f7fa198229b8598b8ab03ef8b2483f7c685bc. --- .vscode/c_cpp_properties.json | 3 +- .vscode/launch.json | 2 +- .vscode/tasks.json | 69 +++----------- src/demo.c | 208 +++++++++--------------------------------- src/entity.h | 17 +--- src/ppusim/input.c | 1 - 6 files changed, 59 insertions(+), 241 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 3a0c430..51f5ad0 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -2,8 +2,7 @@ "configurations": [ { "name": "src", - "compileCommands": "${workspaceFolder}/src/compile_commands.json", - "configurationProvider": "ms-vscode.makefile-tools" + "compileCommands": "${workspaceFolder}/src/compile_commands.json" } ], "version": 4 diff --git a/.vscode/launch.json b/.vscode/launch.json index 4ff91bb..2f7561c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,7 @@ "environment": [], "externalConsole": false, "MIMode": "gdb", - "preLaunchTask": "build", + "preLaunchTask": "client/build", "setupCommands": [ { "description": "Enable pretty-printing for gdb", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a670b0f..53a235e 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -16,19 +16,13 @@ "isDefault": false, "kind": "build" }, - "options": { - "cwd": "${workspaceFolder}/src" - }, + "options": { "cwd": "${workspaceFolder}/src" }, "windows": { "command": "make -j", - "args": [ - "" - ] + "args": [ "" ], }, "command": "make", - "args": [ - "-j" - ], + "args": [ "-j" ], "type": "shell" }, { @@ -38,20 +32,13 @@ "isDefault": false, "kind": "test" }, - "options": { - "cwd": "${workspaceFolder}/src" - }, + "options": { "cwd": "${workspaceFolder}/src" }, "windows": { "command": "make -j flash", - "args": [ - "" - ] + "args": [ "" ], }, "command": "make", - "args": [ - "-j", - "flash" - ], + "args": [ "-j", "flash" ], "type": "shell" }, { @@ -61,19 +48,13 @@ "isDefault": false, "kind": "test" }, - "options": { - "cwd": "${workspaceFolder}/src" - }, + "options": { "cwd": "${workspaceFolder}/src" }, "windows": { "command": "make compile_commands.json", - "args": [ - "" - ] + "args": [ "" ], }, "command": "make", - "args": [ - "compile_commands" - ], + "args": [ "compile_commands" ], "type": "shell" }, { @@ -83,40 +64,14 @@ "isDefault": false, "kind": "test" }, - "options": { - "cwd": "${workspaceFolder}" - }, + "options": { "cwd": "${workspaceFolder}" }, "windows": { "command": "make clean", - "args": [ - "" - ] + "args": [ "" ], }, "command": "make", - "args": [ - "clean" - ], + "args": [ "clean" ], "type": "shell" - }, - { - "type": "cppbuild", - "label": "C/C++: gcc.exe build active file", - "command": "C:\\msys64\\mingw64\\bin\\gcc.exe", - "args": [ - "-fdiagnostics-color=always", - "-g", - "${file}", - "-o", - "${fileDirname}\\${fileBasenameNoExtension}.exe" - ], - "options": { - "cwd": "C:\\msys64\\mingw64\\bin" - }, - "problemMatcher": [ - "$gcc" - ], - "group": "build", - "detail": "compiler: C:\\msys64\\mingw64\\bin\\gcc.exe" } ] } diff --git a/src/demo.c b/src/demo.c index f5d2e71..baaf73d 100644 --- a/src/demo.c +++ b/src/demo.c @@ -5,36 +5,21 @@ #include "input.h" #include "ppu/ppu.h" -#define HH_DEMO_BALL_COUNT 2 +#define HH_DEMO_BALL_COUNT 1 hh_s_ppu_loc_fam_entry g_hh_demo_balls[HH_DEMO_BALL_COUNT]; hh_s_entity_player g_hh_player_1 = { - .pos_x = 11000, - .pos_y = 5000, - .radius = 4, + .pos_x = 31000, // 0b0000 0001 0011 0110 + .pos_y = 21000, + .radius = 8, .speed = 100, - .air_speed = 80, .direction_x = 1, - .accelY = 0, .rotation = 8, .in_air = false, }; -hh_s_entity_enemy g_hh_enemy_1 = { - .pos_x = 16000, - .pos_y = 20000, - .radius = 4, - .speed = 100, - .direction_x = 1, - .accelY = 0, - .in_air = false, -}; - void hh_player_movement(); -int hh_background_collision_x(hh_s_entity_player tempEntity); -hh_s_entity_player hh_background_collision_y_player(hh_s_entity_player tempEntity); - uint16_t g_hh_pos_x; // 0b0000 0001 0011 0110 uint16_t g_hh_pos_y; uint8_t g_hh_left = 0; @@ -83,7 +68,7 @@ void hh_demo_loop(unsigned long frame) { hh_player_movement(); // input testing (no hitbox stuff) // g_hh_player_1.pos_x += ((-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right)) * g_hh_player_1.speed; // -1 = L || 1 == R - g_hh_player_1.pos_y += ((-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down)) * g_hh_player_1.speed; // -1 = D || 1 == U + // g_hh_player_1.pos_y += ((-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down)) * g_hh_player_1.speed; // -1 = D || 1 == U // adjust map size @@ -91,14 +76,12 @@ void hh_demo_loop(unsigned long frame) { g_hh_pos_y = g_hh_player_1.pos_y / 100; + + // update player sprite on ppu g_hh_demo_balls[0].position_x = g_hh_pos_x; g_hh_demo_balls[0].position_y = g_hh_pos_y; - - g_hh_demo_balls[1].position_x = 220; - g_hh_demo_balls[1].position_y = 220; hh_ppu_update_foreground(0, g_hh_demo_balls[0]); - hh_ppu_update_foreground(1, g_hh_demo_balls[1]); // set background pattern position hh_ppu_update_aux((hh_s_ppu_loc_aux){ @@ -124,12 +107,6 @@ void hh_player_movement() { int8_t directionX = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right); // -1 = L || 1 == R int8_t directionY = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down); // -1 = D || 1 == U - if(g_hh_controller_p1.button_primary == 1 && g_hh_player_1.accelY == 0 && g_hh_player_1.in_air == false) - { - g_hh_player_1.accelY = 25; - } - - uint8_t i, j; uint8_t rotation = 0; // 0-7 @@ -147,162 +124,63 @@ void hh_player_movement() { rotation++; } } - // X-axis calc - if (directionX != 0) // update direction and position if player is not idle + // direction calc + if (directionX != 0) // update direction if player is not idle { g_hh_player_1.direction_x = directionX; - g_hh_player_1.pos_x = hh_background_collision_x(g_hh_player_1); } + // collision map x-axis - - g_hh_player_1 = hh_background_collision_y_player(g_hh_player_1); - -} - - -int hh_background_collision_x(hh_s_entity_player tempEntity){ // tile calc including radius and direction for background coliision uint16_t tileColX; - uint16_t tileColY = (tempEntity.pos_y / 100) / 8; + uint16_t tileColY = (g_hh_player_1.pos_y / 100) / 16; ; // remaining space between grid and exact uint8_t modTileX; + uint8_t modTileY; + + if (g_hh_player_1.in_air == false && directionX != 0) { + if (directionX == 1) { + tileColX = ((g_hh_player_1.pos_x / 100) + g_hh_player_1.radius) / 16; + modTileX = (g_hh_player_1.pos_x + (100 * g_hh_player_1.radius)) % 1600; + } else if (directionX == -1) { + tileColX = ((g_hh_player_1.pos_x / 100) - g_hh_player_1.radius) / 16; + modTileX = (g_hh_player_1.pos_x - (100 * g_hh_player_1.radius)) % 1600; + } - - - if (tempEntity.direction_x == 1) { - tileColX = ((tempEntity.pos_x / 100) + tempEntity.radius) / 8; - modTileX = 800 -((tempEntity.pos_x + (100 * tempEntity.radius)) % 800); - } else if (tempEntity.direction_x == -1) { - tileColX = ((tempEntity.pos_x / 100) - tempEntity.radius )/ 8; - modTileX = (tempEntity.pos_x - (100 * tempEntity.radius)) % 800; - } - - tileColY = (( tempEntity.pos_y / 100) + tempEntity.radius) / 8; //bottom of player box - - if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + tempEntity.direction_x] != 1) { - tileColY = (( tempEntity.pos_y / 100) - tempEntity.radius) / 8; //bottom of player box - if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + tempEntity.direction_x] != 1) { - if(tempEntity.in_air== true){ - tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.air_speed); // 80% of max speed if in air - } else { - tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.speed); // 80% of max speed if in air - } - } else { - if(tempEntity.in_air == true){ - if (modTileX < tempEntity.air_speed) { - tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set - } else { - tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.air_speed); // - } - } else { - if (modTileX < g_hh_player_1.speed) { - tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set - } else { - tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * tempEntity.speed); // - } - } + if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + directionX] != 1) { + g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * g_hh_player_1.speed); // NEW x set } - } else if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + tempEntity.direction_x] == 1) { - if(tempEntity.in_air == true){ - if (modTileX < tempEntity.air_speed) { - tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set - } else { - tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * tempEntity.air_speed); // - } - } else { + + else if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + directionX] == 1) { if (modTileX < g_hh_player_1.speed) { - tempEntity.pos_x = tempEntity.pos_x + (tempEntity.direction_x * modTileX); // NEW x set + g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * modTileX); // NEW x set } else { - tempEntity.pos_x= tempEntity.pos_x + (tempEntity.direction_x * tempEntity.speed); // + g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * g_hh_player_1.speed); // NEW x set } } - } - - - return tempEntity.pos_x; - -} - -hh_s_entity_player hh_background_collision_y_player(hh_s_entity_player tempEntity){ - - uint16_t tileColX; - uint16_t tileColY; - - - // remaining space between grid and exact - uint8_t modTileY; - if(g_hh_controller_p1.button_primary == 1 && tempEntity.accelY == 0 && tempEntity.in_air == false) + } else // if in air different all borders have to be checked { -// tempEntity.accelY = 25; } - - tileColY = (( tempEntity.pos_y / 100) + tempEntity.radius) / 8; //bottom of player box - tileColX = ((tempEntity.pos_x / 100) + tempEntity.radius) / 8; //right of player - modTileY = ((tempEntity.pos_y + (100 * tempEntity.radius)) % 800); //bottom of box - //rework arfter jumping - if(tempEntity.accelY <= 0){ //falling - if(HH_DEMO_HITBOX_TILEMAP[tileColY+1][tileColX] != 1) {//check bottom right first - tileColX = ((tempEntity.pos_x / 100) - tempEntity.radius) / 8; - if(HH_DEMO_HITBOX_TILEMAP[tileColY+1][tileColX] != 1) { - tempEntity.in_air = true; - tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set - if (tempEntity.accelY > -35){ - tempEntity.accelY--; - } - } - else { - if(modTileY < tempEntity.accelY * -8) { - tempEntity.pos_y = tempEntity.pos_y + (modTileY) ;// NEW y set - } else { - tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set - } - tempEntity.in_air = false; - tempEntity.accelY = 0; - } - } - else { - if(modTileY < tempEntity.accelY * -8) { - tempEntity.pos_y = tempEntity.pos_y + (modTileY) ;// NEW y set - } else { - tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set - } - tempEntity.in_air = false; - tempEntity.accelY = 0; - } + + if(directionY != 0) + { + // g_hh_player_1.pos_y = g_hh_player_1.pos_y + (directionY * g_hh_player_1.speed * 2); // NEW x set } - else{ //jumping - tileColY = (( tempEntity.pos_y / 100) - tempEntity.radius) / 8; //top of player box - modTileY = 800 -((tempEntity.pos_y + (100 * tempEntity.radius)) % 800); //top of box - if(HH_DEMO_HITBOX_TILEMAP[tileColY-1][tileColX] != 1) {//check bottom right first - tileColX = ((tempEntity.pos_x / 100) - tempEntity.radius) / 8; - if(HH_DEMO_HITBOX_TILEMAP[tileColY-1][tileColX] != 1) { - tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set - tempEntity.in_air = true; - tempEntity.accelY--; - } else { - if(modTileY < tempEntity.accelY * -8) { - tempEntity.pos_y = tempEntity.pos_y - (modTileY) ;// NEW y set - } else { - tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ; - } - tempEntity.accelY = 0; - } - } - else { - if(modTileY < tempEntity.accelY * -8) { - tempEntity.pos_y = tempEntity.pos_y - (modTileY) ;// NEW y set //makew var gravity - } else { - tempEntity.pos_y = tempEntity.pos_y - (tempEntity.accelY * 8) ;// NEW y set //makew var gravity - } - tempEntity.accelY = 0; - } - + // collision map floor (y-axis) (falling) + // if falling no jump press (implement) + /* + tileColY = (( g_hh_player_1.pos_y / 100) + g_hh_player_1.radius) / 16; //bottom of player box + modTileY = 1; + if(HH_DEMO_HITBOX_TILEMAP[tileColY+1][tileColX] != 1) //rework after jumping + { + g_hh_player_1.pos_y = g_hh_player_1.pos_y + 5 ;// NEW y set //makew var gravity + //playerStat = falling; //for later use of graphics/sound } - - return tempEntity; + */ + // else if(HH_DEMO_HITBOX_TILEMAP[]) } diff --git a/src/entity.h b/src/entity.h index 3684252..181182b 100644 --- a/src/entity.h +++ b/src/entity.h @@ -8,20 +8,7 @@ typedef struct { uint16_t pos_y; uint8_t radius; uint8_t rotation; //45 degrees steps 0 == right 2 == down 4 == left 6 == up - int8_t direction_x; //direction where its looking at in case no input; - int8_t accelY; - int16_t speed; // default L/R MODifier - int16_t air_speed; // air L/R MODifier + uint8_t direction_x; //direction where its looking at in case no input; + int8_t speed; //10 default L/R MODifier bool in_air; } hh_s_entity_player; - -typedef struct { - uint16_t pos_x; - uint16_t pos_y; - uint8_t radius; - uint8_t direction_x; //direction where its walking towards; - int8_t accelY; - int16_t speed; // default L/R MODifier - int16_t air_speed; - bool in_air; -} hh_s_entity_enemy; diff --git a/src/ppusim/input.c b/src/ppusim/input.c index 4491a63..08bc382 100644 --- a/src/ppusim/input.c +++ b/src/ppusim/input.c @@ -12,5 +12,4 @@ void hh_input_read() { g_hh_controller_p1.dpad_down = kb[SDL_SCANCODE_S]; g_hh_controller_p1.dpad_left = kb[SDL_SCANCODE_A]; g_hh_controller_p1.dpad_right = kb[SDL_SCANCODE_D]; - g_hh_controller_p1.button_primary = kb[SDL_SCANCODE_K]; } -- cgit v1.2.3 From 47c76e5eabd2b7aa4eb0de7ca34b4ef9ac78f395 Mon Sep 17 00:00:00 2001 From: Flenk008 Date: Mon, 13 Mar 2023 18:04:59 +0100 Subject: Revert "Revert "Merge branch 'dev' of https://github.com/Flenk008/avans-arcade into dev"" This reverts commit a9ad8e0a8ac5346108f1e2c1a0bf9360fadc20da. --- features.md | 72 +++++ src/.gitignore | 1 + src/engine/TODO/entity.c | 41 --- src/engine/TODO/entity.h | 24 -- src/engine/TODO/player_controller.h | 4 - src/engine/TODO/sprite_controller.h | 6 - src/engine/camera.c | 34 +++ src/engine/camera.h | 6 + src/engine/draw_screen.c | 62 +++++ src/engine/draw_screen.h | 16 +- src/engine/engine.c | 1 + src/engine/entity.c | 46 ++++ src/engine/entity.h | 57 ++++ src/engine/maths.c | 19 ++ src/engine/maths.h | 7 +- src/engine/player_controller.c | 167 ++++++++++++ src/engine/player_controller.h | 7 + src/engine/sprite_controller.c | 22 ++ src/engine/sprite_controller.h | 106 ++++++++ src/makefile | 8 +- src/ppusim/sim.c | 11 +- test/bin/exportingPalettes.md | 4 + test/bin/test_file_read.c | 13 +- test/bin/tilemap.pip | 512 ++++++++++++++++++++++++++++++++++++ 24 files changed, 1157 insertions(+), 89 deletions(-) create mode 100644 features.md delete mode 100644 src/engine/TODO/entity.c delete mode 100644 src/engine/TODO/entity.h delete mode 100644 src/engine/TODO/player_controller.h delete mode 100644 src/engine/TODO/sprite_controller.h create mode 100644 src/engine/camera.c create mode 100644 src/engine/camera.h create mode 100644 src/engine/draw_screen.c create mode 100644 src/engine/entity.c create mode 100644 src/engine/entity.h create mode 100644 src/engine/maths.c create mode 100644 src/engine/player_controller.c create mode 100644 src/engine/player_controller.h create mode 100644 src/engine/sprite_controller.c create mode 100644 src/engine/sprite_controller.h create mode 100644 test/bin/exportingPalettes.md create mode 100644 test/bin/tilemap.pip diff --git a/features.md b/features.md new file mode 100644 index 0000000..d044232 --- /dev/null +++ b/features.md @@ -0,0 +1,72 @@ +Af/Cancelled/Implement in sprint 3 +Done +## Checkpoint room (shop) +| feature | status | +|-|-| +|Upgrade abilities|Implement in sprint 3| +|Interaction with shopkeeper|Implement in sprint 3| + +## Upgrades abilities +| feature | status | +|-|-| +|HP boost|Implement in sprint 3| +|Jump boost|Implement in sprint 3| +|Speed boost|Implement in sprint 3| +|Regular dash|Implement in sprint 3| +|Super punch|Implement in sprint 3| +|Smoke bomb|Implement in sprint 3| + +## Levels +| feature | status | +|-|-| +|Breakable blocks|Implement in sprint 3| +|Hidden secrets|Implement in sprint 3| +|Boss fights|Implement in sprint 3| +|Enemies|Implement in sprint 3| +|audio|Implement in sprint 3| + +## player (Gozer) +| feature | status | +|-|-| +|Move X-as|Done| +|Jump|Done| +|Special ability|Implement in sprint 3| +|Health|Implement in sprint 3| +|Currency/Scoreboard|Implement in sprint 3| + +## Enemy (Menneke) +| feature | status | +|-|-| +|Move X-as|Implement in sprint 3| +|Jump|Implement in sprint 3| +|Hunt player|Implement in sprint 3| +|Health (1 HP)|Implement in sprint 3| +|Currency/Scoreboard|Implement in sprint 3| + +## Enemy (Ventje) +| feature | status | +|-|-| +|Move X-as|Implement in sprint 3| +|Jump|Implement in sprint 3| +|Hunt player|Implement in sprint 3| +|Health (2 HP) |Implement in sprint 3| +|Splitting upon defeat|Implement in sprint 3| +|Currency/Scoreboard|Implement in sprint 3| + +## Enemy (Terror uil) +| feature | status | +|-|-| +|Movement|Implement in sprint 3| +|Hunt player|Implement in sprint 3| +|Health (1 HP) |Implement in sprint 3| +|Splitting upon defeat|Implement in sprint 3| +|Currency/Scoreboard|Implement in sprint 3| + +## Could have additions if time is enough +| feature | status | +|-|-| +|Multiplayer|Implement in sprint 3| +|Shared HP|Implement in sprint 3| +|Special ability|Implement in sprint 3| +|Health|Implement in sprint 3| +|Currency/Scoreboard|Implement in sprint 3| diff --git a/src/.gitignore b/src/.gitignore index d8325cf..504b995 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -4,3 +4,4 @@ main.bin main main.exe static/ +*.bin diff --git a/src/engine/TODO/entity.c b/src/engine/TODO/entity.c deleted file mode 100644 index fa550d5..0000000 --- a/src/engine/TODO/entity.c +++ /dev/null @@ -1,41 +0,0 @@ -#include - -#include "hh_entity.h" -#include "maths.h" - -/* - PLAYER: (pos on X) - ,___, - | | - | X | - |___| - -*/ - -bool hh_collision(vec2* pos1, vec2* pos2){ - if (pos2->x == CLAMP(pos2->x,pos1->x,pos1->x+1.0f)){// hit x - return true; - } - - if (pos2->y == CLAMP(pos2->y,pos1->y,pos1->y+0.99f)){// hit y - return true; - } - return false; -} - -void hh_solve_collision(vec2* pos_environment, hh_entity* entity){ - if (entity->vec.x > 0.0f){ - entity->pos.x = MIN(entity->pos.x,pos_environment->x-1.0f); - entity->vec.x = 0.0f; - } else if (entity->vec.x < 0.0f){ - entity->pos.x = MAX(entity->pos.x,pos_environment->x+1.0f); - entity->vec.x = 0.0f; - } else if (entity->vec.y > 0.0f){ - entity->pos.x = MIN(entity->pos.x,pos_environment->x-1.0f); - entity->vec.x = 0.0f; - } else if (entity->vec.y < 0.0f){ - entity->pos.x = MAX(entity->pos.x,pos_environment->x+1.0f); - entity->vec.x = 0.0f; - } -} - diff --git a/src/engine/TODO/entity.h b/src/engine/TODO/entity.h deleted file mode 100644 index fdbeb8a..0000000 --- a/src/engine/TODO/entity.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include "maths.h" - -typedef struct { - vec2 pos, vec; - bool is_grounded; - int8_t hp; - //armor/block? -}hh_entity; - -/// @brief detect for collision enity and eviroment -/// @param pos1 position of environment tile to be checked -/// @param pos2 position entity -/// @return true if collision between enity and environment -bool hh_collision(vec2* pos1, vec2* pos2); - -/// @brief solve collisions -/// @param environment position -/// @param entity position -/// @return solved new entity position -void hh_solve_collision(vec2* pos_environment, hh_entity* entity); diff --git a/src/engine/TODO/player_controller.h b/src/engine/TODO/player_controller.h deleted file mode 100644 index 1e9b86c..0000000 --- a/src/engine/TODO/player_controller.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "maths.h" -#include "hh_entity.h" - -// inputs diff --git a/src/engine/TODO/sprite_controller.h b/src/engine/TODO/sprite_controller.h deleted file mode 100644 index c1fadff..0000000 --- a/src/engine/TODO/sprite_controller.h +++ /dev/null @@ -1,6 +0,0 @@ -// handles sprites - -// Bg sprites - - -// Fg or entity sprites diff --git a/src/engine/camera.c b/src/engine/camera.c new file mode 100644 index 0000000..e756bd4 --- /dev/null +++ b/src/engine/camera.c @@ -0,0 +1,34 @@ +#include "engine/camera.h" + +#include "ppu/consts.h" + + +vec_cor hh_update_camera(vec_cen new, vec2 min, vec2 max){ + + //TODO: change floating point math to fix point math + //TODO: fix buggy y-axis ?? + + // new = vec_cen2cor(new,(vec2){.x=max.x/2,.y=max.y/2}); + new = vec_cen2cor((vec2){.x=new.x+(HH_PPU_SPRITE_WIDTH/2),.y=(new.y+(HH_PPU_SPRITE_HEIGHT/2))*2},(vec2){.x=max.x/2,.y=max.y/2}); + // new.x = new.x << HH_MATH_FIXED_POINT; + // new.y = new.y << HH_MATH_FIXED_POINT; + static vec_cor old; + // old.x = old.x << HH_MATH_FIXED_POINT; + // old.y = old.y << HH_MATH_FIXED_POINT; + + // int16_t some = 0; + // some = some <<= HH_MATH_FIXED_POINT-1; + + new.x = (int)((float)new.x*0.1f + (float)old.x*0.9f); + new.y = (int)((float)new.y*0.1f + (float)old.y*0.9f); + + // old.x = old.x >> HH_MATH_FIXED_POINT; + // old.y = old.y >> HH_MATH_FIXED_POINT; + + + old.x = CLAMP(new.x,min.x,max.x); + old.y = CLAMP(new.y,min.y,max.y); + + return old; +} + diff --git a/src/engine/camera.h b/src/engine/camera.h new file mode 100644 index 0000000..b3ffb52 --- /dev/null +++ b/src/engine/camera.h @@ -0,0 +1,6 @@ +#pragma once + +#include "engine/maths.h" + +vec_cor hh_update_camera(vec_cor new, vec2 min, vec2 max); + diff --git a/src/engine/draw_screen.c b/src/engine/draw_screen.c new file mode 100644 index 0000000..c4f3389 --- /dev/null +++ b/src/engine/draw_screen.c @@ -0,0 +1,62 @@ +#include "engine/draw_screen.h" +#include "engine/sprite_controller.h" + +uint8_t hh_world_to_tile(vec2 pos){ + + FILE* level = fopen("../test/bin/level1_test.bin", "rb"); /* open binary file */ + if (!level) { /* check if file opened successfully */ + fprintf(stderr, "Error: Failed to open file.\n"); + return 0; + } + int index = ((pos.y/16)*40 + pos.x/16);//TODO: remove magic number(s) + fseek(level, (index * sizeof(int)) + sizeof(int), SEEK_SET); + int tile;// = (int*)malloc(sizeof(int)); + fread(&tile, sizeof(int), 1, level); // read 1 tile from binary + + fclose(level); + // int val = tile; + // free(tile); + return tile; +} + + +// remeber old value to know which part to update. +vec2 previousViewport = { .x = 0, .y = 0 }; +void hh_draw_screen(vec_cor viewport){ + if (viewport.x == previousViewport.x && viewport.y == previousViewport.y) return; + + hh_ppu_update_aux((hh_s_ppu_loc_aux){ + .bg_shift_x = viewport.x, + .bg_shift_y = viewport.y, + .fg_fetch = 0, + .sysreset = 0, + }); + + // update previous viewport values + previousViewport = viewport; +} + +void hh_setup_screen(){ + //(HH_map_size_X*HH_map_size_Y) + int size = 2400; // max X = 40 en max Y = 80 + FILE* level = fopen("../test/bin/level1_test.bin", "rb"); /* open binary file */ + if (!level) { /* check if file opened successfully */ + fprintf(stderr, "Error: Failed to open file.\n"); + return; + } + fseek(level, (0* sizeof(int)) + sizeof(int), SEEK_SET); + int* tile = (int*)malloc(size*sizeof(int)); + fread(tile, sizeof(int), size, level); // read 1 tile from binary + + fclose(level); + + for(int BAM_index = 0; BAM_index < size; BAM_index++){ + hh_ppu_update_background(BAM_index, (hh_s_ppu_loc_bam_entry){ + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = hh_get_palette(tile[BAM_index]), + .tilemap_index = tile[BAM_index], + }); + } + free(tile); +} diff --git a/src/engine/draw_screen.h b/src/engine/draw_screen.h index 4af5865..b181108 100644 --- a/src/engine/draw_screen.h +++ b/src/engine/draw_screen.h @@ -3,7 +3,19 @@ // every function call for drawing the screen goes here. #include "engine/maths.h" +#include "ppu/ppu.h" +#include #include -uint16_t hh_world_to_tile(vec2 pos); -void hh_draw_screen(vec2 viewport); \ No newline at end of file +#include + + +#define HH_map_size_X 80 +#define HH_map_size_Y 60 + +/** @brief return a single tile from world binary */ +uint8_t hh_world_to_tile(vec2 pos); +/** @brief shift to level if viewport changed position */ +void hh_draw_screen(vec2 viewport); +/** @brief send data to BAM memory from binary level */ +void hh_setup_screen(); diff --git a/src/engine/engine.c b/src/engine/engine.c index f3410a4..799ee7c 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -1,3 +1,4 @@ #include "engine/draw_screen.h" #include "engine/level.h" #include "engine/maths.h" +#include "engine/sprite_controller.h" diff --git a/src/engine/entity.c b/src/engine/entity.c new file mode 100644 index 0000000..153e7e1 --- /dev/null +++ b/src/engine/entity.c @@ -0,0 +1,46 @@ +#include + +#include "engine/entity.h" +#include "engine/maths.h" + +/* + PLAYER: (pos on X) + ,___, + | | + | X | + |___| + +*/ + +bool hh_collision(vec_cor pos1, vec2 pos2){ + if (pos2.x == CLAMP(pos2.x, pos1.x, pos1.x+16)){// hit x + return true; + } + + if (pos2.y == CLAMP(pos2.y, pos1.y, pos1.y+16)){// hit y + return true; + } + return false; +} + +void hh_solve_collision(vec2 pos_environment, hh_entity* entity){ + if (!hh_collision(pos_environment,entity->pos)) + return; + + printf("BONK!/n"); + // if (entity->vel.y > 0){ + // entity->pos.y = MAX(entity->pos.y,pos_environment.y); + // entity->vel.y = 0; + // } else { + // entity->pos.y = MIN(entity->pos.y,pos_environment.y); + // entity->vel.y = 0; + // } + // if (entity->vel.x <= 0){ + // entity->pos.x = MIN(entity->pos.x,pos_environment.x-16); + // entity->vel.x = 0; + // } else { + // entity->pos.x = MAX(entity->pos.x,pos_environment.x+16); + // entity->vel.x = 0; + // } +} + diff --git a/src/engine/entity.h b/src/engine/entity.h new file mode 100644 index 0000000..f45dae2 --- /dev/null +++ b/src/engine/entity.h @@ -0,0 +1,57 @@ +#pragma once + +#include +#include + +#include "ppu/types.h" + +#include "engine/maths.h" + +typedef uint8_t hh_idx_t; + +typedef enum { + fire, ice, poison +}hh_e_damage_t; + +typedef struct { + hh_s_ppu_loc_fam_entry fam; //screen + hh_idx_t frame0; + hh_idx_t palette; + +}hh_s_rendering; + +typedef struct { + int8_t hp; + int8_t dmg; + hh_e_damage_t dmg_type; + int8_t speed_x, speed_y; + +} hh_s_atributes; + + +typedef struct { + vec2 pos, vel, vec; + bool is_grounded; + int8_t hp; + int8_t speed; + hh_s_rendering render; + //armor/block? +}hh_entity; + +typedef struct { + hh_entity p; + hh_s_atributes atr; +}hh_s_player; + + +/// @brief detect for collision enity and eviroment +/// @param pos1 position of environment tile to be checked +/// @param pos2 position entity +/// @return true if collision between enity and environment +bool hh_collision(vec2 pos1, vec2 pos2); + +/// @brief solve collisions +/// @param environment position +/// @param entity position +/// @return solved new entity position +void hh_solve_collision(vec2 pos_environment, hh_entity* entity); diff --git a/src/engine/maths.c b/src/engine/maths.c new file mode 100644 index 0000000..475bba2 --- /dev/null +++ b/src/engine/maths.c @@ -0,0 +1,19 @@ +#include "engine/maths.h" + +vec2 vec_add(vec2 a, vec2 b){ + return (vec2){a.x + b.x, a.y + b.y}; +} + +vec_cor vec_cen2cor(vec_cen in, vec2 halfDistance){ + return (vec_cor){ + .x = in.x - halfDistance.x, + .y = in.y - halfDistance.y, + }; +} + +vec_cen vec_cor2cen(vec_cor in, vec2 halfDistance){ + return (vec_cen){ + .x = in.x + halfDistance.x, + .y = in.y + halfDistance.y, + }; +} diff --git a/src/engine/maths.h b/src/engine/maths.h index c7f1b44..bef287e 100644 --- a/src/engine/maths.h +++ b/src/engine/maths.h @@ -3,12 +3,17 @@ // #include typedef struct { - uint32_t x,y; + int32_t x,y; } vec2; typedef vec2 vec_cen;//centered typedef vec2 vec_cor;//left upper corner +vec2 vec_add(vec2 a, vec2 b); + +vec_cor vec_cen2cor(vec_cen in, vec2 halfDistance); +vec_cor vec_cor2cen(vec_cen in, vec2 halfDistance); + //fixed point at decimal 7lsb (world positions in pixels (with fixed decimal point)) #define HH_MATH_FIXED_POINT 7 diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c new file mode 100644 index 0000000..6735620 --- /dev/null +++ b/src/engine/player_controller.c @@ -0,0 +1,167 @@ +#include "ppu/types.h" +#include "engine/camera.h" +#include "engine/draw_screen.h" +#include "engine/sprite_controller.h" +#include "engine/player_controller.h" + +#include "demo.h" +#include + +#include "input.h" + +void hh_player_actions() { + static hh_entity player={ + .hp = 4, + .speed = 6, + .is_grounded = false, + .pos = (vec2){32,32}, + .vel = (vec2){0,0}, + .vec = (vec2){0,0}, + .render = { + .frame0 = 20, + .palette = 7, + .fam = (hh_s_ppu_loc_fam_entry){ + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = 7, + .tilemap_index = 2, + } + } + }, player_new = {0}; + + // hh_input_read(); + player.vel = (vec2){.x = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right), + .y = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down) }; + // const int8_t maa = 3; + // const int8_t mbb = -3; + // if (g_hh_controller_p1.dpad_up) + // + // if (g_hh_controller_p1.dpad_down) + // + // if (g_hh_controller_p1.dpad_left) { + // player.vel.x += mbb; + // // g_hh_demo_balls[0].horizontal_flip = true; + // } + // if (g_hh_controller_p1.dpad_right) { + // player.vel.x += maa; + // // g_hh_demo_balls[0].horizontal_flip = true; + // } + // if (g_hh_controller_p1.button_primary /*&& player.is_grounded*/) //JUMP + // player.vel.y += -6; + // // // if (g_hh_controller_p1.button_secondary) + + // player.render.fam.palette_index = 7; + // player.render.fam.tilemap_index = 7; + + // printf("%x ",player.render.fam.palette_index); + + // player.vel.y += 1; //gravity + + + //END OF VECTOR CHANGES + // player.vel.y = CLAMP(player.vel.y,-32,32); + // player.vel.x = CLAMP(player.vel.x,-32,32); + + player_new.pos = (vec2){ + .x = player.pos.x + player.vel.x, + .y = player.pos.y + player.vel.y, + }; + + + + // const uint8_t empty = 0; + // hh_s_tiles tiles[9]; + // const vec2 tile_offset[9] = { + // (vec2){-16,-16},(vec2){0,-16},(vec2){+16,-16}, + // (vec2){-16,0}, (vec2){0,0}, (vec2){+16,0}, + // (vec2){-16,+16},(vec2){0,+16},(vec2){+16,+16}, + // }; + // for (int i = 0; i < 9; i++) { + // vec2 temp_pos = vec_add(player.pos, tile_offset[i]); + // temp_pos =(vec2){ + // .x = temp_pos.x, + // .y = temp_pos.y, + // }; + // hh_s_tiles tile = { + // .pos = temp_pos, + // .idx = hh_world_to_tile(temp_pos) + // }; + // if(hh_colidable(tile.idx)) { + // tiles[i]=tile; + // // printf(" collidable near!"); + // } else { + // tiles[i].idx = 0; + // } + // } + /* + 012 + 345 + 678 + */ + // for (int i = 0; i < 9; i++) + // { + // if (tiles[i].idx != 0){ + // hh_solve_collision(tiles[i].pos, &player); + // } + // } + + player_new.is_grounded = false; + + // solves x collision + if (player.vel.x <= 0) { + if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player.pos.y + 0})) || + hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player.pos.y + 15}))) { + player_new.pos.x = (player_new.pos.x & ~15) + 16, + player_new.vel.x = 0; + } + } else { + if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player.pos.y + 0})) || + hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player.pos.y + 15}))) { + player_new.pos.x = player_new.pos.x & ~15, // <-- magic comma, NOT TOUCHY + player_new.vel.x = 0; + } + } + + //solves y collision + if (player.vel.y <= 0) { + if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 0})) || + hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 15}))) { + player_new.pos.y = (player_new.pos.y & ~15) + 16, + player_new.vel.y = 0; + } + } else { + if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 16})) || + hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player_new.pos.y + 15}))) { + player_new.pos.y = player_new.pos.y & ~15, + player_new.vel.y = 0; + player_new.is_grounded = true; + } + } + + player = player_new; + + vec_cor cam_pos;//value in tiles + // cam_pos = (vec2){0,0}; + cam_pos = hh_update_camera(player.pos,(vec2){0,0},(vec2){.x=20*16,.y=30*16});//TODO: remove magic number(s) + // printf("%i, %i:%i, %i\n",player.pos.x,player.pos.y,cam_pos.x,cam_pos.y); + hh_draw_screen(cam_pos); + // update player sprite on ppu + player.render.fam.position_x = (player.pos.x-cam_pos.x); + player.render.fam.position_y = (player.pos.y-cam_pos.y); + + + player.render.fam.tilemap_index = 2;//TODO: these two lines should be redundant + player.render.fam.palette_index = 7; + hh_ppu_update_foreground(0, player.render.fam); + + + hh_s_ppu_loc_fam_entry sprite = { + .position_x = 16, + .position_y = 16, + .palette_index = 7, + .tilemap_index = 2, + }; + hh_ppu_update_foreground(1, sprite); + +} + diff --git a/src/engine/player_controller.h b/src/engine/player_controller.h new file mode 100644 index 0000000..400c18e --- /dev/null +++ b/src/engine/player_controller.h @@ -0,0 +1,7 @@ +#pragma once + +#include "engine/maths.h" +#include "engine/entity.h" +// inputs + +void hh_player_actions(); diff --git a/src/engine/sprite_controller.c b/src/engine/sprite_controller.c new file mode 100644 index 0000000..5d93cf8 --- /dev/null +++ b/src/engine/sprite_controller.c @@ -0,0 +1,22 @@ +#include + +#include "engine/sprite_controller.h" +#include "ppu/types.h" +#include "ppu/consts.h" +#include "ppu/ppu.h" + +uint8_t hh_get_palette(uint8_t tile_idx) { + return hh_g_sprite_palette[tile_idx]; +} + +void hh_setup_palettes(){ + for (int idx = 0; idx < HH_PPU_PALETTE_COUNT; idx++) { + for (int col = 0; col < HH_PPU_PALETTE_COLOR_COUNT; col++) { + hh_ppu_update_color(idx,col,hh_g_palette[idx][col]); + } + } +} + +bool hh_colidable(uint8_t tile_idx){ + return (hh_get_palette(tile_idx) != 0); +} diff --git a/src/engine/sprite_controller.h b/src/engine/sprite_controller.h new file mode 100644 index 0000000..001a459 --- /dev/null +++ b/src/engine/sprite_controller.h @@ -0,0 +1,106 @@ +#pragma once +#include + +#include "ppu/types.h" + +// handles sprites + +// Bg sprites + +// Fg or entity sprites + +//TODO: pack data inside of sprite_palette LUT +//HH_PPU_PALETTE_COUNT +#define HH_SPRITE_COUNT 40 +#define HH_PAL_IDX_SKY 0 +#define HH_PAL_IDX_BRICK 1 +const static uint8_t hh_g_sprite_palette[HH_SPRITE_COUNT] = { + 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 + //other palettes here: +}; + + +const static hh_ppu_loc_palette_table_t hh_g_palette = { + {//palette info here + {0x1,0x2,0x3}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {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}}, + {//slime + {0x1,0x2,0x3}, + {0x1,0x3,0x2}, + {0x4,0x8,0x3}, + {0x7,0xa,0x4}, + {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}, + {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}}, + { + {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}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}}, + { + {0x0,0xf,0xf}, + {0xf,0xf,0xf}, + {0xf,0x0,0xf}, + {0xf,0xf,0x0}, + {0xf,0x0,0x0}, + {0x0,0xf,0x0}, + {0x0,0x0,0xf}, + {0x0,0x0,0x0}} +}; + +void hh_setup_palettes(); + +/** @brief return palette index that belongs to tilemap index */ +uint8_t hh_get_palette(uint8_t tile_idx); + +bool hh_colidable(uint8_t tile_idx); diff --git a/src/makefile b/src/makefile index 96751fb..d7d9087 100644 --- a/src/makefile +++ b/src/makefile @@ -31,7 +31,13 @@ LOCAL_SRCS += main.c \ ppu/internals.c \ ppu/ppu.c \ demo.c \ - engine/engine.c + engine/engine.c \ + engine/sprite_controller.c \ + engine/player_controller.c \ + engine/draw_screen.c \ + engine/camera.c \ + engine/maths.c \ + engine/entity.c CFLAGS += $(SHARED_FLAGS) LFLAGS += $(SHARED_FLAGS) diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c index 1fceb82..a5fec45 100644 --- a/src/ppusim/sim.c +++ b/src/ppusim/sim.c @@ -29,20 +29,21 @@ void hh_ppu_init() { } void hh_ppu_load_tilemap() { - char* filename = "tiles.bin"; + char* filename = "../test/bin/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)/HH_PPU_VRAM_TMM_SPRITE_SIZE; + int _size = ftell(fp)/sprite_size; fseek(fp, 0, 0);//goto start of file for (int i = 0; i < _size; i++) { - uint8_t data[HH_PPU_VRAM_TMM_SPRITE_SIZE]; + uint8_t data[sprite_size]; - fread(data,HH_PPU_VRAM_TMM_SPRITE_SIZE,1,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; diff --git a/test/bin/exportingPalettes.md b/test/bin/exportingPalettes.md new file mode 100644 index 0000000..be4a354 --- /dev/null +++ b/test/bin/exportingPalettes.md @@ -0,0 +1,4 @@ +```sh +cat test.src|head -n 46 | awk '{printf "%02x: {0x%x,0x%x,0x%x}\n",NR,$1/2,$2/2,$3/2 }' > hex_palettes +``` + diff --git a/test/bin/test_file_read.c b/test/bin/test_file_read.c index b3357ce..df93395 100644 --- a/test/bin/test_file_read.c +++ b/test/bin/test_file_read.c @@ -16,19 +16,22 @@ void printData(uint8_t* in) { } void hh_ppu_load_tilemap() { - char* filename = "tiles.bin"; + + + char* filename = "slime.bin"; FILE* fp = fopen(filename,"rb"); if (!fp){ return;//error } + int sprite_size = (16 * 16); fseek(fp, 0, SEEK_END); - int _size = ftell(fp)/HH_PPU_VRAM_TMM_SPRITE_SIZE; - fseek(fp, 0, 0); + int _size = ftell(fp)/sprite_size; + rewind(fp); // printf("%i",_size); for (int i = 0; i < _size; i++) { - uint8_t data[HH_PPU_VRAM_TMM_SPRITE_SIZE]; - fread(data,HH_PPU_VRAM_TMM_SPRITE_SIZE,1,fp); + uint8_t data[sprite_size]; + fread(data,1,sprite_size,fp); printData(data); } diff --git a/test/bin/tilemap.pip b/test/bin/tilemap.pip new file mode 100644 index 0000000..c0c646e --- /dev/null +++ b/test/bin/tilemap.pip @@ -0,0 +1,512 @@ +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 -- cgit v1.2.3 From 0ede5beef926151dd6c6ce8b0810b26225dae895 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-MR3JJV2\\niels" Date: Wed, 15 Mar 2023 10:01:50 +0100 Subject: precautions --- src/.gitignore | 14 +-- src/engine/sprite_controller.h | 212 ++++++++++++++++++++--------------------- 2 files changed, 113 insertions(+), 113 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index 504b995..b0126dd 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,7 +1,7 @@ -*.o -main.elf -main.bin -main -main.exe -static/ -*.bin +*.o +main.elf +main.bin +main +main.exe +static/ +*.bin diff --git a/src/engine/sprite_controller.h b/src/engine/sprite_controller.h index 001a459..bb7e8d1 100644 --- a/src/engine/sprite_controller.h +++ b/src/engine/sprite_controller.h @@ -1,106 +1,106 @@ -#pragma once -#include - -#include "ppu/types.h" - -// handles sprites - -// Bg sprites - -// Fg or entity sprites - -//TODO: pack data inside of sprite_palette LUT -//HH_PPU_PALETTE_COUNT -#define HH_SPRITE_COUNT 40 -#define HH_PAL_IDX_SKY 0 -#define HH_PAL_IDX_BRICK 1 -const static uint8_t hh_g_sprite_palette[HH_SPRITE_COUNT] = { - 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 - //other palettes here: -}; - - -const static hh_ppu_loc_palette_table_t hh_g_palette = { - {//palette info here - {0x1,0x2,0x3}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {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}}, - {//slime - {0x1,0x2,0x3}, - {0x1,0x3,0x2}, - {0x4,0x8,0x3}, - {0x7,0xa,0x4}, - {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}, - {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}}, - { - {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}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}, - {0x0,0x0,0x0}}, - { - {0x0,0xf,0xf}, - {0xf,0xf,0xf}, - {0xf,0x0,0xf}, - {0xf,0xf,0x0}, - {0xf,0x0,0x0}, - {0x0,0xf,0x0}, - {0x0,0x0,0xf}, - {0x0,0x0,0x0}} -}; - -void hh_setup_palettes(); - -/** @brief return palette index that belongs to tilemap index */ -uint8_t hh_get_palette(uint8_t tile_idx); - -bool hh_colidable(uint8_t tile_idx); +#pragma once +#include + +#include "ppu/types.h" + +// handles sprites + +// Bg sprites + +// Fg or entity sprites + +//TODO: pack data inside of sprite_palette LUT +//HH_PPU_PALETTE_COUNT +#define HH_SPRITE_COUNT 40 +#define HH_PAL_IDX_SKY 0 +#define HH_PAL_IDX_BRICK 1 +const static uint8_t hh_g_sprite_palette[HH_SPRITE_COUNT] = { + 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 + //other palettes here: +}; + + +const static hh_ppu_loc_palette_table_t hh_g_palette = { + {//palette info here + {0x1,0x2,0x3}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {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}}, + {//slime + {0x1,0x2,0x3}, + {0x1,0x3,0x2}, + {0x4,0x8,0x3}, + {0x7,0xa,0x4}, + {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}, + {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}}, + { + {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}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}, + {0x0,0x0,0x0}}, + { + {0x0,0xf,0xf}, + {0xf,0xf,0xf}, + {0xf,0x0,0xf}, + {0xf,0xf,0x0}, + {0xf,0x0,0x0}, + {0x0,0xf,0x0}, + {0x0,0x0,0xf}, + {0x0,0x0,0x0}} +}; + +void hh_setup_palettes(); + +/** @brief return palette index that belongs to tilemap index */ +uint8_t hh_get_palette(uint8_t tile_idx); + +bool hh_colidable(uint8_t tile_idx); -- cgit v1.2.3 From 3891486b368f4cdd1c5e00019a2a66ca05e656e6 Mon Sep 17 00:00:00 2001 From: NielsCoding <48092678+heavydemon21@users.noreply.github.com> Date: Wed, 15 Mar 2023 15:37:21 +0100 Subject: game loop and bullet TODO game loop: -(startingscreen) read correct indexes -(shop) read correct indexes -gameplay still needs alot with different levels etc.. rest not yet done bullet needs testing and correct PAL and tilemap reading --- src/GameLoop/shop.c | 28 +++++++++++++++++++ src/GameLoop/shop.h | 15 ++++++++++ src/GameLoop/startingScreen.c | 30 ++++++++++++++++++++ src/GameLoop/startingScreen.h | 14 ++++++++++ src/demo.c | 62 ++++++++++++++++++++++++++++++++++++++---- src/engine/bullet.c | 39 ++++++++++++++++++++++++++ src/engine/bullet.h | 14 ++++++++++ src/engine/draw_screen.c | 49 ++++++++++++++++++++++++++++++++- src/engine/draw_screen.h | 5 ++++ src/engine/engine.c | 1 + src/engine/player_controller.c | 13 ++++++++- src/makefile | 6 +++- 12 files changed, 268 insertions(+), 8 deletions(-) create mode 100644 src/GameLoop/shop.c create mode 100644 src/GameLoop/shop.h create mode 100644 src/GameLoop/startingScreen.c create mode 100644 src/GameLoop/startingScreen.h create mode 100644 src/engine/bullet.c create mode 100644 src/engine/bullet.h diff --git a/src/GameLoop/shop.c b/src/GameLoop/shop.c new file mode 100644 index 0000000..31ff5ce --- /dev/null +++ b/src/GameLoop/shop.c @@ -0,0 +1,28 @@ +#include "shop.h" + + +bool hh_show_Shop(){ + static hh_e_ShopStates hh_e_Shop = hh_e_STATE_SHOW; + + switch (hh_e_Shop) + { + case hh_e_STATE_SHOW: + hh_setup_startingScreen(); + hh_e_Shop = hh_e_STATE_Input; + return false; + break; + case hh_e_STATE_Input: + if(g_hh_controller_p1.dpad_right){ + hh_e_Shop = hh_e_STATE_END; + } + break; + case hh_e_STATE_END: + hh_e_Shop = hh_e_STATE_SHOW; + return true; + break; + default: + hh_e_Shop = hh_e_STATE_SHOW; + break; + } + return false; +} diff --git a/src/GameLoop/shop.h b/src/GameLoop/shop.h new file mode 100644 index 0000000..35bb780 --- /dev/null +++ b/src/GameLoop/shop.h @@ -0,0 +1,15 @@ +#include "input.h" +#include "engine/draw_screen.h" + + +#include +#include + +typedef enum { + hh_e_STATE_SHOW, + hh_e_STATE_Input, + hh_e_STATE_END +} hh_e_ShopStates; + + +bool hh_show_Shop(); diff --git a/src/GameLoop/startingScreen.c b/src/GameLoop/startingScreen.c new file mode 100644 index 0000000..a0cd283 --- /dev/null +++ b/src/GameLoop/startingScreen.c @@ -0,0 +1,30 @@ +#include "startingScreen.h" +#include "input.h" +#include "engine/draw_screen.h" +// #include "engine/player_controller.h" + +bool hh_show_startingScreen(){ + static hh_e_screenStates hh_e_startingScreen = hh_e_STATE_SHOW; + + switch (hh_e_startingScreen) + { + case hh_e_STATE_SHOW: + hh_setup_startingScreen(); + hh_e_startingScreen = hh_e_STATE_Input; + return false; + break; + case hh_e_STATE_Input: + if(g_hh_controller_p1.dpad_left){ + hh_e_startingScreen = hh_e_STATE_END; + } + break; + case hh_e_STATE_END: + hh_e_startingScreen = hh_e_STATE_SHOW; + return true; + break; + default: + hh_e_startingScreen = hh_e_STATE_SHOW; + break; + } + return false; +} diff --git a/src/GameLoop/startingScreen.h b/src/GameLoop/startingScreen.h new file mode 100644 index 0000000..f51cc66 --- /dev/null +++ b/src/GameLoop/startingScreen.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +typedef enum { + hh_e_STATE_SHOW, + hh_e_STATE_Input, + hh_e_STATE_END +} hh_e_screenStates; + + +bool hh_show_startingScreen(); + diff --git a/src/demo.c b/src/demo.c index 95347cb..f5b5c29 100644 --- a/src/demo.c +++ b/src/demo.c @@ -13,6 +13,17 @@ #include "engine/sprite_controller.h" +#include "GameLoop/startingScreen.h" +#include "GameLoop/shop.h" +// states +typedef enum { + hh_e_STATE_startingScreen, + hh_e_STATE_Shop, + hh_e_STATE_Gameplay, + hh_e_STATE_GameOver, + hh_e_STATE_HighScore +} hh_e_GameState; +hh_e_GameState hh_gameStates; hh_s_entity_player g_hh_player_1 = { .pos_x = 31000, // 0b0000 0001 0011 0110 @@ -45,18 +56,59 @@ typedef struct { hh_entity hh_g_player, hh_g_player_new; -void hh_demo_setup() { - +void hh_demo_setup() { hh_setup_palettes(); - hh_setup_screen(); + //hh_setup_screen(); } - void hh_demo_loop(unsigned long frame) { // hh_player_movement(); + switch (hh_gameStates) + { + case hh_e_STATE_startingScreen: - hh_player_actions(); + if(hh_show_startingScreen()){ + hh_gameStates = hh_e_STATE_Shop; + } + break; + case hh_e_STATE_Shop: + // TODO: + + if(hh_show_Shop()){ + hh_gameStates = hh_e_STATE_Gameplay; + } + // function: new level is chosen goto level + break; + case hh_e_STATE_Gameplay: + static int run_test=0; + if(!run_test){ + hh_setup_screen(); + run_test=1; + + } + else{ + hh_player_actions(); + } + // TODO: + // function: if level complete goto shop + // function: if player is dead goto game over + break; + case hh_e_STATE_GameOver: + // TODO: + // function: show game over screen + // function: after time goto high score + break; + case hh_e_STATE_HighScore: + // TODO: + // fucntion: show all previously scored points + // function: button pressed goto starting screen + break; + default: + hh_gameStates = hh_e_STATE_startingScreen; + break; + } + } diff --git a/src/engine/bullet.c b/src/engine/bullet.c new file mode 100644 index 0000000..eafd4e7 --- /dev/null +++ b/src/engine/bullet.c @@ -0,0 +1,39 @@ +#include "bullet.h" +#include "engine/sprite_controller.h" + +void shootBullet(vec2 playerPos, Bullet* bullet){ + // Set bullet's x and y coordinates to player's coordinates + bullet->x = playerPos.x; + bullet->y = playerPos.y; + // Set bullet's velocity to a fixed value + bullet->velocity = 1; + // Set bullet's status to active + bullet->isActive = true; +} +void updateBullet(Bullet* bullet, int deltaTime){ + // Only update bullet if it is active + static int latestLocationBullet = 0; + if (bullet->isActive) { + // Move bullet based on velocity and deltaTime + bullet->x += bullet->velocity * deltaTime; + drawBullet(bullet); + // Check if bullet has moved 16 pixels + if (bullet->x - latestLocationBullet > 16) { + // Set bullet's status to inactive + bullet->isActive = false; + } + } + else{ + latestLocationBullet = bullet->x; + } +} +void drawBullet(Bullet* bullet){ + + hh_ppu_update_foreground(1, (hh_s_ppu_loc_fam_entry) + { + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = 7, + .tilemap_index = 2, // change tilemap to the correct foreground index; + }); +} diff --git a/src/engine/bullet.h b/src/engine/bullet.h new file mode 100644 index 0000000..f119829 --- /dev/null +++ b/src/engine/bullet.h @@ -0,0 +1,14 @@ +#pragma once +#include "player_controller.h" + +typedef struct { + int x; + int y; + int velocity; + int isActive; +} Bullet; + +//Bullet* createBullet(float x, float y, float velocity, float direction); +void shootBullet(vec2 playerPos, Bullet* bullet); +void updateBullet(Bullet* bullet, int deltaTime); +void drawBullet(Bullet* bullet); diff --git a/src/engine/draw_screen.c b/src/engine/draw_screen.c index c4f3389..205d4b6 100644 --- a/src/engine/draw_screen.c +++ b/src/engine/draw_screen.c @@ -19,7 +19,6 @@ uint8_t hh_world_to_tile(vec2 pos){ return tile; } - // remeber old value to know which part to update. vec2 previousViewport = { .x = 0, .y = 0 }; void hh_draw_screen(vec_cor viewport){ @@ -60,3 +59,51 @@ void hh_setup_screen(){ } free(tile); } + +void hh_setup_startingScreen(){ + int size = 300; // 40 x as tiles 30 y as tiles + FILE* level = fopen("../test/bin/startingScreen.bin", "rb"); /* open binary file */ + if (!level) { /* check if file opened successfully */ + fprintf(stderr, "Error: Failed to open file.\n"); + return; + } + fseek(level, (0* sizeof(int)) + sizeof(int), SEEK_SET); + int* tile = (int*)malloc(size*sizeof(int)); + fread(tile, sizeof(int), size, level); // read 1 tile from binary + + fclose(level); + + for(int BAM_index = 0; BAM_index < size; BAM_index++){ + hh_ppu_update_background(BAM_index, (hh_s_ppu_loc_bam_entry){ + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = hh_get_palette(tile[BAM_index]), + .tilemap_index = tile[BAM_index], + }); + } + free(tile); +} + +void hh_setup_shopScreen(){ + int size = 300; // 40 x as tiles 30 y as tiles + FILE* level = fopen("../test/bin/shopScreen.bin", "rb"); /* open binary file */ + if (!level) { /* check if file opened successfully */ + fprintf(stderr, "Error: Failed to open file.\n"); + return; + } + fseek(level, (0* sizeof(int)) + sizeof(int), SEEK_SET); + int* tile = (int*)malloc(size*sizeof(int)); + fread(tile, sizeof(int), size, level); // read 1 tile from binary + + fclose(level); + + for(int BAM_index = 0; BAM_index < size; BAM_index++){ + hh_ppu_update_background(BAM_index, (hh_s_ppu_loc_bam_entry){ + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = hh_get_palette(tile[BAM_index]), + .tilemap_index = tile[BAM_index], + }); + } + free(tile); +} diff --git a/src/engine/draw_screen.h b/src/engine/draw_screen.h index b181108..bfe8bf8 100644 --- a/src/engine/draw_screen.h +++ b/src/engine/draw_screen.h @@ -19,3 +19,8 @@ uint8_t hh_world_to_tile(vec2 pos); void hh_draw_screen(vec2 viewport); /** @brief send data to BAM memory from binary level */ void hh_setup_screen(); +/** @brief send starting screen data to BAM memory from binary level */ +void hh_setup_startingScreen(); + +/** @brief send shop screen data to BAM memory from binary level */ +void hh_setup_shopScreen(); diff --git a/src/engine/engine.c b/src/engine/engine.c index 799ee7c..3280892 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -1,4 +1,5 @@ #include "engine/draw_screen.h" +#include "engine/bullet.h"" #include "engine/level.h" #include "engine/maths.h" #include "engine/sprite_controller.h" diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c index 22f6eb6..f938844 100644 --- a/src/engine/player_controller.c +++ b/src/engine/player_controller.c @@ -3,7 +3,7 @@ #include "engine/draw_screen.h" #include "engine/sprite_controller.h" #include "engine/player_controller.h" - +#include "engine/bullet.h" #include "input.h" void hh_player_actions() { @@ -29,6 +29,17 @@ void hh_player_actions() { // hh_input_read(); player.vel = (vec2){.x = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right), .y = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down) }; + + // shooting code + static Bullet bullet; + if(g_hh_controller_p1.button_primary){ + bullet.isActive = false; + shootBullet(player.vel, &bullet); + } + else{ + updateBullet(&bullet, 1); + + } // const int8_t maa = 3; // const int8_t mbb = -3; // if (g_hh_controller_p1.dpad_up) diff --git a/src/makefile b/src/makefile index d7d9087..94406ca 100644 --- a/src/makefile +++ b/src/makefile @@ -37,7 +37,11 @@ LOCAL_SRCS += main.c \ engine/draw_screen.c \ engine/camera.c \ engine/maths.c \ - engine/entity.c + engine/bullet.c \ + engine/entity.c \ + GameLoop/shop.c \ + GameLoop/startingScreen.c + CFLAGS += $(SHARED_FLAGS) LFLAGS += $(SHARED_FLAGS) -- cgit v1.2.3 From 2588df5f89da62b857287344d6a7f2cc6951e938 Mon Sep 17 00:00:00 2001 From: NielsCoding <48092678+heavydemon21@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:56:15 +0100 Subject: architecture docu --- .vscode/settings.json | 15 ++++++++++++++- assets/TopLevelArchi | 1 + assets/hh_introScreen.png | Bin 0 -> 130932 bytes docs/architecture.md | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 assets/TopLevelArchi create mode 100644 assets/hh_introScreen.png diff --git a/.vscode/settings.json b/.vscode/settings.json index d027762..7f37ba0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,18 @@ } }, "cmake.configureOnOpen": false, - "files.eol": "\n" + "files.eol": "\n", + "nrf-connect.topdir": "${nrf-connect.sdk:2.1.2}", + "nrf-connect.toolchain.path": "${nrf-connect.toolchain:2.1.2}", + "files.associations": { + "input.h": "c", + "draw_screen.h": "c", + "camera.h": "c", + "entity.h": "c", + "stdint.h": "c", + "player_controller.h": "c", + "sprite_controller.h": "c", + "types.h": "c", + "startingscreen.h": "c" + } } diff --git a/assets/TopLevelArchi b/assets/TopLevelArchi new file mode 100644 index 0000000..bd8c538 --- /dev/null +++ b/assets/TopLevelArchi @@ -0,0 +1 @@ +zVdNc5swEP01PrYDFlD76NhpOtN0yowPSY8KbECtYD3y4o/++kpGfDuJkzp1fTG72hXSe29XYsTm2e5G8VX6DWOQo7ET70ZsMRqPXT9w9J/x7EvP1JuUjkSJ2AY1jqX4DdZp85JCxLDuBBKiJLHqOiPMc4io4+NK4bYb9oiy+9YVT2DgWEZcDr13IqbUet1g2gx8AZGk9tWT8adyIONVsN3JOuUxblsudj1ic4VI5VO2m4M04FW4lHmfnxitF6Ygp1MSvPAuyxcOfL1NQr8QyfebOPzg27XRvtowxHr/1kRFKSaYc3ndeK8UFnkMZlZHW03MLeJKO13t/AlEe0smLwi1K6VM2lG9YLW/t/kH44cxPvqVudi1Bxd7a5VrNQt8EgLrWmOhInhm38xKiasE6Jk4ryZKKxwwA70enadAchKb7jq4lVpSxzVs6AdLyCvIsYvccFnYN4WS70ENONPSWpnHIpOziFBprDagSGgZ3/IHkCGuBQnMdcgDEmGmA6QZuOLRr+TA5xylydOzscfDrzXHTIrE5JLht00kFiRFDvO69hqWTC7snudpiKtN8G3J2J7hVSW0bVWgY31pq/jcKvHsVHgDKnTDIYVSHqGjWyDbVBAsV/ygx63ukl0MzwAXG3fx8t0hXpNjcLnvBdf0om3F7bYV1vu90GUOVghKaChAnb/1BCe2HnbJ1hMM9L6MFED+32md+ZMLa72auIXVghO/OFK+00OKHemi4yNQ1fidH6rhiTZsFHk8M/c2bUWSr9ci6lX5TtB967l1ddBWU9PGeIeLg3di9brOcXJa4PtHsK98J1e5fUOIQu+k5t7rnaBBn9JynzarfWnsTdQXUcB6E5VADCY6yKPe9l8oZnjwvl4xT5wL//C6WfWIF2UTXFI1bp/s6RtV4/bl551LNdpsvpjK8Oa7k13/AQ== \ No newline at end of file diff --git a/assets/hh_introScreen.png b/assets/hh_introScreen.png new file mode 100644 index 0000000..8b6e192 Binary files /dev/null and b/assets/hh_introScreen.png differ diff --git a/docs/architecture.md b/docs/architecture.md index 5001eed..94f17a4 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,3 +1,38 @@ +# Hooded Havic: Miniboss Mania +![intro arcade game](../assets/hh_introScreen.png) + +# introduction +Welcome to Hooded Havoc: Miniboss Mania, an exciting 2D platformer game created by our team Joshua, Loek, Bjorn, Frenk and Niels! This game was developed using the STM32 microcontroller as the game engine and the FPGA as the Picture Processing Unit (PPU). + +In Hooded Havoc: Miniboss Mania, you will take on the role of a brave hero who must battle through multiple levels filled with challenging obstacles and formidable minibosses. With smooth gameplay and engaging graphics, you will feel immersed in a world of adventure and excitement. + +Our use of the STM32 microcontroller and FPGA PPU allowed us to create a unique and innovative gaming experience. The STM32 provides efficient and reliable processing power, while the FPGA ensures that our graphics are rendered smoothly and accurately. + +So get ready to embark on a thrilling journey through Hooded Havoc: Miniboss Mania, and see how far you can make it! +## Objective +The objective of Hooded Havoc: Miniboss Mania is to guide the hero through multiple levels, defeating minibosses and overcoming obstacles along the way. The ultimate goal is to reach the final boss and defeat them to retrieve the stolen staff. + +To achieve this objective, the player must use their platforming skills to jump, run, and dodge obstacles while also battling enemies and minibosses. Each level presents a unique challenge that will require the player to adapt and strategize to overcome. + +As the player progresses through the game, they will unlock new abilities and power-ups that will aid them in their journey. The player must use these abilities wisely to defeat the minibosses and ultimately save the world. + +So, the objective of Hooded Havoc: Miniboss Mania is not only to provide an exciting and engaging gaming experience but also to challenge players to use their skills and strategic thinking to overcome obstacles and emerge victorious. +## Problem statement +One potential problem that could arise in the development of Hooded Havoc: Miniboss Mania is related to the PPU and communication between the STM32 and PPU. + +The PPU is responsible for rendering the graphics and displaying them on the screen, while the STM32 is responsible for processing the game logic and input from the player. However, if there is a problem with the communication between these two components, it could lead to synchronization issues and graphical glitches that could affect the player's experience. + +For example, if the PPU is unable to keep up with the processing speed of the STM32, the graphics may lag or appear distorted, causing the game to become unplayable. Similarly, if there is a delay in communication between the STM32 and PPU, it could result in a mismatch between the game logic and the displayed graphics, leading to confusion for the player. + +To ensure a smooth and enjoyable gaming experience, it is essential to address any potential issues with the PPU and communication between the STM32 and PPU during the development process. This may involve optimizing the code for both components, adjusting the communication protocol, or adding buffer systems to prevent lag or synchronization issues. +### architecture ( top level) +![Top level architecture](../assets/TopLevelArchi); + + + + +### design document (mid-low level) + # General system architecture ![Top-down system architecture diagram](../assets/architecture-level-1.svg) -- cgit v1.2.3 From e79c36460f400991caa82598499c0ea7c37ebb90 Mon Sep 17 00:00:00 2001 From: Flenk008 Date: Wed, 15 Mar 2023 18:58:25 +0100 Subject: Player-Enemy collision Added player with enemy collision. Also changed input system to a vector system with friction and gravity. Jump also works. Enemy is 1 stationary object. --- src/demo.c | 175 +++++++---------------------------------- src/engine/entity.c | 81 +++++++++++++++++++ src/engine/entity.h | 25 ++++++ src/engine/player_controller.c | 155 +++++++++++++++++++++++++++--------- src/ppusim/input.c | 1 + 5 files changed, 253 insertions(+), 184 deletions(-) diff --git a/src/demo.c b/src/demo.c index baaf73d..d4d1bf7 100644 --- a/src/demo.c +++ b/src/demo.c @@ -1,26 +1,21 @@ #include #include "demo.h" -#include "entity.h" #include "input.h" +#include "entity.h" #include "ppu/ppu.h" -#define HH_DEMO_BALL_COUNT 1 -hh_s_ppu_loc_fam_entry g_hh_demo_balls[HH_DEMO_BALL_COUNT]; +#include "engine/maths.h" +#include "engine/camera.h" +#include "engine/entity.h" +#include "engine/draw_screen.h" +#include "engine/player_controller.h" +#include "engine/sprite_controller.h" -hh_s_entity_player g_hh_player_1 = { - .pos_x = 31000, // 0b0000 0001 0011 0110 - .pos_y = 21000, - .radius = 8, - .speed = 100, - .direction_x = 1, - .rotation = 8, - .in_air = false, -}; -void hh_player_movement(); -uint16_t g_hh_pos_x; // 0b0000 0001 0011 0110 + +uint16_t g_hh_pos_x = 1000; // 0b0000 0001 0011 0110 uint16_t g_hh_pos_y; uint8_t g_hh_left = 0; uint8_t g_hh_right = 0; @@ -29,67 +24,29 @@ uint8_t g_hh_down = 0; uint8_t g_hh_pos_x_bit[2]; uint8_t g_hh_pos_y_bit[2]; uint8_t g_hh_data_send[3]; -int g_hh_tile_x; +int g_hh_tile_size = 8; int g_hh_tile_y; -void hh_demo_setup() { - // load sprites - hh_ppu_update_sprite(0, HH_DBG_SPRITE_BALL); - hh_ppu_update_sprite(1, HH_DBG_SPRITE_CHECKERBOARD); - - // background pattern - hh_ppu_update_color(0, 1, (hh_ppu_rgb_color_t){0x4, 0x4, 0x4}); - for (unsigned i = 0; i < HH_PPU_BG_CANVAS_TILES_H * HH_PPU_BG_CANVAS_TILES_V; i++) { - hh_ppu_update_background(i, (hh_s_ppu_loc_bam_entry){ - .horizontal_flip = false, - .vertical_flip = false, - .palette_index = 0, - .tilemap_index = 1, - }); - } - - // cool colors - hh_ppu_update_color(1, 1, (hh_ppu_rgb_color_t){0xf, 0x0, 0xf}); - hh_ppu_update_color(2, 1, (hh_ppu_rgb_color_t){0xf, 0xf, 0xf}); - hh_ppu_update_color(3, 1, (hh_ppu_rgb_color_t){0xf, 0x0, 0x0}); - hh_ppu_update_color(4, 1, (hh_ppu_rgb_color_t){0x0, 0xf, 0xf}); - hh_ppu_update_color(5, 1, (hh_ppu_rgb_color_t){0x0, 0x0, 0xf}); - - // balls - for (unsigned i = 0; i < HH_DEMO_BALL_COUNT; i++) { - g_hh_demo_balls[i].horizontal_flip = false; - g_hh_demo_balls[i].vertical_flip = false; - g_hh_demo_balls[i].palette_index = i + 1; - g_hh_demo_balls[i].tilemap_index = 0; - } -} - -void hh_demo_loop(unsigned long frame) { - hh_player_movement(); - // input testing (no hitbox stuff) - // g_hh_player_1.pos_x += ((-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right)) * g_hh_player_1.speed; // -1 = L || 1 == R - // g_hh_player_1.pos_y += ((-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down)) * g_hh_player_1.speed; // -1 = D || 1 == U +typedef struct { + vec2 pos; + uint8_t idx; +}hh_s_tiles; - // adjust map size - g_hh_pos_x = g_hh_player_1.pos_x / 100; - g_hh_pos_y = g_hh_player_1.pos_y / 100; +hh_entity hh_g_player, hh_g_player_new; +void hh_demo_setup() { + hh_setup_palettes(); + hh_setup_screen(); +} - // update player sprite on ppu - g_hh_demo_balls[0].position_x = g_hh_pos_x; - g_hh_demo_balls[0].position_y = g_hh_pos_y; - hh_ppu_update_foreground(0, g_hh_demo_balls[0]); +void hh_demo_loop(unsigned long frame) { - // set background pattern position - hh_ppu_update_aux((hh_s_ppu_loc_aux){ - .bg_shift_x = (frame / 2) % HH_PPU_SPRITE_WIDTH, - .bg_shift_y = (frame / 8) % HH_PPU_SPRITE_HEIGHT, - .fg_fetch = 0, - .sysreset = 0, - }); + + hh_player_actions(); + } // void sendData(uint8_t address, uint16_t data) { @@ -103,84 +60,8 @@ void hh_demo_loop(unsigned long frame) { // HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET); // } -void hh_player_movement() { - int8_t directionX = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right); // -1 = L || 1 == R - int8_t directionY = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down); // -1 = D || 1 == U - - uint8_t i, j; - uint8_t rotation = 0; // 0-7 - - // rotation calc - for (i = -1; i < 2; i++) { - for (j = -1; j < 2; j++) { - if (directionX == i) { - if (directionY == j) { - if (i != 0 && j != 0) // dont update when player idle - { - g_hh_player_1.rotation = rotation; - } - } - } - rotation++; - } - } - // direction calc - if (directionX != 0) // update direction if player is not idle - { - g_hh_player_1.direction_x = directionX; - } - // collision map x-axis - - // tile calc including radius and direction for background coliision - - uint16_t tileColX; - uint16_t tileColY = (g_hh_player_1.pos_y / 100) / 16; - ; - - // remaining space between grid and exact - uint8_t modTileX; - uint8_t modTileY; - - if (g_hh_player_1.in_air == false && directionX != 0) { - if (directionX == 1) { - tileColX = ((g_hh_player_1.pos_x / 100) + g_hh_player_1.radius) / 16; - modTileX = (g_hh_player_1.pos_x + (100 * g_hh_player_1.radius)) % 1600; - } else if (directionX == -1) { - tileColX = ((g_hh_player_1.pos_x / 100) - g_hh_player_1.radius) / 16; - modTileX = (g_hh_player_1.pos_x - (100 * g_hh_player_1.radius)) % 1600; - } - - if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + directionX] != 1) { - g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * g_hh_player_1.speed); // NEW x set - } - - else if (HH_DEMO_HITBOX_TILEMAP[tileColY][tileColX + directionX] == 1) { - if (modTileX < g_hh_player_1.speed) { - g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * modTileX); // NEW x set - } else { - g_hh_player_1.pos_x = g_hh_player_1.pos_x + (directionX * g_hh_player_1.speed); // NEW x set - } - } - - } else // if in air different all borders have to be checked - { - } - - - if(directionY != 0) - { - // g_hh_player_1.pos_y = g_hh_player_1.pos_y + (directionY * g_hh_player_1.speed * 2); // NEW x set - } - // collision map floor (y-axis) (falling) - // if falling no jump press (implement) - /* - tileColY = (( g_hh_player_1.pos_y / 100) + g_hh_player_1.radius) / 16; //bottom of player box - modTileY = 1; - if(HH_DEMO_HITBOX_TILEMAP[tileColY+1][tileColX] != 1) //rework after jumping - { - g_hh_player_1.pos_y = g_hh_player_1.pos_y + 5 ;// NEW y set //makew var gravity - //playerStat = falling; //for later use of graphics/sound - } - */ - // else if(HH_DEMO_HITBOX_TILEMAP[]) -} + + + + + diff --git a/src/engine/entity.c b/src/engine/entity.c index 153e7e1..535759d 100644 --- a/src/engine/entity.c +++ b/src/engine/entity.c @@ -43,4 +43,85 @@ 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_old_entity.is_grounded = false; + +// solves x collision + if (temp_old_entity.vel.x <= 0) { + if (hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 0, .y=temp_old_entity.pos.y + 0})) || + hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 0, .y=temp_old_entity.pos.y + 15}))) { + temp_new_entity.pos.x = (temp_new_entity.pos.x & ~15) + 16, + temp_new_entity.vel.x = 0; + } + } else { + if (hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 16, .y=temp_old_entity.pos.y + 0})) || + hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 16, .y=temp_old_entity.pos.y + 15}))) { + temp_new_entity.pos.x = temp_new_entity.pos.x & ~15, // <-- magic comma, NOT TOUCHY + temp_new_entity.vel.x = 0; + } + } + + //solves y collision + if (temp_old_entity.vel.y <= 0) { + if (hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 0, .y=temp_new_entity.pos.y + 0})) || + hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 15, .y=temp_new_entity.pos.y + 0}))) { + temp_new_entity.pos.y = (temp_new_entity.pos.y & ~15) + 16, + temp_new_entity.vel.y = 0; + } + } else { + if (hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 0, .y=temp_new_entity.pos.y + 15})) || + hh_colidable(hh_world_to_tile((vec2){.x=temp_new_entity.pos.x + 15, .y=temp_new_entity.pos.y + 15}))) { + temp_new_entity.pos.y = temp_new_entity.pos.y & ~15, + temp_new_entity.vel.y = 0; + temp_old_entity.is_grounded = true; + } + } + temp_old_entity.pos = temp_new_entity.pos; + temp_old_entity.vel = temp_new_entity.vel; + return temp_old_entity; +} + +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); + + if (collide == true && temp_player.is_hit == false) + { + temp_player.is_hit = true; + //angle = atan2( tempEntity.pos_y - tempPlayer.pos_y, tempEntity.pos_x - tempPlayer.pos_x); + if(temp_player.pos.x <= temp_enemy.pos.x) //player left of enemy -- creates flinch movement L or R + { + // printf("BONK-left!/n"); + temp_player.vel.y = -5; + temp_player.vel.x = -8; + } else { + // printf("BONK-right!/n"); + temp_player.vel.y = -5; + temp_player.vel.x = 8; + } + // ghost mode / invulnerable or other things on hit + // temp_player.hp--; + + } else { + temp_player.is_hit = false; + + } + + +return temp_player; +} + + +bool hh_distance_circles (vec2 object_1, vec2 object_2, int radius_1, int radius_2){ + int a_squared = (object_1.x - object_2.x) * (object_1.x - object_2.x); + int b_squared = (object_1.y - object_2.y) * (object_1.y - object_2.y); + int c_squared = a_squared + b_squared; + int radius = ( radius_1 + radius_2) * ( radius_1 + radius_2 ); + + if( c_squared <= radius ){ + return true; + } else { + return false; + } +} diff --git a/src/engine/entity.h b/src/engine/entity.h index f45dae2..cad6ba4 100644 --- a/src/engine/entity.h +++ b/src/engine/entity.h @@ -2,6 +2,7 @@ #include #include +#include #include "ppu/types.h" @@ -32,6 +33,8 @@ typedef struct { typedef struct { vec2 pos, vel, vec; bool is_grounded; + bool is_hit; + uint8_t radius; int8_t hp; int8_t speed; hh_s_rendering render; @@ -55,3 +58,25 @@ bool hh_collision(vec2 pos1, vec2 pos2); /// @param entity position /// @return solved new entity position void hh_solve_collision(vec2 pos_environment, hh_entity* entity); + +/// @brief solve collision of entity with background tiles +/// @param temp_old_entity old data of entity +/// @param temp_new_entity new data of entity where it wants to go to +/// @return updated new entity where it actually can go to +hh_entity hh_background_collision (hh_entity temp_old_entity, hh_entity temp_new_entity); + +/// @brief solve collision of player with enemy +/// @param temp_player data of player +/// @param temp_enemy data of enemy +/// @return updated player with new stats if hitted with enemy +hh_entity hh_enemy_collision(hh_entity temp_player, hh_entity temp_enemy); + +/// @brief calculate if circles (entity) hit each other +/// @param object_1 position of first object (entity) +/// @param object_2 position of second object (entity) +/// @param radius_1 radius of first object (entity) +/// @param radius_2 radius of second object (entity) +/// @return true if objects collids +bool hh_distance_circles (vec2 object_1, vec2 object_2, int radius_1, int radius_2); + + diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c index 22f6eb6..d351bee 100644 --- a/src/engine/player_controller.c +++ b/src/engine/player_controller.c @@ -11,6 +11,8 @@ void hh_player_actions() { .hp = 4, .speed = 6, .is_grounded = false, + .is_hit = false, + .radius = 8, .pos = (vec2){32,32}, .vel = (vec2){0,0}, .vec = (vec2){0,0}, @@ -26,9 +28,113 @@ void hh_player_actions() { } }, player_new = {0}; + + static hh_entity enemy={ + .hp = 4, + .speed = 6, + .is_grounded = false, + .is_hit = false, + .radius = 8, + .pos = (vec2){128,48}, + .vel = (vec2){0,0}, + .vec = (vec2){0,0}, + .render = { + .frame0 = 20, + .palette = 7, + .fam = (hh_s_ppu_loc_fam_entry){ + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = 7, + .tilemap_index = 1, + } + } + }; + player_new = player; // hh_input_read(); + static uint8_t hit = 0; + int8_t hit_timer = 0; + 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); + + if(player.is_hit == true){ + hit_timer = 9; + player.is_hit = false; + } + if(hit_timer > -10){ + hit_timer--; + } + + if(hit_timer <= 0){ + if(direction_x != 0){ + if(player.vel.x > -1 * player.speed && player.vel.x < player.speed) { + player.vel.x = player.vel.x + direction_x; + } else { + if (player.vel.x > 0) { + player.vel.x--; + } else if(player.vel.x < 0) { + player.vel.x++; + } + } + } else { + if (player.vel.x > 0) { + player.vel.x--; + } else if(player.vel.x < 0) { + player.vel.x++; + } + } + + /* // movement Y (w-s) disable gravity to use this + if(direction_y != 0){ + if(player.vel.y > -4 && player.vel.y < 4 ) { + player.vel.y = player.vel.y + direction_y; + } + } else { + if (player.vel.y > 0) { + player.vel.y--; + } else if(player.vel.y < 0) { + player.vel.y++; + } + } + + */ + } else { + if (player.vel.x > 0) { + player.vel.x--; + } else if(player.vel.x < 0) { + player.vel.x++; + } + player.vel.y++; + } + + + if (g_hh_controller_p1.button_primary && player.is_grounded == true) {//JUMP + player.vel.y = -10; + player.is_grounded = false; + } else if (player.vel.y < 6){ + player.vel.y += 1; //gravity + } + + + + +/* player.vel = (vec2){.x = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right), .y = (-1 * g_hh_controller_p1.dpad_up) + (1 * g_hh_controller_p1.dpad_down) }; + + player_new.vel = (vec2){ + .x = player.vel.x, + .y = player.vel.y, + }; +*/ + + player_new.vel = (vec2){ + .x = player.vel.x, + .y = player.vel.y, + }; + + player_new = hh_enemy_collision(player, enemy); + + // const int8_t maa = 3; // const int8_t mbb = -3; // if (g_hh_controller_p1.dpad_up) @@ -55,8 +161,8 @@ void hh_player_actions() { // player.vel.x = CLAMP(player.vel.x,-32,32); player_new.pos = (vec2){ - .x = player.pos.x + player.vel.x, - .y = player.pos.y + player.vel.y, + .x = player.pos.x + player_new.vel.x, + .y = player.pos.y + player_new.vel.y, }; @@ -96,41 +202,10 @@ void hh_player_actions() { // hh_solve_collision(tiles[i].pos, &player); // } // } - - player_new.is_grounded = false; - - // solves x collision - if (player.vel.x <= 0) { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player.pos.y + 0})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player.pos.y + 15}))) { - player_new.pos.x = (player_new.pos.x & ~15) + 16, - player_new.vel.x = 0; - } - } else { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player.pos.y + 0})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player.pos.y + 15}))) { - player_new.pos.x = player_new.pos.x & ~15, // <-- magic comma, NOT TOUCHY - player_new.vel.x = 0; - } - } - - //solves y collision - if (player.vel.y <= 0) { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 0})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 15}))) { - player_new.pos.y = (player_new.pos.y & ~15) + 16, - player_new.vel.y = 0; - } - } else { - if (hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 0, .y=player_new.pos.y + 16})) || - hh_colidable(hh_world_to_tile((vec2){.x=player_new.pos.x + 16, .y=player_new.pos.y + 15}))) { - player_new.pos.y = player_new.pos.y & ~15, - player_new.vel.y = 0; - player_new.is_grounded = true; - } - } - - player = player_new; + + player = hh_background_collision ( player, player_new); + + //player = player_new; vec_cor cam_pos;//value in tiles // cam_pos = (vec2){0,0}; @@ -141,10 +216,16 @@ void hh_player_actions() { player.render.fam.position_x = (player.pos.x-cam_pos.x); player.render.fam.position_y = (player.pos.y-cam_pos.y); + enemy.render.fam.position_x = (enemy.pos.x-cam_pos.x); + enemy.render.fam.position_y = (enemy.pos.y-cam_pos.y); player.render.fam.tilemap_index = 2;//TODO: these two lines should be redundant player.render.fam.palette_index = 7; hh_ppu_update_foreground(0, player.render.fam); + hh_ppu_update_foreground(1, enemy.render.fam); + } + + diff --git a/src/ppusim/input.c b/src/ppusim/input.c index 08bc382..5323fb1 100644 --- a/src/ppusim/input.c +++ b/src/ppusim/input.c @@ -12,4 +12,5 @@ void hh_input_read() { g_hh_controller_p1.dpad_down = kb[SDL_SCANCODE_S]; g_hh_controller_p1.dpad_left = kb[SDL_SCANCODE_A]; g_hh_controller_p1.dpad_right = kb[SDL_SCANCODE_D]; + g_hh_controller_p1.button_primary = kb[SDL_SCANCODE_SPACE]; } -- cgit v1.2.3 From 2346a009fefb6e880bd7a36bb132cad833185080 Mon Sep 17 00:00:00 2001 From: NielsCoding <48092678+heavydemon21@users.noreply.github.com> Date: Wed, 15 Mar 2023 19:46:54 +0100 Subject: bob --- assets/TopLevel.PNG | Bin 0 -> 13919 bytes assets/TopLevelArchi | 1 - docs/BobSprint2.md | 19 +++++++++++++++++++ docs/architecture.md | 3 ++- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 assets/TopLevel.PNG delete mode 100644 assets/TopLevelArchi create mode 100644 docs/BobSprint2.md diff --git a/assets/TopLevel.PNG b/assets/TopLevel.PNG new file mode 100644 index 0000000..2a7b16d Binary files /dev/null and b/assets/TopLevel.PNG differ diff --git a/assets/TopLevelArchi b/assets/TopLevelArchi deleted file mode 100644 index bd8c538..0000000 --- a/assets/TopLevelArchi +++ /dev/null @@ -1 +0,0 @@ -zVdNc5swEP01PrYDFlD76NhpOtN0yowPSY8KbECtYD3y4o/++kpGfDuJkzp1fTG72hXSe29XYsTm2e5G8VX6DWOQo7ET70ZsMRqPXT9w9J/x7EvP1JuUjkSJ2AY1jqX4DdZp85JCxLDuBBKiJLHqOiPMc4io4+NK4bYb9oiy+9YVT2DgWEZcDr13IqbUet1g2gx8AZGk9tWT8adyIONVsN3JOuUxblsudj1ic4VI5VO2m4M04FW4lHmfnxitF6Ygp1MSvPAuyxcOfL1NQr8QyfebOPzg27XRvtowxHr/1kRFKSaYc3ndeK8UFnkMZlZHW03MLeJKO13t/AlEe0smLwi1K6VM2lG9YLW/t/kH44cxPvqVudi1Bxd7a5VrNQt8EgLrWmOhInhm38xKiasE6Jk4ryZKKxwwA70enadAchKb7jq4lVpSxzVs6AdLyCvIsYvccFnYN4WS70ENONPSWpnHIpOziFBprDagSGgZ3/IHkCGuBQnMdcgDEmGmA6QZuOLRr+TA5xylydOzscfDrzXHTIrE5JLht00kFiRFDvO69hqWTC7snudpiKtN8G3J2J7hVSW0bVWgY31pq/jcKvHsVHgDKnTDIYVSHqGjWyDbVBAsV/ygx63ukl0MzwAXG3fx8t0hXpNjcLnvBdf0om3F7bYV1vu90GUOVghKaChAnb/1BCe2HnbJ1hMM9L6MFED+32md+ZMLa72auIXVghO/OFK+00OKHemi4yNQ1fidH6rhiTZsFHk8M/c2bUWSr9ci6lX5TtB967l1ddBWU9PGeIeLg3di9brOcXJa4PtHsK98J1e5fUOIQu+k5t7rnaBBn9JynzarfWnsTdQXUcB6E5VADCY6yKPe9l8oZnjwvl4xT5wL//C6WfWIF2UTXFI1bp/s6RtV4/bl551LNdpsvpjK8Oa7k13/AQ== \ No newline at end of file diff --git a/docs/BobSprint2.md b/docs/BobSprint2.md new file mode 100644 index 0000000..6fff8fc --- /dev/null +++ b/docs/BobSprint2.md @@ -0,0 +1,19 @@ + + +# Proud of +Simulation: We're proud of the simulation that we created to test our game because it allows us to identify and address potential issues before the game is released. This helps ensure that the game is as polished and bug-free as possible. + +PPU: Our use of an FPGA-based PPU (Picture Processing Unit) in our game engine allows us to achieve high-quality graphics and smooth animation. This is important because it helps create an immersive and engaging gaming experience. + +Upscaling: We've implemented a sophisticated upscaling that allows us to scale up our game. This Ensures that our game runs smoothly and without any + +Collisions: We've put a lot of effort into making sure that our collision detection system is accurate and reliable. This ensures that the game mechanics work as intended and that players are able to navigate the game world without frustration. + +Artwork: We're proud of the artwork that was created which is stunning and imaginative artwork that brings the game world to life. From character designs to background artwork, every aspect of the game has been given careful attention to ensure that it looks as good as it plays. And more is coming! +# Challegens +Upscaling: While our upscaling algorithm is sophisticated, one of the challenges we faced was synchronization. Because we're upscaling in real-time, we had to ensure that the upscaling process didn't cause any lag or delay in the game. This required careful optimization of the algorithm and synchronization with other game components. + +PPU: While the use of an FPGA-based PPU allowed us to achieve high-quality graphics, it also presented some challenges. Specifically, the limited resources of the FPGA required us to optimize the PPU code to ensure that it could handle the demands of real-time gameplay. + +Communication bug fixes on the STM32: As with any complex system, we encountered some bugs in the communication between the STM32 microcontroller and the other components of the system. This required careful debugging and troubleshooting to identify and fix the issues. + diff --git a/docs/architecture.md b/docs/architecture.md index 94f17a4..d4632b5 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -25,8 +25,9 @@ The PPU is responsible for rendering the graphics and displaying them on the scr For example, if the PPU is unable to keep up with the processing speed of the STM32, the graphics may lag or appear distorted, causing the game to become unplayable. Similarly, if there is a delay in communication between the STM32 and PPU, it could result in a mismatch between the game logic and the displayed graphics, leading to confusion for the player. To ensure a smooth and enjoyable gaming experience, it is essential to address any potential issues with the PPU and communication between the STM32 and PPU during the development process. This may involve optimizing the code for both components, adjusting the communication protocol, or adding buffer systems to prevent lag or synchronization issues. + ### architecture ( top level) -![Top level architecture](../assets/TopLevelArchi); +![Top level architecture](../assets/TopLevel.PNG.); -- cgit v1.2.3 From 6a70bf52bc2ed5d28b7d08854fabfaee27be3e84 Mon Sep 17 00:00:00 2001 From: NielsCoding <48092678+heavydemon21@users.noreply.github.com> Date: Wed, 15 Mar 2023 20:08:12 +0100 Subject: architecture and design --- docs/architecture.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index d4632b5..cf4440f 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -26,14 +26,40 @@ For example, if the PPU is unable to keep up with the processing speed of the ST To ensure a smooth and enjoyable gaming experience, it is essential to address any potential issues with the PPU and communication between the STM32 and PPU during the development process. This may involve optimizing the code for both components, adjusting the communication protocol, or adding buffer systems to prevent lag or synchronization issues. -### architecture ( top level) +# architecture ( top level) ![Top level architecture](../assets/TopLevel.PNG.); - - - -### design document (mid-low level) - +## STM32 +### game engine +### user input +### PPU communication +### APU communication +### level editing pipeline + +## FPGA (PPU) +### PPU +### SPI +### APU + +## Screen +### VGA + + +# design document (mid-low level) +## STM32 +### game engine +### user input +### PPU communication +### APU communication +### level editing pipeline + +## FPGA (PPU) +### PPU +### SPI +### APU + +## Screen +### VGA # General system architecture ![Top-down system architecture diagram](../assets/architecture-level-1.svg) -- cgit v1.2.3 From 1c0cb0d1cf8c9cb6a11aa404d8c31def1087a586 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 15 Mar 2023 21:57:44 +0100 Subject: (UNCLEAN) partial merge of #37 --- .vscode/settings.json | 15 +-------------- src/GameLoop/shop.h | 4 ++-- src/GameLoop/startingScreen.h | 8 +++----- src/engine/draw_screen.c | 3 ++- src/engine/engine.c | 2 +- src/engine/entity.c | 4 ++++ 6 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7f37ba0..d027762 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,18 +8,5 @@ } }, "cmake.configureOnOpen": false, - "files.eol": "\n", - "nrf-connect.topdir": "${nrf-connect.sdk:2.1.2}", - "nrf-connect.toolchain.path": "${nrf-connect.toolchain:2.1.2}", - "files.associations": { - "input.h": "c", - "draw_screen.h": "c", - "camera.h": "c", - "entity.h": "c", - "stdint.h": "c", - "player_controller.h": "c", - "sprite_controller.h": "c", - "types.h": "c", - "startingscreen.h": "c" - } + "files.eol": "\n" } diff --git a/src/GameLoop/shop.h b/src/GameLoop/shop.h index 35bb780..39db9fd 100644 --- a/src/GameLoop/shop.h +++ b/src/GameLoop/shop.h @@ -1,7 +1,8 @@ +#pragma once + #include "input.h" #include "engine/draw_screen.h" - #include #include @@ -11,5 +12,4 @@ typedef enum { hh_e_STATE_END } hh_e_ShopStates; - bool hh_show_Shop(); diff --git a/src/GameLoop/startingScreen.h b/src/GameLoop/startingScreen.h index f51cc66..5b4f15a 100644 --- a/src/GameLoop/startingScreen.h +++ b/src/GameLoop/startingScreen.h @@ -1,13 +1,11 @@ #pragma once +#include "GameLoop/shop.h" #include #include -typedef enum { - hh_e_STATE_SHOW, - hh_e_STATE_Input, - hh_e_STATE_END -} hh_e_screenStates; +// TODO: fix naming of enum consts +typedef hh_e_ShopStates hh_e_screenStates; bool hh_show_startingScreen(); diff --git a/src/engine/draw_screen.c b/src/engine/draw_screen.c index 205d4b6..43d3cd4 100644 --- a/src/engine/draw_screen.c +++ b/src/engine/draw_screen.c @@ -61,10 +61,11 @@ void hh_setup_screen(){ } void hh_setup_startingScreen(){ + return; int size = 300; // 40 x as tiles 30 y as tiles FILE* level = fopen("../test/bin/startingScreen.bin", "rb"); /* open binary file */ if (!level) { /* check if file opened successfully */ - fprintf(stderr, "Error: Failed to open file.\n"); + fprintf(stderr, "Error: Failed to open file. AAAA\n"); return; } fseek(level, (0* sizeof(int)) + sizeof(int), SEEK_SET); diff --git a/src/engine/engine.c b/src/engine/engine.c index 3280892..d852a99 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -1,5 +1,5 @@ #include "engine/draw_screen.h" -#include "engine/bullet.h"" +#include "engine/bullet.h" #include "engine/level.h" #include "engine/maths.h" #include "engine/sprite_controller.h" diff --git a/src/engine/entity.c b/src/engine/entity.c index 153e7e1..888539a 100644 --- a/src/engine/entity.c +++ b/src/engine/entity.c @@ -3,6 +3,10 @@ #include "engine/entity.h" #include "engine/maths.h" +#ifdef HH_TARGET_DESKTOP +#include +#endif + /* PLAYER: (pos on X) ,___, -- cgit v1.2.3 From 7b44ae05a17b544dfcddd8db322bbd916d2d2df3 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 15 Mar 2023 22:17:56 +0100 Subject: architecture document update --- assets/ppu-level-1.svg | 2 +- assets/ppu-level-2.svg | 2 +- docs/architecture.md | 119 +++++++++++++++++++++++++++++++------------------ docs/ppu.drawio | 2 +- 4 files changed, 78 insertions(+), 47 deletions(-) diff --git a/assets/ppu-level-1.svg b/assets/ppu-level-1.svg index e0d1949..6b3a2ab 100644 --- a/assets/ppu-level-1.svg +++ b/assets/ppu-level-1.svg @@ -1,3 +1,3 @@ -
Basys3 FPGA
PPU
Basys3 FPGA...
Display output
(VGA)
Display output...
STM32F091RC
CPU
STM32F091RC...
RESET
RESET
VRAM-ADDR
VRAM-ADDR
VRAM-DATA
VRAM-DATA
VRAM-WEN
VRAM-WEN
G
G
B
B
R
R
NVSYNC
NVSYNC
NHSYNC
NHSYNC
TVSYNC
TVSYNC
THSYNC
THSYNC
TVBLANK
TVBLANK
THBLANK
THBLANK
HBLANK
HBLANK
VBLANK
VBLANK
VSYNC
VSYNC
HSYNC
HSYNC
Text is not SVG - cannot display
\ No newline at end of file +
Basys3 FPGA
PPU
Basys3 FPGA...
Display output
(VGA)
Display output...
STM32F091RC
CPU
STM32F091RC...
VRAM-ADDR
VRAM-ADDR
VRAM-DATA
VRAM-DATA
VRAM-WEN
VRAM-WEN
G
G
B
B
R
R
NVSYNC
NVSYNC
NHSYNC
NHSYNC
TVBLANK
TVBLANK
THBLANK
THBLANK
HBLANK
HBLANK
VBLANK
VBLANK
Text is not SVG - cannot display
\ No newline at end of file diff --git a/assets/ppu-level-2.svg b/assets/ppu-level-2.svg index a7f343f..303e95a 100644 --- a/assets/ppu-level-2.svg +++ b/assets/ppu-level-2.svg @@ -1,3 +1,3 @@ -
pipeline stage 1-2
pipeline s...
pipeline stage 5
pipeline s...
pipeline stage 3-4
pipeline s...
sprite info
sprite info
TMM
TMM
Background sprite info
Background sp...
sprite info
sprite info
TMM
TMM
Foreground sprite info
Foreground sp...
global palette index
global palette index
Compositor
Compositor
VGA signal
VGA signal
tiny VGA signal generator
tiny VGA sign...
rgb value
rgb value
PAL
PAL
Palette lookup
Palette lookup
BAM
BAM
AUX
AUX
Sprite render
Sprite render
pixel data
pixel data
FAM
FAM
Sprite render
Sprite render
TMM
TMM
Tilemap memory
Tilemap memory
BAM
BAM
Background attribute memory
Background attribute...
screen position
screen position
PPU RAM bus
PPU RAM bus
PPU RAM bus
PPU RAM bus
native VGA signal generator
native VGA si...
VGA signal
VGA signal
Text is not SVG - cannot display
\ No newline at end of file +
pipeline stage 1-2
pipeline s...
pipeline stage 5
pipeline s...
pipeline stage 3-4
pipeline s...
sprite info
sprite info
TMM
TMM
Background sprite info
Background sp...
sprite info
sprite info
TMM
TMM
Foreground sprite info
Foreground sp...
global palette index
global palette index
Compositor
Compositor
rgb value
rgb value
PAL
PAL
Palette lookup
Palette lookup
BAM
BAM
AUX
AUX
Sprite render
Sprite render
pixel data
pixel data
FAM
FAM
Sprite render
Sprite render
TMM
TMM
Tilemap memory
Tilemap memory
BAM
BAM
Background attribute memory
Background attribute...
screen position
screen position
PPU RAM bus
PPU RAM bus
PPU RAM bus
PPU RAM bus
Display controller
Display contr...
VGA signal
VGA signal
Text is not SVG - cannot display
\ No newline at end of file diff --git a/docs/architecture.md b/docs/architecture.md index 5001eed..9be6751 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,12 +1,35 @@ # General system architecture -![Top-down system architecture diagram](../assets/architecture-level-1.svg) +The existing hardware components available for building this project consists +of: + +- Raspberry Pi +- Nucleo STM32 development board +- Basys3 FPGA development board +- Arduino Uno R3 + +The Raspberry Pi is by far the most powerful component out of these 4, but +because one of the project requirements is that no general-purpose operating +system is used, utilizing the Raspberry Pi will involve writing low-level +drivers for its interfaces, which will likely cost a lot of effort. + +As to not risk project failure due to hardware constraints, the decision was +made to use the STM32 microcontroller and FPGA in combination, as these two are +both familiar and still relatively powerful platforms. Because audio and video +consist of data streams that require constant output, the audio and graphics +processing is outsourced to the FPGA. All other game logic processing such as +world loading, or map and entity interactions is done on the STM32 +microcontroller. + +Our game also supports an optional second player, as is shown in the following +diagram. -Important notes: +![Top-down system architecture diagram](../assets/architecture-level-1.svg) -- Gamepad 2 is optionally connected -- The PPU and APU are implemented on the FPGA -- The game logic and PPU/APU control logic runs on the STM32 only +In the above diagram, the "display" and "speaker" components are included to +show what the complete system looks like. The scope of this project only +includes the components inside the area marked "game console" and the gamepad +components. # Game controllers @@ -60,7 +83,13 @@ The state machine will be designed with the following states: # PPU -Here's a list of features our PPU has: +As mentioned in the [research document](research.md#graphics), the PPU designed +for this project is heavily inspired by the NES's PPU. Because our game does +need slightly different graphical capabilities, the differences between the NES +PPU and our custom PPU are highlighted here. Readers of this section are +expected to know basic operation of the NES's PPU. + +PPU features: - 320x240 @ 60Hz VGA output (upscaled to 640x480) - single tilemap with room for 1024 tiles of 16x16 pixels @@ -71,8 +100,7 @@ Here's a list of features our PPU has: - sprites are always drawn on top of the background layer - PPU control using DMA (dual-port asynchronous RAM) - tiles can be flipped using FAM or BAM -- no frame buffer -- vertical and horizontal sync and blank output +- vertical and horizontal blank output Notable differences: @@ -80,60 +108,63 @@ Notable differences: - NES OAM equivalent is called FAM (foreground attribute register) - 320x240 @ 60Hz output - Since we're using VGA, we can't use custom resolutions without an - upscaler/downscaler. This resolution was chosen because it's exactly half of - the lowest standard VGA resolution 640x480. + Since the FPGA board we're using has a VGA port, the PPU outputs VGA. VGA + does not support custom resolutions. This resolution was chosen because it's + exactly half of the lowest standard VGA resolution 640x480. This allows the + PPU to use nearest-neighbor upscaling, which will lead to a simpler hardware + implementation. - No scanline sprite limit - Unless not imposing any sprite limit makes the hardware implementation - impossible, or much more difficult, this is a restriction that will likely - lead to frustrating debugging sessions, so will not be replicated in our - custom PPU. + This was a hardware limitation of the original NES, which our PPU design does + not have. - Sprites are 16x16 Most NES games already tile multiple 8x8 tiles together into "metatiles" to - create the illusion of larger sprites. This was likely done to save on memory - costs as RAM was expensive in the '80s, but since we're running on an FPGA - cost is irrelevant. + create the illusion of larger sprites. This however is wasteful of the + available foreground sprites, so this PPU has 16x16 pixel sprites by default. - Single 1024 sprite tilemap shared between foreground and background sprites The NES OAM registers contain a bit to select which tilemap to use (of two), which effectively expands each tile's index address by one byte. Instead of creating the illusion of two separate memory areas for tiles, having one - large tilemap seems like a more sensible solution to indexed tiles. + large tilemap is a simpler solution. - 8 total palettes, with 8 colors each - More colors is better. Increasing the total palette count is a very memory - intensive operation, while increasing the palette color count is likely slower - when looking up color values for each pixel on real hardware. + More colors allows for nicer looking graphics. Increasing the palette color + count is a very memory intensive operation as this inflates the entire + tilemap, while increasing the total palette count increases FPGA utilization. + Keeping in mind that these palettes can be modified at any point during + runtime, an 8x8 palette table is likely big enough. - Sprites can be positioned partially off-screen on all screen edges using only the offset bits in the FAM register The NES has a separate PPUMASK register to control special color effects, and to shift sprites off the left and top screen edges, as the sprite offsets - count from 0. Our PPU's FAM sprite offset bits count from -15, so the sprite + count from 0. Our PPU's FAM sprite offset bits count from -16, so the sprite can shift past the top and left screen edges, as well as the standard bottom and right edges. -- No status line register, only V-sync and H-sync outputs are supplied back to - CPU +- No status line register, only V-blank and H-blank outputs are supplied back + to CPU - The NES status line register contains some handy lines, such as a buggy - status line for reaching the max sprite count per scanline, and a status line - for detecting collisions between background and foreground sprites. Our PPU - doesn't have a scanline limit, and all hitbox detection is done in software. - Software hacks involving swapping tiles during a screen draw cycle can still - be achieved by counting the V-sync and H-sync pulses using interrupts. + The NES status line register contains a buggy status line for reaching the + max sprite count per scanline, and a status line for detecting collisions + between background and foreground sprites. Our PPU doesn't have a scanline + limit, and all hitbox detection is done in software. Software hacks involving + swapping tiles during a screen draw cycle can still be achieved by counting + the V-blank and H-blank pulses using interrupts. - No background scrolling splits This feature allows only part of the background canvas to be scrolled, while another portion stays still. This was used to draw HUD elements on the background layer for displaying things like health bars or score counters. - Since we are working with a higher foreground sprite limit, we'll use regular + Since this PPU has a higher foreground sprite limit, the game uses regular foreground sprites to display HUD elements. - Sprites are always drawn on top of the background layer - Our game doesn't need this capability for any visual effects. Leaving this - feature out will lead to a simpler hardware design + The NES PPU has the capability to draw 'foreground' sprites both behind and + in front of the background layer. Our game doesn't need this capability for + any visual effects. Leaving this feature out will lead to a simpler hardware + design. - Sprites are positioned relative to the viewport, not the background layer This leads to a simpler hardware architecture for the foreground sprite @@ -149,20 +180,18 @@ Notable differences: Important notes: -- The STM32 can reset the PPU. This line will also be connected to a physical - button on the FPGA. - The STM32 uses direct memory access to control the PPU. - The PPU's native resolution is 320x240. It works in this resolution as if it is a valid VGA signal. The STM32 is also only aware of this resolution. This resolution is referred to as "tiny" resolution. Because VGA-compatible LCD's likely don't support this resolution due to low clock speed, a built-in - pixel-perfect 2X upscaler is chained after the PPU's "tiny" output. This + pixel-perfect 2X upscaler is internally connected before the output. This means that the display sees the resolution as 640x480, but the PPU and STM32 only work in 320x240. -- The STM32 receives the TVSYNC and THSYNC lines from the PPU. These are the - VSYNC and HSYNC lines from the tiny VGA signal generator. These lines can be +- The STM32 receives the TVBLANK and THBLANK lines from the PPU. These are the + VBLANK and HBLANK lines from the "tiny" VGA resolution. These lines can be used to trigger interrupts for counting frames, and to make sure no - read/write conflicts occur for protected memory regions in the PPU. + simultanious reads and writes occur in the PPU. - NVSYNC, NHSYNC and the RGB signals refer to the output of the native VGA signal generator. @@ -181,12 +210,12 @@ Important notes: sprite with non-transparent color at current pixel in order, fallback to background) - (Palette lookup) lookup palette color using palette register - - (VGA signal generator) output real color to VGA signal generator + - (Display controller) output upscaled tiny display signal - The pipeline stages with two clock cycles contain an address set and memory read step. -- The pipeline takes 5 clock ticks in total. About 18 are available during each - pixel. For optimal display compatibility, the output color signal should be - stable before 50% of the pixel clock pulse width (9 clock ticks). +- The pipeline takes 5 clock ticks in total. About 16 are available during each + pixel. Since each scanline is buffered in the upscaler, all available clock + cycles can be used (if necessary). - Since the "sprite info" and "sprite render" steps are fundamentally different for the foreground and background layer, these components will be combined into one for each layer respectively. They are separated in the above diagram @@ -197,6 +226,7 @@ Important notes: the RAM in it's own cache memory. The cache updates are fetched during the VBLANK time between each frame. + ## Registers diff --git a/docs/ppu.drawio b/docs/ppu.drawio index c0ce0be..f7677be 100644 --- a/docs/ppu.drawio +++ b/docs/ppu.drawio @@ -1 +1 @@ -7Vzbcto6FP0aZs55SMayjYFHc0lymoRmCElKX84YEOBWIGqLBPL1lUHCFxmZm21o6Uut7W3Z2mtpbd1IQauN57eONR094j5EBVXpzwtavaCqQAc6/c+zLFaWslFaGYaO3WdOvuHZ/oTMqDDrzO5DN+RIMEbEnoaNPTyZwB4J2SzHwR9htwFG4bdOrSEUDM89C4nWN7tPRqwVRcW330F7OOJvBgq7M7a4MzO4I6uPPwImrVHQag7GZHU1ntcg8oLH47J67mbD3fWHOXBCtnmguPiPkG+kPQPtjw7CTaOh3F2xWt4tNGMNrlruwtWo7ebp1iyoBqKVV7sOvRp6V09PL6w5ZMFj5ODZpA+91yjU42NkE/g8tXre3Q/KCmobkTGiJUAvXXrHngwf4MD76qui4ttaLI4hI6sVWV2InrBrExtPqK1HWw0deuMdOsSmeD1EHLqYEDym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wuRvwf \ No newline at end of file -- cgit v1.2.3 From f53db3c725838e89a6148b2c629093862d57519c Mon Sep 17 00:00:00 2001 From: UnavailableDev <69792062+UnavailableDev@users.noreply.github.com> Date: Wed, 15 Mar 2023 22:19:50 +0100 Subject: Update architecture.md --- docs/architecture.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture.md b/docs/architecture.md index 9be6751..36bec75 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -401,7 +401,7 @@ optional: - envelope (ADSR) -![ADSR envelope](https://upload.wikimedia.org/wikipedia/commons/e/ea/ADSR_parameter.svg) + This image shows an advanced method of generating tones. In our case this is only an indication as to how it could be done, we will actually only be looking at the sustained tone part for simplicity sakes. In order to get the correct graph forms, some data points can be stored in a LUT (Look Up Table). This allows the saving of computation power at the cost of some ROM space. -- cgit v1.2.3 From 51ee4672d5f2f734eb40f4312a2aefd2f8c6dc03 Mon Sep 17 00:00:00 2001 From: BjornMartens <113104306+BjornMartens@users.noreply.github.com> Date: Thu, 16 Mar 2023 09:58:34 +0100 Subject: Added top level stm --- docs/architecture.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/architecture.md b/docs/architecture.md index cf4440f..3b4a877 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -31,6 +31,17 @@ To ensure a smooth and enjoyable gaming experience, it is essential to address a ## STM32 ### game engine +The game engine is designed to run a 2D platformer game. The game engine has to manage all the different game states. To do this it will utilize a finite state machine (FSM). The game engine will also cover de input handling from the player, the game logic for example enemy handling or the powerup handling it will also send out data to the APU (Audio processing unit) so that the right sounds will be played. + +FSM is a useful tool for managing game states and transitions. The game has many different states such as: title screen, shop and gameplay state. Each state represents a particular configuration from the with different logic and variables. + +The state machine is designed to have the following states: +1. Initialization: The initialization state will be responsible for initializing all game-related variables and subsystems, including the FPGA-based picture processing unit. +2. Title Screen: The title screen state will display the game's title screen and wait for user input to start the game or access the options menu. +3. Options: The options state will allow the user to configure game settings, such as sound and graphics options. +4. Game Play: The game play state will be responsible for running the game logic and updating the game state. +5. Game Over: The game over state will display the game over screen and wait for user input to restart the game or return to the title screen. + ### user input ### PPU communication ### APU communication -- cgit v1.2.3 From edee448b453c683ca968a8dacaa37508ec649c8c Mon Sep 17 00:00:00 2001 From: Flenk008 Date: Thu, 16 Mar 2023 12:46:18 +0100 Subject: Update architecture.md Added SPI (STM32, BASYS3) --- docs/architecture.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/architecture.md b/docs/architecture.md index 36bec75..bea35be 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -430,3 +430,23 @@ To index tiles from the tilemap, 10 bits will be used for both the foreground and background layers of the PPU. This means that the global tilemap can fit up to 1024 tiles in total, each being 16x16 pixels (the example uses 4x4 tiles for illustration purposes). + + +### PPU communication + +To comunicate with the FPGA via the STM32 a protocol is needed. After [research](research.md#Input) of different possible protocols, SPI was the best option for this problem. As there is only one master and one slave, four data lines are needed at maximum. The STM32 will be the master and the FPGA will be the slave. The STM32 has a configurable SPI module that is easily configurable unlike the FPGA. Futhermore, the MISO line is not needed because the FPGA does not send any big data to the STM32. The slave select line will operate as a write enable. + + + +### SPI + +The FPGA will configure as a slave of the SPI protocol. THe FPGA (Basys3) does not have a IP-Core that supports external SPI communication so the SPI slave has to be designed. The module requires three inputs as mentioned before in the [STM32](architecture.md#STM32) section. + + +### PPU communication + +The SPI module will be configured that sends 8 bits per cycle and at a speed of 1.0 MB/s. The STM32 Cube IDE SPI module does not include a slave select line so a pin has to configured manually to fullfill this purpose. Every data transfer consists out of 4 times 8 bits, so 32 bits in total. The first byte is the address and the other 3 bytes consist the data. + + +### SPI +The FPGA uses 3 JMOD pins to receive the SPI data. The FPGA does not have a IP-Core for SPI. To receive the data the module has 3 synchronisers for the incoming SPI clock, data and slave select. The data will be read via the SPI protocol and shifted untill all 32 bits are read. -- cgit v1.2.3 From 3b9864c7e6382acc0a6727920ef0f92c33af250d Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 16 Mar 2023 13:06:27 +0100 Subject: merge niels docs --- assets/TopLevel.PNG | Bin 0 -> 13919 bytes assets/hh_introScreen.png | Bin 0 -> 130932 bytes docs/BobSprint2.md | 19 +++++++++++++++++++ docs/architecture.md | 38 +++++++++++++++++++++++++++++++++----- 4 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 assets/TopLevel.PNG create mode 100644 assets/hh_introScreen.png create mode 100644 docs/BobSprint2.md diff --git a/assets/TopLevel.PNG b/assets/TopLevel.PNG new file mode 100644 index 0000000..2a7b16d Binary files /dev/null and b/assets/TopLevel.PNG differ diff --git a/assets/hh_introScreen.png b/assets/hh_introScreen.png new file mode 100644 index 0000000..8b6e192 Binary files /dev/null and b/assets/hh_introScreen.png differ diff --git a/docs/BobSprint2.md b/docs/BobSprint2.md new file mode 100644 index 0000000..6fff8fc --- /dev/null +++ b/docs/BobSprint2.md @@ -0,0 +1,19 @@ + + +# Proud of +Simulation: We're proud of the simulation that we created to test our game because it allows us to identify and address potential issues before the game is released. This helps ensure that the game is as polished and bug-free as possible. + +PPU: Our use of an FPGA-based PPU (Picture Processing Unit) in our game engine allows us to achieve high-quality graphics and smooth animation. This is important because it helps create an immersive and engaging gaming experience. + +Upscaling: We've implemented a sophisticated upscaling that allows us to scale up our game. This Ensures that our game runs smoothly and without any + +Collisions: We've put a lot of effort into making sure that our collision detection system is accurate and reliable. This ensures that the game mechanics work as intended and that players are able to navigate the game world without frustration. + +Artwork: We're proud of the artwork that was created which is stunning and imaginative artwork that brings the game world to life. From character designs to background artwork, every aspect of the game has been given careful attention to ensure that it looks as good as it plays. And more is coming! +# Challegens +Upscaling: While our upscaling algorithm is sophisticated, one of the challenges we faced was synchronization. Because we're upscaling in real-time, we had to ensure that the upscaling process didn't cause any lag or delay in the game. This required careful optimization of the algorithm and synchronization with other game components. + +PPU: While the use of an FPGA-based PPU allowed us to achieve high-quality graphics, it also presented some challenges. Specifically, the limited resources of the FPGA required us to optimize the PPU code to ensure that it could handle the demands of real-time gameplay. + +Communication bug fixes on the STM32: As with any complex system, we encountered some bugs in the communication between the STM32 microcontroller and the other components of the system. This required careful debugging and troubleshooting to identify and fix the issues. + diff --git a/docs/architecture.md b/docs/architecture.md index 36bec75..c2eb655 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,18 +1,46 @@ -# General system architecture +# Hooded Havic: Miniboss Mania + +![intro arcade game](../assets/hh_introScreen.png) + +# introduction +Welcome to Hooded Havoc: Miniboss Mania, an exciting 2D platformer game created by our team Joshua, Loek, Bjorn, Frenk and Niels! This game was developed using the STM32 microcontroller as the game engine and the FPGA as the Picture Processing Unit (PPU). + +In Hooded Havoc: Miniboss Mania, you will take on the role of a brave hero who must battle through multiple levels filled with challenging obstacles and formidable minibosses. With smooth gameplay and engaging graphics, you will feel immersed in a world of adventure and excitement. + +Our use of the STM32 microcontroller and FPGA PPU allowed us to create a unique and innovative gaming experience. The STM32 provides efficient and reliable processing power, while the FPGA ensures that our graphics are rendered smoothly and accurately. + +So get ready to embark on a thrilling journey through Hooded Havoc: Miniboss Mania, and see how far you can make it! +## Objective +The objective of Hooded Havoc: Miniboss Mania is to guide the hero through multiple levels, defeating minibosses and overcoming obstacles along the way. The ultimate goal is to reach the final boss and defeat them to retrieve the stolen staff. + +To achieve this objective, the player must use their platforming skills to jump, run, and dodge obstacles while also battling enemies and minibosses. Each level presents a unique challenge that will require the player to adapt and strategize to overcome. + +As the player progresses through the game, they will unlock new abilities and power-ups that will aid them in their journey. The player must use these abilities wisely to defeat the minibosses and ultimately save the world. + +So, the objective of Hooded Havoc: Miniboss Mania is not only to provide an exciting and engaging gaming experience but also to challenge players to use their skills and strategic thinking to overcome obstacles and emerge victorious. +## Problem statement +One potential problem that could arise in the development of Hooded Havoc: Miniboss Mania is related to the PPU and communication between the STM32 and PPU. + +The PPU is responsible for rendering the graphics and displaying them on the screen, while the STM32 is responsible for processing the game logic and input from the player. However, if there is a problem with the communication between these two components, it could lead to synchronization issues and graphical glitches that could affect the player's experience. The existing hardware components available for building this project consists of: +For example, if the PPU is unable to keep up with the processing speed of the STM32, the graphics may lag or appear distorted, causing the game to become unplayable. Similarly, if there is a delay in communication between the STM32 and PPU, it could result in a mismatch between the game logic and the displayed graphics, leading to confusion for the player. -- Raspberry Pi -- Nucleo STM32 development board -- Basys3 FPGA development board -- Arduino Uno R3 +To ensure a smooth and enjoyable gaming experience, it is essential to address any potential issues with the PPU and communication between the STM32 and PPU during the development process. This may involve optimizing the code for both components, adjusting the communication protocol, or adding buffer systems to prevent lag or synchronization issues. + +# General system architecture The Raspberry Pi is by far the most powerful component out of these 4, but because one of the project requirements is that no general-purpose operating system is used, utilizing the Raspberry Pi will involve writing low-level drivers for its interfaces, which will likely cost a lot of effort. +- Raspberry Pi +- Nucleo STM32 development board +- Basys3 FPGA development board +- Arduino Uno R3 + As to not risk project failure due to hardware constraints, the decision was made to use the STM32 microcontroller and FPGA in combination, as these two are both familiar and still relatively powerful platforms. Because audio and video -- cgit v1.2.3 From 0fb8c4c52d185244898bac5745df6730a5c6ed5e Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 16 Mar 2023 17:58:20 +0100 Subject: restructure architecture document --- docs/architecture.md | 78 +++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index c880b5d..831e6e4 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,8 +1,9 @@ -# Hooded Havic: Miniboss Mania + ![intro arcade game](../assets/hh_introScreen.png) -# introduction +# Introduction + Welcome to Hooded Havoc: Miniboss Mania, an exciting 2D platformer game created by our team Joshua, Loek, Bjorn, Frenk and Niels! This game was developed using the STM32 microcontroller as the game engine and the FPGA as the Picture Processing Unit (PPU). In Hooded Havoc: Miniboss Mania, you will take on the role of a brave hero who must battle through multiple levels filled with challenging obstacles and formidable minibosses. With smooth gameplay and engaging graphics, you will feel immersed in a world of adventure and excitement. @@ -10,7 +11,9 @@ In Hooded Havoc: Miniboss Mania, you will take on the role of a brave hero who m Our use of the STM32 microcontroller and FPGA PPU allowed us to create a unique and innovative gaming experience. The STM32 provides efficient and reliable processing power, while the FPGA ensures that our graphics are rendered smoothly and accurately. So get ready to embark on a thrilling journey through Hooded Havoc: Miniboss Mania, and see how far you can make it! + ## Objective + The objective of Hooded Havoc: Miniboss Mania is to guide the hero through multiple levels, defeating minibosses and overcoming obstacles along the way. The ultimate goal is to reach the final boss and defeat them to retrieve the stolen staff. To achieve this objective, the player must use their platforming skills to jump, run, and dodge obstacles while also battling enemies and minibosses. Each level presents a unique challenge that will require the player to adapt and strategize to overcome. @@ -18,29 +21,32 @@ To achieve this objective, the player must use their platforming skills to jump, As the player progresses through the game, they will unlock new abilities and power-ups that will aid them in their journey. The player must use these abilities wisely to defeat the minibosses and ultimately save the world. So, the objective of Hooded Havoc: Miniboss Mania is not only to provide an exciting and engaging gaming experience but also to challenge players to use their skills and strategic thinking to overcome obstacles and emerge victorious. + ## Problem statement + One potential problem that could arise in the development of Hooded Havoc: Miniboss Mania is related to the PPU and communication between the STM32 and PPU. The PPU is responsible for rendering the graphics and displaying them on the screen, while the STM32 is responsible for processing the game logic and input from the player. However, if there is a problem with the communication between these two components, it could lead to synchronization issues and graphical glitches that could affect the player's experience. -The existing hardware components available for building this project consists -of: For example, if the PPU is unable to keep up with the processing speed of the STM32, the graphics may lag or appear distorted, causing the game to become unplayable. Similarly, if there is a delay in communication between the STM32 and PPU, it could result in a mismatch between the game logic and the displayed graphics, leading to confusion for the player. To ensure a smooth and enjoyable gaming experience, it is essential to address any potential issues with the PPU and communication between the STM32 and PPU during the development process. This may involve optimizing the code for both components, adjusting the communication protocol, or adding buffer systems to prevent lag or synchronization issues. # General system architecture -The Raspberry Pi is by far the most powerful component out of these 4, but -because one of the project requirements is that no general-purpose operating -system is used, utilizing the Raspberry Pi will involve writing low-level -drivers for its interfaces, which will likely cost a lot of effort. +The existing hardware components available for building this project consists +of: - Raspberry Pi - Nucleo STM32 development board - Basys3 FPGA development board - Arduino Uno R3 +The Raspberry Pi is by far the most powerful component out of these 4, but +because one of the project requirements is that no general-purpose operating +system is used, utilizing the Raspberry Pi will involve writing low-level +drivers for its interfaces, which will likely cost a lot of effort. + As to not risk project failure due to hardware constraints, the decision was made to use the STM32 microcontroller and FPGA in combination, as these two are both familiar and still relatively powerful platforms. Because audio and video @@ -59,7 +65,19 @@ show what the complete system looks like. The scope of this project only includes the components inside the area marked "game console" and the gamepad components. -# Game controllers +# STM32 software + +The game engine will be designed to support 2D games. The engine will use a state machine to manage game states and transitions between them. The state machine will be implemented using a finite state machine (FSM) design pattern. The engine will also include support for handling user input, game logic, and sound. + +FSM is a useful tool for managing game states and transitions. A game can have many different states, such as a title screen, a level selection screen, a loading screen, and various gameplay states. Each state represents a particular configuration of the game, with different sets of variables, objects, and logic + +The state machine will be designed with the following states: + +1. Initialization: The initialization state will be responsible for initializing all game-related variables and subsystems, including the FPGA-based picture processing unit. +2. Title Screen: The title screen state will display the game's title screen and wait for user input to start the game or access the options menu. +3. Options: The options state will allow the user to configure game settings, such as sound and graphics options. +4. Game Play: The game play state will be responsible for running the game logic and updating the game state. +5. Game Over: The game over state will display the game over screen and wait for user input to restart the game or return to the title screen. ## Input @@ -95,19 +113,13 @@ The buttons will be connected as follows: To implement the input in the game, the input should be checked at the start of each game cycle. In this case there are no interrupts needed. -# STM32 software +## PPU communication -The game engine will be designed to support 2D games. The engine will use a state machine to manage game states and transitions between them. The state machine will be implemented using a finite state machine (FSM) design pattern. The engine will also include support for handling user input, game logic, and sound. - -FSM is a useful tool for managing game states and transitions. A game can have many different states, such as a title screen, a level selection screen, a loading screen, and various gameplay states. Each state represents a particular configuration of the game, with different sets of variables, objects, and logic +The SPI module will be configured that sends 8 bits per cycle and at a speed of 1.0 MB/s. The STM32 Cube IDE SPI module does not include a slave select line so a pin has to configured manually to fullfill this purpose. Every data transfer consists out of 4 times 8 bits, so 32 bits in total. The first byte is the address and the other 3 bytes consist the data. -The state machine will be designed with the following states: +## SPI -1. Initialization: The initialization state will be responsible for initializing all game-related variables and subsystems, including the FPGA-based picture processing unit. -2. Title Screen: The title screen state will display the game's title screen and wait for user input to start the game or access the options menu. -3. Options: The options state will allow the user to configure game settings, such as sound and graphics options. -4. Game Play: The game play state will be responsible for running the game logic and updating the game state. -5. Game Over: The game over state will display the game over screen and wait for user input to restart the game or return to the title screen. +The FPGA uses 3 JMOD pins to receive the SPI data. The FPGA does not have a IP-Core for SPI. To receive the data the module has 3 synchronisers for the incoming SPI clock, data and slave select. The data will be read via the SPI protocol and shifted untill all 32 bits are read. # PPU @@ -403,6 +415,15 @@ Format: [custompputimings]: https://docs.google.com/spreadsheets/d/1MU6K4c4PtMR_JXIpc3I0ZJdLZNnoFO7G2P3olCz6LSc +## PPU communication + +To comunicate with the FPGA via the STM32 a protocol is needed. After [research](research.md#Input) of different possible protocols, SPI was the best option for this problem. As there is only one master and one slave, four data lines are needed at maximum. The STM32 will be the master and the FPGA will be the slave. The STM32 has a configurable SPI module that is easily configurable unlike the FPGA. Futhermore, the MISO line is not needed because the FPGA does not send any big data to the STM32. The slave select line will operate as a write enable. + +## SPI + +The FPGA will configure as a slave of the SPI protocol. The FPGA (Basys3) does not have a IP-Core that supports external SPI communication so the SPI slave has to be designed. The module requires three inputs as mentioned before in the [STM32](architecture.md#STM32) section. + + # APU The Audio Processing Unit (APU) is programmed on the FPGA, here it will produce different signals on the audio output. These signals come in a few forms, as listed below. @@ -459,22 +480,3 @@ and background layers of the PPU. This means that the global tilemap can fit up to 1024 tiles in total, each being 16x16 pixels (the example uses 4x4 tiles for illustration purposes). - -### PPU communication - -To comunicate with the FPGA via the STM32 a protocol is needed. After [research](research.md#Input) of different possible protocols, SPI was the best option for this problem. As there is only one master and one slave, four data lines are needed at maximum. The STM32 will be the master and the FPGA will be the slave. The STM32 has a configurable SPI module that is easily configurable unlike the FPGA. Futhermore, the MISO line is not needed because the FPGA does not send any big data to the STM32. The slave select line will operate as a write enable. - - - -### SPI - -The FPGA will configure as a slave of the SPI protocol. THe FPGA (Basys3) does not have a IP-Core that supports external SPI communication so the SPI slave has to be designed. The module requires three inputs as mentioned before in the [STM32](architecture.md#STM32) section. - - -### PPU communication - -The SPI module will be configured that sends 8 bits per cycle and at a speed of 1.0 MB/s. The STM32 Cube IDE SPI module does not include a slave select line so a pin has to configured manually to fullfill this purpose. Every data transfer consists out of 4 times 8 bits, so 32 bits in total. The first byte is the address and the other 3 bytes consist the data. - - -### SPI -The FPGA uses 3 JMOD pins to receive the SPI data. The FPGA does not have a IP-Core for SPI. To receive the data the module has 3 synchronisers for the incoming SPI clock, data and slave select. The data will be read via the SPI protocol and shifted untill all 32 bits are read. -- cgit v1.2.3 From 72295b9df9c0de9e585cce3f41437965eb0390cb Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Mon, 20 Mar 2023 19:11:41 +0100 Subject: demo version --- .vscode/settings.json | 4 +- src/GameLoop/shop.c | 30 ++++++++++++++ src/GameLoop/shop.h | 16 ++++++++ src/GameLoop/startingScreen.c | 32 +++++++++++++++ src/GameLoop/startingScreen.h | 14 +++++++ src/demo.c | 54 ++++++++++++++++++++++-- src/engine/bullet.c | 44 ++++++++++++++++++++ src/engine/bullet.h | 16 ++++++++ src/engine/draw_screen.c | 26 ++++++++++++ src/engine/draw_screen.h | 5 +++ src/engine/player_controller.c | 35 ++++++++++++---- src/engine/title_screen.c | 93 ++++++++++++++++++++++++++++++++++++++++++ src/engine/title_screen.h | 3 ++ src/makefile | 6 ++- src/ppusim/input.c | 1 + 15 files changed, 367 insertions(+), 12 deletions(-) create mode 100644 src/GameLoop/shop.c create mode 100644 src/GameLoop/shop.h create mode 100644 src/GameLoop/startingScreen.c create mode 100644 src/GameLoop/startingScreen.h create mode 100644 src/engine/bullet.c create mode 100644 src/engine/bullet.h create mode 100644 src/engine/title_screen.c create mode 100644 src/engine/title_screen.h diff --git a/.vscode/settings.json b/.vscode/settings.json index d027762..f4d72ed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,7 @@ } }, "cmake.configureOnOpen": false, - "files.eol": "\n" + "files.eol": "\n", + "nrf-connect.topdir": "${nrf-connect.sdk:2.1.2}", + "nrf-connect.toolchain.path": "${nrf-connect.toolchain:2.1.2}" } diff --git a/src/GameLoop/shop.c b/src/GameLoop/shop.c new file mode 100644 index 0000000..eb6bed5 --- /dev/null +++ b/src/GameLoop/shop.c @@ -0,0 +1,30 @@ +#include "shop.h" + + +bool hh_show_Shop(){ + static hh_e_ShopStates hh_e_Shop = hh_e_STATE_SHOW; + + switch (hh_e_Shop) + { + case hh_e_STATE_SHOW: + //hh_clear_screen(); + + //hh_setup_shop(); + hh_e_Shop = hh_e_STATE_Input; + return false; + break; + case hh_e_STATE_Input: + if(g_hh_controller_p1.button_primary){ + hh_e_Shop = hh_e_STATE_END; + } + break; + case hh_e_STATE_END: + hh_e_Shop = hh_e_STATE_SHOW; + return true; + break; + default: + hh_e_Shop = hh_e_STATE_SHOW; + break; + } + return false; +} diff --git a/src/GameLoop/shop.h b/src/GameLoop/shop.h new file mode 100644 index 0000000..4014f58 --- /dev/null +++ b/src/GameLoop/shop.h @@ -0,0 +1,16 @@ +#include "input.h" +#include "engine/draw_screen.h" + + + +#include +#include + +typedef enum { + hh_e_STATE_SHOW, + hh_e_STATE_Input, + hh_e_STATE_END +} hh_e_ShopStates; + + +bool hh_show_Shop(); diff --git a/src/GameLoop/startingScreen.c b/src/GameLoop/startingScreen.c new file mode 100644 index 0000000..4fc5af9 --- /dev/null +++ b/src/GameLoop/startingScreen.c @@ -0,0 +1,32 @@ +#include "startingScreen.h" +#include "input.h" +#include "engine/title_screen.h" +#include "engine/draw_screen.h" +// #include "engine/player_controller.h" + +bool hh_show_startingScreen(){ + static hh_e_screenStates hh_e_startingScreen = hh_e_STATE_SHOW; + + switch (hh_e_startingScreen) + { + case hh_e_STATE_SHOW: + hh_clear_screen(); + hh_init_title_screen(); + hh_e_startingScreen = hh_e_STATE_Input; + return false; + break; + case hh_e_STATE_Input: + if(g_hh_controller_p1.button_primary){ + hh_e_startingScreen = hh_e_STATE_END; + } + break; + case hh_e_STATE_END: + hh_e_startingScreen = hh_e_STATE_SHOW; + return true; + break; + default: + hh_e_startingScreen = hh_e_STATE_SHOW; + break; + } + return false; +} diff --git a/src/GameLoop/startingScreen.h b/src/GameLoop/startingScreen.h new file mode 100644 index 0000000..f51cc66 --- /dev/null +++ b/src/GameLoop/startingScreen.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +typedef enum { + hh_e_STATE_SHOW, + hh_e_STATE_Input, + hh_e_STATE_END +} hh_e_screenStates; + + +bool hh_show_startingScreen(); + diff --git a/src/demo.c b/src/demo.c index d4d1bf7..22ee8b7 100644 --- a/src/demo.c +++ b/src/demo.c @@ -11,8 +11,18 @@ #include "engine/draw_screen.h" #include "engine/player_controller.h" #include "engine/sprite_controller.h" +#include "GameLoop/startingScreen.h" +typedef enum { + hh_e_STATE_startingScreen, + hh_e_STATE_Shop, + hh_e_STATE_Gameplay, + hh_e_STATE_GameOver, + hh_e_STATE_HighScore +} hh_e_GameState; +hh_e_GameState hh_gameStates; + uint16_t g_hh_pos_x = 1000; // 0b0000 0001 0011 0110 @@ -37,7 +47,7 @@ hh_entity hh_g_player, hh_g_player_new; void hh_demo_setup() { hh_setup_palettes(); - hh_setup_screen(); + // hh_setup_screen(); } @@ -45,8 +55,46 @@ void hh_demo_setup() { void hh_demo_loop(unsigned long frame) { - hh_player_actions(); - + switch (hh_gameStates) + { + case hh_e_STATE_startingScreen: + bool ret = hh_show_startingScreen(); + if(ret){ + hh_gameStates = hh_e_STATE_Shop; + } + break; + case hh_e_STATE_Shop: + // TODO: + // if(hh_show_Shop()){ + hh_clear_screen(); + hh_clear_sprite(); + hh_setup_screen(); + hh_clear_sprite(); + hh_gameStates = hh_e_STATE_Gameplay; + // } + // function: new level is chosen goto level + break; + case hh_e_STATE_Gameplay: + hh_player_actions(); + + // TODO: + // function: if level complete goto shop + // function: if player is dead goto game over + break; + case hh_e_STATE_GameOver: + // TODO: + // function: show game over screen + // function: after time goto high score + break; + case hh_e_STATE_HighScore: + // TODO: + // fucntion: show all previously scored points + // function: button pressed goto starting screen + break; + default: + hh_gameStates = hh_e_STATE_startingScreen; + break; + } } // void sendData(uint8_t address, uint16_t data) { diff --git a/src/engine/bullet.c b/src/engine/bullet.c new file mode 100644 index 0000000..5aa9e51 --- /dev/null +++ b/src/engine/bullet.c @@ -0,0 +1,44 @@ +#include "bullet.h" +#include "engine/sprite_controller.h" + + +void shootBullet(vec2 playerPos, Bullet* bullet){ + // Set bullet's x and y coordinates to player's coordinates + bullet->x = playerPos.x; + bullet->y = playerPos.y; + // Set bullet's velocity to a fixed value + bullet->velocity = 1; + // Set bullet's status to active + bullet->isActive = true; +} +void updateBullet(Bullet* bullet, int deltaTime){ + // Only update bullet if it is active + static int latestLocationBullet = 0; + if (bullet->isActive) { + // Move bullet based on velocity and deltaTime + bullet->x += bullet->velocity * deltaTime; + drawBullet(bullet); + // Check if bullet has moved 16 pixels + if (bullet->x - latestLocationBullet > 32) { + // Set bullet's status to inactive + bullet->isActive = false; + drawBullet(&(Bullet){.x = -16,.y = -16. }); + } + } + else{ + latestLocationBullet = bullet->x; + } +} +void drawBullet(Bullet* bullet){ + + + hh_ppu_update_foreground(10, (hh_s_ppu_loc_fam_entry) + { + .position_x = bullet->x, + .position_y = bullet->y, + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = 7, + .tilemap_index = 84, // change tilemap to the correct foreground index; + }); +} diff --git a/src/engine/bullet.h b/src/engine/bullet.h new file mode 100644 index 0000000..ad67d84 --- /dev/null +++ b/src/engine/bullet.h @@ -0,0 +1,16 @@ +#pragma once +#include "player_controller.h" + +typedef struct { + int x; + int y; + int velocity; + int isActive; + int hit; +} Bullet; + + +//Bullet* createBullet(float x, float y, float velocity, float direction); +void shootBullet(vec2 playerPos, Bullet* bullet); +void updateBullet(Bullet* bullet, int deltaTime); +void drawBullet(Bullet* bullet); diff --git a/src/engine/draw_screen.c b/src/engine/draw_screen.c index c4f3389..fed2cfa 100644 --- a/src/engine/draw_screen.c +++ b/src/engine/draw_screen.c @@ -60,3 +60,29 @@ void hh_setup_screen(){ } free(tile); } +void hh_clear_screen(){ + // (HH_PPU_SCREEN_HEIGHT*HH_PPU_SCREEN_WIDTH)/(HH_PPU_SPRITE_HEIGHT*HH_PPU_SPRITE_WIDTH) + for (int i = 0; i < HH_PPU_BG_CANVAS_TILES_H*HH_PPU_BG_CANVAS_TILES_V; i++) { + hh_s_ppu_loc_bam_entry temp = { + .vertical_flip=false,.horizontal_flip = false, + .palette_index = 3,.tilemap_index = 0 + }; + hh_ppu_update_background(i,temp); + hh_ppu_update_color(3,0,(hh_ppu_rgb_color_t){0x0,0x0,0x0}); + } + hh_ppu_update_aux((hh_s_ppu_loc_aux){ + .bg_shift_x = 0, + .bg_shift_y = 0, + .fg_fetch = 0, + .sysreset = 0, + }); +} + +void hh_clear_sprite(){ + for (int i = 0; i < HH_PPU_FG_SPRITE_COUNT; i++) { + hh_ppu_update_foreground(i,(hh_s_ppu_loc_fam_entry){ + .position_x = -16, + .position_y = -16, + }); + } +} diff --git a/src/engine/draw_screen.h b/src/engine/draw_screen.h index b181108..d3abca6 100644 --- a/src/engine/draw_screen.h +++ b/src/engine/draw_screen.h @@ -19,3 +19,8 @@ uint8_t hh_world_to_tile(vec2 pos); void hh_draw_screen(vec2 viewport); /** @brief send data to BAM memory from binary level */ void hh_setup_screen(); + +/** @brief send black screen to background memory */ +void hh_clear_screen(); +/** @brief clears all sprite data */ +void hh_clear_sprite(); diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c index d351bee..647b00c 100644 --- a/src/engine/player_controller.c +++ b/src/engine/player_controller.c @@ -6,7 +6,11 @@ #include "input.h" +#include "engine/bullet.h" void hh_player_actions() { + static Bullet bullet ={ + .isActive=false, + }; static hh_entity player={ .hp = 4, .speed = 6, @@ -17,13 +21,13 @@ void hh_player_actions() { .vel = (vec2){0,0}, .vec = (vec2){0,0}, .render = { - .frame0 = 20, - .palette = 7, + .frame0 = 80, + .palette = 3, .fam = (hh_s_ppu_loc_fam_entry){ .horizontal_flip = false, .vertical_flip = false, - .palette_index = 7, - .tilemap_index = 2, + .palette_index = 2, + .tilemap_index = 60, } } }, player_new = {0}; @@ -114,6 +118,10 @@ void hh_player_actions() { player.vel.y += 1; //gravity } + if(g_hh_controller_p1.button_secondary==true){ + shootBullet(player.pos,&bullet); + } + updateBullet(&bullet,5); @@ -202,7 +210,7 @@ void hh_player_actions() { // hh_solve_collision(tiles[i].pos, &player); // } // } - + player = hh_background_collision ( player, player_new); //player = player_new; @@ -221,9 +229,22 @@ void hh_player_actions() { player.render.fam.tilemap_index = 2;//TODO: these two lines should be redundant player.render.fam.palette_index = 7; - hh_ppu_update_foreground(0, player.render.fam); + // hh_ppu_update_foreground(0, player.render.fam); + + for (int i = 0; i < 4; i++) + { + hh_s_ppu_loc_fam_entry temp = player.render.fam; + temp.position_x = player.render.fam.position_x+(!(player.vel.x>0)?-1:1)*(i%2?8:-8); + temp.position_y = player.render.fam.position_y+(i>1?0:-16); + temp.tilemap_index = player.render.frame0 + i; + temp.palette_index = player.render.palette; + temp.horizontal_flip = !(player.vel.x>0); + hh_ppu_update_foreground(i,temp); + } + + - hh_ppu_update_foreground(1, enemy.render.fam); + hh_ppu_update_foreground(4, enemy.render.fam); } diff --git a/src/engine/title_screen.c b/src/engine/title_screen.c new file mode 100644 index 0000000..9c7ed48 --- /dev/null +++ b/src/engine/title_screen.c @@ -0,0 +1,93 @@ +#include "ppu/ppu.h" +#include "ppu/types.h" +#include "ppu/consts.h" + + +#include "engine/draw_screen.h" +#include "engine/entity.h" + +void hh_init_title_screen(){ + + // hh_clear_screen(); + + //send data + uint8_t idx = 0; + const uint8_t tilemap_offset = 59; + 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; + + const uint8_t arr[4][4] = { + {0,1,1,0}, + {2,3,3,2}, + {4,0,0,4}, + {5,6,6,5}, + }; + int val, counter =0; + hh_ppu_update_color(5, 0, (hh_ppu_rgb_color_t) {0x1, 0x1, 0x1}); + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + val = arr[i][j]; + + hh_s_ppu_loc_bam_entry temp = { + .vertical_flip=false, .horizontal_flip = ((j % 4 < 2) ? false : true), + .palette_index = (counter == 9 || counter == 10? 5:3), .tilemap_index = (val > 0 ? (tilemap_offset + val) : 0) + }; + + int vert_pos = tiles_h*i; + int x_pos = j; + idx = vert_offset + vert_pos + x_pos + vp_h/2-2; + + hh_ppu_update_background(idx,temp); + counter++; + } + + } + + + const uint8_t letters_offset = 66; + const int _size_hooded = 7, _size_v = 2; + + // char* hh = "hooded"; + int hooded_lookup[7][2]={ + {0,1},{0,2},//H + {3,4},{3,4},//oo + {5,6},{13,9},//de + {5,6}//d + }; + + counter = 8; + for (int i = 0; i < _size_hooded; i++) { + for (int vert = 1; vert <= _size_v; vert++) { + //TODO: move 'H' a few pixels to the right for a more cohesive font spacing + hh_ppu_update_foreground(counter++, (hh_s_ppu_loc_fam_entry) { + .vertical_flip = false, .horizontal_flip = false, + .palette_index = 6, .tilemap_index = letters_offset + hooded_lookup[i][vert-1], + .position_x = (16*i + 64+48), .position_y = (16*(vert > 1 ? 0:1)*-1 + 64+8+16 +(i==2 || i==3 ? 6:0)) + }); + } + } + + + hh_ppu_update_color(5, 1, (hh_ppu_rgb_color_t) {0xa, 0x3, 0x3}); + hh_ppu_update_color(5, 2, (hh_ppu_rgb_color_t) {0xc, 0x5, 0x3}); + + const int _size_havoc = 6; + int lookup_havoc[6][2]={ + {0,1},{0,2},//H + {13,10},{7,8},//av + {13,11},{13,12}//oc + }; + + counter = 8 + (_size_hooded * _size_v); + for (int i = 0; i < _size_havoc; i++) { + for (int vert = 1; vert <= _size_v; vert++) { + //TODO: move 'H' a few pixels to the right for a more cohesive font spacing + hh_ppu_update_foreground(counter++, (hh_s_ppu_loc_fam_entry) { + .vertical_flip = false, .horizontal_flip = (i > 4 && vert==0 ? 1:0), + .palette_index = 5, .tilemap_index = letters_offset + lookup_havoc[i][vert-1], + .position_x = (16*i +64+32+8), .position_y = (16*(vert > 1 ? 0:1)*-1 + 64+8+48) + }); + } + } +} diff --git a/src/engine/title_screen.h b/src/engine/title_screen.h new file mode 100644 index 0000000..b5eda63 --- /dev/null +++ b/src/engine/title_screen.h @@ -0,0 +1,3 @@ +#pragma once + +void hh_init_title_screen(); diff --git a/src/makefile b/src/makefile index d7d9087..cd248e2 100644 --- a/src/makefile +++ b/src/makefile @@ -37,7 +37,11 @@ LOCAL_SRCS += main.c \ engine/draw_screen.c \ engine/camera.c \ engine/maths.c \ - engine/entity.c + engine/entity.c \ + engine/bullet.c \ + engine/title_screen.c \ + GameLoop/shop.c \ + GameLoop/startingScreen.c CFLAGS += $(SHARED_FLAGS) LFLAGS += $(SHARED_FLAGS) diff --git a/src/ppusim/input.c b/src/ppusim/input.c index 5323fb1..4bc7018 100644 --- a/src/ppusim/input.c +++ b/src/ppusim/input.c @@ -13,4 +13,5 @@ void hh_input_read() { g_hh_controller_p1.dpad_left = kb[SDL_SCANCODE_A]; g_hh_controller_p1.dpad_right = kb[SDL_SCANCODE_D]; g_hh_controller_p1.button_primary = kb[SDL_SCANCODE_SPACE]; + g_hh_controller_p1.button_secondary = kb[SDL_SCANCODE_R]; } -- cgit v1.2.3