~ubuntu-branches/ubuntu/precise/supertuxkart/precise

« back to all changes in this revision

Viewing changes to src/moveable.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Gonéri Le Bouder, Gonéri Le Bouder, Eddy Petrişor
  • Date: 2006-09-08 22:59:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060908225925-3spug0pnh9ekwlpw
Tags: 0.2-1
[ Gonéri Le Bouder ]
* new upstream release candidate
 + Closes: #388021
 + remove supertuxkart.sh
 + add supertuxkart(|-data).install
 + clean up
 + remove deps on ${shlibs:Depends}, ${misc:Depends} for supertuxkart-data
* fix French comment was tagged de_DE
* fix not-binnmuable-any-depends-all
* fix FTBFS on 64bit arch
 + Closes: #370810

[ Eddy Petrişor ]
* added Romanian translation to desktop file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  $Id: moveable.hpp 702 2006-08-31 03:17:18Z hiker $
 
2
//
 
3
//  SuperTuxKart - a fun racing game with go-kart
 
4
//  Copyright (C) 2004-2005 Steve Baker <sjbaker1@airmail.net>
 
5
//  Copyright (C) 2006 Joerg Henrichs, Steve Baker
 
6
//
 
7
//  This program is free software; you can redistribute it and/or
 
8
//  modify it under the terms of the GNU General Public License
 
9
//  as published by the Free Software Foundation; either version 2
 
10
//  of the License, or (at your option) any later version.
 
11
//
 
12
//  This program is distributed in the hope that it will be useful,
 
13
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
//  GNU General Public License for more details.
 
16
//
 
17
//  You should have received a copy of the GNU General Public License
 
18
//  along with this program; if not, write to the Free Software
 
19
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
20
 
 
21
#ifndef HEADER_MOVEABLE_H
 
22
#define HEADER_MOVEABLE_H
 
23
 
 
24
#include <plib/ssg.h>
 
25
#include "material.hpp"
 
26
 
 
27
/* Limits of Kart performance */
 
28
#define CRASH_PITCH          -45.0f
 
29
 
 
30
#define MAX_NATURAL_VELOCITY    ( 60.0f * KILOMETERS_PER_HOUR )
 
31
#define MIN_CRASH_VELOCITY   (MAX_NATURAL_VELOCITY * 0.2f)
 
32
#define MIN_COLLIDE_VELOCITY (MAX_NATURAL_VELOCITY * 0.1f)
 
33
#define COLLIDE_BRAKING_RATE (MAX_NATURAL_VELOCITY * 1.0f)
 
34
 
 
35
#define MAX_HERRING_EATEN    20
 
36
 
 
37
 
 
38
class Moveable {
 
39
protected:
 
40
  sgCoord       reset_pos;      /* Where to start in case of a reset           */
 
41
  sgCoord       curr_pos;       /* current position                            */
 
42
  sgCoord       velocity;       /* current velocity in local coordinates       */
 
43
  sgVec3        abs_velocity;   /* world coordinates' velocity vector          */
 
44
  sgVec4*       normalHOT;      /* plane on which HOT was computed             */
 
45
  Material*     materialHOT;    /* Material at HOT                             */
 
46
  ssgTransform* model;
 
47
  ssgTransform* shadow;
 
48
  int           collided;
 
49
  int           crashed;
 
50
  sgVec3        surface_avoidance_vector ;
 
51
  int           firsttime ;
 
52
  float         wheelie_angle ;
 
53
  int           on_ground ; 
 
54
 
 
55
  float collectIsectData ( sgVec3 start, sgVec3 end ) ;
 
56
  sgCoord*      historyVelocity;
 
57
  sgCoord*      historyPosition;
 
58
 
 
59
public:
 
60
  
 
61
  /* start - New Physics */
 
62
  
 
63
 
 
64
  Moveable (bool bHasHistory=false);
 
65
  virtual ~Moveable();
 
66
 
 
67
  void          setReset     (sgCoord* pos)  {sgCopyCoord( &reset_pos, pos ); }
 
68
  ssgTransform* getModel     ()              {return model ;                  }
 
69
  int           isOnGround   ()              {return on_ground;               }
 
70
  sgCoord*      getVelocity  ()              {return & velocity;              }
 
71
  sgCoord*      getCoord     ()              {return &curr_pos;               }
 
72
  void          setCoord     (sgCoord* pos)  {sgCopyCoord ( &curr_pos,pos);   }
 
73
  virtual void  placeModel   ()              {model->setTransform(&curr_pos); }
 
74
  virtual void  handleZipper ()              {};
 
75
  virtual void  reset        ();
 
76
  virtual void  update       (float dt) ;
 
77
  virtual void  updatePosition(float dt, sgMat4 result);
 
78
  virtual void  doCollisionAnalysis(float dt, float hot);
 
79
 
 
80
  // Gets called when no high of terrain can be determined (isReset=0), or 
 
81
  // there is a 'reset' material under the moveable --> karts need to be 
 
82
  // rescued, missiles should explode.
 
83
  virtual void  OutsideTrack (int isReset) {}
 
84
 
 
85
  float         getIsectData (sgVec3 start, sgVec3 end );
 
86
  void          WriteHistory (char* s, int kartNumber, int indx);
 
87
  void          ReadHistory  (char* s, int kartNumber, int indx);
 
88
};   // class Moveable
 
89
 
 
90
#endif