Skip to content

Commit e8d7315

Browse files
committed
apply changes
1 parent 34e81f2 commit e8d7315

File tree

2 files changed

+33
-36
lines changed

2 files changed

+33
-36
lines changed

include/d/actor/d_a_nzg.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
struct dPath;
88

9-
class nzg_class : public fopEn_enemy_c {
9+
struct nzg_class {
1010
public:
11+
/* 0x000 */ fopEn_enemy_c actor;
1112
/* 0x2AC */ request_of_phase_process_class mPhs;
1213
/* 0x2B4 */ J3DModel* mpModel;
1314
/* 0x2B8 */ u8 m2B8;

src/d/actor/d_a_nzg.cpp

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
/* 00000078-000000E4 .text daNZG_Draw__FP9nzg_class */
1515
static BOOL daNZG_Draw(nzg_class* i_this) {
1616
J3DModel* model = i_this->mpModel;
17-
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->tevStr);
18-
g_env_light.setLightTevColorType(model, &i_this->tevStr);
17+
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->actor.current.pos, &i_this->actor.tevStr);
18+
g_env_light.setLightTevColorType(model, &i_this->actor.tevStr);
1919
mDoExt_modelUpdateDL(model);
2020
return TRUE;
2121
}
@@ -26,48 +26,48 @@ static BOOL daNZG_Draw(nzg_class* i_this) {
2626
void nzg_00_move(nzg_class* i_this) {
2727
/* Nonmatching for Demo */
2828
//fixes regswap issue in demo for the most part but introduces a misplaced instruction error
29-
nzg_class* actor = i_this;
29+
fopAc_ac_c* actor = &i_this->actor;
3030

3131
if (i_this->m2C2[0] != 0 || i_this->m2BE >= i_this->m2C0) {
3232
return;
3333
}
3434

35-
actor->mCyl.SetC(actor->current.pos);
36-
actor->mCyl.SetH(REG8_F(11) + 40.0f);
37-
actor->mCyl.SetR(REG8_F(12) + 40.0f);
38-
dComIfG_Ccsp()->Set(&actor->mCyl);
35+
i_this->mCyl.SetC(actor->current.pos);
36+
i_this->mCyl.SetH(REG8_F(11) + 40.0f);
37+
i_this->mCyl.SetR(REG8_F(12) + 40.0f);
38+
dComIfG_Ccsp()->Set(&i_this->mCyl);
3939

40-
if (actor->mCyl.ChkCoHit()) {
41-
fopAc_ac_c* hit_actor = actor->mCyl.GetCoHitAc();
40+
if (i_this->mCyl.ChkCoHit()) {
41+
fopAc_ac_c* hit_actor = i_this->mCyl.GetCoHitAc();
4242
if (hit_actor != NULL) {
4343
s16 hitAC_name = fopAcM_GetName(hit_actor);
4444
if (hitAC_name != PROC_NZ && hitAC_name != PROC_BOMB && hitAC_name != PROC_Bomb2 && hitAC_name != PROC_ITEM && hitAC_name != PROC_ESA) {
45-
actor->m2D4 = fopAcM_GetID(hit_actor);
46-
actor->m2BB = 1;
45+
i_this->m2D4 = fopAcM_GetID(hit_actor);
46+
i_this->m2BB = 1;
4747
return;
4848
}
4949
}
5050
}
5151

5252
u32 parameters = fopAcM_GetParam(actor) & 0xFF000000;
5353

54-
if (actor->m2BA == 1) {
54+
if (i_this->m2BA == 1) {
5555
parameters |= 0x100;
56-
} else if (actor->m2BA == 2 && cM_rnd() < 0.5f) {
56+
} else if (i_this->m2BA == 2 && cM_rnd() < 0.5f) {
5757
parameters |= 0x100;
5858
}
5959

60-
if (parameters & 0x100 || fopAcM_searchActorDistance(actor, dComIfGp_getPlayer(0)) < actor->m2CC * 0.5f) {
61-
if (fopAcM_searchActorDistance(actor, dComIfGp_getPlayer(0)) > actor->m2D0 * 0.5f) {
60+
if (parameters & 0x100 || fopAcM_searchActorDistance(actor, dComIfGp_getPlayer(0)) < i_this->m2CC * 0.5f) {
61+
if (fopAcM_searchActorDistance(actor, dComIfGp_getPlayer(0)) > i_this->m2D0 * 0.5f) {
6262
parameters |= 1;
6363
csXyz child_angle = actor->current.angle;
6464

6565
child_angle.y += cM_rndFX(8192.0f);
6666
fpc_ProcID childProcID = fopAcM_createChild(PROC_NZ, fopAcM_GetID(actor), parameters, &actor->current.pos, fopAcM_GetRoomNo(actor), &child_angle, &actor->scale, NULL);
6767

6868
if (childProcID != fpcM_ERROR_PROCESS_ID_e) {
69-
actor->m2C2[0] = (childProcID & 3) * 10 + 20;
70-
actor->m2BE++;
69+
i_this->m2C2[0] = (childProcID & 3) * 10 + 20;
70+
i_this->m2BE++;
7171
}
7272
}
7373
}
@@ -78,8 +78,8 @@ void nzg_01_move(nzg_class* i_this) {
7878
if (i_this->m2D4 != fpcM_ERROR_PROCESS_ID_e) {
7979
fopAc_ac_c* ac_id = fopAcM_SearchByID(i_this->m2D4);
8080
if (ac_id != NULL) {
81-
f32 pos_x_diff = i_this->current.pos.x - ac_id->current.pos.x;
82-
f32 pos_z_diff = i_this->current.pos.z - ac_id->current.pos.z;
81+
f32 pos_x_diff = i_this->actor.current.pos.x - ac_id->current.pos.x;
82+
f32 pos_z_diff = i_this->actor.current.pos.z - ac_id->current.pos.z;
8383
pos_x_diff = (pos_x_diff * pos_x_diff) + (pos_z_diff * pos_z_diff);
8484

8585
if (std::sqrtf(pos_x_diff) < 80.0f) {
@@ -119,20 +119,16 @@ static BOOL daNZG_IsDelete(nzg_class*) {
119119

120120
/* 000004D8-00000508 .text daNZG_Delete__FP9nzg_class */
121121
static BOOL daNZG_Delete(nzg_class* i_this) {
122-
#if VERSION == VERSION_DEMO
123-
g_dComIfG_gameInfo.mResControl.deleteObjectRes("NZG");
124-
#else
125-
dComIfG_resDelete(&i_this->mPhs, "NZG");
126-
#endif
122+
dComIfG_resDeleteDemo(&i_this->mPhs, "NZG");
127123
return TRUE;
128124
}
129125

130126
/* 00000508-00000620 .text useHeapInit__FP10fopAc_ac_c */
131127
static BOOL useHeapInit(fopAc_ac_c* i_this) {
132128
nzg_class* nzg_this = (nzg_class*)i_this;
133129

134-
mDoMtx_stack_c::transS(nzg_this->current.pos.x, nzg_this->current.pos.y, nzg_this->current.pos.z);
135-
mDoMtx_stack_c::YrotM(nzg_this->shape_angle.y);
130+
mDoMtx_stack_c::transS(nzg_this->actor.current.pos.x, nzg_this->actor.current.pos.y, nzg_this->actor.current.pos.z);
131+
mDoMtx_stack_c::YrotM(nzg_this->actor.shape_angle.y);
136132

137133
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("NZG", NZG_BDL_KANA_00);
138134
JUT_ASSERT(630, modelData != NULL);
@@ -143,9 +139,9 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) {
143139
}
144140

145141
nzg_this->mpModel = model;
146-
model->setBaseScale(nzg_this->scale);
142+
model->setBaseScale(nzg_this->actor.scale);
147143
model->setBaseTRMtx(mDoMtx_stack_c::get());
148-
fopAcM_SetMtx(nzg_this, model->getBaseTRMtx());
144+
fopAcM_SetMtx(&nzg_this->actor, model->getBaseTRMtx());
149145
return TRUE;
150146
}
151147

@@ -184,24 +180,24 @@ static cPhs_State daNZG_Create(fopAc_ac_c* i_this) {
184180
nzg_class* nzg_this = (nzg_class*)i_this;
185181
cPhs_State phase_state = dComIfG_resLoad(&nzg_this->mPhs, "NZG");
186182
if (phase_state == cPhs_COMPLEATE_e) {
187-
fopAcM_SetupActor(nzg_this, nzg_class);
183+
fopAcM_SetupActor(i_this, nzg_class);
188184
#else
189185
nzg_class* nzg_this = (nzg_class*)i_this;
190-
fopAcM_SetupActor(nzg_this, nzg_class);
186+
fopAcM_SetupActor(i_this, nzg_class);
191187
cPhs_State phase_state = dComIfG_resLoad(&nzg_this->mPhs, "NZG");
192188
if (phase_state == cPhs_COMPLEATE_e) {
193189
#endif
194-
if (!fopAcM_entrySolidHeap(nzg_this, useHeapInit, 0x680)) {
190+
if (!fopAcM_entrySolidHeap(&nzg_this->actor, useHeapInit, 0x680)) {
195191
return cPhs_ERROR_e;
196192
}
197193
nzg_this->m2B8 = fopAcM_GetParam(nzg_this);
198194
nzg_this->m2B9 = fopAcM_GetParam(nzg_this) >> 8;
199195
nzg_this->m2BA = fopAcM_GetParam(nzg_this) >> 16;
200196
nzg_this->m2E9 = fopAcM_GetParam(nzg_this) >> 24;
201197
if (nzg_this->m2E9 != 0xFF) {
202-
nzg_this->mpPath = dPath_GetRoomPath(nzg_this->m2E9, fopAcM_GetRoomNo(nzg_this));
198+
nzg_this->mpPath = dPath_GetRoomPath(nzg_this->m2E9, fopAcM_GetRoomNo(i_this));
203199
}
204-
nzg_this->shape_angle.y = nzg_this->current.angle.y;
200+
nzg_this->actor.shape_angle.y = nzg_this->actor.current.angle.y;
205201
nzg_this->m2CC = nzg_this->m2B8 * 10.0f;
206202
nzg_this->m2C0 = 1;
207203
if (nzg_this->m2B9 != 0) {
@@ -214,8 +210,8 @@ static cPhs_State daNZG_Create(fopAc_ac_c* i_this) {
214210
nzg_this->mCyl.Set(body_cyl_src);
215211
nzg_this->mCyl.SetStts(&nzg_this->mStts);
216212
if (nzg_this->m2BA == 0) {
217-
csXyz child_angle = nzg_this->current.angle;
218-
fopAcM_createChild("NpcNz",fpcM_GetID(nzg_this), 0xffffffff, &nzg_this->current.pos, fopAcM_GetRoomNo(nzg_this), &child_angle, &nzg_this->scale, NULL);
213+
csXyz child_angle = nzg_this->actor.current.angle;
214+
fopAcM_createChild("NpcNz",fpcM_GetID(nzg_this), 0xffffffff, &nzg_this->actor.current.pos, fopAcM_GetRoomNo(&nzg_this->actor), &child_angle, &nzg_this->actor.scale, NULL);
219215
}
220216
}
221217
return phase_state;

0 commit comments

Comments
 (0)