コード例 #1
0
ファイル: CPedSA.cpp プロジェクト: ntauthority/openvice
CWeapon * CPedSA::GiveWeapon ( eWeaponType weaponType, unsigned int uiAmmo, eWeaponSkill skill )
{
    if ( weaponType != WEAPONTYPE_UNARMED )
    {
        CWeaponInfo* pInfo = pGame->GetWeaponInfo ( weaponType, skill );
        if ( pInfo )
        {
            int iModel = pInfo->GetModel();

            if ( iModel )
            {
                CModelInfo * pWeaponModel = pGame->GetModelInfo ( iModel );
                if ( pWeaponModel )
                {
                    pWeaponModel->Request ( BLOCKING, "CPedSA::GiveWeapon" );
                    pWeaponModel->MakeCustomModel ();
                }
            }
            // If the weapon is satchels, load the detonator too
            if ( weaponType == WEAPONTYPE_REMOTE_SATCHEL_CHARGE )
            {
                /*int iModel = pGame->GetWeaponInfo ( WEAPONTYPE_DETONATOR )->GetModel();
                if ( iModel )
                {
                    CModelInfo * pWeaponModel = pGame->GetModelInfo ( iModel );
                    if ( pWeaponModel )
                    {
                        pWeaponModel->Request ( true, true );
                    }
                }*/
                // Load the weapon and give it properly so getPedWeapon shows the weapon is there.
                GiveWeapon( WEAPONTYPE_DETONATOR, 1, WEAPONSKILL_STD );
            }
        }
    }

    DWORD dwReturn = 0;
    DWORD dwFunc = FUNC_GiveWeapon;
    DWORD dwThis = (DWORD)this->GetInterface();
    _asm
    {
        mov     ecx, dwThis
        push    1
        push    uiAmmo
        push    weaponType
        call    dwFunc
        mov     dwReturn, eax
    }

    CWeapon* pWeapon = GetWeapon ( (eWeaponSlot)dwReturn );

    return pWeapon;
}
コード例 #2
0
ファイル: CClientPlayer.cpp プロジェクト: Jusonex/mtasa-blue
// Only called for remote players
void CClientPlayer::DischargeWeapon ( eWeaponType weaponType, const CVector& vecStart, const CVector& vecEnd, float fBackupDamage, uchar ucBackupHitZone, CClientPlayer* pBackupDamagedPlayer )
{
    if ( m_pPlayerPed )
    {
        g_pApplyDamageLastDamagedPed = NULL;
        g_fApplyDamageLastAmount = 0;

        // Ensure remote player has the weapon
        if ( weaponType != GetCurrentWeaponType() )
        {
            GiveWeapon(weaponType, 99, true);
            AddReportLog(5432, SString("DischargeWeapon adding missing weapon %d (%s)", weaponType, GetNick()), 30);
        }

        // Check weapon matches and is enabled for bullet sync
        if ( weaponType == GetCurrentWeaponType () &&
             g_pClientGame->GetWeaponTypeUsesBulletSync ( weaponType ) )
        {
            // Set bullet start and end points
            m_shotSyncData->m_vecRemoteBulletSyncStart = vecStart;
            m_shotSyncData->m_vecRemoteBulletSyncEnd = vecEnd;
            m_shotSyncData->m_bRemoteBulletSyncVectorsValid = true;

            g_iDamageEventLimit = 1;

            // Fixed #9038: bugged shotgun with bullet sync
            if ( weaponType == WEAPONTYPE_SHOTGUN || weaponType == WEAPONTYPE_SAWNOFF_SHOTGUN || weaponType == WEAPONTYPE_SPAS12_SHOTGUN )
            {
                if ( g_pClientGame->GetMiscGameSettings().bAllowShotgunDamageFix )
                    g_iDamageEventLimit = 7;
            }

            // Fire
            CWeapon* pWeapon = m_pPlayerPed->GetWeapon ( m_pPlayerPed->GetCurrentWeaponSlot () );
            pWeapon->FireBullet ( m_pPlayerPed, vecStart, vecEnd );
            g_iDamageEventLimit = -1;

            m_shotSyncData->m_bRemoteBulletSyncVectorsValid = false;
        }

        // Apply extra damage if player has bad network
        if ( pBackupDamagedPlayer && pBackupDamagedPlayer->GetGamePlayer() && pBackupDamagedPlayer->GetWasRecentlyInNetworkInterruption( 1000 ) )
        {
            // Subtract any damage that did get applied during FireBullet
            if ( pBackupDamagedPlayer == g_pApplyDamageLastDamagedPed )
                fBackupDamage -= g_fApplyDamageLastAmount;

            if ( fBackupDamage > 0 )
            {
                // Apply left over damage like what the game would:
                //      CClientPlayer has pre damage health/armor
                //      CPlayerPed has post damage health/armor

                float fPreviousHealth = pBackupDamagedPlayer->m_fHealth;
                float fPreviousArmor = pBackupDamagedPlayer->m_fArmor;

                // Calculate how much damage should be applied to health/armor
                float fArmorDamage = std::min( fBackupDamage, pBackupDamagedPlayer->m_fArmor );
                float fHealthDamage = std::min( fBackupDamage - fArmorDamage, pBackupDamagedPlayer->m_fHealth );

                float fNewArmor = pBackupDamagedPlayer->m_fArmor - fArmorDamage;
                float fNewHealth = pBackupDamagedPlayer->m_fHealth - fHealthDamage;

                // Ensure CPlayerPed has post damage health/armor
                pBackupDamagedPlayer->GetGamePlayer()->SetHealth( fNewHealth );
                pBackupDamagedPlayer->GetGamePlayer()->SetArmor( fNewArmor );

                g_pClientGame->ApplyPedDamageFromGame( weaponType, fBackupDamage, ucBackupHitZone, pBackupDamagedPlayer, this, NULL );

                SString strMessage( "Applied %0.2f damage to %s (from %s) due to network interruption", fBackupDamage, pBackupDamagedPlayer->GetNick(), GetNick() );
                g_pClientGame->TellServerSomethingImportant( 1010, strMessage );
            }
        }
    }
}
コード例 #3
0
ファイル: wl_debug.c プロジェクト: AliSayed/MoSync
int DebugKeys()
{
	boolean esc;
	int level;

	if (IN_KeyDown(sc_C))		// C = count objects
	{
		CountObjects();
		return 1;
	}

	if (IN_KeyDown(sc_E))		// E = quit level
	{
		playstate = ex_completed;
//		gamestate.mapon++;
	}

	if (IN_KeyDown(sc_F))		// F = facing spot
	{
		CenterWindow (14,4);
		US_Print ("X:");
		US_PrintUnsigned (player->x);
		US_Print ("\nY:");
		US_PrintUnsigned (player->y);
		US_Print ("\nA:");
		US_PrintUnsigned (player->angle);
		VW_UpdateScreen();
		IN_Ack();
		return 1;
	}

	if (IN_KeyDown(sc_G))		// G = god mode
	{
		CenterWindow (12,2);
		if (godmode)
		  US_PrintCentered ("God mode OFF");
		else
		  US_PrintCentered ("God mode ON");
		VW_UpdateScreen();
		IN_Ack();
		godmode ^= 1;
		return 1;
	}
	if (IN_KeyDown(sc_H))		// H = hurt self
	{
		IN_ClearKeysDown ();
		TakeDamage (16,NULL);
	}
	else if (IN_KeyDown(sc_I))			// I = item cheat
	{
		CenterWindow (12,3);
		US_PrintCentered ("Free items!");
		VW_UpdateScreen();
		GivePoints(100000);
		HealSelf(99);
		if (gamestate.bestweapon<wp_chaingun)
			GiveWeapon (gamestate.bestweapon+1);
		gamestate.ammo += 50;
		if (gamestate.ammo > 99)
			gamestate.ammo = 99;
		DrawAmmo ();
		IN_Ack ();
		return 1;
	}
	else if (IN_KeyDown(sc_N))			// N = no clip
	{
		noclip^=1;
		CenterWindow (18,3);
		if (noclip)
			US_PrintCentered ("No clipping ON");
		else
			US_PrintCentered ("No clipping OFF");
		VW_UpdateScreen();
		IN_Ack ();
		return 1;
	}
	else if (IN_KeyDown(sc_P))			// P = pause with no screen disruptioon
	{
		PicturePause ();
		return 1;
	}
	else if (IN_KeyDown(sc_Q))			// Q = fast quit
		Quit(NULL);
	else if (IN_KeyDown(sc_S))			// S = slow motion
	{
		singlestep^=1;
		CenterWindow (18,3);
		if (singlestep)
			US_PrintCentered ("Slow motion ON");
		else
			US_PrintCentered ("Slow motion OFF");
		VW_UpdateScreen();
		IN_Ack ();
		return 1;
	}
	else if (IN_KeyDown(sc_T))			// T = shape test
	{
		ShapeTest();
		return 1;
	}
	else if (IN_KeyDown(sc_W))			// W = warp to level
	{
		CenterWindow(26,3);
		PrintY+=6;
#ifndef SPEAR
		US_Print("  Warp to which level(1-10):");
#elif defined(SPEARDEMO)
		US_Print("  Warp to which level(1-2):");
#else
		US_Print("  Warp to which level(1-21):");
#endif
		VW_UpdateScreen();
		esc = !US_LineInput (px,py,str,NULL,true,2,0);
		if (!esc)
		{
			level = atoi (str);
#ifndef SPEAR
			if (level>0 && level<11)
#elif defined(SPEARDEMO)
			if (level>0 && level<2)
#else
			if (level>0 && level<22)
#endif
			{
				gamestate.mapon = level-1;
				playstate = ex_warped;
			}
		}
		return 1;
	}

	DrawPlayBorder();
	
	return 0;
}
コード例 #4
0
void CCharacter::ClassSpawnAttributes()
{
	switch(GetClass())
	{
		case PLAYERCLASS_ENGINEER:
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			GiveWeapon(WEAPON_GUN, 10);
			GiveWeapon(WEAPON_RIFLE, 10);
			m_ActiveWeapon = WEAPON_RIFLE;
			GameServer()->SendBroadcast("Engineer : Can build wall with hammer", m_pPlayer->GetCID());
			break;
		case PLAYERCLASS_SOLDIER:
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			GiveWeapon(WEAPON_GUN, 10);
			GiveWeapon(WEAPON_GRENADE, 10);
			m_ActiveWeapon = WEAPON_GRENADE;
			GameServer()->SendBroadcast("Soldier : Can pose remote bombs with hammer, and recharge it with grenades", m_pPlayer->GetCID());
			break;
		case PLAYERCLASS_MEDIC:
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			GiveWeapon(WEAPON_GUN, 10);
			GiveWeapon(WEAPON_SHOTGUN, 10);
			m_ActiveWeapon = WEAPON_SHOTGUN;
			GameServer()->SendBroadcast("Medic : Can cure infected", m_pPlayer->GetCID());
			break;
		case PLAYERCLASS_NONE:
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			break;
		case PLAYERCLASS_ZOMBIE:
			m_Health = 10;
			RemoveAllGun();
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			GameServer()->SendBroadcast("Zombie : Drain health by hooking players", m_pPlayer->GetCID());
			break;
		case PLAYERCLASS_BOOMER:
			m_Health = 10;
			RemoveAllGun();
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			GameServer()->SendBroadcast("Boomer : Can only perform kamikaze attack", m_pPlayer->GetCID());
			break;
		case PLAYERCLASS_HUNTER:
			m_Health = 10;
			RemoveAllGun();
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			GameServer()->SendBroadcast("Hunter : Has triple jump", m_pPlayer->GetCID());
			break;
	}
}
コード例 #5
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;
  }
}
コード例 #6
0
ファイル: wl_play.cpp プロジェクト: ljbade/wolf4sdl
void CheckKeys (void)
{
    ScanCode scan;


    if (screenfaded || demoplayback)    // don't do anything with a faded screen
        return;

    scan = LastScan;


#ifdef SPEAR
    //
    // SECRET CHEAT CODE: TAB-G-F10
    //
    if (Keyboard[sc_Tab] && Keyboard[sc_G] && Keyboard[sc_F10])
    {
        WindowH = 160;
        if (godmode)
        {
            Message ("God mode OFF");
            SD_PlaySound (NOBONUSSND);
        }
        else
        {
            Message ("God mode ON");
            SD_PlaySound (ENDBONUS2SND);
        }

        IN_Ack ();
        godmode ^= 1;
        DrawPlayBorderSides ();
        IN_ClearKeysDown ();
        return;
    }
#endif


    //
    // SECRET CHEAT CODE: 'MLI'
    //
    if (Keyboard[sc_M] && Keyboard[sc_L] && Keyboard[sc_I])
    {
        gamestate.health = 100;
        gamestate.ammo = 99;
        gamestate.keys = 3;
        gamestate.score = 0;
        gamestate.TimeCount += 42000L;
        GiveWeapon (wp_chaingun);
        DrawWeapon ();
        DrawHealth ();
        DrawKeys ();
        DrawAmmo ();
        DrawScore ();

        ClearMemory ();
        CA_CacheGrChunk (STARTFONT + 1);
        ClearSplitVWB ();

        Message (STR_CHEATER1 "\n"
                 STR_CHEATER2 "\n\n" STR_CHEATER3 "\n" STR_CHEATER4 "\n" STR_CHEATER5);

        UNCACHEGRCHUNK (STARTFONT + 1);
        IN_ClearKeysDown ();
        IN_Ack ();

        if (viewsize < 17)
            DrawPlayBorder ();
    }

    //
    // OPEN UP DEBUG KEYS
    //
#ifdef DEBUGKEYS
    if (Keyboard[sc_BackSpace] && Keyboard[sc_LShift] && Keyboard[sc_Alt] && param_debugmode)
    {
        ClearMemory ();
        CA_CacheGrChunk (STARTFONT + 1);
        ClearSplitVWB ();

        Message ("Debugging keys are\nnow available!");
        UNCACHEGRCHUNK (STARTFONT + 1);
        IN_ClearKeysDown ();
        IN_Ack ();

        DrawPlayBorderSides ();
        DebugOk = 1;
    }
#endif

    //
    // TRYING THE KEEN CHEAT CODE!
    //
    if (Keyboard[sc_B] && Keyboard[sc_A] && Keyboard[sc_T])
    {
        ClearMemory ();
        CA_CacheGrChunk (STARTFONT + 1);
        ClearSplitVWB ();

        Message ("Commander Keen is also\n"
                 "available from Apogee, but\n"
                 "then, you already know\n" "that - right, Cheatmeister?!");

        UNCACHEGRCHUNK (STARTFONT + 1);
        IN_ClearKeysDown ();
        IN_Ack ();

        if (viewsize < 18)
            DrawPlayBorder ();
    }

//
// pause key weirdness can't be checked as a scan code
//
    if(buttonstate[bt_pause]) Paused = true;
    if(Paused)
    {
        int lastoffs = StopMusic();
        LatchDrawPic (20 - 4, 80 - 2 * 8, PAUSEDPIC);
        VH_UpdateScreen();
        IN_Ack ();
        Paused = false;
        ContinueMusic(lastoffs);
        if (MousePresent && IN_IsInputGrabbed())
            IN_CenterMouse();     // Clear accumulated mouse movement
        lasttimecount = GetTimeCount();
        return;
    }

//
// F1-F7/ESC to enter control panel
//
    if (
#ifndef DEBCHECK
           scan == sc_F10 ||
#endif
           scan == sc_F9 || scan == sc_F7 || scan == sc_F8)     // pop up quit dialog
    {
        short oldmapon = gamestate.mapon;
        short oldepisode = gamestate.episode;
        ClearMemory ();
        ClearSplitVWB ();
        US_ControlPanel (scan);

        DrawPlayBorderSides ();

        SETFONTCOLOR (0, 15);
        IN_ClearKeysDown ();
        return;
    }

    if ((scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape || buttonstate[bt_esc])
    {
        int lastoffs = StopMusic ();
        ClearMemory ();
        VW_FadeOut ();

        US_ControlPanel (buttonstate[bt_esc] ? sc_Escape : scan);

        SETFONTCOLOR (0, 15);
        IN_ClearKeysDown ();
        VW_FadeOut();
        if(viewsize != 21)
            DrawPlayScreen ();
        if (!startgame && !loadedgame)
            ContinueMusic (lastoffs);
        if (loadedgame)
            playstate = ex_abort;
        lasttimecount = GetTimeCount();
        if (MousePresent && IN_IsInputGrabbed())
            IN_CenterMouse();     // Clear accumulated mouse movement
        return;
    }

//
// TAB-? debug keys
//
#ifdef DEBUGKEYS
    if (Keyboard[sc_Tab] && DebugOk)
    {
        CA_CacheGrChunk (STARTFONT);
        fontnumber = 0;
        SETFONTCOLOR (0, 15);
        if (DebugKeys () && viewsize < 20)
            DrawPlayBorder ();       // dont let the blue borders flash

        if (MousePresent && IN_IsInputGrabbed())
            IN_CenterMouse();     // Clear accumulated mouse movement

        lasttimecount = GetTimeCount();
        return;
    }
#endif
}
コード例 #7
0
ファイル: wl_debug.cpp プロジェクト: vbt1/wolf4sdl
int DebugKeys (void)
{
    boolean esc;
    int level;

    if (Keyboard[sc_B])             // B = border color
    {
        CenterWindow(20,3);
        PrintY+=6;
        US_Print(" Border color (0-56): ");
        VW_UpdateScreen();
        esc = !US_LineInput (px,py,str,NULL,true,2,0);
        if (!esc)
        {
            level = atoi (str);
            if (level>=0 && level<=99)
            {
                if (level<30) level += 31;
                else
                {
                    if (level > 56) level=31;
                    else level -= 26;
                }

                bordercol=level*4+3;

                if (bordercol == VIEWCOLOR)
                    DrawStatusBorder(bordercol);

                DrawPlayBorder();

                return 0;
            }
        }
        return 1;
    }
    if (Keyboard[sc_C])             // C = count objects
    {
        CountObjects();
        return 1;
    }
    if (Keyboard[sc_D])             // D = Darkone's FPS counter
    {
        CenterWindow (22,2);
        if (fpscounter)
            US_PrintCentered ("Darkone's FPS Counter OFF");
        else
            US_PrintCentered ("Darkone's FPS Counter ON");
        VW_UpdateScreen();
        IN_Ack();
        fpscounter ^= 1;
/*        if (!fpscounter)
            DrawPlayScreen(); */
        return 1;
    }
    if (Keyboard[sc_E])             // E = quit level
    {
        if (param_tedlevel != -1)
            Quit (NULL);
        playstate = ex_completed;
    }

    if (Keyboard[sc_F])             // F = facing spot
    {
        char str[60];
        CenterWindow (14,6);
        US_Print ("x:");     US_PrintUnsigned (player->x);
        US_Print (" (");     US_PrintUnsigned (player->x%65536);
        US_Print (")\ny:");  US_PrintUnsigned (player->y);
        US_Print (" (");     US_PrintUnsigned (player->y%65536);
        US_Print (")\nA:");  US_PrintUnsigned (player->angle);
        US_Print (" X:");    US_PrintUnsigned (player->tilex);
        US_Print (" Y:");    US_PrintUnsigned (player->tiley);
        US_Print ("\n1:");   US_PrintUnsigned (tilemap[player->tilex][player->tiley]);
        sprintf(str," 2:%.8X",(unsigned)(uintptr_t)actorat[player->tilex][player->tiley]); US_Print(str);
        US_Print ("\nf 1:"); US_PrintUnsigned (player->areanumber);
        US_Print (" 2:");    US_PrintUnsigned (MAPSPOT(player->tilex,player->tiley,1));
        US_Print (" 3:");
        if ((unsigned)(uintptr_t)actorat[player->tilex][player->tiley] < 256)
            US_PrintUnsigned (spotvis[player->tilex][player->tiley]);
        else
            US_PrintUnsigned (actorat[player->tilex][player->tiley]->flags);
        VW_UpdateScreen();
        IN_Ack();
        return 1;
    }

    if (Keyboard[sc_G])             // G = god mode
    {
        CenterWindow (12,2);
        if (godmode == 0)
            US_PrintCentered ("God mode ON");
        else if (godmode == 1)
            US_PrintCentered ("God (no flash)");
        else if (godmode == 2)
            US_PrintCentered ("God mode OFF");

        VW_UpdateScreen();
        IN_Ack();
        if (godmode != 2)
            godmode++;
        else
            godmode = 0;
        return 1;
    }
    if (Keyboard[sc_H])             // H = hurt self
    {
        IN_ClearKeysDown ();
        TakeDamage (16,NULL);
    }
    else if (Keyboard[sc_I])        // I = item cheat
    {
        CenterWindow (12,3);
        US_PrintCentered ("Free items!");
        VW_UpdateScreen();
        GivePoints (100000);
        HealSelf (99);
        if (gamestate.bestweapon<wp_chaingun)
            GiveWeapon (gamestate.bestweapon+1);
        gamestate.ammo += 50;
        if (gamestate.ammo > 99)
            gamestate.ammo = 99;
        DrawAmmo ();
        IN_Ack ();
        return 1;
    }
    else if (Keyboard[sc_K])        // K = give keys
    {
        CenterWindow(16,3);
        PrintY+=6;
        US_Print("  Give Key (1-4): ");
        VW_UpdateScreen();
        esc = !US_LineInput (px,py,str,NULL,true,1,0);
        if (!esc)
        {
            level = atoi (str);
            if (level>0 && level<5)
                GiveKey(level-1);
        }
        return 1;
    }
    else if (Keyboard[sc_L])        // L = level ratios
    {
        byte x,start,end=LRpack;

        if (end == 8)   // wolf3d
        {
            CenterWindow(17,10);
            start = 0;
        }
        else            // sod
        {
            CenterWindow(17,12);
            start = 0; end = 10;
        }
again:
        for(x=start;x<end;x++)
        {
            US_PrintUnsigned(x+1);
            US_Print(" ");
            US_PrintUnsigned(LevelRatios[x].time/60);
            US_Print(":");
            if (LevelRatios[x].time%60 < 10)
                US_Print("0");
            US_PrintUnsigned(LevelRatios[x].time%60);
            US_Print(" ");
            US_PrintUnsigned(LevelRatios[x].kill);
            US_Print("% ");
            US_PrintUnsigned(LevelRatios[x].secret);
            US_Print("% ");
            US_PrintUnsigned(LevelRatios[x].treasure);
            US_Print("%\n");
        }
        VW_UpdateScreen();
        IN_Ack();
        if (end == 10 && gamestate.mapon > 9)
        {
            start = 10; end = 20;
            CenterWindow(17,12);
            goto again;
        }

        return 1;
    }
    else if (Keyboard[sc_N])        // N = no clip
    {
        noclip^=1;
        CenterWindow (18,3);
        if (noclip)
            US_PrintCentered ("No clipping ON");
        else
            US_PrintCentered ("No clipping OFF");
        VW_UpdateScreen();
        IN_Ack ();
        return 1;
    }
    else if (Keyboard[sc_O])        // O = basic overhead
    {
        BasicOverhead();
        return 1;
    }
    /*else if(Keyboard[sc_P])         // P = Ripper's picture grabber
    {
        PictureGrabber();
        return 1;
    }	*/
    else if (Keyboard[sc_Q])        // Q = fast quit
        Quit (NULL);
    else if (Keyboard[sc_S])        // S = slow motion
    {
        CenterWindow(30,3);
        PrintY+=6;
        US_Print(" Slow Motion steps (default 14): ");
        VW_UpdateScreen();
        esc = !US_LineInput (px,py,str,NULL,true,2,0);
        if (!esc)
        {
            level = atoi (str);
            if (level>=0 && level<=50)
                singlestep = level;
        }
        return 1;
    }
    else if (Keyboard[sc_T])        // T = shape test
    {
        ShapeTest ();
        return 1;
    }
    else if (Keyboard[sc_V])        // V = extra VBLs
    {
        CenterWindow(30,3);
        PrintY+=6;
        US_Print("  Add how many extra VBLs(0-8): ");
        VW_UpdateScreen();
        esc = !US_LineInput (px,py,str,NULL,true,1,0);
        if (!esc)
        {
            level = atoi (str);
            if (level>=0 && level<=8)
                extravbls = level;
        }
        return 1;
    }
    else if (Keyboard[sc_W])        // W = warp to level
    {
        CenterWindow(26,3);
        PrintY+=6;
#ifndef SPEAR
        US_Print("  Warp to which level(1-10): ");
#else
        US_Print("  Warp to which level(1-21): ");
#endif
        VW_UpdateScreen();
        esc = !US_LineInput (px,py,str,NULL,true,2,0);
        if (!esc)
        {
            level = atoi (str);
#ifndef SPEAR
            if (level>0 && level<11)
#else
            if (level>0 && level<22)
#endif
            {
                gamestate.mapon = level-1;
                playstate = ex_warped;
            }
        }
        return 1;
    }
    else if (Keyboard[sc_X])        // X = item cheat
    {
        CenterWindow (12,3);
        US_PrintCentered ("Extra stuff!");
        VW_UpdateScreen();
        // DEBUG: put stuff here
        IN_Ack ();
        return 1;
    }
#ifdef USE_CLOUDSKY
    else if(Keyboard[sc_Z])
    {
        char defstr[15];

        CenterWindow(34,4);
        PrintY+=6;
        US_Print("  Recalculate sky with seek: ");
        int seekpx = px, seekpy = py;
        US_PrintUnsigned(curSky->seed);
        US_Print("\n  Use color map (0-");
        US_PrintUnsigned(numColorMaps - 1);
        US_Print("): ");
        int mappx = px, mappy = py;
        US_PrintUnsigned(curSky->colorMapIndex);
        VW_UpdateScreen();

        sprintf(defstr, "%u", curSky->seed);
        esc = !US_LineInput(seekpx, seekpy, str, defstr, true, 10, 0);
        if(esc) return 0;
        curSky->seed = (uint32_t) atoi(str);

        sprintf(defstr, "%u", curSky->colorMapIndex);
        esc = !US_LineInput(mappx, mappy, str, defstr, true, 10, 0);
        if(esc) return 0;
        uint32_t newInd = (uint32_t) atoi(str);
        if(newInd < (uint32_t) numColorMaps)
        {
            curSky->colorMapIndex = newInd;
            InitSky();
        }
        else
        {
            CenterWindow (18,3);
            US_PrintCentered ("Illegal color map!");
            VW_UpdateScreen();
            IN_Ack ();
        }
    }
#endif

    return 0;
}
コード例 #8
0
public func OnWeaponSelected(id weapon)
{
	// Two items for special objects.
	if (weapon == Firestone || weapon == Dynamite) GiveWeapon(weapon);
	return inherited(weapon, ...);
}
コード例 #9
0
ファイル: WL_PLAY.C プロジェクト: brycekahle/wolf3d
void CheckKeys (void)
{
	int		i;
	byte	scan;
	unsigned	temp;


	if (screenfaded || demoplayback)	// don't do anything with a faded screen
		return;

	scan = LastScan;


	#ifdef SPEAR
	//
	// SECRET CHEAT CODE: TAB-G-F10
	//
	if (Keyboard[sc_Tab] &&
		Keyboard[sc_G] &&
		Keyboard[sc_F10])
	{
		WindowH = 160;
		if (godmode)
		{
			Message ("God mode OFF");
			SD_PlaySound (NOBONUSSND);
		}
		else
		{
			Message ("God mode ON");
			SD_PlaySound (ENDBONUS2SND);
		}

		IN_Ack();
		godmode ^= 1;
		DrawAllPlayBorderSides ();
		IN_ClearKeysDown();
		return;
	}
	#endif


	//
	// SECRET CHEAT CODE: 'MLI'
	//
	if (Keyboard[sc_M] &&
		Keyboard[sc_L] &&
		Keyboard[sc_I])
	{
		gamestate.health = 100;
		gamestate.ammo = 99;
		gamestate.keys = 3;
		gamestate.score = 0;
		gamestate.TimeCount += 42000L;
		GiveWeapon (wp_chaingun);

		DrawWeapon();
		DrawHealth();
		DrawKeys();
		DrawAmmo();
		DrawScore();

		ClearMemory ();
		CA_CacheGrChunk (STARTFONT+1);
		ClearSplitVWB ();
		VW_ScreenToScreen (displayofs,bufferofs,80,160);

		Message(STR_CHEATER1"\n"
				STR_CHEATER2"\n\n"
				STR_CHEATER3"\n"
				STR_CHEATER4"\n"
				STR_CHEATER5);

		UNCACHEGRCHUNK(STARTFONT+1);
		PM_CheckMainMem ();
		IN_ClearKeysDown();
		IN_Ack();

		DrawAllPlayBorder ();
	}

	//
	// OPEN UP DEBUG KEYS
	//
#ifndef SPEAR
	if (Keyboard[sc_BackSpace] &&
		Keyboard[sc_LShift] &&
		Keyboard[sc_Alt] &&
		MS_CheckParm("goobers"))
#else
	if (Keyboard[sc_BackSpace] &&
		Keyboard[sc_LShift] &&
		Keyboard[sc_Alt] &&
		MS_CheckParm("debugmode"))
#endif
	{
	 ClearMemory ();
	 CA_CacheGrChunk (STARTFONT+1);
	 ClearSplitVWB ();
	 VW_ScreenToScreen (displayofs,bufferofs,80,160);

	 Message("Debugging keys are\nnow available!");
	 UNCACHEGRCHUNK(STARTFONT+1);
	 PM_CheckMainMem ();
	 IN_ClearKeysDown();
	 IN_Ack();

	 DrawAllPlayBorderSides ();
	 DebugOk=1;
	}

	//
	// TRYING THE KEEN CHEAT CODE!
	//
	if (Keyboard[sc_B] &&
		Keyboard[sc_A] &&
		Keyboard[sc_T])
	{
	 ClearMemory ();
	 CA_CacheGrChunk (STARTFONT+1);
	 ClearSplitVWB ();
	 VW_ScreenToScreen (displayofs,bufferofs,80,160);

	 Message("Commander Keen is also\n"
			 "available from Apogee, but\n"
			 "then, you already know\n"
			 "that - right, Cheatmeister?!");

	 UNCACHEGRCHUNK(STARTFONT+1);
	 PM_CheckMainMem ();
	 IN_ClearKeysDown();
	 IN_Ack();

	 DrawAllPlayBorder ();
	}

//
// pause key weirdness can't be checked as a scan code
//
	if (Paused)
	{
		bufferofs = displayofs;
		LatchDrawPic (20-4,80-2*8,PAUSEDPIC);
		SD_MusicOff();
		IN_Ack();
		IN_ClearKeysDown ();
		SD_MusicOn();
		Paused = False;
		//if (MousePresent) // PORT
		//	Mouse(MDelta);	// Clear accumulated mouse movement
		return;
	}


//
// F1-F7/ESC to enter control panel
//
	if (
#ifndef DEBCHECK
		scan == sc_F10 ||
#endif
		scan == sc_F9 ||
		scan == sc_F7 ||
		scan == sc_F8)			// pop up quit dialog
	{
		ClearMemory ();
		ClearSplitVWB ();
		VW_ScreenToScreen (displayofs,bufferofs,80,160);
		US_ControlPanel(scan);

		 DrawAllPlayBorderSides ();

		if (scan == sc_F9)
		  StartMusic ();

		PM_CheckMainMem ();
		SETFONTCOLOR(0,15);
		IN_ClearKeysDown();
		return;
	}

	if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape)
	{
		StopMusic ();
		ClearMemory ();
		VW_FadeOut ();

		US_ControlPanel(scan);

		SETFONTCOLOR(0,15);
		IN_ClearKeysDown();
		DrawPlayScreen ();
		if (!startgame && !loadedgame)
		{
			VW_FadeIn ();
			StartMusic ();
		}
		if (loadedgame)
			playstate = ex_abort;
		lasttimecount = TimeCount;
		//if (MousePresent) // PORT
		//	Mouse(MDelta);	// Clear accumulated mouse movement
		PM_CheckMainMem ();
		return;
	}

//
// TAB-? debug keys
//
	if (Keyboard[sc_Tab] && DebugOk)
	{
		CA_CacheGrChunk (STARTFONT);
		fontnumber=0;
		SETFONTCOLOR(0,15);
		DebugKeys();
		//if (MousePresent) // PORT
		//	Mouse(MDelta);	// Clear accumulated mouse movement
		lasttimecount = TimeCount;
		return;
	}

}
コード例 #10
0
void CCharacter::ClassSpawnAttributes()
{
	switch(GetClass())
	{
		case PLAYERCLASS_ENGINEER:
			m_pPlayer->m_InfectionTick = -1;
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			GiveWeapon(WEAPON_GUN, 10);
			GiveWeapon(WEAPON_RIFLE, 10);
			m_ActiveWeapon = WEAPON_RIFLE;
			if(!m_pPlayer->IsKownClass(PLAYERCLASS_ENGINEER))
			{
				GameServer()->SendBroadcast("You are a human: Engineer!", m_pPlayer->GetCID());
				GameServer()->SendChatTarget(m_pPlayer->GetCID(), "Tip: Build walls with your hammer!");
				m_pPlayer->m_knownClass[PLAYERCLASS_ENGINEER] = true;
			}
			break;
		case PLAYERCLASS_SOLDIER:
			m_pPlayer->m_InfectionTick = -1;
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			GiveWeapon(WEAPON_GUN, 10);
			GiveWeapon(WEAPON_GRENADE, 10);
			m_ActiveWeapon = WEAPON_GRENADE;
			
			if(!m_pPlayer->IsKownClass(PLAYERCLASS_SOLDIER))
			{
				GameServer()->SendBroadcast("You are a human: Soldier!", m_pPlayer->GetCID());
				GameServer()->SendChatTarget(m_pPlayer->GetCID(), "Tip: Build bombs with your hammer!");
				m_pPlayer->m_knownClass[PLAYERCLASS_SOLDIER] = true;
			}
			break;
		case PLAYERCLASS_MEDIC:
			m_pPlayer->m_InfectionTick = -1;
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			GiveWeapon(WEAPON_GUN, 10);
			GiveWeapon(WEAPON_SHOTGUN, 10);
			m_ActiveWeapon = WEAPON_SHOTGUN;
			
			if(!m_pPlayer->IsKownClass(PLAYERCLASS_MEDIC))
			{
				GameServer()->SendBroadcast("You are a human: Medic!", m_pPlayer->GetCID());
				GameServer()->SendChatTarget(m_pPlayer->GetCID(), "Tip: Cure infected humans!");
				m_pPlayer->m_knownClass[PLAYERCLASS_MEDIC] = true;
			}
			break;
		case PLAYERCLASS_NONE:
			m_pPlayer->m_InfectionTick = -1;
			m_Health = 10;
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			break;
		case PLAYERCLASS_ZOMBIE:
			m_Health = 10;
			m_Armor = 0;
			RemoveAllGun();
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			
			if(!m_pPlayer->IsKownClass(PLAYERCLASS_ZOMBIE))
			{   
				//normal zombie?
                GameServer()->SendBroadcast("You are a zombie: Normal!", m_pPlayer->GetCID());
				GameServer()->SendChatTarget(m_pPlayer->GetCID(), "Tip: Hit by hooking others!");
				m_pPlayer->m_knownClass[PLAYERCLASS_ZOMBIE] = true;
			}
			break;
		case PLAYERCLASS_BOOMER:
			m_Health = 10;
			m_Armor = 0;
			RemoveAllGun();
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			
			if(!m_pPlayer->IsKownClass(PLAYERCLASS_BOOMER))
			{
				GameServer()->SendBroadcast("You are a zombie: Boomer!", m_pPlayer->GetCID());
				GameServer()->SendChatTarget(m_pPlayer->GetCID(), "Tip: You can only do kamikaze attacks!");
				m_pPlayer->m_knownClass[PLAYERCLASS_BOOMER] = true;
			}
			break;
		case PLAYERCLASS_HUNTER:
			m_Health = 10;
			m_Armor = 0;
			RemoveAllGun();
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			
			if(!m_pPlayer->IsKownClass(PLAYERCLASS_HUNTER))
			{
				GameServer()->SendBroadcast("You are a zombie: Hunter!", m_pPlayer->GetCID());
				GameServer()->SendChatTarget(m_pPlayer->GetCID(), "Tip: You can jump three times!");
				m_pPlayer->m_knownClass[PLAYERCLASS_HUNTER] = true;
			}
			break;
		case PLAYERCLASS_WITCH:
			m_Health = 10;
			m_Armor = 10;
			RemoveAllGun();
			GiveWeapon(WEAPON_HAMMER, -1);
			m_ActiveWeapon = WEAPON_HAMMER;
			
			if(!m_pPlayer->IsKownClass(PLAYERCLASS_WITCH))
			{
				GameServer()->SendBroadcast("You are a... Witch!!", m_pPlayer->GetCID());
                GameServer()->SendChatTarget(m_pPlayer->GetCID(), "Tip: Zombies may spawn near you!");
				m_pPlayer->m_knownClass[PLAYERCLASS_WITCH] = true;
			}
			break;
	}
}
コード例 #11
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
}
コード例 #12
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");
	}
}
コード例 #13
0
ファイル: 3d_play.cpp プロジェクト: drhelius/bstone-ios
void CheckKeys (void)
{
	boolean one_eighty=false;
	Uint8	scan;
	static boolean Plus_KeyReleased;
	static boolean Minus_KeyReleased;
	static boolean I_KeyReleased;
	static boolean S_KeyReleased;

#if IN_DEVELOPMENT || BETA_TEST
//	if (DebugOk && (Keyboard[sc_p] || PP_step))
//		PicturePause ();
#endif


	if (screenfaded || demoplayback)	// don't do anything with a faded screen
		return;

	scan = LastScan;


#if IN_DEVELOPMENT
#ifdef ACTIVATE_TERMINAL
	if (Keyboard[sc_9] && Keyboard[sc_0])
		ActivateTerminal(true);
#endif
#endif

	//
	// SECRET CHEAT CODE: 'JAM'
	//

#if GAME_VERSION != SHAREWARE_VERSION
	if (Keyboard[sc_j] || Keyboard[sc_a] || Keyboard[sc_m])
	{
		if (jam_buff[sizeof(jam_buff_cmp)-1] != LastScan)
		{
			memcpy(jam_buff,jam_buff+1,sizeof(jam_buff_cmp)-1);
			jam_buff[sizeof(jam_buff_cmp)-1] = LastScan;
		}
	}
#endif

	CheckMusicToggle();

	if (gamestate.rpower)
	{
		if (in_is_binding_pressed(e_bi_radar_magnify))
		{
			if (Plus_KeyReleased && gamestate.rzoom<2)
			{
				UpdateRadarGuage();
				gamestate.rzoom++;
				Plus_KeyReleased=false;
			}
		}
		else
			Plus_KeyReleased=true;

		if (in_is_binding_pressed(e_bi_radar_minify))
		{
			if (Minus_KeyReleased && gamestate.rzoom)
			{
				UpdateRadarGuage();
				gamestate.rzoom--;
				Minus_KeyReleased=false;
			}
		}
		else
			Minus_KeyReleased=true;
	}

	if (in_is_binding_pressed(e_bi_sfx)) {
		if (S_KeyReleased)
		{
			if ((SoundMode != sdm_Off) || (DigiMode!=sds_Off))
			{
				if (SoundMode != sdm_Off)
				{
					SD_WaitSoundDone();
					SD_SetSoundMode(sdm_Off);
				}

				if (DigiMode!=sds_Off)
					SD_SetDigiDevice(sds_Off);

				memcpy((char *)&SoundOn[55],"OFF.",4);
			}
			else
			{
				ClearMemory();
				if (SoundBlasterPresent || AdLibPresent)
					SD_SetSoundMode(sdm_AdLib);
				else
					SD_SetSoundMode(sdm_Off);

				if (SoundBlasterPresent)
					SD_SetDigiDevice(sds_SoundBlaster);
				else
				if (SoundSourcePresent)
					SD_SetDigiDevice(sds_SoundSource);
				else
					SD_SetDigiDevice(sds_Off);

				CA_LoadAllSounds();

				memcpy((char *)&SoundOn[55],"ON. ",4);
			}

			DISPLAY_TIMED_MSG(SoundOn,MP_BONUS,MT_GENERAL);
			S_KeyReleased=false;
		}
	}
	else
		S_KeyReleased=true;

	if (Keyboard[sc_return])
	{
#if (GAME_VERSION != SHAREWARE_VERSION) || GEORGE_CHEAT
		char loop;

		if ((!memcmp(jam_buff,jam_buff_cmp,sizeof(jam_buff_cmp))))
		{
			jam_buff[0]=0;

			for (loop=0; loop<NUMKEYS; loop++)
				if (gamestate.numkeys[static_cast<int>(loop)] < MAXKEYS)
					gamestate.numkeys[static_cast<int>(loop)]=1;

			gamestate.health = 100;
			gamestate.ammo = MAX_AMMO;
			gamestate.rpower = MAX_RADAR_ENERGY;

			if (!DebugOk)
			{
				gamestate.score = 0;
				gamestate.nextextra = EXTRAPOINTS;
			}

			gamestate.TimeCount += 42000L;

			for (loop=0; loop<NUMWEAPONS-1; loop++)
				GiveWeapon(loop);

			DrawWeapon();
			DrawHealth();
			DrawKeys();
			DrawScore();
			DISPLAY_TIMED_MSG("\r\r     YOU CHEATER!",MP_INTERROGATE,MT_GENERAL);
			ForceUpdateStatusBar();

			ClearMemory ();
			ClearSplitVWB ();
			VW_ScreenToScreen (static_cast<Uint16>(displayofs),static_cast<Uint16>(bufferofs),80,160);

			Message("\n NOW you're jammin'!! \n");

			IN_ClearKeysDown();
			IN_Ack();

			CleanDrawPlayBorder();
		}
		else if (!in_use_modern_bindings)
#endif
			one_eighty=true;
	}

// Handle quick turning!
//
	if (!gamestate.turn_around)
	{
	// 90 degrees left
	//
		if (in_is_binding_pressed(e_bi_quick_left))
		{
			gamestate.turn_around = -90;
			gamestate.turn_angle = player->angle + 90;
			if (gamestate.turn_angle > 359)
				gamestate.turn_angle -= ANGLES;
		}

	// 180 degrees right
	//
		if (in_is_binding_pressed(e_bi_turn_around) || one_eighty)
		{
			gamestate.turn_around = 180;
			gamestate.turn_angle = player->angle + 180;
			if (gamestate.turn_angle > 359)
				gamestate.turn_angle -= ANGLES;
		}

	// 90 degrees right
	//
		if (in_is_binding_pressed(e_bi_quick_right))
		{
			gamestate.turn_around = 90;
			gamestate.turn_angle = player->angle - 90;
			if (gamestate.turn_angle < 0)
				gamestate.turn_angle += ANGLES;
		}
	}

//
// pause key weirdness can't be checked as a scan code
//
    if (in_is_binding_pressed(e_bi_pause)) {
        SD_MusicOff();
        fontnumber = 4;
        BMAmsg(PAUSED_MSG);
        IN_Ack();
        IN_ClearKeysDown();
        fontnumber = 2;
        RedrawStatusAreas();
        SD_MusicOn();
        Paused = false;
        ::in_clear_mouse_deltas();
        return;
    }

#if IN_DEVELOPMENT
	if (TestQuickSave)
	{
//   	TestQuickSave--;
		scan = sc_f8;
	}

	if (TestAutoMapper)
		PopupAutoMap();

#endif

    scan = sc_none;

    if (Keyboard[sc_escape])
        scan = sc_escape;
    else if (in_is_binding_pressed(e_bi_help))
        scan = sc_f1;
    if (in_is_binding_pressed(e_bi_save))
        scan = sc_f2;
    else if (in_is_binding_pressed(e_bi_load))
        scan = sc_f3;
    else if (in_is_binding_pressed(e_bi_sound))
        scan = sc_f4;
    else if (in_is_binding_pressed(e_bi_controls))
        scan = sc_f6;
    else if (in_is_binding_pressed(e_bi_end_game))
        scan = sc_f7;
    else if (in_is_binding_pressed(e_bi_quick_save))
        scan = sc_f8;
    else if (in_is_binding_pressed(e_bi_quick_load))
        scan = sc_f9;
    else if (in_is_binding_pressed(e_bi_quick_exit))
        scan = sc_f10;

    switch (scan) {
    case sc_f7:							// END GAME
    case sc_f10:						// QUIT TO DOS
        FinishPaletteShifts();
        ClearMemory();
        US_ControlPanel(scan);
        CleanDrawPlayBorder();
        return;

    case sc_f2:							// SAVE MISSION
    case sc_f8:							// QUICK SAVE
        // Make sure there's room to save...
        //
        ClearMemory();
        FinishPaletteShifts();
        if (!CheckDiskSpace(DISK_SPACE_NEEDED, CANT_SAVE_GAME_TXT, cds_id_print)) {
            CleanDrawPlayBorder();
            break;
        }

    case sc_f1:							// HELP
    case sc_f3:							// LOAD MISSION
    case sc_f4:							// SOUND MENU
    case sc_f5:							//	RESIZE VIEW
    case sc_f6:							// CONTROLS MENU
    case sc_f9:							// QUICK LOAD
    case sc_escape:					// MAIN MENU
        refresh_screen = true;
        if (scan < sc_f8)
            VW_FadeOut();
        StopMusic();
        ClearMemory();
        ClearSplitVWB();
        US_ControlPanel(scan);
        if (refresh_screen) {
            boolean old = loadedgame;

            loadedgame = false;
            DrawPlayScreen(false);
            loadedgame = old;
        }
        ClearMemory();
        if (!sqActive || !loadedgame)
            StartMusic(false);
        IN_ClearKeysDown();
        if (loadedgame) {
            PreloadGraphics();
            loadedgame = false;
            DrawPlayScreen(false);
        } else
            if (!refresh_screen)
                CleanDrawPlayBorder();
        if (!sqActive)
            StartMusic(false);
        return;
    }

    scan = sc_none;

	if (in_is_binding_pressed(e_bi_stats))
		PopupAutoMap();

  	if (Keyboard[sc_back_quote])
   {
      Keyboard[sc_back_quote] = 0;
   	TryDropPlasmaDetonator();
   }


	if ((DebugOk || gamestate.flags & GS_MUSIC_TEST) && (Keyboard[sc_backspace]))
	{
		Uint8 old_num=music_num;

		if (gamestate.flags & GS_MUSIC_TEST)
		{
			if (Keyboard[sc_left_arrow])
			{
				if (music_num)
					music_num--;
				Keyboard[sc_left_arrow]=false;
			}
			else
			if (Keyboard[sc_right_arrow])
			{
				if (music_num < LASTMUSIC-1)
					music_num++;
				Keyboard[sc_right_arrow]=false;
			}

			if (old_num != music_num)
			{
				ClearMemory();

                delete [] audiosegs[STARTMUSIC + old_num];
                audiosegs[STARTMUSIC + old_num] = NULL;

				StartMusic(false);
				DrawScore();
			}
		}

		if (old_num == music_num)
		{
			fontnumber=4;
			SETFONTCOLOR(0,15);
			if (DebugKeys())
         {
				CleanDrawPlayBorder();
         }

            ::in_clear_mouse_deltas();

			lasttimecount = TimeCount;
			return;
		}
	}

	if (in_is_binding_pressed(e_bi_attack_info))
	{
		if (I_KeyReleased)
		{
			gamestate.flags ^= GS_ATTACK_INFOAREA;
			if (gamestate.flags & GS_ATTACK_INFOAREA)
				DISPLAY_TIMED_MSG(attacker_info_enabled,MP_ATTACK_INFO,MT_GENERAL);
			else
				DISPLAY_TIMED_MSG(attacker_info_disabled,MP_ATTACK_INFO,MT_GENERAL);
			I_KeyReleased = false;
		}
	}
	else
		I_KeyReleased = true;


#ifdef CEILING_FLOOR_COLORS
	if (in_is_binding_pressed(e_bi_ceiling))
	{
		gamestate.flags ^= GS_DRAW_CEILING;
		in_reset_binding_state(e_bi_ceiling);
	}

	if (in_is_binding_pressed(e_bi_flooring))
	{
		ThreeDRefresh();
		ThreeDRefresh();

		gamestate.flags ^= GS_DRAW_FLOOR;

		in_reset_binding_state(e_bi_flooring);
#if DUAL_SWAP_FILES
		ChangeSwapFiles(true);
#endif
	}
#endif

	if (in_is_binding_pressed(e_bi_lightning))
	{
		in_reset_binding_state(e_bi_lightning);
		gamestate.flags ^= GS_LIGHTING;
	}
}