Main Page | Alphabetical List | Class List | File List | Class Members | File Members

engine/game.c File Reference

#include "engine.h"

Go to the source code of this file.

Defines

#define MONSTMOVETIME   ((current_map.gamerules==RULESET_KYE92)?(3):(6))

Functions

void game_loop (void)
int level_advance (int level)
int make_move (int key)
void kye_move (int dx, int dy)
void scroll_viewport (void)
void center_viewport (void)
void _drawtile (int x, int y)
void draw_current_map (void)
void draw_map_tile (int x, int y)
void redraw_status_bar (void)
void advance (void)
int tile_is_monster (int x, int y)
void turn_sliders (void)
void try_rotate (int x, int y, int dx, int dy, int cw, int ccw)
void move_slider (int x, int y, int slippery, int dx, int dy)
int rotate_cw (int tile)
int rotate_ccw (int tile)
void move_pusher (int x, int y, int dx, int dy)
void move_monster (int x, int y)
effect_info animate_monster (int x, int y)
void detonate (int x, int y)
void clear_effects (void)
int is_in_bounds (int x, int y)
int can_shove (int x, int y, int dx, int dy)
void shove (int x, int y, int dx, int dy)
int check_diamonds (void)
void set_magnet_skips (void)
void restart_level (void)
void begin_level (void)

Variables

engine_map current_map
int player_x
int player_y
int scroll_x = 0 scroll_y=0
int current_level_num = 0
int advance_to_level = 0
int round
int num_diamonds
int have_moved = 0


Define Documentation

#define MONSTMOVETIME   ((current_map.gamerules==RULESET_KYE92)?(3):(6))
 

Definition at line 3 of file game.c.

Referenced by advance(), and animate_monster().


Function Documentation

void _drawtile int  x,
int  y
[inline, static]
 

Definition at line 296 of file game.c.

References current_map, draw_sprite(), engine_map_square::effect, EFFECT_NONE, effects, player_x, player_y, scroll_x, scroll_y, effect_info::sprite, engine_map::t, TILE_KYE, tile_sprites, and engine_map_square::v.

Referenced by draw_current_map(), and draw_map_tile().

void advance void   ) 
 

Definition at line 368 of file game.c.

References can_shove(), current_map, draw_map_tile(), effect_info::duration, engine_map_square::effect, EFFECT_DIAMOND, EFFECT_NONE, FIELD_HEIGHT, FIELD_WIDTH, message(), MONSTMOVETIME, move_monster(), move_pusher(), move_slider(), player_x, player_y, restart_level(), round, shove(), effect_info::sprite, engine_map::t, TILE_BLOB, TILE_DIAMOND, TILE_GNASHER, tile_is_monster(), TILE_KYE, TILE_MAGNET_EW, TILE_MAGNET_NS, TILE_PUSHER_E, TILE_PUSHER_N, TILE_PUSHER_S, TILE_PUSHER_W, TILE_ROCKY_E, TILE_ROCKY_N, TILE_ROCKY_S, TILE_ROCKY_W, TILE_SLIDER_E, TILE_SLIDER_N, TILE_SLIDER_S, TILE_SLIDER_W, TILE_SPIKE, TILE_TWISTER, TILE_VIRUS, and engine_map_square::v.

Referenced by game_loop().

effect_info animate_monster int  x,
int  y
 

Definition at line 794 of file game.c.

References current_map, effect_info::duration, EFFECT_BLOB, EFFECT_GNASHER, EFFECT_NONE, EFFECT_SPIKE, EFFECT_TWISTER, EFFECT_VIRUS, MONSTMOVETIME, round, effect_info::sprite, engine_map::t, TILE_BLOB, TILE_GNASHER, TILE_SPIKE, TILE_TWISTER, TILE_VIRUS, and engine_map_square::v.

Referenced by move_monster().

void begin_level void   ) 
 

Definition at line 1023 of file game.c.

References center_viewport(), check_diamonds(), current_map, effect_info::duration, engine_map_square::effect, EFFECT_NONE, FIELD_HEIGHT, FIELD_WIDTH, player_x, player_y, round, effect_info::sprite, engine_map::t, TILE_KYE, and engine_map_square::v.

Referenced by level_advance(), and restart_level().

int can_shove int  x,
int  y,
int  dx,
int  dy
 

Definition at line 907 of file game.c.

References current_map, is_in_bounds(), engine_map::t, TILE_BLOB, TILE_BLOCK, TILE_BOULDER, TILE_EMPTY, TILE_EXPLODER, TILE_GNASHER, TILE_MAGNET_EW, TILE_MAGNET_NS, TILE_PIT, TILE_PUSHER_E, TILE_PUSHER_N, TILE_PUSHER_S, TILE_PUSHER_W, TILE_ROCKY_E, TILE_ROCKY_N, TILE_ROCKY_S, TILE_ROCKY_W, TILE_SLIDER_E, TILE_SLIDER_N, TILE_SLIDER_S, TILE_SLIDER_W, TILE_SPIKE, TILE_STICKY_EW, TILE_STICKY_NS, TILE_TWIST_CCW, TILE_TWIST_CW, TILE_TWISTER, TILE_VIRUS, and engine_map_square::v.

Referenced by advance(), kye_move(), and move_pusher().

void center_viewport void   ) 
 

Definition at line 279 of file game.c.

References FIELD_HEIGHT, FIELD_WIDTH, player_x, player_y, scroll_x, scroll_y, VIEWPORT_HEIGHT, and VIEWPORT_WIDTH.

Referenced by begin_level().

int check_diamonds void   ) 
 

Definition at line 968 of file game.c.

References advance_to_level, engine_map::congrat, current_level_num, current_map, FIELD_HEIGHT, FIELD_WIDTH, message(), num_diamonds, redraw_status_bar(), engine_map::t, TILE_DIAMOND, and engine_map_square::v.

Referenced by begin_level(), and kye_move().

void clear_effects void   ) 
 

Definition at line 873 of file game.c.

References current_map, draw_map_tile(), effect_info::duration, engine_map_square::effect, EFFECT_NONE, FIELD_HEIGHT, FIELD_WIDTH, engine_map_square::skip, effect_info::sprite, and engine_map::t.

Referenced by game_loop().

void detonate int  x,
int  y
 

Definition at line 817 of file game.c.

References current_map, draw_map_tile(), effect_info::duration, engine_map_square::effect, EFFECT_EXPLODE_BOTLEFT, EFFECT_EXPLODE_BOTRIGHT, EFFECT_EXPLODE_BOTTOM, EFFECT_EXPLODE_CENTER, EFFECT_EXPLODE_LEFT, EFFECT_EXPLODE_RIGHT, EFFECT_EXPLODE_TOP, EFFECT_EXPLODE_TOPLEFT, EFFECT_EXPLODE_TOPRIGHT, EXPLODE_DURATION, is_in_bounds(), effect_info::sprite, engine_map::t, TILE_DIAMOND, TILE_EMPTY, TILE_KYE, TILE_PIT, and engine_map_square::v.

Referenced by move_slider().

void draw_current_map void   ) 
 

Definition at line 311 of file game.c.

References _drawtile(), clear_screen(), draw_line(), FIELD_HEIGHT, FIELD_WIDTH, redraw_status_bar(), scroll_x, scroll_y, VIEWPORT_HEIGHT, and VIEWPORT_WIDTH.

Referenced by editing_state(), enter_edit_state(), enter_properties_state(), file_open(), file_save(), file_save_as(), game_loop(), level_advance(), make_move(), map_delete(), map_import_level(), map_next(), map_previous(), restart_level(), and scroll_viewport().

void draw_map_tile int  x,
int  y
 

Definition at line 344 of file game.c.

References _drawtile(), scroll_x, scroll_y, VIEWPORT_HEIGHT, and VIEWPORT_WIDTH.

void game_loop void   ) 
 

Definition at line 100 of file game.c.

References advance(), advance_to_level, clear_effects(), current_level_num, DELAY_TIME, draw_current_map(), have_moved, level_advance(), make_move(), read_char_with_timeout(), round, and set_magnet_skips().

Referenced by _main().

int is_in_bounds int  x,
int  y
 

Definition at line 898 of file game.c.

References FIELD_HEIGHT, and FIELD_WIDTH.

void kye_move int  dx,
int  dy
 

Definition at line 188 of file game.c.

References can_shove(), check_diamonds(), current_map, DOOR_EW, DOOR_NS, DOOR_SN, DOOR_WE, draw_map_tile(), effect_info::duration, engine_map_square::effect, EFFECT_NONE, is_in_bounds(), player_x, player_y, scroll_viewport(), shove(), effect_info::sprite, engine_map::t, TILE_DIAMOND, TILE_EMPTY, TILE_FUZZY, TILE_KYE, TILE_MAGNET_EW, TILE_MAGNET_NS, TILE_STICKY_EW, TILE_STICKY_NS, and engine_map_square::v.

Referenced by make_move().

int level_advance int  level  ) 
 

Definition at line 135 of file game.c.

References advance_to_level, begin_level(), current_level_num, draw_current_map(), load_kyelib(), and show_splash().

Referenced by _main(), and game_loop().

int make_move int  key  ) 
 

Definition at line 162 of file game.c.

References advance_to_level, current_level_num, current_map, draw_current_map(), have_moved, engine_map::hint, kye_move(), message(), and restart_level().

Referenced by game_loop().

void move_monster int  x,
int  y
 

Definition at line 742 of file game.c.

References animate_monster(), current_map, draw_map_tile(), effect_info::duration, engine_map_square::effect, EFFECT_NONE, is_in_bounds(), player_x, player_y, engine_map_square::skip, effect_info::sprite, engine_map::t, TILE_EMPTY, and engine_map_square::v.

Referenced by advance().

void move_pusher int  x,
int  y,
int  dx,
int  dy
 

Definition at line 702 of file game.c.

References can_shove(), current_map, draw_map_tile(), engine_map::gamerules, is_in_bounds(), round, RULESET_DCKYE, shove(), engine_map_square::skip, engine_map::t, TILE_EMPTY, TILE_PIT, TILE_PUSHER_E, TILE_PUSHER_N, TILE_PUSHER_S, TILE_PUSHER_W, and engine_map_square::v.

Referenced by advance().

void move_slider int  x,
int  y,
int  slippery,
int  dx,
int  dy
 

Definition at line 518 of file game.c.

References current_map, detonate(), draw_map_tile(), is_in_bounds(), rotate_ccw(), rotate_cw(), engine_map_square::skip, engine_map::t, TILE_BOULDER, TILE_EMPTY, TILE_EXPLODER, TILE_PIT, TILE_ROCKY_E, TILE_ROCKY_N, TILE_ROCKY_S, TILE_ROCKY_W, TILE_TWIST_CCW, TILE_TWIST_CW, TILE_WALL_1, TILE_WALL_2, TILE_WALL_3, TILE_WALL_4, TILE_WALL_6, TILE_WALL_7, TILE_WALL_8, TILE_WALL_9, try_rotate(), and engine_map_square::v.

Referenced by advance().

void redraw_status_bar void   ) 
 

Definition at line 354 of file game.c.

References clear_line_range(), current_level_num, draw_string(), and num_diamonds.

Referenced by check_diamonds(), and draw_current_map().

void restart_level void   ) 
 

Definition at line 1015 of file game.c.

References begin_level(), current_level_num, draw_current_map(), and load_kyelib().

Referenced by advance(), and make_move().

int rotate_ccw int  tile  ) 
 

Definition at line 685 of file game.c.

References TILE_ROCKY_E, TILE_ROCKY_N, TILE_ROCKY_S, TILE_ROCKY_W, TILE_SLIDER_E, TILE_SLIDER_N, TILE_SLIDER_S, and TILE_SLIDER_W.

Referenced by move_slider().

int rotate_cw int  tile  ) 
 

Definition at line 668 of file game.c.

References TILE_ROCKY_E, TILE_ROCKY_N, TILE_ROCKY_S, TILE_ROCKY_W, TILE_SLIDER_E, TILE_SLIDER_N, TILE_SLIDER_S, and TILE_SLIDER_W.

Referenced by move_slider().

void scroll_viewport void   ) 
 

Definition at line 258 of file game.c.

References draw_current_map(), EDGE_X, EDGE_Y, FIELD_HEIGHT, FIELD_WIDTH, player_x, player_y, SCROLL_INCR_X, SCROLL_INCR_Y, scroll_x, scroll_y, VIEWPORT_HEIGHT, and VIEWPORT_WIDTH.

Referenced by kye_move().

void set_magnet_skips void   ) 
 

Definition at line 993 of file game.c.

References current_map, FIELD_HEIGHT, FIELD_WIDTH, engine_map_square::skip, engine_map::t, TILE_MAGNET_EW, TILE_MAGNET_NS, TILE_STICKY_EW, TILE_STICKY_NS, and engine_map_square::v.

Referenced by game_loop().

void shove int  x,
int  y,
int  dx,
int  dy
 

Definition at line 948 of file game.c.

References current_map, draw_map_tile(), effect_info::duration, engine_map_square::effect, effect_info::sprite, engine_map::t, TILE_EMPTY, TILE_PIT, and engine_map_square::v.

Referenced by advance(), kye_move(), and move_pusher().

int tile_is_monster int  x,
int  y
 

Definition at line 455 of file game.c.

References current_map, engine_map::t, TILE_BLOB, TILE_GNASHER, TILE_SPIKE, TILE_TWISTER, TILE_VIRUS, and engine_map_square::v.

Referenced by advance().

void try_rotate int  x,
int  y,
int  dx,
int  dy,
int  cw,
int  ccw
 

Definition at line 505 of file game.c.

References current_map, draw_map_tile(), engine_map::t, TILE_TWIST_CCW, TILE_TWIST_CW, and engine_map_square::v.

Referenced by move_slider(), and turn_sliders().

void turn_sliders void   ) 
 

Definition at line 468 of file game.c.

References current_map, FIELD_HEIGHT, FIELD_WIDTH, engine_map::t, TILE_ROCKY_E, TILE_ROCKY_N, TILE_ROCKY_S, TILE_ROCKY_W, TILE_SLIDER_E, TILE_SLIDER_N, TILE_SLIDER_S, TILE_SLIDER_W, try_rotate(), and engine_map_square::v.


Variable Documentation

int advance_to_level = 0
 

Definition at line 8 of file game.c.

Referenced by check_diamonds(), game_loop(), level_advance(), and make_move().

int current_level_num = 0
 

Definition at line 7 of file game.c.

Referenced by check_diamonds(), game_loop(), level_advance(), make_move(), redraw_status_bar(), restart_level(), and show_splash().

engine_map current_map
 

Definition at line 4 of file game.c.

int have_moved = 0
 

Definition at line 11 of file game.c.

Referenced by game_loop(), and make_move().

int num_diamonds
 

Definition at line 10 of file game.c.

Referenced by check_diamonds(), and redraw_status_bar().

int player_x
 

Definition at line 5 of file game.c.

Referenced by _drawtile(), advance(), begin_level(), center_viewport(), kye_move(), move_monster(), and scroll_viewport().

int player_y
 

Definition at line 5 of file game.c.

Referenced by _drawtile(), advance(), begin_level(), center_viewport(), kye_move(), move_monster(), and scroll_viewport().

int round
 

Definition at line 9 of file game.c.

Referenced by advance(), animate_monster(), begin_level(), game_loop(), and move_pusher().

int scroll_x = 0 scroll_y=0
 

Definition at line 6 of file game.c.

Referenced by _drawtile(), center_viewport(), clip_scroll_pos(), draw_current_map(), draw_map_field(), draw_map_tile(), move_cursor(), scroll_viewport(), xor_selected_range(), and xor_tile().


Generated on Thu Apr 22 14:06:34 2004 for SKye by doxygen 1.3.6