Changeset 10260 for code/trunk
- Timestamp:
- Feb 6, 2015, 11:03:00 PM (10 years ago)
- Location:
- code/trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pickupsFS14 merged: 10184
- Property svn:mergeinfo changed
-
code/trunk/data/levels/jump.oxw
r10259 r10260 243 243 <Model position="0,0,-1000" mesh="JumpPlatform06.mesh" scale="1" /> 244 244 <Model position="0,0,-1000" mesh="JumpProjectile.mesh" scale="1" /> 245 <Model position="0,0,-1000" mesh="JumpFigure.mesh" scale="1" />246 245 <Model position="0,0,-1000" mesh="JumpEnemy1.mesh" scale="1" /> 247 246 <Model position="0,0,-1000" mesh="JumpEnemy2.mesh" scale="1" /> … … 250 249 <Model position="0,0,-1000" mesh="JumpSpring.mesh" scale="1" /> 251 250 <Model position="0,0,-1000" mesh="JumpRocket.mesh" scale="1" /> 251 <Model position="0,0,-1000" mesh="JumpPropeller.mesh" scale="1" /> 252 <Model position="0,0,-1000" mesh="JumpBoots.mesh" scale="1" /> 253 <Model position="0,0,-1000" mesh="JumpShield.mesh" scale="1" /> 252 254 </attached> 253 255 </JumpCenterpoint> -
code/trunk/data/overlays/jumpHUD.oxo
r10216 r10260 1 1 <Template name="JumpHUD"> 2 2 <OverlayGroup name="JumpHUD" scale = "1, 1"> 3 3 4 <JumpScore 4 5 position = "0.5, 0.05" … … 9 10 align = "center" 10 11 showScore = true 12 showFuel = false 13 showMessages = false 14 /> 15 16 <JumpScore 17 position = "0.1, 0.05" 18 pickpoint = "0.0, 0.0" 19 font = "ShareTechMono" 20 textsize = 0.05 21 colour = "1.0, 0.5, 0.0, 1.0" 22 align = "left" 23 showScore = false 24 showFuel = true 11 25 showMessages = false 12 26 /> … … 21 35 gameOverText = "GAME OVER" 22 36 showScore = false 37 showFuel = false 23 38 showMessages = true 24 39 /> 25 40 41 <HUDBar 42 name = "SpeedBar1" 43 background = "Orxonox/BarBackground" 44 size = "0.35, 0.05" 45 position = "0.0 , 1.0 " 46 pickpoint = "0, 1" 47 correctaspect = false 48 49 initialvalue = 50 50 51 > 52 <BarColour position = 0.0 colour = "0.7,0.5,0.2" /> 53 <BarColour position = 0.5 colour = "0.2,0.7,0.2" /> 54 <BarColour position = 1.0 colour = "0.7,0.2,0.2" /> 55 </HUDBar> 56 26 57 </OverlayGroup> 27 58 </Template> -
code/trunk/src/modules/jump/Jump.cc
r10259 r10260 1271 1271 } 1272 1272 1273 float Jump::getFuel() const 1274 { 1275 if (this->figure_ != NULL) 1276 { 1277 if (this->figure_->rocketActive_ != NULL) 1278 { 1279 return this->figure_->rocketActive_->getFuelState(); 1280 } 1281 else if (this->figure_->propellerActive_ != NULL) 1282 { 1283 return this->figure_->propellerActive_->getFuelState(); 1284 } 1285 else if (this->figure_->shieldActive_ != NULL) 1286 { 1287 return this->figure_->shieldActive_->getFuelState(); 1288 } 1289 else if (this->figure_->bootsActive_ != NULL) 1290 { 1291 return this->figure_->bootsActive_->getFuelState(); 1292 } 1293 } 1294 1295 return 0.0; 1296 } 1297 1273 1298 bool Jump::getDead(PlayerInfo* player) const 1274 1299 { -
code/trunk/src/modules/jump/Jump.h
r10078 r10260 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 49 49 virtual void spawnPlayer(PlayerInfo* player); 50 50 int getScore(PlayerInfo* player) const; 51 float getFuel() const; 51 52 bool getDead(PlayerInfo* player) const; 52 53 void setCenterpoint(JumpCenterpoint* center) -
code/trunk/src/modules/jump/JumpBoots.cc
r10215 r10260 52 52 RegisterObject(JumpBoots); 53 53 54 fuel_ = 3.0; 54 initialFuel_ = 3.0; 55 fuel_ = initialFuel_; 55 56 attachedToFigure_ = false; 56 57 … … 102 103 attachedToFigure_ = figure_->StartBoots(this); 103 104 } 105 106 float JumpBoots::getFuelState() 107 { 108 return fuel_/initialFuel_; 109 } 104 110 } -
code/trunk/src/modules/jump/JumpBoots.h
r10078 r10260 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 46 virtual void touchFigure(); 47 virtual float getFuelState(); 47 48 protected: 48 49 float stretch_; 49 50 float fuel_; 51 float initialFuel_; 50 52 }; 51 53 } -
code/trunk/src/modules/jump/JumpFigure.cc
r10218 r10260 70 70 animateHands_ = false; 71 71 turnUp_ = false; 72 rocketActive_ = false;73 propellerActive_ = false;74 bootsActive_ = false;75 shieldActive_ = false;72 rocketActive_ = NULL; 73 propellerActive_ = NULL; 74 bootsActive_ = NULL; 75 shieldActive_ = NULL; 76 76 rocketSpeed_ = 0.0; 77 77 propellerSpeed_ = 0.0; … … 106 106 // Move up/down 107 107 Vector3 velocity = getVelocity(); 108 if (rocketActive_ == true)108 if (rocketActive_ != NULL) 109 109 { 110 110 velocity.z = rocketSpeed_; 111 111 } 112 else if (propellerActive_ == true)112 else if (propellerActive_ != NULL) 113 113 { 114 114 velocity.z = propellerSpeed_; … … 207 207 { 208 208 Vector3 velocity = getVelocity(); 209 velocity.z = (bootsActive_ ? 1.2f*jumpSpeed_ : jumpSpeed_); 209 if (bootsActive_ == NULL) 210 { 211 velocity.z = 1.2f*jumpSpeed_; 212 } 213 else 214 { 215 velocity.z = jumpSpeed_; 216 } 210 217 setVelocity(velocity); 211 212 218 animateHands_ = true; 213 219 handAngle_ = 0.0; … … 228 234 void JumpFigure::CollisionWithEnemy(JumpEnemy* enemy) 229 235 { 230 if (rocketActive_ == false && propellerActive_ == false && shieldActive_ == false)236 if (rocketActive_ == NULL && propellerActive_ == NULL && shieldActive_ == NULL) 231 237 { 232 238 dead_ = true; … … 236 242 bool JumpFigure::StartRocket(JumpRocket* rocket) 237 243 { 238 if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)244 if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL) 239 245 { 240 246 attach(rocket); 241 247 rocket->setPosition(0.0, rocketPos_, 0.0); 242 248 rocket->setVelocity(0.0, 0.0, 0.0); 243 rocketActive_ = true;249 rocketActive_ = rocket; 244 250 245 251 return true; … … 255 261 detach(rocket); 256 262 rocket->destroy(); 257 rocketActive_ = false;263 rocketActive_ = NULL; 258 264 } 259 265 260 266 bool JumpFigure::StartPropeller(JumpPropeller* propeller) 261 267 { 262 if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)268 if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL) 263 269 { 264 270 attach(propeller); 265 271 propeller->setPosition(0.0, 0.0, propellerPos_); 266 272 propeller->setVelocity(0.0, 0.0, 0.0); 267 propellerActive_ = true;273 propellerActive_ = propeller; 268 274 269 275 return true; … … 279 285 detach(propeller); 280 286 propeller->destroy(); 281 propellerActive_ = false;287 propellerActive_ = NULL; 282 288 } 283 289 284 290 bool JumpFigure::StartBoots(JumpBoots* boots) 285 291 { 286 if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)292 if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL) 287 293 { 288 294 attach(boots); 289 295 boots->setPosition(0.0, 0.0, bootsPos_); 290 296 boots->setVelocity(0.0, 0.0, 0.0); 291 bootsActive_ = true;297 bootsActive_ = boots; 292 298 293 299 return true; … … 303 309 detach(boots); 304 310 boots->destroy(); 305 bootsActive_ = false;311 bootsActive_ = NULL; 306 312 } 307 313 … … 313 319 shield->setPosition(0.0, 0.0, propellerPos_); 314 320 shield->setVelocity(0.0, 0.0, 0.0); 315 shieldActive_ = true;321 shieldActive_ = shield; 316 322 317 323 return true; … … 327 333 detach(shield); 328 334 shield->destroy(); 329 shieldActive_ = false;335 shieldActive_ = NULL; 330 336 } 331 337 -
code/trunk/src/modules/jump/JumpFigure.h
r10215 r10260 31 31 32 32 #include "jump/JumpPrereqs.h" 33 34 33 #include "worldentities/ControllableEntity.h" 35 34 … … 119 118 120 119 bool fireSignal_; 121 bool rocketActive_;122 bool propellerActive_;123 120 bool dead_; 121 122 JumpRocket* rocketActive_; 123 JumpPropeller* propellerActive_; 124 JumpBoots* bootsActive_; 125 JumpShield* shieldActive_; 124 126 private: 125 127 std::string modelLeftHand_; … … 149 151 bool animateHands_; 150 152 bool turnUp_; 151 bool bootsActive_;152 bool shieldActive_;153 153 float rocketSpeed_; 154 154 float propellerSpeed_; -
code/trunk/src/modules/jump/JumpItem.h
r10078 r10260 53 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 54 virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed); 55 virtual void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.55 virtual void setFigure(WeakPtr<JumpFigure> bats); 56 56 virtual void touchFigure(); 57 57 … … 74 74 75 75 protected: 76 float fieldWidth_; //!< The width of the playing field.77 float fieldHeight_; //!< The height of the playing field.78 WeakPtr<JumpFigure> figure_; //!< An array with the two bats.76 float fieldWidth_; 77 float fieldHeight_; 78 WeakPtr<JumpFigure> figure_; 79 79 float height_; 80 80 float width_; -
code/trunk/src/modules/jump/JumpPropeller.cc
r10215 r10260 52 52 RegisterObject(JumpPropeller); 53 53 54 fuel_ = 3.0; 54 initialFuel_ = 3.0; 55 fuel_ = initialFuel_; 55 56 attachedToFigure_ = false; 56 57 … … 106 107 } 107 108 } 109 110 float JumpPropeller::getFuelState() 111 { 112 return fuel_/initialFuel_; 113 } 108 114 } -
code/trunk/src/modules/jump/JumpPropeller.h
r10078 r10260 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 48 virtual void touchFigure(); 49 virtual float getFuelState(); 49 50 protected: 50 51 float stretch_; 51 52 float fuel_; 53 float initialFuel_; 52 54 }; 53 55 } -
code/trunk/src/modules/jump/JumpRocket.cc
r10215 r10260 49 49 RegisterObject(JumpRocket); 50 50 51 fuel_ = 3.0; 51 initialFuel_ = 3.0; 52 fuel_ = initialFuel_; 52 53 attachedToFigure_ = false; 53 54 … … 99 100 attachedToFigure_ = figure_->StartRocket(this); 100 101 } 102 103 float JumpRocket::getFuelState() 104 { 105 return fuel_/initialFuel_; 106 } 101 107 } -
code/trunk/src/modules/jump/JumpRocket.h
r10078 r10260 44 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 45 45 virtual void touchFigure(); 46 virtual float getFuelState(); 46 47 protected: 47 48 float stretch_; 48 49 float fuel_; 50 float initialFuel_; 49 51 }; 50 52 } -
code/trunk/src/modules/jump/JumpScore.cc
r10215 r10260 50 50 owner_ = NULL; 51 51 showScore_ = false; 52 showFuel_ = false; 52 53 showMessages_ = false; 53 54 } … … 63 64 64 65 XMLPortParam(JumpScore, "showScore", setShowScore, getShowScore, xmlelement, mode); 66 XMLPortParam(JumpScore, "showFuel", setShowFuel, getShowFuel, xmlelement, mode); 65 67 XMLPortParam(JumpScore, "showMessages", setShowMessages, getShowMessages, xmlelement, mode); 66 68 XMLPortParam(JumpScore, "gameOverText", setGameOverText, getGameOverText, xmlelement, mode); … … 86 88 setCaption(str); 87 89 } 90 else if (showFuel_ == true) 91 { 92 float fuel = owner_->getFuel(); 93 orxout() << fuel << endl; 94 std::string str; 95 96 if (fuel <= 0.0) 97 { 98 str = ""; 99 } 100 else 101 { 102 str = multi_cast<std::string>(fuel); 103 } 104 setCaption(str); 105 } 88 106 else if (showMessages_ == true) 89 107 { 90 91 108 setCaption(owner_->getDead(player_) == true ? gameOverText_ : ""); 92 109 } -
code/trunk/src/modules/jump/JumpScore.h
r10078 r10260 54 54 { return showScore_; } 55 55 56 void setShowFuel(const bool showFuel) 57 { showFuel_ = showFuel; } 58 59 const bool getShowFuel() const 60 { return showFuel_; } 61 56 62 void setShowMessages(const bool showMessages) 57 63 { showMessages_ = showMessages; } … … 71 77 WorldSound* scoreSound_; 72 78 bool showScore_; 79 bool showFuel_; 73 80 bool showMessages_; 74 81 std::string gameOverText_; -
code/trunk/src/modules/jump/JumpShield.cc
r10215 r10260 52 52 RegisterObject(JumpShield); 53 53 54 fuel_ = 7.0; 54 initialFuel_ = 7.0; 55 fuel_ = initialFuel_; 55 56 attachedToFigure_ = false; 56 57 … … 102 103 attachedToFigure_ = figure_->StartShield(this); 103 104 } 105 106 float JumpShield::getFuelState() 107 { 108 return fuel_/initialFuel_; 109 } 104 110 } -
code/trunk/src/modules/jump/JumpShield.h
r10078 r10260 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 48 virtual void touchFigure(); 49 virtual float getFuelState(); 49 50 protected: 50 51 float stretch_; 51 52 float fuel_; 53 float initialFuel_; 52 54 }; 53 55 }
Note: See TracChangeset
for help on using the changeset viewer.