X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=dea7258d009e5cef1816ed53fd17742a5e98035b;hp=6c2e968417e2b82f7ba74544d3d6634d931417d2;hb=c9308ba3e7ddea2d7e44b4d98f0dfbb19e18f04f;hpb=2ea97d888cd50aaec5646c620c24601b823d581b diff --git a/src/libgame/system.c b/src/libgame/system.c index 6c2e9684..dea7258d 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -33,6 +33,7 @@ struct OptionInfo options; struct VideoSystemInfo video; struct AudioSystemInfo audio; struct GfxInfo gfx; +struct TileCursorInfo tile_cursor; struct OverlayInfo overlay; struct ArtworkInfo artwork; struct JoystickInfo joystick; @@ -286,6 +287,11 @@ void InitGfxDrawGlobalBorderFunction(void (*draw_global_border_function)(int)) gfx.draw_global_border_function = draw_global_border_function; } +void InitGfxDrawTileCursorFunction(void (*draw_tile_cursor_function)(int)) +{ + gfx.draw_tile_cursor_function = draw_tile_cursor_function; +} + void InitGfxCustomArtworkInfo() { gfx.override_level_graphics = FALSE; @@ -300,6 +306,19 @@ void InitGfxOtherSettings() gfx.cursor_mode = CURSOR_DEFAULT; } +void InitTileCursorInfo() +{ + tile_cursor.enabled = FALSE; + tile_cursor.active = FALSE; + + tile_cursor.xpos = 0; + tile_cursor.ypos = 0; + tile_cursor.x = 0; + tile_cursor.y = 0; + tile_cursor.target_x = 0; + tile_cursor.target_y = 0; +} + void InitOverlayInfo() { overlay.enabled = FALSE; @@ -311,6 +330,37 @@ void InitOverlayInfo() #endif } +void SetTileCursorEnabled(boolean enabled) +{ + tile_cursor.enabled = enabled; +} + +void SetTileCursorActive(boolean active) +{ + tile_cursor.active = active; +} + +void SetTileCursorTargetXY(int x, int y) +{ + // delayed placement of tile selection cursor at target position + // (tile cursor will be moved to target position step by step) + + tile_cursor.xpos = x; + tile_cursor.ypos = y; + tile_cursor.target_x = gfx.sx + x * gfx.game_tile_size; + tile_cursor.target_y = gfx.sy + y * gfx.game_tile_size; +} + +void SetTileCursorXY(int x, int y) +{ + // immediate placement of tile selection cursor at target position + + SetTileCursorTargetXY(x, y); + + tile_cursor.x = tile_cursor.target_x; + tile_cursor.y = tile_cursor.target_y; +} + void SetOverlayEnabled(boolean enabled) { overlay.enabled = enabled;