- deleted a large batch of code from the menu that is no longer needed.

This commit is contained in:
Christoph Oelckers 2019-11-27 17:57:45 +01:00
parent 723b210c95
commit a4a4b230fd

View file

@ -3407,76 +3407,6 @@ static void Menu_TextFormSubmit(char *input)
} }
static void Menu_FileSelectInit(MenuFileSelect_t *object)
{
// Same crap as everywhere - it expects the user to dump all the shit in the game directory so that it gets in the way of everything.
// Needs to be redone - or removed.
if (usermapfolder)
{
}
else
{
}
#if 0
fnlist_clearnames(&object->fnlist);
if (object->destination[0] == 0)
{
BDIR * usermaps = Bopendir(object->startdir);
if (usermaps)
{
Bclosedir(usermaps);
Bstrcpy(object->destination, object->startdir);
}
else
Bstrcpy(object->destination, "./");
}
Bcorrectfilename(object->destination, 1);
fnlist_getnames(&object->fnlist, object->destination, object->pattern, 0, 0);
object->findhigh[0] = object->fnlist.finddirs;
object->findhigh[1] = object->fnlist.findfiles;
for (int i = 0; i < 2; ++i)
{
object->scrollPos[i] = 0;
klistbookends(object->findhigh[i]);
}
object->currentList = 0;
if (object->findhigh[1])
object->currentList = 1;
#endif
inputState.keyFlushChars();
}
static void Menu_FileSelect(int32_t input)
{
switch (g_currentMenu)
{
case MENU_NETUSERMAP:
if ((g_netServer || ud.multimode > 1))
Net_SendUserMapName();
fallthrough__;
case MENU_USERMAP:
if (input)
{
ud.m_volume_number = 0;
m_level_number = 7;
if (g_skillCnt > 0)
Menu_AnimateChange(MENU_SKILL, MA_Advance);
else
Menu_StartGameWithoutSkill();
}
break;
default:
break;
}
}
static void Menu_AboutToStartDisplaying(Menu_t * m) static void Menu_AboutToStartDisplaying(Menu_t * m)
@ -4435,107 +4365,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
break; break;
} }
#ifdef MENU_ENABLE_RANGEDOUBLE
case RangeDouble:
{
MenuRangeDouble_t *object = (MenuRangeDouble_t*)entry->entry;
int32_t s, p;
int32_t z = entry->font->cursorScale;
Menu_GetFmt(object->font, status|MT_RightSide, &s, &z);
if (status & MT_Disabled)
p = ud.slidebar_paldisabled;
else if (status & MT_Selected)
p = ud.slidebar_palselected;
else
p = 0;
const int32_t slidebarwidth = mulscale16(tilesiz[SLIDEBAR].x * ud.menu_slidebarz, z);
const int32_t slidebarheight = mulscale16(tilesiz[SLIDEBAR].y * ud.menu_slidebarz, z);
if (status & MT_XRight)
x -= slidebarwidth;
else
mousewidth += slidebarwidth;
const int32_t slidebarx = origin.x + x;
const int32_t slidebary = origin.y + y_upper + y + (((height - slidebarheight)>>17)<<16) - menu->scrollPos;
rotatesprite_ybounds(slidebarx, slidebary, mulscale16(ud.menu_slidebarz, z), 0, SLIDEBAR, s, p, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
const int32_t slideregionwidth = mulscale16((tilesiz[SLIDEBAR].x * ud.menu_slidebarz) - (ud.menu_slidebarmargin<<1) - (tilesiz[SLIDEBAR+1].x * ud.menu_slidecursorz), z);
const int32_t slidepointx = slidebarx + mulscale16(ud.menu_slidebarmargin, z) + lrint((double) slideregionwidth * (*object->variable - object->min) / (object->max - object->min));
const int32_t slidepointy = slidebary + mulscale16(((tilesiz[SLIDEBAR].y)>>1 * ud.menu_slidebarz) - ((tilesiz[SLIDEBAR+1].y)>>1 * ud.menu_slidecursorz), z);
rotatesprite_ybounds(slidepointx, slidepointy, mulscale16(ud.menu_slidecursorz, z), 0, SLIDEBAR+1, s, p, 2|8|16|ROTATESPRITE_FULL16, ydim_upper, ydim_lower);
if (object->flags & DisplayTypeMask)
{
status |= MT_XRight;
double onehundredpercent = object->onehundredpercent;
if (onehundredpercent == 0.)
onehundredpercent = 1.;
switch (object->flags & DisplayTypeMask)
{
case DisplayTypeInteger:
Bsprintf(tempbuf, "%.2f", *object->variable);
break;
case DisplayTypePercent:
Bsprintf(tempbuf, "%ld%%", lrint(*object->variable * 100. / onehundredpercent));
break;
case DisplayTypeNormalizedDecimal:
Bsprintf(tempbuf, "%.2f", *object->variable / onehundredpercent);
break;
}
Menu_Text(origin.x + x - (4<<16), origin.y + y_upper + y + ((height>>17)<<16) - menu->scrollPos, object->font, tempbuf, status, ydim_upper, ydim_lower);
}
if (MOUSEACTIVECONDITIONAL(state != 1 && cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, height)))
{
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, mousex, mousey, mousewidth, height)))
{
menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu);
}
if (!m_mousecaught && (inputState.mouseClickState() == MOUSE_PRESSED || inputState.mouseClickState() == MOUSE_HELD))
{
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z);
const int32_t slideregionx = slidebarx + slidepointhalfwidth;
menu->currentEntry = e;
Menu_RunInput_Menu_MovementVerify(menu);
if (entry->flags & MEF_Disabled)
break;
// region between the x-midline of the slidepoint at the extremes slides proportionally
if (!Menu_MouseOutsideBounds(&m_mousepos, slideregionx, mousey, slideregionwidth, height))
{
Menu_RunInput_EntryRangeDouble_MovementArbitrary(/*entry, */object, (object->max - object->min) * (m_mousepos.x - slideregionx) / slideregionwidth + object->min);
m_mousecaught = 1;
}
// region outside the x-midlines clamps to the extremes
else if (!Menu_MouseOutsideBounds(&m_mousepos, slidebarx, mousey, slidebarwidth, height))
{
if (m_mousepos.x > slideregionx + ((slideregionwidth>>17)<<16))
Menu_RunInput_EntryRangeDouble_MovementVerify(/*entry, */object, object->max);
else
Menu_RunInput_EntryRangeDouble_MovementVerify(/*entry, */object, object->min);
m_mousecaught = 1;
}
}
}
break;
}
#endif
case String: case String:
{ {
auto object = (MenuString_t*)entry->entry; auto object = (MenuString_t*)entry->entry;
@ -4893,130 +4723,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
break; break;
} }
case FileSelect:
{
#if 0
auto object = (MenuFileSelect_t*)cm->object;
const int32_t MenuFileSelect_scrollbar_rightedge[2] = { 160<<16, 284<<16 };
int32_t i, selected = 0;
Menu_Pre(cm->menuID);
Menu_PreDrawBackground(cm->menuID, origin);
if (object->title != NoTitle)
Menu_DrawTopBar(origin);
// black translucent background underneath file lists
Menu_BlackRectangle(origin.x + (36<<16), origin.y + (42<<16), 248<<16, 123<<16, 1|32);
// path
Bsnprintf(tempbuf, sizeof(tempbuf), "Path: %s", object->destination);
mgametext(origin.x + object->format[0]->pos.x, origin.y + (32<<16), tempbuf);
uint8_t column_status[2] = { 0, MT_RightSide };
for (i = 0; i < 2; ++i)
{
if (object->findhigh[i])
{
CACHE1D_FIND_REC *dir;
int32_t y = 0;
const int32_t y_upper = object->format[i]->pos.y;
const int32_t y_lower = klabs(object->format[i]->bottomcutoff);
int32_t totalHeight = 0;
for (dir = object->findhigh[i]->usera; dir; dir = dir->next)
{
y += object->font[i]->get_yline();
totalHeight = y;
y += object->getMarginBottom(i);
}
y = 0;
int32_t ydim_upper, ydim_lower;
if (y_upper + totalHeight > y_lower)
{
ydim_upper = ydim_from_200_16(origin.y + y_upper);
ydim_lower = ydim_from_200_16(origin.y + y_lower);
}
else
{
ydim_upper = 0;
ydim_lower = ydim-1;
}
for (dir = object->findhigh[i]->usera; dir; dir = dir->next)
{
uint8_t status = column_status[i];
if (dir == object->findhigh[i] && object->currentList == i)
status |= MT_Selected;
// pal = dir->source==CACHE1D_SOURCE_ZIP ? 8 : 2
Menu_Run_AbbreviateNameIntoBuffer(dir->name, USERMAPENTRYLENGTH);
const int32_t thisx = object->format[i]->pos.x;
const int32_t thisy = y - object->scrollPos[i];
int32_t const height = object->font[i]->get_yline();
if (0 <= thisy + height && thisy <= klabs(object->format[i]->bottomcutoff) - object->format[i]->pos.y)
{
status |= MT_YCenter;
const int32_t mousex = origin.x + thisx;
const int32_t mousey = origin.y + y_upper + thisy + ((height>>17)<<16);
vec2_t textdim = Menu_Text(mousex, mousey, object->font[i], tempbuf, status, ydim_upper, ydim_lower);
if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, textdim.x, object->font[i]->get_yline())))
{
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, mousex, mousey, textdim.x, object->font[i]->get_yline())))
{
object->findhigh[i] = dir;
object->currentList = i;
Menu_RunInput_FileSelect_MovementVerify(object);
}
if (!m_mousecaught && inputState.mouseClickState() == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->get_yline()))
{
object->findhigh[i] = dir;
object->currentList = i;
Menu_RunInput_FileSelect_MovementVerify(object);
m_mousecaught = 1;
selected = 1;
}
}
}
y += object->font[i]->get_yline() + object->getMarginBottom(i);
}
Menu_RunScrollbar(cm, object->format[i], y_upper + totalHeight, &object->scrollPos[i], MenuFileSelect_scrollbar_rightedge[i], origin);
}
}
Menu_PreDraw(cm->menuID, NULL, origin);
if (object->title != NoTitle)
Menu_DrawTopBarCaption(object->title, origin);
if (selected)
{
Menu_RunInput_FileSelect_Select(object);
S_PlaySound(PISTOL_BODYHIT);
m_mousecaught = 1;
}
#endif
break;
}
case Panel: case Panel:
{ {
@ -5409,66 +5116,6 @@ static void Menu_RunInput_EntryRangeFloat_Movement(MenuEntry_t *entry, MenuRange
Menu_RunInput_EntryRangeFloat_MovementVerify(entry, object, newValue); Menu_RunInput_EntryRangeFloat_MovementVerify(entry, object, newValue);
} }
#ifdef MENU_ENABLE_RANGEDOUBLE
static void Menu_RunInput_EntryRangeDouble_MovementVerify(/*MenuEntry_t *entry, */MenuRangeDouble_t *object, double newValue)
{
if (!Menu_EntryRangeDoubleModify(/*entry, newValue*/))
*object->variable = newValue;
}
static void Menu_RunInput_EntryRangeDouble_MovementArbitrary(/*MenuEntry_t *entry, */MenuRangeDouble_t *object, double newValue)
{
if (object->flags & EnforceIntervals)
{
double const range = object->max - object->min;
double const maxInterval = object->steps - 1;
double const newValueIndex = rint((newValue - object->min) * maxInterval / range);
newValue = newValueIndex * range / maxInterval + object->min;
}
Menu_RunInput_EntryRangeDouble_MovementVerify(/*entry, */object, newValue);
}
static void Menu_RunInput_EntryRangeDouble_Movement(/*MenuEntry_t *entry, */MenuRangeDouble_t *object, MenuMovement_t direction)
{
double const oldValue = *object->variable;
double const range = object->max - object->min;
double const maxInterval = object->steps - 1;
double const oldValueIndex = rint((oldValue - object->min) * maxInterval / range);
double const oldValueQuantized = oldValueIndex * range / maxInterval + object->min;
double newValueIndex = oldValueIndex;
switch (direction)
{
case MM_Left:
if (oldValueQuantized >= oldValue)
newValueIndex -= 1.;
if (newValueIndex >= 0.)
break;
fallthrough__;
case MM_AllTheWayLeft:
newValueIndex = 0.;
break;
case MM_Right:
if (oldValueQuantized <= oldValue)
newValueIndex += 1.;
if (newValueIndex <= maxInterval)
break;
fallthrough__;
case MM_AllTheWayRight:
newValueIndex = maxInterval;
break;
default:
break;
}
double const newValue = newValueIndex * range / maxInterval + object->min;
Menu_RunInput_EntryRangeDouble_MovementVerify(/*entry, */object, newValue);
}
#endif
static void Menu_RunInput_EntryString_Activate(MenuEntry_t *entry) static void Menu_RunInput_EntryString_Activate(MenuEntry_t *entry)
{ {
auto object = (MenuString_t*)entry->entry; auto object = (MenuString_t*)entry->entry;
@ -5509,82 +5156,16 @@ static void Menu_RunInput_EntryString_Cancel(/*MenuEntry_t *entry, */MenuString_
static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object) static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
{ {
#if 0
const int32_t listytop = object->format[object->currentList]->pos.y;
const int32_t listybottom = klabs(object->format[object->currentList]->bottomcutoff);
const int32_t ytop = listytop + object->findhigh[object->currentList]->type * (object->font[object->currentList]->get_yline() + object->getMarginBottom(object->currentList));
const int32_t ybottom = ytop + object->font[object->currentList]->get_yline();
if (ybottom - object->scrollPos[object->currentList] > listybottom)
object->scrollPos[object->currentList] = ybottom - listybottom;
else if (ytop - object->scrollPos[object->currentList] < listytop)
object->scrollPos[object->currentList] = ytop - listytop;
#endif
} }
static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMovement_t direction) static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMovement_t direction)
{ {
#if 0
switch (direction)
{
case MM_Up:
if (!object->findhigh[object->currentList])
break;
if (object->findhigh[object->currentList]->prev)
{
object->findhigh[object->currentList] = object->findhigh[object->currentList]->prev;
break;
}
fallthrough__;
case MM_End:
object->findhigh[object->currentList] = object->findhigh[object->currentList]->userb;
break;
case MM_Down:
if (!object->findhigh[object->currentList])
break;
if (object->findhigh[object->currentList]->next)
{
object->findhigh[object->currentList] = object->findhigh[object->currentList]->next;
break;
}
fallthrough__;
case MM_Home:
object->findhigh[object->currentList] = object->findhigh[object->currentList]->usera;
break;
case MM_Swap:
object->currentList = !object->currentList;
break;
default:
break;
}
Menu_RunInput_FileSelect_MovementVerify(object);
#endif
} }
static void Menu_RunInput_FileSelect_Select(MenuFileSelect_t *object) static void Menu_RunInput_FileSelect_Select(MenuFileSelect_t *object)
{ {
#if 0
if (!object->findhigh[object->currentList])
return;
Bstrcat(object->destination, object->findhigh[object->currentList]->name);
if (object->currentList == 0)
{
Bstrcat(object->destination, "/");
Bcorrectfilename(object->destination, 1);
Menu_FileSelectInit(object);
}
else
{
Menu_FileSelect(1);
}
#endif
} }
static void Menu_RunInput(Menu_t *cm) static void Menu_RunInput(Menu_t *cm)
@ -5652,150 +5233,6 @@ static void Menu_RunInput(Menu_t *cm)
case FileSelect: case FileSelect:
{ {
#if 0
auto object = (MenuFileSelect_t*)cm->object;
if (I_ReturnTrigger() || Menu_RunInput_MouseReturn())
{
I_ReturnTriggerClear();
m_mousecaught = 1;
S_PlaySound(EXITMENUSOUND);
object->destination[0] = 0;
Menu_FileSelect(0);
Menu_AnimateChange(cm->parentID, MA_Return);
}
else if (I_AdvanceTrigger())
{
I_AdvanceTriggerClear();
Menu_RunInput_FileSelect_Select(object);
S_PlaySound(PISTOL_BODYHIT);
}
else if (inputState.GetKeyStatus(sc_Home))
{
inputState.ClearKeyStatus(sc_Home);
Menu_RunInput_FileSelect_Movement(object, MM_Home);
S_PlaySound(KICK_HIT);
}
else if (inputState.GetKeyStatus(sc_End))
{
inputState.ClearKeyStatus(sc_End);
Menu_RunInput_FileSelect_Movement(object, MM_End);
S_PlaySound(KICK_HIT);
}
else if (inputState.GetKeyStatus(sc_PgUp))
{
int32_t i;
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
inputState.ClearKeyStatus(sc_PgUp);
for (i = 0; i < 6; ++i)
{
if (seeker && seeker->prev)
seeker = seeker->prev;
}
if (seeker)
{
object->findhigh[object->currentList] = seeker;
Menu_RunInput_FileSelect_MovementVerify(object);
S_PlaySound(KICK_HIT);
}
}
else if (inputState.GetKeyStatus(sc_PgDn))
{
int32_t i;
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
inputState.ClearKeyStatus(sc_PgDn);
for (i = 0; i < 6; ++i)
{
if (seeker && seeker->next)
seeker = seeker->next;
}
if (seeker)
{
object->findhigh[object->currentList] = seeker;
Menu_RunInput_FileSelect_MovementVerify(object);
S_PlaySound(KICK_HIT);
}
}
else if (I_MenuLeft() || I_MenuRight())
{
I_MenuLeftClear();
I_MenuRightClear();
if ((object->currentList ? object->fnlist.numdirs : object->fnlist.numfiles) > 0)
{
Menu_RunInput_FileSelect_Movement(object, MM_Swap);
S_PlaySound(KICK_HIT);
}
}
else if (I_MenuUp())
{
I_MenuUpClear();
Menu_RunInput_FileSelect_Movement(object, MM_Up);
S_PlaySound(KICK_HIT);
}
else if (I_MenuDown())
{
I_MenuDownClear();
Menu_RunInput_FileSelect_Movement(object, MM_Down);
S_PlaySound(KICK_HIT);
}
else
{
// JBF 20040208: seek to first name matching pressed character
char ch2, ch;
ch = inputState.keyGetChar();
if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')))
{
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList]->usera;
if (ch >= 'a')
ch -= ('a'-'A');
while (seeker)
{
ch2 = seeker->name[0];
if (ch2 >= 'a' && ch2 <= 'z')
ch2 -= ('a'-'A');
if (ch2 == ch)
break;
seeker = seeker->next;
}
if (seeker)
{
object->findhigh[object->currentList] = seeker;
Menu_RunInput_FileSelect_MovementVerify(object);
S_PlaySound(KICK_HIT);
}
}
}
#endif
Menu_PreInput(NULL); Menu_PreInput(NULL);
break; break;
} }
@ -5857,199 +5294,6 @@ static void Menu_RunInput(Menu_t *cm)
Menu_PreInput(NULL); Menu_PreInput(NULL);
break; break;
case Menu:
{
int32_t state;
auto menu = (MenuMenu_t*)cm->object;
MenuEntry_t *currentry = menu->entrylist[menu->currentEntry];
state = Menu_DetermineSpecialState(currentry);
if (state == 0)
{
if (currentry != NULL)
switch (currentry->type)
{
case Dummy:
case Spacer:
break;
case Link:
if (currentry->flags & MEF_Disabled)
break;
if (I_AdvanceTrigger())
{
I_AdvanceTriggerClear();
Menu_RunInput_EntryLink_Activate(currentry);
if (g_player[myconnectindex].ps->gm&MODE_MENU) // for skill selection
S_PlaySound(PISTOL_BODYHIT);
}
break;
case Option:
{
auto object = (MenuOption_t*)currentry->entry;
if (currentry->flags & MEF_Disabled)
break;
if (I_AdvanceTrigger())
{
I_AdvanceTriggerClear();
Menu_RunInput_EntryOption_Activate(currentry, object);
S_PlaySound(PISTOL_BODYHIT);
}
else if (I_MenuRight())
{
I_MenuRightClear();
Menu_RunInput_EntryOption_Movement(currentry, object, MM_Right);
S_PlaySound(PISTOL_BODYHIT);
}
else if (I_MenuLeft())
{
I_MenuLeftClear();
Menu_RunInput_EntryOption_Movement(currentry, object, MM_Left);
S_PlaySound(PISTOL_BODYHIT);
}
}
break;
case Custom2Col:
if (I_MenuLeft() || I_MenuRight())
{
I_MenuLeftClear();
I_MenuRightClear();
Menu_RunInput_Menu_Movement(menu, MM_Swap);
S_PlaySound(KICK_HIT);
}
if (currentry->flags & MEF_Disabled)
break;
if (I_AdvanceTrigger())
{
I_AdvanceTriggerClear();
Menu_RunInput_EntryCustom2Col_Activate(currentry);
S_PlaySound(PISTOL_BODYHIT);
}
break;
case RangeInt32:
{
auto object = (MenuRangeInt32_t*)currentry->entry;
if (currentry->flags & MEF_Disabled)
break;
if (I_SliderLeft())
{
I_SliderLeftClear();
Menu_RunInput_EntryRangeInt32_Movement(currentry, object, MM_Left);
S_PlaySound(KICK_HIT);
}
else if (I_SliderRight())
{
I_SliderRightClear();
Menu_RunInput_EntryRangeInt32_Movement(currentry, object, MM_Right);
S_PlaySound(KICK_HIT);
}
break;
}
case RangeFloat:
{
auto object = (MenuRangeFloat_t*)currentry->entry;
if (currentry->flags & MEF_Disabled)
break;
if (I_SliderLeft())
{
I_SliderLeftClear();
Menu_RunInput_EntryRangeFloat_Movement(currentry, object, MM_Left);
S_PlaySound(KICK_HIT);
}
else if (I_SliderRight())
{
I_SliderRightClear();
Menu_RunInput_EntryRangeFloat_Movement(currentry, object, MM_Right);
S_PlaySound(KICK_HIT);
}
break;
}
#ifdef MENU_ENABLE_RANGEDOUBLE
case RangeDouble:
{
MenuRangeDouble_t *object = (MenuRangeDouble_t*)currentry->entry;
if (currentry->flags & MEF_Disabled)
break;
if (I_SliderLeft())
{
I_SliderLeftClear();
Menu_RunInput_EntryRangeDouble_Movement(/*currentry, */object, MM_Left);
S_PlaySound(KICK_HIT);
}
else if (I_SliderRight())
{
I_SliderRightClear();
Menu_RunInput_EntryRangeDouble_Movement(/*currentry, */object, MM_Right);
S_PlaySound(KICK_HIT);
}
break;
}
#endif
case String:
{
if (currentry->flags & MEF_Disabled)
break;
if (I_AdvanceTrigger())
{
I_AdvanceTriggerClear();
Menu_RunInput_EntryString_Activate(currentry);
S_PlaySound(PISTOL_BODYHIT);
}
break;
}
}
if (I_ReturnTrigger() || I_EscapeTrigger() || Menu_RunInput_MouseReturn())
{
I_ReturnTriggerClear();
I_EscapeTriggerClear();
m_mousecaught = 1;
if (cm->parentID != MENU_CLOSE || (g_player[myconnectindex].ps->gm & MODE_GAME))
S_PlaySound(EXITMENUSOUND);
Menu_AnimateChange(cm->parentID, cm->parentAnimation);
}
else if (inputState.GetKeyStatus(sc_Home)) else if (inputState.GetKeyStatus(sc_Home))
{ {
inputState.ClearKeyStatus(sc_Home); inputState.ClearKeyStatus(sc_Home);
@ -6239,38 +5483,7 @@ void M_DisplayMenus(void)
origin.y = ud.returnvar[1]; origin.y = ud.returnvar[1];
} }
// Determine animation values.
if (totalclock < m_animation.start + m_animation.length)
{
const int32_t screenwidth = scale(240<<16, xdim, ydim);
origin.x = mulscale15(screenwidth, m_animation.in(&m_animation));
previousOrigin.x = mulscale15(screenwidth, m_animation.out(&m_animation));
ud.returnvar[0] = previousOrigin.x;
ud.returnvar[1] = previousOrigin.y;
if (m_animation.previous->type == Menu)
{
ud.returnvar[2] = ((MenuMenu_t *)m_animation.previous->object)->currentEntry;
if (m_animation.previous->menuID == MENU_NEWGAMECUSTOMSUB)
ud.returnvar[3] = M_NEWGAMECUSTOM.currentEntry;
}
VM_OnEventWithReturn(EVENT_DISPLAYINACTIVEMENU, g_player[screenpeek].ps->i, screenpeek, m_animation.previous->menuID);
previousOrigin.x = ud.returnvar[0];
previousOrigin.y = ud.returnvar[1];
}
ud.returnvar[0] = origin.x;
ud.returnvar[1] = origin.y;
if (m_currentMenu->type == Menu)
{
ud.returnvar[2] = ((MenuMenu_t *)m_currentMenu->object)->currentEntry;
if (g_currentMenu == MENU_NEWGAMECUSTOMSUB)
ud.returnvar[3] = M_NEWGAMECUSTOM.currentEntry;
}
VM_OnEventWithReturn(EVENT_DISPLAYMENU, g_player[screenpeek].ps->i, screenpeek, g_currentMenu);
origin.x = ud.returnvar[0];
origin.y = ud.returnvar[1];
if (m_parentMenu && backgroundOK) if (m_parentMenu && backgroundOK)
{ {
@ -6308,46 +5521,6 @@ void M_DisplayMenus(void)
VM_OnEventWithReturn(EVENT_DISPLAYINACTIVEMENUREST, g_player[screenpeek].ps->i, screenpeek, m_parentMenu->menuID); VM_OnEventWithReturn(EVENT_DISPLAYINACTIVEMENUREST, g_player[screenpeek].ps->i, screenpeek, m_parentMenu->menuID);
} }
if (totalclock < m_animation.start + m_animation.length)
{
ud.returnvar[0] = previousOrigin.x;
ud.returnvar[1] = previousOrigin.y;
if (m_animation.previous->type == Menu)
{
ud.returnvar[2] = ((MenuMenu_t *)m_animation.previous->object)->currentEntry;
if (m_animation.previous->menuID == MENU_NEWGAMECUSTOMSUB)
ud.returnvar[3] = M_NEWGAMECUSTOM.currentEntry;
}
VM_OnEventWithReturn(EVENT_DISPLAYINACTIVEMENUREST, g_player[screenpeek].ps->i, screenpeek, m_animation.previous->menuID);
}
ud.returnvar[0] = origin.x;
ud.returnvar[1] = origin.y;
if (m_currentMenu->type == Menu)
{
ud.returnvar[2] = ((MenuMenu_t *)m_currentMenu->object)->currentEntry;
if (g_currentMenu == MENU_NEWGAMECUSTOMSUB)
ud.returnvar[3] = M_NEWGAMECUSTOM.currentEntry;
}
VM_OnEventWithReturn(EVENT_DISPLAYMENUREST, g_player[screenpeek].ps->i, screenpeek, g_currentMenu);
if (GUICapture & 2)
{
ImGui_Begin_Frame();
bool b = true;
videoFadeToBlack(1);
#if 0
ImGui::ShowDemoWindow(&b);
if (!b)
#else
if (!ShowOptionMenu())
#endif
{
GUICapture &= ~2;
GUICapture |= 4;
}
return;
}
#if !defined EDUKE32_TOUCH_DEVICES #if !defined EDUKE32_TOUCH_DEVICES