void StaffmodeWnd::DrawMaze(ColorBuf *destCBuf) { D3DXVECTOR3 inVec[4]; float rad,leng,ratio; int i,j,bSetDiff; dest.buf = (RGB24 *)destCBuf->pBuf; dest.sx = destCBuf->width; dest.sy = destCBuf->height; for(j=0;j<4;j++){ int ddeg = (deg +90*j) % 360; if(ddeg>110 && ddeg<250)continue; bSetDiff = 0; for(i=0;i<4;i++){ rad = (float)ddeg-45+90*(i&1); leng = 7.07107f; inVec[i].x = leng *sinf(DEGtoRAD(rad)); inVec[i].y = 5.0f -(i/2)*10.0f; inVec[i].z = leng *cosf(DEGtoRAD(rad)); } for(i=0;i<4;i++){ if(inVec[i].z >= 0)continue; if(i==1 || i==3){ inVec[i].x = (inVec[i].x -inVec[i-1].x)/(inVec[i].z -inVec[i-1].z) *(-inVec[i-1].z) + inVec[i-1].x; inVec[i].z = 0; leng = lineLength(inVec[i-1].x,inVec[i-1].z,inVec[i].x,inVec[i].z); bSetDiff = 1; }else{ inVec[i].x = (inVec[i].x -inVec[i+1].x)/(inVec[i].z -inVec[i+1].z) *(-inVec[i+1].z) + inVec[i+1].x; inVec[i].z = 0; leng = lineLength(inVec[i+1].x,inVec[i+1].z,inVec[i].x,inVec[i].z); bSetDiff = 2; } ratio = (7.07107f*1.142f) /leng ; } for(i=0;i<4;i++){ GetMazeVec(&inVec[i],0); } if(bSetDiff==1)for(i=1;i<4;i+=2){ leng = lineLength(inVec[i-1].x,inVec[i-1].y,inVec[i].x,inVec[i].y); leng = leng *ratio; rad = atan2f(inVec[i].x-inVec[i-1].x,-(inVec[i].y-inVec[i-1].y)); float rtd = RADtoDEG(rad); inVec[i].x = inVec[i-1].x +leng *sinf(rad); inVec[i].y = inVec[i-1].y -leng *cosf(rad); } if(bSetDiff==2)for(i=0;i<4;i+=2){ leng = lineLength(inVec[i+1].x,inVec[i+1].y,inVec[i].x,inVec[i].y); leng = leng *ratio; rad = atan2f(inVec[i].x-inVec[i+1].x,-(inVec[i].y-inVec[i+1].y)); float rtd = RADtoDEG(rad); inVec[i].x = inVec[i+1].x +leng *sinf(rad); inVec[i].y = inVec[i+1].y -leng *cosf(rad); } int light; if(ddeg < 180){ light = 128 -100*ddeg/180; }else{ light = 128 -100*(360-ddeg)/180; } if(3!=bTurn){ DRW_DrawPOLY4_FB_Simple(&dest, &src[j], (int)inVec[0].x, (int)inVec[0].y, (int)inVec[1].x, (int)inVec[1].y, (int)inVec[2].x, (int)inVec[2].y, (int)inVec[3].x, (int)inVec[3].y, light,light,light); }else{ D3DXVECTOR2 pt[4]; if(ddeg == 0){ pt[0].x = inVec[0].x -177*moveStep/18; pt[1].x = inVec[1].x +177*moveStep/18; pt[2].x = inVec[2].x -177*moveStep/18; pt[3].x = inVec[3].x +177*moveStep/18; }else if(ddeg == 90){ for(i=0;i<4;i++){ pt[i].x = inVec[i].x +177*moveStep/18; } }else if(ddeg == 270){ for(i=0;i<4;i++){ pt[i].x = inVec[i].x -177*moveStep/18; } } for(i=0;i<4;i++){ if(i/2==0){ pt[i].y = inVec[i].y -133*moveStep/18; }else{ pt[i].y = inVec[i].y +133*moveStep/18; } } DRW_DrawPOLY4_FB_Simple(&dest, &src[j], (int)pt[0].x, (int)pt[0].y, (int)pt[1].x, (int)pt[1].y, (int)pt[2].x, (int)pt[2].y, (int)pt[3].x, (int)pt[3].y, light,light,light); } } } //StaffmodeWnd::DrawMaze
char* ASC_RADtoSTR_HMS (double Valeur) { Valeur=RADtoDEG(Valeur); return ASC_DEGtoSTR_HMS(Valeur); }
char* DEC_RADtoSTR_DMS (double Valeur) { Valeur=RADtoDEG(Valeur); return DEC_DEGtoSTR_DMS(Valeur); }