resonance 1.0.1
Loading...
Searching...
No Matches
powerupcollection.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "game/powerup.h"
7
8class LocalPlayer;
9
31public:
40 class PowCount {
41 public:
53 bool operator==(PowerupType type) const {
54 return mPowerup->Type() == type;
55 }
56
58 int mCount;
59 };
60
74 PowerupCollection(LocalPlayer *pOwner, int bUnlimited);
75
83
94 virtual void Add(PowerupType type);
95
106 virtual void SelectRelative(int nDelta);
107
117 virtual void Select(int nIndex);
118
132 virtual void Deploy(int nTrack, int nBar);
133
141 virtual int HasSelection() const;
142
149 virtual void SendState() const;
150
151private:
152 std::vector<PowCount> mEntries; // +0x14
153 // The selected entry, or -1 for none.
154 int mSelected; // +0x20
155 LocalPlayer *mOwner; // +0x24
156 // Set from the constructor's second argument. It stocks every entry at construction and stops
157 // Deploy() from spending, so a deployment costs nothing while it is set.
158 int mUnlimited; // +0x28
159};
Player driven by a controller on this machine.
Definition localplayer.h:44
One configured kind, with the number of them stored.
Definition powerupcollection.h:40
Powerup * mPowerup
Definition powerupcollection.h:57
int mCount
Definition powerupcollection.h:58
bool operator==(PowerupType type) const
Report whether the entry holds a powerup of one kind.
Definition powerupcollection.h:53
virtual void Add(PowerupType type)
Increase the count of the entry whose kind matches, up to nine.
virtual int HasSelection() const
Report whether an entry is selected.
virtual void SelectRelative(int nDelta)
Move the selection by nDelta, wrapping, and stop at the first entry with a count above zero.
virtual void Deploy(int nTrack, int nBar)
Deploy the selected powerup and spend one of them.
virtual void Select(int nIndex)
Select one entry by index, without checking its count.
PowerupCollection(LocalPlayer *pOwner, int bUnlimited)
Build one entry for every kind the configuration lists.
virtual void SendState() const
Send one PowerupCountMsg for every non-empty entry, then one ChoosePowerupMsg.
virtual ~PowerupCollection()
Delete every stored powerup.
Base of the thirteen powerups a player can store and deploy.
Definition powerup.h:27
PowerupType
Kinds of item the head-up display labels, in the order HudPowerupName() maps them.
Definition hudutil.h:13