1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-08 15:30:14 +00:00

More actor cleanup Part 2 (#116)

* Change all main actor functions to take a 'Actor* thisx' argument

* Change all actor callbacks to also take a 'Actor* thisx' argument
This commit is contained in:
Roman971 2020-05-04 21:02:51 +02:00 committed by GitHub
parent 8efddb0fe0
commit f114df8929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
429 changed files with 3689 additions and 2523 deletions

View file

@ -8,13 +8,16 @@
#define FLAGS 0x00000010
#define THIS ((BgMjin*)thisx)
void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx);
void BgMjin_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgMjin_Update(Actor* thisx, GlobalContext* globalCtx);
void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgMjin_SetupAction(BgMjin* this, ActorFunc actionFunc);
void BgMjin_Init(BgMjin* this, GlobalContext* globalCtx);
void BgMjin_Destroy(BgMjin* this, GlobalContext* globalCtx);
void func_808A0850(BgMjin* this, GlobalContext* globalCtx);
void func_808A0920(BgMjin* this, GlobalContext* globalCtx);
void BgMjin_Update(BgMjin* this, GlobalContext* globalCtx);
void BgMjin_Draw(BgMjin* this, GlobalContext* globalCtx);
const ActorInit Bg_Mjin_InitVars = {
ACTOR_BG_MJIN,
@ -47,8 +50,8 @@ void BgMjin_SetupAction(BgMjin* this, ActorFunc actionFunc) {
this->actionFunc = actionFunc;
}
void BgMjin_Init(BgMjin* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
void BgMjin_Init(Actor* thisx, GlobalContext* globalCtx) {
BgMjin* this = THIS;
s8 objBankIndex;
Actor_ProcessInitChain(thisx, initChain);
@ -61,7 +64,9 @@ void BgMjin_Init(BgMjin* this, GlobalContext* globalCtx) {
}
}
void BgMjin_Destroy(BgMjin* this, GlobalContext* globalCtx) {
void BgMjin_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgMjin* this = THIS;
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
@ -80,27 +85,29 @@ void func_808A0850(BgMjin* this, GlobalContext* globalCtx) {
this->dyna.dynaPolyId =
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, local_c);
BgMjin_SetupAction(this, &func_808A0920);
this->dyna.actor.draw = &BgMjin_Draw;
this->dyna.actor.draw = BgMjin_Draw;
}
}
void func_808A0920(BgMjin* this, GlobalContext* globalCtx) {
}
void BgMjin_Update(BgMjin* this, GlobalContext* globalCtx) {
void BgMjin_Update(Actor* thisx, GlobalContext* globalCtx) {
BgMjin* this = THIS;
this->actionFunc(this, globalCtx);
}
void BgMjin_Draw(BgMjin* this, GlobalContext* globalCtx) {
s32 objBankIndex;
void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgMjin* this = THIS;
u32 dlist;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* dispRefs[4];
s32 pad;
s32 objBankIndex;
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_mjin.c", 250);
if (this->dyna.actor.params != 0) {
objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectTbl[this->dyna.actor.params - 1]);
if (thisx->params != 0) {
objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectTbl[thisx->params - 1]);
if (objBankIndex >= 0) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objBankIndex].segment);
}