Replace "short" with "int16_t" and fix missing headers

This commit is contained in:
GravisZro 2024-05-23 23:27:12 -04:00
parent aebe1bbbb6
commit 5e5e0c99c3
248 changed files with 5431 additions and 5423 deletions

View File

@ -142,7 +142,7 @@
typedef CFILE *FONTFILE;
static inline int READ_FONT_INT(FONTFILE ffile);
static inline short READ_FONT_SHORT(FONTFILE ffile);
static inline int16_t READ_FONT_SHORT(FONTFILE ffile);
static inline uint8_t READ_FONT_BYTE(FONTFILE ffile);
static inline int READ_FONT_DATA(FONTFILE ffile, void *buf, int size, int nelem);
static inline FONTFILE OPEN_FONT(char *filename, bool &success);
@ -153,7 +153,7 @@ static inline void CLOSE_FONT(FONTFILE ffile);
inline int READ_FONT_INT(FONTFILE ffile) { return cf_ReadInt(ffile); }
inline short READ_FONT_SHORT(FONTFILE ffile) { return cf_ReadShort(ffile); }
inline int16_t READ_FONT_SHORT(FONTFILE ffile) { return cf_ReadShort(ffile); }
inline uint8_t READ_FONT_BYTE(FONTFILE ffile) { return (uint8_t)cf_ReadByte(ffile); }
@ -405,7 +405,7 @@ void grFont::load(char *filename, int slot) {
// Read in all widths
if (ft->flags & FT_PROPORTIONAL) {
ft->char_widths = new short[num_char];
ft->char_widths = new int16_t[num_char];
for (i = 0; i < num_char; i++)
ft->char_widths[i] = READ_FONT_SHORT(ff);
mprintf((0, "::proportional"));

View File

@ -30,7 +30,7 @@
typedef struct mem_bitmap {
char *data;
short bpp;
int16_t bpp;
int rowsize;
uint16_t alloced : 2;
uint16_t flag : 14;

View File

@ -224,7 +224,7 @@ bool gr_mem_surf_Init(ddgr_surface *sf, char *data, int rowsize) {
mbm->data = data;
mbm->rowsize = rowsize;
mbm->bpp = (short)sf->bpp;
mbm->bpp = (int16_t)sf->bpp;
mbm->flag = 0;
sf->obj = (void *)mbm;

View File

@ -3146,7 +3146,7 @@ bool AINotify(object *obj, uint8_t notify_type, void *info) {
int i;
if (hptr->f_directly_player) {
short heard_noise_obj[50];
int16_t heard_noise_obj[50];
int num_objs = fvi_QuickDistObjectList(&obj->pos, obj->roomnum, hptr->max_dist, heard_noise_obj, 50, false, true,
false, true);
@ -4297,7 +4297,7 @@ void AIDoTrackFrame(object *obj) {
track_distance = GoalDetermineTrackDist(obj);
if (track_distance > 0.0f) {
short near_objs[10];
int16_t near_objs[10];
int num_near = fvi_QuickDistObjectList(&obj->pos, obj->roomnum, ai_info->avoid_friends_distance + track_distance,
near_objs, 10, false, true, false, true);
float dist;
@ -4740,7 +4740,7 @@ void ai_move(object *obj) {
f_goal_found = true;
short near_objs[10];
int16_t near_objs[10];
float avoid_dist;
@ -5088,7 +5088,7 @@ void ai_move(object *obj) {
}
if (obj->movement_type == MT_WALKING) {
short robots[6];
int16_t robots[6];
int num_robots =
fvi_QuickDistObjectList(&obj->pos, obj->roomnum, 30.0f, robots, 6, false, true, false, true);
vector d = Zero_vector;
@ -5942,7 +5942,7 @@ void AIDetermineTarget(object *obj) {
if ((ai_info->flags & AIF_TEAM_MASK) == AIF_TEAM_NEUTRAL || (ai_info->flags & AIF_ACT_AS_NEUTRAL_UNTIL_SHOT)) {
best_obj = NULL;
} else if ((ai_info->flags & AIF_TEAM_MASK) != AIF_TEAM_PTMC) {
short list[50];
int16_t list[50];
int num = fvi_QuickDistObjectList(&obj->pos, obj->roomnum, MAX_SEE_TARGET_DIST, list, 50, false, true, false, true);
for (i = 0; i < num; i++) {
@ -6062,7 +6062,7 @@ void AIDoMemFrame(object *obj) {
ai_info->mem_time_till_next_update = 3.0f + (float)ps_rand() / (float)D3_RAND_MAX * 2.0f;
// Do the amount of friends/enemies left and the current shields before running Freud
short near_objs[100];
int16_t near_objs[100];
float dist = 100.0f;
// chrishack -- there must be a better way...

View File

@ -2100,7 +2100,7 @@ void MakeBOA(void) {
static int Current_sort_room;
static int face_sort_func1(const short *a, const short *b) {
static int face_sort_func1(const int16_t *a, const int16_t *b) {
if (Rooms[Current_sort_room].faces[*a].min_xyz.y > Rooms[Current_sort_room].faces[*b].min_xyz.y)
return -1;
else if (Rooms[Current_sort_room].faces[*a].min_xyz.y < Rooms[Current_sort_room].faces[*b].min_xyz.y)
@ -2109,7 +2109,7 @@ static int face_sort_func1(const short *a, const short *b) {
return 0;
}
static int face_sort_func2(const short *a, const short *b) {
static int face_sort_func2(const int16_t *a, const int16_t *b) {
if (Rooms[Current_sort_room].faces[*a].max_xyz.y < Rooms[Current_sort_room].faces[*b].max_xyz.y)
return -1;
else if (Rooms[Current_sort_room].faces[*a].max_xyz.y > Rooms[Current_sort_room].faces[*b].max_xyz.y)
@ -2143,21 +2143,21 @@ void ComputeAABB(bool f_full) {
}
}
short *num_structs_per_room = (short *)mem_malloc((Highest_room_index + 1) * sizeof(short));
short **r_struct_list;
int16_t *num_structs_per_room = (int16_t *)mem_malloc((Highest_room_index + 1) * sizeof(int16_t));
int16_t **r_struct_list;
// Allocate the structure that tells what struct each face is in
r_struct_list = (short **)mem_malloc((Highest_room_index + 1) * sizeof(short *));
r_struct_list = (int16_t **)mem_malloc((Highest_room_index + 1) * sizeof(int16_t *));
for (i = 0; i <= Highest_room_index; i++) {
if (Rooms[i].used) {
if (BOA_AABB_ROOM_checksum[i] != 0 && BOA_AABB_ROOM_checksum[i] == computed_room_check[i])
continue;
r_struct_list[i] = (short *)mem_malloc(Rooms[i].num_faces * sizeof(short));
r_struct_list[i] = (int16_t *)mem_malloc(Rooms[i].num_faces * sizeof(int16_t));
}
}
short count;
int16_t count;
BOA_AABB_checksum = cur_check;
mprintf((0, " (full)!\n"));
@ -2244,12 +2244,12 @@ void ComputeAABB(bool f_full) {
if (BOA_AABB_ROOM_checksum[i] != 0 && BOA_AABB_ROOM_checksum[i] == computed_room_check[i])
continue;
short *nfaces;
int16_t *nfaces;
bool *used;
int n_new;
nfaces = (short *)mem_malloc(sizeof(short) * rp->num_faces);
nfaces = (int16_t *)mem_malloc(sizeof(int16_t) * rp->num_faces);
used = (bool *)mem_malloc(sizeof(bool) * rp->num_faces);
for (count1 = 0; count1 < rp->num_faces; count1++) {
@ -2418,11 +2418,11 @@ void ComputeAABB(bool f_full) {
// temporary malloc
rp->num_bbf_regions = 27 + num_structs_per_room[i] - 1;
rp->bbf_list = (short **)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(short *));
rp->bbf_list = (int16_t **)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(int16_t *));
for (x = 0; x < MAX_REGIONS_PER_ROOM; x++) {
rp->bbf_list[x] = (short *)mem_malloc(rp->num_faces * sizeof(short));
rp->bbf_list[x] = (int16_t *)mem_malloc(rp->num_faces * sizeof(int16_t));
}
rp->num_bbf = (short *)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(short));
rp->num_bbf = (int16_t *)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(int16_t));
rp->bbf_list_min_xyz = (vector *)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(vector));
rp->bbf_list_max_xyz = (vector *)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(vector));
rp->bbf_list_sector = (uint8_t *)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(uint8_t));
@ -2706,7 +2706,7 @@ void ComputeAABB(bool f_full) {
if (rp->num_bbf[i] == 0) {
for (j = i + 1; j < rp->num_bbf_regions; j++) {
short *temp = rp->bbf_list[j - 1];
int16_t *temp = rp->bbf_list[j - 1];
rp->bbf_list[j - 1] = rp->bbf_list[j];
rp->bbf_list[j] = temp;
@ -2841,7 +2841,7 @@ void ComputeAABB(bool f_full) {
if (rp->num_bbf[i] == 0) {
for (j = i + 1; j < rp->num_bbf_regions; j++) {
short *temp = rp->bbf_list[j - 1];
int16_t *temp = rp->bbf_list[j - 1];
rp->bbf_list[j - 1] = rp->bbf_list[j];
rp->bbf_list[j] = temp;
@ -2960,14 +2960,14 @@ void ComputeAABB(bool f_full) {
continue;
for (j = 0; j < rp->num_bbf_regions; j++) {
rp->bbf_list[j] = (short *)mem_realloc(rp->bbf_list[j], (sizeof(short) * rp->num_bbf[j]));
rp->bbf_list[j] = (int16_t *)mem_realloc(rp->bbf_list[j], (sizeof(int16_t) * rp->num_bbf[j]));
}
for (j = rp->num_bbf_regions; j < MAX_REGIONS_PER_ROOM; j++) {
mem_free(rp->bbf_list[j]);
}
rp->bbf_list = (short **)mem_realloc(rp->bbf_list, rp->num_bbf_regions * sizeof(short *));
rp->num_bbf = (short *)mem_realloc(rp->num_bbf, rp->num_bbf_regions * sizeof(short));
rp->bbf_list = (int16_t **)mem_realloc(rp->bbf_list, rp->num_bbf_regions * sizeof(int16_t *));
rp->num_bbf = (int16_t *)mem_realloc(rp->num_bbf, rp->num_bbf_regions * sizeof(int16_t));
rp->bbf_list_min_xyz = (vector *)mem_realloc(rp->bbf_list_min_xyz, rp->num_bbf_regions * sizeof(vector));
rp->bbf_list_max_xyz = (vector *)mem_realloc(rp->bbf_list_max_xyz, rp->num_bbf_regions * sizeof(vector));
rp->bbf_list_sector =

View File

@ -385,7 +385,7 @@ static char Ctltext_KeyBindings[][16] = {"",
"",
""};
static short key_binding_indices[] = {
static int16_t key_binding_indices[] = {
KEY_BACKSP, KEY_TAB, KEY_ENTER, KEY_LCTRL, KEY_LSHIFT, KEY_RSHIFT, KEY_PADMULTIPLY, KEY_LALT,
KEY_SPACEBAR, KEY_CAPSLOCK, 0x45, KEY_SCROLLOCK, KEY_PAD7, KEY_PAD8, KEY_PAD9, KEY_PADMINUS,
KEY_PAD4, KEY_PAD5, KEY_PAD6, KEY_PADPLUS, KEY_PAD1, KEY_PAD2, KEY_PAD3, KEY_PAD0,
@ -534,7 +534,7 @@ UIBitmapItem *cfg_element::m_btn_bmp_lit = NULL;
UIBitmapItem *cfg_element::m_btn_bmp = NULL;
UIBitmapItem *cfg_element::m_xbtn_bmp_lit = NULL;
UIBitmapItem *cfg_element::m_xbtn_bmp = NULL;
short cfg_element::m_count = 0;
int16_t cfg_element::m_count = 0;
// MTS: unused?
bool key_cfg_element(uint8_t *element, uint8_t *flags);

View File

@ -91,7 +91,7 @@
//
class cfg_element : public UIGadget {
static UIBitmapItem *m_btn_bmp_lit, *m_btn_bmp, *m_xbtn_bmp_lit, *m_xbtn_bmp;
static short m_count;
static int16_t m_count;
const char *m_title;
int8_t m_fnid, m_flags; // fnflags : 1 if invert btn visible
int8_t m_slot, m_curslot; // what slow is in focus and number of slots.

View File

@ -1323,9 +1323,9 @@ int Num_lightmap_infos_read = 0;
uint16_t LightmapInfoRemap[MAX_LIGHTMAP_INFOS];
// Arrays for mapping saved data to the current data
short texture_xlate[MAX_TEXTURES];
short door_xlate[MAX_DOORS];
short generic_xlate[MAX_OBJECT_IDS];
int16_t texture_xlate[MAX_TEXTURES];
int16_t door_xlate[MAX_DOORS];
int16_t generic_xlate[MAX_OBJECT_IDS];
#ifdef EDITOR
extern float GlobalMultiplier;
@ -1341,7 +1341,7 @@ extern float GlobalMultiplier;
#define MAX_FAILED_XLATE_ITEMS 1500
struct {
short type, id;
int16_t type, id;
char name[PAGENAME_LEN];
} Failed_xlate_items[MAX_FAILED_XLATE_ITEMS];
@ -1759,7 +1759,7 @@ int ReadObject(CFILE *ifile, object *objp, int handle, int fileversion) {
}
if (fileversion >= LEVEL_FILE_SCRIPTPARMS) {
short s = cf_ReadShort(ifile);
int16_t s = cf_ReadShort(ifile);
for (i = 0; i < s; i++) {
int8_t stype = cf_ReadByte(ifile);
@ -1927,7 +1927,7 @@ int ReadTrigger(CFILE *ifile, trigger *tp, int fileversion) {
cf_ReadString(name, MAX_D3XID_NAME, ifile);
if (fileversion >= LEVEL_FILE_TRIGPARMS) {
int i;
short s = cf_ReadShort(ifile);
int16_t s = cf_ReadShort(ifile);
for (i = 0; i < s; i++) {
int8_t type = cf_ReadByte(ifile);
if (type == PARMTYPE_NUMBER || type == PARMTYPE_REF) {
@ -2281,7 +2281,7 @@ int WriteCompressionByte(CFILE *fp, uint8_t *val, int total, int just_count, int
return written;
}
// Does a RLE compression run of the values given the short array 'val'.
// Does a RLE compression run of the values given the int16_t array 'val'.
// If just_count is 1, doesn't write anything
int WriteCompressionShort(CFILE *fp, uint16_t *val, int total, int just_count, int compress) {
int done = 0, written = 0;
@ -2632,7 +2632,7 @@ int ReadRoom(CFILE *ifile, room *rp, int version) {
}
// Build a translation table for various items
void BuildXlateTable(CFILE *ifile, int (*lookup_func)(const char *), short *xlate_table, int max_items, int type) {
void BuildXlateTable(CFILE *ifile, int (*lookup_func)(const char *), int16_t *xlate_table, int max_items, int type) {
char name[PAGENAME_LEN];
int n;
int i;
@ -3046,7 +3046,7 @@ void ReadBOAChunk(CFILE *fp, int version) {
max_rooms = cf_ReadInt(fp);
if (version < 62) {
cfseek(fp, sizeof(short) * max_rooms * max_rooms, SEEK_CUR);
cfseek(fp, sizeof(int16_t) * max_rooms * max_rooms, SEEK_CUR);
mprintf((0, "We will need to remake boa. New cost structure added\n"));
BOA_AABB_checksum = BOA_mine_checksum = 0;
@ -3056,7 +3056,7 @@ void ReadBOAChunk(CFILE *fp, int version) {
ASSERT(max_rooms - 1 <= MAX_ROOMS + 8);
if (version < 110 || (max_path_portals != MAX_PATH_PORTALS)) {
cfseek(fp, sizeof(short) * max_rooms * max_rooms + max_rooms * max_path_portals * sizeof(float), SEEK_CUR);
cfseek(fp, sizeof(int16_t) * max_rooms * max_rooms + max_rooms * max_path_portals * sizeof(float), SEEK_CUR);
if (version >= 107) {
// Read BOA terrain info (temporary, just so vis data works with multiplay)
@ -3144,15 +3144,15 @@ void ReadRoomAABBChunk(CFILE *fp, int version) {
Rooms[i].bbf_max_xyz.z = cf_ReadFloat(fp);
Rooms[i].num_bbf_regions = cf_ReadShort(fp);
Rooms[i].num_bbf = (short *)mem_malloc(sizeof(short) * Rooms[i].num_bbf_regions);
Rooms[i].bbf_list = (short **)mem_malloc(sizeof(short *) * Rooms[i].num_bbf_regions);
Rooms[i].num_bbf = (int16_t *)mem_malloc(sizeof(int16_t) * Rooms[i].num_bbf_regions);
Rooms[i].bbf_list = (int16_t **)mem_malloc(sizeof(int16_t *) * Rooms[i].num_bbf_regions);
Rooms[i].bbf_list_min_xyz = (vector *)mem_malloc(sizeof(vector) * Rooms[i].num_bbf_regions);
Rooms[i].bbf_list_max_xyz = (vector *)mem_malloc(sizeof(vector) * Rooms[i].num_bbf_regions);
Rooms[i].bbf_list_sector = (uint8_t *)mem_malloc(sizeof(char) * Rooms[i].num_bbf_regions);
for (j = 0; j < Rooms[i].num_bbf_regions; j++) {
Rooms[i].num_bbf[j] = cf_ReadShort(fp);
Rooms[i].bbf_list[j] = (short *)mem_malloc(sizeof(short) * Rooms[i].num_bbf[j]);
Rooms[i].bbf_list[j] = (int16_t *)mem_malloc(sizeof(int16_t) * Rooms[i].num_bbf[j]);
}
for (j = 0; j < Rooms[i].num_bbf_regions; j++) {

View File

@ -695,7 +695,7 @@ inline void AppendToLevelChecksum(uint16_t val) {
Level_md5->update(val);
}
inline void AppendToLevelChecksum(short val) {
inline void AppendToLevelChecksum(int16_t val) {
if (!Level_md5) {
return;
}

View File

@ -444,7 +444,7 @@ typedef void DLLFUNCCALL (*ShutdownDLL_fp)(void);
typedef int DLLFUNCCALL (*GetGOScriptID_fp)(const char *name, uint8_t isdoor);
typedef void DLLFUNCCALL *(*CreateInstance_fp)(int id);
typedef void DLLFUNCCALL (*DestroyInstance_fp)(int id, void *ptr);
typedef short DLLFUNCCALL (*CallInstanceEvent_fp)(int id, void *ptr, int event, tOSIRISEventInfo *data);
typedef int16_t DLLFUNCCALL (*CallInstanceEvent_fp)(int id, void *ptr, int event, tOSIRISEventInfo *data);
typedef int DLLFUNCCALL (*GetTriggerScriptID_fp)(int trigger_room, int trigger_face);
typedef int DLLFUNCCALL (*GetCOScriptList_fp)(int **list, int **id_list);
typedef int DLLFUNCCALL (*SaveRestoreState_fp)(void *file_ptr, uint8_t saving_state);
@ -454,7 +454,7 @@ typedef void(DLLFUNCCALL *ShutdownDLL_fp)(void);
typedef int(DLLFUNCCALL *GetGOScriptID_fp)(const char *name, uint8_t isdoor);
typedef void *(DLLFUNCCALL *CreateInstance_fp)(int id);
typedef void(DLLFUNCCALL *DestroyInstance_fp)(int id, void *ptr);
typedef short(DLLFUNCCALL *CallInstanceEvent_fp)(int id, void *ptr, int event, tOSIRISEventInfo *data);
typedef int16_t(DLLFUNCCALL *CallInstanceEvent_fp)(int id, void *ptr, int event, tOSIRISEventInfo *data);
typedef int(DLLFUNCCALL *GetTriggerScriptID_fp)(int trigger_room, int trigger_face);
typedef int(DLLFUNCCALL *GetCOScriptList_fp)(int **list, int **id_list);
typedef int(DLLFUNCCALL *SaveRestoreState_fp)(void *file_ptr, uint8_t saving_state);
@ -1995,7 +1995,7 @@ bool Osiris_CallLevelEvent(int event, tOSIRISEventInfo *data) {
if (instance) {
data->me_handle = OBJECT_HANDLE_NONE; // its a level script!...no me
short ret;
int16_t ret;
ret = OSIRIS_loaded_modules[dll_id].CallInstanceEvent(0, instance, event, data);
if (aux_event != -1) {
@ -2058,7 +2058,7 @@ bool Osiris_CallTriggerEvent(int trignum, int event, tOSIRISEventInfo *ei) {
instance = Triggers[trignum].osiris_script.script_instance;
if (instance) {
short ret;
int16_t ret;
ret = OSIRIS_loaded_modules[dll_id].CallInstanceEvent(script_id, instance, event, ei);
if (aux_event != -1) {
@ -2144,7 +2144,7 @@ bool Osiris_CallEvent(object *obj, int event, tOSIRISEventInfo *data) {
int dll_id;
int aux_event = -1; // event value
tOSIRISScript *os;
short ret = CONTINUE_CHAIN | CONTINUE_DEFAULT;
int16_t ret = CONTINUE_CHAIN | CONTINUE_DEFAULT;
if (event == EVT_AI_NOTIFY) {
switch (data->evt_ai_notify.notify_type) {

View File

@ -2022,8 +2022,8 @@ typedef struct tDeathSeq {
poly_model *dying_model;
short fate;
short breakup_count;
int16_t fate;
int16_t breakup_count;
float initial_death_time;
float time_dying;
float max_time_dying;

View File

@ -263,7 +263,7 @@ void SlewResetOrient(object *obj) {
// Moves the object for one frame
int SlewFrame(object *obj, int movement_limitations) {
static short old_joy_x = 0, old_joy_y = 0; // position last time around
static int16_t old_joy_x = 0, old_joy_y = 0; // position last time around
int ret_flags = 0;
vector svel, movement; // scaled velocity (per this frame)
matrix rotmat, new_pm;
@ -325,9 +325,9 @@ int SlewFrame(object *obj, int movement_limitations) {
rottime.x = key_timep1 - key_timep0;
rottime.y = key_timeh1 - key_timeh0;
rottime.z = key_timeb1 - key_timeb0;
rotang.p = (short)(65536.0 * rottime.x * ROT_SPEED * Slew_key_speed);
rotang.h = (short)(65536.0 * rottime.y * ROT_SPEED * Slew_key_speed);
rotang.b = (short)(65536.0 * rottime.z * ROT_SPEED * Slew_key_speed);
rotang.p = (int16_t)(65536.0 * rottime.x * ROT_SPEED * Slew_key_speed);
rotang.h = (int16_t)(65536.0 * rottime.y * ROT_SPEED * Slew_key_speed);
rotang.b = (int16_t)(65536.0 * rottime.z * ROT_SPEED * Slew_key_speed);
// joystick movement
#ifdef EDITOR

View File

@ -411,12 +411,12 @@ void RenderBmpStatic(tceffect *tce, float frametime, int xoff, int yoff, bool ok
BltBmpToScreen(tce->pos_x + glitch_dx + xoff, tce->pos_y + glitch_dy + yoff, &tce->bmpinfo.chunk_bmp);
tce->age += frametime;
}
void BlurBitmapArea(uint16_t *srcbm, uint16_t *dstbm, short width, short height, short startx, short starty, short bmw) {
void BlurBitmapArea(uint16_t *srcbm, uint16_t *dstbm, int16_t width, int16_t height, int16_t startx, int16_t starty, int16_t bmw) {
int pixel_count, blue_total, red_total, green_total;
pixel_count = width * height;
blue_total = red_total = green_total = 0;
short x, y;
short pos;
int16_t x, y;
int16_t pos;
if (!pixel_count)
return;

View File

@ -1865,14 +1865,14 @@ int FireWeaponFromObject(object *obj, int weapon_num, int gun_num, bool f_force_
float diff_scale = DIFF_LEVEL / (MAX_DIFFICULTY_LEVELS - 1);
float fs = (MAX_FIRE_SPREAD * (1.0f - diff_scale)) + (MIN_FIRE_SPREAD * diff_scale);
short fire_spread = obj->ai_info->fire_spread * fs;
int16_t fire_spread = obj->ai_info->fire_spread * fs;
if ((obj->control_type == CT_AI && ((obj->ai_info->flags & AIF_TEAM_MASK) != AIF_TEAM_REBEL)) &&
fire_spread < Diff_ai_min_fire_spread[DIFF_LEVEL] * fs) {
fire_spread = Diff_ai_min_fire_spread[DIFF_LEVEL] * fs;
}
short half_fire_spread = fire_spread >> 1;
int16_t half_fire_spread = fire_spread >> 1;
if (fire_spread > 0) {
p = (ps_rand() % fire_spread) - half_fire_spread;

View File

@ -136,7 +136,7 @@ void ambient_life::ALReset() {
void ambient_life::SaveData(CFILE *fp) {
int i, j;
short len;
int16_t len;
cf_WriteInt(fp, AL_VERSION);

View File

@ -508,7 +508,7 @@ typedef struct ai_move_path {
vector pos;
matrix orient;
short path_id;
int16_t path_id;
} ai_move_path;
typedef struct path_information {
@ -550,7 +550,7 @@ typedef struct goal_enabler {
// plus it would make sure the our slots do not fill up in bad or degenerate ways.
typedef struct gi_fire {
short cur_wb; // for ranged attack
int16_t cur_wb; // for ranged attack
uint8_t cur_mask; // for ranged attack
uint8_t melee_number; // this could be union'ed but it makes this struct word aligned
} gi_fire;
@ -583,15 +583,15 @@ typedef struct {
typedef struct {
float rad;
short flags;
int16_t flags;
char parent_ap;
char child_ap;
} g_attach;
typedef struct {
short start_node;
short end_node;
short cur_node;
int16_t start_node;
int16_t end_node;
int16_t cur_node;
} g_static_path;
typedef struct goal_info {
@ -716,14 +716,14 @@ typedef struct ain_weapon_hit_info {
typedef struct ai_mem {
// Computed at end of memory frame
float shields;
short num_enemies;
short num_friends;
int16_t num_enemies;
int16_t num_friends;
// Incremented during the memory frame
short num_times_hit;
short num_enemy_shots_fired;
short num_hit_enemy;
short num_enemy_shots_dodged;
int16_t num_times_hit;
int16_t num_enemy_shots_fired;
int16_t num_hit_enemy;
int16_t num_enemy_shots_dodged;
} ai_mem;
//-------------------------------------------------
@ -757,7 +757,7 @@ typedef struct ai_frame {
int sound[MAX_AI_SOUNDS]; // AI sounds,
float last_sound_time[MAX_AI_SOUNDS];
short last_played_sound_index;
int16_t last_played_sound_index;
char movement_type;
char movement_subtype;
@ -869,8 +869,8 @@ public:
vector pos[MAX_NODES];
int roomnum[MAX_NODES];
short num_nodes;
short use_count;
int16_t num_nodes;
int16_t use_count;
int owner_handle;
};

View File

@ -41,10 +41,10 @@ typedef struct {
int sample_length;
int np_sample_length;
int samples_per_second;
short bits_per_sample;
short number_channels;
int16_t bits_per_sample;
int16_t number_channels;
uint8_t *sample_8bit;
short *sample_16bit;
int16_t *sample_16bit;
} tWaveFile;
// returns:
@ -509,8 +509,8 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) {
// Sound format information
int samples_per_second;
short bits_per_sample;
short number_channels;
int16_t bits_per_sample;
int16_t number_channels;
char error_code = 0;
// Used to read temporary long values
@ -728,7 +728,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) {
wave->sample_length = cksize / 2 + num_needed / 2;
}
wave->sample_16bit = (short *)mem_malloc(cksize + num_needed);
wave->sample_16bit = (int16_t *)mem_malloc(cksize + num_needed);
cf_ReadBytes((uint8_t *)wave->sample_16bit, cksize, cfptr);
for (count = 0; count < (int)cksize / 2; count++) {
@ -757,12 +757,12 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) {
if (wave->sample_16bit == NULL) {
ASSERT(wave->sample_8bit);
wave->sample_16bit = (short *)mem_malloc(wave->sample_length * sizeof(short));
wave->sample_16bit = (int16_t *)mem_malloc(wave->sample_length * sizeof(int16_t));
// NOTE: Interesting note on sound conversion: 16 bit sounds are signed (0 biase). 8 bit sounds are unsigned
// (+128 biase).
for (count = 0; count < (int)wave->sample_length; count++) {
wave->sample_16bit[count] = (((short)wave->sample_8bit[count]) - 128) * 256;
wave->sample_16bit[count] = (((int16_t)wave->sample_8bit[count]) - 128) * 256;
}
mem_free(wave->sample_8bit);

View File

@ -504,8 +504,8 @@ void BNode_ClearBNodeInfo(void) {
}
// Unused?
bool BNode_MakeSubPath(short sroom, short spnt, short eroom, short epnt, int flags, float size, short *roomlist,
short *pnts, int max_elements) {
bool BNode_MakeSubPath(int16_t sroom, int16_t spnt, int16_t eroom, int16_t epnt, int flags, float size, int16_t *roomlist,
int16_t *pnts, int max_elements) {
return false;
}

View File

@ -80,11 +80,11 @@
#define MAX_BNODES_PER_ROOM 127
typedef struct bn_edge {
short end_room;
int16_t end_room;
char end_index;
short flags;
short cost;
int16_t flags;
int16_t cost;
float max_rad;
} bn_edge;

View File

@ -67,8 +67,8 @@ typedef struct {
int nv;
bspplane plane;
short roomnum;
short facenum;
int16_t roomnum;
int16_t facenum;
int8_t subnum;
int color;

View File

@ -556,8 +556,8 @@ static void config_gamma() {
newuiTiledWindow gamma_wnd;
newuiSheet *sheet;
tSliderSettings slider_set;
short *gamma_slider;
short curpos;
int16_t *gamma_slider;
int16_t curpos;
int res, gamma_bitmap = -1;
float init_gamma;
@ -772,11 +772,11 @@ struct sound_menu {
newuiMenu *parent_menu;
int ls_sound_id, sound_id;
short *fxvolume, *musicvolume; // volume sliders
short *fxquantity; // sound fx quantity limit
int16_t *fxvolume, *musicvolume; // volume sliders
int16_t *fxquantity; // sound fx quantity limit
int *fxquality; // sfx quality low/high
short old_fxquantity;
int16_t old_fxquantity;
#ifdef _DEBUG
int *sndmixer;
@ -796,10 +796,10 @@ struct sound_menu {
sheet->NewGroup(NULL, 0, 0);
slider_set.type = SLIDER_UNITS_PERCENT;
fxvolume = sheet->AddSlider(TXT_SOUNDVOL, 10, (short)(Sound_system.GetMasterVolume() * 10), &slider_set);
fxvolume = sheet->AddSlider(TXT_SOUNDVOL, 10, (int16_t)(Sound_system.GetMasterVolume() * 10), &slider_set);
slider_set.type = SLIDER_UNITS_PERCENT;
musicvolume = sheet->AddSlider(TXT_SNDMUSVOL, 10, (short)(D3MusicGetVolume() * 10), &slider_set);
musicvolume = sheet->AddSlider(TXT_SNDMUSVOL, 10, (int16_t)(D3MusicGetVolume() * 10), &slider_set);
// sound fx quality radio list.
if (GetFunctionMode() != GAME_MODE && GetFunctionMode() != EDITOR_GAME_MODE) {
@ -1184,7 +1184,7 @@ struct details_menu {
int *objcomp; // object complexity radio
bool *specmap, *headlight, *mirror, // check boxes
*dynamic, *fog, *coronas, *procedurals, *powerup_halo, *scorches, *weapon_coronas;
short *pixel_err, // 0-27 (1-28)
int16_t *pixel_err, // 0-27 (1-28)
*rend_dist; // 0-120 (80-200)
int *texture_quality;
@ -1323,12 +1323,12 @@ void details_menu::set_preset_details(int setting) {
iTemp = MAXIMUM_TERRAIN_DETAIL - ds.Pixel_error - MINIMUM_TERRAIN_DETAIL;
if (iTemp < 0)
iTemp = 0;
*pixel_err = (short)(iTemp);
*pixel_err = (int16_t)(iTemp);
iTemp = (int)((ds.Terrain_render_distance / ((float)TERRAIN_SIZE)) - MINIMUM_RENDER_DIST);
if (iTemp < 0)
iTemp = 0;
iTemp = iTemp / 2;
*rend_dist = (short)(iTemp);
*rend_dist = (int16_t)(iTemp);
*objcomp = ds.Object_complexity;
*specmap = ds.Specular_lighting;
*headlight = ds.Fast_headlight_on;

View File

@ -299,7 +299,7 @@
// used for adjusting settings.
#define CFG_AXIS_SENS_RANGE 20
const short UID_JOYCFG = 0x1000;
const int16_t UID_JOYCFG = 0x1000;
// Setup of config screens.
@ -403,8 +403,8 @@ t_cfg_element Cfg_joy_elements[] = {{-1, CtlText_WeaponGroup, CCITEM_WPN_X2, CCI
{ctfBANK_RIGHTBUTTON, CtlText_BankRight, 0, 0}};
#define N_JOY_CFG_FN (sizeof(Cfg_joy_elements) / sizeof(t_cfg_element))
#define N_KEY_CFG_FN (sizeof(Cfg_key_elements) / sizeof(t_cfg_element))
static void ctl_cfg_set_and_verify_changes(short fnid, ct_type elem_type, uint8_t controller, uint8_t elem, int8_t slot);
static void ctl_cfg_element_options_dialog(short fnid);
static void ctl_cfg_set_and_verify_changes(int16_t fnid, ct_type elem_type, uint8_t controller, uint8_t elem, int8_t slot);
static void ctl_cfg_element_options_dialog(int16_t fnid);
// used for adjusting settings.
static int weapon_select_dialog(int wpn, bool is_secondary);
#define UID_KEYCFG_ID 0x1000
@ -473,9 +473,9 @@ void key_cfg_screen::process(int res) {
int8_t slot;
ct_type elem_type;
if (m_elem[i].GetActiveSlot() == CFGELEM_SLOT_CLEAR) {
ctl_cfg_element_options_dialog((short)(res - UID_KEYCFG_ID));
ctl_cfg_element_options_dialog((int16_t)(res - UID_KEYCFG_ID));
} else if (m_elem[i].Configure(&elem_type, &controller, &elem, &slot)) {
ctl_cfg_set_and_verify_changes((short)(res - UID_KEYCFG_ID), elem_type, controller, elem, slot);
ctl_cfg_set_and_verify_changes((int16_t)(res - UID_KEYCFG_ID), elem_type, controller, elem, slot);
}
break;
}
@ -581,9 +581,9 @@ void joy_cfg_screen::process(int res) {
int8_t slot;
ct_type elem_type;
if (m_elem[i].GetActiveSlot() == CFGELEM_SLOT_CLEAR) {
ctl_cfg_element_options_dialog((short)(res - UID_JOYCFG_ID));
ctl_cfg_element_options_dialog((int16_t)(res - UID_JOYCFG_ID));
} else if (m_elem[i].Configure(&elem_type, &controller, &elem, &slot)) {
ctl_cfg_set_and_verify_changes((short)(res - UID_JOYCFG_ID), elem_type, controller, elem, slot);
ctl_cfg_set_and_verify_changes((int16_t)(res - UID_JOYCFG_ID), elem_type, controller, elem, slot);
}
break;
}
@ -898,7 +898,7 @@ void wpnsel_cfg_screen::unrealize() {
}
//////////////////////////////////////////////////////////////////////////////
// this will take out any repeats of element and slot in function id.
void ctl_cfg_set_and_verify_changes(short fnid, ct_type elem_type, uint8_t ctrl, uint8_t elem, int8_t slot) {
void ctl_cfg_set_and_verify_changes(int16_t fnid, ct_type elem_type, uint8_t ctrl, uint8_t elem, int8_t slot) {
ct_type ctype_fn[CTLBINDS_PER_FUNC];
uint8_t cfgflags_fn[CTLBINDS_PER_FUNC];
ct_config_data ccfgdata_fn;
@ -966,7 +966,7 @@ void ctl_cfg_set_and_verify_changes(short fnid, ct_type elem_type, uint8_t ctrl,
Controller->set_controller_function(fnid, ctype_fn, ccfgdata_fn, cfgflags_fn);
}
// used as a help/options dialog for each controller config element
void ctl_cfg_element_options_dialog(short fnid) {
void ctl_cfg_element_options_dialog(int16_t fnid) {
newuiTiledWindow wnd;
newuiSheet *sheet;
int *inv_binding[CTLBINDS_PER_FUNC];
@ -1137,12 +1137,12 @@ void joystick_settings_dialog() {
newuiTiledWindow wnd;
newuiSheet *sheet;
int res, i, y;
short curpos;
int16_t curpos;
tSliderSettings slider_set;
char axis_str[N_JOY_AXIS] = {'X', 'Y', 'Z', 'R', 'U', 'V'};
short *joy_sens[N_JOY_AXIS];
short *mse_sens[N_MOUSE_AXIS];
short *ff_gain = NULL;
int16_t *joy_sens[N_JOY_AXIS];
int16_t *mse_sens[N_MOUSE_AXIS];
int16_t *ff_gain = NULL;
bool *ff_enabled = NULL;
bool *ff_auto_center = NULL;
bool ff_auto_center_support = false;
@ -1208,7 +1208,7 @@ void joystick_settings_dialog() {
// ----------------------------------------------
ff_auto_center = sheet->AddLongCheckBox(TXT_CFG_FFAUTOCENTER, ForceIsAutoCenter());
}
curpos = (short)(ForceGetGain() * 50.0f);
curpos = (int16_t)(ForceGetGain() * 50.0f);
slider_set.type = SLIDER_UNITS_PERCENT;
ff_gain = sheet->AddSlider(TXT_CFG_FORCEGAIN, 50, curpos, &slider_set);
}
@ -1265,9 +1265,9 @@ void key_settings_dialog() {
newuiTiledWindow wnd;
newuiSheet *sheet;
int res;
short curpos;
int16_t curpos;
tSliderSettings slider_set;
short *key_ramp_speed;
int16_t *key_ramp_speed;
wnd.Create(TXT_KEYSETTINGS, 0, 0, 384, 256);
sheet = wnd.GetSheet();
sheet->NewGroup(NULL, 0, 30);
@ -1301,7 +1301,7 @@ typedef struct t_ctlcfgswitchcb_data {
cfg_screen *curcfg;
} t_ctlcfgswitchcb_data;
// called when we switch menus
void CtlConfigSwitchCB(newuiMenu *menu, short old_option_id, short new_option_id, void *data) {
void CtlConfigSwitchCB(newuiMenu *menu, int16_t old_option_id, int16_t new_option_id, void *data) {
t_ctlcfgswitchcb_data *cfgdata = (t_ctlcfgswitchcb_data *)data;
// performs custom gadget deinitialization and reinitilization
if (cfgdata->curcfg) {

View File

@ -53,15 +53,17 @@
#ifndef CTLCONFIG_H
#define CTLCONFIG_H
#include <cstdint>
#define CTLCONFIG_KEYBOARD 0
#define CTLCONFIG_CONTROLLER 1
#define CTLCONFIG_WPNSEL 2
typedef struct t_cfg_element {
short fn_id; // -1 = group start
short text; // text string id.
short x;
short y; // location (for groups only)
int16_t fn_id; // -1 = group start
int16_t text; // text string id.
int16_t x;
int16_t y; // location (for groups only)
} t_cfg_element;
extern t_cfg_element Cfg_key_elements[];

View File

@ -468,7 +468,7 @@ void DemoWriteChangedObj(object *op) {
}
void DemoWriteWeaponFire(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum,
uint16_t weapobjnum, short gunnum) {
uint16_t weapobjnum, int16_t gunnum) {
uint32_t uniqueid = MultiGetMatchChecksum(OBJ_WEAPON, weaponnum);
if (weapobjnum == -1)
return;
@ -558,7 +558,7 @@ void DemoReadTurretChanged(void) {
float do_time;
do_time = cf_ReadFloat(Demo_cfp);
short old_objnum = cf_ReadShort(Demo_cfp);
int16_t old_objnum = cf_ReadShort(Demo_cfp);
objnum = Demo_obj_map[old_objnum];
turr_time = cf_ReadFloat(Demo_cfp);
@ -631,12 +631,12 @@ void DemoWriteKillObject(object *hit_obj, object *killer, float damage, int deat
}
void DemoReadKillObject(void) {
short hit_objnum = cf_ReadShort(Demo_cfp);
short killer = cf_ReadShort(Demo_cfp);
int16_t hit_objnum = cf_ReadShort(Demo_cfp);
int16_t killer = cf_ReadShort(Demo_cfp);
float damage = cf_ReadFloat(Demo_cfp);
int death_flags = cf_ReadInt(Demo_cfp);
float delay = cf_ReadFloat(Demo_cfp);
short seed = cf_ReadShort(Demo_cfp);
int16_t seed = cf_ReadShort(Demo_cfp);
if (!(IS_GENERIC(Objects[hit_objnum].type) || (Objects[hit_objnum].type == OBJ_DOOR)))
return; // bail if invalid object type
@ -653,13 +653,13 @@ void DemoWritePlayerDeath(object *player, bool melee, int fate) {
}
void DemoReadPlayerDeath(void) {
short playernum = cf_ReadShort(Demo_cfp);
int16_t playernum = cf_ReadShort(Demo_cfp);
uint8_t melee = cf_ReadByte(Demo_cfp);
int fate = cf_ReadInt(Demo_cfp);
InitiatePlayerDeath(&Objects[playernum], melee ? true : false, fate);
}
void DemoWrite2DSound(short soundidx, float volume) {
void DemoWrite2DSound(int16_t soundidx, float volume) {
cf_WriteByte(Demo_cfp, DT_2D_SOUND);
cf_WriteShort(Demo_cfp, soundidx);
cf_WriteFloat(Demo_cfp, volume);
@ -672,7 +672,7 @@ void DemoRead2DSound(void) {
Sound_system.Play2dSound(soundidx, volume);
}
void DemoWrite3DSound(short soundidx, uint16_t objnum, int priority, float volume) {
void DemoWrite3DSound(int16_t soundidx, uint16_t objnum, int priority, float volume) {
cf_WriteByte(Demo_cfp, DT_3D_SOUND);
cf_WriteShort(Demo_cfp, objnum);
cf_WriteShort(Demo_cfp, soundidx);
@ -681,7 +681,7 @@ void DemoWrite3DSound(short soundidx, uint16_t objnum, int priority, float volum
void DemoRead3DSound(void) {
int objnum;
short soundidx;
int16_t soundidx;
float volume;
objnum = cf_ReadShort(Demo_cfp);
@ -737,7 +737,7 @@ int DemoPlaybackFile(char *filename) {
extern bool IsRestoredGame;
int DemoReadHeader() {
char szsig[10];
short ver;
int16_t ver;
char demo_mission[_MAX_PATH];
int level_num;
int frame_count;
@ -892,7 +892,7 @@ int DemoReadHeader() {
}
void DemoReadObj() {
short objnum;
int16_t objnum;
object *obj;
vector pos;
matrix orient;
@ -945,7 +945,7 @@ void DemoReadWeaponFire() {
float gametime;
uint32_t uniqueid;
object *obj;
short weaponnum, objnum, weapobjnum;
int16_t weaponnum, objnum, weapobjnum;
vector laser_pos, laser_dir;
// Mass driver is hack
@ -969,7 +969,7 @@ void DemoReadWeaponFire() {
}
gametime = cf_ReadFloat(Demo_cfp);
short old_objnum = cf_ReadShort(Demo_cfp);
int16_t old_objnum = cf_ReadShort(Demo_cfp);
objnum = Demo_obj_map[old_objnum];
obj = &Objects[objnum];
ASSERT(Objects[objnum].type != OBJ_NONE);
@ -981,7 +981,7 @@ void DemoReadWeaponFire() {
laser_dir = dir;
weaponnum = MultiMatchWeapon(uniqueid);
weapobjnum = cf_ReadShort(Demo_cfp);
short gunnum = cf_ReadShort(Demo_cfp);
int16_t gunnum = cf_ReadShort(Demo_cfp);
ASSERT(uniqueid != 0xffffffff);
ASSERT(dir != Zero_vector);
@ -1007,7 +1007,7 @@ void DemoReadWeaponFire() {
weapobjnum));
Demo_obj_map[weapobjnum] = new_weap_objnum;
short weapon_num = weaponnum;
int16_t weapon_num = weaponnum;
if (Weapons[weapon_num].sounds[WSI_FLYING] != SOUND_NONE_INDEX)
Sound_system.Play3dSound(Weapons[weapon_num].sounds[WSI_FLYING], &Objects[objnum]);
@ -1104,7 +1104,7 @@ void DemoReadObjCreate() {
matrix orient;
vector pos;
int roomnum;
short id;
int16_t id;
int parent_handle;
object *obj;
@ -1137,11 +1137,11 @@ void DemoReadObjCreate() {
Int3(); // What is this?
}
short new_objnum = ObjCreate(type, id, roomnum, &pos, use_orient ? &orient : NULL, parent_handle);
int16_t new_objnum = ObjCreate(type, id, roomnum, &pos, use_orient ? &orient : NULL, parent_handle);
if (new_objnum > -1) { // DAJ -1FIX
obj = &Objects[new_objnum];
short oldobjnum = cf_ReadShort(Demo_cfp);
int16_t oldobjnum = cf_ReadShort(Demo_cfp);
Demo_obj_map[oldobjnum] = new_objnum;
// MSAFE needs this list too
Server_object_list[oldobjnum] = new_objnum;
@ -1368,8 +1368,8 @@ void DemoReadCollidePlayerWeapon(void) {
vector collision_n;
bool f_reverse_normal;
uint16_t real_weapnum;
short plr_objnum = cf_ReadShort(Demo_cfp);
short wep_objnum = cf_ReadShort(Demo_cfp);
int16_t plr_objnum = cf_ReadShort(Demo_cfp);
int16_t wep_objnum = cf_ReadShort(Demo_cfp);
gs_ReadVector(Demo_cfp, collision_p);
gs_ReadVector(Demo_cfp, collision_n);
uint8_t b = cf_ReadByte(Demo_cfp);
@ -1399,8 +1399,8 @@ void DemoReadCollideGenericWeapon(void) {
vector collision_n;
bool f_reverse_normal;
uint16_t real_weapnum;
short gen_objnum = cf_ReadShort(Demo_cfp);
short wep_objnum = cf_ReadShort(Demo_cfp);
int16_t gen_objnum = cf_ReadShort(Demo_cfp);
int16_t wep_objnum = cf_ReadShort(Demo_cfp);
gs_ReadVector(Demo_cfp, collision_p);
gs_ReadVector(Demo_cfp, collision_n);
uint8_t b = cf_ReadByte(Demo_cfp);
@ -1470,9 +1470,9 @@ void DemoWriteAttachObjRad(object *parent, char parent_ap, object *child, float
}
void DemoReadAttachObjRad(void) {
short old_objnum;
short parent_num;
short child_num;
int16_t old_objnum;
int16_t parent_num;
int16_t child_num;
char parent_ap;
float rad;
old_objnum = cf_ReadShort(Demo_cfp);
@ -1494,9 +1494,9 @@ void DemoWriteAttachObj(object *parent, char parent_ap, object *child, char chil
}
void DemoReadAttachObj(void) {
short old_objnum;
short parent_num;
short child_num;
int16_t old_objnum;
int16_t parent_num;
int16_t child_num;
char parent_ap;
char child_ap;
bool f_aligned;
@ -1516,8 +1516,8 @@ void DemoWriteUnattachObj(object *child) {
}
void DemoReadUnattachObj(void) {
short old_objnum = cf_ReadShort(Demo_cfp);
short unattach_objnum = Demo_obj_map[old_objnum];
int16_t old_objnum = cf_ReadShort(Demo_cfp);
int16_t unattach_objnum = Demo_obj_map[old_objnum];
UnattachFromParent(&Objects[unattach_objnum]);
}
@ -1593,15 +1593,15 @@ void DemoPostPlaybackMenu(void) {
// Game_paused = false;
}
void DemoWriteObjWeapFireFlagChanged(short objnum) {
void DemoWriteObjWeapFireFlagChanged(int16_t objnum) {
cf_WriteByte(Demo_cfp, DT_WEAP_FIRE_FLAG);
cf_WriteShort(Demo_cfp, objnum);
cf_WriteByte(Demo_cfp, Objects[objnum].weapon_fire_flags);
}
void DemoReadObjWeapFireFlagChanged(void) {
short oldobjnum = cf_ReadShort(Demo_cfp);
short newobjnum = Demo_obj_map[oldobjnum];
int16_t oldobjnum = cf_ReadShort(Demo_cfp);
int16_t newobjnum = Demo_obj_map[oldobjnum];
Objects[newobjnum].weapon_fire_flags = cf_ReadByte(Demo_cfp);
}
@ -1746,8 +1746,8 @@ void DemoWriteSetObjDead(object *obj) {
}
void DemoReadSetObjDead() {
short oldobjnum = cf_ReadShort(Demo_cfp);
short local_objnum = Demo_obj_map[oldobjnum];
int16_t oldobjnum = cf_ReadShort(Demo_cfp);
int16_t local_objnum = Demo_obj_map[oldobjnum];
Objects[local_objnum].flags |= OF_SERVER_SAYS_DELETE;
SetObjectDeadFlag(&Objects[local_objnum]);
@ -1868,8 +1868,8 @@ void DemoWriteObjLifeLeft(object *obj) {
}
void DemoReadObjLifeLeft(void) {
short oldobjnum = cf_ReadShort(Demo_cfp);
short local_objnum = Demo_obj_map[oldobjnum];
int16_t oldobjnum = cf_ReadShort(Demo_cfp);
int16_t local_objnum = Demo_obj_map[oldobjnum];
if (cf_ReadByte(Demo_cfp)) {
Objects[local_objnum].flags |= OF_USES_LIFELEFT;

View File

@ -442,7 +442,7 @@ void ShowStaticScreen(char *bitmap_filename, bool timed = false, float delay_tim
extern int CD_inserted;
char Proxy_server[200] = "";
short Proxy_port = 80;
int16_t Proxy_port = 80;
void Descent3() {
int type;

View File

@ -126,7 +126,7 @@ typedef struct {
uint8_t used; // if this door is in use
uint8_t flags; // flags for this door
uint8_t pad; // keep alignment (pagename is 35 chars long)
short hit_points; // for blastable doors
int16_t hit_points; // for blastable doors
float total_open_time; // time of animation to open door
float total_close_time; // time of animation to close door
float total_time_open; // how much time to stay open

View File

@ -1789,7 +1789,7 @@ void MakeShockwave(object *explode_obj_ptr, int parent_handle) {
DoConcussiveForce(explode_obj_ptr, parent_handle);
}
}
// object *object_create_explosion_sub(object *explode_obj_ptr, short segnum, vms_vector * position, fix size, int
// object *object_create_explosion_sub(object *explode_obj_ptr, int16_t segnum, vms_vector * position, fix size, int
// vclip_type, fix maxdamage, fix maxdistance, fix maxforce, int parent )
void DoConcussiveForce(object *explode_obj_ptr, int parent_handle, float player_scalar) {
int objnum;
@ -1798,7 +1798,7 @@ void DoConcussiveForce(object *explode_obj_ptr, int parent_handle, float player_
float maxforce = explode_obj_ptr->impact_force;
float maxdistance = explode_obj_ptr->impact_size;
float effect_distance;
short parent;
int16_t parent;
object *parent_obj;
if (explode_obj_ptr->type == OBJ_SHOCKWAVE) {
effect_distance =

View File

@ -184,7 +184,7 @@ typedef struct {
uint8_t tex_size; // What size texture to use for this animation
float total_life; // How long this animation should last (in seconds)
float size; // How big this explosion is
short bm_handle; // The handle to the vlip
int16_t bm_handle; // The handle to the vlip
} fireball;
extern fireball Fireballs[];

View File

@ -2209,13 +2209,13 @@ void Cinematic_StartCanned(tCannedCinematicInfo *info, int camera_handle) {
// Demo file support
//==================================================
static void mf_WriteInt(uint8_t *buffer, int *pointer, int data);
static void mf_WriteShort(uint8_t *buffer, int *pointer, short data);
static void mf_WriteShort(uint8_t *buffer, int *pointer, int16_t data);
static void mf_WriteByte(uint8_t *buffer, int *pointer, uint8_t data);
static void mf_WriteFloat(uint8_t *buffer, int *pointer, float data);
static void mf_WriteBytes(uint8_t *buffer, int *pointer, uint8_t *data, int len);
static void mf_WriteString(uint8_t *buffer, int *pointer, const char *string);
static int mf_ReadInt(uint8_t *buffer, int *pointer);
static short mf_ReadShort(uint8_t *buffer, int *pointer);
static int16_t mf_ReadShort(uint8_t *buffer, int *pointer);
static uint8_t mf_ReadByte(uint8_t *buffer, int *pointer);
static float mf_ReadFloat(uint8_t *buffer, int *pointer);
static void mf_ReadBytes(uint8_t *buffer, int *pointer, uint8_t *data, int len);
@ -2415,9 +2415,9 @@ void mf_WriteInt(uint8_t *buffer, int *pointer, int data) {
(*pointer) += sizeof(int);
}
void mf_WriteShort(uint8_t *buffer, int *pointer, short data) {
memcpy(&buffer[(*pointer)], &data, sizeof(short));
(*pointer) += sizeof(short);
void mf_WriteShort(uint8_t *buffer, int *pointer, int16_t data) {
memcpy(&buffer[(*pointer)], &data, sizeof(int16_t));
(*pointer) += sizeof(int16_t);
}
void mf_WriteByte(uint8_t *buffer, int *pointer, uint8_t data) {
@ -2450,8 +2450,8 @@ int mf_ReadInt(uint8_t *buffer, int *pointer) {
return value;
}
short mf_ReadShort(uint8_t *buffer, int *pointer) {
short value;
int16_t mf_ReadShort(uint8_t *buffer, int *pointer) {
int16_t value;
memcpy(&value, &buffer[(*pointer)], sizeof(value));
(*pointer) += sizeof(value);
return value;

View File

@ -716,7 +716,7 @@ bool LoadCurrentSaveGame() {
bool SaveGameState(const char *pathname, const char *description) {
CFILE *fp;
char buf[GAMESAVE_DESCLEN + 1];
short pending_music_region;
int16_t pending_music_region;
fp = cfopen(pathname, "wb");
if (!fp)
@ -748,7 +748,7 @@ bool SaveGameState(const char *pathname, const char *description) {
// write out gamemode information
// write out mission level information
cf_WriteShort(fp, (short)Current_mission.cur_level);
cf_WriteShort(fp, (int16_t)Current_mission.cur_level);
if (Current_mission.filename && (strcmpi("d3_2.mn3", Current_mission.filename) == 0)) {
cf_WriteString(fp, "d3.mn3");
@ -838,7 +838,7 @@ bool SaveGameState(const char *pathname, const char *description) {
void SGSXlateTables(CFILE *fp) {
START_VERIFY_SAVEFILE(fp);
// create object info translation table
short i, highest_index = -1;
int16_t i, highest_index = -1;
for (i = 0; i < MAX_OBJECT_IDS; i++)
if (Object_info[i].type != OBJ_NONE)
@ -883,7 +883,7 @@ extern uint8_t AutomapVisMap[MAX_ROOMS];
void SGSRooms(CFILE *fp) {
int i, f, p;
gs_WriteShort(fp, (short)Highest_room_index);
gs_WriteShort(fp, (int16_t)Highest_room_index);
gs_WriteShort(fp, MAX_ROOMS);
@ -951,7 +951,7 @@ void SGSEvents(CFILE *fp) {}
void SGSTriggers(CFILE *fp) {
int i;
gs_WriteShort(fp, (short)Num_triggers);
gs_WriteShort(fp, (int16_t)Num_triggers);
for (i = 0; i < Num_triggers; i++) {
gs_WriteShort(fp, Triggers[i].flags);
@ -986,7 +986,7 @@ void SGSVisEffects(CFILE *fp) {
if (VisEffects[i].type != VIS_NONE)
count++;
gs_WriteShort(fp, (short)count);
gs_WriteShort(fp, (int16_t)count);
for (i = 0; i <= Highest_vis_effect_index; i++) {
if (VisEffects[i].type != VIS_NONE)
@ -1011,14 +1011,14 @@ void SGSObjects(CFILE *fp) {
// Save marker info (text)
cf_WriteInt(fp, Marker_message);
cf_WriteShort(fp, (short)MAX_PLAYERS * 2);
cf_WriteShort(fp, (int16_t)MAX_PLAYERS * 2);
for (i = 0; i < MAX_PLAYERS * 2; i++) {
cf_WriteShort(fp, strlen(MarkerMessages[i]) + 1);
cf_WriteBytes((uint8_t *)MarkerMessages[i], strlen(MarkerMessages[i]) + 1, fp);
}
// this method should maintain the object list as it currently stands in the level
cf_WriteShort(fp, (short)Highest_object_index);
cf_WriteShort(fp, (int16_t)Highest_object_index);
// save what objects are stuck to each other
cf_WriteInt(fp, MAX_OBJECTS);
@ -1093,13 +1093,13 @@ void SGSObjects(CFILE *fp) {
cf_WriteBytes((uint8_t *)op->name, ii, fp);
// data universal to all objects that need to be saved.
gs_WriteShort(fp, (short)op->id);
gs_WriteShort(fp, (int16_t)op->id);
gs_WriteInt(fp, static_cast<int32_t>(op->flags));
gs_WriteByte(fp, (int8_t)op->control_type);
gs_WriteByte(fp, (int8_t)op->movement_type);
gs_WriteByte(fp, (int8_t)op->render_type);
gs_WriteShort(fp, (short)op->renderframe);
gs_WriteShort(fp, (int16_t)op->renderframe);
gs_WriteFloat(fp, op->size);
gs_WriteFloat(fp, op->shields);
gs_WriteByte(fp, op->contains_type);
@ -1162,7 +1162,7 @@ void SGSObjects(CFILE *fp) {
INSURE_SAVEFILE;
gs_WriteShort(fp, (short)op->position_counter);
gs_WriteShort(fp, (int16_t)op->position_counter);
INSURE_SAVEFILE;
@ -1296,7 +1296,7 @@ void SGSObjSpecial(CFILE *fp, const object *op) {}
void SGSSpew(CFILE *fp) {
int i;
gs_WriteShort(fp, (short)spew_count);
gs_WriteShort(fp, (int16_t)spew_count);
for (i = 0; i < MAX_SPEW_EFFECTS; i++) {
gs_WriteByte(fp, SpewEffects[i].inuse ? true : false);
if (SpewEffects[i].inuse)

View File

@ -102,13 +102,13 @@
#define GAMESAVE_DESCLEN 31 // gamesave description maximum length.
typedef struct gs_tables {
short model_handles[MAX_POLY_MODELS];
short obji_indices[MAX_OBJECT_IDS];
short bm_handles[MAX_BITMAPS];
short tex_handles[MAX_TEXTURES];
short door_handles[MAX_DOORS];
short ship_handles[MAX_SHIPS];
short wpn_handles[MAX_WEAPONS];
int16_t model_handles[MAX_POLY_MODELS];
int16_t obji_indices[MAX_OBJECT_IDS];
int16_t bm_handles[MAX_BITMAPS];
int16_t tex_handles[MAX_TEXTURES];
int16_t door_handles[MAX_DOORS];
int16_t ship_handles[MAX_SHIPS];
int16_t wpn_handles[MAX_WEAPONS];
} gs_tables;
// savegame version info.
@ -157,7 +157,7 @@ int LoadGameState(const char *pathname);
gs_WriteVector((_f), (_m).uvec); \
gs_WriteVector((_f), (_m).fvec); \
} while (0)
#define gs_WriteAngle(_f, _a) cf_WriteShort(_f, (short)(_a))
#define gs_WriteAngle(_f, _a) cf_WriteShort(_f, (int16_t)(_a))
#define gs_WriteByte(_f, _b) cf_WriteByte(_f, _b)
#define gs_WriteShort(_f, _s) cf_WriteShort(_f, _s)
#define gs_WriteInt(_f, _i) cf_WriteInt(_f, _i)

View File

@ -2249,7 +2249,7 @@ bool PageInSound(int id) {
if (Dedicated_server)
return false;
// sometimes, id passed was 0xffff which seems like a short -1. The if statement
// sometimes, id passed was 0xffff which seems like a int16_t -1. The if statement
// ensures that the array Sounds_to_free is dealt with properly.
if (Sound_system.CheckAndForceSoundDataAlloc(id)) {
Sounds_to_free[id] = 1;

View File

@ -260,10 +260,10 @@ typedef struct {
} static_proc_element;
typedef struct {
short dynamic_proc_elements; // list of dynamic procedural texture elements
int16_t dynamic_proc_elements; // list of dynamic procedural texture elements
void *proc1; // pointer for procedural page
void *proc2; // back page of procedural
short procedural_bitmap; // handle to the bitmap holding the finished procedural
int16_t procedural_bitmap; // handle to the bitmap holding the finished procedural
uint16_t *palette;
static_proc_element *static_proc_elements;
@ -302,7 +302,7 @@ typedef struct {
int sound; // The sound this texture makes
float sound_volume; // The volume for this texture's sound
short bumpmap; // The bumpmap for this texture, or -1 if there is none
int16_t bumpmap; // The bumpmap for this texture, or -1 if there is none
uint8_t corona_type; // what type of corona this thing uses
uint8_t used; // is this texture free to be allocated?

View File

@ -802,14 +802,14 @@ void menutga_LoadHotSpotMap(int back_bmp, const char *filename, hotspotmap_t *hs
void makecorner(int corner_bmp, int back_bmp, const char *tmap, int l, int t, int r, int b) {
int real_x, real_y, awidth, ax, ay;
short *backdata, *cornerdata;
int16_t *backdata, *cornerdata;
int back_rowsize, corner_rowsize;
awidth = r - l;
bm_ClearBitmap(corner_bmp);
backdata = (short *)bm_data(back_bmp, 0);
backdata = (int16_t *)bm_data(back_bmp, 0);
back_rowsize = bm_rowsize(back_bmp, 0);
cornerdata = (short *)bm_data(corner_bmp, 0);
cornerdata = (int16_t *)bm_data(corner_bmp, 0);
corner_rowsize = bm_rowsize(corner_bmp, 0);
backdata += (t * (back_rowsize / 2));

View File

@ -465,7 +465,7 @@ float Hud_aspect_y = 1.0f;
bool Small_hud_flag = false; // changes how hud items are drawn in small huds.
// used by reticle system.
static short Ret_x_off, Ret_y_off;
static int16_t Ret_x_off, Ret_y_off;
static char Reticle_prefix[PSFILENAME_LEN + 1];
// Hud mode of display
@ -933,24 +933,24 @@ void SGSHudState(CFILE *fp) {
huditem = &HUD_array[i];
if (huditem->stat) {
if (huditem->type == HUD_ITEM_CUSTOMTEXT2) {
cf_WriteShort(fp, (short)huditem->stat);
cf_WriteShort(fp, (int16_t)huditem->stat);
cf_WriteByte(fp, (int8_t)huditem->type);
cf_WriteShort(fp, huditem->x);
cf_WriteShort(fp, huditem->y);
cf_WriteInt(fp, huditem->color);
cf_WriteShort(fp, (short)huditem->flags);
cf_WriteShort(fp, (int16_t)huditem->flags);
cf_WriteByte(fp, (int8_t)huditem->alpha);
cf_WriteShort(fp, (short)huditem->buffer_size);
cf_WriteShort(fp, (int16_t)huditem->buffer_size);
cf_WriteString(fp, huditem->data.text);
mprintf((0, "sg: saved customtext2 (%x,%x,bufsize=%d)\n", huditem->x, huditem->y, huditem->buffer_size));
} else if (huditem->type == HUD_ITEM_TIMER) {
cf_WriteShort(fp, (short)huditem->stat);
cf_WriteShort(fp, (int16_t)huditem->stat);
cf_WriteByte(fp, (int8_t)huditem->type);
cf_WriteShort(fp, huditem->x);
cf_WriteShort(fp, huditem->y);
cf_WriteInt(fp, huditem->color);
cf_WriteShort(fp, (short)huditem->flags);
cf_WriteShort(fp, (int16_t)huditem->flags);
cf_WriteByte(fp, (int8_t)huditem->alpha);
cf_WriteInt(fp, huditem->data.timer_handle);
@ -958,12 +958,12 @@ void SGSHudState(CFILE *fp) {
} else if (huditem->type == HUD_ITEM_CUSTOMTEXT) {
// commented out because persistent hud messages are custom text, and its a mess to save the current
// state of hud persistent messages.
// cf_WriteShort(fp, (short)huditem->stat);
// cf_WriteShort(fp, (int16_t)huditem->stat);
// cf_WriteByte(fp, (int8_t)huditem->type);
// cf_WriteShort(fp, huditem->x);
// cf_WriteShort(fp, huditem->y);
// cf_WriteInt(fp, huditem->color);
// cf_WriteShort(fp, (short)huditem->flags);
// cf_WriteShort(fp, (int16_t)huditem->flags);
// cf_WriteByte(fp, (int8_t)huditem->alpha);
//
// cf_WriteString(fp, huditem->data.timer_handle);
@ -1176,8 +1176,8 @@ void LoadHUDConfig(const char *filename, bool (*fn)(const char *, const char *,
} else if (!strcmpi(command, "reticleoffset")) {
int x, y;
sscanf(operand, "%d,%d", &x, &y);
Ret_x_off = (short)x;
Ret_y_off = (short)y;
Ret_x_off = (int16_t)x;
Ret_y_off = (int16_t)y;
} else if (fn && (*fn)(command, operand, ext_data)) {
continue;
} else {

View File

@ -454,10 +454,10 @@ const char *GetMessageDestination(const char *message, int *destination);
typedef struct t_dirty_rect {
struct {
short l, t, r, b;
int16_t l, t, r, b;
} r[3]; // three rectangles for each frame buffer (3 max)
void set(short l0, short t0, short r0, short b0) {
void set(int16_t l0, int16_t t0, int16_t r0, int16_t b0) {
r[0].l = l0;
r[0].t = t0;
r[0].r = r0;
@ -468,10 +468,10 @@ typedef struct t_dirty_rect {
} tDirtyRect; // dirty rectangle for hud item (small hud version)
typedef struct tHUDItem {
short x, y;
short xa, ya; // auxillary points
short xb, yb;
short tx, ty; // text version x and y.
int16_t x, y;
int16_t xa, ya; // auxillary points
int16_t xb, yb;
int16_t tx, ty; // text version x and y.
float grscalex, grscaley; // used to scale graphics.
uint8_t id; // id number.

View File

@ -1079,7 +1079,7 @@ void RenderScrollingHUDMessages() {
int shade;
int text_height;
short l, t, r, b;
int16_t l, t, r, b;
int i;
// Check for wraps
@ -1220,10 +1220,10 @@ void RenderHUDMessages() {
if (item && Small_hud_flag) {
grtext_SetFont(HUD_FONT);
short l = item->x * Max_window_w / DEFAULT_HUD_WIDTH;
short t = item->y * Max_window_h / DEFAULT_HUD_HEIGHT;
short r = l + grtext_GetTextLineWidth(item->data.text) + 10;
short b = t + grtext_GetTextHeight(item->data.text);
int16_t l = item->x * Max_window_w / DEFAULT_HUD_WIDTH;
int16_t t = item->y * Max_window_h / DEFAULT_HUD_HEIGHT;
int16_t r = l + grtext_GetTextLineWidth(item->data.text) + 10;
int16_t b = t + grtext_GetTextHeight(item->data.text);
item->dirty_rect.set(l, t, r, b);
}
@ -1493,7 +1493,7 @@ void SGSGameMessages(CFILE *fp) {
int i = 0;
const char *msg;
cf_WriteShort(fp, (short)Game_msg_list.m_nmsg);
cf_WriteShort(fp, (int16_t)Game_msg_list.m_nmsg);
while ((msg = Game_msg_list.get(i++)) != NULL) {
cf_WriteString(fp, msg);

View File

@ -827,7 +827,7 @@ bool levelgoals::LoadLevelGoalInfo(CFILE *fptr) {
CleanupAfterLevel();
int i;
short version = cf_ReadShort(fptr);
int16_t version = cf_ReadShort(fptr);
int num_goals = cf_ReadShort(fptr);
for (i = 0; i < num_goals; i++) {

View File

@ -992,7 +992,7 @@ void ApplyVolumeLightToObject(vector *pos, object *obj, float light_dist, float
// Applies lighting to all objects in a certain distance
void ApplyLightingToObjects(vector *pos, int roomnum, float light_dist, float red_scale, float green_scale,
float blue_scale, vector *light_direction, float dot_range) {
short objlist[MAX_DYNAMIC_FACES];
int16_t objlist[MAX_DYNAMIC_FACES];
int num_objects, i;
float normalized_time[MAX_SUBOBJECTS];

View File

@ -62,7 +62,7 @@ typedef struct {
uint8_t used;
uint16_t dynamic;
short spec_map;
int16_t spec_map;
uint8_t type; // see LMI_types above
} lightmap_info;

View File

@ -268,7 +268,7 @@ int LoadGameState(const char *pathname) {
char path[PSPATHNAME_LEN];
uint16_t version;
uint16_t curlevel;
short pending_music_region;
int16_t pending_music_region;
IsRestoredGame = true;
// load in stuff
fp = cfopen(pathname, "rb");
@ -474,7 +474,7 @@ savesg_error:
int LGSXlateTables(CFILE *fp) {
START_VERIFY_SAVEFILE(fp);
int retval = LGS_OK;
short i, num, index;
int16_t i, num, index;
char name[64];
// load object info translation table
@ -541,15 +541,15 @@ extern uint8_t AutomapVisMap[MAX_ROOMS];
// initializes rooms
int LGSRooms(CFILE *fp) {
int retval = LGS_OK;
short i, p, highest_index;
int16_t i, p, highest_index;
gs_ReadShort(fp, highest_index);
if (highest_index != (short)Highest_room_index) {
if (highest_index != (int16_t)Highest_room_index) {
Int3();
return LGS_CORRUPTLEVEL;
}
short num_rooms;
int16_t num_rooms;
gs_ReadShort(fp, num_rooms);
for (i = 0; i < num_rooms; i++) {
@ -628,10 +628,10 @@ int LGSEvents(CFILE *fp) {
// loads in and sets these triggers
int LGSTriggers(CFILE *fp) {
short i, n_trigs = 0;
int16_t i, n_trigs = 0;
gs_ReadShort(fp, n_trigs);
if (n_trigs != (short)Num_triggers) {
if (n_trigs != (int16_t)Num_triggers) {
Int3();
return LGS_CORRUPTLEVEL;
}
@ -686,7 +686,7 @@ typedef struct {
uint16_t flags;
int phys_flags;
uint8_t movement_type;
short custom_handle;
int16_t custom_handle;
uint16_t lighting_color;
vis_attach_info attach_info;
@ -694,8 +694,8 @@ typedef struct {
vector end_pos;
short next;
short prev;
int16_t next;
int16_t prev;
} old_vis_effect;
void CopyVisStruct(vis_effect *vis, old_vis_effect *old_vis) {
@ -733,7 +733,7 @@ void CopyVisStruct(vis_effect *vis, old_vis_effect *old_vis) {
// save viseffects
int LGSVisEffects(CFILE *fp) {
short i, count = 0;
int16_t i, count = 0;
gs_ReadShort(fp, count);
@ -778,7 +778,7 @@ int LGSVisEffects(CFILE *fp) {
// players
int LGSPlayers(CFILE *fp) {
player *plr = &Players[0];
short size;
int16_t size;
// must do this if we read player struct as whole.
plr->inventory.Reset(false, INVRESET_ALL);
@ -953,7 +953,7 @@ int LGSObjects(CFILE *fp, int version) {
door *door;
int index, nattach, new_model, handle;
uint8_t type, dummy_type;
short sindex, size;
int16_t sindex, size;
// if((i==98)||(i==100))
// Int3();
@ -1242,7 +1242,7 @@ int LGSObjects(CFILE *fp, int version) {
case RT_POLYOBJ: // be sure to use translated handles for polyobjs and textures
{
// the paging mess. must update size of object accordingly.
sindex = (short)op->rtype.pobj_info.model_num;
sindex = (int16_t)op->rtype.pobj_info.model_num;
new_model = (sindex > -1) ? gs_Xlates->model_handles[sindex] : -1;
if ((new_model != op->rtype.pobj_info.model_num) || (Poly_models[new_model].flags & PMF_NOT_RESIDENT)) {
switch (type) {
@ -1275,7 +1275,7 @@ int LGSObjects(CFILE *fp, int version) {
}
op->rtype.pobj_info.model_num = new_model;
sindex = (short)op->rtype.pobj_info.dying_model_num;
sindex = (int16_t)op->rtype.pobj_info.dying_model_num;
new_model = (sindex > -1) ? gs_Xlates->model_handles[sindex] : -1;
if (new_model != op->rtype.pobj_info.dying_model_num) {
switch (type) {
@ -1323,7 +1323,7 @@ int LGSObjects(CFILE *fp, int version) {
}
case RT_SHARD:
sindex = (short)op->rtype.shard_info.tmap;
sindex = (int16_t)op->rtype.shard_info.tmap;
op->rtype.shard_info.tmap = (sindex > -1) ? gs_Xlates->tex_handles[sindex] : -1;
break;
@ -1441,7 +1441,7 @@ done:;
// loads ai
int LGSObjAI(CFILE *fp, ai_frame **pai) {
ai_frame *ai;
short size;
int16_t size;
int8_t read_ai;
*pai = NULL;
@ -1464,7 +1464,7 @@ int LGSObjAI(CFILE *fp, ai_frame **pai) {
// loads fx
int LGSObjEffects(CFILE *fp, object *op) {
short size;
int16_t size;
int8_t do_read;
op->effect_info = NULL;
@ -1610,7 +1610,7 @@ int LGSSnapshot(CFILE *fp) {
//@@ {
//@@ case MT_SHOCKWAVE:
//@@ {
//@@ short bound;
//@@ int16_t bound;
//@@ gs_ReadShort(fp, bound);
//@@ if (bound < (sizeof(op_wave->damaged_list)/sizeof(uint32_t))) {
//@@ Int3();

View File

@ -843,14 +843,14 @@ void matcen::SaveData(CFILE *fp) {
cf_WriteInt(fp, m_sound_active_handle);
}
extern short texture_xlate[];
extern int16_t texture_xlate[];
void matcen::LoadData(CFILE *fp) {
int i, j;
int len;
short max_spawn_pnts;
short max_prod_types;
short max_matcen_sounds;
int16_t max_spawn_pnts;
int16_t max_prod_types;
int16_t max_matcen_sounds;
int version = cf_ReadInt(fp);
@ -1721,9 +1721,9 @@ bool matcen::SetCreationEffect(char effect_index) {
return true;
}
void matcen::SetCreationTexture(short texnum) { m_creation_texture = texnum; }
void matcen::SetCreationTexture(int16_t texnum) { m_creation_texture = texnum; }
short matcen::GetCreationTexture() { return m_creation_texture; }
int16_t matcen::GetCreationTexture() { return m_creation_texture; }
int matcen::GetSound(char sound_type) {
if (sound_type >= 0 && sound_type < MAX_MATCEN_SOUNDS) {

View File

@ -61,7 +61,7 @@ private:
char m_control_type;
char m_type;
char m_creation_effect;
short m_creation_texture;
int16_t m_creation_texture;
uint8_t m_cur_saturation_count;
int m_num_spawn_pnts;
@ -77,7 +77,7 @@ private:
int m_spawn_pnt[MAX_SPAWN_PNTS];
vector m_spawn_vec[MAX_SPAWN_PNTS];
vector m_spawn_normal[MAX_SPAWN_PNTS];
short m_spawn_vis_effects[MAX_MATCEN_EFFECT_SATURATION][MAX_SPAWN_PNTS];
int16_t m_spawn_vis_effects[MAX_MATCEN_EFFECT_SATURATION][MAX_SPAWN_PNTS];
int m_max_prod;
@ -86,8 +86,8 @@ private:
int m_prod_priority[MAX_PROD_TYPES];
int m_max_prod_type[MAX_PROD_TYPES];
short m_max_alive_children;
short m_num_alive;
int16_t m_max_alive_children;
int16_t m_num_alive;
int *m_alive_list; // list of alive children
float m_preprod_time;
@ -135,8 +135,8 @@ public:
matcen();
~matcen();
void SetCreationTexture(short texnum);
short GetCreationTexture();
void SetCreationTexture(int16_t texnum);
int16_t GetCreationTexture();
char GetAttachType();
bool SetAttachType(char type);

View File

@ -144,7 +144,7 @@ msn_urls msn_URL = {"", {"", "", "", "", ""}};
msn_urls Net_msn_URLs;
extern char Proxy_server[200];
extern short Proxy_port;
extern int16_t Proxy_port;
int msn_ExtractZipFile(char *zipfilename, char *mn3name);

View File

@ -109,13 +109,13 @@ void MenuScene(); // display menu scene
class tmmItemQueue {
#define tmmItemSIZE 8
tmmItemFX m_items[tmmItemSIZE];
short m_head, m_tail;
int16_t m_head, m_tail;
public:
tmmItemQueue() { m_head = m_tail = 0; };
~tmmItemQueue(){};
void send(tmmItemFX &item) { // sends an item onto the queue
short temp = m_tail + 1;
int16_t temp = m_tail + 1;
if (temp == tmmItemSIZE)
temp = 0;
if (temp != m_head) {
@ -141,8 +141,8 @@ class mmInterface;
// class mmItem
class mmItem : public UIGadget {
char *m_text; // text for item
short m_alpha; // alpha for text item
short m_satcount;
int16_t m_alpha; // alpha for text item
int16_t m_satcount;
tmmItemFX m_curfx; // current effect
#ifndef __LINUX__
tQueue<tmmItemFX, 8> m_fxqueue; // special effects queue

View File

@ -1792,8 +1792,8 @@ char Tracker_id[TRACKER_ID_LEN];
vmt_descent3_struct MTPilotinfo[MAX_NET_PLAYERS];
short Multi_kills[MAX_NET_PLAYERS];
short Multi_deaths[MAX_NET_PLAYERS];
int16_t Multi_kills[MAX_NET_PLAYERS];
int16_t Multi_deaths[MAX_NET_PLAYERS];
int Got_new_game_time = 0;
@ -1827,7 +1827,7 @@ void SendDataChunk(int playernum);
void DenyFile(int playernum, int filenum, int file_who);
void MultiDoFileCancelled(uint8_t *data);
void MultiDoCustomPlayerData(uint8_t *data);
char *GetFileNameFromPlayerAndID(short playernum, short id);
char *GetFileNameFromPlayerAndID(int16_t playernum, int16_t id);
// Multiplayer position flags
#define MPF_AFTERBURNER 1 // Afterburner is on
@ -4211,7 +4211,7 @@ void MultiDoWorldStates(uint8_t *data) {
case WS_ROOM_WIND: {
// Room wind
short roomnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
Rooms[roomnum].wind.x = MultiGetFloat(data, &count);
Rooms[roomnum].wind.y = MultiGetFloat(data, &count);
Rooms[roomnum].wind.z = MultiGetFloat(data, &count);
@ -4222,7 +4222,7 @@ void MultiDoWorldStates(uint8_t *data) {
}
case WS_ROOM_FOG: {
// Room wind
short roomnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
Rooms[roomnum].fog_depth = MultiGetFloat(data, &count);
Rooms[roomnum].fog_r = ((float)MultiGetUbyte(data, &count)) / 255.0;
Rooms[roomnum].fog_g = ((float)MultiGetUbyte(data, &count)) / 255.0;
@ -4239,7 +4239,7 @@ void MultiDoWorldStates(uint8_t *data) {
case WS_ROOM_LIGHTING: {
// Room lighting
uint8_t state;
short roomnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
Rooms[roomnum].pulse_time = MultiGetUbyte(data, &count);
Rooms[roomnum].pulse_offset = MultiGetUbyte(data, &count);
state = MultiGetUbyte(data, &count);
@ -4258,7 +4258,7 @@ void MultiDoWorldStates(uint8_t *data) {
}
case WS_ROOM_REFUEL: {
// Room fueling
short roomnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
uint8_t state = MultiGetUbyte(data, &count);
if (state)
Rooms[roomnum].flags |= RF_FUELCEN;
@ -4268,43 +4268,43 @@ void MultiDoWorldStates(uint8_t *data) {
break;
}
case WS_ROOM_TEXTURE: {
short roomnum = MultiGetShort(data, &count);
short facenum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
int16_t facenum = MultiGetShort(data, &count);
char str[255];
MultiGetString(str, data, &count);
ChangeRoomFaceTexture(roomnum, facenum, FindTextureName(IGNORE_TABLE(str)));
break;
}
case WS_ROOM_GLASS: {
short roomnum = MultiGetShort(data, &count);
short facenum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
int16_t facenum = MultiGetShort(data, &count);
BreakGlassFace(&Rooms[roomnum], facenum);
break;
}
case WS_ROOM_PORTAL_RENDER: {
short roomnum = MultiGetShort(data, &count);
short portalnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
int16_t portalnum = MultiGetShort(data, &count);
uint8_t flags = MultiGetByte(data, &count);
Rooms[roomnum].portals[portalnum].flags = flags;
break;
}
case WS_ROOM_PORTAL_BLOCK: {
short roomnum = MultiGetShort(data, &count);
short portalnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
int16_t portalnum = MultiGetShort(data, &count);
uint8_t flags = MultiGetByte(data, &count);
Rooms[roomnum].portals[portalnum].flags = flags;
break;
}
case WS_ROOM_DAMAGE: {
// Room wind
short roomnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
Rooms[roomnum].damage = MultiGetFloat(data, &count);
Rooms[roomnum].damage_type = MultiGetUbyte(data, &count);
break;
}
case WS_ROOM_GOALSPECFLAG: {
// goals & special flags
short roomnum = MultiGetShort(data, &count);
int16_t roomnum = MultiGetShort(data, &count);
int mask = (RF_SPECIAL1 | RF_SPECIAL2 | RF_SPECIAL3 | RF_SPECIAL4 | RF_SPECIAL5 | RF_SPECIAL6 | RF_GOAL1 |
RF_GOAL2 | RF_GOAL3 | RF_GOAL4);
int change_mask = MultiGetInt(data, &count);
@ -5065,8 +5065,8 @@ void MultiDoExecuteDLL(uint8_t *data) {
SKIP_HEADER(data, &count);
uint16_t eventnum = MultiGetShort(data, &count);
short me_objnum = MultiGetShort(data, &count);
short it_objnum = MultiGetShort(data, &count);
int16_t me_objnum = MultiGetShort(data, &count);
int16_t it_objnum = MultiGetShort(data, &count);
if (MultiGetByte(data, &count)) {
// we need to extract out parameters
@ -5106,8 +5106,8 @@ void MultiDoExecuteDLL(uint8_t *data) {
}
}
short local_me_objnum;
short local_it_objnum;
int16_t local_me_objnum;
int16_t local_it_objnum;
if (me_objnum == -1)
local_me_objnum = -1;
@ -6100,7 +6100,7 @@ void MultiDoRequestCountermeasure(uint8_t *data) {
}
// We're asking the server to create a countermeasure for us
void MultiSendRequestCountermeasure(short objnum, int weapon_index) {
void MultiSendRequestCountermeasure(int16_t objnum, int weapon_index) {
int count = 0;
uint8_t data[MAX_GAME_DATA_SIZE];
int size_offset;
@ -6735,7 +6735,7 @@ void MultiPaintGoalRooms(int *texcolors) {
}
}
void MultiSendKillObject(object *hit_obj, object *killer, float damage, int death_flags, float delay, short seed) {
void MultiSendKillObject(object *hit_obj, object *killer, float damage, int death_flags, float delay, int16_t seed) {
int size;
int count = 0;
uint8_t data[MAX_GAME_DATA_SIZE];
@ -6954,7 +6954,7 @@ void MultiDoObjAnimUpdate(uint8_t *data) {
void MultiDoPlay3dSound(uint8_t *data) {
int objnum;
short soundidx;
int16_t soundidx;
int count = 0;
MULTI_ASSERT_NOMESSAGE(Netgame.local_role != LR_SERVER);
@ -6974,7 +6974,7 @@ void MultiDoPlay3dSound(uint8_t *data) {
Sound_system.Play3dSound(soundidx, &Objects[objnum], priority);
}
void MultiPlay3dSound(short soundidx, uint16_t objnum, int priority) {
void MultiPlay3dSound(int16_t soundidx, uint16_t objnum, int priority) {
uint8_t data[MAX_GAME_DATA_SIZE];
int count = 0;
int size = 0;
@ -7003,7 +7003,7 @@ void MultiPlay3dSound(short soundidx, uint16_t objnum, int priority) {
}
}
void MultiSendRobotFireSound(short soundidx, uint16_t objnum) {
void MultiSendRobotFireSound(int16_t soundidx, uint16_t objnum) {
int size;
int count = 0;
uint8_t data[MAX_GAME_DATA_SIZE];
@ -7039,7 +7039,7 @@ void MultiSendRobotFireSound(short soundidx, uint16_t objnum) {
void MultiDoRobotFireSound(uint8_t *data) {
int objnum;
short soundidx;
int16_t soundidx;
int count = 0;
MULTI_ASSERT_NOMESSAGE(Netgame.local_role != LR_SERVER);
SKIP_HEADER(data, &count);
@ -8040,14 +8040,14 @@ void MultiDoCustomPlayerData(uint8_t *data) {
return;
mprintf((0, "Got custom data in MultiDoCustomPlayerData()\n"));
NetPlayers[playernum].custom_file_seq = NETFILE_ID_SHIP_TEX; // First in the sequence of files we will request
short logo_len = MultiGetUshort(data, &count);
int16_t logo_len = MultiGetUshort(data, &count);
memcpy(NetPlayers[playernum].ship_logo, data + count, logo_len);
count += logo_len;
mprintf((0, "%s uses custom ship logo %s\n", Players[playernum].callsign, NetPlayers[playernum].ship_logo));
for (int t = 0; t < 4; t++) {
char *filename;
short vt_len;
int16_t vt_len;
switch (t) {
case 0:
@ -8070,7 +8070,7 @@ void MultiDoCustomPlayerData(uint8_t *data) {
}
}
char *GetFileNameFromPlayerAndID(short playernum, short id) {
char *GetFileNameFromPlayerAndID(int16_t playernum, int16_t id) {
static char rval[_MAX_PATH * 2];
rval[0] = '\0';
@ -8423,7 +8423,7 @@ void MultiDoAiWeaponFlags(uint8_t *data) {
int flags;
int wb_index;
short obj_num = Server_object_list[MultiGetUshort(data, &count)];
int16_t obj_num = Server_object_list[MultiGetUshort(data, &count)];
flags = MultiGetInt(data, &count);
wb_index = MultiGetByte(data, &count);
if (obj_num == 65535) {
@ -9950,7 +9950,7 @@ void MultiProcessData(uint8_t *data, int len, int slot, network_address *from_ad
// and pass them to multi_process_data.
void MultiProcessBigData(uint8_t *buf, int len, network_address *from_addr) {
int type, bytes_processed = 0;
short sub_len;
int16_t sub_len;
int slot = 0;
int last_type = -1, last_len = -1;
@ -9978,7 +9978,7 @@ void MultiProcessBigData(uint8_t *buf, int len, network_address *from_addr) {
while (bytes_processed < len) {
type = buf[bytes_processed];
sub_len = INTEL_SHORT((*(short *)(buf + bytes_processed + 1)));
sub_len = INTEL_SHORT((*(int16_t *)(buf + bytes_processed + 1)));
if (sub_len < 3 || type == 0 || (len - bytes_processed) < 2) {
mprintf((0, "Got a corrupted packet!\n"));
@ -9988,7 +9988,7 @@ void MultiProcessBigData(uint8_t *buf, int len, network_address *from_addr) {
if ((bytes_processed + sub_len) > len) {
mprintf(
(1, "multi_process_bigdata: packet type %d too short (%d>%d)!\n", type, (bytes_processed + sub_len), len));
(1, "multi_process_bigdata: packet type %d too int16_t (%d>%d)!\n", type, (bytes_processed + sub_len), len));
Int3();
return;
}

View File

@ -698,7 +698,7 @@ extern uint16_t Server_spew_list[];
// A semi-compressed orientation matrix for multiplayer games
typedef struct {
short multi_matrix[9];
int16_t multi_matrix[9];
} multi_orientation;
static inline void MultiMatrixMakeEndianFriendly(multi_orientation *mmat) {
@ -725,7 +725,7 @@ typedef struct {
int objnum;
int roomnum;
uint8_t used;
short original_id;
int16_t original_id;
} powerup_respawn;
typedef struct {
@ -1001,7 +1001,7 @@ void MultiDoRobotPos(uint8_t *data);
int MultiSendRobotFireWeapon(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum);
// Send robot damage
void MultiSendKillObject(object *hit_obj, object *killer, float damage, int death_flags, float delay, short seed);
void MultiSendKillObject(object *hit_obj, object *killer, float damage, int death_flags, float delay, int16_t seed);
// handle robot damage
void MultiDoRobotExplode(uint8_t *data);
@ -1019,7 +1019,7 @@ void MultiSendOnOff(object *obj, uint8_t on, uint8_t wb_index, uint8_t fire_mask
void MultiSendAdditionalDamage(int slot, int type, float amount);
// We're asking the server to create a countermeasure for us
void MultiSendRequestCountermeasure(short objnum, int weapon_index);
void MultiSendRequestCountermeasure(int16_t objnum, int weapon_index);
// Tell the client that an object took damage
void MultiSendDamageObject(object *hit_obj, object *killer, float damage, int weaponid);
@ -1040,10 +1040,10 @@ void MultiDoObjAnimUpdate(uint8_t *data);
void MultiDoPlay3dSound(uint8_t *data);
// Tell the clients to play a 3d sound
void MultiPlay3dSound(short soundidx, uint16_t objnum, int priority);
void MultiPlay3dSound(int16_t soundidx, uint16_t objnum, int priority);
// Tell the client to play a sound because a robot fired
void MultiSendRobotFireSound(short soundidx, uint16_t objnum);
void MultiSendRobotFireSound(int16_t soundidx, uint16_t objnum);
// Play the robot sound that the server told us about
void MultiDoRobotFireSound(uint8_t *data);

View File

@ -86,7 +86,7 @@
* added auto pps
*
* 39 12/08/98 4:52p Jeff
* changed the pilot pics packing to use Ushort instead of short just for
* changed the pilot pics packing to use Ushort instead of int16_t just for
* my conscience...removed some annoying mprintf's too
*
* 38 12/01/98 5:48p Jeff

View File

@ -1006,8 +1006,8 @@ typedef struct player_killed {
typedef struct player_score_matrix {
int num_players;
char name[MAX_NET_PLAYERS][CALLSIGN_LEN + 1];
short deaths[MAX_NET_PLAYERS];
short kills[MAX_NET_PLAYERS];
int16_t deaths[MAX_NET_PLAYERS];
int16_t kills[MAX_NET_PLAYERS];
} player_score_matrix;
// The chokepoint function to call the dll function
void CallMultiScoreDLL(int eventnum, void *data) {

View File

@ -282,9 +282,9 @@ inline void MultiAddSbyte(int8_t element, uint8_t *data, int *count) {
*count += sizeof(int8_t);
}
inline void MultiAddShort(short element, uint8_t *data, int *count) {
*(short *)(data + *count) = INTEL_SHORT(element);
*count += sizeof(short);
inline void MultiAddShort(int16_t element, uint8_t *data, int *count) {
*(int16_t *)(data + *count) = INTEL_SHORT(element);
*count += sizeof(int16_t);
}
inline void MultiAddUshort(uint16_t element, uint8_t *data, int *count) {
@ -334,15 +334,15 @@ inline int8_t MultiGetSbyte(uint8_t *data, int *count) {
return element;
}
inline short MultiGetShort(uint8_t *data, int *count) {
short element = (*(short *)(data + *count));
*count += sizeof(short);
inline int16_t MultiGetShort(uint8_t *data, int *count) {
int16_t element = (*(int16_t *)(data + *count));
*count += sizeof(int16_t);
return INTEL_SHORT(element);
}
inline uint16_t MultiGetUshort(uint8_t *data, int *count) {
uint16_t element = (*(uint16_t *)(data + *count));
*count += sizeof(short);
*count += sizeof(int16_t);
return INTEL_SHORT(element);
}

View File

@ -379,8 +379,8 @@ class newuiResources {
int bm_handle;
chunked_bitmap chunk;
};
short chunked; // is it a bitmap handle or chunk
short n_count;
int16_t chunked; // is it a bitmap handle or chunk
int16_t n_count;
char *filename; // filename of bitmap.
} m_list[N_NEWUI_BMPS_TOTAL]; // list of bitmaps.
@ -406,7 +406,7 @@ class newuiCheckBox : public newuiButton, public UICheckBox {
public:
newuiCheckBox();
void Create(UIWindow *wnd, short id, const char *name, short x, short y, bool is_long = false);
void Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y, bool is_long = false);
protected:
virtual void OnDraw(); // this will use the newuiButton drawing scheme
@ -424,7 +424,7 @@ class newuiRadioButton : public newuiButton, public UIRadioButton {
public:
newuiRadioButton();
void Create(UIWindow *wnd, UIRadioButton *prev_rb, short id, const char *name, short x, short y,
void Create(UIWindow *wnd, UIRadioButton *prev_rb, int16_t id, const char *name, int16_t x, int16_t y,
bool is_long = false);
protected:
@ -445,8 +445,8 @@ protected:
#define SUBGADGET_RIGHT 0x2
class newuiSlider : public UIGadget {
short m_pos;
short m_unitrange;
int16_t m_pos;
int16_t m_unitrange;
UIBitmapItem *m_bar_bmp;
UISnazzyTextItem *m_title;
newuiArrowButton m_minus_btn;
@ -456,12 +456,12 @@ class newuiSlider : public UIGadget {
public:
newuiSlider();
void Create(UIWindow *wnd, short id, const char *name, short x, short y, short range);
void Offset(short offs);
void SetPos(short pos);
void SetRange(short range);
short GetPos() const { return m_pos; };
short GetRange() const { return m_unitrange; };
void Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y, int16_t range);
void Offset(int16_t offs);
void SetPos(int16_t pos);
void SetRange(int16_t range);
int16_t GetPos() const { return m_pos; };
int16_t GetRange() const { return m_unitrange; };
void SetUnits(tSliderSettings *settings);
protected:
@ -483,7 +483,7 @@ class newuiEditBox : public UIEdit {
public:
newuiEditBox();
void Create(UIWindow *wnd, short id, const char *name, short x, short y, short w, short flags);
void Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y, int16_t w, int16_t flags);
void EnableOnQuickEscapeBehavior(bool do_it);
protected:
@ -863,10 +863,10 @@ void newuiMenu::Create() {
}
// sets current option to display.
void newuiMenu::SetCurrentOption(short id) { m_newoptionid = id; }
void newuiMenu::SetCurrentOption(int16_t id) { m_newoptionid = id; }
// returns current option
short newuiMenu::GetCurrentOption() const {
int16_t newuiMenu::GetCurrentOption() const {
if (m_cursheetidx != -1) {
return m_sheetbtn[m_cursheetidx].GetID();
}
@ -877,7 +877,7 @@ short newuiMenu::GetCurrentOption() const {
newuiSheet *newuiMenu::GetCurrentSheet() const { return m_cursheet; }
// when a new option is ready. at this point the system sets the focus on this option
void newuiMenu::SetOnOptionFocusCB(void (*fn)(newuiMenu *, short, void *), void *data) {
void newuiMenu::SetOnOptionFocusCB(void (*fn)(newuiMenu *, int16_t, void *), void *data) {
m_option_focus_cb = fn;
m_option_focus_cb_data = data;
}
@ -936,7 +936,7 @@ int newuiMenu::DoUI() {
for (i = 0; i < m_nsheets; i++) {
if (i != m_cursheetidx) {
if (res == m_sheetbtn[i].GetID() && m_hassheet[i]) {
m_newoptionid = (short)res;
m_newoptionid = (int16_t)res;
break;
}
}
@ -952,7 +952,7 @@ int newuiMenu::DoUI() {
// when a new sheet is realized, this function will be called.
// passed in: the menu object, the old option and the new option respectively
void newuiMenu::SetOnOptionSwitchCB(void (*fn)(newuiMenu *, short, short, void *), void *data) {
void newuiMenu::SetOnOptionSwitchCB(void (*fn)(newuiMenu *, int16_t, int16_t, void *), void *data) {
m_activate_sheet_cb = fn;
m_activate_sheet_cb_data = data;
}
@ -964,11 +964,11 @@ void newuiMenu::SetOnUIFrameCB(void (*fn)()) {
}
// adds an option to a menu, returns a newuiSheet object to add user interface to.
void newuiMenu::AddSimpleOption(short id, const char *title, int yoff) {
void newuiMenu::AddSimpleOption(int16_t id, const char *title, int yoff) {
newuiMenu::AddOption(id, title, 0, false, yoff);
}
newuiSheet *newuiMenu::AddOption(short id, const char *title, int size, bool has_sheet, int yoff) {
newuiSheet *newuiMenu::AddOption(int16_t id, const char *title, int size, bool has_sheet, int yoff) {
newuiMenuOptionButton *last_btn = NULL;
if (m_nsheets == N_NEWUI_SHEETS) {
@ -1076,7 +1076,7 @@ void newuiLargeMenu::Create() {
}
// adds an option to a menu, returns a newuiSheet object to add user interface to.
newuiSheet *newuiLargeMenu::AddOption(short id, const char *title, int size) {
newuiSheet *newuiLargeMenu::AddOption(int16_t id, const char *title, int size) {
return newuiMenu::AddOption(id, title, size);
}
@ -1282,7 +1282,7 @@ void newuiSheet::Reset() {
}
// set focus on this gadget specified by id upon realization.
void newuiSheet::SetInitialFocusedGadget(short id) { m_initial_focus_id = id; }
void newuiSheet::SetInitialFocusedGadget(int16_t id) { m_initial_focus_id = id; }
// call this to initialize gadgets specified above in parent window
void newuiSheet::Realize() {
@ -1307,7 +1307,7 @@ void newuiSheet::Realize() {
newuiHotspot *hot;
UIText *text;
UIStatic *bmp;
short flags;
int16_t flags;
bool bval;
switch (desc->type) {
@ -1676,7 +1676,7 @@ void newuiSheet::UpdateChanges() {
for (i = 0; i < m_ngadgets; i++) {
newuiSheet::t_gadget_desc *desc = &m_gadgetlist[i];
bool bval;
short sval;
int16_t sval;
char sbuftest[EDIT_BUFLEN_MAX];
switch (desc->type) {
@ -1744,7 +1744,7 @@ void newuiSheet::UpdateReturnValues() {
for (i = 0; i < m_ngadgets; i++) {
newuiSheet::t_gadget_desc *desc = &m_gadgetlist[i];
bool bval;
short sval;
int16_t sval;
char sbuftest[EDIT_BUFLEN_MAX];
if (desc->obj.gadget) {
@ -1841,7 +1841,7 @@ bool newuiSheet::HasChanged(int *iptr) {
return false;
}
bool newuiSheet::HasChanged(short *sptr) {
bool newuiSheet::HasChanged(int16_t *sptr) {
int i;
ASSERT(m_realized);
@ -1885,13 +1885,13 @@ bool newuiSheet::HasChanged(char *cptr) {
return false;
}
UIGadget *newuiSheet::GetGadget(short id) {
UIGadget *newuiSheet::GetGadget(int16_t id) {
int i;
for (i = 0; i < m_ngadgets; i++) {
newuiSheet::t_gadget_desc *desc = &m_gadgetlist[i];
if (desc->obj.gadget && id == (short)desc->obj.gadget->GetID()) {
if (desc->obj.gadget && id == (int16_t)desc->obj.gadget->GetID()) {
switch (desc->type) {
case GADGET_STATIC_TXT:
return desc->obj.gadget;
@ -1934,7 +1934,7 @@ UIGadget *newuiSheet::GetGadget(short id) {
return NULL;
}
newuiSheet::t_gadget_desc *newuiSheet::AddGadget(short id, int8_t type, const char *title) {
newuiSheet::t_gadget_desc *newuiSheet::AddGadget(int16_t id, int8_t type, const char *title) {
int i = m_ngadgets;
ASSERT(!m_realized);
@ -1959,7 +1959,7 @@ newuiSheet::t_gadget_desc *newuiSheet::AddGadget(short id, int8_t type, const ch
}
// creates gadget list.
void newuiSheet::NewGroup(const char *title, short x, short y, tAlignment align, short pix_offset) {
void newuiSheet::NewGroup(const char *title, int16_t x, int16_t y, tAlignment align, int16_t pix_offset) {
newuiSheet::t_gadget_desc *gadget = AddGadget(-1, (align == NEWUI_ALIGN_HORIZ) ? GADGET_HGROUP : GADGET_GROUP, title);
gadget->parm.s[0] = x;
gadget->parm.s[1] = y;
@ -1967,59 +1967,59 @@ void newuiSheet::NewGroup(const char *title, short x, short y, tAlignment align,
}
// adds standard button to current group.
void newuiSheet::AddButton(const char *title, short id, short flags) {
void newuiSheet::AddButton(const char *title, int16_t id, int16_t flags) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_BUTTON, title);
gadget->parm.i = flags;
}
// adds standard long button to current group.
void newuiSheet::AddLongButton(const char *title, short id, short flags) {
void newuiSheet::AddLongButton(const char *title, int16_t id, int16_t flags) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_LBUTTON, title);
gadget->parm.i = flags;
}
// adds checkbox to current group. initial state of checkbox can be set.
bool *newuiSheet::AddCheckBox(const char *title, bool init_state, short id) {
bool *newuiSheet::AddCheckBox(const char *title, bool init_state, int16_t id) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_CHECKBOX, title);
gadget->parm.b = init_state;
return &gadget->parm.b;
}
// adds checkbox to current group. initial state of checkbox can be set.
bool *newuiSheet::AddLongCheckBox(const char *title, bool init_state, short id) {
bool *newuiSheet::AddLongCheckBox(const char *title, bool init_state, int16_t id) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_LCHECKBOX, title);
gadget->parm.b = init_state;
return &gadget->parm.b;
}
// adds a radio button to current group. initial state of radio may be set
int *newuiSheet::AddFirstRadioButton(const char *title, short id) {
int *newuiSheet::AddFirstRadioButton(const char *title, int16_t id) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_RADIO, title);
gadget->parm.i = 0;
return &gadget->parm.i;
}
// adds a radio button to current group. initial state of radio may be set
void newuiSheet::AddRadioButton(const char *title, short id) {
void newuiSheet::AddRadioButton(const char *title, int16_t id) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_RADIO, title);
gadget->parm.i = -1;
}
// adds a radio button to current group. initial state of radio may be set
int *newuiSheet::AddFirstLongRadioButton(const char *title, short id) {
int *newuiSheet::AddFirstLongRadioButton(const char *title, int16_t id) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_LRADIO, title);
gadget->parm.i = 0;
return &gadget->parm.i;
}
// adds a radio button to current group. initial state of radio may be set
void newuiSheet::AddLongRadioButton(const char *title, short id) {
void newuiSheet::AddLongRadioButton(const char *title, int16_t id) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_LRADIO, title);
gadget->parm.i = -1;
}
// adds a slider, set the range for it too.
short *newuiSheet::AddSlider(const char *title, short range, short init_pos, tSliderSettings *settings, short id) {
int16_t *newuiSheet::AddSlider(const char *title, int16_t range, int16_t init_pos, tSliderSettings *settings, int16_t id) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_SLIDER, title);
gadget->parm.s[0] = init_pos;
gadget->parm.s[1] = range;
@ -2064,7 +2064,7 @@ char *newuiSheet::AddChangeableText(int buflen) {
}
// adds a hotspot :(, should word wrap too.
void newuiSheet::AddHotspot(const char *title, short w, short h, short id, bool group) {
void newuiSheet::AddHotspot(const char *title, int16_t w, int16_t h, int16_t id, bool group) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_HOTSPOT, title);
gadget->parm.s[0] = w;
gadget->parm.s[1] = h;
@ -2072,7 +2072,7 @@ void newuiSheet::AddHotspot(const char *title, short w, short h, short id, bool
}
// adds a listbox
newuiListBox *newuiSheet::AddListBox(short w, short h, short id, uint16_t flags) {
newuiListBox *newuiSheet::AddListBox(int16_t w, int16_t h, int16_t id, uint16_t flags) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_LISTBOX, NULL);
newuiListBox *lb = new newuiListBox;
lb->Create(m_parent, id, 0, 0, w, h, flags);
@ -2082,7 +2082,7 @@ newuiListBox *newuiSheet::AddListBox(short w, short h, short id, uint16_t flags)
}
// adds a listbox
newuiComboBox *newuiSheet::AddComboBox(short id, uint16_t flags) {
newuiComboBox *newuiSheet::AddComboBox(int16_t id, uint16_t flags) {
newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_COMBOBOX, NULL);
newuiComboBox *cb = new newuiComboBox;
cb->Create(m_parent, id, 0, 0, flags);
@ -2092,7 +2092,7 @@ newuiComboBox *newuiSheet::AddComboBox(short id, uint16_t flags) {
}
// adds an edit box
char *newuiSheet::AddEditBox(const char *title, short maxlen, short w, short id, short flags, bool on_escape_quit) {
char *newuiSheet::AddEditBox(const char *title, int16_t maxlen, int16_t w, int16_t id, int16_t flags, bool on_escape_quit) {
int8_t type = GADGET_EDITBOX;
if (flags & UIED_PASSWORD) {
type = GADGET_EDITBOXPASS;
@ -2128,7 +2128,7 @@ newuiButton::newuiButton() {
m_text = NULL;
}
void newuiButton::Create(UIWindow *menu, short id, const char *name, short x, short y, short flags) {
void newuiButton::Create(UIWindow *menu, int16_t id, const char *name, int16_t x, int16_t y, int16_t flags) {
UITextItem item{""};
UIButton::Create(menu, id, &item, x, y, 10, 8, flags | UIF_FIT);
@ -2145,7 +2145,7 @@ void newuiButton::Create(UIWindow *menu, short id, const char *name, short x, sh
newuiButton::InitStates(name, (flags & NEWUI_BTNF_LONG) != 0);
}
void newuiTinyButton::Create(UIWindow *wnd, short id, const char *name, short x, short y) {
void newuiTinyButton::Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y) {
m_bkg = Newui_resources.Load(NEWUI_TINYBTN_FILE);
m_litbkg = Newui_resources.Load(NEWUI_TINYBTNLIT_FILE);
newuiButton::Create(wnd, id, name, x, y);
@ -2159,7 +2159,7 @@ void newuiButton::OnFormat() {
UIGadget::OnFormat();
}
void newuiButton::InitStates(const char *name, bool is_long, short flags) {
void newuiButton::InitStates(const char *name, bool is_long, int16_t flags) {
if (!m_bkg) {
m_bkg = Newui_resources.Load(is_long ? NEWUI_LBTN_FILE : NEWUI_BTN_FILE);
}
@ -2230,8 +2230,8 @@ void newuiButton::OnGainFocus() {
//////////////////////////////////////////////////////////////////////////////
// CLASS a large option button used in menus.
void newuiMenuOptionButton::Create(newuiMenu *menu, newuiMenuOptionButton *last, short id, const char *name, short x,
short y, bool mono_press) {
void newuiMenuOptionButton::Create(newuiMenu *menu, newuiMenuOptionButton *last, int16_t id, const char *name, int16_t x,
int16_t y, bool mono_press) {
m_bkg = Newui_resources.Load(NEWUI_LRGBTN_FILE);
m_litbkg = Newui_resources.Load(NEWUI_LRGBTNLIT_FILE);
m_text = GadgetLargeText(name);
@ -2299,7 +2299,7 @@ void newuiMenuOptionButton::OnKeyUp(int key) {}
//////////////////////////////////////////////////////////////////////////////
// CLASS creates an arrow button that is sensitive to touch (when down, always select)
void newuiArrowButton::Create(UIWindow *wnd, short id, short type, const char *name, short x, short y) {
void newuiArrowButton::Create(UIWindow *wnd, int16_t id, int16_t type, const char *name, int16_t x, int16_t y) {
switch (type) {
case NEWUI_ARROW_LEFT:
m_bkg = Newui_resources.Load(NEWUI_LARR_FILE);
@ -2401,7 +2401,7 @@ void newuiArrowButton::OnDraw() {
newuiCheckBox::newuiCheckBox() {}
void newuiCheckBox::Create(UIWindow *wnd, short id, const char *name, short x, short y, bool is_long) {
void newuiCheckBox::Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y, bool is_long) {
m_bkg = Newui_resources.Load(is_long ? NEWUI_LCHKBTN_FILE : NEWUI_CHKBTN_FILE);
m_litbkg = Newui_resources.Load(is_long ? NEWUI_LCHKBTNLIT_FILE : NEWUI_CHKBTNLIT_FILE);
@ -2418,7 +2418,7 @@ void newuiCheckBox::OnDraw() { newuiButton::OnDraw(); }
newuiRadioButton::newuiRadioButton() {}
void newuiRadioButton::Create(UIWindow *wnd, UIRadioButton *prev_rb, short id, const char *name, short x, short y,
void newuiRadioButton::Create(UIWindow *wnd, UIRadioButton *prev_rb, int16_t id, const char *name, int16_t x, int16_t y,
bool is_long) {
m_bkg = Newui_resources.Load(is_long ? NEWUI_LBTN_FILE : NEWUI_BTN_FILE);
m_litbkg = Newui_resources.Load(is_long ? NEWUI_LCHKBTNLIT_FILE : NEWUI_CHKBTNLIT_FILE);
@ -2440,7 +2440,7 @@ newuiSlider::newuiSlider() {
m_title = NULL;
}
void newuiSlider::Create(UIWindow *wnd, short id, const char *name, short x, short y, short range) {
void newuiSlider::Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y, int16_t range) {
ASSERT(range > 0);
if (name) {
@ -2456,9 +2456,9 @@ void newuiSlider::Create(UIWindow *wnd, short id, const char *name, short x, sho
m_unit_settings.type = -1;
}
void newuiSlider::Offset(short offs) { newuiSlider::SetPos(m_pos + offs); }
void newuiSlider::Offset(int16_t offs) { newuiSlider::SetPos(m_pos + offs); }
void newuiSlider::SetPos(short pos) {
void newuiSlider::SetPos(int16_t pos) {
if (pos < 0)
pos = 0;
if (pos > m_unitrange)
@ -2466,11 +2466,11 @@ void newuiSlider::SetPos(short pos) {
m_pos = pos;
}
void newuiSlider::SetRange(short range) { m_unitrange = range; }
void newuiSlider::SetRange(int16_t range) { m_unitrange = range; }
// when gadget is added to a window (AddGadget is called)
void newuiSlider::OnAttachToWindow() {
short bx = m_X, by = m_Y;
int16_t bx = m_X, by = m_Y;
if (m_title) {
by += m_title->height() + 5;
@ -2647,7 +2647,7 @@ newuiListBox::newuiListBox() {
m_click_time = 0.0f;
}
void newuiListBox::Create(UIWindow *wnd, short id, short x, short y, short w, short h, uint16_t flags) {
void newuiListBox::Create(UIWindow *wnd, int16_t id, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t flags) {
m_ItemList = NULL;
m_Virt2Real = NULL;
m_Real2Virt = NULL;
@ -2673,9 +2673,9 @@ void newuiListBox::Create(UIWindow *wnd, short id, short x, short y, short w, sh
m_pieces[NW_PIECE_IDX] = Newui_resources.Load(NEWUI_LB_NW_FILE);
// determine true width and height (snap width and height to 32 pixel boundaries
short p_w = LB_PIECE_WIDTH, p_h = LB_PIECE_HEIGHT;
short t_width = (w / p_w);
short t_height = (h / p_h);
int16_t p_w = LB_PIECE_WIDTH, p_h = LB_PIECE_HEIGHT;
int16_t t_width = (w / p_w);
int16_t t_height = (h / p_h);
if (w % p_w)
t_width++;
if (h % p_h)
@ -3390,7 +3390,7 @@ void newuiListBox::OnDetachFromWindow() {
m_up_btn.Destroy();
}
void newuiListBox::Offset(short offs) {
void newuiListBox::Offset(int16_t offs) {
m_Index = m_Index + offs;
if (m_Index < 0) {
m_Index = 0;
@ -3410,7 +3410,7 @@ newuiComboBox::newuiComboBox() {
m_Index = 0;
}
void newuiComboBox::Create(UIWindow *wnd, short id, short x, short y, uint16_t flags) {
void newuiComboBox::Create(UIWindow *wnd, int16_t id, int16_t x, int16_t y, uint16_t flags) {
m_ItemList = NULL;
m_Virt2Real = NULL;
m_Real2Virt = NULL;
@ -3911,7 +3911,7 @@ void newuiComboBox::OnDetachFromWindow() {
newuiEditBox::newuiEditBox() { m_title = NULL; }
void newuiEditBox::Create(UIWindow *wnd, short id, const char *name, short x, short y, short w, short flags) {
void newuiEditBox::Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y, int16_t w, int16_t flags) {
// if (name) {
// m_title = new UISnazzyTextItem(0, MONITOR9_NEWUI_FONT, name, NEWUI_MONITORFONT_COLOR);
// }
@ -3967,7 +3967,7 @@ void newuiEditBox::OnKeyDown(int key) {
newuiHotspot::newuiHotspot() { m_title = NULL; }
void newuiHotspot::Create(UIWindow *wnd, short id, const char *title, short x, short y, short w, short h, short flags) {
void newuiHotspot::Create(UIWindow *wnd, int16_t id, const char *title, int16_t x, int16_t y, int16_t w, int16_t h, int16_t flags) {
if (title) {
m_title = mem_strdup(title);
} else {
@ -4077,7 +4077,7 @@ newuiTiledWindow::newuiTiledWindow() {
m_realized = false;
}
void newuiTiledWindow::Create(const char *title, short x, short y, short w, short h, int flags) {
void newuiTiledWindow::Create(const char *title, int16_t x, int16_t y, int16_t w, int16_t h, int flags) {
if (title) {
ASSERT(strlen(title) < (sizeof(m_title) - 1));
}

View File

@ -188,7 +188,7 @@ struct tSliderSettings {
class newuiSheet {
int m_sx, m_sy; // origin of sheet gadgets relative to parent.
short m_initial_focus_id; // gadget that will have focus upon realization.
int16_t m_initial_focus_id; // gadget that will have focus upon realization.
public:
newuiSheet();
@ -218,48 +218,48 @@ public:
// call these functions to determine if a pointer's value has changed after call to UpdateReturnValues (internal)
bool HasChanged(bool *bptr);
bool HasChanged(short *sptr);
bool HasChanged(int16_t *sptr);
bool HasChanged(int *iptr);
bool HasChanged(char *cptr);
// obtain's pointer to gadget of respective item. it is your responsibility to typecast the gadget
// only works if you specified an ID! Also the sheet must have been realized by now.
UIGadget *GetGadget(short id);
UIGadget *GetGadget(int16_t id);
// set focus on this gadget specified by id upon realization.
void SetInitialFocusedGadget(short id);
void SetInitialFocusedGadget(int16_t id);
// creates gadget list.pix_offset is the pixel offset from the group title to the first control.
void NewGroup(const char *title, short x, short y, tAlignment align = NEWUI_ALIGN_VERT, short pix_offset = -1);
void NewGroup(const char *title, int16_t x, int16_t y, tAlignment align = NEWUI_ALIGN_VERT, int16_t pix_offset = -1);
// adds standard button to current group. (flags see NEWUI_BTNF_xxxx)
void AddButton(const char *title, short id, short flags = 0);
void AddButton(const char *title, int16_t id, int16_t flags = 0);
// adds a long button (flags see NEWUI_BTNF_xxxx)
void AddLongButton(const char *title, short id, short flags = 0);
void AddLongButton(const char *title, int16_t id, int16_t flags = 0);
// adds checkbox to current group. initial state of checkbox can be set.
bool *AddCheckBox(const char *title, bool init_state = false, short id = DEFAULT_NEWUID);
bool *AddCheckBox(const char *title, bool init_state = false, int16_t id = DEFAULT_NEWUID);
// adds long checkbox to current group. initial state of checkbox can be set.
bool *AddLongCheckBox(const char *title, bool init_state = false, short id = DEFAULT_NEWUID);
bool *AddLongCheckBox(const char *title, bool init_state = false, int16_t id = DEFAULT_NEWUID);
// adds a radio button to current group. initial state of radio may be set
// pointer returned will return index of radio button in group currently selected.
int *AddFirstRadioButton(const char *title, short id = DEFAULT_NEWUID);
int *AddFirstRadioButton(const char *title, int16_t id = DEFAULT_NEWUID);
// adds a radio button to current group. initial state of radio may be set
void AddRadioButton(const char *title, short id = DEFAULT_NEWUID);
void AddRadioButton(const char *title, int16_t id = DEFAULT_NEWUID);
// adds a radio button to current group. initial state of radio may be set
int *AddFirstLongRadioButton(const char *title, short id = DEFAULT_NEWUID);
int *AddFirstLongRadioButton(const char *title, int16_t id = DEFAULT_NEWUID);
// adds a radio button to current group. initial state of radio may be set
void AddLongRadioButton(const char *title, short id = DEFAULT_NEWUID);
void AddLongRadioButton(const char *title, int16_t id = DEFAULT_NEWUID);
// adds a slider, set the range for it too., returns two values, short[0] = position, short[1] = range
short *AddSlider(const char *title, short range, short init_pos = 0, tSliderSettings *settings = NULL,
short id = DEFAULT_NEWUID);
// adds a slider, set the range for it too., returns two values, int16_t[0] = position, int16_t[1] = range
int16_t *AddSlider(const char *title, int16_t range, int16_t init_pos = 0, tSliderSettings *settings = NULL,
int16_t id = DEFAULT_NEWUID);
// adds a static text item
void AddText(const char *text, ...);
@ -271,17 +271,17 @@ public:
char *AddChangeableText(int buflen);
// adds a listbox
newuiListBox *AddListBox(short w, short h, short id, uint16_t flags = 0);
newuiListBox *AddListBox(int16_t w, int16_t h, int16_t id, uint16_t flags = 0);
// adds a listbox
newuiComboBox *AddComboBox(short id, uint16_t flags = 0);
newuiComboBox *AddComboBox(int16_t id, uint16_t flags = 0);
// adds an edit box
char *AddEditBox(const char *title, short maxlen = NEWUI_EDIT_BUFLEN, short w = 0, short id = DEFAULT_NEWUID,
short flags = 0, bool return_on_esc = false);
char *AddEditBox(const char *title, int16_t maxlen = NEWUI_EDIT_BUFLEN, int16_t w = 0, int16_t id = DEFAULT_NEWUID,
int16_t flags = 0, bool return_on_esc = false);
// adds a hotspot :(, should word wrap too.
void AddHotspot(const char *title, short w, short h, short id, bool group = false);
void AddHotspot(const char *title, int16_t w, int16_t h, int16_t id, bool group = false);
// THESE FUNCTIONS ARE CALLED BY FRAMEWORK, BUT IF YOU NEED TO DO SOME CUSTOM UI HANDLING, THESE
// FUNCTIONS ARE MADE PUBLIC.
@ -298,11 +298,11 @@ private:
struct t_gadget_desc {
int8_t type; // enumerated ui gadget type
bool changed; // parameters are different than defaults?
short id; // id value
int16_t id; // id value
char *title; // title of gadget
union {
int i;
short s[2];
int16_t s[2];
bool b;
void *p;
} parm; // parameter list.
@ -326,7 +326,7 @@ private:
bool m_realized;
char *m_title;
t_gadget_desc *AddGadget(short id, int8_t type, const char *title);
t_gadget_desc *AddGadget(int16_t id, int8_t type, const char *title);
public:
const char *GetTitle() { return m_title; };
@ -339,7 +339,7 @@ public:
newuiButton();
// see (NEWUI_BTNF_xxx) flags
void Create(UIWindow *wnd, short id, const char *name, short x, short y, short flags = 0);
void Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y, int16_t flags = 0);
protected:
virtual void OnDraw(); // overridable draws the background first
@ -352,7 +352,7 @@ protected:
UISnazzyTextItem *m_text;
// this is used in multiple inheritance cases.(flags are additional attributes usually passed when creating gadget)
void InitStates(const char *name, bool is_long, short flags = 0);
void InitStates(const char *name, bool is_long, int16_t flags = 0);
public:
UISnazzyTextItem *GetTitle() { return m_text; };
@ -362,7 +362,7 @@ public:
class newuiMenuOptionButton : public newuiButton {
public:
void Create(newuiMenu *menu, newuiMenuOptionButton *last, short id, const char *name, short x, short y,
void Create(newuiMenu *menu, newuiMenuOptionButton *last, int16_t id, const char *name, int16_t x, int16_t y,
bool m_mono_press);
protected:
@ -378,7 +378,7 @@ private:
class newuiTinyButton : public newuiButton {
public:
void Create(UIWindow *wnd, short id, const char *name, short x, short y);
void Create(UIWindow *wnd, int16_t id, const char *name, int16_t x, int16_t y);
};
// CLASS creates an arrow button that is sensitive to touch (when down, always select)
@ -387,7 +387,7 @@ class newuiArrowButton : public newuiButton {
public:
newuiArrowButton(){};
void Create(UIWindow *wnd, short id, short type, const char *name, short x, short y);
void Create(UIWindow *wnd, int16_t id, int16_t type, const char *name, int16_t x, int16_t y);
void Show(bool show = true); // this will activate or deactivate a button.
protected:
@ -410,7 +410,7 @@ public:
newuiListBox();
// creates listbox
void Create(UIWindow *wnd, short id, short x, short y, short w, short h, uint16_t flags);
void Create(UIWindow *wnd, int16_t id, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t flags);
// functions to add or remove items,
void AddItem(const char *name);
@ -469,7 +469,7 @@ private:
UIBitmapItem *m_pieces[N_DIRECTIONS]; // bitmap pieces
void Offset(short offs);
void Offset(int16_t offs);
void SetInternalCurrentIndex(int index);
};
@ -480,7 +480,7 @@ public:
newuiComboBox();
// creates listbox
void Create(UIWindow *wnd, short id, short x, short y, uint16_t flags);
void Create(UIWindow *wnd, int16_t id, int16_t x, int16_t y, uint16_t flags);
// functions to add or remove items,
void AddItem(const char *name);
@ -529,13 +529,13 @@ private:
class newuiHotspot : public UIGadget {
private:
char *m_title;
short m_alpha, m_alpha_adjust;
int16_t m_alpha, m_alpha_adjust;
float m_mse_timer;
public:
newuiHotspot();
void Create(UIWindow *wnd, short id, const char *title, short x, short y, short w, short h, short flags = 0);
void Create(UIWindow *wnd, int16_t id, const char *title, int16_t x, int16_t y, int16_t w, int16_t h, int16_t flags = 0);
const char *GetTitle() const { return m_title; };
protected:
@ -563,14 +563,14 @@ public:
void Create();
// adds an option to a menu, returns a newuiSheet object to add user interface to.
newuiSheet *AddOption(short id, const char *title, int size = NEWUIMENU_SMALL, bool has_sheet = true, int yoff = 0);
void AddSimpleOption(short id, const char *title, int yoff = 0);
newuiSheet *AddOption(int16_t id, const char *title, int size = NEWUIMENU_SMALL, bool has_sheet = true, int yoff = 0);
void AddSimpleOption(int16_t id, const char *title, int yoff = 0);
// sets current option to display.
void SetCurrentOption(short id);
void SetCurrentOption(int16_t id);
// returns current option
short GetCurrentOption() const;
int16_t GetCurrentOption() const;
// returns current sheet
newuiSheet *GetCurrentSheet() const;
@ -586,10 +586,10 @@ public:
public:
// when a new option is realized, this function will be called.
// passed in: the menu object, the old option and the new option and an optional pointer respectively
void SetOnOptionSwitchCB(void (*fn)(newuiMenu *, short, short, void *), void *data);
void SetOnOptionSwitchCB(void (*fn)(newuiMenu *, int16_t, int16_t, void *), void *data);
// when a new option is ready. at this point the system sets the focus on this option
void SetOnOptionFocusCB(void (*fn)(newuiMenu *, short, void *), void *data);
void SetOnOptionFocusCB(void (*fn)(newuiMenu *, int16_t, void *), void *data);
// equivalent of SetUICallback, called before gadgets are drawn
void SetOnUIFrameCB(void (*fn)());
@ -610,12 +610,12 @@ private:
int m_optionsx, m_optionsy; // option button placements
int m_titlex, m_titley; // title location.
tAlignment m_align; // alignment of text
short m_newoptionid; // tells that a new option has been selected.
short m_cursheetidx;
int16_t m_newoptionid; // tells that a new option has been selected.
int16_t m_cursheetidx;
bool m_refreshgadgets; // refreshes gadgets on current sheet.
void (*m_activate_sheet_cb)(newuiMenu *, short, short, void *);
void (*m_option_focus_cb)(newuiMenu *, short, void *);
void (*m_activate_sheet_cb)(newuiMenu *, int16_t, int16_t, void *);
void (*m_option_focus_cb)(newuiMenu *, int16_t, void *);
void (*m_uiframe_cb)();
void *m_activate_sheet_cb_data;
@ -630,7 +630,7 @@ public:
void Create();
// adds an option to a menu, returns a newuiSheet object to add user interface to.
newuiSheet *AddOption(short id, const char *title, int size = NEWUIMENU_MEDIUM);
newuiSheet *AddOption(int16_t id, const char *title, int size = NEWUIMENU_MEDIUM);
};
// CLASS, small message box
@ -668,7 +668,7 @@ class newuiTiledWindow : public UIWindow {
public:
newuiTiledWindow();
void Create(const char *title, short x, short y, short w, short h, int flags = 0);
void Create(const char *title, int16_t x, int16_t y, int16_t w, int16_t h, int flags = 0);
// grab a newui interface from it.
newuiSheet *GetSheet();
@ -714,27 +714,27 @@ private:
#define F_APPROXIMATE(_f) ((_f) + 0.000001f)
inline short CALC_SLIDER_POS_FLOAT(float val, const tSliderSettings *settings, short range) {
short curpos;
curpos = (short)F_APPROXIMATE(((val - settings->min_val.f) * range) / (settings->max_val.f - settings->min_val.f));
inline int16_t CALC_SLIDER_POS_FLOAT(float val, const tSliderSettings *settings, int16_t range) {
int16_t curpos;
curpos = (int16_t)F_APPROXIMATE(((val - settings->min_val.f) * range) / (settings->max_val.f - settings->min_val.f));
return curpos;
}
inline short CALC_SLIDER_POS_INT(int val, const tSliderSettings *settings, short range) {
short curpos;
inline int16_t CALC_SLIDER_POS_INT(int val, const tSliderSettings *settings, int16_t range) {
int16_t curpos;
float num = (float)((val - settings->min_val.i) * range);
float dem = (float)((settings->max_val.i - settings->min_val.i));
curpos = (short)F_APPROXIMATE(num / dem);
curpos = (int16_t)F_APPROXIMATE(num / dem);
return curpos;
}
inline float CALC_SLIDER_FLOAT_VALUE(short val, float min, float max, short range) {
inline float CALC_SLIDER_FLOAT_VALUE(int16_t val, float min, float max, int16_t range) {
float retval;
retval = F_APPROXIMATE((max - min) * val / range) + min;
return retval;
}
inline int CALC_SLIDER_INT_VALUE(short val, int min, int max, short range) {
inline int CALC_SLIDER_INT_VALUE(int16_t val, int min, int max, int16_t range) {
int retval;
float num = (float)((max - min) * val);
retval = (int)(F_APPROXIMATE(num / range)) + min;

View File

@ -1199,7 +1199,7 @@
object *Player_object = NULL; // the object that is the player
object *Viewer_object = NULL; // which object we are seeing from
static short free_obj_list[MAX_OBJECTS];
static int16_t free_obj_list[MAX_OBJECTS];
// Data for objects
@ -1212,7 +1212,7 @@ object Objects[MAX_OBJECTS];
tPosHistory Object_position_samples[MAX_OBJECT_POS_HISTORY];
uint8_t Object_position_head;
int16_t Object_map_position_history[MAX_OBJECTS];
short Object_map_position_free_slots[MAX_OBJECT_POS_HISTORY];
int16_t Object_map_position_free_slots[MAX_OBJECT_POS_HISTORY];
uint16_t Num_free_object_position_history;
int Num_objects = 0;
@ -1254,7 +1254,7 @@ char *Object_type_names[MAX_OBJECT_TYPES] = {
#endif
int Num_big_objects = 0;
short BigObjectList[MAX_BIG_OBJECTS]; // DAJ_MR utb int
int16_t BigObjectList[MAX_BIG_OBJECTS]; // DAJ_MR utb int
/*
* Local Function Prototypes

View File

@ -694,7 +694,7 @@ extern object *Viewer_object; // which object we are seeing from
#define MAX_BIG_OBJECTS 350
extern int Num_big_objects;
extern short BigObjectList[MAX_BIG_OBJECTS]; // DAJ_MR utb int
extern int16_t BigObjectList[MAX_BIG_OBJECTS]; // DAJ_MR utb int
// Compute the object number from an object pointer
#define OBJNUM(objp) (objp - Objects)

View File

@ -370,7 +370,7 @@ extern char *Anim_state_names[];
// Info for an animation state
typedef struct {
short from, to;
int16_t from, to;
float spc;
int anim_sound_index;
uint8_t used;
@ -477,10 +477,10 @@ typedef struct {
char *description; // used for inventory
char icon_name[MAX_INVEN_ICON_SIZE]; // used for inventory
short sounds[MAX_OBJ_SOUNDS]; // list of sound handles
short dspew[MAX_DSPEW_TYPES];
int16_t sounds[MAX_OBJ_SOUNDS]; // list of sound handles
int16_t dspew[MAX_DSPEW_TYPES];
float dspew_percent[MAX_DSPEW_TYPES];
short dspew_number[MAX_DSPEW_TYPES];
int16_t dspew_number[MAX_DSPEW_TYPES];
uint8_t f_dspew;
// Valid for physics objects only

View File

@ -2307,9 +2307,9 @@ void osipf_MatcenValue(int matcen_id, char op, char var_handle, void *ptr, int i
break;
case MTNV_S_CREATION_TEXTURE:
if (op == VF_GET)
(*(short *)ptr) = Matcen[matcen_id]->GetCreationTexture();
(*(int16_t *)ptr) = Matcen[matcen_id]->GetCreationTexture();
else if (op == VF_SET)
Matcen[matcen_id]->SetCreationTexture(*(short *)ptr);
Matcen[matcen_id]->SetCreationTexture(*(int16_t *)ptr);
break;
case MTNV_C_NUM_SPAWN_PTS:
@ -2477,9 +2477,9 @@ int osipf_CFReadBytes(uint8_t *buffer, int count, CFILE *cfp) { return cf_ReadBy
// Throws an exception of type (cfile_error *) if the OS returns an error on read
int osipf_CFReadInt(CFILE *cfp) { return cf_ReadInt(cfp); }
// Read and return a short (16 bits)
// Read and return a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on read
short osipf_CFReadShort(CFILE *cfp) { return cf_ReadShort(cfp); }
int16_t osipf_CFReadShort(CFILE *cfp) { return cf_ReadShort(cfp); }
// Read and return a byte (8 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on read
@ -2528,9 +2528,9 @@ int osipf_CFWriteString(const char *buf, CFILE *cfp) { return cf_WriteString(cfp
// Throws an exception of type (cfile_error *) if the OS returns an error on write
void osipf_CFWriteInt(int i, CFILE *cfp) { cf_WriteInt(cfp, i); }
// Write a short (16 bits)
// Write a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on write
void osipf_CFWriteShort(short s, CFILE *cfp) { cf_WriteShort(cfp, s); }
void osipf_CFWriteShort(int16_t s, CFILE *cfp) { cf_WriteShort(cfp, s); }
// Write a byte (8 bits). If the byte is a newline & the file is a text file, writes a CR/LF pair.
// Throws an exception of type (cfile_error *) if the OS returns an error on write
@ -3319,12 +3319,12 @@ void osipf_AIGoalValue(int obj_handle, char g_index, char op, char vtype, void *
int osipf_AIGetNearbyObjs(vector *pos, int init_roomnum, float rad, int *object_handle_list, int max_elements,
bool f_lightmap_only, bool f_only_players_and_ais, bool f_include_non_collide_objects,
bool f_stop_at_closed_doors) {
short *s_list;
int16_t *s_list;
int num_close;
int i;
int count = 0;
s_list = (short *)mem_malloc(sizeof(short) * max_elements);
s_list = (int16_t *)mem_malloc(sizeof(int16_t) * max_elements);
num_close = fvi_QuickDistObjectList(pos, init_roomnum, rad, s_list, max_elements, f_lightmap_only,
f_only_players_and_ais, f_include_non_collide_objects, f_stop_at_closed_doors);

View File

@ -266,9 +266,9 @@ int osipf_CFReadBytes(uint8_t *buffer, int count, CFILE *cfp);
// Throws an exception of type (cfile_error *) if the OS returns an error on read
int osipf_CFReadInt(CFILE *cfp);
// Read and return a short (16 bits)
// Read and return a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on read
short osipf_CFReadShort(CFILE *cfp);
int16_t osipf_CFReadShort(CFILE *cfp);
// Read and return a byte (8 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on read
@ -317,9 +317,9 @@ int osipf_CFWriteString(const char *buf, CFILE *cfp);
// Throws an exception of type (cfile_error *) if the OS returns an error on write
void osipf_CFWriteInt(int i, CFILE *cfp);
// Write a short (16 bits)
// Write a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on write
void osipf_CFWriteShort(short s, CFILE *cfp);
void osipf_CFWriteShort(int16_t s, CFILE *cfp);
// Write a byte (8 bits). If the byte is a newline & the file is a text file, writes a CR/LF pair.
// Throws an exception of type (cfile_error *) if the OS returns an error on write

View File

@ -929,7 +929,7 @@ void PilotListSelectChangeCallback(int index) {
PilotChooseDialogInfo.initial_call = false;
}
void selectcb(newuiMenu *menu, short id, void *data) {
void selectcb(newuiMenu *menu, int16_t id, void *data) {
pilot_select_menu *select = (pilot_select_menu *)data;
if (id == IDP_SELECT) {
menu->SetFocusOnGadget(select->pilot_list);

View File

@ -184,7 +184,7 @@
* added multiple colored balls for players
*
* 54 6/25/98 12:45p Jeff
* fixed callsign length, it was too short
* fixed callsign length, it was too int16_t
*
* 53 5/26/98 7:49p Samir
* E3 version has a long afterburner.

View File

@ -28,12 +28,12 @@
typedef struct {
uint8_t type; // See types above
union {
short objnum;
short visnum;
short facenum;
int16_t objnum;
int16_t visnum;
int16_t facenum;
};
short roomnum;
int16_t roomnum;
float z;
} postrender_struct;

View File

@ -92,7 +92,7 @@ typedef struct {
int flags;
uint16_t used;
short sounds[MAX_POWERUP_SOUNDS];
int16_t sounds[MAX_POWERUP_SOUNDS];
// Default physics information for this powerup type
physics_info phys_info; // the physics data for this obj type.

View File

@ -71,7 +71,7 @@ static float Noise_table[TABSIZE * 3];
dynamic_proc_element DynamicProcElements[MAX_PROC_ELEMENTS];
uint16_t DefaultProcPalette[256];
int Num_proc_elements = 0;
static short Proc_free_list[MAX_PROC_ELEMENTS];
static int16_t Proc_free_list[MAX_PROC_ELEMENTS];
uint16_t ProcFadeTable[32768];
#define NUM_WATER_SHADES 64
uint16_t WaterProcTableHi[NUM_WATER_SHADES][256];
@ -815,8 +815,8 @@ void CalcWater2(int handle, int density) {
int count = PROC_SIZE + 1;
proc_struct *procedural = GameTextures[handle].procedural;
short *newptr = (short *)procedural->proc2;
short *oldptr = (short *)procedural->proc1;
int16_t *newptr = (int16_t *)procedural->proc2;
int16_t *oldptr = (int16_t *)procedural->proc1;
int x, y;
@ -878,8 +878,8 @@ void CalcWater(int handle, int density) {
int count = PROC_SIZE + 1;
proc_struct *procedural = GameTextures[handle].procedural;
short *newptr = (short *)procedural->proc2;
short *oldptr = (short *)procedural->proc1;
int16_t *newptr = (int16_t *)procedural->proc2;
int16_t *oldptr = (int16_t *)procedural->proc1;
int x, y;
@ -937,7 +937,7 @@ void DrawWaterNoLight(int handle) {
int dest_bitmap = procedural->procedural_bitmap;
uint16_t *dest_data = (uint16_t *)bm_data(dest_bitmap, 0);
uint16_t *src_data = (uint16_t *)bm_data(GameTextures[handle].bm_handle, 0);
short *ptr = (short *)procedural->proc1;
int16_t *ptr = (int16_t *)procedural->proc1;
for (y = 0; y < PROC_SIZE; y++) {
for (x = 0; x < PROC_SIZE; x++, offset++) {
if (x == PROC_SIZE - 1)
@ -968,7 +968,7 @@ void DrawWaterWithLight(int handle, int lightval) {
int dest_bitmap = procedural->procedural_bitmap;
uint16_t *dest_data = (uint16_t *)bm_data(dest_bitmap, 0);
uint16_t *src_data = (uint16_t *)bm_data(GameTextures[handle].bm_handle, 0);
short *ptr = (short *)procedural->proc1;
int16_t *ptr = (int16_t *)procedural->proc1;
for (y = 0; y < PROC_SIZE; y++) {
int ychange, ychange2;
if (y == PROC_SIZE - 1) {
@ -1015,7 +1015,7 @@ void AddProcHeightBlob(static_proc_element *proc, int handle) {
int rquad;
int cx, cy, cyq;
int left, top, right, bottom;
short *dest_data = (short *)GameTextures[handle].procedural->proc1;
int16_t *dest_data = (int16_t *)GameTextures[handle].procedural->proc1;
int x = proc->x1;
int y = proc->y1;
int procnum = proc - GameTextures[handle].procedural->static_proc_elements;
@ -1100,7 +1100,7 @@ void AddProcSineBlob(static_proc_element *proc, int handle) {
int radius = proc->size;
int radsquare = radius * radius;
float length = (1024.0 / (float)radius) * (1024.0 / (float)radius);
short *dest_data = (short *)GameTextures[handle].procedural->proc1;
int16_t *dest_data = (int16_t *)GameTextures[handle].procedural->proc1;
int height = proc->speed;
radsquare = (radius * radius);
left = -radius;
@ -1174,7 +1174,7 @@ void EvaluateWaterProcedural(int handle) {
if (EasterEgg) {
if (Easter_egg_handle != -1) {
uint16_t *src_data = bm_data(Easter_egg_handle, 0);
short *dest_data = (short *)GameTextures[handle].procedural->proc1;
int16_t *dest_data = (int16_t *)GameTextures[handle].procedural->proc1;
int sw = bm_w(Easter_egg_handle, 0);
int sh = bm_w(Easter_egg_handle, 0);
int x1 = (PROC_SIZE / 2) - (sw / 2);
@ -1224,7 +1224,7 @@ void EvaluateWaterProcedural(int handle) {
}
CalcWater(handle, thickness);
// Swap for next time
short *temp = (short *)procedural->proc1;
int16_t *temp = (int16_t *)procedural->proc1;
procedural->proc1 = procedural->proc2;
procedural->proc2 = temp;
}

View File

@ -56,7 +56,7 @@ typedef struct {
fix x1, y1;
short prev, next;
int16_t prev, next;
} dynamic_proc_element;
extern dynamic_proc_element DynamicProcElements[];

View File

@ -148,12 +148,12 @@ char Rooms_visited[MAX_ROOMS + MAX_PALETTE_ROOMS];
int Facing_visited[MAX_ROOMS + MAX_PALETTE_ROOMS];
// For keeping track of portal recursion
uint8_t Room_depth_list[MAX_ROOMS + MAX_PALETTE_ROOMS];
short Render_list[MAX_RENDER_ROOMS];
short External_room_list[MAX_ROOMS];
int16_t Render_list[MAX_RENDER_ROOMS];
int16_t External_room_list[MAX_ROOMS];
int N_external_rooms;
// For rendering specular faces
#define MAX_SPECULAR_FACES 2500
short Specular_faces[MAX_SPECULAR_FACES];
int16_t Specular_faces[MAX_SPECULAR_FACES];
int Num_specular_faces_to_render = 0;
int Num_real_specular_faces_to_render = 0; // Non-invisible specular faces
typedef struct {
@ -173,7 +173,7 @@ int Room_fog_plane_check = 0;
float Room_fog_distance = 0;
float Room_fog_eye_distance = 0;
vector Room_fog_plane, Room_fog_portal_vert;
short Fog_faces[MAX_FACES_PER_ROOM];
int16_t Fog_faces[MAX_FACES_PER_ROOM];
int Num_fog_faces_to_render = 0;
#define MAX_EXTERNAL_ROOMS 100
vector External_room_corners[MAX_EXTERNAL_ROOMS][8];
@ -185,8 +185,8 @@ uint8_t External_room_project_net[MAX_EXTERNAL_ROOMS];
#define LGF_INCREASING 2
#define LGF_FAST 4
typedef struct {
short roomnum;
short facenum;
int16_t roomnum;
int16_t facenum;
float size;
vector center;
float scalar;
@ -206,9 +206,9 @@ vector Global_alter_vec = {19, -19, 19};
bool Render_mirror_for_room = false;
int Mirror_room;
int Num_mirrored_rooms;
short Mirrored_room_list[MAX_ROOMS];
int16_t Mirrored_room_list[MAX_ROOMS];
uint8_t Mirrored_room_checked[MAX_ROOMS];
short Mirror_rooms[MAX_ROOMS];
int16_t Mirror_rooms[MAX_ROOMS];
int Num_mirror_rooms = 0;
//
// UTILITY FUNCS
@ -1070,7 +1070,7 @@ void BuildRoomListSub(int start_room_num, clip_wnd *wnd, int depth) {
}
// compare function for room z sort
float Room_z_depth[MAX_ROOMS + MAX_PALETTE_ROOMS];
static int Room_z_sort_func(const short *a, const short *b) {
static int Room_z_sort_func(const int16_t *a, const int16_t *b) {
float az, bz;
az = Room_z_depth[*a];
bz = Room_z_depth[*b];
@ -2129,7 +2129,7 @@ draw_fog:
}
static float face_depth[MAX_FACES_PER_ROOM];
// compare function for room face sort
static int room_face_sort_func(const short *a, const short *b) {
static int room_face_sort_func(const int16_t *a, const int16_t *b) {
float az, bz;
az = face_depth[*a];
bz = face_depth[*b];
@ -3804,7 +3804,7 @@ void RenderBlankScreen(void) { rend_ClearScreen(GR_BLACK); }
// roomnum,facenum - these are filled in with the found values
// if room<0, then an object was found, and the object number is -room-1
// Returns: 1 if found a room, else 0
/*int FindRoomFace(short x,short y,int start_roomnum,int *roomnum,int *facenum)
/*int FindRoomFace(int16_t x,int16_t y,int start_roomnum,int *roomnum,int *facenum)
{
//Init search mode
search_mode = -1;
@ -3826,7 +3826,7 @@ void RenderBlankScreen(void) { rend_ClearScreen(GR_BLACK); }
// start_roomnum - where to start rendering
// roomnum,facenum,lumel_num - these are filled in with the found values
// Returns: 1 if found a room, else 0
/*int FindLightmapFace(short x,short y,int start_roomnum,int *roomnum,int *facenum,int *lumel_num)
/*int FindLightmapFace(int16_t x,int16_t y,int start_roomnum,int *roomnum,int *facenum,int *lumel_num)
{
Search_lightmaps=1;
search_x = x; search_y = y;

View File

@ -188,7 +188,7 @@ extern bool Render_inside_only;
#define Lighting_on 1
#define Outline_mode 0
#endif
extern short use_opengl_1555_format; // DAJ
extern int16_t use_opengl_1555_format; // DAJ
#ifndef RELEASE
extern int Mine_depth;
@ -218,7 +218,7 @@ extern vector Room_fog_plane, Room_fog_portal_vert;
struct face;
typedef struct {
short roomnum;
int16_t roomnum;
float close_dist;
face *close_face;
} fog_portal_data;
@ -264,7 +264,7 @@ void RenderMine(int viewer_roomnum, int flag_automap = 0, int called_from_terrai
// roomnum,facenum - these are filled in with the found values
// if room<0, then an object was found, and the object number is -room-1
// Returns: 1 if found a room, else 0
int FindRoomFace(short x, short y, int start_roomnum, int *roomnum, int *facenum);
int FindRoomFace(int16_t x, int16_t y, int start_roomnum, int *roomnum, int *facenum);
// finds what room,face,lumel is visible at a given screen x & y
// Everything must be set up just like for RenderMineRoom(), and presumably is the same as
@ -273,7 +273,7 @@ int FindRoomFace(short x, short y, int start_roomnum, int *roomnum, int *facenum
// start_roomnum - where to start rendering
// roomnum,facenum,lumel_num - these are filled in with the found values
// Returns: 1 if found a room, else 0
int FindLightmapFace(short x, short y, int start_roomnum, int *roomnum, int *facenum, int *lumel_num);
int FindLightmapFace(int16_t x, int16_t y, int start_roomnum, int *roomnum, int *facenum, int *lumel_num);
// This is needed for small view cameras
// It clears the facing array so that it is recomputed

View File

@ -140,12 +140,12 @@ typedef struct face {
uint8_t num_verts; // how many vertices in this face
int8_t portal_num; // which portal this face is part of, or -1 if none
short *face_verts; // index into list of vertices for this face
int16_t *face_verts; // index into list of vertices for this face
roomUVL *face_uvls; // index into list of uvls for this face
vector normal; // the surface normal of this face
short tmap; // texture numbers for this face
int16_t tmap; // texture numbers for this face
uint16_t lmi_handle; // the lightmap info number for this face
short special_handle; // the index into the special_faces array
int16_t special_handle; // the index into the special_faces array
uint8_t renderframe; // what frame this face was last rendered (for lighting)
uint8_t light_multiple; // what multiple to times by
vector min_xyz, max_xyz; // min & max extents of this face (for FVI)
@ -163,10 +163,10 @@ typedef struct face {
// a connection between two rooms
typedef struct portal {
int flags; // flags for this portal
short portal_face; // the face for this portal
short croom; // the room this portal connects to
short cportal; // the portal in croom this portal connects to
short bnode_index;
int16_t portal_face; // the face for this portal
int16_t croom; // the room this portal connects to
int16_t cportal; // the portal in croom this portal connects to
int16_t bnode_index;
int combine_master; // For rendering combined portals
vector path_pnt; // Point used by the path system
} portal;
@ -229,32 +229,32 @@ typedef struct room {
// Hierarchical bounding boxes for this room
vector bbf_min_xyz;
vector bbf_max_xyz;
short num_bbf_regions;
short pad1;
short **bbf_list;
short *num_bbf;
int16_t num_bbf_regions;
int16_t pad1;
int16_t **bbf_list;
int16_t *num_bbf;
vector *bbf_list_min_xyz;
vector *bbf_list_max_xyz;
uint8_t *bbf_list_sector;
bn_list bn_info;
short wpb_index; // world point buffer index - where this room starts
int16_t wpb_index; // world point buffer index - where this room starts
uint8_t pulse_time; // each room can has a pulse time
uint8_t pulse_offset; // each room has a timer offset for which it pulses
vector wind; // Wind vector for the room
int ambient_sound; // Index of ambient sound pattern for this room, or -1 if none
short vis_effects; // index of first visual effect in this room
short mirror_face; // Index of face that this room is to be mirrored by
int16_t vis_effects; // index of first visual effect in this room
int16_t mirror_face; // Index of face that this room is to be mirrored by
uint8_t num_mirror_faces; // Number of faces in this room that have the same texture as the mirror
uint16_t *mirror_faces_list; // the list of faces in this room that have the same texture as the mirror
float damage; // The damage per second applied to players (& maybe others) in room
vector path_pnt; // Point used by the path system
uint8_t *volume_lights; // Pointer to memory for our volumetric lighting
short volume_width; // The dimensions of our volumetric room
short volume_height;
short volume_depth;
int16_t volume_width; // The dimensions of our volumetric room
int16_t volume_height;
int16_t volume_depth;
float fog_depth; // How far until fog is totally opaque
float fog_r, fog_g, fog_b; // Fog color

View File

@ -234,7 +234,7 @@ static struct {
tLargeBitmap *bmp;
} vis_list[2];
short time_min, time_sec;
int16_t time_min, time_sec;
float shield_rating, energy_rating;
float accuracy_rating;
} PLR;
@ -453,8 +453,8 @@ void SinglePlayerPostLevelResults() {
int curline = 0;
int j;
PLR.time_min = (short)Players[Player_num].time_level / 60.0f;
PLR.time_sec = (short)(Players[Player_num].time_level - ((float)PLR.time_min * 60.0f));
PLR.time_min = (int16_t)Players[Player_num].time_level / 60.0f;
PLR.time_sec = (int16_t)(Players[Player_num].time_level - ((float)PLR.time_min * 60.0f));
PLR.shield_rating = Objects[Players[Player_num].objnum].shields;
PLR.energy_rating = Players[Player_num].energy;
if (Players[Player_num].num_discharges_level > 0)

View File

@ -56,7 +56,7 @@ terrain_sky Terrain_sky;
#if (!defined(RELEASE) || defined(NEWEDITOR))
// first object to render after cell has been rendered (only used for SW renderer)
short Terrain_seg_render_objs[TERRAIN_WIDTH * TERRAIN_DEPTH];
int16_t Terrain_seg_render_objs[TERRAIN_WIDTH * TERRAIN_DEPTH];
#endif
// Our lighting maps for the terrain, one for each quadrant (starting at lower left)
@ -797,7 +797,7 @@ void SetupSky(float radius, int flags, uint8_t randit) {
int LoadPCXTerrain(char *filename) {
CFILE *infile;
int run = 0, i, total, j, n;
short xmin, ymin, xmax, ymax;
int16_t xmin, ymin, xmax, ymax;
int width, height;
uint8_t buf;
uint8_t *lando;

View File

@ -86,8 +86,8 @@ typedef struct {
uint8_t l, r, g, b;
short objects; // Index of the first object in this cell
short texseg_index; // index into the tex_segment array
int16_t objects; // Index of the first object in this cell
int16_t texseg_index; // index into the tex_segment array
uint8_t flags; // various flags
uint8_t lm_quad; // which lightmap quad this index belongs to
@ -99,7 +99,7 @@ typedef struct {
typedef struct {
uint8_t rotation;
short tex_index;
int16_t tex_index;
} terrain_tex_segment;
// Data for LOD shutoff code
@ -117,7 +117,7 @@ typedef struct {
float horizon_u[MAX_HORIZON_PIECES][5];
float horizon_v[MAX_HORIZON_PIECES][5];
short dome_texture;
int16_t dome_texture;
float radius;
float rotate_rate;
@ -138,7 +138,7 @@ typedef struct {
uint8_t num_satellites;
uint8_t num_stars;
short satellite_texture[MAX_SATELLITES];
int16_t satellite_texture[MAX_SATELLITES];
vector lightsource;
angle lightangle;
@ -161,7 +161,7 @@ typedef struct {
typedef struct {
int terrain_seg;
uint8_t num_segs;
short mine_segs[50];
int16_t mine_segs[50];
} terrain_mine_list;
typedef struct {
@ -209,7 +209,7 @@ extern terrain_segment Terrain_seg[TERRAIN_WIDTH * TERRAIN_DEPTH];
extern terrain_tex_segment Terrain_tex_seg[TERRAIN_TEX_WIDTH * TERRAIN_TEX_DEPTH];
// first object to render after cell has been rendered (only used for SW renderer)
extern short Terrain_seg_render_objs[];
extern int16_t Terrain_seg_render_objs[];
#ifdef RELEASE
#define TERRAIN_REGION(x) ((Terrain_seg[0x7FFFFFFF & x].flags & TFM_REGION_MASK) >> 5)

View File

@ -117,8 +117,8 @@ typedef struct trigger {
char name[TRIG_NAME_LEN + 1]; // the name of this trigger
int roomnum; // the room this trigger is in
int facenum; // the face to which this trigger is attched
short flags; // flags for this trigger
short activator; // flags for what can activate this trigger
int16_t flags; // flags for this trigger
int16_t activator; // flags for what can activate this trigger
// This is allocated when the level is started
tOSIRISTriggerScript osiris_script;
} trigger;

View File

@ -204,7 +204,7 @@ int AllocVClip() {
for (i = 0; i < MAX_VCLIPS; i++) {
if (GameVClips[i].used == 0) {
memset(&GameVClips[i], 0, sizeof(vclip));
GameVClips[i].frames = (short *)mem_malloc(VCLIP_MAX_FRAMES * sizeof(short));
GameVClips[i].frames = (int16_t *)mem_malloc(VCLIP_MAX_FRAMES * sizeof(int16_t));
ASSERT(GameVClips[i].frames);
GameVClips[i].frame_time = DEFAULT_FRAMETIME;
GameVClips[i].flags = VCF_NOT_RESIDENT;

View File

@ -32,8 +32,8 @@
typedef struct {
char name[PAGENAME_LEN];
short num_frames;
short *frames; // bitmap indices
int16_t num_frames;
int16_t *frames; // bitmap indices
float frame_time; // time (in seconds) of each frame
int flags;
uint8_t target_size; // what size this vclip should use (texture wise)

View File

@ -463,11 +463,11 @@
// DAJ vis_effect VisEffects[max_vis_effects];
// DAJ uint16_t VisDeadList[max_vis_effects];
// DAJ static short Vis_free_list[max_vis_effects];
// DAJ static int16_t Vis_free_list[max_vis_effects];
vis_effect *VisEffects = NULL;
static short *Vis_free_list = NULL;
static int16_t *Vis_free_list = NULL;
uint16_t *VisDeadList = NULL;
uint16_t max_vis_effects = 0;
@ -496,11 +496,11 @@ void InitVisEffects() {
if (VisEffects != NULL) {
VisEffects = (vis_effect *)mem_realloc(VisEffects, sizeof(vis_effect) * max_vis_effects);
VisDeadList = (uint16_t *)mem_realloc(VisDeadList, sizeof(uint16_t) * max_vis_effects);
Vis_free_list = (short *)mem_realloc(Vis_free_list, sizeof(short) * max_vis_effects);
Vis_free_list = (int16_t *)mem_realloc(Vis_free_list, sizeof(int16_t) * max_vis_effects);
} else if (VisEffects == NULL) {
VisEffects = (vis_effect *)mem_malloc(sizeof(vis_effect) * max_vis_effects);
VisDeadList = (uint16_t *)mem_malloc(sizeof(uint16_t) * max_vis_effects);
Vis_free_list = (short *)mem_malloc(sizeof(short) * max_vis_effects);
Vis_free_list = (int16_t *)mem_malloc(sizeof(int16_t) * max_vis_effects);
}
for (int i = 0; i < max_vis_effects; i++) {
VisEffects[i].type = VIS_NONE;

View File

@ -107,13 +107,13 @@ typedef struct {
int phys_flags;
short custom_handle;
int16_t custom_handle;
uint16_t lighting_color;
uint16_t flags;
short next;
short prev;
int16_t next;
int16_t prev;
vis_attach_info attach_info;
axis_billboard_info billboard_info;

View File

@ -166,7 +166,7 @@
* added reset reticle when setting a new weapon.
*
* 46 4/24/98 8:02a Samir
* added a short weapon name array.
* added a int16_t weapon name array.
*
* 45 4/22/98 1:08p Chris
* Fixed auto-firing of weapons after auto-selection

View File

@ -156,7 +156,7 @@
* Added death_dot and bounce sound for weapons
*
* 46 4/24/98 8:02a Samir
* added a short weapon name array.
* added a int16_t weapon name array.
*
* 45 4/19/98 5:00p Jason
* added cool napalm effect, plus made object effects dynamically
@ -270,17 +270,17 @@ typedef struct {
float player_damage; // how much damage a full impact causes a player
float generic_damage; // how much damage a full impact causes a robot
float alpha; // What alpha to draw this weapon with
short sounds[MAX_WEAPON_SOUNDS]; // sounds for various things
short hud_image_handle; // a handle to a bitmap or vclip for the hud display
short fire_image_handle; // model or bitmap. Shown when you fire this weapon
short explode_image_handle; // exploding vclip
short smoke_handle; // smoke trail handle to texture
short spawn_handle; // weapon handle that gets spawned
short alternate_spawn_handle; // weapon handle that gets spawned (sometimes)
short robot_spawn_handle; // robot that gets spawned as a countermeasure
short particle_handle; // particle handle to texture
short icon_handle;
short scorch_handle; // handle for scorch bitmap, or -1 for none
int16_t sounds[MAX_WEAPON_SOUNDS]; // sounds for various things
int16_t hud_image_handle; // a handle to a bitmap or vclip for the hud display
int16_t fire_image_handle; // model or bitmap. Shown when you fire this weapon
int16_t explode_image_handle; // exploding vclip
int16_t smoke_handle; // smoke trail handle to texture
int16_t spawn_handle; // weapon handle that gets spawned
int16_t alternate_spawn_handle; // weapon handle that gets spawned (sometimes)
int16_t robot_spawn_handle; // robot that gets spawned as a countermeasure
int16_t particle_handle; // particle handle to texture
int16_t icon_handle;
int16_t scorch_handle; // handle for scorch bitmap, or -1 for none
uint8_t spawn_count; // how many of spawn handle gets created
uint8_t alternate_chance; // how often the alternate spawn weapon gets chosen (0 to 100)

View File

@ -99,21 +99,21 @@ typedef struct {
// structure of the header in the file
typedef struct iff_bitmap_header {
short w, h; // width and height of this bitmap
short x, y; // generally unused
short type; // see types above
short transparentcolor; // which color is transparent (if any)
short pagewidth, pageheight; // width & height of source screen
int16_t w, h; // width and height of this bitmap
int16_t x, y; // generally unused
int16_t type; // see types above
int16_t transparentcolor; // which color is transparent (if any)
int16_t pagewidth, pageheight; // width & height of source screen
uint8_t nplanes; // number of planes (8 for 256 color image)
uint8_t masking, compression; // see constants above
uint8_t xaspect, yaspect; // aspect ratio (usually 5/6)
pal_entry palette[256]; // the palette for this bitmap
uint8_t *raw_data; // ptr to array of data
short row_size; // offset to next row
int16_t row_size; // offset to next row
} iff_bitmap_header;
short iff_transparent_color;
short iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is valid
int16_t iff_transparent_color;
int16_t iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is valid
#define MIN(a, b) ((a < b) ? a : b)

View File

@ -153,7 +153,7 @@ static int Fake_file_size = 0;
static inline char tga_read_byte();
static inline int tga_read_int();
static inline short tga_read_short();
static inline int16_t tga_read_short();
static uint16_t bm_tga_translate_pixel(int pixel, int format);
static int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int type);
@ -180,8 +180,8 @@ inline int tga_read_int() {
return INTEL_INT(i);
}
inline short tga_read_short() {
short i;
inline int16_t tga_read_short() {
int16_t i;
// Check for bad file
if (Fake_pos + 2 > Fake_file_size) {
@ -189,7 +189,7 @@ inline short tga_read_short() {
return 0;
}
i = *(short *)(Tga_file_data + Fake_pos);
i = *(int16_t *)(Tga_file_data + Fake_pos);
Fake_pos += 2;
return INTEL_SHORT(i);

View File

@ -915,7 +915,7 @@ int32_t cf_ReadInt(CFILE *cfp) {
cf_ReadBytes((uint8_t *)&i, sizeof(i), cfp);
return INTEL_INT(i);
}
// Read and return a short (16 bits)
// Read and return a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on read
int16_t cf_ReadShort(CFILE *cfp) {
int16_t i;
@ -1029,10 +1029,10 @@ void cf_WriteInt(CFILE *cfp, int32_t i) {
cf_WriteBytes((uint8_t *)&t, sizeof(t), cfp);
}
// Write a short (16 bits)
// Write a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on write
void cf_WriteShort(CFILE *cfp, int16_t s) {
short t = INTEL_SHORT(s);
int16_t t = INTEL_SHORT(s);
cf_WriteBytes((uint8_t *)&t, sizeof(t), cfp);
}

View File

@ -229,7 +229,7 @@ int cf_ReadBytes(uint8_t *buf, int count, CFILE *cfp);
// Throws an exception of type (cfile_error *) if the OS returns an error on read
int32_t cf_ReadInt(CFILE *cfp);
// Read and return a short (16 bits)
// Read and return a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on read
int16_t cf_ReadShort(CFILE *cfp);
@ -283,7 +283,7 @@ int cfprintf(CFILE *cfp, const char *format, ...);
// Throws an exception of type (cfile_error *) if the OS returns an error on write
void cf_WriteInt(CFILE *cfp, int32_t i);
// Write a short (16 bits)
// Write a int16_t (16 bits)
// Throws an exception of type (cfile_error *) if the OS returns an error on write
void cf_WriteShort(CFILE *cfp, int16_t s);

View File

@ -61,7 +61,7 @@ static struct {
int cur_song; // current song
int n_hostiles; // number of hostiles ai thinks there are.
tMusicVal trigger;
short pending_region; // pending region change.
int16_t pending_region; // pending region change.
bool was_toggled_on; // music was turned on by user.
bool immediate_switch; // force switch immediately for regions
bool restart_sequencer; // restarts sequencer next frame.
@ -273,7 +273,7 @@ void D3MusicAI(tMusicSeqInfo *music_info) {
//@@// if no hostiles and mood != mood_default, then modify mood until it equals 0 again. do it every second.
//@@ if (MusicAI.mood != MusicAI.mood_default) {
//@@ short mod = (MusicAI.flags & MUSICAIF_HOSTILES) ? 1 : 2;
//@@ int16_t mod = (MusicAI.flags & MUSICAIF_HOSTILES) ? 1 : 2;
//@@ float time_mod = (MusicAI.flags & MUSICAIF_HOSTILES) ? 0.2f : 0.2f;
//@@ if (MusicAI.mood_timer >= time_mod) {
//@@ if (MusicAI.mood > MusicAI.mood_default) {
@ -414,7 +414,7 @@ void D3MusicSongSelector() {
}
// set music region
void D3MusicSetRegion(short region, bool immediate) {
void D3MusicSetRegion(int16_t region, bool immediate) {
if (Music_seq.GetCurrentRegion() != region) {
MusicAI.immediate_switch = immediate;
MusicAI.pending_region = region;
@ -427,10 +427,10 @@ void D3MusicSetRegion(short region, bool immediate) {
}
// retreives current region
short D3MusicGetRegion() { return Music_seq.GetPlayingRegion(); }
int16_t D3MusicGetRegion() { return Music_seq.GetPlayingRegion(); }
// retreives current PLAYING region.
short D3MusicGetPendingRegion() { return MusicAI.pending_region; }
int16_t D3MusicGetPendingRegion() { return MusicAI.pending_region; }
// starts special in-game cinematic music
void D3MusicStartCinematic() {}

View File

@ -75,13 +75,13 @@ typedef struct mono_element {
} mono_element;
typedef struct {
short first_row;
short height;
short first_col;
short width;
short cursor_row;
short cursor_col;
short open;
int16_t first_row;
int16_t height;
int16_t first_col;
int16_t width;
int16_t cursor_row;
int16_t cursor_col;
int16_t open;
struct mono_element save_buf[25][80];
struct mono_element text[25][80];
} WINDOW;
@ -500,7 +500,7 @@ void con_mputc(int n, char c) {
con_setcursor(ROW + CROW, COL + CCOL);
}
void copy_row(int nwords, short *src, short *dest1, short *dest2) {
void copy_row(int nwords, int16_t *src, int16_t *dest1, int16_t *dest2) {
// TODO: disabled for now to get the x64 build compiling
// do we even need all this old 'mono' stuff anymore?
#ifndef _WIN64
@ -541,7 +541,7 @@ void con_scroll(int n) {
col = 0;
for (row = 0; row < (HEIGHT - 1); row++)
copy_row(WIDTH, (short *)&XCHAR(row + 1, col), (short *)&CHAR(row, col), (short *)&XCHAR(row, col));
copy_row(WIDTH, (int16_t *)&XCHAR(row + 1, col), (int16_t *)&CHAR(row, col), (int16_t *)&XCHAR(row, col));
// for ( col = 0; col < WIDTH; col++ )
// {
@ -574,7 +574,7 @@ void con_setcursor(int row, int col) {
}
void con_drawbox(int n) {
short row, col;
int16_t row, col;
if (!OPEN)
return;
@ -609,7 +609,7 @@ void con_drawbox(int n) {
}
void con_clear(int n) {
short row, col;
int16_t row, col;
if (!OPEN)
return;

View File

@ -145,7 +145,7 @@
static bool DDIO_key_init = 0;
volatile uint8_t DDIO_key_state[DDIO_MAX_KEYS];
volatile short DDIO_key_down_count[DDIO_MAX_KEYS];
volatile int16_t DDIO_key_down_count[DDIO_MAX_KEYS];
static struct t_key_queue {
uint16_t buffer[KEY_QUEUE_SIZE]; // Keyboard buffer queue

View File

@ -224,14 +224,14 @@ void ddio_ffb_DestroyAll(void) {}
// Purpose:
// Play an effect that was previously created.
// -------------------------------------------------------------------
void ddio_ffb_effectPlay(short) {}
void ddio_ffb_effectPlay(int16_t) {}
// -------------------------------------------------------------------
// ddio_ffb_effectStop
// Purpose:
// Stop a single effect.
// -------------------------------------------------------------------
void ddio_ffb_effectStop(short) {}
void ddio_ffb_effectStop(int16_t) {}
// -------------------------------------------------------------------
// ddio_ffb_effectStopAll
@ -246,7 +246,7 @@ void ddio_ffb_effectStopAll(tDevice) {}
// Unload a single effect... Necessary to make room for other
// effects.
// -------------------------------------------------------------------
void ddio_ffb_effectUnload(short) {}
void ddio_ffb_effectUnload(int16_t) {}
// -------------------------------------------------------------------
// ddio_ffb_effectModify
@ -254,14 +254,14 @@ void ddio_ffb_effectUnload(short) {}
// Modifies a single effect, only if the given parameters are
// different from what's currently loaded.
// -------------------------------------------------------------------
void ddio_ffb_effectModify(short, int *, uint32_t *, uint32_t *, uint32_t *, tEffInfo *, tEffEnvelope *) {}
void ddio_ffb_effectModify(int16_t, int *, uint32_t *, uint32_t *, uint32_t *, tEffInfo *, tEffEnvelope *) {}
// -------------------------------------------------------------------
// ddio_ffb_GetEffectData
// Purpose:
// Retrieves affect data for the given parameters, pass NULL for those you don't want
// -------------------------------------------------------------------
void ddio_ffb_GetEffectData(short, int *, uint32_t *, uint32_t *, uint32_t *, tEffInfo *, tEffEnvelope *) {}
void ddio_ffb_GetEffectData(int16_t, int *, uint32_t *, uint32_t *, uint32_t *, tEffInfo *, tEffEnvelope *) {}
// -------------------------------------------------------------------
// ddio_ffjoy_EnableAutoCenter

View File

@ -112,8 +112,8 @@ typedef struct t_mse_button_info {
} t_mse_button_info;
typedef struct t_mse_event {
short btn;
short state;
int16_t btn;
int16_t state;
} t_mse_event;
static t_mse_button_info DIM_buttons;

View File

@ -965,7 +965,7 @@ int ddio_ffb_effectCreate(tDevice dev, tFFB_Effect* eff)
// Purpose:
// Play an effect that was previously created.
// -------------------------------------------------------------------
void ddio_ffb_effectPlay(short eID)
void ddio_ffb_effectPlay(int16_t eID)
{
if(eID<0 || eID>=DDIO_FF_MAXEFFECTS){
Int3(); //invalid eID
@ -993,7 +993,7 @@ ff_try:
// Purpose:
// Stop a single effect.
// -------------------------------------------------------------------
void ddio_ffb_effectStop(short eID)
void ddio_ffb_effectStop(int16_t eID)
{
if(eID<0 || eID>=DDIO_FF_MAXEFFECTS){
Int3(); //invalid eID
@ -1020,7 +1020,7 @@ void ddio_ffb_effectStopAll(tDevice dev)
// Unload a single effect... Necessary to make room for other
// effects.
// -------------------------------------------------------------------
void ddio_ffb_effectUnload(short eID)
void ddio_ffb_effectUnload(int16_t eID)
{
if(eID<0 || eID>=DDIO_FF_MAXEFFECTS){
Int3(); //invalid eID
@ -1036,7 +1036,7 @@ void ddio_ffb_effectUnload(short eID)
// Modifies a single effect, only if the given parameters are
// different from what's currently loaded.
// -------------------------------------------------------------------
void ddio_ffb_effectModify(short eID, int* Direction, uint32_t* Duration, uint32_t* Gain, uint32_t* Period, tEffInfo* TypeInfo, tEffEnvelope* Envelope)
void ddio_ffb_effectModify(int16_t eID, int* Direction, uint32_t* Duration, uint32_t* Gain, uint32_t* Period, tEffInfo* TypeInfo, tEffEnvelope* Envelope)
{
uint32_t flags = 0;
@ -1101,7 +1101,7 @@ void ddio_ffb_effectModify(short eID, int* Direction, uint32_t* Duration, uint32
// Purpose:
// Retrieves affect data for the given parameters, pass NULL for those you don't want
// -------------------------------------------------------------------
void ddio_ffb_GetEffectData(short eID, int* Direction, uint32_t* Duration, uint32_t* Gain, uint32_t* Period, tEffInfo* TypeInfo, tEffEnvelope* Envelope)
void ddio_ffb_GetEffectData(int16_t eID, int* Direction, uint32_t* Duration, uint32_t* Gain, uint32_t* Period, tEffInfo* TypeInfo, tEffEnvelope* Envelope)
{
if (Direction){
*Direction = ddEffect[eID].direction[0];
@ -1498,9 +1498,9 @@ bool ddio_ffjoy_SupportAutoCenter(tDevice dev) { return false; }
void ddio_ffb_DestroyAll(void) {}
void ddio_ffb_effectPlay(short eID) {}
void ddio_ffb_effectPlay(int16_t eID) {}
void ddio_ffb_effectModify(short eID, int *Direction, uint32_t *Duration, uint32_t *Gain, uint32_t *Period,
void ddio_ffb_effectModify(int16_t eID, int *Direction, uint32_t *Duration, uint32_t *Gain, uint32_t *Period,
tEffInfo *TypeInfo, tEffEnvelope *Envelope) {}
int ddio_ffb_effectCreate(tDevice dev, tFFB_Effect *eff) { return -1; }

View File

@ -116,7 +116,7 @@
typedef struct tJoystickRecord {
uint8_t valid; // is this a valid device.
uint8_t flags; // defined in ddio_win.h
short spad;
int16_t spad;
union {
int joyid;
@ -129,8 +129,8 @@ typedef struct tJoystickRecord {
//////////////////////////////////////////////////////////////////////////////
static struct tJoystickLibraryData {
short init; // library initialized?
short njoy; // maximum number of joysticks supported.
int16_t init; // library initialized?
int16_t njoy; // maximum number of joysticks supported.
tJoystickRecord *joystick; // list of joysticks.
LPDIRECTINPUT lpdi; // if lpdi != NULL, we use direct input for joysticks

View File

@ -40,8 +40,8 @@ typedef struct t_mse_button_info {
} t_mse_button_info;
typedef struct t_mse_event {
short btn;
short state;
int16_t btn;
int16_t state;
} t_mse_event;
#define MOUSE_ZMIN 0 // mouse wheel z min and max (increments of 120 = 10 units)
@ -67,9 +67,9 @@ static bool DDIO_mouse_init = 0;
static struct mses_state {
LPDIRECTINPUTDEVICE lpdimse;
RECT brect; // limit rectangle of absolute mouse coords
short x, y, z; // current x,y,z in absolute mouse coords
short cx, cy, cz; // prior values of x,y,z from last mouse frame
short zmin, zmax; // 3 dimensional mouse devices use this
int16_t x, y, z; // current x,y,z in absolute mouse coords
int16_t cx, cy, cz; // prior values of x,y,z from last mouse frame
int16_t zmin, zmax; // 3 dimensional mouse devices use this
int btn_mask, btn_flags; // btn_flags are the avaiable buttons on this device in mask form.
float timer; // done to keep track of mouse polling. [ISB] this is in InjectD3 but not here?
bool emulated; // are we emulating direct input?
@ -78,9 +78,9 @@ static struct mses_state {
int8_t cursor_count;
float x_aspect, y_aspect; // used in calculating coordinates returned from ddio_MouseGetState
HANDLE hmseevt; // signaled if mouse input is awaiting.
short dx, dy, dz, imm_dz;
short mode; // mode of mouse operation.
short nbtns, naxis; // device caps.
int16_t dx, dy, dz, imm_dz;
int16_t mode; // mode of mouse operation.
int16_t nbtns, naxis; // device caps.
} DDIO_mouse_state;
// Normally mouse events use ticks, attempting to use timer_GetTime which has more accuracy to smooth over bug with
@ -368,7 +368,7 @@ int RawInputHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
}
if (buttons & RI_MOUSE_WHEEL) {
wheelAccum += (int)(short)rawinput->data.mouse.usButtonData;
wheelAccum += (int)(int16_t)rawinput->data.mouse.usButtonData;
if (wheelAccum >= WHEEL_DELTA) {
DIM_buttons.down_count[MSEBTN_WHL_UP]++;
DIM_buttons.up_count[MSEBTN_WHL_UP]++;
@ -401,17 +401,17 @@ int RawInputHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
// check bounds of mouse cursor.
if (DDIO_mouse_state.x < DDIO_mouse_state.brect.left)
DDIO_mouse_state.x = (short)DDIO_mouse_state.brect.left;
DDIO_mouse_state.x = (int16_t)DDIO_mouse_state.brect.left;
if (DDIO_mouse_state.x >= DDIO_mouse_state.brect.right)
DDIO_mouse_state.x = (short)DDIO_mouse_state.brect.right - 1;
DDIO_mouse_state.x = (int16_t)DDIO_mouse_state.brect.right - 1;
if (DDIO_mouse_state.y < DDIO_mouse_state.brect.top)
DDIO_mouse_state.y = (short)DDIO_mouse_state.brect.top;
DDIO_mouse_state.y = (int16_t)DDIO_mouse_state.brect.top;
if (DDIO_mouse_state.y >= DDIO_mouse_state.brect.bottom)
DDIO_mouse_state.y = (short)DDIO_mouse_state.brect.bottom - 1;
DDIO_mouse_state.y = (int16_t)DDIO_mouse_state.brect.bottom - 1;
if (DDIO_mouse_state.z > DDIO_mouse_state.zmax)
DDIO_mouse_state.z = (short)DDIO_mouse_state.zmax;
DDIO_mouse_state.z = (int16_t)DDIO_mouse_state.zmax;
if (DDIO_mouse_state.z < DDIO_mouse_state.zmin)
DDIO_mouse_state.z = (short)DDIO_mouse_state.zmin;
DDIO_mouse_state.z = (int16_t)DDIO_mouse_state.zmin;
}
free(buf);

View File

@ -157,7 +157,7 @@ static bool Font_init = false;
typedef CFILE *FONTFILE;
static inline int READ_FONT_INT(FONTFILE ffile);
static inline short READ_FONT_SHORT(FONTFILE ffile);
static inline int16_t READ_FONT_SHORT(FONTFILE ffile);
static inline uint8_t READ_FONT_BYTE(FONTFILE ffile);
static inline int READ_FONT_DATA(FONTFILE ffile, void *buf, int size, int nelem);
static inline FONTFILE OPEN_FONT(char *filename);
@ -165,7 +165,7 @@ static inline void CLOSE_FONT(FONTFILE ffile);
inline int READ_FONT_INT(FONTFILE ffile) { return cf_ReadInt(ffile); }
inline short READ_FONT_SHORT(FONTFILE ffile) { return cf_ReadShort(ffile); }
inline int16_t READ_FONT_SHORT(FONTFILE ffile) { return cf_ReadShort(ffile); }
inline uint8_t READ_FONT_BYTE(FONTFILE ffile) { return (uint8_t)cf_ReadByte(ffile); }
@ -199,7 +199,7 @@ inline void CLOSE_FONT(FONTFILE ffile) { cfclose(ffile); }
typedef FILE *FONTFILE2;
static inline int WRITE_FONT_INT(FONTFILE2 ffile, int i);
static inline int WRITE_FONT_SHORT(FONTFILE2 ffile, short s);
static inline int WRITE_FONT_SHORT(FONTFILE2 ffile, int16_t s);
static inline int WRITE_FONT_BYTE(FONTFILE2 ffile, uint8_t c);
static inline int WRITE_FONT_DATA(FONTFILE2 ffile, void *buf, int size, int nelem);
static inline FONTFILE2 OPEN_FONT2(char *filename);
@ -207,7 +207,7 @@ static inline void CLOSE_FONT2(FONTFILE2 ffile);
inline int WRITE_FONT_INT(FONTFILE2 ffile, int i) { return fwrite(&i, sizeof(i), 1, (FILE *)ffile); }
inline int WRITE_FONT_SHORT(FONTFILE2 ffile, short s) { return fwrite(&s, sizeof(s), 1, (FILE *)ffile); }
inline int WRITE_FONT_SHORT(FONTFILE2 ffile, int16_t s) { return fwrite(&s, sizeof(s), 1, (FILE *)ffile); }
inline int WRITE_FONT_BYTE(FONTFILE2 ffile, uint8_t c) { return fwrite(&c, sizeof(c), 1, (FILE *)ffile); }
@ -456,7 +456,7 @@ void grfont_Free(int handle) {
bool grfont_LoadTemplate(const char *fname, tFontTemplate *ft) {
FONTFILE ff;
char fontname[32];
short ft_width, ft_height, ft_flags, ft_minasc, ft_maxasc, num_char, i;
int16_t ft_width, ft_height, ft_flags, ft_minasc, ft_maxasc, num_char, i;
tFontFileInfo2 ffi2;
// open file.
@ -647,7 +647,7 @@ bool grfont_SetTemplate(const char *pathname, const tFontTemplate *ft) {
WRITE_FONT_DATA(ffout, tempstr, 32, 1);
if (fnt.flags & FT_FFI2) {
WRITE_FONT_SHORT(ffout, (short)ft->ch_tracking);
WRITE_FONT_SHORT(ffout, (int16_t)ft->ch_tracking);
WRITE_FONT_DATA(ffout, ffi2.reserved, sizeof(ffi2.reserved), 1);
}
@ -656,7 +656,7 @@ bool grfont_SetTemplate(const char *pathname, const tFontTemplate *ft) {
// Write widths now if necessary.(FT_PROPORTIONAL)
if (fnt.flags & FT_PROPORTIONAL) {
for (int i = 0; i < num_char; i++)
WRITE_FONT_SHORT(ffout, (short)fnt.char_widths[i]);
WRITE_FONT_SHORT(ffout, (int16_t)fnt.char_widths[i]);
}
if (fnt.flags & FT_KERNED) {
@ -669,7 +669,7 @@ bool grfont_SetTemplate(const char *pathname, const tFontTemplate *ft) {
ASSERT((n_bytes % 3) == 0);
n_pairs = n_bytes / 3;
WRITE_FONT_SHORT(ffout, (short)n_pairs);
WRITE_FONT_SHORT(ffout, (int16_t)n_pairs);
for (i = 0; i < n_pairs; i++) {
WRITE_FONT_BYTE(ffout, ch[i * 3]);
@ -729,7 +729,7 @@ bool grfont_SetTracking(int font, int tracking) {
tFontInfo *oldft = &Fonts[font];
oldft->font.ffi2.tracking = (short)tracking;
oldft->font.ffi2.tracking = (int16_t)tracking;
return false;
}

View File

@ -446,20 +446,20 @@ void grtext_CenteredPrintf(int xoff, int y, const char *fmt, ...) {
void grtext_Puts(int x, int y, const char *str) {
struct {
char op;
short x, y;
int16_t x, y;
} cmd;
ASSERT((Grtext_ptr + sizeof(cmd) + strlen(str) + 1) < GRTEXT_BUFLEN);
cmd.op = GRTEXTOP_PUTS;
cmd.x = (short)x;
cmd.y = (short)y;
cmd.x = (int16_t)x;
cmd.y = (int16_t)y;
ASSERT((Grtext_ptr + sizeof(cmd) + strlen(str) + 1) < GRTEXT_BUFLEN);
cmd.op = GRTEXTOP_PUTS;
cmd.x = (short)x;
cmd.y = (short)y;
cmd.x = (int16_t)x;
cmd.y = (int16_t)y;
memcpy(&Grtext_buffer[Grtext_ptr], &cmd, sizeof(cmd));
Grtext_ptr += sizeof(cmd);
strcpy(&Grtext_buffer[Grtext_ptr], str);
@ -502,15 +502,15 @@ void grtext_Puts(int x, int y, const char *str) {
void grtext_PutChar(int x, int y, int ch) {
struct {
char op;
short x, y;
int16_t x, y;
uint8_t ch;
} cmd;
ASSERT((Grtext_ptr + sizeof(cmd)) < GRTEXT_BUFLEN);
cmd.op = GRTEXTOP_PUTCHAR;
cmd.x = (short)x;
cmd.y = (short)y;
cmd.x = (int16_t)x;
cmd.y = (int16_t)y;
cmd.ch = (uint8_t)ch;
memcpy(&Grtext_buffer[Grtext_ptr], &cmd, sizeof(cmd));
Grtext_ptr += sizeof(cmd);
@ -618,7 +618,7 @@ void grtext_Render() {
case GRTEXTOP_PUTS: {
struct {
char op;
short x, y;
int16_t x, y;
} cmd;
memcpy(&cmd, &Grtext_buffer[pos], sizeof(cmd));
@ -638,7 +638,7 @@ void grtext_Render() {
tCharBlt cbi;
struct {
char op;
short x, y;
int16_t x, y;
uint8_t ch;
} cmd;

View File

@ -970,7 +970,7 @@ BOOL CUpdateDlg::ApplyPatch()
sprintf(patch_cmd_line,"-undo %s",PATCH_LOC_FNAME);
RTPatchApply32 = (uint32_t (__stdcall *)(char *,void *(__stdcall *)(uint32_t,void *),int))GetProcAddress(patchlib, "RTPatchApply32@12");
if (RTPatchApply32) {
m_progress.SetRange(0,short(0x8000));
m_progress.SetRange(0,int16_t(0x8000));
m_progress.SetPos(0);
dlg = this;
StatusBar(IDS_UPDATEDLG_BEG_PATCH);

View File

@ -61,7 +61,7 @@ inline int WRITE_FONT_INT(FONTFILE ffile, int i) {
return fwrite(&i, sizeof(i), 1, (FILE *)ffile);
}
inline int WRITE_FONT_SHORT(FONTFILE ffile, short s) {
inline int WRITE_FONT_SHORT(FONTFILE ffile, int16_t s) {
return fwrite(&s, sizeof(s), 1, (FILE *)ffile);
}
@ -152,8 +152,8 @@ void message_box(const char *fmt, ...)
static bool m_FontProp;
static uint8_t m_CharWidths[MAX_FONT_CHARS];
static short m_CharHeight;
static short m_CharMaxWidth;
static int16_t m_CharHeight;
static int16_t m_CharMaxWidth;
static uint16_t *m_FontBmData;
static uint16_t *m_DataBuffer, *m_DataPtr;
static int m_FontType;
@ -430,7 +430,7 @@ void FontCreate(const char *fnt_file_source, const char *fnt_file_dest, int min_
WRITE_FONT_BYTE(ffile, ft.max_ascii);
WRITE_FONT_DATA(ffile, fontname, 32, 1);
WRITE_FONT_SHORT(ffile, (short)ft.ffi2.tracking);
WRITE_FONT_SHORT(ffile, (int16_t)ft.ffi2.tracking);
WRITE_FONT_DATA(ffile, ft.ffi2.reserved, sizeof(ft.ffi2.reserved),1);
num_char = (int)(ft.max_ascii - ft.min_ascii + 1);

View File

@ -194,7 +194,7 @@ void FontKern(const char *fnt_file_name)
int current_item = 0;
int num_items_displayed = 1;
bool done = false;
short text_alpha=255;
int16_t text_alpha=255;
int red_comp , green_comp, blue_comp;
ddgr_color text_color;

View File

@ -9648,7 +9648,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
O(("int STDCALL GetGOScriptID(const char *name,uint8_t is_door);"));
O(("void STDCALLPTR CreateInstance(int id);"));
O(("void STDCALL DestroyInstance(int id,void *ptr);"));
O(("short STDCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data);"));
O(("int16_t STDCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data);"));
O(("int STDCALL GetTriggerScriptID(int trigger_room, int trigger_face );"));
O(("int STDCALL GetCOScriptList( int **list, int **id_list );"));
O(("int STDCALL SaveRestoreState( void *file_ptr, uint8_t saving_state );"));
@ -9692,14 +9692,14 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
O(("public:"));
O((" BaseScript();"));
O((" ~BaseScript();"));
O((" virtual short CallEvent(int event, tOSIRISEventInfo *data);"));
O((" virtual int16_t CallEvent(int event, tOSIRISEventInfo *data);"));
O(("};"));
O((""));
// Write out the level script class definition
O(("class %s : public BaseScript {",LEVEL_CLASS_NAME));
O(("public:"));
O((" short CallEvent(int event, tOSIRISEventInfo *data);"));
O((" int16_t CallEvent(int event, tOSIRISEventInfo *data);"));
O(("};"));
O((""));
@ -9708,7 +9708,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
if(m_ScriptGroupingList[j].owner_type==OBJECT_TYPE) {
O(("class %s : public BaseScript {",CreateScriptClassName(j)));
O(("public:"));
O((" short CallEvent(int event, tOSIRISEventInfo *data);"));
O((" int16_t CallEvent(int event, tOSIRISEventInfo *data);"));
O(("};"));
O((""));
}
@ -9718,7 +9718,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
if(m_ScriptGroupingList[j].owner_type==TRIGGER_TYPE) {
O(("class %s : public BaseScript {",CreateScriptClassName(j)));
O(("public:"));
O((" short CallEvent(int event, tOSIRISEventInfo *data);"));
O((" int16_t CallEvent(int event, tOSIRISEventInfo *data);"));
O(("};"));
O((""));
}
@ -10141,7 +10141,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
O(("// ==================="));
O(("// CallInstanceEvent()"));
O(("// ==================="));
O(("short STDCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data)"));
O(("int16_t STDCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data)"));
O(("{"));
O((" switch(id) {"));
@ -10282,7 +10282,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
O(("}"));
O((""));
O(("short BaseScript::CallEvent(int event,tOSIRISEventInfo *data)"));
O(("int16_t BaseScript::CallEvent(int event,tOSIRISEventInfo *data)"));
O(("{"));
O((" mprintf(0,\"BaseScript::CallEvent()\\n\");"));
O((" return CONTINUE_CHAIN|CONTINUE_DEFAULT;"));
@ -10290,7 +10290,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
O((""));
// Create the Level Script Class' CallEvent() method
O(("short %s::CallEvent(int event,tOSIRISEventInfo *data)",LEVEL_CLASS_NAME));
O(("int16_t %s::CallEvent(int event,tOSIRISEventInfo *data)",LEVEL_CLASS_NAME));
O(("{"));
O((" switch(event) { "));
@ -10311,7 +10311,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
// Create the CallEvent() methods for each custom object script class
for(j=0;j<m_NumScriptGroups;j++)
if(m_ScriptGroupingList[j].owner_type==OBJECT_TYPE) {
O(("short %s::CallEvent(int event,tOSIRISEventInfo *data)",CreateScriptClassName(j)));
O(("int16_t %s::CallEvent(int event,tOSIRISEventInfo *data)",CreateScriptClassName(j)));
O(("{"));
O((" switch(event) { "));
@ -10328,7 +10328,7 @@ int CDallasMainDlg::CreateScriptFile(char *filename)
// Create the CallEvent() methods for each trigger script class
for(j=0;j<m_NumScriptGroups;j++)
if(m_ScriptGroupingList[j].owner_type==TRIGGER_TYPE) {
O(("short %s::CallEvent(int event,tOSIRISEventInfo *data)",CreateScriptClassName(j)));
O(("int16_t %s::CallEvent(int event,tOSIRISEventInfo *data)",CreateScriptClassName(j)));
O(("{"));
O((" switch(event) { "));

View File

@ -814,7 +814,7 @@ void SaveRoom (int n,char *filename)
CFILE *outfile;
int headsize,savepos,vertsize,facesize,texsize;
int highest_index=0;
short Room_to_texture[MAX_TEXTURES];
int16_t Room_to_texture[MAX_TEXTURES];
int t,found_it=0;
// Make sure its in use!
@ -862,7 +862,7 @@ void SaveRoom (int n,char *filename)
// figure out correct texture ordering
for (i=0;i<Rooms[n].num_faces;i++)
{
short index=Rooms[n].faces[i].tmap;
int16_t index=Rooms[n].faces[i].tmap;
for (found_it=0,t=0;t<highest_index;t++)
{
@ -966,7 +966,7 @@ int AllocLoadRoom (char *filename,bool bCenter,bool palette_room)
room *rp;
char texture_names[MAX_TEXTURES][PAGENAME_LEN];
int highest_index;
short tex_index;
int16_t tex_index;
int room_version=0;
infile=(CFILE *)cfopen (filename,"rb");
@ -1050,7 +1050,7 @@ int AllocLoadRoom (char *filename,bool bCenter,bool palette_room)
int nverts = cf_ReadInt (infile);
//rp->faces[i].num_verts=cf_ReadInt (infile);
//rp->faces[i].face_verts=(short *)mem_malloc (sizeof(short)*rp->faces[i].num_verts);
//rp->faces[i].face_verts=(int16_t *)mem_malloc (sizeof(int16_t)*rp->faces[i].num_verts);
//rp->faces[i].face_uvls=(g3UVL *)mem_malloc (sizeof(g3UVL)*rp->faces[i].num_verts);
InitRoomFace(&rp->faces[i],nverts);
@ -1160,7 +1160,7 @@ void GetIJ(const vector *normal,int *ii,int *jj);
// If the face is convex, returns -1
//NOTE: A face could have multiple concavities, and this will only find the one with the
//lowest-numbered vertex
int CheckFaceConcavity(int num_verts,short *face_verts,vector *normal,vector *verts)
int CheckFaceConcavity(int num_verts,int16_t *face_verts,vector *normal,vector *verts)
{
int ii,jj;
float i0,j0,i1,j1;
@ -1252,7 +1252,7 @@ void CopyFace(face *dfp,face *sfp)
//Checks to see if a face is planar.
//See if all the points are within a certain distance of an average point
//Returns 1 if face is planar, 0 if not
bool FaceIsPlanar(int nv,short *face_verts,vector *normal,vector *verts)
bool FaceIsPlanar(int nv,int16_t *face_verts,vector *normal,vector *verts)
{
//Triangles are always planar
if (nv == 3)
@ -1315,7 +1315,7 @@ void FixConcaveFaces (room *rp,int *facelist,int facecount)
{
int nverts=rp->faces[t].num_verts;
newfaces[t].face_verts = (short *) mem_malloc(nverts * sizeof(short));
newfaces[t].face_verts = (int16_t *) mem_malloc(nverts * sizeof(int16_t));
ASSERT(newfaces[t].face_verts != NULL);
newfaces[t].face_uvls = (roomUVL *) mem_malloc(nverts * sizeof(roomUVL));
ASSERT(newfaces[t].face_uvls != NULL);
@ -1337,7 +1337,7 @@ void FixConcaveFaces (room *rp,int *facelist,int facecount)
{
int nverts=3;
newfaces[t].face_verts = (short *) mem_malloc(nverts * sizeof(short));
newfaces[t].face_verts = (int16_t *) mem_malloc(nverts * sizeof(int16_t));
ASSERT(newfaces[t].face_verts != NULL);
newfaces[t].face_uvls = (roomUVL *) mem_malloc(nverts * sizeof(roomUVL));
ASSERT(newfaces[t].face_uvls != NULL);
@ -1418,7 +1418,7 @@ void ReInitRoomFace(face *fp,int nverts)
mem_free(fp->face_verts);
mem_free(fp->face_uvls);
fp->face_verts = (short *) mem_malloc(nverts * sizeof(*fp->face_verts)); ASSERT(fp->face_verts != NULL);
fp->face_verts = (int16_t *) mem_malloc(nverts * sizeof(*fp->face_verts)); ASSERT(fp->face_verts != NULL);
fp->face_uvls = (roomUVL *) mem_malloc(nverts * sizeof(*fp->face_uvls)); ASSERT(fp->face_uvls != NULL);
}
@ -3123,7 +3123,7 @@ recheck_face:;
else {
for (v=0;v<fp->num_verts;v++) {
if (fp->face_verts[v] == fp->face_verts[(v+2)%fp->num_verts]) {
short tverts[MAX_VERTS_PER_FACE];
int16_t tverts[MAX_VERTS_PER_FACE];
roomUVL tuvls[MAX_VERTS_PER_FACE];
for (int i=0;i<fp->num_verts-2;i++) {

View File

@ -231,7 +231,7 @@ int GetNextRoom (int n);
// If the face is convex, returns -1
//NOTE: A face could have multiple concavities, and this will only find the one with the
//lowest-numbered vertex
int CheckFaceConcavity(int num_verts,short *face_verts,vector *normal,vector *verts);
int CheckFaceConcavity(int num_verts,int16_t *face_verts,vector *normal,vector *verts);
// Goes through each face of the passed room and sets the default uvs
void AssignDefaultUVsToRoom (room *rp);
@ -414,7 +414,7 @@ void RemoveAllDuplicateAndUnusedPoints();
//Checks to see if a face is planar.
//See if all the points are within a certain distance of an average point
//Returns 1 if face is planar, 0 if not
bool FaceIsPlanar(int nv,short *face_verts,vector *normal,vector *verts);
bool FaceIsPlanar(int nv,int16_t *face_verts,vector *normal,vector *verts);
//Checks to see if a face is planar.
//See if all the points are within a certain distance of an average point

View File

@ -109,7 +109,7 @@ inline int WRITE_FONT_INT(FONTFILE ffile, int i) {
return fwrite(&i, sizeof(i), 1, (FILE *)ffile);
}
inline int WRITE_FONT_SHORT(FONTFILE ffile, short s) {
inline int WRITE_FONT_SHORT(FONTFILE ffile, int16_t s) {
return fwrite(&s, sizeof(s), 1, (FILE *)ffile);
}
@ -620,7 +620,7 @@ int CGrFontDialog::read_font_char(int cur_char, int& bmx, int& bmy)
BOOL CGrFontDialog::save_font_file(gr_font_file_record *ft)
{
uint8_t *tmp_data;
short *tmp_widths;
int16_t *tmp_widths;
uint8_t **tmp_cdata;
FONTFILE ffile;
uint32_t id = 0xfeedbaba;

View File

@ -111,8 +111,8 @@ private:
int m_FontPicBm; // Font picture bitmap handle
int m_FontBmW, m_FontBmH;
int m_CharHeight; // current character height.
short m_CharWidths[MAX_FONT_CHARS];
short m_CharMaxWidth;
int16_t m_CharWidths[MAX_FONT_CHARS];
int16_t m_CharMaxWidth;
uint16_t *m_FontBmData;
uint16_t *m_DataBuffer, *m_DataPtr;
uint16_t m_BgColor, m_BoxColor;

View File

@ -834,10 +834,10 @@ void AddEdgeInsert(int v0,int v1,int new_v)
// outbuf - the new polygon created by the part of the input polygon that was clipped away
// onv - the number of verys in outbuf
// num_vertices - pointer to the number of verts in the vertices array
void ClipAgainstEdge(int nv,short *vertnums,vertex *vertices,int *num_vertices,vector *v0,vector *v1,vector *normal,short *inbuf,int *inv,short *outbuf,int *onv)
void ClipAgainstEdge(int nv,int16_t *vertnums,vertex *vertices,int *num_vertices,vector *v0,vector *v1,vector *normal,int16_t *inbuf,int *inv,int16_t *outbuf,int *onv)
{
int i,prev,next,check;
short *ip = inbuf,*op = outbuf;
int16_t *ip = inbuf,*op = outbuf;
vertex *curv,*prevv,*nextv;
int inside_points=0,outside_points=0; //real inside/outside points, distinct from edge points
@ -940,14 +940,14 @@ bool ClipFace(room *arp,int afacenum,room *brp,int bfacenum)
face *afp = &arp->faces[afacenum];
face *bfp = &brp->faces[bfacenum];
int edgenum;
short vbuf0[MAX_VERTS_PER_FACE],vbuf1[MAX_VERTS_PER_FACE];
short newface_verts[MAX_VERTS_PER_FACE][MAX_VERTS_PER_FACE];
int16_t vbuf0[MAX_VERTS_PER_FACE],vbuf1[MAX_VERTS_PER_FACE];
int16_t newface_verts[MAX_VERTS_PER_FACE][MAX_VERTS_PER_FACE];
int newface_nvs[MAX_VERTS_PER_FACE];
vertex newverts[MAX_VERTS_PER_FACE];
int newvertnums[MAX_VERTS_PER_FACE];
int num_newverts;
int num_newfaces = 0;
short *src,*dest;
int16_t *src,*dest;
int nv;
int i;
@ -970,7 +970,7 @@ bool ClipFace(room *arp,int afacenum,room *brp,int bfacenum)
//Clip our polygon against each edge
for (edgenum=0;edgenum<bfp->num_verts;edgenum++) {
vector *v0,*v1;
short *outbuf = newface_verts[num_newfaces];
int16_t *outbuf = newface_verts[num_newfaces];
int *onv = &newface_nvs[num_newfaces];
v0 = &brp->verts[bfp->face_verts[(bfp->num_verts-edgenum)%bfp->num_verts]];
@ -1568,7 +1568,7 @@ void JoinRoomsExact(room *attroomp,int attface,room *baseroomp,int baseface)
World_changed = 1;
}
bool FaceIsPlanar(int nv,short *face_verts,vector *normal,vector *verts);
bool FaceIsPlanar(int nv,int16_t *face_verts,vector *normal,vector *verts);
//Combine two faces, if they can be combined
//Parameters: rp - the room the faces are in
@ -1580,7 +1580,7 @@ bool CombineFaces(room *rp,int face0,int face1)
face *fp0 = &rp->faces[face0], *fp1 = &rp->faces[face1];
int nv0 = fp0->num_verts, nv1 = fp1->num_verts;
int v0,v1;
short vertlist[MAX_VERTS_PER_FACE];
int16_t vertlist[MAX_VERTS_PER_FACE];
roomUVL uvllist[MAX_VERTS_PER_FACE];
int i,nv;
int first0,first1,n0,n1;
@ -2693,7 +2693,7 @@ void BuildSmoothBridge(room *rp0,int facenum0,room *rp1,int facenum1)
World_changed = 1;
}
short New_face_verts[MAX_VERTS_PER_FACE];
int16_t New_face_verts[MAX_VERTS_PER_FACE];
int New_face_num_verts=-1;
room *New_face_roomp;

View File

@ -144,7 +144,7 @@ bool ObjectPaste()
if(!ObjectInBuffer) return false;
short next,prev;
int16_t next,prev;
int roomnum;
vector pos;
matrix orient;

Some files were not shown because too many files have changed in this diff Show More