Subversion Repositories Games.Chess Giants

Rev

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