void TempoMap::setPause(int tick, qreal pause) { iTEvent e = find(tick); if (e != end()) e->second.pause = pause; else { qreal t = tempo(tick); insert(std::pair<const int, TEvent> (tick, TEvent(t, pause, TEMPO_FIX))); } normalize(); }
void TempoMap::setTempo(int tick, qreal tempo) { iTEvent e = find(tick); if (e != end()) { e->second.tempo = tempo; e->second.type = TEMPO_FIX; } else insert(std::pair<const int, TEvent> (tick, TEvent(tempo, 0.0, TEMPO_FIX))); normalize(); }
bool CEvents::LoadEventList () { CSPList list(256); if (!list.Load (param.common_course_dir, "events.lst")) { Message ("could not load events.lst"); return false; } // pass 1: races for (size_t i=0; i<list.Count(); i++) { const string& line = list.Line(i); int type = SPIntN (line, "struct", -1); if (type == 0) { RaceList.push_back(TRace( Course.GetCourse(SPStrN(line, "course")), Env.GetLightIdx(SPStrN(line, "light")), SPIntN(line, "snow", 0), SPIntN(line, "wind", 0), SPVector3i(line, "herring"), SPVector3d(line, "time"), Music.GetThemeIdx(SPStrN(line, "theme", "normal")))); } } list.MakeIndex (RaceIndex, "race"); // pass 2: cups for (size_t i=0; i<list.Count(); i++) { const string& line = list.Line(i); int type = SPIntN (line, "struct", -1); if (type == 1) { CupList.push_back(TCup( SPStrN(line, "cup", errorString), SPStrN(line, "name", "unknown"), SPStrN(line, "desc", "unknown"))); int num = SPIntN (line, "num", 0); CupList.back().races.resize(num); for (int ii=0; ii<num; ii++) { string race = SPStrN (line, Int_StrN (ii+1)); CupList.back().races[ii] = &RaceList[GetRaceIdx(race)]; } } } list.MakeIndex (CupIndex, "cup"); // pass 3: events for (size_t i=0; i<list.Count(); i++) { const string& line = list.Line(i); int type = SPIntN (line, "struct", -1); if (type == 2) { EventList.push_back(TEvent(SPStrN(line, "name", "unknown"))); int num = SPIntN (line, "num", 0); EventList.back().cups.resize(num); for (int ii=0; ii<num; ii++) { string cup = SPStrN (line, Int_StrN (ii+1)); EventList.back().cups[ii] = &CupList[GetCupIdx(cup)]; } } } list.MakeIndex (EventIndex, "event"); return true; }