Changeset 10721 for code/branches
- Timestamp:
- Oct 29, 2015, 11:27:32 PM (9 years ago)
- Location:
- code/branches/fabienHS15
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/fabienHS15/data/levels/includes/weaponSettingsRing.oxi
r10650 r10721 15 15 </links> 16 16 <Weapon> 17 <IceGun mode=0 munitionpershot= 0delay=0.125 damage=9.3 muzzleoffset="11,0,-3" freezefactor=0.5 freezetime=2.0 />17 <IceGun mode=0 munitionpershot=1 delay=0.125 damage=9.3 muzzleoffset="11,0,-3" freezefactor=0.5 freezetime=2.0 /> 18 18 </Weapon> 19 19 <Weapon> 20 <IceGun mode=0 munitionpershot= 0delay=0.125 damage=9.3 muzzleoffset=" -11,0,-3" freezefactor=0.5 freezetime=2.0 />20 <IceGun mode=0 munitionpershot=1 delay=0.125 damage=9.3 muzzleoffset=" -11,0,-3" freezefactor=0.5 freezetime=2.0 /> 21 21 </Weapon> 22 22 <Weapon> 23 <GravityBombFire mode=1 munitionpershot= 0delay=0.125 damage=3 muzzleoffset="0,0,-7"/>23 <GravityBombFire mode=1 munitionpershot=1 delay=0.125 damage=3 muzzleoffset="0,0,-7"/> 24 24 </Weapon> 25 25 </WeaponPack> -
code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt
r10715 r10721 293 293 <StaticEntity> 294 294 <attached> 295 <Billboard position="0,0,0" colour="0.6 0,0.97,0.23" material="Sphere2" scale=0.1>296 <attached> 297 <Billboard position="0,0,0" colour="0. 40,0.81,0.10" material="Arrow" scale=0.65 />295 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1> 296 <attached> 297 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="ArrowUp" scale=0.65 /> 298 298 </attached> 299 299 </Billboard> … … 309 309 <StaticEntity> 310 310 <attached> 311 <Billboard position="0,0,0" colour="0. 95,0.10,0.05" material="Sphere2" scale=0.1>312 <attached> 313 <Billboard position="0,0,0" colour="0. 95,0.20,0.10" material="Arrow" scale=0.65 />311 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1> 312 <attached> 313 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="ArrowDown" scale=0.65 /> 314 314 </attached> 315 315 </Billboard> … … 325 325 <StaticEntity> 326 326 <attached> 327 <Billboard position="0,0,0" colour="0.6 0,0.97,0.23" material="Sphere2" scale=0.1>328 <attached> 329 <Billboard position="0,0,0" colour="0. 40,0.81,0.10" material="Splash" scale=0.65 />327 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1> 328 <attached> 329 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Splash" scale=0.65 /> 330 330 </attached> 331 331 </Billboard> … … 341 341 <StaticEntity> 342 342 <attached> 343 <Billboard position="0,0,0" colour="0.6 0,0.97,0.23" material="Sphere2" scale=0.1>344 <attached> 345 <Billboard position="0,0,0" colour="0. 40,0.81,0.10" material="Asterisk" scale=0.65 />343 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Sphere2" scale=0.1> 344 <attached> 345 <Billboard position="0,0,0" colour="0.6,0.⁰,0.8" material="Asterisk" scale=0.65 /> 346 346 </attached> 347 347 </Billboard> -
code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
r10688 r10721 130 130 <HUDWeaponSystem 131 131 name = "WeaponSystem" 132 correctaspect = false 133 size = "0.6, 0.1" 132 correctaspect = true 134 133 position = "0.0, 0.0" 135 134 pickpoint = "0, 0" 136 135 visible = "true" 136 weaponModeHUDSize = "0.12, 0.04" 137 137 /> 138 138 -
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc
r10715 r10721 21 21 * 22 22 * Author: 23 * Yuning Chai 24 * Felix Schulthess 23 * Fabien Vultier 25 24 * Co-authors: 26 * Reto Grieder 27 * Wolfgang Roenninger 25 * ... 28 26 * 29 27 */ … … 48 46 RegisterObject(HUDWeapon); 49 47 48 weaponModeHUDActualSize_ = Vector2(0.0f,0.0f); 49 50 weaponModes_ = NULL; 51 weaponIndex_ = 0; 52 hudWeaponModes_.clear(); 53 50 54 overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeapon" + getUniqueNumberString())); 51 55 overlayElement_->setMaterialName("Orxonox/WSHUD_Weapon"); … … 75 79 { 76 80 SUPER(HUDWeapon, tick, dt); 81 82 if (!weapon_) 83 { 84 // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is NULL) 85 } 77 86 } 78 87 … … 82 91 83 92 positionHUDChilds(); 84 } 93 } 94 95 void HUDWeapon::sizeChanged() 96 { 97 OrxonoxOverlay::sizeChanged(); 98 99 positionHUDChilds(); 100 } 85 101 86 102 void HUDWeapon::changedOwner() … … 131 147 weaponModes_ = weapon_->getAllWeaponmodes(); 132 148 149 updateSize(); 133 150 createHUDChilds(); 134 positionHUDChilds(); 151 positionHUDChilds(); 135 152 } 136 153 137 154 void HUDWeapon::createHUDChilds() 138 155 { 156 if (weaponModes_ == NULL) 157 { 158 return; 159 } 160 161 int positionIndex = 0; 162 139 163 for (std::multimap<unsigned int, WeaponMode*>::iterator it = weaponModes_->begin(); it != weaponModes_->end(); ++it) 140 164 { 141 165 HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext()); 142 166 hudWeaponMode->setOwner(owner_); 167 hudWeaponMode->setOverlayGroup(this->getOverlayGroup()); 143 168 hudWeaponMode->setWeaponMode(it->second); 169 hudWeaponMode->setWeaponIndex(this->weaponIndex_); 170 hudWeaponMode->setAspectCorrection(false); 171 hudWeaponMode->setPickPoint(Vector2(0.0f,0.0f)); 172 144 173 hudWeaponModes_.push_back(hudWeaponMode); 145 } 174 175 ++ positionIndex; 176 } 146 177 } 147 178 … … 152 183 for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it) 153 184 { 154 (*it)->setOverlayGroup(this->getOverlayGroup()); 155 (*it)->setAspectCorrection(this->getAspectCorrection()); 156 (*it)->setPosition(this->getPosition() + Vector2(0.0f,0.025f*positionIndex)); 157 (*it)->setSize(Vector2(0.15f,0.025f)); 158 (*it)->setPickPoint(Vector2(0.0f,0.0f)); 159 160 ++ positionIndex; 161 } 162 163 overlayElement_->setDimensions(1.0f,0.25f*hudWeaponModes_.size()); 185 (*it)->setWeaponModeIndex(positionIndex); 186 (*it)->setWeaponIndex(this->weaponIndex_); 187 (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_); 188 (*it)->positionHUDChilds(); 189 190 ++ positionIndex; 191 } 164 192 } 165 193 … … 173 201 hudWeaponModes_.clear(); 174 202 } 203 204 void HUDWeapon::updateSize() 205 { 206 if (weaponModes_ != NULL) 207 { 208 this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weaponModes_->size())); 209 updatePosition(); 210 } 211 } 212 213 void HUDWeapon::updatePosition() 214 { 215 if (weaponModes_ != NULL) 216 { 217 this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f)); 218 } 219 } 175 220 } -
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h
r10688 r10721 65 65 virtual void changedVisibility(); 66 66 virtual void changedName(); 67 virtual void positionChanged(); 67 virtual void positionChanged(); 68 virtual void sizeChanged(); 68 69 69 70 virtual void setWeapon(Weapon* weapon); 70 71 72 inline void setWeaponModeHUDActualSize(Vector2 vector) 73 { weaponModeHUDActualSize_ = vector; 74 this->updateSize(); 75 } 76 inline Vector2 getWeaponModeHUDActualSize() const 77 { return weaponModeHUDActualSize_; } 78 inline void setWeaponIndex(int index) 79 { weaponIndex_ = index; 80 this->updatePosition(); 81 } 82 83 virtual void positionHUDChilds(); 84 71 85 private: 72 86 virtual void createHUDChilds(); 73 virtual void positionHUDChilds();74 virtual void destroyHUDChilds(); 87 88 virtual void destroyHUDChilds(); 75 89 virtual void updateWeaponModeList(); 90 virtual void updateSize(); 91 virtual void updatePosition(); 76 92 77 93 WeakPtr<Pawn> owner_; … … 81 97 std::vector<WeakPtr<HUDWeaponMode> > hudWeaponModes_; 82 98 83 Ogre::PanelOverlayElement* overlayElement_; 99 Ogre::PanelOverlayElement* overlayElement_; 100 101 Vector2 weaponModeHUDActualSize_; 102 int weaponIndex_; 84 103 }; 85 104 } -
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc
r10688 r10721 49 49 RegisterObject(HUDWeaponMode); 50 50 51 weaponIndex_ = 0; 52 weaponModeIndex_ = 0; 53 51 54 overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString())); 52 55 overlayElementIcon_->setPosition(0.0f,0.0f); … … 80 83 textOverlayLeft_->setPickPoint(Vector2(0.0f,0.0f)); 81 84 textOverlayLeft_->setVisible(true); 82 textOverlayLeft_->setAlignment(OverlayText:: Left);85 textOverlayLeft_->setAlignment(OverlayText::Center); 83 86 textOverlayLeft_->setTextSize(0.02f); 84 87 textOverlayLeft_->setColour(ColourValue(0.21,0.70,0.21,1.0)); 85 textOverlayLeft_->setPosition(getPosition()); 86 textOverlayLeft_->setAspectCorrection(this->getAspectCorrection()); 88 textOverlayLeft_->setAspectCorrection(false); 87 89 88 90 this->textOverlayRight_ = new OverlayText(this->getContext()); … … 91 93 textOverlayRight_->setPickPoint(Vector2(0.0f,0.0f)); 92 94 textOverlayRight_->setVisible(true); 93 textOverlayRight_->setAlignment(OverlayText:: Left);95 textOverlayRight_->setAlignment(OverlayText::Center); 94 96 textOverlayRight_->setTextSize(0.02f); 95 97 textOverlayRight_->setColour(ColourValue(0.21,0.70,0.21,1.0)); 96 textOverlayRight_->setPosition(getPosition()); 97 textOverlayRight_->setAspectCorrection(this->getAspectCorrection()); 98 textOverlayRight_->setAspectCorrection(false); 98 99 99 100 materialNameState_ = "Orxonox/WSHUD_Reloading"; … … 106 107 if (this->isInitialized()) 107 108 { 108 //this->textOverlay_->destroy(); 109 } 109 //this->textOverlay_->destroy(); 110 } 111 } 112 113 void HUDWeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode) 114 { 115 SUPER(HUDWeaponMode, XMLPort, xmlelement, mode); 110 116 } 111 117 … … 183 189 184 190 positionHUDChilds(); 185 } 191 } 192 193 void HUDWeaponMode::sizeChanged() 194 { 195 OrxonoxOverlay::sizeChanged(); 196 197 positionHUDChilds(); 198 } 186 199 187 200 void HUDWeaponMode::changedOwner() … … 190 203 191 204 this->owner_ = orxonox_cast<Pawn*>(this->getOwner()); 192 193 //updateWeaponsList();194 205 } 195 206 … … 206 217 SUPER(HUDWeaponMode, changedVisibility); 207 218 208 //this->textOverlay_->setVisible(this->isVisible()); 219 this->textOverlayLeft_->setVisible(this->isVisible()); 220 this->textOverlayRight_->setVisible(this->isVisible()); 209 221 } 210 222 … … 248 260 overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionSeparate"); 249 261 } 250 } 262 } 251 263 } 252 264 253 265 void HUDWeaponMode::positionHUDChilds() 254 266 { 255 textOverlayLeft_->setPosition(getPosition() + Vector2(0.06f,0.0f)); 256 textOverlayRight_->setPosition(getPosition() + Vector2(0.105f,0.0f)); 257 } 267 Vector2 size = Vector2(getSize().x*45.0f/150.0f, getSize().y); 268 Vector2 offset1 = Vector2(getSize().x*82.5f/150.0f, 0.0f); 269 Vector2 offset2 = Vector2(getSize().x*127.5f/150.0f, 0.0f); 270 271 textOverlayLeft_->setPosition(getPosition() + offset1); 272 textOverlayRight_->setPosition(getPosition() + offset2); 273 274 textOverlayLeft_->setSize(size); 275 textOverlayRight_->setSize(size); 276 277 textOverlayLeft_->setTextSize(getSize().y); 278 textOverlayRight_->setTextSize(getSize().y); 279 } 280 281 void HUDWeaponMode::updateSize() 282 { 283 this->setSize(weaponModeHUDActualSize_); 284 updatePosition(); 285 } 286 287 void HUDWeaponMode::updatePosition() 288 { 289 this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,weaponModeHUDActualSize_.y*weaponModeIndex_)); 290 } 258 291 } -
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h
r10688 r10721 1 1 2 /* 2 3 * ORXONOX - the hottest 3D action shooter ever to exist … … 58 59 59 60 virtual void tick(float dt); 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 60 62 virtual void changedOwner(); 61 63 virtual void changedOverlayGroup(); … … 63 65 virtual void changedName(); 64 66 virtual void positionChanged(); 67 virtual void sizeChanged(); 65 68 66 69 virtual void setWeaponMode(WeaponMode* weaponMode); 67 70 71 inline void setWeaponModeHUDActualSize(Vector2 vector) 72 { weaponModeHUDActualSize_ = vector; 73 this->updateSize(); 74 } 75 inline Vector2 getWeaponModeHUDActualSize() const 76 { return weaponModeHUDActualSize_; } 77 inline void setWeaponIndex(int index) 78 { weaponIndex_ = index; 79 this->updatePosition(); 80 } 81 inline void setWeaponModeIndex(int index) 82 { weaponModeIndex_ = index; 83 this->updatePosition(); 84 } 85 86 virtual void positionHUDChilds(); 87 68 88 private: 69 virtual void positionHUDChilds(); 89 virtual void updateSize(); 90 virtual void updatePosition(); 70 91 71 92 WeakPtr<Pawn> owner_; … … 81 102 StrongPtr<OverlayText> textOverlayLeft_; 82 103 StrongPtr<OverlayText> textOverlayRight_; 104 105 Vector2 weaponModeHUDActualSize_; 106 int weaponIndex_; 107 int weaponModeIndex_; 83 108 }; 84 109 } -
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc
r10688 r10721 51 51 RegisterObject(HUDWeaponSystem); 52 52 53 weaponModeHUDSize_ = Vector2(0.0f,0.0f); 54 weaponModeHUDActualSize_ = Vector2(0.0f,0.0f); 55 53 56 weapons_.clear(); 54 57 hudWeapons_.clear(); … … 67 70 SUPER(HUDWeaponSystem, XMLPort, xmlelement, mode); 68 71 69 /*XMLPortParam(HUDWeaponSystem, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlelement, mode); 70 XMLPortParam(HUDWeaponSystem, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);*/ 72 XMLPortParam(HUDWeaponSystem, "weaponModeHUDSize", setWeaponModeHUDSize, getWeaponModeHUDSize, xmlelement, mode); 71 73 } 72 74 … … 86 88 87 89 positionHUDChilds(); 88 } 90 } 91 92 void HUDWeaponSystem::sizeChanged() 93 { 94 OrxonoxOverlay::sizeChanged(); 95 96 weaponModeHUDActualSize_ = this->getActualSize(); 97 98 positionHUDChilds(); 99 } 89 100 90 101 void HUDWeaponSystem::changedOwner() … … 142 153 143 154 createHUDChilds(); 144 positionHUDChilds(); 155 positionHUDChilds(); 145 156 } 146 157 147 158 void HUDWeaponSystem::createHUDChilds() 148 159 { 160 int positionIndex = 0; 161 149 162 for (std::vector<WeakPtr<Weapon> >::iterator it = weapons_.begin(); it != weapons_.end(); ++it) 150 163 { 151 HUDWeapon* hudWeapon = new HUDWeapon(this->getContext()); 164 HUDWeapon* hudWeapon = new HUDWeapon(this->getContext()); 152 165 hudWeapon->setOwner(owner_); 166 hudWeapon->setOverlayGroup(this->getOverlayGroup()); 153 167 hudWeapon->setWeapon(*it); 168 hudWeapon->setAspectCorrection(false); 169 hudWeapon->setPickPoint(Vector2(0.0f,0.0f)); 170 154 171 hudWeapons_.push_back(hudWeapon); 155 } 172 173 ++ positionIndex; 174 } 156 175 } 157 176 … … 159 178 { 160 179 int positionIndex = 0; 180 //this->setSize(weaponModeHUDSize_); 181 // this->weaponModeHUDActualSize_ = this->getActualSize(); 161 182 162 183 for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it) 163 184 { 164 (*it)->setOverlayGroup(this->getOverlayGroup()); 165 (*it)->setAspectCorrection(this->getAspectCorrection()); 166 (*it)->setPosition(this->getPosition() + Vector2(0.15f*positionIndex,0.0f)); 167 (*it)->setSize(Vector2(0.15f,0.10f)); 168 (*it)->setPickPoint(Vector2(0.0f,0.0f)); 185 (*it)->setWeaponIndex(positionIndex); 186 (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_); 187 (*it)->positionHUDChilds(); 169 188 170 189 ++ positionIndex; 171 } 190 } 172 191 } 173 192 … … 180 199 181 200 hudWeapons_.clear(); 182 } 201 } 183 202 } -
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h
r10688 r10721 63 63 virtual void changedVisibility(); 64 64 virtual void changedName(); 65 virtual void positionChanged(); 66 65 virtual void positionChanged(); 66 virtual void sizeChanged(); 67 protected: 68 inline void setWeaponModeHUDSize(Vector2 vector) 69 { weaponModeHUDSize_ = vector; 70 this->setSize(weaponModeHUDSize_); 71 } 72 inline Vector2 getWeaponModeHUDSize() const 73 { return weaponModeHUDSize_; } 67 74 private: 68 75 virtual void updateWeaponList(); … … 75 82 std::vector<WeakPtr<Weapon> > weapons_; 76 83 std::vector<WeakPtr<HUDWeapon> > hudWeapons_; 84 85 Vector2 weaponModeHUDSize_; 86 Vector2 weaponModeHUDActualSize_; 77 87 }; 78 88 } -
code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc
r10715 r10721 134 134 { 135 135 this->Pickupable::destroy(); 136 } 136 } 137 137 } 138 138 -
code/branches/fabienHS15/src/orxonox/overlays/OrxonoxOverlay.h
r9667 r10721 65 65 only for displaying a picture). 66 66 - Reacts to changes of the window aspect 67 - Last but not least: On demand you can tell the overlay to automatically res ale to correct for67 - Last but not least: On demand you can tell the overlay to automatically rescale to correct for 68 68 aspect distortion. E.g. if you play 1024x768 you wouldn't want a round object to be oval. 69 69 Remark: This can (due to the Ogre::Overlay transformation order) only work for angle that are -
code/branches/fabienHS15/src/orxonox/weaponsystem/Munition.cc
r10714 r10721 302 302 } 303 303 304 // If we reached the limit, redu ze both magazines and munition to the maximum304 // If we reached the limit, reduce both magazines and munition to the maximum 305 305 if (this->magazines_ >= this->maxMagazines_) 306 306 { 307 this->magazines_ = this->maxMagazines_ - 1;307 this->magazines_ = this->maxMagazines_; 308 308 magazine->munition_ = this->maxMunitionPerMagazine_; 309 309 }
Note: See TracChangeset
for help on using the changeset viewer.