ui.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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 UI_H
  23. #define UI_H
  24. #include "common.h"
  25. #define CHUNKNUM_SPRITEUI 9
  26. #define MENUITEM_COLOR 0x4F
  27. #define MENUITEM_COLOR_INACTIVE 0x1C
  28. #define MENUITEM_COLOR_CONFIRMED 0x2C
  29. #define MENUITEM_COLOR_SELECTED_INACTIVE 0x1F
  30. #define MENUITEM_COLOR_SELECTED_FIRST 0xF9
  31. #define MENUITEM_COLOR_SELECTED_TOTALNUM 6
  32. #define MENUITEM_COLOR_SELECTED \
  33. (MENUITEM_COLOR_SELECTED_FIRST + \
  34. SDL_GetTicks() / (600 / MENUITEM_COLOR_SELECTED_TOTALNUM) \
  35. % MENUITEM_COLOR_SELECTED_TOTALNUM)
  36. #define MENUITEM_COLOR_EQUIPPEDITEM 0xC8
  37. #define DESCTEXT_COLOR 0x2E
  38. #define MAINMENU_BACKGROUND_FBPNUM (gConfig.fIsWIN95 ? 2 :60)
  39. #define RIX_NUM_OPENINGMENU 4
  40. #define MAINMENU_LABEL_NEWGAME 7
  41. #define MAINMENU_LABEL_LOADGAME 8
  42. #define LOADMENU_LABEL_SLOT_FIRST 43
  43. #define CONFIRMMENU_LABEL_NO 19
  44. #define CONFIRMMENU_LABEL_YES 20
  45. #define CASH_LABEL 21
  46. #define SWITCHMENU_LABEL_DISABLE 17
  47. #define SWITCHMENU_LABEL_ENABLE 18
  48. #define GAMEMENU_LABEL_STATUS 3
  49. #define GAMEMENU_LABEL_MAGIC 4
  50. #define GAMEMENU_LABEL_INVENTORY 5
  51. #define GAMEMENU_LABEL_SYSTEM 6
  52. #define SYSMENU_LABEL_SAVE 11
  53. #define SYSMENU_LABEL_LOAD 12
  54. #define SYSMENU_LABEL_MUSIC 13
  55. #define SYSMENU_LABEL_SOUND 14
  56. #define SYSMENU_LABEL_QUIT 15
  57. #define SYSMENU_LABEL_BATTLEMODE 606
  58. #define SYSMENU_LABEL_LAUNCHSETTING 612
  59. #define BATTLESPEEDMENU_LABEL_1 (SYSMENU_LABEL_BATTLEMODE + 1)
  60. #define BATTLESPEEDMENU_LABEL_2 (SYSMENU_LABEL_BATTLEMODE + 2)
  61. #define BATTLESPEEDMENU_LABEL_3 (SYSMENU_LABEL_BATTLEMODE + 3)
  62. #define BATTLESPEEDMENU_LABEL_4 (SYSMENU_LABEL_BATTLEMODE + 4)
  63. #define BATTLESPEEDMENU_LABEL_5 (SYSMENU_LABEL_BATTLEMODE + 5)
  64. #define INVMENU_LABEL_USE 23
  65. #define INVMENU_LABEL_EQUIP 22
  66. #define STATUS_BACKGROUND_FBPNUM 0
  67. #define STATUS_LABEL_EXP 2
  68. #define STATUS_LABEL_LEVEL 48
  69. #define STATUS_LABEL_HP 49
  70. #define STATUS_LABEL_MP 50
  71. #define STATUS_LABEL_EXP_LAYOUT 29
  72. #define STATUS_LABEL_LEVEL_LAYOUT 30
  73. #define STATUS_LABEL_HP_LAYOUT 31
  74. #define STATUS_LABEL_MP_LAYOUT 32
  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 600
  82. #define EQUIP_LABEL_SHOULDER 601
  83. #define EQUIP_LABEL_BODY 602
  84. #define EQUIP_LABEL_HAND 603
  85. #define EQUIP_LABEL_FOOT 604
  86. #define EQUIP_LABEL_NECK 605
  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 0xBB
  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 const MENUITEM* LPCMENUITEM;
  119. typedef struct tagOBJECTDESC
  120. {
  121. WORD wObjectID;
  122. LPWSTR lpDesc;
  123. struct tagOBJECTDESC *next;
  124. } OBJECTDESC, *LPOBJECTDESC;
  125. typedef VOID (*LPITEMCHANGED_CALLBACK)(WORD);
  126. #define MENUITEM_VALUE_CANCELLED 0xFFFF
  127. typedef enum tagNUMCOLOR
  128. {
  129. kNumColorYellow,
  130. kNumColorBlue,
  131. kNumColorCyan
  132. } NUMCOLOR;
  133. typedef enum tagNUMALIGN
  134. {
  135. kNumAlignLeft,
  136. kNumAlignMid,
  137. kNumAlignRight
  138. } NUMALIGN;
  139. PAL_C_LINKAGE_BEGIN
  140. INT
  141. PAL_InitUI(
  142. VOID
  143. );
  144. VOID
  145. PAL_FreeUI(
  146. VOID
  147. );
  148. LPBOX
  149. PAL_CreateBox(
  150. PAL_POS pos,
  151. INT nRows,
  152. INT nColumns,
  153. INT iStyle,
  154. BOOL fSaveScreen
  155. );
  156. LPBOX
  157. PAL_CreateBoxWithShadow(
  158. PAL_POS pos,
  159. INT nRows,
  160. INT nColumns,
  161. INT iStyle,
  162. BOOL fSaveScreen,
  163. INT nShadowOffset
  164. );
  165. LPBOX
  166. PAL_CreateSingleLineBox(
  167. PAL_POS pos,
  168. INT nLen,
  169. BOOL fSaveScreen
  170. );
  171. LPBOX
  172. PAL_CreateSingleLineBoxWithShadow(
  173. PAL_POS pos,
  174. INT nLen,
  175. BOOL fSaveScreen,
  176. INT nShadowOffset
  177. );
  178. VOID
  179. PAL_DeleteBox(
  180. LPBOX lpBox
  181. );
  182. WORD
  183. PAL_ReadMenu(
  184. LPITEMCHANGED_CALLBACK lpfnMenuItemChanged,
  185. LPCMENUITEM rgMenuItem,
  186. INT nMenuItem,
  187. WORD wDefaultItem,
  188. BYTE bLabelColor
  189. );
  190. VOID
  191. PAL_DrawNumber(
  192. UINT iNum,
  193. UINT nLength,
  194. PAL_POS pos,
  195. NUMCOLOR color,
  196. NUMALIGN align
  197. );
  198. INT
  199. PAL_TextWidth(
  200. LPCWSTR lpszItemText
  201. );
  202. INT
  203. PAL_MenuTextMaxWidth(
  204. LPCMENUITEM rgMenuItem,
  205. INT nMenuItem
  206. );
  207. INT
  208. PAL_WordMaxWidth(
  209. INT nFirstWord,
  210. INT nWordNum
  211. );
  212. INT
  213. PAL_WordWidth(
  214. INT nWordIndex
  215. );
  216. LPOBJECTDESC
  217. PAL_LoadObjectDesc(
  218. LPCSTR lpszFileName
  219. );
  220. VOID
  221. PAL_FreeObjectDesc(
  222. LPOBJECTDESC lpObjectDesc
  223. );
  224. LPCWSTR
  225. PAL_GetObjectDesc(
  226. LPOBJECTDESC lpObjectDesc,
  227. WORD wObjectID
  228. );
  229. extern LPSPRITE gpSpriteUI;
  230. PAL_C_LINKAGE_END
  231. #endif