1 /*! 2 * \file 3 * \ingroup display_2d 4 * \brief cursor related data types and functions 5 */ 6 #ifndef __CURSORS_H__ 7 #define __CURSORS_H__ 8 9 #include "actors.h" 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 /*! 16 * \name Cursor types 17 */ 18 /*! @{ */ 19 #define CURSOR_EYE 0 20 #define CURSOR_TALK 1 21 #define CURSOR_ATTACK 2 22 #define CURSOR_ENTER 3 23 #define CURSOR_PICK 4 24 #define CURSOR_HARVEST 5 25 #define CURSOR_WALK 6 26 #define CURSOR_ARROW 7 27 #define CURSOR_TRADE 8 28 #define CURSOR_USE_WITEM 9 29 #define CURSOR_USE 10 30 #define CURSOR_WAND 11 31 #define CURSOR_TEXT 12 32 /*! @} */ 33 34 /*! 35 * \name Type under the cursor 36 */ 37 /*! @{ */ 38 #define UNDER_MOUSE_NPC 0 39 #define UNDER_MOUSE_PLAYER 1 40 #define UNDER_MOUSE_ANIMAL 2 41 #define UNDER_MOUSE_3D_OBJ 3 42 #define UNDER_MOUSE_NOTHING 4 43 #define UNDER_MOUSE_NO_CHANGE 5 44 #ifdef MAP_EDITOR2 45 #define UNDER_MOUSE_2D_OBJ 6 46 #define UNDER_MOUSE_PARTICLE 7 47 #define UNDER_MOUSE_LIGHT 8 48 #endif 49 /*! @} */ 50 51 extern actor *actor_under_mouse; 52 extern int object_under_mouse; 53 extern int thing_under_the_mouse; 54 extern int current_cursor; 55 extern int elwin_mouse; 56 extern int cursor_scale_factor; 57 extern int max_cursor_scale_factor; 58 59 #ifndef FASTER_MAP_LOAD 60 /*! 61 * contains the names of harvestable items 62 */ 63 extern char harvestable_objects[300][80]; 64 65 /*! 66 * contains the name of entrable items 67 */ 68 extern char entrable_objects[300][80]; 69 #endif 70 71 #ifdef FASTER_MAP_LOAD 72 /*! 73 * \ingroup other 74 * \brief Load and initialize the list of harvestable objects 75 */ 76 void load_harvestable_list(void); 77 /*! 78 * \ingroup other 79 * \brief Test if an object can be harvested 80 * 81 * Check if the 3d object with file name \a fname should in principle be 82 * harvestable. Ultimately, the server decides if an object can be harvested, 83 * this function exists to show the correct cursor in the GUI. 84 * \return Zero if the object is not in the harvestable list, non-zero 85 * otherwise. 86 */ 87 int is_harvestable(const char* fname); 88 89 /*! 90 * \ingroup other 91 * \brief Load and initialize the list of entrable objects 92 */ 93 void load_entrable_list(void); 94 /*! 95 * \ingroup other 96 * \brief Test if an object can be entered 97 * 98 * Check if the 3d object with file name \a fname should in principle be 99 * entrable. Ultimately, the server decides if an object can be entered, 100 * this function exists to show the correct cursor in the GUI. 101 * \return Zero if the object is not in the entrable list, non-zero 102 * otherwise. 103 */ 104 int is_entrable(const char* fname); 105 #endif // FASTER_MAP_LOAD 106 107 /*! 108 * \ingroup other 109 * \brief loads and initializes the \see cursors_array global variable 110 * 111 * Loads and initializes the \see cursors_array global variable 112 * 113 */ 114 void load_cursors(void); 115 116 /*! 117 * \ingroup display_2d 118 * \brief changes the current cursor to the cursor given in \a cursor_id. 119 * 120 * Changes the current cursor to the cursor given in \a cursor_id. 121 * 122 * \param cursor_id the cursor to switch to 123 */ 124 void change_cursor(int cursor_id); 125 126 /*! 127 * \ingroup other 128 * \brief builds all the available cursors and stores them in \see cursors_array. 129 * 130 * Builds and initializes all available cursors and stores them in the \see cursors_array. 131 * 132 * \callgraph 133 */ 134 void build_cursors(void); 135 136 /*! 137 * \ingroup display_2d 138 * \brief checks if the cursor has changed and we need to update displays. 139 * 140 * Checks whether the cursor has changed and we need to update displays. 141 * 142 * \callgraph 143 */ 144 void check_cursor_change(void); 145 146 /*! 147 * \ingroup cursors 148 * \brief Free SDL cursors and other cursor memory. 149 * 150 * \callgraph 151 */ 152 void cursors_cleanup(void); 153 154 #ifdef __cplusplus 155 } // extern "C" 156 #endif 157 158 #endif 159