Skip to content

Commit

Permalink
Couple zDiscoFloor matches
Browse files Browse the repository at this point in the history
  • Loading branch information
escape209 committed Sep 29, 2024
1 parent 4a88323 commit ace999a
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 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;

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*, size_t, U32);
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 All @@ -176,7 +206,7 @@ namespace
}
}

void set_object_state(const z_disco_floor&, size_t, S32);
void set_object_state(const z_disco_floor& floor, size_t size, S32 index);

void refresh_state(z_disco_floor& df)
{
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 Expand Up @@ -670,6 +700,8 @@ namespace
void add_tweaks(z_disco_floor&);
}

void z_disco_floor::refresh_bound();

void z_disco_floor::setup()
{
current_disco_floor = id;
Expand Down

0 comments on commit ace999a

Please sign in to comment.