Subversion Repositories Games.Chess Giants

Rev

Rev 1 | Rev 19 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. // defines.h
  2.  
  3. #ifndef DEFINES_H
  4. #define DEFINES_H
  5.  
  6.  
  7. // common definitions
  8. #ifndef DEMO
  9. #define PROGRAM_NAME L"Chess Giants"
  10. #else
  11. #define PROGRAM_NAME L"Chess Giants (Evaluation version)"
  12. #define DEMO_TIMEOUT (6.0f * 60.0f)
  13. #endif // DEMO
  14. #define PROGRAM_VERSION L"2.2"
  15. #define PROGRAM_COPYRIGHT L"© 2010-2014"
  16. #define PROGRAM_URL L"http://www.pmbaty.com/chess"
  17. #define AUTHOR_NAME L"Pierre-Marie Baty"
  18. #define AUTHOR_EMAIL L"pm@pmbaty.com"
  19. #define ACCOUNTCREATION_URL L"http://www.freechess.org/cgi-bin/Register/FICS_register.cgi?Language=%s"
  20. #define MAX_STACKABLE_PARTS 8
  21. #define MAX_PITCH_FOR_FLAT_ICONS 75.0f
  22. #define ANIMATION_DURATION 1.0f
  23. #define WCHAR_SIZEOF(a) (sizeof (a) / sizeof (wchar_t))
  24. #define LOCALIZE(a) LocalizedTexts_GetLocalizedTextFor (a)
  25. #define IS_VALID_POSITION(pos) (((pos)[0] >= 0) && ((pos)[0] < 8) && ((pos)[1] >= 0) && ((pos)[1] < 8))
  26. #define FENSTARTUP_STANDARDCHESS L"rnbqkbnr/pppppppp/////PPPPPPPP/RNBQKBNR w KQkq - 0 1"
  27. #define PGNMOVENUMBER_TO_MOVEINDEX(move,color) (2 * ((move) - 1) + ((color) == COLOR_BLACK ? 1 : 0))
  28. #define MOVEINDEX_TO_PGNMOVENUMBER(moveindex) (1 + ((moveindex) - ((moveindex) % 2)) / 2)
  29.  
  30.  
  31. // color handling macros
  32. #define RGB_TO_RGBACOLOR(r,g,b)    ((((unsigned long) (r)) << 24) | (((unsigned long) (g)) << 16) | (((unsigned long) (b)) << 8) | 0x000000FF)
  33. #define RGBA_TO_RGBACOLOR(r,g,b,a) ((((unsigned long) (r)) << 24) | (((unsigned long) (g)) << 16) | (((unsigned long) (b)) << 8) | ((unsigned long) (a)))
  34. #define RGBACOLOR_RED(rgba)   ((unsigned char) (((rgba) & 0xFF000000) >> 24))
  35. #define RGBACOLOR_GREEN(rgba) ((unsigned char) (((rgba) & 0x00FF0000) >> 16))
  36. #define RGBACOLOR_BLUE(rgba)  ((unsigned char) (((rgba) & 0x0000FF00) >> 8))
  37. #define RGBACOLOR_ALPHA(rgba) ((unsigned char)  ((rgba) & 0x000000FF))
  38. #define RGBACOLOR_SETRED(rgba,red)     (((rgba) & 0x00FFFFFF) | (((unsigned long) (red))   << 24))
  39. #define RGBACOLOR_SETGREEN(rgba,green) (((rgba) & 0xFF00FFFF) | (((unsigned long) (green)) << 16))
  40. #define RGBACOLOR_SETBLUE(rgba,blue)   (((rgba) & 0xFFFF00FF) | (((unsigned long) (blue))  <<  8))
  41. #define RGBACOLOR_SETALPHA(rgba,alpha) (((rgba) & 0xFFFFFF00) |  ((unsigned long) (alpha)))
  42. #define RGBACOLOR_FULLALPHA(rgba)      ((rgba) | 0x000000FF)
  43. #define RGBACOLOR_TO_ARGBCOLOR(rgba) (((rgba) >> 8) | ((rgba) << 24))
  44.  
  45.  
  46. // menu item IDs
  47. #define MENUID_GAME_NEWGAME 101
  48. #define MENUID_GAME_SETUPPOSITION 102
  49. #define MENUID_GAME_LOAD 103
  50. #define MENUID_GAME_SAVE 104
  51. #define MENUID_GAME_SAVEAS 105
  52. #define MENUID_GAME_SAVEPOSITIONAS 106
  53. #define MENUID_GAME_RESIGN 107
  54. #define MENUID_GAME_STATISTICS 108
  55. #define MENUID_GAME_OPTIONS 109
  56. #define MENUID_GAME_QUIT 110
  57. #define MENUID_CHESSBOARD_SUGGESTMOVE 201
  58. #define MENUID_CHESSBOARD_CANCELLASTMOVE 202
  59. #define MENUID_CHESSBOARD_COMMENTMOVE 203
  60. #define MENUID_CHESSBOARD_GOTOMOVE 204
  61. #define MENUID_CHESSBOARD_SWAPSIDES 205
  62. #define MENUID_CHESSBOARD_BEGINNINGOFGAME 206
  63. #define MENUID_CHESSBOARD_PREVIOUSMOVE 207
  64. #define MENUID_CHESSBOARD_NEXTMOVE 208
  65. #define MENUID_CHESSBOARD_CURRENTSTATEOFGAME 209
  66. #define MENUID_CHESSBOARD_TOPVIEW 210
  67. #define MENUID_CHESSBOARD_DEFAULTVIEW 211
  68. #define MENUID_CHESSBOARD_RESETVIEW 212
  69. #define MENUID_CHESSBOARD_ZOOMIN 213
  70. #define MENUID_CHESSBOARD_ZOOMOUT 214
  71. #define MENUID_CHESSBOARD_CHANGEAPPEARANCE 215
  72. #define MENUID_CHESSBOARD_DISPLAYWINDOWSDESKTOP 216
  73. #define MENUID_INTERNET_SHOWONLINEPLAYERS 301
  74. #define MENUID_INTERNET_SHOWSOUGHTGAMES 302
  75. #define MENUID_INTERNET_SEEKGAME 303
  76. #define MENUID_INTERNET_CHATTERCHANNELS 304
  77. #define MENUID_INTERNET_ENTERCHATTEXT 305
  78. #define MENUID_INTERNET_DISPLAYPLAYERCARD 306
  79. #define MENUID_INTERNET_DISPLAYYOURCARD 307
  80. #define MENUID_INTERNET_MOTD 308
  81. #define MENUID_HELP_HELP 401
  82. #define MENUID_HELP_GETCHESSGAMES 402
  83. #define MENUID_HELP_ABOUT 403
  84.  
  85.  
  86. // sound IDs
  87. #define SOUNDTYPE_NONE 0
  88. #define SOUNDTYPE_MOVE 1
  89. #define SOUNDTYPE_ILLEGALMOVE 2
  90. #define SOUNDTYPE_PIECETAKEN 3
  91. #define SOUNDTYPE_CHECK 4
  92. #define SOUNDTYPE_VICTORY 5
  93. #define SOUNDTYPE_DEFEAT 6
  94. #define SOUNDTYPE_CLICK 7
  95.  
  96.  
  97. // text alignments
  98. #define ALIGN_LEFT 0
  99. #define ALIGN_TOP 0
  100. #define ALIGN_RIGHT 1
  101. #define ALIGN_BOTTOM 1
  102. #define ALIGN_CENTER 2
  103.  
  104.  
  105. // in case this ever changes...
  106. #define MATH_PI 3.14159265358979323846f
  107. #define TO_RADIANS (MATH_PI / 180.0f)
  108. #define TO_DEGREES (180.0f / MATH_PI)
  109.  
  110.  
  111. // light types
  112. #define LIGHT_NONE 0
  113. #define LIGHT_DIRECTIONAL 1
  114. #define LIGHT_POINT 2
  115. #define LIGHT_SPOT 3
  116.  
  117.  
  118. // chess colors
  119. #define COLOR_UNSPECIFIED -1 // used in dialog_sendchallenge.cpp and dialog_sendseek.cpp
  120. #define COLOR_BLACK 0
  121. #define COLOR_WHITE 1
  122.  
  123.  
  124. // chess parts
  125. #define PART_NONE 0
  126. #define PART_KING 1
  127. #define PART_QUEEN 2
  128. #define PART_BISHOP 3
  129. #define PART_KNIGHT 4
  130. #define PART_ROOK 5
  131. #define PART_PAWN 6
  132.  
  133.  
  134. // slot flags
  135. #define FLAG_NONE 0
  136. #define FLAG_SELECTED (1 << 0)
  137. #define FLAG_POSSIBLEMOVE (1 << 1)
  138. #define FLAG_TAKEABLE (1 << 2)
  139. #define FLAG_THREAT (1 << 3)
  140. #define FLAG_CHECK (1 << 4)
  141.  
  142.  
  143. // game states
  144. #define STATE_UNKNOWN 0
  145. #define STATE_SETUPPOSITION 1
  146. #define STATE_PLAYING 2
  147. #define STATE_WHITEWIN_CHECKMATE 3
  148. #define STATE_WHITEWIN_RESIGNORFORFEIT 4
  149. #define STATE_BLACKWIN_CHECKMATE 5
  150. #define STATE_BLACKWIN_RESIGNORFORFEIT 6
  151. #define STATE_DRAW_STALEMATE 7
  152. #define STATE_DRAW_AGREEMENT 8
  153. #define STATE_DRAW_OTHER 9
  154. #define STATE_ADJOURNED 10
  155.  
  156.  
  157. // player types
  158. #define PLAYER_HUMAN 0
  159. #define PLAYER_COMPUTER 1
  160. #define PLAYER_INTERNET 2
  161.  
  162.  
  163. // network opponent rating types
  164. #define OPPONENTRATINGTYPE_DEFAULT 0
  165. #define OPPONENTRATINGTYPE_ESTIMATED 1 // E character
  166. #define OPPONENTRATINGTYPE_PROVISIONAL 2 // P character
  167.  
  168.  
  169. // network opponent handle status
  170. #define HANDLESTATUS_UNDEFINED 0
  171. #define HANDLESTATUS_AVAILABLE 1 // (space) character
  172. #define HANDLESTATUS_INGAME 2 // ^ character
  173. #define HANDLESTATUS_INSIMULATION 3 // ~ character
  174. #define HANDLESTATUS_INTOURNAMENT 4 // & character
  175. #define HANDLESTATUS_EXAMININGAGAME 5 // # character
  176. #define HANDLESTATUS_NOTOPENFORAMATCH 6 // : character
  177. #define HANDLESTATUS_INACTIVEORBUSY 7 // . character
  178. #define HANDLESTATUS_OFFLINE 8 // no representation in player list
  179.  
  180.  
  181. // network opponent handle codes
  182. #define HANDLECODE_NONE 0
  183. #define HANDLECODE_ADMINISTRATOR (1 << 0) // (*)
  184. #define HANDLECODE_BLINDFOLD (1 << 1) // (B)
  185. #define HANDLECODE_COMPUTER (1 << 2) // (C)
  186. #define HANDLECODE_TEAM (1 << 3) // (T)
  187. #define HANDLECODE_UNREGISTERED (1 << 4) // (U)
  188. #define HANDLECODE_CHESSADVISOR (1 << 5) // (CA)
  189. #define HANDLECODE_SERVICEREPRESENTATIVE (1 << 6) // (SR)
  190. #define HANDLECODE_TOURNAMENTDIRECTOR (1 << 7) // (TD)
  191. #define HANDLECODE_MAMERMANAGER (1 << 8) // (TM)
  192. #define HANDLECODE_FIDEMASTER (1 << 9) // (FM)
  193. #define HANDLECODE_FIDEINTERNATIONALMASTER (1 << 10) // (IM)
  194. #define HANDLECODE_FIDEGREATMASTER (1 << 11) // (GM)
  195. #define HANDLECODE_FIDEWOMENSINTERNATIONALMASTER (1 << 12) // (WIM)
  196. #define HANDLECODE_FIDEWOMENSGREATMASTER (1 << 13) // (WGM)
  197.  
  198.  
  199. // rating types
  200. #define GAMERATINGTYPE_UNSUPPORTED 0
  201. #define GAMERATINGTYPE_SUPPORTEDRATED 1
  202. #define GAMERATINGTYPE_SUPPORTEDUNRATED 2
  203.  
  204.  
  205. #endif // DEFINES_H
  206.