Subversion Repositories shark

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1665 pj 1
//////////////////////////////////////////////////////////////////
2
// Pong
3
// Written for CS 324, UIUC
4
// Spencer Hoke
5
// James Kim
6
// Tao Luo
7
//
8
// Last Modified: April 29, 2004
9
//
10
// Initial values for global variables are
11
// set in function setglobals() in pong.c
12
 
13
#ifndef _PONG_H_
14
#define _PONG_H_
15
 
16
#include <kernel/kern.h>
17
#include <kernel/func.h>
18
#include <kernel/types.h>
19
#include <kernel/descr.h>
20
#include <drivers/glib.h>
21
#include <drivers/keyb.h>
22
#include <modules/pi.h>
23
#include <stdlib.h>
24
#include <ll/ll.h>
25
#include <math.h>
26
 
27
#define JET_ON
28
#define JET_GROUP    3
29
 
30
#define WCET_JETCTRL      7500
31
#define WCET_JETDUMMY      200
32
#define WCET_JETSLIDE     2300
33
 
34
#define PERIOD_JETCTRL  100000
35
#define PERIOD_JETDUMMY 100000
36
#define PERIOD_JETSLIDE 100000
37
 
38
#define JET_NTASK   28
39
#define JET_Y_NAME 240
40
 
41
#define DUMMY_PID    1
42
 
43
#define JET_DUMMY_WIDTH    100
44
#define JET_DUMMY_HEIGHT    60
45
 
46
#define JET_DUMMY_X        390
47
#define JET_DUMMY_Y        160
48
 
49
#define JET_SLIDE_WIDTH    120
50
#define JET_SLIDE_X        510
51
 
52
#define black              0     // some colors for 8-bit graphics
53
#define green              2
54
#define ltblue             3
55
#define red                4
56
#define purple             5
57
#define orange             6
58
#define gray               7
59
#define dkgray             8
60
#define blue               9
61
#define lime               10
62
#define bluegreen          11
63
#define redorange          12
64
#define magenta            13
65
#define yellow             14
66
#define white              15
67
 
68
void init_jetcontrol();          // init functions for jetcontrol
69
void scenario_jetcontrol();
70
 
71
int     P_MASS;                  // mass of the paddle, should be greater than kp because of how acceleration is implemented
72
int     kp;
73
int     kd;                      // > sqrt(4*(XMAX - XMIN)* kp)
74
int     AI_VIEWING_RANGE;        // how close does the ball needs to be before the AI notices it
75
 
76
#define MAX_BALLS 35
77
 
78
#define XMENU     350            // menu level
79
#define YMENU     10
80
 
81
#define XMIN      14             // main window area
82
#define XMAX      330
83
#define YMIN      50
84
#define YMAX      450
85
 
86
int     num_balls;               // number of balls currently in system
87
int     min_balls;               // minimum number of balls in the system
88
int     locked;                  // 1 if #balls kept constant
89
int     ball_spd;                // ballspeed (default = 5)
90
#define ANGMAX    60             // max starting angle
91
#define ANGMIN    15             // min starting angle
92
#define RAD       3              // radius of balls
93
 
94
//#define MAX_P     35             // max number of balls
95
#define BALLGROUP 1
96
#define BALL_PER  40000          // task period
97
#define BALL_WCET 750            // task wcet
98
 
99
#define ESC       27             // ASCII code of ESCAPE key
100
 
101
int     p_speed;                 // # pixels to move each keypress
102
#define P_THICKNESS 3            // pixel thickness of paddles
103
#define P_DLENGTH 5              // delta length for paddles
104
int     p1_length;               // size of the paddles
105
int     p2_length;               // size of the paddles
106
int     p1_pos;                  // x position of left side of paddles
107
int     p2_pos;
108
int     p2_target_pos;           // best position for paddle 2
109
int     p1_move;                 // + to move right, - to move left
110
#define PGROUP    2
111
#define P_PER     40000
112
#define P_WCET    250
113
 
114
int     points1;                 // scores for each side
115
int     points2;
116
 
117
mutex_t   draw_mutex;            // used for calls to grx functions
118
mutex_t   list_mutex;            // used for balllist access
119
 
120
typedef struct ballinfo{
121
    int x, y, theta;
122
    struct ballinfo *prev;       // double linked list
123
    struct ballinfo *next;
124
} ballinfo;
125
 
126
struct ballinfo *balllist;       // head of list of balls
127
 
128
#endif  /* _PONG_H_ */
129