~ubuntu-branches/ubuntu/lucid/tuxtype/lucid-proposed

« back to all changes in this revision

Viewing changes to tuxtype/playgame.h

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2006-10-30 13:48:49 UTC
  • mfrom: (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20061030134849-5fdruftday0c02gs
Tags: 1.5.6.dfsg1-3ubuntu1
Merge from debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#define __PLAYGAME_H__
21
21
 
22
22
//definitions
23
 
#define RIGHT 0
24
 
#define LEFT 1
25
 
#define RIGHT_LEFT 2
26
 
#define NUM_BACKGROUNDS 4
27
 
#define GRAPHIC_SPACE 4 //space between each status bar element
 
23
#define GRAPHIC_SPACE 4 //space between each status bar element in cascade
28
24
 
29
25
#define NUM_NUMS 10     //"Mmmmm....Num-Nums...."
30
 
#define NUM_LETTERS 26
31
 
#define NOT_A_LETTER NUM_LETTERS + 2
32
 
 
33
 
//word cascade specific defs
34
 
#define NUM_WORDS 200
35
 
#define MAX_WORD_SIZE 7         //no words more than 7 chars
36
26
 
37
27
#define CONGRATS_FRAMES 2       //number of frames for congrats animation
38
 
//#define CONGRATS_ONSCREEN 4
39
28
#define OH_NO_FRAMES 1  //number of frames for "oh no!" losing animation
40
 
//#define OH_NO_ONSCREEN        4
41
 
#define FRAME_MAX 80    //maximum number of counter frames before looping frame counter to 0
42
29
#define MAX_END_FRAMES_BETWEEN_LEVELS 350       //number of frames between levels
43
30
#define MAX_END_FRAMES_WIN_GAME 750     //number of frames at ending animation
44
31
#define MAX_END_FRAMES_GAMEOVER 400     //number of frames at game over
47
34
#define WIN_GAME_YAMP 4 //the yamplitude of winning game text circular motion
48
35
#define WIN_GAME_ANGLE_MULT 4   //the angle multiplier for winning game te xt circ motion
49
36
 
50
 
//tux defs
51
 
#define WALK_FRAMES 4   //number of walking frames
52
 
#define STAND_FRAMES 2  //number of standing frames
53
 
#define RUN_FRAMES 2    //number of running frames
54
 
#define GULP_FRAMES 4   //number of gulping frames
55
 
#define WIN_FRAMES 1    //number of winning frames
56
 
#define YIPE_FRAMES 1   //number of hurting frames
57
 
//tux frame types
58
 
#define WALKING                         1
59
 
#define STANDING                        2
60
 
#define RUNNING                         3
61
 
#define GULPING                         4
62
 
#define WINNING                         6
63
 
#define YIPING                          7
64
37
//tux frame lengths (number of frames each cell of animation frames on-screen)
65
38
#define WALK_ONSCREEN   10
66
39
#define RUN_ONSCREEN    8
80
53
#define MAX_FISHIES_MEDIUM      30
81
54
#define MAX_FISHIES_HARD        40
82
55
#define MAX_FISHIES_DIGITS      2
83
 
#define FISHY_FRAMES    4
 
56
 
84
57
#define FISHY_ONSCREEN  10
85
58
#define SPLAT_FRAMES    1
86
59
#define SPLAT_ONSCREEN  4
87
 
//#define DEFAULT_SPEED                 .6
88
60
#define DEFAULT_SPEED   .3
89
61
 
90
 
//fishy math - EASY
91
 
#define MAX_AMPLITUDE_EASY              1
92
 
#define MAX_PHASE_EASY                  1
93
 
#define MAX_ANGLE_EASY                  1
94
 
#define MAX_SPEED_VARIANCE_EASY         1
95
 
#define FISH_SPACING_EASY               90
96
 
#define EASY_LIVES_INIT                 5
97
 
//fishy math - MEDYUM
98
 
#define MAX_AMPLITUDE_MEDIUM            2
99
 
#define MAX_PHASE_MEDIUM                5
100
 
#define MAX_ANGLE_MEDIUM                .1
101
 
#define MAX_SPEED_VARIANCE_MEDIUM       1
102
 
#define FISH_SPACING_MEDIUM             40
103
 
#define MEDIUM_LIVES_INIT               7
104
 
//fishy math - HARD
105
 
#define MAX_AMPLITUDE_HARD      3
106
 
#define MAX_PHASE_HARD          5
107
 
#define MAX_ANGLE_HARD          .1
108
 
#define MAX_SPEED_VARIANCE_HARD 2
109
 
#define FISH_SPACING_HARD       30
110
 
#define HARD_LIVES_INIT         9
 
62
#define MAX_SPEED_EASY       0.4
 
63
#define MAX_SPEED_MEDIUM     0.9
 
64
#define MAX_SPEED_HARD       1.2
 
65
 
 
66
#define FISH_SPACING_EASY    90
 
67
#define FISH_SPACING_MEDIUM  40
 
68
#define FISH_SPACING_HARD    30
 
69
 
 
70
#define LIVES_INIT_EASY      5
 
71
#define LIVES_INIT_MEDIUM    7
 
72
#define LIVES_INIT_HARD      9
111
73
 
112
74
#define MAX_UPDATES     3*(20+MAX_FISHIES_HARD) //20 to account for text updates (I hope)
113
75
 
115
77
 note that 128 is optimized for speed! */
116
78
#define DEFAULT_ALPHA 128
117
79
 
118
 
//game play structures
119
 
typedef struct {
120
 
    int frames;                 //number of frames to display this object
121
 
    SDL_Surface *image[RIGHT_LEFT];
122
 
} rl_object;                    //right-left object
123
 
 
124
80
typedef struct {
125
81
    int frames;                 //number of frames to display this object
126
82
    SDL_Surface *image;
128
84
 
129
85
struct fishypoo {
130
86
    int alive;
131
 
    int endframe;
132
 
    int curframe;
133
 
    int letter;
 
87
    int can_eat;
 
88
    unsigned char *word;
134
89
    double x, y;
135
 
    double x0;
 
90
    int    w;
 
91
    int    len;
 
92
    int    splat_time;
136
93
    double dy;
137
 
    double x_amplitude;
138
 
    double x_phase;
139
 
    double x_angle_mult;
140
94
} fish_object[MAX_FISHIES_HARD + 1];
141
95
 
142
96
struct fishypoo null_fishy;
143
97
 
144
 
struct wordypoo {
145
 
    int alive;
146
 
    int eaten;
147
 
    int endframe;
148
 
    int curframe;
149
 
    char *word;
150
 
    double x, y;
151
 
    double x0;
152
 
    double dy;
153
 
    double x_amplitude;
154
 
    double x_phase;
155
 
    double x_angle_mult;
156
 
} word_object[MAX_FISHIES_HARD + 1];
157
 
 
158
 
struct wordypoo null_word;
 
98
enum {
 
99
        TUX_WALKING,
 
100
        TUX_STANDING,
 
101
        TUX_RUNNING,
 
102
        TUX_GULPING,
 
103
        TUX_WINNING,
 
104
        TUX_YIPING,
 
105
        TUX_NUM_STATES
 
106
};
 
107
 
 
108
static unsigned char* tux_sprite_fns[TUX_NUM_STATES] = {
 
109
        "tux/walk",
 
110
        "tux/stand",
 
111
        "tux/run",
 
112
        "tux/gulp",
 
113
        "tux/win",
 
114
        "tux/yipe"
 
115
};
 
116
 
 
117
#define RIGHT 0
 
118
#define LEFT 1
159
119
 
160
120
struct tuxguy {
161
121
    int facing;
162
122
    double x, y;
163
123
    double dx, dy;
 
124
    sprite *spr[TUX_NUM_STATES][2];
164
125
    int endx, endy;
165
 
    int endframe;
166
 
    int frametype;
167
 
    int curframe;
168
 
    int letter;
169
 
    char word[MAX_WORD_SIZE + 1];
 
126
    int state;
 
127
    int wordlen;
 
128
    unsigned char word[MAX_WORD_SIZE + 1];
170
129
} tux_object;
171
130
 
172
131
struct splatter {
173
132
    double x, y;
174
133
    int alive;
175
 
    int curframe;
176
 
    int endframe;
177
134
} splat_object[MAX_FISHIES_HARD + 1];
178
135
 
179
136
struct splatter null_splat;
180
137
 
181
 
#define DIRLEN          2
182
 
const char DIR[RIGHT_LEFT][DIRLEN] = { "r", "l" };
183
 
#define TOT_BAD_CHARS 8
184
 
const int BAD_CHARS[TOT_BAD_CHARS] =
185
 
    { '#', '!', '@', '$', '%', '^', '&', '*' };
186
 
 
187
 
//Practice definitions
188
 
#define PKCASCADE_TUT_SCREENS           6
189
 
#define PRACT_TUX_Y                     10
190
 
//KCASCADE, FIRST FRAME
191
 
#define DEFAULT_TUT1_FISH_SPEED .5
192
 
#define TUT1_ENDFRAME           500
193
 
//KCASCADE. SECOND FRAME
194
 
#define DEFAULT_TUT2_FISH_SPEED .35
195
 
#define TUX2_DX1                1
196
 
#define TUX2_ENDX_GOTO1         10
197
 
//KCASCADE. THIRD FRAME
198
 
#define DEFAULT_TUT3_FISH_SPEED .8
199
 
#define TUX3_DX1                1
200
 
#define TUX3_ENDX_GOTO1         10
201
 
#define FISH3_MAX_Y             10
202
 
//KCASCADE. FOURTH FRAME
203
 
#define DEFAULT_TUT4_FISH_SPEED .5
204
 
#define TUX4_DX1                1.5
205
 
#define FISH4_MAX_Y             10
206
 
 
207
 
const char WORD_PATH[PATHNUM][FNLEN] =
208
 
    { ".", "data", "/usr/local/share/tuxtype", "/usr/share/tuxtype",
209
 
        "../data", "/usr/share/pixmaps/tuxtype" };
210
 
 
211
 
#endif                          //KCASCADE. FOURTH FRAMEsplay this object6s --*/ __PLAYGAME_H__
 
138
#endif