Minor fixes

This commit is contained in:
nukeykt 2019-09-01 00:04:06 +09:00 committed by Christoph Oelckers
parent b13e57efa4
commit 48b9ca7f7f
5 changed files with 49 additions and 58 deletions

View file

@ -730,6 +730,13 @@ void timerhandler()
}
}
void HandleAsync()
{
handleevents();
if (!bInMove)
OSD_DispatchQueued();
}
int MyGetStringWidth(const char *str)
{
int nLen = strlen(str);
@ -2022,9 +2029,6 @@ LOOP2:
LOOP3:
while (levelnew != -1)
{
// CHECKME - this should be here?
handleevents();
// BLUE
if (CDplaying()) {
fadecdaudio();
@ -2032,6 +2036,7 @@ LOOP3:
CheckCD();
#if 0
if (!bNoCDCheck)
{
while (!checkcdrom())
@ -2044,6 +2049,7 @@ LOOP3:
}
}
}
#endif
if (levelnew == kMap20)
{
@ -2100,12 +2106,18 @@ LOOP3:
mysetbrightness((uint8_t)nGamma);
//int edi = totalclock;
tclocks2 = totalclock;
CONTROL_BindsEnabled = 1;
// Game Loop
while (1)
{
if (levelnew >= 0)
{
CONTROL_BindsEnabled = 0;
goto LOOP1;
CONTROL_BindsEnabled = 1;
}
HandleAsync();
OSD_DispatchQueued();
// Section B
if (!nCDTrackLength && !nFreeze && !nNetPlayerCount)
{
@ -2150,9 +2162,6 @@ LOOP3:
videoNextPage();
// TEST - trying to fix player unable to restart when dead...
handleevents();
// TODO CONTROL_GetButtonInput();
CheckKeys();
UpdateSounds();
@ -2182,6 +2191,7 @@ LOOP3:
fclose(vcrfp);
}
CONTROL_BindsEnabled = 0;
goto MENU;
}
}
@ -2307,7 +2317,7 @@ LOOP3:
// loc_12149:
if (bInDemo)
{
while (tclocks > totalclock) { handleevents(); }
while (tclocks > totalclock) { HandleAsync(); }
tclocks = totalclock;
}
@ -2319,6 +2329,7 @@ LOOP3:
{
CONTROL_ClearButton(gamefunc_Escape);
MENU2:
CONTROL_BindsEnabled = 0;
nMenu = menu_Menu(1);
switch (nMenu)
@ -2343,6 +2354,7 @@ MENU2:
}
break;
}
CONTROL_BindsEnabled = 1;
RefreshStatus();
}
else if (KB_KeyDown[sc_PrintScreen])
@ -2392,8 +2404,6 @@ MENU2:
}
}
handleevents();
if (PlayerList[nLocalPlayer].nHealth > 0)
{
if (BUTTON(gamefunc_Inventory_Left))
@ -2596,7 +2606,7 @@ void DoTitle()
while (LocalSoundPlaying())
{
handleevents();
HandleAsync();
menu_DoPlasma();
overwritesprite(160, 100, nTile, 0, 3, kPalNormal);
@ -2826,7 +2836,7 @@ int Query(short nLines, short nKeys, ...)
while (1)
{
handleevents();
HandleAsync();
char key = toupper(KB_GetCh());

View file

@ -85,6 +85,8 @@ int DoSpiritHead();
void UpdateScreenSize();
void HandleAsync();
extern buildvfs_kfd kopen4loadfrommod(const char* filename, char searchfirst);
extern int32_t g_commandSetup;
extern int32_t g_noSetup;

View file

@ -196,7 +196,7 @@ void WaitNoKey(int nSecs, void (*pFunc) (void))
while (nTotalTime > totalclock)
{
#ifdef _MSC_VER
handleevents();
HandleAsync();
#endif
if (pFunc) {
pFunc();
@ -211,7 +211,7 @@ int WaitAnyKey(int nSecs)
while (1)
{
#ifdef _MSC_VER
handleevents();
HandleAsync();
#endif
if (nTotalTime <= totalclock || nSecs == -1) {
return -1;

View file

@ -8,25 +8,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef __WATCOMC__
#include <dos.h>
#include <conio.h>
#include <i86.h>
void handleevents()
{
}
#else
#ifdef __cplusplus
extern "C" {
#endif
int handleevents(void);
#ifdef __cplusplus
}
#endif
#endif
#define kMaxGrads 12
const char *GradList[kMaxGrads] = {
@ -212,7 +193,7 @@ void WaitTicks(int nTicks)
if (htimer)
{
nTicks += totalclock;
while (nTicks > totalclock) { handleevents(); }
while (nTicks > totalclock) { HandleAsync(); }
}
else
{

View file

@ -443,13 +443,8 @@ void menu_DoPlasma()
for (int j = 0; j < 5; j++)
{
int pB = plasma_B[j];
if ((plasma_C[j]>>16) <= nSmokeLeft)
plasma_C[j] = nSmokeLeft<<16;
else if ((plasma_C[j]>>16) >= nSmokeRight)
plasma_C[j] = nSmokeRight<<16;
int pC = plasma_C[j];
int badOffset = (pC>>16) < nSmokeLeft || (pC>>16) >= nSmokeRight;
uint8_t *ptr3 = (uint8_t*)(waloff[kExhumedLogo] + ((pC >> 16) - nSmokeLeft) * tilesiz[kExhumedLogo].y);
@ -462,6 +457,9 @@ void menu_DoPlasma()
plasma_A[j] = esi == 0;
}
if (badOffset)
continue;
unsigned int nSmokeOffset = 0;
if (plasma_A[j])
@ -501,6 +499,8 @@ void menu_DoPlasma()
v28[nSmokeOffset] = 175;
}
tileInvalidate(nPlasmaTile,-1,-1);
overwritesprite(0, 0, nPlasmaTile, 0, 2, kPalNormal);
overwritesprite(160, 40, kExhumedLogo, 0, 3, kPalNormal);
@ -521,7 +521,7 @@ void menu_DoPlasma()
// TEMP
int time = totalclock + 4;
while (totalclock < time) {
handleevents();
HandleAsync();
}
}
@ -666,7 +666,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
while (var_38 < 12)
{
handleevents();
HandleAsync();
if ((totalclock - startTime) / kTimerTicks)
{
@ -688,8 +688,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
// for each level - drawing the 'level completed' on-fire smoke markers
for (i = 0; i < kMap20; i++)
{
handleevents();
int screenY = (i >> 1) * -200;
if (nLevelBest >= i) // check if the player has finished this level
@ -837,7 +835,7 @@ void menu_AdjustVolume()
while (1)
{
handleevents();
HandleAsync();
menu_DoPlasma();
@ -1027,7 +1025,7 @@ int menu_NewGameMenu()
while (1)
{
handleevents();
HandleAsync();
menu_DoPlasma();
int y = (tilesiz[kMenuBlankTitleTile].y - (tilesiz[kMenuBlankTitleTile].y / 2) / 2) + 65;
@ -1139,7 +1137,7 @@ int menu_NewGameMenu()
while (1)
{
handleevents();
HandleAsync();
overwritesprite(x, y, kMenuCursorTile, 0, 2, kPalNormal);
overwritesprite(233, y, kMenuCursorTile, 0, 10, kPalNormal);
@ -1149,7 +1147,7 @@ int menu_NewGameMenu()
while (KB_KeyWaiting())
{
handleevents();
HandleAsync();
ch = KB_GetCh();
if (!ch) {
@ -1290,7 +1288,7 @@ int menu_LoadGameMenu()
{
menu_DoPlasma();
handleevents();
HandleAsync();
overwritesprite(80, 65, kMenuLoadGameTile, 0, 2, kPalNormal);
@ -1486,7 +1484,7 @@ int menu_Menu(int nVal)
while (1)
{
handleevents();
HandleAsync();
// skip any disabled menu items so we're selecting the first active one
while (!ptr[nMenu])
@ -1566,7 +1564,7 @@ int menu_Menu(int nVal)
// loc_3A0A7
while (KB_KeyDown[sc_Escape])
{
handleevents();
HandleAsync();
PlayLocalSound(StaticSound[kSound33], 0);
KB_KeyDown[sc_Escape] = 0;
@ -1892,7 +1890,7 @@ uint8_t AdvanceCinemaText()
while (1)
{
handleevents();
HandleAsync();
if (KB_KeyDown[sc_Escape] || KB_KeyDown[sc_Return] || KB_KeyDown[sc_Space]) {
break;
@ -2229,7 +2227,7 @@ void DoLastLevelCinema()
while (nEndTime > totalclock)
{
handleevents();
HandleAsync();
if (var_24 >= 116)
{
@ -2252,7 +2250,7 @@ void DoLastLevelCinema()
do
{
handleevents();
HandleAsync();
LABEL_11:
if (strlen(gString[nString]) == 0)
break;
@ -2274,7 +2272,7 @@ LABEL_11:
// loc_3ADD7
while (1)
{
handleevents();
HandleAsync();
if (strlen(gString[nString]) == 0)
break;
@ -2287,7 +2285,7 @@ LABEL_11:
while (*nChar)
{
handleevents();
HandleAsync();
if (*nChar != ' ') {
PlayLocalSound(StaticSound[kSound71], 0);
@ -2316,7 +2314,7 @@ LABEL_11:
do
{
handleevents();
HandleAsync();
if (v11 <= totalclock)
goto LABEL_11;
@ -2329,7 +2327,7 @@ LABEL_28:
while (1)
{
handleevents();
HandleAsync();
DoStatic(var_28, var_24);