annotate Render.h @ 1512:af57b3b76fe4

Clean and decouple. (1)
author yoctozepto
date Mon, 02 Sep 2013 15:23:09 +0200
parents ab6bf38b2940
children 75fafd8ced59
rev   line source
0
Ritor1
parents:
diff changeset
1 #pragma once
1512
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
2
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
3 #include <cstdint>
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
4 #include <cstdio>
0
Ritor1
parents:
diff changeset
5
Ritor1
parents:
diff changeset
6 #include "lib\legacy_dx\d3d.h"
Ritor1
parents:
diff changeset
7 #include "OSAPI.h"
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9 #include "VectorTypes.h"
Ritor1
parents:
diff changeset
10
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
11 struct Polygon;
0
Ritor1
parents:
diff changeset
12 struct Texture;
Ritor1
parents:
diff changeset
13 struct RGBTexture;
Ritor1
parents:
diff changeset
14 struct RenderBillboardTransform_local0;
Ritor1
parents:
diff changeset
15 struct ODMFace;
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17
Ritor1
parents:
diff changeset
18 /* 119 */
Ritor1
parents:
diff changeset
19 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
20 struct RenderVertexSoft
Ritor1
parents:
diff changeset
21 {
Ritor1
parents:
diff changeset
22 inline RenderVertexSoft():
Ritor1
parents:
diff changeset
23 flt_2C(0.0f)
Ritor1
parents:
diff changeset
24 {}
Ritor1
parents:
diff changeset
25
Ritor1
parents:
diff changeset
26 Vec3_float_ vWorldPosition;
Ritor1
parents:
diff changeset
27 Vec3_float_ vWorldViewPosition;
Ritor1
parents:
diff changeset
28 float vWorldViewProjX;
Ritor1
parents:
diff changeset
29 float vWorldViewProjY;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
30 float _rhw;
0
Ritor1
parents:
diff changeset
31 float u;
Ritor1
parents:
diff changeset
32 float v;
Ritor1
parents:
diff changeset
33 float flt_2C;
Ritor1
parents:
diff changeset
34 };
Ritor1
parents:
diff changeset
35 #pragma pack(pop)
Ritor1
parents:
diff changeset
36
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38
Ritor1
parents:
diff changeset
39 /* 112 */
Ritor1
parents:
diff changeset
40 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
41 struct RenderVertexD3D3
Ritor1
parents:
diff changeset
42 {
Ritor1
parents:
diff changeset
43 Vec3_float_ pos;
Ritor1
parents:
diff changeset
44 float rhw;
Ritor1
parents:
diff changeset
45 unsigned int diffuse;
Ritor1
parents:
diff changeset
46 unsigned int specular;
Ritor1
parents:
diff changeset
47 Vec2_float_ texcoord;
Ritor1
parents:
diff changeset
48 };
1269
34b08429a6b8 inserted missing pragma pack(pop)
Grumpy7
parents: 1268
diff changeset
49 #pragma pack(pop)
0
Ritor1
parents:
diff changeset
50
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 992
diff changeset
51 class Sprite;
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 992
diff changeset
52 class SpriteFrame;
0
Ritor1
parents:
diff changeset
53
Ritor1
parents:
diff changeset
54 /* 161 */
Ritor1
parents:
diff changeset
55 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
56 struct RenderBillboard
Ritor1
parents:
diff changeset
57 {
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
58 int _screenspace_x_scaler_packedfloat;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
59 int _screenspace_y_scaler_packedfloat;
0
Ritor1
parents:
diff changeset
60 float fov_x;
Ritor1
parents:
diff changeset
61 float fov_y;
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
62 union
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
63 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
64 int sZValue;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
65 struct
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
66 {
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
67 unsigned __int16 object_pid;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
68 signed __int16 actual_z;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
69 };
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
70 };
142
8b8fd4d83fdc Various things here and there
Nomad
parents: 86
diff changeset
71 int field_14_actor_id;
0
Ritor1
parents:
diff changeset
72 unsigned __int16 uHwSpriteID;
Ritor1
parents:
diff changeset
73 __int16 uPalette;
Ritor1
parents:
diff changeset
74 __int16 uIndoorSectorID;
Ritor1
parents:
diff changeset
75 __int16 field_1E;
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 349
diff changeset
76 __int16 world_x;
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 349
diff changeset
77 __int16 world_y;
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 349
diff changeset
78 __int16 world_z;
0
Ritor1
parents:
diff changeset
79 __int16 uScreenSpaceX;
Ritor1
parents:
diff changeset
80 __int16 uScreenSpaceY;
657
7747161ea5b5 RenderBillboard member rename
Nomad
parents: 515
diff changeset
81 unsigned __int16 dimming_level;
0
Ritor1
parents:
diff changeset
82 unsigned int uTintColor;
Ritor1
parents:
diff changeset
83 SpriteFrame *pSpriteFrame;
159
3235bc4cf78e NPCDialogue
Ritor1
parents: 144
diff changeset
84
3235bc4cf78e NPCDialogue
Ritor1
parents: 144
diff changeset
85 inline float GetFloatZ() const
3235bc4cf78e NPCDialogue
Ritor1
parents: 144
diff changeset
86 {
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 186
diff changeset
87 return (float)object_pid / 65535.0f + (float)actual_z;
159
3235bc4cf78e NPCDialogue
Ritor1
parents: 144
diff changeset
88 }
0
Ritor1
parents:
diff changeset
89 };
Ritor1
parents:
diff changeset
90 #pragma pack(pop)
Ritor1
parents:
diff changeset
91
Ritor1
parents:
diff changeset
92
Ritor1
parents:
diff changeset
93 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
94 struct RenderD3D__DevInfo
Ritor1
parents:
diff changeset
95 {
Ritor1
parents:
diff changeset
96 unsigned int bIsDeviceCompatible;
Ritor1
parents:
diff changeset
97 char *pName;
Ritor1
parents:
diff changeset
98 char *pDescription;
Ritor1
parents:
diff changeset
99 GUID *pGUID;
Ritor1
parents:
diff changeset
100 unsigned int uCaps;
Ritor1
parents:
diff changeset
101 char *pDriverName;
Ritor1
parents:
diff changeset
102 char *pDeviceDesc;
Ritor1
parents:
diff changeset
103 char *pDDraw4DevDesc;
Ritor1
parents:
diff changeset
104 GUID *pDirectDrawGUID;
Ritor1
parents:
diff changeset
105 int uVideoMem;
Ritor1
parents:
diff changeset
106 };
Ritor1
parents:
diff changeset
107 #pragma pack(pop)
Ritor1
parents:
diff changeset
108
Ritor1
parents:
diff changeset
109
Ritor1
parents:
diff changeset
110
Ritor1
parents:
diff changeset
111 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
112 struct RenderD3D_D3DDevDesc
Ritor1
parents:
diff changeset
113 {
Ritor1
parents:
diff changeset
114 int field_0;
Ritor1
parents:
diff changeset
115 int field_4;
Ritor1
parents:
diff changeset
116 int field_8;
Ritor1
parents:
diff changeset
117 int field_C;
Ritor1
parents:
diff changeset
118 int field_10;
Ritor1
parents:
diff changeset
119 char *pDriverName;
Ritor1
parents:
diff changeset
120 char *pDeviceDesc;
Ritor1
parents:
diff changeset
121 char *pDDraw4DevDesc;
Ritor1
parents:
diff changeset
122 GUID *pGUID;
Ritor1
parents:
diff changeset
123 unsigned int uVideoMem;
Ritor1
parents:
diff changeset
124 };
Ritor1
parents:
diff changeset
125 #pragma pack(pop)
Ritor1
parents:
diff changeset
126
Ritor1
parents:
diff changeset
127
Ritor1
parents:
diff changeset
128
Ritor1
parents:
diff changeset
129
Ritor1
parents:
diff changeset
130
Ritor1
parents:
diff changeset
131
Ritor1
parents:
diff changeset
132
Ritor1
parents:
diff changeset
133
Ritor1
parents:
diff changeset
134
Ritor1
parents:
diff changeset
135 /* 280 */
Ritor1
parents:
diff changeset
136 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
137 struct HWLTexture
Ritor1
parents:
diff changeset
138 {
Ritor1
parents:
diff changeset
139 inline HWLTexture():
Ritor1
parents:
diff changeset
140 field_0(0), field_4(0), field_8(0),
Ritor1
parents:
diff changeset
141 field_C(0), field_10(0), field_14(0)
Ritor1
parents:
diff changeset
142 {}
Ritor1
parents:
diff changeset
143
Ritor1
parents:
diff changeset
144 int field_0;
Ritor1
parents:
diff changeset
145 int field_4;
Ritor1
parents:
diff changeset
146 int field_8;
Ritor1
parents:
diff changeset
147 int field_C;
Ritor1
parents:
diff changeset
148 int field_10;
Ritor1
parents:
diff changeset
149 int field_14;
670
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
150 int uBufferWidth;
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
151 int uBufferHeight;
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
152 int uAreaWidth;
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
153 int uAreaHeigth;
0
Ritor1
parents:
diff changeset
154 unsigned int uWidth;
Ritor1
parents:
diff changeset
155 unsigned int uHeight;
670
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
156 int uAreaX;
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
157 int uAreaY;
0
Ritor1
parents:
diff changeset
158 unsigned __int16 *pPixels;
Ritor1
parents:
diff changeset
159 };
Ritor1
parents:
diff changeset
160 #pragma pack(pop)
Ritor1
parents:
diff changeset
161
Ritor1
parents:
diff changeset
162
Ritor1
parents:
diff changeset
163 /* 185 */
Ritor1
parents:
diff changeset
164 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
165 struct RenderHWLContainer
Ritor1
parents:
diff changeset
166 {
Ritor1
parents:
diff changeset
167 RenderHWLContainer();
Ritor1
parents:
diff changeset
168 bool Load(const wchar_t *pFilename);
Ritor1
parents:
diff changeset
169 bool Release();
Ritor1
parents:
diff changeset
170
Ritor1
parents:
diff changeset
171 HWLTexture *LoadTexture(const char *pName, int bMipMaps);
Ritor1
parents:
diff changeset
172
Ritor1
parents:
diff changeset
173 FILE *pFile;
1512
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
174 uint32_t uSignature;
0
Ritor1
parents:
diff changeset
175 unsigned int uDataOffset;
Ritor1
parents:
diff changeset
176 unsigned int uNumItems;
Ritor1
parents:
diff changeset
177 char *pSpriteNames[50000];
Ritor1
parents:
diff changeset
178 int pSpriteOffsets[50000];
Ritor1
parents:
diff changeset
179 int bDumpDebug;
Ritor1
parents:
diff changeset
180 int field_61A94_scale_hwls_to_half;
Ritor1
parents:
diff changeset
181 };
Ritor1
parents:
diff changeset
182 #pragma pack(pop)
Ritor1
parents:
diff changeset
183
Ritor1
parents:
diff changeset
184
Ritor1
parents:
diff changeset
185
Ritor1
parents:
diff changeset
186 /* 242 */
Ritor1
parents:
diff changeset
187 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
188 struct RenderBillboardD3D
Ritor1
parents:
diff changeset
189 {
Ritor1
parents:
diff changeset
190 enum OpacityType: unsigned __int32
Ritor1
parents:
diff changeset
191 {
Ritor1
parents:
diff changeset
192 Transparent = 0,
Ritor1
parents:
diff changeset
193 Opaque_1 = 1,
Ritor1
parents:
diff changeset
194 Opaque_2 = 2,
Ritor1
parents:
diff changeset
195 Opaque_3 = 3,
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
196 NoBlend = 0xFFFFFFFF
0
Ritor1
parents:
diff changeset
197 };
Ritor1
parents:
diff changeset
198
Ritor1
parents:
diff changeset
199 IDirect3DTexture2 *pTexture;
Ritor1
parents:
diff changeset
200 unsigned int uNumVertices;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1269
diff changeset
201 RenderVertexD3D3 pQuads[4];
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
202 float z_order;
0
Ritor1
parents:
diff changeset
203 OpacityType uOpacity;
Ritor1
parents:
diff changeset
204 int field_90;
Ritor1
parents:
diff changeset
205 int sZValue;
Ritor1
parents:
diff changeset
206 unsigned int uParentBillboardID;
Ritor1
parents:
diff changeset
207 };
Ritor1
parents:
diff changeset
208 #pragma pack(pop)
Ritor1
parents:
diff changeset
209
Ritor1
parents:
diff changeset
210
Ritor1
parents:
diff changeset
211
Ritor1
parents:
diff changeset
212
Ritor1
parents:
diff changeset
213 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
214 struct RenderD3D_aux
Ritor1
parents:
diff changeset
215 {
Ritor1
parents:
diff changeset
216 RenderD3D__DevInfo *pInfo;
Ritor1
parents:
diff changeset
217 RenderD3D_D3DDevDesc *ptr_4;
Ritor1
parents:
diff changeset
218 };
Ritor1
parents:
diff changeset
219 #pragma pack(pop)
Ritor1
parents:
diff changeset
220
Ritor1
parents:
diff changeset
221
Ritor1
parents:
diff changeset
222
Ritor1
parents:
diff changeset
223 /* 183 */
Ritor1
parents:
diff changeset
224 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
225 struct RenderD3D
Ritor1
parents:
diff changeset
226 {
Ritor1
parents:
diff changeset
227 RenderD3D();
Ritor1
parents:
diff changeset
228
Ritor1
parents:
diff changeset
229 void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices);
Ritor1
parents:
diff changeset
230 void Release();
Ritor1
parents:
diff changeset
231 bool CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd);
Ritor1
parents:
diff changeset
232 unsigned int GetDeviceCaps();
Ritor1
parents:
diff changeset
233 void ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear);
Ritor1
parents:
diff changeset
234 void Present(bool bForceBlit);
Ritor1
parents:
diff changeset
235 bool CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim);
Ritor1
parents:
diff changeset
236 void HandleLostResources();
Ritor1
parents:
diff changeset
237
Ritor1
parents:
diff changeset
238
Ritor1
parents:
diff changeset
239 unsigned int bWindowed;
Ritor1
parents:
diff changeset
240 int field_4;
Ritor1
parents:
diff changeset
241 int field_8;
Ritor1
parents:
diff changeset
242 HWND hWindow;
Ritor1
parents:
diff changeset
243 int field_10;
Ritor1
parents:
diff changeset
244 int field_14;
Ritor1
parents:
diff changeset
245 int field_18;
Ritor1
parents:
diff changeset
246 RenderD3D__DevInfo *pAvailableDevices;
Ritor1
parents:
diff changeset
247 IDirectDraw4 *pHost;
Ritor1
parents:
diff changeset
248 IDirect3D3 *pDirect3D;
Ritor1
parents:
diff changeset
249 IUnknown *pUnk;
Ritor1
parents:
diff changeset
250 IDirectDrawSurface4 *pBackBuffer;
Ritor1
parents:
diff changeset
251 IDirectDrawSurface4 *pFrontBuffer;
Ritor1
parents:
diff changeset
252 IDirectDrawSurface4 *pZBuffer;
Ritor1
parents:
diff changeset
253 IDirect3DDevice3 *pDevice;
Ritor1
parents:
diff changeset
254 IDirect3DViewport3 *pViewport;
Ritor1
parents:
diff changeset
255 int field_40;
Ritor1
parents:
diff changeset
256 int field_44;
Ritor1
parents:
diff changeset
257 char pErrorMessage[48];
Ritor1
parents:
diff changeset
258 char field_78[208];
Ritor1
parents:
diff changeset
259 };
Ritor1
parents:
diff changeset
260 #pragma pack(pop)
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
261 extern struct RenderVertexD3D3 pVertices[50];
0
Ritor1
parents:
diff changeset
262
Ritor1
parents:
diff changeset
263 /* 182 */
Ritor1
parents:
diff changeset
264 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
265 struct Render
Ritor1
parents:
diff changeset
266 {
Ritor1
parents:
diff changeset
267 Render();
Ritor1
parents:
diff changeset
268 ~Render();
Ritor1
parents:
diff changeset
269
Ritor1
parents:
diff changeset
270 static Render *Create() {return new Render;}
Ritor1
parents:
diff changeset
271
1512
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
272 bool Initialize(bool bWindowed, uint32_t uDefaultDevice,
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
273 bool bColoredLights, uint32_t uDetailLevel, bool bTinting);
0
Ritor1
parents:
diff changeset
274
Ritor1
parents:
diff changeset
275
Ritor1
parents:
diff changeset
276 bool IsColorKeySupported(IDirectDraw4 *);
Ritor1
parents:
diff changeset
277 void _49EBF1();
Ritor1
parents:
diff changeset
278 void ClearBlack();
Ritor1
parents:
diff changeset
279 void PresentBlackScreen();
Ritor1
parents:
diff changeset
280 void SavePCXScreenshot();
Ritor1
parents:
diff changeset
281 void _49F1BC(const char *a1);
810
f5156b8c61ad savegame refactoring
Gloval
parents: 728
diff changeset
282 void PackPCXpicture(unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size);
0
Ritor1
parents:
diff changeset
283 FILE *SavePCXImage(const char *Filename, char *a3, int a4, int a5);
Ritor1
parents:
diff changeset
284 void ClearTarget(unsigned int uColor);
Ritor1
parents:
diff changeset
285 void Release2();
Ritor1
parents:
diff changeset
286 void Present();
Ritor1
parents:
diff changeset
287 void _49FD3A();
Ritor1
parents:
diff changeset
288 void CreateZBuffer();
Ritor1
parents:
diff changeset
289 void Release();
Ritor1
parents:
diff changeset
290 void CreateSomeTexture();
Ritor1
parents:
diff changeset
291 bool InitializeFullscreen(HWND hWnd);
Ritor1
parents:
diff changeset
292 bool SwitchToWindow(HWND hWnd);
709
af08fc9e29c8 Items (blue dots) on minimap fixed
Nomad
parents: 688
diff changeset
293 char RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor);
0
Ritor1
parents:
diff changeset
294 void ClearZBuffer(int a2, int a3);
709
af08fc9e29c8 Items (blue dots) on minimap fixed
Nomad
parents: 688
diff changeset
295 void SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
0
Ritor1
parents:
diff changeset
296 void ParseTargetPixelFormat();
Ritor1
parents:
diff changeset
297 bool LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags);
Ritor1
parents:
diff changeset
298 bool LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags);
Ritor1
parents:
diff changeset
299 void CreateDirectDraw();
Ritor1
parents:
diff changeset
300 void SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen);
Ritor1
parents:
diff changeset
301 void SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP);
Ritor1
parents:
diff changeset
302 void CreateFrontBuffer();
Ritor1
parents:
diff changeset
303 void CreateBackBuffer();
Ritor1
parents:
diff changeset
304 void CreateDirectDrawPrimarySurface();
Ritor1
parents:
diff changeset
305 void CreateClipper(HWND a2);
Ritor1
parents:
diff changeset
306 void GetTargetPixelFormat(DDPIXELFORMAT *pOut);
Ritor1
parents:
diff changeset
307 void LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow);
Ritor1
parents:
diff changeset
308 bool UsingDirect3D();
Ritor1
parents:
diff changeset
309 void UnlockBackBuffer();
Ritor1
parents:
diff changeset
310 void LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow);
Ritor1
parents:
diff changeset
311 void UnlockFrontBuffer();
Ritor1
parents:
diff changeset
312 void RestoreFrontBuffer();
Ritor1
parents:
diff changeset
313 HRESULT _4A184C();
Ritor1
parents:
diff changeset
314 void PresentRect(RECT *a2, RECT *a3);
Ritor1
parents:
diff changeset
315 void BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags);
Ritor1
parents:
diff changeset
316 void BltBackToFontFast(int a2, int a3, RECT *a4);
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
317 unsigned int Billboard_ProbablyAddToListAndSortByZOrder(float z);
0
Ritor1
parents:
diff changeset
318 unsigned int GetBillboardDrawListSize();
Ritor1
parents:
diff changeset
319 unsigned int GetParentBillboardID(unsigned int uBillboardID);
Ritor1
parents:
diff changeset
320 void BeginSceneD3D();
Ritor1
parents:
diff changeset
321 void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
349
672b83584b0f GetActorTintColor
Nomad
parents: 315
diff changeset
322 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
323 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
324 void DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders);
1427
Ritor1
parents: 1413
diff changeset
325 void DrawSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture);
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
326 void _4A2ED5(signed int a2, struct Polygon *a3, IDirect3DTexture2 *pHwTex);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
327 void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1269
diff changeset
328 void DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID);
0
Ritor1
parents:
diff changeset
329 void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
Ritor1
parents:
diff changeset
330 void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
657
7747161ea5b5 RenderBillboard member rename
Nomad
parents: 515
diff changeset
331 void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard);
717
Ritor1
parents: 688
diff changeset
332 void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level);
0
Ritor1
parents:
diff changeset
333 int MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6);
Ritor1
parents:
diff changeset
334 void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1269
diff changeset
335 void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse);
0
Ritor1
parents:
diff changeset
336 bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture);
670
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
337 bool MoveSpriteToDevice(Sprite *pSprite);
0
Ritor1
parents:
diff changeset
338 void BeginScene();
Ritor1
parents:
diff changeset
339 void EndScene();
Ritor1
parents:
diff changeset
340 unsigned int _4A52F1(unsigned int this_, float a3);
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
341 void SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
342 void ResetTextureClipRect();
0
Ritor1
parents:
diff changeset
343 void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
Ritor1
parents:
diff changeset
344 void _4A5D33(unsigned int a2, unsigned int a3, int a4, int a5, RGBTexture *pTexture);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
345 void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
346 void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
347 void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
348 void DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture);
1455
bfe342ae0c1f DrawPaperdoll cleaning
Ritor1
parents: 1427
diff changeset
349 void DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
350 void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
351 void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
352 void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture);
1496
ab6bf38b2940 UIGame.cpp cleaning(continue)
Ritor1
parents: 1458
diff changeset
353 void GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height);
1268
2929c4406d2c guiwindow funcs cleanup
Gloval
parents: 1262
diff changeset
354 void DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8);
0
Ritor1
parents:
diff changeset
355 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);
Ritor1
parents:
diff changeset
356 void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16);
Ritor1
parents:
diff changeset
357 int _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
358 void _4A6E7E(unsigned int a2, unsigned int a3, struct Texture *a4);
0
Ritor1
parents:
diff changeset
359 char DrawBuildingsD3D();
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
360 //struct BSPModel *DrawBuildingsSW();
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
361 //int OnOutdoorRedrawSW();
0
Ritor1
parents:
diff changeset
362 void DrawSkyD3D();
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
363 //int DrawSkySW(struct Span *a1, Polygon *a2, int a3);
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
364 void PrepareDecorationsRenderList_ODM();
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 430
diff changeset
365 void DrawSpriteObjects_ODM();
0
Ritor1
parents:
diff changeset
366 void TransformBillboardsAndSetPalettesODM();
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
367 //float DrawBezierTerrain();
86
ec84db4c8f9d 4.01.13
Ritor1
parents: 67
diff changeset
368 void RenderTerrainD3D();
985
062788391c88 BezierTerrain little clean
Ritor1
parents: 973
diff changeset
369 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
370 //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
371 //void ExecOutdoorDrawSW();
0
Ritor1
parents:
diff changeset
372 void ChangeBetweenWinFullscreenModes();
Ritor1
parents:
diff changeset
373 void DrawBillboardList_BLV();
Ritor1
parents:
diff changeset
374
Ritor1
parents:
diff changeset
375
Ritor1
parents:
diff changeset
376 unsigned int bUserDirect3D;
Ritor1
parents:
diff changeset
377 unsigned int bStartInWindow;
Ritor1
parents:
diff changeset
378 unsigned int uDesiredDirect3DDevice;
Ritor1
parents:
diff changeset
379 unsigned int uAcquiredDirect3DDevice;
Ritor1
parents:
diff changeset
380 int field_10;
Ritor1
parents:
diff changeset
381 int field_14;
Ritor1
parents:
diff changeset
382 int field_18_locked_pitch;
709
af08fc9e29c8 Items (blue dots) on minimap fixed
Nomad
parents: 688
diff changeset
383 int raster_clip_x;
af08fc9e29c8 Items (blue dots) on minimap fixed
Nomad
parents: 688
diff changeset
384 int raster_clip_y; // clipping rect for raster ops
af08fc9e29c8 Items (blue dots) on minimap fixed
Nomad
parents: 688
diff changeset
385 int raster_clip_z; // like RasterLine2D for (mini)map
af08fc9e29c8 Items (blue dots) on minimap fixed
Nomad
parents: 688
diff changeset
386 int raster_clip_w;
0
Ritor1
parents:
diff changeset
387 __int16 field_2C[65536];
Ritor1
parents:
diff changeset
388 __int16 field_2002C[65536];
Ritor1
parents:
diff changeset
389 int field_4002C;
Ritor1
parents:
diff changeset
390 int field_40030;
Ritor1
parents:
diff changeset
391 int *pActiveZBuffer;
Ritor1
parents:
diff changeset
392 int *pDefaultZBuffer;
Ritor1
parents:
diff changeset
393 int field_4003C;
Ritor1
parents:
diff changeset
394 int field_40040;
Ritor1
parents:
diff changeset
395 int field_40044;
Ritor1
parents:
diff changeset
396 int field_40048;
Ritor1
parents:
diff changeset
397 int field_4004C;
Ritor1
parents:
diff changeset
398 HWND hWnd;
Ritor1
parents:
diff changeset
399 int field_40054;
Ritor1
parents:
diff changeset
400 unsigned int bWindowMode;
Ritor1
parents:
diff changeset
401 int field_4005C[11];
Ritor1
parents:
diff changeset
402 RenderD3D *pRenderD3D;
Ritor1
parents:
diff changeset
403 IDirectDraw4 *pDirectDraw4;
Ritor1
parents:
diff changeset
404 IDirectDrawSurface4 *pFrontBuffer4;
Ritor1
parents:
diff changeset
405 IDirectDrawSurface4 *pBackBuffer4;
Ritor1
parents:
diff changeset
406 IDirectDrawSurface4 *pColorKeySurface4;
Ritor1
parents:
diff changeset
407 IDirectDraw2 *pDirectDraw2;
Ritor1
parents:
diff changeset
408 IDirectDrawSurface2 *pFrontBuffer2;
Ritor1
parents:
diff changeset
409 IDirectDrawSurface2 *pBackBuffer2;
Ritor1
parents:
diff changeset
410 IDirectDrawSurface2 *pSomeSurface2;
Ritor1
parents:
diff changeset
411 DDPIXELFORMAT ddpfPrimareSuface;
Ritor1
parents:
diff changeset
412 unsigned int uTargetRBits;
Ritor1
parents:
diff changeset
413 unsigned int uTargetGBits;
Ritor1
parents:
diff changeset
414 unsigned int uTargetBBits;
Ritor1
parents:
diff changeset
415 unsigned int uTargetRMask;
Ritor1
parents:
diff changeset
416 unsigned int uTargetGMask;
Ritor1
parents:
diff changeset
417 unsigned int uTargetBMask;
Ritor1
parents:
diff changeset
418 unsigned int uNumSceneBegins;
Ritor1
parents:
diff changeset
419 int *ptr_400E8;
Ritor1
parents:
diff changeset
420 unsigned __int16 *pTargetSurface;
Ritor1
parents:
diff changeset
421 unsigned int uTargetSurfacePitch;
Ritor1
parents:
diff changeset
422 unsigned int uClipY;
Ritor1
parents:
diff changeset
423 unsigned int uClipX;
Ritor1
parents:
diff changeset
424 unsigned int uClipW;
Ritor1
parents:
diff changeset
425 unsigned int uClipZ;
Ritor1
parents:
diff changeset
426 unsigned int bClip;
Ritor1
parents:
diff changeset
427 unsigned int bColorKeySupported;
Ritor1
parents:
diff changeset
428 unsigned int uNumD3DSceneBegins;
Ritor1
parents:
diff changeset
429 int field_40110;
Ritor1
parents:
diff changeset
430 RenderHWLContainer pD3DBitmaps;
Ritor1
parents:
diff changeset
431 RenderHWLContainer pD3DSprites;
Ritor1
parents:
diff changeset
432 unsigned int bUseColoredLights;
Ritor1
parents:
diff changeset
433 unsigned int bRequiredTextureStagesAvailable;
Ritor1
parents:
diff changeset
434 unsigned int bTinting;
Ritor1
parents:
diff changeset
435 unsigned int uLevelOfDetail;
Ritor1
parents:
diff changeset
436 unsigned int uMaxDeviceTextureDim;
Ritor1
parents:
diff changeset
437 unsigned int uMinDeviceTextureDim;
Ritor1
parents:
diff changeset
438 int field_10365C;
Ritor1
parents:
diff changeset
439 unsigned int bUsingSpecular;
1512
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
440 uint32_t uFogColor;
0
Ritor1
parents:
diff changeset
441 int field_103668;
Ritor1
parents:
diff changeset
442 unsigned int pHDWaterBitmapIDs[7];
Ritor1
parents:
diff changeset
443 char field_103688[32];
265
96bc024a5fed Render overflows
Nomad
parents: 194
diff changeset
444 int hd_water_current_frame;
96bc024a5fed Render overflows
Nomad
parents: 194
diff changeset
445 int hd_water_tile_id;
0
Ritor1
parents:
diff changeset
446 IDirectDrawSurface4 *pSurface;
Ritor1
parents:
diff changeset
447 IDirect3DTexture2 *pTexture;
Ritor1
parents:
diff changeset
448 int field_1036B8;
Ritor1
parents:
diff changeset
449 int _gpu_memory_used;
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
450 void ( *pBeforePresentFunction)();
0
Ritor1
parents:
diff changeset
451 int field_1036C4;
1512
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
452 uint32_t bFogEnabled;
0
Ritor1
parents:
diff changeset
453 int field_1036CC;
Ritor1
parents:
diff changeset
454 RenderBillboardD3D pBillboardRenderListD3D[1000];
Ritor1
parents:
diff changeset
455 unsigned int uNumBillboardsToDraw;
Ritor1
parents:
diff changeset
456 int field_129834;
Ritor1
parents:
diff changeset
457 unsigned int uCurrentlyLockedSurfacePitch;
Ritor1
parents:
diff changeset
458 unsigned __int16 *pCurrentlyLockedSurfaceDataPtr;
Ritor1
parents:
diff changeset
459 unsigned __int16 *pCurrentlyLockedSoftSurface;
Ritor1
parents:
diff changeset
460 };
Ritor1
parents:
diff changeset
461 #pragma pack(pop)
Ritor1
parents:
diff changeset
462
Ritor1
parents:
diff changeset
463 extern struct IDirectDrawClipper *pDDrawClipper;
Ritor1
parents:
diff changeset
464 extern struct Render *pRenderer; // idb
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 0
diff changeset
465 extern struct pUnkTerrain *Unks;
0
Ritor1
parents:
diff changeset
466
Ritor1
parents:
diff changeset
467
Ritor1
parents:
diff changeset
468
Ritor1
parents:
diff changeset
469 /* 248 */
Ritor1
parents:
diff changeset
470 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
471 struct RenderBillboardTransform_local0
Ritor1
parents:
diff changeset
472 {
Ritor1
parents:
diff changeset
473 unsigned __int16 *pTarget;
Ritor1
parents:
diff changeset
474 int *pTargetZ;
Ritor1
parents:
diff changeset
475 int uScreenSpaceX;
Ritor1
parents:
diff changeset
476 int uScreenSpaceY;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
477 int _screenspace_x_scaler_packedfloat;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
478 int _screenspace_y_scaler_packedfloat;
0
Ritor1
parents:
diff changeset
479 char field_18[8];
Ritor1
parents:
diff changeset
480 unsigned __int16 *pPalette;
Ritor1
parents:
diff changeset
481 unsigned __int16 *pPalette2;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
482 union
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
483 {
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
484 int sZValue;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
485 struct
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
486 {
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
487 unsigned short object_pid;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
488 short zbuffer_depth;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
489 };
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
490 };
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
491 unsigned int uFlags; // & 4 - mirror horizontally
0
Ritor1
parents:
diff changeset
492 unsigned int uTargetPitch;
Ritor1
parents:
diff changeset
493 unsigned int uViewportX;
Ritor1
parents:
diff changeset
494 unsigned int uViewportY;
Ritor1
parents:
diff changeset
495 unsigned int uViewportZ;
Ritor1
parents:
diff changeset
496 unsigned int uViewportW;
Ritor1
parents:
diff changeset
497 int field_44;
Ritor1
parents:
diff changeset
498 int uParentBillboardID;
Ritor1
parents:
diff changeset
499 int uTintColor;
Ritor1
parents:
diff changeset
500 };
Ritor1
parents:
diff changeset
501 #pragma pack(pop)
Ritor1
parents:
diff changeset
502
Ritor1
parents:
diff changeset
503
Ritor1
parents:
diff changeset
504
Ritor1
parents:
diff changeset
505
Ritor1
parents:
diff changeset
506 extern int uNumDecorationsDrawnThisFrame; // weak
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
507 extern RenderBillboard pBillboardRenderList[500];
0
Ritor1
parents:
diff changeset
508 extern unsigned int uNumBillboardsToDraw;
Ritor1
parents:
diff changeset
509 extern int uNumSpritesDrawnThisFrame; // weak
Ritor1
parents:
diff changeset
510
Ritor1
parents:
diff changeset
511
Ritor1
parents:
diff changeset
512
Ritor1
parents:
diff changeset
513
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
514 extern RenderVertexSoft array_507D30[50];
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
515 extern RenderVertexSoft array_50AC10[50];
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
516 extern RenderVertexSoft array_73D150[20];
0
Ritor1
parents:
diff changeset
517
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1391
diff changeset
518 extern RenderVertexD3D3 d3d_vertex_buffer[50];