daNpz_Nz_c Work (#615)

* daNpz_Nz_c Work

* Forgot This

oops
This commit is contained in:
SuperDude88
2024-04-14 09:47:43 -04:00
committed by GitHub
parent a2abbf35cb
commit 9819140a32
7 changed files with 1519 additions and 116 deletions
+15 -2
View File
@@ -2,10 +2,23 @@
#define D_A_ESA_H
#include "f_op/f_op_actor.h"
#include "d/d_particle.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
class esa_class : public fopAc_ac_c {
public:
/* Place member variables here */
};
/* 0x290 */ u8 field_0x290[0x298 - 0x290];
/* 0x298 */ u8 field_0x298;
/* 0x29C */ f32 mGroundHeight;
/* 0x2A0 */ s8 mActionState;
/* 0x2A1 */ s8 mState;
/* 0x2A2 */ u8 field_0x2A2[0x2A4 - 0x2A2];
/* 0x2A4 */ dPa_rippleEcallBack field_0x2A4;
/* 0x2B8 */ u8 field_0x2B8;
/* 0x2B9 */ s8 field_0x2B9;
/* 0x2BA */ u8 field_0x2BA;
/* 0x2BC */ J3DModel* mpModel;
/* 0x2C0 */ s16 mTimer[2];
}; // Size: 0x2C4
#endif /* D_A_ESA_H */
+84 -22
View File
@@ -2,46 +2,57 @@
#define D_A_NPC_NZ_H
#include "f_op/f_op_actor.h"
#include "m_Do/m_Do_hostIO.h"
#include "m_Do/m_Do_ext.h"
#include "d/d_particle.h"
#include "d/d_bg_s_acch.h"
#include "d/d_npc.h"
#include "d/actor/d_a_shop_item.h"
class J3DNode;
class daNpc_Nz_c : public fopAc_ac_c {
class daNpc_Nz_c : public fopNpc_npc_c {
public:
enum Proc_e {
PROC_0_e = 0,
PROC_1_e = 1,
};
// objdiff says this is a weak function
// but defining it here with {} causes it to be inlined with fopAcM_SetupActor which breaks things
daNpc_Nz_c();
void modeProcInit(int) {}
static BOOL NodeCallBack(J3DNode*, int);
static BOOL TailNodeCallBack(J3DNode*, int);
BOOL NodeCallBack(J3DNode*, int);
BOOL TailNodeCallBack(J3DNode*, int);
void TailControl();
void _createHeap();
void XyEventCB(int);
bool _createHeap();
s16 XyEventCB(int);
void eventOrder();
void checkOrder();
void setAttention();
void LookBack();
void setAnm(signed char, bool);
void setAnm(s8, bool);
void setMtx();
void modeWaitInit();
void modeWait();
void modeEventEsaInit();
void modeEventEsa();
void modeProc(Proc_e, int);
void createShopItem(unsigned char, unsigned char);
void getShopItem(int);
void createShopItem(u8, u8);
daShopItem_c* getShopItem(int);
void deleteShopItem();
void next_msgStatus(unsigned long*);
void anmAtr(unsigned short);
BOOL _execute();
BOOL _draw();
void createInit();
u16 next_msgStatus(u32*);
void anmAtr(u16);
bool _execute();
bool _draw();
BOOL createInit();
void setSmokeParticle();
void getArg();
s32 _create();
BOOL _delete();
void _searchEsa(fopAc_ac_c*);
bool _delete();
BOOL _searchEsa(fopAc_ac_c*);
void cutProc();
void cutEatesaStart();
void cutEatesaProc();
@@ -61,15 +72,66 @@ public:
void cutChkGetItemProc();
public:
/* Place member variables here */
};
static const char m_arc_name[];
static const char m_bdl_arc_name[];
class daNpc_Nz_HIO_c {
/* 0x6C4 */ cXyz field_0x6C4;
/* 0x6D0 */ int mCurMode;
/* 0x6D4 */ s8 field_0x6D4;
/* 0x6D5 */ s8 field_0x6D5;
/* 0x6D6 */ s8 field_0x6D6;
/* 0x6D8 */ request_of_phase_process_class mPhs1;
/* 0x6E0 */ request_of_phase_process_class mPhs2;
/* 0x6E8 */ mDoExt_McaMorf* mpMorf;
/* 0x6EC */ f32 field_0x6EC;
/* 0x6F0 */ dBgS_ObjAcch mAcch;
/* 0x8B4 */ dBgS_AcchCir mAcchCir;
/* 0x8F4 */ int field_0x8F4;
/* 0x8F8 */ u8 field_0x8F8;
/* 0x8FA */ s16 field_0x8FA;
/* 0x8FC */ bool field_0x8FC;
/* 0x8FE */ s16 field_0x8FE;
/* 0x900 */ u32 field_0x900;
/* 0x904 */ s16 field_0x904;
/* 0x906 */ s16 field_0x906;
/* 0x908 */ u8 field_0x908;
/* 0x909 */ u8 field_0x909;
/* 0x90A */ s16 field_0x90A;
/* 0x90C */ fopAc_ac_c* mpBait;
/* 0x910 */ f32 field_0x910;
/* 0x914 */ dPa_smokeEcallBack field_0x914;
/* 0x934 */ mDoExt_3DlineMat1_c field_0x934;
/* 0x970 */ u32 field_0x970;
/* 0x974 */ cXyz field_0x974[10];
/* 0x9EC */ cXyz field_0x9EC[10];
/* 0xA64 */ cXyz field_0xA64[2];
/* 0xA7C */ u8 field_0xA70[0xC];
/* 0xA88 */ u32 field_0xA88;
/* 0xA8C */ u32 field_0xA8C;
/* 0xA90 */ s16 field_0xA90;
}; // Size: 0xA92
class daNpc_Nz_HIO_c : public JORReflexible {
public:
daNpc_Nz_HIO_c();
virtual ~daNpc_Nz_HIO_c() {}
public:
/* Place member variables here */
};
/* 0x00 - vtable */
/* 0x04 */ s8 field_0x04;
/* 0x06 */ s16 field_0x06;
/* 0x08 */ s16 field_0x08;
/* 0x0A */ s16 field_0x0A;
/* 0x0C */ s16 field_0x0C;
/* 0x0E */ s16 field_0x0E;
/* 0x10 */ s16 field_0x10;
/* 0x12 */ s16 field_0x12;
/* 0x14 */ s16 field_0x14;
/* 0x16 */ s16 field_0x16;
/* 0x18 */ s16 field_0x18;
/* 0x1A */ s8 field_0x1A;
/* 0x1C */ f32 field_0x1C;
/* 0x20 */ f32 field_0x20;
/* 0x24 */ f32 field_0x24;
}; // Size: 0x28
#endif /* D_A_NPC_NZ_H */
+5 -1
View File
@@ -8,7 +8,11 @@ namespace daObjBarrel {
public:
void attr() const {}
void get_slant_angle() {}
void pos_init() {}
void pos_init() {
current.pos = home.pos;
current.angle = home.angle;
shape_angle = home.angle;
}
void prm_get_cull() const {}
void set_slant_angle(short) {}
+2
View File
@@ -135,6 +135,8 @@ public:
bool ChkWallHit() { return m_flags & WALL_HIT; }
void OffLineCheckHit() { m_flags &= ~LINE_CHECK_HIT; }
void OffLineCheck() { m_flags &= ~LINE_CHECK; }
void OffLineCheckNone() { m_flags &= ~LINE_CHECK_NONE; }
void OnLineCheckNone() { m_flags |= LINE_CHECK_NONE; }
bool ChkLineCheckNone() { return m_flags & LINE_CHECK_NONE; }
bool ChkLineCheck() { return m_flags & LINE_CHECK; }
void ClrRoofHit() { m_flags &= ~ROOF_HIT; }
+7 -3
View File
@@ -56,6 +56,12 @@ public:
virtual s16 getAngleStick();
};
class dLib_anm_idx_c {
public:
/* 0x00 */ int field_0x00;
/* 0x04 */ int field_0x04;
}; // Size: 0x08
class dLib_anm_prm_c {
public:
/* 0x00 */ s8 mBckIdx;
@@ -64,7 +70,7 @@ public:
/* 0x04 */ f32 mMorf;
/* 0x08 */ f32 mPlaySpeed;
/* 0x0C */ int mLoopMode;
};
}; // Size: 0x10
class dLib_circle_path_c {
public:
@@ -86,8 +92,6 @@ public:
/* 0x0A */ s16 mRotZ;
};
class dLib_anm_idx_c;
void dLib_setCirclePath(dLib_circle_path_c*);
f32 dLib_getWaterY(cXyz& pos, dBgS_ObjAcch& acch);
void dLib_waveRot(Vec*, f32, dLib_wave_c*);
+280 -17
View File
@@ -4,45 +4,308 @@
//
#include "d/actor/d_a_esa.h"
#include "dolphin/types.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "f_op/f_op_actor_mng.h"
#include "d/d_s_play.h"
#include "d/d_com_inf_game.h"
#include "d/d_procname.h"
#include "d/d_bg_s_func.h"
#include "d/actor/d_a_sea.h"
#include "d/actor/d_a_player_main.h"
/* 800E7E60-800E7EA8 .text daEsa_Draw__FP9esa_class */
static BOOL daEsa_Draw(esa_class*) {
/* Nonmatching */
static BOOL daEsa_Draw(esa_class* i_this) {
g_env_light.setLightTevColorType(i_this->mpModel, &i_this->tevStr);
mDoExt_modelUpdateDL(i_this->mpModel);
return true;
}
/* 800E7EA8-800E849C .text bg_check__FP9esa_class */
void bg_check(esa_class*) {
/* Nonmatching */
void bg_check(esa_class* i_this) {
/* Nonmatching - stack */
dBgS_GndChk gndChk;
f32 x = i_this->current.pos.x;
f32 y = i_this->current.pos.y;
f32 z = i_this->current.pos.z;
y += 100.0f;
gndChk.GetPointP()->x = x;
gndChk.GetPointP()->y = y;
gndChk.GetPointP()->z = z;
i_this->mGroundHeight = dComIfG_Bgsp()->GroundCross(&gndChk) + 5.0f;
s8 state = 1;
if(daSea_ChkArea(i_this->current.pos.x, i_this->current.pos.z)) {
f32 wave = daSea_calcWave(i_this->current.pos.x, i_this->current.pos.z);
if(i_this->mGroundHeight <= wave) {
i_this->mGroundHeight = wave;
state = 2;
}
}
cXyz temp(i_this->current.pos);
temp.y += 100.0f;
f32 waterHeight = dBgS_GetWaterHeight(temp);
if(waterHeight != -1000000000.0f && i_this->mGroundHeight <= waterHeight) {
i_this->mGroundHeight = waterHeight;
state = 2;
}
if(i_this->speed.y <= 0.0f && i_this->current.pos.y <= i_this->mGroundHeight) {
i_this->current.pos.y = i_this->mGroundHeight;
i_this->mState = state;
}
else {
i_this->mState = 0;
}
dBgS_LinChk linChk;
cXyz temp4 = i_this->old.pos + (i_this->current.pos - i_this->old.pos) * 1.5f;
temp4.y = i_this->old.pos.y;
cXyz temp5 = i_this->old.pos - temp4;
if(temp5.abs() > 1.0f) {
linChk.Set(&i_this->old.pos, &temp4, i_this);
if(dComIfG_Bgsp()->LineCross(&linChk)) {
i_this->current.pos.x = i_this->old.pos.x;
i_this->current.pos.z = i_this->old.pos.z;
i_this->speedF *= 0.5f;
i_this->current.angle.y -= 0x8000;
cXyz temp6;
temp6.x = 0.0f;
temp6.y = 0.0f;
temp6.z = i_this->speedF;
cXyz temp7;
mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
MtxPosition(&temp6, &temp7);
i_this->speed.x = temp7.x;
i_this->speed.z = temp7.z;
}
}
else {
fopAcM_OffStatus(i_this, fopAcStts_UNK4000_e);
}
}
/* 800E849C-800E88F8 .text esa_1_move__FP9esa_class */
void esa_1_move(esa_class*) {
/* Nonmatching */
void esa_1_move(esa_class* i_this) {
/* Nonmatching - stack */
switch(i_this->mActionState) {
case 0:
i_this->current.angle.y += (s16)cM_rndFX(4000.0f);
i_this->current.angle.z = cM_rndFX(32768.0f);
cXyz temp;
temp.x = 0.0f;
temp.y = cM_rndF(8.0f) + 15.0f;
temp.z = cM_rndF(5.0f) + 10.0f;
i_this->speedF = temp.z;
mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
MtxPosition(&temp, &i_this->speed);
i_this->mActionState = 1;
case 1:
if(i_this->mState != 0) {
if(i_this->mState == 2) {
i_this->mTimer[0] = cM_rndF(50.0f) + 200.0f;
i_this->mActionState = 3;
if(i_this->field_0x2A4.getEmitter() == NULL) {
static cXyz ripple_scale(0.2f, 0.2f, 0.2f);
dComIfGp_particle_setShipTail(0x33, &i_this->current.pos, 0, &ripple_scale, 0xFF, &i_this->field_0x2A4);
if(i_this->field_0x2A4.getEmitter()) {
i_this->field_0x2A4.setRate(0.4f);
}
}
}
else {
if(i_this->speed.y < 5.0f) {
i_this->speed.y *= -(cM_rndF(0.05f) + 0.15f);
i_this->current.angle.z = cM_rndFX(32768.0f);
}
i_this->current.angle.y += (s16)cM_rndFX(8000.0f);
i_this->speedF *= cM_rndF(0.3f) + 0.3f;
cXyz temp2;
temp2.x = 0.0f;
temp2.y = 0.0f;
temp2.z = i_this->speedF;
mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
cXyz temp3;
MtxPosition(&temp2, &temp3);
i_this->speed.x = temp3.x;
i_this->speed.z = temp3.z;
if(i_this->speedF < 0.1f) {
i_this->mActionState = 2;
i_this->mTimer[0] = cM_rndF(50.0f) + 200.0f;
break;
}
}
}
i_this->current.pos.x += i_this->speed.x;
i_this->current.pos.y += i_this->speed.y;
i_this->current.pos.z += i_this->speed.z;
i_this->speed.y -= 3.0f;
bg_check(i_this);
break;
case 2:
if(i_this->mTimer[0] == 0) {
fopAcM_delete(i_this);
}
break;
case 3:
if(dComIfGp_evmng_startCheck("SO_ESA_XY")) {
i_this->mTimer[0] = 10000;
}
i_this->field_0x2A4.end();
i_this->current.pos.y = daSea_calcWave(i_this->current.pos.x, i_this->current.pos.z);
if(i_this->mTimer[0] == 0) {
i_this->mTimer[0] = 10;
i_this->mActionState = 4;
}
if(i_this->field_0x298) {
i_this->mTimer[0] = 10;
i_this->mActionState = 4;
if(i_this->field_0x2A4.getEmitter() == NULL) {
static cXyz ripple_scale(0.2f, 0.2f, 0.2f);
dComIfGp_particle_setShipTail(0x33, &i_this->current.pos, 0, &ripple_scale, 0xFF, &i_this->field_0x2A4);
if(i_this->field_0x2A4.getEmitter()) {
i_this->field_0x2A4.setRate(0.4f);
}
}
}
break;
case 4:
if(i_this->mTimer[0] == 0) {
fopAcM_delete(i_this);
}
break;
}
}
/* 800E88F8-800E89B8 .text daEsa_Execute__FP9esa_class */
static BOOL daEsa_Execute(esa_class*) {
/* Nonmatching */
static BOOL daEsa_Execute(esa_class* i_this) {
for(int i = 0; i < 2; i++) {
if(i_this->mTimer[i] != 0) {
i_this->mTimer[i]--;
}
}
esa_1_move(i_this);
MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, false);
mDoMtx_YrotM(*calc_mtx, i_this->current.angle.y);
mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x);
mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z);
i_this->mpModel->setBaseTRMtx(*calc_mtx);
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->tevStr);
return true;
}
/* 800E89B8-800E89C0 .text daEsa_IsDelete__FP9esa_class */
static BOOL daEsa_IsDelete(esa_class*) {
/* Nonmatching */
static BOOL daEsa_IsDelete(esa_class* i_this) {
return true;
}
/* 800E89C0-800E89E8 .text daEsa_Delete__FP9esa_class */
static BOOL daEsa_Delete(esa_class*) {
/* Nonmatching */
static BOOL daEsa_Delete(esa_class* i_this) {
i_this->field_0x2A4.end();
return true;
}
/* 800E89E8-800E8AB0 .text daEsa_CreateHeap__FP10fopAc_ac_c */
static BOOL daEsa_CreateHeap(fopAc_ac_c*) {
/* Nonmatching */
static BOOL daEsa_CreateHeap(fopAc_ac_c* i_actor) {
esa_class* i_this = static_cast<esa_class*>(i_actor);
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes("Link", 0x2C));
JUT_ASSERT(0x1E8, modelData != 0);
i_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022);
if(i_this->mpModel == NULL) {
return false;
}
return true;
}
/* 800E8AB0-800E8CA4 .text daEsa_Create__FP10fopAc_ac_c */
static s32 daEsa_Create(fopAc_ac_c*) {
/* Nonmatching */
static s32 daEsa_Create(fopAc_ac_c* i_actor) {
/* Nonmatching - regalloc */
daPy_py_c* player = daPy_getPlayerActorClass();
fopAcM_SetupActor(i_actor, esa_class);
esa_class* i_this = static_cast<esa_class*>(i_actor);
i_this->field_0x2B9 = fopAcM_GetParam(i_this) & 0xFF;
i_this->field_0x2BA = fopAcM_GetParam(i_this) >> 8 & 0xFF;
if(g_regHIO.mChild->mShortRegs[0] != 0) {
i_this->field_0x2BA = 1;
}
if(!fopAcM_entrySolidHeap(i_this, daEsa_CreateHeap, 0x4C0)) {
return cPhs_ERROR_e;
}
if(i_this->field_0x2BA == 0) {
int num = i_this->field_0x2B9;
if(num > 0) {
for(int i = 0; i < num; i++) {
fopAcM_prm_class* params = fopAcM_CreateAppend();
cXyz pos = player->getLeftHandPos();
params->mPos = pos;
params->mAngle.x = 0;
params->mAngle.y = i_this->current.angle.y;
params->mAngle.z = cM_rndF(65536.0f);
params->mParameter = 0x000000FF;
fpcM_Create(PROC_ESA, 0, params);
}
}
}
f32 temp = g_regHIO.mChild->mFloatRegs[6] + 0.65f;
f32 scaleF = temp + cM_rndF(g_regHIO.mChild->mFloatRegs[5] + 1.0f - temp);
cXyz scale(scaleF, scaleF, scaleF);
i_this->mpModel->setBaseScale(scale);
fopAcM_SetMtx(i_this, i_this->mpModel->getBaseTRMtx());
return cPhs_COMPLEATE_e;
}
actor_method_class l_daEsa_Method = {
(process_method_func)daEsa_Create,
(process_method_func)daEsa_Delete,
(process_method_func)daEsa_Execute,
(process_method_func)daEsa_IsDelete,
(process_method_func)daEsa_Draw,
};
actor_process_profile_definition g_profile_ESA = {
/* LayerID */ fpcLy_CURRENT_e,
/* ListID */ 7,
/* ListPrio */ fpcPi_CURRENT_e,
/* ProcName */ PROC_ESA,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(esa_class),
/* SizeOther */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Priority */ 0x00D0,
/* Actor SubMtd */ &l_daEsa_Method,
/* Status */ fopAcStts_UNK40000_e | fopAcStts_UNK4000_e | fopAcStts_CULL_e,
/* Group */ fopAc_ACTOR_e,
/* CullType */ fopAc_CULLBOX_0_e,
};
+1126 -71
View File
File diff suppressed because it is too large Load Diff