00001 /* 00002 * Copyright (C) 2000-2001 The Exult Team 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef ZOMBIE_H 00020 #define ZOMBIE_H 00021 00022 00023 #include "PathFinder.h" 00024 00025 00026 class Zombie: public virtual PathFinder 00027 { 00028 int major_distance; // Distance in tiles to go. 00029 int major_frame_incr; // # steps to take in faster dir. 00030 Tile_coord cur; // Current pos. within world. 00031 // ->'s to cur.tx, cur.ty. 00032 short *major_coord, *minor_coord; 00033 int major_dir, minor_dir; // 1 or -1 for dir. along each axis. 00034 int major_delta, minor_delta; // For each tile we move along major 00035 // axis, we add 'minor_delta'. When 00036 // the sum >= 'major_delta', we move 00037 // 1 tile along minor axis, and 00038 // subtract 'major_delta' from sum. 00039 int sum; // Sum of 'minor_delta''s. 00040 public: 00041 Zombie(int major_incr = 1) : major_distance(0), 00042 major_frame_incr(major_incr) 00043 { } 00044 // Find a path from sx,sy,sz to dx,dy,dz 00045 // Return 0 if no path can be traced. 00046 // Return !0 if path found 00047 virtual int NewPath(Tile_coord s, Tile_coord d, 00048 Pathfinder_client *client); 00049 00050 // Retrieve the coordinates of the next step on the path 00051 virtual int GetNextStep(Tile_coord& n, bool& done); 00052 virtual int get_num_steps() // # of steps left to take. 00053 { return major_distance/major_frame_incr; } 00054 virtual ~Zombie(); 00055 }; 00056 00057 #endif