#include <gtk/gtk.h>
-#define PLUGIN_VERSION "0.2"
+#define PLUGIN_VERSION "0.4"
#include "ifilter.h"
#include "ibrush.h"
const char* getCommandList()
{
/*GlobalRadiant().getGameName()*/
- 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";
+ 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";
}
const char* getCommandTitleList()
{
if(string_equal(command, "About"))
{
GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_mainwnd),
- "UFO:AI Plugin (http://www.ufoai.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",
+ "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",
eMB_OK, eMB_ICONDEFAULT);
}
else if(string_equal(command, "Level 1"))
{
filter_level(CONTENTS_LEVEL3);
}
- else if(string_equal(command, "Worldspawn (day)"))
+ else if(string_equal(command, "Worldspawn"))
{
- assign_default_values_to_worldspawn(false, true, &message);
+ assign_default_values_to_worldspawn(false, &message);
}
- else if(string_equal(command, "Worldspawn (night)"))
+ else if(string_equal(command, "Worldspawn reset"))
{
- assign_default_values_to_worldspawn(false, false, &message);
- }
- else if(string_equal(command, "Worldspawn reset (day)"))
- {
- assign_default_values_to_worldspawn(true, true, &message);
- }
- else if(string_equal(command, "Worldspawn reset (night)"))
- {
- assign_default_values_to_worldspawn(true, false, &message);
+ assign_default_values_to_worldspawn(true, &message);
}
else if(string_equal(command, "Perform check"))
{
{
filter_actorclip();
}
+ else if(string_equal(command, "WeaponClip"))
+ {
+ filter_weaponclip();
+ }
+ else if(string_equal(command, "NoDraw"))
+ {
+ filter_nodraw();
+ }
if (message != NULL)
{
}
/**
- * @brief Some default values to worldspawn like maxlevel, maxteams and so on
+ * @brief Some default values to worldspawn like maxlevel and so on
*/
-void assign_default_values_to_worldspawn (bool override, bool day, char **returnMsg)
+void assign_default_values_to_worldspawn (bool override, char **returnMsg)
{
static char message[1024];
Entity* worldspawn;
*message = '\0';
*str = '\0';
- get_team_count("info_player_start", &count, &teams);
-
- // TODO: Get highest brush - a level has 64 units
- worldspawn->setKeyValue("maxlevel", "5");
-
- if (string_empty(worldspawn->getKeyValue("maxteams"))
- || atoi(worldspawn->getKeyValue("maxteams")) != teams)
+ if (override || string_empty(worldspawn->getKeyValue("maxlevel")))
{
- snprintf(str, sizeof(str) - 1, "%i", teams);
- worldspawn->setKeyValue("maxteams", str);
- strncat(message, "Worldspawn: Set maxteams to ", sizeof(message) - 1);
- strncat(message, str, sizeof(message) - 1);
- strncat(message, "\n", sizeof(message) - 1);
+ // TODO: Get highest brush - a level has 64 units
+ worldspawn->setKeyValue("maxlevel", "5");
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set maxlevel to: %s", worldspawn->getKeyValue("maxlevel"));
}
- if (day)
+ if (override || string_empty(worldspawn->getKeyValue("maxteams")))
{
- if (override)
+ get_team_count("info_player_start", &count, &teams);
+ if (teams)
{
- worldspawn->setKeyValue("light", "160");
- worldspawn->setKeyValue("_color", "1 0.8 0.8");
- worldspawn->setKeyValue("angles", "30 210");
- worldspawn->setKeyValue("ambient", "0.4 0.4 0.4");
+ snprintf(str, sizeof(str) - 1, "%i", teams);
+ worldspawn->setKeyValue("maxteams", str);
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set maxteams to: %s", worldspawn->getKeyValue("maxteams"));
}
- else
+ if (count < 16)
{
- if (string_empty(worldspawn->getKeyValue("light")))
- {
- worldspawn->setKeyValue("light", "160");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
- if (string_empty(worldspawn->getKeyValue("_color")))
- {
- worldspawn->setKeyValue("_color", "1 0.8 0.8");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
- if (string_empty(worldspawn->getKeyValue("angles")))
- {
- worldspawn->setKeyValue("angles", "30 210");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
- if (string_empty(worldspawn->getKeyValue("ambient")))
- {
- worldspawn->setKeyValue("ambient", "0.4 0.4 0.4");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
- }
- }
- else
- {
- if (override)
- {
- worldspawn->setKeyValue("light", "60");
- worldspawn->setKeyValue("_color", "0.8 0.8 1");
- worldspawn->setKeyValue("angles", "15 60");
- worldspawn->setKeyValue("ambient", "0.25 0.25 0.275");
- }
- else
- {
- if (string_empty(worldspawn->getKeyValue("light")))
- {
- worldspawn->setKeyValue("light", "60");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
- if (string_empty(worldspawn->getKeyValue("_color")))
- {
- worldspawn->setKeyValue("_color", "0.8 0.8 1");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
- if (string_empty(worldspawn->getKeyValue("angles")))
- {
- worldspawn->setKeyValue("angles", "15 60");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
- if (string_empty(worldspawn->getKeyValue("ambient")))
- {
- worldspawn->setKeyValue("ambient", "0.25 0.25 0.275");
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Set ambient to: %s", worldspawn->getKeyValue("ambient"));
- }
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "You should at least place 16 info_player_start");
}
}
- if (override)
- {
- snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
- "Set light to: %s\n"
- "Set _color to: %s\n"
- "Set angles to: %s\n"
- "Set ambient to: %s\n",
- worldspawn->getKeyValue("light"),
- worldspawn->getKeyValue("_color"),
- worldspawn->getKeyValue("angles"),
- worldspawn->getKeyValue("ambient")
- );
- }
-
// no errors - no warnings
if (!strlen(message))
return;
get_team_count("info_player_start", &count, &teams);
if (!count)
strncat(message, "No multiplayer start positions (info_player_start)\n", sizeof(message) - 1);
- else if (string_empty(worldspawn->getKeyValue("maxteams")))
- {
- snprintf(message, sizeof(message) - 1, "Worldspawn: No maxteams defined (#info_player_start) (set to: %i)\n", teams);
- snprintf(str, sizeof(str) - 1, "%i", teams);
- worldspawn->setKeyValue("maxteams", str);
- }
- else if (teams != atoi(worldspawn->getKeyValue("maxteams")))
- snprintf(message, sizeof(message) - 1, "Worldspawn: Settings for maxteams (%s) doesn't match team count (%i)\n", worldspawn->getKeyValue("maxteams"), teams);
// singleplayer map?
count = 0;
if (!count)
strncat(message, "No singleplayer start positions (info_human_start)\n", sizeof(message) - 1);
+ // singleplayer map?
+ count = 0;
+ get_team_count("info_2x2_start", &count, NULL);
+ if (!count)
+ strncat(message, "No singleplayer start positions for 2x2 units (info_2x2_start)\n", sizeof(message) - 1);
+
// search for civilians
count = 0;
get_team_count("info_civilian_start", &count, NULL);
ent_flags = check_entity_flags("func_breakable", "spawnflags");
if (ent_flags)
snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Found %i func_breakable with no spawnflags\n", ent_flags);
+ ent_flags = check_entity_flags("misc_sound", "spawnflags");
+ if (ent_flags)
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Found %i misc_sound with no spawnflags\n", ent_flags);
ent_flags = check_entity_flags("misc_model", "spawnflags");
if (ent_flags)
snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message), "Found %i misc_model with no spawnflags\n", ent_flags);