@@ -15,13 +15,27 @@ const char* funnyText[] = {
1515 "This really isnt ok" ,
1616 "Just feed me RFID cards!" ,
1717 "Forget to charge me too?" };
18-
1918int funnyTextIndex = 0 ;
20-
2119DolphinState * stateLocal = 0 ;
2220char strButthurt [16 ];
2321char strXp [16 ];
22+ char strLevel [10 ];
2423int btnIndex = 0 ;
24+ uint32_t curLevel = 0 ;
25+ uint32_t level_array [29 ] = {500 , 1250 , 2250 , 3500 , 5000 , 6750 , 8750 , 11000 ,
26+ 13500 , 16250 , 19250 , 22500 , 26000 , 29750 , 33750 , 38000 ,
27+ 42500 , 47250 , 52250 , 58250 , 65250 , 73250 , 82250 , 92250 ,
28+ 103250 , 115250 , 128250 , 142250 , 157250 };
29+ #define NUM (a ) (sizeof(a) / sizeof(*a))
30+
31+ uint8_t dolphin_get_mylevel (uint32_t icounter ) {
32+ for (int i = 0 ; i < NUM (level_array ); i ++ ) {
33+ if (icounter <= level_array [i ]) {
34+ return i + 1 ;
35+ }
36+ }
37+ return NUM (level_array ) + 1 ;
38+ }
2539
2640static void draw_callback (Canvas * canvas , void * ctx ) {
2741 UNUSED (ctx );
@@ -34,19 +48,24 @@ static void draw_callback(Canvas* canvas, void* ctx) {
3448 canvas_draw_icon (canvas , 110 , 15 , & I_ButtonLeftSmall_3x5 );
3549 } else if (btnIndex == 1 ) {
3650 canvas_draw_icon (canvas , 110 , 25 , & I_ButtonLeftSmall_3x5 );
51+ } else if (btnIndex == 2 ) {
52+ canvas_draw_icon (canvas , 110 , 35 , & I_ButtonLeftSmall_3x5 );
3753 }
3854
3955 //strings
56+ curLevel = dolphin_get_mylevel (stateLocal -> data .icounter );
4057 canvas_set_font (canvas , FontBatteryPercent );
4158 canvas_draw_str (canvas , 3 , 9 , funnyText [funnyTextIndex ]);
4259 canvas_set_font (canvas , FontSecondary );
4360 snprintf (strButthurt , 16 , "Butthurt: %lu" , stateLocal -> data .butthurt );
4461 snprintf (strXp , 16 , "XP: %lu" , stateLocal -> data .icounter );
62+ snprintf (strLevel , 10 , "Level: %lu" , curLevel );
4563 canvas_draw_str (canvas , 51 , 21 , strButthurt );
4664 canvas_draw_str (canvas , 51 , 31 , strXp );
65+ canvas_draw_str (canvas , 51 , 41 , strLevel );
4766
4867 //save button
49- if (btnIndex == 2 ) {
68+ if (btnIndex == 3 ) {
5069 canvas_draw_rbox (canvas , 51 , 46 , 74 , 15 , 3 );
5170 canvas_invert_color (canvas );
5271 canvas_draw_str_aligned (canvas , 88 , 53 , AlignCenter , AlignCenter , "Save & Reboot" );
@@ -94,7 +113,7 @@ int32_t bigsad_app(void* p) {
94113 while (running ) {
95114 furi_check (furi_message_queue_get (event_queue , & event , FuriWaitForever ) == FuriStatusOk );
96115 if (event .type == InputTypePress ) {
97- if (event .key == InputKeyOk && btnIndex == 2 ) {
116+ if (event .key == InputKeyOk && btnIndex == 3 ) {
98117 bool result = saved_struct_save (
99118 "/int/.dolphin.state" , & stateLocal -> data , sizeof (DolphinStoreData ), 0xD0 , 0x01 );
100119 if (result ) {
@@ -106,13 +125,13 @@ int32_t bigsad_app(void* p) {
106125 }
107126 if (event .key == InputKeyUp ) {
108127 if (btnIndex == 0 ) {
109- btnIndex = 2 ;
128+ btnIndex = 3 ;
110129 } else {
111130 btnIndex -- ;
112131 }
113132 }
114133 if (event .key == InputKeyDown ) {
115- if (btnIndex == 2 ) {
134+ if (btnIndex == 3 ) {
116135 btnIndex = 0 ;
117136 } else {
118137 btnIndex ++ ;
@@ -123,6 +142,11 @@ int32_t bigsad_app(void* p) {
123142 stateLocal -> data .butthurt ++ ;
124143 } else if (btnIndex == 1 ) {
125144 stateLocal -> data .icounter += 10 ;
145+ } else if (btnIndex == 2 ) {
146+ curLevel = dolphin_get_mylevel (stateLocal -> data .icounter ) - 1 ;
147+ if (curLevel <= 28 ) {
148+ stateLocal -> data .icounter = level_array [curLevel ];
149+ }
126150 }
127151 }
128152 if (event .key == InputKeyLeft ) {
@@ -134,6 +158,13 @@ int32_t bigsad_app(void* p) {
134158 } else {
135159 stateLocal -> data .icounter -= 10 ;
136160 }
161+ } else if (btnIndex == 2 ) {
162+ curLevel = dolphin_get_mylevel (stateLocal -> data .icounter ) - 3 ;
163+ if (curLevel >= 1 ) {
164+ stateLocal -> data .icounter = level_array [curLevel ];
165+ } else if (curLevel == 0 ) {
166+ stateLocal -> data .icounter = 0 ;
167+ }
137168 }
138169 }
139170 if (event .key == InputKeyBack ) {
0 commit comments