Skip to content

Commit 2ce558a

Browse files
committed
now using RLE transparent sprites
1 parent 54bc60d commit 2ce558a

File tree

15 files changed

+48
-43
lines changed

15 files changed

+48
-43
lines changed

src/collide.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void collide_balls(ball_data* ball1, ball_data* ball2) {
2929

3030
}
3131

32-
void check_pockets(ball_data* ball, bool* should_change_turn, bool is_player_1_turn, gfx_sprite_t** player_1_type, int* winning_player,
32+
void check_pockets(ball_data* ball, bool* should_change_turn, bool is_player_1_turn, gfx_rletsprite_t** player_1_type, int* winning_player,
3333
int* num_solids, int* num_stripes, int picked_pocket, bool win_attempt) {
3434

3535
static const int pocket_x[] = {14, LCD_WIDTH / 2, LCD_WIDTH - 14, 14, LCD_WIDTH / 2, LCD_WIDTH - 14};

src/collide.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extern "C" {
1616
#endif
1717

1818
typedef struct ball_data {
19-
gfx_sprite_t* sprite;
19+
gfx_rletsprite_t* sprite;
2020
bool collided;
2121
bool pocketed;
2222
float x;
@@ -33,7 +33,7 @@ typedef struct cue_data {
3333
void collide_balls(ball_data* ball1, ball_data* ball2);
3434
void collide_walls(ball_data* ball);
3535

36-
void check_pockets(ball_data* ball, bool* next_turn, bool is_player_1_turn, gfx_sprite_t** player_1_type, int* winning_player,
36+
void check_pockets(ball_data* ball, bool* next_turn, bool is_player_1_turn, gfx_rletsprite_t** player_1_type, int* winning_player,
3737
int* num_solids, int* num_stripes, int picked_pocket, bool win_attempt);
3838

3939
float time_of_collision(ball_data *ball1, ball_data *ball2);

src/draw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ float closest_pos(float x, float y, float o_x, float o_y, float min_distance, fl
9595

9696
}
9797

98-
void draw_players(gfx_sprite_t* player_1_type, bool is_player_1_turn) {
98+
void draw_players(gfx_rletsprite_t* player_1_type, bool is_player_1_turn) {
9999
gfx_SetColor(3);
100100
gfx_SetTextFGColor(3);
101101
gfx_PrintStringXY("Player 1", 8, TABLE_HEIGHT + 20);
102102
gfx_PrintStringXY("Player 2", LCD_WIDTH - 60, TABLE_HEIGHT + 20);
103103

104104
if (player_1_type != NULL) {
105-
gfx_TransparentSprite_NoClip(player_1_type, 66, TABLE_HEIGHT + 20);
106-
gfx_TransparentSprite_NoClip((player_1_type == solid) ? stripe : solid, LCD_WIDTH - 72, TABLE_HEIGHT + 20);
105+
gfx_RLETSprite_NoClip(player_1_type, 66, TABLE_HEIGHT + 20);
106+
gfx_RLETSprite_NoClip((player_1_type == solid) ? stripe : solid, LCD_WIDTH - 72, TABLE_HEIGHT + 20);
107107
}
108108

109109
if (is_player_1_turn)

src/draw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ float closest_pos(float x, float y, float o_x, float o_y, float min_distance, fl
1616

1717
void draw_setup(ball_data balls[16], cue_data* queue);
1818

19-
void draw_players(gfx_sprite_t* player_1_type, bool is_player_1_turn);
19+
void draw_players(gfx_rletsprite_t* player_1_type, bool is_player_1_turn);
2020

2121
void draw_winning(int winning_player);
2222

src/gfx/convimg.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ palettes:
1111
images: automatic
1212

1313
converts:
14-
15-
- name: sprites
14+
- name: rlet_sprites
15+
style: rlet
1616
palette: global_palette
1717
transparent-color-index: 0
1818
images:
19-
- table_l
20-
- table_tl
2119
- eightball
2220
- stripe
2321
- solid
2422
- qball
2523

26-
24+
- name: sprites
25+
palette: global_palette
26+
transparent-color-index: 0
27+
images:
28+
- table_l
29+
- table_tl
2730

2831
outputs:
2932
- type: c
@@ -32,3 +35,4 @@ outputs:
3235
- global_palette
3336
converts:
3437
- sprites
38+
- rlet_sprites

src/gfx/eightball.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
unsigned char eightball_data[66] =
1+
unsigned char eightball_data[74] =
22
{
3-
0x08,0x08,0x00,0x00,0x0b,0x0b,0x0b,0x0b,0x00,0x00,0x00,0x0b,0x08,0x08,0x08,0x08,0x0b,0x00,0x0b,0x08,0x14,0x14,0x08,0x08,0x08,0x0b,0x0b,0x08,0x14,0x08,0x14,0x08,
4-
0x08,0x0b,0x0b,0x08,0x08,0x14,0x08,0x14,0x08,0x0b,0x0b,0x08,0x08,0x08,0x14,0x14,0x08,0x0b,0x00,0x0b,0x08,0x08,0x08,0x08,0x0b,0x00,0x00,0x00,0x0b,0x0b,0x0b,0x0b,
5-
0x00,0x00
3+
0x08,0x08,0x02,0x04,0x0b,0x0b,0x0b,0x0b,0x02,0x01,0x06,0x0b,0x08,0x08,0x08,0x08,0x0b,0x01,0x00,0x08,0x0b,0x08,0x14,0x14,0x08,0x08,0x08,0x0b,0x00,0x08,0x0b,0x08,
4+
0x14,0x08,0x14,0x08,0x08,0x0b,0x00,0x08,0x0b,0x08,0x08,0x14,0x08,0x14,0x08,0x0b,0x00,0x08,0x0b,0x08,0x08,0x08,0x14,0x14,0x08,0x0b,0x01,0x06,0x0b,0x08,0x08,0x08,
5+
0x08,0x0b,0x01,0x02,0x04,0x0b,0x0b,0x0b,0x0b,0x02
66
};

src/gfx/eightball.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ extern "C" {
77

88
#define eightball_width 8
99
#define eightball_height 8
10-
#define eightball_size 66
11-
#define eightball ((gfx_sprite_t*)eightball_data)
12-
extern unsigned char eightball_data[66];
10+
#define eightball_size 74
11+
#define eightball ((gfx_rletsprite_t*)eightball_data)
12+
extern unsigned char eightball_data[74];
1313

1414
#ifdef __cplusplus
1515
}

src/gfx/gfx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extern "C" {
99
#define sprites_palette_offset 0
1010
#include "table_l.h"
1111
#include "table_tl.h"
12+
#define rlet_sprites_palette_offset 0
1213
#include "eightball.h"
1314
#include "stripe.h"
1415
#include "solid.h"

src/gfx/qball.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
unsigned char qball_data[66] =
1+
unsigned char qball_data[74] =
22
{
3-
0x08,0x08,0x00,0x00,0x12,0x12,0x12,0x12,0x00,0x00,0x00,0x12,0x14,0x14,0x14,0x14,0x12,0x00,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x12,0x12,0x14,0x14,0x14,0x14,0x14,
4-
0x14,0x12,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x12,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x12,0x00,0x12,0x14,0x14,0x14,0x14,0x12,0x00,0x00,0x00,0x12,0x12,0x12,0x12,
5-
0x00,0x00
3+
0x08,0x08,0x02,0x04,0x12,0x12,0x12,0x12,0x02,0x01,0x06,0x12,0x14,0x14,0x14,0x14,0x12,0x01,0x00,0x08,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x12,0x00,0x08,0x12,0x14,
4+
0x14,0x14,0x14,0x14,0x14,0x12,0x00,0x08,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x12,0x00,0x08,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x12,0x01,0x06,0x12,0x14,0x14,0x14,
5+
0x14,0x12,0x01,0x02,0x04,0x12,0x12,0x12,0x12,0x02
66
};

src/gfx/qball.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ extern "C" {
77

88
#define qball_width 8
99
#define qball_height 8
10-
#define qball_size 66
11-
#define qball ((gfx_sprite_t*)qball_data)
12-
extern unsigned char qball_data[66];
10+
#define qball_size 74
11+
#define qball ((gfx_rletsprite_t*)qball_data)
12+
extern unsigned char qball_data[74];
1313

1414
#ifdef __cplusplus
1515
}

0 commit comments

Comments
 (0)