Browse Source

dialog disappear behaviour changed to original DOS version; fixes #68, thanks to testing of M-HT

Pal Lockheart 6 years ago
parent
commit
be409bea7b
4 changed files with 21 additions and 6 deletions
  1. 1 0
      common.h
  2. 1 1
      macos/Pal.xcodeproj/project.pbxproj
  3. 19 4
      text.c
  4. 0 1
      video.c

+ 1 - 0
common.h

@@ -115,6 +115,7 @@ typedef const BYTE *LPCBYTE;
 
 # include <unistd.h>
 # include <dirent.h>
+# include <float.h>
 # ifdef __APPLE__
 #  include <objc/objc.h>
 # endif

+ 1 - 1
macos/Pal.xcodeproj/project.pbxproj

@@ -288,7 +288,7 @@
 		7104FD580D772F6300A97E53 /* script.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = script.c; sourceTree = "<group>"; };
 		7104FD590D772F6300A97E53 /* script.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = script.h; sourceTree = "<group>"; };
 		7104FD5A0D772F6300A97E53 /* sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sound.c; sourceTree = "<group>"; };
-		7104FD5C0D772F6300A97E53 /* text.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = text.c; sourceTree = "<group>"; };
+		7104FD5C0D772F6300A97E53 /* text.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.c; path = text.c; sourceTree = "<group>"; tabWidth = 3; };
 		7104FD5D0D772F6300A97E53 /* text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = text.h; sourceTree = "<group>"; };
 		7104FD5E0D772F6300A97E53 /* ui.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.c; path = ui.c; sourceTree = "<group>"; tabWidth = 3; };
 		7104FD5F0D772F6300A97E53 /* ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ui.h; sourceTree = "<group>"; };

+ 19 - 4
text.c

@@ -1162,8 +1162,8 @@ PAL_StartDialog(
 }
 
 static VOID
-PAL_DialogWaitForKey(
-   VOID
+PAL_DialogWaitForKeyWithinMinimalSeconds(
+   FLOAT fMinSeconds
 )
 /*++
   Purpose:
@@ -1183,6 +1183,7 @@ PAL_DialogWaitForKey(
    PAL_LARGE SDL_Color   palette[256];
    SDL_Color   *pCurrentPalette, t;
    int         i;
+   uint32_t    dwBeginningTicks = SDL_GetTicks();
 
    //
    // get the current palette
@@ -1232,8 +1233,14 @@ PAL_DialogWaitForKey(
 
          VIDEO_SetPalette(palette);
       }
+      
+      if (SDL_GetTicks() - dwBeginningTicks < 1000 * fMinSeconds)
+      {
+         PAL_ClearKeyState();
+         continue;
+      }
 
-      if (g_InputState.dwKeyPress != 0)
+      if (fabs(fMinSeconds) > FLT_EPSILON || g_InputState.dwKeyPress != 0)
       {
          break;
       }
@@ -1250,6 +1257,14 @@ PAL_DialogWaitForKey(
    g_TextLib.fUserSkip = FALSE;
 }
 
+static VOID
+PAL_DialogWaitForKey(
+   VOID
+)
+{
+   PAL_DialogWaitForKeyWithinMinimalSeconds(0);
+}
+
 VOID
 PAL_ShowDialogText(
    LPCWSTR      lpszText
@@ -1336,7 +1351,7 @@ PAL_ShowDialogText(
          PAL_DrawText(lpszText, pos, 0, FALSE, FALSE, FALSE);
          VIDEO_UpdateScreen(&rect);
 
-         PAL_DialogWaitForKey();
+         PAL_DialogWaitForKeyWithinMinimalSeconds(1.4);
 
          //
          // Delete the box

+ 0 - 1
video.c

@@ -53,7 +53,6 @@ static WORD               g_wShakeLevel      = 0;
 
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 #define SDL_SoftStretch SDL_UpperBlit
-#include <float.h>
 static SDL_Texture *VIDEO_CreateTexture(int width, int height)
 {
 	int texture_width, texture_height;