text.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 4; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009-2011, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // Copyright (c) 2011-2017, SDLPAL development team.
  5. // All rights reserved.
  6. //
  7. // This file is part of SDLPAL.
  8. //
  9. // SDLPAL is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation, either version 3 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. //
  22. #ifndef _TEXT_H
  23. #define _TEXT_H
  24. #include "common.h"
  25. typedef enum tagDIALOGPOSITION
  26. {
  27. kDialogUpper = 0,
  28. kDialogCenter,
  29. kDialogLower,
  30. kDialogCenterWindow
  31. } DIALOGLOCATION;
  32. typedef enum tagFONTFLAVOR
  33. {
  34. kFontFlavorAuto = 0,
  35. kFontFlavorUnifont,
  36. kFontFlavorSimpChin,
  37. kFontFlavorTradChin,
  38. kFontFlavorJapanese,
  39. } FONTFLAVOR;
  40. PAL_C_LINKAGE_BEGIN
  41. typedef struct tagTEXTLIB
  42. {
  43. LPWSTR *lpWordBuf;
  44. LPWSTR *lpMsgBuf;
  45. int **lpIndexBuf;
  46. BOOL fUseISOFont;
  47. int iFontFlavor;
  48. int nWords;
  49. int nMsgs;
  50. int nIndices;
  51. int nCurrentDialogLine;
  52. BYTE bCurrentFontColor;
  53. PAL_POS posIcon;
  54. PAL_POS posDialogTitle;
  55. PAL_POS posDialogText;
  56. BYTE bDialogPosition;
  57. BYTE bIcon;
  58. int iDelayTime;
  59. BOOL fUserSkip;
  60. BOOL fPlayingRNG;
  61. BYTE bufDialogIcons[282];
  62. } TEXTLIB, *LPTEXTLIB;
  63. extern TEXTLIB g_TextLib;
  64. extern LPWSTR g_rcCredits[12];
  65. INT
  66. PAL_InitText(
  67. VOID
  68. );
  69. VOID
  70. PAL_FreeText(
  71. VOID
  72. );
  73. LPCWSTR
  74. PAL_GetWord(
  75. int iNumWord
  76. );
  77. LPCWSTR
  78. PAL_GetMsg(
  79. int iNumMsg
  80. );
  81. int
  82. PAL_GetMsgNum(
  83. int iIndex,
  84. int iOrder
  85. );
  86. VOID
  87. PAL_DrawText(
  88. LPCWSTR lpszText,
  89. PAL_POS pos,
  90. BYTE bColor,
  91. BOOL fShadow,
  92. BOOL fUpdate,
  93. BOOL fUse8x8Font
  94. );
  95. VOID
  96. PAL_DialogSetDelayTime(
  97. INT iDelayTime
  98. );
  99. VOID
  100. PAL_StartDialog(
  101. BYTE bDialogLocation,
  102. BYTE bFontColor,
  103. INT iNumCharFace,
  104. BOOL fPlayingRNG
  105. );
  106. VOID
  107. PAL_ShowDialogText(
  108. LPCWSTR lpszText
  109. );
  110. VOID
  111. PAL_ClearDialog(
  112. BOOL fWaitForKey
  113. );
  114. VOID
  115. PAL_EndDialog(
  116. VOID
  117. );
  118. BOOL
  119. PAL_IsInDialog(
  120. VOID
  121. );
  122. BOOL
  123. PAL_DialogIsPlayingRNG(
  124. VOID
  125. );
  126. INT
  127. PAL_MultiByteToWideChar(
  128. LPCSTR mbs,
  129. int mbslength,
  130. LPWSTR wcs,
  131. int wcslength
  132. );
  133. INT
  134. PAL_MultiByteToWideCharCP(
  135. CODEPAGE cp,
  136. LPCSTR mbs,
  137. int mbslength,
  138. LPWSTR wcs,
  139. int wcslength
  140. );
  141. WCHAR
  142. PAL_GetInvalidChar(
  143. CODEPAGE uCodePage
  144. );
  145. CODEPAGE
  146. PAL_GetCodePage(
  147. void
  148. );
  149. void
  150. PAL_SetCodePage(
  151. CODEPAGE uCodePage
  152. );
  153. CODEPAGE
  154. PAL_DetectCodePageForString(
  155. const char * text,
  156. int text_len,
  157. CODEPAGE default_cp,
  158. int * probability
  159. );
  160. INT
  161. PAL_swprintf(
  162. LPWSTR buffer,
  163. size_t count,
  164. LPCWSTR format,
  165. ...
  166. );
  167. PAL_C_LINKAGE_END
  168. #endif