diff --git a/2dlib/font.cpp b/2dlib/font.cpp index 35aab78e..34e69f83 100644 --- a/2dlib/font.cpp +++ b/2dlib/font.cpp @@ -562,11 +562,11 @@ void grFont::translate_mono_char(grSurface *sf, int x, int y, int index, gr_font switch (sf->bpp()) { case BPP_16: { /* draw one-bit one color. */ - ushort *dest_ptr; - ushort col_w = GR_COLOR_TO_16(GR_RGB(255, 255, 255)); + uint16_t *dest_ptr; + uint16_t col_w = GR_COLOR_TO_16(GR_RGB(255, 255, 255)); int rowsize_w; - dest_ptr = (ushort *)sf->lock(&rowsize); + dest_ptr = (uint16_t *)sf->lock(&rowsize); rowsize_w = sf->rowsize() / 2; dest_ptr += (y * rowsize_w) + x; @@ -723,14 +723,14 @@ uint8_t *grFont::get_kern_info(uint8_t c1, uint8_t c2) { } void grFont::charblt16(grSurface *dsf, ddgr_color col, int dx, int dy, grSurface *ssf, int sx, int sy, int sw, int sh) { - ushort *dbits; - ushort *sbits; + uint16_t *dbits; + uint16_t *sbits; int srowsize_w, drowsize_w, row, coln; - ushort scol = GR_COLOR_TO_16(col); + uint16_t scol = GR_COLOR_TO_16(col); - dbits = (ushort *)dsf->lock(&drowsize_w); + dbits = (uint16_t *)dsf->lock(&drowsize_w); if (dbits) { - sbits = (ushort *)ssf->lock(&srowsize_w); + sbits = (uint16_t *)ssf->lock(&srowsize_w); if (sbits) { srowsize_w >>= 1; // rowsize in shorts drowsize_w >>= 1; diff --git a/2dlib/lib2d.h b/2dlib/lib2d.h index 06764f52..f4248658 100644 --- a/2dlib/lib2d.h +++ b/2dlib/lib2d.h @@ -32,8 +32,8 @@ typedef struct mem_bitmap { char *data; short bpp; int rowsize; - ushort alloced : 2; - ushort flag : 14; + uint16_t alloced : 2; + uint16_t flag : 14; } mem_bitmap; #define MEMFLAG_TRANSBLT 1 diff --git a/2dlib/memsurf.cpp b/2dlib/memsurf.cpp index 2380f100..0f6d5693 100644 --- a/2dlib/memsurf.cpp +++ b/2dlib/memsurf.cpp @@ -122,7 +122,7 @@ bool grMemorySurface::init(int w, int h, int bpp, char *data, int rowsize, unsig ddsfObj.h = h; ddsfObj.bpp = bpp; ddsfObj.type = SURFTYPE_MEMORY; - ddsfObj.flags = (ushort)flags; + ddsfObj.flags = (uint16_t)flags; if (name) strncpy(ddsfObj.name, name, 15); @@ -240,11 +240,11 @@ void gr_mem_surf_Clear(ddgr_surface *dsf, ddgr_color col, int l, int t, int w, i switch (dbm->bpp) { case BPP_16: { - ushort *sptr; - ushort scol; + uint16_t *sptr; + uint16_t scol; - scol = (ushort)GR_COLOR_TO_16(col); - sptr = (ushort *)dbm->data + (t * ((dbm->rowsize) >> 1)); + scol = (uint16_t)GR_COLOR_TO_16(col); + sptr = (uint16_t *)dbm->data + (t * ((dbm->rowsize) >> 1)); for (int y = t; y < (t + h); y++) { for (int x = l; x < (l + w); x++) @@ -314,15 +314,15 @@ bool gr_mem_surf_AttachHandle(ddgr_surface *sf, unsigned handle) { return true; bool gr_bm_mem_Blt16(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh) { mem_bitmap *dbm = (mem_bitmap *)dsf->obj, *sbm = (mem_bitmap *)ssf->obj; - ushort *dbits; - ushort *sbits; + uint16_t *dbits; + uint16_t *sbits; int srowsize_w, drowsize_w, row, col; // set up blt. srowsize_w = sbm->rowsize >> 1; // rowsize in shorts drowsize_w = dbm->rowsize >> 1; - dbits = (ushort *)dbm->data + (dy * drowsize_w) + dx; - sbits = (ushort *)sbm->data + (sy * srowsize_w) + sx; + dbits = (uint16_t *)dbm->data + (dy * drowsize_w) + dx; + sbits = (uint16_t *)sbm->data + (sy * srowsize_w) + sx; for (row = 0; row < sh; row++) { for (col = 0; col < sw; col++) @@ -336,15 +336,15 @@ bool gr_bm_mem_Blt16(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int s bool gr_bm_mem_Blt16ck(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh) { mem_bitmap *dbm = (mem_bitmap *)dsf->obj, *sbm = (mem_bitmap *)ssf->obj; - ushort *dbits; - ushort *sbits; + uint16_t *dbits; + uint16_t *sbits; int srowsize_w, drowsize_w, row, col; // set up blt. srowsize_w = sbm->rowsize >> 1; // rowsize in shorts drowsize_w = dbm->rowsize >> 1; - dbits = (ushort *)dbm->data + (dy * drowsize_w) + dx; - sbits = (ushort *)sbm->data + (sy * srowsize_w) + sx; + dbits = (uint16_t *)dbm->data + (dy * drowsize_w) + dx; + sbits = (uint16_t *)sbm->data + (sy * srowsize_w) + sx; for (row = 0; row < sh; row++) { for (col = 0; col < sw; col++) { diff --git a/2dlib/surface.cpp b/2dlib/surface.cpp index 7ecfe351..ed8cd5ca 100644 --- a/2dlib/surface.cpp +++ b/2dlib/surface.cpp @@ -158,8 +158,8 @@ void grSurface::create(int w, int h, int bpp, unsigned type, unsigned flags, con ddsfObj.w = w; ddsfObj.h = h; ddsfObj.bpp = bpp; - ddsfObj.type = (ushort)type; - ddsfObj.flags = (ushort)flags; + ddsfObj.type = (uint16_t)type; + ddsfObj.flags = (uint16_t)flags; if (name) strncpy(ddsfObj.name, name, 15); @@ -408,9 +408,9 @@ void grSurface::replace_color(ddgr_color sc, ddgr_color dc) { switch (ddsfObj.bpp) { case BPP_16: { - ushort *data = (ushort *)m_DataPtr; + uint16_t *data = (uint16_t *)m_DataPtr; int rowsize_w = m_DataRowsize / 2; - ushort scc = XLAT_RGB_TO_16(sc), dcc = XLAT_RGB_TO_16(dc); + uint16_t scc = XLAT_RGB_TO_16(sc), dcc = XLAT_RGB_TO_16(dc); for (int y = 0; y < ddsfObj.h; y++) { for (int x = 0; x < ddsfObj.w; x++) @@ -550,14 +550,14 @@ void grSurface::xlat8_16(char *data, int w, int h, char *pal) { /* copy from 8bit source bitmap to destination surface just created and locked */ - ushort *dptr; + uint16_t *dptr; char *sptr; int row, col; int rowsize_w; int height, width; uint8_t *upal = (uint8_t *)pal; - dptr = (ushort *)m_DataPtr; + dptr = (uint16_t *)m_DataPtr; sptr = (char *)data; rowsize_w = m_DataRowsize / 2; @@ -571,7 +571,7 @@ void grSurface::xlat8_16(char *data, int w, int h, char *pal) { int r = upal[spix * 3] >> 3; int g = upal[spix * 3 + 1] >> 2; int b = upal[spix * 3 + 2] >> 3; - ushort destpix = (r << 11) | (g << 5) | b; + uint16_t destpix = (r << 11) | (g << 5) | b; dptr[col] = destpix; } else @@ -588,7 +588,7 @@ void grSurface::xlat16_16(char *data, int w, int h, int format) { This function performs scaling if the source width and height don't match that of the destinations - JL */ - ushort *sptr, *dptr; + uint16_t *sptr, *dptr; int row, col; int rowsize_w; int height, width; @@ -596,8 +596,8 @@ void grSurface::xlat16_16(char *data, int w, int h, int format) { fix ystep = IntToFix(h) / ddsfObj.h; fix fu = 0, fv = 0; - dptr = (ushort *)m_DataPtr; - sptr = (ushort *)data; + dptr = (uint16_t *)m_DataPtr; + sptr = (uint16_t *)data; rowsize_w = m_DataRowsize / 2; height = ddsfObj.h; @@ -633,20 +633,20 @@ void grSurface::xlat16_16(char *data, int w, int h, int format) { } void grSurface::xlat16_24(char *data, int w, int h) { - ushort *sptr; + uint16_t *sptr; char *dptr; int scol, dcol, row; int height, width; dptr = (char *)m_DataPtr; - sptr = (ushort *)data; + sptr = (uint16_t *)data; height = SET_MIN(h, ddsfObj.h); width = SET_MIN(w, ddsfObj.w); for (row = 0; row < height; row++) { dcol = 0; for (scol = 0; scol < width; scol++) { - ushort pix; + uint16_t pix; ddgr_color new_color; char r, g, b; pix = sptr[scol]; @@ -668,11 +668,11 @@ void grSurface::xlat16_24(char *data, int w, int h) { void grSurface::xlat24_16(char *data, int w, int h) { char *sptr; - ushort *dptr; + uint16_t *dptr; int scol, dcol, row; int rowsize_w, height, width; - dptr = (ushort *)m_DataPtr; + dptr = (uint16_t *)m_DataPtr; sptr = (char *)data; rowsize_w = m_DataRowsize / 2; height = SET_MIN(h, ddsfObj.h); @@ -681,12 +681,12 @@ void grSurface::xlat24_16(char *data, int w, int h) { for (row = 0; row < height; row++) { scol = 0; for (dcol = 0; dcol < width; dcol++) { - ushort pix; + uint16_t pix; char r, g, b; r = sptr[scol++]; g = sptr[scol++]; b = sptr[scol++]; - pix = ((ushort)(r >> 3) << 11) + ((ushort)(g >> 2) << 5) + ((ushort)(b >> 3)); + pix = ((uint16_t)(r >> 3) << 11) + ((uint16_t)(g >> 2) << 5) + ((uint16_t)(b >> 3)); dptr[dcol] = pix; } sptr += (w * 3); @@ -696,13 +696,13 @@ void grSurface::xlat24_16(char *data, int w, int h) { void grSurface::xlat32_16(char *data, int w, int h) { unsigned *sptr; - ushort *dptr; + uint16_t *dptr; int col, row; int rowsize_w, height, width; ASSERT((w % 4) == 0); - dptr = (ushort *)m_DataPtr; + dptr = (uint16_t *)m_DataPtr; sptr = (unsigned *)data; rowsize_w = m_DataRowsize / 2; height = SET_MIN(h, ddsfObj.h); @@ -711,12 +711,12 @@ void grSurface::xlat32_16(char *data, int w, int h) { for (row = 0; row < height; row++) { for (col = 0; col < width; col++) { unsigned pix; - ushort spix; + uint16_t spix; pix = sptr[col]; - spix = (ushort)(pix & 0x000000f8) >> 3; - spix |= (ushort)(pix & 0x0000fc00) >> 5; - spix |= (ushort)(pix & 0x00f80000) >> 8; + spix = (uint16_t)(pix & 0x000000f8) >> 3; + spix |= (uint16_t)(pix & 0x0000fc00) >> 5; + spix |= (uint16_t)(pix & 0x00f80000) >> 8; dptr[col] = spix; } sptr += w; diff --git a/Descent3/DllWrappers.cpp b/Descent3/DllWrappers.cpp index e4f26ff7..392ec542 100644 --- a/Descent3/DllWrappers.cpp +++ b/Descent3/DllWrappers.cpp @@ -320,7 +320,7 @@ char *dInven_GetPosName(Inventory *inven) { return inven->GetPosName(); } // return information about the current position item // return true if it is a real object -bool dInven_GetPosInfo(Inventory *inven, ushort &iflags, int &flags) { return inven->GetPosInfo(iflags, flags); } +bool dInven_GetPosInfo(Inventory *inven, uint16_t &iflags, int &flags) { return inven->GetPosInfo(iflags, flags); } // returns the count of the item at the current position int dInven_GetPosCount(Inventory *inven) { return inven->GetPosCount(); } diff --git a/Descent3/DllWrappers.h b/Descent3/DllWrappers.h index 4a034209..953cf1f4 100644 --- a/Descent3/DllWrappers.h +++ b/Descent3/DllWrappers.h @@ -146,7 +146,7 @@ char *dInven_GetPosIconName(Inventory *inven); char *dInven_GetPosName(Inventory *inven); // return information about the current position item // return true if it is a real object -bool dInven_GetPosInfo(Inventory *inven, ushort &iflags, int &flags); +bool dInven_GetPosInfo(Inventory *inven, uint16_t &iflags, int &flags); // returns the count of the item at the current position int dInven_GetPosCount(Inventory *inven); // returns true if the position pointer is at the begining of the inventory list diff --git a/Descent3/Inventory.cpp b/Descent3/Inventory.cpp index be154aee..e9294f36 100644 --- a/Descent3/Inventory.cpp +++ b/Descent3/Inventory.cpp @@ -1264,7 +1264,7 @@ int Inventory::GetPosCount(void) { // return information about the current position item // returns true if the pos is a real object in the game // returns false if the pos is just a type/id inventory item -bool Inventory::GetPosInfo(ushort &iflags, int &flags) { +bool Inventory::GetPosInfo(uint16_t &iflags, int &flags) { if (!pos) { iflags = 0; flags = 0; diff --git a/Descent3/Inventory.h b/Descent3/Inventory.h index 22154661..c842e5bc 100644 --- a/Descent3/Inventory.h +++ b/Descent3/Inventory.h @@ -214,7 +214,7 @@ typedef struct tInvenInfo { char *icon_name; char *name; int flags; - ushort iflags; // Inventory item flags + uint16_t iflags; // Inventory item flags int type; int id; } tInvenInfo; @@ -228,7 +228,7 @@ typedef struct inven_item { // if INVF_OBJECT, this is -1 int oid; // countermeasure powerup id int flags; // misc flags - ushort pad2; // keep alignment + uint16_t pad2; // keep alignment int count; // how many of this type/id (not INVF_OBJECT) @@ -236,7 +236,7 @@ typedef struct inven_item { char *icon_name; char *name; - ushort iflags; // Inventory item flags + uint16_t iflags; // Inventory item flags inven_item *next, *prev; // pointer to next inventory item } inven_item; @@ -288,7 +288,7 @@ public: char *GetPosName(void); // return information about the current position item // return true if it is a real object - bool GetPosInfo(ushort &iflags, int &flags); + bool GetPosInfo(uint16_t &iflags, int &flags); // returns the count of the item at the current position int GetPosCount(void); // returns true if the position pointer is at the begining of the inventory list diff --git a/Descent3/LoadLevel.cpp b/Descent3/LoadLevel.cpp index 6bcb2a93..2f4d1d7e 100644 --- a/Descent3/LoadLevel.cpp +++ b/Descent3/LoadLevel.cpp @@ -1320,7 +1320,7 @@ char *LocalizeLevelName(char *level); // Lightmap remap array int Num_lightmap_infos_read = 0; -ushort LightmapInfoRemap[MAX_LIGHTMAP_INFOS]; +uint16_t LightmapInfoRemap[MAX_LIGHTMAP_INFOS]; // Arrays for mapping saved data to the current data short texture_xlate[MAX_TEXTURES]; @@ -1639,7 +1639,7 @@ int ReadObject(CFILE *ifile, object *objp, int handle, int fileversion) { if (fileversion >= 101) flags = cf_ReadInt(ifile); else - flags = (ushort)cf_ReadShort(ifile); + flags = (uint16_t)cf_ReadShort(ifile); // Make sure no objects except viewers have the outside mine flags set ASSERT((type == OBJ_VIEWER) || !(flags & OF_OUTSIDE_MINE)); @@ -1815,7 +1815,7 @@ int ReadObject(CFILE *ifile, object *objp, int handle, int fileversion) { for (t = 0; t < num_faces; t++) { if (submodel_changed == 0 && model_changed == 0) { lightmap_object_face *fp = &objp->lm_object.lightmap_faces[i][t]; - fp->lmi_handle = LightmapInfoRemap[(ushort)cf_ReadShort(ifile)]; + fp->lmi_handle = LightmapInfoRemap[(uint16_t)cf_ReadShort(ifile)]; if (!Dedicated_server) LightmapInfo[fp->lmi_handle].used++; @@ -2043,7 +2043,7 @@ int ReadFace(CFILE *ifile, face *fp, int version) { fp->flags &= ~FF_LIGHTMAP; } else { // Read lightmap info handle - int lmi_handle = (ushort)cf_ReadShort(ifile); + int lmi_handle = (uint16_t)cf_ReadShort(ifile); if (!Dedicated_server) { fp->lmi_handle = LightmapInfoRemap[lmi_handle]; LightmapInfo[fp->lmi_handle].used++; @@ -2134,7 +2134,7 @@ int ReadFace(CFILE *ifile, face *fp, int version) { for (i = 0; i < num; i++) { cf_ReadVector(ifile, ¢er); - ushort color = cf_ReadShort(ifile); + uint16_t color = cf_ReadShort(ifile); SpecialFaces[fp->special_handle].spec_instance[i].bright_center = center; SpecialFaces[fp->special_handle].spec_instance[i].bright_color = color; @@ -2283,7 +2283,7 @@ int WriteCompressionByte(CFILE *fp, uint8_t *val, int total, int just_count, int // Does a RLE compression run of the values given the short array 'val'. // If just_count is 1, doesn't write anything -int WriteCompressionShort(CFILE *fp, ushort *val, int total, int just_count, int compress) { +int WriteCompressionShort(CFILE *fp, uint16_t *val, int total, int just_count, int compress) { int done = 0, written = 0; int curptr = 0; @@ -2314,7 +2314,7 @@ int WriteCompressionShort(CFILE *fp, ushort *val, int total, int just_count, int ASSERT(curptr < total); - ushort curval = val[curptr]; + uint16_t curval = val[curptr]; uint8_t count = 1; while ((curptr + count) < total && val[curptr + count] == curval && count < 250) @@ -2354,7 +2354,7 @@ void CheckToWriteCompressByte(CFILE *fp, uint8_t *vals, int total) { // Given an array of values, checks to see if it would be better to write it out // as a raw array or RLE array -void CheckToWriteCompressShort(CFILE *fp, ushort *vals, int total) { +void CheckToWriteCompressShort(CFILE *fp, uint16_t *vals, int total) { int count = WriteCompressionShort(fp, vals, total, 1, COMPRESS); if (count >= total) @@ -2396,7 +2396,7 @@ void ReadCompressionByte(CFILE *fp, uint8_t *vals, int total) { } } -void ReadCompressionShort(CFILE *fp, ushort *vals, int total) { +void ReadCompressionShort(CFILE *fp, uint16_t *vals, int total) { int count = 0; uint8_t compressed = cf_ReadByte(fp); @@ -2414,13 +2414,13 @@ void ReadCompressionShort(CFILE *fp, ushort *vals, int total) { if (command == 0) // next byte is raw { - ushort height = cf_ReadShort(fp); + uint16_t height = cf_ReadShort(fp); vals[count] = height; count++; } else if (command >= 2 && command <= 250) // next pixel is run of pixels { - ushort height = cf_ReadShort(fp); + uint16_t height = cf_ReadShort(fp); for (int k = 0; k < command; k++) { vals[count] = height; count++; @@ -2669,7 +2669,7 @@ void ReadNewLightmapChunk(CFILE *fp, int version) { return; } - ushort *lightmap_remap = (ushort *)mem_malloc(MAX_LIGHTMAPS * sizeof(ushort)); + uint16_t *lightmap_remap = (uint16_t *)mem_malloc(MAX_LIGHTMAPS * sizeof(uint16_t)); nummaps = cf_ReadInt(fp); @@ -2691,7 +2691,7 @@ void ReadNewLightmapChunk(CFILE *fp, int version) { int lm_handle = lm_AllocLightmap(w, h); lightmap_remap[i] = lm_handle; - ushort *data = (ushort *)lm_data(lm_handle); + uint16_t *data = (uint16_t *)lm_data(lm_handle); ReadCompressionShort(fp, data, w * h); } @@ -2765,10 +2765,10 @@ void ReadLightmapChunk(CFILE *fp, int version) { int nummaps; int i, t; - ushort *ded_dummy_data = NULL; + uint16_t *ded_dummy_data = NULL; if (Dedicated_server) { - ded_dummy_data = (ushort *)mem_malloc(128 * 128 * 2); + ded_dummy_data = (uint16_t *)mem_malloc(128 * 128 * 2); ASSERT(ded_dummy_data); } @@ -2835,12 +2835,12 @@ void ReadLightmapChunk(CFILE *fp, int version) { LightmapInfo[lmi].normal.z = 1; } - ushort *data; + uint16_t *data; if (Dedicated_server) data = ded_dummy_data; else - data = (ushort *)lm_data(LightmapInfo[lmi].lm_handle); + data = (uint16_t *)lm_data(LightmapInfo[lmi].lm_handle); if (version <= 37) { for (t = 0; t < w * h; t++) @@ -2852,7 +2852,7 @@ void ReadLightmapChunk(CFILE *fp, int version) { // Adjust lightmap data to account for our new 1555 format if (version < 64) { for (t = 0; t < w * h; t++) { - ushort pixel = data[t]; + uint16_t pixel = data[t]; if (pixel == 0x07e0) pixel = NEW_TRANSPARENT_COLOR; @@ -3389,7 +3389,7 @@ void ReadTerrainTmapFlagChunk(CFILE *fp, int version) { } } else { uint8_t *byte_vals = (uint8_t *)mem_malloc(TERRAIN_DEPTH * TERRAIN_WIDTH); - ushort *short_vals = (ushort *)mem_malloc(2 * TERRAIN_DEPTH * TERRAIN_WIDTH); + uint16_t *short_vals = (uint16_t *)mem_malloc(2 * TERRAIN_DEPTH * TERRAIN_WIDTH); if (version < 102) { // Read tmap1 @@ -4232,7 +4232,7 @@ int WriteObject(CFILE *ofile, object *objp) { for (t = 0; t < objp->lm_object.num_faces[i]; t++) { lightmap_object_face *fp = &objp->lm_object.lightmap_faces[i][t]; ASSERT(LightmapInfoRemap[fp->lmi_handle] != BAD_LMI_INDEX); - cf_WriteShort(ofile, (ushort)LightmapInfoRemap[fp->lmi_handle]); + cf_WriteShort(ofile, (uint16_t)LightmapInfoRemap[fp->lmi_handle]); cf_WriteVector(ofile, &fp->rvec); cf_WriteVector(ofile, &fp->uvec); @@ -4305,7 +4305,7 @@ int WriteFace(CFILE *ofile, face *fp) { // Write UV2's ASSERT(LightmapInfoRemap[fp->lmi_handle] != BAD_LMI_INDEX); - cf_WriteShort(ofile, (ushort)LightmapInfoRemap[fp->lmi_handle]); + cf_WriteShort(ofile, (uint16_t)LightmapInfoRemap[fp->lmi_handle]); for (i = 0; i < fp->num_verts; i++) { cf_WriteFloat(ofile, fp->face_uvls[i].u2); @@ -4841,7 +4841,7 @@ void WriteTerrainTmapChunk(CFILE *fp) { int i; uint8_t *byte_vals = (uint8_t *)mem_malloc(TERRAIN_DEPTH * TERRAIN_WIDTH); - ushort *short_vals = (ushort *)mem_malloc(2 * TERRAIN_DEPTH * TERRAIN_WIDTH); + uint16_t *short_vals = (uint16_t *)mem_malloc(2 * TERRAIN_DEPTH * TERRAIN_WIDTH); int start_pos; start_pos = StartChunk(fp, CHUNK_TERRAIN_TMAPS_FLAGS); @@ -4883,7 +4883,7 @@ void WriteLightmapChunk(CFILE *fp) { int lightmap_info_count = 0; int lightmap_count = 0; - ushort *lightmap_remap = (ushort *)mem_malloc(MAX_LIGHTMAPS * sizeof(ushort)); + uint16_t *lightmap_remap = (uint16_t *)mem_malloc(MAX_LIGHTMAPS * sizeof(uint16_t)); uint8_t *lightmap_spoken_for = (uint8_t *)mem_malloc(MAX_LIGHTMAPS); ASSERT(lightmap_remap); @@ -4926,7 +4926,7 @@ void WriteLightmapChunk(CFILE *fp) { cf_WriteShort(fp, w); cf_WriteShort(fp, h); - ushort *data = lm_data(LightmapInfo[i].lm_handle); + uint16_t *data = lm_data(LightmapInfo[i].lm_handle); ASSERT(data != NULL); CheckToWriteCompressShort(fp, data, w * h); diff --git a/Descent3/Mission.h b/Descent3/Mission.h index cb1869fc..dfbb158c 100644 --- a/Descent3/Mission.h +++ b/Descent3/Mission.h @@ -194,7 +194,7 @@ const unsigned LVLFLAG_STARTMOVIE = 1, LVLFLAG_ENDMOVIE = 2, LVLFLAG_BRIEFING = LVLFLAG_SCORE = 256, LVLFLAG_FINAL = 512; const int LVLOBJ_NUM = 4; -const ushort LVLOBJF_SECONDARY1 = 1, LVLOBJF_SECONDARY2 = 2, LVLOBJF_SECONDARY3 = 4, LVLOBJF_SECONDARY4 = 8; +const uint16_t LVLOBJF_SECONDARY1 = 1, LVLOBJF_SECONDARY2 = 2, LVLOBJF_SECONDARY3 = 4, LVLOBJF_SECONDARY4 = 8; // Struct for info about the current level typedef struct level_info { diff --git a/Descent3/OsirisLoadandBind.cpp b/Descent3/OsirisLoadandBind.cpp index b8dd2941..c68f9f6b 100644 --- a/Descent3/OsirisLoadandBind.cpp +++ b/Descent3/OsirisLoadandBind.cpp @@ -470,7 +470,7 @@ typedef struct tRefObj { typedef struct { uint8_t flags; uint8_t extracted_id; - ushort reference_count; + uint16_t reference_count; InitializeDLL_fp InitializeDLL; ShutdownDLL_fp ShutdownDLL; GetGOScriptID_fp GetGOScriptID; @@ -494,15 +494,15 @@ static tOSIRISModule OSIRIS_loaded_modules[MAX_LOADED_MODULES]; tOSIRISModuleInit Osiris_module_init; struct { bool level_loaded; - ushort num_customs; - ushort dll_id; + uint16_t num_customs; + uint16_t dll_id; int *custom_ids; int *custom_handles; void *instance; } tOSIRISCurrentLevel; struct { bool mission_loaded; - ushort dll_id; + uint16_t dll_id; } tOSIRISCurrentMission; #define OESF_USED 0x0001 @@ -2268,7 +2268,7 @@ bool Osiris_CallEvent(object *obj, int event, tOSIRISEventInfo *data) { #define OITF_LEVELTIMER 0x0008 #define OITF_CANCELONDEAD 0x0010 typedef struct { - ushort flags; + uint16_t flags; union { int objhandle; int trignum; @@ -3328,7 +3328,7 @@ OMMSHANDLE OMMS_Find(uint32_t unique_identifier,char *script_identifier); // Returns information about the OMMS memory given it's handle returned from the OMMS_Find() or // OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in; // Pass NULL in for those parameters you don't need information about. -char OMMS_GetInfo(OMMSHANDLE handle,uint32_t *mem_size,uint32_t *uid,ushort *reference_count,uint8_t *has_free_been_called); +char OMMS_GetInfo(OMMSHANDLE handle,uint32_t *mem_size,uint32_t *uid,uint16_t *reference_count,uint8_t *has_free_been_called); ****************************************************************************** @@ -3411,7 +3411,7 @@ static OMMSHANDLE Osiris_OMMS_Find(uint32_t unique_identifier, char *script_iden // Returns information about the OMMS memory given it's handle returned from the OMMS_Find() or // OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in; // Pass NULL in for those parameters you don't need information about. -static char Osiris_OMMS_GetInfo(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, ushort *reference_count, +static char Osiris_OMMS_GetInfo(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, uint16_t *reference_count, uint8_t *has_free_been_called); void Osiris_InitOMMS(void) { @@ -3541,7 +3541,7 @@ void Osiris_RestoreOMMS(CFILE *file) { node->id = (uint16_t)cf_ReadShort(file); node->free_called = (cf_ReadByte(file)) ? true : false; - node->reference_count = (ushort)cf_ReadShort(file); + node->reference_count = (uint16_t)cf_ReadShort(file); node->unique_id = cf_ReadInt(file); node->size_of_memory = cf_ReadInt(file); if (node->size_of_memory) { @@ -3869,7 +3869,7 @@ OMMSHANDLE Osiris_OMMS_Find(uint32_t unique_identifier, char *script_identifier) // Returns information about the OMMS memory given it's handle returned from the OMMS_Find() or // OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in; // Pass NULL in for those parameters you don't need information about. -char Osiris_OMMS_GetInfo(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, ushort *reference_count, +char Osiris_OMMS_GetInfo(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, uint16_t *reference_count, uint8_t *has_free_been_called) { if (mem_size) *mem_size = 0; diff --git a/Descent3/PilotPicsAPI.cpp b/Descent3/PilotPicsAPI.cpp index 923089f6..50e3c22b 100644 --- a/Descent3/PilotPicsAPI.cpp +++ b/Descent3/PilotPicsAPI.cpp @@ -114,7 +114,7 @@ static int PPic_GetIndexFromID(int id); // Purpose: // Returns the file offset of the given pilot id. -1 if not found // ------------------------------------- -static int PPic_GetOffsetByID(ushort pilot_id); +static int PPic_GetOffsetByID(uint16_t pilot_id); //=========================================================================== @@ -210,7 +210,7 @@ void PPic_CloseDatabase(void) { // Given a pilot callsign it will search the database // and return the number of pilots that match the name // --------------------------------------------------------- -ushort PPic_QueryPilot(char *pilot_name) { +uint16_t PPic_QueryPilot(char *pilot_name) { if (!PilotPic_init) return 0; @@ -237,8 +237,8 @@ ushort PPic_QueryPilot(char *pilot_name) { name_buffer[name_size] = '\0'; // next read in pilot_id - ushort pilot_id; - pilot_id = (ushort)cf_ReadShort(file); + uint16_t pilot_id; + pilot_id = (uint16_t)cf_ReadShort(file); // next read past the bitmap name uint8_t bmp_size; @@ -266,7 +266,7 @@ ushort PPic_QueryPilot(char *pilot_name) { // if it couldn't find any pilots matching. It returns // the pilot id. // ---------------------------------------------------------- -bool PPic_FindFirst(char *pilot_name, ushort *pilot_id) { +bool PPic_FindFirst(char *pilot_name, uint16_t *pilot_id) { if (!PilotPic_init) return false; @@ -291,8 +291,8 @@ bool PPic_FindFirst(char *pilot_name, ushort *pilot_id) { name_buffer[name_size] = '\0'; // next read in pilot_id - ushort pid; - pid = (ushort)cf_ReadShort(file); + uint16_t pid; + pid = (uint16_t)cf_ReadShort(file); // next read past the bitmap name uint8_t bmp_size; @@ -317,7 +317,7 @@ bool PPic_FindFirst(char *pilot_name, ushort *pilot_id) { // an initial call to PPic_FindFirst(). It returns the // pilot id. // ---------------------------------------------------------- -bool PPic_FindNext(ushort *pilot_id) { +bool PPic_FindNext(uint16_t *pilot_id) { if (!PilotPic_init) return false; @@ -341,8 +341,8 @@ bool PPic_FindNext(ushort *pilot_id) { name_buffer[name_size] = '\0'; // next read in pilot_id - ushort pid; - pid = (ushort)cf_ReadShort(file); + uint16_t pid; + pid = (uint16_t)cf_ReadShort(file); // next read past the bitmap name uint8_t bmp_size; @@ -375,7 +375,7 @@ void PPic_FindClose(void) { // Given a pilot id, it will return the pilot name of // the pilot name. Returns false if it's an invalid pilot id. // ---------------------------------------------------------- -bool PPic_GetPilot(ushort pilot_id, char *pilot_name, int buffersize) { +bool PPic_GetPilot(uint16_t pilot_id, char *pilot_name, int buffersize) { if (!PilotPic_init) return false; @@ -417,7 +417,7 @@ bool PPic_GetPilot(ushort pilot_id, char *pilot_name, int buffersize) { // bm_FreeBitmap(). Returns -1 if it was an illegal pilot id. // Returns BAD_BITMAP_HANDLE if it couldn't open the bitmap. // ---------------------------------------------------------- -int PPic_GetBitmapHandle(ushort pilot_id) { +int PPic_GetBitmapHandle(uint16_t pilot_id) { if (!PilotPic_init) return -1; @@ -448,8 +448,8 @@ int PPic_GetBitmapHandle(ushort pilot_id) { name_buffer[name_size] = '\0'; // next read in pilot_id - ushort pid; - pid = (ushort)cf_ReadShort(PilotPic_database_index_handle); + uint16_t pid; + pid = (uint16_t)cf_ReadShort(PilotPic_database_index_handle); // next read past the bitmap name uint8_t bmp_size; @@ -472,10 +472,10 @@ int PPic_GetBitmapHandle(ushort pilot_id) { // this maps a pilot_id to an index file offset typedef struct { int offset; - ushort id; + uint16_t id; } tPilotPicIdOffset; tPilotPicIdOffset *Pilot_id_to_offset = NULL; -ushort *Sorted_Pilot_id_to_offset = NULL; +uint16_t *Sorted_Pilot_id_to_offset = NULL; int PilotPic_count = 0; // this maps the alphabet to an index file offset (first pilot_name that begins with the letter) @@ -517,7 +517,7 @@ bool PPic_BuildDatabases(void) { // allocate all the memory we're going to need // ------------------------------------------- Pilot_id_to_offset = (tPilotPicIdOffset *)mem_malloc(sizeof(tPilotPicIdOffset) * PilotPic_count); - Sorted_Pilot_id_to_offset = (ushort *)mem_malloc(sizeof(ushort) * PilotPic_count); + Sorted_Pilot_id_to_offset = (uint16_t *)mem_malloc(sizeof(uint16_t) * PilotPic_count); if (!Pilot_id_to_offset) { // out of memory!!! mprintf((0, "PPIC: Out of memory allocating index database\n")); @@ -551,8 +551,8 @@ bool PPic_BuildDatabases(void) { } // next read in pilot_id - ushort pilot_id; - pilot_id = (ushort)cf_ReadShort(file); + uint16_t pilot_id; + pilot_id = (uint16_t)cf_ReadShort(file); // next read past the bitmap name uint8_t bmp_size; @@ -668,8 +668,8 @@ int PPic_JumpToPilot(char *pilot_name) { name_buffer[name_size] = '\0'; // next read in pilot_id - ushort pilot_id; - pilot_id = (ushort)cf_ReadShort(file); + uint16_t pilot_id; + pilot_id = (uint16_t)cf_ReadShort(file); // next read past the bitmap name uint8_t bmp_size; @@ -707,7 +707,7 @@ int PPic_JumpToPilot(char *pilot_name) { // Purpose: // Returns the file offset of the given pilot id. -1 if not found // ------------------------------------- -int PPic_GetOffsetByID(ushort pilot_id) { +int PPic_GetOffsetByID(uint16_t pilot_id) { int index = PPic_GetIndexFromID(pilot_id); if (index == -1) return -1; diff --git a/Descent3/PilotPicsAPI.h b/Descent3/PilotPicsAPI.h index 59108481..2e9fa500 100644 --- a/Descent3/PilotPicsAPI.h +++ b/Descent3/PilotPicsAPI.h @@ -56,7 +56,7 @@ void PPic_CloseDatabase(void); // Given a pilot callsign it will search the database // and return the number of pilots that match the name // --------------------------------------------------------- -ushort PPic_QueryPilot(char *pilot_name); +uint16_t PPic_QueryPilot(char *pilot_name); // --------------------------------------------------------- // PPic_FindFirst @@ -66,7 +66,7 @@ ushort PPic_QueryPilot(char *pilot_name); // if it couldn't find any pilots matching. It returns // the pilot id. // ---------------------------------------------------------- -bool PPic_FindFirst(char *pilot_name, ushort *pilot_id); +bool PPic_FindFirst(char *pilot_name, uint16_t *pilot_id); // ---------------------------------------------------------- // PPic_FindNext @@ -76,7 +76,7 @@ bool PPic_FindFirst(char *pilot_name, ushort *pilot_id); // an initial call to PPic_FindFirst(). It returns the // pilot id. // ---------------------------------------------------------- -bool PPic_FindNext(ushort *pilot_id); +bool PPic_FindNext(uint16_t *pilot_id); // ---------------------------------------------------------- // PPic_FindClose @@ -91,7 +91,7 @@ void PPic_FindClose(void); // Given a pilot id, it will return the pilot name of // the pilot name. Returns false if it's an invalid pilot id. // ---------------------------------------------------------- -bool PPic_GetPilot(ushort pilot_id, char *pilot_name, int buffersize); +bool PPic_GetPilot(uint16_t pilot_id, char *pilot_name, int buffersize); // ---------------------------------------------------------- // PPic_GetBitmapHandle @@ -101,6 +101,6 @@ bool PPic_GetPilot(ushort pilot_id, char *pilot_name, int buffersize); // bm_FreeBitmap(). Returns -1 if it was an illegal pilot id. // Returns BAD_BITMAP_HANDLE if it couldn't open the bitmap. // ---------------------------------------------------------- -int PPic_GetBitmapHandle(ushort pilot_id); +int PPic_GetBitmapHandle(uint16_t pilot_id); #endif diff --git a/Descent3/Player.cpp b/Descent3/Player.cpp index a45238ef..8711352a 100644 --- a/Descent3/Player.cpp +++ b/Descent3/Player.cpp @@ -2999,7 +2999,7 @@ void PlayerSpewInventory(object *obj, bool spew_energy_and_shield, bool spew_non // Spew out the inventory items object *temp_obj; - ushort inven_flags; + uint16_t inven_flags; int object_flags; bool spew_it; diff --git a/Descent3/TelCom.cpp b/Descent3/TelCom.cpp index 21cf67cd..958dd5a1 100644 --- a/Descent3/TelCom.cpp +++ b/Descent3/TelCom.cpp @@ -969,15 +969,15 @@ void TelCom_BltToScreen(int dx, int dy, chunked_bitmap *src_bmp, int sx, int sy, } void TelCom_BltToMem(int dest_bmp, int dx, int dy, int src_bmp, int sx, int sy, int sw, int sh, bool trans) { - ushort *dbits; - ushort *sbits; + uint16_t *dbits; + uint16_t *sbits; int srowsize_w, drowsize_w, row, col; // set up blt. srowsize_w = bm_w(src_bmp, 0); // rowsize in shorts drowsize_w = bm_w(dest_bmp, 0); - dbits = (ushort *)bm_data(dest_bmp, 0) + (dy * drowsize_w) + dx; - sbits = (ushort *)bm_data(src_bmp, 0) + (sy * srowsize_w) + sx; + dbits = (uint16_t *)bm_data(dest_bmp, 0) + (dy * drowsize_w) + dx; + sbits = (uint16_t *)bm_data(src_bmp, 0) + (sy * srowsize_w) + sx; if (trans) { for (row = 0; row < sh; row++) { @@ -1049,7 +1049,7 @@ int LoadTelcomBitmap(const char *filename, chunked_bitmap *chunk) { // make monitor windows transparent menutga_LoadHotSpotMap(bm_handle, IGNORE_TABLE(HOTSPOT_DISPLAY), &hotspotmap, &windowmap); - ushort *data = bm_data(bm_handle, 0); + uint16_t *data = bm_data(bm_handle, 0); int wnd, x, y, bmw; int bord_left, bord_right, bord_top, bord_bottom; @@ -2056,7 +2056,7 @@ void TelcomCreateScanLine(void) { int start_pixel; start_pixel = 0; - ushort *data = bm_data(scanline_handle, 0); + uint16_t *data = bm_data(scanline_handle, 0); int x, y; for (y = 0; y < 32; y++) { @@ -2125,11 +2125,11 @@ void TelcomCreateStaticOverlays(void) { int saturation = 10; int result; float amount; - ushort *data[8]; + uint16_t *data[8]; amount = ((float)saturation) * 0.4f; - ushort def_color = OPAQUE_FLAG | GR_RGB16(24, 255, 0); + uint16_t def_color = OPAQUE_FLAG | GR_RGB16(24, 255, 0); size = 64 * 64; for (i = 0; i < 4; i++) { @@ -2269,7 +2269,7 @@ void TelcomInitPowerEffect(void) { return; int i; - ushort *bmpdata = bm_data(PowerBmps[0], 0); + uint16_t *bmpdata = bm_data(PowerBmps[0], 0); for (i = 0; i < 32 * 32; i++) bmpdata[i] = OPAQUE_FLAG | GR_RGB(0, 0, 0); diff --git a/Descent3/TelComAutoMap.cpp b/Descent3/TelComAutoMap.cpp index a21d3c1f..1e4486e0 100644 --- a/Descent3/TelComAutoMap.cpp +++ b/Descent3/TelComAutoMap.cpp @@ -192,7 +192,7 @@ static float AM_pitch; int AM_terrain = 0, AM_realign = 0, AM_center_on_player = 0, AM_current_marker; static int Num_AM_rooms; -static ushort AM_room_list[MAX_ROOMS]; +static uint16_t AM_room_list[MAX_ROOMS]; static uint8_t AM_rooms_seen[MAX_ROOMS]; static g3Point *AM_rotated_points = NULL; //[MAX_VERTS_PER_ROOM]; @@ -508,7 +508,7 @@ void TCAMRenderRoom(int roomnum) { // Color this face from the lightmaps if (!black_face && !wacky_face && (fp->flags & FF_LIGHTMAP)) { int lm_handle = LightmapInfo[fp->lmi_handle].lm_handle; - ushort *data = (ushort *)lm_data(lm_handle); + uint16_t *data = (uint16_t *)lm_data(lm_handle); int w = lm_w(lm_handle); int h = lm_h(lm_handle); @@ -523,7 +523,7 @@ void TCAMRenderRoom(int roomnum) { int int_u = u; int int_v = v; - ushort texel = data[int_v * w + int_u]; + uint16_t texel = data[int_v * w + int_u]; int r = (texel >> 10) & 0x1f; int g = (texel >> 5) & 0x1f; @@ -603,7 +603,7 @@ void TCAMReadControls() { if (AM_heading >= 65536) AM_heading -= 65536; - vm_AnglesToMatrix(&newmat, (ushort)AM_pitch, (ushort)AM_heading, 0); + vm_AnglesToMatrix(&newmat, (uint16_t)AM_pitch, (uint16_t)AM_heading, 0); AM_view_orient = newmat; vm_Orthogonalize(&AM_view_orient); diff --git a/Descent3/TelComEffects.cpp b/Descent3/TelComEffects.cpp index edf71e0f..c29ad919 100644 --- a/Descent3/TelComEffects.cpp +++ b/Descent3/TelComEffects.cpp @@ -1218,8 +1218,8 @@ bool CreateBmpStretch(tceffect *tce, const char *filename) { realy = 0; int wi, hi; - ushort *srcdata = bm_data(tce->bmpinfo.bm_handle, 0); - ushort *destdata; + uint16_t *srcdata = bm_data(tce->bmpinfo.bm_handle, 0); + uint16_t *destdata; realx = 0; realy = 0; diff --git a/Descent3/TelComGoals.cpp b/Descent3/TelComGoals.cpp index 63af847f..0f77b0a6 100644 --- a/Descent3/TelComGoals.cpp +++ b/Descent3/TelComGoals.cpp @@ -611,7 +611,7 @@ void TCGoalsRenderCallback(void) { if (TG_MouseOffset_x == -1) { // determine bottom-right x/y of mouse cursor - ushort *data = bm_data(TC_cursor, 0); + uint16_t *data = bm_data(TC_cursor, 0); int width = bm_w(TC_cursor, 0); int index = width * bm_h(TC_cursor, 0) - 1; while (index > 0 && (!(data[index] & OPAQUE_FLAG))) @@ -702,7 +702,7 @@ bool TelComGoalStatus(tTelComInfo *tcs) { if (bm_handle <= BAD_BITMAP_HANDLE) { bm_handle = bm_AllocBitmap(32, 32, 0); if (bm_handle > BAD_BITMAP_HANDLE) { - ushort *data = bm_data(bm_handle, 0); + uint16_t *data = bm_data(bm_handle, 0); for (int i = 0; i < 1024; i++) { data[i] = GR_RGB16(0, 0, 0) | OPAQUE_FLAG; } diff --git a/Descent3/TelcomEffectsRender.cpp b/Descent3/TelcomEffectsRender.cpp index a6e0222f..40b432e8 100644 --- a/Descent3/TelcomEffectsRender.cpp +++ b/Descent3/TelcomEffectsRender.cpp @@ -411,7 +411,7 @@ void RenderBmpStatic(tceffect *tce, float frametime, int xoff, int yoff, bool ok BltBmpToScreen(tce->pos_x + glitch_dx + xoff, tce->pos_y + glitch_dy + yoff, &tce->bmpinfo.chunk_bmp); tce->age += frametime; } -void BlurBitmapArea(ushort *srcbm, ushort *dstbm, short width, short height, short startx, short starty, short bmw) { +void BlurBitmapArea(uint16_t *srcbm, uint16_t *dstbm, short width, short height, short startx, short starty, short bmw) { int pixel_count, blue_total, red_total, green_total; pixel_count = width * height; blue_total = red_total = green_total = 0; @@ -429,7 +429,7 @@ void BlurBitmapArea(ushort *srcbm, ushort *dstbm, short width, short height, sho green_total += GR_COLOR_GREEN(GR_16_TO_COLOR(srcbm[pos])); } } - ushort col; + uint16_t col; if (red_total + green_total + blue_total) col = OPAQUE_FLAG | GR_RGB16(red_total / pixel_count, green_total / pixel_count, blue_total / pixel_count); else @@ -462,7 +462,7 @@ void RenderBmpBlur(tceffect *tce, float frametime, int xoff, int yoff, bool ok_t if ((tce->flags == TC_BMPF_IN) && (tce->bmpinfo.stage > BLUR_STAGES)) done = true; - ushort *src, *dest; + uint16_t *src, *dest; int rowsize, w, h; if (!done) { @@ -493,7 +493,7 @@ void RenderBmpBlur(tceffect *tce, float frametime, int xoff, int yoff, bool ok_t int how_many_across = tce->bmpinfo.chunk_bmp.w; int bh = tce->bmpinfo.chunk_bmp.ph; int bw = tce->bmpinfo.chunk_bmp.pw; - ushort *src_data = bm_data(dbm_handle, 0); + uint16_t *src_data = bm_data(dbm_handle, 0); for (y = 0; y < bh; y++) { for (x = 0; x < bw; x++) { int piece_y = y / dim; @@ -501,8 +501,8 @@ void RenderBmpBlur(tceffect *tce, float frametime, int xoff, int yoff, bool ok_t int sub_x = x % dim; int sub_y = y % dim; int bm = tce->bmpinfo.chunk_bmp.bm_array[piece_y * how_many_across + piece_x]; - ushort *dest_data = bm_data(bm, 0); - ushort pix = src_data[y * bw + x]; + uint16_t *dest_data = bm_data(bm, 0); + uint16_t pix = src_data[y * bw + x]; dest_data[sub_y * dim + sub_x] = pix; } } @@ -535,7 +535,7 @@ void RenderBmpScanline(tceffect *tce, float frametime, int xoff, int yoff, bool int x, y; int sbm_handle = tce->bmpinfo.bm_handle; int dbm_handle = tce->bmpinfo.temp_bmhandle; - ushort *src, *dest; + uint16_t *src, *dest; int rowsize, w, h, xx, yy, stage; float k; if (dbm_handle == BAD_BITMAP_HANDLE) @@ -596,7 +596,7 @@ void RenderBmpScanline(tceffect *tce, float frametime, int xoff, int yoff, bool int how_many_across = tce->bmpinfo.chunk_bmp.w; int bh = tce->bmpinfo.chunk_bmp.ph; int bw = tce->bmpinfo.chunk_bmp.pw; - ushort *src_data = bm_data(dbm_handle, 0); + uint16_t *src_data = bm_data(dbm_handle, 0); int x, y; for (y = 0; y < bh; y++) { for (x = 0; x < bw; x++) { @@ -605,8 +605,8 @@ void RenderBmpScanline(tceffect *tce, float frametime, int xoff, int yoff, bool int sub_x = x % dim; int sub_y = y % dim; int bm = tce->bmpinfo.chunk_bmp.bm_array[piece_y * how_many_across + piece_x]; - ushort *dest_data = bm_data(bm, 0); - ushort pix = src_data[y * bw + x]; + uint16_t *dest_data = bm_data(bm, 0); + uint16_t pix = src_data[y * bw + x]; dest_data[sub_y * dim + sub_x] = pix; } } @@ -663,10 +663,10 @@ void RenderBmpInvert(tceffect *tce, float frametime, int xoff, int yoff, bool ok shift = 7; break; } - ushort *src_data = bm_data(srcbmph, 0); - ushort *sdata; - ushort *ddata; - ushort pix; + uint16_t *src_data = bm_data(srcbmph, 0); + uint16_t *sdata; + uint16_t *ddata; + uint16_t pix; int maxx, maxy; int windex, hindex; int s_y, s_x, d_y, d_x; diff --git a/Descent3/TerrainSearch.cpp b/Descent3/TerrainSearch.cpp index d86f0ca2..53fc118b 100644 --- a/Descent3/TerrainSearch.cpp +++ b/Descent3/TerrainSearch.cpp @@ -233,7 +233,7 @@ static int EvaluateBlock(int x, int z, int lod); -ushort TS_FrameCount = 0xFFFF; +uint16_t TS_FrameCount = 0xFFFF; static int SearchQuadTree(int x1, int y1, int x2, int y2, int dir, int *ccount); int GlobalTransCount = 0; @@ -260,8 +260,8 @@ static vector TS_FVectorAdd, TS_RVectorAdd; static uint8_t Terrain_y_flags[256]; static vector Terrain_y_cache[256]; -static ushort LOD_sort_bucket[MAX_TERRAIN_LOD][MAX_CELLS_TO_RENDER]; -static ushort LOD_sort_num[MAX_TERRAIN_LOD]; +static uint16_t LOD_sort_bucket[MAX_TERRAIN_LOD][MAX_CELLS_TO_RENDER]; +static uint16_t LOD_sort_num[MAX_TERRAIN_LOD]; // Variable to determine if we're in editor or game extern function_mode View_mode; @@ -390,7 +390,7 @@ void Terrain_start_frame(vector *eye, matrix *view_orient) { } memset(Terrain_y_flags, 0, 256); - memset(LOD_sort_num, 0, MAX_TERRAIN_LOD * sizeof(ushort)); + memset(LOD_sort_num, 0, MAX_TERRAIN_LOD * sizeof(uint16_t)); PreRotateTerrain(); } diff --git a/Descent3/aistruct.h b/Descent3/aistruct.h index 8b344671..2b84fd92 100644 --- a/Descent3/aistruct.h +++ b/Descent3/aistruct.h @@ -485,10 +485,10 @@ typedef struct ain_hear { #define AIP_MOVE_LIST 2 typedef struct ai_path_info { - ushort cur_path; - ushort cur_node; + uint16_t cur_path; + uint16_t cur_node; - ushort num_paths; + uint16_t num_paths; int goal_uid; // which goal generated this path int goal_index; @@ -498,9 +498,9 @@ typedef struct ai_path_info { uint8_t path_type[MAX_JOINED_PATHS]; // Used for static game paths - ushort path_start_node[MAX_JOINED_PATHS]; - ushort path_end_node[MAX_JOINED_PATHS]; - ushort path_flags[MAX_JOINED_PATHS]; + uint16_t path_start_node[MAX_JOINED_PATHS]; + uint16_t path_end_node[MAX_JOINED_PATHS]; + uint16_t path_flags[MAX_JOINED_PATHS]; } ai_path_info; // Used for predefined move lists (off of normal static paths) diff --git a/Descent3/bsp.h b/Descent3/bsp.h index d5f18775..398ede16 100644 --- a/Descent3/bsp.h +++ b/Descent3/bsp.h @@ -78,8 +78,8 @@ typedef struct { typedef struct bspnode { uint8_t type; bspplane plane; - ushort node_facenum; - ushort node_roomnum; + uint16_t node_facenum; + uint16_t node_roomnum; int8_t node_subnum; bspnode *front; diff --git a/Descent3/cockpit.cpp b/Descent3/cockpit.cpp index 3e6a0f7e..f8658bc6 100644 --- a/Descent3/cockpit.cpp +++ b/Descent3/cockpit.cpp @@ -589,7 +589,7 @@ float KeyframeAnimateCockpit() { ////////////////////////////////////////////////////////////////////////////// // // returns the submodel number of the monitor requested -bsp_info *CockpitGetMonitorSubmodel(ushort monitor_flag) { +bsp_info *CockpitGetMonitorSubmodel(uint16_t monitor_flag) { int i; ASSERT(Cockpit_info.model_num > -1); for (i = 0; i < Poly_models[Cockpit_info.model_num].n_models; i++) { diff --git a/Descent3/cockpit.h b/Descent3/cockpit.h index 4a5356ef..80de41f0 100644 --- a/Descent3/cockpit.h +++ b/Descent3/cockpit.h @@ -98,7 +98,7 @@ void QuickOpenCockpit(); void QuickCloseCockpit(); // returns the submodel number of the monitor requested -bsp_info *CockpitGetMonitorSubmodel(ushort monitor_flag); +bsp_info *CockpitGetMonitorSubmodel(uint16_t monitor_flag); // returns the polymodel for the hud poly_model *CockpitGetPolyModel(); diff --git a/Descent3/config.cpp b/Descent3/config.cpp index 5a4b20f6..3190cea0 100644 --- a/Descent3/config.cpp +++ b/Descent3/config.cpp @@ -566,7 +566,7 @@ static void config_gamma() { if (gamma_bitmap <= 0) { gamma_bitmap = 0; } else { - ushort *dest_data = (ushort *)bm_data(gamma_bitmap, 0); + uint16_t *dest_data = (uint16_t *)bm_data(gamma_bitmap, 0); int addval = 0; int i, t; @@ -1082,7 +1082,7 @@ struct hud_menu { // sets the menu up. newuiSheet *setup(newuiMenu *menu) { int y, sel; - ushort stat, grstat; + uint16_t stat, grstat; sheet = menu->AddOption(IDV_HCONFIG, TXT_OPTHUD, NEWUIMENU_MEDIUM); parent_menu = menu; @@ -1121,8 +1121,8 @@ struct hud_menu { // retreive values from property sheet here. void finish() { int sel; - ushort hud_new_stat = STAT_MESSAGES + STAT_CUSTOM; - ushort hud_new_grstat = 0; + uint16_t hud_new_stat = STAT_MESSAGES + STAT_CUSTOM; + uint16_t hud_new_grstat = 0; sel = *ship_status; if (sel == 1) diff --git a/Descent3/config.h b/Descent3/config.h index 33a23beb..57affa7c 100644 --- a/Descent3/config.h +++ b/Descent3/config.h @@ -146,8 +146,8 @@ extern tGameToggles Game_toggles; #define RES_1600X1200 6 // stored resolution list and desired game resolution typedef struct tVideoResolution { - ushort width; - ushort height; + uint16_t width; + uint16_t height; } tVideoResolution; extern tVideoResolution Video_res_list[]; diff --git a/Descent3/credits.cpp b/Descent3/credits.cpp index cb8ba81d..535f1acd 100644 --- a/Descent3/credits.cpp +++ b/Descent3/credits.cpp @@ -117,7 +117,7 @@ typedef struct creditline { uint8_t type; char *text; creditline *next; - ushort startx, starty, endx, endy; + uint16_t startx, starty, endx, endy; float displaytime; } creditline; diff --git a/Descent3/ctlconfig.cpp b/Descent3/ctlconfig.cpp index 6c398e7a..7ff72d1a 100644 --- a/Descent3/ctlconfig.cpp +++ b/Descent3/ctlconfig.cpp @@ -737,7 +737,7 @@ void wpnsel_cfg_screen::process(int res) { // do different uis if (do_disable_ui) { ASSERT(m_selection_status == -1 && slot != -1); - ushort wpnidx = is_secondary ? GetAutoSelectSecondaryWpnIdx(slot) : GetAutoSelectPrimaryWpnIdx(slot); + uint16_t wpnidx = is_secondary ? GetAutoSelectSecondaryWpnIdx(slot) : GetAutoSelectPrimaryWpnIdx(slot); wpnidx = wpnidx ^ WPNSEL_SKIP; if (is_secondary) { SetAutoSelectSecondaryWpnIdx(slot, wpnidx); @@ -750,7 +750,7 @@ void wpnsel_cfg_screen::process(int res) { // see if the user has selected another (in the same category) // else if (do_swap_ui) { - ushort wpnidx; + uint16_t wpnidx; if (slot != -1) { if (m_selection_status == -1) { m_switch_slot = slot; @@ -774,7 +774,7 @@ void wpnsel_cfg_screen::process(int res) { } } else { int slot_idx = m_switch_slot; - ushort new_wpnidx = + uint16_t new_wpnidx = is_secondary ? GetAutoSelectSecondaryWpnIdx(m_switch_slot) : GetAutoSelectPrimaryWpnIdx(m_switch_slot); ASSERT(m_switch_slot != -1); @@ -1081,7 +1081,7 @@ int weapon_select_dialog(int wpn, bool is_secondary) { newuiListBox *lbox; newuiSheet *sheet; int res, i; - ushort retval; + uint16_t retval; wpn &= (~WPNSEL_SKIP); wnd.Create(NULL, 0, 0, 320, 288); sheet = wnd.GetSheet(); diff --git a/Descent3/d3serial.h b/Descent3/d3serial.h index 2f839d35..530d336e 100644 --- a/Descent3/d3serial.h +++ b/Descent3/d3serial.h @@ -42,7 +42,8 @@ #ifndef __SERIALIZE_H_ #define __SERIALIZE_H_ -#include +#include +#include #define DESC_ID_LEN 40 // how long the id string can be #define DESC_CHECKSUM_LEN 4 // checksum is 4 bytes diff --git a/Descent3/damage.cpp b/Descent3/damage.cpp index 79a67931..1c202bcb 100644 --- a/Descent3/damage.cpp +++ b/Descent3/damage.cpp @@ -1451,9 +1451,9 @@ void ShakePlayer() { float mag = Shake_magnitude; - ushort pitch_adjust = ((ps_rand() % 5) - 2) * mag; - ushort bank_adjust = ((ps_rand() % 5) - 2) * mag; - ushort heading_adjust = ((ps_rand() % 5) - 2) * mag; + uint16_t pitch_adjust = ((ps_rand() % 5) - 2) * mag; + uint16_t bank_adjust = ((ps_rand() % 5) - 2) * mag; + uint16_t heading_adjust = ((ps_rand() % 5) - 2) * mag; matrix m, tempm; Old_player_orient = Player_object->orient; diff --git a/Descent3/debuggraph.cpp b/Descent3/debuggraph.cpp index a0465c59..1a472b5e 100644 --- a/Descent3/debuggraph.cpp +++ b/Descent3/debuggraph.cpp @@ -275,7 +275,7 @@ void DebugGraph_Render(void) { // create the bitmap graph_bmp = bm_AllocBitmap(64, 64, 0); if (graph_bmp > BAD_BITMAP_HANDLE) { - ushort *data = bm_data(graph_bmp, 0); + uint16_t *data = bm_data(graph_bmp, 0); for (int i = 0; i < 64 * 64; i++) { data[i] = GR_RGB16(0, 0, 0) | OPAQUE_FLAG; } diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index 54afa1c6..0c65c523 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -150,7 +150,7 @@ static char Dummy_dedicated_string[_MAX_PATH]; // If true, allow remote connections static int Dedicated_allow_remote = 0; -static ushort Dedicated_listen_port = 2092; +static uint16_t Dedicated_listen_port = 2092; static char dedicated_telnet_password[65]; static int Dedicated_num_teams = 1; @@ -830,7 +830,7 @@ SOCKET dedicated_listen_socket = INVALID_SOCKET; #define DEDICATED_LOGIN_PROMPT TXT_DS_ENTERPASS -void InitDedicatedSocket(ushort port) { +void InitDedicatedSocket(uint16_t port) { SOCKADDR_IN sock_addr; memset(&sock_addr, 0, sizeof(SOCKADDR_IN)); diff --git a/Descent3/demofile.cpp b/Descent3/demofile.cpp index 0708e63a..a0c6ed71 100644 --- a/Descent3/demofile.cpp +++ b/Descent3/demofile.cpp @@ -518,7 +518,7 @@ void DemoWriteChangedObjects() { } } -void DemoWriteObjCreate(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle, +void DemoWriteObjCreate(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle, object *obj) { if (Demo_flags == DF_RECORDING) { @@ -552,7 +552,7 @@ void DemoWriteTurretChanged(uint16_t objnum) { Demo_turretchanged[objnum] = true void DemoReadTurretChanged(void) { multi_turret multi_turret_info; int objnum; - ushort num_turrets; + uint16_t num_turrets; float turr_time; int count = 0; float do_time; @@ -672,7 +672,7 @@ void DemoRead2DSound(void) { Sound_system.Play2dSound(soundidx, volume); } -void DemoWrite3DSound(short soundidx, ushort objnum, int priority, float volume) { +void DemoWrite3DSound(short soundidx, uint16_t objnum, int priority, float volume) { cf_WriteByte(Demo_cfp, DT_3D_SOUND); cf_WriteShort(Demo_cfp, objnum); cf_WriteShort(Demo_cfp, soundidx); @@ -1311,7 +1311,7 @@ void DemoWriteCinematics(uint8_t *data, uint16_t len) { void DemoReadCinematics() { uint8_t buffer[1500]; - ushort len = cf_ReadShort(Demo_cfp); + uint16_t len = cf_ReadShort(Demo_cfp); cf_ReadBytes(buffer, len, Demo_cfp); mprintf((0, "Reading Cinematic data from demo file.\n")); Cinematic_DoDemoFileData(buffer); @@ -1334,7 +1334,7 @@ extern void MultiDoMSafeFunction(uint8_t *data); void DemoReadMSafe() { uint8_t buffer[1500]; - ushort len = cf_ReadShort(Demo_cfp); + uint16_t len = cf_ReadShort(Demo_cfp); cf_ReadBytes(buffer, len, Demo_cfp); // mprintf((0,"Reading MSAFE data from demo file.\n")); MultiDoMSafeFunction(buffer); @@ -1344,7 +1344,7 @@ extern void MultiDoMSafePowerup(uint8_t *data); void DemoReadPowerups() { uint8_t buffer[1500]; - ushort len = cf_ReadShort(Demo_cfp); + uint16_t len = cf_ReadShort(Demo_cfp); cf_ReadBytes(buffer, len, Demo_cfp); MultiDoMSafePowerup(buffer); } diff --git a/Descent3/fireball.cpp b/Descent3/fireball.cpp index 44029261..a77a8e4b 100644 --- a/Descent3/fireball.cpp +++ b/Descent3/fireball.cpp @@ -693,13 +693,13 @@ void InitFireballs() { } // convert the grey spark into grayscale - ushort *data; + uint16_t *data; int size; float recip32 = 1.0f / 32.0f; data = bm_data(Fireballs[GRAY_SPARK_INDEX].bm_handle, 0); size = bm_w(Fireballs[GRAY_SPARK_INDEX].bm_handle, 0) * bm_h(Fireballs[GRAY_SPARK_INDEX].bm_handle, 0); for (i = 0; i < size; i++) { - ushort col565 = data[i]; + uint16_t col565 = data[i]; if (col565 == 0x07e0) { data[i] = NEW_TRANSPARENT_COLOR; } else { diff --git a/Descent3/gamecinematics.cpp b/Descent3/gamecinematics.cpp index 25c5d8ce..7bfaeac4 100644 --- a/Descent3/gamecinematics.cpp +++ b/Descent3/gamecinematics.cpp @@ -371,7 +371,7 @@ void Cinematic_Init(void) { gc_fade_bmp_handle = bm_AllocBitmap(32, 32, 0); if (gc_fade_bmp_handle > BAD_BITMAP_HANDLE) { - ushort *data = bm_data(gc_fade_bmp_handle, 0); + uint16_t *data = bm_data(gc_fade_bmp_handle, 0); int i, size = 32 * 32; for (i = 0; i < size; i++) @@ -382,7 +382,7 @@ void Cinematic_Init(void) { gc_fadewhite_bmp_handle = bm_AllocBitmap(32, 32, 0); if (gc_fadewhite_bmp_handle > BAD_BITMAP_HANDLE) { - ushort *data = bm_data(gc_fadewhite_bmp_handle, 0); + uint16_t *data = bm_data(gc_fadewhite_bmp_handle, 0); int i, size = 32 * 32; for (i = 0; i < size; i++) @@ -794,7 +794,7 @@ bool Cinematic_StartCine(tGameCinematic *info, const char *text_string, int came // create overlay bitmap GameCinema.bmp_handle = bm_AllocBitmap(128, 128, 0); if (GameCinema.bmp_handle > BAD_BITMAP_HANDLE) { - ushort *data = bm_data(GameCinema.bmp_handle, 0); + uint16_t *data = bm_data(GameCinema.bmp_handle, 0); for (int j = 0; j < 128 * 128; j++) { data[j] = GR_RGB16(0, 0, 0) | OPAQUE_FLAG; } @@ -1634,7 +1634,7 @@ void Cinematic_DoEndTransition(void) { if (gc_temp_bmp_handle > BAD_BITMAP_HANDLE) { float fade_out_perc = 1.0f - ((perc - CUTOFF) / (1.0f - CUTOFF)); int grey = 255.0f * fade_out_perc; - ushort *data = bm_data(gc_temp_bmp_handle, 0); + uint16_t *data = bm_data(gc_temp_bmp_handle, 0); int i, size = 32 * 32; for (i = 0; i < size; i++) diff --git a/Descent3/gamesave.cpp b/Descent3/gamesave.cpp index 26eb6c37..f90a9bd2 100644 --- a/Descent3/gamesave.cpp +++ b/Descent3/gamesave.cpp @@ -1253,7 +1253,7 @@ void SGSObjAI(CFILE *fp, const ai_frame *ai) { //@@// write out thread data if necessary //@@ if (script->thread) { //@@ const vector *mem = D3XGetThreadMem(script->thread->mem_handle); -//@@ ushort mem_size = script->thread->prog->map[script->thread->prog_idx].mem; +//@@ uint16_t mem_size = script->thread->prog->map[script->thread->prog_idx].mem; //@@ //@@ gs_WriteShort(fp, mem_size); //@@ if (mem) { diff --git a/Descent3/gametexture.cpp b/Descent3/gametexture.cpp index 42094613..4fc58101 100644 --- a/Descent3/gametexture.cpp +++ b/Descent3/gametexture.cpp @@ -433,7 +433,7 @@ int AllocateProceduralForTexture(int handle) { GameTextures[handle].procedural->memory_type = PROC_MEMORY_TYPE_NONE; - GameTextures[handle].procedural->palette = (ushort *)mem_malloc(256 * 2); + GameTextures[handle].procedural->palette = (uint16_t *)mem_malloc(256 * 2); GameTextures[handle].procedural->last_procedural_frame = -1; GameTextures[handle].procedural->heat = 128; @@ -762,12 +762,12 @@ void BuildTextureBumpmaps(int texhandle) { buffer = (int8_t *)mem_malloc(w * h); ASSERT(buffer); - ushort *src_data = (ushort *)bm_data(GameTextures[texhandle].bm_handle, 0); + uint16_t *src_data = (uint16_t *)bm_data(GameTextures[texhandle].bm_handle, 0); // create the grayscale for (i = 0; i < h; i++) { for (t = 0; t < w; t++) { - ushort color = src_data[i * w + t]; + uint16_t color = src_data[i * w + t]; int red = ((color >> 10) & 0x1f) << 3; int green = ((color >> 5) & 0x1f) << 3; @@ -777,7 +777,7 @@ void BuildTextureBumpmaps(int texhandle) { } } - ushort *dest_data = (ushort *)bump_data(bump); + uint16_t *dest_data = (uint16_t *)bump_data(bump); for (i = 0; i < h; i++) { int8_t *pDst = (int8_t *)(dest_data + i * w); diff --git a/Descent3/gametexture.h b/Descent3/gametexture.h index d5958463..547eb14f 100644 --- a/Descent3/gametexture.h +++ b/Descent3/gametexture.h @@ -265,9 +265,9 @@ typedef struct { void *proc2; // back page of procedural short procedural_bitmap; // handle to the bitmap holding the finished procedural - ushort *palette; + uint16_t *palette; static_proc_element *static_proc_elements; - ushort num_static_elements; + uint16_t num_static_elements; uint8_t memory_type; diff --git a/Descent3/gauges.cpp b/Descent3/gauges.cpp index a31d29d4..8647d159 100644 --- a/Descent3/gauges.cpp +++ b/Descent3/gauges.cpp @@ -210,7 +210,7 @@ typedef struct tGauge { int first_vert; bool functional; // is this gauge working? bool just_init; // gauge just initialized? - ushort mask; // mask of stat for gauge + uint16_t mask; // mask of stat for gauge int state; // gauge dependent state data. union { // data for gauge. int i; @@ -321,13 +321,13 @@ static inline int GAUGE_INDEX(tStatMask mask) { // Initialization routines // initializes cockpit gauges -void InitGauges(ushort gauge_mask) { +void InitGauges(uint16_t gauge_mask) { Gauge_mask = gauge_mask; Gauge_mask_modified = Gauge_mask; int gauge = 0; for (int i = 0; i < NUM_GAUGES; i++) { - ushort mask = Gauge_mask & (1 << i); + uint16_t mask = Gauge_mask & (1 << i); if (mask == STAT_SHIELDS) { Gauge_list[gauge].monitor = CockpitGetMonitorSubmodel(SHIELD_MONITOR); @@ -369,7 +369,7 @@ void InitGauges(ushort gauge_mask) { // deinitializes cockpit gauges void CloseGauges() { for (int i = 0; i < NUM_GAUGES; i++) { - ushort mask = Gauge_mask & (1 << i); + uint16_t mask = Gauge_mask & (1 << i); Gauge_list[i].monitor = NULL; } Gauge_mask = 0; @@ -474,7 +474,7 @@ void FlagGaugesModified(tStatMask mask_modified) { Gauge_mask_modified |= mask_m // sets whether the gauges are functional void FlagGaugesFunctional(tStatMask mask) { - ushort i = 0x8000, j = NUM_GAUGES; + uint16_t i = 0x8000, j = NUM_GAUGES; while (i) { if (mask & i) @@ -486,7 +486,7 @@ void FlagGaugesFunctional(tStatMask mask) { // sets whether the gauges are functional void FlagGaugesNonfunctional(tStatMask mask) { - ushort i = 0x8000, j = NUM_GAUGES; + uint16_t i = 0x8000, j = NUM_GAUGES; while (i) { if (mask & i) diff --git a/Descent3/hotspotmap.cpp b/Descent3/hotspotmap.cpp index dc635a48..d1ae8563 100644 --- a/Descent3/hotspotmap.cpp +++ b/Descent3/hotspotmap.cpp @@ -119,7 +119,7 @@ static int CreateHotSpotMap(const char *map, int width, int height, hotspotmap_t static void CreateWindowMap(const char *map, int width, int height, windowmap_t *wndmap); // just like the old bm_tga_translate_pixel function, but it stores the alpha in the alpha_value parameter -ushort menutga_translate_pixel(int pixel, char *alpha_value) { +uint16_t menutga_translate_pixel(int pixel, char *alpha_value) { int red = ((pixel >> 16) & 0xFF); int green = ((pixel >> 8) & 0xFF); int blue = ((pixel) & 0xFF); @@ -130,7 +130,7 @@ ushort menutga_translate_pixel(int pixel, char *alpha_value) { int newred = red >> 3; int newgreen = green >> 3; int newblue = blue >> 3; - ushort newpix = OPAQUE_FLAG | (newred << 10) | (newgreen << 5) | (newblue); + uint16_t newpix = OPAQUE_FLAG | (newred << 10) | (newgreen << 5) | (newblue); if (alpha == 0) newpix = NEW_TRANSPARENT_COLOR; @@ -511,7 +511,7 @@ void CreateWindowMap(const char *map, int width, int height, windowmap_t *wndmap int menutga_alloc_file(const char *name, char *hsmap[1], int *w, int *h) { uint8_t image_id_len, color_map_type, image_type, pixsize, descriptor; uint8_t upside_down = 0; - ushort width, height; + uint16_t width, height; uint32_t pixel; int i, t, n; char alphavalue; @@ -576,7 +576,7 @@ int menutga_alloc_file(const char *name, char *hsmap[1], int *w, int *h) { for (t = 0; t < width; t++) { pixel = cf_ReadInt(infile); - ushort newpix = menutga_translate_pixel(pixel, &alphavalue); + uint16_t newpix = menutga_translate_pixel(pixel, &alphavalue); if (upside_down) { GameBitmaps[n].data16[((height - 1) - i) * width + t] = newpix; diff --git a/Descent3/hotspotmap.h b/Descent3/hotspotmap.h index bcc437e1..c4890d75 100644 --- a/Descent3/hotspotmap.h +++ b/Descent3/hotspotmap.h @@ -109,6 +109,6 @@ void ExportHotSpot(const char *filename, hotspotmap_t *hsmap); // Exports a hots void DisplayHotSpots(hotspotmap_t *hsmap, windowmap_t *wndmap); // Displays the hotspots of the given hotspot map to the screen (in blue) void FreeHotSpotMapInternals(hotspotmap_t *hsmap); // Deletes allocated memory within a hotspotmap struct -ushort menutga_translate_pixel(int pixel, char *alpha_value); +uint16_t menutga_translate_pixel(int pixel, char *alpha_value); #endif diff --git a/Descent3/hud.cpp b/Descent3/hud.cpp index 579b9020..3ad7dcca 100644 --- a/Descent3/hud.cpp +++ b/Descent3/hud.cpp @@ -683,7 +683,7 @@ void SetHUDMode(tHUDMode mode) { // do cockpit specific thing. redo_hud_switch: switch (mode) { - ushort cp_hud_stat, cp_hud_graphical_stat; + uint16_t cp_hud_stat, cp_hud_graphical_stat; case HUD_LETTERBOX: // our objective here is to display a letterbox screen for the cockpit. @@ -780,7 +780,7 @@ void ToggleHUDMode() { } // sets the hud item state(what's visible, how it's drawn, etc) -void SetHUDState(ushort hud_mask, ushort hud_gr_mask) { +void SetHUDState(uint16_t hud_mask, uint16_t hud_gr_mask) { int i; Hud_stat_mask = (hud_mask | hud_gr_mask); @@ -797,7 +797,7 @@ void SetHUDState(ushort hud_mask, ushort hud_gr_mask) { // initializes items based off their type (information, etc.) void InitHUDItem(int new_item, tHUDItem *item) { ASSERT(new_item < MAX_HUD_ITEMS); - ushort stat = 0x0000; + uint16_t stat = 0x0000; item->id = new_item; @@ -976,9 +976,9 @@ void SGSHudState(CFILE *fp) { bool LGSHudState(CFILE *fp) { // restore hud items - ushort stat_mask = 0; + uint16_t stat_mask = 0; - while ((stat_mask = (ushort)cf_ReadShort(fp)) != 0) { + while ((stat_mask = (uint16_t)cf_ReadShort(fp)) != 0) { tHUDItem huditem; uint8_t item_type = (uint8_t)cf_ReadByte(fp); @@ -994,7 +994,7 @@ bool LGSHudState(CFILE *fp) { huditem.x = cf_ReadShort(fp); huditem.y = cf_ReadShort(fp); huditem.color = (ddgr_color)cf_ReadInt(fp); - huditem.flags = (ushort)cf_ReadShort(fp); + huditem.flags = (uint16_t)cf_ReadShort(fp); huditem.alpha = (uint8_t)cf_ReadByte(fp); huditem.buffer_size = (int)cf_ReadShort(fp); @@ -1012,7 +1012,7 @@ bool LGSHudState(CFILE *fp) { huditem.x = cf_ReadShort(fp); huditem.y = cf_ReadShort(fp); huditem.color = (ddgr_color)cf_ReadInt(fp); - huditem.flags = (ushort)cf_ReadShort(fp); + huditem.flags = (uint16_t)cf_ReadShort(fp); huditem.alpha = (uint8_t)cf_ReadByte(fp); huditem.data.timer_handle = cf_ReadInt(fp); @@ -1295,7 +1295,7 @@ void RenderAuxHUDFrame() { int cur_game_win_x = Game_window_x; int cur_game_win_y = Game_window_y; int i; - ushort stat_mask = Hud_stat_mask; + uint16_t stat_mask = Hud_stat_mask; // emulating hud that takes up entire screen Game_window_w = Max_window_w; @@ -1812,8 +1812,8 @@ const int Ret_sec_wb[MAX_WB_GUNPOINTS + 1] = { #define RETMASK_FLAG_AUXPRIMARY0 (1 << 8) // matches 9th bit (bit 8) of reticle mask -static ushort Ret_prim_mask = 0; -static ushort Ret_sec_mask = 0; +static uint16_t Ret_prim_mask = 0; +static uint16_t Ret_sec_mask = 0; // Initializes Reticle on Hud. Usually called when weapon changes. void InitReticle(int primary_slots, int secondary_slots) { @@ -1916,7 +1916,7 @@ void ResetReticle() { } // creates the reticle display bitmap mask to be used by the reticle renderer. -static inline ushort reticle_mask(object *pobj, otype_wb_info *static_wb, int wb_index) { +static inline uint16_t reticle_mask(object *pobj, otype_wb_info *static_wb, int wb_index) { poly_model *pm = &Poly_models[pobj->rtype.pobj_info.model_num]; dynamic_wb_info *dyn_wb = &pobj->dynamic_wb[wb_index]; unsigned mask = 0; @@ -1952,7 +1952,7 @@ static inline ushort reticle_mask(object *pobj, otype_wb_info *static_wb, int wb return mask; } -static inline void draw_reticle_sub(int cx, int cy, int rw, int rh, ushort on_mask, ushort gp_mask, const int *wb_elem_array) { +static inline void draw_reticle_sub(int cx, int cy, int rw, int rh, uint16_t on_mask, uint16_t gp_mask, const int *wb_elem_array) { int i, x, y; int bmp_handle; char align; @@ -1996,7 +1996,7 @@ static inline void draw_reticle_sub(int cx, int cy, int rw, int rh, ushort on_ma // renders the reticle void RenderReticle() { - static ushort primary_index_last_frame = 0xffff; + static uint16_t primary_index_last_frame = 0xffff; static bool quad_primary_last_frame = false; player *player = &Players[Player_num]; object *pobj = &Objects[player->objnum]; diff --git a/Descent3/hud.h b/Descent3/hud.h index 2d2613e0..32d85350 100644 --- a/Descent3/hud.h +++ b/Descent3/hud.h @@ -267,7 +267,7 @@ struct bsp_info; struct g3Point; // type to pass to functions that draw stats -typedef ushort tStatMask; +typedef uint16_t tStatMask; struct CFILE; @@ -476,9 +476,9 @@ typedef struct tHUDItem { uint8_t id; // id number. uint8_t type; // custom of predefined hud item type. - ushort stat; // stat mask (what class of hud items does this one belong to) + uint16_t stat; // stat mask (what class of hud items does this one belong to) - ushort flags; // more flags. + uint16_t flags; // more flags. uint8_t alpha; // alpha of hud item uint8_t saturation_count; // how saturated is this hud item (how bright). @@ -551,7 +551,7 @@ void SetHUDMode(tHUDMode mode); void ToggleHUDMode(); // sets the hud item state(what's visible, how it's drawn, etc) -void SetHUDState(ushort hud_mask, ushort hud_gr_mask); +void SetHUDState(uint16_t hud_mask, uint16_t hud_gr_mask); // the current cockpit mode; tHUDMode GetHUDMode(); diff --git a/Descent3/init.cpp b/Descent3/init.cpp index fb518934..02a3f658 100644 --- a/Descent3/init.cpp +++ b/Descent3/init.cpp @@ -1835,8 +1835,8 @@ void InitDedicatedServer() { int ServerTimeout = 0; float LastPacketReceived; -ushort Gameport = D3_DEFAULT_PORT; -ushort PXOPort = 0; +uint16_t Gameport = D3_DEFAULT_PORT; +uint16_t PXOPort = 0; // Initialiaze everything before data load void InitD3Systems1(bool editor) { #if defined(RELEASE) diff --git a/Descent3/lighting.cpp b/Descent3/lighting.cpp index a1ba5212..4f5fda83 100644 --- a/Descent3/lighting.cpp +++ b/Descent3/lighting.cpp @@ -64,7 +64,7 @@ typedef struct { float Specular_tables[3][MAX_SPECULAR_INCREMENTS]; -static ushort *Dynamic_lightmap_memory = NULL; +static uint16_t *Dynamic_lightmap_memory = NULL; static float Light_component_scalar[32]; float Ubyte_to_float[256]; @@ -72,12 +72,12 @@ static uint8_t Lmi_spoken_for[MAX_LIGHTMAP_INFOS / 8]; static dynamic_lightmap *Dynamic_lightmaps; static dynamic_face Dynamic_face_list[MAX_DYNAMIC_FACES]; -static ushort Specular_face_list[MAX_DYNAMIC_FACES]; +static uint16_t Specular_face_list[MAX_DYNAMIC_FACES]; static volume_object Dynamic_volume_object_list[MAX_VOLUME_OBJECTS]; static dynamic_cell Dynamic_cell_list[MAX_DYNAMIC_CELLS]; static int Specular_maps[NUM_DYNAMIC_CLASSES]; -static ushort Edges_to_blend[MAX_DYNAMIC_LIGHTMAPS]; +static uint16_t Edges_to_blend[MAX_DYNAMIC_LIGHTMAPS]; static int Num_edges_to_blend = 0; static int Num_specular_faces = 0; @@ -139,7 +139,7 @@ void InitDynamicLighting() { DYNAMIC_LIGHTMAP_MEMORY = 500000; } - Dynamic_lightmap_memory = (ushort *)mem_malloc(DYNAMIC_LIGHTMAP_MEMORY); + Dynamic_lightmap_memory = (uint16_t *)mem_malloc(DYNAMIC_LIGHTMAP_MEMORY); // Init our records list Dynamic_lightmaps = (dynamic_lightmap *)mem_malloc(sizeof(dynamic_lightmap) * MAX_DYNAMIC_LIGHTMAPS); @@ -220,8 +220,8 @@ void BlendLightingEdges(lightmap_info *lmi_ptr) { int h = lmi_h(lmi_handle); int w = lmi_w(lmi_handle); int lm_handle = lmi_ptr->lm_handle; - ushort *dest_data = (ushort *)lm_data(lm_handle); - ushort *src_data = dest_data; + uint16_t *dest_data = (uint16_t *)lm_data(lm_handle); + uint16_t *src_data = dest_data; int dest_x = lmi_ptr->x1 - 1; int dest_y = lmi_ptr->y1 - 1; int i; @@ -263,12 +263,12 @@ void BlendLightingEdges(lightmap_info *lmi_ptr) { void ApplyLightingToExternalRoom(vector *pos, int roomnum, float light_dist, float red_scale, float green_scale, float blue_scale, vector *light_direction, float dot_range) { int i, lm_handle, t; - ushort *dest_data; + uint16_t *dest_data; vector rad; room *rp = &Rooms[roomnum]; vector Light_min_xyz; vector Light_max_xyz; - ushort lmilist[MAX_DYNAMIC_FACES]; + uint16_t lmilist[MAX_DYNAMIC_FACES]; int num_spoken_for = 0; int red_limit = 31; @@ -391,7 +391,7 @@ void ApplyLightingToExternalRoom(vector *pos, int roomnum, float light_dist, flo if (lmi_ptr->dynamic != BAD_LM_INDEX) // already lit, so just adjust, not start over { lm_handle = LightmapInfo[fp->lmi_handle].lm_handle; - dest_data = (ushort *)lm_data(lm_handle); + dest_data = (uint16_t *)lm_data(lm_handle); if (start_x + lmi_ptr->x1 < GameLightmaps[lm_handle].cx1) GameLightmaps[lm_handle].cx1 = start_x + lmi_ptr->x1; @@ -421,9 +421,9 @@ void ApplyLightingToExternalRoom(vector *pos, int roomnum, float light_dist, flo } // Now copy our source data to our dest data so we have a base to work with - ushort *src_data; + uint16_t *src_data; - src_data = (ushort *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); + src_data = (uint16_t *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); dest_data = Dynamic_lightmaps[dynamic_handle].mem_ptr; for (int y = 0, index = 0; y < yres; y++) { @@ -486,7 +486,7 @@ void ApplyLightingToExternalRoom(vector *pos, int roomnum, float light_dist, flo for (int x = 0; x < width; x++, element_vec += (facematrix.rvec * lmi_ptr->xspacing)) { int lightmap_texel_num = texel_num + x; - ushort lightmap_texel = dest_data[lightmap_texel_num]; + uint16_t lightmap_texel = dest_data[lightmap_texel_num]; if (!(lightmap_texel & OPAQUE_FLAG)) continue; @@ -607,8 +607,8 @@ void ApplyLightingToSubmodel(object *obj, poly_model *pm, bsp_info *sm, float li int i, t; int subnum = sm - pm->submodel; int lm_handle; - ushort *dest_data; - ushort lmilist[MAX_DYNAMIC_FACES]; + uint16_t *dest_data; + uint16_t lmilist[MAX_DYNAMIC_FACES]; int num_spoken_for = 0; int red_limit = 31; @@ -738,7 +738,7 @@ void ApplyLightingToSubmodel(object *obj, poly_model *pm, bsp_info *sm, float li if (lmi_ptr->dynamic != BAD_LM_INDEX) // already lit, so just adjust, not start over { lm_handle = LightmapInfo[fp->lmi_handle].lm_handle; - dest_data = (ushort *)lm_data(lm_handle); + dest_data = (uint16_t *)lm_data(lm_handle); if (start_x + lmi_ptr->x1 < GameLightmaps[lm_handle].cx1) GameLightmaps[lm_handle].cx1 = start_x + lmi_ptr->x1; @@ -770,9 +770,9 @@ void ApplyLightingToSubmodel(object *obj, poly_model *pm, bsp_info *sm, float li } // Now copy our source data to our dest data so we have a base to work with - ushort *src_data; + uint16_t *src_data; - src_data = (ushort *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); + src_data = (uint16_t *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); dest_data = Dynamic_lightmaps[dynamic_handle].mem_ptr; for (int y = 0, index = 0; y < yres; y++) { @@ -835,7 +835,7 @@ void ApplyLightingToSubmodel(object *obj, poly_model *pm, bsp_info *sm, float li for (int x = 0; x < width; x++, element_vec += (facematrix.rvec * lmi_ptr->xspacing)) { int lightmap_texel_num = texel_num + x; - ushort lightmap_texel = dest_data[lightmap_texel_num]; + uint16_t lightmap_texel = dest_data[lightmap_texel_num]; if (!(lightmap_texel & OPAQUE_FLAG)) continue; @@ -1056,11 +1056,11 @@ void ApplyLightingToObjects(vector *pos, int roomnum, float light_dist, float re void ApplyLightingToRooms(vector *pos, int roomnum, float light_dist, float red_scale, float green_scale, float blue_scale, vector *light_direction, float dot_range) { fvi_face_room_list facelist[MAX_DYNAMIC_FACES]; - ushort lmilist[MAX_DYNAMIC_FACES]; + uint16_t lmilist[MAX_DYNAMIC_FACES]; int num_spoken_for = 0; int num_faces, i, t, lm_handle; - ushort *dest_data; + uint16_t *dest_data; int faces_misreported = 0; if (Dedicated_server) @@ -1196,7 +1196,7 @@ void ApplyLightingToRooms(vector *pos, int roomnum, float light_dist, float red_ if (lmi_ptr->dynamic != BAD_LM_INDEX) // already lit, so just adjust, not start over { lm_handle = LightmapInfo[fp->lmi_handle].lm_handle; - dest_data = (ushort *)lm_data(lm_handle); + dest_data = (uint16_t *)lm_data(lm_handle); if (start_x + lmi_ptr->x1 < GameLightmaps[lm_handle].cx1) GameLightmaps[lm_handle].cx1 = start_x + lmi_ptr->x1; @@ -1226,9 +1226,9 @@ void ApplyLightingToRooms(vector *pos, int roomnum, float light_dist, float red_ } // Now copy our source data to our dest data so we have a base to work with - ushort *src_data; + uint16_t *src_data; - src_data = (ushort *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); + src_data = (uint16_t *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); dest_data = Dynamic_lightmaps[dynamic_handle].mem_ptr; for (int y = 0, index = 0; y < yres; y++) { @@ -1291,7 +1291,7 @@ void ApplyLightingToRooms(vector *pos, int roomnum, float light_dist, float red_ for (int x = 0; x < width; x++, element_vec += (facematrix.rvec * lmi_ptr->xspacing)) { int lightmap_texel_num = texel_num + x; - ushort lightmap_texel = dest_data[lightmap_texel_num]; + uint16_t lightmap_texel = dest_data[lightmap_texel_num]; if (!(lightmap_texel & OPAQUE_FLAG)) continue; @@ -1409,8 +1409,8 @@ void ClearDynamicLightmaps() { int lm_handle = LightmapInfo[lmi_handle].lm_handle; lightmap_info *lmi_ptr = &LightmapInfo[lmi_handle]; - ushort *src_data = Dynamic_lightmaps[dynamic_handle].mem_ptr; - ushort *dest_data = (ushort *)lm_data(lm_handle); + uint16_t *src_data = Dynamic_lightmaps[dynamic_handle].mem_ptr; + uint16_t *dest_data = (uint16_t *)lm_data(lm_handle); int lmw = lm_w(lm_handle); @@ -1446,8 +1446,8 @@ void ClearDynamicLightmaps() { int whichmap = ((seg_z / 128) * 2) + (seg_x / 128); whichmap = TerrainLightmaps[whichmap]; - ushort color = OPAQUE_FLAG | GR_RGB16(Terrain_seg[cellnum].r, Terrain_seg[cellnum].g, Terrain_seg[cellnum].b); - ushort *data = lm_data(whichmap); + uint16_t color = OPAQUE_FLAG | GR_RGB16(Terrain_seg[cellnum].r, Terrain_seg[cellnum].g, Terrain_seg[cellnum].b); + uint16_t *data = lm_data(whichmap); data[subz * 128 + subx] = color; @@ -1594,8 +1594,8 @@ void ApplyLightingToTerrain(vector *pos, int cellnum, float light_dist, float re tseg->b = std::min(blue_limit, b + (scalar * blue_scale * 255)); } - ushort color = OPAQUE_FLAG | GR_RGB16(tseg->r, tseg->g, tseg->b); - ushort *data = lm_data(whichmap); + uint16_t color = OPAQUE_FLAG | GR_RGB16(tseg->r, tseg->g, tseg->b); + uint16_t *data = lm_data(whichmap); ASSERT(data); @@ -1658,8 +1658,8 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) int cl=GetLightmapClass (square_res); int lm_handle; - ushort *dest_data; - ushort *src_data=(ushort *)lm_data(lmi_ptr->lm_handle); + uint16_t *dest_data; + uint16_t *src_data=(uint16_t *)lm_data(lmi_ptr->lm_handle); if (lmi_ptr->spec_map==-1) { @@ -1677,7 +1677,7 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) lm_handle=LightmapInfo[dynamic_lmi_handle].lm_handle; lmi_ptr->spec_map=lm_handle; - dest_data=(ushort *)lm_data(lm_handle); + dest_data=(uint16_t *)lm_data(lm_handle); memset (dest_data,0,xres*yres*2); @@ -1716,7 +1716,7 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) { int lightmap_texel_num=texel_num+x; - ushort lightmap_texel=src_data[lightmap_texel_num]; + uint16_t lightmap_texel=src_data[lightmap_texel_num]; if (! (lightmap_texel & OPAQUE_FLAG)) continue; @@ -1761,7 +1761,7 @@ incident_norm=element_vec-SpecialFaces[fp->special_handle].spec_instance[i].brig int index=((float)(MAX_SPECULAR_INCREMENTS-1)*dotp); float val=Specular_tables[material_type][index]; - ushort color=SpecialFaces[fp->special_handle].spec_instance[i].bright_color; + uint16_t color=SpecialFaces[fp->special_handle].spec_instance[i].bright_color; int r=color >> 10 & 0x1f; int g=color >> 5 & 0x1f; int b=color & 0x1f; @@ -1821,8 +1821,8 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) int cl=GetLightmapClass (square_res); int lm_handle; - ushort *dest_data; - ushort *src_data=(ushort *)lm_data(lmi_ptr->lm_handle); + uint16_t *dest_data; + uint16_t *src_data=(uint16_t *)lm_data(lmi_ptr->lm_handle); if (lmi_ptr->spec_map==-1) { @@ -1840,7 +1840,7 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) lm_handle=LightmapInfo[dynamic_lmi_handle].lm_handle; lmi_ptr->spec_map=lm_handle; - dest_data=(ushort *)lm_data(lm_handle); + dest_data=(uint16_t *)lm_data(lm_handle); memset (dest_data,0,xres*yres*2); @@ -1850,7 +1850,7 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) else { lm_handle=lmi_ptr->spec_map; - dest_data=(ushort *)lm_data(lm_handle); + dest_data=(uint16_t *)lm_data(lm_handle); } @@ -1920,7 +1920,7 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) norm.z=Normal_table[SpecialFaces[fp->special_handle].normal_map[lightmap_texel_num*3+2]]; } - ushort lightmap_texel=src_data[lightmap_texel_num]; + uint16_t lightmap_texel=src_data[lightmap_texel_num]; if (! (lightmap_texel & OPAQUE_FLAG)) continue; @@ -1967,7 +1967,7 @@ int GetSpecularLightmapForFace (vector *pos,room *rp,face *fp) int index=((float)(MAX_SPECULAR_INCREMENTS-1)*dotp); float val=Specular_tables[material_type][index]; - ushort color=SpecialFaces[fp->special_handle].spec_instance[i].bright_color; + uint16_t color=SpecialFaces[fp->special_handle].spec_instance[i].bright_color; int r=color >> 10 & 0x1f; int g=color >> 5 & 0x1f; int b=color & 0x1f; @@ -2000,7 +2000,7 @@ void DestroyLight(int roomnum, int facenum) { float r, g, b; fvi_face_room_list facelist[MAX_DYNAMIC_FACES]; int num_faces, i; - ushort lmilist[MAX_DYNAMIC_FACES]; + uint16_t lmilist[MAX_DYNAMIC_FACES]; int num_spoken_for = 0; if (Dedicated_server) @@ -2136,9 +2136,9 @@ void DestroyLight(int roomnum, int facenum) { ASSERT(height > 0); // Now copy our source data to our dest data so we have a base to work with - ushort *dest_data; + uint16_t *dest_data; - dest_data = (ushort *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); + dest_data = (uint16_t *)lm_data(LightmapInfo[fp->lmi_handle].lm_handle); int lm_handle = LightmapInfo[fp->lmi_handle].lm_handle; if (!(GameLightmaps[lm_handle].flags & LF_LIMITS)) { @@ -2182,7 +2182,7 @@ void DestroyLight(int roomnum, int facenum) { for (int x = 0; x < width; x++, element_vec += (facematrix.rvec * lmi_ptr->xspacing)) { int lightmap_texel_num = texel_num + x; - ushort lightmap_texel = dest_data[lightmap_texel_num]; + uint16_t lightmap_texel = dest_data[lightmap_texel_num]; if (!(lightmap_texel & OPAQUE_FLAG)) continue; diff --git a/Descent3/lighting.h b/Descent3/lighting.h index 27b92fa5..a4dd7d5d 100644 --- a/Descent3/lighting.h +++ b/Descent3/lighting.h @@ -40,16 +40,16 @@ extern float Specular_tables[3][MAX_SPECULAR_INCREMENTS]; typedef struct { - ushort *mem_ptr; + uint16_t *mem_ptr; uint8_t used; } dynamic_lightmap; typedef struct { - ushort lmi_handle; + uint16_t lmi_handle; } dynamic_face; typedef struct { - ushort cellnum; + uint16_t cellnum; uint8_t r, g, b; } dynamic_cell; diff --git a/Descent3/lightmap_info.cpp b/Descent3/lightmap_info.cpp index 457b64b3..ee065497 100644 --- a/Descent3/lightmap_info.cpp +++ b/Descent3/lightmap_info.cpp @@ -33,7 +33,7 @@ int Num_of_lightmap_info = 0; lightmap_info *LightmapInfo = NULL; -static ushort *Free_lmi_list = NULL; +static uint16_t *Free_lmi_list = NULL; static void CloseLightmapInfos(); @@ -60,7 +60,7 @@ void InitLightmapInfo(int nummaps) { if (nummaps == 0) { LightmapInfo = (lightmap_info *)mem_malloc(MAX_LIGHTMAP_INFOS * sizeof(lightmap_info)); ASSERT(LightmapInfo); - Free_lmi_list = (ushort *)mem_malloc(MAX_LIGHTMAP_INFOS * sizeof(ushort)); + Free_lmi_list = (uint16_t *)mem_malloc(MAX_LIGHTMAP_INFOS * sizeof(uint16_t)); ASSERT(Free_lmi_list); for (i = 0; i < MAX_LIGHTMAP_INFOS; i++) { @@ -72,7 +72,7 @@ void InitLightmapInfo(int nummaps) { else { LightmapInfo=(lightmap_info *)mem_malloc (nummaps*sizeof(lightmap_info)); ASSERT (LightmapInfo); - Free_lmi_list=(ushort *)mem_malloc (nummaps*sizeof(ushort)); + Free_lmi_list=(uint16_t *)mem_malloc (nummaps*sizeof(uint16_t)); ASSERT (Free_lmi_list); @@ -128,7 +128,7 @@ int AllocLightmapInfo(int w, int h, int type, bool alloc_lightmap) { LightmapInfo[n].lm_handle = lm_AllocLightmap(w, h); ASSERT(LightmapInfo[n].lm_handle != BAD_LM_INDEX); // Make sure we have a valid lightmap - ushort *dest_data = lm_data(LightmapInfo[n].lm_handle); + uint16_t *dest_data = lm_data(LightmapInfo[n].lm_handle); // Set the lightmap to be transparent for (i = 0; i < w * h; i++) @@ -200,13 +200,13 @@ void ShadeLightmapInfoEdges(int type) { for (i = 0; i < MAX_LIGHTMAP_INFOS; i++) { if (LightmapInfo[i].used && LightmapInfo[i].type == type) { - ushort *src_data; - ushort *dest_data = lm_data(LightmapInfo[i].lm_handle); + uint16_t *src_data; + uint16_t *dest_data = lm_data(LightmapInfo[i].lm_handle); int w = lmi_w(i); int h = lmi_h(i); int x, y; - src_data = (ushort *)mem_malloc(w * h * 2); + src_data = (uint16_t *)mem_malloc(w * h * 2); ASSERT(src_data); memcpy(src_data, dest_data, w * h * 2); @@ -217,7 +217,7 @@ void ShadeLightmapInfoEdges(int type) { int r = 0, g = 0, b = 0; int num = 0; ddgr_color color; - ushort color16; + uint16_t color16; // Left edge if (x != 0) { @@ -332,13 +332,13 @@ void BlurLightmapInfos(int type) { for (i = 0; i < MAX_LIGHTMAP_INFOS; i++) { if (LightmapInfo[i].used && LightmapInfo[i].type == type) { - ushort *src_data; - ushort *dest_data = lm_data(LightmapInfo[i].lm_handle); + uint16_t *src_data; + uint16_t *dest_data = lm_data(LightmapInfo[i].lm_handle); int w = lmi_w(i); int h = lmi_h(i); int x, y; - src_data = (ushort *)mem_malloc(w * h * 2); + src_data = (uint16_t *)mem_malloc(w * h * 2); ASSERT(src_data); memcpy(src_data, dest_data, w * h * 2); @@ -349,7 +349,7 @@ void BlurLightmapInfos(int type) { int r = 0, g = 0, b = 0; int num = 0; ddgr_color color; - ushort color16; + uint16_t color16; color16 = src_data[y * w + (x)]; color = GR_16_TO_COLOR(color16); diff --git a/Descent3/lightmap_info.h b/Descent3/lightmap_info.h index bb61e55c..7a014f89 100644 --- a/Descent3/lightmap_info.h +++ b/Descent3/lightmap_info.h @@ -56,12 +56,12 @@ typedef struct { uint8_t xspacing, yspacing; - ushort lm_handle; + uint16_t lm_handle; vector upper_left, normal; uint8_t width, height, x1, y1; uint8_t used; - ushort dynamic; + uint16_t dynamic; short spec_map; uint8_t type; // see LMI_types above diff --git a/Descent3/loadstate.cpp b/Descent3/loadstate.cpp index 47f2718a..07dbc4b1 100644 --- a/Descent3/loadstate.cpp +++ b/Descent3/loadstate.cpp @@ -266,8 +266,8 @@ int LoadGameState(const char *pathname) { int retval = LGS_OK; char desc[GAMESAVE_DESCLEN + 1]; char path[PSPATHNAME_LEN]; - ushort version; - ushort curlevel; + uint16_t version; + uint16_t curlevel; short pending_music_region; IsRestoredGame = true; // load in stuff @@ -282,7 +282,7 @@ int LoadGameState(const char *pathname) { // read in header and do version check. cf_ReadBytes((uint8_t *)desc, sizeof(desc), fp); - version = (ushort)cf_ReadShort(fp); + version = (uint16_t)cf_ReadShort(fp); if (version < GAMESAVE_OLDVER) { Int3(); retval = LGS_OUTDATEDVER; @@ -303,7 +303,7 @@ int LoadGameState(const char *pathname) { // read in gamemode info. // read in mission level info. - curlevel = (ushort)cf_ReadShort(fp); + curlevel = (uint16_t)cf_ReadShort(fp); cf_ReadString(path, sizeof(path), fp); if ((curlevel > 4) && (strcmpi(path, "d3.mn3") == 0)) { @@ -664,8 +664,8 @@ typedef struct { int obj_handle, dest_objhandle; uint8_t subnum, subnum2; - ushort modelnum; - ushort vertnum, end_vertnum; + uint16_t modelnum; + uint16_t vertnum, end_vertnum; } old_vis_attach_info; typedef struct { @@ -683,11 +683,11 @@ typedef struct { float creation_time; int roomnum; - ushort flags; + uint16_t flags; int phys_flags; uint8_t movement_type; short custom_handle; - ushort lighting_color; + uint16_t lighting_color; vis_attach_info attach_info; axis_billboard_info billboard_info; @@ -1489,7 +1489,7 @@ int LGSObjEffects(CFILE *fp, object *op) { //@@{ //@@ int i; //@@ char name[64]; -//@@ ushort nparms; +//@@ uint16_t nparms; //@@ tScriptParm *parms = NULL; //@@ //@@// ugh, write out script info. diff --git a/Descent3/mission_download.cpp b/Descent3/mission_download.cpp index 337665fa..c6f509b8 100644 --- a/Descent3/mission_download.cpp +++ b/Descent3/mission_download.cpp @@ -552,7 +552,7 @@ void msn_DoAskForURL(uint8_t *indata, network_address *net_addr) { // Number of URLs MultiAddByte(num_urls, data, &count); for (i = 0; i < num_urls; i++) { - ushort urllen = strlen(url->URL[i]) + 1; + uint16_t urllen = strlen(url->URL[i]) + 1; if ((count + urllen) >= MAX_GAME_DATA_SIZE) { // if for some reason the URLS exceed what a packet can send // rather than overflow the memory buffer, just don't send out the packet. @@ -586,7 +586,7 @@ void msn_DoCurrMsnURLs(uint8_t *data, network_address *net_addr) { num_urls = MultiGetByte(data, &count); for (i = 0; i < num_urls; i++) { - ushort urllen = MultiGetUshort(data, &count); + uint16_t urllen = MultiGetUshort(data, &count); memcpy(msn_URL.URL[i], data + count, urllen); count += urllen; } diff --git a/Descent3/multi.cpp b/Descent3/multi.cpp index 9642d771..2288a9ce 100644 --- a/Descent3/multi.cpp +++ b/Descent3/multi.cpp @@ -1724,9 +1724,9 @@ bool Multi_no_stats_saved = false; uint32_t Netgame_curr_handle = 1; -ushort Local_object_list[MAX_OBJECTS]; -ushort Server_object_list[MAX_OBJECTS]; -ushort Server_spew_list[MAX_SPEW_EFFECTS]; +uint16_t Local_object_list[MAX_OBJECTS]; +uint16_t Server_object_list[MAX_OBJECTS]; +uint16_t Server_spew_list[MAX_SPEW_EFFECTS]; #ifndef RELEASE int Multi_packet_tracking[255]; @@ -1734,10 +1734,10 @@ int Multi_packet_tracking[255]; // This is for clearing lightmapped objects on the client/server int Num_client_lm_objects, Num_server_lm_objects; -ushort Client_lightmap_list[MAX_OBJECTS], Server_lightmap_list[MAX_OBJECTS]; +uint16_t Client_lightmap_list[MAX_OBJECTS], Server_lightmap_list[MAX_OBJECTS]; // This is for breakable glass -ushort Broke_glass_rooms[MAX_BROKE_GLASS], Broke_glass_faces[MAX_BROKE_GLASS]; +uint16_t Broke_glass_rooms[MAX_BROKE_GLASS], Broke_glass_faces[MAX_BROKE_GLASS]; int Num_broke_glass = 0; // This is for getting out a menu if in multiplayer @@ -1761,7 +1761,7 @@ uint8_t Multi_reliable_urgent[MAX_NET_PLAYERS]; // For keeping track of buildings that have changed uint8_t Multi_building_states[MAX_OBJECTS]; -ushort Multi_num_buildings_changed = 0; +uint16_t Multi_num_buildings_changed = 0; // For keeping track of powerup respawn points powerup_respawn Powerup_respawn[MAX_RESPAWNS]; @@ -3078,16 +3078,16 @@ void MultiDoPlayerPos(uint8_t *data) { vector pos; matrix orient; - ushort short_roomnum; + uint16_t short_roomnum; int roomnum; // Get position MultiExtractPositionData(&pos, data, &count); // Get orientation - ushort p = MultiGetShort(data, &count); - ushort h = MultiGetShort(data, &count); - ushort b = MultiGetShort(data, &count); + uint16_t p = MultiGetShort(data, &count); + uint16_t h = MultiGetShort(data, &count); + uint16_t b = MultiGetShort(data, &count); vm_AnglesToMatrix(&orient, p, h, b); @@ -3245,8 +3245,8 @@ void MultiDoRobotPos(uint8_t *data) { // Skip header stuff SKIP_HEADER(data, &count); - ushort server_objnum = MultiGetUshort(data, &count); - ushort objectnum = Server_object_list[server_objnum]; + uint16_t server_objnum = MultiGetUshort(data, &count); + uint16_t objectnum = Server_object_list[server_objnum]; if (objectnum == 65535 || !(Objects[objectnum].flags & OF_SERVER_OBJECT)) { mprintf((0, "Bad robotposition object number!\n")); return; @@ -3255,16 +3255,16 @@ void MultiDoRobotPos(uint8_t *data) { vector pos; matrix orient; - ushort short_roomnum; + uint16_t short_roomnum; int roomnum; // Get position MultiExtractPositionData(&pos, data, &count); // Get orientation - ushort p = MultiGetShort(data, &count); - ushort h = MultiGetShort(data, &count); - ushort b = MultiGetShort(data, &count); + uint16_t p = MultiGetShort(data, &count); + uint16_t h = MultiGetShort(data, &count); + uint16_t b = MultiGetShort(data, &count); vm_AnglesToMatrix(&orient, p, h, b); @@ -4125,7 +4125,7 @@ void MultiSendBlowupBuilding(int hit_objnum, int killer_objnum, float damage) { int size_offset = 0; uint8_t data[MAX_GAME_DATA_SIZE]; - ushort short_damage = damage; + uint16_t short_damage = damage; size_offset = START_DATA(MP_BLOWUP_BUILDING, data, &count, 1); MultiAddShort(hit_objnum, data, &count); @@ -4148,10 +4148,10 @@ void MultiDoBlowupBuilding(uint8_t *data) { SKIP_HEADER(data, &count); - ushort hit_objnum = MultiGetUshort(data, &count); - ushort killer_objnum = MultiGetUshort(data, &count); - ushort damage = MultiGetUshort(data, &count); - ushort seed = MultiGetUshort(data, &count); + uint16_t hit_objnum = MultiGetUshort(data, &count); + uint16_t killer_objnum = MultiGetUshort(data, &count); + uint16_t damage = MultiGetUshort(data, &count); + uint16_t seed = MultiGetUshort(data, &count); if (Objects[hit_objnum].type != OBJ_BUILDING) { Int3(); // Get Jason, trying to blowup a non-building @@ -4174,7 +4174,7 @@ void MultiDoBuilding(uint8_t *data) { SKIP_HEADER(data, &count); uint8_t num = MultiGetByte(data, &count); for (int i = 0; i < num; i++) { - ushort objnum = MultiGetUshort(data, &count); + uint16_t objnum = MultiGetUshort(data, &count); if (Objects[objnum].type != OBJ_BUILDING) { mprintf((0, "Error! Server says objnum %d is a building and its not!\n", objnum)); } else { @@ -4320,7 +4320,7 @@ void MultiDoWorldStates(uint8_t *data) { } case WS_BUDDYBOTS: { int b_index = MultiGetByte(data, &count); - ushort serv_objnum = MultiGetUshort(data, &count); + uint16_t serv_objnum = MultiGetUshort(data, &count); int local_objnum = Server_object_list[serv_objnum]; ASSERT(Objects[local_objnum].type != OBJ_NONE); @@ -4335,7 +4335,7 @@ void MultiDoWorldStates(uint8_t *data) { } case WS_BUDDYBOTUPDATE: { int b_index = MultiGetByte(data, &count); - ushort serv_objnum = MultiGetUshort(data, &count); + uint16_t serv_objnum = MultiGetUshort(data, &count); int local_objnum = Server_object_list[serv_objnum]; ASSERT(Objects[local_objnum].type != OBJ_NONE); @@ -4442,7 +4442,7 @@ void MultiDoWorldStates(uint8_t *data) { spewinfo spew; mprintf((0, "Got a spew packet!\n")); - ushort spewnum = MultiGetShort(data, &count); + uint16_t spewnum = MultiGetShort(data, &count); if (MultiGetByte(data, &count)) spew.use_gunpoint = true; @@ -4485,7 +4485,7 @@ void MultiDoWorldStates(uint8_t *data) { spew.size = MultiGetFloat(data, &count); spew.speed = MultiGetFloat(data, &count); - ushort local_spewnum = SpewCreate(&spew); + uint16_t local_spewnum = SpewCreate(&spew); ASSERT(local_spewnum != -1); // DAJ -1FIX local_spewnum &= 0xFF; // Adjust for handle Server_spew_list[spewnum] = local_spewnum; @@ -4591,7 +4591,7 @@ void MultiDoJoinObjects(uint8_t *data) { bool obj_is_dummy = false; // Extract info about this object - ushort server_objnum = MultiGetUshort(data, &count); + uint16_t server_objnum = MultiGetUshort(data, &count); uint8_t type = MultiGetByte(data, &count); //@@mprintf ((0,"Got join objnum %d from server. Type=%d\n",server_objnum,type)); @@ -4642,7 +4642,7 @@ void MultiDoJoinObjects(uint8_t *data) { id = 0; vector pos; - ushort short_roomnum; + uint16_t short_roomnum; uint8_t terrain = 0; uint8_t lifeleft = 255; int roomnum; @@ -5064,7 +5064,7 @@ void MultiDoExecuteDLL(uint8_t *data) { SKIP_HEADER(data, &count); - ushort eventnum = MultiGetShort(data, &count); + uint16_t eventnum = MultiGetShort(data, &count); short me_objnum = MultiGetShort(data, &count); short it_objnum = MultiGetShort(data, &count); @@ -5239,9 +5239,9 @@ void MultiDoObject(uint8_t *data) { if (type != OBJ_POWERUP && type != OBJ_DUMMY) { // Extract orientation - ushort p = MultiGetShort(data, &count); - ushort h = MultiGetShort(data, &count); - ushort b = MultiGetShort(data, &count); + uint16_t p = MultiGetShort(data, &count); + uint16_t h = MultiGetShort(data, &count); + uint16_t b = MultiGetShort(data, &count); vm_AnglesToMatrix(&orient, p, h, b); orientp = &orient; @@ -5251,7 +5251,7 @@ void MultiDoObject(uint8_t *data) { uint8_t mtype = MultiGetByte(data, &count); // Get room/cell stuff - ushort short_roomnum = MultiGetUshort(data, &count); + uint16_t short_roomnum = MultiGetUshort(data, &count); uint8_t terrain = MultiGetByte(data, &count); uint8_t lifeleft = MultiGetUbyte(data, &count); int roomnum = short_roomnum; @@ -5455,15 +5455,15 @@ void MultiDoGuidedInfo(uint8_t *data) { vector pos; matrix orient; - ushort short_roomnum; + uint16_t short_roomnum; int roomnum; MultiExtractPositionData(&pos, data, &count); // Get orientation - ushort p = MultiGetShort(data, &count); - ushort h = MultiGetShort(data, &count); - ushort b = MultiGetShort(data, &count); + uint16_t p = MultiGetShort(data, &count); + uint16_t h = MultiGetShort(data, &count); + uint16_t b = MultiGetShort(data, &count); vm_AnglesToMatrix(&orient, p, h, b); @@ -5689,7 +5689,7 @@ void MultiDoRemoveObject(uint8_t *data) { SKIP_HEADER(data, &count); - ushort server_objnum = MultiGetUshort(data, &count); + uint16_t server_objnum = MultiGetUshort(data, &count); uint8_t type = MultiGetByte(data, &count); uint8_t sound = MultiGetByte(data, &count); @@ -5800,7 +5800,7 @@ void MultiDoPowerupReposition(uint8_t *data) { // count+=sizeof(vector); pos = MultiGetVector(data, &count); - ushort short_roomnum = MultiGetUshort(data, &count); + uint16_t short_roomnum = MultiGetUshort(data, &count); uint8_t terrain = MultiGetByte(data, &count); int roomnum = short_roomnum; @@ -6072,7 +6072,7 @@ void MultiDoRequestCountermeasure(uint8_t *data) { SKIP_HEADER(data, &count); - ushort parent_objnum = MultiGetShort(data, &count); + uint16_t parent_objnum = MultiGetShort(data, &count); if (Netgame.local_role != LR_SERVER) { parent_objnum = Server_object_list[parent_objnum]; @@ -6305,7 +6305,7 @@ void MultiDoRequestPeerDamage(uint8_t *data, network_address *from_addr) { SKIP_HEADER(data, &count); int pnum = MultiGetByte(data, &count); - ushort killer_objnum = MultiGetUshort(data, &count); + uint16_t killer_objnum = MultiGetUshort(data, &count); uint8_t weapon_id = MultiGetUbyte(data, &count); uint8_t damage_type = MultiGetUbyte(data, &count); float amount = MultiGetFloat(data, &count); @@ -6739,7 +6739,7 @@ void MultiSendKillObject(object *hit_obj, object *killer, float damage, int deat int size; int count = 0; uint8_t data[MAX_GAME_DATA_SIZE]; - ushort hit_objnum, killer_objnum; + uint16_t hit_objnum, killer_objnum; // mprintf((0,"MultiSendExplodeObject Hit obj:%d Killer Obj: %d\n",OBJNUM(hit_obj),OBJNUM(killer))); MULTI_ASSERT_NOMESSAGE(Netgame.local_role == LR_SERVER); @@ -6770,7 +6770,7 @@ void MultiSendKillObject(object *hit_obj, object *killer, float damage, int deat void MultiDoRobotExplode(uint8_t *data) { int count = 0; float damage, delay; - ushort hit_objnum, killer_objnum, seed; + uint16_t hit_objnum, killer_objnum, seed; int death_flags; MULTI_ASSERT_NOMESSAGE(Netgame.local_role != LR_SERVER); @@ -6817,7 +6817,7 @@ void MultiSendDamageObject(object *hit_obj, object *killer, float damage, int we int size; int count = 0; uint8_t data[MAX_GAME_DATA_SIZE]; - ushort hit_objnum, killer_objnum; + uint16_t hit_objnum, killer_objnum; // mprintf((0,"MultiSendDamageObject Hit obj:%d Killer Obj: %d\n",OBJNUM(hit_obj),OBJNUM(killer))); MULTI_ASSERT_NOMESSAGE(Netgame.local_role == LR_SERVER); @@ -6841,7 +6841,7 @@ void MultiDoRobotDamage(uint8_t *data) { int count = 0; float damage; int weaponid; - ushort hit_objnum, killer_objnum; + uint16_t hit_objnum, killer_objnum; MULTI_ASSERT_NOMESSAGE(Netgame.local_role != LR_SERVER); SKIP_HEADER(data, &count); @@ -6974,7 +6974,7 @@ void MultiDoPlay3dSound(uint8_t *data) { Sound_system.Play3dSound(soundidx, &Objects[objnum], priority); } -void MultiPlay3dSound(short soundidx, ushort objnum, int priority) { +void MultiPlay3dSound(short soundidx, uint16_t objnum, int priority) { uint8_t data[MAX_GAME_DATA_SIZE]; int count = 0; int size = 0; @@ -7003,7 +7003,7 @@ void MultiPlay3dSound(short soundidx, ushort objnum, int priority) { } } -void MultiSendRobotFireSound(short soundidx, ushort objnum) { +void MultiSendRobotFireSound(short soundidx, uint16_t objnum) { int size; int count = 0; uint8_t data[MAX_GAME_DATA_SIZE]; @@ -7123,7 +7123,7 @@ void MultiDoTurretUpdate(uint8_t *data) { multi_turret multi_turret_info; int objnum; - ushort num_turrets; + uint16_t num_turrets; float turr_time; int count = 0; MULTI_ASSERT_NOMESSAGE(Netgame.local_role != LR_SERVER); @@ -7347,7 +7347,7 @@ void MultiSendInventoryRemoveItem(int slot, int type, int id) { // type/id MULTI_ASSERT_NOMESSAGE(Netgame.local_role == LR_SERVER); size = START_DATA(MP_REMOVE_INVENTORY_ITEM, data, &count, 1); - MultiAddUshort((ushort)type, data, &count); + MultiAddUshort((uint16_t)type, data, &count); MultiAddUint(MultiGetMatchChecksum(type, id), data, &count); MultiAddByte(slot, data, &count); END_DATA(count, data, size); @@ -7598,7 +7598,7 @@ void MultiDoGreetings(uint8_t *data, network_address *addr) { // file_id = NETFILE_ID_???? type // file_who = If you are the client who's file you want from the server // who = player number of who you are asking for the file -void MultiAskForFile(ushort file_id, ushort file_who, ushort who) { +void MultiAskForFile(uint16_t file_id, uint16_t file_who, uint16_t who) { int size = 0; uint8_t data[MAX_GAME_DATA_SIZE]; int count = 0; @@ -7668,9 +7668,9 @@ void MultiAskForFile(ushort file_id, ushort file_who, ushort who) { void MultiDoFileReq(uint8_t *data) { int count = 0; SKIP_HEADER(data, &count); - ushort filenum = MultiGetUshort(data, &count); - ushort filewho = MultiGetUshort(data, &count); - ushort playernum = MultiGetUshort(data, &count); + uint16_t filenum = MultiGetUshort(data, &count); + uint16_t filewho = MultiGetUshort(data, &count); + uint16_t playernum = MultiGetUshort(data, &count); // If we are the server, someone want's a file. Either start sending it to them, or deny the request if (NetPlayers[playernum].file_xfer_flags == NETFILE_NONE) { // FIXME!! Figure out what file to open @@ -7750,9 +7750,9 @@ void MultiDoFileDenied(uint8_t *data) { // We asked for a file, but the request was denied for some reason int count = 0; SKIP_HEADER(data, &count); - ushort filenum = MultiGetUshort(data, &count); - ushort playernum = MultiGetUshort(data, &count); - ushort filewho = MultiGetUshort(data, &count); + uint16_t filenum = MultiGetUshort(data, &count); + uint16_t playernum = MultiGetUshort(data, &count); + uint16_t filewho = MultiGetUshort(data, &count); mprintf((0, "Got a file denied packet from %d\n", playernum)); DoNextPlayerFile(filewho); @@ -7762,10 +7762,10 @@ void MultiDoFileData(uint8_t *data) { // File data. We asked for it, now the server is sending it to us. uint32_t total_len; // Length of the entire file uint32_t curr_len; // Length of file sent so far - ushort file_id; // Defines which file this is - ushort playernum; // Who is sending us the file - ushort data_len; // between 1-450 bytes - // ushort file_who; + uint16_t file_id; // Defines which file this is + uint16_t playernum; // Who is sending us the file + uint16_t data_len; // between 1-450 bytes + // uint16_t file_who; int count = 0; uint8_t outdata[MAX_GAME_DATA_SIZE]; int outcount = 0; @@ -8134,7 +8134,7 @@ void MultiSendGhostObject(object *obj, bool ghost) { MULTI_ASSERT_NOMESSAGE(obj); int count = 0; - ushort objnum; + uint16_t objnum; uint8_t data[MAX_GAME_DATA_SIZE]; int size_offset; @@ -8155,7 +8155,7 @@ void MultiDoGhostObject(uint8_t *data) { int count = 0; SKIP_HEADER(data, &count); - ushort server_objnum, objnum; + uint16_t server_objnum, objnum; bool ghost; server_objnum = MultiGetUshort(data, &count); @@ -8467,10 +8467,10 @@ void MultiDoAttach(uint8_t *data) { int count = 0; SKIP_HEADER(data, &count); - ushort parent_num = Server_object_list[MultiGetUshort(data, &count)]; + uint16_t parent_num = Server_object_list[MultiGetUshort(data, &count)]; parent_ap = MultiGetByte(data, &count); parent = &Objects[parent_num]; - ushort child_num = Server_object_list[MultiGetUshort(data, &count)]; + uint16_t child_num = Server_object_list[MultiGetUshort(data, &count)]; child_ap = MultiGetByte(data, &count); child = &Objects[child_num]; f_aligned = MultiGetByte(data, &count) ? true : false; @@ -8515,10 +8515,10 @@ void MultiDoAttachRad(uint8_t *data) { int count = 0; SKIP_HEADER(data, &count); - ushort parent_num = Server_object_list[MultiGetUshort(data, &count)]; + uint16_t parent_num = Server_object_list[MultiGetUshort(data, &count)]; parent_ap = MultiGetByte(data, &count); parent = &Objects[parent_num]; - ushort child_num = Server_object_list[MultiGetUshort(data, &count)]; + uint16_t child_num = Server_object_list[MultiGetUshort(data, &count)]; rad = MultiGetFloat(data, &count); child = &Objects[child_num]; @@ -8559,7 +8559,7 @@ void MultiDoUnattach(uint8_t *data) { SKIP_HEADER(data, &count); int server_objnum = MultiGetUshort(data, &count); ASSERT(server_objnum >= 0 && server_objnum < MAX_OBJECTS); - ushort child_num = Server_object_list[server_objnum]; + uint16_t child_num = Server_object_list[server_objnum]; child = &Objects[child_num]; if (child_num == 65535) { mprintf((0, "Client/Server object lists don't match! (Server num %d)\n", child_num)); @@ -8617,14 +8617,14 @@ void MultiDoPermissionToFire(uint8_t *data) { pos = MultiGetVector(data, &count); // Get orientation - ushort p = MultiGetShort(data, &count); - ushort h = MultiGetShort(data, &count); - ushort b = MultiGetShort(data, &count); + uint16_t p = MultiGetShort(data, &count); + uint16_t h = MultiGetShort(data, &count); + uint16_t b = MultiGetShort(data, &count); vm_AnglesToMatrix(&orient, p, h, b); // Get room and terrain flag - ushort short_roomnum = MultiGetUshort(data, &count); + uint16_t short_roomnum = MultiGetUshort(data, &count); uint8_t outside = MultiGetByte(data, &count); int roomnum; @@ -9008,9 +9008,9 @@ void MultiDoRequestToMove(uint8_t *data) { rotthrust = MultiGetVector(data, &count); // Get orientation - ushort p = MultiGetShort(data, &count); - ushort h = MultiGetShort(data, &count); - ushort b = MultiGetShort(data, &count); + uint16_t p = MultiGetShort(data, &count); + uint16_t h = MultiGetShort(data, &count); + uint16_t b = MultiGetShort(data, &count); vm_AnglesToMatrix(&orient, p, h, b); @@ -9101,7 +9101,7 @@ void MultiDoGenericNonVis(uint8_t *data) { int num = MultiGetShort(data, &count); for (int i = 0; i < num; i++) { - ushort objnum = MultiGetUshort(data, &count); + uint16_t objnum = MultiGetUshort(data, &count); objnum = Server_object_list[objnum]; if (objnum == 65535 || !(Objects[objnum].flags & OF_SERVER_OBJECT)) { diff --git a/Descent3/multi.h b/Descent3/multi.h index b49b7b7d..864351e0 100644 --- a/Descent3/multi.h +++ b/Descent3/multi.h @@ -670,9 +670,9 @@ typedef struct { extern netgame_info Netgame; -extern ushort Local_object_list[]; -extern ushort Server_object_list[]; -extern ushort Server_spew_list[]; +extern uint16_t Local_object_list[]; +extern uint16_t Server_object_list[]; +extern uint16_t Server_spew_list[]; #define MAX_RECEIVE_SIZE 4096 #define MAX_NETWORK_GAMES 100 @@ -748,7 +748,7 @@ extern bool Got_heartbeat; // This is for breakable glass #define MAX_BROKE_GLASS 100 -extern ushort Broke_glass_rooms[], Broke_glass_faces[]; +extern uint16_t Broke_glass_rooms[], Broke_glass_faces[]; extern int Num_broke_glass; // For keeping track of damage and shields @@ -773,7 +773,7 @@ extern int Got_level_info; extern int Got_new_game_time; // For keeping track of buildings that have changed extern uint8_t Multi_building_states[]; -extern ushort Multi_num_buildings_changed; +extern uint16_t Multi_num_buildings_changed; extern bool Multi_logo_state; @@ -786,7 +786,7 @@ extern int Game_is_master_tracker_game; #define TRACKER_ID_LEN 10 // Don't change this! extern char Tracker_id[TRACKER_ID_LEN]; -extern ushort Turrett_position_counter[MAX_OBJECTS]; +extern uint16_t Turrett_position_counter[MAX_OBJECTS]; #define LOGIN_LEN 33 #define REAL_NAME_LEN 66 @@ -1040,10 +1040,10 @@ void MultiDoObjAnimUpdate(uint8_t *data); void MultiDoPlay3dSound(uint8_t *data); // Tell the clients to play a 3d sound -void MultiPlay3dSound(short soundidx, ushort objnum, int priority); +void MultiPlay3dSound(short soundidx, uint16_t objnum, int priority); // Tell the client to play a sound because a robot fired -void MultiSendRobotFireSound(short soundidx, ushort objnum); +void MultiSendRobotFireSound(short soundidx, uint16_t objnum); // Play the robot sound that the server told us about void MultiDoRobotFireSound(uint8_t *data); @@ -1109,7 +1109,7 @@ void MultiSendClientCustomData(int slot, int whoto = -1); void MultiCancelFile(int playernum, int filenum, int file_who); -void MultiAskForFile(ushort file_id, ushort file_who, ushort who); +void MultiAskForFile(uint16_t file_id, uint16_t file_who, uint16_t who); void DoNextPlayerFile(int playernum); diff --git a/Descent3/multi_client.cpp b/Descent3/multi_client.cpp index 495c18f4..e4ac30b8 100644 --- a/Descent3/multi_client.cpp +++ b/Descent3/multi_client.cpp @@ -204,7 +204,7 @@ void MultiSendMyInfo() { MultiAddByte(pps, data, &count); // pilot picture id - ushort ppic_id; + uint16_t ppic_id; Current_pilot.get_multiplayer_data(NULL, NULL, NULL, &ppic_id); MultiAddUshort(ppic_id, data, &count); diff --git a/Descent3/multi_connect.cpp b/Descent3/multi_connect.cpp index 83734960..62f5676a 100644 --- a/Descent3/multi_connect.cpp +++ b/Descent3/multi_connect.cpp @@ -423,7 +423,7 @@ int TryToJoinServer(network_address *addr) { // Client only void MultiDoConnectionAccepted(uint8_t *data) { int count = 0; - ushort server_version; + uint16_t server_version; // Skip header SKIP_HEADER(data, &count); @@ -902,7 +902,7 @@ void MultiCloseGame() { #define GET_GAME_INFO_TIME 2 // Fills in the passed in buffers with the info of the games that are on this subnet -int SearchForLocalGamesTCP(uint32_t ask, ushort port) { +int SearchForLocalGamesTCP(uint32_t ask, uint16_t port) { int count = 0; int size; int tries = 0; @@ -931,7 +931,7 @@ int SearchForLocalGamesTCP(uint32_t ask, ushort port) { } // Fills in the passed in buffers with the info of the games that are on this subnet -int SearchForGamesPXO(uint32_t ask, ushort port) { +int SearchForGamesPXO(uint32_t ask, uint16_t port) { int count = 0; int size; int tries = 0; diff --git a/Descent3/multi_dll_mgr.cpp b/Descent3/multi_dll_mgr.cpp index 0d606438..614e3669 100644 --- a/Descent3/multi_dll_mgr.cpp +++ b/Descent3/multi_dll_mgr.cpp @@ -319,8 +319,8 @@ void *callback = NULL; module MultiDLLHandle = {NULL}; -int SearchForLocalGamesTCP(uint32_t ask, ushort port); -int SearchForGamesPXO(uint32_t ask, ushort port); +int SearchForLocalGamesTCP(uint32_t ask, uint16_t port); +int SearchForGamesPXO(uint32_t ask, uint16_t port); extern uint8_t NewUIWindow_alpha; extern void DoScreenshot(); extern void UpdateAndPackGameList(void); @@ -382,7 +382,7 @@ extern int Num_modems_found; #define DLL_BRIEFING_FONT 1 #define DLL_BIG_BRIEFING_FONT 2 extern uint16_t nw_ListenPort; -extern ushort PXOPort; +extern uint16_t PXOPort; void GetMultiAPI(multi_api *api) { // make the compiler happy diff --git a/Descent3/multi_external.h b/Descent3/multi_external.h index 2a3e67c8..9bb1804c 100644 --- a/Descent3/multi_external.h +++ b/Descent3/multi_external.h @@ -185,7 +185,7 @@ typedef struct { uint32_t file_xfer_id; // File id that we are sending uint32_t file_xfer_who; // Who the file is for CFILE *file_xfer_cfile; // File handle for src/target file - ushort position_counter; // for making sure we don't get position packets out of order + uint16_t position_counter; // for making sure we don't get position packets out of order char ship_logo[_MAX_PATH]; char voice_taunt1[_MAX_PATH]; char voice_taunt2[_MAX_PATH]; @@ -198,7 +198,7 @@ typedef struct { DWORD dpidPlayer; // directplay ID of player created float ping_time; float last_ping_time; - ushort pilot_pic_id; + uint16_t pilot_pic_id; float percent_loss; uint8_t digest[16]; } netplayer; @@ -211,9 +211,9 @@ typedef struct { char mission[MSN_NAMELEN]; char mission_name[MISSION_NAME_LEN]; char scriptname[NETGAME_SCRIPT_LEN]; - ushort level_num; - ushort curr_num_players; - ushort max_num_players; + uint16_t level_num; + uint16_t curr_num_players; + uint16_t max_num_players; float server_response_time; uint32_t flags; float last_update; @@ -244,7 +244,7 @@ typedef struct { #define NF_COOP 0x40000 // This game is a cooperative game typedef struct { - ushort server_version; // This is so client and server code matches + uint16_t server_version; // This is so client and server code matches char name[NETGAME_NAME_LEN]; char mission[MSN_NAMELEN]; char mission_name[MISSION_NAME_LEN]; @@ -287,9 +287,9 @@ inline void MultiAddShort(short element, uint8_t *data, int *count) { *count += sizeof(short); } -inline void MultiAddUshort(ushort element, uint8_t *data, int *count) { - *(ushort *)(data + *count) = INTEL_SHORT(element); - *count += sizeof(ushort); +inline void MultiAddUshort(uint16_t element, uint8_t *data, int *count) { + *(uint16_t *)(data + *count) = INTEL_SHORT(element); + *count += sizeof(uint16_t); } inline void MultiAddInt(int element, uint8_t *data, int *count) { @@ -340,8 +340,8 @@ inline short MultiGetShort(uint8_t *data, int *count) { return INTEL_SHORT(element); } -inline ushort MultiGetUshort(uint8_t *data, int *count) { - ushort element = (*(ushort *)(data + *count)); +inline uint16_t MultiGetUshort(uint8_t *data, int *count) { + uint16_t element = (*(uint16_t *)(data + *count)); *count += sizeof(short); return INTEL_SHORT(element); } diff --git a/Descent3/multi_server.cpp b/Descent3/multi_server.cpp index 1f64be65..5c1a83b0 100644 --- a/Descent3/multi_server.cpp +++ b/Descent3/multi_server.cpp @@ -676,16 +676,16 @@ void MultiProcessShipChecksum(MD5 *md5, int ship_index); int GameDLLGetConnectingPlayersTeam(int slot); int Moved_robots[MAX_NET_PLAYERS][MAX_CHANGED_OBJECTS]; -ushort Num_moved_robots[MAX_NET_PLAYERS]; +uint16_t Num_moved_robots[MAX_NET_PLAYERS]; int Changed_anim[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS]; -ushort Num_changed_anim[MAX_NET_PLAYERS]; +uint16_t Num_changed_anim[MAX_NET_PLAYERS]; int Changed_wb_anim[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS]; -ushort Num_changed_wb_anim[MAX_NET_PLAYERS]; +uint16_t Num_changed_wb_anim[MAX_NET_PLAYERS]; int Changed_turret[MAX_CHANGED_OBJECTS][MAX_NET_PLAYERS]; -ushort Num_changed_turret[MAX_NET_PLAYERS]; +uint16_t Num_changed_turret[MAX_NET_PLAYERS]; float last_sent_bytes[MAX_NET_PLAYERS]; float Multi_last_send_visible[MAX_NET_PLAYERS]; @@ -1216,7 +1216,7 @@ void MultiSendBuildings(int slot) { for (int i = 0; i < MAX_OBJECTS; i++) { if (Multi_building_states[i] != 0) { - MultiAddShort((ushort)i, data, &count); + MultiAddShort((uint16_t)i, data, &count); } } @@ -1264,7 +1264,7 @@ void MultiSendJoinDemoObjects(int slot) { } } - ASSERT((num_demo_objects * sizeof(ushort) + sizeof(ushort)) < MAX_GAME_DATA_SIZE); + ASSERT((num_demo_objects * sizeof(uint16_t) + sizeof(uint16_t)) < MAX_GAME_DATA_SIZE); mprintf((0, "Sending DemoJoinObjects (%d)\n", num_demo_objects)); @@ -1358,14 +1358,14 @@ void MultiSendJoinObjects(int slot) { ASSERT(Netgame.local_role == LR_SERVER); uint8_t data[MAX_GAME_DATA_SIZE]; - ushort outgoing_objects[MAX_OBJECTS]; + uint16_t outgoing_objects[MAX_OBJECTS]; int count = 0; int size_offset; int i; mprintf((0, "Sending MP_JOIN_OBJECTS packet to player %d!\n", slot)); - ushort total_objects = 0; + uint16_t total_objects = 0; last_sent_bytes[slot] = timer_GetTime(); Num_moved_robots[slot] = 0; @@ -2183,7 +2183,7 @@ void MultiUpdateRobotMovedList(int slot) { void MultiSetupNonVisRobots(int slot, object *obj) { obj->generic_nonvis_flags |= (1 << slot); } // Sends out a list of generics that this client can't see -void MultiSendGenericNonVis(int slot, ushort *objarray, int num) { +void MultiSendGenericNonVis(int slot, uint16_t *objarray, int num) { uint8_t data[MAX_GAME_DATA_SIZE]; int count = 0; int size_offset; @@ -2207,7 +2207,7 @@ void MultiSendGenericNonVis(int slot, ushort *objarray, int num) { // Does the bookkeeping that needs to be done for non visible generic objects and a player void MultiDoNonVisGenericForSlot(int slot) { // Keep track of the ones we need to send about - ushort send_out[MAX_OBJECTS]; + uint16_t send_out[MAX_OBJECTS]; int num_to_send = 0; int i; diff --git a/Descent3/newui_core.cpp b/Descent3/newui_core.cpp index e4bd98d5..98458f19 100644 --- a/Descent3/newui_core.cpp +++ b/Descent3/newui_core.cpp @@ -2072,7 +2072,7 @@ void newuiSheet::AddHotspot(const char *title, short w, short h, short id, bool } // adds a listbox -newuiListBox *newuiSheet::AddListBox(short w, short h, short id, ushort flags) { +newuiListBox *newuiSheet::AddListBox(short w, short h, short id, uint16_t flags) { newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_LISTBOX, NULL); newuiListBox *lb = new newuiListBox; lb->Create(m_parent, id, 0, 0, w, h, flags); @@ -2082,7 +2082,7 @@ newuiListBox *newuiSheet::AddListBox(short w, short h, short id, ushort flags) { } // adds a listbox -newuiComboBox *newuiSheet::AddComboBox(short id, ushort flags) { +newuiComboBox *newuiSheet::AddComboBox(short id, uint16_t flags) { newuiSheet::t_gadget_desc *gadget = AddGadget(id, GADGET_COMBOBOX, NULL); newuiComboBox *cb = new newuiComboBox; cb->Create(m_parent, id, 0, 0, flags); @@ -2647,7 +2647,7 @@ newuiListBox::newuiListBox() { m_click_time = 0.0f; } -void newuiListBox::Create(UIWindow *wnd, short id, short x, short y, short w, short h, ushort flags) { +void newuiListBox::Create(UIWindow *wnd, short id, short x, short y, short w, short h, uint16_t flags) { m_ItemList = NULL; m_Virt2Real = NULL; m_Real2Virt = NULL; @@ -3410,7 +3410,7 @@ newuiComboBox::newuiComboBox() { m_Index = 0; } -void newuiComboBox::Create(UIWindow *wnd, short id, short x, short y, ushort flags) { +void newuiComboBox::Create(UIWindow *wnd, short id, short x, short y, uint16_t flags) { m_ItemList = NULL; m_Virt2Real = NULL; m_Real2Virt = NULL; diff --git a/Descent3/newui_core.h b/Descent3/newui_core.h index b28894ee..1b34944b 100644 --- a/Descent3/newui_core.h +++ b/Descent3/newui_core.h @@ -271,10 +271,10 @@ public: char *AddChangeableText(int buflen); // adds a listbox - newuiListBox *AddListBox(short w, short h, short id, ushort flags = 0); + newuiListBox *AddListBox(short w, short h, short id, uint16_t flags = 0); // adds a listbox - newuiComboBox *AddComboBox(short id, ushort flags = 0); + newuiComboBox *AddComboBox(short id, uint16_t flags = 0); // adds an edit box char *AddEditBox(const char *title, short maxlen = NEWUI_EDIT_BUFLEN, short w = 0, short id = DEFAULT_NEWUID, @@ -410,7 +410,7 @@ public: newuiListBox(); // creates listbox - void Create(UIWindow *wnd, short id, short x, short y, short w, short h, ushort flags); + void Create(UIWindow *wnd, short id, short x, short y, short w, short h, uint16_t flags); // functions to add or remove items, void AddItem(const char *name); @@ -480,7 +480,7 @@ public: newuiComboBox(); // creates listbox - void Create(UIWindow *wnd, short id, short x, short y, ushort flags); + void Create(UIWindow *wnd, short id, short x, short y, uint16_t flags); // functions to add or remove items, void AddItem(const char *name); diff --git a/Descent3/object.cpp b/Descent3/object.cpp index 4dff79f9..a4949bd3 100644 --- a/Descent3/object.cpp +++ b/Descent3/object.cpp @@ -662,7 +662,7 @@ * Rooms cannot cycle through anims * * 119 5/04/98 12:30p Matt - * ObjCreate() now takes object id as a ushort + * ObjCreate() now takes object id as a uint16_t * * 118 5/04/98 12:28p Matt * Added shard objects @@ -1680,7 +1680,7 @@ void ObjSetAABB(object *obj) { //----------------------------------------------------------------------------- // initialize a new object. adds to the list for the given room // returns the object number -int ObjCreate(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle) { +int ObjCreate(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle) { int objnum; object *obj; int handle; @@ -3327,7 +3327,7 @@ bool ObjGetAnimUpdate(uint16_t objnum, custom_anim *multi_anim_info) { ai_frame *ai_info = obj->ai_info; multi_anim_info->server_time = Gametime; - multi_anim_info->server_anim_frame = (ushort)(pm->anim_frame * 256.0f); + multi_anim_info->server_anim_frame = (uint16_t)(pm->anim_frame * 256.0f); multi_anim_info->anim_start_frame = pm->anim_start_frame; multi_anim_info->anim_end_frame = pm->anim_end_frame; diff --git a/Descent3/object.h b/Descent3/object.h index 82f3bf63..ec228140 100644 --- a/Descent3/object.h +++ b/Descent3/object.h @@ -271,7 +271,7 @@ * Added hit_death_dot * * 100 5/04/98 12:30p Matt - * ObjCreate() now takes object id as a ushort + * ObjCreate() now takes object id as a uint16_t * * 99 5/04/98 12:28p Matt * Added shard objects @@ -741,7 +741,7 @@ void ObjSetAABB(object *obj); // initialize a new object. adds to the list for the given room // returns the object number -int ObjCreate(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, +int ObjCreate(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle = OBJECT_HANDLE_NONE); // remove object from the world diff --git a/Descent3/osiris_predefs.cpp b/Descent3/osiris_predefs.cpp index ec5653b8..13ba0beb 100644 --- a/Descent3/osiris_predefs.cpp +++ b/Descent3/osiris_predefs.cpp @@ -33,7 +33,7 @@ * Made sure the wb is a valid index * * 126 11/04/99 3:08p Jeff - * fixed ushort check with -1 bug + * fixed uint16_t check with -1 bug * * 125 11/03/99 10:20a Chris * Added the ability to find out if a room is volatile @@ -1403,10 +1403,10 @@ void osipf_ObjectValue(int handle, char op, char var_handle, void *ptr, int inde break; case OBJV_US_ID: if (op == VF_SET) { - m.id = *(ushort *)ptr; + m.id = *(uint16_t *)ptr; msafe_CallFunction(MSAFE_OBJECT_ID, &m); } else if (op == VF_GET) - (*(ushort *)ptr) = obj->id; + (*(uint16_t *)ptr) = obj->id; break; case OBJV_V_POS: if (op == VF_SET) { @@ -2567,12 +2567,12 @@ void osipf_OpenMessageWindow(const char *title, ...) { Int3(); // ummm, this is a blank function, should we ever be calling it? } -int osipf_ObjCreate(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle, +int osipf_ObjCreate(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle, vector *initial_velocity) { object *obj; int objnum; - if (id == 65535) // since it is a ushort, this is == -1 + if (id == 65535) // since it is a uint16_t, this is == -1 return OBJECT_HANDLE_NONE; if (((roomnum >= 0) && (roomnum <= Highest_room_index) && (Rooms[roomnum].used)) || (ROOMNUM_OUTSIDE(roomnum))) { diff --git a/Descent3/osiris_predefs.h b/Descent3/osiris_predefs.h index 89fc29a7..8e540f64 100644 --- a/Descent3/osiris_predefs.h +++ b/Descent3/osiris_predefs.h @@ -341,7 +341,7 @@ void osipf_SetAllControls(bool enabled); void osipf_SetControls(int fn, bool enabled); // Creates an object -int osipf_ObjCreate(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient = NULL, +int osipf_ObjCreate(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient = NULL, int parent_handle = OBJECT_HANDLE_NONE, vector *velocity = NULL); // OBJECT Properties. diff --git a/Descent3/pilot.cpp b/Descent3/pilot.cpp index 8a5a9a29..e6063f2c 100644 --- a/Descent3/pilot.cpp +++ b/Descent3/pilot.cpp @@ -1171,7 +1171,7 @@ void PilotSelect(void) { if (PPic_QueryPilot(pname)) { ShowPilotPicDialog(&working_pilot); } else { - ushort pid; + uint16_t pid; pid = PPIC_INVALID_ID; working_pilot.set_multiplayer_data(NULL, NULL, NULL, &pid); @@ -3690,8 +3690,8 @@ struct { int blank_bmp; int curr_bmp; int curr_index; - ushort size; - ushort *id_list; + uint16_t size; + uint16_t *id_list; newuiListBox *listbox; UIStatic *bmp_disp; } PPicDlgInfo; @@ -3752,13 +3752,13 @@ void ShowPilotPicDialog(pilot *Pilot) { Pilot->get_name(pname); - ushort num_pilots = PPic_QueryPilot(pname); + uint16_t num_pilots = PPic_QueryPilot(pname); int blank_bmp_handle; // only display the dialog if there is a pilot to choose from if (num_pilots == 0) { mprintf((0, "No Pilot Pics available for %s\n", pname)); - ushort pid; + uint16_t pid; pid = PPIC_INVALID_ID; Pilot->set_multiplayer_data(NULL, NULL, NULL, &pid); @@ -3768,7 +3768,7 @@ void ShowPilotPicDialog(pilot *Pilot) { blank_bmp_handle = bm_AllocBitmap(64, 64, 0); if (blank_bmp_handle <= BAD_BITMAP_HANDLE) { - ushort pid; + uint16_t pid; pid = PPIC_INVALID_ID; Pilot->set_multiplayer_data(NULL, NULL, NULL, &pid); @@ -3776,7 +3776,7 @@ void ShowPilotPicDialog(pilot *Pilot) { DoMessageBox(TXT_ERROR, TXT_ERRCREATINGDIALOG, MSGBOX_OK, UICOL_WINDOW_TITLE, UICOL_TEXT_NORMAL); return; } - ushort *data = bm_data(blank_bmp_handle, 0); + uint16_t *data = bm_data(blank_bmp_handle, 0); for (int i = 0; i < 64 * 64; i++) { data[i] = GR_RGB16(0, 0, 0) | OPAQUE_FLAG; } @@ -3808,8 +3808,8 @@ void ShowPilotPicDialog(pilot *Pilot) { // Initialize PPicDlgInfo data // --------------------------- - ushort *id_list; - id_list = (ushort *)mem_malloc(num_pilots * sizeof(ushort)); + uint16_t *id_list; + id_list = (uint16_t *)mem_malloc(num_pilots * sizeof(uint16_t)); if (!id_list) { // out of memory @@ -3826,7 +3826,7 @@ void ShowPilotPicDialog(pilot *Pilot) { // fill in dialog data // ------------------- - ushort temp_id; + uint16_t temp_id; int idx; idx = 0; @@ -3847,7 +3847,7 @@ void ShowPilotPicDialog(pilot *Pilot) { list->AddItem(TXT_NONE); char temp_buffer[PILOT_STRING_SIZE + 6]; - ushort ppic_id; + uint16_t ppic_id; Pilot->get_multiplayer_data(NULL, NULL, NULL, &ppic_id); Pilot->get_name(pname); @@ -3886,7 +3886,7 @@ void ShowPilotPicDialog(pilot *Pilot) { } selected_index = list->GetCurrentIndex(); - ushort pid; + uint16_t pid; if (selected_index == 0) { pid = PPIC_INVALID_ID; } else { @@ -3924,7 +3924,7 @@ void _ReadOldPilotFile(pilot *Pilot, bool keyconfig, bool missiondata) { char pfilename[_MAX_FNAME]; char buffer[256]; uint8_t temp_b; - ushort temp_s; + uint16_t temp_s; int temp_i; int filever, i, nctlfuncs; @@ -3988,15 +3988,15 @@ void _ReadOldPilotFile(pilot *Pilot, bool keyconfig, bool missiondata) { // added in version 0x9 int n; - ushort widx; + uint16_t widx; n = (int)cf_ReadByte(file); for (i = 0; i < n; i++) { - widx = (ushort)cf_ReadShort(file); + widx = (uint16_t)cf_ReadShort(file); SetAutoSelectPrimaryWpnIdx(i, widx); } n = (int)cf_ReadByte(file); for (i = 0; i < n; i++) { - widx = (ushort)cf_ReadShort(file); + widx = (uint16_t)cf_ReadShort(file); SetAutoSelectSecondaryWpnIdx(i, widx); } diff --git a/Descent3/pilot.h b/Descent3/pilot.h index bf28b32e..bbc88067 100644 --- a/Descent3/pilot.h +++ b/Descent3/pilot.h @@ -240,8 +240,8 @@ typedef struct //controller settings cntrldata controls[NUM_CONTROLLER_FUNCTIONS]; // hud layout using the STAT mask - ushort hud_stat; - ushort hud_graphical_stat; + uint16_t hud_stat; + uint16_t hud_graphical_stat; // hud display mode uint8_t hud_mode; // do we read the controller port also (beyond keyboard/mouse) @@ -252,7 +252,7 @@ typedef struct int game_window_w, game_window_h; //pilot picture image id - ushort picture_id; + uint16_t picture_id; //number of mission's flown int num_missions_flown; diff --git a/Descent3/pilot_class.cpp b/Descent3/pilot_class.cpp index 3da96561..66f49f2a 100644 --- a/Descent3/pilot_class.cpp +++ b/Descent3/pilot_class.cpp @@ -666,7 +666,7 @@ void pilot::get_ship(char *ship) { } } -void pilot::set_multiplayer_data(const char *logo, const char *audio1, const char *audio2, const ushort *ppic, const char *audio3, const char *audio4) { +void pilot::set_multiplayer_data(const char *logo, const char *audio1, const char *audio2, const uint16_t *ppic, const char *audio3, const char *audio4) { if (logo) { if (ship_logo) { mem_free(ship_logo); @@ -747,7 +747,7 @@ void pilot::set_multiplayer_data(const char *logo, const char *audio1, const cha write_pending = true; } } -void pilot::get_multiplayer_data(char *logo, char *audio1, char *audio2, ushort *ppic, char *audio3, char *audio4) { +void pilot::get_multiplayer_data(char *logo, char *audio1, char *audio2, uint16_t *ppic, char *audio3, char *audio4) { if (logo) { if (ship_logo) { strcpy(logo, ship_logo); @@ -848,7 +848,7 @@ void pilot::get_guidebot_name(char *name) { } } -void pilot::set_hud_data(uint8_t *hmode, ushort *hstat, ushort *hgraphicalstat, int *gw_w, int *gw_h) { +void pilot::set_hud_data(uint8_t *hmode, uint16_t *hstat, uint16_t *hgraphicalstat, int *gw_w, int *gw_h) { if (hmode) { // should do checking here switch (*hmode) { @@ -882,7 +882,7 @@ void pilot::set_hud_data(uint8_t *hmode, ushort *hstat, ushort *hgraphicalstat, write_pending = true; } } -void pilot::get_hud_data(uint8_t *hmode, ushort *hstat, ushort *hgraphicalstat, int *gw_w, int *gw_h) { +void pilot::get_hud_data(uint8_t *hmode, uint16_t *hstat, uint16_t *hgraphicalstat, int *gw_w, int *gw_h) { if (hmode) { *hmode = hud_mode; } @@ -1084,7 +1084,7 @@ void pilot::write_custom_multiplayer_data(CFILE *file) { void pilot::read_custom_multiplayer_data(CFILE *file, bool skip) { char buffer[PAGENAME_LEN]; - ushort temp; + uint16_t temp; cf_ReadString(buffer, PAGENAME_LEN, file); if (!skip) { @@ -1214,7 +1214,7 @@ void pilot::write_hud_data(CFILE *file) { void pilot::read_hud_data(CFILE *file, bool skip) { uint8_t temp_b; - ushort temp_s; + uint16_t temp_s; int temp_i; temp_b = cf_ReadByte(file); diff --git a/Descent3/pilot_class.h b/Descent3/pilot_class.h index 264256a4..0e272ec4 100644 --- a/Descent3/pilot_class.h +++ b/Descent3/pilot_class.h @@ -208,17 +208,17 @@ public: void set_ship(const char *ship); void get_ship(char *ship); - void set_multiplayer_data(const char *logo = NULL, const char *audio1 = NULL, const char *audio2 = NULL, const ushort *ppic = NULL, + void set_multiplayer_data(const char *logo = NULL, const char *audio1 = NULL, const char *audio2 = NULL, const uint16_t *ppic = NULL, const char *audio3 = NULL, const char *audio4 = NULL); - void get_multiplayer_data(char *logo = NULL, char *audio1 = NULL, char *audio2 = NULL, ushort *ppic = NULL, + void get_multiplayer_data(char *logo = NULL, char *audio1 = NULL, char *audio2 = NULL, uint16_t *ppic = NULL, char *audio3 = NULL, char *audio4 = NULL); void set_difficulty(uint8_t diff); void get_difficulty(uint8_t *diff); - void set_hud_data(uint8_t *hmode = NULL, ushort *hstat = NULL, ushort *hgraphicalstat = NULL, int *gw_w = NULL, + void set_hud_data(uint8_t *hmode = NULL, uint16_t *hstat = NULL, uint16_t *hgraphicalstat = NULL, int *gw_w = NULL, int *gw_h = NULL); - void get_hud_data(uint8_t *hmode = NULL, ushort *hstat = NULL, ushort *hgraphicalstat = NULL, int *gw_w = NULL, + void get_hud_data(uint8_t *hmode = NULL, uint16_t *hstat = NULL, uint16_t *hgraphicalstat = NULL, int *gw_w = NULL, int *gw_h = NULL); void set_profanity_filter(bool enable); @@ -284,21 +284,21 @@ private: char *audio4_file; // audio taunt #2 (filename) char *guidebot_name; // guidebot name - ushort picture_id; // pilot picture image id + uint16_t picture_id; // pilot picture image id uint8_t difficulty; // difficulty setting for this pilot (DIFFICULTY_*) uint8_t hud_mode; // hud display mode bool profanity_filter_on, audiotaunts; - ushort hud_stat; // hud layout using the STAT mask - ushort hud_graphical_stat; + uint16_t hud_stat; // hud layout using the STAT mask + uint16_t hud_graphical_stat; int game_window_w, game_window_h; // game window size int num_missions_flown; // number of mission's flown tMissionData *mission_data; // mission data - ushort PrimarySelectList[MAX_PRIMARY_WEAPONS]; - ushort SecondarySelectList[MAX_SECONDARY_WEAPONS]; + uint16_t PrimarySelectList[MAX_PRIMARY_WEAPONS]; + uint16_t SecondarySelectList[MAX_SECONDARY_WEAPONS]; tGameToggles gameplay_toggles; // special options in config menu. diff --git a/Descent3/postrender.cpp b/Descent3/postrender.cpp index 7e5401ef..583d940b 100644 --- a/Descent3/postrender.cpp +++ b/Descent3/postrender.cpp @@ -127,8 +127,8 @@ void SortPostrenders() { l = 0; r = Num_postrenders - 1; - ushort state_stack_counter = 0; - ushort state_stack[MAX_POSTRENDERS]; + uint16_t state_stack_counter = 0; + uint16_t state_stack[MAX_POSTRENDERS]; while (1) { while (r > l) { diff --git a/Descent3/procedurals.cpp b/Descent3/procedurals.cpp index 8de4c334..ed61f4e6 100644 --- a/Descent3/procedurals.cpp +++ b/Descent3/procedurals.cpp @@ -69,12 +69,12 @@ uint8_t perm[TABSIZE]; static float Noise_table[TABSIZE * 3]; dynamic_proc_element DynamicProcElements[MAX_PROC_ELEMENTS]; -ushort DefaultProcPalette[256]; +uint16_t DefaultProcPalette[256]; int Num_proc_elements = 0; static short Proc_free_list[MAX_PROC_ELEMENTS]; -ushort ProcFadeTable[32768]; +uint16_t ProcFadeTable[32768]; #define NUM_WATER_SHADES 64 -ushort WaterProcTableHi[NUM_WATER_SHADES][256]; +uint16_t WaterProcTableHi[NUM_WATER_SHADES][256]; uint8_t WaterProcTableLo[NUM_WATER_SHADES][256]; const char *ProcNames[] = {"None", "Line Lightning", "Sphere lightning", "Straight", "Rising Embers", "Random Embers", "Spinners", "Roamers", "Fountain", "Cone", "Fall Right", "Fall Left", @@ -84,7 +84,7 @@ static uint8_t *ProcDestData; int pholdrand = 1; static inline int prand() { return (((pholdrand = pholdrand * 214013L + 2531011L) >> 16) & 0x7fff); } // Given an array of r,g,b values, generates a 16bit palette table for those colors -void GeneratePaletteForProcedural(uint8_t *r, uint8_t *g, uint8_t *b, ushort *pal) { +void GeneratePaletteForProcedural(uint8_t *r, uint8_t *g, uint8_t *b, uint16_t *pal) { int i; float fr, fg, fb; for (i = 0; i < 256; i++) { @@ -935,8 +935,8 @@ void DrawWaterNoLight(int handle) { int offset = 0; proc_struct *procedural = GameTextures[handle].procedural; int dest_bitmap = procedural->procedural_bitmap; - ushort *dest_data = (ushort *)bm_data(dest_bitmap, 0); - ushort *src_data = (ushort *)bm_data(GameTextures[handle].bm_handle, 0); + uint16_t *dest_data = (uint16_t *)bm_data(dest_bitmap, 0); + uint16_t *src_data = (uint16_t *)bm_data(GameTextures[handle].bm_handle, 0); short *ptr = (short *)procedural->proc1; for (y = 0; y < PROC_SIZE; y++) { for (x = 0; x < PROC_SIZE; x++, offset++) { @@ -962,12 +962,12 @@ void DrawWaterNoLight(int handle) { void DrawWaterWithLight(int handle, int lightval) { int dx, dy; int x, y; - ushort c; + uint16_t c; int offset = 0; proc_struct *procedural = GameTextures[handle].procedural; int dest_bitmap = procedural->procedural_bitmap; - ushort *dest_data = (ushort *)bm_data(dest_bitmap, 0); - ushort *src_data = (ushort *)bm_data(GameTextures[handle].bm_handle, 0); + uint16_t *dest_data = (uint16_t *)bm_data(dest_bitmap, 0); + uint16_t *src_data = (uint16_t *)bm_data(GameTextures[handle].bm_handle, 0); short *ptr = (short *)procedural->proc1; for (y = 0; y < PROC_SIZE; y++) { int ychange, ychange2; @@ -1136,11 +1136,11 @@ void AllocateMemoryForWaterProcedural(int handle) { mem_free(procedural->proc1); if (procedural->proc2) mem_free(procedural->proc2); - GameTextures[handle].procedural->proc1 = (ushort *)mem_malloc(w * h * 2); + GameTextures[handle].procedural->proc1 = (uint16_t *)mem_malloc(w * h * 2); ASSERT(GameTextures[handle].procedural->proc1); memset(GameTextures[handle].procedural->proc1, 0, w * h * 2); - GameTextures[handle].procedural->proc2 = (ushort *)mem_malloc(w * h * 2); + GameTextures[handle].procedural->proc2 = (uint16_t *)mem_malloc(w * h * 2); ASSERT(GameTextures[handle].procedural->proc2); memset(GameTextures[handle].procedural->proc2, 0, w * h * 2); procedural->memory_type = PROC_MEMORY_TYPE_WATER; @@ -1173,7 +1173,7 @@ void EvaluateWaterProcedural(int handle) { } if (EasterEgg) { if (Easter_egg_handle != -1) { - ushort *src_data = bm_data(Easter_egg_handle, 0); + uint16_t *src_data = bm_data(Easter_egg_handle, 0); short *dest_data = (short *)GameTextures[handle].procedural->proc1; int sw = bm_w(Easter_egg_handle, 0); int sh = bm_w(Easter_egg_handle, 0); @@ -1334,8 +1334,8 @@ void EvaluateFireProcedural(int handle) { BlendProcTexture(handle); ProcDestData = (uint8_t *)procedural->proc2; int total = PROC_SIZE * PROC_SIZE; - ushort *data = bm_data(dest_bitmap, 0); - ushort *pal = procedural->palette; + uint16_t *data = bm_data(dest_bitmap, 0); + uint16_t *pal = procedural->palette; for (i = 0; i < total; i++, data++, ProcDestData++) { *data = pal[*ProcDestData]; } diff --git a/Descent3/procedurals.h b/Descent3/procedurals.h index 46c7034a..b545445c 100644 --- a/Descent3/procedurals.h +++ b/Descent3/procedurals.h @@ -62,7 +62,7 @@ typedef struct { extern dynamic_proc_element DynamicProcElements[]; extern const char *ProcNames[], *WaterProcNames[]; -extern ushort DefaultProcPalette[]; +extern uint16_t DefaultProcPalette[]; // Goes through our array and clears the slots out void InitProcedurals(); @@ -92,6 +92,6 @@ int ProcElementAllocate(); int ProcElementFree(int index); // Given an array of r,g,b values, generates a 16bit palette table for those colors -void GeneratePaletteForProcedural(uint8_t *r, uint8_t *g, uint8_t *b, ushort *pal); +void GeneratePaletteForProcedural(uint8_t *r, uint8_t *g, uint8_t *b, uint16_t *pal); #endif diff --git a/Descent3/render.cpp b/Descent3/render.cpp index 1e7e9d5b..10ca8f79 100644 --- a/Descent3/render.cpp +++ b/Descent3/render.cpp @@ -162,7 +162,7 @@ typedef struct { } smooth_spec_vert; smooth_spec_vert Smooth_verts[MAX_VERTS_PER_ROOM]; // For scorch rendering -ushort Scorches_to_render[MAX_FACES_PER_ROOM]; +uint16_t Scorches_to_render[MAX_FACES_PER_ROOM]; int Num_scorches_to_render = 0; // For rendering volumetric fog #define MAX_FOGGED_ROOMS_PER_FRAME 8 @@ -1286,8 +1286,8 @@ void RenderSpecularFacesFlat(room *rp) { static float lm_red[32], lm_green[32], lm_blue[32]; int num_smooth_faces = 0; int num_smooth_used = 0; - ushort smooth_faces[MAX_FACES_PER_ROOM]; - ushort smooth_used[MAX_VERTS_PER_ROOM]; + uint16_t smooth_faces[MAX_FACES_PER_ROOM]; + uint16_t smooth_used[MAX_VERTS_PER_ROOM]; int i; ASSERT(Num_specular_faces_to_render > 0); if (!UseHardware) @@ -1337,7 +1337,7 @@ void RenderSpecularFacesFlat(room *rp) { continue; int lm_handle; - ushort *data; + uint16_t *data; int w, h; if (fp->lmi_handle == 65535) { @@ -1346,7 +1346,7 @@ void RenderSpecularFacesFlat(room *rp) { } lm_handle = LightmapInfo[fp->lmi_handle].lm_handle; - data = (ushort *)lm_data(lm_handle); + data = (uint16_t *)lm_data(lm_handle); w = lm_w(lm_handle); h = lm_h(lm_handle); @@ -1356,7 +1356,7 @@ void RenderSpecularFacesFlat(room *rp) { float scalar = 0; float u, v; int int_u, int_v; - ushort texel; + uint16_t texel; int r, g, b; float vr, vg, vb; @@ -1383,7 +1383,7 @@ void RenderSpecularFacesFlat(room *rp) { }*/ for (t = 0; t < limit; t++) { - ushort color; + uint16_t color; vector incident_norm; float spec_scalar; @@ -1847,7 +1847,7 @@ void RenderFace(room *rp, int facenum) { if (fp->flags & FF_LIGHTMAP) { int lm_handle = LightmapInfo[fp->lmi_handle].lm_handle; - ushort *data = (ushort *)lm_data(lm_handle); + uint16_t *data = (uint16_t *)lm_data(lm_handle); int w = lm_w(lm_handle); int h = lm_h(lm_handle); @@ -1857,7 +1857,7 @@ void RenderFace(room *rp, int facenum) { g3Point *p = &pointbuffer[i]; int int_u = u; int int_v = v; - ushort texel = data[int_v * w + int_u]; + uint16_t texel = data[int_v * w + int_u]; int r = (texel >> 10) & 0x1f; int g = (texel >> 5) & 0x1f; int b = (texel) & 0x1f; @@ -2056,7 +2056,7 @@ draw_fog: ASSERT(fp->lmi_handle != BAD_LMI_INDEX); lightmap_info *lmi = &LightmapInfo[fp->lmi_handle]; - ushort *src_data = (ushort *)lm_data(lmi->lm_handle); + uint16_t *src_data = (uint16_t *)lm_data(lmi->lm_handle); matrix facematrix; vector fvec = -lmi->normal; vm_VectorToMatrix(&facematrix, &fvec, NULL, NULL); @@ -2877,7 +2877,7 @@ void RenderMirroredRoom(room *rp) { #if (defined(RELEASE) && defined(KATMAI)) vector4 kat_vecs[MAX_VERTS_PER_ROOM]; #endif - ushort save_flags[MAX_FACES_PER_ROOM]; + uint16_t save_flags[MAX_FACES_PER_ROOM]; bool restore_index = true; int save_index = Global_buffer_index; @@ -3617,8 +3617,8 @@ void SortStates(state_limited_element *state_array, int cellcount) { int l, r; l = 0; r = cellcount - 1; - ushort state_stack_counter = 0; - ushort state_stack[2000]; + uint16_t state_stack_counter = 0; + uint16_t state_stack[2000]; while (1) { while (r > l) { @@ -3685,7 +3685,7 @@ void ConsolidateMineMirrors() { rp->mirror_face = 0; continue; } - rp->mirror_faces_list = (ushort *)mem_malloc(num_mirror_faces * sizeof(ushort)); + rp->mirror_faces_list = (uint16_t *)mem_malloc(num_mirror_faces * sizeof(uint16_t)); ASSERT(rp->mirror_faces_list); rp->num_mirror_faces = num_mirror_faces; // Now go through and fill in our list diff --git a/Descent3/robotfirestruct.h b/Descent3/robotfirestruct.h index 5bdaa40e..253e5356 100644 --- a/Descent3/robotfirestruct.h +++ b/Descent3/robotfirestruct.h @@ -70,7 +70,7 @@ typedef struct otype_wb_info { float anim_end_frame[MAX_WB_FIRING_MASKS]; float anim_time[MAX_WB_FIRING_MASKS]; - ushort flags; + uint16_t flags; float energy_usage, ammo_usage; } otype_wb_info; diff --git a/Descent3/room_external.h b/Descent3/room_external.h index e561231a..b57c1a3d 100644 --- a/Descent3/room_external.h +++ b/Descent3/room_external.h @@ -136,7 +136,7 @@ typedef struct roomUVL { // an n-sided polygon used as part of a room or portal typedef struct face { - ushort flags; // flags for this face (see above) + uint16_t flags; // flags for this face (see above) uint8_t num_verts; // how many vertices in this face int8_t portal_num; // which portal this face is part of, or -1 if none @@ -144,7 +144,7 @@ typedef struct face { roomUVL *face_uvls; // index into list of uvls for this face vector normal; // the surface normal of this face short tmap; // texture numbers for this face - ushort lmi_handle; // the lightmap info number for this face + uint16_t lmi_handle; // the lightmap info number for this face short special_handle; // the index into the special_faces array uint8_t renderframe; // what frame this face was last rendered (for lighting) uint8_t light_multiple; // what multiple to times by @@ -247,7 +247,7 @@ typedef struct room { short vis_effects; // index of first visual effect in this room short mirror_face; // Index of face that this room is to be mirrored by uint8_t num_mirror_faces; // Number of faces in this room that have the same texture as the mirror - ushort *mirror_faces_list; // the list of faces in this room that have the same texture as the mirror + uint16_t *mirror_faces_list; // the list of faces in this room that have the same texture as the mirror float damage; // The damage per second applied to players (& maybe others) in room vector path_pnt; // Point used by the path system diff --git a/Descent3/special_face.cpp b/Descent3/special_face.cpp index c06ec3c6..fffe8e3b 100644 --- a/Descent3/special_face.cpp +++ b/Descent3/special_face.cpp @@ -27,7 +27,7 @@ int Num_of_special_faces = 0; special_face SpecialFaces[MAX_SPECIAL_FACES]; -static ushort Free_special_face_list[MAX_SPECIAL_FACES]; +static uint16_t Free_special_face_list[MAX_SPECIAL_FACES]; // Sets all the special faces to unused void InitSpecialFaces() { diff --git a/Descent3/special_face.h b/Descent3/special_face.h index d68738c2..19762816 100644 --- a/Descent3/special_face.h +++ b/Descent3/special_face.h @@ -31,7 +31,7 @@ typedef struct { vector bright_center; - ushort bright_color; + uint16_t bright_color; } specular_instance; #define SFF_SPEC_OBJECT 1 diff --git a/Descent3/terrain.cpp b/Descent3/terrain.cpp index c15b1373..a7c04dc7 100644 --- a/Descent3/terrain.cpp +++ b/Descent3/terrain.cpp @@ -65,7 +65,7 @@ int TerrainLightmaps[4]; // A list of terrain to render terrain_render_info Terrain_list[MAX_CELLS_TO_RENDER]; -ushort *Terrain_rotate_list; // which points have been sub/rotated this frame +uint16_t *Terrain_rotate_list; // which points have been sub/rotated this frame g3Point *World_point_buffer; // Rotated points // The min/max values for a particular region of terrain @@ -950,7 +950,7 @@ void InitTerrain(void) { // Setup stuff for rendering if (!Dedicated_server) { - Terrain_rotate_list = (ushort *)mem_malloc(TERRAIN_WIDTH * TERRAIN_DEPTH * sizeof(ushort)); + Terrain_rotate_list = (uint16_t *)mem_malloc(TERRAIN_WIDTH * TERRAIN_DEPTH * sizeof(uint16_t)); ASSERT(Terrain_rotate_list); World_point_buffer = (g3Point *)mem_malloc(TERRAIN_WIDTH * TERRAIN_DEPTH * sizeof(g3Point)); @@ -1040,8 +1040,8 @@ void UpdateSingleTerrainLightmap(int which) { int tseg = i * TERRAIN_WIDTH + t; terrain_segment *tp = &Terrain_seg[tseg]; - ushort color = GR_RGB16(tp->r, tp->g, tp->b); - ushort *data = lm_data(TerrainLightmaps[which]); + uint16_t color = GR_RGB16(tp->r, tp->g, tp->b); + uint16_t *data = lm_data(TerrainLightmaps[which]); int x = t % 128; int y = 127 - (i % 128); @@ -1111,8 +1111,8 @@ void UpdateTerrainLightmaps() { int y = 127 - (i % 128); int which = ((i / 128) * 2) + (t / 128); - ushort color = GR_RGB16(tp->r, tp->g, tp->b); - ushort *data = lm_data(TerrainLightmaps[which]); + uint16_t color = GR_RGB16(tp->r, tp->g, tp->b); + uint16_t *data = lm_data(TerrainLightmaps[which]); data[y * w + x] = OPAQUE_FLAG | color; } diff --git a/Descent3/terrain.h b/Descent3/terrain.h index a4447aff..8792474f 100644 --- a/Descent3/terrain.h +++ b/Descent3/terrain.h @@ -166,9 +166,9 @@ typedef struct { typedef struct { float z; - ushort right_edge, left_edge, top_edge, bottom_edge; // for fixing tjoint problems + uint16_t right_edge, left_edge, top_edge, bottom_edge; // for fixing tjoint problems uint8_t right_count, left_count, top_count, bottom_count; - ushort segment; // what segment to render + uint16_t segment; // what segment to render uint8_t lod; // what level of detail: 0=16x16, 1=8x8, 2=4x4, 3=2x2, 4=just this segment (1x1) uint8_t pad; } terrain_render_info; @@ -195,7 +195,7 @@ extern int GlobalTransCount, TotalDepth; extern int TerrainEdgeTest[MAX_TERRAIN_LOD][16]; extern terrain_render_info Terrain_list[]; -extern ushort TS_FrameCount; +extern uint16_t TS_FrameCount; extern float VisibleTerrainZ; extern float Terrain_average_height; @@ -250,7 +250,7 @@ extern uint8_t TerrainSelected[]; extern int Num_terrain_selected; #endif -extern ushort *Terrain_rotate_list; // which points have been sub/rotated this frame +extern uint16_t *Terrain_rotate_list; // which points have been sub/rotated this frame extern g3Point *World_point_buffer; // Rotated points #define TSEARCH_FOUND_TERRAIN 0 diff --git a/Descent3/viseffect.cpp b/Descent3/viseffect.cpp index 5110fec6..328cf9bf 100644 --- a/Descent3/viseffect.cpp +++ b/Descent3/viseffect.cpp @@ -462,15 +462,15 @@ #include // DAJ vis_effect VisEffects[max_vis_effects]; -// DAJ ushort VisDeadList[max_vis_effects]; +// DAJ uint16_t VisDeadList[max_vis_effects]; // DAJ static short Vis_free_list[max_vis_effects]; vis_effect *VisEffects = NULL; static short *Vis_free_list = NULL; -ushort *VisDeadList = NULL; +uint16_t *VisDeadList = NULL; -ushort max_vis_effects = 0; +uint16_t max_vis_effects = 0; int NumVisDead = 0; int Highest_vis_effect_index = 0; @@ -487,7 +487,7 @@ void ShutdownVisEffects() { // Goes through our array and clears the slots out void InitVisEffects() { - static ushort old_max_vis = 0; + static uint16_t old_max_vis = 0; max_vis_effects = MAX_VIS_EFFECTS; // always peg to max on PC if (old_max_vis == max_vis_effects) @@ -495,11 +495,11 @@ void InitVisEffects() { if (VisEffects != NULL) { VisEffects = (vis_effect *)mem_realloc(VisEffects, sizeof(vis_effect) * max_vis_effects); - VisDeadList = (ushort *)mem_realloc(VisDeadList, sizeof(ushort) * max_vis_effects); + VisDeadList = (uint16_t *)mem_realloc(VisDeadList, sizeof(uint16_t) * max_vis_effects); Vis_free_list = (short *)mem_realloc(Vis_free_list, sizeof(short) * max_vis_effects); } else if (VisEffects == NULL) { VisEffects = (vis_effect *)mem_malloc(sizeof(vis_effect) * max_vis_effects); - VisDeadList = (ushort *)mem_malloc(sizeof(ushort) * max_vis_effects); + VisDeadList = (uint16_t *)mem_malloc(sizeof(uint16_t) * max_vis_effects); Vis_free_list = (short *)mem_malloc(sizeof(short) * max_vis_effects); } for (int i = 0; i < max_vis_effects; i++) { @@ -810,7 +810,7 @@ void FreeAllVisEffects() { } // Creates a some sparks that go in random directions -void CreateRandomLineSparks(int num_sparks, vector *pos, int roomnum, ushort color, float force_scalar) { +void CreateRandomLineSparks(int num_sparks, vector *pos, int roomnum, uint16_t color, float force_scalar) { // Make more sparks if Katmai if (Katmai) num_sparks *= 2; diff --git a/Descent3/viseffect.h b/Descent3/viseffect.h index 428d0b1f..115476ea 100644 --- a/Descent3/viseffect.h +++ b/Descent3/viseffect.h @@ -164,7 +164,7 @@ void DrawVisEffect(vis_effect *vis); void CreateRandomSparks(int num_sparks, vector *pos, int roomnum, int which_index = -1, float force_scalar = 1); // Creates a some line sparks that go in random directions -void CreateRandomLineSparks(int num_sparks, vector *pos, int roomnum, ushort color = 0, float force_scalar = 1); +void CreateRandomLineSparks(int num_sparks, vector *pos, int roomnum, uint16_t color = 0, float force_scalar = 1); // Creates vis effects but has the caller set their parameters // initialize a new viseffect. adds to the list for the given room diff --git a/Descent3/viseffect_external.h b/Descent3/viseffect_external.h index 9bc233ef..1d363198 100644 --- a/Descent3/viseffect_external.h +++ b/Descent3/viseffect_external.h @@ -71,7 +71,7 @@ #define VF_NO_Z_ADJUST 128 #define VF_LINK_TO_VIEWER 256 // Always link into the room that the viewer is in -extern ushort max_vis_effects; +extern uint16_t max_vis_effects; struct object; @@ -79,9 +79,9 @@ typedef struct { int obj_handle; int dest_objhandle; - ushort modelnum; - ushort vertnum; - ushort end_vertnum; + uint16_t modelnum; + uint16_t vertnum; + uint16_t end_vertnum; uint8_t subnum, subnum2; } vis_attach_info; @@ -108,9 +108,9 @@ typedef struct { int phys_flags; short custom_handle; - ushort lighting_color; + uint16_t lighting_color; - ushort flags; + uint16_t flags; short next; short prev; diff --git a/Descent3/weapon.cpp b/Descent3/weapon.cpp index bfe62609..c8224c9d 100644 --- a/Descent3/weapon.cpp +++ b/Descent3/weapon.cpp @@ -849,7 +849,7 @@ int AddWeaponToPlayer(int slot, int weap_index, int ammo) { int added = std::min(ship->max_ammo[weap_index] - Players[slot].weapon_ammo[weap_index], ammo); // now add it - Players[slot].weapon_ammo[weap_index] += (ushort)added; + Players[slot].weapon_ammo[weap_index] += (uint16_t)added; } if (slot == Player_num) { @@ -879,24 +879,24 @@ int AddWeaponToPlayer(int slot, int weap_index, int ammo) { // This is NOT a mask of weapons available to the player. This is a mask of what CLASS of // weapon this slot is currently in. The code below checks this mask to see if it should // select the higher class weapon in that slot when switching to that slot. -static ushort Weapon_slot_mask = 0; +static uint16_t Weapon_slot_mask = 0; void SelectPrimaryWeapon(int slot); void SelectSecondaryWeapon(int slot); void SetPrimaryWeapon(int index, int slot); void SetSecondaryWeapon(int index, int slot); -static inline bool is_weapon_available(unsigned player_weapon_flags, int new_weapon, ushort ammo = 0xffff) { +static inline bool is_weapon_available(unsigned player_weapon_flags, int new_weapon, uint16_t ammo = 0xffff) { return ((player_weapon_flags & HAS_FLAG(new_weapon)) && ammo > 0) ? true : false; } // used for sequencing -void ResetWeaponSelectStates(ushort new_state) { Weapon_slot_mask = new_state; } +void ResetWeaponSelectStates(uint16_t new_state) { Weapon_slot_mask = new_state; } void SaveWeaponSelectStates(CFILE *fp) { cf_WriteShort(fp, Weapon_slot_mask); } void LoadWeaponSelectStates(CFILE *fp) { - ushort state = (ushort)cf_ReadShort(fp); + uint16_t state = (uint16_t)cf_ReadShort(fp); ResetWeaponSelectStates(state); } @@ -924,7 +924,7 @@ void SelectPrimaryWeapon(int slot) { // do selection. if we are selecting the same slot of weapon, then we select to the next // level of weapon. when going from highest level, go to lowest if (oldslot == slot) { - ushort nw_low = (plr->weapon[PW_PRIMARY].index + NUM_PRIMARY_SLOTS) % MAX_PRIMARY_WEAPONS; + uint16_t nw_low = (plr->weapon[PW_PRIMARY].index + NUM_PRIMARY_SLOTS) % MAX_PRIMARY_WEAPONS; if (is_weapon_available(avail_flags, nw_low)) { // toggle class of weapon in specified slot (save for selection) @@ -1136,17 +1136,17 @@ void SetSecondaryWeapon(int index, int slot) { /////////////////////////////////////////////////////////////////////////// // Weapon AUTO selection -const ushort SELLIST_START = 0x7ffe, SELLIST_END = 0x7fff; +const uint16_t SELLIST_START = 0x7ffe, SELLIST_END = 0x7fff; -static ushort PrimaryWpnSelectList[] = {SELLIST_START, LASER_INDEX, VAUSS_INDEX, MICROWAVE_INDEX, +static uint16_t PrimaryWpnSelectList[] = {SELLIST_START, LASER_INDEX, VAUSS_INDEX, MICROWAVE_INDEX, PLASMA_INDEX, FUSION_INDEX, SUPER_LASER_INDEX, MASSDRIVER_INDEX, NAPALM_INDEX, EMD_INDEX, OMEGA_INDEX, SELLIST_END}; -static ushort SecondaryWpnSelectList[] = { +static uint16_t SecondaryWpnSelectList[] = { SELLIST_START, CONCUSSION_INDEX, HOMING_INDEX, IMPACTMORTAR_INDEX, SMART_INDEX, MEGA_INDEX, FRAG_INDEX, GUIDED_INDEX + WPNSEL_SKIP, NAPALMROCKET_INDEX, CYCLONE_INDEX, BLACKSHARK_INDEX, SELLIST_END}; -ushort GetAutoSelectPrimaryWpnIdx(int slot) { +uint16_t GetAutoSelectPrimaryWpnIdx(int slot) { int i = -1; while (PrimaryWpnSelectList[i + 1] != SELLIST_END) { @@ -1158,7 +1158,7 @@ ushort GetAutoSelectPrimaryWpnIdx(int slot) { return WPNSEL_INVALID; } -ushort GetAutoSelectSecondaryWpnIdx(int slot) { +uint16_t GetAutoSelectSecondaryWpnIdx(int slot) { int i = -1; while (SecondaryWpnSelectList[i + 1] != SELLIST_END) { @@ -1170,21 +1170,21 @@ ushort GetAutoSelectSecondaryWpnIdx(int slot) { return WPNSEL_INVALID; } -void SetAutoSelectPrimaryWpnIdx(int slot, ushort idx) { +void SetAutoSelectPrimaryWpnIdx(int slot, uint16_t idx) { if (slot < 0 || slot >= MAX_PRIMARY_WEAPONS) Int3(); PrimaryWpnSelectList[slot + 1] = idx; } -void SetAutoSelectSecondaryWpnIdx(int slot, ushort idx) { +void SetAutoSelectSecondaryWpnIdx(int slot, uint16_t idx) { if (slot < 0 || slot >= MAX_SECONDARY_WEAPONS) Int3(); SecondaryWpnSelectList[slot + 1] = idx; } -const ushort IWPNSEL_SKIP = (ushort) ((~WPNSEL_SKIP) & 0xFFFF); +const uint16_t IWPNSEL_SKIP = (uint16_t) ((~WPNSEL_SKIP) & 0xFFFF); #define WPNINDEX(_index) (sel_list[(_index)] & IWPNSEL_SKIP) @@ -1194,7 +1194,7 @@ int SwitchPlayerWeapon(int weapon_type) { ship *ship; int new_index; void (*setwpnfunc)(int, int); // Call either primary or secondary set weapon function - ushort *sel_list; + uint16_t *sel_list; int plr_wpn_index; plr = &Players[Player_num]; @@ -1224,7 +1224,7 @@ int SwitchPlayerWeapon(int weapon_type) { } else if (WPNINDEX(new_index) == SELLIST_START) { new_index++; } else { - ushort wpn_index = WPNINDEX(new_index); + uint16_t wpn_index = WPNINDEX(new_index); otype_wb_info *wb = &ship->static_wb[wpn_index]; int slot = (weapon_type == PW_SECONDARY) ? (((wpn_index - SECONDARY_INDEX) % NUM_SECONDARY_SLOTS) + NUM_PRIMARY_SLOTS) @@ -1266,7 +1266,7 @@ int SwitchPlayerWeapon(int weapon_type) { bool AutoSelectWeapon(int weapon_type, int new_wpn) { player *plr; ship *ship; - ushort *sel_list; // a weapon selection list + uint16_t *sel_list; // a weapon selection list int weapon_index; // the current weapon index int list_index; // index into a selection list int list_initial; // initial index in list. @@ -1302,7 +1302,7 @@ bool AutoSelectWeapon(int weapon_type, int new_wpn) { list_index--; if (!(sel_list[list_index] & WPNSEL_SKIP)) { if (list_initial >= list_index) { - ushort index = WPNINDEX(list_initial); + uint16_t index = WPNINDEX(list_initial); otype_wb_info *wb = &ship->static_wb[index]; if (index >= SECONDARY_INDEX && wb->ammo_usage && (wb->ammo_usage <= plr->weapon_ammo[index])) { LOGFILE((_logfp, "keep current ammo weapon...(ind=%d)\n", list_index)); @@ -1323,7 +1323,7 @@ bool AutoSelectWeapon(int weapon_type, int new_wpn) { } while (1) { - ushort index = sel_list[list_index]; + uint16_t index = sel_list[list_index]; otype_wb_info *wb = &ship->static_wb[index]; if (index == SELLIST_START) { diff --git a/Descent3/weapon.h b/Descent3/weapon.h index 48bd6fc4..7bdeb758 100644 --- a/Descent3/weapon.h +++ b/Descent3/weapon.h @@ -440,7 +440,7 @@ bool IsWeaponSecondary(int index); // used for sequencing // resets memory for what slots have high priority weapons (laser->super_laser, for instance) when user selects -void ResetWeaponSelectStates(ushort new_state = 0); +void ResetWeaponSelectStates(uint16_t new_state = 0); // save and load weapon state information void SaveWeaponSelectStates(CFILE *fp); @@ -478,20 +478,20 @@ void CreateRobotSpawnFromWeapon(object *obj); void CreateCountermeasureFromObject(object *parent, int weapon_id); ////////////////////////////////////////////////////////////////////////////// -const ushort WPNSEL_SKIP = 0x8000, WPNSEL_INVALID = 0xffff; +const uint16_t WPNSEL_SKIP = 0x8000, WPNSEL_INVALID = 0xffff; -const ushort DefaultPrimarySelectList[MAX_PRIMARY_WEAPONS] = { +const uint16_t DefaultPrimarySelectList[MAX_PRIMARY_WEAPONS] = { LASER_INDEX, VAUSS_INDEX, MICROWAVE_INDEX, PLASMA_INDEX, FUSION_INDEX, SUPER_LASER_INDEX, MASSDRIVER_INDEX, NAPALM_INDEX, EMD_INDEX, OMEGA_INDEX}; -const ushort DefaultSecondarySelectList[MAX_SECONDARY_WEAPONS] = { +const uint16_t DefaultSecondarySelectList[MAX_SECONDARY_WEAPONS] = { CONCUSSION_INDEX, HOMING_INDEX, IMPACTMORTAR_INDEX, SMART_INDEX, MEGA_INDEX, FRAG_INDEX, GUIDED_INDEX + WPNSEL_SKIP, NAPALMROCKET_INDEX, CYCLONE_INDEX, BLACKSHARK_INDEX}; // weapon auto selection info. -ushort GetAutoSelectPrimaryWpnIdx(int slot); -ushort GetAutoSelectSecondaryWpnIdx(int slot); -void SetAutoSelectPrimaryWpnIdx(int slot, ushort idx); -void SetAutoSelectSecondaryWpnIdx(int slot, ushort idx); +uint16_t GetAutoSelectPrimaryWpnIdx(int slot); +uint16_t GetAutoSelectSecondaryWpnIdx(int slot); +void SetAutoSelectPrimaryWpnIdx(int slot, uint16_t idx); +void SetAutoSelectSecondaryWpnIdx(int slot, uint16_t idx); #endif diff --git a/bitmap/bitmain.cpp b/bitmap/bitmain.cpp index 8edd1881..276ffc41 100644 --- a/bitmap/bitmain.cpp +++ b/bitmap/bitmain.cpp @@ -484,7 +484,7 @@ int bm_AllocateMemoryForIndex(int n, int w, int h, int add_mem) { // If no go on the malloc, bail out with -1 int size = (w * h * 2) + (add_mem) + 2; - GameBitmaps[n].data16 = (ushort *)mem_malloc(size); + GameBitmaps[n].data16 = (uint16_t *)mem_malloc(size); if (!GameBitmaps[n].data16) { Int3(); // Ran out of memory! return -1; @@ -836,7 +836,7 @@ int bm_AllocLoadFileBitmap(const char *fname, int mipped, int format) { { int w = bm_w(src_bm, 0); int h = bm_h(src_bm, 0); - ushort *src_data, *dest_data; + uint16_t *src_data, *dest_data; if (overlay) { bm_AllocateMemoryForIndex(n, w, h, mipped * (((w * h * 2) / 3))); @@ -846,8 +846,8 @@ int bm_AllocLoadFileBitmap(const char *fname, int mipped, int format) { GameBitmaps[n].format = GameBitmaps[src_bm].format; } ASSERT(n >= 0); - src_data = (ushort *)bm_data(src_bm, 0); - dest_data = (ushort *)bm_data(n, 0); + src_data = (uint16_t *)bm_data(src_bm, 0); + dest_data = (uint16_t *)bm_data(n, 0); memcpy(dest_data, src_data, w * h * 2); bm_FreeBitmap(src_bm); @@ -961,12 +961,12 @@ int bm_AllocLoadBitmap(CFILE *infile, int mipped, int format) { { int w = bm_w(src_bm, 0); int h = bm_h(src_bm, 0); - ushort *src_data, *dest_data; + uint16_t *src_data, *dest_data; n = bm_AllocBitmap(w, h, mipped * (((w * h * 2) / 3))); ASSERT(n >= 0); - src_data = (ushort *)bm_data(src_bm, 0); - dest_data = (ushort *)bm_data(n, 0); + src_data = (uint16_t *)bm_data(src_bm, 0); + dest_data = (uint16_t *)bm_data(n, 0); memcpy(dest_data, src_data, w * h * 2); bm_FreeBitmap(src_bm); @@ -978,7 +978,7 @@ int bm_AllocLoadBitmap(CFILE *infile, int mipped, int format) { // Given a handle, makes a big random shape to let you know you are screwed. void bm_MakeBad(int handle) { int i, t, limit; - ushort *dest; + uint16_t *dest; ASSERT(GameBitmaps[handle].used); if (handle != BAD_BITMAP_HANDLE) Int3(); // hmm, you're assigning a random bitmap to something other than @@ -1039,7 +1039,7 @@ int bm_SaveBitmap(CFILE *fp, int handle) { for (int m = 0; m < num_mips; m++) { int curptr = 0; int total = bm_w(handle, m) * bm_h(handle, m); - ushort *src_data = (ushort *)bm_data(handle, m); + uint16_t *src_data = (uint16_t *)bm_data(handle, m); done = 0; while (!done) { if (curptr == total) { @@ -1047,7 +1047,7 @@ int bm_SaveBitmap(CFILE *fp, int handle) { continue; } ASSERT(curptr < total); - ushort curpix = src_data[curptr]; + uint16_t curpix = src_data[curptr]; uint8_t count = 1; while (src_data[curptr + count] == curpix && count < 250 && (curptr + count) < total) count++; @@ -1180,8 +1180,8 @@ int bm_mipped(int handle) { return 0; } // returns a bitmaps data (based on given miplevel), else NULL if something is wrong -ushort *bm_data(int handle, int miplevel) { - ushort *d; +uint16_t *bm_data(int handle, int miplevel) { + uint16_t *d; int i; if (!GameBitmaps[handle].used) { Int3(); @@ -1212,7 +1212,7 @@ void bm_GenerateMipMaps(int handle) { int levels = bm_miplevels(handle); - ushort *destdata; + uint16_t *destdata; for (int miplevel = 1; miplevel < levels; miplevel++) { width /= 2; height /= 2; @@ -1222,16 +1222,16 @@ void bm_GenerateMipMaps(int handle) { for (int t = 0; t < width; t++) { int adjwidth = (t * jump); // find our x offset - ushort *srcptr = bm_data(handle, miplevel - 1); + uint16_t *srcptr = bm_data(handle, miplevel - 1); srcptr += (adjheight + adjwidth); int rsum, gsum, bsum, asum; rsum = gsum = bsum = asum = 0; - ushort destpix = 0; + uint16_t destpix = 0; if (GameBitmaps[handle].format == BITMAP_FORMAT_1555) { for (int y = 0; y < 2; y++) for (int x = 0; x < 2; x++) { - ushort pix = srcptr[y * bm_w(handle, miplevel - 1) + x]; + uint16_t pix = srcptr[y * bm_w(handle, miplevel - 1) + x]; int r = (pix >> 10) & 0x1f; int g = (pix >> 5) & 0x1f; int b = (pix & 0x1f); @@ -1255,7 +1255,7 @@ void bm_GenerateMipMaps(int handle) { } else if (GameBitmaps[handle].format == BITMAP_FORMAT_4444) { for (int y = 0; y < 2; y++) for (int x = 0; x < 2; x++) { - ushort pix = srcptr[y * bm_w(handle, miplevel - 1) + x]; + uint16_t pix = srcptr[y * bm_w(handle, miplevel - 1) + x]; int a = (pix >> 12) & 0x0f; int r = (pix >> 8) & 0x0f; int g = (pix >> 4) & 0x0f; @@ -1288,8 +1288,8 @@ int bm_bpp(int handle) { return BPP_16; } // Given two bitmaps, scales the data from src to the size of dest // Not a particularly fast implementation void bm_ScaleBitmapToBitmap(int dest, int src) { - ushort *dp = bm_data(dest, 0); - ushort *sp = bm_data(src, 0); + uint16_t *dp = bm_data(dest, 0); + uint16_t *sp = bm_data(src, 0); ASSERT(GameBitmaps[dest].used && dp); ASSERT(GameBitmaps[src].used && sp); int smipped = bm_mipped(src); @@ -1303,19 +1303,19 @@ void bm_ScaleBitmapToBitmap(int dest, int src) { int dw = bm_w(dest, 0); int dh = bm_h(dest, 0); int i, t; - ushort *sdata; - ushort *ddata; + uint16_t *sdata; + uint16_t *ddata; if (sw == dw && sh == dh) { if (smipped) limit = bm_miplevels(src); else limit = 1; for (i = 0; i < limit; i++) { - sdata = (ushort *)bm_data(src, i); - ddata = (ushort *)bm_data(dest, i); + sdata = (uint16_t *)bm_data(src, i); + ddata = (uint16_t *)bm_data(dest, i); dw = bm_w(dest, i); dh = bm_h(dest, i); - memcpy(ddata, sdata, dw * dh * sizeof(ushort)); + memcpy(ddata, sdata, dw * dh * sizeof(uint16_t)); } return; } @@ -1329,8 +1329,8 @@ void bm_ScaleBitmapToBitmap(int dest, int src) { dw = bm_w(dest, m); dh = bm_h(dest, m); - sdata = (ushort *)bm_data(src, m); - ddata = (ushort *)bm_data(dest, m); + sdata = (uint16_t *)bm_data(src, m); + ddata = (uint16_t *)bm_data(dest, m); // These are our interpolant variables float xstep = (float)sw / (float)dw; float ystep = (float)sh / (float)dh; @@ -1356,7 +1356,7 @@ int bm_rowsize(int handle, int miplevel) { bool bm_pixel_transparent(int bm_handle, int x, int y) { if ((bm_data(bm_handle, 0)) == NULL) return 0; // only check 16bit stuff - ushort *data = bm_data(bm_handle, 0); + uint16_t *data = bm_data(bm_handle, 0); data = data + (bm_w(bm_handle, 0) * y) + x; if (GameBitmaps[bm_handle].format == BITMAP_FORMAT_4444) { int pix = *data; @@ -1369,10 +1369,10 @@ bool bm_pixel_transparent(int bm_handle, int x, int y) { return false; } // a function to determine if a pixel in a bitmap is transparent -ushort bm_pixel(int bm_handle, int x, int y) { +uint16_t bm_pixel(int bm_handle, int x, int y) { if ((bm_data(bm_handle, 0)) == NULL) return 0; // only check 16bit stuff - ushort *data = bm_data(bm_handle, 0); + uint16_t *data = bm_data(bm_handle, 0); data = data + (bm_w(bm_handle, 0) * y) + x; return *data; } @@ -1382,7 +1382,7 @@ int bm_SetBitmapIfTransparent(int handle) { return 0; // only check 16bit stuff int w = bm_w(handle, 0); int h = bm_h(handle, 0); - ushort *data = bm_data(handle, 0); + uint16_t *data = bm_data(handle, 0); if (GameBitmaps[handle].format == BITMAP_FORMAT_4444) { for (int i = 0; i < w * h; i++) { int pix = data[i] >> 12; @@ -1406,7 +1406,7 @@ int bm_SetBitmapIfTransparent(int handle) { void bm_ClearBitmap(int handle) { int dx, dy; // DAJ int rowsize_w = bm_rowsize(handle,0) >> 1; - ushort *bmpdata = bm_data(handle, 0); + uint16_t *bmpdata = bm_data(handle, 0); int w = bm_w(handle, 0); int h = bm_h(handle, 0); for (dy = 0; dy < h; dy++) { @@ -1457,9 +1457,9 @@ bool bm_CreateChunkedBitmap(int bm_handle, chunked_bitmap *chunk) { bm_ClearBitmap(bm_array[i]); } // Now go through our big bitmap and partition it into pieces - ushort *src_data = bm_data(bm_handle, 0); - ushort *sdata; - ushort *ddata; + uint16_t *src_data = bm_data(bm_handle, 0); + uint16_t *sdata; + uint16_t *ddata; int shift; switch (iopt) { case 32: diff --git a/bitmap/bumpmap.cpp b/bitmap/bumpmap.cpp index ecef2a65..d4f714f9 100644 --- a/bitmap/bumpmap.cpp +++ b/bitmap/bumpmap.cpp @@ -25,7 +25,7 @@ #include "mem.h" static int Num_of_bumpmaps = 0; -static ushort Free_bumpmap_list[MAX_BUMPMAPS]; +static uint16_t Free_bumpmap_list[MAX_BUMPMAPS]; bms_bumpmap GameBumpmaps[MAX_BUMPMAPS]; static int Bumpmap_mem_used = 0; @@ -70,7 +70,7 @@ int bump_AllocBumpmap(int w, int h) { memset(&GameBumpmaps[n], 0, sizeof(bms_bumpmap)); - GameBumpmaps[n].data = (ushort *)mem_malloc(w * h * 2); + GameBumpmaps[n].data = (uint16_t *)mem_malloc(w * h * 2); if (!GameBumpmaps[n].data) { mprintf((0, "NOT ENOUGHT MEMORY FOR BUMPMAP!\n")); Int3(); @@ -103,8 +103,8 @@ void bump_FreeBumpmap(int handle) { } // returns a bumpmaps data else NULL if something is wrong -ushort *bump_data(int handle) { - ushort *d; +uint16_t *bump_data(int handle) { + uint16_t *d; if (!(GameBumpmaps[handle].flags & BUMPF_USED)) { Int3(); diff --git a/bitmap/iff.cpp b/bitmap/iff.cpp index 412a639b..f7305b4f 100644 --- a/bitmap/iff.cpp +++ b/bitmap/iff.cpp @@ -481,13 +481,13 @@ void bm_iff_convert_8_to_16(int dest_bm, iff_bitmap_header *iffbm) { ASSERT(bm_w(dest_bm, 0) == iffbm->w); ASSERT(bm_h(dest_bm, 0) == iffbm->h); - ushort *data; + uint16_t *data; - data = (ushort *)bm_data(dest_bm, 0); + data = (uint16_t *)bm_data(dest_bm, 0); for (int i = 0; i < iffbm->h; i++) for (int t = 0; t < iffbm->w; t++) { - ushort pixel; + uint16_t pixel; uint8_t c = iffbm->raw_data[i * iffbm->w + t]; int r = iffbm->palette[c].r >> 1; diff --git a/bitmap/lightmap.cpp b/bitmap/lightmap.cpp index b248ae33..cabb9b0c 100644 --- a/bitmap/lightmap.cpp +++ b/bitmap/lightmap.cpp @@ -31,7 +31,7 @@ #include static int Num_of_lightmaps = 0; -static ushort Free_lightmap_list[MAX_LIGHTMAPS]; +static uint16_t Free_lightmap_list[MAX_LIGHTMAPS]; bms_lightmap GameLightmaps[MAX_LIGHTMAPS]; static int Lightmap_mem_used = 0; // Sets all the lightmaps to unused @@ -66,7 +66,7 @@ int lm_AllocLightmap(int w, int h) { // If no go on the malloc, bail out with -1 memset(&GameLightmaps[n], 0, sizeof(bms_lightmap)); - GameLightmaps[n].data = (ushort *)mem_malloc((w * h * 2)); + GameLightmaps[n].data = (uint16_t *)mem_malloc((w * h * 2)); if (!GameLightmaps[n].data) { mprintf((0, "NOT ENOUGHT MEMORY FOR LIGHTMAP!\n")); Int3(); @@ -135,8 +135,8 @@ int lm_h(int handle) { return (h); } // returns a lightmaps data else NULL if something is wrong -ushort *lm_data(int handle) { - ushort *d; +uint16_t *lm_data(int handle) { + uint16_t *d; if (!GameLightmaps[handle].used) { Int3(); return NULL; diff --git a/bitmap/pcx.cpp b/bitmap/pcx.cpp index cc15d485..89734f50 100644 --- a/bitmap/pcx.cpp +++ b/bitmap/pcx.cpp @@ -153,11 +153,11 @@ int bm_pcx_8bit_alloc_file(CFILE *infile) { if (src_bm < 0) return -1; // probably out of memory - ushort *data = bm_data(src_bm, 0); + uint16_t *data = bm_data(src_bm, 0); for (i = 0; i < height; i++) { for (t = 0; t < width; t++) { - ushort pixel; + uint16_t pixel; uint8_t c = rawdata[i * width + t]; int r = pred[c]; @@ -294,12 +294,12 @@ int bm_pcx_24bit_alloc_file(CFILE *infile) { if (src_bm < 0) return -1; // probably out of memory - ushort *data = bm_data(src_bm, 0); + uint16_t *data = bm_data(src_bm, 0); for (i = 0; i < height; i++) { for (t = 0; t < width; t++) { int r, g, b; - ushort pixel; + uint16_t pixel; r = rawdata[(i * total) + (0 * BytesPerLine) + t]; g = rawdata[(i * total) + (1 * BytesPerLine) + t]; diff --git a/bitmap/tga.cpp b/bitmap/tga.cpp index 57068094..bd567d5c 100644 --- a/bitmap/tga.cpp +++ b/bitmap/tga.cpp @@ -154,7 +154,7 @@ static int Fake_file_size = 0; static inline char tga_read_byte(); static inline int tga_read_int(); static inline short tga_read_short(); -static ushort bm_tga_translate_pixel(int pixel, int format); +static uint16_t bm_tga_translate_pixel(int pixel, int format); static int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int type); inline char tga_read_byte() { @@ -195,12 +195,12 @@ inline short tga_read_short() { return INTEL_SHORT(i); } -ushort bm_tga_translate_pixel(int pixel, int format) { +uint16_t bm_tga_translate_pixel(int pixel, int format) { int red = ((pixel >> 16) & 0xFF); int green = ((pixel >> 8) & 0xFF); int blue = ((pixel) & 0xFF); int alpha = ((pixel >> 24) & 0xFF); - ushort newpix; + uint16_t newpix; if (format == BITMAP_FORMAT_4444) { int newred = red >> 4; @@ -223,8 +223,8 @@ ushort bm_tga_translate_pixel(int pixel, int format) { } int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int type) { - ushort *dest_data; - ushort pixel; + uint16_t *dest_data; + uint16_t pixel; int width, height; int m; @@ -236,7 +236,7 @@ int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int typ int total = height * width; int count = 0; - dest_data = (ushort *)bm_data(n, m); + dest_data = (uint16_t *)bm_data(n, m); while (count != total) { ASSERT(count < total); @@ -307,9 +307,9 @@ int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int typ width = bm_w(n, m); height = bm_h(n, m); - ushort w_prev = bm_w(n, m - 1); - ushort *dst = bm_data(n, m); - ushort *src = bm_data(n, m - 1); + uint16_t w_prev = bm_w(n, m - 1); + uint16_t *dst = bm_data(n, m); + uint16_t *src = bm_data(n, m - 1); for (int h_inc = 0; h_inc < height; h_inc++) { for (int w_inc = 0; w_inc < width; w_inc++) { @@ -326,7 +326,7 @@ int bm_tga_read_outrage_compressed16(CFILE *infile, int n, int num_mips, int typ int bm_tga_alloc_file(CFILE *infile, char *name, int format) { uint8_t image_id_len, color_map_type, image_type, pixsize, descriptor; uint8_t upside_down = 0; - ushort width, height; + uint16_t width, height; uint32_t pixel; int i, t, n, data8bit = 0, savepos; int mipped = 0; @@ -434,7 +434,7 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) { pixel = (255 << 24) | (r << 16) | (g << 8) | b; } - ushort newpix = bm_tga_translate_pixel(pixel, format); + uint16_t newpix = bm_tga_translate_pixel(pixel, format); for (int k = 0; k < len; k++, total++) { i = total / width; @@ -457,7 +457,7 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) { r = (uint8_t)cf_ReadByte(infile); pixel = (255 << 24) | (r << 16) | (g << 8) | b; } - ushort newpix = bm_tga_translate_pixel(pixel, format); + uint16_t newpix = bm_tga_translate_pixel(pixel, format); i = total / width; t = total % width; @@ -483,7 +483,7 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) { pixel = (255 << 24) | (r << 16) | (g << 8) | b; } - ushort newpix = bm_tga_translate_pixel(pixel, format); + uint16_t newpix = bm_tga_translate_pixel(pixel, format); if (upside_down) GameBitmaps[n].data16[((height - 1) - i) * width + t] = newpix; @@ -539,7 +539,7 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) { int bm_page_in_file(int n) { uint8_t image_id_len, color_map_type, image_type, pixsize, descriptor; uint8_t upside_down = 0; - ushort width, height; + uint16_t width, height; int i, data8bit = 0, savepos; int mipped = 0, file_mipped = 0; int num_mips = 1; @@ -617,7 +617,7 @@ int bm_page_in_file(int n) { mipped = 1; int size = (width * height * 2) + (mipped * ((width * height * 2) / 3)) + 2; - GameBitmaps[n].data16 = (ushort *)mem_malloc(size); + GameBitmaps[n].data16 = (uint16_t *)mem_malloc(size); if (!GameBitmaps[n].data16) { mprintf((0, "Out of memory in bm_page_in_file!\n")); return 0; diff --git a/czip/CZip.cpp b/czip/CZip.cpp index e3615074..9166d74e 100644 --- a/czip/CZip.cpp +++ b/czip/CZip.cpp @@ -670,12 +670,12 @@ uint8_t CZip::ReadRawByte(void) { } return data; } -ushort CZip::ReadRawShort(void) { +uint16_t CZip::ReadRawShort(void) { if (!m_bRawType) return -1; // need to read 2 bytes - ushort data = 0; + uint16_t data = 0; data = ReadRawByte(); data = (data << 8) | (ReadRawByte()); return data; @@ -714,7 +714,7 @@ void CZip::WriteRawByte(uint8_t value) { } } -void CZip::WriteRawShort(ushort value) { +void CZip::WriteRawShort(uint16_t value) { if (!m_bRawType) return; // write 2 bytes diff --git a/ddio_common/key.cpp b/ddio_common/key.cpp index 42df0bc5..ecd13928 100644 --- a/ddio_common/key.cpp +++ b/ddio_common/key.cpp @@ -148,7 +148,7 @@ volatile uint8_t DDIO_key_state[DDIO_MAX_KEYS]; volatile short DDIO_key_down_count[DDIO_MAX_KEYS]; static struct t_key_queue { - ushort buffer[KEY_QUEUE_SIZE]; // Keyboard buffer queue + uint16_t buffer[KEY_QUEUE_SIZE]; // Keyboard buffer queue int tail; int head; } DDIO_key_queue; @@ -310,7 +310,7 @@ void ddio_AddKeyToQueue(int key) { temp = 0; if (temp != DDIO_key_queue.head) { - DDIO_key_queue.buffer[DDIO_key_queue.tail] = (ushort)keycode; + DDIO_key_queue.buffer[DDIO_key_queue.tail] = (uint16_t)keycode; DDIO_key_queue.tail = temp; // mprintf((1, "%d ", keycode)); } diff --git a/ddio_win/winkey.cpp b/ddio_win/winkey.cpp index 671d7e47..27423e9c 100644 --- a/ddio_win/winkey.cpp +++ b/ddio_win/winkey.cpp @@ -215,7 +215,7 @@ volatile struct tWinKeys { }; bool status; // is it down? bool mutex_flag; // done for mutexing between ddio_Internal and KeyThread - ushort mutex_data; + uint16_t mutex_data; } WKeys[DDIO_MAX_KEYS]; static int DDIO_key_language = KBLANG_AMERICAN; diff --git a/grtext/grfont.cpp b/grtext/grfont.cpp index ad7d243e..a1fcc71b 100644 --- a/grtext/grfont.cpp +++ b/grtext/grfont.cpp @@ -920,8 +920,8 @@ void grfont_XlateMonoChar(int bmp_handle, int x, int y, int index, tFontFileInfo fp = ft->char_data[index]; /* draw one-bit one color. */ - ushort *dest_ptr; - ushort col_w = GR_COLOR_TO_16(GR_RGB(255, 255, 255)); + uint16_t *dest_ptr; + uint16_t col_w = GR_COLOR_TO_16(GR_RGB(255, 255, 255)); int rowsize_w; dest_ptr = bm_data(bmp_handle, 0); @@ -951,12 +951,12 @@ void grfont_XlateColorChar(int bmp_handle, int x, int y, int index, tFontFileInf This function performs scaling if the source width and height don't match that of the destinations - JL */ - ushort *dptr, *sptr; + uint16_t *dptr, *sptr; int row, col; int rowsize_w; dptr = bm_data(bmp_handle, 0); - sptr = (ushort *)ft->char_data[index]; + sptr = (uint16_t *)ft->char_data[index]; rowsize_w = bm_rowsize(bmp_handle, 0) / 2; // height = SET_MIN(h, ddsfObj.h); @@ -974,7 +974,7 @@ void grfont_XlateColorChar(int bmp_handle, int x, int y, int index, tFontFileInf // old style for (row = 0; row < ft->height; row++) { for (col = 0; col < width; col++) { - ushort col565 = *(sptr++); + uint16_t col565 = *(sptr++); if (col565 == 0x07e0) dptr[x + col] = NEW_TRANSPARENT_COLOR; else @@ -991,12 +991,12 @@ void grfont_XlateColorGrayChar(int bmp_handle, int x, int y, int index, tFontFil This function performs scaling if the source width and height don't match that of the destinations - JL */ - ushort *dptr, *sptr; + uint16_t *dptr, *sptr; int row, col; int rowsize_w; dptr = bm_data(bmp_handle, 0); - sptr = (ushort *)ft->char_data[index]; + sptr = (uint16_t *)ft->char_data[index]; rowsize_w = bm_rowsize(bmp_handle, 0) / 2; // height = SET_MIN(h, ddsfObj.h); @@ -1007,7 +1007,7 @@ void grfont_XlateColorGrayChar(int bmp_handle, int x, int y, int index, tFontFil for (row = 0; row < ft->height; row++) { for (col = 0; col < width; col++) { - ushort col565 = *(sptr++); + uint16_t col565 = *(sptr++); if (col565 == 0x07e0) dptr[x + col] = NEW_TRANSPARENT_COLOR; else { @@ -1028,7 +1028,7 @@ void grfont_XlateColorGrayChar(int bmp_handle, int x, int y, int index, tFontFil void grfont_ClearBitmap(int bmp_handle) { int dx, dy; int rowsize_w = bm_rowsize(bmp_handle, 0) / 2; - ushort *bmpdata = bm_data(bmp_handle, 0); + uint16_t *bmpdata = bm_data(bmp_handle, 0); for (dy = 0; dy < bm_h(bmp_handle, 0); dy++) { for (dx = 0; dx < rowsize_w; dx++) @@ -1073,7 +1073,7 @@ int grfont_KeyToAscii(int font, int key) { // returns the raw bitmap data for a character in a font, its width and height // returned data should be in 565 hicolor format if (*mono) is false. if (*mono) is true, // then a bitmask will be returned, and you should treat a bit as a pixel. -ushort *grfont_GetRawCharacterData(int font, int ch, int *w, int *h, bool *mono) { +uint16_t *grfont_GetRawCharacterData(int font, int ch, int *w, int *h, bool *mono) { tFontFileInfo *fntfile; tFontInfo *fnt; @@ -1100,7 +1100,7 @@ ushort *grfont_GetRawCharacterData(int font, int ch, int *w, int *h, bool *mono) *h = fnt->font.height; - return (ushort *)fnt->font.char_data[ch]; + return (uint16_t *)fnt->font.char_data[ch]; } // returns a character's width diff --git a/grtext/grtextlib.h b/grtext/grtextlib.h index 81b83b83..b3a06dc2 100644 --- a/grtext/grtextlib.h +++ b/grtext/grtextlib.h @@ -42,8 +42,8 @@ #include "pstypes.h" typedef struct tCharBlt { - ushort ch; - ushort clipped; // if =1, use sx,sy,sw,sh + uint16_t ch; + uint16_t clipped; // if =1, use sx,sy,sw,sh int x, y; float dsw, dsh; // scale vertical and horiz. int sx, sy; // source rectangle within character in pixels. diff --git a/legacy/FontEditor/FontCreate.cpp b/legacy/FontEditor/FontCreate.cpp index b5f5a73e..c8e4c596 100644 --- a/legacy/FontEditor/FontCreate.cpp +++ b/legacy/FontEditor/FontCreate.cpp @@ -154,11 +154,11 @@ static bool m_FontProp; static uint8_t m_CharWidths[MAX_FONT_CHARS]; static short m_CharHeight; static short m_CharMaxWidth; -static ushort *m_FontBmData; -static ushort *m_DataBuffer, *m_DataPtr; +static uint16_t *m_FontBmData; +static uint16_t *m_DataBuffer, *m_DataPtr; static int m_FontType; static int m_FontBmW, m_FontBmH; -static ushort m_FgColor, m_BgColor, m_BoxColor; +static uint16_t m_FgColor, m_BgColor, m_BoxColor; #define PIX(_x,_y) m_FontBmData[(_x) + (_y) * m_FontBmW] @@ -237,7 +237,7 @@ int read_font_char(int cur_char, int& bmx, int& bmy) for (y=0;y 8 bits/1 byte int i,x,y,w,cnt=0; - ushort *p = m_DataBuffer; + uint16_t *p = m_DataBuffer; uint8_t *bits; bits = (uint8_t *)mem_malloc(256 * MAX_FONT_CHARS); diff --git a/legacy/editor/D3XStringEditor.cpp b/legacy/editor/D3XStringEditor.cpp index 8b5bb3c0..adfe53c7 100644 --- a/legacy/editor/D3XStringEditor.cpp +++ b/legacy/editor/D3XStringEditor.cpp @@ -114,7 +114,7 @@ void CD3XStringEditor::OnLoadscript() } list->ResetContent(); - for (ushort i = 0; i < prog->nstr; i++) + for (uint16_t i = 0; i < prog->nstr; i++) list->AddString(prog->strlist[i]); list->EnableWindow(); diff --git a/legacy/editor/Erooms.cpp b/legacy/editor/Erooms.cpp index fdf89d01..9fa28363 100644 --- a/legacy/editor/Erooms.cpp +++ b/legacy/editor/Erooms.cpp @@ -2644,7 +2644,7 @@ next_face:; // Counts the number of unique textures in a level, plus gives names of textures used void CountUniqueTextures () { - ushort *texture_tracking=(ushort *)mem_malloc (MAX_TEXTURES*2); + uint16_t *texture_tracking=(uint16_t *)mem_malloc (MAX_TEXTURES*2); ASSERT (texture_tracking); memset (texture_tracking,0,MAX_TEXTURES*2); diff --git a/legacy/editor/GrFontDialog.cpp b/legacy/editor/GrFontDialog.cpp index 4cd431a3..b9976f80 100644 --- a/legacy/editor/GrFontDialog.cpp +++ b/legacy/editor/GrFontDialog.cpp @@ -409,14 +409,14 @@ void CGrFontDialog::OnKillfocusEditFontname() #define PIX(_x,_y) m_FontBmData[(_x) + (_y) * m_FontBmW] -inline ushort MAKE_565_FROM_555(ushort jcol) +inline uint16_t MAKE_565_FROM_555(uint16_t jcol) { ddgr_color pix32=GR_16_TO_COLOR (jcol); int red=GR_COLOR_RED(pix32); int green=GR_COLOR_GREEN (pix32); int blue=GR_COLOR_BLUE (pix32); - ushort newpix=((red>>3)<<11)|((green>>2)<<5)|(blue>>3); + uint16_t newpix=((red>>3)<<11)|((green>>2)<<5)|(blue>>3); return newpix; } @@ -436,7 +436,7 @@ BOOL CGrFontDialog::extract_font(gr_font_file_record *ft) m_FgColor = NEW_TRANSPARENT_COLOR; if (m_DataBuffer) delete[] m_DataBuffer; - m_DataBuffer = new ushort[1024*MAX_FONT_CHARS]; + m_DataBuffer = new uint16_t[1024*MAX_FONT_CHARS]; m_DataPtr = m_DataBuffer; // assume upper left pixel is background color, and first-found other @@ -594,7 +594,7 @@ int CGrFontDialog::read_font_char(int cur_char, int& bmx, int& bmy) for (y=0;yflags & FT_COLOR) { - WRITE_FONT_INT(ffile, (int)(m_DataPtr-m_DataBuffer)*sizeof(ushort)); - WRITE_FONT_DATA(ffile, (uint8_t *)m_DataBuffer, (m_DataPtr-m_DataBuffer)*sizeof(ushort), 1); + WRITE_FONT_INT(ffile, (int)(m_DataPtr-m_DataBuffer)*sizeof(uint16_t)); + WRITE_FONT_DATA(ffile, (uint8_t *)m_DataBuffer, (m_DataPtr-m_DataBuffer)*sizeof(uint16_t), 1); } else { // bitpack for mono font storage:: 16bpp -> 8 bits/1 byte int i,x,y,w,cnt=0; - ushort *p = m_DataBuffer; + uint16_t *p = m_DataBuffer; uint8_t *bits; bits = (uint8_t *)mem_malloc(256 * MAX_FONT_CHARS); diff --git a/legacy/editor/GrFontDialog.h b/legacy/editor/GrFontDialog.h index 17dffa1a..0e057ae5 100644 --- a/legacy/editor/GrFontDialog.h +++ b/legacy/editor/GrFontDialog.h @@ -113,10 +113,10 @@ private: int m_CharHeight; // current character height. short m_CharWidths[MAX_FONT_CHARS]; short m_CharMaxWidth; - ushort *m_FontBmData; - ushort *m_DataBuffer, *m_DataPtr; - ushort m_BgColor, m_BoxColor; - ushort m_FgColor; + uint16_t *m_FontBmData; + uint16_t *m_DataBuffer, *m_DataPtr; + uint16_t m_BgColor, m_BoxColor; + uint16_t m_FgColor; BOOL m_FontProp; // Proportional font. uint8_t m_Brightness; // brightness * 10 }; diff --git a/legacy/editor/HFile.cpp b/legacy/editor/HFile.cpp index da2ceee3..5e7a0651 100644 --- a/legacy/editor/HFile.cpp +++ b/legacy/editor/HFile.cpp @@ -786,7 +786,7 @@ void ShowLevelStats() { if (lightmaps_used[i]) { - ushort *data=lm_data (i); + uint16_t *data=lm_data (i); int w=lm_w(i); int h=lm_h(i); diff --git a/legacy/editor/MainFrm.cpp b/legacy/editor/MainFrm.cpp index cfea6e29..9aea098b 100644 --- a/legacy/editor/MainFrm.cpp +++ b/legacy/editor/MainFrm.cpp @@ -2602,7 +2602,7 @@ extern float Room_multiplier[]; int IsNonRenderableSubmodel(poly_model *pm,int submodelnum); -extern ushort *Free_lmi_list; +extern uint16_t *Free_lmi_list; void CMainFrame::OnTestTest1() { diff --git a/legacy/editor/MegacellDialog.cpp b/legacy/editor/MegacellDialog.cpp index a3430cee..483063d8 100644 --- a/legacy/editor/MegacellDialog.cpp +++ b/legacy/editor/MegacellDialog.cpp @@ -413,7 +413,7 @@ void CMegacellDialog::OnDeleteMegacell() int num_to_delete=0; char *texnames[MAX_MEGACELL_WIDTH*MAX_MEGACELL_HEIGHT]; - ushort texindices[MAX_MEGACELL_WIDTH*MAX_MEGACELL_HEIGHT]; + uint16_t texindices[MAX_MEGACELL_WIDTH*MAX_MEGACELL_HEIGHT]; for (i=0;i=0); - ushort *dest_data=bm_data (bm_handle,0); - ushort *src_data=bm_data(src_handle,0); + uint16_t *dest_data=bm_data (bm_handle,0); + uint16_t *src_data=bm_data(src_handle,0); for (int ty=0;ty<32;ty++,u=startx,v+=dv) { @@ -1309,7 +1309,7 @@ void CMegacellDialog::OnImportTiny() int cu=u; int cv=v; - ushort pix=src_data[cv*w+cu]; + uint16_t pix=src_data[cv*w+cu]; dest_data[ty*32+tx]=pix; } } @@ -1441,8 +1441,8 @@ void CMegacellDialog::OnImportSky() ASSERT (bm_handle>=0); - ushort *dest_data=bm_data (bm_handle,0); - ushort *src_data=bm_data(src_handle,0); + uint16_t *dest_data=bm_data (bm_handle,0); + uint16_t *src_data=bm_data(src_handle,0); for (int ty=0;ty=0); - ushort *dest_data=bm_data (bm_handle,0); - ushort *src_data=bm_data(src_handle,0); + uint16_t *dest_data=bm_data (bm_handle,0); + uint16_t *src_data=bm_data(src_handle,0); for (int ty=0;tyattach_to_window((unsigned)m_hWnd); - ushort *data=bm_data(m_palette_bitmap,0); + uint16_t *data=bm_data(m_palette_bitmap,0); for (i=0;i MAX_VERTS_PER_ROOM) @@ -586,8 +586,8 @@ void Parse3DSMaxChunk (CFILE *fp, int size) case ID_FACELIST: { - ushort num_faces=cf_ReadShort(fp); - ushort a,b,c,flags; + uint16_t num_faces=cf_ReadShort(fp); + uint16_t a,b,c,flags; int i,t, j, this_size; if (num_faces > MAX_READING_ROOM_FACES) diff --git a/legacy/editor/ScriptSelect.cpp b/legacy/editor/ScriptSelect.cpp index 0ce4ccf6..eab1e878 100644 --- a/legacy/editor/ScriptSelect.cpp +++ b/legacy/editor/ScriptSelect.cpp @@ -42,7 +42,7 @@ static char THIS_FILE[] = __FILE__; // CScriptSelect dialog -CScriptSelect::CScriptSelect(ushort scr_type, int custom_type, CWnd* pParent /*=NULL*/) +CScriptSelect::CScriptSelect(uint16_t scr_type, int custom_type, CWnd* pParent /*=NULL*/) : CDialog(CScriptSelect::IDD, pParent) { //{{AFX_DATA_INIT(CScriptSelect) @@ -51,7 +51,7 @@ CScriptSelect::CScriptSelect(ushort scr_type, int custom_type, CWnd* pParent /*= m_ScriptCode = NULL; m_CurScriptSel = -1; - m_ScriptType = (ushort)scr_type; + m_ScriptType = (uint16_t)scr_type; m_NumParms = 0; m_CustomType = custom_type; } diff --git a/legacy/editor/ScriptSelect.h b/legacy/editor/ScriptSelect.h index d3be9b8c..cf9c5eff 100644 --- a/legacy/editor/ScriptSelect.h +++ b/legacy/editor/ScriptSelect.h @@ -39,7 +39,7 @@ class CScriptSelect : public CDialog { // Construction public: - CScriptSelect(ushort scr_type = 0xffff, int custom = CUSTOM_SCRIPT_MASK, CWnd* pParent=NULL); // standard constructor + CScriptSelect(uint16_t scr_type = 0xffff, int custom = CUSTOM_SCRIPT_MASK, CWnd* pParent=NULL); // standard constructor int m_CurScriptSel; @@ -85,7 +85,7 @@ private: private: tD3XProgram *m_ScriptCode; - ushort m_ScriptType; + uint16_t m_ScriptType; }; diff --git a/legacy/editor/TerrainDialog.cpp b/legacy/editor/TerrainDialog.cpp index 0d4ab572..ec8457fa 100644 --- a/legacy/editor/TerrainDialog.cpp +++ b/legacy/editor/TerrainDialog.cpp @@ -1955,7 +1955,7 @@ static uint8_t *Terrain_heights,*Terrain_fill; void FillTerrainHeights (int cell) { terrain_segment *tseg=&Terrain_seg[cell]; - ushort fill_stack[65536]; + uint16_t fill_stack[65536]; int stack_count=0; ASSERT (cell>=0 && celllock(); - ushort *dest=(ushort *)cur_surf->data(); + uint16_t *dest=(uint16_t *)cur_surf->data(); int rowsize=cur_surf->rowsize()/2; int height=cur_surf->height(); diff --git a/legacy/editor/WireframeGrWnd.cpp b/legacy/editor/WireframeGrWnd.cpp index 7db428e8..5d6727b8 100644 --- a/legacy/editor/WireframeGrWnd.cpp +++ b/legacy/editor/WireframeGrWnd.cpp @@ -622,7 +622,7 @@ void EndWireframeSel(editorSelectorManager *esm) void CWireframeGrWnd::DrawPlayerOnTerrain() { static int lastx=-1,lastz=-1; - static ushort last_color; + static uint16_t last_color; int seg=GetTerrainCellFromPos (&Viewer_object->pos); if (seg<0) @@ -694,14 +694,14 @@ void CWireframeGrWnd::SetMagCoords(int x1,int y1,int x2,int y2) void CWireframeGrWnd::DrawTerrainCell(int seg) { grSurface *cur_surf; - ushort *destptr; + uint16_t *destptr; int lightval; int i,t,x,y; int segx=seg%TERRAIN_WIDTH; int segz=seg/TERRAIN_WIDTH; cur_surf=m_grViewport->lock(); - destptr=(ushort*)cur_surf->data(); + destptr=(uint16_t*)cur_surf->data(); int rowsize=cur_surf->rowsize()/2; int x1,y1,x2,y2; @@ -723,12 +723,12 @@ void CWireframeGrWnd::DrawTerrainCell(int seg) x=segx; y=segz; // flip due to origin difference - ushort fadepixel; + uint16_t fadepixel; int bm_handle=GameTextures[Terrain_tex_seg[Terrain_seg[(y*TERRAIN_WIDTH+x)].texseg_index].tex_index].bm_handle; lightval=Ubyte_to_float[Terrain_seg[y*TERRAIN_WIDTH+x].l]*(MAX_TEXTURE_SHADES-1); - ushort pix; + uint16_t pix; pix=*bm_data(bm_handle,0); fadepixel=(TexShadeTable16[lightval][pix>>8])+TexShadeTable8[lightval][pix & 0xFF]; @@ -765,12 +765,12 @@ void CWireframeGrWnd::DrawTerrainCell(int seg) void CWireframeGrWnd::DrawTerrainWorld(grViewport *vp,vector *view_target,matrix *view_orient,float view_dist) { grSurface *cur_surf; - ushort *destptr; + uint16_t *destptr; int lightval; int i,t; cur_surf=vp->lock(); - destptr=(ushort*)cur_surf->data(); + destptr=(uint16_t*)cur_surf->data(); int rowsize=cur_surf->rowsize()/2; int x1,y1,x2,y2; @@ -790,7 +790,7 @@ void CWireframeGrWnd::DrawTerrainWorld(grViewport *vp,vector *view_target,matrix y=(TERRAIN_DEPTH-1)-y; // flip due to origin difference - ushort fadepixel; + uint16_t fadepixel; int bm_handle=GameTextures[Terrain_seg[y*TERRAIN_WIDTH+x].tex_index].bm_handle; lightval=(Terrain_seg[y*TERRAIN_WIDTH+x].light)*(MAX_TEXTURE_SHADES-1); @@ -803,7 +803,7 @@ void CWireframeGrWnd::DrawTerrainWorld(grViewport *vp,vector *view_target,matrix } else { - ushort pix; + uint16_t pix; pix=*bm_data(bm_handle,0); fadepixel=(TexShadeTable16[lightval][pix>>8])+TexShadeTable8[lightval][pix & 0xFF]; @@ -840,12 +840,12 @@ void CWireframeGrWnd::DrawTerrainWorld(grViewport *vp,vector *view_target,matrix void CWireframeGrWnd::DrawTerrainWorld(grViewport *vp,vector *view_target,matrix *view_orient,float view_dist) { grSurface *cur_surf; - ushort *destptr; + uint16_t *destptr; float lightval; int i,t; cur_surf=vp->lock(); - destptr=(ushort*)cur_surf->data(); + destptr=(uint16_t*)cur_surf->data(); int rowsize=cur_surf->rowsize()/2; int x1,y1,x2,y2; @@ -867,13 +867,13 @@ void CWireframeGrWnd::DrawTerrainWorld(grViewport *vp,vector *view_target,matrix y=(TERRAIN_DEPTH-1)-y; // flip due to origin difference - ushort fadepixel; + uint16_t fadepixel; int bm_handle=GameTextures[Terrain_tex_seg[Terrain_seg[y*TERRAIN_WIDTH+x].texseg_index].tex_index].bm_handle; lightval=Ubyte_to_float[(Terrain_seg[y*TERRAIN_WIDTH+x].l)]; - ushort pix; - ushort *data=bm_data(bm_handle,0); + uint16_t pix; + uint16_t *data=bm_data(bm_handle,0); int w=bm_w(bm_handle,0); subx=(u & 0xFFFF)*w; diff --git a/legacy/editor/WorldTexturesDialog.cpp b/legacy/editor/WorldTexturesDialog.cpp index 3cf4eefa..81592ceb 100644 --- a/legacy/editor/WorldTexturesDialog.cpp +++ b/legacy/editor/WorldTexturesDialog.cpp @@ -850,7 +850,7 @@ void CWorldTexturesDialog::UpdateTextureViews(int frame) CWnd *texwnd; RECT rect; int x, y, bm_handle; - ushort *src_data,*dest_data; + uint16_t *src_data,*dest_data; int bump_handle; if (m_bumpmap==0) @@ -867,8 +867,8 @@ void CWorldTexturesDialog::UpdateTextureViews(int frame) bm_handle=bm_AllocBitmap (BUMP_WIDTH,BUMP_HEIGHT,0); ASSERT (bm_handle>=0); - src_data=(ushort *)bump_data(bump_handle); - dest_data=(ushort *)bm_data(bm_handle,0); + src_data=(uint16_t *)bump_data(bump_handle); + dest_data=(uint16_t *)bm_data(bm_handle,0); memcpy (dest_data,src_data,BUMP_WIDTH*BUMP_HEIGHT*2); @@ -2455,9 +2455,9 @@ void CWorldTexturesDialog::OnImportBump() ASSERT (src_bump>=0); // Do the memcopy from the bitmap to the bumpmap - ushort *src_data,*dest_data; - src_data=(ushort *)bm_data(bm_handle,0); - dest_data=(ushort *)bump_data(src_bump); + uint16_t *src_data,*dest_data; + src_data=(uint16_t *)bm_data(bm_handle,0); + dest_data=(uint16_t *)bump_data(src_bump); memcpy (dest_data,src_data,BUMP_WIDTH*BUMP_HEIGHT*2); diff --git a/legacy/editor/drawworld.cpp b/legacy/editor/drawworld.cpp index e4aec532..2e931334 100644 --- a/legacy/editor/drawworld.cpp +++ b/legacy/editor/drawworld.cpp @@ -313,7 +313,7 @@ typedef struct seg_edge { struct {short v0,v1;}; int32_t vv; }; - ushort type; + uint16_t type; } seg_edge; #define MAX_EDGES (MAX_VERTS_PER_ROOM*2) diff --git a/legacy/editor/editor_lighting.cpp b/legacy/editor/editor_lighting.cpp index 4d432ebb..d24a277d 100644 --- a/legacy/editor/editor_lighting.cpp +++ b/legacy/editor/editor_lighting.cpp @@ -122,7 +122,7 @@ int FindEmptyMaskSpot (int w,int h,int *dest_x,int *dest_y) return 0; } -void CopySqueezeBodyAndEdges (ushort *dest_data,ushort *src_data,int w,int h,int dest_x,int dest_y) +void CopySqueezeBodyAndEdges (uint16_t *dest_data,uint16_t *src_data,int w,int h,int dest_x,int dest_y) { int i,t; @@ -181,11 +181,11 @@ void CopySqueezeBodyAndEdges (ushort *dest_data,ushort *src_data,int w,int h,int Lightmap_mask[((dest_y+h+1)*128)+(dest_x+w+1)]=1; } -void CopySqueezeDataForRooms (int roomnum,int facenum,ushort *dest_data,int dest_x,int dest_y) +void CopySqueezeDataForRooms (int roomnum,int facenum,uint16_t *dest_data,int dest_x,int dest_y) { room *rp=&Rooms[roomnum]; lightmap_info *lmi_ptr=&LightmapInfo[rp->faces[facenum].lmi_handle]; - ushort *src_data=(ushort *)lm_data(lmi_ptr->lm_handle); + uint16_t *src_data=(uint16_t *)lm_data(lmi_ptr->lm_handle); int w=lmi_ptr->width; int h=lmi_ptr->height; @@ -249,11 +249,11 @@ void CopySqueezeDataForRooms (int roomnum,int facenum,ushort *dest_data,int dest } -void CopySqueezeDataForObject (object *obj,int subnum,int facenum,ushort *dest_data,int dest_x,int dest_y) +void CopySqueezeDataForObject (object *obj,int subnum,int facenum,uint16_t *dest_data,int dest_x,int dest_y) { lightmap_object_face *fp=&obj->lm_object.lightmap_faces[subnum][facenum]; lightmap_info *lmi_ptr=&LightmapInfo[fp->lmi_handle]; - ushort *src_data=(ushort *)lm_data(lmi_ptr->lm_handle); + uint16_t *src_data=(uint16_t *)lm_data(lmi_ptr->lm_handle); int t,k; int w=lmi_ptr->width; @@ -516,7 +516,7 @@ void SqueezeLightmaps (int external,int target_roomnum) { memset (Lightmap_mask,0,128*128); Squeeze_lightmap_handle=lm_AllocLightmap(128,128); - ushort *fill_data=(ushort *)lm_data(Squeeze_lightmap_handle); + uint16_t *fill_data=(uint16_t *)lm_data(Squeeze_lightmap_handle); memset (fill_data,0,128*128*2); } @@ -558,7 +558,7 @@ void SqueezeLightmaps (int external,int target_roomnum) memset (Lightmap_mask,0,128*128); Squeeze_lightmap_handle=lm_AllocLightmap(128,128); - ushort *fill_data=(ushort *)lm_data(Squeeze_lightmap_handle); + uint16_t *fill_data=(uint16_t *)lm_data(Squeeze_lightmap_handle); memset (fill_data,0,128*128*2); ASSERT (Lmi_spoken_for[lmi_handle]==0); @@ -607,7 +607,7 @@ void SqueezeLightmaps (int external,int target_roomnum) { memset (Lightmap_mask,0,128*128); Squeeze_lightmap_handle=lm_AllocLightmap(128,128); - ushort *fill_data=(ushort *)lm_data(Squeeze_lightmap_handle); + uint16_t *fill_data=(uint16_t *)lm_data(Squeeze_lightmap_handle); memset (fill_data,0,128*128*2); } @@ -661,7 +661,7 @@ void SqueezeLightmaps (int external,int target_roomnum) memset (Lightmap_mask,0,128*128); Squeeze_lightmap_handle=lm_AllocLightmap(128,128); - ushort *fill_data=(ushort *)lm_data(Squeeze_lightmap_handle); + uint16_t *fill_data=(uint16_t *)lm_data(Squeeze_lightmap_handle); memset (fill_data,0,128*128*2); ASSERT (Lmi_spoken_for[lmi_handle]==0); @@ -727,7 +727,7 @@ void SqueezeLightmaps (int external,int target_roomnum) { memset (Lightmap_mask,0,128*128); Squeeze_lightmap_handle=lm_AllocLightmap(128,128); - ushort *fill_data=(ushort *)lm_data(Squeeze_lightmap_handle); + uint16_t *fill_data=(uint16_t *)lm_data(Squeeze_lightmap_handle); memset (fill_data,0,128*128*2); } @@ -781,7 +781,7 @@ void SqueezeLightmaps (int external,int target_roomnum) memset (Lightmap_mask,0,128*128); Squeeze_lightmap_handle=lm_AllocLightmap(128,128); - ushort *fill_data=(ushort *)lm_data(Squeeze_lightmap_handle); + uint16_t *fill_data=(uint16_t *)lm_data(Squeeze_lightmap_handle); memset (fill_data,0,128*128*2); ASSERT (Lmi_spoken_for[lmi_handle]==0); @@ -1490,7 +1490,7 @@ void AssignRoomSurfaceToLightmap (int roomnum,int facenum,rad_surface *sp) ASSERT (lw>=2); ASSERT (lh>=2); - ushort *dest_data=lm_data (LightmapInfo[lmi_handle].lm_handle); + uint16_t *dest_data=lm_data (LightmapInfo[lmi_handle].lm_handle); // Set face pointer if (GameTextures[fp->tmap].flags & TF_ALPHA) @@ -1544,7 +1544,7 @@ void AssignRoomSurfaceToLightmap (int roomnum,int facenum,rad_surface *sp) blue=min(blue,255); - ushort texel=OPAQUE_FLAG|GR_RGB16(red,green,blue); + uint16_t texel=OPAQUE_FLAG|GR_RGB16(red,green,blue); dest_data[(i+y1)*lw+(t+x1)]=texel; } @@ -3385,7 +3385,7 @@ void CreateNormalMapForFace (room *rp,face *fp) int vlt,vlb,vrt,vrb,max_y_vertex,top_y,bottom_y,height; int no_height=0,no_width=0,no_right=0,no_left=0; lightmap_info *lmi_ptr=&LightmapInfo[fp->lmi_handle]; - ushort *src_data=lm_data(lmi_ptr->lm_handle); + uint16_t *src_data=lm_data(lmi_ptr->lm_handle); matrix facematrix; vector fvec=-lmi_ptr->normal; diff --git a/legacy/editor/editor_object_lighting.cpp b/legacy/editor/editor_object_lighting.cpp index 4d43201c..cba0b675 100644 --- a/legacy/editor/editor_object_lighting.cpp +++ b/legacy/editor/editor_object_lighting.cpp @@ -111,7 +111,7 @@ void ApplyLightmapToObjectSurface (object *obj,int subnum,int facenum,rad_surfac ASSERT (lw>=2); ASSERT (lh>=2); - ushort *dest_data=lm_data (LightmapInfo[lmi_handle].lm_handle); + uint16_t *dest_data=lm_data (LightmapInfo[lmi_handle].lm_handle); for (i=0;iBAD_BITMAP_HANDLE){ - ushort *data = DLLbm_data(PBallHazehandle,0); + uint16_t *data = DLLbm_data(PBallHazehandle,0); for(int i=0;i<32*32;i++){ data[i] = GR_RGB16(80,200,255)|OPAQUE_FLAG; } @@ -1184,7 +1184,7 @@ void DMFCApp::OnServerWeaponCollide(object *pobj,object *wobj,vector *point,vect void SendCollideInfo(object *pobj,object *wobj,int towho,vector *point,vector *normal) { - int maxsize = (sizeof(float)*26) + (sizeof(ushort)*1); + int maxsize = (sizeof(float)*26) + (sizeof(uint16_t)*1); int size = 0; uint8_t *data = PBall.StartPacket(maxsize,SPID_COLLIDE); @@ -1200,8 +1200,8 @@ void SendCollideInfo(object *pobj,object *wobj,int towho,vector *point,vector *n memcpy(&data[size],&wobj->orient.uvec,sizeof(float)*3); size+=(sizeof(float)*3); memcpy(&data[size],point,sizeof(float)*3); size+=(sizeof(float)*3); memcpy(&data[size],normal,sizeof(float)*3); size+=(sizeof(float)*3); - ushort id = (pobj-PBall.Objects); - memcpy(&data[size],&id,sizeof(ushort)); size+= sizeof(ushort); + uint16_t id = (pobj-PBall.Objects); + memcpy(&data[size],&id,sizeof(uint16_t)); size+= sizeof(uint16_t); //we're done PBall.SendPacket(maxsize,towho); @@ -1213,7 +1213,7 @@ void GetCollideInfo(uint8_t *data) vector rotvel,velocity,pos,point,normal; matrix orient; float mass,fsize; - ushort id; + uint16_t id; int objnum; memcpy(&rotvel,&data[size],3*sizeof(float)); size+=(sizeof(float)*3); @@ -1227,7 +1227,7 @@ void GetCollideInfo(uint8_t *data) memcpy(&point,&data[size],sizeof(float)*3); size+=(sizeof(float)*3); memcpy(&normal,&data[size],sizeof(float)*3); size+=(sizeof(float)*3); - memcpy(&id,&data[size],sizeof(ushort)); size+= sizeof(ushort); + memcpy(&id,&data[size],sizeof(uint16_t)); size+= sizeof(uint16_t); objnum = PBall.ConvertServerToLocalObjnum(id); ASSERT(objnum!=-1); diff --git a/legacy/renderer/Direct3D.cpp b/legacy/renderer/Direct3D.cpp index 32316cdf..76401095 100644 --- a/legacy/renderer/Direct3D.cpp +++ b/legacy/renderer/Direct3D.cpp @@ -551,7 +551,7 @@ void d3d_UploadBitmapToSurface(int handle, int map_type, int slot, int new_uploa HRESULT ddrval; int w, h; - ushort *src_data; + uint16_t *src_data; // mprintf ((0,"Uploading bitmap %d type %d\n",handle,map_type)); // mprintf ((0,"Slot=%d handle=%d\n",slot,handle)); @@ -606,7 +606,7 @@ void d3d_UploadBitmapToSurface(int handle, int map_type, int slot, int new_uploa return; } - ushort *dest_data = (ushort *)surf_desc.lpSurface; + uint16_t *dest_data = (uint16_t *)surf_desc.lpSurface; memcpy(dest_data, src_data, w * h * 2); @@ -635,7 +635,7 @@ void d3d_UploadBitmapToSurface(int handle, int map_type, int slot, int new_uploa return; } - ushort *left_data = (ushort *)surf_desc.lpSurface; + uint16_t *left_data = (uint16_t *)surf_desc.lpSurface; int bm_left = 0; int size = GameLightmaps[handle].square_res; @@ -647,7 +647,7 @@ void d3d_UploadBitmapToSurface(int handle, int map_type, int slot, int new_uploa bm_left += (w * y1); for (int i = 0; i < ph; i++, left_data += size, bm_left += w) { - ushort *dest_data = left_data; + uint16_t *dest_data = left_data; for (int t = 0; t < w; t++) { *dest_data++ = src_data[bm_left + t]; } @@ -660,7 +660,7 @@ void d3d_UploadBitmapToSurface(int handle, int map_type, int slot, int new_uploa else { for (int i = 0; i < h; i++, left_data += size, bm_left += w) { - ushort *dest_data = left_data; + uint16_t *dest_data = left_data; for (int t = 0; t < w; t++) { *dest_data++ = src_data[bm_left + t]; } @@ -688,7 +688,7 @@ void d3d_UploadBitmapToSurface(int handle, int map_type, int slot, int new_uploa src_data = bm_data(handle, i); w = bm_w(handle, i); h = bm_h(handle, i); - ushort *dest_data = (ushort *)surf_desc.lpSurface; + uint16_t *dest_data = (uint16_t *)surf_desc.lpSurface; // Copy the raw data into the directx surface int pitch_diff = (surf_desc.lPitch / 2) - w; @@ -725,7 +725,7 @@ void d3d_UploadBitmapToSurface(int handle, int map_type, int slot, int new_uploa return; } - ushort *dest_data = (ushort *)surf_desc.lpSurface; + uint16_t *dest_data = (uint16_t *)surf_desc.lpSurface; memcpy(dest_data, src_data, w * h * 2); @@ -3091,7 +3091,7 @@ void d3d_GetLFBLock(renderer_lfb *lfb) { ddrval = lpBackBuffer->Lock(NULL, &surf_desc, DDLOCK_WAIT, NULL); if (ddrval == DD_OK) { - lfb->data = (ushort *)surf_desc.lpSurface; + lfb->data = (uint16_t *)surf_desc.lpSurface; lfb->bytes_per_row = surf_desc.lPitch; d3d_lfb_locked = 1; } else { @@ -3113,7 +3113,7 @@ void d3d_ReleaseLFBLock(renderer_lfb *lfb) { } uint8_t d3d_Framebuffer_ready = 0; -ushort *d3d_Framebuffer_translate = NULL; +uint16_t *d3d_Framebuffer_translate = NULL; // Gets a renderer ready for a framebuffer copy, or stops a framebuffer copy void d3d_SetFrameBufferCopyState(bool state) { @@ -3123,7 +3123,7 @@ void d3d_SetFrameBufferCopyState(bool state) { ASSERT(d3d_Framebuffer_ready == 0); ASSERT(D3D_preferred_state.bit_depth == 16); d3d_Framebuffer_ready = 1; - d3d_Framebuffer_translate = (ushort *)mem_malloc(32768 * 2); + d3d_Framebuffer_translate = (uint16_t *)mem_malloc(32768 * 2); ASSERT(d3d_Framebuffer_translate); @@ -3176,8 +3176,8 @@ void d3d_CopyBitmapToFramebuffer(int bm_handle, int x, int y) { int w = bm_w(bm_handle, 0); int h = bm_h(bm_handle, 0); - ushort *dptr = lfb.data; - ushort *sptr = (ushort *)bm_data(bm_handle, 0); + uint16_t *dptr = lfb.data; + uint16_t *sptr = (uint16_t *)bm_data(bm_handle, 0); dptr += (y * (lfb.bytes_per_row / 2)); dptr += x; @@ -3195,7 +3195,7 @@ void d3d_CopyBitmapToFramebuffer(int bm_handle, int x, int y) { // Takes a screenshot of the frontbuffer and puts it into the passed bitmap handle void d3d_Screenshot(int bm_handle) { - ushort *dest_data; + uint16_t *dest_data; int i, t; DDSURFACEDESC2 surf_desc; HRESULT ddrval; @@ -3228,10 +3228,10 @@ void d3d_Screenshot(int bm_handle) { int shorts_per_row = surf_desc.lPitch / 2; bool bit15 = (ddpf.dwGBitMask == 0x03e0) ? true : false; - ushort pix; + uint16_t pix; - ushort *rptr; - rptr = (ushort *)surf_desc.lpSurface; + uint16_t *rptr; + rptr = (uint16_t *)surf_desc.lpSurface; // Go through and read our pixels diff --git a/legacy/renderer/opengl.cpp b/legacy/renderer/opengl.cpp index 534f4b52..d3bcbff4 100644 --- a/legacy/renderer/opengl.cpp +++ b/legacy/renderer/opengl.cpp @@ -147,8 +147,8 @@ static float OpenGL_Alpha_factor = 1.0f; static uint8_t Fast_test_render = 0; #endif -ushort *OpenGL_bitmap_remap; -ushort *OpenGL_lightmap_remap; +uint16_t *OpenGL_bitmap_remap; +uint16_t *OpenGL_lightmap_remap; uint8_t *OpenGL_bitmap_states; uint8_t *OpenGL_lightmap_states; @@ -156,9 +156,9 @@ uint32_t *opengl_Upload_data = NULL; uint32_t *opengl_Translate_table = NULL; uint32_t *opengl_4444_translate_table = NULL; -ushort *opengl_packed_Upload_data = NULL; -ushort *opengl_packed_Translate_table = NULL; -ushort *opengl_packed_4444_translate_table = NULL; +uint16_t *opengl_packed_Upload_data = NULL; +uint16_t *opengl_packed_Translate_table = NULL; +uint16_t *opengl_packed_4444_translate_table = NULL; rendering_state OpenGL_state; static float Alpha_multiplier = 1.0; @@ -280,9 +280,9 @@ int opengl_MakeTextureObject(int tn) { } int opengl_InitCache() { - OpenGL_bitmap_remap = (ushort *)mem_malloc(MAX_BITMAPS * 2); + OpenGL_bitmap_remap = (uint16_t *)mem_malloc(MAX_BITMAPS * 2); ASSERT(OpenGL_bitmap_remap); - OpenGL_lightmap_remap = (ushort *)mem_malloc(MAX_LIGHTMAPS * 2); + OpenGL_lightmap_remap = (uint16_t *)mem_malloc(MAX_LIGHTMAPS * 2); ASSERT(OpenGL_lightmap_remap); OpenGL_bitmap_states = (uint8_t *)mem_malloc(MAX_BITMAPS); @@ -833,9 +833,9 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { OpenGL_multitexture = false; if (OpenGL_packed_pixels) { - opengl_packed_Upload_data = (ushort *)mem_malloc(256 * 256 * 2); - opengl_packed_Translate_table = (ushort *)mem_malloc(65536 * 2); - opengl_packed_4444_translate_table = (ushort *)mem_malloc(65536 * 2); + opengl_packed_Upload_data = (uint16_t *)mem_malloc(256 * 256 * 2); + opengl_packed_Translate_table = (uint16_t *)mem_malloc(65536 * 2); + opengl_packed_4444_translate_table = (uint16_t *)mem_malloc(65536 * 2); ASSERT(opengl_packed_Upload_data); ASSERT(opengl_packed_Translate_table); @@ -860,7 +860,7 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { b = 0x1F; #endif - ushort pix; + uint16_t pix; if (!(i & OPAQUE_FLAG)) { pix = 0; @@ -1050,7 +1050,7 @@ void opengl_Close() { // Takes our 16bit format and converts it into the memory scheme that OpenGL wants void opengl_TranslateBitmapToOpenGL(int texnum, int bm_handle, int map_type, int replace, int tn) { - ushort *bm_ptr; + uint16_t *bm_ptr; int w, h; int size; @@ -1093,11 +1093,11 @@ void opengl_TranslateBitmapToOpenGL(int texnum, int bm_handle, int map_type, int if (OpenGL_packed_pixels) { if (map_type == MAP_TYPE_LIGHTMAP) { - ushort *left_data = (ushort *)opengl_packed_Upload_data; + uint16_t *left_data = (uint16_t *)opengl_packed_Upload_data; int bm_left = 0; for (int i = 0; i < h; i++, left_data += size, bm_left += w) { - ushort *dest_data = left_data; + uint16_t *dest_data = left_data; for (int t = 0; t < w; t++) { *dest_data++ = opengl_packed_Translate_table[bm_ptr[bm_left + t]]; } @@ -1823,7 +1823,7 @@ void opengl_EndFrame() {} // Takes a screenshot of the frontbuffer and puts it into the passed bitmap handle void opengl_Screenshot(int bm_handle) { - ushort *dest_data; + uint16_t *dest_data; uint32_t *temp_data; int i, t; int total = OpenGL_state.screen_width * OpenGL_state.screen_height; @@ -2469,9 +2469,9 @@ void opengl_ChangeChunkedBitmap(int bm_handle, chunked_bitmap *chunk) { ASSERT(how_many_down > 0); // Now go through our big bitmap and partition it into pieces - ushort *src_data = bm_data(bm_handle, 0); - ushort *sdata; - ushort *ddata; + uint16_t *src_data = bm_data(bm_handle, 0); + uint16_t *sdata; + uint16_t *ddata; int shift; switch (iopt) { diff --git a/legacy/renderer/renderer.cpp b/legacy/renderer/renderer.cpp index 39795a11..b6ce0212 100644 --- a/legacy/renderer/renderer.cpp +++ b/legacy/renderer/renderer.cpp @@ -1759,7 +1759,7 @@ float rend_GetAspectRatio() { } } // Given a source x,y and width,height, draws any sized bitmap into the renderer lfb -void rend_DrawLFBBitmap(int sx, int sy, int w, int h, int dx, int dy, ushort *data, int rowsize) { +void rend_DrawLFBBitmap(int sx, int sy, int w, int h, int dx, int dy, uint16_t *data, int rowsize) { renderer_lfb lfb; int i, t; lfb.type = LFB_LOCK_WRITE; @@ -1770,7 +1770,7 @@ void rend_DrawLFBBitmap(int sx, int sy, int w, int h, int dx, int dy, ushort *da } for (i = 0; i < h; i++) { for (t = 0; t < w; t++) { - ushort pix = data[((sy + i) * (rowsize / 2)) + sx + t]; + uint16_t pix = data[((sy + i) * (rowsize / 2)) + sx + t]; if (pix & OPAQUE_FLAG) lfb.data[((dy + i) * (lfb.bytes_per_row / 2)) + dx + t] = pix; } diff --git a/lib/CZip.h b/lib/CZip.h index e0d0ebd4..671fdcff 100644 --- a/lib/CZip.h +++ b/lib/CZip.h @@ -69,7 +69,7 @@ #define uint8_t uint8_t #define uint32_t uint32_t -#define ushort uint16_t +#define uint16_t uint16_t typedef struct { uint8_t type; @@ -179,11 +179,11 @@ public: int ReadBytes(char *data, int count); void WriteBytes(char *data, int count); uint8_t ReadRawByte(void); - ushort ReadRawShort(void); + uint16_t ReadRawShort(void); uint32_t ReadRawInt(void); float ReadRawFloat(void); void WriteRawByte(uint8_t value); - void WriteRawShort(ushort value); + void WriteRawShort(uint16_t value); void WriteRawInt(uint32_t value); void WriteRawFloat(float value); bool RawEOF(void); diff --git a/lib/Controller.h b/lib/Controller.h index f3cf24a7..28ad567a 100644 --- a/lib/Controller.h +++ b/lib/Controller.h @@ -186,7 +186,7 @@ const uint8_t CT_X_AXIS = 1, // AXIS constants for ctAxis #define CONTROLLER_CTL2_INFO(_b) ((int8_t)hibyte(_b)) #define CONTROLLER_CTL_INFO(_l, _h) makeshort(_h, _l) -#define CONTROLLER_VALUE(_l) ((ushort)loword(_l)) +#define CONTROLLER_VALUE(_l) ((uint16_t)loword(_l)) #define CONTROLLER_INFO(_l) ((short)hiword(_l)) #define MAKE_CONFIG_DATA(_c, _v) makeword(_c, _v) diff --git a/lib/Ddgr.h b/lib/Ddgr.h index 7ed5e716..2041c20c 100644 --- a/lib/Ddgr.h +++ b/lib/Ddgr.h @@ -103,8 +103,8 @@ class oeApplication; typedef struct ddgr_init_info { oeApplication *obj; // the app object created by app calling char *subsystem; // subsystem name (i.e. 'DirectDraw', 'GDI') - ushort windowed : 1; // are we running in a fullscreen or windowed mode - ushort debug : 1; // are we running in debug mode? + uint16_t windowed : 1; // are we running in a fullscreen or windowed mode + uint16_t debug : 1; // are we running in debug mode? } ddgr_init_info; /* app = application object. @@ -167,8 +167,8 @@ typedef struct ddgr_surface { void *obj; // internal structure info to library char name[SURF_NAMELEN]; // name int w, h, bpp; // width, height and bit depth - ushort type; // how driver handles this surface - ushort flags; // colorkeying, etc. + uint16_t type; // how driver handles this surface + uint16_t flags; // colorkeying, etc. int locks; // lock count. } ddgr_surface; diff --git a/lib/Macros.h b/lib/Macros.h index 08d3f844..8f535a05 100644 --- a/lib/Macros.h +++ b/lib/Macros.h @@ -48,7 +48,7 @@ * added cleanup string 'macro'. * * 4 5/15/98 3:13p Samir - * added some ushort/byte macros. + * added some uint16_t/byte macros. * * 3 3/31/98 7:48p Samir * fixed horrible makeword macro bug. diff --git a/lib/bitmap.h b/lib/bitmap.h index ea45469e..b493818a 100644 --- a/lib/bitmap.h +++ b/lib/bitmap.h @@ -56,9 +56,9 @@ #define BITMAP_FORMAT_4444 1 typedef struct { - ushort *data16; // 16bit data - ushort width, height; // Width and height in pixels - ushort used; // Is this bitmap free to be allocated? + uint16_t *data16; // 16bit data + uint16_t width, height; // Width and height in pixels + uint16_t used; // Is this bitmap free to be allocated? short cache_slot; // For use by the rendering lib uint8_t mip_levels; @@ -117,9 +117,9 @@ int bm_mipped(int handle); // a function to determine if a pixel in a bitmap is transparent bool bm_pixel_transparent(int bm_handle, int x, int y); // a function to determine if a pixel in a bitmap is transparent -ushort bm_pixel(int bm_handle, int x, int y); +uint16_t bm_pixel(int bm_handle, int x, int y); // given a handle to a bitmap, returns a pointer to its data, or NULL if handle is invalid -ushort *bm_data(int handle, int miplevel); +uint16_t *bm_data(int handle, int miplevel); // Gets bits per pixel for a particular bitmap // As of 12/30/96 always returns 16 int bm_bpp(int handle); diff --git a/lib/bumpmap.h b/lib/bumpmap.h index 62b3d5ba..89d1ab46 100644 --- a/lib/bumpmap.h +++ b/lib/bumpmap.h @@ -28,7 +28,7 @@ #define BUMPF_CHANGED 2 typedef struct { - ushort *data; // 8bit data + uint16_t *data; // 8bit data short cache_slot; // for the renderers use uint8_t width, height; uint8_t flags, pad; @@ -49,7 +49,7 @@ int bump_AllocBumpmap(int w, int h); void bump_FreeBumpmap(int handle); // returns a bumpmaps data else NULL if something is wrong -ushort *bump_data(int handle); +uint16_t *bump_data(int handle); // returns width or height of the passed in bumpmap uint8_t bump_w(int handle); diff --git a/lib/dedicated_server.h b/lib/dedicated_server.h index bf4cebac..f76d021c 100644 --- a/lib/dedicated_server.h +++ b/lib/dedicated_server.h @@ -80,6 +80,6 @@ void DedicatedSocketputs(char *str); void ListenDedicatedSocket(void); // Init the socket and start listening -void InitDedicatedSocket(ushort port); +void InitDedicatedSocket(uint16_t port); #endif diff --git a/lib/demofile.h b/lib/demofile.h index 6065cc1e..ae0009b8 100644 --- a/lib/demofile.h +++ b/lib/demofile.h @@ -167,7 +167,7 @@ void DemoWriteChangedObjects(); void DemoWriteWeaponFire(uint16_t objectnum, vector *pos, vector *dir, uint16_t weaponnum, uint16_t weapobjnum, short gunnum); -void DemoWriteObjCreate(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle, +void DemoWriteObjCreate(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle, object *obj); void DemoWriteTurretChanged(uint16_t objnum); @@ -186,7 +186,7 @@ void DemoWriteKillObject(object *hit_obj, object *killer, float damage, int deat void DemoWritePlayerDeath(object *player, bool melee, int fate = -1); -void DemoWrite3DSound(short soundidx, ushort objnum, int priority, float volume = 0.5f); +void DemoWrite3DSound(short soundidx, uint16_t objnum, int priority, float volume = 0.5f); void DemoWriteCollidePlayerWeapon(object *playerobj, object *weapon, vector *collision_point, vector *collision_normal, bool f_reverse_normal, void *hit_info); diff --git a/lib/findintersection.h b/lib/findintersection.h index db2bc9b1..e48bec29 100644 --- a/lib/findintersection.h +++ b/lib/findintersection.h @@ -373,8 +373,8 @@ extern int fvi_FindIntersection(fvi_query *fq, fvi_info *hit_data, bool no_subdi // Face/Room list for some fvi call(s) typedef struct fvi_face_room_list { - ushort face_index; - ushort room_index; + uint16_t face_index; + uint16_t room_index; } fvi_face_room_list; #define MAX_RECORDED_FACES 200 diff --git a/lib/gameos.h b/lib/gameos.h index c0d20c35..aa50e786 100644 --- a/lib/gameos.h +++ b/lib/gameos.h @@ -142,7 +142,7 @@ public: }; // Data structures typedef struct os_date { - ushort year; // 1-65535 A.D. (or C.E.) + uint16_t year; // 1-65535 A.D. (or C.E.) uint8_t month; uint8_t day; uint8_t hour; diff --git a/lib/grdefs.h b/lib/grdefs.h index ce7a0b41..6d4c8869 100644 --- a/lib/grdefs.h +++ b/lib/grdefs.h @@ -84,15 +84,15 @@ static const ddgr_color GR_NULL = 0xffffffff, // don't do a thing with this. // MACROS static inline ddgr_color GR_RGB(int r, int g, int b) { return ((r << 16) + (g << 8) + b); } -static inline ushort GR_RGB16(int r, int g, int b) { return (((r >> 3) << 10) + ((g >> 3) << 5) + (b >> 3)); } +static inline uint16_t GR_RGB16(int r, int g, int b) { return (((r >> 3) << 10) + ((g >> 3) << 5) + (b >> 3)); } -static inline ushort GR_COLOR_TO_16(ddgr_color c) { +static inline uint16_t GR_COLOR_TO_16(ddgr_color c) { int r, g, b; r = ((c & 0x00ff0000) >> 16); g = ((c & 0x0000ff00) >> 8); b = (c & 0x000000ff); - return (ushort)(((r >> 3) << 10) + ((g >> 3) << 5) + (b >> 3)); + return (uint16_t)(((r >> 3) << 10) + ((g >> 3) << 5) + (b >> 3)); } static inline int GR_COLOR_RED(ddgr_color c) { @@ -110,7 +110,7 @@ static inline int GR_COLOR_BLUE(ddgr_color c) { return (int)b; } -static inline ddgr_color GR_16_TO_COLOR(ushort col) { +static inline ddgr_color GR_16_TO_COLOR(uint16_t col) { int r, g, b; r = (col & 0x7c00) >> 7; diff --git a/lib/grtext.h b/lib/grtext.h index 0eb57641..89cb3a0f 100644 --- a/lib/grtext.h +++ b/lib/grtext.h @@ -215,7 +215,7 @@ const char *grtext_GetChar(const char *str, tGetCharInfo *ci); // we can load a font template into this structure. call grfont_FreeTemplate(tFontTemplate) to free memory here. typedef struct tFontTemplate { - ushort min_ascii, max_ascii; + uint16_t min_ascii, max_ascii; uint8_t *ch_widths; uint8_t *kern_data; uint8_t ch_height; @@ -264,7 +264,7 @@ int grfont_KeyToAscii(int font, int key); // returns the raw bitmap data for a character in a font, its width and height // returned data should be in 565 hicolor format if (*mono) is false. if (*mono) is true, // then a bitmask will be returned, and you should treat a bit as a pixel. -ushort *grfont_GetRawCharacterData(int font, int ch, int *w, int *h, bool *mono); +uint16_t *grfont_GetRawCharacterData(int font, int ch, int *w, int *h, bool *mono); ///////////////////////////////////////////////////////////////////// // EDITING FUNCTIONS ONLY diff --git a/lib/lightmap.h b/lib/lightmap.h index b2f024d6..472c0172 100644 --- a/lib/lightmap.h +++ b/lib/lightmap.h @@ -32,9 +32,9 @@ typedef struct { uint8_t width, height; // Width and height in pixels - ushort *data; // 16bit data + uint16_t *data; // 16bit data - ushort used; + uint16_t used; uint8_t flags; short cache_slot; // for the renderers use uint8_t square_res; // for renderers use @@ -62,6 +62,6 @@ int lm_w(int handle); int lm_h(int handle); // returns a lightmaps data else NULL if something is wrong -ushort *lm_data(int handle); +uint16_t *lm_data(int handle); #endif diff --git a/lib/networking.h b/lib/networking.h index 097f412b..2d577928 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -335,7 +335,7 @@ enum network_protocol : uint32_t typedef struct { uint8_t address[6]; - ushort port; + uint16_t port; uint8_t net_id[4]; network_protocol connection_type; // IPX, IP, modem, etc. } network_address; @@ -361,7 +361,7 @@ int nw_InitReliableSocket(); int nw_CheckListenSocket(network_address *from_addr); // Inits the sockets that the application will be using -void nw_InitSockets(ushort port); +void nw_InitSockets(uint16_t port); // Connects a client to a server void nw_ConnectToServer(SOCKET *socket, network_address *server_addr); @@ -380,8 +380,8 @@ uint32_t nw_GetThisIP(); // returns 0 on error or nothing waiting. 1 if we should try to accept int nw_CheckListenSocket(network_address *from_addr); -// Calculates a unique ushort checksum for a stream of data -ushort nw_CalculateChecksum(void *vptr, int len); +// Calculates a unique uint16_t checksum for a stream of data +uint16_t nw_CalculateChecksum(void *vptr, int len); // Sends data on an unreliable socket int nw_Send(network_address *who_to, void *data, int len, int flags); diff --git a/lib/polymodel_external.h b/lib/polymodel_external.h index d64bdbe2..cd87ed7d 100644 --- a/lib/polymodel_external.h +++ b/lib/polymodel_external.h @@ -115,7 +115,7 @@ typedef struct a_bank { typedef struct { uint8_t num_verts; - ushort lmi_handle; + uint16_t lmi_handle; vector rvec, uvec; float *u2, *v2; } lightmap_object_face; @@ -194,8 +194,8 @@ typedef struct bsp_info { int *keyframe_angles; // The destination angles for each key frame vector *keyframe_pos; matrix *keyframe_matrix; // the combined rotation matrices up to frame n - ushort *tick_pos_remap; // For looking up keyframes fast - ushort *tick_ang_remap; // For looking up keyframes fast + uint16_t *tick_pos_remap; // For looking up keyframes fast + uint16_t *tick_ang_remap; // For looking up keyframes fast int *rot_start_time; int *pos_start_time; diff --git a/lib/pstypes.h b/lib/pstypes.h index 91d1830f..34a49fc8 100644 --- a/lib/pstypes.h +++ b/lib/pstypes.h @@ -25,7 +25,7 @@ // define unsigned types; typedef uint8_t uint8_t; typedef int8_t int8_t; -typedef uint16_t ushort; +typedef uint16_t uint16_t; typedef uint32_t uint32_t; typedef unsigned long ulong; diff --git a/lib/renderer.h b/lib/renderer.h index e82d32a2..7e1519e9 100644 --- a/lib/renderer.h +++ b/lib/renderer.h @@ -466,7 +466,7 @@ typedef struct { typedef struct { int type; - ushort *data; + uint16_t *data; int bytes_per_row; } renderer_lfb; @@ -611,7 +611,7 @@ void rend_GetLFBLock(renderer_lfb *lfb); void rend_ReleaseLFBLock(renderer_lfb *lfb); // Given a source x,y and width,height, draws any sized bitmap into the renderer lfb -void rend_DrawLFBBitmap(int sx, int sy, int w, int h, int dx, int dy, ushort *data, int rowsize); +void rend_DrawLFBBitmap(int sx, int sy, int w, int h, int dx, int dy, uint16_t *data, int rowsize); // given a chunked bitmap, renders it. void rend_DrawChunkedBitmap(chunked_bitmap *chunk, int x, int y, uint8_t alpha); diff --git a/lib/ui.h b/lib/ui.h index 0f99a22e..3e313b17 100644 --- a/lib/ui.h +++ b/lib/ui.h @@ -386,7 +386,7 @@ class UIGadget : public UIObject { private: int m_ID; // id value of gadget. short m_Datum; // used to pass info around. - ushort m_Hotkey; + uint16_t m_Hotkey; int m_SavedW, m_SavedH; // saved values of width and height. bool m_Disabled; // is gadget disabled? diff --git a/lib/unzip.h b/lib/unzip.h index 88ff3017..2c2c99bb 100644 --- a/lib/unzip.h +++ b/lib/unzip.h @@ -48,18 +48,18 @@ typedef struct { uint8_t host_os; uint8_t version_needed_to_extract; uint8_t os_needed_to_extract; - ushort general_purpose_bit_flag; - ushort compression_method; - ushort last_mod_file_time; - ushort last_mod_file_date; + uint16_t general_purpose_bit_flag; + uint16_t compression_method; + uint16_t last_mod_file_time; + uint16_t last_mod_file_date; uint32_t crc32; uint32_t compressed_size; uint32_t uncompressed_size; - ushort filename_length; - ushort extra_field_length; - ushort file_comment_length; - ushort disk_number_start; - ushort internal_file_attrib; + uint16_t filename_length; + uint16_t extra_field_length; + uint16_t file_comment_length; + uint16_t disk_number_start; + uint16_t internal_file_attrib; uint32_t external_file_attrib; uint32_t offset_lcl_hdr_frm_frst_disk; char *name; @@ -134,13 +134,13 @@ private: // end_of_cent_dir uint32_t m_end_of_cent_dir_sig; - ushort m_number_of_this_disk; - ushort m_number_of_disk_start_cent_dir; - ushort m_total_entries_cent_dir_this_disk; - ushort m_total_entries_cent_dir; + uint16_t m_number_of_this_disk; + uint16_t m_number_of_disk_start_cent_dir; + uint16_t m_total_entries_cent_dir_this_disk; + uint16_t m_total_entries_cent_dir; uint32_t m_size_of_cent_dir; uint32_t m_offset_to_start_of_cent_dir; - ushort m_zipfile_comment_length; + uint16_t m_zipfile_comment_length; char *m_zipfile_comment; // pointer in ecd }; diff --git a/lib/win/wincontroller.h b/lib/win/wincontroller.h index f8f51d16..f74a991a 100644 --- a/lib/win/wincontroller.h +++ b/lib/win/wincontroller.h @@ -222,8 +222,8 @@ private: struct t_controller { int id; - ushort flags; - ushort buttons; + uint16_t flags; + uint16_t buttons; unsigned btnmask; float normalizer[CT_NUM_AXES]; float sens[CT_NUM_AXES]; diff --git a/linux/lnxcontroller.cpp b/linux/lnxcontroller.cpp index 9e8c320a..0e35fd78 100644 --- a/linux/lnxcontroller.cpp +++ b/linux/lnxcontroller.cpp @@ -206,7 +206,7 @@ const char *lnxgameController::get_binding_text(ct_type type, uint8_t ctrl, uint case ctPOV2: case ctPOV3: case ctPOV4: { - ushort povpos = bind; + uint16_t povpos = bind; if (type == ctPOV) pov_n = 0; @@ -941,7 +941,7 @@ bool lnxgameController::enum_controllers() { // returns the controller with a pov hat int8_t lnxgameController::get_pov_controller(uint8_t pov) { // start from controller 2 because 0, and 1 are reserved for keyboard and mouse - ushort pov_flag = CTF_POV << (pov); + uint16_t pov_flag = CTF_POV << (pov); for (int i = 2; i < m_NumControls; i++) if ((m_ControlList[i].flags & pov_flag) && m_ControlList[i].id != CTID_INVALID) diff --git a/linux/lnxcontroller.h b/linux/lnxcontroller.h index 474d2152..d5567eb4 100644 --- a/linux/lnxcontroller.h +++ b/linux/lnxcontroller.h @@ -111,8 +111,8 @@ private: struct t_controller { int id; - ushort flags; - ushort buttons; + uint16_t flags; + uint16_t buttons; unsigned btnmask; float normalizer[CT_NUM_AXES]; float sens[CT_NUM_AXES]; diff --git a/manage/gamefilepage.cpp b/manage/gamefilepage.cpp index 347beb50..9d3274ca 100644 --- a/manage/gamefilepage.cpp +++ b/manage/gamefilepage.cpp @@ -91,7 +91,7 @@ int mng_ReadNewGamefilePage(CFILE *infile, mngs_gamefile_page *gamefilepage) { int mng_ReadGamefilePage(CFILE *infile, mngs_gamefile_page *gamefilepage) { int done = 0; char command; - ushort len; + uint16_t len; int i; if (!Old_table_method) diff --git a/manage/generic.cpp b/manage/generic.cpp index 9bb0aaff..f0814804 100644 --- a/manage/generic.cpp +++ b/manage/generic.cpp @@ -1339,7 +1339,7 @@ int mng_ReadNewGenericPage(CFILE *infile, mngs_generic_page *genericpage) { int mng_ReadGenericPage(CFILE *infile, mngs_generic_page *genericpage) { int done = 0; char command; - ushort len; + uint16_t len; int i, temp, version = 0, t; if (!Old_table_method) diff --git a/manage/megapage.cpp b/manage/megapage.cpp index e19cdfa4..218af07a 100644 --- a/manage/megapage.cpp +++ b/manage/megapage.cpp @@ -132,7 +132,7 @@ void mng_WriteNewMegacellPage(CFILE *outfile, mngs_megacell_page *megacellpage) int mng_ReadMegacellPage(CFILE *infile, mngs_megacell_page *megacellpage) { int done = 0; char command; - ushort len; + uint16_t len; int i, temp; if (!Old_table_method) return mng_ReadNewMegacellPage(infile, megacellpage); diff --git a/manage/texpage.cpp b/manage/texpage.cpp index c79884a6..e2f3016f 100644 --- a/manage/texpage.cpp +++ b/manage/texpage.cpp @@ -375,7 +375,7 @@ void mng_WriteTexturePage(CFILE *outfile, mngs_texture_page *texpage) { cf_WriteByte(outfile, TEXPAGE_COMMAND_FIRST_PROC_PAL); cf_WriteByte(outfile, (uint8_t)255); for (i = 0; i < 255; i++) { - ushort val = texpage->proc_palette[i]; + uint16_t val = texpage->proc_palette[i]; val >>= 8; cf_WriteByte(outfile, val); @@ -384,7 +384,7 @@ void mng_WriteTexturePage(CFILE *outfile, mngs_texture_page *texpage) { cf_WriteByte(outfile, TEXPAGE_COMMAND_SECOND_PROC_PAL); cf_WriteByte(outfile, (uint8_t)255); for (i = 0; i < 255; i++) { - ushort val = texpage->proc_palette[i]; + uint16_t val = texpage->proc_palette[i]; val &= 0xFF; cf_WriteByte(outfile, val); @@ -470,7 +470,7 @@ void mng_WriteNewTexturePage(CFILE *outfile, mngs_texture_page *texpage) { if (texpage->tex_struct.flags & TF_PROCEDURAL) { // Write procedural palette for (i = 0; i < 255; i++) { - ushort val = texpage->proc_palette[i]; + uint16_t val = texpage->proc_palette[i]; cf_WriteShort(outfile, val); } @@ -603,7 +603,7 @@ int mng_ReadTexturePage(CFILE *infile, mngs_texture_page *texpage) { break; case TEXPAGE_COMMAND_FIRST_PROC_PAL: for (i = 0; i < 255; i++) { - ushort val = cf_ReadByte(infile); + uint16_t val = cf_ReadByte(infile); val <<= 8; texpage->proc_palette[i] &= 0xFF; texpage->proc_palette[i] |= val; @@ -693,7 +693,7 @@ int mng_ReadNewTexturePage(CFILE *infile, mngs_texture_page *texpage) { if (texpage->tex_struct.flags & TF_PROCEDURAL) { for (i = 0; i < 255; i++) { - ushort val = cf_ReadShort(infile); + uint16_t val = cf_ReadShort(infile); texpage->proc_palette[i] = val; } diff --git a/manage/texpage.h b/manage/texpage.h index 33045ba3..9ad5c12f 100644 --- a/manage/texpage.h +++ b/manage/texpage.h @@ -48,7 +48,7 @@ typedef struct { uint8_t proc_x2[MAX_PROC_ELEMENTS]; uint8_t proc_y2[MAX_PROC_ELEMENTS]; - ushort proc_palette[256]; + uint16_t proc_palette[256]; } mngs_texture_page; // Texture page functions diff --git a/model/newstyle.cpp b/model/newstyle.cpp index 49c23b5b..87b2c81f 100644 --- a/model/newstyle.cpp +++ b/model/newstyle.cpp @@ -421,7 +421,7 @@ inline void RenderSubmodelFace(poly_model *pm, bsp_info *sm, int facenum) { int h=lmi_h (lmi_handle); vector rvec=lfp->rvec*lmi_ptr->xspacing; vector uvec=lfp->uvec*lmi_ptr->yspacing; - ushort *src_data=(ushort *)lm_data(lmi_ptr->lm_handle); + uint16_t *src_data=(uint16_t *)lm_data(lmi_ptr->lm_handle); for (int i=0;isubmodel[i].rot_track_max - pm->submodel[i].rot_track_min); if (num_ticks > 0) { - pm->submodel[i].tick_ang_remap = (ushort *)mem_malloc(num_ticks * 2); + pm->submodel[i].tick_ang_remap = (uint16_t *)mem_malloc(num_ticks * 2); ASSERT(pm->submodel[i].tick_ang_remap); } else { pm->submodel[i].tick_ang_remap = NULL; @@ -1892,7 +1892,7 @@ int ReadNewModelFile(int polynum, CFILE *infile) { int num_ticks = (pm->submodel[i].pos_track_max - pm->submodel[i].pos_track_min); if (num_ticks > 0) { - pm->submodel[i].tick_pos_remap = (ushort *)mem_malloc(num_ticks * 2); + pm->submodel[i].tick_pos_remap = (uint16_t *)mem_malloc(num_ticks * 2); ASSERT(pm->submodel[i].tick_pos_remap); } else { pm->submodel[i].tick_pos_remap = NULL; diff --git a/movie/d3movie.cpp b/movie/d3movie.cpp index 3bc424d5..518e1ce8 100644 --- a/movie/d3movie.cpp +++ b/movie/d3movie.cpp @@ -54,7 +54,7 @@ namespace { MovieFrameCallback_fp Movie_callback = NULL; char MovieDir[512]; char SoundCardName[512]; -ushort CurrentPalette[256]; +uint16_t CurrentPalette[256]; int Movie_bm_handle = -1; uint32_t Movie_current_framenum = 0; bool Movie_looping = false; @@ -654,7 +654,7 @@ void BlitToMovieBitmap(uint8_t *buf, uint32_t bufw, uint32_t bufh, uint32_t hico Movie_bm_handle = bm_AllocBitmap(texW, texH, 0); } - uint16_t *pPixelData = (ushort *)bm_data(Movie_bm_handle, 0); + uint16_t *pPixelData = (uint16_t *)bm_data(Movie_bm_handle, 0); GameBitmaps[Movie_bm_handle].flags |= BF_CHANGED; if (hicolor) { uint16_t *wBuf = (uint16_t *)buf; diff --git a/netcon/includes/con_dll.h b/netcon/includes/con_dll.h index ed547a4a..d82501e1 100644 --- a/netcon/includes/con_dll.h +++ b/netcon/includes/con_dll.h @@ -465,7 +465,7 @@ static inline void DLLMultiStartServer(int playing, char *scriptname, int dedica typedef void (*ShowProgressScreen_fp)(char *, char *); ShowProgressScreen_fp DLLShowProgressScreen; -typedef int (*SearchForLocalGamesTCP_fp)(uint32_t, ushort); +typedef int (*SearchForLocalGamesTCP_fp)(uint32_t, uint16_t); SearchForLocalGamesTCP_fp DLLSearchForLocalGamesTCP; typedef int (*nw_GetHostAddressFromNumbers_fp)(char *str); @@ -548,7 +548,7 @@ OldEditGetText_fp DLLOldEditGetText; typedef void (*ToggleUICallback_fp)(int state); ToggleUICallback_fp DLLToggleUICallback; -typedef int (*SearchForGamesPXO_fp)(uint32_t ask, ushort port); +typedef int (*SearchForGamesPXO_fp)(uint32_t ask, uint16_t port); SearchForGamesPXO_fp DLLSearchForGamesPXO; typedef void (*SetOldEditBufferLen_fp)(void *item, int len); diff --git a/netgames/anarchy/anarchy.cpp b/netgames/anarchy/anarchy.cpp index 280bf083..1489b537 100644 --- a/netgames/anarchy/anarchy.cpp +++ b/netgames/anarchy/anarchy.cpp @@ -194,7 +194,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; diff --git a/netgames/coop/coop.cpp b/netgames/coop/coop.cpp index 4322461b..2ea19ec2 100644 --- a/netgames/coop/coop.cpp +++ b/netgames/coop/coop.cpp @@ -226,7 +226,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; diff --git a/netgames/ctf/ctf.cpp b/netgames/ctf/ctf.cpp index 224bc6bc..d180b06f 100644 --- a/netgames/ctf/ctf.cpp +++ b/netgames/ctf/ctf.cpp @@ -428,7 +428,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; @@ -2297,9 +2297,9 @@ int UnPackBytes(uint8_t *bytes, int count, uint8_t *buffer, int pos) { return pos; } -int PackWord(ushort word, uint8_t *buffer, int pos) { return PackBytes((uint8_t *)&word, sizeof(ushort), buffer, pos); } +int PackWord(uint16_t word, uint8_t *buffer, int pos) { return PackBytes((uint8_t *)&word, sizeof(uint16_t), buffer, pos); } -int UnPackWord(ushort *word, uint8_t *buffer, int pos) { return UnPackBytes((uint8_t *)word, sizeof(ushort), buffer, pos); } +int UnPackWord(uint16_t *word, uint8_t *buffer, int pos) { return UnPackBytes((uint8_t *)word, sizeof(uint16_t), buffer, pos); } int PackInt(int data, uint8_t *buffer, int pos) { return PackBytes((uint8_t *)&data, sizeof(int), buffer, pos); } @@ -2343,7 +2343,7 @@ void SendGameState(int pnum) { MultiAddInt(HasFlag[i], data, &count); } - ushort server_objnums[DLLMAX_TEAMS]; + uint16_t server_objnums[DLLMAX_TEAMS]; for (i = 0; i < DLLMAX_TEAMS; i++) { if (ChildFlags[i] == OBJECT_HANDLE_NONE) { // slot not in use @@ -2421,7 +2421,7 @@ void ReceiveGameState(uint8_t *data) { } } - ushort server_objnums[DLLMAX_TEAMS]; + uint16_t server_objnums[DLLMAX_TEAMS]; // unpack attached flag handles for (i = 0; i < DLLMAX_TEAMS; i++) { server_objnums[i] = MultiGetUshort(data, &count); @@ -2431,7 +2431,7 @@ void ReceiveGameState(uint8_t *data) { for (i = 0; i < DLLMAX_TEAMS; i++) { if (server_objnums[i] != 65535) { // we should have a real object here - ushort our_objnum = DMFCBase->ConvertServerToLocalObjnum(server_objnums[i]); + uint16_t our_objnum = DMFCBase->ConvertServerToLocalObjnum(server_objnums[i]); if (our_objnum == -1) { // fatal error diff --git a/netgames/dmfc/dmfcbase.cpp b/netgames/dmfc/dmfcbase.cpp index 2a5126c0..1f6dec0b 100644 --- a/netgames/dmfc/dmfcbase.cpp +++ b/netgames/dmfc/dmfcbase.cpp @@ -912,7 +912,7 @@ void DMFCBase::GameInit(int teams) { MenuBackgroundBMP = DLLbm_AllocBitmap(32, 32, 0); if (MenuBackgroundBMP > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(MenuBackgroundBMP, 0); + uint16_t *data = DLLbm_data(MenuBackgroundBMP, 0); int j; for (j = 0; j < 32 * 32; j++) data[j] = OPAQUE_FLAG | GR_RGB(0, 0, 0); diff --git a/netgames/dmfc/dmfcdllinit.h b/netgames/dmfc/dmfcdllinit.h index 5e9056d2..100d7554 100644 --- a/netgames/dmfc/dmfcdllinit.h +++ b/netgames/dmfc/dmfcdllinit.h @@ -589,8 +589,8 @@ ShieldDelta = (float *)API.vp[7]; Game_interface_mode = (int *)API.vp[8]; LocalD3Dir = (char *)API.vp[9]; m_bTrackerGame = (int *)API.vp[10]; -Local_object_list = (ushort *)API.vp[11]; -Server_object_list = (ushort *)API.vp[12]; +Local_object_list = (uint16_t *)API.vp[11]; +Server_object_list = (uint16_t *)API.vp[12]; Dedicated_server = (bool *)API.vp[13]; Player_colors = (ddgr_color *)API.vp[14]; Hud_aspect_x = (float *)API.vp[15]; diff --git a/netgames/dmfc/dmfcfunctions.cpp b/netgames/dmfc/dmfcfunctions.cpp index cbf012bf..9912ba8e 100644 --- a/netgames/dmfc/dmfcfunctions.cpp +++ b/netgames/dmfc/dmfcfunctions.cpp @@ -139,7 +139,7 @@ DMFCFUNCTION void (*DLLMultiPaintGoalRooms)(int *texcolors); DMFCFUNCTION void (*DLLMultiSendSpecialPacket)(int slot, uint8_t *outdata, int size); DMFCFUNCTION void (*DLLComputeRoomCenter)(vector *vp, room *rp); DMFCFUNCTION int (*DLLGetGoalRoomForTeam)(int teamnum); -DMFCFUNCTION int (*DLLObjCreate)(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, +DMFCFUNCTION int (*DLLObjCreate)(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle); DMFCFUNCTION int (*DLLFindObjectIDName)(const char *name); DMFCFUNCTION void (*DLLObjSetPosNoMark)(object *objp, vector *newpos, int roomnum, matrix *orient, @@ -187,7 +187,7 @@ DMFCFUNCTION void (*DLLRenderHUDQuad)(int x, int y, int w, int h, float u0, floa uint8_t alpha, int sat_count); DMFCFUNCTION void (*DLLRenderHUDText)(ddgr_color col, uint8_t alpha, int sat_count, int x, int y, const char *fmt, ...); DMFCFUNCTION void (*DLLMultiEndLevel)(void); -DMFCFUNCTION ushort *(*DLLbm_data)(int handle, int miplevel); +DMFCFUNCTION uint16_t *(*DLLbm_data)(int handle, int miplevel); DMFCFUNCTION int (*DLLbm_AllocBitmap)(int w, int h, int add_mem); DMFCFUNCTION void (*DLLrend_FillRect)(ddgr_color color, int x1, int y1, int x2, int y2); DMFCFUNCTION bool (*DLLbm_CreateChunkedBitmap)(int bm_handle, chunked_bitmap *chunk); @@ -318,8 +318,8 @@ DMFCFUNCTION int (*DLLSliderGetPos)(void *slider); DMFCFUNCTION void (*DLLSliderSetSelectChangeCallback)(void *slider, void (*fn)(int)); DMFCFUNCTION void (*DLLSliderSetSelectChangeCallbackWData)(void *slider, void (*fn)(int, void *), void *ptr); DMFCFUNCTION void (*DLLTextSetTitle)(void *text, void *textitem); -DMFCFUNCTION bool (*DLLPPic_GetPilot)(ushort pilot_id, char *pilot_name, int buffersize); -DMFCFUNCTION int (*DLLPPic_GetBitmapHandle)(ushort pilot_id); +DMFCFUNCTION bool (*DLLPPic_GetPilot)(uint16_t pilot_id, char *pilot_name, int buffersize); +DMFCFUNCTION int (*DLLPPic_GetBitmapHandle)(uint16_t pilot_id); DMFCFUNCTION void (*DLLrend_DrawLine)(int x1, int y1, int x2, int y2); DMFCFUNCTION void (*DLLrend_SetFlatColor)(ddgr_color color); DMFCFUNCTION void (*DLLMultiSetLogoState)(bool state); @@ -419,7 +419,7 @@ DMFCFUNCTION void (*DLLrend_SetZBias)(float z_bias); DMFCFUNCTION void (*DLLrend_SetZBufferWriteMask)(int state); DMFCFUNCTION void (*DLLrend_GetLFBLock)(renderer_lfb *lfb); DMFCFUNCTION void (*DLLrend_ReleaseLFBLock)(renderer_lfb *lfb); -DMFCFUNCTION void (*DLLrend_DrawLFBBitmap)(int sx, int sy, int w, int h, int dx, int dy, ushort *data, int rowsize); +DMFCFUNCTION void (*DLLrend_DrawLFBBitmap)(int sx, int sy, int w, int h, int dx, int dy, uint16_t *data, int rowsize); DMFCFUNCTION void (*DLLrend_DrawSpecialLine)(g3Point *p0, g3Point *p1); DMFCFUNCTION int (*DLLfvi_FindIntersection)(fvi_query *fq, fvi_info *hit_data, bool no_subdivision); DMFCFUNCTION int (*DLLfvi_QuickDistFaceList)(int init_room_index, vector *pos, float rad, @@ -443,7 +443,7 @@ DMFCFUNCTION void (*DLLVisEffectRelink)(int visnum, int newroomnum); DMFCFUNCTION void (*DLLVisEffectDelete)(int visnum); DMFCFUNCTION void (*DLLCreateRandomSparks)(int num_sparks, vector *pos, int roomnum, int which_index, float force_scalar); -DMFCFUNCTION void (*DLLCreateRandomLineSparks)(int num_sparks, vector *pos, int roomnum, ushort color, +DMFCFUNCTION void (*DLLCreateRandomLineSparks)(int num_sparks, vector *pos, int roomnum, uint16_t color, float force_scalar); DMFCFUNCTION int (*DLLVisEffectCreateControlled)(uint8_t type, object *parent, uint8_t id, int roomnum, vector *pos, float lifetime, vector *velocity, int phys_flags, float size, @@ -513,7 +513,7 @@ DMFCFUNCTION bool (*Inven_GetAuxPosTypeID)(Inventory *inven, int &type, int &id) DMFCFUNCTION char *(*Inven_GetPosDescription)(Inventory *inven); DMFCFUNCTION char *(*Inven_GetPosIconName)(Inventory *inven); DMFCFUNCTION char *(*Inven_GetPosName)(Inventory *inven); -DMFCFUNCTION bool (*Inven_GetPosInfo)(Inventory *inven, ushort &iflags, int &flags); +DMFCFUNCTION bool (*Inven_GetPosInfo)(Inventory *inven, uint16_t &iflags, int &flags); DMFCFUNCTION int (*Inven_GetPosCount)(Inventory *inven); DMFCFUNCTION bool (*Inven_AtBeginning)(Inventory *inven); DMFCFUNCTION bool (*Inven_AtEnd)(Inventory *inven); diff --git a/netgames/dmfc/dmfcinternal.h b/netgames/dmfc/dmfcinternal.h index ae38be5d..99e7247f 100644 --- a/netgames/dmfc/dmfcinternal.h +++ b/netgames/dmfc/dmfcinternal.h @@ -321,8 +321,8 @@ typedef struct { float kill_time; // time of latest kill float death_time; // time of latest death float observer_time; // time the player entered observer mode (or 0 if not) - ushort kills_in_a_row; // Number of kills in a row for this player - ushort deaths_in_a_row; // Number of deaths in a row for this player + uint16_t kills_in_a_row; // Number of kills in a row for this player + uint16_t deaths_in_a_row; // Number of deaths in a row for this player int8_t last_kill_num; // Player record num of last person this player killed int8_t last_death_num; // Player record num of the player that last killed this player char got_revenge; // 1 if revenge has been made on last killer @@ -2097,8 +2097,8 @@ private: int m_iNumBanPlayers; int m_iUIWindowID; void *m_UIUserData; - ushort *Local_object_list; - ushort *Server_object_list; + uint16_t *Local_object_list; + uint16_t *Server_object_list; tHostsNode *m_DenyList; tHostsNode *m_AllowList; bool LossGuageEnabled; diff --git a/netgames/dmfc/dmfcpinfo.cpp b/netgames/dmfc/dmfcpinfo.cpp index 82ad7089..1547b2c4 100644 --- a/netgames/dmfc/dmfcpinfo.cpp +++ b/netgames/dmfc/dmfcpinfo.cpp @@ -285,8 +285,8 @@ int PInfo::GetExtraInfoSize(void) { size += sizeof(float); // extra_info.observer_time size += sizeof(float); // extrainfo.kill_time size += sizeof(float); // extrainfo.death_time - size += sizeof(ushort); // extrainfo.kills_in_a_row - size += sizeof(ushort); // extrainfo.deaths_in_a_row + size += sizeof(uint16_t); // extrainfo.kills_in_a_row + size += sizeof(uint16_t); // extrainfo.deaths_in_a_row size += sizeof(int8_t); // extrainfo.last_kill_num size += sizeof(int8_t); // extrainfo.last_death_num size += sizeof(char); // extrainfo.got_revenge diff --git a/netgames/dmfc/dmfcstats.cpp b/netgames/dmfc/dmfcstats.cpp index d9e2c7cf..23bc57eb 100644 --- a/netgames/dmfc/dmfcstats.cpp +++ b/netgames/dmfc/dmfcstats.cpp @@ -279,7 +279,7 @@ bool CDmfcStats::Initialize(tDmfcStatsInit *init_info) { m_highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); m_background_bmp = DLLbm_AllocBitmap(32, 32, 0); - ushort *data; + uint16_t *data; if (m_highlight_bmp == -1) m_highlight_bmp = BAD_BITMAP_HANDLE; diff --git a/netgames/dmfc/encryption.cpp b/netgames/dmfc/encryption.cpp index f28b1a91..652de630 100644 --- a/netgames/dmfc/encryption.cpp +++ b/netgames/dmfc/encryption.cpp @@ -280,7 +280,7 @@ void IceKey::scheduleBuild(uint16_t *kb, int n, const int *keyrot) { uint32_t *curr_sk = &isk->val[j % 3]; for (k = 0; k < 4; k++) { - ushort *curr_kb = &kb[(kr + k) & 3]; + uint16_t *curr_kb = &kb[(kr + k) & 3]; int bit = *curr_kb & 1; *curr_sk = (*curr_sk << 1) | bit; @@ -297,7 +297,7 @@ void IceKey::set(const uint8_t *key) { int i; if (_rounds == 8) { - ushort kb[4]; + uint16_t kb[4]; for (i = 0; i < 4; i++) { kb[3 - i] = (key[i * 2] << 8) | key[i * 2 + 1]; @@ -309,7 +309,7 @@ void IceKey::set(const uint8_t *key) { for (i = 0; i < _size; i++) { int j; - ushort kb[4]; + uint16_t kb[4]; for (j = 0; j < 4; j++) { kb[3 - j] = (key[i * 8 + j * 2] << 8) | key[i * 8 + j * 2 + 1]; diff --git a/netgames/dmfc/encryption.h b/netgames/dmfc/encryption.h index a82fdd26..9da2a163 100644 --- a/netgames/dmfc/encryption.h +++ b/netgames/dmfc/encryption.h @@ -56,7 +56,7 @@ public: int blockSize(void) const; private: - void scheduleBuild(ushort *k, int n, const int *keyrot); + void scheduleBuild(uint16_t *k, int n, const int *keyrot); int _size; int _rounds; diff --git a/netgames/entropy/EntropyBase.cpp b/netgames/entropy/EntropyBase.cpp index 376ba661..7b30e00f 100644 --- a/netgames/entropy/EntropyBase.cpp +++ b/netgames/entropy/EntropyBase.cpp @@ -343,7 +343,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; diff --git a/netgames/hoard/hoard.cpp b/netgames/hoard/hoard.cpp index db60f519..dc906ce7 100644 --- a/netgames/hoard/hoard.cpp +++ b/netgames/hoard/hoard.cpp @@ -372,7 +372,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; diff --git a/netgames/hyperanarchy/hyperanarchy.cpp b/netgames/hyperanarchy/hyperanarchy.cpp index 762c4bc4..46cbdb81 100644 --- a/netgames/hyperanarchy/hyperanarchy.cpp +++ b/netgames/hyperanarchy/hyperanarchy.cpp @@ -290,7 +290,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; diff --git a/netgames/includes/gamedll_header.h b/netgames/includes/gamedll_header.h index f2e05769..2843e3cf 100644 --- a/netgames/includes/gamedll_header.h +++ b/netgames/includes/gamedll_header.h @@ -181,9 +181,9 @@ typedef int (*GetGoalRoomForTeam_fp)(int teamnum); DMFCDLLOUT(GetGoalRoomForTeam_fp DLLGetGoalRoomForTeam;) // ObjCreate without writing data to demo -// typedef int( *ObjCreate_fp ) (uint8_t type,ushort id,int roomnum,vector *pos,const matrix *orient,int parent_handle = +// typedef int( *ObjCreate_fp ) (uint8_t type,uint16_t id,int roomnum,vector *pos,const matrix *orient,int parent_handle = // OBJECT_HANDLE_NONE); -typedef int (*ObjCreate_fp)(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle); +typedef int (*ObjCreate_fp)(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle); DMFCDLLOUT(ObjCreate_fp DLLObjCreate;) typedef int (*FindObjectIDName_fp)(const char *name); @@ -356,7 +356,7 @@ typedef void (*MultiEndLevel_fp)(void); DMFCDLLOUT(MultiEndLevel_fp DLLMultiEndLevel;) // returns a pointer to the data in a bitmap -typedef ushort *(*bm_data_fp)(int handle, int miplevel); +typedef uint16_t *(*bm_data_fp)(int handle, int miplevel); DMFCDLLOUT(bm_data_fp DLLbm_data;) // Allocs a bitmap of w x h size @@ -889,13 +889,13 @@ DMFCDLLOUT(ObjGet_fp DLLObjGet;) // Given a pilot id, it will return the pilot name of // the pilot name. Returns false if it's an invalid pilot id. -typedef bool (*PPic_GetPilot_fp)(ushort pilot_id, char *pilot_name, int buffersize); +typedef bool (*PPic_GetPilot_fp)(uint16_t pilot_id, char *pilot_name, int buffersize); DMFCDLLOUT(PPic_GetPilot_fp DLLPPic_GetPilot;) // Given a pilot id, it will return a handle to the bitmap for the pilot. // MAKE SURE YOU FREE THE BITMAP WITH DLLbm_FreeBitmap(). Returns -1 if it was an illegal pilot id. // Returns BAD_BITMAP_HANDLE if it couldn't open the bitmap. -typedef int (*PPic_GetBitmapHandle_fp)(ushort pilot_id); +typedef int (*PPic_GetBitmapHandle_fp)(uint16_t pilot_id); DMFCDLLOUT(PPic_GetBitmapHandle_fp DLLPPic_GetBitmapHandle;) // Draws a line @@ -1299,7 +1299,7 @@ typedef void (*rend_ReleaseLFBLock_fp)(renderer_lfb *lfb); DMFCDLLOUT(rend_ReleaseLFBLock_fp DLLrend_ReleaseLFBLock;) // Given a source x,y and width,height, draws any sized bitmap into the renderer lfb -typedef void (*rend_DrawLFBBitmap_fp)(int sx, int sy, int w, int h, int dx, int dy, ushort *data, int rowsize); +typedef void (*rend_DrawLFBBitmap_fp)(int sx, int sy, int w, int h, int dx, int dy, uint16_t *data, int rowsize); DMFCDLLOUT(rend_DrawLFBBitmap_fp DLLrend_DrawLFBBitmap;) // Draws a line using the states of the renderer @@ -1402,9 +1402,9 @@ typedef void (*CreateRandomSparks_fp)(int num_sparks, vector *pos, int roomnum, DMFCDLLOUT(CreateRandomSparks_fp DLLCreateRandomSparks;) // Creates a some line sparks that go in random directions -// typedef void (*CreateRandomLineSparks_fp) (int num_sparks,vector *pos,int roomnum,ushort color=0,float +// typedef void (*CreateRandomLineSparks_fp) (int num_sparks,vector *pos,int roomnum,uint16_t color=0,float // force_scalar=1); -typedef void (*CreateRandomLineSparks_fp)(int num_sparks, vector *pos, int roomnum, ushort color, float force_scalar); +typedef void (*CreateRandomLineSparks_fp)(int num_sparks, vector *pos, int roomnum, uint16_t color, float force_scalar); DMFCDLLOUT(CreateRandomLineSparks_fp DLLCreateRandomLineSparks;) // Creates vis effects but has the caller set their parameters @@ -1710,7 +1710,7 @@ DMFCDLLOUT(dInven_GetPosName_fp Inven_GetPosName;) // return information about the current position item // return true if it is a real object -typedef bool (*dInven_GetPosInfo_fp)(Inventory *inven, ushort &iflags, int &flags); +typedef bool (*dInven_GetPosInfo_fp)(Inventory *inven, uint16_t &iflags, int &flags); DMFCDLLOUT(dInven_GetPosInfo_fp Inven_GetPosInfo;) // returns the count of the item at the current position diff --git a/netgames/monsterball/monsterball.cpp b/netgames/monsterball/monsterball.cpp index 668ab9df..8ae57df0 100644 --- a/netgames/monsterball/monsterball.cpp +++ b/netgames/monsterball/monsterball.cpp @@ -445,7 +445,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; @@ -2110,7 +2110,7 @@ void DoMonsterballScoreEffect(void) { float lifetime = 4.0f; float thickness = 17.5f; float slidetime = 0.3f; - ushort color = GR_RGB16(30, 255, 30); + uint16_t color = GR_RGB16(30, 255, 30); int numtiles = 1; bool autotile = true; int sat_count = 2; diff --git a/netgames/roboanarchy/roboanarchy.cpp b/netgames/roboanarchy/roboanarchy.cpp index e57bfa6b..d960c2a0 100644 --- a/netgames/roboanarchy/roboanarchy.cpp +++ b/netgames/roboanarchy/roboanarchy.cpp @@ -189,7 +189,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; diff --git a/netgames/tanarchy/tanarchy.cpp b/netgames/tanarchy/tanarchy.cpp index 11c6c1c7..35f1a4cb 100644 --- a/netgames/tanarchy/tanarchy.cpp +++ b/netgames/tanarchy/tanarchy.cpp @@ -224,7 +224,7 @@ void DLLFUNCCALL DLLGameInit(int *api_func, uint8_t *all_ok, int num_teams_to_us Highlight_bmp = DLLbm_AllocBitmap(32, 32, 0); if (Highlight_bmp > BAD_BITMAP_HANDLE) { - ushort *data = DLLbm_data(Highlight_bmp, 0); + uint16_t *data = DLLbm_data(Highlight_bmp, 0); if (!data) { // bail on out of here *all_ok = 0; diff --git a/networking/networking.cpp b/networking/networking.cpp index 3c609358..d647c2ad 100644 --- a/networking/networking.cpp +++ b/networking/networking.cpp @@ -390,15 +390,15 @@ network_address My_addr; typedef struct network_checksum_packet { int sequence_number; - ushort flags; - ushort checksum; + uint16_t flags; + uint16_t checksum; uint8_t data[MAX_PACKET_SIZE]; } network_checksum_packet; // definition for a non-checksum packet typedef struct network_packet { int sequence_number; - ushort flags; + uint16_t flags; uint8_t data[MAX_PACKET_SIZE]; } network_naked_packet; @@ -457,8 +457,8 @@ static int Psnet_highest_id = 0; typedef struct { uint8_t type; // packet type uint8_t compressed; // - ushort seq; // sequence packet 0-65535 used for ACKing also - ushort data_len; // length of data + uint16_t seq; // sequence packet 0-65535 used for ACKing also + uint16_t data_len; // length of data float send_time; // Time the packet was sent, if an ACK the time the packet being ACK'd was sent. uint8_t data[NETBUFFERSIZE]; // Packet data } reliable_header; @@ -501,7 +501,7 @@ typedef struct { float last_sent; // The last time we sent a packet (used for NAGLE emulation) int waiting_packet_number; // Which packet has data in it that is waiting for the interval to send - ushort status; // Status of this connection + uint16_t status; // Status of this connection 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 @@ -731,7 +731,7 @@ void nw_SetSocketOptions(SOCKET sock) { uint16_t nw_ListenPort = 0; // Inits the sockets that the application will be using -void nw_InitSockets(ushort port) { +void nw_InitSockets(uint16_t port) { nw_ListenPort = port; // UDP/TCP socket structure @@ -890,8 +890,8 @@ uint32_t nw_GetThisIP() { return local_address.sin_addr.s_addr; } -// Calculates a unique ushort checksum for a stream of data -ushort nw_CalculateChecksum(void *vptr, int len) { +// Calculates a unique uint16_t checksum for a stream of data +uint16_t nw_CalculateChecksum(void *vptr, int len) { uint8_t *ptr = (uint8_t *)vptr; uint32_t sum1, sum2; diff --git a/physics/Collide.cpp b/physics/Collide.cpp index 1b9da9f3..dbfa9e40 100644 --- a/physics/Collide.cpp +++ b/physics/Collide.cpp @@ -1068,9 +1068,9 @@ void DoWallEffects(object *weapon, int surface_tmap) { if ((ps_rand() % 4) == 0) { int num_rubble = (ps_rand() % 3) + 1; int bm_handle = GetTextureBitmap(texp - GameTextures, 0); - ushort *data = bm_data(bm_handle, 0); + uint16_t *data = bm_data(bm_handle, 0); - ushort color = data[(bm_w(bm_handle, 0) * (bm_h(bm_handle, 0) / 2)) + (bm_w(bm_handle, 0) / 2)]; + uint16_t color = data[(bm_w(bm_handle, 0) * (bm_h(bm_handle, 0) / 2)) + (bm_w(bm_handle, 0) / 2)]; for (int i = 0; i < num_rubble; i++) { int visnum; @@ -2551,7 +2551,7 @@ void collide_generic_and_weapon(object *robotobj, object *weapon, vector *collis } if (!electrical) { light_info *li = &Weapons[weapon->id].lighting_info; - ushort color = GR_RGB16(li->red_light2 * 255, li->green_light2 * 255, li->blue_light2 * 255); + uint16_t color = GR_RGB16(li->red_light2 * 255, li->green_light2 * 255, li->blue_light2 * 255); CreateRandomLineSparks(3 + ps_rand() % 6, &weapon->pos, weapon->roomnum, color); } } diff --git a/physics/FindIntersection.cpp b/physics/FindIntersection.cpp index 2cb7a318..86bdb54c 100644 --- a/physics/FindIntersection.cpp +++ b/physics/FindIntersection.cpp @@ -922,9 +922,9 @@ static bool fvi_zero_rad; // Unordered list of rooms and terrain cells that this fvi call visited. // DAJ changed to ushorts to save memory -static ushort fvi_rooms_visited[MAX_ROOMS]; // This should be a small number (100 to 1000) -static ushort fvi_cells_visited[MAX_CELLS_VISITED]; // Use this so that we do not have to use 256x256 elements -static ushort fvi_cells_obj_visited[MAX_CELLS_VISITED]; +static uint16_t fvi_rooms_visited[MAX_ROOMS]; // This should be a small number (100 to 1000) +static uint16_t fvi_cells_visited[MAX_CELLS_VISITED]; // Use this so that we do not have to use 256x256 elements +static uint16_t fvi_cells_obj_visited[MAX_CELLS_VISITED]; // Fvi wall collision stuff static float fvi_wall_sphere_rad; diff --git a/renderer/HardwareBaseGPU.cpp b/renderer/HardwareBaseGPU.cpp index f4048d68..be4305e0 100644 --- a/renderer/HardwareBaseGPU.cpp +++ b/renderer/HardwareBaseGPU.cpp @@ -236,7 +236,7 @@ float rend_GetAspectRatio(void) { } // Given a source x,y and width,height, draws any sized bitmap into the renderer lfb -void rend_DrawLFBBitmap(int sx, int sy, int w, int h, int dx, int dy, ushort *data, int rowsize) {} +void rend_DrawLFBBitmap(int sx, int sy, int w, int h, int dx, int dy, uint16_t *data, int rowsize) {} // draws a scaled 2d bitmap to our buffer void rend_DrawScaledBitmap(int x1, int y1, int x2, int y2, int bm, float u0, float v0, float u1, float v1, int color, diff --git a/renderer/HardwareOpenGL.cpp b/renderer/HardwareOpenGL.cpp index fe529536..9addf203 100644 --- a/renderer/HardwareOpenGL.cpp +++ b/renderer/HardwareOpenGL.cpp @@ -133,8 +133,8 @@ PFNGLCLIENTACTIVETEXTUREARBPROC oglClientActiveTextureARB = NULL; PFNGLMULTITEXCOORD4FARBPROC oglMultiTexCoord4f = NULL; #endif -ushort *OpenGL_bitmap_remap = NULL; -ushort *OpenGL_lightmap_remap = NULL; +uint16_t *OpenGL_bitmap_remap = NULL; +uint16_t *OpenGL_lightmap_remap = NULL; uint8_t *OpenGL_bitmap_states = NULL; uint8_t *OpenGL_lightmap_states = NULL; @@ -142,9 +142,9 @@ uint32_t *opengl_Upload_data = NULL; uint32_t *opengl_Translate_table = NULL; uint32_t *opengl_4444_translate_table = NULL; -ushort *opengl_packed_Upload_data = NULL; -ushort *opengl_packed_Translate_table = NULL; -ushort *opengl_packed_4444_translate_table = NULL; +uint16_t *opengl_packed_Upload_data = NULL; +uint16_t *opengl_packed_Translate_table = NULL; +uint16_t *opengl_packed_4444_translate_table = NULL; extern rendering_state gpu_state; extern renderer_preferred_state gpu_preferred_state; @@ -280,9 +280,9 @@ int opengl_MakeTextureObject(int tn) { int opengl_InitCache(void) { - OpenGL_bitmap_remap = (ushort *)mem_malloc(MAX_BITMAPS * 2); + OpenGL_bitmap_remap = (uint16_t *)mem_malloc(MAX_BITMAPS * 2); ASSERT(OpenGL_bitmap_remap); - OpenGL_lightmap_remap = (ushort *)mem_malloc(MAX_LIGHTMAPS * 2); + OpenGL_lightmap_remap = (uint16_t *)mem_malloc(MAX_LIGHTMAPS * 2); ASSERT(OpenGL_lightmap_remap); OpenGL_bitmap_states = (uint8_t *)mem_malloc(MAX_BITMAPS); @@ -793,9 +793,9 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { } if (OpenGL_packed_pixels) { - opengl_packed_Upload_data = (ushort *)mem_malloc(2048 * 2048 * 2); - opengl_packed_Translate_table = (ushort *)mem_malloc(65536 * 2); - opengl_packed_4444_translate_table = (ushort *)mem_malloc(65536 * 2); + opengl_packed_Upload_data = (uint16_t *)mem_malloc(2048 * 2048 * 2); + opengl_packed_Translate_table = (uint16_t *)mem_malloc(65536 * 2); + opengl_packed_4444_translate_table = (uint16_t *)mem_malloc(65536 * 2); ASSERT(opengl_packed_Upload_data); ASSERT(opengl_packed_Translate_table); @@ -820,7 +820,7 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { b = 0x1F; #endif - ushort pix; + uint16_t pix; if (!(i & OPAQUE_FLAG)) { pix = 0; @@ -1010,7 +1010,7 @@ void opengl_Close() { // Takes our 16bit format and converts it into the memory scheme that OpenGL wants void opengl_TranslateBitmapToOpenGL(int texnum, int bm_handle, int map_type, int replace, int tn) { - ushort *bm_ptr; + uint16_t *bm_ptr; int w, h; int size; @@ -1053,11 +1053,11 @@ void opengl_TranslateBitmapToOpenGL(int texnum, int bm_handle, int map_type, int if (OpenGL_packed_pixels) { if (map_type == MAP_TYPE_LIGHTMAP) { - ushort *left_data = (ushort *)opengl_packed_Upload_data; + uint16_t *left_data = (uint16_t *)opengl_packed_Upload_data; int bm_left = 0; for (int i = 0; i < h; i++, left_data += size, bm_left += w) { - ushort *dest_data = left_data; + uint16_t *dest_data = left_data; for (int t = 0; t < w; t++) { *dest_data++ = opengl_packed_Translate_table[bm_ptr[bm_left + t]]; } @@ -1526,9 +1526,9 @@ void opengl_ChangeChunkedBitmap(int bm_handle, chunked_bitmap *chunk) { ASSERT(how_many_down > 0); // Now go through our big bitmap and partition it into pieces - ushort *src_data = bm_data(bm_handle, 0); - ushort *sdata; - ushort *ddata; + uint16_t *src_data = bm_data(bm_handle, 0); + uint16_t *sdata; + uint16_t *ddata; int shift; switch (iopt) { @@ -2145,7 +2145,7 @@ void rend_DrawSpecialLine(g3Point *p0, g3Point *p1) { // Takes a screenshot of the current frame and puts it into the handle passed std::unique_ptr rend_Screenshot() { - ushort *dest_data; + uint16_t *dest_data; uint32_t *temp_data; int total = gpu_state.screen_width * gpu_state.screen_height; @@ -2172,7 +2172,7 @@ void rend_Screenshot(int bm_handle) { ASSERT((bm_w(bm_handle, 0)) == gpu_state.screen_width); ASSERT((bm_h(bm_handle, 0)) == gpu_state.screen_height); - ushort* dest_data = bm_data(bm_handle, 0); + uint16_t* dest_data = bm_data(bm_handle, 0); for (int i = 0; i < h; i++) { for (int t = 0; t < w; t++) { diff --git a/scripts/Merc3.cpp b/scripts/Merc3.cpp index eaa36aa9..7b42e33d 100644 --- a/scripts/Merc3.cpp +++ b/scripts/Merc3.cpp @@ -2144,7 +2144,7 @@ void cEndSequenceInit() { /////////////////////////////////////////////////////////////////////////////// void do_endsequence_fx(char fx_type, int handle) { - ushort id; + uint16_t id; float time, size, speed, bloblife, blobint; int killflags = 0x60; // fireballs and breaks apart on death diff --git a/scripts/lnx/osiris_common.h b/scripts/lnx/osiris_common.h index 8eb36550..82faa6bd 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 uint8_t; typedef int8_t int8_t; -typedef uint16_t ushort; +typedef uint16_t uint16_t; typedef uint32_t uint32_t; typedef uint32_t ddgr_color; @@ -1171,7 +1171,7 @@ typedef struct { 0x008 // this timer should be auto-cancelled if object_handle_detonator dies, than the // timer auto-cancels typedef struct { - ushort flags; + uint16_t flags; int id; // an optional id you can use to store, will be passed back on EVT_TIMER signal int repeat_count; // if OTF_REPEATER is set, this is how many times to repeat the signal (every // interval). -1 for infinite. @@ -1199,7 +1199,7 @@ typedef struct { typedef struct { tOSIRISSCRIPTID my_id; - ushort id; + uint16_t id; int size; } tOSIRISMEMCHUNK; @@ -1268,7 +1268,7 @@ typedef struct { float drag, mass; // Unused - ushort unused; // was doorway_index + uint16_t unused; // was doorway_index // Weather int randval; diff --git a/scripts/lnx/osiris_import.h b/scripts/lnx/osiris_import.h index a9969de3..159e6b9c 100644 --- a/scripts/lnx/osiris_import.h +++ b/scripts/lnx/osiris_import.h @@ -356,8 +356,8 @@ OSIRISEXTERN Scrpt_CreateTimer_fp Scrpt_CreateTimer; typedef void (*MSafe_DoPowerup_fp)(msafe_struct *mstruct); OSIRISEXTERN MSafe_DoPowerup_fp MSafe_DoPowerup; -// int Obj_Create()(uint8_t type,ushort id,int roomnum,vector *pos,const matrix *orient,int parent_handle) -typedef int (*Obj_Create_fp)(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient = NULL, +// int Obj_Create()(uint8_t type,uint16_t id,int roomnum,vector *pos,const matrix *orient,int parent_handle) +typedef int (*Obj_Create_fp)(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient = NULL, int parent_handle = OBJECT_HANDLE_NONE, vector *initial_velocity = NULL); OSIRISEXTERN Obj_Create_fp Obj_Create; @@ -506,7 +506,7 @@ OSIRISEXTERN OMMS_Find_fp OMMS_Find; // Returns information about the OMMS memory given it's handle returned from the OMMS_Find() or // OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in; // Pass NULL in for those parameters you don't need information about. -typedef char (*OMMS_GetInfo_fp)(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, ushort *reference_count, +typedef char (*OMMS_GetInfo_fp)(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, uint16_t *reference_count, uint8_t *has_free_been_called); OSIRISEXTERN OMMS_GetInfo_fp OMMS_GetInfo; diff --git a/scripts/osiris_common.h b/scripts/osiris_common.h index 5790b011..34f60ce0 100644 --- a/scripts/osiris_common.h +++ b/scripts/osiris_common.h @@ -930,7 +930,7 @@ typedef int OMMSHANDLE; // define unsigned types; typedef uint8_t uint8_t; typedef int8_t int8_t; -typedef uint16_t ushort; +typedef uint16_t uint16_t; typedef uint32_t uint32_t; typedef uint32_t ddgr_color; diff --git a/scripts/osiris_import.h b/scripts/osiris_import.h index ff19ae9a..80ef486b 100644 --- a/scripts/osiris_import.h +++ b/scripts/osiris_import.h @@ -384,11 +384,11 @@ OSIRISEXTERN Scrpt_CreateTimer_fp Scrpt_CreateTimer; typedef void (*MSafe_DoPowerup_fp)(msafe_struct *mstruct); OSIRISEXTERN MSafe_DoPowerup_fp MSafe_DoPowerup; -// int Obj_Create()(uint8_t type,ushort id,int roomnum,vector *pos,const matrix *orient,int parent_handle) -typedef int (*Obj_Create_fp)(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient, int parent_handle, +// int Obj_Create()(uint8_t type,uint16_t id,int roomnum,vector *pos,const matrix *orient,int parent_handle) +typedef int (*Obj_Create_fp)(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle, vector *initial_velocity); OSIRISEXTERN Obj_Create_fp Obj_CreateFP; -static inline int Obj_Create(uint8_t type, ushort id, int roomnum, vector *pos, const matrix *orient = NULL, +static inline int Obj_Create(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient = NULL, int parent_handle = 0, vector *initial_velocity = NULL) { return Obj_CreateFP(type, id, roomnum, pos, orient, parent_handle, initial_velocity); } @@ -566,7 +566,7 @@ OSIRISEXTERN OMMS_Find_fp OMMS_Find; // Returns information about the OMMS memory given it's handle returned from the OMMS_Find() or // OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in; // Pass NULL in for those parameters you don't need information about. -typedef char (*OMMS_GetInfo_fp)(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, ushort *reference_count, +typedef char (*OMMS_GetInfo_fp)(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, uint16_t *reference_count, uint8_t *has_free_been_called); OSIRISEXTERN OMMS_GetInfo_fp OMMS_GetInfo; diff --git a/sndlib/ds3dlib.cpp b/sndlib/ds3dlib.cpp index 17a888f1..7894bad3 100644 --- a/sndlib/ds3dlib.cpp +++ b/sndlib/ds3dlib.cpp @@ -502,7 +502,7 @@ inline void sb_adjust_properties_3d(sound_buffer_info *sb, float f_volume, pos_s } } -inline void sb_adjust_properties_2d(sound_buffer_info *sb, float f_volume, float f_pan, ushort frequency) { +inline void sb_adjust_properties_2d(sound_buffer_info *sb, float f_volume, float f_pan, uint16_t frequency) { if (!ll_sound_ptr->m_in_sound_frame) ll_sound_ptr->m_pending_actions = true; diff --git a/sndlib/ds3dlib_internal.h b/sndlib/ds3dlib_internal.h index 95face51..cdba22f7 100644 --- a/sndlib/ds3dlib_internal.h +++ b/sndlib/ds3dlib_internal.h @@ -127,8 +127,8 @@ typedef struct tPSBInfo { pos_state *cur_pos; }; float reverb; - ushort freq; - ushort priority; + uint16_t freq; + uint16_t priority; bool looping; } tPSBInfo; diff --git a/sndlib/sdlsound.h b/sndlib/sdlsound.h index ef2ed4a8..647bb1c7 100644 --- a/sndlib/sdlsound.h +++ b/sndlib/sdlsound.h @@ -28,7 +28,7 @@ class sound_buffer_info; void lnxsound_SetError(int code); void lnxsound_ErrorText(const char *fmt, ...); -inline void sb_adjust_properties_2d(sound_buffer_info *sb, float f_volume, float f_pan, ushort frequency); +inline void sb_adjust_properties_2d(sound_buffer_info *sb, float f_volume, float f_pan, uint16_t frequency); class emulated_listener { public: @@ -122,7 +122,7 @@ public: friend void lnxsound_SetError(int code); friend void lnxsound_ErrorText(const char *fmt, ...); - friend inline void sb_adjust_properties_2d(sound_buffer_info *sb, float f_volume, float f_pan, ushort frequency); + friend inline void sb_adjust_properties_2d(sound_buffer_info *sb, float f_volume, float f_pan, uint16_t frequency); protected: #ifdef _DEBUG diff --git a/sndlib/ssl_lib.h b/sndlib/ssl_lib.h index 12813691..dba3e9bf 100644 --- a/sndlib/ssl_lib.h +++ b/sndlib/ssl_lib.h @@ -296,7 +296,7 @@ typedef struct { uint8_t sample_skip_interval; // Allows us to skip samples (i.e. simulate lower sampling rates) uint8_t priority; // priority of sound. - ushort m_stream_format; // passed in + uint16_t m_stream_format; // passed in // internal data. int m_samples_played; diff --git a/unzip/unzip.cpp b/unzip/unzip.cpp index 729ceb24..d69beae6 100644 --- a/unzip/unzip.cpp +++ b/unzip/unzip.cpp @@ -95,9 +95,9 @@ #define LFH_XTRALN 0x1c #define LFH_NAME 0x1e -ushort get_buffer_short(char *buf) { +uint16_t get_buffer_short(char *buf) { uint8_t *ubuf = (uint8_t *)buf; - return ((ushort)ubuf[1] << 8) | (ushort)ubuf[0]; + return ((uint16_t)ubuf[1] << 8) | (uint16_t)ubuf[0]; } uint32_t get_buffer_int(char *buf) { uint8_t *ubuf = (uint8_t *)buf; @@ -513,8 +513,8 @@ int ZIP::SeekToCompressedData(zipentry *ent) { return -1; } - ushort filename_length = get_buffer_short(buf + LFH_FNLN); - ushort extra_field_length = get_buffer_short(buf + LFH_XTRALN); + uint16_t filename_length = get_buffer_short(buf + LFH_FNLN); + uint16_t extra_field_length = get_buffer_short(buf + LFH_XTRALN); offset = ent->offset_lcl_hdr_frm_frst_disk + LFH_NAME + filename_length + extra_field_length; diff --git a/win32/WinController.cpp b/win32/WinController.cpp index 37744f1c..74df12be 100644 --- a/win32/WinController.cpp +++ b/win32/WinController.cpp @@ -1297,7 +1297,7 @@ int8_t gameWinController::get_button_controller(uint8_t btn) { // returns the controller with a pov hat int8_t gameWinController::get_pov_controller(uint8_t pov) { // start from controller 2 because 0, and 1 are reserved for keyboard and mouse - ushort pov_flag = CTF_POV << (pov); + uint16_t pov_flag = CTF_POV << (pov); for (int i = 2; i < m_NumControls; i++) if ((m_ControlList[i].flags & pov_flag) && m_ControlList[i].id != CTID_INVALID) @@ -1598,7 +1598,7 @@ const char *gameWinController::get_binding_text(ct_type type, uint8_t ctrl, uint case ctPOV2: case ctPOV3: case ctPOV4: { - ushort povpos = bind; + uint16_t povpos = bind; if (type == ctPOV) { pov_n = 0;