ui.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 3; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // All rights reserved.
  5. //
  6. // This file is part of SDLPAL.
  7. //
  8. // SDLPAL is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. // Modified by Lou Yihua <louyihua@21cn.com> with Unicode support, 2015
  22. //
  23. #ifndef UI_H
  24. #define UI_H
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. #include "common.h"
  30. #define CHUNKNUM_SPRITEUI 9
  31. #define MENUITEM_COLOR 0x4F
  32. #define MENUITEM_COLOR_INACTIVE 0x1C
  33. #define MENUITEM_COLOR_CONFIRMED 0x2C
  34. #define MENUITEM_COLOR_SELECTED_INACTIVE 0x1F
  35. #define MENUITEM_COLOR_SELECTED_FIRST 0xF9
  36. #define MENUITEM_COLOR_SELECTED_TOTALNUM 6
  37. #define MENUITEM_COLOR_SELECTED \
  38. (MENUITEM_COLOR_SELECTED_FIRST + \
  39. SDL_GetTicks() / (600 / MENUITEM_COLOR_SELECTED_TOTALNUM) \
  40. % MENUITEM_COLOR_SELECTED_TOTALNUM)
  41. #define MENUITEM_COLOR_EQUIPPEDITEM 0xC8
  42. #define DESCTEXT_COLOR 0x2E
  43. #define MAINMENU_BACKGROUND_FBPNUM (gConfig.fIsWIN95 ? 2 :60)
  44. #define RIX_NUM_OPENINGMENU 4
  45. #define MAINMENU_LABEL_NEWGAME 7
  46. #define MAINMENU_LABEL_LOADGAME 8
  47. #define LOADMENU_LABEL_SLOT_FIRST 43
  48. #define CONFIRMMENU_LABEL_NO 19
  49. #define CONFIRMMENU_LABEL_YES 20
  50. #define CASH_LABEL 21
  51. #define SWITCHMENU_LABEL_DISABLE 17
  52. #define SWITCHMENU_LABEL_ENABLE 18
  53. #define GAMEMENU_LABEL_STATUS 3
  54. #define GAMEMENU_LABEL_MAGIC 4
  55. #define GAMEMENU_LABEL_INVENTORY 5
  56. #define GAMEMENU_LABEL_SYSTEM 6
  57. #define SYSMENU_LABEL_SAVE 11
  58. #define SYSMENU_LABEL_LOAD 12
  59. #define SYSMENU_LABEL_MUSIC 13
  60. #define SYSMENU_LABEL_SOUND 14
  61. #define SYSMENU_LABEL_QUIT 15
  62. #define SYSMENU_LABEL_BATTLEMODE (PAL_ADDITIONAL_WORD_LAST)
  63. #define BATTLESPEEDMENU_LABEL_1 (PAL_ADDITIONAL_WORD_FIRST + 1)
  64. #define BATTLESPEEDMENU_LABEL_2 (PAL_ADDITIONAL_WORD_FIRST + 2)
  65. #define BATTLESPEEDMENU_LABEL_3 (PAL_ADDITIONAL_WORD_FIRST + 3)
  66. #define BATTLESPEEDMENU_LABEL_4 (PAL_ADDITIONAL_WORD_FIRST + 4)
  67. #define BATTLESPEEDMENU_LABEL_5 (PAL_ADDITIONAL_WORD_FIRST + 5)
  68. #define INVMENU_LABEL_USE 23
  69. #define INVMENU_LABEL_EQUIP 22
  70. #define STATUS_BACKGROUND_FBPNUM 0
  71. #define STATUS_LABEL_EXP 2
  72. #define STATUS_LABEL_LEVEL 48
  73. #define STATUS_LABEL_HP 49
  74. #define STATUS_LABEL_MP 50
  75. #define STATUS_LABEL_ATTACKPOWER 51
  76. #define STATUS_LABEL_MAGICPOWER 52
  77. #define STATUS_LABEL_RESISTANCE 53
  78. #define STATUS_LABEL_DEXTERITY 54
  79. #define STATUS_LABEL_FLEERATE 55
  80. #define STATUS_COLOR_EQUIPMENT 0xBE
  81. #define EQUIP_LABEL_HEAD 566
  82. #define EQUIP_LABEL_SHOULDER 567
  83. #define EQUIP_LABEL_BODY 568
  84. #define EQUIP_LABEL_HAND 569
  85. #define EQUIP_LABEL_FOOT 570
  86. #define EQUIP_LABEL_NECK 571
  87. #define BUYMENU_LABEL_CURRENT 35
  88. #define SELLMENU_LABEL_PRICE 25
  89. #define SPRITENUM_SLASH 39
  90. #define SPRITENUM_ITEMBOX 70
  91. #define SPRITENUM_CURSOR_YELLOW 68
  92. #define SPRITENUM_CURSOR 69
  93. #define SPRITENUM_PLAYERINFOBOX 18
  94. #define SPRITENUM_PLAYERFACE_FIRST 48
  95. #define EQUIPMENU_BACKGROUND_FBPNUM 1
  96. #define ITEMUSEMENU_COLOR_STATLABEL 0xBB
  97. #define BATTLEWIN_GETEXP_LABEL 30
  98. #define BATTLEWIN_BEATENEMY_LABEL 9
  99. #define BATTLEWIN_DOLLAR_LABEL 10
  100. #define BATTLEWIN_LEVELUP_LABEL 32
  101. #define BATTLEWIN_ADDMAGIC_LABEL 33
  102. #define BATTLEWIN_LEVELUP_LABEL_COLOR 0x39
  103. #define SPRITENUM_ARROW 47
  104. #define BATTLE_LABEL_ESCAPEFAIL 31
  105. typedef struct tagBOX
  106. {
  107. PAL_POS pos;
  108. WORD wWidth, wHeight;
  109. SDL_Surface *lpSavedArea;
  110. } BOX, *LPBOX;
  111. typedef struct tagMENUITEM
  112. {
  113. WORD wValue;
  114. WORD wNumWord;
  115. BOOL fEnabled;
  116. PAL_POS pos;
  117. } MENUITEM, *LPMENUITEM;
  118. typedef struct tagOBJECTDESC
  119. {
  120. WORD wObjectID;
  121. LPWSTR lpDesc;
  122. struct tagOBJECTDESC *next;
  123. } OBJECTDESC, *LPOBJECTDESC;
  124. typedef VOID (*LPITEMCHANGED_CALLBACK)(WORD);
  125. #define MENUITEM_VALUE_CANCELLED 0xFFFF
  126. typedef enum tagNUMCOLOR
  127. {
  128. kNumColorYellow,
  129. kNumColorBlue,
  130. kNumColorCyan
  131. } NUMCOLOR;
  132. typedef enum tagNUMALIGN
  133. {
  134. kNumAlignLeft,
  135. kNumAlignMid,
  136. kNumAlignRight
  137. } NUMALIGN;
  138. INT
  139. PAL_InitUI(
  140. VOID
  141. );
  142. VOID
  143. PAL_FreeUI(
  144. VOID
  145. );
  146. LPBOX
  147. PAL_CreateBox(
  148. PAL_POS pos,
  149. INT nRows,
  150. INT nColumns,
  151. INT iStyle,
  152. BOOL fSaveScreen
  153. );
  154. LPBOX
  155. PAL_CreateSingleLineBox(
  156. PAL_POS pos,
  157. INT nLen,
  158. BOOL fSaveScreen
  159. );
  160. VOID
  161. PAL_DeleteBox(
  162. LPBOX lpBox
  163. );
  164. WORD
  165. PAL_ReadMenu(
  166. LPITEMCHANGED_CALLBACK lpfnMenuItemChanged,
  167. LPMENUITEM rgMenuItem,
  168. INT nMenuItem,
  169. WORD wDefaultItem,
  170. BYTE bLabelColor
  171. );
  172. VOID
  173. PAL_DrawNumber(
  174. UINT iNum,
  175. UINT nLength,
  176. PAL_POS pos,
  177. NUMCOLOR color,
  178. NUMALIGN align
  179. );
  180. INT
  181. PAL_MenuTextMaxWidth(
  182. LPMENUITEM rgMenuItem,
  183. INT nMenuItem
  184. );
  185. INT
  186. PAL_WordMaxWidth(
  187. INT nFirstWord,
  188. INT nWordNum
  189. );
  190. INT
  191. PAL_WordWidth(
  192. INT nWordIndex
  193. );
  194. LPOBJECTDESC
  195. PAL_LoadObjectDesc(
  196. LPCSTR lpszFileName
  197. );
  198. VOID
  199. PAL_FreeObjectDesc(
  200. LPOBJECTDESC lpObjectDesc
  201. );
  202. LPCWSTR
  203. PAL_GetObjectDesc(
  204. LPOBJECTDESC lpObjectDesc,
  205. WORD wObjectID
  206. );
  207. extern LPSPRITE gpSpriteUI;
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. #endif