* updated ufoai plugin
authormattn <mattn>
Sun, 16 Mar 2008 09:53:49 +0000 (09:53 +0000)
committermattn <mattn>
Sun, 16 Mar 2008 09:53:49 +0000 (09:53 +0000)
* converted toolbar icons to indexed bitmaps - none indexed bitmaps are
not supported

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@211 8a3a26a2-13c4-0310-b231-cf6edde360e5

contrib/ufoai/bitmaps/ufoai_actorclip.bmp
contrib/ufoai/bitmaps/ufoai_nodraw.bmp
contrib/ufoai/bitmaps/ufoai_stepon.bmp
contrib/ufoai/bitmaps/ufoai_weaponclip.bmp
contrib/ufoai/plugin.cpp
contrib/ufoai/ufoai_filters.cpp
contrib/ufoai/ufoai_filters.h

index 43bdf933ef5cc94894002cf993526f9e78802b68..4a2887c6ae391bde30288a53fecd32ecf7e95051 100644 (file)
Binary files a/contrib/ufoai/bitmaps/ufoai_actorclip.bmp and b/contrib/ufoai/bitmaps/ufoai_actorclip.bmp differ
index b994856271f932edcdf077b4ab806cddf3d8c122..3eaa529cd3090796690ab5e309f59b02c25b3666 100644 (file)
Binary files a/contrib/ufoai/bitmaps/ufoai_nodraw.bmp and b/contrib/ufoai/bitmaps/ufoai_nodraw.bmp differ
index 828449efa53df7b96b9fd81427b686e52a89f5b7..b73896fb33b9c59a10218f17683a2bfd4af40610 100644 (file)
Binary files a/contrib/ufoai/bitmaps/ufoai_stepon.bmp and b/contrib/ufoai/bitmaps/ufoai_stepon.bmp differ
index fe6b3485852ca68332315bc63597fea01b897579..799468ba2bc51b1046ce470176b7fe34c129007e 100644 (file)
Binary files a/contrib/ufoai/bitmaps/ufoai_weaponclip.bmp and b/contrib/ufoai/bitmaps/ufoai_weaponclip.bmp differ
index 83562902bff8910e1c4ba24fd1058184f3046523..b2b9409e2b86c23dcdc0c488e0168d7297b0aa05 100644 (file)
@@ -47,7 +47,7 @@ void *g_pMainWidget;
 static const char *PLUGIN_COMMANDS = CMD_ABOUT ";" CMD_SEP;
 static const char *PLUGIN_ABOUT = "UFO: Alien Invasion plugin " PLUGIN_VERSION "\nby Martin Gerhardy";
 
-#define NUM_TOOLBAR_BUTTONS 12
+#define NUM_TOOLBAR_BUTTONS FILTER_MAX
 typedef struct toolbar_button_info_s
 {
        char *image;
@@ -59,6 +59,34 @@ typedef struct toolbar_button_info_s
 
 static const toolbar_button_info_t toolbar_buttons[NUM_TOOLBAR_BUTTONS] =
 {
+       {
+               "ufoai_actorclip.bmp",
+               "Filter actorclip",
+               "Actorclip",
+               DoActorClipFiltering,
+               IToolbarButton::eToggleButton
+       },
+       {
+               "ufoai_weaponclip.bmp",
+               "Filter weaponclip",
+               "Weaponclip",
+               DoWeaponClipFiltering,
+               IToolbarButton::eToggleButton
+       },
+       {
+               "ufoai_nodraw.bmp",
+               "Filter nodraw",
+               "NoDraw",
+               DoNoDrawFiltering,
+               IToolbarButton::eToggleButton
+       },
+       {
+               "ufoai_stepon.bmp",
+               "Filter stepon",
+               "Stepon",
+               DoSteponFiltering,
+               IToolbarButton::eToggleButton
+       },
        {
                "ufoai_level1.bmp",
                "Filter level1",
@@ -115,34 +143,6 @@ static const toolbar_button_info_t toolbar_buttons[NUM_TOOLBAR_BUTTONS] =
                DoLevel8Filtering,
                IToolbarButton::eToggleButton
        },
-       {
-               "ufoai_actorclip.bmp",
-               "Filter actorclip",
-               "Actorclip",
-               DoActorClipFiltering,
-               IToolbarButton::eToggleButton
-       },
-       {
-               "ufoai_stepon.bmp",
-               "Filter stepon",
-               "Stepon",
-               DoSteponFiltering,
-               IToolbarButton::eToggleButton
-       },
-       {
-               "ufoai_weaponclip.bmp",
-               "Filter weaponclip",
-               "Weaponclip",
-               DoWeaponClipFiltering,
-               IToolbarButton::eToggleButton
-       },
-       {
-               "ufoai_nodraw.bmp",
-               "Filter nodraw",
-               "NoDraw",
-               DoNoDrawFiltering,
-               IToolbarButton::eToggleButton
-       },
 };
 
 class UFOAIButton : public IToolbarButton
index 3cce5893fe77b46dd9c011ef1451e254d5872158..ed155b8f7cd004a83469bd9cac4342238cbfdaee 100644 (file)
@@ -1,47 +1,48 @@
 
 #include "plugin.h"
+#include "ufoai_filters.h"
 #include "ifilters.h"
 
 #define FilterAdd g_FuncTable.m_pfnFilterAdd
-
-enum FILTERS {
-       FILTER_ACTORCLIP,
-       FILTER_WEAPONCLIP,
-       FILTER_NODRAW,
-       FILTER_STEPON,
-       FILTER_LEVEL1,
-       FILTER_LEVEL2,
-       FILTER_LEVEL3,
-       FILTER_LEVEL4,
-       FILTER_LEVEL5,
-       FILTER_LEVEL6,
-       FILTER_LEVEL7,
-       FILTER_LEVEL8,
-
-       FILTER_MAX
-};
+#define FiltersActivate g_FuncTable.m_pfnFiltersActivate
 
 static bfilter_t* filters[FILTER_MAX];
 
 void UFOAIFilterInit (void)
 {
-       filters[FILTER_LEVEL1] = FilterAdd(1, 0, "level1", (0x10 << 0));
-       filters[FILTER_LEVEL2] = FilterAdd(1, 0, "level2", (0x10 << 1));
-       filters[FILTER_LEVEL3] = FilterAdd(1, 0, "level3", (0x10 << 2));
-       filters[FILTER_LEVEL4] = FilterAdd(1, 0, "level4", (0x10 << 3));
-       filters[FILTER_LEVEL5] = FilterAdd(1, 0, "level5", (0x10 << 4));
-       filters[FILTER_LEVEL6] = FilterAdd(1, 0, "level6", (0x10 << 5));
-       filters[FILTER_LEVEL7] = FilterAdd(1, 0, "level7", (0x10 << 6));
-       filters[FILTER_LEVEL8] = FilterAdd(1, 0, "level8", (0x10 << 7));
+       filters[FILTER_ACTORCLIP] = FilterAdd(2, 0, "actorclip", UFOAI_CONTENTS_ACTORCLIP);
+       filters[FILTER_WEAPONCLIP] = FilterAdd(2, 0, "weaponclip", UFOAI_CONTENTS_WEAPONCLIP);
+       filters[FILTER_NODRAW] = FilterAdd(2, 0, "nodraw", UFOAI_SURF_NODRAW);
+       filters[FILTER_STEPON] = FilterAdd(2, 0, "stepon", UFOAI_CONTENTS_STEPON);
+
+       filters[FILTER_LEVEL1] = FilterAdd(2, 0, "level1", UFOAI_CONTENTS_LEVEL_1);
+       filters[FILTER_LEVEL2] = FilterAdd(2, 0, "level2", UFOAI_CONTENTS_LEVEL_2);
+       filters[FILTER_LEVEL3] = FilterAdd(2, 0, "level3", UFOAI_CONTENTS_LEVEL_3);
+       filters[FILTER_LEVEL4] = FilterAdd(2, 0, "level4", UFOAI_CONTENTS_LEVEL_4);
+       filters[FILTER_LEVEL5] = FilterAdd(2, 0, "level5", UFOAI_CONTENTS_LEVEL_5);
+       filters[FILTER_LEVEL6] = FilterAdd(2, 0, "level6", UFOAI_CONTENTS_LEVEL_6);
+       filters[FILTER_LEVEL7] = FilterAdd(2, 0, "level7", UFOAI_CONTENTS_LEVEL_7);
+       filters[FILTER_LEVEL8] = FilterAdd(2, 0, "level8", UFOAI_CONTENTS_LEVEL_8);
+
+       Sys_Printf("UFO:AI Filters initialized\n");
 }
 
 void PerformFiltering (int type)
 {
-       switch (type) {
-       default:
-               Sys_Printf("TODO: Implement filters");
-               break;
+       if (!filters[type]) {
+               Sys_Printf("filters are not yet initialized\n");
+               return;
+       }
+
+       if (filters[type]->active) {
+               filters[type]->active = false;
+               Sys_Printf("filter %i deactivated\n", type);
+       } else {
+               filters[type]->active = true;
+               Sys_Printf("filter %i activated\n", type);
        }
+
+       FiltersActivate();
 }
 
 void DoSteponFiltering(void)
index 847bd3fb3c8244d570725f48c8599cba1161203c..c9e87237f31079ef7ff58f27977a1492d6d4fdea 100644 (file)
@@ -1,4 +1,37 @@
 
+enum FILTERS {
+       FILTER_ACTORCLIP,
+       FILTER_WEAPONCLIP,
+       FILTER_NODRAW,
+       FILTER_STEPON,
+       FILTER_LEVEL1,
+       FILTER_LEVEL2,
+       FILTER_LEVEL3,
+       FILTER_LEVEL4,
+       FILTER_LEVEL5,
+       FILTER_LEVEL6,
+       FILTER_LEVEL7,
+       FILTER_LEVEL8,
+
+       FILTER_MAX
+};
+
+#define UFOAI_CONTENTS_LEVEL_1 0x0100
+#define UFOAI_CONTENTS_LEVEL_2 0x0200
+#define UFOAI_CONTENTS_LEVEL_3 0x0400
+#define UFOAI_CONTENTS_LEVEL_4 0x0800
+#define UFOAI_CONTENTS_LEVEL_5 0x1000
+#define UFOAI_CONTENTS_LEVEL_6 0x2000
+#define UFOAI_CONTENTS_LEVEL_7 0x4000
+#define UFOAI_CONTENTS_LEVEL_8 0x8000
+
+#define UFOAI_CONTENTS_ACTORCLIP   0x00010000
+#define UFOAI_CONTENTS_WEAPONCLIP  0x02000000
+#define UFOAI_CONTENTS_STEPON      0x40000000
+
+#define UFOAI_SURF_NODRAW    0x00000080
+
+
 void DoSteponFiltering(void);
 void DoWeaponClipFiltering(void);
 void DoActorClipFiltering(void);