// $Id: mapengine.h,v 1.4 2006/08/05 09:08:59 matthew Exp $ // Fish Supper // Copyright (C) 2006 Matthew Clarke // // 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 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 _MAP_ENGINE_H_ #define _MAP_ENGINE_H_ #include "constants.h" #include "enums.h" #include #include #include namespace FS { class MapEngine { private: // 2D array of blocks and supporting data Block * my_blocks[NUM_ROWS]; int row_lengths[NUM_ROWS]; int row_lengths_pixels[NUM_ROWS]; float velocities[NUM_ROWS]; Direction directions[NUM_ROWS]; int current_start_pixels[NUM_ROWS]; int pixels_to_move[NUM_ROWS]; int old_pixels_to_move[NUM_ROWS]; bool my_blocks_allocated; // NEW VARIABLES int start_pixel_offsets[NUM_ROWS]; int start_times[NUM_ROWS]; Direction original_directions[NUM_ROWS]; float original_velocities[NUM_ROWS]; public: MapEngine(); ~MapEngine(); void load_map(std::ifstream & fin); //void reset(); void update(int t); const Block * const * get_blocks() { return my_blocks; } const int * get_row_lengths() { return row_lengths; } const int * get_row_lengths_pixels() { return row_lengths_pixels; } const Direction * get_directions() { return directions; } const int * get_current_start_pixels() { return current_start_pixels; } const int * get_pixels_to_move() { return pixels_to_move; } const int * get_old_pixels_to_move() { return old_pixels_to_move; } // NEW FUNCTIONS void reset(); void restart_level(int time_passed); void change_direction(int row, int time_passed); void slow_down(int row, int time_passed); void speed_up(int row, int time_passed); }; // class MapEngine } // namespace FS #endif