Achievements submenu.

This commit is contained in:
Mari the Deer 2021-05-01 14:54:19 +02:00
commit 08914cb1d7
14 changed files with 169 additions and 84 deletions

View file

@ -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)

View file

@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

View file

@ -182,6 +182,7 @@ SWWM_TIME_DAYS = "days";
SWWM_TIME_HOURS = "hours";
SWWM_TIME_MINUTES = "minutes";
SWWM_TIME_SECONDS = "seconds";
SWWM_ATITLE = "Achievements";
SWWM_MMTITLE = "Minimap Settings";
SWWM_MM_ENABLE = "Show Minimap";
SWWM_MM_ROTATE = "Rotate Minimap";

View file

@ -181,6 +181,7 @@ SWWM_TIME_DAYS = "días";
SWWM_TIME_HOURS = "horas";
SWWM_TIME_MINUTES = "minutos";
SWWM_TIME_SECONDS = "segundos";
SWWM_ATITLE = "Logros";
SWWM_MMTITLE = "Opciones de Minimapa";
SWWM_MM_ENABLE = "Mostrar Minimapa";
SWWM_MM_ROTATE = "Rotar Minimapa";

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r459 \cu(Thu 29 Apr 23:26:34 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r459 \cu(2021-04-29 23:26:34)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r461 \cu(Sat 1 May 14:56:02 CEST 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r461 \cu(2021-05-01 14:56:02)\c-";

View file

@ -89,7 +89,7 @@ OptionMenu "SWWMOptionMenu"
ScaleSliderFix "$SWWM_REVIVECOOLDOWN", "swwm_revivecooldown", -1, 300, 30, "$SWWM_UNLIMITED", "$SWWM_ONERETRY"
Option "$SWWM_MENUPAUSE", "swwm_menupause", "YesNo"
Option "$SWWM_PRECISECROSSHAIR", "swwm_precisecrosshair", "YesNo"
//Submenu "$SWWM_ATITLE", "SWWMAchievementMenu"
Submenu "$SWWM_ATITLE", "SWWMAchievementMenu"
StaticText " "
StaticText "$SWWM_OTITLE", "Blue"
Option "$SWWM_SHADERS", "swwm_shaders", "YesNo"

View file

@ -50,6 +50,7 @@ version "4.5"
#include "zscript/menu/swwm_inter.zsc"
#include "zscript/menu/swwm_help.zsc"
#include "zscript/menu/swwm_credits.zsc"
#include "zscript/menu/swwm_achievementmenu.zsc"
// compat code
#include "zscript/compat/swwm_compat.zsc"
#include "zscript/compat/swwm_shame.zsc"

View file

@ -27,7 +27,6 @@ extend Class SWWMStaticHandler
if ( (val == 1) && (gametic > 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);

View file

@ -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
{

View file

@ -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<SWWMAchievement> 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<mItems.Size(); i++ )
{
int left = xx+4*CleanXFac_1;
int top = yy+4*CleanXFac_1;
int right = left+32*CleanXFac_1;
int bottom = top+32*CleanXFac_1;
if ( (mx >= 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<mItems.Size(); i++ )
{
let a = mItems[i];
bool completed = !!a.state.GetInt();
bool hasprogress = (a.progress && a.progress.GetInt());
Screen.DrawTexture(BaseBox,false,xx+5*CleanXFac_1,yy+5*CleanYFac_1,DTA_CleanNoMove_1,true,DTA_FillColor,(!completed&&!hasprogress&&ShouldObscure)?Color(8,8,8):Color(16,16,16));
Screen.DrawTexture((!completed&&!hasprogress&&ShouldObscure)?AchievementUnknown:a.icon,false,xx+4*CleanXFac_1,yy+4*CleanYFac_1,DTA_CleanNoMove_1,true,DTA_Desaturate,(!completed)*255,DTA_ColorOverlay,completed?Color(0,0,0,0):(hasprogress||!ShouldObscure)?Color(96,0,0,0):Color(192,0,0,0));
if ( mSelected == i )
Screen.DrawTexture(SelectBox,false,xx,yy,DTA_CleanNoMove_1,true);
xx += 40*CleanXFac_1;
if ( !((i+1)%12) )
{
xx = (Screen.GetWidth()-480*CleanXFac_1)/2;
yy += 40*CleanYFac_1;
}
}
while ( i%12 )
{
Screen.DrawTexture(BaseBox,false,xx+5*CleanXFac_1,yy+5*CleanYFac_1,DTA_CleanNoMove_1,true,DTA_FillColor,Color(8,8,8));
Screen.DrawTexture(BaseBox,false,xx+4*CleanXFac_1,yy+4*CleanYFac_1,DTA_CleanNoMove_1,true);
xx += 40*CleanXFac_1;
i++;
}
}
}

View file

@ -297,7 +297,8 @@ Class SWWMCombatTracker : Thinker
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( !hnd ) return null;
// NOTE: These are only ever called once a thing spawns, so we don't need to "check" if entries already exist
// this check will only be performed in "update mode", i.e. when called from the swwmupdatetrackers netevent
// this check will only be performed in "update mode", i.e. when called from the swwmupdatetrackers netevent,
// or when a monster is revived
SWWMCombatTracker t;
if ( update ) for ( t=hnd.trackers; t; t=t.next )
{

View file

@ -16,7 +16,7 @@ enum EDoExplosionFlags
Class SWWMAchievement
{
String basename;
transient CVar state, progress, date;
transient CVar state, progress;
TextureID icon;
int maxval;
bool hasformat;
@ -96,7 +96,6 @@ Class SWWMUtility
ac.icon = TexMan.CheckForTexture("graphics/Achievements/Achievement"..ac.basename..".png",TexMan.Type_Any);
// fallback icon if one is not found
if ( !ac.icon.IsValid() ) ac.icon = TexMan.CheckForTexture("graphics/Achievements/DefaultAchievement.png",TexMan.Type_Any);
ac.date = CVar.FindCVar("swwm_unlockdate_"..ac.basename);
achievements.Push(ac);
}
}