Files
tww/include/JSystem/J3DGraphBase/J3DTexture.h
T
mattias-blum d945c14cac d_a_ship 95% (#706)
* Initial Progress

Basic functions at 100% matching

100% Matching:
- `daShip_Draw`
- `daShip_Execute`
- `daShip_IsDelete`
- `daShip_Delete`
- `daShip_createHeap`
- `daShip_Create`

* implemented `getJointPos` inlines in `daTornado_c` needed for d_a_ship

* implemented `Center()` inline in `dCamera_c` needed for d_a_ship

* added `setTranslationX` inline to `J3DTexMtx` needed for match in d_a_ship

* parameters set to `const` for certain inlines in `m_Do_mtx.h`

* added `dComIfGp_onMenuCollect` inline

* changed `shipSpecialDemoStart` return type to `BOOL`

* added member functions to `dPa_waveEcallBack`, `dPa_splashEcallBack `, `dPa_trackEcallBack`

also modified member type of `mRotMtx` of `dPa_waveEcallBack`  and `mPos` of `dPa_trackEcallBack`

* added member to `daGrid_c` that is used in d_a_ship

* added `mDoAud_setShipSailState` and `mDoAud_shipCruiseSePlay` inline functions

* added `fopAcM_seenPlayerAngleY` inline

* d_a_ship mostly matching

approx. 90% matching, mostly regalloc issues. , `checkNextMode`, `setRopePos`, `setHeadAnm`, and `execute` need to have their logic fixer

* replace `unknown_inline_TODO ` from `daShip_c` with `checkForceMove`

* .data match

* .rodata matching

* more inline return type changes from `bool` to `BOOL`

Also changed the array size of `mPlayerStatus`

* implemented `force_calc_wind_rel_angle` inline in `daGrid_c`

* fix `d_a_ship_static`

* fixed `getEmitterAxis`, might need review but works for now

* more progress

* reverted change to `getEmitterAxis`, moved casts to function call in `dPa_waveEcallBack::executeAfter`

* more progress

* change return types of certain inlines from `BOOL` to `u32`

`dComIfGp_checkCameraAttentionStatus`, `dComIfGp_checkPlayerStatus0`, `dComIfGp_checkPlayerStatus1` needed for match in d_a_ship

* fixed memory addresses in `daGrid_c`

* more progress

* resolving symbols

* Initial PR changes

* Removed unnecessary cast

* replaced instances of `PSVECSquareMag` with corresponding inline functions

* update memory layout in `d_a_grid` for consistency

* More PR changes

`checkNextMode` and `procZevDemo` now at 100% matching
2025-03-28 14:17:21 -04:00

93 lines
2.9 KiB
C++

#ifndef J3DTEXTURE_H
#define J3DTEXTURE_H
#include "JSystem/J3DGraphBase/J3DGD.h"
#include "JSystem/J3DGraphBase/J3DStruct.h"
#include "JSystem/J3DGraphBase/J3DTevs.h"
#include "JSystem/JUtility/JUTTexture.h"
#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
inline void J3DGDLoadTexMtxImm(Mtx pMtx, u32 i, GXTexMtxType mType) {
u16 cmd = i * 4;
u8 len = mType == GX_MTX2x4 ? 8 : 12;
J3DGDWriteXFCmdHdr(cmd, len);
J3DGDWrite_f32(pMtx[0][0]);
J3DGDWrite_f32(pMtx[0][1]);
J3DGDWrite_f32(pMtx[0][2]);
J3DGDWrite_f32(pMtx[0][3]);
J3DGDWrite_f32(pMtx[1][0]);
J3DGDWrite_f32(pMtx[1][1]);
J3DGDWrite_f32(pMtx[1][2]);
J3DGDWrite_f32(pMtx[1][3]);
if (mType == GX_MTX3x4) {
J3DGDWrite_f32(pMtx[2][0]);
J3DGDWrite_f32(pMtx[2][1]);
J3DGDWrite_f32(pMtx[2][2]);
J3DGDWrite_f32(pMtx[2][3]);
}
}
class J3DTexture {
private:
/* 0x0 */ u16 mNum;
/* 0x4 */ ResTIMG* mpRes;
public:
J3DTexture(u16 num, ResTIMG* res) : mNum(num), mpRes(res) {}
virtual ~J3DTexture() {}
void loadGX(u16, GXTexMapID) const;
void entryNum(u16);
void addResTIMG(u16, ResTIMG const*);
u16 getNum() const { return mNum; }
ResTIMG* getResTIMG(u16 entry) const { return &mpRes[entry]; }
void setResTIMG(u16 entry, const ResTIMG& timg) {
mpRes[entry] = timg;
mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry)));
mpRes[entry].paletteOffset = ((mpRes[entry].paletteOffset + (u32)&timg - (u32)(mpRes + entry)));
}
};
class J3DTexMtx {
public:
J3DTexMtx() { mTexMtxInfo = j3dDefaultTexMtxInfo; }
J3DTexMtx(const J3DTexMtxInfo& info) {
mTexMtxInfo = info;
}
~J3DTexMtx() {}
void load(u32 texMtxID) const {
GDOverflowCheck(53);
J3DGDLoadTexMtxImm((Mtx&)mMtx, GX_TEXMTX0 + texMtxID * 3, (GXTexMtxType)mTexMtxInfo.mProjection);
};
void calc();
J3DTexMtxInfo& getTexMtxInfo() { return mTexMtxInfo; }
Mtx& getMtx() { return mMtx; }
void setEffectMtx(Mtx effectMtx) { mTexMtxInfo.setEffectMtx(effectMtx); }
Mtx& getViewMtx() { return mViewMtx; }
void setViewMtx(const Mtx viewMtx) { MTXCopy(viewMtx, mViewMtx); }
void setTranslationX(f32 translationX){ mTexMtxInfo.mSRT.mTranslationX = translationX; } // Fakematch
// TODO
void getTextureSRT() {}
private:
/* 0x00 */ J3DTexMtxInfo mTexMtxInfo;
/* 0x64 */ Mtx mMtx;
/* 0x94 */ Mtx mViewMtx;
}; // Size: 0xC4
struct J3DTexCoord : public J3DTexCoordInfo {
J3DTexCoord() { *(J3DTexCoordInfo*)this = j3dDefaultTexCoordInfo[0]; }
J3DTexCoord(const J3DTexCoordInfo& info) { *(J3DTexCoordInfo*)this = info; }
u8 getTexGenType() { return mTexGenType; }
u8 getTexGenSrc() { return mTexGenSrc; }
u32 getTexGenMtx() { return mTexGenMtx & 0xFF; }
void setTexGenMtx(u8 v) { mTexGenMtx = v; }
}; // Size: 0x4
#endif /* J3DTEXTURE_H */