Skip to content

Commit 296fdcd

Browse files
committed
OOBState: Match progress for init func
1 parent 38ad3df commit 296fdcd

File tree

1 file changed

+38
-82
lines changed

1 file changed

+38
-82
lines changed

src/SB/Game/zEntPlayerOOBState.cpp

Lines changed: 38 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -315,88 +315,6 @@ namespace oob_state
315315
} // namespace
316316
} // namespace oob_state
317317

318-
/*
319-
static class
320-
{
321-
// total size: 0x70
322-
public:
323-
signed int flags; // offset 0x0, size 0x4
324-
class state_type* state; // offset 0x4, size 0x4
325-
unsigned char control; // offset 0x8, size 0x1
326-
class state_type* states[4]; // offset 0xC, size 0x10
327-
float out_time; // offset 0x1C, size 0x4
328-
float max_out_time; // offset 0x20, size 0x4
329-
float reset_time; // offset 0x24, size 0x4
330-
class xModelInstance* model; // offset 0x28, size 0x4
331-
class xVec2 loc; // offset 0x2C, size 0x8
332-
class xVec2 dir; // offset 0x34, size 0x8
333-
float fade_alpha; // offset 0x3C, size 0x4
334-
unsigned char render_hand; // offset 0x40, size 0x1
335-
unsigned char vertical; // offset 0x41, size 0x1
336-
float vel; // offset 0x44, size 0x4
337-
float accel; // offset 0x48, size 0x4
338-
class ztalkbox* tutorial; // offset 0x4C, size 0x4
339-
class
340-
{
341-
// total size: 0x20
342-
public:
343-
float near_d; // offset 0x0, size 0x4
344-
float near_h; // offset 0x4, size 0x4
345-
float near_pitch; // offset 0x8, size 0x4
346-
float far_d; // offset 0xC, size 0x4
347-
float far_h; // offset 0x10, size 0x4
348-
float far_pitch; // offset 0x14, size 0x4
349-
class xMat4x3* tgt_mat; // offset 0x18, size 0x4
350-
class xMat4x3* tgt_omat; // offset 0x1C, size 0x4
351-
} cam_data; // offset 0x50, size 0x20
352-
}
353-
shared; // size: 0x70, address: 0x4DFA90
354-
*/
355-
356-
/*
357-
static class {
358-
// total size: 0x58
359-
public:
360-
float bottom_anim_frac; // offset 0x0, size 0x4
361-
float top_anim_frac; // offset 0x4, size 0x4
362-
float bottom_anim_time; // offset 0x8, size 0x4
363-
float top_anim_time; // offset 0xC, size 0x4
364-
float hit_anim_time; // offset 0x10, size 0x4
365-
float damage_rot; // offset 0x14, size 0x4
366-
float death_time; // offset 0x18, size 0x4
367-
float vel_blur; // offset 0x1C, size 0x4
368-
float fade_dist; // offset 0x20, size 0x4
369-
float player_radius; // offset 0x24, size 0x4
370-
float hook_fade_alpha; // offset 0x28, size 0x4
371-
float hook_fade_time; // offset 0x2C, size 0x4
372-
class {
373-
// total size: 0xC
374-
public:
375-
float edge_zone; // offset 0x0, size 0x4
376-
float sway; // offset 0x4, size 0x4
377-
float decay; // offset 0x8, size 0x4
378-
} horizontal; // offset 0x30, size 0xC
379-
class {
380-
// total size: 0x10
381-
public:
382-
float time; // offset 0x0, size 0x4
383-
float anim_out_time; // offset 0x4, size 0x4
384-
float min_dist; // offset 0x8, size 0x4
385-
float max_dist; // offset 0xC, size 0x4
386-
} dive; // offset 0x3C, size 0x10
387-
class {
388-
// total size: 0x4
389-
public:
390-
float speed; // offset 0x0, size 0x4
391-
} camera; // offset 0x4C, size 0x4
392-
class {
393-
// total size: 0x8
394-
public:
395-
float spring; // offset 0x0, size 0x4
396-
float decay; // offset 0x4, size 0x4
397-
} turn; // offset 0x50, size 0x8
398-
} fixed; // size: 0x58, address: 0x5CDE00 */
399-
400318
void oob_state::load_settings(xIniFile& ini)
401319
{
402320
fixed.hand_model = xIniGetString(&ini, "player.state.out_of_bounds.hand_model", "hand");
@@ -447,6 +365,44 @@ void oob_state::load_settings(xIniFile& ini)
447365

448366
void oob_state::init()
449367
{
368+
if ((shared.flags & 0x1) != 0x1)
369+
{
370+
return;
371+
}
372+
373+
shared.flags |= 0x2;
374+
375+
static in_state_type in_state;
376+
shared.states[0] = &in_state;
377+
378+
static out_state_type out_state;
379+
shared.states[1] = &out_state;
380+
381+
static grab_state_type grab_state;
382+
shared.states[2] = &grab_state;
383+
384+
static drop_state_type drop_state;
385+
shared.states[3] = &drop_state;
386+
387+
shared.max_out_time = fixed.out_time;
388+
shared.fade_alpha = 1.0f;
389+
shared.render_hand = FALSE;
390+
shared.control = FALSE;
391+
392+
U32 bufsize;
393+
void* info = xSTFindAsset(xStrHash(fixed.hand_model), &bufsize);
394+
395+
xModelInstance* model;
396+
if (info == NULL)
397+
{
398+
model = NULL;
399+
}
400+
else
401+
{
402+
model = xEntLoadModel(NULL, (RpAtomic*)info);
403+
}
404+
405+
shared.model = model;
450406
}
451407

452408
namespace oob_state

0 commit comments

Comments
 (0)