diff --git a/db/names.tsv b/db/names.tsv index 15c8fc8..524f199 100644 --- a/db/names.tsv +++ b/db/names.tsv @@ -886,7 +886,7 @@ 008e4b10 Menu_Online::Update MenuManager::Update case 0x13: Cursor, "Daily Run"/"Friend Match"/"Options" entries; render 008e4e30 (#Online/ONLINE_DAILY_DESCRIPTOR ...) 008e3830 Menu_Mods::Update MenuManager::Update case 0x10 (MainMenuType MODS): WidgetTab, "/disable.it" 008d6b30 Menu_Collection::render_item_pool_icons ? once from the collection detail renderer 008d5440 (CollectibleTitle/CollectibleDesc/CollectibleItemPools): ItemPool::GetItemPoolsForCollectible then IconShop/IconTreasureRoom/IconBoss/IconDevilRoom/IconAngelRoom/IconPlanetarium... ItemPoolChests anims -008e6a80 Menu_Online::render_descriptions ? in the menu render sequence between the online menus; string_table_translate(manager+0x4a920, key+"_DESC"), "??????" placeholder, DescriptionPos/TextStartPos null frames, Font::DrawStringScaled; this+0x109/+0x70 flags +008e6a80 Menu_OnlineAwards::Render ECX=MenuManager+0xf5cc, the online awards page: string_table_translate(manager+0x4a920, key+"_DESC"), "??????" placeholder, DescriptionPos/TextStartPos null frames, Font::DrawStringScaled; this+0x109/+0x70 flags 0091d2b0 OnlineChat::render ? sprintf "%s:" name prefix lines, KAGE_ColorShader via FUN_00a140c0, Entity_Familiar::GetPlayerSlot for colors; caller 0091e650 used by the lobby render 008e8af0 and HUD 0090b900 00906260 SaveSlotManager::constructor ? constructs a ~0x1c90-byte object: PersistentGameData at +0x5c, ANM2s at +0x10b4/+0x18e4/+0x1a18, KColor; called once from the manager constructor 00950610 (writes manager+0x4b3bc..) 0091a450 load_persistent_game_data_buffer ? (buffer): temp PersistentGameData::constructor then parses the save buffer with FUN_0091b0f0/FUN_0091b960, "Attempting to retrieve read-only buffer in a writable mode", set lookups; from 0090c560 diff --git a/dump/all.c b/dump/all.c index 63b652a..ffa3ed6 100644 --- a/dump/all.c +++ b/dump/all.c @@ -779262,14 +779262,14 @@ LAB_008e6a5a: } -//@@ 008e6a80 Menu_Online::render_descriptions +//@@ 008e6a80 Menu_OnlineAwards::Render /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */ /* DB: ? in the menu render sequence between the online menus; string_table_translate(manager+0x4a920, key+"_DESC"), "??????" placeholder, DescriptionPos/TextStartPos null frames, Font::DrawStringScaled; this+0x109/+0x70 flags */ -void Menu_Online::render_descriptions(void) +void Menu_OnlineAwards::Render(void) { std_string *keySize; @@ -894975,7 +894975,7 @@ void __thiscall MenuManager::Render(MenuManager *this) Menu_Online::Render(&menuManager->_menuOnline); Menu_Options::Render((Menu_Options *)&menuManager->field_0xeb50); Menu_Online::render_mode_select(); - Menu_Online::render_descriptions(); + Menu_OnlineAwards::Render(); Menu_Save::Render((Menu_Save *)&menuManager->_menuSave); imageRefCount = (Vector *)0x98a2c5; Leaderboard::Render((Leaderboard *)&menuManager->field_0x1178); diff --git a/dump/functions.tsv b/dump/functions.tsv index 490b20a..004325e 100644 --- a/dump/functions.tsv +++ b/dump/functions.tsv @@ -7235,7 +7235,7 @@ 008e68a0 FUN_008e68a0 53 008e68e0 FUN_008e68e0 173 008e69a0 FUN_008e69a0 216 -008e6a80 Menu_Online::render_descriptions 1845 +008e6a80 Menu_OnlineAwards::Render 1845 008e71c0 FUN_008e71c0 137 008e7250 Menu_OnlineAwards::Update 586 008e74d0 FUN_008e74d0 130 diff --git a/dump/strings.tsv b/dump/strings.tsv index a3b27f5..2d99a8d 100644 --- a/dump/strings.tsv +++ b/dump/strings.tsv @@ -301,7 +301,7 @@ 00b1c518 #Online/COOP_AWARD_LUSTFUL 00425b70:init_coop_awards 00b1c534 #Online/COOP_AWARD_SLOTHFUL 00425b70:init_coop_awards 00b1c550 CoopStats::get_player_info() did not have data for user %llu \n 00426560:FUN_00426560 00917fd0:FUN_00917fd0 -00b1c590 _DESC 008e6a80:Menu_Online::render_descriptions +00b1c590 _DESC 008e6a80:Menu_OnlineAwards::Render 00b1c5a4 No deathmatch room for current level\n 00b1c5cc #Online/DEATHMATCH_WINNER 004299ba 00b1c5e8 #Online/DEATHMATCH_DRAW 00429b04 @@ -8337,10 +8337,10 @@ z 00b76168 ##GAME###Online/ONLY_FOUND_JOIN_IN_PROGRESS 008e64f0:online_quick_match_popup_callback 00b76194 Doodle Position 008e4e30:Menu_Online::Render 00b761a4 ##GAME###Online/SEARCHING_FOR_LOBBIES 008e5420:Menu_Online::start_quick_match -00b761cc ?????? 008e6a80:Menu_Online::render_descriptions 008e6a80:Menu_Online::render_descriptions -00b761d4 DescriptionPos 008e6a80:Menu_Online::render_descriptions +00b761cc ?????? 008e6a80:Menu_OnlineAwards::Render 008e6a80:Menu_OnlineAwards::Render +00b761d4 DescriptionPos 008e6a80:Menu_OnlineAwards::Render 00b761e4 gfx/ui/main menu/OnlineStatsMenu.anm2 00988d80:MenuManager::LoadGraphics -00b7620c TextStartPos 008e6a80:Menu_Online::render_descriptions +00b7620c TextStartPos 008e6a80:Menu_OnlineAwards::Render 00b7621c ##GAME###Online/NO_CONNECTION_TO_HOST 008e8240:Menu_OnlineLobby::Update 00b76244 gfx/ui/stage/eden_b_head.anm2 008e7b24 00b76264 PlayerInfo 008e9ac0:Menu_OnlineLobby::init_lobby_view 008e9ac0:Menu_OnlineLobby::init_lobby_view 008e7f60:Menu_OnlineLobby::load_graphics 008e7f60:Menu_OnlineLobby::load_graphics 008e7f60:Menu_OnlineLobby::load_graphics 008e9ac0:Menu_OnlineLobby::init_lobby_view diff --git a/generated-src/classes.h b/generated-src/classes.h index 2221354..58dd50c 100644 --- a/generated-src/classes.h +++ b/generated-src/classes.h @@ -349,6 +349,7 @@ struct HUD; struct HUD_Message; struct HWND__; struct HallucinationOverlay; +struct Harness; struct HeartGain; struct History; struct HistoryHUD; @@ -366,6 +367,7 @@ struct InfoDisplayItem; struct InfoDisplayText; struct InputBindings; struct InputConfig; +struct InputDelta; struct InputDeviceBase; struct InputManager; struct InviteFriendsMenu; @@ -3123,7 +3125,6 @@ struct Menu_Online { static void start_quick_match(); // 008e5420 void render_descriptor(std_string *text); // 008e5790 static void on_quick_match_search_result(int *param_1, int param_2); // 008e5f40 - static void render_descriptions(); // 008e6a80 uint8_t _pad_0x0[0x4]; uint8_t _anm2[0x228]; // ANM2 @@ -5331,7 +5332,6 @@ EntityConfig * FUN_00417910(); // 00417910 int FUN_00417920(); // 00417920 void FUN_00417dd0(); // 00417dd0 void FUN_00417df0(); // 00417df0 -void FUN_00417e50(); // 00417e50 int FUN_0041b770(int param_1); // 0041b770 void FUN_0041c670(); // 0041c670 int FUN_0041c6f0(uint32_t param_1); // 0041c6f0 @@ -8104,7 +8104,6 @@ void FUN_008e6880(int *param_1); // 008e6880 void FUN_008e68a0(char param_1, int param_2); // 008e68a0 void FUN_008e68e0(); // 008e68e0 int * FUN_008e69a0(uint32_t param_1); // 008e69a0 -void FUN_008e71c0(); // 008e71c0 void FUN_008e74d0(uint8_t param_1); // 008e74d0 int online_lobby_find_member_index(void *user); // 008e7560 void FUN_008e7610(); // 008e7610 @@ -20240,9 +20239,6 @@ float clamp(float min, float max, float value); // 0042f2a0 float timescale_factor(float acceleration, float timeScale); // 00684cb0 float lerp(float a, float b, float t, uint8_t isClamped); // 00a155c0 } -namespace Menu_OnlineAwards { -void Update(); // 008e7250 -} namespace NetLogging { void format_callstack(uint32_t param_1, uint32_t param_2); // 00904a60 } diff --git a/generated-src/menu_online.cpp b/generated-src/menu_online.cpp index 02c06ac..4d3a7e0 100644 --- a/generated-src/menu_online.cpp +++ b/generated-src/menu_online.cpp @@ -1389,291 +1389,3 @@ LAB_008e6318: *listHead = GHIDRA_INT(local_84); goto LAB_008e6323; } - -// 008e6a80 -void Menu_Online::render_descriptions() -{ - std_string *keySize; - float fVar1; - float fVar2; - float *nullFrame; - uint8_t *translatedText; - Vector *pos; - Font *pFVar3; - uint8_t *****pppppbVar4; - int in_ECX; - uint8_t *strCursor; - uint32_t uVar5; - uint8_t *statKey; - int statIndex; - Vector hiddenValuePos; - Vector valuePos; - Vector descriptionPos; - int statOffset; - KColor textColor; - Vector labelPos; - float columnX; - float rowY; - Vector local_88; - uint32_t fontSettings; - uint32_t local_7c; - uint32_t local_78; - uint32_t local_74; - uint32_t local_70; - uint32_t local_6c; - uint32_t local_68; - uint8_t *****descriptionText [4]; - uint32_t descriptionTextSize; - uint32_t descriptionTextCapacity; - uint8_t *****tmpString [4]; - uint32_t tmpStringSize; - uint32_t tmpStringCapacity; - uint8_t countText [32]; - uint32_t stackCookie; - void *local_10; - uint8_t *puStack_c; - uint32_t local_8; - int statCount; - uint8_t strChar; - - local_8 = 0xffffffff; - puStack_c = &LAB_00b06c45; - local_10 = ExceptionList; - stackCookie = __security_cookie ^ GHIDRA_UINT((countText + 0x30)); - ExceptionList = &local_10; - local_88.x = (g_menuManager->_ViewPosition).x + *GHIDRA_CAST((in_ECX + 0x128)); - local_88.y = (g_menuManager->_ViewPosition).y + *GHIDRA_CAST((in_ECX + 300)); - if (*GHIDRA_CAST((in_ECX + 0x109)) != '\0') { - if (*GHIDRA_CAST((in_ECX + 0x70)) == '\0') { - AnimationState::Render - (GHIDRA_CAST((in_ECX + 0x30)),&local_88,&g_vectorZero,&g_vectorZero); - AnimationState::Render - (GHIDRA_CAST((in_ECX + 0x50)),&local_88,&g_vectorZero,&g_vectorZero); - } - else { - AnimationState::Render - (GHIDRA_CAST((in_ECX + 0x50)),&local_88,&g_vectorZero,&g_vectorZero); - AnimationState::Render - (GHIDRA_CAST((in_ECX + 0x30)),&local_88,&g_vectorZero,&g_vectorZero); - } - } - fVar2 = local_88.y; - fVar1 = local_88.x; - if (*GHIDRA_CAST((in_ECX + 0x34)) == 0) { - nullFrame = GHIDRA_CAST(0x0); - } - else { - nullFrame = AnimationState::GetNullFrame - (GHIDRA_CAST((in_ECX + 0x30)),GHIDRA_CAST("TextStartPos")); - } - labelPos.y = fVar2 + nullFrame[1]; - statIndex = 0; - labelPos.x = fVar1 + *nullFrame; - statKey = GHIDRA_CAST(&DAT_00c78f08); - statOffset = 0xa8c; - columnX = labelPos.x; - rowY = labelPos.y; - local_88.y = labelPos.y; - do { - statCount = *GHIDRA_CAST(((g_manager->_persistentGameData)._achievements + statOffset + -0x38)); - if ((0 < statIndex) && (statIndex == (statIndex / 7) * 7)) { - labelPos.x = columnX + 126.0; - labelPos.y = local_88.y; - columnX = labelPos.x; - rowY = local_88.y; - } - sprintf_s(countText,0x20,s__d); - fontSettings = 0; - local_7c = 0xffff; - local_78 = 0; - local_74 = 0x3f800000; - local_70 = 0xffffffff; - local_6c = 0; - local_68 = 0; - if (statCount < 1) { - textColor._unk = 0; - textColor._red = 0.21176471; - textColor._green = 0.18431373; - textColor._blue = 0.1764706; - textColor._alpha = 0.8; - local_8 = 3; - Font::DrawStringScaled - (&g_manager->_font1_TeamMeatEx10,GHIDRA_CAST("??????"),&labelPos,&textColor,&fontSettings - ); - local_8 = 4; - hiddenValuePos.x = columnX + 102.0; - hiddenValuePos.y = rowY + 0.0; - pos = &hiddenValuePos; - } - else { - pFVar3 = &g_manager->_font1_TeamMeatEx10; - local_8 = 0; - textColor._unk = 0; - textColor._red = 0.21176471; - textColor._green = 0.18431373; - textColor._blue = 0.1764706; - textColor._alpha = 1.0; - strCursor = statKey; - if (0xf < *GHIDRA_CAST((statKey + 0x14))) { - strCursor = *GHIDRA_CAST(statKey); - } - translatedText = string_table_translate(&g_manager->_stringTable,strCursor); - tmpStringSize = 0; - tmpStringCapacity = 0xf; - tmpString[0] = GHIDRA_CAST(0x0); - strCursor = translatedText; - do { - strChar = *strCursor; - strCursor = strCursor + 1; - } while (strChar != 0); - (GHIDRA_CAST((GHIDRA_CAST(tmpString))))->msvc::string::assign(translatedText, - GHIDRA_INT(strCursor) - GHIDRA_INT((translatedText + 1))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; - pppppbVar4 = GHIDRA_CAST(tmpString); - if (0xf < tmpStringCapacity) { - pppppbVar4 = tmpString[0]; - } - Font::DrawStringScaled(pFVar3,GHIDRA_CAST(pppppbVar4),&labelPos,&textColor,&fontSettings); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 0; - if (0xf < tmpStringCapacity) { - uVar5 = tmpStringCapacity + 1; - pppppbVar4 = tmpString[0]; - if (0xfff < uVar5) { - pppppbVar4 = GHIDRA_CAST(tmpString[0][-1]); - uVar5 = tmpStringCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(tmpString[0]) + (-4 - GHIDRA_INT(pppppbVar4))))) - goto LAB_008e718e; - } - operator_delete(pppppbVar4,uVar5); - } - tmpStringSize = 0; - tmpStringCapacity = 0xf; - tmpString[0] = GHIDRA_CAST((GHIDRA_UINT(tmpString[0]) & 0xffffff00)); - local_8 = 2; - valuePos.x = columnX + 102.0; - textColor._red = 0.21176471; - textColor._green = 0.18431373; - textColor._blue = 0.1764706; - textColor._alpha = 1.0; - valuePos.y = rowY + 0.0; - textColor._unk = 0; - pos = &valuePos; - } - local_68 = 0; - local_6c = 0; - local_70 = 0xffffffff; - local_74 = 0x3f800000; - local_78 = 0; - local_7c = 0xffff; - fontSettings = 2; - Font::DrawStringScaled(&g_manager->_font1_TeamMeatEx10,countText,pos,&textColor,&fontSettings); - rowY = rowY + 14.0; - labelPos.y = rowY; - if (statIndex == *GHIDRA_CAST((in_ECX + 0x124))) { - local_7c = 0x12cffff; - local_70 = 0xffffffff; - local_6c = 0; - local_68 = 0; - local_8 = 5; - fontSettings = 1; - local_78 = 1; - local_74 = 0x3f800000; - if (*GHIDRA_CAST((in_ECX + 0x34)) == 0) { - nullFrame = GHIDRA_CAST(0x0); - } - else { - nullFrame = AnimationState::GetNullFrame - (GHIDRA_CAST((in_ECX + 0x30)),GHIDRA_CAST("DescriptionPos")); - } - textColor._unk = 0; - descriptionPos.y = fVar2 + nullFrame[1]; - descriptionPos.x = fVar1 + *nullFrame; - textColor._red = 0.21176471; - textColor._green = 0.18431373; - textColor._blue = 0.1764706; - textColor._alpha = 1.0; - if (statCount < 1) { - Font::DrawStringScaled - (&g_manager->_font1_TeamMeatEx10,GHIDRA_CAST("??????"),&descriptionPos,&textColor, - &fontSettings); - } - else { - keySize = *GHIDRA_CAST((statKey + 0x10)); - pFVar3 = &g_manager->_font1_TeamMeatEx10; - if (0x7fffffffU - GHIDRA_INT(keySize) < 5) { - /* WARNING: Subroutine does not return */ - msvc::string::_Xlen(); - } - strCursor = statKey; - if (0xf < *GHIDRA_CAST((statKey + 0x14))) { - strCursor = *GHIDRA_CAST(statKey); - } - (GHIDRA_CAST((GHIDRA_CAST(tmpString))))->msvc::string::concat(GHIDRA_INT(local_88.y),keySize,strCursor, - GHIDRA_UINT(keySize),GHIDRA_CAST("_DESC"),5); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 6; - pppppbVar4 = GHIDRA_CAST(tmpString); - if (0xf < tmpStringCapacity) { - pppppbVar4 = tmpString[0]; - } - translatedText = string_table_translate(&g_manager->_stringTable,GHIDRA_CAST(pppppbVar4)); - descriptionTextSize = 0; - descriptionTextCapacity = 0xf; - descriptionText[0] = GHIDRA_CAST(0x0); - strCursor = translatedText; - do { - strChar = *strCursor; - strCursor = strCursor + 1; - } while (strChar != 0); - (GHIDRA_CAST((GHIDRA_CAST(descriptionText))))->msvc::string::assign(translatedText, - GHIDRA_INT(strCursor) - GHIDRA_INT((translatedText + 1))); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 5; - if (0xf < tmpStringCapacity) { - uVar5 = tmpStringCapacity + 1; - pppppbVar4 = tmpString[0]; - if (0xfff < uVar5) { - pppppbVar4 = GHIDRA_CAST(tmpString[0][-1]); - uVar5 = tmpStringCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(tmpString[0]) + (-4 - GHIDRA_INT(pppppbVar4))))) - goto LAB_008e718e; - } - operator_delete(pppppbVar4,uVar5); - } - tmpStringSize = 0; - tmpStringCapacity = 0xf; - tmpString[0] = GHIDRA_CAST((GHIDRA_UINT(tmpString[0]) & 0xffffff00)); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 7; - pppppbVar4 = GHIDRA_CAST(descriptionText); - if (0xf < descriptionTextCapacity) { - pppppbVar4 = descriptionText[0]; - } - Font::DrawStringScaled(pFVar3,GHIDRA_CAST(pppppbVar4),&descriptionPos,&textColor,&fontSettings); - (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 5; - if (0xf < descriptionTextCapacity) { - uVar5 = descriptionTextCapacity + 1; - pppppbVar4 = descriptionText[0]; - if (0xfff < uVar5) { - pppppbVar4 = GHIDRA_CAST(descriptionText[0][-1]); - uVar5 = descriptionTextCapacity + 0x24; - if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(descriptionText[0]) + (-4 - GHIDRA_INT(pppppbVar4))))) { -LAB_008e718e: - /* WARNING: Subroutine does not return */ - _invalid_parameter_noinfo_noreturn(); - } - } - operator_delete(pppppbVar4,uVar5); - } - descriptionTextSize = 0; - descriptionTextCapacity = 0xf; - descriptionText[0] = GHIDRA_CAST((GHIDRA_UINT(descriptionText[0]) & 0xffffff00)); - } - } - local_8 = 0xffffffff; - statIndex = statIndex + 1; - statOffset = statOffset + 4; - statKey = statKey + 0x18; - if (0xadf < statOffset) { - ExceptionList = local_10; - return; - } - } while( true ); -} diff --git a/generated-src/stubs.cpp b/generated-src/stubs.cpp index dd5da9f..9f11995 100644 --- a/generated-src/stubs.cpp +++ b/generated-src/stubs.cpp @@ -9056,7 +9056,6 @@ void Menu_Online::enter() { generated_stub("Menu_Online::enter 008e5260"); } void Menu_Online::start_quick_match() { generated_stub("Menu_Online::start_quick_match 008e5420"); } void Menu_Online::render_descriptor(std_string *text) { generated_stub("Menu_Online::render_descriptor 008e5790"); } void Menu_Online::on_quick_match_search_result(int *param_1, int param_2) { generated_stub("Menu_Online::on_quick_match_search_result 008e5f40"); } -void Menu_Online::render_descriptions() { generated_stub("Menu_Online::render_descriptions 008e6a80"); } void Menu_OnlineLobby::update_list_cursor() { generated_stub("Menu_OnlineLobby::update_list_cursor 008db070"); } void Menu_OnlineLobby::render_player_slots() { generated_stub("Menu_OnlineLobby::render_player_slots 008db8f0"); } void Menu_OnlineLobby::Render() { generated_stub("Menu_OnlineLobby::Render 008ddae0"); } @@ -9415,7 +9414,6 @@ EntityConfig * FUN_00417910() { generated_stub("FUN_00417910 00417910"); } int FUN_00417920() { generated_stub("FUN_00417920 00417920"); } void FUN_00417dd0() { generated_stub("FUN_00417dd0 00417dd0"); } void FUN_00417df0() { generated_stub("FUN_00417df0 00417df0"); } -void FUN_00417e50() { generated_stub("FUN_00417e50 00417e50"); } int FUN_0041b770(int param_1) { generated_stub("FUN_0041b770 0041b770"); } void FUN_0041c670() { generated_stub("FUN_0041c670 0041c670"); } int FUN_0041c6f0(uint32_t param_1) { generated_stub("FUN_0041c6f0 0041c6f0"); } @@ -12200,8 +12198,6 @@ void FUN_008e6880(int *param_1) { generated_stub("FUN_008e6880 008e6880"); } void FUN_008e68a0(char param_1, int param_2) { generated_stub("FUN_008e68a0 008e68a0"); } void FUN_008e68e0() { generated_stub("FUN_008e68e0 008e68e0"); } int * FUN_008e69a0(uint32_t param_1) { generated_stub("FUN_008e69a0 008e69a0"); } -void FUN_008e71c0() { generated_stub("FUN_008e71c0 008e71c0"); } -void Menu_OnlineAwards::Update() { generated_stub("Menu_OnlineAwards::Update 008e7250"); } void FUN_008e74d0(uint8_t param_1) { generated_stub("FUN_008e74d0 008e74d0"); } int online_lobby_find_member_index(void *user) { generated_stub("online_lobby_find_member_index 008e7560"); } void FUN_008e7610() { generated_stub("FUN_008e7610 008e7610"); } diff --git a/src/entity/boss/beast.cpp b/src/entity/boss/beast.cpp index 704ebf7..51398f8 100644 --- a/src/entity/boss/beast.cpp +++ b/src/entity/boss/beast.cpp @@ -1023,7 +1023,7 @@ static void beast_background(Entity_NPC& npc, Room& room) bool isWide = room.gridWidth >= BEAST_HORSEMAN_MIN_WIDTH && room.gridHeight >= BEAST_HORSEMAN_MIN_HEIGHT; Vector at = vector_add(room.GetGridPosition(isWide ? room.gridWidth * BEAST_HORSEMAN_ROW + BEAST_HORSEMAN_COLUMN : -1), vector_make(BEAST_HORSEMAN_RIGHT, 0)); - room.lastAliveBossCount = 0; + room.entityList.bossMaxHealth = 0; Entity* horseman = nullptr; if (npc.i1 < BEAST_HORSEMEN) { diff --git a/src/entity/boss/brownie.cpp b/src/entity/boss/brownie.cpp index 0055e12..e80dcdd 100644 --- a/src/entity/boss/brownie.cpp +++ b/src/entity/boss/brownie.cpp @@ -572,7 +572,7 @@ static bool brownie_death(Entity_NPC& npc, BrownieFrame& frame) npc.health = npc.maxHitPoints * BROWNIE_DANGLE_HEALTH; npc.maxHitPoints = npc.health; } - g_game->room->lastAliveBossCount = 0; + g_game->room->entityList.bossMaxHealth = 0; npc.entityCollisionClass = ENTCOLL_ALL; npc.state = NPC_STATE_INIT; return true; diff --git a/src/entity/effect/items.cpp b/src/entity/effect/items.cpp index 76ea3e9..428bb31 100644 --- a/src/entity/effect/items.cpp +++ b/src/entity/effect/items.cpp @@ -444,7 +444,7 @@ static void leech_explosion_init(Entity_Effect& explosion) } // Part of 005cdb20 (Init's case 142) The whirlpool and its particles take the water's color, the particles on the -// floor on one of four idles. +// floor on one of four idles (Idle1 to Idle4). static void whirlpool_init(Entity_Effect& whirlpool) { ColorMod& water = g_game->room->fxLayers.fxParams.waterEffectColor; @@ -456,7 +456,7 @@ static void whirlpool_init(Entity_Effect& whirlpool) } whirlpool.sortingLayer = SORTING_BACKGROUND; - int idle = whirlpool.dropRNG.RandomInt(WHIRLPOOL_PARTICLE_IDLES); + int idle = whirlpool.dropRNG.RandomInt(WHIRLPOOL_PARTICLE_IDLES) + 1; whirlpool.sprite.Play("Idle" + std::to_string(idle)); whirlpool.sprite.color = water; for (int i = 0; i < 3; i++) whirlpool.sprite.color._offset[i] = WHIRLPOOL_PARTICLE_OFFSET; diff --git a/src/entity/familiar/ai.cpp b/src/entity/familiar/ai.cpp index 3ccff53..c9cf217 100644 --- a/src/entity/familiar/ai.cpp +++ b/src/entity/familiar/ai.cpp @@ -6,6 +6,7 @@ #include "entity/weapon/tear.h" #include "entity/familiar/gello.h" #include "entity/familiar/variants.h" +#include "entity/familiar/wisp.h" #include "entity/boss/ai.h" #include "game/game.h" #include "level/generator.h" @@ -904,6 +905,8 @@ void Entity_Familiar::room_enter() case VANISHING_TWIN: vanishing_twin_room_enter(*this); break; case UMBILICAL_BABY: umbilical_baby_room_enter(*this); break; case WISP: + wisp_room_enter(*this); + [[fallthrough]]; case ITEM_WISP: pos = GetOrbitPosition(player->pos); break; } diff --git a/src/entity/familiar/wisp.h b/src/entity/familiar/wisp.h index 324e39f..1d92476 100644 --- a/src/entity/familiar/wisp.h +++ b/src/entity/familiar/wisp.h @@ -46,6 +46,7 @@ void erased_enemy_add(Entity& enemy); void wisp_kind_init(Entity_Familiar& wisp, int item); void wisp_kind_colors(Entity_Familiar& wisp); void wisp_kind_update(Entity_Familiar& wisp, WispShot& shot); +void wisp_room_enter(Entity_Familiar& wisp); void plum_flute_wisp_target(Entity_Familiar& wisp); void plum_flute_wisp_spray(Entity_Familiar& wisp, int updateSteps); bool wisp_kind_fire(Entity_Familiar& wisp, Vector velocity); diff --git a/src/entity/familiar/wisp_kinds.cpp b/src/entity/familiar/wisp_kinds.cpp index bc10e21..e7640d8 100644 --- a/src/entity/familiar/wisp_kinds.cpp +++ b/src/entity/familiar/wisp_kinds.cpp @@ -213,6 +213,7 @@ constexpr float MONSTER_SPEED_MIN = 0.7f; constexpr uint32_t D8_DELAY_SPREAD = 5; constexpr int D8_DELAY_SHIFT = -2; constexpr int D8_SHIFT_INDEX = 13; +constexpr int RED_KEY_WISP_SHIFT_INDEX = 7; constexpr float WAVY_CAP_STACK = 0.75f; constexpr float WAVY_CAP_NULL_STACK = 0.3f; constexpr float WAVY_CAP_ROOT = 0.23f; @@ -1015,6 +1016,24 @@ void plum_flute_wisp_target(Entity_Familiar& wisp) } } +// Part of 0062bb70 (a new room, a wisp's case): Mr. Me!'s wisp drops its errand and rejoins its ring, Red Key's opens a +// red room through the wall its room's spawn seed picks when it can. +void wisp_room_enter(Entity_Familiar& wisp) +{ + if (wisp.subtype == COLLECTIBLE_MR_ME) + { + wisp.keys = MR_ME_IDLE; + wisp.velocity = {}; + if (wisp.orbitLayer < 0) wisp.AddToOrbit(wisp_config(wisp)->layer + WISP_RING_OFFSET); + } + else if (wisp.subtype == COLLECTIBLE_RED_KEY) + { + int slot = (int)(rng_make(g_game->room->descriptor->spawnSeed, RED_KEY_WISP_SHIFT_INDEX).Next() % DOOR_SLOT_COUNT); + if (!g_game->room->doors[slot] && g_game->CanSpawnDoorOutline(g_game->currentRoomIdx, slot)) + g_game->MakeRedRoomDoor(g_game->currentRoomIdx, slot); + } +} + // The end of 0043aa90 for the Plum Flute's wisp spraying: it flies along a diagonal, spraying blood tears behind it // every fourth update with a fart, its animation facing up or down. void plum_flute_wisp_spray(Entity_Familiar& wisp, int updateSteps) diff --git a/src/entity/list.cpp b/src/entity/list.cpp index f2c709c..ec2d2be 100644 --- a/src/entity/list.cpp +++ b/src/entity/list.cpp @@ -241,6 +241,19 @@ EntityList::EntityList() Reset(); } +// 00417e50 Removes every entity still listed, the persistent ones too, so their pools hand them out again. +EntityList::~EntityList() +{ + for (EntityList_EL* list : {&mainEL, &persistentEL}) + for (size_t i = 0; i < list->size(); i++) + { + Entity* entity = (*list)[i]; + entity->ClearReferences(); + entity->isValid = false; + entity->Remove(); + } +} + // 00418230 Removes every entity but the persistent ones, and starts the lists over with those. void EntityList::Reset() { diff --git a/src/entity/list.h b/src/entity/list.h index f5d78c7..a2fa97d 100644 --- a/src/entity/list.h +++ b/src/entity/list.h @@ -157,6 +157,7 @@ struct EntityList bool isAnyBaited = false; EntityList(); + ~EntityList(); EntityList(const EntityList&) = delete; EntityList& operator=(const EntityList&) = delete; diff --git a/src/entity/npc/npc.cpp b/src/entity/npc/npc.cpp index 67d2794..f210b17 100644 --- a/src/entity/npc/npc.cpp +++ b/src/entity/npc/npc.cpp @@ -1270,31 +1270,23 @@ void Entity_NPC::status_overlay_update() (g_game->challenge != CHALLENGE_SPEED && g_game->room->brokenWatchState == BROKEN_WATCH_SLOW); bool isTimeImmune = (flags & (FLAG_FRIENDLY | FLAG_NO_STATUS_EFFECTS)) && type != ENTITY_DEATHS_HEAD; - // Each status overrides the ones before it, so the last that applies shows. Charm overrides them all. + // The first status that applies shows, charm before all, the crown or skull when none does. std::string_view animation; - bool isShared = championColorIdx == CHAMPION_KING; - if (championColorIdx == CHAMPION_KING) animation = "Crown"; + bool isShared = true; + if (HasEntityFlags(FLAG_CHARM) && !isShadowCharger) animation = "Charm"; + else if (HasEntityFlags(FLAG_BRIMSTONE_MARKED)) animation = "BrimstoneCurse"; + else if (HasEntityFlags(FLAG_MAGNETIZED)) animation = "Magnetize"; + else if (HasEntityFlags(FLAG_BAITED)) animation = "Bait", isShared = false; + else if (HasEntityFlags(FLAG_CONFUSION)) animation = "Confuse"; + else if (HasEntityFlags(FLAG_BURN)) animation = "Burning", isShared = false; + else if (HasEntityFlags(FLAG_POISON)) animation = "Poison"; + else if (HasEntityFlags(FLAG_FEAR)) animation = "Fear"; + else if (HasEntityFlags(FLAG_BLEED_OUT)) animation = "BleedingOut"; + else if (HasEntityFlags(FLAG_SLOW) || (isTimeSlowed && !isTimeImmune)) animation = "Slow"; + else if (HasEntityFlags(FLAG_WEAKNESS)) animation = "Weakness"; + else if (type == ENTITY_SIREN_HELPER) animation = "EnemyCharm"; + else if (championColorIdx == CHAMPION_KING) animation = "Crown"; else if (championColorIdx == CHAMPION_DEATH) animation = "Skull"; - - if (HasEntityFlags(FLAG_CHARM) && !isShadowCharger) - { - animation = "Charm"; - isShared = true; - } - else - { - if (HasEntityFlags(FLAG_BRIMSTONE_MARKED)) animation = "BrimstoneCurse"; - if (HasEntityFlags(FLAG_MAGNETIZED)) animation = "Magnetize"; - if (HasEntityFlags(FLAG_BAITED)) animation = "Bait", isShared = false; - if (HasEntityFlags(FLAG_CONFUSION)) animation = "Confuse"; - if (HasEntityFlags(FLAG_BURN)) animation = "Burning", isShared = false; - if (HasEntityFlags(FLAG_POISON)) animation = "Poison"; - if (HasEntityFlags(FLAG_FEAR)) animation = "Fear"; - if (HasEntityFlags(FLAG_BLEED_OUT)) animation = "BleedingOut"; - if (HasEntityFlags(FLAG_SLOW) || (isTimeSlowed && !isTimeImmune)) animation = "Slow"; - if (HasEntityFlags(FLAG_WEAKNESS)) animation = "Weakness"; - if (type == ENTITY_SIREN_HELPER) animation = "EnemyCharm"; - } if (animation.empty()) { if (statusEffectSprite.animState.animData) statusEffectSprite.animState.isPlaying = false; diff --git a/src/entity/weapon/tear.cpp b/src/entity/weapon/tear.cpp index ba3d35f..7b053b5 100644 --- a/src/entity/weapon/tear.cpp +++ b/src/entity/weapon/tear.cpp @@ -1642,14 +1642,17 @@ static bool is_sized_variant(int variant) variant == TEAR_SPORE; } -// The sized animation's name for a variant and its number. +// The sized animation's name for a variant and its number. Tooth, coin and stone tears have half as many sizes. static std::string sized_animation_name(int variant, int number) { const char* format = "RegularTear%d"; - if (is_listed(BLOOD_ANIMATION_VARIANTS, variant)) format = "BloodTear%d"; + bool isHalved = true; + if (is_listed(BLOOD_ANIMATION_VARIANTS, variant)) format = "BloodTear%d", isHalved = false; else if (variant == TEAR_TOOTH || variant == TEAR_BLACK_TOOTH) format = "Tooth%dMove"; else if (variant == TEAR_COIN) format = "Rotate%d"; else if (is_listed(STONE_ANIMATION_VARIANTS, variant)) format = "Stone%dMove"; + else isHalved = false; + if (isHalved) number = std::max(number / 2, 1); char name[TEAR_ANIMATION_NAME_SIZE]; std::snprintf(name, sizeof(name), format, number); diff --git a/src/game/game.cpp b/src/game/game.cpp index fe8056b..aba4e4d 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -441,9 +441,11 @@ void Game::ResetState() } // 007384d0 Replaces the current room with a new one and clears the floor: no rooms, stage, curses or Greed waves. +// The old room stays current while it is deleted, as its entities' removal reads it. void Game::level_reset() { - room.reset(); + delete room.get(); + room.release(); room = std::make_unique(); startingRoomIdx = -1; nbRooms = 0; diff --git a/src/level/room.cpp b/src/level/room.cpp index 25db9cc..f74b15a 100644 --- a/src/level/room.cpp +++ b/src/level/room.cpp @@ -337,7 +337,7 @@ static void room_reset(Room& room) room.entityList.Reset(); room.entityIndexCounter = 0; for (Entity* entity : room.entityList.updateEL) entity->index = room.entityIndexCounter++; - room.lastAliveBossCount = 0; + room.bossesRemaining = 0; for (int i = 0; i < ROOM_ITEM_COUNTER_COUNT; i++) if (!(ROOM_ITEM_COUNTERS_KEPT >> i & 1)) room.itemCounters[i] = 0; diff --git a/src/level/room.h b/src/level/room.h index 02bee50..6ae2b3c 100644 --- a/src/level/room.h +++ b/src/level/room.h @@ -251,7 +251,6 @@ public: int greedWaveTimer = 0; int gridHeight = 0; int gridWidth = 0; - int lastAliveBossCount = 0; int numRainSpawners = 0; int roomClearDelay = 0; int secondBossId = 0; diff --git a/src/level/room_update.cpp b/src/level/room_update.cpp index d0c40d1..e4d1441 100644 --- a/src/level/room_update.cpp +++ b/src/level/room_update.cpp @@ -1428,14 +1428,15 @@ void Room::Update() if ((roomType == ROOM_CHALLENGE || roomType == ROOM_BOSSRUSH) && game.ambush.isActive) game.ambush.Update(); if (isCardAgainstHumanity) card_against_humanity_fill(); + // The bosses still counted are the living ones from here on, warning when some left without TriggerBossDeath. int bosses = GetAliveBossesCount(); - if (bosses < 1 && lastAliveBossCount > 0) + if (bosses < 1 && bossesRemaining > 0) { if (g_manager->netplayManager.is_online()) KAGE_LogMessage(LOG_INFO, (uint8_t*)("[Frame " + std::to_string(game.frameCount) + "] ").c_str()); KAGE_LogMessage(LOG_INFO, (uint8_t*)"[warn] last boss died without triggering the deathspawn.\n"); } - lastAliveBossCount = bosses; + bossesRemaining = bosses; entityList.Update(UPDATE_NORMAL); fxLayers.Update(PLAYER_FOLLOW_EASE); diff --git a/src/ui/menu/manager.cpp b/src/ui/menu/manager.cpp index d1809b4..4cd506a 100644 --- a/src/ui/menu/manager.cpp +++ b/src/ui/menu/manager.cpp @@ -256,6 +256,10 @@ void MenuManager::menus_init() menuBestiary.Init(menu_position_get(MENU_BESTIARY)); log_printf(LOG_INFO, "Menu Custom Challenge Init\n"); menuCustomChallenge.Init(menu_position_get(MENU_CUSTOM_CHALLENGE)); + log_printf(LOG_INFO, "Menu Online Awards Init\n"); + onlineAwardsPosition = menu_position_get(MENU_ONLINE_AWARDS); + online_awards_load(); + online_awards_reset(); } // 00988ba0 Drops every menu's sprites, as a run starts. @@ -279,6 +283,7 @@ void MenuManager::unload_graphics() menuBestiary.unload_graphics(); menuCustomChallenge.customChallengeSprite.Reset(); menuMods.modsMenuSprite.Reset(); + onlineStatsMenuSprite.Reset(); } // 00988d80 Loads every menu's sprites again, as the menus come back. @@ -301,6 +306,7 @@ void MenuManager::LoadGraphics() menuBestiary.load_graphics(); menuCustomChallenge.LoadGraphics(); menuMods.LoadGraphics(); + online_awards_load(); } // 00989750 Fades the menus out into the run to the start jingle, loading the loading screen for the start seed. @@ -399,7 +405,7 @@ void MenuManager::Update() color_mod_update(); } -// Steps the selected menu. The online menus are never selected offline. +// Steps the selected menu. The online menus besides the awards are never selected offline. void MenuManager::menu_update() { switch (selectedMenuId) @@ -420,6 +426,7 @@ void MenuManager::menu_update() case MENU_BESTIARY: menuBestiary.Update(); break; case MENU_CUSTOM_CHALLENGE: menuCustomChallenge.Update(); break; case MENU_MODS: menuMods.Update(); break; + case MENU_ONLINE_AWARDS: online_awards_update(); break; default: break; } } @@ -483,6 +490,7 @@ void MenuManager::Render() menuCutscenes.Render(); menuCustomChallenge.Render(); menuMods.Render(); + online_awards_render(); menuSave.Render(); menuDailyChallenge.leaderboard.Render(); flySprite.Render(menu_draw_get(vector_make(scrollInterpolationX, scrollInterpolationY))); @@ -732,8 +740,8 @@ SeedsEntry MenuManager::transition_other_apply(MenuState previous, MenuState sta case MENU_ONLINE_LOBBY_LIST: case MENU_ONLINE: case MENU_ONLINE_OPTIONS: - case MENU_CREATE_LOBBY: - case MENU_ONLINE_AWARDS: return SEEDS_ENTRY_KEEP; + case MENU_CREATE_LOBBY: return SEEDS_ENTRY_KEEP; + case MENU_ONLINE_AWARDS: online_awards_reset(); return SEEDS_ENTRY_KEEP; default: return SEEDS_ENTRY_RESET; } } diff --git a/src/ui/menu/manager.h b/src/ui/menu/manager.h index f57e4b9..02711af 100644 --- a/src/ui/menu/manager.h +++ b/src/ui/menu/manager.h @@ -124,10 +124,20 @@ constexpr int SOUND_MENU_NOTE_APPEAR = 283; constexpr int SOUND_MENU_NOTE_HIDE = 284; constexpr ColorModState COLOR_MOD_NONE = {1, 1, 1, 0, 0, 1}; +// The directions the online awards page moves its cursor by, each with its hold counter in this order. +enum OnlineAwardsDirection +{ + ONLINE_AWARDS_UP, + ONLINE_AWARDS_DOWN, + ONLINE_AWARDS_LEFT, + ONLINE_AWARDS_RIGHT, + ONLINE_AWARDS_DIRECTION_COUNT +}; + // Copies are never made. Destruction (00986f30) is the default. // The main menu (g_menuManager): every menu laid out on one sheet the view scrolls across, the history of menus // opened, the fades, the fly, the shadow and overlay over everything, and the color modifier it all renders through. -// The online menus are offline: they are never built, entered or drawn. +// The online menus are offline: they are never built, entered or drawn, but for the online awards page the stats open. class MenuManager { public: @@ -144,6 +154,10 @@ public: KAGE::Graphics::ImagePtr menuOverlayImage; ANM2 flySprite; ANM2 menuShadowSprite; + ANM2 onlineStatsMenuSprite; + std::array onlineAwardsHoldFrames{}; + Vector onlineAwardsPosition{}; + int onlineAwardsSelected = 0; Menu_Title menuTitle; Menu_Save menuSave; @@ -208,6 +222,10 @@ private: void overlay_render(); void color_mod_render(); void fades_render(); + void online_awards_load(); + void online_awards_reset(); + void online_awards_update(); + void online_awards_render(); }; extern KAGE::Graphics::ImagePtr menuColorModSurface; diff --git a/src/ui/menu/online_awards.cpp b/src/ui/menu/online_awards.cpp new file mode 100644 index 0000000..cd1d0a9 --- /dev/null +++ b/src/ui/menu/online_awards.cpp @@ -0,0 +1,122 @@ +#include "engine/font.h" +#include "game/game.h" +#include "game/manager.h" +#include "ui/menu/manager.h" +#include + +constexpr const char* ONLINE_STATS_ANM2 = "gfx/ui/main menu/OnlineStatsMenu.anm2"; +constexpr const char* CURSOR_LAYER = "Cursor"; +constexpr const char* TEXT_START_NULL = "TextStartPos"; +constexpr const char* DESCRIPTION_NULL = "DescriptionPos"; +constexpr const char* UNKNOWN_TEXT = "??????"; +constexpr const char* DESCRIPTION_SUFFIX = "_DESC"; + +// The grid: columns of seven awards, three of them. +constexpr int AWARD_ROWS = 7; +constexpr int AWARD_GRID_SPAN = COOP_AWARD_COUNT - AWARD_ROWS; +// A held direction moves once, then again every eighth frame once held past the 39th. +constexpr int HOLD_DELAY = 39; +constexpr int HOLD_INTERVAL = 8; + +// The text: each column 126 wide with its count 102 in, rows 14 apart, descriptions wrapped at 300. +constexpr float COLUMN_WIDTH = 126; +constexpr float COUNT_OFFSET_X = 102; +constexpr float ROW_HEIGHT = 14; +constexpr uint16_t DESCRIPTION_WIDTH = 300; +constexpr KColor TEXT_COLOR = kcolor_rgba(0.21176471f, 0.18431373f, 0.1764706f, 1); +constexpr float UNKNOWN_ALPHA = 0.8f; + +// The award counters the event counters keep, in the order of COOP_AWARD_KEYS. +constexpr int AWARD_COUNTER_FIRST = 500; + +// Loads the online awards page, idling (inlined in MenuManager::Init and MenuManager::LoadGraphics). +void MenuManager::online_awards_load() +{ + onlineStatsMenuSprite.Load(ONLINE_STATS_ANM2, GRAPHICS_LOAD); + onlineStatsMenuSprite.Play(ANIMATION_IDLE); +} + +// 008e71c0 Idles the online awards page (an unforced play) and forgets the held directions. +void MenuManager::online_awards_reset() +{ + onlineStatsMenuSprite.Play(ANIMATION_IDLE); + onlineAwardsHoldFrames = {}; +} + +// Whether a direction is held this frame and moves the cursor now, counting how long it has been held. +static bool is_direction_step(ButtonAction action, int& held) +{ + if (!is_action(action, ACTION_PRESSED)) + { + held = 0; + return false; + } + bool isStep = held == 0 || (held > HOLD_DELAY && held % HOLD_INTERVAL == 0); + held++; + return isStep; +} + +// 008e7250 (Menu_OnlineAwards::Update) Steps the online awards page every other frame (MenuManager::Update's part), +// then back leaves and the directions move the cursor, wrapping within its column or row. The cursor layer shows the +// selected award. +void MenuManager::online_awards_update() +{ + std::array& held = onlineAwardsHoldFrames; + int& selected = onlineAwardsSelected; + + if ((g_manager->framecount & 1) == 0 && onlineStatsMenuSprite.isLoaded) onlineStatsMenuSprite.Update(); + + if (is_action(ACTION_MENU_BACK, ACTION_TRIGGERED)) pop_menu(); + if (is_direction_step(ACTION_MENU_UP, held[ONLINE_AWARDS_UP])) + selected += selected % AWARD_ROWS != 0 ? -1 : AWARD_ROWS - 1; + if (is_direction_step(ACTION_MENU_DOWN, held[ONLINE_AWARDS_DOWN])) + selected += selected % AWARD_ROWS != AWARD_ROWS - 1 ? 1 : 1 - AWARD_ROWS; + if (is_direction_step(ACTION_MENU_LEFT, held[ONLINE_AWARDS_LEFT])) + selected += selected < AWARD_ROWS ? AWARD_GRID_SPAN : -AWARD_ROWS; + if (is_direction_step(ACTION_MENU_RIGHT, held[ONLINE_AWARDS_RIGHT])) + selected += selected >= AWARD_GRID_SPAN ? -AWARD_GRID_SPAN : AWARD_ROWS; + + onlineStatsMenuSprite.SetLayerFrame(CURSOR_LAYER, selected); +} + +// 008e6a80 (Menu_OnlineAwards::Render) Draws the online awards page, then each award's name and count down its column +// (both "??????" faded until won), and the selected award's description wrapped under the grid. +// The original reads the null frames of a page with no animation. Nothing is written then. +void MenuManager::online_awards_render() +{ + Font& font = g_manager->font1_TeamMeatEx10; + std::array& counters = g_manager->persistentGameData.eventCounters; + SpriteDraw draw = menu_draw_get(onlineAwardsPosition); + Vector scale = vector_make(1, 1); + + if (onlineStatsMenuSprite.isLoaded) onlineStatsMenuSprite.Render(draw); + const NullFrame* textStart = onlineStatsMenuSprite.GetNullFrame(TEXT_START_NULL); + const NullFrame* description = onlineStatsMenuSprite.GetNullFrame(DESCRIPTION_NULL); + if (!textStart || !description) return; + + Vector start = vector_add(draw.position, textStart->pos); + Vector label = start; + for (int award = 0; award < COOP_AWARD_COUNT; award++) + { + int count = counters[AWARD_COUNTER_FIRST + award]; + bool isWon = count >= 1; + KColor color = TEXT_COLOR; + if (!isWon) color._alpha = UNKNOWN_ALPHA; + if (award > 0 && award % AWARD_ROWS == 0) label = vector_make(label.x + COLUMN_WIDTH, start.y); + + FontSettings labelSettings; + font.DrawString(isWon ? g_manager->stringTable.translate(COOP_AWARD_KEYS[award]) : UNKNOWN_TEXT, label, scale, + color, labelSettings); + FontSettings countSettings(ALIGN_TOP_RIGHT); + font.DrawString(std::to_string(count), vector_make(label.x + COUNT_OFFSET_X, label.y), scale, color, + countSettings); + label.y += ROW_HEIGHT; + if (award != onlineAwardsSelected) continue; + + FontSettings descriptionSettings(ALIGN_TOP_CENTER); + descriptionSettings.EnableAutoWrap(DESCRIPTION_WIDTH); + std::string key = std::string(COOP_AWARD_KEYS[award]) + DESCRIPTION_SUFFIX; + font.DrawString(isWon ? g_manager->stringTable.translate(key) : UNKNOWN_TEXT, + vector_add(draw.position, description->pos), scale, TEXT_COLOR, descriptionSettings); + } +}