mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
Add character creation screen with race/class/appearance customization
Implements a full character creation UI integrated into the existing flow. In single-player mode, auth screen now goes to character creation before entering the world. In online mode, a "Create Character" button on the character selection screen sends CMSG_CHAR_CREATE to the server. Includes WoW 3.3.5a race/class combo validation and appearance range limits.
This commit is contained in:
parent
f19c060078
commit
cf54db4554
16 changed files with 611 additions and 30 deletions
42
include/ui/character_create_screen.hpp
Normal file
42
include/ui/character_create_screen.hpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include "game/character.hpp"
|
||||
#include "game/world_packets.hpp"
|
||||
#include <imgui.h>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace game { class GameHandler; }
|
||||
|
||||
namespace ui {
|
||||
|
||||
class CharacterCreateScreen {
|
||||
public:
|
||||
CharacterCreateScreen();
|
||||
|
||||
void render(game::GameHandler& gameHandler);
|
||||
void setOnCreate(std::function<void(const game::CharCreateData&)> cb) { onCreate = std::move(cb); }
|
||||
void setOnCancel(std::function<void()> cb) { onCancel = std::move(cb); }
|
||||
void setStatus(const std::string& msg, bool isError = false);
|
||||
void reset();
|
||||
|
||||
private:
|
||||
char nameBuffer[13] = {}; // WoW max name = 12 chars + null
|
||||
int raceIndex = 0;
|
||||
int classIndex = 0;
|
||||
int genderIndex = 0;
|
||||
int skin = 0, face = 0, hairStyle = 0, hairColor = 0, facialHair = 0;
|
||||
std::string statusMessage;
|
||||
bool statusIsError = false;
|
||||
|
||||
std::vector<game::Class> availableClasses;
|
||||
void updateAvailableClasses();
|
||||
|
||||
std::function<void(const game::CharCreateData&)> onCreate;
|
||||
std::function<void()> onCancel;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
} // namespace wowee
|
||||
|
|
@ -30,6 +30,8 @@ public:
|
|||
onCharacterSelected = callback;
|
||||
}
|
||||
|
||||
void setOnCreateCharacter(std::function<void()> cb) { onCreateCharacter = std::move(cb); }
|
||||
|
||||
/**
|
||||
* Check if a character has been selected
|
||||
*/
|
||||
|
|
@ -51,6 +53,7 @@ private:
|
|||
|
||||
// Callbacks
|
||||
std::function<void(uint64_t)> onCharacterSelected;
|
||||
std::function<void()> onCreateCharacter;
|
||||
|
||||
/**
|
||||
* Update status message
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "ui/auth_screen.hpp"
|
||||
#include "ui/realm_screen.hpp"
|
||||
#include "ui/character_create_screen.hpp"
|
||||
#include "ui/character_screen.hpp"
|
||||
#include "ui/game_screen.hpp"
|
||||
#include <memory>
|
||||
|
|
@ -64,6 +65,7 @@ public:
|
|||
*/
|
||||
AuthScreen& getAuthScreen() { return *authScreen; }
|
||||
RealmScreen& getRealmScreen() { return *realmScreen; }
|
||||
CharacterCreateScreen& getCharacterCreateScreen() { return *characterCreateScreen; }
|
||||
CharacterScreen& getCharacterScreen() { return *characterScreen; }
|
||||
GameScreen& getGameScreen() { return *gameScreen; }
|
||||
|
||||
|
|
@ -73,6 +75,7 @@ private:
|
|||
// UI Screens
|
||||
std::unique_ptr<AuthScreen> authScreen;
|
||||
std::unique_ptr<RealmScreen> realmScreen;
|
||||
std::unique_ptr<CharacterCreateScreen> characterCreateScreen;
|
||||
std::unique_ptr<CharacterScreen> characterScreen;
|
||||
std::unique_ptr<GameScreen> gameScreen;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue