New Super Mario Bros. U Headers
Loading...
Searching...
No Matches
Profile.h
Go to the documentation of this file.
1#pragma once
2
3#include <actor/ProfileInfo.h>
4
5#include <basis/seadAssert.h>
6#include <container/seadSafeArray.h>
7#include <heap/seadHeap.h>
8#include <math/seadVector.h>
9
11{
12 enum Flag : u16
13 {
14 cFlag_IgnoreSpawnRange = 1 << 1, ///< Creates the actor regardless of camera proximity.
15 cFlag_ScrollSetupDeferred = 1 << 2, ///< Queues the actor for creation only after scroll limiters and other camera properties have been applied.
16 cFlag_MapObj = 1 << 3, ///< Avoids blocking boost mode block placement and adjusts the Z-position to be further in front.
17 cFlag_Grouped = 1 << 4, ///< Marks the actor as Group Controller-managed, using nybbles 5-6 (high byte of mParam0) as the group ID. Also implies @c cFlag_IgnoreSpawnRange.
18 cFlag_NoCoinEdit = 1 << 5, ///< Prevents spawning in Coin Edit mode.
19 cFlag_CoinEditPatternControlled = 1 << 6, ///< Prevents spawning in Coin Edit mode and is marked as being controlled by a coin edit pattern.
20 cFlag_Coin = 1 << 7, ///< Participates in coin counting routines.
21 cFlag_CoinBlock = 1 << 8, ///< Participates in coin-block counting routines, but only if nybble 20 is 0 and nybble 13 & 1 is 0 (aka mParam1 & 0x1000000F)
22 cFlag_PakkunBlack = 1 << 9, ///< Spawns as a muncher tile instead of constructing an Actor instance.
23 cFlag_ManagedChildTemplate = 1 << 10, ///< Treats creation of the map actor as a reusable operation from an external manager actor.
24 cFlag_GroupedScrollSetupDeferred = 1 << 11, ///< Both @c cFlag_ScrollSetupDeferred and @c cFlag_Grouped
25
27 };
28 friend constexpr Flag operator|(Flag lhs, Flag rhs)
29 {
30 return static_cast<Flag>(
31 static_cast<u16>(lhs) | static_cast<u16>(rhs)
32 );
33 }
34
35 s32 offset_x; // (X) Offset to be added to the initial actor position
36 s32 offset_y; // (Y) ^^^
37 struct
38 {
39 s32 offset_x; // (X) Offset to center of the spawn range bounding box
40 s32 offset_y; // (Y) ^^^
41 s32 half_size_x; // (X) Half the size of the spawn range bounding box
42 s32 half_size_y; // (Y) ^^^
43 } spawn_range;
44 struct {
49 } cull_range;
51
52 // Address: 0x100018F4
54};
55static_assert(sizeof(ActorCreateInfo) == 0x24, "ActorCreateInfo size mismatch");
56
57class ActorBase;
58struct ActorCreateParam;
59class ModelResource;
60
61typedef ActorBase* (*ActorFactory)(const ActorCreateParam&);
62
64{
65public:
66 enum Flag
67 {
68 cFlag_DrawCullCheck = 1 << 1, ///< Enables calling @c Actor::drawCullCheck_() to skip drawing if the actor is considered offscreen.
69 cFlag_NoComboScore = 1 << 2, ///< Disables awarding Combo scores.
70 cFlag_Unk3 = 1 << 3, ///< Possibly unused.
71 cFlag_WinKill = 1 << 4, ///< Kills the actor and awards score when completing the course.
72 cFlag_WinKillNoScore = 1 << 5, ///< Kills the actor when completing the course but does not award score.
73 cFlag_Unk6 = 1 << 6, ///< Possibly unused.
74 cFlag_Projectile = 1 << 7, ///< Used for special collision logic, and kills the actor when completing the course by defeating a boss.
75 cFlag_Unk8 = 1 << 8, ///< Possibly unused.
76 cFlag_NoFumi = 1 << 9, ///< Bypasses stomp classification and always damages the player (applies knockback when penguin-sliding).
77 cFlag_NoLoopPosX = 1 << 10, ///< Disables horizontal screen-wrapping for this actor.
78 cFlag_Carryable = 1 << 11, ///< Allows other carryable blocks to bounce off this actor, kills the actor when catching Nabbit, and counts as a weighted rider on Floating Box.
79 cFlag_Unk12 = 1 << 12, ///< Possibly unused.
80 cFlag_Coin = 1 << 13, ///< Counts as a weighted rider on platforms.
81 cFlag_Item = 1 << 14, ///< Allows being bumped around by Bump Platforms through the @c ItemBase bump-related members.
82 cFlag_FunsuiFollowY = 1 << 15, ///< Causes geysers to drag this actor's position upwards. Only used by Piranha Plants in NSLU.
83
85 };
86 static_assert(sizeof(Flag) == 4);
87
88public:
89 friend Flag operator|(const Flag& lhs, const Flag& rhs)
90 {
91 return (Flag)((u32)lhs | (u32)rhs);
92 }
93
94 friend Flag& operator|=(Flag& lhs, const Flag& rhs)
95 {
96 lhs = lhs | rhs;
97 return lhs;
98 }
99
100 friend Flag operator&(const Flag& lhs, const Flag& rhs)
101 {
102 return (Flag)((u32)lhs & (u32)rhs);
103 }
104
105 friend Flag& operator&=(Flag& lhs, const Flag& rhs)
106 {
107 lhs = lhs & rhs;
108 return lhs;
109 }
110
111 friend Flag operator~(const Flag& val)
112 {
113 return (Flag)(~(u32)val);
114 }
115
116public:
117 Profile(ActorFactory factory, s32 id, const sead::SafeString& name, const ActorCreateInfo* create_info = nullptr, Flag flag = cFlag_None);
118
119 ActorFactory getActorFactory() const
120 {
121 SEAD_ASSERT(mFactory);
122 return mFactory;
123 }
124
125 s32 getID() const
126 {
127 return mID;
128 }
129
131 {
132 return *mActorCreateInfo;
133 }
134
135 bool isResLoaded() const
136 {
137 return mIsResLoaded;
138 }
139
140 Flag getFlag() const
141 {
142 return mFlag;
143 }
144
145 // Address: 0x020195FC
146 void loadResource(sead::Heap* heap);
147 // Address: 0x020196CC
148 void unloadResource(sead::Heap* heap);
149 // Address: 0x020196E4
150 ModelResource* getResource(u32 index) const;
151
152 static Profile* get(s32 id);
153
154protected:
155 ActorFactory mFactory;
160
161 // Address: 0x101ED8DC
162 static sead::SafeArray<
163 Profile*,
166};
167static_assert(sizeof(Profile) == 0x14, "Profile size mismatch");
Base interface class for all actors in the game. Lifecycle is handled by ActorMgr.
Definition ActorBase.h:18
Definition ModelResource.h:14
Definition Profile.h:64
void loadResource(sead::Heap *heap)
ActorFactory mFactory
Definition Profile.h:155
s32 mID
Definition Profile.h:156
void unloadResource(sead::Heap *heap)
friend Flag & operator|=(Flag &lhs, const Flag &rhs)
Definition Profile.h:94
Flag
Definition Profile.h:67
@ cFlag_Item
Allows being bumped around by Bump Platforms through the ItemBase bump-related members.
Definition Profile.h:81
@ cFlag_Unk12
Possibly unused.
Definition Profile.h:79
@ cFlag_NoComboScore
Disables awarding Combo scores.
Definition Profile.h:69
@ cFlag_NoFumi
Bypasses stomp classification and always damages the player (applies knockback when penguin-sliding).
Definition Profile.h:76
@ cFlag_WinKill
Kills the actor and awards score when completing the course.
Definition Profile.h:71
@ cFlag_FunsuiFollowY
Causes geysers to drag this actor's position upwards. Only used by Piranha Plants in NSLU.
Definition Profile.h:82
@ cFlag_None
Definition Profile.h:84
@ cFlag_DrawCullCheck
Enables calling Actor::drawCullCheck_() to skip drawing if the actor is considered offscreen.
Definition Profile.h:68
@ cFlag_Unk3
Possibly unused.
Definition Profile.h:70
@ cFlag_NoLoopPosX
Disables horizontal screen-wrapping for this actor.
Definition Profile.h:77
@ cFlag_Unk6
Possibly unused.
Definition Profile.h:73
@ cFlag_Unk8
Possibly unused.
Definition Profile.h:75
@ cFlag_WinKillNoScore
Kills the actor when completing the course but does not award score.
Definition Profile.h:72
@ cFlag_Coin
Counts as a weighted rider on platforms.
Definition Profile.h:80
@ cFlag_Projectile
Used for special collision logic, and kills the actor when completing the course by defeating a boss.
Definition Profile.h:74
@ cFlag_Carryable
Allows other carryable blocks to bounce off this actor, kills the actor when catching Nabbit,...
Definition Profile.h:78
s32 getID() const
Definition Profile.h:125
static Profile * get(s32 id)
ActorFactory getActorFactory() const
Definition Profile.h:119
friend Flag & operator&=(Flag &lhs, const Flag &rhs)
Definition Profile.h:105
friend Flag operator|(const Flag &lhs, const Flag &rhs)
Definition Profile.h:89
ModelResource * getResource(u32 index) const
const ActorCreateInfo * mActorCreateInfo
Definition Profile.h:157
bool isResLoaded() const
Definition Profile.h:135
Profile(ActorFactory factory, s32 id, const sead::SafeString &name, const ActorCreateInfo *create_info=nullptr, Flag flag=cFlag_None)
Flag getFlag() const
Definition Profile.h:140
friend Flag operator&(const Flag &lhs, const Flag &rhs)
Definition Profile.h:100
bool mIsResLoaded
Definition Profile.h:158
Flag mFlag
Definition Profile.h:159
static sead::SafeArray< Profile *, ProfileInfo::cProfileID_Max > sProfileList
Definition Profile.h:165
friend Flag operator~(const Flag &val)
Definition Profile.h:111
const ActorCreateInfo & getActorCreateInfo() const
Definition Profile.h:130
Definition Profile.h:11
u16 down
Definition Profile.h:46
friend constexpr Flag operator|(Flag lhs, Flag rhs)
Definition Profile.h:28
Flag
Definition Profile.h:13
@ cFlag_GroupedScrollSetupDeferred
Both cFlag_ScrollSetupDeferred and cFlag_Grouped.
Definition Profile.h:24
@ cFlag_IgnoreSpawnRange
Creates the actor regardless of camera proximity.
Definition Profile.h:14
@ cFlag_ScrollSetupDeferred
Queues the actor for creation only after scroll limiters and other camera properties have been applie...
Definition Profile.h:15
@ cFlag_Grouped
Marks the actor as Group Controller-managed, using nybbles 5-6 (high byte of mParam0) as the group ID...
Definition Profile.h:17
@ cFlag_NoCoinEdit
Prevents spawning in Coin Edit mode.
Definition Profile.h:18
@ cFlag_MapObj
Avoids blocking boost mode block placement and adjusts the Z-position to be further in front.
Definition Profile.h:16
@ cFlag_None
Definition Profile.h:26
@ cFlag_CoinBlock
Participates in coin-block counting routines, but only if nybble 20 is 0 and nybble 13 & 1 is 0 (aka ...
Definition Profile.h:21
@ cFlag_Coin
Participates in coin counting routines.
Definition Profile.h:20
@ cFlag_CoinEditPatternControlled
Prevents spawning in Coin Edit mode and is marked as being controlled by a coin edit pattern.
Definition Profile.h:19
@ cFlag_ManagedChildTemplate
Treats creation of the map actor as a reusable operation from an external manager actor.
Definition Profile.h:23
@ cFlag_PakkunBlack
Spawns as a muncher tile instead of constructing an Actor instance.
Definition Profile.h:22
s32 half_size_y
Definition Profile.h:42
s32 offset_x
Definition Profile.h:35
u16 up
Definition Profile.h:45
s32 offset_y
Definition Profile.h:36
u16 left
Definition Profile.h:47
Flag flag
Definition Profile.h:50
s32 half_size_x
Definition Profile.h:41
static const ActorCreateInfo cDefault
Definition Profile.h:53
u16 right
Definition Profile.h:48
Definition ActorCreateParam.h:108