Esempio n. 1
0
static void Cmd_Chase_f(edict_t *ent)
{
    edict_t *target = NULL;
    chase_mode_t mode = CHASE_NONE;

    if (gi.argc() == 2) {
        char *who = gi.argv(1);

        if (!Q_stricmp(who, "quad")) {
            mode = CHASE_QUAD;
        } else if (!Q_stricmp(who, "inv") ||
                   !Q_stricmp(who, "pent")) {
            mode = CHASE_INVU;
        } else if (!Q_stricmp(who, "top") ||
                   !Q_stricmp(who, "topfragger") ||
                   !Q_stricmp(who, "leader")) {
            mode = CHASE_LEADER;
        } else {
            target = G_SetPlayer(ent, 1);
            if (!target) {
                return;
            }
            if (!PlayerSpawned(target)) {
                gi.cprintf(ent, PRINT_HIGH,
                           "Player '%s' is not in the game.\n",
                           target->client->pers.netname);
                return;
            }
        }
    }

    if (!become_spectator(ent)) {
        return;
    }

    if (target) {
        if (target == ent->client->chase_target) {
            gi.cprintf(ent, PRINT_HIGH,
                       "You are already chasing this player.\n");
            return;
        }
        SetChaseTarget(ent, target);
        ent->client->chase_mode = CHASE_NONE;
    } else {
        if (!ent->client->chase_target || mode != CHASE_NONE) {
            GetChaseTarget(ent, mode);
        } else {
            SetChaseTarget(ent, NULL);
        }
    }
}
Esempio n. 2
0
static void select_test(edict_t *ent)
{
    switch (ent->client->menu.cur) {
    case 3:
        if (ent->client->pers.connected == CONN_SPAWNED) {
            if (G_SpecRateLimited(ent)) {
                break;
            }
            spectator_respawn(ent, CONN_SPECTATOR);
            break;
        }
        if (ent->client->pers.connected != CONN_PREGAME) {
            if (G_SpecRateLimited(ent)) {
                break;
            }
        }
        spectator_respawn(ent, CONN_SPAWNED);
        break;
    case 5:
        if (become_spectator(ent)) {
            if (ent->client->chase_target) {
                SetChaseTarget(ent, NULL);
            }
            PMenu_Close(ent);
        }
        break;
    case 6:
        if (become_spectator(ent)) {
            if (!ent->client->chase_target) {
                GetChaseTarget(ent, CHASE_NONE);
            }
            PMenu_Close(ent);
        }
        break;
    case 7:
        if (become_spectator(ent)) {
            GetChaseTarget(ent, CHASE_LEADER);
            PMenu_Close(ent);
        }
        break;
    case 8:
        if (become_spectator(ent)) {
            GetChaseTarget(ent, CHASE_QUAD);
            PMenu_Close(ent);
        }
        break;
    case 9:
        if (become_spectator(ent)) {
            GetChaseTarget(ent, CHASE_INVU);
            PMenu_Close(ent);
        }
        break;
    case 11:
        PMenu_Close(ent);
        break;
    }
}
Esempio n. 3
0
void Small::BigDetect()
{
	if (TeamID != RED)
	{
		for (int i = 0; i < RedList->size(); i++)
		{
			XMVECTOR tempvector = {XMVectorGetX(RedList->at(i)->Location), XMVectorGetY(RedList->at(i)->Location), 0, 0};
			XMVECTOR tempdifference = Location - tempvector;

			if (XMVectorGetX(XMVector2Length(tempdifference)) < 40)
			{
				SetChaseTarget(RedList->at(i));
				TeamID = Target->TeamID;
				Chasing = true;
				Flocking = true;
			}
		}
	}

	if (TeamID != BLUE)
	{
		for (int i = 0; i < BlueList->size(); i++)
		{
			XMVECTOR tempvector = {XMVectorGetX(BlueList->at(i)->Location), XMVectorGetY(BlueList->at(i)->Location), 0, 0};
			XMVECTOR tempdifference = Location - tempvector;

			if (XMVectorGetX(XMVector2Length(tempdifference)) < 40)
			{
				SetChaseTarget(BlueList->at(i));
				TeamID = Target->TeamID;
				Chasing = true;
				Flocking = true;
			}
		}
	}
}