4e1fce7858c3cac07379f56376d3d304062d0fe4
2 Copyright (C) Prikol Software 1996-1997
3 Copyright (C) Aleksey Volynskov 1996-1997
4 Copyright (C) <ARembo@gmail.com> 2011
6 This file is part of the Doom2D:Rembo project.
8 Doom2D:Rembo is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License version 2 as
10 published by the Free Software Foundation.
12 Doom2D:Rembo is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see <http://www.gnu.org/licenses/> or
19 write to the Free Software Foundation, Inc.,
20 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
48 extern map_block_t blk
;
51 int w_o
,w_x
,w_y
,sky_type
=1;
54 byte fldb
[FLDH
][FLDW
];
55 byte fldf
[FLDH
][FLDW
];
58 extern int lt_time
,lt_type
,lt_side
,lt_ypos
;
59 extern void *ltn
[2][2];
61 void W_savegame (FILE* h
) {
64 myfwrite32(sky_type
, h
);
65 for(i
= 1; i
< 256; ++i
) {
69 for (i
= 0; i
< 256; i
++) {
70 myfwrite32(walf
[i
], h
);
72 for (i
= 0; i
< 256; i
++) {
73 myfwrite8(walswp
[i
], h
);
75 myfwrite(fldb
, FLDW
*FLDH
, 1, h
);
76 myfwrite(fld
, FLDW
*FLDH
, 1, h
);
77 myfwrite(fldf
, FLDW
*FLDH
, 1, h
);
80 void W_loadgame (FILE* h
) {
83 sky_type
= myfread32(h
);
85 for (i
= 1; i
< 256; ++i
) {
86 myfread(s
[i
], 8, 1, h
);
89 i
= myfread32(h
); // ignore
90 for (i
= 1; i
< 256; i
++) {
91 walf
[i
] = myfread32(h
);
92 R_load(s
[i
], walf
[i
] & 1);
94 for (i
= 0; i
< 256; i
++) {
95 //walswp[i] = myfread8(h);
96 (void)myfread8(h
); // useless in new code
98 myfread(fldb
, FLDW
*FLDH
, 1, h
);
99 myfread(fld
, FLDW
*FLDH
, 1, h
);
100 myfread(fldf
, FLDW
*FLDH
, 1, h
);
117 static void unpack(void *buf
, int len
, void *obuf
) {
120 unsigned char *p
= buf
;
121 unsigned char *q
= obuf
;
127 step
= p
[i
] | p
[i
+ 1] << 8;
131 memset(&q
[j
], id
, step
);
136 int W_load (FILE *h
) {
143 for (i
= 1; i
< 256 && blk
.sz
> 0; i
++, blk
.sz
-= 9) {
147 if (strncasecmp(s
, "VTRAP01", 8) == 0) {
164 myfread(p
, FLDW
* FLDH
, 1, h
);
167 buf
= malloc(blk
.sz
);
169 ERR_fatal("Не хватает памяти");
171 myfread(buf
, blk
.sz
, 1, h
);
172 unpack(buf
, blk
.sz
, p
);
180 sky_type
= myfread16(h
);