mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-04 10:48:25 -04:00
InitVars -> Profile (#1697)
* ActorProfile * EffectSsProfile * TransitionProfile * variables.txt
This commit is contained in:
+25
-25
@@ -3273,15 +3273,15 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
||||
CS_ID_NONE, HALFDAYBIT_ALL, NULL);
|
||||
}
|
||||
|
||||
ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) {
|
||||
ActorProfile* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) {
|
||||
size_t overlaySize;
|
||||
ActorOverlay* overlayEntry = &gActorOverlayTable[index];
|
||||
ActorInit* actorInit;
|
||||
ActorProfile* profile;
|
||||
|
||||
overlaySize = (uintptr_t)overlayEntry->vramEnd - (uintptr_t)overlayEntry->vramStart;
|
||||
|
||||
if (overlayEntry->vramStart == NULL) {
|
||||
actorInit = overlayEntry->initInfo;
|
||||
profile = overlayEntry->profile;
|
||||
} else {
|
||||
if (overlayEntry->loadedRamAddr == NULL) {
|
||||
if (overlayEntry->allocType & ALLOCTYPE_ABSOLUTE) {
|
||||
@@ -3304,21 +3304,21 @@ ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) {
|
||||
overlayEntry->numLoaded = 0;
|
||||
}
|
||||
|
||||
actorInit = (void*)(uintptr_t)((overlayEntry->initInfo != NULL)
|
||||
? (void*)((uintptr_t)overlayEntry->initInfo -
|
||||
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
||||
(uintptr_t)overlayEntry->loadedRamAddr))
|
||||
: NULL);
|
||||
profile = (void*)(uintptr_t)((overlayEntry->profile != NULL)
|
||||
? (void*)((uintptr_t)overlayEntry->profile -
|
||||
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
||||
(uintptr_t)overlayEntry->loadedRamAddr))
|
||||
: NULL);
|
||||
}
|
||||
|
||||
return actorInit;
|
||||
return profile;
|
||||
}
|
||||
|
||||
Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX,
|
||||
s16 rotY, s16 rotZ, s32 params, u32 csId, u32 halfDaysBits, Actor* parent) {
|
||||
s32 pad;
|
||||
Actor* actor;
|
||||
ActorInit* actorInit;
|
||||
ActorProfile* profile;
|
||||
s32 objectSlot;
|
||||
ActorOverlay* overlayEntry;
|
||||
|
||||
@@ -3326,20 +3326,20 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1
|
||||
return NULL;
|
||||
}
|
||||
|
||||
actorInit = Actor_LoadOverlay(actorCtx, index);
|
||||
if (actorInit == NULL) {
|
||||
profile = Actor_LoadOverlay(actorCtx, index);
|
||||
if (profile == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, actorInit->objectId);
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, profile->objectId);
|
||||
if ((objectSlot <= OBJECT_SLOT_NONE) ||
|
||||
((actorInit->type == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num) &&
|
||||
(actorInit->id != ACTOR_BOSS_05))) {
|
||||
((profile->type == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num) &&
|
||||
(profile->id != ACTOR_BOSS_05))) {
|
||||
Actor_FreeOverlay(&gActorOverlayTable[index]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
actor = ZeldaArena_Malloc(actorInit->instanceSize);
|
||||
actor = ZeldaArena_Malloc(profile->instanceSize);
|
||||
if (actor == NULL) {
|
||||
Actor_FreeOverlay(&gActorOverlayTable[index]);
|
||||
return NULL;
|
||||
@@ -3350,22 +3350,22 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1
|
||||
overlayEntry->numLoaded++;
|
||||
}
|
||||
|
||||
bzero(actor, actorInit->instanceSize);
|
||||
bzero(actor, profile->instanceSize);
|
||||
actor->overlayEntry = overlayEntry;
|
||||
actor->id = actorInit->id;
|
||||
actor->flags = actorInit->flags;
|
||||
actor->id = profile->id;
|
||||
actor->flags = profile->flags;
|
||||
|
||||
if (actorInit->id == ACTOR_EN_PART) {
|
||||
if (profile->id == ACTOR_EN_PART) {
|
||||
actor->objectSlot = rotZ;
|
||||
rotZ = 0;
|
||||
} else {
|
||||
actor->objectSlot = objectSlot;
|
||||
}
|
||||
|
||||
actor->init = actorInit->init;
|
||||
actor->destroy = actorInit->destroy;
|
||||
actor->update = actorInit->update;
|
||||
actor->draw = actorInit->draw;
|
||||
actor->init = profile->init;
|
||||
actor->destroy = profile->destroy;
|
||||
actor->update = profile->update;
|
||||
actor->draw = profile->draw;
|
||||
|
||||
if (parent != NULL) {
|
||||
actor->room = parent->room;
|
||||
@@ -3394,7 +3394,7 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1
|
||||
actor->halfDaysBits = HALFDAYBIT_ALL;
|
||||
}
|
||||
|
||||
Actor_AddToCategory(actorCtx, actor, actorInit->type);
|
||||
Actor_AddToCategory(actorCtx, actor, profile->type);
|
||||
|
||||
{
|
||||
uintptr_t prevSeg = gSegments[0x06];
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
#include "fault.h"
|
||||
|
||||
// Segment and InitVars declarations (also used in the table below)
|
||||
// Segment and Profile declarations (also used in the table below)
|
||||
#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName) \
|
||||
extern struct ActorInit name##_InitVars; \
|
||||
extern struct ActorProfile name##_Profile; \
|
||||
DECLARE_OVERLAY_SEGMENT(name)
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, _allocType, _debugName) extern struct ActorInit name##_InitVars;
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, _allocType, _debugName) extern struct ActorProfile name##_Profile;
|
||||
#define DEFINE_ACTOR_UNSET(_enumValue)
|
||||
|
||||
#include "tables/actor_table.h"
|
||||
@@ -22,15 +22,15 @@
|
||||
SEGMENT_START(ovl_##name), \
|
||||
SEGMENT_END(ovl_##name), \
|
||||
NULL, \
|
||||
&name##_InitVars, \
|
||||
&name##_Profile, \
|
||||
NULL, \
|
||||
allocType, \
|
||||
0, \
|
||||
},
|
||||
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, allocType, _debugName) \
|
||||
{ \
|
||||
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_InitVars, NULL, allocType, 0, \
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, allocType, _debugName) \
|
||||
{ \
|
||||
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_Profile, NULL, allocType, 0, \
|
||||
},
|
||||
|
||||
#define DEFINE_ACTOR_UNSET(_enumValue) { 0 },
|
||||
|
||||
@@ -171,7 +171,7 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initData) {
|
||||
s32 index;
|
||||
u32 overlaySize;
|
||||
EffectSsOverlay* overlayEntry = &gParticleOverlayTable[type];
|
||||
EffectSsInit* initInfo;
|
||||
EffectSsProfile* profile;
|
||||
|
||||
if (EffectSS_FindFreeSpace(priority, &index) != 0) {
|
||||
// Abort because we couldn't find a suitable slot to add this effect in
|
||||
@@ -182,7 +182,7 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initData) {
|
||||
overlaySize = (uintptr_t)overlayEntry->vramEnd - (uintptr_t)overlayEntry->vramStart;
|
||||
|
||||
if (overlayEntry->vramStart == NULL) {
|
||||
initInfo = overlayEntry->initInfo;
|
||||
profile = overlayEntry->profile;
|
||||
} else {
|
||||
if (overlayEntry->loadedRamAddr == NULL) {
|
||||
overlayEntry->loadedRamAddr = ZeldaArena_MallocR(overlaySize);
|
||||
@@ -195,21 +195,21 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initData) {
|
||||
overlayEntry->vramEnd, overlayEntry->loadedRamAddr);
|
||||
}
|
||||
|
||||
initInfo = (void*)(uintptr_t)((overlayEntry->initInfo != NULL)
|
||||
? (void*)((uintptr_t)overlayEntry->initInfo -
|
||||
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
||||
(uintptr_t)overlayEntry->loadedRamAddr))
|
||||
: NULL);
|
||||
profile = (void*)(uintptr_t)((overlayEntry->profile != NULL)
|
||||
? (void*)((uintptr_t)overlayEntry->profile -
|
||||
(intptr_t)((uintptr_t)overlayEntry->vramStart -
|
||||
(uintptr_t)overlayEntry->loadedRamAddr))
|
||||
: NULL);
|
||||
}
|
||||
|
||||
if (initInfo->init != NULL) {
|
||||
if (profile->init != NULL) {
|
||||
// Delete the previous effect in the slot, in case the slot wasn't free
|
||||
EffectSS_Delete(&sEffectSsInfo.dataTable[index]);
|
||||
|
||||
sEffectSsInfo.dataTable[index].type = type;
|
||||
sEffectSsInfo.dataTable[index].priority = priority;
|
||||
|
||||
if (initInfo->init(play, index, &sEffectSsInfo.dataTable[index], initData) == 0) {
|
||||
if (profile->init(play, index, &sEffectSsInfo.dataTable[index], initData) == 0) {
|
||||
EffectSS_ResetEntry(&sEffectSsInfo.dataTable[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "z64effect_ss.h"
|
||||
#include "segment_symbols.h"
|
||||
|
||||
// Init Vars and linker symbol declarations (used in the table below)
|
||||
// Profile and linker symbol declarations (used in the table below)
|
||||
#define DEFINE_EFFECT_SS(name, _enumValue) \
|
||||
extern EffectSsInit name##_InitVars; \
|
||||
extern EffectSsProfile name##_Profile; \
|
||||
DECLARE_OVERLAY_SEGMENT(name)
|
||||
|
||||
#define DEFINE_EFFECT_SS_UNSET(_enumValue)
|
||||
@@ -13,9 +13,9 @@
|
||||
#undef DEFINE_EFFECT_SS
|
||||
#undef DEFINE_EFFECT_SS_UNSET
|
||||
|
||||
#define DEFINE_EFFECT_SS(name, _enumValue) \
|
||||
{ \
|
||||
ROM_FILE(ovl_##name), SEGMENT_START(ovl_##name), SEGMENT_END(ovl_##name), NULL, &name##_InitVars, 1, \
|
||||
#define DEFINE_EFFECT_SS(name, _enumValue) \
|
||||
{ \
|
||||
ROM_FILE(ovl_##name), SEGMENT_START(ovl_##name), SEGMENT_END(ovl_##name), NULL, &name##_Profile, 1, \
|
||||
},
|
||||
|
||||
#define DEFINE_EFFECT_SS_UNSET(_enumValue) { 0 },
|
||||
|
||||
@@ -13,7 +13,7 @@ void EnAObj_Draw(Actor* thisx, PlayState* play);
|
||||
void EnAObj_Idle(EnAObj* this, PlayState* play);
|
||||
void EnAObj_Talk(EnAObj* this, PlayState* play);
|
||||
|
||||
ActorInit En_A_Obj_InitVars = {
|
||||
ActorProfile En_A_Obj_Profile = {
|
||||
/**/ ACTOR_EN_A_OBJ,
|
||||
/**/ ACTORCAT_PROP,
|
||||
/**/ FLAGS,
|
||||
|
||||
@@ -25,7 +25,7 @@ void EnItem00_DrawSprite(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
|
||||
|
||||
ActorInit En_Item00_InitVars = {
|
||||
ActorProfile En_Item00_Profile = {
|
||||
/**/ ACTOR_EN_ITEM00,
|
||||
/**/ ACTORCAT_MISC,
|
||||
/**/ FLAGS,
|
||||
|
||||
@@ -31,7 +31,7 @@ void TransitionCircle_SetType(void* thisx, s32 type);
|
||||
void TransitionCircle_Draw(void* thisx, Gfx** gfxp);
|
||||
s32 TransitionCircle_IsDone(void* thisx);
|
||||
|
||||
TransitionInit TransitionCircle_InitVars = {
|
||||
TransitionProfile TransitionCircle_Profile = {
|
||||
TransitionCircle_Init, TransitionCircle_Destroy, TransitionCircle_Update, TransitionCircle_Draw,
|
||||
TransitionCircle_Start, TransitionCircle_SetType, TransitionCircle_SetColor, NULL,
|
||||
TransitionCircle_IsDone,
|
||||
|
||||
+18
-18
@@ -3,12 +3,12 @@
|
||||
#include "segment_symbols.h"
|
||||
#include "z64lib.h"
|
||||
|
||||
// InitVars and Linker symbol declarations (used in the table below)
|
||||
// Profile and Linker symbol declarations (used in the table below)
|
||||
#define DEFINE_TRANSITION(_enumValue, structName, _instanceName, name) \
|
||||
extern TransitionInit structName##_InitVars; \
|
||||
extern TransitionProfile structName##_Profile; \
|
||||
DECLARE_OVERLAY_SEGMENT(name)
|
||||
|
||||
#define DEFINE_TRANSITION_INTERNAL(_enumValue, structName, _instanceName) extern TransitionInit structName##_InitVars;
|
||||
#define DEFINE_TRANSITION_INTERNAL(_enumValue, structName, _instanceName) extern TransitionProfile structName##_Profile;
|
||||
|
||||
#include "tables/transition_table.h"
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
SEGMENT_START(ovl_##name), \
|
||||
SEGMENT_END(ovl_##name), \
|
||||
ROM_FILE(ovl_##name), \
|
||||
&structName##_InitVars, \
|
||||
&structName##_Profile, \
|
||||
sizeof(structName), \
|
||||
},
|
||||
|
||||
#define DEFINE_TRANSITION_INTERNAL(_enumValue, structName, _instanceName) \
|
||||
{ { 0, 0 }, NULL, NULL, 0, 0, &structName##_InitVars, sizeof(structName) },
|
||||
{ { 0, 0 }, NULL, NULL, 0, 0, &structName##_Profile, sizeof(structName) },
|
||||
|
||||
TransitionOverlay gTransitionOverlayTable[] = {
|
||||
#include "tables/transition_table.h"
|
||||
@@ -38,25 +38,25 @@ TransitionOverlay gTransitionOverlayTable[] = {
|
||||
void Transition_Init(TransitionContext* transitionCtx) {
|
||||
TransitionOverlay* overlayEntry;
|
||||
ptrdiff_t relocOffset;
|
||||
TransitionInit* initInfo[1];
|
||||
TransitionProfile* profile[1];
|
||||
|
||||
overlayEntry = &gTransitionOverlayTable[transitionCtx->fbdemoType];
|
||||
TransitionOverlay_Load(overlayEntry);
|
||||
|
||||
relocOffset = (uintptr_t)Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr) - (uintptr_t)overlayEntry->vramStart;
|
||||
initInfo[0] = NULL;
|
||||
initInfo[0] = (overlayEntry->initInfo != NULL) ? (TransitionInit*)((uintptr_t)overlayEntry->initInfo + relocOffset)
|
||||
: initInfo[0];
|
||||
profile[0] = NULL;
|
||||
profile[0] = (overlayEntry->profile != NULL) ? (TransitionProfile*)((uintptr_t)overlayEntry->profile + relocOffset)
|
||||
: profile[0];
|
||||
|
||||
transitionCtx->init = initInfo[0]->init;
|
||||
transitionCtx->destroy = initInfo[0]->destroy;
|
||||
transitionCtx->start = initInfo[0]->start;
|
||||
transitionCtx->isDone = initInfo[0]->isDone;
|
||||
transitionCtx->draw = initInfo[0]->draw;
|
||||
transitionCtx->update = initInfo[0]->update;
|
||||
transitionCtx->setType = initInfo[0]->setType;
|
||||
transitionCtx->setColor = initInfo[0]->setColor;
|
||||
transitionCtx->setEnvColor = initInfo[0]->setEnvColor;
|
||||
transitionCtx->init = profile[0]->init;
|
||||
transitionCtx->destroy = profile[0]->destroy;
|
||||
transitionCtx->start = profile[0]->start;
|
||||
transitionCtx->isDone = profile[0]->isDone;
|
||||
transitionCtx->draw = profile[0]->draw;
|
||||
transitionCtx->update = profile[0]->update;
|
||||
transitionCtx->setType = profile[0]->setType;
|
||||
transitionCtx->setColor = profile[0]->setColor;
|
||||
transitionCtx->setEnvColor = profile[0]->setEnvColor;
|
||||
}
|
||||
|
||||
void Transition_Destroy(TransitionContext* transitionCtx) {
|
||||
|
||||
@@ -30,7 +30,7 @@ static Gfx sTransFadeSetupDL[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
TransitionInit TransitionFade_InitVars = {
|
||||
TransitionProfile TransitionFade_Profile = {
|
||||
TransitionFade_Init, TransitionFade_Destroy, TransitionFade_Update, TransitionFade_Draw,
|
||||
TransitionFade_Start, TransitionFade_SetType, TransitionFade_SetColor, NULL,
|
||||
TransitionFade_IsDone,
|
||||
|
||||
@@ -10,7 +10,7 @@ ActorFunc sPlayerCallDestroyFunc;
|
||||
ActorFunc sPlayerCallUpdateFunc;
|
||||
ActorFunc sPlayerCallDrawFunc;
|
||||
|
||||
ActorInit Player_InitVars = {
|
||||
ActorProfile Player_Profile = {
|
||||
/**/ ACTOR_PLAYER,
|
||||
/**/ ACTORCAT_PLAYER,
|
||||
/**/ FLAGS,
|
||||
|
||||
@@ -393,11 +393,11 @@ void func_8012301C(Actor* thisx, PlayState* play2) {
|
||||
if (this->av1.actionVar1 == 2) {
|
||||
s16 objectId = gPlayerFormObjectIds[GET_PLAYER_FORM];
|
||||
|
||||
gActorOverlayTable[ACTOR_PLAYER].initInfo->objectId = objectId;
|
||||
gActorOverlayTable[ACTOR_PLAYER].profile->objectId = objectId;
|
||||
func_8012F73C(&play->objectCtx, this->actor.objectSlot, objectId);
|
||||
this->actor.objectSlot = Object_GetSlot(&play->objectCtx, GAMEPLAY_KEEP);
|
||||
} else if (this->av1.actionVar1 >= 3) {
|
||||
s32 objectSlot = Object_GetSlot(&play->objectCtx, gActorOverlayTable[ACTOR_PLAYER].initInfo->objectId);
|
||||
s32 objectSlot = Object_GetSlot(&play->objectCtx, gActorOverlayTable[ACTOR_PLAYER].profile->objectId);
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, objectSlot)) {
|
||||
this->actor.objectSlot = objectSlot;
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) {
|
||||
play->objectCtx.numEntries = loadedCount;
|
||||
play->objectCtx.numPersistentEntries = loadedCount;
|
||||
playerObjectId = gPlayerFormObjectIds[GET_PLAYER_FORM];
|
||||
gActorOverlayTable[0].initInfo->objectId = playerObjectId;
|
||||
gActorOverlayTable[ACTOR_PLAYER].profile->objectId = playerObjectId;
|
||||
Object_SpawnPersistent(&play->objectCtx, playerObjectId);
|
||||
|
||||
play->objectCtx.slots[play->objectCtx.numEntries].segment = objectPtr;
|
||||
|
||||
Reference in New Issue
Block a user