Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2007, 3:54:26 PM (17 years ago)
Author:
rennerc
Message:

Vertical playmode for SpaceShip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc

    r10661 r10662  
    6969
    7070#include "track/track.h"
     71#include "track/action_box.h"
    7172
    7273
     
    345346  LoadParam(root, "actionWidthPercentage", this, SpaceShip, setActionWidthPercentage);
    346347
    347   State::getCamera()->setViewMode(Camera::ViewTop);
     348  State::getCamera()->setViewMode(Camera::ViewNormal);
     349  State::getCameraTargetNode()->setParent(this);
     350  State::getCamera()->setParent(this);
    348351
    349352  LoadParam(root, "reactor", this, SpaceShip, setReactor);
     
    828831      break;
    829832
     833   
     834    case Playable::Vertical:
     835    {
     836        this->travelNode->setAbsCoor(this->getAbsCoor());
     837        this->travelNode->updateNode(0.01f);
     838
     839        this->isTravelDistanceInit = false;
     840
     841        if(this->entityTrack)
     842           this->travelNode->setParent(this->entityTrack->getTrackNode());
     843
     844        this->setParent(this->travelNode);
     845        this->setRelCoor(0,0,0);
     846
     847        State::getCameraNode()->setParentSoft(this->travelNode);
     848        //State::getCameraNode()->setParentSoft(this);
     849        //State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0);
     850        State::getCameraTargetNode()->setParentSoft(this->travelNode);
     851        //State::getCameraTargetNode()->setParentSoft(this);
     852        //State::getCameraTargetNode()->setRelCoorSoft(0,0,0);
     853        this->setCameraMode(Camera::ViewNormal);
     854        State::getCamera()->setEventHandling(false);
     855        registerEvent(KeyMapper::PEV_VIEW0);
     856        registerEvent(KeyMapper::PEV_VIEW1);
     857        registerEvent(KeyMapper::PEV_VIEW2);
     858        registerEvent(KeyMapper::PEV_VIEW3);
     859        registerEvent(KeyMapper::PEV_VIEW4);
     860        registerEvent(KeyMapper::PEV_VIEW5);
     861
     862        State::getCamera()->setParentMode(PNODE_ALL);
     863     
     864      break;
     865    }
     866     
    830867    default:
    831868      PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
     
    9901027    }
    9911028    case Playable::Vertical:
     1029    {
     1030      if ( !entityTrack || !entityTrack->getActionBox() )
     1031      {
     1032        break;
     1033      }
     1034      ActionBox * box = entityTrack->getActionBox();
     1035     
     1036      this->travelVelocity = Vector(0, 0, 0);
     1037      float ssss = 50;
     1038      if ( this->bForward )
     1039      {
     1040        this->travelVelocity += Vector( 0, ssss, 0 );
     1041      }
     1042      if ( this->bBackward )
     1043      {
     1044        this->travelVelocity += Vector( 0, -ssss, 0 );
     1045      }
     1046      if ( this->bLeft )
     1047      {
     1048        this->travelVelocity += Vector( 0, 0, -ssss );
     1049      }
     1050      if ( this->bRight )
     1051      {
     1052        this->travelVelocity += Vector( 0, 0, ssss );
     1053      }
     1054     
     1055      Vector ds = this->travelVelocity*dt;
     1056      Vector newPos = this->getRelCoor() + ds;
     1057      if ( newPos.y < -(box->getHeight_2()) || newPos.y > box->getHeight_2() )
     1058      {
     1059        this->travelVelocity.y = 0;
     1060      }
     1061      if ( newPos.z > box->getWidth_2() || newPos.z < -(box->getWidth_2()) )
     1062      {
     1063        this->travelVelocity.z = 0;
     1064      }
     1065    }
    9921066      break;
    9931067    default:
Note: See TracChangeset for help on using the changeset viewer.