3 /* GENERIC TILING DEFINITIONS */
\r
5 #define WORLD_WIDTH 105 /* IN TILES, WIDTH OF "PLAYFIELD" */
\r
6 #define WORLD_HEIGHT 100 /* IN TILES, HEIGHT OF "PLAYFIELD" */
\r
7 #define WORLD_TILES_TOTAL 10500 /* (WORLD_WIDTH*WORLD_HEIGHT) */
\r
9 #define TILE_WIDTH 16 /* IN PIXELS, WIDTH OF TILE */
\r
10 #define TILE_HEIGHT 16 /* IN PIXELS, HEIGHT OF TILE */
\r
11 #define VIEW_WIDTH 20 /* (SCREEN_WIDTH/TILE_WIDTH) */
\r
12 #define VIEW_HEIGHT 15 /* (SCREEN_HEIGHT/TILE_HEIGHT) */
\r
13 #define VIEW_TILES_TOTAL 300 /* (VIEW_WIDTH*VIEW_HEIGHT) */
\r
14 #define MIXING_TILE 299 /* (VIEW_TILES_TOTAL-1) */
\r
15 #define EMPTY_TILE -1 /* STANDARD INDEX FOR A SEE-THROUGH TILE */
\r
16 #define ERROR_TILE -2 /* STANDARD INDEX FOR ERRORS! */
\r
20 void create_roads (void);
\r
21 int roadexit (int road, int direction);
\r
22 int makeintersection (int road, int ramp);
\r
23 void init_foreground (void);
\r
24 void init_background (void);
\r
25 void add_dirt_edges (void);
\r
26 void init_world(void);
\r
27 int redraw (int draw_type);
\r
28 void init_video (void);
\r
29 void init_data (void);
\r
30 void program_shutdown (char *msg, int errcode);
\r
31 void place_tile_block (int x1, int y1, int x2, int y2);
\r
32 void init_anim (void);
\r
33 void animate (void);
\r
34 void update_tile (int tile);
\r
35 void gogofrog (void);
\r
37 /* VIDEO MODE DEFINITIONS */
\r
40 #define SCREEN_WIDTH 320
\r
41 #define SCREEN_HEIGHT 240
\r
42 #define IMAGES "roads.gif" /* IMAGE CONTAINING TILES */
\r
44 /* VIDEO PAGE DEFINITIONS */
\r
49 /* STANDARD DEFINITIONS */
\r
53 /* CHECKS IF A TILE IS A ROAD OR NOT */
\r
54 #define isroad(r) (r>=FIRST_ROAD_TILE && r<=LAST_ROAD_TILE)
\r
58 #define SCROLL_DOWN 2
\r
59 #define SCROLL_LEFT 3
\r
60 #define SCROLL_RIGHT 4
\r
65 #define NONFLIP_SCROLL_UP 11
\r
66 #define NONFLIP_SCROLL_DOWN 12
\r
67 #define NONFLIP_SCROLL_LEFT 13
\r
68 #define NONFLIP_SCROLL_RIGHT 14
\r
69 #define NONFLIP_REFRESH 15
\r
71 #define MAX_FAILS 50 /* MAXIMUM NUMBER OF ATTEMPTS TO PLACE TILES */
\r
75 * MACROS TO CONVERT TILES FROM "ROW/COLUMN" FORMAT TO "INDEX" FORMAT
\r
79 /* WORLD SPACE CONVERSIONS */
\r
80 #define WORLD_TILE(x,y) ((x)+(y)*WORLD_WIDTH) /* CONVERTS DUAL X,Y TO SINGLE */
\r
81 #define WORLD_TILE_X(z) ((z)%WORLD_WIDTH) /* CONVERTS SINGLE TO DUAL X */
\r
82 #define WORLD_TILE_Y(z) ((z)/WORLD_WIDTH) /* CONVERTS SINGLE TO DUAL Y */
\r
84 /* VIEW SPACE CONVERSIONS */
\r
85 #define VIEW_TILE(x,y) ((x)+(y)*VIEW_WIDTH) /* CONVERTS DUAL X,Y TO SINGLE */
\r
86 #define VIEW_TILE_X(z) ((z)%VIEW_WIDTH) /* CONVERTS SINGLE TO DUAL X */
\r
87 #define VIEW_TILE_Y(z) ((z)/VIEW_WIDTH) /* CONVERTS SINGLE TO DUAL Y */
\r
89 /* RETURNS 1 IF A SINGLE WORLD TILE INDEX IS WITHIN THE VIEWING SCREEN */
\r
90 #define is_viewable(x) (WORLD_TILE_X(x)>=view_x && \
\r
91 WORLD_TILE_X(x)<view_x+VIEW_WIDTH && \
\r
92 WORLD_TILE_Y(x)>=view_y && \
\r
93 WORLD_TILE_Y(x)<view_y+VIEW_HEIGHT) \
\r
95 /* CONVERTS A WORLD INDEX INTO A VIEW INDEX -- USE IS_VIEWABLE TO MAKE */
\r
96 /* SURE THE WORLD INDEX IS WITHIN THE VIEWING AREA! */
\r
97 #define WORLD_TO_VIEW(x) VIEW_TILE(WORLD_TILE_X((x))-view_x,WORLD_TILE_Y((x))-view_y)
\r
99 #define DONS_VIEW_TO_WORLD(x) (WORLD_TILE (view_x, view_y) + (VIEW_TILE_Y (x) * WORLD_WIDTH) + VIEW_TILE_X (x) /* CONVERT VIEW SINGLE TO WORLD SINGLE */
\r
100 #define VIEW_TO_WORLD(x) (WORLD_TILE (VIEW_TILE_X (x) + view_x, VIEW_TILE_Y (x) + view_y)) /* CONVERT VIEW SINGLE TO WORLD SINGLE */
\r
104 * MACROS TO EASE COPYING OF TILES BETWEEN AND AMONG PAGES
\r
108 /* INTENRAL MACRO USED IN COPY TILE MACROS -- USER, DO NOT CALL! */
\r
109 #define COPY_TILE_CORE(from,to,spage,dpage) \
\r
110 ((from)%VIEW_WIDTH)*TILE_WIDTH, \
\r
111 (((from)%VIEW_WIDTH)+1)*TILE_WIDTH-1, \
\r
112 ((from)/VIEW_WIDTH)*TILE_HEIGHT, \
\r
113 (((from)/VIEW_WIDTH)+1)*TILE_WIDTH-1, \
\r
114 ((to)%VIEW_WIDTH)*TILE_WIDTH, \
\r
115 (((to)/VIEW_WIDTH)+1)*TILE_HEIGHT-1, \
\r
118 /* TRANSPARENT TILE COPY FROM HIDDEN PAGE TO ACTIVE PAGE */
\r
119 #define copy_tile_tr(from_tile,to_tile) \
\r
120 fg_tcxfer (COPY_TILE_CORE(from_tile,to_tile,TILEPAGE,VIEWPAGE))
\r
122 /* OPAQUE TILE COPY FROM HIDDEN PAGE TO ACTIVE PAGE */
\r
123 #define copy_tile_op(from_tile,to_tile) \
\r
124 fg_transfer (COPY_TILE_CORE(from_tile,to_tile,TILEPAGE,VIEWPAGE))
\r
126 /* TRANSPARENT TILE COPY */
\r
127 #define pagecopy_tile_tr(from_tile,to_tile,sourcepage,destpage) \
\r
128 fg_tcxfer (COPY_TILE_CORE(from_tile,to_tile,sourcepage,destpage))
\r
130 /* OPAQUE TILE COPY FROM */
\r
131 #define pagecopy_tile_op(from_tile,to_tile,sourcepage,destpage) \
\r
132 fg_transfer (COPY_TILE_CORE(from_tile,to_tile,sourcepage,destpage))
\r
136 int anm; /* NUMBER USED TO ENCODE ANIMATION IN WORLD */
\r
137 int total; /* TOTAL NUMBER OF TILES USED IN ANIMATION */
\r
138 int first; /* FIRST TILE NO. IN ANIMATION */
\r
139 int current; /* TILE CURRENTLY BEING SHOWN IN ANIMATION */
\r
140 int delay; /* DELAY BETWEEN TILES IN CLOCK TICKS */
\r
141 long next; /* TIME OF NEXT UPDATE */
\r