aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorlamp2023-03-05 21:25:03 +0000
committerlamp2023-03-05 21:25:03 +0000
commitb6e7e454ed6242475163dcd534051897d3c9158c (patch)
tree8e923fed21eac6190999de9f4adee76d0f75c10f /include
initmain
Diffstat (limited to 'include')
-rw-r--r--include/backgrounds/background.h32
-rw-r--r--include/backgrounds/game_over.h32
-rw-r--r--include/backgrounds/game_over_map.h30
-rw-r--r--include/backgrounds/map.h29
-rw-r--r--include/backgrounds/numerals.h34
-rw-r--r--include/defines.h23
-rw-r--r--include/metasprite.h27
-rw-r--r--include/pipe.h33
-rw-r--r--include/sprites/bird.h32
-rw-r--r--include/sprites/button.h32
-rw-r--r--include/sprites/pipe.h32
11 files changed, 336 insertions, 0 deletions
diff --git a/include/backgrounds/background.h b/include/backgrounds/background.h
new file mode 100644
index 0000000..d9385be
--- /dev/null
+++ b/include/backgrounds/background.h
@@ -0,0 +1,32 @@
+/*
+
+ EXPORT.H
+
+ Include File.
+
+ Info:
+ Form : All tiles as one unit.
+ Format : Gameboy 4 color.
+ Compression : None.
+ Counter : None.
+ Tile size : 8 x 8
+ Tiles : 0 to 8
+
+ Palette colors : None.
+ SGB Palette : None.
+ CGB Palette : None.
+
+ Convert to metatiles : No.
+
+ This file was generated by GBTD v2.2
+
+*/
+
+#pragma once
+
+/* Bank of tiles. */
+#define BG_TILE_DATABank 0
+/* Start of tile array. */
+extern const unsigned char BG_TILE_DATA[];
+
+/* End of EXPORT.H */
diff --git a/include/backgrounds/game_over.h b/include/backgrounds/game_over.h
new file mode 100644
index 0000000..19a1c1a
--- /dev/null
+++ b/include/backgrounds/game_over.h
@@ -0,0 +1,32 @@
+/*
+
+ EXPORT.H
+
+ Include File.
+
+ Info:
+ Form : All tiles as one unit.
+ Format : Gameboy 4 color.
+ Compression : None.
+ Counter : None.
+ Tile size : 8 x 8
+ Tiles : 0 to 10
+
+ Palette colors : None.
+ SGB Palette : None.
+ CGB Palette : None.
+
+ Convert to metatiles : No.
+
+ This file was generated by GBTD v2.2
+
+*/
+
+#pragma once
+
+/* Bank of tiles. */
+#define GAME_OVER_TILE_DATABank 0
+/* Start of tile array. */
+extern const unsigned char GAME_OVER_TILE_DATA[];
+
+/* End of EXPORT.H */
diff --git a/include/backgrounds/game_over_map.h b/include/backgrounds/game_over_map.h
new file mode 100644
index 0000000..6e861f8
--- /dev/null
+++ b/include/backgrounds/game_over_map.h
@@ -0,0 +1,30 @@
+/*
+
+ GAME_OVER_MAP.H
+
+ Map Include File.
+
+ Info:
+ Section :
+ Bank : 0
+ Map size : 10 x 7
+ Tile set :
+ Z:\var\home\matthew\Documents\Projects\flappy-gb\res\game_over.gbr Plane count
+ : 1 plane (8 bits) Plane order : Tiles are continues Tile offset : 0 Split
+ data : No
+
+ This file was generated by GBMB v1.8
+
+*/
+
+#pragma once
+
+#include "defines.h"
+
+#define GAME_OVER_MAPWidth 10
+#define GAME_OVER_MAPHeight 7
+#define GAME_OVER_MAPBank 0
+
+extern const unsigned char GAME_OVER_MAP[];
+
+/* End of GAME_OVER_MAP.H */
diff --git a/include/backgrounds/map.h b/include/backgrounds/map.h
new file mode 100644
index 0000000..03c1eb5
--- /dev/null
+++ b/include/backgrounds/map.h
@@ -0,0 +1,29 @@
+/*
+
+ MAP.H
+
+ Map Include File.
+
+ Info:
+ Section :
+ Bank : 0
+ Map size : 31 x 17
+ Tile set : Z:\var\home\matthew\Documents\Projects\flappy-gb\res\bg.gbr
+ Plane count : 1 plane (8 bits)
+ Plane order : Tiles are continues
+ Tile offset : 0
+ Split data : No
+
+ This file was generated by GBMB v1.8
+
+*/
+
+#pragma once
+
+#define BG_TILE_MAPWidth 32
+#define BG_TILE_MAPHeight 18
+#define BG_TILE_MAPBank 0
+
+extern const unsigned char BG_TILE_MAP[];
+
+/* End of MAP.H */
diff --git a/include/backgrounds/numerals.h b/include/backgrounds/numerals.h
new file mode 100644
index 0000000..f171edd
--- /dev/null
+++ b/include/backgrounds/numerals.h
@@ -0,0 +1,34 @@
+/*
+
+ EXPORT.H
+
+ Include File.
+
+ Info:
+ Form : All tiles as one unit.
+ Format : Gameboy 4 color.
+ Compression : None.
+ Counter : None.
+ Tile size : 8 x 8
+ Tiles : 0 to 10
+
+ Palette colors : None.
+ SGB Palette : None.
+ CGB Palette : None.
+
+ Convert to metatiles : No.
+
+ This file was generated by GBTD v2.2
+
+*/
+
+#pragma once
+#include "defines.h"
+
+/* Bank of tiles. */
+#define NUMERALS_TILE_DATABank 0
+/* Start of tile array. */
+extern const unsigned char NUMERALS_TILE_DATA[];
+extern const unsigned char NUMERALS_TILE_MAP[];
+extern const unsigned char NUMERALS_TILE_CLEAR[];
+/* End of EXPORT.H */
diff --git a/include/defines.h b/include/defines.h
new file mode 100644
index 0000000..765ecde
--- /dev/null
+++ b/include/defines.h
@@ -0,0 +1,23 @@
+#pragma once
+#include <gb/gb.h>
+
+#define TILE_SIZE 8
+#define GRAVITY_ACCELERATION 1
+#define APPLY_GRAVITY_N_FRAMES 4
+#define CYCLE_ANIMATION_N_FRAMES 8
+#define JUMP_VELOCITY -4
+#define BACKGROUND_SCROLL_SPEED 1
+#define FOREGROUND_SCROLL_SPEED 2
+#define PIPE_TILE_START 9
+#define NUMERALS_TILE_START 10
+#define BLANK_NUMERAL_TILE 20
+#define PIPE_WIDTH 24
+#define BUTTON_TILE_START 14
+#define CYCLE_BUTTON_N_FRAMES 16
+#define WINDOW_CENTERING_OFFSET 23
+#define GAME_OVER_TILE_START 21
+
+#define BIRD_WIDTH 16
+#define BIRD_HEIGHT 12
+
+typedef INT8 ScreenCoordinate;
diff --git a/include/metasprite.h b/include/metasprite.h
new file mode 100644
index 0000000..f4a15e7
--- /dev/null
+++ b/include/metasprite.h
@@ -0,0 +1,27 @@
+#pragma once
+#include <gb/gb.h>
+
+#include "defines.h"
+
+typedef struct Metasprite {
+ ScreenCoordinate x;
+ ScreenCoordinate y;
+ UINT8 width;
+ UINT8 height;
+ INT8 velocity_x;
+ INT8 velocity_y;
+ UINT8 sprite_ids[4]; // A metasprite is four sprites.
+ UINT8 tile_ids[4]; // A metasprite is four sprites.
+} Metasprite;
+
+inline void metasprite_init(Metasprite *metasprite);
+inline void metasprite_move_to(Metasprite *metasprite, ScreenCoordinate new_x,
+ ScreenCoordinate new_y);
+inline void metasprite_move_offset(Metasprite *metasprite,
+ ScreenCoordinate offset_x,
+ ScreenCoordinate offset_y);
+inline void metasprite_apply_gravity(Metasprite *metasprite);
+inline void metasprite_update_position_using_velocity(Metasprite *metasprite);
+inline void metasprite_jump(Metasprite *metasprite);
+inline void metasprite_update_tiles(Metasprite *metasprite);
+inline void metasprite_hide(Metasprite *metasprite);
diff --git a/include/pipe.h b/include/pipe.h
new file mode 100644
index 0000000..2602614
--- /dev/null
+++ b/include/pipe.h
@@ -0,0 +1,33 @@
+#pragma once
+#include <gb/gb.h>
+#include <stdbool.h>
+
+#include "defines.h"
+
+enum SPECIAL_SPRITES {
+ PIPE_TILE_TOP_LEFT,
+ PIPE_TILE_TOP_MIDDLE,
+ PIPE_TILE_TOP_RIGHT,
+ PIPE_TILE_BOTTOM_LEFT,
+ PIPE_TILE_BOTTOM_MIDDLE,
+ PIPE_TILE_BOTTOM_RIGHT,
+};
+
+enum PIPE_TILES {
+ CAP_LEFT,
+ CAP_MIDDLE,
+ MAIN_LEFT,
+ MAIN_MIDDLE,
+};
+
+typedef struct Pipe {
+ UINT8 x;
+ UINT8 height_of_gap;
+ UINT8 gap_skip;
+ UINT8 sprite_ids[36]; // 15 high, minus 3 tile gap, times 3 wide = 36
+} Pipe;
+
+inline void pipe_init(Pipe *pipe);
+inline void pipe_scroll_horizontal(Pipe *pipe, ScreenCoordinate x);
+inline void pipe_move_gap_height(Pipe *pipe, UINT8 gap_height);
+inline void pipe_hide(Pipe *pipe);
diff --git a/include/sprites/bird.h b/include/sprites/bird.h
new file mode 100644
index 0000000..1964266
--- /dev/null
+++ b/include/sprites/bird.h
@@ -0,0 +1,32 @@
+/*
+
+ BIRD.H
+
+ Include File.
+
+ Info:
+ Form : All tiles as one unit.
+ Format : Gameboy 4 color.
+ Compression : None.
+ Counter : None.
+ Tile size : 8 x 8
+ Tiles : 0 to 3
+
+ Palette colors : None.
+ SGB Palette : None.
+ CGB Palette : None.
+
+ Convert to metatiles : No.
+
+ This file was generated by GBTD v2.2
+
+*/
+#pragma once
+
+/* Bank of tiles. */
+#define TileLabelBank 0
+
+/* Start of tile array. */
+extern const unsigned char BIRD_TILE_DATA[];
+
+/* End of BIRD.H */
diff --git a/include/sprites/button.h b/include/sprites/button.h
new file mode 100644
index 0000000..74650c4
--- /dev/null
+++ b/include/sprites/button.h
@@ -0,0 +1,32 @@
+/*
+
+ EXPORT.H
+
+ Include File.
+
+ Info:
+ Form : All tiles as one unit.
+ Format : Gameboy 4 color.
+ Compression : None.
+ Counter : None.
+ Tile size : 8 x 8
+ Tiles : 0 to 7
+
+ Palette colors : None.
+ SGB Palette : None.
+ CGB Palette : None.
+
+ Convert to metatiles : No.
+
+ This file was generated by GBTD v2.2
+
+*/
+
+#pragma once
+
+/* Bank of tiles. */
+#define BUTTON_TILE_DATABank 0
+/* Start of tile array. */
+extern const unsigned char BUTTON_TILE_DATA[];
+
+/* End of EXPORT.H */
diff --git a/include/sprites/pipe.h b/include/sprites/pipe.h
new file mode 100644
index 0000000..30ea5a0
--- /dev/null
+++ b/include/sprites/pipe.h
@@ -0,0 +1,32 @@
+/*
+
+ EXPORT.H
+
+ Include File.
+
+ Info:
+ Form : All tiles as one unit.
+ Format : Gameboy 4 color.
+ Compression : None.
+ Counter : None.
+ Tile size : 8 x 8
+ Tiles : 0 to 0
+
+ Palette colors : None.
+ SGB Palette : None.
+ CGB Palette : None.
+
+ Convert to metatiles : No.
+
+ This file was generated by GBTD v2.2
+
+*/
+
+#pragma once
+
+/* Bank of tiles. */
+#define PIPE_TILE_DATABank 0
+/* Start of tile array. */
+extern const unsigned char PIPE_TILE_DATA[];
+
+/* End of EXPORT.H */