Skip to content

Commit

Permalink
fix _3ds_prepTile
Browse files Browse the repository at this point in the history
  • Loading branch information
SaturnSH2x2 committed Feb 7, 2021
1 parent 7d0d4f2 commit 9a45b97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 4 additions & 2 deletions SonicCDDecomp/3ds/render_3ds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,17 @@ void _3ds_prepTile(int XPos, int YPos, int tileX, int tileY, int direction) {
tileX = tileX + (16 * (tileX / 512));
tileY = tileY % 512;

tile.subtex.width = tileSize;
tile.subtex.height = tileSize;
tile.subtex.width = 512;
tile.subtex.height = 512;
tile.subtex.left = (float) tileX / _3ds_tilesetData[0].width;
tile.subtex.top = 1 - (float) tileY / _3ds_tilesetData[0].height;
tile.subtex.right = (float) (tileX + tileSize) / _3ds_tilesetData[0].width;
tile.subtex.bottom = 1 - (float) (tileY + tileSize) / _3ds_tilesetData[0].height;

tile.params.pos.x = XPos;
tile.params.pos.y = YPos;
tile.params.pos.w = 16;
tile.params.pos.h = 16;
tile.params.center.x = 0;
tile.params.center.y = 0;

Expand Down
9 changes: 4 additions & 5 deletions SonicCDDecomp/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ void RenderRenderDevice()

// old code to test that textures were loading properly

/*
Tex3DS_SubTexture subtex = {
.width = 512,
.height = 512,
Expand All @@ -298,17 +299,15 @@ void RenderRenderDevice()
img.subtex = &subtex;
C2D_DrawImageAt(img, 0, 5, 0);

/*
*/
for (int i = 0; i < tileIndex; i++) {
C2D_Sprite tile;
tile.image.tex = &_3ds_textureData[0];
tile.image.tex = &_3ds_tilesetData[paletteIndex];
tile.image.subtex = &_3ds_tiles[i].subtex;
tile.params = _3ds_tiles[i].params;

C2D_DrawSprite(&tile);
}
*/

for (int i = 0; i < spriteIndex; i++) {
C2D_Sprite spr;
Expand Down Expand Up @@ -831,7 +830,7 @@ void DrawHLineScrollLayer(int layerID)
default: break;
}
#elif RETRO_USING_C2D
_3ds_prepTile(0, 0, tilePxXPos, tileOffsetY, tiles128x128.direction[chunk]);
_3ds_prepTile(0, 0, 0, 0, tiles128x128.direction[chunk]);
#endif
}
else {
Expand Down

0 comments on commit 9a45b97

Please sign in to comment.