uibattle.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 UIBATTLE_H
  24. #define UIBATTLE_H
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. #include "ui.h"
  30. typedef enum tagBATTLEUISTATE
  31. {
  32. kBattleUIWait,
  33. kBattleUISelectMove,
  34. kBattleUISelectTargetEnemy,
  35. kBattleUISelectTargetPlayer,
  36. kBattleUISelectTargetEnemyAll,
  37. kBattleUISelectTargetPlayerAll,
  38. } BATTLEUISTATE;
  39. typedef enum tagBATTLEMENUSTATE
  40. {
  41. kBattleMenuMain,
  42. kBattleMenuMagicSelect,
  43. kBattleMenuUseItemSelect,
  44. kBattleMenuThrowItemSelect,
  45. kBattleMenuMisc,
  46. kBattleMenuMiscItemSubMenu,
  47. } BATTLEMENUSTATE;
  48. typedef enum tagBATTLEUIACTION
  49. {
  50. kBattleUIActionAttack,
  51. kBattleUIActionMagic,
  52. kBattleUIActionCoopMagic,
  53. kBattleUIActionMisc,
  54. } BATTLEUIACTION;
  55. #define SPRITENUM_BATTLEICON_ATTACK 40
  56. #define SPRITENUM_BATTLEICON_MAGIC 41
  57. #define SPRITENUM_BATTLEICON_COOPMAGIC 42
  58. #define SPRITENUM_BATTLEICON_MISCMENU 43
  59. #define SPRITENUM_BATTLE_ARROW_CURRENTPLAYER 69
  60. #define SPRITENUM_BATTLE_ARROW_CURRENTPLAYER_RED 68
  61. #define SPRITENUM_BATTLE_ARROW_SELECTEDPLAYER 67
  62. #define SPRITENUM_BATTLE_ARROW_SELECTEDPLAYER_RED 66
  63. #define BATTLEUI_LABEL_ITEM 5
  64. #define BATTLEUI_LABEL_DEFEND 58
  65. #define BATTLEUI_LABEL_AUTO 56
  66. #define BATTLEUI_LABEL_INVENTORY 57
  67. #define BATTLEUI_LABEL_FLEE 59
  68. #define BATTLEUI_LABEL_STATUS 60
  69. #define BATTLEUI_LABEL_USEITEM 23
  70. #define BATTLEUI_LABEL_THROWITEM 24
  71. #define TIMEMETER_COLOR_DEFAULT 0x1B
  72. #define TIMEMETER_COLOR_SLOW 0x5B
  73. #define TIMEMETER_COLOR_HASTE 0x2A
  74. #define BATTLEUI_MAX_SHOWNUM 16
  75. typedef struct tagSHOWNUM
  76. {
  77. WORD wNum;
  78. PAL_POS pos;
  79. DWORD dwTime;
  80. NUMCOLOR color;
  81. } SHOWNUM;
  82. typedef struct tagBATTLEUI
  83. {
  84. BATTLEUISTATE state;
  85. BATTLEMENUSTATE MenuState;
  86. #ifdef PAL_UNICODE
  87. WCHAR szMsg[256]; // message to be shown on the screen
  88. WCHAR szNextMsg[256]; // next message to be shown on the screen
  89. #else
  90. CHAR szMsg[256]; // message to be shown on the screen
  91. CHAR szNextMsg[256]; // next message to be shown on the screen
  92. #endif
  93. DWORD dwMsgShowTime; // the end time of showing the message
  94. WORD wNextMsgDuration; // duration of the next message
  95. WORD wCurPlayerIndex; // index of the current player
  96. WORD wSelectedAction; // current selected action
  97. WORD wSelectedIndex; // current selected index of player or enemy
  98. WORD wPrevEnemyTarget; // previous enemy target
  99. WORD wActionType; // type of action to be performed
  100. WORD wObjectID; // object ID of the item or magic to use
  101. BOOL fAutoAttack; // TRUE if auto attack
  102. SHOWNUM rgShowNum[BATTLEUI_MAX_SHOWNUM];
  103. } BATTLEUI;
  104. VOID
  105. PAL_PlayerInfoBox(
  106. PAL_POS pos,
  107. WORD wPlayerRole,
  108. INT iTimeMeter,
  109. BYTE bTimeMeterColor,
  110. BOOL fUpdate
  111. );
  112. VOID
  113. PAL_BattleUIShowText(
  114. #ifdef PAL_UNICODE
  115. LPCWSTR lpszText,
  116. #else
  117. LPCSTR lpszText,
  118. #endif
  119. WORD wDuration
  120. );
  121. VOID
  122. PAL_BattleUIPlayerReady(
  123. WORD wPlayerIndex
  124. );
  125. VOID
  126. PAL_BattleUIUpdate(
  127. VOID
  128. );
  129. VOID
  130. PAL_BattleUIShowNum(
  131. WORD wNum,
  132. PAL_POS pos,
  133. NUMCOLOR color
  134. );
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif