diff options
author | UnavailableDev <69792062+UnavailableDev@users.noreply.github.com> | 2023-03-10 16:44:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-10 16:44:25 +0100 |
commit | 3c7f8d25c226510bd391c6b61e89e7f732ce3072 (patch) | |
tree | bd88048f7612af72a2ecd7643d2c4d677fb27a6a /src/stm32/TODO | |
parent | 80e2732c8f208f3f225a2a5c0e540bc50fceab5d (diff) | |
parent | 877ac831461f35d00e0e0ab7d6afbe93768fc7c6 (diff) |
Merge pull request #27 from UnavailableDev/game-engine
Game engine
Diffstat (limited to 'src/stm32/TODO')
-rw-r--r-- | src/stm32/TODO/hh_combat.h | 9 | ||||
-rw-r--r-- | src/stm32/TODO/hh_draw_screen.h | 1 | ||||
-rw-r--r-- | src/stm32/TODO/hh_entity.c | 41 | ||||
-rw-r--r-- | src/stm32/TODO/hh_entity.h | 24 | ||||
-rw-r--r-- | src/stm32/TODO/hh_level.h | 1 | ||||
-rw-r--r-- | src/stm32/TODO/hh_rand.h | 1 | ||||
-rw-r--r-- | src/stm32/TODO/maths.c | 10 | ||||
-rw-r--r-- | src/stm32/TODO/maths.h | 16 | ||||
-rw-r--r-- | src/stm32/TODO/player_controller.h | 4 | ||||
-rw-r--r-- | src/stm32/TODO/sprite_controller.h | 6 |
10 files changed, 0 insertions, 113 deletions
diff --git a/src/stm32/TODO/hh_combat.h b/src/stm32/TODO/hh_combat.h deleted file mode 100644 index 16c41f5..0000000 --- a/src/stm32/TODO/hh_combat.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "hh_entity.h" - - -// attacktypes: - -/// @brief basic attack -/// @param dmg damage number -/// @param target entity under attack (damage changes this hp value) -void hh_attack_basic( int8_t dmg, hh_entity* target ); diff --git a/src/stm32/TODO/hh_draw_screen.h b/src/stm32/TODO/hh_draw_screen.h deleted file mode 100644 index f5d7507..0000000 --- a/src/stm32/TODO/hh_draw_screen.h +++ /dev/null @@ -1 +0,0 @@ -// every function call for drawing the screen goes here. diff --git a/src/stm32/TODO/hh_entity.c b/src/stm32/TODO/hh_entity.c deleted file mode 100644 index fa550d5..0000000 --- a/src/stm32/TODO/hh_entity.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <stdbool.h> - -#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/stm32/TODO/hh_entity.h b/src/stm32/TODO/hh_entity.h deleted file mode 100644 index fdbeb8a..0000000 --- a/src/stm32/TODO/hh_entity.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include <stdint.h> - -#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/stm32/TODO/hh_level.h b/src/stm32/TODO/hh_level.h deleted file mode 100644 index 43b19a3..0000000 --- a/src/stm32/TODO/hh_level.h +++ /dev/null @@ -1 +0,0 @@ -//deal with loading/saving the correct level diff --git a/src/stm32/TODO/hh_rand.h b/src/stm32/TODO/hh_rand.h deleted file mode 100644 index ea7c1d4..0000000 --- a/src/stm32/TODO/hh_rand.h +++ /dev/null @@ -1 +0,0 @@ -// deal with Pseudo random number generation here. diff --git a/src/stm32/TODO/maths.c b/src/stm32/TODO/maths.c deleted file mode 100644 index 2f4444a..0000000 --- a/src/stm32/TODO/maths.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "maths.h" - -float clamp( float* x, float *min, float *max ){ - if (*x < *min) - return *min; - else if (*x > *max) - return *max; - else - return *x; -} diff --git a/src/stm32/TODO/maths.h b/src/stm32/TODO/maths.h deleted file mode 100644 index 0889c47..0000000 --- a/src/stm32/TODO/maths.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -// #include <math.h> - -typedef struct { - u_int32_t x,y; -} vec2; - -typedef vec2 vec_cen;//centered -typedef vec2 vec_cor;//left upper corner - -#define HH_MATH_FIXED_POINT 7 //fixed point at decimal 7lsb (world positions in pixels (with fixed decimal point)) - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) -#define CLAMP(N,LOWER,UPPER) (MIN(MAX(LOWER, N), UPPER)) diff --git a/src/stm32/TODO/player_controller.h b/src/stm32/TODO/player_controller.h deleted file mode 100644 index 1e9b86c..0000000 --- a/src/stm32/TODO/player_controller.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "maths.h" -#include "hh_entity.h" - -// inputs diff --git a/src/stm32/TODO/sprite_controller.h b/src/stm32/TODO/sprite_controller.h deleted file mode 100644 index c1fadff..0000000 --- a/src/stm32/TODO/sprite_controller.h +++ /dev/null @@ -1,6 +0,0 @@ -// handles sprites - -// Bg sprites - - -// Fg or entity sprites |