Skip to content

Commit

Permalink
Fix black square behind timer
Browse files Browse the repository at this point in the history
The black square behind the timer now has a one pixel border like the original game.
  • Loading branch information
JeffRuLz authored Nov 28, 2021
1 parent b6e3924 commit d40475f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/gfx.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef GFX_H

#define GFX_SIZE 4512
#define GFX_SIZE (4512+32)

const unsigned char GFX_DATA[GFX_SIZE] = {
0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1143,6 +1143,15 @@ const unsigned char GFX_DATA[GFX_SIZE] = {
0x00, 0x70, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
//8x7 black tile for timer backdrop
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00
};

Expand Down
10 changes: 8 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,7 @@ void room_title_draw(Room_Title* this)
}
else if (this->delay < 0) {
//rectfill
rectfill(1,1,5,1,0);
//rectfill(1,1,5,1,0);
rectfill(3,7,10,2,0);

if (room.x == 3 && room.y == 1) {
Expand All @@ -1932,6 +1932,12 @@ void room_title_draw(Room_Title* this)
}

draw_time(4+4,4+4);
//black rectangle behind timer
spr(141, 12, 8, 0, PAL_SPROVER, 0, 0);
spr(141, 20, 8, 0, PAL_SPROVER, 0, 0);
spr(141, 28, 8, 0, PAL_SPROVER, 0, 0);
spr(141, 36, 8, 0, PAL_SPROVER, 0, 0);
spr(141, 37, 8, 0, PAL_SPROVER, 0, 0);
}
}

Expand Down Expand Up @@ -2235,7 +2241,7 @@ void _draw()
pal(0,0,0);

//pal(0,5,PAL_BG);
pal(15,0,PAL_BG);
pal(15,0,PAL_BG | PAL_SPROVER);

//-- credits
if (is_title()) {
Expand Down
8 changes: 8 additions & 0 deletions src/pico8.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ void pal(u8 c0, u8 c1, u8 p)

if (p == 0 || p & PAL_TEXT)
SPRITE_PALETTE[32 + i] = palette[i];

if (p == 0 || p & PAL_SPROVER)
SPRITE_PALETTE[48 + i] = palette[i];
}
}
else
Expand All @@ -84,6 +87,9 @@ void pal(u8 c0, u8 c1, u8 p)

if (p & PAL_TEXT)
SPRITE_PALETTE[32 + c0] = palette[c1];

if (p & PAL_SPROVER)
SPRITE_PALETTE[48 + c0] = palette[c1];
}
}

Expand Down Expand Up @@ -154,6 +160,8 @@ void spr(u16 n, s16 x, s16 y, u8 layer, u8 palette, bool flip_x, bool flip_y)
obj->attr2 |= ATTR2_PALETTE(1);
else if (palette & PAL_TEXT)
obj->attr2 |= ATTR2_PALETTE(2);
else if (palette & PAL_SPROVER)
obj->attr2 |= ATTR2_PALETTE(3);

//flip
if (flip_x)
Expand Down

3 comments on commit d40475f

@redthing1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When i run make i get PAL_SPROVER errors:

home/user/Dev/Lib/Archive/butano/Celeste-Classic-GBA/src/main.c: In function 'room_title_draw':
/home/user/Dev/Lib/Archive/butano/Celeste-Classic-GBA/src/main.c:1936:36: error: 'PAL_SPROVER' undeclared (first use in this function); did you mean 'PAL_SPRITES'?
 1936 |                 spr(141, 12, 8, 0, PAL_SPROVER, 0, 0);
      |                                    ^~~~~~~~~~~
      |                                    PAL_SPRITES
/home/user/Dev/Lib/Archive/butano/Celeste-Classic-GBA/src/main.c:1936:36: note: each undeclared identifier is reported only once for each function it appears in
/home/user/Dev/Lib/Archive/butano/Celeste-Classic-GBA/src/main.c: In function '_draw':
/home/user/Dev/Lib/Archive/butano/Celeste-Classic-GBA/src/main.c:2244:27: error: 'PAL_SPROVER' undeclared (first use in this function); did you mean 'PAL_SPRITES'?
 2244 |         pal(15,0,PAL_BG | PAL_SPROVER);
      |                           ^~~~~~~~~~~
      |                           PAL_SPRITES

@JeffRuLz
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PAL_SPROVER was renamed to PAL_OVERLAY. I'm not sure how I missed that. Thank you for reporting it.

@redthing1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! ☺️

Please sign in to comment.