mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 17:22:12 +00:00
Prevent wraparound on Level platter when there are less than 3 rows.
Addresses #251 - I wanted to keep the scrolling because it looks nice and because I don't want to fuck with these drawers too bad.
This commit is contained in:
parent
63a7fb6956
commit
2f26cfad01
1 changed files with 48 additions and 12 deletions
60
src/m_menu.c
60
src/m_menu.c
|
@ -4895,13 +4895,25 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
INT32 selectval;
|
||||
UINT8 iter;
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_DOWNARROW:
|
||||
if (lsrow == levelselect.numrows-1)
|
||||
{
|
||||
if (levelselect.numrows < 3)
|
||||
{
|
||||
if (!lsoffs[0]) // prevent sound spam
|
||||
{
|
||||
lsoffs[0] = -8;
|
||||
S_StartSound(NULL,sfx_s3kb7);
|
||||
}
|
||||
return;
|
||||
}
|
||||
lsrow = UINT8_MAX;
|
||||
}
|
||||
lsrow++;
|
||||
if (lsrow == levelselect.numrows)
|
||||
lsrow = 0;
|
||||
|
||||
lsoffs[0] = lsvseperation(lsrow);
|
||||
|
||||
|
@ -4915,17 +4927,29 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
break;
|
||||
|
||||
case KEY_UPARROW:
|
||||
lsoffs[0] = -lsvseperation(lsrow);
|
||||
|
||||
iter = lsrow;
|
||||
if (!lsrow)
|
||||
{
|
||||
if (levelselect.numrows < 3)
|
||||
{
|
||||
if (!lsoffs[0]) // prevent sound spam
|
||||
{
|
||||
lsoffs[0] = 8;
|
||||
S_StartSound(NULL,sfx_s3kb7);
|
||||
}
|
||||
return;
|
||||
}
|
||||
lsrow = levelselect.numrows;
|
||||
}
|
||||
lsrow--;
|
||||
if (lsrow == UINT8_MAX)
|
||||
lsrow = levelselect.numrows-1;
|
||||
|
||||
lsoffs[0] = -lsvseperation(iter);
|
||||
|
||||
if (levelselect.rows[lsrow].header[0])
|
||||
lshli = lsrow;
|
||||
else
|
||||
{
|
||||
UINT8 iter = lsrow;
|
||||
iter = lsrow;
|
||||
do
|
||||
iter = ((iter == 0) ? levelselect.numrows-1 : iter-1);
|
||||
while ((iter != lsrow) && !(levelselect.rows[iter].header[0]));
|
||||
|
@ -4958,7 +4982,7 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
M_LevelSelectWarp(0);
|
||||
Nextmap_OnChange();
|
||||
}
|
||||
else if (!lsoffs[0]) // prevent sound spam
|
||||
else if (!lsoffs[0]) // prevent sound spam
|
||||
{
|
||||
lsoffs[0] = -8;
|
||||
S_StartSound(NULL,sfx_s3kb2);
|
||||
|
@ -4988,7 +5012,7 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
|
||||
ifselectvalnextmap(lscol) else ifselectvalnextmap(0)
|
||||
}
|
||||
else if (!lsoffs[1]) // prevent sound spam
|
||||
else if (!lsoffs[1]) // prevent sound spam
|
||||
{
|
||||
lsoffs[1] = 8;
|
||||
S_StartSound(NULL,sfx_s3kb7);
|
||||
|
@ -5017,7 +5041,7 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
|
||||
ifselectvalnextmap(lscol) else ifselectvalnextmap(0)
|
||||
}
|
||||
else if (!lsoffs[1]) // prevent sound spam
|
||||
else if (!lsoffs[1]) // prevent sound spam
|
||||
{
|
||||
lsoffs[1] = -8;
|
||||
S_StartSound(NULL,sfx_s3kb7);
|
||||
|
@ -5188,7 +5212,13 @@ static void M_DrawLevelPlatterMenu(void)
|
|||
// finds row at top of the screen
|
||||
while (y > -8)
|
||||
{
|
||||
iter = ((iter == 0) ? levelselect.numrows-1 : iter-1);
|
||||
if (iter == 0)
|
||||
{
|
||||
if (levelselect.numrows < 3)
|
||||
break;
|
||||
iter = levelselect.numrows;
|
||||
}
|
||||
iter--;
|
||||
y -= lsvseperation(iter);
|
||||
}
|
||||
|
||||
|
@ -5197,7 +5227,13 @@ static void M_DrawLevelPlatterMenu(void)
|
|||
{
|
||||
M_DrawLevelPlatterRow(iter, y);
|
||||
y += lsvseperation(iter);
|
||||
iter = ((iter == levelselect.numrows-1) ? 0 : iter+1);
|
||||
if (iter == levelselect.numrows-1)
|
||||
{
|
||||
if (levelselect.numrows < 3)
|
||||
break;
|
||||
iter = UINT8_MAX;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
// draw cursor box
|
||||
|
|
Loading…
Reference in a new issue