MCPcopy Create free account
hub / github.com/TurningWheel/Barony / buttonOpenCharacterCreationWindow

Function buttonOpenCharacterCreationWindow

src/menu.cpp:11556–11673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11554}
11555
11556void buttonOpenCharacterCreationWindow(button_t* my)
11557{
11558 button_t* button;
11559
11560 playing_random_char = false;
11561 loadingsavegame = 0;
11562 loadinglobbykey = 0;
11563 loadGameSaveShowRectangle = 0;
11564 // reset class loadout
11565 clientnum = 0;
11566 stats[0]->sex = static_cast<sex_t>(0 + local_rng.rand() % 2);
11567 stats[0]->stat_appearance = 0 + local_rng.rand() % NUMAPPEARANCES;
11568 stats[0]->playerRace = RACE_HUMAN;
11569 strcpy(stats[0]->name, "");
11570 stats[0]->type = HUMAN;
11571 client_classes[0] = 0;
11572 stats[0]->clearStats();
11573 initClass(0);
11574
11575 // close current window
11576 if ( subwindow )
11577 {
11578 buttonCloseSubwindow(NULL);
11579 list_FreeAll(&button_l);
11580 deleteallbuttons = true;
11581 }
11582
11583 // create character creation window
11584 charcreation_step = 1;
11585 raceSelect = 0;
11586 camera_charsheet_offsetyaw = (330) * PI / 180;
11587 subwindow = 1;
11588 subx1 = xres / 2 - 400;
11589 subx2 = xres / 2 + 400;
11590 suby1 = yres / 2 - 260;
11591 suby2 = yres / 2 + 260;
11592 strcpy(subtext, "");
11593
11594 // close button
11595 button = newButton();
11596 strcpy(button->label, "x");
11597 button->x = subx2 - 20;
11598 button->y = suby1;
11599 button->sizex = 20;
11600 button->sizey = 20;
11601 button->action = &buttonCloseSubwindow;
11602 button->visible = 1;
11603 button->focused = 1;
11604 button->joykey = joyimpulses[INJOY_PAUSE_MENU];
11605
11606 //if ( lastCreatedCharacterClass >= 0
11607 // && lastCreatedCharacterAppearance >= 0
11608 // && lastCreatedCharacterSex >= 0 )
11609 //{
11610 // button_t* replayCharacterBtn = newButton();
11611 // strcpy(replayCharacterBtn->label, Language::get(3000));
11612 // replayCharacterBtn->sizex = strlen(Language::get(3000)) * 12 + 8;
11613 // replayCharacterBtn->sizey = 20;

Callers 1

handleMainMenuFunction · 0.85

Calls 6

list_FreeAllFunction · 0.85
newButtonFunction · 0.85
randMethod · 0.80
initClassFunction · 0.70
buttonCloseSubwindowFunction · 0.70
clearStatsMethod · 0.45

Tested by

no test coverage detected