File: tr_core.h

package info (click to toggle)
xtrojka 123-12
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 492 kB
  • ctags: 443
  • sloc: ansic: 3,087; makefile: 135; sh: 19
file content (130 lines) | stat: -rw-r--r-- 3,232 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
 *		     PLEASE DO NOT EDIT THIS FILE
 *		see documentation for more information
 *
 *
 *                  System Independent Trojka Core 
 *                Copyright (c) 1989-1996 Maarten Los
 *                             --------
 */

#ifndef _trojka_core_h_
#define _trojka_core_h_

/*
 *	constants
 */
#define tc_trojka	3	/* the magic number */
#define tc_trojkabonus	3333	/* the magic bonus */
#define tc_spiderbonus  6666	/* the spider bonus */
#define tc_bigspiderbonus 9999	/* the big spider bonus */
#define tc_bottombonus	999	/* bonus if you hit the bottom */


#define tc_min_speed	1	/* minimum speed */
#define tc_max_speed	9	/* maximum speed */
#define tc_speed_switch	100	/* # of blocks at which speed is increased */
#define	tc_pm_top	20	/* these constants are for the matrix */	
#define tc_pm_bottom	 1	/* see tr_core.doc */
#define tc_v_xsize	 5
#define tc_v_ysize	22
#define tc_virt_middle	 2

#define tc_clear	 0	/* clear cell in the playing field */
#define tc_tagged	-1	/* cell is tagged for wiping */

#define tc_blocks	5	/* number of different blocks */

#define tc_layouts	42	/* number of different layouts */
#define tc_layout_mask	0x03	/* for layout magic */
	/*
	 *	return, command and parameter values
	 */

#define		tc_c_init	1
#define		tc_c_blockdown	2
#define		tc_c_blockleft	3
#define		tc_c_blockright	4
#define		tc_c_dropblock	5
#define		tc_c_speedup	6
#define		tc_c_setspeed	7
#define 	tc_c_drawfield	8
#define		tc_c_setwizard	9

#define		tc_i_touchdown	1
#define		tc_i_dropblock	2
#define		tc_i_force	3

#define		tc_res_normal		1
#define		tc_res_gameover		2
#define		tc_res_touchdown	3



/*
 *	types
 */
typedef char		tt_char;
typedef char		tt_bool;
typedef int		tt_int;
typedef unsigned long	tt_long;
typedef int		tt_layout[5];	/* for wizard patterns */
typedef struct _tt_command {
	tt_int	command;
	tt_long param1;
	tt_long param2;
	tt_long reserved_1;
	tt_long reserved_2;
} tt_command;		/* command for the trojka api */




/************************************************************************
 * This part provides the API between the trojka core and the
 * implementation
 ************************************************************************/

/*
 *	the standard call to the trojka api
 */
extern int trojka_api(tt_command*);


/*
 *	these callback functions must be provided by the programmer and
 *	are called from within the trojka core (tr_core.c)
 */
extern void trojka_make_block_callback(tt_int, tt_int, tt_int);
extern void trojka_wipe_block_callback(tt_int, tt_int);
extern void trojka_explode_callback(tt_int, tt_int);
extern void trojka_trojka_callback(tt_long);
extern void trojka_speedup_callback(tt_int);
extern void trojka_spider_callback(tt_long);
extern void trojka_bottom_callback(tt_long);


/*
 *	these are read only!
 */
extern tt_int	tv_ticks;

extern tt_long	tv_score;
extern tt_bool	tv_score_reset;

extern tt_long	tv_blocks;
extern tt_bool	tv_blocks_reset;

extern tt_long	tv_trojkas;
extern tt_bool	tv_trojkas_reset;

extern tt_long	tv_wipes;
extern tt_long 	tv_wipes_reset;

extern tt_long	tv_block_count[tc_blocks];
extern tt_char	tv_field[tc_v_xsize][tc_v_ysize];

extern tt_int	tv_speed;
extern tt_bool	tv_is_wizard;

#endif /* _trojka_core_h_ */