mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-26 06:16:24 -04:00
Merge decomp/main into dusk
Merges 44 upstream commits from zeldaret/tp decomp/main. Conflict resolutions: - .github/workflows/build.yml: keep deleted (not needed for PC port) - README.md: keep PC port README - J3DAnimation.h: keep OFFSET_PTR macro + add upstream forward decl - J3DModelLoader.h: keep BE(u32) mBlockNum + add field_0x1c - d_com_inf_game.h: keep PC port inlines + add upstream declarations - global.h: keep MULTI_CHAR macro + add FABSF macro - JUTConsole.cpp: keep uintptr_t cast for 64-bit - JUTDbPrint.cpp: keep PC enter_() helper + add cstring include - JUTResFont.cpp: take upstream loop/struct improvements with BE types - JUTCacheFont.cpp: take upstream decomp fix - float.h: use upstream !PLATFORM_GCN guard - d_a_npc_bouS/theB.cpp: keep MULTI_CHAR() for PC portability - d_a_npc_henna.cpp: keep uintptr_t + use upstream var name - d_demo.cpp: keep near_/far_ field renames for PC - d_resorce.cpp: keep uintptr_t + fix var name to res - d_s_room.cpp, m_Do_graphic.cpp: keep dusk includes + add cstring - m_Do_main.cpp: keep JHIComPortManager + use JAS_GLOBAL_INSTANCE_INIT - angle_utils.h: remove redundant types.h include
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "JSystem/J2DGraph/J2DAnimation.h"
|
||||
#include "JSystem/J2DGraph/J2DScreen.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTransform.h"
|
||||
#include "JSystem/JUtility/JUTPalette.h"
|
||||
#include "JSystem/JUtility/JUTResource.h"
|
||||
#include <dolphin/os.h>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "JSystem/J2DGraph/J2DAnimation.h"
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/J2DGraph/J2DScreen.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTransform.h"
|
||||
#include "JSystem/JSupport/JSURandomInputStream.h"
|
||||
#include "JSystem/JUtility/JUTResource.h"
|
||||
#ifndef __MWERKS__
|
||||
|
||||
@@ -471,8 +471,7 @@ const ResTIMG* J2DPicture::changeTexture(char const* resName, u8 param_1) {
|
||||
return changeTexture((ResTIMG*)J2DScreen::getNameResource(resName), param_1);
|
||||
}
|
||||
|
||||
static bool dummy_weak_order(JUTTexture* tex) {
|
||||
J2DPicture* picture;
|
||||
static bool dummy_weak_order(J2DPicture* picture, JUTTexture* tex) {
|
||||
return picture->append(tex, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
char* J2DPrint::mStrBuff;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JSupport/JSURandomInputStream.h"
|
||||
#include "JSystem/JUtility/JUTResFont.h"
|
||||
#include "JSystem/JUtility/JUTResource.h"
|
||||
#include <cstring>
|
||||
|
||||
J2DTextBox::J2DTextBox()
|
||||
: mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), mWhiteColor(), mBlackColor() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
|
||||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
|
||||
@@ -26,14 +26,6 @@ J3DMtxBuffer* J3DMtxCalc::mMtxBuffer;
|
||||
|
||||
J3DJoint* J3DMtxCalc::mJoint;
|
||||
|
||||
inline s32 checkScaleOne(const Vec& param_0) {
|
||||
if (param_0.x == 1.0f && param_0.y == 1.0f && param_0.z == 1.0f) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DMtxCalcCalcTransformBasic::calcTransform(J3DTransformInfo const& transInfo) {
|
||||
J3DJoint* joint = J3DMtxCalc::getJoint();
|
||||
J3DMtxBuffer* mtxBuf = J3DMtxCalc::getMtxBuffer();
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DU/J3DUFur.h"
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DVertex.h"
|
||||
|
||||
static void dummy(J3DShape* shape, J3DVertexBuffer* vtxBuf, J3DModel* model, J3DModelData* modelData) {
|
||||
J3DMaterial* material = shape->getMaterial();
|
||||
J3DJoint* joint = material->getJoint();
|
||||
|
||||
vtxBuf->swapTransformedVtxPos();
|
||||
J3DVertexData* vtxData = vtxBuf->getVertexData();
|
||||
vtxBuf->getTransformedVtxPos(0);
|
||||
vtxBuf->getCurrentVtxNrm();
|
||||
vtxBuf->setCurrentVtxPos(NULL);
|
||||
|
||||
model->getVertexBuffer();
|
||||
|
||||
vtxData->getNrmNum();
|
||||
modelData->getNrmNum();
|
||||
vtxData->getVtxNum();
|
||||
modelData->getVtxNum();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DU/J3DUMotion.h"
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
static void dummy(J3DMtxCalcJ3DSysInitSoftimage* img, Vec* vec) {
|
||||
Mtx mtx;
|
||||
img->init(*vec, mtx);
|
||||
checkScaleOne(*vec);
|
||||
J3DMtxCalc::getMtxBuffer();
|
||||
JMAFastReciprocal(0.0f);
|
||||
JMath::fastReciprocal(0.0f);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DU/J3DUShadow.h"
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
|
||||
void J3DUShadow_dummy(JUTTexture* tex, JGeometry::TVec3<f32>* vec) {
|
||||
JMAAbs(0.0f);
|
||||
JMathInlineVEC::C_VECDotProduct(NULL, NULL);
|
||||
vec->dot(*vec);
|
||||
vec->length();
|
||||
|
||||
tex->getCaptureFlag();
|
||||
tex->getFormat();
|
||||
JMath::fastSqrt<f32>(0.0f);
|
||||
JUTTexture tex2;
|
||||
tex2.setCaptureFlag(false);
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "JSystem/JAHostIO/JAHioMessage.h"
|
||||
#include "JSystem/JAHostIO/JAHioMgr.h"
|
||||
#include "JSystem/JHostIO/JORServer.h"
|
||||
#include <cstring>
|
||||
|
||||
JAHioNode::JAHioNode(const char* name) : mTree(this) {
|
||||
mLastChild = NULL;
|
||||
|
||||
@@ -263,9 +263,6 @@ s16 const JASCalc::CUTOFF_TO_IIR_TABLE[128][4] = {
|
||||
0x7FFF, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
template <>
|
||||
s16 JASCalc::clamp(s32);
|
||||
|
||||
// currently required because of missing functions
|
||||
// JASCalc::hannWindow(short *, u32)
|
||||
// JASCalc::hammWindow(short *, u32)
|
||||
@@ -319,12 +316,3 @@ f32 JASCalc::pow2(f32 x) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <>
|
||||
s16 JASCalc::clamp(s32 x) {
|
||||
if (x <= std::numeric_limits<s16>::min())
|
||||
return std::numeric_limits<s16>::min();
|
||||
if (x >= std::numeric_limits<s16>::max())
|
||||
return std::numeric_limits<s16>::max();
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAudio2/JAUAudience.h"
|
||||
|
||||
// NONMATCHING
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "JSystem/JAudio2/JAUStreamFileTable.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include <dolphin/dvd.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace {
|
||||
class TPushCurrentHeap {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAudio2/JAUSoundObject.h"
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
|
||||
static void dummy(JGeometry::TVec3<f32>* vec_1, JGeometry::TVec3<f32>* vec_2) {
|
||||
*vec_1 = *vec_2;
|
||||
}
|
||||
@@ -337,10 +337,10 @@ JKRFileFinder* JKRArchive::getFirstFile(const char* path) const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u32 JKRArchive::getFileAttribute(u32 index) const {
|
||||
u8 JKRArchive::getFileAttribute(u32 index) const {
|
||||
SDIFileEntry* fileEntry = findIdxResource(index);
|
||||
if (fileEntry) {
|
||||
return u8(fileEntry->type_flags_and_name_offset >> 24);
|
||||
return fileEntry->type_flags_and_name_offset >> 24;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -135,15 +135,7 @@ void JPACalcClrIdxNormal(JPAEmitterWorkData* work) {
|
||||
|
||||
void JPACalcClrIdxNormal(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
s16 age = param_1->mAge;
|
||||
s16 maxFrm = shape->getClrAnmMaxFrm();
|
||||
s16 keyFrame;
|
||||
if (age < maxFrm) {
|
||||
keyFrame = age;
|
||||
} else {
|
||||
keyFrame = maxFrm;
|
||||
}
|
||||
work->mClrKeyFrame = keyFrame;
|
||||
work->mClrKeyFrame = param_1->mAge < shape->getClrAnmMaxFrm() ? param_1->mAge : shape->getClrAnmMaxFrm();
|
||||
}
|
||||
|
||||
void JPACalcClrIdxRepeat(JPAEmitterWorkData* work) {
|
||||
@@ -153,27 +145,25 @@ void JPACalcClrIdxRepeat(JPAEmitterWorkData* work) {
|
||||
|
||||
void JPACalcClrIdxRepeat(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
s32 tick = shape->getClrLoopOfst(param_1->mAnmRandom);
|
||||
tick = param_1->mAge + tick;
|
||||
work->mClrKeyFrame = tick % (shape->getClrAnmMaxFrm() + 1);
|
||||
s32 r28 = shape->getClrAnmMaxFrm() + 1;
|
||||
work->mClrKeyFrame = (param_1->mAge + shape->getClrLoopOfst(param_1->mAnmRandom)) % r28;
|
||||
}
|
||||
|
||||
void JPACalcClrIdxReverse(JPAEmitterWorkData* work) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
int maxFrm = shape->getClrAnmMaxFrm();
|
||||
u32 tick = work->mpEmtr->mTick;
|
||||
u32 uVar1 = tick / maxFrm;
|
||||
tick = tick % maxFrm;
|
||||
uVar1 &= 1;
|
||||
work->mClrKeyFrame = tick + (uVar1) * (maxFrm - tick * 2);
|
||||
u32 div = (work->mpEmtr->mTick / maxFrm) & 1;
|
||||
u32 rem = work->mpEmtr->mTick % maxFrm;
|
||||
work->mClrKeyFrame = rem + (div) * (maxFrm - rem * 2);
|
||||
}
|
||||
|
||||
void JPACalcClrIdxReverse(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
s32 tick = param_1->mAge + shape->getClrLoopOfst(param_1->mAnmRandom);
|
||||
s32 r29 = param_1->mAge + shape->getClrLoopOfst(param_1->mAnmRandom);
|
||||
s32 maxFrm = shape->getClrAnmMaxFrm();
|
||||
s32 rem = tick % maxFrm;
|
||||
work->mClrKeyFrame = rem + ((tick / maxFrm) & 1) * (maxFrm - rem * 2);
|
||||
s32 div = (r29 / maxFrm) & 1;
|
||||
s32 rem = r29 % maxFrm;
|
||||
work->mClrKeyFrame = rem + (div) * (maxFrm - rem * 2);
|
||||
}
|
||||
|
||||
void JPACalcClrIdxMerge(JPAEmitterWorkData* work) {
|
||||
@@ -183,8 +173,7 @@ void JPACalcClrIdxMerge(JPAEmitterWorkData* work) {
|
||||
void JPACalcClrIdxMerge(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
s32 maxFrm = shape->getClrAnmMaxFrm() + 1;
|
||||
s32 tick = (s32)(param_1->mTime * maxFrm) + shape->getClrLoopOfst(param_1->mAnmRandom);
|
||||
work->mClrKeyFrame = tick % maxFrm;
|
||||
work->mClrKeyFrame = (s32(param_1->mTime * maxFrm) + shape->getClrLoopOfst(param_1->mAnmRandom)) % maxFrm;
|
||||
}
|
||||
|
||||
void JPACalcClrIdxRandom(JPAEmitterWorkData* work) {
|
||||
@@ -193,9 +182,7 @@ void JPACalcClrIdxRandom(JPAEmitterWorkData* work) {
|
||||
|
||||
void JPACalcClrIdxRandom(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
s32 tick = shape->getClrLoopOfst(param_1->mAnmRandom);
|
||||
s32 maxFrm = shape->getClrAnmMaxFrm() + 1;
|
||||
work->mClrKeyFrame = tick % maxFrm;
|
||||
work->mClrKeyFrame = shape->getClrLoopOfst(param_1->mAnmRandom) % (shape->getClrAnmMaxFrm() + 1);
|
||||
}
|
||||
|
||||
void JPACalcPrm(JPAEmitterWorkData* work) {
|
||||
@@ -221,15 +208,15 @@ void JPACalcColorCopy(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
}
|
||||
|
||||
void JPAGenTexCrdMtxIdt(JPAEmitterWorkData* param_0) {
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
}
|
||||
|
||||
void JPAGenTexCrdMtxAnm(JPAEmitterWorkData* param_0) {
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0);
|
||||
}
|
||||
|
||||
void JPAGenTexCrdMtxPrj(JPAEmitterWorkData* param_0) {
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0, GX_FALSE, GX_PTIDENTITY);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0);
|
||||
}
|
||||
|
||||
void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) {
|
||||
@@ -260,7 +247,7 @@ void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) {
|
||||
local_108[2][2] = 1.0f;
|
||||
local_108[2][3] = 0.0f;
|
||||
GXLoadTexMtxImm(local_108, 0x1e, GX_MTX2x4);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x1e, false, 0x7d);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX0);
|
||||
}
|
||||
|
||||
void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
@@ -307,16 +294,12 @@ void JPALoadTexAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
|
||||
void JPACalcTexIdxNormal(JPAEmitterWorkData* work) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
u8 tick = shape->getTexAnmKeyNum() - 1 < work->mpEmtr->mTick
|
||||
? shape->getTexAnmKeyNum() - 1 : work->mpEmtr->mTick;
|
||||
work->mpEmtr->mTexAnmIdx = shape->getTexIdx(tick);
|
||||
work->mpEmtr->mTexAnmIdx = shape->getTexIdx(shape->getTexAnmKeyNum() - 1 < work->mpEmtr->mTick ? shape->getTexAnmKeyNum() - 1 : work->mpEmtr->mTick);
|
||||
}
|
||||
|
||||
void JPACalcTexIdxNormal(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
u8 tick = shape->getTexAnmKeyNum() - 1 < param_1->mAge
|
||||
? shape->getTexAnmKeyNum() - 1 : param_1->mAge;
|
||||
param_1->mTexAnmIdx = shape->getTexIdx(tick);
|
||||
param_1->mTexAnmIdx = shape->getTexIdx(shape->getTexAnmKeyNum() - 1 < param_1->mAge ? shape->getTexAnmKeyNum() - 1 : param_1->mAge);
|
||||
}
|
||||
|
||||
void JPACalcTexIdxRepeat(JPAEmitterWorkData* work) {
|
||||
@@ -335,18 +318,18 @@ void JPACalcTexIdxReverse(JPAEmitterWorkData* work) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
int tick = work->mpEmtr->mTick;
|
||||
int keyNum = (int)shape->getTexAnmKeyNum() - 1;
|
||||
int div = tick / keyNum;
|
||||
int div = tick / keyNum & 1;
|
||||
int rem = tick % keyNum;
|
||||
work->mpEmtr->mTexAnmIdx = shape->getTexIdx(rem + (div & 1) * (keyNum - rem * 2));
|
||||
work->mpEmtr->mTexAnmIdx = shape->getTexIdx(rem + div * (keyNum - rem * 2));
|
||||
}
|
||||
|
||||
void JPACalcTexIdxReverse(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
s32 tick = shape->getTexLoopOfst(param_1->mAnmRandom) + param_1->mAge;
|
||||
int keyNum = (int)shape->getTexAnmKeyNum() - 1;
|
||||
int div = tick / keyNum;
|
||||
int div = tick / keyNum & 1;
|
||||
int rem = tick % keyNum;
|
||||
param_1->mTexAnmIdx = shape->getTexIdx(rem + (div & 1) * (keyNum - rem * 2));
|
||||
param_1->mTexAnmIdx = shape->getTexIdx(rem + div * (keyNum - rem * 2));
|
||||
}
|
||||
|
||||
void JPACalcTexIdxMerge(JPAEmitterWorkData* work) {
|
||||
@@ -356,8 +339,7 @@ void JPACalcTexIdxMerge(JPAEmitterWorkData* work) {
|
||||
void JPACalcTexIdxMerge(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
JPABaseShape* shape = work->mpRes->getBsp();
|
||||
s32 maxFrm = shape->getTexAnmKeyNum();
|
||||
s32 tick = (s32)(maxFrm * param_1->mTime) + shape->getTexLoopOfst(param_1->mAnmRandom);
|
||||
param_1->mTexAnmIdx = shape->getTexIdx(tick % maxFrm);
|
||||
param_1->mTexAnmIdx = shape->getTexIdx((s32(maxFrm * param_1->mTime) + shape->getTexLoopOfst(param_1->mAnmRandom)) % maxFrm);
|
||||
}
|
||||
|
||||
void JPACalcTexIdxRandom(JPAEmitterWorkData* work) {
|
||||
@@ -435,124 +417,122 @@ static projectionFunc p_prj[3] = {
|
||||
};
|
||||
|
||||
void JPADrawBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, param_1->mPosition, local_48);
|
||||
Mtx local_38;
|
||||
local_38[0][0] = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][1] = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][2] = 1.0f;
|
||||
local_38[2][3] = local_48.z;
|
||||
local_38[2][1] = 0.0f;
|
||||
local_38[2][0] = 0.0f;
|
||||
local_38[1][2] = 0.0f;
|
||||
local_38[1][0] = 0.0f;
|
||||
local_38[0][2] = 0.0f;
|
||||
local_38[0][1] = 0.0f;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, ¶m_1->mPosition, &local_48);
|
||||
Mtx local_38;
|
||||
local_38[0][0] = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][1] = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][2] = 1.0f;
|
||||
local_38[2][3] = local_48.z;
|
||||
local_38[0][1] = local_38[0][2] = local_38[1][0] = local_38[1][2] = local_38[2][0] = local_38[2][1] = 0.0f;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void JPADrawRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, param_1->mPosition, local_48);
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
f32 particleX = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
|
||||
Mtx local_38;
|
||||
local_38[0][0] = cosRot * particleX;
|
||||
local_38[0][1] = -sinRot * particleY;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][0] = sinRot * particleX;
|
||||
local_38[1][1] = cosRot * particleY;
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][2] = 1.0f;
|
||||
local_38[2][3] = local_48.z;
|
||||
local_38[2][1] = 0.0f;
|
||||
local_38[2][0] = 0.0f;
|
||||
local_38[1][2] = 0.0f;
|
||||
local_38[0][2] = 0.0f;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, ¶m_1->mPosition, &local_48);
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
f32 particleX = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
|
||||
Mtx local_38;
|
||||
local_38[0][0] = cosRot * particleX;
|
||||
local_38[0][1] = -sinRot * particleY;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][0] = sinRot * particleX;
|
||||
local_38[1][1] = cosRot * particleY;
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][2] = 1.0f;
|
||||
local_38[2][3] = local_48.z;
|
||||
local_38[0][2] = local_38[1][2] = local_38[2][0] = local_38[2][1] = 0.0f;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void JPADrawYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, param_1->mPosition, local_48);
|
||||
Mtx local_38;
|
||||
f32 particleY = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
local_38[0][0] = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][1] = work->mYBBCamMtx[1][1] * particleY;
|
||||
local_38[1][2] = work->mYBBCamMtx[1][2];
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][1] = work->mYBBCamMtx[2][1] * particleY;
|
||||
local_38[2][2] = work->mYBBCamMtx[2][2];
|
||||
local_38[2][3] = local_48.z;
|
||||
local_38[2][0] = 0.0f;
|
||||
local_38[1][0] = 0.0f;
|
||||
local_38[0][2] = 0.0f;
|
||||
local_38[0][1] = 0.0f;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, ¶m_1->mPosition, &local_48);
|
||||
Mtx local_38;
|
||||
f32 particleX = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
local_38[0][0] = particleX;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][1] = work->mYBBCamMtx[1][1] * particleY;
|
||||
local_38[1][2] = work->mYBBCamMtx[1][2];
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][1] = work->mYBBCamMtx[2][1] * particleY;
|
||||
local_38[2][2] = work->mYBBCamMtx[2][2];
|
||||
local_38[2][3] = local_48.z;
|
||||
local_38[0][1] = local_38[0][2] = local_38[1][0] = local_38[2][0] = 0.0f;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void JPADrawRotYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, param_1->mPosition, local_48);
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
Mtx local_38;
|
||||
f32 particleX = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
f32 local_98 = (float)(sinRot * particleX);
|
||||
f32 local_94 = (float)(cosRot * particleY);
|
||||
f32 local_90 = work->mYBBCamMtx[1][1];
|
||||
f32 fVar1 = work->mYBBCamMtx[2][1];
|
||||
local_38[0][0] = (float)(cosRot * particleX);
|
||||
local_38[0][1] = (float)(-sinRot * particleY);
|
||||
local_38[0][2] = 0.0f;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][0] = local_98 * local_90;
|
||||
local_38[1][1] = local_94 * local_90;
|
||||
local_38[1][2] = -fVar1;
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][0] = local_98 * fVar1;
|
||||
local_38[2][1] = local_94 * fVar1;
|
||||
local_38[2][2] = local_90;
|
||||
local_38[2][3] = local_48.z;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JGeometry::TVec3<f32> local_48;
|
||||
MTXMultVec(work->mPosCamMtx, ¶m_1->mPosition, &local_48);
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
Mtx local_38;
|
||||
f32 particleX = work->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = work->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
f32 local_98 = (float)(sinRot * particleX);
|
||||
f32 local_94 = (float)(cosRot * particleY);
|
||||
f32 local_90 = work->mYBBCamMtx[1][1];
|
||||
f32 fVar1 = work->mYBBCamMtx[2][1];
|
||||
local_38[0][0] = (float)(cosRot * particleX);
|
||||
local_38[0][1] = (float)(-sinRot * particleY);
|
||||
local_38[0][2] = 0.0f;
|
||||
local_38[0][3] = local_48.x;
|
||||
local_38[1][0] = local_98 * local_90;
|
||||
local_38[1][1] = local_94 * local_90;
|
||||
local_38[1][2] = -fVar1;
|
||||
local_38[1][3] = local_48.y;
|
||||
local_38[2][0] = local_98 * fVar1;
|
||||
local_38[2][1] = local_94 * fVar1;
|
||||
local_38[2][2] = local_90;
|
||||
local_38[2][3] = local_48.z;
|
||||
GXLoadPosMtxImm(local_38, 0);
|
||||
p_prj[work->mPrjType](work, local_38);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void dirTypeVel(JPAEmitterWorkData const* work, JPABaseParticle const* param_1,
|
||||
JGeometry::TVec3<f32>* param_2) {
|
||||
param_1->getVelVec(*param_2);
|
||||
param_1->getVelVec(param_2);
|
||||
}
|
||||
|
||||
void dirTypePos(JPAEmitterWorkData const* work, JPABaseParticle const* param_1,
|
||||
JGeometry::TVec3<f32>* param_2) {
|
||||
param_1->getLocalPosition(*param_2);
|
||||
param_1->getLocalPosition(param_2);
|
||||
}
|
||||
|
||||
void dirTypePosInv(JPAEmitterWorkData const* work, JPABaseParticle const* param_1,
|
||||
JGeometry::TVec3<f32>* param_2) {
|
||||
param_1->getLocalPosition(*param_2);
|
||||
param_1->getLocalPosition(param_2);
|
||||
param_2->negate();
|
||||
}
|
||||
|
||||
@@ -564,13 +544,10 @@ void dirTypeEmtrDir(JPAEmitterWorkData const* work, JPABaseParticle const* param
|
||||
void dirTypePrevPtcl(JPAEmitterWorkData const* work, JPABaseParticle const* param_1,
|
||||
JGeometry::TVec3<f32>* param_2) {
|
||||
JGeometry::TVec3<f32> aTStack_24;
|
||||
param_1->getGlobalPosition(aTStack_24);
|
||||
JPANode<JPABaseParticle>* end = work->mpAlivePtcl->getEnd();
|
||||
JPANode<JPABaseParticle>* prev = work->mpCurNode->getPrev();
|
||||
|
||||
if (end != prev) {
|
||||
JPABaseParticle* particle = work->mpCurNode->getPrev()->getObject();
|
||||
particle->getGlobalPosition(*param_2);
|
||||
param_1->getGlobalPosition(&aTStack_24);
|
||||
|
||||
if (work->mpCurNode->getPrev() != work->mpAlivePtcl->getEnd()) {
|
||||
work->mpCurNode->getPrev()->getObject()->getGlobalPosition(param_2);
|
||||
} else {
|
||||
work->mpEmtr->calcEmitterGlobalPosition(param_2);
|
||||
}
|
||||
@@ -623,23 +600,22 @@ static void rotTypeZ(f32 param_0, f32 param_1, Mtx& param_2) {
|
||||
}
|
||||
|
||||
static void rotTypeXYZ(f32 param_0, f32 param_1, Mtx& param_2) {
|
||||
f32 f3 = 0.33333298563957214f * (1.0f - param_1);
|
||||
f32 fVar1;
|
||||
f32 f4;
|
||||
f4 = f3 + 0.5773500204086304f * param_0;
|
||||
fVar1 = f3 - 0.5773500204086304f * param_0;
|
||||
f3 += param_1;
|
||||
param_2[0][0] = f3;
|
||||
param_2[0][1] = fVar1;
|
||||
param_2[0][2] = f4;
|
||||
f32 f31 = 0.33333298563957214f * (1.0f - param_1);
|
||||
f32 f30 = 0.57735f * param_0;
|
||||
f32 f29 = f31 + f30;
|
||||
f30 = f31 - f30;
|
||||
f31 += param_1;
|
||||
param_2[0][0] = f31;
|
||||
param_2[0][1] = f30;
|
||||
param_2[0][2] = f29;
|
||||
param_2[0][3] = 0.0f;
|
||||
param_2[1][0] = f4;
|
||||
param_2[1][1] = f3;
|
||||
param_2[1][2] = fVar1;
|
||||
param_2[1][0] = f29;
|
||||
param_2[1][1] = f31;
|
||||
param_2[1][2] = f30;
|
||||
param_2[1][3] = 0.0f;
|
||||
param_2[2][0] = fVar1;
|
||||
param_2[2][1] = f4;
|
||||
param_2[2][2] = f3;
|
||||
param_2[2][0] = f30;
|
||||
param_2[2][1] = f29;
|
||||
param_2[2][2] = f31;
|
||||
param_2[2][3] = 0.0f;
|
||||
}
|
||||
|
||||
@@ -704,141 +680,160 @@ static u8* p_dl[2] = {
|
||||
};
|
||||
|
||||
void JPADrawDirection(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
JGeometry::TVec3<f32> local_6c;
|
||||
JGeometry::TVec3<f32> local_78;
|
||||
p_direction[param_0->mDirType](param_0, param_1, &local_6c);
|
||||
if (!local_6c.isZero()) {
|
||||
local_6c.normalize();
|
||||
local_78.cross(param_1->mBaseAxis, local_6c);
|
||||
if (!local_78.isZero()) {
|
||||
local_78.normalize();
|
||||
param_1->mBaseAxis.cross(local_6c, local_78);
|
||||
param_1->mBaseAxis.normalize();
|
||||
Mtx local_60;
|
||||
f32 fVar1 = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 fVar2 = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
local_60[0][0] = param_1->mBaseAxis.x;
|
||||
local_60[0][1] = local_6c.x;
|
||||
local_60[0][2] = local_78.x;
|
||||
local_60[0][3] = param_1->mPosition.x;
|
||||
local_60[1][0] = param_1->mBaseAxis.y;
|
||||
local_60[1][1] = local_6c.y;
|
||||
local_60[1][2] = local_78.y;
|
||||
local_60[1][3] = param_1->mPosition.y;
|
||||
local_60[2][0] = param_1->mBaseAxis.z;
|
||||
local_60[2][1] = local_6c.z;
|
||||
local_60[2][2] = local_78.z;
|
||||
local_60[2][3] = param_1->mPosition.z;
|
||||
p_plane[param_0->mPlaneType](local_60, fVar1, fVar2);
|
||||
MTXConcat(param_0->mPosCamMtx, local_60, local_60);
|
||||
GXLoadPosMtxImm(local_60, 0);
|
||||
p_prj[param_0->mPrjType](param_0, local_60);
|
||||
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
||||
}
|
||||
}
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JGeometry::TVec3<f32> local_6c;
|
||||
JGeometry::TVec3<f32> local_78;
|
||||
p_direction[param_0->mDirType](param_0, param_1, &local_6c);
|
||||
|
||||
if (local_6c.isZero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
local_6c.normalize();
|
||||
local_78.cross(param_1->mBaseAxis, local_6c);
|
||||
|
||||
if (local_78.isZero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
local_78.normalize();
|
||||
param_1->mBaseAxis.cross(local_6c, local_78);
|
||||
param_1->mBaseAxis.normalize();
|
||||
Mtx local_60;
|
||||
f32 fVar1 = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 fVar2 = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
local_60[0][0] = param_1->mBaseAxis.x;
|
||||
local_60[0][1] = local_6c.x;
|
||||
local_60[0][2] = local_78.x;
|
||||
local_60[0][3] = param_1->mPosition.x;
|
||||
local_60[1][0] = param_1->mBaseAxis.y;
|
||||
local_60[1][1] = local_6c.y;
|
||||
local_60[1][2] = local_78.y;
|
||||
local_60[1][3] = param_1->mPosition.y;
|
||||
local_60[2][0] = param_1->mBaseAxis.z;
|
||||
local_60[2][1] = local_6c.z;
|
||||
local_60[2][2] = local_78.z;
|
||||
local_60[2][3] = param_1->mPosition.z;
|
||||
p_plane[param_0->mPlaneType](local_60, fVar1, fVar2);
|
||||
MTXConcat(param_0->mPosCamMtx, local_60, local_60);
|
||||
GXLoadPosMtxImm(local_60, 0);
|
||||
p_prj[param_0->mPrjType](param_0, local_60);
|
||||
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void JPADrawRotDirection(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
JGeometry::TVec3<f32> local_6c;
|
||||
JGeometry::TVec3<f32> local_78;
|
||||
p_direction[param_0->mDirType](param_0, param_1, &local_6c);
|
||||
if (!local_6c.isZero()) {
|
||||
local_6c.normalize();
|
||||
local_78.cross(param_1->mBaseAxis, local_6c);
|
||||
if (!local_78.isZero()) {
|
||||
local_78.normalize();
|
||||
param_1->mBaseAxis.cross(local_6c, local_78);
|
||||
param_1->mBaseAxis.normalize();
|
||||
f32 particleX = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
Mtx auStack_80;
|
||||
Mtx local_60;
|
||||
p_rot[param_0->mRotType](sinRot, cosRot, auStack_80);
|
||||
p_plane[param_0->mPlaneType](auStack_80, particleX, particleY);
|
||||
local_60[0][0] = param_1->mBaseAxis.x;
|
||||
local_60[0][1] = local_6c.x;
|
||||
local_60[0][2] = local_78.x;
|
||||
local_60[0][3] = param_1->mPosition.x;
|
||||
local_60[1][0] = param_1->mBaseAxis.y;
|
||||
local_60[1][1] = local_6c.y;
|
||||
local_60[1][2] = local_78.y;
|
||||
local_60[1][3] = param_1->mPosition.y;
|
||||
local_60[2][0] = param_1->mBaseAxis.z;
|
||||
local_60[2][1] = local_6c.z;
|
||||
local_60[2][2] = local_78.z;
|
||||
local_60[2][3] = param_1->mPosition.z;
|
||||
MTXConcat(local_60, auStack_80, auStack_80);
|
||||
MTXConcat(param_0->mPosCamMtx, auStack_80, local_60);
|
||||
GXLoadPosMtxImm(local_60, 0);
|
||||
p_prj[param_0->mPrjType](param_0, local_60);
|
||||
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
||||
}
|
||||
}
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
JGeometry::TVec3<f32> local_6c;
|
||||
JGeometry::TVec3<f32> local_78;
|
||||
p_direction[param_0->mDirType](param_0, param_1, &local_6c);
|
||||
|
||||
if (local_6c.isZero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
local_6c.normalize();
|
||||
local_78.cross(param_1->mBaseAxis, local_6c);
|
||||
|
||||
if (local_78.isZero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
local_78.normalize();
|
||||
param_1->mBaseAxis.cross(local_6c, local_78);
|
||||
param_1->mBaseAxis.normalize();
|
||||
f32 particleX = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
Mtx auStack_80;
|
||||
Mtx local_60;
|
||||
p_rot[param_0->mRotType](sinRot, cosRot, auStack_80);
|
||||
p_plane[param_0->mPlaneType](auStack_80, particleX, particleY);
|
||||
local_60[0][0] = param_1->mBaseAxis.x;
|
||||
local_60[0][1] = local_6c.x;
|
||||
local_60[0][2] = local_78.x;
|
||||
local_60[0][3] = param_1->mPosition.x;
|
||||
local_60[1][0] = param_1->mBaseAxis.y;
|
||||
local_60[1][1] = local_6c.y;
|
||||
local_60[1][2] = local_78.y;
|
||||
local_60[1][3] = param_1->mPosition.y;
|
||||
local_60[2][0] = param_1->mBaseAxis.z;
|
||||
local_60[2][1] = local_6c.z;
|
||||
local_60[2][2] = local_78.z;
|
||||
local_60[2][3] = param_1->mPosition.z;
|
||||
MTXConcat(local_60, auStack_80, auStack_80);
|
||||
MTXConcat(param_0->mPosCamMtx, auStack_80, local_60);
|
||||
GXLoadPosMtxImm(local_60, 0);
|
||||
p_prj[param_0->mPrjType](param_0, local_60);
|
||||
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void JPADrawDBillboard(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
JGeometry::TVec3<f32> local_70;
|
||||
p_direction[param_0->mDirType](param_0, param_1, &local_70);
|
||||
JGeometry::TVec3<f32> aTStack_7c;
|
||||
aTStack_7c.set(param_0->mPosCamMtx[2][0], param_0->mPosCamMtx[2][1],
|
||||
param_0->mPosCamMtx[2][2]);
|
||||
local_70.cross(local_70, aTStack_7c);
|
||||
if (!local_70.isZero()) {
|
||||
local_70.normalize();
|
||||
MTXMultVecSR(param_0->mPosCamMtx, local_70, local_70);
|
||||
JGeometry::TVec3<f32> local_88;
|
||||
MTXMultVec(param_0->mPosCamMtx, param_1->mPosition, local_88);
|
||||
f32 particleX = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
Mtx local_60;
|
||||
local_60[0][0] = local_70.x * particleX;
|
||||
local_60[0][1] = -local_70.y * particleY;
|
||||
local_60[0][3] = local_88.x;
|
||||
local_60[1][0] = local_70.y * particleX;
|
||||
local_60[1][1] = local_70.x * particleY;
|
||||
local_60[1][3] = local_88.y;
|
||||
local_60[2][2] = 1.0f;
|
||||
local_60[2][3] = local_88.z;
|
||||
local_60[2][1] = 0.0f;
|
||||
local_60[2][0] = 0.0f;
|
||||
local_60[1][2] = 0.0f;
|
||||
local_60[0][2] = 0.0f;
|
||||
GXLoadPosMtxImm(local_60, 0);
|
||||
p_prj[param_0->mPrjType](param_0, local_60);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
}
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JGeometry::TVec3<f32> local_70;
|
||||
p_direction[param_0->mDirType](param_0, param_1, &local_70);
|
||||
JGeometry::TVec3<f32> aTStack_7c(param_0->mPosCamMtx[2][0], param_0->mPosCamMtx[2][1], param_0->mPosCamMtx[2][2]);
|
||||
local_70.cross(local_70, aTStack_7c);
|
||||
|
||||
if (local_70.isZero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
local_70.normalize();
|
||||
MTXMultVecSR(param_0->mPosCamMtx, &local_70, &local_70);
|
||||
JGeometry::TVec3<f32> local_88;
|
||||
MTXMultVec(param_0->mPosCamMtx, ¶m_1->mPosition, &local_88);
|
||||
f32 particleX = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
Mtx local_60;
|
||||
local_60[0][0] = local_70.x * particleX;
|
||||
local_60[0][1] = -local_70.y * particleY;
|
||||
local_60[0][3] = local_88.x;
|
||||
local_60[1][0] = local_70.y * particleX;
|
||||
local_60[1][1] = local_70.x * particleY;
|
||||
local_60[1][3] = local_88.y;
|
||||
local_60[2][2] = 1.0f;
|
||||
local_60[2][3] = local_88.z;
|
||||
local_60[0][2] = local_60[1][2] = local_60[2][0] = local_60[2][1] = 0.0f;
|
||||
GXLoadPosMtxImm(local_60, 0);
|
||||
p_prj[param_0->mPrjType](param_0, local_60);
|
||||
GXCallDisplayList(jpa_dl, sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void JPADrawRotation(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
f32 particleX = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
Mtx auStack_88;
|
||||
p_rot[param_0->mRotType](sinRot, cosRot, auStack_88);
|
||||
p_plane[param_0->mPlaneType](auStack_88, particleX, particleY);
|
||||
auStack_88[0][3] = param_1->mPosition.x;
|
||||
auStack_88[1][3] = param_1->mPosition.y;
|
||||
auStack_88[2][3] = param_1->mPosition.z;
|
||||
MTXConcat(param_0->mPosCamMtx, auStack_88, auStack_88);
|
||||
GXLoadPosMtxImm(auStack_88, 0);
|
||||
p_prj[param_0->mPrjType](param_0, auStack_88);
|
||||
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
f32 sinRot = JMASSin(param_1->mRotateAngle);
|
||||
f32 cosRot = JMASCos(param_1->mRotateAngle);
|
||||
f32 particleX = param_0->mGlobalPtclScl.x * param_1->mParticleScaleX;
|
||||
f32 particleY = param_0->mGlobalPtclScl.y * param_1->mParticleScaleY;
|
||||
Mtx auStack_88;
|
||||
p_rot[param_0->mRotType](sinRot, cosRot, auStack_88);
|
||||
p_plane[param_0->mPlaneType](auStack_88, particleX, particleY);
|
||||
auStack_88[0][3] = param_1->mPosition.x;
|
||||
auStack_88[1][3] = param_1->mPosition.y;
|
||||
auStack_88[2][3] = param_1->mPosition.z;
|
||||
MTXConcat(param_0->mPosCamMtx, auStack_88, auStack_88);
|
||||
GXLoadPosMtxImm(auStack_88, 0);
|
||||
p_prj[param_0->mPrjType](param_0, auStack_88);
|
||||
GXCallDisplayList(p_dl[param_0->mDLType], sizeof(jpa_dl));
|
||||
}
|
||||
|
||||
void JPADrawPoint(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
if (!!(ptcl->mStatus & JPAPtclStts_Invisible))
|
||||
if (ptcl->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
@@ -851,26 +846,30 @@ void JPADrawPoint(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
}
|
||||
|
||||
void JPADrawLine(JPAEmitterWorkData* param_0, JPABaseParticle* param_1) {
|
||||
if (param_1->checkStatus(8) == 0) {
|
||||
JGeometry::TVec3<f32> local_1c;
|
||||
JGeometry::setTVec3f(¶m_1->mPosition.x, &local_1c.x);
|
||||
JGeometry::TVec3<f32> local_28;
|
||||
param_1->getVelVec(local_28);
|
||||
if (!local_28.isZero()) {
|
||||
local_28.setLength(param_0->mGlobalPtclScl.y * (25.0f * param_1->mParticleScaleY));
|
||||
local_28.sub(local_1c, local_28);
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
GXBegin(GX_LINES, GX_VTXFMT1, 2);
|
||||
GXPosition3f32(local_1c.x, local_1c.y, local_1c.z);
|
||||
GXTexCoord2f32(0.0f, 0.0f);
|
||||
GXPosition3f32(local_28.x, local_28.y, local_28.z);
|
||||
GXTexCoord2f32(0.0f, 1.0f);
|
||||
GXEnd();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
||||
}
|
||||
if (param_1->checkStatus(JPAPtclStts_Invisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JGeometry::TVec3<f32> local_1c(param_1->mPosition);
|
||||
JGeometry::TVec3<f32> local_28;
|
||||
param_1->getVelVec(&local_28);
|
||||
|
||||
if (local_28.isZero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
local_28.setLength(param_0->mGlobalPtclScl.y * (25.0f * param_1->mParticleScaleY));
|
||||
local_28.sub(local_1c, local_28);
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
GXBegin(GX_LINES, GX_VTXFMT1, 2);
|
||||
GXPosition3f32(local_1c.x, local_1c.y, local_1c.z);
|
||||
GXTexCoord2f32(0.0f, 0.0f);
|
||||
GXPosition3f32(local_28.x, local_28.y, local_28.z);
|
||||
GXTexCoord2f32(0.0f, 1.0f);
|
||||
GXEnd();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
||||
}
|
||||
|
||||
JPANode<JPABaseParticle>* getNext(JPANode<JPABaseParticle>* param_0) {
|
||||
@@ -901,8 +900,8 @@ void JPADrawStripe(JPAEmitterWorkData* param_0) {
|
||||
JGeometry::TVec3<f32> local_e0[2];
|
||||
JGeometry::TVec3<f32> local_f8;
|
||||
JGeometry::TVec3<f32> local_104;
|
||||
getNodeFunc node_func;
|
||||
JPANode<JPABaseParticle>* startNode;
|
||||
JPANode<JPABaseParticle>* startNode = NULL;
|
||||
getNodeFunc node_func = NULL;
|
||||
if (shape->isDrawFwdAhead()) {
|
||||
startNode = param_0->mpAlivePtcl->getLast();
|
||||
node_func = getPrev;
|
||||
@@ -990,8 +989,8 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
|
||||
JGeometry::TVec3<f32> local_a8[2];
|
||||
JGeometry::TVec3<f32> local_c0;
|
||||
JGeometry::TVec3<f32> local_cc;
|
||||
JPANode<JPABaseParticle>* startNode;
|
||||
getNodeFunc node_func;
|
||||
JPANode<JPABaseParticle>* startNode = NULL;
|
||||
getNodeFunc node_func = NULL;
|
||||
if (shape->isDrawFwdAhead()) {
|
||||
startNode = param_0->mpAlivePtcl->getLast();
|
||||
node_func = getPrev;
|
||||
@@ -1109,22 +1108,27 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
|
||||
}
|
||||
|
||||
void JPADrawEmitterCallBackB(JPAEmitterWorkData* work) {
|
||||
if (work->mpEmtr->mpEmtrCallBack == NULL)
|
||||
JPABaseEmitter* emtr = work->mpEmtr;
|
||||
if (emtr->mpEmtrCallBack == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
work->mpEmtr->mpEmtrCallBack->draw(work->mpEmtr);
|
||||
emtr->mpEmtrCallBack->draw(emtr);
|
||||
}
|
||||
|
||||
void JPADrawParticleCallBack(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
if (work->mpEmtr->mpPtclCallBack == NULL)
|
||||
JPABaseEmitter* emtr = work->mpEmtr;
|
||||
if (emtr->mpPtclCallBack == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
work->mpEmtr->mpPtclCallBack->draw(work->mpEmtr, ptcl);
|
||||
emtr->mpPtclCallBack->draw(emtr, ptcl);
|
||||
}
|
||||
|
||||
static void makeColorTable(GXColor** o_color_table, JPAClrAnmKeyData const* i_data, u8 param_2,
|
||||
s16 i_size, JKRHeap* i_heap) {
|
||||
GXColor* color_table = (GXColor*)JKRAllocFromHeap(i_heap, (i_size + 1) * 4, 4);
|
||||
GXColor* p_clr_tbl = (GXColor*)JKRAllocFromHeap(i_heap, (i_size + 1) * 4, 4);
|
||||
JUT_ASSERT(1548, p_clr_tbl);
|
||||
f32 r_step, g_step, b_step, a_step;
|
||||
r_step = g_step = b_step = a_step = 0.0f;
|
||||
f32 r = i_data[0].color.r;
|
||||
@@ -1134,7 +1138,7 @@ static void makeColorTable(GXColor** o_color_table, JPAClrAnmKeyData const* i_da
|
||||
int j = 0;
|
||||
for (s16 i = 0; i < i_size + 1; i++) {
|
||||
if (i == i_data[j].index) {
|
||||
color_table[i] = i_data[j].color;
|
||||
p_clr_tbl[i] = i_data[j].color;
|
||||
r = i_data[j].color.r;
|
||||
g = i_data[j].color.g;
|
||||
b = i_data[j].color.b;
|
||||
@@ -1151,49 +1155,16 @@ static void makeColorTable(GXColor** o_color_table, JPAClrAnmKeyData const* i_da
|
||||
}
|
||||
} else {
|
||||
r += r_step;
|
||||
color_table[i].r = r;
|
||||
p_clr_tbl[i].r = r;
|
||||
g += g_step;
|
||||
color_table[i].g = g;
|
||||
p_clr_tbl[i].g = g;
|
||||
b += b_step;
|
||||
color_table[i].b = b;
|
||||
p_clr_tbl[i].b = b;
|
||||
a += a_step;
|
||||
color_table[i].a = a;
|
||||
p_clr_tbl[i].a = a;
|
||||
}
|
||||
}
|
||||
*o_color_table = color_table;
|
||||
}
|
||||
|
||||
JPABaseShape::JPABaseShape(u8 const* pData, JKRHeap* pHeap) {
|
||||
mpData = (const JPABaseShapeData*)pData;
|
||||
|
||||
if (isTexCrdAnm()) {
|
||||
mpTexCrdMtxAnmTbl = (const void*)(pData + sizeof(JPABaseShapeData));
|
||||
} else {
|
||||
mpTexCrdMtxAnmTbl = NULL;
|
||||
}
|
||||
|
||||
if (isTexAnm()) {
|
||||
u32 offs = sizeof(JPABaseShapeData);
|
||||
if (isTexCrdAnm())
|
||||
offs = sizeof(JPABaseShapeData) + 0x28;
|
||||
mpTexIdxAnimTbl = (const u8*)(pData + offs);
|
||||
} else {
|
||||
mpTexIdxAnimTbl = NULL;
|
||||
}
|
||||
|
||||
if (isPrmAnm()) {
|
||||
makeColorTable(&mpPrmClrAnmTbl, (JPAClrAnmKeyData*)(pData + mpData->mClrPrmAnmOffset),
|
||||
mpData->mClrPrmKeyNum, mpData->mClrAnmFrmMax, pHeap);
|
||||
} else {
|
||||
mpPrmClrAnmTbl = NULL;
|
||||
}
|
||||
|
||||
if (isEnvAnm()) {
|
||||
makeColorTable(&mpEnvClrAnmTbl, (JPAClrAnmKeyData*)(pData + mpData->mClrEnvAnmOffset),
|
||||
mpData->mClrEnvKeyNum, mpData->mClrAnmFrmMax, pHeap);
|
||||
} else {
|
||||
mpEnvClrAnmTbl = NULL;
|
||||
}
|
||||
*o_color_table = p_clr_tbl;
|
||||
}
|
||||
|
||||
GXBlendMode JPABaseShape::st_bm[3] = {
|
||||
@@ -1279,15 +1250,55 @@ GXTevAlphaArg JPABaseShape::st_aa[2][4] = {
|
||||
},
|
||||
};
|
||||
|
||||
JPABaseShape::JPABaseShape(u8 const* pData, JKRHeap* pHeap) {
|
||||
pBsd = (const JPABaseShapeData*)pData;
|
||||
|
||||
if (isTexCrdAnm()) {
|
||||
mpTexCrdMtxAnmTbl = (const void*)(pData + sizeof(JPABaseShapeData));
|
||||
} else {
|
||||
mpTexCrdMtxAnmTbl = NULL;
|
||||
}
|
||||
|
||||
if (isTexAnm()) {
|
||||
JUT_ASSERT(1698, pBsd->texAnmKeyNum != NULL);
|
||||
u32 offs = sizeof(JPABaseShapeData);
|
||||
if (isTexCrdAnm()) {
|
||||
offs += 0x28;
|
||||
}
|
||||
mpTexIdxAnimTbl = (const u8*)(pData + offs);
|
||||
} else {
|
||||
mpTexIdxAnimTbl = NULL;
|
||||
}
|
||||
|
||||
if (isPrmAnm()) {
|
||||
JUT_ASSERT(1707, pBsd->prmAnmKeyNum != NULL);
|
||||
JPAClrAnmKeyData* anmKeyData = (JPAClrAnmKeyData*)(pData + pBsd->mClrPrmAnmOffset);
|
||||
makeColorTable(&mpPrmClrAnmTbl, anmKeyData,
|
||||
pBsd->prmAnmKeyNum, pBsd->mClrAnmFrmMax, pHeap);
|
||||
} else {
|
||||
mpPrmClrAnmTbl = NULL;
|
||||
}
|
||||
|
||||
if (isEnvAnm()) {
|
||||
JUT_ASSERT(1716, pBsd->envAnmKeyNum != NULL);
|
||||
JPAClrAnmKeyData* anmKeyData = (JPAClrAnmKeyData*)(pData + pBsd->mClrEnvAnmOffset);
|
||||
makeColorTable(&mpEnvClrAnmTbl, anmKeyData,
|
||||
pBsd->envAnmKeyNum, pBsd->mClrAnmFrmMax, pHeap);
|
||||
} else {
|
||||
mpEnvClrAnmTbl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void JPABaseShape::setGX(JPAEmitterWorkData* work) const {
|
||||
const GXTevColorArg* colorArg = getTevColorArg();
|
||||
const GXTevAlphaArg* alphaArg = getTevAlphaArg();
|
||||
GXSetBlendMode(getBlendMode(), getBlendSrc(), getBlendDst(), getLogicOp());
|
||||
GXSetZMode(getZEnable(), getZCmp(), getZUpd());
|
||||
GXSetAlphaCompare(getAlphaCmp0(), getAlphaRef0(), getAlphaOp(), getAlphaCmp1(), getAlphaRef1());
|
||||
JPAExtraShape* extraShape = work->mpRes->getEsp();
|
||||
const GXTevColorArg* colorArg = st_ca[(pBsd->mFlags >> 0x0F) & 0x07];
|
||||
const GXTevAlphaArg* alphaArg = st_aa[(pBsd->mFlags >> 0x12) & 0x01];
|
||||
GXSetBlendMode(st_bm[pBsd->mBlendModeCfg & 0x03], st_bf[(pBsd->mBlendModeCfg >> 2) & 0x0F], st_bf[(pBsd->mBlendModeCfg >> 6) & 0x0F], st_lo[(pBsd->mBlendModeCfg >> 10) & 0x0F]);
|
||||
GXSetZMode(pBsd->mZModeCfg & 0x01, st_c[(pBsd->mZModeCfg >> 1) & 0x07], (pBsd->mZModeCfg >> 4) & 0x01);
|
||||
GXSetAlphaCompare(st_c[pBsd->mAlphaCompareCfg & 0x07], pBsd->mAlphaRef0, st_ao[(pBsd->mAlphaCompareCfg >> 3) & 0x03], st_c[(pBsd->mAlphaCompareCfg >> 5) & 0x07], pBsd->mAlphaRef1);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, colorArg[0], colorArg[1], colorArg[2], colorArg[3]);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, alphaArg[0], alphaArg[1], alphaArg[2], alphaArg[3]);
|
||||
GXSetTevDirect(GX_TEVSTAGE0);
|
||||
GXSetTevDirect(GX_TEVSTAGE1);
|
||||
GXSetZCompLoc(getZCompLoc());
|
||||
GXSetZCompLoc((pBsd->mZModeCfg >> 5) & 0x01);
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ void JPAVolumeCube(JPAEmitterWorkData* work) {
|
||||
}
|
||||
|
||||
static void JPAVolumeSphere(JPAEmitterWorkData* work) {
|
||||
s16 phi, theta;
|
||||
s16 phi, r28;
|
||||
if (work->mpEmtr->checkFlag(JPADynFlag_FixedInterval)) {
|
||||
phi = (u16)(work->mVolumeX * 0x8000 / (work->mDivNumber - 1) + 0x4000);
|
||||
f32 tmp = (u16)(work->mVolumeAngleNum * 0x10000 / (work->mVolumeAngleMax - 1));
|
||||
theta = tmp * work->mVolumeSweep + 0x8000;
|
||||
phi = u16(work->mVolumeX * 0x8000 / (work->mDivNumber - 1) + 0x4000);
|
||||
u16 r26 = u16(work->mVolumeAngleNum * 0x10000 / (work->mVolumeAngleMax - 1));
|
||||
r28 = f32(r26) * work->mVolumeSweep + 0x8000;
|
||||
work->mVolumeAngleNum++;
|
||||
if (work->mVolumeAngleNum == work->mVolumeAngleMax) {
|
||||
work->mVolumeAngleNum = 0;
|
||||
@@ -81,30 +81,30 @@ static void JPAVolumeSphere(JPAEmitterWorkData* work) {
|
||||
}
|
||||
} else {
|
||||
phi = work->mpEmtr->get_r_ss() >> 1;
|
||||
theta = work->mVolumeSweep * work->mpEmtr->get_r_ss();
|
||||
r28 = work->mVolumeSweep * work->mpEmtr->get_r_ss();
|
||||
}
|
||||
|
||||
f32 rnd = work->mpEmtr->get_r_f();
|
||||
f32 f31 = work->mpEmtr->get_r_f();
|
||||
if (work->mpEmtr->checkFlag(JPADynFlag_FixedDensity)) {
|
||||
rnd = 1.0f - rnd * rnd * rnd;
|
||||
f31 = 1.0f - f31 * f31 * f31;
|
||||
}
|
||||
f32 rad = work->mVolumeSize * (work->mVolumeMinRad + rnd * (1.0f - work->mVolumeMinRad));
|
||||
work->mVolumeCalcData.mVolumePos.set(rad * JMASCos(phi) * JMASSin(theta), -rad * JMASSin(phi),
|
||||
rad * JMASCos(phi) * JMASCos(theta));
|
||||
f31 = work->mVolumeSize * (work->mVolumeMinRad + f31 * (1.0f - work->mVolumeMinRad));
|
||||
work->mVolumeCalcData.mVolumePos.set(f31 * JMASCos(phi) * JMASSin(r28), -f31 * JMASSin(phi),
|
||||
f31 * JMASCos(phi) * JMASCos(r28));
|
||||
work->mVolumeCalcData.mVelOmni.mul(work->mVolumeCalcData.mVolumePos, work->mGlobalScl);
|
||||
work->mVolumeCalcData.mVelAxis.set(work->mVolumeCalcData.mVolumePos.x, 0.0f,
|
||||
work->mVolumeCalcData.mVolumePos.z);
|
||||
}
|
||||
|
||||
static void JPAVolumeCylinder(JPAEmitterWorkData* work) {
|
||||
s16 theta = work->mVolumeSweep * work->mpEmtr->get_r_ss();
|
||||
f32 rnd = work->mpEmtr->get_r_f();
|
||||
s16 r30 = work->mVolumeSweep * work->mpEmtr->get_r_ss();
|
||||
f32 f31 = work->mpEmtr->get_r_f();
|
||||
if (work->mpEmtr->checkFlag(JPADynFlag_FixedDensity)) {
|
||||
rnd = 1.0f - rnd * rnd;
|
||||
f31 = 1.0f - f31 * f31;
|
||||
}
|
||||
f32 rad = work->mVolumeSize * (work->mVolumeMinRad + rnd * (1.0f - work->mVolumeMinRad));
|
||||
f31 = work->mVolumeSize * (work->mVolumeMinRad + f31 * (1.0f - work->mVolumeMinRad));
|
||||
work->mVolumeCalcData.mVolumePos.set(
|
||||
rad * JMASSin(theta), work->mVolumeSize * work->mpEmtr->get_r_zp(), rad * JMASCos(theta));
|
||||
f31 * JMASSin(r30), work->mVolumeSize * work->mpEmtr->get_r_zp(), f31 * JMASCos(r30));
|
||||
work->mVolumeCalcData.mVelOmni.mul(work->mVolumeCalcData.mVolumePos, work->mGlobalScl);
|
||||
work->mVolumeCalcData.mVelAxis.set(work->mVolumeCalcData.mVolumePos.x, 0.0f,
|
||||
work->mVolumeCalcData.mVolumePos.z);
|
||||
@@ -166,26 +166,16 @@ void JPADynamicsBlock::init() {
|
||||
|
||||
void JPADynamicsBlock::create(JPAEmitterWorkData* work) {
|
||||
if (work->mpEmtr->checkStatus(JPAEmtrStts_RateStepEmit)) {
|
||||
s32 emitCount;
|
||||
s32 createCount;
|
||||
s32 emitCount = 0;
|
||||
|
||||
// Probably an inlined function.
|
||||
if (work->mpEmtr->checkFlag(JPADynFlag_FixedInterval)) {
|
||||
s32 count;
|
||||
if (getVolumeType() == VOL_Sphere) {
|
||||
count = 4 * getDivNumber() * getDivNumber() + 2;
|
||||
} else {
|
||||
count = getDivNumber();
|
||||
}
|
||||
emitCount = count;
|
||||
emitCount = getVolumeType() == VOL_Sphere ? 4 * getDivNumber() * getDivNumber() + 2 : getDivNumber();
|
||||
|
||||
work->mVolumeEmitIdx = 0;
|
||||
} else {
|
||||
f32 newPtclCount =
|
||||
work->mpEmtr->mRate * (getRateRndm() * work->mpEmtr->get_r_zp() + 1.0f);
|
||||
f32 newEmitCount = work->mpEmtr->mEmitCount + newPtclCount;
|
||||
work->mpEmtr->mEmitCount = newEmitCount;
|
||||
emitCount = (s32)newEmitCount;
|
||||
emitCount = work->mpEmtr->mEmitCount += newPtclCount;
|
||||
work->mpEmtr->mEmitCount -= emitCount;
|
||||
|
||||
if (work->mpEmtr->checkStatus(JPAEmtrStts_FirstEmit) && 0.0f < newPtclCount &&
|
||||
@@ -198,10 +188,10 @@ void JPADynamicsBlock::create(JPAEmitterWorkData* work) {
|
||||
emitCount = 0;
|
||||
}
|
||||
|
||||
// Probably an inlined function.
|
||||
createCount = emitCount;
|
||||
JPABaseParticle* ptcl = NULL;
|
||||
s32 createCount = emitCount;
|
||||
while (createCount > 0) {
|
||||
JPABaseParticle* ptcl = work->mpEmtr->createParticle();
|
||||
ptcl = work->mpEmtr->createParticle();
|
||||
if (ptcl == NULL)
|
||||
break;
|
||||
createCount--;
|
||||
@@ -209,7 +199,7 @@ void JPADynamicsBlock::create(JPAEmitterWorkData* work) {
|
||||
}
|
||||
|
||||
if (++work->mpEmtr->mRateStepTimer >= (work->mpEmtr->mRateStep + 1)) {
|
||||
work->mpEmtr->mRateStepTimer -= (work->mpEmtr->mRateStep + 1);
|
||||
work->mpEmtr->mRateStepTimer -= work->mpEmtr->mRateStep + 1;
|
||||
work->mpEmtr->setStatus(JPAEmtrStts_RateStepEmit);
|
||||
} else {
|
||||
work->mpEmtr->clearStatus(JPAEmtrStts_RateStepEmit);
|
||||
|
||||
@@ -12,38 +12,31 @@ JPAEmitterCallBack::~JPAEmitterCallBack() {
|
||||
|
||||
void JPABaseEmitter::init(JPAEmitterManager* param_0, JPAResource* param_1) {
|
||||
mpEmtrMgr = param_0;
|
||||
mpRes = param_1;
|
||||
mpRes->getDyn()->getEmitterScl(&mLocalScl);
|
||||
mpRes->getDyn()->getEmitterTrs(&mLocalTrs);
|
||||
mpRes->getDyn()->getEmitterDir(&mLocalDir);
|
||||
pRes = param_1;
|
||||
pRes->getDyn()->getEmitterScl(&mLocalScl);
|
||||
pRes->getDyn()->getEmitterTrs(&mLocalTrs);
|
||||
pRes->getDyn()->getEmitterDir(&mLocalDir);
|
||||
mLocalDir.normalize();
|
||||
mpRes->getDyn()->getEmitterRot(&mLocalRot);
|
||||
mMaxFrame = mpRes->getDyn()->getMaxFrame();
|
||||
mLifeTime = mpRes->getDyn()->getLifetime();
|
||||
mVolumeSize = mpRes->getDyn()->getVolumeSize();
|
||||
mRate = mpRes->getDyn()->getRate();
|
||||
mRateStep = mpRes->getDyn()->getRateStep();
|
||||
mVolumeSweep = mpRes->getDyn()->getVolumeSweep();
|
||||
mVolumeMinRad = mpRes->getDyn()->getVolumeMinRad();
|
||||
mAwayFromCenterSpeed = mpRes->getDyn()->getInitVelOmni();
|
||||
mAwayFromAxisSpeed = mpRes->getDyn()->getInitVelAxis();
|
||||
mDirSpeed = mpRes->getDyn()->getInitVelDir();
|
||||
mSpread = mpRes->getDyn()->getInitVelDirSp();
|
||||
mRndmDirSpeed = mpRes->getDyn()->getInitVelRndm();
|
||||
mAirResist = mpRes->getDyn()->getAirRes();
|
||||
pRes->getDyn()->getEmitterRot(&mLocalRot);
|
||||
mMaxFrame = pRes->getDyn()->getMaxFrame();
|
||||
mLifeTime = pRes->getDyn()->getLifetime();
|
||||
mVolumeSize = pRes->getDyn()->getVolumeSize();
|
||||
mRate = pRes->getDyn()->getRate();
|
||||
mRateStep = pRes->getDyn()->getRateStep();
|
||||
mVolumeSweep = pRes->getDyn()->getVolumeSweep();
|
||||
mVolumeMinRad = pRes->getDyn()->getVolumeMinRad();
|
||||
mAwayFromCenterSpeed = pRes->getDyn()->getInitVelOmni();
|
||||
mAwayFromAxisSpeed = pRes->getDyn()->getInitVelAxis();
|
||||
mDirSpeed = pRes->getDyn()->getInitVelDir();
|
||||
mSpread = pRes->getDyn()->getInitVelDirSp();
|
||||
mRndmDirSpeed = pRes->getDyn()->getInitVelRndm();
|
||||
mAirResist = pRes->getDyn()->getAirRes();
|
||||
mRndm.set_seed(mpEmtrMgr->pWd->mRndm.get_rndm_u());
|
||||
MTXIdentity(mGlobalRot);
|
||||
mGlobalScl.set(1.0f, 1.0f, 1.0f);
|
||||
mGlobalTrs.zero();
|
||||
mGlobalPScl.set(1.0f, 1.0f);
|
||||
mGlobalEnvClr.a = 0xff;
|
||||
mGlobalEnvClr.b = 0xff;
|
||||
mGlobalEnvClr.g = 0xff;
|
||||
mGlobalEnvClr.r = 0xff;
|
||||
mGlobalPrmClr.a = 0xff;
|
||||
mGlobalPrmClr.b = 0xff;
|
||||
mGlobalPrmClr.g = 0xff;
|
||||
mGlobalPrmClr.r = 0xff;
|
||||
mGlobalPrmClr.r = mGlobalPrmClr.g = mGlobalPrmClr.b = mGlobalPrmClr.a = mGlobalEnvClr.r = mGlobalEnvClr.g = mGlobalEnvClr.b = mGlobalEnvClr.a = 0xff;
|
||||
param_1->getBsp()->getPrmClr(&mPrmClr);
|
||||
param_1->getBsp()->getEnvClr(&mEnvClr);
|
||||
mpUserWork = NULL;
|
||||
@@ -61,9 +54,11 @@ JPABaseParticle* JPABaseEmitter::createParticle() {
|
||||
if (mpPtclPool->getNum() != 0) {
|
||||
JPANode<JPABaseParticle>* node = mpPtclPool->pop_front();
|
||||
mAlivePtclBase.push_front(node);
|
||||
mpRes->getDyn()->calc(mpEmtrMgr->pWd);
|
||||
node->mData.init_p(mpEmtrMgr->pWd);
|
||||
return &node->mData;
|
||||
pRes->getDyn()->calc(mpEmtrMgr->pWd);
|
||||
node->getObject()->init_p(mpEmtrMgr->pWd);
|
||||
return node->getObject();
|
||||
} else {
|
||||
JUT_WARN(128, "%s", "JPA : Can NOT create particle more\n");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -73,8 +68,10 @@ JPABaseParticle* JPABaseEmitter::createChild(JPABaseParticle* parent) {
|
||||
if (mpPtclPool->getNum() != 0) {
|
||||
JPANode<JPABaseParticle>* node = mpPtclPool->pop_front();
|
||||
mAlivePtclChld.push_front(node);
|
||||
node->mData.init_c(mpEmtrMgr->pWd, parent);
|
||||
return &node->mData;
|
||||
node->getObject()->init_c(mpEmtrMgr->pWd, parent);
|
||||
return node->getObject();
|
||||
} else {
|
||||
JUT_WARN(151, "%s", "JPA : Can NOT create child particle more\n")
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -88,14 +85,12 @@ void JPABaseEmitter::deleteAllParticle() {
|
||||
}
|
||||
|
||||
bool JPABaseEmitter::processTillStartFrame() {
|
||||
JPADynamicsBlock* dyn = mpRes->getDyn();
|
||||
s16 startFrame = dyn->getStartFrame();
|
||||
|
||||
if (mWaitTime >= startFrame)
|
||||
if (mWaitTime >= pRes->getDyn()->getStartFrame())
|
||||
return true;
|
||||
|
||||
if (!(mStatus & 2))
|
||||
if (!checkStatus(2)) {
|
||||
mWaitTime++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -111,7 +106,7 @@ bool JPABaseEmitter::processTermination() {
|
||||
if (mMaxFrame < 0) {
|
||||
setStatus(8);
|
||||
return getParticleNumber() == 0;
|
||||
}
|
||||
}
|
||||
if (mTick >= mMaxFrame) {
|
||||
setStatus(8);
|
||||
if (checkStatus(0x40)) {
|
||||
@@ -129,7 +124,7 @@ void JPABaseEmitter::calcEmitterGlobalPosition(JGeometry::TVec3<f32>* dst) const
|
||||
mtx[0][3] = mGlobalTrs.x;
|
||||
mtx[1][3] = mGlobalTrs.y;
|
||||
mtx[2][3] = mGlobalTrs.z;
|
||||
MTXMultVec(mtx, mLocalTrs, *dst);
|
||||
MTXMultVec(mtx, &mLocalTrs, dst);
|
||||
}
|
||||
|
||||
u32 JPABaseEmitter::getCurrentCreateNumber() const {
|
||||
@@ -140,7 +135,8 @@ u8 JPABaseEmitter::getDrawCount() const {
|
||||
return mpEmtrMgr->pWd->mDrawCount;
|
||||
}
|
||||
|
||||
bool JPABaseEmitter::loadTexture(u8 idx, GXTexMapID texMapID) {
|
||||
mpEmtrMgr->pWd->mpResMgr->load(mpRes->getTexIdx(idx), texMapID);
|
||||
bool JPABaseEmitter::loadTexture(u8 no, GXTexMapID texMapID) {
|
||||
JUT_ASSERT(286, pRes->texNum > no);
|
||||
mpEmtrMgr->pWd->mpResMgr->load(pRes->getTexIdx(no), texMapID);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void JPAEmitterManager::calc(u8 group_id) {
|
||||
|
||||
JPABaseEmitter* emtr = pLink->getObject();
|
||||
|
||||
if (emtr->mpRes->calc(pWd, emtr) && !emtr->checkStatus(0x200))
|
||||
if (emtr->pRes->calc(pWd, emtr) && !emtr->checkStatus(0x200))
|
||||
forceDeleteEmitter(emtr);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ void JPAEmitterManager::draw(JPADrawInfo const* drawInfo, u8 group_id) {
|
||||
JPABaseEmitter* emtr = pLink->getObject();
|
||||
if (!emtr->checkStatus(0x04)) {
|
||||
pWd->mpResMgr = pResMgrAry[emtr->mResMgrID];
|
||||
emtr->mpRes->draw(pWd, emtr);
|
||||
emtr->pRes->draw(pWd, emtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,18 +10,14 @@ void JPALoadExTex(JPAEmitterWorkData* work) {
|
||||
|
||||
GXTexCoordID secTexCoordID = GX_TEXCOORD1;
|
||||
if (ets->isUseIndirect()) {
|
||||
GXSetTexCoordGen2(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, GX_FALSE,
|
||||
GX_PTIDENTITY);
|
||||
u8 texIdx = ets->getIndTexIdx();
|
||||
work->mpResMgr->load(work->mpRes->getTexIdx(texIdx), GX_TEXMAP2);
|
||||
GXSetTexCoordGen(secTexCoordID, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
work->mpResMgr->load(work->mpRes->getTexIdx(ets->getIndTexIdx()), GX_TEXMAP2);
|
||||
secTexCoordID = GX_TEXCOORD2;
|
||||
}
|
||||
|
||||
if (ets->isUseSecTex()) {
|
||||
GXSetTexCoordGen2(secTexCoordID, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, GX_FALSE,
|
||||
GX_PTIDENTITY);
|
||||
u8 texIdx = ets->getSecTexIdx();
|
||||
work->mpResMgr->load(work->mpRes->getTexIdx(texIdx), GX_TEXMAP3);
|
||||
GXSetTexCoordGen(secTexCoordID, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
work->mpResMgr->load(work->mpRes->getTexIdx(ets->getSecTexIdx()), GX_TEXMAP3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ void JPACalcScaleY(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
}
|
||||
|
||||
void JPACalcScaleCopy(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
JPAExtraShape* esp = work->mpRes->getEsp();
|
||||
ptcl->mParticleScaleY = ptcl->mParticleScaleX;
|
||||
}
|
||||
|
||||
@@ -55,21 +54,21 @@ void JPACalcScaleAnmRepeatY(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
|
||||
void JPACalcScaleAnmReverseX(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
JPAExtraShape* esp = work->mpRes->getEsp();
|
||||
s32 cycle = ptcl->mAge / esp->getScaleAnmCycleX();
|
||||
f32 cycle = ptcl->mAge / esp->getScaleAnmCycleX() & 1;
|
||||
f32 base = (ptcl->mAge % esp->getScaleAnmCycleX()) / (f32)esp->getScaleAnmCycleX();
|
||||
work->mScaleAnm = base + ((cycle & 1) * (1.0f - base * 2.0f));
|
||||
work->mScaleAnm = base + cycle * (1.0f - base * 2.0f);
|
||||
}
|
||||
|
||||
void JPACalcScaleAnmReverseY(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
JPAExtraShape* esp = work->mpRes->getEsp();
|
||||
s32 cycle = ptcl->mAge / esp->getScaleAnmCycleY();
|
||||
f32 cycle = ptcl->mAge / esp->getScaleAnmCycleY() & 1;
|
||||
f32 base = (ptcl->mAge % esp->getScaleAnmCycleY()) / (f32)esp->getScaleAnmCycleY();
|
||||
work->mScaleAnm = base + ((cycle & 1) * (1.0f - base * 2.0f));
|
||||
work->mScaleAnm = base + cycle * (1.0f - base * 2.0f);
|
||||
}
|
||||
|
||||
void JPACalcAlphaAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
JPAExtraShape* esp = work->mpRes->getEsp();
|
||||
f32 alpha;
|
||||
f32 alpha = 0.0f;
|
||||
if (ptcl->mTime < esp->getAlphaInTiming()) {
|
||||
alpha = 255.0f * (esp->getAlphaInValue() + esp->getAlphaIncRate() * ptcl->mTime);
|
||||
} else if (ptcl->mTime > esp->getAlphaOutTiming()) {
|
||||
@@ -83,7 +82,7 @@ void JPACalcAlphaAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
|
||||
void JPACalcAlphaFlickAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
JPAExtraShape* esp = work->mpRes->getEsp();
|
||||
f32 alpha;
|
||||
f32 alpha = 0.0f;
|
||||
if (ptcl->mTime < esp->getAlphaInTiming()) {
|
||||
alpha = (esp->getAlphaInValue() + esp->getAlphaIncRate() * ptcl->mTime);
|
||||
} else if (ptcl->mTime > esp->getAlphaOutTiming()) {
|
||||
@@ -92,8 +91,7 @@ void JPACalcAlphaFlickAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
} else {
|
||||
alpha = esp->getAlphaBaseValue();
|
||||
}
|
||||
s32 theta = ptcl->mAlphaWaveRandom * ptcl->mAge * 16384.0f * (1.0f - esp->getAlphaFreq());
|
||||
f32 wave = JMASSin(theta);
|
||||
f32 wave = JMASSin(ptcl->mAlphaWaveRandom * ptcl->mAge * 16384.0f * (1.0f - esp->getAlphaFreq()));
|
||||
alpha *= (1.0f + esp->getAlphaAmp() * (wave - 1.0f) * 0.5f) * 255.0f;
|
||||
OSf32tou8(&alpha, &ptcl->mPrmColorAlphaAnm);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void JPAFieldAir::prepare(JPAEmitterWorkData* work, JPAFieldBlock* block) {
|
||||
if (block->checkStatus(2)) {
|
||||
mAccel.scale(block->getMag(), vec);
|
||||
} else {
|
||||
MTXMultVecSR(work->mRotationMtx, vec, mAccel);
|
||||
MTXMultVecSR(work->mRotationMtx, &vec, &mAccel);
|
||||
mAccel.scale(block->getMag());
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ void JPAFieldConvection::prepare(JPAEmitterWorkData* work, JPAFieldBlock* block)
|
||||
vec2.cross(block->getPos(), block->getDir());
|
||||
vec1.cross(block->getDir(), vec2);
|
||||
MTXMultVecSR(work->mGlobalRot, &vec1, &field_0x10);
|
||||
MTXMultVecSR(work->mGlobalRot, &block->getDir(), field_0x1c);
|
||||
MTXMultVecSR(work->mGlobalRot, &block->getDir(), &field_0x1c);
|
||||
MTXMultVecSR(work->mGlobalRot, &vec2, &field_0x28);
|
||||
field_0x10.normalize();
|
||||
field_0x1c.normalize();
|
||||
@@ -224,34 +224,36 @@ void JPAFieldBlock::init(JKRHeap* heap) {
|
||||
|
||||
switch (getType()) {
|
||||
case FIELD_GRAVITY:
|
||||
mpField = new (heap, 0) JPAFieldGravity();
|
||||
pFld = new (heap, 0) JPAFieldGravity();
|
||||
break;
|
||||
case FIELD_AIR:
|
||||
mpField = new (heap, 0) JPAFieldAir();
|
||||
pFld = new (heap, 0) JPAFieldAir();
|
||||
break;
|
||||
case FIELD_MAGNET:
|
||||
mpField = new (heap, 0) JPAFieldMagnet();
|
||||
pFld = new (heap, 0) JPAFieldMagnet();
|
||||
break;
|
||||
case FIELD_NEWTON:
|
||||
mpField = new (heap, 0) JPAFieldNewton();
|
||||
pFld = new (heap, 0) JPAFieldNewton();
|
||||
break;
|
||||
case FIELD_VORTEX:
|
||||
mpField = new (heap, 0) JPAFieldVortex();
|
||||
pFld = new (heap, 0) JPAFieldVortex();
|
||||
break;
|
||||
case FIELD_RANDOM:
|
||||
mpField = new (heap, 0) JPAFieldRandom();
|
||||
pFld = new (heap, 0) JPAFieldRandom();
|
||||
break;
|
||||
case FIELD_DRAG:
|
||||
mpField = new (heap, 0) JPAFieldDrag();
|
||||
pFld = new (heap, 0) JPAFieldDrag();
|
||||
break;
|
||||
case FIELD_CONVECTION:
|
||||
mpField = new (heap, 0) JPAFieldConvection();
|
||||
pFld = new (heap, 0) JPAFieldConvection();
|
||||
break;
|
||||
case FIELD_SPIN:
|
||||
mpField = new (heap, 0) JPAFieldSpin();
|
||||
pFld = new (heap, 0) JPAFieldSpin();
|
||||
break;
|
||||
default:
|
||||
mpField = NULL;
|
||||
pFld = NULL;
|
||||
JUT_WARN(483, "JPA : WRONG ID (%d) in field data\n", getType());
|
||||
break;
|
||||
}
|
||||
JUT_ASSERT(485, pFld != 0);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ JPAKeyBlock::JPAKeyBlock(const u8* data)
|
||||
}
|
||||
|
||||
f32 JPAKeyBlock::calc(float p1) {
|
||||
if (mDataStart[0xB] != '\0') {
|
||||
int v1 = (int)field_0x4[(mDataStart[9] - 1) * 4] + 1;
|
||||
if (isLoop()) {
|
||||
int v1 = (int)getKeyData()[(getKeyNum() - 1) * 4] + 1;
|
||||
// p1 -= (v1 * ((int)p1 / v1));
|
||||
int v2 = ((int)p1 / v1);
|
||||
p1 = p1 - (v2 * v1);
|
||||
}
|
||||
return JPACalcKeyAnmValue(p1, mDataStart[9], field_0x4);
|
||||
return JPACalcKeyAnmValue(p1, getKeyNum(), getKeyData());
|
||||
}
|
||||
|
||||
@@ -50,10 +50,7 @@ void JPAGetYZRotateMtx(s16 angleY, s16 angleZ, f32 (*param_2)[4]) {
|
||||
param_2[1][2] = (siny * sinz);
|
||||
param_2[2][0] = -siny;
|
||||
param_2[2][2] = cosy;
|
||||
param_2[2][3] = 0.0f;
|
||||
param_2[2][1] = 0.0f;
|
||||
param_2[1][3] = 0.0f;
|
||||
param_2[0][3] = 0.0f;
|
||||
param_2[0][3] = param_2[1][3] = param_2[2][1] = param_2[2][3] = 0.0f;
|
||||
}
|
||||
|
||||
void JPAGetXYZRotateMtx(s16 x, s16 y, s16 z, Mtx mtx) {
|
||||
@@ -68,17 +65,15 @@ void JPAGetXYZRotateMtx(s16 x, s16 y, s16 z, Mtx mtx) {
|
||||
mtx[2][0] = -siny;
|
||||
mtx[2][1] = sinx * cosy;
|
||||
mtx[2][2] = cosx * cosy;
|
||||
f32 cosxsinz = cosx * sinz;
|
||||
f32 sinxcosz = sinx * cosz;
|
||||
mtx[0][1] = sinxcosz * siny - cosxsinz;
|
||||
mtx[1][2] = cosxsinz * siny - sinxcosz;
|
||||
f32 sinxsinz = sinx * sinz;
|
||||
f32 cosxcosz = cosx * cosz;
|
||||
mtx[0][2] = sinxsinz + cosxcosz * siny;
|
||||
mtx[1][1] = cosxcosz + sinxsinz * siny;
|
||||
mtx[2][3] = 0.0f;
|
||||
mtx[1][3] = 0.0f;
|
||||
mtx[0][3] = 0.0f;
|
||||
f32 f30 = cosx * sinz;
|
||||
f32 f29 = sinx * cosz;
|
||||
mtx[0][1] = f29 * siny - f30;
|
||||
mtx[1][2] = f30 * siny - f29;
|
||||
f30 = sinx * sinz;
|
||||
f29 = cosx * cosz;
|
||||
mtx[0][2] = f30 + f29 * siny;
|
||||
mtx[1][1] = f29 + f30 * siny;
|
||||
mtx[0][3] = mtx[1][3] = mtx[2][3] = 0.0f;
|
||||
}
|
||||
|
||||
void JPASetRMtxTVecfromMtx(f32 const (*param_0)[4], f32 (*param_1)[4],
|
||||
@@ -89,8 +84,7 @@ void JPASetRMtxTVecfromMtx(f32 const (*param_0)[4], f32 (*param_1)[4],
|
||||
|
||||
void JPASetRMtxSTVecfromMtx(f32 const (*param_0)[4], f32 (*param_1)[4],
|
||||
JGeometry::TVec3<f32>* param_2, JGeometry::TVec3<f32>* param_3) {
|
||||
JGeometry::TVec3<float> aTStack_54;
|
||||
aTStack_54.set(param_0[0][0], param_0[1][0], param_0[2][0]);
|
||||
JGeometry::TVec3<float> aTStack_54(param_0[0][0], param_0[1][0], param_0[2][0]);
|
||||
param_2->x = aTStack_54.length();
|
||||
aTStack_54.set(param_0[0][1], param_0[1][1], param_0[2][1]);
|
||||
param_2->y = aTStack_54.length();
|
||||
|
||||
@@ -15,32 +15,17 @@
|
||||
#include "global.h"
|
||||
|
||||
JPAResource::JPAResource() {
|
||||
mpDrawEmitterChildFuncList = NULL;
|
||||
mpDrawEmitterFuncList = NULL;
|
||||
mpCalcEmitterFuncList = NULL;
|
||||
mpDrawParticleChildFuncList = NULL;
|
||||
mpCalcParticleChildFuncList = NULL;
|
||||
mpDrawParticleFuncList = NULL;
|
||||
mpCalcParticleFuncList = NULL;
|
||||
mpBaseShape = NULL;
|
||||
mpExtraShape = NULL;
|
||||
mpChildShape = NULL;
|
||||
mpExTexShape = NULL;
|
||||
mpDynamicsBlock = NULL;
|
||||
mpFieldBlocks = NULL;
|
||||
mpKeyBlocks = NULL;
|
||||
mpCalcEmitterFuncList = mpDrawEmitterFuncList = mpDrawEmitterChildFuncList = NULL;
|
||||
mpCalcParticleFuncList = mpDrawParticleFuncList = mpCalcParticleChildFuncList = mpDrawParticleChildFuncList = NULL;
|
||||
pBsp = NULL;
|
||||
pEsp = NULL;
|
||||
pCsp = NULL;
|
||||
pEts = NULL;
|
||||
pDyn = NULL;
|
||||
ppFld = NULL;
|
||||
ppKey = NULL;
|
||||
mpTDB1 = NULL;
|
||||
mpDrawParticleChildFuncListNum = 0;
|
||||
mpCalcParticleChildFuncListNum = 0;
|
||||
mpDrawParticleFuncListNum = 0;
|
||||
mpCalcParticleFuncListNum = 0;
|
||||
mpDrawEmitterChildFuncListNum = 0;
|
||||
mpDrawEmitterFuncListNum = 0;
|
||||
mpCalcEmitterFuncListNum = 0;
|
||||
mTDB1Num = 0;
|
||||
mKeyBlockNum = 0;
|
||||
mFieldBlockNum = 0;
|
||||
mUsrIdx = 0;
|
||||
mUsrIdx = fldNum = keyNum = texNum = mpCalcEmitterFuncListNum = mpDrawEmitterFuncListNum = mpDrawEmitterChildFuncListNum = mpCalcParticleFuncListNum = mpDrawParticleFuncListNum = mpCalcParticleChildFuncListNum = mpDrawParticleChildFuncListNum = 0;
|
||||
}
|
||||
|
||||
static u8 jpa_pos[324] ATTRIBUTE_ALIGN(32) = {
|
||||
@@ -73,30 +58,31 @@ static u8 jpa_crd[32] ATTRIBUTE_ALIGN(32) = {
|
||||
};
|
||||
|
||||
void JPAResource::init(JKRHeap* heap) {
|
||||
BOOL is_glbl_clr_anm = mpBaseShape->isGlblClrAnm();
|
||||
BOOL is_glbl_tex_anm = mpBaseShape->isGlblTexAnm();
|
||||
BOOL is_prm_anm = mpBaseShape->isPrmAnm();
|
||||
BOOL is_env_anm = mpBaseShape->isEnvAnm();
|
||||
BOOL is_tex_anm = mpBaseShape->isTexAnm();
|
||||
BOOL is_tex_crd_anm = mpBaseShape->isTexCrdAnm();
|
||||
BOOL is_prj_tex = mpBaseShape->isPrjTex();
|
||||
BOOL is_enable_scale_anm = mpExtraShape != NULL && mpExtraShape->isEnableScaleAnm();
|
||||
BOOL is_enable_alpha_anm = mpExtraShape != NULL && mpExtraShape->isEnableAlphaAnm();
|
||||
BOOL is_enable_alpha_flick = mpExtraShape != NULL && mpExtraShape->isEnableAlphaAnm()
|
||||
&& mpExtraShape->isEnableAlphaFlick();
|
||||
BOOL is_enable_rotate_anm = mpExtraShape != NULL && mpExtraShape->isEnableRotateAnm();
|
||||
BOOL is_glbl_clr_anm = pBsp->isGlblClrAnm();
|
||||
BOOL is_glbl_tex_anm = pBsp->isGlblTexAnm();
|
||||
BOOL is_prm_anm = pBsp->isPrmAnm();
|
||||
BOOL is_env_anm = pBsp->isEnvAnm();
|
||||
BOOL is_tex_anm = pBsp->isTexAnm();
|
||||
BOOL is_tex_crd_anm = pBsp->isTexCrdAnm();
|
||||
BOOL is_prj_tex = pBsp->isPrjTex();
|
||||
BOOL is_enable_scale_anm = pEsp != NULL && pEsp->isEnableScaleAnm();
|
||||
BOOL is_enable_alpha_anm = pEsp != NULL && pEsp->isEnableAlphaAnm();
|
||||
BOOL is_enable_alpha_flick = pEsp != NULL && pEsp->isEnableAlphaAnm()
|
||||
&& pEsp->isEnableAlphaFlick();
|
||||
BOOL is_enable_rotate_anm = pEsp != NULL && pEsp->isEnableRotateAnm();
|
||||
BOOL is_rotate_on = is_enable_rotate_anm
|
||||
|| (mpChildShape != NULL && mpChildShape->isRotateOn());
|
||||
BOOL base_type_5_6 = mpBaseShape->getType() == 5 || mpBaseShape->getType() == 6;
|
||||
BOOL base_type_0 = mpBaseShape->getType() == 0;
|
||||
BOOL base_type_0_1 = mpBaseShape->getType() == 0 || mpBaseShape->getType() == 1;
|
||||
BOOL child_type_5_6 = mpChildShape != NULL
|
||||
&& (mpChildShape->getType() == 5 || mpChildShape->getType() == 6);
|
||||
BOOL child_type_0 = mpChildShape != NULL && mpChildShape->getType() == 0;
|
||||
BOOL child_type_0_1 = mpChildShape != NULL
|
||||
&& (mpChildShape->getType() == 0 || mpChildShape->getType() == 1);
|
||||
BOOL is_draw_parent = !mpBaseShape->isNoDrawParent();
|
||||
BOOL is_draw_child = !mpBaseShape->isNoDrawChild();
|
||||
|| (pCsp != NULL && pCsp->isRotateOn());
|
||||
BOOL base_type_5_6 = pBsp->getType() == 5 || pBsp->getType() == 6;
|
||||
BOOL base_type_0 = pBsp->getType() == 0;
|
||||
BOOL base_type_0_1 = pBsp->getType() == 0 || pBsp->getType() == 1;
|
||||
BOOL child_type_5_6 = pCsp != NULL
|
||||
&& (pCsp->getType() == 5 || pCsp->getType() == 6);
|
||||
BOOL child_type_0 = pCsp != NULL && pCsp->getType() == 0;
|
||||
BOOL child_type_0_1 = pCsp != NULL
|
||||
&& (pCsp->getType() == 0 || pCsp->getType() == 1);
|
||||
BOOL is_draw_parent = !pBsp->isNoDrawParent();
|
||||
BOOL is_draw_child = !pBsp->isNoDrawChild();
|
||||
int func_no = 0;
|
||||
|
||||
if (is_glbl_tex_anm && is_tex_anm) {
|
||||
mpCalcEmitterFuncListNum++;
|
||||
@@ -119,10 +105,10 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
(EmitterFunc*)JKRAllocFromHeap(heap, mpCalcEmitterFuncListNum * 4, 4);
|
||||
}
|
||||
|
||||
int func_no = 0;
|
||||
func_no = 0;
|
||||
|
||||
if (is_glbl_tex_anm && is_tex_anm) {
|
||||
switch (mpBaseShape->getTexAnmType()) {
|
||||
switch (pBsp->getTexAnmType()) {
|
||||
case 0:
|
||||
mpCalcEmitterFuncList[func_no] = &JPACalcTexIdxNormal;
|
||||
break;
|
||||
@@ -152,7 +138,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
func_no++;
|
||||
}
|
||||
if (is_prm_anm || is_env_anm) {
|
||||
switch (mpBaseShape->getClrAnmType()) {
|
||||
switch (pBsp->getClrAnmType()) {
|
||||
case 0:
|
||||
mpCalcEmitterFuncList[func_no] = &JPACalcClrIdxNormal;
|
||||
break;
|
||||
@@ -169,6 +155,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
mpCalcEmitterFuncList[func_no] = &JPACalcClrIdxRandom;
|
||||
break;
|
||||
}
|
||||
func_no++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,9 +182,9 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
}
|
||||
|
||||
if (is_enable_scale_anm) {
|
||||
if (mpBaseShape->getType() != 0) {
|
||||
if (mpExtraShape->isScaleXYDiff()) {
|
||||
if (mpExtraShape->getScaleAnmTypeX() == 0 && mpExtraShape->getScaleAnmTypeY() == 0) {
|
||||
if (pBsp->getType() != 0) {
|
||||
if (pEsp->isScaleXYDiff()) {
|
||||
if (pEsp->getScaleAnmTypeX() == 0 && pEsp->getScaleAnmTypeY() == 0) {
|
||||
mpCalcParticleFuncListNum++;
|
||||
} else {
|
||||
mpCalcParticleFuncListNum++;
|
||||
@@ -219,7 +206,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
func_no = 0;
|
||||
|
||||
if (!is_glbl_tex_anm && is_tex_anm) {
|
||||
switch (mpBaseShape->getTexAnmType()) {
|
||||
switch (pBsp->getTexAnmType()) {
|
||||
case 0:
|
||||
mpCalcParticleFuncList[func_no] = &JPACalcTexIdxNormal;
|
||||
break;
|
||||
@@ -259,7 +246,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
func_no++;
|
||||
}
|
||||
if (is_prm_anm || is_env_anm) {
|
||||
switch (mpBaseShape->getClrAnmType()) {
|
||||
switch (pBsp->getClrAnmType()) {
|
||||
case 0:
|
||||
mpCalcParticleFuncList[func_no] = &JPACalcClrIdxNormal;
|
||||
break;
|
||||
@@ -284,12 +271,12 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
}
|
||||
|
||||
if (is_enable_scale_anm) {
|
||||
if (mpBaseShape->getType() != 0) {
|
||||
if (mpExtraShape->isScaleXYDiff()) {
|
||||
if (pBsp->getType() != 0) {
|
||||
if (pEsp->isScaleXYDiff()) {
|
||||
mpCalcParticleFuncList[func_no] = &JPACalcScaleY;
|
||||
func_no++;
|
||||
if (mpExtraShape->getScaleAnmTypeY() != 0 || mpExtraShape->getScaleAnmTypeX() != 0) {
|
||||
switch (mpExtraShape->getScaleAnmTypeY()) {
|
||||
if (pEsp->getScaleAnmTypeY() != 0 || pEsp->getScaleAnmTypeX() != 0) {
|
||||
switch (pEsp->getScaleAnmTypeY()) {
|
||||
case 0:
|
||||
mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmNormal;
|
||||
break;
|
||||
@@ -309,7 +296,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
}
|
||||
mpCalcParticleFuncList[func_no] = &JPACalcScaleX;
|
||||
func_no++;
|
||||
switch (mpExtraShape->getScaleAnmTypeX()) {
|
||||
switch (pEsp->getScaleAnmTypeX()) {
|
||||
case 0:
|
||||
mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmNormal;
|
||||
break;
|
||||
@@ -320,13 +307,14 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
mpCalcParticleFuncList[func_no] = &JPACalcScaleAnmReverseX;
|
||||
break;
|
||||
}
|
||||
func_no++;
|
||||
}
|
||||
|
||||
if (mpChildShape != NULL && mpChildShape->isScaleOutOn()) {
|
||||
if (pCsp != NULL && pCsp->isScaleOutOn()) {
|
||||
mpCalcParticleChildFuncListNum++;
|
||||
}
|
||||
|
||||
if (mpChildShape != NULL && mpChildShape->isAlphaOutOn()) {
|
||||
if (pCsp != NULL && pCsp->isAlphaOutOn()) {
|
||||
mpCalcParticleChildFuncListNum++;
|
||||
}
|
||||
|
||||
@@ -337,13 +325,14 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
|
||||
func_no = 0;
|
||||
|
||||
if (mpChildShape != NULL && mpChildShape->isScaleOutOn()) {
|
||||
if (pCsp != NULL && pCsp->isScaleOutOn()) {
|
||||
mpCalcParticleChildFuncList[func_no] = &JPACalcChildScaleOut;
|
||||
func_no++;
|
||||
}
|
||||
|
||||
if (mpChildShape != NULL && mpChildShape->isAlphaOutOn()) {
|
||||
if (pCsp != NULL && pCsp->isAlphaOutOn()) {
|
||||
mpCalcParticleChildFuncList[func_no] = &JPACalcChildAlphaOut;
|
||||
func_no++;
|
||||
}
|
||||
|
||||
if (is_draw_parent && base_type_5_6) {
|
||||
@@ -352,7 +341,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
|
||||
mpDrawEmitterFuncListNum++;
|
||||
|
||||
if (mpExTexShape != NULL) {
|
||||
if (pEts != NULL) {
|
||||
mpDrawEmitterFuncListNum++;
|
||||
}
|
||||
|
||||
@@ -382,7 +371,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
func_no = 0;
|
||||
|
||||
if (is_draw_parent && base_type_5_6) {
|
||||
if (mpBaseShape->getType() == 5) {
|
||||
if (pBsp->getType() == 5) {
|
||||
mpDrawEmitterFuncList[func_no] = &JPADrawStripe;
|
||||
func_no++;
|
||||
} else {
|
||||
@@ -394,7 +383,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
mpDrawEmitterFuncList[func_no] = &JPADrawEmitterCallBackB;
|
||||
func_no++;
|
||||
|
||||
if (mpExTexShape != NULL) {
|
||||
if (pEts != NULL) {
|
||||
mpDrawEmitterFuncList[func_no] = &JPALoadExTex;
|
||||
func_no++;
|
||||
}
|
||||
@@ -444,17 +433,22 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
if (is_glbl_clr_anm) {
|
||||
if (base_type_5_6 || !is_enable_alpha_anm) {
|
||||
mpDrawEmitterFuncList[func_no] = &JPARegistPrmEnv;
|
||||
func_no++;
|
||||
} else if (is_enable_alpha_anm) {
|
||||
mpDrawEmitterFuncList[func_no] = &JPARegistEnv;
|
||||
func_no++;
|
||||
}
|
||||
} else if (!is_prm_anm && !is_enable_alpha_anm) {
|
||||
if (!is_env_anm) {
|
||||
mpDrawEmitterFuncList[func_no] = &JPARegistPrmEnv;
|
||||
func_no++;
|
||||
} else {
|
||||
mpDrawEmitterFuncList[func_no] = &JPARegistPrm;
|
||||
func_no++;
|
||||
}
|
||||
} else if (!is_env_anm) {
|
||||
mpDrawEmitterFuncList[func_no] = &JPARegistEnv;
|
||||
func_no++;
|
||||
}
|
||||
|
||||
if (is_draw_child && child_type_5_6) {
|
||||
@@ -467,8 +461,8 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
mpDrawEmitterChildFuncListNum++;
|
||||
}
|
||||
|
||||
if (mpChildShape != NULL && !mpChildShape->isAlphaOutOn() && !mpChildShape->isAlphaInherited()
|
||||
&& !mpChildShape->isColorInherited()) {
|
||||
if (pCsp != NULL && !pCsp->isAlphaOutOn() && !pCsp->isAlphaInherited()
|
||||
&& !pCsp->isColorInherited()) {
|
||||
mpDrawEmitterChildFuncListNum++;
|
||||
}
|
||||
|
||||
@@ -480,7 +474,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
func_no = 0;
|
||||
|
||||
if (is_draw_child && child_type_5_6) {
|
||||
if (mpChildShape->getType() == 5) {
|
||||
if (pCsp->getType() == 5) {
|
||||
mpDrawEmitterChildFuncList[func_no] = &JPADrawStripe;
|
||||
func_no++;
|
||||
} else {
|
||||
@@ -497,9 +491,10 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
func_no++;
|
||||
}
|
||||
|
||||
if (mpChildShape != NULL && !mpChildShape->isAlphaOutOn() && !mpChildShape->isAlphaInherited()
|
||||
&& !mpChildShape->isColorInherited()) {
|
||||
if (pCsp != NULL && !pCsp->isAlphaOutOn() && !pCsp->isAlphaInherited()
|
||||
&& !pCsp->isColorInherited()) {
|
||||
mpDrawEmitterChildFuncList[func_no] = &JPARegistChildPrmEnv;
|
||||
func_no++;
|
||||
}
|
||||
|
||||
if (is_draw_parent && !base_type_5_6) {
|
||||
@@ -529,7 +524,7 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
func_no = 0;
|
||||
|
||||
if (is_draw_parent && !base_type_5_6) {
|
||||
switch (mpBaseShape->getType()) {
|
||||
switch (pBsp->getType()) {
|
||||
case 2:
|
||||
if (is_enable_rotate_anm) {
|
||||
mpDrawParticleFuncList[func_no] = &JPADrawRotBillboard;
|
||||
@@ -594,23 +589,29 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
if (is_prm_anm) {
|
||||
if (is_env_anm) {
|
||||
mpDrawParticleFuncList[func_no] = &JPARegistPrmAlphaEnv;
|
||||
func_no++;
|
||||
} else {
|
||||
mpDrawParticleFuncList[func_no] = &JPARegistPrmAlpha;
|
||||
func_no++;
|
||||
}
|
||||
} else if (is_enable_alpha_anm) {
|
||||
if (is_env_anm) {
|
||||
mpDrawParticleFuncList[func_no] = &JPARegistAlphaEnv;
|
||||
func_no++;
|
||||
} else {
|
||||
mpDrawParticleFuncList[func_no] = &JPARegistAlpha;
|
||||
func_no++;
|
||||
}
|
||||
} else if (is_env_anm) {
|
||||
mpDrawParticleFuncList[func_no] = &JPARegistEnv;
|
||||
func_no++;
|
||||
}
|
||||
} else if (is_enable_alpha_anm && !base_type_5_6) {
|
||||
mpDrawParticleFuncList[func_no] = &JPARegistAlpha;
|
||||
func_no++;
|
||||
}
|
||||
|
||||
if (is_draw_child && mpChildShape != NULL && !child_type_5_6) {
|
||||
if (is_draw_child && pCsp != NULL && !child_type_5_6) {
|
||||
mpDrawParticleChildFuncListNum++;
|
||||
}
|
||||
|
||||
@@ -620,8 +621,8 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
mpDrawParticleChildFuncListNum++;
|
||||
}
|
||||
|
||||
if (mpChildShape != NULL && (mpChildShape->isAlphaOutOn() || mpChildShape->isAlphaInherited()
|
||||
|| mpChildShape->isColorInherited())) {
|
||||
if (pCsp != NULL && (pCsp->isAlphaOutOn() || pCsp->isAlphaInherited()
|
||||
|| pCsp->isColorInherited())) {
|
||||
mpDrawParticleChildFuncListNum++;
|
||||
}
|
||||
|
||||
@@ -632,8 +633,8 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
|
||||
func_no = 0;
|
||||
|
||||
if (is_draw_child && mpChildShape != NULL && !child_type_5_6) {
|
||||
switch (mpChildShape->getType()) {
|
||||
if (is_draw_child && pCsp != NULL && !child_type_5_6) {
|
||||
switch (pCsp->getType()) {
|
||||
case 2:
|
||||
if (is_rotate_on) {
|
||||
mpDrawParticleChildFuncList[func_no] = &JPADrawRotBillboard;
|
||||
@@ -686,9 +687,10 @@ void JPAResource::init(JKRHeap* heap) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mpChildShape != NULL && (mpChildShape->isAlphaOutOn() || mpChildShape->isAlphaInherited()
|
||||
|| mpChildShape->isColorInherited())) {
|
||||
if (pCsp != NULL && (pCsp->isAlphaOutOn() || pCsp->isAlphaInherited()
|
||||
|| pCsp->isColorInherited())) {
|
||||
mpDrawParticleChildFuncList[func_no] = &JPARegistPrmAlphaEnv;
|
||||
func_no++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -720,8 +722,8 @@ bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
||||
} else {
|
||||
calcKey(work);
|
||||
|
||||
for (int i = mFieldBlockNum - 1; i >= 0; i--) {
|
||||
mpFieldBlocks[i]->initOpParam();
|
||||
for (int i = fldNum - 1; i >= 0; i--) {
|
||||
ppFld[i]->initOpParam();
|
||||
}
|
||||
|
||||
if (emtr->mpEmtrCallBack != NULL) {
|
||||
@@ -737,12 +739,12 @@ bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
||||
(*mpCalcEmitterFuncList[i])(work);
|
||||
}
|
||||
|
||||
for (int i = mFieldBlockNum - 1; i >= 0; i--) {
|
||||
mpFieldBlocks[i]->prepare(work);
|
||||
for (int i = fldNum - 1; i >= 0; i--) {
|
||||
ppFld[i]->prepare(work);
|
||||
}
|
||||
|
||||
if (!emtr->checkStatus(8)) {
|
||||
mpDynamicsBlock->create(work);
|
||||
pDyn->create(work);
|
||||
}
|
||||
|
||||
if (emtr->mpEmtrCallBack != NULL) {
|
||||
@@ -752,23 +754,19 @@ bool JPAResource::calc(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
||||
}
|
||||
}
|
||||
|
||||
JPANode<JPABaseParticle>* node = emtr->mAlivePtclBase.getFirst();
|
||||
JPANode<JPABaseParticle>* next;
|
||||
while (node != emtr->mAlivePtclBase.getEnd()) {
|
||||
JPANode<JPABaseParticle>* next = NULL;
|
||||
for (JPANode<JPABaseParticle>* node = emtr->mAlivePtclBase.getFirst(); node != emtr->mAlivePtclBase.getEnd(); node = next) {
|
||||
next = node->getNext();
|
||||
if (node->getObject()->calc_p(work)) {
|
||||
emtr->mpPtclPool->push_front(emtr->mAlivePtclBase.erase(node));
|
||||
}
|
||||
node = next;
|
||||
}
|
||||
|
||||
node = emtr->mAlivePtclChld.getFirst();
|
||||
while (node != emtr->mAlivePtclChld.getEnd()) {
|
||||
for (JPANode<JPABaseParticle>* node = emtr->mAlivePtclChld.getFirst(); node != emtr->mAlivePtclChld.getEnd(); node = next) {
|
||||
next = node->getNext();
|
||||
if (node->getObject()->calc_c(work)) {
|
||||
emtr->mpPtclPool->push_front(emtr->mAlivePtclChld.erase(node));
|
||||
}
|
||||
node = next;
|
||||
}
|
||||
|
||||
emtr->mTick++;
|
||||
@@ -782,13 +780,13 @@ void JPAResource::draw(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
||||
work->mpRes = this;
|
||||
work->mDrawCount = 0;
|
||||
calcWorkData_d(work);
|
||||
mpBaseShape->setGX(work);
|
||||
pBsp->setGX(work);
|
||||
for (s32 i = 1; i <= emtr->getDrawTimes(); i++) {
|
||||
work->mDrawCount++;
|
||||
if (mpBaseShape->isDrawPrntAhead() && mpChildShape != NULL)
|
||||
if (pBsp->isDrawPrntAhead() && pCsp != NULL)
|
||||
drawC(work);
|
||||
drawP(work);
|
||||
if (!mpBaseShape->isDrawPrntAhead() && mpChildShape != NULL)
|
||||
if (!pBsp->isDrawPrntAhead() && pCsp != NULL)
|
||||
drawC(work);
|
||||
}
|
||||
}
|
||||
@@ -796,28 +794,28 @@ void JPAResource::draw(JPAEmitterWorkData* work, JPABaseEmitter* emtr) {
|
||||
void JPAResource::drawP(JPAEmitterWorkData* work) {
|
||||
work->mpEmtr->clearStatus(0x80);
|
||||
|
||||
work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * mpBaseShape->getBaseSizeX();
|
||||
work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * mpBaseShape->getBaseSizeY();
|
||||
work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * pBsp->getBaseSizeX();
|
||||
work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * pBsp->getBaseSizeY();
|
||||
|
||||
if (mpBaseShape->getType() == 0) {
|
||||
if (pBsp->getType() == 0) {
|
||||
work->mGlobalPtclScl.x *= 1.02f;
|
||||
} else if (mpBaseShape->getType() == 1) {
|
||||
} else if (pBsp->getType() == 1) {
|
||||
work->mGlobalPtclScl.x *= 1.02f;
|
||||
work->mGlobalPtclScl.y *= 0.4f;
|
||||
}
|
||||
|
||||
if (mpExtraShape != NULL && mpExtraShape->isEnableScaleAnm()) {
|
||||
work->mPivot.x = mpExtraShape->getScaleCenterX() - 1.0f;
|
||||
work->mPivot.y = mpExtraShape->getScaleCenterY() - 1.0f;
|
||||
if (pEsp != NULL && pEsp->isEnableScaleAnm()) {
|
||||
work->mPivot.x = pEsp->getScaleCenterX() - 1.0f;
|
||||
work->mPivot.y = pEsp->getScaleCenterY() - 1.0f;
|
||||
} else {
|
||||
work->mPivot.x = work->mPivot.y = 0.0f;
|
||||
}
|
||||
|
||||
work->mDirType = mpBaseShape->getDirType();
|
||||
work->mRotType = mpBaseShape->getRotType();
|
||||
work->mDLType = mpBaseShape->getType() == 4 || mpBaseShape->getType() == 8;
|
||||
work->mPlaneType = work->mDLType ? 2 : mpBaseShape->getBasePlaneType();
|
||||
work->mPrjType = mpBaseShape->isPrjTex() ? (mpBaseShape->isTexCrdAnm() ? 2 : 1) : 0;
|
||||
work->mDirType = pBsp->getDirType();
|
||||
work->mRotType = pBsp->getRotType();
|
||||
work->mDLType = pBsp->getType() == 4 || pBsp->getType() == 8;
|
||||
work->mPlaneType = work->mDLType ? 2 : pBsp->getBasePlaneType();
|
||||
work->mPrjType = pBsp->isPrjTex() ? (pBsp->isTexCrdAnm() ? 2 : 1) : 0;
|
||||
|
||||
work->mpAlivePtcl = &work->mpEmtr->mAlivePtclBase;
|
||||
setPTev();
|
||||
@@ -826,7 +824,7 @@ void JPAResource::drawP(JPAEmitterWorkData* work) {
|
||||
(*mpDrawEmitterFuncList[i])(work);
|
||||
}
|
||||
|
||||
if (mpBaseShape->isDrawFwdAhead()) {
|
||||
if (pBsp->isDrawFwdAhead()) {
|
||||
JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclBase.getLast();
|
||||
for (; node != work->mpEmtr->mAlivePtclBase.getEnd(); node = node->getPrev()) {
|
||||
work->mpCurNode = node;
|
||||
@@ -858,27 +856,27 @@ void JPAResource::drawP(JPAEmitterWorkData* work) {
|
||||
void JPAResource::drawC(JPAEmitterWorkData* work) {
|
||||
work->mpEmtr->setStatus(0x80);
|
||||
|
||||
if (mpChildShape->isScaleInherited()) {
|
||||
work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * mpBaseShape->getBaseSizeX();
|
||||
work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * mpBaseShape->getBaseSizeY();
|
||||
if (pCsp->isScaleInherited()) {
|
||||
work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * pBsp->getBaseSizeX();
|
||||
work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * pBsp->getBaseSizeY();
|
||||
} else {
|
||||
work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * mpChildShape->getScaleX();
|
||||
work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * mpChildShape->getScaleY();
|
||||
work->mGlobalPtclScl.x = work->mpEmtr->mGlobalPScl.x * pCsp->getScaleX();
|
||||
work->mGlobalPtclScl.y = work->mpEmtr->mGlobalPScl.y * pCsp->getScaleY();
|
||||
}
|
||||
|
||||
if (mpChildShape->getType() == 0) {
|
||||
if (pCsp->getType() == 0) {
|
||||
work->mGlobalPtclScl.x *= 1.02f;
|
||||
} else if (mpChildShape->getType() == 1) {
|
||||
} else if (pCsp->getType() == 1) {
|
||||
work->mGlobalPtclScl.x *= 1.02f;
|
||||
work->mGlobalPtclScl.y *= 0.4f;
|
||||
}
|
||||
|
||||
work->mPivot.x = work->mPivot.y = 0.0f;
|
||||
|
||||
work->mDirType = mpChildShape->getDirType();
|
||||
work->mRotType = mpChildShape->getRotType();
|
||||
work->mDLType = mpChildShape->getType() == 4 || mpChildShape->getType() == 8;
|
||||
work->mPlaneType = work->mDLType ? 2 : mpChildShape->getBasePlaneType();
|
||||
work->mDirType = pCsp->getDirType();
|
||||
work->mRotType = pCsp->getRotType();
|
||||
work->mDLType = pCsp->getType() == 4 || pCsp->getType() == 8;
|
||||
work->mPlaneType = work->mDLType ? 2 : pCsp->getBasePlaneType();
|
||||
work->mPrjType = 0;
|
||||
|
||||
work->mpAlivePtcl = &work->mpEmtr->mAlivePtclChld;
|
||||
@@ -888,7 +886,7 @@ void JPAResource::drawC(JPAEmitterWorkData* work) {
|
||||
(*mpDrawEmitterChildFuncList[i])(work);
|
||||
}
|
||||
|
||||
if (mpBaseShape->isDrawFwdAhead()) {
|
||||
if (pBsp->isDrawFwdAhead()) {
|
||||
JPANode<JPABaseParticle>* node = work->mpEmtr->mAlivePtclChld.getLast();
|
||||
for (; node != work->mpEmtr->mAlivePtclChld.getEnd(); node = node->getPrev()) {
|
||||
work->mpCurNode = node;
|
||||
@@ -923,33 +921,27 @@ void JPAResource::setPTev() {
|
||||
u8 tex_gens = 1;
|
||||
u8 ind_stages = 0;
|
||||
|
||||
int base_plane_type = (mpBaseShape->getType() == 3 || mpBaseShape->getType() == 7) ?
|
||||
mpBaseShape->getBasePlaneType() : 0;
|
||||
int center_offset;
|
||||
if (mpExtraShape != NULL) {
|
||||
center_offset =
|
||||
(mpExtraShape->getScaleCenterX() + 3 * mpExtraShape->getScaleCenterY()) * 0xC;
|
||||
} else {
|
||||
center_offset = 0x30;
|
||||
}
|
||||
int base_plane_type = (pBsp->getType() == 3 || pBsp->getType() == 7) ?
|
||||
pBsp->getBasePlaneType() : 0;
|
||||
int center_offset = pEsp != NULL ? (pEsp->getScaleCenterX() + 3 * pEsp->getScaleCenterY()) * 0xC : 0x30;
|
||||
int pos_offset = center_offset + base_plane_type * 0x6C;
|
||||
int crd_offset = (mpBaseShape->getTilingS() + 2 * mpBaseShape->getTilingT()) * 8;
|
||||
int crd_offset = (pBsp->getTilingS() + 2 * pBsp->getTilingT()) * 8;
|
||||
GXSetArray(GX_VA_POS, jpa_pos + pos_offset, 3);
|
||||
GXSetArray(GX_VA_TEX0, jpa_crd + crd_offset, 2);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
|
||||
if (mpExTexShape != NULL) {
|
||||
if (mpExTexShape->isUseIndirect()) {
|
||||
GXSetIndTexOrder(GX_INDTEXSTAGE0, GX_TEXCOORD1, GX_TEXMAP2);
|
||||
if (pEts != NULL) {
|
||||
if (pEts->isUseIndirect()) {
|
||||
GXSetIndTexOrder(GX_INDTEXSTAGE0, tex_coord, GX_TEXMAP2);
|
||||
GXSetIndTexCoordScale(GX_INDTEXSTAGE0, GX_ITS_1, GX_ITS_1);
|
||||
GXSetIndTexMtx(GX_ITM_0, (f32(*)[3])mpExTexShape->getIndTexMtx(), mpExTexShape->getExpScale());
|
||||
GXSetIndTexMtx(GX_ITM_0, (f32(*)[3])pEts->getIndTexMtx(), pEts->getExpScale());
|
||||
GXSetTevIndirect(GX_TEVSTAGE0, GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_STU, GX_ITM_0,
|
||||
GX_ITW_OFF, GX_ITW_OFF, 0, 0, GX_ITBA_OFF);
|
||||
ind_stages++;
|
||||
tex_gens++;
|
||||
tex_coord = GX_TEXCOORD2;
|
||||
}
|
||||
if (mpExTexShape->isUseSecTex()) {
|
||||
if (pEts->isUseSecTex()) {
|
||||
GXSetTevOrder(GX_TEVSTAGE1, tex_coord, GX_TEXMAP3, GX_COLOR_NULL);
|
||||
GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_TEXC, GX_CC_CPREV, GX_CC_ZERO);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_TEXA, GX_CA_APREV, GX_CA_ZERO);
|
||||
@@ -964,7 +956,7 @@ void JPAResource::setPTev() {
|
||||
|
||||
GXSetNumTevStages(tev_stages);
|
||||
GXSetNumIndStages(ind_stages);
|
||||
if (mpBaseShape->isClipOn()) {
|
||||
if (pBsp->isClipOn()) {
|
||||
GXSetMisc(GX_MT_XF_FLUSH, 8);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
} else {
|
||||
@@ -974,8 +966,8 @@ void JPAResource::setPTev() {
|
||||
}
|
||||
|
||||
void JPAResource::setCTev(JPAEmitterWorkData* work) {
|
||||
int base_plane_type = (mpChildShape->getType() == 3 || mpChildShape->getType() == 7) ?
|
||||
mpChildShape->getBasePlaneType() : 0;
|
||||
int base_plane_type = (pCsp->getType() == 3 || pCsp->getType() == 7) ?
|
||||
pCsp->getBasePlaneType() : 0;
|
||||
int pos_offset = 0x30 + base_plane_type * 0x6C;
|
||||
GXSetArray(GX_VA_POS, jpa_pos + pos_offset, 3);
|
||||
GXSetArray(GX_VA_TEX0, jpa_crd, 2);
|
||||
@@ -984,14 +976,14 @@ void JPAResource::setCTev(JPAEmitterWorkData* work) {
|
||||
GXSetTevDirect(GX_TEVSTAGE0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetNumIndStages(0);
|
||||
if (mpChildShape->isClipOn()) {
|
||||
if (pCsp->isClipOn()) {
|
||||
GXSetMisc(GX_MT_XF_FLUSH, 8);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
} else {
|
||||
GXSetClipMode(GX_CLIP_DISABLE);
|
||||
}
|
||||
GXSetNumTexGens(1);
|
||||
work->mpResMgr->load(work->mpRes->getTexIdx(mpChildShape->getTexIdx()), GX_TEXMAP1);
|
||||
work->mpResMgr->load(work->mpRes->getTexIdx(pCsp->getTexIdx()), GX_TEXMAP1);
|
||||
}
|
||||
|
||||
void JPAResource::calc_p(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
@@ -1011,15 +1003,15 @@ void JPAResource::calc_c(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
}
|
||||
|
||||
void JPAResource::calcField(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
|
||||
for (int i = mFieldBlockNum - 1; i >= 0; i--) {
|
||||
mpFieldBlocks[i]->calc(work, ptcl);
|
||||
for (int i = fldNum - 1; i >= 0; i--) {
|
||||
ppFld[i]->calc(work, ptcl);
|
||||
}
|
||||
}
|
||||
|
||||
void JPAResource::calcKey(JPAEmitterWorkData* work) {
|
||||
for (int i = mKeyBlockNum - 1; i >= 0; i--) {
|
||||
f32 val = mpKeyBlocks[i]->calc(work->mpEmtr->mTick);
|
||||
switch (mpKeyBlocks[i]->getID()) {
|
||||
for (int i = keyNum - 1; i >= 0; i--) {
|
||||
f32 val = ppKey[i]->calc(work->mpEmtr->mTick);
|
||||
switch (ppKey[i]->getID()) {
|
||||
case 0:
|
||||
work->mpEmtr->mRate = val;
|
||||
break;
|
||||
@@ -1047,6 +1039,9 @@ void JPAResource::calcKey(JPAEmitterWorkData* work) {
|
||||
case 10:
|
||||
work->mpEmtr->mScaleOut = val;
|
||||
break;
|
||||
default:
|
||||
JUT_WARN(917, "%s", "JPA : WRONG ID in key data\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1055,10 +1050,9 @@ void JPAResource::calcWorkData_c(JPAEmitterWorkData* work) {
|
||||
work->mVolumeSize = work->mpEmtr->mVolumeSize;
|
||||
work->mVolumeMinRad = work->mpEmtr->mVolumeMinRad;
|
||||
work->mVolumeSweep = work->mpEmtr->mVolumeSweep;
|
||||
work->mVolumeX = 0;
|
||||
work->mVolumeAngleNum = 0;
|
||||
work->mVolumeAngleNum = work->mVolumeX = 0;
|
||||
work->mVolumeAngleMax = 1;
|
||||
work->mDivNumber = mpDynamicsBlock->getDivNumber() * 2 + 1;
|
||||
work->mDivNumber = pDyn->getDivNumber() * 2 + 1;
|
||||
Mtx local_scl_mtx, local_rot_mtx, global_mtx;
|
||||
MTXScale(local_scl_mtx, work->mpEmtr->mLocalScl.x, work->mpEmtr->mLocalScl.y,
|
||||
work->mpEmtr->mLocalScl.z);
|
||||
|
||||
@@ -12,12 +12,35 @@
|
||||
#include "JSystem/JParticle/JPAResource.h"
|
||||
#include "JSystem/JParticle/JPAResourceManager.h"
|
||||
|
||||
static void dummy1() {
|
||||
JUT_WARN(0, "JPA : wrong version file %s\n");
|
||||
OS_REPORT("JPA : no jpa file\n");
|
||||
}
|
||||
|
||||
JPAResourceLoader::JPAResourceLoader(u8 const* data, JPAResourceManager* mgr) {
|
||||
if (*(u32*)(data + 4) == '2-10') {
|
||||
load_jpc(data, mgr);
|
||||
} else {
|
||||
JUT_WARN(48, "JPA : wrong version file\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void dummy2() {
|
||||
OS_REPORT("tex_num && \"a resource have to use one or more texture\"");
|
||||
OS_REPORT("p_res != 0");
|
||||
OS_REPORT("(p_res->ppFld != 0) || (p_res->fldNum == 0)");
|
||||
OS_REPORT("(p_res->ppKey != 0) || (p_res->keyNum == 0)");
|
||||
OS_REPORT("(p_res->texIdxTbl != 0) || (p_res->texNum == 0)");
|
||||
OS_REPORT("p_res->ppFld[fld_no] != 0");
|
||||
OS_REPORT("p_res->ppKey[key_no] != 0");
|
||||
OS_REPORT("p_res->pDyn != 0");
|
||||
OS_REPORT("p_res->pBsp != 0");
|
||||
OS_REPORT("p_res->pEsp != 0");
|
||||
OS_REPORT("p_res->pCsp != 0");
|
||||
OS_REPORT("p_res->pEts != 0");
|
||||
OS_REPORT("JPA : wrong type block in jpc file %x\n");
|
||||
}
|
||||
|
||||
struct JPAResourceHeader {
|
||||
/* 0x0 */ u16 mUsrIdx;
|
||||
/* 0x2 */ u16 mBlockNum;
|
||||
@@ -26,74 +49,89 @@ struct JPAResourceHeader {
|
||||
/* 0x6 */ u8 mTDB1Num;
|
||||
};
|
||||
|
||||
void JPAResourceLoader::load_jpc(u8 const* data, JPAResourceManager* mgr) {
|
||||
JKRHeap* heap = mgr->mpHeap;
|
||||
mgr->mResMax = *(u16*)(data + 8);
|
||||
mgr->mTexMax = *(u16*)(data + 0xA);
|
||||
mgr->mpResArr = new (heap, 0) JPAResource*[mgr->mResMax];
|
||||
mgr->mpTexArr = new (heap, 0) JPATexture*[mgr->mTexMax];
|
||||
void JPAResourceLoader::load_jpc(u8 const* data, JPAResourceManager* p_res_mgr) {
|
||||
JKRHeap* heap = p_res_mgr->mpHeap;
|
||||
p_res_mgr->resMaxNum = *(u16*)(data + 8);
|
||||
p_res_mgr->texMaxNum = *(u16*)(data + 0xA);
|
||||
p_res_mgr->pResAry = new (heap, 0) JPAResource*[p_res_mgr->resMaxNum];
|
||||
p_res_mgr->pTexAry = new (heap, 0) JPATexture*[p_res_mgr->texMaxNum];
|
||||
JUT_ASSERT(199, (p_res_mgr->pResAry != NULL) && (p_res_mgr->pTexAry != 0));
|
||||
|
||||
u32 offset = 0x10;
|
||||
for (int i = 0; i < *(u16*)(data + 8); i++) {
|
||||
JPAResourceHeader* header = (JPAResourceHeader*)(data + offset);
|
||||
JPAResource* res = new (heap, 0) JPAResource();
|
||||
res->mFieldBlockNum = header->mFieldBlockNum;
|
||||
res->mpFieldBlocks = res->mFieldBlockNum != 0 ?
|
||||
new (heap, 0) JPAFieldBlock*[res->mFieldBlockNum] : NULL;
|
||||
res->mKeyBlockNum = header->mKeyBlockNum;
|
||||
res->mpKeyBlocks = res->mKeyBlockNum != 0 ?
|
||||
new (heap, 0) JPAKeyBlock*[res->mKeyBlockNum] : NULL;
|
||||
res->mTDB1Num = header->mTDB1Num;
|
||||
res->mpTDB1 = NULL;
|
||||
res->mUsrIdx = header->mUsrIdx;
|
||||
JPAResource* p_res = new (heap, 0) JPAResource();
|
||||
JUT_ASSERT(211, p_res != NULL);
|
||||
p_res->fldNum = header->mFieldBlockNum;
|
||||
p_res->ppFld = p_res->fldNum != 0 ?
|
||||
new (heap, 0) JPAFieldBlock*[p_res->fldNum] : NULL;
|
||||
JUT_ASSERT(216, (p_res->ppFld != NULL) || (p_res->fldNum == 0));
|
||||
p_res->keyNum = header->mKeyBlockNum;
|
||||
p_res->ppKey = p_res->keyNum != 0 ?
|
||||
new (heap, 0) JPAKeyBlock*[p_res->keyNum] : NULL;
|
||||
JUT_ASSERT(221, (p_res->ppKey != NULL) || (p_res->keyNum == 0));
|
||||
p_res->texNum = header->mTDB1Num;
|
||||
p_res->mpTDB1 = NULL;
|
||||
p_res->mUsrIdx = header->mUsrIdx;
|
||||
|
||||
offset += 8;
|
||||
u32 field_idx = 0;
|
||||
u32 key_idx = 0;
|
||||
u32 fld_no = 0;
|
||||
u32 key_no = 0;
|
||||
|
||||
for (int j = 0; j < header->mBlockNum; j++) {
|
||||
u32 magic = *(u32*)(data + offset);
|
||||
u32 size = *(u32*)(data + offset + 4);
|
||||
switch (magic) {
|
||||
case 'FLD1':
|
||||
res->mpFieldBlocks[field_idx] = new (heap, 0) JPAFieldBlock(data + offset, heap);
|
||||
field_idx++;
|
||||
p_res->ppFld[fld_no] = new (heap, 0) JPAFieldBlock(data + offset, heap);
|
||||
JUT_ASSERT(244, p_res->ppFld[fld_no] != NULL);
|
||||
fld_no++;
|
||||
break;
|
||||
case 'KFA1':
|
||||
res->mpKeyBlocks[key_idx] = new (heap, 0) JPAKeyBlock(data + offset);
|
||||
key_idx++;
|
||||
p_res->ppKey[key_no] = new (heap, 0) JPAKeyBlock(data + offset);
|
||||
JUT_ASSERT(249, p_res->ppKey[key_no] != NULL);
|
||||
key_no++;
|
||||
break;
|
||||
case 'BEM1':
|
||||
res->mpDynamicsBlock = new (heap, 0) JPADynamicsBlock(data + offset);
|
||||
p_res->pDyn = new (heap, 0) JPADynamicsBlock(data + offset);
|
||||
JUT_ASSERT(254, p_res->pDyn != NULL);
|
||||
break;
|
||||
case 'BSP1':
|
||||
res->mpBaseShape = new (heap, 0) JPABaseShape(data + offset, heap);
|
||||
p_res->pBsp = new (heap, 0) JPABaseShape(data + offset, heap);
|
||||
JUT_ASSERT(258, p_res->pBsp != NULL);
|
||||
break;
|
||||
case 'ESP1':
|
||||
res->mpExtraShape = new (heap, 0) JPAExtraShape(data + offset);
|
||||
p_res->pEsp = new (heap, 0) JPAExtraShape(data + offset);
|
||||
JUT_ASSERT(262, p_res->pEsp != NULL);
|
||||
break;
|
||||
case 'SSP1':
|
||||
res->mpChildShape = new (heap, 0) JPAChildShape(data + offset);
|
||||
p_res->pCsp = new (heap, 0) JPAChildShape(data + offset);
|
||||
JUT_ASSERT(266, p_res->pCsp != NULL);
|
||||
break;
|
||||
case 'ETX1':
|
||||
res->mpExTexShape = new (heap, 0) JPAExTexShape(data + offset);
|
||||
p_res->pEts = new (heap, 0) JPAExTexShape(data + offset);
|
||||
JUT_ASSERT(270, p_res->pEts != NULL);
|
||||
break;
|
||||
case 'TDB1':
|
||||
res->mpTDB1 = (const u16*)(data + offset + 8);
|
||||
p_res->mpTDB1 = (const u16*)(data + offset + 8);
|
||||
break;
|
||||
default:
|
||||
JUT_WARN(275, "JPA : wrong type block in jpc file %d %x\n", header->mBlockNum, offset);
|
||||
break;
|
||||
}
|
||||
offset += size;
|
||||
}
|
||||
|
||||
res->init(heap);
|
||||
mgr->registRes(res);
|
||||
p_res->init(heap);
|
||||
p_res_mgr->registRes(p_res);
|
||||
}
|
||||
|
||||
offset = *(u32*)(data + 0xC);
|
||||
for (int i = 0; i < *(u16*)(data + 0xA); i++) {
|
||||
u32 size = *(u32*)(data + offset + 4);
|
||||
JPATexture* tex = new (heap, 0) JPATexture(data + offset);
|
||||
mgr->registTex(tex);
|
||||
JPATexture* p_tex = new (heap, 0) JPATexture(data + offset);
|
||||
JUT_ASSERT(298, p_tex != NULL);
|
||||
p_res_mgr->registTex(p_tex);
|
||||
offset += size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,37 +9,39 @@ struct JPAResourceLoader {
|
||||
JPAResourceLoader(u8 const*, JPAResourceManager*);
|
||||
};
|
||||
|
||||
JPAResourceManager::JPAResourceManager(void const* pData, JKRHeap* pHeap) {
|
||||
mpResArr = NULL;
|
||||
mpTexArr = NULL;
|
||||
mResMax = 0;
|
||||
mResNum = 0;
|
||||
mTexMax = 0;
|
||||
mTexNum = 0;
|
||||
JPAResourceManager::JPAResourceManager(void const* p_jpc, JKRHeap* pHeap) {
|
||||
pResAry = NULL;
|
||||
pTexAry = NULL;
|
||||
resMaxNum = 0;
|
||||
resRegNum = 0;
|
||||
texMaxNum = 0;
|
||||
texRegNum = 0;
|
||||
mpHeap = pHeap;
|
||||
JPAResourceLoader loader((u8 const*)pData, this);
|
||||
JUT_ASSERT(49, (p_jpc != 0) && (pHeap != 0));
|
||||
JPAResourceLoader loader((u8 const*)p_jpc, this);
|
||||
}
|
||||
|
||||
JPAResource* JPAResourceManager::getResource(u16 usrIdx) const {
|
||||
for (u16 i = 0; i < mResNum; i++)
|
||||
if (mpResArr[i]->getUsrIdx() == usrIdx)
|
||||
return mpResArr[i];
|
||||
for (u16 i = 0; i < resRegNum; i++)
|
||||
if (pResAry[i]->getUsrIdx() == usrIdx)
|
||||
return pResAry[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool JPAResourceManager::checkUserIndexDuplication(u16 usrIdx) const {
|
||||
for (s32 i = 0; i < mResNum; i++)
|
||||
if (mpResArr[i]->getUsrIdx() == usrIdx)
|
||||
for (s32 i = 0; i < resRegNum; i++)
|
||||
if (pResAry[i]->getUsrIdx() == usrIdx)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
const ResTIMG* JPAResourceManager::swapTexture(ResTIMG const* img, char const* swapName) {
|
||||
const ResTIMG* ret = NULL;
|
||||
JUTTexture* tex = NULL;
|
||||
|
||||
for (s32 i = 0; i < mTexNum; i++) {
|
||||
if (strcmp(swapName, mpTexArr[i]->getName()) == 0) {
|
||||
JUTTexture* tex = mpTexArr[i]->getJUTTexture();
|
||||
for (s32 i = 0; i < texRegNum; i++) {
|
||||
if (strcmp(swapName, pTexAry[i]->getName()) == 0) {
|
||||
tex = pTexAry[i]->getJUTTexture();
|
||||
ret = tex->getTexInfo();
|
||||
tex->storeTIMG(img, (u8)0);
|
||||
break;
|
||||
@@ -50,13 +52,15 @@ const ResTIMG* JPAResourceManager::swapTexture(ResTIMG const* img, char const* s
|
||||
}
|
||||
|
||||
void JPAResourceManager::registRes(JPAResource* res) {
|
||||
mpResArr[mResNum] = res;
|
||||
mResNum++;
|
||||
JUT_ASSERT(151, resRegNum < resMaxNum);
|
||||
pResAry[resRegNum] = res;
|
||||
resRegNum++;
|
||||
}
|
||||
|
||||
void JPAResourceManager::registTex(JPATexture* tex) {
|
||||
mpTexArr[mTexNum] = tex;
|
||||
mTexNum++;
|
||||
JUT_ASSERT(166, texRegNum < texMaxNum);
|
||||
pTexAry[texRegNum] = tex;
|
||||
texRegNum++;
|
||||
}
|
||||
|
||||
u32 JPAResourceManager::getResUserWork(u16 usrIdx) const {
|
||||
|
||||
@@ -116,8 +116,9 @@ void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va
|
||||
OSEnableInterrupts();
|
||||
|
||||
u32 retrace_count = VIGetRetraceCount();
|
||||
do {
|
||||
} while (retrace_count == VIGetRetraceCount());
|
||||
while (retrace_count == VIGetRetraceCount()){
|
||||
// nop
|
||||
}
|
||||
|
||||
// busy loop for 2 seconds
|
||||
OSTime var1 = OSGetTime();
|
||||
@@ -129,6 +130,8 @@ void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va
|
||||
}
|
||||
|
||||
void showAssert_f(u32 device, const char* file, int line, const char* msg, ...) {
|
||||
UNUSED(msg);
|
||||
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
showAssert_f_va(device, file, line, msg, args);
|
||||
@@ -159,6 +162,8 @@ void setWarningMessage_f_va(u32 device, const char* file, int line, const char*
|
||||
}
|
||||
|
||||
void setWarningMessage_f(u32 device, char* file, int line, const char* msg, ...) {
|
||||
UNUSED(msg);
|
||||
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
setWarningMessage_f_va(device, file, line, msg, args);
|
||||
@@ -189,6 +194,8 @@ void setLogMessage_f_va(u32 device, const char* file, int line, const char* msg,
|
||||
}
|
||||
|
||||
void setLogMessage_f(u32 device, char* file, int line, const char* msg, ...) {
|
||||
UNUSED(msg);
|
||||
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
setLogMessage_f_va(device, file, line, msg, args);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include <dolphin/gx.h>
|
||||
#include <stdint.h>
|
||||
#include <cstring>
|
||||
#include "angle_utils.h"
|
||||
|
||||
JUTCacheFont::JUTCacheFont(ResFONT const* p_fontRes, u32 cacheSize, JKRHeap* p_heap) {
|
||||
initialize_state();
|
||||
@@ -70,7 +72,6 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
|
||||
u32 totalGlySize = 0;
|
||||
u32 totalMapSize = 0;
|
||||
u32 maxGlyTexSize = 0;
|
||||
u32 glyTexSize;
|
||||
|
||||
u8* fontInf = (u8*)p_font->data;
|
||||
for (int i = 0; i < (int)p_font->numBlocks; i++) {
|
||||
@@ -84,11 +85,10 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
|
||||
widBlockCount++;
|
||||
break;
|
||||
case 'GLY1':
|
||||
totalGlySize += blkSize;
|
||||
glyTexSize = ((ResFONT::GLY1*)fontInf)->textureSize;
|
||||
totalGlySize += ((BlockHeader*)fontInf)->size;
|
||||
glyBlockCount++;
|
||||
if (glyTexSize > maxGlyTexSize) {
|
||||
maxGlyTexSize = glyTexSize;
|
||||
if (((ResFONT::GLY1*)fontInf)->textureSize > maxGlyTexSize) {
|
||||
maxGlyTexSize = ((ResFONT::GLY1*)fontInf)->textureSize;
|
||||
}
|
||||
break;
|
||||
case 'MAP1':
|
||||
@@ -185,7 +185,7 @@ bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) {
|
||||
}
|
||||
|
||||
if (mGly1BlockNum != 0) {
|
||||
field_0x80 = new (heap, 0) ResFONT::GLY1[mGly1BlockNum];
|
||||
field_0x80 = new (heap, 0) u8[mGly1BlockNum * sizeof(ResFONT::GLY1)];
|
||||
if (field_0x80 == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -350,7 +350,7 @@ void JUTCacheFont::getGlyphFromAram(JUTCacheFont::TGlyphCacheInfo* param_0,
|
||||
prepend(pGylphCacheInfo);
|
||||
int iVar3 = pGylphCacheInfo->field_0x16 * pGylphCacheInfo->field_0x18;
|
||||
int iVar2 = *r30 / iVar3;
|
||||
pGylphCacheInfo->field_0x8 += iVar2 * iVar3;
|
||||
U16_ADD_2(pGylphCacheInfo->field_0x8, iVar2 * iVar3);
|
||||
u16 local_30 = pGylphCacheInfo->field_0x8 + iVar3 - 1;
|
||||
pGylphCacheInfo->field_0xa = pGylphCacheInfo->field_0xa < local_30 ? pGylphCacheInfo->field_0xa : local_30;
|
||||
*param_3 = iVar2;
|
||||
|
||||
@@ -31,6 +31,7 @@ JUTConsole* JUTConsole::create(unsigned int param_0, void* buffer, u32 bufferSiz
|
||||
JUT_ASSERT(59, pManager != NULL);
|
||||
|
||||
JUT_ASSERT(62, ( (uintptr_t)buffer & 0x3 ) == 0);
|
||||
|
||||
u32 maxLines = getLineFromObjectSize(bufferSize, param_0);
|
||||
|
||||
JUTConsole* console = new (buffer) JUTConsole(param_0, maxLines, false);
|
||||
@@ -66,6 +67,10 @@ JUTConsole::JUTConsole(unsigned int param_0, unsigned int maxLines, bool param_2
|
||||
field_0x64 = 8;
|
||||
}
|
||||
|
||||
static void dummystring1() {
|
||||
UNUSED("console != 0");
|
||||
}
|
||||
|
||||
JUTConsole::~JUTConsole() {
|
||||
JUT_ASSERT(154, JUTConsoleManager::getManager());
|
||||
JUTConsoleManager::getManager()->removeConsole(this);
|
||||
@@ -77,7 +82,8 @@ size_t JUTConsole::getObjectSizeFromBufferSize(unsigned int param_0, unsigned in
|
||||
}
|
||||
|
||||
size_t JUTConsole::getLineFromObjectSize(u32 bufferSize, unsigned int param_1) {
|
||||
size_t result = (bufferSize - sizeof(JUTConsole)) / (param_1 + 2);
|
||||
bufferSize -= sizeof(JUTConsole);
|
||||
size_t result = (bufferSize) / (param_1 + 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -102,7 +108,9 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
|
||||
|
||||
if (mVisible && (mFont != NULL || consoleType == CONSOLE_TYPE_2)) {
|
||||
if (mHeight != 0) {
|
||||
bool temp_r30 = consoleType == CONSOLE_TYPE_0;
|
||||
bool spA = consoleType == CONSOLE_TYPE_0 ? true : false;
|
||||
int spA4 = spA ? 1 : 0;
|
||||
spA4 = 0;
|
||||
font_yOffset = 2.0f + mFontSizeY;
|
||||
|
||||
if (consoleType != CONSOLE_TYPE_2) {
|
||||
@@ -115,21 +123,13 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
|
||||
ortho.setPort();
|
||||
}
|
||||
|
||||
const JUtility::TColor* color;
|
||||
if (temp_r30) {
|
||||
color = &field_0x60;
|
||||
} else {
|
||||
color = &field_0x5c;
|
||||
}
|
||||
|
||||
J2DFillBox(mPositionX - 2, (int)(mPositionY - font_yOffset),
|
||||
(int)((mFontSizeX * field_0x20) + 4.0f), (int)(font_yOffset * mHeight),
|
||||
*color);
|
||||
(int)((mFontSizeX * field_0x20) + 4.0f),
|
||||
(int)(font_yOffset * (mHeight + spA4)), spA ? field_0x60 : field_0x5c);
|
||||
mFont->setGX();
|
||||
|
||||
if (temp_r30) {
|
||||
s32 s = (diffIndex(field_0x30, field_0x38) - mHeight) + 1;
|
||||
if (s <= 0) {
|
||||
if (spA) {
|
||||
if (((diffIndex(field_0x30, field_0x38) - (int)mHeight) + 1) <= 0) {
|
||||
mFont->setCharColor(JUtility::TColor(255, 255, 255, 255));
|
||||
} else if (field_0x30 == field_0x34) {
|
||||
mFont->setCharColor(JUtility::TColor(255, 230, 230, 255));
|
||||
@@ -146,38 +146,81 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
|
||||
JUTDirectPrint::getManager()->setCharColor(JUtility::TColor(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
char* linePtr;
|
||||
s32 curLine = field_0x30;
|
||||
s32 yFactor = 0;
|
||||
u8* linePtr;
|
||||
|
||||
do {
|
||||
linePtr = (char*)getLinePtr(curLine);
|
||||
|
||||
if ((u8)linePtr[-1] != NULL) {
|
||||
if (consoleType != CONSOLE_TYPE_2) {
|
||||
mFont->drawString_scale(mPositionX, ((yFactor * font_yOffset) + mPositionY),
|
||||
mFontSizeX, mFontSizeY, linePtr, true);
|
||||
} else {
|
||||
JUTDirectPrint::getManager()->drawString(
|
||||
mPositionX, ((yFactor * font_yOffset) + mPositionY), linePtr);
|
||||
}
|
||||
|
||||
changeLine_1 = curLine + 1;
|
||||
yFactor += 1;
|
||||
changeLine_2 = changeLine_1 & ~(-((s32)mMaxLines <= (s32)changeLine_1));
|
||||
curLine = changeLine_2;
|
||||
} else {
|
||||
while (true) {
|
||||
linePtr = getLinePtr(curLine);
|
||||
u8 sp9 = linePtr[-1];
|
||||
if (sp9 == 0) {
|
||||
break;
|
||||
}
|
||||
} while (yFactor < mHeight && changeLine_2 != field_0x34);
|
||||
|
||||
if (consoleType != CONSOLE_TYPE_2) {
|
||||
mFont->drawString_scale(mPositionX, ((yFactor * font_yOffset) + mPositionY),
|
||||
mFontSizeX, mFontSizeY, (char*)linePtr, true);
|
||||
} else {
|
||||
JUTDirectPrint::getManager()->drawString(
|
||||
mPositionX, ((yFactor * font_yOffset) + mPositionY), (char*)linePtr);
|
||||
}
|
||||
curLine = nextIndex(curLine);
|
||||
yFactor++;
|
||||
|
||||
if (yFactor >= mHeight || curLine == field_0x34) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (spA4 != 0) {
|
||||
f32 f31 = mPositionX;
|
||||
int sp94 = mHeight * font_yOffset + mPositionY;
|
||||
mFont->setCharColor(JUtility::TColor(0xff, mVisible ? 0xff : 200, 0xc8, 0xff));
|
||||
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY, "X", TRUE);
|
||||
f31 += mFontSizeX;
|
||||
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY,
|
||||
mVisible ? "[ON]" : "[OFF]", TRUE);
|
||||
f31 += (int)(mFontSizeX * 6.0f);
|
||||
if (this == NULL) // ????
|
||||
{
|
||||
mFont->setCharColor(JUtility::TColor(0xff, 0xff, 0x64, 0xff));
|
||||
mFont->drawString_scale((int)(f31 - mFontSizeX), mFontSizeX, mFontSizeY, sp94,
|
||||
"*", TRUE);
|
||||
}
|
||||
mFont->setCharColor(JUtility::TColor(0xc8, 0xc8, 0xc8, 0xff));
|
||||
char spA8[] = "S----------E";
|
||||
char spB8[0x20];
|
||||
int sp90 = diffIndex(field_0x34, field_0x38) + 1;
|
||||
int sp8C = diffIndex(field_0x34, field_0x30);
|
||||
int sp88 = 0;
|
||||
int sp84;
|
||||
if (sp90 <= mHeight) {
|
||||
sp84 = 9;
|
||||
sp88 = 1;
|
||||
} else {
|
||||
sp84 = (sp8C * 9) / (int)(sp90 - mHeight);
|
||||
}
|
||||
spA8[sp84 + 1] = 'O';
|
||||
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY, spA8, TRUE);
|
||||
f31 += mFontSizeX * 13.0f;
|
||||
if (sp88) {
|
||||
sprintf(spB8, "ALL");
|
||||
} else {
|
||||
f32 f29 = sp8C / (f32)(sp90 - mHeight);
|
||||
sprintf(spB8, "%3d%%(%dL)", (int)(100.0 * f29), sp90);
|
||||
}
|
||||
mFont->drawString_scale(f31, sp94, mFontSizeX, mFontSizeY, spB8, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JUTConsole::print_f(char const* fmt, ...) {
|
||||
UNUSED(fmt);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTConsole_print_f_va_(this, fmt, args);
|
||||
JUTConsole::print_f_va(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
@@ -187,48 +230,48 @@ void JUTConsole::print(char const* str) {
|
||||
}
|
||||
|
||||
if (mOutput & 1) {
|
||||
const u8* r29 = (const u8*)str;
|
||||
u8* r28 = getLinePtr(field_0x38) + field_0x3c;
|
||||
while (*r29) {
|
||||
u8* src = (u8*)const_cast<char*>(str); // needs to be non-const to match debug
|
||||
u8* dst = (u8*)getLinePtr(field_0x38) + field_0x3c;
|
||||
while (*src != 0) {
|
||||
if (field_0x6a && field_0x34 == nextIndex(field_0x38)) {
|
||||
break;
|
||||
}
|
||||
if (*r29 == '\n') {
|
||||
r29++;
|
||||
if (*src == '\n') {
|
||||
src++;
|
||||
field_0x3c = field_0x20;
|
||||
} else if (*r29 == '\t') {
|
||||
r29++;
|
||||
} else if (*src == '\t') {
|
||||
src++;
|
||||
while (field_0x3c < field_0x20) {
|
||||
*(r28++) = ' ';
|
||||
*dst++ = ' ';
|
||||
field_0x3c++;
|
||||
if (field_0x3c % field_0x64 == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mFont && mFont->isLeadByte(*r29)) {
|
||||
} else if (mFont && mFont->isLeadByte(*src)) {
|
||||
if (field_0x3c + 1 < field_0x20) {
|
||||
*(r28++) = *(r29++);
|
||||
*(r28++) = *(r29++);
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
field_0x3c++;
|
||||
field_0x3c++;
|
||||
} else {
|
||||
*(r28++) = 0;
|
||||
*dst++ = '\0';
|
||||
field_0x3c++;
|
||||
}
|
||||
} else {
|
||||
*(r28++) = *(r29++);
|
||||
*dst++ = *src++;
|
||||
field_0x3c++;
|
||||
}
|
||||
|
||||
if (field_0x3c < field_0x20) {
|
||||
continue;
|
||||
}
|
||||
*r28 = 0;
|
||||
*dst = '\0';
|
||||
field_0x38 = nextIndex(field_0x38);
|
||||
field_0x3c = 0;
|
||||
setLineAttr(field_0x38, 0xff);
|
||||
r28 = getLinePtr(field_0x38);
|
||||
*r28 = 0;
|
||||
dst = getLinePtr(field_0x38);
|
||||
*dst = '\0';
|
||||
int local_28 = diffIndex(field_0x30, field_0x38);
|
||||
if (local_28 == mHeight) {
|
||||
field_0x30 = nextIndex(field_0x30);
|
||||
@@ -244,7 +287,7 @@ void JUTConsole::print(char const* str) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*r28 = 0;
|
||||
*dst = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,6 +343,15 @@ void JUTConsole::dumpToTerminal(unsigned int param_0) {
|
||||
OS_REPORT(":::dump of console[%x] END----------------------------\n", this);
|
||||
}
|
||||
|
||||
static void dummyStrings2()
|
||||
{
|
||||
UNUSED("console != this && console != 0");
|
||||
UNUSED("\n:::dump of console[%x]----------------\n");
|
||||
UNUSED(":::dump of console[%x] END------------\n");
|
||||
UNUSED("sManager == 0");
|
||||
UNUSED("consoleManager != 0 && sManager == consoleManager");
|
||||
}
|
||||
|
||||
void JUTConsole::scroll(int scrollAmnt) {
|
||||
if (scrollAmnt < 0) {
|
||||
int diff = diffIndex(field_0x34, field_0x30);
|
||||
@@ -404,8 +456,9 @@ void JUTConsoleManager::drawDirect(bool waitRetrace) const {
|
||||
s32 interrupt_status = OSEnableInterrupts();
|
||||
u32 retrace_count = VIGetRetraceCount();
|
||||
u32 new_count;
|
||||
do {
|
||||
} while (retrace_count == VIGetRetraceCount());
|
||||
while (retrace_count == VIGetRetraceCount()){
|
||||
// nop
|
||||
}
|
||||
OSRestoreInterrupts(interrupt_status);
|
||||
}
|
||||
mDirectConsole->doDraw(JUTConsole::CONSOLE_TYPE_2);
|
||||
@@ -459,6 +512,8 @@ extern "C" void JUTReportConsole_f_va(const char* fmt, va_list args) {
|
||||
}
|
||||
|
||||
extern "C" void JUTReportConsole_f(const char* fmt, ...) {
|
||||
UNUSED(fmt);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTReportConsole_f_va(fmt, args);
|
||||
@@ -490,6 +545,8 @@ void JUTWarningConsole_f_va(const char* fmt, va_list args) {
|
||||
}
|
||||
|
||||
void JUTWarningConsole_f(const char* fmt, ...) {
|
||||
UNUSED(fmt);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTReportConsole_f_va(fmt, args);
|
||||
|
||||
@@ -5,18 +5,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include <cstdio>
|
||||
#ifndef __MWERKS__
|
||||
#include <cstdarg>
|
||||
#endif
|
||||
|
||||
inline void enter_(int param_0, int param_1, int param_2, const char* fmt, va_list args) {
|
||||
char buf[0x100];
|
||||
int ret = vsnprintf(buf, 0x100, fmt, args);
|
||||
if (ret < 0) {
|
||||
return;
|
||||
}
|
||||
JUTDbPrint::getManager()->enter(param_0, param_1, param_2, buf, ret < 0x100 ? ret : 0xFF);
|
||||
}
|
||||
#include <cstring>
|
||||
|
||||
JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) {
|
||||
mFont = pFont;
|
||||
@@ -62,9 +51,13 @@ void JUTDbPrint::enter(int param_0, int param_1, int param_2, const char* param_
|
||||
}
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
va_list args;
|
||||
enter_(0, 0, 0, 0, args);
|
||||
static inline void enter_(int param_0, int param_1, int param_2, const char* fmt, va_list args) {
|
||||
char buf[0x100];
|
||||
int ret = vsnprintf(buf, 0x100, fmt, args);
|
||||
|
||||
if (ret >= 0) {
|
||||
JUTDbPrint::getManager()->enter(param_0, param_1, param_2, buf, ret < 0x100 ? ret : 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
void JUTDbPrint::flush() {
|
||||
@@ -104,13 +97,17 @@ void JUTDbPrint::drawString(int posX, int posY, int len, const u8* str) {
|
||||
}
|
||||
|
||||
void JUTReport(int param_0, int param_1, char const* fmt, ...) {
|
||||
UNUSED(fmt); // although not really unused
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
enter_(param_0, param_1, 1, fmt, args);
|
||||
enter_(param_0, param_1, TRUE, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void JUTReport(int param_0, int param_1, int param_2, char const* fmt, ...) {
|
||||
UNUSED(fmt); // although not really unused
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
enter_(param_0, param_1, param_2, fmt, args);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <cstdio>
|
||||
#include <dolphin/os.h>
|
||||
#include "global.h"
|
||||
#include "angle_utils.h"
|
||||
|
||||
JUTDirectPrint* JUTDirectPrint::sDirectPrint;
|
||||
|
||||
@@ -160,7 +161,7 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format
|
||||
for (; 0 < buffer_length; buffer_length--, ptr++) {
|
||||
int codepoint = sAsciiTable[*ptr & 0x7f];
|
||||
if (codepoint == 0xfe) {
|
||||
position_y += 7;
|
||||
U16_ADD_2(position_y, 7);
|
||||
position_x = x;
|
||||
} else if (codepoint == 0xfd) {
|
||||
position_x = position_x + 0x30 - ((position_x - x + 0x2f) % 0x30);
|
||||
@@ -168,7 +169,7 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format
|
||||
if (codepoint != 0xff) {
|
||||
drawChar(position_x, position_y, codepoint);
|
||||
}
|
||||
position_x += 6;
|
||||
U16_ADD_2(position_x, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,6 +178,8 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format
|
||||
}
|
||||
|
||||
void JUTDirectPrint::print(u16 position_x, u16 position_y, char const* format, ...) {
|
||||
UNUSED(format);
|
||||
|
||||
if (mFrameBuffer) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
@@ -190,6 +193,8 @@ void JUTDirectPrint::drawString(u16 position_x, u16 position_y, char* text) {
|
||||
}
|
||||
|
||||
void JUTDirectPrint::drawString_f(u16 position_x, u16 position_y, char const* format, ...) {
|
||||
UNUSED(format);
|
||||
|
||||
if (mFrameBuffer) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
@@ -204,17 +209,15 @@ void JUTDirectPrint::setCharColor(JUtility::TColor color) {
|
||||
|
||||
void JUTDirectPrint::setCharColor(u8 r, u8 g, u8 b) {
|
||||
mCharColor = JUtility::TColor(r, g, b, 0xFF);
|
||||
|
||||
int Cb = -0.148 * (int)r - 0.291 * (int)g + 0.439 * (int)b + 128;
|
||||
int Cr = 0.439 * (int)r - 0.368 * (int)g - 0.071 * (int)b + 128;
|
||||
int Y = 0.257 * (int)r + 0.504 * (int)g + 0.098 * (int)b + 16;
|
||||
|
||||
mCharColor_Y = Y << 8;
|
||||
|
||||
int Y = 0.257 * (int)r + 0.504 * (int)g + 0.098 * (int)b + 16.0f;
|
||||
int Cb = -0.148 * (int)r - 0.291 * (int)g + 0.439 * (int)b + 128.0f;
|
||||
int Cr = 0.439 * (int)r - 0.368 * (int)g - 0.071 * (int)b + 128.0f;
|
||||
|
||||
mCharColor_Y = (u16)Y * 256;
|
||||
mCharColor_Cb = Cb;
|
||||
mCharColor_Cb2 = (Cb >> 1) & 0x7fff;
|
||||
mCharColor_Cb4 = (Cb >> 2) & 0x3fff;
|
||||
mCharColor_Cb2 = (u16)Cb / 2;
|
||||
mCharColor_Cb4 = (u16)Cb / 4;
|
||||
mCharColor_Cr = Cr;
|
||||
mCharColor_Cr2 = (Cr >> 1) & 0x7fff;
|
||||
mCharColor_Cr4 = (Cr >> 2) & 0x3fff;
|
||||
mCharColor_Cr2 = (u16)Cr / 2;
|
||||
mCharColor_Cr4 = (u16)Cr / 4;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <cstdlib>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <stdint.h>
|
||||
#include <cstring>
|
||||
|
||||
struct CallbackObject {
|
||||
/* 0x00 */ JUTExceptionUserCallback callback;
|
||||
@@ -190,6 +191,8 @@ void JUTException::panic_f_va(char const* file, int line, char const* format, va
|
||||
}
|
||||
|
||||
void JUTException::panic_f(char const* file, int line, char const* format, ...) {
|
||||
UNUSED(format);
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
panic_f_va(file, line, format, args);
|
||||
@@ -308,7 +311,9 @@ void JUTException::showStack(OSContext* context) {
|
||||
u32* stackPointer = (u32*)mStackPointer;
|
||||
sConsole->print_f("Address: BackChain LR save\n");
|
||||
|
||||
for (i = 0; (stackPointer != NULL) && (stackPointer != (u32*)0xFFFFFFFF) && (i++ < 0x100);) {
|
||||
for (i = 0; (stackPointer != NULL) && ((uintptr_t)stackPointer != -1) && (i++ < 0x100);
|
||||
stackPointer = (u32*)stackPointer[0])
|
||||
{
|
||||
if (i > mTraceSuppress) {
|
||||
sConsole->print("Suppress trace.\n");
|
||||
return;
|
||||
@@ -318,7 +323,6 @@ void JUTException::showStack(OSContext* context) {
|
||||
showMapInfo_subroutine(stackPointer[1], false);
|
||||
JUTConsoleManager::getManager()->drawDirect(true);
|
||||
waitTime(mPrintWaitTime1);
|
||||
stackPointer = (u32*)stackPointer[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,8 +533,10 @@ bool JUTException::isEnablePad() const {
|
||||
bool JUTException::readPad(u32* out_trigger, u32* out_button) {
|
||||
bool result = false;
|
||||
OSTime start_time = OSGetTime();
|
||||
do {
|
||||
} while (OSTicksToMilliseconds(OSGetTime() - start_time) < 0x32);
|
||||
OSTime ms;
|
||||
while (((OSGetTime() - start_time) / (OS_TIMER_CLOCK / 1000)) < 50){
|
||||
// nop
|
||||
}
|
||||
|
||||
if (mGamePad == (JUTGamePad*)0xffffffff) {
|
||||
JUTGamePad gamePad0(JUTGamePad::EPort1);
|
||||
@@ -683,7 +689,7 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
|
||||
|
||||
int down = 0;
|
||||
int up = 0;
|
||||
do {
|
||||
while (true) {
|
||||
readPad(&trigger, &button);
|
||||
|
||||
bool draw = false;
|
||||
@@ -720,7 +726,7 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
|
||||
}
|
||||
|
||||
waitTime(30);
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
@@ -750,19 +756,19 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
|
||||
}
|
||||
|
||||
void JUTException::waitTime(s32 timeout_ms) {
|
||||
if (!timeout_ms) {
|
||||
return;
|
||||
OSTime start_time;
|
||||
if (timeout_ms) {
|
||||
start_time = OSGetTime();
|
||||
while (((OSGetTime() - start_time) / (OS_TIMER_CLOCK / 1000)) < timeout_ms) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
|
||||
OSTime start_time = OSGetTime();
|
||||
do {
|
||||
} while (OSTicksToMilliseconds(OSGetTime() - start_time) < timeout_ms);
|
||||
}
|
||||
|
||||
void JUTException::createFB() {
|
||||
_GXRenderModeObj* renderMode = &GXNtsc480Int;
|
||||
void* end = (void*)OSGetArenaHi();
|
||||
u32 size = (u16(ALIGN_NEXT(u16(renderMode->fbWidth), 16)) * renderMode->xfbHeight) * 2;
|
||||
u32 size = ((u16)ALIGN_NEXT((u16)renderMode->fbWidth, 16) * renderMode->xfbHeight) * 2;
|
||||
|
||||
void* begin = (void*)ALIGN_PREV((uintptr_t)end - size, 32);
|
||||
void* object = (void*)ALIGN_PREV((intptr_t)begin - sizeof(JUTExternalFB), 32);
|
||||
@@ -777,8 +783,9 @@ void JUTException::createFB() {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
u32 start = VIGetRetraceCount();
|
||||
while (start == VIGetRetraceCount())
|
||||
;
|
||||
while (start == VIGetRetraceCount()) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
|
||||
mFrameMemory = (JUTExternalFB*)object;
|
||||
@@ -892,68 +899,74 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
|
||||
if (section_id >= 0 && section_id != section_idx)
|
||||
continue;
|
||||
|
||||
int length;
|
||||
|
||||
int length;
|
||||
while (true) {
|
||||
if ((length = file.fgets(buffer, ARRAY_SIZEU(buffer))) <= 4) {
|
||||
break;
|
||||
}
|
||||
if (length >= 28) {
|
||||
u32 addr;
|
||||
if (buffer[28] == '4') {
|
||||
addr = ((buffer[18] - '0') << 28) | strtol(buffer + 19, NULL, 16);
|
||||
int size = strtol(buffer + 11, NULL, 16);
|
||||
if ((addr <= address && address < addr + size)) {
|
||||
if (out_addr) {
|
||||
*out_addr = addr;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if ((length = file.fgets(buffer, ARRAY_SIZEU(buffer))) <= 4)
|
||||
break;
|
||||
if ((length < 28))
|
||||
continue;
|
||||
if (buffer[28] == '4') {
|
||||
u32 addr = ((buffer[18] - '0') << 28) | strtol(buffer + 19, NULL, 16);
|
||||
int size = strtol(buffer + 11, NULL, 16);
|
||||
if ((addr <= address && address < addr + size)) {
|
||||
if (out_addr)
|
||||
*out_addr = addr;
|
||||
if (out_size) {
|
||||
*out_size = size;
|
||||
}
|
||||
|
||||
if (out_size)
|
||||
*out_size = size;
|
||||
if (out_line) {
|
||||
const u8* src = (const u8*)&buffer[30];
|
||||
u8* dst = (u8*)out_line;
|
||||
u32 i = 0;
|
||||
|
||||
if (out_line) {
|
||||
const u8* src = (const u8*)&buffer[0x1e];
|
||||
u8* dst = (u8*)out_line;
|
||||
u32 i = 0;
|
||||
for (i = 0; i < line_length - 1; src++) {
|
||||
if ((u8)*src < (u32)' ' && *src != (u32)'\t') {
|
||||
break;
|
||||
}
|
||||
if ((*src == ' ' || *src == (u32)'\t') && (i != 0)) {
|
||||
if (dst[-1] != ' ') {
|
||||
*dst = ' ';
|
||||
dst++;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
*dst++ = *src;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i != 0 && dst[-1] == ' ') {
|
||||
dst--;
|
||||
i--;
|
||||
}
|
||||
(void)*src; // needed to match debug
|
||||
*dst = 0;
|
||||
if (print) {
|
||||
if (begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
sConsole->print_f(" [%08X]: .%s [%08X: %XH]\n %s\n", address,
|
||||
section_name, addr, size, out_line);
|
||||
begin_with_newline = false;
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < line_length - 1; ++src) {
|
||||
if ((u32)(*src) < ' ' && (u32)*src != '\t')
|
||||
break;
|
||||
if ((*src == ' ' || (u32)*src == '\t') && (i != 0)) {
|
||||
if (dst[-1] != ' ') {
|
||||
*dst = ' ';
|
||||
dst++;
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
*dst++ = *src;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i != 0 && dst[-1] == ' ') {
|
||||
dst--;
|
||||
i--;
|
||||
}
|
||||
*dst = 0;
|
||||
if (print) {
|
||||
if (begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
sConsole->print_f(" [%08X]: .%s [%08X: %XH]\n %s\n", address, section_name, addr, size, out_line);
|
||||
begin_with_newline = false;
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result || (section_id >= 0 && section_id == section_idx)) {
|
||||
if (print && begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!result && (section_id < 0 || section_id != section_idx)) {
|
||||
continue;
|
||||
}
|
||||
if (print && begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
file.fclose();
|
||||
@@ -961,7 +974,7 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
|
||||
}
|
||||
|
||||
void JUTException::createConsole(void* console_buffer, u32 console_buffer_size) {
|
||||
if (!console_buffer || !console_buffer_size) {
|
||||
if (console_buffer == NULL || console_buffer_size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,14 @@ f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* s
|
||||
bool a7) {
|
||||
f32 temp = a1;
|
||||
|
||||
for (; usz > 0; --usz, ++str) {
|
||||
u32 c = *(u8*)str;
|
||||
u32 b = c;
|
||||
for (; usz != 0; --usz, ++str) {
|
||||
s32 b = (u8)*str;
|
||||
if (isLeadByte(b)) {
|
||||
JUT_ASSERT(114, usz >= 2);
|
||||
usz--;
|
||||
str++;
|
||||
b <<= 8;
|
||||
b |= *(u8*)str;
|
||||
b |= (u8)*str;
|
||||
}
|
||||
|
||||
a1 += drawChar_scale(a1, a2, a3, a4, b, a7);
|
||||
|
||||
@@ -391,26 +391,26 @@ u32 JUTGamePad::CStick::update(s8 x, s8 y, JUTGamePad::EStickMode mode,
|
||||
}
|
||||
|
||||
u32 JUTGamePad::CStick::getButton(u32 buttons) {
|
||||
u32 button = buttons & 0xF;
|
||||
u32 button = buttons & (PAD_BUTTON_UP | PAD_BUTTON_DOWN | PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT);
|
||||
|
||||
if (-sReleasePoint < mPosX && mPosX < sReleasePoint) {
|
||||
button = button & ~0x3;
|
||||
button &= ~(PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT);
|
||||
} else if (mPosX <= -sPressPoint) {
|
||||
button = (button & ~0x2);
|
||||
button |= 1;
|
||||
button &= ~PAD_BUTTON_RIGHT;
|
||||
button |= PAD_BUTTON_LEFT;
|
||||
} else if (mPosX >= sPressPoint) {
|
||||
button = (button & ~0x1);
|
||||
button |= 2;
|
||||
button &= ~PAD_BUTTON_LEFT;
|
||||
button |= PAD_BUTTON_RIGHT;
|
||||
}
|
||||
|
||||
if (-sReleasePoint < mPosY && mPosY < sReleasePoint) {
|
||||
button = button & ~0xC;
|
||||
button &= ~(PAD_BUTTON_UP | PAD_BUTTON_DOWN);
|
||||
} else if (mPosY <= -sPressPoint) {
|
||||
button = (button & ~0x8);
|
||||
button |= 4;
|
||||
button &= ~PAD_BUTTON_UP;
|
||||
button |= PAD_BUTTON_DOWN;
|
||||
} else if (mPosY >= sPressPoint) {
|
||||
button = (button & ~0x4);
|
||||
button |= 8;
|
||||
button &= ~PAD_BUTTON_DOWN;
|
||||
button |= PAD_BUTTON_UP;
|
||||
}
|
||||
|
||||
return button;
|
||||
@@ -481,7 +481,7 @@ void JUTGamePad::CRumble::update(s16 port) {
|
||||
return;
|
||||
} else {
|
||||
bool enabled = getNumBit(mPattern, mFrame % mFrameCount);
|
||||
u8 status = mStatus[port] != false;
|
||||
u32 status = mStatus[port] != false;
|
||||
|
||||
if (enabled && !status) {
|
||||
startMotor(port);
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool data_804514B8;
|
||||
JUTGraphFifo* JUTGraphFifo::sCurrentFifo;
|
||||
|
||||
JUTGraphFifo::JUTGraphFifo(u32 size) {
|
||||
mSize = size + 0x1F & ~0x1F;
|
||||
mSize = ROUND(size, 0x20);
|
||||
if (data_804514B8) {
|
||||
u32 r29 = sizeof(GXFifoObj);
|
||||
mFifo = (GXFifoObj*)JKRAllocFromSysHeap(mSize + r29, 32);
|
||||
mBase = (u8*)mFifo + r29;
|
||||
u32 fifoSize = sizeof(GXFifoObj);
|
||||
mFifo = (GXFifoObj*)JKRAllocFromSysHeap(fifoSize + mSize, 32);
|
||||
mBase = (u8*)mFifo + fifoSize;
|
||||
GXInitFifoBase(mFifo, mBase, mSize);
|
||||
GXInitFifoPtrs(mFifo, mBase, mBase);
|
||||
} else {
|
||||
mBase = JKRAllocFromSysHeap(mSize + 0xA0, 32);
|
||||
mBase = (void*)((intptr_t)mBase + 0x1F & ~0x1F);
|
||||
mBase = (void*)ROUND((intptr_t)mBase, 0x20);
|
||||
mFifo = GXInit(mBase, mSize);
|
||||
GXSetColorUpdate(GX_ENABLE);
|
||||
data_804514B8 = true;
|
||||
@@ -31,8 +31,9 @@ bool JUTGraphFifo::mGpStatus[5];
|
||||
JUTGraphFifo::~JUTGraphFifo() {
|
||||
sCurrentFifo->save();
|
||||
|
||||
do {
|
||||
} while (isGPActive());
|
||||
while (isGPActive()) {
|
||||
// nop
|
||||
}
|
||||
|
||||
if (sCurrentFifo == this) {
|
||||
sCurrentFifo = NULL;
|
||||
|
||||
@@ -9,8 +9,8 @@ void JUTPalette::storeTLUT(GXTlut param_0, ResTLUT* tlut) {
|
||||
OSPanic("JUTPalette.cpp", 35, "JUTTexture: TLUT is NULL\n");
|
||||
}
|
||||
mTlutName = param_0;
|
||||
mFormat = tlut->format;
|
||||
mTransparency = tlut->transparency;
|
||||
mFormat = (const u8)tlut->format;
|
||||
mTransparency = (const u8)tlut->transparency;
|
||||
mNumColors = tlut->numColors;
|
||||
mColorTable = (ResTLUT*)((u8*)tlut + 0x20);
|
||||
GXInitTlutObj(&mTlutObj, (void*)mColorTable, (GXTlutFmt)mFormat, mNumColors);
|
||||
|
||||
@@ -81,8 +81,9 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
|
||||
int* param_4) {
|
||||
BOOL var2 = false;
|
||||
float var1 = *param_1;
|
||||
u32 frameDuration = 16666;
|
||||
while (var1 > param_2) {
|
||||
if (param_0 * var1 * 20.0f / 16666.0f <= mParams.mWidth - 30.0f)
|
||||
if (param_0 * var1 * 20.0f / frameDuration <= mParams.mWidth - 30.0f)
|
||||
break;
|
||||
|
||||
var1 -= (1.0f / 10.0f);
|
||||
@@ -98,7 +99,7 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
|
||||
(*param_4)++;
|
||||
if (*param_4 < 0x1e)
|
||||
break;
|
||||
if ((param_0 * var1 * 20.0f / 16666.0f) < (mParams.mWidth - 60.0f))
|
||||
if ((param_0 * var1 * 20.0f / frameDuration) < (mParams.mWidth - 60.0f))
|
||||
var1 += (1.0f / 5.0f);
|
||||
break;
|
||||
}
|
||||
@@ -113,10 +114,13 @@ void JUTProcBar::draw() {
|
||||
void JUTProcBar::drawProcessBar() {
|
||||
if (mVisible) {
|
||||
int frameDuration = 16666; // duration in miliseconds? for how long a frame takes,
|
||||
if (JUTVideo::getManager() && ((JUTVideo::getManager()->getRenderMode()->viTVmode >> 2) &
|
||||
0x0f) == 1) // possibly a define
|
||||
frameDuration = 20000; // duration for PAL
|
||||
|
||||
if (JUTVideo::getManager()) {
|
||||
int viMode = JUTVideo::getManager()->getRenderMode()->viTVmode;
|
||||
int viMode2 = ((viMode >> 2) & 0x0f);
|
||||
if (viMode2 == 1) { // possibly a define
|
||||
frameDuration = 20000; // duration for PAL
|
||||
}
|
||||
}
|
||||
static int cnt = 0;
|
||||
adjustMeterLength(mWholeLoop.mCost, &oneFrameRate, 1.0f, 10.0f, &cnt);
|
||||
int r28 = oneFrameRate * 20.0f;
|
||||
@@ -168,14 +172,15 @@ void JUTProcBar::drawProcessBar() {
|
||||
int r21 = mParams.mPosX + 1;
|
||||
bar_subroutine(r21, r22, r26, r28, frameDuration, gpuTime, -1,
|
||||
JUtility::TColor(80, 255, 80, 255), JUtility::TColor(80, 255, 80, 255));
|
||||
int thingy1 = gpuTime * r28 / frameDuration + r21; // inline or define?
|
||||
J2DFillBox(thingy1, r22, mGpWait.calcBarSize(r28, frameDuration), r26,
|
||||
J2DFillBox((int)(gpuTime * r28 / frameDuration + r21), r22,
|
||||
(int)(mGpWait.mCost * r28 / frameDuration), r26,
|
||||
JUtility::TColor(0, 255, 0, 255));
|
||||
int r30 = mGp.calcBarSize(r28, frameDuration) + r21;
|
||||
int r30 = mGp.mCost * r28 / frameDuration + r21;
|
||||
r21 += totalTime * r28 / frameDuration;
|
||||
r22 += mParams.mBarWidth * 2;
|
||||
bar_subroutine(r21, r22, r26, r28, frameDuration, mCpu.mCost, -1,
|
||||
JUtility::TColor(255, 80, 80, 255), JUtility::TColor(255, 80, 80, 255));
|
||||
r21 += mCpu.mCost * r28 / frameDuration;
|
||||
r22 += mParams.mBarWidth * 2;
|
||||
bar_subroutine(r30, r22, r26, r28, frameDuration, mIdle.mCost, -1,
|
||||
JUtility::TColor(180, 180, 160, 255),
|
||||
@@ -192,6 +197,7 @@ void JUTProcBar::drawProcessBar() {
|
||||
u32 temp3 = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
CTime* time = &mUsers[i];
|
||||
u32 sp17c = time->mCost;
|
||||
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
|
||||
time->field_0x8 = time->mCost;
|
||||
time->field_0xc = 0;
|
||||
@@ -199,7 +205,8 @@ void JUTProcBar::drawProcessBar() {
|
||||
if (time->field_0x8 > temp3)
|
||||
temp3 = time->field_0x8;
|
||||
}
|
||||
if ((bool)temp3 == true) {
|
||||
bool sp11 = temp3 ? true : false;
|
||||
if (sp11 == true) {
|
||||
static int cntUser = 0;
|
||||
adjustMeterLength(temp3, &oneFrameRateUser, 1.0f, 10.0f, &cntUser);
|
||||
int r21 = oneFrameRateUser * 20.0f;
|
||||
@@ -209,6 +216,7 @@ void JUTProcBar::drawProcessBar() {
|
||||
JUtility::TColor(50, 50, 150, 255), 6);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
CTime* time = &mUsers[i];
|
||||
int unsued = time->mCost;
|
||||
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
|
||||
time->field_0x8 = time->mCost;
|
||||
time->field_0xc = 0;
|
||||
|
||||
@@ -90,9 +90,8 @@ void JUTResFont::countBlock() {
|
||||
mMap1BlockNum = 0;
|
||||
|
||||
u8* pData = (u8*)&mResFont->data;
|
||||
for (u32 i = 0; i < mResFont->numBlocks; i++, pData += ((BlockHeader*)pData)->size) {
|
||||
u32 magic = ((BlockHeader*)pData)->magic;
|
||||
switch (magic) {
|
||||
for (u32 i = 0; i < mResFont->numBlocks; i++) {
|
||||
switch (((BlockHeader*)pData)->magic) {
|
||||
case 'WID1':
|
||||
mWid1BlockNum++;
|
||||
break;
|
||||
@@ -107,6 +106,7 @@ void JUTResFont::countBlock() {
|
||||
default:
|
||||
JUTReportConsole("JUTResFont: Unknown data block\n");
|
||||
}
|
||||
pData += ((BlockHeader*)pData)->size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,20 +117,18 @@ IsLeadByte_func const JUTResFont::saoAboutEncoding_[3] = {
|
||||
};
|
||||
|
||||
void JUTResFont::setBlock() {
|
||||
s32 widthNum, glyphNum, mapNum;
|
||||
widthNum = 0;
|
||||
glyphNum = 0;
|
||||
mapNum = 0;
|
||||
s32 widthNum = 0;
|
||||
s32 glyphNum = 0;
|
||||
s32 mapNum = 0;
|
||||
u32 u;
|
||||
mMaxCode = -1;
|
||||
|
||||
BlockHeader* data = (BlockHeader*)mResFont->data;
|
||||
for (u32 i = 0; i < mResFont->numBlocks;
|
||||
data = (BlockHeader*)((u8*)data + data->size), i++) {
|
||||
u32 magic = data->magic;
|
||||
switch (magic) {
|
||||
BlockHeader* data = (BlockHeader*)mResFont->data;
|
||||
for (u32 i = 0; i < mResFont->numBlocks; i++) {
|
||||
switch (data->magic) {
|
||||
case 'INF1': {
|
||||
mInf1Ptr = (ResFONT::INF1*)data;
|
||||
u32 u = mInf1Ptr->fontType;
|
||||
u = mInf1Ptr->fontType;
|
||||
JUT_ASSERT(244, u < suAboutEncoding_);
|
||||
mIsLeadByte = &saoAboutEncoding_[u];
|
||||
break;
|
||||
@@ -158,6 +156,7 @@ void JUTResFont::setBlock() {
|
||||
JUTReportConsole("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
data = (BlockHeader*)(((Ptr)data) + data->size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,8 +213,8 @@ void JUTResFont::setGX(JUtility::TColor col1, JUtility::TColor col2) {
|
||||
f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, int str_int,
|
||||
bool flag) {
|
||||
f32 x1;
|
||||
f32 y1;
|
||||
f32 x2;
|
||||
f32 y1;
|
||||
|
||||
JUT_ASSERT(378, mValid);
|
||||
JUTFont::TWidth width;
|
||||
@@ -339,48 +338,44 @@ int JUTResFont::getFontCode(int chr) const {
|
||||
|
||||
int ret = mInf1Ptr->defaultCode;
|
||||
if ((getFontType() == 2) && (mMaxCode >= 0x8000U) && (chr >= 0x20) && (chr < 0x7FU)) {
|
||||
chr = halftofull[chr - 32];
|
||||
chr = (halftofull - 0x20)[chr];
|
||||
}
|
||||
for (int i = 0; i < mMap1BlockNum; i++) {
|
||||
u16 sc = mpMapBlocks[i]->startCode;
|
||||
u16 ec = mpMapBlocks[i]->endCode;
|
||||
u16 mm = mpMapBlocks[i]->mappingMethod;
|
||||
if ((sc <= chr) && (chr <= ec)) {
|
||||
if (mm == 0) {
|
||||
ret = chr - sc;
|
||||
break;
|
||||
} else if (mm == 2) {
|
||||
if ((mpMapBlocks[i]->startCode <= chr) && (chr <= mpMapBlocks[i]->endCode)) {
|
||||
if (mpMapBlocks[i]->mappingMethod == 0) {
|
||||
ret = chr - mpMapBlocks[i]->startCode;
|
||||
} else if (mpMapBlocks[i]->mappingMethod == 2) {
|
||||
BE(u16)* leading_temp = &mpMapBlocks[i]->mLeading;
|
||||
ret = leading_temp[chr - sc];
|
||||
break;
|
||||
} else if (mm == 3) {
|
||||
BE(u16)* leading_temp = &mpMapBlocks[i]->mLeading;
|
||||
int phi_r5 = 0;
|
||||
int phi_r6_2 = mpMapBlocks[i]->numEntries - 1;
|
||||
ret = leading_temp[chr - mpMapBlocks[i]->startCode];
|
||||
} else if (mpMapBlocks[i]->mappingMethod == 3) {
|
||||
// invented struct to help match debug, unsure of real struct
|
||||
struct paired_u16 {
|
||||
BE(u16) fullChar;
|
||||
BE(u16) fontCode;
|
||||
};
|
||||
|
||||
while (phi_r6_2 >= phi_r5) {
|
||||
int temp_r7 = (phi_r6_2 + phi_r5) / 2;
|
||||
paired_u16* leading_temp = (paired_u16*)&mpMapBlocks[i]->mLeading;
|
||||
int binarySearchMin = 0;
|
||||
int binarySearchMax = mpMapBlocks[i]->numEntries - 1;
|
||||
|
||||
if (chr < leading_temp[temp_r7 * 2]) {
|
||||
phi_r6_2 = temp_r7 - 1;
|
||||
continue;
|
||||
while (binarySearchMax >= binarySearchMin) {
|
||||
int midIndex = (binarySearchMax + binarySearchMin) / 2;
|
||||
|
||||
if (chr < leading_temp[midIndex].fullChar) {
|
||||
binarySearchMax = midIndex - 1;
|
||||
} else if (chr > leading_temp[midIndex].fullChar) {
|
||||
binarySearchMin = midIndex + 1;
|
||||
} else {
|
||||
ret = leading_temp[midIndex].fontCode;
|
||||
break;
|
||||
}
|
||||
|
||||
if (chr > leading_temp[temp_r7 * 2]) {
|
||||
phi_r5 = temp_r7 + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = leading_temp[temp_r7 * 2 + 1];
|
||||
break;
|
||||
}
|
||||
} else if (mm == 1) {
|
||||
} else if (mpMapBlocks[i]->mappingMethod == 1) {
|
||||
BE(u16)* phi_r5_2 = NULL;
|
||||
if (mpMapBlocks[i]->numEntries == 1) {
|
||||
phi_r5_2 = &mpMapBlocks[i]->mLeading;
|
||||
}
|
||||
ret = convertSjis(chr, phi_r5_2);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -421,8 +416,10 @@ void JUTResFont::loadImage(int code, GXTexMapID id){
|
||||
|
||||
if (pageIdx != mTexPageIdx || i != field_0x66)
|
||||
{
|
||||
GXInitTexObj(&mTexObj, &mpGlyphBlocks[i]->data[pageIdx * texSize], texW,
|
||||
texH, (GXTexFmt)texFmt, GX_CLAMP, GX_CLAMP, 0);
|
||||
void* pImg = &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize];
|
||||
GXInitTexObj(&mTexObj, pImg, mpGlyphBlocks[i]->textureWidth,
|
||||
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)(u16)mpGlyphBlocks[i]->textureFormat,
|
||||
GX_CLAMP, GX_CLAMP, 0);
|
||||
|
||||
GXInitTexObjLOD(&mTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0U, 0U, GX_ANISO_1);
|
||||
mTexPageIdx = pageIdx;
|
||||
|
||||
@@ -19,11 +19,12 @@ void* JUTResReference::getResource(JSUInputStream* stream, u32 resType, JKRArchi
|
||||
|
||||
|
||||
void* JUTResReference::getResource(const void* data, u32 resType, JKRArchive* archive) {
|
||||
mType = *(u8*)data;
|
||||
mNameLength = *((u8*)data + 1);
|
||||
const u8* pData = (const u8*)data;
|
||||
mType = pData[0];
|
||||
mNameLength = pData[1];
|
||||
|
||||
if (mNameLength != 0) {
|
||||
memcpy(&mName, &((u8*)data)[2], mNameLength);
|
||||
memcpy(&mName, &pData[2], mNameLength);
|
||||
}
|
||||
|
||||
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
|
||||
|
||||
@@ -139,12 +139,7 @@ void JUTTexture::init() {
|
||||
}
|
||||
|
||||
void JUTTexture::initTexObj() {
|
||||
GXBool mipmapEnabled;
|
||||
if (mTexInfo->mipmapEnabled != 0) {
|
||||
mipmapEnabled = 1;
|
||||
} else {
|
||||
mipmapEnabled = 0;
|
||||
}
|
||||
GXBool mipmapEnabled = mTexInfo->mipmapEnabled != 0 ? GX_TRUE : GX_FALSE;
|
||||
u8* image = ((u8*)mTexInfo);
|
||||
u32 imgOffset = RES_U32(mTexInfo->imageOffset);
|
||||
image += (imgOffset ? imgOffset : 0x20);
|
||||
@@ -157,12 +152,7 @@ void JUTTexture::initTexObj() {
|
||||
}
|
||||
|
||||
void JUTTexture::initTexObj(GXTlut param_0) {
|
||||
GXBool mipmapEnabled;
|
||||
if (mTexInfo->mipmapEnabled != 0) {
|
||||
mipmapEnabled = 1;
|
||||
} else {
|
||||
mipmapEnabled = 0;
|
||||
}
|
||||
GXBool mipmapEnabled = mTexInfo->mipmapEnabled != 0 ? GX_TRUE : GX_FALSE;
|
||||
mTlutName = param_0;
|
||||
u8* image = ((u8*)mTexInfo);
|
||||
u32 imgOffset = RES_U32(mTexInfo->imageOffset); // Swap!
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
#include "NdevExi2A/DebuggerDriver.h"
|
||||
|
||||
#include "NdevExi2A/exi2.h"
|
||||
#include <dolphin/exi.h>
|
||||
#include <dolphin/os.h>
|
||||
|
||||
static s32 __DBRecvDataSize;
|
||||
static u32 __DBRecvMail;
|
||||
|
||||
static u8 EXIInputFlag;
|
||||
|
||||
static MtrCallback __DBDbgCallback;
|
||||
static MtrCallback __DBMtrCallback;
|
||||
|
||||
static u8 SendCount = 0x80;
|
||||
|
||||
#define IS_TRUE(x) ((x) != FALSE)
|
||||
#define IS_FALSE(x) !IS_TRUE(x)
|
||||
#define ROUND_UP(x, align) (((x) + (align)-1) & (-(align)))
|
||||
|
||||
void __DBMtrHandler(s32 param_0, OSContext* ctx) {
|
||||
EXIInputFlag = 1;
|
||||
if (__DBMtrCallback != (void*)NULL) {
|
||||
__DBMtrCallback(0, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void __DBIntrHandler(s16 param_0, OSContext* ctx) {
|
||||
*__PIRegs = 0x1000;
|
||||
if (__DBDbgCallback != NULL) {
|
||||
__DBDbgCallback(param_0, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void __DBCheckMailBox(void) {
|
||||
u8 sp08;
|
||||
u32 mail;
|
||||
sp08 = __DBReadUSB_CSR();
|
||||
if (!(sp08 & 0x8)) {
|
||||
__DBReadMailbox(&mail);
|
||||
|
||||
if (ODEMUIsValidMail(mail)) {
|
||||
__DBRecvMail = mail;
|
||||
__DBRecvDataSize = ODEMUGetSize(mail);
|
||||
EXIInputFlag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u8 __DBReadUSB_CSR() {
|
||||
u8 result;
|
||||
__DBEXIReadReg(0x34000000, &result, 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
void DBInitComm(u8** a, MtrCallback callback) {
|
||||
BOOL interrupts = OSDisableInterrupts();
|
||||
|
||||
//pEXIInputFlag = &EXIInputFlag;
|
||||
*a = &EXIInputFlag;
|
||||
__DBMtrCallback = callback;
|
||||
__DBEXIInit();
|
||||
|
||||
OSRestoreInterrupts(interrupts);
|
||||
}
|
||||
|
||||
void DBInitInterrupts(void) {
|
||||
__OSMaskInterrupts(0x18000);
|
||||
__OSMaskInterrupts(0x40);
|
||||
__DBDbgCallback = &__DBMtrHandler;
|
||||
__OSSetInterruptHandler(0x19, __DBIntrHandler);
|
||||
__OSUnmaskInterrupts(0x40);
|
||||
}
|
||||
|
||||
u32 DBQueryData(void) {
|
||||
BOOL interrupts;
|
||||
EXIInputFlag = 0;
|
||||
if (__DBRecvDataSize == 0) {
|
||||
interrupts = OSDisableInterrupts();
|
||||
__DBCheckMailBox();
|
||||
OSRestoreInterrupts(interrupts);
|
||||
}
|
||||
return __DBRecvDataSize;
|
||||
}
|
||||
|
||||
BOOL DBRead(u32* buffer, s32 count) {
|
||||
u32 v;
|
||||
u32 interrupts = OSDisableInterrupts();
|
||||
v = ODEMUGetPc2NngcOffset(__DBRecvMail) + 0x1000;
|
||||
|
||||
__DBRead(v, buffer, ROUND_UP(count, 4));
|
||||
|
||||
__DBRecvDataSize = 0;
|
||||
EXIInputFlag = 0;
|
||||
|
||||
OSRestoreInterrupts(interrupts);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL DBWrite(void* src, u32 size) {
|
||||
BOOL interrupts;
|
||||
u32 v;
|
||||
u32 mail;
|
||||
|
||||
interrupts = OSDisableInterrupts();
|
||||
|
||||
__DBWaitForSendMail();
|
||||
|
||||
SendCount++;
|
||||
v = (SendCount & 0x1) ? 0x800 : 0;
|
||||
|
||||
while (!__DBWrite(v, src, ROUND_UP(size, 4)))
|
||||
;
|
||||
|
||||
__DBWaitForSendMail();
|
||||
|
||||
mail = ODEMUGenMailData(SendCount, size);
|
||||
while (!__DBWriteMailbox(mail))
|
||||
;
|
||||
|
||||
__DBWaitForSendMail();
|
||||
|
||||
OSRestoreInterrupts(interrupts);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __DBWaitForSendMail() {
|
||||
u8 busyFlag;
|
||||
do {
|
||||
busyFlag = __DBReadUSB_CSR();
|
||||
} while (busyFlag & 0x4);
|
||||
}
|
||||
|
||||
void DBOpen(void) {}
|
||||
|
||||
void DBClose(void) {}
|
||||
|
||||
static u32 ODEMUGetSize(u32 mail) {
|
||||
return mail & 0x1FFF;
|
||||
}
|
||||
|
||||
BOOL ODEMUIsValidMail(u32 mail) {
|
||||
return (mail & 0x1F000000) == 0x1F000000;
|
||||
}
|
||||
|
||||
u32 ODEMUGetPc2NngcOffset(u32 v) {
|
||||
return ODEMUGetPage(v) & 0x1 ? 0x800 : 0;
|
||||
}
|
||||
|
||||
u32 ODEMUGetPage(u32 v) {
|
||||
return (v & 0xFF0000) >> 16;
|
||||
}
|
||||
|
||||
u32 ODEMUGenMailData(u32 v, u32 size) {
|
||||
return (0x1f000000 | ((v << 16) & 0xFF0000)) | (size & 0x1FFF);
|
||||
}
|
||||
|
||||
void __DBReadMailbox(u32* out) {
|
||||
__DBEXIReadReg(0x34000200, out, 4);
|
||||
}
|
||||
|
||||
BOOL __DBRead(u32 param_0, void* dst, u32 count) {
|
||||
return __DBEXIReadRam(((param_0 + 0xD10000) << 6) & 0x3FFFFF00, dst, count);
|
||||
}
|
||||
|
||||
BOOL __DBWriteMailbox(u32 val) {
|
||||
return __DBEXIWriteReg(0xB4000100, &val, 0x4);
|
||||
}
|
||||
|
||||
BOOL __DBWrite(u32 param_0, void* dst, u32 count) {
|
||||
return __DBEXIWriteRam((((param_0 + 0xD10000) << 6) & 0x3FFFFF00) | 0x80000000, dst, count);
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
#include "NdevExi2A/exi2.h"
|
||||
|
||||
#include <revolution/os.h>
|
||||
|
||||
#define IS_TRUE(x) ((x) != FALSE)
|
||||
#define IS_FALSE(x) !IS_TRUE(x)
|
||||
#define ROUND_UP(x, align) (((x) + (align)-1) & (-(align)))
|
||||
|
||||
BOOL __EXI2Select() {
|
||||
u32 regs = __EXIRegs[10];
|
||||
regs &= 0x405;
|
||||
regs |= 0xC0;
|
||||
__EXIRegs[10] = regs;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL __EXI2Deselect() {
|
||||
u32 regs = __EXIRegs[10];
|
||||
__EXIRegs[10] = regs & 0x405;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL __EXI2Sync() {
|
||||
while (__EXIRegs[13] & 0x1) {
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL __EXI2Imm(u32* param_0, int width, int param_2) {
|
||||
int i1; // r31
|
||||
int i2; // r30
|
||||
u32 var_r29;
|
||||
u8* var_r28;
|
||||
u32 var_r25;
|
||||
|
||||
if (param_2 != 0) {
|
||||
var_r29 = 0;
|
||||
for (i1 = 0; i1 < width; i1++) {
|
||||
var_r29 |= ((u8*)param_0)[i1] << ((3 - i1) << 3);
|
||||
}
|
||||
__EXIRegs[14] = var_r29;
|
||||
}
|
||||
|
||||
__EXIRegs[13] = 0x1 | (param_2 << 2) | ((width - 1) << 4);
|
||||
__EXI2Sync();
|
||||
|
||||
if (param_2 == 0) {
|
||||
var_r28 = (u8*)param_0;
|
||||
var_r25 = __EXIRegs[14];
|
||||
for (i2 = 0; i2 < width; i2++) {
|
||||
*var_r28 = var_r25 >> ((3 - i2) << 3);
|
||||
var_r28++;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void __DBEXIInit() {
|
||||
u8 sp08;
|
||||
|
||||
__OSMaskInterrupts(0x18000);
|
||||
|
||||
while ((__EXIRegs[13] & 0x1) == 0x1) {
|
||||
};
|
||||
|
||||
__EXIRegs[10] = 0;
|
||||
sp08 = 0xD4;
|
||||
__DBEXIWriteReg(0xB4000000, &sp08, 1);
|
||||
}
|
||||
|
||||
BOOL __DBEXIReadReg(u32 param_0, void* dst, u32 param_2) {
|
||||
int is_failed = FALSE;
|
||||
u32 val = 0;
|
||||
|
||||
is_failed |= IS_FALSE(__EXI2Select());
|
||||
is_failed |= IS_FALSE(__EXI2Imm(¶m_0, 4, 1));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
is_failed |= IS_FALSE(__EXI2Imm(&val, 4, 0));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
is_failed |= IS_FALSE(__EXI2Deselect());
|
||||
|
||||
switch (param_2) {
|
||||
case 1:
|
||||
*(u8*)dst = val >> 24;
|
||||
break;
|
||||
case 2:
|
||||
*(u16*)dst = (val >> 24) | ((val >> 8) & 0xff00);
|
||||
break;
|
||||
default:
|
||||
*(u32*)dst = __EXISwap32(val);
|
||||
break;
|
||||
}
|
||||
return IS_FALSE(is_failed);
|
||||
}
|
||||
|
||||
BOOL __DBEXIWriteReg(u32 param_0, void* src, u32 width) {
|
||||
int is_failed = FALSE;
|
||||
u32 val;
|
||||
|
||||
switch (width) {
|
||||
case 1:
|
||||
val = (*(u8*)src & 0xFF) << 24;
|
||||
break;
|
||||
case 2:
|
||||
val = ((*(u16*)src & 0xFF) << 24) | ((*(u16*)src & 0xff00) << 8);
|
||||
break;
|
||||
default:
|
||||
val = __EXISwap32(*(u32*)src);
|
||||
break;
|
||||
}
|
||||
|
||||
is_failed |= IS_FALSE(__EXI2Select());
|
||||
is_failed |= IS_FALSE(__EXI2Imm(¶m_0, 4, 1));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
is_failed |= IS_FALSE(__EXI2Imm(&val, 4, 1));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
is_failed |= IS_FALSE(__EXI2Deselect());
|
||||
|
||||
return IS_FALSE(is_failed);
|
||||
}
|
||||
|
||||
BOOL __DBEXIReadRam(u32 param_0, void* dst, int count) {
|
||||
int is_failed = FALSE;
|
||||
u32 cur_val;
|
||||
u32* cursor = (u32*)dst;
|
||||
|
||||
is_failed |= IS_FALSE(__EXI2Select());
|
||||
is_failed |= IS_FALSE(__EXI2Imm(¶m_0, 4, 1));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
|
||||
while (count > 0) {
|
||||
is_failed |= IS_FALSE(__EXI2Imm(&cur_val, 4, 0));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
*cursor++ = cur_val;
|
||||
count -= 4;
|
||||
}
|
||||
|
||||
is_failed |= IS_FALSE(__EXI2Deselect());
|
||||
|
||||
return IS_FALSE(is_failed);
|
||||
}
|
||||
|
||||
BOOL __DBEXIWriteRam(u32 param_0, void* src, int count) {
|
||||
int is_failed = FALSE;
|
||||
u32 cur_val;
|
||||
u32* cursor = (u32*)src;
|
||||
|
||||
is_failed |= IS_FALSE(__EXI2Select());
|
||||
is_failed |= IS_FALSE(__EXI2Imm(¶m_0, 4, 1));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
|
||||
while (count > 0) {
|
||||
cur_val = *cursor++;
|
||||
is_failed |= IS_FALSE(__EXI2Imm(&cur_val, 4, 1));
|
||||
is_failed |= IS_FALSE(__EXI2Sync());
|
||||
count -= 4;
|
||||
}
|
||||
|
||||
is_failed |= IS_FALSE(__EXI2Deselect());
|
||||
|
||||
return IS_FALSE(is_failed);
|
||||
}
|
||||
|
||||
u32 __EXISwap32(u32 v) {
|
||||
return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000);
|
||||
}
|
||||
@@ -6,6 +6,21 @@ namespace std {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define INT8_MAX (0x7F)
|
||||
# define INT16_MAX (0x7FFF)
|
||||
# define INT32_MAX (0x7FFFFFFF)
|
||||
# define INT64_MAX (0x7FFFFFFFFFFFFFFFLL)
|
||||
|
||||
# define INT8_MIN (-INT8_MAX-1)
|
||||
# define INT16_MIN (-INT16_MAX-1)
|
||||
# define INT32_MIN (-INT632_MAX-1)
|
||||
# define INT64_MIN (-INT64_MAX-1)
|
||||
|
||||
# define UINT8_MAX (0xFFU)
|
||||
# define UINT16_MAX (0xFFFFU)
|
||||
# define UINT32_MAX (0xFFFFFFFFU)
|
||||
# define UINT64_MAX (0xFFFFFFFFFFFFFFFFULL)
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
|
||||
@@ -99,7 +99,7 @@ int __fpclassifyl(long double __value);
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MAX_10_EXP 38
|
||||
|
||||
#if DEBUG || defined(_MSVC_LANG)
|
||||
#if !PLATFORM_GCN
|
||||
#define FLT_MAX 3.4028235e38f
|
||||
#define FLT_EPSILON 1.1920929e-7f
|
||||
#else
|
||||
|
||||
@@ -9,9 +9,15 @@ extern "C" {
|
||||
|
||||
size_t wcstombs(char* dst, const wchar_t* src, size_t n);
|
||||
|
||||
int mbtowc(wchar_t* pwc, const char* s, size_t n);
|
||||
int mbstowcs(wchar_t* param_0, const char* param_1, int param_2);
|
||||
|
||||
int __mbtowc_noconv(wchar_t*, const char*, size_t);
|
||||
int __wctomb_noconv(char*, wchar_t);
|
||||
|
||||
int mbsrtowcs_s(size_t* retval, wchar_t* dst, unsigned int dstsz, const char** param_4, size_t len,
|
||||
int param_6);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@ int fprintf(FILE* stream, const char* format, ...);
|
||||
int printf(const char* format, ...);
|
||||
int sprintf(char* s, const char* format, ...);
|
||||
int snprintf(char* s, size_t n, const char* format, ...);
|
||||
int vsnprintf(char* s, size_t n, const char* format, va_list arg);
|
||||
int vsnprintf(char* s, size_t n, const char* fmt, va_list args);
|
||||
int vsprintf(char* s, const char* format, va_list arg);
|
||||
int vprintf(const char* format, va_list arg);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef _MSL_COMMON_WCSTOUL_H
|
||||
#define _MSL_COMMON_WCSTOUL_H
|
||||
|
||||
#include <wstring.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
size_t wcstoul(wchar_t* param_1, wchar_t** param_2, int param_3);
|
||||
|
||||
size_t wcstol(wchar_t* param_1, wchar_t** param_2, int param_3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MSL_COMMON_WCSTOUL_H */
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef _MSL_COMMON_WMEM_H
|
||||
#define _MSL_COMMON_WMEM_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void wmemcpy(wchar_t* dst, const wchar_t* src, size_t n);
|
||||
|
||||
const wchar_t* wmemchr(const wchar_t* str, wchar_t needle, int max_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MSL_COMMON_WMEM_H */
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef _MSL_COMMON_WPRINTF_H
|
||||
#define _MSL_COMMON_WPRINTF_H
|
||||
|
||||
#include <wstring.h>
|
||||
#include <cstddef>
|
||||
#include <cstdarg>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int swprintf(wchar_t *dst, size_t maxlen, const wchar_t *fmt, ...);
|
||||
|
||||
int vsnwprintf_s(wchar_t* str, size_t n, const wchar_t* fmt, va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MSL_COMMON_WPRINTF_H */
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef _MSL_COMMON_WSCANF_H
|
||||
#define _MSL_COMMON_WSCANF_H
|
||||
|
||||
#include <wstring.h>
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
wchar_t* WCharStr;
|
||||
size_t MaxCharCount;
|
||||
size_t CharsWritten;
|
||||
} __OutStrCtrl;
|
||||
|
||||
wchar_t __wStringRead(wString* src, wchar_t param_1, wchar_t param_2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MSL_COMMON_WSCANF_H */
|
||||
@@ -7,6 +7,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct wString {
|
||||
wchar_t* buffer;
|
||||
size_t field_0x4;
|
||||
size_t field_0x8;
|
||||
} wString;
|
||||
|
||||
size_t wcslen(const wchar_t*);
|
||||
wchar_t* wcscpy(wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
|
||||
|
||||
@@ -2,8 +2,124 @@
|
||||
#include <cstring>
|
||||
#include <locale>
|
||||
|
||||
#include "errno.h"
|
||||
#include "global.h"
|
||||
|
||||
extern void __msl_runtime_constraint_violation_s(const char* msg, void* ptr, int error);
|
||||
|
||||
static unsigned int is_utf8_complete(const char* buf, unsigned int len) {
|
||||
char start_byte;
|
||||
int checked_cnt;
|
||||
int conts;
|
||||
int rem_conts;
|
||||
|
||||
if (len == 0) {
|
||||
return -1;
|
||||
}
|
||||
start_byte = buf[0];
|
||||
if (start_byte == 0) {
|
||||
return 0;
|
||||
}
|
||||
if ((start_byte & 0x80) == 0) {
|
||||
return 1;
|
||||
}
|
||||
if ((start_byte & 0xe0) == 0xc0) {
|
||||
conts = 1;
|
||||
} else if ((start_byte & 0xf0) == 0xe0) {
|
||||
conts = 2;
|
||||
} else if ((start_byte & 0xf8) == 0xf0) {
|
||||
conts = 3;
|
||||
} else if ((start_byte & 0xfc) == 0xf8) {
|
||||
conts = 4;
|
||||
} else if ((start_byte & 0xfe) == 0xfc) {
|
||||
conts = 5;
|
||||
} else {
|
||||
return 0xffffffff;
|
||||
}
|
||||
checked_cnt = 0;
|
||||
for (rem_conts = conts; rem_conts > 0; rem_conts--) {
|
||||
if ((buf[checked_cnt + 1] & 0xc0) != 0x80) {
|
||||
return 0xffffffff;
|
||||
}
|
||||
checked_cnt++;
|
||||
}
|
||||
if (len >= checked_cnt + 1U) {
|
||||
return conts + 1;
|
||||
}
|
||||
return 0xfffffffe;
|
||||
}
|
||||
|
||||
static int __utf8_to_unicode(wchar_t* dst, const char* src, unsigned int len) {
|
||||
short byte_cnt;
|
||||
int remaining;
|
||||
int codepoint;
|
||||
|
||||
codepoint = 0;
|
||||
if (src == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
byte_cnt = is_utf8_complete(src, len);
|
||||
if (byte_cnt < 0) {
|
||||
return -1;
|
||||
}
|
||||
switch (byte_cnt) {
|
||||
case 6:
|
||||
codepoint = *src & ((1 << 2) - 1);
|
||||
break;
|
||||
case 5:
|
||||
codepoint = *src & ((1 << 3) - 1);
|
||||
break;
|
||||
case 4:
|
||||
codepoint = *src & ((1 << 4) - 1);
|
||||
break;
|
||||
case 3:
|
||||
codepoint = *src & ((1 << 5) - 1);
|
||||
break;
|
||||
case 2:
|
||||
codepoint = *src & ((1 << 6) - 1);
|
||||
break;
|
||||
case 1:
|
||||
codepoint = *src;
|
||||
break;
|
||||
}
|
||||
|
||||
for (remaining = byte_cnt - 1; remaining > 0; remaining--) {
|
||||
codepoint <<= 6;
|
||||
codepoint |= *++src & 0x7f;
|
||||
}
|
||||
|
||||
if (codepoint == 0) {
|
||||
remaining = 0;
|
||||
} else if (codepoint < 0 || codepoint < 0x80) {
|
||||
remaining = 1;
|
||||
} else if (codepoint < 0x800) {
|
||||
remaining = 2;
|
||||
} else if (codepoint < 0x10000) {
|
||||
remaining = 3;
|
||||
} else if (codepoint < 0x200000) {
|
||||
remaining = 4;
|
||||
} else if (codepoint < 0x4000000) {
|
||||
remaining = 5;
|
||||
} else {
|
||||
remaining = 6;
|
||||
}
|
||||
|
||||
if (remaining != byte_cnt) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dst != NULL) {
|
||||
*dst = codepoint;
|
||||
}
|
||||
|
||||
return byte_cnt;
|
||||
}
|
||||
|
||||
#if !PLATFORM_GCN
|
||||
int mbtowc(wchar_t* pwc, const char* s, size_t n) {
|
||||
return _current_locale.ctype_cmpt_ptr->decode_mb(pwc, s, n);
|
||||
@@ -67,6 +183,32 @@ int __wctomb_noconv(char* s, wchar_t wchar) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int mbstowcs(wchar_t* param_0, const char* param_1, int param_2) {
|
||||
unsigned int i;
|
||||
int decoded_cnt;
|
||||
int remaining = strlen(param_1);
|
||||
if (param_0 != NULL) {
|
||||
for (i = 0; i < param_2; i++) {
|
||||
if (param_1[0] != '\0') {
|
||||
decoded_cnt =
|
||||
_current_locale.ctype_cmpt_ptr->decode_mb(param_0++, param_1, remaining);
|
||||
if (decoded_cnt > 0) {
|
||||
param_1 += decoded_cnt;
|
||||
remaining -= decoded_cnt;
|
||||
continue;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
param_0[0] = L'\0';
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int wctomb(char* s, wchar_t wchar) {
|
||||
#if PLATFORM_GCN
|
||||
return (unicode_to_UTF8(s, wchar));
|
||||
@@ -101,3 +243,67 @@ size_t wcstombs(char* s, const wchar_t* pwcs, size_t n) {
|
||||
|
||||
return chars_written;
|
||||
}
|
||||
|
||||
int mbsrtowcs_s(size_t* retval, wchar_t* dst, unsigned int dstsz, const char** param_4,
|
||||
size_t len, int param_6) {
|
||||
wchar_t* var_r27;
|
||||
const char* var_r24;
|
||||
unsigned int var_r25;
|
||||
int var_r26;
|
||||
wchar_t sp08[4];
|
||||
|
||||
if (retval == NULL || param_4 == NULL || *param_4 == NULL || param_6 == 0 ||
|
||||
(dst != NULL && (len > 0x7fffffff || dstsz > 0x7fffffff || dstsz < len)))
|
||||
{
|
||||
__msl_runtime_constraint_violation_s(NULL, NULL, 0x22);
|
||||
if (retval != NULL) {
|
||||
*retval = 0xffffffff;
|
||||
}
|
||||
return 0x22;
|
||||
}
|
||||
|
||||
var_r24 = *param_4;
|
||||
var_r26 = strlen(var_r24);
|
||||
for (var_r25 = 0; var_r25 < len; var_r25++) {
|
||||
if (*var_r24 != '\0') {
|
||||
int var_r3_1;
|
||||
|
||||
if (dst == NULL) {
|
||||
var_r27 = sp08;
|
||||
} else {
|
||||
var_r27 = dst++;
|
||||
}
|
||||
|
||||
if (var_r24 != NULL) {
|
||||
var_r3_1 = is_utf8_complete(var_r24, var_r26);
|
||||
if (var_r3_1 < 0xfffffffe) {
|
||||
if (var_r27 != NULL) {
|
||||
var_r3_1 = __utf8_to_unicode(var_r27, var_r24, var_r26);
|
||||
} else if (var_r3_1 == 0xffffffff) {
|
||||
errno = 0x58;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (var_r27 != NULL) {
|
||||
*var_r27 = L'\0';
|
||||
}
|
||||
var_r3_1 = 0;
|
||||
}
|
||||
|
||||
if (var_r3_1 <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
var_r24 += var_r3_1;
|
||||
var_r26 -= var_r3_1;
|
||||
} else {
|
||||
if (dst != NULL) {
|
||||
*dst = 0;
|
||||
*param_4 = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
*retval = var_r25;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1550,7 +1550,7 @@ int vprintf(const char* format, va_list arg) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int vsnprintf(char* s, size_t n, const char* format, va_list arg) {
|
||||
int vsnprintf(char* s, size_t n, const char* fmt, va_list args) {
|
||||
int end;
|
||||
__OutStrCtrl osc;
|
||||
osc.CharStr = s;
|
||||
@@ -1558,9 +1558,9 @@ int vsnprintf(char* s, size_t n, const char* format, va_list arg) {
|
||||
osc.CharsWritten = 0;
|
||||
|
||||
#if PLATFORM_GCN
|
||||
end = __pformatter(&__StringWrite, &osc, format, arg);
|
||||
end = __pformatter(&__StringWrite, &osc, fmt, args);
|
||||
#else
|
||||
end = __pformatter(&__StringWrite, &osc, format, arg, 0);
|
||||
end = __pformatter(&__StringWrite, &osc, fmt, args, 0);
|
||||
#endif
|
||||
|
||||
if (s) {
|
||||
|
||||
@@ -72,7 +72,7 @@ unsigned long __strtoul(int base, int max_width, int (*ReadProc)(void*, int, int
|
||||
scan_state = need_digit;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case leading_zero:
|
||||
if (c == 'X' || c == 'x') {
|
||||
base = 16;
|
||||
scan_state = need_digit;
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
#include <wcstoul.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <wctype_api.h>
|
||||
#include <wscanf.h>
|
||||
#include <climits>
|
||||
#include <locale>
|
||||
|
||||
enum scan_states {
|
||||
start = 0x01,
|
||||
check_for_zero = 0x02,
|
||||
leading_zero = 0x04,
|
||||
need_digit = 0x08,
|
||||
digit_loop = 0x10,
|
||||
finished = 0x20,
|
||||
failure = 0x40
|
||||
};
|
||||
|
||||
#define final_state(scan_state) (scan_state & (finished | failure))
|
||||
#define success(scan_state) (scan_state & (leading_zero | digit_loop | finished))
|
||||
#define fetch() (count++, (*read_proc)(read_proc_arg, 0, 0))
|
||||
|
||||
static size_t __wcstoul(int base, int max_width,
|
||||
wchar_t (*read_proc)(wString* src, wchar_t param_1, wchar_t param_2),
|
||||
void* read_proc_arg, int* chars_scanned, int* negative, int* overflow) {
|
||||
int scan_state;
|
||||
int count;
|
||||
int spaces;
|
||||
unsigned int value;
|
||||
unsigned int value_max;
|
||||
wchar_t c;
|
||||
|
||||
count = 0;
|
||||
scan_state = 1;
|
||||
spaces = 0;
|
||||
value = 0;
|
||||
value_max = 0;
|
||||
|
||||
*negative = *overflow = 0;
|
||||
|
||||
if (base < 0 || base == 1 || base > 36 || max_width < 1) {
|
||||
scan_state = failure;
|
||||
} else {
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
if (base != 0) {
|
||||
value_max = ULONG_MAX / base;
|
||||
}
|
||||
|
||||
// NOTE: c is uninitialized if the parameter validation above fails. In practice, this doesn't
|
||||
// matter because the third condition will always fail in this scenario anyway.
|
||||
while (count <= max_width && c != -1 && !final_state(scan_state)) {
|
||||
switch (scan_state) {
|
||||
case start:
|
||||
if (c >= 0x100 ?
|
||||
0 :
|
||||
_current_locale.ctype_cmpt_ptr->wctype_map_ptr[c] & wctype_space) {
|
||||
c = read_proc(read_proc_arg, 0, 0);
|
||||
spaces++;
|
||||
} else {
|
||||
if (c == L'+') {
|
||||
c = fetch();
|
||||
} else if (c == L'-') {
|
||||
c = fetch();
|
||||
*negative = 1;
|
||||
}
|
||||
scan_state = check_for_zero;
|
||||
}
|
||||
break;
|
||||
case check_for_zero:
|
||||
if ((base == 0 || base == 16) && c == L'0') {
|
||||
scan_state = leading_zero;
|
||||
c = fetch();
|
||||
} else {
|
||||
scan_state = need_digit;
|
||||
}
|
||||
break;
|
||||
case leading_zero:
|
||||
if (c == L'X' || c == L'x') {
|
||||
base = 16;
|
||||
scan_state = need_digit;
|
||||
c = fetch();
|
||||
} else {
|
||||
if (base == 0) {
|
||||
base = 8;
|
||||
}
|
||||
scan_state = digit_loop;
|
||||
}
|
||||
break;
|
||||
case need_digit:
|
||||
case digit_loop:
|
||||
if (base == 0) {
|
||||
base = 10;
|
||||
}
|
||||
|
||||
if (value_max == 0) {
|
||||
value_max = ULONG_MAX / base;
|
||||
}
|
||||
|
||||
if (c >= 0x100 ? 0 : _current_locale.ctype_cmpt_ptr->wctype_map_ptr[c] & wctype_digit) {
|
||||
c -= L'0';
|
||||
if (c >= base) {
|
||||
if (scan_state == digit_loop) {
|
||||
scan_state = finished;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
c += L'0';
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
int temp;
|
||||
if (!(c >= 0x100 ?
|
||||
0 :
|
||||
_current_locale.ctype_cmpt_ptr->wctype_map_ptr[c] & wctype_alpha)) {
|
||||
goto label;
|
||||
}
|
||||
|
||||
temp = 1;
|
||||
if (c <= 0xFF) {
|
||||
temp = 0;
|
||||
}
|
||||
if ((temp ? c :
|
||||
_current_locale.ctype_cmpt_ptr->upper_map_ptr[c]) -
|
||||
0x37 >=
|
||||
base) {
|
||||
label:
|
||||
if (scan_state == digit_loop) {
|
||||
scan_state = finished;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
c = (wchar_t)(c >= 0x100 ?
|
||||
c :
|
||||
_current_locale.ctype_cmpt_ptr->wupper_map_ptr[c]) -
|
||||
0x37;
|
||||
}
|
||||
}
|
||||
|
||||
if (value > value_max) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
value *= base;
|
||||
if (c > ULONG_MAX - value) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
scan_state = digit_loop;
|
||||
value += c;
|
||||
c = fetch();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!success(scan_state)) {
|
||||
value = 0;
|
||||
*chars_scanned = 0;
|
||||
} else {
|
||||
*chars_scanned = count + spaces - 1;
|
||||
}
|
||||
|
||||
read_proc(read_proc_arg, c, 1);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
size_t wcstoul(wchar_t* param_1, wchar_t** param_2, int param_3) {
|
||||
wString sp18;
|
||||
size_t retval;
|
||||
int sp10[2]; // not sure if this should be an array, but the stack doesn't match otherwise
|
||||
int sp0C;
|
||||
int sp08;
|
||||
sp18.buffer = param_1;
|
||||
sp18.field_0x4 = 0;
|
||||
|
||||
retval = __wcstoul(param_3, 0x7fffffff, __wStringRead, &sp18, sp10, &sp0C, &sp08);
|
||||
|
||||
if (param_2 != NULL) {
|
||||
*param_2 = param_1 + sp10[0];
|
||||
}
|
||||
|
||||
if (sp08 != 0) {
|
||||
errno = 0x22;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sp0C != 0) {
|
||||
return -retval;
|
||||
} else {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
size_t wcstol(wchar_t* param_1, wchar_t** param_2, int param_3) {
|
||||
size_t retval;
|
||||
wString sp18;
|
||||
int sp10[2]; // not sure if this should be an array, but the stack doesn't match otherwise
|
||||
int sp0C;
|
||||
int sp08;
|
||||
sp18.buffer = param_1;
|
||||
sp18.field_0x4 = 0;
|
||||
|
||||
retval = __wcstoul(param_3, 0x7fffffff, __wStringRead, &sp18, sp10, &sp0C, &sp08);
|
||||
|
||||
if (param_2 != NULL) {
|
||||
*param_2 = param_1 + sp10[0];
|
||||
}
|
||||
|
||||
if (sp08 != 0 || (sp0C == 0 && retval > 0x7fffffff) || (sp0C != 0 && retval > 0x80000000)) {
|
||||
errno = 0x22;
|
||||
return sp0C != 0 ? 0x80000000 : 0x7fffffff;
|
||||
}
|
||||
|
||||
if (sp0C != 0) {
|
||||
return -retval;
|
||||
} else {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <wmem.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
|
||||
void wmemcpy(wchar_t* dst, const wchar_t* src, size_t n) {
|
||||
memcpy(dst, src, n * 2);
|
||||
}
|
||||
|
||||
const wchar_t* wmemchr(const wchar_t* str, wchar_t needle, int max_len) {
|
||||
int i;
|
||||
for (i = 0; i != max_len; i++) {
|
||||
if (*str == needle) {
|
||||
return str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
#include <wscanf.h>
|
||||
#include <wstring.h>
|
||||
|
||||
wchar_t __wStringRead(wString* src, wchar_t param_1, wchar_t param_2) {
|
||||
switch (param_2) {
|
||||
case 0:
|
||||
param_2 = *src->buffer;
|
||||
if (param_2 == 0) {
|
||||
src->field_0x4 = 1;
|
||||
return 0xFFFF;
|
||||
} else {
|
||||
src->buffer++;
|
||||
return param_2;
|
||||
}
|
||||
case 1:
|
||||
if (src->field_0x4 == 0) {
|
||||
src->buffer--;
|
||||
} else {
|
||||
src->field_0x4 = 0;
|
||||
}
|
||||
return param_1;
|
||||
case 2:
|
||||
return src->field_0x4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#if PLATFORM_WII
|
||||
#include "m_Do/m_Re_controller_pad.h"
|
||||
#include "m_Re/m_Re_controller_pad.h"
|
||||
#endif
|
||||
|
||||
void cAPICPad_recalibrate() {
|
||||
@@ -113,7 +113,7 @@ f32 cAPICPad_X_STICK(u32 i_padNo) {
|
||||
}
|
||||
|
||||
f32 cAPICPad_X_STICK_3D(u32 i_padNo) {
|
||||
return mReCPd::getPad(i_padNo).m_stick3D;
|
||||
return mReCPd::getPad(i_padNo).m_stick3D.x;
|
||||
}
|
||||
|
||||
f32 cAPICPad_Y_STICK(u32 i_padNo) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/string_TRK.h"
|
||||
|
||||
int TRK_strlen(const char *str) {
|
||||
// NONMATCHING for Wii - for some reason Wii uses cmplwi instead of cmpwi
|
||||
int n = -1;
|
||||
do {
|
||||
n++;
|
||||
} while (((unsigned char*)str)[n] != '\0');
|
||||
return n;
|
||||
}
|
||||
@@ -1,10 +1,17 @@
|
||||
#include "TRK_MINNOW_DOLPHIN/utils/common/CircleBuffer.h"
|
||||
#include "TRK_MINNOW_DOLPHIN/utils/common/MWTrace.h"
|
||||
#include "global.h"
|
||||
#include <dolphin/db.h>
|
||||
#include <dolphin/amc/AmcExi2Comm.h>
|
||||
|
||||
#define GDEV_BUF_SIZE (0x500)
|
||||
|
||||
#if PLATFORM_GCN
|
||||
#define TRACE(...) MWTRACE(__VA_ARGS__)
|
||||
#else
|
||||
#define TRACE(...) ((void)0)
|
||||
#endif
|
||||
|
||||
static CircleBuffer gRecvCB;
|
||||
|
||||
static u8 gRecvBuf[GDEV_BUF_SIZE];
|
||||
@@ -12,9 +19,9 @@ static u8 gRecvBuf[GDEV_BUF_SIZE];
|
||||
static BOOL gIsInitialized;
|
||||
|
||||
int gdev_cc_initialize(void* inputPendingPtrRef, EXICallback monitorCallback) {
|
||||
MWTRACE(1, "CALLING EXI2_Init\n");
|
||||
TRACE(1, "CALLING EXI2_Init\n");
|
||||
DBInitComm(inputPendingPtrRef, (int*)monitorCallback);
|
||||
MWTRACE(1, "DONE CALLING EXI2_Init\n");
|
||||
TRACE(1, "DONE CALLING EXI2_Init\n");
|
||||
CircleBufferInitialize(&gRecvCB, gRecvBuf, GDEV_BUF_SIZE);
|
||||
return 0;
|
||||
}
|
||||
@@ -47,7 +54,7 @@ int gdev_cc_read(u8* data, int size) {
|
||||
return -0x2711;
|
||||
}
|
||||
|
||||
MWTRACE(1, "Expected packet size : 0x%08x (%ld)\n", size, size);
|
||||
TRACE(1, "Expected packet size : 0x%08x (%ld)\n", size, size);
|
||||
|
||||
p1 = size;
|
||||
p2 = size;
|
||||
@@ -65,7 +72,7 @@ int gdev_cc_read(u8* data, int size) {
|
||||
if (retval == 0) {
|
||||
CircleBufferReadBytes(&gRecvCB, data, p1);
|
||||
} else {
|
||||
MWTRACE(8, "cc_read : error reading bytes from EXI2 %ld\n", retval);
|
||||
TRACE(8, "cc_read : error reading bytes from EXI2 %ld\n", retval);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -80,14 +87,14 @@ int gdev_cc_write(const u8* bytes, int length) {
|
||||
n_copy = length;
|
||||
|
||||
if (gIsInitialized == FALSE) {
|
||||
MWTRACE(8, "cc not initialized\n");
|
||||
TRACE(8, "cc not initialized\n");
|
||||
return -0x2711;
|
||||
}
|
||||
|
||||
MWTRACE(8, "cc_write : Output data 0x%08x %ld bytes\n", bytes, length);
|
||||
TRACE(8, "cc_write : Output data 0x%08x %ld bytes\n", bytes, length);
|
||||
|
||||
while (n_copy > 0) {
|
||||
MWTRACE(1, "cc_write sending %ld bytes\n", n_copy);
|
||||
TRACE(1, "cc_write sending %ld bytes\n", n_copy);
|
||||
exi2Len = DBWrite((const void*)hexCopy, n_copy);
|
||||
if (exi2Len == AMC_EXI_NO_ERROR) {
|
||||
break;
|
||||
@@ -110,7 +117,7 @@ int gdev_cc_post_stop() {
|
||||
}
|
||||
|
||||
int gdev_cc_peek() {
|
||||
int poll;
|
||||
s32 poll;
|
||||
u8 buff[GDEV_BUF_SIZE];
|
||||
|
||||
poll = DBQueryData();
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
#include "TRK_MINNOW_DOLPHIN/utils/common/CircleBuffer.h"
|
||||
#include "odemuexi2/DebuggerDriver.h"
|
||||
|
||||
#define GDEV_BUF_SIZE (0x500)
|
||||
|
||||
static CircleBuffer gRecvCB;
|
||||
static u8 gRecvBuf[GDEV_BUF_SIZE];
|
||||
static BOOL gIsInitialized;
|
||||
|
||||
int gdev_cc_initinterrupts() {
|
||||
DBInitInterrupts();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gdev_cc_peek() {
|
||||
u8 buf[GDEV_BUF_SIZE];
|
||||
int len;
|
||||
|
||||
if ((len = DBQueryData()) <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (DBRead((u32*)buf, len) == 0) {
|
||||
CircleBufferWriteBytes(&gRecvCB, buf, len);
|
||||
} else {
|
||||
return 0xFFFFD8E7;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int gdev_cc_post_stop() {
|
||||
DBOpen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gdev_cc_pre_continue() {
|
||||
DBClose();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gdev_cc_write(unsigned char* src, int size) {
|
||||
if (!gIsInitialized) {
|
||||
return 0xFFFFD8EF;
|
||||
}
|
||||
|
||||
while (size > 0) {
|
||||
u32 written_cnt = DBWrite(src, size);
|
||||
if (written_cnt == 0) {
|
||||
break;
|
||||
}
|
||||
src += written_cnt;
|
||||
size -= written_cnt;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gdev_cc_read(u8* buf, u32 len) {
|
||||
u8 buf_local[GDEV_BUF_SIZE];
|
||||
int rv = 0;
|
||||
int var_r29;
|
||||
|
||||
if (!gIsInitialized) {
|
||||
return 0xFFFFD8EF;
|
||||
}
|
||||
|
||||
while (CBGetBytesAvailableForRead(&gRecvCB) < len) {
|
||||
rv = 0;
|
||||
if ((var_r29 = DBQueryData()) == 0) {
|
||||
continue;
|
||||
}
|
||||
rv = DBRead((u32*)buf_local, len);
|
||||
if (rv == 0) {
|
||||
CircleBufferWriteBytes(&gRecvCB, buf_local, var_r29);
|
||||
}
|
||||
}
|
||||
if (rv == 0) {
|
||||
CircleBufferReadBytes(&gRecvCB, buf, len);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int gdev_cc_close() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gdev_cc_open() {
|
||||
if (gIsInitialized) {
|
||||
return 0xFFFFD8EB;
|
||||
}
|
||||
|
||||
gIsInitialized = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gdev_cc_shutdown() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gdev_cc_initialize(u8** a, MTRCallbackType b) {
|
||||
DBInitComm(a, b);
|
||||
CircleBufferInitialize(&gRecvCB, gRecvBuf, sizeof(gRecvBuf));
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "Z2AudioCS/SpkData.h"
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
SpkData::SpkData(JKRArchive* resArc) {
|
||||
mResArc = resArc;
|
||||
JUT_ASSERT(21, resArc);
|
||||
}
|
||||
|
||||
void SpkData::loadTable(u16 chan) {
|
||||
JUT_ASSERT(32, mResArc);
|
||||
|
||||
void* res = mResArc->getResource(chan);
|
||||
JUT_ASSERT(35, res);
|
||||
|
||||
mTableMgr.setResource(res);
|
||||
}
|
||||
|
||||
void SpkData::loadWave(u16 chan) {
|
||||
JUT_ASSERT(48, mResArc);
|
||||
|
||||
void* res = mResArc->getResource(chan);
|
||||
JUT_ASSERT(51, res);
|
||||
|
||||
mWaveMgr.setResource(res);
|
||||
}
|
||||
|
||||
BOOL SpkData::isValid(void) const {
|
||||
return mTableMgr.isValid() && mWaveMgr.isValid();
|
||||
}
|
||||
|
||||
static void dummy(SpkWave* wave, SpkTable* table) {
|
||||
if (wave->isValid() && table->isValid()) {
|
||||
table->getParams(0);
|
||||
table->getNumOfSound();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include "JSystem/JAudio2/JASCalc.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
|
||||
SpkMixingBuffer::SpkMixingBuffer(JKRHeap* heap) {
|
||||
JUT_ASSERT(25, heap);
|
||||
for (s32 chan = 0; chan < ARRAY_SIZE(mBuffer); chan++) {
|
||||
mBuffer[chan] = new (heap, 0) s16[cSamplesPerAudioPacket];
|
||||
JUT_ASSERT(29, mBuffer[chan]);
|
||||
bzeroBuffer(chan);
|
||||
}
|
||||
}
|
||||
|
||||
void SpkMixingBuffer::mix(s32 chan, s16* src, s32 len, f32 weight,
|
||||
s32 offset) {
|
||||
JUT_ASSERT(61, chan < 4);
|
||||
JUT_ASSERT(62, mBuffer[chan]);
|
||||
JUT_ASSERT(63, src);
|
||||
JUT_ASSERT(64, offset >= 0);
|
||||
JUT_ASSERT(65, (offset+len) <= cSamplesPerAudioPacket);
|
||||
|
||||
for (s32 i = 0; i < len; i++) {
|
||||
s32 sample = mBuffer[chan][i + offset];
|
||||
s16 srcSample = src[i];
|
||||
sample += (s32)(srcSample * weight);
|
||||
mBuffer[chan][i + offset] = JASCalc::clamp<s16, s32>(sample);
|
||||
}
|
||||
}
|
||||
|
||||
s16* SpkMixingBuffer::getSamples(s32 chan) const {
|
||||
JUT_ASSERT(97, chan < 4);
|
||||
JUT_ASSERT(98, mBuffer[chan]);
|
||||
return mBuffer[chan];
|
||||
}
|
||||
|
||||
bool SpkMixingBuffer::update(s32 chan) {
|
||||
bzeroBuffer(chan);
|
||||
SpkSoundHolder* sound_holder = JASGlobalInstance<SpkSoundHolder>::getInstance();
|
||||
JUT_ASSERT(121, sound_holder);
|
||||
bool result = sound_holder->update(chan);
|
||||
return result;
|
||||
}
|
||||
|
||||
void SpkMixingBuffer::bzeroBuffer(s32 chan) {
|
||||
JUT_ASSERT(143, chan < 4);
|
||||
JUT_ASSERT(144, mBuffer[chan]);
|
||||
JASCalc::bzero(mBuffer[chan], cSamplesPerAudioPacket * sizeof(s16));
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
|
||||
#include "Z2AudioCS/SpkSpeakerCtrl.h"
|
||||
#include "Z2AudioCS/SpkSystem.h"
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
|
||||
#define SPK_SOUND_MIX_STEP 40
|
||||
|
||||
enum SpkSoundState {
|
||||
SpkSoundState_STARTING_e,
|
||||
SpkSoundState_LOCKED_e,
|
||||
SpkSoundState_UNLOCKED_e,
|
||||
SpkSoundState_STOPPING_e,
|
||||
SpkSoundState_DEAD_e,
|
||||
};
|
||||
|
||||
void SpkSoundHandle::releaseSound() {
|
||||
if (!mSound) {
|
||||
return;
|
||||
}
|
||||
|
||||
mSound->mHandle = NULL;
|
||||
mSound = NULL;
|
||||
}
|
||||
|
||||
SpkSoundVolume::SpkSoundVolume() {
|
||||
field_0x00 = 1.0f;
|
||||
field_0x04 = 0.0f;
|
||||
field_0x08 = 1.0f;
|
||||
field_0x0c = 0.0f;
|
||||
field_0x10 = 1.0f;
|
||||
field_0x14 = 1.0f;
|
||||
field_0x18 = 0.0f;
|
||||
mTableVolume = 1.0f;
|
||||
}
|
||||
|
||||
void SpkSoundVolume::setRelease(s32 release) {
|
||||
if (release > 0) {
|
||||
field_0x04 = 1.0f / release;
|
||||
} else {
|
||||
field_0x04 = 1.0f;
|
||||
}
|
||||
|
||||
field_0x00 = 1.0f;
|
||||
}
|
||||
|
||||
void SpkSoundVolume::setFadeOut(s32 fadeOut) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
if (fadeOut > 0) {
|
||||
field_0x0c = 1.0f / fadeOut;
|
||||
} else {
|
||||
field_0x0c = 1.0f;
|
||||
}
|
||||
|
||||
field_0x08 = 1.0f;
|
||||
}
|
||||
|
||||
f32 SpkSoundVolume::calc(bool& param_0) {
|
||||
param_0 = false;
|
||||
|
||||
if (field_0x04 != 0.0f) {
|
||||
field_0x00 -= field_0x04;
|
||||
if (field_0x00 <= 0.0f) {
|
||||
field_0x00 = 0.0f;
|
||||
field_0x04 = 0.0f;
|
||||
param_0 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x0c != 0.0f) {
|
||||
field_0x08 -= field_0x0c;
|
||||
if (field_0x08 <= 0.0f) {
|
||||
field_0x08 = 0.0f;
|
||||
field_0x0c = 0.0f;
|
||||
param_0 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x18 != 0.0f) {
|
||||
field_0x10 += field_0x18;
|
||||
if (field_0x18 >= 0.0f) {
|
||||
if (field_0x10 >= field_0x14) {
|
||||
field_0x10 = field_0x14;
|
||||
field_0x18 = 0.0f;
|
||||
}
|
||||
} else if (field_0x10 <= field_0x14) {
|
||||
field_0x10 = field_0x14;
|
||||
field_0x18 = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
f32 result = mTableVolume * (field_0x10 * (field_0x08 * (field_0x00 * field_0x00)));
|
||||
return result;
|
||||
}
|
||||
|
||||
void SpkSoundVolume::setTableVolume(f32 vol) {
|
||||
mTableVolume = vol;
|
||||
}
|
||||
|
||||
SpkSound::SpkSound() : JSULink<SpkSound>(this),
|
||||
mHandle(NULL), mSoundNum(-1), mWaveData(0), mCurPos(0),
|
||||
field_0x20(0), mPriority(100), field_0x28(0), mWaveSize(0),
|
||||
mWaveLoopStart(-1), mWaveLoopEnd(-1), mState(SpkSoundState_STARTING_e),
|
||||
mLifeTime(-1) {
|
||||
}
|
||||
|
||||
SpkSound::~SpkSound() {
|
||||
releaseHandle();
|
||||
}
|
||||
|
||||
void SpkSound::update(f32 param_0) {
|
||||
if (!((SpkSoundState)mState != SpkSoundState_UNLOCKED_e &&
|
||||
(SpkSoundState)mState != SpkSoundState_STOPPING_e)) {
|
||||
SpkSystem* system = JASGlobalInstance<SpkSystem>::getInstance();
|
||||
JUT_ASSERT(227, system);
|
||||
|
||||
SpkMixingBuffer* mixing_buffer = system->getMixingBuffer();
|
||||
JUT_ASSERT(230, mixing_buffer);
|
||||
|
||||
bool calc_flag = false;
|
||||
f32 weight = mVolume.calc(calc_flag);
|
||||
if (calc_flag) {
|
||||
mState = SpkSoundState_DEAD_e;
|
||||
}
|
||||
weight *= param_0;
|
||||
|
||||
if (!isLoopWave()) {
|
||||
s32 len = SPK_SOUND_MIX_STEP;
|
||||
if (mCurPos + len >= mWaveSize) {
|
||||
len = mWaveSize - mCurPos;
|
||||
}
|
||||
|
||||
mixing_buffer->mix(field_0x20, mWaveData + mCurPos, len, weight, 0);
|
||||
|
||||
mCurPos += SPK_SOUND_MIX_STEP;
|
||||
|
||||
if (mCurPos >= mWaveSize) {
|
||||
mState = SpkSoundState_DEAD_e;
|
||||
}
|
||||
return;
|
||||
}
|
||||
s32 len = 0;
|
||||
s32 processedBytes = 0;
|
||||
s32 remainingBytes = SPK_SOUND_MIX_STEP;
|
||||
if (mWaveLoopEnd - mCurPos >= SPK_SOUND_MIX_STEP) {
|
||||
len = SPK_SOUND_MIX_STEP;
|
||||
mixing_buffer->mix(field_0x20, mWaveData + mCurPos, len, weight, 0);
|
||||
|
||||
mCurPos += SPK_SOUND_MIX_STEP;
|
||||
|
||||
if (mCurPos >= mWaveLoopEnd) {
|
||||
mCurPos = mWaveLoopStart;
|
||||
}
|
||||
} else {
|
||||
while (remainingBytes > 0) {
|
||||
len = mWaveLoopEnd - mCurPos;
|
||||
if (len >= remainingBytes) {
|
||||
len = remainingBytes;
|
||||
}
|
||||
remainingBytes -= len;
|
||||
|
||||
mixing_buffer->mix(field_0x20, mWaveData + mCurPos, len, weight,
|
||||
processedBytes);
|
||||
|
||||
processedBytes += len;
|
||||
mCurPos += len;
|
||||
|
||||
if (mCurPos >= mWaveLoopEnd) {
|
||||
mCurPos = mWaveLoopStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSound::stop(s32 msec) {
|
||||
mState = SpkSoundState_STOPPING_e;
|
||||
s32 fade = convertMsecToFrames(msec);
|
||||
|
||||
if (fade) {
|
||||
mVolume.setFadeOut(fade);
|
||||
} else {
|
||||
startRelease();
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSound::startRelease(void) {
|
||||
mVolume.setRelease(field_0x28);
|
||||
}
|
||||
|
||||
void SpkSound::attachHandle(SpkSoundHandle* handle) {
|
||||
JUT_ASSERT(338, handle);
|
||||
if (isHandleAttached()) {
|
||||
releaseHandle();
|
||||
}
|
||||
|
||||
mHandle = handle;
|
||||
mHandle->mSound = this;
|
||||
}
|
||||
|
||||
bool SpkSound::isHandleAttached(void) const {
|
||||
return mHandle != NULL;
|
||||
}
|
||||
|
||||
void SpkSound::releaseHandle() {
|
||||
if (!mHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHandle->mSound = NULL;
|
||||
mHandle = NULL;
|
||||
}
|
||||
|
||||
bool SpkSound::start(s32 param_0, s32 soundNum) {
|
||||
field_0x20 = param_0;
|
||||
|
||||
bool setResult = setWaveData(soundNum);
|
||||
if (!setResult) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mState = SpkSoundState_LOCKED_e;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SpkSound::kill(void) {
|
||||
mState = SpkSoundState_DEAD_e;
|
||||
}
|
||||
|
||||
bool SpkSound::isStopping(void) const {
|
||||
return mState == SpkSoundState_STOPPING_e;
|
||||
}
|
||||
|
||||
bool SpkSound::isDead(void) const {
|
||||
return mState == SpkSoundState_DEAD_e;
|
||||
}
|
||||
|
||||
bool SpkSound::isLocked(void) const {
|
||||
return mState == SpkSoundState_LOCKED_e;
|
||||
}
|
||||
|
||||
void SpkSound::unlock() {
|
||||
if (mState != SpkSoundState_LOCKED_e) {
|
||||
return;
|
||||
}
|
||||
|
||||
mState = SpkSoundState_UNLOCKED_e;
|
||||
}
|
||||
|
||||
s32 SpkSound::getLifeTime(void) {
|
||||
return mLifeTime;
|
||||
}
|
||||
|
||||
void SpkSound::setLifeTime(s32 lifeTime) {
|
||||
mLifeTime = lifeTime;
|
||||
}
|
||||
|
||||
void SpkSound::updateLifeTime() {
|
||||
mLifeTime--;
|
||||
}
|
||||
|
||||
s32 SpkSound::convertMsecToFrames(s32 msec) {
|
||||
return 6 * msec / 40;
|
||||
}
|
||||
|
||||
inline bool SpkSound::isLoopWave(void) {
|
||||
return mWaveLoopStart >= 0 && mWaveLoopEnd > mWaveLoopStart;
|
||||
}
|
||||
|
||||
bool SpkSound::setWaveData(s32 soundNum) {
|
||||
SpkSystem* system = JASGlobalInstance<SpkSystem>::getInstance();
|
||||
JUT_ASSERT(432, system);
|
||||
|
||||
SpkData* data = system->getData();
|
||||
JUT_ASSERT(435, data);
|
||||
|
||||
if (data->isValid() == 0) {
|
||||
JUT_WARN(438, "%s", "Speaker data is not valid\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
SpkTable& table = data->getTableMgr();
|
||||
JUT_ASSERT(444, soundNum < table.getNumOfSound());
|
||||
|
||||
mSoundNum = soundNum;
|
||||
s32 waveNum = table.getParams(soundNum)->mWaveNum;
|
||||
mPriority = table.getParams(soundNum)->field_0x02;
|
||||
mVolume.setTableVolume(table.getParams(soundNum)->mVolume / 127.0f);
|
||||
field_0x28 = convertMsecToFrames(table.getParams(soundNum)->mMsec);
|
||||
|
||||
SpkWave& wave = data->getWaveMgr();
|
||||
JUT_ASSERT(457, mSoundNum < wave.getNumOfWaves());
|
||||
mWaveData = wave.getWave(waveNum);
|
||||
mCurPos = 0;
|
||||
mWaveSize = wave.getWaveSize(waveNum) / 2;
|
||||
mWaveLoopStart = wave.getLoopStartPos(waveNum);
|
||||
mWaveLoopEnd = wave.getLoopEndPos(waveNum);
|
||||
|
||||
JUT_ASSERT(466, mWaveLoopEnd <= mWaveSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SpkSoundHolder::SpkSoundHolder() : JASGlobalInstance(true) {
|
||||
mMasterVolume = 1.0f;
|
||||
mConfigVolume = 10;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mSoundVolumes); i++) {
|
||||
mSoundVolumes[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::startSound(s32 chan, s32 soundNum, SpkSoundHandle* handle) {
|
||||
if (!SpkSpeakerCtrl::isEnable(chan)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (soundNum < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle != NULL) {
|
||||
if (*handle) {
|
||||
if ((*handle)->isLocked()) {
|
||||
(*handle)->kill();
|
||||
} else {
|
||||
(*handle)->stop(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpkSound* new_sound_p = new SpkSound();
|
||||
if (new_sound_p == NULL) {
|
||||
JUT_WARN(520, "%s", "cannot new SpkSound\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle != NULL) {
|
||||
new_sound_p->attachHandle(handle);
|
||||
}
|
||||
|
||||
bool startResult = new_sound_p->start(chan, soundNum);
|
||||
if (!startResult) {
|
||||
JUT_WARN(532, "%s", "cannot start SpkSound\n");
|
||||
delete new_sound_p;
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
JASCriticalSection cs;
|
||||
appendSound(chan, new_sound_p);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SpkSoundHolder::appendSound(s32 chan, SpkSound* sound) {
|
||||
mSoundList[chan].append(sound);
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::startLevelSound(s32 chan, s32 soundNum, SpkSoundHandle* handle) {
|
||||
if (handle == NULL) {
|
||||
JUT_WARN(558, "%s", "Spk : No Handle for Level Sound");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*handle) {
|
||||
if (!(*handle)->isStopping() && !(*handle)->isDead()) {
|
||||
(*handle)->setLifeTime(2);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
bool startResult = startSound(chan, soundNum, handle);
|
||||
if (!startResult) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*handle) {
|
||||
(*handle)->setLifeTime(2);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSoundHolder::stopAll(s32 chan, s32 msec) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
for (JSULink<SpkSound>* it = mSoundList[chan].getFirst(); it != NULL; it = it->getNext()) {
|
||||
if (it->getObject() != NULL) {
|
||||
it->getObject()->stop(msec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::update(s32 chan) {
|
||||
JASCriticalSection cs;
|
||||
bool ret = updateEachSound(chan);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SpkSoundHolder::updateEachSound(s32 chan) {
|
||||
bool retval = false;
|
||||
|
||||
f32 volume = getMasterVolume() * getConfigVolumeF32();
|
||||
|
||||
for (JSULink<SpkSound>* it = mSoundList[chan].getFirst(); it != NULL; it = it->getNext()) {
|
||||
it->getObject()->update(volume * mSoundVolumes[chan]);
|
||||
retval = true;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void SpkSoundHolder::freeDeadSound(s32 chan) {
|
||||
JSULink<SpkSound>* it = mSoundList[chan].getFirst();
|
||||
while (it != NULL) {
|
||||
JSULink<SpkSound>* next = it->getNext();
|
||||
if (it->getObject()->isDead()) {
|
||||
mSoundList[chan].remove(it);
|
||||
delete it->getObject();
|
||||
}
|
||||
it = next;
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSoundHolder::framework(void) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mSoundList); i++) {
|
||||
for (JSULink<SpkSound>* it = mSoundList[i].getFirst(); it != NULL; it = it->getNext()) {
|
||||
if (it->getObject() != NULL) {
|
||||
if (it->getObject()->isLocked()) {
|
||||
it->getObject()->unlock();
|
||||
} else if (it->getObject()->getLifeTime() >= 0) {
|
||||
it->getObject()->updateLifeTime();
|
||||
if (it->getObject()->getLifeTime() <= 0) {
|
||||
it->getObject()->stop(0);
|
||||
it->getObject()->setLifeTime(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
freeDeadSound(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
#include "Z2AudioCS/SpkSpeakerCtrl.h"
|
||||
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/wpad.h>
|
||||
#include <cstring>
|
||||
|
||||
OSAlarm sSpeakerAlarm;
|
||||
SpeakerInfo sSpeakerInfo[WPAD_MAX_CONTROLLERS];
|
||||
SpkSoundHandle sAdjustSoundHandle[WPAD_MAX_CONTROLLERS];
|
||||
SpkMixingBuffer* sMixingBuffer;
|
||||
|
||||
#if VERSION == VERSION_WII_USA_R0
|
||||
#define SPKSPEAKERCTRL_SET_STATE(s) (void)0
|
||||
#else
|
||||
#define SPKSPEAKERCTRL_SET_STATE(s) mState = s
|
||||
#endif
|
||||
|
||||
void SpkSpeakerCtrl::setMixingBuffer(SpkMixingBuffer* pMixingBuffer) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
sMixingBuffer = pMixingBuffer;
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setup(void) {
|
||||
for (s32 i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||
sSpeakerInfo[i].mIsConnected = false;
|
||||
sSpeakerInfo[i].mIsPlaying = false;
|
||||
sSpeakerInfo[i].field_0x22 = true;
|
||||
sSpeakerInfo[i].mIsMuted = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[i].mState = 0;
|
||||
#endif
|
||||
sSpeakerInfo[i].mVolume = 64;
|
||||
sSpeakerInfo[i].mRadioSensitivityTimer = 0;
|
||||
sSpeakerInfo[i].mExtensionTimer = 0;
|
||||
memset(sSpeakerInfo[i].mEncInfo.data, 0, sizeof(sSpeakerInfo[i].mEncInfo));
|
||||
}
|
||||
|
||||
OSCreateAlarm(&sSpeakerAlarm);
|
||||
OSSetPeriodicAlarm(&sSpeakerAlarm, OSGetTime(), OSNanosecondsToTicks(6666667), updateSpeaker);
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::connect(s32 chan) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
sSpeakerInfo[chan].mIsConnected = true;
|
||||
sSpeakerInfo[chan].mIsPlaying = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
setSpeakerOn(chan);
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::disconnect(s32 chan) {
|
||||
JASCriticalSection cs;
|
||||
|
||||
sSpeakerInfo[chan].mIsConnected = false;
|
||||
sSpeakerInfo[chan].mIsPlaying = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
setSpeakerOff(chan);
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerOn(s32 chan) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
JASCriticalSection cs;
|
||||
#endif
|
||||
|
||||
s32 val = WPADControlSpeaker(chan, 1, setSpeakerOnCallback);
|
||||
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
if (val == -2) {
|
||||
sSpeakerInfo[chan].mState = 1;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerOnCallback(s32 chan, s32 param_1) {
|
||||
#if VERSION == VERSION_WII_USA_R0
|
||||
if (param_1 == 0) {
|
||||
setSpeakerPlay(chan);
|
||||
}
|
||||
#else
|
||||
JASCriticalSection cs;
|
||||
|
||||
if (param_1 == 0) {
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
setSpeakerPlay(chan);
|
||||
} else {
|
||||
if (param_1 == -3) {
|
||||
sSpeakerInfo[chan].mState = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerPlay(s32 chan) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
JASCriticalSection cs;
|
||||
#endif
|
||||
|
||||
s32 val = WPADControlSpeaker(chan, 4, startPlayCallback);
|
||||
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
if (val == -2) {
|
||||
sSpeakerInfo[chan].mState = 2;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::startPlayCallback(s32 chan, s32 param_1) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
JASCriticalSection cs;
|
||||
#endif
|
||||
|
||||
if (param_1 == 0) {
|
||||
sSpeakerInfo[chan].mIsPlaying = true;
|
||||
sSpeakerInfo[chan].field_0x22 = true;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
memset(&sSpeakerInfo[chan].mEncInfo, 0, 0x20);
|
||||
} else if (param_1 == -3) {
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 2;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::setSpeakerOff(s32 chan) {
|
||||
sSpeakerInfo[chan].mIsPlaying = false;
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
sSpeakerInfo[chan].mState = 0;
|
||||
#endif
|
||||
WPADControlSpeaker(chan, 0, 0);
|
||||
}
|
||||
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
void SpkSpeakerCtrl::retryConnection(s32 chan) {
|
||||
switch (sSpeakerInfo[chan].mState) {
|
||||
case 0:
|
||||
case 3:
|
||||
break;
|
||||
case 1:
|
||||
setSpeakerOn(chan);
|
||||
break;
|
||||
case 2:
|
||||
setSpeakerPlay(chan);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void SpkSpeakerCtrl::framework() {
|
||||
for (s32 i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||
retryConnection(i);
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::updateSpeaker(OSAlarm*, OSContext*) {
|
||||
for (s32 i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||
if (sMixingBuffer != NULL) {
|
||||
BOOL isBusy = FALSE;
|
||||
|
||||
if (!checkRadioSensitivity(i)) {
|
||||
isBusy = TRUE;
|
||||
}
|
||||
|
||||
if (!updateExtensionProcess(i)) {
|
||||
isBusy = TRUE;
|
||||
}
|
||||
|
||||
if (sSpeakerInfo[i].mIsMuted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool updateResult = sMixingBuffer->update(i);
|
||||
if (isBusy) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sSpeakerInfo[i].mIsPlaying) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (updateResult) {
|
||||
bool var_r28 = true;
|
||||
|
||||
if (sSpeakerInfo[i].mIsPlaying && sMixingBuffer != NULL) {
|
||||
if (sSpeakerInfo[i].field_0x22) {
|
||||
var_r28 = false;
|
||||
sSpeakerInfo[i].field_0x22 = false;
|
||||
}
|
||||
u8 data[24];
|
||||
WENCGetEncodeData(&sSpeakerInfo[i].mEncInfo, var_r28,
|
||||
sMixingBuffer->getSamples(i), 0x28, data);
|
||||
WPADSendStreamData(i, data, 0x14);
|
||||
}
|
||||
} else {
|
||||
sSpeakerInfo[i].field_0x22 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::isEnable(s32 chan) {
|
||||
return WPADIsSpeakerEnabled(chan) &&
|
||||
sSpeakerInfo[chan].mIsPlaying &&
|
||||
!isSubmitPlayByRadioSensitivity(chan) &&
|
||||
!isSubmitPlayByExtensionConnect(chan) &&
|
||||
sMixingBuffer != NULL;
|
||||
}
|
||||
|
||||
void SpkSpeakerCtrl::extensionProcess(s32 chan, s32 param_1) {
|
||||
if (!sSpeakerInfo[chan].mIsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mExtensionTimer = 49;
|
||||
sSpeakerInfo[chan].field_0x22 = true;
|
||||
if (param_1 == 0xFF) {
|
||||
sSpeakerInfo[chan].mExtensionTimer = 50;
|
||||
}
|
||||
|
||||
if (sSpeakerInfo[chan].mIsPlaying == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSpeakerOff(chan);
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::updateExtensionProcess(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mIsConnected == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sSpeakerInfo[chan].mExtensionTimer < 50) {
|
||||
if (sSpeakerInfo[chan].mExtensionTimer > 0) {
|
||||
if (sSpeakerInfo[chan].mExtensionTimer == 1 && !sSpeakerInfo[chan].mIsPlaying) {
|
||||
setSpeakerOn(chan);
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mExtensionTimer--;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mExtensionTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool retval;
|
||||
if (sSpeakerInfo[chan].mExtensionTimer == 0) {
|
||||
retval = true;
|
||||
} else {
|
||||
retval = false;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::isSubmitPlayByExtensionConnect(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mExtensionTimer > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::checkRadioSensitivity(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mIsConnected == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WPADGetRadioSensitivity(chan) < 60) {
|
||||
if (sSpeakerInfo[chan].mIsPlaying == 1) {
|
||||
setSpeakerOff(chan);
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mRadioSensitivityTimer = 200;
|
||||
sSpeakerInfo[chan].field_0x22 = true;
|
||||
} else {
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer > 0) {
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer == 1) {
|
||||
if (!sSpeakerInfo[chan].mIsPlaying) {
|
||||
setSpeakerOn(chan);
|
||||
}
|
||||
}
|
||||
|
||||
sSpeakerInfo[chan].mRadioSensitivityTimer--;
|
||||
} else {
|
||||
sSpeakerInfo[chan].mRadioSensitivityTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool retval;
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer == 0) {
|
||||
retval = true;
|
||||
} else {
|
||||
retval = false;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool SpkSpeakerCtrl::isSubmitPlayByRadioSensitivity(s32 chan) {
|
||||
if (sSpeakerInfo[chan].mRadioSensitivityTimer > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "Z2AudioCS/SpkSystem.h"
|
||||
|
||||
#include "Z2AudioCS/SpkMixingBuffer.h"
|
||||
#include "Z2AudioCS/SpkSound.h"
|
||||
#include "Z2AudioCS/SpkSpeakerCtrl.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
template<> SpkSystem* JASGlobalInstance<SpkSystem>::sInstance JAS_GLOBAL_INSTANCE_INIT;
|
||||
template<> SpkSoundHolder* JASGlobalInstance<SpkSoundHolder>::sInstance JAS_GLOBAL_INSTANCE_INIT;
|
||||
|
||||
const static s32 cConfigVolumeMax = 15;
|
||||
|
||||
SpkSystem::SpkSystem(JKRHeap* heap) : JASGlobalInstance(true) {
|
||||
mData = NULL;
|
||||
|
||||
if (!heap) {
|
||||
heap = JKRGetCurrentHeap();
|
||||
}
|
||||
|
||||
mHeap = heap;
|
||||
mMixingBuffer = new (heap, 0) SpkMixingBuffer(heap);
|
||||
JUT_ASSERT(35, mMixingBuffer);
|
||||
mSoundHolder = new (heap, 0) SpkSoundHolder();
|
||||
JUT_ASSERT(38, mSoundHolder);
|
||||
SpkSpeakerCtrl::setup();
|
||||
SpkSpeakerCtrl::setMixingBuffer(mMixingBuffer);
|
||||
}
|
||||
|
||||
void SpkSystem::setResource(JKRArchive* resArc, u16 param_1, u16 param_2) {
|
||||
JUT_ASSERT(71, mHeap);
|
||||
JUT_ASSERT(72, resArc);
|
||||
mData = new (mHeap, 0) SpkData(resArc);
|
||||
JUT_ASSERT(75, mData);
|
||||
mData->loadTable(param_1);
|
||||
mData->loadWave(param_2);
|
||||
}
|
||||
|
||||
void SpkSystem::framework() {
|
||||
JUT_ASSERT(89, mSoundHolder);
|
||||
#if VERSION != VERSION_WII_USA_R0
|
||||
SpkSpeakerCtrl::framework();
|
||||
#endif
|
||||
mSoundHolder->framework();
|
||||
}
|
||||
|
||||
void SpkSystem::startSound(s32 chan, s32 param_1, SpkSoundHandle* handle) {
|
||||
JUT_ASSERT(108, chan >= 0);
|
||||
JUT_ASSERT(109, chan < 4);
|
||||
JUT_ASSERT(110, mSoundHolder);
|
||||
mSoundHolder->startSound(chan, param_1, handle);
|
||||
}
|
||||
|
||||
void SpkSystem::startLevelSound(s32 chan, s32 param_1, SpkSoundHandle* handle) {
|
||||
JUT_ASSERT(128, chan >= 0);
|
||||
JUT_ASSERT(129, chan < 4);
|
||||
JUT_ASSERT(130, mSoundHolder);
|
||||
JUT_ASSERT(131, handle);
|
||||
mSoundHolder->startLevelSound(chan, param_1, handle);
|
||||
}
|
||||
|
||||
void SpkSystem::setMasterVolume(f32 vol) {
|
||||
JUT_ASSERT(146, mSoundHolder);
|
||||
JUT_ASSERT(147, vol >= 0.f);
|
||||
JUT_ASSERT(148, vol <= 1.f);
|
||||
mSoundHolder->setMasterVolume(vol);
|
||||
}
|
||||
|
||||
f32 SpkSystem::getMasterVolume(void) {
|
||||
return mSoundHolder->getMasterVolume();
|
||||
}
|
||||
|
||||
void SpkSystem::stopAll(s32 chan, s32 msec) {
|
||||
JUT_ASSERT(269, mSoundHolder);
|
||||
JUT_ASSERT(270, chan < 4);
|
||||
JUT_ASSERT(271, msec >= 0);
|
||||
|
||||
if (chan < 0) {
|
||||
for (s32 i = 0; i < 4; i++) {
|
||||
mSoundHolder->stopAll(i, msec);
|
||||
}
|
||||
} else {
|
||||
mSoundHolder->stopAll(chan, msec);
|
||||
}
|
||||
}
|
||||
|
||||
void SpkSystem::setConfigVolume(s32 vol) {
|
||||
JUT_ASSERT(307, mSoundHolder);
|
||||
JUT_ASSERT(308, vol >= 0);
|
||||
JUT_ASSERT(309, vol <= cConfigVolumeMax);
|
||||
|
||||
mSoundHolder->setConfigVolume(vol);
|
||||
}
|
||||
|
||||
void SpkSystem::newSoundMemPool(s32 numOfSound) {
|
||||
JUT_ASSERT(351, numOfSound >= 0);
|
||||
JASPoolAllocObject<SpkSound>::newMemPool(numOfSound);
|
||||
}
|
||||
|
||||
void SpkSystem::connect(s32 chan) {
|
||||
SpkSpeakerCtrl::connect(chan);
|
||||
}
|
||||
|
||||
void SpkSystem::disconnect(s32 chan) {
|
||||
SpkSpeakerCtrl::disconnect(chan);
|
||||
}
|
||||
|
||||
void SpkSystem::extensionProcess(s32 chan, s32 param_1) {
|
||||
SpkSpeakerCtrl::extensionProcess(chan, param_1);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "Z2AudioCS/SpkTable.h"
|
||||
|
||||
SpkTable::SpkTable(void) {
|
||||
mIsInitialized = false;
|
||||
mNumOfSound = 0;
|
||||
mEntryOffset = 0;
|
||||
mDataOffsets = 0;
|
||||
}
|
||||
|
||||
struct SpkTableHeader {
|
||||
s32 resourceCount;
|
||||
s32 entryOff;
|
||||
s32 dataOffsetsStartOff;
|
||||
BOOL isDataOffsetsInitialized;
|
||||
};
|
||||
|
||||
void SpkTable::setResource(void* res) {
|
||||
mIsInitialized = false;
|
||||
|
||||
s32* cursor = (s32*)res;
|
||||
|
||||
s32 resourceCount = *cursor++;
|
||||
s32 entryOff = *cursor++;
|
||||
s32 dataOffsetsStartOff = *cursor++;
|
||||
s32* pIsDataOffsetsInitialized = cursor;
|
||||
BOOL isDataOffsetsInitialized = *cursor++;
|
||||
|
||||
mNumOfSound = resourceCount;
|
||||
|
||||
s32 entryOffset = (s32)res + entryOff;
|
||||
mEntryOffset = entryOffset;
|
||||
s32* dataOffsets = (s32*)((s32)res + dataOffsetsStartOff);
|
||||
if (!isDataOffsetsInitialized) {
|
||||
for (s32 i = 0; i < mNumOfSound; i++) {
|
||||
dataOffsets[i] += (s32)res;
|
||||
}
|
||||
}
|
||||
|
||||
s32* dataOffsetsCopy = dataOffsets;
|
||||
mDataOffsets = dataOffsetsCopy;
|
||||
*pIsDataOffsetsInitialized = TRUE;
|
||||
|
||||
mIsInitialized = true;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#include "Z2AudioCS/SpkWave.h"
|
||||
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/types.h>
|
||||
|
||||
SpkWave::SpkWave(void) {
|
||||
mWaveData = NULL;
|
||||
}
|
||||
|
||||
void SpkWave::setResource(void* res) {
|
||||
JUT_ASSERT(30, res);
|
||||
|
||||
JASCriticalSection cs;
|
||||
|
||||
mWaveData = res;
|
||||
}
|
||||
|
||||
s32 SpkWave::getNumOfWaves(void) const {
|
||||
if (mWaveData == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((s32*)mWaveData)[1];
|
||||
}
|
||||
|
||||
s32 SpkWave::getWaveSize(s32 num) const {
|
||||
JUT_ASSERT(57, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(60, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(63, data);
|
||||
return data->size;
|
||||
}
|
||||
|
||||
u32 SpkWave::getLoopStartPos(s32 num) const {
|
||||
JUT_ASSERT(76, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(79, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(82, data);
|
||||
return data->loopStartPos;
|
||||
}
|
||||
|
||||
u32 SpkWave::getLoopEndPos(s32 num) const {
|
||||
JUT_ASSERT(95, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(98, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(101, data);
|
||||
return data->loopEndPos;
|
||||
}
|
||||
|
||||
s16* SpkWave::getWave(s32 num) const {
|
||||
JUT_ASSERT(114, num >= 0);
|
||||
if (!mWaveData) {
|
||||
return 0;
|
||||
}
|
||||
JUT_ASSERT(117, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = getWaveData(num);
|
||||
JUT_ASSERT(120, data);
|
||||
return data->wave;
|
||||
}
|
||||
|
||||
WaveData* SpkWave::getWaveData(s32 num) const {
|
||||
JUT_ASSERT(138, num >= 0);
|
||||
JUT_ASSERT(139, mWaveData);
|
||||
JUT_ASSERT(140, num < getNumOfWaves());
|
||||
|
||||
WaveData* data = (WaveData*)((u32)mWaveData + *(u32*)((u32)mWaveData + num * 4 + 8));
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
|
||||
#include "Z2AudioCS/SpkSystem.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <revolution/types.h>
|
||||
#include <revolution/wpad.h>
|
||||
|
||||
#define HANDLES_MAX 0x30
|
||||
|
||||
static SpkSoundHandle* sSpkHandles;
|
||||
|
||||
static u8 l_spkVolume;
|
||||
|
||||
void Z2AudioCS::newSpkSoundMemPool() {
|
||||
SpkSystem::newSoundMemPool(HANDLES_MAX);
|
||||
}
|
||||
|
||||
int Z2AudioCS::init(JKRHeap* heap, JKRArchive* res, s32 param_2, s32 param_3) {
|
||||
JUT_ASSERT(59, heap);
|
||||
JUT_ASSERT(60, res);
|
||||
SpkSystem* spkSys = new(heap, 0) SpkSystem(heap);
|
||||
JUT_ASSERT(67, spkSys);
|
||||
|
||||
sSpkHandles = new (heap, 0) SpkSoundHandle[HANDLES_MAX];
|
||||
JUT_ASSERT(71, sSpkHandles);
|
||||
|
||||
spkSys->setResource(res, 2, 3);
|
||||
spkSys->setMasterVolume(1.0f);
|
||||
spkSys->setConfigVolume(15);
|
||||
}
|
||||
|
||||
void Z2AudioCS::update() {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() != NULL) {
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->framework();
|
||||
}
|
||||
}
|
||||
|
||||
void Z2AudioCS::connect(s32 chan) {
|
||||
SpkSystem::connect(chan);
|
||||
l_spkVolume = WPADGetSpeakerVolume();
|
||||
}
|
||||
|
||||
void Z2AudioCS::disconnect(s32 chan) {
|
||||
SpkSystem::disconnect(chan);
|
||||
}
|
||||
|
||||
void Z2AudioCS::extensionProcess(s32 chan, s32 param_1) {
|
||||
SpkSystem::extensionProcess(chan, param_1);
|
||||
}
|
||||
|
||||
static SpkSoundHandle* getFreeSpkHandle(void) {
|
||||
JUT_ASSERT(125, JASGlobalInstance<SpkSystem>::getInstance());
|
||||
JUT_ASSERT(126, sSpkHandles);
|
||||
|
||||
SpkSoundHandle* highestPriorityHandle = NULL;
|
||||
s32 highestPriority = 255;
|
||||
for (s32 i = 0; i < HANDLES_MAX; i++) {
|
||||
if (!sSpkHandles[i].isSoundAttached()) {
|
||||
return &sSpkHandles[i];
|
||||
}
|
||||
|
||||
if (sSpkHandles[i]->getPriority() < highestPriority) {
|
||||
highestPriorityHandle = &sSpkHandles[i];
|
||||
highestPriority = sSpkHandles[i]->getPriority();
|
||||
}
|
||||
}
|
||||
|
||||
return highestPriorityHandle;
|
||||
}
|
||||
|
||||
SpkSoundHandle* Z2AudioCS::getHandleSoundID(s32 soundNum) {
|
||||
JUT_ASSERT(145, JASGlobalInstance<SpkSystem>::getInstance());
|
||||
JUT_ASSERT(146, sSpkHandles);
|
||||
|
||||
for (s32 i = 0; i < HANDLES_MAX; i++) {
|
||||
if (!sSpkHandles[i].isSoundAttached()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sSpkHandles[i]->getSoundNum() == soundNum) {
|
||||
return &sSpkHandles[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SpkSoundHandle* Z2AudioCS::start(s32 id, s32 chan) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (sSpkHandles == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (l_spkVolume == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OS_REPORT("[Z2AudioCS::start] id:%d ch:%d\n", id, chan);
|
||||
SpkSoundHandle* handle = getFreeSpkHandle();
|
||||
JUT_ASSERT(172, handle);
|
||||
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->startSound(chan, id, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
SpkSoundHandle* Z2AudioCS::startLevel(s32 id, s32 chan) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (sSpkHandles == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (l_spkVolume == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OS_REPORT("[Z2AudioCS::startLevel] id:%d ch:%d\n", id, chan);
|
||||
|
||||
SpkSoundHandle* handle = getHandleSoundID(id);
|
||||
if (handle == NULL) {
|
||||
handle = getFreeSpkHandle();
|
||||
}
|
||||
JUT_ASSERT(191, handle);
|
||||
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->startLevelSound(chan, id, handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
s32 Z2AudioCS::getName(s32 num) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance()->getData() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return JASGlobalInstance<SpkSystem>::getInstance()->getData()->getTableMgr().getName(num);
|
||||
}
|
||||
|
||||
s32 Z2AudioCS::getNumOfSound(void) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance()->getData() == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return JASGlobalInstance<SpkSystem>::getInstance()->getData()->getTableMgr().getNumOfSound();
|
||||
}
|
||||
|
||||
void Z2AudioCS::stopAll(s32 chan, s32 msec) {
|
||||
if (JASGlobalInstance<SpkSystem>::getInstance() == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
JASGlobalInstance<SpkSystem>::getInstance()->stopAll(chan, msec);
|
||||
}
|
||||
|
||||
void Z2AudioCS::stop(s32 chan) {
|
||||
stopAll(chan, 0);
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "Z2AudioLib/Z2FxLineMgr.h"
|
||||
#include "m_Do/m_Do_ext.h"
|
||||
#include <cstring>
|
||||
|
||||
Z2AudioArcLoader::Z2AudioArcLoader(JAUSection* section) : JAUAudioArcLoader(section) {}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "Z2AudioLib/Z2SoundHandles.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
Z2AudioMgr* Z2AudioMgr::mAudioMgrPtr;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
void Z2CreatureLink::setLinkGroupInfo(u8) {}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Z2AudioLib/Z2SoundObjMgr.h"
|
||||
#include "Z2AudioLib/Z2StatusMgr.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include <cstring>
|
||||
|
||||
Z2SceneMgr::Z2SceneMgr() : JASGlobalInstance<Z2SceneMgr>(true) {
|
||||
sceneNum = -1;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
static void dummy() {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Z2AudioLib/Z2Calc.h"
|
||||
#include "Z2AudioLib/Z2SceneMgr.h"
|
||||
#include "Z2AudioLib/Z2LinkMgr.h"
|
||||
#include <cstring>
|
||||
|
||||
Z2SoundObjMgr::Z2SoundObjMgr() : JASGlobalInstance<Z2SoundObjMgr>(true) {
|
||||
ghostEnemyState_ = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "Z2AudioCS/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
Z2SoundObjBase::Z2SoundObjBase()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Z2AudioLib/Z2Param.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_s_play.h"
|
||||
#include <cstring>
|
||||
|
||||
static const char* sSpotName[] = {
|
||||
"F_SP00",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "m_Do/m_Do_ext.h"
|
||||
#include <cstring>
|
||||
|
||||
#if DEBUG
|
||||
#include "f_pc/f_pc_debug_sv.h"
|
||||
|
||||
+835
-756
File diff suppressed because it is too large
Load Diff
+94
-100
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JHostIO/JORFile.h"
|
||||
#include "d/actor/d_a_alink.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include <cstring>
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@@ -685,16 +686,16 @@ void daAlinkHIO_cutNormal_c::genMessage(JORMContext* ctx) {
|
||||
daAlinkHIO_cutNormal_c::daAlinkHIO_cutNormal_c(int param_0, float param_1) {
|
||||
field_0x34 = param_1;
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmV_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmL_c0::m = {\n";
|
||||
static const char plabel2[] = "const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmR_c0::m = {\n";
|
||||
static const char plabel3[] = "const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmSL_c0::m = {\n";
|
||||
static const char plabel4[] = "const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmSR_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1, plabel2, plabel3, plabel4};
|
||||
static void* baseP[5] = {(void*)&daAlinkHIO_cutNmV_c0::m, (void*)&daAlinkHIO_cutNmL_c0::m,
|
||||
(void*)&daAlinkHIO_cutNmR_c0::m, (void*)&daAlinkHIO_cutNmSL_c0::m,
|
||||
(void*)&daAlinkHIO_cutNmSR_c0::m};
|
||||
|
||||
static const char* plabel[] = {"const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmSL_c0::m = {\n",
|
||||
"const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmV_c0::m = {\n",
|
||||
"const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmL_c0::m = {\n",
|
||||
"const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmSR_c0::m = {\n",
|
||||
"const daAlinkHIO_cutNormal_c1 daAlinkHIO_cutNmR_c0::m = {\n"};
|
||||
|
||||
m_len = 32;
|
||||
mp_src_data = baseP[param_0];
|
||||
mp_data = (void*)&m;
|
||||
@@ -734,19 +735,18 @@ void daAlinkHIO_cutFinish_c::genMessage(JORMContext* ctx) {
|
||||
daAlinkHIO_cutFinish_c::daAlinkHIO_cutFinish_c(int param_0, float param_1) {
|
||||
field_0x34 = param_1;
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnL_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnV_c0::m = {\n";
|
||||
static const char plabel2[] = "const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnS_c0::m = {\n";
|
||||
static const char plabel3[] = "const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnSl_c0::m = {\n";
|
||||
static const char plabel4[] = "const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnSm_c0::m = {\n";
|
||||
static const char plabel5[] = "const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnR_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1, plabel2, plabel3, plabel4, plabel5};
|
||||
|
||||
static void* baseP[6] = {(void*)&daAlinkHIO_cutFnL_c0::m, (void*)&daAlinkHIO_cutFnV_c0::m,
|
||||
(void*)&daAlinkHIO_cutFnS_c0::m, (void*)&daAlinkHIO_cutFnSl_c0::m,
|
||||
(void*)&daAlinkHIO_cutFnSm_c0::m, (void*)&daAlinkHIO_cutFnR_c0::m};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnL_c0::m = {\n",
|
||||
"const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnV_c0::m = {\n",
|
||||
"const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnS_c0::m = {\n",
|
||||
"const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnSl_c0::m = {\n",
|
||||
"const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnSm_c0::m = {\n",
|
||||
"const daAlinkHIO_cutFinish_c1 daAlinkHIO_cutFnR_c0::m = {\n",
|
||||
};
|
||||
|
||||
m_len = 44;
|
||||
mp_src_data = baseP[param_0];
|
||||
mp_data = (void*)&m;
|
||||
@@ -826,18 +826,17 @@ void daAlinkHIO_cutDash_c::genMessage(JORMContext* ctx) {
|
||||
daAlinkHIO_cutDash_c::daAlinkHIO_cutDash_c(int param_0, float param_1) {
|
||||
field_0x34 = param_1;
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_cutDash_c1 daAlinkHIO_cutDaL_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_cutDash_c1 daAlinkHIO_cutDaR_c0::m = {\n";
|
||||
static const char plabel2[] = "const daAlinkHIO_cutDash_c1 daAlinkHIO_cutDaCharge_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1, plabel2};
|
||||
|
||||
static void* baseP[3] = {
|
||||
(void*)&daAlinkHIO_cutDaL_c0::m,
|
||||
(void*)&daAlinkHIO_cutDaR_c0::m,
|
||||
(void*)&daAlinkHIO_cutDaCharge_c0::m,
|
||||
};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_cutDash_c1 daAlinkHIO_cutDaL_c0::m = {\n",
|
||||
"const daAlinkHIO_cutDash_c1 daAlinkHIO_cutDaR_c0::m = {\n",
|
||||
"const daAlinkHIO_cutDash_c1 daAlinkHIO_cutDaCharge_c0::m = {\n",
|
||||
};
|
||||
|
||||
m_len = 28;
|
||||
mp_src_data = baseP[param_0];
|
||||
mp_data = (void*)&m;
|
||||
@@ -983,6 +982,12 @@ void daAlinkHIO_hoCut_c::genMessage(JORMContext* ctx) {
|
||||
daAlinkHIO_hoCut_c::daAlinkHIO_hoCut_c(int param_0, float param_1) {
|
||||
field_0x34 = param_1;
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutLA_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutLB_c0::m = {\n";
|
||||
static const char plabel2[] = "const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutRA_c0::m = {\n";
|
||||
static const char plabel3[] = "const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutRB_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1, plabel2, plabel3};
|
||||
|
||||
static void* baseP[4] = {
|
||||
(void*)&daAlinkHIO_hoCutLA_c0::m,
|
||||
(void*)&daAlinkHIO_hoCutLB_c0::m,
|
||||
@@ -990,13 +995,6 @@ daAlinkHIO_hoCut_c::daAlinkHIO_hoCut_c(int param_0, float param_1) {
|
||||
(void*)&daAlinkHIO_hoCutRB_c0::m,
|
||||
};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutLA_c0::m = {\n",
|
||||
"const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutLB_c0::m = {\n",
|
||||
"const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutRA_c0::m = {\n",
|
||||
"const daAlinkHIO_hoCut_c1 daAlinkHIO_hoCutRB_c0::m = {\n",
|
||||
};
|
||||
|
||||
m_len = 32;
|
||||
mp_src_data = baseP[param_0];
|
||||
mp_data = (void*)&m;
|
||||
@@ -1357,16 +1355,15 @@ void daAlinkHIO_guardAttack_c::genMessage(JORMContext* ctx) {
|
||||
daAlinkHIO_guardAttack_c::daAlinkHIO_guardAttack_c(int param_0, float param_1) {
|
||||
field_0x34 = param_1;
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_guardAttack_c1 daAlinkHIO_gAtPush_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_guardAttack_c1 daAlinkHIO_gAtKick_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1};
|
||||
|
||||
static void* baseP[2] = {
|
||||
(void*)&daAlinkHIO_gAtPush_c0::m,
|
||||
(void*)&daAlinkHIO_gAtKick_c0::m,
|
||||
};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_guardAttack_c1 daAlinkHIO_gAtPush_c0::m = {\n",
|
||||
"const daAlinkHIO_guardAttack_c1 daAlinkHIO_gAtKick_c0::m = {\n",
|
||||
};
|
||||
|
||||
m_len = 36;
|
||||
mp_src_data = baseP[param_0];
|
||||
mp_data = (void*)&m;
|
||||
@@ -1385,24 +1382,24 @@ daAlinkHIO_guardAttack_c::daAlinkHIO_guardAttack_c(int param_0, float param_1) {
|
||||
void daAlinkHIO_turnMove_c::genMessage(JORMContext* ctx) {
|
||||
// Reset
|
||||
ctx->genButton("リセット", 0x4000003);
|
||||
//
|
||||
daAlinkHIO_setAnmGenMessage((daAlinkHIO_anm_c*)(this + 0x34), ctx, "回込", 27.0, 1);
|
||||
//
|
||||
ctx->genSlider("半回転回込A速度", (float*)(this + 0x50), 0.0, 10.0);
|
||||
//
|
||||
ctx->genSlider("斬上げCF", (float*)(this + 0x54), 0.0, 28.0);
|
||||
//
|
||||
ctx->genSlider("回転速度率", (short*)(this + 0x48), 0, 100);
|
||||
//
|
||||
ctx->genSlider("回転速度最大", (short*)(this + 0x4a), 0, 0x7fff);
|
||||
//
|
||||
ctx->genSlider("回転速度最小", (short*)(this + 0x4c), 0, 0x7fff);
|
||||
//
|
||||
ctx->genSlider("半回転速度最大", (short*)(this + 0x4e), 0, 0x7fff);
|
||||
//
|
||||
ctx->genSlider("通常側転A速度", (float*)(this + 0x58), 0.0, 10.0);
|
||||
//
|
||||
ctx->genSlider("通常側転速度", (float*)(this + 0x5c), 0.0, 100.0);
|
||||
// Return
|
||||
daAlinkHIO_setAnmGenMessage(&m.mTurnAnm, ctx, "回込", 27.0f, 1);
|
||||
// Half-turn rotation A speed
|
||||
ctx->genSlider("半回転回込A速度", &m.mHalfTurnAnmSpeed, 0.0f, 10.0f);
|
||||
// Slash up CF
|
||||
ctx->genSlider("斬上げCF", &m.mTwirlCutDelayF, 0.0f, 28.0f);
|
||||
// Rotation speed
|
||||
ctx->genSlider("回転速度率", &m.mTurnSpeedRate, 0, 100);
|
||||
// Maximum rotation speed
|
||||
ctx->genSlider("回転速度最大", &m.mMaxTurnSpeed, 0, 0x7fff);
|
||||
// Minimum rotation speed
|
||||
ctx->genSlider("回転速度最小", &m.mMinTurnSpeed, 0, 0x7fff);
|
||||
// Half rotation speed maximum
|
||||
ctx->genSlider("半回転速度最大", &m.mMaxHalfTurnSpeed, 0, 0x7fff);
|
||||
// Normal side roll A speed
|
||||
ctx->genSlider("通常側転A速度", &m.mSideRollAnmSpeed, 0.0f, 10.0f);
|
||||
// Normal side roll speed
|
||||
ctx->genSlider("通常側転速度", &m.mSideRollSpeed, 0.0f, 100.0f);
|
||||
}
|
||||
|
||||
daAlinkHIO_turnMove_c::daAlinkHIO_turnMove_c() {
|
||||
@@ -1929,16 +1926,16 @@ void daAlinkHIO_damLaHu_c::genMessage(JORMContext* ctx) {
|
||||
}
|
||||
|
||||
daAlinkHIO_damLaHu_c::daAlinkHIO_damLaHu_c(int param_0) {
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_damLaHu_c1 daAlinkHIO_damLarge_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_damLaHu_c1 daAlinkHIO_damHuge_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1};
|
||||
|
||||
static void* baseP[2] = {
|
||||
(void*)&daAlinkHIO_damLarge_c0::m,
|
||||
(void*)&daAlinkHIO_damHuge_c0::m,
|
||||
};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_guardAttack_c1 daAlinkHIO_damLarge_c0::m = {\n",
|
||||
"const daAlinkHIO_guardAttack_c1 daAlinkHIO_damHuge_c0::m = {\n",
|
||||
};
|
||||
|
||||
m_len = 188;
|
||||
mp_src_data = baseP[param_0];
|
||||
mp_data = (void*)&m;
|
||||
@@ -2083,8 +2080,8 @@ void daAlinkHIO_damSwim_c::genMessage(JORMContext* ctx) {
|
||||
ctx->genSlider("最高速", &m.mMaxSpeed, 0.0f, 30.0f);
|
||||
// Deceleration
|
||||
ctx->genSlider("減速", &m.mDeceleration, 0.0f, 10.0f);
|
||||
// Sink
|
||||
daAlinkHIO_setAnmGenMessage(&m.mSinkAnm, ctx, "下沈", 10.0f, 0);
|
||||
// Swimming
|
||||
daAlinkHIO_setAnmGenMessage(&m.mSinkAnm, ctx, "泳ぎ", 10.0f, 0);
|
||||
// Water surface
|
||||
daAlinkHIO_setAnmGenMessage(&m.mSurfaceAnm, ctx, "水面", 11.0f, 1);
|
||||
}
|
||||
@@ -2129,8 +2126,8 @@ void daAlinkHIO_damage_c::genMessage(JORMContext* ctx) {
|
||||
ctx->genSlider("無敵時間", &m.mInvincibleTime, 0, 0x96);
|
||||
// Wolf floor invincible time
|
||||
ctx->genSlider("狼ポリゴン時無敵時間", &m.mWolfFloorInvincibleTime, 0, 0x96);
|
||||
// Floor get up
|
||||
daAlinkHIO_setAnmGenMessage(&m.mFloorDmgAnm, ctx, "床起き", 14.0f, 1);
|
||||
// Floor
|
||||
daAlinkHIO_setAnmGenMessage(&m.mFloorDmgAnm, ctx, "床", 14.0f, 1);
|
||||
// Dash
|
||||
daAlinkHIO_setAnmGenMessage(&m.mDashDmgAnm, ctx, "ダッシュ", 9.0f, 0);
|
||||
// Recover stand anm speed
|
||||
@@ -2421,8 +2418,8 @@ void daAlinkHIO_bomb_c::genMessage(JORMContext* ctx) {
|
||||
ctx->genSlider("投げ水平速度", &m.mThrowSpeedH, 0.0f, 100.0f);
|
||||
// Throw vertical speed
|
||||
ctx->genSlider("投げ垂直速度", &m.mThrowSpeedV, 0.0f, 100.0f);
|
||||
// Bound rate
|
||||
ctx->genSlider("バウンド率", &m.mBoundRate, 0.0f, 1.0f);
|
||||
// Bounce rate
|
||||
ctx->genSlider("跳返率", &m.mBoundRate, 0.0f, 1.0f);
|
||||
// Vertical stop speed
|
||||
ctx->genSlider("垂直停止速度", &m.mStopSpeedY, 0.0f, 20.0f);
|
||||
// Bounce time max speed
|
||||
@@ -2520,17 +2517,16 @@ void daAlinkHIO_light_c::genMessage(JORMContext* ctx) {
|
||||
}
|
||||
|
||||
daAlinkHIO_light_c::daAlinkHIO_light_c(int param_0) {
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_light_c1 daAlinkHIO_huLight_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_light_c1 daAlinkHIO_wlLight_c0::m = {\n";
|
||||
static const char plabel2[] = "const daAlinkHIO_light_c1 daAlinkHIO_zwLight_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1, plabel2};
|
||||
|
||||
static void* baseP[] = {
|
||||
(void*)&daAlinkHIO_huLight_c0::m,
|
||||
(void*)&daAlinkHIO_wlLight_c0::m,
|
||||
(void*)&daAlinkHIO_zwLight_c0::m,
|
||||
|
||||
};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_light_c1 daAlinkHIO_huLight_c0::m = {\n",
|
||||
"const daAlinkHIO_light_c1 daAlinkHIO_wlLight_c0::m = {\n",
|
||||
"const daAlinkHIO_light_c1 daAlinkHIO_zwLight_c0::m = {\n",
|
||||
};
|
||||
|
||||
m_len = 28;
|
||||
@@ -2994,19 +2990,19 @@ void daAlinkHIO_bottle_c::genMessage(JORMContext* ctx) {
|
||||
// Start drink
|
||||
daAlinkHIO_setAnmGenMessage(&m.mStartDrinkAnm, ctx, "飲む始め", 56.0f, 0);
|
||||
// End drink
|
||||
daAlinkHIO_setAnmGenMessage(&m.mEndDrinkAnm, ctx, "飲み終", 39.0f, 0);
|
||||
daAlinkHIO_setAnmGenMessage(&m.mEndDrinkAnm, ctx, "飲終", 39.0f, 0);
|
||||
// Milk end drink
|
||||
daAlinkHIO_setAnmGenMessage(&m.mEndDrinkAnm, ctx, "ミルク飲み終", 86.0f, 0);
|
||||
daAlinkHIO_setAnmGenMessage(&m.mEndDrinkAnm, ctx, "まずい飲終", 86.0f, 0);
|
||||
// Open
|
||||
daAlinkHIO_setAnmGenMessage(&m.mOpenBottleAnm, ctx, "開ける", 49.0f, 0);
|
||||
// Scoop
|
||||
daAlinkHIO_setAnmGenMessage(&m.mScoopAnm, ctx, "すくう", 54.0f, 0);
|
||||
daAlinkHIO_setAnmGenMessage(&m.mPourAnm, ctx, "出す", 54.0f, 0);
|
||||
// Swing down
|
||||
daAlinkHIO_setAnmGenMessage(&m.mSwingDownAnm, ctx, "下振り", 24.0f, 1);
|
||||
// Swing side
|
||||
daAlinkHIO_setAnmGenMessage(&m.mSwingSideAnm, ctx, "横振り", 19.0f, 1);
|
||||
// Medicine
|
||||
daAlinkHIO_setAnmGenMessage(&m.mDrinkNastyAnm, ctx, "くすり", 29.0f, 0);
|
||||
daAlinkHIO_setAnmGenMessage(&m.mScoopAnm, ctx, "掬う", 29.0f, 0);
|
||||
// Get
|
||||
daAlinkHIO_setAnmGenMessage(&m.mGetAnm, ctx, "ゲット", 47.0f, 0);
|
||||
}
|
||||
@@ -3238,26 +3234,26 @@ void daAlinkHIO_grab_c::genMessage(JORMContext* ctx) {
|
||||
ctx->genSlider("強制重さ指定", &m.mForceWeightSpec, 0, 3);
|
||||
// Preparation
|
||||
daAlinkHIO_setAnmGenMessage(&m.mPrepareAnm, ctx, "準備", 4.0f, 0);
|
||||
// Lift up
|
||||
daAlinkHIO_setAnmGenMessage(&m.mLiftAnm, ctx, "持上", 9.0f, 1);
|
||||
// Lift
|
||||
daAlinkHIO_setAnmGenMessage(&m.mLiftBackAnm, ctx, "持上", 9.0f, 1);
|
||||
// Throw
|
||||
daAlinkHIO_setAnmGenMessage(&m.mThrowAnm, ctx, "投げる", 39.0f, 1);
|
||||
// Carry
|
||||
daAlinkHIO_setAnmGenMessage(&m.mCarryAnm, ctx, "運び", 12.0f, 1);
|
||||
// Lift back
|
||||
daAlinkHIO_setReverseAnmGenMessage(&m.mLiftBackAnm, ctx, "持ち上げ後", 9.0f, 0);
|
||||
// Stand reverse
|
||||
daAlinkHIO_setAnmGenMessage(&m.mLiftAnm, ctx, "投げる", 39.0f, 1);
|
||||
// One-handed throw
|
||||
daAlinkHIO_setAnmGenMessage(&m.mCarryPlaceReverseAnm, ctx, "片手投げ", 12.0f, 1);
|
||||
// Place
|
||||
daAlinkHIO_setReverseAnmGenMessage(&m.mThrowAnm, ctx, "置く", 9.0f, 0);
|
||||
// Stand
|
||||
daAlinkHIO_setReverseAnmGenMessage(&m.mStandReverseAnm, ctx, "立つ", 4.0f, 1);
|
||||
// Recoil
|
||||
daAlinkHIO_setAnmGenMessage(&m.mRecoilAnm, ctx, "反動", 19.0f, 1);
|
||||
daAlinkHIO_setAnmGenMessage(&m.mCarryAnm, ctx, "反動", 19.0f, 1);
|
||||
// Failure
|
||||
daAlinkHIO_setAnmGenMessage(&m.mFailAnm, ctx, "失敗", 19.0f, 1);
|
||||
daAlinkHIO_setAnmGenMessage(&m.mRecoilAnm, ctx, "失敗", 19.0f, 1);
|
||||
// Failure stop time
|
||||
ctx->genSlider("失敗停止時間", &m.mFailStopTime, 0, 300);
|
||||
// Carry lift
|
||||
daAlinkHIO_setAnmGenMessage(&m.mCarryLiftAnm, ctx, "抱え上げ", 39.0f, 0);
|
||||
// Carry place reverse
|
||||
daAlinkHIO_setReverseAnmGenMessage(&m.mCarryPlaceReverseAnm, ctx, "抱え置き", 39.0f, 1);
|
||||
// Lift up
|
||||
daAlinkHIO_setAnmGenMessage(&m.mFailAnm, ctx, "抱え上げ", 39.0f, 0);
|
||||
// Hold
|
||||
daAlinkHIO_setReverseAnmGenMessage(&m.mCarryLiftAnm, ctx, "抱え置き", 39.0f, 1);
|
||||
// Iron ball throw
|
||||
daAlinkHIO_setAnmGenMessage(&m.mIronBallThrowAnm, ctx, "鉄玉投げ", 49.0f, 1);
|
||||
}
|
||||
@@ -4010,16 +4006,15 @@ void daAlinkHIO_wlDamLaHu_c::genMessage(JORMContext* ctx) {
|
||||
}
|
||||
|
||||
daAlinkHIO_wlDamLaHu_c::daAlinkHIO_wlDamLaHu_c(int param_0) {
|
||||
static const char plabel0[] = "const daAlinkHIO_wlDamLaHu_c1 daAlinkHIO_wlDamLarge_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_wlDamLaHu_c1 daAlinkHIO_wlDamHuge_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1};
|
||||
|
||||
static void* baseP[] = {
|
||||
(void*)&daAlinkHIO_wlDamLarge_c0::m,
|
||||
(void*)&daAlinkHIO_wlDamHuge_c0::m,
|
||||
};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_wlDamLaHu_c1 daAlinkHIO_wlDamLarge_c0::m = {\n",
|
||||
"const daAlinkHIO_wlDamLaHu_c1 daAlinkHIO_wlDamHuge_c0::m = {\n",
|
||||
};
|
||||
|
||||
m_len = 108;
|
||||
mp_src_data = baseP[param_0];
|
||||
mp_data = (void*)&m;
|
||||
@@ -4278,16 +4273,15 @@ void daAlinkHIO_wlAtWait_c::genMessage(JORMContext* ctx) {
|
||||
daAlinkHIO_wlAtWait_c::daAlinkHIO_wlAtWait_c(int param_0, float param_1) {
|
||||
field_0x34 = param_1;
|
||||
|
||||
static const char plabel0[] = "const daAlinkHIO_wlAtWait_c1 daAlinkHIO_wlAtWaLr_c0::m = {\n";
|
||||
static const char plabel1[] = "const daAlinkHIO_wlAtWait_c1 daAlinkHIO_wlAtWaSc_c0::m = {\n";
|
||||
static const char plabel2[] = "const daAlinkHIO_wlAtWait_c1 daAlinkHIO_wlAtWaTl_c0::m = {\n";
|
||||
static const char* plabel[] = {plabel0, plabel1, plabel2};
|
||||
|
||||
static void* baseP[] = {
|
||||
(void*)&daAlinkHIO_wlAtWaLr_c0::m,
|
||||
(void*)&daAlinkHIO_wlAtWaTl_c0::m,
|
||||
(void*)&daAlinkHIO_wlAtWaSc_c0::m,
|
||||
};
|
||||
|
||||
static const char* plabel[] = {
|
||||
"const daAlinkHIO_cutNormal_c1 daAlinkHIO_wlAtWaLr_c0::m = {\n",
|
||||
"const daAlinkHIO_cutNormal_c1 daAlinkHIO_wlAtWaTl_c0::m = {\n",
|
||||
"const daAlinkHIO_cutNormal_c1 daAlinkHIO_wlAtWaSc_c0::m = {\n",
|
||||
(void*)&daAlinkHIO_wlAtWaTl_c0::m,
|
||||
};
|
||||
|
||||
m_len = 60;
|
||||
@@ -5043,7 +5037,7 @@ daAlinkHIO_wlMoveNoP_c::~daAlinkHIO_wlMoveNoP_c() {}
|
||||
daAlinkHIO_wlMove_c::~daAlinkHIO_wlMove_c() {}
|
||||
|
||||
void daAlinkHIO_c::jumpStateUpdate(const cXyz* param_0, const cXyz* param_1, f32 param_2) {
|
||||
char buf[68];
|
||||
char buf[64];
|
||||
|
||||
f32 xDiff = param_0->x - param_1->x;
|
||||
f32 zDiff = param_0->z - param_1->z;
|
||||
|
||||
@@ -23,6 +23,7 @@ int daAlink_c::bottleModelCallBack() {
|
||||
|
||||
static int daAlink_bottleModelCallBack(J3DJoint* i_joint, int param_1) {
|
||||
UNUSED(i_joint);
|
||||
UNUSED(param_1);
|
||||
|
||||
daAlink_c* player_p = (daAlink_c*)j3dSys.getModel()->getUserArea();
|
||||
|
||||
@@ -568,7 +569,7 @@ int daAlink_c::procBottleSwingInit(fopAc_ac_c* i_catchActor, int param_1) {
|
||||
catchActorName = PROC_ALINK;
|
||||
}
|
||||
|
||||
if (catchActorName == PROC_OBJ_OILTUBO || catchActorName == PROC_TAG_SSDRINK ||
|
||||
if (catchActorName == PROC_TAG_SSDRINK || catchActorName == PROC_OBJ_OILTUBO ||
|
||||
catchActorName == PROC_TAG_BTLITM || mEquipItem == fpcNm_ITEM_KANTERA)
|
||||
{
|
||||
setSingleAnimeParam(ANM_BOTTLE_SCOOP, &mpHIO->mItem.mBottle.m.mScoopAnm);
|
||||
|
||||
@@ -352,6 +352,7 @@ BOOL daAlink_c::checkUpperItemActionBow() {
|
||||
if (mEquipItem == fpcNm_ITEM_BOW) {
|
||||
field_0x301e = 0;
|
||||
}
|
||||
(void)0;
|
||||
} else {
|
||||
changeArrowType();
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ int daAlink_c::procCanoeRide() {
|
||||
if (checkAnmEnd(frameCtrl)) {
|
||||
procCanoeWaitInit(1);
|
||||
} else if (frameCtrl->getFrame() < 9.0f) {
|
||||
mProcVar3.field_0x300e += (s16)0x180;
|
||||
ANGLE_ADD(mProcVar3.field_0x300e, 0x180);
|
||||
|
||||
if (mProcVar0.field_0x3008 == 0) {
|
||||
canoe->incShapeAngleZ(-mProcVar3.field_0x300e);
|
||||
@@ -483,11 +483,11 @@ int daAlink_c::procCanoeGetOffInit() {
|
||||
}
|
||||
|
||||
if (var_r27) {
|
||||
shape_angle.y -= (s16)0x4000;
|
||||
ANGLE_SUB(shape_angle.y, 0x4000);
|
||||
setOldRootQuaternion(0, 0x4000, 0);
|
||||
var_r28->mTranslate.x -= 100.0f;
|
||||
} else {
|
||||
shape_angle.y += (s16)0x4000;
|
||||
ANGLE_ADD(shape_angle.y, 0x4000);
|
||||
setOldRootQuaternion(0, -0x4000, 0);
|
||||
var_r28->mTranslate.x += 100.0f;
|
||||
}
|
||||
|
||||
@@ -389,12 +389,19 @@ void daAlink_c::setCrawlMoveAngle() {
|
||||
}
|
||||
|
||||
mLinkGndChk.SetPos(&sp20);
|
||||
// Fakematch:
|
||||
// dBgS::GroundCross is implicitly inlined to cBgS::GroundCross, but for some
|
||||
// reason here that breaks the match. This is the only place in the code so
|
||||
// far (September 2025) where it causes issues.
|
||||
sp2C.set(sp20.x - sp38.x, dComIfG_Bgsp().cBgS::GroundCross(&mLinkGndChk) - sp38.y,
|
||||
#if PLATFORM_SHIELD
|
||||
sp2C.set(sp20.x - sp38.x, dComIfG_Bgsp().GroundCross(&mLinkGndChk) - sp38.y,
|
||||
sp20.z - sp38.z);
|
||||
#else
|
||||
// Likely fakematch:
|
||||
// dBgS::GroundCross is implicitly inlined to cBgS::GroundCross, but for some
|
||||
// reason here that breaks instruction ordering. This is the only place in the code
|
||||
// where it causes issues.
|
||||
// It _is_ possible that this is caused by an actual version difference in Shield, given
|
||||
// that the Wii versions need the cast but Shield prod does not.
|
||||
sp2C.set(sp20.x - sp38.x, ((cBgS&)dComIfG_Bgsp()).GroundCross(&mLinkGndChk) - sp38.y,
|
||||
sp20.z - sp38.z);
|
||||
#endif
|
||||
|
||||
if (cLib_distanceAngleS(sp2C.atan2sY_XZ(), shape_angle.x) > 0x800) {
|
||||
shape_angle.y = current.angle.y;
|
||||
@@ -458,7 +465,7 @@ void daAlink_c::setCrawlAutoMoveAimPos() {
|
||||
mProcVar3.field_0x300e = 0;
|
||||
mProcVar0.field_0x3008 = -1;
|
||||
} else if ((shape_angle.y == current.angle.y && direction == DIR_BACKWARD) || (shape_angle.y != current.angle.y && direction == DIR_FORWARD)) {
|
||||
current.angle.y += 0x8000;
|
||||
ANGLE_ADD_2(current.angle.y, 0x8000);
|
||||
field_0x37c8.x -= 1.5f * (95.0f * cM_ssin(current.angle.y));
|
||||
field_0x37c8.z -= 1.5f * (95.0f * cM_scos(current.angle.y));
|
||||
|
||||
|
||||
@@ -1233,6 +1233,7 @@ int daAlink_c::procCutFinishInit(int i_type) {
|
||||
field_0x3588 = l_halfAtnWaitBaseAnime;
|
||||
|
||||
if (mCutType == CUT_TYPE_MORTAL_DRAW_A || mCutType == CUT_TYPE_FINISH_STAB) {
|
||||
int dummy; // dummy decl to force stack pointer into r31 for debug
|
||||
field_0x2f99 = 13;
|
||||
}
|
||||
|
||||
@@ -1586,7 +1587,7 @@ int daAlink_c::procCutJump() {
|
||||
daPy_frameCtrl_c* framectrl = mUnderFrameCtrl;
|
||||
|
||||
if (current.angle.y == shape_angle.y && changeCutReverseProc(ANM_CUT_JUMP)) {
|
||||
current.angle.y += 0x8000;
|
||||
ANGLE_ADD_2(current.angle.y, 0x8000);
|
||||
mNormalSpeed = 27.0f;
|
||||
dComIfGp_getVibration().StartShock(VIBMODE_S_POWER5, 31, cXyz(0.0f, 1.0f, 0.0f));
|
||||
} else if (current.angle.y != shape_angle.y) {
|
||||
|
||||
@@ -45,11 +45,11 @@ void daAlink_c::freezeTimerDamage() {
|
||||
}
|
||||
|
||||
if (escapeTrigger()) {
|
||||
mProcVar0.field_0x3008 -= (s16)2;
|
||||
S16_SUB(mProcVar0.field_0x3008, 2);
|
||||
}
|
||||
|
||||
if (checkInputOnR() && abs((s16)(mStickAngle - mPrevStickAngle)) > 0x1000) {
|
||||
mProcVar0.field_0x3008 -= (s16)2;
|
||||
S16_SUB(mProcVar0.field_0x3008, 2);
|
||||
}
|
||||
|
||||
if (mProcVar0.field_0x3008 < 0) {
|
||||
@@ -504,7 +504,7 @@ BOOL daAlink_c::checkDamageAction() {
|
||||
poly_dmg_flags = 0;
|
||||
}
|
||||
} else if (mIceDamageWaitTimer > 3) {
|
||||
mIceDamageWaitTimer -= (s16)3;
|
||||
S16_SUB(mIceDamageWaitTimer, 3);
|
||||
} else {
|
||||
mIceDamageWaitTimer = 0;
|
||||
}
|
||||
@@ -1656,7 +1656,7 @@ int daAlink_c::procCoElecDamageInit(fopAc_ac_c* i_tgHitActor, dCcD_GObjInf* i_tg
|
||||
|
||||
if (getZoraSwim()) {
|
||||
current.pos.y += 50.0f;
|
||||
field_0x3080 += (s16)0x4000;
|
||||
ANGLE_ADD(field_0x3080, 0x4000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1805,7 +1805,7 @@ int daAlink_c::procDkCaught() {
|
||||
f32 var_f30;
|
||||
if (checkInputOnR()) {
|
||||
if (getDirectionFromCurrentAngle() == DIR_BACKWARD) {
|
||||
current.angle.y += 0x8000;
|
||||
ANGLE_ADD_2(current.angle.y, 0x8000);
|
||||
mNormalSpeed *= -1.0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "d/actor/d_a_npc_zra.h"
|
||||
#include "d/actor/d_a_obj_tks.h"
|
||||
#include "d/actor/d_a_npc_tkc.h"
|
||||
#include <cstring>
|
||||
|
||||
BOOL daAlink_c::checkEventRun() const {
|
||||
return dComIfGp_event_runCheck() || checkPlayerDemoMode();
|
||||
@@ -268,10 +269,10 @@ int daAlink_c::checkDemoAction() {
|
||||
}
|
||||
|
||||
// TODO: reconcile
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
int type = prm0 - 20;
|
||||
if (type >= 0 && type < 6) {
|
||||
return procCutFinishInit(type);
|
||||
#if VERSION == VERSION_SHIELD_DEBUG || 1
|
||||
prm0 -= 20;
|
||||
if (prm0 >= 0 && prm0 < 6) {
|
||||
return procCutFinishInit(prm0);
|
||||
} else {
|
||||
return procCutTurnInit(1, 1);
|
||||
}
|
||||
@@ -364,7 +365,13 @@ int daAlink_c::checkDemoAction() {
|
||||
return procCutLargeJumpChargeInit();
|
||||
} else if (demoMode == daPy_demo_c::DEMO_UNK_73_e) {
|
||||
onNoResetFlg0(FLG0_UNK_100000);
|
||||
return procSideRollInit(mDemo.getParam0() ? 3 : 2);
|
||||
int temp;
|
||||
if (!mDemo.getParam0()) {
|
||||
temp = 2;
|
||||
} else {
|
||||
temp = 3;
|
||||
}
|
||||
return procSideRollInit(temp);
|
||||
} else if (demoMode == daPy_demo_c::DEMO_UNK_16_e) {
|
||||
onNoResetFlg0(FLG0_UNK_100000);
|
||||
if (checkWolf()) {
|
||||
@@ -584,6 +591,7 @@ void daAlink_c::setDemoData() {
|
||||
if (mMidnaTalkDelayTimer != 0) {
|
||||
mMidnaTalkDelayTimer--;
|
||||
}
|
||||
(void)0;
|
||||
} else {
|
||||
dDemo_actor_c* demo_actor_p = dDemo_c::getActor(demoActorID);
|
||||
cXyz* pos_p = NULL;
|
||||
@@ -763,6 +771,7 @@ void daAlink_c::setDemoData() {
|
||||
dComIfGp_evmng_cutEnd(mAlinkStaffId);
|
||||
}
|
||||
}
|
||||
(void)0;
|
||||
} else {
|
||||
if (mDemo.getDemoType() == daPy_demo_c::DEMO_TYPE_TOOL_e || (mDemo.getDemoType() == daPy_demo_c::DEMO_TYPE_SYSTEM_e && mAlinkStaffId != -1)) {
|
||||
if (prm0_p != NULL) {
|
||||
@@ -1093,7 +1102,7 @@ void daAlink_c::setTalkAnime() {
|
||||
}
|
||||
}
|
||||
|
||||
u8 daAlink_c::setTradeItemAnime() {
|
||||
bool daAlink_c::setTradeItemAnime() {
|
||||
setSingleAnimeBase(ANM_TRADE_ITEM_PULL_OUT);
|
||||
offModeFlg(0x100);
|
||||
|
||||
@@ -1110,7 +1119,7 @@ u8 daAlink_c::setTradeItemAnime() {
|
||||
}
|
||||
|
||||
keepItemData();
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void daAlink_c::setTradeItemOutHand() {
|
||||
@@ -1146,7 +1155,7 @@ u8 daAlink_c::setDemoRightHandIndex(u16 param_0) {
|
||||
mProcVar4.field_0x3010 = 1;
|
||||
return 6;
|
||||
} else if (param_0 == 0xFC) {
|
||||
field_0x2fab |= 0x10;
|
||||
field_0x2fab |= (u8)0x10;
|
||||
return 5;
|
||||
} else if (param_0 == 0xFB) {
|
||||
if (mpDemoHRTmpModel != NULL) {
|
||||
@@ -1169,7 +1178,7 @@ u8 daAlink_c::setDemoLeftHandIndex(u16 param_0) {
|
||||
}
|
||||
return 0;
|
||||
} else if (param_0 == 0xFC) {
|
||||
field_0x2fab |= 0x8;
|
||||
field_0x2fab |= (u8)0x8;
|
||||
return 0;
|
||||
} else if (param_0 == 0xFB) {
|
||||
if (mpDemoHLTmpModel != NULL) {
|
||||
@@ -1527,11 +1536,11 @@ int daAlink_c::procCoToolDemo() {
|
||||
}
|
||||
} else if (arg1 == 7) {
|
||||
if (resID == 1) {
|
||||
field_0x2fab |= 2;
|
||||
field_0x2fab |= (u8)0x2;
|
||||
}
|
||||
} else if (arg1 == 8) {
|
||||
if (resID == 1) {
|
||||
field_0x2fab |= 1;
|
||||
field_0x2fab |= (u8)0x1;
|
||||
}
|
||||
} else if (arg1 == 0) {
|
||||
if (arg2 == 1) {
|
||||
@@ -2042,7 +2051,11 @@ void daAlink_c::setGetSubBgm(int i_itemNo) {
|
||||
/* fpcNm_ITEM_RED_BOTTLE */ SETYPE_ITEM_GET_MINI,
|
||||
/* fpcNm_ITEM_GREEN_BOTTLE */ SETYPE_ITEM_GET_MINI,
|
||||
/* fpcNm_ITEM_BLUE_BOTTLE */ SETYPE_ITEM_GET_MINI,
|
||||
#if PLATFORM_SHIELD
|
||||
/* fpcNm_ITEM_MILK_BOTTLE */ SETYPE_ITEM_GET,
|
||||
#else
|
||||
/* fpcNm_ITEM_MILK_BOTTLE */ SETYPE_ITEM_GET_MINI,
|
||||
#endif
|
||||
/* fpcNm_ITEM_HALF_MILK_BOTTLE */ SETYPE_ITEM_GET,
|
||||
/* fpcNm_ITEM_OIL_BOTTLE */ SETYPE_ITEM_GET_MINI,
|
||||
/* fpcNm_ITEM_WATER_BOTTLE */ SETYPE_NONE,
|
||||
@@ -2217,6 +2230,8 @@ void daAlink_c::setGetSubBgm(int i_itemNo) {
|
||||
}
|
||||
|
||||
BOOL daAlink_c::checkTreasureRupeeReturn(int i_itemNo) const {
|
||||
static const int dummy = 0;
|
||||
|
||||
if (i_itemNo == fpcNm_ITEM_LINKS_SAVINGS) {
|
||||
i_itemNo = fpcNm_ITEM_PURPLE_RUPEE;
|
||||
}
|
||||
@@ -3244,7 +3259,7 @@ int daAlink_c::procHandPatInit() {
|
||||
mNormalSpeed = 0.0f;
|
||||
|
||||
setOldRootQuaternion(0, -0x8000, 0);
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
mProcVar2.field_0x300c = 0;
|
||||
mProcVar3.field_0x300e = 0;
|
||||
return 1;
|
||||
@@ -3270,7 +3285,7 @@ int daAlink_c::procHandPat() {
|
||||
if (checkAnmEnd(frameCtrl_p)) {
|
||||
setSingleAnimeBase(ANM_WAIT_B_TO_A);
|
||||
mProcVar2.field_0x300c = 1;
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
mPrevAngleY = shape_angle.y;
|
||||
current.angle.y = shape_angle.y;
|
||||
setOldRootQuaternion(0, -0x8000, 0);
|
||||
@@ -3335,11 +3350,12 @@ int daAlink_c::procCoFogDead() {
|
||||
}
|
||||
}
|
||||
|
||||
int roomNo;
|
||||
if (mProcVar0.field_0x3008 > 0) {
|
||||
mProcVar0.field_0x3008--;
|
||||
} else if (mProcVar0.field_0x3008 == 0) {
|
||||
if (dStage_changeScene(daTagMist_c::getPlayerNo(), 0.0f, 5, fopAcM_GetRoomNo(this),
|
||||
shape_angle.y, -1))
|
||||
roomNo = fopAcM_GetRoomNo(this);
|
||||
if (dStage_changeScene(daTagMist_c::getPlayerNo(), 0.0f, 5, roomNo, shape_angle.y, -1))
|
||||
{
|
||||
seStartSystem(Z2SE_FORCE_BACK);
|
||||
mProcVar0.field_0x3008--;
|
||||
@@ -3600,7 +3616,7 @@ int daAlink_c::procWolfSnowEscape() {
|
||||
|
||||
if (checkAnmEnd(frameCtrl_p)) {
|
||||
setOldRootQuaternion(0, -0x8000, 0);
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
mPrevAngleY = shape_angle.y;
|
||||
current.angle.y = shape_angle.y;
|
||||
|
||||
@@ -4148,7 +4164,7 @@ int daAlink_c::procDungeonWarpInit() {
|
||||
}
|
||||
|
||||
int daAlink_c::procDungeonWarp() {
|
||||
mProcVar2.field_0x300c += (s16)0x200;
|
||||
ANGLE_ADD(mProcVar2.field_0x300c, 0x200);
|
||||
|
||||
if (mProcVar2.field_0x300c > 0x4000) {
|
||||
mProcVar2.field_0x300c = 0x4000;
|
||||
@@ -4157,7 +4173,7 @@ int daAlink_c::procDungeonWarp() {
|
||||
}
|
||||
|
||||
f32 sin = cM_ssin(mProcVar2.field_0x300c);
|
||||
shape_angle.y += (s16)(14336.0f * sin);
|
||||
ANGLE_ADD(shape_angle.y, 0x3800 * sin);
|
||||
mProcVar3.field_0x300e = 8.0f * sin + 24.0f * (1.0f - scale.x);
|
||||
|
||||
if (mProcVar5.field_0x3012 != 0) {
|
||||
@@ -4216,7 +4232,7 @@ int daAlink_c::procDungeonWarpSceneStartInit() {
|
||||
#endif
|
||||
|
||||
current.pos.y += 120.0f;
|
||||
shape_angle.y += 0x7F7A;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x7F7A);
|
||||
|
||||
scale.set(0.0f, 1.5f, 0.0f);
|
||||
mpLinkModel->setBaseScale(scale);
|
||||
@@ -4247,7 +4263,7 @@ int daAlink_c::procDungeonWarpSceneStart() {
|
||||
if (!var_r31) {
|
||||
current.pos.y -= 5.0f;
|
||||
} else {
|
||||
mProcVar2.field_0x300c -= 0x200;
|
||||
ANGLE_SUB_2(mProcVar2.field_0x300c, 0x200);
|
||||
if (mProcVar2.field_0x300c < 0) {
|
||||
return checkNextAction(0);
|
||||
}
|
||||
@@ -4256,7 +4272,7 @@ int daAlink_c::procDungeonWarpSceneStart() {
|
||||
}
|
||||
|
||||
f32 sin = cM_ssin(mProcVar2.field_0x300c);
|
||||
shape_angle.y += (s16)(sin * 14336.0f);
|
||||
ANGLE_ADD(shape_angle.y, sin * (f32)0x3800);
|
||||
mProcVar3.field_0x300e = (sin * 8.0f) + ((1.0f - scale.x) * 24.0f);
|
||||
return 1;
|
||||
}
|
||||
@@ -4336,7 +4352,7 @@ void daAlink_c::skipPortalObjWarp() {
|
||||
if (checkNoResetFlg3(FLG3_WARP_OBJ_DEMO) &&
|
||||
(dComIfGp_TargetWarpPt_get() == 9 && dComIfGp_TransportWarp_check()))
|
||||
{
|
||||
dStage_changeScene(2, 0.0f, 0, fopAcM_GetRoomNo(this), shape_angle.y, -1);
|
||||
dStage_changeScene(2, 0.0f, 0, (int)fopAcM_GetRoomNo(this), shape_angle.y, -1);
|
||||
} else {
|
||||
dComIfGs_setTurnRestart(dMeter2Info_getWarpPos(), dMeter2Info_getWarpPlayerNo(),
|
||||
dMeter2Info_getWarpRoomNo(), setParamData(dMeter2Info_getWarpRoomNo(), 0, 0xCA, 0));
|
||||
@@ -4605,8 +4621,9 @@ int daAlink_c::procCoWarp() {
|
||||
if (mDemo.getDemoMode() == daPy_demo_c::DEMO_UNK_45_e) {
|
||||
if (mProcVar1.field_0x300a != 0) {
|
||||
if (mGroundCode == 4) {
|
||||
dComIfGp_setNextStage(dComIfGp_getStartStageName(), mProcVar4.field_0x3010,
|
||||
fopAcM_GetRoomNo(this), -1, 0.0f, 5, 1, 0,
|
||||
dComIfGp_setNextStage(dComIfGp_getStartStageName(),
|
||||
mProcVar4.field_0x3010,
|
||||
(int)fopAcM_GetRoomNo(this), -1, 0.0f, 5, 1, 0,
|
||||
shape_angle.y, 1, 0);
|
||||
changeOriginalDemo();
|
||||
changeDemoMode(1, 0, 0, 0);
|
||||
|
||||
+145
-128
@@ -9,7 +9,7 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_k_wmark.h"
|
||||
|
||||
EffParamProc daAlink_c::m_fEffParamProc[] = {
|
||||
const EffParamProc daAlink_c::m_fEffParamProc[] = {
|
||||
&daAlink_c::setEffectFrontRollParam,
|
||||
&daAlink_c::setEffectSlipParam,
|
||||
&daAlink_c::setEffectSmallLandParam,
|
||||
@@ -554,7 +554,7 @@ void daAlink_c::setEffect() {
|
||||
(field_0x3198 == 0x14C || field_0x3198 == 0x14D || field_0x3198 == 0x155))
|
||||
{
|
||||
sp3C = TRUE;
|
||||
current.angle.y += 0x8000;
|
||||
ANGLE_ADD_2(current.angle.y, 0x8000);
|
||||
}
|
||||
|
||||
f32 temp_f30 = field_0x3798.absXZ(current.pos);
|
||||
@@ -643,7 +643,7 @@ void daAlink_c::setEffect() {
|
||||
}
|
||||
|
||||
if (sp3C) {
|
||||
current.angle.y += 0x8000;
|
||||
ANGLE_ADD_2(current.angle.y, 0x8000);
|
||||
}
|
||||
|
||||
setFirePointDamageEffect();
|
||||
@@ -869,10 +869,6 @@ void daAlink_c::setSwordChargeEffect() {
|
||||
}
|
||||
|
||||
void daAlink_c::setElecDamageEffect() {
|
||||
static Vec const localOffset = {0.0f, -10.0f, -10.0f};
|
||||
static Vec const localScale0 = {0.69999999f, 0.85f, 1.5f};
|
||||
static Vec const localScale1 = {1.0f, 0.85f, 1.5f};
|
||||
|
||||
static const u16 effName0[] = {
|
||||
dPa_RM(ID_ZI_S_LK_BIRIBIRIA_A),
|
||||
dPa_RM(ID_ZI_S_LK_BIRIBIRIA_B),
|
||||
@@ -885,6 +881,10 @@ void daAlink_c::setElecDamageEffect() {
|
||||
dPa_RM(ID_ZI_S_LK_BIRIBIRIC_C),
|
||||
};
|
||||
|
||||
static Vec const localOffset = {0.0f, -10.0f, -10.0f};
|
||||
static Vec const localScale0 = {0.69999999f, 0.85f, 1.5f};
|
||||
static Vec const localScale1 = {1.0f, 0.85f, 1.5f};
|
||||
|
||||
cXyz pos;
|
||||
|
||||
const u16* effNameList;
|
||||
@@ -938,11 +938,30 @@ void daAlink_c::clearCutTurnEffectID() {
|
||||
}
|
||||
|
||||
void daAlink_c::setCutTurnEffect() {
|
||||
if (mUnderFrameCtrl[0].getFrame() < mProcVar1.field_0x300a) {
|
||||
return;
|
||||
}
|
||||
|
||||
static Vec const waterEffScale = {1.5f, 1.5f, 1.5f};
|
||||
|
||||
static const int unused0 = 0;
|
||||
static const int unused1 = 0;
|
||||
static const int unused2 = 0;
|
||||
|
||||
static const u16 effNameNormal[] = {
|
||||
ID_ZI_J_KAITENGIRI_A,
|
||||
ID_ZI_J_KAITENGIRI_B,
|
||||
};
|
||||
|
||||
static s16 leftRotNormal[] = {
|
||||
cM_deg2s(180), cM_deg2s(45), cM_deg2s(13), cM_deg2s(180), cM_deg2s(45), cM_deg2s(13),
|
||||
};
|
||||
|
||||
static Vec const leftTransNormal[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 30.0f, 0.0f},
|
||||
};
|
||||
|
||||
static const u16 effNameLight[] = {
|
||||
ID_ZI_J_KAITENGIRIL_A,
|
||||
ID_ZI_J_KAITENGIRIL_B,
|
||||
@@ -950,25 +969,18 @@ void daAlink_c::setCutTurnEffect() {
|
||||
ID_ZI_J_KAITENGIRIL_D,
|
||||
};
|
||||
|
||||
static const u16 effNameWater[] = {
|
||||
ID_ZI_J_KAITENGIRI_INWTR_A,
|
||||
ID_ZI_J_KAITENGIRI_INWTR_B,
|
||||
static s16 leftRotLight[] = {
|
||||
cM_deg2s(180), cM_deg2s(100), cM_deg2s(13), cM_deg2s(180), cM_deg2s(80), cM_deg2s(13),
|
||||
cM_deg2s(180), cM_deg2s(80), cM_deg2s(13), cM_deg2s(180), cM_deg2s(80), cM_deg2s(13),
|
||||
};
|
||||
|
||||
static Vec const waterEffScale = {1.5f, 1.5f, 1.5f};
|
||||
|
||||
static Vec const leftTransNormal[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 30.0f, 0.0f},
|
||||
};
|
||||
|
||||
static Vec const leftTransLight[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 35.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
|
||||
|
||||
static u16 const effNameLarge[] = {
|
||||
ID_ZI_J_KAITENGIRID_A,
|
||||
ID_ZI_J_KAITENGIRID_B,
|
||||
@@ -977,7 +989,13 @@ void daAlink_c::setCutTurnEffect() {
|
||||
ID_ZI_J_KAITENGIRID_E,
|
||||
ID_ZI_J_KAITENGIRID_F,
|
||||
};
|
||||
|
||||
|
||||
static s16 leftRotLarge[] = {
|
||||
cM_deg2s(180), cM_deg2s(45), cM_deg2s(13), cM_deg2s(180), cM_deg2s(45), cM_deg2s(13),
|
||||
cM_deg2s(180), cM_deg2s(60), cM_deg2s(13), cM_deg2s(180), cM_deg2s(60), cM_deg2s(13),
|
||||
cM_deg2s(180), cM_deg2s(60), cM_deg2s(13), cM_deg2s(180), cM_deg2s(60), cM_deg2s(13),
|
||||
};
|
||||
|
||||
static Vec const leftTransLarge[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 35.0f, 0.0f},
|
||||
@@ -987,97 +1005,86 @@ void daAlink_c::setCutTurnEffect() {
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
};
|
||||
|
||||
static const u16 effNameWater[] = {
|
||||
ID_ZI_J_KAITENGIRI_INWTR_A,
|
||||
ID_ZI_J_KAITENGIRI_INWTR_B,
|
||||
};
|
||||
|
||||
static s16 leftRotWater[] = {
|
||||
cM_deg2s(-90), cM_deg2s(0), cM_deg2s(180), cM_deg2s(0), cM_deg2s(0), cM_deg2s(180),
|
||||
};
|
||||
|
||||
static Vec const leftTransWater[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
|
||||
if (!(mUnderFrameCtrl[0].getFrame() < mProcVar1.field_0x300a)) {
|
||||
static s16 leftRotNormal[] = {
|
||||
cM_deg2s(180), cM_deg2s(45), cM_deg2s(13), cM_deg2s(180), cM_deg2s(45), cM_deg2s(13),
|
||||
};
|
||||
JPABaseEmitter* emitter;
|
||||
u32* emitterId = field_0x3204;
|
||||
const u16* effNameList;
|
||||
JGeometry::TVec3<s16>* rot;
|
||||
JGeometry::TVec3<f32>* trans;
|
||||
int effNum;
|
||||
BOOL sp18 = FALSE;
|
||||
|
||||
static s16 leftRotLight[] = {
|
||||
cM_deg2s(180), cM_deg2s(100), cM_deg2s(13), cM_deg2s(180), cM_deg2s(80), cM_deg2s(13),
|
||||
cM_deg2s(180), cM_deg2s(80), cM_deg2s(13), cM_deg2s(180), cM_deg2s(80), cM_deg2s(13),
|
||||
};
|
||||
|
||||
static s16 leftRotLarge[] = {
|
||||
cM_deg2s(180), cM_deg2s(45), cM_deg2s(13), cM_deg2s(180), cM_deg2s(45), cM_deg2s(13),
|
||||
cM_deg2s(180), cM_deg2s(60), cM_deg2s(13), cM_deg2s(180), cM_deg2s(60), cM_deg2s(13),
|
||||
cM_deg2s(180), cM_deg2s(60), cM_deg2s(13), cM_deg2s(180), cM_deg2s(60), cM_deg2s(13),
|
||||
};
|
||||
|
||||
static s16 leftRotWater[] = {
|
||||
cM_deg2s(-90), cM_deg2s(0), cM_deg2s(180), cM_deg2s(0), cM_deg2s(0), cM_deg2s(180),
|
||||
};
|
||||
|
||||
u32* emitterId = field_0x3204;
|
||||
const u16* effNameList;
|
||||
JGeometry::TVec3<s16>* rot;
|
||||
JGeometry::TVec3<f32>* trans;
|
||||
int effNum;
|
||||
BOOL sp18 = FALSE;
|
||||
|
||||
if (checkNoResetFlg0(FLG0_WATER_IN_MOVE)) {
|
||||
if (checkZoraWearAbility()) {
|
||||
effNameList = effNameWater;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotWater;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransWater;
|
||||
effNum = 2;
|
||||
if (mCutType == CUT_TYPE_LARGE_TURN_RIGHT || mCutType == CUT_TYPE_LARGE_TURN_LEFT) {
|
||||
sp18 = TRUE;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else if (mCutType == CUT_TYPE_LARGE_TURN_RIGHT || mCutType == CUT_TYPE_LARGE_TURN_LEFT) {
|
||||
effNameList = effNameLarge;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotLarge;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransLarge;
|
||||
effNum = 6;
|
||||
} else if (checkNoResetFlg3(FLG3_UNK_100000)) {
|
||||
effNameList = effNameLight;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotLight;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransLight;
|
||||
effNum = 4;
|
||||
} else {
|
||||
effNameList = effNameNormal;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotNormal;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransNormal;
|
||||
if (checkNoResetFlg0(FLG0_WATER_IN_MOVE)) {
|
||||
if (checkZoraWearAbility()) {
|
||||
effNameList = effNameWater;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotWater;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransWater;
|
||||
effNum = 2;
|
||||
if (mCutType == CUT_TYPE_LARGE_TURN_RIGHT || mCutType == CUT_TYPE_LARGE_TURN_LEFT) {
|
||||
sp18 = TRUE;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else if (mCutType == CUT_TYPE_LARGE_TURN_RIGHT || mCutType == CUT_TYPE_LARGE_TURN_LEFT) {
|
||||
effNameList = effNameLarge;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotLarge;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransLarge;
|
||||
effNum = 6;
|
||||
} else if (checkNoResetFlg3(FLG3_UNK_100000)) {
|
||||
effNameList = effNameLight;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotLight;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransLight;
|
||||
effNum = 4;
|
||||
} else {
|
||||
effNameList = effNameNormal;
|
||||
rot = (JGeometry::TVec3<s16>*)leftRotNormal;
|
||||
trans = (JGeometry::TVec3<f32>*)leftTransNormal;
|
||||
effNum = 2;
|
||||
}
|
||||
|
||||
cXyz pos;
|
||||
mDoMtx_multVecZero(mpLinkModel->getAnmMtx(1), &pos);
|
||||
cXyz pos;
|
||||
mDoMtx_multVecZero(mpLinkModel->getAnmMtx(1), &pos);
|
||||
|
||||
if (checkMagneBootsOn()) {
|
||||
mDoMtx_stack_c::transS(pos);
|
||||
mDoMtx_stack_c::concat(mMagneBootMtx);
|
||||
mDoMtx_stack_c::ZXYrotM(shape_angle);
|
||||
}
|
||||
if (checkMagneBootsOn()) {
|
||||
mDoMtx_stack_c::transS(pos);
|
||||
mDoMtx_stack_c::concat(mMagneBootMtx);
|
||||
mDoMtx_stack_c::ZXYrotM(shape_angle);
|
||||
}
|
||||
|
||||
for (int i = 0; i < effNum; i++, emitterId++, effNameList++, rot++, trans++) {
|
||||
JPABaseEmitter* emitter = setEmitter(emitterId, *effNameList, &pos, &shape_angle);
|
||||
if (emitter != NULL) {
|
||||
if (checkMagneBootsOn()) {
|
||||
emitter->setGlobalRTMatrix(mDoMtx_stack_c::get());
|
||||
for (int i = 0; i < effNum; i++, emitterId++, effNameList++, rot++, trans++) {
|
||||
emitter = setEmitter(emitterId, *effNameList, &pos, &shape_angle);
|
||||
if (emitter != NULL) {
|
||||
if (checkMagneBootsOn()) {
|
||||
emitter->setGlobalRTMatrix(mDoMtx_stack_c::get());
|
||||
}
|
||||
|
||||
if (mProcVar4.field_0x3010 == 0) {
|
||||
emitter->setLocalRotation(*rot);
|
||||
if (trans->y > 1.0f) {
|
||||
emitter->setLocalTranslation(*trans);
|
||||
}
|
||||
}
|
||||
|
||||
if (mProcVar4.field_0x3010 == 0) {
|
||||
emitter->setLocalRotation(*rot);
|
||||
if (trans->y > 1.0f) {
|
||||
emitter->setLocalTranslation(*trans);
|
||||
}
|
||||
}
|
||||
|
||||
if (sp18) {
|
||||
if (i == 0) {
|
||||
emitter->setGlobalParticleScale(waterEffScale);
|
||||
} else {
|
||||
emitter->setVolumeSize(225);
|
||||
emitter->setAwayFromAxisSpeed(15.0f);
|
||||
}
|
||||
if (sp18) {
|
||||
if (i == 0) {
|
||||
emitter->setGlobalParticleScale(waterEffScale);
|
||||
} else {
|
||||
emitter->setVolumeSize(225);
|
||||
emitter->setAwayFromAxisSpeed(15.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1094,6 +1101,8 @@ void daAlink_c::setHorseCutTurnEffect() {
|
||||
}
|
||||
|
||||
void daAlink_c::setCutLargeJumpLandEffect() {
|
||||
static const int dummy = 0;
|
||||
|
||||
cXyz pos(current.pos.x + cM_ssin(shape_angle.y) * 20.0f, current.pos.y + 50.0f, current.pos.z + cM_scos(shape_angle.y) * 20.0f);
|
||||
csXyz rot;
|
||||
cM3dGPla tripla;
|
||||
@@ -1195,7 +1204,7 @@ void daAlink_c::setWolfRollAttackEffect() {
|
||||
csXyz rot(shape_angle.x, shape_angle.y, 0);
|
||||
|
||||
if (mProcVar2.field_0x300c == 0) {
|
||||
rot.x += 0x8000;
|
||||
ANGLE_ADD_2(rot.x, 0x8000);
|
||||
}
|
||||
|
||||
setEmitter(&field_0x3204[0], ID_ZI_J_WL_KAITENAT_A, &pos, &rot);
|
||||
@@ -1243,6 +1252,7 @@ void daAlink_c::setWolfDigEffect() {
|
||||
emitter->setAwayFromAxisSpeed(var_f30);
|
||||
dComIfGp_particle_levelEmitterOnEventMove(field_0x32cc);
|
||||
}
|
||||
(void)0;
|
||||
} else if (field_0x3198 == 7) {
|
||||
var_r29 = 0;
|
||||
var_r28 = ID_ZI_J_DASHWTRA_C;
|
||||
@@ -1364,6 +1374,7 @@ void daAlink_c::setWolfJumpAttackEffect() {
|
||||
}
|
||||
|
||||
void daAlink_c::setWolfBarrierHitEffect(dBgS_LinChk& i_linchk) {
|
||||
static const int dummy = 0;
|
||||
static const u16 normalNameID[] = {
|
||||
dPa_RM(ID_ZI_S_NSBARRIER_COLL_A),
|
||||
dPa_RM(ID_ZI_S_NSBARRIER_COLL_B),
|
||||
@@ -1406,6 +1417,8 @@ void daAlink_c::setCutWaterDropEffect() {
|
||||
}
|
||||
|
||||
void daAlink_c::setWaterDropEffect() {
|
||||
static const int dummy1 = 0;
|
||||
static const int dummy2 = 0;
|
||||
static const u16 effDataTable[] = {
|
||||
ID_ZI_J_LK_NUREPOTA_BACKBONE2,
|
||||
ID_ZI_J_LK_NUREPOTA_WAIST,
|
||||
@@ -1467,7 +1480,7 @@ void daAlink_c::setWaterDropEffect() {
|
||||
|
||||
if (field_0x32c0[i] != 0) {
|
||||
if (field_0x32a0[i].a > -20) {
|
||||
field_0x32a0[i].a -= 2;
|
||||
field_0x32a0[i].a -= (s16)2;
|
||||
|
||||
if (field_0x32a0[i].a < -20) {
|
||||
field_0x32a0[i].a = -20;
|
||||
@@ -1507,6 +1520,8 @@ void daAlink_c::setSwordUpColorEffect() {
|
||||
}
|
||||
|
||||
void daAlink_c::setSwordCutSplash() {
|
||||
static Vec const swordCutSplashScale = {0.6f, 0.6f, 0.6f};
|
||||
|
||||
static const u16 cutSplashName[] = {
|
||||
ID_ZI_J_DOWNWTRA_A,
|
||||
ID_ZI_J_DOWNWTRA_B,
|
||||
@@ -1514,8 +1529,6 @@ void daAlink_c::setSwordCutSplash() {
|
||||
ID_ZI_J_DOWNWTRA_D,
|
||||
};
|
||||
|
||||
static Vec const swordCutSplashScale = {0.6f, 0.6f, 0.6f};
|
||||
|
||||
if (mCutType != 0 && mProcID != PROC_CUT_TURN && getCutAtFlg() && checkNoResetFlg0(FLG0_UNK_80) && mEquipItem == 0x103) {
|
||||
if (mSwordTopPos.y <= mWaterY && field_0x34b0.y > mWaterY) {
|
||||
cXyz sp14(mSwordTopPos.x, mWaterY, mSwordTopPos.z);
|
||||
@@ -1543,7 +1556,7 @@ void daAlink_c::setMetamorphoseEffectStartLink() {
|
||||
JPABaseEmitter* emitter = setEmitter(&field_0x3200, ID_ZI_J_ATOW_C, &cXyz::Zero, NULL);
|
||||
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
static Vec effScale = {1.33f, 1.0f, 1.0f};
|
||||
static const Vec effScale = {1.33f, 1.0f, 1.0f};
|
||||
if (emitter != NULL) {
|
||||
emitter->setGlobalParticleScale(effScale);
|
||||
}
|
||||
@@ -1752,28 +1765,30 @@ void daAlink_c::initFirePointDamageEffect(cXyz const* param_0, dCcD_GObjInf* i_h
|
||||
}
|
||||
}
|
||||
|
||||
if (i != 4) {
|
||||
cXyz* dmg_vec = getDamageVec(i_hitObj);
|
||||
|
||||
csXyz sp38(dmg_vec->atan2sY_XZ(), dmg_vec->atan2sX_Z(), 0);
|
||||
csXyz sp40;
|
||||
cXyz sp30;
|
||||
|
||||
int var_r30 = field_0x2e44.getHitmarkPosAndAngle(param_0, &sp38, &sp30, &sp40, 0);
|
||||
if (var_r30 == -1 || (!checkWolf() && (var_r30 == 1 || var_r30 == 15 || var_r30 == 16))) {
|
||||
return;
|
||||
}
|
||||
|
||||
eff->field_0x2 = field_0x2e44.getJntNum(var_r30);
|
||||
eff->field_0xc = *param_0;
|
||||
eff->field_0x24 = cXyz::Zero;
|
||||
eff->field_0x0 = 1;
|
||||
eff->field_0x4 = 0;
|
||||
|
||||
mDoMtx_stack_c::copy(mpLinkModel->getAnmMtx(eff->field_0x2));
|
||||
mDoMtx_stack_c::inverse();
|
||||
mDoMtx_stack_c::multVec(&sp30, &eff->field_0x18);
|
||||
if (i == 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
cXyz* dmg_vec = getDamageVec(i_hitObj);
|
||||
|
||||
csXyz sp38(dmg_vec->atan2sY_XZ(), dmg_vec->atan2sX_Z(), 0);
|
||||
csXyz sp40;
|
||||
cXyz sp30;
|
||||
|
||||
int var_r30 = field_0x2e44.getHitmarkPosAndAngle(param_0, &sp38, &sp30, &sp40, 0);
|
||||
if (var_r30 == -1 || (!checkWolf() && (var_r30 == 1 || var_r30 == 15 || var_r30 == 16))) {
|
||||
return;
|
||||
}
|
||||
|
||||
eff->field_0x2 = field_0x2e44.getJntNum(var_r30);
|
||||
eff->field_0xc = *param_0;
|
||||
eff->field_0x24 = cXyz::Zero;
|
||||
eff->field_0x0 = 1;
|
||||
eff->field_0x4 = 0;
|
||||
|
||||
mDoMtx_stack_c::copy(mpLinkModel->getAnmMtx(eff->field_0x2));
|
||||
mDoMtx_stack_c::inverse();
|
||||
mDoMtx_stack_c::multVec(&sp30, &eff->field_0x18);
|
||||
}
|
||||
|
||||
void daAlink_c::setFirePointDamageEffect() {
|
||||
@@ -1827,6 +1842,11 @@ void daAlink_c::setFirePointDamageEffect() {
|
||||
}
|
||||
|
||||
void daAlink_c::setFreezeEffect() {
|
||||
static const int dummy = 0;
|
||||
static const u16 effName[] = {
|
||||
dPa_RM(ID_ZI_S_LK_FREEZEND_A),
|
||||
dPa_RM(ID_ZI_S_LK_FREEZEND_B),
|
||||
};
|
||||
static Vec const effScale = {1.0f, 1.8f, 1.0f};
|
||||
static Vec const wolfEffScale = {1.0f, 1.0f, 1.5f};
|
||||
static Vec const offsetPos = {0.0f, 0.0f, -10.0f};
|
||||
@@ -1859,10 +1879,6 @@ void daAlink_c::setFreezeEffect() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
static const u16 effName[] = {
|
||||
dPa_RM(ID_ZI_S_LK_FREEZEND_A),
|
||||
dPa_RM(ID_ZI_S_LK_FREEZEND_B),
|
||||
};
|
||||
dComIfGp_particle_setColor(effName[i], &pos, &tevStr, NULL, NULL, 0.0f, 0xFF);
|
||||
}
|
||||
|
||||
@@ -1900,6 +1916,7 @@ void daAlink_c::clearWoodShieldBurnEffect() {
|
||||
}
|
||||
|
||||
void daAlink_c::setWoodShieldBurnOutEffect() {
|
||||
static const int dummy = 0;
|
||||
static const u16 effName[] = {
|
||||
ID_ZI_J_LK_SH_BURN_C,
|
||||
ID_ZI_J_LK_SH_BURN_D,
|
||||
@@ -2061,7 +2078,7 @@ void daAlink_blur_c::draw() {
|
||||
GXTexCoord2s16(var_r27, 0);
|
||||
|
||||
var_r27 = var_r28;
|
||||
var_r28 += temp_r26;
|
||||
ANGLE_ADD_2(var_r28, temp_r26);
|
||||
}
|
||||
|
||||
GXEnd();
|
||||
|
||||
@@ -492,10 +492,10 @@ void daAlink_c::setCarryArmAngle(f32 param_0, f32 param_1) {
|
||||
field_0x3136[1].set(0, 0, temp_r29 - (3500.0f * param_1));
|
||||
|
||||
if (param_1 < 0.0f) {
|
||||
field_0x312a[0].z += (s16)(2500.0f * param_1);
|
||||
field_0x3136[0].y += (s16)(2000.0f * param_1);
|
||||
ANGLE_ADD(field_0x312a[0].z, 2500.0f * param_1);
|
||||
ANGLE_ADD(field_0x3136[0].y, 2000.0f * param_1);
|
||||
} else {
|
||||
field_0x3136[0].y += (s16)(4000.0f * param_1);
|
||||
ANGLE_ADD(field_0x3136[0].y, 4000.0f * param_1);
|
||||
}
|
||||
} else if (checkGrabRooster()) {
|
||||
field_0x3136[0].y = -5000.0f * param_1;
|
||||
@@ -2103,7 +2103,7 @@ int daAlink_c::procGoatMove() {
|
||||
int temp_r27 = abs(mMoveAngle);
|
||||
if (checkInputOnR() && temp_r27 > 0x800 && temp_r27 < 0x7800 && (fabsf(sp8.x) < 250.0f || (sp8.x > 0.0f && mMoveAngle < 0) || (sp8.x < 0.0f && mMoveAngle > 0))) {
|
||||
if (abs((s16)(mMoveAngle - current.angle.y)) > 0x4000) {
|
||||
current.angle.y += 0x8000;
|
||||
ANGLE_ADD_2(current.angle.y, 0x8000);
|
||||
mNormalSpeed *= -1.0f;
|
||||
|
||||
if (field_0x2f98 == 3) {
|
||||
@@ -2294,7 +2294,7 @@ int daAlink_c::procGoatCatch() {
|
||||
if (checkAnmEnd(framectrl)) {
|
||||
if (mProcVar5.field_0x3012 == 0) {
|
||||
setOldRootQuaternion(0, -0x8000, 0);
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
current.angle.y = shape_angle.y;
|
||||
field_0x2fe4 = shape_angle.y;
|
||||
}
|
||||
@@ -2537,7 +2537,7 @@ int daAlink_c::procGoronMove() {
|
||||
f32 var_f31;
|
||||
if (checkInputOnR() && temp_r28 > 0x800 && temp_r28 < 0x7800) {
|
||||
if (abs((s16)(mMoveAngle - current.angle.y)) > 0x4000) {
|
||||
current.angle.y += 0x8000;
|
||||
ANGLE_ADD_2(current.angle.y, 0x8000);
|
||||
mNormalSpeed *= -1.0f;
|
||||
|
||||
if (field_0x2f98 == 3) {
|
||||
|
||||
@@ -92,14 +92,13 @@ void daAlink_c::setArrowShieldActor(fopAc_ac_c* i_actor, int param_1) {
|
||||
fopAcM_delete(first_arrow);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (; i < 15; i++) {
|
||||
mShieldArrowIDs[i] = mShieldArrowIDs[i + 1];
|
||||
field_0x2f7c[i] = field_0x2f7c[i + 1];
|
||||
for (arrow_num = 0; arrow_num < 15; arrow_num++) {
|
||||
mShieldArrowIDs[arrow_num] = mShieldArrowIDs[arrow_num + 1];
|
||||
field_0x2f7c[arrow_num] = field_0x2f7c[arrow_num + 1];
|
||||
}
|
||||
|
||||
mShieldArrowIDs[i] = new_arrow_id;
|
||||
field_0x2f7c[i] = 10;
|
||||
mShieldArrowIDs[arrow_num] = new_arrow_id;
|
||||
field_0x2f7c[arrow_num] = 10;
|
||||
|
||||
dComIfGp_setItemArrowNumCount(1);
|
||||
fopAcM_createItemForSimpleDemo(¤t.pos, fpcNm_ITEM_ARROW_10, -1, NULL, NULL, 0.0f, 0.0f);
|
||||
@@ -201,6 +200,7 @@ void daAlink_c::setShieldGuard() {
|
||||
|
||||
void daAlink_c::setGuardSe(dCcD_GObjInf* i_objinf) {
|
||||
int var_r31;
|
||||
u32 hit_se;
|
||||
BOOL isRebound;
|
||||
|
||||
if (checkWoodShieldEquipNotIronBall() && !checkMagicArmorNoDamage()) {
|
||||
@@ -211,7 +211,6 @@ void daAlink_c::setGuardSe(dCcD_GObjInf* i_objinf) {
|
||||
isRebound = TRUE;
|
||||
}
|
||||
|
||||
u32 hit_se;
|
||||
if (i_objinf->GetTgHitGObj() != NULL && i_objinf->GetTgHitGObj()->GetAtType() == AT_TYPE_BOMB) {
|
||||
hit_se = Z2SE_HIT_METAL_WEAPON;
|
||||
} else {
|
||||
@@ -330,7 +329,7 @@ int daAlink_c::procGuardSlip() {
|
||||
setShapeAngleToAtnActor(0);
|
||||
|
||||
if (mProcVar1.field_0x300a != 0) {
|
||||
mProcVar1.field_0x300a -= (s16)1;
|
||||
S16_SUB(mProcVar1.field_0x300a, 1);
|
||||
mBodyAngle.y += mProcVar2.field_0x300c;
|
||||
mBodyAngle.x += mProcVar3.field_0x300e;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ int daAlink_c::getHangDirectionFromAngle() {
|
||||
}
|
||||
|
||||
BOOL daAlink_c::hangMoveBgCheck(s16 param_0, cXyz* param_1) {
|
||||
static const int dummy = 0;
|
||||
|
||||
BOOL rt = false;
|
||||
cM3dGPla sp78;
|
||||
|
||||
@@ -902,7 +904,7 @@ int daAlink_c::setDragonHangPos() {
|
||||
cXyz sp18;
|
||||
mDoMtx_stack_c::multVecSR(&cXyz::BaseY, &sp18);
|
||||
if (sp18.y < 0.0f) {
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
shape_angle.x = 0x8000 - shape_angle.x;
|
||||
shape_angle.z *= -1;
|
||||
}
|
||||
@@ -1418,7 +1420,7 @@ int daAlink_c::procLadderDownStartInit() {
|
||||
dComIfGp_setPlayerStatus0(0, 0x2000000);
|
||||
setOldRootQuaternion(0, 0x8000, 0);
|
||||
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
current.angle.y = shape_angle.y;
|
||||
|
||||
f32 var_f31 = cM_ssin(field_0x306e);
|
||||
@@ -1835,8 +1837,8 @@ int daAlink_c::setMoveBGClimbCorrect() {
|
||||
|
||||
current.pos.x = mLinkLinChk.GetCross().x;
|
||||
current.pos.z = mLinkLinChk.GetCross().z;
|
||||
current.angle.y += (s16)(shape_angle.y - temp_r28);
|
||||
field_0x308c += (s16)(temp_r28 - shape_angle.y);
|
||||
ANGLE_ADD(current.angle.y, shape_angle.y - temp_r28);
|
||||
ANGLE_ADD(field_0x308c, temp_r28 - shape_angle.y);
|
||||
|
||||
mPolyInfo1.SetPolyInfo(mLinkLinChk);
|
||||
}
|
||||
@@ -2457,7 +2459,7 @@ int daAlink_c::procClimbToRoof() {
|
||||
field_0x2f99 = 2;
|
||||
|
||||
if (checkAnmEnd(frameCtrl)) {
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
current.angle.y = shape_angle.y;
|
||||
mPrevAngleY = shape_angle.y;
|
||||
setOldRootQuaternion(0, 0x8000, 0);
|
||||
@@ -2495,7 +2497,7 @@ void daAlink_c::setRoofHangHandOnSE(cBgS_PolyInfo* unused) {
|
||||
if (frame_ctrl->checkPass(field_0x3478)) {
|
||||
return;
|
||||
} else if (frame_ctrl->checkPass(field_0x347c)) {
|
||||
|
||||
(void)0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2842,7 +2844,7 @@ int daAlink_c::procRoofHangTurnInit() {
|
||||
if ((s16)(mMoveAngle - shape_angle.y) < 0) {
|
||||
anm_speed = -mpHIO->mRoofHang.m.mInvertASpeed;
|
||||
mProcVar0.field_0x3008 = 1;
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
setOldRootQuaternion(0, -0x8000, 0);
|
||||
field_0x2060->getOldFrameTransInfo(0)->mTranslate.z = -8.899365425109863f;
|
||||
mProcVar2.field_0x300c = mMoveAngle;
|
||||
@@ -2881,7 +2883,7 @@ int daAlink_c::procRoofHangTurn() {
|
||||
daPy_frameCtrl_c* frame_ctrl = mUnderFrameCtrl;
|
||||
if (checkAnmEnd(frame_ctrl)) {
|
||||
if (mProcVar0.field_0x3008 == 0) {
|
||||
shape_angle.y += 0x8000;
|
||||
ANGLE_ADD_2(shape_angle.y, 0x8000);
|
||||
current.angle.y = shape_angle.y;
|
||||
setOldRootQuaternion(0, -0x8000, 0);
|
||||
field_0x2060->getOldFrameTransInfo(0)->mTranslate.z += 17.798730850219727f;
|
||||
|
||||
@@ -18,6 +18,8 @@ enum {
|
||||
};
|
||||
|
||||
void daAlink_c::hsChainShape_c::draw() {
|
||||
static const int dummy = 0;
|
||||
|
||||
daAlink_c* alink = (daAlink_c*)getUserArea();
|
||||
J3DModelData* modelData = alink->getItemModelData();
|
||||
J3DMaterial* material = modelData->getMaterialNodePointer(0);
|
||||
@@ -50,7 +52,8 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
ppos++;
|
||||
pangle++;
|
||||
|
||||
for (int i = 0; i < 101; i++, ppos++, pangle++) {
|
||||
int i;
|
||||
for (i = 0; i < 101; i++, ppos++, pangle++) {
|
||||
mDoMtx_stack_c::copy(j3dSys.getViewMtx());
|
||||
mDoMtx_stack_c::transM(*ppos);
|
||||
mDoMtx_stack_c::ZXYrotM(*pangle);
|
||||
@@ -65,7 +68,7 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
cXyz spC8;
|
||||
cXyz spBC;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
cXyz* sp48;
|
||||
csXyz* sp44;
|
||||
|
||||
@@ -91,7 +94,7 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
spE = -0x3000;
|
||||
}
|
||||
|
||||
sp10 = sp44->y;
|
||||
sp10 = (s16)sp44->y;
|
||||
sp14 = sp44->z + spE;
|
||||
f32 var_f29 = spC8.abs();
|
||||
|
||||
@@ -144,7 +147,7 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
csXyz sp64(sp6C);
|
||||
|
||||
f32 sp34 = M_PI / maxDistanceF;
|
||||
|
||||
|
||||
f32 temp_f27;
|
||||
f32 var_f26 = 0.0f;
|
||||
f32 var_f28;
|
||||
@@ -153,6 +156,7 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
if (alink->getHookshotStopTime() & 1) {
|
||||
var_f28 *= -1.0f;
|
||||
}
|
||||
(void)0;
|
||||
|
||||
while (maxDistanceF > var_f30) {
|
||||
temp_f27 = var_f28 * cM_fsin(sp34 * var_f30);
|
||||
@@ -172,7 +176,7 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
|
||||
material->getShape()->simpleDrawCache();
|
||||
|
||||
sp64.z += 0x3000;
|
||||
ANGLE_ADD_2(sp64.z, 0x3000);
|
||||
|
||||
var_f26 = temp_f27;
|
||||
var_f30 += fabsf(cM_scos(spC)) * 5.0f;
|
||||
@@ -183,15 +187,15 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
const cXyz& subChainTopPos = alink->getHsSubChainTopPos();
|
||||
maxDistance = subChainRootPos - subChainTopPos;
|
||||
|
||||
f32 temp_f1 = maxDistance.abs();
|
||||
if (temp_f1 > 1.0f) {
|
||||
maxDistance *= (1.0f / temp_f1);
|
||||
maxDistanceF = maxDistance.abs();
|
||||
if (maxDistanceF > 1.0f) {
|
||||
maxDistance *= (1.0f / maxDistanceF);
|
||||
var_f30 = 0.0f;
|
||||
|
||||
|
||||
sp98 = subChainTopPos;
|
||||
sp6C.set(maxDistance.atan2sY_XZ(), maxDistance.atan2sX_Z(), 0);
|
||||
|
||||
while (temp_f1 > var_f30) {
|
||||
while (maxDistanceF > var_f30) {
|
||||
mDoMtx_stack_c::copy(j3dSys.getViewMtx());
|
||||
mDoMtx_stack_c::transM(sp98);
|
||||
mDoMtx_stack_c::ZXYrotM(sp6C);
|
||||
@@ -202,7 +206,7 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
material->getShape()->simpleDrawCache();
|
||||
|
||||
sp98 += maxDistance * 5.0f;
|
||||
sp6C.z += 0x3000;
|
||||
ANGLE_ADD_2(sp6C.z, 0x3000);
|
||||
var_f30 += 5.0f;
|
||||
}
|
||||
}
|
||||
@@ -212,8 +216,7 @@ void daAlink_c::hsChainShape_c::draw() {
|
||||
void daAlink_c::hookshotAtHitCallBack(dCcD_GObjInf* i_atObjInf, fopAc_ac_c* i_tgActor,
|
||||
dCcD_GObjInf* i_tgObjInf) {
|
||||
if (i_tgActor != NULL && fopAcM_IsActor(i_tgActor) && !i_tgObjInf->ChkTgHookshotThrough()) {
|
||||
cXyz* hit_pos_p = i_atObjInf->GetAtHitPosP();
|
||||
f32 dist_to_hitpos = getHsChainTopPos().abs(*hit_pos_p);
|
||||
f32 dist_to_hitpos = getHsChainTopPos().abs(*i_atObjInf->GetAtHitPosP());
|
||||
|
||||
if (dist_to_hitpos < mSearchBallScale) {
|
||||
mSearchBallScale = dist_to_hitpos;
|
||||
@@ -709,7 +712,13 @@ void daAlink_c::setHookshotReturnEnd() {
|
||||
field_0x2060->initOldFrameMorf(3.0f, field_0x30a8, field_0x30aa);
|
||||
} else if (checkHookshotShootAnime()) {
|
||||
int _;
|
||||
setUpperAnimeBaseSpeed(dRes_ID_ALANM_BCK_HSWAIT_e, checkAttentionLock() ? mpHIO->mItem.mHookshot.m.mWaitAnmSpeed : 0.0f, 3.0f);
|
||||
f32 anmSpeed;
|
||||
if (!checkAttentionLock()) {
|
||||
anmSpeed = 0.0f;
|
||||
} else {
|
||||
anmSpeed = mpHIO->mItem.mHookshot.m.mWaitAnmSpeed;
|
||||
}
|
||||
setUpperAnimeBaseSpeed(dRes_ID_ALANM_BCK_HSWAIT_e, anmSpeed, 3.0f);
|
||||
}
|
||||
|
||||
mFastShotTime = 0;
|
||||
@@ -732,7 +741,7 @@ int daAlink_c::setHookshotHangMoveBGCollect() {
|
||||
mDoMtx_stack_c::multVec(&field_0x37c8, &mIronBallBgChkPos);
|
||||
|
||||
current.pos += mIronBallBgChkPos - sp28;
|
||||
shape_angle.y += (s16)(mProcVar0.field_0x3008 - carry_actor->shape_angle.y);
|
||||
ANGLE_ADD(shape_angle.y, mProcVar0.field_0x3008 - carry_actor->shape_angle.y);
|
||||
current.angle.y = shape_angle.y;
|
||||
mProcVar0.field_0x3008 = carry_actor->shape_angle.y;
|
||||
} else if (dComIfG_Bgsp().ChkPolySafe(*polyinfo)) {
|
||||
@@ -796,25 +805,24 @@ void daAlink_c::setHookshotPos() {
|
||||
mDoMtx_stack_c::transM(-2.0f, 1.0f, 1.0f);
|
||||
mDoMtx_stack_c::XYZrotM(cM_deg2s(5.7f), cM_deg2s(162.0f), 0);
|
||||
|
||||
J3DModel* var_r27;
|
||||
J3DModel* model;
|
||||
if (field_0x3020 == 0) {
|
||||
var_r27 = mHeldItemModel;
|
||||
model = mHeldItemModel;
|
||||
} else {
|
||||
var_r27 = field_0x0710;
|
||||
model = field_0x0710;
|
||||
}
|
||||
var_r27->setBaseTRMtx(mDoMtx_stack_c::get());
|
||||
model->setBaseTRMtx(mDoMtx_stack_c::get());
|
||||
|
||||
mDoMtx_stack_c::copy(mpLinkModel->getAnmMtx(mRightItemJntNo));
|
||||
mDoMtx_stack_c::transM(-2.0f, 0.0f, 1.0f);
|
||||
mDoMtx_stack_c::XYZrotM(cM_deg2s(-78.0f), cM_deg2s(182.0f), cM_deg2s(-99.0f));
|
||||
|
||||
J3DModel* var_r27_2;
|
||||
if (field_0x3020 == 0) {
|
||||
var_r27_2 = field_0x0710;
|
||||
model = field_0x0710;
|
||||
} else {
|
||||
var_r27_2 = mHeldItemModel;
|
||||
model = mHeldItemModel;
|
||||
}
|
||||
var_r27_2->setBaseTRMtx(mDoMtx_stack_c::get());
|
||||
model->setBaseTRMtx(mDoMtx_stack_c::get());
|
||||
|
||||
if (mItemMode == 2 || mItemMode == HS_MODE_SHOOT_e) {
|
||||
field_0x33dc += 1.0f;
|
||||
@@ -865,6 +873,7 @@ void daAlink_c::setHookshotPos() {
|
||||
mpHookSound->framework(0, mVoiceReverbIntensity);
|
||||
|
||||
fopAc_ac_c* targetAc_p = mHookTargetAcKeep.getActor();
|
||||
f32 var_f29;
|
||||
f32 return_speed;
|
||||
f32 shoot_speed;
|
||||
f32 max_length;
|
||||
@@ -981,7 +990,7 @@ void daAlink_c::setHookshotPos() {
|
||||
if (mHookTargetAcKeep.getActor() != NULL) {
|
||||
mHookshotTopPos = field_0x381c;
|
||||
|
||||
fopAc_ac_c* targetAc_p = mHookTargetAcKeep.getActor();
|
||||
targetAc_p = mHookTargetAcKeep.getActor();
|
||||
if (targetAc_p != NULL && (targetAc_p->actor_status & 0x280000)) {
|
||||
mHookTargetAcKeep.setData(targetAc_p);
|
||||
mIronBallCenterPos = mHookshotTopPos - targetAc_p->current.pos;
|
||||
@@ -1026,12 +1035,12 @@ void daAlink_c::setHookshotPos() {
|
||||
}
|
||||
|
||||
cXyz sp17C = mHookshotTopPos - mHeldItemRootPos;
|
||||
f32 temp_f1 = sp17C.abs();
|
||||
sp17C *= 1.0f / temp_f1;
|
||||
var_f29 = sp17C.abs();
|
||||
sp17C *= 1.0f / var_f29;
|
||||
|
||||
f32 temp_f26 = max_length - 15.0f;
|
||||
if (temp_f1 >= temp_f26) {
|
||||
mHookshotTopPos = mHeldItemRootPos + (sp17C * temp_f26);
|
||||
f32 var_f26 = max_length - 15.0f;
|
||||
if (var_f29 >= var_f26) {
|
||||
mHookshotTopPos = mHeldItemRootPos + (sp17C * var_f26);
|
||||
mItemMode = HS_MODE_RETURN_e;
|
||||
}
|
||||
|
||||
@@ -1070,9 +1079,9 @@ void daAlink_c::setHookshotPos() {
|
||||
|
||||
mPolyInfo2.SetPolyInfo(mRopeLinChk);
|
||||
if (dComIfG_Bgsp().ChkMoveBG_NoDABg(mRopeLinChk)) {
|
||||
fopAc_ac_c* target_ac = dComIfG_Bgsp().GetActorPointer(mRopeLinChk);
|
||||
mHookTargetAcKeep.setData(target_ac);
|
||||
fopAcM_setHookCarryNow(target_ac);
|
||||
targetAc_p = dComIfG_Bgsp().GetActorPointer(mRopeLinChk);
|
||||
mHookTargetAcKeep.setData(targetAc_p);
|
||||
fopAcM_setHookCarryNow(targetAc_p);
|
||||
}
|
||||
} else {
|
||||
int poly_att0 = dComIfG_Bgsp().GetPolyAtt0(mRopeLinChk);
|
||||
@@ -1131,7 +1140,7 @@ void daAlink_c::setHookshotPos() {
|
||||
if (dComIfG_Bgsp().LineCross(mpHookshotLinChk) &&
|
||||
dComIfG_Bgsp().GetPolyAtt0(*mpHookshotLinChk) != 6)
|
||||
{
|
||||
fpc_ProcID id = fopKyM_createWpillar(mpHookshotLinChk->GetCrossP(), 0.5f, 0);
|
||||
fopKyM_createWpillar(mpHookshotLinChk->GetCrossP(), 0.5f, 0);
|
||||
mDoAud_seStart(Z2SE_CM_BODYFALL_WATER_S, mpHookshotLinChk->GetCrossP(), 0,
|
||||
mVoiceReverbIntensity);
|
||||
}
|
||||
@@ -1217,7 +1226,7 @@ void daAlink_c::hookshotRoofTurn() {
|
||||
|
||||
if (checkInputOnR()) {
|
||||
int stick_direction = getDirectionFromAngle(mStickAngle);
|
||||
int angle = (int)(1024.0f * mMoveValue * mMoveValue);
|
||||
s16 angle = 1024.0f * mMoveValue * mMoveValue;
|
||||
|
||||
if (stick_direction == DIR_LEFT) {
|
||||
shape_angle.y += angle;
|
||||
@@ -1252,11 +1261,11 @@ void daAlink_c::hookshotRoofTurn() {
|
||||
|
||||
u8 status_dir = 0;
|
||||
if (current.pos.y < max_rise_y) {
|
||||
status_dir |= 8;
|
||||
status_dir |= (u8)0x8;
|
||||
}
|
||||
|
||||
if (current.pos.y > min_descend_y) {
|
||||
status_dir |= 2;
|
||||
status_dir |= (u8)0x2;
|
||||
}
|
||||
|
||||
if (!checkEventRun()) {
|
||||
|
||||
@@ -281,9 +281,14 @@ void daAlink_c::setHorseSwordUpAnime() {
|
||||
|
||||
void daAlink_c::setHorseTurnUpperAnime(BOOL i_isTurnL) {
|
||||
if (checkHorseNoUpperAnime() || (!i_isTurnL && checkHorseTurnRAnime()) ||
|
||||
(i_isTurnL == TRUE && checkHorseTurnLAnime()))
|
||||
{
|
||||
setUpperAnimeBaseMorf(!i_isTurnL ? (u16)dRes_ID_ALANM_BCK_TURNLS_e : (u16)dRes_ID_ALANM_BCK_TURNRS_e, 4.0f);
|
||||
(i_isTurnL == TRUE && checkHorseTurnLAnime())) {
|
||||
u16 anmResIdx;
|
||||
if (i_isTurnL == FALSE) {
|
||||
anmResIdx = (u16)dRes_ID_ALANM_BCK_TURNLS_e;
|
||||
} else {
|
||||
anmResIdx = (u16)dRes_ID_ALANM_BCK_TURNRS_e;
|
||||
}
|
||||
setUpperAnimeBaseMorf(anmResIdx, 4.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1095,7 +1100,11 @@ int daAlink_c::checkHorseGetOffDirection() {
|
||||
lin_end_pos.set(ride_actor_p->current.pos.x + cM_ssin(var_r28) * 125.0f, lin_start_pos.y,
|
||||
ride_actor_p->current.pos.z + cM_scos(var_r28) * 125.0f);
|
||||
|
||||
#if PLATFORM_SHIELD
|
||||
f32 check_y[3];
|
||||
#else
|
||||
f32 check_y[3] = {0.0f, 0.0f, 0.0f};
|
||||
#endif
|
||||
check_y[0] = current.pos.y;
|
||||
check_y[1] = ride_actor_p->current.pos.y + (current.pos.y - ride_actor_p->current.pos.y) * 0.5f;
|
||||
|
||||
@@ -1103,8 +1112,7 @@ int daAlink_c::checkHorseGetOffDirection() {
|
||||
check_y[2] = var_f31;
|
||||
|
||||
int check_no;
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (check_no = 0; check_no < 3; check_no++) {
|
||||
lin_start_pos.y = check_y[check_no];
|
||||
lin_end_pos.y = lin_start_pos.y;
|
||||
@@ -1123,7 +1131,7 @@ int daAlink_c::checkHorseGetOffDirection() {
|
||||
|
||||
lin_end_pos.x = lin_start_pos.x * 2.0f - lin_end_pos.x;
|
||||
lin_end_pos.z = lin_start_pos.z * 2.0f - lin_end_pos.z;
|
||||
var_r28 += 0x8000;
|
||||
ANGLE_ADD_2(var_r28, 0x8000);
|
||||
}
|
||||
|
||||
return 2;
|
||||
@@ -1135,11 +1143,11 @@ void daAlink_c::boarForceGetOff() {
|
||||
|
||||
void daAlink_c::horseGetOffEnd() {
|
||||
if (field_0x2fc0 == 0) {
|
||||
shape_angle.y -= (s16)0x4000;
|
||||
ANGLE_SUB(shape_angle.y, 0x4000);
|
||||
setOldRootQuaternion(0, 0x4000, 0);
|
||||
mDoMtx_stack_c::YrotS(-0x4000);
|
||||
} else {
|
||||
shape_angle.y += (s16)0x4000;
|
||||
ANGLE_ADD(shape_angle.y, 0x4000);
|
||||
setOldRootQuaternion(0, -0x4000, 0);
|
||||
mDoMtx_stack_c::YrotS(0x4000);
|
||||
}
|
||||
@@ -1319,7 +1327,7 @@ int daAlink_c::procHorseRideInit() {
|
||||
}
|
||||
field_0x2fc0 = 1;
|
||||
}
|
||||
|
||||
|
||||
if (mDemo.getDemoMode() != daPy_demo_c::DEMO_UNK_7_e) {
|
||||
setOldRootQuaternion(0, (s16)(shape_angle.y - field_0x27f4->shape_angle.y), 0);
|
||||
}
|
||||
@@ -1587,7 +1595,7 @@ int daAlink_c::procHorseGetOff() {
|
||||
if (rideActor != NULL) {
|
||||
current.pos += rideActor->current.pos - field_0x37d4;
|
||||
field_0x37d4 = rideActor->current.pos;
|
||||
shape_angle.y += (s16)(mProcVar3.field_0x300e - rideActor->shape_angle.y);
|
||||
ANGLE_ADD(shape_angle.y, mProcVar3.field_0x300e - rideActor->shape_angle.y);
|
||||
mProcVar3.field_0x300e = rideActor->shape_angle.y;
|
||||
}
|
||||
|
||||
@@ -1670,7 +1678,8 @@ int daAlink_c::procHorseWaitInit() {
|
||||
initServiceWaitTime();
|
||||
checkHorseGetOffAndSetDoStatus();
|
||||
|
||||
setSyncRide((!checkHorseNoUpperAnime() && !checkEquipAnime()) || checkInputOnR() || !checkHorseGetOff() || checkHorseGetOffDirection() == 2);
|
||||
setSyncRide(!((checkHorseNoUpperAnime() || checkEquipAnime()) && !checkInputOnR() &&
|
||||
checkHorseGetOff() && checkHorseGetOffDirection() != 2));
|
||||
field_0x33f0 = 0.0f;
|
||||
return 1;
|
||||
}
|
||||
@@ -2706,9 +2715,9 @@ int daAlink_c::procHorseRun() {
|
||||
|
||||
if (horse->checkRodeoLeft()) {
|
||||
if (mProcVar3.field_0x300e != 0) {
|
||||
mProcVar5.field_0x3012 -= (s16)150;
|
||||
S16_SUB(mProcVar5.field_0x3012, 150);
|
||||
} else {
|
||||
mProcVar5.field_0x3012 -= (s16)600;
|
||||
S16_SUB(mProcVar5.field_0x3012, 600);
|
||||
}
|
||||
|
||||
if (mProcVar2.field_0x300c == 0) {
|
||||
@@ -2716,9 +2725,9 @@ int daAlink_c::procHorseRun() {
|
||||
}
|
||||
} else {
|
||||
if (mProcVar3.field_0x300e != 0) {
|
||||
mProcVar5.field_0x3012 += (s16)150;
|
||||
S16_ADD(mProcVar5.field_0x3012, 150);
|
||||
} else {
|
||||
mProcVar5.field_0x3012 += (s16)600;
|
||||
S16_ADD(mProcVar5.field_0x3012, 600);
|
||||
}
|
||||
|
||||
if (mProcVar2.field_0x300c == 0) {
|
||||
@@ -2744,7 +2753,7 @@ int daAlink_c::procHorseRun() {
|
||||
daPy_frameCtrl_c* framectrl = &mUnderFrameCtrl[0];
|
||||
f32 temp_f31 = framectrl->getFrame() / framectrl->getEnd();
|
||||
|
||||
mProcVar4.field_0x3010 = (field_0x3478 * (1.0f + cM_fsin((M_PI*2) * (temp_f31 - 0.69999999f)))) + (4000.0f * (1.0f - fabsf(0.000099999997f * mProcVar5.field_0x3012)));
|
||||
mProcVar4.field_0x3010 = (field_0x3478 * (1.0f + cM_fsin((M_PI*2) * (temp_f31 - 0.7f)))) + (4000.0f * (1.0f - fabsf(0.0001f * mProcVar5.field_0x3012)));
|
||||
field_0x3088 = field_0x3478 * (1.0f + cM_fsin((M_PI*2) * (temp_f31 - 1.0f)));
|
||||
|
||||
if (framectrl->checkPass(0.0f)) {
|
||||
|
||||
@@ -378,7 +378,7 @@ int daAlink_c::procMagneBootsFly() {
|
||||
|
||||
cLib_addCalcAngleS(&shape_angle.x, sp24.atan2sY_XZ() + -0x4000, 5, 0x1000, 0x100);
|
||||
cLib_addCalcAngleS(&shape_angle.y, sp24.atan2sX_Z(), 5, 0x1000, 0x100);
|
||||
mProcVar2.field_0x300c += (s16)0x1C00;
|
||||
ANGLE_ADD(mProcVar2.field_0x300c, 0x1C00);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -18,7 +18,8 @@ static fopAc_ac_c* daAlink_searchIceLeaf(fopAc_ac_c* i_actor, void* i_data) {
|
||||
}
|
||||
|
||||
bool daAlink_c::checkSnowCode() const {
|
||||
return mGndPolySpecialCode == dBgW_SPCODE_HEAVY_SNOW || mGndPolySpecialCode == dBgW_SPCODE_LIGHT_SNOW;
|
||||
return mGndPolySpecialCode == dBgW_SPCODE_HEAVY_SNOW ||
|
||||
mGndPolySpecialCode == dBgW_SPCODE_LIGHT_SNOW;
|
||||
}
|
||||
|
||||
bool daAlink_c::checkSnowCodePolygon(cBgS_PolyInfo& i_polyinfo) {
|
||||
@@ -27,7 +28,8 @@ bool daAlink_c::checkSnowCodePolygon(cBgS_PolyInfo& i_polyinfo) {
|
||||
}
|
||||
|
||||
bool daAlink_c::checkBoardRestart() {
|
||||
return (mRideStatus == 0 && mRideAcKeep.getActor() != NULL) && fopAcM_GetName(mRideAcKeep.getActor()) == PROC_Obj_IceLeaf;
|
||||
return (mRideStatus == 0 && mRideAcKeep.getActor() != NULL) &&
|
||||
fopAcM_GetName(mRideAcKeep.getActor()) == PROC_Obj_IceLeaf;
|
||||
}
|
||||
|
||||
int daAlink_c::boardCommon(BOOL i_canMove) {
|
||||
@@ -47,7 +49,9 @@ int daAlink_c::boardCommon(BOOL i_canMove) {
|
||||
s16 sp8 = current.angle.y + 0x8000;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (mAcchCir[i].ChkWallHit() && cLib_distanceAngleS(sp8, mAcchCir[i].GetWallAngleY()) <= 0x2000 && mNormalSpeed > 30.0f) {
|
||||
if (mAcchCir[i].ChkWallHit() &&
|
||||
cLib_distanceAngleS(sp8, mAcchCir[i].GetWallAngleY()) <= 0x2000 &&
|
||||
mNormalSpeed > 30.0f) {
|
||||
setJumpMode();
|
||||
return procCoLargeDamageInit(-4, TRUE, 0, 0, NULL, 0);
|
||||
}
|
||||
@@ -110,12 +114,22 @@ int daAlink_c::boardCommon(BOOL i_canMove) {
|
||||
var_f30 = (temp_f29 * mNormalSpeed) / 5.0f;
|
||||
}
|
||||
|
||||
if (checkZeroSpeedF() && temp_r26 > 0x7000 && mProcID == PROC_BOARD_WAIT && !checkModeFlg(2)) {
|
||||
if (mProcVar3.field_0x300e <= 910.0f && checkUnderMove0BckNoArc(ANM_RIDE_WAIT) && mLinkAcch.ChkGroundHit()) {
|
||||
if (checkZeroSpeedF() &&
|
||||
temp_r26 > 0x7000 &&
|
||||
mProcID == PROC_BOARD_WAIT &&
|
||||
!checkModeFlg(2)) {
|
||||
if (mProcVar3.field_0x300e <= l_boardSlopeAngleMin &&
|
||||
checkUnderMove0BckNoArc(ANM_RIDE_WAIT) &&
|
||||
mLinkAcch.ChkGroundHit()) {
|
||||
return procBoardTurnInit();
|
||||
}
|
||||
}
|
||||
} else if (temp_r26 < 0x2000 && field_0x2f8c == 0xB && mProcID == PROC_BOARD_WAIT && !checkModeFlg(2) && mLinkAcch.ChkGroundHit() && (mProcVar3.field_0x300e < field_0x3122) && (checkUnderMove0BckNoArc(ANM_RIDE_WAIT) || checkUnderMove0BckNoArc(ANM_RIDE_FRONT))) {
|
||||
} else if (temp_r26 < 0x2000 &&
|
||||
field_0x2f8c == 0xB &&
|
||||
mProcID == PROC_BOARD_WAIT &&
|
||||
!checkModeFlg(2) && mLinkAcch.ChkGroundHit() &&
|
||||
(mProcVar3.field_0x300e < field_0x3122) &&
|
||||
(checkUnderMove0BckNoArc(ANM_RIDE_WAIT) || checkUnderMove0BckNoArc(ANM_RIDE_FRONT))) {
|
||||
if (mNormalSpeed <= mpHIO->mItem.mBoard.m.mMaxPushSpeed) {
|
||||
return procBoardRowInit();
|
||||
}
|
||||
@@ -160,7 +174,10 @@ int daAlink_c::boardCommon(BOOL i_canMove) {
|
||||
offModeFlg(2);
|
||||
speed.y = 0.0f;
|
||||
} else {
|
||||
if (mProcVar3.field_0x300e > 910.0f && (mProcID != PROC_BOARD_ROW || !(mProcVar3.field_0x300e < 2000.0f))) {
|
||||
if (mProcVar3.field_0x300e > l_boardSlopeAngleMin &&
|
||||
(mProcID != PROC_BOARD_ROW || !(mProcVar3.field_0x300e < l_boardSlopeRowAngleMin))) {
|
||||
f32 temp_f27;
|
||||
f32 temp_f26;
|
||||
f32 var_f25 = (f32)mProcVar3.field_0x300e / (f32)field_0x3122;
|
||||
if (var_f25 > 1.0f) {
|
||||
var_f25 = 1.0f;
|
||||
@@ -176,8 +193,8 @@ int daAlink_c::boardCommon(BOOL i_canMove) {
|
||||
|
||||
var_f31 *= cM_fsin(1.5707964f * var_f25);
|
||||
if (var_f31 > 0.1f) {
|
||||
f32 temp_f27 = (var_f31 * cM_ssin(var_r27)) + (mNormalSpeed * cM_ssin(shape_angle.y));
|
||||
f32 temp_f26 = (var_f31 * cM_scos(var_r27)) + (mNormalSpeed * cM_scos(shape_angle.y));
|
||||
temp_f27 = (var_f31 * cM_ssin(var_r27)) + (mNormalSpeed * cM_ssin(shape_angle.y));
|
||||
temp_f26 = (var_f31 * cM_scos(var_r27)) + (mNormalSpeed * cM_scos(shape_angle.y));
|
||||
|
||||
mNormalSpeed = JMAFastSqrt((temp_f27 * temp_f27) + (temp_f26 * temp_f26));
|
||||
if (mNormalSpeed > mMaxSpeed) {
|
||||
|
||||
@@ -213,6 +213,11 @@ void daAlink_c::setIronBallChainPos() {
|
||||
int sp38;
|
||||
int sp34;
|
||||
|
||||
f32 var_f30;
|
||||
f32 var_f31;
|
||||
f32 var_f29;
|
||||
f32 var_f28;
|
||||
f32 var_f27;
|
||||
if (mItemVar0.field_0x3018 == 2) {
|
||||
var_r29 = mIronBallChainPos + 1;
|
||||
var_r27 = var_r29 - 1;
|
||||
@@ -293,20 +298,20 @@ void daAlink_c::setIronBallChainPos() {
|
||||
daPy_frameCtrl_c* framectrl = &mUnderFrameCtrl[0];
|
||||
|
||||
if (mItemVar0.field_0x3018 == 1) {
|
||||
f32 temp_f25 = framectrl->getEnd() - 13.0f;
|
||||
f32 temp_f29 = (framectrl->getFrame() - 13.0f) / temp_f25;
|
||||
s16 sp12 = -16384.0f - (14336.0f * temp_f29);
|
||||
var_f29 = (framectrl->getFrame() - 13.0f) / (framectrl->getEnd() - 13.0f);
|
||||
s16 sp12 = -16384.0f - (14336.0f * var_f29);
|
||||
|
||||
mDoMtx_stack_c::ZXYrotS(mBodyAngle.x, shape_angle.y, 0);
|
||||
mDoMtx_stack_c::YrotM(sp12);
|
||||
mDoMtx_stack_c::multVec(&cXyz::BaseZ, &sp298);
|
||||
|
||||
sp298 *= 15.0f * (1.0f + temp_f29);
|
||||
sp298 *= 15.0f * (1.0f + var_f29);
|
||||
sp38 = 1000;
|
||||
} else if (mItemVar0.field_0x3018 == 4) {
|
||||
Vec sp268 = {0.0f, 0.0f, 0.0f};
|
||||
sp268.y = mpHIO->mItem.mIronBall.m.mThrowChainAccelY;
|
||||
sp268.z = mpHIO->mItem.mIronBall.m.mThrowChainAccelZ;
|
||||
f32 throwAccelZ = mpHIO->mItem.mIronBall.m.mThrowChainAccelZ;
|
||||
sp268.z = throwAccelZ;
|
||||
|
||||
mDoMtx_stack_c::ZXYrotS(mBodyAngle.x, shape_angle.y, 0);
|
||||
mDoMtx_stack_c::multVec(&sp268, &sp298);
|
||||
@@ -355,10 +360,8 @@ void daAlink_c::setIronBallChainPos() {
|
||||
sp2A4 += sp298;
|
||||
}
|
||||
|
||||
s16 temp_r25 = sp2A4.atan2sX_Z();
|
||||
mIronBallChainAngle->set(sp2A4.atan2sY_XZ(), temp_r25, 0);
|
||||
mIronBallChainAngle->set(sp2A4.atan2sY_XZ(), sp2A4.atan2sX_Z(), 0);
|
||||
} else {
|
||||
f32 var_f30;
|
||||
if (mItemVar0.field_0x3018 == 4 || mItemVar0.field_0x3018 == 5) {
|
||||
var_f30 = mpHIO->mItem.mIronBall.m.mThrowChainGravity;
|
||||
} else {
|
||||
@@ -384,9 +387,9 @@ void daAlink_c::setIronBallChainPos() {
|
||||
|
||||
BOOL sp2C = ((mItemVar0.field_0x3018 == 0 && checkUnderMove1BckNoArc(ANM_IRONBALL_WALK)) && mNowAnmPackUnder[1].getRatio() > 0.8f) && (mUnderFrameCtrl[1].getFrame() >= 24.0f || mUnderFrameCtrl[1].getFrame() <= 3.0f);
|
||||
|
||||
f32 temp_f31 = 5.0f * (5.0f * (mNowAnmPackUnder[1].getRatio() - 0.8f));
|
||||
f32 temp_f28 = temp_f31 * cM_scos(shape_angle.y);
|
||||
temp_f31 *= cM_ssin(shape_angle.y);
|
||||
var_f31 = 5.0f * (5.0f * (mNowAnmPackUnder[1].getRatio() - 0.8f));
|
||||
var_f28 = var_f31 * cM_scos(shape_angle.y);
|
||||
var_f31 *= cM_ssin(shape_angle.y);
|
||||
|
||||
for (i = mItemMode; i > 0; i--, var_r29--, var_r26--) {
|
||||
sp28C = *var_r29;
|
||||
@@ -396,8 +399,8 @@ void daAlink_c::setIronBallChainPos() {
|
||||
} else {
|
||||
sp2A4 = (*var_r29 - *var_r27) + *var_r26;
|
||||
if (sp2C) {
|
||||
sp2A4.x += temp_f31;
|
||||
sp2A4.z += temp_f28;
|
||||
sp2A4.x += var_f31;
|
||||
sp2A4.z += var_f28;
|
||||
}
|
||||
sp2A4.y += var_f30;
|
||||
|
||||
@@ -421,10 +424,10 @@ void daAlink_c::setIronBallChainPos() {
|
||||
s16 sp10;
|
||||
s16 spE = mIronBallChainAngle->z + 0x3000;
|
||||
|
||||
for (i = 0; i < mItemMode; i++, sp3C++, var_r29++, spE += 0x3000) {
|
||||
for (i = 0; i < mItemMode; i++, sp3C++, var_r29++, ANGLE_ADD_2(spE, 0x3000)) {
|
||||
sp2A4 = (*var_r27 - *var_r29);
|
||||
|
||||
f32 var_f27 = sp2A4.absXZ();
|
||||
var_f27 = sp2A4.absXZ();
|
||||
if (var_f27 < 1.0f) {
|
||||
sp10 = sp3C[-1].y;
|
||||
} else {
|
||||
@@ -721,7 +724,7 @@ void daAlink_c::setIronBallPos() {
|
||||
}
|
||||
|
||||
if (mItemMode > 6) {
|
||||
mItemMode -= var_r22;
|
||||
ANGLE_SUB_2(mItemMode, var_r22);
|
||||
if (mItemMode <= 6) {
|
||||
mItemVar0.field_0x3018 = 8;
|
||||
}
|
||||
@@ -749,7 +752,7 @@ void daAlink_c::setIronBallPos() {
|
||||
mDoMtx_stack_c::multVec(&ironBallPosVec, mIronBallChainPos);
|
||||
|
||||
if (mItemMode > 6) {
|
||||
mItemMode -= 10;
|
||||
mItemMode -= (s16)10;
|
||||
if (mItemMode < 6) {
|
||||
mItemMode = 6;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user