Browse Source

fix several render problem introduced by UI shadow; make script FFFF behaviour more like original version in dialogs; hidden exp upgrade dialog tweak

Pal Lockheart 7 years ago
parent
commit
889f9d766f
6 changed files with 25 additions and 10 deletions
  1. 2 2
      Pal.xcodeproj/project.pbxproj
  2. 2 2
      battle.c
  3. 2 2
      magicmenu.c
  4. 2 1
      text.c
  5. 8 0
      ui.c
  6. 9 3
      uigame.c

+ 2 - 2
Pal.xcodeproj/project.pbxproj

@@ -268,11 +268,11 @@
 		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>"; };
 		7104FD5D0D772F6300A97E53 /* text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = text.h; sourceTree = "<group>"; };
-		7104FD5E0D772F6300A97E53 /* ui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ui.c; 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>"; };
 		7104FD600D772F6300A97E53 /* uibattle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uibattle.c; sourceTree = "<group>"; };
 		7104FD610D772F6300A97E53 /* uibattle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uibattle.h; sourceTree = "<group>"; };
-		7104FD620D772F6300A97E53 /* uigame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uigame.c; sourceTree = "<group>"; };
+		7104FD620D772F6300A97E53 /* uigame.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.c; path = uigame.c; sourceTree = "<group>"; tabWidth = 3; };
 		7104FD630D772F6300A97E53 /* uigame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uigame.h; sourceTree = "<group>"; };
 		7104FD640D772F6300A97E53 /* util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = util.c; sourceTree = "<group>"; };
 		7104FD650D772F6300A97E53 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };

+ 2 - 2
battle.c

@@ -683,7 +683,7 @@ PAL_BattleWon(
         { 5,      gpGlobals->g.PlayerRoles.rgwName[4],    TRUE,     PAL_XY(0, 0) },
         { 6,      gpGlobals->g.PlayerRoles.rgwName[5],    TRUE,     PAL_XY(0, 0) },
     };
-    int maxNameWidth = PAL_MenuTextMaxWidth(rgFakeMenuItem, sizeof(rgFakeMenuItem) / sizeof(MENUITEM)) - 1;
+    int maxNameWidth = PAL_MenuTextMaxWidth(rgFakeMenuItem, sizeof(rgFakeMenuItem) / sizeof(MENUITEM));
     const MENUITEM      rgFakeMenuItem2[] =
     {
         // value  label                        enabled   pos
@@ -894,7 +894,7 @@ PAL_BattleWon(
       wcscat(buffer, PAL_GetWord(BATTLEWIN_LEVELUP_LABEL)); \
       PAL_CreateSingleLineBox(PAL_XY(offsetX+78, 60), maxNameWidth+maxPropertyWidth+PAL_TextWidth(PAL_GetWord(BATTLEWIN_LEVELUP_LABEL))/32+4, FALSE);    \
       PAL_DrawText(buffer, PAL_XY(offsetX+90, 70),  0, FALSE, FALSE, FALSE); \
-      PAL_DrawNumber(gpGlobals->g.PlayerRoles.statname[w] - OrigPlayerRoles.statname[w], 5, PAL_XY(183+(maxNameWidth+maxPropertyWidth-3)*4, 74), kNumColorYellow, kNumAlignRight); \
+      PAL_DrawNumber(gpGlobals->g.PlayerRoles.statname[w] - OrigPlayerRoles.statname[w], 5, PAL_XY(183+(maxNameWidth+maxPropertyWidth-3)*8, 74), kNumColorYellow, kNumAlignRight); \
       VIDEO_UpdateScreen(&rect);                            \
       PAL_WaitForKey(3000);                                 \
    }                                                        \

+ 2 - 2
magicmenu.c

@@ -117,7 +117,7 @@ PAL_MagicSelectionMenuUpdate(
    //
    // Create the box.
    //
-   PAL_CreateBox(PAL_XY(10, 42 + iBoxYOffset), iLinesPerPage - 1, 16, 1, FALSE);
+   PAL_CreateBoxWithShadow(PAL_XY(10, 42 + iBoxYOffset), iLinesPerPage - 1, 16, 1, FALSE, 0);
 
    if (!gConfig.fIsWIN95)
    {
@@ -177,7 +177,7 @@ PAL_MagicSelectionMenuUpdate(
          //
          // Draw the MP of the selected magic.
          //
-         PAL_CreateSingleLineBox(PAL_XY(0, 0), 5, FALSE);
+         PAL_CreateSingleLineBoxWithShadow(PAL_XY(0, 0), 5, FALSE,0);
          PAL_RLEBlitToSurface(PAL_SpriteGetFrame(gpSpriteUI, SPRITENUM_SLASH),
             gpScreen, PAL_XY(45, 14));
          PAL_DrawNumber(rgMagicItem[g_iCurrentItem].wMP, 4, PAL_XY(15, 14),

+ 2 - 1
text.c

@@ -1210,7 +1210,8 @@ PAL_ShowDialogText(
          // Create the window box
          //
          pos = PAL_XY(PAL_X(g_TextLib.posDialogText) - len * 4, PAL_Y(g_TextLib.posDialogText));
-         lpBox = PAL_CreateSingleLineBox(pos, (len + 1) / 2, TRUE);
+         // Follow behavior of original version
+         lpBox = PAL_CreateSingleLineBoxWithShadow(pos, (len + 1) / 2, FALSE, 0);
 
          rect.x = PAL_X(pos);
          rect.y = PAL_Y(pos);

+ 8 - 0
ui.c

@@ -176,6 +176,10 @@ PAL_CreateBoxWithShadow(
       }
    }
 
+   // Include shadow
+   rect.w += nShadowOffset;
+   rect.h += nShadowOffset;
+
    if (fSaveScreen)
    {
       //
@@ -305,6 +309,10 @@ PAL_CreateSingleLineBoxWithShadow(
    rect.w += PAL_RLEGetWidth(lpBitmapMid) * nLen;
    rect.h = PAL_RLEGetHeight(lpBitmapLeft);
 
+   // Include shadow
+   rect.w += nShadowOffset;
+   rect.h += nShadowOffset;
+
    if (fSaveScreen)
    {
       //

+ 9 - 3
uigame.c

@@ -177,7 +177,8 @@ PAL_SaveSlotMenu(
    //
    for (i = 0; i < 5; i++)
    {
-      rgpBox[i] = PAL_CreateSingleLineBox(PAL_XY(195 - dx, 7 + 38 * i), 6 + (w > 4 ? w - 4 : 0), TRUE);
+      // Fix render problem with shadow
+      rgpBox[i] = PAL_CreateSingleLineBox(PAL_XY(195 - dx, 7 + 38 * i), 6 + (w > 4 ? w - 4 : 0), FALSE);
 
       rgMenuItem[i].wValue = i + 1;
       rgMenuItem[i].fEnabled = TRUE;
@@ -957,6 +958,9 @@ PAL_InGameMenu(
    LPBOX                lpCashBox, lpMenuBox;
    WORD                 wReturnValue;
    const SDL_Rect       rect = {0, 0, 320, 185};
+   
+   // Fix render problem with shadow
+   VIDEO_BackupScreen();
 
    //
    // Create menu items
@@ -978,7 +982,8 @@ PAL_InGameMenu(
    //
    // Create the menu box.
    //
-   lpMenuBox = PAL_CreateBox(PAL_XY(3, 37), 3, PAL_MenuTextMaxWidth(rgMainMenuItem, 4) - 1, 0, TRUE);
+   // Fix render problem with shadow
+   lpMenuBox = PAL_CreateBox(PAL_XY(3, 37), 3, PAL_MenuTextMaxWidth(rgMainMenuItem, 4) - 1, 0, FALSE);
    VIDEO_UpdateScreen(&rect);
 
    //
@@ -1036,7 +1041,8 @@ out:
    PAL_DeleteBox(lpCashBox);
    PAL_DeleteBox(lpMenuBox);
 
-   VIDEO_UpdateScreen(&rect);
+   // Fix render problem with shadow
+   VIDEO_RestoreScreen();
 }
 
 VOID