tell which color a killed piece had, some fixes in asciiart, added markings on the color-restricted squares
This commit is contained in:
parent
d860d50001
commit
c0395e561c
@ -12,30 +12,30 @@
|
||||
char asciiart_small_blank_board[] =
|
||||
"red \n"
|
||||
" | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--s--s--+--+--+--+--+--r--r--s--\n"
|
||||
" A| | | | | | | | | | |A \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--r--s--+--+--+--+--+--r--s--s--\n"
|
||||
" B| | | | | | | | | | |B \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--r--+--+--+--+--+--+--+--s--s--\n"
|
||||
" C| | | | | | | | | | |C \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--r--+--+--+--+--+--+--+--s--s--\n"
|
||||
" D| | | | | | | | | | |D \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--r--+--+--+--+--+--+--+--s--s--\n"
|
||||
" E| | | | | | | | | | |E \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--r--+--+--+--+--+--+--+--s--s--\n"
|
||||
" F| | | | | | | | | | |F \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--r--+--+--+--+--+--+--+--s--s--\n"
|
||||
" G| | | | | | | | | | |G \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--r--s--+--+--+--+--+--r--s--s--\n"
|
||||
" H| | | | | | | | | | |H \n"
|
||||
"--+--+--+--+--+--+--+--+--+--+--+--\n"
|
||||
"--r--s--s--+--+--+--+--+--r--r--s--\n"
|
||||
" | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| \n"
|
||||
" silver\n"
|
||||
;
|
||||
|
||||
char asciiart_small_pieces[] =
|
||||
" " // NONE
|
||||
"SSSSSSSSRRRRRRRR"
|
||||
"SSSSSSSSRRRRRRRR" // PHARAOH
|
||||
",'`.,'`..\"\"..\"\"." // DJHED
|
||||
"`/\\'/.,\\\"/\\\"/==\\" // PYRAMID
|
||||
". . . . = = = = " // OBELISK
|
||||
@ -75,13 +75,16 @@ asciiart_small_draw_laserhit(char *buf, game_t *game)
|
||||
|
||||
i = asciiart_small_square_index(x, y);
|
||||
if (x == -1 || x == BOARD_WIDTH) {
|
||||
i += (x==-1) ? 2 : -1;
|
||||
buf[i] = '#';
|
||||
} else {
|
||||
if (y == -1)
|
||||
i += SMALL_WIDTH;
|
||||
else if (y == BOARD_HEIGHT)
|
||||
i -= SMALL_WIDTH;
|
||||
buf[i] = buf[i+1] = '#';
|
||||
if (game->last_hit.piece!=OBELISK2)
|
||||
buf[i] = '#';
|
||||
buf[i+1] = '#';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,15 +77,15 @@ laser(game_t *game, int side) {
|
||||
case NONE:
|
||||
break;
|
||||
case PHARAO:
|
||||
game->last_hit = PHARAO;
|
||||
game->last_hit = game->board[x][y];
|
||||
lreturn(SILVER_WINS + 1-game->board[x][y].side); /* GAME OVER */
|
||||
case OBELISK2:
|
||||
game->last_hit = game->board[x][y];
|
||||
game->board[x][y].piece = OBELISK;
|
||||
game->last_hit = OBELISK;
|
||||
lreturn(L_PIECE);
|
||||
case OBELISK:
|
||||
game->last_hit = game->board[x][y];
|
||||
game->board[x][y].piece = NONE;
|
||||
game->last_hit = OBELISK;
|
||||
lreturn(L_PIECE);
|
||||
case DJHED:
|
||||
ddir = (game->board[x][y].dir - dir) & 3;
|
||||
@ -94,8 +94,8 @@ laser(game_t *game, int side) {
|
||||
case PYRAMID:
|
||||
ddir = (game->board[x][y].dir - dir) & 3;
|
||||
if (ddir & 2) {
|
||||
game->last_hit = game->board[x][y];
|
||||
game->board[x][y].piece = NONE;
|
||||
game->last_hit = PYRAMID;
|
||||
lreturn(L_PIECE);
|
||||
}
|
||||
dir=(dir + 1 - 2*(ddir & 1)) & 3;
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* -*- c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef KHET_GAME_H
|
||||
#define KHET_GAME_H
|
||||
|
||||
@ -40,7 +42,7 @@ typedef struct {
|
||||
int winner;
|
||||
square_t board[BOARD_WIDTH][BOARD_HEIGHT];
|
||||
int laser_pos[2];
|
||||
int last_hit;
|
||||
square_t last_hit;
|
||||
} game_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -216,9 +216,13 @@ simple_game(void)
|
||||
net_all_printf("RED WINS!\n");
|
||||
return;
|
||||
case L_WALL:
|
||||
net_all_printf("laser hits wall at %c%c\n",
|
||||
game.laser_pos[1]+'A', game.laser_pos[0]+'0');
|
||||
break;
|
||||
case L_PIECE:
|
||||
net_all_printf("laser hits %s at %c%c\n",
|
||||
r==L_WALL ? "wall" : pieceinfo[game.last_hit].name,
|
||||
net_all_printf("laser hits %s %s at %c%c\n",
|
||||
sideinfo[game.last_hit.side].name,
|
||||
pieceinfo[game.last_hit.piece].name,
|
||||
game.laser_pos[1]+'A', game.laser_pos[0]+'0');
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user