00001 /************************************************************************* 00002 fgentity.h 00003 Project Piedmont game 00004 ------------------------- 00005 00006 Date Created: 10/19/00 Last Modified: 05/07/08 00007 Programmer: David Foster 00008 Copyright: (C) 2000 David Foster (see file COPYING) 00009 E-mail: dfoster@computer.org 00010 00011 Description: main character class from which enemies and player 00012 character classes will be derived. 00013 00014 This program is free software; you can redistribute it and/or modify 00015 it under the terms of the GNU General Public License as published by 00016 the Free Software Foundation; either version 2 of the License, or 00017 (at your option) any later version. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program; if not, write to the Free Software 00026 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00027 00028 ************************************************************************/ 00029 00030 #ifndef FGENTITY_H 00031 #define FGENTITY_H 00032 #define FGENTITY_DEBUG 0 //1 allows debug statements to be output 00033 00034 #include <stdio.h> 00035 #include <iostream> 00036 #include <stdlib.h> 00037 #include <string> 00038 #include <stddef.h> 00039 #include <unistd.h> 00040 #include "SDL.h" 00041 #include "screen.h" 00042 #include "misc.h" 00043 #include "tiles.h" 00044 using std::string; 00045 using namespace std; 00046 00047 class FGEntityList; //forward definition 00048 00049 class FGEntity{ 00050 private: 00051 public: 00052 tile_info *info; 00053 paul_info *pinfo; 00054 string name; // this isn't even being used..... 00055 int index; // index into tiledata class 00056 int onscreen; // flag, if currently onscreen, flag = 1 00057 int character; // what's this variable for? 00058 int direction; 00059 int current_frame; 00060 int stationary; // Set if the item does not move 00061 int animate; // Used in FGItems, set to 0 by default 00062 int walkable; // Used in FGItems, set to 0 by default 00063 FGEntityList *fgentity_list; 00064 SDL_Rect box; // x,y location(in tile units) and w,h on MAP 00065 SDL_Rect current_box; // current pixel x,y location and w,h on WINDOW 00066 Tiledata tiledata; 00067 FGEntity(); 00068 00069 virtual ~FGEntity(); 00070 void set_tiledata(Tiledata &t); 00071 void set_paul_info(paul_info *p); 00072 void set_tileinfo(tile_info *newinfo); 00073 void set_fgentity_list(FGEntityList* new_list); 00074 void set_index(int i); 00075 void set_walkable(int i); 00076 void set_onscreen(int i); 00077 void set_location(int x, int y); 00078 int get_index(); 00079 int is_onscreen(); 00080 SDL_Rect get_box(); 00081 string get_name(); 00082 void set_name(string str); 00083 void reverse(); 00084 virtual void update() = 0; 00085 virtual int activate(); 00086 }; 00087 00088 #endif 00089 00090 00091