6 #include "wellobject.h"
7 #include "welldrawing.h"
8 #include "wellengine.h"
9 #include "wellimagefont.h"
10 #include "welltopnine.h"
12 //define structures for work with figures
15 int squares
, polyomino_number
;
17 int size
, color_number
;
18 int bonus
, random_rotation
, random_reflection
;
22 squares
=polyomino_number
=xpos
=ypos
=size
=0;
23 color_number
=bonus
=random_rotation
=random_reflection
=0;
33 int shape
[MAX_SQUARES
][MAX_SQUARES
];
39 int number
[MAX_MODES
][MAX_TYPES
];
40 int start
[MAX_START_POLYOMINOES
][MAX_TYPES
];
46 Polyominoes polyomino
[MAX_POLYOMINOES
];
57 class WellBase
: public WellObject
60 Polytris tris
[MAX_SQUARES
- MIN_SQUARES
+ 1];
61 int frozen_wall
[MAX_SIDES
];
62 thing_t curThing
, nextThing
;
63 Field wall
[MAX_DEPTH
+MAX_WIDTH
][MAX_PERIMETER
];
64 Field base
[MAX_WIDTH
][MAX_WIDTH
];
66 int level
, score
, rows
, rows_levelup
;
80 int squares
, pause
, steps_to_rotate
;
84 WellDrawingEngine
*dre
;
85 WellImageFont
*txt_score
;
86 WellImageFont
*txt_lines
;
87 WellImageFont
*txt_levelup
;
88 WellImageFont
*txt_level
;
90 WellImageFont
*txt_first
;
91 WellImageFont
*txt_second
;
92 WellImageFont
*txt_third
;
96 ObjectCaller game_over_object
;
98 char player_name
[PLAYER_NAME_LEN
];
100 void set_default_options();
102 void read_polyominoes();
108 bool at_base_fully();
109 bool at_base_partially();
110 bool wall_change(thing_t old
,thing_t new_t
);
112 void wall_to_base(int* base_x
,int* base_y
,int wall_x
,int wall_y
);
113 void try_move(Actions move
);
114 void draw_thing_diff(thing_t
* old
);
118 void freeze_wall(int w
);
119 void defreeze_wall(int w
);
123 void check_update_lines();
124 bool process_action(Actions action
);
126 void make_rotation();
128 virtual void draw_status();
129 virtual void draw_next();
130 virtual void clear_next();
131 virtual void draw_grid();
132 virtual void draw_box(int color
, int x
, int y
);
136 void init(WellEngine
*);
137 void udelay(int msec
);
138 bool move_one_step(Actions
);
141 void new_level_calc();
143 void set_level(int il
) { level
=il
; dbgprintf(("Level now is %d\n",level
));};
144 void set_rotation(bool r
) { rotation
=r
;};
145 void set_mixed(bool r
) { mixed
=r
;};
146 void set_next_piece(bool r
) { showNext
=r
;};
147 void set_squares(int i
) { squares
=i
;};
148 void set_object_on_game_over(ObjectCaller obj
)
150 game_over_object
=obj
;
152 void set_player_name(char *pn
)
154 strcpy(player_name
,pn
);
156 virtual bool process_event(wEvent
);