Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1085 | pj | 1 | /********************************simcity.h***************************/ |
2 | // global variables and tasks bodies declaration |
||
3 | |||
4 | #include <kernel/func.h> |
||
5 | #include <semaphor.h> |
||
6 | #ifndef CST |
||
7 | #include "constant.h" |
||
8 | #endif |
||
9 | |||
10 | /*Global stuff*/ |
||
11 | |||
12 | extern car_data car_data_array[MAX_CAR]; |
||
13 | extern tl_data tl_data_array[MAX_TL]; |
||
14 | |||
15 | //car starting points |
||
16 | extern starting_set starting_set_array[S_POINT]; |
||
17 | |||
18 | // PID vectors |
||
19 | extern PID p_table[MAX_CAR]; |
||
20 | extern PID c_table[MAX_CAR]; |
||
21 | extern PID g_table[MAX_CAR]; |
||
22 | extern PID a_table[MAX_CAR]; |
||
23 | |||
24 | extern char kill_flag[MAX_CAR]; |
||
25 | //graphic mutex |
||
26 | extern sem_t mutex; |
||
27 | |||
28 | //kill_flag mutexes |
||
29 | extern sem_t kill_mutex[MAX_CAR]; |
||
30 | |||
31 | //various sprites |
||
32 | extern DWORD macchine[ROW][COL][NCAR]; |
||
33 | extern DWORD strada[H][W]; |
||
34 | extern BYTE street[H*W*2]; |
||
35 | extern BYTE vbuf[MAX_CAR][ROW*COL*2]; |
||
36 | extern BYTE clrcam[(ROW+2)*(COL+2)*2]; |
||
37 | extern BYTE gauge_img[ROW*COL*2]; |
||
38 | extern BYTE brk_gauge[ROW*COL*2]; |
||
39 | extern BYTE arrow[3][ROW*COL*2]; |
||
40 | extern DWORD sprites[ROW][COL][NO_SPRITE]; |
||
41 | extern BYTE clrscr[800*600*2]; |
||
42 | extern DWORD faces[2][74][47]; |
||
43 | |||
44 | extern char sens; |
||
45 | //sine & cosine look-up tables |
||
46 | extern float cosine[360],sine[360]; |
||
47 | |||
48 | //traffic light sprites |
||
49 | extern DWORD y_sem[4][SH][SW]; |
||
50 | extern DWORD r_sem[4][SH][SW]; |
||
51 | extern DWORD g_sem[4][SH][SW]; |
||
52 | |||
53 | //useful colors |
||
54 | extern DWORD white; |
||
55 | extern DWORD black; |
||
56 | extern DWORD red; |
||
57 | extern DWORD gray; |
||
58 | extern DWORD blue; |
||
59 | extern DWORD green; |
||
60 | extern DWORD border; |
||
61 | extern DWORD tl_bg; |
||
62 | |||
63 | //task chain pointers |
||
64 | extern car_data *free_n,*busy_n,*free_o,*busy_o; |
||
65 | // car counter |
||
66 | extern short maxc; |
||
67 | |||
68 | /*function declaration */ |
||
69 | |||
70 | /* task bodies*/ |
||
71 | TASK car(car_data *); |
||
72 | TASK traffic_light(tl_data *); |
||
73 | TASK camera(int); |
||
74 | TASK gauge_c(int); |
||
75 | TASK blink_arrow(int); |
||
76 | TASK refresher(void *); |
||
77 | TASK killer(void *); |