En_jc_mato matching (#119)

* starting actor

* close to being done

* updating txt files

* z_en_jc_mato OK

* Merge branch 'master' into en_jc_mato

* fixing some suggestions

* adding names

* changing name to movement
This commit is contained in:
Parker Burnett
2021-05-04 22:03:41 -04:00
committed by GitHub
parent d44d842192
commit d61d236a04
7 changed files with 135 additions and 20 deletions
+109 -10
View File
@@ -1,3 +1,9 @@
/*
* File: z_en_jc_mato.c
* Overlay: ovl_en_jc_mato
* Description: Boat Cruise Target
*/
#include "z_en_jc_mato.h"
#define FLAGS 0x00004030
@@ -9,7 +15,10 @@ void EnJcMato_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnJcMato_Update(Actor* thisx, GlobalContext* globalCtx);
void EnJcMato_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
s32 EnJcMato_CheckForHit(EnJcMato* this, GlobalContext* globalCtx);
void EnJcMato_SetupIdle(EnJcMato* this);
void EnJcMato_Idle(EnJcMato* this, GlobalContext* globalCtx);
const ActorInit En_Jc_Mato_InitVars = {
ACTOR_EN_JC_MATO,
ACTORCAT_PROP,
@@ -19,20 +28,110 @@ const ActorInit En_Jc_Mato_InitVars = {
(ActorFunc)EnJcMato_Init,
(ActorFunc)EnJcMato_Destroy,
(ActorFunc)EnJcMato_Update,
(ActorFunc)EnJcMato_Draw
(ActorFunc)EnJcMato_Draw,
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Jc_Mato_0x80B9DEE0/func_80B9DEE0.asm")
ColliderSphereInit sSphereInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_SPHERE,
},
{
ELEMTYPE_UNK0,
{ 0xF7CFFFFF, 0x00, 0x00 },
{ 0xF7CFFFFF, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_ON,
},
{ 0, { { 0, 0, 0 }, 15 }, 100 },
};
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Jc_Mato_0x80B9DEE0/func_80B9DFC8.asm")
DamageTable EnJcMatoDamageTable = {
0x01, 0x01, 0x01, 0x01, 0x01, 0xF1, 0x01, 0x01, 0x01, 0x01, 0x01, 0xF1, 0xF1, 0xF1, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
};
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Jc_Mato_0x80B9DEE0/func_80B9DFDC.asm")
s32 EnJcMato_CheckForHit(EnJcMato* this, GlobalContext* globalCtx) {
this->collider.dim.worldSphere.center.x = this->pos.x;
this->collider.dim.worldSphere.center.y = this->pos.y;
this->collider.dim.worldSphere.center.z = this->pos.z;
if ((this->collider.base.acFlags & 2) && !this->hitFlag && (this->actor.colChkInfo.damageEffect == 0xF)) {
this->collider.base.acFlags &= 0xFFFD;
Audio_PlayActorSound2(&this->actor, 0x4807);
globalCtx->interfaceCtx.unk25C = 1;
this->hitFlag = 1;
return 1;
} else {
CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base);
CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base);
return 0;
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Jc_Mato_0x80B9DEE0/EnJcMato_Init.asm")
void EnJcMato_SetupIdle(EnJcMato* this) {
this->actionFunc = EnJcMato_Idle;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Jc_Mato_0x80B9DEE0/EnJcMato_Destroy.asm")
void EnJcMato_Idle(EnJcMato* this, GlobalContext* globalCtx) {
s16 shouldDespawn;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Jc_Mato_0x80B9DEE0/EnJcMato_Update.asm")
if (this->hitFlag != 0) {
if (this->despawnTimer == 0) {
shouldDespawn = 0;
} else {
this->despawnTimer--;
shouldDespawn = this->despawnTimer;
}
if (shouldDespawn == 0) {
Actor_MarkForDeath(&this->actor);
}
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Jc_Mato_0x80B9DEE0/EnJcMato_Draw.asm")
void EnJcMato_Init(Actor* thisx, GlobalContext* globalCtx) {
EnJcMato* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 24.0f);
Collider_InitSphere(globalCtx, &this->collider);
Collider_SetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit);
this->collider.dim.worldSphere.radius = 0xF;
this->actor.colChkInfo.damageTable = &EnJcMatoDamageTable;
Actor_SetScale(&this->actor, 0.008f);
this->hitFlag = 0;
this->despawnTimer = 25;
EnJcMato_SetupIdle(this);
}
void EnJcMato_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnJcMato* this = THIS;
Collider_DestroySphere(globalCtx, &this->collider);
}
void EnJcMato_Update(Actor* thisx, GlobalContext* globalCtx) {
EnJcMato* this = THIS;
this->actionFunc(this, globalCtx);
if (!(gSaveContext.owl.unk4 & 1)) {
EnJcMato_CheckForHit(this, globalCtx);
}
}
extern Gfx D_06000390[];
Vec3f movement = { 0.0f, -2500.0f, 0.0f };
void EnJcMato_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnJcMato* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06000390);
SysMatrix_MultiplyVector3fByState(&movement, &this->pos);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@@ -5,9 +5,15 @@
struct EnJcMato;
typedef void (*EnJcMatoActionFunc)(struct EnJcMato*, GlobalContext*);
typedef struct EnJcMato {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x6C];
/* 0x144 */ EnJcMatoActionFunc actionFunc;
/* 0x148 */ ColliderSphere collider;
/* 0x1A0 */ s16 despawnTimer;
/* 0x1A2 */ s16 hitFlag;
/* 0x1A4 */ Vec3f pos;
} EnJcMato; // size = 0x1B0
extern const ActorInit En_Jc_Mato_InitVars;