Skip to content

Commit

Permalink
Sonic Nexus (Retro-Sonic Engine)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubberduckycooly committed Apr 17, 2022
1 parent 98cb141 commit cdfe25c
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 193 deletions.
3 changes: 0 additions & 3 deletions Nexus/Animation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#define HITBOX_COUNT (0x20)
#define HITBOX_DIR_COUNT (0x8)

enum AnimrotationFlags { ROTFLAG_NONE, ROTFLAG_FULL, ROTFLAG_45DEG, ROTFLAG_STATICFRAMES };

struct SpriteFrame {
int sprX;
int sprY;
Expand All @@ -25,7 +23,6 @@ struct SpriteAnimation {
byte frameCount;
byte speed;
byte loopPoint;
byte rotationFlag;
SpriteFrame* frames;
};

Expand Down
4 changes: 2 additions & 2 deletions Nexus/Collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ void ObjectFloorCollision(int xOffset, int yOffset, int cPath)
int c = 0;
int XPos = (entity->XPos >> 16) + xOffset;
int YPos = (entity->YPos >> 16) + yOffset;
if (XPos > 0 && XPos < stageLayouts[0].width << 7 && YPos > 0 && YPos < stageLayouts[0].height << 7) {
if (XPos > 0 && XPos < stageLayouts[0].xsize << 7 && YPos > 0 && YPos < stageLayouts[0].ysize << 7) {
int chunkX = XPos >> 7;
int tileX = (XPos & 0x7F) >> 4;
int chunkY = YPos >> 7;
Expand Down Expand Up @@ -1455,7 +1455,7 @@ void ObjectFloorGrip(int xOffset, int yOffset, int cPath)
int chunkX = YPos;
YPos = YPos - 16;
for (int i = 3; i > 0; i--) {
if (XPos > 0 && XPos < stageLayouts[0].width << 7 && YPos > 0 && YPos < stageLayouts[0].height << 7 && !scriptEng.checkResult) {
if (XPos > 0 && XPos < stageLayouts[0].xsize << 7 && YPos > 0 && YPos < stageLayouts[0].ysize << 7 && !scriptEng.checkResult) {
int chunkX = XPos >> 7;
int tileX = (XPos & 0x7F) >> 4;
int chunkY = YPos >> 7;
Expand Down
398 changes: 242 additions & 156 deletions Nexus/Drawing.cpp

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions Nexus/Drawing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
#define SURFACE_MAX (24)
#define GFXDATA_MAX (0x400000)

#define BLENDTABLE_YSIZE (0x100)
#define BLENDTABLE_XSIZE (0x100)
#define BLENDTABLE_SIZE (BLENDTABLE_XSIZE * BLENDTABLE_YSIZE)
#define TINTTABLE_SIZE (0x100)

#define DRAWLAYER_COUNT (0x7)

enum FlipFlags { FLIP_NONE, FLIP_X, FLIP_Y, FLIP_XY };
Expand All @@ -31,12 +26,12 @@ struct GFXSurface {
extern int SCREEN_XSIZE;
extern int SCREEN_CENTERX;

extern byte blendLookupTable[BLENDTABLE_SIZE];
extern byte blendLookupTable[0x100 * 0x100];

extern byte tintTable0[TINTTABLE_SIZE];
extern byte tintTable1[TINTTABLE_SIZE];
extern byte tintTable2[TINTTABLE_SIZE];
extern byte tintTable3[TINTTABLE_SIZE];
extern byte tintTable0[0x100];
extern byte tintTable1[0x100];
extern byte tintTable2[0x100];
extern byte tintTable3[0x100];

extern DrawListEntry drawListEntries[DRAWLAYER_COUNT];

Expand All @@ -55,7 +50,7 @@ inline void ClearGraphicsData()
}
void ClearScreen(byte index);

void SetScreenSize(int width, int height);
void SetScreenSize(int width, int lineSize);

void SetBlendTable(ushort alpha, byte type, byte a3, byte a4);
void SetTintTable(short alpha, short a2, byte type, byte a4, byte a5, byte tableID);
Expand Down
Binary file modified Nexus/Nexus.ico
Binary file not shown.
14 changes: 7 additions & 7 deletions Nexus/Nexus.rc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -88,12 +88,12 @@ BEGIN
BLOCK "0c0904b0"
BEGIN
VALUE "CompanyName", "Sonic Nexus (2008) By Christian 'The Taxman' Whitehead, Decompilation by Rubberduckycooly"
VALUE "FileDescription", "Sonic Nexus"
VALUE "FileVersion", "1.0.0"
VALUE "FileDescription", "Retro-Sonic Engine"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "Nexus.exe"
VALUE "OriginalFilename", "Nexus.exe"
VALUE "ProductName", "Sonic Nexus"
VALUE "ProductVersion", "1.0.0"
VALUE "OriginalFilename", "RSonic.exe"
VALUE "ProductName", "Retro-Sonic Engine"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
Expand Down
24 changes: 12 additions & 12 deletions Nexus/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,24 +363,24 @@ void LoadActLayout()
FileRead(activeTileLayers, 4);
FileRead(&tLayerMidPoint, 1);

FileRead(&stageLayouts[0].width, 1);
FileRead(&stageLayouts[0].height, 1);
FileRead(&stageLayouts[0].xsize, 1);
FileRead(&stageLayouts[0].ysize, 1);
xBoundary1 = 0;
newXBoundary1 = 0;
yBoundary1 = 0;
newYBoundary1 = 0;
xBoundary2 = stageLayouts[0].width << 7;
yBoundary2 = stageLayouts[0].height << 7;
xBoundary2 = stageLayouts[0].xsize << 7;
yBoundary2 = stageLayouts[0].ysize << 7;
waterLevel = yBoundary2 + 128;
newXBoundary2 = stageLayouts[0].width << 7;
newYBoundary2 = stageLayouts[0].height << 7;
newXBoundary2 = stageLayouts[0].xsize << 7;
newYBoundary2 = stageLayouts[0].ysize << 7;

for (int i = 0; i < 0x10000; ++i) stageLayouts[0].tiles[i] = 0;

byte fileBuffer = 0;
for (int y = 0; y < stageLayouts[0].height; ++y) {
for (int y = 0; y < stageLayouts[0].ysize; ++y) {
ushort *tiles = &stageLayouts[0].tiles[(y * 0x100)];
for (int x = 0; x < stageLayouts[0].width; ++x) {
for (int x = 0; x < stageLayouts[0].xsize; ++x) {
FileRead(&fileBuffer, 1);
tiles[x] = fileBuffer << 8;
FileRead(&fileBuffer, 1);
Expand Down Expand Up @@ -487,9 +487,9 @@ void LoadStageBackground()

for (int i = 1; i < layerCount + 1; ++i) {
FileRead(&fileBuffer, 1);
stageLayouts[i].width = fileBuffer;
stageLayouts[i].xsize = fileBuffer;
FileRead(&fileBuffer, 1);
stageLayouts[i].height = fileBuffer;
stageLayouts[i].ysize = fileBuffer;
FileRead(&fileBuffer, 1);
stageLayouts[i].type = fileBuffer;
FileRead(&fileBuffer, 1);
Expand Down Expand Up @@ -525,9 +525,9 @@ void LoadStageBackground()
}

// Read Layout
for (int y = 0; y < stageLayouts[i].height; ++y) {
for (int y = 0; y < stageLayouts[i].ysize; ++y) {
ushort *chunks = &stageLayouts[i].tiles[y * 0x100];
for (int x = 0; x < stageLayouts[i].width; ++x) {
for (int x = 0; x < stageLayouts[i].xsize; ++x) {
FileRead(&fileBuffer, 1);
*chunks += fileBuffer;
++chunks;
Expand Down
4 changes: 2 additions & 2 deletions Nexus/Scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ struct TileLayer {
int YPos;
int ZPos;
byte type;
byte width;
byte height;
byte xsize;
byte ysize;
};

struct LineScroll {
Expand Down

0 comments on commit cdfe25c

Please sign in to comment.