Add Team and Bag pages to the Start menu
This commit is contained in:
8 files changed
+194
-66
No files matched your search
+53
-13
@@ -1,18 +1,42 @@
|
||||
#include "game.h"
|
||||
|
||||
struct SaveMenuState save_menu;
|
||||
static int team_member, team_parent;
|
||||
|
||||
int save_menu_input(unsigned keys, int can_open, const struct Location *location)
|
||||
{
|
||||
unsigned pressed = keys & ~save_menu.previous;
|
||||
save_menu.previous = keys;
|
||||
if (save_menu.phase == SAVE_MENU_CLOSED) {
|
||||
if (!can_open || !(pressed & START)) return 0;
|
||||
save_menu.phase = SAVE_MENU_OPTIONS;
|
||||
if (!can_open || !(pressed & (START | SELECT))) return 0;
|
||||
save_menu.phase = pressed & START ? SAVE_MENU_OPTIONS : SAVE_MENU_TEAM;
|
||||
team_parent = 0;
|
||||
team_member = 0;
|
||||
save_menu.selection = 0;
|
||||
return 1;
|
||||
}
|
||||
if (pressed & (B | START)) {
|
||||
if (pressed & START) {
|
||||
save_menu.phase = SAVE_MENU_CLOSED;
|
||||
return 1;
|
||||
}
|
||||
if (save_menu.phase == SAVE_MENU_TEAM || save_menu.phase == SAVE_MENU_BAG) {
|
||||
if (pressed & (B | SELECT | A)) {
|
||||
if (save_menu.phase == SAVE_MENU_TEAM && (pressed & A) &&
|
||||
!(pressed & (B | SELECT)) && choose_partner(team_member))
|
||||
reset_follower(location->x, location->y);
|
||||
save_menu.phase = team_parent ? SAVE_MENU_OPTIONS : SAVE_MENU_CLOSED;
|
||||
return 1;
|
||||
}
|
||||
unsigned direction = pressed & (LEFT | RIGHT);
|
||||
if (save_menu.phase == SAVE_MENU_TEAM && partner_owned &&
|
||||
(direction == LEFT || direction == RIGHT)) {
|
||||
int members = caught_count + 1;
|
||||
team_member = (team_member + (direction == RIGHT ? 1 : members - 1)) % members;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (pressed & B) {
|
||||
save_menu.phase = SAVE_MENU_CLOSED;
|
||||
return 1;
|
||||
}
|
||||
@@ -22,18 +46,34 @@ int save_menu_input(unsigned keys, int can_open, const struct Location *location
|
||||
return 1;
|
||||
}
|
||||
if (pressed & A) {
|
||||
if (save_menu.selection) save_menu.phase = SAVE_MENU_CLOSED;
|
||||
else save_menu.phase = save_progress(location) ? SAVE_MENU_SAVED : SAVE_MENU_FAILED;
|
||||
if (save_menu.selection == MENU_CLOSE) save_menu.phase = SAVE_MENU_CLOSED;
|
||||
else if (save_menu.selection == MENU_SAVE)
|
||||
save_menu.phase = save_progress(location) ? SAVE_MENU_SAVED : SAVE_MENU_FAILED;
|
||||
else {
|
||||
team_parent = 1;
|
||||
team_member = 0;
|
||||
save_menu.phase = save_menu.selection == MENU_TEAM ? SAVE_MENU_TEAM : SAVE_MENU_BAG;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
unsigned direction = pressed & (UP | DOWN);
|
||||
if (direction == UP || direction == DOWN) {
|
||||
save_menu.selection ^= 1;
|
||||
save_menu.selection = (save_menu.selection + (direction == DOWN ? 1 : MENU_COUNT - 1)) % MENU_COUNT;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void draw_menu_scene(int x, int y)
|
||||
{
|
||||
if (save_menu.phase == SAVE_MENU_TEAM) draw_team_member(team_member);
|
||||
else if (save_menu.phase == SAVE_MENU_BAG) draw_bag();
|
||||
else {
|
||||
draw_scene(x, y);
|
||||
if (save_menu.phase != SAVE_MENU_CLOSED) draw_save_menu();
|
||||
}
|
||||
}
|
||||
|
||||
void draw_save_menu(void)
|
||||
{
|
||||
u16 ink = RGB(5, 8, 11), cream = RGB(30, 30, 26);
|
||||
@@ -42,18 +82,18 @@ void draw_save_menu(void)
|
||||
rectangle(x + 2, y + 2, SAVE_MENU_W - 4, SAVE_MENU_H - 4, cream);
|
||||
large_text(x + 16, y + 10, "MENU", ink);
|
||||
rectangle(x + 6, y + 23, SAVE_MENU_W - 12, 1, RGB(15, 24, 20));
|
||||
text(x + 8, y + 85, "SAVES TEAM", ink);
|
||||
text(x + 8, y + 95, "ITEMS AND", ink);
|
||||
text(x + 8, y + 105, "LOCATION", ink);
|
||||
text(x + 8, y + 99, "SAVES TEAM", ink);
|
||||
text(x + 8, y + 108, "ITEMS AND", ink);
|
||||
text(x + 8, y + 117, "LOCATION", ink);
|
||||
if (save_menu.phase == SAVE_MENU_OPTIONS) {
|
||||
int selected_y = y + 32 + save_menu.selection * 20;
|
||||
int selected_y = y + 28 + save_menu.selection * 16;
|
||||
rectangle(x + 6, selected_y, SAVE_MENU_W - 12, 16, RGB(23, 28, 21));
|
||||
rectangle(x + 10, selected_y + 5, 1, 5, ink);
|
||||
rectangle(x + 11, selected_y + 6, 1, 3, ink);
|
||||
rectangle(x + 12, selected_y + 7, 1, 1, ink);
|
||||
large_text(x + 20, y + 37, "SAVE", ink);
|
||||
large_text(x + 20, y + 57, "CLOSE", ink);
|
||||
text(x + 8, y + 124, "UP DOWN", ink);
|
||||
static const char *const labels[] = {"TEAM", "BAG", "SAVE", "CLOSE"};
|
||||
for (int i = 0; i < MENU_COUNT; ++i) large_text(x + 20, y + 33 + i * 16, labels[i], ink);
|
||||
text(x + 8, y + 126, "UP DOWN", ink);
|
||||
text(x + 8, y + 133, "A SELECT", ink);
|
||||
text(x + 8, y + 142, "B START CLOSE", ink);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user