aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/TODO/combat.h (renamed from src/stm32/TODO/hh_combat.h)0
-rw-r--r--src/engine/TODO/draw_screen.h (renamed from src/stm32/TODO/hh_draw_screen.h)0
-rw-r--r--src/engine/TODO/entity.c (renamed from src/stm32/TODO/hh_entity.c)0
-rw-r--r--src/engine/TODO/entity.h (renamed from src/stm32/TODO/hh_entity.h)0
-rw-r--r--src/engine/TODO/level.h (renamed from src/stm32/TODO/hh_level.h)3
-rw-r--r--src/engine/TODO/maths.h (renamed from src/stm32/TODO/maths.h)7
-rw-r--r--src/engine/TODO/player_controller.h (renamed from src/stm32/TODO/player_controller.h)0
-rw-r--r--src/engine/TODO/sprite_controller.h (renamed from src/stm32/TODO/sprite_controller.h)0
-rw-r--r--src/entity.h1
-rw-r--r--src/input.h1
-rw-r--r--src/ppusim/sim.c28
-rw-r--r--src/ppusim/sim.h3
-rw-r--r--src/stm32/TODO/hh_rand.h1
-rw-r--r--src/stm32/TODO/maths.c10
-rw-r--r--src/stm32/main.c3
15 files changed, 41 insertions, 16 deletions
diff --git a/src/stm32/TODO/hh_combat.h b/src/engine/TODO/combat.h
index 16c41f5..16c41f5 100644
--- a/src/stm32/TODO/hh_combat.h
+++ b/src/engine/TODO/combat.h
diff --git a/src/stm32/TODO/hh_draw_screen.h b/src/engine/TODO/draw_screen.h
index f5d7507..f5d7507 100644
--- a/src/stm32/TODO/hh_draw_screen.h
+++ b/src/engine/TODO/draw_screen.h
diff --git a/src/stm32/TODO/hh_entity.c b/src/engine/TODO/entity.c
index fa550d5..fa550d5 100644
--- a/src/stm32/TODO/hh_entity.c
+++ b/src/engine/TODO/entity.c
diff --git a/src/stm32/TODO/hh_entity.h b/src/engine/TODO/entity.h
index fdbeb8a..fdbeb8a 100644
--- a/src/stm32/TODO/hh_entity.h
+++ b/src/engine/TODO/entity.h
diff --git a/src/stm32/TODO/hh_level.h b/src/engine/TODO/level.h
index 43b19a3..09f77e7 100644
--- a/src/stm32/TODO/hh_level.h
+++ b/src/engine/TODO/level.h
@@ -1 +1,4 @@
//deal with loading/saving the correct level
+
+/** @brief */
+void hh_map_load();
diff --git a/src/stm32/TODO/maths.h b/src/engine/TODO/maths.h
index 0889c47..c7f1b44 100644
--- a/src/stm32/TODO/maths.h
+++ b/src/engine/TODO/maths.h
@@ -1,15 +1,16 @@
#pragma once
-
+#include <stdint.h>
// #include <math.h>
typedef struct {
- u_int32_t x,y;
+ uint32_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))
+//fixed point at decimal 7lsb (world positions in pixels (with fixed decimal point))
+#define HH_MATH_FIXED_POINT 7
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
diff --git a/src/stm32/TODO/player_controller.h b/src/engine/TODO/player_controller.h
index 1e9b86c..1e9b86c 100644
--- a/src/stm32/TODO/player_controller.h
+++ b/src/engine/TODO/player_controller.h
diff --git a/src/stm32/TODO/sprite_controller.h b/src/engine/TODO/sprite_controller.h
index c1fadff..c1fadff 100644
--- a/src/stm32/TODO/sprite_controller.h
+++ b/src/engine/TODO/sprite_controller.h
diff --git a/src/entity.h b/src/entity.h
index 20cbf42..181182b 100644
--- a/src/entity.h
+++ b/src/entity.h
@@ -12,4 +12,3 @@ typedef struct {
int8_t speed; //10 default L/R MODifier
bool in_air;
} hh_s_entity_player;
-
diff --git a/src/input.h b/src/input.h
index adacba2..90f0c61 100644
--- a/src/input.h
+++ b/src/input.h
@@ -19,4 +19,3 @@ extern hh_s_gamepad g_hh_controller_p2;
/** @brief update g_hh_controller_p1 and 2 by reading buttons */
void hh_input_read();
-
diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c
index 449b78d..1fceb82 100644
--- a/src/ppusim/sim.c
+++ b/src/ppusim/sim.c
@@ -1,9 +1,12 @@
#include <SDL2/SDL.h>
#include <stdbool.h>
#include <stdlib.h>
+#include <stdio.h>
#include "main.h"
#include "ppu/ppu.h"
+#include "ppu/consts.h"
+#include "ppu/internals.h"
#include "ppusim/mem.h"
#include "ppusim/sim.h"
#include "ppusim/work.h"
@@ -22,6 +25,31 @@ void hh_ppu_init() {
g_hh_ppusim_vram = malloc(sizeof(hh_ppu_data_t) * 0xffff);
memset(g_hh_ppusim_vram, 0x0000, 0xffff);
+ hh_ppu_load_tilemap();
+}
+
+void hh_ppu_load_tilemap() {
+ char* filename = "tiles.bin";
+ FILE* fp = fopen(filename,"rb");
+ if (!fp){
+ return;//error
+ }
+
+ fseek(fp, 0, SEEK_END);//goto EOF
+ 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[HH_PPU_VRAM_TMM_SPRITE_SIZE];
+
+ 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;
+ hh_ppu_vram_write(sprite);
+ free(sprite.data);
+ }
+ fclose(fp);
}
void hh_ppu_deinit() {
diff --git a/src/ppusim/sim.h b/src/ppusim/sim.h
index 73f4b23..4d1d718 100644
--- a/src/ppusim/sim.h
+++ b/src/ppusim/sim.h
@@ -4,3 +4,6 @@
#define HH_PPUSIM_UPSCALE_FACTOR 3
/** @brief max framerate for PPUSIM */
#define HH_PPUSIM_FRAMERATE 60
+
+/** @brief pump tilemap from rom to ppu ram */
+void hh_ppu_load_tilemap(); //ppu sim?
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/main.c b/src/stm32/main.c
index 735b378..d381d35 100644
--- a/src/stm32/main.c
+++ b/src/stm32/main.c
@@ -1,4 +1,7 @@
#include "main.h"
+#include "ppu/ppu.h"
+
+void hh_ppu_load_tilemap() {}
void hh_loop() {
while(g_hh_run);