Skip to content

Commit

Permalink
fix a few warnings
Browse files Browse the repository at this point in the history
RSDuck committed Nov 18, 2020
1 parent c8ee157 commit fff040e
Showing 7 changed files with 14 additions and 15 deletions.
3 changes: 2 additions & 1 deletion source/blocks/Block.c
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ void Block_Deinit() { C3D_TexDelete(&textureMap.texture); }
void* Block_GetTextureMap() { return &textureMap.texture; }

void Block_GetTexture(Block block, Direction direction, uint8_t metadata, int16_t* out_uv) {
Texture_MapIcon i;
Texture_MapIcon i = {0, 0, 0};
switch (block) {
case Block_Air:
return;
@@ -109,6 +109,7 @@ void Block_GetTexture(Block block, Direction direction, uint8_t metadata, int16_
case Block_Bedrock:
i = icon.bedrock;
break;
default: break;
}
out_uv[0] = i.u;
out_uv[1] = i.v;
4 changes: 2 additions & 2 deletions source/gui/WorldSelect.c
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ void WorldSelect_ScanWorlds() {

DIR* directory = opendir("sdmc:/craftus/saves");

char buffer[256];
char buffer[512];

struct dirent* entry;

@@ -270,7 +270,7 @@ bool WorldSelect_Update(char* out_worldpath, char* out_name, WorldGenType* world
}
if (confirmed_deletion) {
confirmed_deletion = false;
char buffer[256];
char buffer[512];
sprintf(buffer, "sdmc:/craftus/saves/%s", worlds.data[selectedWorld].path);
delete_folder(buffer);

12 changes: 6 additions & 6 deletions source/misc/Collision.c
Original file line number Diff line number Diff line change
@@ -12,12 +12,12 @@ bool Collision_BoxIntersect(Box a, Box b, int ignore_faces,
{
// the normal of each face.
static const float3 faces[6] = {
{-1, 0, 0}, // 'left' face normal (-x direction)
{1, 0, 0}, // 'right' face normal (+x direction)
{0, -1, 0}, // 'bottom' face normal (-y direction)
{0, 1, 0}, // 'top' face normal (+y direction)
{0, 0, -1}, // 'far' face normal (-z direction)
{0, 0, 1}, // 'near' face normal (+z direction)
{{-1, 0, 0}}, // 'left' face normal (-x direction)
{{1, 0, 0}}, // 'right' face normal (+x direction)
{{0, -1, 0}}, // 'bottom' face normal (-y direction)
{{0, 1, 0}}, // 'top' face normal (+y direction)
{{0, 0, -1}}, // 'far' face normal (-z direction)
{{0, 0, 1}}, // 'near' face normal (+z direction)
};

// distance of collided box to the face.
2 changes: 0 additions & 2 deletions source/rendering/Clouds.c
Original file line number Diff line number Diff line change
@@ -19,8 +19,6 @@ static WorldVertex vertices[] = {{{-1, 0, -1}, {0, 0}, {255, 255, 255}, {0, 0, 0
static C3D_Tex texture;
static WorldVertex* cloudVBO;

static int wrap = 0;

#define TEXTURE_SIZE 64

void Clouds_Init() {
4 changes: 2 additions & 2 deletions source/rendering/Hand.c
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ void Hand_Draw(int projUniform, C3D_Mtx* projection, ItemStack stack, Player* pl

if (i == Direction_East ||
i == Direction_West) { // eines der dümmsten Dinge, die ich jemals in meinem Leben getan habe
const uvRotationTable[2][2][2][2] = {
const int16_t uvRotationTable[2][2][2][2] = {
{{{0, 1}, {0, 0}}, {{1, 1}, {1, 0}}}, {{{1, 0}, {1, 1}}, {{0, 0}, {0, 1}}},
};
for (int j = 0; j < 6; j++) {
@@ -82,7 +82,7 @@ void Hand_Draw(int projUniform, C3D_Mtx* projection, ItemStack stack, Player* pl
for (int j = 0; j < 6; j++) {
int idx = i * 6 + j;
#define toTexCoord(x, tw) (int16_t)(((float)(x) / (float)(tw)) * (float)(1 << 15))
const uvLookUp[6][4] = {
const int16_t uvLookUp[6][4] = {
{toTexCoord(48, 64), toTexCoord(52, 64), toTexCoord(20, 64), toTexCoord(32, 64)}, // west = inside
{toTexCoord(40, 64), toTexCoord(44, 64), toTexCoord(20, 64), toTexCoord(32, 64)}, // east = outside
{toTexCoord(52, 64), toTexCoord(56, 64), toTexCoord(20, 64), toTexCoord(32, 64)}, // bottom = back
2 changes: 1 addition & 1 deletion source/rendering/TextureMap.c
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ void Texture_MapInit(Texture_Map* map, const char** files, int num_files) {
for (int i = 0; i < maxSize; i++) buffer[i] = 0x000000FF;

int filei = 0;
char* filename = files[filei];
const char* filename = files[filei];
int c = 0;
while (filename != NULL && c < (TEXTURE_MAPTILES * TEXTURE_MAPTILES) && filei < num_files) {
uint32_t *image, w, h;
2 changes: 1 addition & 1 deletion source/world/ChunkWorker.c
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ void ChunkWorker_Init(ChunkWorker* chunkworker) {

for (int i = 0; i < WorkerItemTypes_Count; i++) vec_init(&chunkworker->handler[i]);

int prio;
s32 prio;
bool isNew3ds = false;
APT_CheckNew3DS(&isNew3ds);
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);

0 comments on commit fff040e

Please sign in to comment.