ASM-accuracy improvement for Profile.cpp
I don't know how I missed an entire function before
This commit is contained in:
parent
9468659b43
commit
15f711b2ec
3 changed files with 33 additions and 27 deletions
|
@ -24,16 +24,18 @@
|
||||||
const char *gDefaultName = "Profile.dat";
|
const char *gDefaultName = "Profile.dat";
|
||||||
const char *gProfileCode = "Do041220";
|
const char *gProfileCode = "Do041220";
|
||||||
|
|
||||||
BOOL IsProfile()
|
BOOL IsProfile(void)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
HANDLE hFile;
|
||||||
|
|
||||||
sprintf(path, "%s\\%s", gModulePath, gDefaultName);
|
sprintf(path, "%s\\%s", gModulePath, gDefaultName);
|
||||||
|
|
||||||
FILE *fp = fopen(path, "rb");
|
hFile = CreateFileA(path, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (fp == NULL)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
fclose(fp);
|
CloseHandle(hFile);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ BOOL SaveProfile(const char *name)
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
// Get path
|
// Get path
|
||||||
if (name)
|
if (name != NULL)
|
||||||
sprintf(path, "%s\\%s", gModulePath, name);
|
sprintf(path, "%s\\%s", gModulePath, name);
|
||||||
else
|
else
|
||||||
sprintf(path, "%s\\%s", gModulePath, gDefaultName);
|
sprintf(path, "%s\\%s", gModulePath, gDefaultName);
|
||||||
|
@ -87,18 +89,18 @@ BOOL SaveProfile(const char *name)
|
||||||
|
|
||||||
BOOL LoadProfile(const char *name)
|
BOOL LoadProfile(const char *name)
|
||||||
{
|
{
|
||||||
// Get path
|
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
PROFILE profile;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
if (name)
|
// Get path
|
||||||
|
if (name != NULL)
|
||||||
sprintf(path, "%s", name);
|
sprintf(path, "%s", name);
|
||||||
else
|
else
|
||||||
sprintf(path, "%s\\%s", gModulePath, gDefaultName);
|
sprintf(path, "%s\\%s", gModulePath, gDefaultName);
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
PROFILE profile;
|
fp = fopen(path, "rb");
|
||||||
|
|
||||||
FILE *fp = fopen(path, "rb");
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -148,9 +150,9 @@ BOOL LoadProfile(const char *name)
|
||||||
gMC.x = profile.x;
|
gMC.x = profile.x;
|
||||||
gMC.y = profile.y;
|
gMC.y = profile.y;
|
||||||
|
|
||||||
gMC.rect_arms.left = 24 * (gArmsData[gSelectedArms].code % 10);
|
gMC.rect_arms.left = (gArmsData[gSelectedArms].code % 10) * 24;
|
||||||
gMC.rect_arms.right = gMC.rect_arms.left + 24;
|
gMC.rect_arms.right = gMC.rect_arms.left + 24;
|
||||||
gMC.rect_arms.top = 32 * (gArmsData[gSelectedArms].code / 10);
|
gMC.rect_arms.top = (gArmsData[gSelectedArms].code / 10) * 32;
|
||||||
gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
|
gMC.rect_arms.bottom = gMC.rect_arms.top + 16;
|
||||||
|
|
||||||
// Reset stuff
|
// Reset stuff
|
||||||
|
@ -162,6 +164,7 @@ BOOL LoadProfile(const char *name)
|
||||||
InitStar();
|
InitStar();
|
||||||
ClearValueView();
|
ClearValueView();
|
||||||
gCurlyShoot_wait = 0;
|
gCurlyShoot_wait = 0;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct PROFILE
|
||||||
unsigned char flags[1000];
|
unsigned char flags[1000];
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOL IsProfile();
|
BOOL IsProfile(void);
|
||||||
BOOL SaveProfile(const char *name);
|
BOOL SaveProfile(const char *name);
|
||||||
BOOL LoadProfile(const char *name);
|
BOOL LoadProfile(const char *name);
|
||||||
BOOL InitializeGame(HWND hWnd);
|
BOOL InitializeGame(HWND hWnd);
|
||||||
|
|
|
@ -19,12 +19,13 @@ static int gStageSelectTitleY;
|
||||||
|
|
||||||
void ClearPermitStage(void)
|
void ClearPermitStage(void)
|
||||||
{
|
{
|
||||||
memset(gPermitStage, 0, 0x40);
|
memset(gPermitStage, 0, sizeof(gPermitStage));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL AddPermitStage(int index, int event)
|
BOOL AddPermitStage(int index, int event)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (i < 8)
|
while (i < 8)
|
||||||
{
|
{
|
||||||
if (gPermitStage[i].index == index)
|
if (gPermitStage[i].index == index)
|
||||||
|
@ -48,6 +49,7 @@ BOOL AddPermitStage(int index, int event)
|
||||||
BOOL SubPermitStage(int index)
|
BOOL SubPermitStage(int index)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
if (gPermitStage[i].index == index)
|
if (gPermitStage[i].index == index)
|
||||||
break;
|
break;
|
||||||
|
@ -59,10 +61,8 @@ BOOL SubPermitStage(int index)
|
||||||
#endif
|
#endif
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (i += 1; i < 8; ++i)
|
for (++i; i < 8; ++i)
|
||||||
{
|
|
||||||
gPermitStage[i - 1] = gPermitStage[i];
|
gPermitStage[i - 1] = gPermitStage[i];
|
||||||
}
|
|
||||||
|
|
||||||
gPermitStage[i - 1].index = 0;
|
gPermitStage[i - 1].index = 0;
|
||||||
gPermitStage[i - 1].event = 0;
|
gPermitStage[i - 1].event = 0;
|
||||||
|
@ -72,11 +72,14 @@ BOOL SubPermitStage(int index)
|
||||||
|
|
||||||
void MoveStageSelectCursor(void)
|
void MoveStageSelectCursor(void)
|
||||||
{
|
{
|
||||||
int stage_num = 0;
|
int stage_num;
|
||||||
|
int stage_x;
|
||||||
|
|
||||||
|
stage_num = 0;
|
||||||
while (gPermitStage[stage_num].index != 0)
|
while (gPermitStage[stage_num].index != 0)
|
||||||
++stage_num;
|
++stage_num;
|
||||||
|
|
||||||
int stage_x = (WINDOW_WIDTH - 40 * stage_num) / 2; // Unused
|
stage_x = (WINDOW_WIDTH - (stage_num * 40)) / 2; // Unused
|
||||||
|
|
||||||
if (stage_num == 0)
|
if (stage_num == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -93,10 +96,10 @@ void MoveStageSelectCursor(void)
|
||||||
if (gSelectedStage > stage_num - 1)
|
if (gSelectedStage > stage_num - 1)
|
||||||
gSelectedStage = 0;
|
gSelectedStage = 0;
|
||||||
|
|
||||||
if ((gKeyLeft | gKeyRight) & gKeyTrg)
|
if (gKeyTrg & (gKeyLeft | gKeyRight))
|
||||||
StartTextScript(gPermitStage[gSelectedStage].index + 1000);
|
StartTextScript(gPermitStage[gSelectedStage].index + 1000);
|
||||||
|
|
||||||
if ((gKeyLeft | gKeyRight) & gKeyTrg)
|
if (gKeyTrg & (gKeyLeft | gKeyRight))
|
||||||
PlaySoundObject(1, 1);
|
PlaySoundObject(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,23 +132,23 @@ void PutStageSelectObject(void)
|
||||||
|
|
||||||
++flash;
|
++flash;
|
||||||
|
|
||||||
if (stage_num)
|
if (stage_num != 0)
|
||||||
{
|
{
|
||||||
stage_x = (WINDOW_WIDTH - 40 * stage_num) / 2;
|
stage_x = (WINDOW_WIDTH - (stage_num * 40)) / 2;
|
||||||
|
|
||||||
PutBitmap3(&rcView, stage_x + 40 * gSelectedStage, (WINDOW_HEIGHT / 2) - 56, &rcCur[(flash >> 1) % 2], SURFACE_ID_TEXT_BOX);
|
PutBitmap3(&rcView, stage_x + (gSelectedStage * 40), (WINDOW_HEIGHT / 2) - 56, &rcCur[flash / 2 % 2], SURFACE_ID_TEXT_BOX);
|
||||||
|
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
if (gPermitStage[i].index == 0)
|
if (gPermitStage[i].index == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rcStage.left = 32 * (gPermitStage[i].index % 8);
|
rcStage.left = (gPermitStage[i].index % 8) * 32;
|
||||||
rcStage.right = rcStage.left + 32;
|
rcStage.right = rcStage.left + 32;
|
||||||
rcStage.top = 16 * (gPermitStage[i].index / 8);
|
rcStage.top = (gPermitStage[i].index / 8) * 16;
|
||||||
rcStage.bottom = rcStage.top + 16;
|
rcStage.bottom = rcStage.top + 16;
|
||||||
|
|
||||||
PutBitmap3(&rcView, stage_x + 40 * i, (WINDOW_HEIGHT / 2) - 56, &rcStage, SURFACE_ID_STAGE_ITEM);
|
PutBitmap3(&rcView, stage_x + (i * 40), (WINDOW_HEIGHT / 2) - 56, &rcStage, SURFACE_ID_STAGE_ITEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue