File: course_load.h

package info (click to toggle)
ppracer 0.3.1-11
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 9,916 kB
  • ctags: 3,049
  • sloc: cpp: 24,190; sh: 3,544; tcl: 2,450; makefile: 612; lisp: 87
file content (126 lines) | stat: -rw-r--r-- 3,464 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* 
 * PPRacer 
 * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
 *
 * Copyright (C) 1999-2001 Jasmin F. Patry
 * 
 * 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.
 */

#include "pp_types.h"
#include "pp_classes.h"

#include "ppgltk/ppgltk.h"

#include "ppgltk/model.h"


#include <list>
#include <string>

#ifndef _COURSE_LOAD_H_
#define _COURSE_LOAD_H_

#define STRIDE_GL_ARRAY ( 8 * sizeof(GLfloat) + 4 * sizeof(GLubyte) )

/* Convenience macro for accessing terrain elevations */
#define ELEV(x,y) ( elevation[(x) + nx*(y)] )

/* Convenience acro to create a course vertex */
#define COURSE_VERTEX(x,y) pp::Vec3d( (float)(x)/(nx-1.)*course_width, \
                       ELEV((x),(y)), -(float)(y)/(ny-1.)*course_length ) 

void load_course( std::string& course );

float     *get_course_elev_data();
int    *get_course_terrain_data();
float      get_course_angle();
void          get_course_dimensions( float *width, float *length );
void          get_play_dimensions( float *width, float *length );
float      get_terrain_base_height( float distance );
float      get_terrain_max_height( float distance );
void          get_course_divisions( int *nx, int *ny );
Tree       *get_tree_locs();
int           get_num_trees();
void          set_start_pt( pp::Vec2d p );
pp::Vec2d     get_start_pt();
pp::Polyhedron*  get_tree_polyhedron( int type );
const char         *get_tree_name(int type);

std::string& get_course_author();
std::string& get_course_name(); 

light_t      *get_course_lights();
void          set_course_mirroring( bool state );
bool        get_course_mirroring( );
void          fill_gl_arrays();
void          get_gl_arrays( GLubyte **vertex_normal_arr );

void          register_course_load_tcl_callbacks( Tcl_Interp *interp );

Item       *get_item_locs();
int           get_num_items();
const char         *get_item_name(int type);

typedef struct {
	std::string name;
    double height;
	double diam;
    int  num_trees;
    unsigned char red, green, blue;
    std::list<pp::Vec2d> pos;
	pp::Model* model;
	pp::Polyhedron* ph;
} tree_type_t;

typedef struct {
    std::string name;
    std::string texture;
    double diam, height;
    double above_ground;
    unsigned char red, green, blue;
    //bool nocollision;
	Item::Type type;
	int score;
    bool reset_point;
    std::list<pp::Vec2d> pos;
    int  num_items;
    bool use_normal;
    pp::Vec3d normal;
} item_type_t;

typedef struct {
    int type;
	int value;
	double friction;
	double compression;
	GLuint texbind;
	GLuint partbind;
	GLuint envmapbind;
	std::string sound;
	bool soundactive;
	struct { GLuint head,mark,tail; }trackmark;
	int wheight;
	int count;
} terrain_tex_t;


item_type_t*	get_item_types();
int		get_num_item_types();


extern std::list<int> usedTerrains;

#endif