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;
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",
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
#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)
+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);