Debian Codegraph @

src/pcxload.c

raw symbols SCIP
1 /*
2 * OpenTyrian: A modern cross-platform port of Tyrian
3 * Copyright (C) 2007-2009 The OpenTyrian Development Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 #include "pcxload.h"cxx . . $ `<file>/src/pcxload.h`/
20
21 #include "file.h"cxx . . $ `<file>/src/file.h`/
22 #include "opentyr.h"cxx . . $ `<file>/src/opentyr.h`/
23 #include "palette.h"cxx . . $ `<file>/src/palette.h`/
24 #include "video.h"cxx . . $ `<file>/src/video.h`/
25
26 #include <string.h>
27
28 void JE_loadPCXcxx . . $ JE_loadPCX(85c52e162fed56f9).(const char *file) // this is only meant to load tshp2.pcx
29 {
30 Uint8cxx . . $ Uint8# *s = VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels.; /* 8-bit specific */
31
32 FILEcxx . . $ FILE# *f = dir_fopen_diecxx . . $ dir_fopen_die(2493aa730c89ee72).(data_dircxx . . $ data_dir(33a1f659e94feb42).(), file, "rb");
33
34 fseekcxx . . $ fseek(543fae30d249f6b1).(f, -769, SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!);
35
36 Uint8cxx . . $ Uint8# temp;
37 fread_u8_diecxx . . $ fread_u8_die(77ebc59a7bf9f340).(&temp, 1, f);
38 if (temp == 12)
39 {
40 for (int i = 0; i < 256; i++)
41 {
42 Uint8cxx . . $ Uint8# rgb[3];
43 fread_u8_diecxx . . $ fread_u8_die(77ebc59a7bf9f340).(rgb, 3, f);
44 colorscxx . . $ colors.[i].rcxx . . $ SDL_Color#r. = rgb[0];
45 colorscxx . . $ colors.[i].gcxx . . $ SDL_Color#g. = rgb[1];
46 colorscxx . . $ colors.[i].bcxx . . $ SDL_Color#b. = rgb[2];
47 }
48 }
49
50 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 128, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
51
52 for (int i = 0; i < 320 * 200; )
53 {
54 Uint8cxx . . $ Uint8# p;
55 fread_u8_diecxx . . $ fread_u8_die(77ebc59a7bf9f340).(&p, 1, f);
56 if ((p & 0xc0) == 0xc0)
57 {
58 i += (p & 0x3f);
59 fread_u8_diecxx . . $ fread_u8_die(77ebc59a7bf9f340).(&temp, 1, f);
60 memsetcxx . . $ memset(d1de1e4fb215f1c6).(s, temp, (p & 0x3f));
61 s += (p & 0x3f);
62 }
63 else
64 {
65 i++;
66 *s = p;
67 s++;
68 }
69 if (i && (i % 320 == 0))
70 {
71 s += VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch. - 320;
72 }
73 }
74
75 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
76 }