actors.h

Go to the documentation of this file.
00001 /*
00002  *  actors.h - Game actors.
00003  *
00004  *  Copyright (C) 1998-1999  Jeffrey S. Freedman
00005  *  Copyright (C) 2000-2001  The Exult Team
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef INCL_ACTORS
00023 #define INCL_ACTORS 1
00024 
00025 #include "contain.h"
00026 #include "utils.h"    // This is only included for Log2...
00027 #include "flags.h"
00028 
00029 class Image_window;
00030 class Game_window;
00031 class Npc_actor;
00032 class Actor_action;
00033 class Schedule;
00034 class Schedule_change;
00035 class Monster_info;
00036 class Monster_actor;
00037 class Weapon_info;
00038 class Dead_body;
00039 class Npc_timer_list;
00040 class Frames_sequence;
00041 class Animator;
00042           // The range of actors' rect. gumps:
00043 const int ACTOR_FIRST_GUMP = 57, ACTOR_LAST_GUMP = 68;
00044 
00045 /*
00046  *  An actor:
00047  */
00048 class Actor : public Container_game_object, public Time_sensitive
00049   {
00050   static Actor *editing;    // NPC being edited by ExultStudio.
00051 protected:
00052   std::string name;     // Its name.
00053   int usecode;      // # of usecode function.
00054   bool usecode_assigned;    // Usecode # explicitly assigned.
00055   bool unused;      // If npc_num > 0, this NPC is unused
00056           //   in the game.
00057   short npc_num;      // # in Game_window::npcs list, or -1.
00058   short face_num;     // Which shape for conversations.
00059   short party_id;     // Index in party, or -1.
00060   int properties[12];   // Properties set/used in 'usecode'.
00061   unsigned char temperature;  // Measure of coldness (0-63).
00062   short shape_save;   // Our old shape, or -1.
00063   short oppressor;    // NPC ID (>= 0) of oppressor, or -1.
00064   Game_object *target;    // Who/what we're attacking.
00065 public:
00066   enum Attack_mode {    // Setting from gump.+++++Save/restore.
00067     nearest = 0,
00068     weakest = 1,    // Attack weakest.
00069     strongest = 2,
00070     beserk = 3,   // Always attack, never retreat.
00071     protect = 4,    // Protect NPC with halo.
00072     defend = 5,
00073     flank = 6,    // Attempt to attack from side.
00074     flee = 7,
00075     random = 8,   // Choose target at random.
00076     manual = 9
00077     };
00078 protected:
00079           // Party positions
00080   const static short party_pos[4][10][2];
00081 
00082   Attack_mode attack_mode;
00083           // A frame sequence for each dir.:
00084   static Frames_sequence *avatar_frames[4];
00085   static Frames_sequence *npc_frames[4];
00086   Frames_sequence **frames;
00087           // Draw weapon in hand
00088   void paint_weapon();
00089   unsigned char schedule_type;  // Schedule type (Schedule_type).
00090   Tile_coord schedule_loc;  // Location (x,y) of Shedule
00091   unsigned char next_schedule;  // Used so correct schedule type 
00092           //   will be saved
00093   Schedule *schedule;   // Current schedule.
00094   bool dormant;     // I.e., off-screen.
00095   bool hit;     // Just hit in combat.
00096   bool combat_protected;    // 'Halo' on paperdoll screen.
00097   bool user_set_attack;   // True if player set attack_mode.
00098   short alignment;    // 'Feelings' towards Ava. See below.
00099   Game_object *spots[18];   // Where things can go.  See 'Spots'
00100           //   below for description.
00101   bool two_handed;    // Carrying a two-handed item.
00102   bool two_fingered;    // Carrying gauntlets (both fingers)
00103   unsigned char light_sources;  // # of light sources readied.
00104   unsigned char usecode_dir;  // Direction (0-7) for usecode anim.
00105   unsigned siflags:32;  // 32 flags used in 'usecode'.
00106   unsigned type_flags:32; // 32 flags used in movement among other things
00107 
00108   unsigned char ident;
00109 
00110   int skin_color;
00111   Actor_action *action;   // Controls current animation.
00112   int frame_time;     // Time between frames in msecs.  0 if
00113           //   actor not moving.
00114   int step_index;     // Index into walking frames, 1 1st.
00115   Npc_timer_list *timers;   // Timers for poison, hunger, etc.
00116   Rectangle weapon_rect;    // Screen area weapon was drawn in.
00117   long rest_time;     // # msecs. of not doing anything.
00118   void init();      // Clear stuff during construction.
00119           // Move and change frame.
00120   void movef(Map_chunk *old_chunk, Map_chunk *new_chunk, 
00121     int new_sx, int new_sy, int new_frame, int new_lift);
00122 public:
00123   friend class Clear_hit;
00124   static void init_default_frames();  // Set usual frame sequence.
00125   Actor(const std::string &nm, int shapenum, int num = -1, int uc = -1);
00126   ~Actor();
00127           // Blocked moving onto tile 't'?
00128   int is_blocked(Tile_coord& t, Tile_coord *f = 0);
00129   int ready_ammo();   // Find and ready appropriate ammo.
00130   void ready_best_weapon(); // Find best weapon and ready it.
00131   void unready_weapon(int spot);  // Try to sheath weapon.
00132           // Force repaint of area taken.
00133   int add_dirty(int figure_rect = 0);
00134   void change_frame(int frnum); // Change frame & set to repaint.
00135   int figure_weapon_pos(int& weapon_x, int& weapon_y, int& weapon_frame);
00136   void use_food();    // Decrement food level.
00137           // Increment/decrement temperature.
00138   void check_temperature(bool freeze);
00139           // Get frame seq. for given dir.
00140   Frames_sequence *get_frames(int dir)
00141     { return frames[dir/2]; }
00142   int& get_step_index()   // Get it (for updating).
00143     { return step_index; }
00144           // Get attack frames.
00145   int get_attack_frames(int weapon, bool projectile,
00146             int dir, signed char *frames) const;
00147   enum Alignment {    // Describes alignment field.
00148     neutral = 0,
00149     friendly = 1,
00150     hostile = 2,
00151     unknown_align = 3 };  // Bees have this, & don't attack until
00152           // Spots where items are carried.
00153   enum Spots {      // Index of each spot, starting at
00154           //   upper, rt., going clkwise.
00155     head = 0,
00156     back = 1,
00157     belt = 2,
00158     lhand = 3,
00159     lfinger = 4,
00160     legs = 5,
00161     feet = 6,
00162     rfinger = 7,
00163     rhand = 8,
00164     torso = 9,
00165     neck = 10,
00166     ammo = 11,
00167     back2h_spot = 12, // SI (2 Handed weapons, Bedroll, 
00168           //   Bodies)
00169     shield_spot = 13, // SI (Sheild behind Backpack)
00170     ears_spot = 14,   // SI
00171     cloak_spot = 15,  // SI
00172     hands2_spot = 16, // SI (gloves, gauntlets)
00173     ucont_spot = 17,  // SI Usecode Container
00174     lrhand = 100,   // Special:  uses lhand & rhand. - Used anymore?
00175     lrfinger = 101,   // Special:  uses lfinger & rfinger - Used anymore?
00176     special_spot = 102  // Special:  SI non placeable
00177     };
00178   int free_hand() const   // Get index of a free hand, or -1.
00179     {       // PREFER right hand.
00180     return two_handed ? -1 :
00181       (!spots[rhand] ? rhand : (!spots[lhand] ? lhand : -1));
00182     }
00183   int free_finger() const   // Get index of a free finger, or -1.
00184     { 
00185     return two_fingered ? -1 :
00186       (!spots[lfinger] ? lfinger
00187         : (!spots[rfinger] ? rfinger : -1));
00188     }
00189   inline bool is_two_handed() const { return two_handed; }
00190   inline bool is_two_fingered() const { return two_fingered; }
00191   int has_light_source() const  // Carrying a torch?
00192     { return light_sources > 0; }
00193   Attack_mode get_attack_mode()
00194     { return attack_mode; }
00195   void set_attack_mode(Attack_mode amode, bool byuser = false)
00196     { attack_mode = amode; user_set_attack = byuser; }
00197   bool did_user_set_attack() const
00198     { return user_set_attack; }
00199   bool is_combat_protected() const
00200     { return combat_protected; }
00201   void set_combat_protected(bool v)
00202     { combat_protected = v; }
00203   int get_oppressor() const
00204     { return oppressor; }
00205   void set_oppressor(int opp)
00206     { oppressor = opp; }
00207   // This is not even a guess, it's a place holder
00208   enum Serpent_flags {    // Bit #'s of flags:
00209     // petra = 4,
00210     // met = 5,
00211     // no_spell_casting = 6,
00212     naked = 8,
00213     // dont_move = 9
00214     };
00215   enum type_flags {
00216     tf_fly = 4,
00217     tf_walk = 5,
00218     tf_swim = 6,
00219     tf_ethereal = 7,
00220     tf_want_primary = 8,
00221     tf_sex = 9,
00222     tf_bleeding = 10,
00223     tf_in_party = 12,
00224     tf_in_action = 13,
00225     tf_conjured = 14,
00226     tf_summonned = 15
00227   };
00228   enum Item_properties {    // Trying to figure out properties.
00229     strength = 0,   // This is also max. health.
00230     dexterity = 1,
00231     intelligence = 2,
00232     health = 3,
00233     combat = 4,
00234     mana = 5,
00235     magic = 6,    // Max. mana.
00236     training = 7,   // Training points.
00237     exp = 8,    // Experience.
00238     food_level = 9
00239     };
00240   enum Frames {     // Frames 0-15.  16-31 are the same,
00241           //   only S instead of N.
00242     standing = 0,
00243     step_right_frame = 1,
00244     step_left_frame = 2,
00245     ready_frame = 3,  // Ready to fight?
00246     raise1_frame = 4, // 1-handed strikes.
00247     reach1_frame = 5,
00248     strike1_frame = 6,
00249     raise2_frame = 7, // 2-handed strikes.
00250     reach2_frame = 8,
00251     strike2_frame = 9,
00252     sit_frame = 10,
00253     bow_frame = 11,
00254     kneel_frame = 12,
00255     sleep_frame = 13,
00256     up_frame = 14,    // Both hands reach up.
00257     out_frame = 15    // Both hands reach out.
00258     };
00259   enum FIS_Type {     // The types used in the call to fit_in_spot
00260     FIS_Other = 0,
00261     FIS_2Hand = 1,
00262     FIS_2Finger = 2,
00263     FIS_Spell = 3
00264     };
00265 
00266   int get_face_shapenum() const // Get "portrait" shape #.
00267     { return face_num; }  // It's the NPC's #.
00268   int get_usecode() const
00269     { return usecode == -1 ? get_shapenum() : usecode; }
00270   Schedule *get_schedule() const
00271     { return schedule; }
00272   int get_frame_time() const  // Return frame time if moving.
00273     { return frame_time; }
00274   void set_frame_time(int ftime)  // Set walking speed.
00275     { frame_time = ftime; }
00276   void stand_at_rest();   // Stand (if not doing anyting else).
00277   void clear_rest_time()
00278     { rest_time = 0; }
00279   void resting(int msecs)   // Increment rest time.
00280     {
00281     if ((rest_time += msecs) > 2000) 
00282       stand_at_rest();// Stand (under certain conditions).
00283     }
00284   bool is_moving() const
00285     { return frame_time != 0; }
00286   bool is_dormant() const   // Inactive (i.e., off-screen)?
00287     { return dormant; }
00288   bool is_dead() const
00289     { return (flags&(1<<Obj_flags::dead)) != 0; }
00290   bool is_in_party() const  // (Includes Avatar.)
00291     { return (flags&(1<<Obj_flags::in_party)) != 0; }
00292   void set_dormant()
00293     { dormant = true; }
00294   Actor_action *get_action()  // Return action.
00295     { return action; }
00296           // Set new action.
00297   void set_action(Actor_action *newact);
00298           // Notify scheduler obj. disappeared.
00299   void notify_object_gone(Game_object *obj);
00300   Tile_coord get_dest();    // Get destination.
00301           // Walk to a desired spot.
00302   void walk_to_tile(Tile_coord dest, int speed = 250, int delay = 0,
00303               int maxblk = 3);
00304   void walk_to_tile(int tx, int ty, int tz, int speed = 250, 
00305           int delay = 0, int maxblk = 3)
00306     { walk_to_tile(Tile_coord(tx, ty, tz), speed, delay, maxblk); }
00307           // Get there, avoiding obstacles.
00308   int walk_path_to_tile(Tile_coord src, Tile_coord dest, 
00309     int speed = 250, int delay = 0, int dist = 0, int maxblk = 3);
00310   int walk_path_to_tile(Tile_coord dest, 
00311     int speed = 250, int delay = 0, int dist = 0, int maxblk = 3)
00312     { return walk_path_to_tile(get_tile(), dest,
00313             speed, delay, dist, maxblk); }
00314           // Start animation.
00315   void start(int speed = 250, int delay = 0);
00316   void stop();      // Stop animation.
00317   void follow(Actor *leader); // Follow the leader.
00318           // Approach another from offscreen.
00319   int approach_another(Actor *other, bool wait = false);
00320           // Get info. about tile to step onto.
00321   static void get_tile_info(Actor *actor,
00322     Game_window *gwin, Map_chunk *nlist,
00323         int tx, int ty, int& water, int& poison);
00324           // Set combat opponent.
00325   void set_target(Game_object *obj, bool start_combat = false);
00326   Game_object *get_target() // Get who/what we're attacking.
00327     { return target; }
00328           // Works out if an object fits in a spot
00329   bool fits_in_spot (Game_object *obj, int spot, FIS_Type type = FIS_Other);
00330           // The prefered slot for an object
00331   void get_prefered_slots (Game_object *obj, int &prefered, int &alternate, FIS_Type &fistype);
00332           // Find where to put object.
00333   int find_best_spot(Game_object *obj);
00334   int get_prev_schedule_type(); // Get previous schedule.
00335   void restore_schedule();  // Set schedule after reading in.
00336           // Set new schedule.
00337   void set_schedule_type(int new_schedule_type, 
00338             Schedule *newsched = 0);
00339           // Change to new schedule at loc
00340   virtual void set_schedule_and_loc(int new_schedule_type, 
00341           Tile_coord dest, int delay = -1);
00342   int get_schedule_type() const
00343     { return schedule_type; }
00344           // Get/set 'alignment'.
00345   int get_alignment() const
00346     { return alignment; }
00347   void set_alignment(short a)
00348     { alignment = a; }
00349           // Update chunks after NPC moved.
00350   virtual void switched_chunks(Map_chunk *, Map_chunk *)
00351     {  }
00352           // Update schedule for new 3-hour time.
00353   virtual void update_schedule(int hour3, 
00354           int backwards = 0, int delay = -1)
00355     {  }
00356           // Render.
00357   virtual void paint();
00358           // Run usecode function.
00359   virtual void activate(int event = 1);
00360   virtual bool edit();    // Edit in ExultStudio.
00361           // Saved from ExultStudio.
00362   static void update_from_studio(unsigned char *data, int datalen);
00363           // Drop another onto this.
00364   virtual int drop(Game_object *obj);
00365   virtual std::string get_name() const;
00366   std::string get_npc_name() const;
00367   void set_npc_name(const char *n);
00368   void set_property(int prop, int val);
00369           // Lose HP's and check for death.
00370   bool reduce_health(int delta, Actor *attacker = 0);
00371   int get_property(int prop) const
00372     { return (prop >= 0 && prop < 12) ? properties[prop] : 0; }
00373   int get_effective_prop(int prop) const;
00374   bool is_dying() const   // Dead when health below -1/3 str.
00375     { return properties[(int) health] < 
00376           -(properties[(int) strength]/3); }
00377   int get_level() const   // Get experience level.
00378     { return 1 + Log2(get_property(exp)/50); }
00379   Npc_timer_list *need_timers();
00380           // Set/clear/get actor flag.
00381   virtual void set_flag(int flag);
00382   virtual void set_siflag(int flag);
00383   void set_type_flag(int flag);
00384   virtual void clear_flag(int flag);
00385   virtual void clear_siflag(int flag);
00386   void clear_type_flag(int flag);
00387   virtual int get_siflag(int flag) const;
00388   int get_type_flag(int flag) const;
00389   void set_type_flags(unsigned short tflags);
00390   int get_skin_color () const { return skin_color; }
00391   void set_skin_color (int color) { skin_color = color; set_actor_shape();}
00392   virtual int get_type_flags() const
00393     { return type_flags; }
00394 //++++++Is_dead() test messes up training.
00395 //  unsigned char get_ident() { return is_dead() ? 0 : ident; }
00396   unsigned char get_ident() { return ident; }
00397   void set_ident(unsigned char id) { ident = id; }
00398 
00399   int get_temperature() const // Get/set measure of coldness.
00400     { return temperature; }
00401   void set_temperature(int t);
00402   int figure_warmth();    // Based on what's worn.
00403   bool is_unused() const    // Free NPC?
00404     { return unused; }
00405   void set_unused(bool tf)
00406     { unused = tf; }
00407 
00408   int get_npc_num() const   // Get its ID (1-num_npcs).
00409     { return npc_num; }
00410           // Get/set index within party.
00411   int get_party_id() const
00412     { return party_id; }
00413   void set_party_id(int i)
00414     { party_id = i; }
00415           // Set for Usecode animations.
00416   void set_usecode_dir(int d)
00417     { usecode_dir = d&7; }
00418   int get_usecode_dir() const
00419     { return usecode_dir; }
00420   virtual Actor *as_actor() // An actor?
00421     { return this; }
00422   void init_readied();    // Call Usecode to init. readied objs.
00423           // Remove an object.
00424   virtual void remove(Game_object *obj);
00425           // Add an object.
00426   virtual bool add(Game_object *obj, bool dont_check = false,
00427               bool combine = false);
00428           // Add to NPC 'readied' spot.
00429   virtual int add_readied(Game_object *obj, int index, int dont_check = 0, int force_pos = 0);
00430   virtual int find_readied(Game_object *obj);
00431   virtual Game_object *get_readied(int index) const
00432     {
00433     return index >= 0 && 
00434       index < (int)(sizeof(spots)/sizeof(spots[0])) ? 
00435         spots[index] : 0; 
00436     }
00437   virtual void call_readied_usecode(int index,
00438           Game_object *obj, int eventid);
00439   virtual int get_max_weight(); // Get max. weight allowed.
00440           // Change member shape.
00441   virtual void change_member_shape(Game_object *obj, int newshape);
00442           // Move out of the way.
00443   virtual int move_aside(Actor *for_actor, int dir);
00444           // Get frame if rotated clockwise.
00445   virtual int get_rotated_frame(int quads);
00446   virtual int get_armor_points(); // Get total armor value.
00447           // Get total weapon value.
00448   virtual Weapon_info *get_weapon(int& points, int& shape); 
00449   Weapon_info *get_weapon(int& points)
00450     { int sh; return get_weapon(points, sh); }
00451   static bool roll_to_win(int attacker, int defender);
00452           // Hit-point algorithm:
00453   bool figure_hit_points(Actor *attacker, int weapon_shape, 
00454               int ammo_shape);
00455           // Under attack.
00456   virtual Game_object *attacked(Actor *attacker, int weapon_shape = 0,
00457           int ammo_shape = 0);
00458   virtual void die(Actor *attacker);    // We're dead.
00459   Actor *resurrect(Dead_body *body);// Bring back to life.
00460   Monster_actor *clone();   // Create another nearby to this.
00461   void mend_hourly();   // Restore HP's hourly.
00462           // Read from file.
00463   void read(DataSource* nfile, int num, bool has_usecode,
00464               bool& fix_unused);
00465           // Don't write out to IREG file.
00466   virtual void write_ireg(DataSource* out) {  }
00467   virtual int get_ireg_size() { return 0; }
00468   void write(DataSource* nfile);// Write out (to 'npc.dat').
00469   virtual void write_contents(DataSource* out); // Write contents
00470   void set_actor_shape();   // Set shape based on sex, skin color
00471   void set_polymorph(int shape);  // Set a polymorph shape
00472   void set_polymorph_default(); // Set the default shape
00473           // Get the polymorph shape
00474   int get_polymorph () { return shape_save; }
00475           // Get the non polymorph shape (note, doesn't returned skin coloured shapes)
00476           // For usecode
00477   int get_shape_real(); 
00478           // This does the same, but will return skin coloured shapes
00479           // For paperdolls/face stats
00480   int get_sexed_coloured_shape() { return shape_save!=-1?shape_save:get_shapenum(); } 
00481 
00482   // Set schedule list.
00483   virtual void set_schedules(Schedule_change *list, int cnt) { }
00484   virtual void set_schedule_time_type(int time, int type) { }
00485   virtual void set_schedule_time_location(int time, int x, int y) { }
00486   virtual void remove_schedule(int time) { }
00487   virtual void get_schedules(Schedule_change *&list, int &cnt)
00488   { list = NULL, cnt = 0; }
00489 
00490   void show_inventory();
00491   int inventory_shapenum();
00492 
00493   bool was_hit() { return hit; }
00494 
00495   // Should be virtual???
00496   void cache_out();
00497   };
00498 
00499 /*
00500  *  Actor frame descriptions:
00501   0 Standing
00502   1 Walk
00503   2 Walk
00504   3 Beginning to attack
00505   4-6 Attacking with one hand
00506   7-9 Attacking with two hands
00507   9 Also NPC shooting magic
00508   10  Sitting down
00509   11  Bending over (beginning to sit down)
00510   12  Kneeling
00511   11  Lying down
00512   14  Casting spell (hands raised)
00513   15  Casting spell (hands outstretched)
00514 
00515  */
00516 
00517 /*
00518  *  The main actor.
00519  */
00520 class Main_actor : public Actor
00521   {
00522 public:
00523   Main_actor(const std::string &nm, int shapenum, int num = -1, int uc = -1)
00524     : Actor(nm, shapenum, num, uc)
00525     {  frames = &avatar_frames[0]; }
00526           // For Time_sensitive:
00527   virtual void handle_event(unsigned long curtime, long udata);
00528   void get_followers();   // Get party to follow.
00529           // Step onto an (adjacent) tile.
00530   virtual int step(Tile_coord t, int frame);
00531           // Update chunks after NPC moved.
00532   virtual void switched_chunks(Map_chunk *olist,
00533           Map_chunk *nlist);
00534           // Move to new abs. location.
00535   virtual void move(int newtx, int newty, int newlift);
00536   virtual void die(Actor *attacker);    // We're dead.
00537   };
00538 
00539 /*
00540  *  A non-player-character that one can converse (or fight) with:
00541  */
00542 class Npc_actor : public Actor
00543   {
00544   unsigned char nearby;   // Queued as a 'nearby' NPC.  This is
00545           //   to avoid being added twice.
00546 protected:
00547   unsigned char num_schedules;  // # entries below.
00548   Schedule_change *schedules; // List of schedule changes.
00549   int find_schedule_change(int hour3);
00550 public:
00551   Npc_actor(const std::string &nm, int shapenum, int num = -1, 
00552                 int uc = -1);
00553   ~Npc_actor();
00554   void set_nearby()   // Set/clear/test 'nearby' flag.
00555     { nearby = true; }
00556   void clear_nearby()
00557     { nearby = false; }
00558   bool is_nearby() const
00559     { return nearby!=0; }
00560           // Set schedule list.
00561   virtual void set_schedules(Schedule_change *list, int cnt);
00562   virtual void set_schedule_time_type(int time, int type);
00563   virtual void set_schedule_time_location(int time, int x, int y);
00564   virtual void remove_schedule(int time);
00565   virtual void get_schedules(Schedule_change *&list, int &cnt);
00566           // Move and change frame.
00567   void movef(Map_chunk *old_chunk, Map_chunk *new_chunk, 
00568     int new_sx, int new_sy, int new_frame, int new_lift);
00569           // Update schedule for new 3-hour time.
00570   virtual void update_schedule(int hour3, 
00571           int backwards = 0, int delay = -1);
00572           // Render.
00573   virtual void paint();
00574           // Run usecode function.
00575   virtual void activate(int event = 1);
00576           // For Time_sensitive:
00577   virtual void handle_event(unsigned long curtime, long udata);
00578           // Step onto an (adjacent) tile.
00579   virtual int step(Tile_coord t, int frame);
00580           // Remove/delete this object.
00581   virtual void remove_this(int nodel = 0);
00582           // Update chunks after NPC moved.
00583   virtual void switched_chunks(Map_chunk *olist,
00584           Map_chunk *nlist);
00585           // Move to new abs. location.
00586   virtual void move(int newtx, int newty, int newlift);
00587 
00588   virtual Npc_actor *as_npc() { return this; }
00589   };
00590 
00591 /*
00592  *  An actor's dead body:
00593  */
00594 class Dead_body : public Container_game_object
00595   {
00596   short npc_num;      // # of NPC it came from, or -1.
00597 public:
00598   Dead_body(int shapenum, int framenum, unsigned int tilex, 
00599     unsigned int tiley, unsigned int lft, int n)
00600     : Container_game_object(shapenum, framenum, tilex, tiley, lft),
00601       npc_num(n)
00602     {
00603     }
00604   virtual ~Dead_body();
00605   virtual int get_live_npc_num();
00606           // Under attack.
00607   virtual Game_object *attacked(Actor *attacker, int weapon_shape = 0,
00608           int ammo_shape = 0)
00609     { return this; }  // Not affected.
00610   };
00611 
00612 #endif

Generated on Mon Jul 9 14:42:40 2007 for ExultEngine by  doxygen 1.5.1