Skip to content

Commit

Permalink
tweaks, improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubberduckycooly committed Jan 1, 2021
1 parent 6a99266 commit fe9edb2
Show file tree
Hide file tree
Showing 15 changed files with 263 additions and 95 deletions.
1 change: 1 addition & 0 deletions SonicCDDecomp/Audio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ inline void freeMusInfo()
SDL_FreeAudioStream(musInfo.stream);
ov_clear(&musInfo.vorbisFile);
musInfo.buffer = nullptr;
musInfo.extraBuffer = nullptr;
musInfo.stream = nullptr;
musInfo.audioLen = 0;
musInfo.currentTrack = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions SonicCDDecomp/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void processStageSelect()
{
DrawTextMenu(&gameMenu[0], SCREEN_CENTERX, 72);
if (keyPress.start || keyPress.A) {
stageMode = DEVMENU_STAGESEL;
stageMode = DEVMENU_MAIN;
SetupTextMenu(&gameMenu[0], 0);
AddTextMenuEntry(&gameMenu[0], "RETRO ENGINE DEV MENU");
AddTextMenuEntry(&gameMenu[0], " ");
Expand Down Expand Up @@ -352,7 +352,7 @@ void processStageSelect()
ClearAnimationData();
LoadPalette("MasterPalette.act", 0, 0, 0, 256);
activeStageList = 0;
stageMode = DEVMENU_STAGESEL;
stageMode = DEVMENU_MAIN;
Engine.gameMode = ENGINE_MAINGAME;
stageListPosition = 0;
}
Expand Down
104 changes: 104 additions & 0 deletions SonicCDDecomp/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ int tileYPos[PARALLAX_COUNT];

void DrawHLineScrollLayer(int layerID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
TileLayer *layer = &stageLayouts[activeTileLayers[layerID]];
int screenwidth16 = (SCREEN_XSIZE >> 4) - 1;
int layerwidth = layer->width;
Expand Down Expand Up @@ -775,9 +776,11 @@ void DrawHLineScrollLayer(int layerID)
}
}
}
#endif
}
void DrawVLineScrollLayer(int layerID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
TileLayer *layer = &stageLayouts[activeTileLayers[layerID]];
int layerwidth = layer->width;
int layerheight = layer->height;
Expand Down Expand Up @@ -1276,9 +1279,15 @@ void DrawVLineScrollLayer(int layerID)
tileX = 0;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
//TODO: this
#endif
}
void Draw3DFloorLayer(int layerID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
TileLayer *layer = &stageLayouts[activeTileLayers[layerID]];
int layerWidth = layer->width << 7;
int layerHeight = layer->height << 7;
Expand Down Expand Up @@ -1323,9 +1332,15 @@ void Draw3DFloorLayer(int layerID)
YPos += YBuffer;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void Draw3DSkyLayer(int layerID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
TileLayer *layer = &stageLayouts[activeTileLayers[layerID]];
int layerWidth = layer->width << 7;
int layerHeight = layer->height << 7;
Expand Down Expand Up @@ -1379,10 +1394,16 @@ void Draw3DSkyLayer(int layerID)
// int cnt = 108 * SCREEN_XSIZE;
// while (cnt--) *frameBufferPtr++ = 0xF81Fu; //Magenta
//}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawRectangle(int XPos, int YPos, int width, int height, int R, int G, int B, int A)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
if (width + XPos > SCREEN_XSIZE)
width = SCREEN_XSIZE - XPos;
if (XPos < 0) {
Expand Down Expand Up @@ -1429,10 +1450,16 @@ void DrawRectangle(int XPos, int YPos, int width, int height, int R, int G, int
frameBufferPtr += pitch;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawTintRectangle(int XPos, int YPos, int width, int height)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
if (width + XPos > SCREEN_XSIZE)
width = SCREEN_XSIZE - XPos;
if (XPos < 0) {
Expand All @@ -1459,10 +1486,16 @@ void DrawTintRectangle(int XPos, int YPos, int width, int height)
++frameBufferPtr;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void DrawScaledTintMask(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX,
int sprY, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
int roundedYPos = 0;
int roundedXPos = 0;
int truescaleX = 4 * scaleX;
Expand Down Expand Up @@ -1556,10 +1589,16 @@ void DrawScaledTintMask(int direction, int XPos, int YPos, int pivotX, int pivot
gfxPitch = 0;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
if (width + XPos > SCREEN_XSIZE)
width = SCREEN_XSIZE - XPos;
if (XPos < 0) {
Expand Down Expand Up @@ -1597,10 +1636,16 @@ void DrawSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, i
frameBufferPtr += pitch;
gfxDataPtr += gfxPitch;
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawSpriteFlipped(int XPos, int YPos, int width, int height, int sprX, int sprY, int direction, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
int widthFlip = width;
int heightFlip = height;

Expand Down Expand Up @@ -1720,10 +1765,16 @@ void DrawSpriteFlipped(int XPos, int YPos, int width, int height, int sprX, int
break;
default: break;
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void DrawSpriteScaled(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX,
int sprY, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
int roundedYPos = 0;
int roundedXPos = 0;
int truescaleX = 4 * scaleX;
Expand Down Expand Up @@ -1823,10 +1874,16 @@ void DrawSpriteScaled(int direction, int XPos, int YPos, int pivotX, int pivotY,
gfxPitch = 0;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void DrawSpriteRotated(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, int width, int height, int rotation,
int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
int sprXPos = (pivotX + sprX) << 9;
int sprYPos = (pivotY + sprY) << 9;
int fullwidth = width + sprX;
Expand Down Expand Up @@ -1968,13 +2025,19 @@ void DrawSpriteRotated(int direction, int XPos, int YPos, int pivotX, int pivotY
frameBufferPtr += pitch;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawSpriteRotozoom(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, int width, int height, int rotation,
int scale, int sheetID)
{
if (scale == 0)
return;
#if RETRO_RENDERTYPE == RETRO_SW_RENDER

int sprXPos = (pivotX + sprX) << 9;
int sprYPos = (pivotY + sprY) << 9;
Expand Down Expand Up @@ -2120,10 +2183,16 @@ void DrawSpriteRotozoom(int direction, int XPos, int YPos, int pivotX, int pivot
frameBufferPtr += pitch;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
if (width + XPos > SCREEN_XSIZE)
width = SCREEN_XSIZE - XPos;
if (XPos < 0) {
Expand Down Expand Up @@ -2161,9 +2230,15 @@ void DrawBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int
frameBufferPtr += pitch;
gfxData += gfxPitch;
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void DrawAlphaBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
if (width + XPos > SCREEN_XSIZE)
width = SCREEN_XSIZE - XPos;
if (XPos < 0) {
Expand Down Expand Up @@ -2227,9 +2302,15 @@ void DrawAlphaBlendedSprite(int XPos, int YPos, int width, int height, int sprX,
gfxData += gfxPitch;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void DrawAdditiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
if (width + XPos > SCREEN_XSIZE)
width = SCREEN_XSIZE - XPos;
if (XPos < 0) {
Expand Down Expand Up @@ -2292,9 +2373,15 @@ void DrawAdditiveBlendedSprite(int XPos, int YPos, int width, int height, int sp
frameBufferPtr += pitch;
gfxData += gfxPitch;
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void DrawSubtractiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID)
{
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
if (width + XPos > SCREEN_XSIZE)
width = SCREEN_XSIZE - XPos;
if (XPos < 0) {
Expand Down Expand Up @@ -2350,6 +2437,11 @@ void DrawSubtractiveBlendedSprite(int XPos, int YPos, int width, int height, int
frameBufferPtr += pitch;
gfxData += gfxPitch;
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawObjectAnimation(void *objScr, void *ent, int XPos, int YPos)
Expand Down Expand Up @@ -2475,6 +2567,7 @@ void DrawFace(void *v, uint colour)
if (verts[0].y == verts[1].y && verts[1].y == verts[2].y && verts[2].y == verts[3].y)
return;

#if RETRO_RENDERTYPE == RETRO_SW_RENDER
int vertexA = 0;
int vertexB = 1;
int vertexC = 2;
Expand Down Expand Up @@ -2580,6 +2673,11 @@ void DrawFace(void *v, uint colour)
++faceTop;
}
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}
void DrawTexturedFace(void *v, byte sheetID)
{
Expand All @@ -2598,6 +2696,7 @@ void DrawTexturedFace(void *v, byte sheetID)
if (verts[0].y == verts[1].y && verts[1].y == verts[2].y && verts[2].y == verts[3].y)
return;

#if RETRO_RENDERTYPE == RETRO_SW_RENDER
int vertexA = 0;
int vertexB = 1;
int vertexC = 2;
Expand Down Expand Up @@ -2703,6 +2802,11 @@ void DrawTexturedFace(void *v, byte sheetID)
}
++faceTop;
}
#endif

#if RETRO_RENDERTYPE == RETRO_HW_RENDER
// TODO: this
#endif
}

void DrawBitmapText(void *menu, int XPos, int YPos, int scale, int spacing, int rowStart, int rowCount)
Expand Down
9 changes: 7 additions & 2 deletions SonicCDDecomp/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ void CheckKeyDown(InputData *input, byte flags)
input->C = inputDevice[6].hold;
if (flags & 0x80)
input->start = inputDevice[7].hold;
//if (flags & 0x80)
// anyHold = inputDevice[8].hold;
}

void QueueHapticEffect(int hapticID)
{
if (Engine.hapticsEnabled) {
//Haptic ID seems to be the ID for "Universal Haptic Layer"'s haptic effect library
}
}
2 changes: 2 additions & 0 deletions SonicCDDecomp/Input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ void ProcessInput();
void CheckKeyPress(InputData *input, byte Flags);
void CheckKeyDown(InputData *input, byte Flags);

void QueueHapticEffect(int hapticID);

#endif // !INPUT_H
Loading

0 comments on commit fe9edb2

Please sign in to comment.