Changeset 196
- Timestamp:
- 02/24/08 07:10:49 (4 months ago)
- Files:
-
- GtkRadiant/trunk/contrib/ufoaiplug/bitmaps/ufoai_actorclip.bmp (modified) (previous)
- GtkRadiant/trunk/contrib/ufoaiplug/bitmaps/ufoai_nodraw.bmp (added)
- GtkRadiant/trunk/contrib/ufoaiplug/bitmaps/ufoai_stepon.bmp (modified) (previous)
- GtkRadiant/trunk/contrib/ufoaiplug/bitmaps/ufoai_weaponclip.bmp (added)
- GtkRadiant/trunk/contrib/ufoaiplug/ufoai.cpp (modified) (5 diffs)
- GtkRadiant/trunk/contrib/ufoaiplug/ufoai_filters.cpp (modified) (3 diffs)
- GtkRadiant/trunk/contrib/ufoaiplug/ufoai_filters.h (modified) (2 diffs)
- GtkRadiant/trunk/contrib/ufoaiplug/ufoai_gtk.cpp (modified) (6 diffs)
- GtkRadiant/trunk/contrib/ufoaiplug/ufoai_level.cpp (modified) (5 diffs)
- GtkRadiant/trunk/contrib/ufoaiplug/ufoai_level.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
GtkRadiant/trunk/contrib/ufoaiplug/ufoai.cpp
r153 r196 33 33 #include <gtk/gtk.h> 34 34 35 #define PLUGIN_VERSION "0. 2"35 #define PLUGIN_VERSION "0.4" 36 36 37 37 #include "ifilter.h" … … 75 75 { 76 76 /*GlobalRadiant().getGameName()*/ 77 return "About;-;Worldspawn reset (day);Worldspawn reset (night);Worldspawn (day);Worldspawn (night);Perform check;-;Level 1;Level 2;Level 3;Level 4;Level 5;Level 6;Level 7;Level 8;-;StepOn;ActorClip";77 return "About;-;Worldspawn reset;Worldspawn;Perform check;-;Level 1;Level 2;Level 3;Level 4;Level 5;Level 6;Level 7;Level 8;-;StepOn;ActorClip;WeaponClip;Nodraw"; 78 78 } 79 79 const char* getCommandTitleList() … … 87 87 { 88 88 GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_mainwnd), 89 "UFO:AI Plugin (http:// www.ufoai.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",89 "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About", 90 90 eMB_OK, eMB_ICONDEFAULT); 91 91 } … … 102 102 filter_level(CONTENTS_LEVEL3); 103 103 } 104 else if(string_equal(command, "Worldspawn (day)")) 105 { 106 assign_default_values_to_worldspawn(false, true, &message); 107 } 108 else if(string_equal(command, "Worldspawn (night)")) 109 { 110 assign_default_values_to_worldspawn(false, false, &message); 111 } 112 else if(string_equal(command, "Worldspawn reset (day)")) 113 { 114 assign_default_values_to_worldspawn(true, true, &message); 115 } 116 else if(string_equal(command, "Worldspawn reset (night)")) 117 { 118 assign_default_values_to_worldspawn(true, false, &message); 104 else if(string_equal(command, "Worldspawn")) 105 { 106 assign_default_values_to_worldspawn(false, &message); 107 } 108 else if(string_equal(command, "Worldspawn reset")) 109 { 110 assign_default_values_to_worldspawn(true, &message); 119 111 } 120 112 else if(string_equal(command, "Perform check")) … … 149 141 { 150 142 filter_actorclip(); 143 } 144 else if(string_equal(command, "WeaponClip")) 145 { 146 filter_weaponclip(); 147 } 148 else if(string_equal(command, "NoDraw")) 149 { 150 filter_nodraw(); 151 151 } 152 152 GtkRadiant/trunk/contrib/ufoaiplug/ufoai_filters.cpp
r153 r196 32 32 bool actorclip_active = false; 33 33 bool stepon_active = false; 34 bool nodraw_active = false; 35 bool weaponclip_active = false; 34 36 int level_active = 0; 35 37 … … 274 276 } 275 277 278 void filter_nodraw (void) 279 { 280 if (nodraw_active) { 281 nodraw_active = false; 282 } else { 283 nodraw_active = true; 284 } 285 brushlist_t brushes; 286 GlobalSceneGraph().traverse(BrushGetLevel(brushes, SURF_NODRAW, false, false, nodraw_active)); 287 288 #ifdef _DEBUG 289 if (brushes.empty()) 290 { 291 globalOutputStream() << "UFO:AI: No brushes.\n"; 292 } 293 else 294 { 295 globalOutputStream() << "UFO:AI: Hiding " << Unsigned(brushes.size()) << " nodraw brushes.\n"; 296 } 297 #endif 298 } 299 276 300 void filter_actorclip (void) 277 301 { … … 295 319 #endif 296 320 } 321 322 void filter_weaponclip (void) 323 { 324 if (weaponclip_active) { 325 weaponclip_active = false; 326 } else { 327 weaponclip_active = true; 328 } 329 brushlist_t brushes; 330 GlobalSceneGraph().traverse(BrushGetLevel(brushes, CONTENTS_WEAPONCLIP, true, false, weaponclip_active)); 331 332 #ifdef _DEBUG 333 if (brushes.empty()) 334 { 335 globalOutputStream() << "UFO:AI: No brushes.\n"; 336 } 337 else 338 { 339 globalOutputStream() << "UFO:AI: Hiding " << Unsigned(brushes.size()) << " weaponclip brushes.\n"; 340 } 341 #endif 342 } GtkRadiant/trunk/contrib/ufoaiplug/ufoai_filters.h
r132 r196 23 23 void filter_stepon(void); 24 24 void filter_actorclip(void); 25 void filter_weaponclip(void); 26 void filter_nodraw(void); 27 28 #define SURF_NODRAW 0x80 25 29 26 30 #define CONTENTS_LEVEL8 0x8000 … … 33 37 #define CONTENTS_LEVEL1 0x0100 34 38 #define CONTENTS_ACTORCLIP 0x10000 35 39 #define CONTENTS_WEAPONCLIP 0x2000000 36 40 #define CONTENTS_STEPON 0x40000000 37 41 GtkRadiant/trunk/contrib/ufoaiplug/ufoai_gtk.cpp
r135 r196 68 68 /* =============================== */ 69 69 70 #define NUM_TOOLBARBUTTONS 1 070 #define NUM_TOOLBARBUTTONS 12 71 71 72 72 /** … … 106 106 case 8: return "ufoai_stepon.bmp"; 107 107 case 9: return "ufoai_actorclip.bmp"; 108 case 10: return "ufoai_weaponclip.bmp"; 109 case 11: return "ufoai_nodraw.bmp"; 108 110 } 109 111 return NULL; … … 116 118 case 8: return eToggleButton; 117 119 case 9: return eToggleButton; 120 case 10: return eToggleButton; 121 case 11: return eToggleButton; 118 122 default: return eButton; 119 123 } … … 133 137 case 8: return "Stepon"; 134 138 case 9: return "Actorclip"; 139 case 10: return "Weaponclip"; 140 case 11: return "Nodraw"; 135 141 } 136 142 return NULL; … … 150 156 case 8: return "Hide stepon brushes"; 151 157 case 9: return "Hide actorclip brushes"; 158 case 10: return "Hide weaponclip brushes"; 159 case 11: return "Hide nodraw brushes"; 152 160 } 153 161 return NULL; … … 168 176 case 8: filter_stepon(); break; 169 177 case 9: filter_actorclip(); break; 178 case 10: filter_weaponclip(); break; 179 case 11: filter_nodraw(); break; 170 180 } 171 181 SceneChangeNotify(); GtkRadiant/trunk/contrib/ufoaiplug/ufoai_level.cpp
r153 r196 142 142 143 143 /** 144 * @brief Some default values to worldspawn like maxlevel , maxteamsand so on145 */ 146 void assign_default_values_to_worldspawn (bool override, bool day,char **returnMsg)144 * @brief Some default values to worldspawn like maxlevel and so on 145 */ 146 void assign_default_values_to_worldspawn (bool override, char **returnMsg) 147 147 { 148 148 static char message[1024]; … … 163 163 *str = '\0'; 164 164 165 get_team_count("info_player_start", &count, &teams); 166 167 // TODO: Get highest brush - a level has 64 units 168 worldspawn->setKeyValue("maxlevel", "5"); 169 170 if (string_empty(worldspawn->getKeyValue("maxteams")) 171 || atoi(worldspawn->getKeyValue("maxteams")) != teams) 172 { 173 snprintf(str, sizeof(str) - 1, "%i", teams); 174 worldspawn->setKeyValue("maxteams", str); 175 strncat(message, "Worldspawn: Set maxteams to ", sizeof(message) - 1); 176 strncat(message, str, sizeof(message) - 1); 177 strncat(message, "\n", sizeof(message) - 1); 178 } 179 180 if (day) 181 { 182 if (override) 183 { 184 worldspawn->setKeyValue("light", "160"); 185 worldspawn->setKeyValue("_color", "1 0.8 0.8"); 186 worldspawn->setKeyValue("angles", "30 210"); 187 worldspawn->setKeyValue("ambient", "0.4 0.4 0.4"); 188 } 189 else 190 { 191 if (string_empty(worldspawn->getKeyValue("light"))) 192 { 193 worldspawn->setKeyValue("light", "160"); 194 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 195 } 196 if (string_empty(worldspawn->getKeyValue("_color"))) 197 { 198 worldspawn->setKeyValue("_color", "1 0.8 0.8"); 199 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 200 } 201 if (string_empty(worldspawn->getKeyValue("angles"))) 202 { 203 worldspawn->setKeyValue("angles", "30 210"); 204 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 205 } 206 if (string_empty(worldspawn->getKeyValue("ambient"))) 207 { 208 worldspawn->setKeyValue("ambient", "0.4 0.4 0.4"); 209 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 210 } 211 } 212 } 213 else 214 { 215 if (override) 216 { 217 worldspawn->setKeyValue("light", "60"); 218 worldspawn->setKeyValue("_color", "0.8 0.8 1"); 219 worldspawn->setKeyValue("angles", "15 60"); 220 worldspawn->setKeyValue("ambient", "0.25 0.25 0.275"); 221 } 222 else 223 { 224 if (string_empty(worldspawn->getKeyValue("light"))) 225 { 226 worldspawn->setKeyValue("light", "60"); 227 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 228 } 229 if (string_empty(worldspawn->getKeyValue("_color"))) 230 { 231 worldspawn->setKeyValue("_color", "0.8 0.8 1"); 232 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 233 } 234 if (string_empty(worldspawn->getKeyValue("angles"))) 235 { 236 worldspawn->setKeyValue("angles", "15 60"); 237 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 238 } 239 if (string_empty(worldspawn->getKeyValue("ambient"))) 240 { 241 worldspawn->setKeyValue("ambient", "0.25 0.25 0.275"); 242 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient")); 243 } 244 } 245 } 246 247 if (override) 248 { 249 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), 250 "Set light to: %s\n" 251 "Set _color to: %s\n" 252 "Set angles to: %s\n" 253 "Set ambient to: %s\n", 254 worldspawn->getKeyValue("light"), 255 worldspawn->getKeyValue("_color"), 256 worldspawn->getKeyValue("angles"), 257 worldspawn->getKeyValue("ambient") 258 ); 165 if (override || string_empty(worldspawn->getKeyValue("maxlevel"))) 166 { 167 // TODO: Get highest brush - a level has 64 units 168 worldspawn->setKeyValue("maxlevel", "5"); 169 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set maxlevel to: %s", worldspawn->getKeyValue("maxlevel")); 170 } 171 172 if (override || string_empty(worldspawn->getKeyValue("maxteams"))) 173 { 174 get_team_count("info_player_start", &count, &teams); 175 if (teams) 176 { 177 snprintf(str, sizeof(str) - 1, "%i", teams); 178 worldspawn->setKeyValue("maxteams", str); 179 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set maxteams to: %s", worldspawn->getKeyValue("maxteams")); 180 } 181 if (count < 16) 182 { 183 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "You should at least place 16 info_player_start"); 184 } 259 185 } 260 186 … … 308 234 if (!count) 309 235 strncat(message, "No multiplayer start positions (info_player_start)\n", sizeof(message) - 1); 310 else if (string_empty(worldspawn->getKeyValue("maxteams")))311 {312 snprintf(message, sizeof(message) - 1, "Worldspawn: No maxteams defined (#info_player_start) (set to: %i)\n", teams);313 snprintf(str, sizeof(str) - 1, "%i", teams);314 worldspawn->setKeyValue("maxteams", str);315 }316 else if (teams != atoi(worldspawn->getKeyValue("maxteams")))317 snprintf(message, sizeof(message) - 1, "Worldspawn: Settings for maxteams (%s) doesn't match team count (%i)\n", worldspawn->getKeyValue("maxteams"), teams);318 236 319 237 // singleplayer map? … … 322 240 if (!count) 323 241 strncat(message, "No singleplayer start positions (info_human_start)\n", sizeof(message) - 1); 242 243 // singleplayer map? 244 count = 0; 245 get_team_count("info_2x2_start", &count, NULL); 246 if (!count) 247 strncat(message, "No singleplayer start positions for 2x2 units (info_2x2_start)\n", sizeof(message) - 1); 324 248 325 249 // search for civilians … … 344 268 if (ent_flags) 345 269 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Found %i func_breakable with no spawnflags\n", ent_flags); 270 ent_flags = check_entity_flags("misc_sound", "spawnflags"); 271 if (ent_flags) 272 snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Found %i misc_sound with no spawnflags\n", ent_flags); 346 273 ent_flags = check_entity_flags("misc_model", "spawnflags"); 347 274 if (ent_flags) GtkRadiant/trunk/contrib/ufoaiplug/ufoai_level.h
r132 r196 20 20 #define INCLUDED_UFOAI_LEVEL_H 21 21 22 void assign_default_values_to_worldspawn (bool override, bool day,char **returnMsg);22 void assign_default_values_to_worldspawn (bool override, char **returnMsg); 23 23 void check_map_values (char **returnMsg); 24 24 void get_team_count (const char *classname, int *count, int *team);
