CustomActor
A library for defining custom actors
模組介紹 作者原文
CustomActor
A library for defining custom actors
Usage
RECOMP_IMPORT("ProxyMM_CustomActor", s16 CustomActor_Register(ActorProfile* profile));
typedef struct MyCustomActor {
//...
} MyCustomActor;
ActorProfile MyCustomActor_Profile = {
ACTOR_ID_MAX, // This will be replaced
ACTORCAT_BG,
FLAGS,
GAMEPLAY_KEEP, // GAMEPLAY_KEEP is always loaded, so safe bet if you're not using stuff from another actor
sizeof(MyCustomActor),
MyCustomActor_Init,
MyCustomActor_Destroy,
MyCustomActor_Update,
MyCustomActor_Draw,
};
s16 ACTOR_MY_CUSTOM_ACTOR = ACTOR_ID_MAX;
RECOMP_CALLBACK("*", recomp_on_init)
void MyCustomActor_OnRecompInit() {
ACTOR_MY_CUSTOM_ACTOR = CustomActor_Register(&Bg_Haka_Profile);
}
RECOMP_HOOK("Actor_SpawnTransitionActors")
void MyCustomActor_Spawner(PlayState play, ActorContext actorCtx) {
if (play->sceneId == SCENE_CLOCKTOWER) {
Actor_SpawnAsChildAndCutscene(actorCtx, play, ACTOR_MY_CUSTOM_ACTOR, -367.0f, 0.0f, -245.0f, 0, 0x8000, 0, 0, 0, 0, 0);
}
}
Note
This library doesn't currently guarantee support for Custom actors being loaded from SceneCommands data. You may get it to work using hardcoded IDs but it's not something I would recommend relying on. For now hooking Actor_SpawnTransitionActors and checking sceneId and roomNum should work for most use cases.
This also does not use the overlay loading system, so static variables will not be reset when all instances of the actor are unloaded.
Examples
You can see an example of how this can be used in the examples/ directory in the repository. Feel free to submit PR's for more examples.
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。