做的一个俄罗斯方块,在全局变量就通过不了了

2019-03-24 19:34发布

第一次碰见这种情况,shit是我生气打上的,但还是通过不了
ELUOSI.C(25): error C244: 'shit': can't initialize, bad type or classELUOSI.C(25): error C132: 'shit': not in formal parameter list
#include<reg52.h>#include"anjian.h"#include"12864.h"
#define xia 0#define zuo 1#define you 2#define zhuanxiang 3#define zuobi 4
#define mod1 100#define mod2 101
char shit=0x01;
char code LTIOX[4][4][4]={{{2,2,2,3},{1,2,3,3},{2,2,2,1},{3,2,1,1}},   //L  {{2,1,2,3},{1,2,2,2},{2,3,2,1},{3,2,2,2}},   //T  {{2,2,2,2},{1,2,3,4},{0,0,0,0},{0,0,0,0}},   //I  {{1,2,1,2},{0,0,0,0},{0,0,0,0},{0,0,0,0}}};           //O char code LTIOY[4][4][4]={{{1,2,3,3},{2,2,2,1},{3,2,1,1},{2,2,2,3}},   //L  {{1,2,2,2},{2,3,2,1},{3,2,2,2},{2,3,2,1}},   //T  {{1,2,3,4},{2,2,2,2}},   //I  {{1,1,2,2}}};   //O
char x,y,xn[4],yn[4];char class=0,stat=0,clock,run,draw=0,next=0,mod=100;char beijing[2][8],tuxiang[2][8],zhuanhuan[16];int fenshu=0;
void init(){ TMOD=0X22; TR1=1; TL0=(65535-50000)%255; TH0=(65535-50000)/255; EA=1; ET0=1; clock=20; TR0=1; next=1; yj_init(); yj_Clear_GDRAM(); yj_zhiling(0x01); yj_zhiling(0x34); yj_zhiling(0x36);}
void yanzheng(){ char i,j,k,l=0,character=0; for(i=0;i<=2;i++) { for(j=0;j<8;j++) { for(k=0,character=0;k<8;k++) { character<<=1; character|=tuxiang[k]>>(7-j); } zhuanhuan[l++]=character; } } for(l=0;l<16;l++) { if(zhuanhuan[l++]==0xff) manhang(l); } for(i=0;i<2;i++) { for(j=0;j<8;j++) { beijing[j]=tuxiang[j]; } } }
void new(){   class=TL1%4; x=3; y=0; TR0=1; }
char fangkuai(){ char i,j; for(i=0;i<4;i++) { xn=x+LTIOX[class][stat]; yn=y+LTIOY[class][stat]; if(xn<0||xn>7) return 2; if(yn<0||yn>15) return 2; } for(i=0;i<2;i++) { for(j=0;j<8;j++) { tuxiang[j]=beijing[j]; } } for(i=0;i<4;i++) if(xn<8) { if((tuxiang[0][yn]&(1<<xn))!=0) return 1; } else { if((tuxiang[0][yn]&(1<<xn-7))!=0) return 1; } for(i=0;i<4;i++) if(xn<8) tuxiang[0][yn]|=1<<xn; else tuxiang[1][yn]|=1<<(xn-7); return 0; }
void zhuanxiangfun(){ char unstat=stat; TR0=0; switch(class) { case 0: case 1: if(class==0||class==1) { unstat+=1; if(unstat==4) unstat=0; break; } case 2: if(class==2) { unstat+=1; if(unstat==2) unstat=0; break; } case 3:    break; } switch(fangkuai()) { case 0: draw=1; stat=unstat; break; case 1: break; case 2:break; } TR0=1;}
void zuobifun(){ char i,j; TR0=0; for(i=0;i<2;i++) { for(j=0;j<7;j++) { beijing[j]<<=1; } } switch(fangkuai()) { case 0: draw=1; break; case 1: break; case 2: break; } TR0=1;}
void main(){ init(); while(1) { if(next==1) { next=0; new(); run=1; } pingyi(anjian()); if(draw==1) { drawfun(); draw=0; } }}
此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。