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

match core2/baXXX.c #10

Merged
merged 6 commits into from
Nov 10, 2024
Merged
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
13 changes: 8 additions & 5 deletions baserom.us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,15 @@ segments:
- [0x1E6A480, c, 1E6A480]
- [0x1E6A730, c, 1E6A730]
- [0x1E6AE20, c, 1E6AE20]
- [0x1E6B1E0, c, bakey]
- [0x1E6B700, c, 1E6B700]
- [0x1E6B900, c, 1E6B900]
- [0x1E6E760, c, 1E6E760]
- [0x1E6E870, c, 1E6E870]
- [0x1E6EC70, c, 1E6EC70]
- [0x1E6EFD0, c, 1E6EFD0]
- [0x1E6EFD0, c, baflag]
- [0x1E6F080, c, 1E6F080]
- [0x1E71260, c, 1E71260]
- [0x1E71260, c, bainput]
- [0x1E71B00, c, 1E71B00]
- [0x1E72180, c, 1E72180]
- [0x1E72EA0, c, 1E72EA0]
Expand All @@ -408,15 +409,15 @@ segments:
- [0x1E75710, c, 1E75710]
- [0x1E75920, c, 1E75920]
- [0x1E75B90, c, 1E75B90]
- [0x1E75BC0, c, 1E75BC0]
- [0x1E75BC0, c, baroll]
- [0x1E75E90, c, yaw]
- [0x1E76360, c, 1E76360]
- [0x1E76500, c, 1E76500]
- [0x1E76880, c, 1E76880]
- [0x1E76CC0, c, 1E76CC0]
- [0x1E76CC0, c, 1E76CC0] #basfx
- [0x1E77A20, c, 1E77A20]
- [0x1E78170, c, 1E78170]
- [0x1E785F0, c, 1E785F0]
- [0x1E785F0, c, bastick]
- [0x1E78BF0, c, 1E78BF0]
- [0x1E79FD0, c, 1E79FD0]
- [0x1E7AB30, c, 1E7AB30]
Expand Down Expand Up @@ -587,6 +588,8 @@ segments:
- [0x1EF5280, .data, 1EB3750]
- [0x1EF5290, data]
- [0x1EFE380, rodata]
- [0x1EFEC30, .rodata, baroll]
- [0x1EFEC40, rodata]
- [0x1EFF620, .rodata, 1EB45C0]
- [0x1EFF640, rodata]
- [0x1F00020, .bss, ../../src/core2/core2bss1]
Expand Down
52 changes: 52 additions & 0 deletions include/ba/flag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef __BA_FLAG_H__
#define __BA_FLAG_H__

#include <ultra64.h>

#include "ba/playerstate.h"

typedef enum {
BA_FLAG_0, // unused
BA_FLAG_1_ON_FLIGHT_PAD,
BA_FLAG_2_ON_SPRING_PAD,
BA_FLAG_3,
BA_FLAG_4,
BA_FLAG_5_HAS_PECKED,
BA_FLAG_6,
BA_FLAG_7,
BA_FLAG_8,
BA_FLAG_9,
BA_FLAG_A,
BA_FLAG_B,
BA_FLAG_C,
BA_FLAG_D, // unused
BA_FLAG_E_TOUCHING_WADING_BOOTS,
BA_FLAG_F, // related to A button ?
BA_FLAG_10_TOUCHING_TURBO_TRAINERS,
BA_FLAG_11, // unused
BA_FLAG_12_HAS_FLAPPED, // has used flap
BA_FLAG_13, // related to ground damage ?
BA_FLAG_14_LOSE_BOGGY_RACE, // in difficult terrain (mud)
BA_FLAG_15_LOADZONE, // touching loadzone?
BA_FLAG_16, // related to flying
BA_FLAG_17_FIRST_PERSON_VIEW,
BA_FLAG_18, // related to underwater state
BA_FLAG_19, // related to transformations
BA_FLAG_1A, // related to bee transformation
BA_FLAG_1B_TRANSFORMING,
NUM_BA_FLAGS = 0x42
} BaFlagId;

typedef struct ba_flag_s {
u8 bytes[NUM_BA_FLAGS];
} BaFlag;

// Definitions
s32 baflag_getStuctSize(void);
void baflag_clearAll(PlayerState *self);
int baflag_isTrue(PlayerState *self, BaFlagId id);
int baflag_isFalse(PlayerState *self, BaFlagId id);
void baflag_set(PlayerState *self, BaFlagId id);
void baflag_clear(PlayerState *self, BaFlagId id);

#endif // __BA_FLAG_H__
52 changes: 52 additions & 0 deletions include/ba/input.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef __BA_KEY_H__
#define __BA_KEY_H__

#include <ultra64.h>

#include "ba/playerstate.h"

typedef struct ba_input_s {
u32 enabled;
u32 __enabled;
f32 dive_cooldown;
} BaInput;

typedef enum {
BA_INPUT_0_ROTATE_CAMERA_LEFT,
BA_INPUT_1_ROTATE_CAMERA_RIGHT,
BA_INPUT_2_ENTER_FIRST_PERSON,

BA_INPUT_5_EXIT_FIRST_PERSON = 5
} BaInputId;

s32 bainput_getStructSize(void);
int bainput_should_beak_barge(PlayerState *self);
int bainput_should_beak_bust(PlayerState *self);
int bainput_should_enter_first_person(PlayerState *self);
int baintput_func_80097B28(PlayerState *self);
int baintput_func_80097B4C(PlayerState *self);
int bainput_should_rotate_camera_left(PlayerState *self);
int bainput_should_rotate_camera_right(PlayerState *self);
int bainput_should_exit_first_person(PlayerState *self);
int bainput_should_poop_egg(PlayerState *self);
int baintput_should_shoot_egg(PlayerState *self);
int bainput_func_80097C7C(PlayerState *self);
int bainput_func_80097D28(PlayerState *self);
int baintput_should_feathery_flap(PlayerState *self);
int bainput_func_80097DF4(PlayerState *self);
int bainput_should_flap_flip(PlayerState *self);
int bainput_func_80097E74(PlayerState *self);
int bainput_func_80097EC8(PlayerState *self);
int bainput_func_80097F08(PlayerState *self);
int bainput_should_dive(PlayerState *self);
int bainput_func_80097FB8(PlayerState *self);
s32 bainput_isEnabled(PlayerState *self, BaInputId arg1);
int bainput_func_8009803C(PlayerState *self);
int bainput_should_trot(PlayerState *self);
int bainput_should_wonderwing(PlayerState *self);
void bainput_init(PlayerState *self);
void bainput_enable(PlayerState *self, BaInputId id, s32 value);
void bainput_setDiveCooldown(PlayerState *self, s32 arg1, f32 cooldown);
void bainput_update(PlayerState *self);

#endif // __BA_KEY_H__
44 changes: 44 additions & 0 deletions include/ba/key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef __BA_KEY_H__
#define __BA_KEY_H__

#include <ultra64.h>

#include "../buttons.h" // ButtonId
#include "ba/playerstate.h" // PlayerState
#include "core2/1E965B0.h" // unkfunc_800BCE84


typedef struct ba_key_s {
unkfunc_800BCE84 *unk0;
s32 unk4;
u8 unk8;
u8 unk9;
u8 state[0xE];
u8 prev_state[0xE];
} BaKey;

// Definitions
s32 bakey_getStructSize(void);
s32 bakey_getControllerIndex(PlayerState *self);
void bakey_func_8009191C(PlayerState *self, ButtonId id, s32 arg2);
void bakey_func_80091940(PlayerState *self, ButtonId id, s32 arg2);
s32 bakey_func_80091964(PlayerState *self);
s32 bakey_heldCount(PlayerState *self, ButtonId id);
s32 bakey_releaseCount(PlayerState *self, ButtonId id);
void bakey_getStick(PlayerState *self, f32 pStickValues[2]);
int bakey_held(PlayerState *self, ButtonId id);
int bakey_released(PlayerState *self, ButtonId id);
int bakey_pressed(PlayerState *self, ButtonId id);
int bakey_newlyReleased(PlayerState *self, ButtonId id);
void bakey_free(PlayerState *self);
void bakey_defrag(PlayerState *self);
void bakey_init(PlayerState *self);
void bakey_setControllerIndex(PlayerState *self, s32 controller_index);
void bakey_func_80091C14(PlayerState *self, s32 value);
void bakey_func_80091C74(PlayerState *self, s32 arg1);
s32 bakey_setState(PlayerState *self, ButtonId id, int arg2);
int bakey_getBitfield(PlayerState *self);
void bakey_update(PlayerState *self);


#endif // __BA_KEY_H__
29 changes: 14 additions & 15 deletions include/ba/playerstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,19 @@ typedef enum bs_e {
BS_B6_BILL_DRILL = 0xB6
} BanjoStateId;

typedef struct player_yaw_s {
f32 value;
f32 ideal;
f32 unk8;
s32 update_type;
f32 velocity_degPerSec;
f32 limit_degPerSec;
f32 step_percent;
} PlayerYaw;

typedef struct player_state_s {
u8 pad0[0xF8];
PlayerYaw *yaw;
u8 padFC[0x60];
u8 pad0[0x40];
struct ba_key_s *key; // 0x40
u8 pad44[0x3C];
struct ba_flag_s *flag; //0x80
u8 pad84[0x20];
struct ba_input_s *input; //0xA4
u8 padA8[0x4C];
struct ba_roll_s *roll; // 0xF4
struct ba_yaw_s *yaw; // 0xF8
u8 padFC[0x2C];
struct ba_stick_s *stick; // 0x128
u8 pad12C[0x30];
union {
s32 word;
u8 bytes[4];
Expand All @@ -51,10 +50,10 @@ typedef struct player_state_s {
u8 pad168[4];
f32 unk16C;
f32 unk170;
u8 pad174[0x10];
s32 unk184;
} PlayerState;

void func_80098140(PlayerState* thisx, s32, s32);
s32 func_80094510(PlayerState* thisx);
s32 button_held(PlayerState*, ButtonId);

#endif
27 changes: 27 additions & 0 deletions include/ba/roll.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef __BA_ROLL_H__
#define __BA_ROLL_H__

#include <ultra64.h>

#include "ba/playerstate.h"

typedef struct ba_roll_s {
f32 value;
f32 ideal;
f32 limit;
f32 rate;
} BaRoll;

// Definitions
s32 baroll_getStructSize(void);
void baroll_reset(PlayerState *self);
void baroll_update(PlayerState *self);
void baroll_setIdeal(PlayerState *self, f32 arg1);
void baroll_set(PlayerState *self, f32 arg1);
void baroll_applyIdeal(PlayerState *self);
f32 baroll_get(PlayerState *self);
f32 baroll_getIdeal(PlayerState *self);
void baroll_setAngularVelocity(PlayerState *self, f32 limit, f32 rate);
void baroll_resetAngularVelocity(PlayerState *self);

#endif // __BA_ROLL_H__
44 changes: 44 additions & 0 deletions include/ba/stick.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef __BA_STICK_H__
#define __BA_STICK_H__

#include <ultra64.h>

#include "playerstate.h"

typedef struct ba_stick_0_s {
f32 position;
s32 id;
f32 markers[5];
} BaStickZone;

typedef struct ba_stick_s {
BaStickZone stored_zones[2];
BaStickZone zone;
f32 value[2];
f32 angle;
f32 distance;
u8 unk64;
u8 unk65;
u8 unk66;
u8 unk67;
} BaStick;

f32 bastick_getAngle(PlayerState *self);
f32 bastick_getAngleRelativeToBanjo(PlayerState *self);
s32 bastick_func_8009EEF8(PlayerState *self);
f32 bastick_distance(PlayerState *);
s32 bastick_getZone(PlayerState *self);
f32 bastick_getZonePosition(PlayerState *self);
f32 bastick_getX(PlayerState *self);
f32 bastick_getY(PlayerState *self);
void bastick_popZone(PlayerState *self);
void bastick_pushZone(PlayerState *self);
void bastick_update(PlayerState *self);
void bastick_reset(PlayerState *self);
void bastick_func_8009F18C(PlayerState *self, s32 arg1);
void bastick_func_8009F198(PlayerState *self, s32 arg1);
s32 bastick_func_8009F1A4(PlayerState *self);
void bastick_setZoneMax(PlayerState *self, s32 zone_id , f32 value);
void bastick_resetZones(PlayerState *self);

#endif // __BA_STICK_H__
10 changes: 10 additions & 0 deletions include/ba/yaw.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ typedef enum yaw_type_e{
YAW_TYPE_3_BOUNDED
} YawType;

typedef struct ba_yaw_s {
f32 value;
f32 ideal;
f32 unk8;
s32 update_type;
f32 velocity_degPerSec;
f32 limit_degPerSec;
f32 step_percent;
} BaYaw;

s32 yaw_size(void);
void yaw_init(PlayerState *self);
void yaw_update(PlayerState *self);
Expand Down
1 change: 1 addition & 0 deletions include/core2/1E2B200.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

f32 func_800136E4(f32); // mlNormalizeAngle()
f32 func_80013728(f32); //mlAbsNormalized()
f32 func_80013B70(f32 y, f32 x, f32 amplitude); //atan2?

#endif // #define __CORE2_1E2B200_H__
13 changes: 0 additions & 13 deletions include/core2/1E785F0.h

This file was deleted.

10 changes: 10 additions & 0 deletions include/core2/1E7D460.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef __CORE2_1E7D460_H__
#define __CORE2_1E7D460_H__

#include <ultra64.h>

#include "../ba/playerstate.h" // for PlayerState

f32 *func_800A4C48(PlayerState *);

#endif // __CORE2_1E7D460_H__
Loading
Loading