/* * $Id: level.h,v 1.4 2002/09/14 01:49:01 aeneas Exp $ * Copyright (c) 2002, Dominik Schnitzer * * JFK - JFK Fucking Killerz, a massive multiplayer 2d shoot'em-up game * http://relax.ath.cx/jfk/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef JFK_LEVEL_H #define JFK_LEVEL_H #include #include #include "output.h" #include "objects_c.h" #include "sprite.h" #include "font.h" using namespace std; namespace JFK { namespace client { class level { public: /* Construct a new level, width and height specify the playfields * extent pixels */ level(output *output, int width, int height); /* Destroy the level */ ~level(); /* Level object management functions */ /* Creates a new managed object using the string s. The string is * usually a network-server message */ void create_object(const string& s); /* Delete the object with the given object id */ void delete_object(unsigned long id); /* Update the object with given object id using the string s */ void update_object(unsigned long id, const string& s); /* Process all objects, move them and change states */ void move_objects(unsigned long micsecs); /* Draw the level on the screen (actually on the invisible * double-buffer. You have to call out->show() to actually show * things */ void draw(); /* Return the current viewport starting coordinates. Used by the * the object->draw() function, to translate world coordiantes to * screen coordinates */ int get_posx() { return posx; }; int get_posy() { return posy; }; /* Returns the desired sprite object, It's NULL on error, used by * the objects to set the sprite type */ sprite* get_image(JFK::object_type otype, int type); font* get_font() { return gamefont; }; /* Returns a vector of the current players in game. Dont alter * the objects! */ vector* get_players(); person* get_player() { return player; }; private: /* Usually during the creation of the level object, we load all * image files necessary to play this level */ void load_images(); /* Set the currently visible viewport position */ void set_viewport(double x, double y); /* layer[0] gets drawn first, layer[LAYER_MAX - 1] last */ enum layers { LAYER_GROUND, LAYER_GRAVE, LAYER_ITEM, LAYER_PERSON, LAYER_OBSTACLE, LAYER_AIR, LAYER_MAX }; vector layer[LAYER_MAX]; person* player; vector images[JFK::OBJECT_MAX]; image earth; int earthsize; font* gamefont; output* out; int w, h; int posx, posy; }; } } #endif /* JFK_LEVEL_H */