add some hacky code to allow passing sfc files with -b
[openc2e.git] / CompoundAgent.h
blob57b94efe13c1212f64bcfd4c658fb94d8ba0057d
1 /*
2 * CompoundAgent.h
3 * openc2e
5 * Created by Alyssa Milburn on Tue May 25 2004.
6 * Copyright (c) 2004 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef _COMPOUNDAGENT_H
21 #define _COMPOUNDAGENT_H
23 #include "Agent.h"
24 #include <map>
25 #include <string>
26 #include "CompoundPart.h"
27 #include "endianlove.h"
29 struct Hotspot {
30 int left, top, right, bottom;
33 struct HotspotFunction {
34 int hotspot;
35 uint16 message;
36 uint8 mask;
39 class CompoundAgent : public Agent {
40 protected:
41 std::vector<CompoundPart *> parts;
43 // C1/C2 data
44 Hotspot hotspots[6];
45 HotspotFunction hotspotfunctions[6];
46 std::string spritefile;
47 unsigned int firstimage, imagecount;
49 public:
50 CompoundAgent(unsigned char family, unsigned char genus, unsigned short species, unsigned int plane,
51 std::string spritefile, unsigned int firstimage, unsigned int imagecount);
52 CompoundAgent(std::string spritefile, unsigned int firstimage, unsigned int imagecount); // C1/C2 constructor
53 virtual ~CompoundAgent();
55 unsigned int partCount() { return parts.size(); }
56 CompoundPart *part(unsigned int id);
57 void addPart(CompoundPart *);
58 void delPart(unsigned int);
59 virtual void tick();
60 void setZOrder(unsigned int plane);
62 int handleClick(float, float);
63 bool fireScript(unsigned short event, Agent *from, caosVar one, caosVar two);
64 void setHotspotLoc(unsigned int id, int l, int t, int r, int b);
65 void setHotspotFunc(unsigned int id, unsigned int h);
66 void setHotspotFuncDetails(unsigned int id, uint16 message, uint8 flags);
68 // accessor functions for NEW: PART and similar
69 std::string getSpriteFile() { return spritefile; }
70 unsigned int getFirstImage() { return firstimage; }
71 unsigned int getImageCount() { return imagecount; }
73 friend class caosVM;
76 #endif
77 /* vim: set noet: */