Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on various units, mostly d_menu_letter #2240

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clangd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CompileFlags:
Add: [-Wno-c++11-compat-deprecated-writable-strings, -Wno-extern-initializer]
Add: [-Wno-c++11-compat-deprecated-writable-strings, -Wno-extern-initializer, -Wno-multichar]
---
If:
PathMatch: .*/*.inc
Expand Down
4 changes: 2 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def MatchingFor(*versions):
Object(Matching, "d/d_menu_fmap2D.cpp"),
Object(Matching, "d/d_menu_insect.cpp"),
Object(Matching, "d/d_menu_item_explain.cpp"),
Object(NonMatching, "d/d_menu_letter.cpp"),
Object(NonMatching, "d/d_menu_letter.cpp", extra_cflags=['-pragma "nosyminline on"']),
Object(Matching, "d/d_menu_option.cpp"),
Object(Matching, "d/d_menu_ring.cpp"),
Object(Equivalent, "d/d_menu_save.cpp"),
Expand Down Expand Up @@ -680,7 +680,7 @@ def MatchingFor(*versions):
"JParticle",
[
Object(Matching, "JSystem/JParticle/JPAResourceManager.cpp"),
Object(Equivalent, "JSystem/JParticle/JPAResource.cpp"),
Object(Matching, "JSystem/JParticle/JPAResource.cpp", extra_cflags=['-pragma "nosyminline off"']),
Object(Matching, "JSystem/JParticle/JPABaseShape.cpp"),
Object(Matching, "JSystem/JParticle/JPAExtraShape.cpp"),
Object(Matching, "JSystem/JParticle/JPAChildShape.cpp"),
Expand Down
8 changes: 6 additions & 2 deletions include/JSystem/J2DGraph/J2DPicture.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ class J2DPicture : public J2DPane {
mWhite = i_white;
return true;
}
/* 801DFA4C */ virtual JUtility::TColor getBlack() const;
/* 801DFA40 */ virtual JUtility::TColor getWhite() const;
/* 801DFA4C */ virtual JUtility::TColor getBlack() const {
return mBlack;
}
/* 801DFA40 */ virtual JUtility::TColor getWhite() const {
return mWhite;
}
/* 8025603C */ virtual J2DMaterial* getMaterial() const { return NULL; }
/* 802FDBFC */ virtual void drawFullSet(f32, f32, f32, f32, Mtx*);
/* 802FE380 */ virtual void drawTexCoord(f32, f32, f32, f32, s16, s16, s16, s16, s16, s16, s16,
Expand Down
8 changes: 6 additions & 2 deletions include/JSystem/J2DGraph/J2DTextBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ class J2DTextBox : public J2DPane {
/* 80254408 */ virtual bool setBlack(JUtility::TColor);
/* 80186C84 */ virtual bool setWhite(JUtility::TColor white) { mWhiteColor = white; return true; }
/* 8019230C */ virtual bool setBlackWhite(JUtility::TColor, JUtility::TColor);
/* 801DFA34 */ virtual JUtility::TColor getBlack() const;
/* 801DFA28 */ virtual JUtility::TColor getWhite() const;
/* 801DFA34 */ virtual JUtility::TColor getBlack() const {
return mBlackColor;
}
/* 801DFA28 */ virtual JUtility::TColor getWhite() const {
return mWhiteColor;
}
/* 8025602C */ virtual J2DMaterial* getMaterial() const { return NULL; }

/* 802FFBC4 */ J2DTextBox(u64, JGeometry::TBox2<f32> const&, ResFONT const*, char const*, s16,
Expand Down
15 changes: 13 additions & 2 deletions include/d/actor/d_a_npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,22 @@ struct daNpcT_motionAnmData_c {

class daNpcT_Hermite_c {
public:
/* 8014CBAC */ ~daNpcT_Hermite_c();

/* 0x00 */ f32 field_0x00;
/* 0x04 */ cXyz mPosition;
/* 0x10 */ f32 field_0x10;

/* 8014CBAC */ virtual ~daNpcT_Hermite_c() {}

// constants might be wrong, regalloc
void Set(f32 param_1) {
field_0x00 = param_1;
f32 sqr = param_1 * param_1;
f32 cubed = param_1 * sqr;
mPosition.x = 1.0f + (2.0f * cubed - 3.0f * sqr);
mPosition.y = 4.0f * cubed + 3.0f * sqr;
mPosition.z = param_1 + (cubed - 2.0f * sqr);
field_0x10 = cubed - sqr;
}
};

class daNpcT_Path_c {
Expand Down
8 changes: 8 additions & 0 deletions include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,14 @@ inline void dComIfGs_onLetterGetFlag(int i_no) {
g_dComIfG_gameInfo.info.getPlayer().getLetterInfo().onLetterGetFlag(i_no);
}

inline int dComIfGs_isLetterReadFlag(int i_no) {
return g_dComIfG_gameInfo.info.getPlayer().getLetterInfo().isLetterReadFlag(i_no);
}

inline void dComIfGs_onLetterReadFlag(int i_no) {
g_dComIfG_gameInfo.info.getPlayer().getLetterInfo().onLetterReadFlag(i_no);
}

inline u8 dComIfGs_getArrowNum() {
return g_dComIfG_gameInfo.info.getPlayer().getItemRecord().getArrowNum();
}
Expand Down
4 changes: 2 additions & 2 deletions include/d/d_menu_letter.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ class dMenu_Letter_c : public dDlst_base_c {
/* 0x024 */ J2DScreen* mpSdwScreen;
/* 0x028 */ J2DScreen* mpLetterScreen[2];
/* 0x030 */ J2DScreen* mpIconScreen;
/* 0x034 */ J2DTextBox* field_0x34[6][5];
/* 0x034 */ J2DPane* field_0x34[6][5];
/* 0x0AC */ J2DTextBox* field_0xac[6][5];
/* 0x124 */ J2DTextBox* field_0x124[6][4];
/* 0x184 */ J2DTextBox* field_0x184[6][4];
/* 0x1E4 */ J2DTextBox* field_0x1e4[2];
/* 0x1EC */ J2DTextBox* field_0x1ec;
/* 0x1F0 */ J2DTextBox* field_0x1f0[9];
/* 0x214 */ J2DTextBox* mpPageLight[9];
/* 0x214 */ J2DPicture* mpPageLight[9];
/* 0x238 */ J2DTextBox* field_0x238[9];
/* 0x25C */ J2DTextBox* field_0x25c[12];
/* 0x28C */ J2DTextBox* mpAButtonString[5];
Expand Down
2 changes: 1 addition & 1 deletion include/d/d_msg_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class dMsgString_c : public dMsgStringBase_c {
return getStringLocal(param_0, param_1, param_2, param_3, param_4, param_5);
}
}
/* 801E1D10 */ virtual void getStringPage(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*,
/* 801E1D10 */ virtual f32 getStringPage(u32, u8, u8, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*,
u8);
/* 80249DB4 */ virtual void resetStringLocal(J2DTextBox*);
/* 80249DE4 */ virtual void drawOutFontLocal(J2DTextBox*, f32);
Expand Down
6 changes: 3 additions & 3 deletions src/JSystem/JParticle/JPAParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ JPAParticleCallBack::~JPAParticleCallBack() {

/* 8027EFEC-8027F8C8 27992C 08DC+00 0/0 1/1 0/0 .text
* init_p__15JPABaseParticleFP18JPAEmitterWorkData */
// NONMATCHING a couple problems, likely issues with setLength and get_r_ss
// NONMATCHING a couple problems, likely issues with setLength
void JPABaseParticle::init_p(JPAEmitterWorkData* work) {
JPABaseEmitter* emtr = work->mpEmtr;
JPAExtraShape* esp = work->mpRes->getEsp();
Expand Down Expand Up @@ -56,8 +56,8 @@ void JPABaseParticle::init_p(JPAEmitterWorkData* work) {
JGeometry::TVec3<f32> velDir;
if (emtr->mDirSpeed) {
Mtx mtx;
s16 angleY = emtr->get_r_ss();
s16 angleZ = emtr->get_r_zp() * 0x8000 * emtr->mSpread;
int angleZ = emtr->get_r_ss();
f32 angleY = emtr->get_r_zp() * 0x8000 * emtr->mSpread;
JPAGetYZRotateMtx(angleY, angleZ, mtx);
MTXConcat(work->mDirectionMtx, mtx, mtx);
velDir.set(emtr->mDirSpeed * mtx[0][2],
Expand Down
5 changes: 5 additions & 0 deletions src/JSystem/JParticle/JPAResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,3 +1117,8 @@ void JPAResource::calcWorkData_d(JPAEmitterWorkData* work) {
MTXConcat(work->mpEmtr->mGlobalRot, mtx, work->mGlobalRot);
MTXMultVecSR(work->mGlobalRot, &work->mpEmtr->mLocalDir, &work->mGlobalEmtrDir);
}

#pragma push
#pragma force_active on
static u8 jpa_resource_padding[28] = {0};
#pragma pop
78 changes: 71 additions & 7 deletions src/d/actor/d_a_npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,77 @@ dCcD_SrcSph daNpcF_c::mCcDSph = {
};

/* 801464D8-8014698C 140E18 04B4+00 1/1 0/0 0/0 .text chkPassed2__13daNpcT_Path_cF4cXyzP4cXyzii */
int daNpcT_Path_c::chkPassed2(cXyz param_0, cXyz* param_1, int param_2, int param_3) {
// NONMATCHING
// NONMATCHING
int daNpcT_Path_c::chkPassed2(cXyz param_1, cXyz* param_2, int param_3, int param_4) {
cXyz cStack_80;
cXyz local_8c;
cXyz local_98;
cXyz cStack_a4;
cXyz cStack_b0;
cXyz cStack_bc;
u16 idx = getIdx();
u16 local_140;
u16 local_142;
u16 local_144;
local_144 = idx;
local_142 = idx;
if (chkClose() && getNumPnts() == param_3) {
daNpcT_decIdx(getNumPnts(), local_142, 1, chkReverse());
daNpcT_incIdx(getNumPnts(), local_144, 1, chkReverse());
} else {
daNpcT_decIdx(param_3, local_142, 0, chkReverse());
daNpcT_incIdx(param_3, local_144, 0, chkReverse());
}
local_140 = local_142;
if (chkClose() && getNumPnts() == param_3) {
daNpcT_decIdx(getNumPnts(), local_140, 1, chkReverse());
} else {
daNpcT_decIdx(param_3, local_140, 0, chkReverse());
}

cStack_80 = getPntPos(local_140);
local_8c = getPntPos(local_142);
local_98 = getPntPos(idx);
cStack_a4 = getPntPos(local_144);
if (local_142 == (u16)(idx & 0xffff)) {
cStack_b0 = cStack_a4 - local_8c;
} else {
cStack_b0 = local_98 - local_8c;
}
if (local_144 == (u16)(idx & 0xffff)) {
cStack_bc = cStack_a4 - local_8c;
} else {
cStack_bc = cStack_a4 - local_98;
}
daNpcT_Hermite_c adStack_70;
cXyz auStack_d4;
adStack_70.Set(field_0x1E * (1.0f / param_4));
hermite(local_8c, cStack_b0, local_98, cStack_bc, adStack_70,
auStack_d4);
param_2->x = auStack_d4.x;
param_2->y = auStack_d4.y;
param_2->z = auStack_d4.z;
f32 local_12c;
f32 local_130;
f32 local_134;
f32 local_138;
f32 auStack_13c;
if (cM3d_Len2dSqPntAndSegLine(param_1.x, param_1.z, local_8c.x, local_8c.z, local_98.x,
local_98.z, &local_12c, &local_134, &auStack_13c) &&
cM3d_Len2dSqPntAndSegLine(param_2->x, param_2->z, local_8c.x, local_8c.z, local_98.x,
local_98.z, &local_130, &local_138, &auStack_13c))
{
s16 sVar10 = cM_atan2s(local_98.x - local_8c.x,
local_98.z - local_8c.z);
s16 sVar11 = cM_atan2s(local_130 - local_12c,
local_138 - local_134);
s16 diff = sVar10 - sVar11;
u16 uVar4 = abs(diff);
if (uVar4 > 0x4000) {
return 1;
}
}
return 0;
}

/* 8014698C-80146C98 1412CC 030C+00 1/1 0/0 0/0 .text
Expand Down Expand Up @@ -2246,11 +2315,6 @@ BOOL daNpcT_chkTmpBit(u32 i_idx) {
return dComIfGs_isTmpBit(dSv_event_tmp_flag_c::tempBitLabels[i_idx]);
}

/* 8014CBAC-8014CBF4 1474EC 0048+00 1/0 0/0 0/0 .text __dt__16daNpcT_Hermite_cFv */
daNpcT_Hermite_c::~daNpcT_Hermite_c() {
// NONMATCHING
}

/* 8014CC0C-8014CC10 14754C 0004+00 1/0 1/0 0/0 .text setCollision__8daNpcT_cFv */
void daNpcT_c::setCollision() {
/* empty function */
Expand Down
Loading