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 <basis/seadAssert.h>
4#include <container/seadSafeArray.h>
5#include <heap/seadHeap.h>
6#include <math/seadVector.h>
7
9{
10 enum Flag : u16
11 {
12 cFlag_IgnoreSpawnRange = 1 << 1, ///< Creates the actor regardless of camera proximity.
13 cFlag_ScrollSetupDeferred = 1 << 2, ///< Queues the actor for creation only after scroll limiters and other camera properties have been applied.
14 cFlag_MapObj = 1 << 3, ///< Avoids blocking boost mode block placement and adjusts the Z-position to be further in front.
15 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.
16 cFlag_NoCoinEdit = 1 << 5, ///< Prevents spawning in Coin Edit mode.
17 cFlag_CoinEditPatternControlled = 1 << 6, ///< Prevents spawning in Coin Edit mode and is marked as being controlled by a coin edit pattern.
18 cFlag_Coin = 1 << 7, ///< Participates in coin counting routines.
19 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)
20 cFlag_PakkunBlack = 1 << 9, ///< Spawns as a muncher tile instead of constructing an Actor instance.
21 cFlag_ManagedChildTemplate = 1 << 10, ///< Treats creation of the map actor as a reusable operation from an external manager actor.
22 cFlag_Jouchu = 1 << 11, ///< Both @c cFlag_ScrollSetupDeferred and @c cFlag_Grouped
23
25 };
26 friend constexpr Flag operator|(Flag lhs, Flag rhs)
27 {
28 return static_cast<Flag>(
29 static_cast<u16>(lhs) | static_cast<u16>(rhs)
30 );
31 }
32
33 s32 offset_x; // (X) Offset to be added to the initial actor position
34 s32 offset_y; // (Y) ^^^
35 struct
36 {
37 s32 offset_x; // (X) Offset to center of the spawn range bounding box
38 s32 offset_y; // (Y) ^^^
39 s32 half_size_x; // (X) Half the size of the spawn range bounding box
40 s32 half_size_y; // (Y) ^^^
41 } spawn_range;
42 struct {
47 } cull_range;
49
50 // Address: 0x100018F4
51 static const ActorData cDefault;
52};
53static_assert(sizeof(ActorData) == 0x24, "ActorData size mismatch");
54
55class ActorBase;
57class ModelResource;
58
59typedef ActorBase* (*ActorFactory)(const ActorCreateParameter&);
60
61typedef s32 ProfileID;
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 enum
90 {
91 cProfileID_Max = 913 // Profiles 910, 911 and 912 are extra (samples)
92 };
93
94public:
95 friend Flag operator|(const Flag& lhs, const Flag& rhs)
96 {
97 return (Flag)((u32)lhs | (u32)rhs);
98 }
99
100 friend Flag& operator|=(Flag& lhs, const Flag& rhs)
101 {
102 lhs = lhs | rhs;
103 return lhs;
104 }
105
106 friend Flag operator&(const Flag& lhs, const Flag& rhs)
107 {
108 return (Flag)((u32)lhs & (u32)rhs);
109 }
110
111 friend Flag& operator&=(Flag& lhs, const Flag& rhs)
112 {
113 lhs = lhs & rhs;
114 return lhs;
115 }
116
117 friend Flag operator~(const Flag& val)
118 {
119 return (Flag)(~(u32)val);
120 }
121
122public:
123 Profile(ActorFactory factory, ProfileID id, const sead::SafeString& name, const ActorData* create_info = nullptr, u32 flag = cFlag_None, void (*)(sead::hostio::Context*) = nullptr);
124
125 ActorFactory getActorFactory() const
126 {
127 SEAD_ASSERT(mFactory);
128 return mFactory;
129 }
130
132 {
133 return mID;
134 }
135
137 {
138 return *mActorCreateInfo;
139 }
140
141 bool isResLoaded() const
142 {
143 return mIsResLoaded;
144 }
145
146 Flag getFlag() const
147 {
148 return mFlag;
149 }
150
151 // Address: 0x020195FC
152 void loadResource(sead::Heap* heap);
153 // Address: 0x020196CC
155 // Address: 0x020196E4
156 ModelResource* getMdlResource(u32 index) const;
157
159
160protected:
161 ActorFactory mFactory;
166
167 // Address: 0x101ED8DC
168 static sead::SafeArray<
169 Profile*,
172};
173static_assert(sizeof(Profile) == 0x14, "Profile size mismatch");
s32 ProfileID
Definition Profile.h:61
Base interface class for all actors in the game. Lifecycle is handled by ActorMgr.
Definition ActorBase.h:19
Definition ModelResource.h:14
Definition Profile.h:64
void loadResource(sead::Heap *heap)
ActorFactory mFactory
Definition Profile.h:161
friend Flag & operator|=(Flag &lhs, const Flag &rhs)
Definition Profile.h:100
static sead::SafeArray< Profile *, cProfileID_Max > sProfileList
Definition Profile.h:171
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
@ cProfileID_Max
Definition Profile.h:91
ActorFactory getActorFactory() const
Definition Profile.h:125
void unloadResource()
friend Flag & operator&=(Flag &lhs, const Flag &rhs)
Definition Profile.h:111
friend Flag operator|(const Flag &lhs, const Flag &rhs)
Definition Profile.h:95
static Profile * getProfile(ProfileID id)
bool isResLoaded() const
Definition Profile.h:141
ModelResource * getMdlResource(u32 index) const
const ActorData & getActorCreateInfo() const
Definition Profile.h:136
Profile(ActorFactory factory, ProfileID id, const sead::SafeString &name, const ActorData *create_info=nullptr, u32 flag=cFlag_None, void(*)(sead::hostio::Context *)=nullptr)
Flag getFlag() const
Definition Profile.h:146
friend Flag operator&(const Flag &lhs, const Flag &rhs)
Definition Profile.h:106
bool mIsResLoaded
Definition Profile.h:164
const ActorData * mActorCreateInfo
Definition Profile.h:163
Flag mFlag
Definition Profile.h:165
ProfileID getID() const
Definition Profile.h:131
friend Flag operator~(const Flag &val)
Definition Profile.h:117
ProfileID mID
Definition Profile.h:162
Definition ActorCreateParameter.h:108
Definition Profile.h:9
friend constexpr Flag operator|(Flag lhs, Flag rhs)
Definition Profile.h:26
u16 left
Definition Profile.h:45
s32 offset_y
Definition Profile.h:34
s32 offset_x
Definition Profile.h:33
s32 half_size_x
Definition Profile.h:39
u16 down
Definition Profile.h:44
Flag
Definition Profile.h:11
@ cFlag_NoCoinEdit
Prevents spawning in Coin Edit mode.
Definition Profile.h:16
@ cFlag_ManagedChildTemplate
Treats creation of the map actor as a reusable operation from an external manager actor.
Definition Profile.h:21
@ cFlag_Jouchu
Both cFlag_ScrollSetupDeferred and cFlag_Grouped.
Definition Profile.h:22
@ cFlag_Grouped
Marks the actor as Group Controller-managed, using nybbles 5-6 (high byte of mParam0) as the group ID...
Definition Profile.h:15
@ cFlag_MapObj
Avoids blocking boost mode block placement and adjusts the Z-position to be further in front.
Definition Profile.h:14
@ cFlag_None
Definition Profile.h:24
@ cFlag_Coin
Participates in coin counting routines.
Definition Profile.h:18
@ cFlag_CoinEditPatternControlled
Prevents spawning in Coin Edit mode and is marked as being controlled by a coin edit pattern.
Definition Profile.h:17
@ cFlag_ScrollSetupDeferred
Queues the actor for creation only after scroll limiters and other camera properties have been applie...
Definition Profile.h:13
@ 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:19
@ cFlag_IgnoreSpawnRange
Creates the actor regardless of camera proximity.
Definition Profile.h:12
@ cFlag_PakkunBlack
Spawns as a muncher tile instead of constructing an Actor instance.
Definition Profile.h:20
static const ActorData cDefault
Definition Profile.h:51
Flag flag
Definition Profile.h:48
u16 right
Definition Profile.h:46
s32 half_size_y
Definition Profile.h:40
u16 up
Definition Profile.h:43