1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix stats mouse handling with difficult skill level

- It fixes the navigation with the arrows
- It fixes the highlight and disable properly the move to an ennemy

Closes #69
This commit is contained in:
Mathieu Schroeter 2018-08-24 23:59:58 +02:00
parent e343821d26
commit 89ddbb6a83
4 changed files with 24 additions and 10 deletions

View File

@ -370,9 +370,9 @@ public:
void StatisticDraw ();
void GenerateStatictic ();
bool StatisticDown (Point pos);
bool StatisticMove (Point pos);
bool StatisticMove (Point pos, bool & disable);
bool StatisticUp (Point pos);
Sint32 StatisticDetect (Point pos);
Sint32 StatisticDetect (Point pos, bool & disable);
// Chemin.cpp
void CheminMemPos (Sint32 exRank);

View File

@ -807,8 +807,9 @@ CDecor::StatisticDown (Point pos)
StatisticUpdate ();
hili = StatisticDetect (pos);
if (hili < 0)
bool disable;
hili = StatisticDetect (pos, disable);
if (hili < 0 || disable)
return false;
if (m_bStatUp && hili == 0) // flèche up ?
@ -984,11 +985,11 @@ select:
// Souris déplacée dans les statistiques.
bool
CDecor::StatisticMove (Point pos)
CDecor::StatisticMove (Point pos, bool & disable)
{
Sint32 rank;
rank = StatisticDetect (pos);
rank = StatisticDetect (pos, disable);
if (rank != m_statHili) // autre mise en évidence ?
m_statHili = rank;
@ -1007,10 +1008,12 @@ CDecor::StatisticUp (Point pos)
// Détecte dans quelle statistique est la souris.
Sint32
CDecor::StatisticDetect (Point pos)
CDecor::StatisticDetect (Point pos, bool & disable)
{
Sint32 rank;
disable = false;
// Dans un bouton stop/setup/write ?
if (pos.x >= 10 && pos.x <= 10 + 42 * 3 && pos.y >= 422 && pos.y <= 422 + 40)
{
@ -1029,12 +1032,18 @@ CDecor::StatisticDetect (Point pos)
if (rank >= STATNB)
return -1;
auto pStatistic = StatisticGet (rank);
if (rank == 11 && this->m_bStatDown)
return rank;
if (rank == 0 && this->m_bStatUp)
return rank;
auto pStatistic = StatisticGet (m_statFirst + rank - !!m_bStatUp);
if (
this->GetSkill () >= 1 && pStatistic->perso >= 0 &&
(pStatistic->perso != 0 && pStatistic->perso != 8))
{
return -1;
disable = true;
}
return rank;

View File

@ -1703,6 +1703,7 @@ CEvent::CEvent ()
m_updateBlinking = 0;
this->shiftDirection = 0;
this->statDisabled = false;
}
// Destructeur.
@ -2875,6 +2876,9 @@ CEvent::MousePosToSprite (Point pos)
if (bRight && bDown)
sprite = SPRITE_ARROWDR;
}
if (this->statDisabled)
sprite = SPRITE_ARROW;
}
else if (m_phase == EV_PHASE_INTRO1)
sprite = SPRITE_POINTER;
@ -3995,7 +3999,7 @@ CEvent::PlayMove (Point pos)
return true;
}
m_pDecor->StatisticMove (pos);
m_pDecor->StatisticMove (pos, this->statDisabled);
if (m_bMouseDown) // bouton souris pressé ?
{

View File

@ -274,6 +274,7 @@ protected:
Sint32 m_updateBlinking;
std::string m_updateVersion;
Uint32 shiftDirection;
bool statDisabled;
};
/////////////////////////////////////////////////////////////////////////////