|
|
|
|
@ -1,12 +1,14 @@
|
|
|
|
|
#include "selhero.h" |
|
|
|
|
|
|
|
|
|
#include <algorithm> |
|
|
|
|
#include <chrono> |
|
|
|
|
#include <random> |
|
|
|
|
|
|
|
|
|
#include "scrollbar.h" |
|
|
|
|
#include "selyesno.h" |
|
|
|
|
#include "DiabloUI/diabloui.h" |
|
|
|
|
#include "DiabloUI/dialogs.h" |
|
|
|
|
#include "devilution.h" |
|
|
|
|
#include "scrollbar.h" |
|
|
|
|
#include "selyesno.h" |
|
|
|
|
|
|
|
|
|
namespace dvl { |
|
|
|
|
|
|
|
|
|
@ -241,6 +243,9 @@ void selhero_ClassSelector_Select(int value)
|
|
|
|
|
strcpy(title, "New Multi Player Hero"); |
|
|
|
|
} |
|
|
|
|
memset(selhero_heroInfo.name, '\0', sizeof(selhero_heroInfo.name)); |
|
|
|
|
#ifdef PREFILL_PLAYER_NAME |
|
|
|
|
strcpy(selhero_heroInfo.name, selhero_GenerateName(selhero_heroInfo.heroclass)); |
|
|
|
|
#endif |
|
|
|
|
UiInitList(0, 0, NULL, selhero_Name_Select, selhero_Name_Esc, ENTERNAME_DIALOG, size(ENTERNAME_DIALOG)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -370,4 +375,51 @@ BOOL UiSelHeroMultDialog(
|
|
|
|
|
selhero_isMultiPlayer = true; |
|
|
|
|
return UiSelHeroDialog(fninfo, fncreate, fnstats, fnremove, dlgresult, name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const char *selhero_GenerateName(std::uint8_t hero_class) |
|
|
|
|
{ |
|
|
|
|
static const char *const kNames[3][10] = { |
|
|
|
|
{ |
|
|
|
|
"Aidan", |
|
|
|
|
"Qarak", |
|
|
|
|
"Born", |
|
|
|
|
"Cathan", |
|
|
|
|
"Halbu", |
|
|
|
|
"Lenalas", |
|
|
|
|
"Maximus", |
|
|
|
|
"Vane", |
|
|
|
|
"Myrdgar", |
|
|
|
|
"Rothat", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"Moreina", |
|
|
|
|
"Akara", |
|
|
|
|
"Kashya", |
|
|
|
|
"Flavie", |
|
|
|
|
"Divo", |
|
|
|
|
"Oriana", |
|
|
|
|
"Iantha", |
|
|
|
|
"Shikha", |
|
|
|
|
"Basanti", |
|
|
|
|
"Elexa", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"Jazreth", |
|
|
|
|
"Drognan", |
|
|
|
|
"Armin", |
|
|
|
|
"Fauztin", |
|
|
|
|
"Jere", |
|
|
|
|
"Kazzulk", |
|
|
|
|
"Ranslor", |
|
|
|
|
"Sarnakyle", |
|
|
|
|
"Valthek", |
|
|
|
|
"Horazon", |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
const auto seed = std::chrono::system_clock::now().time_since_epoch().count(); |
|
|
|
|
std::default_random_engine generator(seed); |
|
|
|
|
std::uniform_int_distribution<std::size_t> dist(0, sizeof(kNames[0]) / sizeof(kNames[0][0]) - 1); |
|
|
|
|
return kNames[hero_class][dist(generator)]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} // namespace dvl
|
|
|
|
|
|