/*--------------------------------------------------------------------------*/ /* selection states */ /*--------------------------------------------------------------------------*/ *************** *** 115,121 **** static void board_shift_time(int x, int y, int side); static void board_exchange(int x, int y, int side); static void board_summon_elemental(int x, int y, int side); ! static int board_revive_frame(int *i, int *old_i, int *actors); static void board_revive(int x, int y, int side); static void board_imprison(int x, int y, int side); static void board_cease_conjuring(int x, int y, int side); --- 117,123 ---- static void board_shift_time(int x, int y, int side); static void board_exchange(int x, int y, int side); static void board_summon_elemental(int x, int y, int side); ! static int board_revive_frame(int *i, int *actors); static void board_revive(int x, int y, int side); static void board_imprison(int x, int y, int side); static void board_cease_conjuring(int x, int y, int side); *************** *** 800,825 **** board_message("select spell: %s", spell_names[board.spell]); old_spell = board.spell; ! if (iface_key_down(STATE_MOVE_UP)) ! board.prev_down = 1; ! if (board.prev_down && !iface_key_down(STATE_MOVE_UP)) { board.prev_down = 0; ! do { ! board.spell--; ! } while (board.spell > SPELL_TELEPORT && !spell_avails[board.side][board.spell]); ! if (!spell_avails[board.side][board.spell]) ! board.spell = old_spell; ! } ! if (iface_key_down(STATE_MOVE_DOWN)) ! board.next_down = 1; ! if (board.next_down && !iface_key_down(STATE_MOVE_DOWN)) { board.next_down = 0; - do { - board.spell++; - } while (board.spell < SPELL_CEASE_CONJURING && !spell_avails[board.side][board.spell]); - if (!spell_avails[board.side][board.spell]) - board.spell = old_spell; - } if (fire_up) spell_funcs[board.spell](0, 0, 0); --- 802,829 ---- board_message("select spell: %s", spell_names[board.spell]); old_spell = board.spell; ! if (iface_key_down(STATE_MOVE_UP)) { ! if (!board.prev_down) { ! board.prev_down = 1; ! do { ! board.spell--; ! } while (board.spell > SPELL_TELEPORT && !spell_avails[board.side][board.spell]); ! if (!spell_avails[board.side][board.spell]) ! board.spell = old_spell; ! } ! } else board.prev_down = 0; ! if (iface_key_down(STATE_MOVE_DOWN)) { ! if (!board.next_down) { ! board.next_down = 1; ! do { ! board.spell++; ! } while (board.spell < SPELL_CEASE_CONJURING && !spell_avails[board.side][board.spell]); ! if (!spell_avails[board.side][board.spell]) ! board.spell = old_spell; ! } ! } else board.next_down = 0; if (fire_up) spell_funcs[board.spell](0, 0, 0); *************** *** 1036,1043 **** /* board_revive_frame */ /*--------------------------------------------------------------------------*/ ! int board_revive_frame(int *i, int *old_i, int *actors) { if (iface_key_down(STATE_FIRE)) board.fire_down = 1; if (board.fire_down && !iface_key_down(STATE_FIRE)) { --- 1040,1052 ---- /* board_revive_frame */ /*--------------------------------------------------------------------------*/ ! int board_revive_frame(int *i, int *actors) { + int old_i = *i; + + if (*i < 0) + for (*i = 0; actors[*i]; (*i)++) + ; if (iface_key_down(STATE_FIRE)) board.fire_down = 1; if (board.fire_down && !iface_key_down(STATE_FIRE)) { *************** *** 1060,1074 **** (*i)++; } ! if (*i != *old_i) { sprite_set_state(cursor_sprite, STATE_BOARD, 1); /* erase cursor */ sprite_paint(cursor_sprite, STATE_BOARD, (board.side == 0 ? CELL_XSIZE : CANVAS_WIDTH - CELL_XSIZE * 2), ! (*old_i) * 40 + 32); sprite_set_state(cursor_sprite, STATE_BOARD, 2); /* draw cursor */ sprite_paint(cursor_sprite, STATE_BOARD, (board.side == 0 ? CELL_XSIZE : CANVAS_WIDTH - CELL_XSIZE * 2), ! (*i) * 40 + 32); board.any_output = 1; } --- 1069,1083 ---- (*i)++; } ! if (*i != old_i) { sprite_set_state(cursor_sprite, STATE_BOARD, 1); /* erase cursor */ sprite_paint(cursor_sprite, STATE_BOARD, (board.side == 0 ? CELL_XSIZE : CANVAS_WIDTH - CELL_XSIZE * 2), ! old_i * V_CELL_YSIZE + CELL_YSIZE); sprite_set_state(cursor_sprite, STATE_BOARD, 2); /* draw cursor */ sprite_paint(cursor_sprite, STATE_BOARD, (board.side == 0 ? CELL_XSIZE : CANVAS_WIDTH - CELL_XSIZE * 2), ! (*i) * V_CELL_YSIZE + CELL_YSIZE); board.any_output = 1; } *************** *** 1081,1089 **** void board_revive(int x, int y, int side) { ! static int actors[10], i; static int cell_x, cell_y; ! int old_i; if (board.ssp.complete) { board.cx = CELL_X(cell_x); /* once ssp is complete, place */ --- 1090,1102 ---- void board_revive(int x, int y, int side) { ! static int actors[10]; static int cell_x, cell_y; ! int i; ! ! iface_frame(); ! if (board.game_status == 0) ! return; if (board.ssp.complete) { board.cx = CELL_X(cell_x); /* once ssp is complete, place */ *************** *** 1103,1121 **** sprite_paint(actors_list[actors[i]].sprite, (board.side == 0 ? STATE_MOVE_RIGHT : STATE_MOVE_LEFT), (board.side == 0 ? CELL_XSIZE : CANVAS_WIDTH - CELL_XSIZE * 2), ! i * 40 + 32); ! old_i = 0; /* force i != old_i, thus redraw */ board.state = V_SELECT_SOURCE; ! } else ! old_i = i; ! if (board_revive_frame(&i, &old_i, actors)) { ! if (actors[i] != 0) { spell_avails[board.side][SPELL_REVIVE] = 0; ! board_init_cell(&board_cells[cell_y][cell_x], actors[i]); board_ssp_init(cell_x, cell_y, cell_x, cell_y, 0); ! board.cx = CELL_X(1); /* make sure cursor is not on a */ ! board.cy = CELL_Y(1); /* power cell (temporarily) */ } else board_end_turn(0); } --- 1116,1133 ---- sprite_paint(actors_list[actors[i]].sprite, (board.side == 0 ? STATE_MOVE_RIGHT : STATE_MOVE_LEFT), (board.side == 0 ? CELL_XSIZE : CANVAS_WIDTH - CELL_XSIZE * 2), ! i*V_CELL_YSIZE + CELL_YSIZE); ! board.cy = -1; /* force redraw */ board.state = V_SELECT_SOURCE; ! } ! if (board_revive_frame(&board.cy, actors)) { ! if (actors[board.cy] != 0) { spell_avails[board.side][SPELL_REVIVE] = 0; ! board_init_cell(&board_cells[cell_y][cell_x], actors[board.cy]); board_ssp_init(cell_x, cell_y, cell_x, cell_y, 0); ! board.cx = CELL_X(1); ! /* make sure cursor is not on a power cell (temporarily) */ } else board_end_turn(0); }