# Work around a problem in ATI's binary Linux driver
This was SVN commit r3789.
This commit is contained in:
parent
8f02c6f10d
commit
8bb97e63cd
@ -55,7 +55,7 @@ void cpu_init()
|
||||
// possible. that means only zero-divide, because the JS engine is
|
||||
// triggering the rest.
|
||||
// note: passing a flag *disables* that exception.
|
||||
ia32_control87(IA32_EM_INVALID|IA32_EM_DENORMAL|IA32_EM_OVERFLOW|IA32_EM_UNDERFLOW|IA32_EM_INEXACT, IA32_MCW_EM);
|
||||
ia32_control87(IA32_EM_ZERODIVIDE|IA32_EM_INVALID|IA32_EM_DENORMAL|IA32_EM_OVERFLOW|IA32_EM_UNDERFLOW|IA32_EM_INEXACT, IA32_MCW_EM);
|
||||
|
||||
// no longer round toward zero (truncate). changing this setting
|
||||
// resulted in much faster float->int casts, because the compiler
|
||||
|
@ -57,7 +57,7 @@ int unix_get_cpu_info()
|
||||
LibError sys_on_each_cpu(void(*cb)())
|
||||
{
|
||||
UNUSED2(cb);
|
||||
|
||||
|
||||
return ERR_NO_SYS;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ LibError sys_error_description_r(int err, char* buf, size_t max_chars)
|
||||
UNUSED2(err);
|
||||
UNUSED2(buf);
|
||||
UNUSED2(max_chars);
|
||||
|
||||
|
||||
// don't need to do anything: lib/errors.cpp already queries
|
||||
// libc's strerror(). if we ever end up needing translation of
|
||||
// e.g. Qt or X errors, that'd go here.
|
||||
@ -150,12 +150,12 @@ LibError sys_cursor_create_empty(void **cursor)
|
||||
/* bitmap for a fully transparent cursor */
|
||||
u8 data[] = {0};
|
||||
u8 mask[] = {0};
|
||||
|
||||
|
||||
// size 8x1 (cursor size must be a whole number of bytes ^^)
|
||||
// hotspot at 0,0
|
||||
// SDL will make its own copies of data and mask
|
||||
*cursor=SDL_CreateCursor(data, mask, 8, 1, 0, 0);
|
||||
|
||||
|
||||
return cursor?ERR_OK:ERR_FAIL;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ void CSelectedEntities::removeSelection( HEntity entity )
|
||||
std::vector<HEntity>::iterator it;
|
||||
for( it = m_selected.begin(); it < m_selected.end(); it++ )
|
||||
{
|
||||
if( (*it) == entity )
|
||||
if( (*it) == entity )
|
||||
{
|
||||
m_selected.erase( it );
|
||||
m_selectionChanged = true;
|
||||
@ -170,7 +170,7 @@ void CSelectedEntities::renderOverlays()
|
||||
if( (*it)->m_grouped != -1 )
|
||||
{
|
||||
if( !(*it)->m_bounds ) continue;
|
||||
|
||||
|
||||
glLoadIdentity();
|
||||
float x, y;
|
||||
CVector3D labelpos = (*it)->m_graphics_position - pCamera->m_Orientation.GetLeft() * (*it)->m_bounds->m_radius;
|
||||
@ -182,7 +182,7 @@ void CSelectedEntities::renderOverlays()
|
||||
glTranslatef( x, g_Renderer.GetHeight() - y, 0.0f );
|
||||
glScalef( 1.0f, -1.0f, 1.0f );
|
||||
glwprintf( L"%d", (i32) (*it)->m_grouped );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if( m_group_highlight != -1 )
|
||||
@ -194,7 +194,7 @@ void CSelectedEntities::renderOverlays()
|
||||
for( it = m_groups[m_group_highlight].begin(); it < m_groups[m_group_highlight].end(); it++ )
|
||||
{
|
||||
if( !(*it)->m_bounds ) continue;
|
||||
|
||||
|
||||
glLoadIdentity();
|
||||
float x, y;
|
||||
CVector3D labelpos = (*it)->m_graphics_position - pCamera->m_Orientation.GetLeft() * (*it)->m_bounds->m_radius;
|
||||
@ -262,7 +262,7 @@ void CSelectedEntities::removeAll( HEntity entity )
|
||||
std::vector<HEntity>::iterator it;
|
||||
for( it = m_selected.begin(); it < m_selected.end(); it++ )
|
||||
{
|
||||
if( (*it) == entity )
|
||||
if( (*it) == entity )
|
||||
{
|
||||
m_selected.erase( it );
|
||||
m_selectionChanged = true;
|
||||
@ -273,7 +273,7 @@ void CSelectedEntities::removeAll( HEntity entity )
|
||||
{
|
||||
for( it = m_groups[group].begin(); it < m_groups[group].end(); it++ )
|
||||
{
|
||||
if( (*it) == entity )
|
||||
if( (*it) == entity )
|
||||
{
|
||||
m_groups[group].erase( it );
|
||||
m_selectionChanged = true;
|
||||
@ -298,7 +298,7 @@ void CSelectedEntities::saveGroup( i8 groupid )
|
||||
// Clear all entities in the group...
|
||||
for( it = m_groups[groupid].begin(); it < m_groups[groupid].end(); it++ )
|
||||
(*it)->m_grouped = -1;
|
||||
|
||||
|
||||
m_groups[groupid].clear();
|
||||
// Remove selected entities from each group they're in, and flag them as
|
||||
// members of the new group
|
||||
@ -392,7 +392,7 @@ void CSelectedEntities::changeGroup( HEntity entity, i8 groupid )
|
||||
std::vector<HEntity>::iterator it;
|
||||
for( it = m_groups[current].begin(); it < m_groups[current].end(); it++ )
|
||||
{
|
||||
if( (*it) == entity )
|
||||
if( (*it) == entity )
|
||||
{
|
||||
m_groups[current].erase( it );
|
||||
break;
|
||||
@ -409,7 +409,7 @@ bool CSelectedEntities::isSelected( HEntity entity )
|
||||
std::vector<HEntity>::iterator it;
|
||||
for( it = m_selected.begin(); it < m_selected.end(); it++ )
|
||||
{
|
||||
if( (*it) == entity )
|
||||
if( (*it) == entity )
|
||||
return( true );
|
||||
}
|
||||
return( false );
|
||||
@ -451,7 +451,7 @@ CVector3D CSelectedEntities::getGroupPosition( i8 groupid )
|
||||
void CSelectedEntities::update()
|
||||
{
|
||||
static std::vector<HEntity> lastSelection;
|
||||
|
||||
|
||||
// Drop out immediately if we're in some special interaction mode
|
||||
if (customSelectionMode)
|
||||
return;
|
||||
@ -459,7 +459,7 @@ void CSelectedEntities::update()
|
||||
if( !( m_selected == lastSelection ) )
|
||||
{
|
||||
g_JSGameEvents.FireSelectionChanged( m_selectionChanged );
|
||||
lastSelection = m_selected;
|
||||
lastSelection = m_selected;
|
||||
}
|
||||
|
||||
if( m_selectionChanged || g_Mouseover.m_targetChanged )
|
||||
@ -471,7 +471,7 @@ void CSelectedEntities::update()
|
||||
m_secondaryCommand = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Quick count to see which is the modal default order.
|
||||
|
||||
const int numCommands=NMT_COMMAND_LAST - NMT_COMMAND_FIRST;
|
||||
@ -497,7 +497,7 @@ void CSelectedEntities::update()
|
||||
(*it)->DispatchEvent( &evt );
|
||||
vote = evt.m_defaultOrder - NMT_COMMAND_FIRST;
|
||||
secvote = evt.m_secondaryOrder - NMT_COMMAND_FIRST;
|
||||
|
||||
|
||||
if( ( vote >= 0 ) && ( vote < numCommands ) )
|
||||
{
|
||||
defaultPoll[vote]++;
|
||||
@ -537,7 +537,7 @@ void CSelectedEntities::update()
|
||||
g_CursorName = itv->first;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
TODO: provide secondary cursor name?
|
||||
|
||||
@ -549,7 +549,7 @@ void CSelectedEntities::update()
|
||||
t = itv->second;
|
||||
g_CursorName = itv->first;
|
||||
}
|
||||
}*/
|
||||
}*/
|
||||
|
||||
// Find the most appropriate action parameter too
|
||||
t = 0;
|
||||
@ -561,7 +561,7 @@ void CSelectedEntities::update()
|
||||
m_defaultAction = iti->first;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
t = 0;
|
||||
for( iti = secondaryAction[secvote].begin(); iti != secondaryAction[secvote].end(); iti++ )
|
||||
{
|
||||
@ -590,7 +590,7 @@ void CMouseoverEntities::update( float timestep )
|
||||
pCamera->BuildCameraRay( origin, dir );
|
||||
|
||||
CUnit* hit = g_UnitMan.PickUnit( origin, dir );
|
||||
|
||||
|
||||
m_worldposition = pCamera->GetWorldCoordinates();
|
||||
|
||||
if( hit && hit->GetEntity() && hit->GetEntity()->m_extant )
|
||||
@ -617,7 +617,7 @@ void CMouseoverEntities::update( float timestep )
|
||||
|
||||
std::vector<HEntity>* onscreen = g_EntityManager.matches( isOnScreen );
|
||||
std::vector<HEntity>::iterator it;
|
||||
|
||||
|
||||
for( it = onscreen->begin(); it < onscreen->end(); it++ )
|
||||
if( (*it)->m_extant && ( (*it)->GetPlayer() == g_Game->GetLocalPlayer() ) )
|
||||
m_mouseover.push_back( SMouseoverFader( *it, m_fademaximum, false ) );
|
||||
@ -667,7 +667,7 @@ void CMouseoverEntities::update( float timestep )
|
||||
{
|
||||
inBox = ( x >= m_x2 ) && ( x < m_x1 );
|
||||
}
|
||||
|
||||
|
||||
if( m_y1 < m_y2 )
|
||||
{
|
||||
inBox &= ( y >= m_y1 ) && ( y < m_y2 );
|
||||
@ -676,7 +676,7 @@ void CMouseoverEntities::update( float timestep )
|
||||
{
|
||||
inBox &= ( y >= m_y2 ) && ( y < m_y1 );
|
||||
}
|
||||
|
||||
|
||||
if( inBox )
|
||||
{
|
||||
bool found = false;
|
||||
@ -692,7 +692,7 @@ void CMouseoverEntities::update( float timestep )
|
||||
}
|
||||
}
|
||||
delete( onscreen );
|
||||
|
||||
|
||||
for( it2 = m_mouseover.begin(); it2 < m_mouseover.end(); )
|
||||
{
|
||||
it2->fade -= m_fadeoutrate * timestep;
|
||||
@ -743,17 +743,17 @@ void CMouseoverEntities::addSelection()
|
||||
{
|
||||
// Rules for shift-click selection:
|
||||
|
||||
// If selecting a non-allied unit, you can only select one. You can't
|
||||
// If selecting a non-allied unit, you can only select one. You can't
|
||||
// select a mix of allied and non-allied units. Therefore:
|
||||
// Forbid shift-click of enemy units unless the selection is empty
|
||||
// Forbid shift-click of allied units if the selection contains one
|
||||
// or more enemy units.
|
||||
|
||||
if( ( m_mouseover.size() != 0 ) &&
|
||||
( m_mouseover.front().entity->GetPlayer() != g_Game->GetLocalPlayer() ) &&
|
||||
( m_mouseover.front().entity->GetPlayer() != g_Game->GetLocalPlayer() ) &&
|
||||
( g_Selection.m_selected.size() != 0 ) )
|
||||
return;
|
||||
|
||||
|
||||
if( ( g_Selection.m_selected.size() != 0 ) &&
|
||||
( g_Selection.m_selected.front()->GetPlayer() != g_Game->GetLocalPlayer() ) )
|
||||
return;
|
||||
@ -780,7 +780,7 @@ void CMouseoverEntities::setSelection()
|
||||
|
||||
void CMouseoverEntities::expandAcrossScreen()
|
||||
{
|
||||
std::vector<HEntity>* activeset = g_EntityManager.matches(
|
||||
std::vector<HEntity>* activeset = g_EntityManager.matches(
|
||||
CEntityManager::EntityPredicateLogicalAnd<isMouseoverType,isOnScreen> );
|
||||
m_mouseover.clear();
|
||||
std::vector<HEntity>::iterator it;
|
||||
@ -858,11 +858,13 @@ void CMouseoverEntities::renderBarBorders()
|
||||
|
||||
glDisable( GL_BLEND );
|
||||
}
|
||||
|
||||
// Helper function for CSelectedEntities::loadUnitUITextures
|
||||
static void LoadUnitUIThunk( const char* path, const DirEnt* UNUSED(ent), void* context )
|
||||
{
|
||||
std::map<CStr, Handle>* textures = (std::map<CStr, Handle>*) context;
|
||||
CStr name(path);
|
||||
|
||||
|
||||
if ( !tex_is_known_extension(path) )
|
||||
{
|
||||
if ( name.BeforeLast(".") == name ) //this is a directory (contains no ".")
|
||||
@ -872,7 +874,7 @@ static void LoadUnitUIThunk( const char* path, const DirEnt* UNUSED(ent), void*
|
||||
}
|
||||
Handle tmp = ogl_tex_load(path);
|
||||
if (tmp <= 0)
|
||||
{
|
||||
{
|
||||
LOG(ERROR, LOG_CATEGORY, "Rank Textures", "loadRankTextures failed on \"%s\"", path);
|
||||
return;
|
||||
}
|
||||
@ -914,7 +916,7 @@ void CMouseoverEntities::renderOverlays()
|
||||
//glPopMatrix();
|
||||
}
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
|
||||
|
||||
std::vector<SMouseoverFader>::iterator it;
|
||||
for( it = m_mouseover.begin(); it < m_mouseover.end(); it++ )
|
||||
{
|
||||
@ -958,7 +960,7 @@ void FireWorldClickEvent(uint button, int clicks)
|
||||
|
||||
if ( g_Selection.m_mouseOverMM )
|
||||
return;
|
||||
|
||||
|
||||
g_JSGameEvents.FireWorldClick(
|
||||
button,
|
||||
clicks,
|
||||
@ -969,7 +971,7 @@ void FireWorldClickEvent(uint button, int clicks)
|
||||
g_Mouseover.m_target,
|
||||
(uint)g_Mouseover.m_worldposition.x,
|
||||
(uint)g_Mouseover.m_worldposition.y);
|
||||
|
||||
|
||||
//Reset duplication flag- after this, it isn't the same order
|
||||
std::vector<HEntity>::iterator it=g_Selection.m_selected.begin();
|
||||
for ( ; it != g_Selection.m_selected.end(); it++ )
|
||||
@ -982,7 +984,7 @@ void FireWorldClickEvent(uint button, int clicks)
|
||||
void MouseButtonUpHandler(const SDL_Event *ev, int clicks)
|
||||
{
|
||||
FireWorldClickEvent(ev->button.button, clicks);
|
||||
|
||||
|
||||
switch( ev->button.button )
|
||||
{
|
||||
case SDL_BUTTON_LEFT:
|
||||
@ -994,7 +996,7 @@ void MouseButtonUpHandler(const SDL_Event *ev, int clicks)
|
||||
|
||||
if (customSelectionMode)
|
||||
break;
|
||||
|
||||
|
||||
if( g_Mouseover.m_viewall )
|
||||
break;
|
||||
|
||||
@ -1060,12 +1062,12 @@ InReaction interactInputHandler( const SDL_Event* ev )
|
||||
static double button_down_time;
|
||||
static bool button_down = false;
|
||||
static bool right_button_down = false;
|
||||
|
||||
|
||||
if (customSelectionMode && ev->type != SDL_MOUSEBUTTONUP)
|
||||
return IN_PASS;
|
||||
|
||||
|
||||
switch( ev->type )
|
||||
{
|
||||
{
|
||||
case SDL_HOTKEYDOWN:
|
||||
switch( ev->user.code )
|
||||
{
|
||||
@ -1090,7 +1092,7 @@ InReaction interactInputHandler( const SDL_Event* ev )
|
||||
break;
|
||||
|
||||
std::vector<CModel::Prop>& Props = g_Selection.m_selected.front()->m_actor->GetModel()->GetProps();
|
||||
|
||||
|
||||
for (size_t x=0; x<Props.size(); x++)
|
||||
{
|
||||
if( Props[x].m_Point->m_Name == "head" )
|
||||
@ -1113,7 +1115,7 @@ InReaction interactInputHandler( const SDL_Event* ev )
|
||||
}
|
||||
if ( g_Selection.m_selected.empty() )
|
||||
break;
|
||||
|
||||
|
||||
pView->AttachToUnit( g_Selection.m_selected.front() );
|
||||
break;
|
||||
}
|
||||
@ -1124,7 +1126,7 @@ InReaction interactInputHandler( const SDL_Event* ev )
|
||||
// The above test limits it to 20 groups, so don't worry about overflowing
|
||||
|
||||
i8 id = (i8)( ev->user.code - HOTKEY_SELECTION_GROUP_0 );
|
||||
|
||||
|
||||
if( hotkeys[HOTKEY_SELECTION_GROUP_ADD] )
|
||||
{
|
||||
g_Selection.addGroup( id );
|
||||
@ -1176,7 +1178,7 @@ InReaction interactInputHandler( const SDL_Event* ev )
|
||||
double time = get_time();
|
||||
// Reset clicks counter if too slow or if the cursor's
|
||||
// hovering over something else now.
|
||||
|
||||
|
||||
if( time - lastclicktime[button] >= SELECT_DBLCLICK_RATE )
|
||||
clicks[button] = 0;
|
||||
if( g_Mouseover.m_target != lastclickobject[button] )
|
||||
@ -1291,7 +1293,7 @@ bool CBuildingPlacer::activate(CStrW& templateName)
|
||||
std::set<CStrW> selections;
|
||||
m_actor = g_UnitMan.CreateUnit( actorName, 0, selections );
|
||||
m_actor->SetPlayerID(g_Game->GetLocalPlayer()->GetPlayerID());
|
||||
|
||||
|
||||
// m_bounds
|
||||
if( base->m_bound_type == CBoundingObject::BOUND_CIRCLE )
|
||||
{
|
||||
@ -1316,7 +1318,7 @@ void CBuildingPlacer::mouseReleased()
|
||||
{
|
||||
deactivate(); // do it first in case we fail for any reason
|
||||
|
||||
if(m_valid)
|
||||
if(m_valid)
|
||||
{
|
||||
HEntity ent = g_EntityManager.createFoundation( m_templateName, clickPos, m_angle );
|
||||
ent->SetPlayer(g_Game->GetLocalPlayer());
|
||||
@ -1348,7 +1350,7 @@ void CBuildingPlacer::update( float timeStep )
|
||||
CVector3D dif = mousePos - clickPos;
|
||||
float x = dif.X, z = dif.Z;
|
||||
if(x*x + z*z < 3*3) {
|
||||
if(m_dragged || m_timeSinceClick > 0.2f)
|
||||
if(m_dragged || m_timeSinceClick > 0.2f)
|
||||
{
|
||||
m_angle += timeStep * PI;
|
||||
}
|
||||
@ -1361,7 +1363,7 @@ void CBuildingPlacer::update( float timeStep )
|
||||
}
|
||||
|
||||
CVector3D pos;
|
||||
if(m_clicked)
|
||||
if(m_clicked)
|
||||
{
|
||||
pos = clickPos;
|
||||
}
|
||||
@ -1382,7 +1384,7 @@ void CBuildingPlacer::update( float timeStep )
|
||||
|
||||
m_bounds->setPosition(pos.X, pos.Z);
|
||||
|
||||
if(m_bounds->m_type == CBoundingObject::BOUND_OABB)
|
||||
if(m_bounds->m_type == CBoundingObject::BOUND_OABB)
|
||||
{
|
||||
CBoundingBox* box = (CBoundingBox*) m_bounds;
|
||||
box->setOrientation(m_angle);
|
||||
@ -1396,7 +1398,7 @@ void CBuildingPlacer::update( float timeStep )
|
||||
{
|
||||
col = CColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
float add = (sin(4*PI*m_totalTime) + 1.0f) * 0.08f;
|
||||
col = CColor(1.4f+add, 0.4f+add, 0.4f+add, 1.0f);
|
||||
@ -1412,7 +1414,7 @@ void CBuildingPlacer::render()
|
||||
return;
|
||||
|
||||
CVector3D pos;
|
||||
if(m_clicked)
|
||||
if(m_clicked)
|
||||
{
|
||||
pos = clickPos;
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, cons
|
||||
m_orientation = orientation;
|
||||
m_ahead.x = sin( m_orientation );
|
||||
m_ahead.y = cos( m_orientation );
|
||||
|
||||
/* Anything added to this list MUST be added to BaseEntity.cpp (and variables used should
|
||||
|
||||
/* Anything added to this list MUST be added to BaseEntity.cpp (and variables used should
|
||||
also be added to BaseEntity.h */
|
||||
|
||||
AddProperty( L"actions.move.speed", &m_speed );
|
||||
@ -68,7 +68,7 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, cons
|
||||
AddProperty( L"traits.health.regen_rate", &m_healthRegenRate );
|
||||
AddProperty( L"traits.health.regen_start", &m_healthRegenStart );
|
||||
AddProperty( L"traits.health.decay_rate", &m_healthDecayRate );
|
||||
|
||||
|
||||
AddProperty( L"traits.stamina.curr", &m_staminaCurr );
|
||||
AddProperty( L"traits.stamina.max", &m_staminaMax );
|
||||
AddProperty( L"traits.stamina.bar_height", &m_staminaBarHeight );
|
||||
@ -106,11 +106,11 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, cons
|
||||
// setting to what seems to be a reasonable default.
|
||||
m_sectorDivs = 4;
|
||||
if ( m_sectorDivs >= 0 )
|
||||
{
|
||||
{
|
||||
m_sectorAngles.resize(m_sectorDivs);
|
||||
m_sectorValues.resize(m_sectorDivs);
|
||||
float step = DEGTORAD(360.0f / m_sectorDivs);
|
||||
|
||||
|
||||
for ( int i=0; i<m_sectorDivs; ++i )
|
||||
{
|
||||
m_sectorAngles[i] = cosf( step*i );
|
||||
@ -157,7 +157,7 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, cons
|
||||
m_currentNotification = 0;
|
||||
m_currentRequest = 0;
|
||||
m_destroyNotifiers = true;
|
||||
|
||||
|
||||
m_formationSlot = -1;
|
||||
m_formation = -1;
|
||||
m_grouped = -1;
|
||||
@ -189,11 +189,11 @@ CEntity::~CEntity()
|
||||
delete it->second;
|
||||
}
|
||||
m_auras.clear();
|
||||
|
||||
|
||||
for ( size_t i=0; i<m_listeners.size(); i++ )
|
||||
m_listeners[i].m_sender->DestroyNotifier( this );
|
||||
DestroyAllNotifiers();
|
||||
|
||||
|
||||
CEntity* remove = this;
|
||||
g_FormationManager.RemoveUnit(remove);
|
||||
}
|
||||
@ -237,12 +237,12 @@ void CEntity::loadBase()
|
||||
void CEntity::kill()
|
||||
{
|
||||
g_Selection.removeAll( me );
|
||||
|
||||
|
||||
CEntity* remove = this;
|
||||
g_FormationManager.RemoveUnit(remove);
|
||||
|
||||
|
||||
DestroyAllNotifiers();
|
||||
|
||||
|
||||
if( m_bounds )
|
||||
delete( m_bounds );
|
||||
m_bounds = NULL;
|
||||
@ -258,9 +258,9 @@ void CEntity::kill()
|
||||
delete( m_actor );
|
||||
m_actor = NULL;
|
||||
}
|
||||
|
||||
|
||||
updateCollisionPatch();
|
||||
|
||||
|
||||
|
||||
me = HEntity(); // will deallocate the entity, assuming nobody else has a reference to it
|
||||
}
|
||||
@ -382,13 +382,13 @@ void CEntity::update( size_t timestep )
|
||||
{
|
||||
m_position_previous = m_position;
|
||||
m_orientation_previous = m_orientation;
|
||||
|
||||
|
||||
CalculateRun( timestep );
|
||||
CalculateHealth( timestep );
|
||||
|
||||
|
||||
if ( m_triggerRun )
|
||||
m_frameCheck++;
|
||||
|
||||
|
||||
if ( m_frameCheck != 0 )
|
||||
{
|
||||
m_shouldRun = true;
|
||||
@ -728,7 +728,7 @@ void CEntity::pushOrder( CEntityOrder& order )
|
||||
if( DispatchEvent(&evt) )
|
||||
{
|
||||
m_orderQueue.push_back( order );
|
||||
if(evt.m_notifyType != CEntityListener::NOTIFY_NONE)
|
||||
if(evt.m_notifyType != CEntityListener::NOTIFY_NONE)
|
||||
{
|
||||
CheckListeners( evt.m_notifyType, evt.m_notifySource );
|
||||
}
|
||||
@ -1101,25 +1101,25 @@ void CEntity::renderBarBorders()
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, g_Renderer.m_Options.m_LodBias);
|
||||
|
||||
|
||||
if ( g_Selection.m_unitUITextures.find(m_healthBorderName) != g_Selection.m_unitUITextures.end() )
|
||||
{
|
||||
ogl_tex_bind( g_Selection.m_unitUITextures[m_healthBorderName] );
|
||||
CVector2D pos = getScreenCoords( m_healthBarHeight );
|
||||
|
||||
|
||||
float left = pos.x - m_healthBorderWidth/2;
|
||||
float right = pos.x + m_healthBorderWidth/2;
|
||||
pos.y = g_yres - pos.y;
|
||||
float bottom = pos.y + m_healthBorderHeight/2;
|
||||
float top = pos.y - m_healthBorderHeight/2;
|
||||
|
||||
float top = pos.y - m_healthBorderHeight/2;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( left, bottom, 0 );
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( left, top, 0 );
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f( right, top, 0 );
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f( right, bottom, 0 );
|
||||
|
||||
|
||||
glEnd();
|
||||
}
|
||||
if ( g_Selection.m_unitUITextures.find(m_staminaBorderName) != g_Selection.m_unitUITextures.end() )
|
||||
@ -1130,15 +1130,15 @@ void CEntity::renderBarBorders()
|
||||
float right = pos.x + m_staminaBorderWidth/2;
|
||||
pos.y = g_yres - pos.y;
|
||||
float bottom = pos.y + m_staminaBorderHeight/2;
|
||||
float top = pos.y - m_staminaBorderHeight/2;
|
||||
|
||||
float top = pos.y - m_staminaBorderHeight/2;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( left, bottom, 0 );
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( left, top, 0 );
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f( right, top, 0 );
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f( right, bottom, 0 );
|
||||
|
||||
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
@ -1148,7 +1148,7 @@ void CEntity::renderHealthBar()
|
||||
return;
|
||||
if( m_healthBarHeight < 0 )
|
||||
return; // negative bar height means don't display health bar
|
||||
|
||||
|
||||
float fraction;
|
||||
if(m_healthMax == 0) fraction = 1.0f;
|
||||
else fraction = clamp(m_healthCurr / m_healthMax, 0.0f, 1.0f);
|
||||
@ -1157,7 +1157,7 @@ void CEntity::renderHealthBar()
|
||||
float x1 = pos.x - m_healthBarSize/2;
|
||||
float x2 = pos.x + m_healthBarSize/2;
|
||||
float y = g_yres - pos.y;
|
||||
|
||||
|
||||
glLineWidth( m_healthBarWidth );
|
||||
glBegin(GL_LINES);
|
||||
|
||||
@ -1174,9 +1174,9 @@ void CEntity::renderHealthBar()
|
||||
glVertex3f( x2, y, 0 );
|
||||
|
||||
glEnd();
|
||||
|
||||
|
||||
glLineWidth(1.0f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CEntity::renderStaminaBar()
|
||||
@ -1194,7 +1194,7 @@ void CEntity::renderStaminaBar()
|
||||
float x1 = pos.x - m_staminaBarSize/2;
|
||||
float x2 = pos.x + m_staminaBarSize/2;
|
||||
float y = g_yres - pos.y;
|
||||
|
||||
|
||||
glLineWidth( m_staminaBarWidth );
|
||||
glBegin(GL_LINES);
|
||||
|
||||
@ -1222,7 +1222,7 @@ void CEntity::renderRank()
|
||||
//Check for valid texture
|
||||
if( g_Selection.m_unitUITextures.find( m_rankName ) == g_Selection.m_unitUITextures.end() )
|
||||
return;
|
||||
|
||||
|
||||
CCamera *g_Camera=g_Game->GetView()->GetCamera();
|
||||
|
||||
float sx, sy;
|
||||
@ -1237,7 +1237,7 @@ void CEntity::renderRank()
|
||||
float x2 = sx + m_healthBarSize/2 + 2*size;
|
||||
float y1 = g_yres - (sy - size); //top
|
||||
float y2 = g_yres - (sy + size); //bottom
|
||||
|
||||
|
||||
ogl_tex_bind(g_Selection.m_unitUITextures[m_rankName]);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
|
||||
@ -1568,8 +1568,8 @@ bool CEntity::Kill( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(arg
|
||||
|
||||
clearOrders();
|
||||
|
||||
g_EntityManager.SetDeath(true);
|
||||
|
||||
g_EntityManager.SetDeath(true);
|
||||
|
||||
|
||||
if( m_actor )
|
||||
{
|
||||
@ -1774,7 +1774,7 @@ bool CEntity::RequestNotification( JSContext* cx, uintN argc, jsval* argv )
|
||||
JS_ReportError( cx, "Too few parameters" );
|
||||
return( false );
|
||||
}
|
||||
|
||||
|
||||
CEntityListener notify;
|
||||
CEntity *target = ToNative<CEntity>( argv[0] );
|
||||
(int&)notify.m_type = ToPrimitive<int>( argv[1] );
|
||||
@ -1784,7 +1784,7 @@ bool CEntity::RequestNotification( JSContext* cx, uintN argc, jsval* argv )
|
||||
|
||||
if (target == this)
|
||||
return false;
|
||||
|
||||
|
||||
notify.m_sender = this;
|
||||
|
||||
//Clean up old requests
|
||||
@ -1797,7 +1797,7 @@ bool CEntity::RequestNotification( JSContext* cx, uintN argc, jsval* argv )
|
||||
m_currentRequest = notify.m_type;
|
||||
m_notifiers.push_back( target );
|
||||
int result = target->m_currentNotification & notify.m_type;
|
||||
|
||||
|
||||
//If our target isn't stationary and it's doing something we want to follow, send notification
|
||||
if ( result && !target->m_orderQueue.empty() )
|
||||
{
|
||||
@ -1808,7 +1808,7 @@ bool CEntity::RequestNotification( JSContext* cx, uintN argc, jsval* argv )
|
||||
case CEntityListener::NOTIFY_RUN:
|
||||
DispatchNotification( order, result );
|
||||
break;
|
||||
|
||||
|
||||
case CEntityListener::NOTIFY_HEAL:
|
||||
case CEntityListener::NOTIFY_ATTACK:
|
||||
case CEntityListener::NOTIFY_GATHER:
|
||||
@ -1822,12 +1822,12 @@ bool CEntity::RequestNotification( JSContext* cx, uintN argc, jsval* argv )
|
||||
target->m_listeners.push_back( notify );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
target->m_listeners.push_back( notify );
|
||||
return false;
|
||||
}
|
||||
bool CEntity::ForceCheckListeners( JSContext *cx, uintN argc, jsval* argv )
|
||||
{
|
||||
{
|
||||
if( argc < 2 )
|
||||
{
|
||||
JS_ReportError( cx, "Too few parameters" );
|
||||
@ -1835,7 +1835,7 @@ bool CEntity::ForceCheckListeners( JSContext *cx, uintN argc, jsval* argv )
|
||||
}
|
||||
int type = ToPrimitive<int>( argv[0] ); //notify code
|
||||
m_currentNotification = type;
|
||||
|
||||
|
||||
CEntity *target = ToNative<CEntity>( argv[1] );
|
||||
if ( target->m_orderQueue.empty() )
|
||||
return false;
|
||||
@ -1849,7 +1849,7 @@ bool CEntity::ForceCheckListeners( JSContext *cx, uintN argc, jsval* argv )
|
||||
switch( result )
|
||||
{
|
||||
case CEntityListener::NOTIFY_GOTO:
|
||||
case CEntityListener::NOTIFY_RUN:
|
||||
case CEntityListener::NOTIFY_RUN:
|
||||
case CEntityListener::NOTIFY_HEAL:
|
||||
case CEntityListener::NOTIFY_ATTACK:
|
||||
case CEntityListener::NOTIFY_GATHER:
|
||||
@ -1857,7 +1857,7 @@ bool CEntity::ForceCheckListeners( JSContext *cx, uintN argc, jsval* argv )
|
||||
case CEntityListener::NOTIFY_IDLE: //target should be 'this'
|
||||
m_listeners[i].m_sender->DispatchNotification( order, result );
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
JS_ReportError( cx, "Invalid order type" );
|
||||
break;
|
||||
@ -1867,13 +1867,13 @@ bool CEntity::ForceCheckListeners( JSContext *cx, uintN argc, jsval* argv )
|
||||
return true;
|
||||
}
|
||||
void CEntity::CheckListeners( int type, CEntity *target)
|
||||
{
|
||||
{
|
||||
m_currentNotification = type;
|
||||
|
||||
|
||||
debug_assert(target);
|
||||
if ( target->m_orderQueue.empty() )
|
||||
return;
|
||||
|
||||
|
||||
CEntityOrder order = target->m_orderQueue.front();
|
||||
for (size_t i=0; i<m_listeners.size(); i++)
|
||||
{
|
||||
@ -1883,7 +1883,7 @@ void CEntity::CheckListeners( int type, CEntity *target)
|
||||
switch( result )
|
||||
{
|
||||
case CEntityListener::NOTIFY_GOTO:
|
||||
case CEntityListener::NOTIFY_RUN:
|
||||
case CEntityListener::NOTIFY_RUN:
|
||||
case CEntityListener::NOTIFY_HEAL:
|
||||
case CEntityListener::NOTIFY_ATTACK:
|
||||
case CEntityListener::NOTIFY_GATHER:
|
||||
@ -1969,7 +1969,7 @@ jsval CEntity::RegisterDamage( JSContext* cx, uintN argc, jsval* argv )
|
||||
CEntity* inflictor = ToNative<CEntity>( argv[0] );
|
||||
CVector2D up(1.0f, 0.0f);
|
||||
CVector2D pos = CVector2D( inflictor->m_position.X, inflictor->m_position.Z );
|
||||
CVector2D posDelta = (pos - m_position).normalize();
|
||||
CVector2D posDelta = (pos - m_position).normalize();
|
||||
|
||||
float angle = up.dot(posDelta);
|
||||
//Find what section it is between and "activate" it
|
||||
@ -1994,7 +1994,7 @@ jsval CEntity::RegisterIdle( JSContext* cx, uintN argc, jsval* argv )
|
||||
|
||||
CVector2D up(1.0f, 0.0f);
|
||||
CVector2D pos = CVector2D( idleEntity->m_position.X, idleEntity->m_position.Z );
|
||||
CVector2D posDelta = (pos - m_position).normalize();
|
||||
CVector2D posDelta = (pos - m_position).normalize();
|
||||
|
||||
float angle = up.dot(posDelta);
|
||||
//Find what section it is between and "activate" it
|
||||
|
Loading…
Reference in New Issue
Block a user