void castSkybaserForGhost(Mission* mission, Airplane* airplane, CatToy* ghost)
{
    assert( ghost );

    // detect cattoy level
    float cattoyLevel = 0.25f * (
        ghost->getVirtues()->getEnduranceSkill() + 
        ghost->getVirtues()->getPerceptionSkill() +
        ghost->getVirtues()->getRiggingSkill() +
        ghost->getVirtues()->getTrackingSkill()
    );

    // detect player is a LICENSED_CHAR
    bool playerIsLicensed = mission->getScene()->getCareer()->getLicensedFlag();

    // build list of same level npc    
    std::vector<unsigned int> npcs;
    database::NPCInfo::select( cattoyLevel, 0.126f, !playerIsLicensed, npcs );

    // select NPC
    unsigned int index = getCore()->getRandToolkit()->getUniformInt() % npcs.size();
    unsigned int npcId = npcs[index];
    
    // create NPC
    NPC* npc = new NPC( mission, npcId, airplane, NULL, ghost );

    // devote ghost
    npc->devoteCattoy();

    // setup cameraman behaviour
    npc->setProgram( new NPCCameraman( npc ) );

    // setup brief signature
    npc->getJumper()->setSignatureType( stBrief );
}
NPC* castGhostNPC(Mission* mission, Enclosure* enclosure, CatToy* ghost, unsigned int npcId)
{
    // create NPC
    NPC* npc = new NPC( mission, npcId, NULL, enclosure, ghost );
    // setup cameraman behaviour
    npc->setProgram( new NPCCameraman( npc ) );
    // setup brief signature
    npc->getJumper()->setSignatureType( stBrief );
    return npc;
}
void Mission::consumePacket(NetworkData *packet) {
	getCore()->logMessage("Revceived packet with data_type: %d", packet->data_type);

	// network id [int]
	if (packet->data_type == 1) {
		memcpy(&this->getPlayer()->network_id, packet->data, sizeof this->network_id);
		this->network_id = this->getPlayer()->network_id;
		
	// add jumper
	} else if (packet->data_type == 2) {
		getCore()->logMessage("Create jumper with net id: %d", packet->receiver_id);
		NPC* npc = new NPC( this, 1, getPlayer()->getAirplane(), getPlayer()->getEnclosure(), CatToy::wrap( getPlayer() ), getPlayer(), true );
		npc->getJumper()->network_id = packet->receiver_id;
		npc->getJumper()->getFreefallActor()->setMass(getPlayer()->getVirtues()->appearance.weight);
		npc->getJumper()->getFreefallActor()->setGlobalPose(getPlayer()->getFreefallActor()->getGlobalPose());
		npc->getJumper()->getFreefallActor()->setLinearVelocity(getPlayer()->getFreefallActor()->getLinearVelocity());
		npc->getJumper()->beginFreefall();	// begins in Jumper
		delete packet;
	}
}
Example #4
0
void castingCallback_BASEVFF_PCA(Actor* parent)
{
    Mission* mission = dynamic_cast<Mission*>( parent ); assert( mission );    

    // build forced equipment
    Virtues::Equipment equipment = selectBASEEquipment( 
        mission->getScene()->getCareer(),
        mission->getScene()->getLocation()->getWindAmbient(),
        mission->getScene()->getLocation()->getWindBlast()
    );

    // exit point
    Enclosure* exitPoint = parent->getScene()->getExitPointEnclosure( mission->getMissionInfo()->exitPointId );

    // cast player on exit point
    mission->setPlayer( new Jumper( mission, NULL, exitPoint, NULL, NULL, &equipment ) );

    // setup brief signature for player
    mission->getPlayer()->setSignatureType( stBrief );

    // cast LICENSED_CHAR as assist base jumper
    unsigned int npcId = database::NPCInfo::getLicensedCharacterId();
    if( mission->getScene()->getCareer()->getLicensedFlag() ) 
    {
        npcId = database::NPCInfo::getRandomNonLicensedCharacter( 
            mission->getScene()->getCareer()->getVirtues()->getSkillLevel(), 0.25f
        );
    }
    NPC* joeBlack = new NPC( mission, npcId, NULL, exitPoint, CatToy::wrap( mission->getPlayer() ) );

    joeBlack->setProgram( new NPCAssist( joeBlack, mission->getPlayer() ) );

    // setup brief signature for LICENSED_CHAR
    joeBlack->getJumper()->setSignatureType( stBrief );

    // cast instructor
    new instructor::BASEInstructor01( mission->getPlayer() );
    new GoalStateOfHealth( mission->getPlayer() );
    new GoalStateOfGear( mission->getPlayer() );

    // play original music for this mission
    Gameplay::iGameplay->playSoundtrack( "./res/sounds/music/dirty_moleculas_action.ogg" );
}
NPC* castCameramanNPC(Mission* mission, Enclosure* enclosure, Jumper* player, std::vector<unsigned int>& npcs)
{
    assert( npcs.size() );

    if( npcs.size() )
    {
        // select NPC
        unsigned int index = getCore()->getRandToolkit()->getUniformInt() % npcs.size();
        unsigned int npcId = npcs[index];
        npcs.erase( npcs.begin() + index );
        // create NPC
        NPC* npc = new NPC( mission, npcId, NULL, enclosure, CatToy::wrap( player ) );
        // setup cameraman behaviour
        npc->setProgram( new NPCCameraman( npc ) );
        // setup brief signature
        npc->getJumper()->setSignatureType( stBrief );
        return npc;
    }

    return NULL;
}
void castingCallback_OpenAir_Opening(Actor* parent)
{
    Mission* mission = dynamic_cast<Mission*>( parent ); assert( mission );    

    // technical platform
    Enclosure* technicalPlatform = parent->getScene()->getExitPointEnclosure( 0 );

    // exit point
    Enclosure* exitPoint = parent->getScene()->getExitPointEnclosure( mission->getMissionInfo()->exitPointId );

    // cast player on exit point
    mission->setPlayer( new Jumper( mission, NULL, exitPoint, NULL, NULL, NULL ) );

    // setup full signature for player
    mission->getPlayer()->setSignatureType( stFull );

    // cast player smokejet
    new SmokeJet( mission->getPlayer(), Vector4f( 0.25f, 1.0f, 0.25f, 1.0f ), sjmRight );

    // select NPCs
    std::vector<unsigned int> npcs;
    selectNPCs( mission->getPlayer(), 0.26f, npcs );

    // cast cameraman NPC for player
    NPC* cameraman = castCameramanNPC( mission, exitPoint, mission->getPlayer(), npcs );
    assert( cameraman );
    if( cameraman )
    {
        new SmokeJet( cameraman->getJumper(), Vector4f( 0.25f, 0.25f, 1.0f, 1.0f ), sjmRight );
    }

    // load ghost
    CatToy* catToy = CatToy::loadGhostCatToy( "./usr/cattoys/openair/opening01.cattoy" ); assert( catToy );

    // cast ghost NPC at technical platform
    NPC* ghost = ::castGhostNPC( mission, technicalPlatform, catToy, npcs );
    assert( ghost );
    if( ghost )
    {
        new SmokeJet( ghost->getJumper(), Vector4f( 1.0f, 0.25f, 0.25f, 1.0f ), sjmRight );
    }

    // cast ghost's cameraman
    NPC* ghostCameraman = ::castCameramanNPC( mission, technicalPlatform, ghost->getJumper(), npcs );
    assert( ghostCameraman );
    if( ghostCameraman )
    {
        new SmokeJet( ghostCameraman->getJumper(), Vector4f( 1.0f, 1.0f, 0.25f, 1.0f ), sjmRight );
    }

    // cast script
    new script::OpenAir_Opening_Script( mission->getPlayer(), catToy );

    // cast goals
    new GoalStateOfHealth( mission->getPlayer() );
    new GoalStateOfGear( mission->getPlayer() );
    new GoalLanding( mission->getPlayer() );
    new GoalExperience( mission->getPlayer() );
    new GoalBonus( mission->getPlayer(), Gameplay::iLanguage->getUnicodeString(533), btProgressive, 1.0f );
	new GoalFreeFallTime( mission->getPlayer() );
	new GoalCanopyTime( mission->getPlayer() );

    // play original music for this mission
    Gameplay::iGameplay->playSoundtrack( "./res/sounds/music/lot of lie.ogg" );
}