mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-27 23:45:55 -04:00
J2DPane (#168)
* most of J2DPane * finish j2dpane * cleanup * use J2DBlendInfo
This commit is contained in:
@@ -15,6 +15,7 @@ public:
|
||||
|
||||
s16 getFrameMax() const { return mFrameMax; }
|
||||
void setFrame(f32 frame) { mFrame = frame; }
|
||||
s32 getKind() const { return mKind; }
|
||||
|
||||
private:
|
||||
/* 0x0 */ // vtable
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef J2DGRAFCONTEXT_H
|
||||
#define J2DGRAFCONTEXT_H
|
||||
|
||||
#include "JSystem/J2DGraph/J2DMatBlock.h"
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
@@ -35,7 +36,7 @@ public:
|
||||
/* 802E9664 */ virtual s32 getGrafType() const { return 0; }
|
||||
/* 802E966C */ virtual void setLookat() {}
|
||||
|
||||
protected:
|
||||
public:
|
||||
/* 0x04 */ JGeometry::TBox2<f32> mBounds;
|
||||
/* 0x14 */ JGeometry::TBox2<f32> mScissorBounds;
|
||||
/* 0x24 */ JUtility::TColor mColorTL;
|
||||
@@ -46,15 +47,9 @@ protected:
|
||||
/* 0x38 */ JGeometry::TVec2<f32> mPrevPos;
|
||||
/* 0x40 */ Mtx44 mMtx44;
|
||||
/* 0x80 */ Mtx mPosMtx;
|
||||
/* 0xB0 */ u8 field_0xb0;
|
||||
/* 0xB1 */ u8 field_0xb1;
|
||||
/* 0xB2 */ u8 field_0xb2;
|
||||
/* 0xB3 */ u8 mLineBlendMode;
|
||||
/* 0xB4 */ u8 mLineSrcBlendFactor;
|
||||
/* 0xB5 */ u8 mLineDstBlendFactor;
|
||||
/* 0xB6 */ u8 mBoxBlendMode;
|
||||
/* 0xB7 */ u8 mBoxSrcBlendFactor;
|
||||
/* 0xB8 */ u8 mBoxDstBlendFactor;
|
||||
/* 0xB0 */ J2DBlendInfo field_0xb0;
|
||||
/* 0xB3 */ J2DBlendInfo mLinePart;
|
||||
/* 0xB6 */ J2DBlendInfo mBoxPart;
|
||||
};
|
||||
|
||||
#endif /* J2DGRAFCONTEXT_H */
|
||||
|
||||
@@ -11,8 +11,8 @@ struct J2DResReference {
|
||||
|
||||
class J2DDataManage {
|
||||
public:
|
||||
/* 8030CE18 */ void get(char const*);
|
||||
/* 8030CE7C */ void get(JSUInputStream*);
|
||||
/* 8030CE18 */ void* get(char const*);
|
||||
/* 8030CE7C */ void* get(JSUInputStream*);
|
||||
};
|
||||
|
||||
#endif /* J2DMANAGE_H */
|
||||
|
||||
@@ -414,11 +414,11 @@ struct J2DBlendInfo {
|
||||
/* 0x0 */ u8 mType;
|
||||
/* 0x1 */ u8 mSrcFactor;
|
||||
/* 0x2 */ u8 mDstFactor;
|
||||
/* 0x3 */ u8 mOp;
|
||||
};
|
||||
|
||||
struct J2DBlend {
|
||||
/* 0x0 */ J2DBlendInfo mBlendInfo;
|
||||
/* 0x3 */ u8 mOp;
|
||||
};
|
||||
|
||||
class J2DPEBlock {
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
J2DPane(J2DPane* other, JSURandomInputStream* stream, u8 arg3);
|
||||
virtual ~J2DPane();
|
||||
|
||||
/* 0x0c */ virtual s32 getTypeID() const;
|
||||
/* 0x0c */ virtual s32 getTypeID() const { return 16; }
|
||||
/* 0x10 */ virtual void move(f32 x, f32 y);
|
||||
/* 0x14 */ virtual void add(f32 x, f32 y);
|
||||
/* 0x18 */ virtual void resize(f32 x, f32 y);
|
||||
@@ -53,12 +53,12 @@ public:
|
||||
/* 0x58 */ virtual void rewriteAlpha();
|
||||
/* 0x5c */ virtual void setAnimation(J2DAnmBase* anm);
|
||||
/* 0x60 */ virtual void setAnimation(J2DAnmTransform* anm);
|
||||
/* 0x64 */ virtual void setAnimation(J2DAnmColor* anm);
|
||||
/* 0x68 */ virtual void setAnimation(J2DAnmTexPattern* anm);
|
||||
/* 0x6c */ virtual void setAnimation(J2DAnmTextureSRTKey* anm);
|
||||
/* 0x70 */ virtual void setAnimation(J2DAnmTevRegKey* anm);
|
||||
/* 0x74 */ virtual void setAnimation(J2DAnmVisibilityFull* anm);
|
||||
/* 0x78 */ virtual void setAnimation(J2DAnmVtxColor* anm);
|
||||
/* 0x64 */ virtual void setAnimation(J2DAnmColor* anm) {}
|
||||
/* 0x68 */ virtual void setAnimation(J2DAnmTexPattern* anm) {}
|
||||
/* 0x6c */ virtual void setAnimation(J2DAnmTextureSRTKey* anm) {}
|
||||
/* 0x70 */ virtual void setAnimation(J2DAnmTevRegKey* anm) {}
|
||||
/* 0x74 */ virtual void setAnimation(J2DAnmVisibilityFull* anm) {}
|
||||
/* 0x78 */ virtual void setAnimation(J2DAnmVtxColor* anm) {}
|
||||
/* 0x7c */ virtual const J2DAnmTransform* animationTransform(const J2DAnmTransform* transform);
|
||||
/* 0x80 */ virtual void setVisibileAnimation(J2DAnmVisibilityFull* visibility);
|
||||
/* 0x84 */ virtual void setAnimationVF(J2DAnmVisibilityFull* visibility);
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
void clip(const JGeometry::TBox2<f32>& bounds);
|
||||
void setBasePosition(J2DBasePosition position);
|
||||
void setInfluencedAlpha(bool arg1, bool arg2);
|
||||
void getGlbVtx(u8 arg1) const;
|
||||
JGeometry::TVec3<f32> getGlbVtx(u8 arg1) const;
|
||||
J2DPane* getFirstChildPane();
|
||||
J2DPane* getNextChildPane();
|
||||
J2DPane* getParentPane();
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
void updateTransform(const J2DAnmTransform* transform);
|
||||
void setUserInfo(u64 info) { mUserInfoTag = info; }
|
||||
|
||||
static f32 static_mBounds[4];
|
||||
static JGeometry::TBox2<f32> static_mBounds;
|
||||
|
||||
public:
|
||||
/* 0x04 */ u16 _4;
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
/* 802F9640 */ static void* getNameResource(char const*);
|
||||
/* 802F9690 */ void animation();
|
||||
|
||||
static J2DDataManage* getDataManage() { return mDataManage; }
|
||||
|
||||
static J2DDataManage* mDataManage;
|
||||
|
||||
private:
|
||||
|
||||
@@ -92,6 +92,10 @@ template<> struct TBox<TVec2<f32> > {
|
||||
|
||||
bool isValid() const { return f.isAbove(i); }
|
||||
|
||||
void addPos(f32 x, f32 y) {
|
||||
addPos(TVec2<f32>(x, y));
|
||||
}
|
||||
|
||||
void addPos(const TVec2<f32>& pos) {
|
||||
i.add(pos);
|
||||
f.add(pos);
|
||||
@@ -123,7 +127,7 @@ struct TBox2 : TBox<TVec2<T> > {
|
||||
}
|
||||
|
||||
void set(const TBox2& other) { set(other.i, other.f); }
|
||||
void set(const TVec2<f32>& i, const TVec2<f32> f) { this->i.set(i), this->f.set(f); }
|
||||
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
|
||||
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,30 @@ public:
|
||||
/* vt[4] */ virtual s32 skip(s32);
|
||||
/* vt[5] */ virtual u32 readData(void*, s32) = 0;
|
||||
|
||||
u32 read32b() {
|
||||
u32 val;
|
||||
this->read(&val, sizeof(val));
|
||||
return val;
|
||||
}
|
||||
|
||||
s16 readS16() {
|
||||
s16 val;
|
||||
this->read(&val, sizeof(val));
|
||||
return val;
|
||||
}
|
||||
|
||||
u16 readU16() {
|
||||
u16 val;
|
||||
this->read(&val, sizeof(val));
|
||||
return val;
|
||||
}
|
||||
|
||||
u8 readU8() {
|
||||
u8 val;
|
||||
this->read(&val, sizeof(val));
|
||||
return val;
|
||||
}
|
||||
|
||||
// TODO: return value probably wrong
|
||||
/* 802DC298 */ s32 read(void*, s32);
|
||||
}; // Size = 0x8
|
||||
|
||||
@@ -157,67 +157,33 @@ private:
|
||||
// Tree
|
||||
//
|
||||
|
||||
#define JSU_TREE_FROM_LINK(T, LINK) (JSUTree<T>*)(((u8*)(LINK)) - 12)
|
||||
#define JSU_TREE_LINK_IF_NOT_NULL(TREE) \
|
||||
if (TREE) { \
|
||||
TREE = (JSUTree<T>*)(&(TREE)->mLink); \
|
||||
}
|
||||
|
||||
#define _JSU_TREE_AS_LINK(TREE) ((JSULink<T>*)(TREE))
|
||||
|
||||
template <typename T>
|
||||
class JSUTree {
|
||||
class JSUTree : public JSUList<T>, public JSULink<T> {
|
||||
public:
|
||||
JSUTree(T* owner) : mList(), mLink(owner) {}
|
||||
JSUTree(T* owner) : JSUList<T>(), JSULink<T>(owner) {}
|
||||
~JSUTree() {}
|
||||
|
||||
bool appendChild(JSUTree<T>* child) {
|
||||
JSU_TREE_LINK_IF_NOT_NULL(child);
|
||||
return this->mList.append(_JSU_TREE_AS_LINK(child));
|
||||
}
|
||||
bool appendChild(JSUTree<T>* child) { return this->append(child); }
|
||||
|
||||
bool removeChild(JSUTree<T>* child) {
|
||||
JSU_TREE_LINK_IF_NOT_NULL(child);
|
||||
return this->mList.remove(_JSU_TREE_AS_LINK(child));
|
||||
}
|
||||
bool removeChild(JSUTree<T>* child) { return this->remove(child); }
|
||||
|
||||
bool insertChild(JSUTree<T>* before, JSUTree<T>* child) {
|
||||
JSU_TREE_LINK_IF_NOT_NULL(before);
|
||||
JSU_TREE_LINK_IF_NOT_NULL(child);
|
||||
return this->mList.insert(_JSU_TREE_AS_LINK(before), _JSU_TREE_AS_LINK(child));
|
||||
}
|
||||
bool insertChild(JSUTree<T>* before, JSUTree<T>* child) { return this->insert(before, child); }
|
||||
|
||||
JSUTree<T>* getEndChild() const { return NULL; }
|
||||
|
||||
JSUTree<T>* getFirstChild() const {
|
||||
JSULink<T>* link = this->mList.getFirst();
|
||||
return link ? JSU_TREE_FROM_LINK(T, link) : (JSUTree<T>*)link;
|
||||
}
|
||||
JSUTree<T>* getFirstChild() const { return (JSUTree<T>*)this->getFirst(); }
|
||||
|
||||
JSUTree<T>* getLastChild() const {
|
||||
JSULink<T>* link = this->mList.getLast();
|
||||
return link ? JSU_TREE_FROM_LINK(T, link) : (JSUTree<T>*)link;
|
||||
}
|
||||
JSUTree<T>* getLastChild() const { return (JSUTree<T>*)this->getLast(); }
|
||||
|
||||
JSUTree<T>* getNextChild() const {
|
||||
JSULink<T>* link = this->mLink.getNext();
|
||||
return link ? JSU_TREE_FROM_LINK(T, link) : (JSUTree<T>*)link;
|
||||
}
|
||||
JSUTree<T>* getNextChild() const { return (JSUTree<T>*)this->getNext(); }
|
||||
|
||||
JSUTree<T>* getPrevChild() const {
|
||||
JSULink<T>* link = this->mLink.getPrev();
|
||||
return link ? JSU_TREE_FROM_LINK(T, link) : (JSUTree<T>*)link;
|
||||
}
|
||||
JSUTree<T>* getPrevChild() const { return (JSUTree<T>*)this->getPrev(); }
|
||||
|
||||
u32 getNumChildren() const { return this->mList.getNumLinks(); }
|
||||
u32 getNumChildren() const { return this->getNumLinks(); }
|
||||
|
||||
T* getObject() const { return this->mLink.getObject(); }
|
||||
T* getObject() const { return (T*)this->getObjectPtr(); }
|
||||
|
||||
JSUTree<T>* getParent() const { return (JSUTree<T>*)this->mLink.getList(); }
|
||||
|
||||
private:
|
||||
JSUList<T> mList;
|
||||
JSULink<T> mLink;
|
||||
JSUTree<T>* getParent() const { return (JSUTree<T>*)this->getList(); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
#ifndef JUTRESOURCE_H
|
||||
#define JUTRESOURCE_H
|
||||
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
#include "JSystem/JSupport/JSUInputStream.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class JUTResReference {
|
||||
private:
|
||||
u8 unk_0x0[0x100];
|
||||
|
||||
public:
|
||||
JUTResReference() { unk_0x0[0] = 0; }
|
||||
/* 802DE078 */ void* getResource(JSUInputStream*, u32, JKRArchive*);
|
||||
/* 802DE120 */ void getResource(void const*, u32, JKRArchive*);
|
||||
/* 802DE1BC */ void getResource(u32, JKRArchive*);
|
||||
};
|
||||
// only rough size known due to getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive
|
||||
|
||||
#endif /* JUTRESOURCE_H */
|
||||
|
||||
Reference in New Issue
Block a user