From 3dcd21b7175b7c473f64360b85e6f0b7e74dbeaf Mon Sep 17 00:00:00 2001 From: GravisZro Date: Thu, 23 May 2024 23:03:29 -0400 Subject: [PATCH] Replace "unsigned short" with "uint16_t" --- Descent3/BOA.cpp | 4 +- Descent3/BOA.h | 2 +- Descent3/LoadLevel.h | 2 +- Descent3/OsirisLoadandBind.cpp | 22 ++-- Descent3/WeaponFire.cpp | 4 +- Descent3/audiotaunts.cpp | 4 +- Descent3/demofile.cpp | 22 ++-- Descent3/gamecinematics.cpp | 2 +- Descent3/multi.cpp | 28 ++--- Descent3/multi.h | 10 +- Descent3/multi_dll_mgr.cpp | 2 +- Descent3/multi_server.h | 6 +- Descent3/object.cpp | 10 +- Descent3/object.h | 8 +- Descent3/osiris_predefs.cpp | 6 +- Descent3/powerup.h | 2 +- Descent3/robotfirestruct.h | 14 +-- Descent3/weapon.h | 2 +- ddebug/lnxmono.cpp | 8 +- ddebug/mono.h | 2 +- ddebug/winmono.cpp | 2 +- legacy/hogmaker/hogmaker.cpp | 2 +- legacy/inetfile/CFtp.cpp | 2 +- legacy/inetfile/Chttpget.cpp | 2 +- legacy/mtclient/chat_api.cpp | 2 +- legacy/mtclient/chat_api.h | 4 +- legacy/mtclient/mtclient.cpp | 2 +- legacy/mtclient/mtgametrack.h | 4 +- legacy/mtclient/mtpilottrack.h | 4 +- lib/Adecode.h | 2 +- lib/CZip.h | 2 +- lib/d3x_op.h | 12 +-- lib/demofile.h | 16 +-- lib/linux/dyna_glide.h | 2 +- lib/networking.h | 16 +-- lib/polymodel_external.h | 2 +- lib/pstypes.h | 2 +- lib/vecmat_external.h | 2 +- libacm/aencode.cpp | 2 +- libacm/decode.c | 4 +- libmve/SystemInterfaces.h | 10 +- libmve/lnxdsound.h | 2 +- libmve/mveasm.cpp | 170 +++++++++++++++--------------- libmve/mvelibi.h | 68 ++++++------ libmve/mvelibl.cpp | 40 +++---- linux/lnxdata.cpp | 2 +- lnxmvelib/asmstub.c | 24 ++--- lnxmvelib/lnxdraw.cpp | 10 +- lnxmvelib/lnxdsound.h | 12 +-- lnxmvelib/mveasm.cpp | 88 ++++++++-------- lnxmvelib/mvelibi.h | 66 ++++++------ lnxmvelib/mvelibl.cpp | 40 +++---- mem/mem.cpp | 10 +- movie/d3movie.cpp | 6 +- netcon/includes/Chttpget.h | 4 +- netcon/includes/con_dll.h | 2 +- netcon/includes/mdllinit.h | 2 +- netcon/inetfile/CFtp.cpp | 2 +- netcon/inetfile/Chttpget.cpp | 2 +- netcon/lanclient/lanclient.cpp | 4 +- netgames/dmfc/encryption.cpp | 2 +- networking/networking.cpp | 14 +-- scripts/AIGame.cpp | 62 +++++------ scripts/AIGame3.cpp | 48 ++++----- scripts/Merc4.cpp | 4 +- scripts/lnx/osiris_common.h | 2 +- scripts/lnx/osiris_vector.h | 4 +- scripts/osiris_common.h | 2 +- scripts/osiris_vector.h | 2 +- sndlib/ddsoundload.cpp | 4 +- sndlib/ds3dlib.cpp | 2 +- sndlib/ds3dlib.h | 10 +- sndlib/hlsoundlib.cpp | 6 +- sndlib/hlsoundlib.h | 6 +- sndlib/sdlsound.cpp | 4 +- sndlib/sdlsound.h | 2 +- sndlib/ssl_lib.h | 4 +- third_party/stb/stb_image_write.h | 28 ++--- vecmat/vector.cpp | 2 +- 79 files changed, 509 insertions(+), 509 deletions(-) diff --git a/Descent3/BOA.cpp b/Descent3/BOA.cpp index b67d238a..4ecb8f5f 100644 --- a/Descent3/BOA.cpp +++ b/Descent3/BOA.cpp @@ -169,7 +169,7 @@ static const ubyte bbf_lookup[27] = {(0), (0x08 | 0x04 | 0x10), (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]; int BOA_mine_checksum = 0; 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) { int depth = 0; int i; - unsigned short stack[TERRAIN_WIDTH * TERRAIN_DEPTH]; + uint16_t stack[TERRAIN_WIDTH * TERRAIN_DEPTH]; char on_stack[TERRAIN_WIDTH * TERRAIN_DEPTH]; for (i = 0; i < TERRAIN_WIDTH * TERRAIN_DEPTH; i++) diff --git a/Descent3/BOA.h b/Descent3/BOA.h index d8e26dc1..f79ffc0b 100644 --- a/Descent3/BOA.h +++ b/Descent3/BOA.h @@ -124,7 +124,7 @@ #define MAX_BOA_TERRAIN_REGIONS 8 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_AABB_checksum; extern int BOA_vis_checksum; diff --git a/Descent3/LoadLevel.h b/Descent3/LoadLevel.h index 460e10ff..16fc95fe 100644 --- a/Descent3/LoadLevel.h +++ b/Descent3/LoadLevel.h @@ -688,7 +688,7 @@ inline void AppendToLevelChecksum(uint32_t val) { Level_md5->update(val); } -inline void AppendToLevelChecksum(unsigned short val) { +inline void AppendToLevelChecksum(uint16_t val) { if (!Level_md5) { return; } diff --git a/Descent3/OsirisLoadandBind.cpp b/Descent3/OsirisLoadandBind.cpp index 28753364..f50e278c 100644 --- a/Descent3/OsirisLoadandBind.cpp +++ b/Descent3/OsirisLoadandBind.cpp @@ -3335,10 +3335,10 @@ char OMMS_GetInfo(OMMSHANDLE handle,uint32_t *mem_size,uint32_t *uid,ushort *ref */ typedef struct tOMMSNode { - unsigned short id; + uint16_t id; uint32_t size_of_memory; uint32_t unique_id; - unsigned short reference_count; + uint16_t reference_count; uint8_t free_called; void *memory_ptr; tOMMSNode *next; @@ -3346,14 +3346,14 @@ typedef struct tOMMSNode { typedef struct tOMMSHashNode { char *script_name; - unsigned short base_id; + uint16_t base_id; tOMMSNode *root; tOMMSHashNode *next; } tOMMSHashNode; tOMMSHashNode *OMMS_Hash_node_root = NULL; -unsigned short OMMS_Current_base_id = 0; -unsigned short OMMS_Current_id = 0; +uint16_t OMMS_Current_base_id = 0; +uint16_t OMMS_Current_id = 0; // 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). @@ -3485,8 +3485,8 @@ void Osiris_SaveOMMS(CFILE *file) { void Osiris_RestoreOMMS(CFILE *file) { ASSERT(OMMS_Hash_node_root == NULL); - OMMS_Current_base_id = (unsigned short)cf_ReadShort(file); - OMMS_Current_id = (unsigned short)cf_ReadShort(file); + OMMS_Current_base_id = (uint16_t)cf_ReadShort(file); + OMMS_Current_id = (uint16_t)cf_ReadShort(file); tOMMSHashNode *currhash; tOMMSNode *node; @@ -3509,7 +3509,7 @@ void Osiris_RestoreOMMS(CFILE *file) { currhash->root = 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 int length = cf_ReadByte(file); @@ -3538,7 +3538,7 @@ void Osiris_RestoreOMMS(CFILE *file) { node->memory_ptr = 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->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) { tOMMSHashNode *hashcurr = OMMS_Hash_node_root; tOMMSNode *nodecurr; - unsigned short base_id; - unsigned short id; + uint16_t base_id; + uint16_t id; base_id = ((handle & 0xFFFF0000) >> 16); id = (handle & 0x0000FFFF); diff --git a/Descent3/WeaponFire.cpp b/Descent3/WeaponFire.cpp index 7e6323ed..2f6febf1 100644 --- a/Descent3/WeaponFire.cpp +++ b/Descent3/WeaponFire.cpp @@ -1889,12 +1889,12 @@ int FireWeaponFromObject(object *obj, int weapon_num, int gun_num, bool f_force_ if (Game_mode & GM_MULTI) { if (Netgame.local_role == LR_SERVER) { 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) { - 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); } diff --git a/Descent3/audiotaunts.cpp b/Descent3/audiotaunts.cpp index e27d6a0e..24fb28d3 100644 --- a/Descent3/audiotaunts.cpp +++ b/Descent3/audiotaunts.cpp @@ -500,7 +500,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) { cfptr = NULL; 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 cksize; // Current chunk's size in bytes uint32_t filesize; // Size of the sound file @@ -579,7 +579,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) { } // Read in the format type - fmttag = (unsigned short)cf_ReadShort(cfptr); + fmttag = (uint16_t)cf_ReadShort(cfptr); switch (fmttag) { // We only support WAVE_FORMAT_PCM currently diff --git a/Descent3/demofile.cpp b/Descent3/demofile.cpp index 3a8e4b0d..c8addca1 100644 --- a/Descent3/demofile.cpp +++ b/Descent3/demofile.cpp @@ -309,7 +309,7 @@ static float Demo_last_pinfo; float Demo_frame_ofs; static int Demo_auto_idx = 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]; bool Demo_looping = 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, - unsigned short weapobjnum, short gunnum) { +void DemoWriteWeaponFire(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum, + uint16_t weapobjnum, short gunnum) { uint32_t uniqueid = MultiGetMatchChecksum(OBJ_WEAPON, weaponnum); if (weapobjnum == -1) return; @@ -547,7 +547,7 @@ void DemoWriteObjCreate(ubyte type, ushort id, int roomnum, vector *pos, const m #define MAX_COOP_TURRETS 400 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) { 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; 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) { Int3(); return; @@ -1301,7 +1301,7 @@ void DemoFrame() { } while (!exit_loop); } -void DemoWriteCinematics(ubyte *data, unsigned short len) { +void DemoWriteCinematics(ubyte *data, uint16_t len) { cf_WriteByte(Demo_cfp, DT_CINEMATICS); // Write a bunch of data mprintf((0, "Writing Cinematic data (%d bytes) to demo file.\n", len)); @@ -1317,14 +1317,14 @@ void DemoReadCinematics() { Cinematic_DoDemoFileData(buffer); } -void DemoWriteMSafe(ubyte *data, unsigned short len) { +void DemoWriteMSafe(ubyte *data, uint16_t len) { cf_WriteByte(Demo_cfp, DT_MSAFE); cf_WriteShort(Demo_cfp, len); cf_WriteBytes(data, len, Demo_cfp); // 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_WriteShort(Demo_cfp, len); cf_WriteBytes(data, len, Demo_cfp); @@ -1367,7 +1367,7 @@ void DemoReadCollidePlayerWeapon(void) { vector collision_p; vector collision_n; bool f_reverse_normal; - unsigned short real_weapnum; + uint16_t real_weapnum; short plr_objnum = cf_ReadShort(Demo_cfp); short wep_objnum = cf_ReadShort(Demo_cfp); gs_ReadVector(Demo_cfp, collision_p); @@ -1398,7 +1398,7 @@ void DemoReadCollideGenericWeapon(void) { vector collision_p; vector collision_n; bool f_reverse_normal; - unsigned short real_weapnum; + uint16_t real_weapnum; short gen_objnum = cf_ReadShort(Demo_cfp); short wep_objnum = cf_ReadShort(Demo_cfp); gs_ReadVector(Demo_cfp, collision_p); diff --git a/Descent3/gamecinematics.cpp b/Descent3/gamecinematics.cpp index 64eb6e11..05fe8242 100644 --- a/Descent3/gamecinematics.cpp +++ b/Descent3/gamecinematics.cpp @@ -223,7 +223,7 @@ extern int DoAI; extern bool Game_being_played_from_quick_play; #endif #endif -extern unsigned short Demo_obj_map[MAX_OBJECTS]; +extern uint16_t Demo_obj_map[MAX_OBJECTS]; struct { // some important, pre-computed times diff --git a/Descent3/multi.cpp b/Descent3/multi.cpp index 157588d3..8b046efe 100644 --- a/Descent3/multi.cpp +++ b/Descent3/multi.cpp @@ -1997,7 +1997,7 @@ void DoNextPlayerFile(int playernum) { // Puts player "slot" position info into the passed in buffer // Returns the number of bytes used -int MultiStuffRobotPosition(unsigned short objectnum, ubyte *data) { +int MultiStuffRobotPosition(uint16_t objectnum, ubyte *data) { int size; int count = 0; //@@multi_orientation mat; @@ -2045,7 +2045,7 @@ int MultiStuffRobotPosition(unsigned short objectnum, ubyte *data) { // Puts player "slot" position info into the passed in buffer // 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 count = 0; ubyte data[MAX_GAME_DATA_SIZE]; @@ -2096,7 +2096,7 @@ int MultiSendRobotFireWeapon(unsigned short objectnum, vector *pos, vector *dir, void MultiDoRobotFire(ubyte *data) { int count = 0; - unsigned short obj_num; + uint16_t obj_num; vector weapon_pos; vector weapon_dir; uint32_t weapon_num; @@ -3887,7 +3887,7 @@ void MultiDoGetGameInfo(ubyte *data, network_address *from_addr) { count += len; MultiAddShort(Current_mission.cur_level, outdata, &count); - unsigned short icurrplayers = 0; + uint16_t icurrplayers = 0; for (int i = 0; i < MAX_NET_PLAYERS; i++) { if (Dedicated_server) { if (i == Player_num) @@ -3971,7 +3971,7 @@ void MultiDoGetPXOGameInfo(ubyte *data, network_address *from_addr) { count += len; MultiAddShort(Current_mission.cur_level, outdata, &count); - unsigned short icurrplayers = 0; + uint16_t icurrplayers = 0; int i = 0; 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; int count = 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 size = 0; 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; int count = 0; int size = 0; @@ -7915,8 +7915,8 @@ void SendDataChunk(int playernum) { } void MultiDoFileCancelled(ubyte *data) { - unsigned short playernum; // Who is telling us the file is cancelled - unsigned short filewho; // Who's file is being cancelled + uint16_t playernum; // Who is telling us the file is cancelled + uint16_t filewho; // Who's file is being cancelled int count = 0; SKIP_HEADER(data, &count); @@ -7969,7 +7969,7 @@ void MultiSendClientCustomData(int slot, int whoto) { 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); memcpy(data + count, csum_filename, logo_len); count += logo_len; @@ -8009,7 +8009,7 @@ void MultiSendClientCustomData(int slot, int whoto) { 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); memcpy(data + count, csum_filename, vt_len); count += vt_len; @@ -8031,7 +8031,7 @@ void MultiSendClientCustomData(int slot, int whoto) { } 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; SKIP_HEADER(data, &count); @@ -9378,7 +9378,7 @@ void DoReqPlayerList(network_address *addr) { memset(outdata, 0, sizeof(outdata)); size = START_DATA(MP_PLAYERLIST_DATA, outdata, &count); - unsigned short icurrplayers = 0; + uint16_t icurrplayers = 0; int i = 0; if (Dedicated_server) { // Skip the server player diff --git a/Descent3/multi.h b/Descent3/multi.h index 561ece7f..b30eb903 100644 --- a/Descent3/multi.h +++ b/Descent3/multi.h @@ -992,13 +992,13 @@ void MultiEndLevel(); void GetServerGameTime(); // Send robot info -int MultiStuffRobotPosition(unsigned short objectnum, ubyte *data); +int MultiStuffRobotPosition(uint16_t objectnum, ubyte *data); // Handle robot position void MultiDoRobotPos(ubyte *data); // 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 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); // 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 void MultiDoObjAnimUpdate(ubyte *data); @@ -1052,7 +1052,7 @@ void MultiDoRobotFireSound(ubyte *data); void MultiAddObjTurretUpdate(int objnum); // 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 void MultiDoTurretUpdate(ubyte *data); @@ -1071,7 +1071,7 @@ void MultiSendInventoryRemoveItem(int slot, int type, int id); void MultiAddObjWBAnimUpdate(int objnum); -int MultiStuffObjWBAnimUpdate(unsigned short objnum, ubyte *data); +int MultiStuffObjWBAnimUpdate(uint16_t objnum, ubyte *data); void MultiDoObjWBAnimUpdate(ubyte *data); diff --git a/Descent3/multi_dll_mgr.cpp b/Descent3/multi_dll_mgr.cpp index 40e1abf7..def528fc 100644 --- a/Descent3/multi_dll_mgr.cpp +++ b/Descent3/multi_dll_mgr.cpp @@ -381,7 +381,7 @@ extern int Num_modems_found; #endif #define DLL_BRIEFING_FONT 1 #define DLL_BIG_BRIEFING_FONT 2 -extern unsigned short nw_ListenPort; +extern uint16_t nw_ListenPort; extern ushort PXOPort; void GetMultiAPI(multi_api *api) { diff --git a/Descent3/multi_server.h b/Descent3/multi_server.h index 7520fc81..9ab41d99 100644 --- a/Descent3/multi_server.h +++ b/Descent3/multi_server.h @@ -30,13 +30,13 @@ extern int Join_response_strings[]; #define MAX_CHANGED_OBJECTS 700 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 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 unsigned short Num_changed_turret[MAX_NET_PLAYERS]; +extern uint16_t Num_changed_turret[MAX_NET_PLAYERS]; extern uint32_t Secret_net_id; #define JOIN_ANSWER_OK 0 diff --git a/Descent3/object.cpp b/Descent3/object.cpp index d9009c3d..f26cc109 100644 --- a/Descent3/object.cpp +++ b/Descent3/object.cpp @@ -1213,7 +1213,7 @@ tPosHistory Object_position_samples[MAX_OBJECT_POS_HISTORY]; ubyte Object_position_head; signed short Object_map_position_history[MAX_OBJECTS]; 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 Highest_object_index = 0; @@ -3319,7 +3319,7 @@ void GetObjectPointInWorld(vector *dest, object *obj, int subnum, int vertnum) { *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]; 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]; 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]; poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num]; 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]; poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num]; polyobj_info *p_info = &obj->rtype.pobj_info; diff --git a/Descent3/object.h b/Descent3/object.h index 548bb9a7..cdce6349 100644 --- a/Descent3/object.h +++ b/Descent3/object.h @@ -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 // (used in multiplayer games and the like) -bool ObjGetAnimUpdate(unsigned short objnum, custom_anim *multi_anim_info); -void ObjSetAnimUpdate(unsigned short objnum, custom_anim *multi_anim_info); +bool ObjGetAnimUpdate(uint16_t 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 ObjSetTurretUpdate(unsigned short objnum, multi_turret *multi_turret_info); +void ObjGetTurretUpdate(uint16_t 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 object *ObjGetUltimateParent(object *child); diff --git a/Descent3/osiris_predefs.cpp b/Descent3/osiris_predefs.cpp index d18a0206..b23eb5d2 100644 --- a/Descent3/osiris_predefs.cpp +++ b/Descent3/osiris_predefs.cpp @@ -842,7 +842,7 @@ void osipf_PlayerValue(int obj_handle, char op, char vhandle, void *ptr, int ind case PLYSV_US_WEAPON_POWERUP_ID: { 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; case PLYSV_I_WEAPON_AMMO: if (op == VF_GET) @@ -2712,9 +2712,9 @@ void osipf_ObjWBValue(int obj_handle, char wb_index, char op, char vtype, void * break; case WBSV_US_GUNPT_WEAPON_ID: 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) { - *((unsigned short *)ptr) = static_wb->gp_weapon_index[g_index]; + *((uint16_t *)ptr) = static_wb->gp_weapon_index[g_index]; } break; case WBSV_V_GUNPT_POS: diff --git a/Descent3/powerup.h b/Descent3/powerup.h index 668c2857..4f749f67 100644 --- a/Descent3/powerup.h +++ b/Descent3/powerup.h @@ -90,7 +90,7 @@ typedef struct { int image_handle; // Either a vclip or a polygon model char model_name[PAGENAME_LEN]; // used for remapping powerups which contain models int flags; - unsigned short used; + uint16_t used; short sounds[MAX_POWERUP_SOUNDS]; diff --git a/Descent3/robotfirestruct.h b/Descent3/robotfirestruct.h index 6b1a9545..c532c990 100644 --- a/Descent3/robotfirestruct.h +++ b/Descent3/robotfirestruct.h @@ -33,12 +33,12 @@ // Attach to the polymodel typedef struct poly_wb_info { // Static Data (Add to robot generic page) - unsigned short num_gps; + uint16_t num_gps; ubyte gp_index[MAX_WB_GUNPOINTS]; // Turrets are listed from most important (greatest mobility) to least important ubyte num_turrets; - unsigned short turret_index[MAX_WB_TURRETS]; + uint16_t turret_index[MAX_WB_TURRETS]; } poly_wb_info; @@ -46,9 +46,9 @@ typedef struct poly_wb_info { // Attach to a object type typedef struct otype_wb_info { - unsigned short gp_weapon_index[MAX_WB_GUNPOINTS]; - unsigned short fm_fire_sound_index[MAX_WB_FIRING_MASKS]; - unsigned short aiming_gp_index; + uint16_t gp_weapon_index[MAX_WB_GUNPOINTS]; + uint16_t fm_fire_sound_index[MAX_WB_FIRING_MASKS]; + uint16_t aiming_gp_index; ubyte num_masks; ubyte gp_fire_masks[MAX_WB_FIRING_MASKS]; @@ -57,8 +57,8 @@ typedef struct otype_wb_info { ubyte gp_quad_fire_mask; ubyte num_levels; - unsigned short gp_level_weapon_index[MAX_WB_UPGRADES]; - unsigned short gp_level_fire_sound_index[MAX_WB_UPGRADES]; + uint16_t gp_level_weapon_index[MAX_WB_UPGRADES]; + uint16_t gp_level_fire_sound_index[MAX_WB_UPGRADES]; ubyte aiming_flags; float aiming_3d_dot; // These can be reused. diff --git a/Descent3/weapon.h b/Descent3/weapon.h index 4ef5a14b..2e270927 100644 --- a/Descent3/weapon.h +++ b/Descent3/weapon.h @@ -284,7 +284,7 @@ typedef struct { ubyte spawn_count; // how many of spawn handle gets created ubyte alternate_chance; // how often the alternate spawn weapon gets chosen (0 to 100) - unsigned short used; + uint16_t used; ubyte particle_count; ubyte terrain_damage_depth; diff --git a/ddebug/lnxmono.cpp b/ddebug/lnxmono.cpp index 2b25ee0e..44c9f59d 100644 --- a/ddebug/lnxmono.cpp +++ b/ddebug/lnxmono.cpp @@ -194,7 +194,7 @@ void *nw_TCPLoggingWorker(void *arg) { return NULL; } -bool nw_InitTCPLogging(char *ip, unsigned short port) { +bool nw_InitTCPLogging(char *ip, uint16_t port) { #if DLOPEN_PTHREAD // load up the pthread library void *lib = dlopen("libpthread.so", RTLD_GLOBAL | RTLD_NOW); @@ -391,7 +391,7 @@ bool Debug_ConsoleInit() { if (port_ptr) { *port_ptr = '\0'; port_ptr++; - unsigned short port; + uint16_t port; port = atoi(port_ptr); if (nw_InitTCPLogging(address, port)) { Mono_use_window_remote = true; @@ -541,7 +541,7 @@ void Debug_ConsolePrintf(int n, const char *format, ...) { uint8_t packet[518]; packet[0x00] = 0x03; // control code packet[0x01] = n; // window_handle - *((unsigned short *)&packet[0x02]) = text_len; + *((uint16_t *)&packet[0x02]) = text_len; memcpy(&packet[0x04], Mono_buffer, text_len); // 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[0x02] = row; // row packet[0x03] = col; // col - *((unsigned short *)&packet[0x04]) = text_len; + *((uint16_t *)&packet[0x04]) = text_len; memcpy(&packet[0x06], Mono_buffer, text_len); // send the packet diff --git a/ddebug/mono.h b/ddebug/mono.h index 7fa7c527..d34accf4 100644 --- a/ddebug/mono.h +++ b/ddebug/mono.h @@ -64,7 +64,7 @@ #ifndef _MONO_H #define _MONO_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, ...); #if (!defined(RELEASE)) && defined(LOGGER) extern bool Debug_print_block; diff --git a/ddebug/winmono.cpp b/ddebug/winmono.cpp index 351fdc61..041e83a6 100644 --- a/ddebug/winmono.cpp +++ b/ddebug/winmono.cpp @@ -126,7 +126,7 @@ SOCKET tcp_log_sock; SOCKADDR_IN tcp_log_addr; 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); tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0); if (INVALID_SOCKET == tcp_log_sock) { diff --git a/legacy/hogmaker/hogmaker.cpp b/legacy/hogmaker/hogmaker.cpp index 23fbc67a..4896320d 100644 --- a/legacy/hogmaker/hogmaker.cpp +++ b/legacy/hogmaker/hogmaker.cpp @@ -388,7 +388,7 @@ create_new_library(char *hogname, int nfiles, char **filenames) //write files (& build index) for (i=0;iS_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_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_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_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 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_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 { struct { uint8_t s_b1, s_b2, s_b3, s_b4; } S_un_b; struct { - unsigned short s_w1, s_w2; + uint16_t s_w1, s_w2; } S_un_w; uint32_t S_addr; } 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; 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 { struct { uint8_t s_b1, s_b2, s_b3, s_b4; } S_un_b; struct { - unsigned short s_w1, s_w2; + uint16_t s_w1, s_w2; } S_un_w; uint32_t S_addr; } 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; } S_un_b; struct { - unsigned short s_w1, s_w2; + uint16_t s_w1, s_w2; } S_un_w; uint32_t S_addr; } 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; } S_un_b; struct { - unsigned short s_w1, s_w2; + uint16_t s_w1, s_w2; } S_un_w; uint32_t S_addr; } S_un; diff --git a/lib/polymodel_external.h b/lib/polymodel_external.h index c858b900..51b1e172 100644 --- a/lib/polymodel_external.h +++ b/lib/polymodel_external.h @@ -225,7 +225,7 @@ typedef struct bsp_info { // used to describe a polygon model typedef struct poly_model { - unsigned short used; + uint16_t used; int flags; // PMF_flags, see above ubyte new_style; // if 1, then this polymodel is in the new outrage format (oof) diff --git a/lib/pstypes.h b/lib/pstypes.h index af2ee7f0..a6bc3ca8 100644 --- a/lib/pstypes.h +++ b/lib/pstypes.h @@ -24,7 +24,7 @@ // define unsigned types; typedef uint8_t ubyte; typedef int8_t sbyte; -typedef unsigned short ushort; +typedef uint16_t ushort; typedef uint32_t uint32_t; typedef unsigned long ulong; diff --git a/lib/vecmat_external.h b/lib/vecmat_external.h index dc030f63..187b49c1 100644 --- a/lib/vecmat_external.h +++ b/lib/vecmat_external.h @@ -44,7 +44,7 @@ #define VECMAT_EXTERNAL_H // 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 { angle p, h, b; diff --git a/libacm/aencode.cpp b/libacm/aencode.cpp index dea768e6..0b16140f 100644 --- a/libacm/aencode.cpp +++ b/libacm/aencode.cpp @@ -25,7 +25,7 @@ typedef uint32_t uint32_t; typedef int32_t int32_t; -typedef unsigned short uint16; +typedef uint16_t uint16; typedef signed short sint16; typedef uint8_t uint8_t; typedef int8_t int8_t; diff --git a/libacm/decode.c b/libacm/decode.c index d801a530..7ed9423f 100644 --- a/libacm/decode.c +++ b/libacm/decode.c @@ -686,13 +686,13 @@ static int output_values(int *src, uint8_t *dst, int n, 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 */ 0x3156, 0x302E, 0,0, 0,0, /* hdrlen?, chans?, bits?, hz */ 28,0, 1, 16, 22050, 0 }; - unsigned short i, buf[12]; + uint16_t i, buf[12]; for (i = 0; i < 12; i++) GET_BITS(buf[i], acm, 16); diff --git a/libmve/SystemInterfaces.h b/libmve/SystemInterfaces.h index 89d6f98b..833d6389 100644 --- a/libmve/SystemInterfaces.h +++ b/libmve/SystemInterfaces.h @@ -43,13 +43,13 @@ #define LNXSND_CAPS_LOCHARDWARE 0x0004 struct SoundWAVEFormatEx { - unsigned short wFormatTag; - unsigned short nChannels; + uint16_t wFormatTag; + uint16_t nChannels; uint32_t nSamplesPerSec; uint32_t nAvgBytesPerSec; - unsigned short nBlockAlign; - unsigned short wBitsPerSample; - unsigned short cbSize; + uint16_t nBlockAlign; + uint16_t wBitsPerSample; + uint16_t cbSize; }; #define SOUND_WAVE_FORMAT_PCM 0x01 diff --git a/libmve/lnxdsound.h b/libmve/lnxdsound.h index d7aa9dac..672e6b80 100644 --- a/libmve/lnxdsound.h +++ b/libmve/lnxdsound.h @@ -54,7 +54,7 @@ typedef struct { LnxBufferDesc lbdesc; - unsigned short freq; + uint16_t freq; char playing; char __pad; } LnxSoundBuffer; diff --git a/libmve/mveasm.cpp b/libmve/mveasm.cpp index 73aa8eed..a7b92417 100644 --- a/libmve/mveasm.cpp +++ b/libmve/mveasm.cpp @@ -35,8 +35,8 @@ extern unsigned nf_new_line; // width - SWIDTH extern unsigned nf_back_right; // (SHEIGHT-1)*width extern unsigned nf_hicolor; -extern unsigned short nf_trans16_lo[256]; -extern unsigned short nf_trans16_hi[256]; +extern uint16_t nf_trans16_lo[256]; +extern uint16_t nf_trans16_hi[256]; extern signed short snd_8to16[256]; 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 nfPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w, unsigned h); void nfPkConfig(void); -unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev); -unsigned sndDecompS16(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(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev); 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); @@ -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) // prev is the previous decompression state or zero. // 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; if (len == 0) 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 // in its low and high order 16-bit halves.) // 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; 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, uint8_t *&edi) { @@ -406,7 +406,7 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8 case 7: { bool donf23 = false; if (hiColor) { - unsigned short val = IntelSwapper(*(unsigned short *)esi); + uint16_t val = IntelSwapper(*(uint16_t *)esi); if (val & 0x8000) { donf23 = true; } @@ -426,7 +426,7 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8 case 8: { bool mode2 = false; if (hiColor) { - unsigned short val = IntelSwapper(*(unsigned short *)esi); + uint16_t val = IntelSwapper(*(uint16_t *)esi); if (val & 0x8000) { mode2 = true; } @@ -448,11 +448,11 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8 bool mode3 = false; if (hiColor) { - unsigned short val = IntelSwapper(*(unsigned short *)esi); + uint16_t val = IntelSwapper(*(uint16_t *)esi); if (val & 0x8000) { mode2 = true; } else { - val = IntelSwapper(*(unsigned short *)(esi + 4)); + val = IntelSwapper(*(uint16_t *)(esi + 4)); if (val & 0x8000) { mode3 = true; } @@ -477,7 +477,7 @@ int SkipOpcode(int opcode_to_use, bool hiColor, const uint8_t *&esi, const uint8 bool mode2 = false; if (hiColor) { - int val1 = IntelSwapper(*(unsigned short *)esi); + int val1 = IntelSwapper(*(uint16_t *)esi); if (val1 & 0x8000) { 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) { #ifdef OUTRAGE_BIG_ENDIAN typedef struct { - unsigned short hax, ax; + uint16_t hax, ax; } reg_word; typedef struct { int8_t hah, hal, ah, al; } reg_byte; #else typedef struct { - unsigned short ax, hax; + uint16_t ax, hax; } reg_word; typedef struct { 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; if (hiColor) { - uint32_t bcompOffset = IntelSwapper(*((const unsigned short *)esi)); + uint32_t bcompOffset = IntelSwapper(*((const uint16_t *)esi)); bcomp = esi + bcompOffset; esi += 2; } @@ -601,8 +601,8 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, if (hiColor) { // Here we can set the color to exactly what we want - const unsigned short kColor = 0; - unsigned short *pDst = reinterpret_cast(edi); + const uint16_t kColor = 0; + uint16_t *pDst = reinterpret_cast(edi); for (int r = 0; r < 8; ++r) { pDst[0] = kColor; pDst[1] = kColor; @@ -689,14 +689,14 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, } break; case 5: { // Far shift from previous buffer - uint32_t eax = IntelSwapper(*(unsigned short *)(esi)); + uint32_t eax = IntelSwapper(*(uint16_t *)(esi)); esi += 2; DOnf_xypshift(hiColor, eax, edi, nfpk_back_right, nf.DiffBufPtrs); } break; case 6: { if (hiColor) { // Far shift from current buffer - uint32_t val1 = IntelSwapper(*(unsigned short *)esi); + uint32_t val1 = IntelSwapper(*(uint16_t *)esi); esi += 2; DOnf_xycshift(hiColor, val1, edi, nfpk_back_right); } else { @@ -722,7 +722,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, case 7: { bool donf23 = false; if (hiColor) { - unsigned short val = IntelSwapper(*(unsigned short *)esi); + uint16_t val = IntelSwapper(*(uint16_t *)esi); if (val & 0x8000) { 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 + 12) = w4; } else { - *(unsigned short *)(edi + 0) = w1; - *(unsigned short *)(edi + 2) = w2; - *(unsigned short *)(edi + 4) = w3; - *(unsigned short *)(edi + 6) = w4; + *(uint16_t *)(edi + 0) = w1; + *(uint16_t *)(edi + 2) = w2; + *(uint16_t *)(edi + 4) = w3; + *(uint16_t *)(edi + 6) = w4; } 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 + 12) = w4; } else { - *(unsigned short *)(edi + 0) = w1; - *(unsigned short *)(edi + 2) = w2; - *(unsigned short *)(edi + 4) = w3; - *(unsigned short *)(edi + 6) = w4; - *(unsigned short *)(edi + 0 + nf_width) = w1; - *(unsigned short *)(edi + 2 + nf_width) = w2; - *(unsigned short *)(edi + 4 + nf_width) = w3; - *(unsigned short *)(edi + 6 + nf_width) = w4; + *(uint16_t *)(edi + 0) = w1; + *(uint16_t *)(edi + 2) = w2; + *(uint16_t *)(edi + 4) = w3; + *(uint16_t *)(edi + 6) = w4; + *(uint16_t *)(edi + 0 + nf_width) = w1; + *(uint16_t *)(edi + 2 + nf_width) = w2; + *(uint16_t *)(edi + 4 + nf_width) = w3; + *(uint16_t *)(edi + 6 + nf_width) = w4; } edi += nf_width * 2; @@ -867,9 +867,9 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, bool donf40 = false; if (hiColor) { - unsigned short val = IntelSwapper(*(unsigned short *)esi); + uint16_t val = IntelSwapper(*(uint16_t *)esi); if (val & 0x8000) { - val = IntelSwapper(*(unsigned short *)(esi + 8)); + val = IntelSwapper(*(uint16_t *)(esi + 8)); if (val & 0x8000) { donf40 = true; } else { @@ -944,11 +944,11 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, *(uint32_t *)(edi + 4) = w4; edi += nf_width; } else { - *(unsigned short *)(edi + 0) = w1; - *(unsigned short *)(edi + 2) = w2; + *(uint16_t *)(edi + 0) = w1; + *(uint16_t *)(edi + 2) = w2; edi += nf_width; - *(unsigned short *)(edi + 0) = w3; - *(unsigned short *)(edi + 2) = w4; + *(uint16_t *)(edi + 0) = w3; + *(uint16_t *)(edi + 2) = w4; 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; edi += nf_width; } else { - *(unsigned short *)(edi + 0) = w1; - *(unsigned short *)(edi + 2) = w2; + *(uint16_t *)(edi + 0) = w1; + *(uint16_t *)(edi + 2) = w2; edi += nf_width; - *(unsigned short *)(edi + 0) = w3; - *(unsigned short *)(edi + 2) = w4; + *(uint16_t *)(edi + 0) = w3; + *(uint16_t *)(edi + 2) = w4; 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 + 12) = w4; } else { - *(unsigned short *)(edi + 0) = w1; - *(unsigned short *)(edi + 2) = w2; - *(unsigned short *)(edi + 4) = w3; - *(unsigned short *)(edi + 6) = w4; + *(uint16_t *)(edi + 0) = w1; + *(uint16_t *)(edi + 2) = w2; + *(uint16_t *)(edi + 4) = w3; + *(uint16_t *)(edi + 6) = w4; } edi += nf_width; @@ -1191,9 +1191,9 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, bool donf57 = false; if (hiColor) { - unsigned short val = IntelSwapper(*(unsigned short *)esi); + uint16_t val = IntelSwapper(*(uint16_t *)esi); if (val & 0x8000) { - val = IntelSwapper(*(unsigned short *)(esi + 4)); + val = IntelSwapper(*(uint16_t *)(esi + 4)); if (val & 0x8000) { donf57 = true; } else { @@ -1201,7 +1201,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, } } else { - val = IntelSwapper(*(unsigned short *)(esi + 4)); + val = IntelSwapper(*(uint16_t *)(esi + 4)); if (val & 0x8000) { donf25 = true; } @@ -1219,7 +1219,7 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, } if (donf57) { - unsigned short colors[4]; + uint16_t colors[4]; if (hiColor) { colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)]; 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; edi -= nfpk_back_right; } else { - unsigned short colors[4]; + uint16_t colors[4]; if (hiColor) { colors[0] = Trans16(esi + 0); 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; if (hiColor) { - int val1 = IntelSwapper(*(unsigned short *)esi); + int val1 = IntelSwapper(*(uint16_t *)esi); if (val1 & 0x8000) { - val1 = IntelSwapper(*(unsigned short *)(esi + 16)); + val1 = IntelSwapper(*(uint16_t *)(esi + 16)); if (val1 & 0x8000) { do42 = true; } 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 - unsigned short colors[4]; + uint16_t colors[4]; if (hiColor) { colors[0] = nf_trans16_lo[*(esi)] | nf_trans16_hi[*(esi + 1)]; 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: { if (!hiColor) { // 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 uint32_t eax = (ebx << 16) | ebx; 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) { - *((unsigned short *)(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)]; - *((unsigned short *)(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)]; - *((unsigned short *)(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)]; - *((unsigned short *)(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 + 0)) = nf_trans16_lo[*(idx + 0)] | nf_trans16_hi[*(idx + 1)]; + *((uint16_t *)(edi + 2)) = nf_trans16_lo[*(idx + 2)] | nf_trans16_hi[*(idx + 3)]; + *((uint16_t *)(edi + 4)) = nf_trans16_lo[*(idx + 4)] | nf_trans16_hi[*(idx + 5)]; + *((uint16_t *)(edi + 6)) = nf_trans16_lo[*(idx + 6)] | nf_trans16_hi[*(idx + 7)]; + *((uint16_t *)(edi + 8)) = nf_trans16_lo[*(idx + 8)] | nf_trans16_hi[*(idx + 9)]; + *((uint16_t *)(edi + 10)) = nf_trans16_lo[*(idx + 10)] | nf_trans16_hi[*(idx + 11)]; + *((uint16_t *)(edi + 12)) = nf_trans16_lo[*(idx + 12)] | nf_trans16_hi[*(idx + 13)]; + *((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) { @@ -2026,10 +2026,10 @@ void DOnf_shift(const bool hiColor, const int offset, uint8_t *&edi, const int n // Non-Implemented Functions //////////////////////////////////////////////// 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); 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); 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); @@ -2037,9 +2037,9 @@ void mve_ShowFrameField(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned h, unsigned dstx, unsigned dsty, unsigned field); void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w, 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); -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); void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops, 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. 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) { uint8_t *this_tbuf = curr_tbuf; 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; // memcpy( this_tbuf, compData, amt ); for (uint32_t ii = 0; ii < (amt / 2); ii++) { - unsigned short *destword = (unsigned short *)this_tbuf[ii]; - unsigned short *srcword = (unsigned short *)compData[ii]; + uint16_t *destword = (uint16_t *)this_tbuf[ii]; + uint16_t *srcword = (uint16_t *)compData[ii]; *destword = IntelSwapper(*srcword); } 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. // esi indexes source from buffer // esi will be computed as +- 16K relative to edi. - compAsWord = (const unsigned short *)comp; + compAsWord = (const uint16_t *)comp; curr_tbuf = nf.tbuf; for (uint8_t fqIt = nf_fqty; fqIt != 0; --fqIt, curr_tbuf += nf_width) { 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; // memcpy( this_tbuf, src, amt ); for (uint32_t ii = 0; ii < (amt / 2); ii++) { - unsigned short *destword = (unsigned short *)this_tbuf[ii]; - unsigned short *srcword = (unsigned short *)src[ii]; + uint16_t *destword = (uint16_t *)this_tbuf[ii]; + uint16_t *srcword = (uint16_t *)src[ii]; *destword = IntelSwapper(*srcword); } 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) { 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); // 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; const uint8_t *compData = comp; 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) { uint8_t *this_tbuf = curr_tbuf; 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; } - unsigned short flags = IntelSwapper(*curr_parms++); + uint16_t flags = IntelSwapper(*curr_parms++); if (flags != 0) { this_tbuf += SWIDTH * HI_COLOR_SCALE; 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? // memcpy( this_tbuf, compData, amt ); for (uint32_t ii = 0; ii < (amt / 2); ii++) { - unsigned short *dest = (unsigned short *)this_tbuf[ii]; - unsigned short *src = (unsigned short *)compData[ii]; + uint16_t *dest = (uint16_t *)this_tbuf[ii]; + uint16_t *src = (uint16_t *)compData[ii]; *dest = IntelSwapper(*src); } 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; // memcpy( this_tbuf, src, amt ); for (uint32_t ii = 0; ii < (amt / 2); ii++) { - unsigned short *destword = (unsigned short *)this_tbuf[ii]; - unsigned short *srcword = (unsigned short *)src[ii]; + uint16_t *destword = (uint16_t *)this_tbuf[ii]; + uint16_t *srcword = (uint16_t *)src[ii]; *destword = IntelSwapper(*srcword); } 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). // Chgs specifies which 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) { 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). // Chgs specifies which 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) { if (nf_hicolor) { 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) { 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) { 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) { debug_break(); } diff --git a/libmve/mvelibi.h b/libmve/mvelibi.h index ba2e8ad2..67edd82c 100644 --- a/libmve/mvelibi.h +++ b/libmve/mvelibi.h @@ -52,7 +52,7 @@ // some inlines to prevent macro craziness when using incrementers and dereferencing, and so I can use operator // 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); } @@ -62,9 +62,9 @@ inline int IntelSwapper(int a) { return INTEL_INT(a); } typedef struct _mve_hdr { char FileType[20]; // MVE_FILE_TYPE - unsigned short HdrSize; // sizeof(mve_hdr) - unsigned short version; // MVE_FILE_VERSION - unsigned short id; // ~MVE_FILE_VERSION+0x1234 + uint16_t HdrSize; // sizeof(mve_hdr) + uint16_t version; // MVE_FILE_VERSION + uint16_t id; // ~MVE_FILE_VERSION+0x1234 void SwapBytes() { HdrSize = IntelSwapper(HdrSize); version = IntelSwapper(version); @@ -77,8 +77,8 @@ typedef struct _mve_hdr { //------------------------------ typedef struct _io_hdr { - unsigned short len; // Length of record data (pad to even) - unsigned short kind; // See IO_REC_xxx + uint16_t len; // Length of record data (pad to even) + uint16_t kind; // See IO_REC_xxx // uint8_t data[0]; // Record data void SwapBytes() { len = IntelSwapper(len); @@ -104,7 +104,7 @@ typedef struct _io_hdr { #define MCMD_DATA(arg) ((uint8_t *)((arg) + 1)) 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 minor; // Minor opcode // uint8_t data[0]; // Opcode data @@ -118,7 +118,7 @@ typedef struct _mcmd_hdr { #define mcmd_syncInit 2 typedef struct _syncInit { uint32_t period; // period of quanta - unsigned short wait_quanta; // # of quanta per frame + uint16_t wait_quanta; // # of quanta per frame void SwapBytes() { period = IntelSwapper(period); wait_quanta = IntelSwapper(wait_quanta); @@ -127,7 +127,7 @@ typedef struct _syncInit { #define mcmd_sndConfigure 3 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 // It indicates that 16-bit data has been compressed to 8-bits. // 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 pad; #endif - unsigned short frequency; + uint16_t frequency; // Minor opcode 1 extends buflen to be a long uint32_t buflen; void SwapBytes() { @@ -157,12 +157,12 @@ typedef struct _sndConfigure { #define mcmd_nfConfig 5 typedef struct _nfConfig { - unsigned short wqty; - unsigned short hqty; + uint16_t wqty; + uint16_t hqty; // Minor opcode 1 fields: - unsigned short fqty; + uint16_t fqty; // 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() { wqty = IntelSwapper(wqty); hqty = IntelSwapper(hqty); @@ -175,19 +175,19 @@ typedef struct _nfConfig { #define mcmd_nfDecompChg 16 #define mcmd_nfPkDecomp 17 typedef struct _nfDecomp { - unsigned short prev; // info:Prev frames+1 needed for full picture - unsigned short iframe; // info:Current internal frame # - unsigned short x; - unsigned short y; - unsigned short w; - unsigned short h; + uint16_t prev; // info:Prev frames+1 needed for full picture + uint16_t iframe; // info:Current internal frame # + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; #ifdef OUTRAGE_BIG_ENDIAN uint8_t bitpadder : 7; uint8_t advance : 1; uint8_t dummy1; #else - unsigned short advance : 1; - unsigned short pad : 15; + uint16_t advance : 1; + uint16_t pad : 15; #endif void SwapBytes() { @@ -205,10 +205,10 @@ typedef struct _nfDecomp { #define mcmd_sfPkShowFrameChg 18 #endif typedef struct _sfShowFrame { - unsigned short pal_start; - unsigned short pal_count; + uint16_t pal_start; + uint16_t pal_count; // 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() { pal_start = IntelSwapper(pal_start); pal_count = IntelSwapper(pal_count); @@ -219,9 +219,9 @@ typedef struct _sfShowFrame { #define mcmd_sndAdd 8 #define mcmd_sndSilence 9 typedef struct _sndAdd { - unsigned short iframe; // info: iframe # of sound - unsigned short TrackMask; - unsigned short qty; // Uncompressed audio size in bytes + uint16_t iframe; // info: iframe # of sound + uint16_t TrackMask; + uint16_t qty; // Uncompressed audio size in bytes // uint8_t data[0]; void SwapBytes() { iframe = IntelSwapper(iframe); @@ -232,9 +232,9 @@ typedef struct _sndAdd { #define mcmd_gfxMode 10 typedef struct _gfxMode { - unsigned short minw; - unsigned short minh; - unsigned short mode; + uint16_t minw; + uint16_t minh; + uint16_t mode; void SwapBytes() { minw = IntelSwapper(minw); minh = IntelSwapper(minh); @@ -255,8 +255,8 @@ typedef struct _palMakeSynthPalette { #define mcmd_palLoadPalette 12 typedef struct _palLoadPalette { - unsigned short start; - unsigned short count; + uint16_t start; + uint16_t count; // uint8_t data[0]; void SwapBytes() { start = IntelSwapper(start); @@ -276,7 +276,7 @@ typedef struct _palLoadPalette { #define mcmd_nfHPkInfo 20 typedef struct _nfPkInfo { uint32_t error; // scaled by 10000 - unsigned short usage[64]; + uint16_t usage[64]; } marg_nfPkInfo; #define mcmd_idcode 21 diff --git a/libmve/mvelibl.cpp b/libmve/mvelibl.cpp index 904d6710..ccbd63ab 100644 --- a/libmve/mvelibl.cpp +++ b/libmve/mvelibl.cpp @@ -55,8 +55,8 @@ extern unsigned sf_ScreenWidth; #include "snd8to16.h" // len always specifies length of destination in bytes. -unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned state); -unsigned sndDecompS16(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(uint16_t *dst, const uint8_t *src, unsigned len, unsigned state); //---------------------------------------------------------------------- // Memory Management @@ -477,14 +477,14 @@ static unsigned sndAddHelper(uint8_t *dst, const uint8_t **pSrc, unsigned len, u if (snd_comp16) { if (!snd_stereo) { if (init) { - state = IntelSwapper(*(unsigned short *)src); - *(unsigned short *)dst = state; + state = IntelSwapper(*(uint16_t *)src); + *(uint16_t *)dst = state; src += 2; dst += 2; len -= 2; } - state = sndDecompM16((unsigned short *)dst, src, len >> 1, state); + state = sndDecompM16((uint16_t *)dst, src, len >> 1, state); src += len >> 1; } else { @@ -495,7 +495,7 @@ static unsigned sndAddHelper(uint8_t *dst, const uint8_t **pSrc, unsigned len, u dst += 4; len -= 4; } - state = sndDecompS16((unsigned short *)dst, src, len >> 2, state); + state = sndDecompS16((uint16_t *)dst, src, len >> 2, state); src += len >> 1; } } else { @@ -617,8 +617,8 @@ unsigned nf_new_w = 0; unsigned nf_new_h = 0; // Hicolor format translation tables -unsigned short nf_trans16_lo[256]; -unsigned short nf_trans16_hi[256]; +uint16_t nf_trans16_lo[256]; +uint16_t nf_trans16_hi[256]; void MVE_memVID(void *p1, void *p2, unsigned size) { 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. // 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); // 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. // 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); //--------------------------------------------------------------------- @@ -963,13 +963,13 @@ void MVE_sfCallbacks(mve_cb_ShowFrame fn_ShowFrame) { sf_ShowFrame = fn_ShowFram // 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); -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); -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 @@ -981,7 +981,7 @@ uint8_t pal_tbl[3 * 256]; // Private, see mveliba.asm #if DBL_DBG uint8_t pal_tbl_old[3 * 256]; #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)) { pal_SetPalette = fn_SetPalette; @@ -1151,8 +1151,8 @@ int MVE_rmStepMovie(void) { } for (;; p = ioNextRecord(), len = 0) { - unsigned short *DecompChg_chgs = (unsigned short *)NULL; - unsigned short *DecompChg_parms = (unsigned short *)NULL; + uint16_t *DecompChg_chgs = (uint16_t *)NULL; + uint16_t *DecompChg_parms = (uint16_t *)NULL; if (!p) { result = MVE_ERR_IO; @@ -1351,11 +1351,11 @@ int MVE_rmStepMovie(void) { } case mcmd_nfChanges: { - DecompChg_chgs = (unsigned short *)p; + DecompChg_chgs = (uint16_t *)p; continue; } case mcmd_nfParms: { - DecompChg_parms = (unsigned short *)p; + DecompChg_parms = (uint16_t *)p; continue; } 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; for (;; p = ioNextRecord(), len = 0) { - unsigned short *DecompChg_parms = (unsigned short *)NULL; + uint16_t *DecompChg_parms = (uint16_t *)NULL; if (!p) { 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: { - DecompChg_parms = (unsigned short *)p; + DecompChg_parms = (uint16_t *)p; continue; } diff --git a/linux/lnxdata.cpp b/linux/lnxdata.cpp index a3e06d93..bef3a7d6 100644 --- a/linux/lnxdata.cpp +++ b/linux/lnxdata.cpp @@ -163,7 +163,7 @@ bool oeLnxAppDatabase::read(const char *label, void *entry, int wordsize) { *((uint8_t *)entry) = (uint8_t)data; break; case 2: - *((unsigned short *)entry) = (unsigned short)data; + *((uint16_t *)entry) = (uint16_t)data; break; case 4: *((uint32_t *)entry) = (uint32_t)data; diff --git a/lnxmvelib/asmstub.c b/lnxmvelib/asmstub.c index 09a5bc51..c50c0055 100644 --- a/lnxmvelib/asmstub.c +++ b/lnxmvelib/asmstub.c @@ -21,13 +21,13 @@ /* These are our global variables for passing values - AH */ /* For _asm_sndDecompM16 */ -unsigned short *sndDecompM16_dst; +uint16_t *sndDecompM16_dst; uint8_t *sndDecompM16_src; uint32_t sndDecompM16_len; uint32_t sndDecompM16_prev; uint32_t sndDecompM16_return; /* For _asm_sndDecompM16 */ -unsigned short *sndDecompS16_dst; +uint16_t *sndDecompS16_dst; uint8_t *sndDecompS16_src; uint32_t sndDecompS16_len; uint32_t sndDecompS16_prev; @@ -72,7 +72,7 @@ int allow_self_modification(void) { } 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_src = src; sndDecompM16_len = len; @@ -81,7 +81,7 @@ unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, uns 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_src = src; 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 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); 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); void nfPkPal(void); 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); void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w, 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); -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); void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops, unsigned dstx, unsigned dsty); @@ -152,12 +152,12 @@ void MVE_gfxSetSplit(unsigned line); #endif 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) { 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) { 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) { 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) { 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) { int3 } diff --git a/lnxmvelib/lnxdraw.cpp b/lnxmvelib/lnxdraw.cpp index 2ac0f89c..538af858 100644 --- a/lnxmvelib/lnxdraw.cpp +++ b/lnxmvelib/lnxdraw.cpp @@ -713,7 +713,7 @@ static int GetXSharedMemory(int size) { inline void BltBuffer32ToPixMap16(uint8_t *pixmap, uint8_t *buffer, int width, int height) { uint8_t *data; - unsigned short int l; + uint16_t int l; int r, g, b, a; 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) { uint8_t *data; - unsigned short int l; + uint16_t int l; int r, g, b, a; 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) { uint8_t *data; - unsigned short int l; + uint16_t int l; int r, g, b, a; - unsigned short c; + uint16_t c; data = (uint8_t *)pixmap; for (l = height * width; l > 0; l--) { - c = *(unsigned short *)buffer; + c = *(uint16_t *)buffer; a = ((c & 0x8000) >> 15); r = ((c & 0x7C00) >> 10); g = ((c & 0x03E0) >> 5); diff --git a/lnxmvelib/lnxdsound.h b/lnxmvelib/lnxdsound.h index e194ecca..9f05b3af 100644 --- a/lnxmvelib/lnxdsound.h +++ b/lnxmvelib/lnxdsound.h @@ -50,13 +50,13 @@ typedef struct { } LnxSoundDevice; typedef struct { - unsigned short wFormatTag; - unsigned short nChannels; + uint16_t wFormatTag; + uint16_t nChannels; uint32_t nSamplesPerSec; uint32_t nAvgBytesPerSec; - unsigned short nBlockAlign; - unsigned short wBitsPerSample; - unsigned short cbSize; + uint16_t nBlockAlign; + uint16_t wBitsPerSample; + uint16_t cbSize; } WAVEFORMATEX; // Taken from Windows for porting #define WAVE_FORMAT_PCM 0x01 @@ -89,7 +89,7 @@ typedef struct { LnxBufferDesc lbdesc; - unsigned short freq; + uint16_t freq; char playing; char __pad; } LnxSoundBuffer; diff --git a/lnxmvelib/mveasm.cpp b/lnxmvelib/mveasm.cpp index 4bc62efc..582d2cec 100644 --- a/lnxmvelib/mveasm.cpp +++ b/lnxmvelib/mveasm.cpp @@ -41,8 +41,8 @@ extern unsigned nf_back_right; // (SHEIGHT-1)*width extern signed short snd_8to16[256]; void nfHPkDecomp(uint8_t *ops, uint8_t *comp, int x, int y, int w, int h); void nfPkConfig(void); -unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned prev); -unsigned sndDecompS16(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(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev); void Trans16Blk(uint8_t *edi, uint8_t *idx); 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) // prev is the previous decompression state or zero. // 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; if (len == 0) 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 // in its low and high order 16-bit halves.) // 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; uint32_t eax, edx, ebx, i; @@ -316,12 +316,12 @@ void nfPkConfig(void) { } } -extern unsigned short nf_trans16_lo[256]; -extern unsigned short nf_trans16_hi[256]; +extern uint16_t nf_trans16_lo[256]; +extern uint16_t nf_trans16_hi[256]; // NOTE: EAX is destroyed after this call (actually the value of // 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_hi[*(idx + 1)]; } @@ -347,7 +347,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w esi = comp; edi = nf.tbuf; - unsigned short swapped = (*(unsigned short *)esi); + uint16_t swapped = (*(uint16_t *)esi); swapped = INTEL_SHORT(swapped); bcomp = swapped + esi; 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 #ifdef OUTRAGE_BIG_ENDIAN typedef struct { - unsigned short hax, ax; + uint16_t hax, ax; } reg_word; typedef struct { int8_t hah, hal, ah, al; } reg_byte; #else typedef struct { - unsigned short ax, hax; + uint16_t ax, hax; } reg_word; typedef struct { 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 #ifdef OUTRAGE_BIG_ENDIAN typedef struct { - unsigned short hax, ax; + uint16_t hax, ax; } reg_word; typedef struct { int8_t hah, hal, ah, al; } reg_byte; #else typedef struct { - unsigned short ax, hax; + uint16_t ax, hax; } reg_word; typedef struct { 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; case 5: { - unsigned short swapper = *(unsigned short *)(esi); + uint16_t swapper = *(uint16_t *)(esi); uint32_t eax = INTEL_SHORT(swapper); esi += 2; 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 uint32_t val1, val2; - unsigned short swapper = *(unsigned short *)(esi); + uint16_t swapper = *(uint16_t *)(esi); val1 = INTEL_SHORT(swapper); esi += 2; @@ -478,10 +478,10 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w } break; case 7: { bool donf23 = false; - unsigned short val; + uint16_t val; int rep_count, max_repcount; - val = *(unsigned short *)esi; + val = *(uint16_t *)esi; val = INTEL_SHORT(val); if (val & 0x8000) { donf23 = true; @@ -579,13 +579,13 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w case 8: { bool donf24 = false; bool donf40 = false; - unsigned short val; + uint16_t val; int rep_count, max_repcount; - val = *(unsigned short *)esi; + val = *(uint16_t *)esi; val = INTEL_SHORT(val); if (val & 0x8000) { - val = *(unsigned short *)(esi + 8); + val = *(uint16_t *)(esi + 8); val = INTEL_SHORT(val); if (val & 0x8000) { donf40 = true; @@ -843,13 +843,13 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w bool donf41 = false; bool donf25 = false; bool donf57 = false; - unsigned short val; + uint16_t val; int rep_count, max_repcount; - val = *(unsigned short *)esi; + val = *(uint16_t *)esi; val = INTEL_SHORT(val); if (val & 0x8000) { - val = *(unsigned short *)(esi + 4); + val = *(uint16_t *)(esi + 4); val = INTEL_SHORT(val); if (val & 0x8000) { donf57 = true; @@ -858,7 +858,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w } } else { - val = *(unsigned short *)(esi + 4); + val = *(uint16_t *)(esi + 4); val = INTEL_SHORT(val); if (val & 0x8000) { donf25 = true; @@ -866,7 +866,7 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w } if (donf57) { - unsigned short colors[4]; + uint16_t colors[4]; max_repcount = 8; 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) { - unsigned short colors[4]; + uint16_t colors[4]; max_repcount = 16; 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) int val1; int rep_count; - unsigned short colors[4]; + uint16_t colors[4]; bool do26 = false; bool do42 = false; - unsigned short swapper = *(unsigned short *)esi; + uint16_t swapper = *(uint16_t *)esi; val1 = INTEL_SHORT(swapper); if (val1 & 0x8000) { - swapper = *(unsigned short *)(esi + 16); + swapper = *(uint16_t *)(esi + 16); val1 = INTEL_SHORT(swapper); if (val1 & 0x8000) { 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) { - *((unsigned short *)(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)]; - *((unsigned short *)(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)]; - *((unsigned short *)(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)]; - *((unsigned short *)(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 + 0)) = nf_trans16_lo[*(idx + 0)] | nf_trans16_hi[*(idx + 1)]; + *((uint16_t *)(edi + 2)) = nf_trans16_lo[*(idx + 2)] | nf_trans16_hi[*(idx + 3)]; + *((uint16_t *)(edi + 4)) = nf_trans16_lo[*(idx + 4)] | nf_trans16_hi[*(idx + 5)]; + *((uint16_t *)(edi + 6)) = nf_trans16_lo[*(idx + 6)] | nf_trans16_hi[*(idx + 7)]; + *((uint16_t *)(edi + 8)) = nf_trans16_lo[*(idx + 8)] | nf_trans16_hi[*(idx + 9)]; + *((uint16_t *)(edi + 10)) = nf_trans16_lo[*(idx + 10)] | nf_trans16_hi[*(idx + 11)]; + *((uint16_t *)(edi + 12)) = nf_trans16_lo[*(idx + 12)] | nf_trans16_hi[*(idx + 13)]; + *((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) { @@ -1542,10 +1542,10 @@ void call_hnfshift(uint32_t meax, uint8_t **medi, uint8_t **mesi, int nfpk_back_ // Non-Implemented Functions //////////////////////////////////////////////// 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); 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); void nfPkPal(void); 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); void mve_ShowFrameFieldHi(uint8_t *buf, unsigned bufw, unsigned bufh, unsigned sx, unsigned sy, unsigned w, 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); -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); void mve_sfPkShowFrameChg(bool prvbuf, unsigned x, unsigned y, unsigned w, unsigned h, uint8_t *ops, unsigned dstx, unsigned dsty); @@ -1583,12 +1583,12 @@ void MVE_gfxSetSplit(unsigned line); #endif 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) { 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) { 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) { 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) { 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) { int3(); } diff --git a/lnxmvelib/mvelibi.h b/lnxmvelib/mvelibi.h index f7d8973b..4c6c1872 100644 --- a/lnxmvelib/mvelibi.h +++ b/lnxmvelib/mvelibi.h @@ -71,9 +71,9 @@ typedef unsigned bool; typedef struct _mve_hdr { char FileType[20]; // MVE_FILE_TYPE - unsigned short HdrSize; // sizeof(mve_hdr) - unsigned short version; // MVE_FILE_VERSION - unsigned short id; // ~MVE_FILE_VERSION+0x1234 + uint16_t HdrSize; // sizeof(mve_hdr) + uint16_t version; // MVE_FILE_VERSION + uint16_t id; // ~MVE_FILE_VERSION+0x1234 } mve_hdr; //------------------------------ @@ -81,8 +81,8 @@ typedef struct _mve_hdr { //------------------------------ typedef struct _io_hdr { - unsigned short len; // Length of record data (pad to even) - unsigned short kind; // See IO_REC_xxx + uint16_t len; // Length of record data (pad to even) + uint16_t kind; // See IO_REC_xxx // uint8_t data[0]; // Record data } ioHdrRec; @@ -104,7 +104,7 @@ typedef struct _io_hdr { #define MCMD_DATA(arg) ((uint8_t *)((arg) + 1)) 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 minor; // Minor opcode // uint8_t data[0]; // Opcode data @@ -117,12 +117,12 @@ typedef struct _mcmd_hdr { #define mcmd_syncInit 2 typedef struct _syncInit { uint32_t period; // period of quanta - unsigned short wait_quanta; // # of quanta per frame + uint16_t wait_quanta; // # of quanta per frame } marg_syncInit; #define mcmd_sndConfigure 3 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 // It indicates that 16-bit data has been compressed to 8-bits. // When it is set, bits16 will also be set. @@ -130,13 +130,13 @@ typedef struct _sndConfigure { // by remaining compressed 8-bit samples. // For stereo, there will be two initial 16-bit samples. // 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 uint8_t bitpadder : 5; #endif uint8_t stereo : 1, bits16 : 1, comp16 : 1; uint8_t dummy1; - unsigned short frequency; + uint16_t frequency; // Minor opcode 1 extends buflen to be a long uint32_t buflen; } marg_sndConfigure; @@ -145,25 +145,25 @@ typedef struct _sndConfigure { #define mcmd_nfConfig 5 typedef struct _nfConfig { - unsigned short wqty; - unsigned short hqty; + uint16_t wqty; + uint16_t hqty; // Minor opcode 1 fields: - unsigned short fqty; + uint16_t fqty; // 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; #define mcmd_nfDecomp 6 #define mcmd_nfDecompChg 16 #define mcmd_nfPkDecomp 17 typedef struct _nfDecomp { - unsigned short prev; // info:Prev frames+1 needed for full picture - unsigned short iframe; // info:Current internal frame # - unsigned short x; - unsigned short y; - unsigned short w; - unsigned short h; - // unsigned short advance:1; + uint16_t prev; // info:Prev frames+1 needed for full picture + uint16_t iframe; // info:Current internal frame # + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; + // uint16_t advance:1; #ifdef OUTRAGE_BIG_ENDIAN uint8_t bitpadder : 7; #endif @@ -177,26 +177,26 @@ typedef struct _nfDecomp { #define mcmd_sfPkShowFrameChg 18 #endif typedef struct _sfShowFrame { - unsigned short pal_start; - unsigned short pal_count; + uint16_t pal_start; + uint16_t pal_count; // 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; #define mcmd_sndAdd 8 #define mcmd_sndSilence 9 typedef struct _sndAdd { - unsigned short iframe; // info: iframe # of sound - unsigned short TrackMask; - unsigned short qty; // Uncompressed audio size in bytes + uint16_t iframe; // info: iframe # of sound + uint16_t TrackMask; + uint16_t qty; // Uncompressed audio size in bytes // uint8_t data[0]; } marg_sndAdd; #define mcmd_gfxMode 10 typedef struct _gfxMode { - unsigned short minw; - unsigned short minh; - unsigned short mode; + uint16_t minw; + uint16_t minh; + uint16_t mode; } marg_gfxMode; #define mcmd_palMakeSynthPalette 11 @@ -211,8 +211,8 @@ typedef struct _palMakeSynthPalette { #define mcmd_palLoadPalette 12 typedef struct _palLoadPalette { - unsigned short start; - unsigned short count; + uint16_t start; + uint16_t count; // uint8_t data[0]; } marg_palLoadPalette; @@ -228,7 +228,7 @@ typedef struct _palLoadPalette { #define mcmd_nfHPkInfo 20 typedef struct _nfPkInfo { uint32_t error; // scaled by 10000 - unsigned short usage[64]; + uint16_t usage[64]; } marg_nfPkInfo; #define mcmd_idcode 21 diff --git a/lnxmvelib/mvelibl.cpp b/lnxmvelib/mvelibl.cpp index 8547f907..81c36782 100644 --- a/lnxmvelib/mvelibl.cpp +++ b/lnxmvelib/mvelibl.cpp @@ -51,8 +51,8 @@ unsigned opt_hscale_adj; #include "snd8to16.h" // len always specifies length of destination in bytes. -unsigned sndDecompM16(unsigned short *dst, const uint8_t *src, unsigned len, unsigned state); -unsigned sndDecompS16(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(uint16_t *dst, const uint8_t *src, unsigned len, unsigned state); 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) if (!snd_stereo) { if (init) { - unsigned short swapper = *(unsigned short *)src; + uint16_t swapper = *(uint16_t *)src; state = INTEL_SHORT(swapper); - *(unsigned short *)dst = state; + *(uint16_t *)dst = state; src += 2; dst += 2; len -= 2; } - state = sndDecompM16((unsigned short *)dst, src, len >> 1, state); + state = sndDecompM16((uint16_t *)dst, src, len >> 1, state); src += len >> 1; } else { @@ -503,7 +503,7 @@ static unsigned sndAddHelper(uint8_t *dst, uint8_t **pSrc, unsigned len, unsigne dst += 4; len -= 4; } - state = sndDecompS16((unsigned short *)dst, src, len >> 2, state); + state = sndDecompS16((uint16_t *)dst, src, len >> 2, state); src += len >> 1; } else { @@ -621,8 +621,8 @@ unsigned nf_new_w; unsigned nf_new_h; // Hicolor format translation tables -unsigned short nf_trans16_lo[256]; -unsigned short nf_trans16_hi[256]; +uint16_t nf_trans16_lo[256]; +uint16_t nf_trans16_hi[256]; void MVE_memVID(void *p1, void *p2, unsigned size) { 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. // 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); // 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. // 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); //--------------------------------------------------------------------- @@ -1000,13 +1000,13 @@ void MVE_sfCallbacks(void (*fn_ShowFrame)(uint8_t *buf, unsigned bufw, unsigned // 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); -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); -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 @@ -1023,7 +1023,7 @@ uint8_t pal_tbl[3 * 256]; // Private, see mveliba.asm #if DBL_DBG uint8_t pal_tbl_old[3 * 256]; #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)) { pal_SetPalette = fn_SetPalette; @@ -1190,8 +1190,8 @@ int MVE_rmStepMovie(void) { } for (;; p = ioNextRecord(), len = 0) { - unsigned short *DecompChg_chgs = (unsigned short *)NULL; - unsigned short *DecompChg_parms = (unsigned short *)NULL; + uint16_t *DecompChg_chgs = (uint16_t *)NULL; + uint16_t *DecompChg_parms = (uint16_t *)NULL; if (!p) { result = MVE_ERR_IO; @@ -1388,11 +1388,11 @@ int MVE_rmStepMovie(void) { } case mcmd_nfChanges: { - DecompChg_chgs = (unsigned short *)p; + DecompChg_chgs = (uint16_t *)p; continue; } case mcmd_nfParms: { - DecompChg_parms = (unsigned short *)p; + DecompChg_parms = (uint16_t *)p; continue; } case mcmd_nfDecompChg: { @@ -1709,7 +1709,7 @@ int MVE_frGet(MVE_frStream frs, uint8_t **pBuf, unsigned *width, unsigned *heigh len = frs->len; for (;; p = ioNextRecord(), len = 0) { - unsigned short *DecompChg_parms = (unsigned short *)NULL; + uint16_t *DecompChg_parms = (uint16_t *)NULL; if (!p) { result = MVE_ERR_IO; @@ -1777,7 +1777,7 @@ int MVE_frGet(MVE_frStream frs, uint8_t **pBuf, unsigned *width, unsigned *heigh } case mcmd_nfParms: { - DecompChg_parms = (unsigned short *)p; + DecompChg_parms = (uint16_t *)p; continue; } diff --git a/mem/mem.cpp b/mem/mem.cpp index 8151aaa3..21cf6bd3 100644 --- a/mem/mem.cpp +++ b/mem/mem.cpp @@ -240,7 +240,7 @@ int Mem_high_water_mark = 0; typedef struct mem_alloc_info { int len; void *ptr; - unsigned short line; + uint16_t line; char file[17]; } mem_alloc_info; @@ -516,7 +516,7 @@ void *mem_malloc_sub(int size, const char *file, int line) { #else mi->ptr = HeapAlloc(Heap, HEAP_NO_SERIALIZE, size + 2); 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); int flen = strlen(file); int lofs = 0; @@ -582,7 +582,7 @@ void mem_free_sub(void *memblock) { if (mynode) { freemem = mynode->data; 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) { // Corrupted memory found when we went to free it. 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]); 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); mem_info[i].len = size; Total_mem_used += size; @@ -851,7 +851,7 @@ void mem_heapcheck(void) { if (mem_info[i].ptr == (void *)MEM_NO_MEMORY_PTR) continue; 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) { 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)); diff --git a/movie/d3movie.cpp b/movie/d3movie.cpp index df0e32e4..3bc424d5 100644 --- a/movie/d3movie.cpp +++ b/movie/d3movie.cpp @@ -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); } - 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; if (hicolor) { - unsigned short *wBuf = (unsigned short *)buf; + uint16_t *wBuf = (uint16_t *)buf; for (int y = 0; y < drawHeight; ++y) { for (int x = 0; x < drawWidth; ++x) { - unsigned short col16 = *wBuf++; + uint16_t col16 = *wBuf++; uint32_t b = ((col16 >> 11) & 0x1F) << 3; uint32_t g = ((col16 >> 5) & 0x3F) << 2; uint32_t r = ((col16 >> 0) & 0x1F) << 3; diff --git a/netcon/includes/Chttpget.h b/netcon/includes/Chttpget.h index 896b874b..4cea18ac 100644 --- a/netcon/includes/Chttpget.h +++ b/netcon/includes/Chttpget.h @@ -84,7 +84,7 @@ class ChttpGet { public: 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); ~ChttpGet(); void GetFile(char *URL, char *localfile); @@ -105,7 +105,7 @@ protected: bool m_ProxyEnabled; char *m_ProxyIP; char m_URL[MAX_URL_LEN]; - unsigned short m_ProxyPort; + uint16_t m_ProxyPort; char m_szUserName[100]; char m_szPassword[100]; diff --git a/netcon/includes/con_dll.h b/netcon/includes/con_dll.h index 70f8dc58..3a883597 100644 --- a/netcon/includes/con_dll.h +++ b/netcon/includes/con_dll.h @@ -789,7 +789,7 @@ bool *DLLUse_DirectPlay; bool *DLLMulti_Gamelist_changed; bool *DLLSupports_score_api; // bool * DLLMulti_no_stats_saved; -unsigned short DLLnw_ListenPort; +uint16_t DLLnw_ListenPort; char szloginid[LOGIN_LEN] = ""; char sztrackerid[TRACKER_ID_LEN] = ""; diff --git a/netcon/includes/mdllinit.h b/netcon/includes/mdllinit.h index c356cb40..3e6afcdc 100644 --- a/netcon/includes/mdllinit.h +++ b/netcon/includes/mdllinit.h @@ -309,7 +309,7 @@ DLLUse_DirectPlay = (bool *)API.vp[22]; DLLDedicated_server = (bool *)API.vp[25]; DLLTCP_active = (BOOL)*API.vp[26]; 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]; DLLPXO_hosted_lobby_name = (char *)API.vp[30]; DLLSupports_score_api = (bool *)API.vp[31]; diff --git a/netcon/inetfile/CFtp.cpp b/netcon/inetfile/CFtp.cpp index c1f8a05e..0745ae72 100644 --- a/netcon/inetfile/CFtp.cpp +++ b/netcon/inetfile/CFtp.cpp @@ -389,7 +389,7 @@ uint32_t CFtpGet::IssuePort() { uint8_t s_b1, s_b2, s_b3, s_b4; } S_un_b; struct { - unsigned short s_w1, s_w2; + uint16_t s_w1, s_w2; } S_un_w; uint32_t S_addr; } S_un; diff --git a/netcon/inetfile/Chttpget.cpp b/netcon/inetfile/Chttpget.cpp index d402c12b..54e94b22 100644 --- a/netcon/inetfile/Chttpget.cpp +++ b/netcon/inetfile/Chttpget.cpp @@ -191,7 +191,7 @@ void ChttpGet::AbortGet() { #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_ProxyIP = proxyip; m_ProxyPort = proxyport; diff --git a/netcon/lanclient/lanclient.cpp b/netcon/lanclient/lanclient.cpp index 8f798181..1b5d221d 100644 --- a/netcon/lanclient/lanclient.cpp +++ b/netcon/lanclient/lanclient.cpp @@ -617,7 +617,7 @@ int MainMultiplayerMenu() { break; case 9: { // Scan a specific IP - unsigned short iport = DEFAULT_GAME_PORT; + uint16_t iport = DEFAULT_GAME_PORT; looklocal = 0; uint32_t iaddr; lastgamesfound = 0; @@ -692,7 +692,7 @@ int MainMultiplayerMenu() { // MTS: only used in this file void AutoLoginAndJoinGame(void) { - unsigned short port; + uint16_t port; uint32_t iaddr; *DLLMultiGameStarting = 0; diff --git a/netgames/dmfc/encryption.cpp b/netgames/dmfc/encryption.cpp index 104f4e10..0370807d 100644 --- a/netgames/dmfc/encryption.cpp +++ b/netgames/dmfc/encryption.cpp @@ -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. // -void IceKey::scheduleBuild(unsigned short *kb, int n, const int *keyrot) { +void IceKey::scheduleBuild(uint16_t *kb, int n, const int *keyrot) { int i; for (i = 0; i < 8; i++) { diff --git a/networking/networking.cpp b/networking/networking.cpp index f6e8f7ac..8be7d7c8 100644 --- a/networking/networking.cpp +++ b/networking/networking.cpp @@ -502,9 +502,9 @@ typedef struct { int waiting_packet_number; // Which packet has data in it that is waiting for the interval to send ushort status; // Status of this connection - unsigned short oursequence; // This is the next sequence number the application is expecting - unsigned short 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 oursequence; // This is the next sequence number the application is expecting + uint16_t theirsequence; // This is the next sequence number the peer is expecting + uint16_t rsequence[MAXNETBUFFERS]; // This is the sequence number of the given packet ubyte ping_pos; @@ -513,7 +513,7 @@ typedef struct { reliable_net_rcvbuffer *rbuffers[MAXNETBUFFERS]; SOCKADDR addr; // SOCKADDR of our peer 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; } 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 void nw_InitSockets(ushort port) { @@ -905,7 +905,7 @@ ushort nw_CalculateChecksum(void *vptr, int len) { } sum2 %= 255; - return (unsigned short)((sum1 << 8) + sum2); + return (uint16_t)((sum1 << 8) + sum2); } // Sends data on an unreliable socket @@ -1477,7 +1477,7 @@ void nw_WorkReliable(ubyte *data, int len, network_address *naddr) { } else { // 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))); savepacket = 0; } diff --git a/scripts/AIGame.cpp b/scripts/AIGame.cpp index 175aae16..90561b5e 100644 --- a/scripts/AIGame.cpp +++ b/scripts/AIGame.cpp @@ -477,8 +477,8 @@ typedef struct humonculous_data { float last_shields; - unsigned short mode; - unsigned short next_mode; + uint16_t mode; + uint16_t next_mode; vector land_pos; vector land_fvec; @@ -503,7 +503,7 @@ private: humonculous_data *memory; 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 DoInterval(int me); bool DoNotify(int me, tOSIRISEventInfo *data); @@ -731,7 +731,7 @@ private: void DoInit(int me); 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, - unsigned short w_id, char f_mask); + uint16_t w_id, char f_mask); void DoFrame(int me); bool DoNotify(int me_handle, tOSIRISEventInfo *data); void SetMode(int me, char mode); @@ -782,7 +782,7 @@ typedef struct { int flags; - unsigned short mantaray_id; + uint16_t mantaray_id; int leader_handle; int num_teammates; @@ -829,7 +829,7 @@ typedef struct { int flags; - unsigned short skiff_id; + uint16_t skiff_id; int leader_handle; int num_teammates; @@ -885,7 +885,7 @@ typedef struct { bool f_hit_by_emd; float mode_time; char last_attack_mode; - unsigned short emd_id; + uint16_t emd_id; int tick_sound; float last_tick_time; @@ -1515,7 +1515,7 @@ typedef struct { 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 bool f_parented; // Buddy will not collide with parent until it isn't parented @@ -1566,7 +1566,7 @@ typedef struct { int amb_camera_handle; float next_powerup_check_time; - unsigned short powerup_ids[6]; + uint16_t powerup_ids[6]; } guidebot_data; class GuideBot : public BaseObjScript { @@ -1668,7 +1668,7 @@ static tThiefItems ThiefableItems[] = { static int numThiefableItems = sizeof(ThiefableItems) / sizeof(tThiefItems); typedef struct { - unsigned short id; + uint16_t id; int owner; } 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); for (i = 0; i < memory->num_stolen_weapons; i++) { - unsigned short id; + uint16_t id; int 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) { amount = 0; 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); 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); - 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"); strcpy(memory->weapon, "Laser Level 1 - Red"); @@ -2277,7 +2277,7 @@ short SuperThief::CallEvent(int event, tOSIRISEventInfo *data) { case EVT_MEMRESTORE: { 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); 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; } -bool Humonculous::SetMode(int me, unsigned short mode) { +bool Humonculous::SetMode(int me, uint16_t mode) { int new_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 :) if (memory->f_pickup == true) { if (it_type == OBJ_PLAYER) { - unsigned short id; + uint16_t id; Obj_Value(evt_collide->it_handle, VF_GET, OBJV_US_ID, &id); if (id == memory->mp_slot) { @@ -6174,7 +6174,7 @@ void GuideBot::DoFrame(int me) { mstruct.objhandle = me; - unsigned short id; + uint16_t id; Obj_Value(me, VF_GET, OBJV_US_ID, &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); DoSteal(me, target_handle, 2, f_success); } else if (target_type == OBJ_ROBOT) { - unsigned short id; + uint16_t id; Obj_Value(target_handle, VF_GET, OBJV_US_ID, &id); 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); for (i = 0; i < memory->num_stolen_weapons; i++) { - unsigned short id; + uint16_t id; int j; for (j = 0; j < memory->stolen_weapons[i].amount; j++) { @@ -7654,7 +7654,7 @@ bool OldScratch::DoSteal(int me, int it) { int room; vector pos; int j; - unsigned short id; + uint16_t id; Obj_Value(me, VF_GET, OBJV_I_ROOMNUM, &room); Obj_Value(me, VF_GET, OBJV_V_POS, &pos); @@ -7986,7 +7986,7 @@ void BarnSwallow::ComputeNest(int me) { vector pos; int room; int type; - unsigned short id; + uint16_t id; memory->num_friends = 0; @@ -8008,7 +8008,7 @@ void BarnSwallow::ComputeNest(int me) { for (i = 0; i < n_scan; i++) { if (scan_objs[i] != me) { 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_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->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[1] = Obj_FindID("buddywingnut"); @@ -8336,7 +8336,7 @@ void GBPowerup::DoInit(int me) { short_id[4] = Obj_FindID("buddyantivirus"); short_id[5] = Obj_FindID("buddyspeed"); - unsigned short id; + uint16_t 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... @@ -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, - unsigned short w_id, char f_mask) { + uint16_t w_id, char f_mask) { memory->start = start; memory->fire = fire; memory->end = end; @@ -9158,7 +9158,7 @@ short Hellion::CallEvent(int event, tOSIRISEventInfo *data) { case EVT_MEMRESTORE: { 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); 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); for (i = 0; i < n_scan; i++) { - unsigned short id; + uint16_t id; Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id); // 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); for (i = 0; i < n_scan; i++) { - unsigned short id; + uint16_t id; Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id); // 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); if (type == OBJ_WEAPON) { - unsigned short id; + uint16_t id; Obj_Value(notify->it_handle, VF_GET, OBJV_US_ID, &id); if (id == memory->emd_id) { @@ -10722,8 +10722,8 @@ void Seeker::DoInit(int me) { 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); - unsigned short id; - unsigned short humon_seeker_id; + uint16_t id; + uint16_t humon_seeker_id; Obj_Value(me, VF_GET, OBJV_US_ID, &id); humon_seeker_id = Obj_FindID("HumonSeeker"); diff --git a/scripts/AIGame3.cpp b/scripts/AIGame3.cpp index 4f43bc2b..ab1784f0 100644 --- a/scripts/AIGame3.cpp +++ b/scripts/AIGame3.cpp @@ -86,32 +86,32 @@ static void AI_SafeSetType(int obj_handle, int ai_type); //---------------- // Name lookup globals -static unsigned short 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 unsigned short 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 unsigned short 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 unsigned short 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 unsigned short shield_blast_id; // weapon ID for the HT shield blast effect -static unsigned short 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 unsigned short 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 unsigned short teleport_effect_id; // weapon ID for teleporting effect +static uint16_t energy_effect_id; // weapon ID for the energy charge effect +static uint16_t frag_burst_effect_id; // weapon ID for the frag burst effect +static uint16_t boss_frag_burst_id; // weapon ID for the boss frag burst effect +static uint16_t transfer_effect_id; // texture ID for the energy transfer lightning effect +static uint16_t heal_effect_id; // texture ID for the heal lightning effect +static uint16_t boss_heal_effect_id; // texture ID for the boss heal lightning effect +static uint16_t tractor_beam_effect_id; // texture ID for the tractor beam effect +static uint16_t alien_organism_id; // object type ID for the alien organism robot +static uint16_t shield_blast_id; // weapon ID for the HT shield blast effect +static uint16_t ht_grenade_id; // weapon ID for the HT grenade +static uint16_t ht_grenade_effect_id; // weapon ID for the HT grenade launch effect +static uint16_t lifter_blast_effect_id; // weapon ID for the lifter blast effect +static uint16_t lifter_stick_effect_id; // texture ID for lifter's night-stick lightning 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 unsigned short boss_turf_id; // turf id -static unsigned short boss_see_id; -static unsigned short boss_hurt_id; +static uint16_t boss_flapping_id; // flapping sound id +static uint16_t boss_turf_id; // turf id +static uint16_t boss_see_id; +static uint16_t boss_hurt_id; -static unsigned short lifter_pull_sound_id; -static unsigned short lifter_amb_sound_id; +static uint16_t lifter_pull_sound_id; +static uint16_t lifter_amb_sound_id; // ========================== // 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); for (i = 0; i < n_scan; i++) { - unsigned short id; + uint16_t id; Obj_Value(scan_objs[i], VF_GET, OBJV_US_ID, &id); // 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 type; - unsigned short id; + uint16_t id; wpn_handle=damage_data->weapon_handle; Obj_Value(wpn_handle, VF_GET, OBJV_US_ID, &id); diff --git a/scripts/Merc4.cpp b/scripts/Merc4.cpp index 50c644e8..83a57ef1 100644 --- a/scripts/Merc4.cpp +++ b/scripts/Merc4.cpp @@ -837,7 +837,7 @@ void aEmitSparks(float num_sparks, int objhandle) { } bool names_looked_up = false; -unsigned short guidebot_id; +uint16_t guidebot_id; #define MAX_SCAN_OBJECTS 20 @@ -861,7 +861,7 @@ void aKillBotsNearObj(int objhandle) { int scan_objs[MAX_SCAN_OBJECTS]; int n_scan; int n, i; - unsigned short id; + uint16_t id; if (!qObjExists(objhandle)) return; diff --git a/scripts/lnx/osiris_common.h b/scripts/lnx/osiris_common.h index f12408c6..b1b3e85c 100644 --- a/scripts/lnx/osiris_common.h +++ b/scripts/lnx/osiris_common.h @@ -929,7 +929,7 @@ typedef int OMMSHANDLE; // define unsigned types; typedef uint8_t ubyte; typedef int8_t sbyte; -typedef unsigned short ushort; +typedef uint16_t ushort; typedef uint32_t uint32_t; typedef uint32_t ddgr_color; diff --git a/scripts/lnx/osiris_vector.h b/scripts/lnx/osiris_vector.h index cc4d4fac..a39687c9 100644 --- a/scripts/lnx/osiris_vector.h +++ b/scripts/lnx/osiris_vector.h @@ -30,7 +30,7 @@ const vector Zero_vector = {0.0f, 0.0f, 0.0f}; #pragma warning(disable : 4244) // Angles are unsigned shorts -typedef unsigned short angle; +typedef uint16_t angle; // The basic fixed-point type 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) *s = FixSin(a); if (c) diff --git a/scripts/osiris_common.h b/scripts/osiris_common.h index 3c0b24e8..7095bb9a 100644 --- a/scripts/osiris_common.h +++ b/scripts/osiris_common.h @@ -930,7 +930,7 @@ typedef int OMMSHANDLE; // define unsigned types; typedef uint8_t ubyte; typedef int8_t sbyte; -typedef unsigned short ushort; +typedef uint16_t ushort; typedef uint32_t uint32_t; typedef uint32_t ddgr_color; diff --git a/scripts/osiris_vector.h b/scripts/osiris_vector.h index 81806739..b6d9fd55 100644 --- a/scripts/osiris_vector.h +++ b/scripts/osiris_vector.h @@ -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) *s = FixSin(a); if (c) diff --git a/sndlib/ddsoundload.cpp b/sndlib/ddsoundload.cpp index 3561c67c..249babba 100644 --- a/sndlib/ddsoundload.cpp +++ b/sndlib/ddsoundload.cpp @@ -121,7 +121,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil CFILE *cfptr; 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 cksize; // Current chunk's size in bytes 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 - fmttag = (unsigned short)cf_ReadShort(cfptr); + fmttag = (uint16_t)cf_ReadShort(cfptr); switch (fmttag) { // We only support WAVE_FORMAT_PCM currently diff --git a/sndlib/ds3dlib.cpp b/sndlib/ds3dlib.cpp index f21ecbaf..17a888f1 100644 --- a/sndlib/ds3dlib.cpp +++ b/sndlib/ds3dlib.cpp @@ -2708,7 +2708,7 @@ void win_llsSystem::SetListener(pos_state *cur_pos) { } // 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; if (!m_f_sound_lib_init) diff --git a/sndlib/ds3dlib.h b/sndlib/ds3dlib.h index 8666cf06..5e629f98 100644 --- a/sndlib/ds3dlib.h +++ b/sndlib/ds3dlib.h @@ -242,8 +242,8 @@ struct tPSBInfo; class sound_buffer_cache { public: 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 - unsigned short m_cur_sounds_played; // Current number of sounds playing + uint16_t m_max_sounds_played; // Maximum sounds played at any given moment + 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) public: @@ -315,7 +315,7 @@ private: private: // 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 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 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) - virtual void AdjustSound(int sound_uid, float f_volume, float f_pan, 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, uint16_t frequency); virtual void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f); // Sample cache and list of samples diff --git a/sndlib/hlsoundlib.cpp b/sndlib/hlsoundlib.cpp index 97ad9962..e197ce84 100644 --- a/sndlib/hlsoundlib.cpp +++ b/sndlib/hlsoundlib.cpp @@ -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; } // 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); } -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 sound_uid; int sound_obj_index; @@ -1348,7 +1348,7 @@ void hlsSystem::SetVolumeObject(int objhandle, float volume) { } // Queued sound functions // 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) return; } diff --git a/sndlib/hlsoundlib.h b/sndlib/hlsoundlib.h index 44ad2483..857ad2d3 100644 --- a/sndlib/hlsoundlib.h +++ b/sndlib/hlsoundlib.h @@ -322,10 +322,10 @@ public: // 2d functions 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, - unsigned short frequency = 22050); + uint16_t frequency = 22050); int Update2dSound(int hlsound_uid, float volume, float pan); @@ -344,7 +344,7 @@ public: float GetMasterVolume(); // 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 KillAllQueues(); diff --git a/sndlib/sdlsound.cpp b/sndlib/sdlsound.cpp index 3d052703..0b5fc1b1 100644 --- a/sndlib/sdlsound.cpp +++ b/sndlib/sdlsound.cpp @@ -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, - 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 @@ -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); } -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; if (sound_device == 0) diff --git a/sndlib/sdlsound.h b/sndlib/sdlsound.h index cb0edf06..ef2ed4a8 100644 --- a/sndlib/sdlsound.h +++ b/sndlib/sdlsound.h @@ -84,7 +84,7 @@ public: void SetListener(pos_state *cur_pos) override; int PlaySound3d(play_information *play_info, int sound_index, pos_state *cur_pos, float master_volume, 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 StopAllSounds() override; diff --git a/sndlib/ssl_lib.h b/sndlib/ssl_lib.h index 372982ab..bbafd35e 100644 --- a/sndlib/ssl_lib.h +++ b/sndlib/ssl_lib.h @@ -504,8 +504,8 @@ public: 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, - bool f_looped, float reverb = 0.5f) = 0; //, unsigned short frequency) - virtual void AdjustSound(int sound_uid, float f_volume, float f_pan, unsigned short frequency) = 0; + bool f_looped, float reverb = 0.5f) = 0; //, uint16_t frequency) + 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 StopAllSounds() = 0; diff --git a/third_party/stb/stb_image_write.h b/third_party/stb/stb_image_write.h index 2ce08974..3662c0f2 100644 --- a/third_party/stb/stb_image_write.h +++ b/third_party/stb/stb_image_write.h @@ -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 return STBIW_ZLIB_COMPRESS(data, data_len, out_len, quality); #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 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 }; unsigned int bitbuf=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, 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; bitCnt += bs[1]; 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; } -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; val = val < 0 ? val-1 : val; bits[1] = 1; @@ -1325,9 +1325,9 @@ static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) { bits[0] = val & ((1<