Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10260


Ignore:
Timestamp:
Feb 6, 2015, 11:03:00 PM (9 years ago)
Author:
landauf
Message:

merged the latest changes from pickupsFS14 to trunk

Location:
code/trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/levels/jump.oxw

    r10259 r10260  
    243243            <Model position="0,0,-1000" mesh="JumpPlatform06.mesh" scale="1" />
    244244            <Model position="0,0,-1000" mesh="JumpProjectile.mesh" scale="1" />
    245             <Model position="0,0,-1000" mesh="JumpFigure.mesh" scale="1" />
    246245            <Model position="0,0,-1000" mesh="JumpEnemy1.mesh" scale="1" />
    247246            <Model position="0,0,-1000" mesh="JumpEnemy2.mesh" scale="1" />
     
    250249            <Model position="0,0,-1000" mesh="JumpSpring.mesh" scale="1" />
    251250            <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" />
    252254          </attached>
    253255        </JumpCenterpoint>
  • code/trunk/data/overlays/jumpHUD.oxo

    r10216 r10260  
    11<Template name="JumpHUD">
    22  <OverlayGroup name="JumpHUD" scale = "1, 1">
     3
    34    <JumpScore
    45     position  = "0.5, 0.05"
     
    910     align     = "center"
    1011     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
    1125     showMessages = false
    1226    />
     
    2135     gameOverText = "GAME OVER"
    2236     showScore = false
     37     showFuel = false
    2338     showMessages = true
    2439    />   
    2540
     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
    2657  </OverlayGroup>
    2758</Template>
  • code/trunk/src/modules/jump/Jump.cc

    r10259 r10260  
    12711271    }
    12721272
     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
    12731298    bool Jump::getDead(PlayerInfo* player) const
    12741299    {
  • code/trunk/src/modules/jump/Jump.h

    r10078 r10260  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Fabien Vultier
    2424 *   Co-authors:
    2525 *      ...
     
    4949            virtual void spawnPlayer(PlayerInfo* player);
    5050            int getScore(PlayerInfo* player) const;
     51            float getFuel() const;
    5152            bool getDead(PlayerInfo* player) const;
    5253            void setCenterpoint(JumpCenterpoint* center)
  • code/trunk/src/modules/jump/JumpBoots.cc

    r10215 r10260  
    5252        RegisterObject(JumpBoots);
    5353
    54         fuel_ = 3.0;
     54        initialFuel_ = 3.0;
     55        fuel_ = initialFuel_;
    5556        attachedToFigure_ = false;
    5657
     
    102103        attachedToFigure_ = figure_->StartBoots(this);
    103104    }
     105
     106    float JumpBoots::getFuelState()
     107    {
     108        return fuel_/initialFuel_;
     109    }
    104110}
  • code/trunk/src/modules/jump/JumpBoots.h

    r10078 r10260  
    4545            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4646            virtual void touchFigure();
     47            virtual float getFuelState();
    4748        protected:
    4849            float stretch_;
    4950            float fuel_;
     51            float initialFuel_;
    5052    };
    5153}
  • code/trunk/src/modules/jump/JumpFigure.cc

    r10218 r10260  
    7070        animateHands_ = false;
    7171        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;
    7676        rocketSpeed_ = 0.0;
    7777        propellerSpeed_ = 0.0;
     
    106106            // Move up/down
    107107            Vector3 velocity = getVelocity();
    108             if (rocketActive_ == true)
     108            if (rocketActive_ != NULL)
    109109            {
    110110                velocity.z = rocketSpeed_;
    111111            }
    112             else if (propellerActive_ == true)
     112            else if (propellerActive_ != NULL)
    113113            {
    114114                velocity.z = propellerSpeed_;
     
    207207        {
    208208            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            }
    210217            setVelocity(velocity);
    211 
    212218            animateHands_ = true;
    213219            handAngle_ = 0.0;
     
    228234    void JumpFigure::CollisionWithEnemy(JumpEnemy* enemy)
    229235    {
    230         if (rocketActive_ == false && propellerActive_ == false && shieldActive_ == false)
     236        if (rocketActive_ == NULL && propellerActive_ == NULL && shieldActive_ == NULL)
    231237        {
    232238            dead_ = true;
     
    236242    bool JumpFigure::StartRocket(JumpRocket* rocket)
    237243    {
    238         if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
     244        if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL)
    239245        {
    240246            attach(rocket);
    241247            rocket->setPosition(0.0, rocketPos_, 0.0);
    242248            rocket->setVelocity(0.0, 0.0, 0.0);
    243             rocketActive_ = true;
     249            rocketActive_ = rocket;
    244250
    245251            return true;
     
    255261        detach(rocket);
    256262        rocket->destroy();
    257         rocketActive_ = false;
     263        rocketActive_ = NULL;
    258264    }
    259265
    260266    bool JumpFigure::StartPropeller(JumpPropeller* propeller)
    261267    {
    262         if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
     268        if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL)
    263269        {
    264270            attach(propeller);
    265271            propeller->setPosition(0.0, 0.0, propellerPos_);
    266272            propeller->setVelocity(0.0, 0.0, 0.0);
    267             propellerActive_ = true;
     273            propellerActive_ = propeller;
    268274
    269275            return true;
     
    279285        detach(propeller);
    280286        propeller->destroy();
    281         propellerActive_ = false;
     287        propellerActive_ = NULL;
    282288    }
    283289
    284290    bool JumpFigure::StartBoots(JumpBoots* boots)
    285291    {
    286         if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
     292        if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL)
    287293        {
    288294            attach(boots);
    289295            boots->setPosition(0.0, 0.0, bootsPos_);
    290296            boots->setVelocity(0.0, 0.0, 0.0);
    291             bootsActive_ = true;
     297            bootsActive_ = boots;
    292298
    293299            return true;
     
    303309        detach(boots);
    304310        boots->destroy();
    305         bootsActive_ = false;
     311        bootsActive_ = NULL;
    306312    }
    307313
     
    313319            shield->setPosition(0.0, 0.0, propellerPos_);
    314320            shield->setVelocity(0.0, 0.0, 0.0);
    315             shieldActive_ = true;
     321            shieldActive_ = shield;
    316322
    317323            return true;
     
    327333        detach(shield);
    328334        shield->destroy();
    329         shieldActive_ = false;
     335        shieldActive_ = NULL;
    330336    }
    331337
  • code/trunk/src/modules/jump/JumpFigure.h

    r10215 r10260  
    3131
    3232#include "jump/JumpPrereqs.h"
    33 
    3433#include "worldentities/ControllableEntity.h"
    3534
     
    119118
    120119            bool fireSignal_;
    121             bool rocketActive_;
    122             bool propellerActive_;
    123120            bool dead_;
     121
     122            JumpRocket* rocketActive_;
     123            JumpPropeller* propellerActive_;
     124            JumpBoots* bootsActive_;
     125            JumpShield* shieldActive_;
    124126        private:
    125127            std::string modelLeftHand_;
     
    149151            bool animateHands_;
    150152            bool turnUp_;
    151             bool bootsActive_;
    152             bool shieldActive_;
    153153            float rocketSpeed_;
    154154            float propellerSpeed_;
  • code/trunk/src/modules/jump/JumpItem.h

    r10078 r10260  
    5353            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5454            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);
    5656            virtual void touchFigure();
    5757
     
    7474
    7575        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_;
    7979            float height_;
    8080            float width_;
  • code/trunk/src/modules/jump/JumpPropeller.cc

    r10215 r10260  
    5252        RegisterObject(JumpPropeller);
    5353
    54         fuel_ = 3.0;
     54        initialFuel_ = 3.0;
     55        fuel_ = initialFuel_;
    5556        attachedToFigure_ = false;
    5657
     
    106107        }
    107108    }
     109
     110    float JumpPropeller::getFuelState()
     111    {
     112        return fuel_/initialFuel_;
     113    }
    108114}
  • code/trunk/src/modules/jump/JumpPropeller.h

    r10078 r10260  
    4747            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4848            virtual void touchFigure();
     49            virtual float getFuelState();
    4950        protected:
    5051            float stretch_;
    5152            float fuel_;
     53            float initialFuel_;
    5254    };
    5355}
  • code/trunk/src/modules/jump/JumpRocket.cc

    r10215 r10260  
    4949        RegisterObject(JumpRocket);
    5050
    51         fuel_ = 3.0;
     51        initialFuel_ = 3.0;
     52        fuel_ = initialFuel_;
    5253        attachedToFigure_ = false;
    5354
     
    99100        attachedToFigure_ = figure_->StartRocket(this);
    100101    }
     102
     103    float JumpRocket::getFuelState()
     104    {
     105        return fuel_/initialFuel_;
     106    }
    101107}
  • code/trunk/src/modules/jump/JumpRocket.h

    r10078 r10260  
    4444            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4545            virtual void touchFigure();
     46            virtual float getFuelState();
    4647        protected:
    4748            float stretch_;
    4849            float fuel_;
     50            float initialFuel_;
    4951    };
    5052}
  • code/trunk/src/modules/jump/JumpScore.cc

    r10215 r10260  
    5050        owner_ = NULL;
    5151        showScore_ = false;
     52        showFuel_ = false;
    5253        showMessages_ = false;
    5354    }
     
    6364
    6465        XMLPortParam(JumpScore, "showScore", setShowScore, getShowScore, xmlelement, mode);
     66        XMLPortParam(JumpScore, "showFuel", setShowFuel, getShowFuel, xmlelement, mode);
    6567        XMLPortParam(JumpScore, "showMessages", setShowMessages, getShowMessages, xmlelement, mode);
    6668        XMLPortParam(JumpScore, "gameOverText", setGameOverText, getGameOverText, xmlelement, mode);
     
    8688                        setCaption(str);
    8789                    }
     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                    }
    88106                    else if (showMessages_ == true)
    89107                    {
    90 
    91108                        setCaption(owner_->getDead(player_) == true ? gameOverText_ : "");
    92109                    }
  • code/trunk/src/modules/jump/JumpScore.h

    r10078 r10260  
    5454                { return showScore_; }
    5555
     56            void setShowFuel(const bool showFuel)
     57                { showFuel_ = showFuel; }
     58
     59            const bool getShowFuel() const
     60                { return showFuel_; }
     61
    5662            void setShowMessages(const bool showMessages)
    5763                { showMessages_ = showMessages; }
     
    7177            WorldSound* scoreSound_;
    7278            bool showScore_;
     79            bool showFuel_;
    7380            bool showMessages_;
    7481            std::string gameOverText_;
  • code/trunk/src/modules/jump/JumpShield.cc

    r10215 r10260  
    5252        RegisterObject(JumpShield);
    5353
    54         fuel_ = 7.0;
     54        initialFuel_ = 7.0;
     55        fuel_ = initialFuel_;
    5556        attachedToFigure_ = false;
    5657
     
    102103        attachedToFigure_ = figure_->StartShield(this);
    103104    }
     105
     106    float JumpShield::getFuelState()
     107    {
     108        return fuel_/initialFuel_;
     109    }
    104110}
  • code/trunk/src/modules/jump/JumpShield.h

    r10078 r10260  
    4747            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4848            virtual void touchFigure();
     49            virtual float getFuelState();
    4950        protected:
    5051            float stretch_;
    5152            float fuel_;
     53            float initialFuel_;
    5254    };
    5355}
Note: See TracChangeset for help on using the changeset viewer.