0
|
1 #pragma once
|
|
2 #include <stdio.h>
|
|
3
|
|
4 #include "lib\legacy_dx\d3d.h"
|
|
5 #include "OSAPI.h"
|
|
6
|
|
7 #include "Sprites.h"
|
|
8 #include "VectorTypes.h"
|
|
9
|
|
10 struct stru148;
|
|
11 struct Texture;
|
|
12 struct RGBTexture;
|
|
13 struct RenderBillboardTransform_local0;
|
|
14 struct ODMFace;
|
|
15
|
|
16
|
|
17 /* 119 */
|
|
18 #pragma pack(push, 1)
|
|
19 struct RenderVertexSoft
|
|
20 {
|
|
21 Vec3_float_ vWorldPosition;
|
|
22 Vec3_float_ vWorldViewPosition;
|
|
23 float vWorldViewProjX;
|
|
24 float vWorldViewProjY;
|
|
25 float flt_20;
|
|
26 float u;
|
|
27 float v;
|
|
28 float flt_2C;
|
|
29 };
|
|
30 #pragma pack(pop)
|
|
31
|
|
32
|
|
33
|
|
34 /* 112 */
|
|
35 #pragma pack(push, 1)
|
|
36 struct RenderVertexD3D3
|
|
37 {
|
|
38 Vec3_float_ pos;
|
|
39 float rhw;
|
|
40 unsigned int diffuse;
|
|
41 unsigned int specular;
|
|
42 Vec2_float_ texcoord;
|
|
43 };
|
|
44
|
|
45
|
|
46
|
|
47 /* 161 */
|
|
48 #pragma pack(push, 1)
|
|
49 struct RenderBillboard
|
|
50 {
|
|
51 int field_0;
|
|
52 int field_4;
|
|
53 float flt_8;
|
|
54 float flt_C;
|
|
55 int sZValue;
|
|
56 int field_14;
|
|
57 unsigned __int16 uHwSpriteID;
|
|
58 __int16 uPalette;
|
|
59 __int16 uIndoorSectorID;
|
|
60 __int16 field_1E;
|
|
61 __int16 field_20;
|
|
62 __int16 field_22;
|
|
63 __int16 field_24;
|
|
64 __int16 field_26;
|
|
65 __int16 field_28;
|
|
66 __int16 field_2A;
|
|
67 int field_2C_prolly_tint;
|
|
68 SpriteFrame *pSpriteFrame;
|
|
69 };
|
|
70 #pragma pack(pop)
|
|
71
|
|
72
|
|
73 #pragma pack(push, 1)
|
|
74 struct RenderD3D__DevInfo
|
|
75 {
|
|
76 unsigned int bIsDeviceCompatible;
|
|
77 char *pName;
|
|
78 char *pDescription;
|
|
79 GUID *pGUID;
|
|
80 unsigned int uCaps;
|
|
81 char *pDriverName;
|
|
82 char *pDeviceDesc;
|
|
83 char *pDDraw4DevDesc;
|
|
84 GUID *pDirectDrawGUID;
|
|
85 int uVideoMem;
|
|
86 };
|
|
87 #pragma pack(pop)
|
|
88
|
|
89
|
|
90
|
|
91 #pragma pack(push, 1)
|
|
92 struct RenderD3D_D3DDevDesc
|
|
93 {
|
|
94 int field_0;
|
|
95 int field_4;
|
|
96 int field_8;
|
|
97 int field_C;
|
|
98 int field_10;
|
|
99 char *pDriverName;
|
|
100 char *pDeviceDesc;
|
|
101 char *pDDraw4DevDesc;
|
|
102 GUID *pGUID;
|
|
103 unsigned int uVideoMem;
|
|
104 };
|
|
105 #pragma pack(pop)
|
|
106
|
|
107
|
|
108
|
|
109
|
|
110
|
|
111
|
|
112
|
|
113
|
|
114
|
|
115 /* 280 */
|
|
116 #pragma pack(push, 1)
|
|
117 struct HWLTexture
|
|
118 {
|
2
|
119 inline HWLTexture():
|
|
120 field_0(0), field_4(0), field_8(0),
|
|
121 field_C(0), field_10(0), field_14(0)
|
|
122 {}
|
|
123
|
0
|
124 int field_0;
|
|
125 int field_4;
|
|
126 int field_8;
|
|
127 int field_C;
|
|
128 int field_10;
|
|
129 int field_14;
|
|
130 int field_18;
|
|
131 int field_1C;
|
|
132 int field_20;
|
|
133 int field_24;
|
|
134 unsigned int uWidth;
|
|
135 unsigned int uHeight;
|
|
136 int field_30;
|
|
137 int field_34;
|
|
138 unsigned __int16 *pPixels;
|
|
139 };
|
|
140 #pragma pack(pop)
|
|
141
|
|
142
|
|
143 /* 185 */
|
|
144 #pragma pack(push, 1)
|
|
145 struct RenderHWLContainer
|
|
146 {
|
|
147 RenderHWLContainer();
|
|
148 bool Load(const wchar_t *pFilename);
|
|
149 bool Release();
|
|
150
|
|
151 HWLTexture *LoadTexture(const char *pName, int bMipMaps);
|
|
152
|
|
153 FILE *pFile;
|
|
154 uint uSignature;
|
|
155 unsigned int uDataOffset;
|
|
156 unsigned int uNumItems;
|
|
157 char *pSpriteNames[50000];
|
|
158 int pSpriteOffsets[50000];
|
|
159 int bDumpDebug;
|
|
160 int field_61A94_scale_hwls_to_half;
|
|
161 };
|
|
162 #pragma pack(pop)
|
|
163
|
|
164
|
|
165
|
|
166 /* 242 */
|
|
167 #pragma pack(push, 1)
|
|
168 struct RenderBillboardD3D
|
|
169 {
|
|
170 IDirect3DTexture2 *pTexture;
|
|
171 unsigned int uNumVertices;
|
|
172 RenderVertexD3D3 pQuards[4];
|
|
173 float flt_88;
|
|
174 unsigned int bOpaque;
|
|
175 int field_90;
|
|
176 int field_94;
|
|
177 unsigned int uParentBillboardID;
|
|
178 };
|
|
179 #pragma pack(pop)
|
|
180
|
|
181
|
|
182
|
|
183
|
|
184 #pragma pack(push, 1)
|
|
185 struct RenderD3D_aux
|
|
186 {
|
|
187 RenderD3D__DevInfo *pInfo;
|
|
188 RenderD3D_D3DDevDesc *ptr_4;
|
|
189 };
|
|
190 #pragma pack(pop)
|
|
191
|
|
192
|
|
193
|
|
194 /* 183 */
|
|
195 #pragma pack(push, 1)
|
|
196 struct RenderD3D
|
|
197 {
|
|
198 RenderD3D();
|
|
199
|
|
200 static bool DoesRaiseExceptions();
|
|
201
|
|
202 void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices);
|
|
203 void Release();
|
|
204 bool CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd);
|
|
205 unsigned int GetDeviceCaps();
|
|
206 void ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear);
|
|
207 void Present(bool bForceBlit);
|
1
|
208 bool CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim);
|
0
|
209 void HandleLostResources();
|
|
210
|
|
211
|
|
212 unsigned int bWindowed;
|
|
213 int field_4;
|
|
214 int field_8;
|
|
215 HWND hWindow;
|
|
216 int field_10;
|
|
217 int field_14;
|
|
218 int field_18;
|
|
219 RenderD3D__DevInfo *pAvailableDevices;
|
|
220 IDirectDraw4 *pHost;
|
|
221 IDirect3D3 *pDirect3D;
|
|
222 IUnknown *pUnk;
|
|
223 IDirectDrawSurface4 *pBackBuffer;
|
|
224 IDirectDrawSurface4 *pFrontBuffer;
|
|
225 IDirectDrawSurface4 *pZBuffer;
|
|
226 IDirect3DDevice3 *pDevice;
|
|
227 IDirect3DViewport3 *pViewport;
|
|
228 int field_40;
|
|
229 int field_44;
|
|
230 char pErrorMessage[48];
|
|
231 char field_78[208];
|
|
232 };
|
|
233 #pragma pack(pop)
|
|
234
|
|
235
|
|
236 /* 182 */
|
|
237 #pragma pack(push, 1)
|
|
238 struct Render
|
|
239 {
|
|
240 Render();
|
|
241 ~Render();
|
|
242
|
|
243 static Render *Create() {return new Render;}
|
|
244
|
|
245 bool Initialize(bool bWindowed, uint uDefaultDevice,
|
|
246 bool bColoredLights, uint uDetailLevel, uint bTinting);
|
|
247
|
|
248 static void __fastcall SetPixel(struct Vec2_int_ *pTargetXY, unsigned __int16 uColor);
|
|
249
|
|
250 bool IsColorKeySupported(IDirectDraw4 *);
|
|
251 void _49EBF1();
|
|
252 void ClearBlack();
|
|
253 void PresentBlackScreen();
|
|
254 void SavePCXScreenshot();
|
|
255 void _49F1BC(const char *a1);
|
|
256 int _49F5A2(int a2, int a3, int a4, void *Dst, int a6, int a7);
|
|
257 FILE *SavePCXImage(const char *Filename, char *a3, int a4, int a5);
|
|
258 void ClearTarget(unsigned int uColor);
|
|
259 void Release2();
|
|
260 void Present();
|
27
|
261 void _49FD3A();
|
0
|
262 void CreateZBuffer();
|
|
263 void Release();
|
|
264 void CreateSomeTexture();
|
|
265 bool InitializeFullscreen(HWND hWnd);
|
|
266 bool SwitchToWindow(HWND hWnd);
|
|
267 char FillRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor);
|
|
268 void ClearZBuffer(int a2, int a3);
|
|
269 void Clip_v2(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
|
|
270 void ParseTargetPixelFormat();
|
|
271 bool LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags);
|
|
272 bool LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags);
|
|
273 void CreateDirectDraw();
|
|
274 void SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen);
|
|
275 void SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP);
|
|
276 void CreateFrontBuffer();
|
|
277 void CreateBackBuffer();
|
|
278 void CreateDirectDrawPrimarySurface();
|
|
279 void CreateClipper(HWND a2);
|
|
280 void GetTargetPixelFormat(DDPIXELFORMAT *pOut);
|
|
281 void LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow);
|
|
282 bool UsingDirect3D();
|
|
283 void UnlockBackBuffer();
|
|
284 void LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow);
|
|
285 void UnlockFrontBuffer();
|
|
286 void RestoreFrontBuffer();
|
|
287 HRESULT _4A184C();
|
|
288 void PresentRect(RECT *a2, RECT *a3);
|
|
289 void BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags);
|
|
290 void BltBackToFontFast(int a2, int a3, RECT *a4);
|
|
291 unsigned int Billboard_ProbablyAddToListAndSortByZOrder(unsigned int a1);
|
|
292 unsigned int GetBillboardDrawListSize();
|
|
293 unsigned int GetParentBillboardID(unsigned int uBillboardID);
|
|
294 void SetGameRenderStates();
|
|
295 void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
|
|
296 unsigned int GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6);
|
|
297 void DrawPolygon(unsigned int uNumVertices, stru148 *a3, ODMFace *a4, IDirect3DTexture2 *pTexture);
|
|
298 void DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, int a6, int a7);
|
|
299 void DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *a4);
|
|
300 void _4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex);
|
|
301 void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, Texture *pTex, int a6, int a7, int a8);
|
|
302 void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
|
|
303 void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
|
|
304 void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int a1a, RenderBillboard *pBillboard);
|
|
305 void _4A43B1(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *a3, int a4);
|
|
306 int _4A48E4(int a2, int a3, int a4, int a5, int a6);
|
|
307 void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9);
|
|
308 void _4A4CC9(struct stru6_stru1_indoor_sw_billboard *a1, int a2);
|
1
|
309 bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture);
|
0
|
310 HWLTexture *MoveSpriteToDevice(Sprite *pSprite);
|
|
311 void BeginScene();
|
|
312 void EndScene();
|
|
313 unsigned int _4A52F1(unsigned int this_, float a3);
|
|
314 void Clip(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
|
|
315 void ResetClip();
|
|
316 void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
|
|
317 void _4A5D33(unsigned int a2, unsigned int a3, int a4, int a5, RGBTexture *pTexture);
|
|
318 void DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4);
|
|
319 void _4A601E(signed int a2, signed int a3, Texture *pTexture, int a5);
|
|
320 void _4A612A(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal);
|
|
321 void DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture);
|
|
322 void _4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8);
|
|
323 void _4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8);
|
|
324 void _4A6776(unsigned int a2, unsigned int a3, Texture *a4);
|
|
325 void DrawTransparentGreenShade(signed int a2, signed int a3, Texture *pTexture);
|
|
326 void _4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height);
|
3
|
327 void DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8);
|
0
|
328 void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor);
|
|
329 void FillRect2(int uX, int uY, int a4, unsigned int a5, int a6, unsigned __int16 a7);
|
|
330 int _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7);
|
|
331 void _4A6E7E(unsigned int a2, unsigned int a3, Texture *a4);
|
|
332 char DrawBuildingsD3D();
|
|
333 struct BSPModel *DrawBuildingsSW();
|
|
334 int OnOutdoorRedrawSW();
|
|
335 void DrawSkyD3D();
|
|
336 int DrawSkySW(struct Span *a1, stru148 *a2, int a3);
|
|
337 void DrawDecorations();
|
|
338 void DrawLayingItems_Shooting_Magic_ODM();
|
|
339 void TransformBillboardsAndSetPalettesODM();
|
|
340 float DrawBezierTerrain();
|
|
341 void DrawTerrainD3D(int a1, int edx0, int a3);
|
|
342 void DrawTerrainSW(int a1, int a2, int a3);
|
|
343 __int16 ExecOutdoorDrawSW();
|
|
344 void ChangeBetweenWinFullscreenModes();
|
|
345 void DrawBillboardList_BLV();
|
|
346
|
|
347
|
|
348 unsigned int bUserDirect3D;
|
|
349 unsigned int bStartInWindow;
|
|
350 unsigned int uDesiredDirect3DDevice;
|
|
351 unsigned int uAcquiredDirect3DDevice;
|
|
352 int field_10;
|
|
353 int field_14;
|
|
354 int field_18_locked_pitch;
|
|
355 int field_1C_clipx;
|
|
356 int field_20_clipy;
|
|
357 int field_24_clipz;
|
|
358 int field_28_clipw;
|
|
359 __int16 field_2C[65536];
|
|
360 __int16 field_2002C[65536];
|
|
361 int field_4002C;
|
|
362 int field_40030;
|
|
363 int *pActiveZBuffer;
|
|
364 int *pDefaultZBuffer;
|
|
365 int field_4003C;
|
|
366 int field_40040;
|
|
367 int field_40044;
|
|
368 int field_40048;
|
|
369 int field_4004C;
|
|
370 HWND hWnd;
|
|
371 int field_40054;
|
|
372 unsigned int bWindowMode;
|
|
373 int field_4005C[11];
|
|
374 RenderD3D *pRenderD3D;
|
|
375 IDirectDraw4 *pDirectDraw4;
|
|
376 IDirectDrawSurface4 *pFrontBuffer4;
|
|
377 IDirectDrawSurface4 *pBackBuffer4;
|
|
378 IDirectDrawSurface4 *pColorKeySurface4;
|
|
379 IDirectDraw2 *pDirectDraw2;
|
|
380 IDirectDrawSurface2 *pFrontBuffer2;
|
|
381 IDirectDrawSurface2 *pBackBuffer2;
|
|
382 IDirectDrawSurface2 *pSomeSurface2;
|
|
383 DDPIXELFORMAT ddpfPrimareSuface;
|
|
384 unsigned int uTargetRBits;
|
|
385 unsigned int uTargetGBits;
|
|
386 unsigned int uTargetBBits;
|
|
387 unsigned int uTargetRMask;
|
|
388 unsigned int uTargetGMask;
|
|
389 unsigned int uTargetBMask;
|
|
390 unsigned int uNumSceneBegins;
|
|
391 int *ptr_400E8;
|
|
392 unsigned __int16 *pTargetSurface;
|
|
393 unsigned int uTargetSurfacePitch;
|
|
394 unsigned int uClipY;
|
|
395 unsigned int uClipX;
|
|
396 unsigned int uClipW;
|
|
397 unsigned int uClipZ;
|
|
398 unsigned int bClip;
|
|
399 unsigned int bColorKeySupported;
|
|
400 unsigned int uNumD3DSceneBegins;
|
|
401 int field_40110;
|
|
402 RenderHWLContainer pD3DBitmaps;
|
|
403 RenderHWLContainer pD3DSprites;
|
|
404 unsigned int bUseColoredLights;
|
|
405 unsigned int bRequiredTextureStagesAvailable;
|
|
406 unsigned int bTinting;
|
|
407 unsigned int uLevelOfDetail;
|
|
408 unsigned int uMaxDeviceTextureDim;
|
|
409 unsigned int uMinDeviceTextureDim;
|
|
410 int field_10365C;
|
|
411 unsigned int bUsingSpecular;
|
|
412 float uFogColor;
|
|
413 int field_103668;
|
|
414 unsigned int pHDWaterBitmapIDs[7];
|
|
415 char field_103688[32];
|
|
416 int field_1036A8_bitmapid;
|
|
417 int field_1036AC_bitmapid;
|
|
418 IDirectDrawSurface4 *pSurface;
|
|
419 IDirect3DTexture2 *pTexture;
|
|
420 int field_1036B8;
|
|
421 int _gpu_memory_used;
|
|
422 void (__cdecl *pBeforePresentFunction)();
|
|
423 int field_1036C4;
|
|
424 int turnFogOn;
|
|
425 int field_1036CC;
|
|
426 RenderBillboardD3D pBillboardRenderListD3D[1000];
|
|
427 unsigned int uNumBillboardsToDraw;
|
|
428 int field_129834;
|
|
429 unsigned int uCurrentlyLockedSurfacePitch;
|
|
430 unsigned __int16 *pCurrentlyLockedSurfaceDataPtr;
|
|
431 unsigned __int16 *pCurrentlyLockedSoftSurface;
|
|
432 };
|
|
433 #pragma pack(pop)
|
|
434
|
|
435 extern struct IDirectDrawClipper *pDDrawClipper;
|
|
436 extern struct Render *pRenderer; // idb
|
|
437
|
|
438
|
|
439
|
|
440
|
|
441 /* 248 */
|
|
442 #pragma pack(push, 1)
|
|
443 struct RenderBillboardTransform_local0
|
|
444 {
|
|
445 unsigned __int16 *pTarget;
|
|
446 int *pTargetZ;
|
|
447 int field_8;
|
|
448 int field_C;
|
|
449 int field_10;
|
|
450 int field_14;
|
|
451 char field_18[8];
|
|
452 unsigned __int16 *pPalette;
|
|
453 unsigned __int16 *pPalette2;
|
|
454 int field_28;
|
|
455 unsigned int uFlags;
|
|
456 unsigned int uTargetPitch;
|
|
457 unsigned int uViewportX;
|
|
458 unsigned int uViewportY;
|
|
459 unsigned int uViewportZ;
|
|
460 unsigned int uViewportW;
|
|
461 int field_44;
|
|
462 int uParentBillboardID;
|
|
463 int uTintColor;
|
|
464 };
|
|
465 #pragma pack(pop)
|
|
466
|
|
467
|
|
468
|
|
469
|
|
470 extern int uNumDecorationsDrawnThisFrame; // weak
|
|
471 extern RenderBillboard pBillboardRenderList[500];
|
|
472 extern unsigned int uNumBillboardsToDraw;
|
|
473 extern int uNumSpritesDrawnThisFrame; // weak
|
|
474
|
|
475
|
|
476
|
|
477
|
|
478 extern RenderVertexSoft array_507D30[50];
|
|
479 extern RenderVertexSoft array_508690[50];
|
|
480 extern RenderVertexSoft array_508FF0[50];
|
|
481 extern RenderVertexSoft array_509950[50];
|
|
482 extern RenderVertexSoft array_50A2B0[50];
|
|
483 extern RenderVertexSoft array_50AC10[50];
|
|
484
|
|
485 extern RenderVertexSoft array_73D150[20];
|
|
486
|
|
487 extern RenderVertexD3D3 arary_77E5C8[50];
|
|
488
|
|
489 extern RenderVertexSoft *ptr_801A04;
|
|
490 extern RenderVertexSoft *ptr_801A08;
|
|
491
|
|
492 extern RenderVertexSoft pVerticesSR_801A10[384];
|
|
493 extern RenderVertexSoft pVerticesSR_806210[384]; |