annotate Texture.cpp @ 41:fd64b06a39a8

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