mirror of https://github.com/zeldaret/mm.git
Import `EnAObj`'s data and a few cleanups (#1111)
* try to import data * bss * spec * name actionfuncs * macros for params * review Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
parent
bbbe0b1821
commit
a5425e4ffc
|
@ -358,9 +358,7 @@ extern u16 viRetrace;
|
||||||
extern DmaEntry dmadata[1568];
|
extern DmaEntry dmadata[1568];
|
||||||
// extern UNK_TYPE1 D_80186028;
|
// extern UNK_TYPE1 D_80186028;
|
||||||
extern u64 aspMainTextStart[];
|
extern u64 aspMainTextStart[];
|
||||||
extern ColliderCylinderInit enAObjCylinderInit;
|
|
||||||
extern InitChainEntry enAObjInitVar;
|
|
||||||
extern Gfx* enAObjDisplayLists[2];
|
|
||||||
extern u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
|
extern u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
|
||||||
extern u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
|
extern u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
|
||||||
extern s32 D_801AE194[32];
|
extern s32 D_801AE194[32];
|
||||||
|
|
|
@ -289,8 +289,17 @@ typedef struct EnAObj {
|
||||||
/* 0x000 */ Actor actor;
|
/* 0x000 */ Actor actor;
|
||||||
/* 0x144 */ EnAObjActionFunc actionFunc;
|
/* 0x144 */ EnAObjActionFunc actionFunc;
|
||||||
/* 0x148 */ ColliderCylinder collision;
|
/* 0x148 */ ColliderCylinder collision;
|
||||||
/* 0x194 */ UNK_TYPE1 pad194[0x14];
|
} EnAObj; // size = 0x194
|
||||||
} EnAObj; // size = 0x1A8
|
|
||||||
|
typedef enum {
|
||||||
|
/* 0 */ AOBJ_SIGNPOST_OBLONG,
|
||||||
|
/* 1 */ AOBJ_SIGNPOST_ARROW,
|
||||||
|
} AObjType;
|
||||||
|
|
||||||
|
#define AOBJ_GET_TEXTID(thisx) ((((thisx)->params >> 8) & 0xFF) | 0x300)
|
||||||
|
#define AOBJ_GET_TYPE(thisx) (((thisx)->params & 0xFF) - 9)
|
||||||
|
|
||||||
|
#define AOBJ_PARAMS(textId, type) ((((textId - 0x300) & 0xFF) << 8) | (type + 9))
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* 0x00 */ ACTORCAT_SWITCH,
|
/* 0x00 */ ACTORCAT_SWITCH,
|
||||||
|
|
3
spec
3
spec
|
@ -424,11 +424,10 @@ beginseg
|
||||||
name "code"
|
name "code"
|
||||||
compress
|
compress
|
||||||
after "dmadata"
|
after "dmadata"
|
||||||
include "build/src/code/z_en_a_keep.o"
|
|
||||||
include "build/data/code/aspMain.data.o"
|
include "build/data/code/aspMain.data.o"
|
||||||
include "build/data/code/gspS2DEX2.fifo.data.o"
|
include "build/data/code/gspS2DEX2.fifo.data.o"
|
||||||
include "build/data/code/njpgdspMain.data.o"
|
include "build/data/code/njpgdspMain.data.o"
|
||||||
include "build/data/code/code_801ADE60.data.o"
|
include "build/src/code/z_en_a_keep.o"
|
||||||
include "build/data/code/code_801E3FA0.bss.o"
|
include "build/data/code/code_801E3FA0.bss.o"
|
||||||
include "build/src/code/z_en_item00.o"
|
include "build/src/code/z_en_item00.o"
|
||||||
include "build/src/code/z_eff_blure.o"
|
include "build/src/code/z_eff_blure.o"
|
||||||
|
|
|
@ -1,21 +1,65 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "assets/objects/gameplay_keep/gameplay_keep.h"
|
||||||
|
|
||||||
|
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8)
|
||||||
|
|
||||||
#define THIS ((EnAObj*)thisx)
|
#define THIS ((EnAObj*)thisx)
|
||||||
|
|
||||||
void EnAObj_Update1(EnAObj* this, PlayState* play);
|
void EnAObj_Init(Actor* thisx, PlayState* play);
|
||||||
void EnAObj_Update2(EnAObj* this, PlayState* play);
|
void EnAObj_Destroy(Actor* thisx, PlayState* play);
|
||||||
|
void EnAObj_Update(Actor* thisx, PlayState* play);
|
||||||
|
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 = {
|
||||||
|
ACTOR_EN_A_OBJ,
|
||||||
|
ACTORCAT_PROP,
|
||||||
|
FLAGS,
|
||||||
|
GAMEPLAY_KEEP,
|
||||||
|
sizeof(EnAObj),
|
||||||
|
(ActorFunc)EnAObj_Init,
|
||||||
|
(ActorFunc)EnAObj_Destroy,
|
||||||
|
(ActorFunc)EnAObj_Update,
|
||||||
|
(ActorFunc)EnAObj_Draw,
|
||||||
|
};
|
||||||
|
|
||||||
|
static ColliderCylinderInit sCylinderInit = {
|
||||||
|
{
|
||||||
|
COLTYPE_NONE,
|
||||||
|
AT_NONE,
|
||||||
|
AC_NONE,
|
||||||
|
OC1_ON | OC1_TYPE_ALL,
|
||||||
|
OC2_TYPE_2,
|
||||||
|
COLSHAPE_CYLINDER,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ELEMTYPE_UNK0,
|
||||||
|
{ 0x00000000, 0x00, 0x00 },
|
||||||
|
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||||
|
TOUCH_NONE,
|
||||||
|
BUMP_NONE,
|
||||||
|
OCELEM_ON,
|
||||||
|
},
|
||||||
|
{ 25, 60, 0, { 0, 0, 0 } },
|
||||||
|
};
|
||||||
|
|
||||||
|
static InitChainEntry sInitChain[] = {
|
||||||
|
ICHAIN_U8(targetMode, 0, ICHAIN_STOP),
|
||||||
|
};
|
||||||
|
|
||||||
void EnAObj_Init(Actor* thisx, PlayState* play) {
|
void EnAObj_Init(Actor* thisx, PlayState* play) {
|
||||||
EnAObj* this = THIS;
|
EnAObj* this = THIS;
|
||||||
|
|
||||||
this->actor.textId = ((this->actor.params >> 8) & 0xFF) | 0x300;
|
this->actor.textId = AOBJ_GET_TEXTID(&this->actor);
|
||||||
this->actor.params = (this->actor.params & 0xFF) - 9;
|
this->actor.params = AOBJ_GET_TYPE(&this->actor);
|
||||||
Actor_ProcessInitChain(&this->actor, &enAObjInitVar);
|
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||||
ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 12);
|
ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 12);
|
||||||
Collider_InitAndSetCylinder(play, &this->collision, &this->actor, &enAObjCylinderInit);
|
Collider_InitAndSetCylinder(play, &this->collision, &this->actor, &sCylinderInit);
|
||||||
Collider_UpdateCylinder(&this->actor, &this->collision);
|
Collider_UpdateCylinder(&this->actor, &this->collision);
|
||||||
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
||||||
this->actionFunc = EnAObj_Update1;
|
this->actionFunc = EnAObj_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnAObj_Destroy(Actor* thisx, PlayState* play) {
|
void EnAObj_Destroy(Actor* thisx, PlayState* play) {
|
||||||
|
@ -24,23 +68,23 @@ void EnAObj_Destroy(Actor* thisx, PlayState* play) {
|
||||||
Collider_DestroyCylinder(play, &this->collision);
|
Collider_DestroyCylinder(play, &this->collision);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnAObj_Update1(EnAObj* this, PlayState* play) {
|
void EnAObj_Idle(EnAObj* this, PlayState* play) {
|
||||||
s32 yawDiff;
|
s32 yawDiff;
|
||||||
|
|
||||||
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
|
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
|
||||||
this->actionFunc = EnAObj_Update2;
|
this->actionFunc = EnAObj_Talk;
|
||||||
} else {
|
} else {
|
||||||
yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y));
|
yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y));
|
||||||
|
|
||||||
if ((yawDiff < 0x2800) || ((this->actor.params == 1) && (yawDiff > 0x5800))) {
|
if ((yawDiff < 0x2800) || ((this->actor.params == AOBJ_SIGNPOST_ARROW) && (yawDiff > 0x5800))) {
|
||||||
func_800B863C(&this->actor, play);
|
func_800B863C(&this->actor, play);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnAObj_Update2(EnAObj* this, PlayState* play) {
|
void EnAObj_Talk(EnAObj* this, PlayState* play) {
|
||||||
if (Actor_TextboxIsClosing(&this->actor, play)) {
|
if (Actor_TextboxIsClosing(&this->actor, play)) {
|
||||||
this->actionFunc = EnAObj_Update1;
|
this->actionFunc = EnAObj_Idle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +96,11 @@ void EnAObj_Update(Actor* thisx, PlayState* play) {
|
||||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collision.base);
|
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collision.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Gfx* sDLists[] = {
|
||||||
|
gSignRectangularDL, // AOBJ_SIGNPOST_OBLONG
|
||||||
|
gSignDirectionalDL, // AOBJ_SIGNPOST_ARROW
|
||||||
|
};
|
||||||
|
|
||||||
void EnAObj_Draw(Actor* thisx, PlayState* play) {
|
void EnAObj_Draw(Actor* thisx, PlayState* play) {
|
||||||
Gfx_DrawDListOpa(play, enAObjDisplayLists[thisx->params]);
|
Gfx_DrawDListOpa(play, sDLists[thisx->params]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,7 +508,7 @@
|
||||||
0x801AAAB0 : "aspMain",
|
0x801AAAB0 : "aspMain",
|
||||||
0x801ABAB0 : "gspS2DEX2.fifo",
|
0x801ABAB0 : "gspS2DEX2.fifo",
|
||||||
0x801AD370 : "njpgdspMain",
|
0x801AD370 : "njpgdspMain",
|
||||||
0x801ADE60 : "",
|
0x801ADE60 : "z_en_a_keep",
|
||||||
0x801ADEC0 : "z_en_item00",
|
0x801ADEC0 : "z_en_item00",
|
||||||
0x801AE240 : "z_eff_blure",
|
0x801AE240 : "z_eff_blure",
|
||||||
0x801AE2F0 : "z_eff_shield_particle",
|
0x801AE2F0 : "z_eff_shield_particle",
|
||||||
|
|
|
@ -486,8 +486,8 @@
|
||||||
0x80096930:("__osMemcpy",),
|
0x80096930:("__osMemcpy",),
|
||||||
0x800A5AC0:("EnAObj_Init",),
|
0x800A5AC0:("EnAObj_Init",),
|
||||||
0x800A5B6C:("EnAObj_Destroy",),
|
0x800A5B6C:("EnAObj_Destroy",),
|
||||||
0x800A5B98:("EnAObj_Update1",),
|
0x800A5B98:("EnAObj_Idle",),
|
||||||
0x800A5C28:("EnAObj_Update2",),
|
0x800A5C28:("EnAObj_Talk",),
|
||||||
0x800A5C60:("EnAObj_Update",),
|
0x800A5C60:("EnAObj_Update",),
|
||||||
0x800A5CB8:("EnAObj_Draw",),
|
0x800A5CB8:("EnAObj_Draw",),
|
||||||
0x800A5D00:("EnItem00_SetObject",),
|
0x800A5D00:("EnItem00_SetObject",),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s,EnAObj_Init,0x800A5AC0,0x2B
|
asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s,EnAObj_Init,0x800A5AC0,0x2B
|
||||||
asm/non_matchings/code/z_en_a_keep/EnAObj_Destroy.s,EnAObj_Destroy,0x800A5B6C,0xB
|
asm/non_matchings/code/z_en_a_keep/EnAObj_Destroy.s,EnAObj_Destroy,0x800A5B6C,0xB
|
||||||
asm/non_matchings/code/z_en_a_keep/EnAObj_Update1.s,EnAObj_Update1,0x800A5B98,0x24
|
asm/non_matchings/code/z_en_a_keep/EnAObj_Idle.s,EnAObj_Idle,0x800A5B98,0x24
|
||||||
asm/non_matchings/code/z_en_a_keep/EnAObj_Update2.s,EnAObj_Update2,0x800A5C28,0xE
|
asm/non_matchings/code/z_en_a_keep/EnAObj_Talk.s,EnAObj_Talk,0x800A5C28,0xE
|
||||||
asm/non_matchings/code/z_en_a_keep/EnAObj_Update.s,EnAObj_Update,0x800A5C60,0x16
|
asm/non_matchings/code/z_en_a_keep/EnAObj_Update.s,EnAObj_Update,0x800A5C60,0x16
|
||||||
asm/non_matchings/code/z_en_a_keep/EnAObj_Draw.s,EnAObj_Draw,0x800A5CB8,0x12
|
asm/non_matchings/code/z_en_a_keep/EnAObj_Draw.s,EnAObj_Draw,0x800A5CB8,0x12
|
||||||
asm/non_matchings/code/z_en_item00/EnItem00_SetObject.s,EnItem00_SetObject,0x800A5D00,0x1C
|
asm/non_matchings/code/z_en_item00/EnItem00_SetObject.s,EnItem00_SetObject,0x800A5D00,0x1C
|
||||||
|
|
|
Loading…
Reference in New Issue