Lotta asset changes

This commit is contained in:
= 2025-07-10 00:04:52 -04:00
parent 0943608bd8
commit 67050e6a67
80 changed files with 14804 additions and 1131 deletions

View File

@ -93,6 +93,7 @@ INCLUDEPATH += \
$$PWD/../libs/ddsfile \ $$PWD/../libs/ddsfile \
$$PWD/../libs/ipakfile \ $$PWD/../libs/ipakfile \
$$PWD/../libs/iwifile \ $$PWD/../libs/iwifile \
$$PWD/../libs/assets \
$$PWD/../libs/zonefile $$PWD/../libs/zonefile
DEPENDPATH += \ DEPENDPATH += \
@ -106,6 +107,7 @@ DEPENDPATH += \
$$PWD/../libs/ddsfile \ $$PWD/../libs/ddsfile \
$$PWD/../libs/ipakfile \ $$PWD/../libs/ipakfile \
$$PWD/../libs/iwifile \ $$PWD/../libs/iwifile \
$$PWD/../libs/assets \
$$PWD/../libs/zonefile $$PWD/../libs/zonefile
# Copy DLLs to Debug folder # Copy DLLs to Debug folder

View File

@ -1,5 +1,4 @@
#include "fastfileviewer.h" #include "fastfileviewer.h"
#include "asset_structs.h"
#include "ui_fastfileviewer.h" #include "ui_fastfileviewer.h"
FastFileViewer::FastFileViewer(QWidget *parent) FastFileViewer::FastFileViewer(QWidget *parent)

View File

@ -1,7 +1,6 @@
#ifndef FASTFILEVIEWER_H #ifndef FASTFILEVIEWER_H
#define FASTFILEVIEWER_H #define FASTFILEVIEWER_H
#include "asset_structs.h"
#include "fastfile.h" #include "fastfile.h"
#include <QWidget> #include <QWidget>

View File

@ -13,16 +13,16 @@ ImageWidget::~ImageWidget()
delete ui; delete ui;
} }
void ImageWidget::SetImage(std::shared_ptr<Image> aImage) void ImageWidget::SetImage(std::shared_ptr<QImage> aImage)
{ {
mImage = aImage; mImage = aImage;
ui->lineEdit_Name->setText(aImage->name); //ui->lineEdit_Name->setText(aImage->name);
ui->lineEdit_Role->setText(aImage->materialName); //ui->lineEdit_Role->setText(aImage->materialName);
ui->comboBox_Compression->setCurrentIndex(aImage->compression); //ui->comboBox_Compression->setCurrentIndex(aImage->compression);
} }
std::shared_ptr<Image> ImageWidget::GetImage() std::shared_ptr<QImage> ImageWidget::GetImage()
{ {
return mImage; return mImage;
} }

View File

@ -4,7 +4,6 @@
#include "enums.h" #include "enums.h"
#include "dds_structs.h" #include "dds_structs.h"
#include "d3dbsp_structs.h" #include "d3dbsp_structs.h"
#include "asset_structs.h"
#include "ipak_structs.h" #include "ipak_structs.h"
#include <QWidget> #include <QWidget>
@ -21,11 +20,11 @@ public:
explicit ImageWidget(QWidget *parent = nullptr); explicit ImageWidget(QWidget *parent = nullptr);
~ImageWidget(); ~ImageWidget();
void SetImage(std::shared_ptr<Image> aImage); void SetImage(std::shared_ptr<QImage> aImage);
std::shared_ptr<Image> GetImage(); std::shared_ptr<QImage> GetImage();
private: private:
std::shared_ptr<Image> mImage; std::shared_ptr<QImage> mImage;
Ui::ImageWidget *ui; Ui::ImageWidget *ui;
}; };

View File

@ -37,26 +37,22 @@ void LocalStringViewer::SetFileNotes(const QString aFileNotes) {
ui->plainTextEdit_FileNotes->setPlainText(mFileNotes); ui->plainTextEdit_FileNotes->setPlainText(mFileNotes);
} }
void LocalStringViewer::AddLocalString(LocalString aLocalString) { // void LocalStringViewer::AddLocalString(LocalizeEntry aLocalString) {
mLocalStrings.append(aLocalString); // mLocalStrings.append(aLocalString);
// ui->tableWidget_Strings->setRowCount(mLocalStrings.size());
ui->tableWidget_Strings->setRowCount(mLocalStrings.size()); // ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(mLocalStrings.size()));
// QTableWidgetItem *aliasItem = new QTableWidgetItem(aLocalString.alias);
ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(mLocalStrings.size())); // QTableWidgetItem *stringItem = new QTableWidgetItem(aLocalString.string);
// ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 0, aliasItem);
QTableWidgetItem *aliasItem = new QTableWidgetItem(aLocalString.alias); // ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 1, stringItem);
QTableWidgetItem *stringItem = new QTableWidgetItem(aLocalString.string); // }
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 0, aliasItem);
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 1, stringItem);
}
void LocalStringViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) { void LocalStringViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
mLocalStrings.clear(); // mLocalStrings.clear();
ui->tableWidget_Strings->clear(); // ui->tableWidget_Strings->clear();
ui->label_Title->setText(aZoneFile->GetStem().section('.', 0, 0) + ".str"); // ui->label_Title->setText(aZoneFile->GetStem().section('.', 0, 0) + ".str");
for (const LocalString &localStr : aZoneFile->GetAssetMap().localStrings) { // for (const LocalString &localStr : aZoneFile->GetAssetMap().localStrings) {
AddLocalString(localStr); // AddLocalString(localStr);
} // }
} }

View File

@ -1,7 +1,6 @@
#ifndef LOCALSTRINGVIEWER_H #ifndef LOCALSTRINGVIEWER_H
#define LOCALSTRINGVIEWER_H #define LOCALSTRINGVIEWER_H
#include "asset_structs.h"
#include "zonefile.h" #include "zonefile.h"
#include <QWidget> #include <QWidget>
@ -20,7 +19,7 @@ public:
void SetVersion(quint32 aVersion); void SetVersion(quint32 aVersion);
void SetConfigPath(const QString aConfigPath); void SetConfigPath(const QString aConfigPath);
void SetFileNotes(const QString aFileNotes); void SetFileNotes(const QString aFileNotes);
void AddLocalString(LocalString aLocalString); //void AddLocalString(LocalString aLocalString);
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile); void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
private: private:
@ -28,7 +27,7 @@ private:
quint32 mVersion; quint32 mVersion;
QString mConfigPath; QString mConfigPath;
QString mFileNotes; QString mFileNotes;
QVector<LocalString> mLocalStrings; //QVector<LocalString> mLocalStrings;
}; };
#endif // LOCALSTRINGVIEWER_H #endif // LOCALSTRINGVIEWER_H

View File

@ -1,4 +1,6 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h"
#include "aboutdialog.h" #include "aboutdialog.h"
#include "fastfile.h" #include "fastfile.h"
#include "highlighter_gsc.h" #include "highlighter_gsc.h"
@ -7,12 +9,12 @@
#include "highlighter_rumble.h" #include "highlighter_rumble.h"
#include "materialviewer.h" #include "materialviewer.h"
#include "preferenceeditor.h" #include "preferenceeditor.h"
#include "reportissuedialog.h"
#include "rumblefileviewer.h" #include "rumblefileviewer.h"
#include "rumblegraphviewer.h" #include "rumblegraphviewer.h"
#include "soundviewer.h" #include "soundviewer.h"
#include "stringtableviewer.h" #include "stringtableviewer.h"
#include "techsetviewer.h" #include "techsetviewer.h"
#include "ui_mainwindow.h"
#include "fastfile_factory.h" #include "fastfile_factory.h"
#include "iwifile.h" #include "iwifile.h"
#include "ddsfile.h" #include "ddsfile.h"
@ -23,7 +25,6 @@
#include "iwiviewer.h" #include "iwiviewer.h"
#include "localstringviewer.h" #include "localstringviewer.h"
#include "imagewidget.h" #include "imagewidget.h"
#include "xtreewidget.h"
#include "zonefileviewer.h" #include "zonefileviewer.h"
#include "techsetviewer.h" #include "techsetviewer.h"
#include "logmanager.h" #include "logmanager.h"
@ -39,7 +40,7 @@ MainWindow::MainWindow(QWidget *parent)
mTypeMap = QMap<QString, int>(); mTypeMap = QMap<QString, int>();
mTypeOrder = QStringList(); mTypeOrder = QStringList();
mRawFileMap = QMap<QString, QString>(); mRawFileMap = QMap<QString, QString>();
mImageMap = QMap<QString, Image>(); //mImageMap = QMap<QString, Image>();
mTreeMap = QMap<QString, QTreeWidgetItem *>(); mTreeMap = QMap<QString, QTreeWidgetItem *>();
mStrTableMap = QMap<QString, QVector<QPair<QString, QString>>>(); mStrTableMap = QMap<QString, QVector<QPair<QString, QString>>>();
mBSPVersion = 0; mBSPVersion = 0;
@ -49,13 +50,23 @@ MainWindow::MainWindow(QWidget *parent)
mTreeWidget = new XTreeWidget(this); mTreeWidget = new XTreeWidget(this);
mLogWidget = new QPlainTextEdit(this); mLogWidget = new QPlainTextEdit(this);
//ModelViewer *mModelViewer = new ModelViewer(container);
//mModelViewer->setAcceptDrops(false);
mProgressBar = new QProgressBar(this); mProgressBar = new QProgressBar(this);
mProgressBar->setMaximum(100); // Default max value mProgressBar->setMaximum(100); // Default max value
mProgressBar->setVisible(false); // Initially hidden mProgressBar->setVisible(false); // Initially hidden
connect(ui->actionRun_Tests, &QAction::triggered, this, [](bool checked) {
Q_UNUSED(checked);
});
connect(ui->actionReport_Issue, &QAction::triggered, this, [this](bool checked) {
Q_UNUSED(checked);
ReportIssueDialog issueDialog("https://git.redline.llc", "njohnson", "XPlor", "4738c4d2efd123efac1506c68c59b285c646df9f", this);
if (issueDialog.exec() == QDialog::Accepted) {
}
});
connect(&StatusBarManager::instance(), &StatusBarManager::statusUpdated, connect(&StatusBarManager::instance(), &StatusBarManager::statusUpdated,
this, &MainWindow::HandleStatusUpdate); this, &MainWindow::HandleStatusUpdate);
@ -157,13 +168,13 @@ MainWindow::MainWindow(QWidget *parent)
scriptEditor->setProperty("PARENT_NAME", QVariant::fromValue(aParentName)); scriptEditor->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
scriptEditor->setFont(QFont("Consolas")); scriptEditor->setFont(QFont("Consolas"));
if (rawFile->contents.isEmpty()) { // if (rawFile->contents.isEmpty()) {
scriptEditor->setPlainText("EMPTY"); // scriptEditor->setPlainText("EMPTY");
} else { // } else {
scriptEditor->setPlainText(rawFile->contents); // scriptEditor->setPlainText(rawFile->contents);
} // }
QString fileStem = rawFile->path.split('/').last(); QString fileStem;// = rawFile->path.split('/').last();
for (int i = 0; i < ui->tabWidget->count(); i++) { for (int i = 0; i < ui->tabWidget->count(); i++) {
if (ui->tabWidget->tabText(i) == fileStem) { if (ui->tabWidget->tabText(i) == fileStem) {
delete scriptEditor; delete scriptEditor;
@ -175,7 +186,7 @@ MainWindow::MainWindow(QWidget *parent)
QFontMetrics metrics(scriptEditor->font()); QFontMetrics metrics(scriptEditor->font());
scriptEditor->setTabStopDistance(tabStopSpaces * metrics.horizontalAdvance(' ')); scriptEditor->setTabStopDistance(tabStopSpaces * metrics.horizontalAdvance(' '));
QSyntaxHighlighter *highlighter; QSyntaxHighlighter *highlighter = nullptr;
if (fileStem.contains(".gsc")) { if (fileStem.contains(".gsc")) {
highlighter = new Highlighter_GSC(scriptEditor->document()); highlighter = new Highlighter_GSC(scriptEditor->document());
} else if (fileStem.contains(".cfg")) { } else if (fileStem.contains(".cfg")) {
@ -191,12 +202,12 @@ MainWindow::MainWindow(QWidget *parent)
rawTabWidget->addTab(scriptEditor, "Text Editor"); rawTabWidget->addTab(scriptEditor, "Text Editor");
ui->tabWidget->addTab(rawTabWidget, fileStem); ui->tabWidget->addTab(rawTabWidget, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_RUMBLE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_RUMBLE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
return; return;
} else if (fileStem.contains(".shock")) { } else if (fileStem.contains(".shock")) {
highlighter = new Highlighter_Shock(scriptEditor->document()); highlighter = new Highlighter_Shock(scriptEditor->document());
} else if (rawFile->contents.left(6) == "RUMBLE") { } /*else if (rawFile->contents.left(6) == "RUMBLE") {
RumbleFileViewer *rmbFileViewer = new RumbleFileViewer(this); RumbleFileViewer *rmbFileViewer = new RumbleFileViewer(this);
rmbFileViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName)); rmbFileViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
rmbFileViewer->SetRumbleFile(rawFile); rmbFileViewer->SetRumbleFile(rawFile);
@ -205,38 +216,40 @@ MainWindow::MainWindow(QWidget *parent)
rawTabWidget->addTab(scriptEditor, "Text Editor"); rawTabWidget->addTab(scriptEditor, "Text Editor");
ui->tabWidget->addTab(rawTabWidget, fileStem); ui->tabWidget->addTab(rawTabWidget, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_RUMBLE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_RUMBLE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
return; return;
}*/ else {
delete highlighter;
} }
ui->tabWidget->addTab(scriptEditor, fileStem); ui->tabWidget->addTab(scriptEditor, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_RAW_FILE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_RAWFILE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
connect(mTreeWidget, &XTreeWidget::ImageSelected, this, [this](std::shared_ptr<Image> image, const QString aParentName) { // connect(mTreeWidget, &XTreeWidget::ImageSelected, this, [this](std::shared_ptr<Image> image, const QString aParentName) {
ImageWidget *mImageWidget = new ImageWidget(this); // ImageWidget *mImageWidget = new ImageWidget(this);
mImageWidget->setAcceptDrops(false); // mImageWidget->setAcceptDrops(false);
mImageWidget->SetImage(image); // mImageWidget->SetImage(image);
mImageWidget->setProperty("PARENT_NAME", QVariant::fromValue(aParentName)); // mImageWidget->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
QString fileStem = image->materialName; // QString fileStem = image->materialName;
for (int i = 0; i < ui->tabWidget->count(); i++) { // for (int i = 0; i < ui->tabWidget->count(); i++) {
if (ui->tabWidget->tabText(i) == fileStem) { // if (ui->tabWidget->tabText(i) == fileStem) {
delete mImageWidget; // delete mImageWidget;
return; // return;
} // }
} // }
ui->tabWidget->addTab(mImageWidget, fileStem); // ui->tabWidget->addTab(mImageWidget, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_IMAGE)); // ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_IMAGE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); // ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); // });
connect(mTreeWidget, &XTreeWidget::MenuSelected, this, [](std::shared_ptr<Menu> menu, const QString aParentName) { // connect(mTreeWidget, &XTreeWidget::MenuSelected, this, [](std::shared_ptr<Menu> menu, const QString aParentName) {
Q_UNUSED(menu); // Q_UNUSED(menu);
}); // });
connect(mTreeWidget, &XTreeWidget::MaterialSelected, this, [this](std::shared_ptr<Material> material, const QString aParentName) { connect(mTreeWidget, &XTreeWidget::MaterialSelected, this, [this](std::shared_ptr<Material> material, const QString aParentName) {
MaterialViewer *matViewer = new MaterialViewer(this); MaterialViewer *matViewer = new MaterialViewer(this);
@ -244,16 +257,16 @@ MainWindow::MainWindow(QWidget *parent)
matViewer->SetMaterial(material); matViewer->SetMaterial(material);
matViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName)); matViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
QString fileStem = material->name; // QString fileStem = material->name;
for (int i = 0; i < ui->tabWidget->count(); i++) { // for (int i = 0; i < ui->tabWidget->count(); i++) {
if (ui->tabWidget->tabText(i) == fileStem) { // if (ui->tabWidget->tabText(i) == fileStem) {
delete matViewer; // delete matViewer;
return; // return;
} // }
} // }
ui->tabWidget->addTab(matViewer, fileStem); //ui->tabWidget->addTab(matViewer, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_MATERIAL)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_MATERIAL));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
@ -272,7 +285,7 @@ MainWindow::MainWindow(QWidget *parent)
} }
ui->tabWidget->addTab(ddsViewer, fileStem); ui->tabWidget->addTab(ddsViewer, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_IMAGE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_IMAGE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
@ -291,7 +304,7 @@ MainWindow::MainWindow(QWidget *parent)
} }
ui->tabWidget->addTab(iwiViewer, fileStem); ui->tabWidget->addTab(iwiViewer, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_IMAGE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_IMAGE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
@ -310,7 +323,7 @@ MainWindow::MainWindow(QWidget *parent)
} }
ui->tabWidget->addTab(fastFileViewer, fileStem); ui->tabWidget->addTab(fastFileViewer, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_FAST_FILE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_FAST_FILE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
@ -341,7 +354,7 @@ MainWindow::MainWindow(QWidget *parent)
scrollArea->setWidget(containerWidget); scrollArea->setWidget(containerWidget);
ui->tabWidget->addTab(scrollArea, fileStem); ui->tabWidget->addTab(scrollArea, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_ZONE_FILE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_ZONE_FILE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
@ -360,11 +373,11 @@ MainWindow::MainWindow(QWidget *parent)
} }
ui->tabWidget->addTab(localStrViewer, fileStem); ui->tabWidget->addTab(localStrViewer, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_LOCAL_STRING)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_LOCALIZE_ENTRY));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
connect(mTreeWidget, &XTreeWidget::TechSetSelected, this, [this](std::shared_ptr<TechSet> aTechSet, const QString aParentName) { connect(mTreeWidget, &XTreeWidget::TechSetSelected, this, [this](std::shared_ptr<MaterialTechSet> aTechSet, const QString aParentName) {
TechSetViewer *techSetViewer = new TechSetViewer(this); TechSetViewer *techSetViewer = new TechSetViewer(this);
techSetViewer->setAcceptDrops(false); techSetViewer->setAcceptDrops(false);
techSetViewer->SetTechSet(aTechSet); techSetViewer->SetTechSet(aTechSet);
@ -379,7 +392,7 @@ MainWindow::MainWindow(QWidget *parent)
} }
ui->tabWidget->addTab(techSetViewer, aTechSet->name); ui->tabWidget->addTab(techSetViewer, aTechSet->name);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_TECH_SET)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_TECHNIQUE_SET));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
@ -398,28 +411,28 @@ MainWindow::MainWindow(QWidget *parent)
} }
ui->tabWidget->addTab(strTableViewer, fileStem); ui->tabWidget->addTab(strTableViewer, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_STRING_TABLE)); ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_STRINGTABLE));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); });
connect(mTreeWidget, &XTreeWidget::SoundSelected, this, [this](std::shared_ptr<Sound> aSound, const QString aParentName) { // connect(mTreeWidget, &XTreeWidget::SoundSelected, this, [this](std::shared_ptr<Sound> aSound, const QString aParentName) {
SoundViewer *soundViewer = new SoundViewer(this); // SoundViewer *soundViewer = new SoundViewer(this);
soundViewer->setAcceptDrops(false); // soundViewer->setAcceptDrops(false);
soundViewer->SetSound(aSound); // soundViewer->SetSound(aSound);
soundViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName)); // soundViewer->setProperty("PARENT_NAME", QVariant::fromValue(aParentName));
QString fileStem = aSound->path.split('/').last(); // QString fileStem = aSound->path.split('/').last();
for (int i = 0; i < ui->tabWidget->count(); i++) { // for (int i = 0; i < ui->tabWidget->count(); i++) {
if (ui->tabWidget->tabText(i) == fileStem) { // if (ui->tabWidget->tabText(i) == fileStem) {
delete soundViewer; // delete soundViewer;
return; // return;
} // }
} // }
ui->tabWidget->addTab(soundViewer, fileStem); // ui->tabWidget->addTab(soundViewer, fileStem);
ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, ZoneFile::AssetTypeToIcon(ASSET_SOUND)); // ui->tabWidget->setTabIcon(ui->tabWidget->count() - 1, Utils::CreateAssetIcon(Utils::ASSET_SOUND));
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); // ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
}); // });
connect(mTreeWidget, &XTreeWidget::ItemSelected, this, [this](const QString itemText) { connect(mTreeWidget, &XTreeWidget::ItemSelected, this, [this](const QString itemText) {
for (int i = 0; i < ui->tabWidget->count(); i++) { for (int i = 0; i < ui->tabWidget->count(); i++) {
@ -535,8 +548,17 @@ bool MainWindow::OpenFastFile(const QString aFastFilePath) {
and opens the selected file. and opens the selected file.
*/ */
bool MainWindow::OpenFastFile() { bool MainWindow::OpenFastFile() {
const QString fastFileName = Utils::GetOpenFastFileName(); // Open file dialog to steam apps
if (!OpenFastFile(fastFileName)) { const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
const QString fastFilePath = QFileDialog::getOpenFileName(this, "Open Fast File", steamPath, "Fast File (*.ff);;All Files (*.*)");
if (fastFilePath.isNull()) {
// User pressed cancel
return false;
} else if (!QFile::exists(fastFilePath)) {
QMessageBox::warning(this, "Warning!", QString("%1 does not exist!.").arg(fastFilePath));
return false;
}
if (!OpenFastFile(fastFilePath)) {
qDebug() << "Failed to open Fast file!"; qDebug() << "Failed to open Fast file!";
return false; return false;
} }
@ -564,8 +586,14 @@ bool MainWindow::OpenZoneFile(const QString aZoneFilePath, bool fromFF) {
} }
bool MainWindow::OpenZoneFile() { bool MainWindow::OpenZoneFile() {
const QString zoneFileName = Utils::GetOpenZoneFileName(); // Open file dialog to steam apps
if (!OpenZoneFile(zoneFileName)) { const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
const QString zoneFilePath = QFileDialog::getOpenFileName(this, "Open Zone File", steamPath, "Zone File (*.zone);;All Files (*.*)");
if (zoneFilePath.isNull()) {
// User pressed cancel
return false;
} else if (!QFile::exists(zoneFilePath)) {
QMessageBox::warning(this, "Warning!", QString("%1 does not exist!.").arg(zoneFilePath));
qDebug() << "Failed to open Zone file!"; qDebug() << "Failed to open Zone file!";
return false; return false;
} }

View File

@ -2,7 +2,6 @@
#define MAINWINDOW_H #define MAINWINDOW_H
#include "d3dbsp_structs.h" #include "d3dbsp_structs.h"
#include "asset_structs.h"
#include "xtreewidget.h" #include "xtreewidget.h"
#include <QMainWindow> #include <QMainWindow>
@ -64,7 +63,7 @@ private:
quint32 mTagCount; quint32 mTagCount;
quint32 mRecordCount; quint32 mRecordCount;
QMap<QString, QString> mRawFileMap; QMap<QString, QString> mRawFileMap;
QMap<QString, Image> mImageMap; //QMap<QString, Image> mImageMap;
QMap<QString, QTreeWidgetItem*> mTreeMap; QMap<QString, QTreeWidgetItem*> mTreeMap;
QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap; QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap;
XTreeWidget *mTreeWidget; XTreeWidget *mTreeWidget;

View File

@ -50,7 +50,7 @@
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="MenuDef">
<property name="title"> <property name="title">
<string>File</string> <string>File</string>
</property> </property>
@ -117,9 +117,17 @@
</property> </property>
<addaction name="actionAbout"/> <addaction name="actionAbout"/>
<addaction name="actionCheck_for_Updates"/> <addaction name="actionCheck_for_Updates"/>
<addaction name="actionReport_Issue"/>
</widget> </widget>
<addaction name="menuFile"/> <widget class="QMenu" name="menuTools">
<property name="title">
<string>Tools</string>
</property>
<addaction name="actionRun_Tests"/>
</widget>
<addaction name="MenuDef"/>
<addaction name="menuEdit"/> <addaction name="menuEdit"/>
<addaction name="menuTools"/>
<addaction name="menuHelp"/> <addaction name="menuHelp"/>
</widget> </widget>
<widget class="QToolBar" name="toolBar"> <widget class="QToolBar" name="toolBar">
@ -353,6 +361,16 @@
<string>Preferences...</string> <string>Preferences...</string>
</property> </property>
</action> </action>
<action name="actionReport_Issue">
<property name="text">
<string>Report Issue</string>
</property>
</action>
<action name="actionRun_Tests">
<property name="text">
<string>Run Tests</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../data/data.qrc"/> <include location="../data/data.qrc"/>

View File

@ -16,20 +16,20 @@ QString ToHexStr(quint32 in) {
} }
void MaterialViewer::SetMaterial(std::shared_ptr<Material> aMaterial) { void MaterialViewer::SetMaterial(std::shared_ptr<Material> aMaterial) {
ui->lineEdit_NamePtr->setText(ToHexStr(aMaterial->namePtr)); // ui->lineEdit_NamePtr->setText(ToHexStr(aMaterial->namePtr));
ui->lineEdit_Name->setText(aMaterial->name); // ui->lineEdit_Name->setText(aMaterial->name);
ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr)); // ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr));
ui->lineEdit_RefName->setText(aMaterial->refName); // ui->lineEdit_RefName->setText(aMaterial->refName);
QString unknownStr = ""; // QString unknownStr = "";
foreach (quint32 unknownPtr, aMaterial->pointers) { // foreach (quint32 unknownPtr, aMaterial->pointers) {
unknownStr += ToHexStr(unknownPtr) + "\n"; // unknownStr += ToHexStr(unknownPtr) + "\n";
} // }
ui->lineEdit_Unknowns->setText(unknownStr); // ui->lineEdit_Unknowns->setText(unknownStr);
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0])); // ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0]));
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1])); // ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1]));
ui->spinBox_TextureCount->setValue(aMaterial->textureCount); // ui->spinBox_TextureCount->setValue(aMaterial->textureCount);
ui->spinBox_ConstCount->setValue(aMaterial->constCount); // ui->spinBox_ConstCount->setValue(aMaterial->constCount);
ui->lineEdit_TechSetPtr->setText(ToHexStr(aMaterial->techSetPtr)); // ui->lineEdit_TechSetPtr->setText(ToHexStr(aMaterial->techSetPtr));
ui->lineEdit_TexturePtr->setText(ToHexStr(aMaterial->texturePtr)); // ui->lineEdit_TexturePtr->setText(ToHexStr(aMaterial->texturePtr));
ui->lineEdit_ConstantPtr->setText(ToHexStr(aMaterial->constPtr)); // ui->lineEdit_ConstantPtr->setText(ToHexStr(aMaterial->constPtr));
} }

View File

@ -1,7 +1,7 @@
#ifndef MATERIALVIEWER_H #ifndef MATERIALVIEWER_H
#define MATERIALVIEWER_H #define MATERIALVIEWER_H
#include "asset_structs.h" #include "material.h"
#include <QWidget> #include <QWidget>
#include <QScrollArea> #include <QScrollArea>

View File

@ -23,36 +23,36 @@ void RumbleFileViewer::SetRumbleFile(std::shared_ptr<RawFile> aRumbleFile) {
ui->tableWidget_Properties->clear(); ui->tableWidget_Properties->clear();
const QString magic = aRumbleFile->contents.left(6); // const QString magic = aRumbleFile->contents.left(6);
if (magic != "RUMBLE") { // if (magic != "RUMBLE") {
qDebug() << "Rumble file has invalid magic: " << magic; // qDebug() << "Rumble file has invalid magic: " << magic;
return; // return;
} // }
int firstIndex = 0; // int firstIndex = 0;
int secondIndex = 0; // int secondIndex = 0;
int thirdIndex = 0; // int thirdIndex = 0;
int startIndex = 0; // int startIndex = 0;
for (int i = 0; i < aRumbleFile->contents.count("\\") / 2; i++) { // for (int i = 0; i < aRumbleFile->contents.count("\\") / 2; i++) {
ui->tableWidget_Properties->setRowCount(i + 1); // ui->tableWidget_Properties->setRowCount(i + 1);
ui->spinBox_Entries->setValue(i + 1); // ui->spinBox_Entries->setValue(i + 1);
firstIndex = aRumbleFile->contents.indexOf("\\", startIndex); // firstIndex = aRumbleFile->contents.indexOf("\\", startIndex);
secondIndex = aRumbleFile->contents.indexOf("\\", firstIndex + 1); // secondIndex = aRumbleFile->contents.indexOf("\\", firstIndex + 1);
thirdIndex = aRumbleFile->contents.indexOf("\\", secondIndex + 1); // thirdIndex = aRumbleFile->contents.indexOf("\\", secondIndex + 1);
if (thirdIndex == -1) { // if (thirdIndex == -1) {
thirdIndex = aRumbleFile->contents.size(); // thirdIndex = aRumbleFile->contents.size();
} // }
const QString keyStr = aRumbleFile->contents.mid(firstIndex + 1, secondIndex - firstIndex - 1); // const QString keyStr = aRumbleFile->contents.mid(firstIndex + 1, secondIndex - firstIndex - 1);
QTableWidgetItem *keyItem = new QTableWidgetItem(keyStr); // QTableWidgetItem *keyItem = new QTableWidgetItem(keyStr);
ui->tableWidget_Properties->setItem(i, 0, keyItem); // ui->tableWidget_Properties->setItem(i, 0, keyItem);
const QString valStr = aRumbleFile->contents.mid(secondIndex + 1, thirdIndex - secondIndex - 1); // const QString valStr = aRumbleFile->contents.mid(secondIndex + 1, thirdIndex - secondIndex - 1);
QTableWidgetItem *valueItem = new QTableWidgetItem(valStr); // QTableWidgetItem *valueItem = new QTableWidgetItem(valStr);
ui->tableWidget_Properties->setItem(i, 1, valueItem); // ui->tableWidget_Properties->setItem(i, 1, valueItem);
startIndex = thirdIndex; // startIndex = thirdIndex;
} // }
} }

View File

@ -1,8 +1,8 @@
#ifndef RUMBLEFILEVIEWER_H #ifndef RUMBLEFILEVIEWER_H
#define RUMBLEFILEVIEWER_H #define RUMBLEFILEVIEWER_H
#include "asset_structs.h" #include "rawfile.h"
#include "zonefile.h"
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {

View File

@ -22,7 +22,7 @@ RumbleGraphViewer::~RumbleGraphViewer() {
void RumbleGraphViewer::SetRumbleGraphFile(const std::shared_ptr<RawFile> aRawFile) { void RumbleGraphViewer::SetRumbleGraphFile(const std::shared_ptr<RawFile> aRawFile) {
mRumbleGraphFile = aRawFile; mRumbleGraphFile = aRawFile;
QDataStream rawFileStream(mRumbleGraphFile->contents.toLatin1()); QDataStream rawFileStream;//(mRumbleGraphFile->contents.toLatin1());
QByteArray magic(15, Qt::Uninitialized); QByteArray magic(15, Qt::Uninitialized);
rawFileStream.readRawData(magic.data(), 15); rawFileStream.readRawData(magic.data(), 15);

View File

@ -1,7 +1,6 @@
#ifndef RUMBLEGRAPHVIEWER_H #ifndef RUMBLEGRAPHVIEWER_H
#define RUMBLEGRAPHVIEWER_H #define RUMBLEGRAPHVIEWER_H
#include "asset_structs.h"
#include "zonefile.h" #include "zonefile.h"
#include <QWidget> #include <QWidget>

View File

@ -61,17 +61,17 @@ SoundViewer::~SoundViewer()
delete ui; delete ui;
} }
void SoundViewer::SetSound(std::shared_ptr<Sound> aSound) // void SoundViewer::SetSound(std::shared_ptr<Sound> aSound)
{ // {
buffer->setData(aSound->data); // buffer->setData(aSound->data);
if (!buffer->open(QIODevice::ReadOnly)) { // if (!buffer->open(QIODevice::ReadOnly)) {
qWarning() << "Failed to open QBuffer."; // qWarning() << "Failed to open QBuffer.";
return; // return;
} // }
ui->groupBox->setTitle(aSound->path); // ui->groupBox->setTitle(aSound->path);
player->setSourceDevice(buffer); // player->setSourceDevice(buffer);
} // }
void SoundViewer::SetOutput(QAudioOutput *aOutput) { void SoundViewer::SetOutput(QAudioOutput *aOutput) {
if (!aOutput) { return; } if (!aOutput) { return; }

View File

@ -1,8 +1,6 @@
#ifndef SOUNDVIEWER_H #ifndef SOUNDVIEWER_H
#define SOUNDVIEWER_H #define SOUNDVIEWER_H
#include "asset_structs.h"
#include <QWidget> #include <QWidget>
#include <QMediaPlayer> #include <QMediaPlayer>
#include <QBuffer> #include <QBuffer>
@ -22,7 +20,7 @@ public:
explicit SoundViewer(QWidget *parent = nullptr); explicit SoundViewer(QWidget *parent = nullptr);
~SoundViewer(); ~SoundViewer();
void SetSound(std::shared_ptr<Sound> aSound); //void SetSound(std::shared_ptr<Sound> aSound);
void SetOutput(QAudioOutput *aOutput); void SetOutput(QAudioOutput *aOutput);
private: private:

View File

@ -19,18 +19,18 @@ void StringTableViewer::SetStringTable(std::shared_ptr<StringTable> aStringTable
ui->tableWidget_Strings->setRowCount(aStringTable->rowCount); ui->tableWidget_Strings->setRowCount(aStringTable->rowCount);
ui->tableWidget_Strings->setColumnCount(aStringTable->columnCount); ui->tableWidget_Strings->setColumnCount(aStringTable->columnCount);
int currentIndex = 0; // int currentIndex = 0;
for (const QString &key : aStringTable->content.keys()) { // for (const QString &key : aStringTable->content.keys()) {
const QString value = aStringTable->content[key]; // const QString value = aStringTable->content[key];
QTableWidgetItem *tableKeyItem = new QTableWidgetItem(); // QTableWidgetItem *tableKeyItem = new QTableWidgetItem();
tableKeyItem->setText(key); // tableKeyItem->setText(key);
ui->tableWidget_Strings->setItem(currentIndex, 0, tableKeyItem); // ui->tableWidget_Strings->setItem(currentIndex, 0, tableKeyItem);
QTableWidgetItem *tableValItem = new QTableWidgetItem(); // QTableWidgetItem *tableValItem = new QTableWidgetItem();
tableValItem->setText(value); // tableValItem->setText(value);
ui->tableWidget_Strings->setItem(currentIndex, 1, tableValItem); // ui->tableWidget_Strings->setItem(currentIndex, 1, tableValItem);
currentIndex++; // currentIndex++;
} // }
} }

View File

@ -1,7 +1,8 @@
#ifndef STRINGTABLEVIEWER_H #ifndef STRINGTABLEVIEWER_H
#define STRINGTABLEVIEWER_H #define STRINGTABLEVIEWER_H
#include "asset_structs.h" #include "stringtable.h"
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {

View File

@ -13,13 +13,13 @@ TechSetViewer::~TechSetViewer()
delete ui; delete ui;
} }
void TechSetViewer::SetTechSet(std::shared_ptr<TechSet> aTechSet) { void TechSetViewer::SetTechSet(std::shared_ptr<MaterialTechSet> aTechSet) {
ui->listWidget_Ptrs->clear(); //ui->listWidget_Ptrs->clear();
ui->label_Title->setText(aTechSet->name); ui->label_Title->setText(aTechSet->name);
int ptrIndex = 1; // int ptrIndex = 1;
for (auto ptr : aTechSet->pointers) { //for (auto ptr : aTechSet->pointers) {
ui->listWidget_Ptrs->addItem(QString("Pointer %1: %2").arg(ptrIndex).arg(ptr)); // ui->listWidget_Ptrs->addItem(QString("Pointer %1: %2").arg(ptrIndex).arg(ptr));
ptrIndex++; // ptrIndex++;
} //}
} }

View File

@ -1,7 +1,8 @@
#ifndef TECHSETVIEWER_H #ifndef TECHSETVIEWER_H
#define TECHSETVIEWER_H #define TECHSETVIEWER_H
#include "asset_structs.h" #include "materialtechset.h"
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {
@ -16,7 +17,7 @@ public:
explicit TechSetViewer(QWidget *parent = nullptr); explicit TechSetViewer(QWidget *parent = nullptr);
~TechSetViewer(); ~TechSetViewer();
void SetTechSet(std::shared_ptr<TechSet> aTechSet); void SetTechSet(std::shared_ptr<MaterialTechSet> aTechSet);
private: private:
Ui::TechSetViewer *ui; Ui::TechSetViewer *ui;

View File

@ -6,14 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>961</width> <width>880</width>
<height>756</height> <height>559</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QLabel" name="label_Title"> <widget class="QLabel" name="label_Title">
<property name="font"> <property name="font">
@ -29,46 +29,120 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>Unknown Pointers:</string> <string>Set Parameters</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QListWidget" name="listWidget_Ptrs"/> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_Name">
<property name="placeholderText">
<string>Technique set name</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>World Vertex Format:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_WorldVertFormat"/>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget_Techniques"/>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <widget class="QGroupBox" name="groupBox_2">
<property name="orientation"> <property name="title">
<enum>Qt::Orientation::Horizontal</enum> <string>Current Technique</string>
</property> </property>
<property name="sizeHint" stdset="0"> <layout class="QVBoxLayout" name="verticalLayout_2">
<size> <item>
<width>40</width> <layout class="QHBoxLayout" name="horizontalLayout_4">
<height>20</height> <item>
</size> <widget class="QLabel" name="label_4">
<property name="text">
<string>Name:</string>
</property> </property>
</spacer> </widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_TechniqueName">
<property name="placeholderText">
<string>Technique set name</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="orientation"> <item>
<enum>Qt::Orientation::Vertical</enum> <widget class="QLabel" name="label_5">
<property name="text">
<string>Flags:</string>
</property> </property>
<property name="sizeHint" stdset="0"> </widget>
<size> </item>
<width>20</width> <item>
<height>363</height> <widget class="QSpinBox" name="spinBox_Flags"/>
</size> </item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Pass Count:</string>
</property> </property>
</spacer> </widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_PassCount"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Material Pass</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -90,13 +90,13 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
} else { } else {
zoneItem = new XTreeWidgetItem(this); zoneItem = new XTreeWidgetItem(this);
} }
zoneItem->setIcon(0, ZoneFile::AssetTypeToIcon(ASSET_ZONE_FILE)); zoneItem->setIcon(0, Utils::CreateAssetIcon(Utils::ASSET_ZONE_FILE));
zoneItem->setText(0, aZoneFile->GetBaseStem() + ".zone"); zoneItem->setText(0, aZoneFile->GetBaseStem() + ".zone");
auto assetMap = aZoneFile->GetAssetMap(); auto assetMap = aZoneFile->GetAssetMap();
if (!assetMap.localStrings.isEmpty()) { if (!assetMap.localizeEntries.isEmpty()) {
QIcon localStrIcon = ZoneFile::AssetTypeToIcon(ASSET_LOCAL_STRING); QIcon localStrIcon = Utils::CreateAssetIcon(Utils::ASSET_LOCALIZE_ENTRY);
XTreeWidgetItem *localStrRoot = new XTreeWidgetItem(zoneItem); XTreeWidgetItem *localStrRoot = new XTreeWidgetItem(zoneItem);
localStrRoot->setText(0, "String Files"); localStrRoot->setText(0, "String Files");
@ -109,14 +109,14 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
} }
if (!assetMap.techSets.isEmpty()) { if (!assetMap.techSets.isEmpty()) {
QIcon techSetIcon = ZoneFile::AssetTypeToIcon(ASSET_TECH_SET); QIcon techSetIcon = Utils::CreateAssetIcon(Utils::ASSET_TECHNIQUE_SET);
XTreeWidgetItem *techSetRoot = new XTreeWidgetItem(zoneItem); XTreeWidgetItem *techSetRoot = new XTreeWidgetItem(zoneItem);
techSetRoot->setText(0, "Tech Sets"); techSetRoot->setText(0, "Tech Sets");
techSetRoot->setIcon(0, techSetIcon); techSetRoot->setIcon(0, techSetIcon);
techSetRoot->SetCategory(CATEGORY_TYPE); techSetRoot->SetCategory(CATEGORY_TYPE);
for (TechSet techSet : assetMap.techSets) { for (auto techSet : assetMap.techSets) {
XTreeWidgetItem *techSetItem = new XTreeWidgetItem(techSetRoot); XTreeWidgetItem *techSetItem = new XTreeWidgetItem(techSetRoot);
techSetItem->setText(0, techSet.name); techSetItem->setText(0, techSet.name);
techSetItem->setIcon(0, techSetIcon); techSetItem->setIcon(0, techSetIcon);
@ -124,122 +124,121 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
} }
if (!assetMap.rawFiles.isEmpty()) { if (!assetMap.rawFiles.isEmpty()) {
QIcon rawFileIcon = ZoneFile::AssetTypeToIcon(ASSET_RAW_FILE); QIcon rawFileIcon = Utils::CreateAssetIcon(Utils::ASSET_RAWFILE);
XTreeWidgetItem *rawFileRoot = new XTreeWidgetItem(zoneItem); XTreeWidgetItem *rawFileRoot = new XTreeWidgetItem(zoneItem);
rawFileRoot->setText(0, "Raw Files"); rawFileRoot->setText(0, "Raw Files");
rawFileRoot->setIcon(0, rawFileIcon); rawFileRoot->setIcon(0, rawFileIcon);
rawFileRoot->SetCategory(CATEGORY_TYPE); rawFileRoot->SetCategory(CATEGORY_TYPE);
for (RawFile rawFile : assetMap.rawFiles) { for (auto rawFile : assetMap.rawFiles) {
if (!rawFile.length) { continue; } if (!rawFile.length) { continue; }
XTreeWidgetItem *tempItem = rawFileRoot; XTreeWidgetItem *tempItem = rawFileRoot;
const QStringList pathParts = rawFile.path.split('/'); // const QStringList pathParts = rawFile->path.split('/');
for (const QString &pathPart : pathParts) { // for (const QString &pathPart : pathParts) {
bool childFound = false; // bool childFound = false;
for (int i = 0; i < tempItem->childCount(); i++) { // for (int i = 0; i < tempItem->childCount(); i++) {
QTreeWidgetItem *rawChildItem = tempItem->child(i); // QTreeWidgetItem *rawChildItem = tempItem->child(i);
XTreeWidgetItem *childItem = dynamic_cast<XTreeWidgetItem*>(rawChildItem); // XTreeWidgetItem *childItem = dynamic_cast<XTreeWidgetItem*>(rawChildItem);
if (childItem->text(0) == pathPart) { // if (childItem->text(0) == pathPart) {
tempItem = childItem; // tempItem = childItem;
childFound = true; // childFound = true;
break; // break;
} // }
} // }
const QString rawFileStr = QString("%1 [%2-%3]").arg(pathPart).arg(rawFile.startPos).arg(rawFile.endPos); // const QString rawFileStr = pathPart;// = QString("%1 [%2-%3]").arg(pathPart).arg(rawFile.startPos).arg(rawFile.endPos);
//rawFileStr = pathPart; // if (pathPart == pathParts.last()) {
if (pathPart == pathParts.last()) { // XTreeWidgetItem *rawFileItem = new XTreeWidgetItem(tempItem);
XTreeWidgetItem *rawFileItem = new XTreeWidgetItem(tempItem); // rawFileItem->setText(0, rawFileStr);
rawFileItem->setText(0, rawFileStr);
tempItem = rawFileItem; // tempItem = rawFileItem;
} else if (!childFound) { // } else if (!childFound) {
tempItem = new XTreeWidgetItem(tempItem); // tempItem = new XTreeWidgetItem(tempItem);
tempItem->setText(0, rawFileStr); // tempItem->setText(0, rawFileStr);
} // }
} // }
tempItem->setIcon(0, rawFileIcon); tempItem->setIcon(0, rawFileIcon);
} }
} }
if (!assetMap.menuFiles.isEmpty()) { if (!assetMap.menuDefinitions.isEmpty()) {
QIcon menuFileIcon = ZoneFile::AssetTypeToIcon(ASSET_MENU); // QIcon MenuDefIcon = Utils::CreateAssetIcon(Utils::ASSET_MENU);
XTreeWidgetItem *menuRoot = new XTreeWidgetItem(zoneItem); // XTreeWidgetItem *menuRoot = new XTreeWidgetItem(zoneItem);
menuRoot->setText(0, "Menu Files"); // menuRoot->setText(0, "Menu Files");
menuRoot->setIcon(0, menuFileIcon); // menuRoot->setIcon(0, MenuDefIcon);
menuRoot->SetCategory(CATEGORY_TYPE); // menuRoot->SetCategory(CATEGORY_TYPE);
int menuIndex = 1; // int menuIndex = 1;
for (MenuFile menuFile : assetMap.menuFiles) { // for (MenuDef menuDef : assetMap.menuDefinitions) {
XTreeWidgetItem *menuFileRoot = new XTreeWidgetItem(menuRoot); // XTreeWidgetItem *MenuDefRoot = new XTreeWidgetItem(menuRoot);
menuFileRoot->setText(0, QString("Menu %1").arg(menuIndex)); // MenuDefRoot->setText(0, QString("Menu %1").arg(menuIndex));
for (Menu menu : menuFile.menuDefs) { // for (Menu menu : menuDef.men) {
XTreeWidgetItem *menuItem = new XTreeWidgetItem(menuFileRoot); // XTreeWidgetItem *menuItem = new XTreeWidgetItem(MenuDefRoot);
menuItem->setText(0, menu.filePath); // menuItem->setText(0, menu.filePath);
menuItem->setIcon(0, menuFileIcon); // menuItem->setIcon(0, MenuDefIcon);
} // }
menuIndex++; // menuIndex++;
} // }
} }
if (!assetMap.images.isEmpty()) { if (!assetMap.images.isEmpty()) {
QIcon imageIcon = ZoneFile::AssetTypeToIcon(ASSET_IMAGE); // QIcon imageIcon = Utils::CreateAssetIcon(Utils::ASSET_IMAGE);
XTreeWidgetItem *imageRoot = new XTreeWidgetItem(zoneItem); // XTreeWidgetItem *imageRoot = new XTreeWidgetItem(zoneItem);
imageRoot->setText(0, "Images"); // imageRoot->setText(0, "Images");
imageRoot->setIcon(0, imageIcon); // imageRoot->setIcon(0, imageIcon);
imageRoot->SetCategory(CATEGORY_TYPE); // imageRoot->SetCategory(CATEGORY_TYPE);
for (Image image : assetMap.images) { // for (Image image : assetMap.images) {
XTreeWidgetItem *imageItem = new XTreeWidgetItem(imageRoot); // XTreeWidgetItem *imageItem = new XTreeWidgetItem(imageRoot);
imageItem->setText(0, image.materialName); // imageItem->setText(0, image.materialName);
imageItem->setIcon(0, imageIcon); // imageItem->setIcon(0, imageIcon);
} // }
} }
if (!assetMap.models.isEmpty()) { if (!assetMap.models.isEmpty()) {
QIcon modelIcon = ZoneFile::AssetTypeToIcon(ASSET_MODEL); QIcon modelIcon = Utils::CreateAssetIcon(Utils::ASSET_XMODEL);
XTreeWidgetItem *modelsRoot = new XTreeWidgetItem(zoneItem); XTreeWidgetItem *modelsRoot = new XTreeWidgetItem(zoneItem);
modelsRoot->setText(0, "Models"); modelsRoot->setText(0, "Models");
modelsRoot->setIcon(0, modelIcon); modelsRoot->setIcon(0, modelIcon);
modelsRoot->SetCategory(CATEGORY_TYPE); modelsRoot->SetCategory(CATEGORY_TYPE);
for (Model model: assetMap.models) { for (auto model: assetMap.models) {
XTreeWidgetItem *modelItem = new XTreeWidgetItem(modelsRoot); XTreeWidgetItem *modelItem = new XTreeWidgetItem(modelsRoot);
modelItem->setText(0, model.modelName); modelItem->setText(0, model.name);
modelItem->setIcon(0, modelIcon); modelItem->setIcon(0, modelIcon);
} }
} }
if (!assetMap.materials.isEmpty()) { if (!assetMap.materials.isEmpty()) {
QIcon materialIcon = ZoneFile::AssetTypeToIcon(ASSET_MATERIAL); QIcon materialIcon = Utils::CreateAssetIcon(Utils::ASSET_MATERIAL);
XTreeWidgetItem *materialsRoot = new XTreeWidgetItem(zoneItem); XTreeWidgetItem *materialsRoot = new XTreeWidgetItem(zoneItem);
materialsRoot->setText(0, "Materials"); materialsRoot->setText(0, "Materials");
materialsRoot->setIcon(0, materialIcon); materialsRoot->setIcon(0, materialIcon);
materialsRoot->SetCategory(CATEGORY_TYPE); materialsRoot->SetCategory(CATEGORY_TYPE);
for (Material material: assetMap.materials) { for (auto material: assetMap.materials) {
XTreeWidgetItem *materialItem = new XTreeWidgetItem(materialsRoot); XTreeWidgetItem *materialItem = new XTreeWidgetItem(materialsRoot);
materialItem->setText(0, material.name); //materialItem->setText(0, material.name);
materialItem->setIcon(0, materialIcon); materialItem->setIcon(0, materialIcon);
} }
} }
if (!assetMap.stringTables.isEmpty()) { if (!assetMap.stringTables.isEmpty()) {
QIcon stringTableIcon = ZoneFile::AssetTypeToIcon(ASSET_STRING_TABLE); QIcon stringTableIcon = Utils::CreateAssetIcon(Utils::ASSET_STRINGTABLE);
XTreeWidgetItem *strTableRoot = new XTreeWidgetItem(zoneItem); XTreeWidgetItem *strTableRoot = new XTreeWidgetItem(zoneItem);
strTableRoot->setText(0, "String Tables"); strTableRoot->setText(0, "String Tables");
strTableRoot->setIcon(0, stringTableIcon); strTableRoot->setIcon(0, stringTableIcon);
strTableRoot->SetCategory(CATEGORY_TYPE); strTableRoot->SetCategory(CATEGORY_TYPE);
for (StringTable strTable: assetMap.stringTables) { for (auto strTable: assetMap.stringTables) {
XTreeWidgetItem *modelItem = new XTreeWidgetItem(strTableRoot); XTreeWidgetItem *modelItem = new XTreeWidgetItem(strTableRoot);
modelItem->setText(0, strTable.name); modelItem->setText(0, strTable.name);
modelItem->setIcon(0, stringTableIcon); modelItem->setIcon(0, stringTableIcon);
@ -247,46 +246,12 @@ void XTreeWidget::AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetIt
} }
if (!assetMap.sounds.isEmpty()) { if (!assetMap.sounds.isEmpty()) {
QIcon soundIcon = ZoneFile::AssetTypeToIcon(ASSET_SOUND); QIcon soundIcon = Utils::CreateAssetIcon(Utils::ASSET_SOUND);
XTreeWidgetItem *soundsRoot = new XTreeWidgetItem(zoneItem); XTreeWidgetItem *soundsRoot = new XTreeWidgetItem(zoneItem);
soundsRoot->setText(0, "Sounds"); soundsRoot->setText(0, "Sounds");
soundsRoot->setIcon(0, soundIcon); soundsRoot->setIcon(0, soundIcon);
soundsRoot->SetCategory(CATEGORY_TYPE); soundsRoot->SetCategory(CATEGORY_TYPE);
for (SoundAsset soundAsset : assetMap.sounds) {
for (Sound sound : soundAsset.sounds) {
XTreeWidgetItem *tempItem = soundsRoot;
if (!sound.dataLength) { continue; }
for (const QString &pathPart : sound.path.split('/')) {
if (pathPart.isEmpty()) { continue; }
bool childFound = false;
for (int i = 0; i < tempItem->childCount(); i++) {
XTreeWidgetItem *childItem = dynamic_cast<XTreeWidgetItem*>(tempItem->child(i));
if (childItem->text(0) == pathPart) {
tempItem = childItem;
childFound = true;
break;
}
}
if (pathPart.contains(".wav")) {
XTreeWidgetItem *soundItem = new XTreeWidgetItem(tempItem);
soundItem->setText(0, pathPart);
tempItem = soundItem;
} else if (!childFound) {
tempItem = new XTreeWidgetItem(tempItem);
tempItem->setText(0, pathPart);
}
}
tempItem->setIcon(0, soundIcon);
}
}
} }
mZoneFiles[aZoneFile->GetBaseStem() + ".zone"] = aZoneFile; mZoneFiles[aZoneFile->GetBaseStem() + ".zone"] = aZoneFile;
@ -518,7 +483,7 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
const QString zoneFilePath = QFileDialog::getSaveFileName( const QString zoneFilePath = QFileDialog::getSaveFileName(
nullptr, "Export Zone File...", QDir::currentPath(), nullptr, "Export Zone File...", QDir::currentPath(),
"Zone File (*.zone);;All Files(*.*)"); "Zone File (*.zone);;All Files(*.*)");
fastFile->GetZoneFile()->SaveZoneFile(zoneFilePath); //fastFile->GetZoneFile()->SaveZoneFile(zoneFilePath);
}); });
} else if (activeText.contains(".zone")) { } else if (activeText.contains(".zone")) {
const QString fileStem = activeText; const QString fileStem = activeText;
@ -553,40 +518,40 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
} }
if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) { if (parentItem && parentItem != invisibleRootItem() && parentItem->text(0).contains(".zone")) {
const QString fileStem = parentItem->text(0).section('.', 0, 0); const QString fileStem = parentItem->text(0).section('.', 0, 0);
QVector<SoundAsset> soundAssets = mZoneFiles[fileStem]->GetAssetMap().sounds; // QVector<LoadedSound> LoadedSounds = mZoneFiles[fileStem]->GetAssetMap().sounds;
for (SoundAsset soundAsset : soundAssets) { // for (LoadedSound LoadedSound : LoadedSounds) {
for (Sound sound : soundAsset.sounds) { // for (Sound sound : LoadedSound.sounds) {
if (sound.path.contains(activeText)) { // if (sound.path.contains(activeText)) {
QMenu *exportSubmenu = new QMenu("Export...", this); // QMenu *exportSubmenu = new QMenu("Export...", this);
contextMenu->addMenu(exportSubmenu); // contextMenu->addMenu(exportSubmenu);
QAction *exportWAVAction = new QAction("Export as WAV File"); // QAction *exportWAVAction = new QAction("Export as WAV File");
exportSubmenu->addAction(exportWAVAction); // exportSubmenu->addAction(exportWAVAction);
connect(exportWAVAction, &QAction::triggered, this, [sound](bool checked) { // connect(exportWAVAction, &QAction::triggered, this, [sound](bool checked) {
Q_UNUSED(checked); // Q_UNUSED(checked);
QDir dir = QDir::currentPath(); // QDir dir = QDir::currentPath();
if (!dir.exists("exports/")) { // if (!dir.exists("exports/")) {
dir.mkdir("exports/"); // dir.mkdir("exports/");
} // }
if (!dir.exists("exports/sounds/")) { // if (!dir.exists("exports/sounds/")) {
dir.mkdir("exports/sounds/"); // dir.mkdir("exports/sounds/");
} // }
const QString fileName = "exports/sounds/" + sound.path.split('/').last(); // const QString fileName = "exports/sounds/" + sound.path.split('/').last();
QFile wavFile(fileName); // QFile wavFile(fileName);
if (!wavFile.open(QIODevice::WriteOnly)) { // if (!wavFile.open(QIODevice::WriteOnly)) {
qDebug() << "Failed to write wav file!"; // qDebug() << "Failed to write wav file!";
return; // return;
} // }
wavFile.write(sound.data); // wavFile.write(sound.data);
wavFile.close(); // wavFile.close();
}); // });
break; // break;
} // }
} // }
} // }
} }
} else if (activeItem && activeText == "Sounds") { } else if (activeItem && activeText == "Sounds") {
XTreeWidgetItem *parentItem = dynamic_cast<XTreeWidgetItem*>(activeItem->parent()); XTreeWidgetItem *parentItem = dynamic_cast<XTreeWidgetItem*>(activeItem->parent());
@ -609,29 +574,29 @@ void XTreeWidget::PrepareContextMenu(const QPoint &pos) {
connect(exportAllWAVAction, &QAction::triggered, this, [zoneFile](bool checked) { connect(exportAllWAVAction, &QAction::triggered, this, [zoneFile](bool checked) {
Q_UNUSED(checked); Q_UNUSED(checked);
for (SoundAsset soundAsset : zoneFile->GetAssetMap().sounds) { // for (LoadedSound LoadedSound : zoneFile->GetAssetMap().sounds) {
for (Sound sound : soundAsset.sounds) { // for (Sound sound : LoadedSound.sounds) {
if (!sound.dataLength) { continue; } // if (!sound.dataLength) { continue; }
QDir dir = QDir::currentPath(); // QDir dir = QDir::currentPath();
if (!dir.exists("exports/")) { // if (!dir.exists("exports/")) {
dir.mkdir("exports/"); // dir.mkdir("exports/");
} // }
if (!dir.exists("exports/sounds/")) { // if (!dir.exists("exports/sounds/")) {
dir.mkdir("exports/sounds/"); // dir.mkdir("exports/sounds/");
} // }
const QString fileName = "exports/sounds/" + sound.path.split('/').last(); // const QString fileName = "exports/sounds/" + sound.path.split('/').last();
QFile wavFile(fileName); // QFile wavFile(fileName);
if (!wavFile.open(QIODevice::WriteOnly)) { // if (!wavFile.open(QIODevice::WriteOnly)) {
qDebug() << "Failed to write wav file!"; // qDebug() << "Failed to write wav file!";
return; // return;
} // }
wavFile.write(sound.data); // wavFile.write(sound.data);
wavFile.close(); // wavFile.close();
} // }
} // }
}); });
} }
} }
@ -688,13 +653,13 @@ void XTreeWidget::ItemSelectionChanged() {
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent()); XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
if (grandpaItem && grandpaItem->text(0).contains(".zone")) { if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
const QString fileStem = grandpaItem->text(0).section('.', 0, 0); const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
QVector<Image> images = mZoneFiles[fileStem]->GetAssetMap().images; // QVector<Image> images = mZoneFiles[fileStem]->GetAssetMap().images;
for (Image image : images) { // for (Image image : images) {
if (image.materialName == selectedText) { // if (image.materialName == selectedText) {
emit ImageSelected(std::make_shared<Image>(image), fileStem); // emit ImageSelected(std::make_shared<Image>(image), fileStem);
break; // break;
} // }
} // }
} }
} else if (parentItem && (parentItem->text(0) == "Tech Sets")) { } else if (parentItem && (parentItem->text(0) == "Tech Sets")) {
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent()); XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
@ -703,19 +668,7 @@ void XTreeWidget::ItemSelectionChanged() {
auto techsets = mZoneFiles[fileStem]->GetAssetMap().techSets; auto techsets = mZoneFiles[fileStem]->GetAssetMap().techSets;
for (auto techset : techsets) { for (auto techset : techsets) {
if (techset.name == selectedText) { if (techset.name == selectedText) {
emit TechSetSelected(std::make_shared<TechSet>(techset), fileStem); emit TechSetSelected(std::make_shared<MaterialTechSet>(techset), fileStem);
break;
}
}
}
} else if (parentItem && (parentItem->text(0) == "Tech Sets")) {
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
auto techsets = mZoneFiles[fileStem]->GetAssetMap().techSets;
for (auto techset : techsets) {
if (techset.name == selectedText) {
emit TechSetSelected(std::make_shared<TechSet>(techset), fileStem);
break; break;
} }
} }
@ -724,12 +677,12 @@ void XTreeWidget::ItemSelectionChanged() {
XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent()); XTreeWidgetItem *grandpaItem = dynamic_cast<XTreeWidgetItem*>(parentItem->parent());
if (grandpaItem && grandpaItem->text(0).contains(".zone")) { if (grandpaItem && grandpaItem->text(0).contains(".zone")) {
const QString fileStem = grandpaItem->text(0).section('.', 0, 0); const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
QVector<Material> materials = mZoneFiles[fileStem]->GetAssetMap().materials; auto materials = mZoneFiles[fileStem]->GetAssetMap().materials;
for (Material material : materials) { for (auto material : materials) {
if (material.name == selectedText) { // if (material.name == selectedText) {
emit MaterialSelected(std::make_shared<Material>(material), fileStem); // emit MaterialSelected(std::make_shared<Material>(material), fileStem);
break; // break;
} // }
} }
} }
} else if (parentItem && selectedText.contains(".wav")) { } else if (parentItem && selectedText.contains(".wav")) {
@ -743,15 +696,15 @@ void XTreeWidget::ItemSelectionChanged() {
} }
if (grandpaItem && grandpaItem != invisibleRootItem() && grandpaItem->text(0).contains(".zone")) { if (grandpaItem && grandpaItem != invisibleRootItem() && grandpaItem->text(0).contains(".zone")) {
const QString fileStem = grandpaItem->text(0).section('.', 0, 0); const QString fileStem = grandpaItem->text(0).section('.', 0, 0);
QVector<SoundAsset> soundAssets = mZoneFiles[fileStem]->GetAssetMap().sounds; // QVector<LoadedSound> LoadedSounds = mZoneFiles[fileStem]->GetAssetMap().sounds;
for (SoundAsset soundAsset : soundAssets) { // for (LoadedSound LoadedSound : LoadedSounds) {
for (Sound sound : soundAsset.sounds) { // for (Sound sound : LoadedSound.sounds) {
if (sound.path.contains(selectedText)) { // if (sound.path.contains(selectedText)) {
emit SoundSelected(std::make_shared<Sound>(sound), fileStem); // emit SoundSelected(std::make_shared<Sound>(sound), fileStem);
break; // break;
} // }
} // }
} // }
} }
} else if (selectedItem->GetCategory() != CATEGORY_TYPE) { } else if (selectedItem->GetCategory() != CATEGORY_TYPE) {
XTreeWidgetItem *zoneRoot = selectedItem; XTreeWidgetItem *zoneRoot = selectedItem;
@ -772,12 +725,12 @@ void XTreeWidget::ItemSelectionChanged() {
return; return;
} }
QVector<RawFile> rawFiles = mZoneFiles[fileStem]->GetAssetMap().rawFiles; auto rawFiles = mZoneFiles[fileStem]->GetAssetMap().rawFiles;
for (RawFile rawFile : rawFiles) { for (auto rawFile : rawFiles) {
if (rawFile.path.split('/').last() == selectedText) { //if (rawFile->path.split('/').last() == selectedText) {
emit RawFileSelected(std::make_shared<RawFile>(rawFile), fileStem); // emit RawFileSelected(std::make_shared<RawFile>(rawFile), fileStem);
return; // return;
} //}
} }
} }
} }
@ -819,7 +772,7 @@ void XTreeWidget::AddIWIFile(std::shared_ptr<IWIFile> aIWIFile) {
} }
XTreeWidgetItem *iwiItem = new XTreeWidgetItem(this); XTreeWidgetItem *iwiItem = new XTreeWidgetItem(this);
iwiItem->setIcon(0, ZoneFile::AssetTypeToIcon(ASSET_IMAGE)); iwiItem->setIcon(0, Utils::CreateAssetIcon(Utils::ASSET_IMAGE));
iwiItem->setText(0, iwiFileName); iwiItem->setText(0, iwiFileName);
mIWIFiles[aIWIFile->fileStem.section(".", 0, 0)] = aIWIFile; mIWIFiles[aIWIFile->fileStem.section(".", 0, 0)] = aIWIFile;
} }
@ -835,7 +788,7 @@ void XTreeWidget::AddDDSFile(std::shared_ptr<DDSFile> aDDSFile) {
} }
XTreeWidgetItem *ddsItem = new XTreeWidgetItem(this); XTreeWidgetItem *ddsItem = new XTreeWidgetItem(this);
ddsItem->setIcon(0, ZoneFile::AssetTypeToIcon(ASSET_IMAGE)); ddsItem->setIcon(0, Utils::CreateAssetIcon(Utils::ASSET_IMAGE));
ddsItem->setText(0, ddsFileName); ddsItem->setText(0, ddsFileName);
mDDSFiles[aDDSFile->fileStem.section(".", 0, 0)] = aDDSFile; mDDSFiles[aDDSFile->fileStem.section(".", 0, 0)] = aDDSFile;
} }

View File

@ -2,13 +2,15 @@
#define XTREEWIDGET_H #define XTREEWIDGET_H
#include "d3dbsp_structs.h" #include "d3dbsp_structs.h"
#include "asset_structs.h"
#include "ddsfile.h" #include "ddsfile.h"
#include "iwifile.h" #include "iwifile.h"
#include "fastfile.h" #include "fastfile.h"
#include "xtreewidgetitem.h" #include "xtreewidgetitem.h"
#include "zonefile.h" #include "zonefile.h"
#include "utils.h" #include "rawfile.h"
#include "gfximage.h"
#include "stringtable.h"
#include "menudef.h"
#include <QTreeWidget> #include <QTreeWidget>
#include <QFileDialog> #include <QFileDialog>
@ -39,11 +41,11 @@ signals:
void ZoneFileSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName); void ZoneFileSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
void LocalStringSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName); void LocalStringSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
void RawFileSelected(std::shared_ptr<RawFile> aRawFile, const QString aParentName); void RawFileSelected(std::shared_ptr<RawFile> aRawFile, const QString aParentName);
void ImageSelected(std::shared_ptr<Image> aImage, const QString aParentName); void ImageSelected(std::shared_ptr<GfxImage> aImage, const QString aParentName);
void TechSetSelected(std::shared_ptr<TechSet> aZoneFile, const QString aParentName); void TechSetSelected(std::shared_ptr<MaterialTechSet> aZoneFile, const QString aParentName);
void StrTableSelected(std::shared_ptr<StringTable> aStrTable, const QString aParentName); void StrTableSelected(std::shared_ptr<StringTable> aStrTable, const QString aParentName);
void MenuSelected(std::shared_ptr<Menu> aMenu, const QString aParentName); void MenuSelected(std::shared_ptr<MenuDef> aMenu, const QString aParentName);
void SoundSelected(std::shared_ptr<Sound> aSound, const QString aParentName); void SoundSelected(std::shared_ptr<LoadedSound> aSound, const QString aParentName);
void MaterialSelected(std::shared_ptr<Material> aMaterial, const QString aParentName); void MaterialSelected(std::shared_ptr<Material> aMaterial, const QString aParentName);
void ItemSelected(const QString itemText); void ItemSelected(const QString itemText);

View File

@ -109,16 +109,16 @@ void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
int assetIndex = 0; int assetIndex = 0;
foreach (auto assetOccurance, assetOccurances) { foreach (auto assetOccurance, assetOccurances) {
const QString record = assetOccurance.first; const QString record = assetOccurance.first;
AssetType assetType = mZoneFile->AssetStrToEnum(record); Utils::AssetType assetType = mZoneFile->AssetStrToEnum(record);
int assetCount = assetOccurance.second; int assetCount = assetOccurance.second;
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType); QIcon assetIcon = Utils::CreateAssetIcon(assetType);
if (assetIcon.isNull()) { if (assetIcon.isNull()) {
qDebug() << "Icon is null for record: " << record; qDebug() << "Icon is null for record: " << record;
} }
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper()); QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
QTableWidgetItem *recordStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType)); QTableWidgetItem *recordStrItem = new QTableWidgetItem(Utils::AssetTypeToStr(assetType));
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(assetCount)); QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(assetCount));
recordItem->setIcon(assetIcon); recordItem->setIcon(assetIcon);
@ -133,8 +133,8 @@ void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
for (const QString &record : recordCounts.keys()) { for (const QString &record : recordCounts.keys()) {
int recordCount = recordCounts[record]; int recordCount = recordCounts[record];
AssetType assetType = mZoneFile->AssetStrToEnum(record); Utils::AssetType assetType = mZoneFile->AssetStrToEnum(record);
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType); QIcon assetIcon = Utils::CreateAssetIcon(assetType);
if (assetIcon.isNull()) { if (assetIcon.isNull()) {
qDebug() << "Icon is null for record: " << record; qDebug() << "Icon is null for record: " << record;
} }
@ -142,7 +142,7 @@ void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
ui->tableWidget_RecordCounts->setRowCount(recordIndex + 1); ui->tableWidget_RecordCounts->setRowCount(recordIndex + 1);
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper()); QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType)); QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(Utils::AssetTypeToStr(assetType));
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(recordCount)); QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(recordCount));
recordItem->setIcon(assetIcon); recordItem->setIcon(assetIcon);

View File

@ -1,6 +1,8 @@
#include "assets_cod4_360.h" #include "assets_cod4_360.h"
Assets_COD4_360::Assets_COD4_360() { Assets_COD4_360::Assets_COD4_360(QObject *parent)
: Assets(parent)
{
} }
@ -8,106 +10,3 @@ Assets_COD4_360::~Assets_COD4_360() {
} }
std::shared_ptr<Animation> Assets_COD4_360::Load_Animation(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<Model> Assets_COD4_360::Load_Model(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<Material> Assets_COD4_360::Load_Material(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<MaterialPixelShader> Assets_COD4_360::Load_MaterialPixelShader(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<MaterialTechSet> Assets_COD4_360::Load_MaterialTechSet(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<GfxImage> Assets_COD4_360::Load_GfxImage(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<SoundAliasList> Assets_COD4_360::Load_SoundAliasList(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<SoundCurve> Assets_COD4_360::Load_SoundCurve(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<LoadedSound> Assets_COD4_360::Load_LoadedSound(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<ClipMap> Assets_COD4_360::Load_ClipMap(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<ComWorld> Assets_COD4_360::Load_ComWorld(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<GameWorldSp> Assets_COD4_360::Load_GameWorldSp(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<GameWorldMp> Assets_COD4_360::Load_GameWorldMp(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<MapEnts> Assets_COD4_360::Load_MapEnts(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<GfxWorld> Assets_COD4_360::Load_GfxWorld(QDataStream *aZoneFileStream){
return nullptr;
}
std::shared_ptr<GfxLightDef> Assets_COD4_360::Load_GfxLightPtr(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<GameFont> Assets_COD4_360::Load_GameFont(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<MenuList> Assets_COD4_360::Load_MenuList(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<MenuDef> Assets_COD4_360::Load_MenuDef(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<LocalizeEntry> Assets_COD4_360::Load_LocalizeEntry(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<WeaponDef> Assets_COD4_360::Load_WeaponDef(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<SoundDriver> Assets_COD4_360::Load_SoundDriver(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<EffectDef> Assets_COD4_360::Load_EffectDef(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<ImpactTable> Assets_COD4_360::Load_ImpactTable(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<RawFile> Assets_COD4_360::Load_RawFile(QDataStream *aZoneFileStream) {
return nullptr;
}
std::shared_ptr<StringTable> Assets_COD4_360::Load_StringTable(QDataStream *aZoneFileStream) {
return nullptr;
}

View File

@ -5,36 +5,11 @@
class Assets_COD4_360 : public Assets class Assets_COD4_360 : public Assets
{ {
public: Q_OBJECT
Assets_COD4_360();
~Assets_COD4_360();
std::shared_ptr<Animation> Load_Animation(QDataStream *aZoneFileStream) override; public:
std::shared_ptr<Model> Load_Model(QDataStream *aZoneFileStream) override; explicit Assets_COD4_360(QObject *parent = nullptr);
std::shared_ptr<Material> Load_Material(QDataStream *aZoneFileStream) override; ~Assets_COD4_360();
std::shared_ptr<MaterialPixelShader> Load_MaterialPixelShader(QDataStream *aZoneFileStream) override;
std::shared_ptr<MaterialTechSet> Load_MaterialTechSet(QDataStream *aZoneFileStream) override;
std::shared_ptr<GfxImage> Load_GfxImage(QDataStream *aZoneFileStream) override;
std::shared_ptr<SoundAliasList> Load_SoundAliasList(QDataStream *aZoneFileStream) override;
std::shared_ptr<SoundCurve> Load_SoundCurve(QDataStream *aZoneFileStream) override;
std::shared_ptr<LoadedSound> Load_LoadedSound(QDataStream *aZoneFileStream) override;
std::shared_ptr<ClipMap> Load_ClipMap(QDataStream *aZoneFileStream) override;
std::shared_ptr<ComWorld> Load_ComWorld(QDataStream *aZoneFileStream) override;
std::shared_ptr<GameWorldSp> Load_GameWorldSp(QDataStream *aZoneFileStream) override;
std::shared_ptr<GameWorldMp> Load_GameWorldMp(QDataStream *aZoneFileStream) override;
std::shared_ptr<MapEnts> Load_MapEnts(QDataStream *aZoneFileStream) override;
std::shared_ptr<GfxWorld> Load_GfxWorld(QDataStream *aZoneFileStream) override;
std::shared_ptr<GfxLightDef> Load_GfxLightPtr(QDataStream *aZoneFileStream) override;
std::shared_ptr<GameFont> Load_GameFont(QDataStream *aZoneFileStream) override;
std::shared_ptr<MenuList> Load_MenuList(QDataStream *aZoneFileStream) override;
std::shared_ptr<MenuDef> Load_MenuDef(QDataStream *aZoneFileStream) override;
std::shared_ptr<LocalizeEntry> Load_LocalizeEntry(QDataStream *aZoneFileStream) override;
std::shared_ptr<WeaponDef> Load_WeaponDef(QDataStream *aZoneFileStream) override;
std::shared_ptr<SoundDriver> Load_SoundDriver(QDataStream *aZoneFileStream) override;
std::shared_ptr<EffectDef> Load_EffectDef(QDataStream *aZoneFileStream) override;
std::shared_ptr<ImpactTable> Load_ImpactTable(QDataStream *aZoneFileStream) override;
std::shared_ptr<RawFile> Load_RawFile(QDataStream *aZoneFileStream) override;
std::shared_ptr<StringTable> Load_StringTable(QDataStream *aZoneFileStream) override;
}; };
#endif // ASSETS_COD4_360_H #endif // ASSETS_COD4_360_H

648
libs/assets/animparts.cpp Normal file
View File

@ -0,0 +1,648 @@
#include "animparts.h"
#include <QIODevice>
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDynamicFrames &aAnimDynamicFramesIn)
{
aDataStream << aAnimDynamicFramesIn.framesPtr;
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimDynamicFrames &aAnimDynamicFramesOut)
{
aDataStream >> aAnimDynamicFramesOut.framesPtr;
return aDataStream;
}
QString XAnimDynamicFramesToString(const XAnimDynamicFrames &aAnimDynamicFrames) {
QString debug;
debug.append("XAnimDynamicFrames(");
debug.append(QString("\n framesPtr: %1").arg(aAnimDynamicFrames.framesPtr));
for (int i = 0; i < 3; i++) {
debug.append(QString("\n frames %1: %2").arg(i).arg(aAnimDynamicFrames.frames[i]));
}
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDynamicIndices &aAnimDynamicIndicesIn)
{
aDataStream << aAnimDynamicIndicesIn.indices[0];
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimDynamicIndices &aAnimDynamicIndicesOut)
{
aDataStream >> aAnimDynamicIndicesOut.indices[0];
return aDataStream;
}
QString XAnimDynamicIndicesToString(const XAnimDynamicIndices &aAnimDynamicIndices) {
QString debug;
debug.append("XAnimDynamicIndices(");
debug.append(QString("\n indices: %1").arg(aAnimDynamicIndices.indices[0]));
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimPartTransFrames &aAnimPartTransFramesIn)
{
for (int i = 0; i < 3; i++) {
aDataStream << aAnimPartTransFramesIn.mins[i];
}
for (int i = 0; i < 3; i++) {
aDataStream << aAnimPartTransFramesIn.size[i];
}
aDataStream
<< aAnimPartTransFramesIn.frames
<< aAnimPartTransFramesIn.indices;
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimPartTransFrames &aAnimPartTransFramesOut)
{
for (int i = 0; i < 3; i++) {
aDataStream >> aAnimPartTransFramesOut.mins[i];
}
for (int i = 0; i < 3; i++) {
aDataStream >> aAnimPartTransFramesOut.size[i];
}
aDataStream
>> aAnimPartTransFramesOut.frames
>> aAnimPartTransFramesOut.indices;
return aDataStream;
}
QString XAnimPartTransFramesToString(const XAnimPartTransFrames &aAnimPartTransFrames) {
QString debug;
debug.append("XAnimPartTransFrames(");
for (int i = 0; i < 3; i++) {
debug.append(QString("\n mins %1: %2").arg(i).arg(aAnimPartTransFrames.mins[i]));
}
for (int i = 0; i < 3; i++) {
debug.append(QString("\n size %1: %2").arg(i).arg(aAnimPartTransFrames.size[i]));
}
debug.append(QString("\n frames: %1").arg(XAnimDynamicFramesToString(aAnimPartTransFrames.frames)));
debug.append(QString("\n frames: %1").arg(XAnimDynamicIndicesToString(aAnimPartTransFrames.indices)));
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimPartTransData &aAnimPartTransDataIn)
{
aDataStream
<< aAnimPartTransDataIn.frames;
for (int i = 0; i < 3; i++) {
aDataStream << aAnimPartTransDataIn.frame0[i];
}
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimPartTransData &aAnimPartTransDataOut)
{
aDataStream
>> aAnimPartTransDataOut.frames;
for (int i = 0; i < 3; i++) {
aDataStream >> aAnimPartTransDataOut.frame0[i];
}
return aDataStream;
}
QString XAnimPartTransDataToString(const XAnimPartTransData &aAnimPartTransData) {
QString debug;
debug.append("XAnimPartTransData(");
debug.append(QString("\n frames: %1").arg(XAnimPartTransFramesToString(aAnimPartTransData.frames)));
for (int i = 0; i < 3; i++) {
debug.append(QString("\n smallTrans: %1").arg(aAnimPartTransData.frame0[i]));
}
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimPartTrans &aAnimPartTransIn)
{
aDataStream
<< aAnimPartTransIn.size
<< aAnimPartTransIn.smallTrans
<< aAnimPartTransIn.data;
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimPartTrans &aAnimPartTransOut)
{
aDataStream
>> aAnimPartTransOut.size
>> aAnimPartTransOut.smallTrans
>> aAnimPartTransOut.data;
return aDataStream;
}
QString XAnimPartTransToString(const XAnimPartTrans &aAnimPartTrans) {
QString debug;
debug.append("XAnimPartTrans(");
debug.append(QString("\n size: %1").arg(aAnimPartTrans.size));
debug.append(QString("\n smallTrans: %1").arg(aAnimPartTrans.smallTrans));
debug.append(QString("\n data: %1").arg(XAnimPartTransDataToString(aAnimPartTrans.data)));
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPartQuatDataFrames &aAnimDeltaPartQuatDataFramesIn)
{
aDataStream
<< aAnimDeltaPartQuatDataFramesIn.framesPtr
<< aAnimDeltaPartQuatDataFramesIn.indices;
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPartQuatDataFrames &aAnimDeltaPartQuatDataFramesOut)
{
aDataStream
>> aAnimDeltaPartQuatDataFramesOut.framesPtr
>> aAnimDeltaPartQuatDataFramesOut.indices;
return aDataStream;
}
QString XAnimDeltaPartQuatDataFramesToString(const XAnimDeltaPartQuatDataFrames &aAnimDeltaPartQuatDataFrames) {
QString debug;
debug.append("XAnimDeltaPartQuatDataFrames(");
debug.append(QString("\n framesPtr: %1").arg(aAnimDeltaPartQuatDataFrames.framesPtr));
for (int i = 0; i < 2; i++) {
debug.append(QString("\n frames %1: %2").arg(i).arg(aAnimDeltaPartQuatDataFrames.frames[i]));
}
debug.append(QString("\n indices: %1").arg(XAnimDynamicIndicesToString(aAnimDeltaPartQuatDataFrames.indices)));
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPartQuatData &aAnimDeltaPartQuatDataIn)
{
aDataStream
<< aAnimDeltaPartQuatDataIn.frames;
for (int i = 0; i < 2; i++) {
aDataStream << aAnimDeltaPartQuatDataIn.frame0[i];
}
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPartQuatData &aAnimDeltaPartQuatDataOut)
{
aDataStream
>> aAnimDeltaPartQuatDataOut.frames;
for (int i = 0; i < 2; i++) {
aDataStream >> aAnimDeltaPartQuatDataOut.frame0[i];
}
return aDataStream;
}
QString XAnimDeltaPartQuatDataToString(const XAnimDeltaPartQuatData &aAnimDeltaPartQuatData) {
QString debug;
debug.append("XAnimDeltaPartQuatData(");
debug.append(QString("\n frames: %1").arg(XAnimDeltaPartQuatDataFramesToString(aAnimDeltaPartQuatData.frames)));
for (int i = 0; i < 2; i++) {
debug.append(QString("\n frame0 %1: %2").arg(i).arg(aAnimDeltaPartQuatData.frame0[i]));
}
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPartQuat &aAnimDeltaPartQuatIn)
{
aDataStream
<< aAnimDeltaPartQuatIn.size
<< aAnimDeltaPartQuatIn.data;
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPartQuat &aAnimDeltaPartQuatOut)
{
aDataStream
>> aAnimDeltaPartQuatOut.size
>> aAnimDeltaPartQuatOut.data;
return aDataStream;
}
QString XAnimDeltaPartQuatToString(const XAnimDeltaPartQuat &aAnimDeltaPartQuat) {
QString debug;
debug.append("XAnimDeltaPartQuat(");
debug.append(QString("\n size: %1").arg(aAnimDeltaPartQuat.size));
debug.append(QString("\n data: %1").arg(XAnimDeltaPartQuatDataToString(aAnimDeltaPartQuat.data)));
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPart &aAnimDeltaPartIn)
{
aDataStream
<< aAnimDeltaPartIn.transPtr
<< aAnimDeltaPartIn.quatPtr;
return aDataStream;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPart &aAnimDeltaPartOut)
{
aDataStream
>> aAnimDeltaPartOut.transPtr
>> aAnimDeltaPartOut.quatPtr;
return aDataStream;
}
QString XAnimDeltaPartToString(const XAnimDeltaPart &aAnimDeltaPart) {
QString debug;
debug.append("XAnimDeltaPart(");
debug.append(QString("\n transPtr: %1").arg(aAnimDeltaPart.transPtr));
debug.append(QString("\n trans: %1").arg(XAnimPartTransToString(aAnimDeltaPart.trans)));
debug.append(QString("\n quatPtr: %1").arg(aAnimDeltaPart.quatPtr));
debug.append(QString("\n quat: %1").arg(XAnimDeltaPartQuatToString(aAnimDeltaPart.quat)));
debug.append("\n)");
return debug;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimNotifyInfo &aAnimNotifyInfoIn)
{
aDataStream
<< aAnimNotifyInfoIn.name
<< aAnimNotifyInfoIn.time;
return aDataStream;
}
QDebug operator<<(QDebug debug, const XAnimNotifyInfo &aAnimNotifyInfo) {
QDebugStateSaver saver(debug);
debug.noquote().nospace();
debug << "XAnimNotifyInfo(";
debug << "\n name: " << aAnimNotifyInfo.name;
debug << "\n time: " << aAnimNotifyInfo.time;
debug << "\n)";
return debug;
}
QString XAnimNotifyInfoToString(const XAnimNotifyInfo &aAnimNotifyInfo) {
QString debug;
debug.append("XAnimNotifyInfo(");
debug.append(QString("\n name: %1").arg(aAnimNotifyInfo.name));
debug.append(QString("\n time: %1").arg(aAnimNotifyInfo.time));
debug.append("\n)");
return debug;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimNotifyInfo &aAnimNotifyInfoOut)
{
aDataStream
>> aAnimNotifyInfoOut.name
>> aAnimNotifyInfoOut.time;
return aDataStream;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimIndices &aAnimIndicesIn)
{
aDataStream
<< aAnimIndicesIn.indexPtr
<< aAnimIndicesIn.index;
return aDataStream;
}
QDebug operator<<(QDebug debug, const XAnimIndices &aAnimIndices) {
QDebugStateSaver saver(debug);
debug.noquote().nospace();
debug << "XAnimIndices(";
debug << "\n name: " << aAnimIndices.indexPtr;
debug << "\n namePtr: " << aAnimIndices.index;
debug << "\n)";
return debug;
}
QString XAnimIndicesToString(const XAnimIndices &aAnimIndices) {
QString debug;
debug.append("XAnimIndices(");
debug.append(QString("\n name: %1").arg(aAnimIndices.indexPtr));
debug.append(QString("\n namePtr: %1").arg(aAnimIndices.index));
debug.append("\n)");
return debug;
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimIndices &aAnimIndicesOut)
{
aDataStream
>> aAnimIndicesOut.indexPtr
>> aAnimIndicesOut.index;
return aDataStream;
}
QDataStream &operator<<(QDataStream &aDataStream, const XAnimParts &aAnimPartIn)
{
aDataStream
<< aAnimPartIn.name
<< aAnimPartIn.dataByteCount
<< aAnimPartIn.dataShortCount
<< aAnimPartIn.dataIntCount
<< aAnimPartIn.randomDataByteCount
<< aAnimPartIn.randomDataIntCount
<< aAnimPartIn.numframes
<< aAnimPartIn.bLoop
<< aAnimPartIn.bDelta;
for (int i = 0; i < 12; i++) {
aDataStream << aAnimPartIn.boneCount[i];
}
aDataStream
<< aAnimPartIn.notifyCount
<< aAnimPartIn.pad
<< aAnimPartIn.randomDataShortCount
<< aAnimPartIn.indexCount
<< aAnimPartIn.framerate
<< aAnimPartIn.frequency
<< aAnimPartIn.namesPtr
<< aAnimPartIn.dataBytePtr
<< aAnimPartIn.dataShortPtr
<< aAnimPartIn.dataIntPtr
<< aAnimPartIn.randomDataShortPtr
<< aAnimPartIn.randomDataBytePtr
<< aAnimPartIn.randomDataIntPtr
<< aAnimPartIn.indices
<< aAnimPartIn.notifyPtr
<< aAnimPartIn.deltaPartPtr;
return aDataStream;
}
quint32 ROL4(quint32 value, int positions) {
return (value << positions) | (value >> (32 - positions));
}
QDataStream &operator>>(QDataStream &aDataStream, XAnimParts &aAnimPartOut)
{
aDataStream
>> aAnimPartOut.namePtr
>> aAnimPartOut.dataByteCount
>> aAnimPartOut.dataShortCount
>> aAnimPartOut.dataIntCount
>> aAnimPartOut.randomDataByteCount
>> aAnimPartOut.randomDataIntCount
>> aAnimPartOut.numframes
>> aAnimPartOut.bLoop
>> aAnimPartOut.bDelta;
for (int i = 0; i < 12; i++) {
aDataStream >> aAnimPartOut.boneCount[i];
}
aDataStream
>> aAnimPartOut.notifyCount
>> aAnimPartOut.assetType
>> aAnimPartOut.pad;
aDataStream.skipRawData(3);
aDataStream
>> aAnimPartOut.randomDataShortCount
>> aAnimPartOut.indexCount;
quint32 framerateInt, frequencyInt;
aDataStream
>> framerateInt
>> frequencyInt
>> aAnimPartOut.namesPtr
>> aAnimPartOut.dataBytePtr
>> aAnimPartOut.dataShortPtr
>> aAnimPartOut.dataIntPtr
>> aAnimPartOut.randomDataShortPtr
>> aAnimPartOut.randomDataBytePtr
>> aAnimPartOut.randomDataIntPtr
>> aAnimPartOut.indices
>> aAnimPartOut.notifyPtr
>> aAnimPartOut.deltaPartPtr;
aAnimPartOut.framerate = *reinterpret_cast<float*>(&framerateInt);
aAnimPartOut.frequency = *reinterpret_cast<float*>(&frequencyInt);
if (aAnimPartOut.namePtr) {
aAnimPartOut.name = "";
char animNameChar;
aDataStream >> animNameChar;
while (animNameChar != '\0') {
aAnimPartOut.name += animNameChar;
aDataStream >> animNameChar;
}
}
if (aAnimPartOut.namesPtr) {
int nameCount = aAnimPartOut.boneCount[11];
aDataStream.skipRawData(2 * nameCount);
for (int i = 0; i < nameCount; i++) {
aDataStream.skipRawData(2);
}
}
if (aAnimPartOut.notifyPtr) {
int notifyCount = aAnimPartOut.notifyCount;
aDataStream.skipRawData(8 * notifyCount);
for (int i = 0; i < notifyCount; i++) {
aDataStream.skipRawData(8);
aDataStream >> aAnimPartOut.notify;
}
}
if (aAnimPartOut.deltaPartPtr) {
aDataStream >> aAnimPartOut.deltaPart;
if (aAnimPartOut.deltaPart.transPtr) {
aDataStream >> aAnimPartOut.deltaPart.trans;
if (aAnimPartOut.deltaPart.trans.size) {
aDataStream >> aAnimPartOut.deltaPart.trans.data.frames;
quint32 size = aAnimPartOut.deltaPart.trans.size;
quint32 readSize;
if (aAnimPartOut.numframes >= 0x100) {
readSize = 2 * (size + 1);
} else {
readSize = size + 1;
}
aDataStream >> aAnimPartOut.deltaPart.trans.data.frames.indices;
if (aAnimPartOut.deltaPart.trans.smallTrans) {
if (aAnimPartOut.deltaPart.trans.data.frames.frames.framesPtr) {
aDataStream.skipRawData(3 * (aAnimPartOut.deltaPart.trans.size + 1));
}
} else if (aAnimPartOut.deltaPart.trans.data.frames.frames.framesPtr) {
aDataStream.skipRawData(6 * (aAnimPartOut.deltaPart.trans.size + 1));
}
}
}
if (aAnimPartOut.deltaPart.quatPtr) {
aDataStream >> aAnimPartOut.deltaPart.quat;
if (aAnimPartOut.deltaPart.quat.size) {
aDataStream >> aAnimPartOut.deltaPart.quat.data.frames;
aDataStream >> aAnimPartOut.deltaPart.quat.data.frames.indices;
if (aAnimPartOut.deltaPart.quat.data.frames.framesPtr) {
aDataStream.skipRawData(4 * (aAnimPartOut.deltaPart.quat.size + 1));
}
} else {
aDataStream >> aAnimPartOut.deltaPart.quat.data;
}
}
}
if (aAnimPartOut.dataBytePtr) {
aDataStream.skipRawData(aAnimPartOut.dataByteCount);
}
if (aAnimPartOut.dataShortPtr) {
aDataStream.skipRawData(ROL4(aAnimPartOut.dataShortCount, 1));
}
if (aAnimPartOut.dataIntPtr) {
aDataStream.skipRawData(ROL4(aAnimPartOut.dataIntCount, 2));
}
if (aAnimPartOut.randomDataShortPtr) {
aDataStream.skipRawData(2 * aAnimPartOut.randomDataShortCount);
}
if (aAnimPartOut.randomDataBytePtr) {
aDataStream.skipRawData(2 * aAnimPartOut.randomDataByteCount);
}
if (aAnimPartOut.randomDataIntPtr) {
aDataStream.skipRawData(ROL4(aAnimPartOut.randomDataIntCount, 2));
}
qDebug() << aDataStream.device()->pos();
return aDataStream;
}
QString XAnimPartsToString(const XAnimParts &xAnimParts) {
QString debug = "";
debug.append(QString("XAnimParts("));
debug.append(QString("\n name: %1").arg(xAnimParts.name));
debug.append(QString("\n namePtr: %1").arg(QString::number(xAnimParts.namePtr, 16)));
debug.append(QString("\n dataByteCount: %1").arg(xAnimParts.dataByteCount));
debug.append(QString("\n dataShortCount: %1").arg(xAnimParts.dataShortCount));
debug.append(QString("\n dataIntCount: %1").arg(xAnimParts.dataIntCount));
debug.append(QString("\n randomDataByteCount: %1").arg(xAnimParts.randomDataByteCount));
debug.append(QString("\n randomDataIntCount: %1").arg(xAnimParts.randomDataIntCount));
debug.append(QString("\n numframes: %1").arg(xAnimParts.numframes));
debug.append(QString("\n bLoop: %1").arg(xAnimParts.bLoop));
debug.append(QString("\n bDelta: %1").arg(xAnimParts.bDelta));
for (int i = 0; i < 12; i++) {
debug.append(QString("\n boneCount %1: %2").arg(i).arg(xAnimParts.boneCount[i]));
}
debug.append(QString("\n notifyCount: %1").arg(xAnimParts.notifyCount));
debug.append(QString("\n assetType: %1").arg(xAnimParts.assetType));
debug.append(QString("\n pad: %1").arg(xAnimParts.pad));
debug.append(QString("\n randomDataShortCount: %1").arg(xAnimParts.randomDataShortCount));
debug.append(QString("\n indexCount: %1").arg(xAnimParts.indexCount));
debug.append(QString("\n framerate: %1").arg(xAnimParts.framerate));
debug.append(QString("\n frequency: %1").arg(xAnimParts.frequency));
debug.append(QString("\n namesPtr: %1").arg(QString::number(xAnimParts.namesPtr, 16)));
debug.append(QString("\n names: %1").arg(xAnimParts.names));
debug.append(QString("\n dataBytePtr: %1").arg(QString::number(xAnimParts.dataBytePtr, 16)));
debug.append(QString("\n dataByte: %1").arg(xAnimParts.dataByte));
debug.append(QString("\n dataShortPtr: %1").arg(QString::number(xAnimParts.dataShortPtr, 16)));
debug.append(QString("\n dataShort: %1").arg(xAnimParts.dataShort));
debug.append(QString("\n dataIntPtr: %1").arg(QString::number(xAnimParts.dataIntPtr, 16)));
debug.append(QString("\n dataInt: %1").arg(xAnimParts.dataInt));
debug.append(QString("\n randomDataShortPtr: %1").arg(QString::number(xAnimParts.randomDataShortPtr, 16)));
debug.append(QString("\n randomDataShort: %1").arg(xAnimParts.randomDataShort));
debug.append(QString("\n randomDataBytePtr: %1").arg(QString::number(xAnimParts.randomDataBytePtr, 16)));
debug.append(QString("\n randomDataByte: %1").arg(xAnimParts.randomDataByte));
debug.append(QString("\n randomDataIntPtr: %1").arg(QString::number(xAnimParts.randomDataIntPtr, 16)));
debug.append(QString("\n randomDataInt: %1").arg(xAnimParts.randomDataInt));
debug.append(QString("\n indices: %1").arg(XAnimIndicesToString(xAnimParts.indices)));
debug.append(QString("\n notifyPtr: %1").arg(QString::number(xAnimParts.notifyPtr, 16)));
debug.append(QString("\n notify: %1").arg(XAnimNotifyInfoToString(xAnimParts.notify)));
debug.append(QString("\n deltaPartPtr: %1").arg(QString::number(xAnimParts.deltaPartPtr, 16)));
debug.append(QString("\n deltaPart: %1").arg(XAnimDeltaPartToString(xAnimParts.deltaPart)));
debug.append(QString("\n)"));
return debug;
}
QDebug operator<<(QDebug debug, const XAnimParts &xanimParts) {
QDebugStateSaver saver(debug);
debug.noquote().nospace();
debug << XAnimPartsToString(xanimParts);
return debug;
}

View File

@ -3,18 +3,22 @@
#include <QString> #include <QString>
#include <QDataStream> #include <QDataStream>
#include <QDebug>
union XAnimDynamicFrames struct XAnimDynamicFrames
{ {
quint8 (*_1)[3]; quint32 framesPtr;
quint16 (*_2)[3]; quint8 frames[3];
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDynamicFrames &aAnimDynamicFramesIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimDynamicFrames &aAnimDynamicFramesOut);
union XAnimDynamicIndices struct XAnimDynamicIndices
{ {
quint8 _1[1]; quint8 indices[1];
quint16 _2[1];
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDynamicIndices &aAnimDynamicIndicesIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimDynamicIndices &aAnimDynamicIndicesOut);
struct XAnimPartTransFrames struct XAnimPartTransFrames
{ {
@ -23,61 +27,87 @@ struct XAnimPartTransFrames
XAnimDynamicFrames frames; XAnimDynamicFrames frames;
XAnimDynamicIndices indices; XAnimDynamicIndices indices;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimPartTransFrames &aAnimPartTransFramesIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimPartTransFrames &aAnimPartTransFramesOut);
union XAnimPartTransData union XAnimPartTransData
{ {
XAnimPartTransFrames frames; XAnimPartTransFrames frames;
float frame0[3]; float frame0[3];
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimPartTransData &aAnimPartTransDataIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimPartTransData &aAnimPartTransDataOut);
struct XAnimPartTrans struct XAnimPartTrans
{ {
quint16 size; quint16 size;
quint8 smallTrans; quint8 smallTrans;
XAnimPartTransData u; XAnimPartTransData data;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimPartTrans &aAnimPartTransIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimPartTrans &aAnimPartTransOut);
struct XAnimDeltaPartQuatDataFrames struct XAnimDeltaPartQuatDataFrames
{ {
qint16 (*frames)[2]; quint32 framesPtr;
qint16 frames[2];
XAnimDynamicIndices indices; XAnimDynamicIndices indices;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPartQuatDataFrames &aAnimDeltaPartQuatDataFramesIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPartQuatDataFrames &aAnimDeltaPartQuatDataFramesOut);
union XAnimDeltaPartQuatData struct XAnimDeltaPartQuatData
{ {
XAnimDeltaPartQuatDataFrames frames; XAnimDeltaPartQuatDataFrames frames;
qint16 frame0[2]; qint16 frame0[2];
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPartQuatData &aAnimDeltaPartQuatDataIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPartQuatData &aAnimDeltaPartQuatDataOut);
struct XAnimDeltaPartQuat struct XAnimDeltaPartQuat
{ {
quint16 size; quint16 size;
XAnimDeltaPartQuatData u; XAnimDeltaPartQuatData data;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPartQuat &aAnimDeltaPartQuatIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPartQuat &aAnimDeltaPartQuatOut);
struct XAnimDeltaPart struct XAnimDeltaPart
{ {
XAnimPartTrans *trans; quint32 transPtr;
XAnimDeltaPartQuat *quat; XAnimPartTrans trans;
quint32 quatPtr;
XAnimDeltaPartQuat quat;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimDeltaPart &aAnimDeltaPartIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimDeltaPart &aAnimDeltaPartOut);
struct XAnimNotifyInfo struct XAnimNotifyInfo
{ {
quint16 name; quint16 name;
float time; float time;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimNotifyInfo &aAnimNotifyInfoIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimNotifyInfo &aAnimNotifyInfoOut);
QDebug operator<<(QDebug debug, const XAnimNotifyInfo &aAnimNotifyInfo);
QString XAnimNotifyInfoToString(const XAnimNotifyInfo &aAnimNotifyInfo);
struct XAnimIndices struct XAnimIndices
{ {
quint8 *_1; quint32 indexPtr;
quint16 *_2; quint16 index;
void *data;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimIndices &aAnimIndicesIn);
QDataStream &operator>>(QDataStream &aDataStream, XAnimIndices &aAnimIndicesOut);
QDebug operator<<(QDebug debug, const XAnimIndices &aAnimIndices);
QString XAnimIndicesToString(const XAnimIndices &aAnimIndices);
struct XAnimParts struct XAnimParts
{ {
qint32 namePtr;
QString name; QString name;
quint32 namePtr;
quint16 dataByteCount; quint16 dataByteCount;
quint16 dataShortCount; quint16 dataShortCount;
@ -95,19 +125,32 @@ struct XAnimParts
bool pad; bool pad;
unsigned int randomDataShortCount; quint16 randomDataShortCount;
unsigned int indexCount; quint16 indexCount;
float framerate; float framerate;
float frequency; float frequency;
quint16 *names; quint32 namesPtr;
quint8 *dataByte; quint16 names;
qint16 *dataShort;
int *dataInt; quint32 dataBytePtr;
qint16 *randomDataShort; quint8 dataByte;
quint8 *randomDataByte;
int *randomDataInt; quint32 dataShortPtr;
qint16 dataShort;
quint32 dataIntPtr;
int dataInt;
quint32 randomDataShortPtr;
qint16 randomDataShort;
quint32 randomDataBytePtr;
quint8 randomDataByte;
quint32 randomDataIntPtr;
int randomDataInt;
XAnimIndices indices; XAnimIndices indices;
@ -117,74 +160,14 @@ struct XAnimParts
qint32 deltaPartPtr; qint32 deltaPartPtr;
XAnimDeltaPart deltaPart; XAnimDeltaPart deltaPart;
}; };
QDataStream &operator<<(QDataStream &aDataStream, const XAnimParts &aAnimPartIn);
QDataStream& operator<<(QDataStream& out, const XAnimParts& in) { QDataStream &operator>>(QDataStream &aDataStream, XAnimParts &aAnimPartOut);
out.writeRawData(reinterpret_cast<const char*>(&in.namePtr), 4); QDebug operator<<(QDebug debug, const XAnimParts &xanimParts);
out.writeRawData(reinterpret_cast<const char*>(&in.dataByteCount), 2); QString XAnimPartsToString(const XAnimParts &xAnimParts);
out.writeRawData(reinterpret_cast<const char*>(&in.dataShortCount), 2);
out.writeRawData(reinterpret_cast<const char*>(&in.dataIntCount), 2);
out.writeRawData(reinterpret_cast<const char*>(&in.randomDataByteCount), 2);
out.writeRawData(reinterpret_cast<const char*>(&in.randomDataIntCount), 2);
out.writeRawData(reinterpret_cast<const char*>(&in.numframes), 2);
out.writeRawData(reinterpret_cast<const char*>(&in.bLoop), 1);
out.writeRawData(reinterpret_cast<const char*>(&in.bDelta), 1);
for (int i = 0; i < 12; i++) {
out.writeRawData(reinterpret_cast<const char*>(&in.boneCount[i]), 1);
}
out.writeRawData(reinterpret_cast<const char*>(&in.notifyCount), 1);
out.writeRawData(reinterpret_cast<const char*>(&in.assetType), 1);
out.writeRawData(reinterpret_cast<const char*>(&in.pad), 1);
out.writeRawData(reinterpret_cast<const char*>(&in.randomDataShortCount), 2);
out.writeRawData(reinterpret_cast<const char*>(&in.indexCount), 2);
out.writeRawData(reinterpret_cast<const char*>(&in.framerate), 4);
out.writeRawData(reinterpret_cast<const char*>(&in.frequency), 4);
return out;
}
QDataStream& operator>>(QDataStream& in, XAnimParts& out) {
in.readRawData(reinterpret_cast<char*>(&out.namePtr), 4);
in.readRawData(reinterpret_cast<char*>(&out.dataByteCount), 2);
in.readRawData(reinterpret_cast<char*>(&out.dataShortCount), 2);
in.readRawData(reinterpret_cast<char*>(&out.dataIntCount), 2);
in.readRawData(reinterpret_cast<char*>(&out.randomDataByteCount), 2);
in.readRawData(reinterpret_cast<char*>(&out.randomDataIntCount), 2);
in.readRawData(reinterpret_cast<char*>(&out.numframes), 2);
in.readRawData(reinterpret_cast<char*>(&out.bLoop), 1);
in.readRawData(reinterpret_cast<char*>(&out.bDelta), 1);
for (int i = 0; i < 12; i++) {
in.readRawData(reinterpret_cast<char*>(&out.boneCount[i]), 1);
}
in.readRawData(reinterpret_cast<char*>(&out.notifyCount), 1);
in.readRawData(reinterpret_cast<char*>(&out.assetType), 1);
in.readRawData(reinterpret_cast<char*>(&out.pad), 1);
in.readRawData(reinterpret_cast<char*>(&out.randomDataShortCount), 2);
in.readRawData(reinterpret_cast<char*>(&out.indexCount), 2);
in.readRawData(reinterpret_cast<char*>(&out.framerate), 4);
in.readRawData(reinterpret_cast<char*>(&out.frequency), 4);
return in;
}
struct Animation { struct Animation {
QString name; QString name;
std::shared_ptr<XAnimParts> parts; XAnimParts animParts;
}; };
QDataStream& operator<<(QDataStream& out, const Animation& in) {
out << *in.parts;
return out;
}
QDataStream& operator>>(QDataStream& in, Animation& out) {
in >> *out.parts;
return in;
}
#endif // ANIMPARTS_H #endif // ANIMPARTS_H

1
libs/assets/asset.cpp Normal file
View File

@ -0,0 +1 @@
#include "asset.h"

View File

@ -0,0 +1 @@
#include "assetlist.h"

View File

@ -2,13 +2,7 @@
#define ASSETLIST_H #define ASSETLIST_H
#include "asset.h" #include "asset.h"
#include "scriptstringlist.h"
struct ScriptStringList
{
int count;
QVector<qint32> stringPtrs;
QStringList scriptStrings;
};
struct XAssetList struct XAssetList
{ {

60
libs/assets/assetmap.h Normal file
View File

@ -0,0 +1,60 @@
#ifndef ASSETMAP_H
#define ASSETMAP_H
#include "animparts.h"
#include "model.h"
#include "material.h"
#include "materialpixelshader.h"
#include "materialtechset.h"
#include "gfximage.h"
#include "soundalias.h"
#include "soundcurve.h"
#include "loadedsound.h"
#include "clipmap.h"
#include "comworld.h"
#include "gameworld.h"
#include "mapent.h"
#include "gfxworld.h"
#include "gfxlightdef.h"
#include "gfximage.h"
#include "font.h"
#include "menulist.h"
#include "menudef.h"
#include "localizeentry.h"
#include "weapondef.h"
#include "sounddriver.h"
#include "effectdef.h"
#include "effecttable.h"
#include "rawfile.h"
#include "stringtable.h"
struct AssetMap {
QVector<Animation> animations;
QVector<Model> models;
QVector<Material> materials;
QVector<MaterialPixelShader> pixelShaders;
QVector<MaterialTechSet> techSets;
QVector<GfxWorld> gfxWorlds;
QVector<GfxLightDef> gfxLightDefs;
QVector<GfxImage> images;
QVector<SoundAliasList> sounds;
QVector<SoundCurve> soundCurves;
QVector<LoadedSound> loadedSounds;
QVector<ClipMap> clipMaps;
QVector<ComWorld> comWorlds;
QVector<GameWorldSp> gameWorldSPs;
QVector<GameWorldMp> gameWorldMPs;
QVector<MapEnts> mapEntities;
QVector<GameFont> fonts;
QVector<MenuList> menuLists;
QVector<MenuDef> menuDefinitions;
QVector<LocalizeEntry> localizeEntries;
QVector<WeaponDef> weaponDefinitions;
QVector<SoundDriver> soundDrivers;
QVector<EffectDef> effectDefinitions;
QVector<ImpactTable> impactTables;
QVector<RawFile> rawFiles;
QVector<StringTable> stringTables;
};
#endif // ASSETMAP_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,36 @@ CONFIG += staticlib c++17
SOURCES += \ SOURCES += \
# Base class # Base class
assets.cpp \ assets.cpp \
animparts.cpp \
asset.cpp \
assetlist.cpp \
clipmap.cpp \
comworld.cpp \
d3dresource.cpp \
effectdef.cpp \
effecttable.cpp \
file.cpp \
font.cpp \
gameworld.cpp \
gfximage.cpp \
gfxlightdef.cpp \
gfxworld.cpp \
loadedsound.cpp \
localizeentry.cpp \
mapent.cpp \
material.cpp \
materialpixelshader.cpp \
materialtechset.cpp \
menudef.cpp \
menulist.cpp \
model.cpp \
rawfile.cpp \
scriptstringlist.cpp \
soundalias.cpp \
soundcurve.cpp \
sounddriver.cpp \
stringtable.cpp \
weapondef.cpp \
# 360 classes # 360 classes
360/assets_cod2_360.cpp \ 360/assets_cod2_360.cpp \
360/assets_cod4_360.cpp \ 360/assets_cod4_360.cpp \
@ -49,6 +79,7 @@ HEADERS += \
animparts.h \ animparts.h \
asset.h \ asset.h \
assetlist.h \ assetlist.h \
assetmap.h \
assets.h \ assets.h \
# 360 classes # 360 classes
360/assets_cod2_360.h \ 360/assets_cod2_360.h \
@ -109,6 +140,7 @@ HEADERS += \
menulist.h \ menulist.h \
model.h \ model.h \
rawfile.h \ rawfile.h \
scriptstringlist.h \
soundalias.h \ soundalias.h \
soundcurve.h \ soundcurve.h \
sounddriver.h \ sounddriver.h \
@ -119,11 +151,9 @@ LIBS += \
-L$$OUT_PWD/../libs/core -lcore -L$$OUT_PWD/../libs/core -lcore
INCLUDEPATH += \ INCLUDEPATH += \
$$PWD/../core \ $$PWD/../core
$$PWD/../../third_party/dx9_sdk/include
DEPENDPATH += \ DEPENDPATH += \
$$PWD/../core \ $$PWD/../core
$$PWD/../../third_party/dx9_sdk/include
DESTDIR = $$OUT_PWD/../ DESTDIR = $$OUT_PWD/../

1
libs/assets/clipmap.cpp Normal file
View File

@ -0,0 +1 @@
#include "clipmap.h"

View File

@ -29,11 +29,11 @@ struct dmaterial_t
struct cNode_t struct cNode_t
{ {
cplane_s *plane; CPlane *plane;
__int16 children[2]; __int16 children[2];
}; };
struct cLeaf_t struct CLeaf
{ {
unsigned __int16 firstCollAabbIndex; unsigned __int16 firstCollAabbIndex;
unsigned __int16 collAabbCount; unsigned __int16 collAabbCount;
@ -45,30 +45,30 @@ struct cLeaf_t
__int16 cluster; __int16 cluster;
}; };
struct cLeafBrushNodeLeaf_t struct CLeafBrushNodeLeaf
{ {
unsigned __int16 *brushes; unsigned __int16 *brushes;
}; };
struct cLeafBrushNodeChildren_t struct CLeafBrushNodeChildren
{ {
float dist; float dist;
float range; float range;
unsigned __int16 childOffset[2]; unsigned __int16 childOffset[2];
}; };
union cLeafBrushNodeData_t union CLeafBrushNodeData
{ {
cLeafBrushNodeLeaf_t leaf; CLeafBrushNodeLeaf leaf;
cLeafBrushNodeChildren_t children; CLeafBrushNodeChildren children;
}; };
struct cLeafBrushNode_s struct CLeafBrushNode
{ {
unsigned __int8 axis; unsigned __int8 axis;
__int16 leafBrushCount; __int16 leafBrushCount;
int contents; int contents;
cLeafBrushNodeData_t data; CLeafBrushNodeData data;
}; };
struct CollisionBorder struct CollisionBorder
@ -103,21 +103,21 @@ struct CollisionAabbTree
CollisionAabbTreeIndex u; CollisionAabbTreeIndex u;
}; };
struct cmodel_t struct CModel
{ {
float mins[3]; float mins[3];
float maxs[3]; float maxs[3];
float radius; float radius;
cLeaf_t leaf; CLeaf leaf;
}; };
struct __declspec(align(16)) cbrush_t struct __declspec(align(16)) CBrush
{ {
float mins[3]; float mins[3];
int contents; int contents;
float maxs[3]; float maxs[3];
unsigned int numsides; unsigned int numsides;
cbrushside_t *sides; CBrushSide *sides;
__int16 axialMaterialNum[2][3]; __int16 axialMaterialNum[2][3];
unsigned __int8 *baseAdjacentSide; unsigned __int8 *baseAdjacentSide;
__int16 firstAdjacentSideOffsets[2][3]; __int16 firstAdjacentSideOffsets[2][3];
@ -181,21 +181,21 @@ struct ClipMap
const char *name; const char *name;
int isInUse; int isInUse;
int planeCount; int planeCount;
cplane_s *planes; CPlane *planes;
unsigned int numStaticModels; unsigned int numStaticModels;
cStaticModel_s *staticModelList; cStaticModel_s *staticModelList;
unsigned int numMaterials; unsigned int numMaterials;
dmaterial_t *materials; dmaterial_t *materials;
unsigned int numBrushSides; unsigned int numBrushSides;
cbrushside_t *brushsides; CBrushSide *brushsides;
unsigned int numBrushEdges; unsigned int numBrushEdges;
unsigned __int8 *brushEdges; unsigned __int8 *brushEdges;
unsigned int numNodes; unsigned int numNodes;
cNode_t *nodes; cNode_t *nodes;
unsigned int numLeafs; unsigned int numLeafs;
cLeaf_t *leafs; CLeaf *leafs;
unsigned int leafbrushNodesCount; unsigned int leafbrushNodesCount;
cLeafBrushNode_s *leafbrushNodes; CLeafBrushNode *leafbrushNodes;
unsigned int numLeafBrushes; unsigned int numLeafBrushes;
unsigned __int16 *leafbrushes; unsigned __int16 *leafbrushes;
unsigned int numLeafSurfaces; unsigned int numLeafSurfaces;
@ -212,16 +212,16 @@ struct ClipMap
int aabbTreeCount; int aabbTreeCount;
CollisionAabbTree *aabbTrees; CollisionAabbTree *aabbTrees;
unsigned int numSubModels; unsigned int numSubModels;
cmodel_t *cmodels; CModel *cmodels;
unsigned __int16 numBrushes; unsigned __int16 numBrushes;
cbrush_t *brushes; CBrush *brushes;
int numClusters; int numClusters;
int clusterBytes; int clusterBytes;
unsigned __int8 *visibility; unsigned __int8 *visibility;
int vised; int vised;
MapEnts *mapEnts; MapEnts *mapEnts;
cbrush_t *box_brush; CBrush *box_brush;
cmodel_t box_model; CModel box_model;
unsigned __int16 dynEntCount[2]; unsigned __int16 dynEntCount[2];
DynEntityDef *dynEntDefList[2]; DynEntityDef *dynEntDefList[2];
DynEntityPose *dynEntPoseList[2]; DynEntityPose *dynEntPoseList[2];

1
libs/assets/comworld.cpp Normal file
View File

@ -0,0 +1 @@
#include "comworld.h"

View File

@ -0,0 +1 @@
#include "d3dresource.h"

View File

@ -0,0 +1 @@
#include "effectdef.h"

View File

@ -79,29 +79,45 @@ struct FxElemVisStateSample
struct FxElemMarkVisuals struct FxElemMarkVisuals
{ {
Material *materials[2]; qint32 materialPtrs[2];
QVector<Material> materials;
}; };
struct EffectDef; struct EffectDef;
union EffectDefRef union EffectDefRef
{ {
qint32 handlePtr;
const EffectDef *handle; const EffectDef *handle;
qint32 namePtr;
const char *name; const char *name;
}; };
union FxElemVisuals union FxElemVisuals
{ {
qint32 anonymousPtr;
const void *anonymous; const void *anonymous;
qint32 materialPtr;
Material *material; Material *material;
qint32 modelPtr;
Model *model; Model *model;
EffectDefRef effectDef; EffectDefRef effectDef;
qint32 soundNamePtr;
const char *soundName; const char *soundName;
}; };
union FxElemDefVisuals struct FxElemDefVisuals
{ {
FxElemMarkVisuals *markArray; qint32 markArrayPtr;
FxElemVisuals *array; QVector<FxElemMarkVisuals> markArray;
qint32 arrayPtr;
QVector<FxElemVisuals> array;
FxElemVisuals instance; FxElemVisuals instance;
}; };
@ -146,8 +162,10 @@ struct FxElemDef
unsigned __int8 visualCount; unsigned __int8 visualCount;
unsigned __int8 velIntervalCount; unsigned __int8 velIntervalCount;
unsigned __int8 visStateIntervalCount; unsigned __int8 visStateIntervalCount;
const FxElemVelStateSample *velSamples; qint32 velSamplesPtr;
const FxElemVisStateSample *visSamples; QVector<FxElemVelStateSample> velSamples;
qint32 visSamplesPtr;
QVector<FxElemVisStateSample> visSamples;
FxElemDefVisuals visuals; FxElemDefVisuals visuals;
float collMins[3]; float collMins[3];
float collMaxs[3]; float collMaxs[3];
@ -156,7 +174,10 @@ struct FxElemDef
EffectDefRef effectEmitted; EffectDefRef effectEmitted;
FxFloatRange emitDist; FxFloatRange emitDist;
FxFloatRange emitDistVariance; FxFloatRange emitDistVariance;
qint32 trailDefPtr;
FxTrailDef *trailDef; FxTrailDef *trailDef;
unsigned __int8 sortOrder; unsigned __int8 sortOrder;
unsigned __int8 lightingFrac; unsigned __int8 lightingFrac;
unsigned __int8 useItemClip; unsigned __int8 useItemClip;
@ -165,14 +186,18 @@ struct FxElemDef
struct EffectDef struct EffectDef
{ {
const char *name; qint32 namePtr;
QString name;
int flags; int flags;
int totalSize; int totalSize;
int msecLoopingLife; int msecLoopingLife;
int elemDefCountLooping; int elemDefCountLooping;
int elemDefCountOneShot; int elemDefCountOneShot;
int elemDefCountEmission; int elemDefCountEmission;
const FxElemDef *elemDefs;
qint32 elemDefsPtr;
QVector<FxElemDef> elemDefs;
}; };
#endif // EFFECTDEF_H #endif // EFFECTDEF_H

View File

@ -0,0 +1 @@
#include "effecttable.h"

View File

@ -5,14 +5,20 @@
struct FxImpactEntry struct FxImpactEntry
{ {
const EffectDef *nonflesh[29]; QVector<qint32> nonFleshPtrs;
const EffectDef *flesh[4]; QVector<EffectDef> nonFlesh;
QVector<qint32> fleshPtrs;
QVector<EffectDef> flesh;
}; };
struct ImpactTable struct ImpactTable
{ {
const char *name; qint32 namePtr;
FxImpactEntry *table; QString name;
qint32 tablePtr;
QVector<FxImpactEntry> table;
}; };
#endif // EFFECTTABLE_H #endif // EFFECTTABLE_H

1
libs/assets/file.cpp Normal file
View File

@ -0,0 +1 @@
#include "file.h"

1
libs/assets/font.cpp Normal file
View File

@ -0,0 +1 @@
#include "font.h"

View File

@ -0,0 +1 @@
#include "gameworld.h"

View File

@ -27,7 +27,7 @@ enum nodeType : __int32
NODE_DONTLINK = 0x14, NODE_DONTLINK = 0x14,
}; };
struct pathlink_s struct PathLink
{ {
float fDist; float fDist;
unsigned __int16 nodeNum; unsigned __int16 nodeNum;
@ -36,7 +36,7 @@ struct pathlink_s
unsigned __int8 ubBadPlaceCount[4]; unsigned __int8 ubBadPlaceCount[4];
}; };
struct pathnode_constant_t struct PathNodeConstant
{ {
nodeType type; nodeType type;
unsigned __int16 spawnflags; unsigned __int16 spawnflags;
@ -56,7 +56,7 @@ struct pathnode_constant_t
__int16 wChainDepth; __int16 wChainDepth;
__int16 wChainParent; __int16 wChainParent;
unsigned __int16 totalLinkCount; unsigned __int16 totalLinkCount;
pathlink_s *Links; PathLink *Links;
}; };
struct pathnode_dynamic_t struct pathnode_dynamic_t
@ -85,49 +85,49 @@ struct pathnode_transient_t
struct pathnode_t struct pathnode_t
{ {
pathnode_constant_t constant; PathNodeConstant constant;
pathnode_dynamic_t dynamic; pathnode_dynamic_t dynamic;
pathnode_transient_t transient; pathnode_transient_t transient;
}; };
struct pathbasenode_t struct PathBaseNode
{ {
float vOrigin[3]; float vOrigin[3];
unsigned int type; unsigned int type;
}; };
struct pathnode_tree_nodes_t struct PathNodeTreeNodes
{ {
int nodeCount; int nodeCount;
unsigned __int16 *nodes; unsigned __int16 *nodes;
}; };
struct pathnode_tree_t; struct PathNodeTree;
union pathnode_tree_info_t union PathNodeTreeInfo
{ {
pathnode_tree_t *child[2]; PathNodeTree *child[2];
pathnode_tree_nodes_t s; PathNodeTreeNodes s;
}; };
struct pathnode_tree_t struct PathNodeTree
{ {
int axis; int axis;
float dist; float dist;
pathnode_tree_info_t u; PathNodeTreeInfo u;
}; };
struct PathData struct PathData
{ {
unsigned int nodeCount; unsigned int nodeCount;
pathnode_t *nodes; pathnode_t *nodes;
pathbasenode_t *basenodes; PathBaseNode *basenodes;
unsigned int chainNodeCount; unsigned int chainNodeCount;
unsigned __int16 *chainNodeForNode; unsigned __int16 *chainNodeForNode;
unsigned __int16 *nodeForChainNode; unsigned __int16 *nodeForChainNode;
int visBytes; int visBytes;
unsigned __int8 *pathVis; unsigned __int8 *pathVis;
int nodeTreeCount; int nodeTreeCount;
pathnode_tree_t *nodeTree; PathNodeTree *nodeTree;
}; };
struct GameWorldSp struct GameWorldSp

1
libs/assets/gfximage.cpp Normal file
View File

@ -0,0 +1 @@
#include "gfximage.h"

View File

@ -4,20 +4,29 @@
#include "material.h" #include "material.h"
struct GfxImageLoadDef; struct GfxImageLoadDef;
union GfxTexture struct GfxTexture
{ {
D3DBaseTexture *basemap; qint32 baseMapPtr;
D3DBaseTexture *baseMap;
qint32 mapPtr;
D3DTexture *map; D3DTexture *map;
D3DVolumeTexture *volmap;
D3DCubeTexture *cubemap; qint32 volMapPtr;
D3DVolumeTexture *volMap;
qint32 cubeMapPtr;
D3DCubeTexture *cubeMap;
qint32 loadDefPtr;
GfxImageLoadDef *loadDef; GfxImageLoadDef *loadDef;
}; };
struct GfxImageLoadDef struct GfxImageLoadDef
{ {
unsigned __int8 levelCount; quint8 levelCount;
unsigned __int8 flags; quint8 flags;
__int16 dimensions[3]; quint16 dimensions[3];
int format; int format;
GfxTexture texture; GfxTexture texture;
}; };
@ -31,18 +40,23 @@ struct GfxImage
{ {
MapType mapType; MapType mapType;
GfxTexture texture; GfxTexture texture;
unsigned __int8 semantic; quint8 semantic;
CardMemory cardMemory; CardMemory cardMemory;
unsigned __int16 width; quint16 width;
unsigned __int16 height; quint16 height;
unsigned __int16 depth; quint16 depth;
unsigned __int8 category; quint8 category;
bool delayLoadPixels; bool delayLoadPixels;
unsigned __int8 *pixels;
qint32 pixelsPtr;
quint8 *pixels;
unsigned int baseSize; unsigned int baseSize;
unsigned __int16 streamSlot; quint16 streamSlot;
bool streaming; bool streaming;
const char *name;
qint32 namePtr;
QString name;
}; };
#endif // GFXIMAGE_H #endif // GFXIMAGE_H

View File

@ -0,0 +1 @@
#include "gfxlightdef.h"

1
libs/assets/gfxworld.cpp Normal file
View File

@ -0,0 +1 @@
#include "gfxworld.h"

View File

@ -84,7 +84,7 @@ struct GfxReflectionProbe
struct GfxWorldDpvsPlanes struct GfxWorldDpvsPlanes
{ {
int cellCount; int cellCount;
cplane_s *planes; CPlane *planes;
unsigned __int16 *nodes; unsigned __int16 *nodes;
unsigned int *sceneEntCellBits; unsigned int *sceneEntCellBits;
}; };
@ -352,7 +352,7 @@ struct GfxWorldDpvsStatic
GfxSurface *surfaces; GfxSurface *surfaces;
GfxCullGroup *cullGroups; GfxCullGroup *cullGroups;
GfxStaticModelDrawInst *smodelDrawInsts; GfxStaticModelDrawInst *smodelDrawInsts;
GfxDrawSurf *surfaceMaterials; GfxDrawSurfFields *surfaceMaterials;
unsigned int *surfaceCastsSunShadow; unsigned int *surfaceCastsSunShadow;
volatile int usageCount; volatile int usageCount;
}; };

View File

@ -0,0 +1 @@
#include "loadedsound.h"

View File

@ -0,0 +1 @@
#include "localizeentry.h"

1
libs/assets/mapent.cpp Normal file
View File

@ -0,0 +1 @@
#include "mapent.h"

1
libs/assets/material.cpp Normal file
View File

@ -0,0 +1 @@
#include "material.h"

View File

@ -5,35 +5,31 @@
struct GfxDrawSurfFields struct GfxDrawSurfFields
{ {
unsigned __int64 objectId : 16; quint64 objectId : 16;
unsigned __int64 reflectionProbeIndex : 8; quint64 reflectionProbeIndex : 8;
unsigned __int64 customIndex : 5; quint64 customIndex : 5;
unsigned __int64 materialSortedIndex : 11; quint64 materialSortedIndex : 11;
unsigned __int64 prepass : 2; quint64 prepass : 2;
unsigned __int64 primaryLightIndex : 8; quint64 primaryLightIndex : 8;
unsigned __int64 surfType : 4; quint64 surfType : 4;
unsigned __int64 primarySortKey : 6; quint64 primarySortKey : 6;
unsigned __int64 unused : 4; quint64 unused : 4;
}; };
union GfxDrawSurf struct MaterialInfo
{ {
GfxDrawSurfFields fields; qint32 namePtr;
unsigned __int64 packed; QString name;
};
struct __declspec(align(8)) MaterialInfo quint8 gameFlags;
{ quint8 sortKey;
const char *name; quint8 textureAtlasRowCount;
unsigned __int8 gameFlags; quint8 textureAtlasColumnCount;
unsigned __int8 sortKey; GfxDrawSurfFields drawSurf;
unsigned __int8 textureAtlasRowCount;
unsigned __int8 textureAtlasColumnCount;
GfxDrawSurf drawSurf;
unsigned int surfaceTypeBits; unsigned int surfaceTypeBits;
}; };
enum MapType : __int32 enum MapType : qint32
{ {
MAPTYPE_NONE = 0x0, MAPTYPE_NONE = 0x0,
MAPTYPE_INVALID1 = 0x1, MAPTYPE_INVALID1 = 0x1,
@ -46,48 +42,49 @@ enum MapType : __int32
struct GPUTEXTURESIZE_1D struct GPUTEXTURESIZE_1D
{ {
unsigned __int32 Width : 24; quint32 Width : 24;
}; };
struct GPUTEXTURESIZE_2D struct GPUTEXTURESIZE_2D
{ {
unsigned __int32 Width : 13; quint32 Width : 13;
unsigned __int32 Height : 13; quint32 Height : 13;
}; };
struct GPUTEXTURESIZE_3D struct GPUTEXTURESIZE_3D
{ {
unsigned __int32 Width : 11; quint32 Width : 11;
unsigned __int32 Height : 11; quint32 Height : 11;
unsigned __int32 Depth : 10; quint32 Depth : 10;
}; };
struct GPUTEXTURESIZE_STACK struct GPUTEXTURESIZE_STACK
{ {
unsigned __int32 Width : 13; quint32 Width : 13;
unsigned __int32 Height : 13; quint32 Height : 13;
unsigned __int32 Depth : 6; quint32 Depth : 6;
}; };
struct $FD14676823C8BF1A2A32FD1720A565E9 struct GPUTEXTURE_FETCH_CONSTANT
{ {
unsigned __int32 Type : 2; quint32 Type : 2;
unsigned __int32 SignX : 2; quint32 SignX : 2;
unsigned __int32 SignY : 2; quint32 SignY : 2;
unsigned __int32 SignZ : 2; quint32 SignZ : 2;
unsigned __int32 SignW : 2; quint32 SignW : 2;
unsigned __int32 ClampX : 3; quint32 ClampX : 3;
unsigned __int32 ClampY : 3; quint32 ClampY : 3;
unsigned __int32 ClampZ : 3; quint32 ClampZ : 3;
unsigned __int32 : 3; quint32 : 3;
unsigned __int32 Pitch : 9; quint32 Pitch : 9;
unsigned __int32 Tiled : 1; quint32 Tiled : 1;
unsigned __int32 DataFormat : 6;
unsigned __int32 Endian : 2; quint32 DataFormat : 6;
unsigned __int32 RequestSize : 2; quint32 Endian : 2;
unsigned __int32 Stacked : 1; quint32 RequestSize : 2;
unsigned __int32 ClampPolicy : 1; quint32 Stacked : 1;
unsigned __int32 BaseAddress : 20; quint32 ClampPolicy : 1;
quint32 BaseAddress : 20;
union union
{ {
GPUTEXTURESIZE_1D OneD; GPUTEXTURESIZE_1D OneD;
@ -95,41 +92,99 @@ struct $FD14676823C8BF1A2A32FD1720A565E9
GPUTEXTURESIZE_3D ThreeD; GPUTEXTURESIZE_3D ThreeD;
GPUTEXTURESIZE_STACK Stack; GPUTEXTURESIZE_STACK Stack;
} Size; } Size;
unsigned __int32 NumFormat : 1;
unsigned __int32 SwizzleX : 3; quint32 NumFormat : 1;
unsigned __int32 SwizzleY : 3; quint32 SwizzleX : 3;
unsigned __int32 SwizzleZ : 3; quint32 SwizzleY : 3;
unsigned __int32 SwizzleW : 3; quint32 SwizzleZ : 3;
__int32 ExpAdjust : 6; quint32 SwizzleW : 3;
unsigned __int32 MagFilter : 2; qint32 ExpAdjust : 6;
unsigned __int32 MinFilter : 2; quint32 MagFilter : 2;
unsigned __int32 MipFilter : 2; quint32 MinFilter : 2;
unsigned __int32 AnisoFilter : 3; quint32 MipFilter : 2;
unsigned __int32 : 3; quint32 AnisoFilter : 3;
unsigned __int32 BorderSize : 1; quint32 : 3;
unsigned __int32 VolMagFilter : 1; quint32 BorderSize : 1;
unsigned __int32 VolMinFilter : 1;
unsigned __int32 MinMipLevel : 4; quint32 VolMagFilter : 1;
unsigned __int32 MaxMipLevel : 4; quint32 VolMinFilter : 1;
unsigned __int32 MagAnisoWalk : 1; quint32 MinMipLevel : 4;
unsigned __int32 MinAnisoWalk : 1; quint32 MaxMipLevel : 4;
__int32 LODBias : 10; quint32 MagAnisoWalk : 1;
__int32 GradExpAdjustH : 5; quint32 MinAnisoWalk : 1;
__int32 GradExpAdjustV : 5; qint32 LODBias : 10;
unsigned __int32 BorderColor : 2; qint32 GradExpAdjustH : 5;
unsigned __int32 ForceBCWToMax : 1; qint32 GradExpAdjustV : 5;
unsigned __int32 TriClamp : 2;
__int32 AnisoBias : 4; quint32 BorderColor : 2;
unsigned __int32 Dimension : 2; quint32 ForceBCWToMax : 1;
unsigned __int32 PackedMips : 1; quint32 TriClamp : 2;
unsigned __int32 MipAddress : 20; qint32 AnisoBias : 4;
quint32 Dimension : 2;
quint32 PackedMips : 1;
quint32 MipAddress : 20;
}; };
union GPUTEXTURE_FETCH_CONSTANT // QDataStream &operator>>(QDataStream &in, GPUTEXTURE_FETCH_CONSTANT &s)
{ // {
$FD14676823C8BF1A2A32FD1720A565E9 __s0; // quint32 raw1, raw2, raw3, raw4, raw5;
unsigned int dword[6]; // in >> raw1 >> raw2 >> raw3 >> raw4 >> raw5;
};
// s.Type = raw1 & 0b000000000000000000000011;
// s.SignX = (raw1 >> 2) & 0b000000000000000000000011;
// s.SignY = (raw1 >> 4) & 0b000000000000000000000011;
// s.SignZ = (raw1 >> 6) & 0b000000000000000000000011;
// s.SignW = (raw1 >> 8) & 0b000000000000000000000011;
// s.ClampX = (raw1 >> 10) & 0b000000000000000000000111;
// s.ClampY = (raw1 >> 13) & 0b000000000000000000000111;
// s.ClampZ = (raw1 >> 16) & 0b000000000000000000000111;
// s.Pitch = (raw1 >> 22) & 0b000000000000000111111111;
// s.Tiled = (raw1 >> 31) & 0b000000000000000000000001;
// s.DataFormat = raw2 & 0b000000000000000000111111;
// s.Endian = (raw2 >> 6) & 0b000000000000000000000011;
// s.RequestSize = (raw2 >> 8) & 0b000000000000000000000011;
// s.Stacked = (raw2 >> 10) & 0b000000000000000000000001;
// s.ClampPolicy = (raw2 >> 11) & 0b000000000000000000000001;
// s.BaseAddress = (raw2 >> 12) & 0b000011111111111111111111;
// s.Size = (raw2 >> 32) & 0b000000000000000000001111;
// s.NumFormat = raw3 & 0b000000000000000000000001;
// s.SwizzleX = (raw3 >> 32) & 0b000000000000000000000111;
// s.SwizzleY = (raw3 >> 32) & 0b000000000000000000000111;
// s.SwizzleZ = (raw3 >> 32) & 0b000000000000000000000111;
// s.SwizzleW = (raw3 >> 32) & 0b000000000000000000000111;
// s.ExpAdjust = (raw3 >> 32) & 0b000000000000000000111111;
// s.MagFilter = (raw3 >> 32) & 0b000000000000000000001111;
// s.MinFilter = (raw3 >> 32) & 0b000000000000000000001111;
// s.MipFilter = (raw3 >> 32) & 0b000000000000000000001111;
// s.AnisoFilter = (raw3 >> 32) & 0b000000000000000000001111;
// s.: 3;
// s.BorderSize =
// s.VolMagFilter =
// s.VolMinFilter =
// s.MinMipLevel =
// s.MaxMipLevel =
// s.MagAnisoWalk =
// s.MinAnisoWalk =
// s.LODBias =
// s.GradExpAdjustH =
// s.GradExpAdjustV =
// s.BorderColor =
// s.ForceBCWToMax =
// s.TriClamp =
// s.AnisoBias =
// s.Dimension =
// s.PackedMips =
// s.MipAddress =
// return in;
// }
struct D3DBaseTexture : D3DResource struct D3DBaseTexture : D3DResource
{ {
@ -184,8 +239,8 @@ struct MaterialTextureDef
unsigned int nameHash; unsigned int nameHash;
char nameStart; char nameStart;
char nameEnd; char nameEnd;
unsigned __int8 samplerState; quint8 samplerState;
unsigned __int8 semantic; quint8 semantic;
MaterialTextureDefInfo u; MaterialTextureDefInfo u;
}; };
@ -204,15 +259,24 @@ struct GfxStateBits
struct Material struct Material
{ {
MaterialInfo info; MaterialInfo info;
unsigned __int8 stateBitsEntry[26];
unsigned __int8 textureCount; quint8 stateBitsEntry[26];
unsigned __int8 constantCount; quint8 textureCount;
unsigned __int8 stateBitsCount; quint8 constantCount;
unsigned __int8 stateFlags; quint8 stateBitsCount;
unsigned __int8 cameraRegion; quint8 stateFlags;
quint8 cameraRegion;
qint32 techSetPtr;
MaterialTechSet *techniqueSet; MaterialTechSet *techniqueSet;
qint32 textureTablePtr;
MaterialTextureDef *textureTable; MaterialTextureDef *textureTable;
qint32 constantTablePtr;
MaterialConstantDef *constantTable; MaterialConstantDef *constantTable;
qint32 stateBitsTablePtr;
GfxStateBits *stateBitsTable; GfxStateBits *stateBitsTable;
}; };

View File

@ -0,0 +1 @@
#include "materialpixelshader.h"

View File

@ -2,13 +2,17 @@
#define MATERIAL_PIXERHSHADER_H #define MATERIAL_PIXERHSHADER_H
#include "d3dresource.h" #include "d3dresource.h"
#include "qcontainerfwd.h"
#include "qtypes.h"
struct GfxPixelShaderLoadDef struct GfxPixelShaderLoadDef
{ {
unsigned __int8 *cachedPart; quint16 cachedPartPtr;
unsigned __int8 *physicalPart; QVector<quint8> cachedPart;
unsigned __int16 cachedPartSize; quint16 physicalPartPtr;
unsigned __int16 physicalPartSize; QVector<quint8> physicalPart;
quint16 cachedPartSize;
quint16 physicalPartSize;
}; };
struct D3DPixelShader : D3DResource struct D3DPixelShader : D3DResource

View File

@ -0,0 +1 @@
#include "materialtechset.h"

View File

@ -36,8 +36,10 @@ struct D3DVertexShader : D3DResource
struct GfxVertexShaderLoadDef struct GfxVertexShaderLoadDef
{ {
int *cachedPart; qint32 cachedPartPtr;
int *physicalPart; QVector<int> cachedPart;
qint32 physicalPartPtr;
QVector<int> physicalPart;
int cachedPartSize; int cachedPartSize;
int physicalPartSize; int physicalPartSize;
}; };
@ -102,7 +104,11 @@ struct MaterialTechSet
{ {
QString name; QString name;
int worldVertFormat; int worldVertFormat;
qint32 remappedPtr;
std::shared_ptr<MaterialTechSet> remappedTechniqueSet; std::shared_ptr<MaterialTechSet> remappedTechniqueSet;
QVector<qint32> techPtrs;
QVector<std::shared_ptr<MaterialTechnique>> techniques; QVector<std::shared_ptr<MaterialTechnique>> techniques;
}; };

1
libs/assets/menudef.cpp Normal file
View File

@ -0,0 +1 @@
#include "menudef.h"

View File

@ -42,7 +42,7 @@ struct ItemKeyHandler
ItemKeyHandler *next; ItemKeyHandler *next;
}; };
enum operationEnum : __int32 enum OperationEnum : __int32
{ {
OP_NOOP = 0x0, OP_NOOP = 0x0,
OP_RIGHTPAREN = 0x1, OP_RIGHTPAREN = 0x1,
@ -135,7 +135,7 @@ enum expDataType : __int32
VAL_STRING = 0x2, VAL_STRING = 0x2,
}; };
union operandInternalDataUnion union OperandInternalDataUnion
{ {
int intVal; int intVal;
float floatVal; float floatVal;
@ -145,12 +145,12 @@ union operandInternalDataUnion
struct Operand struct Operand
{ {
expDataType dataType; expDataType dataType;
operandInternalDataUnion internals; OperandInternalDataUnion internals;
}; };
union entryInternalData union entryInternalData
{ {
operationEnum op; OperationEnum op;
Operand operand; Operand operand;
}; };
@ -193,7 +193,7 @@ struct listBoxDef_s
Material *selectIcon; Material *selectIcon;
}; };
struct editFieldDef_s struct EditFieldDef
{ {
float minVal; float minVal;
float maxVal; float maxVal;
@ -205,7 +205,7 @@ struct editFieldDef_s
int paintOffset; int paintOffset;
}; };
struct multiDef_s struct MultiDef
{ {
const char *dvarList[32]; const char *dvarList[32];
const char *dvarStr[32]; const char *dvarStr[32];
@ -214,17 +214,17 @@ struct multiDef_s
int strDef; int strDef;
}; };
union itemDefData_t union ItemDefData
{ {
listBoxDef_s *listBox; listBoxDef_s *listBox;
editFieldDef_s *editField; EditFieldDef *editField;
multiDef_s *multi; MultiDef *multi;
const char *enumDvarName; const char *enumDvarName;
void *data; void *data;
}; };
struct MenuDef; struct MenuDef;
struct itemDef_s struct ItemDef
{ {
windowDef_t window; windowDef_t window;
rectDef_s textRect[4]; rectDef_s textRect[4];
@ -258,7 +258,7 @@ struct itemDef_s
SoundAliasList *focusSound; SoundAliasList *focusSound;
float special; float special;
int cursorPos[4]; int cursorPos[4];
itemDefData_t typeData; ItemDefData typeData;
int imageTrack; int imageTrack;
statement_s visibleExp; statement_s visibleExp;
statement_s textExp; statement_s textExp;
@ -295,7 +295,7 @@ struct MenuDef
float disableColor[4]; float disableColor[4];
statement_s rectXExp; statement_s rectXExp;
statement_s rectYExp; statement_s rectYExp;
itemDef_s **items; ItemDef **items;
}; };
#endif // MENUDEF_H #endif // MENUDEF_H

1
libs/assets/menulist.cpp Normal file
View File

@ -0,0 +1 @@
#include "menulist.h"

1
libs/assets/model.cpp Normal file
View File

@ -0,0 +1 @@
#include "model.h"

View File

@ -2,17 +2,19 @@
#define MODEL_H #define MODEL_H
#include "material.h" #include "material.h"
#include "scriptstringlist.h"
struct XSurfaceVertexInfo struct XSurfaceVertexInfo
{ {
__int16 vertCount[4]; qint16 vertCount[4];
unsigned __int16 *vertsBlend; qint32 vertsBlendPtr;
quint16 vertsBlend;
}; };
union GfxColor union GfxColor
{ {
unsigned int packed; unsigned int packed;
unsigned __int8 array[4]; quint8 array[4];
}; };
union PackedTexCoords union PackedTexCoords
@ -60,20 +62,20 @@ struct D3DVertexBuffer : D3DResource
struct XSurfaceCollisionAabb struct XSurfaceCollisionAabb
{ {
unsigned __int16 mins[3]; quint16 mins[3];
unsigned __int16 maxs[3]; quint16 maxs[3];
}; };
struct XSurfaceCollisionNode struct XSurfaceCollisionNode
{ {
XSurfaceCollisionAabb aabb; XSurfaceCollisionAabb aabb;
unsigned __int16 childBeginIndex; quint16 childBeginIndex;
unsigned __int16 childCount; quint16 childCount;
}; };
struct XSurfaceCollisionLeaf struct XSurfaceCollisionLeaf
{ {
unsigned __int16 triangleBeginIndex; quint16 triangleBeginIndex;
}; };
struct XSurfaceCollisionTree struct XSurfaceCollisionTree
@ -81,17 +83,17 @@ struct XSurfaceCollisionTree
float trans[3]; float trans[3];
float scale[3]; float scale[3];
unsigned int nodeCount; unsigned int nodeCount;
XSurfaceCollisionNode *nodes; QVector<XSurfaceCollisionNode> nodes;
unsigned int leafCount; unsigned int leafCount;
XSurfaceCollisionLeaf *leafs; QVector<XSurfaceCollisionLeaf> leafs;
}; };
struct XRigidVertList struct XRigidVertList
{ {
unsigned __int16 boneOffset; quint16 boneOffset;
unsigned __int16 vertCount; quint16 vertCount;
unsigned __int16 triOffset; quint16 triOffset;
unsigned __int16 triCount; quint16 triCount;
XSurfaceCollisionTree *collisionTree; XSurfaceCollisionTree *collisionTree;
}; };
@ -103,11 +105,11 @@ struct D3DIndexBuffer : D3DResource
struct XSurface struct XSurface
{ {
unsigned __int8 tileMode; quint8 tileMode;
bool deformed; bool deformed;
unsigned __int16 vertCount; quint16 vertCount;
unsigned __int16 triCount; quint16 triCount;
unsigned __int16 *triIndices; quint16 *triIndices;
XSurfaceVertexInfo vertInfo; XSurfaceVertexInfo vertInfo;
GfxPackedVertex *verts0; GfxPackedVertex *verts0;
D3DVertexBuffer vb0; D3DVertexBuffer vb0;
@ -127,12 +129,12 @@ struct DObjAnimMat
struct XModelLodInfo struct XModelLodInfo
{ {
float dist; float dist;
unsigned __int16 numsurfs; quint16 numsurfs;
unsigned __int16 surfIndex; quint16 surfIndex;
int partBits[4]; int partBits[4];
}; };
struct XModelCollSurf_s struct XModelCollSurf
{ {
float mins[3]; float mins[3];
float maxs[3]; float maxs[3];
@ -161,34 +163,42 @@ struct XModelStreamInfo
struct PhysPreset struct PhysPreset
{ {
const char *name; qint32 namePtr;
QString name;
int type; int type;
float mass; float mass;
float bounce; float bounce;
float friction; float friction;
float bulletForceScale; float bulletForceScale;
float explosiveForceScale; float explosiveForceScale;
const char *sndAliasPrefix;
qint32 sndAliasPrefixPtr;
QString sndAliasPrefix;
float piecesSpreadFraction; float piecesSpreadFraction;
float piecesUpwardVelocity; float piecesUpwardVelocity;
bool tempDefaultToCylinder; bool tempDefaultToCylinder;
}; };
struct cplane_s struct CPlane
{ {
float normal[3]; float normal[3];
float dist; float dist;
unsigned __int8 type; quint8 type;
unsigned __int8 signbits; quint8 signbits;
unsigned __int8 pad[2]; quint8 pad[2];
}; };
struct cbrushside_t struct CBrushSide
{ {
cplane_s *plane; qint32 planePtr;
unsigned int materialNum; CPlane plane;
__int16 firstAdjacentSideOffset; uint materialNum;
unsigned __int8 edgeCount; qint16 firstAdjacentSideOffset;
quint8 edgeCount;
}; };
struct BrushWrapper struct BrushWrapper
@ -197,13 +207,13 @@ struct BrushWrapper
int contents; int contents;
float maxs[3]; float maxs[3];
unsigned int numsides; unsigned int numsides;
cbrushside_t *sides; CBrushSide *sides;
__int16 axialMaterialNum[2][3]; __int16 axialMaterialNum[2][3];
unsigned __int8 *baseAdjacentSide; quint8 *baseAdjacentSide;
__int16 firstAdjacentSideOffsets[2][3]; __int16 firstAdjacentSideOffsets[2][3];
unsigned __int8 edgeCount[2][3]; quint8 edgeCount[2][3];
int totalEdgeCount; int totalEdgeCount;
cplane_s *planes; CPlane *planes;
}; };
struct PhysGeomInfo struct PhysGeomInfo
@ -231,33 +241,61 @@ struct PhysGeomList
struct Model struct Model
{ {
const char *name; QString name;
unsigned __int8 numBones; qint32 namePtr;
unsigned __int8 numRootBones; quint8 numBones;
unsigned __int8 numsurfs; quint8 numRootBones;
unsigned __int8 lodRampType; quint8 numsurfs;
unsigned __int16 *boneNames; quint8 lodRampType;
unsigned __int8 *parentList;
__int16 *quats; quint32 boneNamesPtr;
ScriptStringList boneNames;
quint32 parentListPtr;
quint8 *parentList;
qint32 quatsPtr;
qint16 *quats;
qint32 transPtr;
float *trans; float *trans;
unsigned __int8 *partClassification;
qint32 partClassPtr;
quint8 *partClassification;
qint32 baseMatPtr;
DObjAnimMat *baseMat; DObjAnimMat *baseMat;
qint32 surfsPtr;
XSurface *surfs; XSurface *surfs;
qint32 matHandlesPtr;
Material **materialHandles; Material **materialHandles;
XModelLodInfo lodInfo[4]; XModelLodInfo lodInfo[4];
XModelCollSurf_s *collSurfs;
qint32 collSurfsPtr;
XModelCollSurf *collSurfs;
int numCollSurfs; int numCollSurfs;
int contents; int contents;
qint32 boneInfoPtr;
XBoneInfo *boneInfo; XBoneInfo *boneInfo;
float radius; float radius;
float mins[3]; float mins[3];
float maxs[3]; float maxs[3];
__int16 numLods;
__int16 collLod; qint16 numLods;
qint16 collLod;
XModelStreamInfo streamInfo; XModelStreamInfo streamInfo;
int memUsage; int memUsage;
unsigned __int8 flags; quint8 flags;
PhysPreset *physPreset; std::shared_ptr<PhysPreset> physPreset;
qint32 physGeomsPtr;
PhysGeomList *physGeoms; PhysGeomList *physGeoms;
}; };

1
libs/assets/rawfile.cpp Normal file
View File

@ -0,0 +1 @@
#include "rawfile.h"

View File

@ -3,18 +3,15 @@
#include <QString> #include <QString>
struct p_RawFile struct RawFile
{
const char *name;
int length;
const char *buffer;
};
struct RawFile : p_RawFile
{ {
qint32 namePtr;
QString name; QString name;
QString path;
int length; quint32 length;
qint32 bufferPtr;
QByteArray buffer;
}; };
#endif // RAWFILE_H #endif // RAWFILE_H

View File

@ -0,0 +1 @@
#include "scriptstringlist.h"

View File

@ -0,0 +1,13 @@
#ifndef SCRIPTSTRINGLIST_H
#define SCRIPTSTRINGLIST_H
#include <QStringList>
struct ScriptStringList
{
int count;
QVector<qint32> stringPtrs;
QStringList scriptStrings;
};
#endif // SCRIPTSTRINGLIST_H

View File

@ -0,0 +1 @@
#include "soundalias.h"

View File

@ -0,0 +1 @@
#include "soundcurve.h"

View File

@ -0,0 +1 @@
#include "sounddriver.h"

View File

@ -1,6 +1,8 @@
#ifndef SoundDriver_H #ifndef SoundDriver_H
#define SoundDriver_H #define SoundDriver_H
#include <QString>
struct XAUDIOREVERBSETTINGS struct XAUDIOREVERBSETTINGS
{ {
unsigned int ReflectionsDelay; unsigned int ReflectionsDelay;
@ -34,8 +36,11 @@ struct XaReverbSettings
struct SoundDriver struct SoundDriver
{ {
qint32 namePtr;
QString name;
qint32 reverbPtr;
XaReverbSettings *reverbSettings; XaReverbSettings *reverbSettings;
const char *name;
}; };
#endif // SoundDriver_H #endif // SoundDriver_H

View File

@ -0,0 +1 @@
#include "stringtable.h"

View File

@ -1,12 +1,19 @@
#ifndef STRINGTABLESH_H #ifndef STRINGTABLESH_H
#define STRINGTABLESH_H #define STRINGTABLESH_H
#include <QString>
#include <QList>
struct StringTable struct StringTable
{ {
const char *name; qint32 namePtr;
QString name;
int columnCount; int columnCount;
int rowCount; int rowCount;
const char **values;
qint32 valuesPtr;
QStringList values;
}; };
#endif // STRINGTABLESH_H #endif // STRINGTABLESH_H

View File

@ -0,0 +1 @@
#include "weapondef.h"

View File

@ -5,7 +5,7 @@
#include "soundalias.h" #include "soundalias.h"
#include "model.h" #include "model.h"
enum weapType_t : __int32 enum WeaponType : __int32
{ {
WEAPTYPE_BULLET = 0x0, WEAPTYPE_BULLET = 0x0,
WEAPTYPE_GRENADE = 0x1, WEAPTYPE_GRENADE = 0x1,
@ -14,7 +14,7 @@ enum weapType_t : __int32
WEAPTYPE_NUM = 0x4, WEAPTYPE_NUM = 0x4,
}; };
enum weapClass_t : __int32 enum WeaponClass : __int32
{ {
WEAPCLASS_RIFLE = 0x0, WEAPCLASS_RIFLE = 0x0,
WEAPCLASS_MG = 0x1, WEAPCLASS_MG = 0x1,
@ -52,7 +52,7 @@ enum ImpactType : __int32
IMPACT_TYPE_COUNT = 0x9, IMPACT_TYPE_COUNT = 0x9,
}; };
enum weapInventoryType_t : __int32 enum WeaponInventoryType : __int32
{ {
WEAPINVENTORY_PRIMARY = 0x0, WEAPINVENTORY_PRIMARY = 0x0,
WEAPINVENTORY_OFFHAND = 0x1, WEAPINVENTORY_OFFHAND = 0x1,
@ -61,7 +61,7 @@ enum weapInventoryType_t : __int32
WEAPINVENTORYCOUNT = 0x4, WEAPINVENTORYCOUNT = 0x4,
}; };
enum weapFireType_t : __int32 enum WeaponFireType : __int32
{ {
WEAPON_FIRETYPE_FULLAUTO = 0x0, WEAPON_FIRETYPE_FULLAUTO = 0x0,
WEAPON_FIRETYPE_SINGLESHOT = 0x1, WEAPON_FIRETYPE_SINGLESHOT = 0x1,
@ -80,7 +80,7 @@ enum OffhandClass : __int32
OFFHAND_CLASS_COUNT = 0x4, OFFHAND_CLASS_COUNT = 0x4,
}; };
enum weapStance_t : __int32 enum WeaponStance : __int32
{ {
WEAPSTANCE_STAND = 0x0, WEAPSTANCE_STAND = 0x0,
WEAPSTANCE_DUCK = 0x1, WEAPSTANCE_DUCK = 0x1,
@ -88,7 +88,7 @@ enum weapStance_t : __int32
WEAPSTANCE_NUM = 0x3, WEAPSTANCE_NUM = 0x3,
}; };
enum activeReticleType_t : __int32 enum ActiveReticleType : __int32
{ {
VEH_ACTIVE_RETICLE_NONE = 0x0, VEH_ACTIVE_RETICLE_NONE = 0x0,
VEH_ACTIVE_RETICLE_PIP_ON_A_STICK = 0x1, VEH_ACTIVE_RETICLE_PIP_ON_A_STICK = 0x1,
@ -96,7 +96,7 @@ enum activeReticleType_t : __int32
VEH_ACTIVE_RETICLE_COUNT = 0x3, VEH_ACTIVE_RETICLE_COUNT = 0x3,
}; };
enum weaponIconRatioType_t : __int32 enum WeaponIconRatioType : __int32
{ {
WEAPON_ICON_RATIO_1TO1 = 0x0, WEAPON_ICON_RATIO_1TO1 = 0x0,
WEAPON_ICON_RATIO_2TO1 = 0x1, WEAPON_ICON_RATIO_2TO1 = 0x1,
@ -104,7 +104,7 @@ enum weaponIconRatioType_t : __int32
WEAPON_ICON_RATIO_COUNT = 0x3, WEAPON_ICON_RATIO_COUNT = 0x3,
}; };
enum ammoCounterClipType_t : __int32 enum AmmoCounterClipType : __int32
{ {
AMMO_COUNTER_CLIP_NONE = 0x0, AMMO_COUNTER_CLIP_NONE = 0x0,
AMMO_COUNTER_CLIP_MAGAZINE = 0x1, AMMO_COUNTER_CLIP_MAGAZINE = 0x1,
@ -116,7 +116,7 @@ enum ammoCounterClipType_t : __int32
AMMO_COUNTER_CLIP_COUNT = 0x7, AMMO_COUNTER_CLIP_COUNT = 0x7,
}; };
enum weapOverlayReticle_t : __int32 enum WeaponOverlayReticle : __int32
{ {
WEAPOVERLAYRETICLE_NONE = 0x0, WEAPOVERLAYRETICLE_NONE = 0x0,
WEAPOVERLAYRETICLE_CROSSHAIR = 0x1, WEAPOVERLAYRETICLE_CROSSHAIR = 0x1,
@ -131,7 +131,7 @@ enum WeapOverlayInteface_t : __int32
WEAPOVERLAYINTERFACECOUNT = 0x3, WEAPOVERLAYINTERFACECOUNT = 0x3,
}; };
enum weapProjExposion_t : __int32 enum WeaponProjExposion : __int32
{ {
WEAPPROJEXP_GRENADE = 0x0, WEAPPROJEXP_GRENADE = 0x0,
WEAPPROJEXP_ROCKET = 0x1, WEAPPROJEXP_ROCKET = 0x1,
@ -152,7 +152,7 @@ enum WeapStickinessType : __int32
WEAPSTICKINESS_COUNT = 0x4, WEAPSTICKINESS_COUNT = 0x4,
}; };
enum guidedMissileType_t : __int32 enum GuidedMissileType : __int32
{ {
MISSILE_GUIDANCE_NONE = 0x0, MISSILE_GUIDANCE_NONE = 0x0,
MISSILE_GUIDANCE_SIDEWINDER = 0x1, MISSILE_GUIDANCE_SIDEWINDER = 0x1,
@ -174,14 +174,14 @@ struct WeaponDef
unsigned __int16 notetrackSoundMapKeys[16]; unsigned __int16 notetrackSoundMapKeys[16];
unsigned __int16 notetrackSoundMapValues[16]; unsigned __int16 notetrackSoundMapValues[16];
int playerAnimType; int playerAnimType;
weapType_t weapType; WeaponType weapType;
weapClass_t weapClass; WeaponClass weapClass;
PenetrateType penetrateType; PenetrateType penetrateType;
ImpactType impactType; ImpactType impactType;
weapInventoryType_t inventoryType; WeaponInventoryType inventoryType;
weapFireType_t fireType; WeaponFireType fireType;
OffhandClass offhandClass; OffhandClass offhandClass;
weapStance_t stance; WeaponStance stance;
const EffectDef *viewFlashEffect; const EffectDef *viewFlashEffect;
const EffectDef *worldFlashEffect; const EffectDef *worldFlashEffect;
SoundAliasList *pickupSound; SoundAliasList *pickupSound;
@ -239,7 +239,7 @@ struct WeaponDef
int iReticleCenterSize; int iReticleCenterSize;
int iReticleSideSize; int iReticleSideSize;
int iReticleMinOfs; int iReticleMinOfs;
activeReticleType_t activeReticleType; ActiveReticleType activeReticleType;
float vStandMove[3]; float vStandMove[3];
float vStandRot[3]; float vStandRot[3];
float vDuckedOfs[3]; float vDuckedOfs[3];
@ -264,10 +264,10 @@ struct WeaponDef
Model *knifeModel; Model *knifeModel;
Model *worldKnifeModel; Model *worldKnifeModel;
Material *hudIcon; Material *hudIcon;
weaponIconRatioType_t hudIconRatio; WeaponIconRatioType hudIconRatio;
Material *ammoCounterIcon; Material *ammoCounterIcon;
weaponIconRatioType_t ammoCounterIconRatio; WeaponIconRatioType ammoCounterIconRatio;
ammoCounterClipType_t ammoCounterClip; AmmoCounterClipType ammoCounterClip;
int iStartAmmo; int iStartAmmo;
const char *szAmmoName; const char *szAmmoName;
int iAmmoIndex; int iAmmoIndex;
@ -338,7 +338,7 @@ struct WeaponDef
float fAdsZoomOutFrac; float fAdsZoomOutFrac;
Material *overlayMaterial; Material *overlayMaterial;
Material *overlayMaterialLowRes; Material *overlayMaterialLowRes;
weapOverlayReticle_t overlayReticle; WeaponOverlayReticle overlayReticle;
WeapOverlayInteface_t overlayInterface; WeapOverlayInteface_t overlayInterface;
float overlayWidth; float overlayWidth;
float overlayHeight; float overlayHeight;
@ -395,10 +395,10 @@ struct WeaponDef
int enhanced; int enhanced;
int laserSightDuringNightvision; int laserSightDuringNightvision;
Material *killIcon; Material *killIcon;
weaponIconRatioType_t killIconRatio; WeaponIconRatioType killIconRatio;
int flipKillIcon; int flipKillIcon;
Material *dpadIcon; Material *dpadIcon;
weaponIconRatioType_t dpadIconRatio; WeaponIconRatioType dpadIconRatio;
int bNoPartialReload; int bNoPartialReload;
int bSegmentedReload; int bSegmentedReload;
int iReloadAmmoAdd; int iReloadAmmoAdd;
@ -422,7 +422,7 @@ struct WeaponDef
float timeToAccelerate; float timeToAccelerate;
float projectileCurvature; float projectileCurvature;
Model *projectileModel; Model *projectileModel;
weapProjExposion_t projExplosion; WeaponProjExposion projExplosion;
const EffectDef *projExplosionEffect; const EffectDef *projExplosionEffect;
int projExplosionEffectForceNormalUp; int projExplosionEffectForceNormalUp;
const EffectDef *projDudEffect; const EffectDef *projDudEffect;
@ -440,7 +440,7 @@ struct WeaponDef
float perpendicularBounce[29]; float perpendicularBounce[29];
const EffectDef *projTrailEffect; const EffectDef *projTrailEffect;
float vProjectileColor[3]; float vProjectileColor[3];
guidedMissileType_t guidedMissileType; GuidedMissileType guidedMissileType;
float maxSteeringAccel; float maxSteeringAccel;
int projIgnitionDelay; int projIgnitionDelay;
const EffectDef *projIgnitionEffect; const EffectDef *projIgnitionEffect;