Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 7, 2015, 2:32:47 PM (8 years ago)
Author:
meierman
Message:

Finished with comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hoverHS15/src/modules/hover/Hover.cc

    r10928 r10930  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Manuel Meier
    2424 *   Co-authors:
    25  *      ...
     25 *      Cyrill Muskelprotz
    2626 *
    2727 */
     
    2929/**
    3030    @file Hover.cc
    31     @brief Implementation of the Hover class.
     31    @brief Implementation of the Hover class. Sets up the whole Minigame
    3232*/
    3333
     
    5151{
    5252    bool firstTick = true;
     53
     54    //Levelcode represents the pitch: It's a 10x10 field.
     55    // 1 represents a Wall on the right side of this square
     56    // 2 represents a Wall on the top of this square
     57    // 3 represents 2 and 1 at the same time
     58    // Note: the levelcode is generated from the Maze-Generator functions at the beginning of the game
    5359    int levelcode[10][10] =
    5460        {
     
    122128            g_PtY=0;
    123129            GenerateMaze();
    124             MazeOut();
    125130            RenderMaze();
    126             LevelOut();
    127131            firstTick = false;
    128132
     
    135139            }
    136140
     141            //Generate inner Walls according to levelcode
    137142            for(int y=0; y<10; y++){
    138143                for(int x=0; x<10; x++){
     
    150155            }
    151156
    152 
     157            //Generate 5 flags randomly
    153158            for ( int i = 0; i < 5; i++ )
    154159                flagVector.push_back(new HoverFlag(origin_->getContext(), rand()%10, rand()%10));
    155160
    156161            Flags_ = flagVector.size();
    157            
    158             //new HoverFlag(origin_->getContext()); //Rechts in Y Richtung
    159             //new HoverWall(origin_->getContext(), 5, 6, 0); //Ueber in x richtung
    160             //new HoverWall(origin_->getContext(), 5, 5, 0); //Ueber in x richtung
    161         }
     162
     163        }//firsttick end
     164
     165        // Check if ship collided with one of the flags
    162166        for ( int i = 0; i < flagVector.size(); i++ ){
    163167            if(flagVector[i]->getCollided()){
     
    200204
    201205
    202     ////////////////////////////////////////////////////////////////////////////
    203 
     206    // Some definitions for the Maze-Generator
    204207
    205208    //                   0  1  2  3  4  5  6  7  8
     
    220223
    221224
    222     ////////////////////////////////////////////////////////////////////////////
    223 
     225    /**
     226    @brief
     227        Checks if Direction is valid (for Maze-Generator)
     228    */
    224229    bool Hover::IsDirValid( eDirection Dir )
    225230    {
     
    232237    }
    233238
     239    /**
     240    @brief
     241        Generates new Direction (for Maze-Generator)
     242    */
    234243    eDirection Hover::GetDirection()
    235244    {
     
    259268    }
    260269
     270    /**
     271    @brief
     272        Generates a Maze (for Maze-Generator)
     273    */
    261274    void Hover::GenerateMaze()
    262275    {
     
    265278        for ( eDirection Dir = GetDirection(); Dir != eDirection_Invalid; Dir = GetDirection() )
    266279        {
    267             // a progress indicator, kind of
    268            // if ( ++Cells % 1000 == 0 ) std::cout << ".";
    269 
    270280            g_Maze[ CellIdx() ] |= Dir;
    271281
     
    275285            g_Maze[ CellIdx() ] = Mask[ Dir ];
    276286        }
    277 
    278         std::cout << std::endl;
    279287    } 
    280288   
    281 
     289    /**
     290    @brief
     291        Print Maze (for Debugging only)
     292    */
    282293    void Hover::MazeOut(){
    283294        for ( int y = 0; y < NumCells; y++ )
     
    302313    }
    303314
     315    /**
     316    @brief
     317        Print Levelcode (for Debugging only)
     318    */
    304319    void Hover::LevelOut(){
    305320        for ( int y = 0; y < NumCells; y++ )
     
    307322            for ( int x = 0; x < NumCells; x++ )
    308323            {
    309                 /*orxout()<<"[";
     324                orxout()<<"[";
    310325                if ( levelcode[x][y] < 2) orxout()<<"U";
    311326                else orxout()<<" ";
     
    315330                orxout()<<" ";
    316331                orxout()<<" ";
    317                 orxout()<<"]";*/
    318 
    319                 orxout()<<levelcode[x][y];
     332                orxout()<<"]";
    320333            }
    321334            orxout()<<endl;
    322335        }
    323 
    324 
    325 
    326     }
    327 
     336    }
     337
     338    /**
     339    @brief
     340        Generate Levelcode from Maze
     341    */
    328342    void Hover::RenderMaze()
    329343    {
     
    336350                if ( !( v & eDirection_Up    ) && y >0) levelcode[y][x] |= 2;
    337351                if ( !( v & eDirection_Right ) && x <9) levelcode[y][x] |= 1;
    338                 //if ( !( v & eDirection_Down  ) && y>0) levelcode[x][y-1] += 2;
    339                 //if ( !( v & eDirection_Left  ) && x>0) levelcode[x-1][y] += 1;
    340352            }
    341353        }
Note: See TracChangeset for help on using the changeset viewer.