src/Terrain.hh
author terom
Mon, 15 Dec 2008 14:24:38 +0000
changeset 370 39e59dd36b6e
parent 296 4d3ebaa29430
child 406 a2e35ca66c74
permissions -rw-r--r--
clean up Vector a bit, remove unused Terrain -> direction function
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     1
#ifndef TERRAIN_HH
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     2
#define TERRAIN_HH
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     3
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     4
#include <vector>
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     5
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     6
#include "Vector.hh"
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
     7
#include "GraphicsPointer.hh"
296
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents: 255
diff changeset
     8
#include "Types.hh"
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     9
#include "Config.hh"
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    10
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    11
enum TerrainType {
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    12
    TERRAIN_EMPTY, 
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    13
    TERRAIN_DIRT, 
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    14
    TERRAIN_ROCK
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    15
};
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    16
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    17
/**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    18
 * Terrain class. Represents game terrain and contains member
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    19
 * functions to manipulate terrain and get info about it.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    20
 * 
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    21
 * Terrain resolution is a constant that is defined in
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    22
 * configuration. Terrain has a scale (i.e. the width and height in
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    23
 * "real" units. Scaling is needed because physics simulation uses
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    24
 * "real" units. The idea is that this class is used with "real" units
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    25
 * and it uses pixelcoordinates internally.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    26
 */ 
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    27
class Terrain {
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    28
public: // XXX: until we fix Network's access to this
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    29
    std::vector<std::vector<TerrainType> > terrain;    
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    30
    
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    31
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    32
     * Generates pixelbuffer from terrain. Should be used only on
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    33
     * constructors because this is expected to be slow.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    34
     */
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    35
    void generatePixelBuffer();
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    36
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    37
protected:
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    38
    // terrain dimensions
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    39
    PixelDimension map_width, map_height;
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    40
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    41
    // We can pre-render the terrain as a pixel buffer and then just modify this
203
3ec7ab40755f send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents: 185
diff changeset
    42
    CL_PixelBuffer pixbuf;
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    43
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    44
    // terrain texture
243
25d9a0090397 some generated texture
nireco
parents: 222
diff changeset
    45
    std::vector<std::vector<int> > texture;
25d9a0090397 some generated texture
nireco
parents: 222
diff changeset
    46
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    47
    /**
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    48
     * Default constructor. The width/height are set to zero and the terrain is invalid until it gets updated
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    49
     *
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    50
     * @param scale The "real" width and height of the terrain.
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    51
     */
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    52
    Terrain (void);
203
3ec7ab40755f send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents: 185
diff changeset
    53
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    54
    /**
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    55
     * Constructor.
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    56
     *
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    57
     * @param scale The "real" width and height of the terrain.
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    58
     * @param seed Random number generator seed used to create the
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    59
     * terrain.
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    60
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    61
    Terrain (PixelDimension map_width, PixelDimension map_height, int seed);
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    62
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    63
    /**
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    64
     * Copy constructor.
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    65
     *
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    66
     * @param t Terrain to be copied.
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    67
     */
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    68
    Terrain (const Terrain &t);
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    69
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    70
    /**
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    71
     * Destructor
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    72
     */
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    73
    ~Terrain (void) {}
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    74
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    75
protected:
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    76
    void generate_texture();
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    77
    void noisifyPixel(CL_Color& col, PixelCoordinate pc);
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    78
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    79
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    80
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    81
     * Scale parameter to "pixels"
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    82
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    83
     * @param x Scaled value
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    84
     * @return Corresponding value in pixels
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    85
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    86
    PixelDimension scale (float x) const;
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    87
243
25d9a0090397 some generated texture
nireco
parents: 222
diff changeset
    88
    /**
25d9a0090397 some generated texture
nireco
parents: 222
diff changeset
    89
     * Sets to color the correct color of pixel in (x,y)
25d9a0090397 some generated texture
nireco
parents: 222
diff changeset
    90
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    91
    void loadPixelColor (CL_Color& color, PixelCoordinate pc);
243
25d9a0090397 some generated texture
nireco
parents: 222
diff changeset
    92
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    93
 public:
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    94
    /**
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    95
     * Get pixel location of a point that is in "real" units.
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    96
     *
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    97
     * @param point Point in "real" units
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    98
     * @return Int vector
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
    99
     */
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   100
    PixelCoordinate getPixelCoordinate (Vector point) const;
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   101
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   102
    /**
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   103
     * Return the terrain dimensions à la a PixelCoordinate
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   104
     */
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   105
    PixelCoordinate getDimensions (void) const;
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   106
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   107
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   108
     * Return the type of terrain at given position. Returns ROCK if
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   109
     * given point is not inside terrain area.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   110
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   111
     * @param x X coordinate
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   112
     * @param y Y coordinate
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   113
     * @return Terrain type
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   114
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   115
    TerrainType getType (PixelDimension px, PixelDimension py) const;
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   116
    TerrainType getType (PixelCoordinate pc) const;
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   117
    TerrainType getType (Vector point) const;
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   118
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   119
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   120
     * Check if given point has some terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   121
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   122
     * @param point Point that is in scaled units.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   123
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   124
    bool collides (const Vector &point) const;
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   125
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   126
     * Check if given line collides with terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   127
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   128
     * @param begin Line begin point in scaled units.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   129
     * @param end Line end point in scaled units.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   130
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   131
    bool collides (const Vector &begin, const Vector &end) const;
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   132
    
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   133
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   134
     * Remove a circular area from terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   135
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   136
     * @param pos Circle center
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   137
     * @param r Circle radius
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   138
     */ 
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   139
    void removeGround (const Vector &pos, float r);
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   140
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   141
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   142
     * Return normal for the given point.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   143
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   144
     * @param point Point for which the normal is calculated.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   145
     * @return Normal vector ((0,0) if there's no terrain)
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   146
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   147
    Vector getNormal (Vector point, Vector prevPoint) const;
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   148
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   149
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   150
     * Generate random terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   151
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   152
     * @param seed Seed for the randomnumber generator.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   153
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   154
    void generateTerrain (int seed);
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   155
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   156
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   157
     * Draw the terrain for given graphicscontext.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   158
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   159
     * @param gc CL_GraphicContext
248
e40ef56dc62c scrolling looks like it works
nireco
parents: 243
diff changeset
   160
     * @param camera - upper left corner of screen
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   161
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   162
    virtual void draw (Graphics *g, PixelCoordinate camera = PixelCoordinate(0, 0));
222
293ddf4c067d reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents: 203
diff changeset
   163
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   164
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   165
     * Draw part of the terrain for given graphiscontext.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   166
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   167
     * @param gc CL_GraphicContext
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   168
     * @param center Center of the rectangle drawn.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   169
     * @param dimension Dimensions of the rectangle.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   170
     */
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   171
    //void draw(CL_GraphicContext &gc, Vector center, Vector dimensions);
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   172
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   173
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   174
     * Set terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   175
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   176
     * @param terrain Terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   177
     */
255
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   178
    void setTerrain (const std::vector<std::vector<TerrainType> > &terrain);
99431fdb0dc8 add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
terom
parents: 248
diff changeset
   179
    
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   180
    /**
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   181
     * Get terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   182
     *
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   183
     * @return Terrain.
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   184
     */
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   185
    std::vector<std::vector<TerrainType> > getTerrain() const;
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   186
};
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   187
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
   188
#endif