Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ScreenEffect methods #304

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 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 Expand Up @@ -300,6 +302,15 @@ th06::GameWindow::InitD3dDevice
th06::GameWindow::InitD3dRendering
th06::ScreenEffect::Clear
th06::ScreenEffect::SetViewport
th06::ScreenEffect::CalcFadeIn
th06::ScreenEffect::DrawSquare
th06::ScreenEffect::CalcFadeOut
th06::ScreenEffect::RegisterChain
th06::ScreenEffect::DrawFadeIn
th06::ScreenEffect::DrawFadeOut
th06::ScreenEffect::ShakeScreen
th06::ScreenEffect::AddedCallback
th06::ScreenEffect::DeletedCallback
th06::utils::AddNormalizeAngle
th06::utils::Rotate
th06::SoundPlayer::SoundPlayer
Expand Down
4 changes: 2 additions & 2 deletions config/mapping.csv
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ th06::Chain::~Chain,0x41c6d0,0x4b,__thiscall,,void,Chain*
th06::ChainElem::ChainElem,0x41c720,0x61,__thiscall,,ChainElem*,ChainElem*
th06::ChainElem::~ChainElem,0x41c790,0x56,__thiscall,,void,ChainElem*
th06::Chain::Chain,0x41c7f0,0x64,__thiscall,,void,Chain*
th06::Chain::AddToCalcChain,0x41c860,0xda,__thiscall,,u32,Chain*,ChainElem*,i32
th06::Chain::AddToCalcChain,0x41c860,0xda,__thiscall,,i32,Chain*,ChainElem*,i32
th06::Chain::AddToDrawChain,0x41c940,0xcd,__thiscall,,u32,Chain*,ChainElem*,i32
th06::Chain::RunCalcChain,0x41ca10,0x9d,__thiscall,,i32,Chain*
th06::Chain::RunDrawChain,0x41cad0,0x9e,__thiscall,,i32,Chain*
Expand Down Expand Up @@ -295,7 +295,7 @@ th06::SoundPlayer::FadeOut,0x424e41,0x4e,__thiscall,,void,SoundPlayer*,f32
th06::MusicRoom::FUN_00424e8f,0x424e8f,0x1e,__thiscall,,ZunResult,MusicRoom*
th06::MusicRoom::DrawMusicList,0x424ead,0x38d,__thiscall,,void,MusicRoom*
th06::MusicRoom::RegisterChain,0x42523a,0xde,default,,ZunResult
th06::MusicRoom::MusicRoom,0x425318,0xc5,__thiscall,,u32*,MusicRoom*
th06::MusicRoom::MusicRoom,0x425318,0xc5,__thiscall,,MusicRoom*,MusicRoom*
th06::MusicRoom::OnUpdate,0x4253dd,0x7d,__cdecl,,ChainCallbackResult,MusicRoom*
th06::MusicRoom::OnDraw,0x42545a,0x1f2,__cdecl,,ChainCallbackResult,MusicRoom*
th06::MusicRoom::AddedCallback,0x42564c,0x74b,__cdecl,,ZunResult,MusicRoom*
Expand Down
4 changes: 0 additions & 4 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 All @@ -13,12 +11,10 @@ th06::Supervisor::DeletedCallback
th06::MusicRoom::RegisterChain
th06::ResultScreen::RegisterChain
th06::ResultScreen::ReleaseScoreDat
th06::ScreenEffect::RegisterChain
th06::MainMenu::SelectRelated
th06::ItemManager::RemoveAllItems
th06::ReplayManager::RegisterChain
th06::ReplayManager::StopRecording
th06::ReplayManager::SaveReplay
th06::ReplayManager::ValidateReplayData
th06::ScreenEffect::DrawSquare
th06::Pbg3Archive::Pbg3Archive
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
2 changes: 2 additions & 0 deletions src/ChainPriorities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define TH_CHAIN_PRIO_CALC_EFFECTMANAGER 10
#define TH_CHAIN_PRIO_CALC_BULLETMANAGER 11
#define TH_CHAIN_PRIO_CALC_GUI 12
#define TH_CHAIN_PRIO_CALC_SCREENEFFECT 14

#define TH_CHAIN_PRIO_DRAW_MAINMENU 0
#define TH_CHAIN_PRIO_DRAW_ENDING 1
Expand All @@ -26,3 +27,4 @@
#define TH_CHAIN_PRIO_DRAW_GUI 11
#define TH_CHAIN_PRIO_DRAW_SUPERVISOR 14
#define TH_CHAIN_PRIO_DRAW_ASCIIMANAGER_MENUS 15
#define TH_CHAIN_PRIO_DRAW_SCREENEFFECT 16
2 changes: 1 addition & 1 deletion src/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ ChainCallbackResult GameManager::OnUpdate(GameManager *gameManager)
gameManager->demoFrames++;
if (gameManager->demoFrames == DEMO_FADEOUT_FRAMES)
{
ScreenEffect::RegisterChain(SCREEN_EFFECT_FADE_OUT, 0x78, 0, 0, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_FADE_OUT, 120, 0x000000, 0, 0);
}
if (gameManager->demoFrames >= DEMO_FRAMES)
{
Expand Down
4 changes: 2 additions & 2 deletions src/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,11 @@ ZunResult MainMenu::AddedCallback(MainMenu *m)
if (g_Supervisor.startupTimeBeforeMenuMusic == 0)
{
g_Supervisor.PlayAudio("bgm/th06_01.mid");
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_0, 0x78, 0xffffff, 0, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_FADE_IN, 120, 0xffffff, 0, 0);
}
else
{
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_0, 200, 0xffffff, 0, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_FADE_IN, 200, 0xffffff, 0, 0);
}
}
g_GameManager.demoMode = 0;
Expand Down
12 changes: 6 additions & 6 deletions src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ void Player::BombReimuACalc(Player *player)
player->bombInfo.bombRegionVelocities[i] / 100.0f; // ZUN moment

g_SoundPlayer.PlaySoundByIdx(SOUND_F, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_1, 16, 8, 0, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_SHAKE, 16, 8, 0, 0);
}
}
}
Expand Down Expand Up @@ -1651,13 +1651,13 @@ void Player::BombReimuBCalc(Player *player)
player->bombInfo.bombRegionPositions[3].x = 192.0f;
player->bombInfo.bombRegionPositions[3].y = player->positionCenter.y;
player->bombInfo.bombRegionPositions[3].z = 0.405f;
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_1, 60, 2, 6, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_SHAKE, 60, 2, 6, 0);
}
else
{
if (player->bombInfo.timer == 60)
{
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_1, 80, 20, 0, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_SHAKE, 80, 20, 0, 0);
}

player->bombProjectiles[0].size.x = 62.0f;
Expand Down Expand Up @@ -1731,7 +1731,7 @@ void Player::BombMarisaACalc(Player *player)
player->bombInfo.bombRegionVelocities[i].z = 0.0f;
}
g_SoundPlayer.PlaySoundByIdx(SOUND_BOMB_REIMARI, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_1, 0x78, 4, 1, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_SHAKE, 120, 4, 1, 0);
}
else
{
Expand Down Expand Up @@ -1800,11 +1800,11 @@ void Player::BombMarisaBCalc(Player *player)

if (player->bombInfo.timer == 60)
{
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_1, 60, 1, 7, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_SHAKE, 60, 1, 7, 0);
}
else if (player->bombInfo.timer == 120)
{
ScreenEffect::RegisterChain(SCREEN_EFFECT_UNK_1, 200, 24, 0, 0);
ScreenEffect::RegisterChain(SCREEN_EFFECT_SHAKE, 200, 24, 0, 0);
}

if (player->bombInfo.timer.HasTicked() && player->bombInfo.timer.AsFrames() % 4 != 0)
Expand Down
Loading