00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef INCL_BARGE
00026 #define INCL_BARGE 1
00027
00028 #include "contain.h"
00029
00030
00031
00032
00033
00034
00035 class Barge_object : public Container_game_object, public Time_sensitive
00036 {
00037 Game_object_vector objects;
00038 int perm_count;
00039
00040 unsigned char xtiles, ytiles;
00041 unsigned char dir;
00042 bool complete;
00043 bool gathered;
00044 bool ice_raft;
00045 bool first_step;
00046 signed char boat;
00047 int frame_time;
00048
00049 PathFinder *path;
00050 Tile_coord center;
00051 Game_object *get_object(int i)
00052 { return objects[i]; }
00053 void swap_dims();
00054 void set_center();
00055 int okay_to_rotate(Tile_coord pos);
00056 void add_dirty();
00057
00058 void finish_move(Tile_coord *positions);
00059 public:
00060 Barge_object(int shapenum, int framenum,
00061 unsigned int shapex, unsigned int shapey, unsigned int lft,
00062 int xt, int yt, int d)
00063 : Container_game_object(shapenum, framenum,
00064 shapex, shapey, lft),
00065 perm_count(0),
00066 xtiles(xt), ytiles(yt), dir(d),
00067 complete(false), gathered(false), ice_raft(false),
00068 first_step(true), boat(-1), frame_time(0), path(0)
00069 { }
00070 Rectangle get_tile_footprint();
00071 bool is_moving()
00072 { return frame_time > 0; }
00073 int get_xtiles()
00074 { return xtiles; }
00075 int get_ytiles()
00076 { return ytiles; }
00077 Tile_coord get_center()
00078 { return center; }
00079 virtual ~Barge_object();
00080 void set_to_gather()
00081 { gathered = false; }
00082 void gather();
00083 void face_direction(int ndir);
00084
00085 void travel_to_tile(Tile_coord dest, int speed);
00086 void turn_right();
00087 void turn_left();
00088 void turn_around();
00089 void stop()
00090 { frame_time = 0; first_step = true; }
00091 void done();
00092 int okay_to_land();
00093 virtual Barge_object *as_barge() { return this; }
00094
00095 virtual void handle_event(unsigned long curtime, long udata);
00096
00097 virtual void move(int newtx, int newty, int newlift);
00098
00099 virtual void remove(Game_object *obj);
00100
00101 virtual bool add(Game_object *obj, bool dont_check = false,
00102 bool combine = false);
00103
00104 virtual int drop(Game_object *obj);
00105
00106 virtual void paint();
00107
00108 virtual int step(Tile_coord t, int frame = -1);
00109
00110 virtual void write_ireg(DataSource* out);
00111
00112 virtual int get_ireg_size();
00113 virtual void elements_read();
00114 };
00115
00116 #endif