Ignore:
Timestamp:
2010-05-28 07:39:52 (2 years ago)
Author:
kpoole
Message:

Episode 5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Classes/mouse_handler_base.cpp

    r17 r26  
    1919#include "log.hpp" 
    2020#include "preferences.hpp" 
     21 
     22extern bool gMegamap; 
     23extern bool gRedraw; 
     24extern bool gIsDragging; 
    2125 
    2226 
     
    8185        return true; 
    8286    } 
    83  
     87/* 
    8488    if(minimap_scrolling_) { 
    8589        //if the game is run in a window, we could miss a LMB/MMB up event 
     
    101105        if(minimap_scrolling_) return true; 
    102106    } 
     107*/  
    103108 
    104109    // Fire the drag & drop only after minimal drag distance 
     
    132137        dragged_y_ = dy; 
    133138        didDrag_ = true; 
     139        gIsDragging = true; 
    134140        // KP: fixes #5 
    135141        unsigned long curTime = SDL_GetTicks(); 
     
    168174        if (event.state == SDL_PRESSED) { 
    169175            cancel_dragging(); 
    170             init_dragging(dragging_left_); 
     176            if (event.x < gui().map_area().w) 
     177                init_dragging(dragging_left_); 
    171178            left_click(event.x, event.y, browse); 
    172179        } else if (event.state == SDL_RELEASED) { 
     
    261268{ 
    262269    // clicked on a hex on the minimap? then initiate minimap scrolling 
    263     const map_location& loc = gui().minimap_location_on(x, y); 
    264     minimap_scrolling_ = false; 
    265     if(loc.valid()) { 
    266         minimap_scrolling_ = true; 
    267         last_hex_ = loc; 
    268         gui().scroll_to_tile(loc,display::WARP, false); 
    269         return true; 
    270     } 
    271     return false; 
     270    if (gMegamap == true) 
     271    { 
     272        const map_location& loc = gui().megamap_location_on(x, y); 
     273        if(loc.valid()) { 
     274            minimap_scrolling_ = true; 
     275            last_hex_ = loc; 
     276            gui().scroll_to_tile(loc, display::WARP, false); 
     277            gMegamap = false; 
     278            gRedraw = true; 
     279            cancel_dragging(); 
     280            dragged_x_ = 0; 
     281            dragged_y_ = 0; 
     282            didDrag_ = false; 
     283            gIsDragging = false; 
     284            drag_start_time_ = 0; 
     285            scroll_velocity_x_ = 0; 
     286            scroll_velocity_y_ = 0; 
     287            drag_last_xVelocity_ = 0; 
     288            drag_last_yVelocity_ = 0; 
     289            minimap_scrolling_ = false; 
     290            return true; 
     291        }        
     292        return false; 
     293    } 
     294    else 
     295    { 
     296        const map_location& loc = gui().minimap_location_on(x, y); 
     297        minimap_scrolling_ = false; 
     298        if(loc.valid()) { 
     299#ifdef __IPAD__          
     300            minimap_scrolling_ = true; 
     301            last_hex_ = loc; 
     302            gui().scroll_to_tile(loc,display::WARP, false); 
     303#else 
     304            // KP: now, a click on the minimap causes the megamap to popup 
     305            gMegamap = true; 
     306#endif 
     307            return true; 
     308        } 
     309                 
     310        return false; 
     311    } 
    272312} 
    273313 
Note: See TracChangeset for help on using the changeset viewer.