Made MiniMap.cpp actually ASM-accurate

This commit is contained in:
Clownacy 2019-05-13 17:50:09 +01:00
parent cc1df04fab
commit 9b82baeb02
11 changed files with 40 additions and 32 deletions

View file

@ -129,10 +129,10 @@ BOOL AddItemData(long code)
}
if (i == ITEM_MAX)
return false;
return FALSE;
gItemData[i].code = code;
return true;
return TRUE;
}
BOOL SubItemData(long code)
@ -388,7 +388,7 @@ int CampLoop()
if (gKeyTrg & KEY_ESCAPE)
{
switch (Call_Escape())
switch (Call_Escape(hWnd))
{
case 0:
return 0;
@ -430,7 +430,7 @@ int CampLoop()
}
}
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}

View file

@ -48,8 +48,10 @@ FontObject *gFont;
#define FRAMERATE 20
BOOL Flip_SystemTask()
BOOL Flip_SystemTask(int hWnd)
{
(void)hWnd;
while (true)
{
if (!SystemTask())

View file

@ -52,7 +52,7 @@ struct SURFACE;
extern SURFACE surf[SURFACE_ID_MAX];
BOOL Flip_SystemTask();
BOOL Flip_SystemTask(int hWnd);
BOOL StartDirectDraw(int lMagnification, int lColourDepth);
void EndDirectDraw();
void ReleaseSurface(int s);

View file

@ -410,7 +410,7 @@ int Scene_DownIsland(int mode)
// Escape menu
if (gKey & 0x8000)
{
int escRet = Call_Escape();
int escRet = Call_Escape(hWnd);
if (escRet == 0)
return 0;
if (escRet == 2)
@ -464,7 +464,7 @@ int Scene_DownIsland(int mode)
// Draw window
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}

View file

@ -7,7 +7,7 @@
#include "KeyControl.h"
#include "Main.h"
int Call_Escape()
int Call_Escape(int hWnd)
{
RECT rc = {0, 128, 208, 144};
@ -37,7 +37,7 @@ int Call_Escape()
PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX);
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
{
// Quit if window is closed
gKeyTrg = 0;

View file

@ -1,3 +1,3 @@
#pragma once
int Call_Escape();
int Call_Escape(int hWnd);

View file

@ -141,7 +141,7 @@ int ModeOpening()
// Escape menu
if (gKey & KEY_ESCAPE)
{
int escRet = Call_Escape();
int escRet = Call_Escape(hWnd);
if (escRet == 0)
return 0;
if (escRet == 2)
@ -193,7 +193,7 @@ int ModeOpening()
PutTextScript();
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
++gCounter;
@ -204,7 +204,7 @@ int ModeOpening()
{
CortBox(&grcGame, 0x000000);
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}
return 2;
@ -335,7 +335,7 @@ int ModeTitle()
if (gKey & KEY_ESCAPE)
{
int escRet = Call_Escape();
int escRet = Call_Escape(hWnd);
if (escRet == 0)
return 0;
if (escRet == 2)
@ -420,7 +420,7 @@ int ModeTitle()
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}
@ -433,7 +433,7 @@ int ModeTitle()
{
CortBox(&grcGame, 0);
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}
@ -479,7 +479,7 @@ int ModeAction()
// Escape menu
if (gKey & KEY_ESCAPE)
{
int escRet = Call_Escape();
int escRet = Call_Escape(hWnd);
if (escRet == 0)
return 0;
if (escRet == 2)
@ -614,7 +614,7 @@ int ModeAction()
PutTextScript();
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
break;
++gCounter;
}

View file

@ -32,6 +32,7 @@ char gDataPath[PATH_LENGTH];
int gJoystickButtonTable[8];
int hWnd; // Placeholder until we restore the WinAPI code
bool gbUseJoystick = false;
bool bFps = false;
@ -349,7 +350,7 @@ int main(int argc, char *argv[])
PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING);
// Draw to screen
if (Flip_SystemTask())
if (Flip_SystemTask(hWnd))
{
// Initialize sound
InitDirectSound();

View file

@ -1,4 +1,6 @@
#pragma once
extern int hWnd;
void PutFramePerSecound();
int GetFramePerSecound();

View file

@ -79,19 +79,23 @@ void WriteMiniMapLine(int line)
int MiniMapLoop()
{
int f;
int line;
unsigned char my_wait;
RECT rcMiniMap;
RECT rcView;
RECT my_rect = {0, 57, 1, 58};
int my_x = (gMC.x / 0x200 + 8) / 16;
int my_y = (gMC.y / 0x200 + 8) / 16;
RECT rcView;
for (f = 0; f <= 8; f++)
{
GetTrg();
if (gKey & KEY_ESCAPE)
{
switch (Call_Escape())
switch (Call_Escape(hWnd))
{
case 0:
return 0;
@ -111,11 +115,10 @@ int MiniMapLoop()
CortBox(&rcView, 0);
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}
RECT rcMiniMap;
rcMiniMap.left = 0;
rcMiniMap.right = gMap.width;
rcMiniMap.top = 0;
@ -125,8 +128,8 @@ int MiniMapLoop()
rcView.bottom = --rcView.top + gMap.length + 2;
CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP);
int line = 0;
unsigned char my_wait = 0;
line = 0;
my_wait = 0;
while (true)
{
GetTrg();
@ -136,7 +139,7 @@ int MiniMapLoop()
if (gKey & KEY_ESCAPE)
{
switch (Call_Escape())
switch (Call_Escape(hWnd))
{
case 0:
return 0;
@ -167,7 +170,7 @@ int MiniMapLoop()
PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX);
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}
@ -177,7 +180,7 @@ int MiniMapLoop()
if (gKey & KEY_ESCAPE)
{
switch (Call_Escape())
switch (Call_Escape(hWnd))
{
case 0:
return 0;
@ -197,7 +200,7 @@ int MiniMapLoop()
CortBox(&rcView, 0);
PutFramePerSecound();
if (!Flip_SystemTask())
if (!Flip_SystemTask(hWnd))
return 0;
}

View file

@ -151,7 +151,7 @@ int StageSelectLoop(int *p_event)
if (gKey & KEY_ESCAPE)
{
int escRet = Call_Escape();
int escRet = Call_Escape(hWnd);
if (escRet == 0)
return 0;
if (escRet == 2)
@ -193,7 +193,7 @@ int StageSelectLoop(int *p_event)
PutFramePerSecound();
}
while (Flip_SystemTask());
while (Flip_SystemTask(hWnd));
return 0;
}