Merge pull request #3232 from STK-helper/MiniMap
Increase minimap size and reduce its aliasing
This commit is contained in:
commit
85eb59c6af
@ -122,6 +122,13 @@
|
|||||||
<replay max-time="600" delta-t="0.05" delta-pos="0.1"
|
<replay max-time="600" delta-t="0.05" delta-pos="0.1"
|
||||||
delta-angle="0.5" />
|
delta-angle="0.5" />
|
||||||
|
|
||||||
|
<!-- Determines the minimap related values.
|
||||||
|
size: The size of the minimap (scaled afterwards) 480 = full screen height)
|
||||||
|
ai-icon: The size of the icons for the AI karts on the minimap.
|
||||||
|
player-icon: The size of the icons for the player karts. -->
|
||||||
|
|
||||||
|
<minimap size="180.0" ai-icon="16.0" player-icon="20.0"/>
|
||||||
|
|
||||||
<!-- Skidmark data: maximum number of skid marks, and
|
<!-- Skidmark data: maximum number of skid marks, and
|
||||||
time for skidmarks to fade out. Maximum number will over
|
time for skidmarks to fade out. Maximum number will over
|
||||||
current number of karts, so the more karts, the less
|
current number of karts, so the more karts, the less
|
||||||
|
@ -154,6 +154,9 @@ void STKConfig::load(const std::string &filename)
|
|||||||
CHECK_NEG(m_replay_delta_angle, "replay delta-angle" );
|
CHECK_NEG(m_replay_delta_angle, "replay delta-angle" );
|
||||||
CHECK_NEG(m_replay_delta_pos2, "replay delta-position" );
|
CHECK_NEG(m_replay_delta_pos2, "replay delta-position" );
|
||||||
CHECK_NEG(m_replay_dt, "replay delta-t" );
|
CHECK_NEG(m_replay_dt, "replay delta-t" );
|
||||||
|
CHECK_NEG(m_minimap_size, "minimap size" );
|
||||||
|
CHECK_NEG(m_minimap_ai_icon, "minimap ai_icon" );
|
||||||
|
CHECK_NEG(m_minimap_player_icon, "minimap player_icon" );
|
||||||
CHECK_NEG(m_smooth_angle_limit, "physics smooth-angle-limit" );
|
CHECK_NEG(m_smooth_angle_limit, "physics smooth-angle-limit" );
|
||||||
CHECK_NEG(m_default_track_friction, "physics default-track-friction");
|
CHECK_NEG(m_default_track_friction, "physics default-track-friction");
|
||||||
CHECK_NEG(m_physics_fps, "physics fps" );
|
CHECK_NEG(m_physics_fps, "physics fps" );
|
||||||
@ -196,6 +199,9 @@ void STKConfig::init_defaults()
|
|||||||
m_replay_delta_angle = -100;
|
m_replay_delta_angle = -100;
|
||||||
m_replay_delta_pos2 = -100;
|
m_replay_delta_pos2 = -100;
|
||||||
m_replay_dt = -100;
|
m_replay_dt = -100;
|
||||||
|
m_minimap_size = -100;
|
||||||
|
m_minimap_ai_icon = -100;
|
||||||
|
m_minimap_player_icon = -100;
|
||||||
m_network_state_frequeny = -100;
|
m_network_state_frequeny = -100;
|
||||||
m_title_music = NULL;
|
m_title_music = NULL;
|
||||||
m_smooth_normals = false;
|
m_smooth_normals = false;
|
||||||
@ -406,6 +412,13 @@ void STKConfig::getAllData(const XMLNode * root)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(const XMLNode *replay_node = root->getNode("minimap"))
|
||||||
|
{
|
||||||
|
replay_node->get("size", &m_minimap_size );
|
||||||
|
replay_node->get("ai-icon", &m_minimap_ai_icon );
|
||||||
|
replay_node->get("player-icon", &m_minimap_player_icon );
|
||||||
|
}
|
||||||
|
|
||||||
if (const XMLNode *fonts_list = root->getNode("fonts-list"))
|
if (const XMLNode *fonts_list = root->getNode("fonts-list"))
|
||||||
{
|
{
|
||||||
fonts_list->get("normal-ttf", &m_normal_ttf);
|
fonts_list->get("normal-ttf", &m_normal_ttf);
|
||||||
|
@ -163,6 +163,13 @@ public:
|
|||||||
* be generated. */
|
* be generated. */
|
||||||
float m_replay_delta_angle;
|
float m_replay_delta_angle;
|
||||||
|
|
||||||
|
/** The minimap size */
|
||||||
|
float m_minimap_size;
|
||||||
|
|
||||||
|
/* The size of icons for AIs and human players, respectively */
|
||||||
|
float m_minimap_ai_icon;
|
||||||
|
float m_minimap_player_icon;
|
||||||
|
|
||||||
/** The field of view for 1, 2, 3, 4 player split screen. */
|
/** The field of view for 1, 2, 3, 4 player split screen. */
|
||||||
float m_camera_fov[MAX_PLAYER_COUNT];
|
float m_camera_fov[MAX_PLAYER_COUNT];
|
||||||
|
|
||||||
|
@ -82,9 +82,29 @@ RaceGUI::RaceGUI()
|
|||||||
else
|
else
|
||||||
m_lap_width = font->getDimension(L"9/9").Width;
|
m_lap_width = font->getDimension(L"9/9").Width;
|
||||||
|
|
||||||
|
float map_size_splitscreen = 1.0f;
|
||||||
|
|
||||||
|
// If there are four players or more in splitscreen
|
||||||
|
// and the map is in a player view, scale down the map
|
||||||
|
if (race_manager->getNumLocalPlayers() >= 4 && !race_manager->getIfEmptyScreenSpaceExists())
|
||||||
|
{
|
||||||
|
// If the resolution is wider than 4:3, we don't have to scaledown the minimap as much
|
||||||
|
// Uses some margin, in case the game's screen is not exactly 4:3
|
||||||
|
if ( ((float) irr_driver->getFrameSize().Width / (float) irr_driver->getFrameSize().Height) >
|
||||||
|
(4.1f/3.0f))
|
||||||
|
{
|
||||||
|
if (race_manager->getNumLocalPlayers() == 4)
|
||||||
|
map_size_splitscreen = 0.75f;
|
||||||
|
else
|
||||||
|
map_size_splitscreen = 0.5f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
map_size_splitscreen = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
// Originally m_map_height was 100, and we take 480 as minimum res
|
// Originally m_map_height was 100, and we take 480 as minimum res
|
||||||
float scaling = irr_driver->getFrameSize().Height / 480.0f;
|
float scaling = irr_driver->getFrameSize().Height / 480.0f;
|
||||||
const float map_size = 100.0f;
|
const float map_size = stk_config->m_minimap_size * map_size_splitscreen;
|
||||||
const float top_margin = 3.5f * m_font_height;
|
const float top_margin = 3.5f * m_font_height;
|
||||||
|
|
||||||
if (UserConfigParams::m_multitouch_enabled &&
|
if (UserConfigParams::m_multitouch_enabled &&
|
||||||
@ -107,8 +127,8 @@ RaceGUI::RaceGUI()
|
|||||||
|
|
||||||
// Marker texture has to be power-of-two for (old) OpenGL compliance
|
// Marker texture has to be power-of-two for (old) OpenGL compliance
|
||||||
//m_marker_rendered_size = 2 << ((int) ceil(1.0 + log(32.0 * scaling)));
|
//m_marker_rendered_size = 2 << ((int) ceil(1.0 + log(32.0 * scaling)));
|
||||||
m_minimap_ai_size = (int)( 14.0f * scaling);
|
m_minimap_ai_size = (int)( stk_config->m_minimap_ai_icon * scaling);
|
||||||
m_minimap_player_size = (int)( 16.0f * scaling);
|
m_minimap_player_size = (int)( stk_config->m_minimap_player_icon * scaling);
|
||||||
m_map_width = (int)(map_size * scaling);
|
m_map_width = (int)(map_size * scaling);
|
||||||
m_map_height = (int)(map_size * scaling);
|
m_map_height = (int)(map_size * scaling);
|
||||||
m_map_left = (int)( 10.0f * scaling);
|
m_map_left = (int)( 10.0f * scaling);
|
||||||
@ -209,6 +229,9 @@ void RaceGUI::renderGlobal(float dt)
|
|||||||
if(world->getPhase() == World::GOAL_PHASE)
|
if(world->getPhase() == World::GOAL_PHASE)
|
||||||
drawGlobalGoal();
|
drawGlobalGoal();
|
||||||
|
|
||||||
|
// MiniMap is drawn when the players wait for the start countdown to end
|
||||||
|
drawGlobalMiniMap();
|
||||||
|
|
||||||
// Timer etc. are not displayed unless the game is actually started.
|
// Timer etc. are not displayed unless the game is actually started.
|
||||||
if(!world->isRacePhase()) return;
|
if(!world->isRacePhase()) return;
|
||||||
if (!m_enabled) return;
|
if (!m_enabled) return;
|
||||||
@ -227,8 +250,6 @@ void RaceGUI::renderGlobal(float dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawGlobalMiniMap();
|
|
||||||
|
|
||||||
if (!m_is_tutorial) drawGlobalPlayerIcons(m_map_height);
|
if (!m_is_tutorial) drawGlobalPlayerIcons(m_map_height);
|
||||||
if(Track::getCurrentTrack()->isSoccer()) drawScores();
|
if(Track::getCurrentTrack()->isSoccer()) drawScores();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1118,10 +1118,9 @@ void Track::loadMinimap()
|
|||||||
|
|
||||||
//Create the minimap resizing it as necessary.
|
//Create the minimap resizing it as necessary.
|
||||||
m_mini_map_size = World::getWorld()->getRaceGUI()->getMiniMapSize();
|
m_mini_map_size = World::getWorld()->getRaceGUI()->getMiniMapSize();
|
||||||
core::dimension2du size = m_mini_map_size
|
|
||||||
.getOptimalSize(!nonpower,!nonsquare);
|
|
||||||
|
|
||||||
m_render_target = Graph::get()->makeMiniMap(size, "minimap::" + m_ident, video::SColor(127, 255, 255, 255));
|
//Use twice the size of the rendered minimap to reduce significantly aliasing
|
||||||
|
m_render_target = Graph::get()->makeMiniMap(m_mini_map_size*2, "minimap::" + m_ident, video::SColor(127, 255, 255, 255));
|
||||||
if (!m_render_target) return;
|
if (!m_render_target) return;
|
||||||
|
|
||||||
core::dimension2du mini_map_texture_size = m_render_target->getTextureSize();
|
core::dimension2du mini_map_texture_size = m_render_target->getTextureSize();
|
||||||
|
Loading…
Reference in New Issue
Block a user