diff --git a/src/k_hud.c b/src/k_hud.c index 42773bb77..38b80b035 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -75,8 +75,8 @@ static patch_t *kp_racefinish[6]; static patch_t *kp_positionnum[10][2][2]; // number, overlay or underlay, splitscreen -static patch_t *kp_facenum[MAXPLAYERS+1]; -patch_t *kp_facehighlight[8]; +patch_t *kp_facenum[MAXPLAYERS+1]; +static patch_t *kp_facehighlight[8]; static patch_t *kp_nocontestminimap; static patch_t *kp_spbminimap; diff --git a/src/k_hud.h b/src/k_hud.h index b16c15e2c..663690c7c 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -81,6 +81,7 @@ extern patch_t *kp_button_right[2]; extern patch_t *kp_button_left[2]; extern patch_t *kp_eggnum[6]; +extern patch_t *kp_facenum[MAXPLAYERS+1]; #ifdef __cplusplus } // extern "C" diff --git a/src/k_menu.h b/src/k_menu.h index 8c91a612c..8b43bd498 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1206,7 +1206,7 @@ void M_DrawAddons(void); #define CC_TOTAL 0 #define CC_UNLOCKED 1 -#define CC_TALLY 2 +#define CC_PERCENT 2 #define CC_ANIM 3 #define CC_CHAOANIM 4 #define CC_CHAONOPE 5 diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 691ccf65e..9a8e8f93e 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -5896,7 +5896,6 @@ static void M_DrawChallengePreview(INT32 x, INT32 y) } #define challengesgridstep 22 -#define challengekeybarwidth 50 void M_DrawChallenges(void) { @@ -6046,11 +6045,23 @@ challengedesc: // Tally { - str = va("%d/%d", - challengesmenu.unlockcount[CC_UNLOCKED] + challengesmenu.unlockcount[CC_TALLY], - challengesmenu.unlockcount[CC_TOTAL] - ); - V_DrawRightAlignedTimerString(BASEVIDWIDTH-7, 9-challengesmenu.unlockcount[CC_ANIM], 0, str); + INT32 textx = BASEVIDWIDTH - 24, texty = 20-challengesmenu.unlockcount[CC_ANIM]; + UINT8 numbers[3]; + numbers[0] = ((challengesmenu.unlockcount[CC_PERCENT] / 100) % 10); + numbers[1] = ((challengesmenu.unlockcount[CC_PERCENT] / 10) % 10); + numbers[2] = (challengesmenu.unlockcount[CC_PERCENT] % 10); + + patch_t *percent = W_CachePatchName("K_SPDML1", PU_CACHE); + + V_DrawScaledPatch(textx + 3, texty, 0, percent); + + i = 3; + while (i) + { + i--; + textx -= 6; + V_DrawScaledPatch(textx, texty, 0, kp_facenum[numbers[i]]); + } } // Chao Keys @@ -6061,34 +6072,50 @@ challengedesc: offs = -offs; offs /= 2; - if (gamedata->chaokeys > 9) - { - offs -= 6; - if (gamedata->chaokeys > 99) - offs -= 2; // as far as we can go - } - - fixed_t keyx = (8+offs)*FRACUNIT, keyy = 5*FRACUNIT; - - const char *timerstr = va("%u", gamedata->chaokeys); - - V_DrawTimerString((27+offs), 9-challengesmenu.unlockcount[CC_CHAOANIM], 0, timerstr); + fixed_t keyx = (3+offs)*FRACUNIT, keyy = 0; K_drawButton( - (27 + offs + V_TimerStringWidth(timerstr, 0) + 2) << FRACBITS, - 11 << FRACBITS, + (21 + offs + 2) << FRACBITS, + 8 << FRACBITS, 0, kp_button_c[1], M_MenuExtraHeld(pid) ); - offs = challengekeybarwidth; + #define challengekeybarheight 27 + + offs = challengekeybarheight; if (gamedata->chaokeys < GDMAX_CHAOKEYS) - offs = ((gamedata->pendingkeyroundoffset * challengekeybarwidth)/GDCONVERT_ROUNDSTOKEY); + offs = ((gamedata->pendingkeyroundoffset * challengekeybarheight)/GDCONVERT_ROUNDSTOKEY); if (offs > 0) - V_DrawFill(1, 25, offs, 2, 0); - if (offs < challengekeybarwidth) - V_DrawFadeFill(1+offs, 25, challengekeybarwidth-offs, 2, 0, 31, challengetransparentstrength); + V_DrawFill(1, 1 + (challengekeybarheight-offs), 2, offs, 0); + if (offs < challengekeybarheight) + V_DrawFadeFill(1, 1, 2, challengekeybarheight-offs, 0, 31, challengetransparentstrength); + + #undef challengekeybarheight + + { + INT32 textx = 4, texty = 20-challengesmenu.unlockcount[CC_CHAOANIM]; + UINT8 numbers[4]; + numbers[0] = ((gamedata->chaokeys / 100) % 10); + numbers[1] = ((gamedata->chaokeys / 10) % 10); + numbers[2] = (gamedata->chaokeys % 10); + + numbers[3] = ((gamedata->chaokeys / 1000) % 10); + if (numbers[3] != 0) + { + V_DrawScaledPatch(textx - 1, texty, 0, kp_facenum[numbers[3]]); + textx += 5; + } + + i = 0; + while (i < 3) + { + V_DrawScaledPatch(textx, texty, 0, kp_facenum[numbers[i]]); + textx += 6; + i++; + } + } if (challengesmenu.currentunlock < MAXUNLOCKABLES && challengesmenu.chaokeyhold) { @@ -6202,7 +6229,6 @@ challengedesc: #undef challengetransparentstrength #undef challengesgridstep -#undef challengekeybarwidth // Statistics menu diff --git a/src/menus/extras-challenges.c b/src/menus/extras-challenges.c index 6eba38d84..4cdee237d 100644 --- a/src/menus/extras-challenges.c +++ b/src/menus/extras-challenges.c @@ -54,6 +54,14 @@ menu_t MISC_StatisticsDef = { struct challengesmenu_s challengesmenu; +static void M_UpdateChallengeGridVisuals(void) +{ + // Currently only updates the completion %. + challengesmenu.unlockcount[CC_PERCENT] = + (100 * challengesmenu.unlockcount[CC_UNLOCKED]) + /challengesmenu.unlockcount[CC_TOTAL]; +} + static void M_ChallengesAutoFocus(UINT16 unlockid, boolean fresh) { UINT16 i; @@ -263,6 +271,8 @@ menu_t *M_InterruptMenuWithChallenges(menu_t *desiredmenu) challengesmenu.unlockcount[CC_UNLOCKED]++; } + M_UpdateChallengeGridVisuals(); + if (challengesmenu.pending) M_ChallengesAutoFocus(newunlock, true); else if (newunlock >= MAXUNLOCKABLES && gamedata->pendingkeyrounds > 0 @@ -312,7 +322,7 @@ static boolean M_CanKeyHiliTile(void) // Not a hinted tile OR a fresh board. if (!(challengesmenu.extradata[i].flags & CHE_HINT) - && (challengesmenu.unlockcount[CC_UNLOCKED] + challengesmenu.unlockcount[CC_TALLY] > 0)) + && (challengesmenu.unlockcount[CC_UNLOCKED] > 0)) return false; // Marked as major? @@ -520,7 +530,9 @@ void M_ChallengesTick(void) Z_Free(challengesmenu.unlockcondition); challengesmenu.unlockcondition = M_BuildConditionSetString(challengesmenu.currentunlock); - challengesmenu.unlockcount[CC_TALLY]++; + challengesmenu.unlockcount[CC_UNLOCKED]++; + M_UpdateChallengeGridVisuals(); + challengesmenu.unlockcount[CC_ANIM]++; if (challengesmenu.extradata) @@ -582,15 +594,6 @@ void M_ChallengesTick(void) } else if (!challengesmenu.chaokeyhold) { - - // Tick down the tally. (currently not visible) - /*if ((challengesmenu.ticker & 1) - && challengesmenu.unlockcount[CC_TALLY] > 0) - { - challengesmenu.unlockcount[CC_TALLY]--; - challengesmenu.unlockcount[CC_UNLOCKED]++; - }*/ - if (challengesmenu.fade > 0) { // Fade decrease. @@ -631,10 +634,8 @@ boolean M_ChallengesInputs(INT32 ch) { gamedata->unlocked[challengesmenu.currentunlock] = gamedata->unlockpending[challengesmenu.currentunlock] = false; - if (challengesmenu.unlockcount[CC_TALLY] > 0) - challengesmenu.unlockcount[CC_TALLY]--; - else - challengesmenu.unlockcount[CC_UNLOCKED]--; + challengesmenu.unlockcount[CC_UNLOCKED]--; + M_UpdateChallengeGridVisuals(); } #endif }