- Timestamp:
- Apr 18, 2019, 3:44:09 PM (6 years ago)
- Location:
- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
- Files:
-
- 4 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt
r12298 r12308 4 4 OrxoBloxWall.cc 5 5 OrxoBloxBall.cc 6 OrxoBloxBat.cc7 6 OrxoBloxBot.cc 8 7 OrxoBloxCenterpoint.cc -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
r12307 r12308 33 33 34 34 #include "OrxoBlox.h" 35 #include "Highscore.h" 35 36 36 37 #include "core/CoreIncludes.h" 37 38 #include "core/EventIncludes.h" 38 39 #include "core/command/Executor.h" 39 #include "core/config/ConfigValueIncludes.h" 40 41 42 #include "core/config/ConfigValueIncludes.h"//Remove?? 40 43 41 44 #include "gamestates/GSLevel.h" 42 #include "chat/ChatManager.h" 45 46 47 #include "chat/ChatManager.h"//Remove? 43 48 44 49 #include "OrxoBloxCenterpoint.h" 45 50 #include "OrxoBloxBall.h" 46 #include "OrxoBloxBat.h" 47 #include "OrxoBloxBot.h" 51 // #include "OrxoBloxBat.h"//Remove?? 52 #include "OrxoBloxBot.h"//Remove?? 48 53 #include "OrxoBloxStones.h" 49 54 #include "OrxoBloxWall.h" … … 52 57 namespace orxonox 53 58 { 54 // Events to allow to react to scoring of a player, in the level-file. 55 CreateEventName(OrxoBloxCenterpoint, right); 56 CreateEventName(OrxoBloxCenterpoint, left); 59 57 60 58 61 RegisterUnloadableClass(OrxoBlox); … … 148 151 149 152 150 151 152 153 // If one of the bats is missing, create it. Apply the template for the bats as specified in the centerpoint.154 for (WeakPtr<orxonox::OrxoBloxBat>& bat : this->bat_)155 {156 if (bat == nullptr)157 {158 bat = new OrxoBloxBat(this->center_->getContext());159 bat->addTemplate(this->center_->getBattemplate());160 }161 }162 163 164 153 // Create the first Wall. 165 154 this->createWall(); 166 orxout()<< "helloo"<< endl;167 155 168 156 } … … 257 245 } 258 246 259 // void OrxoBlox::createWall(void) //TODO: random rotation offset between 0 and 3 (times 90°)260 // {261 // // create new futureBrick_262 // this->futureWall_ = new TetrisBrick(this->center_->getContext());263 264 265 // // Apply the stone template to the stone.266 // this->futureBrick_->addTemplate(this->center_->getBrickTemplate());267 268 // // Attach the brick to the Centerpoint and set the position of the brick to be at the left side.269 // this->center_->attach(this->futureBrick_);270 // float xPos = (this->center_->getWidth()*1.6f + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();271 // float yPos = (this->center_->getHeight()-5.1f)*this->center_->getStoneSize();272 273 // this->futureBrick_->setPosition(xPos, yPos, 0.0f);274 // this->futureBrick_->setGame(this);275 // }276 247 277 248 /** -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
r12307 r12308 96 96 WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field. 97 97 WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball. 98 WeakPtr<OrxoBloxBat> bat_[0]; //!< The two bats.98 99 99 PlayerInfo* player_; 100 100 -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
r12305 r12308 39 39 #include "gametypes/Gametype.h" 40 40 41 #include "OrxoBloxBat.h"42 41 43 42 #include "sound/WorldSound.h" … … 61 60 this->speed_ = 0; 62 61 this->accelerationFactor_ = 1.0f; 63 this->bat_ = nullptr;64 62 this->bDeleteBats_ = false; 65 this->batID_ = new unsigned int[2];66 this->batID_[0] = OBJECTID_UNKNOWN;67 this->batID_[1] = OBJECTID_UNKNOWN;68 63 this->relMercyOffset_ = 0.05f; 69 64 … … 97 92 { 98 93 if (this->bDeleteBats_) 99 delete[] this->bat_;100 94 101 95 delete[] this->batID_; … … 123 117 registerVariable( this->speed_ ); 124 118 registerVariable( this->relMercyOffset_ ); 125 registerVariable( this->batID_[0] );126 registerVariable( this->batID_[1], VariableDirection::ToClient, new NetworkCallback<OrxoBloxBall>( this, &OrxoBloxBall::applyBats) );127 119 } 128 120 … … 217 209 } 218 210 219 /**220 @brief221 Set the bats for the ball.222 @param bats223 An array (of size 2) of weak pointers, to be set as the new bats.224 */225 void OrxoBloxBall::setBats(WeakPtr<OrxoBloxBat>* bats)226 {227 if (this->bDeleteBats_) // If there are already some bats, delete them.228 {229 delete[] this->bat_;230 this->bDeleteBats_ = false;231 }232 233 this->bat_ = bats;234 // Also store their object IDs, for synchronization.235 this->batID_[0] = this->bat_[0]->getObjectID();236 this->batID_[1] = this->bat_[1]->getObjectID();237 }238 239 /**240 @brief241 Get the bats over the network.242 */243 void OrxoBloxBall::applyBats()244 {245 // Make space for the bats, if they don't exist, yet.246 if (this->bat_ == nullptr)247 {248 this->bat_ = new WeakPtr<OrxoBloxBat>[2];249 this->bDeleteBats_ = true;250 }251 252 if (this->batID_[0] != OBJECTID_UNKNOWN)253 this->bat_[0] = orxonox_cast<OrxoBloxBat*>(Synchronisable::getSynchronisable(this->batID_[0]));254 if (this->batID_[1] != OBJECTID_UNKNOWN)255 this->bat_[1] = orxonox_cast<OrxoBloxBat*>(Synchronisable::getSynchronisable(this->batID_[1]));256 }257 211 258 212 void OrxoBloxBall::setDefScoreSound(const std::string &OrxoBloxSound) -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h
r12212 r12308 121 121 { return this->batlength_; } 122 122 123 void setBats(WeakPtr<OrxoBloxBat>* bats); //!< Set the bats for the ball.123 124 124 void applyBats(); //!< Get the bats over the network. 125 125 … … 141 141 float accelerationFactor_; //!< The acceleration factor of the ball. 142 142 float batlength_; //!< The length of the bats (in z-direction) as percentage of the height of the playing field. 143 WeakPtr<OrxoBloxBat>* bat_; //!< An array with the two bats.144 143 bool bDeleteBats_; //!< Bool, to keep track, of whether this->bat_ exists or not. 145 144 unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network. -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h
r12307 r12308 69 69 { 70 70 class OrxoBlox; 71 class OrxoBloxAI;72 71 class OrxoBloxBall; 73 class OrxoBloxBat;72 74 73 class OrxoBloxCenterpoint; 75 74 class OrxoBloxWall; -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
r12307 r12308 42 42 return orxobloxGametype; 43 43 } 44 else orxout()<<"There is no Gametype ! ask Anna"<< endl;44 else orxout()<<"There is no Gametype for OrxoBlox! ask Anna"<< endl; 45 45 return nullptr; 46 46 }
Note: See TracChangeset
for help on using the changeset viewer.