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
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
*/
#include "graph.h"
/*#include "Crt.h"*/
namespace Avalanche {
const string crlf = string('\15') + '\12';
const char eof_ = '\32';
const array<1, 177, char> trip5head =
string("Sprite*.AVD ... data file for Trippancy Five") + crlf + crlf +
"[Thorsoft relocatable fiveplane sprite image format]" + crlf + crlf +
"Thomas Thurman was here. ... Have fun!" + crlf + crlf + eof_ +
"������� * G. I. E. D. ! * ";
const array<1, 4, char> tripid = string('\x30') + '\x1' + '\x75' + '\261';
const array<1, 50, char> trip5foot = crlf + crlf +
" and that's it! Enjoy the game. " + '\3' + crlf + crlf +
"\n\n\n\n\n\n\n" + "tt";
struct adxotype {
varying_string<12> name; /* name of character */
byte num; /* number of pictures */
byte xl, yl; /* x & y lengths of pictures */
byte seq; /* how many in one stride */
word size; /* the size of one picture */
byte fgc, bgc; /* foreground & background bubble colours */
};
struct adxtype {
varying_string<12> name; /* name of character */
varying_string<16> comment; /* comment */
byte num; /* number of pictures */
byte xl, yl; /* x & y lengths of pictures */
byte seq; /* how many in one stride */
word size; /* the size of one picture */
byte fgc, bgc; /* foreground & background bubble colours */
byte accinum; /* the number according to Acci (1=Avvy, etc.) */
};
varying_string<2> sn;
adxotype oa;
adxtype a;
matrix<1, 24, 0, 1, pointer> pic; /* the pictures themselves */
array<1, 16000, byte> aa;
untyped_file out;
integer bigsize;
void copyaoa() {
{
a.name = oa.name;
a.comment = "Transferred";
a.num = oa.num;
a.xl = oa.xl;
a.yl = oa.yl;
a.seq = oa.seq;
a.size = oa.size;
a.fgc = oa.fgc;
a.bgc = oa.bgc;
}
}
void setup() {
integer gd, gm;
gd = 3;
gm = 0;
initgraph(gd, gm, "c:\\bp\\bgi");
}
string strf(longint x) {
string q;
string strf_result;
str(x, q);
strf_result = q;
return strf_result;
}
void save() {
byte sort, n;
word fv, ff;
char r;
byte xw;
byte nxl, nyl;
word soa;
cleardevice();
{
a.xl = 45;
a.yl = 10;
a.num = 1;
a.seq = 1;
a.size = imagesize(0, 0, a.xl, a.yl);
soa = sizeof(a);
assign(out, "v:sprite10.avd");
rewrite(out, 1);
blockwrite(out, trip5head, 177);
blockwrite(out, tripid, 4);
blockwrite(out, soa, 2);
blockwrite(out, a, soa);
nxl = a.xl;
nyl = a.yl;
xw = nxl / 8;
if ((nxl % 8) > 0) xw += 1;
for (n = 1; n <= a.num; n ++) {
getimage(0, 0, a.xl, a.yl, aa);
for (fv = 0; fv <= nyl; fv ++)
blockwrite(out, aa[5 + fv * xw * 4], xw);
getimage(100, 0, 100 + a.xl, a.yl, aa);
blockwrite(out, aa[5], a.size - 6);
}
}
}
int main(int argc, const char *argv[]) {
pio_initialize(argc, argv);
setup();
save();
blockwrite(out, trip5foot, 50);
close(out);
return EXIT_SUCCESS;
}
} // End of namespace Avalanche.
|