From 08914cb1d7a45de3ac90c7f5db4b4a6943417750 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sat, 1 May 2021 14:54:19 +0200 Subject: [PATCH] Achievements submenu. --- FuturePlans.md | 5 + cvarinfo.txt | 74 --------- graphics/Achievements/NoAchievement.png | Bin 0 -> 371 bytes graphics/Achievements/SelectAchievement.png | Bin 0 -> 222 bytes language.def_menu | 1 + language.es_menu | 1 + language.version | 4 +- menudef.txt | 2 +- zscript.txt | 1 + .../swwm_statichandler_achievements.zsc | 1 - zscript/kbase/swwm_kbase.zsc | 6 +- zscript/menu/swwm_achievementmenu.zsc | 152 ++++++++++++++++++ zscript/swwm_thinkers_hud.zsc | 3 +- zscript/utility/swwm_utility.zsc | 3 +- 14 files changed, 169 insertions(+), 84 deletions(-) create mode 100644 graphics/Achievements/NoAchievement.png create mode 100644 graphics/Achievements/SelectAchievement.png create mode 100644 zscript/menu/swwm_achievementmenu.zsc diff --git a/FuturePlans.md b/FuturePlans.md index 5aafb517b..7a05b9069 100644 --- a/FuturePlans.md +++ b/FuturePlans.md @@ -71,6 +71,11 @@ This is just a bit of *"future planning"* for stuff that I ***might*** add after - Cyrus POW Grenades *(UnSX 4)* - Z-Bomb *(UnSX 3)* - Dr. Locke's Burrow Bombs *(SWWM Platinum Ep2 / UnSX 5)* +* **Additional ammo types:** + - Green shell - Dyratin charge *(Plasma slug)* + - Orange shell - Micro-grenade *(What it says on the tin)* + - Blue rocket - Hellblazer Torturer *(Nail bomb)* + - White rocket - Hellblazer Subjugator *(Stun bomb)* * **Expand third person animations** - 4-directional movement variants - Height-dependent headpats (current animation was designed for dogs on same floor) diff --git a/cvarinfo.txt b/cvarinfo.txt index 1aee2ac28..61282fe90 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -221,80 +221,6 @@ nosave int swwm_achievement_thruwall = 0; nosave int swwm_achievement_wantdie = 0; nosave int swwm_achievement_wave = 0; nosave int swwm_achievement_yeet = 0; -// date of completion -nosave int swwm_unlockdate_acid = 0; -nosave int swwm_unlockdate_allcoll = 0; -nosave int swwm_unlockdate_allitems = 0; -nosave int swwm_unlockdate_allkills = 0; -nosave int swwm_unlockdate_allsecrets = 0; -nosave int swwm_unlockdate_anom = 0; -nosave int swwm_unlockdate_anone = 0; -nosave int swwm_unlockdate_balls = 0; -nosave int swwm_unlockdate_barrier = 0; -nosave int swwm_unlockdate_bonk = 0; -nosave int swwm_unlockdate_bossdash = 0; -nosave int swwm_unlockdate_brake = 0; -nosave int swwm_unlockdate_bune = 0; -nosave int swwm_unlockdate_bustin = 0; -nosave int swwm_unlockdate_butts = 0; -nosave int swwm_unlockdate_cliffyb = 0; -nosave int swwm_unlockdate_clonk = 0; -nosave int swwm_unlockdate_conga = 0; -nosave int swwm_unlockdate_dab = 0; -nosave int swwm_unlockdate_dakka = 0; -nosave int swwm_unlockdate_dime = 0; -nosave int swwm_unlockdate_dosh = 0; -nosave int swwm_unlockdate_everything = 0; -nosave int swwm_unlockdate_ezkill = 0; -nosave int swwm_unlockdate_flight = 0; -nosave int swwm_unlockdate_friend = 0; -nosave int swwm_unlockdate_fuel = 0; -nosave int swwm_unlockdate_fuller = 0; -nosave int swwm_unlockdate_gcsandwich = 0; -nosave int swwm_unlockdate_gepgun = 0; -nosave int swwm_unlockdate_ghost = 0; -nosave int swwm_unlockdate_gib = 0; -nosave int swwm_unlockdate_golden = 0; -nosave int swwm_unlockdate_gravity = 0; -nosave int swwm_unlockdate_hnd = 0; -nosave int swwm_unlockdate_jump = 0; -nosave int swwm_unlockdate_lead = 0; -nosave int swwm_unlockdate_lightning = 0; -nosave int swwm_unlockdate_ligma = 0; -nosave int swwm_unlockdate_love = 0; -nosave int swwm_unlockdate_mashiro = 0; -nosave int swwm_unlockdate_mbf = 0; -nosave int swwm_unlockdate_mega = 0; -nosave int swwm_unlockdate_moth = 0; -nosave int swwm_unlockdate_nice = 0; -nosave int swwm_unlockdate_oneguy = 0; -nosave int swwm_unlockdate_onestanding = 0; -nosave int swwm_unlockdate_oopsie = 0; -nosave int swwm_unlockdate_par = 0; -nosave int swwm_unlockdate_parry = 0; -nosave int swwm_unlockdate_pene = 0; -nosave int swwm_unlockdate_plush = 0; -nosave int swwm_unlockdate_rage = 0; -nosave int swwm_unlockdate_reflect = 0; -nosave int swwm_unlockdate_refresh = 0; -nosave int swwm_unlockdate_roast = 0; -nosave int swwm_unlockdate_salt = 0; -nosave int swwm_unlockdate_sanic = 0; -nosave int swwm_unlockdate_sekiro = 0; -nosave int swwm_unlockdate_shame = 0; -nosave int swwm_unlockdate_shock = 0; -nosave int swwm_unlockdate_slayer = 0; -nosave int swwm_unlockdate_slemg = 0; -nosave int swwm_unlockdate_sneeze = 0; -nosave int swwm_unlockdate_step = 0; -nosave int swwm_unlockdate_stomp = 0; -nosave int swwm_unlockdate_sunny = 0; -nosave int swwm_unlockdate_tele = 0; -nosave int swwm_unlockdate_thicc = 0; -nosave int swwm_unlockdate_thruwall = 0; -nosave int swwm_unlockdate_wantdie = 0; -nosave int swwm_unlockdate_wave = 0; -nosave int swwm_unlockdate_yeet = 0; // cross-session progress cvars nosave int swwm_progress_acid = 0; nosave int swwm_progress_allcoll = 0; diff --git a/graphics/Achievements/NoAchievement.png b/graphics/Achievements/NoAchievement.png new file mode 100644 index 0000000000000000000000000000000000000000..e8a7a2078949356ece859eb7a78bc73f565e3b23 GIT binary patch literal 371 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4h9AWhA=@@4F(2AD^C~45DWj>fQxyD40v+x z{yS>Y>zk7#CCqW-e|_YvpYPtNd}z3R?A+a-LC53b%HRK9fB5{zl6^7x^>W)^Kdt#? zTPJV#U4FN@@oe$Us&Z`Il^>4_mqkqY_-#VoLZctQ7sQv{@;Y-pbgD?~RyX^M|3NN! z52}kVJ=UzbzH$Dd)?x?oYMl@l>lc>G@|#yY>-fcz6;!#Bm2HPMOI5*QTN&oQ-8@tO zsb>0m+%$PSHL$$o!@L#k=E0xFzYsYy#$Kh}yE5xEOWGY^ZN Zv1jW$t}=rmX96fRJzf1=);T3K0RW-yoDu*4 literal 0 HcmV?d00001 diff --git a/graphics/Achievements/SelectAchievement.png b/graphics/Achievements/SelectAchievement.png new file mode 100644 index 0000000000000000000000000000000000000000..9c9b72d464a7139233ae7f3c63d8709a47605bbc GIT binary patch literal 222 zcmeAS@N?(olHy`uVBq!ia0y~yV9*3%7G?$phA2PTqYMlTasfUet_%<`fk9*|gHi^A zh7*HUVlFQRrp)^4J*%bzSoIUw>@t(uQ{5h TTDh8w1LRImS3j3^P6 lastachievementnotify) ) { a.state.SetInt(2); - a.date.SetInt(SystemTime.Now()); EventHandler.SendNetworkEvent("swwmachievement."..a.basename,consoleplayer); let notif = new("SWWMAchievementNotification").Init(a.basename,a.icon,a.hasformat?a.maxval:0); StatusBar.AttachMessage(notif,-3478); diff --git a/zscript/kbase/swwm_kbase.zsc b/zscript/kbase/swwm_kbase.zsc index 8ca94de4f..39a1df2af 100644 --- a/zscript/kbase/swwm_kbase.zsc +++ b/zscript/kbase/swwm_kbase.zsc @@ -3106,10 +3106,10 @@ Class DemolitionistMenu : GenericMenu let a = achievements[i]; bool completed = !!a.state.GetInt(); bool hasprogress = (a.progress && a.progress.GetInt()); - Screen.DrawTexture((!completed&&!hasprogress&&obscure)?AchievementUnknown:a.icon,false,origin.x+xx+1,origin.y+yy+1,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_FillColor,(!completed&&!hasprogress&&obscure)?Color(8,8,8):Color(16,16,16)); + Screen.DrawTexture(AchievementUnknown,false,origin.x+xx+1,origin.y+yy+1,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_FillColor,(!completed&&!hasprogress&&obscure)?Color(8,8,8):Color(16,16,16)); Screen.DrawTexture((!completed&&!hasprogress&&obscure)?AchievementUnknown:a.icon,false,origin.x+xx,origin.y+yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Desaturate,(!completed)*255,DTA_ColorOverlay,completed?Color(0,0,0,0):(hasprogress||!obscure)?Color(96,0,0,0):Color(192,0,0,0)); // progress bar - if ( a.progress ) + if ( a.progress && (!obscure || hasprogress) ) { int val = a.progress.GetInt(); val = clamp(val,0,a.maxval); @@ -3119,7 +3119,7 @@ Class DemolitionistMenu : GenericMenu if ( completed ) str = String.Format("%s / %s",SWWMUtility.ThousandsNum(a.maxval),SWWMUtility.ThousandsNum(a.maxval)); else str = String.Format("%s / %s",SWWMUtility.ThousandsNum(val),SWWMUtility.ThousandsNum(a.maxval)); int ox = (barsz-MiniwiFont.StringWidth(str))/2; - Screen.DrawText(MiniwiFont,completed?Font.CR_GREEN:hasprogress?Font.CR_WHITE:Font.CR_DARKGRAY,origin.x+xx+ox,origin.y+yy+37,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(MiniwiFont,completed?Font.CR_GREEN:Font.CR_WHITE,origin.x+xx+ox,origin.y+yy+37,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } else { diff --git a/zscript/menu/swwm_achievementmenu.zsc b/zscript/menu/swwm_achievementmenu.zsc new file mode 100644 index 000000000..980cc84ce --- /dev/null +++ b/zscript/menu/swwm_achievementmenu.zsc @@ -0,0 +1,152 @@ +// dedicated achievement browser + +Class SWWMAchievementMenu : GenericMenu +{ + // since this is a unique menu, we don't need a descriptor, + // so put everything in here + TextureID AchievementUnknown, SelectBox, BaseBox; + bool ShouldObscure; + Array mItems; + String mTitle; + int mSelected; + int mBaseY; // Y position achievement boxes are being drawn at + // needed to tune mouse selection + + override void Init( Menu parent ) + { + Super.Init(parent); + mTitle = StringTable.Localize("$SWWM_ATITLE"); + mSelected = 0; + SWWMUtility.LoadAchievements(mItems,true); + ShouldObscure = (swwm_filterachievements==1); + AchievementUnknown = TexMan.CheckForTexture("graphics/Achievements/HiddenAchievement.png",TexMan.Type_Any); + SelectBox = TexMan.CheckForTexture("graphics/Achievements/SelectAchievement.png",TexMan.Type_Any); + BaseBox = TexMan.CheckForTexture("graphics/Achievements/NoAchievement.png",TexMan.Type_Any); + } + + int DrawCaption() + { + // let the delegate do all the work + let fnt = menuDelegate.PickFont(BigFont); + if ( fnt && (mTitle.Length() > 0) ) + return menuDelegate.DrawCaption(mtitle,fnt,0,true); + return 0; + } + + void DrawTooltip( int y ) + { + // detailed achievement information + let a = mItems[mSelected]; + bool completed = !!a.state.GetInt(); + bool hasprogress = (a.progress && a.progress.GetInt()); + String str = StringTable.Localize("$SWWM_ACHIEVEMENT_"..a.basename.."_TAG"); + if ( !completed && !hasprogress && ShouldObscure ) SWWMUtility.ObscureText(str,gametic/3); + int xx = (Screen.GetWidth()-newsmallfont.StringWidth(str)*CleanXFac_1)/2; + int yy = y; + if ( !a.progress || (ShouldObscure && !hasprogress) ) yy += ((newsmallfont.GetHeight()+2)*CleanYFac_1)/2; + Screen.DrawText(newsmallfont,completed?Font.CR_GREEN:Font.CR_DARKGRAY,xx,yy,str,DTA_CleanNoMove_1,true); + yy += (newsmallfont.GetHeight()+2)*CleanYFac_1; + str = a.hasformat?String.Format(StringTable.Localize("$SWWM_ACHIEVEMENT_"..a.basename.."_TXT"),a.maxval):StringTable.Localize("$SWWM_ACHIEVEMENT_"..a.basename.."_TXT"); + if ( !completed && !hasprogress && ShouldObscure ) SWWMUtility.ObscureText(str,(gametic/3)+1); + xx = (Screen.GetWidth()-newsmallfont.StringWidth(str)*CleanXFac_1)/2; + Screen.DrawText(newsmallfont,completed?Font.CR_WHITE:Font.CR_BLACK,xx,yy,str,DTA_CleanNoMove_1,true); + if ( a.progress && (!ShouldObscure || hasprogress) ) + { + yy += (newsmallfont.GetHeight()+2)*CleanYFac_1; + int val = a.progress.GetInt(); + val = clamp(val,0,a.maxval); + if ( completed ) str = String.Format("%s / %s",SWWMUtility.ThousandsNum(a.maxval),SWWMUtility.ThousandsNum(a.maxval)); + else str = String.Format("%s / %s",SWWMUtility.ThousandsNum(val),SWWMUtility.ThousandsNum(a.maxval)); + xx = (Screen.GetWidth()-newsmallfont.StringWidth(str)*CleanXFac_1)/2; + Screen.DrawText(newsmallfont,completed?Font.CR_GREEN:Font.CR_DARKGRAY,xx,yy,str,DTA_CleanNoMove_1,true); + } + } + + override bool MenuEvent( int mkey, bool fromcontroller ) + { + int prevsel = mSelected; + switch( mkey ) + { + case MKEY_Up: + if ( mSelected >= 12 ) mSelected -= 12; + break; + case MKEY_Down: + if ( mSelected < (mItems.Size()-12) ) mSelected += 12; + break; + case MKEY_Left: + if ( (mSelected%12) > 0 ) mSelected--; + break; + case MKEY_Right: + if ( ((mSelected%12) < 11) && (mSelected < mItems.Size()-1) ) mSelected++; + break; + default: + return Super.MenuEvent(mkey,fromcontroller); + } + if ( mSelected != prevsel ) MenuSound("menu/cursor"); + return true; + } + + override bool MouseEvent( int type, int mx, int my ) + { + bool res = Super.MouseEvent(type,mx,my); + if ( type == MOUSE_Click ) + { + int xx = (Screen.GetWidth()-480*CleanXFac_1)/2; + int yy = mBaseY; + for ( int i=0; i= left) && (mx < right) && (my >= top) && (my < bottom) ) + { + if ( i != mSelected ) MenuSound("menu/cursor"); + mSelected = i; + return res; + } + xx += 40*CleanXFac_1; + if ( !((i+1)%12) ) + { + xx = (Screen.GetWidth()-480*CleanXFac_1)/2; + yy += 40*CleanYFac_1; + } + } + } + return res; + } + + override void Drawer() + { + Super.Drawer(); + int y = DrawCaption()+10*CleanYFac_1; + DrawTooltip(y); + int xx = (Screen.GetWidth()-480*CleanXFac_1)/2; + int yy = y+60*CleanYFac_1; + mBaseY = yy; + int i; + for ( i=0; i