Skip to content

Commit 57c9d64

Browse files
authored
Misc. framework/d/ improvements (#2572)
1 parent ee608ce commit 57c9d64

File tree

8 files changed

+216
-218
lines changed

8 files changed

+216
-218
lines changed

config/GZ2E01/symbols.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21819,7 +21819,8 @@ m_mode__7dDemo_c = .sbss:0x80450E38; // type:object size:0x4 scope:global align:
2181921819
m_status__7dDemo_c = .sbss:0x80450E3C; // type:object size:0x4 scope:global align:4 data:4byte
2182021820
m_branchType__7dDemo_c = .sbss:0x80450E40; // type:object size:0x2 scope:global align:2 data:2byte
2182121821
m_branchData__7dDemo_c = .sbss:0x80450E44; // type:object size:0x4 scope:global align:4 data:4byte
21822-
struct_80450E48 = .sbss:0x80450E48; // type:object size:0x4 scope:local align:4 data:byte
21822+
init$1867 = .sbss:0x80450E48; // type:object size:0x1 scope:local align:1 data:byte
21823+
init$1870 = .sbss:0x80450E49; // type:object size:0x1 scope:local align:1 data:byte
2182321824
it = .sbss:0x80450E4C; // type:object size:0x4 scope:local align:4 data:4byte
2182421825
init$1672 = .sbss:0x80450E50; // type:object size:0x1 scope:local align:1 data:byte
2182521826
mNowStayFloorNo__10dMapInfo_c = .sbss:0x80450E58; // type:object size:0x1 scope:global align:1 data:byte

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ def MatchingFor(*versions) -> bool:
548548
Object(MatchingFor("GZ2E01", "GZ2J01"), "d/d_a_item_static.cpp"),
549549
Object(MatchingFor("GZ2E01", "GZ2J01"), "d/d_a_shop_item_static.cpp"),
550550
Object(MatchingFor("GZ2E01", "GZ2J01"), "d/d_a_horse_static.cpp"),
551-
Object(NonMatching, "d/d_demo.cpp"),
551+
Object(MatchingFor("GZ2E01"), "d/d_demo.cpp"),
552552
Object(MatchingFor("GZ2E01", "GZ2J01"), "d/d_door_param2.cpp", extra_cflags=['-pragma "nosyminline on"']),
553553
Object(NonMatching, "d/d_resorce.cpp"),
554554
Object(MatchingFor("GZ2E01", "GZ2J01"), "d/d_map_path.cpp"),

include/JSystem/JParticle/JPAEmitter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class JPABaseEmitter {
160160
void setGlobalParticleScale(f32 scaleX, f32 scaleY) {
161161
mGlobalPScl.set(scaleX, scaleY);
162162
}
163-
void getGlobalParticleScale(JGeometry::TVec3<f32>& scale) {
163+
void getGlobalParticleScale(JGeometry::TVec3<f32>& scale) const {
164164
scale.set(mGlobalPScl.x, mGlobalPScl.y, 1.0f);
165165
}
166166
void setGlobalScale(const JGeometry::TVec3<f32>& scale) {

include/d/d_demo.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,8 @@ class dDemo_actor_c : public JStage::TActor {
9494
cMtx_copy(mModel->getAnmMtx((u16)param_0), param_1);
9595
return true;
9696
}
97-
/* 8003A0D8 */ virtual void JSGGetTranslation(Vec* o_trans) const {
98-
*o_trans = mTrans;
99-
}
10097
/* 80038920 */ virtual void JSGSetTranslation(Vec const&);
101-
/* 8003A0F4 */ virtual void JSGGetScaling(Vec* o_scale) const {
102-
*o_scale = mScale;
103-
}
10498
/* 80038980 */ virtual void JSGSetScaling(Vec const&);
105-
/* 8003A110 */ virtual void JSGGetRotation(Vec* param_0) const {
106-
param_0->x = mRotate.x * 0.005493164f;
107-
param_0->y = mRotate.y * 0.005493164f;
108-
param_0->z = mRotate.z * 0.005493164f;
109-
}
11099
/* 800389A8 */ virtual void JSGSetRotation(Vec const&);
111100
/* 80038A0C */ virtual void JSGSetShape(u32);
112101
/* 80038A20 */ virtual void JSGSetAnimation(u32);
@@ -120,6 +109,17 @@ class dDemo_actor_c : public JStage::TActor {
120109
/* 8003A0D0 */ virtual f32 JSGGetTextureAnimationFrameMax() const {
121110
return mTexAnmFrameMax;
122111
}
112+
/* 8003A0D8 */ virtual void JSGGetTranslation(Vec* o_trans) const {
113+
*o_trans = mTrans;
114+
}
115+
/* 8003A0F4 */ virtual void JSGGetScaling(Vec* o_scale) const {
116+
*o_scale = mScale;
117+
}
118+
/* 8003A110 */ virtual void JSGGetRotation(Vec* param_0) const {
119+
param_0->x = mRotate.x * 0.005493164f;
120+
param_0->y = mRotate.y * 0.005493164f;
121+
param_0->z = mRotate.z * 0.005493164f;
122+
}
123123

124124
void setModel(J3DModel* p_model) { mModel = p_model; }
125125
BOOL checkEnable(u16 flag) { return mFlags & flag; }
@@ -164,10 +164,10 @@ class dDemo_system_c : public JStage::TSystem {
164164
public:
165165
dDemo_system_c() { mpObject = NULL; }
166166

167-
/* 80039AAC */ virtual ~dDemo_system_c();
168167
/* 80039528 */ virtual int JSGFindObject(JStage::TObject**, char const*,
169168
JStage::TEObject) const;
170-
169+
/* 80039AAC */ virtual ~dDemo_system_c();
170+
171171
void setObject(dDemo_object_c* i_object) { mpObject = i_object; }
172172

173173
private:
@@ -198,13 +198,13 @@ class dDemo_light_c : public JStage::TLight {
198198
mFlags = 0;
199199
}
200200

201-
/* 80039468 */ virtual ~dDemo_light_c();
202201
/* 80038E20 */ virtual void JSGSetLightType(JStage::TELight);
203202
/* 80038E34 */ virtual void JSGSetPosition(Vec const&);
204203
/* 80038E5C */ virtual void JSGSetColor(GXColor);
205204
/* 80038E8C */ virtual void JSGSetDistanceAttenuation(f32, f32, GXDistAttnFn);
206205
/* 80038EA8 */ virtual void JSGSetAngleAttenuation(f32, GXSpotFn);
207206
/* 80038EC0 */ virtual void JSGSetDirection(Vec const&);
207+
/* 80039468 */ virtual ~dDemo_light_c();
208208

209209
void onEnable(u8 flag) { mFlags |= flag; }
210210

@@ -234,11 +234,11 @@ class dDemo_fog_c : public JStage::TFog {
234234
mFlags = 0;
235235
}
236236

237-
/* 80039408 */ virtual ~dDemo_fog_c();
238237
/* 80038EE8 */ virtual void JSGSetFogFunction(GXFogType);
239238
/* 80038EFC */ virtual void JSGSetStartZ(f32);
240239
/* 80038F10 */ virtual void JSGSetEndZ(f32);
241240
/* 80038F24 */ virtual void JSGSetColor(GXColor);
241+
/* 80039408 */ virtual ~dDemo_fog_c();
242242

243243
void onEnable(u8 flag) { mFlags |= flag; }
244244

@@ -267,7 +267,6 @@ class dDemo_camera_c : public JStage::TCamera {
267267
mFlags = 0;
268268
}
269269

270-
/* 80039FFC */ virtual ~dDemo_camera_c();
271270
/* 80038AC4 */ virtual f32 JSGGetProjectionNear() const;
272271
/* 80038AF8 */ virtual void JSGSetProjectionNear(f32);
273272
/* 80038B0C */ virtual f32 JSGGetProjectionFar() const;
@@ -284,6 +283,7 @@ class dDemo_camera_c : public JStage::TCamera {
284283
/* 80038D5C */ virtual void JSGSetViewTargetPosition(Vec const&);
285284
/* 80038D84 */ virtual f32 JSGGetViewRoll() const;
286285
/* 80038DDC */ virtual void JSGSetViewRoll(f32);
286+
/* 80039FFC */ virtual ~dDemo_camera_c();
287287

288288
void onEnable(u8 flag) { mFlags |= flag; }
289289
bool checkEnable(u8 flag) { return mFlags & flag; }
@@ -316,8 +316,8 @@ class dDemo_ambient_c : public JStage::TAmbientLight {
316316
mFlags = 0;
317317
}
318318

319-
/* 800394C8 */ virtual ~dDemo_ambient_c();
320319
/* 80038DF0 */ virtual void JSGSetColor(GXColor);
320+
/* 800394C8 */ virtual ~dDemo_ambient_c();
321321

322322
void onEnable(u8 flag) { mFlags |= flag; }
323323

src/d/d_demo.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ int dDemo_actor_c::getDemoIDData(int* param_0, int* param_1, int* param_2, u16*
255255
return 1;
256256
}
257257

258+
#if DEBUG
258259
s16 dDemo_c::m_branchNum = 0;
260+
#endif
259261

260262
/* 80038490-80038518 032DD0 0088+00 1/1 0/0 0/0 .text dDemo_getJaiPointer__FPCcUliPUs */
261263
static void* dDemo_getJaiPointer(char const* arcName, u32 anmID, int param_2, u16* param_3) {
@@ -287,8 +289,7 @@ int dDemo_setDemoData(fopAc_ac_c* i_actor, u8 i_flags, mDoExt_McaMorf* i_morf, c
287289

288290
u8 flags = demo_actor->checkEnable(i_flags);
289291
if (flags & dDemo_actor_c::ENABLE_TRANS_e) {
290-
i_actor->current.pos = demo_actor->getTrans();
291-
i_actor->old.pos = i_actor->current.pos;
292+
i_actor->old.pos = i_actor->current.pos = demo_actor->getTrans();
292293
}
293294

294295
if (flags & dDemo_actor_c::ENABLE_ROTATE_e) {
@@ -311,24 +312,26 @@ int dDemo_setDemoData(fopAc_ac_c* i_actor, u8 i_flags, mDoExt_McaMorf* i_morf, c
311312

312313
if (flags & dDemo_actor_c::ENABLE_ANM_e) {
313314
u32 anmID = demo_actor->getAnmId();
315+
void* ptr;
314316

315317
if (anmID != demo_actor->getOldAnmId()) {
316318
const char* a_name;
317319
if (anmID & 0x10000) {
318320
a_name = dStage_roomControl_c::getDemoArcName();
319-
JUT_ASSERT(267, a_name != NULL);
321+
JUT_ASSERT(0x267, a_name != NULL);
320322
} else {
321323
a_name = i_arcName;
322324
}
323325

324326
demo_actor->setOldAnmId(anmID);
325327

326-
J3DAnmTransform* i_key = (J3DAnmTransform*)dComIfG_getObjectIDRes(a_name, anmID);
328+
J3DAnmTransform* i_key = (J3DAnmTransform*)dComIfG_getObjectIDRes(a_name, anmID & 0xffff);
327329
JUT_ASSERT(272, i_key != 0);
328330

329-
void* ptr = dDemo_getJaiPointer(a_name, anmID, param_4, param_5);
331+
ptr = dDemo_getJaiPointer(a_name, anmID & 0xffff, param_4, param_5);
330332

331-
i_morf->setAnm(i_key, -1, demo_actor->getPrm_Morf(), 1.0f, 0.0f, -1.0f, ptr);
333+
f32 prmMorf = demo_actor->getPrm_Morf();
334+
i_morf->setAnm(i_key, -1, prmMorf, 1.0f, 0.0f, -1.0f, ptr);
332335
demo_actor->setAnmFrameMax(i_morf->getEndFrame());
333336
}
334337
}
@@ -337,7 +340,8 @@ int dDemo_setDemoData(fopAc_ac_c* i_actor, u8 i_flags, mDoExt_McaMorf* i_morf, c
337340
f32 anm_frame = demo_actor->getAnmFrame();
338341

339342
if (anm_frame > 1.0f) {
340-
i_morf->setFrame(anm_frame - 1.0f);
343+
anm_frame -= 1.0f;
344+
i_morf->setFrame(anm_frame);
341345
i_morf->play(&i_actor->current.pos, param_6, i_reverb);
342346
} else {
343347
i_morf->setFrame(anm_frame);

0 commit comments

Comments
 (0)