mirror of
https://codeberg.org/hkzlab/TK2048.git
synced 2025-12-25 11:02:17 +11:00
Re-enable partial drawing
This commit is contained in:
parent
f5cfc0f5da
commit
76fed16432
1 changed files with 38 additions and 34 deletions
|
|
@ -92,59 +92,62 @@ void main(void) {
|
|||
vdp_draw_joystick(JS_POS_CENTER); // Center the joystick
|
||||
|
||||
vdp_redraw_tiles(get_front_grid());
|
||||
__enable_interrupts();
|
||||
|
||||
while(1);
|
||||
|
||||
|
||||
//__enable_interrupts();
|
||||
|
||||
while(1) { // Game loop
|
||||
lfsr_update();
|
||||
|
||||
__disable_interrupts();
|
||||
//vdp_draw_joystick(JS_POS_CENTER);
|
||||
__enable_interrupts();
|
||||
|
||||
switch(read_kb()) {
|
||||
case K_UP:
|
||||
SND_TAP();
|
||||
done = step_game(GAME_STEP_UP);
|
||||
__disable_interrupts();
|
||||
//vdp_draw_joystick(JS_POS_UP);
|
||||
__enable_interrupts();
|
||||
SND_TAP();
|
||||
vdp_draw_joystick(JS_POS_UP);
|
||||
done = step_game(GAME_STEP_UP);
|
||||
//__enable_interrupts();
|
||||
break;
|
||||
case K_DOWN:
|
||||
SND_TAP();
|
||||
done = step_game(GAME_STEP_DOWN);
|
||||
__disable_interrupts();
|
||||
//vdp_draw_joystick(JS_POS_DOWN);
|
||||
__enable_interrupts();
|
||||
SND_TAP();
|
||||
vdp_draw_joystick(JS_POS_DOWN);
|
||||
done = step_game(GAME_STEP_DOWN);
|
||||
//__enable_interrupts();
|
||||
break;
|
||||
case K_LEFT:
|
||||
SND_TAP();
|
||||
done = step_game(GAME_STEP_LEFT);
|
||||
__disable_interrupts();
|
||||
//vdp_draw_joystick(JS_POS_LEFT);
|
||||
__enable_interrupts();
|
||||
SND_TAP();
|
||||
vdp_draw_joystick(JS_POS_LEFT);
|
||||
done = step_game(GAME_STEP_LEFT);
|
||||
//__enable_interrupts();
|
||||
break;
|
||||
case K_RIGHT:
|
||||
SND_TAP();
|
||||
done = step_game(GAME_STEP_RIGHT);
|
||||
__disable_interrupts();
|
||||
//vdp_draw_joystick(JS_POS_RIGHT);
|
||||
__enable_interrupts();
|
||||
SND_TAP();
|
||||
vdp_draw_joystick(JS_POS_RIGHT);
|
||||
done = step_game(GAME_STEP_RIGHT);
|
||||
//__enable_interrupts();
|
||||
break;
|
||||
case K_CTRL_R:
|
||||
__disable_interrupts();
|
||||
snd_mod_button();
|
||||
//__enable_interrupts();
|
||||
|
||||
score = 0; // We'll reset the score
|
||||
done = -1;
|
||||
break;
|
||||
case K_CTRL_S: // The following two will return early
|
||||
__disable_interrupts();
|
||||
snd_mod_button();
|
||||
//__enable_interrupts();
|
||||
|
||||
memcpy((void*)(state_page->save_grid), get_front_grid(), GRID_SIDE * GRID_SIDE);
|
||||
state_page->saved_moves_count = moves_count;
|
||||
shared_page->master_command = MASTER_COMMAND_SAVE;
|
||||
case K_CTRL_L:
|
||||
__disable_interrupts();
|
||||
snd_mod_button();
|
||||
//__enable_interrupts();
|
||||
|
||||
shared_page->next_module_idx = MODULE_GAME;
|
||||
gad->mode = GAME_MODE_LOAD;
|
||||
__disable_interrupts();
|
||||
|
|
@ -156,18 +159,18 @@ void main(void) {
|
|||
// Increase the count of moves we made (unless we lost or reset the game)
|
||||
if(done >= 0) moves_count++;
|
||||
|
||||
num_to_decbuf(moves_count, 6, text_buf); // Moves count
|
||||
decbuf_to_ascii(6, text_buf);
|
||||
num_to_decbuf(moves_count, 5, text_buf); // Moves count
|
||||
decbuf_to_ascii(5, text_buf);
|
||||
__disable_interrupts();
|
||||
vdp_print_string(0, MOVES_TEXT_X, MOVES_TEXT_Y, (char*)text_buf);
|
||||
__enable_interrupts();
|
||||
//__enable_interrupts();
|
||||
|
||||
// If we have won, or we got a reset request, break out of this loop
|
||||
if(done) {
|
||||
score += (done > 0) ? WIN_SCORE_BONUS : 0;
|
||||
|
||||
num_to_decbuf(score, 6, text_buf); // Score
|
||||
decbuf_to_ascii(6, text_buf);
|
||||
num_to_decbuf(score, 5, text_buf); // Score
|
||||
decbuf_to_ascii(5, text_buf);
|
||||
__disable_interrupts();
|
||||
vdp_print_string(0, SCORE_TEXT_X, SCORE_TEXT_Y, (char*)text_buf);
|
||||
|
||||
|
|
@ -184,18 +187,19 @@ void main(void) {
|
|||
score = calculate_score();
|
||||
|
||||
// Draw the score
|
||||
num_to_decbuf(score, 6, text_buf); // Score
|
||||
decbuf_to_ascii(6, text_buf);
|
||||
num_to_decbuf(score, 5, text_buf); // Score
|
||||
decbuf_to_ascii(5, text_buf);
|
||||
__disable_interrupts();
|
||||
vdp_print_string(0, SCORE_TEXT_X, SCORE_TEXT_Y, (char*)text_buf);
|
||||
//vdp_redraw_tiles(get_front_grid());
|
||||
__enable_interrupts();
|
||||
vdp_redraw_tiles(get_front_grid());
|
||||
vdp_draw_joystick(JS_POS_CENTER);
|
||||
//__enable_interrupts();
|
||||
}
|
||||
|
||||
dld->mode = (done > 0) ? DLOG_MODE_WIN : DLOG_MODE_LOSE;
|
||||
dld->score = score;
|
||||
|
||||
//vdp_redraw_tiles(get_front_grid());
|
||||
vdp_redraw_tiles(get_front_grid());
|
||||
|
||||
WAIT(0xFF);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue