NXEngine v1.0.0.6
[NXEngine.git] / player.h
blobe75e212d5f0ddd93efc7d4d35735b954eb573c7c
2 #ifndef _PLAYER_H
3 #define _PLAYER_H
5 #include "p_arms.h"
6 #include "ai/weapons/whimstar.h"
7 #define MAX_INVENTORY 42
9 class Player : public Object
11 public:
12 virtual ~Player();
14 // current physics constants (change when you go underwater, etc)
15 int fallspeed, walkspeed;
16 int fallaccel, jumpfallaccel;
17 int walkaccel, jumpwalkaccel;
18 int decelspeed;
19 int jumpvelocity;
21 // attributes player is touching: water etc
22 uint32_t touchattr;
24 int airleft; // remaining air (is scaled x10)
25 int airshowtimer; // used for blinking "100" when coming out of water
27 bool walking, lastwalking;
28 int walkanimframe;
29 int walkanimtimer;
31 bool jumping; // 1 if jump physics are enabled
33 uint8_t look; // 0 = not looking, UP = looking up, DOWN = looking down
34 uint8_t lookscroll; // which way the screen should scroll because of a look
35 uint8_t lookscroll_timer; // delays a moment before scrolling when player pushes UP/DOWN
37 bool inputs_locked; // if 1, the controls are turned off (player can't control his sprite)
38 bool inputs_locked_lasttime;
40 bool dead; // deactivates player AI...do we really need this?
41 bool hide; // if 1, player and his statusbar is invisible
42 bool drowned; // if 1, player drowning code has been activated
43 // if 1, player is invisible and controls unresponsive
44 // but statusbar still shown.
45 bool disabled;
47 bool lookaway; // 1 makes him look away from screen (eg when you push DOWN)
49 int inventory[MAX_INVENTORY]; // list of inventory items we have
50 int ninventory; // how many objects are in inventory[]
52 Object *riding; // if non-null, he is "riding" this object (used for solidity)
53 Object *lastriding; // for thud sound
54 // if non-null then this points at an object for which ->riding cannot be set.
55 // This is used when a platform you are riding tries to push you into the ceiling
56 // and so the engine deals with it by having you fall through the platform instead.
57 Object *cannotride;
58 // object if any that caused player's blocku to be set
59 Object *bopped_object;
61 // <UNI mode--used with Ironhead battle
62 int movementmode;
64 // how much fuel you have left in the Booster for this jump
65 int boosterfuel;
66 int booststate; // one of BoosterDir enum
67 int lastbooststate;
68 bool hitwhileboosting; // bit of a hack, to make hurthop work
70 // controls "+xx" floattext numbers when you gain XP
71 FloatText *XPText;
73 Weapon weapons[WPN_COUNT];
74 int curWeapon;
76 int maxHealth; // max health
78 int hurt_time; // timer for blinks after getting hit
79 bool hurt_flash_state; // if 1, player is invisible because he's blinking
81 // when displaying the water bubble (air tank item) this is the frame shown
82 uint8_t water_shield_frame;
83 uint8_t water_shield_timer;
85 // items equipped
86 uint16_t equipmask;
87 WhimsicalStar whimstar;
89 // additional "block" points placed further in than the real block points.
90 // if these make it inside a block the player is "pushed" out of the block.
91 // they can get inside the block because his R/L points are further out than his
92 // D/U points because of his odd shape.
93 Point repel_l[8];
94 Point repel_r[8];
95 Point repel_u[8];
96 Point repel_d[8];
97 int nrepel_l, nrepel_r, nrepel_u, nrepel_d;
100 extern Player *player;
101 extern bool pinputs[INPUT_COUNT];
102 extern bool lastpinputs[INPUT_COUNT];
104 enum PMoveModes
106 MOVEMODE_NORMAL = 0,
107 MOVEMODE_ZEROG = 1,
108 MOVEMODE_DEBUG = 2
111 // how much fuel you start out with in the Booster on each jump.
112 // (for both 0.8 and 2.0)
113 #define BOOSTER_FUEL_QTY 50
115 enum BoosterState
117 BOOST_OFF = 0,
118 BOOST_UP,
119 BOOST_DOWN,
120 BOOST_HOZ,
121 BOOST_08
124 #define EQUIP_BOOSTER08 0x01
125 #define EQUIP_MAP 0x02
126 #define EQUIP_ARMS_BARRIER 0x04
127 #define EQUIP_TURBOCHARGE 0x08
128 #define EQUIP_AIRTANK 0x10
129 #define EQUIP_BOOSTER20 0x20
130 #define EQUIP_MIMIGA_MASK 0x40
131 #define EQUIP_WHIMSTAR 0x80
132 #define EQUIP_NIKUMARU 0x100
134 void AddXP(int xp, bool quiet = false);
135 void SubXP(int xp, bool quiet = false);
137 #endif