Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2011, 6:41:25 PM (14 years ago)
Author:
simonmie
Message:

added more comments, removed code marks, changed strange (wrong?) hit call

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc

    r8551 r8553  
    152152        this->bReload_ = false;
    153153
    154 ////////me
     154        // TODO: use the existing timer functions instead
    155155        if(this->reloadWaitCountdown_ > 0)
    156156        {
     
    163163        }
    164164
    165 ////////end me
    166165        if (GameMode::isMaster())
     166        {
    167167            if (this->health_ <= 0 && bAlive_)
    168168            {
     
    170170                this->death();
    171171            }
     172        }
    172173    }
    173174
     
    195196    }
    196197
    197 //////////////////me
     198
     199    void Pawn::setHealth(float health)
     200    {
     201        this->health_ = std::min(health, this->maxHealth_); //Health can't be set to a value bigger than maxHealth, otherwise it will be reduced at first hit
     202    }
     203
     204    void Pawn::setShieldHealth(float shieldHealth)
     205    {
     206        this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_);
     207    }
     208
     209    void Pawn::setMaxShieldHealth(float maxshieldhealth)
     210    {
     211        this->maxShieldHealth_ = maxshieldhealth;
     212    }
     213
    198214    void Pawn::setReloadRate(float reloadrate)
    199215    {
    200216        this->reloadRate_ = reloadrate;
    201         //COUT(2) << "RELOAD RATE SET TO " << this->reloadRate_ << endl;
    202217    }
    203218
     
    205220    {
    206221        this->reloadWaitTime_ = reloadwaittime;
    207         //COUT(2) << "RELOAD WAIT TIME SET TO " << this->reloadWaitTime_ << endl;
    208222    }
    209223
     
    213227    }
    214228
    215     void Pawn::setMaxShieldHealth(float maxshieldhealth)
    216     {
    217         this->maxShieldHealth_ = maxshieldhealth;
    218     }
    219 
    220     void Pawn::setShieldHealth(float shieldHealth)
    221     {
    222         this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_);
    223     }
    224 
    225 ///////////////end me
    226 
    227     void Pawn::setHealth(float health)
    228     {
    229         this->health_ = std::min(health, this->maxHealth_); //Health can't be set to a value bigger than maxHealth, otherwise it will be reduced at first hit
    230     }
    231 
    232 //////////////////me edit
     229    /* Old damage function.
     230     * For effects causing only damage not specifically to shield or health
     231     */
    233232    void Pawn::damage(float damage, Pawn* originator)
    234233    {
    235                 COUT(3) << "### alte damage-funktion ###" << endl;
    236234        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
    237235        {
     
    247245            }
    248246
    249  //           else { COUT(3) << "## SHIELD : " << this->getShieldHealth() << endl; }
    250 
    251247            this->setHealth(this->health_ - healthdamage);
    252248
     
    261257        }
    262258    }
    263 ////////////////////end edit
    264 
    265 
    266 /////////////////////me override
     259
     260    /* Does damage to the pawn, splits it up to shield and health.
     261     * Sets lastHitOriginator.
     262     */
    267263    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
    268264    {
     
    291287            // play damage effect
    292288        }
    293         //COUT(3) << "neue damage-Funktion wurde aufgerufen // " << "Shield:" << this->getShieldHealth() << endl;
    294     }
    295 
    296 /////////////end me
     289    }
    297290
    298291
    299292/* HIT-Funktionen
    300         Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden!
     293        Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte)
    301294
    302295*/
    303296
    304 
     297    /* Old hit function, calls the old damage function and changes velocity vector
     298     */
    305299    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    306300    {
     
    314308    }
    315309
    316 /////////////me override
     310    /* calls the damage function and adds the force that hit the pawn to the velocity vector
     311     */
    317312    void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
    318313    {
    319 //        COUT(3) << "neue hit-Funktion wurde aufgerufen // " << std::flush;
    320314        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    321315        {
     
    326320        }
    327321    }
    328 /////////////end me
    329 
     322
     323    /* Old hit (2) function, calls the old damage function and hits controller
     324     */
    330325    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
    331326    {
     
    341336    }
    342337
    343 /////////////me override
     338    /* Hit (2) function, calls the damage function and hits controller
     339     */
    344340    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
    345341    {
    346 //        COUT(3) << "neue hit2-Funktion wurde aufgerufen // shielddamage: " << shielddamage << std::flush;
    347342        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    348343        {
     
    350345
    351346            if ( this->getController() )
    352                 this->getController()->hit(originator, contactpoint, shielddamage);
     347                this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
    353348
    354349            // play hit effect
    355350        }
    356351    }
    357 /////////////end me
     352
    358353
    359354    void Pawn::kill()
Note: See TracChangeset for help on using the changeset viewer.