mirror of
https://github.com/encounter/tp.git
synced 2026-07-11 06:18:46 -07:00
Work on d_a_obj_flag3 (#2485)
* Work on d_a_obj_flag3 * Fix JASBasicWaveBank::incWaveTable * Match JASBNKParser::Ver0::createBasicBank
This commit is contained in:
@@ -10,7 +10,7 @@ class JKRHeap;
|
||||
|
||||
namespace JASBNKParser {
|
||||
struct TFileHeader {
|
||||
/* 0x0 */ u8 _00[4];
|
||||
/* 0x0 */ int id;
|
||||
/* 0x4 */ u32 mSize;
|
||||
/* 0x8 */ u8 _08[4];
|
||||
/* 0xC */ u32 mVersion;
|
||||
|
||||
@@ -64,7 +64,7 @@ struct JASWaveArc : JASDisposer {
|
||||
/* 0xC */ u32 _c;
|
||||
};
|
||||
|
||||
/* 0x04 */ JASHeap mHeap;
|
||||
/* 0x04 */ mutable JASHeap mHeap;
|
||||
/* 0x48 */ u32 _48;
|
||||
/* 0x4C */ volatile s32 mStatus;
|
||||
/* 0x50 */ int mEntryNum;
|
||||
|
||||
@@ -1,8 +1,80 @@
|
||||
#ifndef D_A_OBJ_FLAG3_H
|
||||
#define D_A_OBJ_FLAG3_H
|
||||
|
||||
#include "d/d_cc_d.h"
|
||||
#include "f_op/f_op_actor_mng.h"
|
||||
|
||||
struct daObjFlag3_Attr_c {
|
||||
/* 0x00 */ f32 mGravity;
|
||||
/* 0x04 */ f32 mSpringCoeeficient;
|
||||
/* 0x08 */ f32 mDecayRate;
|
||||
/* 0x0C */ f32 mWindCoefficient;
|
||||
/* 0x10 */ f32 mTornado;
|
||||
};
|
||||
|
||||
class FlagCloth2_c : public J3DPacket {
|
||||
public:
|
||||
/* 80BEEDE4 */ void execute();
|
||||
/* 80BEEF74 */ inline void calcFlagNormal(cXyz*, int);
|
||||
/* 80BEF278 */ inline cXyz calcFlagFactor(cXyz*, cXyz*, cXyz*, int);
|
||||
/* 80BEF790 */ virtual ~FlagCloth2_c();
|
||||
/* 80BEFD08 */ void initFlagPos(cXyz*, fopAc_ac_c*);
|
||||
/* 80BF00A0 */ virtual void draw();
|
||||
/* 80BF0434 */ cXyz getTargetPos() { return mPositions[4]; }
|
||||
|
||||
inline void calcFlagNormalBack();
|
||||
cXyz* getPos() { return mPositions; }
|
||||
cXyz* getVec() { return mVecs; }
|
||||
cXyz* getNormal() { return mNormals; }
|
||||
cXyz* getNormalBack() { return mNormalBacks; }
|
||||
GXTexObj* getImageTexObj() { return &mTexObj; }
|
||||
void setSpringRate(f32 rate) { mSpringRate = rate; }
|
||||
void setWindRate(f32 rate) { mWindRate = rate; }
|
||||
void setDecayRate(f32 rate) { mDecayRate = rate; }
|
||||
void setGravity(f32 rate) { mGravity = rate; }
|
||||
void setTornado(f32 tornado) { mTornado = tornado; }
|
||||
|
||||
void initTexCoord() {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < 6; j++) {
|
||||
mTexCoord[i* 6 + j][0] = j / 5.0f;
|
||||
mTexCoord[i* 6 + j][1] = (5 - i) / 5.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void calcFlagFactorSub(cXyz* param_1, cXyz* param_2, cXyz* param_3, f32 param_4) {
|
||||
cXyz acStack_2c = *param_2 - *param_1;
|
||||
param_4 = acStack_2c.abs() - param_4;
|
||||
cXyz cStack_38 = acStack_2c.normZC();
|
||||
param_4 *= mSpringRate;
|
||||
cStack_38 *= param_4;
|
||||
*param_3 += cStack_38;
|
||||
}
|
||||
|
||||
/* 0x010 */ GXTexObj mTexObj;
|
||||
/* 0x030 */ dKy_tevstr_c mTevStr;
|
||||
/* 0x3B8 */ dCcD_Stts mStts;
|
||||
/* 0x3F4 */ dCcD_Sph mSph;
|
||||
/* 0x52C */ u8 field_0x52c[0x540 - 0x52c];
|
||||
/* 0x540 */ cXyz mPositions[36];
|
||||
/* 0x6F0 */ u8 field_0x6f0[0x700 - 0x6f0];
|
||||
/* 0x700 */ cXyz mNormals[36];
|
||||
/* 0x8B0 */ u8 field_0x8b0[0x8c0 - 0x8b0];
|
||||
/* 0x8C0 */ cXyz mNormalBacks[36];
|
||||
/* 0xA70 */ u8 field_0xa70[0xa80 - 0xa70];
|
||||
/* 0xA70 */ f32 mTexCoord[36][2];
|
||||
/* 0xBA0 */ cXyz mVecs[36];
|
||||
/* 0xD50 */ cXyz* mpFlagPosition;
|
||||
/* 0xD54 */ Mtx mModelMtx;
|
||||
// /* 0xD8C */ void* mpTexCoord;
|
||||
/* 0xD84 */ f32 mSpringRate;
|
||||
/* 0xD88 */ f32 mWindRate;
|
||||
/* 0xD8C */ f32 mDecayRate;
|
||||
/* 0xD90 */ f32 mGravity;
|
||||
/* 0xD94 */ f32 mTornado;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup actors-objects
|
||||
* @class daObjFlag3_c
|
||||
@@ -13,30 +85,29 @@
|
||||
*/
|
||||
class daObjFlag3_c : public fopAc_ac_c {
|
||||
public:
|
||||
/* 80BEEA78 */ void createHeap();
|
||||
/* 80BEED3C */ void execute();
|
||||
/* 80BEEA78 */ int createHeap();
|
||||
/* 80BEED3C */ int execute();
|
||||
/* 80BEF700 */ ~daObjFlag3_c();
|
||||
/* 80BEF95C */ void create();
|
||||
/* 80BEF95C */ int create();
|
||||
/* 80BEFBC4 */ void create_init();
|
||||
inline int draw();
|
||||
inline void initBaseMtx();
|
||||
|
||||
static u8 const M_attr[20];
|
||||
static daObjFlag3_Attr_c const M_attr;
|
||||
const daObjFlag3_Attr_c& attr() const { return M_attr; }
|
||||
|
||||
private:
|
||||
/* 0x568 */ u8 field_0x568[0x1340 - 0x568];
|
||||
/* 0x0568 */ J3DModel* mModel;
|
||||
/* 0x056C */ request_of_phase_process_class mFlagPhase;
|
||||
/* 0x0574 */ request_of_phase_process_class mArcPhase;
|
||||
/* 0x057c */ int field_0x57c;
|
||||
/* 0x0580 */ FlagCloth2_c mFlagCloth;
|
||||
/* 0x1318 */ u8 field_0x1318[0x1320 - 0x1318];
|
||||
/* 0x1320 */ cXyz field_0x1320;
|
||||
/* 0x132C */ bool mFlagValid;
|
||||
/* 0x132D */ char mFlagName[19];
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(daObjFlag3_c) == 0x1340);
|
||||
|
||||
class FlagCloth2_c {
|
||||
public:
|
||||
/* 80BEEDE4 */ void execute();
|
||||
/* 80BEEF74 */ void calcFlagNormal(cXyz*, int);
|
||||
/* 80BEF278 */ void calcFlagFactor(cXyz*, cXyz*, cXyz*, int);
|
||||
/* 80BEF790 */ ~FlagCloth2_c();
|
||||
/* 80BEFD08 */ void initFlagPos(cXyz*, fopAc_ac_c*);
|
||||
/* 80BF00A0 */ void draw();
|
||||
/* 80BF0434 */ void getTargetPos();
|
||||
};
|
||||
|
||||
|
||||
#endif /* D_A_OBJ_FLAG3_H */
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "JSystem/JAudio2/JASCalc.h"
|
||||
#include "JSystem/JAudio2/JASDrumSet.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include "JSystem/JAudio2/JASChannel.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
@@ -27,10 +28,11 @@ JASBasicBank* JASBNKParser::createBasicBank(void const* stream, JKRHeap* heap) {
|
||||
}
|
||||
|
||||
u32 free_size = heap->getFreeSize();
|
||||
|
||||
TFileHeader* filep = (TFileHeader*)stream;
|
||||
JUT_ASSERT(59, filep->id == 'IBNK');
|
||||
JASBasicBank* bank = NULL;
|
||||
|
||||
TFileHeader* header = (TFileHeader*)stream;
|
||||
switch (header->mVersion) {
|
||||
switch (filep->mVersion) {
|
||||
case 0:
|
||||
bank = Ver0::createBasicBank(stream, heap);
|
||||
break;
|
||||
@@ -165,14 +167,12 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
|
||||
/* 80299A3C-80299E68 29437C 042C+00 1/1 0/0 0/0 .text
|
||||
* createBasicBank__Q212JASBNKParser4Ver0FPCvP7JKRHeap */
|
||||
// NONMATCHING
|
||||
JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* heap) {
|
||||
THeader const* header = (THeader*)stream;
|
||||
|
||||
if (heap == NULL) {
|
||||
heap = JASDram;
|
||||
}
|
||||
|
||||
|
||||
THeader const* header = (THeader*)stream;
|
||||
JASBasicBank* bank = new (heap, 0) JASBasicBank();
|
||||
if (bank == NULL) {
|
||||
return NULL;
|
||||
@@ -181,94 +181,101 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
bank->newInstTable(0x80, heap);
|
||||
|
||||
for (int i = 0; i < 0x80; i++) {
|
||||
TInst* tinst = header->mOffsets.mInstOffset[i].ptr(stream);
|
||||
TInst* tinst = header->mOffsets.mInstOffset[i].ptr(header);
|
||||
if (tinst != NULL) {
|
||||
JASBasicInst* inst = new (heap, 0) JASBasicInst();
|
||||
inst->setVolume(tinst->mVolume);
|
||||
inst->setPitch(tinst->mPitch);
|
||||
JASBasicInst* instp = new (heap, 0) JASBasicInst();
|
||||
JUT_ASSERT(368, instp != 0);
|
||||
instp->setVolume(tinst->mVolume);
|
||||
instp->setPitch(tinst->mPitch);
|
||||
|
||||
int osc_idx = 0;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
TOsc* tosc = tinst->mOscOffset[j].ptr(stream);
|
||||
TOsc* tosc = tinst->mOscOffset[j].ptr(header);
|
||||
if (tosc != NULL) {
|
||||
JASOscillator::Data* osc_data = findOscPtr(bank, header, tosc);
|
||||
if (osc_data != NULL) {
|
||||
inst->setOsc(osc_idx, osc_data);
|
||||
JASOscillator::Data* osc = findOscPtr(bank, header, tosc);
|
||||
if (osc != NULL) {
|
||||
instp->setOsc(osc_idx, osc);
|
||||
} else {
|
||||
osc_data = new (heap, 0) JASOscillator::Data();
|
||||
osc_data->mTarget = tosc->mTarget;
|
||||
osc_data->_04 = tosc->field_0x4;
|
||||
u32 size;
|
||||
osc = new (heap, 0) JASOscillator::Data();
|
||||
JUT_ASSERT(386, osc != 0);
|
||||
osc->mTarget = tosc->mTarget;
|
||||
osc->_04 = tosc->field_0x4;
|
||||
|
||||
JASOscillator::Point* points = tosc->mPointOffset.ptr(stream);
|
||||
JASOscillator::Point* points = tosc->mPointOffset.ptr(header);
|
||||
if (points != NULL) {
|
||||
size = getOscTableEndPtr(points) - points;
|
||||
const JASOscillator::Point* endPtr = getOscTableEndPtr(points);
|
||||
int size = endPtr - points;
|
||||
JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size];
|
||||
JUT_ASSERT(396, table != 0);
|
||||
JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point));
|
||||
osc_data->mTable = table;
|
||||
osc->mTable = table;
|
||||
} else {
|
||||
osc_data->mTable = NULL;
|
||||
osc->mTable = NULL;
|
||||
}
|
||||
|
||||
points = tosc->field_0xc.ptr(stream);
|
||||
points = tosc->field_0xc.ptr(header);
|
||||
if (points != NULL) {
|
||||
size = getOscTableEndPtr(points) - points;
|
||||
const JASOscillator::Point* endPtr = getOscTableEndPtr(points);
|
||||
int size = endPtr - points;
|
||||
JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size];
|
||||
JUT_ASSERT(409, table != 0);
|
||||
JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point));
|
||||
osc_data->_0C = table;
|
||||
osc->_0C = table;
|
||||
} else {
|
||||
osc_data->_0C = NULL;
|
||||
osc->_0C = NULL;
|
||||
}
|
||||
|
||||
osc_data->mScale = tosc->mScale;
|
||||
osc_data->_14 = tosc->field_0x14;
|
||||
inst->setOsc(osc_idx, osc_data);
|
||||
osc->mScale = tosc->mScale;
|
||||
osc->_14 = tosc->field_0x14;
|
||||
instp->setOsc(osc_idx, osc);
|
||||
}
|
||||
|
||||
osc_idx++;
|
||||
}
|
||||
}
|
||||
|
||||
inst->setKeyRegionCount(tinst->mKeyRegionCount, heap);
|
||||
instp->setKeyRegionCount(tinst->mKeyRegionCount, heap);
|
||||
for (int j = 0; j < tinst->mKeyRegionCount; j++) {
|
||||
JASBasicInst::TKeymap* keymap = inst->getKeyRegion(j);
|
||||
TKeymap* tkeymap = tinst->mKeymapOffset[j].ptr(stream);
|
||||
JASBasicInst::TKeymap* keymap = instp->getKeyRegion(j);
|
||||
TKeymap* tkeymap = tinst->mKeymapOffset[j].ptr(header);
|
||||
keymap->setHighKey(tkeymap->mHighKey);
|
||||
TVmap* tvmap = tkeymap->mVmapOffset.ptr(stream);
|
||||
TVmap* tvmap = tkeymap->mVmapOffset.ptr(header);
|
||||
keymap->field_0x4 = JSULoHalf(tvmap->field_0x4);
|
||||
keymap->field_0x8 = tvmap->field_0x8;
|
||||
keymap->field_0xc = tvmap->field_0xc;
|
||||
}
|
||||
|
||||
bank->setInst(i, inst);
|
||||
bank->setInst(i, instp);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
TPerc* tperc = header->mOffsets.mPercOffset[i].ptr(stream);
|
||||
TPerc* tperc = header->mOffsets.mPercOffset[i].ptr(header);
|
||||
if (tperc != NULL) {
|
||||
JASDrumSet* drumset = new (heap, 0) JASDrumSet();
|
||||
drumset->newPercArray(0x80, heap);
|
||||
JASDrumSet* setp = new (heap, 0) JASDrumSet();
|
||||
JUT_ASSERT(509, setp != 0);
|
||||
setp->newPercArray(0x80, heap);
|
||||
|
||||
for (int j = 0; j < 0x80; j++) {
|
||||
TPmap* tpmap = tperc->mPmapOffset[j].ptr(stream);
|
||||
TPmap* tpmap = tperc->mPmapOffset[j].ptr(header);
|
||||
if (tpmap != NULL) {
|
||||
JASDrumSet::TPerc* perc = new (heap, 0) JASDrumSet::TPerc();
|
||||
perc->setVolume(tpmap->mVolume);
|
||||
perc->setPitch(tpmap->mPitch);
|
||||
JASDrumSet::TPerc* percp = new (heap, 0) JASDrumSet::TPerc();
|
||||
JUT_ASSERT(519, percp);
|
||||
percp->setVolume(tpmap->mVolume);
|
||||
percp->setPitch(tpmap->mPitch);
|
||||
if (tperc->mMagic == 'PER2') {
|
||||
perc->setPan(tperc->mPan[j] / 127.0f);
|
||||
perc->setRelease(tperc->mRelease[j]);
|
||||
percp->setPan(tperc->mPan[j] / 127.0f);
|
||||
percp->setRelease(tperc->mRelease[j]);
|
||||
}
|
||||
TVmap* vmap = tpmap->mVmapOffset.ptr(stream);
|
||||
perc->field_0xe = JSULoHalf(vmap->field_0x4);
|
||||
perc->field_0x10 = vmap->field_0x8;
|
||||
perc->field_0x14 = vmap->field_0xc;
|
||||
drumset->setPerc(j, perc);
|
||||
TVmap* vmap = tpmap->mVmapOffset.ptr(header);
|
||||
percp->field_0xe = JSULoHalf(vmap->field_0x4);
|
||||
percp->field_0x10 = vmap->field_0x8;
|
||||
percp->field_0x14 = vmap->field_0xc;
|
||||
setp->setPerc(j, percp);
|
||||
}
|
||||
}
|
||||
|
||||
bank->setInst(i + 0xe4, drumset);
|
||||
bank->setInst(i + 0xe4, setp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,14 +55,12 @@ void JASBasicWaveBank::setWaveTableSize(u32 param_0, JKRHeap* param_1) {
|
||||
|
||||
/* 80298790-8029883C 2930D0 00AC+00 1/1 0/0 0/0 .text
|
||||
* incWaveTable__16JASBasicWaveBankFPCQ216JASBasicWaveBank10TWaveGroup */
|
||||
// NONMATCHING instruction order
|
||||
// This works if argument type is changed to non const
|
||||
void JASBasicWaveBank::incWaveTable(JASBasicWaveBank::TWaveGroup const* param_0) {
|
||||
JASMutexLock lock(&field_0x4);
|
||||
for (u32 i = 0; i < param_0->getWaveCount(); i++) {
|
||||
TWaveHandle* handle = mWaveTable + param_0->getWaveID(i);
|
||||
if (!handle->mHeap) {
|
||||
handle->mHeap = const_cast<JASHeap*>(¶m_0->mHeap);
|
||||
handle->mHeap = ¶m_0->mHeap;
|
||||
handle->field_0x4.field_0x20 = ¶m_0->_48;
|
||||
handle->field_0x4.field_0x08 = param_0->mCtrlWaveArray[i].field_0x4;
|
||||
}
|
||||
|
||||
+472
-423
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user