📄 znewf02.c
字号:
if (gColorGraSelectMode == 0)
{
}
else if (gColorGraSelectMode == 1)
{
unsigned int perPointDisDMXValue = 100 / temp ;
unsigned int staticColorGraPointNum = scenes[13] / perPointDisDMXValue ;
if ( i >(staticColorGraPointNum * 2) )
{
return;
}
}
else
{
if (colorGraPointNum > (2*temp))
{
colorGraPointNum = 1;
}
if (gColorGraMode ==1)
{
if (i > colorGraPointNum)
{
return;
}
}
else if ((gColorGraMode >=2) &&(gColorGraMode <=7))
{
if (i <=colorGraPointNum)
{
Color =colorGraFore;
}
else
{
Color =colorGraBack;
}
}
else
{
if (i <colorGraPointNum)
{
LaserOn(0);
if (x ==127)
{
IsStartPoint=1;
continue;
}
else
{
WalkeToXY(x,y,200);
continue;
}
}
}
}
/*------------------------------------------------------------*/
DisPlayFlag1=(DisPlayFlag1+1)%1;
DisPlay2=!DisPlay2;
//--------------------------------------------------------//
if(x==127)
{
Delay(300);
LaserOn(0);
IsStartPoint=1;
continue;
}
//------------------------------------------------------------//
j++;
if (((ColorMode >=3)&&(ColorMode <= 4))&&(j ==1))
{
Color =0;
}
if(((ColorMode>=3) &&(ColorMode <=4)) &&((j%3) ==0))
{
switch(ColorMode)
{
case 3: Color=(((j/3)+1)%4);break;
case 4: Color=(((j/3)+Flow)%3);break;
}
}
//------------------------------------------------------------//
x=x+Dx;
y=y+Dy;
/*-------------------=CB=F5=B7=C5-----------------------*/
if(scenes[7]>10)
{
int TempX,TempY;
TempX = x,TempY =y;
if(ZoomX>=0&&ZoomX<10)
{TempX=(TempX-Dx)/(0-ZoomA[ZoomX])/1+Dx;}
else if(ZoomX>=10&&ZoomX<20)
{TempX=(TempX-Dx)*ZoomA[ZoomX]/10+Dx;}
if(ZoomY>=0&&ZoomY<10)
{TempY=(TempY-Dy)/(0-ZoomA[ZoomY])/1+Dy;}
else if(ZoomY>=10&&ZoomY<20)
{TempY=(TempY-Dy)*ZoomA[ZoomY]/10+Dy;}
//-------------------------------------------//
if(TempX<-20) TempX=-20;
else if(TempX>20) TempX=20;
if(TempY<-20) TempY=-20;
else if(TempY>20) TempY=20;
x =TempX, y =TempY;
}
/*--------------------=D0=FD=D7=AA--------------------------*/
if(AngleX!=0) x=Dx-((x-Dx)*AngleX)/75;
if(AngleY!=0) y=Dy-((y-Dy)*AngleY)/75;
/*----------------------=C8=C6Z=D6=E1=D0=FD=D7=AA-------------------*/
if(AngleZ!=0)
{
int xx;
int tdx,tdy;
tdx= x-Dx; tdy= y-Dy;
if(AngleZ>0)
{
xx=(tdx*S_cosA[AngleZ] + tdy*S_sinA[AngleZ])/100 +Dx;
y=(tdy*S_cosA[AngleZ] - tdx*S_sinA[AngleZ])/100 +Dy;
x=xx;
}
else
{
xx=(tdx*S_cosA[37+AngleZ] + tdy*S_sinA[37+AngleZ])/100+Dx;
y=(tdy*S_cosA[37+AngleZ] - tdx*S_sinA[37+AngleZ])/100+Dy;
x=xx;
}
}
//--------------------------------------------------//
if(x<-15) x=-15;
if(x>15) x=15;
if(y<-15) y=-15;
if(y>15) y=15;
//--------------------------------------------------//
if(i==1) {LaserOn(0);WalkeToXY(x,y,200);Delay(300);}
else if(IsStartPoint==1)
{LaserOn(0);WalkeToXY(x,y,200);Delay(300);IsStartPoint=0;}
else
{
switch(DisPlayMode)
{
case 0: LaserOn(1);WalkeToXY(x,y,200); break;
case 1:
{
if(DisPlayFlag1==0)
{LaserOn(1);WalkeToXY(x,y,200);Delay(300);}
else {LaserOn(1);WalkeToXY(x,y,200);}
break;
}
case 2:
{
if(DisPlay2){WalkeToXY(x,y,200);Delay(500);LaserOn(1);}
else {WalkeToXY(x,y,200);Delay(500);LaserOn(0);}
break;
}
case 3:
{
DisPlayFlag3=(DisPlayFlag3+1)%1;
if(DisPlayFlag3==0)
{LaserOn(0);WalkeToXY(x,y,200);Delay(500);LaserOn(1);Delay(100);LaserOn(0);}
else {LaserOn(0);WalkeToXY(x,y,200);}
break;
}
default:LaserOn(1);WalkeToXY(x,y,200);break;
}
}
}
}
//-----------------------------------------------------------------------=
uchar cartoonTimes =0,cartoonFlag = 0;
void Show2Pictrue(char code *pPictrue1)
{
//register uint i;
uchar TempDate1,ProgramRecode;
char Dx,Dy;
bit DirectionFalgX,DirectionFalgY;
char ZoomX,ZoomY;
int AngleX,AngleY;
char AngleZ;
bit ZoomXFlage,ZoomYFlage,EddyX,EddyY;
//------------------------------------------------------------------//
uchar tmpScenes1 =scenes[1]/70;
TempDate1=scenes[2]/2;
Dx = 0;
Dy = 0;
DirectionFalgX = 1; /*=CF=F2=D7=F3*/
DirectionFalgY = 1;
AngleZ=0;
AngleY =AngleX = 10;
ZoomXFlage=ZoomYFlage=EddyX=EddyY=1;
while(1)
{
if(WorkMode==0&&DMX_Flag==10)
{LaserOn(0);return;}
//------------------------------------------------------------------//
if(PlayMode==0) {LaserOn(0);return;}
if(Reset==10) return;
if (tmpScenes1 !=(scenes[1]/70))
{
return;
}
if ( ( (PlayMode ==1) || (PlayMode ==2) )&&(cartoonFlag ==1) )
{
cartoonTimes++;
if ( cartoonTimes >18)//20 )
{
cartoonTimes =0;
return;
}
}
/*-----------------=CB=AE=C6=BD=D2=C6=B6=AF---------------------*/
if(scenes[5]==0) Dx=0;
else if(scenes[5]>0&&scenes[5]<=160) {Dx=(char)(scenes[5]/4-20);}
else if(scenes[5]>160&&scenes[5]<=190)
{
Dx=Dx-(scenes[5]-160)/6-1;
if(Dx<=-20) Dx=20;
}
else if(scenes[5]>190&&scenes[5]<=220)
{
Dx=Dx+(scenes[5]-190)/6+1;
if(Dx>=20) Dx=-20;
}
else
{
if(DirectionFalgX)
{Dx=Dx-(scenes[5]-220)/6-1;if(Dx<=-20) DirectionFalgX=0;}
else {Dx=Dx+(scenes[5]-220)/6+1;if(Dx>=20) DirectionFalgX=1;}
}
/*-----------------=B4=B9=D6=B1=D2=C6=B6=AF---------------------*/
if(scenes[6]==0) Dy=0;
else if(scenes[6]>0&&scenes[6]<=160) {Dy= (char)(scenes[6]/4-20);}
else if(scenes[6]>160&&scenes[6]<=190)
{
Dy=Dy-(scenes[6]-160)/6-1;
if(Dy<=-20) Dy=20;
}
else if(scenes[6]>190&&scenes[6]<=220)
{
Dy=Dy+(scenes[6]-190)/6+1;
if(Dy>=20) Dy=-20;
}
else
{
if(DirectionFalgY)
{
Dy=Dy-(scenes[6]-220)/6-1;
if(Dy<=-20)
DirectionFalgY=0;
}
else {Dy=Dy+(scenes[6]-220)/6+1;if(Dy>=20)
DirectionFalgY=1;}
}
/*-----------------=CB=F5=B7=C5---------------------*/
if(scenes[7]<=2) ZoomY=ZoomX=10;
else if(scenes[7]>2&&scenes[7]<=92)
{ZoomY=ZoomX=scenes[7]/3-1;}
else if(scenes[7]>92&&scenes[7]<=146)
{ZoomY=ZoomX=(ZoomX+(scenes[7]-92)/14+1)%21;}
else if(scenes[7]>146&&scenes[7]<=200)
{
ZoomY=ZoomX=ZoomX-(scenes[7]-146)/14-1;
if(ZoomX<=0) ZoomY=ZoomX=19;
}
else
{
if(ZoomXFlage)
{
ZoomY=ZoomX=ZoomX+(scenes[7]-200)/14+1;
if(ZoomX>20) {ZoomY=ZoomX=20;ZoomXFlage=0;}
}
else
{
ZoomY=ZoomX=ZoomX-(scenes[7]-200)/14-1;
if(ZoomX<0) {ZoomY=ZoomX=0;ZoomXFlage=1;}
}
}
/*-------------------Y=D0=FD=D7=AA--------------------*/
if(scenes[10]==0) AngleX=0;
else if(scenes[10]>0&&scenes[10]<=150)
AngleX=scenes[10];
else
{
if(EddyX)
{
AngleX=AngleX+(scenes[10]-151)/10+1;
if(AngleX>150) {AngleX=300-AngleX;EddyX=0;}
}
else
{
AngleX=AngleX-(scenes[10]-151)/10-1;
if(AngleX<0) {AngleX=-AngleX;EddyX=1;}
}
}
/*-------------------X=D0=FD=D7=AA--------------------*/
if(scenes[11]==0) AngleY=0;
else if(scenes[11]>0&&scenes[11]<=150)
AngleY=scenes[11];
else
{
if(EddyY)
{
AngleY=AngleY+(scenes[11]-151)/10+1;
if(AngleY>150) {AngleY=300-AngleY;EddyY=0;}
}
else
{
AngleY=AngleY-(scenes[11]-151)/10-1;
if(AngleY<0) {AngleY=-AngleY;EddyY=1;}
}
}
//-----------------------------------------------//
if(scenes[12]==0) AngleZ=0;
else if(scenes[12]<=180) AngleZ=scenes[12];
else if(scenes[12]<=217)
AngleZ=(AngleZ+(scenes[12]-181)/10+1)%36;
else
{
AngleZ=AngleZ-(scenes[12]-218)/10-1;
if(AngleZ<0) AngleZ=37+AngleZ;
}
//---------------------------------------------------------------------//=
switch(PlayMode)
{
case 1:
{
Show(pPictrue1,Dx,Dy,ZoomX,ZoomY,AngleX,AngleY,AngleZ);
if (VoiceFlag > 0) VoiceFlag--;
HaveShow++;
while ( VoiceFlag == 0&& cartoonFlag ==0 )
{
if( PlayMode!=1|| (ChangPhoto >= gVoiceRhythmNum) )
{
VoiceFlag=5;
ShowTime=0;
ChangPhoto = 0;
return;
}
Show(pPictrue1,Dx,Dy,ZoomX,ZoomY,AngleX,AngleY,AngleZ);
}
if( ((PlayMode !=1) || (ChangPhoto >=gVoiceRhythmNum))&&(cartoonFlag == 0) )
{
VoiceFlag=5;
ShowTime=0;
ChangPhoto = 0;
return;
}
{VoiceFlag=0;ShowTime=0;return;}
break;
}
case 2:
{
Show(pPictrue1,Dx,Dy,ZoomX,ZoomY,AngleX,AngleY,AngleZ);
if( (PlayMode!=2||TimeFlag) && cartoonFlag == 0 ) {TimeFlag=0;return;}
break;
}
case 3:
{
Show(pPictrue1,Dx,Dy,ZoomX,ZoomY,AngleX,AngleY,AngleZ);
if(PlayMode!=3||TempDate1!=scenes[2]/2) return;
break;
}
case 4:
{
Show(pPictrue1,Dx,Dy,ZoomX,ZoomY,AngleX,AngleY,AngleZ);
if(ProgramRecode!=ProgramNumber||PlayMode!=4) return;
break;
}
default: break;
}
}
}
//------------------------------------------------------------//
void init(void)
{
SCON=0x90;
PCON=0x00;
TMOD=0x11;/*T0 =B5=C4=B9=A4=D7=F7=C4=A3=CA=BD=CE=AA=C4=A3=CA=BD1*/
IP=0x10; /*=B4=AE=D0=D0=BF=DA=D6=D0=B6=CF=D3=C5=CF=C8*/
IE=0x96;
SendOrReceive=0;
//-------------------------------------------------------------------//
TH0=0x00;
TL0=0x00;
TR0=1;
//------------------------------------------------------------------//
OffOrOn=0;
Reset=0;
AllowReset=10;
}
//--------------------------------------------------------------------//
char code CircleArray[]={5,-7,7,7,-7,7,7,-7,-7,0,0};
void JumpCircle()
{
char i,j;
char temp=scenes[2]/6;
j=2*CircleArray[0];
for(i=1;i<=j;i=i+2)
{
if(temp!=scenes[2]/6) return;
Circle(CircleArray[i],CircleArray[i+1],5,150,5);
//--------------------------------//
if(PlayMode==0) {LaserOn(0);return;}
if(DMX_Flag==10) {LaserOn(0);return;}
}
}
void ZoomCircle1()
{
char i;
uchar temp=scenes[2]/6;
for(i=0;i<=2;i++)
{
if(temp!=scenes[2]/6) return;
Circle(0,0,i,150,20);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -