Made MiniMap.cpp actually ASM-accurate
This commit is contained in:
parent
cc1df04fab
commit
9b82baeb02
11 changed files with 40 additions and 32 deletions
|
@ -129,10 +129,10 @@ BOOL AddItemData(long code)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == ITEM_MAX)
|
if (i == ITEM_MAX)
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
gItemData[i].code = code;
|
gItemData[i].code = code;
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SubItemData(long code)
|
BOOL SubItemData(long code)
|
||||||
|
@ -388,7 +388,7 @@ int CampLoop()
|
||||||
|
|
||||||
if (gKeyTrg & KEY_ESCAPE)
|
if (gKeyTrg & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
switch (Call_Escape())
|
switch (Call_Escape(hWnd))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -430,7 +430,7 @@ int CampLoop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,10 @@ FontObject *gFont;
|
||||||
|
|
||||||
#define FRAMERATE 20
|
#define FRAMERATE 20
|
||||||
|
|
||||||
BOOL Flip_SystemTask()
|
BOOL Flip_SystemTask(int hWnd)
|
||||||
{
|
{
|
||||||
|
(void)hWnd;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (!SystemTask())
|
if (!SystemTask())
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct SURFACE;
|
||||||
|
|
||||||
extern SURFACE surf[SURFACE_ID_MAX];
|
extern SURFACE surf[SURFACE_ID_MAX];
|
||||||
|
|
||||||
BOOL Flip_SystemTask();
|
BOOL Flip_SystemTask(int hWnd);
|
||||||
BOOL StartDirectDraw(int lMagnification, int lColourDepth);
|
BOOL StartDirectDraw(int lMagnification, int lColourDepth);
|
||||||
void EndDirectDraw();
|
void EndDirectDraw();
|
||||||
void ReleaseSurface(int s);
|
void ReleaseSurface(int s);
|
||||||
|
|
|
@ -410,7 +410,7 @@ int Scene_DownIsland(int mode)
|
||||||
// Escape menu
|
// Escape menu
|
||||||
if (gKey & 0x8000)
|
if (gKey & 0x8000)
|
||||||
{
|
{
|
||||||
int escRet = Call_Escape();
|
int escRet = Call_Escape(hWnd);
|
||||||
if (escRet == 0)
|
if (escRet == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (escRet == 2)
|
if (escRet == 2)
|
||||||
|
@ -464,7 +464,7 @@ int Scene_DownIsland(int mode)
|
||||||
|
|
||||||
// Draw window
|
// Draw window
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "KeyControl.h"
|
#include "KeyControl.h"
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
|
|
||||||
int Call_Escape()
|
int Call_Escape(int hWnd)
|
||||||
{
|
{
|
||||||
RECT rc = {0, 128, 208, 144};
|
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);
|
PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX);
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
|
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
{
|
{
|
||||||
// Quit if window is closed
|
// Quit if window is closed
|
||||||
gKeyTrg = 0;
|
gKeyTrg = 0;
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
int Call_Escape();
|
int Call_Escape(int hWnd);
|
||||||
|
|
16
src/Game.cpp
16
src/Game.cpp
|
@ -141,7 +141,7 @@ int ModeOpening()
|
||||||
// Escape menu
|
// Escape menu
|
||||||
if (gKey & KEY_ESCAPE)
|
if (gKey & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
int escRet = Call_Escape();
|
int escRet = Call_Escape(hWnd);
|
||||||
if (escRet == 0)
|
if (escRet == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (escRet == 2)
|
if (escRet == 2)
|
||||||
|
@ -193,7 +193,7 @@ int ModeOpening()
|
||||||
PutTextScript();
|
PutTextScript();
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
|
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
++gCounter;
|
++gCounter;
|
||||||
|
@ -204,7 +204,7 @@ int ModeOpening()
|
||||||
{
|
{
|
||||||
CortBox(&grcGame, 0x000000);
|
CortBox(&grcGame, 0x000000);
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -335,7 +335,7 @@ int ModeTitle()
|
||||||
|
|
||||||
if (gKey & KEY_ESCAPE)
|
if (gKey & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
int escRet = Call_Escape();
|
int escRet = Call_Escape(hWnd);
|
||||||
if (escRet == 0)
|
if (escRet == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (escRet == 2)
|
if (escRet == 2)
|
||||||
|
@ -420,7 +420,7 @@ int ModeTitle()
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
|
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ int ModeTitle()
|
||||||
{
|
{
|
||||||
CortBox(&grcGame, 0);
|
CortBox(&grcGame, 0);
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +479,7 @@ int ModeAction()
|
||||||
// Escape menu
|
// Escape menu
|
||||||
if (gKey & KEY_ESCAPE)
|
if (gKey & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
int escRet = Call_Escape();
|
int escRet = Call_Escape(hWnd);
|
||||||
if (escRet == 0)
|
if (escRet == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (escRet == 2)
|
if (escRet == 2)
|
||||||
|
@ -614,7 +614,7 @@ int ModeAction()
|
||||||
PutTextScript();
|
PutTextScript();
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
break;
|
break;
|
||||||
++gCounter;
|
++gCounter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ char gDataPath[PATH_LENGTH];
|
||||||
|
|
||||||
int gJoystickButtonTable[8];
|
int gJoystickButtonTable[8];
|
||||||
|
|
||||||
|
int hWnd; // Placeholder until we restore the WinAPI code
|
||||||
bool gbUseJoystick = false;
|
bool gbUseJoystick = false;
|
||||||
bool bFps = 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);
|
PutBitmap3(&clip_rect, (WINDOW_WIDTH - 64) / 2, (WINDOW_HEIGHT - 8) / 2, &loading_rect, SURFACE_ID_LOADING);
|
||||||
|
|
||||||
// Draw to screen
|
// Draw to screen
|
||||||
if (Flip_SystemTask())
|
if (Flip_SystemTask(hWnd))
|
||||||
{
|
{
|
||||||
// Initialize sound
|
// Initialize sound
|
||||||
InitDirectSound();
|
InitDirectSound();
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
extern int hWnd;
|
||||||
|
|
||||||
void PutFramePerSecound();
|
void PutFramePerSecound();
|
||||||
int GetFramePerSecound();
|
int GetFramePerSecound();
|
||||||
|
|
|
@ -79,19 +79,23 @@ void WriteMiniMapLine(int line)
|
||||||
int MiniMapLoop()
|
int MiniMapLoop()
|
||||||
{
|
{
|
||||||
int f;
|
int f;
|
||||||
|
int line;
|
||||||
|
unsigned char my_wait;
|
||||||
|
|
||||||
|
RECT rcMiniMap;
|
||||||
|
RECT rcView;
|
||||||
|
|
||||||
RECT my_rect = {0, 57, 1, 58};
|
RECT my_rect = {0, 57, 1, 58};
|
||||||
int my_x = (gMC.x / 0x200 + 8) / 16;
|
int my_x = (gMC.x / 0x200 + 8) / 16;
|
||||||
int my_y = (gMC.y / 0x200 + 8) / 16;
|
int my_y = (gMC.y / 0x200 + 8) / 16;
|
||||||
|
|
||||||
RECT rcView;
|
|
||||||
for (f = 0; f <= 8; f++)
|
for (f = 0; f <= 8; f++)
|
||||||
{
|
{
|
||||||
GetTrg();
|
GetTrg();
|
||||||
|
|
||||||
if (gKey & KEY_ESCAPE)
|
if (gKey & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
switch (Call_Escape())
|
switch (Call_Escape(hWnd))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -111,11 +115,10 @@ int MiniMapLoop()
|
||||||
CortBox(&rcView, 0);
|
CortBox(&rcView, 0);
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECT rcMiniMap;
|
|
||||||
rcMiniMap.left = 0;
|
rcMiniMap.left = 0;
|
||||||
rcMiniMap.right = gMap.width;
|
rcMiniMap.right = gMap.width;
|
||||||
rcMiniMap.top = 0;
|
rcMiniMap.top = 0;
|
||||||
|
@ -125,8 +128,8 @@ int MiniMapLoop()
|
||||||
rcView.bottom = --rcView.top + gMap.length + 2;
|
rcView.bottom = --rcView.top + gMap.length + 2;
|
||||||
CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP);
|
CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP);
|
||||||
|
|
||||||
int line = 0;
|
line = 0;
|
||||||
unsigned char my_wait = 0;
|
my_wait = 0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
GetTrg();
|
GetTrg();
|
||||||
|
@ -136,7 +139,7 @@ int MiniMapLoop()
|
||||||
|
|
||||||
if (gKey & KEY_ESCAPE)
|
if (gKey & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
switch (Call_Escape())
|
switch (Call_Escape(hWnd))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return 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);
|
PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX);
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +180,7 @@ int MiniMapLoop()
|
||||||
|
|
||||||
if (gKey & KEY_ESCAPE)
|
if (gKey & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
switch (Call_Escape())
|
switch (Call_Escape(hWnd))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -197,7 +200,7 @@ int MiniMapLoop()
|
||||||
CortBox(&rcView, 0);
|
CortBox(&rcView, 0);
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask(hWnd))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ int StageSelectLoop(int *p_event)
|
||||||
|
|
||||||
if (gKey & KEY_ESCAPE)
|
if (gKey & KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
int escRet = Call_Escape();
|
int escRet = Call_Escape(hWnd);
|
||||||
if (escRet == 0)
|
if (escRet == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (escRet == 2)
|
if (escRet == 2)
|
||||||
|
@ -193,7 +193,7 @@ int StageSelectLoop(int *p_event)
|
||||||
|
|
||||||
PutFramePerSecound();
|
PutFramePerSecound();
|
||||||
}
|
}
|
||||||
while (Flip_SystemTask());
|
while (Flip_SystemTask(hWnd));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue