File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ uint8_t kb_offsets[3] = {
3636 2
3737};
3838
39+ uint8_t seeded = 0 ;
3940uint8_t kb_x = 0 ;
4041uint8_t kb_y = 0 ;
4142uint8_t guess_nr ;
@@ -294,12 +295,19 @@ void run_fiver(void)
294295 gotogxy (2 , 0 );
295296 gprint ("Game Boy FIVER" );
296297 draw_keyboard (0 , kb_vert_offset );
297-
298+
299+ while (joypad ());
300+
298301 color (LTGREY , WHITE , M_NOFILL );
299302 highlight_key ();
300303 while (1 ) {
301304 uint8_t j = joypad ();
302305 if ((has_random == 0 ) && (j != 0 )) {
306+ if (! seeded ) {
307+ initrand ((uint16_t )LY_REG | ((uint16_t )DIV_REG << 8 ));
308+ seeded = 1 ;
309+ }
310+
303311 uint16_t r ;
304312 do {
305313 r = randw () & (NUM_ANSWERS_ROUNDED_UP_POW2 - 1 );
@@ -404,10 +412,6 @@ void run_fiver(void)
404412}
405413
406414void main () {
407- uint16_t seed = LY_REG ;
408- seed |= (uint16_t )DIV_REG << 8 ;
409- initrand (seed );
410-
411415 while (1 ) {
412416 run_fiver ();
413417 }
You can’t perform that action at this time.
0 commit comments