Skip to content

Commit

Permalink
Merge pull request #300 from toadster172/ascii-manager-render
Browse files Browse the repository at this point in the history
Implement AsciiManager popup draw methods
  • Loading branch information
roblabla authored Nov 2, 2024
2 parents aea2218 + adc3de5 commit c16c4ad
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config/implemented.csv
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ th06::AsciiManager::AddFormatText
th06::AsciiManager::CreatePopup1
th06::AsciiManager::CreatePopup2
th06::AsciiManager::DrawStrings
th06::AsciiManager::DrawPopupsWithHwVertexProcessing
th06::AsciiManager::DrawPopupsWithoutHwVertexProcessing
th06::ZunTimer::Initialize
th06::ZunTimer::Increment
th06::ZunTimer::Decrement
Expand Down
2 changes: 0 additions & 2 deletions config/stubbed.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
th06::EclManager::Unload
th06::AsciiManager::DrawPopupsWithHwVertexProcessing
th06::AsciiManager::DrawPopupsWithoutHwVertexProcessing
th06::AnmManager::DrawEndingRect
th06::MidiOutput::OnTimerElapsed
th06::MidiOutput::ParseFile
Expand Down
105 changes: 104 additions & 1 deletion src/AsciiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ChainCallbackResult AsciiManager::OnUpdate(AsciiManager *mgr)

curPopup->position.y -= 0.5f * g_Supervisor.effectiveFramerateMultiplier;
curPopup->timer.Tick();
if ((i32)(curPopup->timer.current > 60))
if (curPopup->timer > 60)
{
curPopup->inUse = false;
}
Expand Down Expand Up @@ -835,4 +835,107 @@ void StageMenu::OnDrawRetryMenu()
return;
}

#pragma var_order(currentPopup, j, i, currentDigit, unusedVec3)
void AsciiManager::DrawPopupsWithHwVertexProcessing()
{
u8 *currentDigit;
AsciiManagerPopup *currentPopup;
i32 i;
i32 j;
D3DXVECTOR3 unusedVec3;

currentPopup = this->popups;
g_Supervisor.viewport.X = g_GameManager.arcadeRegionTopLeftPos.x;
g_Supervisor.viewport.Y = g_GameManager.arcadeRegionTopLeftPos.y;
g_Supervisor.viewport.Width = g_GameManager.arcadeRegionSize.x;
g_Supervisor.viewport.Height = g_GameManager.arcadeRegionSize.y;
g_Supervisor.d3dDevice->SetViewport(&g_Supervisor.viewport);

for (i = 0; i < ARRAY_SIZE_SIGNED(this->popups); i++, currentPopup++)
{
if (currentPopup->inUse == 0)
{
continue;
}

this->vm1.pos.x = currentPopup->position.x - (currentPopup->characterCount * 4);
this->vm1.pos.y = currentPopup->position.y;
this->vm1.color = currentPopup->color;

currentDigit = (u8 *)currentPopup->digits + currentPopup->characterCount - 1;
for (j = currentPopup->characterCount; 0 < j; j--)
{
this->vm1.sprite = g_AnmManager->sprites + *currentDigit;
if (*currentDigit >= '\n')
{
this->vm1.matrix.m[0][0] = 0.1875f;
this->vm1.matrix.m[1][1] = 0.03125f;
g_AnmManager->Draw2(&this->vm1);
this->vm1.matrix.m[0][0] = 0.03125f;
this->vm1.matrix.m[1][1] = 0.03125f;
}
else
{
g_AnmManager->Draw2(&this->vm1);
}

this->vm1.pos.x += 8.0f;
currentDigit--;
}
}

return;
}

#pragma var_order(currentPopup, j, i, currentDigit, unusedVec3)
void AsciiManager::DrawPopupsWithoutHwVertexProcessing()
{
u8 *currentDigit;
AsciiManagerPopup *currentPopup;
i32 i;
i32 j;
D3DXVECTOR3 unusedVec3;

currentPopup = this->popups;
g_Supervisor.viewport.X = g_GameManager.arcadeRegionTopLeftPos.x;
g_Supervisor.viewport.Y = g_GameManager.arcadeRegionTopLeftPos.y;
g_Supervisor.viewport.Width = g_GameManager.arcadeRegionSize.x;
g_Supervisor.viewport.Height = g_GameManager.arcadeRegionSize.y;
g_Supervisor.d3dDevice->SetViewport(&g_Supervisor.viewport);

for (i = 0; i < ARRAY_SIZE_SIGNED(this->popups); i++, currentPopup++)
{
if (currentPopup->inUse == 0)
{
continue;
}

this->vm1.pos.x = currentPopup->position.x - (currentPopup->characterCount * 4);
this->vm1.pos.y = currentPopup->position.y;
this->vm1.color = currentPopup->color;

currentDigit = (u8 *)currentPopup->digits + currentPopup->characterCount - 1;
for (j = currentPopup->characterCount; 0 < j; j--)
{
this->vm1.sprite = g_AnmManager->sprites + *currentDigit;
if (*currentDigit >= '\n')
{
this->vm1.matrix.m[0][0] = 0.1875f;
this->vm1.matrix.m[1][1] = 0.03125f;
g_AnmManager->DrawNoRotation(&this->vm1);
this->vm1.matrix.m[0][0] = 0.03125f;
this->vm1.matrix.m[1][1] = 0.03125f;
}
else
{
g_AnmManager->Draw2(&this->vm1);
}

this->vm1.pos.x += 8.0f;
currentDigit--;
}
}

return;
}
}; // namespace th06

0 comments on commit c16c4ad

Please sign in to comment.