Merge branch 'extra-emblem-display' into 'next'
Extra emblem hint display See merge request STJr/SRB2!721
This commit is contained in:
commit
8e4cb953c8
149
src/m_menu.c
149
src/m_menu.c
|
@ -231,6 +231,8 @@ static void M_Credits(INT32 choice);
|
||||||
static void M_SoundTest(INT32 choice);
|
static void M_SoundTest(INT32 choice);
|
||||||
static void M_PandorasBox(INT32 choice);
|
static void M_PandorasBox(INT32 choice);
|
||||||
static void M_EmblemHints(INT32 choice);
|
static void M_EmblemHints(INT32 choice);
|
||||||
|
static void M_HandleEmblemHints(INT32 choice);
|
||||||
|
UINT32 hintpage = 1;
|
||||||
static void M_HandleChecklist(INT32 choice);
|
static void M_HandleChecklist(INT32 choice);
|
||||||
menu_t SR_MainDef, SR_UnlockChecklistDef;
|
menu_t SR_MainDef, SR_UnlockChecklistDef;
|
||||||
|
|
||||||
|
@ -727,8 +729,9 @@ static menuitem_t SR_SoundTestMenu[] =
|
||||||
|
|
||||||
static menuitem_t SR_EmblemHintMenu[] =
|
static menuitem_t SR_EmblemHintMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING|IT_CVAR, NULL, "Emblem Radar", &cv_itemfinder, 10},
|
{IT_STRING | IT_ARROWS, NULL, "Page", M_HandleEmblemHints, 10},
|
||||||
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SPauseDef, 20}
|
{IT_STRING|IT_CVAR, NULL, "Emblem Radar", &cv_itemfinder, 20},
|
||||||
|
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SPauseDef, 30}
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
|
@ -7234,18 +7237,33 @@ finishchecklist:
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NUMHINTS 5
|
#define NUMHINTS 5
|
||||||
|
|
||||||
static void M_EmblemHints(INT32 choice)
|
static void M_EmblemHints(INT32 choice)
|
||||||
{
|
{
|
||||||
|
INT32 i;
|
||||||
|
UINT32 local = 0;
|
||||||
|
emblem_t *emblem;
|
||||||
|
for (i = 0; i < numemblems; i++)
|
||||||
|
{
|
||||||
|
emblem = &emblemlocations[i];
|
||||||
|
if (emblem->level != gamemap || emblem->type > ET_SKIN)
|
||||||
|
continue;
|
||||||
|
if (++local > NUMHINTS*2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
(void)choice;
|
(void)choice;
|
||||||
SR_EmblemHintMenu[0].status = (M_SecretUnlocked(SECRET_ITEMFINDER)) ? (IT_CVAR|IT_STRING) : (IT_SECRET);
|
SR_EmblemHintMenu[0].status = (local > NUMHINTS*2) ? (IT_STRING | IT_ARROWS) : (IT_DISABLED);
|
||||||
|
SR_EmblemHintMenu[1].status = (M_SecretUnlocked(SECRET_ITEMFINDER)) ? (IT_CVAR|IT_STRING) : (IT_SECRET);
|
||||||
|
hintpage = 1;
|
||||||
M_SetupNextMenu(&SR_EmblemHintDef);
|
M_SetupNextMenu(&SR_EmblemHintDef);
|
||||||
itemOn = 1; // always start on back.
|
itemOn = 2; // always start on back.
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_DrawEmblemHints(void)
|
static void M_DrawEmblemHints(void)
|
||||||
{
|
{
|
||||||
INT32 i, j = 0, x, y, left_hints = NUMHINTS;
|
INT32 i, j = 0, x, y, left_hints = NUMHINTS, pageflag = 0;
|
||||||
UINT32 collected = 0, local = 0;
|
UINT32 collected = 0, totalemblems = 0, local = 0;
|
||||||
emblem_t *emblem;
|
emblem_t *emblem;
|
||||||
const char *hint;
|
const char *hint;
|
||||||
|
|
||||||
|
@ -7254,17 +7272,34 @@ static void M_DrawEmblemHints(void)
|
||||||
emblem = &emblemlocations[i];
|
emblem = &emblemlocations[i];
|
||||||
if (emblem->level != gamemap || emblem->type > ET_SKIN)
|
if (emblem->level != gamemap || emblem->type > ET_SKIN)
|
||||||
continue;
|
continue;
|
||||||
if (++local >= NUMHINTS*2)
|
|
||||||
break;
|
local++;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = (local > NUMHINTS ? 4 : 12);
|
x = (local > NUMHINTS ? 4 : 12);
|
||||||
y = 8;
|
y = 8;
|
||||||
|
|
||||||
// If there are more than 1 page's but less than 2 pages' worth of emblems,
|
if (local > NUMHINTS){
|
||||||
|
if (local > ((hintpage-1)*NUMHINTS*2) && local < ((hintpage)*NUMHINTS*2)){
|
||||||
|
if (NUMHINTS % 2 == 1)
|
||||||
|
left_hints = (local - ((hintpage-1)*NUMHINTS*2) + 1) / 2;
|
||||||
|
else
|
||||||
|
left_hints = (local - ((hintpage-1)*NUMHINTS*2)) / 2;
|
||||||
|
}else{
|
||||||
|
left_hints = NUMHINTS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (local > NUMHINTS*2){
|
||||||
|
if (itemOn == 0){
|
||||||
|
pageflag = V_YELLOWMAP;
|
||||||
|
}
|
||||||
|
V_DrawString(currentMenu->x + 40, currentMenu->y + 10, pageflag, va("%d of %d",hintpage, local/(NUMHINTS*2) + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are more than 1 page's but less than 2 pages' worth of emblems on the last possible page,
|
||||||
// put half (rounded up) of the hints on the left, and half (rounded down) on the right
|
// put half (rounded up) of the hints on the left, and half (rounded down) on the right
|
||||||
if (local > NUMHINTS && local < (NUMHINTS*2)-1)
|
|
||||||
left_hints = (local + 1) / 2;
|
|
||||||
|
|
||||||
if (!local)
|
if (!local)
|
||||||
V_DrawCenteredString(160, 48, V_YELLOWMAP, "No hidden emblems on this map.");
|
V_DrawCenteredString(160, 48, V_YELLOWMAP, "No hidden emblems on this map.");
|
||||||
|
@ -7274,42 +7309,80 @@ static void M_DrawEmblemHints(void)
|
||||||
if (emblem->level != gamemap || emblem->type > ET_SKIN)
|
if (emblem->level != gamemap || emblem->type > ET_SKIN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (emblem->collected)
|
totalemblems++;
|
||||||
{
|
|
||||||
collected = V_GREENMAP;
|
|
||||||
V_DrawMappedPatch(x, y+4, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH),
|
|
||||||
R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
collected = 0;
|
|
||||||
V_DrawScaledPatch(x, y+4, 0, W_CachePatchName("NEEDIT", PU_PATCH));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emblem->hint[0])
|
if (totalemblems >= ((hintpage-1)*(NUMHINTS*2) + 1) && totalemblems < (hintpage*NUMHINTS*2)+1){
|
||||||
hint = emblem->hint;
|
|
||||||
else
|
|
||||||
hint = M_GetText("No hint available for this emblem.");
|
|
||||||
hint = V_WordWrap(40, BASEVIDWIDTH-12, 0, hint);
|
|
||||||
if (local > NUMHINTS)
|
|
||||||
V_DrawThinString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint);
|
|
||||||
else
|
|
||||||
V_DrawString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint);
|
|
||||||
|
|
||||||
y += 28;
|
if (emblem->collected)
|
||||||
|
{
|
||||||
|
collected = V_GREENMAP;
|
||||||
|
V_DrawMappedPatch(x, y+4, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH),
|
||||||
|
R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
collected = 0;
|
||||||
|
V_DrawScaledPatch(x, y+4, 0, W_CachePatchName("NEEDIT", PU_PATCH));
|
||||||
|
}
|
||||||
|
|
||||||
if (++j == left_hints)
|
if (emblem->hint[0])
|
||||||
{
|
hint = emblem->hint;
|
||||||
x = 4+(BASEVIDWIDTH/2);
|
else
|
||||||
y = 8;
|
hint = M_GetText("No hint available for this emblem.");
|
||||||
|
hint = V_WordWrap(40, BASEVIDWIDTH-12, 0, hint);
|
||||||
|
//always draw tiny if we have more than NUMHINTS*2, visually more appealing
|
||||||
|
if (local > NUMHINTS)
|
||||||
|
V_DrawThinString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint);
|
||||||
|
else
|
||||||
|
V_DrawString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint);
|
||||||
|
|
||||||
|
y += 28;
|
||||||
|
|
||||||
|
// If there are more than 1 page's but less than 2 pages' worth of emblems on the last possible page,
|
||||||
|
// put half (rounded up) of the hints on the left, and half (rounded down) on the right
|
||||||
|
|
||||||
|
if (++j == left_hints)
|
||||||
|
{
|
||||||
|
x = 4+(BASEVIDWIDTH/2);
|
||||||
|
y = 8;
|
||||||
|
}
|
||||||
|
else if (j >= NUMHINTS*2)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (j >= NUMHINTS*2)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
M_DrawGenericMenu();
|
M_DrawGenericMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void M_HandleEmblemHints(INT32 choice)
|
||||||
|
{
|
||||||
|
INT32 i;
|
||||||
|
emblem_t *emblem;
|
||||||
|
UINT32 stageemblems = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < numemblems; i++)
|
||||||
|
{
|
||||||
|
emblem = &emblemlocations[i];
|
||||||
|
if (emblem->level != gamemap || emblem->type > ET_SKIN)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
stageemblems++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (choice == 0){
|
||||||
|
if (hintpage > 1){
|
||||||
|
hintpage--;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (hintpage < ((stageemblems-1)/(NUMHINTS*2) + 1)){
|
||||||
|
hintpage++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*static void M_DrawSkyRoom(void)
|
/*static void M_DrawSkyRoom(void)
|
||||||
{
|
{
|
||||||
INT32 i, y = 0;
|
INT32 i, y = 0;
|
||||||
|
|
Loading…
Reference in New Issue