-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBRKFUNC.H
44 lines (34 loc) · 844 Bytes
/
BRKFUNC.H
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
/*
Diverse funksjoner til MegaBreak og Level Editor
Q 3/1-95
*/
void brick_load(char *Filename, byte *Brickmap);
void brick_save(char *Filename, byte *Brickmap);
//void draw_bricks();
const short FILE_SIZE = 260; // Et brett tar 260 bytes (13*20)
void brick_load(char *Filename, byte *Brickmap)
{
FILE *handle;
int i;
handle = fopen(Filename, "r+b");
if (handle==NULL)
handle = fopen(Filename, "w+b");
else {
for (i=0; i<FILE_SIZE; i++)
{
Brickmap[i] = fgetc(handle);
}
}
fclose(handle);
}
void brick_save(char *Filename, byte *Brickmap)
{
FILE *handle;
int i;
handle = fopen(Filename, "wb");
for (i=0; i<FILE_SIZE; i++)
{
fputc(Brickmap[i], handle);
}
fclose(handle);
}