* Shows the stats at end of scenario. * @param killedAllied The amount of destroyed allied units. * @param killedEnemy The amount of destroyed enemy units. * @param destroyedAllied The amount of destroyed allied structures. * @param destroyedEnemy The amount of destroyed enemy structures. * @param harvestedAllied The amount of spice harvested by allies. * @param harvestedEnemy The amount of
| 1620 | * @param houseID The houseID of the player. |
| 1621 | */ |
| 1622 | void GUI_EndStats_Show(uint16 killedAllied, uint16 killedEnemy, uint16 destroyedAllied, uint16 destroyedEnemy, uint16 harvestedAllied, uint16 harvestedEnemy, int16 score, uint8 houseID) |
| 1623 | { |
| 1624 | Screen oldScreenID; |
| 1625 | uint16 statsBoxCount; |
| 1626 | uint16 textLeft; /* text left position */ |
| 1627 | uint16 statsBarWidth; /* available width to draw the score bars */ |
| 1628 | struct { uint16 value; uint16 increment; } scores[3][2]; |
| 1629 | uint16 i; |
| 1630 | |
| 1631 | s_ticksPlayed = ((g_timerGame - g_tickScenarioStart) / 3600) + 1; |
| 1632 | |
| 1633 | score = Update_Score(score, &harvestedAllied, &harvestedEnemy, houseID); |
| 1634 | |
| 1635 | /* 1st scenario doesn't have the "Building destroyed" stats */ |
| 1636 | statsBoxCount = (g_scenarioID == 1) ? 2 : 3; |
| 1637 | |
| 1638 | GUI_Mouse_Hide_Safe(); |
| 1639 | |
| 1640 | GUI_ChangeSelectionType(SELECTIONTYPE_MENTAT); |
| 1641 | |
| 1642 | oldScreenID = GFX_Screen_SetActive(SCREEN_1); |
| 1643 | |
| 1644 | GUI_HallOfFame_DrawBackground(score, false); |
| 1645 | |
| 1646 | GUI_DrawTextOnFilledRectangle(String_Get_ByIndex(STR_SPICE_HARVESTED_BY), 83); |
| 1647 | GUI_DrawTextOnFilledRectangle(String_Get_ByIndex(STR_UNITS_DESTROYED_BY), 119); |
| 1648 | if (g_scenarioID != 1) GUI_DrawTextOnFilledRectangle(String_Get_ByIndex(STR_BUILDINGS_DESTROYED_BY), 155); |
| 1649 | |
| 1650 | textLeft = 19 + max(Font_GetStringWidth(String_Get_ByIndex(STR_YOU)), Font_GetStringWidth(String_Get_ByIndex(STR_ENEMY))); |
| 1651 | statsBarWidth = 261 - textLeft; |
| 1652 | |
| 1653 | for (i = 0; i < statsBoxCount; i++) { |
| 1654 | GUI_DrawText_Wrapper(String_Get_ByIndex(STR_YOU), textLeft - 4, 92 + (i * 36), 0xF, 0, 0x221); |
| 1655 | GUI_DrawText_Wrapper(String_Get_ByIndex(STR_ENEMY), textLeft - 4, 101 + (i * 36), 0xF, 0, 0x221); |
| 1656 | } |
| 1657 | |
| 1658 | Music_Play(17 + Tools_RandomLCG_Range(0, 5)); |
| 1659 | |
| 1660 | GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, SCREEN_HEIGHT, SCREEN_1, SCREEN_0); |
| 1661 | |
| 1662 | Input_History_Clear(); |
| 1663 | |
| 1664 | scores[0][0].value = harvestedAllied; |
| 1665 | scores[0][1].value = harvestedEnemy; |
| 1666 | scores[1][0].value = killedEnemy; |
| 1667 | scores[1][1].value = killedAllied; |
| 1668 | scores[2][0].value = destroyedEnemy; |
| 1669 | scores[2][1].value = destroyedAllied; |
| 1670 | |
| 1671 | for (i = 0; i < statsBoxCount; i++) { |
| 1672 | uint16 scoreIncrement; |
| 1673 | |
| 1674 | /* You */ |
| 1675 | if (scores[i][0].value > 65000) scores[i][0].value = 65000; |
| 1676 | /* Enemy */ |
| 1677 | if (scores[i][1].value > 65000) scores[i][1].value = 65000; |
| 1678 | |
| 1679 | scoreIncrement = 1 + (max(scores[i][0].value, scores[i][1].value) / statsBarWidth); |
no test coverage detected