Exemplo n.º 1
0
void AsScene1308JaggyDoor::stCloseDoor() {
	startAnimation(0xBA0AE050, -1, -1);
	_playBackwards = true;
	setVisible(true);
	playSound(0, calcHash("fxDoorClose38"));
	NextState(&AsScene1308JaggyDoor::stCloseDoorDone);
}
  //
  // StateInit
  //
  // Start the construction process
  //
  void UnitConstruct::StateInit()
  {
    // Unit should not have been added to the team list yet
    ASSERT(!subject->IsActivelyOnTeam())

    // Get construction time
    F32 time = subject->UnitType()->GetConstructionTime();

    // Setup progress counts
    progressTotal = 0.0F;
    progressMax = (time > 0.0F) ? (1.0F / (time * GameTime::SimTimeInv())) : 1.0F;

    // Grab total resource to be removed
    resourceRemoved = 0;
    resourceRemaining = subject->UnitType()->GetResourceCost();

    // Setup number of hitpoints to add
    hitPointsLeft = subject->MapType()->GetHitPoints() - subject->UnitType()->GetConstructionHitPoints();

    // Register construction of this object
    if ((constructListTeam = subject->GetTeam()) != NULL)
    {
      constructListTeam->RegisterConstructionBegin(subject);
    }

    // Create the construction effect
    CreateEffect();

    NextState(0x4E5A04E4); // "Construct"
  }
Exemplo n.º 3
0
// ---------------------------------------------------------------------------
// CWlanBgScan::OnTimeout
// ---------------------------------------------------------------------------
//
void CWlanBgScan::OnTimeout()
    {
    DEBUG( "CWlanBgScan::OnTimeout()" );
    
    NextState( CWlanBgScanStates::EBgScanEventIntervalChanged );
    
    }
Exemplo n.º 4
0
AsScene1308KeyboardDoor::AsScene1308KeyboardDoor(NeverhoodEngine *vm, Scene *parentScene)
	: AnimatedSprite(vm, 0xA08A0851, 1100, 320, 240), _parentScene(parentScene) {

	playSound(0, 0x51456049);
	SetMessageHandler(&AsScene1308KeyboardDoor::handleMessage);
	NextState(&AsScene1308KeyboardDoor::stFallingKeys);
}
// -----------------------------------------------------------------------------
// CPhoneHandlerEndCall::RequestCompleted
// Handler for completed asynchronous calls.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CPhoneHandlerEndCall::RequestCompleted( const TInt aError )
    {
    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerEndCall::RequestCompleted() aError=%d, iState=%d", aError, iState );
        
    switch( iState )
        {
        case EPhoneHandlerState1:
            {
            NextState();
            iControl.CommandInitiator().SendResponse( GetStatus(), 
                                                      iOperation,
                                                      aError );
            Activate();
            break;
            }
            
        case EPhoneHandlerState2:
            {
            IdleState();
            delete this;  
            break;
            }
            
        default:
            {
            COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::RequestCompleted() Unspecified state" );
            break;
            }
        };
    }
  //
  // Notify
  //
  // Notify this task of an event
  //
  Bool TransportUnload::ProcessEvent(const Event &event)
  {
    switch (event.message)
    {
      case GameObjNotify::Interrupted:
        NextState(0xABAA7B48); // "Init"
        return (TRUE);

      case Movement::Notify::Incapable:
        if (moveHandle == event.param1)
        {
          Quit();
        }
        return (TRUE);

      case Movement::Notify::Completed:
        if (moveHandle == event.param1)
        {
          subject->Move(moveHandle, &destination, NULL, FALSE);
        }
        return (TRUE);

    }
    return (GameTask<TransportObjType, TransportObj>::ProcessEvent(event));
  }
 //
 // StateStage2
 //
 // Waiting to die
 //
 void ParasiteSight::StateStage2()
 {
   // Is the target still alive
   if (subject->GetTarget())
   {
     // Is the parasite done
     if (timer.Test())
     {
       NextState(0x8C1F21CA); // "Done"
     }
   }
   else
   {
     NextState(0x8C1F21CA); // "Done"
   }
 }
Exemplo n.º 8
0
void Game::Loop() {

    do {
        switch ( state ) {
            case G_MAIN_MENU    : 
                {
                    MainMenu(); 
                }
                break;
            case G_NET_MENU     : 
                {
                    NetMenu();
                }
                break;
            case G_HOF_SCREEN   : 
                {
                    NextState( G_MAIN_MENU );
                }
                break;
            case G_SHIPS_SCREEN : 
                {
                    ShipsScr();
                }
                break;
            case G_PLAY_SCREEN  : 
                {
                    PlayScreen();
                }
                break;
            case G_EXIT         : return;
        }
    } while ( true );
}
Exemplo n.º 9
0
void AsDiskplayerSceneKey::stDropKey() {
	startAnimation(0x100B90B4, 0, -1);
	SetUpdateHandler(&AnimatedSprite::update);
	SetMessageHandler(&AsDiskplayerSceneKey::handleMessage);
	NextState(&AsDiskplayerSceneKey::stDropKeyDone);
	setVisible(true);
}
Exemplo n.º 10
0
  //
  // StateInit
  //
  // Just attached to target
  //
  void ParasiteSight::StateInit()
  {
    // Is the target still alive
    if (subject->GetTarget())
    {
      // Start the countdown
      timer.Start(subject->ParasiteType()->GetTime1());

      // Proceed
      NextState(0xC97BFBB9); // "Stage1"
    }
    else
    {
      NextState(0x8C1F21CA); // "Done"
    }
  }
  //
  // Pathing State
  //
  void SquadMoveTogether::StatePathing()
  {
    switch (subject->GetPathFinder().State())
    {
      case PathSearch::FS_QUEUED:
      case PathSearch::FS_ACTIVE:
        break;

      case PathSearch::FS_IDLE:
        ERR_FATAL(("Path is idle when it shouldn't be"))
        break;

      case PathSearch::FS_NOPATH:
        Quit();
        break;

      case PathSearch::FS_DIRECT:
        // We should handle direct especially perhaps ?
        
      case PathSearch::FS_FOUND:
      case PathSearch::FS_CLOSEST:
        NextState(0x367BCF47); // "PathAnalysis"
        break;

      default:
        ERR_FATAL(("Unknown path finder state [%d]", subject->GetPathFinder().State()));
    }
  }
Exemplo n.º 12
0
static void htmlf(FILE* Output, const char* Format, ...)
    {
    TMachine    Machine = {STATE_START, 0};
    int         Opcode;
    const char* Rover;
    char*       Buffer;
    va_list     ArgPtr;

    Buffer      = malloc(1024*8);

    assert(Buffer != NULL);
    assert(Format != NULL);
    va_start(ArgPtr, Format);
    Machine.Input   = Format;
    while((Opcode=NextState(Output, &Machine)) != OP_EOS)
        {
        if(Opcode == OP_EOS)
            break;
        else if(Opcode == OP_GETARG)
            Machine.IntArg  = va_arg(ArgPtr, int);
        else
            {
            if(Opcode == OP_OUTINT)
                sprintf(Buffer, Machine.FmtSpec, va_arg(ArgPtr, int));
            else if(Opcode == OP_OUTLONG)
                sprintf(Buffer, Machine.FmtSpec, va_arg(ArgPtr, long));
            else if(Opcode == OP_OUTPTR)
Exemplo n.º 13
0
void AsScene2101Door::stCloseDoor() {
	startAnimation(0xC222A8D4, 0, -1);
	_newStickFrameIndex = STICK_LAST_FRAME;
	setVisible(true);
	playSound(0, calcHash("fxDoorClose32"));
	NextState(&AsScene2101Door::stCloseDoorDone);
}
Exemplo n.º 14
0
 //
 // Initial state
 //
 void SquadAttack::StateInit()
 {
   // Attack that target already
   for (SquadObj::UnitList::Iterator i(&subject->GetList()); *i; ++i)
   {
     if (UnitObj *u = (*i)->GetPointer())
     {
       // If the unit can damage the target then make it attack
       if 
       (
         !u->ForceAttacking(target) && u->CanDamageNow(target) && 
         u->FlushTasks(Tasks::UnitAttack::GetConfigBlockingPriority())
       )
       {
         Task *task = new UnitAttack(u, target);
         u->PrependTask(task, GetFlags());
         (*i)->task = task->GetTaskId();
         (*i)->completed = FALSE;
       }
       else 
       {
         (*i)->task = 0;
         (*i)->completed = TRUE;
       }
     }
   }
   NextState(0xA8FEF90A); // "Attack"
 }
Exemplo n.º 15
0
  //
  // Choose a time to play the idle animation
  //
  void UnitIdle::StateTime()
  {
    // How long until we play the idle animation
    timer.Start(Random::sync.Float() * 15.0F + 5.0F);

    // Proceed
    NextState(0x793360CC); // "Idle"
  }
Exemplo n.º 16
0
void CTrieHolder::GetOccurrences (const TerminalString& Text, yvector< COccurrence >& Occurrences) const
{
    int r = 0;
    Occurrences.clear();
    for (size_t i=0; i<Text.size(); i++) {
        r = NextState(r, i, Text[i], Occurrences);
    };
};
Exemplo n.º 17
0
void GSFileUpdateCheck::OnSkip()
{
  // TODO Hmm, could be complicated as request is already in flight..??
  // Ignore response if this state is no longer current.

  // DON'T update timestamp
  NextState();
}
Exemplo n.º 18
0
void AsScene1306Elevator::stGoingUp() {
	setVisible(true);
	_isDown = false;
	startAnimation(0x043B0270, 0, -1);
	playSound(0);
	SetUpdateHandler(&AsScene1306Elevator::update);
	NextState(&AsScene1306Elevator::cbGoingUpEvent);
}
Exemplo n.º 19
0
void Game::MainMenu() {

    mmenu_state = MainMenuState();
    
    while (true) 
    {
        // update screen
        MainMenuDraw();

        // process key
        int key = Console::GetInstance().WaitKey();

        if (key == 'w' || key == 's') 
        {
            if (key == 'w') 
            {
                mmenu_state.menu_index = 
                    ( mmenu_state.menu_index - 1 < 0 ? NumMenuItems - 1 : mmenu_state.menu_index - 1 );
            }
            else {
                mmenu_state.menu_index = 
                    ( mmenu_state.menu_index + 1 > NumMenuItems - 1 ? 0 : mmenu_state.menu_index + 1 );
            }
        }
        // select item
        else if (key == 13) 
        {
            if ( mmenu_state.menu_index == 2 ) {

                NextState( G_EXIT );
                break;
            }
            if ( mmenu_state.menu_index == 1 ) {

                NextState( G_HOF_SCREEN );
                break;
            }
            if ( mmenu_state.menu_index == 0 ) {

                NextState( G_NET_MENU );
                break;
            }
        }
        else ;
    }
}
Exemplo n.º 20
0
void AsScene2402TV::upWait() {
	if (_countdown1 != 0 && (--_countdown1) == 0) {
		startAnimation(0x4919397A, 0, -1);
		SetMessageHandler(&AsScene2402TV::hmJoke);
		NextState(&AsScene2402TV::stJokeFinished);
	}
	AnimatedSprite::update();
}
  //
  // StateInit
  //
  // Start moving towards destination
  //
  void TransportUnload::StateInit()
  {
    // Setup height at destination
    destination.y = TerrainData::FindFloor(destination.x, destination.z);

    // Start moving
    subject->Move(moveHandle, &destination, NULL, FALSE);
    NextState(0x9E947215); // "Moving"
  }
Exemplo n.º 22
0
void AsScene3010DeadBolt::stDisabled() {
	setVisible(true);
	startAnimation(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1);
	SetMessageHandler(&AsScene3010DeadBolt::hmAnimation);
	FinalizeState(&AsScene3010DeadBolt::stDisabledMessage);
	NextState(&AsScene3010DeadBolt::stIdle);
	_playBackwards = true;
	playSound(2);
}
Exemplo n.º 23
0
// ---------------------------------------------------------------------------
// CWlanBgScan::AwsCommandComplete
// --------------------------------------------------------------------------
//
void CWlanBgScan::AwsCommandComplete( MWlanBgScanAwsComms::TAwsCommand& aCommand, TInt aStatus )
    {
    DEBUG2( "CWlanBgScan::AwsCommandComplete( aCommand: %d, aStatus: %d )", aCommand, aStatus );
    
    SetAwsCmdStatus( aCommand, aStatus );

    NextState( CWlanBgScanStates::EBgScanEventAwsCmdComplete );
    
    }
Exemplo n.º 24
0
void AsScene1306Elevator::stGoingDown() {
	_isUp = false;
	setVisible(true);
	startAnimation(0x043B0270, -1, -1);
	_playBackwards = true;
	playSound(1);
	SetUpdateHandler(&AsScene1306Elevator::upGoingDown);
	NextState(&AsScene1306Elevator::cbGoingDownEvent);
}
Exemplo n.º 25
0
void CPolicyImporter::ChangeStateL()
    {
    switch (NextState())
        {
        case EStateBeginPolicyImport:
            StateBeginPolicyImportL();
            break;

        case EStateImportCaCert:
            StateImportCaCertL();
            break;

        case EStateAfterImportCaCert:
            StateAfterImportCaCertL();
            break;

        case EStateImportPeerCert:
            StateImportPeerCertL();
            break;

        case EStateAfterImportPeerCert:
            StateAfterImportPeerCertL();
            break;

        case EStateImportUserPrivKey:
            StateImportUserPrivKeyL();
            break;

        case EStateAfterImportUserPrivKey:
            StateAfterImportUserPrivKeyL();
            break;

        case EStateAttachCertificate:
            StateAttachCertificateL();
            break;

        case EStateAfterAttachCertificate:
            StateAfterAttachCertificateL();
            break;

        case EStateImportPinAndPol:
            StateImportPinAndPolL();
            break;

        case EStateCreateVpnDestination:
            StateCreateVpnDestinationL();
            break;

        case EStateEndPolicyImport:
            StateEndPolicyImportL();
            break;

        default:
            User::Panic(KVpnManagerServer, EInvalidImportState);
            break;
        }
    }
Exemplo n.º 26
0
void ACS_Idle::Send(AppLayerChannel* c, APDU& arAPDU, size_t aNumRetry)
{
	AppControlField acf = arAPDU.GetControl();
	FunctionCodes func = arAPDU.GetFunction();
	acf.SEQ = (acf.FIR && func == FC_RESPONSE) ? c->Sequence() : c->IncrSequence();
	arAPDU.SetControl(acf);
	c->ChangeState(NextState(c, arAPDU.GetFunction(), acf.CON));
	c->SetRetry(aNumRetry);
	c->QueueSend(arAPDU);
}
Exemplo n.º 27
0
//
// StateInit
//
void UnitExplore::StateInit()
{
    // Find an unexplored point and go to it
    Vector location = subject->RootOrigin();
    Point<S32> cell(subject->GetCellX(), subject->GetCellZ());
    TaskUtil::FindUnexplored(location, cell, subject->UnitType()->GetTractionIndex(subject->GetCurrentLayer()), subject->GetTeam());
    subject->Move(moveHandle, &location, NULL, GetFlags() & TF_AI ? TRUE : FALSE);

    NextState(0x9E947215); // "Moving"
}
Exemplo n.º 28
0
void KmScene1305::stCrashDown() {
	playSound(0, 0x41648271);
	_busyStatus = 1;
	_acceptInput = false;
	startAnimationByHash(0x000BAB02, 0x88003000, 0);
	SetUpdateHandler(&Klaymen::update);
	SetSpriteUpdate(NULL);
	SetMessageHandler(&Klaymen::hmLowLevelAnimation);
	NextState(&KmScene1305::stCrashDownFinished);
}
Exemplo n.º 29
0
// ---------------------------------------------------------------------------
// CWlanBgScan::DoSetInterval
// ---------------------------------------------------------------------------
//
void CWlanBgScan::DoSetInterval( TUint32 aNewInterval )
    {
    DEBUG1( "CWlanBgScan::DoSetInterval( aNewInterval: %u )", aNewInterval );
        
    SetAutoInterval( aNewInterval );
    DEBUG( "CWlanBgScan::DoSetInterval() - interval stored, giving event to state machine" );
    
    NextState( CWlanBgScanStates::EBgScanEventAwsIntervalChanged );

    }
/**
Accepts the input and checks if test can move to next/other state
@param	aClient
		a client which gives transition input
@param	aEvent
		event from the client
@param	aError
		error associated with the event
return  -1 if error should end the test; 0 test is in current state; 1 test move to new state		
 */
TInt CTestStepVidPlayerARN::AnalyseInput(TClient aClient, TTestEvent aEvent, TInt aError)
	{
	TInt res = JumpStateIfRequired(aClient, aEvent, aError,iCurrentState);
	if(res)
		{
		return res;		
		}
	
	if(aClient == ETestStep)
		{
		res = 1;			
		}
	else
		{
		CTransitionInput* pSet = ipTransitionSet[iCurrentState];
		for(TInt i = 0; i < iExpInputCnt[iCurrentState]; i++)
			{
			//check for client and event.
			if(pSet[i].iClient == aClient && pSet[i].iEvent == aEvent)
				{
				if(pSet[i].iError == aError)
					{
					if(!pSet[i].iMatched)
						{
						iRxInputCnt[iCurrentState]++;
						pSet[i].iMatched = ETrue;		
						}		
					}
				else if(!pSet[i].iIgnoreError)
					{
					return -1;	
					}
				break;
				}
			}
	
		if(iRxInputCnt[iCurrentState] == iExpInputCnt[iCurrentState])
			{
			res = 1;
			}
		else
			{
			res = 0;	
			}	
		}
		
	if(res == 1)
		{
		if(!NextState(iCurrentState))
			{
			res = -1;	
			}
		}
	return res;	
	}