annotate Texture.cpp @ 0:8b8875f5b359

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