-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprites.c
192 lines (147 loc) · 5.47 KB
/
sprites.c
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#include "sprites.h"
void initialiseColourBlue(unsigned int count, struct sp1_cs *c)
{
(void)count; /* Suppress compiler warning about unused parameter */
c->attr_mask = SP1_AMASK_INK;
c->attr = INK_BLUE | BRIGHT;
}
void initialiseColourWhite(unsigned int count, struct sp1_cs *c)
{
(void)count; /* Suppress compiler warning about unused parameter */
c->attr_mask = SP1_AMASK_INK;
c->attr = INK_WHITE;
}
void initialiseColourWhiteBright(unsigned int count, struct sp1_cs *c)
{
(void)count; /* Suppress compiler warning about unused parameter */
c->attr_mask = SP1_AMASK_INK;
c->attr = INK_WHITE | BRIGHT;
}
void initialiseColourYellow(unsigned int count, struct sp1_cs *c)
{
(void)count; /* Suppress compiler warning about unused parameter */
c->attr_mask = SP1_AMASK_INK;
c->attr = INK_YELLOW | BRIGHT;
}
void initialiseColourGhostRed(unsigned int count, struct sp1_cs *c)
{
// count defines each 8x8 block in the sprite, and thus it is possible to have a
// multicolor sprite in 8x8 blocks
(void)count; /* Suppress compiler warning about unused parameter */
c->attr_mask = SP1_AMASK_INK;
c->attr = INK_RED | BRIGHT;
}
void initialiseColourGhostCyan(unsigned int count, struct sp1_cs *c)
{
// count defines each 8x8 block in the sprite, and thus it is possible to have a
// multicolor sprite in 8x8 blocks
(void)count; /* Suppress compiler warning about unused parameter */
c->attr_mask = SP1_AMASK_INK;
c->attr = INK_CYAN | BRIGHT;
}
void initialiseColourGhostMagenta(unsigned int count, struct sp1_cs *c)
{
// count defines each 8x8 block in the sprite, and thus it is possible to have a
// multicolor sprite in 8x8 blocks
(void)count; /* Suppress compiler warning about unused parameter */
c->attr_mask = SP1_AMASK_INK;
c->attr = INK_MAGENTA | BRIGHT;
}
void initialiseColourRedApple(unsigned int count, struct sp1_cs *c)
{
// count defines each 8x8 block in the sprite, and thus it is possible to have a
// multicolor sprite in 8x8 blocks
if(count == 1 || count == 4) {
c->attr = INK_RED;
} else {
c->attr = INK_RED | BRIGHT;
}
c->attr_mask = SP1_AMASK_INK;
}
void initialiseColourGreenRed(unsigned int count, struct sp1_cs *c)
{
c->attr_mask = SP1_AMASK_INK;
if(count < 2) {
c->attr = INK_GREEN;
} else {
c->attr = INK_RED;
}
if (count != 1 && count != 4) {
c->attr |= BRIGHT;
}
}
void initialiseColourGreen(unsigned int count, struct sp1_cs *c)
{
c->attr_mask = SP1_AMASK_INK;
if(count == 1 || count == 4) {
c->attr = INK_GREEN;
} else {
c->attr = INK_GREEN | BRIGHT;
}
}
void initialiseColourRedYellowWhiteCyan(unsigned int count, struct sp1_cs *c)
{
c->attr_mask = SP1_AMASK_INK;
if(count == 0) {
c->attr = INK_RED;
} else if (count == 1){
c->attr = INK_YELLOW;
} else if(count == 3) {
c->attr = INK_WHITE;
} else {
c->attr = INK_CYAN;
}
}
struct sp1_ss * add_sprite() {
struct sp1_ss * sp;
sp = sp1_CreateSpr(SP1_DRAW_LOAD1LB, SP1_TYPE_1BYTE, 3, (int)sprite_protar1, 1);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)sprite_protar2, 1);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1RB, SP1_TYPE_1BYTE, 0, 0);
sp1_IterateSprChar(sp, initialiseColourYellow);
return sp;
}
struct sp1_ss * add_dead_prota_sprite() {
struct sp1_ss * sp;
sp = sp1_CreateSpr(SP1_DRAW_XOR1LB, SP1_TYPE_1BYTE, 3, (int)sprite_protar_dead1, 1);
sp1_AddColSpr(sp, SP1_DRAW_XOR1, SP1_TYPE_1BYTE, (int)sprite_protar_dead2, 1);
sp1_AddColSpr(sp, SP1_DRAW_XOR1RB, SP1_TYPE_1BYTE, 0, 0);
sp1_IterateSprChar(sp, initialiseColourYellow);
return sp;
}
struct sp1_ss * add_ghost_sprite() {
struct sp1_ss * sp;
sp = sp1_CreateSpr(SP1_DRAW_LOAD1LB, SP1_TYPE_1BYTE, 3, (int)red_ghost1, 1);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)red_ghost2, 1);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1RB, SP1_TYPE_1BYTE, 0, 0);
return sp;
}
struct sp1_ss * add_cherry_sprite() {
struct sp1_ss * sp;
sp = sp1_CreateSpr(SP1_DRAW_LOAD1LB, SP1_TYPE_1BYTE, 3, (int)cerezas1, 1);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)cerezas2, 1);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1RB, SP1_TYPE_1BYTE, 0, 0);
sp1_IterateSprChar(sp, initialiseColourGreenRed);
return sp;
}
struct sp1_ss * add_billboard_sprite() {
struct sp1_ss * sp;
sp = sp1_CreateSpr(SP1_DRAW_LOAD1LB, SP1_TYPE_1BYTE, 2, (int)letterboxes1, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes2, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes3, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes4, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes5, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes6, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes7, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes8, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)letterboxes9, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1RB, SP1_TYPE_1BYTE, 0, 0);
return sp;
}
struct sp1_ss * add_points_sprite() {
struct sp1_ss * sp;
sp = sp1_CreateSpr(SP1_DRAW_LOAD1LB, SP1_TYPE_1BYTE, 3, (int)puntos1, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1, SP1_TYPE_1BYTE, (int)puntos2, 2);
sp1_AddColSpr(sp, SP1_DRAW_LOAD1RB, SP1_TYPE_1BYTE, 0, 0);
sp1_IterateSprChar(sp, initialiseColourWhiteBright);
return sp;
}