mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 15:04:31 +00:00
InitVars
-> Profile
(#2011)
* rename ActorInit * rename actorInit * rename initInfo * EffectSs Profile * _InitVars -> _Profile * format, loose ends * revert tutorial
This commit is contained in:
parent
a083a15650
commit
078e21f6c6
472 changed files with 525 additions and 521 deletions
|
@ -2834,7 +2834,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
s16 rotY, s16 rotZ, s16 params) {
|
||||
s32 pad;
|
||||
Actor* actor;
|
||||
ActorInit* actorInit;
|
||||
ActorProfile* profile;
|
||||
s32 objectSlot;
|
||||
ActorOverlay* overlayEntry;
|
||||
uintptr_t temp;
|
||||
|
@ -2862,7 +2862,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
if (overlayEntry->vramStart == NULL) {
|
||||
ACTOR_DEBUG_PRINTF("オーバーレイではありません\n"); // "Not an overlay"
|
||||
|
||||
actorInit = overlayEntry->initInfo;
|
||||
profile = overlayEntry->profile;
|
||||
} else {
|
||||
if (overlayEntry->loadedRamAddr != NULL) {
|
||||
ACTOR_DEBUG_PRINTF("既にロードされています\n"); // "Already loaded"
|
||||
|
@ -2905,30 +2905,30 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
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);
|
||||
}
|
||||
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, actorInit->objectId);
|
||||
objectSlot = Object_GetSlot(&play->objectCtx, profile->objectId);
|
||||
|
||||
if ((objectSlot < 0) ||
|
||||
((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) {
|
||||
((profile->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) {
|
||||
// "No data bank!! <data bank=%d> (profilep->bank=%d)"
|
||||
PRINTF(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, objectSlot,
|
||||
actorInit->objectId);
|
||||
profile->objectId);
|
||||
Actor_FreeOverlay(overlayEntry);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
actor = ZELDA_ARENA_MALLOC(actorInit->instanceSize, name, 1);
|
||||
actor = ZELDA_ARENA_MALLOC(profile->instanceSize, name, 1);
|
||||
|
||||
if (actor == NULL) {
|
||||
// "Actor class cannot be reserved! %s <size=%d bytes>"
|
||||
PRINTF(VT_COL(RED, WHITE) "Actorクラス確保できません! %s <サイズ=%dバイト>\n", VT_RST, name,
|
||||
actorInit->instanceSize);
|
||||
profile->instanceSize);
|
||||
Actor_FreeOverlay(overlayEntry);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2942,32 +2942,36 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
// "Actor client No. %d"
|
||||
ACTOR_DEBUG_PRINTF("アクタークライアントは %d 個目です\n", overlayEntry->numLoaded);
|
||||
|
||||
Lib_MemSet((u8*)actor, actorInit->instanceSize, 0);
|
||||
Lib_MemSet((u8*)actor, profile->instanceSize, 0);
|
||||
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;
|
||||
|
||||
actor->room = play->roomCtx.curRoom.num;
|
||||
|
||||
actor->home.pos.x = posX;
|
||||
actor->home.pos.y = posY;
|
||||
actor->home.pos.z = posZ;
|
||||
|
||||
actor->home.rot.x = rotX;
|
||||
actor->home.rot.y = rotY;
|
||||
actor->home.rot.z = rotZ;
|
||||
|
||||
actor->params = params;
|
||||
|
||||
Actor_AddToCategory(actorCtx, actor, actorInit->category);
|
||||
Actor_AddToCategory(actorCtx, actor, profile->category);
|
||||
|
||||
temp = gSegments[6];
|
||||
Actor_Init(actor, play);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#undef DEFINE_ACTOR_INTERNAL
|
||||
#undef DEFINE_ACTOR_UNSET
|
||||
|
||||
// Init Vars declarations (also used in the table below)
|
||||
#define DEFINE_ACTOR(name, _1, _2, _3) extern ActorInit name##_InitVars;
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _1, _2, _3) extern ActorInit name##_InitVars;
|
||||
// Profile declarations (also used in the table below)
|
||||
#define DEFINE_ACTOR(name, _1, _2, _3) extern ActorProfile name##_Profile;
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _1, _2, _3) extern ActorProfile name##_Profile;
|
||||
#define DEFINE_ACTOR_UNSET(_0)
|
||||
|
||||
#include "tables/actor_table.h"
|
||||
|
@ -31,15 +31,15 @@
|
|||
_ovl_##name##SegmentStart, \
|
||||
_ovl_##name##SegmentEnd, \
|
||||
NULL, \
|
||||
&name##_InitVars, \
|
||||
&name##_Profile, \
|
||||
nameString, \
|
||||
allocType, \
|
||||
0, \
|
||||
},
|
||||
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \
|
||||
{ \
|
||||
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_InitVars, nameString, allocType, 0, \
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \
|
||||
{ \
|
||||
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_Profile, nameString, allocType, 0, \
|
||||
},
|
||||
|
||||
#else
|
||||
|
@ -51,15 +51,15 @@
|
|||
_ovl_##name##SegmentStart, \
|
||||
_ovl_##name##SegmentEnd, \
|
||||
NULL, \
|
||||
&name##_InitVars, \
|
||||
&name##_Profile, \
|
||||
NULL, \
|
||||
allocType, \
|
||||
0, \
|
||||
},
|
||||
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, _3) \
|
||||
{ \
|
||||
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_InitVars, NULL, allocType, 0, \
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, _3) \
|
||||
{ \
|
||||
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_Profile, NULL, allocType, 0, \
|
||||
},
|
||||
|
||||
#endif
|
||||
|
@ -88,7 +88,7 @@ void ActorOverlayTable_LogPrint(void) {
|
|||
|
||||
for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < (u32)gMaxActorId; i++, overlayEntry++) {
|
||||
PRINTF("%08x %08x %08x %08x %08x %08x %s\n", overlayEntry->file.vromStart, overlayEntry->file.vromEnd,
|
||||
overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, &overlayEntry->initInfo->id,
|
||||
overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, &overlayEntry->profile->id,
|
||||
overlayEntry->name != NULL ? overlayEntry->name : "?");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -174,7 +174,7 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
|
|||
s32 index;
|
||||
u32 overlaySize;
|
||||
EffectSsOverlay* overlayEntry;
|
||||
EffectSsInit* initInfo;
|
||||
EffectSsProfile* profile;
|
||||
|
||||
overlayEntry = &gEffectSsOverlayTable[type];
|
||||
|
||||
|
@ -191,7 +191,7 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
|
|||
if (overlayEntry->vramStart == NULL) {
|
||||
// "Not an overlay"
|
||||
PRINTF("EffectSoftSprite2_makeEffect():オーバーレイではありません。\n");
|
||||
initInfo = overlayEntry->initInfo;
|
||||
profile = overlayEntry->profile;
|
||||
} else {
|
||||
if (overlayEntry->loadedRamAddr == NULL) {
|
||||
overlayEntry->loadedRamAddr = ZELDA_ARENA_MALLOC_R(overlaySize, "../z_effect_soft_sprite.c", 585);
|
||||
|
@ -218,19 +218,19 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
|
|||
PRINTF(VT_RST);
|
||||
}
|
||||
|
||||
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) {
|
||||
// "Effects have already been loaded, but the constructor is NULL so the addition will not occur.
|
||||
// Please fix this. (Waste of memory) %08x %d"
|
||||
PRINTF("EffectSoftSprite2_makeEffect():すでにエフェクトはロード済みで\nすが,"
|
||||
"コンストラクターがNULLなので追加をやめます。\n直してください。(メモリーの無駄) %08x %d\n",
|
||||
initInfo, type);
|
||||
profile, type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
|
|||
sEffectSsInfo.table[index].type = type;
|
||||
sEffectSsInfo.table[index].priority = priority;
|
||||
|
||||
if (initInfo->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) {
|
||||
if (profile->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) {
|
||||
PRINTF(VT_FGCOL(GREEN));
|
||||
// "Construction failed for some reason. The constructor returned an error.
|
||||
// Ceasing effect addition."
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#undef DEFINE_EFFECT_SS
|
||||
#undef DEFINE_EFFECT_SS_UNSET
|
||||
|
||||
// Init Vars declarations (also used in the table below)
|
||||
#define DEFINE_EFFECT_SS(name, _1) extern EffectSsInit name##_InitVars;
|
||||
// Profile declarations (also used in the table below)
|
||||
#define DEFINE_EFFECT_SS(name, _1) extern EffectSsProfile name##_Profile;
|
||||
#define DEFINE_EFFECT_SS_UNSET(_0)
|
||||
|
||||
#include "tables/effect_ss_table.h"
|
||||
|
@ -19,9 +19,9 @@
|
|||
#undef DEFINE_EFFECT_SS_UNSET
|
||||
|
||||
// Effect SS Overlay Table definition
|
||||
#define DEFINE_EFFECT_SS(name, _1) \
|
||||
{ \
|
||||
ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, NULL, &name##_InitVars, 1, \
|
||||
#define DEFINE_EFFECT_SS(name, _1) \
|
||||
{ \
|
||||
ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, NULL, &name##_Profile, 1, \
|
||||
},
|
||||
|
||||
#define DEFINE_EFFECT_SS_UNSET(_0) \
|
||||
|
|
|
@ -20,7 +20,7 @@ void EnAObj_SetupBlockRot(EnAObj* this, s16 type);
|
|||
void EnAObj_SetupBoulderFragment(EnAObj* this, s16 type);
|
||||
void EnAObj_SetupBlock(EnAObj* this, s16 type);
|
||||
|
||||
ActorInit En_A_Obj_InitVars = {
|
||||
ActorProfile En_A_Obj_Profile = {
|
||||
/**/ ACTOR_EN_A_OBJ,
|
||||
/**/ ACTORCAT_PROP,
|
||||
/**/ FLAGS,
|
||||
|
|
|
@ -20,7 +20,7 @@ void EnItem00_DrawCollectible(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,
|
||||
|
|
|
@ -17,7 +17,7 @@ void Player_Destroy(Actor* thisx, PlayState* play);
|
|||
void Player_Update(Actor* thisx, PlayState* play);
|
||||
void Player_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
ActorInit Player_InitVars = {
|
||||
ActorProfile Player_Profile = {
|
||||
/**/ ACTOR_PLAYER,
|
||||
/**/ ACTORCAT_PLAYER,
|
||||
/**/ FLAGS,
|
||||
|
|
|
@ -205,7 +205,7 @@ BAD_RETURN(s32) Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) {
|
|||
|
||||
linkObjectId = gLinkObjectIds[((void)0, gSaveContext.save.linkAge)];
|
||||
|
||||
gActorOverlayTable[playerEntry->id].initInfo->objectId = linkObjectId;
|
||||
gActorOverlayTable[playerEntry->id].profile->objectId = linkObjectId;
|
||||
Object_SpawnPersistent(&play->objectCtx, linkObjectId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue