C++#if __cplusplus<=201103L
#error You must use C++1y(C++14) to compile at least.
#endif
#include<cstdio>
#include<Windows.h>
#include<conio.h>
#include<time.h>
#include<string>
using std::string;
#include<random>
using std::mt19937;
mt19937 rcc11;
void rccsrand(unsigned int seed){rcc11.seed(seed);}
auto rccrand(){return rcc11();}
#define srand(a) rccsrand(a)
#define rand() rccrand()
//------
//#define Debugground
#define Groundinfo
#define GroundinfoMore
#define GroundinfoChinese
#define Peopleinfo
//------
/*
enum ConsoleColor {
BLACK = 0, BLUE = 1, GREEN = 2, CYAN = 3, RED = 4,
MAGENTA = 5, BROWN = 6, LIGHTGRAY = 7, DARKGRAY = 8,
LIGHTBLUE = 9, LIGHTGREEN = 10, LIGHTCYAN = 11,
LIGHTRED = 12, LIGHTMAGENTA = 13, YELLOW = 14, WHITE = 15,
ORANGE = 6,
PINK = 13
};
*/
inline void printtext(const char*,int);
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
//------------
char screen[25][100];
int x=9,y=15,gy=16,lastgy=16,gyup=1,seay=16,lastjumpy=15,startdropy=15,tick=0,tempclock,startclock,score=0,lastscore=0,woodt=0,kill_mons=0,kickkill=0;
char gc;
int ticksp=80;
int landtype=1,landscape,landhold=0,jumpup=0,landymax=23,landymin=5,issea=0;
bool ishighland=0,isforest=0,ismonster=1;
bool ispressp=0,ispressw=0,ispressd=0,ispressa=0,is2dt=0,is3dt=0,isndt=0,isseatoland=0,isinwayed=0,isjumptree=0;
bool sttus=0,ismain=0,isstrint;
//----achivement
#define achivementtotal 30
int treewalktick=0,protecttick=0,nopressdtick=0,nopresswtick=0,staylefttick=0,stayx0tick=0,getuptolandx=2147483647,last2dtx=2147483640,last3dtx=2147483641,lastndtx=2147483642;
struct achi{
string name,discribe;
// char name[100],discribe[1000];//C
int color;
bool isgeted;
int showtick,gettick;
}achis[38];
void achiinit(){
#define tfac(index,a,b,c) achis[index]={a,b,c,0,0,-1};
//#define tfac(index,a,b,c) achis[index].name=a;achis[index].discribe=b;achis[index].color=c;achis[index].isgeted=achis[index].showtick=0;achis[index].gettick=-1;//C++98
tfac(0,"[二段跳]","进行一次二段跳。二段跳的定义:在比上一次起跳位置高(即比上一次起跳位置的y值更小)的树木上起跳。",10)
tfac(1,"[三段跳]","进行一次三段跳。三段跳的定义:在二段跳的基础上再进行一次二段跳。",10)
tfac(2,"[多段跳]","进行一次多段跳。多段跳的定义:在三段跳或多段跳的基础上再进行一次二段跳。",13)
tfac(3,"[凌树微步]","50帧不碰地面。",10)
tfac(4,"[触顶]","碰到屏幕顶(即y=0)。",10)
tfac(5,"[止步不前]","200帧不按d键。",10)
tfac(6,"[地势平坦]","200帧不按w键。",10)
tfac(7,"[护林者]","500帧不砍树。",13)
tfac(8,"[我们有十八组木头]","获得18*64=1152个木头(即‘*’)。",10)
tfac(9,"[小目标]","达到10000分。",10)
tfac(10,"[活着]","存活10000帧.",13)
tfac(11,"[保守派]","保持x值200帧小于等于9。",10)
tfac(12,"[最左端]","来到屏幕最左端(即x=0)。",10)
tfac(13,"[极限!]","在屏幕最左端待200帧。",13)
tfac(14,"[高原山地气候!]","来到“高原山地”地形。",10)
tfac(15,"[大目标]","达到100000分。",13)
tfac(16,"[水是生命之源]","碰到水。",10)
tfac(17,"[落地水!]","进行一次大于等于4格的摔落并掉进水里。",10)
tfac(18,"[海草还是树?]","砍一个水中的“树”。",10)
tfac(19,"[触底]","碰到屏幕底(即y=24)",10)
tfac(20,"[上岸]","从海里上到陆地上。",10)
tfac(21,"[资深伐木工]","获得10000个木头。",13)
tfac(22,"[信仰之跃!]","进行一次超过12格的摔落。",13)
tfac(23,"[吐鲁番]","来到“盆地”地形。",10)
tfac(24,"[二岔口]","来到“溶洞”地形。",10)
tfac(25,"[森溶平]","来到“森林平原溶洞”地形。",13)
tfac(26,"[一树三步高]","在一棵树上完成四段跳。16番。",13)
tfac(27,"[一树四步高]","在一棵树上完成五段跳。32番。",13)
tfac(28,"[怪物猎人]","击杀一个怪物",10)
tfac(29,"[血流成河]","击杀100个怪物",13)
tfac(30,"[骑士踢]","通过从树上跳下击杀共10个怪物",13)
}
void achiif(){
#define achiset(i,t) if(!achis[i].isgeted){achis[i].isgeted=1;achis[i].showtick=t;achis[i].gettick=tick;}
if(is2dt){
printf("二段跳!");
achiset(0,30);
}
if(isndt){
printf("多段跳!!!");
if(!achis[2].isgeted) score+=100;
achiset(2,50);
}
else if(is3dt){
printf("三段跳!!");
achiset(1,30);
}
if(y==0){achiset(4,30);}
if(x==0){achiset(12,30);}
if(treewalktick>=50){achiset(3,30);}
if(protecttick>=500){if(!achis[7].isgeted) score+=10000;achiset(7,50);}
if(nopressdtick>=200){achiset(5,30);}
if(nopresswtick>=200){achiset(6,30);}
if(woodt>=18*64){achiset(8,30);}
if(score>=10000){achiset(9,30);}
if(tick>=10000){if(!achis[10].isgeted) score+=1000;achiset(10,50);}
if(staylefttick>=200){achiset(11,30);}
if(stayx0tick>=200){if(!achis[13].isgeted) score+=4000;achiset(13,50);}
if(landscape==10 && ishighland){achiset(14,30);}
if(score>=100000){achiset(15,50);}
if(screen[y][x]=='~'){achiset(16,30);}
//17 in movepeople()
//18 in movepeople()
if(y==24){achiset(19,30);}
if(tick+x>=getuptolandx){achiset(20,30);}
if(woodt>=10000){if(!achis[21].isgeted) score+=5000;achiset(21,50);}
//22 in movepeople()
if(landtype==2 && !issea){achiset(23,30);}
if(landtype==4){achiset(24,30);}
if(landtype==4 && landscape==250 && isforest){if(!achis[25].isgeted) score+=1000;achiset(25,50);}
if(kill_mons==1){achiset(28,50)}
if(kill_mons==1){achiset(28,30)}
if(kill_mons==100){achiset(29,50)}
if(kickkill==10){achiset(30,50)}
}
void achishow(){
for(int i=0;i<=achivementtotal;i++){
if(achis[i].showtick){
if(achis[i].color==10)printf("\n达成了成就 ");
else printf("\n完成了挑战 ");
printtext(achis[i].name.c_str(),achis[i].color);
printf("!");
if(!ispressp) achis[i].showtick--;
}
}
}
#define achishow2(i) printtext(achis[i].name.c_str(),achis[i].color);printf(":");if(achis[i].isgeted) printf("在%dtick达成\n",achis[i].gettick);else printf("未达成\n");
//----seed
#define Seedinfo
unsigned int seedv;
long long seedv2=0;
inline unsigned int seedpow(int a,int b){
for(int i=1;i<b;i++) a=a*b+(a-b);
return a;
}
inline long long seedpow2(int a,int b){
long long t=1;
for(int i=0;i<b;i++) t*=a;
return t;
}
char seedstr[133333];
int ct__=0;
long long seedsti(){
int l=0;
for(int i=0;i<ct__;i++,l++) if(seedstr[i]!='0') break;
for(int i=ct__-1;i>=l;i--){
seedv2+=(seedstr[i]-'0')*seedpow2(10,ct__-1-i);
if(seedv2>=4294967296){
seedv2=-1;
break;
}
}
return seedv2;
}
//----seed
//------------
#define checkp() if(gc=='p' or gc=='P'){\
ispressp=1;\
}
#define checkw() if(gc=='w' or gc=='W'){\
ispressw=1;\
nopresswtick=0;\
}
#define checkd() if(gc=='d' or gc=='D'){\
ispressd=1;\
nopressdtick=0;\
}
#define checka() if(gc=='a' or gc=='A'){\
ispressa=1;\
}
#define checkkeys() if(_kbhit()){\
gc=_getch();\
checkp() checkw() checkd() checka()\
}
//------------
inline void printtext(const char* text,int color){
SetConsoleTextAttribute(hConsole,color);
printf(text);
SetConsoleTextAttribute(hConsole,7);
}
inline void printf2(const char* text){
for(const char*cp=text;*cp!='\0';cp++){
putchar(*cp);
Sleep(20);
}
}
inline void printf3(const char* text){
for(const char*cp=text;*cp!='\0';cp++){
putchar(*cp);
if(_kbhit()){
_getch();
sttus=1;
}
if(!sttus) Sleep(20);
}
}
inline void printtext2(const char* text,int color){
SetConsoleTextAttribute(hConsole,color);
printf3(text);
SetConsoleTextAttribute(hConsole,7);
}
inline void showscreen(){
for(int i=0;i<=24;i++){
for(int j=0;j<100;j++){
if(i==y && j==x) putchar('&');
else putchar(screen[i][j]);
//checkkeys()
}
putchar('\n');
}
for(int i=0;i<100;i++) putchar('=');
putchar('\n');
}
inline void showstart(){
for(int i=0;i<=24;i++){
for(int j=0;j<100;j++){
if(i==y && j==x) putchar('&');
else putchar(screen[i][j]);
checkkeys()
}
putchar('\n');
}
for(int i=0;i<100;i++) putchar('=');
putchar('\n');
}
inline void movescreen(){
bool istreestart=0;
int temprand=0;
for(int i=0;i<=24;i++){
for(int j=1;j<100;j++){
screen[i][j-1]=screen[i][j];
checkkeys()
}
}
for(int i=0;i<25;i++){
if(isforest) temprand=rand()%(100*(gy-3-i)+3);
else temprand=rand()%(250*(gy-3-i)+20);
if(temprand==0 && (landtype!=2 or i>seay+2)){
istreestart=1;
}
if(istreestart && i<gy &&(landtype!=4 or i<gyup)) screen[i][99]='*';
else if(i==gy or (landtype==4 && i==gyup)) screen[i][99]='-';
else if((gy<i && i<lastgy) or (gy>i && i>lastgy)) screen[i][99]='=';
else if(seay<=i && i<gy && (landtype==2 or isseatoland) && issea) screen[i][99]='~';
else screen[i][99]=' ';
//checkkeys()
}
for(int i=0;i<25;i++){
if(screen[i+1][99]=='-'&&ismonster&&screen[i][99]==' '){
int randsss=rand()%100;
randsss%=100;
if(randsss<5){
screen[i][99]='o';
}
}
}
istreestart=0;
lastgy=gy;
}
inline void groundmove(){
int temprand=0;
#ifndef Debugground
#define landfeature(a,feature) temprand=(rand()*rand())%100;if(0<=temprand && temprand<feature) a=1;else a=0;
if(landhold<=0){
temprand=(rand()*rand())%100;
if(0<=temprand && temprand<8 && gy<=18 && landtype!=2){//sea
landtype=2;
seay=((gy<10)?10:gy);
}
else if(8<=temprand && temprand<=14) landtype=3;//badland
else if(15<=temprand && temprand<=25) landtype=4;//cave
else{
if(landtype==2) isseatoland=1;
landtype=1;
}
temprand=(rand()*rand())%100;
if(0<=temprand && temprand<=50) landhold=rand()%500+300;
else if(51<=temprand && temprand<=63) landhold=rand()%1000+100;
else if(64<=temprand && temprand<=65) landhold=rand()%60+150;
else if(66<=temprand && temprand<=68) landhold=rand()%200+15;
else landhold=200+rand()%200;
//-----
if(landtype==1){landfeature(ishighland,30);}
else ishighland=0;
landfeature(isforest,50);
if(landtype==2){landfeature(issea,60);}
else if(!isseatoland) issea=2;
if(!issea && landtype==2) landhold=landhold%80+30;
if(landtype==4) landhold=landhold%300+50;
//-----
temprand=(rand()*rand())%100;
if(landtype==1 or landtype==4){
if(0<=temprand && temprand<=30) landscape=250;
else if(31<=temprand && temprand<=45) landscape=100;
else if(51<=temprand && temprand<=60) landscape=50;
else if(61<=temprand && temprand<=68) landscape=10;
else landscape=150;
gyup=gy-2;
}
else if(landtype==2){
if(0<=temprand && temprand<=50) landscape=250;
else landscape=50;
}
else if(landtype==3) landscape=25;
else landscape=404;
}
#else //debug part
landtype=2;
issea=0;
landhold=10;
landscape=50;
#endif
//--
if(landtype==1){
if(ishighland) landymax=12,landymin=5;
else landymax=23,landymin=10;
}
else if(landtype==2) landymax=25,landymin=seay+4;//sea
else landymax=23,landymin=4;//badland
//--
#define trmls (temprand%landscape)
if(isseatoland && gy>seay){
gy-=2;
if(gy<=seay){
gy=seay;
if(issea==1) getuptolandx=tick+99;
isseatoland=0;
}
}
else if(gy>landymax) gy--;
else if(gy==landymax){
temprand=rand();
if(landtype==3){
if(trmls==1) gy--;
else if(trmls==2) gy-=2;
else gy-=3;
}
else if(1<=trmls && trmls<=4) gy--;
}
else if(gy<landymin && landtype==2) gy+=2;
else if(gy<landymin) gy++;
else if(gy==landymin){
temprand=rand();
if(landtype==3){
if(trmls==1) gy++;
else if(trmls==2) gy+=2;
else gy+=3;
}
else if(6<=trmls && trmls<=9) gy++;
}
else{
temprand=rand();
if(landtype==3){
if(trmls==0) gy++;
else if(trmls==1) gy--;
else if(2<=trmls && trmls<=3){
gy+=2;if(gy>landymax) gy=landymax;
}
else if(4<=trmls && trmls<=5){
gy-=2;if(gy<landymin) gy=landymin;
}
else if(6<=trmls && trmls<=14){
gy+=3;if(gy>landymax) gy=landymax;
}
else if(15<=trmls && trmls<=23){
gy-=3;if(gy<landymin) gy=landymin;
}
}
else{
if(6<=trmls && trmls<=7) gy++;
else if(3<=trmls && trmls<=4) gy--;
}
}
if(landtype==4){
if(gyup>gy-5) gyup--;
else if(gyup==gy-5){
temprand=rand();
if(1<=trmls && trmls<=4) gyup--;
}
else if(gyup<3) gyup++;
else if(gyup==3){
temprand=rand();
if(6<=trmls && trmls<=9) gyup++;
}
}
landhold--;
}
inline void movepeople(){
isinwayed=0;
if(screen[y+1][x]=='-'||screen[y+1][x]=='='||screen[y+1][x]=='*'||screen[y+1][x]=='~'){isjumptree=0;}
if(ispressw && (screen[y+1][x]!=' ' or screen[y][x]=='-' or screen[y][x]=='=')){
jumpup=2;
if(screen[y][x]=='~') jumpup=1;
else if(screen[y+1][x]=='~' && screen[y][x]==' ') jumpup=0;
if(y<lastjumpy && screen[y+1][x]=='*' && screen[y][x]!='~'){
if(is3dt){
isndt=1;
score+=100;
if(last2dtx==last3dtx && last3dtx==tick+x){
if(tick+x==lastndtx){
if(!achis[27].isgeted) score+=3200;
achiset(27,50);
}
if(!achis[26].isgeted) score+=1600;
achiset(26,50);
}
lastndtx=tick+x;
}
else if(is2dt){
is3dt=1;
is2dt=0;
score+=10;
last3dtx=tick+x;
}
else{
is2dt=1,score+=2;last2dtx=tick+x;
}
}
if(screen[y+1][x]=='*'){
isjumptree=1;
}
else{is2dt=is3dt=0;}
if(screen[y+1][x]!='~') lastjumpy=y;
}
if(ispressd && screen[y][x]==' ' && x<95) x++;
if(ispressa){
if(screen[y][x]=='~'){
if(x==0){x--;return;}
else if(screen[y][x-1]!='-' or screen[y][x-1]!='=') x--;
}
else{
if(x==0){x-=2;return;}
else if(screen[y][x-1]=='~'){
if(screen[y][x-2]!='-' or screen[y][x-2]!='=') x--;
}
for(int i=0;i<2 && screen[y][x-1]==' ';i++){
x--;
if(x==0){
if(i==0) x--;
ispressa=0;
return;
}
}
}
}
if(screen[y+1][x]=='o'){if(isjumptree){kickkill++;}score+=10;screen[y+1][x]=' ';kill_mons++;}
if(screen[y][x]=='o'){
Sleep(1000);
system("cls");
printtext(" _____ ______ _________ ________ ______ \n\\ / / \\ | | | \\ | | | \\ \n \\ / | | | | | | | | | |\n \\ / | | | | | | | | | |\n \\ / | | | | | | | |-------- | |\n | | | | | | | | | | |\n | | | | | | | | | | |\n | \\_____/ \\_____/ |______/ ____|____ |________ |______/\n",4);
/*
_____ ______ _________ ________ ______
\ / / \ | | | \ | | | \
\ / | | | | | | | | | |
\ / | | | | | | | | | |
\ / | | | | | | | |-------- | |
| | | | | | | | | | |
| | | | | | | | | | |
| \_____/ \_____/ |______/ ____|____ |________ |______/
*/
printf("You are out...\n");
Sleep(2000);
printf("You has lived:%d ticks and get %d scores!\n",tick,score);
Sleep(2000);
printf("种子:%u\n",seedv);
for(int i=0;i<=achivementtotal;i++){achishow2(i);Sleep(50);}
Sleep(3000);
printf("Press any key......");
_getch();
exit(0);
}
if(screen[y][x]=='-' or screen[y][x]=='='){x--;isinwayed=1;}
else if(screen[y][x]=='*'){
int i;
for(i=y;i>=0;i--){
if(screen[i][x]=='*') score+=3,woodt++,protecttick=0;
else break;
}
if(screen[i][x]=='~'){
achiset(18,30);
i++;
for(;i<=y;i++) screen[i][x]='~';
}
else{
i++;
for(;i<=y;i++) screen[i][x]=' ';
}
x--;
isinwayed=1;
}
if(x<0) return;
if(jumpup>0){
for(int i=0;i<jumpup;i++){
if(y>0 && (screen[y-1][x]==' ' or screen[y-1][x]=='~')) y--;
else{
jumpup=0;
}
}
}
else if(jumpup<0){
for(int i=0;i>jumpup;i--){
if(screen[y+1][x]==' ' or screen[y+1][x]=='~') y++;
else{
jumpup=0;
if(y-startdropy>12){
if(!achis[22].isgeted) score+=2000;
achiset(22,50)
}
}
}
if(screen[y+1][x]!=' ' && screen[y+1][x]!='~'){
jumpup=0;
if(y-startdropy>12){
if(!achis[22].isgeted) score+=2000;
achiset(22,50)
}
}
}
if(jumpup==0) startdropy=y;
if(screen[y][x]=='~'){
if(y-startdropy>=4){
achiset(17,30);
}
startdropy=y;
}
if(jumpup>0 or (jumpup<=0 && (screen[y+1][x]==' ' or screen[y+1][x]=='~'))) jumpup--;
if(jumpup<-3) jumpup=-3;
if(jumpup<-1 && screen[y][x]=='~') jumpup=-1;
if((!isinwayed) && screen[y][x]=='~' && (!ispressd) && (screen[y][x-1]==' ' or screen[y][x-1]=='~')) x--;
ispressw=0;
ispressd=0;
ispressa=0;
}
//-------------
int main(){
system("mode con cols=120 lines=35");
struct _timeb T;
_ftime(&T);
srand(T.millitm);
// #if __cplusplus>=201100
// CONSOLE_CURSOR_INFO cursor_infomdg={1,0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_infomdg);
// #endif
// #if __cplusplus>=201100
// COORD pos={0,0};
// #endif
startsym:
system("cls");
x=9,y=15,gy=16,lastgy=16,seay=16,lastjumpy=15,startdropy=15,landscape=0,landhold=0,isinwayed=0;
ispressp=0,ispressw=0,ispressd=0,ispressa=0,is2dt=0,is3dt=0,isndt=0,isseatoland=0;
treewalktick=0,protecttick=0,nopressdtick=0,nopresswtick=0,staylefttick=0,stayx0tick=0,getuptolandx=2147483647,last2dtx=2147483640,last3dtx=2147483641,lastndtx=2147483642;
achiinit();
for(int i=0;i<25;i++){
for(int j=0;j<100;j++){
if(i==gy) screen[i][j]='-';
else screen[i][j]=' ';
}
}
showscreen();
if(!ismain){
ismain=1;
printf2("欢迎游玩“大旅行家”1.7.1!");
Sleep(2000);
printf2("\n按1开始游玩,2显示教程,3显示成就帮助,e键退出。");
}
else printf("欢迎游玩“大旅行家”1.7.1!\n按1开始游玩,2显示教程,3显示成就帮助,e键退出。");
while(1){
gc=_getch();
if(gc=='2'){
system("cls");
printf("按任意键跳过停顿。");
#define tf(t,a) printf("\n");printf3(t);tempclock=clock();if(!sttus){\
while(clock()-tempclock<a){\
if(_kbhit()){\
_getch();\
sttus=1; \
break;\
}\
}\
}
tf("本游戏使用wasd移动,w跳跃(上浮),d向右,a向左(绝对2格,相对1格);p键可暂停,再按一次继续。",2000);
tf("右边界限制95,左边界为0;出左边界游戏结束;",2000);
tf("‘-’为地面,‘*’为树,‘~’为水,‘&’为角色。",2000);
tf("角色可站在地面和树上面。若被其(从右侧)阻挡且不跳过,会随地面或树一起左移直至出界。",3000);
tf("在水中时人物运动受限,若按d键x坐标保持不动,不按则左移。",3000);
tf("每一帧加1分。若角色横向向右碰到树,停留(即左移)1帧后会清除这棵树于角色y坐标上方的树木,加(清除掉的木头数×3)分。",3000);
tf("基础教程已完毕,快去游玩吧!",2000);
printf("\nPress any key...");
_getch();
sttus=0;
goto startsym;
}
else if(gc=='3'){
system("cls");
printf("按任意键跳过停顿。");
#define tf2(i) printf("\n");printtext2(achis[i].name.c_str(),achis[i].color);printf3(":");printf3(achis[i].discribe.c_str());tempclock=clock();if(!sttus){\
while(clock()-tempclock<2000){\
if(_kbhit()){\
_getch();\
sttus=1; \
break;\
}\
}\
}
for(int i=0;i<=achivementtotal;i++){
tf2(i);
}
printf("\nPress any key...");
_getch();
sttus=0;
goto startsym;
}
else if(gc=='e' or gc=='E'){
system("cls");
showscreen();
printf2("再见!");
Sleep(2000);
return 0;
}
else if(gc=='1') break;
}
seedsym:
system("cls");
showscreen();
printf2("请输入游戏种子(空串则使用随机种子):");
seedv2=seedv=gc=ct__=0;
isstrint=1;
for(ct__=0;(gc=getchar())!='\n';ct__++){
if(ct__>133330){
system("cls");
printf("错误:种子长度过长,若需重输种子按1,否则按2键使用随机种子:");
gc=_getch();
if(gc=='1') goto seedsym;
else if(gc=='2'){ct__=0;break;}
}
seedstr[ct__]=gc;
if(gc=='\r'){
ct__--;
continue;
}
if(!('0'<=gc && gc<='9')) isstrint=0;
seedv+=seedpow(gc,31)+137896873;
seedv*=seedpow(gc,7)+99063253;
seedv^=1378392839;
}
seedstr[ct__]='\0';
if(ct__==0){
srand(time(0)*rand()+rand()*rand()^3029292941);
seedv=(time(0)*rand()+rand()*rand())^3029292941;
}
else if(isstrint){
seedsti();
if(seedv2>=0) seedv=seedv2;
else isstrint=0;
}
srand(seedv);
startclock=tempclock=clock();
system("cls");
showscreen();
while(clock()-tempclock<5000){
printf("%.2f\r",(5000-clock()+tempclock)/1000.0);
Sleep(50);
}
system("cls");
tempclock=clock();
//gamestart
score=1;lastscore=woodt=0;
for(tick=1;tick<=70;tick++){
start70forsym:
#ifndef Debugground
system("cls");
showstart();
printf("tick:%d wood:%d protecttick:%d score:%d ",tick,woodt,protecttick,score);
if(score-lastscore>1){
SetConsoleTextAttribute(hConsole,2);
printf("+%d ",score-lastscore);
SetConsoleTextAttribute(hConsole,7);
}
else printf("+1 ");
lastscore=score;
achiif();
printf("\n");
#ifdef Peopleinfo
printf("x:%d y:%d jumpup:%d ",x,y,jumpup);
#endif
#ifdef Seedinfo
printf("seedv:%u ",seedv);
if(ct__>100) printf("seedstr is too long ");
else if(ct__>0 && !isstrint) printf("seedstr:%s ",seedstr);
#endif
achishow();
//---
if(x<0){
Sleep(1000);
system("cls");
printtext(" _____ ______ _________ ________ ______ \n\\ / / \\ | | | \\ | | | \\ \n \\ / | | | | | | | | | |\n \\ / | | | | | | | | | |\n \\ / | | | | | | | |-------- | |\n | | | | | | | | | | |\n | | | | | | | | | | |\n | \\_____/ \\_____/ |______/ ____|____ |________ |______/\n",4);
printf("You are out...\n");
Sleep(2000);
printf("You has lived:%d ticks and get %d scores!\n",tick,score);
Sleep(2000);
printf("种子:%u\n",seedv);
for(int i=0;i<=achivementtotal;i++){achishow2(i);Sleep(50);}
Sleep(3000);
printf("Press any key......");
_getch();
goto startsym;
}
for70ispressp:
if(ispressp){
printf("\n游戏暂停(按p键继续,a键显示成就,r键重开)");
Sleep(100);
while(1){
gc=_getch();
if(gc=='p' or gc=='P'){
ispressp=0;
Sleep(100);
break;
}
else if(gc=='a' or gc=='A'){
system("cls");
for(int i=0;i<=achivementtotal;i++){achishow2(i);}
printf("具体教程见主界面“成就帮助”。");
Sleep(3000);
printf("\nPress any key...");
_getch();
goto start70forsym;
}
else if(gc=='r' or gc=='R'){
system("cls");
showscreen();
printf("是否放弃本轮,回到主界面?(y/n)");
while(1){
gc=_getch();
if(gc=='y' or gc=='Y'){
ispressp=0;
goto startsym;
}
else if(gc=='n' or gc=='N'){
goto start70forsym;
}
}
}
}
}
while(clock()-tempclock<ticksp){
checkkeys()
goto for70ispressp;
}
#endif
protecttick++;
nopressdtick++;
nopresswtick++;
movepeople();
if(y>=lastjumpy) is2dt=is3dt=isndt=0;
if(screen[y+1][x]!='-' && screen[y+1][x]!='=' && screen[y+1][x]!='~') treewalktick++;
else treewalktick=0;
if(x<=9) staylefttick++;
else staylefttick=0;
if(x==0) stayx0tick++;
else stayx0tick=0;
score++;
tempclock=clock();
}
groundmove();
forsym:
system("cls");
showscreen();
printf("tick:%d wood:%d protecttick:%d score:%d ",tick,woodt,protecttick,score);
if(1<score-lastscore && score-lastscore<100) SetConsoleTextAttribute(hConsole,2);
else if(100<=score-lastscore && score-lastscore<=1000) SetConsoleTextAttribute(hConsole,14);
else if(score-lastscore>1000) SetConsoleTextAttribute(hConsole,13);
else SetConsoleTextAttribute(hConsole,7);
printf("+%d ",score-lastscore);
SetConsoleTextAttribute(hConsole,7);
lastscore=score;
achiif();
printf("\n");
//---
#ifdef Groundinfo
printf("landscape:%d ",landscape);
#ifdef GroundinfoMore
printf("ishighland:%d isforest:%d ismonster:%d",ishighland,isforest,ismonster);
#endif
#ifdef GroundinfoChinese
printf("(");
if(ishighland) printf("高原");
if(isforest) printf("森林");
if(ismonster) printf("test");
switch(landtype){
case 1:case 4:
switch(landscape){
case 10:
printf("山地");
break;
case 50:
printf("丘陵");
break;
case 100:
case 150:
printf("丘原");
break;
case 250:
if(!ishighland) printf("平原");
break;
default:printf("特殊地形");
}
if(landtype==4) printf("溶洞");
break;
case 2:
if(issea) printf("海洋");
else printf("盆地");
break;
case 3:
printf("风蚀之地");
break;
default:printf("特殊地形");
}
printf(")");
#endif
printf("landhold:%d seay:%d ",landhold,seay);
#endif
//---
#ifdef Peopleinfo
printf("x:%d y:%d jumpup:%d ",x,y,jumpup);//1998374123
#endif
#ifdef Seedinfo
printf("seedv:%u ",seedv);
if(ct__>100) printf("seedstr is too long ");
else if(ct__>0 && !isstrint) printf("seedstr:%s ",seedstr);
#endif
achishow();
//---
if(x<0){
Sleep(1000);
system("cls");
printtext(" _____ ______ _________ ________ ______ \n\\ / / \\ | | | \\ | | | \\ \n \\ / | | | | | | | | | |\n \\ / | | | | | | | | | |\n \\ / | | | | | | | |-------- | |\n | | | | | | | | | | |\n | | | | | | | | | | |\n | \\_____/ \\_____/ |______/ ____|____ |________ |______/\n",4);
/*
_____ ______ _________ ________ ______
\ / / \ | | | \ | | | \
\ / | | | | | | | | | |
\ / | | | | | | | | | |
\ / | | | | | | | |-------- | |
| | | | | | | | | | |
| | | | | | | | | | |
| \_____/ \_____/ |______/ ____|____ |________ |______/
*/
printf("You are out...\n");
Sleep(2000);
printf("You has lived:%d ticks and get %d scores!\n",tick,score);
Sleep(2000);
printf("种子:%u\n",seedv);
for(int i=0;i<=achivementtotal;i++){achishow2(i);Sleep(50);}
Sleep(3000);
printf("Press any key......");
_getch();
goto startsym;
}
forispressp:
if(ispressp){
printf("\n游戏暂停(按p键继续,a键显示成就,r键重开)");
Sleep(100);
while(1){
gc=_getch();
if(gc=='p' or gc=='P'){
ispressp=0;
Sleep(100);
break;
}
else if(gc=='a' or gc=='A'){
system("cls");
for(int i=0;i<=achivementtotal;i++){achishow2(i);}
printf("具体教程见主界面“成就帮助”。");
Sleep(3000);
printf("\nPress any key...");
_getch();
goto forsym;
}
else if(gc=='r' or gc=='R'){
system("cls");
showscreen();
printf("是否放弃本轮,回到主界面?(y/n)");
while(1){
gc=_getch();
if(gc=='y' or gc=='Y'){
ispressp=0;
goto startsym;
}
else if(gc=='n' or gc=='N'){
goto forsym;
}
}
}
}
}
while(clock()-tempclock<ticksp){
checkkeys()
goto forispressp;
}
tempclock=clock();
movescreen();
groundmove();
protecttick++;
nopressdtick++;
nopresswtick++;
movepeople();
if(y>=lastjumpy) is2dt=is3dt=isndt=0;
if(screen[y+1][x]!='-' && screen[y+1][x]!='=' && screen[y+1][x]!='~') treewalktick++;
else treewalktick=0;
if(x<=9) staylefttick++;
else staylefttick=0;
if(x==0) stayx0tick++;
else stayx0tick=0;
score++;
tick++;
goto forsym;
return 0;
}