annotate Texture.cpp @ 127:9eac46182d8f

Слияние
author Ritor1
date Sun, 04 Nov 2012 09:37:39 +0600
parents 51a5b0dc3f30
children
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include <stdlib.h>
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 #include "Texture.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "FrameTableInc.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5 #include "Allocator.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 #include "LOD.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 #include "PaletteManager.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8 #include "Render.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 struct TextureFrameTable *pTextureFrameTable;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 Texture *pTexture_LloydBeacons[2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 Texture *pTexture_50635C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 Texture *pTexture_506368;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 Texture *pTexture_50636C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31 Texture *pTexture_506370;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32 Texture *pTexture_506374;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33 Texture *pTexture_506378;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 Texture *pTexture_50637C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35 Texture *pTexture_506380;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 Texture *pTexture_506384;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 Texture *pTexture_506388;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 Texture *pTexture_50638C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39 Texture *pTexture_506390;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40 Texture *pTexture_506394;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 Texture *pTex_tab_an_7a__zoot_off;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 Texture *pTex_tab_an_6a__zoom_off;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 Texture *pTex_tab_an_7b__zoot_on;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 Texture *pTex_tab_an_6b__zoom_on;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45 Texture *pTexture_TownPortalHarmn;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
46 Texture *pTexture_TownPortalElf;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47 Texture *pTexture_TownPortalWarlock;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48 Texture *pTexture_TownPortalIsland;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
49 Texture *pTexture_TownPortalHeaven;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
50 Texture *pTexture_TownPortalHell;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
51 Texture *dword_5063D8[777];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
52 Texture *dword_506404[777];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
53 Texture *dword_506434[777];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
54 Texture *pTexture_50643C; // idb
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55 Texture *ptr_506440;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
56 Texture *pTexture_506444;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
57 Texture *pTexture_506448; // idb
84
b39bdc150e90 Some inventory stuff
Nomad
parents: 61
diff changeset
58 Texture *pTextures_tabs[8][2];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
59 Texture *pTexture_mapbordr; // idb
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60 Texture *pTexture_pagemask; // idb
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61 Texture *pTextures_5064A0[14];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 Texture *pTexture_AutonotesBook;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63 Texture *pTexture_CurrentBook;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 Texture *pTex_moon_new;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 Texture *pTex_moon_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66 Texture *pTex_moon_2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67 Texture *pTex_moon_2_2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
68 Texture *pTex_moon_ful;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
69
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 RGBTexture stru_506E40; // weak
44
916bec351934 22.10.12(pCurrentScreen)
Ritor1
parents: 43
diff changeset
73 RGBTexture pTexture_PCX;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
74
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 int uTextureID_RestUI_restb4; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
77 int uTextureID_RestUI_restexit; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78 int uTextureID_RestUI_restb3; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 int uTextureID_RestUI_restb1; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 int uTextureID_RestUI_restb2; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
81 int uTextureID_RestUI_restmain; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 unsigned int uTextureID_Leather;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
83 int uTextureID_ar_dn_dn; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84 int uTextureID_ar_dn_up; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 int uTextureID_ar_up_dn; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 int uTextureID_ar_up_up; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
88
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
89 int uTextureID_507698; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 int uTextureID_50769C; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
91 int uTextureID_5076A0; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
92 int uTextureID_5076A4; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
93 int uTextureID_5076A8; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
94 int uTextureID_5076AC; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
95 int uTextureID_5076B0; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
96 int uTextureID_5076B4; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97 int uTextureID_Parchment; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98 unsigned int uTextureID_mhp_yel;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99 unsigned int uTextureID_mhp_red;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 unsigned int uTextureID_mhp_grn;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 unsigned int uTextureID_mhp_capr;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102 unsigned int uTextureID_mhp_capl;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
103 unsigned int uTextureID_mhp_bd;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
104 unsigned int uTextureID_BUTTDESC2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
105 unsigned int uTextureID_x_x_u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 unsigned int uTextureID_BUTTMAKE2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107 unsigned int uTextureID_BUTTMAKE;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 unsigned int uTextureID_BUTTYES2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109 unsigned int uTextureID_x_ok_u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110 Texture *pPlayerPortraits[22];
43
484492a6dd28 Прорисовка окна создания персонажа готова, но не решена проблема кликабельности доступных навыков
Ritor1
parents: 35
diff changeset
111 Texture *pTexture_IC_KNIGHT[8];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112 Texture *pTexture_MAKESKY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113 Texture *pTexture_MAKETOP;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 Texture *pTextures_arrowr[20];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 Texture *pTextures_arrowl[20];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
116 Texture *pTexture_presleft;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117 Texture *pTexture_pressrigh;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118 Texture *pTexture_buttminu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 Texture *pTexture_buttplus;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 unsigned int uTextureID_50792C; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121 unsigned int uTextureID_507930; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
122 unsigned int uTextureID_507934; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 unsigned int uTextureID_507938; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
124 unsigned int uTextureID_50793C; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
125 unsigned int uTextureID_507940; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
126 unsigned int uTextureID_507944; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
127
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
128
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 unsigned int uTextureID_ib_td5_A;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
130 unsigned int uTextureID_ib_td2_A; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
131 unsigned int uTextureID_ib_td1_A;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
132 int uTextureID_507958; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
133 int uTextureID_50795C; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
134
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
135
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 unsigned int uTextureID_507970;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
137
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
138
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
139 unsigned int uTextureID_507978;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
140 unsigned int uTextureID_50797C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
141 unsigned int uTextureID_507980;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
142 unsigned int uTextureID_507984;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 unsigned int uTextureID_FONTPAL;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 unsigned int uTextureID_50798C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 unsigned int uTextureID_507990;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146 unsigned int pTextureIDs_pMapDirs[8];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 unsigned int uTextureID_BarRed;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150 unsigned int uTextureID_BarYellow;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 unsigned int uTextureID_BarGreen;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152 unsigned int uTextureID_BarBlue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
153
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
154
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
155 unsigned int uTextureID_right_panel; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
156
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
158 RGBTexture *pTexture_StatusBar = new RGBTexture;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
159 RGBTexture *pTexture_LeftFrame = new RGBTexture;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
160 RGBTexture *pTexture_TopFrame = new RGBTexture;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
161 RGBTexture *pTexture_BottomFrame = new RGBTexture;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
162 RGBTexture *pTexture_RightFrame = new RGBTexture;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
163
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
164
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165 unsigned int uTextureID_507B04; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
166
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
167
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
168 Texture *pTexture_Leather;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
169 Texture *pTexture_RestUI_CurrentSkyFrame; // idb
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
170 Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
171
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
172
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
173 unsigned int uTextureID_507BF4; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
174 unsigned int uTextureID_507BF8; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
175 unsigned int uTextureID_507BFC; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
176 unsigned int uTextureID_507C00; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
177 unsigned int uTextureID_507C04; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
178
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
179
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
180 unsigned int uTextureID_507C10; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
181 unsigned int uTextureID_507C14; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
182 unsigned int uTextureID_507C18; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
183 unsigned int uTextureID_507C1C; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
184 unsigned int uTextureID_507C20; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
185 unsigned int uTextureID_507C24; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
186 unsigned int pTextureIDs_GammaPositions[10];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
187 unsigned int uTextureID_507C50; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
188 unsigned int uTextureID_507C54; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
189 unsigned int uTextureID_507C58; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
190 unsigned int uTextureID_507C60; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
191 unsigned int uTextureID_507C64[777]; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
192 unsigned int uTextureID_507C68; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
193 unsigned int uTextureID_507C6C; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
194 unsigned int uTextureID_507C70; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
195 unsigned int uTextureID_507C74; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
196 unsigned int uTextureID_507C84; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
197 unsigned int pTextureIDs_SoundLevels[10];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
198 unsigned int uTextureID_507CB0; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
199 unsigned int uTextureID_507CB4; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
200 unsigned int uTextureID_507CB8; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
201
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
202
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
203 unsigned int uTextureID_5118C8; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
204 unsigned int uTextureID_MAGNIF_B; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
205 unsigned int uTextureID_BACKDOLL; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
206 unsigned int uTextureID_BACKHAND; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
207
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
208
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
209 Texture pTex_F7CE30;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
210
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
211
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
212 RGBTexture stru_5773C4; // idb
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
213
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
214
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
215
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
216
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
217
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
218
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
219
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
220
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
221
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
222
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
223
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
224 /* 245 */
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
225 #pragma pack(push, 1)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
226 struct PCXHeader1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
227 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
228 char magic;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
229 char version;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
230 char encoding;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
231 char bpp;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
232 __int16 left;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
233 __int16 up;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
234 __int16 right;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
235 __int16 bottom;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
236 __int16 hres;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
237 __int16 vres;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
238 };
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
239 #pragma pack(pop)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
240
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
241 /* 246 */
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
242 #pragma pack(push, 1)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
243 struct PCXHeader2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
244 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
245 char reserved;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
246 char planes;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
247 __int16 pitch;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
248 __int16 palette_info;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
249 };
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
250 #pragma pack(pop)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
251
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
252
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
253
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
254
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
255
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
256
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
257
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
258
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
259
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
260 //----- (0044E054) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
261 void TextureFrameTable::ToFile()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
262 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
263 TextureFrameTable *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
264 FILE *v2; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
265 FILE *v3; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
266
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
267 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
268 v2 = fopen("data\\dtft.bin", "wb");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
269 v3 = v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
270 if ( !v2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
271 Abortf("Unable to save dtft.bin!");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
272 fwrite(v1, 4u, 1u, v2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
273 fwrite(v1->pTextures, 0x14u, v1->uNumTextures, v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
274 fclose(v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
275 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
276
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
277 //----- (0044E0A0) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
278 void TextureFrameTable::FromFile(void *pSerialized)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
279 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
280 uNumTextures = *(int *)pSerialized;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
281 pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, 20 * uNumTextures, "Txt Frames");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
282 memcpy(pTextures, (char *)pSerialized + 4, 20 * uNumTextures);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
283 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
284
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
285 //----- (0044E0ED) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
286 unsigned int TextureFrameTable::LoadAnimationSequenceAndPalettes(unsigned int uIconID)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
287 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
288 unsigned int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
289 TextureFrameTable *v3; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
290 unsigned int i; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
291
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
292 result = uIconID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
293 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
294 if ( (signed int)uIconID <= (signed int)this->uNumTextures && (uIconID & 0x80000000u) == 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
295 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
296 for ( i = uIconID; ; ++i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
297 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
298 v3->pTextures[i].uTextureID = pBitmaps_LOD->LoadTexture(v3->pTextures[i].pTextureName, TEXTURE_DEFAULT);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
299 auto pTex = (v3->pTextures[i].uTextureID != -1 ? &pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID] : 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
300 if (pTex)
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
301 pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
302 result = (unsigned int)v3->pTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
303 if ( !(*(char *)(result + i * 20 + 18) & 1) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
304 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
305 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
306 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
307 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
308 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
309
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
310 //----- (0044E163) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
311 unsigned int TextureFrameTable::FindTextureByName(const char *Str2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
312 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
313 TextureFrameTable *v2; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
314 int v3; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
315 unsigned int uID; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
316 unsigned int result; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
317
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
318 v2 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
319 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
320 uID = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
321 if ( (signed int)this->uNumTextures <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
322 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
323 LABEL_4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
324 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
325 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
326 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
327 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
328 while ( _strcmpi(v2->pTextures[v3].pTextureName, Str2) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
329 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
330 ++uID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
331 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
332 if ( (signed int)uID >= (signed int)v2->uNumTextures )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
333 goto LABEL_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
334 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
335 result = uID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
336 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
337 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
338 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
339
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
340 //----- (0044E19A) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
341 unsigned int TextureFrameTable::GetFrameTexture(int uFrameID, signed int a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
342 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
343 int v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
344 TextureFrame *v4; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
345 TextureFrame *v5; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
346 __int16 v6; // dx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
347 int v7; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
348 char *i; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
349 int v9; // ecx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
350 unsigned int result; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
351
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
352 v3 = uFrameID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
353 v4 = this->pTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
354 v5 = &v4[uFrameID];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
355 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
356 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
357 v7 = (a3 >> 3) % v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
358 for ( i = (char *)&v5->uAnimTime; ; i += 20 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
359 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
360 v9 = *(short *)i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
361 if ( v7 <= v9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
362 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
363 v7 -= v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
364 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
365 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
366 result = v4[v3].uTextureID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
367 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
368 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
369 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
370 result = v5->uTextureID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
371 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
372 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
373 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
374
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
375
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
376
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
377
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
378
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
379
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
380 //----- (0040F806) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
381 void *Texture::UnzipPalette()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
382 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
383 Texture *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
384 void *v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
385 Texture *pSource; // [sp+0h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
386
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
387 pSource = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
388 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
389 v2 = malloc(this->uDecompressedSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
390 zlib::MemUnzip(v2, (unsigned int *)&pSource, v1->pLevelOfDetail0, v1->uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
391 return v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
392 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
393
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
394 //----- (0040F77C) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
395 void Texture::Release()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
396 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
397 if (this)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
398 {
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
399 pName[0] = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
400
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
401 if (pBits & 0x0400)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
402 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
403 pAllocator->FreeChunk(pLevelOfDetail0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
404 pAllocator->FreeChunk(pPalette16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
405 pAllocator->FreeChunk(pPalette24);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
406 }
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
407
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
408 pLevelOfDetail0 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
409 pLevelOfDetail1 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
410 pLevelOfDetail2 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
411 pLevelOfDetail3 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
412
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
413 pPalette16 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
414 pPalette24 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
415
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
416 uSizeOfMaxLevelOfDetail = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
417 uTextureSize = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
418 uTextureHeight = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
419 uTextureWidth = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
420 uHeightLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
421 uWidthLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
422 palette_id1 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
423 palette_id2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
424 pBits &= 0xFFFF0000;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
425 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
426 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
427
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
428 //----- (0040F5F5) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
429 int RGBTexture::Reload(const char *pContainer)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
430 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
431 RGBTexture *v2; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
432 FILE *v3; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
433 FILE *v4; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
434 void *v5; // ebx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
435 signed int result; // eax@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
436 unsigned int v7; // ecx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
437 unsigned __int16 *v8; // ST20_4@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
438 int v9; // eax@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
439 char color_map[48]; // [sp+8h] [bp-98h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
440 Texture DstBuf; // [sp+38h] [bp-68h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
441 PCXHeader1 header1; // [sp+80h] [bp-20h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
442 PCXHeader2 header2; // [sp+90h] [bp-10h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
443 FILE *File; // [sp+98h] [bp-8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
444 size_t Count; // [sp+9Ch] [bp-4h]@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
445 void *uSourceLena; // [sp+A8h] [bp+8h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
446
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
447 v2 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
448 if ( !v2->pPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
449 return 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
450 v3 = pIcons_LOD->FindContainer(pContainer, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
451 v4 = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
452 File = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
453 if ( !v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
454 {
96
51a5b0dc3f30 3.11.12
Ritor1
parents: 84
diff changeset
455 sprintf(pTmpBuf, "Unable to load %s", pContainer);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
456 Abortf(pTmpBuf);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
457 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
458 fread(&DstBuf, 1u, 0x30u, v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
459 Count = DstBuf.uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
460 if ( DstBuf.uDecompressedSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
461 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
462 v5 = malloc(DstBuf.uDecompressedSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
463 uSourceLena = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
464 fread(uSourceLena, 1u, Count, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
465 zlib::MemUnzip(v5, &DstBuf.uDecompressedSize, uSourceLena, DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
466 DstBuf.uTextureSize = DstBuf.uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
467 pAllocator->FreeChunk(uSourceLena);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
468 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
469 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
470 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
471 v5 = malloc(DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
472 fread(v5, 1u, Count, v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
473 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
474 memcpy(&header1, v5, 0x10u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
475 memcpy(color_map, (char *)v5 + 16, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
476 memcpy(&header2, (char *)v5 + 64, 6u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
477 if ( header1.bpp != 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
478 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
479 v7 = (signed __int16)(header1.right - header1.left + 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
480 if ( (signed int)(v7 * (signed __int16)(header1.bottom - header1.up + 1)) <= (signed int)v2->uNumPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
481 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
482 v2->uWidth = header1.right - header1.left + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
483 v8 = v2->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
484 v9 = v7 * v2->uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
485 v2->uNumPixels = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
486 v2->uHeight = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
487 v2->DecodePCX((char *)v5, v8, v7);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
488 free(v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
489 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
490 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
491 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
492 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
493 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
494 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
495 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
496 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
497
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
498 //----- (0040F5BE) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
499 Texture::Texture()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
500 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
501 pName[0] = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
502 uSizeOfMaxLevelOfDetail = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
503 uTextureSize = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
504 uTextureHeight = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
505 uTextureWidth = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
506 uHeightLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
507 uWidthLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
508 palette_id1 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
509 palette_id2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
510 pLevelOfDetail0 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
511 pLevelOfDetail3 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
512 pLevelOfDetail2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
513 pLevelOfDetail1 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
514 pPalette16 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
515 pPalette24 = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
516 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
517
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
518 //----- (0040F414) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
519 int RGBTexture::Load(const char *pContainer, int mode)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
520 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
521 RGBTexture *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
522 FILE *v4; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
523 FILE *v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
524 void *v6; // ebx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
525 unsigned __int16 v7; // ax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
526 unsigned __int16 v8; // cx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
527 int v9; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
528 void *v10; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
529 void *v11; // eax@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
530 unsigned __int16 *v12; // eax@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
531 char color_map[48]; // [sp+Ch] [bp-98h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
532 Texture DstBuf; // [sp+3Ch] [bp-68h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
533 PCXHeader1 header1; // [sp+84h] [bp-20h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
534 PCXHeader2 header2; // [sp+94h] [bp-10h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
535 FILE *File; // [sp+9Ch] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
536 size_t Count; // [sp+A0h] [bp-4h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
537 char *Str1a; // [sp+ACh] [bp+8h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
538
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
539 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
540 v4 = pIcons_LOD->FindContainer(pContainer, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
541 v5 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
542 File = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
543 if ( !v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
544 {
96
51a5b0dc3f30 3.11.12
Ritor1
parents: 84
diff changeset
545 sprintf(pTmpBuf, "Unable to load %s", pContainer);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
546 Abortf(pTmpBuf);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
547 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
548 fread(&DstBuf, 1u, 0x30u, v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
549 Count = DstBuf.uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
550 if ( DstBuf.uDecompressedSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
551 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
552 Str1a = (char *)malloc(DstBuf.uDecompressedSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
553 v6 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
554 fread(v6, 1u, Count, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
555 zlib::MemUnzip(Str1a, &DstBuf.uDecompressedSize, v6, DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
556 DstBuf.uTextureSize = DstBuf.uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
557 pAllocator->FreeChunk(v6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
558 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
559 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
560 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
561 Str1a = (char *)malloc(DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
562 fread(Str1a, 1u, Count, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
563 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
564 memcpy(&header1, Str1a, 0x10u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
565 memcpy(color_map, Str1a + 16, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
566 memcpy(&header2, Str1a + 64, 6u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
567 if ( header1.bpp != 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
568 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
569 v7 = header1.right - header1.left + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
570 v8 = header1.bottom - header1.up + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
571 v3->uWidth = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
572 v3->uHeight = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
573 v9 = (signed __int16)v7 * (signed __int16)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
574 v10 = v3->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
575 v3->uNumPixels = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
576 if ( v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
577 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
578 if ( mode )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
579 goto LABEL_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
580 pAllocator->FreeChunk(v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
581 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
582 if ( !mode )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
583 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
584 v11 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, "16bit PCX");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
585 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
586 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
587 LABEL_14:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
588 if ( mode != 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
589 goto LABEL_17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
590 v11 = malloc(2 * v3->uNumPixels + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
591 *(unsigned int *)&v3->field_20 |= 1u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
592 LABEL_16:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
593 v3->pPixels = (unsigned __int16 *)v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
594 LABEL_17:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
595 v12 = v3->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
596 if ( !v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
597 return 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
598 v3->DecodePCX(Str1a, v12, v3->uWidth);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
599 free(Str1a);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
600 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
601 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
602
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
603
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
604 //----- (0040F037) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
605 signed int RGBTexture::DecodePCX(char *pPcx, unsigned __int16 *pOutPixels, unsigned int uNumPixels)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
606 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
607 signed int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
608 unsigned char test_byte; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
609 unsigned int read_offset; // ebx@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
610 unsigned int row_position; // edi@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
611 unsigned char value; // cl@63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
612 char count; // [sp+50h] [bp-Ch]@43
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
613 unsigned short current_line; // [sp+54h] [bp-8h]@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
614 unsigned short *dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
615 unsigned short *temp_dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
616 PCXHeader1 psx_head1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
617 PCXHeader2 psx_head2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
618 short int width, height;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
619 BYTE color_map[48]; // Colormap for 16-color images
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
620
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
621
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
622 memcpy(&psx_head1, pPcx , 16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
623 memcpy(&color_map, pPcx + 16, 48);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
624 memcpy(&psx_head2, pPcx + 64, 6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
625
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
626
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
627 if (psx_head1.bpp!=8)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
628 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
629 uWidth=(short int )(psx_head1.right-psx_head1.left+1); // word @ 000014
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
630 uHeight=(short int )(psx_head1.bottom-psx_head1.up+1); // word @ 000016
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
631
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
632
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
633 uNumPixels=uWidth*uHeight; // dword @ 000010
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
634
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
635 memset(pOutPixels, 0, uNumPixels * sizeof(__int16));
32
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
636 short i=1;
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
637 while ( (1<<i) !=uWidth)
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
638 {
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
639 ++i;
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
640 if (i >= 15)
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
641 break;
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
642 }
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
643 field_18=i;
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
644 short i_=1;
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
645 while ( (1<<i_) !=uHeight)
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
646 {
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
647 ++i_;
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
648 if (i_ >= 15)
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
649 break;
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
650 }
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
651 field_1A=i_;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
652 switch (field_18)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
653 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
654 case 2: field_1C = 3; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
655 case 3: field_1C = 7; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
656 case 4: field_1C = 15; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
657 case 5: field_1C = 31; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
658 case 6: field_1C = 63; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
659 case 7: field_1C = 127; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
660 case 8: field_1C = 255; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
661 case 9: field_1C = 511; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
662 case 10: field_1C = 1023; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
663 case 11: field_1C = 2047; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
664 case 12: field_1C = 4095; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
665 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
666
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
667 switch (field_1A)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
668 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
669 case 2: field_1E = 3; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
670 case 3: field_1E = 7; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
671 case 4: field_1E = 15; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
672 case 5: field_1E = 31; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
673 case 6: field_1E = 63; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
674 case 7: field_1E = 127; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
675 case 8: field_1E = 255; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
676 case 9: field_1E = 511; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
677 case 10: field_1E = 1023; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
678 case 11: field_1E = 2047; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
679 case 12: field_1E = 4095; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
680 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
681
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
682
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
683 read_offset = 128;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
684 if (psx_head2.planes != 3)
32
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
685 return 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
686 current_line = 0;
32
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
687 if ( uHeight > 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
688 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
689 dec_position = pOutPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
690 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
691 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
692 temp_dec_position = dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
693 row_position = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
694 //decode red line
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
695 if (psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
696 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
697 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
698 {
32
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
699 test_byte = pPcx[read_offset];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
700 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
701 if ((test_byte & 0xC0) == 0xC0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
702 {
32
77de07f99e03 16.10.12 9.09
Ritor1
parents: 1
diff changeset
703 value = pPcx[read_offset];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
704 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
705
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
706 if ((test_byte & 0x3F) > 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
707 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
708 count = test_byte & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
709 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
710 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
711
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
712 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
713 //*temp_dec_position =0xFF000000;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
714 //*temp_dec_position|=(unsigned long)value<<16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
715 *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
716 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
717 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
718 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
719
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
720 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
721 if (row_position == psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
722 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
723 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
724 while (count-- != 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
725 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
726 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
727 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
728 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
729 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
730 //*temp_dec_position =0xFF000000;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
731 //*temp_dec_position|= (unsigned long)test_byte<<16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
732
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
733 *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
734 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
735 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
736 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
737
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
738 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
739 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
740
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
741 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
742 while (row_position < psx_head2.pitch);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
743 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
744
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
745 temp_dec_position = dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
746 row_position=0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
747 //decode green line
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
748 while (row_position < psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
749 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
750 test_byte = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
751 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
752 if ((test_byte & 0xC0) == 0xC0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
753 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
754 value = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
755 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
756 if ((test_byte & 0x3F) > 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
757 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
758 count = test_byte & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
759 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
760 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
761 //*temp_dec_position|= (unsigned int)value<<8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
762 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
763
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
764 *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
765 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
766 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
767
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
768 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
769 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
770 if (row_position == psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
771 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
772
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
773 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
774 while (count-- != 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
775 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
776 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
777 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
778 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
779 //*temp_dec_position |=(unsigned int) test_byte<<8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
780 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
781
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
782 *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
783 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
784 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
785 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
786 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
787 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
788 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
789
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
790 temp_dec_position = dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
791 row_position=0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
792 //decode blue line
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
793 while (row_position < psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
794 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
795 test_byte = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
796 read_offset++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
797 if ((test_byte & 0xC0) == 0xC0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
798 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
799 value = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
800 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
801 if ((test_byte & 0x3F) > 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
802 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
803 count = test_byte & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
804 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
805 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
806 //*temp_dec_position|= value;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
807 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
808
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
809 *temp_dec_position |= value >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
810 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
811
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
812 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
813 if (row_position == psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
814 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
815 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
816 while (count-- != 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
817 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
818 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
819 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
820 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
821 //*temp_dec_position|= test_byte;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
822 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
823 *temp_dec_position |= test_byte >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
824 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
825
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
826 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
827 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
828
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
829 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
830 ++current_line;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
831 dec_position += uWidth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
832 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
833 while (current_line < uHeight);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
834 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
835 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
836 /*
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
837 RGBTexture *v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
838 signed int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
839 unsigned __int16 v6; // ax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
840 unsigned __int16 *v7; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
841 unsigned int v8; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
842 signed int v9; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
843 signed int v10; // ecx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
844 signed int v11; // ebx@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
845 unsigned __int16 *v12; // eax@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
846 int v13; // edi@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
847 int v14; // ebx@41
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
848 char v15; // bl@42
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
849 unsigned __int16 *v16; // eax@50
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
850 int v17; // ebx@51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
851 char v18; // bl@52
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
852 unsigned __int16 *v19; // eax@61
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
853 unsigned __int8 v20; // dl@62
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
854 unsigned __int8 v21; // dl@63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
855 unsigned __int8 v22; // cl@63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
856 char color_map[48]; // [sp+8h] [bp-54h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
857 PCXHeader1 header1; // [sp+38h] [bp-24h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
858 PCXHeader2 header2; // [sp+48h] [bp-14h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
859 unsigned int v26; // [sp+50h] [bp-Ch]@43
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
860 int v27; // [sp+54h] [bp-8h]@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
861 unsigned __int16 *v28; // [sp+58h] [bp-4h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
862 int pOutPixelsa; // [sp+68h] [bp+Ch]@41
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
863 int pOutPixelsb; // [sp+68h] [bp+Ch]@51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
864
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
865 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
866 memcpy(&header1, pPcx, 0x10u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
867 memcpy(color_map, pPcx + 16, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
868 memcpy(&header2, pPcx + 64, 6u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
869 if ( header1.bpp == 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
870 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
871 v6 = header1.right - header1.left + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
872 LOWORD(v7) = header1.bottom - header1.up + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
873 v4->uWidth = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
874 v4->uHeight = (unsigned __int16)v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
875 v7 = (unsigned __int16 *)(signed __int16)v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
876 v28 = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
877 v4->uNumPixels = (signed __int16)v7 * (signed __int16)v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
878 HIWORD(v8) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
879 v9 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
880 while ( 1 << v9 != (signed __int16)v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
881 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
882 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
883 if ( v9 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
884 goto LABEL_8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
885 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
886 v4->field_18 = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
887 LABEL_8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
888 v10 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
889 while ( (unsigned __int16 *)(1 << v10) != v28 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
890 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
891 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
892 if ( v10 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
893 goto LABEL_13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
894 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
895 v4->field_1A = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
896 LABEL_13:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
897 switch ( v4->field_18 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
898 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
899 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
900 v4->field_1C = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
901 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
902 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
903 v4->field_1C = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
904 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
905 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
906 v4->field_1C = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
907 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
908 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
909 v4->field_1C = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
910 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
911 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
912 v4->field_1C = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
913 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
914 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
915 v4->field_1C = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
916 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
917 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
918 v4->field_1C = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
919 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
920 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
921 v4->field_1C = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
922 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
923 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
924 v4->field_1C = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
925 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
926 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
927 v4->field_1C = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
928 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
929 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
930 v4->field_1C = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
931 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
932 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
933 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
934 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
935 switch ( v4->field_1A )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
936 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
937 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
938 v4->field_1E = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
939 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
940 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
941 v4->field_1E = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
942 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
943 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
944 v4->field_1E = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
945 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
946 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
947 v4->field_1E = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
948 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
949 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
950 v4->field_1E = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
951 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
952 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
953 v4->field_1E = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
954 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
955 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
956 v4->field_1E = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
957 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
958 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
959 v4->field_1E = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
960 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
961 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
962 v4->field_1E = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
963 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
964 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
965 v4->field_1E = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
966 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
967 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
968 v4->field_1E = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
969 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
970 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
971 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
972 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
973 v11 = 128;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
974 if ( header2.planes == 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
975 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
976 v27 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
977 if ( (signed int)v28 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
978 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
979 v28 = pOutPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
980 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
981 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
982 v12 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
983 v13 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
984 if ( header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
985 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
986 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
987 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
988 LOBYTE(v8) = pPcx[v11];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
989 v14 = v11 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
990 pOutPixelsa = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
991 if ( (v8 & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
992 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
993 pOutPixelsa = v14 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
994 v15 = pPcx[v14];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
995 if ( (signed int)(v8 & 0x3F) > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
996 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
997 v26 = v8 & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
998 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
999 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1000 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1001 *v12 = LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)v15 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1002 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1003 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1004 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1005 ++v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1006 if ( v13 == (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1007 v12 = &v12[uNumPixels - (unsigned __int16)header2.pitch - 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1008 --v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1009 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1010 while ( v26 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1011 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1012 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1013 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1014 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1015 LOWORD(v8) = (unsigned __int8)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1016 v8 = pRenderer->uTargetRMask & (v8 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1017 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1018 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1019 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1020 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1021 *v12 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1022 ++v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1023 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1024 v11 = pOutPixelsa;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1025 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1026 while ( v13 < (unsigned __int16)header2.pitch );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1027 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1028 v16 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1029 while ( v13 < 2 * (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1030 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1031 LOBYTE(v8) = pPcx[v11];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1032 v17 = v11 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1033 pOutPixelsb = v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1034 if ( (v8 & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1035 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1036 pOutPixelsb = v17 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1037 v18 = pPcx[v17];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1038 if ( (signed int)(v8 & 0x3F) > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1039 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1040 v26 = v8 & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1041 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1042 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1043 *v16 |= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)v18 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1044 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1045 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1046 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1047 ++v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1048 if ( v13 == (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1049 v16 = &v16[uNumPixels - (unsigned __int16)header2.pitch - 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1050 --v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1051 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1052 while ( v26 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1053 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1054 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1055 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1056 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1057 LOWORD(v8) = (unsigned __int8)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1058 v8 = pRenderer->uTargetGMask & (v8 << (LOBYTE(pRenderer->uTargetGBits) + LOBYTE(pRenderer->uTargetBBits) - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1059 *v16 |= v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1060 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1061 ++v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1062 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1063 v11 = pOutPixelsb;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1064 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1065 v19 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1066 while ( v13 < 3 * (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1067 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1068 v20 = pPcx[v11++];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1069 if ( (v20 & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1070 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1071 v21 = v20 & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1072 v22 = pPcx[v11++];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1073 if ( (signed int)v21 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1074 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1075 v26 = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1076 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1077 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1078 *v19 |= v22 >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1079 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1080 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1081 if ( v13 == (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1082 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1083 v8 = uNumPixels - (unsigned __int16)header2.pitch;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1084 v19 = &v19[uNumPixels - (unsigned __int16)header2.pitch - 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1085 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1086 --v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1087 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1088 while ( v26 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1089 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1090 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1091 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1092 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1093 *v19 |= v20 >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1094 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1095 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1096 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1097 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1098 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1099 v28 += uNumPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1100 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1101 while ( v27 < v4->uHeight );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1102 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1103 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1104 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1105 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1106 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1107 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1108 result = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1109 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1110 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1111 */
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1112 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1113
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1114 //----- (0040EAD8) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1115 unsigned int RGBTexture::LoadFromFILE(FILE *pFile, unsigned int mode, unsigned int bCloseFile)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1116 {
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1117 signed int result; // eax@2
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1118 unsigned char test_byte; // edx@3
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1119 //unsigned int read_offset; // ebx@37
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1120 unsigned int row_position; // edi@40
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1121 unsigned char value; // cl@63
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1122 char count; // [sp+50h] [bp-Ch]@43
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1123 unsigned short current_line; // [sp+54h] [bp-8h]@38
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1124 unsigned short *dec_position;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1125 unsigned short *temp_dec_position;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1126 PCXHeader1 psx_head1;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1127 PCXHeader2 psx_head2;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1128 short int width, height;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1129 BYTE color_map[48]; // Colormap for 16-color images
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1130
45
bcc051713d20 BLV render & seffects
Nomad
parents: 43
diff changeset
1131 if (!pFile)
bcc051713d20 BLV render & seffects
Nomad
parents: 43
diff changeset
1132 return 1;
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1133
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1134
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1135 fread(&psx_head1, 1, 16, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1136 fread(&color_map, 1, 48, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1137 fread(&psx_head2, 1, 6, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1138
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1139 if (psx_head1.bpp!=8)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1140 return 3;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1141 uWidth=(short int )(psx_head1.right-psx_head1.left+1); // word @ 000014
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1142 uHeight=(short int )(psx_head1.bottom-psx_head1.up+1); // word @ 000016
45
bcc051713d20 BLV render & seffects
Nomad
parents: 43
diff changeset
1143
bcc051713d20 BLV render & seffects
Nomad
parents: 43
diff changeset
1144
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1145 uNumPixels=uWidth*uHeight; // dword @ 000010
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1146
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1147
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1148 if ( mode == 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1149 {
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1150 if ( pPixels )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1151 {
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1152 pAllocator->FreeChunk(pPixels);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1153 pPixels = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1154 }
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1155 pPixels = (unsigned __int16 *)pAllocator->AllocNamedChunk(
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1156 pPixels,
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1157 2 * uNumPixels + 4,
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1158 pName);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1159 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1160 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1161 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1162 if ( mode != 1 && mode == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1163 {
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1164 pPixels = (unsigned __int16 *)malloc((uNumPixels + 2) * sizeof(unsigned __int16));
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1165 field_20 |= 1;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1166 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1167 }
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1168
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1169
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1170
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1171
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1172 auto pOutPixels = pPixels;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1173
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1174 memset(pOutPixels, 0, uNumPixels * sizeof(__int16));
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1175
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1176 short i=1;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1177 while ( (1<<i) !=uWidth)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1178 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1179 ++i;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1180 if (i >= 15)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1181 break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1182 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1183 field_18=i;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1184 short i_=1;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1185 while ( (1<<i_) !=uHeight)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1186 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1187 ++i_;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1188 if (i_ >= 15)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1189 break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1190 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1191 field_1A=i_;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1192 switch (field_18)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1193 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1194 case 2: field_1C = 3; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1195 case 3: field_1C = 7; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1196 case 4: field_1C = 15; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1197 case 5: field_1C = 31; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1198 case 6: field_1C = 63; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1199 case 7: field_1C = 127; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1200 case 8: field_1C = 255; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1201 case 9: field_1C = 511; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1202 case 10: field_1C = 1023; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1203 case 11: field_1C = 2047; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1204 case 12: field_1C = 4095; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1205 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1206
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1207 switch (field_1A)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1208 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1209 case 2: field_1E = 3; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1210 case 3: field_1E = 7; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1211 case 4: field_1E = 15; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1212 case 5: field_1E = 31; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1213 case 6: field_1E = 63; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1214 case 7: field_1E = 127; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1215 case 8: field_1E = 255; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1216 case 9: field_1E = 511; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1217 case 10: field_1E = 1023; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1218 case 11: field_1E = 2047; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1219 case 12: field_1E = 4095; break;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1220 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1221
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1222
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1223 fseek(pFile, 128 - 70, SEEK_CUR);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1224
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1225
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1226 for (uint y = 0; y < uHeight; ++y)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1227 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1228 unsigned __int16 *pDst = pPixels + y * uWidth;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1229
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1230 uint x = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1231 do
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1232 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1233 uint ctrl = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1234 fread(&ctrl, 1, 1, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1235 if ((ctrl & 0xC0) == 0xC0)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1236 {
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1237 uint uNumPixels = ctrl & 0x3F;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1238 uint clr = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1239 fread(&clr, 1, 1, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1240 for (uint i = 0; i < uNumPixels; ++i)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1241 pDst[x++] = pRenderer->uTargetRMask & (clr << (pRenderer->uTargetGBits +
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1242 pRenderer->uTargetRBits +
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1243 pRenderer->uTargetBBits - 8));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1244 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1245 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1246 {
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1247 pDst[x++] = pRenderer->uTargetRMask & (ctrl << (pRenderer->uTargetGBits +
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1248 pRenderer->uTargetRBits +
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1249 pRenderer->uTargetBBits - 8));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1250 }
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1251 } while (x < psx_head2.pitch);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1252
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1253
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1254
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1255
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1256
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1257 x = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1258 do
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1259 {
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1260 uint ctrl = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1261 fread(&ctrl, 1, 1, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1262 if ((ctrl & 0xC0) == 0xC0)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1263 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1264 uint uNumPixels = ctrl & 0x3F;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1265 uint clr = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1266 fread(&clr, 1, 1, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1267 for (uint i = 0; i < uNumPixels; ++i)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1268 pDst[x++] |= pRenderer->uTargetGMask & (clr << (pRenderer->uTargetGBits +
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1269 pRenderer->uTargetBBits - 8));
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1270 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1271 else
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1272 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1273 pDst[x++] |= pRenderer->uTargetGMask & (ctrl << (pRenderer->uTargetGBits +
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1274 pRenderer->uTargetBBits - 8));
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1275 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1276 } while (x < psx_head2.pitch);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1277
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1278
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1279
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1280
45
bcc051713d20 BLV render & seffects
Nomad
parents: 43
diff changeset
1281
61
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1282 x = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1283 do
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1284 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1285 uint ctrl = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1286 fread(&ctrl, 1, 1, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1287 if ((ctrl & 0xC0) == 0xC0)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1288 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1289 uint uNumPixels = ctrl & 0x3F;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1290 uint clr = 0;
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1291 fread(&clr, 1, 1, pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1292 for (uint i = 0; i < uNumPixels; ++i)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1293 pDst[x++] |= pRenderer->uTargetBMask & (clr >> (8 - pRenderer->uTargetBBits));
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1294 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1295 else
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1296 {
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1297 pDst[x++] |= pRenderer->uTargetBMask & (ctrl >> (8 - pRenderer->uTargetRBits));
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1298 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1299 } while (x < psx_head2.pitch);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1300 }
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1301
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1302 if (bCloseFile)
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1303 fclose(pFile);
05e4b4bd4d64 Savegame preview thumbnails
Nomad
parents: 46
diff changeset
1304 return 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1305 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1306
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1307 //----- (0040E51F) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1308 void RGBTexture::Release()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1309 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1310 RGBTexture *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1311 char v2; // zf@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1312 void *v3; // [sp-4h] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1313
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1314 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1315 v2 = (this->field_20 & 1) == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1316 v3 = this->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1317 this->pName[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1318 if ( v2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1319 pAllocator->FreeChunk(v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1320 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1321 free(v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1322 *(unsigned int *)&v1->field_20 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1323 v1->pPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1324 v1->uNumPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1325 v1->uHeight = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1326 v1->uWidth = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1327 v1->field_1A = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1328 v1->field_18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1329 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1330
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1331 //----- (0040E55E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1332 int RGBTexture::_40E55E(const char *Filename, unsigned int a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1333 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1334 RGBTexture *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1335 signed int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1336 FILE *v5; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1337 char *v6; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1338 int v7; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1339 char v8; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1340 unsigned __int16 v9; // cx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1341 unsigned __int16 v10; // ax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1342 int v11; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1343 char v12; // zf@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1344 void *v13; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1345 signed int v14; // ecx@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1346 signed int v15; // ecx@24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1347 int v16; // eax@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1348 unsigned __int16 *v17; // ecx@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1349 unsigned __int16 *v18; // edi@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1350 signed int v19; // eax@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1351 unsigned __int16 *v20; // edi@64
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1352 signed int v21; // eax@66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1353 unsigned __int16 *v22; // edi@71
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1354 signed int v23; // eax@73
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1355 int v24; // eax@78
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1356 char v25; // [sp+Ch] [bp-54h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1357 char DstBuf; // [sp+3Ch] [bp-24h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1358 char v27; // [sp+3Dh] [bp-23h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1359 char v28; // [sp+3Eh] [bp-22h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1360 char v29; // [sp+3Fh] [bp-21h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1361 int v30; // [sp+40h] [bp-20h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1362 int v31; // [sp+44h] [bp-1Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1363 char v32; // [sp+48h] [bp-18h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1364 char v33; // [sp+4Ah] [bp-16h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1365 char v34; // [sp+4Ch] [bp-14h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1366 char v35; // [sp+4Dh] [bp-13h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1367 unsigned __int16 v36; // [sp+4Eh] [bp-12h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1368 int v37; // [sp+54h] [bp-Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1369 int v38; // [sp+58h] [bp-8h]@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1370 FILE *File; // [sp+5Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1371
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1372 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1373 File = fopen(Filename, "rb");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1374 if ( !File )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1375 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1376 v5 = File;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1377 fread(&DstBuf, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1378 fread(&v27, 1u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1379 fread(&v28, 1u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1380 fread(&v29, 1u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1381 fread(&v30, 2u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1382 fread((char *)&v30 + 2, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1383 fread(&v31, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1384 fread((char *)&v31 + 2, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1385 fread(&v32, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1386 fread(&v33, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1387 fread(&v25, 0x30u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1388 fread(&v34, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1389 fread(&v35, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1390 fread(&v36, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1391 v6 = (char *)Filename;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1392 v37 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1393 v7 = (char *)v3 - Filename;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1394 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1395 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1396 v8 = *v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1397 if ( !*v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1398 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1399 if ( v8 == 46 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1400 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1401 ++v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1402 (v6++)[v7] = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1403 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1404 while ( v37 < 15 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1405 v3->pName[v37] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1406 if ( v29 != 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1407 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1408 v9 = v31 - (short)v30 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1409 v10 = HIWORD(v31) - HIWORD(v30);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1410 v3->uWidth = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1411 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1412 v3->uHeight = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1413 v11 = (signed __int16)v9 * (signed __int16)v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1414 v12 = a3 == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1415 v3->uNumPixels = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1416 if ( v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1417 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1418 if ( v3->pPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1419 pAllocator->FreeChunk(v3->pPixels);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1420 v13 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, v3->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1421 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1422 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1423 if ( a3 != 1 && a3 == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1424 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1425 v13 = operator new(4 * v11 + 8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1426 *(unsigned int *)&v3->field_20 |= 1u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1427 LABEL_16:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1428 v3->pPixels = (unsigned __int16 *)v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1429 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1430 if ( v3->pPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1431 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1432 v14 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1433 while ( 1 << v14 != v3->uWidth )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1434 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1435 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1436 if ( v14 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1437 goto LABEL_24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1438 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1439 v3->field_18 = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1440 LABEL_24:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1441 v15 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1442 while ( 1 << v15 != v3->uHeight )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1443 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1444 ++v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1445 if ( v15 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1446 goto LABEL_29;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1447 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1448 v3->field_1A = v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1449 LABEL_29:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1450 switch ( v3->field_18 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1451 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1452 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1453 v3->field_1C = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1454 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1455 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1456 v3->field_1C = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1457 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1458 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1459 v3->field_1C = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1460 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1461 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1462 v3->field_1C = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1463 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1464 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1465 v3->field_1C = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1466 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1467 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1468 v3->field_1C = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1469 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1470 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1471 v3->field_1C = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1472 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1473 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1474 v3->field_1C = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1475 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1476 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1477 v3->field_1C = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1478 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1479 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1480 v3->field_1C = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1481 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1482 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1483 v3->field_1C = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1484 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1485 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1486 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1487 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1488 switch ( v3->field_1A )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1489 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1490 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1491 v3->field_1E = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1492 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1493 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1494 v3->field_1E = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1495 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1496 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1497 v3->field_1E = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1498 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1499 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1500 v3->field_1E = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1501 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1502 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1503 v3->field_1E = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1504 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1505 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1506 v3->field_1E = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1507 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1508 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1509 v3->field_1E = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1510 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1511 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1512 v3->field_1E = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1513 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1514 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1515 v3->field_1E = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1516 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1517 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1518 v3->field_1E = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1519 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1520 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1521 v3->field_1E = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1522 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1523 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1524 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1525 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1526 fseek(File, 128, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1527 ftell(File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1528 if ( v35 == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1529 Abortf("24bit PCX Only!");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1530 if ( v35 == 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1531 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1532 v37 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1533 if ( v3->uHeight > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1534 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1535 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1536 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1537 v16 = v37 * v3->uWidth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1538 v17 = v3->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1539 v38 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1540 v18 = &v17[v16];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1541 if ( v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1542 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1543 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1544 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1545 fread((char *)&Filename + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1546 if ( (BYTE3(Filename) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1547 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1548 BYTE3(Filename) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1549 fread((char *)&a3 + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1550 v19 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1551 if ( BYTE3(Filename) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1552 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1553 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1554 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1555 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1556 *v18 = LOWORD(pRenderer->uTargetRMask) & (BYTE3(a3) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1557 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1558 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1559 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1560 ++v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1561 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1562 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1563 while ( v19 < BYTE3(Filename) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1564 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1565 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1566 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1567 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1568 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1569 *v18 = LOWORD(pRenderer->uTargetRMask) & (BYTE3(Filename) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1570 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1571 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1572 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1573 ++v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1574 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1575 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1576 while ( v38 < v36 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1577 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1578 v20 = &v3->pPixels[v37 * v3->uWidth];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1579 while ( v38 < 2 * v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1580 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1581 fread((char *)&Filename + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1582 if ( (BYTE3(Filename) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1583 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1584 BYTE3(Filename) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1585 fread((char *)&a3 + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1586 v21 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1587 if ( BYTE3(Filename) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1588 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1589 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1590 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1591 *v20 |= pRenderer->uTargetGMask & (unsigned __int16)(BYTE3(a3) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1592 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1593 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1594 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1595 ++v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1596 ++v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1597 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1598 while ( v21 < BYTE3(Filename) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1599 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1600 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1601 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1602 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1603 *v20 |= pRenderer->uTargetGMask & (unsigned __int16)(BYTE3(Filename) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1604 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1605 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1606 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1607 ++v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1608 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1609 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1610 v22 = &v3->pPixels[v37 * v3->uWidth];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1611 while ( v38 < 3 * v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1612 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1613 fread((char *)&Filename + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1614 if ( (BYTE3(Filename) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1615 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1616 BYTE3(Filename) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1617 fread((char *)&a3 + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1618 v23 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1619 if ( BYTE3(Filename) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1620 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1621 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1622 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1623 *v22 |= BYTE3(a3) >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1624 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1625 ++v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1626 ++v23;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1627 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1628 while ( v23 < BYTE3(Filename) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1629 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1630 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1631 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1632 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1633 *v22 |= BYTE3(Filename) >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1634 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1635 ++v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1636 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1637 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1638 v24 = v3->uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1639 ++v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1640 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1641 while ( v37 < v24 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1642 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1643 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1644 fclose(File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1645 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1646 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1647 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1648 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1649 result = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1650 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1651 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1652 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1653
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1654
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1655 //----- (0040D73D) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1656 RGBTexture::RGBTexture()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1657 {
26
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1658 pName[0] = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1659 pPixels = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1660 uNumPixels = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1661 uHeight = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1662 uWidth = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1663 field_1A = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1664 field_18 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1665 field_20 = 0;
93bf1d5f6a6d Game loading.
Nomad
parents: 1
diff changeset
1666 field_22 = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1667 }