コード例 #1
0
void Scene_House_Out::Init()
{
   _lpSceneDirector->ChangeMusic(DIRECTOR_MUSIC_NONE, true);
   _lpSceneDirector->ShowIHM(true);

   // Glit sur la portière
   if (TaskResolved("car_box_map") && TaskResolved("car_box_key")) {
      GetObjectImageByName("out_car_zone")->EnableGlitch(false);
   }
   
   if (!TaskResolved("task_out_firstvisit")) {
      ResolveTask("task_out_firstvisit");
      AddObjective("house","getmap");
      AddHint("house","getmap","how");
      _lpSceneDirector->getSequencer()->Callback(NULL, "tutoask");
      _lpSceneDirector->getDiaryPtr()->beginCreatePage();
      _lpSceneDirector->getDiaryPtr()->addImageToPage("diary_out.png");
      _lpSceneDirector->getDiaryPtr()->addStringToPage("DIARY_OUT", FONT_DIARY_1, 0, 0);
      _lpSceneDirector->getDiaryPtr()->endCreatePage();
   }
   
   if (TaskResolved("out_house_zeps")) {
      GetObjectImageByName("out_house_zeps")->EnableGlitch(false);
   }
         
   if (getAdditionalName() == "gotohouse") {
      AddObjective("house","enterhouse");
      AddHint("house","enterhouse","how");
      if (TestGlobal("__tutorial__")) {
         _lpSceneDirector->getSequencer()->Tutobox(NULL, KStr("HOUSE_OUT_TUTO_ENTERHOUSE"), 273, 204, 180, 200);
      }
   }

   _lpSceneDirector->getSequencer()->PreloadVideo("videos/zeppelins.ogv");
}
コード例 #2
0
ファイル: scion02.cpp プロジェクト: Nielk1/bz2-sp-fixes
void scion02::ArtilleryObjective(void) {
	ClearObjectives();
	if (art_objective1) {
		AddObjective("scion0205.otf",GREEN,5.0f);
	} else AddObjective("scion0205.otf",WHITE,5.0f);
	if (art_objective2) {
		AddObjective("scion0209.otf",GREEN,5.0f);
	} else AddObjective("scion0209.otf",WHITE,5.0f);

}
コード例 #3
0
void Scene_House_Basement_Grid::Init()
{
   // 1ère visite de la grille
   if (!TaskResolved("task_house_basement_visitgrid")) {
      ResolveTask("task_house_basement_visitgrid");
      AddObjective("house","basementgrid");
      AddHint("house","basementgrid","how");
   }
   
   // Grille ouverte ?
   if (TaskResolved("task_house_basement_opengrid")) {
      SetVisible("basement_grid_gridclosed", false, true);
      SetVisible("basement_grid_gridopen", true, true);
      // La vis
      SetVisible("basement_grid_bolt", TestGlobal("basement_grid_bolt") == false, true);
   } else {
      SetVisible("basement_grid_gridclosed", true, true);
      SetVisible("basement_grid_gridopen", false, true);
   }

   // Le charbon
   if (TaskResolved("task_house_basement_reversecoal")) {
      SetVisible("basement_grid_coal", true, true);
      // Le fusain
      SetVisible("basement_grid_charcoal", TestGlobal("basement_grid_charcoal") == false, true);
   }
}
コード例 #4
0
void Scene_Inca_Mainscreen::Init()
{
   StartAnimation("bg2_anim");
   StartAnimation("clouds_anim");

   if (!TaskResolved("inca_ashleytalkintro")) {
      ResolveTask("inca_ashleytalkintro");
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, true);
      _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("INCA_DIALOGBOX_INTRO1"), "", false, true);
      _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("INCA_DIALOGBOX_INTRO2"), "", false, true);
      _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("INCA_DIALOGBOX_INTRO3"), "", false, true);
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, false);
      AddTask("task_inca_findspear");
      AddObjective("inca","spear");
      AddHint("inca","spear","where");
   }
   
   // Ajout de la statuette à l'inventaire si elle n'y est pas déjà
   if (_lpSceneDirector->getInventory()->getItemFromInventory("inv_inca_statuette") == NULL) {
      _lpSceneDirector->getInventory()->AddItem("inca","inv_inca_statuette");
   }
   
   // Morceaux de lance
   SetupItem("inca_spear[1]");
   SetupItem("inca_spear[2]");
   SetupItem("inca_spear[3]");
   SetupItem("inca_spear[4]");   
   SetupItem("inca_spear[5]");
   if (TaskResolved("task_inca_opencube")) {
      SetupItem("inca_spear[6]");
   }
   
   // Bloc de pierre
   if (TaskResolved("task_inca_opencube")) {
      SetVisible("inca_main_cubesclosed", false, true);
      SetVisible("inca_main_cubesopen", true, true);
   }
   else {
      SetVisible("inca_main_cubesclosed", true, true);
      SetVisible("inca_main_cubesopen", false, true);
   }
   
   // Le garde
   // Il n'a pas encore sa lance
   if (!TaskResolved("task_inca_givespear")) {
      SetVisible("inca_main_guard_nospear", true);
   }
   // Il a eu sa lance
   else {
      SetVisible("inca_main_guard_spear", true);
   }
   
   // La porte est ouverte
   if (TaskResolved("task_inca_opendoor")) {
      SetVisible("inca_main_door", false, false);
   }
}
コード例 #5
0
ファイル: isdf06.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf06Mission::ConstructionMessage(void)
{
    ClearObjectives();
    AddObjective("isdf0604.otf",WHITE,10.0f);
    if (cbunker!=NULL)
    {
        AddObjective("isdf0605.otf",GREEN,10.0f);
    } else
        AddObjective("isdf0605.otf",WHITE,10.0f);

    if ((guntow1!=NULL) && (guntow2!=NULL))
    {
        AddObjective("isdf0606.otf",GREEN,10.0f);
    }	else
        AddObjective("isdf0606.otf",WHITE,10.0f);


}
コード例 #6
0
void Scene_House_IncaBook::Init()
{
   if (!TaskResolved("task_house_incabook_discover")) {
      ResolveTask("task_house_incabook_discover");
      AddObjective("house","living_buildbase");
      AddHint("house","living_buildbase","fire");
   }
   
	PageSet(_nCurrentPage);
}
コード例 #7
0
ファイル: mainscr.cpp プロジェクト: meiavy/Wyrmgus
/**
**  Adds objective to the stack
**
**  @param msg  Objective to add.
*/
void MessagesDisplay::AddObjective(const char *msg)
{
	char *ptr;
	char *next;
	char *message = Objectives[ObjectivesCount];
	// Split long message into lines
	if (strlen(msg) >= sizeof(Objectives[0])) {
		strncpy(message, msg, sizeof(Objectives[0]) - 1);
		ptr = message + sizeof(Objectives[0]) - 1;
		*ptr-- = '\0';
		next = ptr + 1;
		while (ptr >= message) {
			if (*ptr == ' ') {
				*ptr = '\0';
				next = ptr + 1;
				break;
			}
			--ptr;
		}
		if (ptr < message) {
			ptr = next - 1;
		}
	} else {
		strcpy_s(message, sizeof(Objectives[ObjectivesCount]), msg);
		next = ptr = message + strlen(message);
	}

	while (UI.MessageFont->Width(message) + 8 >= UI.MapArea.EndX - UI.MapArea.X) {
		while (1) {
			--ptr;
			if (*ptr == ' ') {
				*ptr = '\0';
				next = ptr + 1;
				break;
			} else if (ptr == message) {
				break;
			}
		}
		// No space found, wrap in the middle of a word
		if (ptr == message) {
			ptr = next - 1;
			while (UI.MessageFont->Width(message) + 8 >= UI.MapArea.EndX - UI.MapArea.X) {
				*--ptr = '\0';
			}
			next = ptr + 1;
			break;
		}
	}

	++ObjectivesCount;

	if (strlen(msg) != (size_t)(ptr - message)) {
		AddObjective(msg + (next - message));
	}
}
コード例 #8
0
ファイル: isdf07.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf07Mission::handlePlayerMistakes() {
	if (missionState < 6) {	//Not enough scrap
		if ((missionState>3) &&
			(GetScrap(1) < 6) && (GetTime() > errorRemTime1)) {
			ClearObjectives();
			AddObjective("isdf0709.otf", WHITE);
			AudioMessage("isdf0709.wav");
			errorRemTime1 = (GetTime() + 60.0f);
		}


	}

	if (!IsAlive(shabayev)) {	//kills shabayev
	//	AudioMessage("Demo0304.wav"); // "Cooke.  You're being shipped back to Earth where you'll face court marshall for killing a commanding officer.
	//	FailMission(GetTime() + 15.0f);
	}

/*	if (!IsAlive(player)) { //gets killed
	//	AudioMessage("Demo0304.wav"); // you loose go to shell screen
		FailMission(GetTime() + 15.0f);
	}*/

	if (missionState == 6) {//does not follow shabayev
		if ((GetDistance(player, shabayev) > 400.0f) && (GetTime() < timeToFail)) {
		//	AudioMessage("tooFar.wav"); //"Cooke, you're getting too far from my wing.  Fall in.
			timeToFail = GetTime() + 60.0f;
		}
		else 
		if (GetDistance(player, shabayev) < 400.0f) {
			timeToFail = 0.0f;
		}


	}
	if (missionState == 7) {//does not get out of his vehicle

	}
	if (missionState == 9) {//ignores shabayev's need for help
		if ((GetDistance(player, shabayev) > 40.0f) && (GetTime() < timeToFail)) {
		//	AudioMessage("tooFar.wav"); //"Cooke, you're getting too far from my wing.  Fall in.
			timeToFail = GetTime() + 60.0f;
		}
		if  (GetDistance(player, shabayev) < 40.0f) {
			timeToFail = 0.0f;
		}

	}
}
コード例 #9
0
void Scene_Inca_Mainscreen::Draw()
{
   double fElapsed = MyGame::getGame()->getKWindow()->getFrameTime();
   if (_bAnimDoor) {
      _lpAnimDoor->move(fElapsed);
      // Déplace la porte
      RestorePosition("inca_main_door");
      MovePosition("inca_main_door", GetRandom(-1.0, 1.0), _lpAnimDoor->getCurrentValue());
      if (_lpAnimDoor->isCompleted()) {
         _bAnimDoor = false;
         ResolveTask("task_inca_opendoor");
         AddObjective("inca","4artefacts");
         AddHint("inca","4artefacts","where");
         AddHint("inca","4artefacts","light");
         _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, false);
      }
   }
   
   EScene::Draw();
}
コード例 #10
0
void Scene_House_Hall::Init()
{
   SetupItem("house_score");

   _lpSceneDirector->getMap()->renameZone("hall", "house_hall");
   _lpSceneDirector->getMap()->setVisited("house_hall");
      
   if (getAdditionalName() == "start") {
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_LOCKMOUSE, true);
      int x, y;
      GetObjectPosition("nathan_shadow", x, y, true, false);
      ResolveTask("task_house_openliving");
      SetVisible("nathan_shadow",true, true);
      StartEmitter("creeping_nathan_shadow");
      _lpSceneDirector->getSequencer()->EarthQuake("earthquakehall",false,"hall_earthquake");
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_fragments", false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_plaster", false);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "hall_earthquakeout");
      _lpSceneDirector->getSequencer()->SwitchImage(NULL, "nathan9", "nathan14");
      _lpSceneDirector->getSequencer()->SwitchImage(NULL, "nathan14", "nathan15");
      _lpSceneDirector->getSequencer()->SwitchImage(NULL, "nathan15", "hall_isaac_waiting");

//      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, true);
//      _lpSceneDirector->getSequencer()->PickupItem(NULL,"inv_hexagramme", 1024/2, 768/2, 1);
//      _lpSceneDirector->getSequencer()->ShowImage(NULL, "neckless", true, false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_shadow",false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_show",true);
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"nathan_show",true);
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"nathan_shadow",false);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HALL_NATHAN_STARTHERE"), "nathan_hall_starthere", false);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "opendoor");
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"house_hall_livingdooropen", true, true);
      _lpSceneDirector->getSequencer()->Wait(NULL, 500);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_souls1",true);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostgone");
      _lpSceneDirector->getSequencer()->ShowImage(NULL, "nathan_show", false, false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_show",false);
      _lpSceneDirector->getSequencer()->Callback(NULL,"inv_hexagramme");
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, false);

      _lpSceneDirector->getDiaryPtr()->beginCreatePage();
      _lpSceneDirector->getDiaryPtr()->addImageToPage("diary_hall.png");
      _lpSceneDirector->getDiaryPtr()->addStringToPage("DIARY_HALL1", FONT_DIARY_1, 0, 0);
      _lpSceneDirector->getDiaryPtr()->endCreatePage();
      _lpSceneDirector->getDiaryPtr()->beginCreatePage();
      _lpSceneDirector->getDiaryPtr()->addStringToPage("DIARY_HALL2", FONT_DIARY_1, 0, 0);
      _lpSceneDirector->getDiaryPtr()->addImageToPage("diary_medaillon.png");
      _lpSceneDirector->getDiaryPtr()->endCreatePage();

      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_LOCKMOUSE, false);

      AddObjective("house","contactyumanco");
      AddHint("house","contactyumanco","where");
   }
   
   // Plante
   if (!TaskResolved("task_house_getbrushwood")) {
      SetVisible("house_hall_plant", true, true);
   }
   else {
      SetVisible("house_hall_plant_done", true, true);
   }
   
   // Isaac
   if (!TaskResolved("task_house_hall_groundfloor") && getAdditionalName()=="") {
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "hall_dog_cry");
      SetVisible("hall_isaac_waiting", true, true);
   }

   // Porte du salon
   if (TaskResolved("task_house_openliving") && getAdditionalName() == "") {
      SetVisible("house_hall_livingdooropen", true, true);
   }
   
   // Porte de la salle à manger ouverte ou fermée ?
   if (ObjectiveResolved("house","helpnatsumi")) {
      SetVisible("diningroom", false);
      SetVisible("house_hall_diningdooropen", true, true);
   }
   else {
      SetVisible("diningroom", true);
      SetVisible("house_hall_diningdooropen", false);
   }

   // Etage résolu
   if (TaskResolved("task_house_hall_groundfloor")) {
      ResolveGroundFloor();
   }
   
   // Premier retour dans le hall après avoir sauvé l'inca
   if (TaskResolved("task_inca_universeresolved") && !TaskResolved("task_meetnathan2")) {
      int x, y;
      GetObjectPosition("nathan_corridor", x, y, true, false);
      ResolveTask("task_meetnathan2");
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, true);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_souls2",true);
      _lpSceneDirector->getSequencer()->Wait(NULL, 2000);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_corridor",true);
      _lpSceneDirector->getSequencer()->Wait(NULL, 2000);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "attic_nathanappear");
      _lpSceneDirector->getSequencer()->ShowImage(NULL, "nathan_corridor", true);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_souls2",false);
      _lpSceneDirector->getSequencer()->Wait(NULL, 1500);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HALL_NATHAN_MEET2_1"), "HALL_NATHAN_MEET2_1", false);
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, false);
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, true);
      _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("HALL_ASHLEY_MEET2"),"hall_ashley_meet2",false,true);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_souls2",true);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HALL_NATHAN_MEET2_3"), "HALL_NATHAN_MEET2_3", false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_souls2",true);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostgone");
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL,"creeping_nathan_corridor",false);
      _lpSceneDirector->getSequencer()->ShowImage(NULL, "nathan_corridor", false);
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, false);
      _lpSceneDirector->getDiaryPtr()->beginCreatePage();
      _lpSceneDirector->getDiaryPtr()->addImageToPage("diary_hall.png");
      _lpSceneDirector->getDiaryPtr()->addStringToPage("DIARY_NATHAN2", FONT_DIARY_1, 0, 0);
      _lpSceneDirector->getDiaryPtr()->endCreatePage();
   }
   else {
      if (!TaskResolved("hall_tuto_guide") && getAdditionalName() != "start") {
         ResolveTask("hall_tuto_guide");
         if (TestGlobal("__tutorial__")) {
            _lpSceneDirector->getSequencer()->Tutobox(NULL, KStr("HOUSE_OUT_TUTO_TASK"), 70, 740, -90, 200);
         }
      }
   }
}
コード例 #11
0
ファイル: isdf06.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf06Mission::AddObject(Handle h)
{
    char ODFName[64];
    GetObjInfo(h, Get_CFG, ODFName);

    if (start_done)
    {
        if ((cbunker==NULL) && (IsOdf2(h,"ibcbun")))
        {
            if (GetDistance(h,"pool")<200.0f)
            {
                cbunker=h;
                ConstructionMessage();
            }
            else
            {
                // consturction warning
                ClearObjectives();
                AddObjective("isdf0610.otf",RED,10.0f);
            }
        }
        else {
            if ((guntow1==NULL) && (IsOdf2(h,"ibgtow")))
            {
                if (GetDistance(h,"pool")<400.0f)
                {
                    guntow1=h;
                    ConstructionMessage();
                }
                else
                {
                    // construction warning
                    ClearObjectives();
                    AddObjective("isdf0610.otf",RED,10.0f);
                }
            }
            else
            {
                if ((guntow2==NULL) && (IsOdf2(h,"ibgtow")))
                {
                    if (GetDistance(h,"pool")<400.0f)
                    {
                        guntow2=h;
                        ConstructionMessage();
                    }
                    else
                    {
                        // construction warning
                        ClearObjectives();
                        AddObjective("isdf0610.otf",RED,10.0f);
                    }
                }
            }
        }
        if (IsOdf2(h,"fbscav"))  // assuming fvscav-> ibscav
        {
            escav=h;
        }

        if (IsOdf2(h,"ivbomb"))
        {
            SetPerceivedTeam(h,2);  // so they won't shoot it
        }
    }
    if (IsOdf2(h,"ibscav")) {
        scav_count++;
    }

    // Tweak NM 12/20/03 if the spawned-in scav dies, use any built scav
    // as a replacement
    if((mission_state == 4) && (scav == NULL) && (IsOdf2(h,"ivscav"))) {
        scav = h;
        Goto(scav,"pool");
    }

    /*
    	if ((scav1 == NULL) && (IsOdf2(h,"ivscav")))
    	{
    		scav1 = h;
    	}
    	else if ((scav2 == NULL) && (IsOdf2(h,"ivscav")))
    	{
    		scav2 = h;
    	}
    	else if ((turret1 == NULL) && (IsOdf2(h,"ivturr")))
    	{
    		turret1 = h;
    	}
    	else if ((turret2 == NULL) && (IsOdf2(h,"ivturr")))
    	{
    		turret2 = h;
    	}
    	else if ((wingman1 == NULL) && (IsOdf2(h,"ivscout")))
    	{
    		wingman1 = h;
    	}
    	else if ((wingman2 == NULL) && (IsOdf2(h,"ivscout")))
    	{
    		wingman2 = h;
    	}
    */
}
コード例 #12
0
ファイル: isdf07.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf07Mission::Execute(void) {

	
/* The following is needed for editing cineractives. */	
	if (BeginCin == true) {
		BeginCin = PlayMove();
	}

	if (BeginSeq == true) {
		char temp[20] = "***";
		BeginSeq = PlayMovie(temp);
	}
	if (IFace_GetFloat("script.cin.edit") == 1.0) {
//		cinToolSetup();
		IFace_SetFloat("script.cin.edit", 0.0);
	}
/* The above is needed for editing cineractives. */



	
	player = GetPlayerHandle();

	//This section evaluates what has happened.
	checkWing(shabayev, player); //Did we hurt our friendly instructor.
	switch (missionState) {
		case 0: //This will do the setup for the mission.
			spawn1 = GetHandle("spawn_1");
			spawn2 = GetHandle("spawn_2");
			spawn3 = GetHandle("spawn_3");
			creature1=BuildObject("mcjak01",0,"creature1");
			creature2=BuildObject("mcjak01",0,"creature2");
			creature3=BuildObject("mcjak01",0,"creature3");
			creature4=BuildObject("mcjak01",0,"creature4");

			shabayev = BuildObject("ivtank",3,"spawn_shab");
			recy = GetHandle("recycler");
			ruins = GetHandle("ruins");
			SetScrap(1, 40);
//			playerEnemy1 = BuildObject("fvtank", 2, spawn3);
//			Attack(playerEnemy1, player, 1);
			CommandShab();
			AudioMessage("isdf0701.wav");
			AudioMessage("isdf0740.wav");
			AudioMessage("isdf0702.wav");
			AudioMessage("isdf0703.wav");
			SetSkill(shabayev,3);
			SendEnemies(0,player);
			{
				// brad added
				int poolHandle = GetHandle(288);
				SpawnBirds(1, 5, "mcwing01", 0, poolHandle, poolHandle);
			}
			missionState++;
			break;
		case 1: //Check to see if the player has deployed their recycler.
			if (!getNewOrder) {
				ClearObjectives();
				AudioMessage("isdf0704.wav");
				AddObjective("isdf0701.otf", WHITE);
				reminderTimer = (GetTime() + 60.0f);
				if (!IsAlive(animal1)) {
					animal1 = BuildObject("mcjak01", 2, spawn3); //This will be changed to the animal
					Goto(animal1, recy);
					SetIndependence(animal1, 0);
				}
				getNewOrder = true;
			}

			//	recyDeployed = IsDeployed(recy);
			if (recyDeployed) {
				AudioMessage("isdf0706.wav");
				missionState++;
				getNewOrder = false;
			}
			if ((IsAlive(playerEnemy1)) && (!enemy1deployed) &&
				(GetDistance(recy,playerEnemy1)<100.0f))
			{
				enemy1deployed=true;
			}
			if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) {
				playerEnemy1 = BuildObject("fvtank", comp_team, spawn3);
				Attack(playerEnemy1, player, 1);
			}
			break;
		case 2: //Check to see if the player has built a scavenger.
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0702.otf", WHITE);
				reminderTimer = (GetTime() + 60.0f);
				AudioMessage("isdf0708.wav");
				getNewOrder = true;
			}
			if (scavBuilt) {
				AudioMessage("isdf0707.wav");
				reminderTimer = (GetTime() + 30.0f);
				missionState++;
				getNewOrder = false;
			}
			if ((IsAlive(playerEnemy1)) && (!enemy1deployed) &&
				(GetDistance(recy,playerEnemy1)<100.0f))
			{
				enemy1deployed=true;
			}
			if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) {
				playerEnemy1 = BuildObject("fvtank", 2, spawn3);
				Attack(playerEnemy1, player, 1);
			}

			break;
		case 3: //Check to see if the player has built a construction rig.
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0703.otf", WHITE);
				AudioMessage("isdf0710.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if ((IsAlive(playerEnemy1)) && (!enemy1deployed) &&
				(GetDistance(recy,playerEnemy1)<100.0f))
			{
				enemy1deployed=true;
			}
			if (constBuilt) {
				missionState++;
				getNewOrder = false;
			}
			break;
		case 4: //Check to see if the player has built a power plant.
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0704.otf", WHITE);
				AudioMessage("isdf0714.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if (powerBuilt) {
				missionState++;
				getNewOrder = false;
			}
			if ((!IsAlive(playerEnemy1)) && (!IsAlive(enemy1))) {
				playerEnemy1 = BuildObject("fvtank", 2, spawn3);
				Attack(playerEnemy1, player, 1);

			}

			break;
		case 5:  // check to see if the player has built a relay bunker
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0705.otf", WHITE);
				AudioMessage("isdf0716.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if (relayBuilt) {
				missionState++;
				getNewOrder = false;
			}

			break;
		case 6: //Check to see if the player has built a gun tower
			if (!getNewOrder) {
				ClearObjectives();
				AddObjective("isdf0706.otf", WHITE);
				AudioMessage("isdf0719.wav");
				reminderTimer = (GetTime() + 60.0f);
				getNewOrder = true;
			}
			if (gunTowBuilt) 
			{
				missionState++;
				artil=BuildObject("fvartl",2,"artil");
				Goto(artil,"artillery");
				Handle temp=BuildObject("fvscout",2,spawn2);
				Follow(temp,artil);
				BuildObject("fvscout",2,spawn3);
				Follow(temp,artil);
				artil_counter=0;
				getNewOrder = false;
			}
			break;
		case 7:  // now they will use artillery
			artil_counter++;
			if (artil_counter==300)
			{
				Attack(artil,gtow);
		//		CameraReady();
			}
			if ((artil_counter>300) & (artil_counter<355))
			{
		//		CameraObject(artil,12,8,3,artil);
			}
			if (artil_counter==355)
			{
		//		CameraFinish();
				missionState++;
			}
			// cheesy code but I am tired
			break;
		case 8:
			if (!IsAlive(artil))
			{
				missionState++;
			}
			break;
	
	}
	float currentTime = GetTime();
	if ((reminderTimer < currentTime) && (getNewOrder)) { //This checks to see if we should remind the player of his order.
		getNewOrder = false;
	}
	harrass_count++;
	if (harrass_count%701==0)
	{
		SendEnemies(1,player);
	}
	CommandShab();
	handlePlayerMistakes();
	if (shabState<3) {
		if ((!IsAlive(shabayev) && (!shab_dead)))	
		{
			AudioMessage("isdf0732.wav");
			ClearObjectives();
			AddObjective("isdf05l1.otf",RED,15.0f);
			FailMission(GetTime()+5.0f,"isdf05l1.otf");
			shab_dead=true;
		}
	}

	if ((!IsAround(recy)) && (!shab_dead))
	{
		FailMission(GetTime()+5.0f,"isdf05l1.otf");
		shab_dead=true;
	}


}
コード例 #13
0
ファイル: isdf20.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf20Mission::Execute(void)
{
/*
	Here is where you put what happens every frame.  
*/


	/*
		LANDSLIDE INFO
		- .bzn has file reslida1.odf
		- Don't forget to delete bin data before you try this
		- Run animation on reslid01.odf
		- Replace it with reslidea1.odf
	*/
	player = GetPlayerHandle();
	char tempstr[128]; 
	Ally(1,3);
	switch (mission_state)
	{
		case 0:
				    // build this stuff at start
		/*	
				Handle recy=BuildObject("ivrecy",1,"Recycler");
				int grp=GetFirstEmptyGroup();
			SetGroup(recy,grp);			
			SetScrap(1,30);
			*/
			// deleted for Nathan
			  /*
			mbike_1=BuildObject("ivmbike",3,"mbike1");
			mbike_2=BuildObject("ivmbike",3,"mbike2");
		    mbike_3=BuildObject("ivmbike",3,"mbike3");
			*/
		    tank_1=BuildObject("ivatank",1,"tank1");  // was atank
			SetGroup(tank_1,0);
			tank_2=BuildObject("ivrckt",1,"tank2");  // was atank
			SetGroup(tank_2,1);
			// serv= BuildObject("ivserv",1,"serv");
			// Set
			//    scav_1=BuildObject("ivscav",1,"scav1");
			//    scav_2=BuildObject("ivscav",1,"scav2");
//			rckt_1=BuildObject("ivrckt",1,"rckt1");
//			rckt_2=BuildObject("ivrckt",1,"rckt2");
			SetGroup(rckt_1,1);
			SetGroup(rckt_2,1);
			serv_1=BuildObject("ivserv",1,"scav1");
			SetGroup(serv_1,2);

			espir_2=BuildObject("ibgtow",comp_team,"base_here");
			esent_1=BuildObject("ivmisl",comp_team,"esentpath1");
			esent_2=BuildObject("ivmisl",comp_team,"esentpath1");
			espir_1=BuildObject("ibgtow",comp_team,"espir1");
			base_1=BuildObject("ibfact",comp_team,"estro1");
			base_2=BuildObject("ibpgen",comp_team,"ekiln1");

			base_3=BuildObject("ibpgen",comp_team,"power_x");  // was eforg1
			base_4=BuildObject("ibcbun",comp_team,"bunker_x");
			espir_3=BuildObject("ibgtow",comp_team,"espir3");
			esent_3=BuildObject("ivscout",comp_team,"esent3");
			esent_4=BuildObject("ivscout",comp_team,"esent4");
			ClearObjectives();
			AddObjective("isdf20a.otf",WHITE,10.0f);
			Patrol(esent_1,"esentpath1");
			Follow(esent_2,esent_1);
			after_briefing= GetTime()+20.0f;
			slide1=GetHandle("unnamed_reslida1");
			//Vector temp=GetPosition(slide1);
			RemoveObject(slide1);

			nav=BuildObject("ibnav",1,"lung2");
			SetObjectiveOn(nav);
			TranslateString2(tempstr, sizeof(tempstr), "Mission2002");  // Rebel Base
			SetObjectiveName(nav,tempstr);
			// SetPosition(slide2??

			/*
				So the mission isn't too slow. 
			*/
			AddHealth(espir_1,-3000);
			AddHealth(espir_2,-3000);
			mission_state++;
			audio=AudioMessage("isdf2021.wav");
			CameraReady();
			break;
		case 1:
			CameraPath("camera1",200,200,player);

//			CameraObject(espir_1,30,20,20,espir_1);
			if (IsAudioMessageDone(audio))
			{
				audio=AudioMessage("isdf2022.wav");
				mission_state++;	
			}
			break;
		case 2 :
			CameraPath("camera2",200,200,espir_2);
			if (IsAudioMessageDone(audio))
			{	
				AudioMessage("isdf2001.wav");
				CameraFinish();
				mission_state++;
			}
			break;
		case 3:  //the attack begins
			
				// after the opening briefing, AI squadron drives to fight sentry units on their own
				if (GetTime() > after_briefing)
				{
				//	Goto(mbike_1,"front_ambush");
				//	Goto(mbike_2,"front_ambush");
				//	Goto(mbike_3,"front_ambush");
				//	Goto(rckt_1,"front_ambush");
				//	Goto(rckt_2,"front_ambush");
					Handle temp=BuildObject("ivscout",comp_team,"lung2");
					Attack(temp,player);
					mission_state++;
				}
			
			break;
		case 4: // Kill the sentries

  			// AI squadron engages sentry units
			if ((GetDistance(tank_1,"front_ambush")<200.0f)  ||
			      (GetDistance(tank_2,"front_ambush")<200.0f)  ||
					(GetDistance(rckt_1,"front_ambush")<200.0f)  ||
					(GetDistance(rckt_2,"front_ambush")<200.0f)  ||
					(GetDistance(player,"front_ambush")<200.0f) )
			{
				/*
				Attack(mbike_1,esent_1);
				Attack(mbike_2,esent_2);
				Attack(mbike_3,esent_1);
				*/
				SetObjectiveOn(esent_1);

				TranslateString2(tempstr, sizeof(tempstr), "Mission2001");  // Rebel
				SetObjectiveName(esent_1,tempstr);
				SetObjectiveOn(esent_2);
				SetObjectiveName(esent_2,tempstr);
		//		Attack(rckt_1,esent_2);
		//		Attack(rckt_2,esent_1);
			}
// once the sentrys are destroyed, AI squadron heads to enemy gun tower and stops
			if ((!IsAlive(esent_1))  &&  (!IsAlive(esent_2)))
			{
				/*
				Goto(mbike_1,"front_ambush");
				Goto(mbike_2,"front_ambush");
				Goto(mbike_3,"front_ambush");
				*/
		//		Goto(rckt_1,"front_ambush");
		//		Goto(rckt_2,"front_ambush");
		//		temp=BuildObject("ivscout",2,"lung2");
		//		Attack(temp,serv_1);
				mission_state++;
			}
			break;
		case 5:  // wait till they get to the tower
			if ((
				(GetDistance(tank_1,"front_ambush")<75.0f)  ||
				(GetDistance(rckt_2,"front_ambush")<75.0f)  ||
				(GetDistance(player,"front_ambush")<75.0f)))
				{
					Handle temp=BuildObject("ivscout",comp_team,"lung2");
					Attack(temp,player);
					AudioMessage("isdf2002.wav"); // use your assault tanks
					ClearObjectives();
					AddObjective("isdf2002.otf",WHITE,20.0f);
					SetObjectiveOn(espir_1);
				TranslateString2(tempstr, sizeof(tempstr), "Mission2003");  // Gun Tower
					SetObjectiveName(espir_1,tempstr);
					//temp=BuildObject("ivscout",2,"lung2");
					//Attack(temp,player);
					mission_state++;
				}
			break;
		case 6: // destroy the tower
// once you destroy the gun tower, AI squadron heads to next gun tower and stops
				if (!IsAlive(espir_1))  
				{
					Goto(mbike_1,"exit1");
					Goto(mbike_2,"exit1");
					Goto(mbike_3,"exit1");
		//			AudioMessage("isdf2003.wav"); // now let's press on to the base
		//			Goto(rckt_1,"exit1");
		//			Goto(rckt_2,"exit1");
		//			temp=BuildObject("ivscout",2,"lung2");
		//			Attack(temp,serv_1);
					mission_state++;
  
				}			
			break;
		case 7:  // now go to the next tower
			if (((GetDistance(tank_1,"exit1")<50.0f)  ||
				(GetDistance(rckt_1,"exit1")<50.0f)  ||
				(GetDistance(player,"exit1")<50.0f))) 
			{
				ClearObjectives();
				AddObjective("isdf2003.otf",WHITE,20.0f);
				AudioMessage("isdf2003.wav");
				mission_state++;
			}
			break;
		case 8:  // until enemy spire is dead
			if (!IsAlive(espir_2))	
			{
//				Attack(mbike_1,base_1);
//				Attack(mbike_2,base_1);
//				Attack(mbike_3,base_1);
				Attack(rckt_1,base_1,0);
				Attack(rckt_2,base_1,0);
				mission_state++;
			}
			break;
		case 9:
			if (!IsAlive(base_1)) 
			{
//				Attack(mbike_1,base_2);
//				Attack(mbike_2,base_2);
//				Attack(mbike_3,base_2);
				AudioMessage("isdf2004.wav");
				Attack(rckt_1,base_2,0);
				Attack(rckt_2,base_2,0);
				mission_state++;
			}

			break;
		case 10:
			if (!IsAlive(base_2))
			{
//				Attack(mbike_1,base_3);
//				Attack(mbike_2,base_3);
//				Attack(mbike_3,base_3);
				Attack(rckt_1,base_3,0);
				Attack(rckt_2,base_3,0);
				mission_state++;
			}
			break;
		case 11:// is the third base dead?
			if (!IsAlive(base_3))  
			{
/*
				Goto(mbike_1,"homebase");
				Goto(mbike_2,"homebase");
				Goto(mbike_3,"homebase");
*/
				Goto(rckt_1,"homebase",0);
				Goto(rckt_2,"homebase",0);
				// keep the player bunched up
				Follow(tank_1,player,0);
				Follow(tank_2,player,0);

				ClearObjectives();
				AddObjective("isdf2004.otf",WHITE,20.0f);
				SetObjectiveOff(nav);
				nav=BuildObject("ibnav",1,"scav2");
				TranslateString2(tempstr, sizeof(tempstr), "Mission2004");  // Rencezvous
				SetObjectiveName(nav,tempstr);
				SetObjectiveOn(nav);
				AudioMessage("isdf2005.wav");
				mission_state++;
			}
			break;
		case 12:
// first ambush launches as soon as you exit enemy base after destroying it
// second ambush comes in from behind
			if  (GetDistance(player,"exit1")<125.0f)
			{		
	  
				  ambush_delay=GetTime()+15.0f;
				  mission_state++;
			}
			break;
		case 13:
			if (GetTime()>ambush_delay) 
			{
				eatank_1=BuildObject("ivtank",comp_team,"eatank1");
				eatank_2=BuildObject("ivtank",comp_team,"eatank2");
				eatank_3=BuildObject("ivmbike",comp_team,"eatank3");
				SetSkill(eatank_1,2);
				SetSkill(eatank_2,2);
				SetSkill(eatank_3,2);
				Attack(eatank_1,player);
				Attack(eatank_2,player);
				Attack(eatank_3,player);
				etank_1=BuildObject("ivtank",comp_team,"etank1");
				etank_2=BuildObject("ivtank",comp_team,"etank2");
				etank_3=BuildObject("ivmbike",comp_team,"etank3");
				earch_1=BuildObject("ivtank",comp_team,"earch1");
				earch_2=BuildObject("ivtank",comp_team,"earch2");
				earch_3=BuildObject("ivmisl",comp_team,"earch3");
				manson= BuildObject("ivatank",comp_team,"manson");
				Attack(etank_1,player);
				Attack(etank_2,player);
				Attack(etank_3,player);
				Attack(earch_1,player);
				Attack(earch_2,player);
				Attack(earch_3,player);
				Attack(manson,player);
				uhoh= GetTime()+20.0f;
				mission_state++;
			}
			break;			
		case 14:
			if (GetTime() > uhoh) 
			{
				AudioMessage("isdf2006.wav");
				AudioMessage("isdf2007.wav");
				ClearObjectives();
				AddObjective("isdf2005.otf",WHITE,20.0f);
				Handle temp=BuildObject("ivapc",comp_team,"lung2");  // now you are screwed
				Attack(temp,player);
//				temp=BuildObject("ivapc",2,"lung2");
//				Attack(temp,player);
				mission_state++;
			}
			break;
		case 15:
			// how do you win??
			if ((!seen_manson) && (GetDistance(player,manson)<200.0f))
			{
				seen_manson=true;
				SetObjectiveOn(manson);
			}
			if (!IsAlive(manson))
			{
				AudioMessage("isdf2010.wav");	
				SucceedMission(GetTime()+10.0f,"isdf20w1.txt");
				mission_state++;
			}

			break;
	}  // switch (mission_state)
	PeriodicAttack();











// once you destroy the second gun tower, AI squadron enters enemy base and levels it

// infinite health and ammo
//    SetCurAmmo(player, 1200);
//    SetCurHealth(player, 3000);

// tells player to head back to base
//  if ((!IsAlive(enemybase))  &&  (!go_home))
//  {
//    AudioMessage("wahoo.wav");
//    go_home=true;
//  }

 

}
コード例 #14
0
ファイル: isdf07.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf07Mission::CommandShab() {
	char tempstr[128];
	switch (shabState) {
		case 0: //setup the first batch of enemies
			shabEnemy1 = BuildObject("fvsent", comp_team, spawn1);
			shabEnemy2 = BuildObject("fvsent", comp_team, spawn2);
			Attack(shabEnemy1, shabayev, 1);
			Attack(shabEnemy2, shabayev, 1);
			Attack(shabayev, shabEnemy1, 1);
			shabState++;
			break;
		case 1: //do nothing until the first enemy gets killed
			if (!IsAlive(shabEnemy1)) {
				if (IsAlive(shabEnemy2)) {
					Attack(shabayev, shabEnemy2, 1);
					shabState++;
				}
				else {
					shabState++;
				}
			}

			if (gunTowBuilt) { //If shab can't kill anybody do it for her
				Damage(shabEnemy1, 3000);
				if (IsAlive(shabEnemy2)) {
					Damage(shabEnemy2, 3000);
				}
				ClearObjectives();
				AddObjective("isdf0707.otf", WHITE);
				Goto(shabayev, "tree_point", 1);
				AudioMessage("isdf0728.wav");
				shabState = 3;
				BugFix=GetTime()+60.0f;
			}

			break;
		case 2: //go NEAR the ruin when all of the enemies are killed
			if ((missionState>8) && (IsAlive(shabEnemy2))) { //If shab can't kill anybody do it for her
				Damage(shabEnemy2, 3000);
			}
			if ((!IsAlive(shabEnemy1)) && (!IsAlive(shabEnemy2)) && (!gunTowBuilt)) {
				shabEnemy2 = BuildObject("fvsent", 2, spawn1);
				Attack(shabayev, shabEnemy2, 1);
				Attack(shabEnemy2, shabayev, 1);

			}
			if ((!IsAlive(shabEnemy1)) && (!IsAlive(shabEnemy2)) && (gunTowBuilt)) {
				ClearObjectives();
				AddObjective("isdf0710.otf", WHITE);
				AudioMessage("isdf0728.wav");
				Goto(shabayev, "tree_point", 1);
				BugFix=GetTime()+20.0f;
				shabState++;
			}
			break;
		case 3: //hop out of the vehicle when near the ruin
			if (GetTime()>BugFix)
			{
				Goto(shabayev,"tree_point");
				BugFix=GetTime()+10.0f;	
			}
			if (((GetDistance(shabayev, "tree_point") < 25.0)) && ((!IsAlive(enemy1)) || (!IsAlive(enemy2))))
			{
				ClearObjectives();
				AudioMessage("isdf0725.wav");

				AddObjective("isdf0707.otf", WHITE);
				justHoped = true;
				HopOut(shabayev);
//				SetObjectiveOn(shabOnFoot);
				hunter=	BuildObject("fvsent",comp_team,"hunter");
	//			Patrol(temp,"hunter_path");
				Attack(hunter,shabayev); // blow up shabs craft
				CameraReady();
				reminderTimer=GetTime()+60.0f;
				shabState++;
			}
			break;
		case 4:
			oldPlayer=HoppedOutOf(shabOnFoot);	// because shab becomes 0
			{
				Vector pos;
				pos = GetPosition(oldPlayer);
				CameraObject(oldPlayer,2,5,-7,oldPlayer);		
				LookAt(shabOnFoot, ruins, 1);
				RemoveObject(oldPlayer);
				oldPlayer=BuildObject("petank",1,pos);
			}
			shabState++;
			break;
		case 5:
			if (movie_counter<70)
			{
				CameraObject(oldPlayer,2,2,-7,oldPlayer);
				movie_counter++;
			}
			else
			{
				RemoveObject(oldPlayer);
				Handle temp=BuildObject("ibnav",1,"tree_point");
				TranslateString2(tempstr, sizeof(tempstr), "Mission0701");  // Rescue
				SetObjectiveName(temp,tempstr);
				SetObjectiveOn(temp);
				CameraFinish();
				shabState++;
			}
			break;
		case 6: //order the player to get out of his vehicle once he gets close
			if ((!IsAround(shabayev)) && (!ship_blown_up))
			{
				Patrol(hunter,"hunter_path");
				SetIndependence(hunter,0);
				ship_blown_up=true;

			}

			if ((!IsAlive(shabOnFoot) && (!shab_dead)))	
			{
				AudioMessage("isdf0732.wav");
				ClearObjectives();
				AddObjective("isdf05l1.otf",RED,15.0f);
				FailMission(GetTime()+5.0f,"isdf05l1.otf");
				shab_dead=true;
			}

			if (GetTime()>reminderTimer) {
				AudioMessage("isdf0725.wav");
				reminderTimer=GetTime()+60.0f;
			}
			
			if ((GetDistance(shabOnFoot, player) < 50.0)) {

				//RemoveObject(shabayev);
				Attack(shabEnemy1,shabayev);
				Attack(shabEnemy2,shabayev);
				ClearObjectives();
				AudioMessage("isdf0729.wav");
				AddObjective("isdf0708.otf", WHITE);
				shabState++;
			}
			break;

		case 7: //send shab to get the relic
			if ((!IsAlive(shabOnFoot) && (!shab_dead)))	
			{
				AudioMessage("isdf0732.wav");
				ClearObjectives();
				AddObjective("isdf05l1.otf",RED,15.0f);
				FailMission(GetTime()+5.0f,"isdf05l1.otf");
				shab_dead=true;
			}
			if (playerOnFoot) {
				Attack(shabEnemy1,oldPlayer);
				Attack(shabEnemy2,oldPlayer);
				Goto(shabOnFoot, ruins, 1);
				//we should start the patrols here
				shabState++;
			}
			break;
		case 8: //get shab hurt
			if ((!IsAlive(shabOnFoot) && (!shab_dead)))	
			{
				AudioMessage("isdf0732.wav");
				ClearObjectives();
				AddObjective("isdf05l1.otf",RED,15.0f);
				FailMission(GetTime()+5.0f,"isdf05l1.otf");
				shab_dead=true;
			}

			if ((GetDistance(shabOnFoot, ruins) < 20.0f) || (GetDistance(player,ruins)<10.0f))
			{
				if (winMission == false) {
					AudioMessage("isdf0731.wav"); // wrong file name
					SucceedMission(GetTime()+5.0f,"isdf07w1.txt");
					winMission = true;
				}
			}
			break;
		case 9: //hide shab
			
			break;
		case 10: //play closing cineractive
		// The following is an example of how to play a movie in a script.
			moviePlaying = PlayMovie("temp");
			if (!moviePlaying) {
				missionState++;
				moviePlaying = true;
				//IFace_SetInteger("script.mission.state", 1);
			}
			break;
	}

	if (GetHealth(shabayev) < 0.7f) { //keep shab alive
		AddHealth(shabayev, 100);
	}

	if ((GetAmmo(shabayev)) < 0.5f) {
		AddAmmo(shabayev, 500);
	}
	if ((justHoped) && (!IsAlive(shabOnFoot)))
	{
		int i;
		i=1;
		// Houston we have a problem
	}

}
コード例 #15
0
ファイル: cdogsed.c プロジェクト: kodephys/cdogs-sdl
static HandleInputResult HandleInput(
	int c, int m, int *xc, int *yc, int *xcOld, int *ycOld, Mission *scrap)
{
	HandleInputResult result = { false, false, false, false };
	Mission *mission = CampaignGetCurrentMission(&gCampaign);
	UIObject *o = NULL;
	brush.Pos = GetMouseTile(&gEventHandlers);

	// Find whether the mouse has hovered over a tooltip
	bool hadTooltip = sTooltipObj != NULL;
	if (!UITryGetObject(sObjs, gEventHandlers.mouse.currentPos, &sTooltipObj) ||
		!sTooltipObj->Tooltip)
	{
		sTooltipObj = NULL;
	}
	// Need to redraw if we either had a tooltip (draw to remove) or there's a
	// tooltip to draw
	if (hadTooltip || sTooltipObj)
	{
		result.Redraw = true;
	}

	// Make sure a redraw is done immediately if the resolution changes
	// Otherwise the resolution change is ignored and we try to redraw
	// later, when the draw buffer has not yet been recreated
	if (gEventHandlers.HasResolutionChanged)
	{
		result.Redraw = true;
	}

	// Also need to redraw if the brush is active to update the highlight
	if (brush.IsActive)
	{
		result.Redraw = true;
	}

	if (m &&
		(m == SDL_BUTTON_LEFT || m == SDL_BUTTON_RIGHT ||
		m == SDL_BUTTON_WHEELUP || m == SDL_BUTTON_WHEELDOWN))
	{
		result.Redraw = true;
		if (UITryGetObject(sObjs, gEventHandlers.mouse.currentPos, &o))
		{
			if (!o->DoNotHighlight)
			{
				if (sLastHighlightedObj)
				{
					UIObjectUnhighlight(sLastHighlightedObj);
				}
				sLastHighlightedObj = o;
				UIObjectHighlight(o);
			}
			CArrayTerminate(&sDrawObjs);
			*xcOld = *xc;
			*ycOld = *yc;
			// Only change selection on left/right click
			if (m == SDL_BUTTON_LEFT || m == SDL_BUTTON_RIGHT)
			{
				if (!(o->Flags & UI_LEAVE_YC))
				{
					*yc = o->Id;
					AdjustYC(yc);
				}
				if (!(o->Flags & UI_LEAVE_XC))
				{
					*xc = o->Id2;
					AdjustXC(*yc, xc);
				}
			}
			if (!(o->Flags & UI_SELECT_ONLY) &&
				(!(o->Flags & UI_SELECT_ONLY_FIRST) || (*xc == *xcOld && *yc == *ycOld)))
			{
				if (m == SDL_BUTTON_LEFT || m == SDL_BUTTON_WHEELUP)
				{
					c = SDLK_PAGEUP;
				}
				else if (m == SDL_BUTTON_RIGHT || m == SDL_BUTTON_WHEELDOWN)
				{
					c = SDLK_PAGEDOWN;
				}
			}
		}
		else
		{
			if (!(brush.IsActive && mission))
			{
				UIObjectUnhighlight(sObjs);
				CArrayTerminate(&sDrawObjs);
				sLastHighlightedObj = NULL;
			}
		}
	}
	if (!o &&
		(MouseIsDown(&gEventHandlers.mouse, SDL_BUTTON_LEFT) ||
		MouseIsDown(&gEventHandlers.mouse, SDL_BUTTON_RIGHT)))
	{
		result.Redraw = true;
		if (brush.IsActive && mission->Type == MAPTYPE_STATIC)
		{
			// Draw a tile
			if (IsBrushPosValid(brush.Pos, mission))
			{
				int isMain =
					MouseIsDown(&gEventHandlers.mouse, SDL_BUTTON_LEFT);
				EditorResult r =
					EditorBrushStartPainting(&brush, mission, isMain);
				if (r == EDITOR_RESULT_CHANGED ||
					r == EDITOR_RESULT_CHANGED_AND_RELOAD)
				{
					fileChanged = 1;
					Autosave();
					result.RemakeBg = true;
					sHasUnbakedChanges = true;
				}
				if (r == EDITOR_RESULT_CHANGED_AND_RELOAD)
				{
					Setup(0);
				}
			}
		}
	}
	else
	{
		if (mission)
		{
			// Clamp brush position
			brush.Pos = Vec2iClamp(
				brush.Pos,
				Vec2iZero(), Vec2iMinus(mission->Size, Vec2iUnit()));
			EditorResult r = EditorBrushStopPainting(&brush, mission);
			if (r == EDITOR_RESULT_CHANGED ||
				r == EDITOR_RESULT_CHANGED_AND_RELOAD)
			{
				fileChanged = 1;
				Autosave();
				result.Redraw = true;
				result.RemakeBg = true;
				sHasUnbakedChanges = true;
			}
			if (r == EDITOR_RESULT_CHANGED_AND_RELOAD)
			{
				Setup(0);
			}
		}
	}
	// Pan the camera based on keyboard cursor keys
	if (mission)
	{
		if (KeyIsDown(&gEventHandlers.keyboard, SDLK_LEFT))
		{
			camera.x -= CAMERA_PAN_SPEED;
			result.Redraw = result.RemakeBg = true;
		}
		else if (KeyIsDown(&gEventHandlers.keyboard, SDLK_RIGHT))
		{
			camera.x += CAMERA_PAN_SPEED;
			result.Redraw = result.RemakeBg = true;
		}
		if (KeyIsDown(&gEventHandlers.keyboard, SDLK_UP))
		{
			camera.y -= CAMERA_PAN_SPEED;
			result.Redraw = result.RemakeBg = true;
		}
		else if (KeyIsDown(&gEventHandlers.keyboard, SDLK_DOWN))
		{
			camera.y += CAMERA_PAN_SPEED;
			result.Redraw = result.RemakeBg = true;
		}
		// Also pan the camera based on middle mouse drag
		if (MouseIsDown(&gEventHandlers.mouse, SDL_BUTTON_MIDDLE))
		{
			camera = Vec2iAdd(camera, Vec2iMinus(
				gEventHandlers.mouse.previousPos,
				gEventHandlers.mouse.currentPos));
			result.Redraw = result.RemakeBg = true;
		}
		camera.x = CLAMP(camera.x, 0, Vec2iCenterOfTile(mission->Size).x);
		camera.y = CLAMP(camera.y, 0, Vec2iCenterOfTile(mission->Size).y);
	}
	bool hasQuit = false;
	if (gEventHandlers.keyboard.modState & (KMOD_ALT | KMOD_CTRL))
	{
		result.Redraw = true;
		switch (c)
		{
		case 'z':
			// Undo
			// Do this by swapping the current mission with the last mission
			// This requires a bit of copy-acrobatics; because missions
			// are saved in Setup(), but by this stage the mission has already
			// changed, _two_ mission caches are used, copied in sequence.
			// That is, if the current mission is at state B, the first cache
			// is still at state B (copied after the mission has changed
			// already), and the second cache is at state A.
			// If we were to perform an undo and still maintain functionality,
			// we need to copy such that the states change from B,B,A to
			// A,A,B.

			// However! The above is true only if we have "baked" changes
			// The editor has been optimised to perform some changes
			// without reloading map files; that is, the files are actually
			// in states C,B,A.
			// In this case, another set of "acrobatics" is required
			if (sHasUnbakedChanges)
			{
				MissionCopy(&lastMission, mission);	// B,A,Z -> B,A,B
			}
			else
			{
				MissionCopy(mission, &lastMission);	// B,B,A -> A,B,A
				MissionCopy(&lastMission, &currentMission);	// A,B,A -> A,B,B
			}
			fileChanged = 1;
			Setup(0);	// A,B,B -> A,A,B
			break;

		case 'x':
			MissionTerminate(scrap);
			MissionCopy(scrap, mission);
			Delete(*xc, *yc);
			break;

		case 'c':
			MissionTerminate(scrap);
			MissionCopy(scrap, mission);
			break;

		case 'v':
			// Use map size as a proxy to whether there's a valid scrap mission
			if (!Vec2iEqual(scrap->Size, Vec2iZero()))
			{
				InsertMission(&gCampaign, scrap, gCampaign.MissionIndex);
				fileChanged = 1;
				Setup(0);
			}
			break;

		case 'q':
			hasQuit = true;
			break;

		case 'n':
			InsertMission(&gCampaign, NULL, gCampaign.Setting.Missions.size);
			gCampaign.MissionIndex = gCampaign.Setting.Missions.size - 1;
			fileChanged = 1;
			Setup(0);
			break;
				
		case 'o':
			if (!fileChanged || ConfirmScreen(
				"File has been modified, but not saved", "Open anyway? (Y/N)"))
			{
				Open();
			}
			break;

		case 's':
			Save();
			break;

		case 'm':
			result.WillDisplayAutomap = true;
			break;

		case 'e':
			EditCharacters(&gCampaign.Setting);
			Setup(0);
			UIObjectUnhighlight(sObjs);
			CArrayTerminate(&sDrawObjs);
			break;
		}
	}
	else
	{
		if (c != 0)
		{
			result.Redraw = true;
		}
		switch (c)
		{
		case SDLK_F1:
			HelpScreen();
			break;

		case SDLK_HOME:
			if (gCampaign.MissionIndex > 0)
			{
				gCampaign.MissionIndex--;
			}
			Setup(0);
			break;

		case SDLK_END:
			if (gCampaign.MissionIndex < (int)gCampaign.Setting.Missions.size)
			{
				gCampaign.MissionIndex++;
			}
			Setup(0);
			break;

		case SDLK_INSERT:
			switch (*yc)
			{
			case YC_CHARACTERS:
				if (gCampaign.Setting.characters.OtherChars.size > 0)
				{
					int ch = 0;
					CArrayPushBack(&mission->Enemies, &ch);
					CharacterStoreAddBaddie(&gCampaign.Setting.characters, ch);
					*xc = mission->Enemies.size - 1;
				}
				break;

			case YC_SPECIALS:
				if (gCampaign.Setting.characters.OtherChars.size > 0)
				{
					int ch = 0;
					CArrayPushBack(&mission->SpecialChars, &ch);
					CharacterStoreAddSpecial(&gCampaign.Setting.characters, ch);
					*xc = mission->SpecialChars.size - 1;
				}
				break;

			case YC_ITEMS:
				{
					int item = 0;
					CArrayPushBack(&mission->Items, &item);
					CArrayPushBack(&mission->ItemDensities, &item);
					*xc = mission->Items.size - 1;
				}
				break;

			default:
				if (*yc >= YC_OBJECTIVES)
				{
					AddObjective(mission);
				}
				else
				{
					InsertMission(&gCampaign, NULL, gCampaign.MissionIndex);
				}
				break;
			}
			fileChanged = 1;
			Setup(0);
			break;

		case SDLK_DELETE:
			Delete(*xc, *yc);
			break;

		case SDLK_PAGEUP:
			if (Change(o, *yc, 1))
			{
				fileChanged = 1;
			}
			Setup(0);
			break;

		case SDLK_PAGEDOWN:
			if (Change(o, *yc, -1))
			{
				fileChanged = 1;
			}
			Setup(0);
			break;

		case SDLK_ESCAPE:
			hasQuit = true;
			break;

		case SDLK_BACKSPACE:
			fileChanged |= UIObjectDelChar(sObjs);
			break;

		default:
			c = KeyGetTyped(&gEventHandlers.keyboard);
			if (c)
			{
				fileChanged |= UIObjectAddChar(sObjs, (char)c);
			}
			break;
		}
	}
	if (gEventHandlers.HasQuit)
	{
		hasQuit = true;
	}
	if (hasQuit && (!fileChanged || ConfirmScreen(
		"File has been modified, but not saved", "Quit anyway? (Y/N)")))
	{
		result.Done = true;
	}
	return result;
}
コード例 #16
0
ファイル: isdf06.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf06Mission::Execute(void)
{

    /*
    	Stuff in 6
    	You are responsible for
    	the northern aproach to the base
    	Alien units approach from the south
    	and you battle them.

    	Shabayev discovers a scrap pool.
    	She highlights it.
    	You must go to it and destroy a
    	scion scavenger.

    	You are given control of
    	constructor.  Your job is to build
    	a bunker and a gun tower around it
    	to protect it.

    	Once the bunker is built
    	you are told to go on the
    	offensive.


    	At the first place
    	you go you find the
    	voyager probe.

    	The second is the
    	climatic battle.
    */

    player = GetPlayerHandle();

    if (!start_done)
    {
        start_done=true;
        /*
        	This is one of our three
        	key bases on the Planet
        	You must defend this approach.
        */
        ClearObjectives();
        AddObjective("isdf0601.otf",WHITE,20.0f);
        AudioMessage("isdf0601.wav");
        // Manson:
        // Prepare for enemy attacks
        // You are a reserve for a counter attack
        // or in case they break through.
        attack_wave_time=GetTime()+10.0f;
        wave_launched=false;
        SetScrap(1,20);
        SetIndependence(escav,0);
        escav=BuildObject("fvscav",2,"pool");
        Goto(escav,scrap_pool,0);
        Handle temp=GetHandle("gtow1");
        AddHealth(temp,-2500);
        temp=GetHandle("gtow2");
        AddHealth(temp,-2500);
        GiveWeapon(player, "gshadow_c");
        /*
        turret1=BuildObject("ivturr",3,"turret1");
        turret2=BuildObject("ivturr",3,"turret2");
        Deploy(turret1);
        Deploy(turret2);
        */
    }

    if ((!IsAlive(constructor)) && (mission_state>1) && (mission_state!=99))
    {
        // you loose
        AudioMessage("isdf0607.wav");
        // Manson:
        // That constructor was vital
        // to our effort.  I'm pulling
        // back immeadiately.
        FailMission(GetTime()+15.0f,"isdf06l2.txt");
        mission_state=99;  // out of the loop
    }

    switch (mission_state)
    {
    case 0: // attack starts
        if ((!warning) &&
                (GetDistance(atk1,turret1)<250.0f))
        {
            AudioMessage("isdf0602.wav");
            warning=true;
        }
        if ((!wave_launched) && (GetTime()>attack_wave_time))
        {
            atk1=BuildObject("fvtank",2,"attack_start1");
            Goto(atk1,"attack_path1");
            SetSkill(atk1,3);
            atk2=BuildObject("fvtank",2,"attack_start1");
            Goto(atk2,"attack_path1");
            SetSkill(atk2,3);
            atk3=BuildObject("fvsent",2,"attack_start1");
            Goto(atk3,"attack_path1");
            SetSkill(atk3,3);
            atk4=BuildObject("fvsent",2,"attack_start1");
            Goto(atk4,"attack_path1");
            SetSkill(atk4,3);
            atk5=BuildObject("fvtank",2,"attack_start2");
            Goto(atk5,"attack_path2");
            SetSkill(atk5,3);
            atk6=BuildObject("fvtank",2,"attack_start2");
            Goto(atk6,"attack_path2");
            SetSkill(atk6,3);
            atk7=BuildObject("fvsent",2,"attack_start2");
            Goto(atk7,"attack_path2");
            SetSkill(atk7,3);
            //		atk8=BuildObject("fvsent",2,"attack_start2");
            //		Goto(atk8,"attack_path2");
            //		SetSkill(atk8,3);
            wave_launched=true;
        }
        if ((wave_launched) && (!IsAlive(atk1))
                && (!IsAlive(atk2))
                && (!IsAlive(atk3))
                && (!IsAlive(atk4))
                && (!IsAlive(atk5))
                && (!IsAlive(atk6))
                && (!IsAlive(atk7))
                && (!IsAlive(atk8)))
        {
            warning=false;
            wave_launched=false;
            wave_count++;
            if (!repair_hint)
            {
                repair_hint=true;
                AudioMessage("isdf0612.wav");
                /*
                	MANSON
                	Take advantage of the
                	breaks between attacks
                	to repair your forces at the service
                	bay.
                */
            }
            if (wave_count==2)
            {
                back1=BuildObject("fvarch",2,"back1");
                Goto(back1,"back_door");
                back2=BuildObject("fvarch",2,"back2");
                Goto(back2,"back_door");
                back3=BuildObject("fvsent",2,"back3");
                Goto(back3,"back_door");
                SetObjectiveOn(back1);
                AudioMessage("isdf0614.wav");
            }
            if (wave_count>(2)) //was 2
            {
                if ((!IsAlive(back1))
                        && (!IsAlive(back2))
                        && (!IsAlive(back3)))
                {

                    mission_state++;
                    SetObjectiveOn(escav);
                    ClearObjectives();
                    AddObjective("isdf0602.otf",WHITE,10.0f);
                    AudioMessage("isdf0603.wav");
                    // Shabayev
                    // I have detected the scavenger
                    // which is supplying the enemy.
                    // Its time to counter attack.
                    // Manson
                    // Alright, Cooke, you heard
                    // the lieutenant.  Get that
                    // scavenger
                    AudioMessage("isdf0604.wav");
                }
            }
            else attack_wave_time=GetTime()+5.0f;
            // hold back your forces
            if ((GetDistance(turret1,mbike1)<50.0f) && (!defend_warning))
            {
                AudioMessage("isdf0610.wav");
                // MansoN:
                // Cooke, hold back your forces.
                defend_warning=true;

            }
        }
        break;
    case 1: // shabayev highlights the scavenger
        /*
        */
        if (scav_count<3)
        {
            FailMission(GetTime()+5.0f,"isdf06l1.txt");
            mission_state=99;
        }
        else
        {

            if ((GetDistance(player,escav)<150.0f)
                    && (!got_to_scav))
            {
                AudioMessage("isdf0605.wav");
                // Shabayev: Attack!
                got_to_scav=true;

            }
            if (!IsAlive(escav))
            {
                ClearObjectives();
                AddObjective("isdf0603.otf",WHITE,10.0f);

                constructor=BuildObject("ivcon6",1,"constructor_spawn");
                int grp=GetFirstEmptyGroup();
                SetGroup(constructor,grp);
                Goto(constructor,"pool",0);

                mission_state++;
                AudioMessage("isdf0606.wav");
                // Manson:
                // Cooke, I'm sending you a
                // constructor to fortify your
                // position.  Use the constructor
                // to build defenses around that
                // scrap pool.
            }
        }
        break;
    case 2:	 // you get a constructor
        if (GetDistance(constructor,"pool")<250.0f)
        {
            AudioMessage("isdf0611.wav");
            // Shabayev
            // Build a communications bunker to
            // anchor the base.
            // Once you have a communications bunker
            // build two adjacent
            // gun towers
            // The gun towers will be powered from
            // the surplus power of the main base.
            // Good luck.

            ConstructionMessage();
            // spawn in attackers
            scout1=BuildObject("fvscout",2,"patrol_spawn");
            scout2=BuildObject("fvscout",2,"patrol_spawn");
            if (IsAlive(mbike1))
            {
                Attack(scout1,player);
            }
            else
            {
                Attack(scout1,player);
            }
            if (IsAlive(mbike2))
            {
                Attack(scout2,player);
            }
            else Attack(scout2,mbike2);
            mission_state++;
        }

        break;
    case 3:
        if ((!IsAlive(scout1)) && (!IsAlive(scout2)))
        {
            scout1=BuildObject("fvscout",2,"patrol_spawn");
            scout2=BuildObject("fvscout",2,"patrol_spawn");
            if (IsAlive(mbike1))
            {
                Attack(scout1,mbike1);
            }
            else Attack(scout1,player);
            if (IsAlive(mbike2))
            {
                Attack(scout2,mbike2);
            }
            else	Attack(scout2,player);
        }
        if ((cbunker!=NULL) && (guntow1!=NULL)
                && (guntow2!=NULL))
        {
            AudioMessage("isdf0608.wav");
            /*
            	Manson:
            	Great!
            	I'm sending a scavenger to secure
            	that pool.
            	Prepare for further orders.

            */
            // more cannon foder to get pulverized
            atk1=BuildObject("fvtank",2,"patrol_spawn1");
            Attack(atk1,guntow1);  // cannon foder
            atk2=BuildObject("fvtank",2,"patrol_spawn2");
            Attack(atk2,guntow2);  // cannon foder

            // FraKTal says this scav doesn't want to deploy on its
            // own. So, put it under 100% human control - NM 6/27/03
#if 0
            // was
            scav=BuildObject("ivscav",3,"constructor_spawn");
#else
            // now
            scav=BuildObject("ivscav",1,"constructor_spawn");
#endif

            Goto(scav,"pool");
            ClearObjectives();
            AddObjective("isdf0607.otf",WHITE,10.0f);
            mission_state++;
        }
        break;
    case 4:  // when the scavenger gets there-- attack!!
        if (GetDistance(scav,"pool")<100.0f)
        {
            AudioMessage("isdf0609.wav");
            AudioMessage("isdf0613.wav");
            // Shabayev:
            // Its time we finish them off.
            // All forces, converge on the enemy base!
            SetObjectiveOn(goal);
            mission_state++;
            // spawn in patrols
            atk1=BuildObject("fvtank",2,"patrol_spawn2");
            atk2=BuildObject("fvtank",2,"patrol_spawn2");
            atk3=BuildObject("fvsent",2,"patrol_spawn");
            atk4=BuildObject("fvsent",2,"patrol_spawn");
            Patrol(atk1,"patrol");
            Patrol(atk2,"patrol");
            Patrol(atk3,"patrol");
            Patrol(atk4,"patrol");
            // spawn in attackers
            atk1=BuildObject("ivtank",3,"constructor_spawn");
            atk2=BuildObject("ivtank",3,"constructor_spawn");
            Goto(atk1,goal);
            Goto(atk2,goal);
            BuildObject("ibbomb",1,"bomber");  // you get a bomber
//					BuildObject("ivbomb",1,"bomber");
            ClearObjectives();
            AddObjective("isdf0608.otf",WHITE,10.0f);
        }
        break;
    case 5:  // test to destroy base
        time_counter++;
        if (time_counter%1200==0) // every minute 1/2
        {
            atk1=BuildObject("fvtank",2,"patrol_spawn2");
            atk2=BuildObject("fvtank",2,"patrol_spawn2");
            Patrol(atk1,"patrol");
            Patrol(atk2,"patrol");
        }
        if (!IsAlive(goal))
        {
            // you win
            SucceedMission(GetTime()+20.0f,"isdf06w1.txt");
            mission_state++;
            ClearObjectives();
            AddObjective("isdf0609.otf",WHITE,10.0f);
        }
        break;
    case 6:
        // cineractive
        // Through the worm hole
        break;

    } // switch
}
コード例 #17
0
void SceneMenu::Check()
{
   EScene::Check();
#ifndef DEBUG
   if (KInput::isPressed(K_VK_M)) {
      _nCheatCode = 1;
   }
   
   if (KInput::isPressed(K_VK_I) && _nCheatCode == 1) {
      _nCheatCode++;
   }

   if (KInput::isPressed(K_VK_L) && (_nCheatCode == 2 || _nCheatCode == 3)) {
      _nCheatCode++;
   }

   if (KInput::isPressed(K_VK_I) && _nCheatCode == 4) {
      _nCheatCode++;
   }

   if (KInput::isPressed(K_VK_O) && _nCheatCode == 5) {
      _nCheatCode++;
   }

   if (KInput::isPressed(K_VK_N) && _nCheatCode == 6) {
      _nCheatCode++;
   }
#else
   _nCheatCode = 7;
#endif
   if (_nCheatCode >= 7) {
      if (KInput::isPressed(K_VK_L_SHIFT))
      {
         if (KInput::isPressed(K_VK_1)) {
            _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "island", false);
            return;
         }
      }
      if (KInput::isPressed(K_VK_L_SHIFT))
      {
         if (KInput::isPressed(K_VK_2)) {
            _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "japan", false);
            return;
         }
      }
      if (KInput::isPressed(K_VK_L_SHIFT))
      {
         if (KInput::isPressed(K_VK_3)) {
            _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "inca", false);
            return;
         }
      }
      if (KInput::isPressed(K_VK_L_SHIFT))
      {
         if (KInput::isPressed(K_VK_4)) {
            _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "middleage", false);
            return;
         }
      }
      if (KInput::isPressed(K_VK_L_SHIFT))
      {
         if (KInput::isPressed(K_VK_5)) {
            _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "egypt", false);
            return;
         }
      }
      
      if (KInput::isPressed(K_VK_0))
      {
         _lpSceneDirector->SetHexagramme(false);
         EInventoryItem::CleanUp(NULL);
         EGlobalBank::CleanUp();
         _lpSceneDirector->getDiaryPtr()->Clean();
         _lpSceneDirector->getMap()->Clean();
         _lpSceneDirector->OpenDialogbox("Clean up done");
      }
      if (KInput::isPressed(K_VK_1))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "island", false);
      }
      if (KInput::isPressed(K_VK_2))
      {
         AddObjective("house","helpnatsumi");
         AddHint("house","helpnatsumi","where");
         if (!_lpSceneDirector->getInventory()->getItemFromInventory("inv_basementkey")) {
            _lpSceneDirector->getInventory()->AddItem("house","inv_basementkey");
         }
         _lpSceneDirector->GoToScene("corridor");
      }
      if (KInput::isPressed(K_VK_3))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "japan", false);
      }
      if (KInput::isPressed(K_VK_4))
      {
         ResolveTask("task_gethexagramme");
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "firstfloor", "house", false);      
      }
      if (KInput::isPressed(K_VK_5))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "middleage", false);
      }
      if (KInput::isPressed(K_VK_6))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "inca", false);
      }
      if (KInput::isPressed(K_VK_7))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "vignette_hands", "egypt", false);
      }
      if (KInput::isPressed(K_VK_8))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "hell_mainscreen", "", false);
      }
      if (KInput::isPressed(K_VK_9))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "house_attic", "", false);
      }
      if (KInput::isPressed(K_VK_RIGHT))
      {
         ResolveTask("task_gethexagramme");
         ResolveObjective("house","helpnatsumi");
         ResolveTask("task_living_discover");
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "house_diningroom", "", false);
      }
      if (KInput::isPressed(K_VK_LEFT))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "debug_david", "", false);
      }
      if (KInput::isPressed(K_VK_UP))
      {
         _lpSceneDirector->getSequencer()->GoToScene(NULL, "debug_preload", "", false);
      }
   }   
}
コード例 #18
0
ファイル: isdf08.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf08Mission::Execute(void)
{
/*
	Here is where you put what happens every frame.  
*/

	player = GetPlayerHandle();
	char tempstr[128];

	if (!start_done)
	{
		shab=GetHandle("shabayev");
		start_done=true;
		Handle temp=BuildObject("ibnav",1,"manson_base");
		TranslateString2(tempstr, sizeof(tempstr), "Mission0801");  // West Base
		SetObjectiveName(temp,tempstr);
		GiveWeapon(player, "igsatc");
		first_aud=AudioMessage("mes0801.wav");  // was isdf0801
// I don't know what these are or where they go
/*
	Handle sp=BuildObject("fvtank",2,"spawn1");
		SetSkill(sp,3);
		sp=BuildObject("fvsent",2,"spawn2");
		SetSkill(sp,3);
		sp=BuildObject("fvtank",2,"spawn3");
		SetSkill(sp,3);
		sp=BuildObject("fvsent",2,"spawn4");
		SetSkill(sp,4);
		SetScrap(1,30);
*/	
// These ships circle the ruin you're in at the beginning, then leave
		pilot1=BuildObject("fvtank",2,"pilot_1");
		pilot2=BuildObject("fvtank",2,"pilot_2");
		pilot3=BuildObject("fvsent",2,"pilot_3");

// They are dumb
		SetIndependence(pilot1,0);
    SetIndependence(pilot2,0);
    SetIndependence(pilot3,0);

// These are the patrol paths for the vehicles
    Goto(pilot1,"start1");
    Goto(pilot2,"start2");
    Goto(pilot3,"start3");

// These turrets block the path to the south
    turret1=BuildObject("fvturr",2,"turret_1");
		turret2=BuildObject("fvturr",2,"turret_2");

// These jaks inhabit the swamp just west of the starting point
		jak1=BuildObject("mcjak01",0,"jak_1");
		Patrol(jak1,"jakpatrol1",1);
		SetIndependence(jak1,1);
    jak2=BuildObject("mcjak01",0,"jak_2");
		Patrol(jak2,"jakpatrol2",1);
		SetIndependence(jak2,1);
    jak3=BuildObject("mcjak01",0,"jak_3");
		Patrol(jak3,"jakpatrol3",1);
		SetIndependence(jak3,1);

// This spire guards the entrance to the Scion base
    espir1=BuildObject("fbspir",2,"espir_1");
 //   SetIndependence(espir1,0);

// These 3 ships patrol different areas
    scout1=BuildObject("fvtank",2,"patrol_1");
		Patrol(scout1,"patrol_1",0);
		scout2=BuildObject("fvtank",2,"patrol_2");
		Patrol(scout2,"patrol_2",0);

		// this should be a bazooka or something
		BuildObject("aptech",0,"weapon_1");

// pilots around second patrol ship
#if 0
		// 'sssold' won't save/reload properly - NM 9/28/04
		pilot7=BuildObject("sssold",2,"pilot_5");
    Patrol(pilot7,"pilotpatrol1",0);
		pilot8=BuildObject("sssold",2,"pilot_6");
    Patrol(pilot8,"pilotpatrol2",0);
#endif

		// jak blocking power ups before ruins
		jak7=BuildObject("mcjak01",0,"jak_7");
    Patrol(jak7,"jakpatrol7",1);

		// power up in the second nest of puff plants
		BuildObject("aprepa",0,"health_1");
		BuildObject("apammo",0,"ammo_1");
		BuildObject("apbazo",0,"weapon1");

// jak creatures hanging around ruins
		jak4=BuildObject("mcjak01",0,"jak_4");
    Patrol(jak4,"jakpatrol4",1);
		jak5=BuildObject("mcjak01",0,"jak_5");
    Patrol(jak5,"jakpatrol5",1);

		// power ups near ruins
		BuildObject("aprepa",0,"health_2");
		BuildObject("apammo",0,"ammo_2");
		SetAnimation(shab,"speak");
		fvartl=BuildObject("fvartl",2,"fvartl");
	}

	if ((IsAudioMessageDone(first_aud)) && (!shab_still))
	{
		shab_still=true;
		SetAnimation(shab,"speak",1);
	}
	if ((!IsAround(shab)) && (!reached_base))
	{
		FailMission(GetTime()+5.0f,"genFail.txt");
		reached_base=true;

	}
// Gun tower shoots at you if you get within 100 meters
  if (inside_espir1)
  {
    if (GetDistance(espir1,player) > 50.0f)
    {
      inside_espir1=false;
      Stop(espir1);
    }
  }
  else
  {
    if (GetDistance(espir1,player) < 50.0f)
    {
      inside_espir1 = true;
      Attack(espir1,player);
    }
  }

  if ((!jak1_attack) && (GetDistance(jak1,player)<50.0f))
  {
	  jak1_attack=true;
	  Stop(jak1,player);
  }
  if ((!jak2_attack) && (GetDistance(jak2,player)<50.0f))
  {
		jak2_attack=true;
		Stop(jak2,player);
  }
  if ((!jak3_attack) && (GetDistance(jak3,player)<50.0f))
  {
	  jak3_attack=true;
	  Stop(jak3,player);
  }
  if ((!jak4_attack) && (GetDistance(jak4,player)<50.0f))
  {
	  jak4_attack=true;
	  Stop(jak4,player);
  }
   if ((!jak5_attack) && (GetDistance(jak5,player)<50.0f))
  {
	  jak5_attack=true;
	  Stop(jak5,player);
  }
// If you shoot any of the patrol ships in the beginning, they will attack you
  if (((GetWhoShotMe(pilot1)  ==  player) ||
      (GetWhoShotMe(pilot2)  ==  player)  ||
      (GetWhoShotMe(pilot3)  ==  player))  &&
      (!patrol_attacked))
  {
    Attack(pilot1,player);
    Attack(pilot2,player);
    Attack(pilot3,player);
    patrol_attacked=true;
  }

// Once the patrol from the beginning leaves the ruins, they disappear from the map
  if ((GetDistance(pilot1,"killpatrol1")<64.0f))
  {
    RemoveObject(pilot1);
  }

  if ((GetDistance(pilot2,"killpatrol1")<64.0f))
  {
    RemoveObject(pilot2);
  }

  if ((GetDistance(pilot3,"killpatrol1")<64.0f))
  {
    RemoveObject(pilot3);
  }

  if (((GetDistance(pilot1,"turret_1")<192.0f)  ||
       (GetDistance(pilot2,"turret_1")<192.0f)  ||
       (GetDistance(pilot3,"turret_1")<192.0f))  &&
       (!played_0802))
  {
//		message1=AudioMessage("isdf0802.wav");
		ClearObjectives();
		AddObjective("isdf0801.otf",WHITE,15.0f);
		played_0802=true;
  }

  if ((played_0802)  &&  (IsAudioMessageDone(message1))  &&
      (GetDistance(player,"start_point")<20.0f)  &&  (!played_0803))
  {
//    AudioMessage("isdf0803.wav");
    played_0803=true;
  }

  if ((!played_0804)  &&  (played_0802)  &&  (GetDistance(player,"play_0804")<80.0f))
  {
    AudioMessage("isdf0804.wav");
    played_0804=true;
  }

  if ((!played_0805)  &&  (played_0802)  &&  (GetDistance(player,"play_0805")<80.0f))
  {
    AudioMessage("isdf0805.wav");
    played_0805=true;
  }

  if ((GetDistance(player,turret1)<150.0f)    &&
      (!played_0806))
  {
    AudioMessage("isdf0806.wav");
    played_0806=true;
  }

  if ((!played_0807)  &&  (GetDistance(player,"sees_datatransfer")<100.0f))
  {
    AudioMessage("isdf0807.wav");
    played_0807=true;
    ClearObjectives();
    AddObjective("isdf0801.otf",WHITE,10.0f);
  }


// As you exit the ruins, 3 Scion ships spawn in the Scion base and head towards you
	if (((GetDistance(player,"exitruin_1")<80.0f)  ||
      (GetDistance(player,"exitruin_2")<80.0f))  &&
      (!trigger1))
  {
    attack1=BuildObject("fvtank",2,"attack_1");
    attack2=BuildObject("fvsent",2,"attack_2");
    attack3=BuildObject("fvtank",2,"attack_3");
    Attack(attack1,player);
    Attack(attack2,player);
    Attack(attack3,player);
    trigger1=true;
  }

  if ((trigger1)  &&  (!played_0808))
  {
    AudioMessage("isdf0808.wav");
    played_0808=true;
  }

  if (((GetDistance(player,attack1)<300.0f)  ||
      (GetDistance(player,attack2)<300.0f)  ||
      (GetDistance(player,attack3)<300.0f))  &&
      (!played_0809))
  {
    AudioMessage("isdf0809.wav");
    played_0809=true;
  }

#if 0
	// isdf0811.wav doesn't exist - NM 11/14/03
  if (((GetDistance(player,attack1)<100.0f)  ||
      (GetDistance(player,attack2)<100.0f)  ||
      (GetDistance(player,attack3)<100.0f))  &&
      (!played_0811))
  {
    AudioMessage("isdf0811.wav");
    played_0811=true;
  }
#endif

// If you head south, the turrets will kill you
  // if I am between entering the swamp and
  // I hide in water (near swampn) then the patrols ignore me
  if ((played_0804) &&
	  (!trigger2))
  {	
	  if ((GetDistance(player,"swamp1")<50.0f) ||
			(GetDistance(player,"swamp2")<50.0f) ||
			(GetDistance(player,"swamp3")<50.0f) ||
			(GetDistance(player,"swamp4")<50.0f) ||
			(GetDistance(player,"swamp5")<50.0f) ||
			(GetDistance(player,"swamp6")<50.0f) ||
			(GetDistance(player,"swamp7")<50.0f))
	  {
		  SetPerceivedTeam(player,2);
		  SetIndependence(scout1,0);
		  SetIndependence(scout2,0);
	  }
		else
	  {
		  SetPerceivedTeam(player,1);
		  SetIndependence(scout1,1);
		  SetIndependence(scout2,1);
		}
		if ((!detected) && 
			((GetWhoShotMe(scout1)==player) 
				||(GetWhoShotMe(scout2)==player)))
		{
			Attack(scout1,player);
			Attack(scout2,player);
			detected=true;
		}
	
  }
 // As you approach the ISDF base, 3 friendly units launch to protect you from the Scion attackers
  if (((GetDistance(player,"enterbase_1")<100.0f)  ||
      (GetDistance(player,"enterbase_2")<100.0f)  ||
      (GetDistance(player,"enterbase_3")<100.0f))  &&
      (!trigger2))
  {
    rescue1=BuildObject("ivtank",1,"rescue_1");
    rescue2=BuildObject("ivmbike",1,"rescue_2");
    rescue3=BuildObject("ivtank",1,"rescue_3");
    Attack(rescue1,attack1);
    Attack(rescue2,attack1);
    Attack(rescue3,attack1);
    trigger2=true;
  }

  if ((!IsAlive(attack1))  &&
      (!killed_attack1))
  {
    Attack(rescue1,attack2);
    Attack(rescue2,attack2);
    Attack(rescue3,attack2);
    killed_attack1=true;
  }

  if ((!IsAlive(attack2))  &&
      (!killed_attack2))
  {
    Attack(rescue1,attack3);
    Attack(rescue2,attack3);
    Attack(rescue3,attack3);
    killed_attack2=true;
  }



  if ((GetDistance(player,"edge_warning1")<25.0f)
	  && (GetDistance(player,"edge_warning1")<25.0f)
	  && (!edge_attack))
  {
		edge_attack=true;
		Attack(fvartl,player);
  }
// If the ISDF ships get close to the Scion attack squadron, the Scions will stop chasing you and fight the ships
  if ((GetDistance(rescue1,attack1)<50.0f)  ||
      (GetDistance(rescue1,attack2)<50.0f)  ||
      (GetDistance(rescue1,attack3)<50.0f)  ||
      (GetDistance(rescue2,attack1)<50.0f)  ||
      (GetDistance(rescue2,attack2)<50.0f)  ||
      (GetDistance(rescue2,attack3)<50.0f)  ||
      (GetDistance(rescue3,attack1)<50.0f)  ||
      (GetDistance(rescue3,attack2)<50.0f)  ||
      (GetDistance(rescue3,attack3)<50.0f))
  {
    Attack(attack1,rescue1);
    Attack(attack2,rescue2);
    Attack(attack3,rescue3);
  }

// If you've killed all the attack vehicles and entered the base, the mission is a success
  if 
	  (((GetDistance(player,"endmission1")<100.0f)  ||
      (GetDistance(player,"endmission2")<100.0f))  &&
      (!IsAlive(attack1))  &&
      (!IsAlive(attack2))  &&
      (!IsAlive(attack3))  &&
      (!reached_base))
	
  {
		AudioMessage("isdf0514.wav");
		SucceedMission(GetTime()+10.0f,"isdf08w1.txt");
		reached_base=true;
  }
}
コード例 #19
0
void SceneBasement::Init()
{
   StartAnimation("basement_ghostup_anim");
   SetVisible("basement_ghostup", false, true);
   SetupItem("envelope_basement");
   
   // 1ère visite
   if (!TaskResolved("task_house_basementvisit")) {
      ResolveTask("task_house_basementvisit");
      AddObjective("house","basementlight");
      AddHint("house","basementlight","how");
      RemoveHint("house","helpnatsumi","where");
      AddHint("house","helpnatsumi","what");
      AddHint("house","helpnatsumi","nextpaper");
   }
   
   // Lumière éteinte
   if (!TaskResolved("task_house_basement_light")) {
      AddTask("task_house_basement_light");
      SetVisible("darkness", true);
      // Ampoule non réparée
      if (TaskResolved("task_house_basement_changebulb")) {
         SetVisible("bulboff", true);
      }
      else {
         // Bulbe cassé retiré ?
         if (TaskResolved("task_house_basement_removebulb")) {
            SetVisible("bulbbroken", false);
            SetVisible("nobulb", true);
         }else {
            SetVisible("bulbbroken", true);
         }
      }
   }
   else {
      SetVisible("darkness", false);
      SetVisible("lightning", true);
      SetVisible("bulboff", false, true);
      SetVisible("bulbon", true, true);
   }
   
   if (TaskResolved("task_japan_universeresolved")) {
      SetVisible("basement_ghosthidden", false, true);
      SetupItem("basement_rope");
      if (isVisible("basement_rope")) {
         StartEmitter("flake_rope");
      }
   }         

   // La clé
   SetVisible("basement_screwdriver", TestGlobal("basement_screwdriver") == false);
   // La pince
   SetVisible("basement_grip", TestGlobal("basement_grip") == false);
   // Le bonzaï
   if (TaskResolved("task_house_basement_bonzai")) {
      SetVisible("basement_bonzairesolved", true, true);
   } else {
      SetVisible("basement_bonzai", true, true);
   }
   
   // La grille
   if (TaskResolved("task_house_basement_opengrid")) {
      SetVisible("basement_gridopen", true);
   } else {
      SetVisible("basement_gridclosed", true);
   }
   
   // Le charbon
   if (!TaskResolved("task_house_basement_reversecoal")) {
      SetVisible("basement_coalbucketup", true, true);
   } else {
      SetVisible("basement_coalbucketdown", true, true);
   }
   
   // Le vase
   if (!TaskResolved("task_house_basement_brokevase")) {
      SetVisible("basement_vase", true, true);
   } else {
      SetVisible("basement_vasebroken", true, true);
      // Le papier
      SetVisible("basement_paper", TestGlobal("basement_paper") == false);
   }
   
   // La boite à outils
   if (!TaskResolved("task_house_basement_opentoolbox")) {
      SetVisible("basement_toolboxclosed", true, true);
   } else {
      SetVisible("basement_toolboxopen", true, true);
      // Le marteau
      SetVisible("basement_hammer", TestGlobal("basement_hammer") == false);
   }
   
   // Le fantôme
   if (!TaskResolved("task_house_basement_light")) {
      int x,y;
      GetObjectPosition("basement_ghostup", x, y);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_up", true);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostcreep");
      _lpSceneDirector->getSequencer()->Wait(NULL, 2500);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostappear");
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghostup",true);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HOUSE_BASEMENT_NATSUMI_LETME"), "", false, false, _lpGhostVoice);
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghostup",false);
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghosthidden",true);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_up", false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_hidden", true);
   } else {
      if (!TaskResolved("task_japan_universeresolved")) {
         _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_hidden", true);
         _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghosthidden",true);
      }
   }
   
   // Le croquis
   if (TaskResolved("task_house_basement_givepaper") && TaskResolved("task_house_basement_givecharcoal")) {
      SetVisible("basement_sketch", TestGlobal("basement_sketch") == false);
   }
   
   // On revient de l'univers
   if (getAdditionalName() == "backfrombeyond") {
      int x,y;
      x = 1024/2;
      y = 768/2;
      SetVisible("black", true, true);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_up", true);
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, true);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("JAPAN_NATSUMI_HOUSEEPILOG1"), "", false, false, _lpGhostVoice);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("JAPAN_NATSUMI_HOUSEEPILOG2"), "", false, false, _lpGhostVoice);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("JAPAN_NATSUMI_HOUSEEPILOG3"), "", false, false, _lpGhostVoice);
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostgone");
      _lpSceneDirector->getSequencer()->GotoVideo(NULL, "videos/reveil.ogv","frombeyond");
      SetupItem("basement_rope");
      StartEmitter("flake_rope");
      _lpSceneDirector->getSequencer()->ShowImage(NULL, "black", false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_up", false);
      _lpSceneDirector->getSequencer()->Wait(NULL, 2000);
      _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, false);
      ResolveTask("task_freeghost_done_japan");
      AddObjective("house","freemurray");
      AddHint("house","freemurray","where");
      _lpSceneDirector->getDiaryPtr()->beginCreatePage();
      _lpSceneDirector->getDiaryPtr()->addImageToPage("diary_basement2.png");
      _lpSceneDirector->getDiaryPtr()->addStringToPage("DIARY_BASEMENT2", FONT_DIARY_1, 0, 0);
      _lpSceneDirector->getDiaryPtr()->endCreatePage();
      return;
   }
   
   // Allumage
   if (getAdditionalName() == "light") {
      // On provoque l'apparition de Natsumi
      ObjectClicked("basement_ghosthidden", 0, 0);
      _lpSceneDirector->getDiaryPtr()->beginCreatePage();
      _lpSceneDirector->getDiaryPtr()->addImageToPage("diary_basement1.png");
      _lpSceneDirector->getDiaryPtr()->addStringToPage("DIARY_BASEMENT1", FONT_DIARY_1, 0, 0);
      _lpSceneDirector->getDiaryPtr()->endCreatePage();
   }
   
   if (getAdditionalName() == "completed") {
      BasementGoforUniverse();
      return;
   }   
   
   // On force le passage à l'univers, en cas de plantage/quit prématuré entre la scène et l'univers
   if (TaskResolved("task_japan_prologcompleted") && !TaskResolved("task_japan_universeresolved")) {
      BasementGoforUniverse();
      return;
   }
   
   // On a tout terminé
   if ( TaskResolved("task_japan_universeresolved") && TestGlobal("basement_rope")) {
      _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("GLOBAL_ASHLEY_FINISHED"), "", true);
      return;
   }
}
コード例 #20
0
bool Scene_Inca_Mainscreen::ItemUsed(const char *szItemName, const char *szObjectName)
{
   // Le joueur donne la lance réparée au garde
   if (strcmp(szItemName, "inv_inca_spearrepaired") == 0) {
      if (strcmp(szObjectName, "inca_main_guard_nospear") == 0) {
         _lpSceneDirector->DropItem(szItemName);
         ESoundBank::getSound("success")->playSample();
         ResolveTask("task_inca_givespear");
         int x,y;
         GetObjectPosition("inca_main_guard_spear", x, y, true, false);
         // Le garde reçoit la lance
         _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, true);
         _lpSceneDirector->getSequencer()->SwitchImage(NULL, "inca_main_guard_nospear", "inca_main_guard_spear");
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL1"), "", false);
         _lpSceneDirector->getSequencer()->SwitchImage(NULL, "inca_main_guard_spear", "inca_main_guard_prey");
         _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL2"), "", false);
         _lpSceneDirector->getSequencer()->SwitchImage(NULL, "inca_main_guard_prey", "inca_main_guard_spear");
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, false);
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, true);
         _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL3"), "", false);
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL4"), "", false);
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL5"), "", false);
         _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL6"), "", false);
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("INCA_YUMANCO_HOWENTER"), "", false, true);
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL7"), "", false);
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_RITUAL8"), "", false);
         if (TestGlobal("__mode_adventure__")) _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, false);
         _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_CINEMATIC, false);
         AddTask("task_inca_opendoor");
         AddTask("task_inca_getartefacts");
         ResolveObjective("inca","spear");
         AddObjective("inca","enter");
         AddHint("inca","enter","how");
         return true;
      }
   }

   // Le joueur donne la lance réparée au garde
   if (strcmp(szItemName, "inv_inca_spearbroken") == 0) {
      if (strcmp(szObjectName, "inca_main_guard_nospear") == 0) {
         int x,y;
         GetObjectPosition("inca_main_guard_spear", x, y, true, false);
         // Le garde n'en veut pas
         _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_SPEARBROKEN"), "", false);
         return true;
      }
   }

   // Le joueur utilise la statuette
   if (strcmp(szItemName, "inv_inca_statuette") == 0) {
      if (strcmp(szObjectName, "inca_main_door") == 0) {
         if (!TaskResolved("task_inca_givespear")) {
            int x,y;
            GetObjectPosition("inca_main_guard_nospear", x, y, true, false);
            _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("INCA_GUARD_REFUSE"), "", true);
         }
         else {
            // Ouverture de la vignette
            ESoundBank::getSound("success")->playSample();
            _lpSceneDirector->GoToVignette("vignette_inca_statuette", szObjectName, true);
         }
         return true;
      }
   }
   
   // Le joueur utilise un effet de la statuette
   if (strcmp(szItemName, "statuette_effect_raise") == 0) {
      if (strcmp(szObjectName, "inca_main_door") == 0) {
         // Lancement de l'effet
         StartEffect("raise_door");
         return true;
      }
   }

   char *effectprefix = "statuette_effect_";
   if (strncmp(szItemName, effectprefix,strlen(effectprefix)) == 0) {
         _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("INCA_MAIN_YUMANCO_STATUETTE_NOEFFECT"), "", true, false);
		 return true;
   }
   return false;
}
コード例 #21
0
ファイル: isdf05.cpp プロジェクト: Nielk1/bz2-sp-fixes
void isdf05Mission::Execute(void)
{

	/*
	a) The player is asked to patrol around the base

	(through steps b-d sent & scouts attack)

	b) Once the base is secure, the player is supposed
	to look for scrap veins and send a scavenger (twice)

	c)Eventually you get to some turrets.  
	Shebayev detaches some mortar bikes to help you take 
	out the turrets.  

	d) Once the turrets are destroyed you need to
	deploy

	e) Follow Manson to the teleporter?  Drop off a bomb
	*/
	char tempstr[128];
	Handle nearguy = 0;
	// this is the start of the mission
	if (!start_done)
	{

		/*
		Alright Sgt Cooke, this looks like
		a good place to establish a base.  
		Patrol the area around this recycler.  
		If it looks safe, deploy the recycler.  
		*/
		shabayev = BuildObject("ivtan5",1,"shab_start");//"patrol_east");
		constructor = BuildObject("ivcons",1,"spawn_constructor");
		Stop(constructor,1);
		scav_comp= GetHandle("scav3");
		SetGroup(scav_comp,-1);
		Handle temppool=GetHandle("poolx");
		Goto(scav_comp,temppool,1);
		//	SetPlan("isdf05.aip",3);  // build stuff
		AudioMessage("isdf0500.wav");
		SetObjectiveOn(shabayev);
		SetObjectiveName(shabayev,"Cmdr. Shabayev");


		audmsg=AudioMessage("isdf0501.wav");
		patrol_phase=true;
		start_done = true;

		Handle tempscav=GetHandle("ivscav1");
		KillPilot(tempscav);
		tempscav=GetHandle("ivscav2");
		KillPilot(tempscav);
		//		Handle fv=BuildObject("fvarch",2,"scrap_field1");
		//		SetSkill(fv,3);
		SetSkill(shabayev,3);
		//		Patrol(shabayev,"patrol1",1);
		//		Attack(shabayev,fv,1);
		recy=BuildObject("ivrec5",1,"recy_start");
		//		Goto(recy,"recy_deploy");
		Dropoff(recy, "recy_deploy");
		Follow(shabayev,recy,1);
		SetScrap(1,40);
		SetScrap(3,40);  // allied resources
	}

	/*
	Here is where you put what happens every frame.  
	*/

	player = GetPlayerHandle();
	if ((!IsAlive(shabayev) && (!shab_dead)))
	{
		AudioMessage("isdf0732.wav");
		ClearObjectives();
		AddObjective("isdf05l1.otf",RED,15.0f);
		FailMission(GetTime()+5.0f,"isdf05l1.otf");
		shab_dead=true;
	}

	// determining if the player is out of his ship
	if (IsOdf(player,"isuser"))
	{
		if (!out_of_ship) GiveWeapon(player, "igsatc");
		out_of_ship = true;
	}
	else
	{
		out_of_ship = false;
	}

	if ((GetDistance(player,"spawn2")<150.f) && (!warning_message))
	{
		AudioMessage("isdf0520.wav");
		/*
		Stay away from those alien structures
		they aren't 
		vital to our mission-
		but they may be dangerous. 
		*/
		warning_message=true;
	}
	// this is checking to make sure the player does not attack his wingman /////////
	if ((!in_combat) && (!fire_message))
	{
		if ((IsAlive(shabayev)) && (IsAlive(player)))
		{
			if (GetTime() - GetLastFriendShot(shabayev) < .2f)
			{
				AudioMessage("ff01.wav"); // (shab) watch your firing!
				fire_reset = GetTime() + 2.f;
				fire_message = true;
			}
		}

		if ((IsAlive(manson)) && (IsAlive(player)))
		{
			if (GetTime() - GetLastFriendShot(manson) < .2f)
			{
				AudioMessage("isdf0555.wav"); // (manson) watch your firing!
				fire_reset = GetTime() + 2.f;
				fire_message = true;
			}
		}
	}

	if ((fire_message) && (fire_reset < GetTime()))
	{
		fire_reset = GetTime() + 999999.9f;
		fire_message = false;
	}
	if ((!IsAlive(constructor)) && (mission_state<10))
	{
		// the constructor is dead, you lose
		mission_state=12;
	}

	switch (mission_state)
	{
	case 0:

		// Shabayev starts the base
		if (GetDistance(recy,"recy_deploy") < 25.0)
		{
			//				Dropoff(recy,"recy_deploy");
			Patrol(shabayev,"patrol1",1);
			SetIndependence(shabayev,1);
			ClearObjectives();
			AddObjective("isdf0501.otf", WHITE, 10.0f);
			patrol_reminder_time=GetTime()+30.0f;
			MoviePlaying=true;
			CameraReady();
			// but danger looms..
			atk1=BuildObject("fvscout",2,"spawn1");
			wasDead1=false;
			Attack(atk1,player);
			mission_state++;
		}
		break;

	case 1:
		if (MoviePlaying)
		{
			//CameraObject(recycler,5,5,5,recycler);
			MoviePlaying = PlayMovie("isdf0501.cin");	
			//		if (IsAudioMessageDone(audmsg)) {
			if (!MoviePlaying)
			{
				//	MoviePlaying=false;
				CameraFinish();
				Build(constructor,"ibpge5",1);
				drop_off=true;
				Attack(shabayev,atk1);
				mission_state++;
			}
		}
		ReallyKillCineractive = 0;
		break;

	case 2: // patrol_phase

		// Kick this out a few extra times.
		if((ReallyKillCineractive == 0) || (ReallyKillCineractive == 10) || 
			(ReallyKillCineractive == 20))
			CameraFinish();
		ReallyKillCineractive++;

		if (drop_off)
		{
			Dropoff(constructor,"pgen1",1);
			drop_off=false;
			Handle temp=GetHandle("unnamed_ivdrop");
			Attack(shabayev,atk1,1);
			RemoveObject(temp);
		}

		if (!IsAlive(atk1))
		{
			wait_count++;
			if (wait_count==250)
			{
				wasDead1=false;
				wasDead2=false;
				raid1=BuildObject("fvsent",2,"raid1");
				Goto(raid1,recy);
				raid2=BuildObject("fvtank",2,"raid2");
				Goto(raid2,recy);
				//				raid3=BuildObject("fvsent",2,"raid3");
				//				Goto(raid3,recy);
				//				raid4=BuildObject("fvtank",2,"raid4");
				//				Goto(raid4,recy);
				ClearObjectives();
				AddObjective("isdf0517.otf",WHITE,10.0f);
				Goto(shabayev,constructor);
				AudioMessage("isdf0543.wav");
				mission_state++;
				wait_count=0;
			}
		}
		break;

	case 3:
		if (power2)
		{
			Dropoff(constructor,"pgen2",1);
			power2=false;
		}
		if (com1)
		{
			Dropoff(constructor,"rbunker1",1);
			com1=false;
		}
		if (!IsAliveAndPilot(raid1)) {
			wasDead1=true;	
		}
		if (!IsAliveAndPilot(raid2)) {
			wasDead2=true;
		}
		if ((wasDead1) && (wasDead2))
		{
			if (raid_count==1)  // should be 2
			{
				/*
				Now look for scrap veins
				around the base.  
				If you find one mark it with 
				a nav beacon.  
				*/
				scout_phase=true;
				ClearObjectives();
				AddObjective("isdf0507.otf",WHITE,5.0f);
				SetObjectiveOff(shabayev);
				nav1=BuildObject("ibnav",1,"scrap_field1");
				TranslateString2(tempstr, sizeof(tempstr), "Mission0501");  // tempstr
				SetObjectiveName(nav1,tempstr);
				SetObjectiveOn(nav1);
				//					SetObjectiveName(pool1,"bio-metal");
				//					SetObjectiveOn(pool1);

				AudioMessage("isdf0507.wav");	
				// Add an attacked for spice
				Handle atk1=BuildObject("fvscout",2,"spawn1");
				Goto(atk1,"attack1");
				Patrol(shabayev,"patrol1",1);
				SetIndependence(shabayev,1);
				// AudioMessage(
				// You go on John, I'll guard the base
				mission_state++;
			}
			else
			{
				wait_count++;
				if (wait_count==400)
				{
					if  (pgen2==NULL)
					{	
						// was follow
						Goto(shabayev,constructor,1);
						Build(constructor,"ibpge5");
						power2=true;
					}
					else 
					{
						//was Follow
						Goto(shabayev,constructor,1);
						Build(constructor,"ibcbu5");
						com1=true;
					}
					raid_count++;
					AddHealth(constructor,500);
					AddHealth(shabayev,500);
					raid1=BuildObject("fvtank",2,"raid1");
					Goto(raid1,recy);
					raid2=BuildObject("fvtank",2,"raid2");
					Goto(raid2,recy);
					wasDead1=false;
					wasDead2=false;
					//					raid3=BuildObject("fvsent",2,"raid3");
					//					Goto(raid3,recy);
					//					raid4=BuildObject("fvtank",2,"raid4");
					//					Goto(raid4,recy);
					wait_count=0;
				}
			}
		}

		break;

	case 4: 	
		// there is one, mark it with the geyser
		// mark that with a power up
		// good, now find another.  
		if ((GetDistance(player,pool1)<75.0f) && (!found_field1))
		{
			// there is a field, deploy the scavenger

			AudioMessage("isdf0508.wav");
			found_field1=true;
		}
		if (scav2_deployed) // any scav is deployed
		{
			mission_state++;
			scav1_deployed=true;
			ClearObjectives();
			AddObjective("isdf0508.otf",WHITE,10.0f);
			/*
			SetObjectiveOff(pool1);
			SetObjectiveName(pool2,"bio-metal 1");
			SetObjectiveOn(pool2);
			*/
			nav2=BuildObject("ibnav",1,"scrap_field3");
			TranslateString2(tempstr, sizeof(tempstr), "Mission0502");  // Bio-Metal 2
			SetObjectiveName(nav2,tempstr);
			SetObjectiveOff(nav1);
			SetObjectiveOn(nav2);
			AudioMessage("isdf0509.wav");  // good job
			if (!found_field1)
			{
				AudioMessage("isdf0519.wav");
				/*
				Don't send out scavengers unescorted.  
				Be sure to stay with them.
				*/
			}
		}
		break;

	case 5:
		if ((scav2_deployed) && (!found_field3) && (GetDistance(player,"scrap_field3")<225.0f))
		{
			found_field3=true;
			/*
			Watch out!
			That field looks hot.  
			*/
			AudioMessage("isdf0512.wav");
			ClearObjectives();
			AddObjective("isdf0511.otf",RED,10.0f);
			mortar_delay=GetTime()+15.0f;
		}
		nearguy=GetNearestEnemy(player);
		if ((found_field3) && (GetTime()>mortar_delay)
			&& (GetDistance(player,nearguy)>150.0f))
		{
			/*
			Cineractive
			Cooke, I'm sending you
			force to help 
			you take out those turrets!
			Here are some mortar bikes.  
			*/

			Build(constructor,"ibfact5",1);
			factory=true;

			audmsg=AudioMessage("isdf0527.wav");
			//was AudioMessage("isdf0513.wav");
			ClearObjectives();
			AddObjective("isdf0516.otf",WHITE,10.0f);
			/*
			int grp=GetFirstEmptyGroup();			
			mbike1=BuildObject("ivmbike",1,"patrol_south");
			SetGroup(mbike1,grp);
			Follow(mbike1,player,0);
			Handle mb=BuildObject("ivmbike",1,"patrol_east");
			SetGroup(mb,grp);
			Follow(mb,player,0);
			mb=BuildObject("ivmbike",1,"patrol_west");
			SetGroup(mb,grp);
			Follow(mb,player,0);
			mb=BuildObject("ivmbike",1,"patrol_north");
			SetGroup(mb,grp);
			Follow(mb,player,0);
			*/
			mission_state++;
			CameraReady();
			MoviePlaying=true;
		}
		break;

	case 6:// attack phase 
		/*
		First check to see if you blew up
		sturret1-4
		then create Manson
		at manson_start
		"Good job Cooke, you show promise"
		Then follow Manson (he's an objective)
		into the base
		When you get close
		lets run past those towers

		when you get there
		hop out and use your demolition charge

		Then run away.  Everything blows up.  
		*/
		if (factory)
		{
			Dropoff(constructor,"fact");
			factory=false;
		}
		if (MoviePlaying)
		{
			CameraObject(constructor,1,11,22,constructor);
			if (IsAudioMessageDone(audmsg))
			{
				MoviePlaying=false;
				CameraFinish();
			}
		}

		if ((!killed_turrets) &&
			(!IsAlive(sturret1)) && 
			(!IsAlive(sturret2)) &&
			(!IsAlive(sturret3)) && (!IsAlive(sturret4))
			&&
			(!IsAlive(sturret5)) && (!IsAlive(sturret6)))
		{
			AudioMessage("isdf0514.wav"); // you show promise
			killed_turrets=true;
			ClearObjectives();
			AddObjective("isdf0512.otf",WHITE,10.0f);
			manson_shows=GetTime()+10.0f;
			manson=BuildObject("ivtank",3,"manson_start");
			SetObjectiveName(manson, "Maj. Manson");
			Handle minion=BuildObject("ivtank",3,"manson_escort1");
			SetObjectiveName(minion, "Sgt. Zdarko");
			Follow(minion,manson);
			minion=BuildObject("ivtank",3,"manson_escort2");
			SetObjectiveName(minion, "Sgt. Masiker");
			Follow(minion,manson);
		}
		if ((killed_turrets) && (!manson_message) && 
			(GetTime()>manson_shows))
		{
			/*
			We found the objective, 
			follow me
			*/
			AudioMessage("isdf0515.wav");
			SetObjectiveOff(nav2);
			SetObjectiveOn(manson);
			ClearObjectives();
			AddObjective("isdf0518.otf",WHITE,10.0f);
			manson_message=true;
			mission_state++;
		}
		break;

	case 7:
		if (GetDistance(player,manson)<50.0f)
		{
			ClearObjectives();
			AddObjective("isdf0513.otf",WHITE,10.0f);
			SetIndependence(manson,0);
			SetAvoidType(manson,0);
			AudioMessage("isdf0539a.wav");
			Goto(manson,"manson_path1");				
			mission_state++;
		}	
		break;

	case 8:
		AddHealth(manson,100); // we don't want him to die here
		if ((wait_up) && (GetDistance(player,manson)<100.0f))
		{
			// right now this goes off too 
			// soon.   You go on to path 2 before 1 is doen
			// But at least it makes sure
			// you are close once.  
			wait_up=false;
			Goto(manson,"manson_path2");
		}
		if ((!gun_tower_message) && (GetDistance(manson,"guntower2")<200.0f))
		{
			/*
			There are gun towers ahead
			let's try to go past fast.  
			*/
			AudioMessage("isdf0516.wav");
			gun_tower_message=true;
			ClearObjectives();
			AddObjective("isdf0514.otf",WHITE,10.0f);
			gun_tower_counter=0;
		}
		if (gun_tower_message) 
		{
			gun_tower_counter++;
			if (gun_tower_counter>450)  // you are on a timer
			{
				AudioMessage("isdf0529.wav");
				ClearObjectives();
				AddObjective("isdf0520.otf",RED,10.0f);
				FailMission(GetTime()+10.0f,"isdf0520.otf");
				mission_state=12;
			}
			if (gun_tower_counter==300)
			{
				AudioMessage("isdf0528.wav");
			}
		}
		if ((gun_tower_message) && (!hop_out_message) &&
			(GetDistance(player,teleportal)<100.0f))
		{
			/* 
			Get out and use your
			demolition charge on
			that building
			*/
			AudioMessage("isdf0173.wav");  // that looks like one of ours?
			AudioMessage("isdf0517.wav");
			hop_out_message=true;
			SetObjectiveOff(manson);
			SetObjectiveOn(teleportal);
			TranslateString2(tempstr, sizeof(tempstr), "Mission0503");  // Excavator
			SetObjectiveName(teleportal,tempstr);
			ClearObjectives();
			AddObjective("isdf0515.otf",WHITE,10.0f);
			SetIndependence(manson,1);
			mission_state++;
		}
		break;

	case 9:
		if ((!out_of_ship_ever) && (out_of_ship)) {
			out_of_ship_ever=true;
			ClearObjectives();
			AddObjective("isdf0521.otf",WHITE,5.0f);
		}
		if (!IsAlive(teleportal))
		{
			if (out_of_ship_ever)
			{
				AudioMessage("isdf0518.wav");
				SucceedMission(GetTime()+10.0f,"isdf05w1.txt");
				mission_state++;
			}
			else
			{
				AudioMessage("isdf0521.wav");
				/*
				I said use your
				demolition charge
				*/
				FailMission(GetTime()+10.0f,"isdfl1.txt");
				mission_state++;
			}
		}
		break;

	case 12:
		/*
		If you lose the constructor
		this condition occurs.  
		*/
		AudioMessage("isdf0522.wav");
		ClearObjectives();
		AddObjective("isdf0519.otf",RED,10.0f);
		FailMission(GetTime()+10.0f,"isdf0519.otf");
		mission_state++;
		break;
	case 13:
		// waiting for the end of the world.  
		break;
	}



	/*
	the lurkers
	*/
	if ((lurker1==NULL) && (GetDistance(player,"lurker1")<150.0f))
	{
		lurker1=BuildObject("fvsent",2,"lurker1");
	}
	if ((lurker2==NULL) && (GetDistance(player,"lurker2")<150.0f))
	{
		lurker2=BuildObject("fvsent",2,"lurker1");
	}
	if ((lurker3==NULL) && (GetDistance(player,"lurker3")<150.0f))
	{
		lurker3=BuildObject("fvsent",2,"lurker3");
	}
	if ((lurker4==NULL) && (GetDistance(player,"lurker4")<150.0f))
	{
		lurker4=BuildObject("fvsent",2,"lurker4");
	}
}
コード例 #22
0
bool SceneBasement::ItemUsed(const char *szItemName, const char *szObjectName)
{
   // Le joueur donne quelque chose au fantôme debout
   if (strcmp(szObjectName, "basement_ghostup") == 0)
   {
      int x,y;
      bool bGiven = false;
      GetObjectPosition("basement_ghostup", x, y);
      if (strcmp(szItemName, "inv_house_basement_paper") == 0) {
         ResolveTask("task_house_basement_givepaper");
         RemoveHint("house","helpnatsumi","nextpaper");
         // On peut maintenant retirer l'objet de l'inventaire
         _lpSceneDirector->DropItem("inv_house_basement_paper");
         _lpSceneDirector->getSequencer()->PlaySound(NULL, "success");
         _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HOUSE_BASEMENT_NATSUMI_THANKYOU"), "", true, false, _lpGhostVoice);
         if (!TaskResolved("task_house_basement_givecharcoal")) {
            AddHint("house","helpnatsumi","nextcharcoal");
         }
         bGiven = true;
      }
      else
      if (strcmp(szItemName, "inv_house_basement_grid_charcoal") == 0) {
         ResolveTask("task_house_basement_givecharcoal");
         RemoveHint("house","helpnatsumi","nextcharcoal");
         // On peut maintenant retirer l'objet de l'inventaire
         _lpSceneDirector->DropItem("inv_house_basement_grid_charcoal");
         _lpSceneDirector->getSequencer()->PlaySound(NULL, "success");
         _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HOUSE_BASEMENT_NATSUMI_THANKYOU"), "", true, false, _lpGhostVoice);
         bGiven = true;
      }
      else {
         _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HOUSE_BASEMENT_NATSUMI_IDONTNEED"), "", true, false, _lpGhostVoice);
      }
      
      // On teste si on a donné les 2 objets attendus par le fantôme
      if (bGiven) {
         if (TaskResolved("task_house_basement_givepaper") && TaskResolved("task_house_basement_givecharcoal")) {
            _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, true);
            _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_up", false);
            _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghostup",false);
            _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghostdrawing1",true);
            _lpSceneDirector->getSequencer()->SwitchImage(NULL, "basement_ghostdrawing1", "basement_ghostdrawing2");
            _lpSceneDirector->getSequencer()->SwitchImage(NULL, "basement_ghostdrawing2", "basement_ghostdrawing1");
            _lpSceneDirector->getSequencer()->SwitchImage(NULL, "basement_ghostdrawing1", "basement_ghostdrawing2");
            _lpSceneDirector->getSequencer()->SwitchImage(NULL, "basement_ghostdrawing2", "basement_ghostdrawing1");
            _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("HOUSE_BASEMENT_ASHLEY_SHEDRAW"), "", false, true);
            _lpSceneDirector->getSequencer()->SwitchImage(NULL, "basement_ghostdrawing1", "basement_ghostdrawing2");
            _lpSceneDirector->getSequencer()->SwitchImage(NULL, "basement_ghostdrawing2", "basement_ghostdrawing1");
            _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghostdrawing1",false);
            _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_hidden", true);
            _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghosthidden",true);
            _lpSceneDirector->getSequencer()->PlaySound(NULL, "success");
            _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_sketch",true);
            _lpSceneDirector->getSequencer()->Animation(NULL, "sketchanimp2p", true);
            _lpSceneDirector->getSequencer()->NarrationMode(NULL, SEQUENCE_NARRATION_DIALOG, false);
            _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("HOUSE_BASEMENT_ASHLEY_SHEDRAW2"), "", true);
            ResolveTask("task_house_basement_natsumineed");
            AddTask("task_house_basement_bonzai");
            RemoveHint("house","helpnatsumi","what");
            AddObjective("house","bonzai");
            AddHint("house","bonzai","how");
            AddHint("house","bonzai","grip");
         }
      }
      return true;
   }
   // Le joueur donne quelque chose au fantôme caché
   if (strcmp(szObjectName, "basement_ghosthidden") == 0)
   {
      _lpSceneDirector->getSequencer()->PlaySound(NULL, "ghostappear");
      int x,y;
      GetObjectPosition("basement_ghostup", x, y);
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghosthidden",false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_hidden", false);
      _lpSceneDirector->getSequencer()->ShowEmitter(NULL, "creeping_static_up", true);
      _lpSceneDirector->getSequencer()->ShowImage(NULL,"basement_ghostup",true);
      _lpSceneDirector->getSequencer()->Talk(NULL, x, y, KStr("HOUSE_BASEMENT_NATSUMI_DOYOUWANT2GIVE"), "", false, false, _lpGhostVoice);
      _lpTimerGhost->startCounter(0.0f, 1.0f, 0, 10000, K_COUNTER_LINEAR);
      return true;
   }
   // Le joueur utilise l'ampoule sur le bulbe cassé
   if ( strcmp(szItemName, "inv_house_basement_bulb") == 0 ) {
      if (strcmp(szObjectName, "bulbbroken") == 0)
      {
         _lpSceneDirector->getSequencer()->VoiceOver(NULL, KStr("HOUSE_BASEMENT_ASHLEY_IMPOBULB"),"");
         return true;
      }
   }
   // Le joueur utilise le torchon sur le bulbe cassé
   if ( strcmp(szItemName, "inv_house_basement_rag") == 0 ) {
      if (strcmp(szObjectName, "bulbbroken") == 0)
      {
         ESoundBank::getSound("success")->playSample();
         // On peut maintenant retirer l'objet de l'inventaire
         _lpSceneDirector->DropItem("inv_house_basement_rag");
         // On enlève la douille cassée
         SetVisible("bulbbroken", false);
         SetVisible("nobulb", true);
         // Tache résolue : enlever le bulbe brisé
         ResolveTask("task_house_basement_removebulb");
         return true;
      }
   }
   // Le joueur utilise l'ampoule neuve sur la douille vide
   if ( strcmp(szItemName, "inv_house_basement_bulb") == 0 ) {
      if (strcmp(szObjectName, "nobulb") == 0)
      {
         ESoundBank::getSound("success")->playSample();
         // On peut maintenant retirer l'objet de l'inventaire
         _lpSceneDirector->DropItem("inv_house_basement_bulb");
         // On met l'ampoule
         SetVisible("bulboff", true);
         SetVisible("nobulb", false);
         // Tache résolue : enlever le bulbe brisé
         ResolveTask("task_house_basement_changebulb");
         return true;
      }
   }
   // Le joueur utilise le marteau sur le vase
   if ( strcmp(szItemName, "inv_house_basement_hammer") == 0 ) {
      if (strcmp(szObjectName, "basement_vase") == 0)
      {
         ESoundBank::getSound("success")->playSample();
         // On peut maintenant retirer l'objet de l'inventaire
         _lpSceneDirector->DropItem("inv_house_basement_hammer");
         SetVisible("basement_vase", false);
         SetVisible("basement_vasebroken", true);
         SetVisible("basement_paper", true);
         _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("HOUSE_BASEMENT_VASEBROKEN_INFO"), "", true);
         // Tache résolue
         ResolveTask("task_house_basement_brokevase");
         return true;
      }
   }
   
   // Le joueur utilise la pince cassée sur le bonzai
   if ( strcmp(szItemName, "inv_house_basement_gripbroken") == 0 ) {
      _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("HOUSE_BASEMENT_ASHLEY_CANNOTWRIST"), "", true);
   }
   // Le joueur utilise la pince sur le bonzai
   if ( strcmp(szItemName, "inv_house_basement_grip") == 0 ) {
      // On doit avoir le modèle pour faire le mini jeu !
      if (_lpSceneDirector->getInventory()->getItemFromInventory("inv_house_basement_sketch")) {
         if (strcmp(szObjectName, "basement_bonzai") == 0)
         {
            EMiniJeuBase *lpMiniJeu = new EMinijeuBonzai();
            _lpSceneDirector->GoToMiniGame("bonzai", lpMiniJeu);
            return true;
         }
      }
      else {
         _lpSceneDirector->getSequencer()->Talk(NULL, CHARACTER_POSX, CHARACTER_POSY, KStr("HOUSE_BASEMENT_ASHLEY_INEEDMODEL"), "", true);
         return true;
      }
   }
   return false;
}
コード例 #23
0
ファイル: scion02.cpp プロジェクト: Nielk1/bz2-sp-fixes
void scion02::Execute(void)
{





/*
	Here is where you put what happens every frame.  
*/
	// paths
	// spawn_scout1  >> strike1 
	// spawn_scout2  >> strike2
	
	//	SetCurAmmo(player,1500);//TEMP	
	//	SetCurHealth(player,2000);//TEMP
//STARTING PARAMETERS
	
	char tempstr[128];

	if ((!been_detected) && (mission_state<5)) // 5= ambush is set
	{
		/*
		Handle foe=GetWhoShotMe(player);
		if ((foe!=NULL) && (foe!=oldscout) && 
			(IsAlive(oldscout)) && // I just added this.. probably unness if HandleScout worked
			(GetTeamNum(oldscout)==comp_team))
		*/
		if ((GetDistance(enemytank1,player)<75.0f) ||
			(GetDistance(enemytank2,player)<75.0f) ||
			(GetDistance(enemyscout1,player)<75.0f) ||
			(GetDistance(enemyscout2,player)<75.0f))
		{
			been_detected=true;
			mission_state=101;
			AudioMessage("scion0220.wav");  // oh no we've been detected
			been_detected=true;
		}
		HandleScout();
	}
	


	switch (mission_state)
	{
		case 0:
			{
			// HACK to fix bug
				Handle shab=GetHandle("shabayev");  // what is she doing here anyway?
				RemoveObject(shab);

			// play message
				talk1 = AudioMessage("scion0201.wav");
		
			// take over base
				SetScrap(1,40);

			// Your starting base
				int grp=GetFirstEmptyGroup();			
				recycler=BuildObject("fvrec2",1,"recycler");
				SetGroup(recycler,grp);	

				grp++;
				scav1=BuildObject("fvscav",1,"scav_1");
				SetGroup(scav1,grp);
				grp++;
				scav2=BuildObject("fvscav",1,"scav_2");
				SetGroup(scav2,grp);	
			
				grp++;
				turret1=BuildObject("fvturr",1,"turret_1");
				SetGroup(turret1,grp);
				turret2=BuildObject("fvturr",1,"turret_2");
				SetGroup(turret2,grp);

				grp++;
				sent1=BuildObject("fvtank",1,"tank_1");
				SetGroup(sent1,grp);
				sent2=BuildObject("fvtank",1,"tank_2");
				SetGroup(sent2,grp);

				grp++;
				constructor=BuildObject("fvcos2",1,"cons_1");
				SetGroup(constructor,grp);

				objective=BuildObject("ibnav",1,"jammer");
//	These units have smaller engage ranges
				enemytank1=BuildObject("ivtas2",2,"etank_1");
				enemyscout1=BuildObject("ivscos2",2,"escout_1");	
	
				enemytank2=BuildObject("ivtas2",2,"etank_2");
				enemyscout2=BuildObject("ivscos2",2,"escout_2");

				Patrol(enemytank1,"isdf_patrol1",0);
				Patrol(enemyscout1,"isdf_patrol1",0);

				Patrol(enemytank2,"isdf_patrol2",0);
				Patrol(enemyscout2,"isdf_patrol2",0);

				BuildObject("ibgtow",comp_team,"egtow_1");
				BuildObject("ibgtow",comp_team,"egtow_2");
				power1=BuildObject("ibpgen",comp_team,"epgen_1");
				power2=BuildObject("ibpgen",comp_team,"epgen_2");
				BuildObject("ibsbay",comp_team,"esbay");
				BuildObject("ibfact",comp_team,"efact");
				enemybase=BuildObject("ibrecy",comp_team,"erecy");
				BuildObject("ibarmo",comp_team,"earmo");

				base_unit_1=BuildObject("ivtank",comp_team,"base_unit_1");
				base_unit_2=BuildObject("ivmisl",comp_team,"base_unit_2");
				base_unit_3=BuildObject("ivtank",comp_team,"base_unit_3");
				base_unit_4=BuildObject("ivmisl",comp_team,"base_unit_4");
				
				mission_state++;
			}
			break;
		case 1:  // further instruction
			if ((IsAudioMessageDone(talk1)))
			{
					ClearObjectives();
					AudioMessage("scion0202.wav");
					AddObjective("scion0201.otf",WHITE,20.0f);
					SetObjectiveOn(objective); 
					TranslateString2(tempstr, sizeof(tempstr), "MissionS0201");  // Ambush
					SetObjectiveName(objective,tempstr);
					mission_state++;
			}
			break;
		case 2:  // player arrives at ambush site
			if (GetDistance(player,objective)<75.0f)	
			{
				AudioMessage("scion0203.wav");  // good now set up
				ClearObjectives();
				AddObjective("scion0202.otf",WHITE,20.0f);
				AddObjective("scion0203.otf",WHITE,20.0f);
				mission_state++;

			}
			break;
		case 3: // wait for the constructor to show up
				if (GetDistance(constructor,objective)<75.0f)
				{	
					AudioMessage("scion0204.wav"); // Good, now build a jammer
					ClearObjectives();
					AddObjective("scion0202.otf",GREEN,5.0f);
					AddObjective("scion0203.otf",WHITE,5.0f);
					mission_state++;
				}
			break;
		case 4:
				if (jammer_exists)
				{
					AudioMessage("scion0205.wav");  
					// now drive into the enemy base and lead them to 
					// your ambush.  
					ClearObjectives();
					AddObjective("scion0204.otf",WHITE,10.0f);
					mission_state++;
					SetIndependence(enemytank1,1);
					SetIndependence(enemytank2,1);
					SetIndependence(enemyscout1,1);
					SetIndependence(enemyscout2,1);
					been_detected=true;  // doesn't matter now
				}
			break;
		case 5: 
			if ((GetDistance(player,base_unit_1)<200.0f) ||
				(GetDistance(player,base_unit_2)<200.0f)
				|| (GetDistance(player,enemytank1)<75.0f)
				|| (GetDistance(player,enemyscout1)<75.0f))
			{
				AudioMessage("scion0206.wav");
				// Here they come!
				Goto(base_unit_1,"go_jammer");
				Goto(base_unit_2,"go_jammer");
				Goto(base_unit_3,"go_jammer");
				Goto(base_unit_4,"go_jammer");
				Attack(enemyscout1,player);
				Attack(enemytank1,player);
				// the ambush has begun
				mission_state++;
			}
			break;
		case 6: // wait for ambush to end
			if (!IsAlive(player))
			{
				if (IsAlive(base_unit_1))  
					Attack(base_unit_1,jammer);
				if (IsAlive(base_unit_2))
					Attack(base_unit_2,jammer);
				if (IsAlive(base_unit_3))
					Attack(base_unit_3,jammer);
				if (IsAlive(base_unit_4))
					Attack(base_unit_4,jammer);
				if (IsAlive(enemyscout1))
					Attack(enemyscout1,player);
				if (IsAlive(enemytank1))
					Attack(enemytank1,player);
			}
			if ((!IsAlive(base_unit_1)) &&
				(!IsAlive(base_unit_2)) &&
				(!IsAlive(base_unit_3)) &&
				(!IsAlive(base_unit_4)))
			{
				AudioMessage("scion0207.wav");
				ArtilleryObjective();
				/*
					Now we will use artillery
					to finish off the base surgically
				*/
				// set where the artillery goes as an objective, 
				// wait for the player to build it
				SetObjectiveOff(objective);
				objective2=BuildObject("ibnav",1,"escout_1");
				SetObjectiveOn(objective2);
				TranslateString2(tempstr, sizeof(tempstr), "MissionS0202");  // Artillery
				SetObjectiveName(objective2,tempstr);
				mission_state++;
			}
			break;
		case 7:  // wait for artillery
			if ((IsAlive(artillery)) || (IsAlive(artillery2)))
			{
				AudioMessage("scion0208.wav");
				art_objective1=true;
				ArtilleryObjective();
				mission_state++;
			}
			break;
		case 8:  // wait for it to get there
			if (
				((IsAlive(artillery2)) && (GetDistance(artillery,objective2)<50.0f)) || 
				((IsAlive(artillery2)) && (GetDistance(artillery2,objective2)<50.0f))  ) 
			{
				art_objective2=true;
				ArtilleryObjective();
				AudioMessage("scion0209.wav");
				SetObjectiveOn(power1);
				SetObjectiveOn(power2);
				mission_state++;
			}
			break;
		case 9:
			increment++;
			if (increment%300==0)
			{
				if (!last_objective) {
					ClearObjectives();
					AddObjective("scion0206.otf",WHITE,5.0f);
					last_objective=true;
				}
				Handle atk1=BuildObject("ivscout",2,"base_unit_2");
				Attack(atk1,artillery);
			}
			if ((!IsAlive(power1)) || (!IsAlive(power2)))
			{
				AudioMessage("scion0210.wav");
				if (IsAlive(power1))
					SetObjectiveOff(power1);
				if (IsAlive(power2))
					SetObjectiveOff(power2);
				mission_state++;
			}
			break;
		case 10:
			if (GetDistance(player,"erecy")<75.0f)
			{
				AudioMessage("scion0211.wav");
				SucceedMission(GetTime()+10.0f,"scion02w1.txt");
				mission_state++;
			}
			break;
		case 101:  // player is detected too soon
			{
				increment++;
				if (increment%300==0)
				{
					Handle atk=BuildObject("ivtank",comp_team,"efact");
					Attack(atk,recycler);
					atk=BuildObject("ivmbike",comp_team,"efact");
					Attack(atk,recycler);
					atk=BuildObject("ivrckt",comp_team,"spawn_scout1");
					Goto(atk,"strike1");
				}
			}
			break;
		case 102:
			/*
				You lose, movie etc.  

			*/
			{
				FailMission(GetTime()+15.0f,"scion0201.otf");
				mission_state++;
			}
			break;
	}
				


	//making sure isdf base guardians stay in the area
/*
	if ((!tank1toofar) && (GetDistance(basetank1,"goback") > 250))
	{
		Retreat(basetank1,"goback");
		tank1toofar = true;
	}

	if ((!tank2toofar) && (GetDistance(basetank2,"goback") > 250))
	{
		Retreat(basetank2,"goback");
		tank2toofar = true;
	}

	if ((!scout1toofar) && (GetDistance(scout1,"goback") > 250))
	{
		Retreat(scout1,"goback");
		scout1toofar = true;
	}

///
	if ((tank1toofar) && (GetDistance(basetank1,"goback") <100))
	{
		Attack(basetank1,player);
		tank1toofar = false;
	}
	
	if ((tank2toofar) && (GetDistance(basetank2,"goback") <100))
	{
		Attack(basetank2,player);
		tank2toofar = false;
	}

	if ((scout1toofar) && (GetDistance(scout1,"goback") <100))
	{
		Attack(scout1,player);
		scout1toofar = false;
	}
*/
	if ((mission_state<102) && (!IsAlive(recycler)))
	{
		mission_state=102;
	}
	player = GetPlayerHandle();

}