more stuff
This commit is contained in:
parent
72cc93e73c
commit
58e9c2920e
|
@ -84,6 +84,8 @@ set(TESTAPP_SRC_FILES
|
|||
)
|
||||
|
||||
set(CUTTOWN_SRC_FILES
|
||||
CuttownTest/gameData.cpp
|
||||
CuttownTest/gameData.h
|
||||
CuttownTest/Main.cpp
|
||||
CuttownTest/mainWindow.cpp
|
||||
CuttownTest/mainWindow.h
|
||||
|
|
|
@ -1,43 +1,45 @@
|
|||
#pragma once
|
||||
#include "SDL.h"
|
||||
#include <QApplication>
|
||||
|
||||
#include "windows.h"
|
||||
#include "LmpRepository.h"
|
||||
#include "GobFile.h"
|
||||
#include "VifDecoder.h"
|
||||
#include "TexDecoder.h"
|
||||
#include "AnimDecoder.h"
|
||||
#include "Model.h"
|
||||
#include "Texture.h"
|
||||
#include "AnimData.h"
|
||||
#include "WorldReader.h"
|
||||
#include "World.h"
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
#include "mainWindow.h"
|
||||
|
||||
LmpRepository* lmpRepository;
|
||||
#include "gameData.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QCoreApplication::setApplicationName("World Viewer");
|
||||
QCoreApplication::setApplicationVersion("1.0");
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("World Viewer");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
QCommandLineOption rootDirectoryOption(QStringList() << "r" << "root-directory",
|
||||
"The root directory of the game.",
|
||||
"directory");
|
||||
parser.addOption(rootDirectoryOption);
|
||||
|
||||
QCommandLineOption worldNameOption(QStringList() << "w" << "world",
|
||||
"The name of the world to open.",
|
||||
"worldname");
|
||||
parser.addOption(worldNameOption);
|
||||
|
||||
parser.process(app);
|
||||
|
||||
QString rootDir = parser.value(rootDirectoryOption);
|
||||
QString worldName = parser.value(worldNameOption);
|
||||
|
||||
//Q_INIT_RESOURCE(dockwidgets);
|
||||
MainWindow mainWin;
|
||||
GameData gameData;
|
||||
gameData.read(rootDir, worldName);
|
||||
MainWindow mainWin(gameData);
|
||||
mainWin.show();
|
||||
return app.exec();
|
||||
/*
|
||||
string dataPath = "D:\\emu\\bgda\\BG\\DATA\\";
|
||||
if (argc == 2){
|
||||
dataPath = argv[1];
|
||||
}
|
||||
lmpRepository = new LmpRepositoryImpl(dataPath, GameType::DARK_ALLIANCE);
|
||||
|
||||
GobFile cuttownGob = GobFile(dataPath + "CUTTOWN.GOB", GameType::DARK_ALLIANCE);
|
||||
World* world = WorldReader().readWorld(&cuttownGob, "cuttown");
|
||||
|
||||
|
||||
return 0;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
34
CuttownTest/gameData.cpp
Normal file
34
CuttownTest/gameData.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "gameData.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include "LmpRepository.h"
|
||||
#include "GobFile.h"
|
||||
#include "VifDecoder.h"
|
||||
#include "TexDecoder.h"
|
||||
#include "AnimDecoder.h"
|
||||
#include "Model.h"
|
||||
#include "Texture.h"
|
||||
#include "AnimData.h"
|
||||
#include "WorldReader.h"
|
||||
#include "World.h"
|
||||
|
||||
void GameData::read(QString rootDir, QString worldName)
|
||||
{
|
||||
findGame(rootDir);
|
||||
/*
|
||||
LmpRepository* lmpRepository = new LmpRepositoryImpl(dataPath, GameType::DARK_ALLIANCE);
|
||||
|
||||
GobFile cuttownGob = GobFile(dataPath + "CUTTOWN.GOB", GameType::DARK_ALLIANCE);
|
||||
World* world = WorldReader().readWorld(&cuttownGob, "cuttown");
|
||||
*/
|
||||
}
|
||||
|
||||
void GameData::findGame(QString rootDir)
|
||||
{
|
||||
QDir rootDirectory(rootDir);
|
||||
if (rootDirectory.exists()) {
|
||||
auto entries = rootDirectory.entryList(QStringList() << "SL*.*");
|
||||
|
||||
}
|
||||
}
|
12
CuttownTest/gameData.h
Normal file
12
CuttownTest/gameData.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
class GameData
|
||||
{
|
||||
public:
|
||||
void read(QString rootDir, QString worldName);
|
||||
|
||||
private:
|
||||
void findGame(QString rootDir);
|
||||
};
|
|
@ -2,8 +2,8 @@
|
|||
#include <QtWidgets>
|
||||
#include "mainWindow.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: textEdit(new QTextEdit)
|
||||
MainWindow::MainWindow(GameData& gameDataIn)
|
||||
: textEdit(new QTextEdit), gameData(gameDataIn)
|
||||
{
|
||||
setCentralWidget(textEdit);
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "gameData.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QListWidget;
|
||||
|
@ -17,7 +19,7 @@ class MainWindow : public QMainWindow
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
MainWindow(GameData& gameData);
|
||||
|
||||
private slots:
|
||||
void about();
|
||||
|
@ -31,5 +33,7 @@ private:
|
|||
QListWidget* listWidget;
|
||||
|
||||
QMenu* viewMenu;
|
||||
|
||||
GameData& gameData;
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue