Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rototype

As the merged changes include fixing 5138 in the main repo which was already kind of fixed here, I had to take a bit of care
  • Loading branch information
kimden committed Aug 19, 2024
2 parents 683a1b1 + 88cd5cf commit 12efb28
Show file tree
Hide file tree
Showing 29 changed files with 164 additions and 110 deletions.
Binary file modified data/skins/cartoon-coal/button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/cartoon-coal/button_focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/cartoon-coal/checkbox_checked_focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/cartoon-coal/checkbox_focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/cartoon-coal/spinner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/cartoon-coal/spinner_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/cartoon-coal/spinner_fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/cartoon-coal/spinner_focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions data/skins/cartoon-coal/stkskin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ Here you can configure advanced theming rules for this skin
<color type="emphasis_text" state="focused" r="255" g="226" b="56" />

<!-- Color used for red/blue items in list (e.g. player team color in networking) -->
<color type="list_blue" state="neutral" r="0" g="0" b="180" />
<color type="list_blue" state="focused" r="0" g="0" b="255" />
<color type="list_red" state="neutral" r="255" g="0" b="0" />
<color type="list_red" state="focused" r="255" g="0" b="0" />
<color type="list_blue" state="neutral" r="0" g="0" b="90" />
<color type="list_blue" state="focused" r="0" g="0" b="225" />
<color type="list_red" state="neutral" r="255" g="30" b="30" />
<color type="list_red" state="focused" r="145" g="0" b="0" />

<!-- Color used to fade out background when a dialog is shown -->
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/skins/classic-coal/glass_section.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/skins/classic-coal/glassspinner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions data/skins/classic-coal/stkskin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Here you can configure advanced theming rules for this skin
<element type="selectionHalo" image="bubble.png" />
<element type="focusHalo" image="glass_iconhighlight_focus.png" />

<element type="spinner" state="neutral" common="y" image="glassspinner.png"
<element type="spinner" state="neutral" image="glassspinner.png"
left_border="110" right_border="110" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />

Expand Down Expand Up @@ -254,10 +254,10 @@ Here you can configure advanced theming rules for this skin
<color type="emphasis_text" state="focused" r="255" g="226" b="56" />

<!-- Color used for red/blue items in list (e.g. player team color in networking) -->
<color type="list_blue" state="neutral" r="0" g="0" b="180" />
<color type="list_blue" state="focused" r="0" g="0" b="255" />
<color type="list_red" state="neutral" r="255" g="0" b="0" />
<color type="list_red" state="focused" r="255" g="0" b="0" />
<color type="list_blue" state="neutral" r="0" g="0" b="115" />
<color type="list_blue" state="focused" r="45" g="45" b="255" />
<color type="list_red" state="neutral" r="255" g="30" b="30" />
<color type="list_red" state="focused" r="255" g="30" b="30" />

<!-- Color used to fade out background when a dialog is shown -->
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
Expand Down
2 changes: 0 additions & 2 deletions lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ void CGUIContextMenu::draw()
// loop through all menu items

rect = AbsoluteRect;
s32 y = AbsoluteRect.UpperLeftCorner.Y;

for (s32 i=0; i<(s32)Items.size(); ++i)
{
Expand All @@ -549,7 +548,6 @@ void CGUIContextMenu::draw()
rect.UpperLeftCorner.Y += 1;
skin->draw2DRectangle(this, skin->getColor(EGDC_3D_HIGH_LIGHT), rect, clip);

y += 10;
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
#endif
#ifdef ANDROID
Android_initDisplayCutout(&TopPadding, &BottomPadding, &LeftPadding, &RightPadding, &InitialOrientation);
#else
(void)InitialOrientation;
#endif
core::stringc sdlversion = "Compiled SDL Version ";
sdlversion += Info.version.major;
Expand Down
6 changes: 0 additions & 6 deletions lib/irrlicht/source/Irrlicht/CMeshManipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const

// Main algorithm
u32 highest = 0;
u32 drawcalls = 0;
for (;;)
{
if (tc[highest].drawn)
Expand Down Expand Up @@ -1582,7 +1581,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
lru.add(tc[highest].ind[0]);
lru.add(tc[highest].ind[1]);
highest = lru.add(tc[highest].ind[2], true);
drawcalls++;
}

buf->setBoundingBox(mb->getBoundingBox());
Expand All @@ -1605,7 +1603,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const

// Main algorithm
u32 highest = 0;
u32 drawcalls = 0;
for (;;)
{
if (tc[highest].drawn)
Expand Down Expand Up @@ -1694,7 +1691,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
lru.add(tc[highest].ind[0]);
lru.add(tc[highest].ind[1]);
highest = lru.add(tc[highest].ind[2]);
drawcalls++;
}

buf->setBoundingBox(mb->getBoundingBox());
Expand All @@ -1718,7 +1714,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const

// Main algorithm
u32 highest = 0;
u32 drawcalls = 0;
for (;;)
{
if (tc[highest].drawn)
Expand Down Expand Up @@ -1807,7 +1802,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
lru.add(tc[highest].ind[0]);
lru.add(tc[highest].ind[1]);
highest = lru.add(tc[highest].ind[2]);
drawcalls++;
}

buf->setBoundingBox(mb->getBoundingBox());
Expand Down
5 changes: 3 additions & 2 deletions lib/irrlicht/source/Irrlicht/CNullDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,9 @@ const SLight& CNullDriver::getDynamicLight(u32 idx) const
{
if ( idx < Lights.size() )
return Lights[idx];
else
return *((SLight*)0);
static const SLight defaultLight;
os::Printer::log("Error: CNullDriver::getDynamicLight was invoked with an invalid index.", ELL_ERROR);
return defaultLight;
}


Expand Down
6 changes: 3 additions & 3 deletions lib/irrlicht/source/Irrlicht/COSOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ namespace irr
{

// constructor linux
COSOperator::COSOperator(const core::stringc& osVersion, IrrlichtDevice* device)
: OperatingSystem(osVersion), IrrDevice(device)
COSOperator::COSOperator(const core::stringc& osVersion, IrrlichtDevice* /*device*/)
: OperatingSystem(osVersion)
{
}


// constructor
COSOperator::COSOperator(const core::stringc& osVersion)
: OperatingSystem(osVersion), IrrDevice(NULL)
: OperatingSystem(osVersion)
{
#ifdef _DEBUG
setDebugName("COSOperator");
Expand Down
1 change: 0 additions & 1 deletion lib/irrlicht/source/Irrlicht/COSOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class COSOperator : public IOSOperator
private:

core::stringc OperatingSystem;
IrrlichtDevice* IrrDevice;

};

Expand Down
8 changes: 6 additions & 2 deletions lib/irrlicht/source/Irrlicht/CSceneManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,12 @@ const core::aabbox3d<f32>& CSceneManager::getBoundingBox() const
{
_IRR_DEBUG_BREAK_IF(true) // Bounding Box of Scene Manager wanted.

// should never be used.
return *((core::aabbox3d<f32>*)0);
os::Printer::log("Unexpected call to CSceneManager::getBoundingBox()", ELL_ERROR);
// Static default bounding box to return in case this function is called unexpectedly
static const core::aabbox3d<f32> defaultBox;

// Should never be used, but we return a safe reference instead of dereferencing a null pointer.
return defaultBox;
}


Expand Down
2 changes: 1 addition & 1 deletion lib/irrlicht/source/Irrlicht/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ namespace os
//! generates a pseudo random number
f32 Randomizer::frand()
{
return rand()*(1.f/rMax);
return rand()*(1.f/static_cast<f32>(rMax));
}

s32 Randomizer::randMax()
Expand Down
4 changes: 3 additions & 1 deletion src/guiengine/event_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,12 @@ int EventHandler::findIDClosestWidget(const NavigationDirection nav, const int p
// - it corresponds to the current widget
// - it corresponds to an invisible or disabled widget
// - the player is not allowed to select it
// - Its base coordinates are negative (such as buttons within ribbons)
if (w_test == NULL || !Widget::isFocusableId(i) || w == w_test ||
(!w_test->isVisible() && ignore_disabled) ||
(!w_test->isActivated() && ignore_disabled) ||
(playerID != PLAYER_ID_GAME_MASTER && !w_test->m_supports_multiplayer))
(playerID != PLAYER_ID_GAME_MASTER && !w_test->m_supports_multiplayer) ||
(w_test->m_x < 0) || (w_test->m_y < 0))
continue;

// Ignore empty ribbon widgets and lists
Expand Down
4 changes: 4 additions & 0 deletions src/guiengine/widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ namespace GUIEngine
*/
int getID() const { return m_id; }

/** Get the name used for this widget in the GUI files or set in the code
* Use only for debugging. */
std::string getName() { return m_properties[PROP_ID]; }

/** Get whether this object is allowed to receive focus */
bool isFocusable() const { return m_focusable; }

Expand Down
22 changes: 16 additions & 6 deletions src/network/protocols/server_lobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,9 @@ void ServerLobby::asynchronousUpdate()
m_item_seed = (uint32_t)StkTime::getTimeSinceEpoch();
ItemManager::updateRandomSeed(m_item_seed);
m_game_setup->setRace(winner_vote, m_extra_seconds);

// For spectators that don't have the track, remember their
// spectate mode and don't load the track
std::string track_name = winner_vote.m_track_name;
if (ServerConfig::m_soccer_tournament)
{
Expand All @@ -1208,13 +1211,14 @@ void ServerLobby::asynchronousUpdate()
m_tournament_arenas[m_tournament_game] = track_name;
}
auto peers = STKHost::get()->getPeers();
std::map<std::shared_ptr<STKPeer>, AlwaysSpectateMode> bad_spectators;
std::map<std::shared_ptr<STKPeer>,
AlwaysSpectateMode> previous_spectate_mode;
for (auto peer : peers)
{
if (peer->alwaysSpectate() &&
peer->getClientAssets().second.count(track_name) == 0)
{
bad_spectators[peer] = peer->getAlwaysSpectate();
previous_spectate_mode[peer] = peer->getAlwaysSpectate();
peer->setAlwaysSpectate(ASM_NONE);
peer->setWaitingForGame(true);
m_peers_ready.erase(peer);
Expand All @@ -1223,8 +1227,9 @@ void ServerLobby::asynchronousUpdate()
bool has_always_on_spectators = false;
auto players = STKHost::get()
->getPlayersForNewGame(&has_always_on_spectators);
for (auto& p: bad_spectators)
p.first->setAlwaysSpectate(p.second);
for (auto& p: previous_spectate_mode)
if (p.first)
p.first->setAlwaysSpectate(p.second);
auto ai_instance = m_ai_peer.lock();
if (supportsAI())
{
Expand Down Expand Up @@ -1315,7 +1320,7 @@ void ServerLobby::asynchronousUpdate()
sendMessageToPeers(load_world_message);
// updatePlayerList so the in lobby players (if any) can see always
// spectators join the game
if (has_always_on_spectators || !bad_spectators.empty())
if (has_always_on_spectators || !previous_spectate_mode.empty())
updatePlayerList();
delete load_world_message;

Expand Down Expand Up @@ -3994,7 +3999,12 @@ void ServerLobby::handleUnencryptedConnection(std::shared_ptr<STKPeer> peer,
unsigned max_players = ServerConfig::m_server_max_players;
// We need to reserve at least 1 slot for new player
if (player_count + ai_add + 1 > max_players)
ai_add = max_players - player_count - 1;
{
if (max_players >= player_count + 1)
ai_add = max_players - player_count - 1;
else
ai_add = 0;
}
for (unsigned i = 0; i < ai_add; i++)
{
#ifdef SERVER_ONLY
Expand Down
6 changes: 3 additions & 3 deletions src/network/stk_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,12 @@ class STKPeer : public NoCopy
m_default_always_spectate.store(mode);
}
// ------------------------------------------------------------------------
bool alwaysSpectate() const
{ return m_always_spectate.load() != ASM_NONE; }
// ------------------------------------------------------------------------
AlwaysSpectateMode getAlwaysSpectate() const
{ return (AlwaysSpectateMode)m_always_spectate.load(); }
// ------------------------------------------------------------------------
bool alwaysSpectate() const
{ return m_always_spectate.load() != ASM_NONE; }
// ------------------------------------------------------------------------
bool isCommandSpectator() const
{ return m_always_spectate.load() == ASM_COMMAND; }
// ------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/states_screens/arenas_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
Track* clicked_track = track_manager->getTrack(selection);
if (clicked_track != NULL)
{
// In favorite edit mode, switch the status of the selected track
if (getWidget<CheckBoxWidget>("favorite")->getState())
{
if(PlayerManager::getCurrentPlayer()->isFavoriteTrack(clicked_track->getIdent()))
Expand Down
6 changes: 3 additions & 3 deletions src/states_screens/kart_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ EventPropagation FocusDispatcher::focused(const int player_id)
// ->getIrrlichtElement()->getID() <<
// ")" << std::endl;

m_parent->m_kart_widgets[n].m_player_ident_spinner
->setFocusForPlayer(player_id);

m_parent->m_kart_widgets[n].m_player_ident_spinner->setFocusForPlayer(player_id);

return GUIEngine::EVENT_BLOCK;
}
Expand Down Expand Up @@ -438,6 +436,8 @@ void KartSelectionScreen::init()
// if kart from config not found, select the first instead
w->setSelection(0, 0, true);
}

m_dispatcher->setVisible(false);
}
else
{
Expand Down
Loading

0 comments on commit 12efb28

Please sign in to comment.