Subversion Repositories Games.Chess Giants

Rev

Rev 193 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. // prototypes.h
  2.  
  3. #ifndef PROTOTYPES_H
  4. #define PROTOTYPES_H
  5.  
  6.  
  7. // audio.cpp function prototypes
  8. bool Audio_Init (void);
  9. void Audio_Shutdown (void);
  10. void Audio_Think (void);
  11. void Audio_PlaySound (int sound_type, float pos_x, float pos_y, float pos_z);
  12. #define Audio_PlaySoundAtCenter(soundtype) Audio_PlaySound ((soundtype), 0.0f, 0.0f, 0.04f)
  13. #define Audio_PlaySoundAtSlot(soundtype,line,column) Audio_PlaySound ((soundtype), 17.5f - (7 - (column)) * 5.0f, 17.5f - (line) * 5.0f, 0.04f)
  14.  
  15. // base64.cpp function prototypes
  16. size_t base64_encode (char *dest, const char *source, size_t source_len);
  17. size_t base64_decode (unsigned char *dest, const unsigned char *source, size_t source_len);
  18.  
  19. // board.cpp function prototypes
  20. bool Board_Init (board_t *board, int white_playertype, int black_playertype, wchar_t *game_rules, wchar_t *fen_string);
  21. void Board_Shutdown (board_t *board);
  22. bool Board_Reset (board_t *board, wchar_t *fen_string);
  23. bool Board_Think (board_t *board);
  24. void Board_SwapSides (board_t *board);
  25. void Board_EnterSetupPosition (board_t *board);
  26. void Board_SetSelectedAndHovered (board_t *board, int selected_line, int selected_column, int hovered_line, int hovered_column);
  27. char Board_ColorToMove (board_t *board);
  28. void Board_AppendMove (board_t *board, int from_line, int from_column, int to_line, int to_column, char promotion_type, wchar_t *comment);
  29.  
  30. // buffer.cpp function prototypes
  31. void Buffer_Initialize (buffer_t *buffer);
  32. void Buffer_Forget (buffer_t *buffer);
  33. int Buffer_Append (buffer_t *buffer, char *data, unsigned long data_size);
  34. #define Buffer_AppendCString(buffer,string_data) Buffer_Append ((buffer), (string_data), strlen (string_data))
  35. #define Buffer_AppendCharArray(buffer,char_array) Buffer_Append ((buffer), (char_array), sizeof (char_array) - 1)
  36. #define Buffer_AppendBuffer(buffer,appendable) Buffer_Append ((buffer), (appendable)->data, (appendable)->size)
  37. int Buffer_Prepend (buffer_t *buffer, char *data, unsigned long data_size);
  38. #define Buffer_PrependCString(buffer,string_data) Buffer_Prepend ((buffer), (string_data), strlen (string_data))
  39. #define Buffer_PrependCharArray(buffer,char_array) Buffer_Prepend ((buffer), (char_array), sizeof (char_array) - 1)
  40. #define Buffer_PrependBuffer(buffer,prependable) Buffer_Prepend ((buffer), (prependable)->data, (prependable)->size)
  41. int Buffer_WriteAt (buffer_t *buffer, unsigned long write_index, char *data, unsigned long data_size);
  42. int Buffer_ReadFromFile (buffer_t *buffer, const char *file_pathname);
  43. int Buffer_ReadFromFileW (buffer_t *buffer, const wchar_t *file_pathname);
  44. int Buffer_WriteToFile (buffer_t *buffer, const char *file_pathname);
  45. int Buffer_WriteToFileW (buffer_t *buffer, const wchar_t *file_pathname);
  46. char *Buffer_Find (buffer_t *buffer, char *needle, unsigned long needle_length);
  47. int Buffer_Compare (buffer_t *buffer1, buffer_t *buffer2);
  48. unsigned long Buffer_OffsetOf (buffer_t *buffer, void *something);
  49.  
  50. // challenge.cpp function prototypes
  51. void Challenges_Init (void);
  52. void Challenges_Shutdown (void);
  53. challenge_t *Challenge_FindOrCreate (const wchar_t *nickname);
  54. challenge_t *Challenge_Find (const wchar_t *nickname);
  55. void Challenge_UpdateData (challenge_t *challenge, challenge_t *new_challenge);
  56.  
  57. // chessengine.cpp function prototypes
  58. bool PlayerEngine_Init (player_t *player);
  59. void PlayerEngine_Shutdown (player_t *player);
  60. bool PlayerEngine_Think (player_t *player);
  61.  
  62. // config.cpp function prototypes
  63. void Config_Load (void);
  64. void Config_LoadEngines (void);
  65. void Config_Save (void);
  66.  
  67. // fenfile.cpp function prototypes
  68. bool FENFile_Load (const wchar_t *fenfile_pathname, wchar_t *fen_string, int fenstring_maxsize);
  69. bool FENFile_Save (const wchar_t *fenfile_pathname, wchar_t *fen_string);
  70.  
  71. // hyperlinks.cpp function prototypes
  72. void ConvertStaticToHyperlink (HWND hWndStatic);
  73.  
  74. // inifile.cpp function prototypes
  75. void *INIFile_NewINIFile (void);
  76. int INIFile_GetNumberOfSections (void *ini_data);
  77. wchar_t *INIFile_GetSectionName (void *ini_data, int section_index);
  78. int INIFile_GetNumberOfEntries (void  *ini_data, wchar_t *section);
  79. wchar_t *INIFile_GetEntryName (void *ini_data, wchar_t *section, int entry_index);
  80. unsigned char INIFile_ReadEntryAsBool (void *ini_data, wchar_t *section, wchar_t *entry, unsigned char default_value);
  81. long INIFile_ReadEntryAsLong (void *ini_data, wchar_t *section, wchar_t *entry, long default_value);
  82. unsigned long INIFile_ReadEntryAsUnsignedLong (void *ini_data, wchar_t *section, wchar_t *entry, unsigned long default_value);
  83. double INIFile_ReadEntryAsDouble (void *ini_data, wchar_t *section, wchar_t *entry, double default_value);
  84. wchar_t *INIFile_ReadEntryAsString (void *ini_data, wchar_t *section, wchar_t *entry, wchar_t *default_value);
  85. void INIFile_WriteEntryAsBool (void *ini_data, wchar_t *section, wchar_t *entry, unsigned char value);
  86. void INIFile_WriteEntryAsLong (void *ini_data, wchar_t *section, wchar_t *entry, long value);
  87. void INIFile_WriteEntryAsUnsignedLong (void *ini_data, wchar_t *section, wchar_t *entry, unsigned long value);
  88. void INIFile_WriteEntryAsDouble (void *ini_data, wchar_t *section, wchar_t *entry, double value);
  89. void INIFile_WriteEntryAsString (void *ini_data, wchar_t *section, wchar_t *entry, wchar_t *value);
  90. void INIFile_DeleteEntry (void *ini_data, wchar_t *section, wchar_t *entry);
  91. void INIFile_DeleteSection (void *ini_data, wchar_t *section);
  92. void *INIFile_LoadINIFile (const wchar_t *filename);
  93. unsigned char INIFile_SaveINIFile (const wchar_t *filename, void *ini_data);
  94. void INIFile_FreeINIFile (void *ini_data);
  95.  
  96. // interlocutor.cpp function prototypes
  97. void Interlocutors_Init (void);
  98. void Interlocutors_Shutdown (void);
  99. interlocutor_t *Interlocutor_FindOrCreate (const wchar_t *nickname);
  100. interlocutor_t *Interlocutor_FindByWindowHandle (HWND window_handle);
  101. void Interlocutor_Chat (interlocutor_t *interlocutor, const wchar_t *sender, bool is_localsender, const wchar_t *message);
  102. void Interlocutor_Notify (interlocutor_t *interlocutor, const wchar_t *fmt, ...);
  103.  
  104. // localizedtexts.cpp function prototypes
  105. void LocalizedTexts_Init (void);
  106. void LocalizedTexts_Shutdown (void);
  107. wchar_t *LocalizedTexts_GetLocalizedTextFor (wchar_t *id_string);
  108.  
  109. // move.cpp function prototypes
  110. void Move_SetSlot (boardmove_t *move, int line, int column, int color, int part_type);
  111. bool Move_IsKingThreatenedAtLocation (boardmove_t *move, int color, int at_line, int at_column, int *threat_line, int *threat_column);
  112. bool Move_IsCheck (boardmove_t *move, int color);
  113. bool Move_IsStaleMate (boardmove_t *move, int color);
  114. bool Move_IsMoveValid (boardmove_t *move, int from_line, int from_column, int to_line, int to_column);
  115. bool Move_FindRandomMove (boardmove_t *move, int color, boardmove_t *random_move);
  116. int Move_CountPartsByColorAndType (boardmove_t *move, int color, int part_type);
  117. bool Move_IsColorInCheckAfterTestMove (boardmove_t *move, int source_line, int source_column, int target_line, int target_column, int color);
  118. bool Move_IsColorInCheckAfterTestMoveEP (boardmove_t *move, int source_line, int source_column, int target_line, int target_column, int clear_line, int clear_column, int color);
  119. void Move_DescribeInFEN (boardmove_t *move);
  120. bool Move_SetupFromFEN (boardmove_t *move, wchar_t *fen_string);
  121. bool Move_SetupFromStyle12 (boardmove_t *move, wchar_t *positions, int move_color, int pawnrush_column,
  122.                             bool can_white_castle_short, bool can_white_castle_long, bool can_black_castle_short, bool can_black_castle_long, wchar_t *pretty_movestring);
  123.  
  124. // network.cpp function prototypes
  125. bool PlayerNetwork_Init (player_t *player);
  126. void PlayerNetwork_Shutdown (player_t *player);
  127. bool PlayerNetwork_Think (player_t *player);
  128.  
  129. // network-eval.cpp function prototypes
  130. void EvaluateServerReply_MOTD (player_t *player);
  131. void EvaluateServerReply_Seek (player_t *player);
  132. void EvaluateServerReply_Challenge (player_t *player);
  133. void EvaluateServerReply_Finger (player_t *player);
  134. void EvaluateServerReply_PrivateMessage (player_t *player);
  135. void EvaluateServerReply_ChallengeAccepted (player_t *player);
  136. void EvaluateServerReply_ChallengeDeclined (player_t *player);
  137. void EvaluateServerReply_Takeback (player_t *player);
  138. void EvaluateServerReply_TakebackDeclinedByOther (player_t *player);
  139. void EvaluateServerReply_TakebackDeclinedByYou (player_t *player);
  140. void EvaluateServerReply_PlayNotAllowed (player_t *player);
  141. void EvaluateServerReply_PlayUnexistent (player_t *player);
  142. void EvaluateServerReply_PlayWrongRating (player_t *player);
  143. void EvaluateServerReply_Announcement (player_t *player);
  144. void EvaluateServerReply_ChannelMessage (player_t *player);
  145. void EvaluateServerReply_ChannelsAndMembers (player_t *player);
  146. void EvaluateServerReply_SoughtList (player_t *player);
  147. void EvaluateServerReply_PlayersList (player_t *player);
  148. void EvaluateServerReply_GameStarting (player_t *player);
  149. void EvaluateServerReply_GameState (player_t *player);
  150. void EvaluateServerReply_GameResults (player_t *player);
  151.  
  152. // pgnfile.cpp function prototypes
  153. bool PGNFile_Load (const wchar_t *pgnfile_pathname);
  154. bool PGNFile_LoadGame (board_t *board, const wchar_t *pgnfile_pathname, pgngame_t *game);
  155. bool PGNFile_Save (board_t *board, const wchar_t *pgnfile_pathname);
  156.  
  157. // pipe.cpp function prototypes
  158. FILE *pipe_open (const wchar_t *shell_command, const wchar_t *mode);
  159. int pipe_close (FILE *stream);
  160. int pipe_isalive (FILE *stream, int64_t *exit_code);
  161. int pipe_hasdata (FILE *stream);
  162. int pipe_read (FILE *stream, void *dstbuf, int nbytes);
  163. int pipe_write (FILE *stream, void *srcbuf, int nbytes);
  164.  
  165. // player.cpp function prototypes
  166. void Player_Init (player_t *player, int color, int type);
  167. void Player_Shutdown (player_t *player);
  168. void Player_ResetView (player_t *player);
  169. bool Player_RotateTable (player_t *player, float frame_time);
  170. bool Player_Think (player_t *player);
  171. bool Player_SendBuffer_Add (player_t *player, int milliseconds_max, const wchar_t *fmt, ...);
  172. player_t *Player_FindByType (int player_type);
  173. player_t *Player_GetCurrent (void);
  174. player_t *Player_GetOpposite (void);
  175.  
  176. // playercard.cpp function prototypes
  177. void PlayerCards_Init (void);
  178. void PlayerCards_Shutdown (void);
  179. playercard_t *PlayerCard_FindOrCreate (const wchar_t *nickname);
  180. void PlayerCard_AppendPersonalData (playercard_t *playercard, const wchar_t *text);
  181.  
  182. // render.cpp function prototypes
  183. bool Render_Init (const wchar_t *fmt, ...); // parameter = splash screen pathname
  184. void Render_Shutdown (void);
  185. void Render_RenderFrame (scene_t *scene);
  186. int Render_LoadMesh (const wchar_t *fmt, ...);
  187. int Render_LoadTexture (const wchar_t *fmt, ...);
  188. int Render_LoadSprite (const wchar_t *fmt, ...);
  189. int Render_MaterialIndexOf (const wchar_t *material_name);
  190. void Render_MouseToFloor (short mouse_x, short mouse_y, float *floor_x, float *floor_y);
  191. bool Render_IsMouseInBox (short mouse_x, short mouse_y, float x_percent, float y_percent, float width_percent, float height_percent);
  192.  
  193. // safelib.cpp function prototypes
  194. void *SAFE_malloc (int count, size_t element_size, bool cleanup);
  195. void *SAFE_realloc (void *allocation, int old_count, int new_count, size_t element_size, bool cleanup);
  196. void SAFE_free (void **address_of_pointer_to_allocation);
  197.  
  198. // san.cpp function prototypes
  199. bool Move_SetupFromSAN (boardmove_t *move, boardmove_t *new_move, int move_color);
  200. bool Move_DescribeInSAN (boardmove_t *move, boardmove_t *previousmove, wchar_t *out_pgntext, size_t out_buflen, bool use_localized_abbreviations);
  201.  
  202. // scene.cpp function prototypes
  203. void Scene_Init (scene_t *scene, board_t *board);
  204. void Scene_Shutdown (scene_t *scene);
  205. void Scene_Update (scene_t *scene, board_t *board);
  206. void Scene_AddCCReply (scene_t *scene, wchar_t *nickname, wchar_t *channelname, unsigned long color_rgbx, wchar_t *fmt, ...);
  207. void Scene_AddCCAnnouncement (scene_t *scene, wchar_t *announcement_label, wchar_t *fmt, ...);
  208. void Scene_SetupButton (guibutton_t *button, float left_percent, float top_percent, float width_percent, float height_percent, int sprite_index, wchar_t *font_face, float font_sizepct, bool is_bold, bool is_italic, wchar_t *fmt, ...);
  209. void Scene_SetupTextArea (guitext_t *text, float xpos_percent, float ypos_percent, float maxwidth_percent, int horizontal_align, int vertical_align, int text_align, wchar_t *font_face, float font_sizepct, bool is_bold, bool is_italic);
  210. void Scene_UpdateText (guitext_t *text, unsigned long color_rgba, float duration, bool want_fade, wchar_t *fmt, ...);
  211.  
  212. // tabcontrol.cpp function prototypes
  213. void *TabControl_New (HWND hTabControlWnd, WNDPROC ParentProc);
  214. void TabControl_AddPage (void *tab_control, wchar_t *page_name, int dialog_id);
  215. void TabControl_SelectTab (void *tab_control, int page_index);
  216. HWND TabControl_GetItem (void *tab_control, int item_id);
  217. void TabControl_Destroy (void *tab_control);
  218. bool TabControl_Notify (NMHDR *notification);
  219.  
  220. // theme.cpp function prototypes
  221. bool Themes_Init (void);
  222. void Themes_Shutdown (void);
  223. void Theme_LoadABitMore (theme_t *theme);
  224. void Background_LoadImage (backgroundsprite_t *bg, const wchar_t *fmt, ...);
  225.  
  226. // util.cpp function prototypes
  227. const wchar_t *GetDirectoryPath (const wchar_t *pathname, wchar_t *path);
  228. void CreateOrUpdateApplicationMenu (void);
  229. void CenterWindow (HWND hWnd, HWND hParentWnd);
  230. void HintWindow (HWND hWnd);
  231. float ProcessTime (void);
  232. float WrapAngle (float angle);
  233. bool SafeTerminateProcess (HANDLE hProcess, unsigned int uExitCode);
  234. wchar_t *ReachBeginningOfCurrentLine (wchar_t *string, wchar_t *current_pos);
  235. wchar_t *ReachBeginningOfNextLine (wchar_t *string, wchar_t *current_pos);
  236. wchar_t *ReadACompleteLine (wchar_t *destination_line, int max_length, wchar_t *source_buffer);
  237. wchar_t *wcsgets (wchar_t *destination_line, int max_length, wchar_t *source_buffer);
  238. wchar_t *wcsistr (const wchar_t *haystack, const wchar_t *needle);
  239. void ConvertCRLFsToSingleSpaces (wchar_t *multiline_string);
  240. size_t ConvertTo7BitASCII (char *dest, size_t dest_size_in_bytes, wchar_t *source);
  241. size_t ConvertToWideChar (wchar_t *dest, size_t dest_size_in_wchars, char *source);
  242. void MinutesToWideCharString (wchar_t *dest, size_t dest_size_in_wchars, int minutes);
  243. void SecondsToWideCharString (wchar_t *dest, size_t dest_size_in_wchars, int seconds);
  244. int MonthStringToNumber (wchar_t *month_string);
  245. bool GetImageSize (const wchar_t *imagefile_pathname, int *width, int *height);
  246. void GenerateVersionNumber (char *out_string, size_t outstring_maxsize);
  247. void Debug_Init (const wchar_t *logfile_name);
  248. void Debug_Log (const wchar_t *fmt, ...);
  249. void Debug_LogMove (boardmove_t *move, const wchar_t *fmt, ...);
  250. bool Debug_SendLogToAuthor (char *reason, bool should_include_description);
  251. int RecvWithTimeout (int socket_id, float timeout_in_seconds, char *outbuf, size_t outbuf_size, int flags);
  252. const wchar_t *GetLastNetworkError (void);
  253. HICON W32LoadIcon (const wchar_t *fmt, ...);
  254. HBITMAP W32LoadImage (const wchar_t *fmt, ...);
  255. #ifndef NO_REGISTRATION
  256. bool IsRegistrationCorrect (const wchar_t *email, const unsigned __int32 code);
  257. #endif // !NO_REGISTRATION
  258.  
  259. // dialog_xxx.cpp and window_xxx.cpp function prototypes
  260. void DialogBox_Registration (void);
  261. void DialogBox_About (void);                             void DialogBox_About_Validated (void);
  262. void DialogBox_Challenge (int challenge_index);          void DialogBox_Challenge_Validated (void);
  263. void DialogBox_ChangeAppearance (void);                  void DialogBox_ChangeAppearance_Validated (void);
  264. void DialogBox_Comment (void);                           void DialogBox_Comment_Validated (void);
  265. void DialogBox_EndGame (void);                           void DialogBox_EndGame_Validated (void);
  266. void DialogBox_GoToMove (void);                          void DialogBox_GoToMove_Validated (void);
  267. void DialogBox_RenameSides (void);                       void DialogBox_RenameSides_Validated (void);
  268. void DialogBox_Load (void);                              void DialogBox_Load_Validated (void);
  269. void DialogBox_Message (messagebox_t *messagebox_parms); void DialogBox_Message_Validated (void);
  270. void DialogBox_NewGame (void);                           void DialogBox_NewGame_Validated (void);
  271. void DialogBox_Options (void);                           void DialogBox_Options_Validated (void);
  272. void DialogBox_PawnPromotion (void);                     void DialogBox_PawnPromotion_Validated (void);
  273. void DialogBox_PlayerCard (int playercard_index);        void DialogBox_PlayerCard_Validated (void);
  274. void DialogBox_PlayerInfoName (void);                    void DialogBox_PlayerInfoName_Validated (void);
  275. void DialogBox_Quit (void);                              void DialogBox_Quit_Validated (void);
  276. void DialogBox_Resign (int type);                        void DialogBox_Resign_Validated (void);
  277. void DialogBox_Save (bool want_quit_after_save);         void DialogBox_Save_Validated (void);
  278. void DialogBox_SavePosition (void);                      void DialogBox_SavePosition_Validated (void);
  279. void DialogBox_SendChallenge (wchar_t *challengee_name); void DialogBox_SendChallenge_Validated (void);
  280. void DialogBox_SendSeek (void);                          void DialogBox_SendSeek_Validated (void);
  281. void DialogBox_Takeback (int howmany_halfmoves);         void DialogBox_Takeback_Validated (void);
  282. void Window_Chat (int interlocutor_index);               void Window_Chat_Validated (void);
  283. void Window_ChatterChannels (void);                      void Window_ChatterChannels_Validated (void);
  284. void Window_Games (void);                                void Window_Games_Validated (void);
  285. void Window_MOTD (void);                                 void Window_MOTD_Validated (void);
  286. void Window_Opponents (void);                            void Window_Opponents_Validated (void);
  287. void Window_Sought (void);                               void Window_Sought_Validated (void);
  288. LRESULT CALLBACK WindowProc_Main (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam);
  289.  
  290.  
  291. #endif // PROTOTYPES_H
  292.