diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-04 22:45:50 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-04 22:45:50 +0100 |
commit | 64c38d95bfd6b24e34bc86f7d4ce7ba345c5a963 (patch) | |
tree | 9aaba99b80cd44b032cdd30e40f8b6625508ee89 /crawl-ref/source/directn.h | |
parent | ce5c888daccae3cf40be8e28176f415e54b26650 (diff) | |
download | crawl-ref-64c38d95bfd6b24e34bc86f7d4ce7ba345c5a963.tar.gz crawl-ref-64c38d95bfd6b24e34bc86f7d4ce7ba345c5a963.zip |
Split up view.cc.
Diffstat (limited to 'crawl-ref/source/directn.h')
-rw-r--r-- | crawl-ref/source/directn.h | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h index d7bbd68656..08d5fd60ca 100644 --- a/crawl-ref/source/directn.h +++ b/crawl-ref/source/directn.h @@ -25,94 +25,6 @@ private: bool do_anything; }; -class crawl_view_buffer -{ -public: - crawl_view_buffer(); - ~crawl_view_buffer(); - void size(const coord_def &size); - operator screen_buffer_t * () { return (buffer); } - - void draw(); -private: - screen_buffer_t *buffer; -}; - -struct crawl_view_geometry -{ -public: - coord_def termp; // Left-top pos of terminal. - coord_def termsz; // Size of the terminal. - coord_def viewp; // Left-top pos of viewport. - coord_def viewsz; // Size of the viewport (play area). - coord_def hudp; // Left-top pos of status area. - coord_def hudsz; // Size of the status area. - coord_def msgp; // Left-top pos of the message pane. - coord_def msgsz; // Size of the message pane. - coord_def mlistp; // Left-top pos of the monster list. - coord_def mlistsz; // Size of the monster list. - - crawl_view_buffer vbuf; // Buffer for drawing the main game map. - - coord_def vgrdc; // What grid pos is at the centre of the view - // usually you.pos(). - - coord_def viewhalfsz; - - coord_def glos1, glos2; // LOS limit grid coords (inclusive) - coord_def vlos1, vlos2; // LOS limit viewport coords (inclusive) - - coord_def mousep; // Where the mouse is. - -private: - coord_def last_player_pos; - -public: - crawl_view_geometry(); - void init_geometry(); - - void init_view(); - void set_player_at(const coord_def &c, bool force_centre = false); - // Set new location, but preserve scrolling as if the player didn't move. - void shift_player_to(const coord_def &c); - - coord_def view_centre() const - { - return viewp + viewhalfsz; - } - - coord_def glosc() const - { - return (glos1 + glos2) / 2; - } - - bool in_grid_los(const coord_def &c) const - { - return (c.x >= glos1.x && c.x <= glos2.x - && c.y >= glos1.y && c.y <= glos2.y); - } - - bool in_view_los(const coord_def &c) const - { - return (c.x >= vlos1.x && c.x <= vlos2.x - && c.y >= vlos1.y && c.y <= vlos2.y); - } - - bool in_view_viewport(const coord_def &c) const - { - return (c.x >= viewp.x && c.y >= viewp.y - && c.x < viewp.x + viewsz.x - && c.y < viewp.y + viewsz.y); - } - - bool in_grid_viewport(const coord_def &c) const - { - return in_view_viewport(c - vgrdc + view_centre()); - } -}; - -extern crawl_view_geometry crawl_view; - // An object that modifies the behaviour of the direction prompt. class targetting_behaviour { @@ -206,56 +118,6 @@ std::vector<dungeon_feature_type> features_by_desc(const base_pattern &pattern); void full_describe_view(void); -inline int view2gridX(int vx) -{ - return (crawl_view.vgrdc.x + vx - crawl_view.view_centre().x); -} - -inline int view2gridY(int vy) -{ - return (crawl_view.vgrdc.y + vy - crawl_view.view_centre().y); -} - -inline coord_def view2grid(const coord_def &pos) -{ - return pos - crawl_view.view_centre() + crawl_view.vgrdc; -} - -inline int grid2viewX(int gx) -{ - return (gx - crawl_view.vgrdc.x + crawl_view.view_centre().x); -} - -inline int grid2viewY(int gy) -{ - return (gy - crawl_view.vgrdc.y + crawl_view.view_centre().y); -} - -inline coord_def grid2view(const coord_def &pos) -{ - return (pos - crawl_view.vgrdc + crawl_view.view_centre()); -} - -inline coord_def view2show(const coord_def &pos) -{ - return (pos - crawl_view.vlos1); -} - -inline coord_def show2view(const coord_def &pos) -{ - return (pos + crawl_view.vlos1); -} - -inline coord_def grid2show(const coord_def &pos) -{ - return (view2show(grid2view(pos))); -} - -inline coord_def show2grid(const coord_def &pos) -{ - return (view2grid(show2view(pos))); -} - extern const struct coord_def Compass[8]; #endif |