Subversion Repositories shark

Rev

Rev 1665 | Blame | Compare with Previous | Last modification | View Log | RSS feed

//////////////////////////////////////////////////////////////////
// Pong
// Written for CS 324, UIUC
// Spencer Hoke
// James Kim
// Tao Luo
//
// Last Modified: April 29, 2004
//
// Initial values for global variables are
// set in function setglobals() in pong.c

#ifndef _PONG_H_
#define _PONG_H_

#include <kernel/kern.h>
#include <kernel/func.h>
#include <kernel/types.h>
#include <kernel/descr.h>
#include <drivers/shark_fb26.h>
#include <drivers/shark_keyb26.h>
#include <modules/pi.h>
#include <stdlib.h>
#include <ll/ll.h>
#include <math.h>

#define JET_ON
#define JET_GROUP    3

#define WCET_JETCTRL      7500
#define WCET_JETDUMMY      200
#define WCET_JETSLIDE     2300

#define PERIOD_JETCTRL  100000
#define PERIOD_JETDUMMY 100000
#define PERIOD_JETSLIDE 100000

#define JET_NTASK   28
#define JET_Y_NAME 240

#define DUMMY_PID    1

#define JET_DUMMY_WIDTH    100
#define JET_DUMMY_HEIGHT    60

#define JET_DUMMY_X        390
#define JET_DUMMY_Y        160

#define JET_SLIDE_WIDTH    120
#define JET_SLIDE_X        510

#define black              vga16color[0]     // some colors for 8-bit graphics
#define green              vga16color[2]
#define ltblue             vga16color[3]
#define red                vga16color[4]
#define purple             vga16color[5]
#define orange             vga16color[6]
#define gray               vga16color[7]
#define dkgray             vga16color[8]
#define blue               vga16color[9]
#define lime               vga16color[10]
#define bluegreen          vga16color[11]
#define redorange          vga16color[12]
#define magenta            vga16color[13]
#define yellow             vga16color[14]
#define white              vga16color[15]

extern int vga16color[16];

void init_jetcontrol();          // init functions for jetcontrol
void scenario_jetcontrol();

int     P_MASS;                  // mass of the paddle, should be greater than kp because of how acceleration is implemented
int     kp;
int     kd;                      // > sqrt(4*(XMAX - XMIN)* kp)
int     AI_VIEWING_RANGE;        // how close does the ball needs to be before the AI notices it

#define MAX_BALLS 35

#define XMENU     350            // menu level
#define YMENU     10

#define XMIN      14             // main window area
#define XMAX      330
#define YMIN      50
#define YMAX      450

int     num_balls;               // number of balls currently in system
int     min_balls;               // minimum number of balls in the system
int     locked;                  // 1 if #balls kept constant
int     ball_spd;                // ballspeed (default = 5)
#define ANGMAX    60             // max starting angle
#define ANGMIN    15             // min starting angle
#define RAD       3              // radius of balls

//#define MAX_P     35             // max number of balls
#define BALLGROUP 1
#define BALL_PER  40000          // task period
#define BALL_WCET 750            // task wcet

int     p_speed;                 // # pixels to move each keypress
#define P_THICKNESS 3            // pixel thickness of paddles
#define P_DLENGTH 5              // delta length for paddles
int     p1_length;               // size of the paddles
int     p2_length;               // size of the paddles
int     p1_pos;                  // x position of left side of paddles
int     p2_pos;
int     p2_target_pos;           // best position for paddle 2
int     p1_move;                 // + to move right, - to move left
#define PGROUP    2
#define P_PER     40000
#define P_WCET    250

int     points1;                 // scores for each side
int     points2;

mutex_t   draw_mutex;            // used for calls to grx functions
mutex_t   list_mutex;            // used for balllist access

typedef struct ballinfo{
    int x, y, theta;
    struct ballinfo *prev;       // double linked list
    struct ballinfo *next;
} ballinfo;

struct ballinfo *balllist;       // head of list of balls

#endif  /* _PONG_H_ */