fix compiler warnings
This commit is contained in:
parent
8ca1ab4384
commit
0bf7d419e0
4
Makefile
4
Makefile
|
@ -66,13 +66,13 @@ includeflag != find source -type d -name include
|
||||||
includeflag += $(engincs) source/engine/thirdparty/Nuklear
|
includeflag += $(engincs) source/engine/thirdparty/Nuklear
|
||||||
includeflag := $(addprefix -I, $(includeflag))
|
includeflag := $(addprefix -I, $(includeflag))
|
||||||
|
|
||||||
WARNING_FLAGS = -Wall# -pedantic -Wextra -Wwrite-strings -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types -Wno-unused-function
|
WARNING_FLAGS = -Wall -Wno-unused-function# -pedantic -Wextra -Wwrite-strings -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types -Wno-unused-function
|
||||||
|
|
||||||
SEM = 0.0.1
|
SEM = 0.0.1
|
||||||
COM != git rev-parse --short HEAD
|
COM != git rev-parse --short HEAD
|
||||||
VER = $(SEM)-$(COM)
|
VER = $(SEM)-$(COM)
|
||||||
|
|
||||||
COMPILER_FLAGS = $(includeflag) $(QFLAGS) -MD $(WARNING_FLAGS) -DCP_USE_DOUBLES=0 -DTINYSPLINE_FLOAT_PRECISION -DVER=\"$(VER)\" -DINFO=\"$(INFO)\" -march=native -std=c99 -c $< -o $@
|
COMPILER_FLAGS = $(includeflag) $(QFLAGS) -MD $(WARNING_FLAGS) -I. -DCP_USE_DOUBLES=0 -DTINYSPLINE_FLOAT_PRECISION -DVER=\"$(VER)\" -DINFO=\"$(INFO)\" -march=native -std=c99 -c $< -o $@
|
||||||
|
|
||||||
LIBPATH = -L$(BIN)
|
LIBPATH = -L$(BIN)
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,13 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#include "debugdraw.h"
|
#include "debugdraw.h"
|
||||||
#include "gameobject.h"
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <chipmunk/chipmunk_unsafe.h>
|
#include <chipmunk/chipmunk_unsafe.h>
|
||||||
#include "stb_ds.h"
|
#include "stb_ds.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "2dphysics.h"
|
||||||
|
|
||||||
#include "tinyspline.h"
|
#include "tinyspline.h"
|
||||||
|
|
||||||
#include "script.h"
|
#include "script.h"
|
||||||
|
@ -459,7 +460,6 @@ void phys2d_applypoly(struct phys2d_poly *poly)
|
||||||
void phys2d_dbgdrawpoly(struct phys2d_poly *poly)
|
void phys2d_dbgdrawpoly(struct phys2d_poly *poly)
|
||||||
{
|
{
|
||||||
float *color = shape_color(poly->shape.shape);
|
float *color = shape_color(poly->shape.shape);
|
||||||
int n = arrlen(poly->points);
|
|
||||||
|
|
||||||
if (arrlen(poly->points) >= 3) {
|
if (arrlen(poly->points) >= 3) {
|
||||||
int n = cpPolyShapeGetCount(poly->shape.shape);
|
int n = cpPolyShapeGetCount(poly->shape.shape);
|
||||||
|
@ -686,7 +686,6 @@ static cpBool handle_collision(cpArbiter *arb, int type)
|
||||||
struct phys2d_shape *pshape2 = cpShapeGetUserData(shape2);
|
struct phys2d_shape *pshape2 = cpShapeGetUserData(shape2);
|
||||||
|
|
||||||
cpVect norm1 = cpArbiterGetNormal(arb);
|
cpVect norm1 = cpArbiterGetNormal(arb);
|
||||||
cpVect vel1 = cpArbiterGetSurfaceVelocity(arb);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CTYPE_BEGIN:
|
case CTYPE_BEGIN:
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "script.h"
|
||||||
|
|
||||||
int logLevel = 1;
|
int logLevel = 1;
|
||||||
|
|
||||||
/* Four levels of log:
|
/* Four levels of log:
|
||||||
|
@ -25,8 +27,8 @@ FILE *logfile = NULL;
|
||||||
|
|
||||||
#define CONSOLE_BUF 1024*1024*5/* 5MB */
|
#define CONSOLE_BUF 1024*1024*5/* 5MB */
|
||||||
|
|
||||||
char lastlog[ERROR_BUFFER] = {'\0'};
|
char lastlog[ERROR_BUFFER+1] = {'\0'};
|
||||||
char consolelog[CONSOLE_BUF] = {'\0'};
|
char consolelog[CONSOLE_BUF+1] = {'\0'};
|
||||||
|
|
||||||
void mYughLog(int category, int priority, int line, const char *file, const char *message, ...)
|
void mYughLog(int category, int priority, int line, const char *file, const char *message, ...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,7 +162,6 @@ struct sFont *MakeFont(const char *fontfile, int height)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int curchar = 0;
|
static int curchar = 0;
|
||||||
static float *buffdraw;
|
|
||||||
|
|
||||||
void draw_char_box(struct Character c, float cursor[2], float scale, float color[3])
|
void draw_char_box(struct Character c, float cursor[2], float scale, float color[3])
|
||||||
{
|
{
|
||||||
|
@ -281,7 +280,6 @@ int renderText(const char *text, mfloat_t pos[2], float scale, mfloat_t color[3]
|
||||||
curchar = 0;
|
curchar = 0;
|
||||||
|
|
||||||
float *usecolor = color;
|
float *usecolor = color;
|
||||||
float caretcolor[3] = {0.4,0.98,0.75};
|
|
||||||
|
|
||||||
while (*line != '\0') {
|
while (*line != '\0') {
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ int body2id(cpBody *body)
|
||||||
|
|
||||||
cpBody *id2body(int id)
|
cpBody *id2body(int id)
|
||||||
{
|
{
|
||||||
struct gameobject *go;
|
struct gameobject *go = id2go(id);
|
||||||
|
|
||||||
if (go = id2go(id))
|
if (go)
|
||||||
return go->body;
|
return go->body;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -88,7 +88,7 @@ void gameobject_set_sensor(int id, int sensor)
|
||||||
|
|
||||||
int go2id(struct gameobject *go)
|
int go2id(struct gameobject *go)
|
||||||
{
|
{
|
||||||
id_from_gameobject(go);
|
return id_from_gameobject(go);
|
||||||
}
|
}
|
||||||
|
|
||||||
void go_shape_apply(cpBody *body, cpShape *shape, struct gameobject *go)
|
void go_shape_apply(cpBody *body, cpShape *shape, struct gameobject *go)
|
||||||
|
|
|
@ -47,6 +47,8 @@ const char *gamepad2str(int btn)
|
||||||
case GLFW_GAMEPAD_BUTTON_LEFT_THUMB: return "lthumb";
|
case GLFW_GAMEPAD_BUTTON_LEFT_THUMB: return "lthumb";
|
||||||
case GLFW_GAMEPAD_BUTTON_RIGHT_THUMB: return "rthumb";
|
case GLFW_GAMEPAD_BUTTON_RIGHT_THUMB: return "rthumb";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "NOBTN";
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_pawn(struct callee c)
|
void register_pawn(struct callee c)
|
||||||
|
@ -196,7 +198,7 @@ void input_init()
|
||||||
glfwSetJoystickCallback(joystick_cb);
|
glfwSetJoystickCallback(joystick_cb);
|
||||||
nukechar = glfwSetCharCallback(mainwin->window, char_cb);
|
nukechar = glfwSetCharCallback(mainwin->window, char_cb);
|
||||||
|
|
||||||
const char *paddb = slurp_text("data/gamecontrollerdb.txt");
|
char *paddb = slurp_text("data/gamecontrollerdb.txt");
|
||||||
glfwUpdateGamepadMappings(paddb);
|
glfwUpdateGamepadMappings(paddb);
|
||||||
free(paddb);
|
free(paddb);
|
||||||
|
|
||||||
|
@ -229,8 +231,9 @@ void call_input_signal(char *signal) {
|
||||||
JS_FreeValue(js, s);
|
JS_FreeValue(js, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *keyname_extd(int key, int scancode) {
|
|
||||||
char keybuf[50];
|
char keybuf[50];
|
||||||
|
|
||||||
|
const char *keyname_extd(int key, int scancode) {
|
||||||
const char *kkey = NULL;
|
const char *kkey = NULL;
|
||||||
|
|
||||||
if (key > 289 && key < 302) {
|
if (key > 289 && key < 302) {
|
||||||
|
@ -372,6 +375,8 @@ const char *axis2str(int axis)
|
||||||
case GLFW_GAMEPAD_AXIS_LEFT_TRIGGER: return "ltrigger";
|
case GLFW_GAMEPAD_AXIS_LEFT_TRIGGER: return "ltrigger";
|
||||||
case GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER: return "rtrigger";
|
case GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER: return "rtrigger";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "NOAXIS";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is called once every frame - or more if we want it more! */
|
/* This is called once every frame - or more if we want it more! */
|
||||||
|
@ -394,7 +399,6 @@ void input_poll(double wait)
|
||||||
|
|
||||||
JSValue argv[3];
|
JSValue argv[3];
|
||||||
argv[0] = num_cache[joysticks[i].id];
|
argv[0] = num_cache[joysticks[i].id];
|
||||||
char inputstr[50];
|
|
||||||
for (int b = 0; b < 15; b++) {
|
for (int b = 0; b < 15; b++) {
|
||||||
argv[1] = jsgamepadstr[b];
|
argv[1] = jsgamepadstr[b];
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ struct sprite *tsprite = NULL;
|
||||||
|
|
||||||
|
|
||||||
static unsigned int projUBO;
|
static unsigned int projUBO;
|
||||||
static unsigned int resUBO;
|
|
||||||
|
|
||||||
void debug_draw_phys(int draw) {
|
void debug_draw_phys(int draw) {
|
||||||
debugDrawPhysics = draw;
|
debugDrawPhysics = draw;
|
||||||
|
|
|
@ -31,7 +31,7 @@ static const char *cur_ext = NULL;
|
||||||
struct dirent *c_dirent = NULL;
|
struct dirent *c_dirent = NULL;
|
||||||
struct vec *c_vec = NULL;
|
struct vec *c_vec = NULL;
|
||||||
|
|
||||||
char pathbuf[MAXPATH];
|
char pathbuf[MAXPATH+1];
|
||||||
|
|
||||||
void resources_init()
|
void resources_init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,7 +99,11 @@ int js_print_exception(JSValue v)
|
||||||
JS_FreeCString(js, msg);
|
JS_FreeCString(js, msg);
|
||||||
JS_FreeCString(js, stack);
|
JS_FreeCString(js, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int script_dofile(const char *file) {
|
int script_dofile(const char *file) {
|
||||||
|
@ -139,6 +143,7 @@ JSValue js_callee_exec(struct callee *c, int argc, JSValue *argv)
|
||||||
JSValue ret = JS_Call(js, c->fn, c->obj, argc, argv);
|
JSValue ret = JS_Call(js, c->fn, c->obj, argc, argv);
|
||||||
js_print_exception(ret);
|
js_print_exception(ret);
|
||||||
JS_FreeValue(js, ret);
|
JS_FreeValue(js, ret);
|
||||||
|
return JS_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void call_callee(struct callee *c) {
|
void call_callee(struct callee *c) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ struct callee {
|
||||||
extern struct callee stacktrace_callee;
|
extern struct callee stacktrace_callee;
|
||||||
extern JSValue num_cache[100];
|
extern JSValue num_cache[100];
|
||||||
|
|
||||||
|
void js_stacktrace();
|
||||||
void script_startup();
|
void script_startup();
|
||||||
void script_init();
|
void script_init();
|
||||||
void script_run(const char *script);
|
void script_run(const char *script);
|
||||||
|
|
|
@ -30,8 +30,6 @@ int make_sprite(int go)
|
||||||
.layer = 0,
|
.layer = 0,
|
||||||
.enabled = 1 };
|
.enabled = 1 };
|
||||||
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (first<0) {
|
if (first<0) {
|
||||||
arrput(sprites, sprite);
|
arrput(sprites, sprite);
|
||||||
arrlast(sprites).id = arrlen(sprites)-1;
|
arrlast(sprites).id = arrlen(sprites)-1;
|
||||||
|
|
|
@ -63,7 +63,6 @@ struct Texture *texture_pullfromfile(const char *path)
|
||||||
glGenTextures(1, &tex->id);
|
glGenTextures(1, &tex->id);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex->id);
|
glBindTexture(GL_TEXTURE_2D, tex->id);
|
||||||
|
|
||||||
GLenum fmt;
|
GLenum fmt;
|
||||||
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
|
@ -84,7 +83,7 @@ struct Texture *texture_pullfromfile(const char *path)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->width, tex->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->width, tex->height, 0, fmt, GL_UNSIGNED_BYTE, data);
|
||||||
|
|
||||||
if (tex->opts.mips)
|
if (tex->opts.mips)
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#include "transform.h"
|
#include "transform.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
struct mTransform MakeTransform(mfloat_t pos[3], mfloat_t rotation[4],
|
struct mTransform MakeTransform(mfloat_t pos[3], mfloat_t rotation[4], float scale)
|
||||||
float scale)
|
|
||||||
{
|
{
|
||||||
struct mTransform newT;
|
struct mTransform newT;
|
||||||
memcpy(newT.position, pos, sizeof(*pos));
|
memcpy(newT.position, pos, sizeof(*pos));
|
||||||
|
|
|
@ -47,6 +47,7 @@ void window_iconify_callback(GLFWwindow *w, int iconified)
|
||||||
void window_focus_callback(GLFWwindow *w, int focused)
|
void window_focus_callback(GLFWwindow *w, int focused)
|
||||||
{
|
{
|
||||||
struct window *win = winfind(w);
|
struct window *win = winfind(w);
|
||||||
|
win->mouseFocus = focused;
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_maximize_callback(GLFWwindow *w, int maximized)
|
void window_maximize_callback(GLFWwindow *w, int maximized)
|
||||||
|
|
Loading…
Reference in a new issue