Skip to content
Draft
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
42 changes: 31 additions & 11 deletions src/SB/Core/x/containers.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,23 @@ template <class T> struct static_queue
return this;
}

iterator operator-=(S32 value)
{
return *(*this += -value);
}

iterator* operator++()
{
*this += 1;
return this;
}

iterator operator-(S32 value) const
{
iterator it = *this;
it -= value;
return it;
}
};

bool empty() const
Expand All @@ -82,16 +94,18 @@ template <class T> struct static_queue

void init(u32 size)
{
U32 unk_r3 = 0;
U32 shift = 0;

size += 1;
while (size > 1)
{
size /= 2;
unk_r3++;
shift++;
}

_max_size = unk_r3;
_max_size_mask = 1 << _max_size;
_buffer = (T*)xMemAlloc(gActiveHeap, sizeof(T) * (size), 0);
_max_size = 1 << shift;
_max_size_mask = _max_size - 1;
_buffer = (T*)xMemAlloc(gActiveHeap, sizeof(T) * _max_size, 0);
clear();
}

Expand All @@ -107,11 +121,22 @@ template <class T> struct static_queue
return *it;
}

T& back()
{
iterator it = end() - 1;
return *it;
}

iterator begin() const
{
return create_iterator(_first);
}

iterator end() const
{
return create_iterator(mod_max_size(_first + _size));
}

iterator create_iterator(u32 initial_size) const
{
iterator it;
Expand Down Expand Up @@ -153,6 +178,7 @@ template <class T> struct static_queue
{
U32 orig_size = _size;
U32 orig_first = _first;

_first = other._it;
_size = mod_max_size((orig_first + orig_size) - _first);
}
Expand All @@ -161,12 +187,6 @@ template <class T> struct static_queue
_size -= mod_max_size(other._it - it._it);
}
}

iterator end() const
{
iterator it;
return create_iterator(mod_max_size(_first + _size));
}
};

template <class T, U32 N> struct fixed_queue
Expand Down
6 changes: 6 additions & 0 deletions src/SB/Core/x/xCollide.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ bool xSphereHitsOBB(const xSphere&, const xBox&, const xMat4x3&);
bool xSphereHitsSphere(const xVec3&, F32, const xVec3&, F32);
bool xSphereHitsVCylinder(const xVec3& sc, F32 sr, const xVec3& cc, F32 cr, F32 ch);
bool xSphereHitsVCircle(const xSphere& s, const xVec3& c, F32 r);
bool xSphereHitsCapsule(const xVec3& sc, F32 sr, const xVec3& c1, const xVec3& c2, F32 cr);

inline bool xSphereHitsCapsule(const xSphere& s, const xVec3& c1, const xVec3& c2, F32 cr)
{
return xSphereHitsCapsule(s.center, s.r, c1, c2, cr);
}
bool xSphereHitsVCircle(const xVec3& sc, F32 sr, const xVec3& cc, F32 cr);
U32 xSphereHitsModel(const xSphere* b, const xModelInstance* m, xCollis* coll);

Expand Down
12 changes: 11 additions & 1 deletion src/SB/Core/x/xFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@ struct xFXRibbon
U32 mlife;

void init(const char*, const char*);
void init(S32, const char*);

void init(S32, const char* name)
{
init(name, NULL);
}

void clear()
{
joints.clear();
}

void set_texture(const char* name);
void set_texture(U32);
void set_texture(RwTexture* texture);
Expand Down
17 changes: 17 additions & 0 deletions src/SB/Core/x/xMath2.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ struct xVec2
F32 x;
F32 y;

static xVec2 create(F32 x, F32 y)
{
xVec2 v = { 0.0f, 0.0f };

v.x = x;
v.y = y;

return v;
}

xVec2& assign(F32 xy)
{
return assign(xy, xy);
Expand Down Expand Up @@ -75,6 +85,13 @@ struct xVec2
xVec2& operator=(F32);
xVec2 operator*(F32) const;
xVec2 operator/=(F32);
xVec2 operator+(const xVec2& v) const
{
xVec2 sum = *this;
sum += v;
return sum;
}

xVec2& operator+=(const xVec2&);
xVec2& operator*=(F32);
xVec2& operator-=(const xVec2&);
Expand Down
8 changes: 7 additions & 1 deletion src/SB/Core/x/xParEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ struct xParInterp
F32 oofreq;

void set(F32, F32, F32, U32);
void set(F32); // Used in zNPCDutchman
void set(F32 v)
{
val[1] = v;
val[0] = v;
interp = 0;
freq = oofreq = 1.0f;
}
void order();
void operator=(const xParInterp& p);
};
Expand Down
3 changes: 3 additions & 0 deletions src/SB/Core/x/xSnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ U32 xSndPlay3D(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, xEnt* parent
F32 outerRadius, sound_category category, F32 delay);
U32 xSndPlay3D(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, const xVec3* pos,
F32 innerRadius, F32 outerRadius, sound_category category, F32 delay);
U32 xSndPlay3DFade(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, const xVec3* pos,
F32 innerRadius, F32 outerRadius, sound_category category, F32 fadeTime,
F32 delay);
U32 xSndPlayInternal(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, U32 parentID,
xEnt* parentEnt, const xVec3* pos, F32 innerRadius, F32 outerRadius,
sound_category category, F32 delay);
Expand Down
Loading
Loading