Skip to content

Instantly share code, notes, and snippets.

@farteryhr
Created November 6, 2011 07:07
Show Gist options
  • Save farteryhr/1342579 to your computer and use it in GitHub Desktop.
Save farteryhr/1342579 to your computer and use it in GitHub Desktop.
俄罗斯方块EX 控制台版 c++代码 by Farteryhr
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <time.h>
#include <math.h>
#include <string.h>
#define u16 unsigned short
char XC[2001]={0};
const char* blk[30]={
"oo",
"\262\262","\262\262","\262\262","\262\262","\262\262","\262\262","\262\262","\262\262",
"\261\261","\261\261","\261\261","\261\261","\261\261","\261\261","\261\261","\261\261",
"\260\260","\260\260","\260\260","\260\260","\260\260","\260\260","\260\260","\260\260",
"\40\40","\333\333","\333\333"};
char Farteryhr[2000];
int ydgb(int x, int y)
{ COORD cd;
cd.X=x*2;cd.Y=y;
return SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),cd);}
int zbwb(int x,int y,char *str){
char*iptr=str,*gptr=&XC[x*2+y*80];
while(*str!='\0')*(gptr++)=*(str++);}
int textcolor(short iColor){
HANDLE hd=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbInfo;
GetConsoleScreenBufferInfo(hd, &csbInfo);
return SetConsoleTextAttribute(hd, iColor|(csbInfo.wAttributes&~0xF));}
int gtpc(int x,int y,const char*str){
XC[y*80+x*2]=str[0];
XC[y*80+x*2+1]=str[1];}
int sgn(int num){
if(num>0)return 1;
if(num==0)return 0;
if(num<0)return -1;}
int Fun0(void);
int Fun1(void);
int Fun2(int,int,int,int);
int Fun3(int,int,int,int);
int Fun4(int);
int Fun5(void);
int Fun6(void);
int Fun7(void);
char *Fun8(int);
int Fun9(void);
int Fun10(void);
int Fun11(void);
int Fun12(void);
int Fun13(int);
bool Fun14(int,int,int,int);
bool Fun15(int,int,int);
int Fun16(int,int,int,int);
int Fun17(void);
int Fun18(void);
int Fun19(int,int);
bool Fun20(int,int,int);
int Fun21(int,int,int,int);
int Fun22(int,int);
int Fun23(void);
int Fun24(int);
int Fun25(int,int);
int Fun26(int);
int Fun27(void);
int Fun28(void);
int cj0=0,cj1=0,cj2=0,cj3=0,cj4=0,cj5=0,cj6=0;
int aj0=48,aj1=0,aj2=0,aj3=80,aj4=0,aj5=0;
int csiz=0,cmut=0,cdbg=0;
int iS=0,iR=0,iX=0,iY=0,iH=0,iA=0,iD=0;
int kp0=0,kp1=0,kp2=0,kp3=0,kp4=0,kp5=0,kp6=0,kp7 =0;
int kc0=0,kc1=0,kc2=0,kc3=0,kc4=0,kc5=0,kc6=0,aj0d=0;
int n0=0,n1=0,n2=0,n3=0,m0=0,m1=0,m2=2;
double SS;
int m9=8,m99=0;
int g0=0,g1=0,g2=5,g3=2,g4=8,g5=-1,mg4=4,mg5=0,g6=0,g7=-1;
int kl=0,kls[22]={0};
int hbp=0,hbs[4]={0,0,0,0};
int nbssss[3]={0};
int g8=5,g9=5;
int iF[25][30]={0};
int D0[21]= { 1, 1, 1, 1, 1, 1, 1, 2, 3, 5, 20,20,20,20,20,20,20,20,20,20, 20};
int D1[21]= {60,30,15, 8, 4, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int D2[21]= {40,40,40,40,40,40,40,40,40,40, 40,33,28,24,20,18,15,12,10, 8, 20};
int D3[21]= {20,20,20,20,20,20,20,20,20,20, 12,12,12, 9, 9, 6, 6, 6, 6, 6, 10};
int D4[21]= {25,25,25,25,25,15,15,15,15,15, 10,10,10, 6, 6, 4, 4, 4, 4, 4, 4};
int D5[21]= {12,12,12,12,12,10,10,10,10,10, 8, 8, 8, 8, 8, 6, 6, 6, 4, 4, 4};
char*strL[21]={"H0","H1","H2","H3","H4","H5","H6","H7","H8","H9","M0",
"M1","M2","M3","M4","M5","M6","M7","M8","M9","WTF"};
int isssssty=1;
int icccccol[2][8]={
{0,1,2,3,4,5,6,7},
{0,3,2,6,4,5,7,1}};
int ini0[2][8]={
{0,0,0,0,0,0,0,0},
{2,2,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,curfps=0,curffps=0;
int Fun0(){
kp0=sgn(int(GetAsyncKeyState(KK0)&0x8000));
kp1=sgn(int(GetAsyncKeyState(KK1)&0x8000));
kp2=sgn(int(GetAsyncKeyState(KK2)&0x8000));
kp4=sgn(int(GetAsyncKeyState(KK4)&0x8000));
kp5=sgn(int(GetAsyncKeyState(KK5)&0x8000));
kp6=sgn(int(GetAsyncKeyState(KK6)&0x8000));
kp3=sgn(int(GetAsyncKeyState(KK3)&0x8000));
kp7=sgn(int(GetAsyncKeyState(KK7)&0x8000));
aj1=sgn(int(GetAsyncKeyState(aj0)&0x8000));
aj4=sgn(int(GetAsyncKeyState(aj3)&0x8000));}
int Fun1(){
int P=0,jf=0,xx=0,yy=0;
for(xx=0;xx<4;xx++){
for(yy=0;yy<4;yy++){
if(iK[iS][iR*16+yy*4+xx]!=-1){
iF[iX+xx+g8][iY+yy+g9]=n0>=15?0:iS;}}}
SS += pow(2.0,((20.0-iY)/20))*pow(2,(n0/ 5))*25;
n2=0;
m1=-1;
Fun3(iS,iR,iX,iY);
P=Fun18();
cj6=1;
if(P!=0){
iD=D4[n0];
iA=5;}else{
iD=D3[n0];
iA=1;}
if(n1>=100){
n1-=100;
n0++;
Fun5();
if(n0==10||n0==20){
iA=4;
iD=0;}}}
int Fun2(int bs,int br,int bx,int by){
if(n0<10){
for(int xx=0;xx<4;xx++){
for(int yy=0;yy<4;yy++){
if(iK[bs][br*16+yy*4+xx]!=-1){
sBs[bx+xx][by+yy]=n0>=15?0+16+1:icccccol[isssssty][iS]+16+1;
sBst[bx+xx][by+yy]=1;}}}}}
int Fun3(int bs,int br,int bx,int by){
for(int xx=0;xx<4;xx++){
for(int yy=0;yy<4;yy++){
if(iK[bs][br*16+yy*4+xx]!=-1){
sBs[bx+xx][by+yy]=26;
sBst[bx+xx][by+yy]=4;}}}}
int Fun4(int nocurr){
QueryPerformanceCounter(&stT_T);
memset(XC,32,2000);
int tmp;
for(int P=0;P<10;P++){
for(int P2=0;P2<22;P2++){
if(n0==20&&iA!=4){
fBs[P][P2]=25;}else{
if(iF[P+g8][P2+g9]==-1){
fBs[P][P2]=25;}
else{
fBs[P][P2]=8+icccccol[isssssty][iF[P+g8][P2+g9]]+1;}}}}
for(int P=0;P<10;P++)
for(int P2=0;P2<22;P2++)
if(sBst[P][P2]>=0)fBs[P][P2]=sBs[P][P2];
if(nocurr==0){
tmp=Fun25(20,1);
for(int P=0;P<4;P++){
for(int P2=0;P2<4;P2++){
if(iK[iS][iR*16+P+P2*4]!=-1){
if(iA!=4&&iA!=5&&n0<5)fBs[iX+P][tmp+P2]=16+icccccol[isssssty][iS]+1;
fBs[iX+P][iY+P2]=n0>=15?1:icccccol[isssssty][iS]+1;}}}}
if(cj3==0){
for(int P=0;P<10;P++){
for(int P2=0;P2<22;P2++){
gtpc(P+g2+g0,P2+g3+g1,blk[fBs[P][P2]]);}}}else{
for(int P=0;P<10;P++){
for(int P2=2;P2<22;P2++){
if(fBs[P][P2]!=25)
gtpc(P+g2+g0,P2+g3+g1,blk[25]);}}}
for(int P=0;P<16;P++){
if(int(P/4)-ini1[isssssty][iH]>=0&&int(P/4)-ini1[isssssty][iH]<=3){
if(iK[iH][ini0[isssssty][iH]*16-ini1[isssssty][iH]*4+P]!=-1)
gtpc(P%4+g0+g6,P/4+g1+g7,blk[n2==1?9:(n0>=15?1:icccccol[isssssty][iH]+1)]);}}
for(int P=0;P<3;P++){
for(int P2=0;P2<16;P2++){
if(int(P2/4)-ini1[isssssty][nbssss[P]]>=0&&int(P2/4)-ini1[isssssty][nbssss[P]]<=3){
if(iK[nbssss[P]][ini0[isssssty][nbssss[P]]*16-ini1[isssssty][nbssss[P]]*4+P2]!=-1)
gtpc(P*mg4+P2%4+g0+g4,P*mg5+P2/4+g1+g5,blk[n0>=15?1:icccccol[isssssty][nbssss[P]]+1]);}}}
for(int P=-1;P<11;P++){
gtpc(P+g2+g0,g3+1+g1,blk[27]);
gtpc(P+g2+g0,g3+22+g1,blk[27]);}
for(int P=2;P<22;P++){
gtpc(g2-1+g0,g3+P+g1,blk[27]);
gtpc(g2+10+g0,g3+P+g1,blk[27]);}
QueryPerformanceCounter(&edT_T);
frmT_T.QuadPart=edT_T.QuadPart-stT_T.QuadPart;
sprintf(Farteryhr,"Level:%s-%d",Fun8(n0),n1);
zbwb(g0+16,g1+5,Farteryhr);
sprintf(Farteryhr,"Lines:%d",n3);
zbwb(g0+16,g1+6,Farteryhr);
sprintf(Farteryhr,"Score:%d%c",int(SS),cj2==1?'!':'\0');
zbwb(g0+16,g1+7,Farteryhr);
sprintf(Farteryhr,"T-EX 20111106");
zbwb(g0+16,g1+8,Farteryhr);
sprintf(Farteryhr,"Press P to %s",cj3==0?"Pause":"Continue");
zbwb(g0+16,g1+9,Farteryhr);
sprintf(Farteryhr,"Farteryhr %.3fms",float(frmT_T.QuadPart)/T_Tf.QuadPart*1000);
zbwb(g0+16,g1+14,Farteryhr);
ydgb(0,0);
XC[1999]='\0';
printf("%s\r",XC);}
int Fun5(){
kc0=0;kc1=0;
m0=Fun6();}
int Fun6(){
return D5[n0];}
int Fun7(){
iD=D2[n0];
return 0;}
char* Fun8(int level){
return strL[level];}
int Fun9(){
if(nbssss[0]==0){
nbssss[0]=Fun10();
nbssss[1]=Fun10();
nbssss[2]=Fun10();}else{
nbssss[0]=nbssss[1];nbssss[1]=nbssss[2];
nbssss[2]=Fun10();}}
int Fun11(){
int tmp;
iR=ini0[isssssty][iS];
iX=3;iY=ini1[isssssty][iS];
iA=2;m1=0;
tmp=m2;m2=0;
Fun22(0,0);
m2=tmp;m99=0;
if(!Fun14(iS,iR,iX,iY)){
Fun1();iD=0;iA=4;cj5=1;return 0;}
if(n1!=99)n1++;
if(D1[n0]==0)Fun25(20,0);
else iD=D1[n0];
cj6=0;}
int Fun10(){
int rollrnd=0,rollflg=0;
for(int Pr=0;Pr<4;Pr++){
rollrnd=rand()%7+1;
rollflg=0;
for(int Pn=0;Pn<6;Pn++){
if(hbs[Pn]==rollrnd){
rollflg=1;
break;}}
if(rollflg==0){
hbs[hbp]=rollrnd;
hbp++;
hbp=(hbp>=4)?hbp-4:hbp;
return rollrnd;}}
hbs[hbp]=rollrnd;
hbp++;
hbp=(hbp>=4)?hbp-4:hbp;
return rollrnd;}
int Fun12(){
if(kp4==1&&kc4==0){kc4=1;Fun13(0);Fun13(1);}
if(kp5==1&&kc5==0){kc5=1;Fun13(0);Fun13(-1);}
if(kp6==1&&kc6==0){kc6=1;Fun13(1);Fun13(-1);}
if(kp4==0)kc4=0;
if(kp5==0)kc5=0;
if(kp6==0)kc6=0;}
int Fun13(int a){
if(a==-1){
if(kc4==1)kc4=2;}else if(a==1){
if(kc5==1)kc5=2;}else if(a==0){
if(kc6==1)kc6=2;}}
bool Fun14(int blox,int rmode,int tx,int ty){
for(int xx=0;xx<4;xx++){
for(int yy=0;yy<4;yy++){
if(iK[blox][rmode*16+yy*4+xx]!=-1){
if(iF[tx+xx+g8][ty+yy+g9]!=-1){
return false;}}}}
return true;}
bool Fun15(int dmode,int dx,int dy){
if(-dy>m2||iY+dy<m1-m2)return false;
if(Fun14(iS,Fun19(iR,dmode),iX+dx,iY+dy))return true;
else return false;}
int Fun16(int dmode,int dx,int dy,int isro){
iR=Fun19(iR,dmode);iX+=dx;iY+=dy;
if(dmode==1)kc5=2;
if(dmode==-1)kc4=2;
if(isro==1)kc6=2;
if(iA==3){
if(m99<m9){
Fun7();
m99++;}}}
int Fun17(){
int xx=0,yy=0,zz=0,ww=0,ked[30];
for(yy=-g9;yy<22;yy++)ked[yy+g9]=0;
for(xx=0;xx<kl;xx++)ked[kls[xx]+g9]=1;
for(yy=21;yy>=0;yy--){
zz=0;
for(xx=0;xx<kl;xx++)if(kls[xx]>=yy)zz++;
ww=yy;
while(zz>0){
ww--;
if(ked[ww+g9]==0)zz--;}
if(ww<yy){
for(xx=0;xx<10;xx++){
iF[xx+g8][yy+g9]=iF[xx+g8][ww+g9];}}}
if(cj2==1&&kl>1&&n0!=20){
if(n0<10)
kl--;
else if(n0>=15)
kl=int(pow(2,(kl-1)));
for(xx=0;xx<10;xx++){
for(yy=0;yy<22-kl;yy++){
iF[xx+g8][yy+g9]=iF[xx+g8][yy+kl+g9];}
for(yy=22-kl;yy<22;yy++){
iF[xx+g8][yy+g9]=0;}}
ww=rand()%10;
for(yy=22-kl;yy<22;yy++)
iF[ww+g8][yy+g9]=-1;}}
int Fun18(){
int xx=0,yy=0,zz=0,ww=0,P=0,foff[22];
double jf=0;
kl=0;
for(yy=0;yy<22;yy++){
zz=0;
for(xx=0;xx<10;xx++)zz+=iF[xx+g8][yy+g9]==-1?0:1;
if(zz==10){
for(xx=0;xx<10;xx++){
if(iF[xx+g8][yy+g8-1]!=-1)int(iF[xx+g8][yy+g9-1]/2)*2;
if(iF[xx+g8][yy+g8+1]!=-1)int(iF[xx+g8][yy+g9+1]/4)*4+iF[xx+g8][yy+g9+1]%2;
iF[xx+g8][yy+g9]=-1;
sBs[xx][yy]=26;
sBst[xx][yy]=2;}
kls[kl]=yy;
kl++;
P+=1;jf+=pow(2.0,double(n0)/5.0)*150;}else{
kls[yy]=0;}}
n1=(n0==20)?0:n1+P;
SS+=P*jf;n3+=P;
return P;}
int Fun19(int a,int b){
if(a+b>=4)return a+b-4;
if(a+b<0)return a+b+4;
return a+b;}
int wktblc[3]={7,8,8};
int wktbl[3][8][2]={
{{0,0},{1,0},{1,1},{0,1},{-1,1},{-1,0},{0,-1}},
{{1,0},{1,1},{2,0},{0,0},{0,-1},{0,1},{-1,1},{-1,0}},
{{-1,0},{-1,1},{-1,2},{0,1},{0,0},{0,-1},{1,0},{1,1}}};
bool Fun20(int dmmode,int dire,int tT_T){
if(Fun15(dire,wktbl[dmmode][tT_T][0]*dire,wktbl[dmmode][tT_T][1]))return true;
return false;}
int Fun21(int dmmode,int dire,int tT_T,int ro){
Fun16(dire,wktbl[dmmode][tT_T][0]*dire,wktbl[dmmode][tT_T][1],ro);}
int Fun22(int moving,int dire){
int ro=0;
if(kc5!=1&&kc4!=1&&kc6!=1)return 0;
if(dire==0){
if(kc4==1)dire=-1;
if(kc5==1)dire=1;}else{
ro=1;}
if(moving==0){
for(int P=0;P<wktblc[0];P++)
if(Fun20(0,dire,P)){
Fun21(0,dire,P,ro);
break;}}
else if(dire==moving){
for(int P=0;P<wktblc[1];P++)
if(Fun20(1,dire,P)){
Fun21(1,dire,P,ro);
break;}}
else if(dire!=moving){
for(int P=0;P<wktblc[2];P++)
if(Fun20(2,dire,P)){
Fun21(2,dire,P,ro);
break;}}
if(kc6==1&&ro==0){
if(iA==1)Fun16(2,0,0,1);
else if(kp4!=kp5){
if(kp4==1)Fun22(moving,-1);
else Fun22(moving,1);}}}
int Fun23(){
int moved=0;
if(kp0==0)kc0=0;
else if(kp0==1){
if(kc0==0){
if(kp1==1){
kc1=m0+1;kc0=1;}else{
kc0=1;}}
else if(kc0==m0+1&&kp1==0)kc0=m0;
if(kc0==1||kc0==m0){
if(Fun15(0,-1,0)){
iX--;moved=1;
if(iA==3){
if(m99<m9){
Fun7();
m99++;}}}}else{
if(Fun15(0,-1,0)){
moved=1;}}
kc0=(kc0>=m0)?kc0:kc0+1;}
if(kp1==0)kc1=0;
else if(kp1==1){
if(kc1==0){
if(kp0==1){
kc0=m0+1;kc1=1;}else{
kc1=1;}}
else if(kc1==m0+1&&kp0==0)kc1=m0;
if(kc1==1||kc1==m0){
if(Fun15(0,1,0)){
iX++;moved=1;
if(iA==3){
if(m99<m9){
Fun7();
m99++;}}}}else{
if(Fun15(0,1,0)){
moved=1;}}
kc1=(kc1>=m0)?kc1:kc1+1;}
Fun2(iS,iR,iX,iY);
if(moved!=1){
if(kc0!=m0+1&&kp0==1) return -1;
if(kc1!=m0+1&&kp1==1) return 1;}
return 0;}
int Fun24(int bisinf){
int tmp;
if(kp7==0)aj0d=0;
if(sH==1&&n2==0){
if(bisinf==1){
if(kp7==1&&aj0d==0){
aj0d=2;n2=1;
if(iH==0){
iH=iS;iS=nbssss[0];Fun9();}else{
tmp=iH;iH=iS;iS=tmp;}
Fun11();}}else{
if(kp7==1&&aj0d==0){
aj0d=2;n2=1;
if(iH==0){
iH=nbssss[0];Fun9();}else{
tmp=iH;iH=nbssss[0];nbssss[0]=tmp;}}}}}
int Fun25(int blocks,int notreallydo){
int zzz;
if(notreallydo==0){
for(zzz=0;zzz<blocks;zzz++){
Fun2(iS,iR,iX,iY+zzz);
if(!Fun14(iS,iR,iX,iY+zzz+1)){
iY+=zzz;
if(m1<iY||iA==2){
m1=iY;
Fun7();}
Fun7();
iA=3;return iY;}}
iY+=zzz;return iY;}else{
for(zzz=0;zzz<blocks;zzz++){
if(!Fun14(iS,iR,iX,iY+zzz+1)){
return iY+zzz;}}
return iY+zzz;}}
int die(){
if(SS>cj0&&cj2==0){
cj0=int(SS);
cj1=0;}
Fun27();}
int Fun26(int frames) {
for(int tz=0;tz<frames;tz++){
int xed=0,zzz=0,moved=0,xx=0,yy=0,zz=0,ww=0,P=0,jf=0,tmp=0,tmp2=0;
Fun0();
if(aj1==1&&aj2==0){
aj2=1;n1+=100;cj2=1;}else if(aj1==0)aj2=0;
if(aj4==1&&aj5==0){
aj5=1;cj3=1-cj3;}else if(aj4==0)aj5=0;
if(cj3==0){
cj6=0;
switch(iA){
case 1:{
cj6=1;
iD--;
if(iD<=0){
iS=nbssss[0];
Fun11();
Fun9();
break;}
Fun24(0);
if(kp0==1&&(kc0==0||kp1==0)){
kc0=m0;kc1=m0+1;}else if(kp1==1&&(kc1==0||kp0==0)){
kc1=m0;kc0=m0+1;}
if(kp3==0&&kc3==1)kc3=0;
Fun12();
break;}
case 2:{
if(kp2==1&&kc2==0){
if(n0<5)iD=1;
else Fun25(20,0);}
if(kp2==0)kc2=0;
if(kp3==0)kc3=0;
if(kp3==1&&kc3==0){
Fun25(20,0);
kc3=2;
Fun1();
break;}
Fun24(1);
if(iA!=2)break;
tmp=Fun23();
Fun12();
Fun22(tmp,0);
iD--;
if(iD<=0){
Fun25(D0[n0],0);
if(iA==2)iD=D1[n0];
break;}
break;}
case 3:{
if(kp3==1&&kc3==0){iD=1;kc3=1;Fun1();break;}
if(kp2==0)kc2=0;
Fun24(1);
if(iA!=3)break;
tmp=Fun23();
Fun12();
Fun22(tmp,0);
if(Fun14(iS,iR,iX,iY+1)){
tmp=m1;
if(D1[n0]!=0){
if(Fun25(D0[n0],0)>tmp){
iA=2;iD=D1[n0];}}else{
if(Fun25(20,0)>tmp)iD=D2[n0];}}else{
iD-=1;
if(iD<=0){
Fun1();
break;}}
break;}
case 4:{
cj6=1;
if(cj5==1){
if(iD%10==0)
for(int a=0;a<10;a++){
if(iF[a+g8][21-int(iD/8)+g9]!=-1){
sBs[a][21-int(iD/10)]=icccccol[isssssty][iF[a+g8][21-int(iD/10)+g9]]+16+1;
sBst[a][21-int(iD/10)]=5;
iF[a+g8][21-int(iD/10)+g9]=-1;}}
iD++;
if(iD==219)die();}else{
if(iD%8==0)
for(int a=0;a<10;a++){
if(iF[a+g8][21-int(iD/8)+g9]!=-1){
sBs[a][21-int(iD/8)]=26;
sBst[a][21-int(iD/8)]=4;
iF[a+g8][21-int(iD/8)+g9]=-1;}}
iD++;
if(iD==176){iA=1;iD=60;}}}
break;
case 5:{
cj6=1;
if(kp3==0&&kc3==1)kc3=0;
iD-=1;
if(iD<=0){
Fun17();
iA=1;
iD=D3[n0];}
Fun24(0);
if(kp0==1&&(kc0==0||kp1==0)){
kc0=m0;kc1=m0+1;}else if(kp1==1&&(kc1==0||kp0==0)){
kc1=m0;kc0=m0+1;}
Fun12();}
break;}}
for(int P=0;P<10;P++)
for(int P2=0;P2<22;P2++)
if(sBst[P][P2]>=0)sBst[P][P2]-=1;}
Fun4(cj6);}
int Fun27(){
for(int P=0;P<10;P++){
for(int P2=-5;P2<22;P2++){
iF[g8+P][g9+P2]=-1;}}
SS=0;n3=0;n1=0;m1=0;iS=0;iH=0;
Fun9();iA=1;
iD=120;n0=0;Fun5();
kp0=0;kc0=0;
kp1=0;kc1=0;
kp2=0;kc2=0;
kp4=0;kc4=0;
kp5=0;kc5=0;
kp6=0;kc6=0;
kp3=0;kc3=0;
kp7=0;aj0d=0;
cj2=0;
cj5=0;}
int Fun28(){
Fun27();
QueryPerformanceFrequency(&T_Tf);
frmdl=T_Tf.QuadPart/60;
QueryPerformanceCounter(&T_Te);
T_T1=T_Te;
T_T2=T_Te;
while(1){
QueryPerformanceCounter(&T_Te);
if((T_Te.QuadPart-T_T1s.QuadPart)>=T_Tf.QuadPart){
T_T1s.QuadPart+=T_Tf.QuadPart;
curfps=fps;
curffps=ffps;
fps=0;
ffps=0;}
QueryPerformanceCounter(&T_T2);
if(T_T2.QuadPart-T_T1.QuadPart>=frmdl){
f2rf=int((T_T2.QuadPart-T_T1.QuadPart)/frmdl);
T_T1.QuadPart+=(long long)f2rf*frmdl;
stT_T=T_T2;
Fun26(f2rf);
fps+=f2rf;
ffps++;}
Sleep(1);}}
int main(){
SetConsoleOutputCP(437);
srand(time(NULL));
Fun28();
return 0;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment