Browse Source

Remove PAL_UNICODE definition

Now every thing is unicode, with a new option "UseEmbeddedFonts" for DOS version to use its original font.
louyihua 8 years ago
parent
commit
112754ca15
20 changed files with 124 additions and 732 deletions
  1. 19 0
      ascii.h
  2. 0 1
      common.h
  3. 1 18
      fight.c
  4. 88 277
      font.c
  5. 1 15
      font.h
  6. 1 1
      fontglyph.h
  7. 7 6
      global.c
  8. 2 2
      global.h
  9. 1 31
      itemmenu.c
  10. 0 28
      magicmenu.c
  11. 1 1
      main.c
  12. 0 53
      script.c
  13. 2 224
      text.c
  14. 0 18
      text.h
  15. 1 14
      ui.c
  16. 0 8
      ui.h
  17. 0 20
      uibattle.c
  18. 0 9
      uibattle.h
  19. 0 2
      uigame.c
  20. 0 4
      video.c

+ 19 - 0
ascii.h

@@ -1,3 +1,16 @@
+
+#ifndef _ASCII_H
+#define _ASCII_H
+
+#ifndef _FONT_C
+#error "This file should only be included inside font.c!"
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+	
 unsigned char iso_font[] =
 {
    /*
@@ -134,3 +147,9 @@ unsigned char iso_font[] =
    /* 7E */ 0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    /* 7F */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
 };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 0 - 1
common.h

@@ -24,7 +24,6 @@
 #define _COMMON_H
 
 #define PAL_CLASSIC        1
-#define PAL_UNICODE        1
 
 #ifdef __cplusplus
 extern "C"

+ 1 - 18
fight.c

@@ -4803,11 +4803,7 @@ PAL_BattleStealFromEnemy(
 {
    int   iPlayerIndex = g_Battle.wMovingPlayerIndex;
    int   offset, x, y, i;
-#ifdef PAL_UNICODE
    WCHAR s[256] = L"";
-#else
-   char  s[256] = "";
-#endif
 
    g_Battle.rgPlayer[iPlayerIndex].wCurrentFrame = 10;
    offset = ((INT)wTarget - iPlayerIndex) * 8;
@@ -4858,15 +4854,7 @@ PAL_BattleStealFromEnemy(
 
          if (c > 0)
          {
-#        ifdef PAL_UNICODE
-			 swprintf(s, 256, L"%s %d %s", PAL_GetWord(34), c, PAL_GetWord(10));
-#        else
-			 strcpy(s, PAL_GetWord(34));
-			 strcat(s, " ");
-			 strcat(s, va("%d", c));
-			 strcat(s, " ");
-			 strcat(s, PAL_GetWord(10));
-#        endif
+            swprintf(s, 256, L"%s %d %s", PAL_GetWord(34), c, PAL_GetWord(10));
          }
       }
       else
@@ -4877,13 +4865,8 @@ PAL_BattleStealFromEnemy(
          g_Battle.rgEnemy[wTarget].e.nStealItem--;
          PAL_AddItemToInventory(g_Battle.rgEnemy[wTarget].e.wStealItem, 1);
 
-#     ifdef PAL_UNICODE
 		 wcscpy(s, PAL_GetWord(34));
          wcscat(s, PAL_GetWord(g_Battle.rgEnemy[wTarget].e.wStealItem));
-#     else
-		 strcpy(s, PAL_GetWord(34));
-		 strcat(s, PAL_GetWord(g_Battle.rgEnemy[wTarget].e.wStealItem));
-#     endif
 	  }
 
       if (s[0] != '\0')

+ 88 - 277
font.c

@@ -23,16 +23,18 @@
 
 #include "font.h"
 #include "util.h"
+#include "text.h"
 
 #define _FONT_C
 
-#if defined(PAL_UNICODE)
-
 #include "fontglyph.h"
+#include "ascii.h"
+
+static int _font_height = 16;
 
 INT
 PAL_InitFont(
-   VOID
+   BOOL      fUseEmbeddedFonts
 )
 /*++
   Purpose:
@@ -49,7 +51,87 @@ PAL_InitFont(
 
 --*/
 {
-   return 0;
+	if (fUseEmbeddedFonts)
+	{
+		FILE *fp;
+		char *char_buf;
+		wchar_t *wchar_buf;
+		int nBytes, nChars, i;
+
+		//
+		// Load the wor16.asc file.
+		//
+		if (NULL == (fp = UTIL_OpenFile("wor16.asc")))
+		{
+			return 0;
+		}
+		
+		//
+		// Get the size of wor16.asc file.
+		//
+		fseek(fp, 0, SEEK_END);
+		nBytes = ftell(fp);
+
+		//
+		// Allocate buffer & read all the character codes.
+		//
+		if (NULL == (char_buf = (char *)malloc(nBytes)))
+		{
+			fclose(fp);
+			return 0;
+		}
+		fseek(fp, 0, SEEK_SET);
+		fread(char_buf, 1, nBytes, fp);
+
+		//
+		// Close wor16.asc file.
+		//
+		fclose(fp);
+
+		//
+		// Convert characters into unicode
+		//
+		nChars = PAL_MultiByteToWideChar(char_buf, nBytes, NULL, 0);
+		if (NULL == (wchar_buf = (wchar_t *)malloc(nChars * sizeof(wchar_t))))
+		{
+			free(char_buf);
+			return 0;
+		}
+		PAL_MultiByteToWideChar(char_buf, nBytes, wchar_buf, nChars);
+		free(char_buf);
+
+		//
+		// Read bitmaps from wor16.fon file.
+		//
+		fp = UTIL_OpenFile("wor16.fon");
+
+		//
+		// The font glyph data begins at offset 0x682 in wor16.fon.
+		//
+		fseek(fp, 0x682, SEEK_SET);
+
+		//
+		// Replace the original fonts
+		//
+		for (i = 0; i < nChars; i++)
+		{
+			fread(unicode_font[wchar_buf[i]], 30, 1, fp);
+			unicode_font[wchar_buf[i]][30] = 0;
+			unicode_font[wchar_buf[i]][31] = 0;
+		}
+		free(wchar_buf);
+		
+		fclose(fp);
+
+		for (int i = 0; i < 0x80; i++)
+		{
+			memcpy(unicode_font[i], &iso_font[i * 15], 15);
+			unicode_font[i][15] = 0;
+		}
+		_font_height = 15;
+	}
+
+	return 0;
 }
 
 VOID
@@ -127,7 +209,7 @@ PAL_DrawCharOnSurface(
 	LPBYTE top = (LPBYTE)lpSurface->pixels + lpSurface->h * lpSurface->pitch;
 	if (font_width[wChar] == 32)
 	{
-		for (i = 0; i < 32 && dest < top; i += 2, dest += lpSurface->pitch)
+		for (i = 0; i < _font_height * 2 && dest < top; i += 2, dest += lpSurface->pitch)
 		{
 			for (j = 0; j < 8 && x + j < lpSurface->w; j++)
 			{
@@ -147,7 +229,7 @@ PAL_DrawCharOnSurface(
 	}
 	else
 	{
-		for (i = 0; i < 16 && dest < top; i++, dest += lpSurface->pitch)
+		for (i = 0; i < _font_height && dest < top; i++, dest += lpSurface->pitch)
 		{
 			for (j = 0; j < 8 && x + j < lpSurface->w; j++)
 			{
@@ -194,274 +276,3 @@ PAL_CharWidth(
 
 	return font_width[wChar] >> 1;
 }
-
-#else
-
-typedef struct tagFont
-{
-   LPWORD           lpBufChar;
-   LPBYTE           lpBufGlyph;
-   INT              nChar;
-} FONT, *LPFONT;
-
-static LPFONT gpFont = NULL;
-
-INT
-PAL_InitFont(
-   VOID
-)
-/*++
-  Purpose:
-
-    Load the font files.
-
-  Parameters:
-
-    None.
-
-  Return value:
-
-    0 if succeed, -1 if cannot allocate memory, -2 if cannot load files.
-
---*/
-{
-   FILE *fp;
-
-   if (gpFont != NULL)
-   {
-      //
-      // Already initialized
-      //
-      return 0;
-   }
-
-   gpFont = (LPFONT)calloc(1, sizeof(FONT));
-   if (gpFont == NULL)
-   {
-      return -1;
-   }
-
-   //
-   // Load the wor16.asc file.
-   //
-   fp = UTIL_OpenRequiredFile("wor16.asc");
-
-   //
-   // Get the size of wor16.asc file.
-   //
-   fseek(fp, 0, SEEK_END);
-   gpFont->nChar = ftell(fp);
-   gpFont->nChar /= 2;
-
-   //
-   // Read all the character codes.
-   //
-   gpFont->lpBufChar = (LPWORD)calloc(gpFont->nChar, sizeof(WORD));
-   if (gpFont->lpBufChar == NULL)
-   {
-      free(gpFont);
-      gpFont = NULL;
-      return -1;
-   }
-
-   fseek(fp, 0, SEEK_SET);
-   fread(gpFont->lpBufChar, sizeof(WORD), gpFont->nChar, fp);
-
-   //
-   // Close wor16.asc file.
-   //
-   fclose(fp);
-
-   //
-   // Read all bitmaps from wor16.fon file.
-   //
-   fp = UTIL_OpenRequiredFile("wor16.fon");
-
-   gpFont->lpBufGlyph = (LPBYTE)calloc(gpFont->nChar, 30);
-   if (gpFont->lpBufGlyph == NULL)
-   {
-      free(gpFont->lpBufChar);
-      free(gpFont);
-      gpFont = NULL;
-      return -1;
-   }
-
-   //
-   // The font glyph data begins at offset 0x682 in wor16.fon.
-   //
-   fseek(fp, 0x682, SEEK_SET);
-   fread(gpFont->lpBufGlyph, 30, gpFont->nChar, fp);
-   fclose(fp);
-
-   return 0;
-}
-
-VOID
-PAL_FreeFont(
-   VOID
-)
-/*++
-  Purpose:
-
-    Free the memory used for fonts.
-
-  Parameters:
-
-    None.
-
-  Return value:
-
-    None.
-
---*/
-{
-   if (gpFont != NULL)
-   {
-      free(gpFont->lpBufChar);
-      free(gpFont->lpBufGlyph);
-      free(gpFont);
-   }
-
-   gpFont = NULL;
-}
-
-VOID
-PAL_DrawCharOnSurface(
-   WORD                     wChar,
-   SDL_Surface             *lpSurface,
-   PAL_POS                  pos,
-   BYTE                     bColor
-)
-/*++
-  Purpose:
-
-    Draw a BIG-5 Chinese character on a surface.
-
-  Parameters:
-
-    [IN]  wChar - the character to be drawn (in BIG-5).
-
-    [OUT] lpSurface - the destination surface.
-
-    [IN]  pos - the destination location of the surface.
-
-    [IN]  bColor - the color of the character.
-
-  Return value:
-
-    None.
-
---*/
-{
-   int       i, j, dx;
-   int       x = PAL_X(pos), y = PAL_Y(pos);
-   LPBYTE    pChar;
-
-   //
-   // Check for NULL pointer.
-   //
-   if (lpSurface == NULL || gpFont == NULL)
-   {
-      return;
-   }
-
-   //
-   // Locate for this character in the font lib.
-   //
-   for (i = 0; i < gpFont->nChar; i++)
-   {
-      if (gpFont->lpBufChar[i] == wChar)
-      {
-         break;
-      }
-   }
-
-   if (i >= gpFont->nChar)
-   {
-      //
-      // This character does not exist in the font lib.
-      //
-      return;
-   }
-
-   pChar = gpFont->lpBufGlyph + i * 30;
-
-   //
-   // Draw the character to the surface.
-   //
-   y *= lpSurface->pitch;
-   for (i = 0; i < 30; i++)
-   {
-      dx = x + ((i & 1) << 3);
-      for (j = 0; j < 8; j++)
-      {
-         if (pChar[i] & (1 << (7 - j)))
-         {
-            ((LPBYTE)(lpSurface->pixels))[y + dx] = bColor;
-         }
-         dx++;
-      }
-      y += (i & 1) * lpSurface->pitch;
-   }
-}
-
-VOID
-PAL_DrawASCIICharOnSurface(
-   BYTE                     bChar,
-   SDL_Surface             *lpSurface,
-   PAL_POS                  pos,
-   BYTE                     bColor
-)
-/*++
-  Purpose:
-
-    Draw a ASCII character on a surface.
-
-  Parameters:
-
-    [IN]  bChar - the character to be drawn.
-
-    [OUT] lpSurface - the destination surface.
-
-    [IN]  pos - the destination location of the surface.
-
-    [IN]  bColor - the color of the character.
-
-  Return value:
-
-    None.
-
---*/
-{
-   int i, j, dx;
-   int x = PAL_X(pos), y = PAL_Y(pos);
-   LPBYTE pChar = &iso_font[(int)(bChar & ~128) * 15];
-
-   //
-   // Check for NULL pointer.
-   //
-   if (lpSurface == NULL)
-   {
-      return;
-   }
-
-   //
-   // Draw the character to the surface.
-   //
-   y *= lpSurface->pitch;
-   for (i = 0; i < 15; i++)
-   {
-      dx = x;
-      for (j = 0; j < 8; j++)
-      {
-         if (pChar[i] & (1 << j))
-         {
-            ((LPBYTE)(lpSurface->pixels))[y + dx] = bColor;
-         }
-         dx++;
-      }
-      y += lpSurface->pitch;
-   }
-}
-
-#endif

+ 1 - 15
font.h

@@ -34,7 +34,7 @@ extern "C"
 
 INT
 PAL_InitFont(
-   VOID
+   BOOL      fUseEmbeddedFonts
 );
 
 VOID
@@ -50,25 +50,11 @@ PAL_DrawCharOnSurface(
    BYTE                     bColor
 );
 
-#ifdef PAL_UNICODE
-
 INT
 PAL_CharWidth(
    WORD                     wChar
 );
 
-#else
-
-VOID
-PAL_DrawASCIICharOnSurface(
-   BYTE                     bChar,
-   SDL_Surface             *lpSurface,
-   PAL_POS                  pos,
-   BYTE                     bColor
-);
-
-#endif
-
 #ifdef __cplusplus
 }
 #endif

+ 1 - 1
fontglyph.h

@@ -32,7 +32,7 @@ extern "C"
 {
 #endif
 
-static const unsigned char unicode_font[][32] = {
+static unsigned char unicode_font[][32] = {
   { 170,170,0,1,128,0,0,1,128,0,74,81,234,80,90,81,201,158,0,1,128,0,0,1,128,0,0,1,128,0,85,85 },
   { 170,170,0,1,128,0,0,1,128,0,57,147,194,82,50,95,138,82,113,147,128,0,0,1,128,0,0,1,128,0,85,85 },
   { 170,170,0,1,128,0,0,1,128,0,59,165,193,36,49,25,137,36,113,37,128,0,0,1,128,0,0,1,128,0,85,85 },

+ 7 - 6
global.c

@@ -64,14 +64,13 @@ PAL_InitGlobals(
 
 --*/
 {
-#ifdef PAL_UNICODE
    FILE     *fp;
    CODEPAGE  iCodePage = CP_UNKNOWN;
    DWORD     dwWordLength = 10;		// Default for PAL DOS/WIN95
    DWORD     dwExtraMagicDescLines = 0;	// Default for PAL DOS/WIN95
    DWORD     dwExtraItemDescLines = 0;	// Default for PAL DOS/WIN95
    DWORD     dwIsDOS = 1;				// Default for DOS
-#endif
+   DWORD     dwUseEmbeddedFonts = 1;	// Default for using embedded fonts in DOS version
 
    if (gpGlobals == NULL)
    {
@@ -82,7 +81,6 @@ PAL_InitGlobals(
       }
    }
 
-#ifdef PAL_UNICODE
    if (fp = UTIL_OpenFile("sdlpal.cfg"))
    {
 	   PAL_LARGE char buf[512];
@@ -135,6 +133,10 @@ PAL_InitGlobals(
 				   {
 					   sscanf(ptr, "%u", &dwIsDOS);
 				   }
+				   else if (SDL_strcasecmp(p, "USEEMBEDDEDFONTS") == 0)
+				   {
+					   sscanf(ptr, "%u", &dwUseEmbeddedFonts);
+				   }
 			   }
 		   }
 	   }
@@ -183,10 +185,10 @@ PAL_InitGlobals(
 		   iCodePage = CP_BIG5;
 	   }
    }
-#endif
 
    // Choose version
    gpGlobals->fIsWIN95 = dwIsDOS ? FALSE : TRUE;
+   gpGlobals->fUseEmbeddedFonts = dwIsDOS && dwUseEmbeddedFonts ? TRUE : FALSE;
    // Set decompress function
    Decompress = gpGlobals->fIsWIN95 ? YJ2_Decompress : YJ1_Decompress;
 
@@ -204,12 +206,11 @@ PAL_InitGlobals(
 
    gpGlobals->lpObjectDesc = gpGlobals->fIsWIN95 ? NULL : PAL_LoadObjectDesc(va("%s%s", PAL_PREFIX, "desc.dat"));
    gpGlobals->bCurrentSaveSlot = 1;
-#ifdef PAL_UNICODE
+
    gpGlobals->iCodePage = iCodePage;
    gpGlobals->dwWordLength = dwWordLength;
    gpGlobals->dwExtraMagicDescLines = dwExtraMagicDescLines;
    gpGlobals->dwExtraItemDescLines = dwExtraItemDescLines;
-#endif
 
    return 0;
 }

+ 2 - 2
global.h

@@ -592,13 +592,13 @@ typedef struct tagGLOBALVARS
    INVENTORY        rgInventory[MAX_INVENTORY];  // inventory status
    LPOBJECTDESC     lpObjectDesc;
    DWORD            dwFrameNum;
-#ifdef PAL_UNICODE
+
    CODEPAGE         iCodePage;
    DWORD            dwWordLength;
    DWORD            dwExtraMagicDescLines;
    DWORD            dwExtraItemDescLines;
    BOOL             fIsWIN95;
-#endif
+   BOOL             fUseEmbeddedFonts;
 } GLOBALVARS, *LPGLOBALVARS;
 
 extern LPGLOBALVARS gpGlobals;

+ 1 - 31
itemmenu.c

@@ -51,7 +51,6 @@ PAL_ItemSelectMenuUpdate(
    BYTE               bColor;
    static BYTE        bufImage[2048];
    static WORD        wPrevImageIndex = 0xFFFF;
-#ifdef PAL_UNICODE
    const int          iItemsPerLine = 34 / gpGlobals->dwWordLength;
    const int          iItemTextWidth = 8 * gpGlobals->dwWordLength + 20;
    const int          iLinesPerPage = 7 - gpGlobals->dwExtraItemDescLines;
@@ -60,16 +59,6 @@ PAL_ItemSelectMenuUpdate(
    const int          iAmountXOffset = gpGlobals->dwWordLength * 8 + 1;
    const int          iPageLineOffset = (iLinesPerPage + 1) / 2;
    const int          iPictureYOffset = (gpGlobals->dwExtraItemDescLines > 1) ? (gpGlobals->dwExtraItemDescLines - 1) * 16 : 0;
-#else
-   const int          iItemsPerLine = 3;
-   const int          iItemTextWidth = 100;
-   const int          iLinesPerPage = 7;
-   const int          iBoxHeightOffset = 0;
-   const int          iCursorXOffset = 25;
-   const int          iAmountXOffset = 81;
-   const int          iPageLineOffset = 4;
-   const int          iPictureYOffset = 0;
-#endif
 
    //
    // Process input
@@ -244,31 +233,18 @@ PAL_ItemSelectMenuUpdate(
    {
       if (!g_fNoDesc && gpGlobals->lpObjectDesc != NULL)
 	  {
-#     ifdef PAL_UNICODE
          WCHAR szDesc[512], *next;
          const WCHAR *d = PAL_GetObjectDesc(gpGlobals->lpObjectDesc, wObject);
-#     else
-         char szDesc[512], *next;
-         const char *d = PAL_GetObjectDesc(gpGlobals->lpObjectDesc, wObject);
-#     endif
 
          if (d != NULL)
          {
             k = 150;
-#        ifdef PAL_UNICODE
             wcscpy(szDesc, d);
-#        else
-            strcpy(szDesc, d);
-#        endif
             d = szDesc;
 
             while (TRUE)
             {
-#           ifdef PAL_UNICODE
                next = wcschr(d, '*');
-#           else
-               next = strchr(d, '*');
-#           endif
                if (next != NULL)
                {
                   *next++ = '\0';
@@ -297,15 +273,9 @@ PAL_ItemSelectMenuUpdate(
          {
             if (gpGlobals->g.lprgScriptEntry[wScript].wOperation == 0xFFFF)
             {
-#ifdef PAL_UNICODE
-              int line_incr = (gpGlobals->g.lprgScriptEntry[wScript].rgwOperand[1] != 1) ? 1 : 0;
-#endif
+               int line_incr = (gpGlobals->g.lprgScriptEntry[wScript].rgwOperand[1] != 1) ? 1 : 0;
                wScript = PAL_RunAutoScript(wScript, PAL_ITEM_DESC_BOTTOM | line);
-#ifdef PAL_UNICODE
                line += line_incr;
-#else
-               line++;
-#endif
             }
             else
             {

+ 0 - 28
magicmenu.c

@@ -56,21 +56,12 @@ PAL_MagicSelectionMenuUpdate(
    int         i, j, k, line;
    BYTE        bColor;
    WORD        wScript;
-#ifdef PAL_UNICODE
    const int   iItemsPerLine = 32 / gpGlobals->dwWordLength;
    const int   iItemTextWidth = 8 * gpGlobals->dwWordLength + 7;
    const int   iLinesPerPage = 5 - gpGlobals->dwExtraMagicDescLines;
    const int   iBoxYOffset = gpGlobals->dwExtraMagicDescLines * 16;
    const int   iCursorXOffset = gpGlobals->dwWordLength * 5 / 2;
    const int   iPageLineOffset = iLinesPerPage / 2;
-#else
-   const int   iItemsPerLine = 3;
-   const int   iItemTextWidth = 87;
-   const int   iLinesPerPage = 5;
-   const int   iBoxYOffset = 0;
-   const int   iCursorXOffset = 25;
-   const int   iPageLineOffset = 2;
-#endif
 
    //
    // Check for inputs
@@ -144,13 +135,8 @@ PAL_MagicSelectionMenuUpdate(
       }
       else
       {
-#  ifdef PAL_UNICODE
          WCHAR szDesc[512], *next;
          const WCHAR *d = PAL_GetObjectDesc(gpGlobals->lpObjectDesc, rgMagicItem[g_iCurrentItem].wMagic);
-#  else
-         char szDesc[512], *next;
-         const char *d = PAL_GetObjectDesc(gpGlobals->lpObjectDesc, rgMagicItem[g_iCurrentItem].wMagic);
-#  endif
 
          //
          // Draw the magic description.
@@ -158,20 +144,12 @@ PAL_MagicSelectionMenuUpdate(
          if (d != NULL)
          {
             k = 3;
-#     ifdef PAL_UNICODE
 		    wcscpy(szDesc, d);
-#     else
-            strcpy(szDesc, d);
-#     endif
             d = szDesc;
 
             while (TRUE)
             {
-#        ifdef PAL_UNICODE
                next = wcschr(d, '*');
-#        else
-               next = strchr(d, '*');
-#        endif
                if (next != NULL)
                {
                   *next++ = '\0';
@@ -208,15 +186,9 @@ PAL_MagicSelectionMenuUpdate(
       {
          if (gpGlobals->g.lprgScriptEntry[wScript].wOperation == 0xFFFF)
          {
-#ifdef PAL_UNICODE
             int line_incr = (gpGlobals->g.lprgScriptEntry[wScript].rgwOperand[1] != 1) ? 1 : 0;
-#endif
             wScript = PAL_RunAutoScript(wScript, line);
-#ifdef PAL_UNICODE
             line += line_incr;
-#else
-            line++;
-#endif
 	     }
          else
          {

+ 1 - 1
main.c

@@ -115,7 +115,7 @@ PAL_Init(
       TerminateOnError("Could not initialize global data: %d.\n", e);
    }
 
-   e = PAL_InitFont();
+   e = PAL_InitFont(gpGlobals->fUseEmbeddedFonts);
    if (e != 0)
    {
       TerminateOnError("Could not load fonts: %d.\n", e);

+ 0 - 53
script.c

@@ -518,7 +518,6 @@ PAL_AdditionalCredits(
 
 --*/
 {
-#ifdef PAL_UNICODE
    LPCWSTR rgszcps[][CP_MAX] = {
 	   // Traditional Chinese, Simplified Chinese, Japanese
 	   { L"", L"", L"" },
@@ -571,41 +570,6 @@ PAL_AdditionalCredits(
 	  L"   %s",
       NULL
    };
-#else
-   LPCSTR rgszStrings[] = {
-      "SDLPAL (http://sdlpal.codeplex.com/)",
-#  ifdef PAL_CLASSIC
-      "         (\xB8\x67\xA8\xE5\xAF\x53\xA7\x4F\xBD\x67  " __DATE__ ")",
-#  else
-      "                    (" __DATE__ ")",
-#  endif
-      " ",
-      "  (c) 2009-2015, Wei Mingzhi",
-      "      <whistler_wmz@users.sf.net>.",
-#  ifdef __SYMBIAN32__
-      "  Symbian S60 \xB2\xBE\xB4\xD3 (c) 2009, netwan.",
-#  endif
-#  ifdef GPH
-      "  GPH Caanoo & Wiz \xB2\xBE\xB4\xD3 (c) 2011, Rikku2000.",
-#  endif
-#  ifdef GEKKO
-      "  Nintendo WII \xB2\xBE\xB4\xD3 (c) 2012, Rikku2000.",
-#  endif
-#  ifdef DINGOO
-      "  DINGOO & Dingux \xB2\xBE\xB4\xD3 (c) 2011, Rikku2000.",
-#  endif
-#  ifdef ANDROID
-	  "  ANDROID \xB2\xBE\xB4\xD3 (c) 2013, Rikku2000.",
-#  endif
-	  " ",
-      "\xA5\xBB\xB5\x7B\xA6\xA1\xAC\x4F\xA6\xDB\xA5\xD1\xB3\x6E\xC5\xE9\xA1\x41\xAB\xF6\xB7\xD3"
-      " GNU General",
-      "Public License (GPLv3) \xB5\x6F\xA7\x47",
-      " ",
-      "                 ...\xAB\xF6 Enter \xB5\xB2\xA7\xF4",
-      NULL
-   };
-#endif
 
    int        i = 0;
 
@@ -613,13 +577,9 @@ PAL_AdditionalCredits(
 
    for (i = 0; rgszStrings[i]; i++)
    {
-#ifdef PAL_UNICODE
       WCHAR buffer[50];
 	  swprintf(buffer, 50, rgszStrings[i], rgszcps[i][gpGlobals->iCodePage]);
 	  PAL_DrawText(buffer, PAL_XY(25, 20 + i * 16), DESCTEXT_COLOR, TRUE, FALSE);
-#else
-      PAL_DrawText(rgszStrings[i], PAL_XY(25, 20 + i * 16), DESCTEXT_COLOR, TRUE, FALSE);
-#endif
    }
 
    PAL_SetPalette(0, FALSE);
@@ -1472,11 +1432,7 @@ PAL_InterpretInstruction(
       //
       if (gpGlobals->wCollectValue > 0)
       {
-#     ifdef PAL_UNICODE
          WCHAR s[256];
-#     else
-         char s[256];
-#     endif
 
 #ifdef PAL_CLASSIC
          i = RandomLong(1, gpGlobals->wCollectValue);
@@ -1498,13 +1454,8 @@ PAL_InterpretInstruction(
          PAL_AddItemToInventory(gpGlobals->g.lprgStore[0].rgwItems[i], 1);
 
          PAL_StartDialog(kDialogCenterWindow, 0, 0, FALSE);
-#     ifdef PAL_UNICODE
 		 wcscpy(s, PAL_GetWord(42));
 		 wcscat(s, PAL_GetWord(gpGlobals->g.lprgStore[0].rgwItems[i]));
-#     else
-         strcpy(s, PAL_GetWord(42));
-         strcat(s, PAL_GetWord(gpGlobals->g.lprgStore[0].rgwItems[i]));
-#     endif
          PAL_ShowDialogText(s);
       }
       else
@@ -3530,11 +3481,7 @@ begin:
 			   iDescLine = (wEventObjectID & ~PAL_ITEM_DESC_BOTTOM);
 			   if (wEventObjectID & PAL_ITEM_DESC_BOTTOM)
 			   {
-#  ifdef PAL_UNICODE
 				   int YOffset = gpGlobals->dwExtraItemDescLines * 16;
-#  else
-				   int YOffset = 0;
-#  endif
 				   PAL_DrawText(PAL_GetMsg(pScript->rgwOperand[0]), PAL_XY(75, iDescLine * 16 + 150 - YOffset), DESCTEXT_COLOR, TRUE, FALSE);
 			   }
 			   else

+ 2 - 224
text.c

@@ -26,10 +26,6 @@
 
 #include "main.h"
 
-#ifndef PAL_UNICODE
-#define WORD_LENGTH      10
-#endif
-
 #define   FONT_COLOR_DEFAULT        0x4F
 #define   FONT_COLOR_YELLOW         0x2D
 #define   FONT_COLOR_RED            0x1A
@@ -38,7 +34,6 @@
 
 BOOL      g_fUpdatedInBattle      = FALSE;
 
-#ifdef PAL_UNICODE
 #define INCLUDE_CODEPAGE_H
 #include "codepage.h"
 
@@ -48,27 +43,11 @@ static const WCHAR* gc_rgszAdditionalWords[CP_MAX][6] = {
    { L"\x6226\x95D8\x901F\x5EA6", L"\x4E00", L"\x4E8C", L"\x4E09", L"\x56DB", L"\x4E94" },
 };
 static const WCHAR** g_rgszAdditionalWords;
-#else
-static const char g_rgszAdditionalWords[][WORD_LENGTH + 1] = {
-   {0xBE, 0xD4, 0xB0, 0xAB, 0xB3, 0x74, 0xAB, 0xD7, 0x00, 0x00, 0x00}, // Battle Speed
-   {0xA4, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 1
-   {0xA4, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 2
-   {0xA4, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 3
-   {0xA5, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 4
-   {0xA4, 0xAD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 5
-};
-#endif
 
 typedef struct tagTEXTLIB
 {
-#ifdef PAL_UNICODE
    LPWSTR*         lpWordBuf;
    LPWSTR*         lpMsgBuf;
-#else
-   LPBYTE          lpWordBuf;
-   LPBYTE          lpMsgBuf;
-   LPDWORD         lpMsgOffset;
-#endif
 
    int             nWords;
    int             nMsgs;
@@ -110,12 +89,10 @@ PAL_InitText(
 --*/
 {
    FILE       *fpMsg, *fpWord;
-#ifdef PAL_UNICODE
    DWORD      *offsets;
    LPBYTE      temp;
    LPWSTR      tmp;
    int         wlen, wpos;
-#endif
    int         i;
 
    //
@@ -130,46 +107,29 @@ PAL_InitText(
    fseek(fpWord, 0, SEEK_END);
    i = ftell(fpWord);
 
-#ifdef PAL_UNICODE
    //
    // Each word has 10 or 16 bytes
    //
    g_TextLib.nWords = (i + (gpGlobals->dwWordLength - 1)) / gpGlobals->dwWordLength;
-#else
-   //
-   // Each word has 10 bytes
-   //
-   g_TextLib.nWords = (i + (WORD_LENGTH - 1)) / WORD_LENGTH;
-#endif
 
    //
    // Read the words
    //
-#ifdef PAL_UNICODE
    temp = (LPBYTE)malloc(i);
    if (temp == NULL)
-#else
-   g_TextLib.lpWordBuf = (LPBYTE)malloc(i);
-   if (g_TextLib.lpWordBuf == NULL)
-#endif
    {
       fclose(fpWord);
       fclose(fpMsg);
       return -1;
    }
    fseek(fpWord, 0, SEEK_SET);
-#ifdef PAL_UNICODE
    fread(temp, i, 1, fpWord);
-#else
-   fread(g_TextLib.lpWordBuf, i, 1, fpWord);
-#endif
 
    //
    // Close the words file
    //
    fclose(fpWord);
 
-#ifdef PAL_UNICODE
    // Split the words and do code page conversion
    for (i = 0, wlen = 0; i < g_TextLib.nWords; i++)
    {
@@ -191,7 +151,6 @@ PAL_InitText(
 	   wpos += l + 1;
    }
    free(temp);
-#endif
 
    //
    // Read the message offsets. The message offsets are in SSS.MKF #3
@@ -199,25 +158,15 @@ PAL_InitText(
    i = PAL_MKFGetChunkSize(3, gpGlobals->f.fpSSS) / sizeof(DWORD);
    g_TextLib.nMsgs = i - 1;
 
-#ifdef PAL_UNICODE
    offsets = (LPDWORD)malloc(i * sizeof(DWORD));
    if (offsets == NULL)
-#else
-   g_TextLib.lpMsgOffset = (LPDWORD)malloc(i * sizeof(DWORD));
-   if (g_TextLib.lpMsgOffset == NULL)
-#endif
    {
       free(g_TextLib.lpWordBuf);
       fclose(fpMsg);
       return -1;
    }
 
-#ifdef PAL_UNICODE
    PAL_MKFReadChunk((LPBYTE)(offsets), i * sizeof(DWORD), 3, gpGlobals->f.fpSSS);
-#else
-   PAL_MKFReadChunk((LPBYTE)(g_TextLib.lpMsgOffset), i * sizeof(DWORD), 3,
-      gpGlobals->f.fpSSS);
-#endif
 
    //
    // Read the messages.
@@ -225,35 +174,21 @@ PAL_InitText(
    fseek(fpMsg, 0, SEEK_END);
    i = ftell(fpMsg);
 
-#ifdef PAL_UNICODE
    temp = (LPBYTE)malloc(i);
    if (temp == NULL)
-#else
-   g_TextLib.lpMsgBuf = (LPBYTE)malloc(i);
-   if (g_TextLib.lpMsgBuf == NULL)
-#endif
    {
-#ifdef PAL_UNICODE
       free(offsets);
 	  free(g_TextLib.lpWordBuf[0]);
-#else
-      free(g_TextLib.lpMsgOffset);
-#endif
       free(g_TextLib.lpWordBuf);
       fclose(fpMsg);
       return -1;
    }
 
    fseek(fpMsg, 0, SEEK_SET);
-#ifdef PAL_UNICODE
    fread(temp, 1, i, fpMsg);
-#else
-   fread(g_TextLib.lpMsgBuf, 1, i, fpMsg);
-#endif
 
    fclose(fpMsg);
 
-#ifdef PAL_UNICODE
    // Split messages and do code page conversion here
    for (i = 0, wlen = 0; i < g_TextLib.nMsgs; i++)
    {
@@ -273,7 +208,6 @@ PAL_InitText(
    free(offsets);
 
    g_rgszAdditionalWords = gc_rgszAdditionalWords[gpGlobals->iCodePage];
-#endif
 
    g_TextLib.bCurrentFontColor = FONT_COLOR_DEFAULT;
    g_TextLib.bIcon = 0;
@@ -311,34 +245,19 @@ PAL_FreeText(
 {
    if (g_TextLib.lpMsgBuf != NULL)
    {
-#  ifdef PAL_UNICODE
       free(g_TextLib.lpMsgBuf[0]);
-#  endif
       free(g_TextLib.lpMsgBuf);
       g_TextLib.lpMsgBuf = NULL;
    }
-#ifndef PAL_UNICODE
-   if (g_TextLib.lpMsgOffset != NULL)
-   {
-      free(g_TextLib.lpMsgOffset);
-      g_TextLib.lpMsgOffset = NULL;
-   }
-#endif
    if (g_TextLib.lpWordBuf != NULL)
    {
-#  ifdef PAL_UNICODE
       free(g_TextLib.lpWordBuf[0]);
-#  endif
       free(g_TextLib.lpWordBuf);
       g_TextLib.lpWordBuf = NULL;
    }
 }
 
-#ifdef PAL_UNICODE
 LPCWSTR
-#else
-LPCSTR
-#endif
 PAL_GetWord(
    WORD       wNumWord
 )
@@ -357,10 +276,6 @@ PAL_GetWord(
 
 --*/
 {
-#ifndef PAL_UNICODE
-   static char buf[WORD_LENGTH + 1];
-#endif
-
    if (wNumWord >= PAL_ADDITIONAL_WORD_FIRST)
    {
       return g_rgszAdditionalWords[wNumWord - PAL_ADDITIONAL_WORD_FIRST];
@@ -371,31 +286,10 @@ PAL_GetWord(
       return NULL;
    }
 
-#ifdef PAL_UNICODE
    return g_TextLib.lpWordBuf[wNumWord];
-#else
-   memcpy(buf, &g_TextLib.lpWordBuf[wNumWord * WORD_LENGTH], WORD_LENGTH);
-   buf[WORD_LENGTH] = '\0';
-
-   //
-   // Remove the trailing spaces
-   //
-   trim(buf);
-
-   if ((strlen(buf) & 1) != 0 && buf[strlen(buf) - 1] == '1')
-   {
-      buf[strlen(buf) - 1] = '\0';
-   }
-
-   return buf;
-#endif
 }
 
-#ifdef PAL_UNICODE
 LPCWSTR
-#else
-LPCSTR
-#endif
 PAL_GetMsg(
    WORD       wNumMsg
 )
@@ -414,35 +308,12 @@ PAL_GetMsg(
 
 --*/
 {
-#ifdef PAL_UNICODE
-	return (wNumMsg >= g_TextLib.nMsgs) ? NULL : g_TextLib.lpMsgBuf[wNumMsg];
-#else
-   static char    buf[256];
-   DWORD          dwOffset, dwSize;
-
-   if (wNumMsg >= g_TextLib.nMsgs)
-   {
-      return NULL;
-   }
-
-   dwOffset = SWAP32(g_TextLib.lpMsgOffset[wNumMsg]);
-   dwSize = SWAP32(g_TextLib.lpMsgOffset[wNumMsg + 1]) - dwOffset;
-   assert(dwSize < 255);
-
-   memcpy(buf, &g_TextLib.lpMsgBuf[dwOffset], dwSize);
-   buf[dwSize] = '\0';
-
-   return buf;
-#endif
+   return (wNumMsg >= g_TextLib.nMsgs) ? NULL : g_TextLib.lpMsgBuf[wNumMsg];
 }
 
 VOID
 PAL_DrawText(
-#ifdef PAL_UNICODE
    LPCWSTR    lpszText,
-#else
-   LPCSTR     lpszText,
-#endif
    PAL_POS    pos,
    BYTE       bColor,
    BOOL       fShadow,
@@ -472,20 +343,13 @@ PAL_DrawText(
 --*/
 {
    SDL_Rect   rect, urect;
-#ifndef PAL_UNICODE
-   WORD       wChar;
-#endif
 
    rect.x = PAL_X(pos);
    rect.y = PAL_Y(pos);
 
    urect.x = rect.x;
    urect.y = rect.y;
-#if defined(PAL_UNICODE)
-   urect.h = 17;
-#else
-   urect.h = 16;
-#endif
+   urect.h = gpGlobals->fUseEmbeddedFonts ? 16 : 17;
    urect.w = 0;
 
    while (*lpszText)
@@ -493,7 +357,6 @@ PAL_DrawText(
       //
       // Draw the character
       //
-#  ifdef PAL_UNICODE
 	  int char_width = PAL_CharWidth(*lpszText);
 
       if (fShadow)
@@ -505,39 +368,6 @@ PAL_DrawText(
       lpszText++;
 	  rect.x += char_width;
 	  urect.w += char_width;
-#  else
-      if (*lpszText & 0x80)
-      {
-         //
-         // Chinese Character
-         //
-         wChar = SWAP16(((LPBYTE)lpszText)[0] | (((LPBYTE)lpszText)[1] << 8));
-         if (fShadow)
-         {
-            PAL_DrawCharOnSurface(wChar, gpScreen, PAL_XY(rect.x + 1, rect.y + 1), 0);
-            PAL_DrawCharOnSurface(wChar, gpScreen, PAL_XY(rect.x + 1, rect.y), 0);
-         }
-         PAL_DrawCharOnSurface(wChar, gpScreen, PAL_XY(rect.x, rect.y), bColor);
-         lpszText += 2;
-         rect.x += 16;
-         urect.w += 16;
-      }
-      else
-      {
-         //
-         // ASCII character
-         //
-         if (fShadow)
-         {
-            PAL_DrawASCIICharOnSurface(*lpszText, gpScreen, PAL_XY(rect.x + 1, rect.y + 1), 0);
-            PAL_DrawASCIICharOnSurface(*lpszText, gpScreen, PAL_XY(rect.x + 1, rect.y), 0);
-         }
-         PAL_DrawASCIICharOnSurface(*lpszText, gpScreen, PAL_XY(rect.x, rect.y), bColor);
-         lpszText++;
-         rect.x += 8;
-         urect.w += 8;
-      }
-#  endif
    }
 
    //
@@ -802,11 +632,7 @@ PAL_DialogWaitForKey(
 
 VOID
 PAL_ShowDialogText(
-#ifdef PAL_UNICODE
    LPCWSTR      lpszText
-#else
-   LPCSTR       lpszText
-#endif
 )
 /*++
   Purpose:
@@ -824,11 +650,7 @@ PAL_ShowDialogText(
 --*/
 {
    SDL_Rect        rect;
-#ifdef PAL_UNICODE
    int             x, y;
-#else
-   int             x, y, len = strlen(lpszText);
-#endif
 
    PAL_ClearKeyState();
    g_TextLib.bIcon = 0;
@@ -871,12 +693,10 @@ PAL_ShowDialogText(
       {
          PAL_POS    pos;
          LPBOX      lpBox;
-#     ifdef PAL_UNICODE
 		 int        i, w = wcslen(lpszText), len = 0;
 
 		 for (i = 0; i < w; i++)
             len += PAL_CharWidth(lpszText[i]) >> 3;
-#     endif
          //
          // Create the window box
          //
@@ -908,18 +728,10 @@ PAL_ShowDialogText(
    }
    else
    {
-#  ifdef PAL_UNICODE
       int len = wcslen(lpszText);
-#  endif
       if (g_TextLib.nCurrentDialogLine == 0 &&
          g_TextLib.bDialogPosition != kDialogCenter &&
-#  ifdef PAL_UNICODE
 		 (lpszText[len - 1] == 0xff1a ||
-#  else
-         (((BYTE)lpszText[len - 1] == 0x47 && (BYTE)lpszText[len - 2] == 0xA1) ||
-          ((BYTE)lpszText[len - 1] == 0xBA && (BYTE)lpszText[len - 2] == 0xA3) ||
-          ((BYTE)lpszText[len - 1] == 0xC3 && (BYTE)lpszText[len - 2] == 0xA1) ||
-#  endif
 		  lpszText[len - 1] == ':'))
       {
          //
@@ -932,11 +744,7 @@ PAL_ShowDialogText(
          //
          // normal texts
          //
-#     ifdef PAL_UNICODE
          WCHAR text[2];
-#     else
-         char text[3];
-#     endif
 
          if (!g_TextLib.fPlayingRNG && g_TextLib.nCurrentDialogLine == 0)
          {
@@ -998,11 +806,7 @@ PAL_ShowDialogText(
                //
                // Set the delay time of text-displaying
                //
-#           ifdef PAL_UNICODE
                g_TextLib.iDelayTime = wcstol(lpszText + 1, NULL, 10) * 10 / 7;
-#           else
-               g_TextLib.iDelayTime = atoi(lpszText + 1) * 10 / 7;
-#           endif
                lpszText += 3;
                break;
 
@@ -1010,11 +814,7 @@ PAL_ShowDialogText(
                //
                // Delay for a period and quit
                //
-#           ifdef PAL_UNICODE
                UTIL_Delay(wcstol(lpszText + 1, NULL, 10) * 80 / 7);
-#           else
-               UTIL_Delay(atoi(lpszText + 1) * 80 / 7);
-#           endif
 			   g_TextLib.nCurrentDialogLine = 0;
                g_TextLib.fUserSkip = FALSE;
                return; // don't go further
@@ -1039,31 +839,11 @@ PAL_ShowDialogText(
                lpszText++;
 
             default:
-#           ifdef PAL_UNICODE
                text[0] = *lpszText++;
 			   text[1] = 0;
-#           else
-               if (*lpszText & 0x80)
-               {
-                  text[0] = lpszText[0];
-                  text[1] = lpszText[1];
-                  text[2] = '\0';
-                  lpszText += 2;
-               }
-               else
-               {
-                  text[0] = *lpszText;
-                  text[1] = '\0';
-                  lpszText++;
-               }
-#           endif
 
                PAL_DrawText(text, PAL_XY(x, y), g_TextLib.bCurrentFontColor, TRUE, TRUE);
-#           ifdef PAL_UNICODE
 			   x += PAL_CharWidth(text[0]);
-#           else
-               x += ((text[0] & 0x80) ? 16 : 8);
-#           endif
 
                if (!g_TextLib.fUserSkip)
                {
@@ -1199,7 +979,6 @@ PAL_DialogIsPlayingRNG(
    return g_TextLib.fPlayingRNG;
 }
 
-#ifdef PAL_UNICODE
 INT
 PAL_MultiByteToWideChar(
    LPCSTR        mbs,
@@ -1397,4 +1176,3 @@ PAL_GetInvalidChar(
    default:          return 0;
    }
 }
-#endif

+ 0 - 18
text.h

@@ -44,31 +44,19 @@ PAL_FreeText(
    VOID
 );
 
-#ifdef PAL_UNICODE
 LPCWSTR
-#else
-LPCSTR
-#endif
 PAL_GetWord(
    WORD       wNumWord
 );
 
-#ifdef PAL_UNICODE
 LPCWSTR
-#else
-LPCSTR
-#endif
 PAL_GetMsg(
    WORD       wNumMsg
 );
 
 VOID
 PAL_DrawText(
-#ifdef PAL_UNICODE
    LPCWSTR    lpszText,
-#else
-   LPCSTR     lpszText,
-#endif
    PAL_POS    pos,
    BYTE       bColor,
    BOOL       fShadow,
@@ -90,11 +78,7 @@ PAL_StartDialog(
 
 VOID
 PAL_ShowDialogText(
-#ifdef PAL_UNICODE
    LPCWSTR    lpszText
-#else
-   LPCSTR     lpszText
-#endif
 );
 
 VOID
@@ -117,7 +101,6 @@ PAL_DialogIsPlayingRNG(
    VOID
 );
 
-#ifdef PAL_UNICODE
 INT
 PAL_MultiByteToWideChar(
    LPCSTR        mbs,
@@ -130,6 +113,5 @@ WCHAR
 PAL_GetInvalidChar(
    CODEPAGE      iCodePage
 );
-#endif
 
 #endif

+ 1 - 14
ui.c

@@ -826,31 +826,22 @@ PAL_LoadObjectDesc(
    //
    while (fgets(buf, 512, fp) != NULL)
    {
-#  ifdef PAL_UNICODE
       int wlen;
-#  endif
       p = strchr(buf, '=');
       if (p == NULL)
       {
          continue;
       }
 
-      *p = '\0';
-      p++;
-#  ifdef PAL_UNICODE
+      *p++ = '\0';
 	  wlen = PAL_MultiByteToWideChar(p, -1, NULL, 0);
-#  endif
 
       pNew = UTIL_calloc(1, sizeof(OBJECTDESC));
 
       sscanf(buf, "%x", &i);
       pNew->wObjectID = i;
-#  ifdef PAL_UNICODE
 	  pNew->lpDesc = (LPWSTR)malloc(wlen * sizeof(WCHAR));
 	  PAL_MultiByteToWideChar(p, -1, pNew->lpDesc, wlen);
-#  else
-      pNew->lpDesc = strdup(p);
-#  endif
 
       pNew->next = lpDesc;
       lpDesc = pNew;
@@ -890,11 +881,7 @@ PAL_FreeObjectDesc(
    }
 }
 
-#ifdef PAL_UNICODE
 LPCWSTR
-#else
-LPCSTR
-#endif
 PAL_GetObjectDesc(
    LPOBJECTDESC   lpObjectDesc,
    WORD           wObjectID

+ 0 - 8
ui.h

@@ -140,11 +140,7 @@ typedef struct tagMENUITEM
 typedef struct tagOBJECTDESC
 {
    WORD                        wObjectID;
-#ifdef PAL_UNICODE
    LPWSTR                      lpDesc;
-#else
-   LPSTR                       lpDesc;
-#endif
    struct tagOBJECTDESC       *next;
 } OBJECTDESC, *LPOBJECTDESC;
 
@@ -242,11 +238,7 @@ PAL_FreeObjectDesc(
    LPOBJECTDESC    lpObjectDesc
 );
 
-#  ifdef PAL_UNICODE
 LPCWSTR
-#  else
-LPCSTR
-#  endif
 PAL_GetObjectDesc(
    LPOBJECTDESC   lpObjectDesc,
    WORD           wObjectID

+ 0 - 20
uibattle.c

@@ -546,11 +546,7 @@ PAL_BattleUIMiscItemSubMenuUpdate(
 
 VOID
 PAL_BattleUIShowText(
-#ifdef PAL_UNICODE
    LPCWSTR       lpszText,
-#else
-   LPCSTR        lpszText,
-#endif
    WORD          wDuration
 )
 /*++
@@ -572,20 +568,12 @@ PAL_BattleUIShowText(
 {
    if (SDL_GetTicks() < g_Battle.UI.dwMsgShowTime)
    {
-#  ifdef PAL_UNICODE
       wcscpy(g_Battle.UI.szNextMsg, lpszText);
-#  else
-      strcpy(g_Battle.UI.szNextMsg, lpszText);
-#  endif
       g_Battle.UI.wNextMsgDuration = wDuration;
    }
    else
    {
-#  ifdef PAL_UNICODE
       wcscpy(g_Battle.UI.szMsg, lpszText);
-#  else
-      strcpy(g_Battle.UI.szMsg, lpszText);
-#  endif
       g_Battle.UI.dwMsgShowTime = SDL_GetTicks() + wDuration;
    }
 }
@@ -1705,14 +1693,10 @@ end:
       // The text should be shown in a small window at the center of the screen
       //
       PAL_POS    pos;
-#  ifdef PAL_UNICODE
 	  int        i, w = wcslen(g_Battle.UI.szMsg), len = 0;
 
 	  for (i = 0; i < w; i++)
 		  len += PAL_CharWidth(g_Battle.UI.szMsg[i]) >> 3;
-#  else
-      int        len = strlen(g_Battle.UI.szMsg);
-#  endif
 
       //
       // Create the window box
@@ -1728,11 +1712,7 @@ end:
    }
    else if (g_Battle.UI.szNextMsg[0] != '\0')
    {
-#  ifdef PAL_UNICODE
       wcscpy(g_Battle.UI.szMsg, g_Battle.UI.szNextMsg);
-#  else
-      strcpy(g_Battle.UI.szMsg, g_Battle.UI.szNextMsg);
-#  endif
       g_Battle.UI.dwMsgShowTime = SDL_GetTicks() + g_Battle.UI.wNextMsgDuration;
       g_Battle.UI.szNextMsg[0] = '\0';
    }

+ 0 - 9
uibattle.h

@@ -99,13 +99,8 @@ typedef struct tagBATTLEUI
    BATTLEUISTATE    state;
    BATTLEMENUSTATE  MenuState;
 
-#ifdef PAL_UNICODE
    WCHAR            szMsg[256];           // message to be shown on the screen
    WCHAR            szNextMsg[256];       // next message to be shown on the screen
-#else
-   CHAR             szMsg[256];           // message to be shown on the screen
-   CHAR             szNextMsg[256];       // next message to be shown on the screen
-#endif
    DWORD            dwMsgShowTime;        // the end time of showing the message
    WORD             wNextMsgDuration;     // duration of the next message
 
@@ -133,11 +128,7 @@ PAL_PlayerInfoBox(
 
 VOID
 PAL_BattleUIShowText(
-#ifdef PAL_UNICODE
    LPCWSTR       lpszText,
-#else
-   LPCSTR        lpszText,
-#endif
    WORD          wDuration
 );
 

+ 0 - 2
uigame.c

@@ -1185,7 +1185,6 @@ PAL_PlayerStatus(
          //
          // Draw the text label
          //
-#ifdef PAL_UNICODE
          offset = PAL_WordWidth(w) * 16;
          if (rgEquipPos[i][0] + offset + 5 > 320)
          {
@@ -1195,7 +1194,6 @@ PAL_PlayerStatus(
          {
             offset = 0;
          }
-#endif
          PAL_DrawText(PAL_GetWord(w),
             PAL_XY(rgEquipPos[i][0] + offset + 5, rgEquipPos[i][1] + 38), STATUS_COLOR_EQUIPMENT, TRUE, FALSE);
       }

+ 0 - 4
video.c

@@ -206,7 +206,6 @@ VIDEO_Init(
       VIDEO_SetPalette(palette);
       p = gpScreen;
       gpScreen = gpScreenBak;
-#  ifdef PAL_UNICODE
 	  switch(gpGlobals->iCodePage)
 	  {
 	  case CP_BIG5:
@@ -219,9 +218,6 @@ VIDEO_Init(
 		  PAL_DrawText(L"Press Back again to end", PAL_XY(30, 30), 1, FALSE, FALSE);	// TODO: Japanese string
 		  break;
 	  }
-#  else
-      PAL_DrawText("\xA6\x41\xA6\xB8\xAB\xF6 Back \xB5\xB2\xA7\xF4", PAL_XY(30, 30), 1, FALSE, FALSE);
-#  endif
       gpScreen = p;
       gpBackKeyMessage = SDL_CreateTextureFromSurface(gpRenderer, gpScreenBak);
       SDL_FillRect(gpScreenBak, NULL, 0);