Skip to content

Commit

Permalink
added flag display
Browse files Browse the repository at this point in the history
  • Loading branch information
raicool committed Aug 20, 2023
1 parent 457fded commit 8a012c9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
Binary file modified res/tex/Symbol/flag_atlas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions src/core/panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void panel::render()

ImGui::NewLine(); ImGui::Separator(); ImGui::NewLine();
ImGui::Checkbox("Display all courses within cup", &show_all_course);
ImGui::Checkbox("Display flags", &display_flags);

ImGui::PushID("Load Failed");
if (ImGui::BeginPopupModal("Load Failed", NULL, ImGuiWindowFlags_AlwaysAutoResize))
Expand Down Expand Up @@ -151,10 +152,19 @@ void panel::draw_ghost_details(ghost* _ghost)
*/
ImGui::Image(app_ptr->texture_manager.driver[_ghost->character_id], { 64, 64 });
ImGui::SameLine();
ImGui::Text("%s", utf8_conv.to_bytes(_ghost->player_name).c_str());
ImGui::SameLine();
//ImGui::Image(app_ptr->texture_manager.symbol[0x01], { 26, 18 }, {0, (18.0f * _ghost->country_id) / 1170.0f}, { 1, ((18.0f * _ghost->country_id) + 18) / 1170.0f});

if (display_flags)
{
// 26
// 18
float flag_xoffset = (26 * (_ghost->country_id % 16)) / 416.0f;
float flag_yoffset = (18 * (round_multiple(_ghost->country_id, 17) / 17)) / 216.0f;
ImGui::Image(app_ptr->texture_manager.symbol[0x01], { 26, 18 }, { flag_xoffset, flag_yoffset }, { flag_xoffset + (26 / 416.0f), flag_yoffset + (18 / 216.0f) });
}

ImGui::SameLine();
ImGui::Text("%s", utf8_conv.to_bytes(_ghost->player_name).c_str());

/*
* display ghost kart config
*/
Expand Down
1 change: 1 addition & 0 deletions src/core/panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct panel
int32_t course = 0; //< which course to display ghosts for in PANEL_GHOST_LIST
bool show_all_course = false; //< toggle whether to show all courses within a cup or just 1
bool is_cup_selected = false;
bool display_flags = true;

void draw_ghost_details(ghost* _ghost);

Expand Down
19 changes: 1 addition & 18 deletions src/file/mii.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,5 @@ enum console_t

struct mii
{
char version : 4; // always 3

bool copy : 1;
bool name_profanity : 1;
char region : 2;
char character_set : 2;
char : 0;

char page_idx : 2;
char slot_idx : 2;
char : 0;

char console : 3;
char : 0;

unsigned long sys_id : 8;

char data[0x3c];
char data[0x60];
};
1 change: 0 additions & 1 deletion src/file/spotpass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ uint8_t spotpass::load(const char* dir)
offset += 4;
bin_read<mii>(&ghosts[ghost_count]->mii_data, spotpass_data, &offset);
bin_read<uint8_t>(&ghosts[ghost_count]->country_id, spotpass_data, &offset);
LOG_DEBUG("country = {}", ghosts[ghost_count]->country_id);
ghost_count++;
}
}
Expand Down

0 comments on commit 8a012c9

Please sign in to comment.