Mercurial > mm7
comparison Render.cpp @ 1178:f7ad7bd0a806
Слияние
author | Ritor1 |
---|---|
date | Tue, 04 Jun 2013 09:44:53 +0600 |
parents | dac817fbf85a 29a8defbad9e |
children | fa30ea497e94 |
comparison
equal
deleted
inserted
replaced
1177:ce5ff6d32200 | 1178:f7ad7bd0a806 |
---|---|
1 #ifdef _MSC_VER | |
2 #define _CRT_SECURE_NO_WARNINGS | |
3 #endif | |
4 | |
1 #include <assert.h> | 5 #include <assert.h> |
2 | 6 |
3 #include "VideoPlayer.h" | 7 #include "VideoPlayer.h" |
4 #include "Sprites.h" | 8 #include "Sprites.h" |
5 #include "Mouse.h" | 9 #include "Mouse.h" |
1828 } | 1832 } |
1829 | 1833 |
1830 assert(v6 < 1000); // many random crashes here | 1834 assert(v6 < 1000); // many random crashes here |
1831 | 1835 |
1832 // for all shore tiles - draw a tile water under them since they're half-empty | 1836 // for all shore tiles - draw a tile water under them since they're half-empty |
1833 if (!strnicmp(pBitmaps_LOD->pTextures[v8->uTileBitmapID].pName, "wtrdr", 5)) // all shore tile filenames are wtrdrXXX | 1837 if (!_strnicmp(pBitmaps_LOD->pTextures[v8->uTileBitmapID].pName, "wtrdr", 5)) // all shore tile filenames are wtrdrXXX |
1834 { | 1838 { |
1835 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); // no Z writing: the shore tile will be draw in the same place, so taking care about z-fighting | 1839 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); // no Z writing: the shore tile will be draw in the same place, so taking care about z-fighting |
1836 pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true); | 1840 pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true); |
1837 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); | 1841 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); |
1838 | 1842 |
6515 | 6519 |
6516 //----- (004A1032) -------------------------------------------------------- | 6520 //----- (004A1032) -------------------------------------------------------- |
6517 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags) | 6521 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags) |
6518 { | 6522 { |
6519 IDirectDrawSurface2 *v4; // esi@1 | 6523 IDirectDrawSurface2 *v4; // esi@1 |
6520 bool v5; // eax@1 | 6524 HRESULT v5; // eax@1 |
6521 HRESULT v6; // eax@2 | 6525 HRESULT v6; // eax@2 |
6522 int v7; // [sp-8h] [bp-10h]@8 | 6526 int v7; // [sp-8h] [bp-10h]@8 |
6523 unsigned int v8; // [sp-4h] [bp-Ch]@8 | 6527 unsigned int v8; // [sp-4h] [bp-Ch]@8 |
6524 | 6528 |
6525 v4 = pSurface; | 6529 v4 = pSurface; |
8434 } | 8438 } |
8435 | 8439 |
8436 //----- (004A49D0) -------------------------------------------------------- | 8440 //----- (004A49D0) -------------------------------------------------------- |
8437 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9) | 8441 void Render::DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9) |
8438 { | 8442 { |
8439 int v10; // eax@1 | 8443 int absXDifference; // eax@1 |
8440 unsigned int v11; // ebx@1 | 8444 int absYDifference; // eax@1 |
8441 unsigned int v12; // ecx@1 | 8445 unsigned int smallerabsdiff; // ebx@1 |
8442 int v13; // edx@2 | 8446 unsigned int largerabsdiff; |
8443 int v14; // edx@4 | |
8444 unsigned int v15; // edx@6 | |
8445 double v16; // st7@7 | 8447 double v16; // st7@7 |
8446 double v17; // st7@7 | 8448 double v17; // st7@7 |
8447 double v18; // st6@7 | 8449 double v18; // st6@7 |
8448 double v19; // st4@7 | |
8449 double v20; // st4@8 | 8450 double v20; // st4@8 |
8450 double v21; // st4@10 | 8451 double v21; // st4@10 |
8451 double v22; // st4@10 | 8452 double v22; // st4@10 |
8452 double v23; // st4@10 | 8453 double v23; // st4@10 |
8453 double v24; // st4@10 | |
8454 double v25; // st4@11 | 8454 double v25; // st4@11 |
8455 double v26; // st4@13 | 8455 double v26; // st4@13 |
8456 double v27; // st5@13 | |
8457 double v28; // st4@13 | 8456 double v28; // st4@13 |
8458 RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7 | 8457 RenderVertexD3D3 v29[4]; // [sp+0h] [bp-94h]@7 |
8459 double v30; // [sp+80h] [bp-14h]@1 | 8458 int xDifference; // [sp+88h] [bp-Ch]@1 |
8460 int v31; // [sp+88h] [bp-Ch]@1 | |
8461 signed int v32; // [sp+8Ch] [bp-8h]@1 | 8459 signed int v32; // [sp+8Ch] [bp-8h]@1 |
8462 int X; // [sp+90h] [bp-4h]@1 | 8460 int yDifference; // [sp+90h] [bp-4h]@1 |
8463 float a3a; // [sp+A4h] [bp+10h]@10 | 8461 |
8464 float a4a; // [sp+A8h] [bp+14h]@10 | 8462 xDifference = bankersRounding(dstX - srcX); |
8465 | 8463 yDifference = bankersRounding(dstY - srcY); |
8466 *(float *)&X = dstX - srcX; | 8464 absYDifference = abs(yDifference); |
8467 v30 = *(float *)&X + 6.7553994e15; | 8465 absXDifference = abs(xDifference); |
8468 v31 = LODWORD(v30); | 8466 smallerabsdiff = min(absXDifference, absYDifference); |
8469 *(float *)&v32 = dstY - srcY; | 8467 largerabsdiff = max(absXDifference, absYDifference); |
8470 v30 = *(float *)&v32 + 6.7553994e15; | 8468 v32 = (11 * smallerabsdiff >> 5) + largerabsdiff; |
8471 X = LODWORD(v30); | |
8472 HIDWORD(v30) = abs(COERCE_UNSIGNED_INT64(*(float *)&v32 + 6.7553994e15)); | |
8473 v10 = abs(v31); | |
8474 v32 = v10; | |
8475 v11 = HIDWORD(v30); | |
8476 v12 = 0; | |
8477 if ( v10 < SHIDWORD(v30) ) | |
8478 { | |
8479 v13 = v10; | |
8480 v10 = HIDWORD(v30); | |
8481 v11 = v13; | |
8482 } | |
8483 if ( v10 < 0 ) | |
8484 { | |
8485 v14 = v10; | |
8486 v10 = 0; | |
8487 v12 = v14; | |
8488 } | |
8489 if ( (signed int)v11 < (signed int)v12 ) | |
8490 { | |
8491 v15 = v12; | |
8492 v12 = v11; | |
8493 v11 = v15; | |
8494 } | |
8495 v32 = (11 * v11 >> 5) + (v12 >> 2) + v10; | |
8496 v16 = 1.0 / (double)v32; | 8469 v16 = 1.0 / (double)v32; |
8497 *(float *)&v31 = (double)v31 * v16; | 8470 v17 = (double)yDifference * v16 * a4; |
8498 *(float *)&X = (double)X * v16; | 8471 v18 = (double)xDifference * v16 * a4; |
8499 v17 = *(float *)&X * a4; | 8472 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
8473 { | |
8474 v20 = a3 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
8475 v25 = a7 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
8476 } | |
8477 else | |
8478 { | |
8479 v20 = a3 * 0.061758894; | |
8480 v25 = a7 * 0.061758894; | |
8481 } | |
8482 v21 = 1.0 / a3; | |
8483 v22 = (double)yDifference * v16 * a8; | |
8484 v23 = (double)xDifference * v16 * a8; | |
8485 v26 = 1.0 - 1.0 / v25; | |
8486 v28 = 1.0 / a7; | |
8500 v29[0].pos.x = srcX + v17; | 8487 v29[0].pos.x = srcX + v17; |
8501 v18 = *(float *)&v31 * a4; | |
8502 v29[0].pos.y = srcY - v18; | 8488 v29[0].pos.y = srcY - v18; |
8503 v19 = a3; | 8489 v29[0].pos.z = 1.0 - 1.0 / v20; |
8504 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | 8490 v29[0].rhw = v21; |
8505 v20 = v19 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
8506 else | |
8507 v20 = v19 * 0.061758894; | |
8508 v29[0].diffuse = -1; | 8491 v29[0].diffuse = -1; |
8509 v29[0].specular = 0; | 8492 v29[0].specular = 0; |
8510 v29[0].pos.z = 1.0 - 1.0 / v20; | |
8511 v21 = 1.0 / a3; | |
8512 *((float *)&v30 + 1) = v21; | |
8513 v29[0].rhw = v21; | |
8514 v29[0].texcoord.x = 1.0; | 8493 v29[0].texcoord.x = 1.0; |
8515 v29[0].texcoord.y = 0.0; | 8494 v29[0].texcoord.y = 0.0; |
8516 v22 = *(float *)&X * a8; | 8495 |
8517 a3a = v22; | |
8518 v29[1].pos.x = v22 + dstX; | 8496 v29[1].pos.x = v22 + dstX; |
8519 v23 = *(float *)&v31 * a8; | |
8520 a4a = v23; | |
8521 v29[1].pos.y = dstY - v23; | 8497 v29[1].pos.y = dstY - v23; |
8522 v24 = a7; | 8498 v29[1].pos.z = v26; |
8523 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | 8499 v29[1].rhw = v28; |
8524 v25 = v24 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist; | |
8525 else | |
8526 v25 = v24 * 0.061758894; | |
8527 v29[2].diffuse = -1; | |
8528 v29[3].diffuse = -1; | |
8529 *(_QWORD *)&v29[3].pos.z = __PAIR__(HIDWORD(v30), LODWORD(v29[0].pos.z)); | |
8530 v29[1].diffuse = -16711936; | 8500 v29[1].diffuse = -16711936; |
8531 v29[1].specular = 0; | 8501 v29[1].specular = 0; |
8532 v29[2].specular = 0; | |
8533 v29[3].specular = 0; | |
8534 v26 = 1.0 - 1.0 / v25; | |
8535 v29[1].pos.z = v26; | |
8536 v27 = v26; | |
8537 v28 = 1.0 / a7; | |
8538 v29[1].rhw = v28; | |
8539 v29[1].texcoord.x = 1.0; | 8502 v29[1].texcoord.x = 1.0; |
8540 v29[1].texcoord.y = 1.0; | 8503 v29[1].texcoord.y = 1.0; |
8541 v29[2].pos.x = dstX - a3a; | 8504 |
8542 v29[2].pos.y = a4a + dstY; | 8505 v29[2].pos.x = dstX - v22; |
8543 v29[2].pos.z = v27; | 8506 v29[2].pos.y = v23 + dstY; |
8507 v29[2].pos.z = v26; | |
8544 v29[2].rhw = v28; | 8508 v29[2].rhw = v28; |
8509 v29[2].diffuse = -1; | |
8510 v29[2].specular = 0; | |
8545 v29[2].texcoord.x = 0.0; | 8511 v29[2].texcoord.x = 0.0; |
8546 v29[2].texcoord.y = 1.0; | 8512 v29[2].texcoord.y = 1.0; |
8513 | |
8547 v29[3].pos.x = srcX - v17; | 8514 v29[3].pos.x = srcX - v17; |
8548 v29[3].pos.y = v18 + srcY; | 8515 v29[3].pos.y = v18 + srcY; |
8516 v29[3].pos.z = v29[0].pos.z; | |
8517 v29[3].rhw = v21; | |
8518 v29[3].diffuse = -1; | |
8519 v29[3].specular = 0; | |
8549 v29[3].texcoord.x = 0.0; | 8520 v29[3].texcoord.x = 0.0; |
8550 v29[3].texcoord.y = 0.0; | 8521 v29[3].texcoord.y = 0.0; |
8551 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | 8522 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
8552 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | 8523 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
8553 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | 8524 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); |
10585 | 10556 |
10586 //----- (004667E9) -------------------------------------------------------- | 10557 //----- (004667E9) -------------------------------------------------------- |
10587 void Render::ChangeBetweenWinFullscreenModes() | 10558 void Render::ChangeBetweenWinFullscreenModes() |
10588 { | 10559 { |
10589 float v0; // ST14_4@17 | 10560 float v0; // ST14_4@17 |
10590 bool v1; // edx@24 | |
10591 signed int v2; // ecx@24 | |
10592 int v3; // esi@25 | |
10593 int v4; // edx@26 | 10561 int v4; // edx@26 |
10594 ObjectDesc *v5; // eax@26 | 10562 ObjectDesc *v5; // eax@26 |
10595 RGBTexture *v6; // esi@33 | 10563 RGBTexture *v6; // esi@33 |
10596 const char *v7; // eax@34 | |
10597 const char *v8; // [sp-4h] [bp-28h]@33 | 10564 const char *v8; // [sp-4h] [bp-28h]@33 |
10598 int v9; // [sp+0h] [bp-24h]@33 | |
10599 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 | 10565 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 |
10600 | 10566 |
10601 if ( pRenderer->bWindowMode ) | 10567 if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) ) |
10602 goto LABEL_52; | |
10603 if ( dword_6BE364_game_settings_1 & 2 ) | |
10604 { | 10568 { |
10605 ModalWindow(pGlobalTXT_LocalizationStrings[62], 0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window." | 10569 ModalWindow(pGlobalTXT_LocalizationStrings[62], 0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window." |
10606 return; | 10570 return; |
10607 } | 10571 } |
10608 if ( !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) | 10572 if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) |
10609 { | 10573 { |
10610 LABEL_52: | |
10611 if ( pEventTimer->bPaused ) | 10574 if ( pEventTimer->bPaused ) |
10612 BYTE1(dword_6BE364_game_settings_1) |= 8u; | 10575 BYTE1(dword_6BE364_game_settings_1) |= 8u; |
10613 else | 10576 else |
10614 pEventTimer->Pause(); | 10577 pEventTimer->Pause(); |
10615 if ( pMiscTimer->bPaused ) | 10578 if ( pMiscTimer->bPaused ) |
10648 if ( pRenderer->pRenderD3D ) | 10611 if ( pRenderer->pRenderD3D ) |
10649 { | 10612 { |
10650 pBitmaps_LOD->_410423_move_textures_to_device(); | 10613 pBitmaps_LOD->_410423_move_textures_to_device(); |
10651 pSprites_LOD->MoveSpritesToVideoMemory(); | 10614 pSprites_LOD->MoveSpritesToVideoMemory(); |
10652 } | 10615 } |
10653 if ( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits | 10616 if (!( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits |
10654 && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits | 10617 && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits |
10655 && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits ) | 10618 && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits )) |
10656 goto LABEL_38; | 10619 { |
10657 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | 10620 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
10658 pPaletteManager->RecalculateAll(); | 10621 pPaletteManager->RecalculateAll(); |
10659 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | 10622 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
10660 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | 10623 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
10661 v2 = 0; | 10624 for (int i = 0; i < pObjectList->uNumObjects; i++) |
10662 if ( (signed int)pObjectList->uNumObjects > 0 ) | |
10663 { | |
10664 v3 = 0; | |
10665 do | |
10666 { | 10625 { |
10667 BYTE3(v4) = 0; | 10626 BYTE3(v4) = 0; |
10668 v5 = &pObjectList->pObjects[v3]; | 10627 v5 = &pObjectList->pObjects[i]; |
10669 ++v3; | |
10670 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; | 10628 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; |
10671 LOBYTE(v4) = v5->uParticleTrailColorG; | 10629 LOBYTE(v4) = v5->uParticleTrailColorG; |
10672 v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); | 10630 v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); |
10673 ++v2; | 10631 } |
10674 } | 10632 SetUserInterface(pParty->alignment, true); |
10675 while ( v2 < (signed int)pObjectList->uNumObjects ); | 10633 if ( pVideoPlayer->pVideoFrame.pPixels ) |
10676 } | 10634 pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); |
10677 LOBYTE(v1) = 1; | |
10678 SetUserInterface(pParty->alignment, v1); | |
10679 if ( pVideoPlayer->pVideoFrame.pPixels ) | |
10680 pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); | |
10681 if ( uCurrentMenuID ) | |
10682 { | |
10683 if ( uCurrentMenuID != 6 ) | 10635 if ( uCurrentMenuID != 6 ) |
10684 { | 10636 { |
10685 if ( uCurrentMenuID == 8 ) | 10637 if ( uCurrentMenuID == 8 ) |
10686 dword_A74C88 = 1; | 10638 dword_A74C88 = 1; |
10687 goto LABEL_38; | 10639 } |
10688 } | 10640 else |
10689 v6 = &pTexture_PCX; | 10641 { |
10690 pTexture_PCX.Release(); | 10642 if ( uCurrentMenuID ) |
10691 v9 = 0; | 10643 { |
10692 v8 = "makeme.pcx"; | 10644 v6 = &pTexture_PCX; |
10693 } | 10645 pTexture_PCX.Release(); |
10694 else | 10646 v8 = "makeme.pcx"; |
10695 { | 10647 } |
10696 v6 = &pTexture_PCX; | 10648 else |
10697 pTexture_PCX.Release(); | 10649 { |
10698 v7 = "title.pcx"; | 10650 v6 = &pTexture_PCX; |
10699 if ( uCurrentMenuID ) | 10651 pTexture_PCX.Release(); |
10700 v7 = "lsave640.pcx"; | 10652 v8 = "title.pcx"; |
10701 v9 = 0; | 10653 if ( uCurrentMenuID ) |
10702 v8 = v7; | 10654 v8 = "lsave640.pcx"; |
10703 } | 10655 } |
10704 v6->Load(v8, v9); | 10656 v6->Load(v8, 0); |
10705 LABEL_38: | 10657 } |
10658 } | |
10706 viewparams->bRedrawGameUI = 1; | 10659 viewparams->bRedrawGameUI = 1; |
10707 viewparams->InitGrayPalette(); | 10660 viewparams->InitGrayPalette(); |
10708 pMouse->SetCurrentCursorBitmap(); | 10661 pMouse->SetCurrentCursorBitmap(); |
10709 if ( pRenderer->bWindowMode ) | 10662 if ( pRenderer->bWindowMode ) |
10710 { | 10663 { |
10735 } | 10688 } |
10736 | 10689 |
10737 //----- (0040DBD3) -------------------------------------------------------- | 10690 //----- (0040DBD3) -------------------------------------------------------- |
10738 void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor) | 10691 void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor) |
10739 { | 10692 { |
10740 Vec2_int_ *pTargetXY_; // esi@1 | |
10741 unsigned __int16 v3; // di@1 | |
10742 signed int v4; // ecx@2 | |
10743 signed int v5; // eax@4 | |
10744 | |
10745 pTargetXY_ = pTargetXY; | |
10746 v3 = uColor; | |
10747 pRenderer->BeginScene(); | 10693 pRenderer->BeginScene(); |
10748 if ( pRenderer->uNumSceneBegins ) | 10694 if ( pRenderer->uNumSceneBegins ) |
10749 { | 10695 { |
10750 v4 = pTargetXY_->x; | 10696 int xVal = pTargetXY->x; |
10751 if ( pTargetXY_->x >= 0 ) | 10697 int yVal = pTargetXY->y; |
10752 { | 10698 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) |
10753 if ( v4 <= 639 ) | 10699 { |
10754 { | 10700 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; |
10755 v5 = pTargetXY_->y; | |
10756 if ( v5 >= 0 ) | |
10757 { | |
10758 if ( v5 <= 479 ) | |
10759 pRenderer->pTargetSurface[v4 + pRenderer->uTargetSurfacePitch * v5] = v3; | |
10760 } | |
10761 } | |
10762 } | 10701 } |
10763 pRenderer->EndScene(); | 10702 pRenderer->EndScene(); |
10764 } | 10703 } |
10765 } | 10704 } |
10766 | 10705 |
10797 idx2 = uNumItems; | 10736 idx2 = uNumItems; |
10798 while (true) | 10737 while (true) |
10799 { | 10738 { |
10800 auto i = idx1 + (idx2 - idx1) / 2; | 10739 auto i = idx1 + (idx2 - idx1) / 2; |
10801 | 10740 |
10802 auto res = strcmpi(pName, pSpriteNames[i]); | 10741 auto res = _stricmp(pName, pSpriteNames[i]); |
10803 if (!res) | 10742 if (!res) |
10804 { | 10743 { |
10805 fseek(pFile, pSpriteOffsets[i], SEEK_SET); | 10744 fseek(pFile, pSpriteOffsets[i], SEEK_SET); |
10806 break; | 10745 break; |
10807 } | 10746 } |
10840 delete [] pCompressedData; | 10779 delete [] pCompressedData; |
10841 } | 10780 } |
10842 else | 10781 else |
10843 fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); | 10782 fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); |
10844 | 10783 |
10845 if ( field_61A94_scale_hwls_to_half ) | 10784 if ( field_61A94_scale_hwls_to_half ) //is it even possible to ever get here? field_61A94_scale_hwls_to_half is only set to zero |
10846 { | 10785 { |
10847 v11 = pTex->uHeight / 2; | 10786 v11 = pTex->uHeight / 2; |
10848 v12 = pTex->uWidth / 2; | 10787 v12 = pTex->uWidth / 2; |
10849 pTex->uHeight = v11; | 10788 pTex->uHeight = v11; |
10850 pTex->uWidth = v12; | 10789 pTex->uWidth = v12; |
10897 } | 10836 } |
10898 | 10837 |
10899 //----- (0045271F) -------------------------------------------------------- | 10838 //----- (0045271F) -------------------------------------------------------- |
10900 bool RenderHWLContainer::Release() | 10839 bool RenderHWLContainer::Release() |
10901 { | 10840 { |
10902 RenderHWLContainer *v1; // esi@1 | |
10903 int v2; // ebx@1 | |
10904 void **v3; // edi@3 | |
10905 __int32 v4; // eax@6 | 10841 __int32 v4; // eax@6 |
10906 FILE *v5; // ST24_4@6 | 10842 FILE *v5; // ST24_4@6 |
10907 size_t *v6; // edi@6 | |
10908 int v7; // ebx@7 | |
10909 signed int v9; // [sp+0h] [bp-8h]@6 | |
10910 FILE *File; // [sp+4h] [bp-4h]@6 | 10843 FILE *File; // [sp+4h] [bp-4h]@6 |
10911 | 10844 |
10912 v1 = this; | 10845 if ( this->bDumpDebug) |
10913 v2 = 0; | |
10914 if ( this->bDumpDebug ) | |
10915 { | 10846 { |
10916 File = fopen("logd3d.txt", "w"); | 10847 File = fopen("logd3d.txt", "w"); |
10917 v4 = ftell(v1->pFile); | 10848 v4 = ftell(this->pFile); |
10918 v5 = v1->pFile; | 10849 v5 = this->pFile; |
10919 v6 = &v1->uNumItems; | 10850 this->uDataOffset = v4; |
10920 v1->uDataOffset = v4; | 10851 fwrite(&this->uNumItems, 4u, 1u, v5); |
10921 fwrite(&v1->uNumItems, 4u, 1u, v5); | 10852 for (int i = 0; i < this->uNumItems; i++) |
10922 v9 = 0; | 10853 { |
10923 if ( (signed int)v1->uNumItems > 0 ) | 10854 fwrite(this->pSpriteNames[i], 1u, 0x14u, this->pFile); |
10924 { | 10855 fprintf(File, "D3D texture name: %s\t\toffset: %x\n", this->pSpriteNames[i], *(unsigned int *)(&(this->pSpriteNames[i]) + 200000/sizeof(char*))); |
10925 v7 = (int)v1->pSpriteNames; | 10856 } |
10926 do | 10857 fwrite(this->pSpriteOffsets, 4u, this->uNumItems, this->pFile); |
10927 { | 10858 fseek(this->pFile, 4, 0); |
10928 fwrite(*(const void **)v7, 1u, 0x14u, v1->pFile); | 10859 fwrite(&this->uDataOffset, 4u, 1u, this->pFile); |
10929 fprintf(File, "D3D texture name: %s\t\toffset: %x\n", *(unsigned int *)v7, *(unsigned int *)(v7 + 200000)); | 10860 fclose(this->pFile); |
10930 ++v9; | |
10931 v7 += 4; | |
10932 } | |
10933 while ( v9 < (signed int)*v6 ); | |
10934 v2 = 0; | |
10935 } | |
10936 fwrite(v1->pSpriteOffsets, 4u, *v6, v1->pFile); | |
10937 fseek(v1->pFile, 4, v2); | |
10938 fwrite(&v1->uDataOffset, 4u, 1u, v1->pFile); | |
10939 fclose(v1->pFile); | |
10940 fclose(File); | 10861 fclose(File); |
10941 } | 10862 } |
10942 else | 10863 else |
10943 { | 10864 { |
10944 fclose(this->pFile); | 10865 fclose(this->pFile); |
10945 if ( (signed int)v1->uNumItems > 0 ) | 10866 for (int i = 0; i < this->uNumItems; i++) |
10946 { | 10867 { |
10947 v3 = (void **)v1->pSpriteNames; | 10868 free(this->pSpriteNames[i]); |
10948 do | |
10949 { | |
10950 free(*v3); | |
10951 ++v2; | |
10952 ++v3; | |
10953 } | |
10954 while ( v2 < (signed int)v1->uNumItems ); | |
10955 } | 10869 } |
10956 } | 10870 } |
10957 return true; | 10871 return true; |
10958 } | 10872 } |
10959 | 10873 |
10960 //----- (00452347) -------------------------------------------------------- | 10874 //----- (00452347) -------------------------------------------------------- |
10961 RenderHWLContainer::RenderHWLContainer(): | 10875 RenderHWLContainer::RenderHWLContainer(): |
10962 bDumpDebug(false) | 10876 bDumpDebug(false) |
10963 { | 10877 { |
10964 RenderHWLContainer *v1; // esi@1 | |
10965 | |
10966 v1 = this; | |
10967 this->pFile = 0; | 10878 this->pFile = 0; |
10968 uSignature = 0; | 10879 uSignature = 0; |
10969 v1->uDataOffset = 0; | 10880 this->uDataOffset = 0; |
10970 memset(&v1->uNumItems, 0, 0x61A84u); | 10881 memset(&this->uNumItems, 0, 0x61A84u); |
10971 v1->uNumItems = 0; | 10882 this->uNumItems = 0; |
10972 v1->field_61A94_scale_hwls_to_half = 0; | 10883 this->field_61A94_scale_hwls_to_half = 0; |
10973 } | 10884 } |
10974 | 10885 |
10975 //----- (0045237F) -------------------------------------------------------- | 10886 //----- (0045237F) -------------------------------------------------------- |
10976 bool RenderHWLContainer::Load(const wchar_t *pFilename) | 10887 bool RenderHWLContainer::Load(const wchar_t *pFilename) |
10977 { | 10888 { |