Subversion Repositories Games.Chess Giants

Rev

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