aboutsummaryrefslogtreecommitdiff
path: root/src/engine/sprite_controller.h
blob: 93a2aaf3af8e65b524e258de99e719a8945d4b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#pragma once
#include <stdint.h>

#include "ppu/types.h"

#include "static/tilemap.h"

// handles sprites

// Bg sprites

// Fg or entity sprites

//TODO: pack data inside of sprite_palette LUT
//HH_PPU_PALETTE_COUNT

#define HH_PAL_IDX_SKY 0
#define HH_PAL_IDX_BRICK 1
#define HH_PAL_IDX_SLIME 2
#define HH_PAL_IDX_HUD 2
#define HH_PAL_IDX_BULLET 3
#define HH_PAL_IDX_GOZER 3
#define HH_PAL_IDX_TITLE_SCREEN_ICON 3
#define HH_PAL_IDX_CRATE 4
#define HH_PAL_IDX_SHOP 5
#define HH_PAL_IDX_FONT 6
#define HH_PAL_IDX_DEV 7

const static uint8_t hh_g_sprite_palette[HH_TM_GROUPS] = {
	HH_PAL_IDX_SKY,
	HH_PAL_IDX_BRICK,
	HH_PAL_IDX_CRATE,
	HH_PAL_IDX_SHOP,
	// HH_PAL_IDX_SHOP,
	HH_PAL_IDX_TITLE_SCREEN_ICON,
	HH_PAL_IDX_TITLE_SCREEN_ICON,
	HH_PAL_IDX_HUD,
	HH_PAL_IDX_HUD,
	HH_PAL_IDX_BULLET,
	HH_PAL_IDX_GOZER,
	HH_PAL_IDX_SLIME,
	HH_PAL_IDX_SLIME,
	HH_PAL_IDX_DEV,
	HH_PAL_IDX_FONT

};


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
		{0x0,0x0,0x1},//25
		{0x1,0x1,0x1},//26
		{0x1,0x1,0x2},//27
		{0x2,0x2,0x3},//28
		{0x3,0x4,0x5},//29
		{0x5,0x1,0x7},
		{0xd,0x8,0xa}},//24
	{//slime
		{0x1,0x2,0x3},
		{0x1,0x3,0x2},
		{0x4,0x8,0x3},
		{0x7,0xa,0x4},//hp HUD
		{0xa,0xc,0x5},
		{0xa,0x3,0x3},
		{0x0,0x0,0x1},
		{0xe,0xe,0xe}},
	{//player //TODO: use one less color && update player indexed sprites
		{0x0,0x0,0x0},
		{0x1,0x1,0x1},
		{0x4,0x2,0x5},
		{0x7,0x3,0x7},
		{0xe,0xe,0xe}, 
		{0x7,0x2,0x3}, //elemental
		{0xc,0x5,0x3},
		{0xe,0xc,0x7}},
	{//crates
		{0x5,0x7,0x7},
		{0x3,0x1,0x2},
		{0x6,0x2,0x2},
		{0x7,0x4,0x4},
		{0xa,0x7,0x5},
		{0x0,0x0,0x0},
		{0x0,0x0,0x0},
		{0x0,0x0,0x0}},
	{//shop
		// {0x1,0x2,0x3},
		// {0x0,0x0,0x1},
		// {0x0,0x0,0x0},
		// {0x0,0x0,0x0},
		// {0x0,0x0,0x0},
		// {0x0,0x0,0x0},
		// {0x0,0x0,0x0},
		// {0x0,0x0,0x0}},
		{0x1, 0x2, 0x3},//0
		{0x0, 0x0, 0x1},//1
		{0x6, 0x2, 0x2},//2
		{0x7, 0x4, 0x4},//3
		{0xc, 0x9, 0x7},//4
		{0xd, 0xb, 0x9},//5
		{0x3, 0x4, 0x5},//6
		{0x8, 0x9, 0x9}},
	{//white
		{0x1,0x2,0x3},
		{0xf,0xf,0xf},
		{0xf,0xf,0xf},
		{0xf,0xf,0xf},
		{0xf,0xf,0xf},
		{0xf,0xf,0xf},
		{0xf,0xf,0xf},
		{0xf,0xf,0xf}},
	{//Dev palette (7)
		{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();

//TODO: UPDATE THIS FUNCTION
/** @brief return palette index that belongs to tilemap index */
uint8_t hh_get_palette(uint8_t tile_idx);

//TODO: UPDATE THIS FUNCTION
bool hh_colidable(uint8_t tile_idx);