Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10258


Ignore:
Timestamp:
Feb 5, 2015, 11:47:13 PM (10 years ago)
Author:
landauf
Message:

merged presentationHS14merge back to trunk

Location:
code/trunk
Files:
29 edited
27 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/cmake/LibraryConfig.cmake

    r9765 r10258  
    161161SET(Boost_ADDITIONAL_VERSIONS 1.40 1.40.0 1.41 1.41.0 1.42 1.42.0 1.43 1.43.0
    162162                              1.44 1.44.0 1.45 1.45.0 1.46 1.46.0 1.46.1 1.49.0
    163                               1.53.0)
     163                              1.53.0)
    164164IF(NOT TARDIS)
    165165  FIND_PACKAGE(Boost 1.40 REQUIRED thread filesystem system date_time)
  • code/trunk/data/gui/layouts/SingleplayerMenu.layout

    r9782 r10258  
    5555            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/>
    5656        </Window>
     57        <Window Type="MenuWidgets/Button" Name="orxonox/CampaignButton" >
     58            <Property Name="Text" Value="Campaign" />
     59            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     60            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.8,0},{0.6,0},{0.85,0}}" />
     61            <Event Name="Clicked" Function="SingleplayerMenu.CampaignButton_clicked"/>
     62        </Window>
    5763    </Window>
    5864</GUILayout>
  • code/trunk/data/gui/scripts/SingleplayerMenu.lua

    r9348 r10258  
    22
    33local P = createMenuSheet("SingleplayerMenu")
    4 P.loadAlong = {"ShipSelectionMenu"}
     4P.loadAlong = {"ShipSelectionMenu","CampaignMenu"}
    55P.levelList = {}
    66P.activeTabIndexes = {}
     
    2323    P.SingleplayerSelectionChanged()
    2424
    25     --buttons are arranged in a 1x3 matrix
     25    --buttons are arranged in a 2x3 matrix
    2626    P:setButton(1, 1, {
    2727            ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
     
    3737            ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
    3838            ["callback"]  = P.SingleplayerBackButton_clicked
     39    })
     40
     41    P:setButton(2, 2,{
     42            ["button"] = winMgr:getWindow("orxonox/CampaignButton"),
     43            ["callback"] = P.CampaignButton_clicked
    3944    })
    4045end
     
    166171end
    167172
     173function P.CampaignButton_clicked(e)
     174    showMenuSheet("CampaignMenu", true)
     175end
     176
    168177return P
  • code/trunk/data/levels/presentationHS13.oxw

    r9943 r10258  
    131131
    132132            <undocking>
    133                 <EventListener event="undockMe" />
     133                        <EventListener event="undockMe" />
    134134            </undocking>
    135135       
  • code/trunk/data/levels/templates/FPS.oxt

    r9348 r10258  
    2121   weapon            = "hs-w01.mesh"
    2222  >
    23     <collisionShapes>
    24       <BoxCollisionShape position="0,-20,0" halfExtents="15,25,15" />
     23    <collisionShapes>                   <!-- old values: position="0,-20,0"  halfExtents="15,25,15"  -->
     24      <BoxCollisionShape position="0,-25,0" halfExtents="15,20,15" />
    2525    </collisionShapes>
    2626
  • code/trunk/data/levels/templates/tower.oxt

    r9348 r10258  
    11<Template name=tower>
    2   <Tower
     2  <TowerDefenseTower
    33
    44
     
    2020        </WaypointPatrolController>
    2121    </controller>
     22   
    2223
    2324
    2425    <attached>
    2526        <Model position="0,0,0" scale=45 mesh="Tower.mesh" />
     27       
     28       
    2629    </attached>
    2730
     
    3336  include("../includes/towerWeaponSettings.oxi")
    3437?>
    35   </Tower>
     38  </TowerDefenseTower>
    3639</Template>
    3740
     41
     42
     43<Template name=towerturret>
     44  <TowerDefenseTower
     45
     46
     47   explosionchunks        = 6
     48
     49   reloadrate          = 10
     50   reloadwaittime      = 5
     51
     52   collisionType     = "dynamic"
     53   team = 1
     54
     55
     56  >
     57  <attached>
     58
     59    <Model position="0,0,0" scale=45 mesh="Tower.mesh" />
     60
     61    <Turret reloadrate=10 reloadwaittime=5 collisionType="dynamic" position="0,0,10" direction="0,0,1" pitch="0" yaw="0" roll="0" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=1000 minAttackRadius=30>
     62
     63      <controller>
     64        <TurretController/>
     65      </controller>
     66      <?lua
     67        include("../includes/weaponSettingsTurret.oxi")
     68      ?>
     69    </Turret>
     70   
     71  </attached>
     72   
     73
     74
     75
     76    <!--collisionShapes>
     77
     78    </collisionShapes-->
     79
     80<?lua
     81  include("../includes/towerWeaponSettings.oxi")
     82?>
     83  </TowerDefenseTower>
     84</Template>
     85
     86
     87
     88<Template name=towerturret1>
     89  <TowerDefenseTower
     90
     91
     92   explosionchunks        = 6
     93
     94   reloadrate          = 10
     95   reloadwaittime      = 5
     96
     97   collisionType     = "dynamic"
     98   team = 1
     99
     100
     101  >
     102  <attached>
     103
     104
     105    <Turret reloadrate=10 reloadwaittime=5 collisionType="dynamic" position="0,0,10" direction="0,0,1" pitch="0" yaw="0" roll="0" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=1000 minAttackRadius=30>
     106
     107      <controller>
     108        <TurretController/>
     109      </controller>
     110      <?lua
     111        include("../includes/weaponSettingsTurret1.oxi")
     112      ?>
     113    </Turret>
     114   
     115  </attached>
     116   
     117
     118
     119
     120    <!--collisionShapes>
     121
     122    </collisionShapes-->
     123
     124<?lua
     125  include("../includes/towerWeaponSettings.oxi")
     126?>
     127  </TowerDefenseTower>
     128</Template>
  • code/trunk/data/levels/towerDefense.oxw

    r9348 r10258  
    2121  include("templates/spaceshipPirate.oxt")
    2222  include("templates/tower.oxt")
     23  include("templates/enemytowerdefense.oxt")
     24  include("templates/standardTurret.oxt")
    2325?>
    2426
    2527<!-- Specify the position of the camera -->
    2628<Template name=centerpointmarkcamera defaults=0>
    27   <Pawn>
     29  <Pawn team=1>
    2830    <camerapositions>
    2931      <CameraPosition position="0,0,1500"/>
     
    3436<!-- Loads a mesh to mark the center-->
    3537<Template name=centerpointmark>
    36   <Pawn camerapositiontemplate=centerpointmarkcamera>
     38  <Pawn team=1 camerapositiontemplate=centerpointmarkcamera>
    3739    <attached>
    3840      <Model position="0,0,0" mesh="cylinder.mesh" scale3D="1,1,1" /> <!-- the camera is attached to this -->
     
    7072
    7173    <!-- Spawns the camera, attached to a crate -->
    72     <SpawnPoint team=0 position="0,0,0" spawnclass=Pawn pawndesign=centerpointmark />
     74    <SpawnPoint team=1 position="0,0,0" spawnclass=Pawn pawndesign=centerpointmark />
    7375    <!--TeamSpawnPoint team=1 position="-7,7,4" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    7476
     
    7678    <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    7779
    78     <SpaceShip position="-700,-500, 100" lookat="0,0,0" scale=3 team=1 >
    79       <templates>
    80         <Template link=spaceshipassff />
    81       </templates>
    82       <controller>
    83         <WaypointController accuracy=60>
    84           <waypoints>
    85             <!-- 1,3 10,3 10,11, 13,11 -->
    86             <Model mesh="cube.mesh" scale=0 position="-700,-500, 150" />
    87             <Model mesh="cube.mesh" scale=0 position=" 200,-500, 150" />
    88             <Model mesh="cube.mesh" scale=0 position=" 200, 300, 150" />
    89             <Model mesh="cube.mesh" scale=0 position=" 500, 300, 150" />
    90             <Model mesh="cube.mesh" scale=0 position=" 500, 700, 150" />
    91           </waypoints>
    92         </WaypointController>
    93       </controller>
    94     </SpaceShip>
     80
    9581
    9682
    9783    <!--invisible entity to attach towers to, since playfield is static and towers are dynamic-->
    98     <StaticEntity position=0,0,0>
     84    <StaticEntity team =1 position=0,0,0>
    9985
    10086        <attached>
     
    132118    direction="0,0,0"
    133119    collisionType=dynamic
    134     mass=100000>
    135 
    136     </TowerDefenseCenterpoint>
     120    mass=100000
     121    team=1
     122    />
    137123
    138124  </Scene>
  • code/trunk/data/overlays/HUDTemplates3.oxo

    r9939 r10258  
    8282     background        = "Orxonox/HealthBarBackground"
    8383     size              = "0.35, 0.0875"
    84      position          = "1.0 , 0.1 "
     84     position          = "1 ,0.1"
    8585     pickpoint         = "1, 1"
    8686     bartexture        = "healthbar_bar.png"
  • code/trunk/data/overlays/towerdefenseHUD.oxo

    r9348 r10258  
    11<Template name="TowerDefenseHUD">
     2
     3
    24  <OverlayGroup name="TowerDefenseHUD" scale = "1, 1">
     5 
     6 
    37    <OverlayText
    4      position  = "0.05, 0.05"
     8     position  = "0.83, 0.05"
    59     pickpoint = "0.0, 0.0"
    610     font      = "ShareTechMono"
     
    913     align     = "left"
    1014
    11      caption = "Hello World"
     15     caption = "Cash:"
    1216    />
     17   
     18   
     19     <TowerDefenseHUDController
     20     position  = "0.88, 0.10"
     21     pickpoint = "0.0, 0.0"
     22     font      = "ShareTechMono"
     23     textsize  = 0.05
     24     colour    = "1.0, 1.0, 1.0, 1.0"
     25     align     = "left"
     26                showlives = false
     27                showcredits = true
     28                showwaves = false
     29    />
     30   
     31        <OverlayText
     32     position  = "0.83, 0.22"
     33     pickpoint = "0.0, 0.0"
     34     font      = "ShareTechMono"
     35     textsize  = 0.05
     36     colour    = "1.0, 1.0, 1.0, 1.0"
     37     align     = "left"
     38
     39     caption = "Lifes:"
     40    />
     41   
     42         <TowerDefenseHUDController
     43     position  = "0.88, 0.27"
     44     pickpoint = "0.0, 0.0"
     45     font      = "ShareTechMono"
     46     textsize  = 0.05
     47     colour    = "1.0, 1.0, 1.0, 1.0"
     48     align     = "left"
     49                showlives = true
     50                showcredits = false
     51                showwaves = false
     52    />
     53   
     54            <OverlayText
     55     position  = "0.83, 0.39"
     56     pickpoint = "0.0, 0.0"
     57     font      = "ShareTechMono"
     58     textsize  = 0.05
     59     colour    = "1.0, 1.0, 1.0, 1.0"
     60     align     = "left"
     61
     62     caption = "Waves:"
     63    />
     64   
     65         <TowerDefenseHUDController
     66     position  = "0.88, 0.44"
     67     pickpoint = "0.0, 0.0"
     68     font      = "ShareTechMono"
     69     textsize  = 0.05
     70     colour    = "1.0, 1.0, 1.0, 1.0"
     71     align     = "left"
     72        showlives = false
     73                showcredits = false
     74                showwaves = true
     75
     76    />
     77   
     78   
    1379  </OverlayGroup>
    1480</Template>
     81
     82
  • code/trunk/src/modules/CMakeLists.txt

    r10216 r10258  
    4141ADD_SUBDIRECTORY(invader)
    4242ADD_SUBDIRECTORY(jump)
     43ADD_SUBDIRECTORY(mini4dgame)
     44ADD_SUBDIRECTORY(dodgerace)
  • code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc

    r9667 r10258  
    7373        this->position_ = Vector4(0.0, 0.0, 0.0, 0.0);
    7474        this->alignment_ = "LeftAligned";
    75         this->fontSize_ = 12;
     75        this->fontSize_ = 10;
    7676        this->fontColor_ = Vector4(1.0, 1.0, 1.0, 1.0);
    7777        this->fontColorStr_ = "FFFFFFFF";
  • code/trunk/src/modules/overlays/hud/HUDNavigation.cc

    r9939 r10258  
    8282        this->setNavMarkerSize(0.03f);
    8383        this->setAimMarkerSize(0.02f);
     84        this->setHealthMarkerSize(0.06f);
     85        this->setHealthLevelMarkerSize(0.06f);
    8486
    8587        this->setDetectionLimit(10000.0f);
     
    116118        XMLPortParam(HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
    117119        XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlelement, mode);
     120        XMLPortParam(HUDNavigation, "healthMarkerSize", setHealthMarkerSize, getHealthMarkerSize, xmlelement, mode);
     121        XMLPortParam(HUDNavigation, "healthLevelMarkerSize", setHealthLevelMarkerSize, getHealthLevelMarkerSize, xmlelement, mode);
     122
    118123    }
    119124
     
    206211        for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt)
    207212        {
     213
    208214            std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.find(listIt->first);
    209215            closeEnough = listIt->second < this->detectionLimit_;
     
    275281
    276282
     283
     284
    277285                // Transform to screen coordinates
    278286                Vector3 pos = camTransform * it->first->getRVWorldPosition();
     
    298306                    if (!it->second.wasOutOfView_)
    299307                    {
     308                        it->second.health_->hide();
     309                        it->second.healthLevel_->hide();
    300310                        it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("arrows.png", it->first->getRadarObjectColour()));
    301311                        it->second.wasOutOfView_ = true;
     
    357367                    // Object is in view
    358368
     369
     370
     371
     372                    //calculate the health of the actual selected radarViewable (relativHealthScale: while (0) is no health left, (1) is the initial health)
     373                    Pawn* pawnPtr = (Pawn*) (it->first->getWorldEntity());
     374                    float health = pawnPtr->getHealth();
     375                    float initHealth = pawnPtr->getMaxHealth();
     376                    float relativHealthScale = health/initHealth;
     377
     378                    //integer values from 0 to 10 (0 is no health and 10 is full health)
     379                    int discreteHealthScale = (int)(10*relativHealthScale);
     380
     381                    //calculate the HealthLevel (= OponentLevel or Strength) there are 5 Levels
     382                    //Level 1, Level 2,... , Level 5
     383                    int HealthLevel = 1;
     384
     385                    if(initHealth < 200)
     386                        HealthLevel = 1;
     387                    if(200 <= initHealth && initHealth < 500)
     388                        HealthLevel = 2;
     389                    if(500 <= initHealth && initHealth < 1000)
     390                        HealthLevel = 3;
     391                    if(1000 <= initHealth && initHealth < 2500)
     392                        HealthLevel = 4;
     393                    if(2500 <= initHealth)
     394                        HealthLevel = 5;
     395
     396
     397
    359398                    // Change material only if outOfView changed
    360399                    if (it->second.wasOutOfView_)
     
    364403                        it->second.panel_->setDimensions(this->navMarkerSize_ * this->getActualSize().x, this->navMarkerSize_ * this->getActualSize().y);
    365404                        it->second.target_->setDimensions(this->aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y);
     405
     406
     407                        //it->second.health_->setMaterialName(TextureGenerator::getMaterialName("bar2_1.png", it->first->getRadarObjectColour()));
     408                        it->second.health_->setMaterialName(TextureGenerator::getMaterialName("barSquare.png", it->first->getRadarObjectColour()));
     409                        it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x , 0.75f*this->healthMarkerSize_ * this->getActualSize().y);
    366410                        it->second.wasOutOfView_ = false;
    367                     }
     411
     412                        // because as soon as relative health drops below 10% (0.1) the descrete value is 0 but as long as the
     413                        // spaceship is still intact there should be at least one part of the bar left.
     414                        if(1<=discreteHealthScale){
     415                            it->second.health_->setTiling((float)discreteHealthScale , 1 ,0);
     416                            it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x *0.1f*discreteHealthScale, 0.75f*this->healthMarkerSize_ * this->getActualSize().y);
     417                        }
     418
     419
     420
     421                        //healthLevel
     422                        it->second.healthLevel_->setMaterialName(TextureGenerator::getMaterialName("barSquare.png", it->first->getRadarObjectColour()));
     423                        it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * this->getActualSize().x , 0.75f*this->healthLevelMarkerSize_ * this->getActualSize().y);
     424                        it->second.wasOutOfView_ = false;
     425                        it->second.healthLevel_->setTiling((float)HealthLevel , 1 ,0);
     426                        it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * this->getActualSize().x *0.1f*HealthLevel, 0.25f*this->healthLevelMarkerSize_ * this->getActualSize().y);
     427                    }
     428
     429
     430
     431                    // sets Position and Dimensions (amount) health
     432                    it->second.health_->setUV(0.0f, 0.0f, 1.0f, 1.0f);
     433                    it->second.health_->setLeft((pos.x + 0.975f - it->second.panel_->getWidth()) * 0.5f);
     434                    it->second.health_->setTop((-pos.y + 1.04f - it->second.panel_->getHeight()) * 0.5f);
     435
     436
     437                    // because as soon as relative health drops below 10% (0.1) the descrete value is 0 but as long as the
     438                    // spaceship is still intact there should be at least one part of the bar left.
     439                    if(1<=discreteHealthScale){
     440                    it->second.health_->setTiling((float)discreteHealthScale , 1 ,0);
     441                    it->second.health_->setDimensions(this->healthMarkerSize_ * this->getActualSize().x *0.1f*discreteHealthScale, 0.75f*this->healthMarkerSize_ * this->getActualSize().y);
     442                    }
     443
     444
     445                    //sets Position and Dimensions (level) of healthLevel
     446                    it->second.healthLevel_->setMaterialName(TextureGenerator::getMaterialName("barSquare.png", it->first->getRadarObjectColour()));
     447                    it->second.healthLevel_->setUV(0.0f, 0.0f, 1.0f, 1.0f);
     448                    it->second.healthLevel_->setLeft((pos.x + 0.975f - it->second.panel_->getWidth()) * 0.5f);
     449                    it->second.healthLevel_->setTop((-pos.y + 1.125f - it->second.panel_->getHeight()) * 0.5f);
     450
     451                    it->second.healthLevel_->setTiling((float)HealthLevel , 1 ,0);
     452                    it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * this->getActualSize().x *0.1f*HealthLevel, 0.25f*this->healthLevelMarkerSize_ * this->getActualSize().y);
     453
    368454
    369455                    // Position marker
     
    376462                    it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);
    377463
     464
     465
     466
    378467                    // Make sure the overlays are shown
     468                    it->second.health_->show();
     469                    it->second.healthLevel_->show();
    379470                    it->second.panel_->show();
    380471                    it->second.text_->show();
     
    419510
    420511            {
     512                it->second.health_->hide();
     513                it->second.healthLevel_->hide();
    421514                it->second.panel_->hide();
    422515                it->second.text_->hide();
     
    442535        for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)
    443536        {
     537            if (it->second.health_ != NULL)
     538                it->second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);
     539            if (it->second.healthLevel_ != NULL)
     540                it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale);
    444541            if (it->second.panel_ != NULL)
    445542                it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);
     
    468565
    469566        // Create everything needed to display the object on the radar and add it to the map
     567
     568        // Create health
     569        Ogre::PanelOverlayElement* health = static_cast<Ogre::PanelOverlayElement*>( Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDNavigation_healthMarker_" + getUniqueNumberString()));
     570        //panel->setMaterialName("Orxonox/NavTDC");
     571        health->setMaterialName(TextureGenerator::getMaterialName("barSquare.png", object->getRadarObjectColour()));
     572        health->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);
     573        //panel->setColour(object->getRadarObjectColour());
     574
     575        // Create healthLevel
     576        Ogre::PanelOverlayElement* healthLevel = static_cast<Ogre::PanelOverlayElement*>( Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "HUDNavigation_healthLevelMarker_" + getUniqueNumberString()));
     577        //panel->setMaterialName("Orxonox/NavTDC");
     578        health->setMaterialName(TextureGenerator::getMaterialName("barSquare.png", object->getRadarObjectColour()));
     579        health->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale);
     580
    470581
    471582        // Create arrow/marker
     
    490601        text->setColour(object->getRadarObjectColour());
    491602
     603        health->hide();
     604        healthLevel->hide();
    492605        panel->hide();
    493606        target->hide();
     
    495608
    496609        ObjectInfo tempStruct =
    497         {   panel, target, text, false, false, false};
     610        {   health, healthLevel, panel, target, text, false, false, false};
    498611        this->activeObjectList_[object] = tempStruct;
    499612
     613        this->background_->addChild(health);
     614        this->background_->addChild(healthLevel);
    500615        this->background_->addChild(panel);
    501616        this->background_->addChild(target);
     
    512627        {
    513628            // Detach overlays
     629            this->background_->removeChild(it->second.health_->getName());
     630            this->background_->removeChild(it->second.healthLevel_->getName());
    514631            this->background_->removeChild(it->second.panel_->getName());
    515632            this->background_->removeChild(it->second.target_->getName());
    516633            this->background_->removeChild(it->second.text_->getName());
    517634            // Properly destroy the overlay elements (do not use delete!)
     635            Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.health_);
     636            Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.healthLevel_);
    518637            Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.panel_);
    519638            Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.target_);
  • code/trunk/src/modules/overlays/hud/HUDNavigation.h

    r9667 r10258  
    7777            struct ObjectInfo
    7878            {
     79
     80
     81
     82                Ogre::PanelOverlayElement* health_;
     83                Ogre::PanelOverlayElement* healthLevel_;
    7984                Ogre::PanelOverlayElement* panel_;
    8085                Ogre::PanelOverlayElement* target_;
     
    8893
    8994            // XMLPort accessors
     95            inline void setHealthMarkerSize(float size)
     96                        {
     97                            this->healthMarkerSize_ = size;
     98                            this->sizeChanged();
     99                        }
     100            inline float getHealthMarkerSize() const
     101                            { return healthMarkerSize_; }
     102
     103            inline void setHealthLevelMarkerSize(float size)
     104                                    {
     105                                        this->healthLevelMarkerSize_ = size;
     106                                        this->sizeChanged();
     107                                    }
     108                        inline float getHealthLevelMarkerSize() const
     109                                        { return healthLevelMarkerSize_; }
     110
    90111            inline void setNavMarkerSize(float size)
    91112            {
     
    100121                this->sizeChanged();
    101122            }
     123
    102124            inline float getAimMarkerSize() const
    103125                { return aimMarkerSize_; }
     
    121143            std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_;
    122144
     145            float healthMarkerSize_;
     146            float healthLevelMarkerSize_;
    123147            float navMarkerSize_;
    124148            float aimMarkerSize_;
  • code/trunk/src/modules/towerdefense/CMakeLists.txt

    r9958 r10258  
    11SET_SOURCE_FILES(TOWERDEFENSE_SRC_FILES
    22  TowerDefense.cc
    3   Tower.cc
     3  TowerDefenseTower.cc
     4  TowerTurret.cc
    45  TowerDefenseCenterpoint.cc
    56  TowerDefenseHUDController.cc
    67  TowerDefensePlayerStats.cc
     8  TDCoordinate.cc
     9  TowerDefenseEnemy.cc
    710
    811)
  • code/trunk/src/modules/towerdefense/TDEnemy.h

    r9272 r10258  
    55 *      Author: weigeltm
    66 */
    7 
     7/*
    88#ifndef TDENEMY_H_
    99#define TDENEMY_H_
     
    2424
    2525
    26 #endif /* TDENEMY_H_ */
     26#endif TDENEMY_H_ */
  • code/trunk/src/modules/towerdefense/Tower.cc

    r9667 r10258  
    4040    {
    4141        static int ori;
    42         orxout() << "orientation " << ++ori << endl;
     42        //orxout() << "orientation " << ++ori << endl;
    4343    }
    4444
     
    4646    {
    4747        static int yaw;
    48         orxout() << "rotateYaw " << ++yaw << endl;
     48        //orxout() << "rotateYaw " << ++yaw << endl;
    4949    }
    5050
     
    5252    {
    5353        static int pitch;
    54         orxout() << "rotatePitch " << ++pitch << endl;
     54        //orxout() << "rotatePitch " << ++pitch << endl;
    5555    }
    5656
     
    5858    {
    5959        static int roll;
    60         orxout() << "rotateRoll" << ++roll << endl;
     60        //orxout() << "rotateRoll" << ++roll << endl;
    6161    }
    6262
  • code/trunk/src/modules/towerdefense/TowerDefense.cc

    r9667 r10258  
    2020 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    2121 *
    22  *   Author:
     22 *  Author:
    2323 *
    2424 *   Co-authors:
     
    7373 *
    7474 */
    75 
    7675#include "TowerDefense.h"
    77 #include "Tower.h"
     76#include "TowerDefenseTower.h"
    7877#include "TowerDefenseCenterpoint.h"
    79 
     78//#include "TDCoordinate.h"
     79#include "TowerTurret.h"
    8080#include "worldentities/SpawnPoint.h"
    8181#include "worldentities/pawns/Pawn.h"
    8282#include "worldentities/pawns/SpaceShip.h"
    8383#include "controllers/WaypointController.h"
    84 
    8584#include "graphics/Model.h"
    8685#include "infos/PlayerInfo.h"
    87 
    8886#include "chat/ChatManager.h"
    8987#include "core/CoreIncludes.h"
    90 
    9188/* Part of a temporary hack to allow the player to add towers */
    9289#include "core/command/ConsoleCommand.h"
     
    9996    {
    10097        RegisterObject(TowerDefense);
     98/*
     99        for (int i=0; i < 16 ; i++){
     100            for (int j = 0; j< 16 ; j++){
     101                towermatrix[i][j] = NULL;
     102            }
     103        }*/
    101104
    102105        this->setHUDTemplate("TowerDefenseHUD");
    103106
    104         this->stats_ = new TowerDefensePlayerStats();
    105 
    106         /* Temporary hack to allow the player to add towers */
     107        //this->stats_ = new TowerDefensePlayerStats();
     108
     109        /* Temporary hack to allow the player to add towers and upgrade them */
    107110        this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
     111        this->dedicatedUpgradeTower_ = createConsoleCommand( "upgradeTower", createExecutor( createFunctor(&TowerDefense::upgradeTower, this) ) );
    108112    }
    109113
     
    127131    void TowerDefense::start()
    128132    {
     133
    129134        Deathmatch::start();
    130135
    131         const int kInitialTowerCount = 3;
    132         Coordinate initialTowerCoordinates[kInitialTowerCount] = {{3,2}, {8,5}, {12,10}};
    133 
    134         for (int i = 0; i < kInitialTowerCount; i++)
    135         {
    136             Coordinate coordinate = initialTowerCoordinates[i];
    137             addTower(coordinate.x, coordinate.y);
    138         }
    139 
    140         ChatManager::message("Use the console command addTower x y to add towers");
    141 
    142         //TODO: let the player control his controllable entity && TODO: create a new ControllableEntity for the player
    143     }
     136// Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path
     137        for (int i=0; i < 16 ; i++){
     138            for (int j = 0; j< 16 ; j++){
     139                towermatrix[i][j] = false;
     140            }
     141        }
     142
     143        for (int k=0; k<3; k++)
     144            towermatrix[1][k]=true;
     145        for (int l=1; l<11; l++)
     146            towermatrix[l][3]=true;
     147        for (int m=3; m<12; m++)
     148            towermatrix[10][m]=true;
     149        for (int n=10; n<14; n++)
     150            towermatrix[n][11]=true;
     151        for (int o=13; o<16; o++)
     152            towermatrix[13][o]=true;
     153
     154        //set initial credits, lifes and WaveNumber
     155        this->setCredit(200);
     156        this->setLifes(50);
     157        this->setWaveNumber(0);
     158        time=0.0;
     159
     160        //adds initial towers
     161        for (int i=0; i <7; i++){
     162            addTower(i+3,4);
     163        }/*
     164        for (int j=0; j < 7; j++){
     165            addTower(9,j+5);
     166        }*/
     167    }
     168
     169    // Generates a TowerDefenseEnemy. Uses Template "enemytowerdefense". Sets position at first waypoint of path.
     170    void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr){
     171
     172
     173        TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext());
     174       
     175        switch(templatenr)
     176        {
     177        case 1 :
     178            en1->addTemplate("enemytowerdefense1");
     179            en1->setScale(3);
     180            en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
     181            break;
     182
     183        case 2 :
     184            en1->addTemplate("enemytowerdefense2");
     185            en1->setScale(2);
     186            en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
     187            //  en1->setShieldHealth(en1->getShield() = this->getWaveNumber()*2))
     188            break;
     189
     190        case 3 :
     191            en1->addTemplate("enemytowerdefense3");
     192            en1->setScale(1);
     193            en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
     194            break;
     195        }
     196
     197        en1->getController();
     198        en1->setPosition(path.at(0)->get3dcoordinate());
     199        TowerDefenseEnemyvector.push_back(en1);
     200
     201        for(unsigned int i = 0; i < path.size(); ++i)
     202        {
     203            en1->addWaypoint((path.at(i)));
     204        }
     205    }
     206
    144207
    145208    void TowerDefense::end()
    146209    {
     210
    147211        Deathmatch::end();
    148 
    149         ChatManager::message("Match is over");
    150     }
    151 
     212        ChatManager::message("Match is over! Gameover!");
     213
     214    }
     215
     216    //not working yet
     217    void TowerDefense::upgradeTower(int x,int y)
     218    {/*
     219        const int upgradeCost = 20;
     220
     221        if (!this->hasEnoughCreditForTower(upgradeCost))
     222        {
     223            orxout() << "not enough credit: " << (this->getCredit()) << " available, " << upgradeCost << " needed.";
     224            return;
     225        }
     226
     227        if (towermatrix [x][y] == NULL)
     228        {
     229            orxout() << "no tower on this position" << endl;
     230            return;
     231        }
     232
     233        else
     234        {
     235            (towermatrix [x][y])->upgradeTower();
     236        }*/
     237    }
     238
     239    /*adds Tower at Position (x,y) and reduces credit and adds the point to the towermatrix. template ("towerturret")
     240    so towers have ability if the turrets
     241
     242    */
    152243    void TowerDefense::addTower(int x, int y)
    153244    {
    154         const TowerCost towerCost = TDDefaultTowerCost;
     245        const int towerCost = 20;
    155246
    156247        if (!this->hasEnoughCreditForTower(towerCost))
    157248        {
    158             orxout() << "not enough credit: " << (this->stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed.";
     249            orxout() << "not enough credit: " << (this->getCredit()) << " available, " << towerCost << " needed.";
    159250            return;
    160251        }
    161252
    162         if (this->towerExists(x,y))
    163         {
    164             orxout() << "tower exists!!" << endl;
     253        if (towermatrix [x][y]==true)
     254        {
     255            orxout() << "not possible to put tower here!!" << endl;
    165256            return;
    166257        }
    167258
    168         /*
     259/*
    169260        unsigned int width = this->center_->getWidth();
    170261        unsigned int height = this->center_->getHeight();
    171         */
     262*/
    172263
    173264        int tileScale = (int) this->center_->getTileScale();
     
    182273        orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
    183274
    184         // Add tower to coordinatesStack
    185         Coordinate newTowerCoordinates = {x, y};
    186         addedTowersCoordinates_.push_back(newTowerCoordinates);
    187 
    188         // Reduce credit
    189         this->stats_->buyTower(towerCost);
    190 
    191         // Create tower
    192         Tower* newTower = new Tower(this->center_->getContext());
    193         newTower->addTemplate(this->center_->getTowerTemplate());
    194 
    195         newTower->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
    196         newTower->setGame(this);
    197     }
    198 
    199     bool TowerDefense::hasEnoughCreditForTower(TowerCost towerCost)
    200     {
    201         return ((this->stats_->getCredit()) >= towerCost);
    202     }
    203 
    204     bool TowerDefense::towerExists(int x, int y)
    205     {
    206         for(std::vector<Coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it)
    207         {
    208             Coordinate currentCoordinates = (Coordinate) (*it);
    209             if (currentCoordinates.x == x && currentCoordinates.y == y)
    210                 return true;
    211         }
    212 
    213         return false;
    214     }
    215 
    216 
     275       //Reduce credit
     276        this->buyTower(towerCost);
     277        towermatrix [x][y]=true;
     278
     279        //Creates tower
     280        TowerDefenseTower* towernew = new TowerDefenseTower(this->center_->getContext());
     281        towernew->addTemplate("towerturret");
     282        towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
     283        towernew->setGame(this);
     284    }
     285
     286    bool TowerDefense::hasEnoughCreditForTower(int towerCost)
     287    {
     288        return ((this->getCredit()) >= towerCost);
     289    }
     290
     291
     292    bool TowerDefense::hasEnoughCreditForUpgrade()
     293    {
     294        return true;
     295    }
     296
     297 
    217298    void TowerDefense::tick(float dt)
    218299    {
    219300        SUPER(TowerDefense, tick, dt);
     301        time +=dt;
     302
     303        TDCoordinate* coord1 = new TDCoordinate(1,1);
     304        std::vector<TDCoordinate*> path;
     305        path.push_back(coord1);
     306        if(time>1 && TowerDefenseEnemyvector.size() < 30)
     307        {
     308            //adds different types of enemys depending on the WaveNumber
     309            addTowerDefenseEnemy(path, this->getWaveNumber() % 3 +1 );
     310            time = time-1;
     311        }
     312
     313        Vector3* endpoint = new Vector3(500, 700, 150);
     314        //if ships are at the end they get destroyed
     315        for(unsigned int i =0; i < TowerDefenseEnemyvector.size(); ++i)
     316        {
     317            if(TowerDefenseEnemyvector.at(i) != NULL && TowerDefenseEnemyvector.at(i)->isAlive())
     318            {
     319                //destroys enemys at the end of teh path and reduces the life by 1. no credits gifted
     320
     321                Vector3 ship = TowerDefenseEnemyvector.at(i)->getRVWorldPosition();
     322                float distance = ship.distance(*endpoint);
     323
     324                if(distance <50){
     325                    TowerDefenseEnemyvector.at(i)->destroy();
     326                    this->reduceLifes(1);
     327                    this->buyTower(1);
     328                    if (this->getLifes()==0)
     329                    {
     330                        this->end();
     331                    }
     332                }
     333            }
     334        }
     335        //goes thorugh vector to see if an enemy is still alive. if not next wave is launched
     336        int count= 0;
     337        for(unsigned int i =0; i < TowerDefenseEnemyvector.size(); ++i)
     338        {
     339            if(TowerDefenseEnemyvector.at(i)!= NULL)
     340            {
     341                ++count;
     342            }
     343        }
     344
     345        if(count== 0)
     346        {
     347            time2 +=dt;
     348            if(time2 > 10)
     349            {
     350                TowerDefenseEnemyvector.clear();
     351                this->nextwave();
     352                time=0;
     353                time2=0;
     354            }
     355        }
     356
     357
    220358    }
    221359
  • code/trunk/src/modules/towerdefense/TowerDefense.h

    r9667 r10258  
    3737#ifndef _TowerDefense_H__
    3838#define _TowerDefense_H__
    39 
     39#include "TDCoordinate.h"
    4040#include "towerdefense/TowerDefensePrereqs.h"
    4141#include "gametypes/Deathmatch.h"
    42 
    43  #include "TowerDefensePlayerStats.h"
     42#include "TowerDefenseEnemy.h"
     43#include "util/Output.h"
     44#include "core/object/WeakPtr.h"
    4445
    4546namespace orxonox
     
    5152        virtual ~TowerDefense();
    5253
     54        std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector;
     55        bool towermatrix[16][16];
     56        void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr);
    5357        virtual void start(); //<! The function is called when the gametype starts
    5458        virtual void end();
     
    5660        //virtual void playerEntered(PlayerInfo* player);
    5761        //virtual bool playerLeft(PlayerInfo* player);
     62        //Player Stats (set,get, reduce)
     63        int getCredit(){ return this->credit_; }
     64        int getLifes(){ return this->lifes_; }
     65        int getWaveNumber(){ return this->waves_; }
     66        void setCredit(int credit){ credit_ = credit; }
     67        void setLifes(int lifes){ lifes_ = lifes; }
     68        void setWaveNumber(int wavenumber){ waves_=wavenumber; }
     69        void buyTower(int cost){ credit_ -= cost;}
     70        void addCredit(int credit) { credit_+=credit; }
     71        void nextwave(){ waves_++;}
     72        int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; }
    5873
    5974        //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
     
    6984        void addTower(int x, int y);
    7085
     86        void upgradeTower(int x, int y);
    7187        /* Part of a temporary hack to allow the player to add towers */
    7288        ConsoleCommand* dedicatedAddTower_;
     89        ConsoleCommand* dedicatedUpgradeTower_;
    7390
    7491        //TODO: void spawnNewWave()
     
    7996    private:
    8097        TowerDefenseCenterpoint *center_;
     98        float time;
     99        float time2;
     100        int credit_;
     101        int waves_;
     102        int lifes_;
    81103
    82104        /* handles stats */
    83         TowerDefensePlayerStats *stats_;
    84         bool hasEnoughCreditForTower(TowerCost towerCost);
     105        bool hasEnoughCreditForTower(int towerCost);
     106        bool hasEnoughCreditForUpgrade();
    85107
    86         bool towerExists(int x, int y);
    87108
    88         typedef struct {
    89             int x;
    90             int y;
    91         } Coordinate;
    92109
    93         std::vector<Coordinate> addedTowersCoordinates_;
    94         std::vector<Tower*> towers_;
     110        std::vector<TowerTurret*> towers_;
    95111    };
    96112}
  • code/trunk/src/modules/towerdefense/TowerDefenseController.cc

    r9667 r10258  
    3333#include "core/XMLPort.h"
    3434#include "worldentities/pawns/Pawn.h"
     35#include "controllers/WaypointController.h"
    3536
    3637namespace orxonox
     
    5354        XMLPortParam(TowerDefenseController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f);
    5455    }
     56
    5557
    5658    void TowerDefenseController::tick(float dt)
  • code/trunk/src/modules/towerdefense/TowerDefenseHUDController.cc

    r9667 r10258  
    3232#include "util/Convert.h"
    3333
    34 
    3534namespace orxonox
    3635{
     
    4039    {
    4140        RegisterObject(TowerDefenseHUDController);
     41        this->td = 0;
    4242    }
    4343
     
    5050    {
    5151        SUPER(TowerDefenseHUDController, tick, dt);
     52        const std::string& lifes = multi_cast<std::string>(this->td->getLifes());
     53        const std::string& credits = multi_cast<std::string>(this->td->getCredit());
     54        const std::string& wave = multi_cast<std::string>(this->td->getWaveNumber());
     55
     56        if(showlives == true)
     57          this->setCaption(multi_cast<std::string>(lifes));
     58        else if(showcredits == true)
     59          this->setCaption(multi_cast<std::string>(credits));
     60        else if(showwaves == true)
     61          this->setCaption(multi_cast<std::string>(wave));
     62
     63
    5264    }
    5365
     
    5567    {
    5668        SUPER(TowerDefenseHUDController, XMLPort, xmlelement, mode);
     69
     70        XMLPortParam(TowerDefenseHUDController, "showlives", setShowlives, getShowlives, xmlelement, mode);
     71        XMLPortParam(TowerDefenseHUDController, "showcredits", setShowcredits, getShowcredits, xmlelement, mode);
     72        XMLPortParam(TowerDefenseHUDController, "showwaves", setShowwaves, getShowwaves, xmlelement, mode);
     73
    5774    }
    5875
    5976    void TowerDefenseHUDController::changedOwner()
    60     {
    61         SUPER(TowerDefenseHUDController, changedOwner);
    62         /*
    63         if (this->getOwner() != NULL && this->getOwner()->getGametype())
    64             this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get());
    65         else
    66             this->owner_ = 0;
    67         */
    68     }
     77        {
     78            SUPER(TowerDefenseHUDController, changedOwner);
    6979
    70 }
     80            if (this->getOwner() && this->getOwner()->getGametype())
     81                    {
     82                        this->td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get());
     83                    }
     84                    else
     85                    {
     86                        this->td = 0;
     87                    }
     88                }
     89        }
     90
  • code/trunk/src/modules/towerdefense/TowerDefenseHUDController.h

    r9667 r10258  
    3939
    4040#include "towerdefense/TowerDefensePrereqs.h"
    41 
     41#include "TowerDefensePlayerStats.h"
    4242#include "tools/interfaces/Tickable.h"
    4343#include "overlays/OverlayText.h"
    44 
     44#include "TowerDefense.h"
    4545
    4646namespace orxonox
     
    5252        virtual ~TowerDefenseHUDController();
    5353
     54
    5455        virtual void tick(float dt);
    5556        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5657        virtual void changedOwner();
     58        void setShowlives(bool temp)
     59            { this->showlives = temp; }
     60        unsigned int getShowlives(void) const
     61            { return this->showlives; }
     62
     63        void setShowcredits(bool temp)
     64            { this->showcredits = temp; }
     65        unsigned int getShowcredits(void) const
     66            { return this->showcredits; }
     67
     68        void setShowwaves(bool temp)
     69            { this->showwaves = temp; }
     70        unsigned int getShowwaves(void) const
     71            { return this->showwaves; }
     72
     73    private:
     74        TowerDefense* td;
     75        bool showcredits;
     76        bool showlives;
     77        bool showwaves;
    5778    };
    5879}
  • code/trunk/src/modules/towerdefense/TowerDefensePlayerStats.cc

    r9272 r10258  
    2525 *      ...
    2626 */
    27 
     27/*
    2828#include "TowerDefensePlayerStats.h"
    2929
     
    3131{
    3232    const int kDefaultCredit = 200;
    33 
     33    const int kDefaultLifes=20;
    3434    TowerDefensePlayerStats::TowerDefensePlayerStats()
    3535    {
    3636        this->credit_ = kDefaultCredit;
    3737        this->waveNumber_ = 0;
     38        this->lifes_=kDefaultLifes;
    3839    }
    39     /*
     40
    4041    TowerDefensePlayerStats::~TowerDefensePlayerStats()
    4142    {
    4243    }
    43     */
     44
    4445}
     46*/
  • code/trunk/src/modules/towerdefense/TowerDefensePlayerStats.h

    r9272 r10258  
    2727 */
    2828
    29  /**
     29 /*
    3030    @brief
    3131        This manages the stats of the player. It is used by 'TowerDefense', the gametype
    3232
    3333    @ingroup TowerDefense
    34  */
     34
    3535
    3636
     
    4444    typedef enum _TowerCosts {
    4545        // Set to 0 for debug...
    46         TDDefaultTowerCost = 0
     46        TDDefaultTowerCost = 20 ,
     47        TDDefaultUpgradeCost = 15
    4748    } TowerCost;
    4849
     
    6768            { waveNumber_++; }
    6869
     70        inline int getLifes()
     71            {return lifes_; }
     72
     73        inline void reduceLifes(int NumberofLifes)
     74        {lifes_-=NumberofLifes; }
     75
     76        inline void upgradeTower(int upgradecost)
     77            { credit_ -= upgradecost;}
     78
     79
     80
    6981    private:
    7082        int credit_;
    7183        int waveNumber_;
     84        int upgradecost;
     85        int lifes_;
    7286        //int baseHealth_;
    7387    };
    7488}
    7589
    76 #endif /* _TowerDefensePlayerStats_H__ */
     90#endif _TowerDefensePlayerStats_H__ */
  • code/trunk/src/modules/towerdefense/TowerDefensePrereqs.h

    r9272 r10258  
    6666{
    6767    class TowerDefense;
    68     class Tower;
     68
     69    class TowerDefenseTower;
     70
    6971    class TowerDefenseCenterpoint;
    7072    class TowerDefenseHUDController;
    7173    class TowerDefensePlayerStats;
     74    class TowerDefenseEnemy;
     75    class TDCoordinate;
     76    class TowerTurret;
     77    class TowerDefenseTower;
    7278}
    7379
  • code/trunk/src/modules/weapons/RocketController.cc

    r9667 r10258  
    4141namespace orxonox
    4242{
     43    RegisterClass(RocketController);
     44
    4345    /**
    4446    @brief
     
    9799        if (distance > 1000 && this->rocket_->getVelocity().squaredLength()<160000)
    98100            this->rocket_->setAcceleration(this->rocket_->getOrientation()*Vector3(-20,-20,-20));
    99         if (distance <1000) this->rocket_->setAcceleration(0,0,0);
     101        if (distance < 1000) this->rocket_->setAcceleration(0,0,0);
    100102
    101103        this->rocket_->rotateYaw(-sgn(coord.x)*coord.x*coord.x);
  • code/trunk/src/orxonox/LevelManager.cc

    r9667 r10258  
    8989        SetConfigValue(defaultLevelName_, "missionOne.oxw")
    9090            .description("Sets the pre selection of the level in the main menu.");
     91        SetConfigValue(lastFinishedCampaignMission_,  "")
     92            .description("The last finished mission of a campaign");
     93        SetConfigValue(campaignMissions_,  std::vector<std::string>())
     94            .description("The list of missions in the campaign");
     95    }
     96
     97    /**
     98     * @brief Stores the argument in the corresponding config value.
     99     */
     100    void LevelManager::setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission)
     101    {
     102        ModifyConfigValue(lastFinishedCampaignMission_, set, lastFinishedCampaignMission);
    91103    }
    92104
  • code/trunk/src/orxonox/LevelManager.h

    r9667 r10258  
    9191            LevelInfoItem* getAvailableLevelListItem(unsigned int index); //!< Get the LevelInfoItem at the given index in the list of available Levels.
    9292
     93            void setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission);
     94            inline const std::string& getLastFinishedCampaignMission() const
     95                { return this->lastFinishedCampaignMission_; }
     96
     97            inline unsigned int getNumberOfCampaignMissions()
     98                { return this->campaignMissions_.size(); }
     99            inline const std::string& getCampaignMission(unsigned int index)
     100                { return this->campaignMissions_[index]; }
     101
    93102            /**
    94103            @brief Get the instance of the LevelManager.
     
    116125            // config values
    117126            std::string defaultLevelName_;
     127            std::string lastFinishedCampaignMission_;
     128            std::vector<std::string> campaignMissions_;
    118129
    119130            static LevelManager* singletonPtr_s;
  • code/trunk/src/orxonox/gametypes/Mission.cc

    r9986 r10258  
    2828
    2929#include "Mission.h"
     30
    3031#include "items/Engine.h"
    3132#include "controllers/ArtificialController.h"
     
    3637#include "network/Host.h"
    3738#include "worldentities/pawns/Pawn.h"
    38 
     39#include "LevelManager.h"
    3940
    4041namespace orxonox
     
    7071    void Mission::pawnKilled(Pawn* victim, Pawn* killer)
    7172    {
    72         if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer() )
     73        if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer())
    7374        {
    7475            this->lives_--;
     
    8788    {
    8889        if (this->missionAccomplished_ && !this->gtinfo_->hasEnded())
     90        {
    8991            this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
     92
     93            LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());
     94        }
    9095        else if (!this->gtinfo_->hasEnded())
    9196            this->gtinfo_->sendAnnounceMessage("Mission failed!");
     97
    9298        Gametype::end();
    9399    }
    94100
    95101    void Mission::setTeams()
    96     {//Set pawn-colours
     102    { //Set pawn-colours
    97103        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
    98104        {
    99105            Pawn* pawn = static_cast<Pawn*>(*it);
    100             if(!pawn) continue;
    101                 this->setDefaultObjectColour(pawn);
     106            if (!pawn)
     107                continue;
     108            this->setDefaultObjectColour(pawn);
    102109        }
    103110    }
     
    105112    {
    106113        for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
    107         {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
     114        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
    108115            it->setMissionAccomplished(accomplished);
    109116            it->end();
    110117        }
    111118    }
    112    
     119
    113120    void Mission::setLivesWrapper(unsigned int amount)
    114121    {
    115122        for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
    116         {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
     123        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
    117124            it->setLives(amount);
    118125        }
    119126    }
    120 
    121 
    122127}
Note: See TracChangeset for help on using the changeset viewer.