summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2024-08-02 17:50:02 -0400
committerGitHub <noreply@github.com>2024-08-02 17:50:02 -0400
commit078e21f6c62b5acb4744cefd97718f63bc622831 (patch)
tree14e2c5a9f8c0d8730b4894c9e4d32f6456e3f67f /src/code
parenta083a15650496db67aa057127c13ad75fbaaab7f (diff)
`InitVars` -> `Profile` (#2011)
* rename ActorInit * rename actorInit * rename initInfo * EffectSs Profile * _InitVars -> _Profile * format, loose ends * revert tutorial
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_actor.c46
-rw-r--r--src/code/z_actor_dlftbls.c24
-rw-r--r--src/code/z_effect_soft_sprite.c20
-rw-r--r--src/code/z_effect_soft_sprite_dlftbls.c10
-rw-r--r--src/code/z_en_a_keep.c2
-rw-r--r--src/code/z_en_item00.c2
-rw-r--r--src/code/z_player_call.c2
-rw-r--r--src/code/z_scene.c2
8 files changed, 56 insertions, 52 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 890a05a68..620586961 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -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);
diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c
index 4a6ce2567..ff162db4b 100644
--- a/src/code/z_actor_dlftbls.c
+++ b/src/code/z_actor_dlftbls.c
@@ -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
diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c
index 20691e716..d6d58659d 100644
--- a/src/code/z_effect_soft_sprite.c
+++ b/src/code/z_effect_soft_sprite.c
@@ -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."
diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c
index 3fb498b33..cb24257c8 100644
--- a/src/code/z_effect_soft_sprite_dlftbls.c
+++ b/src/code/z_effect_soft_sprite_dlftbls.c
@@ -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) \
diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c
index 21c5ebd75..57799c22e 100644
--- a/src/code/z_en_a_keep.c
+++ b/src/code/z_en_a_keep.c
@@ -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,
diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c
index 9e2e76249..7306c4689 100644
--- a/src/code/z_en_item00.c
+++ b/src/code/z_en_item00.c
@@ -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,
diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c
index 1eb12319c..38812cb0f 100644
--- a/src/code/z_player_call.c
+++ b/src/code/z_player_call.c
@@ -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,
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index 849d936a4..1de6f7a61 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -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);
}