Changeset 1907 for trunk


Ignore:
Timestamp:
04/04/03 16:22:06 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1905 r1907  
    11                                                 -*-*- 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
    211
    312 2003/04/04: Wolfgang Wittek
  • trunk/MagicSoft/Mars/mbase/MAGIC.h

    r1657 r1907  
    88//
    99///////////////////////////////////////////////////////////////////////////////
    10 
    1110#ifndef ROOT_TROOT
    1211#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
    1316#endif
    1417
  • trunk/MagicSoft/Mars/mtools/MagicDomino.h

    r1440 r1907  
    9696    void ChangeCamera(); //*MENU*
    9797
    98     ClassDef(MagicDomino, 0) // Tool to visualize next neighbours
     98    ClassDef(MagicDomino, 0) // Magic Camera Games: Some kind of Domino
    9999};
    100100
  • trunk/MagicSoft/Mars/mtools/MagicReversi.cc

    r1880 r1907  
    3333//   MagicReversi reversi;
    3434//
     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//
    3550////////////////////////////////////////////////////////////////////////////
    3651#include "MagicReversi.h"
    3752
    3853#include <iostream.h>
     54
     55#include <KeySymbols.h>
    3956
    4057#include <TText.h>
     
    168185    : fGeomCam(NULL), fDone(NULL), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)
    169186{
    170     SetNewCamera(new MGeomCamCT1);
     187    SetNewCamera(new MGeomCamMagic);
    171188
    172189    //
     
    177194    SetBit(kCanDelete);
    178195    gInterpreter->DeleteGlobal(this);
     196
     197    fNumUsers = 2;
    179198
    180199    Draw();
     
    317336void MagicReversi::Update()
    318337{
    319     for (int i=0; i<fNumUsers; i++)
     338    int i;
     339    for (i=0; i<fNumUsers; i++)
    320340    {
    321341        TString txt = "Pixels: ";
     
    327347        fUsrTxt[i]->SetText(-fRange*0.95, fRange-(i+1)*fRange*0.06, txt);
    328348    }
     349    for (; i<6; i++)
     350        fUsrTxt[i]->SetText(0, 0, "");
     351}
     352
     353void MagicReversi::TwoPlayer()
     354{
     355    fNumUsers = 2;
     356    Reset();
     357}
     358
     359void MagicReversi::ThreePlayer()
     360{
     361    fNumUsers = 3;
     362    Reset();
     363}
     364
     365void MagicReversi::FourPlayer()
     366{
     367    fNumUsers = 4;
     368    Reset();
     369}
     370
     371void MagicReversi::FivePlayer()
     372{
     373    fNumUsers = 5;
     374    Reset();
     375}
     376
     377void MagicReversi::SixPlayer()
     378{
     379    fNumUsers = 6;
     380    Reset();
    329381}
    330382
     
    352404    }
    353405
    354     fNumUsers = 2; // not more than 6!
    355406    fNumUser  = 0;
    356407
     
    387438
    388439    TString txt = "Player #";
    389     txt += winner;
     440    txt += winner+1;
    390441    txt += " wins (";
    391442    txt += max;
     
    523574        return;
    524575
     576    if (event==kKeyPress && py==kKey_Escape)
     577    {
     578        Done();
     579        fDrawingPad->Modified();
     580        fDrawingPad->Update();
     581        return;
     582    }
     583
    525584    UInt_t idx;
    526585    for (idx=0; idx<fNumPixels; idx++)
     
    547606        while (!CheckMoves())
    548607        {
    549             cout << "Sorry, no moves possible!" << endl;
     608            cout << "Sorry, no moves possible for player #" << fNumUser << endl;
    550609            fNumUser++;
    551610            fNumUser%=fNumUsers;
    552611
    553612            if (fNumUser==start)
     613            {
    554614                Done();
     615                break;
     616            }
    555617        }
    556618
     
    559621
    560622    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  
    8787    void Reset();        //*MENU*
    8888    void ChangeCamera(); //*MENU*
     89    void TwoPlayer(); //*MENU*
     90    void ThreePlayer(); //*MENU*
     91    void FourPlayer(); //*MENU*
     92    void FivePlayer(); //*MENU*
     93    void SixPlayer(); //*MENU*
    8994
    90     ClassDef(MagicReversi, 0) // Magic Camera Games
     95    ClassDef(MagicReversi, 0) // Magic Camera Games: Reversi
    9196};
    9297
  • trunk/MagicSoft/Mars/mtools/MagicSnake.h

    r1440 r1907  
    9696    void ChangeCamera(); //*MENU*
    9797
    98     ClassDef(MagicSnake, 0) // Magic Camera Games
     98    ClassDef(MagicSnake, 0) // Magic Camera Games: Snake
    9999};
    100100
  • trunk/MagicSoft/Mars/mtools/MineSweeper.h

    r1440 r1907  
    7373    void ChangeCamera(); //*MENU*
    7474
    75     ClassDef(MineSweeper, 0) // Magic Camera Games
     75    ClassDef(MineSweeper, 0) // Magic Camera Games: Mine Sweeper
    7676};
    7777
Note: See TracChangeset for help on using the changeset viewer.