Skip to content

Commit

Permalink
Finish matching xSurface
Browse files Browse the repository at this point in the history
  • Loading branch information
tgsm authored and SquareMan committed Jun 27, 2024
1 parent 2e4509c commit 89958ff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
Object(NonMatching, "SB/Core/x/xSpline.cpp"),
Object(NonMatching, "SB/Core/x/xstransvc.cpp"),
Object(NonMatching, "SB/Core/x/xString.cpp"),
Object(NonMatching, "SB/Core/x/xSurface.cpp"),
Object(Matching, "SB/Core/x/xSurface.cpp"),
Object(NonMatching, "SB/Core/x/xTimer.cpp"),
Object(NonMatching, "SB/Core/x/xTRC.cpp"),
Object(Matching, "SB/Core/x/xutil.cpp"),
Expand Down
34 changes: 11 additions & 23 deletions src/SB/Core/x/xSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@

#include <types.h>

extern xSurface* surfs;
extern uint16 nsurfs;
xSurface* surfs;
uint16 nsurfs;

#if 0
// The for loop is off.
void xSurfaceInit(uint16 num_surfs)
{
nsurfs = num_surfs;
if (num_surfs != 0)
{
surfs = (xSurface*)xMemAllocSize(num_surfs * sizeof(xSurface));
for (int32 i = 0; i < nsurfs; i++)
for (uint16 i = 0; i < nsurfs; i++)
{
surfs[i].idx = i;
}
Expand All @@ -25,32 +23,22 @@ void xSurfaceInit(uint16 num_surfs)
}
}

#endif
extern "C" {
extern void __copy(void* dst, const void* src, uint32 n);
}

#if 0
// Close to being finished.
void xSurface::operator=(const xSurface& ent)
xSurface& xSurface::operator=(const xSurface& ent)
{
xBase::operator=(ent);
this->idx = ent.idx;
this->type = ent.type;
this->ent = ent.ent;
this->friction = ent.friction;
this->state = ent.state;
this->pad = ent.pad; // Make this call __copy();
// FIXME: Is this auto-inserted by the compiler?
__copy(&pad, &ent.pad, 3);
this->moprops = ent.moprops;
}

#endif

void xSurface::operator=(const xBase& ent)
{
this->id = ent.id;
this->baseType = ent.baseType;
this->linkCount = ent.linkCount;
this->baseFlags = ent.baseFlags;
this->link = ent.link;
this->eventFunc = ent.eventFunc;
return *this;
}

void xSurfaceExit()
Expand All @@ -67,7 +55,7 @@ void xSurfaceLoad(xSurface* ent, xSerial* s)
xBaseLoad((xBase*)ent, s);
}

void xSurfaceReset()
void xSurfaceReset(xSurface* ent)
{
}

Expand Down
7 changes: 3 additions & 4 deletions src/SB/Core/x/xSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ struct xSurface : xBase
uint8 pad[3];
void* moprops;

void operator=(const xSurface& ent);
void operator=(const xBase& ent);
xSurface& operator=(const xSurface& ent);
};

#define XSURFACE_TYPE_1 1
Expand All @@ -31,8 +30,8 @@ void xSurfaceInit(uint16 num_surfs);
void xSurfaceExit();
void xSurfaceSave(xSurface* ent, xSerial* s);
void xSurfaceLoad(xSurface* ent, xSerial* s);
void xSurfaceReset();
void xSurfaceReset(xSurface* ent);
uint16 xSurfaceGetNumSurfaces();
xSurface* xSurfaceGetByIdx(uint16 n);

#endif
#endif
2 changes: 1 addition & 1 deletion src/SB/Game/zSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void zSurfaceExit()

void zSurfaceResetSurface(xSurface* surf)
{
xSurfaceReset();
xSurfaceReset(surf);
surf->friction = ((zSurfaceProps*)(surf->moprops))->asset->friction;
}

Expand Down

0 comments on commit 89958ff

Please sign in to comment.