From 8e94b21061882bdf8cb5ad572b9dc45c80d20ac4 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 11 Nov 2012 00:12:17 +0000 Subject: [PATCH] Add size information to improve -fmudflap --- arch/include/jukebox.h | 2 +- arch/include/key.h | 2 +- arch/sdl/joy.c | 4 +--- arch/sdl/jukebox.c | 2 +- editor/eglobal.c | 2 +- include/editor/editor.h | 5 +++-- include/maths.h | 8 ++++---- main/ai.h | 4 ++-- main/automap.h | 1 + main/bm.h | 8 ++++---- main/bmread.c | 10 ---------- main/endlevel.c | 1 + main/fireball.c | 2 -- main/gamemine.h | 1 - main/gamepal.h | 1 + main/gamerend.c | 1 - main/gamesave.c | 3 --- main/gamesave.h | 2 +- main/gauges.c | 2 +- main/gauges.h | 3 ++- main/kconfig.h | 3 +++ main/laser.h | 3 --- main/multi.c | 5 +---- main/multi.h | 5 ++++- main/newmenu.c | 1 + main/piggy.c | 7 +++---- main/piggy.h | 5 +++++ main/player.h | 3 +++ main/polyobj.c | 1 - main/polyobj.h | 9 +++++++-- main/robot.h | 2 +- main/segment.h | 6 +++--- main/segpoint.h | 2 +- main/wall.c | 1 - main/wall.h | 3 ++- main/weapon.h | 2 +- maths/tables.c | 8 ++++---- 37 files changed, 64 insertions(+), 66 deletions(-) diff --git a/arch/include/jukebox.h b/arch/include/jukebox.h index aa71a9af7..89d1e8768 100644 --- a/arch/include/jukebox.h +++ b/arch/include/jukebox.h @@ -1,7 +1,7 @@ #ifndef __JUKEBOX_H__ #define __JUKEBOX_H__ -extern const char *const jukebox_exts[]; +extern const char *const jukebox_exts[7]; void jukebox_unload(); void jukebox_load(); diff --git a/arch/include/key.h b/arch/include/key.h index 02839b509..6db3ad2e5 100644 --- a/arch/include/key.h +++ b/arch/include/key.h @@ -47,7 +47,7 @@ extern int event_key_get_raw(d_event *event); // same as above but without mod s extern unsigned char key_ascii(); // Set to 1 if the key is currently down, else 0 -extern volatile unsigned char keyd_pressed[]; +extern volatile unsigned char keyd_pressed[256]; extern volatile unsigned char keyd_last_pressed; extern volatile unsigned char keyd_last_released; diff --git a/arch/sdl/joy.c b/arch/sdl/joy.c index 2fdbd79e8..2fc8af07b 100644 --- a/arch/sdl/joy.c +++ b/arch/sdl/joy.c @@ -14,9 +14,7 @@ #include "text.h" #include "u_mem.h" #include "playsave.h" - -extern char *joybutton_text[]; //from kconfig.c -extern char *joyaxis_text[]; //from kconfig.c +#include "kconfig.h" int num_joysticks = 0; int joy_num_axes = 0; diff --git a/arch/sdl/jukebox.c b/arch/sdl/jukebox.c index b0bfe59e3..0df66ed27 100644 --- a/arch/sdl/jukebox.c +++ b/arch/sdl/jukebox.c @@ -51,7 +51,7 @@ void jukebox_unload() JukeboxSongs.num_songs = JukeboxSongs.max_songs = JukeboxSongs.max_buf = 0; } -const char *const jukebox_exts[] = { SONG_EXT_HMP, SONG_EXT_MID, SONG_EXT_OGG, SONG_EXT_FLAC, SONG_EXT_MP3, NULL }; +const char *const jukebox_exts[7] = { SONG_EXT_HMP, SONG_EXT_MID, SONG_EXT_OGG, SONG_EXT_FLAC, SONG_EXT_MP3, NULL }; int read_m3u(void) { diff --git a/editor/eglobal.c b/editor/eglobal.c index fb2822470..a8ff9cad6 100644 --- a/editor/eglobal.c +++ b/editor/eglobal.c @@ -70,7 +70,7 @@ editor_view RightView = {3,1, NULL, i2f(100),{{0,0,f1_0},{0,f1_0,0},{f1_0,0,0}}, #endif -editor_view *Views[] = {&LargeView, +editor_view *Views[ORTHO_VIEWS ? 4 : 1] = {&LargeView, #if ORTHO_VIEWS &TopView,&FrontView,&RightView #endif diff --git a/include/editor/editor.h b/include/editor/editor.h index 9feb119da..a7cfcabee 100644 --- a/include/editor/editor.h +++ b/include/editor/editor.h @@ -21,6 +21,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define _EDITOR_H #include "vecmat.h" +#include "segment.h" #include "inferno.h" #include "gr.h" #include "ui.h" @@ -154,7 +155,7 @@ typedef struct editor_view { * */ -extern editor_view *Views[]; +extern editor_view *Views[ORTHO_VIEWS ? 4 : 1]; extern int N_views; extern int Large_view_index; extern UI_GADGET_USERBOX * LargeViewBox; @@ -541,7 +542,7 @@ extern int Lock_view_to_cursegp; // !0 means whenever cursegp changes, view it extern int Num_tilings; // number of tilings/wall extern int Degenerate_segment_found; -extern sbyte Been_visited[]; // List of segments visited in a recursive search, if element n set, segment n done been visited +extern sbyte Been_visited[MAX_SEGMENTS]; // List of segments visited in a recursive search, if element n set, segment n done been visited // Initializes autosave system. // Sets global Autosave_count to 0. diff --git a/include/maths.h b/include/maths.h index 101b180ee..0518b5e31 100644 --- a/include/maths.h +++ b/include/maths.h @@ -109,9 +109,9 @@ fixang fix_acos (fix v); //NOTE: this is different from the standard C atan2, since it is left-handed. fixang fix_atan2 (fix cos, fix sin); -extern const ubyte guess_table[]; -extern const short sincos_table[]; -extern const ushort asin_table[]; -extern const ushort acos_table[]; +extern const ubyte guess_table[256]; +extern const short sincos_table[321]; +extern const ushort asin_table[258]; +extern const ushort acos_table[258]; #endif diff --git a/main/ai.h b/main/ai.h index 290a2abd3..730455034 100644 --- a/main/ai.h +++ b/main/ai.h @@ -221,9 +221,9 @@ extern void ai_multi_send_robot_position(int objnum, int force); // It is not valid to use FrameTime because robots do not get moved every frame. extern int Num_boss_teleport_segs; -extern short Boss_teleport_segs[]; +extern short Boss_teleport_segs[MAX_BOSS_TELEPORT_SEGS]; extern int Num_boss_gate_segs; -extern short Boss_gate_segs[]; +extern short Boss_gate_segs[MAX_BOSS_TELEPORT_SEGS]; // --------- John: These variables must be saved as part of gamesave. --------- diff --git a/main/automap.h b/main/automap.h index 0edeaeeb0..ca0213bc6 100644 --- a/main/automap.h +++ b/main/automap.h @@ -24,6 +24,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. extern int Automap_active; +extern char Marker_input[40]; extern void do_automap(int key_code); extern void automap_clear_visited(); extern ubyte Automap_visited[MAX_SEGMENTS]; diff --git a/main/bm.h b/main/bm.h index dbc0bb62a..fb21f40c3 100644 --- a/main/bm.h +++ b/main/bm.h @@ -52,8 +52,11 @@ typedef struct { extern int Num_object_types; #define N_COCKPIT_BITMAPS 6 +struct player_ship; +extern struct player_ship only_player_ship; extern int Num_cockpits; extern bitmap_index cockpit_bitmap[N_COCKPIT_BITMAPS]; +extern short tmap_xlate_table[MAX_TEXTURES]; extern int Num_tmaps; #ifdef EDITOR @@ -62,10 +65,6 @@ extern int TmapList[MAX_TEXTURES]; extern tmap_info TmapInfo[MAX_TEXTURES]; -//for each model, a model number for dying & dead variants, or -1 if none -extern int Dying_modelnums[]; -extern int Dead_modelnums[]; - //the model number of the marker object extern int Marker_model_num; @@ -82,6 +81,7 @@ extern int Num_object_subtypes; // Number of possible IDs for the current t #define MAX_OBJ_BITMAPS 610 +extern int N_ObjBitmaps; extern bitmap_index ObjBitmaps[MAX_OBJ_BITMAPS]; extern ushort ObjBitmapPtrs[MAX_OBJ_BITMAPS]; extern int First_multi_bitmap_num; diff --git a/main/bmread.c b/main/bmread.c index 838cad41b..9de9747ce 100644 --- a/main/bmread.c +++ b/main/bmread.c @@ -78,9 +78,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define MAX_BITMAPS_PER_BRUSH 30 -extern player_ship only_player_ship; // In bm.c - -extern short N_ObjBitmaps; // in bm.c short N_ObjBitmapPtrs=0; static int Num_robot_ais = 0; int TmapList[MAX_TEXTURES]; @@ -119,10 +116,6 @@ int linenum; //line int table currently being parsed //------------------- Useful macros and variables --------------- #define IFTOK(str) if (!strcmp(arg, str)) -extern char *space; // in piggy.c -//--unused-- char *equal = { "=" }; -extern char *equal_space; // in piggy.c - // For the sake of LINT, defining prototypes to module's functions void bm_read_alias(void); @@ -214,9 +207,6 @@ bitmap_index bm_load_sub(int skip, char * filename ) return bitmap_num; } -extern ubyte bogus_bitmap_initialized; -extern digi_sound bogus_sound; - void ab_load(int skip, char * filename, bitmap_index bmp[], int *nframes ) { grs_bitmap * bm[MAX_BITMAPS_PER_BRUSH]; diff --git a/main/endlevel.c b/main/endlevel.c index 64a567dd7..dd919864a 100644 --- a/main/endlevel.c +++ b/main/endlevel.c @@ -45,6 +45,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "endlevel.h" #include "object.h" #include "game.h" +#include "gamepal.h" #include "screens.h" #include "gauges.h" #include "wall.h" diff --git a/main/fireball.c b/main/fireball.c index 2985befe9..4149606a4 100644 --- a/main/fireball.c +++ b/main/fireball.c @@ -593,8 +593,6 @@ int choose_drop_segment() // ------------------------------------------------------------------------------------------------------ // Drop cloak powerup if in a network game. -extern char PowerupsInMine[],MaxPowerupsAllowed[]; - void maybe_drop_net_powerup(int powerup_type) { if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) { diff --git a/main/gamemine.h b/main/gamemine.h index 4965ab000..4f20c975f 100644 --- a/main/gamemine.h +++ b/main/gamemine.h @@ -121,7 +121,6 @@ int game_load_mine(char * filename); int load_mine_data(PHYSFS_file *LoadFile); int load_mine_data_compiled(PHYSFS_file *LoadFile); -extern short tmap_xlate_table[]; extern fix Level_shake_frequency, Level_shake_duration; extern int Secret_return_segment; extern vms_matrix Secret_return_orient; diff --git a/main/gamepal.h b/main/gamepal.h index 1ce3e2d86..c1daa1983 100644 --- a/main/gamepal.h +++ b/main/gamepal.h @@ -27,6 +27,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. extern char last_palette_loaded[FILENAME_LEN]; extern char Current_level_palette[FILENAME_LEN]; +extern char last_palette_loaded_pig[FILENAME_LEN]; // load a palette by name. returns 1 if new palette loaded, else 0 // if used_for_level is set, load pig, etc. diff --git a/main/gamerend.c b/main/gamerend.c index 1d34aa24d..1025be060 100644 --- a/main/gamerend.c +++ b/main/gamerend.c @@ -61,7 +61,6 @@ extern void newmenu_free_background(); int netplayerinfo_on=0; extern ubyte DefiningMarkerMessage; -extern char Marker_input[]; void game_draw_marker_message() { diff --git a/main/gamesave.c b/main/gamesave.c index b1f12a240..ffa0b8b8e 100644 --- a/main/gamesave.c +++ b/main/gamesave.c @@ -130,9 +130,6 @@ void do_load_save_levels(int save); void dump_mine_info(void); #endif -extern char MaxPowerupsAllowed[MAX_POWERUP_TYPES]; -extern char PowerupsInMine[MAX_POWERUP_TYPES]; - #ifdef EDITOR extern char mine_filename[]; extern int save_mine_data_compiled(PHYSFS_file *SaveFile); diff --git a/main/gamesave.h b/main/gamesave.h index fb42f9ead..f9fe6106e 100644 --- a/main/gamesave.h +++ b/main/gamesave.h @@ -28,7 +28,7 @@ int get_level_name(void); extern int load_level(const char *filename); extern int save_level(char *filename); -extern char Gamesave_current_filename[]; +extern char Gamesave_current_filename[PATH_MAX]; extern int Gamesave_current_version; diff --git a/main/gauges.c b/main/gauges.c index 6470c2e8f..aabb6bdac 100644 --- a/main/gauges.c +++ b/main/gauges.c @@ -2226,7 +2226,7 @@ extern int Missile_gun; extern int allowed_to_fire_laser(void); extern int allowed_to_fire_missile(void); -const rgb player_rgb[] = { +const rgb player_rgb[MAX_PLAYERS] = { {15,15,23}, {27,0,0}, {0,23,0}, diff --git a/main/gauges.h b/main/gauges.h index 4be702976..f89fdf244 100644 --- a/main/gauges.h +++ b/main/gauges.h @@ -26,6 +26,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "piggy.h" #include "object.h" #include "hudmsg.h" +#include "player.h" //from gauges.c @@ -61,7 +62,7 @@ typedef struct { ubyte r,g,b; } rgb; -extern const rgb player_rgb[]; +extern const rgb player_rgb[MAX_PLAYERS]; #define WBU_WEAPON 0 // the weapons display #define WBU_MISSILE 1 // the missile view diff --git a/main/kconfig.h b/main/kconfig.h index ba9e915cf..83ebed8b5 100644 --- a/main/kconfig.h +++ b/main/kconfig.h @@ -64,4 +64,7 @@ extern void kc_set_controls(); //set the cruise speed to zero extern void reset_cruise(void); +extern char *joybutton_text[JOY_MAX_BUTTONS]; +extern char *joyaxis_text[JOY_MAX_AXES]; + #endif /* _KCONFIG_H */ diff --git a/main/laser.h b/main/laser.h index f02e69b94..da089d915 100644 --- a/main/laser.h +++ b/main/laser.h @@ -100,9 +100,6 @@ struct object; extern fix Min_trackable_dot; // MIN_TRACKABLE_DOT inversely scaled by FrameTime -extern struct object *Guided_missile[]; -extern int Guided_missile_sig[]; - void Laser_render(struct object *obj); void Laser_player_fire(struct object * obj, int type, int gun_num, int make_sound, int harmless_flag); void Laser_player_fire_spread(struct object *obj, int laser_type, int gun_num, fix spreadr, fix spreadu, int make_sound, int harmless); diff --git a/main/multi.c b/main/multi.c index 91d9f0d9c..0348261b0 100644 --- a/main/multi.c +++ b/main/multi.c @@ -39,7 +39,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "console.h" #include "wall.h" #include "cntrlcen.h" -#include "powerup.h" #include "polyobj.h" #include "bm.h" #include "endlevel.h" @@ -200,7 +199,7 @@ static const int message_length[] = { char PowerupsInMine[MAX_POWERUP_TYPES],MaxPowerupsAllowed[MAX_POWERUP_TYPES]; extern fix ThisLevelTime; -char *RankStrings[]={"(unpatched) ","Cadet ","Ensign ","Lieutenant ","Lt.Commander ", +const char *const RankStrings[10]={"(unpatched) ","Cadet ","Ensign ","Lieutenant ","Lt.Commander ", "Commander ","Captain ","Vice Admiral ","Admiral ","Demigod "}; char *multi_allow_powerup_text[MULTI_ALLOW_POWERUP_MAX] = @@ -4640,8 +4639,6 @@ void multi_do_start_trigger (const ubyte *buf) Triggers[(int)buf[1]].flags |=TF_DISABLED; } -extern char *RankStrings[]; - void multi_add_lifetime_kills () { // This function adds a kill to lifetime stats of this player, and possibly diff --git a/main/multi.h b/main/multi.h index 3ea0d8497..3454dbb42 100644 --- a/main/multi.h +++ b/main/multi.h @@ -23,6 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "gameseq.h" #include "piggy.h" #include "newmenu.h" +#include "powerup.h" #ifdef USE_UDP #ifdef _WIN32 @@ -357,7 +358,9 @@ extern int Bounty_target; extern bitmap_index multi_player_textures[MAX_PLAYERS][N_PLAYER_SHIP_TEXTURES]; -extern char *RankStrings[]; +extern const char *const RankStrings[10]; +extern char PowerupsInMine[MAX_POWERUP_TYPES], + MaxPowerupsAllowed[MAX_POWERUP_TYPES]; // Globals for protocol-bound Refuse-functions extern char RefuseThisPlayer,WaitForRefuseAnswer,RefuseTeam,RefusePlayerName[12]; diff --git a/main/newmenu.c b/main/newmenu.c index 9a0ae2fe9..6d97cd46c 100644 --- a/main/newmenu.c +++ b/main/newmenu.c @@ -33,6 +33,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "mouse.h" #include "palette.h" #include "game.h" +#include "gamepal.h" #include "text.h" #include "menu.h" #include "newmenu.h" diff --git a/main/piggy.c b/main/piggy.c index 6fcd763eb..f21ade73c 100644 --- a/main/piggy.c +++ b/main/piggy.c @@ -37,6 +37,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "args.h" #include "palette.h" #include "gamefont.h" +#include "gamepal.h" #include "rle.h" #include "screens.h" #include "piggy.h" @@ -1542,8 +1543,6 @@ int piggy_is_substitutable_bitmap( char * name, char * subst_name ) * 2) From descent.pig (for loading d1 levels) */ -extern char last_palette_loaded_pig[]; - void free_bitmap_replacements() { if (Bitmap_replacement_data) { @@ -1744,8 +1743,8 @@ void remove_char( char * s, char c ) if (p) *p = '\0'; } -char *space = { " \t" }; -char *equal_space = { " \t=" }; +const char space[3] = " \t"; +const char equal_space[4] = " \t="; // this function is at the same position in the d1 shareware piggy loading // algorithm as bm_load_sub in main/bmread.c diff --git a/main/piggy.h b/main/piggy.h index 53807d247..f3c0e584b 100644 --- a/main/piggy.h +++ b/main/piggy.h @@ -132,4 +132,9 @@ extern void remove_char( char * s, char c ); // in piggy.c #define REMOVE_COMMENTS(s) remove_char((s),';') #define REMOVE_DOTS(s) remove_char((s),'.') +extern ubyte bogus_bitmap_initialized; +extern digi_sound bogus_sound; +extern const char space[3]; +extern const char equal_space[4]; + #endif //_PIGGY_H diff --git a/main/player.h b/main/player.h index fe0069e7d..901d6f4b9 100644 --- a/main/player.h +++ b/main/player.h @@ -197,6 +197,9 @@ extern int Player_num; // The player number who is on the console. extern player Players[MAX_PLAYERS+4]; // Misc player info extern player_ship *Player_ship; +extern struct object *Guided_missile[MAX_PLAYERS]; +extern int Guided_missile_sig[MAX_PLAYERS]; + /* * reads a player_ship structure from a PHYSFS_file */ diff --git a/main/polyobj.c b/main/polyobj.c index 9dd92085a..d4a989d47 100644 --- a/main/polyobj.c +++ b/main/polyobj.c @@ -47,7 +47,6 @@ polymodel Polygon_models[MAX_POLYGON_MODELS]; // = {&bot11,&bot17,&robot_s2,&rob int N_polygon_models = 0; -#define MAX_POLYGON_VECS 1000 g3s_point robot_points[MAX_POLYGON_VECS]; #define PM_COMPATIBLE_VERSION 6 diff --git a/main/polyobj.h b/main/polyobj.h index 49db4d28c..02669f2d0 100644 --- a/main/polyobj.h +++ b/main/polyobj.h @@ -33,6 +33,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define MAX_POLYGON_MODELS 200 #define MAX_SUBMODELS 10 +//for each model, a model number for dying & dead variants, or -1 if none +extern int Dying_modelnums[MAX_POLYGON_MODELS]; +extern int Dead_modelnums[MAX_POLYGON_MODELS]; + //used to describe a polygon model typedef struct polymodel { int n_models; @@ -55,7 +59,7 @@ typedef struct polymodel { } __pack__ polymodel; // array of pointers to polygon objects -extern polymodel Polygon_models[]; +extern polymodel Polygon_models[MAX_POLYGON_MODELS]; // how many polygon objects there are extern int N_polygon_models; @@ -90,7 +94,8 @@ void free_model(polymodel *po); #define MAX_POLYOBJ_TEXTURES 100 extern grs_bitmap *texture_list[MAX_POLYOBJ_TEXTURES]; extern bitmap_index texture_list_index[MAX_POLYOBJ_TEXTURES]; -extern g3s_point robot_points[]; +#define MAX_POLYGON_VECS 1000 +extern g3s_point robot_points[MAX_POLYGON_VECS]; /* * reads a polymodel structure from a PHYSFS_file diff --git a/main/robot.h b/main/robot.h index 8f82af170..48f0e367b 100644 --- a/main/robot.h +++ b/main/robot.h @@ -139,7 +139,7 @@ typedef struct robot_info { extern char Robot_names[MAX_ROBOT_TYPES][ROBOT_NAME_LENGTH]; //the array of robots types -extern robot_info Robot_info[]; // Robot info for AI system, loaded from bitmaps.tbl. +extern robot_info Robot_info[MAX_ROBOT_TYPES]; // Robot info for AI system, loaded from bitmaps.tbl. //how many kinds of robots extern int N_robot_types; // Number of robot types. We used to assume this was the same as N_polygon_models. diff --git a/main/segment.h b/main/segment.h index 60088cc28..1b47b7337 100644 --- a/main/segment.h +++ b/main/segment.h @@ -158,9 +158,9 @@ typedef struct { } group; // Globals from mglobal.c -extern vms_vector Vertices[]; -extern segment Segments[]; #define Segment2s Segments +extern vms_vector Vertices[MAX_VERTICES]; +extern segment Segments[MAX_SEGMENTS]; extern int Num_segments; extern int Num_vertices; @@ -169,7 +169,7 @@ extern int Num_vertices; extern const sbyte Side_to_verts[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. extern const int Side_to_verts_int[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. -extern const char Side_opposite[]; // Side_opposite[my_side] returns side opposite cube from my_side. +extern const char Side_opposite[MAX_SIDES_PER_SEGMENT]; // Side_opposite[my_side] returns side opposite cube from my_side. #define SEG_PTR_2_NUM(segptr) (Assert((unsigned) (segptr-Segments)