-
Notifications
You must be signed in to change notification settings - Fork 2
/
game_ctrl.h
170 lines (141 loc) · 3.53 KB
/
game_ctrl.h
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* --------------------------------------------------------------------
EXTREME TUXRACER
Copyright (C) 2010 Extreme Tuxracer Team
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.
---------------------------------------------------------------------*/
#ifndef GAME_CTRL_H
#define GAME_CTRL_H
#include "bh.h"
#include "tux.h"
#include "keyframe.h"
#define MAX_RACES2 256
#define MAX_CUPS2 64
#define MAX_EVENTS2 16
#define MAX_RACES_PER_CUP 6
#define MAX_CUPS_PER_EVENT 12
typedef struct {
string race;
int course;
int light;
int snow;
int wind;
TIndex3 herrings;
TVector3 time;
int music_theme;
} TRace2;
typedef struct {
string cup;
string name;
string desc;
int num_races;
int races[MAX_RACES_PER_CUP];
} TCup2;
typedef struct {
string name;
int num_cups;
int cups[MAX_CUPS_PER_EVENT];
} TEvent2;
class CEvents {
private:
string RaceIndex;
string CupIndex;
string EventIndex;
bool Unlocked [MAX_EVENTS2][MAX_CUPS_PER_EVENT+1];
public:
CEvents ();
~CEvents ();
TRace2 RaceList[MAX_RACES2];
int numRaces;
TCup2 CupList[MAX_CUPS2];
int numCups;
TEvent2 EventList[MAX_EVENTS2];
int numEvents;
bool LoadEventList ();
int GetRaceIdx (string race);
int GetCupIdx (string cup);
int GetEventIdx (string event);
string GetCup (int event, int cup);
string GetCupTrivialName (int event, int cup);
void MakeUnlockList (string unlockstr);
bool IsUnlocked (int event, int cup);
};
extern CEvents Events;
// --------------------------------------------------------------------
// player
// --------------------------------------------------------------------
#define MAX_PLAYERS 16
#define MAX_AVATARS 32
typedef struct {
string name;
CControl *ctrl;
string funlocked;
GLuint texid;
string avatar;
} TPlayer;
typedef struct {
string filename;
GLuint texid;
} TAvatar;
class CPlayers {
private:
TPlayer plyr[MAX_PLAYERS];
int currPlayer;
void SetDefaultPlayers ();
string AvatarIndex;
TAvatar avatars[MAX_AVATARS];
public:
CPlayers ();
~CPlayers ();
int numPlayers;
int numAvatars;
string GetCurrUnlocked ();
void AddPassedCup (string cup);
void AddPlayer (string name, string avatar);
bool LoadPlayers ();
void SavePlayers ();
CControl *GetCtrl (); // current player
CControl *GetCtrl (int player);
string GetName (int player);
void ResetControls ();
void AllocControl (int player);
void LoadAvatars ();
GLuint GetAvatarID (int player);
GLuint GetAvatarID (string filename);
GLuint GetDirectAvatarID (int avatar);
string GetDirectAvatarName (int avatar);
};
extern CPlayers Players;
// -------------------------------- characters ------------------------
#define MAX_CHARACTERS 16
typedef struct {
int type;
string name;
string dir;
GLuint preview;
CCharShape *shape;
CKeyframe frames[NUM_FRAME_TYPES];
bool finishframesok;
} TCharacter;
class CCharacter {
private:
int curr_character;
public:
CCharacter ();
~CCharacter ();
TCharacter CharList [MAX_CHARACTERS];
int numCharacters;
void Draw (int idx);
CCharShape *GetShape (int idx);
void LoadCharacterList ();
void FreeCharacterPreviews ();
CKeyframe *GetKeyframe (int idx, TFrameType type);
};
extern CCharacter Char;
#endif