Implement clang support

Fixing a load of issues related to autoconf and some small source-level issues to re-add clang support.
autoconf feature detection probably needs some addressing - partially as -Werror is applied late.
This commit is contained in:
Th3T3chn0G1t 2023-08-10 23:11:52 +01:00 committed by Bill Currie
parent f21e1275b9
commit 3098b5d3f7
26 changed files with 117 additions and 91 deletions

View File

@ -29,10 +29,14 @@ AC_LINK_IFELSE(
) )
AH_VERBATIM([HAVE_C99INLINE], AH_VERBATIM([HAVE_C99INLINE],
[#undef HAVE_C99INLINE [#undef HAVE_C99INLINE
#ifdef HAVE_C99INLINE #ifdef __clang__
# define GNU89INLINE # define GNU89INLINE static
#else #else
# define GNU89INLINE extern # ifdef HAVE_C99INLINE
# define GNU89INLINE
# else
# define GNU89INLINE extern
# endif
#endif]) #endif])
if test "x$GCC" = xyes; then if test "x$GCC" = xyes; then

View File

@ -48,20 +48,20 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dlfcn.h>]], [[int foo = RTLD_DEEP
]) ])
fi fi
dnl Checks for stricmp/strcasecmp #dnl Checks for stricmp/strcasecmp
#AC_CHECK_FUNC(strcasecmp, #AC_CHECK_FUNC(strcasecmp,
# , # ,
# AC_CHECK_FUNC(stricmp, # AC_CHECK_FUNC(stricmp,
# AC_DEFINE(strcasecmp, stricmp) # AC_DEFINE(strcasecmp, stricmp)
# ) # )
#) #)
AC_CHECK_FUNC(strcasecmp, strcasecmp=yes, strcasecmp=no) #AC_CHECK_FUNC(strcasecmp, strcasecmp=yes, strcasecmp=no)
if test "x$strcasecmp" = xno; then #if test "x$strcasecmp" = xno; then
AC_CHECK_FUNC(stricmp, # AC_CHECK_FUNC(stricmp,
AC_DEFINE(strcasecmp, stricmp, [Define strcasecmp as stricmp if you have one but not the other]), # AC_DEFINE(strcasecmp, stricmp, [Define strcasecmp as stricmp if you have one but not the other]),
AC_MSG_ERROR([Neither stricmp nor strcasecmp found]) # AC_MSG_ERROR([Neither stricmp nor strcasecmp found])
) # )
fi #fi
dnl Check for vsnprintf dnl Check for vsnprintf
if test "x$ac_cv_func_vsnprintf" = "xno" -a \ if test "x$ac_cv_func_vsnprintf" = "xno" -a \
@ -80,14 +80,14 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[fnmatch();]])],[BUILD_FNMATCH=no
AM_CONDITIONAL(BUILD_FNMATCH, test "x$BUILD_FNMATCH" = "xyes") AM_CONDITIONAL(BUILD_FNMATCH, test "x$BUILD_FNMATCH" = "xyes")
AC_MSG_CHECKING(for opendir) AC_MSG_CHECKING(for opendir)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[opendir();]])],[BUILD_DIRENT=no AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern void opendir(); opendir();]])],[BUILD_DIRENT=no
AC_MSG_RESULT(yes)],[BUILD_DIRENT=yes AC_MSG_RESULT(yes)],[BUILD_DIRENT=yes
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
]) ])
AM_CONDITIONAL(BUILD_DIRENT, test "x$BUILD_DIRENT" = "xyes") AM_CONDITIONAL(BUILD_DIRENT, test "x$BUILD_DIRENT" = "xyes")
AC_MSG_CHECKING(for getopt_long) AC_MSG_CHECKING(for getopt_long)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[getopt_long();]])],[BUILD_GETOPT=no AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern void getopt_long(); getopt_long();]])],[BUILD_GETOPT=no
AC_MSG_RESULT(yes)],[BUILD_GETOPT=yes AC_MSG_RESULT(yes)],[BUILD_GETOPT=yes
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
]) ])

View File

@ -27,7 +27,7 @@ AH_VERBATIM([HAVE___ATTRIBUTE__],
AC_MSG_CHECKING(for __attribute__ ((visibility))) AC_MSG_CHECKING(for __attribute__ ((visibility)))
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo (void); AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo (void);
__attribute__ ((sivibility ("default"))) void foo (void) {}]], [[]])],[AC_DEFINE(HAVE___ATTRIBUTE__VISIBILITY) __attribute__ ((visibility ("default"))) void foo (void) {}]], [[]])],[AC_DEFINE(HAVE___ATTRIBUTE__VISIBILITY)
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
]) ])
AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY], AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY],
@ -39,6 +39,20 @@ AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY],
# define VISIBLE # define VISIBLE
#endif]) #endif])
AC_MSG_CHECKING(for __attribute__ ((designated_init)))
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo (void);
struct x { char y; } __attribute__ ((designated_init));]], [[]])],[AC_DEFINE(HAVE___ATTRIBUTE__DESIGNATED_INIT)
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
])
AH_VERBATIM([HAVE___ATTRIBUTE__DESIGNATED_INIT],
[/* Define this if the GCC designated_init __attribute__ is available */
#undef HAVE___ATTRIBUTE__DESIGNATED_INIT
#ifdef HAVE___ATTRIBUTE__DESIGNATED_INIT
# define DESIGNATED_INIT __attribute__((designated_init))
#else
# define DESIGNATED_INIT
#endif])
if test "x$SYSTYPE" = "xWIN32"; then if test "x$SYSTYPE" = "xWIN32"; then
AC_MSG_CHECKING(for __attribute__ ((gcc_struct))) AC_MSG_CHECKING(for __attribute__ ((gcc_struct)))
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef struct { int foo; } AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef struct { int foo; }

View File

@ -54,7 +54,7 @@ case "$host_os" in
;; ;;
*) *)
dnl Checks for working -lm dnl Checks for working -lm
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken])) AC_CHECK_LIB(m, lgammaf,, AC_MSG_ERROR([math library (-lm) appears broken]))
;; ;;
esac esac

View File

@ -6,10 +6,10 @@
#endif #endif
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#ifndef __QFCC__
#include "QF/cexpr.h" #include "QF/cexpr.h"
#include "QF/simd/types.h" #include "QF/simd/types.h"
#ifndef __QFCC__
#include "QF/darray.h" #include "QF/darray.h"
#include "QF/Vulkan/command.h" #include "QF/Vulkan/command.h"
#endif #endif
@ -142,8 +142,13 @@ typedef struct qfv_attachmentinfo_s {
} qfv_attachmentinfo_t; } qfv_attachmentinfo_t;
typedef struct qfv_taskinfo_s { typedef struct qfv_taskinfo_s {
#ifndef __QFCC__
exprfunc_t *func; exprfunc_t *func;
const exprval_t **params; const exprval_t **params;
#else
void *func;
const void **params;
#endif
void *param_data; void *param_data;
} qfv_taskinfo_t; } qfv_taskinfo_t;

View File

@ -27,6 +27,10 @@
#ifndef __QF_expr_h #ifndef __QF_expr_h
#define __QF_expr_h #define __QF_expr_h
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h> #include <stdlib.h>
struct exprval_s; struct exprval_s;
@ -57,7 +61,7 @@ typedef struct exprtype_s {
binop_t *binops; binop_t *binops;
unop_t *unops; unop_t *unops;
void *data; void *data;
} __attribute__((designated_init)) exprtype_t; } DESIGNATED_INIT exprtype_t;
typedef struct exprval_s { typedef struct exprval_s {
exprtype_t *type; exprtype_t *type;

View File

@ -52,20 +52,23 @@
typedef uint8_t byte; typedef uint8_t byte;
#endif #endif
#if __STDC_VERSION__ < 202000 #if __STDC_VERSION__ < 202000 || defined(__clang__)
#define auto __auto_type # define auto __auto_type
#ifndef _DEF_BOOL_
# define _DEF_BOOL_
// KJB Undefined true and false defined in SciTech's DEBUG.H header
# ifdef __cplusplus
# define __bool_true_false_are_defined
# endif
# ifndef __bool_true_false_are_defined
# undef true
# undef false
typedef enum {false, true} bool;
# endif
#endif #endif
#if __STDC_VERSION__ < 202000
# ifndef _DEF_BOOL_
# define _DEF_BOOL_
// KJB Undefined true and false defined in SciTech's DEBUG.H header
# ifdef __cplusplus
# define __bool_true_false_are_defined
# endif
# ifndef __bool_true_false_are_defined
# undef true
# undef false
typedef enum {false, true} bool;
# endif
# endif
#endif #endif
// From mathlib... // From mathlib...

View File

@ -4,7 +4,6 @@ EXTRA_PROGRAMS += libs/audio/test/testsound
testaudio_libs= \ testaudio_libs= \
libs/audio/libQFsound.la \ libs/audio/libQFsound.la \
libs/scene/libQFscene.la \
libs/ruamoko/libQFruamoko.la \ libs/ruamoko/libQFruamoko.la \
libs/util/libQFutil.la libs/util/libQFutil.la

View File

@ -126,7 +126,6 @@ CL_NewDlight (entity_t ent, vec4f_t org, int effects, byte glow_size,
if (effects & EF_DIMLIGHT) if (effects & EF_DIMLIGHT)
if (effects & ~EF_DIMLIGHT) if (effects & ~EF_DIMLIGHT)
radius -= 100; radius -= 100;
radius = radius;
switch (effects & (EF_RED | EF_BLUE)) { switch (effects & (EF_RED | EF_BLUE)) {
case EF_RED | EF_BLUE: color = purple; break; case EF_RED | EF_BLUE: color = purple; break;

View File

@ -571,14 +571,14 @@ draw_input_line (inputline_t *il, draw_charbuffer_t *buffer)
char *src = il->lines[il->edit_line] + il->scroll + 1; char *src = il->lines[il->edit_line] + il->scroll + 1;
size_t i; size_t i;
*dst++ = il->scroll ? '<' | 0x80 : il->lines[il->edit_line][0]; *dst++ = il->scroll ? '<' | 0x80U : il->lines[il->edit_line][0];
for (i = 0; i < il->width - 2 && *src; i++) { for (i = 0; i < il->width - 2 && *src; i++) {
*dst++ = *src++; *dst++ = *src++;
} }
while (i++ < il->width - 2) { while (i++ < il->width - 2) {
*dst++ = ' '; *dst++ = ' ';
} }
*dst++ = *src ? '>' | 0x80 : ' '; *dst++ = *src ? '>' | 0x80U : ' ';
} }
static void static void

View File

@ -141,13 +141,12 @@ static int
test_3 (void) test_3 (void)
{ {
int ret = 1; int ret = 1;
static char text[] = R"(01 don't forget this line static char text[] = "01 don't forget this line\n\
02 and some more lines here 02 and some more lines here\n\
03 adsf 03 adsf\n\
04 adfa 04 adfa\n\
06 hi there 06 hi there\n\
06 don't forget there's line 07 06 don't forget there's line 07\n";
)";
static uint32_t lengths[] = { 26, 28, 9, 8, 12, 32, 0 }; static uint32_t lengths[] = { 26, 28, 9, 8, 12, 32, 0 };
static uint32_t lengths2[] = { 1, 5, 2 }; static uint32_t lengths2[] = { 1, 5, 2 };

View File

@ -1781,7 +1781,7 @@ op_call:
old_val.value = pr->watch->value; old_val.value = pr->watch->value;
} }
} }
exit_program: exit_program:;
} }
#define MM(type) (*((pr_##type##_t *) (mm))) #define MM(type) (*((pr_##type##_t *) (mm)))
@ -1793,6 +1793,7 @@ pr_address_mode (progs_t *pr, const dstatement_t *st, int mm_ind)
pr_type_t *op_a = pr->pr_globals + st->a + PR_BASE (pr, st, A); pr_type_t *op_a = pr->pr_globals + st->a + PR_BASE (pr, st, A);
pr_type_t *op_b = pr->pr_globals + st->b + PR_BASE (pr, st, B); pr_type_t *op_b = pr->pr_globals + st->b + PR_BASE (pr, st, B);
pr_ptr_t mm_offs = 0; pr_ptr_t mm_offs = 0;
pr_ptr_t edict_area = 0;
switch (mm_ind) { switch (mm_ind) {
case 0: case 0:
@ -1801,7 +1802,7 @@ pr_address_mode (progs_t *pr, const dstatement_t *st, int mm_ind)
break; break;
case 1: case 1:
// entity.field (equivalent to OP_LOAD_t_v6p) // entity.field (equivalent to OP_LOAD_t_v6p)
pr_ptr_t edict_area = pr->pr_edict_area - pr->pr_globals; edict_area = pr->pr_edict_area - pr->pr_globals;
mm_offs = edict_area + OPA(entity) + OPB(field); mm_offs = edict_area + OPA(entity) + OPB(field);
break; break;
case 2: case 2:
@ -1830,6 +1831,7 @@ pr_call_mode (progs_t *pr, const dstatement_t *st, int mm_ind)
pr_type_t *op_a = pr->pr_globals + st->a + PR_BASE (pr, st, A); pr_type_t *op_a = pr->pr_globals + st->a + PR_BASE (pr, st, A);
pr_type_t *op_b = pr->pr_globals + st->b + PR_BASE (pr, st, B); pr_type_t *op_b = pr->pr_globals + st->b + PR_BASE (pr, st, B);
pr_ptr_t mm_offs = 0; pr_ptr_t mm_offs = 0;
pr_ptr_t edict_area = 0;
switch (mm_ind) { switch (mm_ind) {
case 1: case 1:
@ -1846,7 +1848,7 @@ pr_call_mode (progs_t *pr, const dstatement_t *st, int mm_ind)
break; break;
case 4: case 4:
// entity.field (equivalent to OP_LOAD_t_v6p) // entity.field (equivalent to OP_LOAD_t_v6p)
pr_ptr_t edict_area = pr->pr_edict_area - pr->pr_globals; edict_area = pr->pr_edict_area - pr->pr_globals;
mm_offs = edict_area + OPA(entity) + OPB(field); mm_offs = edict_area + OPA(entity) + OPB(field);
break; break;
} }
@ -2148,6 +2150,9 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
pr_type_t *stk; pr_type_t *stk;
pr_type_t *mm; pr_type_t *mm;
pr_func_t function; pr_func_t function;
int ret_size = 0;
pr_opcode_e st_op = st->op & OP_MASK; pr_opcode_e st_op = st->op & OP_MASK;
switch (st_op) { switch (st_op) {
// 0 0000 // 0 0000
@ -2547,7 +2552,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
break; break;
OP_cmp_T (LT, U, long, lvec2, lvec4, <, ulong, ulvec2, ulvec4); OP_cmp_T (LT, U, long, lvec2, lvec4, <, ulong, ulvec2, ulvec4);
case OP_RETURN: case OP_RETURN:
int ret_size = (st->c & 0x1f) + 1; // up to 32 words ret_size = (st->c & 0x1f) + 1; // up to 32 words
if (st->c != 0xffff) { if (st->c != 0xffff) {
mm = pr_address_mode (pr, st, st->c >> 5); mm = pr_address_mode (pr, st, st->c >> 5);
memcpy (&R_INT (pr), mm, ret_size * sizeof (*op_a)); memcpy (&R_INT (pr), mm, ret_size * sizeof (*op_a));
@ -2876,7 +2881,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
old_val.value = pr->watch->value; old_val.value = pr->watch->value;
} }
} }
exit_program: exit_program:;
} }
/* /*
PR_ExecuteProgram PR_ExecuteProgram

View File

@ -219,6 +219,9 @@ ED_ParseEpair (progs_t *pr, pr_type_t *base, pr_def_t *key, const char *s)
pr_type_t *d; pr_type_t *d;
dfunction_t *func; dfunction_t *func;
vec3_t vec = {};
char *str = 0;
d = &base[key->ofs]; d = &base[key->ofs];
switch (key->type & ~DEF_SAVEGLOBAL) { switch (key->type & ~DEF_SAVEGLOBAL) {
@ -231,8 +234,7 @@ ED_ParseEpair (progs_t *pr, pr_type_t *base, pr_def_t *key, const char *s)
break; break;
case ev_vector: case ev_vector:
vec3_t vec = {}; str = alloca (strlen (s) + 1);
char *str = alloca (strlen (s) + 1);
strcpy (str, s); strcpy (str, s);
for (char *v = str; *v; v++) { for (char *v = str; *v; v++) {
if (*v == ',') { if (*v == ',') {
@ -446,7 +448,6 @@ static void
ED_SpawnEntities (progs_t *pr, plitem_t *entity_list) ED_SpawnEntities (progs_t *pr, plitem_t *entity_list)
{ {
edict_t *ent; edict_t *ent;
int inhibit = 0;
plitem_t *entity; plitem_t *entity;
plitem_t *item; plitem_t *item;
int i; int i;
@ -479,7 +480,6 @@ ED_SpawnEntities (progs_t *pr, plitem_t *entity_list)
// remove things from different skill levels or deathmatch // remove things from different skill levels or deathmatch
if (pr->prune_edict && pr->prune_edict (pr, ent)) { if (pr->prune_edict && pr->prune_edict (pr, ent)) {
ED_Free (pr, ent); ED_Free (pr, ent);
inhibit++;
continue; continue;
} }

View File

@ -1070,10 +1070,11 @@ fmt_state_conversion (fmt_state_t *state)
{ {
progs_t *pr = state->pr; progs_t *pr = state->pr;
char conv; char conv;
pr_ptr_t at_param;
switch ((conv = *state->c++)) { switch ((conv = *state->c++)) {
case '@': case '@':
// object // object
pr_ptr_t at_param = P_UINT (pr, state->fmt_count); at_param = P_UINT (pr, state->fmt_count);
if (state->at_handler) { if (state->at_handler) {
const char *at_str = state->at_handler (pr, at_param, const char *at_str = state->at_handler (pr, at_param,
state->at_handler_data); state->at_handler_data);

View File

@ -30,6 +30,7 @@ static void
test_debug_handler (prdebug_t event, void *param, void *data) test_debug_handler (prdebug_t event, void *param, void *data)
{ {
progs_t *pr = data; progs_t *pr = data;
dstatement_t *st = 0;
switch (event) { switch (event) {
case prd_breakpoint: case prd_breakpoint:
@ -44,7 +45,7 @@ test_debug_handler (prdebug_t event, void *param, void *data)
case prd_subexit: case prd_subexit:
break; break;
case prd_trace: case prd_trace:
dstatement_t *st = test_pr.pr_statements + test_pr.pr_xstatement; st = test_pr.pr_statements + test_pr.pr_xstatement;
if (verbose > 1) { if (verbose > 1) {
printf ("---\n"); printf ("---\n");
printf ("debug: trace %05x %04x %04x %04x %04x%s\n", printf ("debug: trace %05x %04x %04x %04x %04x%s\n",

View File

@ -231,7 +231,6 @@ load_textures (model_t *mod, vulkan_ctx_t *ctx)
// to black, no one should notice :) // to black, no one should notice :)
sky_palette[3] = 0; sky_palette[3] = 0;
size_t image_count = 0;
size_t memsize = 0; size_t memsize = 0;
for (unsigned i = 0; i < brush->numtextures; i++) { for (unsigned i = 0; i < brush->numtextures; i++) {
texture_t *tx = brush->textures[i]; texture_t *tx = brush->textures[i];
@ -240,7 +239,6 @@ load_textures (model_t *mod, vulkan_ctx_t *ctx)
} }
vulktex_t *tex = tx->render; vulktex_t *tex = tx->render;
memsize += QFV_GetImageSize (device, tex->tex->image); memsize += QFV_GetImageSize (device, tex->tex->image);
image_count++;
// just so we have one in the end // just so we have one in the end
image = tex->tex->image; image = tex->tex->image;
} }

View File

@ -211,6 +211,7 @@ Light_DecayLights (lightingdata_t *ldata, float frametime, double realtime)
} }
} }
#if 0
void void
Light_dyn_light_ui (void *comp, imui_ctx_t *imui_ctx, Light_dyn_light_ui (void *comp, imui_ctx_t *imui_ctx,
ecs_registry_t *reg, uint32_t ent, void *data) ecs_registry_t *reg, uint32_t ent, void *data)
@ -274,3 +275,4 @@ Light_light_ui (void *comp, imui_ctx_t *imui_ctx,
UI_Labelf ("%g %g %g %g", VEC4_EXP (light->attenuation)); UI_Labelf ("%g %g %g %g", VEC4_EXP (light->attenuation));
} }
} }
#endif

View File

@ -156,13 +156,13 @@ static const component_t scene_components[scene_comp_count] = {
[scene_dynlight] = { [scene_dynlight] = {
.size = sizeof (dlight_t), .size = sizeof (dlight_t),
.name = "dyn_light", .name = "dyn_light",
.ui = Light_dyn_light_ui, // .ui = Light_dyn_light_ui,
}, },
[scene_light] = { [scene_light] = {
.size = sizeof (light_t), .size = sizeof (light_t),
.name = "light", .name = "light",
.ui = Light_light_ui, // .ui = Light_light_ui,
}, },
[scene_efrags] = { [scene_efrags] = {
.size = sizeof (efrag_t *), .size = sizeof (efrag_t *),

View File

@ -482,7 +482,7 @@ test_frames (void)
int int
main (void) main (void)
{ {
scene_t *scene = Scene_NewScene (); scene_t *scene = Scene_NewScene (NULL);
reg = scene->reg; reg = scene->reg;
if (test_single_transform ()) { return 1; } if (test_single_transform ()) { return 1; }

View File

@ -217,10 +217,10 @@ imui_ctx_t *
IMUI_NewContext (canvas_system_t canvas_sys, const char *font, float fontsize) IMUI_NewContext (canvas_system_t canvas_sys, const char *font, float fontsize)
{ {
imui_ctx_t *ctx = malloc (sizeof (imui_ctx_t)); imui_ctx_t *ctx = malloc (sizeof (imui_ctx_t));
uint32_t canvas; uint32_t canvas = Canvas_New (canvas_sys);
*ctx = (imui_ctx_t) { *ctx = (imui_ctx_t) {
.csys = canvas_sys, .csys = canvas_sys,
.canvas = canvas = Canvas_New (canvas_sys), .canvas = canvas,
.vsys = { canvas_sys.reg, canvas_sys.view_base }, .vsys = { canvas_sys.reg, canvas_sys.view_base },
.tsys = { canvas_sys.reg, canvas_sys.view_base, canvas_sys.text_base }, .tsys = { canvas_sys.reg, canvas_sys.view_base, canvas_sys.text_base },
.shaper = Shaper_New (), .shaper = Shaper_New (),
@ -792,7 +792,7 @@ IMUI_Layout_SetXSize (imui_ctx_t *ctx, imui_size_t size, int value)
auto pcont = View_Control (ctx->current_parent); auto pcont = View_Control (ctx->current_parent);
uint32_t id = ctx->current_parent.id; uint32_t id = ctx->current_parent.id;
pcont->semantic_x = size; pcont->semantic_x = size;
if (size == imui_size_percent || imui_size_expand) { if (size == imui_size_percent || (bool) imui_size_expand) {
*(int *) Ent_AddComponent(id, c_percent_x, ctx->csys.reg) = value; *(int *) Ent_AddComponent(id, c_percent_x, ctx->csys.reg) = value;
} }
} }
@ -803,7 +803,7 @@ IMUI_Layout_SetYSize (imui_ctx_t *ctx, imui_size_t size, int value)
auto pcont = View_Control (ctx->current_parent); auto pcont = View_Control (ctx->current_parent);
uint32_t id = ctx->current_parent.id; uint32_t id = ctx->current_parent.id;
pcont->semantic_y = size; pcont->semantic_y = size;
if (size == imui_size_percent || imui_size_expand) { if (size == imui_size_percent || (bool) imui_size_expand) {
*(int *) Ent_AddComponent(id, c_percent_y, ctx->csys.reg) = value; *(int *) Ent_AddComponent(id, c_percent_y, ctx->csys.reg) = value;
} }
} }

View File

@ -615,9 +615,8 @@ Hunk_Print (memhunk_t *hunk, bool all)
{ {
if (!hunk) { hunk = global_hunk; } //FIXME clean up callers if (!hunk) { hunk = global_hunk; } //FIXME clean up callers
hunkblk_t *h, *next, *endlow, *starthigh, *endhigh; hunkblk_t *h, *next, *endlow, *starthigh, *endhigh;
int count, sum, totalblocks; int sum, totalblocks;
count = 0;
sum = 0; sum = 0;
totalblocks = 0; totalblocks = 0;
@ -648,7 +647,6 @@ Hunk_Print (memhunk_t *hunk, bool all)
} }
next = (hunkblk_t *) ((byte *) h + h->size); next = (hunkblk_t *) ((byte *) h + h->size);
count++;
totalblocks++; totalblocks++;
sum += h->size; sum += h->size;
@ -667,7 +665,6 @@ Hunk_Print (memhunk_t *hunk, bool all)
Sys_Printf (" :%8i %*.*s (TOTAL)\n", Sys_Printf (" :%8i %*.*s (TOTAL)\n",
sum, sz, sz, h->name[0] ? h->name : "unknown"); sum, sz, sz, h->name[0] ? h->name : "unknown");
} }
count = 0;
sum = 0; sum = 0;
} }

View File

@ -1250,6 +1250,7 @@ create_light_matrices (lightingctx_t *lctx)
auto lm = &lctx->light_mats.a[r->matrix_id]; auto lm = &lctx->light_mats.a[r->matrix_id];
mat4f_t view; mat4f_t view;
mat4f_t proj; mat4f_t proj;
vec4f_t dir;
switch (r->mode) { switch (r->mode) {
default: default:
@ -1261,7 +1262,7 @@ create_light_matrices (lightingctx_t *lctx)
case ST_CASCADE: case ST_CASCADE:
case ST_PLANE: case ST_PLANE:
//FIXME will fail for -ref_direction //FIXME will fail for -ref_direction
vec4f_t dir = light->direction; dir = light->direction;
dir[3] = 0; dir[3] = 0;
mat4fquat (view, qrotf (dir, ref_direction)); mat4fquat (view, qrotf (dir, ref_direction));
break; break;

View File

@ -438,22 +438,22 @@ Cam_Track (usercmd_t *cmd)
} }
frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK]; frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
if (autocam && cls.demoplayback2 && 0) { // if (autocam && cls.demoplayback2) {
if (ideal_track != spec_track && realtime - last_lock > 1 // if (ideal_track != spec_track && realtime - last_lock > 1
&& frame->playerstate[ideal_track].messagenum == cl.parsecount) // && frame->playerstate[ideal_track].messagenum == cl.parsecount)
Cam_Lock (ideal_track); // Cam_Lock (ideal_track);
if (frame->playerstate[spec_track].messagenum != cl.parsecount) { // if (frame->playerstate[spec_track].messagenum != cl.parsecount) {
int i; // int i;
for (i = 0; i < MAX_CLIENTS; i++) { // for (i = 0; i < MAX_CLIENTS; i++) {
if (frame->playerstate[i].messagenum == cl.parsecount) // if (frame->playerstate[i].messagenum == cl.parsecount)
break; // break;
} // }
if (i < MAX_CLIENTS) // if (i < MAX_CLIENTS)
Cam_Lock (i); // Cam_Lock (i);
} // }
} // }
player = frame->playerstate + spec_track; player = frame->playerstate + spec_track;
self = frame->playerstate + cl.playernum; self = frame->playerstate + cl.playernum;

View File

@ -1025,19 +1025,16 @@ client_t *
SV_AllocClient (int spectator, int server) SV_AllocClient (int spectator, int server)
{ {
client_t *cl; client_t *cl;
int i, clients, spectators, free, bots; int i, clients, spectators, free;
static int userid; static int userid;
// count up the clients and spectators // count up the clients and spectators
clients = 0; clients = 0;
spectators = 0; spectators = 0;
free = 0; free = 0;
bots = 0;
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) { for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
if (cl->state == cs_free) if (cl->state == cs_free)
free++; free++;
else if (cl->state == cs_server)
bots++;
else if (cl->spectator) else if (cl->spectator)
spectators++; spectators++;
else else

View File

@ -87,10 +87,11 @@ ALLOC_STATE (ex_value_t, values);
static void static void
value_debug_handler (prdebug_t event, void *param, void *data) value_debug_handler (prdebug_t event, void *param, void *data)
{ {
progs_t *pr = data; progs_t *pr = data;
dstatement_t *st = 0;
switch (event) { switch (event) {
case prd_trace: case prd_trace:
dstatement_t *st = pr->pr_statements + pr->pr_xstatement; st = pr->pr_statements + pr->pr_xstatement;
PR_PrintStatement (pr, st, 0); PR_PrintStatement (pr, st, 0);
break; break;
case prd_breakpoint: case prd_breakpoint:

View File

@ -75,7 +75,7 @@ LoadTriangleList (char *filename, triangle_t **pptri, int *numtriangles)
QFile *input; QFile *input;
char name[256], tex[256]; char name[256], tex[256];
float start, exitpattern; float start, exitpattern;
int count, iLevel, magic, i; int count, magic, i;
tf_triangle tri; tf_triangle tri;
triangle_t *ptri; triangle_t *ptri;
@ -91,8 +91,6 @@ LoadTriangleList (char *filename, triangle_t **pptri, int *numtriangles)
exit (0); exit (0);
} }
iLevel = 0;
Qread(input, &magic, sizeof(int)); Qread(input, &magic, sizeof(int));
if (BigLong (magic) != MAGIC) { if (BigLong (magic) != MAGIC) {
fprintf (stderr,"File is not a Alias object separated triangle file, " fprintf (stderr,"File is not a Alias object separated triangle file, "
@ -123,7 +121,6 @@ LoadTriangleList (char *filename, triangle_t **pptri, int *numtriangles)
// fprintf(stdout,"OBJECT START: %s\n",name); // fprintf(stdout,"OBJECT START: %s\n",name);
Qread (input, &count, sizeof (int)); Qread (input, &count, sizeof (int));
count = BigLong (count); count = BigLong (count);
++iLevel;
if (count != 0) { if (count != 0) {
// indent(); // indent();
// fprintf (stdout, "NUMBER OF TRIANGLES: %d\n", count); // fprintf (stdout, "NUMBER OF TRIANGLES: %d\n", count);
@ -145,7 +142,6 @@ LoadTriangleList (char *filename, triangle_t **pptri, int *numtriangles)
/* safe and to provide a little extra information for */ /* safe and to provide a little extra information for */
/* those who do not wish to write a recursive reader. */ /* those who do not wish to write a recursive reader. */
/* Mia culpa. */ /* Mia culpa. */
iLevel--;
i = -1; i = -1;
do { do {
i++; i++;