Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 6, 2018, 12:15:25 AM (6 years ago)
Author:
landauf
Message:

merged the remaining commits of HUD_HS16 branch back to trunk (except commit r11392 which added DDDialogue that seems to be just a test)

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc

    r11354 r11700  
    5656    HUDPickupSystem::~HUDPickupSystem()
    5757    {
    58         if (this->isInitialized())
     58        /*if (this->isInitialized())
    5959        {
    6060            this->picks.clear();
    61         }
     61        }*/
    6262    }
    6363
     
    6868    }
    6969   
     70    void HUDPickupSystem::sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_)
     71    {
     72        //hide all pickup symbols in HUD and delete from local map
     73       
     74        orxout() << "picks size before: " << picks.size() << endl;
     75        orxout() << "p size before: " << p.size() << endl;
    7076
    71     void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_)
    72     {
    73         int i =0;
     77        for(const auto& sm_pair : picks)
     78        {
     79            sm_pair.second->hideMe(sm_pair.first, repaint);
     80            orxout() << "deleting local list picks: " << picks.size() << " pickup ptr" << sm_pair.first << endl;
     81        }
     82
     83        picks.clear();
     84        assert(picks.empty()); //picks must be empty now
     85
     86        //add to local map and place on screen
     87        int i = 0;
    7488        const float offsetX = 0.345f;
    7589        float offsetY = 0.82f;
    7690        const float x = 0.102f;
     91        orxout() << "picks size after: " << picks.size() << endl;
     92        orxout() << "p size after: " << p.size() << endl;
    7793
    78         if(picks.size()>0)
     94        for(Pickupable* pickup:p)
    7995        {
    80             for(Pickupable* p : picks)
    81             {
    82                 i = indexes_.find(p)->second;
    83                 offsetY = 0.82f;
     96            i=indexes_.find(pickup)->second;
     97            //second row has offset
     98            if(i==5)
     99            {   
     100                i=0;
     101                offsetY+=0.075f;
     102            }
    84103
    85                 if(i>=5)
    86                 {
    87                     offsetY+=0.075f;
    88                     i-=5;
    89                 }   
    90                 if(this->picks.count(p)==0)
    91                 {
    92                     HUDPickupItem* item = new HUDPickupItem(this->getContext());
    93                     item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY);
    94                
    95                     item->setOverlayGroup(this->getOverlayGroup());
    96                     this->picks[p] = item;
    97                 }
    98             }
     104            HUDPickupItem* item = new HUDPickupItem(this->getContext());
     105            item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY);
     106            orxout() << "created new pickupHUDItem"<<endl;
     107            item->setOverlayGroup(this->getOverlayGroup());
     108            picks[pickup] = item;
    99109        }
    100110    }
    101111
    102     void HUDPickupSystem::createPickupList()
    103     {
    104     }     
    105 
    106     void HUDPickupSystem::removePickup(Pickupable* pickup)
    107     {
    108         assert(pickup);
    109         HUDPickupItem* item = this->picks.find(pickup)->second;
    110         orxout(internal_info, context::pickups) << "removePickup: pickup= " << pickup << " item= " << item << endl;
    111         assert(item);
    112         item->hideMe(pickup, repaint);
    113         assert(overlayElement_);
    114         assert(this->background_);
    115         this->picks.erase(pickup);
    116     }
    117 
     112   
    118113    void HUDPickupSystem::destroyAll()
    119114    {
Note: See TracChangeset for help on using the changeset viewer.