00001 /************************************************************************* 00002 fgentity_list.h 00003 Project Piedmont game 00004 ------------------------- 00005 00006 Date Created: 10/19/00 Last Modified: 11/16/00 00007 Programmer: David Foster 00008 Copyright: (C) 2000 David Foster (see file COPYING) 00009 E-mail: dfoster@computer.org 00010 00011 Description: dynamic list to hold characters 00012 00013 This program is free software; you can redistribute it and/or modify 00014 it under the terms of the GNU General Public License as published by 00015 the Free Software Foundation; either version 2 of the License, or 00016 (at your option) any later version. 00017 00018 This program is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 GNU General Public License for more details. 00022 00023 You should have received a copy of the GNU General Public License 00024 along with this program; if not, write to the Free Software 00025 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 00027 ************************************************************************/ 00028 00029 #ifndef FGENTITY_LIST_H 00030 #define FGENTITY_LIST_H 00031 #define FGENTITY_LIST_DEBUG 0 //1 allows debug statements to be output 00032 00033 #include <stdio.h> 00034 #include <iostream> 00035 #include <stdlib.h> 00036 #include <string> 00037 #include <stddef.h> 00038 #include <unistd.h> 00039 #include "SDL.h" 00040 #include "misc.h" 00041 #include "screen.h" 00042 #include "tiles.h" 00043 #include "fgentity.h" 00044 #include "bgentity.h" 00045 #include "bgdraw.h" 00046 #include "player.h" 00047 using std::string; 00048 using namespace std; 00049 00050 class FGEntityList{ 00051 private: 00052 BGEntity *bgentity; 00053 BGDraw bgdraw; 00054 struct node{ 00055 FGEntity *fgentity; 00056 node *next; 00057 node *previous; 00058 int index; 00059 }; 00060 node *first; 00061 int node_count; 00062 int index; 00063 Player player; 00064 Screen screen; 00065 paul_info *pinfo; 00066 public: 00067 FGEntityList(); 00068 ~FGEntityList(); 00069 void set_bgentity(BGEntity *bge); 00070 void set_background_draw(BGDraw &bgd); 00071 void set_screen(Screen &s); 00072 void add_fgentity(FGEntity *l); 00073 void add_node(node *new_node); 00074 void remove_node(node *bye_node); 00075 void check_collisions(); 00076 void test(int dir); 00077 void set_player(Player &p); 00078 void set_paul_info(paul_info *p); 00079 int check_bg_collisions(int dir, SDL_Rect char_box); 00080 int check_fg_walkable(int dir, int prx, int pry); 00081 }; 00082 00083 #endif 00084 00085 00086