/*! Get max joint values. \return Maximal joint values for the 4 dof X, Y, A, B. Translation Y is expressed in meters. Rotations X, A and B in radians. */ vpColVector vpAfma4::getJointMax() const { vpColVector qmax(4); for (unsigned int i=0; i < 4; i ++) qmax[i] = this->_joint_max[i]; return qmax; }
bool checkURDF2DHForAGivenChain(const KDL::CoDyCo::UndirectedTree& undirectedTree, const std::string& base_frame, const std::string& end_effector_frame) { KDL::Chain kdl_chain; iCub::iKin::iKinLimb ikin_limb; //cerr << "urdf2dh test testing chain extraction between " << base_frame // << " and " << end_effector_frame << endl; KDL::Tree kdl_rotated_tree = undirectedTree.getTree(base_frame); bool result = kdl_rotated_tree.getChain(base_frame,end_effector_frame,kdl_chain); if( !result ) { cerr << "urdf2dh: Impossible to find " << base_frame << " or " << end_effector_frame << " in the URDF." << endl; return false; } // // Convert the chain and the limits to an iKin chain (i.e. DH parameters) // KDL::JntArray qmin(kdl_chain.getNrOfJoints()),qmax(kdl_chain.getNrOfJoints()); for(size_t i=0; i < qmin.rows(); i++ ) { qmin(i) = -10.0; qmax(i) = 10.0; } result = iKinLimbFromKDLChain(kdl_chain,ikin_limb,qmin,qmax,1000); if( !result ) { cerr << "urdf2dh: Could not export KDL::Tree to iKinChain" << endl; return false; } return checkChainsAreEqual(kdl_chain,ikin_limb); }
/* =============== Sbar_DrawInventory =============== */ void Sbar_DrawInventory(void) { int i; char num[6]; float time; int flashon; qboolean headsup; qboolean hudswap; headsup = !(cl_sbar.value || scr_viewsize.value < 100); hudswap = cl_hudswap.value; // Get that nasty float out :) if (!headsup) Sbar_DrawPic(0, -24, sb_ibar); // weapons for (i = 0; i < 7; i++) { if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) { time = cl.item_gettime[i]; flashon = qmax((int)((cl.time - time) * 10), 0); if (flashon >= 10) { if (cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN << i)) flashon = 1; else flashon = 0; } else flashon = (flashon % 5) + 2; if (headsup) { if (i || vid.height > 200) Sbar_DrawSubPic((hudswap) ? 0 : (vid.width - 24), -68 - (7 - i) * 16, sb_weapons[flashon][i], 0, 0, 24, 16); } else Sbar_DrawPic(i * 24, -16, sb_weapons[flashon][i]); // Sbar_DrawSubPic (0,0,20,20,i*24, -16, sb_weapons[flashon][i]); if (flashon > 1) sb_updates = 0; // force update to remove flash } } // ammo counts for (i = 0; i < 4; i++) { sprintf(num, "%3i", cl.stats[STAT_SHELLS + i]); if (headsup) { // Sbar_DrawSubPic(3, -24, sb_ibar, 3, 0, 42,11); Sbar_DrawSubPic((hudswap) ? 0 : (vid.width - 42), -24 - (4 - i) * 11, sb_ibar, 3 + (i * 48), 0, 42, 11); if (num[0] != ' ') Sbar_DrawCharacter((hudswap) ? 3 : (vid.width - 39), -24 - (4 - i) * 11, 18 + num[0] - '0'); if (num[1] != ' ') Sbar_DrawCharacter((hudswap) ? 11 : (vid.width - 31), -24 - (4 - i) * 11, 18 + num[1] - '0'); if (num[2] != ' ') Sbar_DrawCharacter((hudswap) ? 19 : (vid.width - 23), -24 - (4 - i) * 11, 18 + num[2] - '0'); } else { if (num[0] != ' ') Sbar_DrawCharacter((6 * i + 1) * 8 - 2, -24, 18 + num[0] - '0'); if (num[1] != ' ') Sbar_DrawCharacter((6 * i + 2) * 8 - 2, -24, 18 + num[1] - '0'); if (num[2] != ' ') Sbar_DrawCharacter((6 * i + 3) * 8 - 2, -24, 18 + num[2] - '0'); } } flashon = 0; // items for (i = 0; i < 6; i++) if (cl.stats[STAT_ITEMS] & (1 << (17 + i))) { time = cl.item_gettime[17 + i]; if (time && time > cl.time - 2 && flashon) { // flash frame sb_updates = 0; } else Sbar_DrawPic(192 + i * 16, -16, sb_items[i]); if (time && time > cl.time - 2) sb_updates = 0; } // sigils for (i = 0; i < 4; i++) if (cl.stats[STAT_ITEMS] & (1 << (28 + i))) { time = cl.item_gettime[28 + i]; if (time && time > cl.time - 2 && flashon) { // flash frame sb_updates = 0; } else Sbar_DrawPic(320 - 32 + i * 8, -16, sb_sigil[i]); if (time && time > cl.time - 2) sb_updates = 0; } }
void checkauto() // Check automatic/timer controlled stuff (Like fighting and regeneration) { // static TIMERVAL checkspawnregions=0; static TIMERVAL checktempfx=0; static TIMERVAL checknpcs=0; static TIMERVAL checktamednpcs=0; static TIMERVAL checknpcfollow=0; static TIMERVAL checkitemstime=0; static TIMERVAL lighttime=0; static TIMERVAL htmltime=0; static TIMERVAL housedecaytimer=0; LOGICAL lightChanged = false; // // Accounts // if (SrvParms->auto_a_reload > 0 && TIMEOUT( Accounts->lasttimecheck + (SrvParms->auto_a_reload*60*MY_CLOCKS_PER_SEC) ) ) Accounts->CheckAccountFile(); // // Weather (change is handled by crontab) // // Calendar // if ( TIMEOUT( uotickcount ) ) { if (Calendar::advanceMinute()) day++; uotickcount=uiCurrentTime+secondsperuominute*MY_CLOCKS_PER_SEC; if (Calendar::g_nMinute%8==0) moon1=(UI08)((moon1+1)%8); if (Calendar::g_nMinute%3==0) moon2=(UI08)((moon2+1)%8); } // // Light // if( TIMEOUT( lighttime ) ) { UI08 lightLevel = worldcurlevel; SI32 timenow = (Calendar::g_nHour * 60) + Calendar::g_nMinute; SI32 dawntime = (Calendar::g_nCurDawnHour * 60) + Calendar::g_nCurDawnMin; SI32 sunsettime = (Calendar::g_nCurSunsetHour * 60) + Calendar::g_nCurSunsetMin; SI32 nighttime = qmin((sunsettime+120), (1439)); SI32 morntime = qmax((dawntime-120), (0)); SI32 const middaytime = 750; // SI32 const midnighttime = 0; // unused variable UI08 dawnlight = (UI08)((((worlddarklevel - worldbrightlevel))/3) + worldbrightlevel); // // default lights at dawn and sunset // if ( timenow == dawntime || timenow==sunsettime ) lightLevel = dawnlight; // // highest light at midday // else if( timenow == middaytime ) lightLevel = (UI08) qmax(worldbrightlevel-1, 0); // // darkest light during night // else if( timenow >= nighttime ) lightLevel = worlddarklevel; // else if( timenow <= morntime ) lightLevel = worlddarklevel; // // fading light slight before dawn // else if( timenow > morntime && timenow < dawntime ) lightLevel = (UI08)linInterpolation(morntime, worlddarklevel, dawntime, dawnlight, timenow); // // fading light slight from dawn to midday else if( timenow > dawntime && timenow < middaytime ) lightLevel = (UI08)linInterpolation(dawntime, dawnlight, middaytime, worldbrightlevel, timenow); // // fading light slight from midday to sunset // else if( timenow > middaytime && timenow < sunsettime ) lightLevel = (UI08)linInterpolation(middaytime, worldbrightlevel, sunsettime, dawnlight, timenow); // // fading light slight from sunset to night // else if( timenow > sunsettime && timenow < nighttime ) lightLevel = (UI08)linInterpolation(sunsettime, dawnlight, nighttime, worlddarklevel, timenow); if (wtype) lightLevel += 2; if (moon1+moon2<4) ++lightLevel; if (moon1+moon2<10) ++lightLevel; if (lightLevel != worldcurlevel) { worldcurlevel = lightLevel; lightChanged = true; } lighttime=uiCurrentTime+secondsperuominute*5*MY_CLOCKS_PER_SEC; } // // Housedecay and stabling // if ( TIMEOUT( housedecaytimer ) ) { ////////////////////// ///// check_houses ///////////////////// if( SrvParms->housedecay_secs != UINVALID ) cHouses::check_house_decay(); housedecaytimer = uiCurrentTime+MY_CLOCKS_PER_SEC*60*60; // check only each hour } // // Spawns // if( TIMEOUT( Spawns->check ) ) { Spawns->doSpawn(); } // // Shoprestock // Restocks->doRestock(); // // Prison release // prison::checkForFree(); // // Temporary effects // if( TIMEOUT( checktempfx ) ) tempfx::checktempeffects(); // // Characters & items // NxwSocketWrapper sw; sw.fillOnline(); for( sw.rewind(); !sw.isEmpty(); sw++ ) { NXWCLIENT ps = sw.getClient(); if( ps == NULL ) continue; P_CHAR pc=ps->currChar(); if( !ISVALIDPC( pc ) ) continue; if( lightChanged ) dolight(ps->toInt(),worldcurlevel); pc->heartbeat(); if( TIMEOUT( checknpcs ) || TIMEOUT( checktamednpcs ) || TIMEOUT( checknpcfollow ) ) { #ifdef SPAR_C_LOCATION_MAP PCHAR_VECTOR *pCV = pointers::getNearbyChars( pc, VISRANGE, pointers::NPC ); PCHAR_VECTOR it( pCV->begin() ), end( pCV->end() ); P_CHAR pNpc = 0; while( it != end ) { pNpc = (*it); if( pNpc->lastNpcCheck != uiCurrentTime && (TIMEOUT( checknpcs ) || (TIMEOUT( checktamednpcs ) && pNpc->tamed) || (TIMEOUT( checknpcfollow ) && pNpc->npcWander == WANDER_FOLLOW ) ) ) { pNpc->heartbeat(); pNpc->lastNpcCheck = uiCurrentTime; } ++it; } #else NxwCharWrapper sc; sc.fillCharsNearXYZ( pc->getPosition(), VISRANGE, true, false ); for( sc.rewind(); !sc.isEmpty(); sc++ ) { P_CHAR npc=sc.getChar(); if(!ISVALIDPC(npc) || !npc->npc ) continue; if( npc->lastNpcCheck != uiCurrentTime && (TIMEOUT( checknpcs ) || (TIMEOUT( checktamednpcs ) && npc->tamed) || (TIMEOUT( checknpcfollow ) && npc->npcWander == WANDER_FOLLOW ) ) ) { npc->heartbeat(); npc->lastNpcCheck = uiCurrentTime; } } #endif } if( TIMEOUT( checkitemstime ) ) { NxwItemWrapper si; si.fillItemsNearXYZ( pc->getPosition(), 2*VISRANGE, false ); for( si.rewind(); !si.isEmpty(); si++ ) { P_ITEM pi=si.getItem(); if( !ISVALIDPI( pi ) ) continue; pi->doDecay(); switch( pi->type ) { case 51 : case 52 : //if( TIMEOUT( pi->gatetime ) ) //for (int k=0;k<2;++k) Sparhawk what's this???? Let's comment it out for now // pi->deleteItem(); // bugfix for items disappearing //pi->deleteItem(); break; case 61 : case 62 : case 63 : case 64 : case 65 : case 69 : case 125 : break; //SPAWNERS may not decay!!! --> Sparhawk then don't use the decay tag in the script case 88 : if( pi->morey >= 0 && pi->morey < 25 ) if (pc->distFrom(pi)<=pi->morey) if( (UI32)RandomNum(1,100) <= pi->morez ) soundeffect4(ps->toInt(), pi, (UI16)pi->morex); break; } } } // Check boats extra, or else they will only be updated every CHECK_ITEMS time std::map<int,P_BOAT>::iterator iter_boat; for ( iter_boat= s_boat.begin();iter_boat != s_boat.end();iter_boat++) { P_BOAT boat=iter_boat->second; P_ITEM pi=boat->getShipLink(); if( pi->type2 == 1 || pi->type2 == 2 ) if( TIMEOUT( pi->gatetime ) ) { if (pi->type2==1) Boats->Move(ps->toInt(),pi->dir,pi); else { int dir=pi->dir+4; dir%=8; Boats->Move(ps->toInt(),dir,pi); } pi->gatetime=(TIMERVAL)(uiCurrentTime + (R64)(SrvParms->boatspeed*MY_CLOCKS_PER_SEC)); } } }//for i<now if( TIMEOUT( checkitemstime ) ) checkitemstime = (TIMERVAL)((R64) uiCurrentTime+(speed.itemtime*MY_CLOCKS_PER_SEC)); if( TIMEOUT( checknpcs ) ) checknpcs = (TIMERVAL)((R64) uiCurrentTime+(speed.npctime*MY_CLOCKS_PER_SEC)); if( TIMEOUT( checktamednpcs ) ) checktamednpcs=(TIMERVAL)((R64) uiCurrentTime+(speed.tamednpctime*MY_CLOCKS_PER_SEC)); if( TIMEOUT( checknpcfollow ) ) checknpcfollow=(TIMERVAL)((R64) uiCurrentTime+(speed.npcfollowtime*MY_CLOCKS_PER_SEC)); // // Html // if(SrvParms->html>0 && (htmltime<=uiCurrentTime )) { updatehtml(); htmltime=uiCurrentTime+(SrvParms->html*MY_CLOCKS_PER_SEC); } // // Finish // if ( TIMEOUT( nextfieldeffecttime ) ) nextfieldeffecttime = (TIMERVAL)((R64) uiCurrentTime + (0.5*MY_CLOCKS_PER_SEC)); if ( TIMEOUT( nextdecaytime ) ) nextdecaytime = uiCurrentTime + (15*MY_CLOCKS_PER_SEC); if( TIMEOUT( checktempfx ) ) checktempfx = (TIMERVAL)((R64) uiCurrentTime+(0.5*MY_CLOCKS_PER_SEC)); }
//-------------------------------------------------------------------------- void run(int /*arg*/) { if ( !autoIsOk() && askyn_c(-1, "HIDECANCEL\n" "The autoanalysis has not finished yet.\n" "The result might be incomplete. Do you want to continue?") < 0 ) return; // gather information about the entry points entrylist_t *li = new entrylist_t; size_t n = get_entry_qty(); for ( size_t i=0; i < n; i++ ) { asize_t ord = get_entry_ordinal((int)i); ea_t ea = get_entry(ord); if ( ord == ea ) continue; qtype type, fnames; char decl[MAXSTR]; char true_name[MAXSTR]; asize_t argsize = 0; get_entry_name(ord, true_name, sizeof(true_name)); if ( get_tinfo(ea, &type, &fnames) && print_type_to_one_line( decl, sizeof(decl), idati, type.c_str(), true_name, NULL, fnames.c_str()) == T_NORMAL ) { // found type info -- calc the args size func_type_info_t fi; int a = build_funcarg_info(idati, type.c_str(), fnames.c_str(), &fi, 0); if ( a != 0 ) { for ( int k=0; k < a; k++ ) { const type_t *ptr = fi[k].type.c_str(); int s1 = (int)get_type_size(idati, ptr); s1 = qmax(s1, inf.cc.size_i); argsize += s1; } } } else if ( get_long_name(BADADDR, ea, decl, sizeof(decl)) != NULL && get_true_name(BADADDR, ea, true_name, sizeof(true_name)) != NULL && strcmp(decl, true_name) != 0 ) { // found mangled name } else { // found nothing, just show the name const char *name = get_name(BADADDR, ea, true_name, sizeof(true_name)); if ( name == NULL ) continue; qstrncpy(decl, name, sizeof(decl)); } if ( argsize == 0 ) { func_t *pfn = get_func(ea); if ( pfn != NULL ) argsize = pfn->argsize; } item_t x; x.ord = (int)ord; x.ea = ea; x.decl = decl; x.argsize = (uint32)argsize; li->push_back(x); } // now open the window choose2(false, // non-modal window -1, -1, -1, -1, // position is determined by Windows li, // pass the created array qnumber(header), // number of columns widths, // widths of columns sizer, // function that returns number of lines desc, // function that generates a line "Exported functions", // window title -1, // use the default icon for the window 0, // position the cursor on the first line NULL, // "kill" callback NULL, // "new" callback NULL, // "update" callback NULL, // "edit" callback enter_cb, // function to call when the user pressed Enter destroy_cb, // function to call when the window is closed NULL, // use default popup menu items NULL); // use the same icon for all lines }