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

Couple zDiscoFloor matches #377

Merged
merged 1 commit into from
Sep 29, 2024
Merged
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
36 changes: 33 additions & 3 deletions src/SB/Game/zDiscoFloor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "zSurface.h"
#include "zGlobals.h"
#include "zGrid.h"
#include "zRenderState.h"
#include "zEntSimpleObj.h"
#include "zLOD.h"
Expand Down Expand Up @@ -163,9 +164,38 @@ namespace
}
}

U32 get_tile(const U8*, size_t);
U32 get_tile(const U8* a, size_t b)
{
static S8 init;
static volatile S32 bit_index;
static S32 r;

void set_tile(U8*, size_t, U32);
U32 uVar1 = a[(b >> 2) & 0x1fffffff] >> ((b & 3) << 1) & 3;
if (uVar1 == 2)
{
if (init == 0)
{
bit_index = 0x20;
init = 1;
}
bit_index++;
if (bit_index >= 0x20)
{
bit_index = 0;
r = xrand();
}
uVar1 = r & 1 << bit_index;
uVar1 = (-uVar1 | uVar1) >> 0x1f;
}
return uVar1;
}

void set_tile(U8* r3, size_t r4, U32 r5)
{
U32 uVar1 = (r4 >> 2) & 0x1fffffff;
int iVar2 = (r4 & 3) << 1;
r3[uVar1] = r3[uVar1] & ~(3 << iVar2) | (r5 << iVar2);
}

void translate_mask(U8* r3, const U8* r4, size_t r5)
{
Expand Down Expand Up @@ -417,7 +447,7 @@ namespace
RpAtomicRender(atomic);
}

void render_model(xModelInstance* model, const xSphere& sph, F32 y_offset)
void render_model(xModelInstance* model, xSphere& sph, F32 y_offset)
{
RpAtomic* atomic = model->Data;

Expand Down