Compiler compat fix: Passing of rvalue GXColors to non-const reference parameters (#1142)

This commit is contained in:
LagoLunatic
2026-07-31 13:20:48 -04:00
committed by GitHub
parent 641268e340
commit 45718d8ccc
16 changed files with 87 additions and 171 deletions
+7 -7
View File
@@ -62,16 +62,16 @@ public:
};
/* 0x0C */ virtual void setGX() = 0;
/* 0x10 */ virtual void setGX(JUtility::TColor col1, JUtility::TColor col2);
/* 0x10 */ virtual void setGX(JUtility::TColor col1, JUtility::TColor col2) { setGX(); }
/* 0x14 */ virtual f32 drawChar_scale(f32 a1, f32 a2, f32 a3, f32 a4, int a5, bool a6) = 0;
/* 0x18 */ virtual int getLeading() const = 0;
/* 0x1C */ virtual s32 getAscent() const = 0;
/* 0x20 */ virtual s32 getDescent() const = 0;
/* 0x24 */ virtual s32 getHeight() const = 0;
/* 0x28 */ virtual s32 getWidth() const = 0;
/* 0x1C */ virtual int getAscent() const = 0;
/* 0x20 */ virtual int getDescent() const = 0;
/* 0x24 */ virtual int getHeight() const = 0;
/* 0x28 */ virtual int getWidth() const = 0;
/* 0x2C */ virtual void getWidthEntry(int i_no, TWidth* width) const = 0;
/* 0x30 */ virtual int getCellWidth() const;
/* 0x34 */ virtual s32 getCellHeight() const;
/* 0x30 */ virtual int getCellWidth() const { return getWidth(); }
/* 0x34 */ virtual int getCellHeight() const { return getHeight(); }
/* 0x38 */ virtual int getFontType() const = 0;
/* 0x3C */ virtual const ResFONT* getResFont() const = 0;
/* 0x40 */ virtual bool isLeadByte(int a1) const = 0;
+5 -5
View File
@@ -17,13 +17,13 @@ public:
virtual const ResFONT* getResFont() const { return mResFont; }
virtual int getFontType() const { return mInfoBlock->fontType; }
virtual int getLeading() const { return mInfoBlock->leading; }
virtual s32 getWidth() const { return mInfoBlock->width; }
virtual s32 getAscent() const { return mInfoBlock->ascent; }
virtual s32 getDescent() const { return mInfoBlock->descent; }
virtual s32 getHeight() const { return getAscent() + getDescent(); }
virtual int getWidth() const { return mInfoBlock->width; }
virtual int getAscent() const { return mInfoBlock->ascent; }
virtual int getDescent() const { return mInfoBlock->descent; }
virtual int getHeight() const { return getAscent() + getDescent(); }
virtual void getWidthEntry(int, JUTFont::TWidth*) const;
virtual int getCellWidth() const;
virtual s32 getCellHeight() const;
virtual int getCellHeight() const;
virtual bool isLeadByte(int) const;
virtual void loadImage(int, GXTexMapID);
virtual void setBlock();
+8 -2
View File
@@ -151,8 +151,14 @@ public:
virtual void draw();
void setAlpha(u8 i_alpha) { mBlack.a = i_alpha; }
void setBlackColor(GXColor& c) { mBlack = c; }
void setWhiteColor(GXColor& c) { mWhite = c; }
void setBlackColor(GXColor& i_color) { mBlack = i_color; }
void setWhiteColor(GXColor& i_color) { mWhite = i_color; }
// some calls to these functions define i_color inline which is illegal in C++ for a non-const
// reference parameter - we add these overloads to enable standard compiler compatibility
#if !__MWERKS__
void setBlackColor(const GXColor& i_color) { mBlack = const_cast<GXColor&>(i_color); }
void setWhiteColor(const GXColor& i_color) { mWhite = const_cast<GXColor&>(i_color); }
#endif
public:
struct TexEntry {
+35 -12
View File
@@ -454,9 +454,10 @@ public:
void reset() { mp3DlineMat = NULL; }
void setMat(mDoExt_3DlineMat_c* pMat);
void setMat(mDoExt_3DlineMat_c* i_3DlineMat);
virtual void draw();
virtual ~mDoExt_3DlineMatSortPacket();
virtual ~mDoExt_3DlineMatSortPacket() {}
private:
/* 0x10 */ mDoExt_3DlineMat_c* mp3DlineMat;
@@ -588,11 +589,22 @@ public:
~mDoExt_3DlineMat0_c() {}
BOOL init(u16 numLines, u16 numSegments, BOOL hasSize);
void setMaterial();
void draw();
void update(u16, f32, GXColor&, u16, dKy_tevstr_c*);
void update(u16, GXColor&, dKy_tevstr_c*);
int getMaterialID();
void update(u16 i_segs, f32 i_size, GXColor& i_color, u16 i_space, dKy_tevstr_c* i_tevStr);
void update(u16 i_segs, GXColor& i_color, dKy_tevstr_c* i_tevStr);
// some calls to these functions define i_color inline which is illegal in C++ for a non-const
// reference parameter - we add these overloads to enable standard compiler compatibility
#if !__MWERKS__
void update(u16 i_segs, f32 i_size, const _GXColor& i_color, u16 i_space, dKy_tevstr_c* i_tevStr) {
update(i_segs, i_size, const_cast<_GXColor&>(i_color), i_space, i_tevStr);
}
void update(u16 i_segs, const _GXColor& i_color, dKy_tevstr_c* i_tevStr) {
update(i_segs, const_cast<_GXColor&>(i_color), i_tevStr);
}
#endif
virtual int getMaterialID() { return 0; }
virtual void setMaterial();
virtual void draw();
cXyz* getPos(int i_idx) { return mpLines[i_idx].mpSegments; }
u8* getSize(int i_idx) { return mpLines[i_idx].mpSize; }
@@ -612,11 +624,22 @@ public:
~mDoExt_3DlineMat1_c() {}
BOOL init(u16 numLines, u16 numSegments, ResTIMG* i_img, BOOL hasSize);
void setMaterial();
void draw();
void update(u16, f32, GXColor&, u16, dKy_tevstr_c*);
void update(u16, GXColor&, dKy_tevstr_c*);
int getMaterialID();
void update(u16 i_segs, f32 i_size, GXColor& i_color, u16 i_space, dKy_tevstr_c* i_tevStr);
void update(u16 i_segs, GXColor& i_color, dKy_tevstr_c* i_tevStr);
// some calls to these functions define i_color inline which is illegal in C++ for a non-const
// reference parameter - we add these overloads to enable standard compiler compatibility
#if !__MWERKS__
void update(u16 i_segs, f32 i_size, const GXColor& i_color, u16 i_space, dKy_tevstr_c* i_tevStr) {
update(i_segs, i_size, const_cast<GXColor&>(i_color), i_space, i_tevStr);
}
void update(u16 i_segs, const GXColor& i_color, dKy_tevstr_c* i_tevStr) {
update(i_segs, const_cast<GXColor&>(i_color), i_tevStr);
}
#endif
virtual int getMaterialID() { return 1; }
virtual void setMaterial();
virtual void draw();
cXyz* getPos(int i_idx) { return mpLines[i_idx].mpSegments; }
u8* getSize(int i_idx) { return mpLines[i_idx].mpSize; }