Exemplo n.º 1
0
    void UpdateAI(const uint32 diff)
    {
        if (real_event_started)
        {
            if (initial_movement)
            {
                DoYell(SAY_BEGIN, LANG_UNIVERSAL, NULL);
                initial_movement = false;
            }

            Player* player = GetPlayerForEscort();
            if (player)
            {
                if(player->isDead())
                {
                    player->FailQuest(QUEST_PROTECT_DAPHNE);
                    SetVariables();
                }

                if(m_creature->isDead() && player)
                    player->FailQuest(QUEST_PROTECT_DAPHNE);
            }

            UpdateEvent(diff);
        }

        npc_escortAI::UpdateAI(diff);
    }
void
ExportDBAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("ExportDBAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("allTimes")) != 0)
        SetAllTimes(node->AsBool());
    if((node = searchNode->GetNode("db_type")) != 0)
        SetDb_type(node->AsString());
    if((node = searchNode->GetNode("db_type_fullname")) != 0)
        SetDb_type_fullname(node->AsString());
    if((node = searchNode->GetNode("filename")) != 0)
        SetFilename(node->AsString());
    if((node = searchNode->GetNode("dirname")) != 0)
        SetDirname(node->AsString());
    if((node = searchNode->GetNode("variables")) != 0)
        SetVariables(node->AsStringVector());
    if((node = searchNode->GetNode("opts")) != 0)
        opts.SetFromNode(node);
}
Exemplo n.º 3
0
/*++

Routine Description:

    This function is executed when a Start command is sent to the
    service by the SCM or when the operating system starts (for a service
    that starts automatically). It specifies actions to take when the
    service starts. In this code sample, OnStart logs a service-start
    message to the Application log, and queues the main service function for
    execution in a thread pool worker thread.

    NOTE: A service application is designed to be long running. Therefore,
          it usually polls or monitors something in the system. The monitoring is
          set up in the OnStart method. However, OnStart does not actually do the
          monitoring. The OnStart method must return to the operating system after
          the service's operation has begun. It must not loop forever or block. To
          set up a simple monitoring mechanism, one general solution is to create
          a timer in OnStart. The timer would then raise events in your code
          periodically, at which time your service could do its monitoring. The
          other solution is to spawn a new thread to perform the main service
          functions, which is demonstrated in this code sample.

Arguments:

    Argc - The number of command line arguments

    Argv - The array of command line arguments

Return Value:

    VOID

--*/
VOID
CSampleService::OnStart(
    DWORD  Argc,
    PWSTR *Argv
    )
{
	__debugbreak();

    //
    // Log a service start message to the Application log.
    //
    WriteToEventLog(L"SampleService in OnStart", 
                    EVENTLOG_INFORMATION_TYPE);

    //
    // Set up any variables the service needs.
    //
    SetVariables();

    //
    // Set up the context, and register for notifications.
    //
    InitializeContext(&m_Context);

    //
    // Queue the main service function for execution in a worker thread.
    //
    CThreadPool::QueueUserWorkItem(&CSampleService::ServiceWorkerThread, this);
}
Exemplo n.º 4
0
/*++

Routine Description:

    When implemented in a derived class, executes when a Start
    command is sent to the service by the SCM or when the operating system
    starts (for a service that starts automatically). Specifies actions to
    take when the service starts. Be sure to periodically call
    CServiceBase::SetServiceStatus() with SERVICE_START_PENDING if the
    procedure is going to take long time. You may also consider spawning a
    new thread in OnStart to perform time-consuming initialization tasks.

Arguments:

    Argc - The number of command line arguments

    Argv - The array of command line arguments

Return Value:

    VOID

--*/
VOID
CServiceBase::OnStart(
    DWORD Argc,
    PWSTR *Argv
)
{
    SetVariables();
}
Exemplo n.º 5
0
    void WaypointReached(uint32 i)
    {
        Player* player = GetPlayerForEscort();

        if (!player)
            return;

        if (IsWalking && !m_creature->IsWalking())
            m_creature->SetWalk(true);

        switch (i)
        {
        case 0:
            SetVariables();
            break;
        case 3:
            if (!yeller_spawned)
            {
                Creature *yeller = m_creature->SummonCreature(DEFIAS_RAIDER, THUG_SPAWN_X, THUG_SPAWN_Y, THUG_SPAWN_Z, THUG_SPAWN_O, TEMPSUMMON_TIMED_DESPAWN, 3000);
                yeller->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                yeller->Yell(SAY_KILL_HER, LANG_UNIVERSAL, 0);
                yeller_spawned = true;
            }
            break;
        case 5:
            real_event_started = true;
            NextEvent();
            break;
        case 6:
            IsWalking = true;
            break;
        case 11:
            if (thug_wave > 3)
            {
                player->CompleteQuest(QUEST_PROTECT_DAPHNE);
            }
            if (player && player->GetTypeId() == TYPEID_PLAYER)
                ((Player*)player)->GroupEventHappens(QUEST_PROTECT_DAPHNE,m_creature);

            m_creature->GetMotionMaster()->MovementExpired();
            m_creature->GetMotionMaster()->MoveTargetedHome();
            SetVariables();
            break;
        }
    }
Exemplo n.º 6
0
Arquivo: Game.cpp Projeto: cearp/Pang
void Game::Start(void)
{
		player1score = 0;
	player2score = 0;
	SetVariables();

	//We check that the game state is uninitialized so that we do not call it more than once.
	if(_gameState != Uninitialized)//Throwing an error would be proper
		return;

	_mainWindow.create(sf::VideoMode(SCREEN_LENGTH,SCREEN_HEIGHT,32),"Pang!");//Creates the resolutions, 32bpp color, and title.
	_gameState= Game::ShowingSplash;//Title screen

	while(!IsExiting())//While the game is in play mode, we run the gameloop.
	{
		GameLoop();//repeats as long as we're not in exit mode.
	}

	_mainWindow.close();//Closes the window when not in play mode.
}
Exemplo n.º 7
0
SoftParticles::SoftParticles()
{
	SetVariables();
}
Exemplo n.º 8
0
void
QueryAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("QueryAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("name")) != 0)
        SetName(node->AsString());
    if((node = searchNode->GetNode("variables")) != 0)
        SetVariables(node->AsStringVector());
    if((node = searchNode->GetNode("resultsMessage")) != 0)
        SetResultsMessage(node->AsString());
    if((node = searchNode->GetNode("worldPoint")) != 0)
        SetWorldPoint(node->AsDoubleArray());
    if((node = searchNode->GetNode("domain")) != 0)
        SetDomain(node->AsInt());
    if((node = searchNode->GetNode("element")) != 0)
        SetElement(node->AsInt());
    if((node = searchNode->GetNode("resultsValue")) != 0)
        SetResultsValue(node->AsDoubleVector());
    if((node = searchNode->GetNode("elementType")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 2)
                SetElementType(ElementType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            ElementType value;
            if(ElementType_FromString(node->AsString(), value))
                SetElementType(value);
        }
    }
    if((node = searchNode->GetNode("timeStep")) != 0)
        SetTimeStep(node->AsInt());
    if((node = searchNode->GetNode("varTypes")) != 0)
        SetVarTypes(node->AsIntVector());
    if((node = searchNode->GetNode("dataType")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 2)
                SetDataType(DataType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            DataType value;
            if(DataType_FromString(node->AsString(), value))
                SetDataType(value);
        }
    }
    if((node = searchNode->GetNode("pipeIndex")) != 0)
        SetPipeIndex(node->AsInt());
    if((node = searchNode->GetNode("useGlobalId")) != 0)
        SetUseGlobalId(node->AsBool());
    if((node = searchNode->GetNode("xUnits")) != 0)
        SetXUnits(node->AsString());
    if((node = searchNode->GetNode("yUnits")) != 0)
        SetYUnits(node->AsString());
    if((node = searchNode->GetNode("darg1")) != 0)
        SetDarg1(node->AsDoubleVector());
    if((node = searchNode->GetNode("darg2")) != 0)
        SetDarg2(node->AsDoubleVector());
    if((node = searchNode->GetNode("floatFormat")) != 0)
        SetFloatFormat(node->AsString());
    if((node = searchNode->GetNode("xmlResult")) != 0)
        SetXmlResult(node->AsString());
}
Exemplo n.º 9
0
PerlinFire::PerlinFire()
{
	SetVariables();
}
Exemplo n.º 10
0
GaussianMain::GaussianMain()
{
	SetVariables();
}
Exemplo n.º 11
0
 npc_daphne_stilwellAI(Creature *c) : npc_escortAI(c)
 {
     SetVariables();
 }
Exemplo n.º 12
0
Arquivo: Game.cpp Projeto: cearp/Pang
void Game::collisions()//Just a place to put all the collision checking 
{
	//float speed = 24;//((player1score + player2score)+1)/2;
	_angle = rand()%360;//random angle

	if(ball.isColliding(player1.getRect()))//right
	{
		ball.playHitSound();
		ball.bounceX(1);
		ball.bounceY(1);
		ball.accelerate(player1);
	}
	if(ball.isColliding(player2.getRect()))//left
	{
		ball.playHitSound();
		ball.bounceX(1);
		ball.bounceY(1);
		ball.accelerate(player1);
	}
	//Reverse moving paddles
	if(ball.isColliding(player1rev.getRect()))
	{
		ball.playHitSound();
		ball.bounceX(1);
		ball.bounceY(1);
		ball.accelerate(player1rev);
	}
	if(ball.isColliding(player2rev.getRect()))
	{
		ball.playHitSound();
		ball.bounceX(1);
		ball.bounceY(1);
		ball.accelerate(player1rev);
	}
	if(ball.isColliding(TOP.getGlobalBounds()))//Hits the top 
	{
		ball.playHitSound();
		ball.bounceX(-1);
		ball.bounceY(1);
	}
	if(ball.isColliding(BOTTOM.getGlobalBounds()))//Hits bottom
	{
		ball.playHitSound();
		ball.bounceX(-1);
		ball.bounceY(1);
	}
	if(ball.isColliding(LEFT.getGlobalBounds()))//Check if player1 scores
	{
		player1score++;
		ballMoving = false;
		ballGoal = true;
		ball.initBallPos(ballPos);
		ball.resetBallSpeed(random * (-1));
		SetVariables();
		cout<<"Player1 Score: "<<player1score<<"Player2 Score: "<<player2score<<endl;
	}
	if(ball.isColliding(RIGHT.getGlobalBounds()))//Check if player2 scores
	{
		player2score++;
		ballMoving = false;
		ballGoal = true;
		ball.initBallPos(ballPos);
		ball.resetBallSpeed(random * (-1));
		SetVariables();
		cout<<"Player1 Score: "<<player1score<<"  Player2 Score: "<<player2score<<endl;
	}
	//cout<<"Player1 Score: "<<player1score<<"Player2 Score: "<<player2score<<endl;
}
Exemplo n.º 13
0
LightingMain::LightingMain()
{
	SetVariables();
}