Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 22, 2011, 3:05:26 PM (13 years ago)
Author:
dafrick
Message:

Cleaning up game immersion. Roughly documenting weapons module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r8706 r8855  
    2121 *
    2222 *   Author:
     23 *      Gabriel Nadler
     24 *   Co-authors:
    2325 *      Oliver Scheuss
    24  *   Co-authors:
    2526 *      simonmie
    2627 *
    2728 */
    2829
     30/**
     31    @file BasicProjectile.h
     32    @brief Implementation of the BasicProjectile class.
     33*/
     34
    2935#include "SimpleRocketFire.h"
    3036
     37#include "core/CoreIncludes.h"
    3138#include "util/Math.h"
    32 #include "core/CoreIncludes.h"
    33 #include "weapons/RocketController.h"
    3439
    3540#include "weaponsystem/Weapon.h"
     
    3843#include "worldentities/pawns/Pawn.h"
    3944#include "sound/WorldSound.h"
     45
     46#include "weapons/RocketController.h"
     47#include "weapons/projectiles/SimpleRocket.h"
    4048
    4149namespace orxonox
     
    4856        RegisterObject(SimpleRocketFire);
    4957
    50         this->reloadTime_ = 1;
     58        this->reloadTime_ = 1.0f;
    5159        this->bParallelReload_ = false;
    52         this->damage_ = 0;
    53         this->speed_ = 500;
     60        this->damage_ = 0.0f;
     61        this->speed_ = 500.0f;
    5462
    5563        this->setMunitionName("RocketMunition");
     
    6270    }
    6371
    64     /* Creates the Rocket (RocketController) object, sets its properties to the SimpleRocketFire properties, sets target
    65      */
     72    /**
     73    @brief
     74        Fires the weapon. Creates the SimpleRocket and a RocketController to steer it and fires it.
     75    */
    6676    void SimpleRocketFire::fire()
    6777    {
    68         RocketController* con = new RocketController(this);
    69         SimpleRocket* rocket = con->getRocket();
     78        RocketController* controller = new RocketController(this);
     79        SimpleRocket* rocket = controller->getRocket();
    7080        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    7181        rocket->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getWorldOrientation());
    7282        rocket->setPosition(this->getMuzzlePosition());
    7383        rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
    74         rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
     84        rocket->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7585
    7686        rocket->setDamage(this->damage_);
     
    7888        rocket->setHealthDamage(this->getHealthDamage());
    7989
    80         WorldEntity* pawnn=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
    81         if (pawnn) con->setTarget(pawnn);
     90        WorldEntity* pawn = static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
     91        if (pawn) controller->setTarget(pawn);
    8292    }
    8393}
Note: See TracChangeset for help on using the changeset viewer.