A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
KartItem.cc
Go to the documentation of this file.
1#include "KartItem.hh"
2
5
7
8namespace Kinoko::Item {
9
14
16KartItem::~KartItem() = default;
17
19void KartItem::init(size_t playerIdx) {
20 apply(playerIdx);
21}
22
26 bool prevButton = m_flags.onBit(eFlags::ItemButtonHold);
28
29 const auto &currentInputs = inputs()->currentState();
30 if (currentInputs.item()) {
32 }
33
34 auto &status = KartObjectProxy::status();
35
41 }
42 } else {
47 } else {
48 const auto *raceMgr = System::RaceManager::Instance();
50 canUse = canUse && raceMgr->isStageReached(System::RaceManager::Stage::Race);
52 canUse = canUse && (m_inventory.id() != ItemId::NONE);
53
54 if (canUse) {
55 // For now, assume only time trials are valid and use a mushroom
57 }
58 }
59 }
60}
61
64 if (m_inventory.id() != ItemId::NONE) {
66 }
67}
68
73
79
80} // namespace Kinoko::Item
constexpr bool offBit(Es... es) const
Checks if all of the corresponding bits for the provided enum values are off.
Definition BitFlag.hh:470
constexpr bool onBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are on.
Definition BitFlag.hh:437
void init(size_t playerIdx)
Definition KartItem.cc:19
void calc()
Calculates item activation based on the controller input state.
Definition KartItem.cc:25
ItemInventory m_inventory
Definition KartItem.hh:45
const System::KPad * inputs() const
const RaceInputState & currentState() const
static RaceManager * Instance()
Pertains to item handling.
@ Burnout
Set during a burnout on race start.
Definition Status.hh:60
@ BeforeRespawn
Set on respawn collision, cleared on position snap.
Definition Status.hh:17
constexpr bool onBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are on.
Definition BitFlag.hh:166
constexpr TBitFlag< T, E > & setBit(Es... es)
Sets the corresponding bits for the provided enum values.
Definition BitFlag.hh:74
constexpr TBitFlag< T, E > & changeBit(bool on, Es... es)
Changes the state of the corresponding bits for the provided enum values.
Definition BitFlag.hh:143
constexpr void makeAllZero()
Resets all the bits to zero.
Definition BitFlag.hh:292
constexpr TBitFlag< T, E > & resetBit(Es... es)
Resets the corresponding bits for the provided enum values.
Definition BitFlag.hh:85