// a game inside a game? Class DemolitionistGameTab : DemolitionistMenuTab { MadcatGame game; Array > gamelist; int sel; override DemolitionistMenuTab Init( DemolitionistMenu master ) { title = StringTable.Localize("$SWWM_GAMETAB"); for ( int i=0; i)(AllClasses[i])); } bDirectInput = true; return Super.Init(master); } override void OnDestroy() { Super.OnDestroy(); if ( game ) game.Destroy(); } override void OnSelect() { sel = master.shnd.menustate.At("LastGame").ToInt(); // auto-add lore for kris let lore = SWWMLoreLibrary.Find(players[consoleplayer]); bool found = false; for ( int i=0; i 0 ) { sel--; master.MenuSound("menu/demoscroll"); } break; case MK_UP: if ( sel < gamelist.Size()-1 ) { sel++; master.MenuSound("menu/demoscroll"); } break; case MK_ENTER: master.MenuSound("menu/demosel"); game = MadcatGame(new(gamelist[sel])); game.Init(); break; } } override void MouseInput( Vector2 pos, int btn ) { if ( game ) return; if ( btn != MB_LEFT ) return; String str; double xx, yy; yy = int(master.ws.y-14*gamelist.Size())/2; for ( int i=0; i yy+h ) continue; sel = i; MenuInput(MK_ENTER); break; } } override bool DirectInput( UIEvent ev ) { if ( !game ) return false; return game.ProcessInput(ev.keychar,ev.type==UIEvent.Type_KeyUp); } override void Ticker() { if ( game ) game.Tick(); } override void Drawer( double fractic ) { if ( game ) { // calculate res to fit double scl = max(floor(((master.ws.y-120)*master.hs)/240.),1.); Vector2 res = ((384,240)*scl)/master.hs; String str = StringTable.Localize("$SWWM_GAMETITLE_"..game.GetClassName()); double xx = int(master.ws.x-master.mSmallFont.StringWidth(str))/2; double yy = int(master.ws.y-res.y)/2; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy-32,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); int cw = int(ceil((master.mSmallFont.StringWidth(str)+8)/6.))*6; xx = int(master.ws.x-cw)/2; for ( int i=0; i=4)?0x2727:0x2726,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); Screen.DrawChar(master.mSmallFont,Font.CR_GREEN,master.origin.x+xx+w+6,master.origin.y+yy,((Menu.MenuTime()&8)>=4)?0x2727:0x2726,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } yy += 14; } } } }