NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_actorcreate_manager.cpp
1#include <cstdlib>
2#include <game/bases/d_actorcreate_manager.hpp>
3#include <game/bases/d_actor_group_manager.hpp>
4#include <game/bases/d_bg.hpp>
5#include <game/bases/d_info.hpp>
6#include <game/bases/d_s_stage.hpp>
7#include <game/bases/d_profile.hpp>
8#include <game/bases/d_bg_parameter.hpp>
9
12 fProfile::EN_PUKUCOIN,
13 fProfile::EN_KARON,
14 fProfile::EN_BIGKARON,
15 fProfile::EN_KARON_HEAD,
16 fProfile::WAKI_KERONPA,
17 fProfile::PROFILE_NULL
18};
19
29
30bool dActorCreateMng_c::ScroolAreaInCheck(int boundsEdge, int areaEdge, int boundMin, int boundMax, int areaMin, int areaMax) {
31 if (boundsEdge == areaEdge) {
32 return boundMax >= areaMin && boundMin <= areaMax;
33 }
34 return false;
35}
36
37bool dActorCreateMng_c::ScroolAreaInLoopCheck(int boundsEdge, int areaEdge, int boundMin, int boundMax, int areaMin, int areaMax) {
38 return ScroolAreaInCheck(boundsEdge, areaEdge, boundMin, boundMax, areaMin, areaMax);
39}
40
42 for (int i = 0; i < MAX_MAP_ACTOR_COUNT; i++) {
43 mSpawnFlags[i] = 0;
44 mDeleteVals[i] = 0;
45 }
46
47 if (dInfo_c::mGameFlag & dInfo_c::GAME_FLAG_0) {
48 return;
49 }
50
52 mScreenTopPos = 0;
56}
57
59 if (dInfo_c::mGameFlag & dInfo_c::GAME_FLAG_0) {
60 return;
61 }
62
63 if (mIsEndingDemo) {
64 return;
65 }
66
67 for (int i = 0; i < MAX_MAP_ACTOR_COUNT; i++) {
68 mSpawnFlags[i] &= ~dActor_c::ACTOR_SPAWNED;
69 }
70
72 mScreenTopPos = 0;
76}
77
79 dCdFile_c *file = dCd_c::m_instance->getFileP(dScStage_c::m_instance->mCurrFile);
81 file->mpMapActors,
84 file->mMapActorCount,
85 false
86 );
87}
88
90 dCdFile_c *file = dCd_c::m_instance->getFileP(dScStage_c::m_instance->mCurrFile);
91 u8 areaNo = dScStage_c::m_instance->getCurrArea();
93 file->mMapActorsByArea[areaNo],
94 &mDeleteVals[file->mMapActorIdxForArea[areaNo]],
95 &mSpawnFlags[file->mMapActorIdxForArea[areaNo]],
96 file->mMapActorCountByArea[areaNo],
97 true
98 );
99}
100
102 ProfileName i = 0;
103 while (l_GoAheadEnemy[i] != ARRAY_LAST(l_GoAheadEnemy)) {
104 if (data->mMapActorID == l_GoAheadEnemy[i]) {
105 break;
106 }
107 i++;
108 }
109
110 if (l_GoAheadEnemy[i] != ARRAY_LAST(l_GoAheadEnemy)) {
111 return true;
112 }
113
114 return false;
115}
116
117void dActorCreateMng_c::processGroupId(sMapActorData *data, u8 file, u32 mapActorIdx) {
118 dActorGroupIdMng_c::m_instance->process(data, GROUP_ID(data->mParam), file, mapActorIdx);
119}
120
122 return GROUP_ID(param) == 0;
123}
124
125void dActorCreateMng_c::MapActorInitialCreate(sMapActorData *levelData, u16 *deleteVal, u8 *spawnFlags, int mapActorCount, bool isAreaReload) {
126 if (mapActorCount == 0 || levelData == nullptr) {
127 return;
128 }
129
130 dScStage_c *stage = dScStage_c::m_instance;
131 dBgParameter_c *bgParam = dBgParameter_c::ms_Instance_p;
132
133 float screenPosX = bgParam->pos().x;
134 float screenPosY = bgParam->pos().y;
135 float screenWidth = bgParam->size().x;
136 float screenHeight = bgParam->size().y;
137
138 int screenLeft = screenPosX;
139 int screenTop = -(int) screenPosY;
140
141 int boundTop = screenTop - 32;
142 int boundBottom = screenTop + (int) screenHeight + 48;
143 int boundLeft = screenLeft - 48;
144 int boundRight = screenLeft + (int) screenWidth + 64;
145
146 int boundHalfHeight = (boundBottom - boundTop) >> 1;
147 int boundHalfWidth = (boundRight - boundLeft) >> 1;
148 int boundCenterY = boundTop + boundHalfHeight;
149 int boundCenterX = boundLeft + boundHalfWidth;
150
151 int actorCenterX, actorCenterY, actorHalfWidth, actorHalfHeight;
152
153 u32 i = 0;
154 dCdFile_c *file = dCd_c::m_instance->getFileP(stage->mCurrFile);
155 u8 areaNo = dScStage_c::m_instance->getCurrArea();
156
157 while (i != mapActorCount) {
158 if ((*spawnFlags & dActor_c::ACTOR_SPAWNED) == 0) {
159 dActorData_c *mapActorInfo = dActorData_c::getMapActorInfo(levelData->mMapActorID);
160
161 bool globalActor = false;
162 bool canSpawn = false;
163
164 if (!isAreaReload) {
165 bool groupedActor = false;
166
167 // If the actor can be grouped and a group ID is defined, process the group
168 if (mapActorInfo->mFlags & ACTOR_CREATE_GROUPABLE) {
169 if (!GroupIdCheck(levelData->mParam)) {
170 processGroupId(levelData, stage->mCurrFile, i);
171 groupedActor = true;
172 }
173 } else if (GlobalActorCheck(levelData)) {
174 globalActor = true;
175 }
176
177 // Do not process grouped actors and let the Group Controller deal with it
178 // Otherwise, verify the actor's spawn range is within the zone boundaries
179 if (!groupedActor) {
180 sRangePosSize bound = {
181 levelData->mX,
182 levelData->mY,
183 (u16) (mapActorInfo->mSpawnRangeHalfWidth * 2),
184 (u16) (mapActorInfo->mSpawnRangeHalfHeight * 2)
185 };
186 if (file->getAreaNo(&bound) == areaNo) {
187 canSpawn = true;
188 }
189 }
190
191 // On zone reload, spawn all non-grouped actors
192 } else {
193 if (mapActorInfo->mFlags & ACTOR_CREATE_GROUPABLE) {
194 if (GroupIdCheck(levelData->mParam)) {
195 canSpawn = true;
196 }
197 } else {
198 canSpawn = true;
199 }
200 }
201
202 bool spawnActor = globalActor;
203 if (!globalActor && canSpawn) {
204 if (mapActorInfo->mFlags & ACTOR_CREATE_GLOBAL) {
205 spawnActor = true;
206 } else {
207 // If the distance between the boundary center and the actor center is less than their combined half-widths,
208 // the two boxes are touching, and the actor can be spawned
209 actorHalfWidth = mapActorInfo->mSpawnRangeHalfWidth + ((mapActorInfo->mSpawnMarginLeft + mapActorInfo->mSpawnMarginRight) >> 1);
210 actorHalfHeight = mapActorInfo->mSpawnRangeHalfHeight + ((mapActorInfo->mSpawnMarginTop + mapActorInfo->mSpawnMarginBottom) >> 1);
211 actorCenterX = levelData->mX + mapActorInfo->mSpawnRangeOffsetX;
212 actorCenterY = levelData->mY - mapActorInfo->mSpawnRangeOffsetY;
213 if (
214 abs(boundCenterX - actorCenterX) <= abs(boundHalfWidth + actorHalfWidth) &&
215 abs(boundCenterY - actorCenterY) <= abs(boundHalfHeight + actorHalfHeight)
216 ) {
217 spawnActor = true;
218 }
219 }
220 }
221
222 if (spawnActor) {
223 mapActorSpawn(levelData, mapActorInfo, spawnFlags, deleteVal, areaNo);
224 }
225 }
226
227 levelData++;
228 spawnFlags++;
229 deleteVal++;
230 i++;
231 }
232}
233
235 if (dInfo_c::mGameFlag & dInfo_c::GAME_FLAG_0) {
236 return;
237 }
238
239 if (mIsGoalPoleDemo == true) {
240 return;
241 }
242
243 dBgParameter_c *bgParam = dBgParameter_c::ms_Instance_p;
244
245 sMapActorCreateBounds::BOUND_SCROLL_DIR_X_e scrollDirX = sMapActorCreateBounds::BOUND_SCROLL_X_LEFT;
246 sMapActorCreateBounds::BOUND_SCROLL_DIR_Y_e scrollDirY = sMapActorCreateBounds::BOUND_SCROLL_Y_UP;
247
248 float screenPosX = bgParam->pos().x;
249 float screenPosY = bgParam->pos().y;
250 float screenWidth = bgParam->size().x;
251 float screenHeight = bgParam->size().y;
252
253 int screenLeft = screenPosX;
254 int screenTop = -(int) screenPosY;
255
256 int tileLeft = (screenLeft - 32) >> 4;
257 int tileRight = (screenLeft + (int) screenWidth + 48) >> 4;
258 int tileTop = (screenTop - 16) >> 4;
259 int tileBottom = (screenTop + (int) screenHeight + 32) >> 4;
260
261 sMapActorCreateBounds createBounds;
262
263 int scrollBoundaryTileX, scrollBoundaryTileY;
264
265 if (dBg_c::m_bg_p->getDispScale() != dBg_c::m_bg_p->getPrevDispScale()) {
266 createBounds.mScrollBoundaryTileX = tileLeft;
267 createBounds.mScrollBoundaryTileY = tileBottom;
268 createBounds.mTileLeft = tileLeft;
269 createBounds.mTileRight = tileRight;
270 createBounds.mTileTop = tileTop;
271 createBounds.mTileBottom = tileBottom;
272 createBounds.mScrollDirX = sMapActorCreateBounds::BOUND_SCROLL_X_LEFT;
273 createBounds.mScrollDirY = sMapActorCreateBounds::BOUND_SCROLL_Y_DOWN;
274 MapActorScrollCreate(&createBounds, false);
275
276 // [Possible optimization: MapActorScrollCreate can be called with scroll directions
277 // X_RIGHT and Y_UP, making the third call redundant as each axis is handled individually]
278 createBounds.mScrollBoundaryTileX = tileRight;
279 createBounds.mScrollBoundaryTileY = tileBottom;
280 createBounds.mTileLeft = tileLeft;
281 createBounds.mTileRight = tileRight;
282 createBounds.mTileTop = tileTop;
283 createBounds.mTileBottom = tileBottom;
284 createBounds.mScrollDirX = sMapActorCreateBounds::BOUND_SCROLL_X_RIGHT;
285 createBounds.mScrollDirY = sMapActorCreateBounds::BOUND_SCROLL_Y_DOWN;
286 MapActorScrollCreate(&createBounds, false);
287
288 mScreenLeftPos = screenLeft; // [Unnecessary assignment]
289 mScreenTopPos = screenTop; // [Unnecessary assignment]
290 scrollBoundaryTileX = tileRight;
291 scrollBoundaryTileY = tileTop;
292
293 createBounds.mScrollBoundaryTileX = tileRight;
294 createBounds.mScrollBoundaryTileY = tileTop;
295 createBounds.mScrollDirX = sMapActorCreateBounds::BOUND_SCROLL_X_RIGHT;
296 createBounds.mScrollDirY = sMapActorCreateBounds::BOUND_SCROLL_Y_UP;
297 MapActorScrollCreate(&createBounds, false);
298 } else {
299 int bgScrollDirY = bgParam->mScrollDirY;
300 int bgScrollDirX = bgParam->mScrollDirX;
301
302 if (bgScrollDirX != dBgParameter_c::BG_SCROLL_X_NONE) {
303 if (bgScrollDirX == dBgParameter_c::BG_SCROLL_X_RIGHT) {
304 // Right
305 scrollBoundaryTileX = tileRight;
306 scrollDirX = sMapActorCreateBounds::BOUND_SCROLL_X_RIGHT;
307 } else {
308 // Left
309 scrollBoundaryTileX = tileLeft;
310 }
311 } else {
312 // None
313 scrollBoundaryTileX = mPrevScrollBoundaryTileY; // [Bug? Should be mPrevScrollBoundaryTileX]
314 scrollDirX = sMapActorCreateBounds::BOUND_SCROLL_X_NONE;
315 }
316
317 if (bgScrollDirY != dBgParameter_c::BG_SCROLL_Y_NONE) {
318 if (bgScrollDirY == (u32)dBgParameter_c::BG_SCROLL_Y_DOWN) {
319 // Down
320 scrollBoundaryTileY = tileBottom;
321 scrollDirY = sMapActorCreateBounds::BOUND_SCROLL_Y_DOWN;
322 } else {
323 // Up
324 scrollBoundaryTileY = tileTop;
325 }
326 } else {
327 // None
328 scrollBoundaryTileY = mPrevScrollBoundaryTileY;
329 scrollDirY = sMapActorCreateBounds::BOUND_SCROLL_Y_NONE;
330 }
331
332 // Only spawn actors if the camera has moved from the previous frame
333 if (mPrevScrollBoundaryTileX != scrollBoundaryTileX || mPrevScrollBoundaryTileY != scrollBoundaryTileY) {
334 createBounds.mScrollBoundaryTileX = scrollBoundaryTileX;
335 createBounds.mScrollBoundaryTileY = scrollBoundaryTileY;
336 createBounds.mTileLeft = tileLeft;
337 createBounds.mTileRight = tileRight;
338 createBounds.mTileTop = tileTop;
339 createBounds.mTileBottom = tileBottom;
340 createBounds.mScrollDirX = scrollDirX;
341 createBounds.mScrollDirY = scrollDirY;
342 MapActorScrollCreate(&createBounds, true);
343 }
344 }
345
346 mScreenLeftPos = screenLeft;
347 mScreenTopPos = screenTop;
348 mPrevScrollBoundaryTileX = scrollBoundaryTileX;
349 mPrevScrollBoundaryTileY = scrollBoundaryTileY;
350}
351
352void dActorCreateMng_c::MapActorScrollCreate(sMapActorCreateBounds *createBounds, int isScreenScroll) {
353 dScStage_c *stage = dScStage_c::m_instance;
354 u8 areaNo = stage->mCurrArea;
355 dCdFile_c *file = dCd_c::m_instance->getFileP(stage->mCurrFile);
356
357 int mapActorCount = file->mMapActorCountByArea[areaNo];
358 if (mapActorCount == 0) {
359 return;
360 }
361
362 sMapActorData *data = file->mMapActorsByArea[areaNo];
363 if (data == nullptr) {
364 return;
365 }
366
367 u16 *deleteVal = &mDeleteVals[file->mMapActorIdxForArea[areaNo]];
368 u8 *spawnFlags = &mSpawnFlags[file->mMapActorIdxForArea[areaNo]];
369
370 bool spawnActor;
371 int actorCenterX, actorCenterY;
372 int scrollBoundaryTileX, actorTileLeft, actorTileRight;
373 int scrollBoundaryTileY, actorTileTop, actorTileBottom;
374
375 int createBoundaryTileX = createBounds->mScrollBoundaryTileX;
376 int createBoundaryTileY = createBounds->mScrollBoundaryTileY;
377 int boundsLeft = createBounds->mTileLeft;
378 int boundsRight = createBounds->mTileRight;
379 int boundsTop = createBounds->mTileTop;
380 int boundsBottom = createBounds->mTileBottom;
381 sMapActorCreateBounds::BOUND_SCROLL_DIR_X_e scrollDirX = createBounds->mScrollDirX;
382 sMapActorCreateBounds::BOUND_SCROLL_DIR_Y_e scrollDirY = createBounds->mScrollDirY;
383
384 for (u32 i = 0; i != mapActorCount; i++) {
385 if ((*spawnFlags & dActor_c::ACTOR_SPAWNED) == 0) {
386 dActorData_c *mapActorInfo = dActorData_c::getMapActorInfo(data->mMapActorID);
387 spawnActor = false;
388 actorCenterX = data->mX + mapActorInfo->mSpawnRangeOffsetX;
389 actorCenterY = data->mY - mapActorInfo->mSpawnRangeOffsetY;
390 actorTileLeft = (actorCenterX - mapActorInfo->mSpawnRangeHalfWidth - mapActorInfo->mSpawnMarginLeft) >> 4;
391 actorTileRight = (actorCenterX + mapActorInfo->mSpawnRangeHalfWidth + mapActorInfo->mSpawnMarginRight) >> 4;
392 actorTileTop = (actorCenterY - mapActorInfo->mSpawnRangeHalfHeight - mapActorInfo->mSpawnMarginTop) >> 4;
393 actorTileBottom = (actorCenterY + mapActorInfo->mSpawnRangeHalfHeight + mapActorInfo->mSpawnMarginBottom) >> 4;
394 scrollBoundaryTileX = actorTileRight;
395 if (scrollDirX != sMapActorCreateBounds::BOUND_SCROLL_X_LEFT) {
396 scrollBoundaryTileX = actorTileLeft;
397 }
398 scrollBoundaryTileY = actorTileBottom;
399 if (scrollDirY != sMapActorCreateBounds::BOUND_SCROLL_Y_UP) {
400 scrollBoundaryTileY = actorTileTop;
401 }
402
403 bool groupedActor = false;
404 if (mapActorInfo->mFlags & ACTOR_CREATE_GROUPABLE) {
405 if (!GroupIdCheck(data->mParam)) {
406 groupedActor = true;
407 }
408 }
409
410 if (!groupedActor) {
411 if (isScreenScroll) {
412 if (scrollBoundaryTileX == createBoundaryTileX) {
413 if (scrollDirX != sMapActorCreateBounds::BOUND_SCROLL_X_NONE) {
414 if (scrollDirX < 0) {
415 spawnActor = ScroolAreaInCheck(boundsRight, actorTileLeft, boundsTop, boundsBottom, actorTileTop, actorTileBottom);
416 } else {
417 spawnActor = ScroolAreaInCheck(boundsLeft, actorTileRight, boundsTop, boundsBottom, actorTileTop, actorTileBottom);
418 }
419 }
420 } else if (scrollBoundaryTileY == createBoundaryTileY) {
421 if (scrollDirY != sMapActorCreateBounds::BOUND_SCROLL_Y_NONE) {
422 if (scrollDirY < 0) {
423 spawnActor = ScroolAreaInLoopCheck(boundsBottom, actorTileTop, boundsLeft, boundsRight, actorTileLeft, actorTileRight);
424 } else {
425 spawnActor = ScroolAreaInLoopCheck(boundsTop, actorTileBottom, boundsLeft, boundsRight, actorTileLeft, actorTileRight);
426 }
427 }
428 }
429 } else {
430 if (ScroolAreaInCheck(createBoundaryTileX, scrollBoundaryTileX, boundsTop, boundsBottom, actorTileTop, actorTileBottom)) {
431 spawnActor = true;
432 }
433 if (ScroolAreaInCheck(createBoundaryTileY, scrollBoundaryTileY, boundsLeft, boundsRight, actorTileLeft, actorTileRight)) {
434 spawnActor = true;
435 }
436 }
437 }
438
439 if (spawnActor) {
440 mapActorSpawn(data, mapActorInfo, spawnFlags, deleteVal, areaNo);
441 }
442 }
443
444 data++;
445 deleteVal++;
446 spawnFlags++;
447 }
448}
449
451 mZPosCount++;
452 if (mZPosCount >= Z_POS_COUNT) {
453 mZPosCount = 0;
454 }
455}
456
458 float res = 1900.0f - mZPosCount * 16.0f;
459 incZposCount();
460 return res;
461}
462
469
471 float res = -2500.0f + mZPosCountLayer2 * 16.0f;
473 return res;
474}
475
482
484 float res = 400.0f - mMapObjZPosCount * 8.0f;
486 return res;
487}
488
495
497 float res = -3100.0f - mMapObjZPosCountLayer2 * 8.0f;
499 return res;
500}
501
502dActor_c *dActorCreateMng_c::mapActorSpawn(sMapActorData *data, dActorData_c *info, u8 *spawnFlags, u16 *deleteVal, u8 areaNo) {
503 if (data->getProfileName() == fProfile::DUMMY_ACTOR) {
504 return nullptr;
505 }
506
507 float zPos;
508 if (info->mFlags & ACTOR_CREATE_MAPOBJ) {
509 if (data->mLayer != LAYER_1) {
511 } else {
512 zPos = addMapObjZposCount();
513 }
514 } else {
515 if (data->mLayer != LAYER_1) {
516 zPos = addZposCount_layer2();
517 } else {
518 zPos = addZposCount();
519 }
520 }
521 mVec3_c pos(data->mX + info->mSpawnOffsetX, -(data->mY - info->mSpawnOffsetY), zPos);
522
523 dActor_c::m_read_p_keep = spawnFlags;
524 *(u16 *) dActor_c::m_flag_keep = *(u16 *) data->mEventNums; // [Works in MWCC without the casts too]
525 dActor_c::m_mbgchoice_keep = data->mLayer;
526
527 u8 eventId1 = dActor_c::m_flag_keep[1];
528 u8 eventId2 = dActor_c::m_flag_keep[0];
530 if (eventId1 != 0) {
531 dActor_c::m_flagbit_keep = 1LL << (eventId1 - 1);
532 }
533 if (eventId2 != 0) {
534 dActor_c::m_flagbit_keep = 1LL << (eventId2 - 1);
535 }
536
537 dActor_c *actor = dActor_c::construct(data->getProfileName(), data->mParam, &pos, nullptr, data->mLayer);
538 if (actor != nullptr) {
539 if (data->mMapActorID >= 10) {
540 actor->mAreaNo = areaNo;
541 actor->mpSpawnFlags = spawnFlags;
542 actor->mpDeleteVal = deleteVal;
543 *(u16 *) actor->mEventNums = *(u16 *) dActor_c::m_flag_keep;
545 actor->mBlockHit = false;
546 actor->mSpriteSpawnFlags = info->mFlags;
547 // [Couldn't get this to match in a better way...]
548 float areaX = actor->mVisibleAreaSize.x;
549 if (!areaX) {
550 float areaY = actor->mVisibleAreaSize.y;
551 if (!areaY) {
552 actor->mVisibleAreaSize.set(info->mSpawnRangeHalfWidth * 2.0f, info->mSpawnRangeHalfHeight * 2.0f);
553 }
554 }
555 }
556 *spawnFlags |= dActor_c::ACTOR_SPAWNED;
557 }
558 return actor;
559}
Manager for map actor creation.
int mScreenTopPos
The screen's top edge.
int mZPosCount
The Z position index for the next spawned actor.
void incZposCount()
Updates the Z-position index for the next spawned actor.
bool mIsEndingDemo
Whether an end-of-level cutscene is active.
int mMapObjZPosCount
The Z position index for the next spawned non-enemy actor.
dActor_c * mapActorSpawn(sMapActorData *data, dActorData_c *info, u8 *spawnFlags, u16 *deleteVal, u8 areaNo)
Spawns an actor from the corresponding map actor data.
int mPrevScrollBoundaryTileY
The previous scroll boundary on the Y axis, used to check if the screen has scrolled.
bool GroupIdCheck(ulong param)
Checks whether the provided actor parameters contain a group ID definition.
void incZposCount_layer2()
Updates the Z-position index for the next spawned actor on layer 2.
bool ScroolAreaInCheck(int boundsEdge, int areaEdge, int boundMin, int boundMax, int areaMin, int areaMax)
Checks whether an actor should be spawned based on the camera's current scroll position.
void incMapObjZposCount_layer2()
Updates the Z-position index for the next spawned non-enemy actor on layer 2.
void setMapActorCreate_next()
Initializes map actors on area reload.
bool GlobalActorCheck(sMapActorData *data)
Checks whether the profile associated to the map actor is allowed to ignore screen bounds on spawn.
static const ProfileName l_GoAheadEnemy[]
The profiles allowed to spawn outside of the screen.
void processGroupId(sMapActorData *data, u8 file, u32 mapActorIdx)
Adds a group-based map actor to the group manager.
float addMapObjZposCount_layer2()
Gets the Z position for the next spawned non-enemy actor on layer 2.
void incMapObjZposCount()
Updates the Z-position index for the next spawned non-enemy actor.
int mMapObjZPosCountLayer2
The Z position index for the next spawned non-enemy actor on layer 2.
int mScreenLeftPos
The screen's left edge.
u8 mSpawnFlags[MAX_MAP_ACTOR_COUNT]
Flags indicating each map actor' spawn status. See dActor_c::ACTOR_SPAWN_FLAG_e.
u16 mYoshiColor
The color of the next spawned Yoshi (egg).
void ActorCreateInfoClear()
Resets all temporary data for map actor spawning.
int mPrevScrollBoundaryTileX
The previous scroll boundary on the X axis, used to check if the screen has scrolled.
int mZPosCountLayer2
The Z position index for the next spawned actor on layer 2.
void MapActorScroolCreateCheck()
Checks for screen scrolling and zoom changes to trigger spawning of nearby actors.
bool mIsGoalPoleDemo
Whether a goal flagpole cutscene is active.
void MapActorInital_next()
Triggers actor creation on area reload.
float addMapObjZposCount()
Gets the Z position for the next spawned non-enemy actor.
bool ScroolAreaInLoopCheck(int boundsEdge, int areaEdge, int boundMin, int boundMax, int areaMin, int areaMax)
Checks whether an actor should be spawned due to being close to a screen edge (for looping stages).
float addZposCount()
Gets the Z position for the next spawned actor.
float addZposCount_layer2()
Gets the Z position for the next spawned actor on layer 2.
void MapActorInital_set()
Triggers actor creation on first area load.
u16 mDeleteVals[MAX_MAP_ACTOR_COUNT]
A value that each map actor can write to when it is deleted.
void MapActorInitialCreate(sMapActorData *levelData, u16 *deleteVal, u8 *spawnFlags, int mapActorCount, bool isAreaReload)
Manages actor spawning when entering a level or area.
void MapActorScrollCreate(sMapActorCreateBounds *createBounds, int isScreenScroll)
Performs spawning of nearby actors as they enter the screen via scrolling or zoom changes.
void setMapActorCreate()
Initializes map actors on first area load.
static dActorCreateMng_c * m_instance
The static instance of the map actor creation manager.
The configuration for a map actor.
int mSpawnRangeOffsetY
The vertical offset of the actor's bounding box from the actor's position.
u16 mSpawnMarginBottom
The additional padding added to the bottom of the bounding box to prevent pop-in.
int mSpawnRangeHalfWidth
The half-width of the actor's bounding box.
u16 mFlags
Various flags that control map actor spawning behaviour. Value is a bitfield from MAP_ACTOR_INFO_FLAG...
int mSpawnOffsetY
The vertical offset from the map actor to the actor's spawn position.
u16 mSpawnMarginTop
The additional padding added to the top of the bounding box to prevent pop-in.
u16 mSpawnMarginLeft
The additional padding added to the left of the bounding box to prevent pop-in.
int mSpawnRangeOffsetX
The horizontal offset of the actor's bounding box from the actor's position.
int mSpawnOffsetX
The horizontal offset from the map actor to the actor's spawn position.
u16 mSpawnMarginRight
The additional padding added to the right of the bounding box to prevent pop-in.
int mSpawnRangeHalfHeight
The half-height of the actor's bounding box.
The minimum required implementation for a stage actor.
Definition d_actor.hpp:15
static dActor_c * construct(ProfileName profName, unsigned long param, const mVec3_c *position, const mAng3_c *rotation, u8 layer)
Creates a stage actor without a parent.
Definition d_actor.cpp:166
static u8 m_flag_keep[2]
Temporary storage for the next created sprite actor's tracked event IDs. See mEventNums.
Definition d_actor.hpp:407
bool mBlockHit
Whether a block below the actor was hit.
Definition d_actor.hpp:362
static u64 m_flagbit_keep
Temporary storage for the next created sprite actor's event mask. See mEventMask.
Definition d_actor.hpp:410
u8 * mpSpawnFlags
The spawn flags for the actor. See ACTOR_SPAWN_FLAG_e.
Definition d_actor.hpp:355
mVec2_c mVisibleAreaSize
The size of the area inside which the actor is visible.
Definition d_actor.hpp:347
u8 mAreaNo
The actor's zone ID.
Definition d_actor.hpp:352
u8 mEventNums[2]
The event IDs the actor is tracking.
Definition d_actor.hpp:357
u64 mEventMask
The event mask, generated from mEventNums.
Definition d_actor.hpp:358
static u8 * m_read_p_keep
Temporary storage for the next created sprite actor's spawn flags. See mpSpawnFlags.
Definition d_actor.hpp:404
u16 mSpriteSpawnFlags
The spawn flags from the sprite data entry.
Definition d_actor.hpp:361
@ ACTOR_SPAWNED
The actor is spawned.
Definition d_actor.hpp:69
u16 * mpDeleteVal
Definition d_actor.hpp:356
static u8 m_mbgchoice_keep
Temporary storage for the next created sprite actor's layer. See mLayer.
Definition d_actor.hpp:413
u8 mScrollDirY
See BG_SCROLL_DIR_Y_e.
u8 mScrollDirX
See BG_SCROLL_DIR_X_e.
Course data file holder. A course data file contains the actual course elements - areas,...
Definition d_cd.hpp:11
sMapActorData * mMapActorsByArea[MAX_AREAS]
Pointers to the first map actor for an area.
Definition d_cd.hpp:83
u32 mMapActorCountByArea[MAX_AREAS]
Number of map actors per area.
Definition d_cd.hpp:84
u32 mMapActorIdxForArea[MAX_AREAS]
Index of the first map actor for an area.
Definition d_cd.hpp:85
static unsigned int mGameFlag
See GAME_FLAG_e.
Definition d_info.hpp:76
A three-dimensional floating point vector.
Definition m_vec.hpp:107
#define Z_POS_COUNT
The number of Z positions inside a layer.
#define MAX_MAP_ACTOR_COUNT
The maximum number of map actors that can exist simultaneously.
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32