Skip to content
Open
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
14 changes: 13 additions & 1 deletion lib/libnbke.a
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ gfx_finish_hook = 0x802E3B7C;
kb_vi_counter = 0x80274578; /* need nbke */
bk_controller_raw = 0x802812B8;


bk_take_me_there = 0x802E4078;
bk_transformation_set = 0x8029a95c;

/* BK_Moves.c */
bk_moves_has_used_set_bit = 0x802957bc;
bk_moves_has_used_get_bit = 0x802957a0;
bk_moves_unlocked_get_bit = 0x802957d8;
bk_moves_unlocked_get = 0x802957f0;
bk_moves_clear = 0x80295804;
bk_moves_unlocked_set_bit = 0x80295818;
bk_moves_unlocked_set = 0x80295864;
bk_moves_has_used_set = 0x80295870;
bk_moves_bitfield_stats = 0x8029587c;

bk_item_array = 0x80385f30;
bk_item_get_count = 0x80345fa0;

Expand All @@ -27,4 +39,4 @@ bk_mumbo_token_flag_set = 0x803215d0;
bk_empty_honeycomb_flag_get = 0x803212e4;
bk_empty_honeycomb_flag_set = 0x80321364;

bk_high_note_scores = 0x80385ff0;
bk_high_note_scores = 0x80385ff0;
13 changes: 12 additions & 1 deletion lib/libnbke11.a
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ kb_vi_counter = 0x80274578; /* need nbke-1.1 */
bk_controller_raw = 0x80284754;

bk_take_me_there = 0x802e30b8;
bk_transformation_set = 0x802997d8;
bk_transformation_set = 0x802997d8;

/* BK_Moves.c */
bk_moves_has_used_get_bit = 0x80294610;
bk_moves_has_used_set_bit = 0x80294628;
bk_moves_unlocked_get_bit = 0x80294648;
bk_moves_unlocked_get = 0x80294660;
bk_moves_clear = 0x80294674;
bk_moves_unlocked_set_bit = 0x80294688;
bk_moves_unlocked_set = 0x802946d4;
bk_moves_has_used_set = 0x802946e0;
bk_moves_bitfield_stats = 0x802946ec;
13 changes: 12 additions & 1 deletion lib/libnbkj.a
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ kb_vi_counter = 0x80274578;
bk_controller_raw = 0x80284754;

bk_take_me_there = 0x802e31d8;
bk_transformation_set = 0x802997fC;
bk_transformation_set = 0x802997fC;

/* BK_Moves.c */
bk_moves_has_used_get_bit = 0x80294640;
bk_moves_has_used_set_bit = 0x80294658;
bk_moves_unlocked_get_bit = 0x80294678;
bk_moves_unlocked_get = 0x80294690;
bk_moves_clear = 0x802946a4;
bk_moves_unlocked_set_bit = 0x802946b8;
bk_moves_unlocked_set = 0x80294704;
bk_moves_has_used_set = 0x80294710;
bk_moves_bitfield_stats = 0x8029471C;
13 changes: 12 additions & 1 deletion lib/libnbkp.a
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ kb_vi_counter = 0x80274578; /* need nbkp */
bk_controller_raw = 0x802810d8;

bk_take_me_there = 0x802E4268;
bk_transformation_set = 0x8029a95c;
bk_transformation_set = 0x8029a95c;

/* BK_Moves.c */
bk_moves_has_used_get_bit = 0x802955e0;
bk_moves_has_used_set_bit = 0x802945f8;
bk_moves_unlocked_get_bit = 0x80295618;
bk_moves_unlocked_get = 0x80295630;
bk_moves_clear = 0x80295644;
bk_moves_unlocked_set_bit = 0x80295658;
bk_moves_unlocked_set = 0x802956a4;
bk_moves_has_used_set = 0x802956b0;
bk_moves_bitfield_stats = 0x802956bc;
33 changes: 33 additions & 0 deletions src/kb/bk.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ typedef struct{
int8_t y;
} bk_controller_t;

typedef enum moves{
bk_moves_beakBarge = 0,
bk_moves_beakBomb = 1,
bk_moves_beakBuster = 2,
bk_moves_cameraControls = 3,
bk_moves_bearPunch = 4,
bk_moves_climbTrees = 5,
bk_moves_eggs = 6,
bk_moves_featheryFlap = 7,
bk_moves_flapFlip = 8,
bk_moves_flying = 9,
bk_moves_holdAToJumpHigher = 10,
bk_moves_ratATatRap = 11,
bk_moves_roll = 12,
bk_moves_shockSpringJump = 13,
bk_moves_wadingBoots = 14,
bk_moves_dive = 15,
bk_moves_talonTrot = 16,
bk_moves_turboTalonTrainers = 17,
bk_moves_wonderwing = 18,
bk_moves_firstNoteDoorMolehill = 19,
} bk_moves_t;

typedef enum bK_item{
BK_ITEM_SKULL_HOURGLASS = 0x1,
BK_ITEM_PROPELLOR_TIMER = 0x3,
Expand Down Expand Up @@ -87,6 +110,16 @@ bk_extern void load_code_stage1 (void);
bk_extern void bk_gfx_finish (Gfx **p_gfx_p);
bk_extern void bk_take_me_there (uint32_t map, uint32_t exit, uint32_t warp_type);

bk_extern bool bk_moves_has_used_get_bit (uint32_t move_index);
bk_extern void bk_moves_has_used_set_bit (uint32_t move_index); //code clear method
bk_extern bool bk_moves_unlocked_get_bit (uint32_t move_index);
bk_extern uint32_t bk_moves_unlocked_get(void);
bk_extern void bk_moves_clear(void);
bk_extern void bk_moves_unlocked_set_bit (uint32_t move_index, uint32_t boolean);
bk_extern void bk_moves_unlocked_set(uint32_t value);
bk_extern void bk_moves_has_used_set(uint32_t value);
bk_extern void bk_moves_bitfield_stats(uint32_t* size, void* addr);

bk_extern uint32_t bk_item_get_count (uint32_t item_index);
bk_extern uint32_t bk_item_array;

Expand Down
2 changes: 2 additions & 0 deletions src/kb/kb.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ void init(void){
menu_init(main_menu, 20, 30);

main_menu->selected_item = menu_button_add(main_menu, 0, 0, "return", main_menu_on_activate, NULL);

menu_submenu_add(main_menu, 0, 1, "warps", create_warps_menu());
menu_submenu_add(main_menu, 0, 2, "watches", create_watches_menu());
menu_submenu_add(main_menu, 0, 4, "moves", create_moves_menu());
menu_submenu_add(main_menu, 0, 5, "items", create_items_menu());

kb.menu_active = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/kb/kb.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ extern kb_ctxt_t kb;

menu_t *create_warps_menu(void);
menu_t *create_watches_menu (void);

menu_t *create_moves_menu(void);
#endif
73 changes: 73 additions & 0 deletions src/kb/kb_moves_menu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include <stdlib.h>
#include <libundermine.h>
#include "kb.h"
#include "bk.h"

struct moves_data {
uint32_t moves_indx;
char *tooltip;
};

static struct moves_data moves_table[]={
{ bk_moves_beakBarge, "beak barge"},
{ bk_moves_beakBomb, "beak bomb"},
{ bk_moves_beakBuster, "beak buster"},
{ bk_moves_cameraControls, "camera controls"},
{ bk_moves_bearPunch, "bear punch"},
{ bk_moves_climbTrees, "climb trees"},
{ bk_moves_eggs, "eggs"},
{ bk_moves_featheryFlap,"feathery flap"},
{ bk_moves_flapFlip, "flap flip"},
{ bk_moves_flying, "flying"},
{ bk_moves_holdAToJumpHigher, "variable jump height"},
{ bk_moves_ratATatRap, "rat-a-tat rap"},
{ bk_moves_roll, "roll"},
{ bk_moves_shockSpringJump, "shock spring jump"},
{ bk_moves_wadingBoots, "wading boots"},
{ bk_moves_dive, "dive" },
{ bk_moves_talonTrot, "talon trot"},
{ bk_moves_turboTalonTrainers, "turbo talon trainers"},
{ bk_moves_wonderwing, "wonderwing"},
{ bk_moves_firstNoteDoorMolehill, "1st note door molehill"}, //move to other flags?
};


static int has_move_callback(event_handler_t *handler, menu_event_t callback, void *data){
uint32_t moves_index = (uint32_t)handler->callback_data & 0xFF;
if(callback == MENU_EVENT_ACTIVATE){
bool is_unlocked = bk_moves_unlocked_get_bit(moves_index);
if(is_unlocked){
bk_moves_unlocked_set_bit(moves_index, 0);
} else {
bk_moves_unlocked_set_bit(moves_index, 1);
}
bk_moves_has_used_set(bk_moves_unlocked_get());
return 1;
} else if(callback == MENU_EVENT_UPDATE) {
menu_checkbox_set(handler->subscriber,bk_moves_unlocked_get_bit(moves_index));
return 1;
}
return 0;
}

menu_t *create_moves_menu(){
static menu_t moves_menu;
uint32_t data;
menu_init(&moves_menu, 0, 0);
moves_menu.selected_item = menu_button_add(&moves_menu, 0, 0, "return", menu_return, NULL);

for (int i = 0; i < sizeof(moves_table)/sizeof(struct moves_data); i++)
{ //add visual elements
menu_item_t* unlock_move_item = menu_checkbox_add(&moves_menu,0,i+1);
menu_label_add(&moves_menu, 1,i+1,moves_table[i].tooltip);

//set callback process
menu_item_register_event(unlock_move_item,MENU_EVENT_ACTIVATE | MENU_EVENT_UPDATE, has_move_callback, (void*)moves_table[i].moves_indx);
}





return &moves_menu;
}