Applied jmimu's patch which shows players affected by attachments
and explosion in the player icon list, and 'animates' if a kart is overtaken another kart. Thanks a lot for this patch! git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5856 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
0e84cdf091
commit
10616dab38
BIN
data/models/anchor-attach-icon.png
Normal file
BIN
data/models/anchor-attach-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
data/models/bomb-attach-icon.png
Normal file
BIN
data/models/bomb-attach-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -17,5 +17,8 @@
|
|||||||
<material name="anchor-icon.png" clampU="Y" clampV="Y" transparency="Y" light="N" ignore="Y"/>
|
<material name="anchor-icon.png" clampU="Y" clampV="Y" transparency="Y" light="N" ignore="Y"/>
|
||||||
<material name="plunger-icon.png" transparency="Y" light="N"/>
|
<material name="plunger-icon.png" transparency="Y" light="N"/>
|
||||||
<material name="parachute-icon.png" clampU="Y" clampV="Y" ignore="Y"/>
|
<material name="parachute-icon.png" clampU="Y" clampV="Y" ignore="Y"/>
|
||||||
|
<material name="anchor-attach-icon.png" clampU="Y" clampV="Y" transparency="Y" light="N" ignore="Y"/>
|
||||||
|
<material name="parachute-attach-icon.png" clampU="Y" clampV="Y" ignore="Y"/>
|
||||||
|
<material name="bomb-attach-icon.png" clampU="Y" clampV="Y" ignore="Y"/>
|
||||||
</materials>
|
</materials>
|
||||||
|
|
||||||
|
BIN
data/models/parachute-attach-icon.png
Normal file
BIN
data/models/parachute-attach-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -20,11 +20,12 @@
|
|||||||
#include "items/attachment_manager.hpp"
|
#include "items/attachment_manager.hpp"
|
||||||
|
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
|
#include "graphics/material_manager.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
|
|
||||||
AttachmentManager *attachment_manager = 0;
|
AttachmentManager *attachment_manager = 0;
|
||||||
|
|
||||||
struct initAttachmentType {attachmentType attachment; const char *file;};
|
struct initAttachmentType {attachmentType attachment; const char *file; const char *icon_file;};
|
||||||
|
|
||||||
/* Some explanations to the attachments:
|
/* Some explanations to the attachments:
|
||||||
Parachute: This will increase the air friction, reducing the maximum speed.
|
Parachute: This will increase the air friction, reducing the maximum speed.
|
||||||
@ -45,11 +46,11 @@ struct initAttachmentType {attachmentType attachment; const char *file;};
|
|||||||
|
|
||||||
initAttachmentType iat[]=
|
initAttachmentType iat[]=
|
||||||
{
|
{
|
||||||
{ATTACH_PARACHUTE, "parachute.b3d"},
|
{ATTACH_PARACHUTE, "parachute.b3d", "parachute-attach-icon.png"},
|
||||||
{ATTACH_BOMB, "bomb.b3d"},
|
{ATTACH_BOMB, "bomb.b3d", "bomb-attach-icon.png"},
|
||||||
{ATTACH_ANVIL, "anchor.b3d"},
|
{ATTACH_ANVIL, "anchor.b3d", "anchor-attach-icon.png"},
|
||||||
{ATTACH_TINYTUX, "reset-button.b3d"},
|
{ATTACH_TINYTUX, "reset-button.b3d",""},
|
||||||
{ATTACH_MAX, ""},
|
{ATTACH_MAX, "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -70,6 +71,12 @@ void AttachmentManager::loadModels()
|
|||||||
// have to be in memory till the end of the game.
|
// have to be in memory till the end of the game.
|
||||||
std::string full_path = file_manager->getModelFile(iat[i].file);
|
std::string full_path = file_manager->getModelFile(iat[i].file);
|
||||||
m_attachments[iat[i].attachment]=irr_driver->getAnimatedMesh(full_path);
|
m_attachments[iat[i].attachment]=irr_driver->getAnimatedMesh(full_path);
|
||||||
|
|
||||||
|
std::string full_icon_path = file_manager->getModelFile(iat[i].icon_file);
|
||||||
|
m_all_icons[iat[i].attachment]=material_manager->getMaterial(full_icon_path,
|
||||||
|
/* full_path */ false,
|
||||||
|
/*make_permanent */ true);
|
||||||
|
|
||||||
} // for
|
} // for
|
||||||
} // reInit
|
} // reInit
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ class AttachmentManager
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
scene::IAnimatedMesh *m_attachments[ATTACH_MAX];
|
scene::IAnimatedMesh *m_attachments[ATTACH_MAX];
|
||||||
|
Material *m_all_icons [ATTACH_MAX];
|
||||||
public:
|
public:
|
||||||
AttachmentManager() {};
|
AttachmentManager() {};
|
||||||
/** Returns the mest for a certain attachment.
|
/** Returns the mest for a certain attachment.
|
||||||
@ -36,6 +37,10 @@ public:
|
|||||||
scene::IAnimatedMesh *getMesh(attachmentType type) const {return m_attachments[type]; }
|
scene::IAnimatedMesh *getMesh(attachmentType type) const {return m_attachments[type]; }
|
||||||
void removeTextures ();
|
void removeTextures ();
|
||||||
void loadModels ();
|
void loadModels ();
|
||||||
|
/** Returns the icon to display in the race gui if a kart
|
||||||
|
* has an attachment. */
|
||||||
|
const Material*
|
||||||
|
getIcon (int type) const {return m_all_icons [type];}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern AttachmentManager *attachment_manager;
|
extern AttachmentManager *attachment_manager;
|
||||||
|
@ -75,8 +75,16 @@ public:
|
|||||||
void forceRescue();
|
void forceRescue();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns true if an emergency animation is being played.
|
/** Returns true if an emergency animation is being played. */
|
||||||
*/
|
|
||||||
bool playingEmergencyAnimation() const {return m_kart_mode!=EA_NONE; }
|
bool playingEmergencyAnimation() const {return m_kart_mode!=EA_NONE; }
|
||||||
|
|
||||||
|
/** Returns if a rescue animation is being shown. */
|
||||||
|
bool playingRescueAnimation() const {return m_kart_mode==EA_RESCUE; }
|
||||||
|
|
||||||
|
/** Returns if an explosion animation is being shown. */
|
||||||
|
bool playingExplosionAnimation() const {return m_kart_mode==EA_EXPLOSION; }
|
||||||
|
|
||||||
|
/** Returns the timer for the currently played animation. */
|
||||||
|
const float getAnimationTimer() const {return m_timer;}
|
||||||
}; // EmergencyAnimation
|
}; // EmergencyAnimation
|
||||||
#endif
|
#endif
|
||||||
|
@ -250,11 +250,10 @@ public:
|
|||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the current attachment. */
|
/** Returns the current attachment. */
|
||||||
Attachment *getAttachment()
|
const Attachment* getAttachment() const {return m_attachment; }
|
||||||
{
|
// ------------------------------------------------------------------------
|
||||||
return m_attachment;
|
/** Returns the current attachment, non-const version. */
|
||||||
} // getAttachment
|
Attachment* getAttachment() {return m_attachment; }
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the camera of this kart (or NULL if no camera is attached
|
/** Returns the camera of this kart (or NULL if no camera is attached
|
||||||
* to this kart). */
|
* to this kart). */
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Constructs the linear world. Note that here no functions can be called
|
||||||
|
* that use World::getWorld(), since it is not yet defined.
|
||||||
|
*/
|
||||||
LinearWorld::LinearWorld() : World()
|
LinearWorld::LinearWorld() : World()
|
||||||
{
|
{
|
||||||
m_kart_display_info = NULL;
|
m_kart_display_info = NULL;
|
||||||
@ -39,15 +42,20 @@ LinearWorld::LinearWorld() : World()
|
|||||||
} // LinearWorld
|
} // LinearWorld
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Actually initialises the world, i.e. creates all data structures to
|
||||||
|
* for all karts etc. In init functions can be called that use
|
||||||
|
* World::getWorld().
|
||||||
|
*/
|
||||||
void LinearWorld::init()
|
void LinearWorld::init()
|
||||||
{
|
{
|
||||||
World::init();
|
World::init();
|
||||||
const unsigned int kart_amount = m_karts.size();
|
const unsigned int kart_amount = m_karts.size();
|
||||||
|
m_position_index.resize(kart_amount);
|
||||||
m_kart_display_info = new RaceGUIBase::KartIconDisplayInfo[kart_amount];
|
m_kart_display_info = new RaceGUIBase::KartIconDisplayInfo[kart_amount];
|
||||||
|
|
||||||
for(unsigned int n=0; n<kart_amount; n++)
|
for(unsigned int n=0; n<kart_amount; n++)
|
||||||
{
|
{
|
||||||
|
m_position_index[n] = n;
|
||||||
KartInfo info;
|
KartInfo info;
|
||||||
info.m_track_sector = QuadGraph::UNKNOWN_SECTOR;
|
info.m_track_sector = QuadGraph::UNKNOWN_SECTOR;
|
||||||
info.m_last_valid_sector = 0;
|
info.m_last_valid_sector = 0;
|
||||||
@ -98,7 +106,7 @@ void LinearWorld::restartRace()
|
|||||||
const unsigned int kart_amount = m_karts.size();
|
const unsigned int kart_amount = m_karts.size();
|
||||||
for(unsigned int i=0; i<kart_amount; i++)
|
for(unsigned int i=0; i<kart_amount; i++)
|
||||||
{
|
{
|
||||||
KartInfo& info = m_kart_info[i];
|
KartInfo& info = m_kart_info[i];
|
||||||
info.m_track_sector = QuadGraph::UNKNOWN_SECTOR;
|
info.m_track_sector = QuadGraph::UNKNOWN_SECTOR;
|
||||||
info.m_last_valid_sector = 0;
|
info.m_last_valid_sector = 0;
|
||||||
info.m_lap_start_time = 0;
|
info.m_lap_start_time = 0;
|
||||||
@ -734,6 +742,7 @@ void LinearWorld::updateRacePosition()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
kart->setPosition(p);
|
kart->setPosition(p);
|
||||||
|
m_position_index[p-1] = i;
|
||||||
// Switch on faster music if not already done so, if the
|
// Switch on faster music if not already done so, if the
|
||||||
// first kart is doing its last lap, and if the estimated
|
// first kart is doing its last lap, and if the estimated
|
||||||
// remaining time is less than 30 seconds.
|
// remaining time is less than 30 seconds.
|
||||||
|
@ -61,6 +61,9 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** This contains a mapping from race position to kart index. */
|
||||||
|
std::vector<int> m_position_index;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RaceGUIBase::KartIconDisplayInfo* m_kart_display_info;
|
RaceGUIBase::KartIconDisplayInfo* m_kart_display_info;
|
||||||
|
|
||||||
@ -98,7 +101,9 @@ public:
|
|||||||
virtual RaceGUIBase::KartIconDisplayInfo*
|
virtual RaceGUIBase::KartIconDisplayInfo*
|
||||||
getKartsDisplayInfo();
|
getKartsDisplayInfo();
|
||||||
virtual void moveKartAfterRescue(Kart* kart);
|
virtual void moveKartAfterRescue(Kart* kart);
|
||||||
|
/** Returns the kart with position p, 1<=p<=num_karts). */
|
||||||
|
const Kart* getKartAtPosition(unsigned int p) const
|
||||||
|
{ return m_karts[m_position_index[p-1]]; }
|
||||||
virtual void restartRace();
|
virtual void restartRace();
|
||||||
|
|
||||||
virtual bool raceHasLaps(){ return true; }
|
virtual bool raceHasLaps(){ return true; }
|
||||||
|
@ -34,7 +34,11 @@ using namespace irr;
|
|||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "input/input.hpp"
|
#include "input/input.hpp"
|
||||||
#include "input/input_manager.hpp"
|
#include "input/input_manager.hpp"
|
||||||
|
#include "items/attachment.hpp"
|
||||||
|
#include "items/attachment_manager.hpp"
|
||||||
|
#include "items/powerup_manager.hpp"
|
||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
|
#include "modes/linear_world.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "race/race_manager.hpp"
|
#include "race/race_manager.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
@ -92,6 +96,9 @@ RaceGUI::RaceGUI()
|
|||||||
m_string_ready = _("Ready!");
|
m_string_ready = _("Ready!");
|
||||||
m_string_set = _("Set!");
|
m_string_set = _("Set!");
|
||||||
m_string_go = _("Go!");
|
m_string_go = _("Go!");
|
||||||
|
|
||||||
|
m_dist_show_overlap=2;
|
||||||
|
m_icons_inertia=2;
|
||||||
} // RaceGUI
|
} // RaceGUI
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -113,13 +120,15 @@ void RaceGUI::createMarkerTexture()
|
|||||||
while(npower2<num_karts) npower2*=2;
|
while(npower2<num_karts) npower2*=2;
|
||||||
|
|
||||||
int radius = (m_marker_rendered_size>>1)-1;
|
int radius = (m_marker_rendered_size>>1)-1;
|
||||||
IrrDriver::RTTProvider rttProvider(core::dimension2du(m_marker_rendered_size * npower2,
|
IrrDriver::RTTProvider rttProvider(core::dimension2du(m_marker_rendered_size
|
||||||
m_marker_rendered_size),
|
*npower2,
|
||||||
|
m_marker_rendered_size),
|
||||||
"RaceGUI::markers");
|
"RaceGUI::markers");
|
||||||
scene::ICameraSceneNode *camera = irr_driver->addCameraSceneNode();
|
scene::ICameraSceneNode *camera = irr_driver->addCameraSceneNode();
|
||||||
core::matrix4 projection;
|
core::matrix4 projection;
|
||||||
projection.buildProjectionMatrixOrthoLH((float)(m_marker_rendered_size*npower2),
|
projection.buildProjectionMatrixOrthoLH((float)(m_marker_rendered_size*npower2),
|
||||||
(float)(m_marker_rendered_size), -1.0f, 1.0f);
|
(float)(m_marker_rendered_size),
|
||||||
|
-1.0f, 1.0f);
|
||||||
camera->setProjectionMatrix(projection, true);
|
camera->setProjectionMatrix(projection, true);
|
||||||
core::vector3df center( (float)(m_marker_rendered_size*npower2>>1),
|
core::vector3df center( (float)(m_marker_rendered_size*npower2>>1),
|
||||||
(float)(m_marker_rendered_size>>1), 0.0f);
|
(float)(m_marker_rendered_size>>1), 0.0f);
|
||||||
@ -144,11 +153,12 @@ void RaceGUI::createMarkerTexture()
|
|||||||
const std::string& kart_ident = race_manager->getKartIdent(i);
|
const std::string& kart_ident = race_manager->getKartIdent(i);
|
||||||
assert(kart_ident.size() > 0);
|
assert(kart_ident.size() > 0);
|
||||||
|
|
||||||
const KartProperties *kp = kart_properties_manager->getKart(kart_ident);
|
const KartProperties *kp=kart_properties_manager->getKart(kart_ident);
|
||||||
assert(kp != NULL);
|
assert(kp != NULL);
|
||||||
|
|
||||||
core::vector2df center((float)((m_marker_rendered_size>>1)+i*m_marker_rendered_size),
|
core::vector2df center((float)((m_marker_rendered_size>>1)
|
||||||
(float)(m_marker_rendered_size>>1) );
|
+i*m_marker_rendered_size),
|
||||||
|
(float)(m_marker_rendered_size>>1) );
|
||||||
int count = kp->getShape();
|
int count = kp->getShape();
|
||||||
video::ITexture *t = kp->getMinimapIcon();
|
video::ITexture *t = kp->getMinimapIcon();
|
||||||
if(t)
|
if(t)
|
||||||
@ -172,8 +182,10 @@ void RaceGUI::createMarkerTexture()
|
|||||||
video::SColor color = kp->getColor();
|
video::SColor color = kp->getColor();
|
||||||
createRegularPolygon(count, (float)radius, center, color,
|
createRegularPolygon(count, (float)radius, center, color,
|
||||||
vertices, index);
|
vertices, index);
|
||||||
irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices, count,
|
irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices,
|
||||||
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
count, index, count-2,
|
||||||
|
video::EVT_STANDARD,
|
||||||
|
scene::EPT_TRIANGLE_FAN);
|
||||||
delete [] vertices;
|
delete [] vertices;
|
||||||
delete [] index;
|
delete [] index;
|
||||||
} // if special minimap icon defined
|
} // if special minimap icon defined
|
||||||
@ -193,13 +205,15 @@ void RaceGUI::createMarkerTexture()
|
|||||||
void RaceGUI::createRegularPolygon(unsigned int n, float radius,
|
void RaceGUI::createRegularPolygon(unsigned int n, float radius,
|
||||||
const core::vector2df ¢er,
|
const core::vector2df ¢er,
|
||||||
const video::SColor &color,
|
const video::SColor &color,
|
||||||
video::S3DVertex *v, unsigned short int *index)
|
video::S3DVertex *v,
|
||||||
|
unsigned short int *index)
|
||||||
{
|
{
|
||||||
float f = 2*M_PI/(float)n;
|
float f = 2*M_PI/(float)n;
|
||||||
for (unsigned int i=0; i<n; i++)
|
for (unsigned int i=0; i<n; i++)
|
||||||
{
|
{
|
||||||
float p = i*f;
|
float p = i*f;
|
||||||
core::vector2df X = center + core::vector2df(sin(p)*radius, -cos(p)*radius);
|
core::vector2df X = center + core::vector2df( sin(p)*radius,
|
||||||
|
-cos(p)*radius);
|
||||||
v[i].Pos.X = X.X;
|
v[i].Pos.X = X.X;
|
||||||
v[i].Pos.Y = X.Y;
|
v[i].Pos.Y = X.Y;
|
||||||
v[i].Color = color;
|
v[i].Color = color;
|
||||||
@ -217,13 +231,18 @@ void RaceGUI::renderGlobal(float dt)
|
|||||||
{
|
{
|
||||||
cleanupMessages(dt);
|
cleanupMessages(dt);
|
||||||
|
|
||||||
// Special case : when 3 players play, use 4th window to display such stuff (but we must clear it)
|
// Special case : when 3 players play, use 4th window to display such
|
||||||
if (race_manager->getNumLocalPlayers() == 3 && !GUIEngine::ModalDialog::isADialogActive())
|
// stuff (but we must clear it)
|
||||||
|
if (race_manager->getNumLocalPlayers() == 3 &&
|
||||||
|
!GUIEngine::ModalDialog::isADialogActive())
|
||||||
{
|
{
|
||||||
static video::SColor black = video::SColor(255,0,0,0);
|
static video::SColor black = video::SColor(255,0,0,0);
|
||||||
irr_driver->getVideoDriver()->draw2DRectangle(black,
|
irr_driver->getVideoDriver()
|
||||||
core::rect<s32>(UserConfigParams::m_width/2, UserConfigParams::m_height/2,
|
->draw2DRectangle(black,
|
||||||
UserConfigParams::m_width, UserConfigParams::m_height));
|
core::rect<s32>(UserConfigParams::m_width/2,
|
||||||
|
UserConfigParams::m_height/2,
|
||||||
|
UserConfigParams::m_width,
|
||||||
|
UserConfigParams::m_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
World *world = World::getWorld();
|
World *world = World::getWorld();
|
||||||
@ -268,19 +287,25 @@ void RaceGUI::renderPlayerView(const Kart *kart)
|
|||||||
{
|
{
|
||||||
int offset_y = viewport.UpperLeftCorner.Y;
|
int offset_y = viewport.UpperLeftCorner.Y;
|
||||||
|
|
||||||
const int screen_width = viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X;
|
const int screen_width = viewport.LowerRightCorner.X
|
||||||
const int plunger_size = viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y;
|
- viewport.UpperLeftCorner.X;
|
||||||
int plunger_x = viewport.UpperLeftCorner.X + screen_width/2 - plunger_size/2;
|
const int plunger_size = viewport.LowerRightCorner.Y
|
||||||
|
- viewport.UpperLeftCorner.Y;
|
||||||
|
int plunger_x = viewport.UpperLeftCorner.X + screen_width/2
|
||||||
|
- plunger_size/2;
|
||||||
|
|
||||||
video::ITexture *t=m_plunger_face->getTexture();
|
video::ITexture *t=m_plunger_face->getTexture();
|
||||||
core::rect<s32> dest(plunger_x, offset_y,
|
core::rect<s32> dest(plunger_x, offset_y,
|
||||||
plunger_x+plunger_size, offset_y+plunger_size);
|
plunger_x+plunger_size, offset_y+plunger_size);
|
||||||
const core::rect<s32> source(core::position2d<s32>(0,0), t->getOriginalSize());
|
const core::rect<s32> source(core::position2d<s32>(0,0),
|
||||||
|
t->getOriginalSize());
|
||||||
|
|
||||||
//static const video::SColor white = video::SColor(255, 255, 255, 255);
|
//static const video::SColor white = video::SColor(255, 255, 255, 255);
|
||||||
|
|
||||||
irr_driver->getVideoDriver()->draw2DImage(t, dest, source, NULL /* clip */,
|
irr_driver->getVideoDriver()->draw2DImage(t, dest, source,
|
||||||
NULL /* color */, true /* alpha */);
|
NULL /* clip */,
|
||||||
|
NULL /* color */,
|
||||||
|
true /* alpha */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -349,8 +374,10 @@ void RaceGUI::drawGlobalMiniMap()
|
|||||||
Vec3 draw_at;
|
Vec3 draw_at;
|
||||||
world->getTrack()->mapPoint2MiniMap(xyz, &draw_at);
|
world->getTrack()->mapPoint2MiniMap(xyz, &draw_at);
|
||||||
// int marker_height = m_marker->getOriginalSize().Height;
|
// int marker_height = m_marker->getOriginalSize().Height;
|
||||||
core::rect<s32> source(i *m_marker_rendered_size, 0,
|
core::rect<s32> source(i *m_marker_rendered_size,
|
||||||
(i+1)*m_marker_rendered_size, m_marker_rendered_size);
|
0,
|
||||||
|
(i+1)*m_marker_rendered_size,
|
||||||
|
m_marker_rendered_size);
|
||||||
int marker_half_size = (kart->getController()->isPlayerController()
|
int marker_half_size = (kart->getController()->isPlayerController()
|
||||||
? m_marker_player_size
|
? m_marker_player_size
|
||||||
: m_marker_ai_size )>>1;
|
: m_marker_ai_size )>>1;
|
||||||
@ -358,7 +385,8 @@ void RaceGUI::drawGlobalMiniMap()
|
|||||||
lower_y -(int)(draw_at.getY()+marker_half_size),
|
lower_y -(int)(draw_at.getY()+marker_half_size),
|
||||||
m_map_left+(int)(draw_at.getX()+marker_half_size),
|
m_map_left+(int)(draw_at.getX()+marker_half_size),
|
||||||
lower_y -(int)(draw_at.getY()-marker_half_size));
|
lower_y -(int)(draw_at.getY()-marker_half_size));
|
||||||
irr_driver->getVideoDriver()->draw2DImage(m_marker, position, source, NULL, NULL, true);
|
irr_driver->getVideoDriver()->draw2DImage(m_marker, position, source,
|
||||||
|
NULL, NULL, true);
|
||||||
} // for i<getNumKarts
|
} // for i<getNumKarts
|
||||||
} // drawGlobalMiniMap
|
} // drawGlobalMiniMap
|
||||||
|
|
||||||
@ -366,18 +394,21 @@ void RaceGUI::drawGlobalMiniMap()
|
|||||||
// Draw players icons and their times (if defined in the current mode).
|
// Draw players icons and their times (if defined in the current mode).
|
||||||
void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
|
void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
|
||||||
{
|
{
|
||||||
int x = 5;
|
int x_base = 15;
|
||||||
int y_base = 20;
|
int y_base = 20;
|
||||||
|
|
||||||
// Special case : when 3 players play, use 4th window to display such stuff
|
// Special case : when 3 players play, use 4th window to display such stuff
|
||||||
if (race_manager->getNumLocalPlayers() == 3)
|
if (race_manager->getNumLocalPlayers() == 3)
|
||||||
{
|
{
|
||||||
x = UserConfigParams::m_width/2 + 5;
|
x_base = UserConfigParams::m_width/2 + 15;
|
||||||
y_base = UserConfigParams::m_height/2 + 20;
|
y_base = UserConfigParams::m_height/2 + 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
float previous_distance=10000.0;//far ahead
|
||||||
|
|
||||||
|
|
||||||
int ICON_WIDTH=(int)(40*(UserConfigParams::m_width/800.0f));
|
int ICON_WIDTH=(int)(40*(UserConfigParams::m_width/800.0f));
|
||||||
int ICON_PLAYER_WIDTH=(int)(50*(UserConfigParams::m_width/800.0f));
|
int ICON_PLAYER_WIDTH=(int)(50*(UserConfigParams::m_width/800.0f));
|
||||||
if(UserConfigParams::m_height<600)
|
if(UserConfigParams::m_height<600)
|
||||||
@ -386,51 +417,179 @@ void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
|
|||||||
ICON_PLAYER_WIDTH = 35;
|
ICON_PLAYER_WIDTH = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int previous_x=x_base;
|
||||||
|
int previous_y=y_base-ICON_PLAYER_WIDTH-2;
|
||||||
|
|
||||||
gui::ScalableFont* font = GUIEngine::getFont();
|
gui::ScalableFont* font = GUIEngine::getFont();
|
||||||
World *world = World::getWorld();
|
LinearWorld *world = (LinearWorld*)(World::getWorld());
|
||||||
const unsigned int kart_amount = world->getNumKarts();
|
const unsigned int kart_amount = world->getNumKarts();
|
||||||
for(unsigned int i = 0; i < kart_amount ; i++)
|
|
||||||
|
for(int position = 1; position <= (int)kart_amount ; position++)
|
||||||
{
|
{
|
||||||
Kart* kart = world->getKart(i);
|
const Kart *kart = world->getKartAtPosition(position);
|
||||||
if(kart->isEliminated()) continue;
|
if(kart->isEliminated()) continue;
|
||||||
const int position = kart->getPosition();
|
unsigned int kart_id = kart->getWorldKartId();
|
||||||
|
|
||||||
y = y_base + ( (position == -1 ? i : position-1)*(ICON_PLAYER_WIDTH+2));
|
//x,y is the target position
|
||||||
|
int lap = info[kart->getWorldKartId()].lap;
|
||||||
if (info[i].m_text.size() > 0)
|
float distance=
|
||||||
|
world->getDistanceDownTrackForKart(kart_id)
|
||||||
|
+world->getTrack()->getTrackLength()*lap;
|
||||||
|
if (previous_distance-distance<m_dist_show_overlap)
|
||||||
{
|
{
|
||||||
video::SColor color = video::SColor(255, (int)(255*info[i].r),
|
//linear translation : form (0,ICON_PLAYER_WIDTH+2) to
|
||||||
(int)(255*info[i].g),
|
// (previous_x-x_base+(ICON_PLAYER_WIDTH+2)/2,0)
|
||||||
(int)(255*info[i].b) );
|
x=(int)(x_base+(1-(previous_distance-distance)
|
||||||
core::rect<s32> pos(x+ICON_PLAYER_WIDTH, y+5, x+ICON_PLAYER_WIDTH, y+5);
|
/m_dist_show_overlap)
|
||||||
core::stringw s=info[i].m_text.c_str();
|
*(previous_x-x_base+(ICON_PLAYER_WIDTH+2)/2));
|
||||||
|
y=(int)(previous_y+(previous_distance-distance)
|
||||||
|
/m_dist_show_overlap*(ICON_PLAYER_WIDTH+2));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x=x_base;
|
||||||
|
y=previous_y+ICON_PLAYER_WIDTH+2;
|
||||||
|
}
|
||||||
|
previous_x=x;//save coord of the previous kart in list
|
||||||
|
previous_y=y;
|
||||||
|
previous_distance=distance;
|
||||||
|
|
||||||
|
//initialize m_previous_icons_position
|
||||||
|
if (m_previous_icons_position.size()<kart_amount)
|
||||||
|
{
|
||||||
|
core::vector2d<s32> pos(x,y);
|
||||||
|
m_previous_icons_position.push_back(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
//soft movement using previous position:
|
||||||
|
x=(int)((x+m_previous_icons_position[kart_id].X*m_icons_inertia)
|
||||||
|
/(m_icons_inertia+1));
|
||||||
|
y=(int)((y+m_previous_icons_position[kart_id].Y*m_icons_inertia)
|
||||||
|
/(m_icons_inertia+1));
|
||||||
|
|
||||||
|
//save position for next time
|
||||||
|
m_previous_icons_position[kart_id].X=x;
|
||||||
|
m_previous_icons_position[kart_id].Y=y;
|
||||||
|
|
||||||
|
if (info[kart_id].m_text.size() > 0)
|
||||||
|
{
|
||||||
|
video::SColor color = video::SColor(255,
|
||||||
|
(int)(255*info[kart_id].r),
|
||||||
|
(int)(255*info[kart_id].g),
|
||||||
|
(int)(255*info[kart_id].b) );
|
||||||
|
core::rect<s32> pos(x+ICON_PLAYER_WIDTH, y+5,
|
||||||
|
x+ICON_PLAYER_WIDTH, y+5);
|
||||||
|
core::stringw s=info[kart_id].m_text.c_str();
|
||||||
font->draw(s.c_str(), pos, color);
|
font->draw(s.c_str(), pos, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info[i].special_title.size() > 0)
|
if (info[kart_id].special_title.size() > 0)
|
||||||
{
|
{
|
||||||
static video::SColor color = video::SColor(255, 255, 0, 0);
|
static video::SColor color = video::SColor(255, 255, 0, 0);
|
||||||
core::rect<s32> pos(x+ICON_PLAYER_WIDTH, y+5, x+ICON_PLAYER_WIDTH, y+5);
|
core::rect<s32> pos(x+ICON_PLAYER_WIDTH, y+5,
|
||||||
core::stringw s(info[i].special_title.c_str());
|
x+ICON_PLAYER_WIDTH, y+5);
|
||||||
|
core::stringw s(info[kart_id].special_title.c_str());
|
||||||
font->draw(s.c_str(), pos, color);
|
font->draw(s.c_str(), pos, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw icon
|
// draw icon
|
||||||
video::ITexture *icon =
|
video::ITexture *icon =
|
||||||
kart->getKartProperties()->getIconMaterial()->getTexture();
|
kart->getKartProperties()->getIconMaterial()->getTexture();
|
||||||
int w = kart->getController()->isPlayerController() ? ICON_PLAYER_WIDTH
|
int w =
|
||||||
: ICON_WIDTH;
|
kart->getController()->isPlayerController() ? ICON_PLAYER_WIDTH
|
||||||
|
: ICON_WIDTH;
|
||||||
const core::rect<s32> pos(x, y, x+w, y+w);
|
const core::rect<s32> pos(x, y, x+w, y+w);
|
||||||
|
|
||||||
// Fixes crash bug, why are certain icons not showing up?
|
// Fixes crash bug, why are certain icons not showing up?
|
||||||
if (icon != NULL)
|
if ((icon != NULL) && (!kart->playingEmergencyAnimation()))
|
||||||
{
|
{
|
||||||
const core::rect<s32> rect(core::position2d<s32>(0,0), icon->getOriginalSize());
|
const core::rect<s32> rect(core::position2d<s32>(0,0),
|
||||||
irr_driver->getVideoDriver()->draw2DImage(icon, pos, rect, NULL, NULL, true);
|
icon->getOriginalSize());
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon, pos, rect,
|
||||||
|
NULL, NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // next kart
|
//draw status info
|
||||||
|
|
||||||
|
if ((icon != NULL) && (kart->playingRescueAnimation()))
|
||||||
|
{
|
||||||
|
//icon fades to the left
|
||||||
|
float t_anim=100*sin(0.5f*M_PI*kart->getAnimationTimer());
|
||||||
|
const core::rect<s32> rect1(core::position2d<s32>(0,0),
|
||||||
|
icon->getOriginalSize());
|
||||||
|
const core::rect<s32> pos1((int)(x-t_anim), y,
|
||||||
|
(int)(x+w-t_anim), y+w);
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon, pos1, rect1,
|
||||||
|
NULL, NULL, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((icon != NULL) && (kart->playingExplosionAnimation()))
|
||||||
|
{
|
||||||
|
//exploses into 4 parts
|
||||||
|
float t_anim=50.0f*sin(0.5f*M_PI*kart->getAnimationTimer());
|
||||||
|
u16 icon_size_x=icon->getOriginalSize().Width;
|
||||||
|
u16 icon_size_y=icon->getOriginalSize().Height;
|
||||||
|
|
||||||
|
const core::rect<s32> rect1(0, 0, icon_size_x/2,icon_size_y/2);
|
||||||
|
const core::rect<s32> pos1((int)(x-t_anim), (int)(y-t_anim),
|
||||||
|
(int)(x+w/2-t_anim),
|
||||||
|
(int)(y+w/2-t_anim));
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon, pos1, rect1,
|
||||||
|
NULL, NULL, true);
|
||||||
|
|
||||||
|
const core::rect<s32> rect2(icon_size_x/2,0,
|
||||||
|
icon_size_x,icon_size_y/2);
|
||||||
|
const core::rect<s32> pos2((int)(x+w/2+t_anim),
|
||||||
|
(int)(y-t_anim),
|
||||||
|
(int)(x+w+t_anim),
|
||||||
|
(int)(y+w/2-t_anim));
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon, pos2, rect2,
|
||||||
|
NULL, NULL, true);
|
||||||
|
|
||||||
|
const core::rect<s32> rect3(0, icon_size_y/2, icon_size_x/2,icon_size_y);
|
||||||
|
const core::rect<s32> pos3((int)(x-t_anim), (int)(y+w/2+t_anim),
|
||||||
|
(int)(x+w/2-t_anim), (int)(y+w+t_anim));
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon, pos3, rect3, NULL, NULL, true);
|
||||||
|
|
||||||
|
const core::rect<s32> rect4(icon_size_x/2,icon_size_y/2,icon_size_x,icon_size_y);
|
||||||
|
const core::rect<s32> pos4((int)(x+w/2+t_anim), (int)(y+w/2+t_anim),
|
||||||
|
(int)(x+w+t_anim), (int)(y+w+t_anim));
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon, pos4, rect4, NULL, NULL, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Plunger
|
||||||
|
if (kart->hasViewBlockedByPlunger())
|
||||||
|
{
|
||||||
|
video::ITexture *icon_plunger =
|
||||||
|
powerup_manager->getIcon(PowerupManager::POWERUP_PLUNGER)->getTexture();
|
||||||
|
if (icon_plunger != NULL)
|
||||||
|
{
|
||||||
|
const core::rect<s32> rect(core::position2d<s32>(0,0),
|
||||||
|
icon_plunger->getOriginalSize());
|
||||||
|
const core::rect<s32> pos1(x+10, y-10, x+w+10, y+w-10);
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon_plunger, pos1,
|
||||||
|
rect, NULL, NULL,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//attachment
|
||||||
|
if (kart->getAttachment()->getType() != ATTACH_NOTHING)
|
||||||
|
{
|
||||||
|
video::ITexture *icon_attachment =
|
||||||
|
attachment_manager->getIcon(kart->getAttachment()->getType())
|
||||||
|
->getTexture();
|
||||||
|
if (icon_attachment != NULL)
|
||||||
|
{
|
||||||
|
const core::rect<s32> rect(core::position2d<s32>(0,0),
|
||||||
|
icon_attachment->getOriginalSize());
|
||||||
|
const core::rect<s32> pos1(x-20, y-10, x+w-20, y+w-10);
|
||||||
|
irr_driver->getVideoDriver()->draw2DImage(icon_attachment,
|
||||||
|
pos1, rect, NULL,
|
||||||
|
NULL, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} //next position
|
||||||
} // drawGlobalPlayerIcons
|
} // drawGlobalPlayerIcons
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -449,7 +608,8 @@ void RaceGUI::drawPowerupIcons(const Kart* kart,
|
|||||||
|
|
||||||
int itemSpacing = (int)(std::min(scaling.X, scaling.Y)*30);
|
int itemSpacing = (int)(std::min(scaling.X, scaling.Y)*30);
|
||||||
|
|
||||||
int x1 = viewport.UpperLeftCorner.X + viewport.getWidth()/2 - (n * itemSpacing)/2;
|
int x1 = viewport.UpperLeftCorner.X + viewport.getWidth()/2
|
||||||
|
- (n * itemSpacing)/2;
|
||||||
int y1 = viewport.UpperLeftCorner.Y + (int)(20 * scaling.Y);
|
int y1 = viewport.UpperLeftCorner.Y + (int)(20 * scaling.Y);
|
||||||
|
|
||||||
assert(powerup != NULL);
|
assert(powerup != NULL);
|
||||||
@ -656,23 +816,30 @@ void RaceGUI::drawLap(const KartIconDisplayInfo* info, const Kart* kart,
|
|||||||
if (m_minimap_on_left)
|
if (m_minimap_on_left)
|
||||||
{
|
{
|
||||||
// check if mini-map is within Y coords of this player.
|
// check if mini-map is within Y coords of this player.
|
||||||
// if the mini-map is not even in the viewport of this player, don't bother placing
|
// if the mini-map is not even in the viewport of this player, don't
|
||||||
// the lap text at the right of the minimap.
|
// bother placing the lap text at the right of the minimap.
|
||||||
if (UserConfigParams::m_height - m_map_bottom - m_map_height > viewport.LowerRightCorner.Y)
|
if (UserConfigParams::m_height - m_map_bottom - m_map_height
|
||||||
|
> viewport.LowerRightCorner.Y)
|
||||||
{
|
{
|
||||||
pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X + (int)(0.1f*UserConfigParams::m_width);
|
pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X
|
||||||
|
+ (int)(0.1f*UserConfigParams::m_width);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// place lap text at the right of the mini-map
|
// place lap text at the right of the mini-map
|
||||||
const int calculated_x = viewport.UpperLeftCorner.X + (int)(0.05f*UserConfigParams::m_width);
|
const int calculated_x = viewport.UpperLeftCorner.X
|
||||||
pos.UpperLeftCorner.X = std::max(calculated_x, m_map_right_side_x + 15); // don't overlap minimap
|
+ (int)(0.05f*UserConfigParams::m_width);
|
||||||
|
// don't overlap minimap
|
||||||
|
pos.UpperLeftCorner.X = std::max(calculated_x,
|
||||||
|
m_map_right_side_x + 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// mini-map is on the right, and lap text on right, so no overlap possible
|
// mini-map is on the right, and lap text on right,
|
||||||
pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X + (int)(0.05f*UserConfigParams::m_width);
|
// so no overlap possible
|
||||||
|
pos.UpperLeftCorner.X = viewport.UpperLeftCorner.X
|
||||||
|
+ (int)(0.05f*UserConfigParams::m_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
gui::ScalableFont* font = GUIEngine::getFont();
|
gui::ScalableFont* font = GUIEngine::getFont();
|
||||||
@ -735,7 +902,8 @@ void RaceGUI::drawAllMessages(const Kart* kart,
|
|||||||
const int w = (viewport.LowerRightCorner.X + viewport.UpperLeftCorner.X)/2;
|
const int w = (viewport.LowerRightCorner.X + viewport.UpperLeftCorner.X)/2;
|
||||||
|
|
||||||
// draw less important first, at the very top of the screen
|
// draw less important first, at the very top of the screen
|
||||||
for (AllMessageType::const_iterator i = m_messages.begin(); i != m_messages.end(); ++i)
|
for (AllMessageType::const_iterator i = m_messages.begin();
|
||||||
|
i != m_messages.end(); ++i)
|
||||||
{
|
{
|
||||||
TimedMessage const &msg = *i;
|
TimedMessage const &msg = *i;
|
||||||
if (!msg.m_important)
|
if (!msg.m_important)
|
||||||
@ -744,8 +912,9 @@ void RaceGUI::drawAllMessages(const Kart* kart,
|
|||||||
if (msg.m_kart && msg.m_kart!=kart) continue;
|
if (msg.m_kart && msg.m_kart!=kart) continue;
|
||||||
|
|
||||||
core::rect<s32> pos(x - w/2, y, x + w/2, y + m_max_font_height);
|
core::rect<s32> pos(x - w/2, y, x + w/2, y + m_max_font_height);
|
||||||
GUIEngine::getSmallFont()->draw(core::stringw(msg.m_message.c_str()).c_str(),
|
GUIEngine::getSmallFont()->draw(
|
||||||
pos, msg.m_color, true /* hcenter */, true /* vcenter */);
|
core::stringw(msg.m_message.c_str()).c_str(),
|
||||||
|
pos, msg.m_color, true /* hcenter */, true /* vcenter */);
|
||||||
y -= m_small_font_max_height;
|
y -= m_small_font_max_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -756,18 +925,21 @@ void RaceGUI::drawAllMessages(const Kart* kart,
|
|||||||
// The message are displayed in reverse order, so that a multi-line
|
// The message are displayed in reverse order, so that a multi-line
|
||||||
// message (addMessage("1", ...); addMessage("2",...) is displayed
|
// message (addMessage("1", ...); addMessage("2",...) is displayed
|
||||||
// in the right order: "1" on top of "2"
|
// in the right order: "1" on top of "2"
|
||||||
for (AllMessageType::const_iterator i = m_messages.begin(); i != m_messages.end(); ++i)
|
for (AllMessageType::const_iterator i = m_messages.begin();
|
||||||
|
i != m_messages.end(); ++i)
|
||||||
{
|
{
|
||||||
TimedMessage const &msg = *i;
|
TimedMessage const &msg = *i;
|
||||||
|
|
||||||
if (!msg.m_important) continue; // less important messages were already displayed
|
// less important messages were already displayed
|
||||||
|
if (!msg.m_important) continue;
|
||||||
|
|
||||||
// Display only messages for all karts, or messages for this kart
|
// Display only messages for all karts, or messages for this kart
|
||||||
if (msg.m_kart && msg.m_kart!=kart) continue;
|
if (msg.m_kart && msg.m_kart!=kart) continue;
|
||||||
|
|
||||||
core::rect<s32> pos(x - w/2, y, x + w/2, y + m_max_font_height);
|
core::rect<s32> pos(x - w/2, y, x + w/2, y + m_max_font_height);
|
||||||
GUIEngine::getFont()->draw(core::stringw(msg.m_message.c_str()).c_str(),
|
GUIEngine::getFont()->draw(core::stringw(msg.m_message.c_str()).c_str(),
|
||||||
pos, msg.m_color, true /* hcenter */, true /* vcenter */);
|
pos, msg.m_color, true /* hcenter */,
|
||||||
|
true /* vcenter */);
|
||||||
y += m_max_font_height;
|
y += m_max_font_height;
|
||||||
} // for i in all messages
|
} // for i in all messages
|
||||||
} // drawAllMessages
|
} // drawAllMessages
|
||||||
@ -777,10 +949,12 @@ void RaceGUI::drawAllMessages(const Kart* kart,
|
|||||||
* certain amount of time (unless time<0, then the message is displayed
|
* certain amount of time (unless time<0, then the message is displayed
|
||||||
* once).
|
* once).
|
||||||
**/
|
**/
|
||||||
void RaceGUI::addMessage(const core::stringw &msg, const Kart *kart, float time,
|
void RaceGUI::addMessage(const core::stringw &msg, const Kart *kart,
|
||||||
int font_size, const video::SColor &color, bool important)
|
float time, int font_size,
|
||||||
|
const video::SColor &color, bool important)
|
||||||
{
|
{
|
||||||
m_messages.push_back(TimedMessage(msg, kart, time, font_size, color, important));
|
m_messages.push_back(TimedMessage(msg, kart, time, font_size, color,
|
||||||
|
important));
|
||||||
} // addMessage
|
} // addMessage
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -788,7 +962,8 @@ void RaceGUI::addMessage(const core::stringw &msg, const Kart *kart, float time,
|
|||||||
// usually the title and composer.
|
// usually the title and composer.
|
||||||
void RaceGUI::drawGlobalMusicDescription()
|
void RaceGUI::drawGlobalMusicDescription()
|
||||||
{
|
{
|
||||||
if (!UserConfigParams::m_music) return; // show no music description when it's off
|
// show no music description when it's off
|
||||||
|
if (!UserConfigParams::m_music) return;
|
||||||
|
|
||||||
gui::IGUIFont* font = GUIEngine::getFont();
|
gui::IGUIFont* font = GUIEngine::getFont();
|
||||||
|
|
||||||
@ -813,7 +988,7 @@ void RaceGUI::drawGlobalMusicDescription()
|
|||||||
|
|
||||||
const float resize3 = resize*resize*resize;
|
const float resize3 = resize*resize*resize;
|
||||||
|
|
||||||
// ---- Get song name, and calculate its size, allowing us to position stuff
|
// Get song name, and calculate its size, allowing us to position stuff
|
||||||
const MusicInformation* mi = music_manager->getCurrentMusic();
|
const MusicInformation* mi = music_manager->getCurrentMusic();
|
||||||
if (!mi) return;
|
if (!mi) return;
|
||||||
|
|
||||||
@ -838,14 +1013,18 @@ void RaceGUI::drawGlobalMusicDescription()
|
|||||||
const int ICON_SIZE = 64;
|
const int ICON_SIZE = 64;
|
||||||
const int y = UserConfigParams::m_height - 80;
|
const int y = UserConfigParams::m_height - 80;
|
||||||
// the 20 is an arbitrary space left between the note icon and the text
|
// the 20 is an arbitrary space left between the note icon and the text
|
||||||
const int noteX = (UserConfigParams::m_width / 2) - std::max(textWidth, textWidth2)/2 - ICON_SIZE/2 - 20;
|
const int noteX = (UserConfigParams::m_width / 2)
|
||||||
|
- std::max(textWidth, textWidth2)/2 - ICON_SIZE/2 - 20;
|
||||||
const int noteY = y;
|
const int noteY = y;
|
||||||
// the 20 is an arbitrary space left between the note icon and the text
|
// the 20 is an arbitrary space left between the note icon and the text
|
||||||
const int textXFrom = (UserConfigParams::m_width / 2) - std::max(textWidth, textWidth2)/2 + 20;
|
const int textXFrom = (UserConfigParams::m_width / 2)
|
||||||
const int textXTo = (UserConfigParams::m_width / 2) + std::max(textWidth, textWidth2)/2 + 20;
|
- std::max(textWidth, textWidth2)/2 + 20;
|
||||||
|
const int textXTo = (UserConfigParams::m_width / 2)
|
||||||
|
+ std::max(textWidth, textWidth2)/2 + 20;
|
||||||
|
|
||||||
// ---- Draw "by" text
|
// ---- Draw "by" text
|
||||||
const int text_y = (int)(UserConfigParams::m_height - 80*(resize3) + 40*(1-resize));
|
const int text_y = (int)(UserConfigParams::m_height - 80*(resize3)
|
||||||
|
+ 40*(1-resize));
|
||||||
|
|
||||||
static const video::SColor white = video::SColor(255, 255, 255, 255);
|
static const video::SColor white = video::SColor(255, 255, 255, 255);
|
||||||
if(mi->getComposer()!="")
|
if(mi->getComposer()!="")
|
||||||
@ -853,27 +1032,31 @@ void RaceGUI::drawGlobalMusicDescription()
|
|||||||
core::rect<s32> pos_by(textXFrom, text_y+40,
|
core::rect<s32> pos_by(textXFrom, text_y+40,
|
||||||
textXTo, text_y+40);
|
textXTo, text_y+40);
|
||||||
std::string s="by "+mi->getComposer();
|
std::string s="by "+mi->getComposer();
|
||||||
font->draw(core::stringw(s.c_str()).c_str(), pos_by, white, true, true);
|
font->draw(core::stringw(s.c_str()).c_str(), pos_by, white,
|
||||||
|
true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Draw "song name" text
|
// ---- Draw "song name" text
|
||||||
core::rect<s32> pos(textXFrom, text_y,
|
core::rect<s32> pos(textXFrom, text_y,
|
||||||
textXTo, text_y);
|
textXTo, text_y);
|
||||||
|
|
||||||
font->draw(thetext.c_str(), pos, white, true /* hcenter */, true /* vcenter */);
|
font->draw(thetext.c_str(), pos, white, true /* hcenter */,
|
||||||
|
true /* vcenter */);
|
||||||
|
|
||||||
// Draw music icon
|
// Draw music icon
|
||||||
int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize);
|
int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize);
|
||||||
int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize);
|
int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize);
|
||||||
|
|
||||||
video::ITexture *t = m_music_icon->getTexture();
|
video::ITexture *t = m_music_icon->getTexture();
|
||||||
core::rect<s32> dest(noteX-iconSizeX/2+20, noteY-iconSizeY/2+ICON_SIZE/2,
|
core::rect<s32> dest(noteX-iconSizeX/2+20,
|
||||||
noteX+iconSizeX/2+20, noteY+iconSizeY/2+ICON_SIZE/2);
|
noteY-iconSizeY/2+ICON_SIZE/2,
|
||||||
const core::rect<s32> source(core::position2d<s32>(0,0), t->getOriginalSize());
|
noteX+iconSizeX/2+20,
|
||||||
|
noteY+iconSizeY/2+ICON_SIZE/2);
|
||||||
|
const core::rect<s32> source(core::position2d<s32>(0,0),
|
||||||
|
t->getOriginalSize());
|
||||||
|
|
||||||
irr_driver->getVideoDriver()->draw2DImage(t, dest, source, NULL, NULL, true);
|
irr_driver->getVideoDriver()->draw2DImage(t, dest, source,
|
||||||
|
NULL, NULL, true);
|
||||||
|
|
||||||
} // drawGlobalMusicDescription
|
} // drawGlobalMusicDescription
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -885,20 +1068,22 @@ void RaceGUI::drawGlobalReadySetGo()
|
|||||||
{
|
{
|
||||||
case WorldStatus::READY_PHASE:
|
case WorldStatus::READY_PHASE:
|
||||||
{
|
{
|
||||||
//static video::SColor color = video::SColor(255, 230, 168, 158);
|
|
||||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||||
core::rect<s32> pos(UserConfigParams::m_width>>1, UserConfigParams::m_height>>1,
|
core::rect<s32> pos(UserConfigParams::m_width>>1,
|
||||||
UserConfigParams::m_width>>1, UserConfigParams::m_height>>1);
|
UserConfigParams::m_height>>1,
|
||||||
|
UserConfigParams::m_width>>1,
|
||||||
|
UserConfigParams::m_height>>1);
|
||||||
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
||||||
font->draw(m_string_ready.c_str(), pos, color, true, true);
|
font->draw(m_string_ready.c_str(), pos, color, true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WorldStatus::SET_PHASE:
|
case WorldStatus::SET_PHASE:
|
||||||
{
|
{
|
||||||
//static video::SColor color = video::SColor(255, 230, 230, 158);
|
|
||||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||||
core::rect<s32> pos(UserConfigParams::m_width>>1, UserConfigParams::m_height>>1,
|
core::rect<s32> pos(UserConfigParams::m_width>>1,
|
||||||
UserConfigParams::m_width>>1, UserConfigParams::m_height>>1);
|
UserConfigParams::m_height>>1,
|
||||||
|
UserConfigParams::m_width>>1,
|
||||||
|
UserConfigParams::m_height>>1);
|
||||||
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
||||||
//I18N: as in "ready, set, go", shown at the beginning of the race
|
//I18N: as in "ready, set, go", shown at the beginning of the race
|
||||||
font->draw(m_string_set.c_str(), pos, color, true, true);
|
font->draw(m_string_set.c_str(), pos, color, true, true);
|
||||||
@ -906,10 +1091,11 @@ void RaceGUI::drawGlobalReadySetGo()
|
|||||||
break;
|
break;
|
||||||
case WorldStatus::GO_PHASE:
|
case WorldStatus::GO_PHASE:
|
||||||
{
|
{
|
||||||
//static video::SColor color = video::SColor(255, 100, 209, 100);
|
|
||||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||||
core::rect<s32> pos(UserConfigParams::m_width>>1, UserConfigParams::m_height>>1,
|
core::rect<s32> pos(UserConfigParams::m_width>>1,
|
||||||
UserConfigParams::m_width>>1, UserConfigParams::m_height>>1);
|
UserConfigParams::m_height>>1,
|
||||||
|
UserConfigParams::m_width>>1,
|
||||||
|
UserConfigParams::m_height>>1);
|
||||||
//gui::IGUIFont* font = irr_driver->getRaceFont();
|
//gui::IGUIFont* font = irr_driver->getRaceFont();
|
||||||
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
||||||
//I18N: as in "ready, set, go", shown at the beginning of the race
|
//I18N: as in "ready, set, go", shown at the beginning of the race
|
||||||
|
@ -139,6 +139,12 @@ private:
|
|||||||
int m_max_font_height;
|
int m_max_font_height;
|
||||||
int m_small_font_max_height;
|
int m_small_font_max_height;
|
||||||
|
|
||||||
|
/** Distance on track to begin showing overlap in drawGlobalPlayerIcons */
|
||||||
|
float m_dist_show_overlap;///can be zero
|
||||||
|
float m_icons_inertia;///can be zero
|
||||||
|
/** previous position of icons */
|
||||||
|
std::vector< core::vector2d<s32> > m_previous_icons_position;
|
||||||
|
|
||||||
void createMarkerTexture();
|
void createMarkerTexture();
|
||||||
void createRegularPolygon(unsigned int n, float radius,
|
void createRegularPolygon(unsigned int n, float radius,
|
||||||
const core::vector2df ¢er,
|
const core::vector2df ¢er,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user