~ubuntu-branches/ubuntu/karmic/starvoyager/karmic

« back to all changes in this revision

Viewing changes to frag.h

  • Committer: Bazaar Package Importer
  • Author(s): Idan Sofer
  • Date: 2003-08-01 16:55:13 UTC
  • Revision ID: james.westby@ubuntu.com-20030801165513-0ueb129iym99k7tg
Tags: upstream-0.4.4
ImportĀ upstreamĀ versionĀ 0.4.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
        frag.h
 
3
        
 
4
        (c) Richard Thrippleton
 
5
        Licensing terms are in the 'LICENSE' file
 
6
        If that file is not included with this source then permission is not given to use this source in any way whatsoever.
 
7
*/
 
8
 
 
9
class ship;
 
10
struct cord;
 
11
 
 
12
class frag //A frag object, like phaser fire, torpedo, debris
 
13
{
 
14
        public:
 
15
        enum {ENERGY=1,HOMER=2,DEBRIS=3}; //Frag types
 
16
        enum {FIRE=1}; //Index of burning fire graphic
 
17
        static const int ISIZE=512; //Capacity of frag index
 
18
 
 
19
        frag(cord loc,int typ,short spr,short col,ship* trg,ship* own,vect mov,short rot,short pow,short trck,short rng); //Constructor to create a new frag from scratch
 
20
 
 
21
        ~frag(); //Destructor
 
22
 
 
23
        static void init(); //Initialise the frag system datastructures
 
24
        static void purgeall(); //Clean out the frag system after use
 
25
        static void simulateall(); //Simulate all the frags and physics
 
26
        static void notifydelete(ship* tshp); //Notify the frags of the deletion of a ship, to resolve dangling target and owner references
 
27
        static void saveall(); //Save all frags to the database
 
28
        static void loadall(); //Load all frags from database
 
29
        static frag* get(int indx); //Return the frag of given index
 
30
 
 
31
        void netout(int typ,unsigned char* buf); //Get type of data from frag into a network buffer
 
32
 
 
33
        int self; //Self index in the database
 
34
        cord loc; //Position
 
35
        int typ; //Type (see the top enum)
 
36
        ship* trg; //Target ship index
 
37
        ship* own; //Owner ship index
 
38
 
 
39
        private:
 
40
        frag(int self); //Constructor, give it its index value and it will load from the database
 
41
 
 
42
        void physics(); //Move the frag, do collisions
 
43
        void home(); //Sub-function of physics, handles homing
 
44
        void save(); //Save frag to a database
 
45
        void load(); //Load frag from a database
 
46
 
 
47
        static frag* frags[ISIZE]; //The frag index
 
48
 
 
49
        int spr; //Associated sprite index
 
50
        int col; //Colour if relevant (makes it a beam weapon)
 
51
        long ox,oy; //Old co-ordinates, for purposes of clientside interpolation
 
52
        vect mov; //Velocity vector
 
53
        int rot; //Rotation frame to use
 
54
        int pow; //Power/damage
 
55
        long trck; //Tracking power
 
56
        int rng; //Range left
 
57
};