Various warning fixes with the command-line switches

This commit is contained in:
Colton Rushton 2021-02-14 15:48:38 -04:00
parent bd50f83568
commit 7b633a250e
8 changed files with 41 additions and 15 deletions

View File

@ -477,7 +477,7 @@ SDLCONFIG := $(CROSS)sdl2-config
BACKEND_CFLAGS := -DRAPI_$(RENDER_API)=1 -DWAPI_$(WINDOW_API)=1 -DAAPI_$(AUDIO_API)=1
# can have multiple controller APIs
BACKEND_CFLAGS += $(foreach capi,$(CONTROLLER_API),-DCAPI_$(capi)=1)
BACKEND_LDFLAG0S :=
BACKEND_LDFLAGS :=
SDL1_USED := 0
SDL2_USED := 0

View File

@ -17,7 +17,7 @@
#undef bzero
#undef bcopy
#define bzero(buf, len) memset((buf), 0, (len))
#define bcopy(src, dst, len) memcpy((dst), (src), (len))
#define bcopy(src, dst, len) memmove((dst), (src), (len))
#else

View File

@ -397,7 +397,7 @@ static void stbiw__putc(stbi__write_context *s, unsigned char c)
static void stbiw__write1(stbi__write_context *s, unsigned char a)
{
if (s->buf_used + 1 > sizeof(s->buffer))
if ((unsigned int)s->buf_used + 1 > sizeof(s->buffer))
stbiw__write_flush(s);
s->buffer[s->buf_used++] = a;
}
@ -405,7 +405,7 @@ static void stbiw__write1(stbi__write_context *s, unsigned char a)
static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c)
{
int n;
if (s->buf_used + 3 > sizeof(s->buffer))
if ((unsigned int)s->buf_used + 3 > sizeof(s->buffer))
stbiw__write_flush(s);
n = s->buf_used;
s->buf_used = n+3;

View File

@ -8,31 +8,40 @@
* These settings are animations, colour, and spawn quantity.
* Fish spawning restricted to within a set distance from Mario.
*/
#ifdef NODRAWINGDISTANCE
#include "macros.h"
#endif
void fish_act_spawn(void) {
s32 i;
s32 schoolQuantity;
s16 model;
#ifndef NODRAWINGDISTANCE
f32 minDistToMario;
#else
UNUSED f32 minDistToMario;
#endif
const struct Animation * const*fishAnimation;
struct Object *fishObject;
switch (o->oBehParams2ndByte) {
// Blue fish with a quanitiy of twenty.
// Blue fish with a quantity of twenty.
case 0:
model = MODEL_FISH; schoolQuantity = 20; minDistToMario = 1500.0f; fishAnimation = blue_fish_seg3_anims_0301C2B0;
break;
// Blue fish with a quanitiy of five.
// Blue fish with a quantity of five.
case 1:
model = MODEL_FISH; schoolQuantity = 5; minDistToMario = 1500.0f; fishAnimation = blue_fish_seg3_anims_0301C2B0;
break;
// Cyan fish with a quanitiy of twenty.
// Cyan fish with a quantity of twenty.
case 2:
model = MODEL_CYAN_FISH; schoolQuantity = 20; minDistToMario = 1500.0f; fishAnimation = cyan_fish_seg6_anims_0600E264;
break;
// Cyan fish with a quanitiy of five.
// Cyan fish with a quantity of five.
case 3:
model = MODEL_CYAN_FISH; schoolQuantity = 5; minDistToMario = 1500.0f; fishAnimation = cyan_fish_seg6_anims_0600E264;
break;

View File

@ -276,7 +276,7 @@ void render_generic_char(u8 c) {
#ifdef VERSION_EU
static void alloc_ia4_tex_from_i1(u8 *out, u8 *in, s16 width, s16 height) {
u32 size = (u32) width * (u32) height;
UNUSED u32 size = (u32) width * (u32) height;
s32 inPos;
s16 outPos = 0;
u8 bitMask;

View File

@ -31,7 +31,9 @@
#include "save_file.h"
#include "spawn_object.h"
#include "spawn_sound.h"
#ifdef NODRAWINGDISTANCE
#include "macros.h"
#endif
/**
* @file obj_behaviors.c
* This file contains a portion of the obj behaviors and many helper functions for those
@ -525,10 +527,17 @@ s32 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist)
/**
* Sets an object as visible if within a certain distance of Mario's graphical position.
*/
#ifndef NODRAWINGDISTANCE
void set_object_visibility(struct Object *obj, s32 dist) {
f32 objX = obj->oPosX;
f32 objY = obj->oPosY;
f32 objZ = obj->oPosZ;
#else
void set_object_visibility(struct Object *obj, UNUSED s32 dist) {
UNUSED f32 objX = obj->oPosX;
UNUSED f32 objY = obj->oPosY;
UNUSED f32 objZ = obj->oPosZ;
#endif
#ifndef NODRAWINGDISTANCE
if (is_point_within_radius_of_mario(objX, objY, objZ, dist) == TRUE) {

View File

@ -1,4 +1,5 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
@ -221,16 +222,22 @@ static void set_state(void) {
}
void set_logo(void) {
if (lastCourseNum)
snprintf(largeImageKey, sizeof(largeImageKey), "%d", lastCourseNum);
else
if (lastCourseNum) {
if (snprintf(largeImageKey, sizeof(largeImageKey), "%d", lastCourseNum) < 0) {
abort();
};
} else {
strcpy(largeImageKey, "0");
}
/*
if (lastActNum)
snprintf(smallImageKey, sizeof(largeImageKey), "%d", lastActNum);
else
if (snprintf(smallImageKey, sizeof(largeImageKey), "%d", lastActNum) < 0) {
abort();
};
} else {
smallImageKey[0] = '\0';
}
*/
discordRichPresence.largeImageKey = largeImageKey;

View File

@ -79,6 +79,7 @@ struct ar_header {
#define FLAGS_MIPS3 0x20
#define FLAGS_O32ABI 0x100000
int main(int argc, char **argv) {
argc = 0;
FILE *f = fopen(argv[1], "r+");
if (f == NULL) {