Skip to content

Commit 6e93809

Browse files
committed
Make it easier to change graphics. Still not completely easy but better than before.
1 parent d508205 commit 6e93809

File tree

13 files changed

+2479
-2300
lines changed

13 files changed

+2479
-2300
lines changed

datasrc/blks.c

Lines changed: 2116 additions & 2049 deletions
Large diffs are not rendered by default.

datasrc/blks.ppm

48.1 KB
Binary file not shown.

datasrc/bullet.c

Lines changed: 76 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,77 @@
11

2-
unsigned char bin_bullet[] = {
3-
0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
4-
0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
5-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
6-
0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
7-
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00,
8-
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
9-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
10-
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11-
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
12-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13-
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
14-
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
15-
0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
16-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
17-
0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
18-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
19-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
20-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
21-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
22-
0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
23-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
24-
0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
25-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
26-
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28-
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
29-
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
30-
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
31-
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
32-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff,
33-
0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
34-
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00 };
2+
/* Automatically generated by the program ppm2c version 0.6
3+
written by Peter Ekberg, peda@lysator.liu.se */
4+
5+
unsigned int bullet_nr_colors = 2;
6+
unsigned int bullet_cols = 4;
7+
unsigned int bullet_rows = 64;
8+
9+
unsigned char bullet_colors[] = {
10+
0x00, 0x00, 0x00,
11+
0xde, 0xf7, 0x08};
12+
13+
unsigned char bullet_pixels[] = {
14+
0x00, 0x01, 0x00, 0x00,
15+
0x00, 0x01, 0x00, 0x00,
16+
0x00, 0x01, 0x00, 0x00,
17+
0x00, 0x01, 0x00, 0x00,
18+
0x00, 0x00, 0x01, 0x00,
19+
0x00, 0x00, 0x01, 0x00,
20+
0x00, 0x01, 0x00, 0x00,
21+
0x00, 0x01, 0x00, 0x00,
22+
0x00, 0x00, 0x00, 0x01,
23+
0x00, 0x00, 0x01, 0x00,
24+
0x00, 0x01, 0x00, 0x00,
25+
0x00, 0x00, 0x00, 0x00,
26+
0x00, 0x00, 0x00, 0x00,
27+
0x00, 0x00, 0x01, 0x01,
28+
0x01, 0x01, 0x00, 0x00,
29+
0x00, 0x00, 0x00, 0x00,
30+
0x00, 0x00, 0x00, 0x00,
31+
0x01, 0x01, 0x01, 0x01,
32+
0x00, 0x00, 0x00, 0x00,
33+
0x00, 0x00, 0x00, 0x00,
34+
0x00, 0x00, 0x00, 0x00,
35+
0x01, 0x01, 0x00, 0x00,
36+
0x00, 0x00, 0x01, 0x01,
37+
0x00, 0x00, 0x00, 0x00,
38+
0x01, 0x00, 0x00, 0x00,
39+
0x00, 0x01, 0x00, 0x00,
40+
0x00, 0x00, 0x01, 0x00,
41+
0x00, 0x00, 0x00, 0x00,
42+
0x00, 0x01, 0x00, 0x00,
43+
0x00, 0x01, 0x00, 0x00,
44+
0x00, 0x00, 0x01, 0x00,
45+
0x00, 0x00, 0x01, 0x00,
46+
0x00, 0x00, 0x01, 0x00,
47+
0x00, 0x00, 0x01, 0x00,
48+
0x00, 0x00, 0x01, 0x00,
49+
0x00, 0x00, 0x01, 0x00,
50+
0x00, 0x00, 0x01, 0x00,
51+
0x00, 0x00, 0x01, 0x00,
52+
0x00, 0x01, 0x00, 0x00,
53+
0x00, 0x01, 0x00, 0x00,
54+
0x00, 0x00, 0x00, 0x00,
55+
0x00, 0x00, 0x01, 0x00,
56+
0x00, 0x01, 0x00, 0x00,
57+
0x01, 0x00, 0x00, 0x00,
58+
0x00, 0x00, 0x00, 0x00,
59+
0x00, 0x00, 0x01, 0x01,
60+
0x01, 0x01, 0x00, 0x00,
61+
0x00, 0x00, 0x00, 0x00,
62+
0x00, 0x00, 0x00, 0x00,
63+
0x00, 0x00, 0x00, 0x00,
64+
0x01, 0x01, 0x01, 0x01,
65+
0x00, 0x00, 0x00, 0x00,
66+
0x00, 0x00, 0x00, 0x00,
67+
0x01, 0x01, 0x00, 0x00,
68+
0x00, 0x00, 0x01, 0x01,
69+
0x00, 0x00, 0x00, 0x00,
70+
0x00, 0x00, 0x00, 0x00,
71+
0x00, 0x01, 0x00, 0x00,
72+
0x00, 0x00, 0x01, 0x00,
73+
0x00, 0x00, 0x00, 0x01,
74+
0x00, 0x01, 0x00, 0x00,
75+
0x00, 0x01, 0x00, 0x00,
76+
0x00, 0x00, 0x01, 0x00,
77+
0x00, 0x00, 0x01, 0x00 };

datasrc/bullet.ppm

826 Bytes
Binary file not shown.

datasrc/shld.c

Lines changed: 60 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,67 @@
11

2-
unsigned char bin_shld[] = {
3-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe,
4-
0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
5-
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x00,
6-
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00,
7-
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00,
8-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
9-
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00,
10-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11-
0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00,
12-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13-
0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00,
14-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15-
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xfe, 0x00,
16-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe,
18-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
20-
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22-
0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2+
/* Automatically generated by the program ppm2c version 0.6
3+
written by Peter Ekberg, peda@lysator.liu.se */
4+
5+
unsigned int shld_nr_colors = 5;
6+
unsigned int shld_cols = 17;
7+
unsigned int shld_rows = 17;
8+
9+
unsigned char shld_colors[] = {
10+
0x00, 0x00, 0x00,
11+
0x3c, 0x3e, 0x3c,
12+
0xa2, 0xa4, 0xa1,
13+
0xc0, 0xc3, 0xc0,
14+
0x6a, 0x6d, 0x6a};
15+
16+
unsigned char shld_pixels[] = {
17+
0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x03,
18+
0x03, 0x03, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00,
19+
0x00,
20+
0x00, 0x00, 0x00, 0x02, 0x03, 0x04, 0x00, 0x00,
21+
0x00, 0x00, 0x00, 0x04, 0x03, 0x02, 0x00, 0x00,
22+
0x00,
23+
0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00,
24+
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00,
25+
0x00,
26+
0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
27+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
28+
0x00,
29+
0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
31+
0x01,
32+
0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
34+
0x02,
35+
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2336
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24-
0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
37+
0x03,
38+
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2539
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26-
0x00, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00,
40+
0x03,
41+
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2742
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28-
0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00,
43+
0x03,
44+
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2945
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30-
0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe,
46+
0x03,
47+
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3148
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32-
0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00,
33-
0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34-
0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00,
35-
0x00, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00,
36-
0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00,
37-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe,
38-
0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
49+
0x03,
50+
0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
52+
0x02,
53+
0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
55+
0x01,
56+
0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
57+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
58+
0x00,
59+
0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
60+
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00,
61+
0x00,
62+
0x00, 0x00, 0x00, 0x02, 0x03, 0x04, 0x00, 0x00,
63+
0x00, 0x00, 0x00, 0x04, 0x03, 0x02, 0x00, 0x00,
64+
0x00,
65+
0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x03,
66+
0x03, 0x03, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00,
3967
0x00 };

datasrc/shld.ppm

926 Bytes
Binary file not shown.

src/fast_gr.c

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,36 @@ ui8 *bild;
1818

1919
static ui8 fuelblink;
2020

21-
ui8 palette_shift=0;
22-
ui8 color_conversion[USED_COLORS] = {
23-
0x00, 0x01, 0x02, 0x04,
24-
0x0c, 0x0e, 0x0f,
25-
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
26-
0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1e,
27-
0x20, 0x21, 0x22, 0x23, 0x24,
28-
29-
30-
31-
0x41,
32-
33-
34-
35-
36-
37-
38-
39-
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
40-
0x88, 0x89, 0x8f,
41-
42-
43-
0xa4, 0xa5,
44-
45-
46-
47-
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
48-
0xc8,
49-
50-
51-
52-
53-
54-
0xfe, 0xff
21+
ui8 pixel_collision[256];
22+
23+
ui8 extracolor[EXTRA_COLORS * 3] = {
24+
0x40, 0x40, 0xff,
25+
0xff, 0xff, 0xff,
26+
0xd5, 0x00, 0x00,
27+
0xd5, 0xaa, 0x00,
28+
0x00, 0xd5, 0x00,
29+
0xff, 0xff, 0x49,
30+
0xff, 0xff, 0x49,
31+
0xff, 0xff, 0x49,
32+
0xa8, 0xa8, 0xff,
33+
0x00, 0x55, 0x00,
34+
0xde, 0xf7, 0x08,
35+
0x6b, 0x00, 0x00,
5536
};
56-
ui8 color_lookup[256];
37+
ui8 extracolor_shift = 0;
38+
39+
ui8 findcolor[FIND_COLORS * 3] = {
40+
0xff, 0x80, 0x35,
41+
0xa8, 0xa8, 0xff,
42+
0xff, 0x55, 0xaa,
43+
0x80, 0xff, 0xaa,
44+
0xaa, 0xff, 0xaa
45+
};
46+
ui8 foundcolor[FIND_COLORS];
47+
48+
ui8 bullet_shift = 0;
49+
ui8 shield_shift = 0;
50+
ui8 ship_shift = 0;
5751

5852
void
5953
putscr(int x, int y)
@@ -201,8 +195,10 @@ testcrash(ui8 *object, ui8 *storage, word len, ui8 shield)
201195

202196
for(i=0; i<len; i++) {
203197
if(*(object++)!=BLACK) {
204-
if(*storage>res && (!shield || (shield && *storage<SHIELDLIMIT)))
205-
res=*storage;
198+
if(pixel_collision[*storage]>res && (!shield || (shield && pixel_collision[*storage]>SHIELDLIMIT))) {
199+
res=pixel_collision[*storage];
200+
printf("Found %d\n", *storage);
201+
}
206202
}
207203
storage++;
208204
}

src/fast_gr.h

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,42 @@
1313
#define PUSEX (PBILDX-8)
1414
#define PUSEY (PBILDY-8)
1515

16-
#define USED_COLORS (51)
17-
extern ui8 color_conversion[USED_COLORS];
18-
extern ui8 color_lookup[256];
19-
extern ui8 palette_shift;
20-
#define TEXTCOLOR (color_lookup[0x20] + palette_shift)
21-
#define HIGHLIGHT (color_lookup[0x21] + palette_shift)
22-
#define FUELCOLOR (color_lookup[0x22] + palette_shift)
23-
#define SCORETEXT (color_lookup[0x23] + palette_shift)
24-
#define SCORENAME (color_lookup[0x24] + palette_shift)
25-
#define BGCOLOR (color_lookup[0x41] + palette_shift)
26-
#define FUELHIGHLIGHT (color_lookup[0x88] + palette_shift)
27-
#define STATUSFRAME (color_lookup[0x88] + palette_shift)
28-
#define STATUSNUMBERS (color_lookup[0x88] + palette_shift)
29-
#define STATUSTEXT (color_lookup[0x89] + palette_shift)
30-
#define BLACK (color_lookup[0x00] + palette_shift)
31-
#define TRACTOR (color_lookup[0x01] + palette_shift)
32-
#define FRAGMENT (color_lookup[0x0c] + palette_shift)
33-
#define BULBS (color_lookup[0x89] + palette_shift)
34-
#define GUN (color_lookup[0x8f] + palette_shift)
35-
#define STAND (color_lookup[0xa4] + palette_shift)
36-
#define POD (color_lookup[0xa5] + palette_shift)
37-
#define SHIELD (color_lookup[0xfe] + palette_shift)
38-
#define SHIP (color_lookup[0xff] + palette_shift)
39-
40-
#define SHIELDLIMIT SHIELD
41-
#define CRASH_VALUE(x) (((ui8)(color_conversion[(x)-palette_shift]))>>5)
16+
extern ui8 pixel_collision[256];
17+
18+
#define EXTRA_COLORS (12)
19+
extern ui8 extracolor[EXTRA_COLORS * 3];
20+
extern ui8 extracolor_shift;
21+
#define TEXTCOLOR (0 + extracolor_shift)
22+
#define HIGHLIGHT (1 + extracolor_shift)
23+
#define FUELCOLOR (2 + extracolor_shift)
24+
#define SCORETEXT (3 + extracolor_shift)
25+
#define SCORENAME (4 + extracolor_shift)
26+
#define FUELHIGHLIGHT (5 + extracolor_shift)
27+
#define STATUSFRAME (6 + extracolor_shift)
28+
#define STATUSNUMBERS (7 + extracolor_shift)
29+
#define STATUSTEXT (8 + extracolor_shift)
30+
#define FRAGMENT (9 + extracolor_shift)
31+
#define SHIP (10 + extracolor_shift)
32+
#define TRACTOR (11 + extracolor_shift)
33+
34+
#define BLACK (0)
35+
#define FIND_COLORS (5)
36+
extern ui8 findcolor[FIND_COLORS * 3];
37+
extern ui8 foundcolor[FIND_COLORS];
38+
#define BGCOLOR (foundcolor[0])
39+
#define BULBS (foundcolor[1])
40+
#define GUN (foundcolor[2])
41+
#define STAND (foundcolor[3])
42+
#define POD (foundcolor[4])
43+
44+
extern ui8 bullet_shift;
45+
extern ui8 shield_shift;
46+
extern ui8 ship_shift;
47+
#define SHIELD (shield_shift + 1)
48+
49+
#define SHIELDLIMIT 1
50+
#define CRASH_VALUE(x) x
51+
//(((ui8)(color_conversion[(x)-palette_shift]))>>5)
4252

4353
#ifdef __STDC__
4454
void putscr(int x, int y);

0 commit comments

Comments
 (0)