Skip to content

Commit

Permalink
implemented MainMenu::BeginStartup (happyhavoc#99)
Browse files Browse the repository at this point in the history
* implemented MainMenu::BeginStartup

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Robin Lambertz <[email protected]>
  • Loading branch information
3 people committed Apr 3, 2024
1 parent 7ea61fb commit 755ac58
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
52 changes: 25 additions & 27 deletions src/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Supervisor.hpp"

#pragma optimize("s", on)
#pragma var_order(time, i, vector3Ptr)
ZunResult MainMenu::BeginStartup()
{
D3DXVECTOR3 vector3Ptr; // we have to add Ptr,
Expand All @@ -14,41 +15,38 @@ ZunResult MainMenu::BeginStartup()

if (LoadTitleAnm(this) != ZUN_SUCCESS)
{
g_Supervisor.curState = 4;
g_Supervisor.curState = SUPERVISOR_STATE_EXITSUCCESS;
return ZUN_ERROR;
}
else
if (g_Supervisor.startupTimeBeforeMenuMusic > 0)
{
if (g_Supervisor.startupTimeBeforeMenuMusic > 0)
time = timeGetTime();
while ((time - g_Supervisor.startupTimeBeforeMenuMusic >= 0) &&
(3000 > time - g_Supervisor.startupTimeBeforeMenuMusic))
{
time = timeGetTime();
while ((time - g_Supervisor.startupTimeBeforeMenuMusic >= 0) &&
(3000 > time - g_Supervisor.startupTimeBeforeMenuMusic))
{
time = timeGetTime();
}
g_Supervisor.startupTimeBeforeMenuMusic = 0;
g_Supervisor.PlayAudio("bgm/th06_01.mid");
}
for (i = 0; i < 122; i++)
g_Supervisor.startupTimeBeforeMenuMusic = 0;
g_Supervisor.PlayAudio("bgm/th06_01.mid");
}
for (i = 0; i < 122; i++)
{
this->vm[i].pendingInterrupt = 1;
this->vm[i].flags |= AnmVmFlags_3;
if ((g_Supervisor.cfg.opts & (1 << GCOS_USE_D3D_HW_TEXTURE_BLENDING)) == 0)
{
this->vm[i].color = 0xff000000;
}
else
{
this->vm[i].pendingInterrupt = 1;
this->vm[i].flags |= 8;
if ((g_Supervisor.cfg.opts & 1) == 0)
{
this->vm[i].color = 0xff000000;
}
else
{
this->vm[i].color = 0xffffffff;
}
vector3Ptr.x = 0.0;
vector3Ptr.y = 0.0;
vector3Ptr.z = 0.0;
this->vm[i].pos2 = vector3Ptr;
this->vm[i].color = 0xffffffff;
}
this->gameState = STATE_PRE_INPUT;
return ZUN_SUCCESS;
vector3Ptr.x = 0.0;
vector3Ptr.y = 0.0;
vector3Ptr.z = 0.0;
this->vm[i].pos2 = vector3Ptr;
}
this->gameState = STATE_PRE_INPUT;
return ZUN_SUCCESS;
}
#pragma optimize("", on)
23 changes: 20 additions & 3 deletions src/MainMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <D3D8.h>

#include "AnmVm.hpp"
#include "Chain.hpp"
#include "ZunResult.hpp"
#include "inttypes.hpp"

Expand Down Expand Up @@ -35,7 +36,7 @@ struct MainMenu

AnmVm vm[122];
i32 cursor;
i8 padding[68];
i8 padding[0x40];
u32 unk_81e4;
i32 chosenReplay;
i32 replayFilesNum;
Expand All @@ -47,6 +48,22 @@ struct MainMenu
D3DCOLOR color2;
D3DCOLOR color1;
u32 unk_820c;
i8 padding2[0x8D24];
u32 isActive;
u32 wasActive;
i8 padding2[4];
i16 controlMapping[9];
i8 padding3[6];
ChainElem *chainCalc;
ChainElem *chainDraw;
char replayFilePaths[60][512];
char replayFileName[60][8];
i8 replayFileData[60][0x50];
i8 *currentReplay;
i32 *unk_10ee0;
f32 *unk_10ee4;
i8 padding4[64];
u32 unk_10f28;
u32 unk_10f2c;
u32 time_related;
};

C_ASSERT(sizeof(MainMenu) == 0x10f34);
2 changes: 0 additions & 2 deletions src/Supervisor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ struct Supervisor

void PlayAudio(char *path);

void PlayAudio(char *path);

static void CreateBackBuffer();

static ZunResult SetupDInput(Supervisor *s);
Expand Down

0 comments on commit 755ac58

Please sign in to comment.