game 118 modules/games/gui_tetris.c StcGame *game = 0; game 159 modules/games/gui_tetris.c if (game->nextBlock.type != prevNextBlockType) game 161 modules/games/gui_tetris.c prevNextBlockType = game->nextBlock.type; game 166 modules/games/gui_tetris.c if (game->nextBlock.cells[i][j] != EMPTY_CELL) game 172 modules/games/gui_tetris.c MAKE_COLOR(game->nextBlock.cells[i][j], game->nextBlock.cells[i][j]), RECT_BORDER0 | DRAW_FILLED); game 191 modules/games/gui_tetris.c if (game->map[i][j] != EMPTY_CELL) game 193 modules/games/gui_tetris.c tmp2[i][j] = game->map[i][j]; game 202 modules/games/gui_tetris.c if (game->fallingBlock.cells[i][j] != EMPTY_CELL) game 204 modules/games/gui_tetris.c tmp[i + game->fallingBlock.x][j + game->fallingBlock.y] = game->fallingBlock.cells[i][j]; game 246 modules/games/gui_tetris.c sprintf(str_buf, "High: %5d", game->stats.high); game 248 modules/games/gui_tetris.c sprintf(str_buf, "Points: %5d", game->stats.score); game 250 modules/games/gui_tetris.c sprintf(str_buf, "Lines: %5d", game->stats.lines); game 252 modules/games/gui_tetris.c sprintf(str_buf, "Level: %5d", game->stats.level); game 344 modules/games/gui_tetris.c static void startGame(StcGame *game) game 349 modules/games/gui_tetris.c game->errorCode = GAME_ERROR_NONE; game 350 modules/games/gui_tetris.c game->systemTime = platformGetSystemTime(); game 351 modules/games/gui_tetris.c game->lastFallTime = game->systemTime; game 352 modules/games/gui_tetris.c game->isOver = 0; game 353 modules/games/gui_tetris.c game->isPaused = 0; game 354 modules/games/gui_tetris.c game->showPreview = 1; game 355 modules/games/gui_tetris.c game->events = EVENT_NONE; game 356 modules/games/gui_tetris.c game->delay = INI_DELAY_FALL; game 358 modules/games/gui_tetris.c game->stats.score = 0; game 359 modules/games/gui_tetris.c game->stats.lines = 0; game 360 modules/games/gui_tetris.c game->stats.totalPieces = 0; game 361 modules/games/gui_tetris.c game->stats.level = 0; game 364 modules/games/gui_tetris.c game->stats.pieces[i] = 0; game 368 modules/games/gui_tetris.c srand(game->systemTime); game 371 modules/games/gui_tetris.c setMatrixCells(&game->map[0][0], BOARD_WIDTH, BOARD_HEIGHT, EMPTY_CELL); game 374 modules/games/gui_tetris.c setTetramino(rand() % 7, &game->fallingBlock); game 375 modules/games/gui_tetris.c game->fallingBlock.x = (BOARD_WIDTH - game->fallingBlock.size) / 2; game 376 modules/games/gui_tetris.c game->fallingBlock.y = 0; game 379 modules/games/gui_tetris.c setTetramino(rand() % 7, &game->nextBlock); game 386 modules/games/gui_tetris.c StcGame *game = (StcGame *) malloc(sizeof(StcGame)); game 387 modules/games/gui_tetris.c return game; game 393 modules/games/gui_tetris.c int gameInit(StcGame *game) game 400 modules/games/gui_tetris.c startGame(game); game 412 modules/games/gui_tetris.c void deleteGame(StcGame *game) game 414 modules/games/gui_tetris.c free(game); game 421 modules/games/gui_tetris.c void rotateTetramino(StcGame *game, int clockwise) game 427 modules/games/gui_tetris.c if (game->fallingBlock.type == TETROMINO_O) game 436 modules/games/gui_tetris.c for (i = 0; i < game->fallingBlock.size; ++i) game 438 modules/games/gui_tetris.c for (j = 0; j < game->fallingBlock.size; ++j) game 442 modules/games/gui_tetris.c rotated[game->fallingBlock.size - j - 1][i] = game->fallingBlock.cells[i][j]; game 446 modules/games/gui_tetris.c rotated[j][game->fallingBlock.size - i - 1] = game->fallingBlock.cells[i][j]; game 451 modules/games/gui_tetris.c for (i = 0; i < game->fallingBlock.size; ++i) game 453 modules/games/gui_tetris.c for (j = 0; j < game->fallingBlock.size; ++j) game 458 modules/games/gui_tetris.c if ((game->fallingBlock.x + i < 0) || (game->fallingBlock.x + i >= BOARD_WIDTH) || (game->fallingBlock.y + j >= BOARD_HEIGHT)) game 463 modules/games/gui_tetris.c if (game->map[i + game->fallingBlock.x][j + game->fallingBlock.y] != EMPTY_CELL) game 475 modules/games/gui_tetris.c game->fallingBlock.cells[i][j] = rotated[i][j]; game 484 modules/games/gui_tetris.c static int checkCollision(StcGame *game, int dx, int dy) game 488 modules/games/gui_tetris.c newx = game->fallingBlock.x + dx; game 489 modules/games/gui_tetris.c newy = game->fallingBlock.y + dy; game 491 modules/games/gui_tetris.c for (i = 0; i < game->fallingBlock.size; ++i) game 493 modules/games/gui_tetris.c for (j = 0; j < game->fallingBlock.size; ++j) game 495 modules/games/gui_tetris.c if (game->fallingBlock.cells[i][j] != EMPTY_CELL) game 503 modules/games/gui_tetris.c if (game->map[newx + i][newy + j] != EMPTY_CELL) game 514 modules/games/gui_tetris.c static void onFilledRows(StcGame *game, int filledRows) game 517 modules/games/gui_tetris.c game->stats.lines += filledRows; game 523 modules/games/gui_tetris.c game->stats.score += (SCORE_1_FILLED_ROW * (game->stats.level)); game 526 modules/games/gui_tetris.c game->stats.score += (SCORE_2_FILLED_ROW * (game->stats.level)); game 529 modules/games/gui_tetris.c game->stats.score += (SCORE_3_FILLED_ROW * (game->stats.level)); game 532 modules/games/gui_tetris.c game->stats.score += (SCORE_4_FILLED_ROW * (game->stats.level)); game 535 modules/games/gui_tetris.c game->errorCode = GAME_ERROR_ASSERT; /* This can't happen */ game 538 modules/games/gui_tetris.c if (game->stats.lines >= FILLED_ROWS_FOR_LEVEL_UP * (game->stats.level)) game 540 modules/games/gui_tetris.c game->stats.level++; game 543 modules/games/gui_tetris.c game->delay *= DELAY_FACTOR_FOR_LEVEL_UP; game 552 modules/games/gui_tetris.c static void moveTetramino(StcGame *game, int x, int y) game 557 modules/games/gui_tetris.c if (checkCollision(game, x, y)) game 564 modules/games/gui_tetris.c if (game->fallingBlock.y <= 1) game 566 modules/games/gui_tetris.c game->isOver = 1; /* if this happens the game is over */ game 572 modules/games/gui_tetris.c for (i = 0; i < game->fallingBlock.size; ++i) game 574 modules/games/gui_tetris.c for (j = 0; j < game->fallingBlock.size; ++j) game 576 modules/games/gui_tetris.c if (game->fallingBlock.cells[i][j] != EMPTY_CELL) game 578 modules/games/gui_tetris.c game->map[game->fallingBlock.x + i][game->fallingBlock.y + j] = game->fallingBlock.cells[i][j]; game 590 modules/games/gui_tetris.c if (game->map[i][j] == EMPTY_CELL) game 604 modules/games/gui_tetris.c game->map[x][y] = game->map[x][y - 1]; game 614 modules/games/gui_tetris.c onFilledRows(game, numFilledRows); game 616 modules/games/gui_tetris.c game->stats.totalPieces++; game 617 modules/games/gui_tetris.c game->stats.pieces[game->fallingBlock.type]++; game 625 modules/games/gui_tetris.c game->fallingBlock.cells[i][j] = game->nextBlock.cells[i][j]; game 628 modules/games/gui_tetris.c game->fallingBlock.size = game->nextBlock.size; game 629 modules/games/gui_tetris.c game->fallingBlock.type = game->nextBlock.type; game 632 modules/games/gui_tetris.c game->fallingBlock.y = 0; game 633 modules/games/gui_tetris.c game->fallingBlock.x = (BOARD_WIDTH - game->fallingBlock.size) / 2; game 636 modules/games/gui_tetris.c setTetramino(rand() % 7, &game->nextBlock); game 643 modules/games/gui_tetris.c game->fallingBlock.x += x; game 644 modules/games/gui_tetris.c game->fallingBlock.y += y; game 649 modules/games/gui_tetris.c static void dropTetramino(StcGame *game) game 654 modules/games/gui_tetris.c while (!checkCollision(game, 0, y)) game 658 modules/games/gui_tetris.c moveTetramino(game, 0, y - 1); game 664 modules/games/gui_tetris.c void gameUpdate(StcGame *game) game 668 modules/games/gui_tetris.c if (!game) game 677 modules/games/gui_tetris.c if (game->isOver) game 680 modules/games/gui_tetris.c if (game->stats.score > game->stats.high) game 682 modules/games/gui_tetris.c game->stats.high = game->stats.score; game 685 modules/games/gui_tetris.c buf = game->stats.score; game 694 modules/games/gui_tetris.c if (game->events & EVENT_PAUSE) game 699 modules/games/gui_tetris.c game->isOver = 0; game 700 modules/games/gui_tetris.c startGame(game); game 709 modules/games/gui_tetris.c if (game->events & EVENT_PAUSE) game 711 modules/games/gui_tetris.c game->isPaused = !game->isPaused; game 712 modules/games/gui_tetris.c game->events = EVENT_NONE; game 716 modules/games/gui_tetris.c if (game->isPaused) game 720 modules/games/gui_tetris.c game->lastFallTime += (sysTime - game->systemTime); game 724 modules/games/gui_tetris.c if (game->events != EVENT_NONE) game 726 modules/games/gui_tetris.c if (game->events & EVENT_SHOW_NEXT) game 728 modules/games/gui_tetris.c game->showPreview = !game->showPreview; game 730 modules/games/gui_tetris.c if (game->events & EVENT_DROP) game 732 modules/games/gui_tetris.c dropTetramino(game); game 734 modules/games/gui_tetris.c if (game->events & EVENT_ROTATE_CW) game 736 modules/games/gui_tetris.c rotateTetramino(game, 1); game 738 modules/games/gui_tetris.c if (game->events & EVENT_MOVE_RIGHT) game 740 modules/games/gui_tetris.c moveTetramino(game, 1, 0); game 742 modules/games/gui_tetris.c else if (game->events & EVENT_MOVE_LEFT) game 744 modules/games/gui_tetris.c moveTetramino(game, -1, 0); game 746 modules/games/gui_tetris.c if (game->events & EVENT_MOVE_DOWN) game 748 modules/games/gui_tetris.c moveTetramino(game, 0, 1); game 750 modules/games/gui_tetris.c game->events = EVENT_NONE; game 753 modules/games/gui_tetris.c if (sysTime - game->lastFallTime >= game->delay) game 755 modules/games/gui_tetris.c moveTetramino(game, 0, 1); game 756 modules/games/gui_tetris.c game->lastFallTime = sysTime; game 759 modules/games/gui_tetris.c game->systemTime = sysTime; game 771 modules/games/gui_tetris.c game = createGame(); game 772 modules/games/gui_tetris.c gameInit(game); game 780 modules/games/gui_tetris.c game->stats.high = 0; game 785 modules/games/gui_tetris.c game->stats.high = buf; game 789 modules/games/gui_tetris.c startGame(game); game 801 modules/games/gui_tetris.c gameUpdate(game); game 806 modules/games/gui_tetris.c if (!game) game 813 modules/games/gui_tetris.c if ((game->isPaused) || (game->isOver)) game 821 modules/games/gui_tetris.c game->events |= EVENT_PAUSE; game 824 modules/games/gui_tetris.c game->events |= EVENT_MOVE_LEFT; game 827 modules/games/gui_tetris.c game->events |= EVENT_MOVE_RIGHT; game 830 modules/games/gui_tetris.c game->events |= EVENT_MOVE_DOWN; game 838 modules/games/gui_tetris.c game->events |= EVENT_ROTATE_CW;