From cc67b9230af81d19c4ed229988a485297273b544 Mon Sep 17 00:00:00 2001 From: GravisZro Date: Thu, 23 May 2024 23:04:15 -0400 Subject: [PATCH] Replace "signed short" with "int16_t" --- Descent3/object.cpp | 2 +- Descent3/object.h | 2 +- lib/Adecode.h | 2 +- lib/linux/dyna_glide.h | 2 +- libacm/aencode.cpp | 2 +- libmve/lnxdsound.cpp | 12 ++++++------ libmve/mveasm.cpp | 6 +++--- libmve/snd8to16.h | 2 +- lnxmvelib/lnxdsound.cpp | 12 ++++++------ lnxmvelib/mveasm.cpp | 6 +++--- lnxmvelib/snd8to16.h | 2 +- netgames/dmfc/dmfcinternal.h | 2 +- netgames/dmfc/dmfcmenu.cpp | 2 +- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Descent3/object.cpp b/Descent3/object.cpp index f26cc109..0a359016 100644 --- a/Descent3/object.cpp +++ b/Descent3/object.cpp @@ -1211,7 +1211,7 @@ object Objects[MAX_OBJECTS]; tPosHistory Object_position_samples[MAX_OBJECT_POS_HISTORY]; ubyte Object_position_head; -signed short Object_map_position_history[MAX_OBJECTS]; +int16_t Object_map_position_history[MAX_OBJECTS]; short Object_map_position_free_slots[MAX_OBJECT_POS_HISTORY]; uint16_t Num_free_object_position_history; diff --git a/Descent3/object.h b/Descent3/object.h index cdce6349..7b57654a 100644 --- a/Descent3/object.h +++ b/Descent3/object.h @@ -825,7 +825,7 @@ typedef struct { } tPosHistory; extern tPosHistory Object_position_samples[MAX_OBJECT_POS_HISTORY]; extern ubyte Object_position_head; -extern signed short Object_map_position_history[MAX_OBJECTS]; +extern int16_t Object_map_position_history[MAX_OBJECTS]; extern float Last_position_history_update[MAX_POSITION_HISTORY]; // last gametime the positions were updated void ObjInitPositionHistory(object *obj); void ObjFreePositionHistory(object *obj); diff --git a/lib/Adecode.h b/lib/Adecode.h index 597a384a..9146e0d5 100644 --- a/lib/Adecode.h +++ b/lib/Adecode.h @@ -23,7 +23,7 @@ namespace AudioDecoder { typedef uint32_t uint32_t; typedef int32_t int32_t; typedef uint16_t uint16; -typedef signed short sint16; +typedef int16_t sint16; typedef uint8_t uint8_t; typedef int8_t int8_t; diff --git a/lib/linux/dyna_glide.h b/lib/linux/dyna_glide.h index 191d8f63..ac7343b7 100644 --- a/lib/linux/dyna_glide.h +++ b/lib/linux/dyna_glide.h @@ -171,7 +171,7 @@ typedef int8_t FxI8; typedef uint16_t FxU16; -typedef signed short FxI16; +typedef int16_t FxI16; typedef int32_t FxI32; diff --git a/libacm/aencode.cpp b/libacm/aencode.cpp index 0b16140f..6c2bcb12 100644 --- a/libacm/aencode.cpp +++ b/libacm/aencode.cpp @@ -26,7 +26,7 @@ typedef uint32_t uint32_t; typedef int32_t int32_t; typedef uint16_t uint16; -typedef signed short sint16; +typedef int16_t sint16; typedef uint8_t uint8_t; typedef int8_t int8_t; diff --git a/libmve/lnxdsound.cpp b/libmve/lnxdsound.cpp index 0f20ae06..0cc133a9 100644 --- a/libmve/lnxdsound.cpp +++ b/libmve/lnxdsound.cpp @@ -522,7 +522,7 @@ static bool StartupSoundSystem(LnxSoundDevice *dev) { static void ShutdownSoundSystem(void) { SDL_CloseAudio(); } static inline void GetValues(const LnxSoundBuffer *dsb, uint8_t *buf, uint32_t *fl, uint32_t *fr) { - signed short *bufs = (signed short *)buf; + int16_t *bufs = (int16_t *)buf; // 8 bit stereo if ((dsb->wfx.wBitsPerSample == 8) && dsb->wfx.nChannels == 2) { @@ -555,7 +555,7 @@ static inline void GetValues(const LnxSoundBuffer *dsb, uint8_t *buf, uint32_t * } static inline void SetValues(uint8_t *buf, uint32_t fl, uint32_t fr) { - signed short *bufs = (signed short *)buf; + int16_t *bufs = (int16_t *)buf; // 8 bit stereo if ((LnxBuffers[0]->wfx.wBitsPerSample == 8) && (LnxBuffers[0]->wfx.nChannels == 2)) { @@ -588,7 +588,7 @@ static inline void SetValues(uint8_t *buf, uint32_t fl, uint32_t fr) { static void LinuxSoundMixWithVolume(LnxSoundBuffer *dsb, uint8_t *buf, uint32_t len) { uint32_t i, inc = (LnxBuffers[0]->wfx.wBitsPerSample >> 3); uint8_t *bpc = buf; - signed short *bps = (signed short *)buf; + int16_t *bps = (int16_t *)buf; if ((!(dsb->lbdesc.dwFlags & LNXSND_CAPS_CTRLPAN) || (dsb->pan == 0)) && (!(dsb->lbdesc.dwFlags & LNXSND_CAPS_CTRLVOLUME) || (dsb->volume == 0))) @@ -680,7 +680,7 @@ static uint32_t LinuxSoundMixInMainBuffer(LnxSoundBuffer *dsb, int len) { uint32_t i, ilen, advance = (LnxBuffers[0]->wfx.wBitsPerSample >> 3); uint8_t *buf, *ibuf, *obuf; int32_t temp, field; - signed short *ibufs, *obufs; + int16_t *ibufs, *obufs; if (!(dsb->flags & LNXSND_LOOPING)) { temp = DoMulDiv(LnxBuffers[0]->wfx.nAvgBytesPerSec, dsb->buffer_len, dsb->bps) - @@ -716,8 +716,8 @@ static uint32_t LinuxSoundMixInMainBuffer(LnxSoundBuffer *dsb, int len) { obuf = LnxBuffers[0]->buffer + LnxBuffers[0]->play_cursor; for (i = 0; i < len; i += advance) { - obufs = (signed short *)obuf; - ibufs = (signed short *)ibuf; + obufs = (int16_t *)obuf; + ibufs = (int16_t *)ibuf; if (LnxBuffers[0]->wfx.wBitsPerSample == 16) { field = *ibufs; field += *obufs; diff --git a/libmve/mveasm.cpp b/libmve/mveasm.cpp index a7b92417..3f3fdb98 100644 --- a/libmve/mveasm.cpp +++ b/libmve/mveasm.cpp @@ -38,7 +38,7 @@ extern unsigned nf_hicolor; extern uint16_t nf_trans16_lo[256]; extern uint16_t nf_trans16_hi[256]; -extern signed short snd_8to16[256]; +extern int16_t snd_8to16[256]; void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, const unsigned x, const unsigned y, const unsigned w, const unsigned h); void nfHPkDecomp(uint8_t *ops, uint8_t *comp, int x, int y, int w, int h); @@ -154,8 +154,8 @@ int32_t nfpk_ShiftY[256]; // Constant tables // 8-bit -8:7 x nf_width + -8:7 -signed short nfpk_ShiftP1[256]; -signed short nfpk_ShiftP2[256]; +int16_t nfpk_ShiftP1[256]; +int16_t nfpk_ShiftP2[256]; // Constant tables // mov eax, ebx/ecx diff --git a/libmve/snd8to16.h b/libmve/snd8to16.h index bcc0e1d6..962bd66e 100644 --- a/libmve/snd8to16.h +++ b/libmve/snd8to16.h @@ -32,7 +32,7 @@ */ #define S short -signed short snd_8to16[256] = { +int16_t snd_8to16[256] = { (S)0, (S)1, (S)2, (S)3, (S)4, (S)5, (S)6, (S)7, (S)(S)8, (S)9, (S)10, (S)11, (S)12, (S)13, (S)14, (S)15, (S)(S)16, (S)17, diff --git a/lnxmvelib/lnxdsound.cpp b/lnxmvelib/lnxdsound.cpp index c6c57b2f..d6f39f30 100644 --- a/lnxmvelib/lnxdsound.cpp +++ b/lnxmvelib/lnxdsound.cpp @@ -506,7 +506,7 @@ static bool StartupSoundSystem(LnxSoundDevice *dev) { static void ShutdownSoundSystem(void) { SDL_CloseAudio(); } static inline void GetValues(const LnxSoundBuffer *dsb, uint8_t *buf, uint32_t *fl, uint32_t *fr) { - signed short *bufs = (signed short *)buf; + int16_t *bufs = (int16_t *)buf; // 8 bit stereo if ((dsb->wfx.wBitsPerSample == 8) && dsb->wfx.nChannels == 2) { @@ -539,7 +539,7 @@ static inline void GetValues(const LnxSoundBuffer *dsb, uint8_t *buf, uint32_t * } static inline void SetValues(uint8_t *buf, uint32_t fl, uint32_t fr) { - signed short *bufs = (signed short *)buf; + int16_t *bufs = (int16_t *)buf; // 8 bit stereo if ((LnxBuffers[0]->wfx.wBitsPerSample == 8) && (LnxBuffers[0]->wfx.nChannels == 2)) { @@ -572,7 +572,7 @@ static inline void SetValues(uint8_t *buf, uint32_t fl, uint32_t fr) { static void LinuxSoundMixWithVolume(LnxSoundBuffer *dsb, uint8_t *buf, uint32_t len) { uint32_t i, inc = (LnxBuffers[0]->wfx.wBitsPerSample >> 3); uint8_t *bpc = buf; - signed short *bps = (signed short *)buf; + int16_t *bps = (int16_t *)buf; if ((!(dsb->lbdesc.dwFlags & LNXSND_CAPS_CTRLPAN) || (dsb->pan == 0)) && (!(dsb->lbdesc.dwFlags & LNXSND_CAPS_CTRLVOLUME) || (dsb->volume == 0))) @@ -664,7 +664,7 @@ static uint32_t LinuxSoundMixInMainBuffer(LnxSoundBuffer *dsb, int len) { uint32_t i, ilen, advance = (LnxBuffers[0]->wfx.wBitsPerSample >> 3); uint8_t *buf, *ibuf, *obuf; int32_t temp, field; - signed short *ibufs, *obufs; + int16_t *ibufs, *obufs; if (!(dsb->flags & LNXSND_LOOPING)) { temp = DoMulDiv(LnxBuffers[0]->wfx.nAvgBytesPerSec, dsb->buffer_len, dsb->bps) - @@ -700,8 +700,8 @@ static uint32_t LinuxSoundMixInMainBuffer(LnxSoundBuffer *dsb, int len) { obuf = LnxBuffers[0]->buffer + LnxBuffers[0]->play_cursor; for (i = 0; i < len; i += advance) { - obufs = (signed short *)obuf; - ibufs = (signed short *)ibuf; + obufs = (int16_t *)obuf; + ibufs = (int16_t *)ibuf; if (LnxBuffers[0]->wfx.wBitsPerSample == 16) { field = *ibufs; field += *obufs; diff --git a/lnxmvelib/mveasm.cpp b/lnxmvelib/mveasm.cpp index 582d2cec..7afc314e 100644 --- a/lnxmvelib/mveasm.cpp +++ b/lnxmvelib/mveasm.cpp @@ -38,7 +38,7 @@ extern unsigned nf_width; // wqty * SWIDTH extern unsigned nf_new_line; // width - SWIDTH extern unsigned nf_back_right; // (SHEIGHT-1)*width -extern signed short snd_8to16[256]; +extern int16_t snd_8to16[256]; void nfHPkDecomp(uint8_t *ops, uint8_t *comp, int x, int y, int w, int h); void nfPkConfig(void); unsigned sndDecompM16(uint16_t *dst, const uint8_t *src, unsigned len, unsigned prev); @@ -152,8 +152,8 @@ int32_t nfpk_ShiftY[256]; // Constant tables // 8-bit -8:7 x nf_width + -8:7 -signed short nfpk_ShiftP1[256]; -signed short nfpk_ShiftP2[256]; +int16_t nfpk_ShiftP1[256]; +int16_t nfpk_ShiftP2[256]; // Constant tables // mov eax, ebx/ecx diff --git a/lnxmvelib/snd8to16.h b/lnxmvelib/snd8to16.h index 678498a4..b9482c43 100644 --- a/lnxmvelib/snd8to16.h +++ b/lnxmvelib/snd8to16.h @@ -32,7 +32,7 @@ */ #pragma warning(disable : 4245) -signed short snd_8to16[256] = { +int16_t snd_8to16[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, diff --git a/netgames/dmfc/dmfcinternal.h b/netgames/dmfc/dmfcinternal.h index d6a97293..5fe7d1dc 100644 --- a/netgames/dmfc/dmfcinternal.h +++ b/netgames/dmfc/dmfcinternal.h @@ -2114,7 +2114,7 @@ private: int *Camera_view_mode; char DatabaseRegisteredName[MAX_DBNAME_SIZE]; - signed short players_in_game[MAX_PLAYER_RECORDS]; + int16_t players_in_game[MAX_PLAYER_RECORDS]; // DMFCBase::InitializeForLevel // diff --git a/netgames/dmfc/dmfcmenu.cpp b/netgames/dmfc/dmfcmenu.cpp index 92987cd2..e9629407 100644 --- a/netgames/dmfc/dmfcmenu.cpp +++ b/netgames/dmfc/dmfcmenu.cpp @@ -512,7 +512,7 @@ void MenuItem::Draw(int x, int y, int height, int bmp, float *not_used) { #define FLASHRATE 700.0 // alphas per second - signed short a = m_Alpha; + int16_t a = m_Alpha; int units = (int)FLASHRATE * (*basethis->Frametime); // do alphaing effect