Changeset 10930 for code/branches/hoverHS15/src/modules/hover/Hover.cc
- Timestamp:
- Dec 7, 2015, 2:32:47 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hoverHS15/src/modules/hover/Hover.cc
r10928 r10930 21 21 * 22 22 * Author: 23 * Florian Zinggeler23 * Manuel Meier 24 24 * Co-authors: 25 * ...25 * Cyrill Muskelprotz 26 26 * 27 27 */ … … 29 29 /** 30 30 @file Hover.cc 31 @brief Implementation of the Hover class. 31 @brief Implementation of the Hover class. Sets up the whole Minigame 32 32 */ 33 33 … … 51 51 { 52 52 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 53 59 int levelcode[10][10] = 54 60 { … … 122 128 g_PtY=0; 123 129 GenerateMaze(); 124 MazeOut();125 130 RenderMaze(); 126 LevelOut();127 131 firstTick = false; 128 132 … … 135 139 } 136 140 141 //Generate inner Walls according to levelcode 137 142 for(int y=0; y<10; y++){ 138 143 for(int x=0; x<10; x++){ … … 150 155 } 151 156 152 157 //Generate 5 flags randomly 153 158 for ( int i = 0; i < 5; i++ ) 154 159 flagVector.push_back(new HoverFlag(origin_->getContext(), rand()%10, rand()%10)); 155 160 156 161 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 162 166 for ( int i = 0; i < flagVector.size(); i++ ){ 163 167 if(flagVector[i]->getCollided()){ … … 200 204 201 205 202 //////////////////////////////////////////////////////////////////////////// 203 206 // Some definitions for the Maze-Generator 204 207 205 208 // 0 1 2 3 4 5 6 7 8 … … 220 223 221 224 222 //////////////////////////////////////////////////////////////////////////// 223 225 /** 226 @brief 227 Checks if Direction is valid (for Maze-Generator) 228 */ 224 229 bool Hover::IsDirValid( eDirection Dir ) 225 230 { … … 232 237 } 233 238 239 /** 240 @brief 241 Generates new Direction (for Maze-Generator) 242 */ 234 243 eDirection Hover::GetDirection() 235 244 { … … 259 268 } 260 269 270 /** 271 @brief 272 Generates a Maze (for Maze-Generator) 273 */ 261 274 void Hover::GenerateMaze() 262 275 { … … 265 278 for ( eDirection Dir = GetDirection(); Dir != eDirection_Invalid; Dir = GetDirection() ) 266 279 { 267 // a progress indicator, kind of268 // if ( ++Cells % 1000 == 0 ) std::cout << ".";269 270 280 g_Maze[ CellIdx() ] |= Dir; 271 281 … … 275 285 g_Maze[ CellIdx() ] = Mask[ Dir ]; 276 286 } 277 278 std::cout << std::endl;279 287 } 280 288 281 289 /** 290 @brief 291 Print Maze (for Debugging only) 292 */ 282 293 void Hover::MazeOut(){ 283 294 for ( int y = 0; y < NumCells; y++ ) … … 302 313 } 303 314 315 /** 316 @brief 317 Print Levelcode (for Debugging only) 318 */ 304 319 void Hover::LevelOut(){ 305 320 for ( int y = 0; y < NumCells; y++ ) … … 307 322 for ( int x = 0; x < NumCells; x++ ) 308 323 { 309 /*orxout()<<"[";324 orxout()<<"["; 310 325 if ( levelcode[x][y] < 2) orxout()<<"U"; 311 326 else orxout()<<" "; … … 315 330 orxout()<<" "; 316 331 orxout()<<" "; 317 orxout()<<"]";*/ 318 319 orxout()<<levelcode[x][y]; 332 orxout()<<"]"; 320 333 } 321 334 orxout()<<endl; 322 335 } 323 324 325 326 } 327 336 } 337 338 /** 339 @brief 340 Generate Levelcode from Maze 341 */ 328 342 void Hover::RenderMaze() 329 343 { … … 336 350 if ( !( v & eDirection_Up ) && y >0) levelcode[y][x] |= 2; 337 351 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;340 352 } 341 353 }
Note: See TracChangeset
for help on using the changeset viewer.