Subversion Repositories shark

Rev

Rev 1665 | Details | Compare with Previous | 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>
1667 giacomo 20
#include <drivers/shark_fb26.h>
21
#include <drivers/shark_keyb26.h>
1665 pj 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
 
1667 giacomo 52
#define black              vga16color[0]     // some colors for 8-bit graphics
53
#define green              vga16color[2]
54
#define ltblue             vga16color[3]
55
#define red                vga16color[4]
56
#define purple             vga16color[5]
57
#define orange             vga16color[6]
58
#define gray               vga16color[7]
59
#define dkgray             vga16color[8]
60
#define blue               vga16color[9]
61
#define lime               vga16color[10]
62
#define bluegreen          vga16color[11]
63
#define redorange          vga16color[12]
64
#define magenta            vga16color[13]
65
#define yellow             vga16color[14]
66
#define white              vga16color[15]
1665 pj 67
 
1667 giacomo 68
extern int vga16color[16];
69
 
1665 pj 70
void init_jetcontrol();          // init functions for jetcontrol
71
void scenario_jetcontrol();
72
 
73
int     P_MASS;                  // mass of the paddle, should be greater than kp because of how acceleration is implemented
74
int     kp;
75
int     kd;                      // > sqrt(4*(XMAX - XMIN)* kp)
76
int     AI_VIEWING_RANGE;        // how close does the ball needs to be before the AI notices it
77
 
78
#define MAX_BALLS 35
79
 
80
#define XMENU     350            // menu level
81
#define YMENU     10
82
 
83
#define XMIN      14             // main window area
84
#define XMAX      330
85
#define YMIN      50
86
#define YMAX      450
87
 
88
int     num_balls;               // number of balls currently in system
89
int     min_balls;               // minimum number of balls in the system
90
int     locked;                  // 1 if #balls kept constant
91
int     ball_spd;                // ballspeed (default = 5)
92
#define ANGMAX    60             // max starting angle
93
#define ANGMIN    15             // min starting angle
94
#define RAD       3              // radius of balls
95
 
96
//#define MAX_P     35             // max number of balls
97
#define BALLGROUP 1
98
#define BALL_PER  40000          // task period
99
#define BALL_WCET 750            // task wcet
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