mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- image scroller is working again.
This commit is contained in:
parent
6ba06f5ed0
commit
19c719db4e
4 changed files with 26 additions and 3 deletions
|
@ -550,6 +550,21 @@ void M_SetMenu(FName menu, int param)
|
|||
}
|
||||
M_ActivateMenu(newmenu);
|
||||
}
|
||||
else if ((*desc)->IsKindOf(RUNTIME_CLASS(DImageScrollerDescriptor)))
|
||||
{
|
||||
auto ld = static_cast<DImageScrollerDescriptor*>(*desc);
|
||||
PClass* cls = ld->mClass;
|
||||
if (cls == nullptr) cls = DefaultOptionMenuClass;
|
||||
if (cls == nullptr) cls = PClass::FindClass("ImageScrollerMenu");
|
||||
|
||||
DMenu* newmenu = (DMenu*)cls->CreateNew();
|
||||
IFVIRTUALPTRNAME(newmenu, "ImageScrollerMenu", Init)
|
||||
{
|
||||
VMValue params[3] = { newmenu, CurrentMenu, ld };
|
||||
VMCall(func, params, 3, nullptr, 0);
|
||||
}
|
||||
M_ActivateMenu(newmenu);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1249,6 +1249,7 @@ static void ParseImageScroller(FScanner& sc)
|
|||
|
||||
DImageScrollerDescriptor* desc = Create<DImageScrollerDescriptor>();
|
||||
|
||||
desc->mMenuName = sc.String;
|
||||
desc->textBackground.SetInvalid();
|
||||
desc->textBackgroundBrightness = 0xffffffff;
|
||||
desc->textFont = SmallFont;
|
||||
|
|
|
@ -648,6 +648,7 @@ void MainLoop ()
|
|||
Printf (PRINT_BOLD, "\n%s\n", error.GetMessage());
|
||||
}
|
||||
gi->ErrorCleanup();
|
||||
M_ClearMenus();
|
||||
C_FullConsole();
|
||||
gameaction = ga_nothing;
|
||||
}
|
||||
|
@ -656,6 +657,8 @@ void MainLoop ()
|
|||
error.MaybePrintMessage();
|
||||
Printf("%s", error.stacktrace.GetChars());
|
||||
gi->ErrorCleanup();
|
||||
twod->SetOffset(DVector2(0, 0));
|
||||
M_ClearMenus();
|
||||
C_FullConsole();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,12 +154,14 @@ class ImageScrollerMenu : Menu
|
|||
current = to;
|
||||
}
|
||||
|
||||
void Init(Menu parent, ImageScrollerDescriptor desc)
|
||||
virtual void Init(Menu parent, ImageScrollerDescriptor desc)
|
||||
{
|
||||
mParentMenu = parent;
|
||||
index = 0;
|
||||
mDesc = desc;
|
||||
AnimatedTransition = desc.mAnimatedTransition;
|
||||
current = mDesc.mItems[0];
|
||||
previous = null;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -240,9 +242,9 @@ class ImageScrollerMenu : Menu
|
|||
double factor = screen.GetWidth()/2;
|
||||
double phase = (now - start) / length * 180. + 90.;
|
||||
|
||||
screen.SetOffset(0, factor * dir * (sin(phase) - 1.));
|
||||
screen.SetOffset(factor * dir * (sin(phase) - 1.), 0);
|
||||
previous.Drawer(false);
|
||||
screen.SetOffset(0, factor * dir * (sin(phase) + 1.));
|
||||
screen.SetOffset(factor * dir * (sin(phase) + 1.), 0);
|
||||
current.Drawer(false);
|
||||
screen.SetOffset(0, 0);
|
||||
return true;
|
||||
|
@ -261,9 +263,11 @@ class ImageScrollerMenu : Menu
|
|||
{
|
||||
if (previous != null)
|
||||
{
|
||||
Animated = true;
|
||||
if (DrawTransition()) return;
|
||||
previous = null;
|
||||
}
|
||||
current.Drawer(false);
|
||||
Animated = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue