Example #1
0
void ShuttleFactory::handleDatabaseJobComplete(void* ref,DatabaseResult* result)
{
    QueryContainerBase* asyncContainer = reinterpret_cast<QueryContainerBase*>(ref);

    switch(asyncContainer->mQueryType)
    {
    case SHFQuery_MainData:
    {
        Shuttle* shuttle = _createShuttle(result);

        if(shuttle->getLoadState() == LoadState_Loaded && asyncContainer->mOfCallback)
        {
            asyncContainer->mOfCallback->handleObjectReady(shuttle,asyncContainer->mClient);
        }
        else
        {

        }
    }
    break;

    default:
        break;
    }

    mQueryContainerPool.free(asyncContainer);
}
Example #2
0
bool EffectFindClipping::TransferParameters(Shuttle & shuttle)
{
   shuttle.TransferInt(wxT("Start"), mStart, 3);
   shuttle.TransferInt(wxT("Stop"), mStop, 3);

   return true;
}
Example #3
0
bool EffectTruncSilence::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferEnum(wxT("Db"), mTruncDbChoiceIndex, Enums::NumDbChoices, Enums::GetDbChoices());
   shuttle.TransferInt(wxT("Minimum"), mTruncInitialAllowedSilentMs, 200);
   shuttle.TransferInt(wxT("Duration"), mTruncLongestAllowedSilentMs, 1000);
   shuttle.TransferDouble(wxT("Compress"), mSilenceCompressRatio, 4.0f);
   return true;
}
Example #4
0
bool EffectNormalize::TransferParameters( Shuttle & shuttle )
{
   shuttle.TransferBool( wxT("ApplyGain"), mGain, true );
   shuttle.TransferBool( wxT("RemoveDcOffset"), mDC, true );
   shuttle.TransferDouble( wxT("Level"), mLevel, 0.0);
   shuttle.TransferBool( wxT("StereoIndependent"), mStereoInd, false );
   return true;
}
Example #5
0
bool EffectTruncSilence::TransferParameters( Shuttle & shuttle )
{
   shuttle.TransferEnum(wxT("Db"), mTruncDbChoiceIndex, Enums::NumDbChoices, Enums::GetDbChoices());
   shuttle.TransferInt(wxT("Action"), mProcessIndex, 0);
   shuttle.TransferDouble(wxT("Minimum"), mInitialAllowedSilence, 0.5);
   shuttle.TransferDouble(wxT("Truncate"), mTruncLongestAllowedSilence, 0.5);
   shuttle.TransferDouble(wxT("Compress"), mSilenceCompressPercent, 50.0);
   return true;
}
Example #6
0
bool EffectPhaser::TransferParameters( Shuttle & shuttle )
{
   shuttle.TransferInt(wxT("Stages"),stages,2);
   shuttle.TransferInt(wxT("Wet"),drywet,128);
   shuttle.TransferFloat(wxT("Freq"),freq,0.4f);
   shuttle.TransferInt(wxT("Depth"),depth,100);
   shuttle.TransferFloat(wxT("Feedback"),fb,0.0f);
   return true;
}
Example #7
0
bool EffectBassTreble::TransferParameters(Shuttle & shuttle)
{  
   shuttle.TransferDouble(wxT("Bass"),dB_bass,0.0);
   shuttle.TransferDouble(wxT("Treble"),dB_treble,0.0);
   shuttle.TransferDouble(wxT("Level"),dB_level,0.0);
   shuttle.TransferBool( wxT("Normalize"), mbNormalize, true );

   return true;
}
Example #8
0
bool EffectWahwah::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferFloat(wxT("Freq"),freq,1.5f);
   shuttle.TransferFloat(wxT("Phase"),startphase,0.0f);
   shuttle.TransferFloat(wxT("Depth"),depth,0.7f);
   shuttle.TransferFloat(wxT("Resonance"),res,2.5f);
   shuttle.TransferFloat(wxT("Offset"),freqofs,0.3f);
   return true;
}
Example #9
0
void Game::tap(float x, float y) {
    Bullet* bullet = new Bullet();
    bullet->translate(shuttle_->getX(), 0.0f);
    scene_.push_back(bullet);

    float dx = x - shuttle_->getX();
    dx = copysignf(1.0, dx) * fmin(shuttle_->getSpeed(), abs(dx));

    shuttle_->translate(dx, 0.0f);
}
Example #10
0
bool EffectTimeScale::TransferParameters( Shuttle & shuttle )
{
   shuttle.TransferDouble(wxT("RatePercentChangeStart"),m_RatePercentChangeStart,0.0);
   shuttle.TransferDouble(wxT("RatePercentChangeEnd"),m_RatePercentChangeEnd,0.0);
   shuttle.TransferDouble(wxT("PitchHalfStepsStart"),m_PitchHalfStepsStart,0.0);
   shuttle.TransferDouble(wxT("PitchHalfStepsEnd"),m_PitchHalfStepsEnd,0.0);
   shuttle.TransferDouble(wxT("PitchPercentChangeStart"),m_PitchPercentChangeStart,0.0);
   shuttle.TransferDouble(wxT("PitchPercentChangeEnd"),m_PitchPercentChangeEnd,0.0);
   shuttle.TransferBool(wxT("PreAnalyze"),m_PreAnalyze,false);
   return true;
}
Example #11
0
void Game::updateMeteor(double dt, vector<Node*>::iterator nodeIt) {
    Meteor* meteor = (Meteor*) (*nodeIt);
    // Move meteor
    meteor->translate(meteor->getXFallSpeed(), dt * meteor->getYFallSpeed());
    // Make it spin
    meteor->rotate(meteor->getRotateSpeed());

    // Mark it for deletion if it's out
    if (meteor->isOut()) {
        deleted_.push_back(nodeIt - scene_.begin());
    }

    // If meteor hit shuttle than the game is over
    if (shuttle_->isIntersect(meteor)) {
        isOver_ = true;
    }
}
Example #12
0
bool EffectAutoDuck::TransferParameters( Shuttle & shuttle )
{
   shuttle.TransferDouble(wxT("DuckAmountDb"), mDuckAmountDb,
      PARAM_DEFAULT_DUCK_AMOUNT_DB);
   shuttle.TransferDouble(wxT("InnerFadeDownLen"), mInnerFadeDownLen,
      PARAM_DEFAULT_INNER_FADE_DOWN_LEN);
   shuttle.TransferDouble(wxT("InnerFadeUpLen"), mInnerFadeUpLen,
      PARAM_DEFAULT_INNER_FADE_UP_LEN);
   shuttle.TransferDouble(wxT("OuterFadeDownLen"), mOuterFadeDownLen,
      PARAM_DEFAULT_OUTER_FADE_DOWN_LEN);
   shuttle.TransferDouble(wxT("OuterFadeUpLen"), mOuterFadeUpLen,
      PARAM_DEFAULT_OUTER_FADE_UP_LEN);
   shuttle.TransferDouble(wxT("ThresholdDb"), mThresholdDb,
      PARAM_DEFAULT_THRESHOLD_DB);
   shuttle.TransferDouble(wxT("MaximumPause"), mMaximumPause,
      PARAM_DEFAULT_MAXIMUM_PAUSE);

   return true;
}
Example #13
0
bool EffectChangeSpeed::TransferParameters(Shuttle& shuttle)
{  
   shuttle.TransferDouble(wxT("Percentage"), mPercentChange, 0.0);
   return true;
}
Example #14
0
bool EffectNoiseRemoval::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferInt(wxT("Level"),mLevel,1);
   return true;
}
Example #15
0
Shuttle* ShuttleFactory::_createShuttle(DatabaseResult* result)
{
    Shuttle*	shuttle				= new Shuttle();
    Inventory*	shuttleInventory	= new Inventory();
    shuttleInventory->setParent(shuttle);

    uint64 count = result->getRowCount();

    result->GetNextRow(mShuttleBinding,(void*)shuttle);

    shuttle->mHam.mBattleFatigue = 0;
    shuttle->mHam.mHealth.setCurrentHitPoints(500);
    shuttle->mHam.mAction.setCurrentHitPoints(500);
    shuttle->mHam.mMind.setCurrentHitPoints(500);
    shuttle->mHam.calcAllModifiedHitPoints();

    // inventory
    shuttleInventory->setId(shuttle->mId + INVENTORY_OFFSET);
    shuttleInventory->setParentId(shuttle->mId);
    shuttleInventory->setModelString("object/tangible/inventory/shared_creature_inventory.iff");
    shuttleInventory->setName("inventory");
    shuttleInventory->setNameFile("item_n");
    shuttleInventory->setTangibleGroup(TanGroup_Inventory);
    shuttleInventory->setTangibleType(TanType_CreatureInventory);
    shuttle->mEquipManager.addEquippedObject(CreatureEquipSlot_Inventory,shuttleInventory);
    shuttle->setLoadState(LoadState_Loaded);

    shuttle->mPosture = 0;
    shuttle->mScale = 1.0;
    shuttle->setFaction("neutral");
    shuttle->mTypeOptions = 0x100;

    // Here we can handle the initializing of shuttle states

    // First, a dirty test for the shuttles in Theed Spaceport.
    // No need to randomize departure times, since we can always travel from there.
    // We wan't them to go in sync, so one of them always are in the spaceport.
    // if (shuttle->mParentId == 1692104)
#if defined(_MSC_VER)
    if (shuttle->mId == 47781511212)
#else
    if (shuttle->mId == 47781511212LLU)
#endif
    {
        shuttle->setShuttleState(ShuttleState_InPort);
        shuttle->setInPortTime(0);
    }
#if defined (_MSC_VER)
    else if (shuttle->mId == 47781511214)	// This is the "extra" shuttle.
#else
    else if (shuttle->mId == 47781511214LLU)	// This is the "extra" shuttle.
#endif
    {
        shuttle->setShuttleState(ShuttleState_Away);
        shuttle->setAwayTime(0);
    }
    else
    {
        // Get a randowm value in the range [0 <-> InPortInterval + AwayInterval] in ticks.
        // The rand value will land in either the InPort or in the Away part of the values.
        // Use that state as initial state and set the value as time that have already expired.
        uint32 maxInPortAndAwayIntervalTime = shuttle->getInPortInterval() + shuttle->getAwayInterval();
        uint32 shuttleTimeExpired = static_cast<uint32>(gRandom->getRand() / RAND_MAX) * (maxInPortAndAwayIntervalTime);

        if (shuttleTimeExpired <= shuttle->getInPortInterval())
        {
            // gLogger->log(LogManager::DEBUG,"Shuttle start InPort, time expired %u", shuttleTimeExpired);
            shuttle->setShuttleState(ShuttleState_InPort);
            shuttle->setInPortTime(shuttleTimeExpired);
        }
        else
        {
            // gLogger->log(LogManager::DEBUG,"Shuttle start Away, time expired %u", shuttleTimeExpired - shuttle->getInPortInterval());
            shuttle->setShuttleState(ShuttleState_Away);
            shuttle->setAwayTime(shuttleTimeExpired - shuttle->getInPortInterval()); // Set the part corresponding to this state only.
        }
    }
    return shuttle;
}
Example #16
0
bool EffectRepeat::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferInt(wxT("Count"),repeatCount,1);
   return true;
}
Example #17
0
bool EffectChangePitch::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferDouble(wxT("Percentage"),m_PercentChange,0.0);
   m_SemitonesChange = (12.0 * log((100.0 + m_PercentChange) / 100.0)) / log(2.0);
   return true;
}
Example #18
0
bool EffectNyquist::TransferParameters( Shuttle & shuttle )
{
   for (size_t i = 0; i < mControls.GetCount(); i++) {
      NyqControl *ctrl = &mControls[i];
      double d = ctrl->val;
      bool good = false;

      if (d == UNINITIALIZED_CONTROL) {
         if (ctrl->type != NYQ_CTRL_STRING) {
            if (!shuttle.mbStoreInClient) {
               d = GetCtrlValue(ctrl->valStr);
            }
         }
      }

      if (ctrl->type == NYQ_CTRL_REAL) {
         good = shuttle.TransferDouble(ctrl->var, d, 0.0);
      }
      else if (ctrl->type == NYQ_CTRL_INT) {
         int val = (int) d;
         good = shuttle.TransferInt(ctrl->var, val, 0);
         d = (double) val;
      }
      else if (ctrl->type == NYQ_CTRL_CHOICE) {
         //str is coma separated labels for each choice
         wxString str = ctrl->label;
         wxArrayString choices;
         
         while (1) {
            int ci = str.Find( ',' ); //coma index

            if (ci == -1) {
               choices.Add( str );
               break;
            }
            else {
               choices.Add(str.Left(ci));
            }
            
            str = str.Right(str.length() - ci - 1);
         }

         int cnt = choices.GetCount();
         if (choices.GetCount() > 0) {
            wxString *array = NULL;
            array = new wxString[cnt];
            for (int j = 0; j < cnt; j++ ) {
               array[j] = choices[j];
            }

            int val = (int) d;
            good = shuttle.TransferEnum(ctrl->var, val, cnt, array);
            d = (double) val;

            delete [] array;
         }
      }
      else if (ctrl->type == NYQ_CTRL_STRING) {
         good = shuttle.TransferString(ctrl->var, ctrl->valStr, wxEmptyString);
      }

      if (ctrl->type != NYQ_CTRL_STRING) {
         if (shuttle.mbStoreInClient && good) {
            ctrl->val = d;
         }
      }
   }

   return true;
}
Example #19
0
bool EffectClickRemoval::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferInt(wxT("Threshold"),mThresholdLevel,0);
   shuttle.TransferInt(wxT("Width"),mClickWidth,0);
   return true;
}
Example #20
0
bool EffectLeveller::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferEnum(wxT("Db"),mLevellerDbChoiceIndex,Enums::NumDbChoices,Enums::GetDbChoices());
   shuttle.TransferInt(wxT("Passes"),mLevellerNumPasses,1);
   return true;
}
Example #21
0
bool EffectTruncSilence::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferEnum(wxT("Db"), mTruncDbChoiceIndex, Enums::NumDbChoices, Enums::GetDbChoices());
   shuttle.TransferInt(wxT("Duration"), mTruncLongestAllowedSilentMs, 200);
   return true;
}
Example #22
0
bool EffectEcho::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferFloat(wxT("Delay"),delay,1.0);
   shuttle.TransferFloat(wxT("Decay"),decay,0.5);
   return true;
}
bool EffectPaulstretch::TransferParameters(Shuttle &shuttle){
   shuttle.TransferFloat(wxT("Stretch Factor"),amount,10.0);
   shuttle.TransferFloat(wxT("Time Resolution"),time_resolution,0.25);

   return true;
};
Example #24
0
void TravelMapHandler::handleUIEvent(uint32 action,int32 element,BString inputStr,UIWindow* window)
{
    if(!action && element != -1 )
    {
        uint32					zoneId			= gWorldManager->getZoneId();
        PlayerObject*			playerObject	= window->getOwner();
        UITicketSelectListBox*	listBox			= dynamic_cast<UITicketSelectListBox*>(window);

        if(playerObject->getSurveyState() || playerObject->getSamplingState() || !listBox)
            return;

        Shuttle* shuttle = listBox->getShuttle();

        if(!shuttle)
        {
            return;
        }

        if (!shuttle->availableInPort())
        {
            gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "shuttle_not_available"), playerObject);
            return;
        }

        if((playerObject->getParentId() != shuttle->getParentId()) || (glm::distance(playerObject->mPosition, shuttle->mPosition) > 25.0f))
        {
            gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "boarding_too_far"), playerObject);

            return;
        }

        ObjectIDList*			invObjects		= dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory))->getObjects();
        ObjectIDList::iterator	it				= invObjects->begin();

        while(it != invObjects->end())
        {
            TravelTicket* ticket = dynamic_cast<TravelTicket*>(gWorldManager->getObjectById((*it)));
            if(ticket)
            {
                BString srcPoint		= (int8*)((ticket->getAttribute<std::string>("travel_departure_point")).c_str());
                BString dstPointStr	= (int8*)((ticket->getAttribute<std::string>("travel_arrival_point")).c_str());
                uint16 srcPlanetId	= static_cast<uint8>(gWorldManager->getPlanetIdByName((int8*)((ticket->getAttribute<std::string>("travel_departure_planet")).c_str())));
                uint16 dstPlanetId	= static_cast<uint8>(gWorldManager->getPlanetIdByName((int8*)((ticket->getAttribute<std::string>("travel_arrival_planet")).c_str())));

                BStringVector* items = (dynamic_cast<UIListBox*>(window))->getDataItems();
                BString selectedDst = items->at(element);
                selectedDst.convert(BSTRType_ANSI);

                if(srcPlanetId == zoneId && (strcmp(dstPointStr.getAnsi(),selectedDst.getAnsi()) == 0)&&(strcmp(srcPoint.getAnsi(),listBox->getPort().getAnsi()) == 0))
                {
                    TravelPoint* dstPoint = gTravelMapHandler->getTravelPoint(dstPlanetId,dstPointStr);

                    if(dstPoint != NULL)
                    {
                        glm::vec3 destination;
                        destination.x = dstPoint->spawnX + (gRandom->getRand()%5 - 2);
                        destination.y = dstPoint->spawnY;
                        destination.z = dstPoint->spawnZ + (gRandom->getRand()%5 - 2);

                        // If it's on this planet, then just warp, otherwize zone
                        if(dstPlanetId == zoneId)
                        {
                            // only delete the ticket if we are warping on this planet.
							TangibleObject* tO = dynamic_cast<TangibleObject*>(gWorldManager->getObjectById(ticket->getParentId()));
							gContainerManager->deleteObject(ticket, tO);

							gWorldManager->warpPlanet(playerObject,destination,0);
                        }
                        else
                        {
                            gMessageLib->sendClusterZoneTransferRequestByTicket(playerObject,ticket->getId(), dstPoint->planetId);
                        }
                    }
                    else
                    {
                    }
                    break;
                }
            }
            ++it;
        }
    }
}
Example #25
0
bool EffectBassBoost::TransferParameters( Shuttle & shuttle )
{  
   shuttle.TransferFloat(wxT("Boost"),dB_boost,0.0);
   shuttle.TransferFloat(wxT("Freq"),frequency,0.0);
   return true;
}
Example #26
0
bool EffectAmplify::TransferParameters( Shuttle & shuttle )
{
   shuttle.TransferFloat( wxT("Ratio"), ratio, 0.9f );
   return true;
}
Example #27
0
bool WorldManager::_handleShuttleUpdate(uint64 callTime,void* ref)
{
    ShuttleList::iterator shuttleIt = mShuttleList.begin();
    while(shuttleIt != mShuttleList.end())
    {
        Shuttle* shuttle = (*shuttleIt);

        // The Ticket Collector need a valid shuttle-object.
        if (!shuttle->ticketCollectorEnabled())
        {
            TicketCollector* collector = dynamic_cast<TicketCollector*>(getObjectById(shuttle->getCollectorId()));
            if (collector)
            {
                if (!collector->getShuttle())
                {
                    // Enable the collector.
                    collector->setShuttle(shuttle);
                }
                shuttle->ticketCollectorEnable();
            }
        }

        switch(shuttle->getShuttleState())
        {
        case ShuttleState_Away:
        {
            uint32 awayTime = shuttle->getAwayTime() + 1000;
            if(awayTime >= shuttle->getAwayInterval())
            {
                uint32 awayTime = shuttle->getAwayTime() + 1000;
                if(awayTime >= shuttle->getAwayInterval())
                {
                    shuttle->states.setPosture(0);
                    shuttle->setAwayTime(0);
                    shuttle->setShuttleState(ShuttleState_AboutBoarding);
                    gMessageLib->sendPostureUpdate(shuttle);
                    gMessageLib->sendCombatAction(shuttle,NULL,opChange_Posture);
                }
            }
            else
                shuttle->setAwayTime(awayTime);
        }
        break;

        case ShuttleState_Landing:
        {
            uint32 landingTime = shuttle->getLandingTime() + 1000;

            if(landingTime >= SHUTTLE_LANDING_ANIMATION_TIME - 5000)
            {
                shuttle->setShuttleState(ShuttleState_AboutBoarding);
            }
            else
                shuttle->setLandingTime(landingTime);
        }
        break;

        case ShuttleState_AboutBoarding:
        {
            uint32 landingTime = shuttle->getLandingTime() + 1000;

            if(landingTime >= SHUTTLE_LANDING_ANIMATION_TIME)
            {
                shuttle->setLandingTime(0);

                shuttle->setShuttleState(ShuttleState_InPort);
            }
            else
                shuttle->setLandingTime(landingTime);
        }
        break;

        case ShuttleState_InPort:
        {
            uint32 inPortTime = shuttle->getInPortTime() + 1000;
            if(inPortTime >= shuttle->getInPortInterval())
            {
                uint32 inPortTime = shuttle->getInPortTime() + 1000;
                if(inPortTime >= shuttle->getInPortInterval())
                {
                    shuttle->setInPortTime(0);
                    shuttle->setShuttleState(ShuttleState_Away);
                    shuttle->states.setPosture(2);
                    gMessageLib->sendPostureUpdate(shuttle);
                    gMessageLib->sendCombatAction(shuttle,NULL,opChange_Posture);
                }
            }
            else
            {
                shuttle->setInPortTime(inPortTime);
            }
        }
        break;

        default:
            break;
        }

        ++shuttleIt;
    }

    return(true);
}