|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T n
Length: 4751 (0x128f)
Types: TextFile
Names: »notify.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/X/Xtetris/notify.c«
#include "defs.h"
void
drop_block(client_data, id)
caddr_t client_data;
XtIntervalId *id;
{
start_timer();
if (block_can_drop(shape_no, xpos, ypos, rot))
print_shape(shape_no, xpos, ypos++, rot, WHITE);
else {
if (ypos < 0)
end_game();
else {
score += shape[shape_no].pointv[rot];
store_shape(shape_no, xpos, ypos, rot);
remove_full_lines(ypos);
create_shape();
show_score();
show_next();
}
}
print_shape(shape_no, xpos, ypos, rot, shape[shape_no].color);
draw_shadow(shape_no, xpos, ypos, rot, shape[shape_no].color);
}
show_score(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
char buf[BUFSIZ], buf1[BUFSIZ], buf2[BUFSIZ];
int j;
sprintf(buf, "Score: %d", score);
j=0;
XtSetArg(args[j], XtNstring, buf); j++;
XtSetValues(score_item,args,j);
sprintf(buf1, "Level: %d", rows / 10);
j=0;
XtSetArg(args[j], XtNstring, buf1); j++;
XtSetValues(level_item,args,j);
sprintf(buf2, "Rows : %d", rows);
j=0;
XtSetArg(args[j], XtNstring, buf2); j++;
XtSetValues(rows_item,args,j);
}
void
quit_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
clear_events();
stop_timer();
XtDestroyWidget(toplevel);
exit(0);
}
end_game(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
int j;
end_of_game = 1;
clear_events();
stop_timer();
j=0;
XtSetArg(args[j], XtNstring, "Game Over"); j++;
XtSetValues(game_over,args,j);
update_highscore_table();
print_high_scores();
}
void
restart_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
clear_events();
stop_timer();
init_all();
}
void
start_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
if (end_of_game)
return;
set_events();
start_timer();
}
void
pause_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
clear_events();
stop_timer();
}
left_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
if (block_can_left(shape_no, xpos, ypos, rot)) {
print_shape(shape_no, xpos, ypos, rot, WHITE);
xpos--;
print_shape(shape_no, xpos, ypos, rot, shape[shape_no].color);
draw_shadow(shape_no, xpos, ypos, rot, shape[shape_no].color);
}
}
right_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
if (block_can_right(shape_no, xpos, ypos, rot)) {
print_shape(shape_no, xpos, ypos, rot, WHITE);
xpos++;
print_shape(shape_no, xpos, ypos, rot, shape[shape_no].color);
draw_shadow(shape_no, xpos, ypos, rot, shape[shape_no].color);
}
}
anti_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
int newrot;
newrot = (rot + 3) % 4;
if (check_rot(shape_no, xpos, ypos, newrot)) {
print_shape(shape_no, xpos, ypos, rot, WHITE);
rot = newrot;
print_shape(shape_no, xpos, ypos, rot, shape[shape_no].color);
draw_shadow(shape_no, xpos, ypos, rot, shape[shape_no].color);
}
}
clock_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
int newrot;
newrot = (rot + 1) % 4;
if (check_rot(shape_no, xpos, ypos, newrot)) {
print_shape(shape_no, xpos, ypos, rot, WHITE);
rot = newrot;
print_shape(shape_no, xpos, ypos, rot, shape[shape_no].color);
draw_shadow(shape_no, xpos, ypos, rot, shape[shape_no].color);
}
}
fast_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
while (block_can_drop(shape_no, xpos, ypos, rot)) {
print_shape(shape_no, xpos, ypos, rot, WHITE);
ypos++;
print_shape(shape_no, xpos, ypos, rot, shape[shape_no].color);
}
}
void
done_proc(w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
XtPopdown(score_frame);
}