Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ASSIGNMENT_OPERATOR macro #284

Merged
merged 2 commits into from
Jul 1, 2024
Merged
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
14 changes: 0 additions & 14 deletions include/rwsdk/rwplcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

#define rwBIGENDIAN

// Creates an operator= declaration for the type T.
// This is specifically meant as a temporary fix for __as functions
// that are auto-generated by the compiler, not for __as functions that
// appear to be hand-written.
#ifdef __cplusplus
#define ASSIGNMENT_OPERATOR(T) T& operator=(const T&);
#else
#define ASSIGNMENT_OPERATOR(T)
#endif

typedef long RwFixed;
typedef int RwInt32;
typedef unsigned int RwUInt32;
Expand Down Expand Up @@ -174,8 +164,6 @@ struct RwV3d
RwReal x;
RwReal y;
RwReal z;

ASSIGNMENT_OPERATOR(RwV3d)
};

struct RwV4dTag
Expand Down Expand Up @@ -800,8 +788,6 @@ struct rwGameCube2DVertex
RwRGBA emissiveColor;
RwReal u;
RwReal v;

ASSIGNMENT_OPERATOR(rwGameCube2DVertex)
};

typedef rwGameCube2DVertex RwIm2DVertex;
Expand Down
11 changes: 0 additions & 11 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,4 @@ typedef int32 bool32;

#define WEAK __declspec(weak)

// Creates an operator= declaration for the type T.
// This is specifically meant as a temporary fix for __as functions
// that are auto-generated by the compiler, not for __as functions that
// appear to be hand-written.
// Note: rwsdk has its own copy of this macro to avoid needing to include types.h.
#ifdef __cplusplus
#define ASSIGNMENT_OPERATOR(T) T& operator=(const T&);
#else
#define ASSIGNMENT_OPERATOR(T)
#endif

#endif
4 changes: 1 addition & 3 deletions src/SB/Core/gc/iColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ struct iColor_tag
uint8 g;
uint8 b;
uint8 a;

ASSIGNMENT_OPERATOR(iColor_tag)
};

#endif
#endif
13 changes: 0 additions & 13 deletions src/SB/Core/x/iCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,19 +316,6 @@ void iCameraSetFogParams(iFogParams* fp, float32 time)
}
#endif

iFogParams& iFogParams::operator=(const iFogParams& other) // temp
{
this->type = other.type;
this->start = other.start;
this->stop = other.stop;
this->density = other.density;
*(uint32*)&this->fogcolor = *(uint32*)&other.fogcolor;
*(uint32*)&this->bgcolor = *(uint32*)&other.bgcolor;
this->table = other.table;

return *this;
}

void iCameraSetFogRenderStates()
{
RwCamera* pCamera;
Expand Down
2 changes: 0 additions & 2 deletions src/SB/Core/x/iCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ struct iFogParams
RwRGBA fogcolor;
RwRGBA bgcolor;
uint8* table;

ASSIGNMENT_OPERATOR(iFogParams)
};

extern RwCamera* globalCamera;
Expand Down
31 changes: 0 additions & 31 deletions src/SB/Core/x/xBound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,6 @@ void xBoundGetBox(xBox& box, const xBound& bound)
}
}

xBox& xBox::operator=(const xBox& other) // temp
{
*(uint32*)&this->upper.x = *(uint32*)&other.upper.x;
*(uint32*)&this->upper.y = *(uint32*)&other.upper.y;
*(uint32*)&this->upper.z = *(uint32*)&other.upper.z;
*(uint32*)&this->lower.x = *(uint32*)&other.lower.x;
*(uint32*)&this->lower.y = *(uint32*)&other.lower.y;
*(uint32*)&this->lower.z = *(uint32*)&other.lower.z;

return *this;
}

void xBoundGetSphere(xSphere& o, const xBound& bound)
{
switch (bound.type)
Expand Down Expand Up @@ -515,25 +503,6 @@ xVec3& xVec3::operator-=(const xVec3& v)
return *this;
}

xVec3& xVec3::operator=(const xVec3& other) // temp
{
this->x = other.x;
this->y = other.y;
this->z = other.z;

return *this;
}

xSphere& xSphere::operator=(const xSphere& other) // temp
{
*(uint32*)&this->center.x = *(uint32*)&other.center.x;
*(uint32*)&this->center.y = *(uint32*)&other.center.y;
*(uint32*)&this->center.z = *(uint32*)&other.center.z;
this->r = other.r;

return *this;
}

void xDrawBox(const xBox*)
{
}
Expand Down
40 changes: 0 additions & 40 deletions src/SB/Core/x/xCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,36 +202,6 @@ void xCameraReset(xCamera* cam, float32 d, float32 h, float32 pitch)
xcam_collis_owner_disable = 0;
}

xMat4x3& xMat4x3::operator=(const xMat4x3& other) // temp
{
xMat3x3::operator=(other);

*(uint32*)&this->pos.x = *(uint32*)&other.pos.x;
*(uint32*)&this->pos.y = *(uint32*)&other.pos.y;
*(uint32*)&this->pos.z = *(uint32*)&other.pos.z;
*(uint32*)&this->pad3 = *(uint32*)&other.pad3;

return *this;
}

xMat3x3& xMat3x3::operator=(const xMat3x3& other) // temp
{
*(uint32*)&this->right.x = *(uint32*)&other.right.x;
*(uint32*)&this->right.y = *(uint32*)&other.right.y;
*(uint32*)&this->right.z = *(uint32*)&other.right.z;
*(uint32*)&this->flags = *(uint32*)&other.flags;
*(uint32*)&this->up.x = *(uint32*)&other.up.x;
*(uint32*)&this->up.y = *(uint32*)&other.up.y;
*(uint32*)&this->up.z = *(uint32*)&other.up.z;
*(uint32*)&this->pad1 = *(uint32*)&other.pad1;
*(uint32*)&this->at.x = *(uint32*)&other.at.x;
*(uint32*)&this->at.y = *(uint32*)&other.at.y;
*(uint32*)&this->at.z = *(uint32*)&other.at.z;
*(uint32*)&this->pad2 = *(uint32*)&other.pad2;

return *this;
}

#ifndef NON_MATCHING
static void xCam_buildbasis(xCamera* cam);
#else
Expand Down Expand Up @@ -1333,16 +1303,6 @@ void xVec3Inv(xVec3* o, const xVec3* v)
o->z = -v->z;
}

xQuat& xQuat::operator=(const xQuat& other) // temp
{
*(uint32*)&this->v.x = *(uint32*)&other.v.x;
*(uint32*)&this->v.y = *(uint32*)&other.v.y;
*(uint32*)&this->v.z = *(uint32*)&other.v.z;
this->s = other.s;

return *this;
}

float32 xacos(float32 x)
{
return std::acosf(x);
Expand Down
2 changes: 0 additions & 2 deletions src/SB/Core/x/xCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ struct xCamera : xBase
float32 roll_ccv;
float32 roll_csv;
xVec4 frustplane[12];

ASSIGNMENT_OPERATOR(xCamera)
};

struct xBinaryCamera
Expand Down
2 changes: 0 additions & 2 deletions src/SB/Core/x/xCollide.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ struct xCollis
uint32 index;
float32 r;
float32 d;

ASSIGNMENT_OPERATOR(tri_data)
};

uint32 flags;
Expand Down
31 changes: 0 additions & 31 deletions src/SB/Core/x/xDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,6 @@ void xtextbox::render(bool cache) const
render(temp_layout(cache), 0, -1);
}

#if 0
// WIP.
xfont& xfont::operator=(const xfont& other)
{
iColor_tag tmpColor;
float32 tmp;
float32 tmp2;

tmp = other.width;
this->id = other.id;
tmp2 = other.height;
this->width = tmp;
tmp = other.space;
this->height = tmp2;
tmpColor = other.color;
this->space = tmp;
tmp2 = other.clip.x;
this->color = tmpColor;
tmp = other.clip.y;
this->clip.x = tmp2;
tmp2 = other.clip.w;
this->clip.y = tmp;
tmp = other.clip.h;
this->clip.w = tmp2;
this->clip.h = tmp;

return *this;
}

#endif

float32 NSCREENY(float32 scale)
{
return _781 * scale;
Expand Down
6 changes: 1 addition & 5 deletions src/SB/Core/x/xEntDrive.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ struct xEntDrive
xVec3 loc;
float32 yaw;
xCollis* coll;

ASSIGNMENT_OPERATOR(tri_data)
};

uint32 flags;
Expand All @@ -31,12 +29,10 @@ struct xEntDrive
float32 yaw;
xVec3 dloc;
tri_data tri;

ASSIGNMENT_OPERATOR(xEntDrive)
};

void xEntDriveInit(xEntDrive* drv, xEnt* driven);
void xEntDriveMount(xEntDrive* drv, xEnt* driver, float32 mt, const xCollis* coll);
void xEntDriveDismount(xEntDrive* drv, float32 dmt);

#endif
#endif
2 changes: 0 additions & 2 deletions src/SB/Core/x/xFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ struct xFXRibbon
uint32 blend_src;
uint32 blend_dst;
float32 pivot;

ASSIGNMENT_OPERATOR(config)
};

struct joint_data
Expand Down
Loading