From f7ac72f8b2211a4c8d99abfba78f338fc7a76ced Mon Sep 17 00:00:00 2001 From: mattn Date: Sun, 16 Mar 2008 09:53:49 +0000 Subject: [PATCH] * updated ufoai plugin * 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 | Bin 1014 -> 494 bytes contrib/ufoai/bitmaps/ufoai_nodraw.bmp | Bin 1014 -> 498 bytes contrib/ufoai/bitmaps/ufoai_stepon.bmp | Bin 1014 -> 458 bytes contrib/ufoai/bitmaps/ufoai_weaponclip.bmp | Bin 1014 -> 558 bytes contrib/ufoai/plugin.cpp | 58 ++++++++++---------- contrib/ufoai/ufoai_filters.cpp | 59 +++++++++++---------- contrib/ufoai/ufoai_filters.h | 33 ++++++++++++ 7 files changed, 92 insertions(+), 58 deletions(-) diff --git a/contrib/ufoai/bitmaps/ufoai_actorclip.bmp b/contrib/ufoai/bitmaps/ufoai_actorclip.bmp index 43bdf933ef5cc94894002cf993526f9e78802b68..4a2887c6ae391bde30288a53fecd32ecf7e95051 100644 GIT binary patch literal 494 zcmbWvyGuf07zXg?bhXTD+0m|=UF_azbCU)^Fjoh!C{Bt)Ac9M0XsW3#i2i_vD1r(l zbLj$2)nI}B1wj$CXV0fjZS}zK<$GTE-nI1)35|Sny2wZdlAz%PKFO?YTIE{+Hc6!| z+NJ|Kq+>dvQ#zv}mFSYnRH0kCqX&AVC#upj)u;})djlSi3a@tuKHo0<{yhW&``pzL z3?3mAI!8Esfk>oCB}AiT#9~*7$16xAu8~aMAeFjDI$cF3^MY))Mz6@_-jL6~qfq#Q zs@5U5qO|g#Zq^yQrY05}7sP+adi}I*ctk8jH|Y$63y$$g(Z_y8S#~<-?DGz}w|l^% nm1RY-T8CB?n=JLTw{?g<<65%Mj`sIyES)CNn-O-B485Dpd1H%EJybw18g9X6E|NjgOxN$?n|NrOk~XAnpR<79gGr#Hjj{l8*dOPCoj-wDc9&{?yb{|NZ=C1Jzvu;ypmT35Y>< suLNRH7@_KixdWYssl!F1t4HVK(gzbqSC7tzsl!F1t4HVK(gza<0AuYzS^xk5 diff --git a/contrib/ufoai/bitmaps/ufoai_nodraw.bmp b/contrib/ufoai/bitmaps/ufoai_nodraw.bmp index b994856271f932edcdf077b4ab806cddf3d8c122..3eaa529cd3090796690ab5e309f59b02c25b3666 100644 GIT binary patch literal 498 zcmb7;O(?@*9LGQNI_72OZQkG6%-jAhO0rfCD_p$Bv=?z8+Q<&5&0z`UunPy_OgIS# zjdmj^<-$ebrldHjdHlChZoc(-p5N!`dHO!)u6G4;V#KZ!lUk52P@t60-^8j>MQ9fD z4_?~w$(ZnCW|a;O=;u&y!~n+(al$ZXSP5d|LU4(l5Du;x;_0Yc6IS7RI8PHb~Gxy$qHKA(%He0k3a`+{hrk)rv(YZ6nFGt>0?%KB2H zBx$uO6)~|H`2|HKd38UYk&u!UpHpk7u4*($QpKOhwKYxU>B=m*TK3|yLPc)euj?9g PYGwAXi%b9iXXM2-B485Dpd1H%EJybw18g9U)Ze}?-1cyYu2|NrsfVWR&I zL*D=O4B`I|G9>)p$q@7ZAw$9c!wiZ4_r~{u@v6}J|Ch7o{h#ES`~OeHbd_J0*hcE4*6eg8}q-_Dfxerq38cosnap^gVe5L2>X8k zXvTJi=>Kbh?6(YM{|_fl`hPfS(*Lc|?f=(?H~xQGyc*1h$BD!I|Nkk$SmJhjOy~b^ zH9P*#@hkm*nj!W7R)(nmPZ$cZrxPst8yph;&+sYyUuGQv3=8}JUm2?YcQLpUt$$~1 h_y23z3;u)XvkYlq`=2os5v?B{HXyeRlk|zp9{{z5lzjjI diff --git a/contrib/ufoai/bitmaps/ufoai_stepon.bmp b/contrib/ufoai/bitmaps/ufoai_stepon.bmp index 828449efa53df7b96b9fd81427b686e52a89f5b7..b73896fb33b9c59a10218f17683a2bfd4af40610 100644 GIT binary patch literal 458 zcmZ?rJ;lfX2DgBu1`rDXF+UJ9GH?J%28ItnEW{1Lnm{%PGnj-k$lC`qFgRo}FgWKk z$h*cfFt`)~aS;Q9YY~HjdlCbKdl>_RXB7j3R}BM$cP#^hUlW62P$mOIKpTT%XgLEz zXfK0eWIY2z{5%GRgar)xshtcusoe~&>2(bH*^?OjO8Xh?E9Nl-RZV5Et6jkm-ZY;f zs%;5FOy>%Q*zQ#f_PvJ~5+-b5NSeHbA#=`thJxj17>d_iVkldGouO{eGX@bT(0~GJ z^Z8ksxVag)*d^7a<)y`C#fA7}BqTVbM8#M*6ge0LI8+tXb0IR%-8d1&Ph Gn7;s?3r%1E literal 1014 zcmZ?r{l?4y24+A~1BeBHm>-B485Dpd1H%EJybw18g9SiD!h-+!aNV9~|M6jbdO>pd z^n&C@y#9c;{|qjL{}~*z{xf*hK(I;pe+JL0{|v50|NTn)|Cg=5{y(T{>i?L|6=2#m zz3zW_)BOJ+S~0TzzhO}3f4kZh|Mjycfw6*n(trDkdH?lOJOAsXcK?@mjsFi8>pcXf z#Oc-M}`?*Qiy0PGP{y8r+H diff --git a/contrib/ufoai/bitmaps/ufoai_weaponclip.bmp b/contrib/ufoai/bitmaps/ufoai_weaponclip.bmp index fe6b3485852ca68332315bc63597fea01b897579..799468ba2bc51b1046ce470176b7fe34c129007e 100644 GIT binary patch literal 558 zcmbWx$uHbt9LMqZpeSYROSKrr&KTQZhM$>{NRbikK@UU*O==4v60t-^kTl_fLtBKu zpa&-h;y_|K&_=9@12>67B~2tvnoPex%f-0M{x{6(IwVed9U~i+xsyvUt|9;4wm0g zdP_y!Bo!YgLHR5GL7AJ%`e~}_XK*;@sA-y~wq=Qi-W3}AR&n;P(>$=rr{Qg^-EKa+ z_GlgbN!!=~?c;}ZOdN@0dZsSKC4*o8F!cQv*OHrzhu9wSoIWBT#-B485Dpd1H%EJybw18g9Si@{r~^?aKrrn|M6jbdO>pd z^n&CDoqppB{~5G5{%0_~@t;Ay?tf13v;TWWPyAms{WFGtFx;;)`9Fi@i~kI^ z-~KZwG=SAR1T_3NbI$p1hu0H=%y&tUZ$$i4{-pX(Umfu7zl;s-6gqpL^f4|e?k)Tv>r diff --git a/contrib/ufoai/plugin.cpp b/contrib/ufoai/plugin.cpp index 83562902..b2b9409e 100644 --- a/contrib/ufoai/plugin.cpp +++ b/contrib/ufoai/plugin.cpp @@ -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 diff --git a/contrib/ufoai/ufoai_filters.cpp b/contrib/ufoai/ufoai_filters.cpp index 3cce5893..ed155b8f 100644 --- a/contrib/ufoai/ufoai_filters.cpp +++ b/contrib/ufoai/ufoai_filters.cpp @@ -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) diff --git a/contrib/ufoai/ufoai_filters.h b/contrib/ufoai/ufoai_filters.h index 847bd3fb..c9e87237 100644 --- a/contrib/ufoai/ufoai_filters.h +++ b/contrib/ufoai/ufoai_filters.h @@ -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);