1 /* 2 * 3 * Copyright (c) 2002, 2003 Johannes Prix 4 * Copyright (c) 2004-2010 Arthur Huillet 5 * 6 * 7 * This file is part of Freedroid 8 * 9 * Freedroid is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * Freedroid is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with Freedroid; see the file COPYING. If not, write to the 21 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 22 * MA 02111-1307 USA 23 * 24 */ 25 26 /* ---------------------------------------------------------------------- 27 * This file contains all functions for the heart of the level editor. 28 * ---------------------------------------------------------------------- */ 29 30 #ifndef _leveleditor_h_ 31 #define _leveleditor_h_ 32 33 #undef EXTERN 34 #ifndef _leveleditor_c 35 #define EXTERN extern 36 #else 37 #define EXTERN 38 #endif 39 40 typedef struct line_element { 41 moderately_finepoint position; 42 obstacle *address; 43 44 list_head_t list; 45 } line_element, *Line_element; 46 47 enum ActionType { 48 ACT_CREATE_OBSTACLE, 49 ACT_REMOVE_OBSTACLE, 50 ACT_MOVE_OBSTACLE, 51 ACT_CREATE_ITEM, 52 ACT_REMOVE_ITEM, 53 ACT_MOVE_ITEM, 54 ACT_CREATE_WAYPOINT, 55 ACT_REMOVE_WAYPOINT, 56 ACT_MOVE_WAYPOINT, 57 ACT_TOGGLE_WAYPOINT_RSPAWN, 58 ACT_TOGGLE_WAYPOINT_CONNECTION, 59 ACT_TILE_FLOOR_SET, 60 ACT_SET_OBSTACLE_LABEL, 61 ACT_SET_MAP_LABEL, 62 ACT_JUMP_TO_LEVEL, 63 ACT_MULTIPLE_ACTIONS, 64 ACT_CHANGE_FLOOR_LAYER, 65 ACT_CREATE_MAP_LABEL, 66 ACT_REMOVE_MAP_LABEL, 67 ACT_CREATE_ENEMY, 68 ACT_REMOVE_ENEMY 69 }; 70 71 typedef struct { 72 struct list_head node; 73 enum ActionType type; 74 75 union { 76 struct { 77 double x, y; 78 int new_obstacle_type; 79 } create_obstacle; 80 81 obstacle *delete_obstacle; 82 83 struct { 84 obstacle *obstacle; 85 float newx; 86 float newy; 87 } move_obstacle; 88 89 struct { 90 float x, y; 91 int type; 92 } create_item; 93 94 item *delete_item; 95 96 struct { 97 item *item; 98 float newx; 99 float newy; 100 } move_item; 101 102 struct { 103 int x, y; 104 int suppress_random_spawn; 105 } create_waypoint; 106 107 struct { 108 int x, y; 109 } delete_waypoint; 110 111 struct { 112 waypoint *w; 113 int newx, newy; 114 } move_waypoint; 115 116 struct { 117 int x, y; 118 } toggle_waypoint_rspawn; 119 120 struct { 121 int x, y; 122 } toggle_waypoint_connection; 123 124 struct { 125 int x, y; 126 int layer; 127 int type; 128 } change_floor; 129 130 int number_actions; 131 132 struct { 133 obstacle *obstacle; 134 char *new_name; 135 } change_obstacle_name; /* give_new_name_to_obstacle */ 136 137 struct { 138 int id; 139 char *new_name; 140 int x, y; 141 } change_label_name; /* EditMapLabelData */ 142 143 struct { 144 int target_level; 145 double x, y; 146 } jump_to_level; 147 148 int target_layer; 149 150 struct { 151 int x; 152 int y; 153 char *label_name; 154 } create_map_label; 155 156 struct { 157 int x; 158 int y; 159 } delete_map_label; 160 161 enemy *create_enemy; 162 enemy *delete_enemy; 163 } d; 164 } action; 165 166 enum { 167 REDO = -1, /* pop in to_redo and push in to_undo */ 168 NORMAL = 0, /* push only in to_undo */ 169 UNDO = 1 /* pop in to_undo and push in to_redo */ 170 }; 171 172 EXTERN void LevelEditor(void); 173 EXTERN item *ItemDropFromLevelEditor(void); 174 EXTERN void TestMap(void); 175 EXTERN void leveleditor_cleanup(); 176 177 enum lvledit_object_type { 178 OBJECT_OBSTACLE, 179 OBJECT_FLOOR, 180 OBJECT_ITEM, 181 OBJECT_ENEMY, 182 OBJECT_WAYPOINT, 183 OBJECT_MAP_LABEL, 184 OBJECT_NONE, 185 }; 186 187 EXTERN int EditX(void); 188 EXTERN int EditY(void); 189 EXTERN level *EditLevel(void); 190 191 EXTERN char VanishingMessage[10000]; 192 EXTERN float VanishingMessageEndDate; 193 194 EXTERN int OriginWaypoint; 195 196 EXTERN int level_editor_done; 197 198 EXTERN int current_floor_layer; 199 200 EXTERN void get_random_droids_from_user(void); 201 202 EXTERN enemy *create_special_force(gps, int); 203 204 #endif 205