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