Esempio n. 1
0
static void SetupQuickPlayEnemies(
	Mission *mission, const int numEnemies, CharacterStore *store)
{
	int i;
	for (i = 0; i < numEnemies; i++)
	{
		const GunDescription *gun;
		CArrayPushBack(&mission->Enemies, &i);

		for (;;)
		{
			gun = CArrayGet(
				&gGunDescriptions.Guns,
				rand() % (int)gGunDescriptions.Guns.size);
			if (!gun->IsRealGun)
			{
				continue;
			}
			// make at least one of each type of enemy:
			// - Short range weapon
			// - Long range weapon
			// - High explosive weapon
			if (i == 0 && !IsShortRange(gun))
			{
				continue;
			}
			if (i == 1 && !IsLongRange(gun))
			{
				continue;
			}
			if (i == 2 &&
				ConfigGetBool(&gConfig, "QuickPlay.EnemiesWithExplosives") &&
				!IsHighDPS(gun))
			{
				continue;
			}

			if (!ConfigGetBool(&gConfig, "QuickPlay.EnemiesWithExplosives") &&
				IsHighDPS(gun))
			{
				continue;
			}
			break;
		}
		Character *ch = CharacterStoreAddOther(store);
		SetupQuickPlayEnemy(ch, gun);
	}
}
Esempio n. 2
0
void SetupQuickPlayEnemy(TBadGuy *enemy, gun_e gun)
{
	enemy->armedBodyPic = BODY_ARMED;
	enemy->unarmedBodyPic = BODY_UNARMED;
	enemy->facePic = rand() % FACE_COUNT;
	enemy->gun = gun;
	if (IsShortRange(enemy->gun))
	{
		enemy->speed = 256 + (rand() % (384 - 256 + 1));
	}
	else
	{
		enemy->speed = 128 + (rand() % (256 - 128 + 1));
	}
	if (IsShortRange(enemy->gun))
	{
		enemy->probabilityToMove = 50 + (rand() % 50);
	}
	else
	{
		enemy->probabilityToMove = 25 + (rand() % 75);
	}
	enemy->probabilityToTrack = 25 + (rand() % 75);
	if (enemy->gun == GUN_KNIFE)
	{
		enemy->probabilityToShoot = 0;
	}
	else if (IsHighDPS(enemy->gun))
	{
		enemy->probabilityToShoot = 10 + (rand() % 10);
	}
	else
	{
		enemy->probabilityToShoot = 25 + (rand() % 75);
	}
	enemy->actionDelay = rand() % (50 + 1);
	enemy->skinColor = rand() % SHADE_COUNT;
	enemy->armColor = rand() % SHADE_COUNT;
	enemy->bodyColor = rand() % SHADE_COUNT;
	enemy->legColor = rand() % SHADE_COUNT;
	enemy->hairColor = rand() % SHADE_COUNT;
	enemy->health = 10 + (rand() % (100 - 10 + 1));
	enemy->flags = 0;
}
Esempio n. 3
0
static void SetupQuickPlayEnemy(Character *enemy, const GunDescription *gun)
{
	CharacterShuffleAppearance(enemy);
	enemy->Gun = gun;
	enemy->speed =GenerateQuickPlayParam(
		ConfigGetEnum(&gConfig, "QuickPlay.EnemySpeed"), 64, 112, 160, 256);
	if (IsShortRange(enemy->Gun))
	{
		enemy->speed = enemy->speed * 4 / 3;
	}
	if (IsShortRange(enemy->Gun))
	{
		enemy->bot->probabilityToMove = 35 + (rand() % 35);
	}
	else
	{
		enemy->bot->probabilityToMove = 30 + (rand() % 30);
	}
	enemy->bot->probabilityToTrack = 10 + (rand() % 60);
	if (!enemy->Gun->CanShoot)
	{
		enemy->bot->probabilityToShoot = 0;
	}
	else if (IsHighDPS(enemy->Gun))
	{
		enemy->bot->probabilityToShoot = 1 + (rand() % 3);
	}
	else
	{
		enemy->bot->probabilityToShoot = 1 + (rand() % 6);
	}
	enemy->bot->actionDelay = rand() % (50 + 1);
	enemy->maxHealth = GenerateQuickPlayParam(
		ConfigGetEnum(&gConfig, "QuickPlay.EnemyHealth"), 10, 20, 40, 60);
	enemy->flags = 0;
}
Esempio n. 4
0
void SetupQuickPlayCampaign(CampaignSetting *setting)
{
	int i;
	gun_e gun;
	strcpy(gQuickPlayMission.title, "");
	strcpy(gQuickPlayMission.description, "");
	gQuickPlayMission.wallStyle = rand() % WALL_STYLE_COUNT;
	gQuickPlayMission.floorStyle = rand() % FLOOR_STYLE_COUNT;
	gQuickPlayMission.roomStyle = rand() % FLOOR_STYLE_COUNT;
	gQuickPlayMission.exitStyle = rand() % EXIT_COUNT;
	gQuickPlayMission.keyStyle = rand() % KEYSTYLE_COUNT;
	gQuickPlayMission.doorStyle = rand() % DOORSTYLE_COUNT;
	gQuickPlayMission.mapWidth = 16 + (rand() % (64 - 16 + 1));
	gQuickPlayMission.mapHeight = 16 + (rand() % (64 - 16 + 1));
	gQuickPlayMission.wallCount = rand() % (200 + 1);
	gQuickPlayMission.wallLength = 1 + (rand() % (200 - 1 + 1));
	gQuickPlayMission.roomCount = rand() % (100 + 1);
	gQuickPlayMission.squareCount = rand() % (100 + 1);
	gQuickPlayMission.exitLeft = 0;
	gQuickPlayMission.exitTop = 0;
	gQuickPlayMission.exitRight = 0;
	gQuickPlayMission.exitBottom = 0;
	gQuickPlayMission.objectiveCount = 0;
	gQuickPlayMission.baddieCount = 3 + (rand() % (BADDIE_MAX - 3));

	// make at least one of each type of enemy:
	// - Short range weapon
	// - Long range weapon
	// - High explosive weapon
	gQuickPlayMission.baddies[0] = 0;
	do
	{
		gun = rand() % GUN_COUNT;
	} while (!IsShortRange(gun));
	SetupQuickPlayEnemy(&gQuickPlayEnemies[0], gun);

	gQuickPlayMission.baddies[1] = 1;
	do
	{
		gun = rand() % GUN_COUNT;
	} while (!IsLongRange(gun));
	SetupQuickPlayEnemy(&gQuickPlayEnemies[1], gun);

	gQuickPlayMission.baddies[2] = 2;
	do
	{
		gun = rand() % GUN_COUNT;
	} while (!IsHighDPS(gun));
	SetupQuickPlayEnemy(&gQuickPlayEnemies[2], gun);

	for (i = 3; i < gQuickPlayMission.baddieCount; i++)
	{
		gQuickPlayMission.baddies[i] = i;
		SetupQuickPlayEnemy(&gQuickPlayEnemies[i], rand() % GUN_COUNT);
	}
	gQuickPlayMission.specialCount = 0;
	gQuickPlayMission.itemCount = rand() % (ITEMS_MAX + 1);
	for (i = 0; i < gQuickPlayMission.itemCount; i++)
	{
		gQuickPlayMission.items[i] = i;
		gQuickPlayMission.itemDensity[i] = rand() % 32;
	}
	gQuickPlayMission.baddieDensity =
		(40 + (rand() % 20)) / gQuickPlayMission.baddieCount;
	gQuickPlayMission.weaponSelection = 0;
	strcpy(gQuickPlayMission.song, "");
	strcpy(gQuickPlayMission.map, "");
	gQuickPlayMission.wallRange = rand() % (COLORRANGE_COUNT - 1 + 1);
	gQuickPlayMission.floorRange = rand() % (COLORRANGE_COUNT - 1 + 1);
	gQuickPlayMission.roomRange = rand() % (COLORRANGE_COUNT - 1 + 1);
	gQuickPlayMission.altRange = rand() % (COLORRANGE_COUNT - 1 + 1);

	strcpy(setting->title, "Quick play");
	strcpy(setting->author, "");
	strcpy(setting->description, "");
	setting->missionCount = 1;
	setting->missions = &gQuickPlayMission;
	setting->characterCount = BADDIE_MAX;
	setting->characters = gQuickPlayEnemies;
}