Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Commit e9bbf92

Browse files
authored
Merge pull request #505 from MAFINS/patch-searchFavourites
2 parents 1bddc8d + 6e1b3fc commit e9bbf92

File tree

8 files changed

+66
-23
lines changed

8 files changed

+66
-23
lines changed

Solution/source/Submenus/PedAnimation.cpp

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ namespace sub
4545

4646
namespace AnimationSub_catind
4747
{
48+
std::string _searchStr = std::string();
49+
void ClearSearchStr() { _searchStr.clear(); }
50+
4851
//struct NamedAnimation { std::string caption; std::string animDict, animName; };
4952
const std::vector<AnimationSub_catind::NamedAnimation> vPresetPedAnims
5053
{
@@ -174,13 +177,13 @@ namespace sub
174177

175178
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), searchobj, nullFunc, -1, true); if (searchobj)
176179
{
177-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
180+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
178181
boost::to_lower(_searchStr);
179182
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToLower, _searchStr, 126U, std::string(), _searchStr);
180183
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
181184
}
182185

183-
AddOption("Stop Animation", null, AnimationSub_StopAnimationCallback);
186+
AddTickol("Stop Animation", true, AnimationSub_StopAnimationCallback, AnimationSub_StopAnimationCallback, TICKOL::CROSS);
184187

185188
for (auto& current : vAllPedAnims)
186189
{
@@ -193,9 +196,14 @@ namespace sub
193196
notFoundInDict = true;
194197
for (auto& current2 : current.second)
195198
{
196-
if (current2.find(_searchStr) != std::string::npos) { notFoundInDict = false; break; }
199+
if (current2.find(_searchStr) != std::string::npos)
200+
{
201+
notFoundInDict = false;
202+
break;
203+
}
197204
}
198-
if (notFoundInDict) { continue; }
205+
if (notFoundInDict)
206+
continue;
199207
}
200208
}
201209

@@ -437,7 +445,7 @@ namespace sub
437445
SET_PED_IS_IGNORED_BY_AUTO_OPEN_DOORS(Static_241, TRUE);
438446

439447
AddTitle("Animations");
440-
AddOption("Stop Animation", null, AnimationSub_StopAnimationCallback);
448+
AddTickol("Stop Animation", true, AnimationSub_StopAnimationCallback, AnimationSub_StopAnimationCallback, TICKOL::CROSS);
441449
AddanimOption_("Pole Dance", "mini@strip_club@pole_dance@pole_dance3", "pd_dance_03");
442450
AddanimOption_("Hood Dance", "missfbi3_sniping", "dance_m_default");
443451
AddanimOption_("Burning", "ragdoll@human", "on_fire");
@@ -561,16 +569,34 @@ namespace sub
561569
Menu::SetSub_previous();
562570
return;
563571
}
564-
565572
auto nodeAnims = doc.child("PedAnims");
566573

574+
Menu::OnSubBack = AnimationSub_catind::ClearSearchStr;
575+
auto& _searchStr = AnimationSub_catind::_searchStr;
576+
567577
AddTitle("Favourites");
568578

579+
bool bSearchPressed = false;
580+
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
581+
{
582+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
583+
boost::to_lower(_searchStr);
584+
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
585+
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
586+
}
587+
569588
for (auto nodeAnim = nodeAnims.first_child(); nodeAnim; nodeAnim = nodeAnim.next_sibling())
570589
{
571590
std::string dict = nodeAnim.attribute("dict").as_string();
572591
std::string name = nodeAnim.attribute("name").as_string();
573592

593+
if (!_searchStr.empty())
594+
{
595+
if (dict.find(_searchStr) == std::string::npos &&
596+
name.find(_searchStr) == std::string::npos)
597+
continue;
598+
}
599+
574600
AddanimOption_(dict + ", " + name, dict, name);
575601
}
576602
}
@@ -1156,7 +1182,7 @@ namespace sub
11561182
AddOption("ALL SCENARIOS", clearSearchStr, nullFunc, SUB::ANIMATIONSUB_TASKSCENARIOS2); if (clearSearchStr)
11571183
_searchStr.clear();
11581184

1159-
AddOption("End Scenarios", null, stopScenarioPls);
1185+
AddTickol("End Scenarios", true, stopScenarioPls, stopScenarioPls, TICKOL::CROSS);
11601186

11611187
for (auto& scen : vNamedScenarios)
11621188
{
@@ -1171,13 +1197,13 @@ namespace sub
11711197

11721198
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), searchobj, nullFunc, -1, true); if (searchobj)
11731199
{
1174-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
1200+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
11751201
boost::to_lower(_searchStr);
11761202
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToLower, _searchStr, 126U, std::string(), _searchStr);
11771203
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
11781204
}
11791205

1180-
AddOption("End Scenarios", null, stopScenarioPls);
1206+
AddTickol("End Scenarios", true, stopScenarioPls, stopScenarioPls, TICKOL::CROSS);
11811207

11821208
for (auto& current : vValues_TaskScenarios)
11831209
{

Solution/source/Submenus/PedComponentChanger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ namespace sub
14881488
bool bSearchPressed = false;
14891489
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
14901490
{
1491-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
1491+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
14921492
boost::to_upper(_searchStr);
14931493
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
14941494
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);

Solution/source/Submenus/PedModelChanger.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ namespace sub
4343
namespace PedFavourites_catind
4444
{
4545
std::string xmlFavouritePeds = "FavouritePeds.xml";
46+
std::string _searchStr = std::string();
47+
48+
void ClearSearchStr() { _searchStr.clear(); }
49+
4650
bool IsPedAFavourite(GTAmodel::Model model)
4751
{
4852
pugi::xml_document doc;
@@ -130,6 +134,8 @@ namespace sub
130134

131135
void Sub_PedFavourites()
132136
{
137+
Menu::OnSubBack = ClearSearchStr;
138+
133139
AddTitle("Favourites");
134140

135141
pugi::xml_document doc;
@@ -176,11 +182,22 @@ namespace sub
176182
{
177183
AddBreak("---Added Ped Models---");
178184

185+
bool bSearchPressed = false;
186+
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
187+
{
188+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
189+
boost::to_upper(_searchStr);
190+
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
191+
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
192+
}
193+
179194
for (auto nodeLocToLoad = nodeRoot.first_child(); nodeLocToLoad; nodeLocToLoad = nodeLocToLoad.next_sibling())
180195
{
181196
const std::string& customName = nodeLocToLoad.attribute("customName").as_string();
182197
Model model = nodeLocToLoad.attribute("hash").as_uint();
183198

199+
if (!_searchStr.empty()) { if (boost::to_upper_copy(customName).find(_searchStr) == std::string::npos) continue; }
200+
184201
AddmodelOption_(customName, model);
185202
}
186203
}

Solution/source/Submenus/PedSpeech.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ namespace sub
397397
bool bSearchPressed = false;
398398
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
399399
{
400-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
400+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
401401
boost::to_upper(_searchStr);
402402
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
403403
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -433,7 +433,7 @@ namespace sub
433433
bool bSearchPressed = false;
434434
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
435435
{
436-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
436+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
437437
boost::to_upper(_searchStr);
438438
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
439439
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);

Solution/source/Submenus/Spooner/Submenus.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ namespace sub
334334
bool bSearchPressed = false;
335335
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
336336
{
337-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
337+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
338338
boost::to_upper(_searchStr);
339339
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
340340
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -400,7 +400,7 @@ namespace sub
400400
bool bSearchPressed = false;
401401
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
402402
{
403-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
403+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
404404
boost::to_upper(_searchStr);
405405
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
406406
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -2930,7 +2930,7 @@ namespace sub
29302930
bool bSearchPressed = false;
29312931
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
29322932
{
2933-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
2933+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
29342934
boost::to_lower(_searchStr);
29352935
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToLower, _searchStr, 126U, std::string(), _searchStr);
29362936
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -3064,7 +3064,7 @@ namespace sub
30643064
bool bSearchPressed = false;
30653065
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
30663066
{
3067-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
3067+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
30683068
boost::to_lower(_searchStr);
30693069
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToLower, _searchStr, 126U, std::string(), _searchStr);
30703070
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);

Solution/source/Submenus/Spooner/Submenus_TaskSequence.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ namespace sub::Spooner
518518
bool searchobj = false;
519519
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), searchobj, nullFunc, -1, true); if (searchobj)
520520
{
521-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
521+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
522522
boost::to_lower(_searchStr);
523523
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToLower, _searchStr, 126U, std::string(), _searchStr);
524524
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -688,7 +688,7 @@ namespace sub::Spooner
688688

689689
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), searchobj, nullFunc, -1, true); if (searchobj)
690690
{
691-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
691+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
692692
boost::to_lower(_searchStr);
693693
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToLower, _searchStr, 126U, std::string(), _searchStr);
694694
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -857,7 +857,7 @@ namespace sub::Spooner
857857
bool bSearchPressed = false;
858858
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
859859
{
860-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
860+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
861861
boost::to_upper(_searchStr);
862862
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
863863
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);

Solution/source/Submenus/VehicleSpawner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ namespace sub
13421342
bool bSearchPressed = false;
13431343
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
13441344
{
1345-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
1345+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
13461346
boost::to_upper(_searchStr);
13471347
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
13481348
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -2098,7 +2098,7 @@ namespace sub
20982098
bool bSearchPressed = false;
20992099
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
21002100
{
2101-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
2101+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
21022102
boost::to_upper(_searchStr);
21032103
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
21042104
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);

Solution/source/Submenus/WeaponOptions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ namespace sub
14881488
bool bSearchPressed = false;
14891489
AddOption(_searchStr.empty() ? "SEARCH" : _searchStr, bSearchPressed, nullFunc, -1, true); if (bSearchPressed)
14901490
{
1491-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
1491+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", boost::to_lower_copy(_searchStr));
14921492
boost::to_upper(_searchStr);
14931493
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToUpper, _searchStr, 126U, std::string(), _searchStr);
14941494
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);
@@ -1731,7 +1731,7 @@ namespace sub
17311731

17321732
AddOption(_searchStr.empty() ? "SEARCH" : boost::to_upper_copy(_searchStr), searchobj, nullFunc, -1, true); if (searchobj)
17331733
{
1734-
_searchStr = Game::InputBox(_searchStr, 126U, "", _searchStr);
1734+
_searchStr = Game::InputBox(_searchStr, 126U, "SEARCH", _searchStr);
17351735
boost::to_lower(_searchStr);
17361736
//OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::SearchToLower, _searchStr, 126U, std::string(), _searchStr);
17371737
//OnscreenKeyboard::State::arg1._ptr = reinterpret_cast<void*>(&_searchStr);

0 commit comments

Comments
 (0)