Skip to content

Commit

Permalink
Merge pull request #337 from KSSBrawl/anmanager-drawendingrect
Browse files Browse the repository at this point in the history
Implement AnmManager::DrawEndingRect
  • Loading branch information
wearrrrr authored Nov 28, 2024
2 parents d834692 + 8ccabe6 commit 3e30641
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/implemented.csv
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ th06::AnmVm::AnmVm
th06::AnmVm::Initialize
th06::AnmManager::AnmManager
th06::AnmManager::CopySurfaceToBackBuffer
th06::AnmManager::DrawEndingRect
th06::AnmManager::CreateEmptyTexture
th06::AnmManager::ExecuteScript
th06::AnmManager::DrawTextToSprite
Expand Down
1 change: 0 additions & 1 deletion config/stubbed.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
th06::AnmManager::DrawEndingRect
th06::MidiOutput::OnTimerElapsed
th06::MidiOutput::ParseFile
th06::MainMenu::SelectRelated
48 changes: 48 additions & 0 deletions src/AnmManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,54 @@ void AnmManager::CopySurfaceToBackBuffer(i32 surfaceIdx, i32 left, i32 top, i32
destSurface->Release();
}

void AnmManager::DrawEndingRect(i32 surfaceIdx, i32 rectX, i32 rectY, i32 rectLeft, i32 rectTop, i32 width, i32 height)
{
if (this->surfacesBis[surfaceIdx] == NULL)
{
return;
}

IDirect3DSurface8 *D3D_Surface;
if (g_Supervisor.d3dDevice->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &D3D_Surface) != D3D_OK)
{
return;
}

if (this->surfaces[surfaceIdx] == NULL)
{
if (g_Supervisor.d3dDevice->CreateRenderTarget(
this->surfaceSourceInfo[surfaceIdx].Width, this->surfaceSourceInfo[surfaceIdx].Height,
g_Supervisor.presentParameters.BackBufferFormat, D3DMULTISAMPLE_NONE, TRUE,
&this->surfaces[surfaceIdx]) != D3D_OK)
{
if (g_Supervisor.d3dDevice->CreateImageSurface(
this->surfaceSourceInfo[surfaceIdx].Width, this->surfaceSourceInfo[surfaceIdx].Height,
g_Supervisor.presentParameters.BackBufferFormat, &this->surfaces[surfaceIdx]) != D3D_OK)
{
D3D_Surface->Release();
return;
}
}
if (D3DXLoadSurfaceFromSurface(this->surfaces[surfaceIdx], NULL, NULL, this->surfacesBis[surfaceIdx], NULL,
NULL, D3DX_FILTER_NONE, 0) != D3D_OK)
{
D3D_Surface->Release();
return;
}
}

RECT rect;
POINT point;
rect.left = rectLeft;
rect.top = rectTop;
rect.right = rectLeft + width;
rect.bottom = rectTop + height;
point.x = rectX;
point.y = rectY;
g_Supervisor.d3dDevice->CopyRects(this->surfaces[surfaceIdx], &rect, 1, D3D_Surface, &point);
D3D_Surface->Release();
}

#pragma var_order(entry, spriteIdx, spriteIdxOffset, i, byteOffset, anmFilePtr, anmIdx, )
void AnmManager::ReleaseAnm(i32 anmIdx)
{
Expand Down

0 comments on commit 3e30641

Please sign in to comment.