mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add character screen model preview, item icons, stats panel, and fix targeting bugs
Enhanced the C-key character screen with a 3-column layout featuring a 3D character model preview (with drag-to-rotate), item icons loaded from BLP textures via ItemDisplayInfo.dbc, and a stats panel showing base + equipment bonuses. Fixed selection circle clipping under terrain by adding a Z offset, and corrected faction hostility logic that was wrongly marking hostile mobs as friendly.
This commit is contained in:
parent
7128ea1417
commit
394e91cd9e
12 changed files with 738 additions and 53 deletions
|
|
@ -1,21 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include "game/inventory.hpp"
|
||||
#include "game/character.hpp"
|
||||
#include "game/world_packets.hpp"
|
||||
#include <GL/glew.h>
|
||||
#include <imgui.h>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline { class AssetManager; }
|
||||
namespace rendering { class CharacterPreview; class CharacterRenderer; }
|
||||
namespace game { class GameHandler; }
|
||||
namespace ui {
|
||||
|
||||
class InventoryScreen {
|
||||
public:
|
||||
~InventoryScreen();
|
||||
|
||||
/// Render bags window (B key). Positioned at bottom of screen.
|
||||
void render(game::Inventory& inventory, uint64_t moneyCopper);
|
||||
|
||||
/// Render character screen (C key). Standalone equipment window.
|
||||
void renderCharacterScreen(game::Inventory& inventory);
|
||||
void renderCharacterScreen(game::GameHandler& gameHandler);
|
||||
|
||||
bool isOpen() const { return open; }
|
||||
void toggle() { open = !open; }
|
||||
|
|
@ -31,6 +39,21 @@ public:
|
|||
gameHandler_ = handler;
|
||||
}
|
||||
|
||||
/// Set asset manager for icon/model loading
|
||||
void setAssetManager(pipeline::AssetManager* am) { assetManager_ = am; }
|
||||
|
||||
/// Store player appearance for character preview
|
||||
void setPlayerAppearance(game::Race race, game::Gender gender,
|
||||
uint8_t skin, uint8_t face,
|
||||
uint8_t hairStyle, uint8_t hairColor,
|
||||
uint8_t facialHair);
|
||||
|
||||
/// Mark the character preview as needing equipment update
|
||||
void markPreviewDirty() { previewDirty_ = true; }
|
||||
|
||||
/// Update the preview animation (call each frame)
|
||||
void updatePreview(float deltaTime);
|
||||
|
||||
/// Returns true if equipment changed since last call, and clears the flag.
|
||||
bool consumeEquipmentDirty() { bool d = equipmentDirty; equipmentDirty = false; return d; }
|
||||
/// Returns true if any inventory slot changed since last call, and clears the flag.
|
||||
|
|
@ -48,6 +71,30 @@ private:
|
|||
bool vendorMode_ = false;
|
||||
game::GameHandler* gameHandler_ = nullptr;
|
||||
|
||||
// Asset manager for icons and preview
|
||||
pipeline::AssetManager* assetManager_ = nullptr;
|
||||
|
||||
// Item icon cache: displayInfoId -> GL texture
|
||||
std::unordered_map<uint32_t, GLuint> iconCache_;
|
||||
GLuint getItemIcon(uint32_t displayInfoId);
|
||||
|
||||
// Character model preview
|
||||
std::unique_ptr<rendering::CharacterPreview> charPreview_;
|
||||
bool previewInitialized_ = false;
|
||||
bool previewDirty_ = false;
|
||||
|
||||
// Stored player appearance for preview
|
||||
game::Race playerRace_ = game::Race::HUMAN;
|
||||
game::Gender playerGender_ = game::Gender::MALE;
|
||||
uint8_t playerSkin_ = 0;
|
||||
uint8_t playerFace_ = 0;
|
||||
uint8_t playerHairStyle_ = 0;
|
||||
uint8_t playerHairColor_ = 0;
|
||||
uint8_t playerFacialHair_ = 0;
|
||||
|
||||
void initPreview();
|
||||
void updatePreviewEquipment(game::Inventory& inventory);
|
||||
|
||||
// Drag-and-drop held item state
|
||||
bool holdingItem = false;
|
||||
game::ItemDef heldItem;
|
||||
|
|
@ -58,6 +105,7 @@ private:
|
|||
|
||||
void renderEquipmentPanel(game::Inventory& inventory);
|
||||
void renderBackpackPanel(game::Inventory& inventory);
|
||||
void renderStatsPanel(game::Inventory& inventory, uint32_t playerLevel);
|
||||
|
||||
// Slot rendering with interaction support
|
||||
enum class SlotKind { BACKPACK, EQUIPMENT };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue