Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 17, 2019, 1:32:44 PM (5 years ago)
Author:
pomselj
Message:

Jesus safed our souls and stopped the crashing. Hallowed be his name and hallowed be his followers sevy and aryo, first of their names, saviors of the andals the raynars and the first nerds. Fourier is love btw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc

    r12395 r12396  
    1 /*
    2  *   ORXONOX - the hottest 3D action shooter ever to exist
    3  *                    > www.orxonox.net <
    4  *
    5  *
    6  *   License notice:
    7  *
    8  *   This program is free software; you can redistribute it and/or
    9  *   modify it under the terms of the GNU General Public License
    10  *   as published by the Free Software Foundation; either version 2
    11  *   of the License, or (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    21  *
    22  *   Author:
    23  *      Fabian 'x3n' Landau
    24  *   Co-authors:
    25  *      ...
    26  *
    27  */
    28 
    29 /**
    30     @file OrxoBlox.cc
    31     @brief Implementation of the OrxoBlox class.
    32 */
    33 
    341#include "OrxoBlox.h"
    352#include "Highscore.h"
     
    10067    void OrxoBlox::cleanup()
    10168    {   
    102         //if (this->ball_ != nullptr) // Destroy the ball, if present.
    103         //{
    104         //    this->ball_->destroy();
    105         //    this->ball_ = nullptr;
    106         //}
    107 
    108         /*if (this->futureWall_ != nullptr)
    109             {
    110             this->futureWall_->destroy();
    111             this->futureWall_ = nullptr;
    112             }
    113         */
    114 
     69
     70        std::vector<OrxoBloxWall*> vyserion_targets;
     71        std::vector<OrxoBloxStones*> casterly_rocks;
     72
     73        for (OrxoBloxWall* wall : ObjectList<OrxoBloxWall>()) {
     74            if(wall != nullptr) {
     75                vyserion_targets.push_back(wall);
     76            }
     77        }
    11578        for (OrxoBloxStones* stone : ObjectList<OrxoBloxStones>()) {
    116             if(stone != nullptr)
    117             stone->destroy();
    118         }
    119 
    120 
    121         for (OrxoBloxWall* wall : this->activeWalls_) {
    122             if (wall != nullptr)
    123                 wall->destroy();
    124         }
    125         this->activeWalls_.clear();
    126 
    127         this->stones_.clear();
    128         if(this->playership != nullptr) {
    129             this->playership->destroy();
    130         }
    131         if(this->center_ != nullptr) {
    132             this->center_->destroy();
    133         }
    134        
     79            if(stone != nullptr) {
     80                casterly_rocks.push_back(stone);
     81            }
     82        }
     83        for(unsigned int i = 0; i < vyserion_targets.size(); i++) {
     84            vyserion_targets.at(i)->destroy();
     85        }
     86        for(unsigned int i = 0; i < casterly_rocks.size(); i++) {
     87            casterly_rocks.at(i)->destroy();
     88        }
    13589
    13690    }
     
    146100        if (this->center_ != nullptr) // There needs to be a OrxoBloxCenterpoint, i.e. the area the game takes place.
    147101        {
    148 
    149102            level_= 1;
    150 
    151103        }
    152104        else // If no centerpoint was specified, an error is thrown and the level is exited.
     
    156108            return;
    157109        }
    158 
    159         // Start the timer. After it has expired the ball is started.
    160110        this->starttimer_.startTimer();
    161111
    162         // Set variable to temporarily force the player to spawn.
    163         // Set variable to temporarily force the player to spawn.
    164         //bool temp = this->bForceSpawn_;
    165112        this->bForceSpawn_ = false;
    166 
    167         // Call start for the parent class.
    168113        Deathmatch::start();
    169 
    170         // Reset the variable.
    171         //this->bForceSpawn_ = temp;
    172 
    173114    }
    174115
     
    199140    }
    200141   
    201     // void OrxoBlox::spawnPlayer(PlayerInfo* player)
    202     // {
    203     //     assert(player);
    204 
    205     //     if(this->player_ == nullptr)
    206     //     {
    207     //         this->player_ = player;
    208     //         this->players_[player].state_ = PlayerState::Alive;
    209     //     }
    210 
    211     // }
    212142
    213143    void OrxoBlox::LevelUp(){
     
    219149
    220150        this->createWall();
    221         this->activeWalls_.push_back(this->futureWall_);
    222         for (int i = 0; i < this->futureWall_->getNumberOfStones(); i++) {
    223             this->stones_.push_back(this->futureWall_->getStone(i));
    224         }
    225 
    226         for(OrxoBloxWall* wall : this->activeWalls_) {
    227             if(wall == nullptr) {
    228                 continue;
    229             }
    230             if(wall->isEmpty()) {
    231                 wall->destroy();
    232             }
    233             int NumberOfStones = 0;
    234             for(int i = 0; i < 10; i++) {
    235                 if(wall->getStone(i) == nullptr) {
    236                     continue;
    237                 }
    238                 else {
    239                     NumberOfStones++;
    240                 }
    241 
    242             }
    243         }
    244         //new location of ship
    245         //new amount of balls
    246         //create balls
    247         //insert new wall
     151
    248152        for(OrxoBloxStones* stone : ObjectList<OrxoBloxStones>()){
    249153            if (stone->isA(Class(OrxoBloxStones))) {
     
    257161                    orxout() << "calling end() function" << endl;
    258162                    this->end();
     163                    return;
    259164                }
    260165            }
    261166            else {
    262                 stone = nullptr;
    263             }
    264         }
    265 
    266        
     167                orxout() << "WTF IS THIS SHIT?!?!?!" << endl;
     168            }
     169        }
    267170    }
    268171
     
    280183
    281184
    282     /**
    283     @brief
    284         Starts the ball with some default speed.
    285     */
    286     //void OrxoBlox::startBall()
    287     //{
    288     //    if (this->ball_ != nullptr && this->center_ != nullptr)
    289     //        this->ball_->setSpeed(this->center_->getBallSpeed());
    290     //}
    291      
    292     /*OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) {
    293         //orxout() << "Checking for Collision" << endl;
    294         Vector3 BallPosition = Ball->getPosition();
    295         for(OrxoBloxStones* someStone : this->stones_)
    296         {
    297             if(someStone == nullptr)
    298             {
    299                 continue;
    300             }
    301             //orxout() << "Checking a stone" << endl;
    302             const Vector3& StonePosition = someStone->getPosition(); //!< Saves the position of the currentStone
    303             int size = someStone->getSize()/2;
    304             if((BallPosition.x - Ball->getRadius() >= StonePosition.x - size && BallPosition.x + Ball->getRadius() <= StonePosition.x + size) &&
    305                 (BallPosition.z - Ball->getRadius() >= StonePosition.z - size && BallPosition.z + Ball->getRadius() <= StonePosition.z + size)) {
    306                 //orxout() << "FOUND ONE" << endl;
    307                 return someStone;
    308             }
    309         }
    310         orxout() << "Found nothing...." << endl;
    311         return nullptr;
    312     }
    313     */
    314 
    315185    void OrxoBlox::playerPreSpawn(PlayerInfo* player)
    316186    {
     
    322192        SUPER(OrxoBlox, tick, dt);
    323193    }
    324 /*
    325     bool OrxoBlox::Intersect(int XpositionBall, int XPositionBlock, int YPositionBall, int YPositionBlock, int radiusBall, int sizeBlock) {
    326         distanceX = XpositionBall - XPositionBlock;
    327         distanceY = YPositionBall - YPositionBlock;
    328         if (distanceX < 0) {
    329             distanceX = -distanceX;
    330         }
    331         if (distanceY < 0) {
    332             distanceY = -distanceY;
    333         }
    334         if((distanceX <= radiusBall + sizeBlock) || (distanceY <= radiusBall + sizeBlock)) {
    335             return true;
    336         }
    337         else {
    338             top = YPositionBall + radiusBall;
    339             right = XpositionBall + radiusBall;
    340             bottom = YPositionBall - radiusBall;
    341             left = XpositionBall - radiusBall;
    342 
    343             if((top >= YPositionBlock - size) && (top <= YPositionBlock + size) && (left <= XPositionBlock + size) && (left >= XPositionBlock - size))
    344         }
    345     }
    346   */ 
     194 
    347195    void OrxoBlox::count() {
    348196        if(++(this->counter) >= this->max_counter) {
Note: See TracChangeset for help on using the changeset viewer.