Browse Source

Cleanup game_loop

pull/25/head
galaxyhaxz 7 years ago committed by Anders Jenbo
parent
commit
040b4b0cc9
  1. 37
      Source/diablo.cpp
  2. 4
      Source/diablo.h
  3. 2
      Source/nthread.cpp
  4. 2
      Source/nthread.h

37
Source/diablo.cpp

@ -1892,31 +1892,22 @@ void __fastcall LoadGameLevel(BOOL firstflag, int lvldir)
// 5CF31D: using guessed type char setlevel;
// 679660: using guessed type char gbMaxPlayers;
void __fastcall game_loop(BOOLEAN bStartup)
void __fastcall game_loop(BOOL bStartup)
{
int v1; // ecx
int v2; // esi
v1 = bStartup != 0 ? 0x39 : 0;
v2 = v1 + 3;
if (v1 != -3) {
while (1) {
--v2;
if (!multi_handle_delta())
break;
timeout_cursor(0);
int i;
i = bStartup ? 60 : 3;
while(i--) {
if(!multi_handle_delta()) {
timeout_cursor(TRUE);
break;
} else {
timeout_cursor(FALSE);
game_logic();
if (gbRunGame) {
if (gbMaxPlayers != 1) {
if (nthread_has_500ms_passed(0)) {
if (v2)
continue;
}
}
}
return;
}
timeout_cursor(1);
if(!gbRunGame || gbMaxPlayers == 1 || !nthread_has_500ms_passed(TRUE))
break;
}
}
// 679660: using guessed type char gbMaxPlayers;
@ -1967,7 +1958,7 @@ void __cdecl game_logic()
// 525740: using guessed type int PauseMode;
// 679660: using guessed type char gbMaxPlayers;
void __fastcall timeout_cursor(BOOLEAN bTimeout)
void __fastcall timeout_cursor(BOOL bTimeout)
{
if (bTimeout) {
if (sgnTimeoutCurs == CURSOR_NONE && !sgbMouseDown) {

4
Source/diablo.h

@ -66,9 +66,9 @@ void __cdecl LoadLvlGFX();
void __cdecl LoadAllGFX();
void __fastcall CreateLevel(int lvldir);
void __fastcall LoadGameLevel(BOOL firstflag, int lvldir);
void __fastcall game_loop(BOOLEAN bStartup);
void __fastcall game_loop(BOOL bStartup);
void __cdecl game_logic();
void __fastcall timeout_cursor(BOOLEAN bTimeout);
void __fastcall timeout_cursor(BOOL bTimeout);
void __cdecl diablo_color_cyc_logic();
/* data */

2
Source/nthread.cpp

@ -288,7 +288,7 @@ void __fastcall nthread_ignore_mutex(BOOL bStart)
}
// 67975A: using guessed type char sgbThreadIsRunning;
BOOL __fastcall nthread_has_500ms_passed(int unused)
BOOL __fastcall nthread_has_500ms_passed(BOOL unused)
{
DWORD currentTickCount; // eax
int ticksElapsed; // ecx

2
Source/nthread.h

@ -30,7 +30,7 @@ void __fastcall nthread_start(BOOLEAN set_turn_upper_bit);
unsigned int __stdcall nthread_handler(void *a1);
void __cdecl nthread_cleanup();
void __fastcall nthread_ignore_mutex(BOOL bStart);
BOOL __fastcall nthread_has_500ms_passed(int unused);
BOOL __fastcall nthread_has_500ms_passed(BOOL unused);
/* rdata */

Loading…
Cancel
Save