mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-23 10:52:38 +01:00
Move blip object lookup and make arrows work again.
This commit is contained in:
parent
50cf4293e4
commit
6422c8ae97
@ -24,6 +24,7 @@ class VehicleObject;
|
||||
#include <render/VisualFX.hpp>
|
||||
#include <data/ObjectData.hpp>
|
||||
|
||||
struct BlipData;
|
||||
class InventoryItem;
|
||||
struct WeaponScan;
|
||||
|
||||
@ -215,6 +216,13 @@ public:
|
||||
|
||||
std::vector<PlayerController*> players;
|
||||
|
||||
/**
|
||||
* @brief getBlipTarget
|
||||
* @param blip
|
||||
* @return The targetted object of the given blip
|
||||
*/
|
||||
GameObject *getBlipTarget(const BlipData &blip) const;
|
||||
|
||||
/**
|
||||
* Stores objects within a grid cell, and their maximum
|
||||
* bounding radius
|
||||
|
@ -513,6 +513,21 @@ GameWorld::ObjectPool& GameWorld::getTypeObjectPool(GameObject* object)
|
||||
}
|
||||
}
|
||||
|
||||
GameObject*GameWorld::getBlipTarget(const BlipData& blip) const
|
||||
{
|
||||
switch( blip.type )
|
||||
{
|
||||
case BlipData::Vehicle:
|
||||
return vehiclePool.find(blip.target);
|
||||
case BlipData::Character:
|
||||
return pedestrianPool.find(blip.target);
|
||||
case BlipData::Pickup:
|
||||
return pickupPool.find(blip.target);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void GameWorld::destroyObject(GameObject* object)
|
||||
{
|
||||
auto coord = worldToGrid(glm::vec2(object->getPosition()));
|
||||
|
@ -381,13 +381,11 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera &camera, float
|
||||
|
||||
if( blip.second.target > 0 )
|
||||
{
|
||||
// TODO restore arrows
|
||||
/*auto& pool = world->getTypeObjectPool(blip.second.target);
|
||||
auto object = pool.find(blip.second.target);
|
||||
auto object = world->getBlipTarget(blip.second);
|
||||
if( object )
|
||||
{
|
||||
model = object->getTimeAdjustedTransform( _renderAlpha );
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -169,19 +169,7 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi)
|
||||
glm::vec2 blippos( blip.second.coord );
|
||||
if( blip.second.target > 0 )
|
||||
{
|
||||
GameObject* object = nullptr;
|
||||
switch( blip.second.type ) {
|
||||
case BlipData::Vehicle:
|
||||
object = world->vehiclePool.find(blip.second.target);
|
||||
break;
|
||||
case BlipData::Character:
|
||||
object = world->pedestrianPool.find(blip.second.target);
|
||||
break;
|
||||
case BlipData::Pickup:
|
||||
object = world->pickupPool.find(blip.second.target);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
GameObject* object = world->getBlipTarget(blip.second);
|
||||
if( object )
|
||||
{
|
||||
blippos = glm::vec2( object->getPosition() );
|
||||
|
Loading…
Reference in New Issue
Block a user