void GrafxMakeRandomBackground( GraphicsDevice *device, CampaignOptions *co, struct MissionOptions *mo, Map *map) { HSV tint; CampaignSettingInit(&co->Setting); ActorsInit(); ObjsInit(); MobObjsInit(); SetupQuickPlayCampaign(&co->Setting, &gConfig.QuickPlay); co->seed = rand(); tint.h = rand() * 360.0 / RAND_MAX; tint.s = rand() * 1.0 / RAND_MAX; tint.v = 0.5; DrawBuffer buffer; DrawBufferInit(&buffer, Vec2iNew(X_TILES, Y_TILES), device); co->MissionIndex = 0; GrafxMakeBackground( device, &buffer, co, mo, map, tint, 0, 1, Vec2iCenterOfTile(Vec2iScaleDiv(map->Size, 2)), NULL); DrawBufferTerminate(&buffer); ActorsTerminate(); ObjsTerminate(); MobObjsTerminate(); RemoveAllWatches(); MissionOptionsTerminate(mo); CampaignSettingTerminate(&co->Setting); co->seed = gConfig.Game.RandomSeed; }
void MissionOptionsTerminate(struct MissionOptions *mo) { ActorsTerminate(); ObjsTerminate(); MobObjsTerminate(); PickupsTerminate(); ParticlesTerminate(&gParticles); WatchesTerminate(); CA_FOREACH(PlayerData, p, gPlayerDatas) p->ActorUID = -1; CA_FOREACH_END() gMission.HasStarted = false; gMission.HasBegun = false; CArrayTerminate(&mo->Weapons); memset(mo, 0, sizeof *mo); }