Replace "unsigned short" with "uint16_t"

This commit is contained in:
GravisZro 2024-05-23 23:03:29 -04:00
parent cf0c51c8dd
commit 3dcd21b717
79 changed files with 509 additions and 509 deletions

View File

@ -169,7 +169,7 @@ static const ubyte bbf_lookup[27] = {(0),
(0x08 | 0x04 | 0x10), (0x08 | 0x04 | 0x10),
(0x08 | 0x10 | 0x20)}; (0x08 | 0x10 | 0x20)};
unsigned short BOA_Array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS]; uint16_t BOA_Array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS];
float BOA_cost_array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_PATH_PORTALS]; float BOA_cost_array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_PATH_PORTALS];
int BOA_mine_checksum = 0; int BOA_mine_checksum = 0;
int BOA_vis_checksum = 0; // this checksum is for the VIS bit of the boa array int BOA_vis_checksum = 0; // this checksum is for the VIS bit of the boa array
@ -647,7 +647,7 @@ void compute_mine_info() {
void add_terrain_cell(int cell, int t_region, char *checked) { void add_terrain_cell(int cell, int t_region, char *checked) {
int depth = 0; int depth = 0;
int i; int i;
unsigned short stack[TERRAIN_WIDTH * TERRAIN_DEPTH]; uint16_t stack[TERRAIN_WIDTH * TERRAIN_DEPTH];
char on_stack[TERRAIN_WIDTH * TERRAIN_DEPTH]; char on_stack[TERRAIN_WIDTH * TERRAIN_DEPTH];
for (i = 0; i < TERRAIN_WIDTH * TERRAIN_DEPTH; i++) for (i = 0; i < TERRAIN_WIDTH * TERRAIN_DEPTH; i++)

View File

@ -124,7 +124,7 @@
#define MAX_BOA_TERRAIN_REGIONS 8 #define MAX_BOA_TERRAIN_REGIONS 8
extern float BOA_cost_array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_PATH_PORTALS]; extern float BOA_cost_array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_PATH_PORTALS];
extern unsigned short BOA_Array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS]; extern uint16_t BOA_Array[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS];
extern int BOA_mine_checksum; extern int BOA_mine_checksum;
extern int BOA_AABB_checksum; extern int BOA_AABB_checksum;
extern int BOA_vis_checksum; extern int BOA_vis_checksum;

View File

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

View File

@ -3335,10 +3335,10 @@ char OMMS_GetInfo(OMMSHANDLE handle,uint32_t *mem_size,uint32_t *uid,ushort *ref
*/ */
typedef struct tOMMSNode { typedef struct tOMMSNode {
unsigned short id; uint16_t id;
uint32_t size_of_memory; uint32_t size_of_memory;
uint32_t unique_id; uint32_t unique_id;
unsigned short reference_count; uint16_t reference_count;
uint8_t free_called; uint8_t free_called;
void *memory_ptr; void *memory_ptr;
tOMMSNode *next; tOMMSNode *next;
@ -3346,14 +3346,14 @@ typedef struct tOMMSNode {
typedef struct tOMMSHashNode { typedef struct tOMMSHashNode {
char *script_name; char *script_name;
unsigned short base_id; uint16_t base_id;
tOMMSNode *root; tOMMSNode *root;
tOMMSHashNode *next; tOMMSHashNode *next;
} tOMMSHashNode; } tOMMSHashNode;
tOMMSHashNode *OMMS_Hash_node_root = NULL; tOMMSHashNode *OMMS_Hash_node_root = NULL;
unsigned short OMMS_Current_base_id = 0; uint16_t OMMS_Current_base_id = 0;
unsigned short OMMS_Current_id = 0; uint16_t OMMS_Current_id = 0;
// Searches through the hash nodes and looks for the one associated with // Searches through the hash nodes and looks for the one associated with
// the script name, if one doesn't exist it will create one (if autocreate is true). // the script name, if one doesn't exist it will create one (if autocreate is true).
@ -3485,8 +3485,8 @@ void Osiris_SaveOMMS(CFILE *file) {
void Osiris_RestoreOMMS(CFILE *file) { void Osiris_RestoreOMMS(CFILE *file) {
ASSERT(OMMS_Hash_node_root == NULL); ASSERT(OMMS_Hash_node_root == NULL);
OMMS_Current_base_id = (unsigned short)cf_ReadShort(file); OMMS_Current_base_id = (uint16_t)cf_ReadShort(file);
OMMS_Current_id = (unsigned short)cf_ReadShort(file); OMMS_Current_id = (uint16_t)cf_ReadShort(file);
tOMMSHashNode *currhash; tOMMSHashNode *currhash;
tOMMSNode *node; tOMMSNode *node;
@ -3509,7 +3509,7 @@ void Osiris_RestoreOMMS(CFILE *file) {
currhash->root = NULL; currhash->root = NULL;
currhash->script_name = NULL; currhash->script_name = NULL;
currhash->base_id = (unsigned short)cf_ReadShort(file); currhash->base_id = (uint16_t)cf_ReadShort(file);
// read length of string // read length of string
int length = cf_ReadByte(file); int length = cf_ReadByte(file);
@ -3538,7 +3538,7 @@ void Osiris_RestoreOMMS(CFILE *file) {
node->memory_ptr = NULL; node->memory_ptr = NULL;
node->next = NULL; node->next = NULL;
node->id = (unsigned short)cf_ReadShort(file); node->id = (uint16_t)cf_ReadShort(file);
node->free_called = (cf_ReadByte(file)) ? true : false; node->free_called = (cf_ReadByte(file)) ? true : false;
node->reference_count = (ushort)cf_ReadShort(file); node->reference_count = (ushort)cf_ReadShort(file);
@ -3738,8 +3738,8 @@ void Osiris_OMMS_CallFreeForNode(tOMMSHashNode *root, tOMMSNode *node) {
tOMMSNode *Osiris_OMMS_FindHandle(OMMSHANDLE handle, tOMMSHashNode **hash) { tOMMSNode *Osiris_OMMS_FindHandle(OMMSHANDLE handle, tOMMSHashNode **hash) {
tOMMSHashNode *hashcurr = OMMS_Hash_node_root; tOMMSHashNode *hashcurr = OMMS_Hash_node_root;
tOMMSNode *nodecurr; tOMMSNode *nodecurr;
unsigned short base_id; uint16_t base_id;
unsigned short id; uint16_t id;
base_id = ((handle & 0xFFFF0000) >> 16); base_id = ((handle & 0xFFFF0000) >> 16);
id = (handle & 0x0000FFFF); id = (handle & 0x0000FFFF);

View File

@ -1889,12 +1889,12 @@ int FireWeaponFromObject(object *obj, int weapon_num, int gun_num, bool f_force_
if (Game_mode & GM_MULTI) { if (Game_mode & GM_MULTI) {
if (Netgame.local_role == LR_SERVER) { if (Netgame.local_role == LR_SERVER) {
if (obj->control_type == CT_AI) { if (obj->control_type == CT_AI) {
MultiSendRobotFireWeapon(obj->handle & HANDLE_OBJNUM_MASK, &laser_pos, &laser_dir, (unsigned short)weapon_num); MultiSendRobotFireWeapon(obj->handle & HANDLE_OBJNUM_MASK, &laser_pos, &laser_dir, (uint16_t)weapon_num);
} }
} }
} }
if (Demo_flags == DF_RECORDING) { if (Demo_flags == DF_RECORDING) {
DemoWriteWeaponFire(obj->handle & HANDLE_OBJNUM_MASK, &laser_pos, &laser_dir, (unsigned short)weapon_num, objnum, DemoWriteWeaponFire(obj->handle & HANDLE_OBJNUM_MASK, &laser_pos, &laser_dir, (uint16_t)weapon_num, objnum,
gun_num); gun_num);
} }

View File

@ -500,7 +500,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) {
cfptr = NULL; cfptr = NULL;
char format_type[80]; // ASCII name of format type char format_type[80]; // ASCII name of format type
unsigned short fmttag = 0; // Numerical format type uint16_t fmttag = 0; // Numerical format type
uint32_t ckid; // Current chunk's ID uint32_t ckid; // Current chunk's ID
uint32_t cksize; // Current chunk's size in bytes uint32_t cksize; // Current chunk's size in bytes
uint32_t filesize; // Size of the sound file uint32_t filesize; // Size of the sound file
@ -579,7 +579,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) {
} }
// Read in the format type // Read in the format type
fmttag = (unsigned short)cf_ReadShort(cfptr); fmttag = (uint16_t)cf_ReadShort(cfptr);
switch (fmttag) { switch (fmttag) {
// We only support WAVE_FORMAT_PCM currently // We only support WAVE_FORMAT_PCM currently

View File

@ -309,7 +309,7 @@ static float Demo_last_pinfo;
float Demo_frame_ofs; float Demo_frame_ofs;
static int Demo_auto_idx = 0; static int Demo_auto_idx = 0;
uint32_t Demo_flags = 0; uint32_t Demo_flags = 0;
unsigned short Demo_obj_map[MAX_OBJECTS]; uint16_t Demo_obj_map[MAX_OBJECTS];
static bool Demo_turretchanged[MAX_OBJECTS]; static bool Demo_turretchanged[MAX_OBJECTS];
bool Demo_looping = false; bool Demo_looping = false;
bool Demo_paused = false; bool Demo_paused = false;
@ -467,8 +467,8 @@ void DemoWriteChangedObj(object *op) {
} }
} }
void DemoWriteWeaponFire(unsigned short objectnum, vector *pos, vector *dir, unsigned short weaponnum, void DemoWriteWeaponFire(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum,
unsigned short weapobjnum, short gunnum) { uint16_t weapobjnum, short gunnum) {
uint32_t uniqueid = MultiGetMatchChecksum(OBJ_WEAPON, weaponnum); uint32_t uniqueid = MultiGetMatchChecksum(OBJ_WEAPON, weaponnum);
if (weapobjnum == -1) if (weapobjnum == -1)
return; return;
@ -547,7 +547,7 @@ void DemoWriteObjCreate(ubyte type, ushort id, int roomnum, vector *pos, const m
#define MAX_COOP_TURRETS 400 #define MAX_COOP_TURRETS 400
extern float turret_holder[MAX_COOP_TURRETS]; extern float turret_holder[MAX_COOP_TURRETS];
void DemoWriteTurretChanged(unsigned short objnum) { Demo_turretchanged[objnum] = true; } void DemoWriteTurretChanged(uint16_t objnum) { Demo_turretchanged[objnum] = true; }
void DemoReadTurretChanged(void) { void DemoReadTurretChanged(void) {
multi_turret multi_turret_info; multi_turret multi_turret_info;
@ -576,7 +576,7 @@ void DemoReadTurretChanged(void) {
} }
} }
void DemoWriteObjAnimChanged(unsigned short objnum) { void DemoWriteObjAnimChanged(uint16_t objnum) {
custom_anim multi_anim_info; custom_anim multi_anim_info;
if (ObjGetAnimUpdate(objnum, &multi_anim_info)) // Checks if obj is still alive and all if (ObjGetAnimUpdate(objnum, &multi_anim_info)) // Checks if obj is still alive and all
@ -996,7 +996,7 @@ void DemoReadWeaponFire() {
} }
} }
unsigned short new_weap_objnum = CreateAndFireWeapon(&pos, &dir, &Objects[objnum], weaponnum); uint16_t new_weap_objnum = CreateAndFireWeapon(&pos, &dir, &Objects[objnum], weaponnum);
if (0xffff == new_weap_objnum) { if (0xffff == new_weap_objnum) {
Int3(); Int3();
return; return;
@ -1301,7 +1301,7 @@ void DemoFrame() {
} while (!exit_loop); } while (!exit_loop);
} }
void DemoWriteCinematics(ubyte *data, unsigned short len) { void DemoWriteCinematics(ubyte *data, uint16_t len) {
cf_WriteByte(Demo_cfp, DT_CINEMATICS); cf_WriteByte(Demo_cfp, DT_CINEMATICS);
// Write a bunch of data // Write a bunch of data
mprintf((0, "Writing Cinematic data (%d bytes) to demo file.\n", len)); mprintf((0, "Writing Cinematic data (%d bytes) to demo file.\n", len));
@ -1317,14 +1317,14 @@ void DemoReadCinematics() {
Cinematic_DoDemoFileData(buffer); Cinematic_DoDemoFileData(buffer);
} }
void DemoWriteMSafe(ubyte *data, unsigned short len) { void DemoWriteMSafe(ubyte *data, uint16_t len) {
cf_WriteByte(Demo_cfp, DT_MSAFE); cf_WriteByte(Demo_cfp, DT_MSAFE);
cf_WriteShort(Demo_cfp, len); cf_WriteShort(Demo_cfp, len);
cf_WriteBytes(data, len, Demo_cfp); cf_WriteBytes(data, len, Demo_cfp);
// mprintf((0,"Writing MSAFE data to demo file.\n")); // mprintf((0,"Writing MSAFE data to demo file.\n"));
} }
void DemoWritePowerup(ubyte *data, unsigned short len) { void DemoWritePowerup(ubyte *data, uint16_t len) {
cf_WriteByte(Demo_cfp, DT_POWERUP); cf_WriteByte(Demo_cfp, DT_POWERUP);
cf_WriteShort(Demo_cfp, len); cf_WriteShort(Demo_cfp, len);
cf_WriteBytes(data, len, Demo_cfp); cf_WriteBytes(data, len, Demo_cfp);
@ -1367,7 +1367,7 @@ void DemoReadCollidePlayerWeapon(void) {
vector collision_p; vector collision_p;
vector collision_n; vector collision_n;
bool f_reverse_normal; bool f_reverse_normal;
unsigned short real_weapnum; uint16_t real_weapnum;
short plr_objnum = cf_ReadShort(Demo_cfp); short plr_objnum = cf_ReadShort(Demo_cfp);
short wep_objnum = cf_ReadShort(Demo_cfp); short wep_objnum = cf_ReadShort(Demo_cfp);
gs_ReadVector(Demo_cfp, collision_p); gs_ReadVector(Demo_cfp, collision_p);
@ -1398,7 +1398,7 @@ void DemoReadCollideGenericWeapon(void) {
vector collision_p; vector collision_p;
vector collision_n; vector collision_n;
bool f_reverse_normal; bool f_reverse_normal;
unsigned short real_weapnum; uint16_t real_weapnum;
short gen_objnum = cf_ReadShort(Demo_cfp); short gen_objnum = cf_ReadShort(Demo_cfp);
short wep_objnum = cf_ReadShort(Demo_cfp); short wep_objnum = cf_ReadShort(Demo_cfp);
gs_ReadVector(Demo_cfp, collision_p); gs_ReadVector(Demo_cfp, collision_p);

View File

@ -223,7 +223,7 @@ extern int DoAI;
extern bool Game_being_played_from_quick_play; extern bool Game_being_played_from_quick_play;
#endif #endif
#endif #endif
extern unsigned short Demo_obj_map[MAX_OBJECTS]; extern uint16_t Demo_obj_map[MAX_OBJECTS];
struct { struct {
// some important, pre-computed times // some important, pre-computed times

View File

@ -1997,7 +1997,7 @@ void DoNextPlayerFile(int playernum) {
// Puts player "slot" position info into the passed in buffer // Puts player "slot" position info into the passed in buffer
// Returns the number of bytes used // Returns the number of bytes used
int MultiStuffRobotPosition(unsigned short objectnum, ubyte *data) { int MultiStuffRobotPosition(uint16_t objectnum, ubyte *data) {
int size; int size;
int count = 0; int count = 0;
//@@multi_orientation mat; //@@multi_orientation mat;
@ -2045,7 +2045,7 @@ int MultiStuffRobotPosition(unsigned short objectnum, ubyte *data) {
// Puts player "slot" position info into the passed in buffer // Puts player "slot" position info into the passed in buffer
// Returns the number of bytes used // Returns the number of bytes used
int MultiSendRobotFireWeapon(unsigned short objectnum, vector *pos, vector *dir, unsigned short weaponnum) { int MultiSendRobotFireWeapon(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum) {
int size; int size;
int count = 0; int count = 0;
ubyte data[MAX_GAME_DATA_SIZE]; ubyte data[MAX_GAME_DATA_SIZE];
@ -2096,7 +2096,7 @@ int MultiSendRobotFireWeapon(unsigned short objectnum, vector *pos, vector *dir,
void MultiDoRobotFire(ubyte *data) { void MultiDoRobotFire(ubyte *data) {
int count = 0; int count = 0;
unsigned short obj_num; uint16_t obj_num;
vector weapon_pos; vector weapon_pos;
vector weapon_dir; vector weapon_dir;
uint32_t weapon_num; uint32_t weapon_num;
@ -3887,7 +3887,7 @@ void MultiDoGetGameInfo(ubyte *data, network_address *from_addr) {
count += len; count += len;
MultiAddShort(Current_mission.cur_level, outdata, &count); MultiAddShort(Current_mission.cur_level, outdata, &count);
unsigned short icurrplayers = 0; uint16_t icurrplayers = 0;
for (int i = 0; i < MAX_NET_PLAYERS; i++) { for (int i = 0; i < MAX_NET_PLAYERS; i++) {
if (Dedicated_server) { if (Dedicated_server) {
if (i == Player_num) if (i == Player_num)
@ -3971,7 +3971,7 @@ void MultiDoGetPXOGameInfo(ubyte *data, network_address *from_addr) {
count += len; count += len;
MultiAddShort(Current_mission.cur_level, outdata, &count); MultiAddShort(Current_mission.cur_level, outdata, &count);
unsigned short icurrplayers = 0; uint16_t icurrplayers = 0;
int i = 0; int i = 0;
for (i = 0; i < MAX_NET_PLAYERS; i++) { for (i = 0; i < MAX_NET_PLAYERS; i++) {
@ -6893,7 +6893,7 @@ void MultiAddObjAnimUpdate(int objnum) {
} }
} }
int MultiStuffObjAnimUpdate(unsigned short objnum, ubyte *data) { int MultiStuffObjAnimUpdate(uint16_t objnum, ubyte *data) {
custom_anim multi_anim_info; custom_anim multi_anim_info;
int count = 0; int count = 0;
int size = 0; int size = 0;
@ -7084,7 +7084,7 @@ void MultiAddObjTurretUpdate(int objnum) {
} }
} }
int MultiStuffTurretUpdate(unsigned short objnum, ubyte *data) { int MultiStuffTurretUpdate(uint16_t objnum, ubyte *data) {
int count = 0; int count = 0;
int size = 0; int size = 0;
multi_turret multi_turret_info; multi_turret multi_turret_info;
@ -7416,7 +7416,7 @@ void MultiAddObjWBAnimUpdate(int objnum) {
} }
} }
int MultiStuffObjWBAnimUpdate(unsigned short objnum, ubyte *data) { int MultiStuffObjWBAnimUpdate(uint16_t objnum, ubyte *data) {
// multi_anim multi_anim_info; // multi_anim multi_anim_info;
int count = 0; int count = 0;
int size = 0; int size = 0;
@ -7915,8 +7915,8 @@ void SendDataChunk(int playernum) {
} }
void MultiDoFileCancelled(ubyte *data) { void MultiDoFileCancelled(ubyte *data) {
unsigned short playernum; // Who is telling us the file is cancelled uint16_t playernum; // Who is telling us the file is cancelled
unsigned short filewho; // Who's file is being cancelled uint16_t filewho; // Who's file is being cancelled
int count = 0; int count = 0;
SKIP_HEADER(data, &count); SKIP_HEADER(data, &count);
@ -7969,7 +7969,7 @@ void MultiSendClientCustomData(int slot, int whoto) {
strcpy(csum_filename, NetPlayers[slot].ship_logo); strcpy(csum_filename, NetPlayers[slot].ship_logo);
} }
} }
unsigned short logo_len = strlen(csum_filename) + 1; uint16_t logo_len = strlen(csum_filename) + 1;
MultiAddUshort(logo_len, data, &count); MultiAddUshort(logo_len, data, &count);
memcpy(data + count, csum_filename, logo_len); memcpy(data + count, csum_filename, logo_len);
count += logo_len; count += logo_len;
@ -8009,7 +8009,7 @@ void MultiSendClientCustomData(int slot, int whoto) {
strcpy(csum_filename, filename); strcpy(csum_filename, filename);
} }
} }
unsigned short vt_len = strlen(csum_filename) + 1; uint16_t vt_len = strlen(csum_filename) + 1;
MultiAddUshort(vt_len, data, &count); MultiAddUshort(vt_len, data, &count);
memcpy(data + count, csum_filename, vt_len); memcpy(data + count, csum_filename, vt_len);
count += vt_len; count += vt_len;
@ -8031,7 +8031,7 @@ void MultiSendClientCustomData(int slot, int whoto) {
} }
void MultiDoCustomPlayerData(ubyte *data) { void MultiDoCustomPlayerData(ubyte *data) {
unsigned short playernum; // Who has data we are interested in uint16_t playernum; // Who has data we are interested in
int count = 0; int count = 0;
SKIP_HEADER(data, &count); SKIP_HEADER(data, &count);
@ -9378,7 +9378,7 @@ void DoReqPlayerList(network_address *addr) {
memset(outdata, 0, sizeof(outdata)); memset(outdata, 0, sizeof(outdata));
size = START_DATA(MP_PLAYERLIST_DATA, outdata, &count); size = START_DATA(MP_PLAYERLIST_DATA, outdata, &count);
unsigned short icurrplayers = 0; uint16_t icurrplayers = 0;
int i = 0; int i = 0;
if (Dedicated_server) { if (Dedicated_server) {
// Skip the server player // Skip the server player

View File

@ -992,13 +992,13 @@ void MultiEndLevel();
void GetServerGameTime(); void GetServerGameTime();
// Send robot info // Send robot info
int MultiStuffRobotPosition(unsigned short objectnum, ubyte *data); int MultiStuffRobotPosition(uint16_t objectnum, ubyte *data);
// Handle robot position // Handle robot position
void MultiDoRobotPos(ubyte *data); void MultiDoRobotPos(ubyte *data);
// Handle robot (or any AI created) weapon fire // Handle robot (or any AI created) weapon fire
int MultiSendRobotFireWeapon(unsigned short objectnum, vector *pos, vector *dir, unsigned short weaponnum); int MultiSendRobotFireWeapon(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum);
// Send robot damage // 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, short seed);
@ -1031,7 +1031,7 @@ void MultiDoRobotDamage(ubyte *data);
void MultiAddObjAnimUpdate(int objnum); void MultiAddObjAnimUpdate(int objnum);
// Stuff an animation update into a packet // Stuff an animation update into a packet
int MultiStuffObjAnimUpdate(unsigned short objnum, ubyte *data); int MultiStuffObjAnimUpdate(uint16_t objnum, ubyte *data);
// Handle an animation update // Handle an animation update
void MultiDoObjAnimUpdate(ubyte *data); void MultiDoObjAnimUpdate(ubyte *data);
@ -1052,7 +1052,7 @@ void MultiDoRobotFireSound(ubyte *data);
void MultiAddObjTurretUpdate(int objnum); void MultiAddObjTurretUpdate(int objnum);
// Stuff turret data into a packet // Stuff turret data into a packet
int MultiStuffTurretUpdate(unsigned short objnum, ubyte *data); int MultiStuffTurretUpdate(uint16_t objnum, ubyte *data);
// Handle a turret update from the server // Handle a turret update from the server
void MultiDoTurretUpdate(ubyte *data); void MultiDoTurretUpdate(ubyte *data);
@ -1071,7 +1071,7 @@ void MultiSendInventoryRemoveItem(int slot, int type, int id);
void MultiAddObjWBAnimUpdate(int objnum); void MultiAddObjWBAnimUpdate(int objnum);
int MultiStuffObjWBAnimUpdate(unsigned short objnum, ubyte *data); int MultiStuffObjWBAnimUpdate(uint16_t objnum, ubyte *data);
void MultiDoObjWBAnimUpdate(ubyte *data); void MultiDoObjWBAnimUpdate(ubyte *data);

View File

@ -381,7 +381,7 @@ extern int Num_modems_found;
#endif #endif
#define DLL_BRIEFING_FONT 1 #define DLL_BRIEFING_FONT 1
#define DLL_BIG_BRIEFING_FONT 2 #define DLL_BIG_BRIEFING_FONT 2
extern unsigned short nw_ListenPort; extern uint16_t nw_ListenPort;
extern ushort PXOPort; extern ushort PXOPort;
void GetMultiAPI(multi_api *api) { void GetMultiAPI(multi_api *api) {

View File

@ -30,13 +30,13 @@ extern int Join_response_strings[];
#define MAX_CHANGED_OBJECTS 700 #define MAX_CHANGED_OBJECTS 700
extern int Changed_anim[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS]; extern int Changed_anim[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS];
extern unsigned short Num_changed_anim[MAX_NET_PLAYERS]; extern uint16_t Num_changed_anim[MAX_NET_PLAYERS];
extern int Changed_wb_anim[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS]; extern int Changed_wb_anim[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS];
extern unsigned short Num_changed_wb_anim[MAX_NET_PLAYERS]; extern uint16_t Num_changed_wb_anim[MAX_NET_PLAYERS];
extern int Changed_turret[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS]; extern int Changed_turret[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS];
extern unsigned short Num_changed_turret[MAX_NET_PLAYERS]; extern uint16_t Num_changed_turret[MAX_NET_PLAYERS];
extern uint32_t Secret_net_id; extern uint32_t Secret_net_id;
#define JOIN_ANSWER_OK 0 #define JOIN_ANSWER_OK 0

View File

@ -1213,7 +1213,7 @@ tPosHistory Object_position_samples[MAX_OBJECT_POS_HISTORY];
ubyte Object_position_head; ubyte Object_position_head;
signed short Object_map_position_history[MAX_OBJECTS]; signed short Object_map_position_history[MAX_OBJECTS];
short Object_map_position_free_slots[MAX_OBJECT_POS_HISTORY]; short Object_map_position_free_slots[MAX_OBJECT_POS_HISTORY];
unsigned short Num_free_object_position_history; uint16_t Num_free_object_position_history;
int Num_objects = 0; int Num_objects = 0;
int Highest_object_index = 0; int Highest_object_index = 0;
@ -3319,7 +3319,7 @@ void GetObjectPointInWorld(vector *dest, object *obj, int subnum, int vertnum) {
*dest += obj->pos; *dest += obj->pos;
} }
bool ObjGetAnimUpdate(unsigned short objnum, custom_anim *multi_anim_info) { bool ObjGetAnimUpdate(uint16_t objnum, custom_anim *multi_anim_info) {
object *obj = &Objects[objnum]; object *obj = &Objects[objnum];
if ((objnum >= 0) && (obj->type != OBJ_NONE) && (obj->type != OBJ_WEAPON) && (obj->flags & OF_POLYGON_OBJECT)) { if ((objnum >= 0) && (obj->type != OBJ_NONE) && (obj->type != OBJ_WEAPON) && (obj->flags & OF_POLYGON_OBJECT)) {
@ -3400,7 +3400,7 @@ void SetObjectControlType(object *obj, int control_type) {
} }
} }
void ObjSetAnimUpdate(unsigned short objnum, custom_anim *multi_anim_info) { void ObjSetAnimUpdate(uint16_t objnum, custom_anim *multi_anim_info) {
object *obj = &Objects[objnum]; object *obj = &Objects[objnum];
polyobj_info *pm; polyobj_info *pm;
@ -3414,7 +3414,7 @@ void ObjSetAnimUpdate(unsigned short objnum, custom_anim *multi_anim_info) {
} }
} }
void ObjGetTurretUpdate(unsigned short objnum, multi_turret *multi_turret_info) { void ObjGetTurretUpdate(uint16_t objnum, multi_turret *multi_turret_info) {
object *obj = &Objects[objnum]; object *obj = &Objects[objnum];
poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num]; poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num];
polyobj_info *p_info = &obj->rtype.pobj_info; polyobj_info *p_info = &obj->rtype.pobj_info;
@ -3436,7 +3436,7 @@ void ObjGetTurretUpdate(unsigned short objnum, multi_turret *multi_turret_info)
} }
} }
void ObjSetTurretUpdate(unsigned short objnum, multi_turret *multi_turret_info) { void ObjSetTurretUpdate(uint16_t objnum, multi_turret *multi_turret_info) {
object *obj = &Objects[objnum]; object *obj = &Objects[objnum];
poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num]; poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num];
polyobj_info *p_info = &obj->rtype.pobj_info; polyobj_info *p_info = &obj->rtype.pobj_info;

View File

@ -798,11 +798,11 @@ void GetObjectPointInWorld(vector *dest, object *obj, int subnum, int vertnum);
// These functions are for setting and getting an objects animation information // These functions are for setting and getting an objects animation information
// (used in multiplayer games and the like) // (used in multiplayer games and the like)
bool ObjGetAnimUpdate(unsigned short objnum, custom_anim *multi_anim_info); bool ObjGetAnimUpdate(uint16_t objnum, custom_anim *multi_anim_info);
void ObjSetAnimUpdate(unsigned short objnum, custom_anim *multi_anim_info); void ObjSetAnimUpdate(uint16_t objnum, custom_anim *multi_anim_info);
void ObjGetTurretUpdate(unsigned short objnum, multi_turret *multi_turret_info); void ObjGetTurretUpdate(uint16_t objnum, multi_turret *multi_turret_info);
void ObjSetTurretUpdate(unsigned short objnum, multi_turret *multi_turret_info); void ObjSetTurretUpdate(uint16_t objnum, multi_turret *multi_turret_info);
// Returns the original parent for the given object. Returns self if it has no parent // Returns the original parent for the given object. Returns self if it has no parent
object *ObjGetUltimateParent(object *child); object *ObjGetUltimateParent(object *child);

View File

@ -842,7 +842,7 @@ void osipf_PlayerValue(int obj_handle, char op, char vhandle, void *ptr, int ind
case PLYSV_US_WEAPON_POWERUP_ID: { case PLYSV_US_WEAPON_POWERUP_ID: {
if (op == VF_GET) if (op == VF_GET)
*(unsigned short *)ptr = Ships[Players[id].ship_index].spew_powerup[index]; *(uint16_t *)ptr = Ships[Players[id].ship_index].spew_powerup[index];
} break; } break;
case PLYSV_I_WEAPON_AMMO: case PLYSV_I_WEAPON_AMMO:
if (op == VF_GET) if (op == VF_GET)
@ -2712,9 +2712,9 @@ void osipf_ObjWBValue(int obj_handle, char wb_index, char op, char vtype, void *
break; break;
case WBSV_US_GUNPT_WEAPON_ID: case WBSV_US_GUNPT_WEAPON_ID:
if (op == VF_SET) { if (op == VF_SET) {
static_wb->gp_weapon_index[g_index] = *((unsigned short *)ptr); static_wb->gp_weapon_index[g_index] = *((uint16_t *)ptr);
} else if (op == VF_GET) { } else if (op == VF_GET) {
*((unsigned short *)ptr) = static_wb->gp_weapon_index[g_index]; *((uint16_t *)ptr) = static_wb->gp_weapon_index[g_index];
} }
break; break;
case WBSV_V_GUNPT_POS: case WBSV_V_GUNPT_POS:

View File

@ -90,7 +90,7 @@ typedef struct {
int image_handle; // Either a vclip or a polygon model int image_handle; // Either a vclip or a polygon model
char model_name[PAGENAME_LEN]; // used for remapping powerups which contain models char model_name[PAGENAME_LEN]; // used for remapping powerups which contain models
int flags; int flags;
unsigned short used; uint16_t used;
short sounds[MAX_POWERUP_SOUNDS]; short sounds[MAX_POWERUP_SOUNDS];

View File

@ -33,12 +33,12 @@
// Attach to the polymodel // Attach to the polymodel
typedef struct poly_wb_info { typedef struct poly_wb_info {
// Static Data (Add to robot generic page) // Static Data (Add to robot generic page)
unsigned short num_gps; uint16_t num_gps;
ubyte gp_index[MAX_WB_GUNPOINTS]; ubyte gp_index[MAX_WB_GUNPOINTS];
// Turrets are listed from most important (greatest mobility) to least important // Turrets are listed from most important (greatest mobility) to least important
ubyte num_turrets; ubyte num_turrets;
unsigned short turret_index[MAX_WB_TURRETS]; uint16_t turret_index[MAX_WB_TURRETS];
} poly_wb_info; } poly_wb_info;
@ -46,9 +46,9 @@ typedef struct poly_wb_info {
// Attach to a object type // Attach to a object type
typedef struct otype_wb_info { typedef struct otype_wb_info {
unsigned short gp_weapon_index[MAX_WB_GUNPOINTS]; uint16_t gp_weapon_index[MAX_WB_GUNPOINTS];
unsigned short fm_fire_sound_index[MAX_WB_FIRING_MASKS]; uint16_t fm_fire_sound_index[MAX_WB_FIRING_MASKS];
unsigned short aiming_gp_index; uint16_t aiming_gp_index;
ubyte num_masks; ubyte num_masks;
ubyte gp_fire_masks[MAX_WB_FIRING_MASKS]; ubyte gp_fire_masks[MAX_WB_FIRING_MASKS];
@ -57,8 +57,8 @@ typedef struct otype_wb_info {
ubyte gp_quad_fire_mask; ubyte gp_quad_fire_mask;
ubyte num_levels; ubyte num_levels;
unsigned short gp_level_weapon_index[MAX_WB_UPGRADES]; uint16_t gp_level_weapon_index[MAX_WB_UPGRADES];
unsigned short gp_level_fire_sound_index[MAX_WB_UPGRADES]; uint16_t gp_level_fire_sound_index[MAX_WB_UPGRADES];
ubyte aiming_flags; ubyte aiming_flags;
float aiming_3d_dot; // These can be reused. float aiming_3d_dot; // These can be reused.

View File

@ -284,7 +284,7 @@ typedef struct {
ubyte spawn_count; // how many of spawn handle gets created ubyte spawn_count; // how many of spawn handle gets created
ubyte alternate_chance; // how often the alternate spawn weapon gets chosen (0 to 100) ubyte alternate_chance; // how often the alternate spawn weapon gets chosen (0 to 100)
unsigned short used; uint16_t used;
ubyte particle_count; ubyte particle_count;
ubyte terrain_damage_depth; ubyte terrain_damage_depth;

View File

@ -194,7 +194,7 @@ void *nw_TCPLoggingWorker(void *arg) {
return NULL; return NULL;
} }
bool nw_InitTCPLogging(char *ip, unsigned short port) { bool nw_InitTCPLogging(char *ip, uint16_t port) {
#if DLOPEN_PTHREAD #if DLOPEN_PTHREAD
// load up the pthread library // load up the pthread library
void *lib = dlopen("libpthread.so", RTLD_GLOBAL | RTLD_NOW); void *lib = dlopen("libpthread.so", RTLD_GLOBAL | RTLD_NOW);
@ -391,7 +391,7 @@ bool Debug_ConsoleInit() {
if (port_ptr) { if (port_ptr) {
*port_ptr = '\0'; *port_ptr = '\0';
port_ptr++; port_ptr++;
unsigned short port; uint16_t port;
port = atoi(port_ptr); port = atoi(port_ptr);
if (nw_InitTCPLogging(address, port)) { if (nw_InitTCPLogging(address, port)) {
Mono_use_window_remote = true; Mono_use_window_remote = true;
@ -541,7 +541,7 @@ void Debug_ConsolePrintf(int n, const char *format, ...) {
uint8_t packet[518]; uint8_t packet[518];
packet[0x00] = 0x03; // control code packet[0x00] = 0x03; // control code
packet[0x01] = n; // window_handle packet[0x01] = n; // window_handle
*((unsigned short *)&packet[0x02]) = text_len; *((uint16_t *)&packet[0x02]) = text_len;
memcpy(&packet[0x04], Mono_buffer, text_len); memcpy(&packet[0x04], Mono_buffer, text_len);
// send the packet // send the packet
@ -581,7 +581,7 @@ void Debug_ConsolePrintfAt(int n, int row, int col, const char *format, ...) {
packet[0x01] = n; // window_handle packet[0x01] = n; // window_handle
packet[0x02] = row; // row packet[0x02] = row; // row
packet[0x03] = col; // col packet[0x03] = col; // col
*((unsigned short *)&packet[0x04]) = text_len; *((uint16_t *)&packet[0x04]) = text_len;
memcpy(&packet[0x06], Mono_buffer, text_len); memcpy(&packet[0x06], Mono_buffer, text_len);
// send the packet // send the packet

View File

@ -64,7 +64,7 @@
#ifndef _MONO_H #ifndef _MONO_H
#define _MONO_H #define _MONO_H
#include "debug.h" #include "debug.h"
void nw_InitTCPLogging(char *ip, unsigned short port); void nw_InitTCPLogging(char *ip, uint16_t port);
void nw_TCPPrintf(int n, char *format, ...); void nw_TCPPrintf(int n, char *format, ...);
#if (!defined(RELEASE)) && defined(LOGGER) #if (!defined(RELEASE)) && defined(LOGGER)
extern bool Debug_print_block; extern bool Debug_print_block;

View File

@ -126,7 +126,7 @@ SOCKET tcp_log_sock;
SOCKADDR_IN tcp_log_addr; SOCKADDR_IN tcp_log_addr;
char tcp_log_buffer[MAX_TCPLOG_LEN]; char tcp_log_buffer[MAX_TCPLOG_LEN];
void nw_InitTCPLogging(char *ip, unsigned short port) { void nw_InitTCPLogging(char *ip, uint16_t port) {
int addrlen = sizeof(SOCKADDR_IN); int addrlen = sizeof(SOCKADDR_IN);
tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0); tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0);
if (INVALID_SOCKET == tcp_log_sock) { if (INVALID_SOCKET == tcp_log_sock) {

View File

@ -388,7 +388,7 @@ create_new_library(char *hogname, int nfiles, char **filenames)
//write files (& build index) //write files (& build index)
for (i=0;i<nfiles;i++) { for (i=0;i<nfiles;i++) {
FILE *ifp; FILE *ifp;
unsigned short date,time; uint16_t date,time;
ifp = fopen(filenames[i],"rb"); ifp = fopen(filenames[i],"rb");
if ( ifp == NULL ) { if ( ifp == NULL ) {

View File

@ -438,7 +438,7 @@ uint32_t CFtpGet::IssuePort()
#else #else
union{ union{
struct{ uint8_t s_b1,s_b2,s_b3,s_b4;}S_un_b; struct{ uint8_t s_b1,s_b2,s_b3,s_b4;}S_un_b;
struct{ unsigned short s_w1,s_w2;} S_un_w; struct{ uint16_t s_w1,s_w2;} S_un_w;
uint32_t S_addr; uint32_t S_addr;
}S_un; }S_un;

View File

@ -179,7 +179,7 @@ void ChttpGet::AbortGet()
#endif #endif
} }
ChttpGet::ChttpGet(char *URL,char *localfile,char *proxyip,unsigned short proxyport) ChttpGet::ChttpGet(char *URL,char *localfile,char *proxyip,uint16_t proxyport)
{ {
m_ProxyEnabled = true; m_ProxyEnabled = true;
m_ProxyIP = proxyip; m_ProxyIP = proxyip;

View File

@ -1311,7 +1311,7 @@ char *GetChannelList(void)
return Chan_list; return Chan_list;
} }
void AddChannel(char *channel,unsigned short numusers,char *topic) void AddChannel(char *channel,uint16_t numusers,char *topic)
{ {
Currchannel = Firstchannel; Currchannel = Firstchannel;
if(Firstchannel==NULL) if(Firstchannel==NULL)

View File

@ -39,7 +39,7 @@ typedef struct _Chat_user
typedef struct _Chat_channel typedef struct _Chat_channel
{ {
char channel_name[33]; char channel_name[33];
unsigned short users; uint16_t users;
char topic[100]; char topic[100];
_Chat_channel *next; _Chat_channel *next;
}Chat_channel; }Chat_channel;
@ -73,5 +73,5 @@ void RemoveAllChatUsers(void);
void AddChatCommandToQueue(int command,void *data,int len); void AddChatCommandToQueue(int command,void *data,int len);
Chat_command *GetChatCommandFromQueue(void); Chat_command *GetChatCommandFromQueue(void);
void FlushChatCommandQueue(void); void FlushChatCommandQueue(void);
void AddChannel(char *channel,unsigned short numusers,char *topic); void AddChannel(char *channel,uint16_t numusers,char *topic);
void FlushChannelList(void); void FlushChannelList(void);

View File

@ -3313,7 +3313,7 @@ void AutoLoginAndJoinGame(void)
int loginlen = LOGIN_LEN; int loginlen = LOGIN_LEN;
int passlen = PASSWORD_LEN; int passlen = PASSWORD_LEN;
int valret; int valret;
unsigned short port; uint16_t port;
uint32_t iaddr; uint32_t iaddr;
*DLLMultiGameStarting = 0; *DLLMultiGameStarting = 0;

View File

@ -210,14 +210,14 @@ typedef struct {
uint8_t game_type; uint8_t game_type;
char game_name[MAX_GAME_LISTS_PER_PACKET][MAX_GENERIC_GAME_NAME_LEN]; char game_name[MAX_GAME_LISTS_PER_PACKET][MAX_GENERIC_GAME_NAME_LEN];
uint32_t game_server[MAX_GAME_LISTS_PER_PACKET]; uint32_t game_server[MAX_GAME_LISTS_PER_PACKET];
unsigned short game_port[MAX_GAME_LISTS_PER_PACKET]; uint16_t game_port[MAX_GAME_LISTS_PER_PACKET];
}game_list; }game_list;
*/ */
typedef struct { typedef struct {
uint8_t game_type; uint8_t game_type;
uint32_t game_server[MAX_GAME_LISTS_PER_PACKET*4]; uint32_t game_server[MAX_GAME_LISTS_PER_PACKET*4];
unsigned short game_port[MAX_GAME_LISTS_PER_PACKET*4]; uint16_t game_port[MAX_GAME_LISTS_PER_PACKET*4];
}game_list; }game_list;
//Function prototypes //Function prototypes

View File

@ -240,9 +240,9 @@ typedef struct {
typedef struct { typedef struct {
uint8_t type; //Type of request uint8_t type; //Type of request
unsigned short len; //Length of total packet, including this header uint16_t len; //Length of total packet, including this header
uint32_t code; //For control messages uint32_t code; //For control messages
unsigned short xcode; //For control/NAK messages and for sigs. uint16_t xcode; //For control/NAK messages and for sigs.
uint32_t sig; //To identify unique return ACKs uint32_t sig; //To identify unique return ACKs
uint32_t security; // Just a random value, we store the last value used in the user record uint32_t security; // Just a random value, we store the last value used in the user record
// So we don't process the same request twice. // So we don't process the same request twice.

View File

@ -22,7 +22,7 @@
namespace AudioDecoder { namespace AudioDecoder {
typedef uint32_t uint32_t; typedef uint32_t uint32_t;
typedef int32_t int32_t; typedef int32_t int32_t;
typedef unsigned short uint16; typedef uint16_t uint16;
typedef signed short sint16; typedef signed short sint16;
typedef uint8_t uint8_t; typedef uint8_t uint8_t;
typedef int8_t int8_t; typedef int8_t int8_t;

View File

@ -69,7 +69,7 @@
#define ubyte uint8_t #define ubyte uint8_t
#define uint32_t uint32_t #define uint32_t uint32_t
#define ushort unsigned short #define ushort uint16_t
typedef struct { typedef struct {
ubyte type; ubyte type;

View File

@ -245,11 +245,11 @@ typedef struct tD3XInstruction {
struct /* register <- Address-Immediate indirect addressing */ struct /* register <- Address-Immediate indirect addressing */
{ {
uint8_t d, a; uint8_t d, a;
unsigned short imm; uint16_t imm;
} aii; } aii;
struct /* jump absolute <- register or jump/call absolute (r = 0xff) */ struct /* jump absolute <- register or jump/call absolute (r = 0xff) */
{ {
unsigned short abs; uint16_t abs;
uint8_t r; uint8_t r;
} ra; } ra;
struct /* register <- Address-Immediate indirect addressing */ struct /* register <- Address-Immediate indirect addressing */
@ -291,10 +291,10 @@ typedef struct tD3XInstruction {
typedef struct tD3XPMap { typedef struct tD3XPMap {
char name[MAX_D3XID_NAME]; char name[MAX_D3XID_NAME];
unsigned short ip; uint16_t ip;
unsigned short mem; uint16_t mem;
unsigned short type; uint16_t type;
unsigned short parms; uint16_t parms;
} tD3XPMap; } tD3XPMap;
#define D3X_TAG "D3X5" #define D3X_TAG "D3X5"

View File

@ -115,7 +115,7 @@ extern bool Demo_restart;
extern bool Demo_auto_play; extern bool Demo_auto_play;
extern bool Demo_make_movie; extern bool Demo_make_movie;
extern float Demo_frame_ofs; extern float Demo_frame_ofs;
extern unsigned short Demo_obj_map[MAX_OBJECTS]; extern uint16_t Demo_obj_map[MAX_OBJECTS];
#define DF_NONE 0 #define DF_NONE 0
#define DF_RECORDING 1 #define DF_RECORDING 1
#define DF_PLAYBACK 2 #define DF_PLAYBACK 2
@ -164,13 +164,13 @@ void DemoWriteHudMessage(uint32_t color, bool blink, char *msg);
void DemoWriteChangedObjects(); void DemoWriteChangedObjects();
void DemoWriteWeaponFire(unsigned short objectnum, vector *pos, vector *dir, unsigned short weaponnum, void DemoWriteWeaponFire(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum,
unsigned short weapobjnum, short gunnum); uint16_t weapobjnum, short gunnum);
void DemoWriteObjCreate(ubyte type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle, void DemoWriteObjCreate(ubyte type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle,
object *obj); object *obj);
void DemoWriteTurretChanged(unsigned short objnum); void DemoWriteTurretChanged(uint16_t objnum);
int DemoReadHeader(); int DemoReadHeader();
@ -200,7 +200,7 @@ void DemoReadCollideGenericWeapon(void);
void DemoReadNewFrame(void); void DemoReadNewFrame(void);
void DemoWriteObjAnimChanged(unsigned short objnum); void DemoWriteObjAnimChanged(uint16_t objnum);
void DemoWriteAttachObjRad(object *parent, char parent_ap, object *child, float rad); void DemoWriteAttachObjRad(object *parent, char parent_ap, object *child, float rad);
@ -226,17 +226,17 @@ void DemoReadPlayerInfo(void);
void DemoPlayAutoDemo(void); void DemoPlayAutoDemo(void);
void DemoWriteMSafe(ubyte *data, unsigned short len); void DemoWriteMSafe(ubyte *data, uint16_t len);
void DemoReadMSafe(); void DemoReadMSafe();
void DemoWritePowerup(ubyte *data, unsigned short len); void DemoWritePowerup(ubyte *data, uint16_t len);
void DemoReadPowerups(); void DemoReadPowerups();
void DemoReadCinematics(); void DemoReadCinematics();
void DemoWriteCinematics(ubyte *data, unsigned short len); void DemoWriteCinematics(ubyte *data, uint16_t len);
void DemoWritePersistantHUDMessage(ddgr_color color, int x, int y, float time, int flags, int sound_index, char *msg); void DemoWritePersistantHUDMessage(ddgr_color color, int x, int y, float time, int flags, int sound_index, char *msg);

View File

@ -169,7 +169,7 @@ typedef uint8_t FxU8;
typedef int8_t FxI8; typedef int8_t FxI8;
typedef unsigned short FxU16; typedef uint16_t FxU16;
typedef signed short FxI16; typedef signed short FxI16;

View File

@ -166,11 +166,11 @@
// helper macros for working with SOCKADDR_IN to make it look nicer between windows and Linux // helper macros for working with SOCKADDR_IN to make it look nicer between windows and Linux
static inline void INADDR_SET_SUN_SADDR(struct in_addr *st, uint32_t value) { st->S_un.S_addr = value; } static inline void INADDR_SET_SUN_SADDR(struct in_addr *st, uint32_t value) { st->S_un.S_addr = value; }
static inline void INADDR_GET_SUN_SADDR(struct in_addr *st, uint32_t *value) { *value = st->S_un.S_addr; } static inline void INADDR_GET_SUN_SADDR(struct in_addr *st, uint32_t *value) { *value = st->S_un.S_addr; }
static inline void INADDR_SET_SUN_SUNW(struct in_addr *st, unsigned short s_w1, unsigned short s_w2) { static inline void INADDR_SET_SUN_SUNW(struct in_addr *st, uint16_t s_w1, uint16_t s_w2) {
st->S_un.S_un_w.s_w1 = s_w1; st->S_un.S_un_w.s_w1 = s_w1;
st->S_un.S_un_w.s_w2 = s_w2; st->S_un.S_un_w.s_w2 = s_w2;
} }
static inline void INADDR_GET_SUN_SUNW(struct in_addr *st, unsigned short *s_w1, unsigned short *s_w2) { static inline void INADDR_GET_SUN_SUNW(struct in_addr *st, uint16_t *s_w1, uint16_t *s_w2) {
*s_w1 = st->S_un.S_un_w.s_w1; *s_w1 = st->S_un.S_un_w.s_w1;
*s_w2 = st->S_un.S_un_w.s_w2; *s_w2 = st->S_un.S_un_w.s_w2;
} }
@ -243,13 +243,13 @@ extern bool Use_DirectPlay;
// helper macros for working with SOCKADDR_IN to make it look nicer between windows and Linux // helper macros for working with SOCKADDR_IN to make it look nicer between windows and Linux
static inline void INADDR_SET_SUN_SADDR(struct in_addr *st, uint32_t value) { st->s_addr = value; } static inline void INADDR_SET_SUN_SADDR(struct in_addr *st, uint32_t value) { st->s_addr = value; }
static inline void INADDR_GET_SUN_SADDR(struct in_addr *st, uint32_t *value) { *value = st->s_addr; } static inline void INADDR_GET_SUN_SADDR(struct in_addr *st, uint32_t *value) { *value = st->s_addr; }
static inline void INADDR_SET_SUN_SUNW(struct in_addr *st, unsigned short s_w1, unsigned short s_w2) { static inline void INADDR_SET_SUN_SUNW(struct in_addr *st, uint16_t s_w1, uint16_t s_w2) {
union { union {
struct { struct {
uint8_t s_b1, s_b2, s_b3, s_b4; uint8_t s_b1, s_b2, s_b3, s_b4;
} S_un_b; } S_un_b;
struct { struct {
unsigned short s_w1, s_w2; uint16_t s_w1, s_w2;
} S_un_w; } S_un_w;
uint32_t S_addr; uint32_t S_addr;
} S_un; } S_un;
@ -258,13 +258,13 @@ static inline void INADDR_SET_SUN_SUNW(struct in_addr *st, unsigned short s_w1,
S_un.S_un_w.s_w2 = s_w2; S_un.S_un_w.s_w2 = s_w2;
st->s_addr = S_un.S_addr; st->s_addr = S_un.S_addr;
} }
static inline void INADDR_GET_SUN_SUNW(struct in_addr *st, unsigned short *s_w1, unsigned short *s_w2) { static inline void INADDR_GET_SUN_SUNW(struct in_addr *st, uint16_t *s_w1, uint16_t *s_w2) {
union { union {
struct { struct {
uint8_t s_b1, s_b2, s_b3, s_b4; uint8_t s_b1, s_b2, s_b3, s_b4;
} S_un_b; } S_un_b;
struct { struct {
unsigned short s_w1, s_w2; uint16_t s_w1, s_w2;
} S_un_w; } S_un_w;
uint32_t S_addr; uint32_t S_addr;
} S_un; } S_un;
@ -280,7 +280,7 @@ static inline void INADDR_SET_SUN_SUNB(struct in_addr *st, uint8_t s_b1, uint8_t
uint8_t s_b1, s_b2, s_b3, s_b4; uint8_t s_b1, s_b2, s_b3, s_b4;
} S_un_b; } S_un_b;
struct { struct {
unsigned short s_w1, s_w2; uint16_t s_w1, s_w2;
} S_un_w; } S_un_w;
uint32_t S_addr; uint32_t S_addr;
} S_un; } S_un;
@ -298,7 +298,7 @@ static inline void INADDR_GET_SUN_SUNB(struct in_addr *st, uint8_t *s_b1, uint8_
uint8_t s_b1, s_b2, s_b3, s_b4; uint8_t s_b1, s_b2, s_b3, s_b4;
} S_un_b; } S_un_b;
struct { struct {
unsigned short s_w1, s_w2; uint16_t s_w1, s_w2;
} S_un_w; } S_un_w;
uint32_t S_addr; uint32_t S_addr;
} S_un; } S_un;

View File

@ -225,7 +225,7 @@ typedef struct bsp_info {
// used to describe a polygon model // used to describe a polygon model
typedef struct poly_model { typedef struct poly_model {
unsigned short used; uint16_t used;
int flags; // PMF_flags, see above int flags; // PMF_flags, see above
ubyte new_style; // if 1, then this polymodel is in the new outrage format (oof) ubyte new_style; // if 1, then this polymodel is in the new outrage format (oof)

View File

@ -24,7 +24,7 @@
// define unsigned types; // define unsigned types;
typedef uint8_t ubyte; typedef uint8_t ubyte;
typedef int8_t sbyte; typedef int8_t sbyte;
typedef unsigned short ushort; typedef uint16_t ushort;
typedef uint32_t uint32_t; typedef uint32_t uint32_t;
typedef unsigned long ulong; typedef unsigned long ulong;

View File

@ -44,7 +44,7 @@
#define VECMAT_EXTERNAL_H #define VECMAT_EXTERNAL_H
// Angles are unsigned shorts // Angles are unsigned shorts
typedef unsigned short angle; // make sure this matches up with fix.h typedef uint16_t angle; // make sure this matches up with fix.h
typedef struct { typedef struct {
angle p, h, b; angle p, h, b;

View File

@ -25,7 +25,7 @@
typedef uint32_t uint32_t; typedef uint32_t uint32_t;
typedef int32_t int32_t; typedef int32_t int32_t;
typedef unsigned short uint16; typedef uint16_t uint16;
typedef signed short sint16; typedef signed short sint16;
typedef uint8_t uint8_t; typedef uint8_t uint8_t;
typedef int8_t int8_t; typedef int8_t int8_t;

View File

@ -686,13 +686,13 @@ static int output_values(int *src, uint8_t *dst, int n,
static int read_wavc_header(ACMStream *acm) static int read_wavc_header(ACMStream *acm)
{ {
static const unsigned short expect[12] = { static const uint16_t expect[12] = {
/* 'V1.0', raw_size, acm_size */ /* 'V1.0', raw_size, acm_size */
0x3156, 0x302E, 0,0, 0,0, 0x3156, 0x302E, 0,0, 0,0,
/* hdrlen?, chans?, bits?, hz */ /* hdrlen?, chans?, bits?, hz */
28,0, 1, 16, 22050, 0 28,0, 1, 16, 22050, 0
}; };
unsigned short i, buf[12]; uint16_t i, buf[12];
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
GET_BITS(buf[i], acm, 16); GET_BITS(buf[i], acm, 16);

View File

@ -43,13 +43,13 @@
#define LNXSND_CAPS_LOCHARDWARE 0x0004 #define LNXSND_CAPS_LOCHARDWARE 0x0004
struct SoundWAVEFormatEx { struct SoundWAVEFormatEx {
unsigned short wFormatTag; uint16_t wFormatTag;
unsigned short nChannels; uint16_t nChannels;
uint32_t nSamplesPerSec; uint32_t nSamplesPerSec;
uint32_t nAvgBytesPerSec; uint32_t nAvgBytesPerSec;
unsigned short nBlockAlign; uint16_t nBlockAlign;
unsigned short wBitsPerSample; uint16_t wBitsPerSample;
unsigned short cbSize; uint16_t cbSize;
}; };
#define SOUND_WAVE_FORMAT_PCM 0x01 #define SOUND_WAVE_FORMAT_PCM 0x01

View File

@ -54,7 +54,7 @@ typedef struct {
LnxBufferDesc lbdesc; LnxBufferDesc lbdesc;
unsigned short freq; uint16_t freq;
char playing; char playing;
char __pad; char __pad;
} LnxSoundBuffer; } LnxSoundBuffer;

View File

@ -35,8 +35,8 @@ extern unsigned nf_new_line; // width - SWIDTH
extern unsigned nf_back_right; // (SHEIGHT-1)*width extern unsigned nf_back_right; // (SHEIGHT-1)*width
extern unsigned nf_hicolor; extern unsigned nf_hicolor;
extern unsigned short nf_trans16_lo[256]; extern uint16_t nf_trans16_lo[256];
extern unsigned short nf_trans16_hi[256]; extern uint16_t nf_trans16_hi[256];
extern signed short snd_8to16[256]; extern signed short snd_8to16[256];
void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, const unsigned x, void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, const unsigned x,
@ -44,8 +44,8 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
void nfHPkDecomp(uint8_t *ops, uint8_t *comp, int x, int y, int w, int h); void nfHPkDecomp(uint8_t *ops, uint8_t *comp, int x, int y, int w, int h);
void nfPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfPkConfig(void); void nfPkConfig(void);
unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev); unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev);
unsigned sndDecompS16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev); unsigned sndDecompS16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev);
void Trans16Blk(uint8_t *edi, const uint8_t *idx); void Trans16Blk(uint8_t *edi, const uint8_t *idx);
void DOnf_xycshift(const bool hiColor, const uint32_t eax, uint8_t *&edi, const int nfpk_back_right); void DOnf_xycshift(const bool hiColor, const uint32_t eax, uint8_t *&edi, const int nfpk_back_right);
@ -61,7 +61,7 @@ void DOnf_shift(const bool hiColor, int eax, uint8_t *&edi, const int nfpk_back_
// (src is len bytes, dst is len*2 bytes) // (src is len bytes, dst is len*2 bytes)
// prev is the previous decompression state or zero. // prev is the previous decompression state or zero.
// Returns new decompression state. // Returns new decompression state.
unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev) { unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev) {
uint32_t i, eax, ebx; uint32_t i, eax, ebx;
if (len == 0) if (len == 0)
return prev; return prev;
@ -86,7 +86,7 @@ unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, uns
// (It encodes the 16-bit states of the two stereo channels // (It encodes the 16-bit states of the two stereo channels
// in its low and high order 16-bit halves.) // in its low and high order 16-bit halves.)
// Returns new decompression state. // Returns new decompression state.
unsigned sndDecompS16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev) { unsigned sndDecompS16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev) {
unsigned re = 0; unsigned re = 0;
uint32_t eax, edx, ebx, i; uint32_t eax, edx, ebx, i;
@ -374,7 +374,7 @@ void nfPkConfig(void) {
} }
} }
unsigned short Trans16(const uint8_t *idx) { return nf_trans16_lo[idx[0]] | nf_trans16_hi[idx[1]]; } uint16_t Trans16(const uint8_t *idx) { return nf_trans16_lo[idx[0]] | nf_trans16_hi[idx[1]]; }
int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8_t *&bcomp, int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8_t *&bcomp,
uint8_t *&edi) { uint8_t *&edi) {
@ -406,7 +406,7 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8
case 7: { case 7: {
bool donf23 = false; bool donf23 = false;
if (hiColor) { if (hiColor) {
unsigned short val = IntelSwapper(*(unsigned short *)esi); uint16_t val = IntelSwapper(*(uint16_t *)esi);
if (val & 0x8000) { if (val & 0x8000) {
donf23 = true; donf23 = true;
} }
@ -426,7 +426,7 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8
case 8: { case 8: {
bool mode2 = false; bool mode2 = false;
if (hiColor) { if (hiColor) {
unsigned short val = IntelSwapper(*(unsigned short *)esi); uint16_t val = IntelSwapper(*(uint16_t *)esi);
if (val & 0x8000) { if (val & 0x8000) {
mode2 = true; mode2 = true;
} }
@ -448,11 +448,11 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8
bool mode3 = false; bool mode3 = false;
if (hiColor) { if (hiColor) {
unsigned short val = IntelSwapper(*(unsigned short *)esi); uint16_t val = IntelSwapper(*(uint16_t *)esi);
if (val & 0x8000) { if (val & 0x8000) {
mode2 = true; mode2 = true;
} else { } else {
val = IntelSwapper(*(unsigned short *)(esi + 4)); val = IntelSwapper(*(uint16_t *)(esi + 4));
if (val & 0x8000) { if (val & 0x8000) {
mode3 = true; mode3 = true;
} }
@ -477,7 +477,7 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8
bool mode2 = false; bool mode2 = false;
if (hiColor) { if (hiColor) {
int val1 = IntelSwapper(*(unsigned short *)esi); int val1 = IntelSwapper(*(uint16_t *)esi);
if (val1 & 0x8000) { if (val1 & 0x8000) {
mode2 = true; mode2 = true;
} }
@ -531,14 +531,14 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
const unsigned y, unsigned w, unsigned h) { const unsigned y, unsigned w, unsigned h) {
#ifdef OUTRAGE_BIG_ENDIAN #ifdef OUTRAGE_BIG_ENDIAN
typedef struct { typedef struct {
unsigned short hax, ax; uint16_t hax, ax;
} reg_word; } reg_word;
typedef struct { typedef struct {
int8_t hah, hal, ah, al; int8_t hah, hal, ah, al;
} reg_byte; } reg_byte;
#else #else
typedef struct { typedef struct {
unsigned short ax, hax; uint16_t ax, hax;
} reg_word; } reg_word;
typedef struct { typedef struct {
int8_t al, ah, hal, hah; int8_t al, ah, hal, hah;
@ -561,7 +561,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
const uint8_t *bcomp = NULL; const uint8_t *bcomp = NULL;
if (hiColor) { if (hiColor) {
uint32_t bcompOffset = IntelSwapper(*((const unsigned short *)esi)); uint32_t bcompOffset = IntelSwapper(*((const uint16_t *)esi));
bcomp = esi + bcompOffset; bcomp = esi + bcompOffset;
esi += 2; esi += 2;
} }
@ -601,8 +601,8 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
if (hiColor) { if (hiColor) {
// Here we can set the color to exactly what we want // Here we can set the color to exactly what we want
const unsigned short kColor = 0; const uint16_t kColor = 0;
unsigned short *pDst = reinterpret_cast<unsigned short *>(edi); uint16_t *pDst = reinterpret_cast<uint16_t *>(edi);
for (int r = 0; r < 8; ++r) { for (int r = 0; r < 8; ++r) {
pDst[0] = kColor; pDst[0] = kColor;
pDst[1] = kColor; pDst[1] = kColor;
@ -689,14 +689,14 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
} break; } break;
case 5: { case 5: {
// Far shift from previous buffer // Far shift from previous buffer
uint32_t eax = IntelSwapper(*(unsigned short *)(esi)); uint32_t eax = IntelSwapper(*(uint16_t *)(esi));
esi += 2; esi += 2;
DOnf_xypshift(hiColor, eax, edi, nfpk_back_right, nf.DiffBufPtrs); DOnf_xypshift(hiColor, eax, edi, nfpk_back_right, nf.DiffBufPtrs);
} break; } break;
case 6: { case 6: {
if (hiColor) { if (hiColor) {
// Far shift from current buffer // Far shift from current buffer
uint32_t val1 = IntelSwapper(*(unsigned short *)esi); uint32_t val1 = IntelSwapper(*(uint16_t *)esi);
esi += 2; esi += 2;
DOnf_xycshift(hiColor, val1, edi, nfpk_back_right); DOnf_xycshift(hiColor, val1, edi, nfpk_back_right);
} else { } else {
@ -722,7 +722,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
case 7: { case 7: {
bool donf23 = false; bool donf23 = false;
if (hiColor) { if (hiColor) {
unsigned short val = IntelSwapper(*(unsigned short *)esi); uint16_t val = IntelSwapper(*(uint16_t *)esi);
if (val & 0x8000) { if (val & 0x8000) {
donf23 = true; donf23 = true;
} }
@ -775,10 +775,10 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
*(uint32_t *)(edi + 8) = w3; *(uint32_t *)(edi + 8) = w3;
*(uint32_t *)(edi + 12) = w4; *(uint32_t *)(edi + 12) = w4;
} else { } else {
*(unsigned short *)(edi + 0) = w1; *(uint16_t *)(edi + 0) = w1;
*(unsigned short *)(edi + 2) = w2; *(uint16_t *)(edi + 2) = w2;
*(unsigned short *)(edi + 4) = w3; *(uint16_t *)(edi + 4) = w3;
*(unsigned short *)(edi + 6) = w4; *(uint16_t *)(edi + 6) = w4;
} }
edi += nf_width; edi += nf_width;
@ -844,14 +844,14 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
*(uint32_t *)(edi + nf_width + 8) = w3; *(uint32_t *)(edi + nf_width + 8) = w3;
*(uint32_t *)(edi + nf_width + 12) = w4; *(uint32_t *)(edi + nf_width + 12) = w4;
} else { } else {
*(unsigned short *)(edi + 0) = w1; *(uint16_t *)(edi + 0) = w1;
*(unsigned short *)(edi + 2) = w2; *(uint16_t *)(edi + 2) = w2;
*(unsigned short *)(edi + 4) = w3; *(uint16_t *)(edi + 4) = w3;
*(unsigned short *)(edi + 6) = w4; *(uint16_t *)(edi + 6) = w4;
*(unsigned short *)(edi + 0 + nf_width) = w1; *(uint16_t *)(edi + 0 + nf_width) = w1;
*(unsigned short *)(edi + 2 + nf_width) = w2; *(uint16_t *)(edi + 2 + nf_width) = w2;
*(unsigned short *)(edi + 4 + nf_width) = w3; *(uint16_t *)(edi + 4 + nf_width) = w3;
*(unsigned short *)(edi + 6 + nf_width) = w4; *(uint16_t *)(edi + 6 + nf_width) = w4;
} }
edi += nf_width * 2; edi += nf_width * 2;
@ -867,9 +867,9 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
bool donf40 = false; bool donf40 = false;
if (hiColor) { if (hiColor) {
unsigned short val = IntelSwapper(*(unsigned short *)esi); uint16_t val = IntelSwapper(*(uint16_t *)esi);
if (val & 0x8000) { if (val & 0x8000) {
val = IntelSwapper(*(unsigned short *)(esi + 8)); val = IntelSwapper(*(uint16_t *)(esi + 8));
if (val & 0x8000) { if (val & 0x8000) {
donf40 = true; donf40 = true;
} else { } else {
@ -944,11 +944,11 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
*(uint32_t *)(edi + 4) = w4; *(uint32_t *)(edi + 4) = w4;
edi += nf_width; edi += nf_width;
} else { } else {
*(unsigned short *)(edi + 0) = w1; *(uint16_t *)(edi + 0) = w1;
*(unsigned short *)(edi + 2) = w2; *(uint16_t *)(edi + 2) = w2;
edi += nf_width; edi += nf_width;
*(unsigned short *)(edi + 0) = w3; *(uint16_t *)(edi + 0) = w3;
*(unsigned short *)(edi + 2) = w4; *(uint16_t *)(edi + 2) = w4;
edi += nf_width; edi += nf_width;
} }
@ -1064,11 +1064,11 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
*(uint32_t *)(edi + 4) = w4; *(uint32_t *)(edi + 4) = w4;
edi += nf_width; edi += nf_width;
} else { } else {
*(unsigned short *)(edi + 0) = w1; *(uint16_t *)(edi + 0) = w1;
*(unsigned short *)(edi + 2) = w2; *(uint16_t *)(edi + 2) = w2;
edi += nf_width; edi += nf_width;
*(unsigned short *)(edi + 0) = w3; *(uint16_t *)(edi + 0) = w3;
*(unsigned short *)(edi + 2) = w4; *(uint16_t *)(edi + 2) = w4;
edi += nf_width; edi += nf_width;
} }
@ -1154,10 +1154,10 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
*(uint32_t *)(edi + 8) = w3; *(uint32_t *)(edi + 8) = w3;
*(uint32_t *)(edi + 12) = w4; *(uint32_t *)(edi + 12) = w4;
} else { } else {
*(unsigned short *)(edi + 0) = w1; *(uint16_t *)(edi + 0) = w1;
*(unsigned short *)(edi + 2) = w2; *(uint16_t *)(edi + 2) = w2;
*(unsigned short *)(edi + 4) = w3; *(uint16_t *)(edi + 4) = w3;
*(unsigned short *)(edi + 6) = w4; *(uint16_t *)(edi + 6) = w4;
} }
edi += nf_width; edi += nf_width;
@ -1191,9 +1191,9 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
bool donf57 = false; bool donf57 = false;
if (hiColor) { if (hiColor) {
unsigned short val = IntelSwapper(*(unsigned short *)esi); uint16_t val = IntelSwapper(*(uint16_t *)esi);
if (val & 0x8000) { if (val & 0x8000) {
val = IntelSwapper(*(unsigned short *)(esi + 4)); val = IntelSwapper(*(uint16_t *)(esi + 4));
if (val & 0x8000) { if (val & 0x8000) {
donf57 = true; donf57 = true;
} else { } else {
@ -1201,7 +1201,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
} }
} else { } else {
val = IntelSwapper(*(unsigned short *)(esi + 4)); val = IntelSwapper(*(uint16_t *)(esi + 4));
if (val & 0x8000) { if (val & 0x8000) {
donf25 = true; donf25 = true;
} }
@ -1219,7 +1219,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
} }
if (donf57) { if (donf57) {
unsigned short colors[4]; uint16_t colors[4];
if (hiColor) { if (hiColor) {
colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)]; colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)];
colors[1] = nf_trans16_lo[*(esi + 2)] | nf_trans16_hi[*(esi + 3)]; colors[1] = nf_trans16_lo[*(esi + 2)] | nf_trans16_hi[*(esi + 3)];
@ -1441,7 +1441,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
esi += (hiColor) ? 12 : 8; esi += (hiColor) ? 12 : 8;
edi -= nfpk_back_right; edi -= nfpk_back_right;
} else { } else {
unsigned short colors[4]; uint16_t colors[4];
if (hiColor) { if (hiColor) {
colors[0] = Trans16(esi + 0); colors[0] = Trans16(esi + 0);
colors[1] = Trans16(esi + 2); colors[1] = Trans16(esi + 2);
@ -1505,9 +1505,9 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
bool do42 = false; bool do42 = false;
if (hiColor) { if (hiColor) {
int val1 = IntelSwapper(*(unsigned short *)esi); int val1 = IntelSwapper(*(uint16_t *)esi);
if (val1 & 0x8000) { if (val1 & 0x8000) {
val1 = IntelSwapper(*(unsigned short *)(esi + 16)); val1 = IntelSwapper(*(uint16_t *)(esi + 16));
if (val1 & 0x8000) { if (val1 & 0x8000) {
do42 = true; do42 = true;
} else { } else {
@ -1525,7 +1525,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
} }
// Load bx,dx,cx,bp with four colors // Load bx,dx,cx,bp with four colors
unsigned short colors[4]; uint16_t colors[4];
if (hiColor) { if (hiColor) {
colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)]; colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)];
colors[1] = nf_trans16_lo[*(esi + 2)] | nf_trans16_hi[*(esi + 3)]; colors[1] = nf_trans16_lo[*(esi + 2)] | nf_trans16_hi[*(esi + 3)];
@ -1912,7 +1912,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
case 15: { case 15: {
if (!hiColor) { if (!hiColor) {
// mix 8x8x0 (2 bytes) // mix 8x8x0 (2 bytes)
uint32_t ebx = IntelSwapper(*(unsigned short *)(esi)); // Copy 2 colors into 8 positions uint32_t ebx = IntelSwapper(*(uint16_t *)(esi)); // Copy 2 colors into 8 positions
esi += 2; // in a checkerboard esi += 2; // in a checkerboard
uint32_t eax = (ebx << 16) | ebx; uint32_t eax = (ebx << 16) | ebx;
ebx = (eax << 8) | ((eax >> 24) & 0xFF); ebx = (eax << 8) | ((eax >> 24) & 0xFF);
@ -1941,14 +1941,14 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp,
} }
void Trans16Blk(uint8_t *edi, const uint8_t *idx) { void Trans16Blk(uint8_t *edi, const uint8_t *idx) {
*((unsigned short *)(edi + 0)) = nf_trans16_lo[*(idx + 0)] | nf_trans16_hi[*(idx + 1)]; *((uint16_t *)(edi + 0)) = nf_trans16_lo[*(idx + 0)] | nf_trans16_hi[*(idx + 1)];
*((unsigned short *)(edi + 2)) = nf_trans16_lo[*(idx + 2)] | nf_trans16_hi[*(idx + 3)]; *((uint16_t *)(edi + 2)) = nf_trans16_lo[*(idx + 2)] | nf_trans16_hi[*(idx + 3)];
*((unsigned short *)(edi + 4)) = nf_trans16_lo[*(idx + 4)] | nf_trans16_hi[*(idx + 5)]; *((uint16_t *)(edi + 4)) = nf_trans16_lo[*(idx + 4)] | nf_trans16_hi[*(idx + 5)];
*((unsigned short *)(edi + 6)) = nf_trans16_lo[*(idx + 6)] | nf_trans16_hi[*(idx + 7)]; *((uint16_t *)(edi + 6)) = nf_trans16_lo[*(idx + 6)] | nf_trans16_hi[*(idx + 7)];
*((unsigned short *)(edi + 8)) = nf_trans16_lo[*(idx + 8)] | nf_trans16_hi[*(idx + 9)]; *((uint16_t *)(edi + 8)) = nf_trans16_lo[*(idx + 8)] | nf_trans16_hi[*(idx + 9)];
*((unsigned short *)(edi + 10)) = nf_trans16_lo[*(idx + 10)] | nf_trans16_hi[*(idx + 11)]; *((uint16_t *)(edi + 10)) = nf_trans16_lo[*(idx + 10)] | nf_trans16_hi[*(idx + 11)];
*((unsigned short *)(edi + 12)) = nf_trans16_lo[*(idx + 12)] | nf_trans16_hi[*(idx + 13)]; *((uint16_t *)(edi + 12)) = nf_trans16_lo[*(idx + 12)] | nf_trans16_hi[*(idx + 13)];
*((unsigned short *)(edi + 14)) = nf_trans16_lo[*(idx + 14)] | nf_trans16_hi[*(idx + 15)]; *((uint16_t *)(edi + 14)) = nf_trans16_lo[*(idx + 14)] | nf_trans16_hi[*(idx + 15)];
} }
void DOnf_xycshift(const bool hiColor, const uint32_t eax, uint8_t *&edi, const int nfpk_back_right) { void DOnf_xycshift(const bool hiColor, const uint32_t eax, uint8_t *&edi, const int nfpk_back_right) {
@ -2026,10 +2026,10 @@ void DOnf_shift(const bool hiColor, const int offset, uint8_t *&edi, const int n
// Non-Implemented Functions // Non-Implemented Functions
//////////////////////////////////////////////// ////////////////////////////////////////////////
void nfHiColorDecomp(const uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfHiColorDecomp(const uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfHiColorDecompChg(const unsigned short *chgs, const unsigned short *parms, const uint8_t *comp, unsigned x, void nfHiColorDecompChg(const uint16_t *chgs, const uint16_t *parms, const uint8_t *comp, unsigned x,
unsigned y, unsigned w, unsigned h); unsigned y, unsigned w, unsigned h);
void nfDecomp(const uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfDecomp(const uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfDecompChg(const unsigned short *chgs, const unsigned short *parms, const uint8_t *comp, unsigned x, void nfDecompChg(const uint16_t *chgs, const uint16_t *parms, const uint8_t *comp, unsigned x,
unsigned y, unsigned w, unsigned h); unsigned y, unsigned w, unsigned h);
void nfPkDecompH(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfPkDecompH(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfPkDecompD(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfPkDecompD(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
@ -2037,9 +2037,9 @@ void mve_ShowFrameField(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx,
unsigned h, unsigned dstx, unsigned dsty, unsigned field); unsigned h, unsigned dstx, unsigned dsty, unsigned field);
void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w, void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w,
unsigned h, unsigned dstx, unsigned dsty, unsigned field); unsigned h, unsigned dstx, unsigned dsty, unsigned field);
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops, void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
@ -2075,7 +2075,7 @@ void DECOMP_BODY(bool HI_COLOR_FLAG, const uint8_t *&comp, uint32_t _x, uint32_t
// Iterate over params and copy new hires data to appropriate sections. // Iterate over params and copy new hires data to appropriate sections.
uint8_t *curr_tbuf = nf.tbuf; uint8_t *curr_tbuf = nf.tbuf;
const unsigned short *compAsWord = (const unsigned short *)comp; const uint16_t *compAsWord = (const uint16_t *)comp;
for (uint8_t fqIt = nf_fqty; fqIt != 0; --fqIt, curr_tbuf += nf_width) { for (uint8_t fqIt = nf_fqty; fqIt != 0; --fqIt, curr_tbuf += nf_width) {
uint8_t *this_tbuf = curr_tbuf; uint8_t *this_tbuf = curr_tbuf;
for (uint32_t ch = nf.h; ch != 0; --ch, this_tbuf += nf.new_row) { for (uint32_t ch = nf.h; ch != 0; --ch, this_tbuf += nf.new_row) {
@ -2093,8 +2093,8 @@ void DECOMP_BODY(bool HI_COLOR_FLAG, const uint8_t *&comp, uint32_t _x, uint32_t
size_t amt = sizeof(uint32_t) * 2 * HI_COLOR_SCALE; size_t amt = sizeof(uint32_t) * 2 * HI_COLOR_SCALE;
// memcpy( this_tbuf, compData, amt ); // memcpy( this_tbuf, compData, amt );
for (uint32_t ii = 0; ii < (amt / 2); ii++) { for (uint32_t ii = 0; ii < (amt / 2); ii++) {
unsigned short *destword = (unsigned short *)this_tbuf[ii]; uint16_t *destword = (uint16_t *)this_tbuf[ii];
unsigned short *srcword = (unsigned short *)compData[ii]; uint16_t *srcword = (uint16_t *)compData[ii];
*destword = IntelSwapper(*srcword); *destword = IntelSwapper(*srcword);
} }
compData += amt; compData += amt;
@ -2114,7 +2114,7 @@ void DECOMP_BODY(bool HI_COLOR_FLAG, const uint8_t *&comp, uint32_t _x, uint32_t
// ebx indexes params. // ebx indexes params.
// esi indexes source from buffer // esi indexes source from buffer
// esi will be computed as +- 16K relative to edi. // esi will be computed as +- 16K relative to edi.
compAsWord = (const unsigned short *)comp; compAsWord = (const uint16_t *)comp;
curr_tbuf = nf.tbuf; curr_tbuf = nf.tbuf;
for (uint8_t fqIt = nf_fqty; fqIt != 0; --fqIt, curr_tbuf += nf_width) { for (uint8_t fqIt = nf_fqty; fqIt != 0; --fqIt, curr_tbuf += nf_width) {
uint8_t *this_tbuf = curr_tbuf; uint8_t *this_tbuf = curr_tbuf;
@ -2140,8 +2140,8 @@ void DECOMP_BODY(bool HI_COLOR_FLAG, const uint8_t *&comp, uint32_t _x, uint32_t
size_t amt = sizeof(uint32_t) * 2 * HI_COLOR_SCALE; size_t amt = sizeof(uint32_t) * 2 * HI_COLOR_SCALE;
// memcpy( this_tbuf, src, amt ); // memcpy( this_tbuf, src, amt );
for (uint32_t ii = 0; ii < (amt / 2); ii++) { for (uint32_t ii = 0; ii < (amt / 2); ii++) {
unsigned short *destword = (unsigned short *)this_tbuf[ii]; uint16_t *destword = (uint16_t *)this_tbuf[ii];
unsigned short *srcword = (unsigned short *)src[ii]; uint16_t *srcword = (uint16_t *)src[ii];
*destword = IntelSwapper(*srcword); *destword = IntelSwapper(*srcword);
} }
src += amt + nf_new_line; src += amt + nf_new_line;
@ -2155,7 +2155,7 @@ void DECOMP_BODY(bool HI_COLOR_FLAG, const uint8_t *&comp, uint32_t _x, uint32_t
} }
} }
void DECOMP_CHG_BODY(bool HI_COLOR_FLAG, const unsigned short *&chgs, const unsigned short *&parms, void DECOMP_CHG_BODY(bool HI_COLOR_FLAG, const uint16_t *&chgs, const uint16_t *&parms,
const uint8_t *&comp, uint32_t _x, uint32_t _y, uint32_t _w, uint32_t _h) { const uint8_t *&comp, uint32_t _x, uint32_t _y, uint32_t _w, uint32_t _h) {
uint32_t HI_COLOR_SCALE = (HI_COLOR_FLAG) ? 2 : 1; uint32_t HI_COLOR_SCALE = (HI_COLOR_FLAG) ? 2 : 1;
@ -2167,11 +2167,11 @@ void DECOMP_CHG_BODY(bool HI_COLOR_FLAG, const unsigned short *&chgs, const unsi
NF_DECOMP_INIT(HI_COLOR_FLAG ? 1 : 0, &nf); NF_DECOMP_INIT(HI_COLOR_FLAG ? 1 : 0, &nf);
// Iterate over params and copy new hires data to appropriate sections. // Iterate over params and copy new hires data to appropriate sections.
const unsigned short *pChgs = chgs; const uint16_t *pChgs = chgs;
uint32_t eax = 0; uint32_t eax = 0;
const uint8_t *compData = comp; const uint8_t *compData = comp;
uint8_t *curr_tbuf = nf.tbuf; uint8_t *curr_tbuf = nf.tbuf;
const unsigned short *curr_parms = parms; const uint16_t *curr_parms = parms;
for (uint8_t fqIt = nf_fqty; fqIt != 0; --fqIt, curr_tbuf += nf_width) { for (uint8_t fqIt = nf_fqty; fqIt != 0; --fqIt, curr_tbuf += nf_width) {
uint8_t *this_tbuf = curr_tbuf; uint8_t *this_tbuf = curr_tbuf;
for (uint32_t ch = nf.h; ch != 0; --ch, this_tbuf += nf.new_row) { for (uint32_t ch = nf.h; ch != 0; --ch, this_tbuf += nf.new_row) {
@ -2187,7 +2187,7 @@ void DECOMP_CHG_BODY(bool HI_COLOR_FLAG, const unsigned short *&chgs, const unsi
continue; continue;
} }
unsigned short flags = IntelSwapper(*curr_parms++); uint16_t flags = IntelSwapper(*curr_parms++);
if (flags != 0) { if (flags != 0) {
this_tbuf += SWIDTH * HI_COLOR_SCALE; this_tbuf += SWIDTH * HI_COLOR_SCALE;
continue; continue;
@ -2201,8 +2201,8 @@ void DECOMP_CHG_BODY(bool HI_COLOR_FLAG, const unsigned short *&chgs, const unsi
// TODO: Do these bytes need swapping? Is this data shorts? // TODO: Do these bytes need swapping? Is this data shorts?
// memcpy( this_tbuf, compData, amt ); // memcpy( this_tbuf, compData, amt );
for (uint32_t ii = 0; ii < (amt / 2); ii++) { for (uint32_t ii = 0; ii < (amt / 2); ii++) {
unsigned short *dest = (unsigned short *)this_tbuf[ii]; uint16_t *dest = (uint16_t *)this_tbuf[ii];
unsigned short *src = (unsigned short *)compData[ii]; uint16_t *src = (uint16_t *)compData[ii];
*dest = IntelSwapper(*src); *dest = IntelSwapper(*src);
} }
compData += amt; compData += amt;
@ -2258,8 +2258,8 @@ void DECOMP_CHG_BODY(bool HI_COLOR_FLAG, const unsigned short *&chgs, const unsi
size_t amt = sizeof(uint32_t) * 2 * HI_COLOR_SCALE; size_t amt = sizeof(uint32_t) * 2 * HI_COLOR_SCALE;
// memcpy( this_tbuf, src, amt ); // memcpy( this_tbuf, src, amt );
for (uint32_t ii = 0; ii < (amt / 2); ii++) { for (uint32_t ii = 0; ii < (amt / 2); ii++) {
unsigned short *destword = (unsigned short *)this_tbuf[ii]; uint16_t *destword = (uint16_t *)this_tbuf[ii];
unsigned short *srcword = (unsigned short *)src[ii]; uint16_t *srcword = (uint16_t *)src[ii];
*destword = IntelSwapper(*srcword); *destword = IntelSwapper(*srcword);
} }
src += amt + nf_new_line; src += amt + nf_new_line;
@ -2281,7 +2281,7 @@ void nfHiColorDecomp(const uint8_t *comp, uint32_t x, uint32_t y, uint32_t w, ui
// by x,y,w,h in units of SWIDTHxSHEIGHT (8x8). // by x,y,w,h in units of SWIDTHxSHEIGHT (8x8).
// Chgs specifies which squares to update. // Chgs specifies which squares to update.
// Parms are motion parms for squares to update. // Parms are motion parms for squares to update.
void nfHiColorDecompChg(const unsigned short *chgs, const unsigned short *parms, const uint8_t *comp, unsigned x, void nfHiColorDecompChg(const uint16_t *chgs, const uint16_t *parms, const uint8_t *comp, unsigned x,
unsigned y, unsigned w, unsigned h) { unsigned y, unsigned w, unsigned h) {
DECOMP_CHG_BODY(true, chgs, parms, comp, x, y, w, h); DECOMP_CHG_BODY(true, chgs, parms, comp, x, y, w, h);
} }
@ -2301,7 +2301,7 @@ void nfDecomp(const uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned
// by x,y,w,h in units of SWIDTHxSHEIGHT (8x8). // by x,y,w,h in units of SWIDTHxSHEIGHT (8x8).
// Chgs specifies which squares to update. // Chgs specifies which squares to update.
// Parms are motion parms for squares to update. // Parms are motion parms for squares to update.
void nfDecompChg(const unsigned short *chgs, const unsigned short *parms, const uint8_t *comp, unsigned x, void nfDecompChg(const uint16_t *chgs, const uint16_t *parms, const uint8_t *comp, unsigned x,
unsigned y, unsigned w, unsigned h) { unsigned y, unsigned w, unsigned h) {
if (nf_hicolor) { if (nf_hicolor) {
nfHiColorDecompChg(chgs, parms, comp, x, y, w, h); nfHiColorDecompChg(chgs, parms, comp, x, y, w, h);
@ -2321,11 +2321,11 @@ void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned s
unsigned h, unsigned dstx, unsigned dsty, unsigned field) { unsigned h, unsigned dstx, unsigned dsty, unsigned field) {
debug_break(); debug_break();
} }
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty) { unsigned dstx, unsigned dsty) {
debug_break(); debug_break();
} }
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty) { unsigned dstx, unsigned dsty) {
debug_break(); debug_break();
} }

View File

@ -52,7 +52,7 @@
// some inlines to prevent macro craziness when using incrementers and dereferencing, and so I can use operator // some inlines to prevent macro craziness when using incrementers and dereferencing, and so I can use operator
// overloading // overloading
inline unsigned short IntelSwapper(unsigned short a) { return INTEL_SHORT(a); } inline uint16_t IntelSwapper(uint16_t a) { return INTEL_SHORT(a); }
inline short IntelSwapper(short a) { return INTEL_SHORT(a); } inline short IntelSwapper(short a) { return INTEL_SHORT(a); }
@ -62,9 +62,9 @@ inline int IntelSwapper(int a) { return INTEL_INT(a); }
typedef struct _mve_hdr { typedef struct _mve_hdr {
char FileType[20]; // MVE_FILE_TYPE char FileType[20]; // MVE_FILE_TYPE
unsigned short HdrSize; // sizeof(mve_hdr) uint16_t HdrSize; // sizeof(mve_hdr)
unsigned short version; // MVE_FILE_VERSION uint16_t version; // MVE_FILE_VERSION
unsigned short id; // ~MVE_FILE_VERSION+0x1234 uint16_t id; // ~MVE_FILE_VERSION+0x1234
void SwapBytes() { void SwapBytes() {
HdrSize = IntelSwapper(HdrSize); HdrSize = IntelSwapper(HdrSize);
version = IntelSwapper(version); version = IntelSwapper(version);
@ -77,8 +77,8 @@ typedef struct _mve_hdr {
//------------------------------ //------------------------------
typedef struct _io_hdr { typedef struct _io_hdr {
unsigned short len; // Length of record data (pad to even) uint16_t len; // Length of record data (pad to even)
unsigned short kind; // See IO_REC_xxx uint16_t kind; // See IO_REC_xxx
// uint8_t data[0]; // Record data // uint8_t data[0]; // Record data
void SwapBytes() { void SwapBytes() {
len = IntelSwapper(len); len = IntelSwapper(len);
@ -104,7 +104,7 @@ typedef struct _io_hdr {
#define MCMD_DATA(arg) ((uint8_t *)((arg) + 1)) #define MCMD_DATA(arg) ((uint8_t *)((arg) + 1))
typedef struct _mcmd_hdr { typedef struct _mcmd_hdr {
unsigned short len; // Length of data (pad to even) uint16_t len; // Length of data (pad to even)
uint8_t major; // Major opcode uint8_t major; // Major opcode
uint8_t minor; // Minor opcode uint8_t minor; // Minor opcode
// uint8_t data[0]; // Opcode data // uint8_t data[0]; // Opcode data
@ -118,7 +118,7 @@ typedef struct _mcmd_hdr {
#define mcmd_syncInit 2 #define mcmd_syncInit 2
typedef struct _syncInit { typedef struct _syncInit {
uint32_t period; // period of quanta uint32_t period; // period of quanta
unsigned short wait_quanta; // # of quanta per frame uint16_t wait_quanta; // # of quanta per frame
void SwapBytes() { void SwapBytes() {
period = IntelSwapper(period); period = IntelSwapper(period);
wait_quanta = IntelSwapper(wait_quanta); wait_quanta = IntelSwapper(wait_quanta);
@ -127,7 +127,7 @@ typedef struct _syncInit {
#define mcmd_sndConfigure 3 #define mcmd_sndConfigure 3
typedef struct _sndConfigure { typedef struct _sndConfigure {
unsigned short rate; // 65536-(256E6/(frequency*(stereo+1))) uint16_t rate; // 65536-(256E6/(frequency*(stereo+1)))
// comp16 is a minor opcode 1 field // comp16 is a minor opcode 1 field
// It indicates that 16-bit data has been compressed to 8-bits. // It indicates that 16-bit data has been compressed to 8-bits.
// When it is set, bits16 will also be set. // When it is set, bits16 will also be set.
@ -143,7 +143,7 @@ typedef struct _sndConfigure {
uint8_t stereo : 1, bits16 : 1, comp16 : 1; uint8_t stereo : 1, bits16 : 1, comp16 : 1;
uint8_t pad; uint8_t pad;
#endif #endif
unsigned short frequency; uint16_t frequency;
// Minor opcode 1 extends buflen to be a long // Minor opcode 1 extends buflen to be a long
uint32_t buflen; uint32_t buflen;
void SwapBytes() { void SwapBytes() {
@ -157,12 +157,12 @@ typedef struct _sndConfigure {
#define mcmd_nfConfig 5 #define mcmd_nfConfig 5
typedef struct _nfConfig { typedef struct _nfConfig {
unsigned short wqty; uint16_t wqty;
unsigned short hqty; uint16_t hqty;
// Minor opcode 1 fields: // Minor opcode 1 fields:
unsigned short fqty; uint16_t fqty;
// Minor opcode 2 fields: // Minor opcode 2 fields:
unsigned short hicolor; /*0=256-color, 1=HiColor, 2=HiColorSwapped*/ uint16_t hicolor; /*0=256-color, 1=HiColor, 2=HiColorSwapped*/
void SwapBytes() { void SwapBytes() {
wqty = IntelSwapper(wqty); wqty = IntelSwapper(wqty);
hqty = IntelSwapper(hqty); hqty = IntelSwapper(hqty);
@ -175,19 +175,19 @@ typedef struct _nfConfig {
#define mcmd_nfDecompChg 16 #define mcmd_nfDecompChg 16
#define mcmd_nfPkDecomp 17 #define mcmd_nfPkDecomp 17
typedef struct _nfDecomp { typedef struct _nfDecomp {
unsigned short prev; // info:Prev frames+1 needed for full picture uint16_t prev; // info:Prev frames+1 needed for full picture
unsigned short iframe; // info:Current internal frame # uint16_t iframe; // info:Current internal frame #
unsigned short x; uint16_t x;
unsigned short y; uint16_t y;
unsigned short w; uint16_t w;
unsigned short h; uint16_t h;
#ifdef OUTRAGE_BIG_ENDIAN #ifdef OUTRAGE_BIG_ENDIAN
uint8_t bitpadder : 7; uint8_t bitpadder : 7;
uint8_t advance : 1; uint8_t advance : 1;
uint8_t dummy1; uint8_t dummy1;
#else #else
unsigned short advance : 1; uint16_t advance : 1;
unsigned short pad : 15; uint16_t pad : 15;
#endif #endif
void SwapBytes() { void SwapBytes() {
@ -205,10 +205,10 @@ typedef struct _nfDecomp {
#define mcmd_sfPkShowFrameChg 18 #define mcmd_sfPkShowFrameChg 18
#endif #endif
typedef struct _sfShowFrame { typedef struct _sfShowFrame {
unsigned short pal_start; uint16_t pal_start;
unsigned short pal_count; uint16_t pal_count;
// Minor opcode 1 fields: // Minor opcode 1 fields:
unsigned short field; // 0:none, 2:send to even, 3:send to odd uint16_t field; // 0:none, 2:send to even, 3:send to odd
void SwapBytes() { void SwapBytes() {
pal_start = IntelSwapper(pal_start); pal_start = IntelSwapper(pal_start);
pal_count = IntelSwapper(pal_count); pal_count = IntelSwapper(pal_count);
@ -219,9 +219,9 @@ typedef struct _sfShowFrame {
#define mcmd_sndAdd 8 #define mcmd_sndAdd 8
#define mcmd_sndSilence 9 #define mcmd_sndSilence 9
typedef struct _sndAdd { typedef struct _sndAdd {
unsigned short iframe; // info: iframe # of sound uint16_t iframe; // info: iframe # of sound
unsigned short TrackMask; uint16_t TrackMask;
unsigned short qty; // Uncompressed audio size in bytes uint16_t qty; // Uncompressed audio size in bytes
// uint8_t data[0]; // uint8_t data[0];
void SwapBytes() { void SwapBytes() {
iframe = IntelSwapper(iframe); iframe = IntelSwapper(iframe);
@ -232,9 +232,9 @@ typedef struct _sndAdd {
#define mcmd_gfxMode 10 #define mcmd_gfxMode 10
typedef struct _gfxMode { typedef struct _gfxMode {
unsigned short minw; uint16_t minw;
unsigned short minh; uint16_t minh;
unsigned short mode; uint16_t mode;
void SwapBytes() { void SwapBytes() {
minw = IntelSwapper(minw); minw = IntelSwapper(minw);
minh = IntelSwapper(minh); minh = IntelSwapper(minh);
@ -255,8 +255,8 @@ typedef struct _palMakeSynthPalette {
#define mcmd_palLoadPalette 12 #define mcmd_palLoadPalette 12
typedef struct _palLoadPalette { typedef struct _palLoadPalette {
unsigned short start; uint16_t start;
unsigned short count; uint16_t count;
// uint8_t data[0]; // uint8_t data[0];
void SwapBytes() { void SwapBytes() {
start = IntelSwapper(start); start = IntelSwapper(start);
@ -276,7 +276,7 @@ typedef struct _palLoadPalette {
#define mcmd_nfHPkInfo 20 #define mcmd_nfHPkInfo 20
typedef struct _nfPkInfo { typedef struct _nfPkInfo {
uint32_t error; // scaled by 10000 uint32_t error; // scaled by 10000
unsigned short usage[64]; uint16_t usage[64];
} marg_nfPkInfo; } marg_nfPkInfo;
#define mcmd_idcode 21 #define mcmd_idcode 21

View File

@ -55,8 +55,8 @@ extern unsigned sf_ScreenWidth;
#include "snd8to16.h" #include "snd8to16.h"
// len always specifies length of destination in bytes. // len always specifies length of destination in bytes.
unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned state); unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned state);
unsigned sndDecompS16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned state); unsigned sndDecompS16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned state);
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Memory Management // Memory Management
@ -477,14 +477,14 @@ static unsigned sndAddHelper(uint8_t *dst, const uint8_t **pSrc, unsigned len, u
if (snd_comp16) { if (snd_comp16) {
if (!snd_stereo) { if (!snd_stereo) {
if (init) { if (init) {
state = IntelSwapper(*(unsigned short *)src); state = IntelSwapper(*(uint16_t *)src);
*(unsigned short *)dst = state; *(uint16_t *)dst = state;
src += 2; src += 2;
dst += 2; dst += 2;
len -= 2; len -= 2;
} }
state = sndDecompM16((unsigned short *)dst, src, len >> 1, state); state = sndDecompM16((uint16_t *)dst, src, len >> 1, state);
src += len >> 1; src += len >> 1;
} else { } else {
@ -495,7 +495,7 @@ static unsigned sndAddHelper(uint8_t *dst, const uint8_t **pSrc, unsigned len, u
dst += 4; dst += 4;
len -= 4; len -= 4;
} }
state = sndDecompS16((unsigned short *)dst, src, len >> 2, state); state = sndDecompS16((uint16_t *)dst, src, len >> 2, state);
src += len >> 1; src += len >> 1;
} }
} else { } else {
@ -617,8 +617,8 @@ unsigned nf_new_w = 0;
unsigned nf_new_h = 0; unsigned nf_new_h = 0;
// Hicolor format translation tables // Hicolor format translation tables
unsigned short nf_trans16_lo[256]; uint16_t nf_trans16_lo[256];
unsigned short nf_trans16_hi[256]; uint16_t nf_trans16_hi[256];
void MVE_memVID(void *p1, void *p2, unsigned size) { void MVE_memVID(void *p1, void *p2, unsigned size) {
MemInit(&nf_mem_buf1, size, p1); MemInit(&nf_mem_buf1, size, p1);
@ -747,7 +747,7 @@ void nfHiColorDecomp(const uint8_t *comp, unsigned x, unsigned y, unsigned w, un
// Chgs specifies which squares to update. // Chgs specifies which squares to update.
// Parms are motion parms for squares to update. // Parms are motion parms for squares to update.
// //
void nfHiColorDecompChg(const unsigned short *chgs, const unsigned short *parms, const uint8_t *comp, unsigned x, void nfHiColorDecompChg(const uint16_t *chgs, const uint16_t *parms, const uint8_t *comp, unsigned x,
unsigned y, unsigned w, unsigned h); unsigned y, unsigned w, unsigned h);
// Non-HiColor versions // Non-HiColor versions
@ -767,7 +767,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
// Chgs specifies which squares to update. // Chgs specifies which squares to update.
// Parms are motion parms for squares to update. // Parms are motion parms for squares to update.
// //
void nfDecompChg(const unsigned short *chgs, const unsigned short *parms, const uint8_t *comp, unsigned x, void nfDecompChg(const uint16_t *chgs, const uint16_t *parms, const uint8_t *comp, unsigned x,
unsigned y, unsigned w, unsigned h); unsigned y, unsigned w, unsigned h);
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@ -963,13 +963,13 @@ void MVE_sfCallbacks(mve_cb_ShowFrame fn_ShowFrame) { sf_ShowFrame = fn_ShowFram
// on the screen is 2*h alternate lines. // on the screen is 2*h alternate lines.
// //
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
static void sfShowFrameChg(int dx, int dy, unsigned short *chgs) { logLabel("StartShowChg"); } static void sfShowFrameChg(int dx, int dy, uint16_t *chgs) { logLabel("StartShowChg"); }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Palette Management // Palette Management
@ -981,7 +981,7 @@ uint8_t pal_tbl[3 * 256]; // Private, see mveliba.asm
#if DBL_DBG #if DBL_DBG
uint8_t pal_tbl_old[3 * 256]; uint8_t pal_tbl_old[3 * 256];
#endif #endif
unsigned short pal15_tbl[256]; // Private, see mveliba.asm uint16_t pal15_tbl[256]; // Private, see mveliba.asm
void MVE_palCallbacks(void (*fn_SetPalette)(uint8_t *p, unsigned start, unsigned count)) { void MVE_palCallbacks(void (*fn_SetPalette)(uint8_t *p, unsigned start, unsigned count)) {
pal_SetPalette = fn_SetPalette; pal_SetPalette = fn_SetPalette;
@ -1151,8 +1151,8 @@ int MVE_rmStepMovie(void) {
} }
for (;; p = ioNextRecord(), len = 0) { for (;; p = ioNextRecord(), len = 0) {
unsigned short *DecompChg_chgs = (unsigned short *)NULL; uint16_t *DecompChg_chgs = (uint16_t *)NULL;
unsigned short *DecompChg_parms = (unsigned short *)NULL; uint16_t *DecompChg_parms = (uint16_t *)NULL;
if (!p) { if (!p) {
result = MVE_ERR_IO; result = MVE_ERR_IO;
@ -1351,11 +1351,11 @@ int MVE_rmStepMovie(void) {
} }
case mcmd_nfChanges: { case mcmd_nfChanges: {
DecompChg_chgs = (unsigned short *)p; DecompChg_chgs = (uint16_t *)p;
continue; continue;
} }
case mcmd_nfParms: { case mcmd_nfParms: {
DecompChg_parms = (unsigned short *)p; DecompChg_parms = (uint16_t *)p;
continue; continue;
} }
case mcmd_nfDecompChg: { case mcmd_nfDecompChg: {
@ -1631,7 +1631,7 @@ int MVE_frGet(MVE_frStream frs, uint8_t **pBuf, uint32_t *width, uint32_t *heigh
len = frs->len; len = frs->len;
for (;; p = ioNextRecord(), len = 0) { for (;; p = ioNextRecord(), len = 0) {
unsigned short *DecompChg_parms = (unsigned short *)NULL; uint16_t *DecompChg_parms = (uint16_t *)NULL;
if (!p) { if (!p) {
result = MVE_ERR_IO; result = MVE_ERR_IO;
@ -1696,7 +1696,7 @@ int MVE_frGet(MVE_frStream frs, uint8_t **pBuf, uint32_t *width, uint32_t *heigh
} }
case mcmd_nfParms: { case mcmd_nfParms: {
DecompChg_parms = (unsigned short *)p; DecompChg_parms = (uint16_t *)p;
continue; continue;
} }

View File

@ -163,7 +163,7 @@ bool oeLnxAppDatabase::read(const char *label, void *entry, int wordsize) {
*((uint8_t *)entry) = (uint8_t)data; *((uint8_t *)entry) = (uint8_t)data;
break; break;
case 2: case 2:
*((unsigned short *)entry) = (unsigned short)data; *((uint16_t *)entry) = (uint16_t)data;
break; break;
case 4: case 4:
*((uint32_t *)entry) = (uint32_t)data; *((uint32_t *)entry) = (uint32_t)data;

View File

@ -21,13 +21,13 @@
/* These are our global variables for passing values - AH */ /* These are our global variables for passing values - AH */
/* For _asm_sndDecompM16 */ /* For _asm_sndDecompM16 */
unsigned short *sndDecompM16_dst; uint16_t *sndDecompM16_dst;
uint8_t *sndDecompM16_src; uint8_t *sndDecompM16_src;
uint32_t sndDecompM16_len; uint32_t sndDecompM16_len;
uint32_t sndDecompM16_prev; uint32_t sndDecompM16_prev;
uint32_t sndDecompM16_return; uint32_t sndDecompM16_return;
/* For _asm_sndDecompM16 */ /* For _asm_sndDecompM16 */
unsigned short *sndDecompS16_dst; uint16_t *sndDecompS16_dst;
uint8_t *sndDecompS16_src; uint8_t *sndDecompS16_src;
uint32_t sndDecompS16_len; uint32_t sndDecompS16_len;
uint32_t sndDecompS16_prev; uint32_t sndDecompS16_prev;
@ -72,7 +72,7 @@ int allow_self_modification(void) {
} }
return (1); return (1);
} }
unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev) { unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev) {
sndDecompM16_dst = dst; sndDecompM16_dst = dst;
sndDecompM16_src = src; sndDecompM16_src = src;
sndDecompM16_len = len; sndDecompM16_len = len;
@ -81,7 +81,7 @@ unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, uns
return (sndDecompM16_return); return (sndDecompM16_return);
} }
unsigned sndDecompS16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev) { unsigned sndDecompS16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev) {
sndDecompS16_dst = dst; sndDecompS16_dst = dst;
sndDecompS16_src = src; sndDecompS16_src = src;
sndDecompS16_len = len; sndDecompS16_len = len;
@ -112,10 +112,10 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, uint32_t x, uint32_t y, uint32_t w
/***********************************************************/ /***********************************************************/
void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfHiColorDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, void nfHiColorDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y,
unsigned w, unsigned h); unsigned w, unsigned h);
void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w, void nfDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w,
unsigned h); unsigned h);
void nfPkPal(void); void nfPkPal(void);
void nfPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
@ -125,9 +125,9 @@ void mve_ShowFrameField(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx,
unsigned h, unsigned dstx, unsigned dsty, unsigned field); unsigned h, unsigned dstx, unsigned dsty, unsigned field);
void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w, void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w,
unsigned h, unsigned dstx, unsigned dsty, unsigned field); unsigned h, unsigned dstx, unsigned dsty, unsigned field);
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops, void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
@ -152,12 +152,12 @@ void MVE_gfxSetSplit(unsigned line);
#endif #endif
void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3 } void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3 }
void nfHiColorDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, void nfHiColorDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y,
unsigned w, unsigned h) { unsigned w, unsigned h) {
int3 int3
} }
void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3 } void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3 }
void nfDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w, void nfDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w,
unsigned h) { unsigned h) {
int3 int3
} }
@ -173,11 +173,11 @@ void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned s
unsigned h, unsigned dstx, unsigned dsty, unsigned field) { unsigned h, unsigned dstx, unsigned dsty, unsigned field) {
int3 int3
} }
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty) { unsigned dstx, unsigned dsty) {
int3 int3
} }
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty) { unsigned dstx, unsigned dsty) {
int3 int3
} }

View File

@ -713,7 +713,7 @@ static int GetXSharedMemory(int size) {
inline void BltBuffer32ToPixMap16(uint8_t *pixmap, uint8_t *buffer, int width, int height) { inline void BltBuffer32ToPixMap16(uint8_t *pixmap, uint8_t *buffer, int width, int height) {
uint8_t *data; uint8_t *data;
unsigned short int l; uint16_t int l;
int r, g, b, a; int r, g, b, a;
uint32_t c; uint32_t c;
@ -740,7 +740,7 @@ inline void BltBuffer16ToPixMap16(uint8_t *pixmap, uint8_t *buffer, int width, i
inline void BltBuffer32ToPixMap24(uint8_t *pixmap, uint8_t *buffer, int width, int height) { inline void BltBuffer32ToPixMap24(uint8_t *pixmap, uint8_t *buffer, int width, int height) {
uint8_t *data; uint8_t *data;
unsigned short int l; uint16_t int l;
int r, g, b, a; int r, g, b, a;
uint32_t c; uint32_t c;
@ -761,13 +761,13 @@ inline void BltBuffer32ToPixMap24(uint8_t *pixmap, uint8_t *buffer, int width, i
inline void BltBuffer16ToPixMap24(uint8_t *pixmap, uint8_t *buffer, int width, int height) { inline void BltBuffer16ToPixMap24(uint8_t *pixmap, uint8_t *buffer, int width, int height) {
uint8_t *data; uint8_t *data;
unsigned short int l; uint16_t int l;
int r, g, b, a; int r, g, b, a;
unsigned short c; uint16_t c;
data = (uint8_t *)pixmap; data = (uint8_t *)pixmap;
for (l = height * width; l > 0; l--) { for (l = height * width; l > 0; l--) {
c = *(unsigned short *)buffer; c = *(uint16_t *)buffer;
a = ((c & 0x8000) >> 15); a = ((c & 0x8000) >> 15);
r = ((c & 0x7C00) >> 10); r = ((c & 0x7C00) >> 10);
g = ((c & 0x03E0) >> 5); g = ((c & 0x03E0) >> 5);

View File

@ -50,13 +50,13 @@ typedef struct {
} LnxSoundDevice; } LnxSoundDevice;
typedef struct { typedef struct {
unsigned short wFormatTag; uint16_t wFormatTag;
unsigned short nChannels; uint16_t nChannels;
uint32_t nSamplesPerSec; uint32_t nSamplesPerSec;
uint32_t nAvgBytesPerSec; uint32_t nAvgBytesPerSec;
unsigned short nBlockAlign; uint16_t nBlockAlign;
unsigned short wBitsPerSample; uint16_t wBitsPerSample;
unsigned short cbSize; uint16_t cbSize;
} WAVEFORMATEX; // Taken from Windows for porting } WAVEFORMATEX; // Taken from Windows for porting
#define WAVE_FORMAT_PCM 0x01 #define WAVE_FORMAT_PCM 0x01
@ -89,7 +89,7 @@ typedef struct {
LnxBufferDesc lbdesc; LnxBufferDesc lbdesc;
unsigned short freq; uint16_t freq;
char playing; char playing;
char __pad; char __pad;
} LnxSoundBuffer; } LnxSoundBuffer;

View File

@ -41,8 +41,8 @@ extern unsigned nf_back_right; // (SHEIGHT-1)*width
extern signed short snd_8to16[256]; extern signed short snd_8to16[256];
void nfHPkDecomp(uint8_t *ops, uint8_t *comp, int x, int y, int w, int h); void nfHPkDecomp(uint8_t *ops, uint8_t *comp, int x, int y, int w, int h);
void nfPkConfig(void); void nfPkConfig(void);
unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev); unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev);
unsigned sndDecompS16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev); unsigned sndDecompS16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev);
void Trans16Blk(uint8_t *edi, uint8_t *idx); void Trans16Blk(uint8_t *edi, uint8_t *idx);
void call_hnfxycshift(uint32_t eax, uint8_t **medi, uint8_t **mesi, int nfpk_back_right); void call_hnfxycshift(uint32_t eax, uint8_t **medi, uint8_t **mesi, int nfpk_back_right);
@ -58,7 +58,7 @@ void call_hnfshift(uint32_t meax, uint8_t **medi, uint8_t **mesi, int nfpk_back_
// (src is len bytes, dst is len*2 bytes) // (src is len bytes, dst is len*2 bytes)
// prev is the previous decompression state or zero. // prev is the previous decompression state or zero.
// Returns new decompression state. // Returns new decompression state.
unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev) { unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev) {
uint32_t i, eax, ebx; uint32_t i, eax, ebx;
if (len == 0) if (len == 0)
return prev; return prev;
@ -83,7 +83,7 @@ unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, uns
// (It encodes the 16-bit states of the two stereo channels // (It encodes the 16-bit states of the two stereo channels
// in its low and high order 16-bit halves.) // in its low and high order 16-bit halves.)
// Returns new decompression state. // Returns new decompression state.
unsigned sndDecompS16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev) { unsigned sndDecompS16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev) {
unsigned re = 0; unsigned re = 0;
uint32_t eax, edx, ebx, i; uint32_t eax, edx, ebx, i;
@ -316,12 +316,12 @@ void nfPkConfig(void) {
} }
} }
extern unsigned short nf_trans16_lo[256]; extern uint16_t nf_trans16_lo[256];
extern unsigned short nf_trans16_hi[256]; extern uint16_t nf_trans16_hi[256];
// NOTE: EAX is destroyed after this call (actually the value of // NOTE: EAX is destroyed after this call (actually the value of
// nf_trans16_hi[idx+1] // nf_trans16_hi[idx+1]
void Trans16(unsigned short *dst, unsigned short *idx, bool mask) { void Trans16(uint16_t *dst, uint16_t *idx, bool mask) {
*dst = nf_trans16_lo[*idx]; *dst = nf_trans16_lo[*idx];
*dst |= nf_trans16_hi[*(idx + 1)]; *dst |= nf_trans16_hi[*(idx + 1)];
} }
@ -347,7 +347,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
esi = comp; esi = comp;
edi = nf.tbuf; edi = nf.tbuf;
unsigned short swapped = (*(unsigned short *)esi); uint16_t swapped = (*(uint16_t *)esi);
swapped = INTEL_SHORT(swapped); swapped = INTEL_SHORT(swapped);
bcomp = swapped + esi; bcomp = swapped + esi;
esi = esi + 2; esi = esi + 2;
@ -387,14 +387,14 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
// Near shift from newer part of current buffer // Near shift from newer part of current buffer
#ifdef OUTRAGE_BIG_ENDIAN #ifdef OUTRAGE_BIG_ENDIAN
typedef struct { typedef struct {
unsigned short hax, ax; uint16_t hax, ax;
} reg_word; } reg_word;
typedef struct { typedef struct {
int8_t hah, hal, ah, al; int8_t hah, hal, ah, al;
} reg_byte; } reg_byte;
#else #else
typedef struct { typedef struct {
unsigned short ax, hax; uint16_t ax, hax;
} reg_word; } reg_word;
typedef struct { typedef struct {
int8_t al, ah, hal, hah; int8_t al, ah, hal, hah;
@ -420,14 +420,14 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
// Near shift from previous buffer // Near shift from previous buffer
#ifdef OUTRAGE_BIG_ENDIAN #ifdef OUTRAGE_BIG_ENDIAN
typedef struct { typedef struct {
unsigned short hax, ax; uint16_t hax, ax;
} reg_word; } reg_word;
typedef struct { typedef struct {
int8_t hah, hal, ah, al; int8_t hah, hal, ah, al;
} reg_byte; } reg_byte;
#else #else
typedef struct { typedef struct {
unsigned short ax, hax; uint16_t ax, hax;
} reg_word; } reg_word;
typedef struct { typedef struct {
int8_t al, ah, hal, hah; int8_t al, ah, hal, hah;
@ -448,7 +448,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
} break; } break;
case 5: { case 5: {
unsigned short swapper = *(unsigned short *)(esi); uint16_t swapper = *(uint16_t *)(esi);
uint32_t eax = INTEL_SHORT(swapper); uint32_t eax = INTEL_SHORT(swapper);
esi += 2; esi += 2;
call_hnfxypshift(eax, &edi, &esi, nfpk_back_right, nf.DiffBufPtrs); call_hnfxypshift(eax, &edi, &esi, nfpk_back_right, nf.DiffBufPtrs);
@ -457,7 +457,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
// Far shift from current buffer // Far shift from current buffer
uint32_t val1, val2; uint32_t val1, val2;
unsigned short swapper = *(unsigned short *)(esi); uint16_t swapper = *(uint16_t *)(esi);
val1 = INTEL_SHORT(swapper); val1 = INTEL_SHORT(swapper);
esi += 2; esi += 2;
@ -478,10 +478,10 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
} break; } break;
case 7: { case 7: {
bool donf23 = false; bool donf23 = false;
unsigned short val; uint16_t val;
int rep_count, max_repcount; int rep_count, max_repcount;
val = *(unsigned short *)esi; val = *(uint16_t *)esi;
val = INTEL_SHORT(val); val = INTEL_SHORT(val);
if (val & 0x8000) { if (val & 0x8000) {
donf23 = true; donf23 = true;
@ -579,13 +579,13 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
case 8: { case 8: {
bool donf24 = false; bool donf24 = false;
bool donf40 = false; bool donf40 = false;
unsigned short val; uint16_t val;
int rep_count, max_repcount; int rep_count, max_repcount;
val = *(unsigned short *)esi; val = *(uint16_t *)esi;
val = INTEL_SHORT(val); val = INTEL_SHORT(val);
if (val & 0x8000) { if (val & 0x8000) {
val = *(unsigned short *)(esi + 8); val = *(uint16_t *)(esi + 8);
val = INTEL_SHORT(val); val = INTEL_SHORT(val);
if (val & 0x8000) { if (val & 0x8000) {
donf40 = true; donf40 = true;
@ -843,13 +843,13 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
bool donf41 = false; bool donf41 = false;
bool donf25 = false; bool donf25 = false;
bool donf57 = false; bool donf57 = false;
unsigned short val; uint16_t val;
int rep_count, max_repcount; int rep_count, max_repcount;
val = *(unsigned short *)esi; val = *(uint16_t *)esi;
val = INTEL_SHORT(val); val = INTEL_SHORT(val);
if (val & 0x8000) { if (val & 0x8000) {
val = *(unsigned short *)(esi + 4); val = *(uint16_t *)(esi + 4);
val = INTEL_SHORT(val); val = INTEL_SHORT(val);
if (val & 0x8000) { if (val & 0x8000) {
donf57 = true; donf57 = true;
@ -858,7 +858,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
} }
} else { } else {
val = *(unsigned short *)(esi + 4); val = *(uint16_t *)(esi + 4);
val = INTEL_SHORT(val); val = INTEL_SHORT(val);
if (val & 0x8000) { if (val & 0x8000) {
donf25 = true; donf25 = true;
@ -866,7 +866,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
} }
if (donf57) { if (donf57) {
unsigned short colors[4]; uint16_t colors[4];
max_repcount = 8; max_repcount = 8;
colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)]; colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)];
@ -992,7 +992,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
} }
if (!donf25 && !donf41 && !donf57) { if (!donf25 && !donf41 && !donf57) {
unsigned short colors[4]; uint16_t colors[4];
max_repcount = 16; max_repcount = 16;
colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)]; colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)];
@ -1033,14 +1033,14 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
// 2x2 4x4x2 (32 bytes) or 2x1 4x8x2 (24 bytes) or 1x2 4x8x2 (24 bytes) // 2x2 4x4x2 (32 bytes) or 2x1 4x8x2 (24 bytes) or 1x2 4x8x2 (24 bytes)
int val1; int val1;
int rep_count; int rep_count;
unsigned short colors[4]; uint16_t colors[4];
bool do26 = false; bool do26 = false;
bool do42 = false; bool do42 = false;
unsigned short swapper = *(unsigned short *)esi; uint16_t swapper = *(uint16_t *)esi;
val1 = INTEL_SHORT(swapper); val1 = INTEL_SHORT(swapper);
if (val1 & 0x8000) { if (val1 & 0x8000) {
swapper = *(unsigned short *)(esi + 16); swapper = *(uint16_t *)(esi + 16);
val1 = INTEL_SHORT(swapper); val1 = INTEL_SHORT(swapper);
if (val1 & 0x8000) { if (val1 & 0x8000) {
do42 = true; do42 = true;
@ -1463,14 +1463,14 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
} }
void Trans16Blk(uint8_t *edi, uint8_t *idx) { void Trans16Blk(uint8_t *edi, uint8_t *idx) {
*((unsigned short *)(edi + 0)) = nf_trans16_lo[*(idx + 0)] | nf_trans16_hi[*(idx + 1)]; *((uint16_t *)(edi + 0)) = nf_trans16_lo[*(idx + 0)] | nf_trans16_hi[*(idx + 1)];
*((unsigned short *)(edi + 2)) = nf_trans16_lo[*(idx + 2)] | nf_trans16_hi[*(idx + 3)]; *((uint16_t *)(edi + 2)) = nf_trans16_lo[*(idx + 2)] | nf_trans16_hi[*(idx + 3)];
*((unsigned short *)(edi + 4)) = nf_trans16_lo[*(idx + 4)] | nf_trans16_hi[*(idx + 5)]; *((uint16_t *)(edi + 4)) = nf_trans16_lo[*(idx + 4)] | nf_trans16_hi[*(idx + 5)];
*((unsigned short *)(edi + 6)) = nf_trans16_lo[*(idx + 6)] | nf_trans16_hi[*(idx + 7)]; *((uint16_t *)(edi + 6)) = nf_trans16_lo[*(idx + 6)] | nf_trans16_hi[*(idx + 7)];
*((unsigned short *)(edi + 8)) = nf_trans16_lo[*(idx + 8)] | nf_trans16_hi[*(idx + 9)]; *((uint16_t *)(edi + 8)) = nf_trans16_lo[*(idx + 8)] | nf_trans16_hi[*(idx + 9)];
*((unsigned short *)(edi + 10)) = nf_trans16_lo[*(idx + 10)] | nf_trans16_hi[*(idx + 11)]; *((uint16_t *)(edi + 10)) = nf_trans16_lo[*(idx + 10)] | nf_trans16_hi[*(idx + 11)];
*((unsigned short *)(edi + 12)) = nf_trans16_lo[*(idx + 12)] | nf_trans16_hi[*(idx + 13)]; *((uint16_t *)(edi + 12)) = nf_trans16_lo[*(idx + 12)] | nf_trans16_hi[*(idx + 13)];
*((unsigned short *)(edi + 14)) = nf_trans16_lo[*(idx + 14)] | nf_trans16_hi[*(idx + 15)]; *((uint16_t *)(edi + 14)) = nf_trans16_lo[*(idx + 14)] | nf_trans16_hi[*(idx + 15)];
} }
void call_hnfxycshift(uint32_t eax, uint8_t **medi, uint8_t **mesi, int nfpk_back_right) { void call_hnfxycshift(uint32_t eax, uint8_t **medi, uint8_t **mesi, int nfpk_back_right) {
@ -1542,10 +1542,10 @@ void call_hnfshift(uint32_t meax, uint8_t **medi, uint8_t **mesi, int nfpk_back_
// Non-Implemented Functions // Non-Implemented Functions
//////////////////////////////////////////////// ////////////////////////////////////////////////
void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfHiColorDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, void nfHiColorDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y,
unsigned w, unsigned h); unsigned w, unsigned h);
void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
void nfDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w, void nfDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w,
unsigned h); unsigned h);
void nfPkPal(void); void nfPkPal(void);
void nfPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h);
@ -1555,9 +1555,9 @@ void mve_ShowFrameField(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx,
unsigned h, unsigned dstx, unsigned dsty, unsigned field); unsigned h, unsigned dstx, unsigned dsty, unsigned field);
void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w, void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w,
unsigned h, unsigned dstx, unsigned dsty, unsigned field); unsigned h, unsigned dstx, unsigned dsty, unsigned field);
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops, void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
@ -1583,12 +1583,12 @@ void MVE_gfxSetSplit(unsigned line);
#endif #endif
void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3(); } void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3(); }
void nfHiColorDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, void nfHiColorDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y,
unsigned w, unsigned h) { unsigned w, unsigned h) {
int3(); int3();
} }
void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3(); } void nfDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h) { int3(); }
void nfDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w, void nfDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w,
unsigned h) { unsigned h) {
int3(); int3();
} }
@ -1604,11 +1604,11 @@ void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned s
unsigned h, unsigned dstx, unsigned dsty, unsigned field) { unsigned h, unsigned dstx, unsigned dsty, unsigned field) {
int3(); int3();
} }
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty) { unsigned dstx, unsigned dsty) {
int3(); int3();
} }
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty) { unsigned dstx, unsigned dsty) {
int3(); int3();
} }

View File

@ -71,9 +71,9 @@ typedef unsigned bool;
typedef struct _mve_hdr { typedef struct _mve_hdr {
char FileType[20]; // MVE_FILE_TYPE char FileType[20]; // MVE_FILE_TYPE
unsigned short HdrSize; // sizeof(mve_hdr) uint16_t HdrSize; // sizeof(mve_hdr)
unsigned short version; // MVE_FILE_VERSION uint16_t version; // MVE_FILE_VERSION
unsigned short id; // ~MVE_FILE_VERSION+0x1234 uint16_t id; // ~MVE_FILE_VERSION+0x1234
} mve_hdr; } mve_hdr;
//------------------------------ //------------------------------
@ -81,8 +81,8 @@ typedef struct _mve_hdr {
//------------------------------ //------------------------------
typedef struct _io_hdr { typedef struct _io_hdr {
unsigned short len; // Length of record data (pad to even) uint16_t len; // Length of record data (pad to even)
unsigned short kind; // See IO_REC_xxx uint16_t kind; // See IO_REC_xxx
// uint8_t data[0]; // Record data // uint8_t data[0]; // Record data
} ioHdrRec; } ioHdrRec;
@ -104,7 +104,7 @@ typedef struct _io_hdr {
#define MCMD_DATA(arg) ((uint8_t *)((arg) + 1)) #define MCMD_DATA(arg) ((uint8_t *)((arg) + 1))
typedef struct _mcmd_hdr { typedef struct _mcmd_hdr {
unsigned short len; // Length of data (pad to even) uint16_t len; // Length of data (pad to even)
uint8_t major; // Major opcode uint8_t major; // Major opcode
uint8_t minor; // Minor opcode uint8_t minor; // Minor opcode
// uint8_t data[0]; // Opcode data // uint8_t data[0]; // Opcode data
@ -117,12 +117,12 @@ typedef struct _mcmd_hdr {
#define mcmd_syncInit 2 #define mcmd_syncInit 2
typedef struct _syncInit { typedef struct _syncInit {
uint32_t period; // period of quanta uint32_t period; // period of quanta
unsigned short wait_quanta; // # of quanta per frame uint16_t wait_quanta; // # of quanta per frame
} marg_syncInit; } marg_syncInit;
#define mcmd_sndConfigure 3 #define mcmd_sndConfigure 3
typedef struct _sndConfigure { typedef struct _sndConfigure {
unsigned short rate; // 65536-(256E6/(frequency*(stereo+1))) uint16_t rate; // 65536-(256E6/(frequency*(stereo+1)))
// comp16 is a minor opcode 1 field // comp16 is a minor opcode 1 field
// It indicates that 16-bit data has been compressed to 8-bits. // It indicates that 16-bit data has been compressed to 8-bits.
// When it is set, bits16 will also be set. // When it is set, bits16 will also be set.
@ -130,13 +130,13 @@ typedef struct _sndConfigure {
// by remaining compressed 8-bit samples. // by remaining compressed 8-bit samples.
// For stereo, there will be two initial 16-bit samples. // For stereo, there will be two initial 16-bit samples.
// and compressed streams will be interleaved. // and compressed streams will be interleaved.
// unsigned short stereo:1, bits16:1, comp16:1; // uint16_t stereo:1, bits16:1, comp16:1;
#ifdef OUTRAGE_BIG_ENDIAN #ifdef OUTRAGE_BIG_ENDIAN
uint8_t bitpadder : 5; uint8_t bitpadder : 5;
#endif #endif
uint8_t stereo : 1, bits16 : 1, comp16 : 1; uint8_t stereo : 1, bits16 : 1, comp16 : 1;
uint8_t dummy1; uint8_t dummy1;
unsigned short frequency; uint16_t frequency;
// Minor opcode 1 extends buflen to be a long // Minor opcode 1 extends buflen to be a long
uint32_t buflen; uint32_t buflen;
} marg_sndConfigure; } marg_sndConfigure;
@ -145,25 +145,25 @@ typedef struct _sndConfigure {
#define mcmd_nfConfig 5 #define mcmd_nfConfig 5
typedef struct _nfConfig { typedef struct _nfConfig {
unsigned short wqty; uint16_t wqty;
unsigned short hqty; uint16_t hqty;
// Minor opcode 1 fields: // Minor opcode 1 fields:
unsigned short fqty; uint16_t fqty;
// Minor opcode 2 fields: // Minor opcode 2 fields:
unsigned short hicolor; /*0=256-color, 1=HiColor, 2=HiColorSwapped*/ uint16_t hicolor; /*0=256-color, 1=HiColor, 2=HiColorSwapped*/
} marg_nfConfig; } marg_nfConfig;
#define mcmd_nfDecomp 6 #define mcmd_nfDecomp 6
#define mcmd_nfDecompChg 16 #define mcmd_nfDecompChg 16
#define mcmd_nfPkDecomp 17 #define mcmd_nfPkDecomp 17
typedef struct _nfDecomp { typedef struct _nfDecomp {
unsigned short prev; // info:Prev frames+1 needed for full picture uint16_t prev; // info:Prev frames+1 needed for full picture
unsigned short iframe; // info:Current internal frame # uint16_t iframe; // info:Current internal frame #
unsigned short x; uint16_t x;
unsigned short y; uint16_t y;
unsigned short w; uint16_t w;
unsigned short h; uint16_t h;
// unsigned short advance:1; // uint16_t advance:1;
#ifdef OUTRAGE_BIG_ENDIAN #ifdef OUTRAGE_BIG_ENDIAN
uint8_t bitpadder : 7; uint8_t bitpadder : 7;
#endif #endif
@ -177,26 +177,26 @@ typedef struct _nfDecomp {
#define mcmd_sfPkShowFrameChg 18 #define mcmd_sfPkShowFrameChg 18
#endif #endif
typedef struct _sfShowFrame { typedef struct _sfShowFrame {
unsigned short pal_start; uint16_t pal_start;
unsigned short pal_count; uint16_t pal_count;
// Minor opcode 1 fields: // Minor opcode 1 fields:
unsigned short field; // 0:none, 2:send to even, 3:send to odd uint16_t field; // 0:none, 2:send to even, 3:send to odd
} marg_sfShowFrame; } marg_sfShowFrame;
#define mcmd_sndAdd 8 #define mcmd_sndAdd 8
#define mcmd_sndSilence 9 #define mcmd_sndSilence 9
typedef struct _sndAdd { typedef struct _sndAdd {
unsigned short iframe; // info: iframe # of sound uint16_t iframe; // info: iframe # of sound
unsigned short TrackMask; uint16_t TrackMask;
unsigned short qty; // Uncompressed audio size in bytes uint16_t qty; // Uncompressed audio size in bytes
// uint8_t data[0]; // uint8_t data[0];
} marg_sndAdd; } marg_sndAdd;
#define mcmd_gfxMode 10 #define mcmd_gfxMode 10
typedef struct _gfxMode { typedef struct _gfxMode {
unsigned short minw; uint16_t minw;
unsigned short minh; uint16_t minh;
unsigned short mode; uint16_t mode;
} marg_gfxMode; } marg_gfxMode;
#define mcmd_palMakeSynthPalette 11 #define mcmd_palMakeSynthPalette 11
@ -211,8 +211,8 @@ typedef struct _palMakeSynthPalette {
#define mcmd_palLoadPalette 12 #define mcmd_palLoadPalette 12
typedef struct _palLoadPalette { typedef struct _palLoadPalette {
unsigned short start; uint16_t start;
unsigned short count; uint16_t count;
// uint8_t data[0]; // uint8_t data[0];
} marg_palLoadPalette; } marg_palLoadPalette;
@ -228,7 +228,7 @@ typedef struct _palLoadPalette {
#define mcmd_nfHPkInfo 20 #define mcmd_nfHPkInfo 20
typedef struct _nfPkInfo { typedef struct _nfPkInfo {
uint32_t error; // scaled by 10000 uint32_t error; // scaled by 10000
unsigned short usage[64]; uint16_t usage[64];
} marg_nfPkInfo; } marg_nfPkInfo;
#define mcmd_idcode 21 #define mcmd_idcode 21

View File

@ -51,8 +51,8 @@ unsigned opt_hscale_adj;
#include "snd8to16.h" #include "snd8to16.h"
// len always specifies length of destination in bytes. // len always specifies length of destination in bytes.
unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned state); unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned state);
unsigned sndDecompS16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned state); unsigned sndDecompS16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned state);
static LnxWindow *mve_lpWin = NULL; static LnxWindow *mve_lpWin = NULL;
@ -483,15 +483,15 @@ static unsigned sndAddHelper(uint8_t *dst, uint8_t **pSrc, unsigned len, unsigne
else if (snd_comp16) else if (snd_comp16)
if (!snd_stereo) { if (!snd_stereo) {
if (init) { if (init) {
unsigned short swapper = *(unsigned short *)src; uint16_t swapper = *(uint16_t *)src;
state = INTEL_SHORT(swapper); state = INTEL_SHORT(swapper);
*(unsigned short *)dst = state; *(uint16_t *)dst = state;
src += 2; src += 2;
dst += 2; dst += 2;
len -= 2; len -= 2;
} }
state = sndDecompM16((unsigned short *)dst, src, len >> 1, state); state = sndDecompM16((uint16_t *)dst, src, len >> 1, state);
src += len >> 1; src += len >> 1;
} else { } else {
@ -503,7 +503,7 @@ static unsigned sndAddHelper(uint8_t *dst, uint8_t **pSrc, unsigned len, unsigne
dst += 4; dst += 4;
len -= 4; len -= 4;
} }
state = sndDecompS16((unsigned short *)dst, src, len >> 2, state); state = sndDecompS16((uint16_t *)dst, src, len >> 2, state);
src += len >> 1; src += len >> 1;
} }
else { else {
@ -621,8 +621,8 @@ unsigned nf_new_w;
unsigned nf_new_h; unsigned nf_new_h;
// Hicolor format translation tables // Hicolor format translation tables
unsigned short nf_trans16_lo[256]; uint16_t nf_trans16_lo[256];
unsigned short nf_trans16_hi[256]; uint16_t nf_trans16_hi[256];
void MVE_memVID(void *p1, void *p2, unsigned size) { void MVE_memVID(void *p1, void *p2, unsigned size) {
MemInit(&nf_mem_buf1, size, p1); MemInit(&nf_mem_buf1, size, p1);
@ -792,7 +792,7 @@ void nfHiColorDecomp(uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned
// Chgs specifies which squares to update. // Chgs specifies which squares to update.
// Parms are motion parms for squares to update. // Parms are motion parms for squares to update.
// //
void nfHiColorDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, void nfHiColorDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y,
unsigned w, unsigned h); unsigned w, unsigned h);
// Non-HiColor versions // Non-HiColor versions
@ -812,7 +812,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w
// Chgs specifies which squares to update. // Chgs specifies which squares to update.
// Parms are motion parms for squares to update. // Parms are motion parms for squares to update.
// //
void nfDecompChg(unsigned short *chgs, unsigned short *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w, void nfDecompChg(uint16_t *chgs, uint16_t *parms, uint8_t *comp, unsigned x, unsigned y, unsigned w,
unsigned h); unsigned h);
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@ -1000,13 +1000,13 @@ void MVE_sfCallbacks(void (*fn_ShowFrame)(uint8_t *buf, unsigned bufw, unsigned
// on the screen is 2*h alternate lines. // on the screen is 2*h alternate lines.
// //
void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfHiColorShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, unsigned short *chgs, void mve_sfShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint16_t *chgs,
unsigned dstx, unsigned dsty); unsigned dstx, unsigned dsty);
static void sfShowFrameChg(int dx, int dy, unsigned short *chgs) { logLabel("StartShowChg"); } static void sfShowFrameChg(int dx, int dy, uint16_t *chgs) { logLabel("StartShowChg"); }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Palette Management // Palette Management
@ -1023,7 +1023,7 @@ uint8_t pal_tbl[3 * 256]; // Private, see mveliba.asm
#if DBL_DBG #if DBL_DBG
uint8_t pal_tbl_old[3 * 256]; uint8_t pal_tbl_old[3 * 256];
#endif #endif
unsigned short pal15_tbl[256]; // Private, see mveliba.asm uint16_t pal15_tbl[256]; // Private, see mveliba.asm
void MVE_palCallbacks(void (*fn_SetPalette)(uint8_t *p, unsigned start, unsigned count)) { void MVE_palCallbacks(void (*fn_SetPalette)(uint8_t *p, unsigned start, unsigned count)) {
pal_SetPalette = fn_SetPalette; pal_SetPalette = fn_SetPalette;
@ -1190,8 +1190,8 @@ int MVE_rmStepMovie(void) {
} }
for (;; p = ioNextRecord(), len = 0) { for (;; p = ioNextRecord(), len = 0) {
unsigned short *DecompChg_chgs = (unsigned short *)NULL; uint16_t *DecompChg_chgs = (uint16_t *)NULL;
unsigned short *DecompChg_parms = (unsigned short *)NULL; uint16_t *DecompChg_parms = (uint16_t *)NULL;
if (!p) { if (!p) {
result = MVE_ERR_IO; result = MVE_ERR_IO;
@ -1388,11 +1388,11 @@ int MVE_rmStepMovie(void) {
} }
case mcmd_nfChanges: { case mcmd_nfChanges: {
DecompChg_chgs = (unsigned short *)p; DecompChg_chgs = (uint16_t *)p;
continue; continue;
} }
case mcmd_nfParms: { case mcmd_nfParms: {
DecompChg_parms = (unsigned short *)p; DecompChg_parms = (uint16_t *)p;
continue; continue;
} }
case mcmd_nfDecompChg: { case mcmd_nfDecompChg: {
@ -1709,7 +1709,7 @@ int MVE_frGet(MVE_frStream frs, uint8_t **pBuf, unsigned *width, unsigned *heigh
len = frs->len; len = frs->len;
for (;; p = ioNextRecord(), len = 0) { for (;; p = ioNextRecord(), len = 0) {
unsigned short *DecompChg_parms = (unsigned short *)NULL; uint16_t *DecompChg_parms = (uint16_t *)NULL;
if (!p) { if (!p) {
result = MVE_ERR_IO; result = MVE_ERR_IO;
@ -1777,7 +1777,7 @@ int MVE_frGet(MVE_frStream frs, uint8_t **pBuf, unsigned *width, unsigned *heigh
} }
case mcmd_nfParms: { case mcmd_nfParms: {
DecompChg_parms = (unsigned short *)p; DecompChg_parms = (uint16_t *)p;
continue; continue;
} }

View File

@ -240,7 +240,7 @@ int Mem_high_water_mark = 0;
typedef struct mem_alloc_info { typedef struct mem_alloc_info {
int len; int len;
void *ptr; void *ptr;
unsigned short line; uint16_t line;
char file[17]; char file[17];
} mem_alloc_info; } mem_alloc_info;
@ -516,7 +516,7 @@ void *mem_malloc_sub(int size, const char *file, int line) {
#else #else
mi->ptr = HeapAlloc(Heap, HEAP_NO_SERIALIZE, size + 2); mi->ptr = HeapAlloc(Heap, HEAP_NO_SERIALIZE, size + 2);
mi->len = size; mi->len = size;
unsigned short mem_sig = MEM_GAURDIAN_SIG; uint16_t mem_sig = MEM_GAURDIAN_SIG;
memcpy(((char *)mi->ptr) + size, (void *)&mem_sig, 2); memcpy(((char *)mi->ptr) + size, (void *)&mem_sig, 2);
int flen = strlen(file); int flen = strlen(file);
int lofs = 0; int lofs = 0;
@ -582,7 +582,7 @@ void mem_free_sub(void *memblock) {
if (mynode) { if (mynode) {
freemem = mynode->data; freemem = mynode->data;
freemem->ptr = (void *)MEM_NO_MEMORY_PTR; freemem->ptr = (void *)MEM_NO_MEMORY_PTR;
unsigned short mem_sig = MEM_GAURDIAN_SIG; uint16_t mem_sig = MEM_GAURDIAN_SIG;
if (memcmp((char *)memblock + freemem->len, &mem_sig, 2) != 0) { if (memcmp((char *)memblock + freemem->len, &mem_sig, 2) != 0) {
// Corrupted memory found when we went to free it. // Corrupted memory found when we went to free it.
mprintf((0, "Memory block found to be damaged when it was freed!\n")); mprintf((0, "Memory block found to be damaged when it was freed!\n"));
@ -649,7 +649,7 @@ void *mem_realloc_sub(void *memblock, int size) {
deleteNode(&mem_info[i]); deleteNode(&mem_info[i]);
mem_info[i].ptr = HeapReAlloc(Heap, 0, memblock, size + 2); mem_info[i].ptr = HeapReAlloc(Heap, 0, memblock, size + 2);
unsigned short mem_sig = MEM_GAURDIAN_SIG; uint16_t mem_sig = MEM_GAURDIAN_SIG;
memcpy(((char *)mem_info[i].ptr) + size, (void *)&mem_sig, 2); memcpy(((char *)mem_info[i].ptr) + size, (void *)&mem_sig, 2);
mem_info[i].len = size; mem_info[i].len = size;
Total_mem_used += size; Total_mem_used += size;
@ -851,7 +851,7 @@ void mem_heapcheck(void) {
if (mem_info[i].ptr == (void *)MEM_NO_MEMORY_PTR) if (mem_info[i].ptr == (void *)MEM_NO_MEMORY_PTR)
continue; continue;
freemem = &mem_info[i]; freemem = &mem_info[i];
unsigned short mem_sig = MEM_GAURDIAN_SIG; uint16_t mem_sig = MEM_GAURDIAN_SIG;
if (memcmp((char *)freemem->ptr + freemem->len, &mem_sig, 2) != 0) { if (memcmp((char *)freemem->ptr + freemem->len, &mem_sig, 2) != 0) {
mprintf((0, "Memory block found to be damaged in mem_heapcheck()!\n")); mprintf((0, "Memory block found to be damaged in mem_heapcheck()!\n"));
mprintf((0, "Originally allocated from file %s, line %d\n", freemem->file, freemem->line)); mprintf((0, "Originally allocated from file %s, line %d\n", freemem->file, freemem->line));

View File

@ -654,13 +654,13 @@ void BlitToMovieBitmap(uint8_t *buf, uint32_t bufw, uint32_t bufh, uint32_t hico
Movie_bm_handle = bm_AllocBitmap(texW, texH, 0); Movie_bm_handle = bm_AllocBitmap(texW, texH, 0);
} }
unsigned short *pPixelData = (ushort *)bm_data(Movie_bm_handle, 0); uint16_t *pPixelData = (ushort *)bm_data(Movie_bm_handle, 0);
GameBitmaps[Movie_bm_handle].flags |= BF_CHANGED; GameBitmaps[Movie_bm_handle].flags |= BF_CHANGED;
if (hicolor) { if (hicolor) {
unsigned short *wBuf = (unsigned short *)buf; uint16_t *wBuf = (uint16_t *)buf;
for (int y = 0; y < drawHeight; ++y) { for (int y = 0; y < drawHeight; ++y) {
for (int x = 0; x < drawWidth; ++x) { for (int x = 0; x < drawWidth; ++x) {
unsigned short col16 = *wBuf++; uint16_t col16 = *wBuf++;
uint32_t b = ((col16 >> 11) & 0x1F) << 3; uint32_t b = ((col16 >> 11) & 0x1F) << 3;
uint32_t g = ((col16 >> 5) & 0x3F) << 2; uint32_t g = ((col16 >> 5) & 0x3F) << 2;
uint32_t r = ((col16 >> 0) & 0x1F) << 3; uint32_t r = ((col16 >> 0) & 0x1F) << 3;

View File

@ -84,7 +84,7 @@
class ChttpGet { class ChttpGet {
public: public:
ChttpGet(char *URL, char *localfile); ChttpGet(char *URL, char *localfile);
ChttpGet(char *URL, char *localfile, char *proxyip, unsigned short proxyport); ChttpGet(char *URL, char *localfile, char *proxyip, uint16_t proxyport);
void PrepSocket(char *URL); void PrepSocket(char *URL);
~ChttpGet(); ~ChttpGet();
void GetFile(char *URL, char *localfile); void GetFile(char *URL, char *localfile);
@ -105,7 +105,7 @@ protected:
bool m_ProxyEnabled; bool m_ProxyEnabled;
char *m_ProxyIP; char *m_ProxyIP;
char m_URL[MAX_URL_LEN]; char m_URL[MAX_URL_LEN];
unsigned short m_ProxyPort; uint16_t m_ProxyPort;
char m_szUserName[100]; char m_szUserName[100];
char m_szPassword[100]; char m_szPassword[100];

View File

@ -789,7 +789,7 @@ bool *DLLUse_DirectPlay;
bool *DLLMulti_Gamelist_changed; bool *DLLMulti_Gamelist_changed;
bool *DLLSupports_score_api; bool *DLLSupports_score_api;
// bool * DLLMulti_no_stats_saved; // bool * DLLMulti_no_stats_saved;
unsigned short DLLnw_ListenPort; uint16_t DLLnw_ListenPort;
char szloginid[LOGIN_LEN] = ""; char szloginid[LOGIN_LEN] = "";
char sztrackerid[TRACKER_ID_LEN] = ""; char sztrackerid[TRACKER_ID_LEN] = "";

View File

@ -309,7 +309,7 @@ DLLUse_DirectPlay = (bool *)API.vp[22];
DLLDedicated_server = (bool *)API.vp[25]; DLLDedicated_server = (bool *)API.vp[25];
DLLTCP_active = (BOOL)*API.vp[26]; DLLTCP_active = (BOOL)*API.vp[26];
DLLIPX_active = (BOOL)*API.vp[27]; DLLIPX_active = (BOOL)*API.vp[27];
DLLnw_ListenPort = (unsigned short)((size_t)API.vp[28] & 0xffff); DLLnw_ListenPort = (uint16_t)((size_t)API.vp[28] & 0xffff);
DLLMulti_Gamelist_changed = (bool *)API.vp[29]; DLLMulti_Gamelist_changed = (bool *)API.vp[29];
DLLPXO_hosted_lobby_name = (char *)API.vp[30]; DLLPXO_hosted_lobby_name = (char *)API.vp[30];
DLLSupports_score_api = (bool *)API.vp[31]; DLLSupports_score_api = (bool *)API.vp[31];

View File

@ -389,7 +389,7 @@ uint32_t CFtpGet::IssuePort() {
uint8_t s_b1, s_b2, s_b3, s_b4; uint8_t s_b1, s_b2, s_b3, s_b4;
} S_un_b; } S_un_b;
struct { struct {
unsigned short s_w1, s_w2; uint16_t s_w1, s_w2;
} S_un_w; } S_un_w;
uint32_t S_addr; uint32_t S_addr;
} S_un; } S_un;

View File

@ -191,7 +191,7 @@ void ChttpGet::AbortGet() {
#endif #endif
} }
ChttpGet::ChttpGet(char *URL, char *localfile, char *proxyip, unsigned short proxyport) { ChttpGet::ChttpGet(char *URL, char *localfile, char *proxyip, uint16_t proxyport) {
m_ProxyEnabled = true; m_ProxyEnabled = true;
m_ProxyIP = proxyip; m_ProxyIP = proxyip;
m_ProxyPort = proxyport; m_ProxyPort = proxyport;

View File

@ -617,7 +617,7 @@ int MainMultiplayerMenu() {
break; break;
case 9: { case 9: {
// Scan a specific IP // Scan a specific IP
unsigned short iport = DEFAULT_GAME_PORT; uint16_t iport = DEFAULT_GAME_PORT;
looklocal = 0; looklocal = 0;
uint32_t iaddr; uint32_t iaddr;
lastgamesfound = 0; lastgamesfound = 0;
@ -692,7 +692,7 @@ int MainMultiplayerMenu() {
// MTS: only used in this file // MTS: only used in this file
void AutoLoginAndJoinGame(void) { void AutoLoginAndJoinGame(void) {
unsigned short port; uint16_t port;
uint32_t iaddr; uint32_t iaddr;
*DLLMultiGameStarting = 0; *DLLMultiGameStarting = 0;

View File

@ -264,7 +264,7 @@ void IceKey::decrypt(const ubyte *ctext, ubyte *ptext) const {
// //
// Set 8 rounds [n, n+7] of the key schedule of an ICE key. // Set 8 rounds [n, n+7] of the key schedule of an ICE key.
// //
void IceKey::scheduleBuild(unsigned short *kb, int n, const int *keyrot) { void IceKey::scheduleBuild(uint16_t *kb, int n, const int *keyrot) {
int i; int i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {

View File

@ -502,9 +502,9 @@ typedef struct {
int waiting_packet_number; // Which packet has data in it that is waiting for the interval to send int waiting_packet_number; // Which packet has data in it that is waiting for the interval to send
ushort status; // Status of this connection ushort status; // Status of this connection
unsigned short oursequence; // This is the next sequence number the application is expecting uint16_t oursequence; // This is the next sequence number the application is expecting
unsigned short theirsequence; // This is the next sequence number the peer is expecting uint16_t theirsequence; // This is the next sequence number the peer is expecting
unsigned short rsequence[MAXNETBUFFERS]; // This is the sequence number of the given packet uint16_t rsequence[MAXNETBUFFERS]; // This is the sequence number of the given packet
ubyte ping_pos; ubyte ping_pos;
@ -513,7 +513,7 @@ typedef struct {
reliable_net_rcvbuffer *rbuffers[MAXNETBUFFERS]; reliable_net_rcvbuffer *rbuffers[MAXNETBUFFERS];
SOCKADDR addr; // SOCKADDR of our peer SOCKADDR addr; // SOCKADDR of our peer
reliable_net_sendbuffer *sbuffers[MAXNETBUFFERS]; // This is an array of pointers for quick sorting reliable_net_sendbuffer *sbuffers[MAXNETBUFFERS]; // This is an array of pointers for quick sorting
unsigned short ssequence[MAXNETBUFFERS]; // This is the sequence number of the given packet uint16_t ssequence[MAXNETBUFFERS]; // This is the sequence number of the given packet
ubyte send_urgent; ubyte send_urgent;
} reliable_socket; } reliable_socket;
@ -728,7 +728,7 @@ void nw_SetSocketOptions(SOCKET sock) {
*/ */
} }
unsigned short nw_ListenPort = 0; uint16_t nw_ListenPort = 0;
// Inits the sockets that the application will be using // Inits the sockets that the application will be using
void nw_InitSockets(ushort port) { void nw_InitSockets(ushort port) {
@ -905,7 +905,7 @@ ushort nw_CalculateChecksum(void *vptr, int len) {
} }
sum2 %= 255; sum2 %= 255;
return (unsigned short)((sum1 << 8) + sum2); return (uint16_t)((sum1 << 8) + sum2);
} }
// Sends data on an unreliable socket // Sends data on an unreliable socket
@ -1477,7 +1477,7 @@ void nw_WorkReliable(ubyte *data, int len, network_address *naddr) {
} else { } else {
// Sequence is high, so prepare for wrap around // Sequence is high, so prepare for wrap around
if (((unsigned short)(INTEL_SHORT(rcv_buff.seq) + rsocket->oursequence)) > (MAXNETBUFFERS - 1)) { if (((uint16_t)(INTEL_SHORT(rcv_buff.seq) + rsocket->oursequence)) > (MAXNETBUFFERS - 1)) {
mprintf((0, "Received old packet with seq of %d\n", INTEL_SHORT(rcv_buff.seq))); mprintf((0, "Received old packet with seq of %d\n", INTEL_SHORT(rcv_buff.seq)));
savepacket = 0; savepacket = 0;
} }

View File

@ -477,8 +477,8 @@ typedef struct humonculous_data {
float last_shields; float last_shields;
unsigned short mode; uint16_t mode;
unsigned short next_mode; uint16_t next_mode;
vector land_pos; vector land_pos;
vector land_fvec; vector land_fvec;
@ -503,7 +503,7 @@ private:
humonculous_data *memory; humonculous_data *memory;
void DetermineDeathPos(int me, vector *dpos, int *droom); void DetermineDeathPos(int me, vector *dpos, int *droom);
bool SetMode(int me, unsigned short mode); bool SetMode(int me, uint16_t mode);
void DoInit(int me); void DoInit(int me);
void DoInterval(int me); void DoInterval(int me);
bool DoNotify(int me, tOSIRISEventInfo *data); bool DoNotify(int me, tOSIRISEventInfo *data);
@ -731,7 +731,7 @@ private:
void DoInit(int me); void DoInit(int me);
void RemapAlert(int me, float start, float end, float time); void RemapAlert(int me, float start, float end, float time);
void RemapWB(int me, float start, float fire, int fire_sound, float end, float time, float latency, int index, void RemapWB(int me, float start, float fire, int fire_sound, float end, float time, float latency, int index,
unsigned short w_id, char f_mask); uint16_t w_id, char f_mask);
void DoFrame(int me); void DoFrame(int me);
bool DoNotify(int me_handle, tOSIRISEventInfo *data); bool DoNotify(int me_handle, tOSIRISEventInfo *data);
void SetMode(int me, char mode); void SetMode(int me, char mode);
@ -782,7 +782,7 @@ typedef struct {
int flags; int flags;
unsigned short mantaray_id; uint16_t mantaray_id;
int leader_handle; int leader_handle;
int num_teammates; int num_teammates;
@ -829,7 +829,7 @@ typedef struct {
int flags; int flags;
unsigned short skiff_id; uint16_t skiff_id;
int leader_handle; int leader_handle;
int num_teammates; int num_teammates;
@ -885,7 +885,7 @@ typedef struct {
bool f_hit_by_emd; bool f_hit_by_emd;
float mode_time; float mode_time;
char last_attack_mode; char last_attack_mode;
unsigned short emd_id; uint16_t emd_id;
int tick_sound; int tick_sound;
float last_tick_time; float last_tick_time;
@ -1515,7 +1515,7 @@ typedef struct {
float mode_time; float mode_time;
unsigned short mp_slot; // Owner's slot number uint16_t mp_slot; // Owner's slot number
int my_player; // Owner's object reference int my_player; // Owner's object reference
bool f_parented; // Buddy will not collide with parent until it isn't parented bool f_parented; // Buddy will not collide with parent until it isn't parented
@ -1566,7 +1566,7 @@ typedef struct {
int amb_camera_handle; int amb_camera_handle;
float next_powerup_check_time; float next_powerup_check_time;
unsigned short powerup_ids[6]; uint16_t powerup_ids[6];
} guidebot_data; } guidebot_data;
class GuideBot : public BaseObjScript { class GuideBot : public BaseObjScript {
@ -1668,7 +1668,7 @@ static tThiefItems ThiefableItems[] = {
static int numThiefableItems = sizeof(ThiefableItems) / sizeof(tThiefItems); static int numThiefableItems = sizeof(ThiefableItems) / sizeof(tThiefItems);
typedef struct { typedef struct {
unsigned short id; uint16_t id;
int owner; int owner;
} inv_item; // not really inventory items, but items such as quads, automap, headlight, etc (non-weapons) } inv_item; // not really inventory items, but items such as quads, automap, headlight, etc (non-weapons)
@ -1815,7 +1815,7 @@ void SuperThief::SpewEverything(int me) {
Obj_Value(me, VF_GET, OBJV_V_POS, &pos); Obj_Value(me, VF_GET, OBJV_V_POS, &pos);
for (i = 0; i < memory->num_stolen_weapons; i++) { for (i = 0; i < memory->num_stolen_weapons; i++) {
unsigned short id; uint16_t id;
int j; int j;
for (j = 0; j < memory->stolen_weapons[i].amount; j++) { for (j = 0; j < memory->stolen_weapons[i].amount; j++) {
@ -1981,7 +1981,7 @@ bool SuperThief::DoSteal(int me, int it) {
if (SuperThiefableItems[i].type == THIEFABLEITEM_PRIMARY) { if (SuperThiefableItems[i].type == THIEFABLEITEM_PRIMARY) {
amount = 0; amount = 0;
if (SuperThiefableItems[i].autoselect > memory->cur_weapon) { if (SuperThiefableItems[i].autoselect > memory->cur_weapon) {
unsigned short wpn = Wpn_FindID(SuperThiefableItems[i].weapon_name); uint16_t wpn = Wpn_FindID(SuperThiefableItems[i].weapon_name);
int snd = Sound_FindId(SuperThiefableItems[i].fire_sound); int snd = Sound_FindId(SuperThiefableItems[i].fire_sound);
Obj_WBValue(me, 1, VF_SET, WBSV_I_FIRE_SOUND, &snd, 0); Obj_WBValue(me, 1, VF_SET, WBSV_I_FIRE_SOUND, &snd, 0);
@ -2035,7 +2035,7 @@ void SuperThief::DoInit(int me) {
memory->laser_obj = CreateAndAttach(me, "STEmitter", OBJ_ROBOT, 2, 0, true, true); memory->laser_obj = CreateAndAttach(me, "STEmitter", OBJ_ROBOT, 2, 0, true, true);
unsigned short wpn = Wpn_FindID("Laser Level 1 - Red"); uint16_t wpn = Wpn_FindID("Laser Level 1 - Red");
int snd = Sound_FindId("Laser level 1"); int snd = Sound_FindId("Laser level 1");
strcpy(memory->weapon, "Laser Level 1 - Red"); strcpy(memory->weapon, "Laser Level 1 - Red");
@ -2277,7 +2277,7 @@ short SuperThief::CallEvent(int event, tOSIRISEventInfo *data) {
case EVT_MEMRESTORE: { case EVT_MEMRESTORE: {
memory = (superthief_data *)data->evt_memrestore.memory_ptr; memory = (superthief_data *)data->evt_memrestore.memory_ptr;
unsigned short wpn = Wpn_FindID(memory->weapon); uint16_t wpn = Wpn_FindID(memory->weapon);
int snd = Sound_FindId(memory->sound); int snd = Sound_FindId(memory->sound);
Obj_WBValue(data->me_handle, 1, VF_SET, WBSV_I_FIRE_SOUND, &snd, 0); Obj_WBValue(data->me_handle, 1, VF_SET, WBSV_I_FIRE_SOUND, &snd, 0);
@ -3209,7 +3209,7 @@ bool Humonculous::DoNotify(int me, tOSIRISEventInfo *data) {
return true; return true;
} }
bool Humonculous::SetMode(int me, unsigned short mode) { bool Humonculous::SetMode(int me, uint16_t mode) {
int new_mode_index = -1; int new_mode_index = -1;
int old_mode_index = -1; int old_mode_index = -1;
@ -5612,7 +5612,7 @@ void GuideBot::DoCollide(int me, tOSIRISEVTCOLLIDE *evt_collide) {
// Add a buddy bot to you inventory :) // Add a buddy bot to you inventory :)
if (memory->f_pickup == true) { if (memory->f_pickup == true) {
if (it_type == OBJ_PLAYER) { if (it_type == OBJ_PLAYER) {
unsigned short id; uint16_t id;
Obj_Value(evt_collide->it_handle, VF_GET, OBJV_US_ID, &id); Obj_Value(evt_collide->it_handle, VF_GET, OBJV_US_ID, &id);
if (id == memory->mp_slot) { if (id == memory->mp_slot) {
@ -6174,7 +6174,7 @@ void GuideBot::DoFrame(int me) {
mstruct.objhandle = me; mstruct.objhandle = me;
unsigned short id; uint16_t id;
Obj_Value(me, VF_GET, OBJV_US_ID, &id); Obj_Value(me, VF_GET, OBJV_US_ID, &id);
if (Obj_FindID("GuideBot") == id) { if (Obj_FindID("GuideBot") == id) {
@ -6692,7 +6692,7 @@ bool Thief::DoNotify(int me, tOSIRISEVTAINOTIFY *notify) {
f_success = DoSteal(me, target_handle, 1, false); f_success = DoSteal(me, target_handle, 1, false);
DoSteal(me, target_handle, 2, f_success); DoSteal(me, target_handle, 2, f_success);
} else if (target_type == OBJ_ROBOT) { } else if (target_type == OBJ_ROBOT) {
unsigned short id; uint16_t id;
Obj_Value(target_handle, VF_GET, OBJV_US_ID, &id); Obj_Value(target_handle, VF_GET, OBJV_US_ID, &id);
if (id == ROBOT_GUIDEBOT || id == ROBOT_GUIDEBOTRED) { if (id == ROBOT_GUIDEBOT || id == ROBOT_GUIDEBOTRED) {
@ -6841,7 +6841,7 @@ void Thief::SpewEverything(int me) {
Obj_Value(me, VF_GET, OBJV_V_POS, &pos); Obj_Value(me, VF_GET, OBJV_V_POS, &pos);
for (i = 0; i < memory->num_stolen_weapons; i++) { for (i = 0; i < memory->num_stolen_weapons; i++) {
unsigned short id; uint16_t id;
int j; int j;
for (j = 0; j < memory->stolen_weapons[i].amount; j++) { for (j = 0; j < memory->stolen_weapons[i].amount; j++) {
@ -7654,7 +7654,7 @@ bool OldScratch::DoSteal(int me, int it) {
int room; int room;
vector pos; vector pos;
int j; int j;
unsigned short id; uint16_t id;
Obj_Value(me, VF_GET, OBJV_I_ROOMNUM, &room); Obj_Value(me, VF_GET, OBJV_I_ROOMNUM, &room);
Obj_Value(me, VF_GET, OBJV_V_POS, &pos); Obj_Value(me, VF_GET, OBJV_V_POS, &pos);
@ -7986,7 +7986,7 @@ void BarnSwallow::ComputeNest(int me) {
vector pos; vector pos;
int room; int room;
int type; int type;
unsigned short id; uint16_t id;
memory->num_friends = 0; memory->num_friends = 0;
@ -8008,7 +8008,7 @@ void BarnSwallow::ComputeNest(int me) {
for (i = 0; i < n_scan; i++) { for (i = 0; i < n_scan; i++) {
if (scan_objs[i] != me) { if (scan_objs[i] != me) {
int c_type; int c_type;
unsigned short c_id; uint16_t c_id;
Obj_Value(scan_objs[i], VF_GET, OBJV_I_TYPE, &c_type); Obj_Value(scan_objs[i], VF_GET, OBJV_I_TYPE, &c_type);
Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &c_id); Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &c_id);
@ -8327,7 +8327,7 @@ void GBPowerup::DoInit(int me) {
memory->next_check_time = Game_GetTime() + (float)rand() / (float)RAND_MAX; // Sead the powerups differently :) memory->next_check_time = Game_GetTime() + (float)rand() / (float)RAND_MAX; // Sead the powerups differently :)
memory->time_till_next_hud_message = 0.0f; memory->time_till_next_hud_message = 0.0f;
unsigned short short_id[6]; uint16_t short_id[6];
short_id[0] = Obj_FindID("Buddyextinguisher"); short_id[0] = Obj_FindID("Buddyextinguisher");
short_id[1] = Obj_FindID("buddywingnut"); short_id[1] = Obj_FindID("buddywingnut");
@ -8336,7 +8336,7 @@ void GBPowerup::DoInit(int me) {
short_id[4] = Obj_FindID("buddyantivirus"); short_id[4] = Obj_FindID("buddyantivirus");
short_id[5] = Obj_FindID("buddyspeed"); short_id[5] = Obj_FindID("buddyspeed");
unsigned short id; uint16_t id;
Obj_Value(me, VF_GET, OBJV_US_ID, &id); Obj_Value(me, VF_GET, OBJV_US_ID, &id);
memory->type = 5; // Forces it to the speed powerup if it didn't know what it was... memory->type = 5; // Forces it to the speed powerup if it didn't know what it was...
@ -8658,7 +8658,7 @@ void Hellion::RemapAlert(int me, float start, float end, float time) {
} }
void Hellion::RemapWB(int me, float start, float fire, int fire_sound, float end, float time, float latency, int index, void Hellion::RemapWB(int me, float start, float fire, int fire_sound, float end, float time, float latency, int index,
unsigned short w_id, char f_mask) { uint16_t w_id, char f_mask) {
memory->start = start; memory->start = start;
memory->fire = fire; memory->fire = fire;
memory->end = end; memory->end = end;
@ -9158,7 +9158,7 @@ short Hellion::CallEvent(int event, tOSIRISEventInfo *data) {
case EVT_MEMRESTORE: { case EVT_MEMRESTORE: {
memory = (hellion_data *)data->evt_memrestore.memory_ptr; memory = (hellion_data *)data->evt_memrestore.memory_ptr;
unsigned short wpn = Wpn_FindID(memory->weapon); uint16_t wpn = Wpn_FindID(memory->weapon);
int snd = Sound_FindId(memory->sound); int snd = Sound_FindId(memory->sound);
RemapAlert(data->me_handle, memory->alert_start, memory->alert_end, memory->alert_time); RemapAlert(data->me_handle, memory->alert_start, memory->alert_end, memory->alert_time);
@ -9294,7 +9294,7 @@ void MantaRay::UpdateSquad(int me) {
n_scan = AI_GetNearbyObjs(&pos, room, 200.0f, scan_objs, 25, false, true, false, true); n_scan = AI_GetNearbyObjs(&pos, room, 200.0f, scan_objs, 25, false, true, false, true);
for (i = 0; i < n_scan; i++) { for (i = 0; i < n_scan; i++) {
unsigned short id; uint16_t id;
Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id); Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id);
// this is more rare than the types matching; so, do it first // this is more rare than the types matching; so, do it first
@ -9715,7 +9715,7 @@ void Skiff::UpdateSquad(int me) {
n_scan = AI_GetNearbyObjs(&pos, room, 200.0f, scan_objs, 25, false, true, false, true); n_scan = AI_GetNearbyObjs(&pos, room, 200.0f, scan_objs, 25, false, true, false, true);
for (i = 0; i < n_scan; i++) { for (i = 0; i < n_scan; i++) {
unsigned short id; uint16_t id;
Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id); Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id);
// this is more rare than the types matching; so, do it first // this is more rare than the types matching; so, do it first
@ -10064,7 +10064,7 @@ bool SpyHunter::DoNotify(int me, tOSIRISEventInfo *data) {
Obj_Value(notify->it_handle, VF_GET, OBJV_I_TYPE, &type); Obj_Value(notify->it_handle, VF_GET, OBJV_I_TYPE, &type);
if (type == OBJ_WEAPON) { if (type == OBJ_WEAPON) {
unsigned short id; uint16_t id;
Obj_Value(notify->it_handle, VF_GET, OBJV_US_ID, &id); Obj_Value(notify->it_handle, VF_GET, OBJV_US_ID, &id);
if (id == memory->emd_id) { if (id == memory->emd_id) {
@ -10722,8 +10722,8 @@ void Seeker::DoInit(int me) {
AI_SetType(me, AIT_AIS); AI_SetType(me, AIT_AIS);
AI_AddGoal(me, AIG_GET_TO_OBJ, 1, 1.0f, -1, GF_OBJ_IS_TARGET | GF_USE_BLINE_IF_SEES_GOAL, OBJECT_HANDLE_NONE); AI_AddGoal(me, AIG_GET_TO_OBJ, 1, 1.0f, -1, GF_OBJ_IS_TARGET | GF_USE_BLINE_IF_SEES_GOAL, OBJECT_HANDLE_NONE);
unsigned short id; uint16_t id;
unsigned short humon_seeker_id; uint16_t humon_seeker_id;
Obj_Value(me, VF_GET, OBJV_US_ID, &id); Obj_Value(me, VF_GET, OBJV_US_ID, &id);
humon_seeker_id = Obj_FindID("HumonSeeker"); humon_seeker_id = Obj_FindID("HumonSeeker");

View File

@ -86,32 +86,32 @@ static void AI_SafeSetType(int obj_handle, int ai_type);
//---------------- //----------------
// Name lookup globals // Name lookup globals
static unsigned short energy_effect_id; // weapon ID for the energy charge effect static uint16_t energy_effect_id; // weapon ID for the energy charge effect
static unsigned short frag_burst_effect_id; // weapon ID for the frag burst effect static uint16_t frag_burst_effect_id; // weapon ID for the frag burst effect
static unsigned short boss_frag_burst_id; // weapon ID for the boss frag burst effect static uint16_t boss_frag_burst_id; // weapon ID for the boss frag burst effect
static unsigned short transfer_effect_id; // texture ID for the energy transfer lightning effect static uint16_t transfer_effect_id; // texture ID for the energy transfer lightning effect
static unsigned short heal_effect_id; // texture ID for the heal lightning effect static uint16_t heal_effect_id; // texture ID for the heal lightning effect
static unsigned short boss_heal_effect_id; // texture ID for the boss heal lightning effect static uint16_t boss_heal_effect_id; // texture ID for the boss heal lightning effect
static unsigned short tractor_beam_effect_id; // texture ID for the tractor beam effect static uint16_t tractor_beam_effect_id; // texture ID for the tractor beam effect
static unsigned short alien_organism_id; // object type ID for the alien organism robot static uint16_t alien_organism_id; // object type ID for the alien organism robot
static unsigned short shield_blast_id; // weapon ID for the HT shield blast effect static uint16_t shield_blast_id; // weapon ID for the HT shield blast effect
static unsigned short ht_grenade_id; // weapon ID for the HT grenade static uint16_t ht_grenade_id; // weapon ID for the HT grenade
static unsigned short ht_grenade_effect_id; // weapon ID for the HT grenade launch effect static uint16_t ht_grenade_effect_id; // weapon ID for the HT grenade launch effect
static unsigned short lifter_blast_effect_id; // weapon ID for the lifter blast effect static uint16_t lifter_blast_effect_id; // weapon ID for the lifter blast effect
static unsigned short lifter_stick_effect_id; // texture ID for lifter's night-stick lightning effect static uint16_t lifter_stick_effect_id; // texture ID for lifter's night-stick lightning effect
static unsigned short teleport_effect_id; // weapon ID for teleporting effect static uint16_t teleport_effect_id; // weapon ID for teleporting effect
static unsigned short ht_grenade_sound_id; // sound ID for firing the grenade static uint16_t ht_grenade_sound_id; // sound ID for firing the grenade
static unsigned short powerup_id; // invisible powerup id static uint16_t powerup_id; // invisible powerup id
static unsigned short boss_flapping_id; // flapping sound id static uint16_t boss_flapping_id; // flapping sound id
static unsigned short boss_turf_id; // turf id static uint16_t boss_turf_id; // turf id
static unsigned short boss_see_id; static uint16_t boss_see_id;
static unsigned short boss_hurt_id; static uint16_t boss_hurt_id;
static unsigned short lifter_pull_sound_id; static uint16_t lifter_pull_sound_id;
static unsigned short lifter_amb_sound_id; static uint16_t lifter_amb_sound_id;
// ========================== // ==========================
// AI Goal Related Functions // AI Goal Related Functions
@ -2300,7 +2300,7 @@ void AlienOrganism::UpdateSquad(int me) {
n_scan = AI_GetNearbyObjs(&pos, room, ALIEN_SQUAD_RECRUIT_RADIUS, scan_objs, 25, false, true, false, true); n_scan = AI_GetNearbyObjs(&pos, room, ALIEN_SQUAD_RECRUIT_RADIUS, scan_objs, 25, false, true, false, true);
for (i = 0; i < n_scan; i++) { for (i = 0; i < n_scan; i++) {
unsigned short id; uint16_t id;
Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id); Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id);
// this is more rare than the types matching; so, do it first // this is more rare than the types matching; so, do it first
@ -3992,7 +3992,7 @@ void AlienOrganism::DoDamage(int me, tOSIRISEVTDAMAGED *damage_data) {
/* /*
int wpn_handle=damage_data->weapon_handle; int wpn_handle=damage_data->weapon_handle;
int type; int type;
unsigned short id; uint16_t id;
wpn_handle=damage_data->weapon_handle; wpn_handle=damage_data->weapon_handle;
Obj_Value(wpn_handle, VF_GET, OBJV_US_ID, &id); Obj_Value(wpn_handle, VF_GET, OBJV_US_ID, &id);

View File

@ -837,7 +837,7 @@ void aEmitSparks(float num_sparks, int objhandle) {
} }
bool names_looked_up = false; bool names_looked_up = false;
unsigned short guidebot_id; uint16_t guidebot_id;
#define MAX_SCAN_OBJECTS 20 #define MAX_SCAN_OBJECTS 20
@ -861,7 +861,7 @@ void aKillBotsNearObj(int objhandle) {
int scan_objs[MAX_SCAN_OBJECTS]; int scan_objs[MAX_SCAN_OBJECTS];
int n_scan; int n_scan;
int n, i; int n, i;
unsigned short id; uint16_t id;
if (!qObjExists(objhandle)) if (!qObjExists(objhandle))
return; return;

View File

@ -929,7 +929,7 @@ typedef int OMMSHANDLE;
// define unsigned types; // define unsigned types;
typedef uint8_t ubyte; typedef uint8_t ubyte;
typedef int8_t sbyte; typedef int8_t sbyte;
typedef unsigned short ushort; typedef uint16_t ushort;
typedef uint32_t uint32_t; typedef uint32_t uint32_t;
typedef uint32_t ddgr_color; typedef uint32_t ddgr_color;

View File

@ -30,7 +30,7 @@ const vector Zero_vector = {0.0f, 0.0f, 0.0f};
#pragma warning(disable : 4244) #pragma warning(disable : 4244)
// Angles are unsigned shorts // Angles are unsigned shorts
typedef unsigned short angle; typedef uint16_t angle;
// The basic fixed-point type // The basic fixed-point type
typedef int32_t fix; typedef int32_t fix;
@ -971,7 +971,7 @@ void vm_VectorToMatrix(matrix *m, vector *fvec, vector *uvec, vector *rvec) {
} }
} }
void vm_SinCos(unsigned short a, float *s, float *c) { void vm_SinCos(uint16_t a, float *s, float *c) {
if (s) if (s)
*s = FixSin(a); *s = FixSin(a);
if (c) if (c)

View File

@ -930,7 +930,7 @@ typedef int OMMSHANDLE;
// define unsigned types; // define unsigned types;
typedef uint8_t ubyte; typedef uint8_t ubyte;
typedef int8_t sbyte; typedef int8_t sbyte;
typedef unsigned short ushort; typedef uint16_t ushort;
typedef uint32_t uint32_t; typedef uint32_t uint32_t;
typedef uint32_t ddgr_color; typedef uint32_t ddgr_color;

View File

@ -708,7 +708,7 @@ void vm_VectorToMatrix(matrix *m, vector *fvec, vector *uvec, vector *rvec) {
} }
} }
void vm_SinCos(unsigned short a, float *s, float *c) { void vm_SinCos(uint16_t a, float *s, float *c) {
if (s) if (s)
*s = FixSin(a); *s = FixSin(a);
if (c) if (c)

View File

@ -121,7 +121,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil
CFILE *cfptr; CFILE *cfptr;
char format_type[80]; // ASCII name of format type char format_type[80]; // ASCII name of format type
unsigned short fmttag = 0; // Numerical format type uint16_t fmttag = 0; // Numerical format type
uint32_t ckid; // Current chunk's ID uint32_t ckid; // Current chunk's ID
uint32_t cksize; // Current chunk's size in bytes uint32_t cksize; // Current chunk's size in bytes
uint32_t filesize; // Size of the sound file uint32_t filesize; // Size of the sound file
@ -214,7 +214,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil
} }
// Read in the format type // Read in the format type
fmttag = (unsigned short)cf_ReadShort(cfptr); fmttag = (uint16_t)cf_ReadShort(cfptr);
switch (fmttag) { switch (fmttag) {
// We only support WAVE_FORMAT_PCM currently // We only support WAVE_FORMAT_PCM currently

View File

@ -2708,7 +2708,7 @@ void win_llsSystem::SetListener(pos_state *cur_pos) {
} }
// AdjustSound2d -- adjusts the volume, pan, and freq. of a sound // AdjustSound2d -- adjusts the volume, pan, and freq. of a sound
void win_llsSystem::AdjustSound(int sound_uid, float f_volume, float f_pan, unsigned short frequency) { void win_llsSystem::AdjustSound(int sound_uid, float f_volume, float f_pan, uint16_t frequency) {
int current_slot; int current_slot;
if (!m_f_sound_lib_init) if (!m_f_sound_lib_init)

View File

@ -242,8 +242,8 @@ struct tPSBInfo;
class sound_buffer_cache { class sound_buffer_cache {
public: public:
class sound_buffer_info *m_sound_cache; // List of all sounds current sounds class sound_buffer_info *m_sound_cache; // List of all sounds current sounds
unsigned short m_max_sounds_played; // Maximum sounds played at any given moment uint16_t m_max_sounds_played; // Maximum sounds played at any given moment
unsigned short m_cur_sounds_played; // Current number of sounds playing uint16_t m_cur_sounds_played; // Current number of sounds playing
unsigned m_loop_method; // what method do we do looping sounds (direct sound only) unsigned m_loop_method; // what method do we do looping sounds (direct sound only)
public: public:
@ -315,7 +315,7 @@ private:
private: private:
// Total samples played since start of library // Total samples played since start of library
unsigned short m_total_sounds_played; // Used for unique ids and for stats uint16_t m_total_sounds_played; // Used for unique ids and for stats
// Sound library status // Sound library status
uint8_t m_f_sound_lib_init; // Flag is set if sound library is initialized -- cmphack uint8_t m_f_sound_lib_init; // Flag is set if sound library is initialized -- cmphack
@ -373,8 +373,8 @@ public:
virtual void SetListener(pos_state *cur_pos); virtual void SetListener(pos_state *cur_pos);
virtual int PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float master_volume, virtual int PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float master_volume,
bool f_looped, float reverb = 0.5f); //, unsigned short frequency) bool f_looped, float reverb = 0.5f); //, uint16_t frequency)
virtual void AdjustSound(int sound_uid, float f_volume, float f_pan, unsigned short frequency); virtual void AdjustSound(int sound_uid, float f_volume, float f_pan, uint16_t frequency);
virtual void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f); virtual void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f);
// Sample cache and list of samples // Sample cache and list of samples

View File

@ -1169,10 +1169,10 @@ int hlsSystem::Play3dSound(int sound_index, pos_state *cur_pos, object *cur_obj,
return m_sound_objects[i].m_hlsound_uid; return m_sound_objects[i].m_hlsound_uid;
} }
// General purpose 2d sound play function // General purpose 2d sound play function
int hlsSystem::Play2dSound(int sound_index, float volume, float pan, unsigned short frequency) { int hlsSystem::Play2dSound(int sound_index, float volume, float pan, uint16_t frequency) {
return hlsSystem::Play2dSound(sound_index, SND_PRIORITY_NORMAL, volume, pan, frequency); return hlsSystem::Play2dSound(sound_index, SND_PRIORITY_NORMAL, volume, pan, frequency);
} }
int hlsSystem::Play2dSound(int sound_index, int priority, float volume, float pan, unsigned short frequency) { int hlsSystem::Play2dSound(int sound_index, int priority, float volume, float pan, uint16_t frequency) {
int i = 0; int i = 0;
int sound_uid; int sound_uid;
int sound_obj_index; int sound_obj_index;
@ -1348,7 +1348,7 @@ void hlsSystem::SetVolumeObject(int objhandle, float volume) {
} }
// Queued sound functions // Queued sound functions
// Adds a sound to a queue // Adds a sound to a queue
void hlsSystem::Add2dSoundQueued(int q_num, int sound_index, float volume, float pan, unsigned short frequency) { void hlsSystem::Add2dSoundQueued(int q_num, int sound_index, float volume, float pan, uint16_t frequency) {
if (!m_f_hls_system_init) if (!m_f_hls_system_init)
return; return;
} }

View File

@ -322,10 +322,10 @@ public:
// 2d functions // 2d functions
int Play2dSound(int sound_index, float volume = MAX_GAME_VOLUME / 2, float pan = 0.0, int Play2dSound(int sound_index, float volume = MAX_GAME_VOLUME / 2, float pan = 0.0,
unsigned short frequency = 22050); uint16_t frequency = 22050);
int Play2dSound(int sound_index, int priority, float volume = MAX_GAME_VOLUME / 2, float pan = 0.0, int Play2dSound(int sound_index, int priority, float volume = MAX_GAME_VOLUME / 2, float pan = 0.0,
unsigned short frequency = 22050); uint16_t frequency = 22050);
int Update2dSound(int hlsound_uid, float volume, float pan); int Update2dSound(int hlsound_uid, float volume, float pan);
@ -344,7 +344,7 @@ public:
float GetMasterVolume(); float GetMasterVolume();
// Queued sound functions // Queued sound functions
void Add2dSoundQueued(int q_num, int sound_index, float volume, float pan, unsigned short frequency); void Add2dSoundQueued(int q_num, int sound_index, float volume, float pan, uint16_t frequency);
void KillQueue(int q_num = 0); void KillQueue(int q_num = 0);
void KillAllQueues(); void KillAllQueues();

View File

@ -373,7 +373,7 @@ void lnxsound::SetListener(pos_state *cur_pos) {
} }
int lnxsound::PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float adjusted_volume, int lnxsound::PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float adjusted_volume,
bool f_looped, float reverb) //, unsigned short frequency bool f_looped, float reverb) //, uint16_t frequency
{ {
float volume = adjusted_volume; // Adjust base volume by sent volume, let 3d stuff do the rest float volume = adjusted_volume; // Adjust base volume by sent volume, let 3d stuff do the rest
@ -415,7 +415,7 @@ int lnxsound::PlaySound3d(play_information *play_info, int sound_index, pos_stat
return PlaySound2d(play_info, sound_index, volume, pan, f_looped); return PlaySound2d(play_info, sound_index, volume, pan, f_looped);
} }
void lnxsound::AdjustSound(int sound_uid, float f_volume, float f_pan, unsigned short frequency) { void lnxsound::AdjustSound(int sound_uid, float f_volume, float f_pan, uint16_t frequency) {
int current_slot; int current_slot;
if (sound_device == 0) if (sound_device == 0)

View File

@ -84,7 +84,7 @@ public:
void SetListener(pos_state *cur_pos) override; void SetListener(pos_state *cur_pos) override;
int PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float master_volume, int PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float master_volume,
bool f_looped, float reverb = 0.5f) override; bool f_looped, float reverb = 0.5f) override;
void AdjustSound(int sound_uid, float f_volume, float f_pan, unsigned short frequency) override; void AdjustSound(int sound_uid, float f_volume, float f_pan, uint16_t frequency) override;
void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f) override; void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f) override;
void StopAllSounds() override; void StopAllSounds() override;

View File

@ -504,8 +504,8 @@ public:
virtual void SetListener(pos_state *cur_pos) = 0; virtual void SetListener(pos_state *cur_pos) = 0;
virtual int PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float master_volume, virtual int PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float master_volume,
bool f_looped, float reverb = 0.5f) = 0; //, unsigned short frequency) bool f_looped, float reverb = 0.5f) = 0; //, uint16_t frequency)
virtual void AdjustSound(int sound_uid, float f_volume, float f_pan, unsigned short frequency) = 0; virtual void AdjustSound(int sound_uid, float f_volume, float f_pan, uint16_t frequency) = 0;
virtual void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f) = 0; virtual void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f) = 0;
virtual void StopAllSounds() = 0; virtual void StopAllSounds() = 0;

View File

@ -898,9 +898,9 @@ STBIWDEF uint8_t * stbi_zlib_compress(uint8_t *data, int data_len, int *out_len,
// user provided a zlib compress implementation, use that // user provided a zlib compress implementation, use that
return STBIW_ZLIB_COMPRESS(data, data_len, out_len, quality); return STBIW_ZLIB_COMPRESS(data, data_len, out_len, quality);
#else // use builtin #else // use builtin
static unsigned short lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 }; static uint16_t lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 };
static uint8_t lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 }; static uint8_t lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 };
static unsigned short distc[] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 }; static uint16_t distc[] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 };
static uint8_t disteb[] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13 }; static uint8_t disteb[] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13 };
unsigned int bitbuf=0; unsigned int bitbuf=0;
int i,j, bitcount=0; int i,j, bitcount=0;
@ -1250,7 +1250,7 @@ STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x,
static const uint8_t stbiw__jpg_ZigZag[] = { 0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18, static const uint8_t stbiw__jpg_ZigZag[] = { 0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,
24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 }; 24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 };
static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const unsigned short *bs) { static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const uint16_t *bs) {
int bitBuf = *bitBufP, bitCnt = *bitCntP; int bitBuf = *bitBufP, bitCnt = *bitCntP;
bitCnt += bs[1]; bitCnt += bs[1];
bitBuf |= bs[0] << (24 - bitCnt); bitBuf |= bs[0] << (24 - bitCnt);
@ -1315,7 +1315,7 @@ static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float
*d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6; *d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6;
} }
static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) { static void stbiw__jpg_calcBits(int val, uint16_t bits[2]) {
int tmp1 = val < 0 ? -val : val; int tmp1 = val < 0 ? -val : val;
val = val < 0 ? val-1 : val; val = val < 0 ? val-1 : val;
bits[1] = 1; bits[1] = 1;
@ -1325,9 +1325,9 @@ static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) {
bits[0] = val & ((1<<bits[1])-1); bits[0] = val & ((1<<bits[1])-1);
} }
static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt, float *CDU, int du_stride, float *fdtbl, int DC, const unsigned short HTDC[256][2], const unsigned short HTAC[256][2]) { static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt, float *CDU, int du_stride, float *fdtbl, int DC, const uint16_t HTDC[256][2], const uint16_t HTAC[256][2]) {
const unsigned short EOB[2] = { HTAC[0x00][0], HTAC[0x00][1] }; const uint16_t EOB[2] = { HTAC[0x00][0], HTAC[0x00][1] };
const unsigned short M16zeroes[2] = { HTAC[0xF0][0], HTAC[0xF0][1] }; const uint16_t M16zeroes[2] = { HTAC[0xF0][0], HTAC[0xF0][1] };
int dataOff, i, j, n, diff, end0pos, x, y; int dataOff, i, j, n, diff, end0pos, x, y;
int DU[64]; int DU[64];
@ -1357,7 +1357,7 @@ static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt
if (diff == 0) { if (diff == 0) {
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[0]); stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[0]);
} else { } else {
unsigned short bits[2]; uint16_t bits[2];
stbiw__jpg_calcBits(diff, bits); stbiw__jpg_calcBits(diff, bits);
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[bits[1]]); stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[bits[1]]);
stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits); stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits);
@ -1374,7 +1374,7 @@ static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt
for(i = 1; i <= end0pos; ++i) { for(i = 1; i <= end0pos; ++i) {
int startpos = i; int startpos = i;
int nrzeroes; int nrzeroes;
unsigned short bits[2]; uint16_t bits[2];
for (; DU[i]==0 && i<=end0pos; ++i) { for (; DU[i]==0 && i<=end0pos; ++i) {
} }
nrzeroes = i-startpos; nrzeroes = i-startpos;
@ -1422,9 +1422,9 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in
0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa
}; };
// Huffman tables // Huffman tables
static const unsigned short YDC_HT[256][2] = { {0,2},{2,3},{3,3},{4,3},{5,3},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9}}; static const uint16_t YDC_HT[256][2] = { {0,2},{2,3},{3,3},{4,3},{5,3},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9}};
static const unsigned short UVDC_HT[256][2] = { {0,2},{1,2},{2,2},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9},{1022,10},{2046,11}}; static const uint16_t UVDC_HT[256][2] = { {0,2},{1,2},{2,2},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9},{1022,10},{2046,11}};
static const unsigned short YAC_HT[256][2] = { static const uint16_t YAC_HT[256][2] = {
{10,4},{0,2},{1,2},{4,3},{11,4},{26,5},{120,7},{248,8},{1014,10},{65410,16},{65411,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, {10,4},{0,2},{1,2},{4,3},{11,4},{26,5},{120,7},{248,8},{1014,10},{65410,16},{65411,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
{12,4},{27,5},{121,7},{502,9},{2038,11},{65412,16},{65413,16},{65414,16},{65415,16},{65416,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, {12,4},{27,5},{121,7},{502,9},{2038,11},{65412,16},{65413,16},{65414,16},{65415,16},{65416,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
{28,5},{249,8},{1015,10},{4084,12},{65417,16},{65418,16},{65419,16},{65420,16},{65421,16},{65422,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, {28,5},{249,8},{1015,10},{4084,12},{65417,16},{65418,16},{65419,16},{65420,16},{65421,16},{65422,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
@ -1442,7 +1442,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in
{65515,16},{65516,16},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{0,0},{0,0},{0,0},{0,0},{0,0}, {65515,16},{65516,16},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{0,0},{0,0},{0,0},{0,0},{0,0},
{2041,11},{65525,16},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} {2041,11},{65525,16},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0}
}; };
static const unsigned short UVAC_HT[256][2] = { static const uint16_t UVAC_HT[256][2] = {
{0,2},{1,2},{4,3},{10,4},{24,5},{25,5},{56,6},{120,7},{500,9},{1014,10},{4084,12},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, {0,2},{1,2},{4,3},{10,4},{24,5},{25,5},{56,6},{120,7},{500,9},{1014,10},{4084,12},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
{11,4},{57,6},{246,8},{501,9},{2038,11},{4085,12},{65416,16},{65417,16},{65418,16},{65419,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, {11,4},{57,6},{246,8},{501,9},{2038,11},{4085,12},{65416,16},{65417,16},{65418,16},{65419,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
{26,5},{247,8},{1015,10},{4086,12},{32706,15},{65420,16},{65421,16},{65422,16},{65423,16},{65424,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, {26,5},{247,8},{1015,10},{4086,12},{32706,15},{65420,16},{65421,16},{65422,16},{65423,16},{65424,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
@ -1521,7 +1521,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in
// Encode 8x8 macroblocks // Encode 8x8 macroblocks
{ {
static const unsigned short fillBits[] = {0x7F, 7}; static const uint16_t fillBits[] = {0x7F, 7};
int DCY=0, DCU=0, DCV=0; int DCY=0, DCU=0, DCV=0;
int bitBuf=0, bitCnt=0; int bitBuf=0, bitCnt=0;
// comp == 2 is grey+alpha (alpha is ignored) // comp == 2 is grey+alpha (alpha is ignored)

View File

@ -666,7 +666,7 @@ void vm_VectorToMatrix(matrix *m, vector *fvec, vector *uvec, vector *rvec) {
} }
} }
void vm_SinCos(unsigned short a, float *s, float *c) { void vm_SinCos(uint16_t a, float *s, float *c) {
if (s) if (s)
*s = FixSin(a); *s = FixSin(a);
if (c) if (c)