mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 15:21:44 +00:00
game: sync functions definitions
Make local variables static
This commit is contained in:
parent
a1d053bca1
commit
9820aa4cb1
17 changed files with 172 additions and 101 deletions
|
@ -25,8 +25,8 @@ static int j;
|
|||
static uint64_t carry;
|
||||
static uint64_t xs;
|
||||
static uint64_t cng;
|
||||
|
||||
uint64_t
|
||||
|
||||
static uint64_t
|
||||
B64MWC(void)
|
||||
{
|
||||
uint64_t t, x;
|
||||
|
@ -36,11 +36,11 @@ B64MWC(void)
|
|||
t = (x << 28) + carry;
|
||||
carry = (x >> 36) - (t < x);
|
||||
return QARY[j] = t - x;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate a pseudorandom
|
||||
* integer >0.
|
||||
/*
|
||||
* Generate a pseudorandom
|
||||
* integer >0.
|
||||
*/
|
||||
int
|
||||
randk(void)
|
||||
|
@ -55,7 +55,7 @@ randk(void)
|
|||
|
||||
/*
|
||||
* Generate a pseudorandom
|
||||
* signed float between
|
||||
* signed float between
|
||||
* 0 and 1.
|
||||
*/
|
||||
float
|
||||
|
@ -87,7 +87,7 @@ randk_seed(void)
|
|||
QARY[i] = CNG + XS;
|
||||
}
|
||||
|
||||
/* Run through several rounds
|
||||
/* Run through several rounds
|
||||
to warm up the state */
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
|
||||
extern cvar_t *maxclients;
|
||||
|
||||
qboolean enemy_vis;
|
||||
qboolean enemy_infront;
|
||||
int enemy_range;
|
||||
float enemy_yaw;
|
||||
static qboolean enemy_vis;
|
||||
static qboolean enemy_infront;
|
||||
static int enemy_range;
|
||||
static float enemy_yaw;
|
||||
|
||||
qboolean FindTarget(edict_t *self);
|
||||
qboolean ai_checkattack(edict_t *self);
|
||||
|
|
|
@ -1226,7 +1226,7 @@ Cmd_PlayerList_f(edict_t *ent)
|
|||
gi.cprintf(ent, PRINT_HIGH, "%s", text);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
Cmd_Teleport_f(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
|
@ -1276,9 +1276,6 @@ Cmd_Teleport_f(edict_t *ent)
|
|||
gi.linkentity(ent);
|
||||
}
|
||||
|
||||
edict_t* G_Spawn(void);
|
||||
void ED_CallSpawn(edict_t* ent);
|
||||
|
||||
static void
|
||||
Cmd_SpawnEntity_f(edict_t *ent)
|
||||
{
|
||||
|
@ -1647,7 +1644,7 @@ cycle_weapon(edict_t *ent)
|
|||
return noweap_fallback;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
Cmd_CycleWeap_f(edict_t *ent)
|
||||
{
|
||||
gitem_t *weap;
|
||||
|
@ -1753,7 +1750,7 @@ preferred_weapon(edict_t *ent)
|
|||
return noweap_fallback;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
Cmd_PrefWeap_f(edict_t *ent)
|
||||
{
|
||||
gitem_t *weap;
|
||||
|
|
|
@ -45,13 +45,13 @@ void Weapon_GrenadeLauncher(edict_t *ent);
|
|||
void Weapon_Railgun(edict_t *ent);
|
||||
void Weapon_BFG(edict_t *ent);
|
||||
|
||||
gitem_armor_t jacketarmor_info = {25, 50, .30, .00, ARMOR_JACKET};
|
||||
gitem_armor_t combatarmor_info = {50, 100, .60, .30, ARMOR_COMBAT};
|
||||
gitem_armor_t bodyarmor_info = {100, 200, .80, .60, ARMOR_BODY};
|
||||
static gitem_armor_t jacketarmor_info = {25, 50, .30, .00, ARMOR_JACKET};
|
||||
static gitem_armor_t combatarmor_info = {50, 100, .60, .30, ARMOR_COMBAT};
|
||||
static gitem_armor_t bodyarmor_info = {100, 200, .80, .60, ARMOR_BODY};
|
||||
|
||||
int jacket_armor_index;
|
||||
int combat_armor_index;
|
||||
int body_armor_index;
|
||||
static int jacket_armor_index;
|
||||
static int combat_armor_index;
|
||||
static int body_armor_index;
|
||||
static int power_screen_index;
|
||||
static int power_shield_index;
|
||||
|
||||
|
|
|
@ -89,19 +89,6 @@ cvar_t *gib_on;
|
|||
cvar_t *aimfix;
|
||||
cvar_t *g_machinegun_norecoil;
|
||||
|
||||
void SpawnEntities(char *mapname, char *entities, char *spawnpoint);
|
||||
void ClientThink(edict_t *ent, usercmd_t *cmd);
|
||||
qboolean ClientConnect(edict_t *ent, char *userinfo);
|
||||
void ClientUserinfoChanged(edict_t *ent, char *userinfo);
|
||||
void ClientDisconnect(edict_t *ent);
|
||||
void ClientBegin(edict_t *ent);
|
||||
void ClientCommand(edict_t *ent);
|
||||
void RunEntity(edict_t *ent);
|
||||
void WriteGame(char *filename, qboolean autosave);
|
||||
void ReadGame(char *filename);
|
||||
void WriteLevel(char *filename);
|
||||
void ReadLevel(char *filename);
|
||||
void InitGame(void);
|
||||
void G_RunFrame(void);
|
||||
|
||||
/* =================================================================== */
|
||||
|
@ -115,6 +102,41 @@ ShutdownGame(void)
|
|||
gi.FreeTags(TAG_GAME);
|
||||
}
|
||||
|
||||
/*
|
||||
* convert function declarations to correct one
|
||||
* (waring like from incompatible pointer type)
|
||||
* little bit better than cust function before set
|
||||
*/
|
||||
static void
|
||||
ReadLevel_f(char *filename)
|
||||
{
|
||||
ReadLevel(filename);
|
||||
}
|
||||
|
||||
static void
|
||||
WriteLevel_f(char *filename)
|
||||
{
|
||||
WriteLevel(filename);
|
||||
}
|
||||
|
||||
static void
|
||||
ReadGame_f(char *filename)
|
||||
{
|
||||
ReadGame(filename);
|
||||
}
|
||||
|
||||
static void
|
||||
WriteGame_f(char *filename, qboolean autosave)
|
||||
{
|
||||
WriteGame(filename, autosave);
|
||||
}
|
||||
|
||||
static void
|
||||
SpawnEntities_f(char *mapname, char *entities, char *spawnpoint)
|
||||
{
|
||||
SpawnEntities(mapname, entities, spawnpoint);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a pointer to the structure
|
||||
* with all entry points and global
|
||||
|
@ -128,12 +150,12 @@ GetGameAPI(game_import_t *import)
|
|||
globals.apiversion = GAME_API_VERSION;
|
||||
globals.Init = InitGame;
|
||||
globals.Shutdown = ShutdownGame;
|
||||
globals.SpawnEntities = SpawnEntities;
|
||||
globals.SpawnEntities = SpawnEntities_f;
|
||||
|
||||
globals.WriteGame = WriteGame;
|
||||
globals.ReadGame = ReadGame;
|
||||
globals.WriteLevel = WriteLevel;
|
||||
globals.ReadLevel = ReadLevel;
|
||||
globals.WriteGame = WriteGame_f;
|
||||
globals.ReadGame = ReadGame_f;
|
||||
globals.WriteLevel = WriteLevel_f;
|
||||
globals.ReadLevel = ReadLevel_f;
|
||||
|
||||
globals.ClientThink = ClientThink;
|
||||
globals.ClientConnect = ClientConnect;
|
||||
|
|
|
@ -581,8 +581,8 @@ typedef struct
|
|||
vec3_t angles;
|
||||
} pushed_t;
|
||||
|
||||
pushed_t pushed[MAX_EDICTS], *pushed_p;
|
||||
edict_t *obstacle;
|
||||
static pushed_t pushed[MAX_EDICTS], *pushed_p;
|
||||
static edict_t *obstacle;
|
||||
|
||||
/*
|
||||
* Objects need to be moved back on a failed push,
|
||||
|
|
|
@ -148,7 +148,7 @@ void SP_turret_breach(edict_t *self);
|
|||
void SP_turret_base(edict_t *self);
|
||||
void SP_turret_driver(edict_t *self);
|
||||
|
||||
spawn_t spawns[] = {
|
||||
static spawn_t spawns[] = {
|
||||
{"item_health", SP_item_health},
|
||||
{"item_health_small", SP_item_health_small},
|
||||
{"item_health_large", SP_item_health_large},
|
||||
|
@ -709,7 +709,7 @@ SpawnEntities(const char *mapname, char *entities, const char *spawnpoint)
|
|||
|
||||
/* =================================================================== */
|
||||
|
||||
char *single_statusbar =
|
||||
static char *single_statusbar =
|
||||
"yb -24 "
|
||||
|
||||
/* health */
|
||||
|
@ -767,7 +767,7 @@ char *single_statusbar =
|
|||
"endif "
|
||||
;
|
||||
|
||||
char *dm_statusbar =
|
||||
static char *dm_statusbar =
|
||||
"yb -24 "
|
||||
|
||||
/* health */
|
||||
|
|
|
@ -77,10 +77,10 @@ typedef struct
|
|||
unsigned compare;
|
||||
} ipfilter_t;
|
||||
|
||||
ipfilter_t ipfilters[MAX_IPFILTERS];
|
||||
int numipfilters;
|
||||
static ipfilter_t ipfilters[MAX_IPFILTERS];
|
||||
static int numipfilters;
|
||||
|
||||
qboolean
|
||||
static qboolean
|
||||
StringToFilter(char *s, ipfilter_t *f)
|
||||
{
|
||||
char num[128];
|
||||
|
|
|
@ -563,7 +563,6 @@ SP_target_splash(edict_t *self)
|
|||
* speed how fast it should be moving otherwise it
|
||||
* will just be dropped
|
||||
*/
|
||||
void ED_CallSpawn(edict_t *ent);
|
||||
|
||||
void
|
||||
use_target_spawner(edict_t *self, edict_t *other /* unused */, edict_t *activator /* unused */)
|
||||
|
|
|
@ -371,10 +371,10 @@ vtos(vec3_t v)
|
|||
return s;
|
||||
}
|
||||
|
||||
vec3_t VEC_UP = {0, -1, 0};
|
||||
vec3_t MOVEDIR_UP = {0, 0, 1};
|
||||
vec3_t VEC_DOWN = {0, -2, 0};
|
||||
vec3_t MOVEDIR_DOWN = {0, 0, -1};
|
||||
static vec3_t VEC_UP = {0, -1, 0};
|
||||
static vec3_t MOVEDIR_UP = {0, 0, 1};
|
||||
static vec3_t VEC_DOWN = {0, -2, 0};
|
||||
static vec3_t MOVEDIR_DOWN = {0, 0, -1};
|
||||
|
||||
void
|
||||
G_SetMovedir(vec3_t angles, vec3_t movedir)
|
||||
|
|
|
@ -596,8 +596,16 @@ typedef struct
|
|||
extern field_t fields[];
|
||||
extern gitem_t itemlist[];
|
||||
|
||||
/* player/client.c */
|
||||
void ClientBegin(edict_t *ent);
|
||||
void ClientDisconnect(edict_t *ent);
|
||||
void ClientUserinfoChanged(edict_t *ent, char *userinfo);
|
||||
qboolean ClientConnect(edict_t *ent, char *userinfo);
|
||||
void ClientThink(edict_t *ent, usercmd_t *cmd);
|
||||
|
||||
/* g_cmds.c */
|
||||
void Cmd_Help_f(edict_t *ent);
|
||||
void ClientCommand(edict_t *ent);
|
||||
|
||||
/* g_items.c */
|
||||
void PrecacheItem(gitem_t *it);
|
||||
|
@ -645,6 +653,9 @@ char *vtos(vec3_t v);
|
|||
float vectoyaw(vec3_t vec);
|
||||
void vectoangles(vec3_t vec, vec3_t angles);
|
||||
|
||||
/* g_spawn.c */
|
||||
void ED_CallSpawn(edict_t *ent);
|
||||
|
||||
/* g_combat.c */
|
||||
qboolean OnSameTeam(edict_t *ent1, edict_t *ent2);
|
||||
qboolean CanDamage(edict_t *targ, edict_t *inflictor);
|
||||
|
@ -802,6 +813,14 @@ void ChaseNext(edict_t *ent);
|
|||
void ChasePrev(edict_t *ent);
|
||||
void GetChaseTarget(edict_t *ent);
|
||||
|
||||
/* savegame */
|
||||
void InitGame(void);
|
||||
void ReadLevel(const char *filename);
|
||||
void WriteLevel(const char *filename);
|
||||
void ReadGame(const char *filename);
|
||||
void WriteGame(const char *filename, qboolean autosave);
|
||||
void SpawnEntities(const char *mapname, char *entities, const char *spawnpoint);
|
||||
|
||||
/* ============================================================================ */
|
||||
|
||||
/* client_t->anim_priority */
|
||||
|
@ -1096,4 +1115,14 @@ struct edict_s
|
|||
monsterinfo_t monsterinfo;
|
||||
};
|
||||
|
||||
/*
|
||||
* Uncomment for check that exported functions declarations are same as in
|
||||
* implementation. (-Wmissing-prototypes )
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
#include "../savegame/savegame.h"
|
||||
#include "../savegame/tables/gamefunc_decs.h"
|
||||
#endif
|
||||
|
||||
#endif /* GAME_LOCAL_H */
|
||||
|
|
|
@ -794,8 +794,6 @@ medic_hook_launch(edict_t *self)
|
|||
gi.sound(self, CHAN_WEAPON, sound_hook_launch, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
||||
void ED_CallSpawn(edict_t *ent);
|
||||
|
||||
static vec3_t medic_cable_offsets[] = {
|
||||
{45.0, -9.2, 15.5},
|
||||
{48.4, -9.7, 15.2},
|
||||
|
|
|
@ -2129,7 +2129,7 @@ ClientDisconnect(edict_t *ent)
|
|||
|
||||
/* ============================================================== */
|
||||
|
||||
edict_t *pm_passent;
|
||||
static edict_t *pm_passent;
|
||||
|
||||
/*
|
||||
* pmove doesn't need to know
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
#define NEXT(n) (((n) + 1) & (TRAIL_LENGTH - 1))
|
||||
#define PREV(n) (((n) - 1) & (TRAIL_LENGTH - 1))
|
||||
|
||||
edict_t *trail[TRAIL_LENGTH];
|
||||
int trail_head;
|
||||
qboolean trail_active = false;
|
||||
static edict_t *trail[TRAIL_LENGTH];
|
||||
static int trail_head;
|
||||
static qboolean trail_active = false;
|
||||
|
||||
void
|
||||
PlayerTrail_Init(void)
|
||||
|
|
|
@ -31,11 +31,11 @@ static edict_t *current_player;
|
|||
static gclient_t *current_client;
|
||||
|
||||
static vec3_t forward, right, up;
|
||||
float xyspeed;
|
||||
static float xyspeed;
|
||||
|
||||
float bobmove;
|
||||
int bobcycle; /* odd cycles are right foot going forward */
|
||||
float bobfracsin; /* sin(bobfrac*M_PI) */
|
||||
static float bobmove;
|
||||
static int bobcycle; /* odd cycles are right foot going forward */
|
||||
static float bobfracsin; /* sin(bobfrac*M_PI) */
|
||||
|
||||
float
|
||||
SV_CalcRoll(vec3_t angles, vec3_t velocity)
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include "../header/local.h"
|
||||
|
||||
#include "savegame.h"
|
||||
/*
|
||||
* When ever the savegame version is changed, q2 will refuse to
|
||||
* load older savegames. This should be bumped if the files
|
||||
|
@ -120,36 +120,6 @@
|
|||
#define ARCH_1 "unknown"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Connects a human readable
|
||||
* function signature with
|
||||
* the corresponding pointer
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *funcStr;
|
||||
byte *funcPtr;
|
||||
} functionList_t;
|
||||
|
||||
/*
|
||||
* Connects a human readable
|
||||
* mmove_t string with the
|
||||
* corresponding pointer
|
||||
* */
|
||||
typedef struct
|
||||
{
|
||||
char *mmoveStr;
|
||||
mmove_t *mmovePtr;
|
||||
} mmoveList_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char ver[32];
|
||||
char game[32];
|
||||
char os[32];
|
||||
char arch[32];
|
||||
} savegameHeader_t;
|
||||
|
||||
/* ========================================================= */
|
||||
|
||||
/*
|
||||
|
@ -164,7 +134,7 @@ typedef struct
|
|||
* to each of the functions
|
||||
* prototyped above.
|
||||
*/
|
||||
functionList_t functionList[] = {
|
||||
static functionList_t functionList[] = {
|
||||
#include "tables/gamefunc_list.h"
|
||||
};
|
||||
|
||||
|
@ -181,12 +151,12 @@ functionList_t functionList[] = {
|
|||
* functions prototyped
|
||||
* above.
|
||||
*/
|
||||
mmoveList_t mmoveList[] = {
|
||||
static mmoveList_t mmoveList[] = {
|
||||
#include "tables/gamemmove_list.h"
|
||||
};
|
||||
|
||||
/*
|
||||
* Fields to be saved
|
||||
* Fields to be saved (used in g_spawn.c)
|
||||
*/
|
||||
field_t fields[] = {
|
||||
#include "tables/fields.h"
|
||||
|
@ -196,7 +166,7 @@ field_t fields[] = {
|
|||
* Level fields to
|
||||
* be saved
|
||||
*/
|
||||
field_t levelfields[] = {
|
||||
static field_t levelfields[] = {
|
||||
#include "tables/levelfields.h"
|
||||
};
|
||||
|
||||
|
@ -204,7 +174,7 @@ field_t levelfields[] = {
|
|||
* Client fields to
|
||||
* be saved
|
||||
*/
|
||||
field_t clientfields[] = {
|
||||
static field_t clientfields[] = {
|
||||
#include "tables/clientfields.h"
|
||||
};
|
||||
|
||||
|
|
56
src/game/savegame/savegame.h
Normal file
56
src/game/savegame/savegame.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
* Copyright (C) 2011 Knightmare
|
||||
* Copyright (C) 2011 Yamagi Burmeister
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
#ifndef SAVEGAME_LOCAL_H
|
||||
#define SAVEGAME_LOCAL_H
|
||||
|
||||
/*
|
||||
* Connects a human readable
|
||||
* function signature with
|
||||
* the corresponding pointer
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *funcStr;
|
||||
byte *funcPtr;
|
||||
} functionList_t;
|
||||
|
||||
/*
|
||||
* Connects a human readable
|
||||
* mmove_t string with the
|
||||
* corresponding pointer
|
||||
* */
|
||||
typedef struct
|
||||
{
|
||||
char *mmoveStr;
|
||||
mmove_t *mmovePtr;
|
||||
} mmoveList_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char ver[32];
|
||||
char game[32];
|
||||
char os[32];
|
||||
char arch[32];
|
||||
} savegameHeader_t;
|
||||
|
||||
#endif /* SAVEGAME_LOCAL_H */
|
Loading…
Reference in a new issue