From 8ab562ef13ef0c8eefd68df2c002ad5f7632bb48 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 8 Mar 2017 18:47:52 +0100 Subject: [PATCH] - the fourth. --- src/actor.h | 16 +- src/b_bot.h | 8 +- src/b_game.cpp | 8 +- src/basictypes.h | 2 +- src/c_bind.cpp | 4 +- src/c_cvars.cpp | 8 +- src/c_cvars.h | 10 +- src/c_dispatch.cpp | 12 +- src/colormatcher.h | 4 +- src/compatibility.cpp | 2 +- src/ct_chat.cpp | 6 +- src/d_dehacked.cpp | 18 +-- src/d_event.h | 4 +- src/d_main.cpp | 4 +- src/d_net.cpp | 86 +++++------ src/d_net.h | 16 +- src/d_netinfo.cpp | 20 +-- src/d_player.h | 24 +-- src/d_protocol.cpp | 74 ++++----- src/d_protocol.h | 50 +++--- src/decallib.cpp | 4 +- src/dobject.cpp | 10 +- src/dobjtype.cpp | 30 ++-- src/dobjtype.h | 6 +- src/doomdata.h | 78 +++++----- src/doomstat.h | 2 +- src/doomtype.h | 12 +- src/dthinker.cpp | 2 +- src/dthinker.h | 2 +- src/edata.cpp | 10 +- src/files.h | 20 +-- src/g_game.cpp | 46 +++--- src/g_level.h | 22 +-- src/g_levellocals.h | 20 +-- src/g_mapinfo.cpp | 6 +- src/g_skill.cpp | 2 +- src/gameconfigfile.cpp | 2 +- src/gameconfigfile.h | 2 +- src/gi.h | 16 +- src/gl/data/gl_data.cpp | 2 +- src/gl/models/gl_models_md2.cpp | 2 +- src/hu_stuff.h | 4 +- src/i_net.cpp | 22 +-- src/info.h | 16 +- src/m_cheat.cpp | 2 +- src/m_crc32.h | 8 +- src/m_fixed.h | 4 +- src/m_joy.cpp | 6 +- src/m_joy.h | 2 +- src/m_misc.cpp | 24 +-- src/m_misc.h | 4 +- src/m_png.cpp | 126 +++++++-------- src/m_png.h | 20 +-- src/m_random.cpp | 16 +- src/m_random.h | 26 ++-- src/md5.cpp | 28 ++-- src/md5.h | 12 +- src/memarena.cpp | 4 +- src/mus2midi.cpp | 40 ++--- src/nodebuild.cpp | 52 +++---- src/nodebuild.h | 64 ++++---- src/nodebuild_extract.cpp | 22 +-- src/nodebuild_gl.cpp | 28 ++-- src/nodebuild_utility.cpp | 8 +- src/oplsynth/dosbox/opl.cpp | 2 +- src/oplsynth/mlopl.cpp | 2 +- src/oplsynth/mlopl_io.cpp | 4 +- src/oplsynth/music_opl_mididevice.cpp | 2 +- src/oplsynth/music_opldumper_mididevice.cpp | 24 +-- src/oplsynth/muslib.h | 36 ++--- src/oplsynth/nukedopl3.h | 2 +- src/oplsynth/opl_mus_player.cpp | 18 +-- src/posix/cocoa/i_video.mm | 6 +- src/posix/sdl/i_input.cpp | 16 +- src/posix/sdl/sdlvideo.cpp | 2 +- src/r_data/r_translate.cpp | 12 +- src/r_data/r_translate.h | 6 +- src/r_data/renderstyle.cpp | 2 +- src/r_data/sprites.cpp | 4 +- src/r_data/sprites.h | 10 +- src/r_utility.cpp | 4 +- src/r_utility.h | 2 +- src/s_advsound.cpp | 6 +- src/s_environment.cpp | 2 +- src/s_sndseq.cpp | 12 +- src/s_sound.cpp | 16 +- src/s_sound.h | 16 +- src/sc_man.cpp | 2 +- src/sc_man.h | 2 +- src/st_stuff.cpp | 162 ++++++++++---------- src/stringtable.cpp | 14 +- src/stringtable.h | 2 +- src/teaminfo.cpp | 2 +- src/tflags.h | 2 +- src/v_blend.cpp | 2 +- src/v_font.cpp | 160 +++++++++---------- src/v_font.h | 16 +- src/v_palette.cpp | 44 +++--- src/v_palette.h | 16 +- src/v_pfx.cpp | 84 +++++----- src/v_pfx.h | 22 +-- src/v_text.cpp | 14 +- src/v_text.h | 6 +- src/w_wad.cpp | 64 ++++---- src/w_wad.h | 32 ++-- src/w_zip.h | 6 +- src/xlat/parse_xlat.cpp | 8 +- 107 files changed, 1038 insertions(+), 1038 deletions(-) diff --git a/src/actor.h b/src/actor.h index 119214398b..080813bf5d 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1054,7 +1054,7 @@ public: int weaponspecial; // Special info for weapons. int health; - BYTE movedir; // 0-7 + uint8_t movedir; // 0-7 SBYTE visdir; SWORD movecount; // when 0, select a new dir SWORD strafecount; // for MF3_AVOIDMELEE @@ -1072,8 +1072,8 @@ public: DVector3 SpawnPoint; // For nightmare respawn WORD SpawnAngle; int StartHealth; - BYTE WeaveIndexXY; // Separated from special2 because it's used by globally accessible functions. - BYTE WeaveIndexZ; + uint8_t WeaveIndexXY; // Separated from special2 because it's used by globally accessible functions. + uint8_t WeaveIndexZ; int skillrespawncount; int TIDtoHate; // TID of things to hate (0 if none) FNameNoInit Species; // For monster families @@ -1090,8 +1090,8 @@ public: AActor *inext, **iprev;// Links to other mobjs in same bucket TObjPtr goal; // Monster's goal if not chasing anything int waterlevel; // 0=none, 1=feet, 2=waist, 3=eyes - BYTE boomwaterlevel; // splash information for non-swimmable water sectors - BYTE MinMissileChance;// [RH] If a random # is > than this, then missile attack. + uint8_t boomwaterlevel; // splash information for non-swimmable water sectors + uint8_t MinMissileChance;// [RH] If a random # is > than this, then missile attack. SBYTE LastLookPlayerNumber;// Player number last looked for (if TIDtoHate == 0) ActorBounceFlags BounceFlags; // which bouncing type? DWORD SpawnFlags; // Increased to DWORD because of Doom 64 @@ -1139,9 +1139,9 @@ public: TObjPtr Inventory; // [RH] This actor's inventory DWORD InventoryID; // A unique ID to keep track of inventory items - BYTE smokecounter; - BYTE FloatBobPhase; - BYTE FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc) + uint8_t smokecounter; + uint8_t FloatBobPhase; + uint8_t FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc) PalEntry BloodColor; DWORD BloodTranslation; diff --git a/src/b_bot.h b/src/b_bot.h index df4ba0a32a..fd3ad3c94a 100644 --- a/src/b_bot.h +++ b/src/b_bot.h @@ -91,7 +91,7 @@ public: void Init (); void End(); bool SpawnBot (const char *name, int color = NOCOLOR); - void TryAddBot (BYTE **stream, int player); + void TryAddBot (uint8_t **stream, int player); void RemoveAllBots (bool fromlist); bool LoadBots (); void ForgetBots (); @@ -110,8 +110,8 @@ public: bool IsDangerous (sector_t *sec); TArray getspawned; //Array of bots (their names) which should be spawned when starting a game. - BYTE freeze; //Game in freeze mode. - BYTE changefreeze; //Game wants to change freeze mode. + uint8_t freeze; //Game in freeze mode. + uint8_t changefreeze; //Game wants to change freeze mode. int botnum; botinfo_t *botinfo; int spawn_tries; @@ -124,7 +124,7 @@ public: private: //(b_game.cpp) - bool DoAddBot (BYTE *info, botskill_t skill); + bool DoAddBot (uint8_t *info, botskill_t skill); protected: bool ctf; diff --git a/src/b_game.cpp b/src/b_game.cpp index 38fbfafcbc..c388c0538f 100644 --- a/src/b_game.cpp +++ b/src/b_game.cpp @@ -309,7 +309,7 @@ bool FCajunMaster::SpawnBot (const char *name, int color) return true; } -void FCajunMaster::TryAddBot (BYTE **stream, int player) +void FCajunMaster::TryAddBot (uint8_t **stream, int player) { int botshift = ReadByte (stream); char *info = ReadString (stream); @@ -332,7 +332,7 @@ void FCajunMaster::TryAddBot (BYTE **stream, int player) } } - if (DoAddBot ((BYTE *)info, skill)) + if (DoAddBot ((uint8_t *)info, skill)) { //Increment this. botnum++; @@ -353,7 +353,7 @@ void FCajunMaster::TryAddBot (BYTE **stream, int player) delete[] info; } -bool FCajunMaster::DoAddBot (BYTE *info, botskill_t skill) +bool FCajunMaster::DoAddBot (uint8_t *info, botskill_t skill) { int bnum; @@ -564,7 +564,7 @@ bool FCajunMaster::LoadBots () case BOTCFG_TEAM: { char teamstr[16]; - BYTE teamnum; + uint8_t teamnum; sc.MustGetString (); if (IsNum (sc.String)) diff --git a/src/basictypes.h b/src/basictypes.h index acb499c0d4..aceb4752cb 100644 --- a/src/basictypes.h +++ b/src/basictypes.h @@ -39,7 +39,7 @@ typedef struct _GUID DWORD Data1; WORD Data2; WORD Data3; - BYTE Data4[8]; + uint8_t Data4[8]; } GUID; #endif diff --git a/src/c_bind.cpp b/src/c_bind.cpp index c21e200d38..8d27c38bd3 100644 --- a/src/c_bind.cpp +++ b/src/c_bind.cpp @@ -158,7 +158,7 @@ FKeyBindings DoubleBindings; FKeyBindings AutomapBindings; static unsigned int DClickTime[NUM_KEYS]; -static BYTE DClicked[(NUM_KEYS+7)/8]; +static uint8_t DClicked[(NUM_KEYS+7)/8]; //============================================================================= // @@ -724,7 +724,7 @@ bool C_DoKey (event_t *ev, FKeyBindings *binds, FKeyBindings *doublebinds) FString binding; bool dclick; int dclickspot; - BYTE dclickmask; + uint8_t dclickmask; unsigned int nowtime; if (ev->type != EV_KeyDown && ev->type != EV_KeyUp) diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index 6430d95ad5..fecb156c3a 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -481,9 +481,9 @@ UCVarValue FBaseCVar::FromFloat (float value, ECVarType type) return ret; } -static BYTE HexToByte (const char *hex) +static uint8_t HexToByte (const char *hex) { - BYTE v = 0; + uint8_t v = 0; for (int i = 0; i < 2; ++i) { v <<= 4; @@ -1370,7 +1370,7 @@ void FilterCompactCVars (TArray &cvars, DWORD filter) } } -void C_WriteCVars (BYTE **demo_p, DWORD filter, bool compact) +void C_WriteCVars (uint8_t **demo_p, DWORD filter, bool compact) { FString dump = C_GetMassCVarString(filter, compact); size_t dumplen = dump.Len() + 1; // include terminating \0 @@ -1408,7 +1408,7 @@ FString C_GetMassCVarString (DWORD filter, bool compact) return dump; } -void C_ReadCVars (BYTE **demo_p) +void C_ReadCVars (uint8_t **demo_p) { char *ptr = *((char **)demo_p); char *breakpt; diff --git a/src/c_cvars.h b/src/c_cvars.h index 98dc71915c..221097f347 100644 --- a/src/c_cvars.h +++ b/src/c_cvars.h @@ -160,7 +160,7 @@ private: static bool m_DoNoSet; friend FString C_GetMassCVarString (uint32 filter, bool compact); - friend void C_ReadCVars (BYTE **demo_p); + friend void C_ReadCVars (uint8_t **demo_p); friend void C_BackupCVars (void); friend FBaseCVar *FindCVar (const char *var_name, FBaseCVar **prev); friend FBaseCVar *FindCVarSub (const char *var_name, int namelen); @@ -178,10 +178,10 @@ FString C_GetMassCVarString (uint32 filter, bool compact=false); // Writes all cvars that could effect demo sync to *demo_p. These are // cvars that have either CVAR_SERVERINFO or CVAR_DEMOSAVE set. -void C_WriteCVars (BYTE **demo_p, uint32 filter, bool compact=false); +void C_WriteCVars (uint8_t **demo_p, uint32 filter, bool compact=false); // Read all cvars from *demo_p and set them appropriately. -void C_ReadCVars (BYTE **demo_p); +void C_ReadCVars (uint8_t **demo_p); // Backup demo cvars. Called before a demo starts playing to save all // cvars the demo might change. @@ -431,8 +431,8 @@ extern int cvar_defflags; FBaseCVar *cvar_set (const char *var_name, const char *value); FBaseCVar *cvar_forceset (const char *var_name, const char *value); -inline FBaseCVar *cvar_set (const char *var_name, const BYTE *value) { return cvar_set (var_name, (const char *)value); } -inline FBaseCVar *cvar_forceset (const char *var_name, const BYTE *value) { return cvar_forceset (var_name, (const char *)value); } +inline FBaseCVar *cvar_set (const char *var_name, const uint8_t *value) { return cvar_set (var_name, (const char *)value); } +inline FBaseCVar *cvar_forceset (const char *var_name, const uint8_t *value) { return cvar_forceset (var_name, (const char *)value); } diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 4b3dc85c60..198460b62f 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -297,8 +297,8 @@ static int ListActionCommands (const char *pattern) #endif #if !defined (get16bits) -#define get16bits(d) ((((DWORD)(((const BYTE *)(d))[1])) << 8)\ - +(DWORD)(((const BYTE *)(d))[0]) ) +#define get16bits(d) ((((DWORD)(((const uint8_t *)(d))[1])) << 8)\ + +(DWORD)(((const uint8_t *)(d))[0]) ) #endif DWORD SuperFastHash (const char *data, size_t len) @@ -352,8 +352,8 @@ DWORD SuperFastHash (const char *data, size_t len) /* A modified version to do a case-insensitive hash */ #undef get16bits -#define get16bits(d) ((((DWORD)tolower(((const BYTE *)(d))[1])) << 8)\ - +(DWORD)tolower(((const BYTE *)(d))[0]) ) +#define get16bits(d) ((((DWORD)tolower(((const uint8_t *)(d))[1])) << 8)\ + +(DWORD)tolower(((const uint8_t *)(d))[0]) ) DWORD SuperFastHashI (const char *data, size_t len) { @@ -467,7 +467,7 @@ bool FButtonStatus::PressKey (int keynum) } Keys[open] = keynum; } - BYTE wasdown = bDown; + uint8_t wasdown = bDown; bDown = bWentDown = true; // Returns true if this key caused the button to go down. return !wasdown; @@ -476,7 +476,7 @@ bool FButtonStatus::PressKey (int keynum) bool FButtonStatus::ReleaseKey (int keynum) { int i, numdown, match; - BYTE wasdown = bDown; + uint8_t wasdown = bDown; keynum &= KEY_DBLCLICKED-1; diff --git a/src/colormatcher.h b/src/colormatcher.h index 5fbe162de0..edf456b510 100644 --- a/src/colormatcher.h +++ b/src/colormatcher.h @@ -42,8 +42,8 @@ public: FColorMatcher (const FColorMatcher &other); void SetPalette (const DWORD *palette); - BYTE Pick (int r, int g, int b); - BYTE Pick (PalEntry pe) + uint8_t Pick (int r, int g, int b); + uint8_t Pick (PalEntry pe) { return Pick(pe.r, pe.g, pe.b); } diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 37531d40fa..1737b237d4 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -637,7 +637,7 @@ void SetCompatibilityParams() CCMD (mapchecksum) { MapData *map; - BYTE cksum[16]; + uint8_t cksum[16]; if (argv.argc() < 2) { diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index 9d54a5991a..98e95cdde4 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -61,11 +61,11 @@ int chatmodeon; static void CT_ClearChatMessage (); static void CT_AddChar (char c); static void CT_BackSpace (); -static void ShoveChatStr (const char *str, BYTE who); +static void ShoveChatStr (const char *str, uint8_t who); static bool DoSubstitution (FString &out, const char *in); static int len; -static BYTE ChatQueue[QUEUESIZE]; +static uint8_t ChatQueue[QUEUESIZE]; CVAR (String, chatmacro1, "I'm ready to kick butt!", CVAR_ARCHIVE) CVAR (String, chatmacro2, "I'm OK.", CVAR_ARCHIVE) @@ -353,7 +353,7 @@ static void CT_ClearChatMessage () // //=========================================================================== -static void ShoveChatStr (const char *str, BYTE who) +static void ShoveChatStr (const char *str, uint8_t who) { // Don't send empty messages if (str == NULL || str[0] == '\0') diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 7e2b22e277..139678400e 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -129,8 +129,8 @@ static TArray InfoNames; struct BitName { char Name[20]; - BYTE Bit; - BYTE WhichFlags; + uint8_t Bit; + uint8_t WhichFlags; }; static TArray BitNames; @@ -139,7 +139,7 @@ static TArray BitNames; struct StyleName { char Name[20]; - BYTE Num; + uint8_t Num; }; static TArray StyleNames; @@ -160,7 +160,7 @@ struct CodePointerAlias { FName name; char alias[20]; - BYTE params; + uint8_t params; }; static TArray MBFCodePointers; @@ -391,7 +391,7 @@ static bool HandleKey (const struct Key *keys, void *structure, const char *key, keys++; if (keys->name) { - *((int *)(((BYTE *)structure) + keys->offset)) = value; + *((int *)(((uint8_t *)structure) + keys->offset)) = value; return false; } @@ -842,7 +842,7 @@ static int PatchThing (int thingy) int result; AActor *info; - BYTE dummy[sizeof(AActor)]; + uint8_t dummy[sizeof(AActor)]; bool hadHeight = false; bool hadTranslucency = false; bool hadStyle = false; @@ -1605,7 +1605,7 @@ static int PatchWeapon (int weapNum) { int result; PClassActor *type = NULL; - BYTE dummy[sizeof(AWeapon)]; + uint8_t dummy[sizeof(AWeapon)]; AWeapon *info = (AWeapon *)&dummy; bool patchedStates = false; FStateDefinitions statedef; @@ -1917,7 +1917,7 @@ static int PatchMisc (int dummy) else if (a > 0) { GetDefaultByName (types[i])->ColorVar(NAME_BlendColor) = PalEntry( - BYTE(clamp(a,0.f,1.f)*255.f), + uint8_t(clamp(a,0.f,1.f)*255.f), clamp(r,0,255), clamp(g,0,255), clamp(b,0,255)); @@ -2592,7 +2592,7 @@ static bool DoDehPatch() return true; } -static inline bool CompareLabel (const char *want, const BYTE *have) +static inline bool CompareLabel (const char *want, const uint8_t *have) { return *(DWORD *)want == *(DWORD *)have; } diff --git a/src/d_event.h b/src/d_event.h index 962286b8f2..2152ce0d9c 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -45,8 +45,8 @@ enum EGenericEvent // Event structure. struct event_t { - BYTE type; - BYTE subtype; + uint8_t type; + uint8_t subtype; SWORD data1; // keys / mouse/joystick buttons SWORD data2; SWORD data3; diff --git a/src/d_main.cpp b/src/d_main.cpp index ca143a0ecb..63727c1786 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -388,14 +388,14 @@ CUSTOM_CVAR (Int, dmflags, 0, CVAR_SERVERINFO) // If nofov is set, force everybody to the arbitrator's FOV. if ((self & DF_NO_FOV) && consoleplayer == Net_Arbitrator) { - BYTE fov; + uint8_t fov; Net_WriteByte (DEM_FOV); // If the game is started with DF_NO_FOV set, the arbitrator's // DesiredFOV will not be set when this callback is run, so // be sure not to transmit a 0 FOV. - fov = (BYTE)players[consoleplayer].DesiredFOV; + fov = (uint8_t)players[consoleplayer].DesiredFOV; if (fov == 0) { fov = 90; diff --git a/src/d_net.cpp b/src/d_net.cpp index 1dfa171166..221d67ba8f 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -72,7 +72,7 @@ EXTERN_CVAR (Int, autosavecount) //#define SIMULATEERRORS (RAND_MAX/3) #define SIMULATEERRORS 0 -extern BYTE *demo_p; // [RH] Special "ticcmds" get recorded in demos +extern uint8_t *demo_p; // [RH] Special "ticcmds" get recorded in demos extern FString savedescription; extern FString savegamefile; @@ -82,7 +82,7 @@ doomcom_t doomcom; #define netbuffer (doomcom.data) enum { NET_PeerToPeer, NET_PacketServer }; -BYTE NetMode = NET_PeerToPeer; +uint8_t NetMode = NET_PeerToPeer; @@ -127,11 +127,11 @@ void D_ProcessEvents (void); void G_BuildTiccmd (ticcmd_t *cmd); void D_DoAdvanceDemo (void); -static void SendSetup (DWORD playersdetected[MAXNETNODES], BYTE gotsetup[MAXNETNODES], int len); -static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, int always); +static void SendSetup (DWORD playersdetected[MAXNETNODES], uint8_t gotsetup[MAXNETNODES], int len); +static void RunScript(uint8_t **stream, APlayerPawn *pawn, int snum, int argn, int always); int reboundpacket; -BYTE reboundstore[MAX_MSGLEN]; +uint8_t reboundstore[MAX_MSGLEN]; int frameon; int frameskip[4]; @@ -185,9 +185,9 @@ static TArray OutBuffer; // [RH] Special "ticcmds" get stored in here static struct TicSpecial { - BYTE *streams[BACKUPTICS]; + uint8_t *streams[BACKUPTICS]; size_t used[BACKUPTICS]; - BYTE *streamptr; + uint8_t *streamptr; size_t streamoffs; size_t specialsize; int lastmaketic; @@ -205,7 +205,7 @@ static struct TicSpecial for (i = 0; i < BACKUPTICS; i++) { - streams[i] = (BYTE *)M_Malloc (256); + streams[i] = (uint8_t *)M_Malloc (256); used[i] = 0; } okay = true; @@ -237,7 +237,7 @@ static struct TicSpecial DPrintf (DMSG_NOTIFY, "Expanding special size to %zu\n", specialsize); for (i = 0; i < BACKUPTICS; i++) - streams[i] = (BYTE *)M_Realloc (streams[i], specialsize); + streams[i] = (uint8_t *)M_Realloc (streams[i], specialsize); streamptr = streams[(maketic/ticdup)%BACKUPTICS] + streamoffs; } @@ -265,7 +265,7 @@ static struct TicSpecial streamoffs = 0; } - TicSpecial &operator << (BYTE it) + TicSpecial &operator << (uint8_t it) { if (streamptr) { @@ -399,7 +399,7 @@ int NetbufferSize () return k + 3 * count * numtics; } - BYTE *skipper = &netbuffer[k]; + uint8_t *skipper = &netbuffer[k]; if ((netbuffer[0] & NCMD_EXIT) == 0) { while (count-- > 0) @@ -446,13 +446,13 @@ void HSendPacket (int node, int len) { fprintf (debugfile,"%i/%i send %i = SETUP [%3i]", gametic, maketic, node, len); for (i = 0; i < len; i++) - fprintf (debugfile," %2x", ((BYTE *)netbuffer)[i]); + fprintf (debugfile," %2x", ((uint8_t *)netbuffer)[i]); } else if (netbuffer[0] & NCMD_EXIT) { fprintf (debugfile,"%i/%i send %i = EXIT [%3i]", gametic, maketic, node, len); for (i = 0; i < len; i++) - fprintf (debugfile," %2x", ((BYTE *)netbuffer)[i]); + fprintf (debugfile," %2x", ((uint8_t *)netbuffer)[i]); } else { @@ -480,7 +480,7 @@ void HSendPacket (int node, int len) numtics, realretrans, len); for (i = 0; i < len; i++) - fprintf (debugfile, "%c%2x", i==k?'|':' ', ((BYTE *)netbuffer)[i]); + fprintf (debugfile, "%c%2x", i==k?'|':' ', ((uint8_t *)netbuffer)[i]); } fprintf (debugfile, " [[ "); for (i = 0; i < doomcom.numnodes; ++i) @@ -613,14 +613,14 @@ bool HGetPacket (void) { fprintf (debugfile,"%i/%i get %i = SETUP [%3i]", gametic, maketic, doomcom.remotenode, doomcom.datalength); for (i = 0; i < doomcom.datalength; i++) - fprintf (debugfile, " %2x", ((BYTE *)netbuffer)[i]); + fprintf (debugfile, " %2x", ((uint8_t *)netbuffer)[i]); fprintf (debugfile, "\n"); } else if (netbuffer[0] & NCMD_EXIT) { fprintf (debugfile,"%i/%i get %i = EXIT [%3i]", gametic, maketic, doomcom.remotenode, doomcom.datalength); for (i = 0; i < doomcom.datalength; i++) - fprintf (debugfile, " %2x", ((BYTE *)netbuffer)[i]); + fprintf (debugfile, " %2x", ((uint8_t *)netbuffer)[i]); fprintf (debugfile, "\n"); } else { @@ -648,7 +648,7 @@ bool HGetPacket (void) numtics, realretrans, doomcom.datalength); for (i = 0; i < doomcom.datalength; i++) - fprintf (debugfile, "%c%2x", i==k?'|':' ', ((BYTE *)netbuffer)[i]); + fprintf (debugfile, "%c%2x", i==k?'|':' ', ((uint8_t *)netbuffer)[i]); if (numtics) fprintf (debugfile, " <<%4x>>\n", consistancy[playerfornode[doomcom.remotenode]][nettics[doomcom.remotenode]%BACKUPTICS] & 0xFFFF); @@ -740,7 +740,7 @@ void PlayerIsGone (int netnode, int netconsole) G_CheckDemoStatus (); //WriteByte (DEM_DROPPLAYER, &demo_p); - //WriteByte ((BYTE)netconsole, &demo_p); + //WriteByte ((uint8_t)netconsole, &demo_p); } } @@ -757,7 +757,7 @@ void GetPackets (void) int numtics; int retransmitfrom; int k; - BYTE playerbytes[MAXNETNODES]; + uint8_t playerbytes[MAXNETNODES]; int numplayers; while ( HGetPacket() ) @@ -792,7 +792,7 @@ void GetPackets (void) PlayerIsGone (netnode, netconsole); if (NetMode == NET_PacketServer) { - BYTE *foo = &netbuffer[2]; + uint8_t *foo = &netbuffer[2]; for (int i = 0; i < MAXPLAYERS; ++i) { if (playeringame[i]) @@ -908,7 +908,7 @@ void GetPackets (void) // update command store from the packet { - BYTE *start; + uint8_t *start; int i, tics; remoteresend[netnode] = false; @@ -942,7 +942,7 @@ void NetUpdate (void) int newtics; int i,j; int realstart; - BYTE *cmddata; + uint8_t *cmddata; bool resendOnly; GC::CheckGC(); @@ -1120,7 +1120,7 @@ void NetUpdate (void) for (i = 0; i < doomcom.numnodes; i++) { - BYTE playerbytes[MAXPLAYERS]; + uint8_t playerbytes[MAXPLAYERS]; if (!nodeingame[i]) { @@ -1265,7 +1265,7 @@ void NetUpdate (void) else if (i != 0) { int len; - BYTE *spec; + uint8_t *spec; WriteWord (netcmds[playerbytes[l]][start].consistancy, &cmddata); spec = NetSpecs[playerbytes[l]][start].GetData (&len); @@ -1406,14 +1406,14 @@ void NetUpdate (void) struct ArbitrateData { DWORD playersdetected[MAXNETNODES]; - BYTE gotsetup[MAXNETNODES]; + uint8_t gotsetup[MAXNETNODES]; }; bool DoArbitrate (void *userdata) { ArbitrateData *data = (ArbitrateData *)userdata; char *s; - BYTE *stream; + uint8_t *stream; int version; int node; int i, j; @@ -1537,7 +1537,7 @@ bool DoArbitrate (void *userdata) if (consoleplayer == Net_Arbitrator) { netbuffer[0] = NCMD_SETUP+2; - netbuffer[1] = (BYTE)doomcom.ticdup; + netbuffer[1] = (uint8_t)doomcom.ticdup; netbuffer[2] = NetMode; stream = &netbuffer[3]; WriteString (startmap, &stream); @@ -1631,7 +1631,7 @@ void D_ArbitrateNetStart (void) StartScreen->NetDone(); } -static void SendSetup (DWORD playersdetected[MAXNETNODES], BYTE gotsetup[MAXNETNODES], int len) +static void SendSetup (DWORD playersdetected[MAXNETNODES], uint8_t gotsetup[MAXNETNODES], int len) { if (consoleplayer != Net_Arbitrator) { @@ -1769,7 +1769,7 @@ void D_QuitNetGame (void) k = 2; if (NetMode == NET_PacketServer && consoleplayer == Net_Arbitrator) { - BYTE *foo = &netbuffer[2]; + uint8_t *foo = &netbuffer[2]; // Let the new arbitrator know what resendto counts to use @@ -1998,7 +1998,7 @@ void Net_NewMakeTic (void) specials.NewMakeTic (); } -void Net_WriteByte (BYTE it) +void Net_WriteByte (uint8_t it) { specials << it; } @@ -2023,7 +2023,7 @@ void Net_WriteString (const char *it) specials << it; } -void Net_WriteBytes (const BYTE *block, int len) +void Net_WriteBytes (const uint8_t *block, int len) { while (len--) specials << *block++; @@ -2051,12 +2051,12 @@ FDynamicBuffer::~FDynamicBuffer () m_Len = m_BufferLen = 0; } -void FDynamicBuffer::SetData (const BYTE *data, int len) +void FDynamicBuffer::SetData (const uint8_t *data, int len) { if (len > m_BufferLen) { m_BufferLen = (len + 255) & ~255; - m_Data = (BYTE *)M_Realloc (m_Data, m_BufferLen); + m_Data = (uint8_t *)M_Realloc (m_Data, m_BufferLen); } if (data != NULL) { @@ -2069,7 +2069,7 @@ void FDynamicBuffer::SetData (const BYTE *data, int len) } } -BYTE *FDynamicBuffer::GetData (int *len) +uint8_t *FDynamicBuffer::GetData (int *len) { if (len) *len = m_Len; @@ -2128,9 +2128,9 @@ static int RemoveClass(const PClass *cls) // [RH] Execute a special "ticcmd". The type byte should // have already been read, and the stream is positioned // at the beginning of the command's actual data. -void Net_DoCommand (int type, BYTE **stream, int player) +void Net_DoCommand (int type, uint8_t **stream, int player) { - BYTE pos = 0; + uint8_t pos = 0; char *s = NULL; int i; @@ -2139,7 +2139,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) case DEM_SAY: { const char *name = players[player].userinfo.GetName(); - BYTE who = ReadByte (stream); + uint8_t who = ReadByte (stream); s = ReadString (stream); CleanseString (s); @@ -2309,7 +2309,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) PClassActor *typeinfo; int angle = 0; SWORD tid = 0; - BYTE special = 0; + uint8_t special = 0; int args[5]; s = ReadString (stream); @@ -2540,7 +2540,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) case DEM_ADDCONTROLLER: { - BYTE playernum = ReadByte (stream); + uint8_t playernum = ReadByte (stream); players[playernum].settings_controller = true; if (consoleplayer == playernum || consoleplayer == Net_Arbitrator) @@ -2550,7 +2550,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) case DEM_DELCONTROLLER: { - BYTE playernum = ReadByte (stream); + uint8_t playernum = ReadByte (stream); players[playernum].settings_controller = false; if (consoleplayer == playernum || consoleplayer == Net_Arbitrator) @@ -2691,7 +2691,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) } // Used by DEM_RUNSCRIPT, DEM_RUNSCRIPT2, and DEM_RUNNAMEDSCRIPT -static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, int always) +static void RunScript(uint8_t **stream, APlayerPawn *pawn, int snum, int argn, int always) { int arg[4] = { 0, 0, 0, 0 }; int i; @@ -2707,9 +2707,9 @@ static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, int P_StartScript(pawn, NULL, snum, level.MapName, arg, MIN(countof(arg), argn), ACS_NET | always); } -void Net_SkipCommand (int type, BYTE **stream) +void Net_SkipCommand (int type, uint8_t **stream) { - BYTE t; + uint8_t t; size_t skip; switch (type) diff --git a/src/d_net.h b/src/d_net.h index e1e4360a2c..45559b86aa 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -83,7 +83,7 @@ struct doomcom_t #endif // packet data to be sent - BYTE data[MAX_MSGLEN]; + uint8_t data[MAX_MSGLEN]; }; @@ -94,11 +94,11 @@ public: FDynamicBuffer (); ~FDynamicBuffer (); - void SetData (const BYTE *data, int len); - BYTE *GetData (int *len = NULL); + void SetData (const uint8_t *data, int len); + uint8_t *GetData (int *len = NULL); private: - BYTE *m_Data; + uint8_t *m_Data; int m_Len, m_BufferLen; }; @@ -119,15 +119,15 @@ void Net_CheckLastReceived(int); // [RH] Functions for making and using special "ticcmds" void Net_NewMakeTic (); -void Net_WriteByte (BYTE); +void Net_WriteByte (uint8_t); void Net_WriteWord (short); void Net_WriteLong (int); void Net_WriteFloat (float); void Net_WriteString (const char *); -void Net_WriteBytes (const BYTE *, int len); +void Net_WriteBytes (const uint8_t *, int len); -void Net_DoCommand (int type, BYTE **stream, int player); -void Net_SkipCommand (int type, BYTE **stream); +void Net_DoCommand (int type, uint8_t **stream, int player); +void Net_SkipCommand (int type, uint8_t **stream); void Net_ClearBuffers (); diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 8a856b44b2..5c4b249788 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -228,7 +228,7 @@ void D_PickRandomTeam (int player) { static char teamline[8] = "\\team\\X"; - BYTE *foo = (BYTE *)teamline; + uint8_t *foo = (uint8_t *)teamline; teamline[6] = (char)D_PickRandomTeam() + '0'; D_ReadUserInfoStrings (player, &foo, teamplay); } @@ -538,7 +538,7 @@ void D_UserInfoChanged (FBaseCVar *cvar) Net_WriteString (foo); } -static const char *SetServerVar (char *name, ECVarType type, BYTE **stream, bool singlebit) +static const char *SetServerVar (char *name, ECVarType type, uint8_t **stream, bool singlebit) { FBaseCVar *var = FindCVar (name, NULL); UCVarValue value; @@ -619,8 +619,8 @@ void D_SendServerInfoChange (const FBaseCVar *cvar, UCVarValue value, ECVarType namelen = strlen (cvar->GetName ()); Net_WriteByte (DEM_SINFCHANGED); - Net_WriteByte ((BYTE)(namelen | (type << 6))); - Net_WriteBytes ((BYTE *)cvar->GetName (), (int)namelen); + Net_WriteByte ((uint8_t)(namelen | (type << 6))); + Net_WriteBytes ((uint8_t *)cvar->GetName (), (int)namelen); switch (type) { case CVAR_Bool: Net_WriteByte (value.Bool); break; @@ -638,12 +638,12 @@ void D_SendServerFlagChange (const FBaseCVar *cvar, int bitnum, bool set) namelen = (int)strlen (cvar->GetName ()); Net_WriteByte (DEM_SINFCHANGEDXOR); - Net_WriteByte ((BYTE)namelen); - Net_WriteBytes ((BYTE *)cvar->GetName (), namelen); - Net_WriteByte (BYTE(bitnum | (set << 5))); + Net_WriteByte ((uint8_t)namelen); + Net_WriteBytes ((uint8_t *)cvar->GetName (), namelen); + Net_WriteByte (uint8_t(bitnum | (set << 5))); } -void D_DoServerInfoChange (BYTE **stream, bool singlebit) +void D_DoServerInfoChange (uint8_t **stream, bool singlebit) { const char *value; char name[64]; @@ -679,7 +679,7 @@ static int namesortfunc(const void *a, const void *b) return stricmp(name1->GetChars(), name2->GetChars()); } -void D_WriteUserInfoStrings (int pnum, BYTE **stream, bool compact) +void D_WriteUserInfoStrings (int pnum, uint8_t **stream, bool compact) { if (pnum >= MAXPLAYERS) { @@ -741,7 +741,7 @@ void D_WriteUserInfoStrings (int pnum, BYTE **stream, bool compact) *(*stream)++ = '\0'; } -void D_ReadUserInfoStrings (int pnum, BYTE **stream, bool update) +void D_ReadUserInfoStrings (int pnum, uint8_t **stream, bool update) { userinfo_t *info = &players[pnum].userinfo; TArray compact_names(info->CountUsed()); diff --git a/src/d_player.h b/src/d_player.h index 2b1b386a97..d94553454b 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -51,18 +51,18 @@ struct FPlayerColorSet { struct ExtraRange { - BYTE RangeStart, RangeEnd; // colors to remap - BYTE FirstColor, LastColor; // colors to map to + uint8_t RangeStart, RangeEnd; // colors to remap + uint8_t FirstColor, LastColor; // colors to map to }; FName Name; // Name of this color int Lump; // Lump to read the translation from, otherwise use next 2 fields - BYTE FirstColor, LastColor; // Describes the range of colors to use for the translation + uint8_t FirstColor, LastColor; // Describes the range of colors to use for the translation - BYTE RepresentativeColor; // A palette entry representative of this translation, + uint8_t RepresentativeColor; // A palette entry representative of this translation, // for map arrows and status bar backgrounds and such - BYTE NumExtraRanges; + uint8_t NumExtraRanges; ExtraRange Extra[6]; }; @@ -162,8 +162,8 @@ public: FNameNoInit Portrait; FNameNoInit Slot[10]; double HexenArmor[5]; - BYTE ColorRangeStart; // Skin color range - BYTE ColorRangeEnd; + uint8_t ColorRangeStart; // Skin color range + uint8_t ColorRangeEnd; }; @@ -383,7 +383,7 @@ public: void SendPitchLimits() const; APlayerPawn *mo; - BYTE playerstate; + uint8_t playerstate; ticcmd_t cmd; usercmd_t original_cmd; DWORD original_oldbuttons; @@ -406,7 +406,7 @@ public: DVector2 Vel; bool centering; - BYTE turnticks; + uint8_t turnticks; bool attackdown; @@ -416,13 +416,13 @@ public: // is used during levels int inventorytics; - BYTE CurrentPlayerClass; // class # for this player instance + uint8_t CurrentPlayerClass; // class # for this player instance int frags[MAXPLAYERS]; // kills of other players int fragcount; // [RH] Cumulative frags for this player int lastkilltime; // [RH] For multikills - BYTE multicount; - BYTE spreecount; // [RH] Keep track of killing sprees + uint8_t multicount; + uint8_t spreecount; // [RH] Keep track of killing sprees WORD WeaponState; AWeapon *ReadyWeapon; diff --git a/src/d_protocol.cpp b/src/d_protocol.cpp index 6d7200f8c1..61a709630f 100644 --- a/src/d_protocol.cpp +++ b/src/d_protocol.cpp @@ -41,7 +41,7 @@ #include "serializer.h" -char *ReadString (BYTE **stream) +char *ReadString (uint8_t **stream) { char *string = *((char **)stream); @@ -49,35 +49,35 @@ char *ReadString (BYTE **stream) return copystring (string); } -const char *ReadStringConst(BYTE **stream) +const char *ReadStringConst(uint8_t **stream) { const char *string = *((const char **)stream); *stream += strlen (string) + 1; return string; } -int ReadByte (BYTE **stream) +int ReadByte (uint8_t **stream) { - BYTE v = **stream; + uint8_t v = **stream; *stream += 1; return v; } -int ReadWord (BYTE **stream) +int ReadWord (uint8_t **stream) { short v = (((*stream)[0]) << 8) | (((*stream)[1])); *stream += 2; return v; } -int ReadLong (BYTE **stream) +int ReadLong (uint8_t **stream) { int v = (((*stream)[0]) << 24) | (((*stream)[1]) << 16) | (((*stream)[2]) << 8) | (((*stream)[3])); *stream += 4; return v; } -float ReadFloat (BYTE **stream) +float ReadFloat (uint8_t **stream) { union { @@ -88,7 +88,7 @@ float ReadFloat (BYTE **stream) return fakeint.f; } -void WriteString (const char *string, BYTE **stream) +void WriteString (const char *string, uint8_t **stream) { char *p = *((char **)stream); @@ -97,24 +97,24 @@ void WriteString (const char *string, BYTE **stream) } *p++ = 0; - *stream = (BYTE *)p; + *stream = (uint8_t *)p; } -void WriteByte (BYTE v, BYTE **stream) +void WriteByte (uint8_t v, uint8_t **stream) { **stream = v; *stream += 1; } -void WriteWord (short v, BYTE **stream) +void WriteWord (short v, uint8_t **stream) { (*stream)[0] = v >> 8; (*stream)[1] = v & 255; *stream += 2; } -void WriteLong (int v, BYTE **stream) +void WriteLong (int v, uint8_t **stream) { (*stream)[0] = v >> 24; (*stream)[1] = (v >> 16) & 255; @@ -123,7 +123,7 @@ void WriteLong (int v, BYTE **stream) *stream += 4; } -void WriteFloat (float v, BYTE **stream) +void WriteFloat (float v, uint8_t **stream) { union { @@ -135,10 +135,10 @@ void WriteFloat (float v, BYTE **stream) } // Returns the number of bytes read -int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream) +int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream) { - BYTE *start = *stream; - BYTE flags; + uint8_t *start = *stream; + uint8_t flags; if (basis != NULL) { @@ -160,7 +160,7 @@ int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream) if (flags & UCMDF_BUTTONS) { DWORD buttons = ucmd->buttons; - BYTE in = ReadByte(stream); + uint8_t in = ReadByte(stream); buttons = (buttons & ~0x7F) | (in & 0x7F); if (in & 0x80) @@ -198,11 +198,11 @@ int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream) } // Returns the number of bytes written -int PackUserCmd (const usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream) +int PackUserCmd (const usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream) { - BYTE flags = 0; - BYTE *temp = *stream; - BYTE *start = *stream; + uint8_t flags = 0; + uint8_t *temp = *stream; + uint8_t *start = *stream; usercmd_t blank; DWORD buttons_changed; @@ -217,10 +217,10 @@ int PackUserCmd (const usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream) buttons_changed = ucmd->buttons ^ basis->buttons; if (buttons_changed != 0) { - BYTE bytes[4] = { BYTE(ucmd->buttons & 0x7F), - BYTE((ucmd->buttons >> 7) & 0x7F), - BYTE((ucmd->buttons >> 14) & 0x7F), - BYTE((ucmd->buttons >> 21) & 0xFF) }; + uint8_t bytes[4] = { uint8_t(ucmd->buttons & 0x7F), + uint8_t((ucmd->buttons >> 7) & 0x7F), + uint8_t((ucmd->buttons >> 14) & 0x7F), + uint8_t((ucmd->buttons >> 21) & 0xFF) }; flags |= UCMDF_BUTTONS; @@ -318,7 +318,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, usercmd_t &cmd, usercm return arc; } -int WriteUserCmdMessage (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream) +int WriteUserCmdMessage (usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream) { if (basis == NULL) { @@ -352,10 +352,10 @@ int WriteUserCmdMessage (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream) } -int SkipTicCmd (BYTE **stream, int count) +int SkipTicCmd (uint8_t **stream, int count) { int i, skip; - BYTE *flow = *stream; + uint8_t *flow = *stream; for (i = count; i > 0; i--) { @@ -364,7 +364,7 @@ int SkipTicCmd (BYTE **stream, int count) flow += 2; // Skip consistancy marker while (moreticdata) { - BYTE type = *flow++; + uint8_t type = *flow++; if (type == DEM_USERCMD) { @@ -410,10 +410,10 @@ int SkipTicCmd (BYTE **stream, int count) #include extern short consistancy[MAXPLAYERS][BACKUPTICS]; -void ReadTicCmd (BYTE **stream, int player, int tic) +void ReadTicCmd (uint8_t **stream, int player, int tic) { int type; - BYTE *start; + uint8_t *start; ticcmd_t *tcmd; int ticmod = tic % BACKUPTICS; @@ -451,7 +451,7 @@ void ReadTicCmd (BYTE **stream, int player, int tic) void RunNetSpecs (int player, int buf) { - BYTE *stream; + uint8_t *stream; int len; if (gametic % ticdup == 0) @@ -459,7 +459,7 @@ void RunNetSpecs (int player, int buf) stream = NetSpecs[player][buf].GetData (&len); if (stream) { - BYTE *end = stream + len; + uint8_t *end = stream + len; while (stream < end) { int type = ReadByte (&stream); @@ -471,11 +471,11 @@ void RunNetSpecs (int player, int buf) } } -BYTE *lenspot; +uint8_t *lenspot; // Write the header of an IFF chunk and leave space // for the length field. -void StartChunk (int id, BYTE **stream) +void StartChunk (int id, uint8_t **stream) { WriteLong (id, stream); lenspot = *stream; @@ -484,7 +484,7 @@ void StartChunk (int id, BYTE **stream) // Write the length field for the chunk and insert // pad byte if the chunk is odd-sized. -void FinishChunk (BYTE **stream) +void FinishChunk (uint8_t **stream) { int len; @@ -501,7 +501,7 @@ void FinishChunk (BYTE **stream) // Skip past an unknown chunk. *stream should be // pointing to the chunk's length field. -void SkipChunk (BYTE **stream) +void SkipChunk (uint8_t **stream) { int len; diff --git a/src/d_protocol.h b/src/d_protocol.h index f95e3fc816..f2e33463f9 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -52,13 +52,13 @@ struct zdemoheader_s { - BYTE demovermajor; - BYTE demoverminor; - BYTE minvermajor; - BYTE minverminor; - BYTE map[8]; + uint8_t demovermajor; + uint8_t demoverminor; + uint8_t minvermajor; + uint8_t minverminor; + uint8_t map[8]; unsigned int rngseed; - BYTE consoleplayer; + uint8_t consoleplayer; }; struct usercmd_t @@ -221,30 +221,30 @@ enum ECheatCommand CHT_GOD2 }; -void StartChunk (int id, BYTE **stream); -void FinishChunk (BYTE **stream); -void SkipChunk (BYTE **stream); +void StartChunk (int id, uint8_t **stream); +void FinishChunk (uint8_t **stream); +void SkipChunk (uint8_t **stream); -int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream); -int PackUserCmd (const usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream); -int WriteUserCmdMessage (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream); +int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream); +int PackUserCmd (const usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream); +int WriteUserCmdMessage (usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream); struct ticcmd_t; -int SkipTicCmd (BYTE **stream, int count); -void ReadTicCmd (BYTE **stream, int player, int tic); +int SkipTicCmd (uint8_t **stream, int count); +void ReadTicCmd (uint8_t **stream, int player, int tic); void RunNetSpecs (int player, int buf); -int ReadByte (BYTE **stream); -int ReadWord (BYTE **stream); -int ReadLong (BYTE **stream); -float ReadFloat (BYTE **stream); -char *ReadString (BYTE **stream); -const char *ReadStringConst(BYTE **stream); -void WriteByte (BYTE val, BYTE **stream); -void WriteWord (short val, BYTE **stream); -void WriteLong (int val, BYTE **stream); -void WriteFloat (float val, BYTE **stream); -void WriteString (const char *string, BYTE **stream); +int ReadByte (uint8_t **stream); +int ReadWord (uint8_t **stream); +int ReadLong (uint8_t **stream); +float ReadFloat (uint8_t **stream); +char *ReadString (uint8_t **stream); +const char *ReadStringConst(uint8_t **stream); +void WriteByte (uint8_t val, uint8_t **stream); +void WriteWord (short val, uint8_t **stream); +void WriteLong (int val, uint8_t **stream); +void WriteFloat (float val, uint8_t **stream); +void WriteString (const char *string, uint8_t **stream); #endif //__D_PROTOCOL_H__ diff --git a/src/decallib.cpp b/src/decallib.cpp index 511e2231f9..e352e90c24 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -54,7 +54,7 @@ FDecalLib DecalLibrary; static double ReadScale (FScanner &sc); -static TArray DecalTranslations; +static TArray DecalTranslations; // A decal group holds multiple decals and returns one randomly // when GetDecal() is called. @@ -1073,7 +1073,7 @@ FDecalLib::FTranslation::FTranslation (DWORD start, DWORD end) { DWORD ri, gi, bi, rs, gs, bs; PalEntry *first, *last; - BYTE *table; + uint8_t *table; unsigned int i, tablei; StartColor = start; diff --git a/src/dobject.cpp b/src/dobject.cpp index 1485096aea..456305f215 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -404,7 +404,7 @@ size_t DObject::PropagateMark() } while (*offsets != ~(size_t)0) { - GC::Mark((DObject **)((BYTE *)this + *offsets)); + GC::Mark((DObject **)((uint8_t *)this + *offsets)); offsets++; } @@ -416,7 +416,7 @@ size_t DObject::PropagateMark() } while (*offsets != ~(size_t)0) { - auto aray = (TArray*)((BYTE *)this + *offsets); + auto aray = (TArray*)((uint8_t *)this + *offsets); for (auto &p : *aray) { GC::Mark(&p); @@ -447,9 +447,9 @@ size_t DObject::PointerSubstitution (DObject *old, DObject *notOld) } while (*offsets != ~(size_t)0) { - if (*(DObject **)((BYTE *)this + *offsets) == old) + if (*(DObject **)((uint8_t *)this + *offsets) == old) { - *(DObject **)((BYTE *)this + *offsets) = notOld; + *(DObject **)((uint8_t *)this + *offsets) = notOld; changed++; } offsets++; @@ -463,7 +463,7 @@ size_t DObject::PointerSubstitution (DObject *old, DObject *notOld) } while (*offsets != ~(size_t)0) { - auto aray = (TArray*)((BYTE *)this + *offsets); + auto aray = (TArray*)((uint8_t *)this + *offsets); for (auto &p : *aray) { if (p == old) diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 2aecd8e99b..8375742fcf 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -637,7 +637,7 @@ void PInt::SetValue(void *addr, int val) } else if (Size == 1) { - *(BYTE *)addr = val; + *(uint8_t *)addr = val; } else if (Size == 2) { @@ -673,7 +673,7 @@ int PInt::GetValueInt(void *addr) const } else if (Size == 1) { - return Unsigned ? *(BYTE *)addr : *(SBYTE *)addr; + return Unsigned ? *(uint8_t *)addr : *(SBYTE *)addr; } else if (Size == 2) { @@ -1035,7 +1035,7 @@ bool PString::ReadValue(FSerializer &ar, const char *key, void *addr) const void PString::SetDefaultValue(void *base, unsigned offset, TArray *special) const { - if (base != nullptr) new((BYTE *)base + offset) FString; + if (base != nullptr) new((uint8_t *)base + offset) FString; if (special != nullptr) { special->Push(std::make_pair(this, offset)); @@ -1715,7 +1715,7 @@ void PArray::WriteValue(FSerializer &ar, const char *key,const void *addr) const { if (ar.BeginArray(key)) { - const BYTE *addrb = (const BYTE *)addr; + const uint8_t *addrb = (const uint8_t *)addr; for (unsigned i = 0; i < ElementCount; ++i) { ElementType->WriteValue(ar, nullptr, addrb); @@ -1738,7 +1738,7 @@ bool PArray::ReadValue(FSerializer &ar, const char *key, void *addr) const bool readsomething = false; unsigned count = ar.ArraySize(); unsigned loop = MIN(count, ElementCount); - BYTE *addrb = (BYTE *)addr; + uint8_t *addrb = (uint8_t *)addr; for(unsigned i=0;iReadValue(ar, nullptr, addrb); @@ -2036,7 +2036,7 @@ void PDynArray::WriteValue(FSerializer &ar, const char *key, const void *addr) c { if (ar.BeginArray(key)) { - const BYTE *addrb = (const BYTE *)aray->Array; + const uint8_t *addrb = (const uint8_t *)aray->Array; for (unsigned i = 0; i < aray->Count; ++i) { ElementType->WriteValue(ar, nullptr, addrb); @@ -2068,7 +2068,7 @@ bool PDynArray::ReadValue(FSerializer &ar, const char *key, void *addr) const memset(aray->Array, 0, blocksize); aray->Most = aray->Count = count; - BYTE *addrb = (BYTE *)aray->Array; + uint8_t *addrb = (uint8_t *)aray->Array; for (unsigned i = 0; iFlags & (VARF_Transient|VARF_Meta))) { - field->Type->WriteValue(ar, field->SymbolName.GetChars(), (const BYTE *)addr + field->Offset); + field->Type->WriteValue(ar, field->SymbolName.GetChars(), (const uint8_t *)addr + field->Offset); } } } @@ -2357,7 +2357,7 @@ bool PStruct::ReadFields(FSerializer &ar, void *addr) const else { readsomething |= static_cast(sym)->Type->ReadValue(ar, nullptr, - (BYTE *)addr + static_cast(sym)->Offset); + (uint8_t *)addr + static_cast(sym)->Offset); } } return readsomething || !foundsomething; @@ -3073,7 +3073,7 @@ PClass *PClass::FindClass (FName zaname) DObject *PClass::CreateNew() { - BYTE *mem = (BYTE *)M_Malloc (Size); + uint8_t *mem = (uint8_t *)M_Malloc (Size); assert (mem != nullptr); // Set this object's defaults before constructing it. @@ -3136,7 +3136,7 @@ void PClass::DestroySpecials(void *addr) ParentClass->DestroySpecials(addr); for (auto tao : SpecialInits) { - tao.first->DestroyValue((BYTE *)addr + tao.second); + tao.first->DestroyValue((uint8_t *)addr + tao.second); } } @@ -3172,7 +3172,7 @@ void PClass::InitializeDefaults() if (IsKindOf(RUNTIME_CLASS(PClassActor))) { assert(Defaults == nullptr); - Defaults = (BYTE *)M_Malloc(Size); + Defaults = (uint8_t *)M_Malloc(Size); // run the constructor on the defaults to set the vtbl pointer which is needed to run class-aware functions on them. // Temporarily setting bSerialOverride prevents linking into the thinker chains. @@ -3203,7 +3203,7 @@ void PClass::InitializeDefaults() assert(MetaSize >= ParentClass->MetaSize); if (MetaSize != 0) { - Meta = (BYTE*)M_Malloc(MetaSize); + Meta = (uint8_t*)M_Malloc(MetaSize); // Copy the defaults from the parent but leave the DObject part alone because it contains important data. if (ParentClass->Meta != nullptr) @@ -3372,7 +3372,7 @@ PField *PClass::AddField(FName name, PType *type, DWORD flags) // setting up any defaults for any class. if (field != nullptr && !(flags & VARF_Native) && Defaults != nullptr) { - Defaults = (BYTE *)M_Realloc(Defaults, Size); + Defaults = (uint8_t *)M_Realloc(Defaults, Size); memset(Defaults + oldsize, 0, Size - oldsize); } return field; @@ -3387,7 +3387,7 @@ PField *PClass::AddField(FName name, PType *type, DWORD flags) // setting up any defaults for any class. if (field != nullptr && !(flags & VARF_Native) && Meta != nullptr) { - Meta = (BYTE *)M_Realloc(Meta, MetaSize); + Meta = (uint8_t *)M_Realloc(Meta, MetaSize); memset(Meta + oldsize, 0, MetaSize - oldsize); } return field; diff --git a/src/dobjtype.h b/src/dobjtype.h index 0ec96b304f..16acfdcf93 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -92,7 +92,7 @@ public: bool MemberOnly = false; // type may only be used as a struct/class member but not as a local variable or function argument. FString mDescriptiveName; VersionInfo mVersion = { 0,0,0 }; - BYTE loadOp, storeOp, moveOp, RegType, RegCount; + uint8_t loadOp, storeOp, moveOp, RegType, RegCount; PType(unsigned int size = 1, unsigned int align = 1); virtual ~PType(); @@ -601,8 +601,8 @@ public: const size_t *Pointers; // object pointers defined by this class *only* const size_t *FlatPointers; // object pointers defined by this class and all its superclasses; not initialized by default const size_t *ArrayPointers; // dynamic arrays containing object pointers. - BYTE *Defaults; - BYTE *Meta; // Per-class static script data + uint8_t *Defaults; + uint8_t *Meta; // Per-class static script data unsigned MetaSize; bool bRuntimeClass; // class was defined at run-time, not compile-time bool bExported; // This type has been declared in a script diff --git a/src/doomdata.h b/src/doomdata.h index 0c1fb4a970..39df8d84d1 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -71,19 +71,19 @@ enum // A single Vertex. struct mapvertex_t { - short x, y; + int16_t x, y; }; // A SideDef, defining the visual appearance of a wall, // by setting textures and offsets. struct mapsidedef_t { - short textureoffset; - short rowoffset; + int16_t textureoffset; + int16_t rowoffset; char toptexture[8]; char bottomtexture[8]; char midtexture[8]; - short sector; // Front sector, towards viewer. + int16_t sector; // Front sector, towards viewer. }; struct intmapsidedef_t @@ -97,24 +97,24 @@ struct intmapsidedef_t // A LineDef, as used for editing, and as input to the BSP builder. struct maplinedef_t { - WORD v1; - WORD v2; - WORD flags; - short special; - short tag; - WORD sidenum[2]; // sidenum[1] will be -1 if one sided + uint16_t v1; + uint16_t v2; + uint16_t flags; + int16_t special; + int16_t tag; + uint16_t sidenum[2]; // sidenum[1] will be -1 if one sided } ; // [RH] Hexen-compatible LineDef. struct maplinedef2_t { - WORD v1; - WORD v2; - WORD flags; - BYTE special; - BYTE args[5]; - WORD sidenum[2]; + uint16_t v1; + uint16_t v2; + uint16_t flags; + uint8_t special; + uint8_t args[5]; + uint16_t sidenum[2]; } ; @@ -221,26 +221,26 @@ static inline int GET_SPAC (int flags) // Sector definition, from editing struct mapsector_t { - short floorheight; - short ceilingheight; + int16_t floorheight; + int16_t ceilingheight; char floorpic[8]; char ceilingpic[8]; - short lightlevel; - short special; - short tag; + int16_t lightlevel; + int16_t special; + int16_t tag; }; // SubSector, as generated by BSP struct mapsubsector_t { - WORD numsegs; - WORD firstseg; // index of first one, segs are stored sequentially + uint16_t numsegs; + uint16_t firstseg; // index of first one, segs are stored sequentially }; #pragma pack(1) struct mapsubsector4_t { - WORD numsegs; + uint16_t numsegs; DWORD firstseg; // index of first one, segs are stored sequentially }; #pragma pack() @@ -249,10 +249,10 @@ struct mapsubsector4_t // using partition lines selected by BSP builder. struct mapseg_t { - WORD v1; - WORD v2; + uint16_t v1; + uint16_t v2; SWORD angle; - WORD linedef; + uint16_t linedef; SWORD side; SWORD offset; @@ -265,7 +265,7 @@ struct mapseg4_t int32_t v1; int32_t v2; SWORD angle; - WORD linedef; + uint16_t linedef; SWORD side; SWORD offset; @@ -290,7 +290,7 @@ struct mapnode_t SWORD bbox[2][4]; // bounding box for each child // If NF_SUBSECTOR is or'ed in, it's a subsector, // else it's a node of another subtree. - WORD children[2]; + uint16_t children[2]; DWORD Child(int num) { return LittleShort(children[num]); } }; @@ -334,9 +334,9 @@ struct mapthinghexen_t SWORD z; SWORD angle; SWORD type; - WORD flags; - BYTE special; - BYTE args[5]; + uint16_t flags; + uint8_t special; + uint8_t args[5]; }; struct FDoomEdEntry; @@ -346,10 +346,10 @@ struct FMapThing { int thingid; DVector3 pos; - short angle; - WORD SkillFilter; - WORD ClassFilter; - short EdNum; + int16_t angle; + uint16_t SkillFilter; + uint16_t ClassFilter; + int16_t EdNum; FDoomEdEntry *info; DWORD flags; int special; @@ -361,8 +361,8 @@ struct FMapThing DVector2 Scale; double Health; int score; - short pitch; - short roll; + int16_t pitch; + int16_t roll; DWORD RenderStyle; int FloatbobPhase; }; @@ -426,7 +426,7 @@ enum EMapThingFlags struct FPlayerStart { DVector3 pos; - short angle, type; + int16_t angle, type; FPlayerStart() { } FPlayerStart(const FMapThing *mthing, int pnum) diff --git a/src/doomstat.h b/src/doomstat.h index ee7b7d2101..a73f134478 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -234,7 +234,7 @@ struct DehInfo int KFAArmor; int KFAAC; char PlayerSprite[5]; - BYTE ExplosionStyle; + uint8_t ExplosionStyle; double ExplosionAlpha; int NoAutofreeze; int BFGCells; diff --git a/src/doomtype.h b/src/doomtype.h index fda7d00fa7..b2540d69f0 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -133,24 +133,24 @@ struct PalEntry PalEntry &operator= (uint32 other) { d = other; return *this; } PalEntry InverseColor() const { PalEntry nc; nc.a = a; nc.r = 255 - r; nc.g = 255 - g; nc.b = 255 - b; return nc; } #ifdef __BIG_ENDIAN__ - PalEntry (BYTE ir, BYTE ig, BYTE ib) : a(0), r(ir), g(ig), b(ib) {} - PalEntry (BYTE ia, BYTE ir, BYTE ig, BYTE ib) : a(ia), r(ir), g(ig), b(ib) {} + PalEntry (uint8_t ir, uint8_t ig, uint8_t ib) : a(0), r(ir), g(ig), b(ib) {} + PalEntry (uint8_t ia, uint8_t ir, uint8_t ig, uint8_t ib) : a(ia), r(ir), g(ig), b(ib) {} union { struct { - BYTE a,r,g,b; + uint8_t a,r,g,b; }; uint32 d; }; #else - PalEntry (BYTE ir, BYTE ig, BYTE ib) : b(ib), g(ig), r(ir), a(0) {} - PalEntry (BYTE ia, BYTE ir, BYTE ig, BYTE ib) : b(ib), g(ig), r(ir), a(ia) {} + PalEntry (uint8_t ir, uint8_t ig, uint8_t ib) : b(ib), g(ig), r(ir), a(0) {} + PalEntry (uint8_t ia, uint8_t ir, uint8_t ig, uint8_t ib) : b(ib), g(ig), r(ir), a(ia) {} union { struct { - BYTE b,g,r,a; + uint8_t b,g,r,a; }; uint32 d; }; diff --git a/src/dthinker.cpp b/src/dthinker.cpp index fddc283177..a5d78a5049 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -156,7 +156,7 @@ void DThinker::SaveList(FSerializer &arc, DThinker *node) void DThinker::SerializeThinkers(FSerializer &arc, bool hubLoad) { //DThinker *thinker; - //BYTE stat; + //uint8_t stat; //int statcount; int i; diff --git a/src/dthinker.h b/src/dthinker.h index f86eff2666..a8c374bb75 100644 --- a/src/dthinker.h +++ b/src/dthinker.h @@ -116,7 +116,7 @@ protected: const PClass *m_ParentType; private: DThinker *m_CurrThinker; - BYTE m_Stat; + uint8_t m_Stat; bool m_SearchStats; bool m_SearchingFresh; diff --git a/src/edata.cpp b/src/edata.cpp index 015be0bb17..19583f7770 100644 --- a/src/edata.cpp +++ b/src/edata.cpp @@ -124,9 +124,9 @@ struct EDSector int damageamount; int damageinterval; FNameNoInit damagetype; - BYTE leaky; - BYTE leakyadd; - BYTE leakyremove; + uint8_t leaky; + uint8_t leakyadd; + uint8_t leakyremove; int floorterrain; int ceilingterrain; @@ -349,7 +349,7 @@ static void parseSector(FScanner &sc) else if (sc.Compare("damageflags")) { DWORD *flagvar = NULL; - BYTE *leakvar = NULL; + uint8_t *leakvar = NULL; if (sc.CheckString(".")) { sc.MustGetString(); @@ -723,7 +723,7 @@ void ProcessEDSector(sector_t *sec, int recordnum) if (esec->flagsSet) sec->Flags = (sec->Flags & ~flagmask); sec->Flags = (sec->Flags | esec->flags | esec->flagsAdd) & ~esec->flagsRemove; - BYTE leak = 0; + uint8_t leak = 0; if (esec->damageflagsSet) sec->Flags = (sec->Flags & ~SECF_DAMAGEFLAGS); else leak = sec->leakydamage >= 256 ? 2 : sec->leakydamage >= 5 ? 1 : 0; sec->Flags = (sec->Flags | esec->damageflags | esec->damageflagsAdd) & ~esec->damageflagsRemove; diff --git a/src/files.h b/src/files.h index b782824824..05afe9b459 100644 --- a/src/files.h +++ b/src/files.h @@ -13,7 +13,7 @@ public: virtual ~FileReaderBase() {} virtual long Read (void *buffer, long len) = 0; - FileReaderBase &operator>> (BYTE &v) + FileReaderBase &operator>> (uint8_t &v) { Read (&v, 1); return *this; @@ -79,7 +79,7 @@ public: FILE *GetFile () const { return File; } virtual const char *GetBuffer() const { return NULL; } - FileReader &operator>> (BYTE &v) + FileReader &operator>> (uint8_t &v) { Read (&v, 1); return *this; @@ -138,7 +138,7 @@ public: virtual long Read (void *buffer, long len); - FileReaderZ &operator>> (BYTE &v) + FileReaderZ &operator>> (uint8_t &v) { Read (&v, 1); return *this; @@ -184,7 +184,7 @@ private: FileReader &File; bool SawEOF; z_stream Stream; - BYTE InBuff[BUFF_SIZE]; + uint8_t InBuff[BUFF_SIZE]; void FillBuffer (); @@ -200,7 +200,7 @@ public: long Read (void *buffer, long len); - FileReaderBZ2 &operator>> (BYTE &v) + FileReaderBZ2 &operator>> (uint8_t &v) { Read (&v, 1); return *this; @@ -246,7 +246,7 @@ private: FileReader &File; bool SawEOF; bz_stream Stream; - BYTE InBuff[BUFF_SIZE]; + uint8_t InBuff[BUFF_SIZE]; void FillBuffer (); @@ -264,7 +264,7 @@ public: long Read (void *buffer, long len); - FileReaderLZMA &operator>> (BYTE &v) + FileReaderLZMA &operator>> (uint8_t &v) { Read (&v, 1); return *this; @@ -313,7 +313,7 @@ private: size_t Size; size_t InPos, InSize; size_t OutProcessed; - BYTE InBuff[BUFF_SIZE]; + uint8_t InBuff[BUFF_SIZE]; void FillBuffer (); @@ -347,12 +347,12 @@ public: virtual long Read (void *buffer, long len); virtual char *Gets(char *strbuf, int len); virtual const char *GetBuffer() const { return (char*)&buf[0]; } - TArray &GetArray() { return buf; } + TArray &GetArray() { return buf; } void UpdateLength() { Length = buf.Size(); } protected: - TArray buf; + TArray buf; }; diff --git a/src/g_game.cpp b/src/g_game.cpp index e0fbd9854c..d1903a23a9 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -180,13 +180,13 @@ bool demorecording; bool demoplayback; bool demonew; // [RH] Only used around G_InitNew for demos int demover; -BYTE* demobuffer; -BYTE* demo_p; -BYTE* democompspot; -BYTE* demobodyspot; +uint8_t* demobuffer; +uint8_t* demo_p; +uint8_t* democompspot; +uint8_t* demobodyspot; size_t maxdemosize; -BYTE* zdemformend; // end of FORM ZDEM chunk -BYTE* zdembodyend; // end of ZDEM BODY chunk +uint8_t* zdemformend; // end of FORM ZDEM chunk +uint8_t* zdembodyend; // end of ZDEM BODY chunk bool singledemo; // quit after playing a demo from cmdline bool precache = true; // if true, load all graphics at start @@ -1162,7 +1162,7 @@ void G_Ticker () // [RH] Include some random seeds and player stuff in the consistancy // check, not just the player's x position like BOOM. - DWORD rngsum = FRandom::StaticSumSeeds (); + uint32_t rngsum = FRandom::StaticSumSeeds (); //Added by MC: For some of that bot stuff. The main bot function. bglobal.Main (); @@ -1211,7 +1211,7 @@ void G_Ticker () } if (players[i].mo) { - DWORD sum = rngsum + int((players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z())*257) + players[i].mo->Angles.Yaw.BAMs() + players[i].mo->Angles.Pitch.BAMs(); + uint32_t sum = rngsum + int((players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z())*257) + players[i].mo->Angles.Yaw.BAMs() + players[i].mo->Angles.Pitch.BAMs(); sum ^= players[i].health; consistancy[i][buf] = sum; } @@ -1394,7 +1394,7 @@ void G_PlayerReborn (int player) int itemcount; int secretcount; int chasecam; - BYTE currclass; + uint8_t currclass; userinfo_t userinfo; // [RH] Save userinfo APlayerPawn *actor; PClassActor *cls; @@ -2034,11 +2034,11 @@ void G_DoLoadGame () arc("importantcvars", cvar); if (!cvar.IsEmpty()) { - BYTE *vars_p = (BYTE *)cvar.GetChars(); + uint8_t *vars_p = (uint8_t *)cvar.GetChars(); C_ReadCVars(&vars_p); } - DWORD time[2] = { 1,0 }; + uint32_t time[2] = { 1,0 }; arc("ticrate", time[0]) ("leveltime", time[1]); @@ -2206,7 +2206,7 @@ static void PutSaveComment (FSerializer &arc) { char comment[256]; const char *readableTime; - WORD len; + uint16_t len; int levelTime; // Get the current date and time @@ -2222,7 +2222,7 @@ static void PutSaveComment (FSerializer &arc) // Get level name //strcpy (comment, level.level_name); mysnprintf(comment, countof(comment), "%s - %s", level.MapName.GetChars(), level.LevelName.GetChars()); - len = (WORD)strlen (comment); + len = (uint16_t)strlen (comment); comment[len] = '\n'; // Append elapsed time @@ -2429,7 +2429,7 @@ void G_ReadDemoTiccmd (ticcmd_t *cmd, int player) case DEM_DROPPLAYER: { - BYTE i = ReadByte (&demo_p); + uint8_t i = ReadByte (&demo_p); if (i < MAXPLAYERS) { playeringame[i] = false; @@ -2451,11 +2451,11 @@ CCMD (stop) stoprecording = true; } -extern BYTE *lenspot; +extern uint8_t *lenspot; void G_WriteDemoTiccmd (ticcmd_t *cmd, int player, int buf) { - BYTE *specdata; + uint8_t *specdata; int speclen; if (stoprecording) @@ -2488,7 +2488,7 @@ void G_WriteDemoTiccmd (ticcmd_t *cmd, int player, int buf) ptrdiff_t body = demobodyspot - demobuffer; // [RH] Allocate more space for the demo maxdemosize += 0x20000; - demobuffer = (BYTE *)M_Realloc (demobuffer, maxdemosize); + demobuffer = (uint8_t *)M_Realloc (demobuffer, maxdemosize); demo_p = demobuffer + pos; lenspot = demobuffer + spot; democompspot = demobuffer + comp; @@ -2508,7 +2508,7 @@ void G_RecordDemo (const char* name) FixPathSeperator (demoname); DefaultExtension (demoname, ".lmp"); maxdemosize = 0x20000; - demobuffer = (BYTE *)M_Malloc (maxdemosize); + demobuffer = (uint8_t *)M_Malloc (maxdemosize); demorecording = true; } @@ -2549,7 +2549,7 @@ void G_BeginRecording (const char *startmap) if (playeringame[i]) { StartChunk (UINF_ID, &demo_p); - WriteByte ((BYTE)i, &demo_p); + WriteByte ((uint8_t)i, &demo_p); D_WriteUserInfoStrings (i, &demo_p); FinishChunk (&demo_p); } @@ -2635,7 +2635,7 @@ bool G_ProcessIFFDemo (FString &mapname) int numPlayers = 0; int id, len, i; uLong uncompSize = 0; - BYTE *nextchunk; + uint8_t *nextchunk; demoplayback = true; @@ -2763,7 +2763,7 @@ bool G_ProcessIFFDemo (FString &mapname) if (uncompSize > 0) { - BYTE *uncompressed = (BYTE*)M_Malloc(uncompSize); + uint8_t *uncompressed = (uint8_t*)M_Malloc(uncompSize); int r = uncompress (uncompressed, &uncompSize, demo_p, uLong(zdembodyend - demo_p)); if (r != Z_OK) { @@ -2791,7 +2791,7 @@ void G_DoPlayDemo (void) if (demolump >= 0) { int demolen = Wads.LumpLength (demolump); - demobuffer = (BYTE *)M_Malloc(demolen); + demobuffer = (uint8_t *)M_Malloc(demolen); Wads.ReadLump (demolump, demobuffer); } else @@ -2937,7 +2937,7 @@ bool G_CheckDemoStatus (void) if (demorecording) { - BYTE *formlen; + uint8_t *formlen; WriteByte (DEM_STOP, &demo_p); diff --git a/src/g_level.h b/src/g_level.h index 26da28b9ae..0f8906b6a1 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -230,7 +230,7 @@ enum ELevelFlags : unsigned int struct FSpecialAction { FName Type; // this is initialized before the actors... - BYTE Action; + uint8_t Action; int Args[5]; // must allow 16 bit tags for 666 & 667! }; @@ -288,35 +288,35 @@ struct level_info_t int cluster; int partime; int sucktime; - DWORD flags; - DWORD flags2; - DWORD flags3; + uint32_t flags; + uint32_t flags2; + uint32_t flags3; FString Music; FString LevelName; - SBYTE WallVertLight, WallHorizLight; + int8_t WallVertLight, WallHorizLight; int musicorder; FCompressedBuffer Snapshot; TArray deferred; float skyspeed1; float skyspeed2; - DWORD fadeto; - DWORD outsidefog; + uint32_t fadeto; + uint32_t outsidefog; int cdtrack; unsigned int cdid; double gravity; double aircontrol; int WarpTrans; int airsupply; - DWORD compatflags, compatflags2; - DWORD compatmask, compatmask2; + uint32_t compatflags, compatflags2; + uint32_t compatmask, compatmask2; FString Translator; // for converting Doom-format linedef and sector types. int DefaultEnvironment; // Default sound environment for the map. FName Intermission; FName deathsequence; FName slideshow; - DWORD hazardcolor; - DWORD hazardflash; + uint32_t hazardcolor; + uint32_t hazardflash; // Redirection: If any player is carrying the specified item, then // you go to the RedirectMap instead of this one. diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 9c77a64f98..4019064366 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -8,7 +8,7 @@ struct FLevelLocals void Tick (); void AddScroller (int secnum); - BYTE md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded. + uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded. int time; // time in the hub int maptime; // time in the map int totaltime; // time in the game @@ -36,15 +36,15 @@ struct FLevelLocals TArray sectorPortals; - DWORD flags; - DWORD flags2; - DWORD flags3; + uint32_t flags; + uint32_t flags2; + uint32_t flags3; - DWORD fadeto; // The color the palette fades to (usually black) - DWORD outsidefog; // The fog for sectors with sky ceilings + uint32_t fadeto; // The color the palette fades to (usually black) + uint32_t outsidefog; // The fog for sectors with sky ceilings - DWORD hazardcolor; // what color strife hazard blends the screen color as - DWORD hazardflash; // what color strife hazard flashes the screen color as + uint32_t hazardcolor; // what color strife hazard blends the screen color as + uint32_t hazardflash; // what color strife hazard flashes the screen color as FString Music; int musicorder; @@ -73,8 +73,8 @@ struct FLevelLocals TArray Scrolls; // NULL if no DScrollers in this level - SBYTE WallVertLight; // Light diffs for vert/horiz walls - SBYTE WallHorizLight; + int8_t WallVertLight; // Light diffs for vert/horiz walls + int8_t WallHorizLight; bool FromSnapshot; // The current map was restored from a snapshot diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 69c90048fa..231d376eb8 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -965,14 +965,14 @@ DEFINE_MAP_OPTION(vertwallshade, true) { parse.ParseAssign(); parse.sc.MustGetNumber(); - info->WallVertLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127); + info->WallVertLight = (int8_t)clamp (parse.sc.Number / 2, -128, 127); } DEFINE_MAP_OPTION(horizwallshade, true) { parse.ParseAssign(); parse.sc.MustGetNumber(); - info->WallHorizLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127); + info->WallHorizLight = (int8_t)clamp (parse.sc.Number / 2, -128, 127); } DEFINE_MAP_OPTION(gravity, true) @@ -1243,7 +1243,7 @@ struct MapInfoFlagHandler { const char *name; EMIType type; - DWORD data1, data2; + uint32_t data1, data2; } MapFlagHandlers[] = { diff --git a/src/g_skill.cpp b/src/g_skill.cpp index 25108c0dfd..a2c75376ce 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -559,7 +559,7 @@ int FSkillInfo::GetTextColor() const { return CR_UNTRANSLATED; } - const BYTE *cp = (const BYTE *)TextColor.GetChars(); + const uint8_t *cp = (const uint8_t *)TextColor.GetChars(); int color = V_ParseFontColor(cp, 0, 0); if (color == CR_UNDEFINED) { diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index e6a0f99350..8b4e11ab59 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -488,7 +488,7 @@ void FGameConfigFile::ReadNetVars () // Read cvars from a cvar section of the ini. Flags are the flags to give // to newly-created cvars that were not already defined. -void FGameConfigFile::ReadCVars (DWORD flags) +void FGameConfigFile::ReadCVars (uint32_t flags) { const char *key, *value; FBaseCVar *cvar; diff --git a/src/gameconfigfile.h b/src/gameconfigfile.h index aa0d71e425..faeec2e517 100644 --- a/src/gameconfigfile.h +++ b/src/gameconfigfile.h @@ -63,7 +63,7 @@ protected: private: void SetRavenDefaults (bool isHexen); - void ReadCVars (DWORD flags); + void ReadCVars (uint32_t flags); bool bModSetup; diff --git a/src/gi.h b/src/gi.h index 2c614e3c70..f20ae0d997 100644 --- a/src/gi.h +++ b/src/gi.h @@ -55,8 +55,8 @@ extern const char *GameNames[17]; struct staticgameborder_t { - BYTE offset; - BYTE size; + uint8_t offset; + uint8_t size; char tl[8]; char t[8]; char tr[8]; @@ -69,8 +69,8 @@ struct staticgameborder_t struct gameborder_t { - BYTE offset; - BYTE size; + uint8_t offset; + uint8_t size; FString tl; FString t; FString tr; @@ -147,19 +147,19 @@ struct gameinfo_t double telefogheight; int defKickback; FString translator; - DWORD defaultbloodcolor; - DWORD defaultbloodparticlecolor; + uint32_t defaultbloodcolor; + uint32_t defaultbloodparticlecolor; FName backpacktype; FString statusbar; FString intermissionMusic; int intermissionOrder; FString CursorPic; - DWORD dimcolor; + uint32_t dimcolor; float dimamount; int definventorymaxamount; int defaultrespawntime; int defaultdropstyle; - DWORD pickupcolor; + uint32_t pickupcolor; TArray quitmessages; FName mTitleColor; FName mFontColor; diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index 36ae3ad8f4..a0bbd80029 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -319,7 +319,7 @@ DEFINE_MAP_OPTION(lightmode, false) FGLROptions *opt = info->GetOptData("gl_renderer"); parse.ParseAssign(); parse.sc.MustGetNumber(); - opt->lightmode = BYTE(parse.sc.Number); + opt->lightmode = uint8_t(parse.sc.Number); } DEFINE_MAP_OPTION(nocoloredspritelighting, false) diff --git a/src/gl/models/gl_models_md2.cpp b/src/gl/models/gl_models_md2.cpp index 0a4e85fede..bd0e9f0da9 100644 --- a/src/gl/models/gl_models_md2.cpp +++ b/src/gl/models/gl_models_md2.cpp @@ -331,7 +331,7 @@ void FDMDModel::BuildVertexBuffer() // //=========================================================================== -void FDMDModel::AddSkins(BYTE *hitlist) +void FDMDModel::AddSkins(uint8_t *hitlist) { for (int i = 0; i < info.numSkins; i++) { diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 9c3250d735..0f42d73d88 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -29,8 +29,8 @@ class player_t; // // Globally visible constants. // -#define HU_FONTSTART BYTE('!') // the first font characters -#define HU_FONTEND BYTE('\377') // the last font characters +#define HU_FONTSTART uint8_t('!') // the first font characters +#define HU_FONTEND uint8_t('\377') // the last font characters // Calculate # of glyphs in font. #define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) diff --git a/src/i_net.cpp b/src/i_net.cpp index e03f50a6ba..a1ec6017cd 100644 --- a/src/i_net.cpp +++ b/src/i_net.cpp @@ -99,7 +99,7 @@ typedef int socklen_t; static u_short DOOMPORT = (IPPORT_USERRESERVED + 29); static SOCKET mysocket = INVALID_SOCKET; static sockaddr_in sendaddress[MAXNETNODES]; -static BYTE sendplayer[MAXNETNODES]; +static uint8_t sendplayer[MAXNETNODES]; #ifdef __WIN32__ const char *neterror (void); @@ -125,24 +125,24 @@ enum struct PreGamePacket { - BYTE Fake; - BYTE Message; - BYTE NumNodes; + uint8_t Fake; + uint8_t Message; + uint8_t NumNodes; union { - BYTE ConsoleNum; - BYTE NumPresent; + uint8_t ConsoleNum; + uint8_t NumPresent; }; struct { DWORD address; WORD port; - BYTE player; - BYTE pad; + uint8_t player; + uint8_t pad; } machines[MAXNETNODES]; }; -BYTE TransmitBuffer[TRANSMIT_SIZE]; +uint8_t TransmitBuffer[TRANSMIT_SIZE]; // // UDPsocket @@ -452,7 +452,7 @@ void StartNetwork (bool autoPort) void SendAbort (void) { - BYTE dis[2] = { PRE_FAKE, PRE_DISCONNECT }; + uint8_t dis[2] = { PRE_FAKE, PRE_DISCONNECT }; int i, j; if (doomcom.numnodes > 1) @@ -515,7 +515,7 @@ bool Host_CheckForConnects (void *userdata) { if (node == -1) { - const BYTE *s_addr_bytes = (const BYTE *)&from->sin_addr; + const uint8_t *s_addr_bytes = (const uint8_t *)&from->sin_addr; StartScreen->NetMessage ("Got extra connect from %d.%d.%d.%d:%d", s_addr_bytes[0], s_addr_bytes[1], s_addr_bytes[2], s_addr_bytes[3], from->sin_port); diff --git a/src/info.h b/src/info.h index 6caa273254..afa8baa130 100644 --- a/src/info.h +++ b/src/info.h @@ -119,8 +119,8 @@ struct FState uint8_t Frame; uint8_t UseFlags; uint8_t DefineFlags; // Unused byte so let's use it during state creation. - int32_t Misc1; // Was changed to SBYTE, reverted to long for MBF compat - int32_t Misc2; // Was changed to BYTE, reverted to long for MBF compat + int32_t Misc1; // Was changed to int8_t, reverted to long for MBF compat + int32_t Misc2; // Was changed to uint8_t, reverted to long for MBF compat public: inline int GetFrame() const { @@ -170,7 +170,7 @@ public: { return NextState; } - inline void SetFrame(BYTE frame) + inline void SetFrame(uint8_t frame) { Frame = frame - 'A'; } @@ -253,7 +253,7 @@ public: virtual size_t PointerSubstitution(DObject *oldclass, DObject *newclass); void BuildDefaults(); - void ApplyDefaults(BYTE *defaults); + void ApplyDefaults(uint8_t *defaults); void RegisterIDs(); void SetDamageFactor(FName type, double factor); void SetPainChance(FName type, int chance); @@ -279,11 +279,11 @@ public: PClassActor *Replacement; PClassActor *Replacee; int NumOwnedStates; - BYTE GameFilter; + uint8_t GameFilter; uint8_t DefaultStateUsage; // state flag defaults for blocks without a qualifier. - WORD SpawnID; - WORD ConversationID; - SWORD DoomEdNum; + uint16_t SpawnID; + uint16_t ConversationID; + int16_t DoomEdNum; FStateLabels *StateList; DmgFactors *DamageFactors; PainChanceList *PainChances; diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index ab937dc3e1..ace2c0c617 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -352,7 +352,7 @@ void cht_DoCheat (player_t *player, int cheat) player->mo->SetState (player->mo->SpawnState); if (!(player->mo->flags2 & MF2_DONTTRANSLATE)) { - player->mo->Translation = TRANSLATION(TRANSLATION_Players, BYTE(player-players)); + player->mo->Translation = TRANSLATION(TRANSLATION_Players, uint8_t(player-players)); } if (player->ReadyWeapon != nullptr) { diff --git a/src/m_crc32.h b/src/m_crc32.h index f18b9448ca..0d6a439db8 100644 --- a/src/m_crc32.h +++ b/src/m_crc32.h @@ -37,16 +37,16 @@ // zlib includes some CRC32 stuff, so just use that -inline const DWORD *GetCRCTable () { return (const DWORD *)get_crc_table(); } -inline DWORD CalcCRC32 (const BYTE *buf, unsigned int len) +inline const uint32_t *GetCRCTable () { return (const uint32_t *)get_crc_table(); } +inline uint32_t CalcCRC32 (const uint8_t *buf, unsigned int len) { return crc32 (0, buf, len); } -inline DWORD AddCRC32 (DWORD crc, const BYTE *buf, unsigned int len) +inline uint32_t AddCRC32 (uint32_t crc, const uint8_t *buf, unsigned int len) { return crc32 (crc, buf, len); } -inline DWORD CRC1 (DWORD crc, const BYTE c, const DWORD *crcTable) +inline uint32_t CRC1 (uint32_t crc, const uint8_t c, const uint32_t *crcTable) { return crcTable[(crc & 0xff) ^ c] ^ (crc >> 8); } diff --git a/src/m_fixed.h b/src/m_fixed.h index dc7c3f4c97..b751d6b1fa 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -70,9 +70,9 @@ __forceinline int32_t DivScale6(int32_t a, int32_t b) { return (int32_t)(((int64 __forceinline int32_t DivScale21(int32_t a, int32_t b) { return (int32_t)(((int64_t)a << 21) / b); } // only used by R_DrawVoxel __forceinline int32_t DivScale30(int32_t a, int32_t b) { return (int32_t)(((int64_t)a << 30) / b); } // only used once in the node builder -__forceinline void fillshort(void *buff, unsigned int count, WORD clear) +__forceinline void fillshort(void *buff, unsigned int count, uint16_t clear) { - SWORD *b2 = (SWORD *)buff; + int16_t *b2 = (int16_t *)buff; for (unsigned int i = 0; i != count; ++i) { b2[i] = clear; diff --git a/src/m_joy.cpp b/src/m_joy.cpp index 46c0b9006a..dd5d8f58fd 100644 --- a/src/m_joy.cpp +++ b/src/m_joy.cpp @@ -35,7 +35,7 @@ CUSTOM_CVAR(Bool, use_joystick, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINI // PRIVATE DATA DEFINITIONS ------------------------------------------------ // Bits 0 is X+, 1 is X-, 2 is Y+, and 3 is Y-. -static BYTE JoyAngleButtons[8] = { 1, 1+4, 4, 2+4, 2, 2+8, 8, 1+8 }; +static uint8_t JoyAngleButtons[8] = { 1, 1+4, 4, 2+4, 2, 2+8, 8, 1+8 }; // CODE -------------------------------------------------------------------- @@ -182,9 +182,9 @@ void M_SaveJoystickConfig(IJoystickConfig *joy) // //=========================================================================== -double Joy_RemoveDeadZone(double axisval, double deadzone, BYTE *buttons) +double Joy_RemoveDeadZone(double axisval, double deadzone, uint8_t *buttons) { - BYTE butt; + uint8_t butt; // Cancel out deadzone. if (fabs(axisval) < deadzone) diff --git a/src/m_joy.h b/src/m_joy.h index 9450e9c8e7..042a59686d 100644 --- a/src/m_joy.h +++ b/src/m_joy.h @@ -54,7 +54,7 @@ void M_SaveJoystickConfig(IJoystickConfig *joy); void Joy_GenerateButtonEvents(int oldbuttons, int newbuttons, int numbuttons, int base); void Joy_GenerateButtonEvents(int oldbuttons, int newbuttons, int numbuttons, const int *keys); int Joy_XYAxesToButtons(double x, double y); -double Joy_RemoveDeadZone(double axisval, double deadzone, BYTE *buttons); +double Joy_RemoveDeadZone(double axisval, double deadzone, uint8_t *buttons); // These ought to be provided by a system-specific i_input.cpp. void I_GetAxes(float axes[NUM_JOYAXIS]); diff --git a/src/m_misc.cpp b/src/m_misc.cpp index c49b342ce0..40214f3620 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -114,11 +114,11 @@ bool M_WriteFile (char const *name, void *source, int length) // // M_ReadFile // -int M_ReadFile (char const *name, BYTE **buffer) +int M_ReadFile (char const *name, uint8_t **buffer) { int handle, count, length; struct stat fileinfo; - BYTE *buf; + uint8_t *buf; handle = open (name, O_RDONLY | O_BINARY, 0666); if (handle == -1) @@ -127,7 +127,7 @@ int M_ReadFile (char const *name, BYTE **buffer) if (stat (name,&fileinfo) == -1) I_Error ("Couldn't read file %s", name); length = fileinfo.st_size; - buf = new BYTE[length]; + buf = new uint8_t[length]; count = read (handle, buf, length); close (handle); @@ -141,11 +141,11 @@ int M_ReadFile (char const *name, BYTE **buffer) // // M_ReadFile (same as above but use malloc instead of new to allocate the buffer.) // -int M_ReadFileMalloc (char const *name, BYTE **buffer) +int M_ReadFileMalloc (char const *name, uint8_t **buffer) { int handle, count, length; struct stat fileinfo; - BYTE *buf; + uint8_t *buf; handle = open (name, O_RDONLY | O_BINARY, 0666); if (handle == -1) @@ -154,7 +154,7 @@ int M_ReadFileMalloc (char const *name, BYTE **buffer) if (stat (name,&fileinfo) == -1) I_Error ("Couldn't read file %s", name); length = fileinfo.st_size; - buf = (BYTE*)M_Malloc(length); + buf = (uint8_t*)M_Malloc(length); count = read (handle, buf, length); close (handle); @@ -459,15 +459,15 @@ inline void putc(unsigned char chr, FileWriter *file) // // WritePCXfile // -void WritePCXfile (FileWriter *file, const BYTE *buffer, const PalEntry *palette, +void WritePCXfile (FileWriter *file, const uint8_t *buffer, const PalEntry *palette, ESSType color_type, int width, int height, int pitch) { - BYTE temprow[MAXWIDTH * 3]; - const BYTE *data; + uint8_t temprow[MAXWIDTH * 3]; + const uint8_t *data; int x, y; int runlen; int bytes_per_row_minus_one; - BYTE color; + uint8_t color; pcx_t pcx; pcx.manufacturer = 10; // PCX id @@ -600,7 +600,7 @@ void WritePCXfile (FileWriter *file, const BYTE *buffer, const PalEntry *palette // // WritePNGfile // -void WritePNGfile (FileWriter *file, const BYTE *buffer, const PalEntry *palette, +void WritePNGfile (FileWriter *file, const uint8_t *buffer, const PalEntry *palette, ESSType color_type, int width, int height, int pitch) { char software[100]; @@ -703,7 +703,7 @@ void M_ScreenShot (const char *filename) } // save the screenshot - const BYTE *buffer; + const uint8_t *buffer; int pitch; ESSType color_type; diff --git a/src/m_misc.h b/src/m_misc.h index d7365e1bbb..cd2b09f2f2 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -33,8 +33,8 @@ class FIWadManager; extern FGameConfigFile *GameConfig; bool M_WriteFile (char const *name, void *source, int length); -int M_ReadFile (char const *name, BYTE **buffer); -int M_ReadFileMalloc (char const *name, BYTE **buffer); +int M_ReadFile (char const *name, uint8_t **buffer); +int M_ReadFileMalloc (char const *name, uint8_t **buffer); void M_FindResponseFile (void); // [RH] M_ScreenShot now accepts a filename parameter. diff --git a/src/m_png.cpp b/src/m_png.cpp index b122212a57..50ecb29f4c 100644 --- a/src/m_png.cpp +++ b/src/m_png.cpp @@ -66,13 +66,13 @@ struct IHDR { - DWORD Width; - DWORD Height; - BYTE BitDepth; - BYTE ColorType; - BYTE Compression; - BYTE Filter; - BYTE Interlace; + uint32_t Width; + uint32_t Height; + uint8_t BitDepth; + uint8_t ColorType; + uint8_t Compression; + uint8_t Filter; + uint8_t Interlace; }; PNGHandle::PNGHandle (FILE *file) : File(0), bDeleteFilePtr(true), ChunkPt(0) @@ -99,11 +99,11 @@ PNGHandle::~PNGHandle () // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- -static inline void MakeChunk (void *where, DWORD type, size_t len); -static inline void StuffPalette (const PalEntry *from, BYTE *to); -static bool WriteIDAT (FileWriter *file, const BYTE *data, int len); -static void UnfilterRow (int width, BYTE *dest, BYTE *stream, BYTE *prev, int bpp); -static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE *rowin, BYTE *rowout, bool grayscale); +static inline void MakeChunk (void *where, uint32_t type, size_t len); +static inline void StuffPalette (const PalEntry *from, uint8_t *to); +static bool WriteIDAT (FileWriter *file, const uint8_t *data, int len); +static void UnfilterRow (int width, uint8_t *dest, uint8_t *stream, uint8_t *prev, int bpp); +static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const uint8_t *rowin, uint8_t *rowout, bool grayscale); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -131,17 +131,17 @@ CVAR(Float, png_gamma, 0.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // //========================================================================== -bool M_CreatePNG (FileWriter *file, const BYTE *buffer, const PalEntry *palette, +bool M_CreatePNG (FileWriter *file, const uint8_t *buffer, const PalEntry *palette, ESSType color_type, int width, int height, int pitch) { - BYTE work[8 + // signature + uint8_t work[8 + // signature 12+2*4+5 + // IHDR 12+4 + // gAMA 12+256*3]; // PLTE - DWORD *const sig = (DWORD *)&work[0]; + uint32_t *const sig = (uint32_t *)&work[0]; IHDR *const ihdr = (IHDR *)&work[8 + 8]; - DWORD *const gama = (DWORD *)((BYTE *)ihdr + 2*4+5 + 12); - BYTE *const plte = (BYTE *)gama + 4 + 12; + uint32_t *const gama = (uint32_t *)((uint8_t *)ihdr + 2*4+5 + 12); + uint8_t *const plte = (uint8_t *)gama + 4 + 12; size_t work_len; sig[0] = MAKE_ID(137,'P','N','G'); @@ -187,7 +187,7 @@ bool M_CreatePNG (FileWriter *file, const BYTE *buffer, const PalEntry *palette, bool M_CreateDummyPNG (FileWriter *file) { - static const BYTE dummyPNG[] = + static const uint8_t dummyPNG[] = { 137,'P','N','G',13,10,26,10, 0,0,0,13,'I','H','D','R', @@ -209,7 +209,7 @@ bool M_CreateDummyPNG (FileWriter *file) bool M_FinishPNG (FileWriter *file) { - static const BYTE iend[12] = { 0,0,0,0,73,69,78,68,174,66,96,130 }; + static const uint8_t iend[12] = { 0,0,0,0,73,69,78,68,174,66,96,130 }; return file->Write (iend, 12) == 12; } @@ -221,15 +221,15 @@ bool M_FinishPNG (FileWriter *file) // //========================================================================== -bool M_AppendPNGChunk (FileWriter *file, DWORD chunkID, const BYTE *chunkData, DWORD len) +bool M_AppendPNGChunk (FileWriter *file, uint32_t chunkID, const uint8_t *chunkData, uint32_t len) { - DWORD head[2] = { BigLong((unsigned int)len), chunkID }; - DWORD crc; + uint32_t head[2] = { BigLong((unsigned int)len), chunkID }; + uint32_t crc; if (file->Write (head, 8) == 8 && (len == 0 || file->Write (chunkData, len) == len)) { - crc = CalcCRC32 ((BYTE *)&head[1], 4); + crc = CalcCRC32 ((uint8_t *)&head[1], 4); if (len != 0) { crc = AddCRC32 (crc, chunkData, len); @@ -250,10 +250,10 @@ bool M_AppendPNGChunk (FileWriter *file, DWORD chunkID, const BYTE *chunkData, D bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text) { - struct { DWORD len, id; char key[80]; } head; + struct { uint32_t len, id; char key[80]; } head; int len = (int)strlen (text); int keylen = MIN ((int)strlen (keyword), 79); - DWORD crc; + uint32_t crc; head.len = BigLong(len + keylen + 1); head.id = MAKE_ID('t','E','X','t'); @@ -264,10 +264,10 @@ bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text) if ((int)file->Write (&head, keylen + 9) == keylen + 9 && (int)file->Write (text, len) == len) { - crc = CalcCRC32 ((BYTE *)&head+4, keylen + 5); + crc = CalcCRC32 ((uint8_t *)&head+4, keylen + 5); if (len != 0) { - crc = AddCRC32 (crc, (BYTE *)text, len); + crc = AddCRC32 (crc, (uint8_t *)text, len); } crc = BigLong((unsigned int)crc); return file->Write (&crc, 4) == 4; @@ -289,7 +289,7 @@ bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text) // //========================================================================== -unsigned int M_FindPNGChunk (PNGHandle *png, DWORD id) +unsigned int M_FindPNGChunk (PNGHandle *png, uint32_t id) { png->ChunkPt = 0; return M_NextPNGChunk (png, id); @@ -303,7 +303,7 @@ unsigned int M_FindPNGChunk (PNGHandle *png, DWORD id) // //========================================================================== -unsigned int M_NextPNGChunk (PNGHandle *png, DWORD id) +unsigned int M_NextPNGChunk (PNGHandle *png, uint32_t id) { for ( ; png->ChunkPt < png->Chunks.Size(); ++png->ChunkPt) { @@ -378,7 +378,7 @@ PNGHandle *M_VerifyPNG (FileReader *filer, bool takereader) { PNGHandle::Chunk chunk; PNGHandle *png; - DWORD data[2]; + uint32_t data[2]; bool sawIDAT = false; if (filer->Read(&data, 8) != 8) @@ -479,14 +479,14 @@ void M_FreePNG (PNGHandle *png) // //========================================================================== -bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitch, - BYTE bitdepth, BYTE colortype, BYTE interlace, unsigned int chunklen) +bool M_ReadIDAT (FileReader *file, uint8_t *buffer, int width, int height, int pitch, + uint8_t bitdepth, uint8_t colortype, uint8_t interlace, unsigned int chunklen) { // Uninterlaced images are treated as a conceptual eighth pass by these tables. - static const BYTE passwidthshift[8] = { 3, 3, 2, 2, 1, 1, 0, 0 }; - static const BYTE passheightshift[8] = { 3, 3, 3, 2, 2, 1, 1, 0 }; - static const BYTE passrowoffset[8] = { 0, 0, 4, 0, 2, 0, 1, 0 }; - static const BYTE passcoloffset[8] = { 0, 4, 0, 2, 0, 1, 0, 0 }; + static const uint8_t passwidthshift[8] = { 3, 3, 2, 2, 1, 1, 0, 0 }; + static const uint8_t passheightshift[8] = { 3, 3, 3, 2, 2, 1, 1, 0 }; + static const uint8_t passrowoffset[8] = { 0, 0, 4, 0, 2, 0, 1, 0 }; + static const uint8_t passcoloffset[8] = { 0, 4, 0, 2, 0, 1, 0, 0 }; Byte *inputLine, *prev, *curr, *adam7buff[3], *bufferend; Byte chunkbuffer[4096]; @@ -597,8 +597,8 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc } else { - const BYTE *in; - BYTE *out; + const uint8_t *in; + uint8_t *out; int colstep, x; // Store pixels into a temporary buffer @@ -628,7 +628,7 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc case 2: for (x = passwidth; x > 0; --x) { - *(WORD *)out = *(WORD *)in; + *(uint16_t *)out = *(uint16_t *)in; out += colstep; in += 2; } @@ -648,7 +648,7 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc case 4: for (x = passwidth; x > 0; --x) { - *(DWORD *)out = *(DWORD *)in; + *(uint32_t *)out = *(uint32_t *)in; out += colstep; in += 4; } @@ -666,7 +666,7 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc if (chunklen == 0 && !lastIDAT) { - DWORD x[3]; + uint32_t x[3]; if (file->Read (x, 12) != 12) { @@ -711,12 +711,12 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc // //========================================================================== -static inline void MakeChunk (void *where, DWORD type, size_t len) +static inline void MakeChunk (void *where, uint32_t type, size_t len) { - BYTE *const data = (BYTE *)where; - *(DWORD *)(data - 8) = BigLong ((unsigned int)len); - *(DWORD *)(data - 4) = type; - *(DWORD *)(data + len) = BigLong ((unsigned int)CalcCRC32 (data-4, (unsigned int)(len+4))); + uint8_t *const data = (uint8_t *)where; + *(uint32_t *)(data - 8) = BigLong ((unsigned int)len); + *(uint32_t *)(data - 4) = type; + *(uint32_t *)(data + len) = BigLong ((unsigned int)CalcCRC32 (data-4, (unsigned int)(len+4))); } //========================================================================== @@ -727,7 +727,7 @@ static inline void MakeChunk (void *where, DWORD type, size_t len) // //========================================================================== -static void StuffPalette (const PalEntry *from, BYTE *to) +static void StuffPalette (const PalEntry *from, uint8_t *to) { for (int i = 256; i > 0; --i) { @@ -746,9 +746,9 @@ static void StuffPalette (const PalEntry *from, BYTE *to) // //========================================================================== -DWORD CalcSum(Byte *row, int len) +uint32_t CalcSum(Byte *row, int len) { - DWORD sum = 0; + uint32_t sum = 0; while (len-- != 0) { @@ -776,8 +776,8 @@ static int SelectFilter(Byte row[5][1 + MAXWIDTH*3], Byte prior[MAXWIDTH*3], int // As it turns out, it seems no filtering is the best for Doom screenshots, // no matter what the heuristic might determine. return 0; - DWORD sum; - DWORD bestsum; + uint32_t sum; + uint32_t bestsum; int bestfilter; int x; @@ -904,7 +904,7 @@ static int SelectFilter(Byte row[5][1 + MAXWIDTH*3], Byte prior[MAXWIDTH*3], int // //========================================================================== -bool M_SaveBitmap(const BYTE *from, ESSType color_type, int width, int height, int pitch, FileWriter *file) +bool M_SaveBitmap(const uint8_t *from, ESSType color_type, int width, int height, int pitch, FileWriter *file) { #if USE_FILTER_HEURISTIC Byte prior[MAXWIDTH*3]; @@ -1044,13 +1044,13 @@ bool M_SaveBitmap(const BYTE *from, ESSType color_type, int width, int height, i // //========================================================================== -static bool WriteIDAT (FileWriter *file, const BYTE *data, int len) +static bool WriteIDAT (FileWriter *file, const uint8_t *data, int len) { - DWORD foo[2], crc; + uint32_t foo[2], crc; foo[0] = BigLong (len); foo[1] = MAKE_ID('I','D','A','T'); - crc = CalcCRC32 ((BYTE *)&foo[1], 4); + crc = CalcCRC32 ((uint8_t *)&foo[1], 4); crc = BigLong ((unsigned int)AddCRC32 (crc, data, len)); if (file->Write (foo, 8) != 8 || @@ -1072,7 +1072,7 @@ static bool WriteIDAT (FileWriter *file, const BYTE *data, int len) // //========================================================================== -void UnfilterRow (int width, BYTE *dest, BYTE *row, BYTE *prev, int bpp) +void UnfilterRow (int width, uint8_t *dest, uint8_t *row, uint8_t *prev, int bpp) { int x; @@ -1110,7 +1110,7 @@ void UnfilterRow (int width, BYTE *dest, BYTE *row, BYTE *prev, int bpp) while (--x); for (x = width - bpp; x > 0; --x) { - *dest = *row++ + (BYTE)((unsigned(*(dest - bpp)) + unsigned(*prev++)) >> 1); + *dest = *row++ + (uint8_t)((unsigned(*(dest - bpp)) + unsigned(*prev++)) >> 1); dest++; } break; @@ -1134,7 +1134,7 @@ void UnfilterRow (int width, BYTE *dest, BYTE *row, BYTE *prev, int bpp) pc = abs (pa + pb); pa = abs (pa); pb = abs (pb); - *dest = *row + (BYTE)((pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c); + *dest = *row + (uint8_t)((pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c); dest++; row++; prev++; @@ -1158,11 +1158,11 @@ void UnfilterRow (int width, BYTE *dest, BYTE *row, BYTE *prev, int bpp) // //========================================================================== -static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE *rowin, BYTE *rowout, bool grayscale) +static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const uint8_t *rowin, uint8_t *rowout, bool grayscale) { - const BYTE *in; - BYTE *out; - BYTE pack; + const uint8_t *in; + uint8_t *out; + uint8_t pack; int lastbyte; assert(bitdepth == 1 || bitdepth == 2 || bitdepth == 4); @@ -1256,7 +1256,7 @@ static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE * union { uint32 bits2l; - BYTE bits2[4]; + uint8_t bits2[4]; }; out = rowout + width; diff --git a/src/m_png.h b/src/m_png.h index 9fb9eeeffd..2390059c1d 100644 --- a/src/m_png.h +++ b/src/m_png.h @@ -44,14 +44,14 @@ // The passed file should be a newly created file. // This function writes the PNG signature and the IHDR, gAMA, PLTE, and IDAT // chunks. -bool M_CreatePNG (FileWriter *file, const BYTE *buffer, const PalEntry *pal, +bool M_CreatePNG (FileWriter *file, const uint8_t *buffer, const PalEntry *pal, ESSType color_type, int width, int height, int pitch); // Creates a grayscale 1x1 PNG file. Used for savegames without savepics. bool M_CreateDummyPNG (FileWriter *file); // Appends any chunk to a PNG file started with M_CreatePNG. -bool M_AppendPNGChunk (FileWriter *file, DWORD chunkID, const BYTE *chunkData, DWORD len); +bool M_AppendPNGChunk (FileWriter *file, uint32_t chunkID, const uint8_t *chunkData, uint32_t len); // Adds a tEXt chunk to a PNG file started with M_CreatePNG. bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text); @@ -59,7 +59,7 @@ bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text); // Appends the IEND chunk to a PNG file. bool M_FinishPNG (FileWriter *file); -bool M_SaveBitmap(const BYTE *from, ESSType color_type, int width, int height, int pitch, FileWriter *file); +bool M_SaveBitmap(const uint8_t *from, ESSType color_type, int width, int height, int pitch, FileWriter *file); // PNG Reading -------------------------------------------------------------- @@ -68,9 +68,9 @@ struct PNGHandle { struct Chunk { - DWORD ID; - DWORD Offset; - DWORD Size; + uint32_t ID; + uint32_t Offset; + uint32_t Size; }; FileReader *File; @@ -94,11 +94,11 @@ PNGHandle *M_VerifyPNG (FILE *file); // Finds a chunk in a PNG file. The file pointer will be positioned at the // beginning of the chunk data, and its length will be returned. A return // value of 0 indicates the chunk was either not present or had 0 length. -unsigned int M_FindPNGChunk (PNGHandle *png, DWORD chunkID); +unsigned int M_FindPNGChunk (PNGHandle *png, uint32_t chunkID); // Finds a chunk in the PNG file, starting its search at whatever chunk // the file pointer is currently positioned at. -unsigned int M_NextPNGChunk (PNGHandle *png, DWORD chunkID); +unsigned int M_NextPNGChunk (PNGHandle *png, uint32_t chunkID); // Finds a PNG text chunk with the given signature and returns a pointer // to a NULL-terminated string if present. Returns NULL on failure. @@ -108,8 +108,8 @@ bool M_GetPNGText (PNGHandle *png, const char *keyword, char *buffer, size_t buf // The file must be positioned at the start of the first IDAT. It reads // image data into the provided buffer. Returns true on success. -bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitch, - BYTE bitdepth, BYTE colortype, BYTE interlace, unsigned int idatlen); +bool M_ReadIDAT (FileReader *file, uint8_t *buffer, int width, int height, int pitch, + uint8_t bitdepth, uint8_t colortype, uint8_t interlace, unsigned int idatlen); class FTexture; diff --git a/src/m_random.cpp b/src/m_random.cpp index 697bb173f1..ecb2bfe9e7 100644 --- a/src/m_random.cpp +++ b/src/m_random.cpp @@ -94,10 +94,10 @@ extern FRandom pr_damagemobj; FRandom M_Random; // Global seed. This is modified predictably to initialize every RNG. -DWORD rngseed; +uint32_t rngseed; // Static RNG marker. This is only used when the RNG is set for each new game. -DWORD staticrngseed; +uint32_t staticrngseed; bool use_staticrng; // Allows checking or staticly setting the global seed. @@ -169,7 +169,7 @@ FRandom::FRandom () FRandom::FRandom (const char *name) { - NameCRC = CalcCRC32 ((const BYTE *)name, (unsigned int)strlen (name)); + NameCRC = CalcCRC32 ((const uint8_t *)name, (unsigned int)strlen (name)); #ifndef NDEBUG initialized = false; Name = name; @@ -257,12 +257,12 @@ void FRandom::StaticClearRandom () // //========================================================================== -void FRandom::Init(DWORD seed) +void FRandom::Init(uint32_t seed) { // [RH] Use the RNG's name's CRC to modify the original seed. // This way, new RNGs can be added later, and it doesn't matter // which order they get initialized in. - DWORD seeds[2] = { NameCRC, seed }; + uint32_t seeds[2] = { NameCRC, seed }; InitByArray(seeds, 2); } @@ -270,13 +270,13 @@ void FRandom::Init(DWORD seed) // // FRandom :: StaticSumSeeds // -// This function produces a DWORD that can be used to check the consistancy +// This function produces a uint32_t that can be used to check the consistancy // of network games between different machines. Only a select few RNGs are // used for the sum, because not all RNGs are important to network sync. // //========================================================================== -DWORD FRandom::StaticSumSeeds () +uint32_t FRandom::StaticSumSeeds () { return pr_spawnmobj.sfmt.u[0] + pr_spawnmobj.idx + @@ -377,7 +377,7 @@ void FRandom::StaticReadRNGState(FSerializer &arc) FRandom *FRandom::StaticFindRNG (const char *name) { - DWORD NameCRC = CalcCRC32 ((const BYTE *)name, (unsigned int)strlen (name)); + uint32_t NameCRC = CalcCRC32 ((const uint8_t *)name, (unsigned int)strlen (name)); // Use the default RNG if this one happens to have a CRC of 0. if (NameCRC == 0) return &pr_exrandom; diff --git a/src/m_random.h b/src/m_random.h index b3e0f3b283..c82c77a62d 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -86,21 +86,21 @@ public: return operator()(); } - void Init(DWORD seed); + void Init(uint32_t seed); // SFMT interface unsigned int GenRand32(); QWORD GenRand64(); - void FillArray32(DWORD *array, int size); + void FillArray32(uint32_t *array, int size); void FillArray64(QWORD *array, int size); - void InitGenRand(DWORD seed); - void InitByArray(DWORD *init_key, int key_length); + void InitGenRand(uint32_t seed); + void InitByArray(uint32_t *init_key, int key_length); int GetMinArraySize32(); int GetMinArraySize64(); /* These real versions are due to Isaku Wada */ /** generates a random number on [0,1]-real-interval */ - static inline double ToReal1(DWORD v) + static inline double ToReal1(uint32_t v) { return v * (1.0/4294967295.0); /* divided by 2^32-1 */ @@ -113,7 +113,7 @@ public: } /** generates a random number on [0,1)-real-interval */ - static inline double ToReal2(DWORD v) + static inline double ToReal2(uint32_t v) { return v * (1.0/4294967296.0); /* divided by 2^32 */ @@ -126,7 +126,7 @@ public: } /** generates a random number on (0,1)-real-interval */ - static inline double ToReal3(DWORD v) + static inline double ToReal3(uint32_t v) { return (((double)v) + 0.5)*(1.0/4294967296.0); /* divided by 2^32 */ @@ -147,7 +147,7 @@ public: /** generates a random number on [0,1) with 53-bit resolution from two * 32 bit integers */ - static inline double ToRes53Mix(DWORD x, DWORD y) + static inline double ToRes53Mix(uint32_t x, uint32_t y) { return ToRes53(x | ((QWORD)y << 32)); } @@ -164,7 +164,7 @@ public: */ inline double GenRand_Res53_Mix() { - DWORD x, y; + uint32_t x, y; x = GenRand32(); y = GenRand32(); @@ -173,7 +173,7 @@ public: // Static interface static void StaticClearRandom (); - static DWORD StaticSumSeeds (); + static uint32_t StaticSumSeeds (); static void StaticReadRNGState (FSerializer &arc); static void StaticWriteRNGState (FSerializer &file); static FRandom *StaticFindRNG(const char *name); @@ -187,7 +187,7 @@ private: const char *Name; #endif FRandom *Next; - DWORD NameCRC; + uint32_t NameCRC; static FRandom *RNGList; @@ -215,9 +215,9 @@ private: #endif }; -extern DWORD rngseed; // The starting seed (not part of state) +extern uint32_t rngseed; // The starting seed (not part of state) -extern DWORD staticrngseed; // Static rngseed that can be set by the user +extern uint32_t staticrngseed; // Static rngseed that can be set by the user extern bool use_staticrng; diff --git a/src/md5.cpp b/src/md5.cpp index 7729108437..ae3cb53c0b 100644 --- a/src/md5.cpp +++ b/src/md5.cpp @@ -22,12 +22,12 @@ #include "templates.h" #ifdef __BIG_ENDIAN__ -void byteSwap(DWORD *buf, unsigned words) +void byteSwap(uint32_t *buf, unsigned words) { - BYTE *p = (BYTE *)buf; + uint8_t *p = (uint8_t *)buf; do { - *buf++ = (DWORD)((unsigned)p[3] << 8 | p[2]) << 16 | + *buf++ = (uint32_t)((unsigned)p[3] << 8 | p[2]) << 16 | ((unsigned)p[1] << 8 | p[0]); p += 4; } while (--words); @@ -55,9 +55,9 @@ void MD5Context::Init() * Update context to reflect the concatenation of another buffer full * of bytes. */ -void MD5Context::Update(const BYTE *buf, unsigned len) +void MD5Context::Update(const uint8_t *buf, unsigned len) { - DWORD t; + uint32_t t; /* Update byte count */ @@ -67,13 +67,13 @@ void MD5Context::Update(const BYTE *buf, unsigned len) t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ if (t > len) { - memcpy((BYTE *)in + 64 - t, buf, len); + memcpy((uint8_t *)in + 64 - t, buf, len); return; } /* First chunk is an odd size */ if (t < 64) { - memcpy((BYTE *)in + 64 - t, buf, t); + memcpy((uint8_t *)in + 64 - t, buf, t); byteSwap(in, 16); MD5Transform(this->buf, in); buf += t; @@ -96,7 +96,7 @@ void MD5Context::Update(const BYTE *buf, unsigned len) void MD5Context::Update(FileReader *file, unsigned len) { - BYTE readbuf[8192]; + uint8_t readbuf[8192]; long t; while (len != 0) @@ -112,10 +112,10 @@ void MD5Context::Update(FileReader *file, unsigned len) * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ -void MD5Context::Final(BYTE digest[16]) +void MD5Context::Final(uint8_t digest[16]) { int count = bytes[0] & 0x3f; /* Number of bytes in ctx->in */ - BYTE *p = (BYTE *)in + count; + uint8_t *p = (uint8_t *)in + count; /* Set the first char of padding to 0x80. There is always room. */ *p++ = 0x80; @@ -128,7 +128,7 @@ void MD5Context::Final(BYTE digest[16]) memset(p, 0, count + 8); byteSwap(in, 16); MD5Transform(buf, in); - p = (BYTE *)in; + p = (uint8_t *)in; count = 56; } memset(p, 0, count); @@ -164,9 +164,9 @@ void MD5Context::Final(BYTE digest[16]) * the data and converts bytes into longwords for this routine. */ void -MD5Transform(DWORD buf[4], const DWORD in[16]) +MD5Transform(uint32_t buf[4], const uint32_t in[16]) { - DWORD a, b, c, d; + uint32_t a, b, c, d; a = buf[0]; b = buf[1]; @@ -276,7 +276,7 @@ CCMD (md5sum) else { MD5Context md5; - BYTE readbuf[8192]; + uint8_t readbuf[8192]; size_t len; while ((len = fread(readbuf, 1, sizeof(readbuf), file)) > 0) diff --git a/src/md5.h b/src/md5.h index 173fcbb756..1f2765378d 100644 --- a/src/md5.h +++ b/src/md5.h @@ -25,17 +25,17 @@ struct MD5Context MD5Context() { Init(); } void Init(); - void Update(const BYTE *buf, unsigned len); + void Update(const uint8_t *buf, unsigned len); void Update(FileReader *file, unsigned len); - void Final(BYTE digest[16]); + void Final(uint8_t digest[16]); private: - DWORD buf[4]; - DWORD bytes[2]; - DWORD in[16]; + uint32_t buf[4]; + uint32_t bytes[2]; + uint32_t in[16]; }; -void MD5Transform(DWORD buf[4], DWORD const in[16]); +void MD5Transform(uint32_t buf[4], uint32_t const in[16]); #endif /* !MD5_H */ diff --git a/src/memarena.cpp b/src/memarena.cpp index af9f915471..88b2c8c4c0 100644 --- a/src/memarena.cpp +++ b/src/memarena.cpp @@ -201,7 +201,7 @@ FMemArena::Block *FMemArena::AddBlock(size_t size) // Search for a free block to use for (last = &FreeBlocks, mem = FreeBlocks; mem != NULL; last = &mem->NextBlock, mem = mem->NextBlock) { - if ((BYTE *)mem->Limit - (BYTE *)mem >= (ptrdiff_t)size) + if ((uint8_t *)mem->Limit - (uint8_t *)mem >= (ptrdiff_t)size) { *last = mem->NextBlock; break; @@ -220,7 +220,7 @@ FMemArena::Block *FMemArena::AddBlock(size_t size) size += BlockSize/2; } mem = (Block *)M_Malloc(size); - mem->Limit = (BYTE *)mem + size; + mem->Limit = (uint8_t *)mem + size; } mem->Reset(); mem->NextBlock = TopBlock; diff --git a/src/mus2midi.cpp b/src/mus2midi.cpp index 9d27d31cad..09abdeb192 100644 --- a/src/mus2midi.cpp +++ b/src/mus2midi.cpp @@ -43,7 +43,7 @@ #include "mus2midi.h" #include "doomdef.h" -static const BYTE StaticMIDIhead[] = +static const uint8_t StaticMIDIhead[] = { 'M','T','h','d', 0, 0, 0, 6, 0, 0, // format 0: only one track 0, 1, // yes, there is really only one track @@ -53,9 +53,9 @@ static const BYTE StaticMIDIhead[] = 0, 255, 81, 3, 0x07, 0xa1, 0x20 }; -extern int MUSHeaderSearch(const BYTE *head, int len); +extern int MUSHeaderSearch(const uint8_t *head, int len); -static const BYTE CtrlTranslate[15] = +static const uint8_t CtrlTranslate[15] = { 0, // program change 0, // bank select @@ -74,11 +74,11 @@ static const BYTE CtrlTranslate[15] = 121, // reset all controllers }; -static size_t ReadVarLen (const BYTE *buf, int *time_out) +static size_t ReadVarLen (const uint8_t *buf, int *time_out) { int time = 0; size_t ofs = 0; - BYTE t; + uint8_t t; do { @@ -89,7 +89,7 @@ static size_t ReadVarLen (const BYTE *buf, int *time_out) return ofs; } -static size_t WriteVarLen (TArray &file, int time) +static size_t WriteVarLen (TArray &file, int time) { long buffer; size_t ofs; @@ -101,7 +101,7 @@ static size_t WriteVarLen (TArray &file, int time) } for (ofs = 0;;) { - file.Push(BYTE(buffer & 0xff)); + file.Push(uint8_t(buffer & 0xff)); if (buffer & 0x80) buffer >>= 8; else @@ -110,16 +110,16 @@ static size_t WriteVarLen (TArray &file, int time) return ofs; } -bool ProduceMIDI (const BYTE *musBuf, int len, TArray &outFile) +bool ProduceMIDI (const uint8_t *musBuf, int len, TArray &outFile) { - BYTE midStatus, midArgs, mid1, mid2; + uint8_t midStatus, midArgs, mid1, mid2; size_t mus_p, maxmus_p; - BYTE event; + uint8_t event; int deltaTime; const MUSHeader *musHead; - BYTE status; - BYTE chanUsed[16]; - BYTE lastVel[16]; + uint8_t status; + uint8_t chanUsed[16]; + uint8_t lastVel[16]; long trackLen; bool no_op; @@ -159,7 +159,7 @@ bool ProduceMIDI (const BYTE *musBuf, int len, TArray &outFile) while (mus_p < maxmus_p && (event & 0x70) != MUS_SCOREEND) { int channel; - BYTE t = 0; + uint8_t t = 0; event = musBuf[mus_p++]; @@ -291,16 +291,16 @@ bool ProduceMIDI (const BYTE *musBuf, int len, TArray &outFile) // fill in track length trackLen = outFile.Size() - 22; - outFile[18] = BYTE((trackLen >> 24) & 255); - outFile[19] = BYTE((trackLen >> 16) & 255); - outFile[20] = BYTE((trackLen >> 8) & 255); - outFile[21] = BYTE(trackLen & 255); + outFile[18] = uint8_t((trackLen >> 24) & 255); + outFile[19] = uint8_t((trackLen >> 16) & 255); + outFile[20] = uint8_t((trackLen >> 8) & 255); + outFile[21] = uint8_t(trackLen & 255); return true; } -bool ProduceMIDI(const BYTE *musBuf, int len, FILE *outFile) +bool ProduceMIDI(const uint8_t *musBuf, int len, FILE *outFile) { - TArray work; + TArray work; if (ProduceMIDI(musBuf, len, work)) { return fwrite(&work[0], 1, work.Size(), outFile) == work.Size(); diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index 30c44b69c0..d4794c639f 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -131,11 +131,11 @@ void FNodeBuilder::BuildTree () CreateSubsectorsForReal (); } -int FNodeBuilder::CreateNode (DWORD set, unsigned int count, fixed_t bbox[4]) +int FNodeBuilder::CreateNode (uint32_t set, unsigned int count, fixed_t bbox[4]) { node_t node; int skip, selstat; - DWORD splitseg; + uint32_t splitseg; skip = int(count / MaxSegs); @@ -149,7 +149,7 @@ int FNodeBuilder::CreateNode (DWORD set, unsigned int count, fixed_t bbox[4]) CheckSubsector (set, node, splitseg)) { // Create a normal node - DWORD set1, set2; + uint32_t set1, set2; unsigned int count1, count2; SplitSegs (set, node, splitseg, set1, set2, count1, count2); @@ -170,7 +170,7 @@ int FNodeBuilder::CreateNode (DWORD set, unsigned int count, fixed_t bbox[4]) } } -int FNodeBuilder::CreateSubsector (DWORD set, fixed_t bbox[4]) +int FNodeBuilder::CreateSubsector (uint32_t set, fixed_t bbox[4]) { int ssnum, count; @@ -216,8 +216,8 @@ void FNodeBuilder::CreateSubsectorsForReal () for (i = 0; i < SubsectorSets.Size(); ++i) { - DWORD set = SubsectorSets[i]; - DWORD firstline = (DWORD)SegList.Size(); + uint32_t set = SubsectorSets[i]; + uint32_t firstline = (uint32_t)SegList.Size(); while (set != DWORD_MAX) { @@ -227,7 +227,7 @@ void FNodeBuilder::CreateSubsectorsForReal () SegList.Push (ptr); set = ptr.SegPtr->next; } - sub.numlines = (DWORD)(SegList.Size() - firstline); + sub.numlines = (uint32_t)(SegList.Size() - firstline); sub.firstline = (seg_t *)(size_t)firstline; // Sort segs by linedef for special effects @@ -247,7 +247,7 @@ void FNodeBuilder::CreateSubsectorsForReal () Vertices[SegList[i].SegPtr->v2].y>>16, Vertices[SegList[i].SegPtr->v1].x, Vertices[SegList[i].SegPtr->v1].y, Vertices[SegList[i].SegPtr->v2].x, Vertices[SegList[i].SegPtr->v2].y)); - SegList[i].SegNum = DWORD(SegList[i].SegPtr - &Segs[0]); + SegList[i].SegNum = uint32_t(SegList[i].SegPtr - &Segs[0]); } Subsectors.Push (sub); } @@ -318,10 +318,10 @@ int FNodeBuilder::SortSegs (const void *a, const void *b) // a splitter is synthesized, and true is returned to continue processing // down this branch of the tree. -bool FNodeBuilder::CheckSubsector (DWORD set, node_t &node, DWORD &splitseg) +bool FNodeBuilder::CheckSubsector (uint32_t set, node_t &node, uint32_t &splitseg) { sector_t *sec; - DWORD seg; + uint32_t seg; sec = NULL; seg = set; @@ -381,10 +381,10 @@ bool FNodeBuilder::CheckSubsector (DWORD set, node_t &node, DWORD &splitseg) // When creating GL nodes, we need to check for segs with the same start and // end vertices and split them into two subsectors. -bool FNodeBuilder::CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD &splitseg) +bool FNodeBuilder::CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, uint32_t &splitseg) { int v1, v2; - DWORD seg1, seg2; + uint32_t seg1, seg2; for (seg1 = set; seg1 != DWORD_MAX; seg1 = Segs[seg1].next) { @@ -424,7 +424,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD // seg in front of the splitter is partnered with a new miniseg on // the back so that the back will have two segs. -bool FNodeBuilder::ShoveSegBehind (DWORD set, node_t &node, DWORD seg, DWORD mate) +bool FNodeBuilder::ShoveSegBehind (uint32_t set, node_t &node, uint32_t seg, uint32_t mate) { SetNodeFromSeg (node, &Segs[seg]); HackSeg = seg; @@ -446,12 +446,12 @@ bool FNodeBuilder::ShoveSegBehind (DWORD set, node_t &node, DWORD seg, DWORD mat // each unique plane needs to be considered as a splitter. A result of 0 means // this set is a convex region. A result of -1 means that there were possible // splitters, but they all split segs we want to keep intact. -int FNodeBuilder::SelectSplitter (DWORD set, node_t &node, DWORD &splitseg, int step, bool nosplit) +int FNodeBuilder::SelectSplitter (uint32_t set, node_t &node, uint32_t &splitseg, int step, bool nosplit) { int stepleft; int bestvalue; - DWORD bestseg; - DWORD seg; + uint32_t bestseg; + uint32_t seg; bool nosplitters = false; bestvalue = 0; @@ -522,7 +522,7 @@ int FNodeBuilder::SelectSplitter (DWORD set, node_t &node, DWORD &splitseg, int // true. A score of 0 means that the splitter does not split any of the segs // in the set. -int FNodeBuilder::Heuristic (node_t &node, DWORD set, bool honorNoSplit) +int FNodeBuilder::Heuristic (node_t &node, uint32_t set, bool honorNoSplit) { // Set the initial score above 0 so that near vertex anti-weighting is less likely to produce a negative score. int score = 1000000; @@ -530,7 +530,7 @@ int FNodeBuilder::Heuristic (node_t &node, DWORD set, bool honorNoSplit) int counts[2] = { 0, 0 }; int realSegs[2] = { 0, 0 }; int specialSegs[2] = { 0, 0 }; - DWORD i = set; + uint32_t i = set; int sidev[2]; int side; bool splitter = false; @@ -760,7 +760,7 @@ int FNodeBuilder::Heuristic (node_t &node, DWORD set, bool honorNoSplit) return score; } -void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &outset0, DWORD &outset1, unsigned int &count0, unsigned int &count1) +void FNodeBuilder::SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uint32_t &outset0, uint32_t &outset1, unsigned int &count0, unsigned int &count1) { unsigned int _count0 = 0; unsigned int _count1 = 0; @@ -890,7 +890,7 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou } if (hack && GLNodes) { - DWORD newback, newfront; + uint32_t newback, newfront; newback = AddMiniseg (seg->v2, seg->v1, DWORD_MAX, set, splitseg); if (HackMate == DWORD_MAX) @@ -942,7 +942,7 @@ void FNodeBuilder::SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const } } -DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront) +uint32_t FNodeBuilder::SplitSeg (uint32_t segnum, int splitvert, int v1InFront) { double dx, dy; FPrivSeg newseg; @@ -991,7 +991,7 @@ DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront) return newnum; } -void FNodeBuilder::RemoveSegFromVert1 (DWORD segnum, int vertnum) +void FNodeBuilder::RemoveSegFromVert1 (uint32_t segnum, int vertnum) { FPrivVert *v = &Vertices[vertnum]; @@ -1001,7 +1001,7 @@ void FNodeBuilder::RemoveSegFromVert1 (DWORD segnum, int vertnum) } else { - DWORD prev, curr; + uint32_t prev, curr; prev = 0; curr = v->segs; while (curr != DWORD_MAX && curr != segnum) @@ -1016,7 +1016,7 @@ void FNodeBuilder::RemoveSegFromVert1 (DWORD segnum, int vertnum) } } -void FNodeBuilder::RemoveSegFromVert2 (DWORD segnum, int vertnum) +void FNodeBuilder::RemoveSegFromVert2 (uint32_t segnum, int vertnum) { FPrivVert *v = &Vertices[vertnum]; @@ -1026,7 +1026,7 @@ void FNodeBuilder::RemoveSegFromVert2 (DWORD segnum, int vertnum) } else { - DWORD prev, curr; + uint32_t prev, curr; prev = 0; curr = v->segs2; while (curr != DWORD_MAX && curr != segnum) @@ -1064,7 +1064,7 @@ double FNodeBuilder::InterceptVector (const node_t &splitter, const FPrivSeg &se return frac; } -void FNodeBuilder::PrintSet (int l, DWORD set) +void FNodeBuilder::PrintSet (int l, uint32_t set) { Printf (PRINT_LOG, "set %d:\n", l); for (; set != DWORD_MAX; set = Segs[set].next) diff --git a/src/nodebuild.h b/src/nodebuild.h index 6d730644e2..c5297190d6 100644 --- a/src/nodebuild.h +++ b/src/nodebuild.h @@ -9,7 +9,7 @@ struct FMiniBSP; struct FEventInfo { int Vertex; - DWORD FrontSeg; + uint32_t FrontSeg; }; struct FEvent @@ -62,12 +62,12 @@ class FNodeBuilder int linedef; sector_t *frontsector; sector_t *backsector; - DWORD next; - DWORD nextforvert; - DWORD nextforvert2; + uint32_t next; + uint32_t nextforvert; + uint32_t nextforvert2; int loopnum; // loop number for split avoidance (0 means splitting is okay) - DWORD partner; // seg on back side - DWORD storedseg; // seg # in the GL_SEGS lump + uint32_t partner; // seg on back side + uint32_t storedseg; // seg # in the GL_SEGS lump int planenum; bool planefront; @@ -75,8 +75,8 @@ class FNodeBuilder }; struct FPrivVert : FSimpleVert { - DWORD segs; // segs that use this vertex as v1 - DWORD segs2; // segs that use this vertex as v2 + uint32_t segs; // segs that use this vertex as v1 + uint32_t segs2; // segs that use this vertex as v2 bool operator== (const FPrivVert &other) { @@ -89,19 +89,19 @@ class FNodeBuilder }; union USegPtr { - DWORD SegNum; + uint32_t SegNum; FPrivSeg *SegPtr; }; struct FSplitSharer { double Distance; - DWORD Seg; + uint32_t Seg; bool Forward; }; struct glseg_t : public seg_t { - DWORD Partner; + uint32_t Partner; }; @@ -220,11 +220,11 @@ private: TArray Nodes; TArray Subsectors; - TArray SubsectorSets; + TArray SubsectorSets; TArray Segs; TArray Vertices; TArray SegList; - TArray PlaneChecked; + TArray PlaneChecked; TArray Planes; TArray Touched; // Loops a splitter touches on a vertex @@ -233,8 +233,8 @@ private: TArray SplitSharers; // Segs colinear with the current splitter - DWORD HackSeg; // Seg to force to back of splitter - DWORD HackMate; // Seg to use in front of hack seg + uint32_t HackSeg; // Seg to force to back of splitter + uint32_t HackMate; // Seg to use in front of hack seg FLevel &Level; bool GLNodes; // Add minisegs to make GL nodes? @@ -249,17 +249,17 @@ private: void GroupSegPlanesSimple (); void FindPolyContainers (TArray &spots, TArray &anchors); bool GetPolyExtents (int polynum, fixed_t bbox[4]); - int MarkLoop (DWORD firstseg, int loopnum); + int MarkLoop (uint32_t firstseg, int loopnum); void AddSegToBBox (fixed_t bbox[4], const FPrivSeg *seg); - int CreateNode (DWORD set, unsigned int count, fixed_t bbox[4]); - int CreateSubsector (DWORD set, fixed_t bbox[4]); + int CreateNode (uint32_t set, unsigned int count, fixed_t bbox[4]); + int CreateSubsector (uint32_t set, fixed_t bbox[4]); void CreateSubsectorsForReal (); - bool CheckSubsector (DWORD set, node_t &node, DWORD &splitseg); - bool CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD &splitseg); - bool ShoveSegBehind (DWORD set, node_t &node, DWORD seg, DWORD mate); int SelectSplitter (DWORD set, node_t &node, DWORD &splitseg, int step, bool nosplit); - void SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &outset0, DWORD &outset1, unsigned int &count0, unsigned int &count1); - DWORD SplitSeg (DWORD segnum, int splitvert, int v1InFront); - int Heuristic (node_t &node, DWORD set, bool honorNoSplit); + bool CheckSubsector (uint32_t set, node_t &node, uint32_t &splitseg); + bool CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, uint32_t &splitseg); + bool ShoveSegBehind (uint32_t set, node_t &node, uint32_t seg, uint32_t mate); int SelectSplitter (uint32_t set, node_t &node, uint32_t &splitseg, int step, bool nosplit); + void SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uint32_t &outset0, uint32_t &outset1, unsigned int &count0, unsigned int &count1); + uint32_t SplitSeg (uint32_t segnum, int splitvert, int v1InFront); + int Heuristic (node_t &node, uint32_t set, bool honorNoSplit); // Returns: // 0 = seg is in front @@ -270,16 +270,16 @@ private: void FixSplitSharers (const node_t &node); double AddIntersection (const node_t &node, int vertex); - void AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, DWORD &rset); - DWORD CheckLoopStart (fixed_t dx, fixed_t dy, int vertex1, int vertex2); - DWORD CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex2); - void RemoveSegFromVert1 (DWORD segnum, int vertnum); - void RemoveSegFromVert2 (DWORD segnum, int vertnum); - DWORD AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD splitseg); + void AddMinisegs (const node_t &node, uint32_t splitseg, uint32_t &fset, uint32_t &rset); + uint32_t CheckLoopStart (fixed_t dx, fixed_t dy, int vertex1, int vertex2); + uint32_t CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex2); + void RemoveSegFromVert1 (uint32_t segnum, int vertnum); + void RemoveSegFromVert2 (uint32_t segnum, int vertnum); + uint32_t AddMiniseg (int v1, int v2, uint32_t partner, uint32_t seg1, uint32_t splitseg); void SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const; int CloseSubsector (TArray &segs, int subsector, vertex_t *outVerts); - DWORD PushGLSeg (TArray &segs, const FPrivSeg *seg, vertex_t *outVerts); + uint32_t PushGLSeg (TArray &segs, const FPrivSeg *seg, vertex_t *outVerts); void PushConnectingGLSeg (int subsector, TArray &segs, vertex_t *v1, vertex_t *v2); int OutputDegenerateSubsector (TArray &segs, int subsector, bool bForward, double lastdot, FPrivSeg *&prev, vertex_t *outVerts); @@ -287,7 +287,7 @@ private: double InterceptVector (const node_t &splitter, const FPrivSeg &seg); - void PrintSet (int l, DWORD set); + void PrintSet (int l, uint32_t set); FNodeBuilder &operator= (const FNodeBuilder &) { return *this; } }; diff --git a/src/nodebuild_extract.cpp b/src/nodebuild_extract.cpp index bdb3434497..98ade3f780 100644 --- a/src/nodebuild_extract.cpp +++ b/src/nodebuild_extract.cpp @@ -86,7 +86,7 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount, if (outNodes[i].intchildren[j] & 0x80000000) { D(Printf(PRINT_LOG, " subsector %d\n", outNodes[i].intchildren[j] & 0x7FFFFFFF)); - outNodes[i].children[j] = (BYTE *)(outSubs + (outNodes[i].intchildren[j] & 0x7fffffff)) + 1; + outNodes[i].children[j] = (uint8_t *)(outSubs + (outNodes[i].intchildren[j] & 0x7fffffff)) + 1; } else { @@ -109,7 +109,7 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount, for (i = 0; i < subCount; ++i) { - DWORD numsegs = CloseSubsector (segs, i, &outVerts[0]); + uint32_t numsegs = CloseSubsector (segs, i, &outVerts[0]); outSubs[i].numlines = numsegs; outSubs[i].firstline = (seg_t *)(size_t)(segs.Size() - numsegs); } @@ -123,7 +123,7 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount, if (segs[i].Partner != DWORD_MAX) { - const DWORD storedseg = Segs[segs[i].Partner].storedseg; + const uint32_t storedseg = Segs[segs[i].Partner].storedseg; outSegs[i].PartnerSeg = DWORD_MAX == storedseg ? nullptr : &outSegs[storedseg]; } else @@ -193,7 +193,7 @@ void FNodeBuilder::ExtractMini (FMiniBSP *bsp) if (bsp->Nodes[i].intchildren[j] & 0x80000000) { D(Printf(PRINT_LOG, " subsector %d\n", bsp->Nodes[i].intchildren[j] & 0x7FFFFFFF)); - bsp->Nodes[i].children[j] = (BYTE *)&bsp->Subsectors[bsp->Nodes[i].intchildren[j] & 0x7fffffff] + 1; + bsp->Nodes[i].children[j] = (uint8_t *)&bsp->Subsectors[bsp->Nodes[i].intchildren[j] & 0x7fffffff] + 1; } else { @@ -215,7 +215,7 @@ void FNodeBuilder::ExtractMini (FMiniBSP *bsp) TArray glsegs; for (i = 0; i < Subsectors.Size(); ++i) { - DWORD numsegs = CloseSubsector (glsegs, i, &bsp->Verts[0]); + uint32_t numsegs = CloseSubsector (glsegs, i, &bsp->Verts[0]); bsp->Subsectors[i].numlines = numsegs; bsp->Subsectors[i].firstline = &bsp->Segs[bsp->Segs.Size() - numsegs]; } @@ -265,11 +265,11 @@ int FNodeBuilder::CloseSubsector (TArray &segs, int subsector, vertex_t double accumx, accumy; fixed_t midx, midy; int firstVert; - DWORD first, max, count, i, j; + uint32_t first, max, count, i, j; bool diffplanes; int firstplane; - first = (DWORD)(size_t)Subsectors[subsector].firstline; + first = (uint32_t)(size_t)Subsectors[subsector].firstline; max = first + Subsectors[subsector].numlines; count = 0; @@ -329,7 +329,7 @@ int FNodeBuilder::CloseSubsector (TArray &segs, int subsector, vertex_t { angle_t bestdiff = ANGLE_MAX; FPrivSeg *bestseg = NULL; - DWORD bestj = DWORD_MAX; + uint32_t bestj = DWORD_MAX; j = first; do { @@ -434,7 +434,7 @@ int FNodeBuilder::OutputDegenerateSubsector (TArray &segs, int subsecto double dot, x1, y1, dx, dy, dx2, dy2; bool wantside; - first = (DWORD)(size_t)Subsectors[subsector].firstline; + first = (uint32_t)(size_t)Subsectors[subsector].firstline; max = first + Subsectors[subsector].numlines; count = 0; @@ -493,7 +493,7 @@ int FNodeBuilder::OutputDegenerateSubsector (TArray &segs, int subsecto return count; } -DWORD FNodeBuilder::PushGLSeg (TArray &segs, const FPrivSeg *seg, vertex_t *outVerts) +uint32_t FNodeBuilder::PushGLSeg (TArray &segs, const FPrivSeg *seg, vertex_t *outVerts) { glseg_t newseg; @@ -512,7 +512,7 @@ DWORD FNodeBuilder::PushGLSeg (TArray &segs, const FPrivSeg *seg, verte newseg.sidedef = NULL; } newseg.Partner = seg->partner; - return (DWORD)segs.Push (newseg); + return (uint32_t)segs.Push (newseg); } void FNodeBuilder::PushConnectingGLSeg (int subsector, TArray &segs, vertex_t *v1, vertex_t *v2) diff --git a/src/nodebuild_gl.cpp b/src/nodebuild_gl.cpp index 61bed0727e..db9d716ac0 100644 --- a/src/nodebuild_gl.cpp +++ b/src/nodebuild_gl.cpp @@ -87,7 +87,7 @@ void FNodeBuilder::FixSplitSharers (const node_t &node) D(Events.PrintTree()); for (unsigned int i = 0; i < SplitSharers.Size(); ++i) { - DWORD seg = SplitSharers[i].Seg; + uint32_t seg = SplitSharers[i].Seg; int v2 = Segs[seg].v2; FEvent *event = Events.FindEvent (SplitSharers[i].Distance); FEvent *next; @@ -136,12 +136,12 @@ void FNodeBuilder::FixSplitSharers (const node_t &node) Vertices[event->Info.Vertex].x>>16, Vertices[event->Info.Vertex].y>>16)); - DWORD newseg = SplitSeg (seg, event->Info.Vertex, 1); + uint32_t newseg = SplitSeg (seg, event->Info.Vertex, 1); Segs[newseg].next = Segs[seg].next; Segs[seg].next = newseg; - DWORD partner = Segs[seg].partner; + uint32_t partner = Segs[seg].partner; if (partner != DWORD_MAX) { int endpartner = SplitSeg (partner, event->Info.Vertex, 1); @@ -168,7 +168,7 @@ void FNodeBuilder::FixSplitSharers (const node_t &node) } } -void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, DWORD &bset) +void FNodeBuilder::AddMinisegs (const node_t &node, uint32_t splitseg, uint32_t &fset, uint32_t &bset) { FEvent *event = Events.GetMinimum (), *prev = NULL; @@ -176,8 +176,8 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, { if (prev != NULL) { - DWORD fseg1, bseg1, fseg2, bseg2; - DWORD fnseg, bnseg; + uint32_t fseg1, bseg1, fseg2, bseg2; + uint32_t fnseg, bnseg; // Minisegs should only be added when they can create valid loops on both the front and // back of the splitter. This means some subsectors could be unclosed if their sectors @@ -234,9 +234,9 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, } } -DWORD FNodeBuilder::AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD splitseg) +uint32_t FNodeBuilder::AddMiniseg (int v1, int v2, uint32_t partner, uint32_t seg1, uint32_t splitseg) { - DWORD nseg; + uint32_t nseg; FPrivSeg *seg = &Segs[seg1]; FPrivSeg newseg; @@ -283,13 +283,13 @@ DWORD FNodeBuilder::AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD return nseg; } -DWORD FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int vertex2) +uint32_t FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int vertex2) { FPrivVert *v = &Vertices[vertex]; angle_t splitAngle = PointToAngle (dx, dy); - DWORD segnum; + uint32_t segnum; angle_t bestang; - DWORD bestseg; + uint32_t bestseg; // Find the seg ending at this vertex that forms the smallest angle // to the splitter. @@ -342,13 +342,13 @@ DWORD FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int vert return bestseg; } -DWORD FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex) +uint32_t FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex) { FPrivVert *v = &Vertices[vertex]; angle_t splitAngle = PointToAngle (dx, dy) + ANGLE_180; - DWORD segnum; + uint32_t segnum; angle_t bestang; - DWORD bestseg; + uint32_t bestseg; // Find the seg starting at this vertex that forms the smallest angle // to the splitter. diff --git a/src/nodebuild_utility.cpp b/src/nodebuild_utility.cpp index b6115f4c8e..f27b95485e 100644 --- a/src/nodebuild_utility.cpp +++ b/src/nodebuild_utility.cpp @@ -486,9 +486,9 @@ void FNodeBuilder::FindPolyContainers (TArray &spots, TArrayv1].x>>16, Vertices[s1->v1].y>>16, Vertices[s1->v2].x>>16, Vertices[s1->v2].y>>16)); - DWORD bestseg = DWORD_MAX; - DWORD tryseg = Vertices[s1->v2].segs; + uint32_t bestseg = DWORD_MAX; + uint32_t tryseg = Vertices[s1->v2].segs; angle_t bestang = ANGLE_MAX; angle_t ang1 = PointToAngle (Vertices[s1->v2].x - Vertices[s1->v1].x, Vertices[s1->v2].y - Vertices[s1->v1].y); diff --git a/src/oplsynth/dosbox/opl.cpp b/src/oplsynth/dosbox/opl.cpp index 64b77ce8c9..f7c81ee4af 100644 --- a/src/oplsynth/dosbox/opl.cpp +++ b/src/oplsynth/dosbox/opl.cpp @@ -38,7 +38,7 @@ typedef DWORD Bit32u; typedef int32_t Bit32s; typedef WORD Bit16u; typedef SWORD Bit16s; -typedef BYTE Bit8u; +typedef uint8_t Bit8u; typedef SBYTE Bit8s; #define OPLTYPE_IS_OPL3 diff --git a/src/oplsynth/mlopl.cpp b/src/oplsynth/mlopl.cpp index bbff8b5fda..87cd7f450f 100644 --- a/src/oplsynth/mlopl.cpp +++ b/src/oplsynth/mlopl.cpp @@ -474,7 +474,7 @@ int musicBlock::OPLloadBank (FileReader &data) for (int i = 0; i < 175; ++i) { Printf ("%3d.%-33s%3d %3d %3d %d\n", i, - (BYTE *)data+6308+i*32, + (uint8_t *)data+6308+i*32, OPLinstruments[i].instr[0].basenote, OPLinstruments[i].instr[1].basenote, OPLinstruments[i].note, diff --git a/src/oplsynth/mlopl_io.cpp b/src/oplsynth/mlopl_io.cpp index 4e88ac1082..cd4b3dd559 100644 --- a/src/oplsynth/mlopl_io.cpp +++ b/src/oplsynth/mlopl_io.cpp @@ -195,8 +195,8 @@ void OPLio::OPLwriteFreq(uint32_t channel, uint32_t note, uint32_t pitch, uint32 } int i = frequencies[j] | (octave << 10); - OPLwriteValue (0xA0, channel, (BYTE)i); - OPLwriteValue (0xB0, channel, (BYTE)(i>>8)|(keyon<<5)); + OPLwriteValue (0xA0, channel, (uint8_t)i); + OPLwriteValue (0xB0, channel, (uint8_t)(i>>8)|(keyon<<5)); } /* diff --git a/src/oplsynth/music_opl_mididevice.cpp b/src/oplsynth/music_opl_mididevice.cpp index 853a679c44..f6cfab30ed 100644 --- a/src/oplsynth/music_opl_mididevice.cpp +++ b/src/oplsynth/music_opl_mididevice.cpp @@ -252,7 +252,7 @@ void OPLMIDIDevice::HandleEvent(int status, int parm1, int parm2) // //========================================================================== -void OPLMIDIDevice::HandleLongEvent(const BYTE *data, int len) +void OPLMIDIDevice::HandleLongEvent(const uint8_t *data, int len) { } diff --git a/src/oplsynth/music_opldumper_mididevice.cpp b/src/oplsynth/music_opldumper_mididevice.cpp index cf20a0e737..6ea7ee63bf 100644 --- a/src/oplsynth/music_opldumper_mididevice.cpp +++ b/src/oplsynth/music_opldumper_mididevice.cpp @@ -71,7 +71,7 @@ protected: double CurTime; int CurIntTime; int TickMul; - BYTE CurChip; + uint8_t CurChip; }; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -110,16 +110,16 @@ public: virtual void WriteReg(int reg, int v) { assert(File != NULL); - BYTE chipnum = reg >> 8; + uint8_t chipnum = reg >> 8; if (chipnum != CurChip) { - BYTE switcher[2] = { (BYTE)(chipnum + 1), 2 }; + uint8_t switcher[2] = { (uint8_t)(chipnum + 1), 2 }; fwrite(switcher, 1, 2, File); } reg &= 255; if (reg != 0 && reg != 2 && (reg != 255 || v != 255)) { - BYTE cmd[2] = { BYTE(v), BYTE(reg) }; + uint8_t cmd[2] = { uint8_t(v), uint8_t(reg) }; fwrite(cmd, 1, 2, File); } } @@ -153,7 +153,7 @@ public: } else { // Change the clock rate in the middle of the song. - BYTE clock_change[4] = { 0, 2, BYTE(clock_word & 255), BYTE(clock_word >> 8) }; + uint8_t clock_change[4] = { 0, 2, uint8_t(clock_word & 255), uint8_t(clock_word >> 8) }; fwrite(clock_change, 1, 4, File); } } @@ -162,7 +162,7 @@ public: if (ticks > 0) { // RDos raw has very precise delays but isn't very efficient at // storing long delays. - BYTE delay[2]; + uint8_t delay[2]; ticks *= TickMul; delay[1] = 0; @@ -172,7 +172,7 @@ public: delay[0] = 255; fwrite(delay, 1, 2, File); } - delay[0] = BYTE(ticks); + delay[0] = uint8_t(ticks); fwrite(delay, 1, 2, File); } } @@ -212,14 +212,14 @@ public: virtual void WriteReg(int reg, int v) { assert(File != NULL); - BYTE chipnum = reg >> 8; + uint8_t chipnum = reg >> 8; if (chipnum != CurChip) { CurChip = chipnum; fputc(chipnum + 2, File); } reg &= 255; - BYTE cmd[3] = { 4, BYTE(reg), BYTE(v) }; + uint8_t cmd[3] = { 4, uint8_t(reg), uint8_t(v) }; fwrite (cmd + (reg > 4), 1, 3 - (reg > 4), File); } virtual void WriteDelay(int ticks) @@ -233,20 +233,20 @@ public: CurIntTime += delay; while (delay > 65536) { - BYTE cmd[3] = { 1, 255, 255 }; + uint8_t cmd[3] = { 1, 255, 255 }; fwrite(cmd, 1, 2, File); delay -= 65536; } delay--; if (delay <= 255) { - BYTE cmd[2] = { 0, BYTE(delay) }; + uint8_t cmd[2] = { 0, uint8_t(delay) }; fwrite(cmd, 1, 2, File); } else { assert(delay <= 65535); - BYTE cmd[3] = { 1, BYTE(delay & 255), BYTE(delay >> 8) }; + uint8_t cmd[3] = { 1, uint8_t(delay & 255), uint8_t(delay >> 8) }; fwrite(cmd, 1, 3, File); } } diff --git a/src/oplsynth/muslib.h b/src/oplsynth/muslib.h index 9091c85366..eb4682b32a 100644 --- a/src/oplsynth/muslib.h +++ b/src/oplsynth/muslib.h @@ -88,28 +88,28 @@ class FileReader; /* OPL2 instrument */ struct OPL2instrument { -/*00*/ BYTE trem_vibr_1; /* OP 1: tremolo/vibrato/sustain/KSR/multi */ -/*01*/ BYTE att_dec_1; /* OP 1: attack rate/decay rate */ -/*02*/ BYTE sust_rel_1; /* OP 1: sustain level/release rate */ -/*03*/ BYTE wave_1; /* OP 1: waveform select */ -/*04*/ BYTE scale_1; /* OP 1: key scale level */ -/*05*/ BYTE level_1; /* OP 1: output level */ -/*06*/ BYTE feedback; /* feedback/AM-FM (both operators) */ -/*07*/ BYTE trem_vibr_2; /* OP 2: tremolo/vibrato/sustain/KSR/multi */ -/*08*/ BYTE att_dec_2; /* OP 2: attack rate/decay rate */ -/*09*/ BYTE sust_rel_2; /* OP 2: sustain level/release rate */ -/*0A*/ BYTE wave_2; /* OP 2: waveform select */ -/*0B*/ BYTE scale_2; /* OP 2: key scale level */ -/*0C*/ BYTE level_2; /* OP 2: output level */ -/*0D*/ BYTE unused; +/*00*/ uint8_t trem_vibr_1; /* OP 1: tremolo/vibrato/sustain/KSR/multi */ +/*01*/ uint8_t att_dec_1; /* OP 1: attack rate/decay rate */ +/*02*/ uint8_t sust_rel_1; /* OP 1: sustain level/release rate */ +/*03*/ uint8_t wave_1; /* OP 1: waveform select */ +/*04*/ uint8_t scale_1; /* OP 1: key scale level */ +/*05*/ uint8_t level_1; /* OP 1: output level */ +/*06*/ uint8_t feedback; /* feedback/AM-FM (both operators) */ +/*07*/ uint8_t trem_vibr_2; /* OP 2: tremolo/vibrato/sustain/KSR/multi */ +/*08*/ uint8_t att_dec_2; /* OP 2: attack rate/decay rate */ +/*09*/ uint8_t sust_rel_2; /* OP 2: sustain level/release rate */ +/*0A*/ uint8_t wave_2; /* OP 2: waveform select */ +/*0B*/ uint8_t scale_2; /* OP 2: key scale level */ +/*0C*/ uint8_t level_2; /* OP 2: output level */ +/*0D*/ uint8_t unused; /*0E*/ int16_t basenote; /* base note offset */ }; /* OP2 instrument file entry */ struct OP2instrEntry { /*00*/ WORD flags; // see FL_xxx below -/*02*/ BYTE finetune; // finetune value for 2-voice sounds -/*03*/ BYTE note; // note # for fixed instruments +/*02*/ uint8_t finetune; // finetune value for 2-voice sounds +/*03*/ uint8_t note; // note # for fixed instruments /*04*/ struct OPL2instrument instr[2]; // instruments }; @@ -188,8 +188,8 @@ struct musicBlock { musicBlock(); ~musicBlock(); - BYTE *score; - BYTE *scoredata; + uint8_t *score; + uint8_t *scoredata; int playingcount; OPLdata driverdata; OPLio *io; diff --git a/src/oplsynth/nukedopl3.h b/src/oplsynth/nukedopl3.h index 5b1392542d..9421814ac0 100644 --- a/src/oplsynth/nukedopl3.h +++ b/src/oplsynth/nukedopl3.h @@ -38,7 +38,7 @@ typedef DWORD Bit32u; typedef int32_t Bit32s; typedef WORD Bit16u; typedef SWORD Bit16s; -typedef BYTE Bit8u; +typedef uint8_t Bit8u; typedef SBYTE Bit8s; // Channel types diff --git a/src/oplsynth/opl_mus_player.cpp b/src/oplsynth/opl_mus_player.cpp index 465f89592c..da28d9ce54 100644 --- a/src/oplsynth/opl_mus_player.cpp +++ b/src/oplsynth/opl_mus_player.cpp @@ -60,7 +60,7 @@ OPLmusicFile::OPLmusicFile (FileReader *reader) return; } - scoredata = new BYTE[ScoreLen]; + scoredata = new uint8_t[ScoreLen]; if (reader->Read(scoredata, ScoreLen) != ScoreLen) { @@ -126,7 +126,7 @@ fail: delete[] scoredata; scoredata[4] == 'B' && scoredata[5] == 1) { int songlen; - BYTE *max = scoredata + ScoreLen; + uint8_t *max = scoredata + ScoreLen; RawPlayer = IMF; SamplesPerTick = OPL_SAMPLE_RATE / IMF_RATE; @@ -363,7 +363,7 @@ void OPLmusicBlock::OffsetSamples(float *buff, int count) int OPLmusicFile::PlayTick () { - BYTE reg, data; + uint8_t reg, data; WORD delay; switch (RawPlayer) @@ -453,14 +453,14 @@ int OPLmusicFile::PlayTick () case DosBox2: { - BYTE *to_reg = scoredata + 0x1A; - BYTE to_reg_size = scoredata[0x19]; - BYTE short_delay_code = scoredata[0x17]; - BYTE long_delay_code = scoredata[0x18]; + uint8_t *to_reg = scoredata + 0x1A; + uint8_t to_reg_size = scoredata[0x19]; + uint8_t short_delay_code = scoredata[0x17]; + uint8_t long_delay_code = scoredata[0x18]; while (score < scoredata + ScoreLen) { - BYTE code = *score++; + uint8_t code = *score++; data = *score++; // Which OPL chip to write to is encoded in the high bit of the code value. @@ -512,7 +512,7 @@ ADD_STAT (opl) OPLmusicFile::OPLmusicFile(const OPLmusicFile *source, const char *filename) { ScoreLen = source->ScoreLen; - scoredata = new BYTE[ScoreLen]; + scoredata = new uint8_t[ScoreLen]; memcpy(scoredata, source->scoredata, ScoreLen); SamplesPerTick = source->SamplesPerTick; RawPlayer = source->RawPlayer; diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 637ca0d7fc..3017d0c9b1 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -320,7 +320,7 @@ private: PalEntry m_palette[256]; bool m_needPaletteUpdate; - BYTE m_gammaTable[3][256]; + uint8_t m_gammaTable[3][256]; float m_gamma; bool m_needGammaUpdate; @@ -1498,7 +1498,7 @@ bool I_SetCursor(FTexture* cursorpic) // Load bitmap data to representation - BYTE* buffer = [bitmapImageRep bitmapData]; + uint8_t* buffer = [bitmapImageRep bitmapData]; memset(buffer, 0, imagePitch * imageHeight); FBitmap bitmap(buffer, imagePitch, imageWidth, imageHeight); @@ -1510,7 +1510,7 @@ bool I_SetCursor(FTexture* cursorpic) { const size_t offset = i * 4; - const BYTE temp = buffer[offset ]; + const uint8_t temp = buffer[offset ]; buffer[offset ] = buffer[offset + 2]; buffer[offset + 2] = temp; } diff --git a/src/posix/sdl/i_input.cpp b/src/posix/sdl/i_input.cpp index 57ea03d928..fc705e8554 100644 --- a/src/posix/sdl/i_input.cpp +++ b/src/posix/sdl/i_input.cpp @@ -110,9 +110,9 @@ static const SDL_Scancode DIKToKeyScan[256] = SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN }; -static TMap InitKeySymMap () +static TMap InitKeySymMap () { - TMap KeySymToDIK; + TMap KeySymToDIK; for (int i = 0; i < 256; ++i) { @@ -127,11 +127,11 @@ static TMap InitKeySymMap () return KeySymToDIK; } -static const TMap KeySymToDIK(InitKeySymMap()); +static const TMap KeySymToDIK(InitKeySymMap()); -static TMap InitKeyScanMap () +static TMap InitKeyScanMap () { - TMap KeyScanToDIK; + TMap KeyScanToDIK; for (int i = 0; i < 256; ++i) { @@ -140,7 +140,7 @@ static TMap InitKeyScanMap () return KeyScanToDIK; } -static const TMap KeyScanToDIK(InitKeyScanMap()); +static const TMap KeyScanToDIK(InitKeyScanMap()); static void I_CheckGUICapture () { @@ -377,9 +377,9 @@ void MessagePump (const SDL_Event &sev) // If that fails, then we'll do a lookup against the scan code, // which may not return the right key, but at least the key should // work in the game. - if (const BYTE *dik = KeySymToDIK.CheckKey (sev.key.keysym.sym)) + if (const uint8_t *dik = KeySymToDIK.CheckKey (sev.key.keysym.sym)) event.data1 = *dik; - else if (const BYTE *dik = KeyScanToDIK.CheckKey (sev.key.keysym.scancode)) + else if (const uint8_t *dik = KeyScanToDIK.CheckKey (sev.key.keysym.scancode)) event.data1 = *dik; if (event.data1) diff --git a/src/posix/sdl/sdlvideo.cpp b/src/posix/sdl/sdlvideo.cpp index 4a68330260..3404e415e7 100644 --- a/src/posix/sdl/sdlvideo.cpp +++ b/src/posix/sdl/sdlvideo.cpp @@ -511,7 +511,7 @@ void SDLFB::Update () { for (int y = 0; y < Height; ++y) { - memcpy ((BYTE *)pixels+y*pitch, MemBuffer+y*Pitch, Width); + memcpy ((uint8_t *)pixels+y*pitch, MemBuffer+y*Pitch, Width); } } } diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index f8820b0df3..64f00b5bc3 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -57,7 +57,7 @@ TAutoGrowArray translationtables[NUM_TRANSLATION_TABLES]; -const BYTE IcePalette[16][3] = +const uint8_t IcePalette[16][3] = { { 10, 8, 18 }, { 15, 15, 26 }, @@ -109,7 +109,7 @@ FRemapTable::~FRemapTable() void FRemapTable::Alloc(int count) { - Remap = (BYTE *)M_Malloc(count*sizeof(*Remap) + count*sizeof(*Palette)); + Remap = (uint8_t *)M_Malloc(count*sizeof(*Remap) + count*sizeof(*Palette)); assert (Remap != NULL); Palette = (PalEntry *)(Remap + count*(sizeof(*Remap))); Native = NULL; @@ -934,7 +934,7 @@ void R_InitTranslationTables () // Doom palette has no good substitutes for these bluish-tinted grays, so // they will just look gray unless you use a different PLAYPAL with Doom. - BYTE IcePaletteRemap[16]; + uint8_t IcePaletteRemap[16]; for (i = 0; i < 16; ++i) { IcePaletteRemap[i] = ColorMatcher.Pick (IcePalette[i][0], IcePalette[i][1], IcePalette[i][2]); @@ -1060,8 +1060,8 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC FPlayerSkin *skin, FRemapTable *table, FRemapTable *alttable, FRemapTable *pillartable) { int i; - BYTE start = skin->range0start; - BYTE end = skin->range0end; + uint8_t start = skin->range0start; + uint8_t end = skin->range0end; float r, g, b; float bases, basev; float sdelta, vdelta; @@ -1125,7 +1125,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC else { FMemLump translump = Wads.ReadLump(colorset->Lump); - const BYTE *trans = (const BYTE *)translump.GetMem(); + const uint8_t *trans = (const uint8_t *)translump.GetMem(); for (i = start; i <= end; ++i) { table->Remap[i] = GPalette.Remap[trans[i]]; diff --git a/src/r_data/r_translate.h b/src/r_data/r_translate.h index 6c0fe8c77f..bd13550cc2 100644 --- a/src/r_data/r_translate.h +++ b/src/r_data/r_translate.h @@ -47,7 +47,7 @@ struct FRemapTable void AddToTranslation(const char * range); int StoreTranslation(int slot); - BYTE *Remap; // For the software renderer + uint8_t *Remap; // For the software renderer PalEntry *Palette; // The ideal palette this maps to FNativePalette *Native; // The Palette stored in a HW texture int NumEntries; // # of elements in this table (usually 256) @@ -81,7 +81,7 @@ extern TAutoGrowArray translationtables[NUM_TRANS #define TRANSLATION_MASK ((1< BloodTranslationColors; diff --git a/src/r_data/renderstyle.cpp b/src/r_data/renderstyle.cpp index 5c9dcc429b..c44b136a09 100644 --- a/src/r_data/renderstyle.cpp +++ b/src/r_data/renderstyle.cpp @@ -64,7 +64,7 @@ FRenderStyle LegacyRenderStyles[STYLE_Count] = #else FRenderStyle LegacyRenderStyles[STYLE_Count]; -static const BYTE Styles[STYLE_Count * 4] = +static const uint8_t Styles[STYLE_Count * 4] = { STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0, STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1, diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index d6d6aa4e11..1d7e051086 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -31,7 +31,7 @@ struct spriteframewithrotate : public spriteframe_t // [RH] skin globals TArray Skins; -BYTE OtherGameSkinRemap[256]; +uint8_t OtherGameSkinRemap[256]; PalEntry OtherGameSkinPalette[256]; @@ -893,7 +893,7 @@ CCMD (skins) static void R_CreateSkinTranslation (const char *palname) { FMemLump lump = Wads.ReadLump (palname); - const BYTE *otherPal = (BYTE *)lump.GetMem(); + const uint8_t *otherPal = (uint8_t *)lump.GetMem(); for (int i = 0; i < 256; ++i) { diff --git a/src/r_data/sprites.h b/src/r_data/sprites.h index 9e7d9392ec..beeff22f42 100644 --- a/src/r_data/sprites.h +++ b/src/r_data/sprites.h @@ -34,7 +34,7 @@ struct spritedef_t char name[5]; DWORD dwName; }; - BYTE numframes; + uint8_t numframes; WORD spriteframes; }; @@ -49,9 +49,9 @@ class FPlayerSkin public: FString Name; FString Face; - BYTE gender = 0; // This skin's gender (not really used) - BYTE range0start = 0; - BYTE range0end = 0; + uint8_t gender = 0; // This skin's gender (not really used) + uint8_t range0start = 0; + uint8_t range0end = 0; bool othergame = 0; // [GRB] DVector2 Scale = { 1, 1 }; int sprite = 0; @@ -61,7 +61,7 @@ public: extern TArray Skins; -extern BYTE OtherGameSkinRemap[256]; +extern uint8_t OtherGameSkinRemap[256]; extern PalEntry OtherGameSkinPalette[256]; void R_InitSprites (); diff --git a/src/r_utility.cpp b/src/r_utility.cpp index a7a3860bb2..a422c3126b 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -132,7 +132,7 @@ double ViewSin, ViewTanSin; AActor *camera; // [RH] camera to draw from. doesn't have to be a player double r_TicFracF; // same as floating point -DWORD r_FrameTime; // [RH] Time this frame started drawing (in ms) +uint32_t r_FrameTime; // [RH] Time this frame started drawing (in ms) bool r_NoInterpolate; bool r_showviewer; @@ -324,7 +324,7 @@ subsector_t *R_PointInSubsector (fixed_t x, fixed_t y) } while (!((size_t)node & 1)); - return (subsector_t *)((BYTE *)node - 1); + return (subsector_t *)((uint8_t *)node - 1); } //========================================================================== diff --git a/src/r_utility.h b/src/r_utility.h index dfea0fe33c..053af0924c 100644 --- a/src/r_utility.h +++ b/src/r_utility.h @@ -39,7 +39,7 @@ extern bool LocalKeyboardTurner; // [RH] The local player used the keyboard t extern float WidescreenRatio; extern double r_TicFracF; -extern DWORD r_FrameTime; +extern uint32_t r_FrameTime; extern int extralight; extern unsigned int R_OldBlend; diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 9968f7e52c..5aa52981d0 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -163,10 +163,10 @@ enum SICommands struct FBloodSFX { - DWORD RelVol; // volume, 0-255 + uint32_t RelVol; // volume, 0-255 int Pitch; // pitch change int PitchRange; // range of random pitch - DWORD Format; // format of audio 1=11025 5=22050 + uint32_t Format; // format of audio 1=11025 5=22050 int32_t LoopStart; // loop position (-1 means no looping) char RawName[9]; // name of RAW resource }; @@ -270,7 +270,7 @@ static TArray PlayerSounds; static FString DefPlayerClassName; static int DefPlayerClass; -static BYTE CurrentPitchMask; +static uint8_t CurrentPitchMask; static FRandom pr_randsound ("RandSound"); diff --git a/src/s_environment.cpp b/src/s_environment.cpp index 377537a6c9..4dafa706e6 100644 --- a/src/s_environment.cpp +++ b/src/s_environment.cpp @@ -489,7 +489,7 @@ static void ReadReverbDef (int lump) char *name; int id1, id2, i, j; bool inited[NUM_REVERB_FIELDS]; - BYTE bools[32]; + uint8_t bools[32]; sc.OpenLumpNum(lump); while (sc.GetString ()) diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index f8242717da..71cb943f82 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -97,7 +97,7 @@ typedef enum struct hexenseq_t { ENamedName Name; - BYTE Seqs[4]; + uint8_t Seqs[4]; }; class DSeqActorNode : public DSeqNode @@ -203,7 +203,7 @@ struct FSoundSequencePtrArray : public TArray static void AssignTranslations (FScanner &sc, int seq, seqtype_t type); static void AssignHexenTranslations (void); -static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, const TArray &ScriptTemp); +static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, const TArray &ScriptTemp); static int FindSequence (const char *searchname); static int FindSequence (FName seqname); static bool TwiddleSeqNum (int &sequence, seqtype_t type); @@ -559,7 +559,7 @@ void S_ClearSndSeq() void S_ParseSndSeq (int levellump) { - TArray ScriptTemp; + TArray ScriptTemp; int lastlump, lump; char seqtype = ':'; FName seqname; @@ -785,13 +785,13 @@ void S_ParseSndSeq (int levellump) AssignHexenTranslations (); } -static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, const TArray &ScriptTemp) +static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, const TArray &ScriptTemp) { - Sequences[curseq] = (FSoundSequence *)M_Malloc (sizeof(FSoundSequence) + sizeof(DWORD)*ScriptTemp.Size()); + Sequences[curseq] = (FSoundSequence *)M_Malloc (sizeof(FSoundSequence) + sizeof(uint32_t)*ScriptTemp.Size()); Sequences[curseq]->SeqName = seqname; Sequences[curseq]->Slot = slot; Sequences[curseq]->StopSound = FSoundID(stopsound); - memcpy (Sequences[curseq]->Script, &ScriptTemp[0], sizeof(DWORD)*ScriptTemp.Size()); + memcpy (Sequences[curseq]->Script, &ScriptTemp[0], sizeof(uint32_t)*ScriptTemp.Size()); Sequences[curseq]->Script[ScriptTemp.Size()] = MakeCommand(SS_CMD_END, 0); } diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 89fc13365a..544149ca3a 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -131,7 +131,7 @@ FSoundChan *Channels; FSoundChan *FreeChannels; FRolloffInfo S_Rolloff; -BYTE *S_SoundCurve; +uint8_t *S_SoundCurve; int S_SoundCurveSize; FBoolCVar noisedebug ("noise", false, 0); // [RH] Print sound debugging info? @@ -301,7 +301,7 @@ void S_Init () if (curvelump >= 0) { S_SoundCurveSize = Wads.LumpLength (curvelump); - S_SoundCurve = new BYTE[S_SoundCurveSize]; + S_SoundCurve = new uint8_t[S_SoundCurveSize]; Wads.ReadLump(curvelump, S_SoundCurve); } @@ -1398,7 +1398,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx) if (size > 0) { FWadLump wlump = Wads.OpenLumpNum(sfx->lumpnum); - BYTE *sfxdata = new BYTE[size]; + uint8_t *sfxdata = new uint8_t[size]; wlump.Read(sfxdata, size); int32_t dmxlen = LittleLong(((int32_t *)sfxdata)[1]); std::pair snd; @@ -1414,9 +1414,9 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx) snd = GSnd->LoadSoundRaw(sfxdata, size, sfx->RawRate, 1, 8, sfx->LoopStart); } // Otherwise, try the sound as DMX format. - else if (((BYTE *)sfxdata)[0] == 3 && ((BYTE *)sfxdata)[1] == 0 && dmxlen <= size - 8) + else if (((uint8_t *)sfxdata)[0] == 3 && ((uint8_t *)sfxdata)[1] == 0 && dmxlen <= size - 8) { - int frequency = LittleShort(((WORD *)sfxdata)[1]); + int frequency = LittleShort(((uint16_t *)sfxdata)[1]); if (frequency == 0) frequency = 11025; snd = GSnd->LoadSoundRaw(sfxdata+8, dmxlen, frequency, 1, 8, sfx->LoopStart); } @@ -1458,7 +1458,7 @@ static void S_LoadSound3D(sfxinfo_t *sfx) if(size <= 0) return; FWadLump wlump = Wads.OpenLumpNum(sfx->lumpnum); - BYTE *sfxdata = new BYTE[size]; + uint8_t *sfxdata = new uint8_t[size]; wlump.Read(sfxdata, size); int32_t dmxlen = LittleLong(((int32_t *)sfxdata)[1]); std::pair snd; @@ -1474,9 +1474,9 @@ static void S_LoadSound3D(sfxinfo_t *sfx) snd = GSnd->LoadSoundRaw(sfxdata, size, sfx->RawRate, 1, 8, sfx->LoopStart, true); } // Otherwise, try the sound as DMX format. - else if (((BYTE *)sfxdata)[0] == 3 && ((BYTE *)sfxdata)[1] == 0 && dmxlen <= size - 8) + else if (((uint8_t *)sfxdata)[0] == 3 && ((uint8_t *)sfxdata)[1] == 0 && dmxlen <= size - 8) { - int frequency = LittleShort(((WORD *)sfxdata)[1]); + int frequency = LittleShort(((uint16_t *)sfxdata)[1]); if (frequency == 0) frequency = 11025; snd = GSnd->LoadSoundRaw(sfxdata+8, dmxlen, frequency, 1, 8, sfx->LoopStart, -1, true); } diff --git a/src/s_sound.h b/src/s_sound.h index f3df32e650..541a507010 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -46,8 +46,8 @@ struct sfxinfo_t unsigned int next, index; // [RH] For hashing float Volume; - BYTE PitchMask; - SWORD NearLimit; // 0 means unlimited + uint8_t PitchMask; + int16_t NearLimit; // 0 means unlimited float LimitRange; // Range for sound limiting (squared for faster computations) unsigned bRandomHeader:1; @@ -177,7 +177,7 @@ public: }; extern FRolloffInfo S_Rolloff; -extern BYTE *S_SoundCurve; +extern uint8_t *S_SoundCurve; extern int S_SoundCurveSize; // Information about one playing sound. @@ -191,11 +191,11 @@ struct FSoundChan : public FISoundChannel FSoundID OrgID; // Sound ID of sound used to start this channel. float Volume; int ChanFlags; - SWORD Pitch; // Pitch variation. - BYTE EntChannel; // Actor's sound channel. - SBYTE Priority; - SWORD NearLimit; - BYTE SourceType; + int16_t Pitch; // Pitch variation. + uint8_t EntChannel; // Actor's sound channel. + int8_t Priority; + int16_t NearLimit; + uint8_t SourceType; float LimitRange; union { diff --git a/src/sc_man.cpp b/src/sc_man.cpp index 577f7690ec..ee31e0f6de 100644 --- a/src/sc_man.cpp +++ b/src/sc_man.cpp @@ -200,7 +200,7 @@ void FScanner::Open (const char *name) void FScanner::OpenFile (const char *name) { - BYTE *filebuf; + uint8_t *filebuf; int filesize; Close (); diff --git a/src/sc_man.h b/src/sc_man.h index 25565ad9af..860935b8d5 100644 --- a/src/sc_man.h +++ b/src/sc_man.h @@ -103,7 +103,7 @@ protected: const char *LastGotPtr; int LastGotLine; bool CMode; - BYTE StateMode; + uint8_t StateMode; bool StateOptions; bool Escape; VersionInfo ParseVersion = { 0, 0, 0 }; // no ZScript extensions by default diff --git a/src/st_stuff.cpp b/src/st_stuff.cpp index 632eaadf8a..ea3de557bb 100644 --- a/src/st_stuff.cpp +++ b/src/st_stuff.cpp @@ -38,16 +38,16 @@ EXTERN_CVAR (Int, am_cheat); struct cheatseq_t { - BYTE *Sequence; - BYTE *Pos; - BYTE DontCheck; - BYTE CurrentArg; - BYTE Args[2]; + uint8_t *Sequence; + uint8_t *Pos; + uint8_t DontCheck; + uint8_t CurrentArg; + uint8_t Args[2]; bool (*Handler)(cheatseq_t *); }; static bool CheatCheckList (event_t *ev, cheatseq_t *cheats, int numcheats); -static bool CheatAddKey (cheatseq_t *cheat, BYTE key, bool *eat); +static bool CheatAddKey (cheatseq_t *cheat, uint8_t key, bool *eat); static bool Cht_Generic (cheatseq_t *); static bool Cht_Music (cheatseq_t *); static bool Cht_BeholdMenu (cheatseq_t *); @@ -60,7 +60,7 @@ static bool Cht_MyPos (cheatseq_t *); static bool Cht_Sound (cheatseq_t *); static bool Cht_Ticker (cheatseq_t *); -BYTE CheatPowerup[7][10] = +uint8_t CheatPowerup[7][10] = { { 'i','d','b','e','h','o','l','d','v', 255 }, { 'i','d','b','e','h','o','l','d','s', 255 }, @@ -70,7 +70,7 @@ BYTE CheatPowerup[7][10] = { 'i','d','b','e','h','o','l','d','l', 255 }, { 'i','d','b','e','h','o','l','d', 255 }, }; -BYTE CheatPowerup1[11][7] = +uint8_t CheatPowerup1[11][7] = { { 'g','i','m','m','e','a',255 }, { 'g','i','m','m','e','b',255 }, @@ -84,7 +84,7 @@ BYTE CheatPowerup1[11][7] = { 'g','i','m','m','e','j',255 }, { 'g','i','m','m','e','z',255 }, }; -BYTE CheatPowerup2[8][10] = +uint8_t CheatPowerup2[8][10] = { { 'p','u','m','p','u','p','b',255 }, { 'p','u','m','p','u','p','i',255 }, @@ -97,84 +97,84 @@ BYTE CheatPowerup2[8][10] = }; // Smashing Pumpkins Into Small Piles Of Putrid Debris. -static BYTE CheatNoclip[] = { 'i','d','s','p','i','s','p','o','p','d',255 }; -static BYTE CheatNoclip2[] = { 'i','d','c','l','i','p',255 }; -static BYTE CheatMus[] = { 'i','d','m','u','s',0,0,255 }; -static BYTE CheatChoppers[] = { 'i','d','c','h','o','p','p','e','r','s',255 }; -static BYTE CheatGod[] = { 'i','d','d','q','d',255 }; -static BYTE CheatAmmo[] = { 'i','d','k','f','a',255 }; -static BYTE CheatAmmoNoKey[] = { 'i','d','f','a',255 }; -static BYTE CheatClev[] = { 'i','d','c','l','e','v',0,0,255 }; -static BYTE CheatMypos[] = { 'i','d','m','y','p','o','s',255 }; -static BYTE CheatAmap[] = { 'i','d','d','t',255 }; +static uint8_t CheatNoclip[] = { 'i','d','s','p','i','s','p','o','p','d',255 }; +static uint8_t CheatNoclip2[] = { 'i','d','c','l','i','p',255 }; +static uint8_t CheatMus[] = { 'i','d','m','u','s',0,0,255 }; +static uint8_t CheatChoppers[] = { 'i','d','c','h','o','p','p','e','r','s',255 }; +static uint8_t CheatGod[] = { 'i','d','d','q','d',255 }; +static uint8_t CheatAmmo[] = { 'i','d','k','f','a',255 }; +static uint8_t CheatAmmoNoKey[] = { 'i','d','f','a',255 }; +static uint8_t CheatClev[] = { 'i','d','c','l','e','v',0,0,255 }; +static uint8_t CheatMypos[] = { 'i','d','m','y','p','o','s',255 }; +static uint8_t CheatAmap[] = { 'i','d','d','t',255 }; -static BYTE CheatQuicken[] = { 'q','u','i','c','k','e','n',255 }; -static BYTE CheatKitty[] = { 'k','i','t','t','y',255 }; -static BYTE CheatRambo[] = { 'r','a','m','b','o',255 }; -static BYTE CheatShazam[] = { 's','h','a','z','a','m',255 }; -static BYTE CheatPonce[] = { 'p','o','n','c','e',255 }; -static BYTE CheatSkel[] = { 's','k','e','l',255 }; -static BYTE CheatNoise[] = { 'n','o','i','s','e',255 }; -static BYTE CheatTicker[] = { 't','i','c','k','e','r',255 }; -static BYTE CheatEngage[] = { 'e','n','g','a','g','e',0,0,255 }; -static BYTE CheatChicken[] = { 'c','o','c','k','a','d','o','o','d','l','e','d','o','o',255 }; -static BYTE CheatMassacre[] = { 'm','a','s','s','a','c','r','e',255 }; -static BYTE CheatRavMap[] = { 'r','a','v','m','a','p',255 }; +static uint8_t CheatQuicken[] = { 'q','u','i','c','k','e','n',255 }; +static uint8_t CheatKitty[] = { 'k','i','t','t','y',255 }; +static uint8_t CheatRambo[] = { 'r','a','m','b','o',255 }; +static uint8_t CheatShazam[] = { 's','h','a','z','a','m',255 }; +static uint8_t CheatPonce[] = { 'p','o','n','c','e',255 }; +static uint8_t CheatSkel[] = { 's','k','e','l',255 }; +static uint8_t CheatNoise[] = { 'n','o','i','s','e',255 }; +static uint8_t CheatTicker[] = { 't','i','c','k','e','r',255 }; +static uint8_t CheatEngage[] = { 'e','n','g','a','g','e',0,0,255 }; +static uint8_t CheatChicken[] = { 'c','o','c','k','a','d','o','o','d','l','e','d','o','o',255 }; +static uint8_t CheatMassacre[] = { 'm','a','s','s','a','c','r','e',255 }; +static uint8_t CheatRavMap[] = { 'r','a','v','m','a','p',255 }; -static BYTE CheatSatan[] = { 's','a','t','a','n',255 }; -static BYTE CheatCasper[] = { 'c','a','s','p','e','r',255 }; -static BYTE CheatNRA[] = { 'n','r','a',255 }; -static BYTE CheatClubMed[] = { 'c','l','u','b','m','e','d',255 }; -static BYTE CheatLocksmith[] = { 'l','o','c','k','s','m','i','t','h',255 }; -static BYTE CheatIndiana[] = { 'i','n','d','i','a','n','a',255 }; -static BYTE CheatSherlock[] = { 's','h','e','r','l','o','c','k',255 }; -static BYTE CheatVisit[] = { 'v','i','s','i','t',0,0,255 }; -static BYTE CheatPig[] = { 'd','e','l','i','v','e','r','a','n','c','e',255 }; -static BYTE CheatButcher[] = { 'b','u','t','c','h','e','r',255 }; -static BYTE CheatConan[] = { 'c','o','n','a','n',255 }; -static BYTE CheatMapsco[] = { 'm','a','p','s','c','o',255 }; -static BYTE CheatWhere[] = { 'w','h','e','r','e',255 }; +static uint8_t CheatSatan[] = { 's','a','t','a','n',255 }; +static uint8_t CheatCasper[] = { 'c','a','s','p','e','r',255 }; +static uint8_t CheatNRA[] = { 'n','r','a',255 }; +static uint8_t CheatClubMed[] = { 'c','l','u','b','m','e','d',255 }; +static uint8_t CheatLocksmith[] = { 'l','o','c','k','s','m','i','t','h',255 }; +static uint8_t CheatIndiana[] = { 'i','n','d','i','a','n','a',255 }; +static uint8_t CheatSherlock[] = { 's','h','e','r','l','o','c','k',255 }; +static uint8_t CheatVisit[] = { 'v','i','s','i','t',0,0,255 }; +static uint8_t CheatPig[] = { 'd','e','l','i','v','e','r','a','n','c','e',255 }; +static uint8_t CheatButcher[] = { 'b','u','t','c','h','e','r',255 }; +static uint8_t CheatConan[] = { 'c','o','n','a','n',255 }; +static uint8_t CheatMapsco[] = { 'm','a','p','s','c','o',255 }; +static uint8_t CheatWhere[] = { 'w','h','e','r','e',255 }; #if 0 -static BYTE CheatClass1[] = { 's','h','a','d','o','w','c','a','s','t','e','r',255 }; -static BYTE CheatClass2[] = { 's','h','a','d','o','w','c','a','s','t','e','r',0,255 }; -static BYTE CheatInit[] = { 'i','n','i','t',255 }; -static BYTE CheatScript1[] = { 'p','u','k','e',255 }; -static BYTE CheatScript2[] = { 'p','u','k','e',0,255 }; -static BYTE CheatScript3[] = { 'p','u','k','e',0,0,255 }; +static uint8_t CheatClass1[] = { 's','h','a','d','o','w','c','a','s','t','e','r',255 }; +static uint8_t CheatClass2[] = { 's','h','a','d','o','w','c','a','s','t','e','r',0,255 }; +static uint8_t CheatInit[] = { 'i','n','i','t',255 }; +static uint8_t CheatScript1[] = { 'p','u','k','e',255 }; +static uint8_t CheatScript2[] = { 'p','u','k','e',0,255 }; +static uint8_t CheatScript3[] = { 'p','u','k','e',0,0,255 }; #endif -static BYTE CheatSpin[] = { 's','p','i','n',0,0,255 }; -static BYTE CheatRift[] = { 'r','i','f','t',0,0,255 }; -static BYTE CheatGPS[] = { 'g','p','s',255 }; -static BYTE CheatGripper[] = { 'g','r','i','p','p','e','r',255 }; -static BYTE CheatLego[] = { 'l','e','g','o',255 }; -static BYTE CheatDots[] = { 'd','o','t','s',255 }; -static BYTE CheatScoot[] = { 's','c','o','o','t',0,255 }; -static BYTE CheatDonnyTrump[] = { 'd','o','n','n','y','t','r','u','m','p',255 }; -static BYTE CheatOmnipotent[] = { 'o','m','n','i','p','o','t','e','n','t',255 }; -static BYTE CheatJimmy[] = { 'j','i','m','m','y',255 }; -static BYTE CheatBoomstix[] = { 'b','o','o','m','s','t','i','x',255 }; -static BYTE CheatStoneCold[] = { 's','t','o','n','e','c','o','l','d',255 }; -static BYTE CheatElvis[] = { 'e','l','v','i','s',255 }; -static BYTE CheatTopo[] = { 't','o','p','o',255 }; +static uint8_t CheatSpin[] = { 's','p','i','n',0,0,255 }; +static uint8_t CheatRift[] = { 'r','i','f','t',0,0,255 }; +static uint8_t CheatGPS[] = { 'g','p','s',255 }; +static uint8_t CheatGripper[] = { 'g','r','i','p','p','e','r',255 }; +static uint8_t CheatLego[] = { 'l','e','g','o',255 }; +static uint8_t CheatDots[] = { 'd','o','t','s',255 }; +static uint8_t CheatScoot[] = { 's','c','o','o','t',0,255 }; +static uint8_t CheatDonnyTrump[] = { 'd','o','n','n','y','t','r','u','m','p',255 }; +static uint8_t CheatOmnipotent[] = { 'o','m','n','i','p','o','t','e','n','t',255 }; +static uint8_t CheatJimmy[] = { 'j','i','m','m','y',255 }; +static uint8_t CheatBoomstix[] = { 'b','o','o','m','s','t','i','x',255 }; +static uint8_t CheatStoneCold[] = { 's','t','o','n','e','c','o','l','d',255 }; +static uint8_t CheatElvis[] = { 'e','l','v','i','s',255 }; +static uint8_t CheatTopo[] = { 't','o','p','o',255 }; //[BL] Graf will probably get rid of this -static BYTE CheatJoelKoenigs[] = { 'j','o','e','l','k','o','e','n','i','g','s',255 }; -static BYTE CheatDavidBrus[] = { 'd','a','v','i','d','b','r','u','s',255 }; -static BYTE CheatScottHolman[] = { 's','c','o','t','t','h','o','l','m','a','n',255 }; -static BYTE CheatMikeKoenigs[] = { 'm','i','k','e','k','o','e','n','i','g','s',255 }; -static BYTE CheatCharlesJacobi[] = { 'c','h','a','r','l','e','s','j','a','c','o','b','i',255 }; -static BYTE CheatAndrewBenson[] = { 'a','n','d','r','e','w','b','e','n','s','o','n',255 }; -static BYTE CheatDeanHyers[] = { 'd','e','a','n','h','y','e','r','s',255 }; -static BYTE CheatMaryBregi[] = { 'm','a','r','y','b','r','e','g','i',255 }; -static BYTE CheatAllen[] = { 'a','l','l','e','n',255 }; -static BYTE CheatDigitalCafe[] = { 'd','i','g','i','t','a','l','c','a','f','e',255 }; -static BYTE CheatJoshuaStorms[] = { 'j','o','s','h','u','a','s','t','o','r','m','s',255 }; -static BYTE CheatLeeSnyder[] = { 'l','e','e','s','n','y','d','e','r',0,0,255 }; -static BYTE CheatKimHyers[] = { 'k','i','m','h','y','e','r','s',255 }; -static BYTE CheatShrrill[] = { 's','h','e','r','r','i','l','l',255 }; +static uint8_t CheatJoelKoenigs[] = { 'j','o','e','l','k','o','e','n','i','g','s',255 }; +static uint8_t CheatDavidBrus[] = { 'd','a','v','i','d','b','r','u','s',255 }; +static uint8_t CheatScottHolman[] = { 's','c','o','t','t','h','o','l','m','a','n',255 }; +static uint8_t CheatMikeKoenigs[] = { 'm','i','k','e','k','o','e','n','i','g','s',255 }; +static uint8_t CheatCharlesJacobi[] = { 'c','h','a','r','l','e','s','j','a','c','o','b','i',255 }; +static uint8_t CheatAndrewBenson[] = { 'a','n','d','r','e','w','b','e','n','s','o','n',255 }; +static uint8_t CheatDeanHyers[] = { 'd','e','a','n','h','y','e','r','s',255 }; +static uint8_t CheatMaryBregi[] = { 'm','a','r','y','b','r','e','g','i',255 }; +static uint8_t CheatAllen[] = { 'a','l','l','e','n',255 }; +static uint8_t CheatDigitalCafe[] = { 'd','i','g','i','t','a','l','c','a','f','e',255 }; +static uint8_t CheatJoshuaStorms[] = { 'j','o','s','h','u','a','s','t','o','r','m','s',255 }; +static uint8_t CheatLeeSnyder[] = { 'l','e','e','s','n','y','d','e','r',0,0,255 }; +static uint8_t CheatKimHyers[] = { 'k','i','m','h','y','e','r','s',255 }; +static uint8_t CheatShrrill[] = { 's','h','e','r','r','i','l','l',255 }; -static BYTE CheatTNTem[] = { 't','n','t','e','m',255 }; +static uint8_t CheatTNTem[] = { 't','n','t','e','m',255 }; static cheatseq_t DoomCheats[] = { @@ -364,7 +364,7 @@ static bool CheatCheckList (event_t *ev, cheatseq_t *cheats, int numcheats) for (i = 0; i < numcheats; i++, cheats++) { - if (CheatAddKey (cheats, (BYTE)ev->data2, &eat)) + if (CheatAddKey (cheats, (uint8_t)ev->data2, &eat)) { if (cheats->DontCheck || !CheckCheatmode ()) { @@ -390,7 +390,7 @@ static bool CheatCheckList (event_t *ev, cheatseq_t *cheats, int numcheats) // //-------------------------------------------------------------------------- -static bool CheatAddKey (cheatseq_t *cheat, BYTE key, bool *eat) +static bool CheatAddKey (cheatseq_t *cheat, uint8_t key, bool *eat) { if (cheat->Pos == NULL) { diff --git a/src/stringtable.cpp b/src/stringtable.cpp index cdcb3071a4..549af499f2 100644 --- a/src/stringtable.cpp +++ b/src/stringtable.cpp @@ -54,7 +54,7 @@ struct FStringTable::StringEntry { StringEntry *Next; char *Name; - BYTE PassNum; + uint8_t PassNum; char String[]; }; @@ -138,13 +138,13 @@ void FStringTable::LoadStrings (bool enuOnly) } } -void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int passnum) +void FStringTable::LoadLanguage (int lumpnum, uint32_t code, bool exactMatch, int passnum) { static bool errordone = false; - const DWORD orMask = exactMatch ? 0 : MAKE_ID(0,0,0xff,0); - DWORD inCode = 0; + const uint32_t orMask = exactMatch ? 0 : MAKE_ID(0,0,0xff,0); + uint32_t inCode = 0; StringEntry *entry, **pentry; - DWORD bucket; + uint32_t bucket; int cmpval; bool skip = true; @@ -328,7 +328,7 @@ const char *FStringTable::operator[] (const char *name) const { return NULL; } - DWORD bucket = MakeKey (name) & (HASH_SIZE - 1); + uint32_t bucket = MakeKey (name) & (HASH_SIZE - 1); StringEntry *entry = Buckets[bucket]; while (entry != NULL) @@ -359,7 +359,7 @@ const char *FStringTable::operator() (const char *name) const // pointer to it. Return NULL for entry1 if it wasn't found. void FStringTable::FindString (const char *name, StringEntry **&pentry1, StringEntry *&entry1) { - DWORD bucket = MakeKey (name) & (HASH_SIZE - 1); + uint32_t bucket = MakeKey (name) & (HASH_SIZE - 1); StringEntry **pentry = &Buckets[bucket], *entry = *pentry; while (entry != NULL) diff --git a/src/stringtable.h b/src/stringtable.h index 523647a859..792ef06b3a 100644 --- a/src/stringtable.h +++ b/src/stringtable.h @@ -69,7 +69,7 @@ private: void FreeData (); void FreeNonDehackedStrings (); - void LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int passnum); + void LoadLanguage (int lumpnum, uint32_t code, bool exactMatch, int passnum); static size_t ProcessEscapes (char *str); void FindString (const char *stringName, StringEntry **&pentry, StringEntry *&entry); }; diff --git a/src/teaminfo.cpp b/src/teaminfo.cpp index 18a2580e2d..b9d5d24aae 100644 --- a/src/teaminfo.cpp +++ b/src/teaminfo.cpp @@ -284,7 +284,7 @@ int FTeam::GetTextColor () const if (m_TextColor.IsEmpty ()) return CR_UNTRANSLATED; - const BYTE *pColor = (const BYTE *)m_TextColor.GetChars (); + const uint8_t *pColor = (const uint8_t *)m_TextColor.GetChars (); int iColor = V_ParseFontColor (pColor, 0, 0); if (iColor == CR_UNDEFINED) diff --git a/src/tflags.h b/src/tflags.h index a7536ab013..203fa70e69 100644 --- a/src/tflags.h +++ b/src/tflags.h @@ -40,7 +40,7 @@ * A Qt-inspired type-safe flagset type. * * T is the enum type of individual flags, - * TT is the underlying integer type used (defaults to DWORD) + * TT is the underlying integer type used (defaults to uint32_t) */ template class TFlags diff --git a/src/v_blend.cpp b/src/v_blend.cpp index 874e81ca14..7ea4a4fdfa 100644 --- a/src/v_blend.cpp +++ b/src/v_blend.cpp @@ -58,7 +58,7 @@ CVAR( Float, pickup_fade_scalar, 1.0f, CVAR_ARCHIVE ) // [SP] Uses same logic as // [RH] Amount of red flash for up to 114 damage points. Calculated by hand // using a logarithmic scale and my trusty HP48G. -static BYTE DamageToAlpha[114] = +static uint8_t DamageToAlpha[114] = { 0, 8, 16, 23, 30, 36, 42, 47, 53, 58, 62, 67, 71, 75, 79, 83, 87, 90, 94, 97, 100, 103, 107, 109, 112, 115, 118, 120, 123, 125, diff --git a/src/v_font.cpp b/src/v_font.cpp index d668de94ca..51ac6052f5 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -101,15 +101,15 @@ The FON2 header is followed by variable length data: #define DEFAULT_LOG_COLOR PalEntry(223,223,223) // TYPES ------------------------------------------------------------------- -void RecordTextureColors (FTexture *pic, BYTE *colorsused); +void RecordTextureColors (FTexture *pic, uint8_t *colorsused); // This structure is used by BuildTranslations() to hold color information. struct TranslationParm { short RangeStart; // First level for this range short RangeEnd; // Last level for this range - BYTE Start[3]; // Start color for this range - BYTE End[3]; // End color for this range + uint8_t Start[3]; // Start color for this range + uint8_t End[3]; // End color for this range }; struct TranslationMap @@ -126,12 +126,12 @@ public: protected: void CheckFON1Chars (double *luminosity); void BuildTranslations2 (); - void FixupPalette (BYTE *identity, double *luminosity, const BYTE *palette, + void FixupPalette (uint8_t *identity, double *luminosity, const uint8_t *palette, bool rescale, PalEntry *out_palette); void LoadTranslations (); - void LoadFON1 (int lump, const BYTE *data); - void LoadFON2 (int lump, const BYTE *data); - void LoadBMF (int lump, const BYTE *data); + void LoadFON1 (int lump, const uint8_t *data); + void LoadFON2 (int lump, const uint8_t *data); + void LoadBMF (int lump, const uint8_t *data); void CreateFontFromPic (FTextureID picnum); static int BMFCompare(const void *a, const void *b); @@ -142,7 +142,7 @@ protected: FONT2, BMFFONT } FontType; - BYTE PaletteData[768]; + uint8_t PaletteData[768]; bool RescalePalette; }; @@ -176,9 +176,9 @@ class FFontChar1 : public FTexture { public: FFontChar1 (FTexture *sourcelump); - const BYTE *GetColumn (unsigned int column, const Span **spans_out); - const BYTE *GetPixels (); - void SetSourceRemap(const BYTE *sourceremap); + const uint8_t *GetColumn (unsigned int column, const Span **spans_out); + const uint8_t *GetPixels (); + void SetSourceRemap(const uint8_t *sourceremap); void Unload (); ~FFontChar1 (); @@ -186,8 +186,8 @@ protected: void MakeTexture (); FTexture *BaseTexture; - BYTE *Pixels; - const BYTE *SourceRemap; + uint8_t *Pixels; + const uint8_t *SourceRemap; }; // This is a font character that reads RLE compressed data. @@ -197,17 +197,17 @@ public: FFontChar2 (int sourcelump, int sourcepos, int width, int height, int leftofs=0, int topofs=0); ~FFontChar2 (); - const BYTE *GetColumn (unsigned int column, const Span **spans_out); - const BYTE *GetPixels (); - void SetSourceRemap(const BYTE *sourceremap); + const uint8_t *GetColumn (unsigned int column, const Span **spans_out); + const uint8_t *GetPixels (); + void SetSourceRemap(const uint8_t *sourceremap); void Unload (); protected: int SourceLump; int SourcePos; - BYTE *Pixels; + uint8_t *Pixels; Span **Spans; - const BYTE *SourceRemap; + const uint8_t *SourceRemap; void MakeTexture (); }; @@ -371,7 +371,7 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count, Lump = fdlump; Chars = new CharData[count]; charlumps = new FTexture *[count]; - PatchRemap = new BYTE[256]; + PatchRemap = new uint8_t[256]; FirstChar = first; LastChar = first + count - 1; FontHeight = 0; @@ -550,18 +550,18 @@ DEFINE_ACTION_FUNCTION(FFont, FindFont) // //========================================================================== -void RecordTextureColors (FTexture *pic, BYTE *usedcolors) +void RecordTextureColors (FTexture *pic, uint8_t *usedcolors) { int x; for (x = pic->GetWidth() - 1; x >= 0; x--) { const FTexture::Span *spans; - const BYTE *column = pic->GetColumn (x, &spans); + const uint8_t *column = pic->GetColumn (x, &spans); while (spans->Length != 0) { - const BYTE *source = column + spans->TopOffset; + const uint8_t *source = column + spans->TopOffset; int count = spans->Length; do @@ -584,12 +584,12 @@ void RecordTextureColors (FTexture *pic, BYTE *usedcolors) static int compare (const void *arg1, const void *arg2) { - if (RPART(GPalette.BaseColors[*((BYTE *)arg1)]) * 299 + - GPART(GPalette.BaseColors[*((BYTE *)arg1)]) * 587 + - BPART(GPalette.BaseColors[*((BYTE *)arg1)]) * 114 < - RPART(GPalette.BaseColors[*((BYTE *)arg2)]) * 299 + - GPART(GPalette.BaseColors[*((BYTE *)arg2)]) * 587 + - BPART(GPalette.BaseColors[*((BYTE *)arg2)]) * 114) + if (RPART(GPalette.BaseColors[*((uint8_t *)arg1)]) * 299 + + GPART(GPalette.BaseColors[*((uint8_t *)arg1)]) * 587 + + BPART(GPalette.BaseColors[*((uint8_t *)arg1)]) * 114 < + RPART(GPalette.BaseColors[*((uint8_t *)arg2)]) * 299 + + GPART(GPalette.BaseColors[*((uint8_t *)arg2)]) * 587 + + BPART(GPalette.BaseColors[*((uint8_t *)arg2)]) * 114) return -1; else return 1; @@ -614,7 +614,7 @@ static int compare (const void *arg1, const void *arg2) // //========================================================================== -int FFont::SimpleTranslation (BYTE *colorsused, BYTE *translation, BYTE *reverse, double **luminosity) +int FFont::SimpleTranslation (uint8_t *colorsused, uint8_t *translation, uint8_t *reverse, double **luminosity) { double min, max, diver; int i, j; @@ -671,7 +671,7 @@ int FFont::SimpleTranslation (BYTE *colorsused, BYTE *translation, BYTE *reverse // //========================================================================== -void FFont::BuildTranslations (const double *luminosity, const BYTE *identity, +void FFont::BuildTranslations (const double *luminosity, const uint8_t *identity, const void *ranges, int total_colors, const PalEntry *palette) { int i, j; @@ -871,7 +871,7 @@ DEFINE_ACTION_FUNCTION(FFont, GetHeight) // //========================================================================== -int FFont::StringWidth(const BYTE *string) const +int FFont::StringWidth(const uint8_t *string) const { int w = 0; int maxw = 0; @@ -926,7 +926,7 @@ DEFINE_ACTION_FUNCTION(FFont, StringWidth) void FFont::LoadTranslations() { unsigned int count = LastChar - FirstChar + 1; - BYTE usedcolors[256], identity[256]; + uint8_t usedcolors[256], identity[256]; double *luminosity; memset (usedcolors, 0, 256); @@ -1029,7 +1029,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump) FontName = name; FMemLump data1 = Wads.ReadLump (lump); - const BYTE *data = (const BYTE *)data1.GetMem(); + const uint8_t *data = (const uint8_t *)data1.GetMem(); if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A) { @@ -1089,7 +1089,7 @@ void FSingleLumpFont::CreateFontFromPic (FTextureID picnum) void FSingleLumpFont::LoadTranslations() { double luminosity[256]; - BYTE identity[256]; + uint8_t identity[256]; PalEntry local_palette[256]; bool useidentity = true; bool usepalette = false; @@ -1135,7 +1135,7 @@ void FSingleLumpFont::LoadTranslations() // //========================================================================== -void FSingleLumpFont::LoadFON1 (int lump, const BYTE *data) +void FSingleLumpFont::LoadFON1 (int lump, const uint8_t *data) { int w, h; @@ -1150,7 +1150,7 @@ void FSingleLumpFont::LoadFON1 (int lump, const BYTE *data) FirstChar = 0; LastChar = 255; GlobalKerning = 0; - PatchRemap = new BYTE[256]; + PatchRemap = new uint8_t[256]; for(unsigned int i = 0;i < 256;++i) Chars[i].Pic = NULL; @@ -1167,13 +1167,13 @@ void FSingleLumpFont::LoadFON1 (int lump, const BYTE *data) // //========================================================================== -void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) +void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data) { int count, i, totalwidth; int *widths2; - WORD *widths; - const BYTE *palette; - const BYTE *data_p; + uint16_t *widths; + const uint8_t *palette; + const uint8_t *data_p; FontType = FONT2; FontHeight = data[4] + data[5]*256; @@ -1188,13 +1188,13 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) widths2 = new int[count]; if (data[11] & 1) { // Font specifies a kerning value. - GlobalKerning = LittleShort(*(SWORD *)&data[12]); - widths = (WORD *)(data + 14); + GlobalKerning = LittleShort(*(int16_t *)&data[12]); + widths = (uint16_t *)(data + 14); } else { // Font does not specify a kerning value. GlobalKerning = 0; - widths = (WORD *)(data + 12); + widths = (uint16_t *)(data + 12); } totalwidth = 0; @@ -1206,7 +1206,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) widths2[i] = totalwidth; } totalwidth *= count; - palette = (BYTE *)&widths[1]; + palette = (uint8_t *)&widths[1]; } else { // Font has varying character widths. @@ -1215,7 +1215,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) widths2[i] = LittleShort(widths[i]); totalwidth += widths2[i]; } - palette = (BYTE *)(widths + i); + palette = (uint8_t *)(widths + i); } if (FirstChar <= ' ' && LastChar >= ' ') @@ -1248,7 +1248,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) Chars[i].Pic = new FFontChar2 (lump, int(data_p - data), widths2[i], FontHeight); do { - SBYTE code = *data_p++; + int8_t code = *data_p++; if (code >= 0) { data_p += code+1; @@ -1281,18 +1281,18 @@ void FSingleLumpFont::LoadFON2 (int lump, const BYTE *data) // //========================================================================== -void FSingleLumpFont::LoadBMF(int lump, const BYTE *data) +void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data) { - const BYTE *chardata; + const uint8_t *chardata; int numchars, count, totalwidth, nwidth; int infolen; int i, chari; - BYTE raw_palette[256*3]; + uint8_t raw_palette[256*3]; PalEntry sort_palette[256]; FontType = BMFFONT; FontHeight = data[5]; - GlobalKerning = (SBYTE)data[8]; + GlobalKerning = (int8_t)data[8]; ActiveColors = data[16]; SpaceWidth = -1; nwidth = -1; @@ -1354,7 +1354,7 @@ void FSingleLumpFont::LoadBMF(int lump, const BYTE *data) qsort(sort_palette + 1, ActiveColors - 1, sizeof(PalEntry), BMFCompare); // Create the PatchRemap table from the sorted "alpha" values. - PatchRemap = new BYTE[ActiveColors]; + PatchRemap = new uint8_t[ActiveColors]; PatchRemap[0] = 0; for (i = 1; i < ActiveColors; ++i) { @@ -1384,8 +1384,8 @@ void FSingleLumpFont::LoadBMF(int lump, const BYTE *data) Chars[chardata[chari] - FirstChar].Pic = new FFontChar2(lump, int(chardata + chari + 6 - data), chardata[chari+1], // width chardata[chari+2], // height - -(SBYTE)chardata[chari+3], // x offset - -(SBYTE)chardata[chari+4] // y offset + -(int8_t)chardata[chari+3], // x offset + -(int8_t)chardata[chari+4] // y offset ); } @@ -1436,10 +1436,10 @@ int FSingleLumpFont::BMFCompare(const void *a, const void *b) void FSingleLumpFont::CheckFON1Chars (double *luminosity) { FMemLump memLump = Wads.ReadLump(Lump); - const BYTE* data = (const BYTE*) memLump.GetMem(); + const uint8_t* data = (const uint8_t*) memLump.GetMem(); - BYTE used[256], reverse[256]; - const BYTE *data_p; + uint8_t used[256], reverse[256]; + const uint8_t *data_p; int i, j; memset (used, 0, 256); @@ -1458,7 +1458,7 @@ void FSingleLumpFont::CheckFON1Chars (double *luminosity) // Advance to next char's data and count the used colors. do { - SBYTE code = *data_p++; + int8_t code = *data_p++; if (code >= 0) { destSize -= code+1; @@ -1501,7 +1501,7 @@ void FSingleLumpFont::CheckFON1Chars (double *luminosity) // //========================================================================== -void FSingleLumpFont::FixupPalette (BYTE *identity, double *luminosity, const BYTE *palette, bool rescale, PalEntry *out_palette) +void FSingleLumpFont::FixupPalette (uint8_t *identity, double *luminosity, const uint8_t *palette, bool rescale, PalEntry *out_palette) { int i; double maxlum = 0.0; @@ -1639,7 +1639,7 @@ FFontChar1::FFontChar1 (FTexture *sourcelump) // //========================================================================== -const BYTE *FFontChar1::GetPixels () +const uint8_t *FFontChar1::GetPixels () { if (Pixels == NULL) { @@ -1658,8 +1658,8 @@ void FFontChar1::MakeTexture () { // Make the texture as normal, then remap it so that all the colors // are at the low end of the palette - Pixels = new BYTE[Width*Height]; - const BYTE *pix = BaseTexture->GetPixels(); + Pixels = new uint8_t[Width*Height]; + const uint8_t *pix = BaseTexture->GetPixels(); if (!SourceRemap) { @@ -1680,7 +1680,7 @@ void FFontChar1::MakeTexture () // //========================================================================== -const BYTE *FFontChar1::GetColumn (unsigned int column, const Span **spans_out) +const uint8_t *FFontChar1::GetColumn (unsigned int column, const Span **spans_out) { if (Pixels == NULL) { @@ -1697,7 +1697,7 @@ const BYTE *FFontChar1::GetColumn (unsigned int column, const Span **spans_out) // //========================================================================== -void FFontChar1::SetSourceRemap(const BYTE *sourceremap) +void FFontChar1::SetSourceRemap(const uint8_t *sourceremap) { Unload(); SourceRemap = sourceremap; @@ -1785,7 +1785,7 @@ void FFontChar2::Unload () // //========================================================================== -const BYTE *FFontChar2::GetPixels () +const uint8_t *FFontChar2::GetPixels () { if (Pixels == NULL) { @@ -1800,7 +1800,7 @@ const BYTE *FFontChar2::GetPixels () // //========================================================================== -const BYTE *FFontChar2::GetColumn (unsigned int column, const Span **spans_out) +const uint8_t *FFontChar2::GetColumn (unsigned int column, const Span **spans_out) { if (Pixels == NULL) { @@ -1827,7 +1827,7 @@ const BYTE *FFontChar2::GetColumn (unsigned int column, const Span **spans_out) // //========================================================================== -void FFontChar2::SetSourceRemap(const BYTE *sourceremap) +void FFontChar2::SetSourceRemap(const uint8_t *sourceremap) { Unload(); SourceRemap = sourceremap; @@ -1843,12 +1843,12 @@ void FFontChar2::MakeTexture () { FWadLump lump = Wads.OpenLumpNum (SourceLump); int destSize = Width * Height; - BYTE max = 255; + uint8_t max = 255; bool rle = true; // This is to "fix" bad fonts { - BYTE buff[16]; + uint8_t buff[16]; lump.Read (buff, 4); if (buff[3] == '2') { @@ -1869,11 +1869,11 @@ void FFontChar2::MakeTexture () } } - Pixels = new BYTE[destSize]; + Pixels = new uint8_t[destSize]; int runlen = 0, setlen = 0; - BYTE setval = 0; // Shut up, GCC! - BYTE *dest_p = Pixels; + uint8_t setval = 0; // Shut up, GCC! + uint8_t *dest_p = Pixels; int dest_adv = Height; int dest_rew = destSize - 1; @@ -1885,7 +1885,7 @@ void FFontChar2::MakeTexture () { if (runlen != 0) { - BYTE color; + uint8_t color; lump >> color; color = MIN (color, max); @@ -1907,7 +1907,7 @@ void FFontChar2::MakeTexture () } else { - SBYTE code; + int8_t code; lump >> code; if (code >= 0) @@ -1916,7 +1916,7 @@ void FFontChar2::MakeTexture () } else if (code != -128) { - BYTE color; + uint8_t color; lump >> color; setlen = (-code) + 1; @@ -1937,7 +1937,7 @@ void FFontChar2::MakeTexture () { for (int x = Width; x != 0; --x) { - BYTE color; + uint8_t color; lump >> color; if (color > max) { @@ -1982,7 +1982,7 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l FontName = name; Chars = new CharData[count]; charlumps = new FTexture*[count]; - PatchRemap = new BYTE[256]; + PatchRemap = new uint8_t[256]; FirstChar = first; LastChar = first + count - 1; FontHeight = 0; @@ -2050,7 +2050,7 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l void FSpecialFont::LoadTranslations() { int count = LastChar - FirstChar + 1; - BYTE usedcolors[256], identity[256]; + uint8_t usedcolors[256], identity[256]; double *luminosity; int TotalColors; int i, j; @@ -2607,9 +2607,9 @@ PalEntry V_LogColorFromColorRange (EColorRange range) // //========================================================================== -EColorRange V_ParseFontColor (const BYTE *&color_value, int normalcolor, int boldcolor) +EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int boldcolor) { - const BYTE *ch = color_value; + const uint8_t *ch = color_value; int newcolor = *ch++; if (newcolor == '-') // Normal @@ -2630,7 +2630,7 @@ EColorRange V_ParseFontColor (const BYTE *&color_value, int normalcolor, int bol } else if (newcolor == '[') // Named { - const BYTE *namestart = ch; + const uint8_t *namestart = ch; while (*ch != ']' && *ch != '\0') { ch++; diff --git a/src/v_font.h b/src/v_font.h index ec85f76221..6553f58555 100644 --- a/src/v_font.h +++ b/src/v_font.h @@ -93,9 +93,9 @@ public: static void StaticPreloadFonts(); // Return width of string in pixels (unscaled) - int StringWidth (const BYTE *str) const; - inline int StringWidth (const char *str) const { return StringWidth ((const BYTE *)str); } - inline int StringWidth (const FString &str) const { return StringWidth ((const BYTE *)str.GetChars()); } + int StringWidth (const uint8_t *str) const; + inline int StringWidth (const char *str) const { return StringWidth ((const uint8_t *)str); } + inline int StringWidth (const FString &str) const { return StringWidth ((const uint8_t *)str.GetChars()); } int GetCharCode(int code, bool needpic) const; char GetCursor() const { return Cursor; } @@ -105,12 +105,12 @@ public: protected: FFont (int lump); - void BuildTranslations (const double *luminosity, const BYTE *identity, + void BuildTranslations (const double *luminosity, const uint8_t *identity, const void *ranges, int total_colors, const PalEntry *palette); void FixXMoves(); - static int SimpleTranslation (BYTE *colorsused, BYTE *translation, - BYTE *identity, double **luminosity); + static int SimpleTranslation (uint8_t *colorsused, uint8_t *translation, + uint8_t *identity, double **luminosity); int FirstChar, LastChar; int SpaceWidth; @@ -125,7 +125,7 @@ protected: } *Chars; int ActiveColors; TArray Ranges; - BYTE *PatchRemap; + uint8_t *PatchRemap; int Lump; FName FontName; @@ -144,7 +144,7 @@ void V_InitFonts(); void V_ClearFonts(); EColorRange V_FindFontColor (FName name); PalEntry V_LogColorFromColorRange (EColorRange range); -EColorRange V_ParseFontColor (const BYTE *&color_value, int normalcolor, int boldcolor); +EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int boldcolor); FFont *V_GetFont(const char *); void V_InitFontColors(); diff --git a/src/v_palette.cpp b/src/v_palette.cpp index 4f4c9cb189..5873de10ba 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -72,7 +72,7 @@ static int sortforremap2 (const void *a, const void *b); /* Gamma correction stuff */ /**************************/ -BYTE newgamma[256]; +uint8_t newgamma[256]; CUSTOM_CVAR (Float, Gamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { if (self == 0.f) @@ -135,12 +135,12 @@ FPalette::FPalette () { } -FPalette::FPalette (const BYTE *colors) +FPalette::FPalette (const uint8_t *colors) { SetPalette (colors); } -void FPalette::SetPalette (const BYTE *colors) +void FPalette::SetPalette (const uint8_t *colors) { for (int i = 0; i < 256; i++, colors += 3) { @@ -151,8 +151,8 @@ void FPalette::SetPalette (const BYTE *colors) // Find white and black from the original palette so that they can be // used to make an educated guess of the translucency % for a BOOM // translucency map. - WhiteIndex = BestColor ((DWORD *)BaseColors, 255, 255, 255, 0, 255); - BlackIndex = BestColor ((DWORD *)BaseColors, 0, 0, 0, 0, 255); + WhiteIndex = BestColor ((uint32_t *)BaseColors, 255, 255, 255, 0, 255); + BlackIndex = BestColor ((uint32_t *)BaseColors, 0, 0, 0, 0, 255); } // In ZDoom's new texture system, color 0 is used as the transparent color. @@ -216,18 +216,18 @@ void FPalette::MakeGoodRemap () static int sortforremap (const void *a, const void *b) { - return (*(const DWORD *)a & 0xFFFFFF) - (*(const DWORD *)b & 0xFFFFFF); + return (*(const uint32_t *)a & 0xFFFFFF) - (*(const uint32_t *)b & 0xFFFFFF); } struct RemappingWork { - DWORD Color; - BYTE Foreign; // 0 = local palette, 1 = foreign palette - BYTE PalEntry; // Entry # in the palette - BYTE Pad[2]; + uint32_t Color; + uint8_t Foreign; // 0 = local palette, 1 = foreign palette + uint8_t PalEntry; // Entry # in the palette + uint8_t Pad[2]; }; -void FPalette::MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, int numcolors) const +void FPalette::MakeRemap (const uint32_t *colors, uint8_t *remap, const uint8_t *useful, int numcolors) const { RemappingWork workspace[255+256]; int i, j, k; @@ -238,7 +238,7 @@ void FPalette::MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, for (i = 1; i < 256; ++i) { - workspace[i-1].Color = DWORD(BaseColors[i]) & 0xFFFFFF; + workspace[i-1].Color = uint32_t(BaseColors[i]) & 0xFFFFFF; workspace[i-1].Foreign = 0; workspace[i-1].PalEntry = i; } @@ -282,7 +282,7 @@ void FPalette::MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, { if (workspace[i].Foreign == 1) { - remap[workspace[i].PalEntry] = BestColor ((DWORD *)BaseColors, + remap[workspace[i].PalEntry] = BestColor ((uint32_t *)BaseColors, RPART(workspace[i].Color), GPART(workspace[i].Color), BPART(workspace[i].Color), 1, 255); } @@ -305,7 +305,7 @@ static int sortforremap2 (const void *a, const void *b) } } -static bool FixBuildPalette (BYTE *opal, int lump, bool blood) +static bool FixBuildPalette (uint8_t *opal, int lump, bool blood) { if (Wads.LumpLength (lump) < 768) { @@ -313,7 +313,7 @@ static bool FixBuildPalette (BYTE *opal, int lump, bool blood) } FMemLump data = Wads.ReadLump (lump); - const BYTE *ipal = (const BYTE *)data.GetMem(); + const uint8_t *ipal = (const uint8_t *)data.GetMem(); // Reverse the palette because BUILD used entry 255 as // transparent, but we use 0 as transparent. @@ -338,7 +338,7 @@ static bool FixBuildPalette (BYTE *opal, int lump, bool blood) void InitPalette () { - BYTE pal[768]; + uint8_t pal[768]; bool usingBuild = false; int lump; @@ -359,14 +359,14 @@ void InitPalette () GPalette.SetPalette (pal); GPalette.MakeGoodRemap (); - ColorMatcher.SetPalette ((DWORD *)GPalette.BaseColors); + ColorMatcher.SetPalette ((uint32_t *)GPalette.BaseColors); // The BUILD engine already has a transparent color, so it doesn't need any remapping. if (!usingBuild) { if (GPalette.Remap[0] == 0) { // No duplicates, so settle for something close to color 0 - GPalette.Remap[0] = BestColor ((DWORD *)GPalette.BaseColors, + GPalette.Remap[0] = BestColor ((uint32_t *)GPalette.BaseColors, GPalette.BaseColors[0].r, GPalette.BaseColors[0].g, GPalette.BaseColors[0].b, 1, 255); } } @@ -385,13 +385,13 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in { if (from != to) { - memcpy (to, from, count * sizeof(DWORD)); + memcpy (to, from, count * sizeof(uint32_t)); } return; } else if (a == 256) { - DWORD t = MAKERGB(r,g,b); + uint32_t t = MAKERGB(r,g,b); int i; for (i = 0; i < count; i++) @@ -507,7 +507,7 @@ CCMD (testblend) CCMD (testfade) { FString colorstring; - DWORD color; + uint32_t color; if (argv.argc() < 2) { @@ -606,7 +606,7 @@ void HSVtoRGB (float *r, float *g, float *b, float h, float s, float v) CCMD (testcolor) { FString colorstring; - DWORD color; + uint32_t color; int desaturate; if (argv.argc() < 2) diff --git a/src/v_palette.h b/src/v_palette.h index 784c01c988..62628eb5cb 100644 --- a/src/v_palette.h +++ b/src/v_palette.h @@ -37,8 +37,8 @@ #include "doomtype.h" #include "c_cvars.h" -#define MAKERGB(r,g,b) DWORD(((r)<<16)|((g)<<8)|(b)) -#define MAKEARGB(a,r,g,b) DWORD(((a)<<24)|((r)<<16)|((g)<<8)|(b)) +#define MAKERGB(r,g,b) uint32_t(((r)<<16)|((g)<<8)|(b)) +#define MAKEARGB(a,r,g,b) uint32_t(((a)<<24)|((r)<<16)|((g)<<8)|(b)) #define APART(c) (((c)>>24)&0xff) #define RPART(c) (((c)>>16)&0xff) @@ -48,21 +48,21 @@ struct FPalette { FPalette (); - FPalette (const BYTE *colors); + FPalette (const uint8_t *colors); - void SetPalette (const BYTE *colors); + void SetPalette (const uint8_t *colors); void MakeGoodRemap (); PalEntry BaseColors[256]; // non-gamma corrected palette - BYTE Remap[256]; // remap original palette indices to in-game indices + uint8_t Remap[256]; // remap original palette indices to in-game indices - BYTE WhiteIndex; // white in original palette index - BYTE BlackIndex; // black in original palette index + uint8_t WhiteIndex; // white in original palette index + uint8_t BlackIndex; // black in original palette index // Given an array of colors, fills in remap with values to remap the // passed array of colors to this palette. - void MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, int numcolors) const; + void MakeRemap (const uint32_t *colors, uint8_t *remap, const uint8_t *useful, int numcolors) const; }; extern FPalette GPalette; diff --git a/src/v_pfx.cpp b/src/v_pfx.cpp index 8f4ea69498..260e87944c 100644 --- a/src/v_pfx.cpp +++ b/src/v_pfx.cpp @@ -43,7 +43,7 @@ extern "C" PfxState GPfx; } -static bool AnalyzeMask (DWORD mask, BYTE *shift); +static bool AnalyzeMask (uint32_t mask, uint8_t *shift); static void Palette16Generic (const PalEntry *pal); static void Palette16R5G5B5 (const PalEntry *pal); @@ -52,19 +52,19 @@ static void Palette32Generic (const PalEntry *pal); static void Palette32RGB (const PalEntry *pal); static void Palette32BGR (const PalEntry *pal); -static void Scale8 (BYTE *src, int srcpitch, +static void Scale8 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac); -static void Convert8 (BYTE *src, int srcpitch, +static void Convert8 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac); -static void Convert16 (BYTE *src, int srcpitch, +static void Convert16 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac); -static void Convert24 (BYTE *src, int srcpitch, +static void Convert24 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac); -static void Convert32 (BYTE *src, int srcpitch, +static void Convert32 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac); @@ -96,9 +96,9 @@ void PfxState::SetFormat (int bits, uint32 redMask, uint32 greenMask, uint32 blu SetPalette = Palette16Generic; } Convert = Convert16; - Masks.Bits16.Red = (WORD)redMask; - Masks.Bits16.Green = (WORD)greenMask; - Masks.Bits16.Blue = (WORD)blueMask; + Masks.Bits16.Red = (uint16_t)redMask; + Masks.Bits16.Green = (uint16_t)greenMask; + Masks.Bits16.Blue = (uint16_t)blueMask; break; case 24: @@ -148,9 +148,9 @@ void PfxState::SetFormat (int bits, uint32 redMask, uint32 greenMask, uint32 blu } } -static bool AnalyzeMask (DWORD mask, BYTE *shiftout) +static bool AnalyzeMask (uint32_t mask, uint8_t *shiftout) { - BYTE shift = 0; + uint8_t shift = 0; if (mask >= 0xff) { @@ -178,12 +178,12 @@ static bool AnalyzeMask (DWORD mask, BYTE *shiftout) static void Palette16Generic (const PalEntry *pal) { - WORD *p16; + uint16_t *p16; int i; for (p16 = GPfxPal.Pal16, i = 256; i != 0; i--, pal++, p16++) { - WORD rpart, gpart, bpart; + uint16_t rpart, gpart, bpart; if (GPfx.RedLeft) rpart = pal->r << GPfx.RedShift; else rpart = pal->r >> GPfx.RedShift; @@ -202,7 +202,7 @@ static void Palette16Generic (const PalEntry *pal) static void Palette16R5G5B5 (const PalEntry *pal) { - WORD *p16; + uint16_t *p16; int i; for (p16 = GPfxPal.Pal16, i = 256; i != 0; i--, pal++, p16++) @@ -215,7 +215,7 @@ static void Palette16R5G5B5 (const PalEntry *pal) static void Palette16R5G6B5 (const PalEntry *pal) { - WORD *p16; + uint16_t *p16; int i; for (p16 = GPfxPal.Pal16, i = 256; i != 0; i--, pal++, p16++) @@ -228,12 +228,12 @@ static void Palette16R5G6B5 (const PalEntry *pal) static void Palette32Generic (const PalEntry *pal) { - DWORD *p32; + uint32_t *p32; int i; for (p32 = GPfxPal.Pal32, i = 256; i != 0; i--, pal++, p32++) { - DWORD rpart, gpart, bpart; + uint32_t rpart, gpart, bpart; if (GPfx.RedLeft) rpart = pal->r << GPfx.RedShift; else rpart = pal->r >> GPfx.RedShift; @@ -257,7 +257,7 @@ static void Palette32RGB (const PalEntry *pal) static void Palette32BGR (const PalEntry *pal) { - DWORD *p32; + uint32_t *p32; int i; for (p32 = GPfxPal.Pal32, i = 256; i != 0; i--, pal++, p32++) @@ -268,7 +268,7 @@ static void Palette32BGR (const PalEntry *pal) // Bitmap converters ------------------------------------------------------- -static void Scale8 (BYTE *src, int srcpitch, +static void Scale8 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac) { @@ -278,7 +278,7 @@ static void Scale8 (BYTE *src, int srcpitch, } int x, y, savedx; - BYTE *dest = (BYTE *)destin; + uint8_t *dest = (uint8_t *)destin; if (xstep == FRACUNIT && ystep == FRACUNIT) { @@ -291,14 +291,14 @@ static void Scale8 (BYTE *src, int srcpitch, } else if (xstep == FRACUNIT/2 && ystep == FRACUNIT/2) { - BYTE *dest2 = dest + destpitch; + uint8_t *dest2 = dest + destpitch; destpitch = destpitch * 2 - destwidth; srcpitch -= destwidth / 2; for (y = destheight / 2; y != 0; --y) { for (x = destwidth / 2; x != 0; --x) { - BYTE foo = src[0]; + uint8_t foo = src[0]; dest[0] = foo; dest[1] = foo; dest2[0] = foo; @@ -318,9 +318,9 @@ static void Scale8 (BYTE *src, int srcpitch, srcpitch -= destwidth / 4; for (y = destheight / 4; y != 0; --y) { - for (BYTE *end = dest + destpitch; dest != end; dest += 4) + for (uint8_t *end = dest + destpitch; dest != end; dest += 4) { - BYTE foo = src[0]; + uint8_t foo = src[0]; dest[0] = foo; dest[1] = foo; dest[2] = foo; @@ -358,7 +358,7 @@ static void Scale8 (BYTE *src, int srcpitch, } for (savedx = x, x >>= 2; x != 0; x--) { - DWORD work; + uint32_t work; #ifdef __BIG_ENDIAN__ work = src[xf >> FRACBITS] << 24; xf += xstep; @@ -371,7 +371,7 @@ static void Scale8 (BYTE *src, int srcpitch, work |= src[xf >> FRACBITS] << 16; xf += xstep; work |= src[xf >> FRACBITS] << 24; xf += xstep; #endif - *(DWORD *)dest = work; + *(uint32_t *)dest = work; dest += 4; } for (savedx &= 3; savedx != 0; savedx--, xf += xstep) @@ -389,7 +389,7 @@ static void Scale8 (BYTE *src, int srcpitch, } } -static void Convert8 (BYTE *src, int srcpitch, +static void Convert8 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac) { @@ -399,7 +399,7 @@ static void Convert8 (BYTE *src, int srcpitch, } int x, y, savedx; - BYTE *dest = (BYTE *)destin; + uint8_t *dest = (uint8_t *)destin; destpitch -= destwidth; if (xstep == FRACUNIT && ystep == FRACUNIT) @@ -415,7 +415,7 @@ static void Convert8 (BYTE *src, int srcpitch, } for (savedx = x, x >>= 2; x != 0; x--) { - *(DWORD *)dest = + *(uint32_t *)dest = #ifdef __BIG_ENDIAN__ (GPfxPal.Pal8[src[0]] << 24) | (GPfxPal.Pal8[src[1]] << 16) | @@ -452,7 +452,7 @@ static void Convert8 (BYTE *src, int srcpitch, } for (savedx = x, x >>= 2; x != 0; x--) { - DWORD work; + uint32_t work; #ifdef __BIG_ENDIAN__ work = GPfxPal.Pal8[src[xf >> FRACBITS]] << 24; xf += xstep; @@ -465,7 +465,7 @@ static void Convert8 (BYTE *src, int srcpitch, work |= GPfxPal.Pal8[src[xf >> FRACBITS]] << 16; xf += xstep; work |= GPfxPal.Pal8[src[xf >> FRACBITS]] << 24; xf += xstep; #endif - *(DWORD *)dest = work; + *(uint32_t *)dest = work; dest += 4; } for (savedx &= 3; savedx != 0; savedx--, xf += xstep) @@ -483,7 +483,7 @@ static void Convert8 (BYTE *src, int srcpitch, } } -static void Convert16 (BYTE *src, int srcpitch, +static void Convert16 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac) { @@ -493,7 +493,7 @@ static void Convert16 (BYTE *src, int srcpitch, } int x, y, savedx; - WORD *dest = (WORD *)destin; + uint16_t *dest = (uint16_t *)destin; destpitch = (destpitch >> 1) - destwidth; if (xstep == FRACUNIT && ystep == FRACUNIT) @@ -509,7 +509,7 @@ static void Convert16 (BYTE *src, int srcpitch, } for (savedx = x, x >>= 1; x != 0; x--) { - *(DWORD *)dest = + *(uint32_t *)dest = #ifdef __BIG_ENDIAN__ (GPfxPal.Pal16[src[0]] << 16) | (GPfxPal.Pal16[src[1]]); @@ -542,7 +542,7 @@ static void Convert16 (BYTE *src, int srcpitch, } for (savedx = x, x >>= 1; x != 0; x--) { - DWORD work; + uint32_t work; #ifdef __BIG_ENDIAN__ work = GPfxPal.Pal16[src[xf >> FRACBITS]] << 16; xf += xstep; @@ -551,7 +551,7 @@ static void Convert16 (BYTE *src, int srcpitch, work = GPfxPal.Pal16[src[xf >> FRACBITS]]; xf += xstep; work |= GPfxPal.Pal16[src[xf >> FRACBITS]] << 16; xf += xstep; #endif - *(DWORD *)dest = work; + *(uint32_t *)dest = work; dest += 2; } if (savedx & 1) @@ -569,7 +569,7 @@ static void Convert16 (BYTE *src, int srcpitch, } } -static void Convert24 (BYTE *src, int srcpitch, +static void Convert24 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac) { @@ -579,7 +579,7 @@ static void Convert24 (BYTE *src, int srcpitch, } int x, y; - BYTE *dest = (BYTE *)destin; + uint8_t *dest = (uint8_t *)destin; destpitch = destpitch - destwidth*3; if (xstep == FRACUNIT && ystep == FRACUNIT) @@ -589,7 +589,7 @@ static void Convert24 (BYTE *src, int srcpitch, { for (x = destwidth; x != 0; x--) { - BYTE *pe = GPfxPal.Pal24[src[0]]; + uint8_t *pe = GPfxPal.Pal24[src[0]]; dest[0] = pe[0]; dest[1] = pe[1]; dest[2] = pe[2]; @@ -607,7 +607,7 @@ static void Convert24 (BYTE *src, int srcpitch, fixed_t xf = xfrac; for (x = destwidth; x != 0; x--) { - BYTE *pe = GPfxPal.Pal24[src[xf >> FRACBITS]]; + uint8_t *pe = GPfxPal.Pal24[src[xf >> FRACBITS]]; dest[0] = pe[0]; dest[1] = pe[1]; dest[2] = pe[2]; @@ -625,7 +625,7 @@ static void Convert24 (BYTE *src, int srcpitch, } } -static void Convert32 (BYTE *src, int srcpitch, +static void Convert32 (uint8_t *src, int srcpitch, void *destin, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac) { @@ -635,7 +635,7 @@ static void Convert32 (BYTE *src, int srcpitch, } int x, y, savedx; - DWORD *dest = (DWORD *)destin; + uint32_t *dest = (uint32_t *)destin; destpitch = (destpitch >> 2) - destwidth; if (xstep == FRACUNIT && ystep == FRACUNIT) diff --git a/src/v_pfx.h b/src/v_pfx.h index 87c15c8286..230b30c8da 100644 --- a/src/v_pfx.h +++ b/src/v_pfx.h @@ -40,10 +40,10 @@ union PfxUnion { - BYTE Pal8[256]; - WORD Pal16[256]; - DWORD Pal32[256]; - BYTE Pal24[256][4]; + uint8_t Pal8[256]; + uint16_t Pal16[256]; + uint32_t Pal32[256]; + uint8_t Pal24[256][4]; }; struct PfxState @@ -52,9 +52,9 @@ struct PfxState { struct { - WORD Red; - WORD Green; - WORD Blue; + uint16_t Red; + uint16_t Green; + uint16_t Blue; } Bits16; struct { @@ -63,16 +63,16 @@ struct PfxState uint32_t Blue; } Bits32; } Masks; - BYTE RedShift; - BYTE BlueShift; - BYTE GreenShift; + uint8_t RedShift; + uint8_t BlueShift; + uint8_t GreenShift; BITFIELD RedLeft:1; BITFIELD BlueLeft:1; BITFIELD GreenLeft:1; void SetFormat (int bits, uint32_t redMask, uint32_t greenMask, uint32_t blueMask); void (*SetPalette) (const PalEntry *pal); - void (*Convert) (BYTE *src, int srcpitch, + void (*Convert) (uint8_t *src, int srcpitch, void *dest, int destpitch, int destwidth, int destheight, fixed_t xstep, fixed_t ystep, fixed_t xfrac, fixed_t yfrac); }; diff --git a/src/v_text.cpp b/src/v_text.cpp index a80a566abf..ca445913f1 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -132,7 +132,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawChar) void DCanvas::DrawTextCommon(FFont *font, int normalcolor, double x, double y, const char *string, DrawParms &parms) { int w; - const BYTE *ch; + const uint8_t *ch; int c; double cx; double cy; @@ -154,7 +154,7 @@ void DCanvas::DrawTextCommon(FFont *font, int normalcolor, double x, double y, c kerning = font->GetDefaultKerning(); - ch = (const BYTE *)string; + ch = (const uint8_t *)string; cx = x; cy = y; @@ -254,7 +254,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawText) // //========================================================================== -static void breakit (FBrokenLines *line, FFont *font, const BYTE *start, const BYTE *stop, FString &linecolor) +static void breakit (FBrokenLines *line, FFont *font, const uint8_t *start, const uint8_t *stop, FString &linecolor) { if (!linecolor.IsEmpty()) { @@ -265,11 +265,11 @@ static void breakit (FBrokenLines *line, FFont *font, const BYTE *start, const B line->Width = font->StringWidth (line->Text); } -FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *string, bool preservecolor, unsigned int *count) +FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const uint8_t *string, bool preservecolor, unsigned int *count) { TArray Lines(128); - const BYTE *space = NULL, *start = string; + const uint8_t *space = NULL, *start = string; int c, w, nw; FString lastcolor, linecolor; bool lastWasSpace = false; @@ -285,7 +285,7 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *string, bool { if (*string == '[') { - const BYTE *start = string; + const uint8_t *start = string; while (*string != ']' && *string != '\0') { string++; @@ -355,7 +355,7 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *string, bool // String here is pointing one character after the '\0' if (--string - start >= 1) { - const BYTE *s = start; + const uint8_t *s = start; while (s < string) { diff --git a/src/v_text.h b/src/v_text.h index bd24be4058..4c54b941b7 100644 --- a/src/v_text.h +++ b/src/v_text.h @@ -75,11 +75,11 @@ struct FBrokenLines #define TEXTCOLOR_CHAT "\034*" #define TEXTCOLOR_TEAMCHAT "\034!" -FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *str, bool preservecolor = false, unsigned int *count = nullptr); +FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const uint8_t *str, bool preservecolor = false, unsigned int *count = nullptr); void V_FreeBrokenLines (FBrokenLines *lines); inline FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const char *str, bool preservecolor = false, unsigned int *count = nullptr) - { return V_BreakLines (font, maxwidth, (const BYTE *)str, preservecolor, count); } + { return V_BreakLines (font, maxwidth, (const uint8_t *)str, preservecolor, count); } inline FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const FString &str, bool preservecolor = false, unsigned int *count = nullptr) - { return V_BreakLines (font, maxwidth, (const BYTE *)str.GetChars(), preservecolor, count); } + { return V_BreakLines (font, maxwidth, (const uint8_t *)str.GetChars(), preservecolor, count); } #endif //__V_TEXT_H__ diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 41833fc245..c9230f5842 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -187,10 +187,10 @@ void FWadCollection::InitMultipleFiles (TArray &filenames) FixMacHexen(); // [RH] Set up hash table - FirstLumpIndex = new DWORD[NumLumps]; - NextLumpIndex = new DWORD[NumLumps]; - FirstLumpIndex_FullName = new DWORD[NumLumps]; - NextLumpIndex_FullName = new DWORD[NumLumps]; + FirstLumpIndex = new uint32_t[NumLumps]; + NextLumpIndex = new uint32_t[NumLumps]; + FirstLumpIndex_FullName = new uint32_t[NumLumps]; + NextLumpIndex_FullName = new uint32_t[NumLumps]; InitHashChains (); LumpInfo.ShrinkToFit(); Files.ShrinkToFit(); @@ -268,10 +268,10 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) if (resfile != NULL) { - DWORD lumpstart = LumpInfo.Size(); + uint32_t lumpstart = LumpInfo.Size(); resfile->SetFirstLump(lumpstart); - for (DWORD i=0; i < resfile->LumpCount(); i++) + for (uint32_t i=0; i < resfile->LumpCount(); i++) { FResourceLump *lump = resfile->GetLump(i); FWadCollection::LumpRecord *lump_p = &LumpInfo[LumpInfo.Reserve(1)]; @@ -286,7 +286,7 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) } Files.Push(resfile); - for (DWORD i=0; i < resfile->LumpCount(); i++) + for (uint32_t i=0; i < resfile->LumpCount(); i++) { FResourceLump *lump = resfile->GetLump(i); if (lump->Flags & LUMPF_EMBEDDED) @@ -300,7 +300,7 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) if (hashfile) { - BYTE cksum[16]; + uint8_t cksum[16]; char cksumout[33]; memset(cksumout, 0, sizeof(cksumout)); @@ -324,7 +324,7 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) else fprintf(hashfile, "file: %s, Directory structure\n", filename); - for (DWORD i = 0; i < resfile->LumpCount(); i++) + for (uint32_t i = 0; i < resfile->LumpCount(); i++) { FResourceLump *lump = resfile->GetLump(i); @@ -431,7 +431,7 @@ int FWadCollection::CheckNumForName (const char *name, int space) char uname[8]; QWORD qname; }; - DWORD i; + uint32_t i; if (name == NULL) { @@ -477,7 +477,7 @@ int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bo char uname[8]; QWORD qname; }; - DWORD i; + uint32_t i; if (wadnum < 0) { @@ -543,7 +543,7 @@ int FWadCollection::GetNumForName (const char *name, int space) int FWadCollection::CheckNumForFullName (const char *name, bool trynormal, int namespc) { - DWORD i; + uint32_t i; if (name == NULL) { @@ -568,7 +568,7 @@ int FWadCollection::CheckNumForFullName (const char *name, bool trynormal, int n int FWadCollection::CheckNumForFullName (const char *name, int wadnum) { - DWORD i; + uint32_t i; if (wadnum < 0) { @@ -702,10 +702,10 @@ int FWadCollection::GetLumpFlags (int lump) // //========================================================================== -DWORD FWadCollection::LumpNameHash (const char *s) +uint32_t FWadCollection::LumpNameHash (const char *s) { - const DWORD *table = GetCRCTable ();; - DWORD hash = 0xffffffff; + const uint32_t *table = GetCRCTable ();; + uint32_t hash = 0xffffffff; int i; for (i = 8; i > 0 && *s; --i, ++s) @@ -769,11 +769,11 @@ void FWadCollection::RenameSprites () bool renameAll; bool MNTRZfound = false; - static const DWORD HereticRenames[] = + static const uint32_t HereticRenames[] = { MAKE_ID('H','E','A','D'), MAKE_ID('L','I','C','H'), // Ironlich }; - static const DWORD HexenRenames[] = + static const uint32_t HexenRenames[] = { MAKE_ID('B','A','R','L'), MAKE_ID('Z','B','A','R'), // ZBarrel MAKE_ID('A','R','M','1'), MAKE_ID('A','R','_','1'), // MeshArmor MAKE_ID('A','R','M','2'), MAKE_ID('A','R','_','2'), // FalconShield @@ -790,7 +790,7 @@ void FWadCollection::RenameSprites () MAKE_ID('I','N','V','U'), MAKE_ID('D','E','F','N'), // Icon of the Defender }; - static const DWORD StrifeRenames[] = + static const uint32_t StrifeRenames[] = { MAKE_ID('M','I','S','L'), MAKE_ID('S','M','I','S'), // lots of places MAKE_ID('A','R','M','1'), MAKE_ID('A','R','M','3'), // MetalArmor MAKE_ID('A','R','M','2'), MAKE_ID('A','R','M','4'), // LeatherArmor @@ -810,7 +810,7 @@ void FWadCollection::RenameSprites () MAKE_ID('S','P','I','D'), MAKE_ID('S','T','L','K'), // Stalker }; - const DWORD *renames; + const uint32_t *renames; int numrenames; switch (gameinfo.gametype) @@ -837,7 +837,7 @@ void FWadCollection::RenameSprites () } - for (DWORD i=0; i< LumpInfo.Size(); i++) + for (uint32_t i=0; i< LumpInfo.Size(); i++) { // check for full Minotaur animations. If this is not found // some frames need to be renamed. @@ -853,7 +853,7 @@ void FWadCollection::RenameSprites () renameAll = !!Args->CheckParm ("-oldsprites") || nospriterename; - for (DWORD i = 0; i < LumpInfo.Size(); i++) + for (uint32_t i = 0; i < LumpInfo.Size(); i++) { if (LumpInfo[i].lump->Namespace == ns_sprites) { @@ -916,8 +916,8 @@ void FWadCollection::RenameNerve () return; bool found = false; - BYTE cksum[16]; - static const BYTE nerve[16] = { 0x96, 0x7d, 0x5a, 0xe2, 0x3d, 0xaf, 0x45, 0x19, + uint8_t cksum[16]; + static const uint8_t nerve[16] = { 0x96, 0x7d, 0x5a, 0xe2, 0x3d, 0xaf, 0x45, 0x19, 0x62, 0x12, 0xae, 0x1b, 0x60, 0x5d, 0xa3, 0xb0 }; size_t nervesize = 3819855; // NERVE.WAD's file size int w = IWAD_FILENUM; @@ -1000,24 +1000,24 @@ void FWadCollection::FixMacHexen() reader->Seek(0, SEEK_SET); - BYTE checksum[16]; + uint8_t checksum[16]; MD5Context md5; md5.Update(reader, iwadSize); md5.Final(checksum); - static const BYTE HEXEN_DEMO_MD5[16] = + static const uint8_t HEXEN_DEMO_MD5[16] = { 0x92, 0x5f, 0x9f, 0x50, 0x00, 0xe1, 0x7d, 0xc8, 0x4b, 0x0a, 0x6a, 0x3b, 0xed, 0x3a, 0x6f, 0x31 }; - static const BYTE HEXEN_BETA_MD5[16] = + static const uint8_t HEXEN_BETA_MD5[16] = { 0x2a, 0xf1, 0xb2, 0x7c, 0xd1, 0x1f, 0xb1, 0x59, 0xe6, 0x08, 0x47, 0x2a, 0x1b, 0x53, 0xe4, 0x0e }; - static const BYTE HEXEN_FULL_MD5[16] = + static const uint8_t HEXEN_FULL_MD5[16] = { 0xb6, 0x81, 0x40, 0xa7, 0x96, 0xf6, 0xfd, 0x7f, 0x3a, 0x5d, 0x32, 0x26, 0xa3, 0x2b, 0x93, 0xbe @@ -1340,7 +1340,7 @@ FWadLump *FWadCollection::ReopenLumpNumNewFile (int lump) FileReader *FWadCollection::GetFileReader(int wadnum) { - if ((DWORD)wadnum >= Files.Size()) + if ((uint32_t)wadnum >= Files.Size()) { return NULL; } @@ -1359,7 +1359,7 @@ const char *FWadCollection::GetWadName (int wadnum) const { const char *name, *slash; - if ((DWORD)wadnum >= Files.Size()) + if ((uint32_t)wadnum >= Files.Size()) { return NULL; } @@ -1376,7 +1376,7 @@ const char *FWadCollection::GetWadName (int wadnum) const int FWadCollection::GetFirstLump (int wadnum) const { - if ((DWORD)wadnum >= Files.Size()) + if ((uint32_t)wadnum >= Files.Size()) { return 0; } @@ -1391,7 +1391,7 @@ int FWadCollection::GetFirstLump (int wadnum) const int FWadCollection::GetLastLump (int wadnum) const { - if ((DWORD)wadnum >= Files.Size()) + if ((uint32_t)wadnum >= Files.Size()) { return 0; } diff --git a/src/w_wad.h b/src/w_wad.h index a10d6d3ea7..5eaea8fab1 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -34,15 +34,15 @@ class FTexture; struct wadinfo_t { // Should be "IWAD" or "PWAD". - DWORD Magic; - DWORD NumLumps; - DWORD InfoTableOfs; + uint32_t Magic; + uint32_t NumLumps; + uint32_t InfoTableOfs; }; struct wadlump_t { - DWORD FilePos; - DWORD Size; + uint32_t FilePos; + uint32_t Size; char Name[8]; }; @@ -164,14 +164,14 @@ public: int CheckNumForName (const char *name, int namespc, int wadfile, bool exact = true); int GetNumForName (const char *name, int namespc); - inline int CheckNumForName (const BYTE *name) { return CheckNumForName ((const char *)name, ns_global); } + inline int CheckNumForName (const uint8_t *name) { return CheckNumForName ((const char *)name, ns_global); } inline int CheckNumForName (const char *name) { return CheckNumForName (name, ns_global); } inline int CheckNumForName (const FString &name) { return CheckNumForName (name.GetChars()); } - inline int CheckNumForName (const BYTE *name, int ns) { return CheckNumForName ((const char *)name, ns); } + inline int CheckNumForName (const uint8_t *name, int ns) { return CheckNumForName ((const char *)name, ns); } inline int GetNumForName (const char *name) { return GetNumForName (name, ns_global); } inline int GetNumForName (const FString &name) { return GetNumForName (name.GetChars(), ns_global); } - inline int GetNumForName (const BYTE *name) { return GetNumForName ((const char *)name); } - inline int GetNumForName (const BYTE *name, int ns) { return GetNumForName ((const char *)name, ns); } + inline int GetNumForName (const uint8_t *name) { return GetNumForName ((const char *)name); } + inline int GetNumForName (const uint8_t *name, int ns) { return GetNumForName ((const char *)name, ns); } int CheckNumForFullName (const char *name, bool trynormal = false, int namespc = ns_global); int CheckNumForFullName (const char *name, int wadfile); @@ -200,7 +200,7 @@ public: int FindLumpMulti (const char **names, int *lastlump, bool anyns = false, int *nameindex = NULL); // same with multiple possible names bool CheckLumpName (int lump, const char *name); // [RH] True if lump's name == name - static DWORD LumpNameHash (const char *name); // [RH] Create hash key from an 8-char name + static uint32_t LumpNameHash (const char *name); // [RH] Create hash key from an 8-char name int LumpLength (int lump) const; int GetLumpOffset (int lump); // [RH] Returns offset of lump in the wadfile @@ -229,14 +229,14 @@ protected: TArray Files; TArray LumpInfo; - DWORD *FirstLumpIndex; // [RH] Hashing stuff moved out of lumpinfo structure - DWORD *NextLumpIndex; + uint32_t *FirstLumpIndex; // [RH] Hashing stuff moved out of lumpinfo structure + uint32_t *NextLumpIndex; - DWORD *FirstLumpIndex_FullName; // The same information for fully qualified paths from .zips - DWORD *NextLumpIndex_FullName; + uint32_t *FirstLumpIndex_FullName; // The same information for fully qualified paths from .zips + uint32_t *NextLumpIndex_FullName; - DWORD NumLumps; // Not necessarily the same as LumpInfo.Size() - DWORD NumWads; + uint32_t NumLumps; // Not necessarily the same as LumpInfo.Size() + uint32_t NumWads; void SkinHack (int baselump); void InitHashChains (); // [RH] Set up the lumpinfo hashing diff --git a/src/w_zip.h b/src/w_zip.h index 4d79ac0e21..6120e629bf 100644 --- a/src/w_zip.h +++ b/src/w_zip.h @@ -19,8 +19,8 @@ struct FZipEndOfCentralDirectory struct FZipCentralDirectoryInfo { uint32_t Magic; - BYTE VersionMadeBy[2]; - BYTE VersionToExtract[2]; + uint8_t VersionMadeBy[2]; + uint8_t VersionToExtract[2]; uint16_t Flags; uint16_t Method; uint16_t ModTime; @@ -42,7 +42,7 @@ struct FZipCentralDirectoryInfo struct FZipLocalFileHeader { uint32_t Magic; - BYTE VersionToExtract[2]; + uint8_t VersionToExtract[2]; uint16_t Flags; uint16_t Method; uint16_t ModTime; diff --git a/src/xlat/parse_xlat.cpp b/src/xlat/parse_xlat.cpp index 6e5266cbfe..87e68954d3 100644 --- a/src/xlat/parse_xlat.cpp +++ b/src/xlat/parse_xlat.cpp @@ -80,8 +80,8 @@ struct SpecialArg struct ListFilter { - WORD filter; - BYTE value; + uint16_t filter; + uint8_t value; }; struct MoreFilters @@ -98,8 +98,8 @@ struct MoreLines struct ParseBoomArg { - BYTE constant; - WORD mask; + uint8_t constant; + uint16_t mask; MoreFilters *filters; };