Mercurial > mm7
diff Render.cpp @ 781:d170f23f70d1
tidy, code moving
author | zipi |
---|---|
date | Sun, 24 Mar 2013 01:27:34 +0000 |
parents | 45615cacad31 |
children | 346f7069676a |
line wrap: on
line diff
--- a/Render.cpp Sun Mar 24 00:42:55 2013 +0000 +++ b/Render.cpp Sun Mar 24 01:27:34 2013 +0000 @@ -22,19 +22,11 @@ #include "Log.h" #include "TileFrameTable.h" #include "texts.h" - #include "mm7_data.h" - #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") - - - - - - struct IDirectDrawClipper *pDDrawClipper; struct Render *pRenderer; // idb struct RenderVertexD3D3 pVertices[50]; @@ -43,7 +35,6 @@ unsigned int uNumBillboardsToDraw; int uNumSpritesDrawnThisFrame; // weak - RenderVertexSoft array_507D30[50]; RenderVertexSoft array_508690[50]; RenderVertexSoft array_508FF0[50]; @@ -61,15 +52,8 @@ RenderVertexSoft pVerticesSR_801A10[384]; RenderVertexSoft pVerticesSR_806210[384]; - - - - - - void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); - /* 384 */ #pragma pack(push, 1) struct PCXHeader_1 @@ -98,29 +82,11 @@ }; #pragma pack(pop) - - - - - - - HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst); HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2); HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, struct RenderD3D_aux *a6); signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut); // idb - - - - - - - - - - - //----- (0049E79F) -------------------------------------------------------- bool __cdecl CheckTextureStages() { @@ -163,18 +129,6 @@ return v0; } - - - - - - - - - - - - //----- (00440CB8) -------------------------------------------------------- void Render::DrawBillboardList_BLV() { @@ -224,10 +178,6 @@ } } - - - - //----- (004A16A5) -------------------------------------------------------- bool __cdecl AreRenderSurfacesOk() { @@ -256,8 +206,6 @@ return result; } - - //----- (00487389) -------------------------------------------------------- __int16 Render::ExecOutdoorDrawSW() { @@ -2476,8 +2424,6 @@ // 4D864C: using guessed type char byte_4D864C; // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag; - - //----- (00481212) -------------------------------------------------------- void Render::DrawTerrainSW(int a1, int a2, int a3) { @@ -2976,7 +2922,6 @@ } } - //----- (0047BACF) -------------------------------------------------------- void Render::TransformBillboardsAndSetPalettesODM() { @@ -3056,7 +3001,6 @@ } } - //----- (0047AF11) -------------------------------------------------------- void Render::DrawSpriteObjects_ODM() { @@ -3263,7 +3207,6 @@ // 4E94D3: using guessed type char byte_4E94D3; // 5187E4: using guessed type int uNumSpritesDrawnThisFrame; - //----- (0049D9BC) -------------------------------------------------------- signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut) { @@ -3383,7 +3326,6 @@ return 1; } - //----- (0049D784) -------------------------------------------------------- HRESULT __stdcall D3DDeviceEnumerator(const GUID *lpGUID, const char *lpDeviceDesc, const char *lpDeviceName, D3DDEVICEDESC *pHWDesc, D3DDEVICEDESC *pSWDesc, RenderD3D_aux *a6) { @@ -3461,7 +3403,6 @@ return 1; } - //----- (0049D75C) -------------------------------------------------------- HRESULT __stdcall DDrawDisplayModesEnumerator(DDSURFACEDESC2 *pSurfaceDesc, __int16 *a2) { @@ -3479,8 +3420,6 @@ return result; } - - //----- (0047A95E) -------------------------------------------------------- void Render::PrepareDecorationsRenderList_ODM() { @@ -3803,7 +3742,6 @@ // 4E94D0: using guessed type char byte_4E94D0; // 5187EC: using guessed type int uNumDecorationsDrawnThisFrame; - //----- (0049D717) -------------------------------------------------------- HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst) { @@ -3836,7 +3774,6 @@ DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices); } - //----- (0049DC58) -------------------------------------------------------- RenderD3D::RenderD3D() { @@ -3978,7 +3915,6 @@ } } - //----- (0049DE14) -------------------------------------------------------- bool RenderD3D::CreateDevice(unsigned int uDeviceID, int bWindowed, HWND hWnd) { @@ -4254,7 +4190,6 @@ return 1; } - //----- (0049E444) -------------------------------------------------------- unsigned int RenderD3D::GetDeviceCaps() { @@ -4297,7 +4232,6 @@ return result; } - //----- (0049E4FC) -------------------------------------------------------- void RenderD3D::ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear) { @@ -4313,7 +4247,6 @@ pViewport->Clear2(1, rects, uClearFlags, uClearColor, z_clear, 0); } - //----- (0049E54D) -------------------------------------------------------- void RenderD3D::Present(bool bForceBlit) { @@ -4339,7 +4272,6 @@ pFrontBuffer->Flip(0, 1); } - //----- (0049E5D4) -------------------------------------------------------- bool RenderD3D::CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim) { @@ -4430,8 +4362,6 @@ pSprites_LOD->ReleaseLostHardwareSprites(); } - - //----- (004A2050) -------------------------------------------------------- void Render::DrawPolygon(unsigned int uNumVertices, stru148 *a3, ODMFace *a4, IDirect3DTexture2 *pTexture) { @@ -4693,7 +4623,6 @@ } // 4D864C: using guessed type char byte_4D864C; - //----- (0049EB79) -------------------------------------------------------- Render::~Render() { @@ -4709,8 +4638,6 @@ //nullsub_1(); } - - //----- (0049E756) -------------------------------------------------------- bool Render::IsColorKeySupported(IDirectDraw4 *this_) { @@ -4785,8 +4712,7 @@ hd_water_current_frame = 0; } -bool Render::Initialize(bool bWindowed, uint uDefaultDevice, - bool bColoredLights, uint uDetailLevel, uint bTinting) +bool Render::Initialize(bool bWindowed, uint uDefaultDevice, bool bColoredLights, uint uDetailLevel, uint bTinting) { bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0); bStartInWindow = bWindowed; @@ -4804,8 +4730,6 @@ return r1 && r2; } - - //----- (0049EBF1) -------------------------------------------------------- void Render::_49EBF1() { @@ -4856,7 +4780,6 @@ } } - //----- (0049ECC4) -------------------------------------------------------- void Render::ClearBlack() { @@ -4869,7 +4792,6 @@ memset(pRenderer->pTargetSurface, 0, 4 * (field_10 * field_14 / 2)); } - //----- (0049ED18) -------------------------------------------------------- void Render::PresentBlackScreen() { @@ -4903,7 +4825,6 @@ pRenderer->Present(); } - //----- (0049EDB6) -------------------------------------------------------- void Render::SavePCXScreenshot() { @@ -5088,7 +5009,6 @@ } // 4EFA80: using guessed type int dword_4EFA80; - //----- (0049F1BC) -------------------------------------------------------- void Render::_49F1BC(const char *a1) { @@ -5283,8 +5203,6 @@ } // 4EFA84: using guessed type int dword_4EFA84; - - //----- (0049F5A2) -------------------------------------------------------- int Render::_49F5A2(int a2, int a3, int a4, void *Dst, int a6, int a7) { @@ -5456,7 +5374,6 @@ return result; } - //----- (0049F8B5) -------------------------------------------------------- FILE *Render::SavePCXImage(const char *Filename, char *a3, int a4, int a5) { @@ -5593,7 +5510,6 @@ return result; } - //----- (0049FBCD) -------------------------------------------------------- void Render::ClearTarget(unsigned int uColor) { @@ -5606,8 +5522,6 @@ memset32(pTargetSurface, uColor, field_10 * field_14 / 2); } - - //----- (0049FC23) -------------------------------------------------------- void Render::Release2() { @@ -5615,7 +5529,6 @@ bWindowMode = 1; } - //----- (0049FC37) -------------------------------------------------------- void Render::Present() { @@ -5694,7 +5607,6 @@ } } - //----- (0049FDBF) -------------------------------------------------------- void Render::CreateZBuffer() { @@ -5706,7 +5618,6 @@ } } - //----- (0049FE05) -------------------------------------------------------- void Render::Release() { @@ -6059,7 +5970,6 @@ } // 6BE3A0: using guessed type float flt_6BE3A0; - //----- (004A05F3) -------------------------------------------------------- bool Render::SwitchToWindow(HWND hWnd) { @@ -6292,7 +6202,6 @@ return 0; } - //----- (004A0BEE) -------------------------------------------------------- char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) { @@ -6526,16 +6435,12 @@ return v12; } - - //----- (004A0E80) -------------------------------------------------------- void Render::ClearZBuffer(int a2, int a3) { memset32(this->pActiveZBuffer, -65536, 0x4B000u); } - - //----- (004A0E97) -------------------------------------------------------- void Render::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) { @@ -6545,7 +6450,6 @@ this->raster_clip_w = uW; } - //----- (004A0EB6) -------------------------------------------------------- void Render::ParseTargetPixelFormat() { @@ -6660,7 +6564,6 @@ return result; } - //----- (004A1032) -------------------------------------------------------- bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags) { @@ -6991,7 +6894,6 @@ return bUserDirect3D == 0; } - //----- (004A16E1) -------------------------------------------------------- void Render::UnlockBackBuffer() { @@ -7001,7 +6903,6 @@ ErrD3D(pBackBuffer2->Unlock(0)); } - //----- (004A172E) -------------------------------------------------------- void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) { @@ -7054,7 +6955,6 @@ ErrD3D(pFront->Unlock(0)); } - //----- (004A1814) -------------------------------------------------------- void Render::RestoreFrontBuffer() { @@ -7067,7 +6967,6 @@ (*v1)->Restore(); } - //----- (004A184C) -------------------------------------------------------- HRESULT Render::_4A184C() { @@ -7121,7 +7020,6 @@ ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8)); } - //----- (004A18F5) -------------------------------------------------------- void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags) { @@ -7238,7 +7136,6 @@ return v7; } - //----- (004A1E9D) -------------------------------------------------------- unsigned int Render::GetBillboardDrawListSize() { @@ -7312,8 +7209,6 @@ pGame->pStru6Instance->RenderSpecialEffects(); } - - //----- (004A2031) -------------------------------------------------------- unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) { @@ -7718,7 +7613,6 @@ pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES ) pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); } - // 4A26BC: could not find valid save-restore pair for esi // 4D864C: using guessed type char byte_4D864C; @@ -7766,6 +7660,7 @@ pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); } } + //----- (004A2DA3) -------------------------------------------------------- void Render::DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture) { @@ -7810,7 +7705,6 @@ } } - //----- (004A2ED5) -------------------------------------------------------- void Render::_4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex) { @@ -7866,8 +7760,6 @@ } } - - //----- (004A2FC0) -------------------------------------------------------- void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) { @@ -8075,7 +7967,6 @@ } // 4D864C: using guessed type char byte_4D864C; - //----- (004A43B1) -------------------------------------------------------- void Render::DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level) { @@ -8204,8 +8095,6 @@ } } - - //----- (004A354F) -------------------------------------------------------- void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) { @@ -8381,7 +8270,6 @@ } } - //----- (004A3AD9) -------------------------------------------------------- void Render::MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) { @@ -8554,7 +8442,6 @@ } } - //----- (004A4023) -------------------------------------------------------- void Render::TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard) { @@ -8660,7 +8547,6 @@ pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent; } - //----- (004A48E4) -------------------------------------------------------- int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6) { @@ -8854,7 +8740,6 @@ ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); } - //----- (004A4CC9) -------------------------------------------------------- void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2) { @@ -8932,7 +8817,6 @@ } } - //----- (004A4DE1) -------------------------------------------------------- bool Render::LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture) { @@ -9186,7 +9070,6 @@ } } - //----- ( ) -------------------------------------------------------- unsigned int Render::_4A52F1(unsigned int this_, float a3) { @@ -9394,8 +9277,6 @@ return result; } - - //----- (004A5B81) -------------------------------------------------------- void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) { @@ -9406,7 +9287,6 @@ this->uClipZ = uZ; } - //----- (004A5BB6) -------------------------------------------------------- void Render::ResetTextureClipRect() { @@ -9417,7 +9297,6 @@ this->uClipZ = 640; } - //----- (004A5BE3) -------------------------------------------------------- void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) { @@ -9521,7 +9400,6 @@ } } - //----- (004A5D33) -------------------------------------------------------- void Render::_4A5D33(unsigned int pX, unsigned int pY, int a4, int a5, RGBTexture *pTexture) { @@ -9634,8 +9512,6 @@ } } - - //----- (004A6E7E) -------------------------------------------------------- void Render::_4A6E7E(unsigned int a2, unsigned int a3, Texture *a4) { @@ -9768,7 +9644,6 @@ } } - //----- (004A6DF5) -------------------------------------------------------- int Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, unsigned __int16 *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) { @@ -9818,7 +9693,6 @@ return result; } - //----- (004A6D87) -------------------------------------------------------- void Render::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) { @@ -9836,8 +9710,6 @@ } } - - //----- (004A6C4F) -------------------------------------------------------- void Render::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) { @@ -9937,8 +9809,6 @@ } } - - //----- (004A6A68) -------------------------------------------------------- void Render::_4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height) { @@ -9957,8 +9827,6 @@ DrawTextureIndexed(a2, a3, &tex); } - - //----- (004A6AB1) -------------------------------------------------------- void Render::DrawTextPalette(int x, int y, int a4, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8) { @@ -10209,7 +10077,6 @@ } } - //----- (004A6776) -------------------------------------------------------- void Render::DrawTransparentRedShade(unsigned int a2, unsigned int a3, Texture *a4) { @@ -10425,7 +10292,6 @@ } } - //----- (004A63E6) -------------------------------------------------------- void Render::_4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) { @@ -10549,7 +10415,6 @@ } } - //----- (004A6274) -------------------------------------------------------- void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) { @@ -10658,7 +10523,6 @@ } } - //----- (004A612A) -------------------------------------------------------- void Render::DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal) { @@ -10764,7 +10628,6 @@ } } - //----- (004A601E) -------------------------------------------------------- void Render::_4A601E(signed int a2, signed int a3, Texture *pTexture, int a5) { @@ -11104,14 +10967,12 @@ // 6BE364: using guessed type int dword_6BE364_game_settings_1; // A74C88: using guessed type int dword_A74C88; - //----- (0044EC20) -------------------------------------------------------- bool RenderD3D::DoesRaiseExceptions() { return true; } - //----- (0040DBD3) -------------------------------------------------------- void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor) { @@ -11142,7 +11003,6 @@ } } - //----- (004524D8) -------------------------------------------------------- HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) { @@ -11383,14 +11243,6 @@ return true; } - - - - - - - - //----- (004A1C1E) -------------------------------------------------------- void DoRenderBillboards_D3D() { @@ -11459,10 +11311,6 @@ ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); } - - - - //----- (004A1DA8) -------------------------------------------------------- void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1) {