📄 escape.c
字号:
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <bios.h>
#include <alloc.h>
#include <math.h>
#define ESC 0x1b
#define MINROW 2
#define MINCOL 1
#define MAXROW 25
#define MAXCOL 60
#define PLAYER_X 69
#define PLAYER_Y 2
#define LEVER_X 69
#define LEVER_Y 3
#define TIME_X 68
#define TIME_Y 4
#define AUTO_X 68
#define AUTO_Y 5
#define SYSTIME_X 70
#define SYSTIME_Y 6
#define STEP_X 68
#define STEP_Y 8
#define EMPTY_X 69
#define EMPTY_Y 9
#define BOOM_X 68
#define BOOM_Y 10
#define C7KEY_X 62
#define C7KEY_Y 12
#define C8KEY_X 69
#define C8KEY_Y 12
#define C9KEY_X 76
#define C9KEY_Y 12
#define C4KEY_X 62
#define C4KEY_Y 16
#define C5KEY_X 69
#define C5KEY_Y 16
#define C6KEY_X 76
#define C6KEY_Y 16
#define C1KEY_X 62
#define C1KEY_Y 20
#define C2KEY_X 69
#define C2KEY_Y 20
#define C3KEY_X 76
#define C3KEY_Y 20
#define MASSAGE_X 62
#define MASSAGE_Y 22
char *playername,*massage,*timestr,*autostr;
int step,empty,boom,lever,NOMOVE,EXITGAME,DEAD,TIMEMARK,AUTOMARK;
int timehour,timesecond,timeminute;
int couserx,cousery;
struct empty{
int x;
int y;
struct empty *next;
};
typedef struct empty NODE;
NODE *head;
typedef struct time TIME;
TIME starttime,playtime;
void setmode(),startvar(),printvar();
void wait(),window();
int getempty(),getvalue(),getkey(),iskey(),deleteempty();
void printempty(),closegame(),numkeyview(),dalaytime();
void movecental();
int keycental(),movetg();
void deleteall(),clearview(),clearplay(),scanempty();
int openjump(),getcontinuekey();
void openauto(),openboom(),placetime(),printtime(),deletenode(),aroundput();
void opencursor(),closecursor(),changeboom();
void deadview();
NODE *seacher();
int main()
{
register int i;
EXITGAME=0; DEAD=0;
TIMEMARK=1; AUTOMARK=0;
setmode();
startvar();
randomize();
getempty();
printvar();
printempty();
for( ; !EXITGAME && !DEAD ; )
{
for( ; !EXITGAME && !DEAD && empty; )
{
if( ( iskey() ) )
{
movecental( );
printvar();
printempty();
}
placetime();
}
if( DEAD ) break;
if( !getcontinuekey() ) break;
clearview();
if( EXITGAME ) { EXITGAME=0; }
else { lever+=1; empty=lever*10; changeboom(); }
step=0; TIMEMARK=1;
getempty();
printvar();
printempty();
}
if( DEAD )
{
for( ; ; )
{
deadview();
if( iskey() )
{
closegame();
bioskey(0);
exit(0);
}
}
}
closegame();
return 0;
}
void setmode()
{
textcolor(YELLOW);
textbackground(BLUE);
clrscr();
window(MINCOL,MINROW,MAXCOL,MAXROW);
gotoxy(1,1);
cputs("****************************E S C A P E G A M E****************************");
gotoxy(MAXCOL+2,2);
cputs("Player: YOUR");
gotoxy(MAXCOL+2,LEVER_Y);
cputs("Lever: 0");
gotoxy(MAXCOL+2,TIME_Y);
cputs("Time: ");
gotoxy(MAXCOL+2,AUTO_Y);
cputs("Auto: off");
gotoxy(MAXCOL+2,SYSTIME_Y);
cputs("Systime: ");
gotoxy(MAXCOL+2,STEP_Y);
cputs("Step: 0");
gotoxy(MAXCOL+2,EMPTY_Y);
cputs("Empty: 0");
gotoxy(MAXCOL+2,BOOM_Y);
cputs("Boom: 0");
gotoxy(MAXCOL+2,12);
cputs("7 8 9");
gotoxy(MAXCOL+2,16);
cputs("4 <- 5 -> 6");
gotoxy(MAXCOL+2,20);
cputs("1 2 3");
gotoxy(MAXCOL+2,22);
textattr(0x9e);
cputs("Type ESC to exit!");
textattr(0x1e);
}
void window(int left,int top,int right,int bottom)
{
register int i;
gotoxy(left,top);
putchar('
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -