From 8102e1a021a4943dd7a6dab8bf1667dbc4404101 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Tue, 31 Dec 2013 12:47:18 +0100 Subject: [PATCH] Move entitycmpfnc() to cl_view.c an reimplement it This function is only used in cl_view.c, so no need for external declaration. Reimplement it in a sane and on all platform 64 bit clean way. This allows us to finally remove the horible INT macro. --- src/client/cl_screen.c | 14 -------------- src/client/cl_view.c | 18 ++++++++++++++++-- src/client/header/client.h | 11 ----------- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/client/cl_screen.c b/src/client/cl_screen.c index ed8cf904..efe60d46 100644 --- a/src/client/cl_screen.c +++ b/src/client/cl_screen.c @@ -612,20 +612,6 @@ SCR_Loading_f(void) SCR_BeginLoadingPlaque(); } -int -entitycmpfnc(const entity_t *a, const entity_t *b) -{ - /* all other models are sorted by model then skin */ - if (a->model == b->model) - { - return (INT)a->skin - (INT)b->skin; - } - else - { - return (INT)a->model - (INT)b->model; - } -} - void SCR_TimeRefresh_f(void) { diff --git a/src/client/cl_view.c b/src/client/cl_view.c index 1f9c569d..14fea877 100644 --- a/src/client/cl_view.c +++ b/src/client/cl_view.c @@ -444,11 +444,25 @@ V_Gun_Model_f(void) gun_model = R_RegisterModel(name); } +int +entitycmpfnc(const entity_t *a, const entity_t *b) +{ + /* all other models are sorted by model then skin */ + if (a->model == b->model) + { + return (a->skin == b->skin) ? 0 : + (a->skin > b->skin) ? 1 : -1; + } + else + { + return (a->model == b->model) ? 0 : + (a->model > b->model) ? 1 : -1; + } +} + void V_RenderView(float stereo_separation) { - extern int entitycmpfnc(const entity_t *, const entity_t *); - if (cls.state != ca_active) { return; diff --git a/src/client/header/client.h b/src/client/header/client.h index 5d106116..f6f7762b 100644 --- a/src/client/header/client.h +++ b/src/client/header/client.h @@ -27,17 +27,6 @@ #ifndef CL_CLIENT_H #define CL_CLIENT_H -#ifdef __x86_64__ -#define INT long int -#elif defined __ia64__ -/* I will have to double check this but if my experience in adding CLIPS to - * LLVM is any sign then long int will fail horribly but long long will work on - * ia64. I'll double check this on my zx6000. */ -#define INT long long -#else -#define INT int -#endif - #define MAX_CLIENTWEAPONMODELS 20 #define CMD_BACKUP 256 /* allow a lot of command backups for very fast systems */