source/square.c
// Resets the game to the starting configuration.
Resets the game to the starting configuration.
Resets the game to the starting configuration .
void resetGame(void) {
    static int tempMap[MAP_HEIGHT][MAP_WIDTH] = {
        {0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1},
        {0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0},
        {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
        {0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0},
        {0, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0},
        {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0},
        {0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}
    };
    sx = 0;
    sy = 0;
    moves = 0;
    cd = 0;
    game_won = false;
    for (s32 x = 0; x < MAP_WIDTH; x++)
        for (s32 y = 0; y < MAP_HEIGHT; y++)
            map[y][x] = tempMap[y][x];
    fillSquare(0, 0, SCREEN_WIDTH, C_BLACK);
    drawBox();
    drawPlayerSquare();
    drawNPC();
    iprintf("\x1b[0;0H");
    iprintf("Moves/CD: 0/0                   \n");
    for (s32 i = 0; i < SCREEN_WIDTH / 8; i++)
        iprintf("-");
    iprintf("\nWelcome! Controls:\n\n");
    iprintf("A: consume an adjacent square.\n");
    iprintf("B: explode! (has cooldown)\n");
    iprintf("X: exit the game.\n");
    iprintf("Y: reset the game.\n\n                 ");
}
void resetGame ( void ) { static int tempMap [ MAP_HEIGHT ] [ MAP_WIDTH ] = { { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 } , { 0 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 2 , 0 , 0 } , { 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 } , { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 } , { 0 , 1 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 2 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 2 , 0 } , { 0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 1 } , { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 , 0 } , { 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 } } ; sx = 0 ; sy = 0 ; moves = 0 ; cd = 0 ; game_won = false ; for ( s32 x = 0 ; x < MAP_WIDTH ; x ++ ) for ( s32 y = 0 ; y < MAP_HEIGHT ; y ++ ) map [ y ] [ x ] = tempMap [ y ] [ x ] ; fillSquare ( 0 , 0 , SCREEN_WIDTH , C_BLACK ) ; drawBox ( ) ; drawPlayerSquare ( ) ; drawNPC ( ) ; iprintf ( " \x1b " ) ; iprintf ( " \n " ) ; for ( s32 i = 0 ; i < SCREEN_WIDTH / 8 ; i ++ ) iprintf ( " " ) ; iprintf ( " \n \n \n " ) ; iprintf ( " \n " ) ; iprintf ( " \n " ) ; iprintf ( " \n " ) ; iprintf ( " \n \n " ) ; }
Resets the game to the starting configuration.
Resets the game to the starting configuration .