ui.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. #ifndef UI_H
  22. #define UI_H
  23. #ifdef __cplusplus
  24. extern "C"
  25. {
  26. #endif
  27. #include "common.h"
  28. #define CHUNKNUM_SPRITEUI 9
  29. #define MENUITEM_COLOR 0x4F
  30. #define MENUITEM_COLOR_INACTIVE 0x1C
  31. #define MENUITEM_COLOR_CONFIRMED 0x2C
  32. #define MENUITEM_COLOR_SELECTED_INACTIVE 0x1F
  33. #define MENUITEM_COLOR_SELECTED_FIRST 0xF9
  34. #define MENUITEM_COLOR_SELECTED_TOTALNUM 6
  35. #define MENUITEM_COLOR_SELECTED \
  36. (MENUITEM_COLOR_SELECTED_FIRST + \
  37. SDL_GetTicks() / (600 / MENUITEM_COLOR_SELECTED_TOTALNUM) \
  38. % MENUITEM_COLOR_SELECTED_TOTALNUM)
  39. #define MENUITEM_COLOR_EQUIPPEDITEM 0xC8
  40. #define DESCTEXT_COLOR 0x2E
  41. #define MAINMENU_BACKGROUND_FBPNUM 60
  42. #define RIX_NUM_OPENINGMENU 4
  43. #define MAINMENU_LABEL_NEWGAME 7
  44. #define MAINMENU_LABEL_LOADGAME 8
  45. #define LOADMENU_LABEL_SLOT_FIRST 43
  46. #define CONFIRMMENU_LABEL_NO 19
  47. #define CONFIRMMENU_LABEL_YES 20
  48. #define CASH_LABEL 21
  49. #define SWITCHMENU_LABEL_DISABLE 17
  50. #define SWITCHMENU_LABEL_ENABLE 18
  51. #define GAMEMENU_LABEL_STATUS 3
  52. #define GAMEMENU_LABEL_MAGIC 4
  53. #define GAMEMENU_LABEL_INVENTORY 5
  54. #define GAMEMENU_LABEL_SYSTEM 6
  55. #define SYSMENU_LABEL_SAVE 11
  56. #define SYSMENU_LABEL_LOAD 12
  57. #define SYSMENU_LABEL_MUSIC 13
  58. #define SYSMENU_LABEL_SOUND 14
  59. #define SYSMENU_LABEL_QUIT 15
  60. #define SYSMENU_LABEL_BATTLEMODE (PAL_ADDITIONAL_WORD_FIRST)
  61. #define BATTLESPEEDMENU_LABEL_1 (PAL_ADDITIONAL_WORD_FIRST + 1)
  62. #define BATTLESPEEDMENU_LABEL_2 (PAL_ADDITIONAL_WORD_FIRST + 2)
  63. #define BATTLESPEEDMENU_LABEL_3 (PAL_ADDITIONAL_WORD_FIRST + 3)
  64. #define BATTLESPEEDMENU_LABEL_4 (PAL_ADDITIONAL_WORD_FIRST + 4)
  65. #define BATTLESPEEDMENU_LABEL_5 (PAL_ADDITIONAL_WORD_FIRST + 5)
  66. #define INVMENU_LABEL_USE 23
  67. #define INVMENU_LABEL_EQUIP 22
  68. #define STATUS_BACKGROUND_FBPNUM 0
  69. #define STATUS_LABEL_EXP 2
  70. #define STATUS_LABEL_LEVEL 48
  71. #define STATUS_LABEL_HP 49
  72. #define STATUS_LABEL_MP 50
  73. #define STATUS_LABEL_ATTACKPOWER 51
  74. #define STATUS_LABEL_MAGICPOWER 52
  75. #define STATUS_LABEL_RESISTANCE 53
  76. #define STATUS_LABEL_DEXTERITY 54
  77. #define STATUS_LABEL_FLEERATE 55
  78. #define STATUS_COLOR_EQUIPMENT 0xBE
  79. #define BUYMENU_LABEL_CURRENT 35
  80. #define SELLMENU_LABEL_PRICE 25
  81. #define SPRITENUM_SLASH 39
  82. #define SPRITENUM_ITEMBOX 70
  83. #define SPRITENUM_CURSOR_YELLOW 68
  84. #define SPRITENUM_CURSOR 69
  85. #define SPRITENUM_PLAYERINFOBOX 18
  86. #define SPRITENUM_PLAYERFACE_FIRST 48
  87. #define EQUIPMENU_BACKGROUND_FBPNUM 1
  88. #define ITEMUSEMENU_COLOR_STATLABEL 0xBB
  89. #define BATTLEWIN_GETEXP_LABEL 30
  90. #define BATTLEWIN_BEATENEMY_LABEL 9
  91. #define BATTLEWIN_DOLLAR_LABEL 10
  92. #define BATTLEWIN_LEVELUP_LABEL 32
  93. #define BATTLEWIN_ADDMAGIC_LABEL 33
  94. #define BATTLEWIN_LEVELUP_LABEL_COLOR 0x39
  95. #define SPRITENUM_ARROW 47
  96. #define BATTLE_LABEL_ESCAPEFAIL 31
  97. typedef struct tagBOX
  98. {
  99. PAL_POS pos;
  100. WORD wWidth, wHeight;
  101. SDL_Surface *lpSavedArea;
  102. } BOX, *LPBOX;
  103. typedef struct tagMENUITEM
  104. {
  105. WORD wValue;
  106. WORD wNumWord;
  107. BOOL fEnabled;
  108. PAL_POS pos;
  109. } MENUITEM, *LPMENUITEM;
  110. typedef struct tagOBJECTDESC
  111. {
  112. WORD wObjectID;
  113. LPSTR lpDesc;
  114. struct tagOBJECTDESC *next;
  115. } OBJECTDESC, *LPOBJECTDESC;
  116. typedef VOID (*LPITEMCHANGED_CALLBACK)(WORD);
  117. #define MENUITEM_VALUE_CANCELLED 0xFFFF
  118. typedef enum tagNUMCOLOR
  119. {
  120. kNumColorYellow,
  121. kNumColorBlue,
  122. kNumColorCyan
  123. } NUMCOLOR;
  124. typedef enum tagNUMALIGN
  125. {
  126. kNumAlignLeft,
  127. kNumAlignMid,
  128. kNumAlignRight
  129. } NUMALIGN;
  130. INT
  131. PAL_InitUI(
  132. VOID
  133. );
  134. VOID
  135. PAL_FreeUI(
  136. VOID
  137. );
  138. LPBOX
  139. PAL_CreateBox(
  140. PAL_POS pos,
  141. INT nRows,
  142. INT nColumns,
  143. INT iStyle,
  144. BOOL fSaveScreen
  145. );
  146. LPBOX
  147. PAL_CreateSingleLineBox(
  148. PAL_POS pos,
  149. INT nLen,
  150. BOOL fSaveScreen
  151. );
  152. VOID
  153. PAL_DeleteBox(
  154. LPBOX lpBox
  155. );
  156. WORD
  157. PAL_ReadMenu(
  158. LPITEMCHANGED_CALLBACK lpfnMenuItemChanged,
  159. LPMENUITEM rgMenuItem,
  160. INT nMenuItem,
  161. WORD wDefaultItem,
  162. BYTE bLabelColor
  163. );
  164. VOID
  165. PAL_DrawNumber(
  166. UINT iNum,
  167. UINT nLength,
  168. PAL_POS pos,
  169. NUMCOLOR color,
  170. NUMALIGN align
  171. );
  172. LPOBJECTDESC
  173. PAL_LoadObjectDesc(
  174. LPCSTR lpszFileName
  175. );
  176. VOID
  177. PAL_FreeObjectDesc(
  178. LPOBJECTDESC lpObjectDesc
  179. );
  180. LPCSTR
  181. PAL_GetObjectDesc(
  182. LPOBJECTDESC lpObjectDesc,
  183. WORD wObjectID
  184. );
  185. extern LPSPRITE gpSpriteUI;
  186. #ifdef __cplusplus
  187. }
  188. #endif
  189. #endif