ui.h 6.0 KB

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