Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sarc Explorer (only File/Folder renaming for now)
  • Loading branch information
RicBent committed Oct 17, 2016
1 parent 2f9f232 commit 673c8aa
Show file tree
Hide file tree
Showing 22 changed files with 403 additions and 58 deletions.
9 changes: 6 additions & 3 deletions CoinKiller.pro
Expand Up @@ -47,7 +47,8 @@ SOURCES += main.cpp\
settingsmanager.cpp \
filedownloader.cpp \
levelminimap.cpp \
objectseditionmode.cpp
objectseditionmode.cpp \
sarcexplorerwindow.cpp

HEADERS += mainwindow.h \
filesystembase.h \
Expand Down Expand Up @@ -86,10 +87,12 @@ HEADERS += mainwindow.h \
settingsmanager.h \
filedownloader.h \
levelminimap.h \
objectseditionmode.h
objectseditionmode.h \
sarcexplorerwindow.h

FORMS += mainwindow.ui \
leveleditorwindow.ui \
tileseteditorwindow.ui
tileseteditorwindow.ui \
sarcexplorerwindow.ui

CONFIG += c++11
Binary file added coinkiller_data/icons/file.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coinkiller_data/icons/file_image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coinkiller_data/icons/folder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions coinkiller_data/languages/English/translations.txt
Expand Up @@ -19,6 +19,7 @@ file=File
filename=Filename
help=Help
settings=Settings
tools=Tools
edit=Edit
save=Save
copy=Copy
Expand Down Expand Up @@ -90,3 +91,8 @@ moveObjDown=Move Object Down
objSettings=Object Settings
tileData=Tile Data
noneData=None

[SarcExplorer]
sarcExplorer=Sarc Explorer
sarcArchives=Sarc Archives
selectArchive=Select an Sarc Archive
8 changes: 7 additions & 1 deletion coinkiller_data/languages/German/translations.txt
Expand Up @@ -19,6 +19,7 @@ file=Datei
filename=Dateiname
help=Hilfe
settings=Einstellungen
tools=Tools
edit=Bearbeiten
save=Speichern
copy=Kopieren
Expand Down Expand Up @@ -89,4 +90,9 @@ moveObjUp=Objekt nach oben verschieben
moveObjDown=Objekt nach unten verschieben
objSettings=Objekt Einstellungen
tileData=Teildaten
noneData=Keine
noneData=Keine

[SarcExplorer]
sarcExplorer=Sarc Explorer
sarcArchives=Sarc Archive
selectArchive=Sarc Archiv auswählen
75 changes: 44 additions & 31 deletions coinkiller_data/spritedata.xml
Expand Up @@ -769,7 +769,7 @@
<value nybble="8" title="Unknown Value 8" comment="Checkbox?"/>
<value nybble="12" title="Unknown Value 12" comment="..."/>
</sprite>
<sprite id="123" name="Bouncy Mushroom Platform" notes="Previously appeared in the original NSMB.">
<sprite id="123" name="Bouncy Mushroom" notes="Previously appeared in the original NSMB.">
<checkbox nybble="5" title="Only Solid from Top"/>
<value nybble="6" title="Unknown Value 6" comment="No visual change with n 5 and n 16 on 0."/>
<checkbox nybble="16" title="Longer Platform" comment="todo: Give detail on sizes."/>
Expand Down Expand Up @@ -901,9 +901,21 @@
</list>
<checkbox nybble="10" title="Spins Clockwise"/>
</sprite>
<sprite id="148" name="Move-while-on Lift">
<value nybble="8" title="Unknown Value 8" comment="Always 2..."/>
<value nybble="16" title="Unknown Value 16" comment="Always 2..."/>
<sprite id="148" name="Boat Raft Platform" notes="Only moves right.">
<list nybble="8" title="Movement">
<entry value="0">Moves Back When Not On It</entry>
<entry value="1">Continuously Moves Once On It</entry>
<entry value="2">Stops When Not On It</entry>
</list>
<list nybble="18" title="Speed">
<entry value="0">Slowest</entry>
<entry value="2">Slower</entry>
<entry value="4">Slow</entry>
<entry value="6">Medium</entry>
<entry value="8">Fast</entry>
<entry value="10">Faster</entry>
<entry value="12">Fastest</entry>
</list>
</sprite>
<sprite id="149" name="Changeable-direction Lift" notes="It is still at first, it starts moving when landed on. After that it reverses direction when landed on. Values 15 and 4 for Unknown Values 5 and 6 make the platform move up and down. Values 2 and 6 make it move upright-downright.">
<value nybble="1-2" title="Flag"/>
Expand Down Expand Up @@ -1199,7 +1211,7 @@
<entry value="1">Top</entry>
<entry value="2">Bottom</entry>
</list>
<list nybble="12" title="Unknown Value 12" comment="Maybe Move related"/>
<value nybble="12" title="Unknown Value 12" comment="Maybe Move related"/>
<value nybble="14" title="Height" comment="Value+1"/>
<value nybble="16" title="Width" comment="Value+1"/>
</sprite>
Expand Down Expand Up @@ -1496,12 +1508,12 @@
<entry value="0">Left</entry>
<entry value="1">Right</entry>
</list>
<list nybble="6" title="Speed" comment="Speeds go in order from slow to fast.">
<entry value="0">No Movement</entry>
<entry value="1">Speed 1</entry>
<entry value="2">Speed 2</entry>
<entry value="3">Speed 3</entry>
<entry value="4">Speed 4</entry>
<list nybble="6" title="Speed" comment="Gotta Go Fast!">
<entry value="0">Does Not Move</entry>
<entry value="1">Slow</entry>
<entry value="2">Medium</entry>
<entry value="3">Fast</entry>
<entry value="4">Super Fast</entry>
</list>
<checkbox nybble="7" title="Maintain Momentum" comment="Spiked Ball keeps it's momentum when it hits other objects."/>
<list nybble="14" title="Behaviour" comment="Behaviours loop after value 3">
Expand All @@ -1518,12 +1530,12 @@
<entry value="0">Left</entry>
<entry value="1">Right</entry>
</list>
<list nybble="6" title="Speed" comment="Speeds go in order from slow to fast.">
<entry value="0">No movement</entry>
<entry value="1">Speed 1</entry>
<entry value="2">Speed 2</entry>
<entry value="3">Speed 3</entry>
<entry value="4">Speed 4</entry>
<list nybble="6" title="Speed" comment="Gotta Go Fast!">
<entry value="0">Does Not Move</entry>
<entry value="1">Slow</entry>
<entry value="2">Medium</entry>
<entry value="3">Fast</entry>
<entry value="4">Super Fast</entry>
</list>
<checkbox nybble="7" title="Maintain Momentum" comment="Spiked Ball keeps it's momentum when it hits other objects."/>
<value nybble="9" title="Unknown Value 9" comment="Checkbox?"/>
Expand All @@ -1542,12 +1554,12 @@
<entry value="0">Left</entry>
<entry value="1">Right</entry>
</list>
<list nybble="6" title="Speeds" comment="Speeds go in order from slow to fast.">
<entry value="0">No movement</entry>
<entry value="1">Speed 1</entry>
<entry value="2">Speed 2</entry>
<entry value="3">Speed 3</entry>
<entry value="4">Speed 4</entry>
<list nybble="6" title="Speeds" comment="Gotta Go Fast!">
<entry value="0">Does Not Move</entry>
<entry value="1">Slow</entry>
<entry value="2">Medium</entry>
<entry value="3">Fast</entry>
<entry value="4">Super Fast</entry>
</list>
<checkbox nybble="7" title="Maintain Momentum" comment="Spiked Ball keeps it's momentum when it hits other objects."/>
<value nybble="12" title="Unknown Value 12" comment="Always 1..."/>
Expand Down Expand Up @@ -1753,18 +1765,19 @@
</sprite>
<sprite id="269" name="Gold Ship" notes="Existing In-Game Sprite Data:&#13;&#10;Incomplete">
<value nybble="12" title="Path Controller ID" comment="Use this to link this sprite to 188."/>
<value nybble="1" title="Unknown value 22" comment="Set to 1 at start of stage, And 2 at mid point?"/>
</sprite>
<sprite id="270" name="Icy Spiked Ball" notes="Icy version of a regular Spike Ball">
<list nybble="5" title="Direction" comment="Sets the starting direction.">
<entry value="0">Left</entry>
<entry value="1">Right</entry>
</list>
<list nybble="6" title="Speed" comment="Speeds go in order from slow to fast.">
<entry value="0">No movement</entry>
<entry value="1">Speed 1</entry>
<entry value="2">Speed 2</entry>
<entry value="3">Speed 3</entry>
<entry value="4">Speed 4</entry>
<list nybble="6" title="Speed" comment="Gotta Go Fast!">
<entry value="0">Does Not Move</entry>
<entry value="1">Slow</entry>
<entry value="2">Medium</entry>
<entry value="3">Fast</entry>
<entry value="4">Super Fast</entry>
</list>
</sprite>
<sprite id="271" name="Big Icy Spiked Ball" notes="Likely to have identical sprite data to normal Big Spike Ball">
Expand Down Expand Up @@ -1869,7 +1882,7 @@
<sprite id="286" name="Chandelier Lift - Big"/>
<sprite id="287" name="Door - Toad House" notes="Existing In-Game Sprite Data: Incomplete"/>
<sprite id="288" name="Resources Loader - Mega Mario"/>
<sprite id="289" name="Bouncy Mushroom Platform - Castle">
<sprite id="289" name="Bouncy Mushroom - Castle">
<checkbox nybble="16" title="Longer Platform" comment="todo: Give detail on sizes."/>
</sprite>
<sprite id="290" name="Path-controlled Climbable Fence (small)">
Expand Down Expand Up @@ -1898,7 +1911,7 @@
<value nybble="8" title="Speed?" comment="..."/>
<value nybble="9" title="Move when on?" comment="Checkbox with mask 2?"/>
</sprite>
<sprite id="298" name="&quot;Applause-kun&quot;">
<sprite id="298" name="Resources Loader - Applause Coin" notes="Needed for the applause coin to work, place at the start of the level.">
<value nybble="12" title="Unknown Value 12" comment="Always 1..."/>
</sprite>
<sprite id="299" name="Rectangle Lift - Lemmy Battle"/>
Expand Down
Binary file added coinkiller_data/ts_convert/convert.exe
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions externalfilesystem.cpp
Expand Up @@ -77,3 +77,11 @@ bool ExternalFilesystem::renameFile(QString path, QString newName)
if (!file.exists()) return false;
return file.rename(newName);
}

bool ExternalFilesystem::renameDir(QString path, QString newName)
{
QDir dir(basepath + path);
if (!dir.exists()) return false;
QString newPath = dir.path() + "/" + newName; // Is this working? Dunno. TODO: test this
return dir.rename(path, newPath);
}
2 changes: 1 addition & 1 deletion externalfilesystem.h
Expand Up @@ -33,7 +33,7 @@ class ExternalFilesystem : public FilesystemBase
bool save(FileBase* file);
bool deleteFile(QString path);
bool renameFile(QString path, QString newName);

bool renameDir(QString path, QString newName);

private:
QString basepath;
Expand Down
1 change: 1 addition & 0 deletions filesystembase.h
Expand Up @@ -32,6 +32,7 @@ class FilesystemBase
virtual bool save(FileBase* file)=0;
virtual bool deleteFile(QString path)=0;
virtual bool renameFile(QString path, QString newName)=0;
virtual bool renameDir(QString patn, QString newName)=0;
};


Expand Down
14 changes: 14 additions & 0 deletions mainwindow.cpp
Expand Up @@ -33,6 +33,7 @@

#include "leveleditorwindow.h"
#include "tileseteditorwindow.h"
#include "sarcexplorerwindow.h"
#include "sillytest.h" // REMOVE ME!!

MainWindow::MainWindow(QWidget *parent) :
Expand Down Expand Up @@ -173,6 +174,8 @@ void MainWindow::loadTranslations()
ui->tabWidget->setTabText(2, settings->getTranslation("General", "settings"));
ui->languagesLabel->setText(settings->getTranslation("MainWindow", "languages")+":");
ui->updateSpriteData->setText(settings->getTranslation("MainWindow", "updateSDat"));
ui->tabWidget->setTabText(3, settings->getTranslation("General", "tools"));
ui->openSarcExplorerBtn->setText(settings->getTranslation("SarcExplorer", "sarcExplorer"));
}

void MainWindow::on_updateSpriteData_clicked()
Expand Down Expand Up @@ -211,3 +214,14 @@ void MainWindow::sdDownload_finished(QNetworkReply::NetworkError error)

this->setEnabled(true);
}

void MainWindow::on_openSarcExplorerBtn_clicked()
{
QString sarcFilePath = QFileDialog::getOpenFileName(this, settings->getTranslation("SarcExplorer", "selectArchive"), settings->getLastRomFSPath(), settings->getTranslation("SarcExplorer", "sarcArchives") + " (*.sarc)");

if (sarcFilePath.isEmpty() || sarcFilePath.isEmpty())
return;

SarcExplorerWindow* sarcExplorer = new SarcExplorerWindow(this, sarcFilePath, settings);
sarcExplorer->show();
}
2 changes: 2 additions & 0 deletions mainwindow.h
Expand Up @@ -52,6 +52,8 @@ private slots:

void on_updateSpriteData_clicked();

void on_openSarcExplorerBtn_clicked();

private:
Ui::MainWindow *ui;

Expand Down
14 changes: 14 additions & 0 deletions mainwindow.ui
Expand Up @@ -124,6 +124,20 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>&lt;Tools&gt;</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QPushButton" name="openSarcExplorerBtn">
<property name="text">
<string>&lt;Sarc Explorer&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
Expand Down
5 changes: 5 additions & 0 deletions objectrenderer.cpp
Expand Up @@ -395,6 +395,11 @@ FlipperRenderer::FlipperRenderer(const Sprite *spr)
else img = new NormalImageRenderer(spr, basePath + "Flipper_Right_Down.png");
}

void FlipperRenderer::render(QPainter *painter)
{
img->render(painter);
}

// Sprite 97: End of Level Flag
GoalRenderer::GoalRenderer(const Sprite *spr)
{
Expand Down
3 changes: 1 addition & 2 deletions objectrenderer.h
Expand Up @@ -63,13 +63,12 @@ class SpecialExitControllerRenderer: public SpriteRenderer
};

// Sprite 94: Flipper (One way gate)
class FlipperRenderer: public ObjectRenderer
class FlipperRenderer: public SpriteRenderer
{
public:
FlipperRenderer(const Sprite *spr);
void render(QPainter *painter);
protected:
const Object *obj;
NormalImageRenderer *img;
};

Expand Down

0 comments on commit 673c8aa

Please sign in to comment.