void BiquadLowShelf::SetupFast ( Float32 normFreq, Float32 dB, Float32 shelfSlope ){ Float32 A = pow( 10, dB/40 ); Float32 w0 = 2 * M_PI * normFreq; Float32 sn, cs; fastsincos( w0, &sn, &cs ); Float32 al = sn / 2 * fastsqrt1( (A + 1/A) * (1/shelfSlope - 1) + 2 ); Float32 sa = 2 * fastsqrt1( A ) * al; SetupCommon( cs, A, sa ); }
void BiquadLowShelf::Setup ( Float32 normFreq, Float32 dB, Float32 shelfSlope ){ Float32 A = pow( 10, dB/40 ); Float32 w0 = 2 * M_PI * normFreq; Float32 cs = cos(w0); Float32 sn = sin(w0); Float32 al = sn / 2 * ::sqrt( (A + 1/A) * (1/shelfSlope - 1) + 2 ); Float32 sa = 2 * ::sqrt( A ) * al; SetupCommon( cs, A, sa ); }
void Game_Map::Setup(int _id) { SetupCommon(_id); for (size_t i = 0; i < map->events.size(); ++i) { events.insert(std::make_pair(map->events[i].ID, EASYRPG_MAKE_SHARED<Game_Event>(location.map_id, map->events[i]))); } for (size_t i = 0; i < Data::commonevents.size(); ++i) { common_events.insert(std::make_pair(Data::commonevents[i].ID, EASYRPG_MAKE_SHARED<Game_CommonEvent>(Data::commonevents[i].ID))); } location.pan_finish_x = 0; location.pan_finish_y = 0; location.pan_current_x = 0; location.pan_current_y = 0; }
void Game_Map::SetupFromSave() { SetupCommon(location.map_id, true); // Make main interpreter "busy" if save contained events to prevent auto-events from starting interpreter->SetupFromSave(Main_Data::game_data.events.commands); events.reserve(map->events.size()); for (size_t i = 0; i < map->events.size(); ++i) { if (i < map_info.events.size()) { events.emplace_back(location.map_id, map->events[i], map_info.events[i]); } else { events.emplace_back(location.map_id, map->events[i]); } if (events.back().IsMoveRouteOverwritten()) pending.push_back(&events.back()); } for (size_t i = 0; i < Main_Data::game_data.common_events.size() && i < common_events.size(); ++i) { common_events[i].SetSaveData(Main_Data::game_data.common_events[i].event_data); } for (size_t i = 0; i < 3; i++) if (vehicles[i]->IsMoveRouteOverwritten()) pending.push_back(vehicles[i].get()); map_info.Fixup(GetMap()); map_info.Fixup(GetMapInfo()); SetChipset(map_info.chipset_id); SetEncounterSteps(location.encounter_steps); // We want to support loading rm2k3e panning chunks // but also not break other saves which don't have them. // To solve this problem, we reuse the scrolling methods // which always reset the position anyways when scroll_horz/vert // is false. // This produces compatible behavior for old RPG_RT saves, namely // the pan_x/y is always forced to 0. // If the later async code will load panorama, set the flag to not clear the offsets. Game_Map::Parallax::ChangeBG(GetParallaxParams()); }
void Game_Map::SetupFromSave() { SetupCommon(location.map_id); for (size_t i = 0; i < map->events.size(); ++i) { EASYRPG_SHARED_PTR<Game_Event> evnt; if (i < map_info.events.size()) { evnt = EASYRPG_MAKE_SHARED<Game_Event>(location.map_id, map->events[i], map_info.events[i]); } else { evnt = EASYRPG_MAKE_SHARED<Game_Event>(location.map_id, map->events[i]); } events.insert(std::make_pair(map->events[i].ID, evnt)); } for (size_t i = 0; i < Data::commonevents.size(); ++i) { EASYRPG_SHARED_PTR<Game_CommonEvent> evnt; if (i < Main_Data::game_data.common_events.size()) { evnt = EASYRPG_MAKE_SHARED<Game_CommonEvent>(Data::commonevents[i].ID, false, Main_Data::game_data.common_events[i]); } else { evnt = EASYRPG_MAKE_SHARED<Game_CommonEvent>(Data::commonevents[i].ID, false); } common_events.insert(std::make_pair(Data::commonevents[i].ID, evnt)); } static_cast<Game_Interpreter_Map*>(interpreter.get())->SetupFromSave(Main_Data::game_data.events.events, 0); map_info.Fixup(*map.get()); // FIXME: Handle Pan correctly location.pan_current_x = 0; location.pan_current_y = 0; location.pan_finish_x = 0; location.pan_finish_y = 0; ready = true; }
void Game_Map::Setup(int _id) { Dispose(); first_frame = true; SetupCommon(_id, false); map_info.encounter_rate = GetMapInfo().encounter_steps; SetEncounterSteps(0); reset_panorama_x_on_next_init = true; reset_panorama_y_on_next_init = true; panorama = {}; Parallax::ClearChangedBG(); SetChipset(map->chipset_id); for (size_t i = 0; i < map_info.lower_tiles.size(); i++) { map_info.lower_tiles[i] = i; } for (size_t i = 0; i < map_info.upper_tiles.size(); i++) { map_info.upper_tiles[i] = i; } events.reserve(map->events.size()); for (const RPG::Event& ev : map->events) { events.emplace_back(location.map_id, ev); } // pan_state does not reset when you change maps. location.pan_speed = default_pan_speed; location.pan_finish_x = default_pan_x; location.pan_finish_y = default_pan_y; location.pan_current_x = default_pan_x; location.pan_current_y = default_pan_y; // Save allowed int current_index = GetMapIndex(location.map_id); int can_save = Data::treemap.maps[current_index].save; int can_escape = Data::treemap.maps[current_index].escape; int can_teleport = Data::treemap.maps[current_index].teleport; while (can_save == RPG::MapInfo::TriState_parent || can_escape == RPG::MapInfo::TriState_parent || can_teleport == RPG::MapInfo::TriState_parent) { int parent_index = GetMapIndex(Data::treemap.maps[current_index].parent_map); if (parent_index == 0) { // If parent is 0 and flag is parent, it's implicitly enabled. break; } if (parent_index == current_index) { Output::Warning("Map %d has parent pointing to itself!", current_index); break; } if (parent_index < 0) { Output::Warning("Map %d has invalid parent id %d!", Data::treemap.maps[current_index].parent_map); break; } current_index = parent_index; if (can_save == RPG::MapInfo::TriState_parent) { can_save = Data::treemap.maps[current_index].save; } if (can_escape == RPG::MapInfo::TriState_parent) { can_escape = Data::treemap.maps[current_index].escape; } if (can_teleport == RPG::MapInfo::TriState_parent) { can_teleport = Data::treemap.maps[current_index].teleport; } } Game_System::SetAllowSave(can_save != RPG::MapInfo::TriState_forbid); Game_System::SetAllowEscape(can_escape != RPG::MapInfo::TriState_forbid); Game_System::SetAllowTeleport(can_teleport != RPG::MapInfo::TriState_forbid); }