From 7f16c9fe5a80696fe024121cabe27d13c28195c1 Mon Sep 17 00:00:00 2001 From: its your bedtime <23366927+itsyourbedtime@users.noreply.github.com> Date: Wed, 2 Jun 2021 14:47:05 +0300 Subject: [PATCH] [FL-1388] Passport portraits (#506) * new passport pics, 3 stages with 3 moods each * removed magic const --- applications/dolphin/passport/passport.c | 25 +++++++++++++++--- assets/icons/Passport/passport_bad1_43x45.png | Bin 0 -> 1121 bytes assets/icons/Passport/passport_bad2_43x45.png | Bin 0 -> 1152 bytes assets/icons/Passport/passport_bad3_43x45.png | Bin 0 -> 1165 bytes .../icons/Passport/passport_happy1_43x45.png | Bin 0 -> 1163 bytes .../icons/Passport/passport_happy2_43x45.png | Bin 0 -> 1197 bytes .../icons/Passport/passport_happy3_43x45.png | Bin 0 -> 1210 bytes .../icons/Passport/passport_okay1_43x45.png | Bin 0 -> 1105 bytes .../icons/Passport/passport_okay2_43x45.png | Bin 0 -> 1140 bytes .../icons/Passport/passport_okay3_43x45.png | Bin 0 -> 1181 bytes 10 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 assets/icons/Passport/passport_bad1_43x45.png create mode 100644 assets/icons/Passport/passport_bad2_43x45.png create mode 100644 assets/icons/Passport/passport_bad3_43x45.png create mode 100644 assets/icons/Passport/passport_happy1_43x45.png create mode 100644 assets/icons/Passport/passport_happy2_43x45.png create mode 100644 assets/icons/Passport/passport_happy3_43x45.png create mode 100644 assets/icons/Passport/passport_okay1_43x45.png create mode 100644 assets/icons/Passport/passport_okay2_43x45.png create mode 100644 assets/icons/Passport/passport_okay3_43x45.png diff --git a/applications/dolphin/passport/passport.c b/applications/dolphin/passport/passport.c index caa4c102..c037d93f 100644 --- a/applications/dolphin/passport/passport.c +++ b/applications/dolphin/passport/passport.c @@ -3,6 +3,10 @@ #include #include "dolphin/dolphin.h" #include "dolphin/dolphin_state.h" +#include "math.h" + +#define MOODS_TOTAL 3 +#define BUTTHURT_MAX 3 typedef enum { EventTypeTick, @@ -17,7 +21,21 @@ typedef struct { } AppEvent; // Moods, corresponding to butthurt level. (temp, unclear about max level) -static const char* mood_strings[5] = {[0] = "Normal", [1] = "Ok", [2] = "Sad", [3] = "Angry"}; +static const char* mood_strings[MOODS_TOTAL] = {[0] = "Happy", [1] = "Ok", [2] = "Bad"}; + +static const IconName portrait_happy[BUTTHURT_MAX] = { + I_passport_happy1_43x45, + I_passport_happy2_43x45, + I_passport_happy3_43x45}; +static const IconName portrait_ok[BUTTHURT_MAX] = { + I_passport_okay1_43x45, + I_passport_okay2_43x45, + I_passport_okay3_43x45}; +static const IconName portrait_bad[BUTTHURT_MAX] = { + I_passport_bad1_43x45, + I_passport_bad2_43x45, + I_passport_bad3_43x45}; +static const IconName* portraits[MOODS_TOTAL] = {portrait_happy, portrait_ok, portrait_bad}; static void input_callback(InputEvent* input_event, void* ctx) { osMessageQueueId_t event_queue = ctx; @@ -33,11 +51,12 @@ static void render_callback(Canvas* canvas, void* ctx) { char level[20]; char mood[32]; - uint32_t butthurt = dolphin_state_get_butthurt(state); + uint32_t butthurt = CLAMP(dolphin_state_get_butthurt(state), BUTTHURT_MAX - 1, 0); uint32_t current_level = dolphin_state_get_level(state); uint32_t prev_cap = dolphin_state_xp_to_levelup(state, current_level - 1, false); uint32_t exp = (dolphin_state_xp_to_levelup(state, current_level, true) * 63) / (dolphin_state_xp_to_levelup(state, current_level, false) - prev_cap); + uint8_t portrait_level = CLAMP(floor(current_level / 14), MOODS_TOTAL - 1, 0); canvas_clear(canvas); @@ -56,7 +75,7 @@ static void render_callback(Canvas* canvas, void* ctx) { canvas_draw_line(canvas, 53, 5, 55, 7); // portrait - canvas_draw_icon_name(canvas, 14, 11, I_DolphinOkay_41x43); + canvas_draw_icon_name(canvas, 10, 9, portraits[butthurt][portrait_level]); canvas_draw_line(canvas, 59, 18, 124, 18); canvas_draw_line(canvas, 59, 31, 124, 31); canvas_draw_line(canvas, 59, 44, 124, 44); diff --git a/assets/icons/Passport/passport_bad1_43x45.png b/assets/icons/Passport/pass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w^o8k2h7g3epEGXyXdk_`nTU<@&>5ImEL9U2``y z5-zgn`J5%QdMu4q^%l5B^;kkxxf}_G^E>-drz=-ve0+0paLHkD^r21W-6exPb$fJ% zd=y`%w`bM4xjAC)n7FZrYy>_zi0G(U~IU*-xAJWP|Iibt(m=d zAO3pm$cihQB7xix_lg^zYPoVpdfL5lOPwl%$rDG<9UOW3Wc1s*@@59@k4@$;yKi^K zzj(y%SY=M6Pd?jycv8U}fi7AzZCsS=07?@QuLn2Bde0{8v^K0UTq__OB&@Hb09I0xZL0)vRD^GUf^&XRs)CuGfo`&aftiB2rCv&6 zQetval8%CrfsvuUfr-AMiLQZxm9eFjiHQOfC;_c2N=dT{a&d!N2ISc)Wt5Z@Sn2DR zmzV368|&p4rRy77T3YHG80i}s=>k>g7FXt#Bv$C=6)VF`a7isrF3Kz@$;{7F0GXJW zlwVq6s|0i^#1FXzaAWg|q2UA!G5w0f0)0b01CXC!3VnU?E6vS?t1d1HN=3LAtHH$~ zl?AE#L8-<0rA5iWm`hUzSyf==T$Gwvl3x^(pPvH@#(<3clKkR~`~n3dBRvxZjquF8 zl>G8yO|S-EUn|eN;*!L?5YP8Mzk2F?a1 zrmhywmX0ni#xT7u`N^fZsd*(Zy(tL2#yItY5<_kQ&}Ns^qRg_?6t|-MTm`V7tuk@D z#Q>*yP`xR*-C~GSuRhQ*`k|Jz9x%NZ0TcFbg9*04Ou-i5 z6XN>+|9>De^w8xxAobSM#WAGf)|#n~VuuwtTz-DvUn0)Sniz09d~@b2{s$V1ZyI$Z z{@%zCGkIID&+oh?f%-MUT1Hw{tg9NL#iVbt8DBXO73~ug@yBsAB1?3x@MV`7d$FHA8dj72^JdwRQU)fmX=-O}?b}x;$cIaOWpn#s@wxTO{Q7t% a9)@0C#?lLJFS>yqXYh3Ob6Mw<&;$S%!isDF literal 0 HcmV?d00001 diff --git a/assets/icons/Passport/passport_happy1_43x45.png b/assets/icons/Passport/passport_happy1_43x45.png new file mode 100644 index 0000000000000000000000000000000000000000..9f02523fc89306d1d4fec82c321a9fdc629baa1d GIT binary patch literal 1163 zcmeAS@N?(olHy`uVBq!ia0vp^+CZ$!!3-oBZY8}3l9DB^5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?@QuLn2Bde0{8v^K0UTq__OB&@Hb09I0xZL0)vRD^GUf^&XRs)CuGfo`&aftiB2rCv&6 zQetval8%CrfsvuUfr-AMiLQZxm9eFjiHQOfC;_c2N=dT{a&d!N2ISc)Wt5Z@Sn2DR zmzV368|&p4rRy77T3YHG80i}s=>k>g7FXt#Bv$C=6)VF`a7isrF3Kz@$;{7F0GXJW zlwVq6s|0i^#1FXzaAWg|q2UA!G5w0f0)0b01CXC!3VnU?E6vS?t1d1HN=3LAtHH$~ zl?AE#L8-<0rA5iWm`hUzSyf==T$Gwvl3x^(pPvH@#(<3clKkR~`~n3dBRvxZjquF8 zl>G8yO|S-EUn|eN;*!L?*yP`xR*-C~GSuRhQ*`k|Jz9x%NZ0TXumoa05nOu-i5 z6XN>+|9>De^w8xxAobeQ#WAGf)|9D%e9Vd*E|uT+mt0=Ej)OVM-mJG$R#3tux_j%I zSnCUyp8Stnd^B!nZ&&}jE%Fwbv!Zoe{d7J~;4XPK$Jo+d^FxjgbHV literal 0 HcmV?d00001 diff --git a/assets/icons/Passport/passport_happy2_43x45.png b/assets/icons/Passport/passport_happy2_43x45.png new file mode 100644 index 0000000000000000000000000000000000000000..28ea8d956a736f1883cf7760900de33ac06c7e05 GIT binary patch literal 1197 zcmeAS@N?(olHy`uVBq!ia0vp^+CZ$!!3-oBZY8}3l9DB^5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?@QuLn2Bde0{8v^K0UTq__OB&@Hb09I0xZL0)vRD^GUf^&XRs)CuGfo`&aftiB2rCv&6 zQetval8%CrfsvuUfr-AMiLQZxm9eFjiHQOfC;_c2N=dT{a&d!N2ISc)Wt5Z@Sn2DR zmzV368|&p4rRy77T3YHG80i}s=>k>g7FXt#Bv$C=6)VF`a7isrF3Kz@$;{7F0GXJW zlwVq6s|0i^#1FXzaAWg|q2UA!G5w0f0)0b01CXC!3VnU?E6vS?t1d1HN=3LAtHH$~ zl?AE#L8-<0rA5iWm`hUzSyf==T$Gwvl3x^(pPvH@#(<3clKkR~`~n3dBRvxZjquF8 zl>G8yO|S-EUn|eN;*!L?S#7KVndPL>uXP8OC< zhK9zLMh0f4rZBxO`N^fZsd*(Zy(tL2&N%gg5<_kQ&}Ns^qRg_?6t|-MTm`V7tuk@D z#S*7^P`xR*-QtK-uRhQ*`k|Jz9x%NZ0TZ_QasKtdOu-i5 z6XN>+|9>De^w8xx1_nl6PZ!6Kid%E0M)w_2;9-gVzWCxyfa0 z={HI>3YM<)R+pPw^Usj=KvaQ*nauVNJHOr*`2UN$#7gf_-xn?&?s+xSHr4mMY<+QN z`yp3luX8FoffofrZ)_6g?Rwr&!E~+V|Qyc zmrIPiI+uJ-a9o`KB0#75%&NBe2^;^!`LDH|bx44FXLy`f==1#-cZ${s|G#3Qa@4#m zLosgsp3SRO5?&}At=%G~mBzSH`q95EEluY&QRzv^=d&*I{X602-MfZ?=Y{?n!%bTi zuP8~cd#|Lkp0P|gZ(UW3=-Y1#Y86keSNGliChOCK^V{ti*%+qtG2Y~wTFVA1Ks;Uj KT-G@yGywp+u9)Wl literal 0 HcmV?d00001 diff --git a/assets/icons/Passport/passport_happy3_43x45.png b/assets/icons/Passport/passport_happy3_43x45.png new file mode 100644 index 0000000000000000000000000000000000000000..724535eca4b8eb9d0b1642345e773e01b78734a5 GIT binary patch literal 1210 zcmeAS@N?(olHy`uVBq!ia0vp^+CZ$!!3-oBZY8}3l9DB^5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?@QuLn2Bde0{8v^K0UTq__OB&@Hb09I0xZL0)vRD^GUf^&XRs)CuGfo`&aftiB2rCv&6 zQetval8%CrfsvuUfr-AMiLQZxm9eFjiHQOfC;_c2N=dT{a&d!N2ISc)Wt5Z@Sn2DR zmzV368|&p4rRy77T3YHG80i}s=>k>g7FXt#Bv$C=6)VF`a7isrF3Kz@$;{7F0GXJW zlwVq6s|0i^#1FXzaAWg|q2UA!G5w0f0)0b01CXC!3VnU?E6vS?t1d1HN=3LAtHH$~ zl?AE#L8-<0rA5iWm`hUzSyf==T$Gwvl3x^(pPvH@#(<3clKkR~`~n3dBRvxZjquF8 zl>G8yO|S-EUn|eN;*!L?S#7KVndPEKw{hOWkr zu4XQ#rWQuV&M>_$`N^fZsd*(Zy(tL2&N%gg5<_kQ&}Ns^qRg_?6t|-MTm`V7tuk@D z#S*7^P`xR*-QtK-uRhQ*`k|Jz9x%NZ0TcEw9-ZI7Ou-i5 z6XN>+|9>De^w8xx1_nkcPZ!6Kid%E01oAm6aq0JSBXY_UKm!gU2na}u6X<7+;@*=M-(iRobWjQ zLFR#i)NEd_{YA6Q-+W8Z+IpsAk0IBj?03sc3a*}N(Z^ahBDO-FL++5f0Uz}W* z__}2FY=O<)Ti@hgv)ELtaO32?m`KqhCUcG-xm6=vG~@GQNuL#_^9_7XuT*FLp0Cfy Z#_))N@nibbNlQVciKnZd%Q~loCIIhnsI&k8 literal 0 HcmV?d00001 diff --git a/assets/icons/Passport/passport_okay1_43x45.png b/assets/icons/Passport/passport_okay1_43x45.png new file mode 100644 index 0000000000000000000000000000000000000000..176d104e41fad38818754405c891469964cb7414 GIT binary patch literal 1105 zcmaJ=TWHfz7>;g;3`OzspuQY36-Aq*Y1f&!Dr?ia>N0EB(V{P=$>|!lua1&8cnNK<#ii$oAuc(uGV_pV6C=(HczKIArPv$y(um*C@e-8im{oj8%2jWfZ zW>zh%q9|%+tU*eUeFgbF(<{hIjbw^sU4SEL+>Ej~uh@{P*H8w6n4z@71XQ%nZI56b zMO7@;lWClm8$}fvjN0rfFVN43rgo4p^O$>2@uRavu z!o1h#^+rOgq(C5AQ|lA>fInKh%2&clNbNA7iAz}R57t{2>kflqk;oFX_3coL+QU8OfjE`$h4lX%Njy^QWyxU~3S6-;RN*=|u zcw;g$Ha14gmOC$ZlC3``)h7!hSBE#u*~Lw-csBa8d;5a{1AGo0|M+&(!Flo9E4F@+ zyVfk(;F-I*d&_828+rQh^RXXU`CaPE>f+HWSJd$3v(?$=Fa5*o2i4fu-fM@A;o_;@ z>z@`qxzT>})C>Pmi~n2qjZ|gd>VY?@R}Ggc&);p_owk*YKl%ARvrhIrp33h#6WuX% z?{(nB_Zh{#J41tKj@n_ix-iw`yJOlxbAop(#tVL#JmG@l-6* KB=v>1?)e4Wbaapa literal 0 HcmV?d00001 diff --git a/assets/icons/Passport/passport_okay2_43x45.png b/assets/icons/Passport/passport_okay2_43x45.png new file mode 100644 index 0000000000000000000000000000000000000000..11ca378020412e4b358576f26f5cfd3ee12576eb GIT binary patch literal 1140 zcmaJ=S!mQi7>-p$ML~QhDxx9!;L*+1n3}Y!bT_+pwOf|$maY#TIi_u>$;4#pZfo%< zRy;rjD}q;rilB%n79Uhp)OsO4c+{hU7rqpwAc)7yI;q|2gKHo&{|w*v{pajT)GVJe zY33w?Ag08slqB94;Xg28EMAFM+7Mo6phz0k!UmL4T|iVCPy=MlQX4@Ms7C9C`=Ej# z#?CWSX_Ssv%R01Z)yL3T%kf2sie*_x)tdn#HPC3ZEXfmtX zTu|FqlhWIob;+QXEhQ_mG8V7^Qpv2f-uC2dkQ&yNvF%?o6gdn*%|YsSQ0aJr3_}-? zBFzSLmKDh|i8fSC)itezMmsVpyKx`2a=)yjB~j*?{fM%_}It(_Pa+CbUUkQPp4z3Q{=K-#J*$ zsI2Xc)CpIN$*K;+(X5|S9vF}RA8J{nXb&a9pLqW%?4?>Az$AeOTU;G?u3@h4%8|n^ zP!V)f5U$UcG0_AO^qQbU@;oh&^XpC9fEjPWFd-h7W44D>TL&>ENMQ-uGz~c{$V>xe*vq7h2?S z&azoJmc<42Mz}`dSj2){1_#6Vo&BrR`71m=zBxL$_%J&9z{d0L;=$gc9vQ%oVtk@H z70Kmt*sQzxWHa8L#+1r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