00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef INCL_EGG
00021 #define INCL_EGG 1
00022
00023 class Egg_object;
00024 class Animated_egg_object;
00025 class Animator;
00026 class Monster_actor;
00027 class Missile_launcher;
00028
00029 #include "iregobjs.h"
00030
00031
00032
00033
00034
00035 class Egglike_game_object : public Ireg_game_object
00036 {
00037 public:
00038 Egglike_game_object(int shapenum, int framenum,
00039 unsigned int tilex,
00040 unsigned int tiley, unsigned int lft = 0)
00041 : Ireg_game_object(shapenum, framenum, tilex, tiley, lft)
00042 { }
00043
00044 virtual void paint();
00045
00046 virtual int is_findable();
00047 };
00048
00049
00050
00051
00052
00053 class Egg_object : public Egglike_game_object
00054 {
00055 static Egg_object *editing;
00056 protected:
00057 unsigned char type;
00058 unsigned char probability;
00059 unsigned char criteria:3;
00060 unsigned distance:6;
00061 unsigned flags:4;
00062 unsigned short data1, data2;
00063 Rectangle area;
00064 unsigned char solid_area;
00065 Missile_launcher *launcher;
00066 void init_field(unsigned char ty);
00067 void activate_teleport(Game_object *obj);
00068 public:
00069 enum Egg_types {
00070 monster = 1,
00071 jukebox = 2,
00072 soundsfx = 3,
00073 voice = 4,
00074 usecode = 5,
00075 missile = 6,
00076 teleport = 7,
00077 weather = 8,
00078 path = 9,
00079 button = 10,
00080
00081 fire_field = 128,
00082 sleep_field = 129,
00083 poison_field = 130,
00084 caltrops_field = 131,
00085 mirror_object = 132
00086 };
00087 enum Egg_flag_shifts {
00088 nocturnal = 0,
00089 once = 1,
00090 hatched = 2,
00091 auto_reset = 3
00092 };
00093 enum Egg_criteria {
00094 cached_in = 0,
00095 party_near = 1,
00096 avatar_near = 2,
00097 avatar_far = 3,
00098 avatar_footpad = 4,
00099 party_footpad = 5,
00100 something_on = 6,
00101 external_criteria = 7
00102
00103 };
00104
00105 Egg_object(int shapenum, int framenum, unsigned int tilex,
00106 unsigned int tiley, unsigned int lft,
00107 unsigned short itype,
00108 unsigned char prob, short d1, short d2);
00109
00110 Egg_object(int shapenum, int framenum, unsigned int tilex,
00111 unsigned int tiley, unsigned int lft,
00112 unsigned char ty);
00113 virtual ~Egg_object();
00114 virtual void set_area();
00115 int get_distance() const
00116 { return distance; }
00117 int get_criteria() const
00118 { return criteria; }
00119 int get_type() const
00120 { return type; }
00121
00122 virtual int is_active(Game_object *obj,
00123 int tx, int ty, int tz, int from_tx, int from_ty);
00124
00125 Rectangle get_area() const
00126 { return area; }
00127 int is_solid_area() const
00128 { return solid_area; }
00129
00130 virtual void paint();
00131
00132 virtual void activate(int event = 1);
00133 virtual bool edit();
00134
00135 static void update_from_studio(unsigned char *data, int datalen);
00136 virtual void activate(Game_object *obj, bool must = false);
00137 void print_debug();
00138 static void set_weather(int weather, int len = 15,
00139 Game_object *egg = 0);
00140
00141 virtual void move(int newtx, int newty, int newlift);
00142
00143 virtual void remove_this(int nodel = 0);
00144 virtual int is_egg() const
00145 { return 1; }
00146
00147 virtual void write_ireg(DataSource* out);
00148
00149 virtual int get_ireg_size();
00150
00151 virtual void reset()
00152 { flags &= ~(1 << hatched); }
00153
00154 virtual Egg_object *as_egg() { return this; }
00155
00156 };
00157
00158
00159
00160
00161
00162 class Animated_egg_object : public Egg_object
00163 {
00164 protected:
00165 Animator *animator;
00166 public:
00167 Animated_egg_object(int shapenum, int framenum,
00168 unsigned int tilex,
00169 unsigned int tiley, unsigned int lft,
00170 unsigned short itype,
00171 unsigned char prob, short d1, short d2);
00172 Animated_egg_object(int shapenum, int framenum, unsigned int tilex,
00173 unsigned int tiley, unsigned int lft,
00174 unsigned char ty);
00175 virtual ~Animated_egg_object();
00176
00177 virtual void paint();
00178
00179 virtual int is_findable()
00180 { return Ireg_game_object::is_findable(); }
00181
00182 virtual void activate(int event = 1);
00183 void stop_animation();
00184 };
00185
00186
00187
00188
00189
00190 class Field_object : public Animated_egg_object
00191 {
00192 bool field_effect(Actor *actor);
00193 public:
00194 Field_object(int shapenum, int framenum, unsigned int tilex,
00195 unsigned int tiley, unsigned int lft, unsigned char ty)
00196 : Animated_egg_object(shapenum, framenum, tilex, tiley,
00197 lft, ty)
00198 { }
00199
00200 virtual void activate(int event = 1);
00201 virtual void activate(Game_object *obj, bool must = false);
00202
00203 virtual void write_ireg(DataSource* out);
00204
00205 virtual int get_ireg_size();
00206 };
00207
00208
00209
00210
00211
00212 class Mirror_object : public Egg_object
00213 {
00214 public:
00215 Mirror_object(int shapenum, int framenum, unsigned int tilex,
00216 unsigned int tiley, unsigned int lft);
00217
00218
00219 virtual void activate(int event = 1);
00220 virtual void activate(Game_object *obj, bool must = false);
00221
00222
00223 virtual int is_active(Game_object *obj,
00224 int tx, int ty, int tz, int from_tx, int from_ty);
00225
00226 virtual void set_area();
00227
00228
00229 virtual void paint();
00230
00231 virtual int is_findable()
00232 { return Ireg_game_object::is_findable(); }
00233
00234 virtual void write_ireg(DataSource* out);
00235
00236 virtual int get_ireg_size();
00237 };
00238 #endif