:DCS "99999999333333339999999937777773999999993775177399999999375511739999999937111173999999993771577399999999377777739999999933333333FFFFFFFF99922229222F222F92222222FFFFFFFF99FBB333F222F2229FD5BDD3FFFFFFFF99FDDDF922F222F299933339FFFFFFFF9994D4392F222F2299933399 // Check requirements. If 80>det([[20:Then Disp "Get Doors CSE to run this:","http://dcs.cemetech.net Return End "rowSwap(BLOCKLVL->Str3 SetHalfResolution( SetSpeed15MHz( Lbl A // Clear the screen For(A,1,2 SetupColorMode(4,29,0 "Loading\... DrawString(0,1,0,94,1 End // Read the header line Str3->Str0 1:ReadLine( If Str9!="BLOCKDUDELEVELS":Then "Couldn't load levels,^reverting to base\... DrawString(0,9,0,94,1 "rowSwap(BLOCKLVL->Str3 End // Load images "BLOCKSPR LoadTilePic(0 // Create temp file "thetaTMPBLK->Str2 Str2->Str0 DeleteVar( CreateVar( // Get the home screen map Str3->Str0 3:ReadLine( Str2->Str0 1:InsertLine( prgmthetaTMPBLK For(A,1,2 SetupColorMode(4,29,0 FillRectangle(0,8,160,96,62 DrawMapA(0,0,20,1,0,1,19,12,0 DrawLine(0,104,160,104,0,0 DrawSpriteA(8I,8J+8,1,1,0,0,62,0,0,6 "Loading\... DrawString(0,1,0,94,1 End Str3->Str0 // Get number of levels 0:ReadLine( theta-3->Z // Get passwords 2:ReadLine( expr(Str9->L1 0->L 1->M 0->R Repeat L or K=45 If M:Then For(A,1,2 SetupColorMode(4,29,0 "Merthsoft Creations DrawString(4,1,0,0,0 FillRectangle(0,8,160,96,62 DrawMapA(0,0,20,1,0,1,19,12,0 DrawLine(0,104,160,104,0,0 "Play Load Help Exit DrawString(4,108,0,0,0 DrawSpriteA(8I,8J+8,1,1,0,0,62,0,0,6 If A=1 UpdateLCD( End 0->M End InvertFilledRectangle(3+40R,107,34,10,1 InvertFilledRectangle(3+40R,107,34,10,1 Repeat K getKey->K End If K=26 or K=24:Then InvertFilledRectangle(3+40R,107,34,10,1 InvertFilledRectangle(3+40R,107,34,10,1 End R+(K=26 and R!=3)-(K=24 and R!=0->R If K=105:21->K If K=21:Then If not(R:Then For(A,1,2 FillRectangle(39,47,82,17,29,0 DrawLine(38,46,121,46,0,0 DrawLine(38,64,121,64,0,0 DrawLine(38,46,38,64,0,0 DrawLine(121,46,121,64,0,0 If A=1:UpdateLCD( End "1.New Game^2.Password DrawString(40,48,0,94,1 Repeat K=92 or K=93 or K=45 getKey->K If K=21 or K=105:92->K End If K=45:Then 0->K 1->M End If K=92:1->L If K=93:Then For(A,1,2 FillRectangle(39,47,82,17,29,0 "Password:^--- DrawString(40,48,0,94,1 End 100->G 0->L 0->W Repeat G<1 Repeat F>=0 and F<=9 Repeat Ans:getKey:End Ans(102!=Ans)-13int(Ans/13(2>abs(5-abs(5-abs(Ans-83->F End L+GAns->L For(A,1,2 FillRectangle(40+8W,56,8,8,29,0 DrawStringValueA(40+8W,56,0,F,0 If A=1:UpdateLCD( End W+1->W G/10->G End For(A,1,Z If L=L1(A:Then A->L For(W,1,2 FillRectangle(39,47,82,17,29,0 "Level:^Loading\... DrawString(40,48,0,94,0 DrawStringValueA(88,48,0,L,0 If W=1:UpdateLCD( End Z->A 0->W End End If W:Then FillRectangle(39,47,82,17,29,0 "Unknown^Password DrawString(40,48,0,94,1 rand(50 1->M 0->L End End End If R=1:Then SetFullResolution(1 ClrHome Disp "Enter appvar name Input "AppVar: ",Str3 "rowSwap("+Str3->Str3 ~1->L SetHalfResolution( End If R=2:Then SetupColorMode(4,29,0 " Block Dude^A puzzle game in^which you move^blocks to navigate^to the end of the^level. Use arrow^keys to move, and^2nd to lift boxes.^TRACE\ and GRAPH^switch direction.^Get to the door to^win!^^(Press any key) DrawString(0,1,0,94,1 Repeat getKey:End 1->M End If R=3:45->K End End If K=45:~2->L // Level, reload flag If L=~1:Goto A 1->R While K!=45 and L<=Z If R=1:Then FillRectangle(39,47,82,17,29,0 DrawLine(38,46,121,46,0,0 DrawLine(38,64,121,64,0,0 DrawLine(38,46,38,64,0,0 DrawLine(121,46,121,64,0,0 "Level:^Loading\... DrawString(40,48,0,94,0 DrawStringValueA(88,48,0,L,0 FillRectangle(0,0,160,8,29 "Loading\... DrawString(0,1,0,0,1 // Direction, moves ~1->D:0->M // Carrying 0->C // Reset flag 0->R Str2->Str0 DeleteVar( CreateVar( // Don't show up in DCS "Ans->Str9 1:InsertLine( Str3->Str0 L+3:ReadLine( Str2->Str0 2:InsertLine( prgmthetaTMPBLK H->P min({19,W-1->Q 13-min({12,H->H For(A,1,2 SetupColorMode(4,29,0 "Level: DrawString(0,1,0,0,0 DrawStringValueA(48,1,0,L "Pass: DrawString(96,1,0,0,0 DrawStringValueA(136,1,0,L1(L FillRectangle(0,8,160,96,62 DrawMapA(U,V,W,1,0,H,Q,12,0 DrawLine(0,104,160,104,0,0 "Moves: DrawString(0,108,0,0,0 If A=1:UpdateLCD( End I->F J->G 0->X 0->T 0->theta End For(A,1,2 // Clear dynamic parts If T:Then // Redraw the whole screen? FillRectangle(0,8,160,96,62,0 DrawMapA(U,V,W,1,0,H,Q,12,0 Else // Just clear the player's old location If not(theta:Then FillRectangle(8F-8U,8G+8H-8V,8,8,62,0 Else DrawSpriteA(8F,8J+8H,1,1,~8U,~8V,62,0,0,2 End End FillRectangle(48,108,40,8,29,0 // Draw values DrawSpriteA(8I,8J+8H,1,1,~8U,~8V,62,0,not(D+1),7,6 DrawStringValueA(48,108,0,M,0 If C:Then If not(T:FillRectangle(8F-8U,8G+8H-8-8V,8,8,62,0 DrawSpriteA(8I,8J+8H-8,1,1,~8U,~8V,62,0,0,2 End If A=1:UpdateLCD( End 0->T 0->theta If X=3 Then L+1->L 1->R End Repeat R or K getKey->K End If K=45:Then // Restart? FillRectangle(39,47,82,17,29,0 DrawLine(38,46,121,46,0,0 DrawLine(38,64,121,64,0,0 DrawLine(38,46,38,64,0,0 DrawLine(121,46,121,64,0,0 "1.Restart^2.Quit DrawString(40,48,0,94,1 Repeat K=92 or K=93 or K=45 getKey->K End If K=45:0->K If K=92:1->R If K=93:45->K 1->T End // Backup location I->F:J->G:C->E:D->B // Left and right If K=26 or K=24 or K=14 or K=15:Then I+(K=26)-(K=24->I (K=26 or K=15)-(K=24 or K=14->D DrawMap_GetTileA(8I,8J,W,1,~8U,~8V->X If X and X!=3 F->I // If we're carrying a block and run it into a block, // make sure it falls down If C and DrawMap_GetTileA(8I,8J-8,W,1,~8U,~8V Then 0->C DrawMap_SetTile(F,J,W,1,2,0,0 FillRectangle(8F-8U,8J+8H-8V-8,8,8,62,1 FillRectangle(8F-8U,8J+8H-8V-8,8,8,62,0 1->theta End End // Up If K=25:Then // First check that there's something right in front of you I+D->I J-1->J DrawMap_GetTileA(8I,8J,W,1,~8U,~8V->X If (X!=0 and X!=3) or not(DrawMap_GetTileA(8I,8J+8,W,1,~8U,~8V Then F->I G->J End End // Fall down? DrawMap_GetTileA(8I,8J+8,W,1,~8U,~8V While Ans=0 or Ans=3 J+1->J // Adjust view window If J-V>7 and V+12T:V+1->V End DrawMap_GetTileA(8I,8J+8,W,1,~8U,~8V End DrawMap_GetTileA(8I,8J,W,1,~8U,~8V->X // 2nd (pickup) // Note: This section has lots of repeated code, that's because // of how xLIB handles the screen buffer. I could put it in a for // loop, but the "End" commands were getting ridiculous. If K=21 or K=34:Then // Carrying? If C:Then If not(DrawMap_GetTileA(8I+8D,8J-8,W,1,~8U,~8V Then 0->C // Drop blocks J-1->N While not(DrawMap_GetTileA(8I+8D,8N+8,W,1,~8U,~8V N+1->N End DrawMap_SetTile(I+D,N,W,1,2,0,0 If 8J+8H-8-8V<104 FillRectangle(8I-8U,8J+8H-8-8V,8,8,62 DrawSpriteA(8I+8D,8N+8H,1,1,~8U,~8V,62,1,0,2 If 8J+8H-8-8V<104 FillRectangle(8I-8U,8J+8H-8-8V,8,8,62 DrawSpriteA(8I+8D,8N+8H,1,1,~8U,~8V,62,0,0,2 End Else // Not carrying If DrawMap_GetTileA(8I+8D,8J,W,1,~8U,~8V)=2 and not(DrawMap_GetTileA(8I+8D,8J-8,W,1,~8U,~8V Then 1->C DrawMap_SetTile(I+D,J,W,1,0,0,0 DrawSpriteA(8I,8J+8H-8,1,1,~8U,~8V,62,0,0,2 FillRectangle(8I+8D-8U,8J+8H-8V,8,8,62,1 FillRectangle(8I+8D-8U,8J+8H-8V,8,8,62,0 End End End // Movement was done? If I!=F or J!=G or C!=E or D!=B M+1->M // Adjust view window If I-U<4 and U>0:Then 1->T:U-1->U End If I-U>15 and U<(W-20:Then 1->T:U+1->U End If J-V<6 and V>0:Then 1->T:V-1->V End // The other V direction is handled when falling down End // Win?! If L>Z:Then FillRectangle(4,39,150,34,29,0 DrawLine(4,38,153,38,0,0 DrawLine(4,73,153,73,0,0 DrawLine(3,39,3,72,0,0 DrawLine(154,39,154,72,0,0 "You win! DrawString(44,40,0,94,0 "Now go make some DrawString(12,48,0,94,0 "levels of your own! DrawString(4,56,0,94,0 "(Press any key) DrawString(16,64,0,94,1 Repeat getKey:End End If L!=~2 Goto A DelVar L1 Str2->Str0 DeleteVar( DelVar Str1DelVar Str2DelVar Str3DelVar Str7DelVar Str9DelVar Str0 SetFullResolution(1 ClrHome