Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/** @file J3DMaterialAttach.h
* @brief Contains defintions and functions that relate to Drawn 3D Objects
*
* @author Captain Kitty Cat
* @bug No known bugs.
*/
#ifndef TP_J3DMATERIALATTACH_H
#define TP_J3DMATERIALATTACH_H

#include <cstdint>
#include <JSystem/J3DGraphBase/J3DMaterial.h>

namespace libtp::tp
{

struct J3DMaterialTable {
/* 0x0 */ uint8_t field_0x0[8];
/* 0x8 */ J3DMaterial** mMaterialNodePointer;
uint8_t unk1[0x14];
} __attribute__((__packed__));

static_assert(sizeof(J3DMaterialTable) == 0x20);
}
#endif /* TP_J3DMATERIALATTACH_H */
35 changes: 35 additions & 0 deletions include/JSystem/J3DGraphAnimator/J3DModelData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** @file J3DModelData.h
* @brief Contains defintions and functions that relate to Drawn 3D Objects
*
* @author Captain Kitty Cat
* @bug No known bugs.
*/
#ifndef TP_J3DMODELDATA_H
#define TP_J3DMODELDATA_H

#include <cstdint>
#include "J3DMaterialAttach.h"

namespace libtp::tp
{

struct J3DModelData {
/* 0x0 */ uint8_t field_0x0[0x58];
/* 0x58 */ J3DMaterialTable mMaterialTable;
/* 0x78 */ uint8_t unk1[0x6C];
} __attribute__((__packed__));

struct GXColorS10 {
/* 0x0 */ int16_t r;
/* 0x2 */ int16_t g;
/* 0x4 */ int16_t b;
/* 0x6 */ int16_t a;
} __attribute__((__packed__));

static_assert(sizeof(J3DModelData) == 0xE4);

extern "C" {
extern GXColorS10 j3dDefaultTevColor;
}
}
#endif /* TP_J3DMODELDATA_H */
24 changes: 24 additions & 0 deletions include/JSystem/J3DGraphBase/J3DMatBlock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/** @file J3DMatBlock.h
* @brief Contains defintions and functions that relate to Drawn 3D Objects
*
* @author Captain Kitty Cat
* @bug No known bugs.
*/
#ifndef TP_J3DMATBLOCK_H
#define TP_J3DMATBLOCK_H

#include <cstdint>

namespace libtp::tp
{

struct J3DTevBlock {
uint32_t field_0x0;
uint32_t mTexNoOffset;
} __attribute__((__packed__));

extern "C" {
//void setTevColor(libtp::tp::J3DTevBlock amog, uint32_t param_0, const GXColorS10* icolor);
}
}
#endif /* TP_J3DMATBLOCK_H */
27 changes: 27 additions & 0 deletions include/JSystem/J3DGraphBase/J3DMaterial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @file J3DMaterial.h
* @brief Contains defintions and functions that relate to Drawn 3D Objects
*
* @author Captain Kitty Cat
* @bug No known bugs.
*/
#ifndef TP_J3DMATERIAL_H
#define TP_J3DMATERIAL_H

#include <cstdint>
#include "J3DMatBlock.h"
#include "tp/J3DShape.h"

namespace libtp::tp
{

struct J3DMaterial {
/* 0x00 */ uint8_t field_0x0[0x8];
/* 0x08 */ libtp::tp::J3DShape::J3DShape* mShape;
/* 0x0C */ uint8_t field_0x0c[0x2C-0x0C];
/* 0x2C */ J3DTevBlock* mTevBlock;
/* 0x30 */ uint8_t field_0x30[0x4C-0x30];
} __attribute__((__packed__));

static_assert(sizeof(J3DMaterial) == 0x4C);
}
#endif /* TP_J3DMATERIAL_H */
26 changes: 26 additions & 0 deletions include/JSystem/JMath/JMATrigonometric.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @file JMATrigonometric.h
* @brief Contains functions for handling various aspects of the game
*
* @author Captain Kitty Cat
* @bug No known bugs.
*/
#ifndef JMATRIGONOMETRIC_H
#define JMATRIGONOMETRIC_H

#include <cstdint>
#include <utility.h>

namespace libtp::tp
{
struct TSinCosTable
{
libtp::pair<float, float> table[0x2000];

} __attribute__((__packed__));

extern "C"
{
extern TSinCosTable sincosTable_;
}
} // namespace libtp::tp
#endif
19 changes: 18 additions & 1 deletion include/tp/J3DShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @brief Contains defintions and functions that relate to Drawn 3D Objects
*
* @author Lunar Soap
* @author Captain Kitty Cat
* @bug No known bugs.
*/
#ifndef TP_J3DSHAPE_H
Expand All @@ -12,6 +13,15 @@

namespace libtp::tp::J3DShape
{
enum J3DShpFlag {
J3DShpFlag_Visible = 0x0001,
J3DShpFlag_SkinPosCpu = 0x0004,
J3DShpFlag_SkinNrmCpu = 0x0008,
J3DShpFlag_Hidden = 0x0010,
J3DShpFlag_EnableLod = 0x0100,
J3DShpFlag_NoMtx = 0x0200,
};

struct J3DShape
{
/* 0x00 */ void* vtable;
Expand Down Expand Up @@ -42,5 +52,12 @@ namespace libtp::tp::J3DShape

static_assert(sizeof(J3DShape) == 0x68);

extern "C" {
void onFlag(J3DShape* shapePtr, uint32_t flaag);
void offFlag(J3DShape* shapePtr, uint32_t flaag);
void showMesh(J3DShape* shapePtr);
void hideMesh(J3DShape* shapePtr);
}

} // namespace libtp::tp::J3DShape
#endif
#endif
7 changes: 4 additions & 3 deletions include/tp/d_a_alink.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "tp/J3DShape.h"
#include "SSystem/SComponent/c_phase.h"
#include "tp/J3DModel.h"
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
#include "tp/m_do_ext.h"

namespace libtp::tp::d_a_alink
Expand Down Expand Up @@ -402,7 +403,7 @@ namespace libtp::tp::d_a_alink
/* 0x0063C */ request_of_phase_process_class mShieldPhaseReq;
/* 0x00644 */ char* mShieldArcName;
/* 0x00648 */ void* field_0x0648; // JKRExpHeap*
/* 0x0064C */ void* field_0x064C; // J3DModelData*
/* 0x0064C */ J3DModelData* field_0x064C;
/* 0x00650 */ libtp::tp::J3DModel::J3DModel* mpLinkModel;
/* 0x00654 */ libtp::tp::J3DModel::J3DModel* mpLinkFaceModel;
/* 0x00658 */ libtp::tp::J3DModel::J3DModel* mpLinkHatModel;
Expand Down Expand Up @@ -431,7 +432,7 @@ namespace libtp::tp::d_a_alink
/* 0x006B4 */ libtp::tp::J3DAnimation::J3DAnmTransform* field_0x06b4;
/* 0x006B8 */ libtp::tp::J3DModel::J3DModel* mSwordModel;
/* 0x006BC */ libtp::tp::J3DModel::J3DModel* mSheathModel;
/* 0x006C0 */ void* field_0x06c0; // J3DModelData*
/* 0x006C0 */ J3DModelData* field_0x06c0;
/* 0x006C4 */ libtp::tp::J3DAnimation::J3DAnmTextureSRTKey* m_nSwordBtk;
/* 0x006C8 */ libtp::tp::J3DAnimation::J3DAnmTextureSRTKey* m_mSwordBtk;
/* 0x006CC */ libtp::tp::J3DAnimation::J3DAnmTevRegKey* m_mSwordBrk;
Expand Down Expand Up @@ -461,7 +462,7 @@ namespace libtp::tp::d_a_alink
/* 0x0072C */ libtp::tp::J3DAnimation::J3DAnmTexPattern* field_0x072c;
/* 0x00730 */ libtp::tp::m_Do_ext::mDoExt_bckAnm mItemBck;
/* 0x0074C */ libtp::tp::m_Do_ext::mDoExt_bckAnm mHookTipBck;
/* 0x00768 */ void* mpHookKusariModelData; // J3DModelData
/* 0x00768 */ J3DModelData* mpHookKusariModelData;
/* 0x0076C */ void* mpHookSound; // Z2SoundObjSimple
/* 0x00770 */ void* mpHookChain; // hsChainShape_c
/* 0x00774 */ uint8_t field_0x0774[0x8];
Expand Down
23 changes: 23 additions & 0 deletions source/tp/J3DShape.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <tp/J3DShape.h>

#include <cstdint>

namespace libtp::tp::J3DShape
{
void onFlag(J3DShape* shapePtr, uint32_t flaag) {
shapePtr->mFlags |= flaag;
}

void offFlag(J3DShape* shapePtr, uint32_t flaag) {
shapePtr->mFlags &= ~flaag;
}

void showMesh(J3DShape* shapePtr) {
offFlag(shapePtr, J3DShpFlag_Visible);
}

void hideMesh(J3DShape* shapePtr) {
onFlag(shapePtr, J3DShpFlag_Visible);
}

} // namespace libtp::tp::J3DShape