- Timestamp:
- 04/04/03 16:22:06 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1905 r1907 1 1 -*-*- END OF LINE -*-*- 2 3 2003/04/04: Thomas Bretz 4 5 * mtools/MagicReversi.cc: 6 - added support for Number of Players 7 - added instructions 8 - added support for Esc key 9 10 2 11 3 12 2003/04/04: Wolfgang Wittek -
trunk/MagicSoft/Mars/mbase/MAGIC.h
r1657 r1907 8 8 // 9 9 /////////////////////////////////////////////////////////////////////////////// 10 11 10 #ifndef ROOT_TROOT 12 11 #include <TROOT.h> 12 #endif 13 14 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,00) 15 #error Your root version is too old to compile Mars, use root>=3.02 13 16 #endif 14 17 -
trunk/MagicSoft/Mars/mtools/MagicDomino.h
r1440 r1907 96 96 void ChangeCamera(); //*MENU* 97 97 98 ClassDef(MagicDomino, 0) // Tool to visualize next neighbours98 ClassDef(MagicDomino, 0) // Magic Camera Games: Some kind of Domino 99 99 }; 100 100 -
trunk/MagicSoft/Mars/mtools/MagicReversi.cc
r1880 r1907 33 33 // MagicReversi reversi; 34 34 // 35 // Rules: 36 // ------ 37 // 38 // Use the mouse to put a stone at some place. If between your newly 39 // placed stone and the next stone (in a row) of your color are stones 40 // of other colors this stones are won by you. You can only place a 41 // stone if you win at least one stone from your 'enemy'. If you 42 // cannot do so, you are skipped. If nobody can make a move anymore 43 // the game is over. The player has won who has the most stones in 44 // his own color. 45 // The present player is indicated by <*> 46 // Use the Escape key to abort a game. 47 // If the game was aborted or has been stopped youcan access the 48 // options in the context menu. 49 // 35 50 //////////////////////////////////////////////////////////////////////////// 36 51 #include "MagicReversi.h" 37 52 38 53 #include <iostream.h> 54 55 #include <KeySymbols.h> 39 56 40 57 #include <TText.h> … … 168 185 : fGeomCam(NULL), fDone(NULL), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE) 169 186 { 170 SetNewCamera(new MGeomCam CT1);187 SetNewCamera(new MGeomCamMagic); 171 188 172 189 // … … 177 194 SetBit(kCanDelete); 178 195 gInterpreter->DeleteGlobal(this); 196 197 fNumUsers = 2; 179 198 180 199 Draw(); … … 317 336 void MagicReversi::Update() 318 337 { 319 for (int i=0; i<fNumUsers; i++) 338 int i; 339 for (i=0; i<fNumUsers; i++) 320 340 { 321 341 TString txt = "Pixels: "; … … 327 347 fUsrTxt[i]->SetText(-fRange*0.95, fRange-(i+1)*fRange*0.06, txt); 328 348 } 349 for (; i<6; i++) 350 fUsrTxt[i]->SetText(0, 0, ""); 351 } 352 353 void MagicReversi::TwoPlayer() 354 { 355 fNumUsers = 2; 356 Reset(); 357 } 358 359 void MagicReversi::ThreePlayer() 360 { 361 fNumUsers = 3; 362 Reset(); 363 } 364 365 void MagicReversi::FourPlayer() 366 { 367 fNumUsers = 4; 368 Reset(); 369 } 370 371 void MagicReversi::FivePlayer() 372 { 373 fNumUsers = 5; 374 Reset(); 375 } 376 377 void MagicReversi::SixPlayer() 378 { 379 fNumUsers = 6; 380 Reset(); 329 381 } 330 382 … … 352 404 } 353 405 354 fNumUsers = 2; // not more than 6!355 406 fNumUser = 0; 356 407 … … 387 438 388 439 TString txt = "Player #"; 389 txt += winner ;440 txt += winner+1; 390 441 txt += " wins ("; 391 442 txt += max; … … 523 574 return; 524 575 576 if (event==kKeyPress && py==kKey_Escape) 577 { 578 Done(); 579 fDrawingPad->Modified(); 580 fDrawingPad->Update(); 581 return; 582 } 583 525 584 UInt_t idx; 526 585 for (idx=0; idx<fNumPixels; idx++) … … 547 606 while (!CheckMoves()) 548 607 { 549 cout << "Sorry, no moves possible !"<< endl;608 cout << "Sorry, no moves possible for player #" << fNumUser << endl; 550 609 fNumUser++; 551 610 fNumUser%=fNumUsers; 552 611 553 612 if (fNumUser==start) 613 { 554 614 Done(); 615 break; 616 } 555 617 } 556 618 … … 559 621 560 622 fDrawingPad->Modified(); 561 562 /* 563 if (event==kKeyPress && py==0x1000) 564 { 565 Reset(); 566 return; 567 } 568 */ 569 /* 570 UInt_t idx; 571 for (idx=0; idx<fNumPixels; idx++) 572 if ((*fPixels)[idx]->DistancetoPrimitive(px, py)==0) 573 break; 574 575 if (idx==fNumPixels) 576 return; 577 578 MGeomPix &pix=(*fGeomCam)[idx]; 579 580 if (event==kButton1Double) 581 { 582 OpenHexagon(idx); 583 584 if (pix.TestBit(kHasBomb)) 585 Done("Argh... you hit the Bomb!!!", kRed); 586 } 587 588 if (event==kButton1Down && !pix.TestBit(kIsVisible)) 589 { 590 if (pix.TestBit(kHasFlag)) 591 Remove(GetFlag(idx)); 592 else 593 GetFlag(idx)->Draw(); 594 595 pix.InvertBit(kHasFlag); 596 } 597 598 UInt_t vis=fNumBombs; 599 UInt_t flg=fNumBombs; 600 for (UInt_t i=0; i<fNumPixels; i++) 601 { 602 if ((*fGeomCam)[i].TestBit(kIsVisible)) 603 vis++; 604 if ((*fGeomCam)[i].TestBit(kHasFlag)) 605 flg--; 606 } 607 608 Update(flg); 609 610 if (vis==fNumPixels && !fDone) 611 Done("Great! Congratulations, you did it!", kGreen); 612 613 fDrawingPad->Modified(); 614 */ 615 /* 616 switch (event) 617 { 618 case kNoEvent: cout << "No Event" << endl; break; 619 case kButton1Down: cout << "Button 1 down" << endl; break; 620 case kButton2Down: cout << "Button 2 down" << endl; break; 621 case kButton3Down: cout << "Button 3 down" << endl; break; 622 case kKeyDown: cout << "Key down" << endl; break; 623 case kKeyUp: cout << "Key up" << endl; break; 624 case kKeyPress: cout << "Key press" << endl; break; 625 case kButton1Locate: cout << "Button 1 locate" << endl; break; 626 case kButton2Locate: cout << "Button 2 locate" << endl; break; 627 case kButton3Locate: cout << "Button 3 locate" << endl; break; 628 } 629 */ 630 } 623 } -
trunk/MagicSoft/Mars/mtools/MagicReversi.h
r1880 r1907 87 87 void Reset(); //*MENU* 88 88 void ChangeCamera(); //*MENU* 89 void TwoPlayer(); //*MENU* 90 void ThreePlayer(); //*MENU* 91 void FourPlayer(); //*MENU* 92 void FivePlayer(); //*MENU* 93 void SixPlayer(); //*MENU* 89 94 90 ClassDef(MagicReversi, 0) // Magic Camera Games 95 ClassDef(MagicReversi, 0) // Magic Camera Games: Reversi 91 96 }; 92 97 -
trunk/MagicSoft/Mars/mtools/MagicSnake.h
r1440 r1907 96 96 void ChangeCamera(); //*MENU* 97 97 98 ClassDef(MagicSnake, 0) // Magic Camera Games 98 ClassDef(MagicSnake, 0) // Magic Camera Games: Snake 99 99 }; 100 100 -
trunk/MagicSoft/Mars/mtools/MineSweeper.h
r1440 r1907 73 73 void ChangeCamera(); //*MENU* 74 74 75 ClassDef(MineSweeper, 0) // Magic Camera Games 75 ClassDef(MineSweeper, 0) // Magic Camera Games: Mine Sweeper 76 76 }; 77 77
Note:
See TracChangeset
for help on using the changeset viewer.