OSDN Git Service

Nazghul-0.7.1
[nazghul-jp/nazghul-jp.git] / src / vehicle.h
1 //
2 // nazghul - an old-school RPG engine
3 // Copyright (C) 2002, 2003 Gordon McNutt
4 //
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
8 // any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13 // more details.
14 //
15 // You should have received a copy of the GNU General Public License along with
16 // this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17 // Suite 330, Boston, MA 02111-1307 USA
18 //
19 // Gordon McNutt
20 // gmcnutt@users.sourceforge.net
21 //
22
23 #ifndef vehicle_h
24 #define vehicle_h
25
26 #include "object.h"
27 #include "sound.h"
28 #include <closure.h>
29
30 class VehicleType:public ObjectType {
31  public:
32         virtual int getType();
33         virtual bool isType(int classID);
34         VehicleType(const char *tag, const char *name, struct sprite *sprite,
35                     struct terrain_map *map,
36                     class ArmsType *ordnance,
37                     bool vulnerable,
38                     bool killsOccupants,
39                     bool mustTurn,
40                     char *mv_desc,
41                     sound_t *mv_sound,
42                     int tailwind_penalty,
43                     int headwind_penalty,
44                     int crosswind_penalty,
45                     int maxHp,
46                     int speed
47                     );
48         virtual ~VehicleType();
49         virtual class ArmsType *getOrdnance();
50         virtual char *getMvDesc();
51         virtual sound_t *get_movement_sound();
52         virtual bool mustTurn();
53         virtual class Object *createInstance();
54         virtual int getWindPenalty(int facing);
55         
56
57         bool isVulnerable();
58         bool killsOccupants();
59
60         struct formation *formation;
61         struct terrain_map *map;
62         closure_t *renderCombat;
63         struct mmode *mmode;
64
65  protected:
66         class ArmsType *ordnance;
67         bool is_vulnerable;
68         bool kills_occupants; /* on destroy */
69         bool must_turn;
70         char *mv_desc;
71         sound_t *mv_sound;
72         int pmask;
73         int tailwind_penalty;
74         int headwind_penalty;
75         int crosswind_penalty;
76         int maxHp;
77 };
78
79 class Vehicle:public Object {
80  public:
81         virtual bool isType(int classID);
82         virtual int getType();
83         Vehicle (VehicleType*);
84         Vehicle (VehicleType*, int facing, int hp);
85         virtual ~Vehicle();
86         virtual class VehicleType *getObjectType();
87         virtual const char *getName();
88         virtual int getX();
89         virtual int getY();
90         virtual class ArmsType *getOrdnance();
91         virtual struct mmode *getMovementMode();
92         virtual char *getMvDesc();
93         virtual sound_t *get_movement_sound();
94         virtual bool mustTurn();
95         virtual int get_facing_to_fire_weapon(int dx, int dy);
96         virtual bool fire_weapon(int dx, int dy, class Object *user);
97         virtual struct formation *get_formation();
98         virtual struct place *getPlace();
99         virtual void destroy();
100         virtual void save(struct save *save);
101         virtual void describe();
102
103         bool isVulnerable();
104         bool turn(int dx, int dy, int *cost);
105         int getMovementCostMultiplier();
106         void damage(int amount);
107         void setName(char *val);
108         class Object *getOccupant();
109         void setOccupant(class Object *val);
110         bool isNamed();
111
112  protected:
113         char *name;
114         class Object *occupant;
115 };
116
117 #endif                          // vehicle_h