1 /*
2  *		     PLEASE DO NOT EDIT THIS FILE
3  *		see documentation for more information
4  *
5  *
6  *                  System Independent Trojka Core
7  *                Copyright (c) 1989-1996 Maarten Los
8  *                             --------
9  */
10 
11 #ifndef _trojka_core_h_
12 #define _trojka_core_h_
13 
14 /*
15  *	constants
16  */
17 #define tc_trojka	3	/* the magic number */
18 #define tc_trojkabonus	3333	/* the magic bonus */
19 #define tc_spiderbonus  6666	/* the spider bonus */
20 #define tc_bigspiderbonus 9999	/* the big spider bonus */
21 #define tc_bottombonus	999	/* bonus if you hit the bottom */
22 
23 
24 #define tc_min_speed	1	/* minimum speed */
25 #define tc_max_speed	9	/* maximum speed */
26 #define tc_speed_switch	100	/* # of blocks at which speed is increased */
27 #define	tc_pm_top	20	/* these constants are for the matrix */
28 #define tc_pm_bottom	 1	/* see tr_core.doc */
29 #define tc_v_xsize	 5
30 #define tc_v_ysize	22
31 #define tc_virt_middle	 2
32 
33 #define tc_clear	 0	/* clear cell in the playing field */
34 #define tc_tagged	-1	/* cell is tagged for wiping */
35 
36 #define tc_blocks	5	/* number of different blocks */
37 
38 #define tc_layouts	42	/* number of different layouts */
39 #define tc_layout_mask	0x03	/* for layout magic */
40 	/*
41 	 *	return, command and parameter values
42 	 */
43 
44 #define		tc_c_init	1
45 #define		tc_c_blockdown	2
46 #define		tc_c_blockleft	3
47 #define		tc_c_blockright	4
48 #define		tc_c_dropblock	5
49 #define		tc_c_speedup	6
50 #define		tc_c_setspeed	7
51 #define 	tc_c_drawfield	8
52 #define		tc_c_setwizard	9
53 
54 #define		tc_i_touchdown	1
55 #define		tc_i_dropblock	2
56 #define		tc_i_force	3
57 
58 #define		tc_res_normal		1
59 #define		tc_res_gameover		2
60 #define		tc_res_touchdown	3
61 
62 
63 
64 /*
65  *	types
66  */
67 typedef char		tt_char;
68 typedef char		tt_bool;
69 typedef int		tt_int;
70 typedef unsigned long	tt_long;
71 typedef int		tt_layout[5];	/* for wizard patterns */
72 typedef struct _tt_command {
73 	tt_int	command;
74 	tt_long param1;
75 	tt_long param2;
76 	tt_long reserved_1;
77 	tt_long reserved_2;
78 } tt_command;		/* command for the trojka api */
79 
80 
81 
82 
83 /************************************************************************
84  * This part provides the API between the trojka core and the
85  * implementation
86  ************************************************************************/
87 
88 /*
89  *	the standard call to the trojka api
90  */
91 extern int trojka_api(tt_command*);
92 
93 
94 /*
95  *	these callback functions must be provided by the programmer and
96  *	are called from within the trojka core (tr_core.c)
97  */
98 extern void trojka_make_block_callback(tt_int, tt_int, tt_int);
99 extern void trojka_wipe_block_callback(tt_int, tt_int);
100 extern void trojka_explode_callback(tt_int, tt_int);
101 extern void trojka_trojka_callback(tt_long);
102 extern void trojka_speedup_callback(tt_int);
103 extern void trojka_spider_callback(tt_long);
104 extern void trojka_bottom_callback(tt_long);
105 
106 
107 /*
108  *	these are read only!
109  */
110 extern tt_int	tv_ticks;
111 
112 extern tt_long	tv_score;
113 extern tt_bool	tv_score_reset;
114 
115 extern tt_long	tv_blocks;
116 extern tt_bool	tv_blocks_reset;
117 
118 extern tt_long	tv_trojkas;
119 extern tt_bool	tv_trojkas_reset;
120 
121 extern tt_long	tv_wipes;
122 extern tt_long 	tv_wipes_reset;
123 
124 extern tt_long	tv_block_count[tc_blocks];
125 extern tt_char	tv_field[tc_v_xsize][tc_v_ysize];
126 
127 extern tt_int	tv_speed;
128 extern tt_bool	tv_is_wizard;
129 
130 #endif /* _trojka_core_h_ */
131