void check_turn_ready() { if (current_turn && !check_gameover(0)) { if (recv_all_actions(current_turn)) { if ((queued_screen == GAME_SCREEN_WORLD && !door_dir) || screen == GAME_SCREEN_WORLD) { if (server) { do_ai(); /* computer players select their actions */ send_ai_actions(); server_prepare_actions(); } do_actions(); current_turn++; } } } }
void main() { int driver=0,mode=VESA_1024x768x8bit,paused=0; char *p; block bl; int key,n=1; long t0; initgraph(&driver,&mode,""); randomize(); memset(map_check,0,sizeof(map_check)); draw_map(); t0=time(NULL); init_block(&bl); itoa(score,ss,10); outtextxy(X0+470,Y0+320,ss); outtextxy(X0+397,Y0+220,"Press spacebar to pause"); outtextxy(X0+397,Y0+270,"Press spacebar agian to continue"); while(!stop) { show_block(bl); if(check_xy(bl)==3) { bl.y--; init_block(&bl); check_gameover(); show_block(bl); } while(((long)time(NULL)-t0)<=n*dtime) { if(bioskey(1)!=0) { key=bioskey(0); clear_block(bl); switch(key) { case UP:bl.rotate++;break; case LEFT:bl.x--;break; case RIGHT:bl.x++;break; case DOWN:bl.y++;break; case ESC:stop=1;break; case SPACE:show_block(bl);paused=1;break; default:break; } while(paused){ if(bioskey(1)!=0) { if(bioskey(0)==SPACE) { clear_block(bl); paused=0; break; } } } if(bl.rotate>3 || bl.rotate<0) bl.rotate=0; if(check_xy(bl)==1) bl.x++; if(check_xy(bl)==2) bl.x--; if(check_xy(bl)==3) { bl.y--; check_gameover(); show_block(bl); while(cover()) { delete_last(cover()); score+=100; setfillstyle(SOLID_FILL,BLACK); bar(X0+460,Y0+300,X0+520,Y0+340); itoa(score,ss,10); setcolor(WHITE); outtextxy(X0+470,Y0+320,ss); } init_block(&bl); check_gameover(); } if(check_collision(bl)) { if(key==UP) bl.rotate--; if(key==LEFT) bl.x++; if(key==RIGHT) bl.x--; if(key==DOWN) { bl.y--; check_gameover(); show_block(bl); while(cover()) { delete_last(cover()); score+=100; setfillstyle(SOLID_FILL,BLACK); bar(X0+460,Y0+300,X0+520,Y0+340); itoa(score,ss,10); setcolor(WHITE); outtextxy(X0+470,Y0+320,ss); } init_block(&bl); check_gameover(); } } check_gameover(); show_block(bl); } } clear_block(bl); bl.y++; if(check_xy(bl)==3 || check_collision(bl)) { bl.y--; check_gameover(); show_block(bl); while(cover()) { delete_last(cover()); score+=100; setfillstyle(SOLID_FILL,BLACK); bar(X0+460,Y0+300,X0+520,Y0+340); itoa(score,ss,10); setcolor(WHITE); outtextxy(X0+470,Y0+320,ss); } init_block(&bl); check_gameover(); } n++; } getchar(); closegraph(); }