mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
Compare commits
16 Commits
a04449bd67
...
c8f6a451d7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8f6a451d7 | ||
|
|
d859670f7b | ||
|
|
05d949523c | ||
|
|
04c3dac382 | ||
|
|
6860d86369 | ||
|
|
e56bde0dde | ||
|
|
c6a89b5ef8 | ||
|
|
79b6a47b9a | ||
|
|
8935c520c0 | ||
|
|
7cf7127810 | ||
|
|
8fb51991e0 | ||
|
|
7fdd22545f | ||
|
|
15eafe92d7 | ||
|
|
1ad3679f90 | ||
|
|
81970958a8 | ||
|
|
a9cad5238d |
@ -32,6 +32,8 @@ if(WHOA_SYSTEM_MAC)
|
||||
"-framework AppKit"
|
||||
"-framework Carbon"
|
||||
"-framework IOKit"
|
||||
"-framework Metal"
|
||||
"-framework QuartzCore"
|
||||
)
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mac/MainMenu.nib DESTINATION "bin")
|
||||
|
||||
9
src/app/mac/EngineMTLLayerView.h
Normal file
9
src/app/mac/EngineMTLLayerView.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef APP_MAC_ENGINE_MTL_LAYER_VIEW_H
|
||||
#define APP_MAC_ENGINE_MTL_LAYER_VIEW_H
|
||||
|
||||
#include "app/mac/EngineGLLayerView.h"
|
||||
|
||||
@interface EngineMTLLayerView : EngineGLLayerView
|
||||
@end
|
||||
|
||||
#endif
|
||||
36
src/app/mac/EngineMTLLayerView.mm
Normal file
36
src/app/mac/EngineMTLLayerView.mm
Normal file
@ -0,0 +1,36 @@
|
||||
#include "app/mac/EngineMTLLayerView.h"
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
|
||||
@implementation EngineMTLLayerView
|
||||
|
||||
- (CALayer*)makeBackingLayer {
|
||||
return [CAMetalLayer layer];
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(NSRect)frame glWindow:(GLWindow*)window {
|
||||
self = [super initWithFrame:frame glWindow:window];
|
||||
|
||||
if (self) {
|
||||
[self setWantsLayer:YES];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)dirtyRect {
|
||||
// Rendering is driven by CGxDeviceMTL.
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
[super update];
|
||||
|
||||
if (![self.layer isKindOfClass:[CAMetalLayer class]]) {
|
||||
return;
|
||||
}
|
||||
|
||||
CAMetalLayer* layer = (CAMetalLayer*)self.layer;
|
||||
CGSize size = [self convertSizeToBacking:self.bounds.size];
|
||||
layer.drawableSize = size;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,7 +1,9 @@
|
||||
#include "app/mac/View.h"
|
||||
#include "app/mac/EngineGLLayerView.h"
|
||||
#include "app/mac/EngineMTLLayerView.h"
|
||||
#include "app/mac/WindowCallbacks.h"
|
||||
#include "gx/gll/GLWindow.h"
|
||||
#include "gx/Device.hpp"
|
||||
|
||||
GLWindowCallbacks EngineViewCallbacks = {
|
||||
&MacOnResized,
|
||||
@ -23,5 +25,9 @@ void AssignEngineViewCallbacks(GLWindowCallbacks* callbacks) {
|
||||
}
|
||||
|
||||
Class GetEngineViewClass() {
|
||||
if (GxDevApi() == GxApi_Metal) {
|
||||
return [EngineMTLLayerView class];
|
||||
}
|
||||
|
||||
return [EngineGLLayerView class];
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "app/mac/MacClient.h"
|
||||
#include "event/Input.hpp"
|
||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||
#include "gx/Device.hpp"
|
||||
#include "gx/Window.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
@ -171,7 +172,11 @@ void MacOnResized(int32_t width, int32_t height, bool a3) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GxDevApi() == GxApi_GLL) {
|
||||
static_cast<CGxDeviceGLL*>(g_theGxDevicePtr)->Resize(width, height);
|
||||
} else if (GxDevApi() == GxApi_Metal) {
|
||||
static_cast<CGxDeviceMTL*>(g_theGxDevicePtr)->Resize(width, height);
|
||||
}
|
||||
|
||||
OsQueuePut(OS_INPUT_SIZE, width, height, 0, 0);
|
||||
|
||||
|
||||
@ -121,6 +121,10 @@ bool ComponentCompressCallback(CVar* var, const char* oldValue, const char* valu
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReplaceParticleColor(CM2Model* model, int32_t particleColorID) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
int32_t CCharacterComponent::AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t visualID) {
|
||||
if (!model || !displayRec || invSlot > INVSLOT_TABARD) {
|
||||
return -1;
|
||||
@ -247,6 +251,26 @@ CCharacterComponent* CCharacterComponent::AllocComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
void CCharacterComponent::ApplyMonsterGeosets(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec) {
|
||||
if (!model || !displayInfoRec || !displayInfoRec->m_creatureGeosetData) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int32_t group = 100, dataOfs = 0; group < 900; group += 100, dataOfs += 4) {
|
||||
auto section = (displayInfoRec->m_creatureGeosetData >> dataOfs) & 0xF;
|
||||
|
||||
if (section) {
|
||||
// Hide all sections in group
|
||||
model->SetGeometryVisible(group, group + 99, false);
|
||||
|
||||
// Show matching section
|
||||
model->SetGeometryVisible(group + section, group + section, true);
|
||||
}
|
||||
}
|
||||
|
||||
model->OptimizeVisibleGeometry();
|
||||
}
|
||||
|
||||
void CCharacterComponent::ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot) {
|
||||
uint32_t firstBone;
|
||||
uint32_t lastBone;
|
||||
@ -789,6 +813,54 @@ void CCharacterComponent::RemoveLinkpt(CM2Model* model, GEOCOMPONENTLINKS link)
|
||||
}
|
||||
}
|
||||
|
||||
void CCharacterComponent::ReplaceMonsterSkin(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec, const CreatureModelDataRec* modelDataRec) {
|
||||
if (!model || !displayInfoRec || !modelDataRec) {
|
||||
return;
|
||||
}
|
||||
|
||||
CStatus status;
|
||||
char texturePath[STORM_MAX_PATH];
|
||||
|
||||
// Copy model path to use as base path for texture
|
||||
auto src = modelDataRec->m_modelName;
|
||||
auto dst = texturePath;
|
||||
while (*src) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = '\0';
|
||||
|
||||
// Locate start of model file name
|
||||
auto lastSlash = strrchr(texturePath, '\\');
|
||||
auto modelFileName = lastSlash ? lastSlash + 1 : texturePath;
|
||||
|
||||
auto textureFlags = CGxTexFlags(GxTex_LinearMipLinear, 1, 1, 0, 0, 0, 1);
|
||||
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
auto textureName = displayInfoRec->m_textureVariation[i];
|
||||
|
||||
if (textureName[0] == '\0') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Replace model file name with texture name
|
||||
src = textureName;
|
||||
dst = modelFileName;
|
||||
while (*src) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = '\0';
|
||||
|
||||
auto texture = TextureCreate(texturePath, textureFlags, &status, 0);
|
||||
|
||||
if (texture) {
|
||||
model->ReplaceTexture(11 + i, texture);
|
||||
HandleClose(texture);
|
||||
}
|
||||
}
|
||||
|
||||
ReplaceParticleColor(model, displayInfoRec->m_particleColorID);
|
||||
}
|
||||
|
||||
void CCharacterComponent::UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels) {
|
||||
auto component = static_cast<CCharacterComponent*>(userArg);
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
class CACHEENTRY;
|
||||
class CCharacterComponent;
|
||||
class CharSectionsRec;
|
||||
class CreatureDisplayInfoRec;
|
||||
class CreatureModelDataRec;
|
||||
class ItemDisplayInfoRec;
|
||||
|
||||
struct BlpPalPixel;
|
||||
@ -51,6 +53,7 @@ class CCharacterComponent {
|
||||
static int32_t AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t a8);
|
||||
static void AddLink(CM2Model* parent, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t visualID, const ItemDisplayInfoRec* displayRec);
|
||||
static CCharacterComponent* AllocComponent();
|
||||
static void ApplyMonsterGeosets(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec);
|
||||
static void ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot);
|
||||
static void ComponentOpenFingers(CM2Model* model, COMP_HAND_SLOT handSlot);
|
||||
static HTEXTURE CreateTexture(const char* fileName, CStatus* status);
|
||||
@ -68,6 +71,7 @@ class CCharacterComponent {
|
||||
static void PasteTransparent4Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstWidth, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
|
||||
static void PasteTransparent8Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstWidth, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
|
||||
static void RemoveLinkpt(CM2Model* model, GEOCOMPONENTLINKS link);
|
||||
static void ReplaceMonsterSkin(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec, const CreatureModelDataRec* modelDataRec);
|
||||
static void UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels);
|
||||
|
||||
// Member variables
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include "gx/Adapter.hpp"
|
||||
#include "gx/Device.hpp"
|
||||
#include <storm/Array.hpp>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
static CGxDevice* s_device;
|
||||
@ -417,6 +418,13 @@ void ConsoleDeviceInitialize(const char* title) {
|
||||
api = GxApi_GLL;
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
const char* apiOverride = getenv("WHOA_GX_API");
|
||||
if (apiOverride && !strcmp(apiOverride, "metal")) {
|
||||
api = GxApi_Metal;
|
||||
}
|
||||
#endif
|
||||
|
||||
s_device = GxDevCreate(api, OsWindowProc, format);
|
||||
|
||||
// TODO
|
||||
|
||||
@ -12,7 +12,9 @@ WowClientDB<CharacterFacialHairStylesRec> g_characterFacialHairStylesDB;
|
||||
WowClientDB<ChrClassesRec> g_chrClassesDB;
|
||||
WowClientDB<ChrRacesRec> g_chrRacesDB;
|
||||
WowClientDB<CreatureDisplayInfoRec> g_creatureDisplayInfoDB;
|
||||
WowClientDB<CreatureDisplayInfoExtraRec> g_creatureDisplayInfoExtraDB;
|
||||
WowClientDB<CreatureModelDataRec> g_creatureModelDataDB;
|
||||
WowClientDB<CreatureSoundDataRec> g_creatureSoundDataDB;
|
||||
WowClientDB<FactionGroupRec> g_factionGroupDB;
|
||||
WowClientDB<FactionTemplateRec> g_factionTemplateDB;
|
||||
WowClientDB<ItemDisplayInfoRec> g_itemDisplayInfoDB;
|
||||
@ -21,6 +23,7 @@ WowClientDB<MapRec> g_mapDB;
|
||||
WowClientDB<PaperDollItemFrameRec> g_paperDollItemFrameDB;
|
||||
WowClientDB<SoundEntriesRec> g_soundEntriesDB;
|
||||
WowClientDB<SoundEntriesAdvancedRec> g_soundEntriesAdvancedDB;
|
||||
WowClientDB<UnitBloodLevelsRec> g_unitBloodLevelsDB;
|
||||
|
||||
void LoadDB(WowClientDB_Base* db, const char* filename, int32_t linenumber) {
|
||||
db->Load(filename, linenumber);
|
||||
@ -38,7 +41,9 @@ void StaticDBLoadAll(void (*loadFn)(WowClientDB_Base*, const char*, int32_t)) {
|
||||
loadFn(&g_chrClassesDB, __FILE__, __LINE__);
|
||||
loadFn(&g_chrRacesDB, __FILE__, __LINE__);
|
||||
loadFn(&g_creatureDisplayInfoDB, __FILE__, __LINE__);
|
||||
loadFn(&g_creatureDisplayInfoExtraDB, __FILE__, __LINE__);
|
||||
loadFn(&g_creatureModelDataDB, __FILE__, __LINE__);
|
||||
loadFn(&g_creatureSoundDataDB, __FILE__, __LINE__);
|
||||
loadFn(&g_factionGroupDB, __FILE__, __LINE__);
|
||||
loadFn(&g_factionTemplateDB, __FILE__, __LINE__);
|
||||
loadFn(&g_itemDisplayInfoDB, __FILE__, __LINE__);
|
||||
@ -47,6 +52,7 @@ void StaticDBLoadAll(void (*loadFn)(WowClientDB_Base*, const char*, int32_t)) {
|
||||
loadFn(&g_paperDollItemFrameDB, __FILE__, __LINE__);
|
||||
loadFn(&g_soundEntriesDB, __FILE__, __LINE__);
|
||||
loadFn(&g_soundEntriesAdvancedDB, __FILE__, __LINE__);
|
||||
loadFn(&g_unitBloodLevelsDB, __FILE__, __LINE__);
|
||||
};
|
||||
|
||||
void ClientDBInitialize() {
|
||||
|
||||
@ -13,7 +13,9 @@
|
||||
#include "db/rec/ChrClassesRec.hpp"
|
||||
#include "db/rec/ChrRacesRec.hpp"
|
||||
#include "db/rec/CreatureDisplayInfoRec.hpp"
|
||||
#include "db/rec/CreatureDisplayInfoExtraRec.hpp"
|
||||
#include "db/rec/CreatureModelDataRec.hpp"
|
||||
#include "db/rec/CreatureSoundDataRec.hpp"
|
||||
#include "db/rec/FactionGroupRec.hpp"
|
||||
#include "db/rec/FactionTemplateRec.hpp"
|
||||
#include "db/rec/ItemDisplayInfoRec.hpp"
|
||||
@ -22,6 +24,7 @@
|
||||
#include "db/rec/PaperDollItemFrameRec.hpp"
|
||||
#include "db/rec/SoundEntriesRec.hpp"
|
||||
#include "db/rec/SoundEntriesAdvancedRec.hpp"
|
||||
#include "db/rec/UnitBloodLevelsRec.hpp"
|
||||
|
||||
extern WowClientDB<AchievementRec> g_achievementDB;
|
||||
extern WowClientDB<AreaTableRec> g_areaTableDB;
|
||||
@ -34,7 +37,9 @@ extern WowClientDB<CharacterFacialHairStylesRec> g_characterFacialHairStylesDB;
|
||||
extern WowClientDB<ChrClassesRec> g_chrClassesDB;
|
||||
extern WowClientDB<ChrRacesRec> g_chrRacesDB;
|
||||
extern WowClientDB<CreatureDisplayInfoRec> g_creatureDisplayInfoDB;
|
||||
extern WowClientDB<CreatureDisplayInfoExtraRec> g_creatureDisplayInfoExtraDB;
|
||||
extern WowClientDB<CreatureModelDataRec> g_creatureModelDataDB;
|
||||
extern WowClientDB<CreatureSoundDataRec> g_creatureSoundDataDB;
|
||||
extern WowClientDB<FactionGroupRec> g_factionGroupDB;
|
||||
extern WowClientDB<FactionTemplateRec> g_factionTemplateDB;
|
||||
extern WowClientDB<ItemDisplayInfoRec> g_itemDisplayInfoDB;
|
||||
@ -43,6 +48,7 @@ extern WowClientDB<MapRec> g_mapDB;
|
||||
extern WowClientDB<PaperDollItemFrameRec> g_paperDollItemFrameDB;
|
||||
extern WowClientDB<SoundEntriesRec> g_soundEntriesDB;
|
||||
extern WowClientDB<SoundEntriesAdvancedRec> g_soundEntriesAdvancedDB;
|
||||
extern WowClientDB<UnitBloodLevelsRec> g_unitBloodLevelsDB;
|
||||
|
||||
void ClientDBInitialize();
|
||||
|
||||
|
||||
66
src/db/rec/CreatureDisplayInfoExtraRec.cpp
Normal file
66
src/db/rec/CreatureDisplayInfoExtraRec.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#include "db/rec/CreatureDisplayInfoExtraRec.hpp"
|
||||
#include "util/Locale.hpp"
|
||||
#include "util/SFile.hpp"
|
||||
|
||||
const char* CreatureDisplayInfoExtraRec::GetFilename() {
|
||||
return "DBFilesClient\\CreatureDisplayInfoExtra.dbc";
|
||||
}
|
||||
|
||||
uint32_t CreatureDisplayInfoExtraRec::GetNumColumns() {
|
||||
return 21;
|
||||
}
|
||||
|
||||
uint32_t CreatureDisplayInfoExtraRec::GetRowSize() {
|
||||
return 84;
|
||||
}
|
||||
|
||||
bool CreatureDisplayInfoExtraRec::NeedIDAssigned() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t CreatureDisplayInfoExtraRec::GetID() {
|
||||
return this->m_ID;
|
||||
}
|
||||
|
||||
void CreatureDisplayInfoExtraRec::SetID(int32_t id) {
|
||||
this->m_ID = id;
|
||||
}
|
||||
|
||||
bool CreatureDisplayInfoExtraRec::Read(SFile* f, const char* stringBuffer) {
|
||||
uint32_t bakeNameOfs;
|
||||
|
||||
if (
|
||||
!SFile::Read(f, &this->m_ID, sizeof(this->m_ID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_displayRaceID, sizeof(this->m_displayRaceID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_displaySexID, sizeof(this->m_displaySexID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_skinID, sizeof(this->m_skinID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_faceID, sizeof(this->m_faceID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_hairStyleID, sizeof(this->m_hairStyleID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_hairColorID, sizeof(this->m_hairColorID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_facialHairID, sizeof(this->m_facialHairID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[0], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[1], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[2], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[3], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[4], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[5], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[6], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[7], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[8], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[9], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcitemDisplay[10], sizeof(m_npcitemDisplay[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_flags, sizeof(this->m_flags), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &bakeNameOfs, sizeof(uint32_t), nullptr, nullptr, nullptr)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stringBuffer) {
|
||||
this->m_bakeName = &stringBuffer[bakeNameOfs];
|
||||
} else {
|
||||
this->m_bakeName = "";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
32
src/db/rec/CreatureDisplayInfoExtraRec.hpp
Normal file
32
src/db/rec/CreatureDisplayInfoExtraRec.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#ifndef DB_REC_CREATURE_DISPLAY_INFO_EXTRA_REC_HPP
|
||||
#define DB_REC_CREATURE_DISPLAY_INFO_EXTRA_REC_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SFile;
|
||||
|
||||
class CreatureDisplayInfoExtraRec {
|
||||
public:
|
||||
int32_t m_ID;
|
||||
int32_t m_displayRaceID;
|
||||
int32_t m_displaySexID;
|
||||
int32_t m_skinID;
|
||||
int32_t m_faceID;
|
||||
int32_t m_hairStyleID;
|
||||
int32_t m_hairColorID;
|
||||
int32_t m_facialHairID;
|
||||
int32_t m_npcitemDisplay[11];
|
||||
int32_t m_flags;
|
||||
const char* m_bakeName;
|
||||
|
||||
static const char* GetFilename();
|
||||
static uint32_t GetNumColumns();
|
||||
static uint32_t GetRowSize();
|
||||
static bool NeedIDAssigned();
|
||||
int32_t GetID();
|
||||
void SetID(int32_t id);
|
||||
bool Read(SFile* f, const char* stringBuffer);
|
||||
};
|
||||
|
||||
#endif
|
||||
75
src/db/rec/CreatureSoundDataRec.cpp
Normal file
75
src/db/rec/CreatureSoundDataRec.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#include "db/rec/CreatureSoundDataRec.hpp"
|
||||
#include "util/Locale.hpp"
|
||||
#include "util/SFile.hpp"
|
||||
|
||||
const char* CreatureSoundDataRec::GetFilename() {
|
||||
return "DBFilesClient\\CreatureSoundData.dbc";
|
||||
}
|
||||
|
||||
uint32_t CreatureSoundDataRec::GetNumColumns() {
|
||||
return 38;
|
||||
}
|
||||
|
||||
uint32_t CreatureSoundDataRec::GetRowSize() {
|
||||
return 152;
|
||||
}
|
||||
|
||||
bool CreatureSoundDataRec::NeedIDAssigned() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t CreatureSoundDataRec::GetID() {
|
||||
return this->m_ID;
|
||||
}
|
||||
|
||||
void CreatureSoundDataRec::SetID(int32_t id) {
|
||||
this->m_ID = id;
|
||||
}
|
||||
|
||||
bool CreatureSoundDataRec::Read(SFile* f, const char* stringBuffer) {
|
||||
if (
|
||||
!SFile::Read(f, &this->m_ID, sizeof(this->m_ID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundExertionID, sizeof(this->m_soundExertionID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundExertionCriticalID, sizeof(this->m_soundExertionCriticalID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundInjuryID, sizeof(this->m_soundInjuryID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundInjuryCriticalID, sizeof(this->m_soundInjuryCriticalID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundInjuryCrushingBlowID, sizeof(this->m_soundInjuryCrushingBlowID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundDeathID, sizeof(this->m_soundDeathID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundStunID, sizeof(this->m_soundStunID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundStandID, sizeof(this->m_soundStandID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFootstepID, sizeof(this->m_soundFootstepID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundAggroID, sizeof(this->m_soundAggroID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundWingFlapID, sizeof(this->m_soundWingFlapID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundWingGlideID, sizeof(this->m_soundWingGlideID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundAlertID, sizeof(this->m_soundAlertID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[0], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[1], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[2], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[3], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[4], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[0], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[1], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[2], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[3], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcsoundID, sizeof(this->m_npcsoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_loopSoundID, sizeof(this->m_loopSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_creatureImpactType, sizeof(this->m_creatureImpactType), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundJumpStartID, sizeof(this->m_soundJumpStartID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundJumpEndID, sizeof(this->m_soundJumpEndID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundPetAttackID, sizeof(this->m_soundPetAttackID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundPetOrderID, sizeof(this->m_soundPetOrderID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundPetDismissID, sizeof(this->m_soundPetDismissID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_fidgetDelaySecondsMin, sizeof(this->m_fidgetDelaySecondsMin), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_fidgetDelaySecondsMax, sizeof(this->m_fidgetDelaySecondsMax), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_birthSoundID, sizeof(this->m_birthSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_spellCastDirectedSoundID, sizeof(this->m_spellCastDirectedSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_submergeSoundID, sizeof(this->m_submergeSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_submergedSoundID, sizeof(this->m_submergedSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_creatureSoundDataIdpet, sizeof(this->m_creatureSoundDataIdpet), nullptr, nullptr, nullptr)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
52
src/db/rec/CreatureSoundDataRec.hpp
Normal file
52
src/db/rec/CreatureSoundDataRec.hpp
Normal file
@ -0,0 +1,52 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#ifndef DB_REC_CREATURE_SOUND_DATA_REC_HPP
|
||||
#define DB_REC_CREATURE_SOUND_DATA_REC_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SFile;
|
||||
|
||||
class CreatureSoundDataRec {
|
||||
public:
|
||||
int32_t m_ID;
|
||||
int32_t m_soundExertionID;
|
||||
int32_t m_soundExertionCriticalID;
|
||||
int32_t m_soundInjuryID;
|
||||
int32_t m_soundInjuryCriticalID;
|
||||
int32_t m_soundInjuryCrushingBlowID;
|
||||
int32_t m_soundDeathID;
|
||||
int32_t m_soundStunID;
|
||||
int32_t m_soundStandID;
|
||||
int32_t m_soundFootstepID;
|
||||
int32_t m_soundAggroID;
|
||||
int32_t m_soundWingFlapID;
|
||||
int32_t m_soundWingGlideID;
|
||||
int32_t m_soundAlertID;
|
||||
int32_t m_soundFidget[5];
|
||||
int32_t m_customAttack[4];
|
||||
int32_t m_npcsoundID;
|
||||
int32_t m_loopSoundID;
|
||||
int32_t m_creatureImpactType;
|
||||
int32_t m_soundJumpStartID;
|
||||
int32_t m_soundJumpEndID;
|
||||
int32_t m_soundPetAttackID;
|
||||
int32_t m_soundPetOrderID;
|
||||
int32_t m_soundPetDismissID;
|
||||
float m_fidgetDelaySecondsMin;
|
||||
float m_fidgetDelaySecondsMax;
|
||||
int32_t m_birthSoundID;
|
||||
int32_t m_spellCastDirectedSoundID;
|
||||
int32_t m_submergeSoundID;
|
||||
int32_t m_submergedSoundID;
|
||||
int32_t m_creatureSoundDataIdpet;
|
||||
|
||||
static const char* GetFilename();
|
||||
static uint32_t GetNumColumns();
|
||||
static uint32_t GetRowSize();
|
||||
static bool NeedIDAssigned();
|
||||
int32_t GetID();
|
||||
void SetID(int32_t id);
|
||||
bool Read(SFile* f, const char* stringBuffer);
|
||||
};
|
||||
|
||||
#endif
|
||||
41
src/db/rec/UnitBloodLevelsRec.cpp
Normal file
41
src/db/rec/UnitBloodLevelsRec.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#include "db/rec/UnitBloodLevelsRec.hpp"
|
||||
#include "util/Locale.hpp"
|
||||
#include "util/SFile.hpp"
|
||||
|
||||
const char* UnitBloodLevelsRec::GetFilename() {
|
||||
return "DBFilesClient\\UnitBloodLevels.dbc";
|
||||
}
|
||||
|
||||
uint32_t UnitBloodLevelsRec::GetNumColumns() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
uint32_t UnitBloodLevelsRec::GetRowSize() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
bool UnitBloodLevelsRec::NeedIDAssigned() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t UnitBloodLevelsRec::GetID() {
|
||||
return this->m_ID;
|
||||
}
|
||||
|
||||
void UnitBloodLevelsRec::SetID(int32_t id) {
|
||||
this->m_ID = id;
|
||||
}
|
||||
|
||||
bool UnitBloodLevelsRec::Read(SFile* f, const char* stringBuffer) {
|
||||
if (
|
||||
!SFile::Read(f, &this->m_ID, sizeof(this->m_ID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_violencelevel[0], sizeof(m_violencelevel[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_violencelevel[1], sizeof(m_violencelevel[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_violencelevel[2], sizeof(m_violencelevel[0]), nullptr, nullptr, nullptr)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
23
src/db/rec/UnitBloodLevelsRec.hpp
Normal file
23
src/db/rec/UnitBloodLevelsRec.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#ifndef DB_REC_UNIT_BLOOD_LEVELS_REC_HPP
|
||||
#define DB_REC_UNIT_BLOOD_LEVELS_REC_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SFile;
|
||||
|
||||
class UnitBloodLevelsRec {
|
||||
public:
|
||||
int32_t m_ID;
|
||||
int32_t m_violencelevel[3];
|
||||
|
||||
static const char* GetFilename();
|
||||
static uint32_t GetNumColumns();
|
||||
static uint32_t GetRowSize();
|
||||
static bool NeedIDAssigned();
|
||||
int32_t GetID();
|
||||
void SetID(int32_t id);
|
||||
bool Read(SFile* f, const char* stringBuffer);
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||
#include "gx/mac/Display.hpp"
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
@ -117,6 +118,8 @@ int32_t CGxDevice::AdapterFormats(EGxApi api, TSGrowableArray<CGxFormat>& adapte
|
||||
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||
} else if (api == GxApi_GLL) {
|
||||
CGxDevice::GLLAdapterFormats(adapterFormats);
|
||||
} else if (api == GxApi_Metal) {
|
||||
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||
}
|
||||
|
||||
#elif defined(WHOA_SYSTEM_LINUX)
|
||||
@ -228,6 +231,11 @@ CGxDevice* CGxDevice::NewGLL() {
|
||||
auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0);
|
||||
return new (m) CGxDeviceGLL();
|
||||
}
|
||||
|
||||
CGxDevice* CGxDevice::NewMTL() {
|
||||
auto m = SMemAlloc(sizeof(CGxDeviceMTL), __FILE__, __LINE__, 0x0);
|
||||
return new (m) CGxDeviceMTL();
|
||||
}
|
||||
#endif
|
||||
|
||||
CGxDevice* CGxDevice::NewOpenGl() {
|
||||
|
||||
@ -70,6 +70,7 @@ class CGxDevice {
|
||||
#endif
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
static CGxDevice* NewGLL();
|
||||
static CGxDevice* NewMTL();
|
||||
#endif
|
||||
static CGxDevice* NewOpenGl();
|
||||
static void OpenGlAdapterFormats(TSGrowableArray<CGxFormat>& adapterFormats);
|
||||
|
||||
@ -20,6 +20,7 @@ if(WHOA_SYSTEM_MAC)
|
||||
file(GLOB MAC_SOURCES
|
||||
"gll/*.cpp"
|
||||
"gll/*.mm"
|
||||
"mtl/*.mm"
|
||||
"mac/*.cpp"
|
||||
)
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t
|
||||
device = CGxDevice::NewOpenGl();
|
||||
} else if (api == GxApi_GLL) {
|
||||
device = CGxDevice::NewGLL();
|
||||
} else if (api == GxApi_Metal) {
|
||||
device = CGxDevice::NewMTL();
|
||||
} else {
|
||||
// Error
|
||||
}
|
||||
|
||||
@ -35,7 +35,8 @@ enum EGxApi {
|
||||
GxApi_D3d10 = 3,
|
||||
GxApi_D3d11 = 4,
|
||||
GxApi_GLL = 5,
|
||||
GxApis_Last = 6
|
||||
GxApi_Metal = 6,
|
||||
GxApis_Last = 7
|
||||
};
|
||||
|
||||
enum EGxBlend {
|
||||
|
||||
81
src/gx/mtl/CGxDeviceMTL.hpp
Normal file
81
src/gx/mtl/CGxDeviceMTL.hpp
Normal file
@ -0,0 +1,81 @@
|
||||
#ifndef GX_MTL_C_GX_DEVICE_MTL_HPP
|
||||
#define GX_MTL_C_GX_DEVICE_MTL_HPP
|
||||
|
||||
#include "gx/CGxDevice.hpp"
|
||||
#include "gx/gll/GLWindow.h"
|
||||
|
||||
class CGxBatch;
|
||||
class CGxShader;
|
||||
|
||||
class CGxDeviceMTL : public CGxDevice {
|
||||
public:
|
||||
// Member variables
|
||||
GLWindow m_window;
|
||||
|
||||
// Virtual member functions
|
||||
void ITexMarkAsUpdated(CGxTex*) override;
|
||||
void IRsSendToHw(EGxRenderState) override;
|
||||
int32_t DeviceCreate(int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat&) override;
|
||||
int32_t DeviceSetFormat(const CGxFormat&) override;
|
||||
void* DeviceWindow() override;
|
||||
void DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) override {};
|
||||
void CapsWindowSize(CRect&) override;
|
||||
void CapsWindowSizeInScreenCoords(CRect& dst) override;
|
||||
void ScenePresent() override;
|
||||
void SceneClear(uint32_t, CImVector) override;
|
||||
void Draw(CGxBatch* batch, int32_t indexed) override;
|
||||
void PoolSizeSet(CGxPool*, uint32_t) override;
|
||||
char* BufLock(CGxBuf*) override;
|
||||
int32_t BufUnlock(CGxBuf*, uint32_t) override;
|
||||
void BufData(CGxBuf* buf, const void* data, size_t size, uintptr_t offset) override;
|
||||
void TexDestroy(CGxTex* texId) override;
|
||||
void IShaderCreate(CGxShader*) override;
|
||||
void ShaderCreate(CGxShader*[], EGxShTarget, const char*, const char*, int32_t) override;
|
||||
int32_t StereoEnabled(void) override;
|
||||
void XformSetProjection(const C44Matrix& matrix) override;
|
||||
|
||||
// Member functions
|
||||
CGxDeviceMTL();
|
||||
void Resize(uint32_t width, uint32_t height);
|
||||
|
||||
private:
|
||||
void ISetCaps(const CGxFormat& format);
|
||||
void EnsureLibrary();
|
||||
void BeginFrame();
|
||||
void* GetPipeline(EGxVertexBufferFormat format, bool useColor, bool useSkin, bool useTex, int32_t blendMode);
|
||||
void* GetPoolBuffer(CGxPool* pool);
|
||||
void ITexCreate(CGxTex* texId);
|
||||
void ITexUpload(CGxTex* texId);
|
||||
void* GetTexture(CGxTex* texId);
|
||||
void* GetSampler(CGxTex* texId);
|
||||
void EnsureFallbackTexture();
|
||||
void EnsureDepthTexture(uint32_t width, uint32_t height);
|
||||
void* GetDepthState(bool depthTest, bool depthWrite, uint32_t depthFunc);
|
||||
void* m_device = nullptr;
|
||||
void* m_commandQueue = nullptr;
|
||||
void* m_layer = nullptr;
|
||||
void* m_shaderLibrary = nullptr;
|
||||
void* m_pipelineColor[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineSolid[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineSkin[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineColorTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineSolidTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineSkinTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineColorTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineSolidTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_pipelineSkinTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||
void* m_frameCommandBuffer = nullptr;
|
||||
void* m_frameEncoder = nullptr;
|
||||
void* m_frameDrawable = nullptr;
|
||||
uint32_t m_frameHasDraw = 0;
|
||||
uint32_t m_clearMask = 0;
|
||||
uint32_t m_clearColor = 0;
|
||||
void* m_fallbackTexture = nullptr;
|
||||
void* m_fallbackSampler = nullptr;
|
||||
void* m_depthTexture = nullptr;
|
||||
uint32_t m_depthWidth = 0;
|
||||
uint32_t m_depthHeight = 0;
|
||||
void* m_depthStates[2][2][4] = {};
|
||||
};
|
||||
|
||||
#endif
|
||||
1855
src/gx/mtl/CGxDeviceMTL.mm
Normal file
1855
src/gx/mtl/CGxDeviceMTL.mm
Normal file
File diff suppressed because it is too large
Load Diff
@ -1604,6 +1604,10 @@ void CM2Model::LinkToCallbackListTail() {
|
||||
this->m_shared->m_callbackListTail = &this->m_callbackNext;
|
||||
}
|
||||
|
||||
void CM2Model::OptimizeVisibleGeometry() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
int32_t CM2Model::ProcessCallbacks() {
|
||||
// TODO
|
||||
return 1;
|
||||
|
||||
@ -178,6 +178,7 @@ class CM2Model {
|
||||
int32_t IsDrawable(int32_t a2, int32_t a3);
|
||||
int32_t IsLoaded(int32_t a2, int32_t attachments);
|
||||
void LinkToCallbackListTail();
|
||||
void OptimizeVisibleGeometry();
|
||||
int32_t ProcessCallbacks();
|
||||
void ProcessCallbacksRecursive();
|
||||
uint32_t Release();
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
#include "object/client/CGUnit_C.hpp"
|
||||
#include "component/CCharacterComponent.hpp"
|
||||
#include "model/Model2.hpp"
|
||||
#include "object/client/ObjMgr.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "ui/Game.hpp"
|
||||
#include <storm/Error.hpp>
|
||||
|
||||
WOWGUID CGUnit_C::s_activeMover;
|
||||
|
||||
@ -95,6 +98,10 @@ const char* CGUnit_C::GetDisplayRaceNameFromRecord(const ChrRacesRec* raceRec, U
|
||||
|
||||
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate) : CGObject_C(time, objCreate) {
|
||||
// TODO
|
||||
|
||||
this->RefreshDataPointers();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
CGUnit_C::~CGUnit_C() {
|
||||
@ -115,16 +122,22 @@ int32_t CGUnit_C::CanBeTargetted() {
|
||||
return this->CanHighlight();
|
||||
}
|
||||
|
||||
int32_t CGUnit_C::GetDisplayID() const {
|
||||
// Prefer local display ID if set and unit's display ID hasn't been overridden from unit's
|
||||
// native display ID.
|
||||
if (this->GetLocalDisplayID() && this->GetDisplayID() == this->GetNativeDisplayID()) {
|
||||
return this->GetLocalDisplayID();
|
||||
}
|
||||
|
||||
return this->CGUnit::GetDisplayID();
|
||||
}
|
||||
|
||||
int32_t CGUnit_C::GetLocalDisplayID() const {
|
||||
return this->m_localDisplayID;
|
||||
}
|
||||
|
||||
CreatureModelDataRec* CGUnit_C::GetModelData() const {
|
||||
// Prefer local display ID if set and unit's display ID hasn't been overridden from unit's
|
||||
// native display ID; otherwise prefer overridden display ID.
|
||||
auto displayID = this->GetLocalDisplayID() && this->GetDisplayID() == this->GetNativeDisplayID()
|
||||
? this->GetLocalDisplayID()
|
||||
: this->GetDisplayID();
|
||||
auto displayID = this->GetDisplayID();
|
||||
|
||||
auto creatureDisplayInfoRec = g_creatureDisplayInfoDB.GetRecord(displayID);
|
||||
|
||||
@ -164,12 +177,80 @@ void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
||||
this->CGObject_C::PostInit(time, init, a4);
|
||||
|
||||
// TODO
|
||||
|
||||
if (this->m_displayInfo) {
|
||||
CCharacterComponent::ApplyMonsterGeosets(this->m_model, this->m_displayInfo);
|
||||
CCharacterComponent::ReplaceMonsterSkin(this->m_model, this->m_displayInfo, this->m_modelData);
|
||||
|
||||
if (this->m_modelData) {
|
||||
this->m_model->m_flag4 = (this->m_modelData->m_flags & 0x200) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGUnit_C::RefreshDataPointers() {
|
||||
auto displayID = this->GetDisplayID();
|
||||
|
||||
// Display info
|
||||
|
||||
this->m_displayInfo = g_creatureDisplayInfoDB.GetRecord(displayID);
|
||||
|
||||
if (!this->m_displayInfo) {
|
||||
// TODO auto name = this->GetUnitName(0, 1);
|
||||
// TODO SysMsgPrintf(2, 2, "NOUNITDISPLAYID|%d|%s", displayID, name);
|
||||
|
||||
this->m_displayInfo = g_creatureDisplayInfoDB.GetRecordByIndex(0);
|
||||
|
||||
if (!this->m_displayInfo) {
|
||||
STORM_APP_FATAL("Error, NO creature display records found");
|
||||
}
|
||||
}
|
||||
|
||||
// Display info extra
|
||||
|
||||
this->m_displayInfoExtra = g_creatureDisplayInfoExtraDB.GetRecord(this->m_displayInfo->m_extendedDisplayInfoID);
|
||||
|
||||
// Model data
|
||||
|
||||
this->m_modelData = g_creatureModelDataDB.GetRecord(this->m_displayInfo->m_modelID);
|
||||
|
||||
// Sound data
|
||||
|
||||
this->m_soundData = g_creatureSoundDataDB.GetRecord(this->m_displayInfo->m_soundID);
|
||||
|
||||
if (!this->m_soundData) {
|
||||
this->m_soundData = g_creatureSoundDataDB.GetRecord(this->m_modelData->m_soundID);
|
||||
}
|
||||
|
||||
// Blood levels
|
||||
|
||||
this->m_bloodRec = g_unitBloodLevelsDB.GetRecord(this->m_displayInfo->m_bloodID);
|
||||
|
||||
if (!this->m_bloodRec) {
|
||||
this->m_bloodRec = g_unitBloodLevelsDB.GetRecord(this->m_modelData->m_bloodID);
|
||||
|
||||
if (!this->m_bloodRec) {
|
||||
this->m_bloodRec = g_unitBloodLevelsDB.GetRecordByIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Creature stats
|
||||
|
||||
if (this->GetType() == HIER_TYPE_UNIT) {
|
||||
// TODO load creature stats
|
||||
}
|
||||
|
||||
// Flags
|
||||
|
||||
// TODO set flags
|
||||
}
|
||||
|
||||
void CGUnit_C::SetStorage(uint32_t* storage, uint32_t* saved) {
|
||||
this->CGObject_C::SetStorage(storage, saved);
|
||||
|
||||
|
||||
@ -9,7 +9,11 @@
|
||||
|
||||
class ChrClassesRec;
|
||||
class ChrRacesRec;
|
||||
class CreatureDisplayInfoRec;
|
||||
class CreatureDisplayInfoExtraRec;
|
||||
class CreatureModelDataRec;
|
||||
class CreatureSoundDataRec;
|
||||
class UnitBloodLevelsRec;
|
||||
|
||||
class CGUnit_C : public CGObject_C, public CGUnit {
|
||||
public:
|
||||
@ -31,15 +35,27 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
||||
|
||||
// Public member functions
|
||||
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
||||
int32_t GetLocalDisplayID() const;
|
||||
int32_t GetDisplayID() const;
|
||||
CreatureModelDataRec* GetModelData() const;
|
||||
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
||||
void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover);
|
||||
void SetStorage(uint32_t* storage, uint32_t* saved);
|
||||
|
||||
protected:
|
||||
// Protected member functions
|
||||
int32_t GetLocalDisplayID() const;
|
||||
void RefreshDataPointers();
|
||||
|
||||
private:
|
||||
// Private member variables
|
||||
// TODO
|
||||
CreatureDisplayInfoRec* m_displayInfo;
|
||||
CreatureDisplayInfoExtraRec* m_displayInfoExtra;
|
||||
CreatureModelDataRec* m_modelData;
|
||||
CreatureSoundDataRec* m_soundData;
|
||||
// TODO
|
||||
UnitBloodLevelsRec* m_bloodRec;
|
||||
// TODO
|
||||
int32_t m_localDisplayID = 0;
|
||||
// TODO
|
||||
};
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
#include "ui/game/CGWorldFrame.hpp"
|
||||
#include "gx/Shader.hpp"
|
||||
#include "gx/Transform.hpp"
|
||||
#include "ui/game/PlayerName.hpp"
|
||||
#include <storm/Memory.hpp>
|
||||
#include <tempest/Matrix.hpp>
|
||||
|
||||
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
||||
// TODO use CDataAllocator
|
||||
@ -7,6 +11,27 @@ CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
||||
return STORM_NEW(CGWorldFrame)(parent);
|
||||
}
|
||||
|
||||
void CGWorldFrame::RenderWorld(void* param) {
|
||||
auto frame = reinterpret_cast<CGWorldFrame*>(param);
|
||||
|
||||
C44Matrix savedProj;
|
||||
GxXformProjection(savedProj);
|
||||
|
||||
C44Matrix savedView;
|
||||
GxXformView(savedView);
|
||||
|
||||
frame->OnWorldUpdate();
|
||||
PlayerNameUpdateWorldText();
|
||||
|
||||
frame->OnWorldRender();
|
||||
PlayerNameRenderWorldText();
|
||||
|
||||
GxXformSetProjection(savedProj);
|
||||
GxXformSetView(savedView);
|
||||
|
||||
CShaderEffect::UpdateProjMatrix();
|
||||
}
|
||||
|
||||
CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
||||
// TODO
|
||||
|
||||
@ -14,9 +39,27 @@ CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
||||
|
||||
// TODO
|
||||
|
||||
this->SetFrameStrata(FRAME_STRATA_WORLD);
|
||||
|
||||
this->EnableEvent(SIMPLE_EVENT_KEY, -1);
|
||||
this->EnableEvent(SIMPLE_EVENT_MOUSE, -1);
|
||||
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
||||
this->CSimpleFrame::OnFrameRender(batch, layer);
|
||||
|
||||
if (layer == DRAWLAYER_BACKGROUND) {
|
||||
batch->QueueCallback(&CGWorldFrame::RenderWorld, this);
|
||||
}
|
||||
}
|
||||
|
||||
void CGWorldFrame::OnWorldRender() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGWorldFrame::OnWorldUpdate() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -11,9 +11,15 @@ class CGWorldFrame : public CSimpleFrame {
|
||||
|
||||
// Static functions
|
||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
||||
static void RenderWorld(void* param);
|
||||
|
||||
// Virtual member functions
|
||||
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
||||
|
||||
// Member functions
|
||||
CGWorldFrame(CSimpleFrame* parent);
|
||||
void OnWorldRender();
|
||||
void OnWorldUpdate();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
9
src/ui/game/PlayerName.cpp
Normal file
9
src/ui/game/PlayerName.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include "ui/game/PlayerName.hpp"
|
||||
|
||||
void PlayerNameRenderWorldText() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void PlayerNameUpdateWorldText() {
|
||||
// TODO
|
||||
}
|
||||
8
src/ui/game/PlayerName.hpp
Normal file
8
src/ui/game/PlayerName.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef UI_GAME_PLAYER_NAME_HPP
|
||||
#define UI_GAME_PLAYER_NAME_HPP
|
||||
|
||||
void PlayerNameRenderWorldText();
|
||||
|
||||
void PlayerNameUpdateWorldText();
|
||||
|
||||
#endif
|
||||
@ -23,6 +23,8 @@ if(WHOA_SYSTEM_MAC)
|
||||
"-framework AppKit"
|
||||
"-framework Carbon"
|
||||
"-framework IOKit"
|
||||
"-framework Metal"
|
||||
"-framework QuartzCore"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user