// defines.h
#ifndef DEFINES_H
#define DEFINES_H
// common definitions
#define PROGRAM_NAME L"Chess Giants"
#define DEMO_TIMEOUT (6.0f * 60.0f)
//#define PROGRAM_VERSION L"2.8" // no longer used. Version comes in the form YYYYMMDD and is built in dialog_about.cpp
#define PROGRAM_COPYRIGHT L"© 2010-2015"
#define PROGRAM_URL L"http://www.pmbaty.com/chess"
#define AUTHOR_NAME L"Pierre-Marie Baty"
#define AUTHOR_EMAIL L"pm@pmbaty.com"
///////////////////////
// PayPal stuff - BEGIN
#define PAYPAL_BUTTONID L"DC5JKRXQQFNKQ"
#define PAYPAL_NOTIFYURL PROGRAM_URL L"/notify.php"
#define PAYPAL_RETURNURL PROGRAM_URL L"/thankyou.php"
#define PAYPAL_URL L"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=" PAYPAL_BUTTONID L"¬ify_url=" PAYPAL_NOTIFYURL L"&return=" PAYPAL_RETURNURL
#define NOPAYPAL_URL PROGRAM_URL L"/nopaypal.php"
// PayPal stuff - END
/////////////////////
#define ACCOUNTCREATION_URL L"http://www.freechess.org/cgi-bin/Register/FICS_register.cgi?Language=%s"
#define MAX_STACKABLE_PARTS 7
#define MAX_PITCH_FOR_FLAT_ICONS 75.0f
#define ANIMATION_DURATION 1.0f
#define WCHAR_SIZEOF(a) (sizeof (a) / sizeof (wchar_t))
#define LOCALIZE(a) LocalizedTexts_GetLocalizedTextFor (a)
#define IS_VALID_POSITION(pos) (((pos)[0] >= 0) && ((pos)[0] < 8) && ((pos)[1] >= 0) && ((pos)[1] < 8))
#define FENSTARTUP_STANDARDCHESS L"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
#define PGNMOVENUMBER_TO_MOVEINDEX(move,color) (2 * ((move) - 1) + ((color) == COLOR_BLACK ? 1 : 0))
#define MOVEINDEX_TO_PGNMOVENUMBER(moveindex) (1 + ((moveindex) - ((moveindex) % 2)) / 2)
// color handling macros
#define RGB_TO_RGBACOLOR(r,g,b) ((((unsigned long) (r)) << 24) | (((unsigned long) (g)) << 16) | (((unsigned long) (b)) << 8) | 0x000000FF)
#define RGBA_TO_RGBACOLOR(r,g,b,a) ((((unsigned long) (r)) << 24) | (((unsigned long) (g)) << 16) | (((unsigned long) (b)) << 8) | ((unsigned long) (a)))
#define RGBACOLOR_RED(rgba) ((unsigned char) (((rgba) & 0xFF000000) >> 24))
#define RGBACOLOR_GREEN(rgba) ((unsigned char) (((rgba) & 0x00FF0000) >> 16))
#define RGBACOLOR_BLUE(rgba) ((unsigned char) (((rgba) & 0x0000FF00) >> 8))
#define RGBACOLOR_ALPHA(rgba) ((unsigned char) ((rgba) & 0x000000FF))
#define RGBACOLOR_SETRED(rgba,red) (((rgba) & 0x00FFFFFF) | (((unsigned long) (red)) << 24))
#define RGBACOLOR_SETGREEN(rgba,green) (((rgba) & 0xFF00FFFF) | (((unsigned long) (green)) << 16))
#define RGBACOLOR_SETBLUE(rgba,blue) (((rgba) & 0xFFFF00FF) | (((unsigned long) (blue)) << 8))
#define RGBACOLOR_SETALPHA(rgba,alpha) (((rgba) & 0xFFFFFF00) | ((unsigned long) (alpha)))
#define RGBACOLOR_FULLALPHA(rgba) ((rgba) | 0x000000FF)
#define RGBACOLOR_TO_ARGBCOLOR(rgba) (((rgba) >> 8) | ((rgba) << 24))
// menu item IDs
#define MENUID_GAME_NEWGAME 101
#define MENUID_GAME_SETUPPOSITION 102
#define MENUID_GAME_LOAD 103
#define MENUID_GAME_SAVE 104
#define MENUID_GAME_SAVEAS 105
#define MENUID_GAME_SAVEPOSITIONAS 106
#define MENUID_GAME_PAUSE 107
#define MENUID_GAME_RESIGN 108
#define MENUID_GAME_STATISTICS 109
#define MENUID_GAME_OPTIONS 110
#define MENUID_GAME_QUIT 111
#define MENUID_CHESSBOARD_SUGGESTMOVE 201
#define MENUID_CHESSBOARD_CANCELLASTMOVE 202
#define MENUID_CHESSBOARD_COMMENTMOVE 203
#define MENUID_CHESSBOARD_GOTOMOVE 204
#define MENUID_CHESSBOARD_SWAPSIDES 205
#define MENUID_CHESSBOARD_RENAMESIDES 206
#define MENUID_CHESSBOARD_BEGINNINGOFGAME 207
#define MENUID_CHESSBOARD_PREVIOUSMOVE 208
#define MENUID_CHESSBOARD_NEXTMOVE 209
#define MENUID_CHESSBOARD_CURRENTSTATEOFGAME 210
#define MENUID_CHESSBOARD_TOPVIEW 211
#define MENUID_CHESSBOARD_DEFAULTVIEW 212
#define MENUID_CHESSBOARD_RESETVIEW 213
#define MENUID_CHESSBOARD_ZOOMIN 214
#define MENUID_CHESSBOARD_ZOOMOUT 215
#define MENUID_CHESSBOARD_CHANGEAPPEARANCE 216
#define MENUID_CHESSBOARD_DISPLAYWINDOWSDESKTOP 217
#define MENUID_INTERNET_SHOWONLINEPLAYERS 301
#define MENUID_INTERNET_SHOWSOUGHTGAMES 302
#define MENUID_INTERNET_SEEKGAME 303
#define MENUID_INTERNET_CHATTERCHANNELS 304
#define MENUID_INTERNET_ENTERCHATTEXT 305
#define MENUID_INTERNET_DISPLAYPLAYERCARD 306
#define MENUID_INTERNET_DISPLAYYOURCARD 307
#define MENUID_INTERNET_MOTD 308
#define MENUID_HELP_HELP 401
#define MENUID_HELP_GETCHESSGAMES 402
#define MENUID_HELP_ADDMODIFYVISUALTHEMES 403
#define MENUID_HELP_ADDMODIFYENGINES 404
#define MENUID_HELP_ADDMODIFYTRANSLATIONS 405
#define MENUID_HELP_ABOUT 406
// sound IDs
#define SOUNDTYPE_NONE 0
#define SOUNDTYPE_MOVE 1
#define SOUNDTYPE_ILLEGALMOVE 2
#define SOUNDTYPE_PIECETAKEN 3
#define SOUNDTYPE_CHECK 4
#define SOUNDTYPE_VICTORY 5
#define SOUNDTYPE_DEFEAT 6
#define SOUNDTYPE_CLICK 7
// text alignments
#define ALIGN_LEFT 0
#define ALIGN_TOP 0
#define ALIGN_RIGHT 1
#define ALIGN_BOTTOM 1
#define ALIGN_CENTER 2
// in case this ever changes...
#define MATH_PI 3.14159265358979323846f
#define TO_RADIANS (MATH_PI / 180.0f)
#define TO_DEGREES (180.0f / MATH_PI)
// light types
#define LIGHT_NONE 0
#define LIGHT_DIRECTIONAL 1
#define LIGHT_POINT 2
#define LIGHT_SPOT 3
// chess colors
#define COLOR_UNSPECIFIED -1 // used in dialog_sendchallenge.cpp and dialog_sendseek.cpp
#define COLOR_BLACK 0
#define COLOR_WHITE 1
// chess parts
#define PART_NONE 0
#define PART_KING 1
#define PART_QUEEN 2
#define PART_BISHOP 3
#define PART_KNIGHT 4
#define PART_ROOK 5
#define PART_PAWN 6
// slot flags
#define FLAG_NONE 0
#define FLAG_SELECTED (1 << 0)
#define FLAG_POSSIBLEMOVE (1 << 1)
#define FLAG_TAKEABLE (1 << 2)
#define FLAG_THREAT (1 << 3)
#define FLAG_CHECK (1 << 4)
// game states
#define STATE_UNKNOWN 0
#define STATE_SETUPPOSITION 1
#define STATE_PLAYING 2
#define STATE_WHITEWIN_CHECKMATE 3
#define STATE_WHITEWIN_RESIGNORFORFEIT 4
#define STATE_BLACKWIN_CHECKMATE 5
#define STATE_BLACKWIN_RESIGNORFORFEIT 6
#define STATE_DRAW_STALEMATE 7
#define STATE_DRAW_AGREEMENT 8
#define STATE_DRAW_OTHER 9
#define STATE_ADJOURNED 10
// player types
#define PLAYER_HUMAN 0
#define PLAYER_COMPUTER 1
#define PLAYER_INTERNET 2
// network opponent rating types
#define OPPONENTRATINGTYPE_DEFAULT 0
#define OPPONENTRATINGTYPE_ESTIMATED 1 // E character
#define OPPONENTRATINGTYPE_PROVISIONAL 2 // P character
// network opponent handle status
#define HANDLESTATUS_UNDEFINED 0
#define HANDLESTATUS_AVAILABLE 1 // (space) character
#define HANDLESTATUS_INGAME 2 // ^ character
#define HANDLESTATUS_INSIMULATION 3 // ~ character
#define HANDLESTATUS_INTOURNAMENT 4 // & character
#define HANDLESTATUS_EXAMININGAGAME 5 // # character
#define HANDLESTATUS_NOTOPENFORAMATCH 6 // : character
#define HANDLESTATUS_INACTIVEORBUSY 7 // . character
#define HANDLESTATUS_OFFLINE 8 // no representation in player list
// network opponent handle codes
#define HANDLECODE_NONE 0
#define HANDLECODE_ADMINISTRATOR (1 << 0) // (*)
#define HANDLECODE_BLINDFOLD (1 << 1) // (B)
#define HANDLECODE_COMPUTER (1 << 2) // (C)
#define HANDLECODE_TEAM (1 << 3) // (T)
#define HANDLECODE_UNREGISTERED (1 << 4) // (U)
#define HANDLECODE_CHESSADVISOR (1 << 5) // (CA)
#define HANDLECODE_SERVICEREPRESENTATIVE (1 << 6) // (SR)
#define HANDLECODE_TOURNAMENTDIRECTOR (1 << 7) // (TD)
#define HANDLECODE_MAMERMANAGER (1 << 8) // (TM)
#define HANDLECODE_FIDEMASTER (1 << 9) // (FM)
#define HANDLECODE_FIDEINTERNATIONALMASTER (1 << 10) // (IM)
#define HANDLECODE_FIDEGREATMASTER (1 << 11) // (GM)
#define HANDLECODE_FIDEWOMENSINTERNATIONALMASTER (1 << 12) // (WIM)
#define HANDLECODE_FIDEWOMENSGREATMASTER (1 << 13) // (WGM)
// rating types
#define GAMERATINGTYPE_UNSUPPORTED 0
#define GAMERATINGTYPE_SUPPORTEDRATED 1
#define GAMERATINGTYPE_SUPPORTEDUNRATED 2
#endif // DEFINES_H