Mercurial > mm7
annotate Render.h @ 2253:aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
author | Grumpy7 |
---|---|
date | Wed, 26 Feb 2014 23:35:23 +0100 |
parents | 5944810e88e2 |
children | 25f771e528f0 |
rev | line source |
---|---|
0 | 1 #pragma once |
1512 | 2 |
3 #include <cstdint> | |
4 #include <cstdio> | |
0 | 5 |
6 #include "lib\legacy_dx\d3d.h" | |
1802 | 7 #include "OSWindow.h" |
0 | 8 |
9 #include "VectorTypes.h" | |
10 | |
2152 | 11 |
12 #define ErrD3D(hr) \ | |
13 do \ | |
14 { \ | |
15 extern void ErrHR(HRESULT, const char *, const char *, const char *, int); \ | |
16 ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__); \ | |
17 } while(0) | |
18 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
19 struct Polygon; |
0 | 20 struct Texture; |
21 struct RGBTexture; | |
22 struct RenderBillboardTransform_local0; | |
23 struct ODMFace; | |
24 | |
25 | |
2069 | 26 unsigned __int16 Color16(unsigned __int32 r, unsigned __int32 g, unsigned __int32 b); |
27 unsigned __int32 Color32(unsigned __int16 color16); | |
28 | |
0 | 29 /* 119 */ |
30 #pragma pack(push, 1) | |
31 struct RenderVertexSoft | |
32 { | |
33 inline RenderVertexSoft(): | |
34 flt_2C(0.0f) | |
35 {} | |
36 | |
37 Vec3_float_ vWorldPosition; | |
38 Vec3_float_ vWorldViewPosition; | |
39 float vWorldViewProjX; | |
40 float vWorldViewProjY; | |
168 | 41 float _rhw; |
0 | 42 float u; |
43 float v; | |
44 float flt_2C; | |
45 }; | |
46 #pragma pack(pop) | |
47 | |
48 | |
49 | |
50 /* 112 */ | |
51 #pragma pack(push, 1) | |
52 struct RenderVertexD3D3 | |
53 { | |
54 Vec3_float_ pos; | |
55 float rhw; | |
2006 | 56 signed int diffuse; |
0 | 57 unsigned int specular; |
58 Vec2_float_ texcoord; | |
59 }; | |
1269 | 60 #pragma pack(pop) |
0 | 61 |
1016 | 62 class Sprite; |
63 class SpriteFrame; | |
0 | 64 |
65 /* 161 */ | |
66 #pragma pack(push, 1) | |
67 struct RenderBillboard | |
68 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
69 int _screenspace_x_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
70 int _screenspace_y_scaler_packedfloat; |
0 | 71 float fov_x; |
72 float fov_y; | |
194 | 73 union |
74 { | |
75 int sZValue; | |
76 struct | |
77 { | |
78 unsigned __int16 object_pid; | |
79 signed __int16 actual_z; | |
80 }; | |
81 }; | |
142 | 82 int field_14_actor_id; |
2226
5944810e88e2
occasionally pRenderer->pBillboardRenderListD3D array elements are not correct (0xcdcdcdcd) fix
Ritor1
parents:
2182
diff
changeset
|
83 signed __int16 HwSpriteID; |
0 | 84 __int16 uPalette; |
85 __int16 uIndoorSectorID; | |
86 __int16 field_1E; | |
430 | 87 __int16 world_x; |
88 __int16 world_y; | |
89 __int16 world_z; | |
0 | 90 __int16 uScreenSpaceX; |
91 __int16 uScreenSpaceY; | |
657 | 92 unsigned __int16 dimming_level; |
2006 | 93 signed int sTintColor; |
0 | 94 SpriteFrame *pSpriteFrame; |
159 | 95 |
96 inline float GetFloatZ() const | |
97 { | |
194 | 98 return (float)object_pid / 65535.0f + (float)actual_z; |
159 | 99 } |
0 | 100 }; |
101 #pragma pack(pop) | |
102 | |
103 | |
104 #pragma pack(push, 1) | |
105 struct RenderD3D__DevInfo | |
106 { | |
107 unsigned int bIsDeviceCompatible; | |
108 char *pName; | |
109 char *pDescription; | |
110 GUID *pGUID; | |
111 unsigned int uCaps; | |
112 char *pDriverName; | |
113 char *pDeviceDesc; | |
114 char *pDDraw4DevDesc; | |
115 GUID *pDirectDrawGUID; | |
116 int uVideoMem; | |
117 }; | |
118 #pragma pack(pop) | |
119 | |
120 | |
121 | |
122 #pragma pack(push, 1) | |
123 struct RenderD3D_D3DDevDesc | |
124 { | |
125 int field_0; | |
126 int field_4; | |
127 int field_8; | |
128 int field_C; | |
129 int field_10; | |
130 char *pDriverName; | |
131 char *pDeviceDesc; | |
132 char *pDDraw4DevDesc; | |
133 GUID *pGUID; | |
134 unsigned int uVideoMem; | |
135 }; | |
136 #pragma pack(pop) | |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | |
145 | |
146 /* 280 */ | |
147 #pragma pack(push, 1) | |
148 struct HWLTexture | |
149 { | |
150 inline HWLTexture(): | |
151 field_0(0), field_4(0), field_8(0), | |
152 field_C(0), field_10(0), field_14(0) | |
153 {} | |
154 | |
155 int field_0; | |
156 int field_4; | |
157 int field_8; | |
158 int field_C; | |
159 int field_10; | |
160 int field_14; | |
670 | 161 int uBufferWidth; |
162 int uBufferHeight; | |
163 int uAreaWidth; | |
164 int uAreaHeigth; | |
0 | 165 unsigned int uWidth; |
166 unsigned int uHeight; | |
670 | 167 int uAreaX; |
168 int uAreaY; | |
0 | 169 unsigned __int16 *pPixels; |
170 }; | |
171 #pragma pack(pop) | |
172 | |
173 | |
174 /* 185 */ | |
175 #pragma pack(push, 1) | |
176 struct RenderHWLContainer | |
177 { | |
178 RenderHWLContainer(); | |
179 bool Load(const wchar_t *pFilename); | |
180 bool Release(); | |
181 | |
182 HWLTexture *LoadTexture(const char *pName, int bMipMaps); | |
183 | |
184 FILE *pFile; | |
1512 | 185 uint32_t uSignature; |
0 | 186 unsigned int uDataOffset; |
187 unsigned int uNumItems; | |
188 char *pSpriteNames[50000]; | |
189 int pSpriteOffsets[50000]; | |
190 int bDumpDebug; | |
1583 | 191 int scale_hwls_to_half; |
0 | 192 }; |
193 #pragma pack(pop) | |
194 | |
195 | |
196 | |
197 /* 242 */ | |
198 #pragma pack(push, 1) | |
199 struct RenderBillboardD3D | |
200 { | |
2155 | 201 inline RenderBillboardD3D(): |
202 opacity(Transparent), | |
203 field_90(-1), | |
204 sParentBillboardID(-1), | |
205 uNumVertices(4) | |
206 {} | |
207 | |
208 enum OpacityType: unsigned __int32 | |
0 | 209 { |
210 Transparent = 0, | |
211 Opaque_1 = 1, | |
212 Opaque_2 = 2, | |
213 Opaque_3 = 3, | |
2155 | 214 NoBlend = 0xFFFFFFFF |
0 | 215 }; |
216 | |
217 IDirect3DTexture2 *pTexture; | |
218 unsigned int uNumVertices; | |
1390 | 219 RenderVertexD3D3 pQuads[4]; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
220 float z_order; |
2155 | 221 OpacityType opacity; |
0 | 222 int field_90; |
223 int sZValue; | |
2002 | 224 signed int sParentBillboardID; |
0 | 225 }; |
226 #pragma pack(pop) | |
227 | |
228 | |
229 | |
230 | |
231 #pragma pack(push, 1) | |
232 struct RenderD3D_aux | |
233 { | |
234 RenderD3D__DevInfo *pInfo; | |
235 RenderD3D_D3DDevDesc *ptr_4; | |
236 }; | |
237 #pragma pack(pop) | |
238 | |
239 | |
240 | |
241 /* 183 */ | |
242 #pragma pack(push, 1) | |
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2226
diff
changeset
|
243 class RenderD3D |
0 | 244 { |
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2226
diff
changeset
|
245 public: |
0 | 246 RenderD3D(); |
247 | |
248 void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices); | |
249 void Release(); | |
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2226
diff
changeset
|
250 bool CreateDevice(unsigned int uDeviceID, int bWindowed, OSWindow *window); |
0 | 251 unsigned int GetDeviceCaps(); |
252 void ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear); | |
253 void Present(bool bForceBlit); | |
254 bool CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim); | |
255 void HandleLostResources(); | |
256 | |
257 | |
258 unsigned int bWindowed; | |
259 int field_4; | |
260 int field_8; | |
261 HWND hWindow; | |
262 int field_10; | |
263 int field_14; | |
264 int field_18; | |
265 RenderD3D__DevInfo *pAvailableDevices; | |
266 IDirectDraw4 *pHost; | |
267 IDirect3D3 *pDirect3D; | |
268 IUnknown *pUnk; | |
269 IDirectDrawSurface4 *pBackBuffer; | |
270 IDirectDrawSurface4 *pFrontBuffer; | |
271 IDirectDrawSurface4 *pZBuffer; | |
272 IDirect3DDevice3 *pDevice; | |
273 IDirect3DViewport3 *pViewport; | |
274 int field_40; | |
275 int field_44; | |
276 char pErrorMessage[48]; | |
277 char field_78[208]; | |
278 }; | |
279 #pragma pack(pop) | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
280 extern struct RenderVertexD3D3 pVertices[50]; |
0 | 281 |
282 /* 182 */ | |
283 #pragma pack(push, 1) | |
284 struct Render | |
285 { | |
286 Render(); | |
287 ~Render(); | |
288 | |
289 static Render *Create() {return new Render;} | |
290 | |
2069 | 291 bool Initialize(OSWindow *window, bool bColoredLights, uint32_t uDetailLevel, bool bTinting); |
0 | 292 |
293 | |
294 void ClearBlack(); | |
295 void PresentBlackScreen(); | |
296 void SavePCXScreenshot(); | |
2069 | 297 void SaveWinnersCertificate(const char *a1); |
0 | 298 void ClearTarget(unsigned int uColor); |
299 void Present(); | |
2154 | 300 void _49FD3A_fullscreen(); |
0 | 301 void CreateZBuffer(); |
302 void Release(); | |
1802 | 303 bool InitializeFullscreen(); |
304 bool SwitchToWindow(); | |
2102 | 305 void RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor); |
0 | 306 void ClearZBuffer(int a2, int a3); |
709 | 307 void SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); |
0 | 308 bool LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags); |
309 void GetTargetPixelFormat(DDPIXELFORMAT *pOut); | |
310 void LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow); | |
311 void UnlockBackBuffer(); | |
312 void LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow); | |
313 void UnlockFrontBuffer(); | |
314 void RestoreFrontBuffer(); | |
2152 | 315 void RestoreBackBuffer(); |
0 | 316 void BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags); |
317 void BltBackToFontFast(int a2, int a3, RECT *a4); | |
318 void BeginSceneD3D(); | |
319 void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); | |
349 | 320 unsigned int GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
321 void DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
322 void DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders); |
1923 | 323 void DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture); |
324 void DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture); | |
1262 | 325 void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8); |
1923 | 326 void DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID); |
0 | 327 void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); |
328 void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); | |
717 | 329 void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level); |
0 | 330 void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9); |
1390 | 331 void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse); |
0 | 332 bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture); |
670 | 333 bool MoveSpriteToDevice(Sprite *pSprite); |
0 | 334 void BeginScene(); |
335 void EndScene(); | |
2155 | 336 void ScreenFade(unsigned int color, float t); |
727 | 337 void SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); |
338 void ResetTextureClipRect(); | |
0 | 339 void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4); |
1675 | 340 void CreditsTextureScroll(unsigned int pX, unsigned int pY, int move_X, int move_Y, RGBTexture *pTexture); |
1262 | 341 void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4); |
342 void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5); | |
343 void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal); | |
344 void DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture); | |
1455 | 345 void DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); |
1262 | 346 void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); |
347 void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4); | |
348 void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture); | |
2069 | 349 void DrawMasked(signed int a2, signed int a3, struct Texture *pTexture, unsigned __int16 mask); |
1496 | 350 void GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height); |
1268 | 351 void DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8); |
0 | 352 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); |
353 void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16); | |
2069 | 354 void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7); |
2155 | 355 void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture *a4); |
1787 | 356 void DrawBuildingsD3D(); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
357 //struct BSPModel *DrawBuildingsSW(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
358 //int OnOutdoorRedrawSW(); |
1923 | 359 void DrawOutdoorSkyD3D(); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
360 //int DrawSkySW(struct Span *a1, Polygon *a2, int a3); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
361 void PrepareDecorationsRenderList_ODM(); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
430
diff
changeset
|
362 void DrawSpriteObjects_ODM(); |
0 | 363 void TransformBillboardsAndSetPalettesODM(); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
364 //float DrawBezierTerrain(); |
86 | 365 void RenderTerrainD3D(); |
985 | 366 void DrawTerrainD3D(int a1, int edx0, int a3, int unk4); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
367 //void DrawTerrainSW(int a1, int a2, int a3, int a4); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
368 //void ExecOutdoorDrawSW(); |
0 | 369 void ChangeBetweenWinFullscreenModes(); |
370 void DrawBillboardList_BLV(); | |
2154 | 371 bool AreRenderSurfacesOk(); |
372 bool IsGammaSupported(); | |
373 void SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height); | |
374 void PackScreenshot(unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size); | |
2182 | 375 int _46À6ÀÑ_GetActorsInViewport(int pDepth); |
2155 | 376 void BeginLightmaps(); |
377 void EndLightmaps(); | |
378 void BeginLightmaps2(); | |
379 void EndLightmaps2(); | |
380 bool DrawLightmap(struct Lightmap *pLightmap, struct Vec3_float_ *pColorMult, float z_bias); | |
381 | |
382 void BeginDecals(); | |
383 void EndDecals(); | |
384 void DrawDecal(struct Decal *pDecal, float z_bias); | |
385 | |
386 void do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff); | |
387 void DrawLines(const RenderVertexD3D3 *vertices, unsigned int num_vertices); | |
388 void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices); | |
389 void DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture); | |
0 | 390 |
2154 | 391 void am_Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3); |
392 void am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode); | |
2153 | 393 |
2155 | 394 |
395 protected: unsigned int uDesiredDirect3DDevice; | |
396 protected: int raster_clip_x; | |
397 protected: int raster_clip_y; // clipping rect for raster ops | |
398 protected: int raster_clip_z; // like RasterLine2D for (mini)map | |
399 protected: int raster_clip_w; | |
400 public: int *pActiveZBuffer; | |
401 protected: int *pDefaultZBuffer; | |
402 protected: OSWindow *window; | |
403 protected: unsigned int bWindowMode; | |
404 protected: RenderD3D *pRenderD3D; | |
2154 | 405 public: IDirectDraw4 *pDirectDraw4; |
406 public: IDirectDrawSurface4 *pFrontBuffer4; | |
407 public: IDirectDrawSurface4 *pBackBuffer4; | |
408 protected: DDPIXELFORMAT ddpfPrimarySuface; | |
2155 | 409 protected: unsigned int uTargetRBits; |
410 protected: unsigned int uTargetGBits; | |
411 protected: unsigned int uTargetBBits; | |
412 protected: unsigned int uTargetRMask; | |
413 protected: unsigned int uTargetGMask; | |
414 protected: unsigned int uTargetBMask; | |
2154 | 415 protected: unsigned int uNumSceneBegins; |
416 protected: unsigned __int32 *pTargetSurface_unaligned; | |
2155 | 417 public: void *pTargetSurface; |
2154 | 418 public: unsigned int uTargetSurfacePitch; |
2155 | 419 protected: unsigned int uClipY; |
420 protected: unsigned int uClipX; | |
421 protected: unsigned int uClipW; | |
422 protected: unsigned int uClipZ; | |
423 protected: unsigned int bClip; | |
2154 | 424 protected: unsigned int uNumD3DSceneBegins; |
425 protected: int using_software_screen_buffer; | |
426 protected: RenderHWLContainer pD3DBitmaps; | |
427 protected: RenderHWLContainer pD3DSprites; | |
428 public: unsigned int bUseColoredLights; | |
429 protected: unsigned int bRequiredTextureStagesAvailable; | |
430 public: unsigned int bTinting; | |
431 protected: unsigned int uLevelOfDetail; | |
432 protected: unsigned int uMaxDeviceTextureDim; | |
433 protected: unsigned int uMinDeviceTextureDim; | |
434 public: unsigned int bUsingSpecular; | |
435 public: uint32_t uFogColor; | |
436 public: unsigned int pHDWaterBitmapIDs[7]; | |
437 public: int hd_water_current_frame; | |
438 public: int hd_water_tile_id; | |
2155 | 439 public: void (*pBeforePresentFunction)(); |
2154 | 440 public: uint32_t bFogEnabled; |
441 public: RenderBillboardD3D pBillboardRenderListD3D[1000]; | |
442 public: unsigned int uNumBillboardsToDraw; | |
2155 | 443 |
2069 | 444 |
2153 | 445 protected: |
2154 | 446 void DoRenderBillboards_D3D(); |
447 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); | |
448 void DrawBorderTiles(struct Polygon *poly); | |
449 unsigned short *MakeScreenshot(signed int width, signed int height); | |
450 bool CheckTextureStages(); | |
2155 | 451 void ParseTargetPixelFormat(); |
452 void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard); | |
453 void CreateDirectDraw(); | |
454 void SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen); | |
455 void SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP); | |
456 void CreateFrontBuffer(); | |
457 void CreateBackBuffer(); | |
458 void CreateDirectDrawPrimarySurface(); | |
459 void CreateClipper(HWND a2); | |
460 void PackPCXpicture(unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size); | |
461 void SavePCXImage(const char *Filename, unsigned short* picture_data, int width, int height); | |
462 unsigned int Billboard_ProbablyAddToListAndSortByZOrder(float z); | |
463 unsigned int GetParentBillboardID(unsigned int uBillboardID); | |
464 unsigned int GetBillboardDrawListSize(); | |
2153 | 465 |
466 public: | |
2069 | 467 inline void WritePixel16(int x, int y, unsigned __int16 color) |
468 { | |
469 if (ddpfPrimarySuface.dwRGBBitCount == 32) | |
470 { | |
471 auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch; | |
472 *p = Color32(color); | |
473 } | |
474 else if (ddpfPrimarySuface.dwRGBBitCount == 16) | |
475 { | |
476 auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch; | |
477 *p = color; | |
478 } | |
479 else __debugbreak(); | |
480 } | |
481 | |
482 inline unsigned __int16 ReadPixel16(int x, int y) | |
483 { | |
484 if (ddpfPrimarySuface.dwRGBBitCount == 32) | |
485 { | |
486 auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch; | |
487 return Color16((*p >> 16) & 255, (*p >> 8) & 255, *p & 255); | |
488 } | |
489 else if (ddpfPrimarySuface.dwRGBBitCount == 16) | |
490 { | |
491 auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch; | |
492 return *p; | |
493 } | |
494 else __debugbreak(); | |
495 } | |
1655 | 496 |
497 | |
2153 | 498 inline void ToggleTint() {bTinting = !bTinting;} |
499 inline void ToggleColoredLights() {bUseColoredLights = !bUseColoredLights;} | |
500 | |
2154 | 501 inline unsigned int GetRenderWidth() {return window->GetWidth();} |
502 inline unsigned int GetRenderHeight() {return window->GetHeight();} | |
503 | |
2153 | 504 inline void Sub01() |
505 { | |
506 if (pRenderD3D && !bWindowMode) | |
2154 | 507 _49FD3A_fullscreen(); |
2153 | 508 } |
509 | |
2154 | 510 friend void Present_NoColorKey(); |
2153 | 511 |
1802 | 512 //int windowed_mode_width; |
513 //int windowed_mode_height; | |
0 | 514 }; |
515 #pragma pack(pop) | |
516 | |
517 extern struct IDirectDrawClipper *pDDrawClipper; | |
518 extern struct Render *pRenderer; // idb | |
67 | 519 extern struct pUnkTerrain *Unks; |
0 | 520 |
521 | |
522 | |
523 /* 248 */ | |
524 #pragma pack(push, 1) | |
525 struct RenderBillboardTransform_local0 | |
526 { | |
2069 | 527 void *pTarget; |
0 | 528 int *pTargetZ; |
529 int uScreenSpaceX; | |
530 int uScreenSpaceY; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
531 int _screenspace_x_scaler_packedfloat; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
532 int _screenspace_y_scaler_packedfloat; |
0 | 533 char field_18[8]; |
534 unsigned __int16 *pPalette; | |
535 unsigned __int16 *pPalette2; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
536 union |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
537 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
538 int sZValue; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
539 struct |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
540 { |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
541 unsigned short object_pid; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
542 short zbuffer_depth; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
543 }; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
544 }; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
545 unsigned int uFlags; // & 4 - mirror horizontally |
0 | 546 unsigned int uTargetPitch; |
547 unsigned int uViewportX; | |
548 unsigned int uViewportY; | |
549 unsigned int uViewportZ; | |
550 unsigned int uViewportW; | |
551 int field_44; | |
2002 | 552 int sParentBillboardID; |
2006 | 553 int sTintColor; |
0 | 554 }; |
555 #pragma pack(pop) | |
556 | |
557 | |
558 | |
559 | |
560 extern int uNumDecorationsDrawnThisFrame; // weak | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
561 extern RenderBillboard pBillboardRenderList[500]; |
0 | 562 extern unsigned int uNumBillboardsToDraw; |
563 extern int uNumSpritesDrawnThisFrame; // weak | |
564 | |
565 | |
566 | |
567 | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
568 extern RenderVertexSoft array_507D30[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
569 extern RenderVertexSoft array_50AC10[50]; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
570 extern RenderVertexSoft array_73D150[20]; |
0 | 571 |
1413 | 572 extern RenderVertexD3D3 d3d_vertex_buffer[50]; |