Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10721


Ignore:
Timestamp:
Oct 29, 2015, 11:27:32 PM (8 years ago)
Author:
fvultier
Message:
 
Location:
code/branches/fabienHS15
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fabienHS15/data/levels/includes/weaponSettingsRing.oxi

    r10650 r10721  
    1515    </links>
    1616    <Weapon>
    17       <IceGun mode=0 munitionpershot=0 delay=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 />
    1818    </Weapon>
    1919    <Weapon>
    20       <IceGun mode=0 munitionpershot=0 delay=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 />
    2121    </Weapon>
    2222    <Weapon>
    23       <GravityBombFire mode=1 munitionpershot=0 delay=0.125 damage=3 muzzleoffset="0,0,-7"/>
     23      <GravityBombFire mode=1 munitionpershot=1 delay=0.125 damage=3 muzzleoffset="0,0,-7"/>
    2424    </Weapon>
    2525  </WeaponPack>
  • code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt

    r10715 r10721  
    293293            <StaticEntity>
    294294                <attached>
    295                     <Billboard position="0,0,0" colour="0.60,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 />
    298298                        </attached>
    299299                    </Billboard>
     
    309309            <StaticEntity>
    310310                <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 />
    314314                        </attached>
    315315                    </Billboard>
     
    325325            <StaticEntity>
    326326                <attached>
    327                     <Billboard position="0,0,0" colour="0.60,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 />
    330330                        </attached>
    331331                    </Billboard>
     
    341341            <StaticEntity>
    342342                <attached>
    343                     <Billboard position="0,0,0" colour="0.60,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 />
    346346                        </attached>
    347347                    </Billboard>
  • code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo

    r10688 r10721  
    130130    <HUDWeaponSystem
    131131     name                   = "WeaponSystem"
    132      correctaspect          = false
    133      size                   = "0.6, 0.1"
     132     correctaspect          = true
    134133     position               = "0.0, 0.0"
    135134     pickpoint              = "0, 0"
    136135     visible                = "true"
     136     weaponModeHUDSize      = "0.12, 0.04"
    137137    />
    138138   
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc

    r10715 r10721  
    2121 *
    2222 *   Author:
    23  *      Yuning Chai
    24  *      Felix Schulthess
     23 *      Fabien Vultier
    2524 *   Co-authors:
    26  *      Reto Grieder
    27  *      Wolfgang Roenninger
     25 *      ...
    2826 *
    2927 */
     
    4846        RegisterObject(HUDWeapon);
    4947
     48        weaponModeHUDActualSize_ = Vector2(0.0f,0.0f);
     49
     50        weaponModes_ = NULL;
     51        weaponIndex_ = 0;
     52        hudWeaponModes_.clear();
     53
    5054        overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeapon" + getUniqueNumberString()));
    5155        overlayElement_->setMaterialName("Orxonox/WSHUD_Weapon");
     
    7579    {
    7680        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        }
    7786    }   
    7887
     
    8291
    8392        positionHUDChilds();
    84     }     
     93    }
     94
     95    void HUDWeapon::sizeChanged()
     96    {
     97        OrxonoxOverlay::sizeChanged();
     98
     99        positionHUDChilds();
     100    }
    85101
    86102    void HUDWeapon::changedOwner()
     
    131147        weaponModes_ = weapon_->getAllWeaponmodes();
    132148
     149        updateSize();
    133150        createHUDChilds();
    134         positionHUDChilds();       
     151        positionHUDChilds();
    135152    } 
    136153
    137154    void HUDWeapon::createHUDChilds()
    138155    {
     156        if (weaponModes_ == NULL)
     157        {
     158            return;
     159        }
     160
     161        int positionIndex = 0;
     162
    139163        for (std::multimap<unsigned int, WeaponMode*>::iterator it = weaponModes_->begin(); it != weaponModes_->end(); ++it)
    140164        {
    141165            HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext());
    142166            hudWeaponMode->setOwner(owner_);
     167            hudWeaponMode->setOverlayGroup(this->getOverlayGroup());
    143168            hudWeaponMode->setWeaponMode(it->second);
     169            hudWeaponMode->setWeaponIndex(this->weaponIndex_);                   
     170            hudWeaponMode->setAspectCorrection(false);
     171            hudWeaponMode->setPickPoint(Vector2(0.0f,0.0f));
     172
    144173            hudWeaponModes_.push_back(hudWeaponMode);
    145         }   
     174
     175            ++ positionIndex;
     176        }
    146177    }     
    147178
     
    152183        for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
    153184        {
    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        }
    164192    } 
    165193
     
    173201        hudWeaponModes_.clear();
    174202    }
     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    }       
    175220}
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.h

    r10688 r10721  
    6565        virtual void changedVisibility();
    6666        virtual void changedName();
    67         virtual void positionChanged();
     67        virtual void positionChanged();
     68        virtual void sizeChanged();
    6869
    6970        virtual void setWeapon(Weapon* weapon);
    7071
     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
    7185    private:
    7286        virtual void createHUDChilds();
    73         virtual void positionHUDChilds();
    74         virtual void destroyHUDChilds();       
     87       
     88        virtual void destroyHUDChilds();
    7589        virtual void updateWeaponModeList();
     90        virtual void updateSize();
     91        virtual void updatePosition();
    7692
    7793        WeakPtr<Pawn> owner_;
     
    8197        std::vector<WeakPtr<HUDWeaponMode> > hudWeaponModes_;
    8298
    83         Ogre::PanelOverlayElement* overlayElement_;       
     99        Ogre::PanelOverlayElement* overlayElement_;
     100
     101        Vector2 weaponModeHUDActualSize_;
     102        int weaponIndex_;
    84103    };
    85104}
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.cc

    r10688 r10721  
    4949        RegisterObject(HUDWeaponMode);
    5050
     51        weaponIndex_ = 0;
     52        weaponModeIndex_ = 0;
     53
    5154        overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDWeaponMode" + getUniqueNumberString()));
    5255        overlayElementIcon_->setPosition(0.0f,0.0f);
     
    8083        textOverlayLeft_->setPickPoint(Vector2(0.0f,0.0f));
    8184        textOverlayLeft_->setVisible(true);
    82         textOverlayLeft_->setAlignment(OverlayText::Left);
     85        textOverlayLeft_->setAlignment(OverlayText::Center);
    8386        textOverlayLeft_->setTextSize(0.02f);
    8487        textOverlayLeft_->setColour(ColourValue(0.21,0.70,0.21,1.0));
    85         textOverlayLeft_->setPosition(getPosition());
    86         textOverlayLeft_->setAspectCorrection(this->getAspectCorrection());
     88        textOverlayLeft_->setAspectCorrection(false);
    8789       
    8890        this->textOverlayRight_ = new OverlayText(this->getContext());
     
    9193        textOverlayRight_->setPickPoint(Vector2(0.0f,0.0f));
    9294        textOverlayRight_->setVisible(true);
    93         textOverlayRight_->setAlignment(OverlayText::Left);
     95        textOverlayRight_->setAlignment(OverlayText::Center);
    9496        textOverlayRight_->setTextSize(0.02f);
    9597        textOverlayRight_->setColour(ColourValue(0.21,0.70,0.21,1.0));
    96         textOverlayRight_->setPosition(getPosition());
    97         textOverlayRight_->setAspectCorrection(this->getAspectCorrection());       
     98        textOverlayRight_->setAspectCorrection(false);
    9899
    99100        materialNameState_ = "Orxonox/WSHUD_Reloading";
     
    106107        if (this->isInitialized())
    107108        {
    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);
    110116    }
    111117
     
    183189
    184190        positionHUDChilds();
    185     }   
     191    }
     192
     193    void HUDWeaponMode::sizeChanged()
     194    {
     195        OrxonoxOverlay::sizeChanged();
     196
     197        positionHUDChilds();
     198    }
    186199
    187200    void HUDWeaponMode::changedOwner()
     
    190203
    191204        this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
    192 
    193         //updateWeaponsList();
    194205    }
    195206
     
    206217        SUPER(HUDWeaponMode, changedVisibility);
    207218
    208         //this->textOverlay_->setVisible(this->isVisible());
     219        this->textOverlayLeft_->setVisible(this->isVisible());
     220        this->textOverlayRight_->setVisible(this->isVisible());
    209221    }
    210222
     
    248260                overlayElementMunition_->setMaterialName("Orxonox/WSHUD_MunitionSeparate");
    249261            }
    250         }     
     262        }
    251263    }
    252264
    253265    void HUDWeaponMode::positionHUDChilds()
    254266    {
    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    }     
    258291}
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponMode.h

    r10688 r10721  
     1
    12/*
    23 *   ORXONOX - the hottest 3D action shooter ever to exist
     
    5859
    5960        virtual void tick(float dt);
     61        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6062        virtual void changedOwner();
    6163        virtual void changedOverlayGroup();
     
    6365        virtual void changedName();
    6466        virtual void positionChanged();
     67        virtual void sizeChanged();
    6568
    6669        virtual void setWeaponMode(WeaponMode* weaponMode);
    6770
     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
    6888    private:
    69         virtual void positionHUDChilds();
     89        virtual void updateSize();
     90        virtual void updatePosition();
    7091
    7192        WeakPtr<Pawn> owner_;
     
    81102        StrongPtr<OverlayText> textOverlayLeft_;
    82103        StrongPtr<OverlayText> textOverlayRight_;
     104
     105        Vector2 weaponModeHUDActualSize_;
     106        int weaponIndex_;
     107        int weaponModeIndex_;
    83108    };
    84109}
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.cc

    r10688 r10721  
    5151        RegisterObject(HUDWeaponSystem);
    5252
     53        weaponModeHUDSize_ = Vector2(0.0f,0.0f);
     54        weaponModeHUDActualSize_ = Vector2(0.0f,0.0f);       
     55
    5356        weapons_.clear();
    5457        hudWeapons_.clear();
     
    6770        SUPER(HUDWeaponSystem, XMLPort, xmlelement, mode);
    6871
    69         /*XMLPortParam(HUDWeaponSystem, "sensitivity", setRadarSensitivity, getRadarSensitivity, xmlelement, mode);
    70         XMLPortParam(HUDWeaponSystem, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);*/
     72        XMLPortParam(HUDWeaponSystem, "weaponModeHUDSize", setWeaponModeHUDSize, getWeaponModeHUDSize, xmlelement, mode);
    7173    }
    7274
     
    8688
    8789        positionHUDChilds();
    88     } 
     90    }
     91
     92    void HUDWeaponSystem::sizeChanged()
     93    {
     94        OrxonoxOverlay::sizeChanged();
     95
     96        weaponModeHUDActualSize_ = this->getActualSize();
     97
     98        positionHUDChilds();
     99    }
    89100
    90101    void HUDWeaponSystem::changedOwner()
     
    142153
    143154        createHUDChilds();
    144         positionHUDChilds();       
     155        positionHUDChilds();
    145156    }
    146157
    147158    void HUDWeaponSystem::createHUDChilds()
    148159    {
     160        int positionIndex = 0;
     161
    149162        for (std::vector<WeakPtr<Weapon> >::iterator it = weapons_.begin(); it != weapons_.end(); ++it)
    150163        {
    151             HUDWeapon* hudWeapon = new HUDWeapon(this->getContext());           
     164            HUDWeapon* hudWeapon = new HUDWeapon(this->getContext());
    152165            hudWeapon->setOwner(owner_);
     166            hudWeapon->setOverlayGroup(this->getOverlayGroup());
    153167            hudWeapon->setWeapon(*it);
     168            hudWeapon->setAspectCorrection(false);
     169            hudWeapon->setPickPoint(Vector2(0.0f,0.0f));
     170
    154171            hudWeapons_.push_back(hudWeapon);
    155         }       
     172
     173            ++ positionIndex;
     174        }
    156175    }     
    157176
     
    159178    {
    160179        int positionIndex = 0;
     180        //this->setSize(weaponModeHUDSize_);
     181        // this->weaponModeHUDActualSize_ = this->getActualSize();
    161182
    162183        for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
    163184        {
    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();           
    169188
    170189            ++ positionIndex;
    171         }       
     190        }
    172191    } 
    173192
     
    180199
    181200        hudWeapons_.clear();     
    182     }     
     201    }
    183202}
  • code/branches/fabienHS15/src/modules/overlays/hud/HUDWeaponSystem.h

    r10688 r10721  
    6363        virtual void changedVisibility();
    6464        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_; }
    6774    private:
    6875        virtual void updateWeaponList();
     
    7582        std::vector<WeakPtr<Weapon> > weapons_;
    7683        std::vector<WeakPtr<HUDWeapon> > hudWeapons_;
     84
     85        Vector2 weaponModeHUDSize_;
     86        Vector2 weaponModeHUDActualSize_;
    7787    };
    7888}
  • code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc

    r10715 r10721  
    134134        {
    135135            this->Pickupable::destroy();
    136         }       
     136        }
    137137    }   
    138138
  • code/branches/fabienHS15/src/orxonox/overlays/OrxonoxOverlay.h

    r9667 r10721  
    6565          only for displaying a picture).
    6666        - Reacts to changes of the window aspect
    67         - Last but not least: On demand you can tell the overlay to automatically resale to correct for
     67        - Last but not least: On demand you can tell the overlay to automatically rescale to correct for
    6868          aspect distortion. E.g. if you play 1024x768 you wouldn't want a round object to be oval.
    6969          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  
    302302                }
    303303
    304                 // If we reached the limit, reduze both magazines and munition to the maximum
     304                // If we reached the limit, reduce both magazines and munition to the maximum
    305305                if (this->magazines_ >= this->maxMagazines_)
    306306                {
    307                     this->magazines_ = this->maxMagazines_ - 1;
     307                    this->magazines_ = this->maxMagazines_;
    308308                    magazine->munition_ = this->maxMunitionPerMagazine_;
    309309                }
Note: See TracChangeset for help on using the changeset viewer.