annotate Texture.cpp @ 7:1200e31f08e5

10.10.12
author Серик@ПончиК
date Wed, 10 Oct 2012 21:05:53 +0600
parents ac0fb48cd27a
children 93bf1d5f6a6d 77de07f99e03
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)
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
309 pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1);
0
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 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
405 if (this)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
406 {
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
407 pName[0] = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
408
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
409 if (pBits & 0x0400)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
410 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
411 pAllocator->FreeChunk(pLevelOfDetail0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
412 pAllocator->FreeChunk(pPalette16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
413 pAllocator->FreeChunk(pPalette24);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
414 }
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
415
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
416 pLevelOfDetail0 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
417 pLevelOfDetail1 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
418 pLevelOfDetail2 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
419 pLevelOfDetail3 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
420
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
421 pPalette16 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
422 pPalette24 = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
423
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
424 uSizeOfMaxLevelOfDetail = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
425 uTextureSize = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
426 uTextureHeight = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
427 uTextureWidth = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
428 uHeightLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
429 uWidthLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
430 palette_id1 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
431 palette_id2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
432 pBits &= 0xFFFF0000;
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 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
509 pName[0] = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
510 uSizeOfMaxLevelOfDetail = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
511 uTextureSize = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
512 uTextureHeight = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
513 uTextureWidth = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
514 uHeightLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
515 uWidthLn2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
516 palette_id1 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
517 palette_id2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
518 pLevelOfDetail0 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
519 pLevelOfDetail3 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
520 pLevelOfDetail2 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
521 pLevelOfDetail1 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
522 pPalette16 = 0;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
523 pPalette24 = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
524 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
525
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
526 //----- (0040F414) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
527 int RGBTexture::Load(const char *pContainer, int mode)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
528 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
529 RGBTexture *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
530 FILE *v4; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
531 FILE *v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
532 void *v6; // ebx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
533 unsigned __int16 v7; // ax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
534 unsigned __int16 v8; // cx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
535 int v9; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
536 void *v10; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
537 void *v11; // eax@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
538 unsigned __int16 *v12; // eax@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
539 char color_map[48]; // [sp+Ch] [bp-98h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
540 Texture DstBuf; // [sp+3Ch] [bp-68h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
541 PCXHeader1 header1; // [sp+84h] [bp-20h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
542 PCXHeader2 header2; // [sp+94h] [bp-10h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
543 FILE *File; // [sp+9Ch] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
544 size_t Count; // [sp+A0h] [bp-4h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
545 char *Str1a; // [sp+ACh] [bp+8h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
546
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
547 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
548 v4 = pIcons_LOD->FindContainer(pContainer, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
549 v5 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
550 File = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
551 if ( !v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
552 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
553 sprintfex(pTmpBuf, "Unable to load %s", pContainer);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
554 Abortf(pTmpBuf);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
555 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
556 fread(&DstBuf, 1u, 0x30u, v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
557 Count = DstBuf.uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
558 if ( DstBuf.uDecompressedSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
559 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
560 Str1a = (char *)malloc(DstBuf.uDecompressedSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
561 v6 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
562 fread(v6, 1u, Count, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
563 zlib::MemUnzip(Str1a, &DstBuf.uDecompressedSize, v6, DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
564 DstBuf.uTextureSize = DstBuf.uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
565 pAllocator->FreeChunk(v6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
566 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
567 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
568 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
569 Str1a = (char *)malloc(DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
570 fread(Str1a, 1u, Count, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
571 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
572 memcpy(&header1, Str1a, 0x10u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
573 memcpy(color_map, Str1a + 16, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
574 memcpy(&header2, Str1a + 64, 6u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
575 if ( header1.bpp != 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
576 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
577 v7 = header1.right - header1.left + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
578 v8 = header1.bottom - header1.up + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
579 v3->uWidth = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
580 v3->uHeight = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
581 v9 = (signed __int16)v7 * (signed __int16)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
582 v10 = v3->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
583 v3->uNumPixels = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
584 if ( v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
585 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
586 if ( mode )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
587 goto LABEL_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
588 pAllocator->FreeChunk(v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
589 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
590 if ( !mode )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
591 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
592 v11 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, "16bit PCX");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
593 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
594 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
595 LABEL_14:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
596 if ( mode != 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
597 goto LABEL_17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
598 v11 = malloc(2 * v3->uNumPixels + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
599 *(unsigned int *)&v3->field_20 |= 1u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
600 LABEL_16:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
601 v3->pPixels = (unsigned __int16 *)v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
602 LABEL_17:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
603 v12 = v3->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
604 if ( !v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
605 return 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
606 v3->DecodePCX(Str1a, v12, v3->uWidth);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
607 free(Str1a);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
608 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
609 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
610
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
611
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
612 //----- (0040F037) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
613 signed int RGBTexture::DecodePCX(char *pPcx, unsigned __int16 *pOutPixels, unsigned int uNumPixels)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
614 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
615 signed int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
616 unsigned char test_byte; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
617 unsigned int read_offset; // ebx@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
618 unsigned int row_position; // edi@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
619 unsigned char value; // cl@63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
620 char count; // [sp+50h] [bp-Ch]@43
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
621 unsigned short current_line; // [sp+54h] [bp-8h]@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
622 unsigned short *dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
623 unsigned short *temp_dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
624 PCXHeader1 psx_head1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
625 PCXHeader2 psx_head2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
626 short int width, height;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
627 BYTE color_map[48]; // Colormap for 16-color images
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
628
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
629
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
630 memcpy(&psx_head1, pPcx , 16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
631 memcpy(&color_map, pPcx + 16, 48);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
632 memcpy(&psx_head2, pPcx + 64, 6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
633
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
634
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
635 if (psx_head1.bpp!=8)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
636 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
637 uWidth=(short int )(psx_head1.right-psx_head1.left+1); // word @ 000014
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
638 uHeight=(short int )(psx_head1.bottom-psx_head1.up+1); // word @ 000016
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
639
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
640
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
641 uNumPixels=uWidth*uHeight; // dword @ 000010
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
642
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
643 memset(pOutPixels, 0, uNumPixels * sizeof(__int16));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
644
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
645 for (short i=1; i<=15; i++)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
646 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
647 if ((1<<i)==uWidth)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
648 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
649 field_18=i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
650 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
651 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
652 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
653
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
654 for (short i=1; i<=15; i++)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
655 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
656 if ((1<<i)==uHeight)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
657 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
658 field_1A=i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
659 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
660 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
661 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
662 switch (field_18)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
663 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
664 case 2: field_1C = 3; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
665 case 3: field_1C = 7; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
666 case 4: field_1C = 15; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
667 case 5: field_1C = 31; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
668 case 6: field_1C = 63; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
669 case 7: field_1C = 127; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
670 case 8: field_1C = 255; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
671 case 9: field_1C = 511; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
672 case 10: field_1C = 1023; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
673 case 11: field_1C = 2047; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
674 case 12: field_1C = 4095; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
675 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
676
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
677 switch (field_1A)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
678 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
679 case 2: field_1E = 3; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
680 case 3: field_1E = 7; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
681 case 4: field_1E = 15; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
682 case 5: field_1E = 31; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
683 case 6: field_1E = 63; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
684 case 7: field_1E = 127; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
685 case 8: field_1E = 255; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
686 case 9: field_1E = 511; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
687 case 10: field_1E = 1023; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
688 case 11: field_1E = 2047; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
689 case 12: field_1E = 4095; break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
690 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
691
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
692
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
693 read_offset = 128;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
694 if (psx_head2.planes != 3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
695 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
696 current_line = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
697 if ( uWidth > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
698 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
699 dec_position = pOutPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
700 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
701 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
702 temp_dec_position = dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
703 row_position = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
704 //decode red line
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
705 if (psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
706 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
707 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
708 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
709 test_byte = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
710 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
711 if ((test_byte & 0xC0) == 0xC0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
712 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
713 value = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
714 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
715
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
716 if ((test_byte & 0x3F) > 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
717 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
718 count = test_byte & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
719 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
720 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
721
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
722 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
723 //*temp_dec_position =0xFF000000;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
724 //*temp_dec_position|=(unsigned long)value<<16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
725 *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
726 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
727 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
728 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
729
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
730 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
731 if (row_position == psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
732 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
733 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
734 while (count-- != 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
735 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
736 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
737 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
738 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
739 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
740 //*temp_dec_position =0xFF000000;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
741 //*temp_dec_position|= (unsigned long)test_byte<<16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
742
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
743 *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
744 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
745 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
746 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
747
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
748 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
749 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
750
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
751 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
752 while (row_position < psx_head2.pitch);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
753 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
754
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
755 temp_dec_position = dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
756 row_position=0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
757 //decode green line
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
758 while (row_position < psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
759 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
760 test_byte = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
761 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
762 if ((test_byte & 0xC0) == 0xC0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
763 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
764 value = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
765 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
766 if ((test_byte & 0x3F) > 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
767 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
768 count = test_byte & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
769 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
770 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
771 //*temp_dec_position|= (unsigned int)value<<8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
772 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
773
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
774 *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
775 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
776 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
777
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
778 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
779 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
780 if (row_position == psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
781 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
782
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
783 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
784 while (count-- != 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
785 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
786 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
787 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
788 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
789 //*temp_dec_position |=(unsigned int) test_byte<<8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
790 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
791
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
792 *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
793 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
794 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
795 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
796 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
797 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
798 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
799
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
800 temp_dec_position = dec_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
801 row_position=0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
802 //decode blue line
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
803 while (row_position < psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
804 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
805 test_byte = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
806 read_offset++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
807 if ((test_byte & 0xC0) == 0xC0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
808 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
809 value = *(pPcx + read_offset);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
810 ++read_offset;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
811 if ((test_byte & 0x3F) > 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
812 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
813 count = test_byte & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
814 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
815 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
816 //*temp_dec_position|= value;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
817 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
818
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
819 *temp_dec_position |= value >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
820 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
821
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
822 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
823 if (row_position == psx_head2.pitch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
824 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
825 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
826 while (count-- != 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
827 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
828 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
829 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
830 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
831 //*temp_dec_position|= test_byte;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
832 //temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
833 *temp_dec_position |= test_byte >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
834 temp_dec_position++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
835
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
836 ++row_position;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
837 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
838
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
839 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
840 ++current_line;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
841 dec_position += uWidth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
842 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
843 while (current_line < uHeight);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
844 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
845 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
846 /*
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
847 RGBTexture *v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
848 signed int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
849 unsigned __int16 v6; // ax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
850 unsigned __int16 *v7; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
851 unsigned int v8; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
852 signed int v9; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
853 signed int v10; // ecx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
854 signed int v11; // ebx@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
855 unsigned __int16 *v12; // eax@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
856 int v13; // edi@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
857 int v14; // ebx@41
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
858 char v15; // bl@42
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
859 unsigned __int16 *v16; // eax@50
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
860 int v17; // ebx@51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
861 char v18; // bl@52
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
862 unsigned __int16 *v19; // eax@61
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
863 unsigned __int8 v20; // dl@62
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
864 unsigned __int8 v21; // dl@63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
865 unsigned __int8 v22; // cl@63
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
866 char color_map[48]; // [sp+8h] [bp-54h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
867 PCXHeader1 header1; // [sp+38h] [bp-24h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
868 PCXHeader2 header2; // [sp+48h] [bp-14h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
869 unsigned int v26; // [sp+50h] [bp-Ch]@43
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
870 int v27; // [sp+54h] [bp-8h]@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
871 unsigned __int16 *v28; // [sp+58h] [bp-4h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
872 int pOutPixelsa; // [sp+68h] [bp+Ch]@41
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
873 int pOutPixelsb; // [sp+68h] [bp+Ch]@51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
874
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
875 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
876 memcpy(&header1, pPcx, 0x10u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
877 memcpy(color_map, pPcx + 16, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
878 memcpy(&header2, pPcx + 64, 6u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
879 if ( header1.bpp == 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
880 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
881 v6 = header1.right - header1.left + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
882 LOWORD(v7) = header1.bottom - header1.up + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
883 v4->uWidth = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
884 v4->uHeight = (unsigned __int16)v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
885 v7 = (unsigned __int16 *)(signed __int16)v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
886 v28 = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
887 v4->uNumPixels = (signed __int16)v7 * (signed __int16)v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
888 HIWORD(v8) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
889 v9 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
890 while ( 1 << v9 != (signed __int16)v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
891 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
892 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
893 if ( v9 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
894 goto LABEL_8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
895 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
896 v4->field_18 = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
897 LABEL_8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
898 v10 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
899 while ( (unsigned __int16 *)(1 << v10) != v28 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
900 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
901 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
902 if ( v10 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
903 goto LABEL_13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
904 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
905 v4->field_1A = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
906 LABEL_13:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
907 switch ( v4->field_18 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
908 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
909 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
910 v4->field_1C = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
911 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
912 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
913 v4->field_1C = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
914 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
915 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
916 v4->field_1C = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
917 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
918 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
919 v4->field_1C = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
920 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
921 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
922 v4->field_1C = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
923 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
924 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
925 v4->field_1C = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
926 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
927 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
928 v4->field_1C = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
929 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
930 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
931 v4->field_1C = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
932 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
933 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
934 v4->field_1C = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
935 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
936 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
937 v4->field_1C = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
938 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
939 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
940 v4->field_1C = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
941 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
942 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
943 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
944 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
945 switch ( v4->field_1A )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
946 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
947 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
948 v4->field_1E = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
949 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
950 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
951 v4->field_1E = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
952 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
953 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
954 v4->field_1E = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
955 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
956 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
957 v4->field_1E = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
958 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
959 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
960 v4->field_1E = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
961 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
962 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
963 v4->field_1E = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
964 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
965 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
966 v4->field_1E = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
967 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
968 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
969 v4->field_1E = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
970 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
971 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
972 v4->field_1E = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
973 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
974 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
975 v4->field_1E = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
976 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
977 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
978 v4->field_1E = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
979 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
980 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
981 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
982 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
983 v11 = 128;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
984 if ( header2.planes == 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
985 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
986 v27 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
987 if ( (signed int)v28 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
988 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
989 v28 = pOutPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
990 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
991 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
992 v12 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
993 v13 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
994 if ( header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
995 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
996 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
997 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
998 LOBYTE(v8) = pPcx[v11];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
999 v14 = v11 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1000 pOutPixelsa = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1001 if ( (v8 & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1002 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1003 pOutPixelsa = v14 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1004 v15 = pPcx[v14];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1005 if ( (signed int)(v8 & 0x3F) > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1006 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1007 v26 = v8 & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1008 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1009 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1010 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1011 *v12 = LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)v15 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1012 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1013 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1014 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1015 ++v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1016 if ( v13 == (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1017 v12 = &v12[uNumPixels - (unsigned __int16)header2.pitch - 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1018 --v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1019 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1020 while ( v26 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1021 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1022 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1023 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1024 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1025 LOWORD(v8) = (unsigned __int8)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1026 v8 = pRenderer->uTargetRMask & (v8 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1027 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1028 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1029 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1030 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1031 *v12 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1032 ++v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1033 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1034 v11 = pOutPixelsa;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1035 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1036 while ( v13 < (unsigned __int16)header2.pitch );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1037 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1038 v16 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1039 while ( v13 < 2 * (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1040 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1041 LOBYTE(v8) = pPcx[v11];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1042 v17 = v11 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1043 pOutPixelsb = v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1044 if ( (v8 & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1045 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1046 pOutPixelsb = v17 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1047 v18 = pPcx[v17];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1048 if ( (signed int)(v8 & 0x3F) > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1049 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1050 v26 = v8 & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1051 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1052 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1053 *v16 |= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)v18 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1054 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1055 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1056 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1057 ++v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1058 if ( v13 == (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1059 v16 = &v16[uNumPixels - (unsigned __int16)header2.pitch - 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1060 --v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1061 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1062 while ( v26 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1063 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1064 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1065 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1066 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1067 LOWORD(v8) = (unsigned __int8)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1068 v8 = pRenderer->uTargetGMask & (v8 << (LOBYTE(pRenderer->uTargetGBits) + LOBYTE(pRenderer->uTargetBBits) - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1069 *v16 |= v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1070 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1071 ++v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1072 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1073 v11 = pOutPixelsb;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1074 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1075 v19 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1076 while ( v13 < 3 * (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1077 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1078 v20 = pPcx[v11++];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1079 if ( (v20 & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1080 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1081 v21 = v20 & 0x3F;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1082 v22 = pPcx[v11++];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1083 if ( (signed int)v21 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1084 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1085 v26 = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1086 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1087 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1088 *v19 |= v22 >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1089 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1090 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1091 if ( v13 == (unsigned __int16)header2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1092 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1093 v8 = uNumPixels - (unsigned __int16)header2.pitch;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1094 v19 = &v19[uNumPixels - (unsigned __int16)header2.pitch - 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1095 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1096 --v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1097 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1098 while ( v26 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1099 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1100 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1101 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1102 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1103 *v19 |= v20 >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1104 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1105 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1106 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1107 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1108 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1109 v28 += uNumPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1110 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1111 while ( v27 < v4->uHeight );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1112 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1113 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1114 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1115 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1116 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1117 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1118 result = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1119 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1120 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1121 */
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1122 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1123
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1124 //----- (0040EAD8) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1125 unsigned int RGBTexture::LoadFromFILE(FILE *pFile, unsigned int mode, unsigned int bCloseFile)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1126 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1127 RGBTexture *v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1128 unsigned int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1129 unsigned int v6; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1130 unsigned __int16 v7; // cx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1131 unsigned __int16 v8; // ax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1132 unsigned int v9; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1133 char v10; // zf@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1134 signed int v11; // ecx@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1135 int v12; // ebx@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1136 signed int v13; // ecx@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1137 int v14; // ebx@52
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1138 unsigned __int16 *v15; // edi@52
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1139 __int16 v16; // ax@54
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1140 unsigned __int16 *v17; // edi@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1141 __int16 v18; // ax@61
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1142 unsigned __int16 *v19; // edi@66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1143 unsigned __int16 v20; // ax@68
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1144 int v21; // eax@73
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1145 char DstBuf[60]; // [sp+Ch] [bp-90h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1146 char pColorMap[48]; // [sp+48h] [bp-54h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1147 PCXHeader1 pcxh1; // [sp+78h] [bp-24h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1148 PCXHeader2 pcxh2; // [sp+88h] [bp-14h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1149 int v26; // [sp+90h] [bp-Ch]@51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1150 int v27; // [sp+94h] [bp-8h]@54
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1151 unsigned __int8 v28; // [sp+9Bh] [bp-1h]@54
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1152
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1153 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1154 if ( pFile )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1155 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1156 fread(&pcxh1, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1157 fread(&pcxh1.version, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1158 fread(&pcxh1.encoding, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1159 fread(&pcxh1.bpp, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1160 v6 = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1161 fread(&pcxh1.left, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1162 fread(&pcxh1.up, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1163 fread(&pcxh1.right, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1164 fread(&pcxh1.bottom, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1165 fread(&pcxh1.hres, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1166 fread(&pcxh1.vres, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1167 fread(pColorMap, 0x30u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1168 fread(&pcxh2, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1169 fread(&pcxh2.planes, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1170 fread(&pcxh2.pitch, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1171 fread(&pcxh2.palette_info, 2u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1172 fread(DstBuf, 58u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1173 if ( pcxh1.bpp == 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1174 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1175 v7 = pcxh1.right - pcxh1.left + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1176 v8 = pcxh1.bottom - pcxh1.up;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1177 v4->uWidth = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1178 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1179 v4->uHeight = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1180 v9 = (signed __int16)v7 * (signed __int16)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1181 v10 = mode == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1182 v4->uNumPixels = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1183 if ( v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1184 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1185 if ( v4->pPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1186 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1187 pAllocator->FreeChunk(v4->pPixels);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1188 v4->pPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1189 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1190 v4->pPixels = (unsigned __int16 *)pAllocator->AllocNamedChunk(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1191 v4->pPixels,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1192 2 * v4->uNumPixels + 4,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1193 v4->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1194 v6 = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1195 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1196 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1197 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1198 if ( mode != 1 && mode == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1199 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1200 operator new(2 * v9 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1201 v4->pPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1202 *(unsigned int *)&v4->field_20 |= 1u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1203 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1204 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1205 if ( v4->pPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1206 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1207 v11 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1208 while ( 1 << v11 != v4->uWidth )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1209 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1210 ++v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1211 if ( v11 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1212 goto LABEL_19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1213 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1214 v4->field_18 = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1215 LABEL_19:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1216 v12 = v4->uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1217 v13 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1218 while ( 1 << v13 != v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1219 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1220 ++v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1221 if ( v13 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1222 goto LABEL_24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1223 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1224 v4->field_1A = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1225 LABEL_24:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1226 switch ( v4->field_18 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1227 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1228 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1229 v4->field_1C = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1230 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1231 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1232 v4->field_1C = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1233 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1234 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1235 v4->field_1C = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1236 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1237 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1238 v4->field_1C = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1239 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1240 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1241 v4->field_1C = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1242 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1243 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1244 v4->field_1C = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1245 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1246 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1247 v4->field_1C = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1248 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1249 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1250 v4->field_1C = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1251 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1252 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1253 v4->field_1C = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1254 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1255 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1256 v4->field_1C = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1257 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1258 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1259 v4->field_1C = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1260 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1261 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1262 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1263 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1264 switch ( v4->field_1A )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1265 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1266 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1267 v4->field_1E = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1268 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1269 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1270 v4->field_1E = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1271 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1272 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1273 v4->field_1E = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1274 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1275 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1276 v4->field_1E = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1277 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1278 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1279 v4->field_1E = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1280 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1281 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1282 v4->field_1E = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1283 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1284 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1285 v4->field_1E = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1286 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1287 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1288 v4->field_1E = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1289 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1290 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1291 v4->field_1E = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1292 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1293 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1294 v4->field_1E = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1295 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1296 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1297 v4->field_1E = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1298 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1299 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1300 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1301 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1302 if ( pcxh2.planes == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1303 Abortf("24bit PCX Only!");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1304 if ( pcxh2.planes == 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1305 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1306 v26 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1307 if ( v12 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1308 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1309 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1310 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1311 v14 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1312 v15 = &v4->pPixels[v26 * v4->uWidth];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1313 if ( pcxh2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1314 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1315 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1316 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1317 fread((char *)&mode + 3, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1318 if ( (BYTE3(mode) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1319 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1320 BYTE3(mode) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1321 fread(&v28, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1322 v27 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1323 v16 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1324 if ( BYTE3(mode) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1325 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1326 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1327 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1328 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1329 *v15 = LOWORD(pRenderer->uTargetRMask) & (v16 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1330 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1331 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1332 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1333 ++v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1334 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1335 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1336 while ( v27 < BYTE3(mode) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1337 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1338 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1339 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1340 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1341 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1342 *v15 = LOWORD(pRenderer->uTargetRMask) & (BYTE3(mode) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1343 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1344 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1345 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1346 ++v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1347 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1348 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1349 while ( v14 < (unsigned __int16)pcxh2.pitch );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1350 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1351 v17 = &v4->pPixels[v26 * v4->uWidth];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1352 while ( v14 < 2 * (unsigned __int16)pcxh2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1353 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1354 fread((char *)&mode + 3, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1355 if ( (BYTE3(mode) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1356 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1357 BYTE3(mode) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1358 fread(&v28, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1359 v27 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1360 v18 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1361 if ( BYTE3(mode) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1362 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1363 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1364 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1365 *v17 |= pRenderer->uTargetGMask & (unsigned __int16)(v18 << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1366 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1367 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1368 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1369 ++v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1370 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1371 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1372 while ( v27 < BYTE3(mode) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1373 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1374 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1375 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1376 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1377 *v17 |= pRenderer->uTargetGMask & (unsigned __int16)(BYTE3(mode) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1378 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1379 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1380 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1381 ++v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1382 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1383 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1384 v19 = &v4->pPixels[v26 * v4->uWidth];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1385 while ( v14 < 3 * (unsigned __int16)pcxh2.pitch )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1386 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1387 fread((char *)&mode + 3, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1388 if ( (BYTE3(mode) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1389 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1390 BYTE3(mode) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1391 fread(&v28, 1u, 1u, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1392 v27 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1393 v20 = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1394 if ( BYTE3(mode) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1395 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1396 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1397 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1398 *v19 |= v20 >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1399 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1400 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1401 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1402 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1403 while ( v27 < BYTE3(mode) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1404 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1405 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1406 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1407 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1408 *v19 |= BYTE3(mode) >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1409 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1410 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1411 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1412 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1413 v21 = v4->uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1414 ++v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1415 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1416 while ( v26 < v21 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1417 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1418 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1419 if ( bCloseFile )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1420 fclose(pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1421 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1422 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1423 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1424 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1425 result = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1426 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1427 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1428 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1429 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1430 result = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1431 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1432 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1433 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1434 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1435 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1436 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1437 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1438 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1439
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1440 //----- (0040E51F) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1441 void RGBTexture::Release()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1442 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1443 RGBTexture *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1444 char v2; // zf@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1445 void *v3; // [sp-4h] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1446
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1447 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1448 v2 = (this->field_20 & 1) == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1449 v3 = this->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1450 this->pName[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1451 if ( v2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1452 pAllocator->FreeChunk(v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1453 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1454 free(v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1455 *(unsigned int *)&v1->field_20 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1456 v1->pPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1457 v1->uNumPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1458 v1->uHeight = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1459 v1->uWidth = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1460 v1->field_1A = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1461 v1->field_18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1462 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1463
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1464 //----- (0040E55E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1465 int RGBTexture::_40E55E(const char *Filename, unsigned int a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1466 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1467 RGBTexture *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1468 signed int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1469 FILE *v5; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1470 char *v6; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1471 int v7; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1472 char v8; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1473 unsigned __int16 v9; // cx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1474 unsigned __int16 v10; // ax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1475 int v11; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1476 char v12; // zf@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1477 void *v13; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1478 signed int v14; // ecx@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1479 signed int v15; // ecx@24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1480 int v16; // eax@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1481 unsigned __int16 *v17; // ecx@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1482 unsigned __int16 *v18; // edi@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1483 signed int v19; // eax@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1484 unsigned __int16 *v20; // edi@64
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1485 signed int v21; // eax@66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1486 unsigned __int16 *v22; // edi@71
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1487 signed int v23; // eax@73
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1488 int v24; // eax@78
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1489 char v25; // [sp+Ch] [bp-54h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1490 char DstBuf; // [sp+3Ch] [bp-24h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1491 char v27; // [sp+3Dh] [bp-23h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1492 char v28; // [sp+3Eh] [bp-22h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1493 char v29; // [sp+3Fh] [bp-21h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1494 int v30; // [sp+40h] [bp-20h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1495 int v31; // [sp+44h] [bp-1Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1496 char v32; // [sp+48h] [bp-18h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1497 char v33; // [sp+4Ah] [bp-16h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1498 char v34; // [sp+4Ch] [bp-14h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1499 char v35; // [sp+4Dh] [bp-13h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1500 unsigned __int16 v36; // [sp+4Eh] [bp-12h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1501 int v37; // [sp+54h] [bp-Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1502 int v38; // [sp+58h] [bp-8h]@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1503 FILE *File; // [sp+5Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1504
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1505 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1506 File = fopen(Filename, "rb");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1507 if ( !File )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1508 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1509 v5 = File;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1510 fread(&DstBuf, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1511 fread(&v27, 1u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1512 fread(&v28, 1u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1513 fread(&v29, 1u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1514 fread(&v30, 2u, 1u, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1515 fread((char *)&v30 + 2, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1516 fread(&v31, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1517 fread((char *)&v31 + 2, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1518 fread(&v32, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1519 fread(&v33, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1520 fread(&v25, 0x30u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1521 fread(&v34, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1522 fread(&v35, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1523 fread(&v36, 2u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1524 v6 = (char *)Filename;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1525 v37 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1526 v7 = (char *)v3 - Filename;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1527 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1528 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1529 v8 = *v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1530 if ( !*v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1531 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1532 if ( v8 == 46 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1533 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1534 ++v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1535 (v6++)[v7] = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1536 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1537 while ( v37 < 15 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1538 v3->pName[v37] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1539 if ( v29 != 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1540 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1541 v9 = v31 - (short)v30 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1542 v10 = HIWORD(v31) - HIWORD(v30);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1543 v3->uWidth = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1544 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1545 v3->uHeight = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1546 v11 = (signed __int16)v9 * (signed __int16)v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1547 v12 = a3 == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1548 v3->uNumPixels = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1549 if ( v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1550 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1551 if ( v3->pPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1552 pAllocator->FreeChunk(v3->pPixels);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1553 v13 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, v3->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1554 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1555 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1556 if ( a3 != 1 && a3 == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1557 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1558 v13 = operator new(4 * v11 + 8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1559 *(unsigned int *)&v3->field_20 |= 1u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1560 LABEL_16:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1561 v3->pPixels = (unsigned __int16 *)v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1562 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1563 if ( v3->pPixels )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1564 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1565 v14 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1566 while ( 1 << v14 != v3->uWidth )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1567 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1568 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1569 if ( v14 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1570 goto LABEL_24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1571 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1572 v3->field_18 = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1573 LABEL_24:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1574 v15 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1575 while ( 1 << v15 != v3->uHeight )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1576 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1577 ++v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1578 if ( v15 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1579 goto LABEL_29;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1580 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1581 v3->field_1A = v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1582 LABEL_29:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1583 switch ( v3->field_18 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1584 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1585 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1586 v3->field_1C = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1587 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1588 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1589 v3->field_1C = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1590 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1591 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1592 v3->field_1C = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1593 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1594 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1595 v3->field_1C = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1596 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1597 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1598 v3->field_1C = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1599 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1600 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1601 v3->field_1C = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1602 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1603 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1604 v3->field_1C = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1605 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1606 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1607 v3->field_1C = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1608 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1609 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1610 v3->field_1C = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1611 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1612 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1613 v3->field_1C = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1614 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1615 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1616 v3->field_1C = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1617 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1618 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1619 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1620 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1621 switch ( v3->field_1A )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1622 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1623 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1624 v3->field_1E = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1625 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1626 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1627 v3->field_1E = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1628 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1629 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1630 v3->field_1E = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1631 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1632 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1633 v3->field_1E = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1634 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1635 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1636 v3->field_1E = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1637 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1638 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1639 v3->field_1E = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1640 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1641 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1642 v3->field_1E = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1643 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1644 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1645 v3->field_1E = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1646 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1647 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1648 v3->field_1E = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1649 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1650 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1651 v3->field_1E = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1652 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1653 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1654 v3->field_1E = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1655 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1656 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1657 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1658 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1659 fseek(File, 128, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1660 ftell(File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1661 if ( v35 == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1662 Abortf("24bit PCX Only!");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1663 if ( v35 == 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1664 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1665 v37 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1666 if ( v3->uHeight > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1667 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1668 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1669 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1670 v16 = v37 * v3->uWidth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1671 v17 = v3->pPixels;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1672 v38 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1673 v18 = &v17[v16];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1674 if ( v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1675 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1676 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1677 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1678 fread((char *)&Filename + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1679 if ( (BYTE3(Filename) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1680 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1681 BYTE3(Filename) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1682 fread((char *)&a3 + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1683 v19 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1684 if ( BYTE3(Filename) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1685 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1686 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1687 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1688 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1689 *v18 = LOWORD(pRenderer->uTargetRMask) & (BYTE3(a3) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1690 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1691 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1692 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1693 ++v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1694 ++v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1695 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1696 while ( v19 < BYTE3(Filename) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1697 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1698 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1699 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1700 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1701 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1702 *v18 = LOWORD(pRenderer->uTargetRMask) & (BYTE3(Filename) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1703 + LOBYTE(pRenderer->uTargetRBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1704 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1705 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1706 ++v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1707 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1708 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1709 while ( v38 < v36 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1710 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1711 v20 = &v3->pPixels[v37 * v3->uWidth];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1712 while ( v38 < 2 * v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1713 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1714 fread((char *)&Filename + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1715 if ( (BYTE3(Filename) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1716 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1717 BYTE3(Filename) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1718 fread((char *)&a3 + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1719 v21 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1720 if ( BYTE3(Filename) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1721 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1722 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1723 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1724 *v20 |= pRenderer->uTargetGMask & (unsigned __int16)(BYTE3(a3) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1725 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1726 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1727 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1728 ++v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1729 ++v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1730 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1731 while ( v21 < BYTE3(Filename) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1732 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1733 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1734 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1735 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1736 *v20 |= pRenderer->uTargetGMask & (unsigned __int16)(BYTE3(Filename) << (LOBYTE(pRenderer->uTargetGBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1737 + LOBYTE(pRenderer->uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1738 - 8));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1739 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1740 ++v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1741 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1742 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1743 v22 = &v3->pPixels[v37 * v3->uWidth];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1744 while ( v38 < 3 * v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1745 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1746 fread((char *)&Filename + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1747 if ( (BYTE3(Filename) & 0xC0) == -64 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1748 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1749 BYTE3(Filename) &= 0x3Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1750 fread((char *)&a3 + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1751 v23 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1752 if ( BYTE3(Filename) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1753 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1754 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1755 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1756 *v22 |= BYTE3(a3) >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1757 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1758 ++v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1759 ++v23;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1760 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1761 while ( v23 < BYTE3(Filename) );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1762 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1763 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1764 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1765 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1766 *v22 |= BYTE3(Filename) >> (8 - LOBYTE(pRenderer->uTargetBBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1767 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1768 ++v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1769 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1770 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1771 v24 = v3->uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1772 ++v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1773 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1774 while ( v37 < v24 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1775 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1776 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1777 fclose(File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1778 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1779 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1780 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1781 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1782 result = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1783 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1784 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1785 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1786
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1787
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1788 //----- (0040D73D) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1789 RGBTexture::RGBTexture()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1790 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1791 this->pName[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1792 this->pPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1793 this->uNumPixels = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1794 this->uHeight = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1795 this->uWidth = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1796 this->field_1A = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1797 this->field_18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1798 this->field_20 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1799 this->field_22 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1800 }