diff options
author | Gentoo <installgentoo@endianness.com> | 2022-07-22 23:18:14 +1000 |
---|---|---|
committer | Gentoo <installgentoo@endianness.com> | 2022-07-22 23:18:14 +1000 |
commit | 51d1734677dcb540900bfffa2536215acf246f2d (patch) | |
tree | d5d571278c5ad132103b1cbf9bcc2124832b27d5 | |
parent | e17444df6b97a65b134c93229ca49df623935ff3 (diff) | |
download | gl-tron-51d1734677dcb540900bfffa2536215acf246f2d.tar.gz gl-tron-51d1734677dcb540900bfffa2536215acf246f2d.tar.bz2 gl-tron-51d1734677dcb540900bfffa2536215acf246f2d.zip |
fixed some warnings
-rw-r--r-- | nebu/filesystem/filesystem.c | 2 | ||||
-rw-r--r-- | nebu/include/filesystem/nebu_filesystem.h | 2 | ||||
-rw-r--r-- | nebu/video/png_texture.c | 12 | ||||
-rw-r--r-- | src/game/init.c | 14 | ||||
-rw-r--r-- | src/include/configuration/configuration.h | 2 | ||||
-rw-r--r-- | src/include/game/init.h | 4 | ||||
-rw-r--r-- | src/input/input.c | 2 | ||||
-rw-r--r-- | src/video/trail.c | 24 |
8 files changed, 31 insertions, 31 deletions
diff --git a/nebu/filesystem/filesystem.c b/nebu/filesystem/filesystem.c index 4576087..36299dc 100644 --- a/nebu/filesystem/filesystem.c +++ b/nebu/filesystem/filesystem.c @@ -2,7 +2,7 @@ #include <stdio.h> -void initFilesystem(int argc, const char *argv[]) { +void initFilesystem(int argc, char *argv[]) { dirSetup(argv[0]); } diff --git a/nebu/include/filesystem/nebu_filesystem.h b/nebu/include/filesystem/nebu_filesystem.h index 14759f5..cd6375a 100644 --- a/nebu/include/filesystem/nebu_filesystem.h +++ b/nebu/include/filesystem/nebu_filesystem.h @@ -7,7 +7,7 @@ #include <stdio.h> #include <stdlib.h> -extern void initFilesystem(int argc, const char *argv[]); +extern void initFilesystem(int argc, char *argv[]); extern List* readDirectoryContents(const char *dirname, const char *prefix); diff --git a/nebu/video/png_texture.c b/nebu/video/png_texture.c index 0721523..6576307 100644 --- a/nebu/video/png_texture.c +++ b/nebu/video/png_texture.c @@ -28,7 +28,7 @@ png_texture* load_png_texture(char *filename) { png_structp png_ptr; png_infop info_ptr; png_byte **row_pointers; - + f = fopen(filename, "rb"); if(f == NULL) { fprintf(stderr, ERR_PREFIX "can't open file %s\n", filename); @@ -72,11 +72,11 @@ png_texture* load_png_texture(char *filename) { fclose(f); return NULL; } - + switch(color_type) { case PNG_COLOR_TYPE_RGB: zsize = 3; break; case PNG_COLOR_TYPE_RGB_ALPHA: zsize = 4; break; - default: + default: fprintf(stderr, "unknown png color type\n"); return NULL; } @@ -86,11 +86,11 @@ png_texture* load_png_texture(char *filename) { tex->width = x; tex->height = y; tex->channels = zsize; - + /* get pointers */ row_pointers = (png_byte**) malloc(y * sizeof(png_byte*)); for(i = 0; i < y; i++) - row_pointers[i] = tex->data + (y - i - 1) + row_pointers[i] = tex->data + (y - i - 1) * zsize * x; png_read_image(png_ptr, row_pointers); @@ -122,7 +122,7 @@ png_texture* mipmap_png_texture(png_texture *source, int level, mip->channels = source->channels; fx = (source->width > 1) ? 2 : 1; fy = (source->height > 1) ? 2 : 1; - + mip->width = source->width / fx; mip->height = source->height / fy; mip->data = (unsigned char*) malloc(mip->width * mip->height * diff --git a/src/game/init.c b/src/game/init.c index 2598ad1..e785cb0 100644 --- a/src/game/init.c +++ b/src/game/init.c @@ -4,7 +4,7 @@ #include "base/util.h" #include "scripting/scripting.h" -void initSubsystems(int argc, const char *argv[]) { +void initSubsystems(int argc, char *argv[]) { initFilesystem(argc, argv); initScripting(); init_c_interface(); @@ -23,12 +23,12 @@ void initScripting(void) { runScript(PATH_SCRIPTS, "joystick.lua"); } -void initConfiguration(int argc, const char *argv[]) +void initConfiguration(int argc, char *argv[]) { /* load some more defaults from config file */ runScript(PATH_SCRIPTS, "config.lua"); runScript(PATH_SCRIPTS, "artpack.lua"); - + /* go for .gltronrc (or whatever is defined in RC_NAME) */ { char *path; @@ -47,7 +47,7 @@ void initConfiguration(int argc, const char *argv[]) exit(1); // something is seriously wrong } } - + if(!isSetting("version") || getSettingf("version") < 0.70f) { /* load some more defaults from config file */ runScript(PATH_SCRIPTS, "config.lua"); @@ -61,7 +61,7 @@ void initConfiguration(int argc, const char *argv[]) runScript(PATH_SCRIPTS, "artpack.lua"); printf("[warning] defunct config file found, overriding using defaults\n"); } - + setSettingf("version", 0.70f); /* parse any comandline switches overrinding the loaded settings */ @@ -69,7 +69,7 @@ void initConfiguration(int argc, const char *argv[]) /* sanity check some settings */ checkSettings(); - + /* intialize the settings cache, remember to do that everytime you change something */ updateSettingsCache(); @@ -95,7 +95,7 @@ void initAudio(void) { Sound_initTracks(); Sound_setup(); } - + void initGame(void) { /* initialize the rest of the game's datastructures */ initGameStructures(); diff --git a/src/include/configuration/configuration.h b/src/include/configuration/configuration.h index 58045a0..ced5ccc 100644 --- a/src/include/configuration/configuration.h +++ b/src/include/configuration/configuration.h @@ -1,7 +1,7 @@ #ifndef CONFIGURATION_H #define CONFIGURATION_H -extern void parse_args(int argc, const char *argv[]); +extern void parse_args(int argc, char *argv[]); extern void updateSettingsCache(void); extern void initColors(void); extern void checkSettings(void); diff --git a/src/include/game/init.h b/src/include/game/init.h index 33b17ed..9a8eabe 100644 --- a/src/include/game/init.h +++ b/src/include/game/init.h @@ -1,9 +1,9 @@ #ifndef INIT_H #define INIT_H -extern void initSubsystems(int argc, const char *argv[]); +extern void initSubsystems(int argc, char *argv[]); extern void initScripting(void); -extern void initConfiguration(int argc, const char *argv[]); +extern void initConfiguration(int argc, char *argv[]); extern void initVideo(void); extern void initAudio(void); extern void initInput(void); diff --git a/src/input/input.c b/src/input/input.c index 39acfa2..905fdc0 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -120,7 +120,7 @@ void keyGame(int state, int k, int x, int y) } } -void parse_args(int argc, const char *argv[]) { +void parse_args(int argc, char *argv[]) { int i; while(argc--) { if(argv[argc][0] == '-') { diff --git a/src/video/trail.c b/src/video/trail.c index f1b276d..5805e16 100644 --- a/src/video/trail.c +++ b/src/video/trail.c @@ -7,7 +7,7 @@ static float normal1[] = { 1.0, 0.0, 0.0 }; static float normal2[] = { 0.0, 1.0, 0.0 }; -/* +/* getDists returns the minimum distance from (the wall) *line to the specified (eye) point the z component is ignored @@ -19,7 +19,7 @@ float getDist(segment2 *s, float* eye) { n[1] = s->vStart.v[1] - s->vDirection.v[0]; tmp[0] = eye[0] - s->vStart.v[0]; tmp[1] = eye[1] - s->vStart.v[1]; - if(n[0] == n[1] == 0) return length(tmp); + if(n[0] == 0 && n[1] == 0) return length(tmp); return abs(scalarprod2(n, tmp) / length(n)); } @@ -33,13 +33,13 @@ float dists[] = { BOW_DIST2, BOW_DIST3, BOW_DIST1, 0 }; float getSegmentEndX(Data *data, int dist) { float tlength, blength; segment2 *s = data->trails + data->trailOffset; - - if(dirsX[data->dir] == 0) + + if(dirsX[data->dir] == 0) return s->vStart.v[0] + s->vDirection.v[0]; tlength = segment2_Length(s); blength = (tlength < 2 * BOW_LENGTH) ? tlength / 2 : BOW_LENGTH; - return + return s->vStart.v[0] + s->vDirection.v[0] - dists[dist] * blength * dirsX[ data->dir ]; } @@ -53,7 +53,7 @@ float getSegmentEndY(Data *data, int dist) { tlength = segment2_Length(s); blength = (tlength < 2 * BOW_LENGTH) ? tlength / 2 : BOW_LENGTH; - return + return s->vStart.v[1] + s->vDirection.v[1] - dists[dist] * blength * dirsY[ data->dir ]; } @@ -71,7 +71,7 @@ float getSegmentUV(segment2 *s) { return segment2_Length(s) / DECAL_WIDTH; } -/* +/* drawTrailLines() draws a white line on top of each trail segment the alpha value is reduced with increasing distance to the player */ @@ -110,14 +110,14 @@ void drawTrailLines(Player *p, PlayerVisual *pV) { glBegin(GL_LINES); s = data->trails; - while(s != data->trails + data->trailOffset) { + while(s != data->trails + data->trailOffset) { /* the current line is not drawn */ /* compute distance from line to eye point */ dist = getDist(s, cam->cam); alpha = (game2->rules.grid_size - dist / 2) / game2->rules.grid_size; // trail_top[3] = alpha; glColor4fv(trail_top); - + if(s->vDirection.v[1] == 0) normal = normal1; else normal = normal2; glNormal3fv(normal); @@ -152,14 +152,14 @@ void drawTrailLines(Player *p, PlayerVisual *pV) { /* glEnable(GL_LIGHTING); */ glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); /* disable line antialiasing */ - + /* glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); */ } -/* +/* drawTrailShadow() draws a alpha-blended shadow on the floor for each trail segment. The light source source is (in homogenous coordinates) @@ -198,7 +198,7 @@ void drawTrailShadow(Player* p, PlayerVisual *pV) { mesh.pTexCoords = (vec2*) malloc(1000 * sizeof(vec2)); mesh.pIndices = (unsigned short*) malloc(1000 * 2); mesh.iUsed = 0; - + trailGeometry(p, pV, &mesh, &vOffset, &iOffset); bowGeometry(p, pV, &mesh, &vOffset, &iOffset); trailStatesShadowed(); |