示例#1
0
文件: b_game.cpp 项目: rsrsps/gzdoom
void FCajunMaster::RemoveAllBots (bool fromlist)
{
    int i, j;

    for (i = 0; i < MAXPLAYERS; ++i)
    {
        if (players[i].Bot != NULL)
        {
            // If a player is looking through this bot's eyes, make him
            // look through his own eyes instead.
            for (j = 0; j < MAXPLAYERS; ++j)
            {
                if (i != j && playeringame[j] && players[j].Bot == NULL)
                {
                    if (players[j].camera == players[i].mo)
                    {
                        players[j].camera = players[j].mo;
                        if (j == consoleplayer)
                        {
                            StatusBar->AttachToPlayer (players + j);
                        }
                    }
                }
            }
            FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, players[i].mo, true, i, true);
            ClearPlayer (i, !fromlist);
        }
    }

    if (fromlist)
    {
        wanted_botnum = 0;
    }
    botnum = 0;
}
示例#2
0
文件: b_game.cpp 项目: rsrsps/gzdoom
bool FCajunMaster::DoAddBot (BYTE *info, botskill_t skill)
{
    int bnum;

    for (bnum = 0; bnum < MAXPLAYERS; bnum++)
    {
        if (!playeringame[bnum])
        {
            break;
        }
    }

    if (bnum == MAXPLAYERS)
    {
        Printf ("The maximum of %d players/bots has been reached\n", MAXPLAYERS);
        return false;
    }

    D_ReadUserInfoStrings (bnum, &info, false);

    if (!deathmatch && playerstarts[bnum].type == 0)
    {
        Printf ("%s tried to join, but there was no player %d start\n",
                players[bnum].userinfo.GetName(), bnum+1);
        ClearPlayer (bnum, false);	// Make the bot inactive again
        return false;
    }

    multiplayer = true; //Prevents cheating and so on; emulates real netgame (almost).
    players[bnum].Bot = new DBot;
    players[bnum].Bot->player = &players[bnum];
    players[bnum].Bot->skill = skill;
    playeringame[bnum] = true;
    players[bnum].mo = NULL;
    players[bnum].playerstate = PST_ENTER;

    if (teamplay)
        Printf ("%s joined the %s team\n", players[bnum].userinfo.GetName(), Teams[players[bnum].userinfo.GetTeam()].GetName());
    else
        Printf ("%s joined the game\n", players[bnum].userinfo.GetName());

    G_DoReborn (bnum, true);
    if (StatusBar != NULL)
    {
        StatusBar->MultiplayerChanged ();
    }

    return true;
}
int ProjectFrame::CloseProject(int query)
{
	if (theProject)
	{
		if (query && theProject->GetChange())
		{
			if (QuerySaveProject() < 0)
				return 0;
		}

		if (CloseAllEditors() == 0)
			return 0;
		StopPlayer();
		ClearPlayer();
		prjTree->RemoveAll();
		theProject->Release();
		theProject = 0;
	}
	return 1;
}
void FCajunMaster::DoAddBot (int bnum, char *info)
{
	BYTE *infob = (BYTE *)info;
	D_ReadUserInfoStrings (bnum, &infob, false);
	if (!deathmatch && playerstarts[bnum].type == 0)
	{
		Printf ("%s tried to join, but there was no player %d start\n",
			players[bnum].userinfo.netname, bnum+1);
		ClearPlayer (bnum, false);	// Make the bot inactive again
		if (botnum > 0)
		{
			botnum--;
		}
	}
	else
	{
		multiplayer = true; //Prevents cheating and so on; emulates real netgame (almost).
		players[bnum].isbot = true;
		playeringame[bnum] = true;
		players[bnum].mo = NULL;
		players[bnum].playerstate = PST_ENTER;
		botingame[bnum] = true;

		if (teamplay)
			Printf ("%s joined the %s team\n", players[bnum].userinfo.netname,Teams[players[bnum].userinfo.team].GetName ());
		else
			Printf ("%s joined the game\n", players[bnum].userinfo.netname);

		G_DoReborn (bnum, true);
		if (StatusBar != NULL)
		{
			StatusBar->MultiplayerChanged ();
		}
	}
	waitingforspawn[bnum] = false;
}