Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
djyt committed Nov 26, 2013
1 parent 412d566 commit 3cfa178
Show file tree
Hide file tree
Showing 92 changed files with 19,993 additions and 0 deletions.
100 changes: 100 additions & 0 deletions src/LayOut.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#-------------------------------------------------
#
# LayOut QMake File
#
#-------------------------------------------------

# Set the path to where the source tree is stored
INCLUDEPATH += c:/coding/qt/lastwave/LayOut

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = LayOut
TEMPLATE = app

# Icons
RC_ICONS = res/icon48x48.ico # Windows
ICON = res/icon48x48.icns # Mac

SOURCES += main.cpp\
mainwindow.cpp \
import/romloader.cpp \
roadedit/roadpathwidget.cpp \
leveldata.cpp \
generatexml.cpp \
export/exportcannonball.cpp \
import/importoutrun.cpp \
sprites/spritelist.cpp \
sprites/spritesection.cpp \
sprites/sprite.cpp \
sprites/previewwidget.cpp \
preview/oroad.cpp \
preview/hwroad.cpp \
preview/renders16.cpp \
preview/osprite.cpp \
preview/osprites.cpp \
preview/olevelobjs.cpp \
preview/hwsprites.cpp \
height/heightwidget.cpp \
height/heightsection.cpp \
import/importdialog.cpp \
levelpalettewidget/levelpalettewidget.cpp \
previewpalette.cpp \
utils.cpp \
levels/levels.cpp \
roadedit/roadpathscene.cpp \
settings/settingsdialog.cpp \
about/about.cpp

HEADERS += mainwindow.h \
import/romloader.hpp \
stdint.hpp \
roadedit/roadpathwidget.hpp \
leveldata.hpp \
generatexml.hpp \
export/exportcannonball.hpp \
import/importbase.hpp \
export/exportbase.hpp \
import/importoutrun.hpp \
sprites/spritelist.hpp \
sprites/spritesection.hpp \
sprites/sprite.hpp \
sprites/previewwidget.hpp \
preview/oroad.hpp \
preview/hwroad.hpp \
globals.hpp \
preview/renders16.hpp \
preview/ozoom_lookup.hpp \
preview/oentry.hpp \
preview/osprites.hpp \
preview/olevelobjs.hpp \
preview/hwsprites.hpp \
controlpoint.hpp \
sprites/spriteformat.hpp \
import/outrunlabels.hpp \
height/heightwidget.hpp \
height/heightsection.hpp \
height/heightlabels.hpp \
import/importdialog.hpp \
levelpalettewidget/levelpalettewidget.hpp \
previewpalette.hpp \
utils.hpp \
levels/levels.hpp \
height/heightformat.hpp \
roadedit/roadpathscene.hpp \
settings/settingsdialog.hpp \
about/about.hpp \
levels/levelpalette.hpp

FORMS += mainwindow.ui \
import/importdialog.ui \
levelpalettewidget/levelpalettewidget.ui \
levels/levels.ui \
settings/settingsdialog.ui \
about/about.ui

RESOURCES += \
layout.qrc

244 changes: 244 additions & 0 deletions src/LayOut.pro.user

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions src/about/about.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/***************************************************************************
Layout About Dialog
Copyright Chris White.
See license.txt for more details.
***************************************************************************/

#include <QTimer>
#include "../globals.hpp"
#include "../import/romloader.hpp"
#include "ui_about.h"
#include "about.hpp"

About::About(QWidget *parent, RomLoader* rom0) :
QDialog(parent, Qt::Tool),
ui(new Ui::About)
{
ui->setupUi(this);
setFixedSize(size());
ui->sprite->setTransparency(true);

connect(ui->buttonOK, SIGNAL(clicked()), this, SLOT(closeAbout()));

if (rom0->rom != NULL)
{
setupFrames(rom0);
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(advanceFrame()));
timer->start(150);
}
else
currentFrame = -1;

advanceFrame();
}

About::~About()
{
delete ui;
}

void About::closeAbout()
{
this->close();
}

// ------------------------------------------------------------------------------------------------
// Simple Animation Player
//
// Requires ROMs to be loaded.
// ------------------------------------------------------------------------------------------------

// Setup Animation Sequence With Required Frames
void About::setupFrames(RomLoader* rom0)
{
// ROM Address of spin sequence
uint32_t spin_anim_adr = 0x2424;

// Sprite Zoom
const static int ZOOM_LEVEL = 0x7F;

// Read animation sequence and create sprites
while (true)
{
SpriteFormat entry;
uint32_t adr = rom0->read32(spin_anim_adr);
entry.width = rom0->read8(WH_TABLE + (ZOOM_LEVEL << 8) + rom0->read8(adr + 1));
entry.height = rom0->read8(WH_TABLE + (ZOOM_LEVEL << 8) + rom0->read8(adr + 3));
entry.bank = rom0->read8(adr + 7);
entry.offset = rom0->read16(adr + 8);
pals.push_back(rom0->read8(spin_anim_adr + 4));
sprites.push_back(entry);

// End of animation sequence
if (rom0->read8(spin_anim_adr + 7))
break;
// Advance to next entry
else
spin_anim_adr += 8;
}

currentFrame = 0;
}

// Advance animation sequence to next frame
void About::advanceFrame()
{
if (currentFrame == -1)
return;

SpriteFormat entry = sprites.at(currentFrame);
ui->sprite->setSprite(entry.bank, entry.offset, entry.width, entry.height, false, pals.at(currentFrame));

if (++currentFrame >= sprites.length())
currentFrame = 0;
}
48 changes: 48 additions & 0 deletions src/about/about.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/***************************************************************************
Layout About Dialog
Copyright Chris White.
See license.txt for more details.
***************************************************************************/

#ifndef ABOUT_HPP
#define ABOUT_HPP

#include <QDialog>
#include "../sprites/spriteformat.hpp"

class RomLoader;

namespace Ui {
class About;
}

class About : public QDialog
{
Q_OBJECT

public:
explicit About(QWidget *parent = 0, RomLoader *rom0 = NULL);
~About();

private slots:
void closeAbout();
void advanceFrame();

private:
Ui::About *ui;

// Animation Sprites
QList <SpriteFormat> sprites;

// Animation Palettes
QList <int> pals;

// Current Animation Frame
int currentFrame;

// Function Prototypes
void setupFrames(RomLoader* rom0);
};

#endif // ABOUT_HPP
69 changes: 69 additions & 0 deletions src/about/about.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>About</class>
<widget class="QWidget" name="About">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>188</width>
<height>272</height>
</rect>
</property>
<property name="windowTitle">
<string>About Layout</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item alignment="Qt::AlignHCenter|Qt::AlignTop">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Reassembler Presents...&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:600;&quot;&gt;LayOut&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; font-weight:600;&quot;&gt;Version 0.11&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="SpritePreviewWidget" name="sprite" native="true">
<property name="minimumSize">
<size>
<width>170</width>
<height>136</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>170</width>
<height>136</height>
</size>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;a href=&quot;http://reassembler.blogspot.com&quot;&gt;reassembler.blogspot.com&lt;/a&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonOK">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>SpritePreviewWidget</class>
<extends>QWidget</extends>
<header>sprites/previewwidget.hpp</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
21 changes: 21 additions & 0 deletions src/controlpoint.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef CONTROLPOINT_HPP
#define CONTROLPOINT_HPP

struct ControlPoint
{
// Position of Change (Index into road)
int pos;

// Width / Height
int type;

// Used to store width or height index
// Sprites: Number Of Sprites In Segment [byte]
int value1;

// Width Change Speed
// Sprites: Sprite Data Entry Number From Lookup Table [byte]
int value2;
};

#endif // CONTROLPOINT_HPP
27 changes: 27 additions & 0 deletions src/export/exportbase.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/***************************************************************************
Export Level Data Base Class
Copyright Chris White.
See license.txt for more details.
***************************************************************************/

#ifndef EXPORTBASE_HPP
#define EXPORTBASE_HPP

#include <QList>

class QString;
class Levels;
struct HeightSegment;
struct SpriteSectionEntry;

class ExportBase
{
public:
virtual void write(QString& filename,
Levels *levels,
QList<HeightSegment> heightMaps,
QList<SpriteSectionEntry> spriteMaps) = 0;
};

#endif // EXPORTBASE_HPP
Loading

0 comments on commit 3cfa178

Please sign in to comment.