text.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. PAL_C_LINKAGE_BEGIN
  33. typedef struct tagTEXTLIB
  34. {
  35. LPWSTR *lpWordBuf;
  36. LPWSTR *lpMsgBuf;
  37. int **lpIndexBuf;
  38. BOOL fUseISOFont;
  39. int nWords;
  40. int nMsgs;
  41. int nIndices;
  42. int nCurrentDialogLine;
  43. BYTE bCurrentFontColor;
  44. PAL_POS posIcon;
  45. PAL_POS posDialogTitle;
  46. PAL_POS posDialogText;
  47. BYTE bDialogPosition;
  48. BYTE bIcon;
  49. int iDelayTime;
  50. BOOL fUserSkip;
  51. BOOL fPlayingRNG;
  52. BYTE bufDialogIcons[282];
  53. } TEXTLIB, *LPTEXTLIB;
  54. extern TEXTLIB g_TextLib;
  55. extern LPWSTR g_rcCredits[12];
  56. INT
  57. PAL_InitText(
  58. VOID
  59. );
  60. VOID
  61. PAL_FreeText(
  62. VOID
  63. );
  64. LPCWSTR
  65. PAL_GetWord(
  66. int iNumWord
  67. );
  68. LPCWSTR
  69. PAL_GetMsg(
  70. int iNumMsg
  71. );
  72. int
  73. PAL_GetMsgNum(
  74. int iIndex,
  75. int iOrder
  76. );
  77. VOID
  78. PAL_DrawText(
  79. LPCWSTR lpszText,
  80. PAL_POS pos,
  81. BYTE bColor,
  82. BOOL fShadow,
  83. BOOL fUpdate,
  84. BOOL fUse8x8Font
  85. );
  86. VOID
  87. PAL_DialogSetDelayTime(
  88. INT iDelayTime
  89. );
  90. VOID
  91. PAL_StartDialog(
  92. BYTE bDialogLocation,
  93. BYTE bFontColor,
  94. INT iNumCharFace,
  95. BOOL fPlayingRNG
  96. );
  97. VOID
  98. PAL_ShowDialogText(
  99. LPCWSTR lpszText
  100. );
  101. VOID
  102. PAL_ClearDialog(
  103. BOOL fWaitForKey
  104. );
  105. VOID
  106. PAL_EndDialog(
  107. VOID
  108. );
  109. BOOL
  110. PAL_IsInDialog(
  111. VOID
  112. );
  113. BOOL
  114. PAL_DialogIsPlayingRNG(
  115. VOID
  116. );
  117. INT
  118. PAL_MultiByteToWideChar(
  119. LPCSTR mbs,
  120. int mbslength,
  121. LPWSTR wcs,
  122. int wcslength
  123. );
  124. INT
  125. PAL_MultiByteToWideCharCP(
  126. CODEPAGE cp,
  127. LPCSTR mbs,
  128. int mbslength,
  129. LPWSTR wcs,
  130. int wcslength
  131. );
  132. WCHAR
  133. PAL_GetInvalidChar(
  134. CODEPAGE uCodePage
  135. );
  136. CODEPAGE
  137. PAL_GetCodePage(
  138. void
  139. );
  140. void
  141. PAL_SetCodePage(
  142. CODEPAGE uCodePage
  143. );
  144. CODEPAGE
  145. PAL_DetectCodePageForString(
  146. const char * text,
  147. int text_len,
  148. CODEPAGE default_cp,
  149. int * probability
  150. );
  151. INT
  152. PAL_swprintf(
  153. LPWSTR buffer,
  154. size_t count,
  155. LPCWSTR format,
  156. ...
  157. );
  158. PAL_C_LINKAGE_END
  159. #endif