Prepare for global arrays to be array<>

This commit is contained in:
Kp 2015-04-02 02:36:52 +00:00
parent 6e96ff3e00
commit 66a70fd373
16 changed files with 43 additions and 49 deletions

View file

@ -404,10 +404,6 @@ extern segnum_t get_free_segment_number(void);
#define diagnostic_message editor_status
#define diagnostic_message_fmt editor_status_fmt
// Status Icon.
extern void print_status_icon( char icon[1], int position );
extern void clear_status_icon( char icon[1], int position );
// Editor status message.
extern void editor_status_fmt(const char *format, ... ) __attribute_format_printf(1, 2);
#define editor_status_fmt(F,...) dxx_call_printf_checked(editor_status_fmt,editor_status,(),(F),##__VA_ARGS__)

View file

@ -452,7 +452,6 @@ extern palette_array_t gr_palette;
typedef array<color_t, 256> gft_array0;
typedef array<gft_array0, GR_FADE_LEVELS> gft_array1;
extern gft_array1 gr_fade_table;
extern ubyte gr_inverse_table[32*32*32];
extern ushort gr_palette_selector;
extern ushort gr_inverse_table_selector;

View file

@ -74,14 +74,15 @@ extern sbyte Boss_hit_this_frame;
#define NUM_D2_BOSSES 8
extern const ubyte Boss_teleports[NUM_D2_BOSSES]; // Set byte if this boss can teleport
extern const ubyte Boss_spew_more[NUM_D2_BOSSES]; // Set byte if this boss can teleport
typedef ubyte boss_flags_t[NUM_D2_BOSSES];
extern const boss_flags_t Boss_teleports; // Set byte if this boss can teleport
extern const boss_flags_t Boss_spew_more; // Set byte if this boss can teleport
//extern ubyte Boss_cloaks[NUM_D2_BOSSES]; // Set byte if this boss can cloak
extern const ubyte Boss_spews_bots_energy[NUM_D2_BOSSES]; // Set byte if boss spews bots when hit by energy weapon.
extern const ubyte Boss_spews_bots_matter[NUM_D2_BOSSES]; // Set byte if boss spews bots when hit by matter weapon.
extern const ubyte Boss_invulnerable_energy[NUM_D2_BOSSES]; // Set byte if boss is invulnerable to energy weapons.
extern const ubyte Boss_invulnerable_matter[NUM_D2_BOSSES]; // Set byte if boss is invulnerable to matter weapons.
extern const ubyte Boss_invulnerable_spot[NUM_D2_BOSSES]; // Set byte if boss is invulnerable in all but a certain spot. (Dot product fvec|vec_to_collision < BOSS_INVULNERABLE_DOT)
extern const boss_flags_t Boss_spews_bots_energy; // Set byte if boss spews bots when hit by energy weapon.
extern const boss_flags_t Boss_spews_bots_matter; // Set byte if boss spews bots when hit by matter weapon.
extern const boss_flags_t Boss_invulnerable_energy; // Set byte if boss is invulnerable to energy weapons.
extern const boss_flags_t Boss_invulnerable_matter; // Set byte if boss is invulnerable to matter weapons.
extern const boss_flags_t Boss_invulnerable_spot; // Set byte if boss is invulnerable in all but a certain spot. (Dot product fvec|vec_to_collision < BOSS_INVULNERABLE_DOT)
extern segnum_t Believed_player_seg;
extern objnum_t Ai_last_missile_camera;
#endif

View file

@ -170,8 +170,6 @@ extern unsigned Num_open_doors; // Number of open doors
extern unsigned Num_wall_anims;
extern array<wclip, MAX_WALL_ANIMS> WallAnims;
extern int walls_bm_num[MAX_WALL_ANIMS];
#endif
#ifdef EDITOR

View file

@ -60,8 +60,7 @@ static inline void hostage_init_info(const objnum_t &) {}
#endif
#endif
extern int N_hostage_types;
extern unsigned N_hostage_types;
extern int Hostage_vclip_num[MAX_HOSTAGE_TYPES]; // for each type of hostage
void draw_hostage(vobjptridx_t obj);

View file

@ -33,7 +33,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define MAX_VECS 5000
struct morph_data
struct morph_data : prohibit_void_ptr<morph_data>
{
object *obj; // object which is morphing
vms_vector morph_vecs[MAX_VECS];

View file

@ -39,7 +39,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
// these global vars are set after a call to do_physics_sim(). Ugly, I know.
// list of segments went through
extern int phys_seglist[MAX_FVI_SEGS], n_phys_segs;
extern unsigned n_phys_segs;
extern int phys_seglist[MAX_FVI_SEGS];
// Simulate a physics object for this frame
void do_physics_sim(vobjptridx_t obj);

View file

@ -24,6 +24,8 @@
#include "dxxsconf.h"
#include "compiler-make_unique.h"
#include "compiler-range_for.h"
#include "partial_range.h"
#ifdef WORDS_BIGENDIAN
#define MIDIINT(x) (x)
@ -34,9 +36,9 @@
#endif
#ifdef _WIN32
int midi_volume;
int channel_volume[16];
void hmp_stop(hmp_file *hmp);
static int midi_volume;
static int channel_volume[16];
static void hmp_stop(hmp_file *hmp);
#endif
// READ/OPEN/CLOSE HMP
@ -181,12 +183,14 @@ static int get_event(hmp_file *hmp, event *ev) {
static const int cmdlen[7]={3,3,3,3,2,2,3};
unsigned long got;
unsigned long mindelta, delta;
int i, ev_num;
int ev_num;
hmp_track *trk, *fndtrk;
mindelta = INT_MAX;
fndtrk = NULL;
for (trk = hmp->trks, i = hmp->num_trks; (i--) > 0; trk++) {
range_for (auto &rtrk, partial_range(hmp->trks, static_cast<unsigned>(hmp->num_trks)))
{
const auto trk = &rtrk;
if (!trk->left || (hmp->loop_start && hmp->looping && !trk->loop_set))
continue;
if (!(got = get_var_num_hmi(trk->cur, trk->left, &delta)))

View file

@ -547,8 +547,8 @@ static void load_hxm(const d_fname &hxmname)
static void custom_remove()
{
int i;
grs_bitmap *bmo = BitmapOriginal;
grs_bitmap *bmp = GameBitmaps;
auto bmo = begin(BitmapOriginal);
auto bmp = begin(GameBitmaps);
for (i = 0; i < MAX_BITMAP_FILES; bmo++, bmp++, i++)
if (bmo->bm_flags & 0x80)

View file

@ -54,7 +54,7 @@ static const char Gamefont_filenames_h[][16] = {
array<grs_font_ptr, MAX_FONTS> Gamefonts;
int Gamefont_installed=0;
static int Gamefont_installed;
float FNTScaleX = 1, FNTScaleY = 1;
//code to allow variable GAME_FONT, added 10/7/99 Matt Mueller - updated 11/18/99 to handle all fonts, not just GFONT_SMALL
@ -65,7 +65,6 @@ struct a_gamefont_conf
int y;
union{
char name[64];//hrm.
grs_font *ptr;
} f;
};

View file

@ -2380,7 +2380,7 @@ static void sb_draw_energy_bar(int energy)
static void sb_draw_afterburner()
{
int erase_height, w, h, aw, i;
char ab_str[3] = "AB";
auto &ab_str = "AB";
PAGE_IN_GAUGE( SB_GAUGE_AFTERBURNER );
hud_bitblt(HUD_SCALE_X(SB_AFTERBURNER_GAUGE_X), HUD_SCALE_Y(SB_AFTERBURNER_GAUGE_Y), &GameBitmaps[GET_GAUGE_INDEX(SB_GAUGE_AFTERBURNER)]);

View file

@ -40,7 +40,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
//------------- Globaly used hostage variables --------------------------------
int N_hostage_types = 0; // Number of hostage types
unsigned N_hostage_types; // Number of hostage types
int Hostage_vclip_num[MAX_HOSTAGE_TYPES]; // vclip num for each tpye of hostage

View file

@ -157,7 +157,8 @@ static void set_object_turnroll(const vobjptr_t obj)
}
//list of segments went through
int phys_seglist[MAX_FVI_SEGS],n_phys_segs;
unsigned n_phys_segs;
int phys_seglist[MAX_FVI_SEGS];
#define MAX_IGNORE_OBJS 100

View file

@ -68,6 +68,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define DEFAULT_PIGFILE_REGISTERED "descent.pig"
#elif defined(DXX_BUILD_DESCENT_II)
#include "compiler-range_for.h"
#include "partial_range.h"
#define DEFAULT_PIGFILE_REGISTERED "groupa.pig"
#define DEFAULT_PIGFILE_SHAREWARE "d2demo.pig"
#define DEFAULT_HAMFILE_REGISTERED "descent2.ham"
@ -87,7 +90,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
unsigned Num_aliases;
array<alias, MAX_ALIASES> alias_list;
int Must_write_hamfile = 0;
int Piggy_hamfile_version = 0;
#endif
@ -99,8 +101,15 @@ struct SoundFile
char name[15];
};
#if defined(DXX_BUILD_DESCENT_II)
namespace {
#endif
hashtable AllBitmapsNames;
hashtable AllDigiSndNames;
int GameBitmapOffset[MAX_BITMAP_FILES];
#if defined(DXX_BUILD_DESCENT_II)
}
#endif
int Num_bitmap_files = 0;
int Num_sound_files = 0;
@ -109,8 +118,6 @@ digi_sound GameSounds[MAX_SOUND_FILES];
int SoundOffset[MAX_SOUND_FILES];
grs_bitmap GameBitmaps[MAX_BITMAP_FILES];
int Num_bitmap_files_new = 0;
int Num_sound_files_new = 0;
#if defined(DXX_BUILD_DESCENT_I)
#define DBM_FLAG_LARGE 128 // Flags added onto the flags struct in b
static
@ -120,16 +127,12 @@ static SoundFile AllSounds[ MAX_SOUND_FILES ];
#define DBM_FLAG_ABM 64 // animated bitmap
int Piggy_bitmap_cache_size = 0;
int Piggy_bitmap_cache_next = 0;
static int Piggy_bitmap_cache_size;
static int Piggy_bitmap_cache_next;
ubyte * Piggy_bitmap_cache_data = NULL;
#if defined(DXX_BUILD_DESCENT_II)
static
#endif
int GameBitmapOffset[MAX_BITMAP_FILES];
#if defined(DXX_BUILD_DESCENT_II)
static
#endif
ubyte GameBitmapFlags[MAX_BITMAP_FILES];
ushort GameBitmapXlat[MAX_BITMAP_FILES];
@ -280,7 +283,6 @@ bitmap_index piggy_register_bitmap( grs_bitmap * bmp, const char * name, int in_
#endif
if (GameArg.DbgNoCompressPigBitmap)
gr_bitmap_rle_compress(*bmp);
Num_bitmap_files_new++;
}
#if defined(DXX_BUILD_DESCENT_II)
else if (SoundOffset[Num_sound_files] == 0)
@ -333,10 +335,6 @@ int piggy_register_sound( digi_sound * snd, const char * name, int in_file )
#endif
i = Num_sound_files;
if (!in_file)
Num_sound_files_new++;
Num_sound_files++;
return i;
}
@ -974,7 +972,6 @@ int read_hamfile()
}
if (!ham_fp) {
Must_write_hamfile = 1;
return 0;
}

View file

@ -370,8 +370,8 @@ static polymodel *read_model_file(polymodel *pm,const char *filename,robot_info
Assert(n_frames == N_ANIM_STATES);
for (int m=0;m<pm->n_models;m++)
for (int f=0;f<n_frames;f++)
pof_read_angs(&anim_angs[f][m], 1, model_buf);
range_for (auto &f, partial_range(anim_angs, n_frames))
pof_read_angs(&f[m], 1, model_buf);
robot_set_angles(r,pm,anim_angs);

View file

@ -1437,8 +1437,7 @@ void wall_frame_process()
#endif
}
int Num_stuck_objects=0;
static unsigned Num_stuck_objects;
stuckobj Stuck_objects[MAX_STUCK_OBJECTS];
// An object got stuck in a door (like a flare).