Subversion Repositories Games.Chess Giants

Rev

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