Subversion Repositories Games.Chess Giants

Rev

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