This commit is contained in:
Rachael Alexanderson 2017-03-08 21:25:24 -05:00
commit cc9a2e5121
283 changed files with 3302 additions and 2957 deletions

View File

@ -4,7 +4,7 @@ branches:
except:
- /^travis.*$/
clone_depth: 1
clone_depth: 10
os: Visual Studio 2015
@ -52,3 +52,9 @@ build:
project: build\GZDoom.sln
parallel: true
verbosity: minimal
notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false

View File

@ -7,7 +7,7 @@ branches:
- /^appveyor.*$/
git:
depth: 3
depth: 10
matrix:
include:
@ -85,6 +85,7 @@ before_install:
- if [ -n "$CLANG_VERSION" ]; then export CC="clang-${CLANG_VERSION}" CXX="clang++-${CLANG_VERSION}"; fi
- $CC --version
- $CXX --version
# Update dependencies here: https://github.com/coelckers/gzdoom/releases/tag/ci_deps
- export FMOD_FILENAME=fmod-4.44.64-${TRAVIS_OS_NAME}.tar.bz2
- curl -LO "https://github.com/coelckers/gzdoom/releases/download/ci_deps/${FMOD_FILENAME}"
- tar -xf "${FMOD_FILENAME}"

View File

@ -756,6 +756,8 @@ file( GLOB HEADER_FILES
scripting/decorate/*.h
scripting/zscript/*.h
scripting/vm/*.h
timidity/*.h
wildmidi/*.h
xlat/*.h
swrenderer/*.h
swrenderer/drawers/*.h
@ -935,6 +937,7 @@ set( FASTMATH_SOURCES
sound/music_timidity_mididevice.cpp
sound/music_wildmidi_mididevice.cpp
sound/music_win_mididevice.cpp
sound/music_audiotoolbox_mididevice.cpp
sound/oalsound.cpp
sound/sndfile_decoder.cpp
sound/music_pseudo_mididevice.cpp
@ -1387,7 +1390,7 @@ endif()
if( APPLE )
set_target_properties(zdoom PROPERTIES
LINK_FLAGS "-framework Carbon -framework Cocoa -framework IOKit -framework OpenGL"
LINK_FLAGS "-framework AudioToolbox -framework AudioUnit -framework Carbon -framework Cocoa -framework IOKit -framework OpenGL"
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/zdoom-info.plist" )
if( NOT NO_FMOD )

View File

@ -511,7 +511,7 @@ typedef TFlags<ActorFlag5> ActorFlags5;
typedef TFlags<ActorFlag6> ActorFlags6;
typedef TFlags<ActorFlag7> ActorFlags7;
typedef TFlags<ActorRenderFlag> ActorRenderFlags;
typedef TFlags<ActorBounceFlag, WORD> ActorBounceFlags;
typedef TFlags<ActorBounceFlag, uint16_t> ActorBounceFlags;
DEFINE_TFLAGS_OPERATORS (ActorFlags)
DEFINE_TFLAGS_OPERATORS (ActorFlags2)
DEFINE_TFLAGS_OPERATORS (ActorFlags3)
@ -746,7 +746,7 @@ public:
void DestroyAllInventory ();
// Set the alphacolor field properly
void SetShade (DWORD rgb);
void SetShade (uint32_t rgb);
void SetShade (int r, int g, int b);
// Plays a conversation animation
@ -991,8 +991,8 @@ public:
uint8_t fountaincolor; // Split out of 'effect' to have easier access.
FRenderStyle RenderStyle; // Style to draw this actor with
FTextureID picnum; // Draw this instead of sprite if valid
DWORD fillcolor; // Color to draw when STYLE_Shaded
DWORD Translation;
uint32_t fillcolor; // Color to draw when STYLE_Shaded
uint32_t Translation;
ActorRenderFlags renderflags; // Different rendering flags
ActorFlags flags;
@ -1045,7 +1045,7 @@ public:
int projectileKickback;
// [BB] If 0, everybody can see the actor, if > 0, only members of team (VisibleToTeam-1) can see it.
DWORD VisibleToTeam;
uint32_t VisibleToTeam;
int special1; // Special info
int special2; // Special info
@ -1054,32 +1054,32 @@ public:
int weaponspecial; // Special info for weapons.
int health;
BYTE movedir; // 0-7
SBYTE visdir;
SWORD movecount; // when 0, select a new dir
SWORD strafecount; // for MF3_AVOIDMELEE
TObjPtr<AActor> target; // thing being chased/attacked (or NULL)
uint8_t movedir; // 0-7
int8_t visdir;
int16_t movecount; // when 0, select a new dir
int16_t strafecount; // for MF3_AVOIDMELEE
TObjPtr<AActor*> target; // thing being chased/attacked (or NULL)
// also the originator for missiles
TObjPtr<AActor> lastenemy; // Last known enemy -- killough 2/15/98
TObjPtr<AActor> LastHeard; // [RH] Last actor this one heard
TObjPtr<AActor*> lastenemy; // Last known enemy -- killough 2/15/98
TObjPtr<AActor*> LastHeard; // [RH] Last actor this one heard
int32_t reactiontime; // if non 0, don't attack yet; used by
// player to freeze a bit after teleporting
int32_t threshold; // if > 0, the target will be chased
int32_t DefThreshold; // [MC] Default threshold which the actor will reset its threshold to after switching targets
// no matter what (even if shot)
player_t *player; // only valid if type of APlayerPawn
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
TObjPtr<AActor*> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
DVector3 SpawnPoint; // For nightmare respawn
WORD SpawnAngle;
uint16_t 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
TObjPtr<AActor> alternative; // (Un)Morphed actors stored here. Those with the MF_UNMORPHED flag are the originals.
TObjPtr<AActor> tracer; // Thing being chased/attacked for tracers
TObjPtr<AActor> master; // Thing which spawned this one (prevents mutual attacks)
TObjPtr<AActor*> alternative; // (Un)Morphed actors stored here. Those with the MF_UNMORPHED flag are the originals.
TObjPtr<AActor*> tracer; // Thing being chased/attacked for tracers
TObjPtr<AActor*> master; // Thing which spawned this one (prevents mutual attacks)
int tid; // thing identifier
int special; // special
@ -1088,13 +1088,13 @@ public:
int accuracy, stamina; // [RH] Strife stats -- [XA] moved here for DECORATE/ACS access.
AActor *inext, **iprev;// Links to other mobjs in same bucket
TObjPtr<AActor> goal; // Monster's goal if not chasing anything
TObjPtr<AActor*> 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.
SBYTE LastLookPlayerNumber;// Player number last looked for (if TIDtoHate == 0)
uint8_t boomwaterlevel; // splash information for non-swimmable water sectors
uint8_t MinMissileChance;// [RH] If a random # is > than this, then missile attack.
int8_t LastLookPlayerNumber;// Player number last looked for (if TIDtoHate == 0)
ActorBounceFlags BounceFlags; // which bouncing type?
DWORD SpawnFlags; // Increased to DWORD because of Doom 64
uint32_t SpawnFlags; // Increased to uint32_t because of Doom 64
double meleerange; // specifies how far a melee attack reaches.
double meleethreshold; // Distance below which a monster doesn't try to shoot missiles anynore
// but instead tries to come closer for a melee attack.
@ -1126,7 +1126,7 @@ public:
FNameNoInit PoisonDamageTypeReceived; // Damage type received by poison.
int PoisonDurationReceived; // Duration left for receiving poison damage.
int PoisonPeriodReceived; // How often poison damage is applied. (Every X tics.)
TObjPtr<AActor> Poisoner; // Last source of received poison damage.
TObjPtr<AActor*> Poisoner; // Last source of received poison damage.
// a linked list of sectors where this object appears
struct msecnode_t *touching_sectorlist; // phares 3/14/98
@ -1136,14 +1136,14 @@ public:
int validcount;
TObjPtr<AInventory> Inventory; // [RH] This actor's inventory
DWORD InventoryID; // A unique ID to keep track of inventory items
TObjPtr<AInventory*> Inventory; // [RH] This actor's inventory
uint32_t 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;
uint32_t BloodTranslation;
// [RH] Stuff that used to be part of an Actor Info
FSoundIDNoInit SeeSound;
@ -1160,7 +1160,7 @@ public:
double MaxStepHeight;
int32_t Mass;
SWORD PainChance;
int16_t PainChance;
int PainThreshold;
FNameNoInit DamageType;
FNameNoInit DamageTypeReceived;
@ -1434,7 +1434,7 @@ public:
// begin of GZDoom specific additions
TArray<TObjPtr<AActor> > dynamiclights;
TArray<TObjPtr<AActor*> > dynamiclights;
void * lightassociations;
bool hasmodel;
// end of GZDoom specific additions
@ -1545,7 +1545,7 @@ template<class T> inline T *Spawn() // for inventory items we do not need coordi
}
void PrintMiscActorInfo(AActor * query);
AActor *P_LinePickActor(AActor *t1, DAngle angle, double distance, DAngle pitch, ActorFlags actorMask, DWORD wallMask);
AActor *P_LinePickActor(AActor *t1, DAngle angle, double distance, DAngle pitch, ActorFlags actorMask, uint32_t wallMask);
// If we want to make P_AimLineAttack capable of handling arbitrary portals, it needs to pass a lot more info than just the linetarget actor.
struct FTranslatedLineTarget

View File

@ -256,7 +256,7 @@ struct AMColorset
c[i].FromCVar(*values[i]);
}
DWORD ba = *(values[0]);
uint32_t ba = *(values[0]);
int r = RPART(ba) - 16;
int g = GPART(ba) - 16;
@ -791,7 +791,7 @@ static bool stopped = true;
static void AM_calcMinMaxMtoF();
static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
INTBOOL flip, double xscale, double yscale, int translation, double alpha, DWORD fillcolor, FRenderStyle renderstyle);
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle);
void AM_rotatePoint (double *x, double *y);
void AM_rotate (double *x, double *y, DAngle an);
@ -1920,7 +1920,7 @@ void AM_drawSubsectors()
// Fill the points array from the subsector.
points.Resize(subsectors[i].numlines);
for (DWORD j = 0; j < subsectors[i].numlines; ++j)
for (uint32_t j = 0; j < subsectors[i].numlines; ++j)
{
mpoint_t pt = { subsectors[i].firstline[j].v1->fX(),
subsectors[i].firstline[j].v1->fY() };
@ -2911,7 +2911,7 @@ void AM_drawThings ()
//=============================================================================
static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
INTBOOL flip, double xscale, double yscale, int translation, double alpha, DWORD fillcolor, FRenderStyle renderstyle)
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle)
{
if (tex == NULL || tex->UseType == FTexture::TEX_Null)
{
@ -2932,7 +2932,7 @@ static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
DTA_TranslationIndex, translation,
DTA_Alpha, alpha,
DTA_FillColor, fillcolor,
DTA_RenderStyle, DWORD(renderstyle),
DTA_RenderStyle, uint32_t(renderstyle),
TAG_DONE);
}
@ -2977,7 +2977,7 @@ void AM_drawAuthorMarkers ()
FTextureID picnum;
FTexture *tex;
WORD flip = 0;
uint16_t flip = 0;
if (mark->picnum.isValid())
{

View File

@ -35,7 +35,15 @@
#ifndef AUTOSEGS_H
#define AUTOSEGS_H
#include "doomtype.h"
#if defined(__clang__)
#if defined(__has_feature) && __has_feature(address_sanitizer)
#define NO_SANITIZE __attribute__((no_sanitize("address")))
#else
#define NO_SANITIZE
#endif
#else
#define NO_SANITIZE
#endif
#define REGMARKER(x) (x)
typedef void * const REGINFO;

View File

@ -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,21 +110,21 @@ public:
bool IsDangerous (sector_t *sec);
TArray<FString> 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;
int wanted_botnum;
TObjPtr<AActor> firstthing;
TObjPtr<AActor> body1;
TObjPtr<AActor> body2;
TObjPtr<AActor*> firstthing;
TObjPtr<AActor*> body1;
TObjPtr<AActor*> body2;
bool m_Thinking;
private:
//(b_game.cpp)
bool DoAddBot (BYTE *info, botskill_t skill);
bool DoAddBot (uint8_t *info, botskill_t skill);
protected:
bool ctf;
@ -152,12 +152,12 @@ public:
player_t *player;
DAngle Angle; // The wanted angle that the bot try to get every tic.
// (used to get a smooth view movement)
TObjPtr<AActor> dest; // Move Destination.
TObjPtr<AActor> prev; // Previous move destination.
TObjPtr<AActor> enemy; // The dead meat.
TObjPtr<AActor> missile; // A threatening missile that needs to be avoided.
TObjPtr<AActor> mate; // Friend (used for grouping in teamplay or coop).
TObjPtr<AActor> last_mate; // If bots mate disappeared (not if died) that mate is
TObjPtr<AActor*> dest; // Move Destination.
TObjPtr<AActor*> prev; // Previous move destination.
TObjPtr<AActor*> enemy; // The dead meat.
TObjPtr<AActor*> missile; // A threatening missile that needs to be avoided.
TObjPtr<AActor*> mate; // Friend (used for grouping in teamplay or coop).
TObjPtr<AActor*> last_mate; // If bots mate disappeared (not if died) that mate is
// pointed to by this. Allows bot to roam to it if
// necessary.

View File

@ -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))

View File

@ -8,7 +8,6 @@ typedef uint8_t BYTE;
typedef int16_t SWORD;
typedef uint16_t WORD;
typedef uint32_t uint32;
typedef int64_t SQWORD;
typedef uint64_t QWORD;
// windef.h, included by windows.h, has its own incompatible definition
@ -23,23 +22,14 @@ typedef uint32 DWORD;
typedef uint32 BITFIELD;
typedef int INTBOOL;
// a 64-bit constant
#ifdef __GNUC__
#define CONST64(v) (v##LL)
#define UCONST64(v) (v##ULL)
#else
#define CONST64(v) ((SQWORD)(v))
#define UCONST64(v) ((QWORD)(v))
#endif
#if !defined(GUID_DEFINED)
#define GUID_DEFINED
typedef struct _GUID
{
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[8];
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[8];
} GUID;
#endif

View File

@ -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)

View File

@ -94,7 +94,7 @@ CVAR(Bool, con_notablist, false, CVAR_ARCHIVE)
static FTextureID conback;
static DWORD conshade;
static uint32_t conshade;
static bool conline;
extern int gametic;

View File

@ -74,7 +74,7 @@ FBaseCVar::FBaseCVar (const FBaseCVar &var)
I_FatalError ("Use of cvar copy constructor");
}
FBaseCVar::FBaseCVar (const char *var_name, DWORD flags, void (*callback)(FBaseCVar &))
FBaseCVar::FBaseCVar (const char *var_name, uint32_t flags, void (*callback)(FBaseCVar &))
{
FBaseCVar *var;
@ -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;
@ -573,8 +573,8 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
if (i == 38 && value[i] == 0)
{
cGUID.Data1 = strtoul (value + 1, NULL, 16);
cGUID.Data2 = (WORD)strtoul (value + 10, NULL, 16);
cGUID.Data3 = (WORD)strtoul (value + 15, NULL, 16);
cGUID.Data2 = (uint16_t)strtoul (value + 10, NULL, 16);
cGUID.Data3 = (uint16_t)strtoul (value + 15, NULL, 16);
cGUID.Data4[0] = HexToByte (value + 20);
cGUID.Data4[1] = HexToByte (value + 22);
cGUID.Data4[2] = HexToByte (value + 25);
@ -690,7 +690,7 @@ DEFINE_ACTION_FUNCTION(_CVar, GetRealType)
// Boolean cvar implementation
//
FBoolCVar::FBoolCVar (const char *name, bool def, DWORD flags, void (*callback)(FBoolCVar &))
FBoolCVar::FBoolCVar (const char *name, bool def, uint32_t flags, void (*callback)(FBoolCVar &))
: FBaseCVar (name, flags, reinterpret_cast<void (*)(FBaseCVar &)>(callback))
{
DefaultValue = def;
@ -748,7 +748,7 @@ void FBoolCVar::DoSet (UCVarValue value, ECVarType type)
// Integer cvar implementation
//
FIntCVar::FIntCVar (const char *name, int def, DWORD flags, void (*callback)(FIntCVar &))
FIntCVar::FIntCVar (const char *name, int def, uint32_t flags, void (*callback)(FIntCVar &))
: FBaseCVar (name, flags, reinterpret_cast<void (*)(FBaseCVar &)>(callback))
{
DefaultValue = def;
@ -806,7 +806,7 @@ void FIntCVar::DoSet (UCVarValue value, ECVarType type)
// Floating point cvar implementation
//
FFloatCVar::FFloatCVar (const char *name, float def, DWORD flags, void (*callback)(FFloatCVar &))
FFloatCVar::FFloatCVar (const char *name, float def, uint32_t flags, void (*callback)(FFloatCVar &))
: FBaseCVar (name, flags, reinterpret_cast<void (*)(FBaseCVar &)>(callback))
{
DefaultValue = def;
@ -874,7 +874,7 @@ void FFloatCVar::DoSet (UCVarValue value, ECVarType type)
// String cvar implementation
//
FStringCVar::FStringCVar (const char *name, const char *def, DWORD flags, void (*callback)(FStringCVar &))
FStringCVar::FStringCVar (const char *name, const char *def, uint32_t flags, void (*callback)(FStringCVar &))
: FBaseCVar (name, flags, reinterpret_cast<void (*)(FBaseCVar &)>(callback))
{
DefaultValue = copystring (def);
@ -943,7 +943,7 @@ void FStringCVar::DoSet (UCVarValue value, ECVarType type)
// Color cvar implementation
//
FColorCVar::FColorCVar (const char *name, int def, DWORD flags, void (*callback)(FColorCVar &))
FColorCVar::FColorCVar (const char *name, int def, uint32_t flags, void (*callback)(FColorCVar &))
: FIntCVar (name, def, flags, reinterpret_cast<void (*)(FIntCVar &)>(callback))
{
}
@ -1024,7 +1024,7 @@ int FColorCVar::ToInt2 (UCVarValue value, ECVarType type)
// GUID cvar implementation
//
FGUIDCVar::FGUIDCVar (const char *name, const GUID *def, DWORD flags, void (*callback)(FGUIDCVar &))
FGUIDCVar::FGUIDCVar (const char *name, const GUID *def, uint32_t flags, void (*callback)(FGUIDCVar &))
: FBaseCVar (name, flags, reinterpret_cast<void (*)(FBaseCVar &)>(callback))
{
if (def != NULL)
@ -1141,7 +1141,7 @@ DEFINE_ACTION_FUNCTION(_CVar, ResetToDefault)
// the network. The "host" cvar is responsible for that.
//
FFlagCVar::FFlagCVar (const char *name, FIntCVar &realvar, DWORD bitval)
FFlagCVar::FFlagCVar (const char *name, FIntCVar &realvar, uint32_t bitval)
: FBaseCVar (name, 0, NULL),
ValueVar (realvar),
BitVal (bitval)
@ -1246,7 +1246,7 @@ void FFlagCVar::DoSet (UCVarValue value, ECVarType type)
// Similar to FFlagCVar but can have multiple bits
//
FMaskCVar::FMaskCVar (const char *name, FIntCVar &realvar, DWORD bitval)
FMaskCVar::FMaskCVar (const char *name, FIntCVar &realvar, uint32_t bitval)
: FBaseCVar (name, 0, NULL),
ValueVar (realvar),
BitVal (bitval)
@ -1354,7 +1354,7 @@ static int sortcvars (const void *a, const void *b)
return strcmp (((*(FBaseCVar **)a))->GetName(), ((*(FBaseCVar **)b))->GetName());
}
void FilterCompactCVars (TArray<FBaseCVar *> &cvars, DWORD filter)
void FilterCompactCVars (TArray<FBaseCVar *> &cvars, uint32_t filter)
{
// Accumulate all cvars that match the filter flags.
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
@ -1370,7 +1370,7 @@ void FilterCompactCVars (TArray<FBaseCVar *> &cvars, DWORD filter)
}
}
void C_WriteCVars (BYTE **demo_p, DWORD filter, bool compact)
void C_WriteCVars (uint8_t **demo_p, uint32_t filter, bool compact)
{
FString dump = C_GetMassCVarString(filter, compact);
size_t dumplen = dump.Len() + 1; // include terminating \0
@ -1378,7 +1378,7 @@ void C_WriteCVars (BYTE **demo_p, DWORD filter, bool compact)
*demo_p += dumplen;
}
FString C_GetMassCVarString (DWORD filter, bool compact)
FString C_GetMassCVarString (uint32_t filter, bool compact)
{
FBaseCVar *cvar;
FString dump;
@ -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;
@ -1420,7 +1420,7 @@ void C_ReadCVars (BYTE **demo_p)
{ // compact mode
TArray<FBaseCVar *> cvars;
FBaseCVar *cvar;
DWORD filter;
uint32_t filter;
ptr++;
breakpt = strchr (ptr, '\\');
@ -1613,7 +1613,7 @@ FBaseCVar *GetUserCVar(int playernum, const char *cvarname)
//
//===========================================================================
FBaseCVar *C_CreateCVar(const char *var_name, ECVarType var_type, DWORD flags)
FBaseCVar *C_CreateCVar(const char *var_name, ECVarType var_type, uint32_t flags)
{
assert(FindCVar(var_name, NULL) == NULL);
flags |= CVAR_AUTO;
@ -1634,7 +1634,7 @@ void UnlatchCVars (void)
while (LatchedValues.Pop (var))
{
DWORD oldflags = var.Variable->Flags;
uint32_t oldflags = var.Variable->Flags;
var.Variable->Flags &= ~(CVAR_LATCH | CVAR_SERVERINFO);
var.Variable->SetGenericRep (var.Value, var.Type);
if (var.Type == CVAR_String)
@ -1643,7 +1643,7 @@ void UnlatchCVars (void)
}
}
void DestroyCVarsFlagged (DWORD flags)
void DestroyCVarsFlagged (uint32_t flags)
{
FBaseCVar *cvar = CVars;
FBaseCVar *next = cvar;
@ -1808,7 +1808,7 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
{
if (CheckWildcards (filter, var->GetName()))
{
DWORD flags = var->GetFlags();
uint32_t flags = var->GetFlags();
if (plain)
{ // plain formatting does not include user-defined cvars
if (!(flags & CVAR_UNSETTABLE))

View File

@ -160,12 +160,12 @@ 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);
friend void UnlatchCVars (void);
friend void DestroyCVarsFlagged (DWORD flags);
friend void DestroyCVarsFlagged (uint32_t flags);
friend void C_ArchiveCVars (FConfigFile *f, uint32 filter);
friend void C_SetCVarsToDefaults (void);
friend void FilterCompactCVars (TArray<FBaseCVar *> &cvars, uint32 filter);
@ -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.
@ -196,13 +196,13 @@ FBaseCVar *GetCVar(AActor *activator, const char *cvarname);
FBaseCVar *GetUserCVar(int playernum, const char *cvarname);
// Create a new cvar with the specified name and type
FBaseCVar *C_CreateCVar(const char *var_name, ECVarType var_type, DWORD flags);
FBaseCVar *C_CreateCVar(const char *var_name, ECVarType var_type, uint32_t flags);
// Called from G_InitNew()
void UnlatchCVars (void);
// Destroy CVars with the matching flags; called from CCMD(restart)
void DestroyCVarsFlagged (DWORD flags);
void DestroyCVarsFlagged (uint32_t flags);
// archive cvars to FILE f
void C_ArchiveCVars (FConfigFile *f, uint32 filter);
@ -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); }

View File

@ -293,17 +293,17 @@ static int ListActionCommands (const char *pattern)
#undef get16bits
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
#define get16bits(d) (*((const WORD *) (d)))
#define get16bits(d) (*((const uint16_t *) (d)))
#endif
#if !defined (get16bits)
#define get16bits(d) ((((DWORD)(((const BYTE *)(d))[1])) << 8)\
+(DWORD)(((const BYTE *)(d))[0]) )
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
+(uint32_t)(((const uint8_t *)(d))[0]) )
#endif
DWORD SuperFastHash (const char *data, size_t len)
uint32_t SuperFastHash (const char *data, size_t len)
{
DWORD hash = 0, tmp;
uint32_t hash = 0, tmp;
size_t rem;
if (len == 0 || data == NULL) return 0;
@ -317,7 +317,7 @@ DWORD SuperFastHash (const char *data, size_t len)
hash += get16bits (data);
tmp = (get16bits (data+2) << 11) ^ hash;
hash = (hash << 16) ^ tmp;
data += 2*sizeof (WORD);
data += 2*sizeof (uint16_t);
hash += hash >> 11;
}
@ -326,7 +326,7 @@ DWORD SuperFastHash (const char *data, size_t len)
{
case 3: hash += get16bits (data);
hash ^= hash << 16;
hash ^= data[sizeof (WORD)] << 18;
hash ^= data[sizeof (uint16_t)] << 18;
hash += hash >> 11;
break;
case 2: hash += get16bits (data);
@ -352,12 +352,12 @@ 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) ((((uint32_t)tolower(((const uint8_t *)(d))[1])) << 8)\
+(uint32_t)tolower(((const uint8_t *)(d))[0]) )
DWORD SuperFastHashI (const char *data, size_t len)
uint32_t SuperFastHashI (const char *data, size_t len)
{
DWORD hash = 0, tmp;
uint32_t hash = 0, tmp;
size_t rem;
if (len <= 0 || data == NULL) return 0;
@ -371,7 +371,7 @@ DWORD SuperFastHashI (const char *data, size_t len)
hash += get16bits (data);
tmp = (get16bits (data+2) << 11) ^ hash;
hash = (hash << 16) ^ tmp;
data += 2*sizeof (WORD);
data += 2*sizeof (uint16_t);
hash += hash >> 11;
}
@ -380,7 +380,7 @@ DWORD SuperFastHashI (const char *data, size_t len)
{
case 3: hash += get16bits (data);
hash ^= hash << 16;
hash ^= tolower(data[sizeof (WORD)]) << 18;
hash ^= tolower(data[sizeof (uint16_t)]) << 18;
hash += hash >> 11;
break;
case 2: hash += get16bits (data);
@ -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;

View File

@ -152,7 +152,7 @@ struct FButtonStatus
{
enum { MAX_KEYS = 6 }; // Maximum number of keys that can press this button
WORD Keys[MAX_KEYS];
uint16_t Keys[MAX_KEYS];
BYTE bDown; // Button is down right now
BYTE bWentDown; // Button went down this tic
BYTE bWentUp; // Button went up this tic

View File

@ -656,7 +656,7 @@ FProduction *ProdNeqStr (FStringProd *prod1, FStringProd *prod2)
FProduction *ProdXorDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{
return NewDoubleProd ((double)((SQWORD)prod1->Value ^ (SQWORD)prod2->Value));
return NewDoubleProd ((double)((int64_t)prod1->Value ^ (int64_t)prod2->Value));
}
//==========================================================================
@ -667,7 +667,7 @@ FProduction *ProdXorDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{
return NewDoubleProd ((double)((SQWORD)prod1->Value & (SQWORD)prod2->Value));
return NewDoubleProd ((double)((int64_t)prod1->Value & (int64_t)prod2->Value));
}
//==========================================================================
@ -678,7 +678,7 @@ FProduction *ProdAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdOrDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{
return NewDoubleProd ((double)((SQWORD)prod1->Value | (SQWORD)prod2->Value));
return NewDoubleProd ((double)((int64_t)prod1->Value | (int64_t)prod2->Value));
}
//==========================================================================
@ -689,7 +689,7 @@ FProduction *ProdOrDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdLAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{
return NewDoubleProd ((double)((SQWORD)prod1->Value && (SQWORD)prod2->Value));
return NewDoubleProd ((double)((int64_t)prod1->Value && (int64_t)prod2->Value));
}
//==========================================================================
@ -700,7 +700,7 @@ FProduction *ProdLAndDbl (FDoubleProd *prod1, FDoubleProd *prod2)
FProduction *ProdLOrDbl (FDoubleProd *prod1, FDoubleProd *prod2)
{
return NewDoubleProd ((double)((SQWORD)prod1->Value || (SQWORD)prod2->Value));
return NewDoubleProd ((double)((int64_t)prod1->Value || (int64_t)prod2->Value));
}

View File

@ -50,7 +50,7 @@ FColorMatcher::FColorMatcher ()
Pal = NULL;
}
FColorMatcher::FColorMatcher (const DWORD *palette)
FColorMatcher::FColorMatcher (const uint32_t *palette)
{
SetPalette (palette);
}
@ -66,7 +66,7 @@ FColorMatcher &FColorMatcher::operator= (const FColorMatcher &other)
return *this;
}
void FColorMatcher::SetPalette (const DWORD *palette)
void FColorMatcher::SetPalette (const uint32_t *palette)
{
Pal = (const PalEntry *)palette;
}

View File

@ -38,12 +38,12 @@ class FColorMatcher
{
public:
FColorMatcher ();
FColorMatcher (const DWORD *palette);
FColorMatcher (const uint32_t *palette);
FColorMatcher (const FColorMatcher &other);
void SetPalette (const DWORD *palette);
BYTE Pick (int r, int g, int b);
BYTE Pick (PalEntry pe)
void SetPalette (const uint32_t *palette);
uint8_t Pick (int r, int g, int b);
uint8_t Pick (PalEntry pe)
{
return Pick(pe.r, pe.g, pe.b);
}

View File

@ -61,7 +61,7 @@
struct FCompatOption
{
const char *Name;
DWORD CompatFlags;
uint32_t CompatFlags;
int WhichSlot;
};
@ -637,7 +637,7 @@ void SetCompatibilityParams()
CCMD (mapchecksum)
{
MapData *map;
BYTE cksum[16];
uint8_t cksum[16];
if (argv.argc() < 2)
{

View File

@ -8,7 +8,7 @@
union FMD5Holder
{
BYTE Bytes[16];
DWORD DWords[4];
uint32_t DWords[4];
hash_t Hash;
};

View File

@ -871,7 +871,7 @@ const char *FConfigFile::GenerateEndTag(const char *value)
for (int i = 0; i < 5; ++i)
{
//DWORD three_bytes = (rand_bytes[i*3] << 16) | (rand_bytes[i*3+1] << 8) | (rand_bytes[i*3+2]); // ???
//uint32_t three_bytes = (rand_bytes[i*3] << 16) | (rand_bytes[i*3+1] << 8) | (rand_bytes[i*3+2]); // ???
EndTag[4+i*4 ] = Base64Table[rand_bytes[i*3] >> 2];
EndTag[4+i*4+1] = Base64Table[((rand_bytes[i*3] & 3) << 4) | (rand_bytes[i*3+1] >> 4)];
EndTag[4+i*4+2] = Base64Table[((rand_bytes[i*3+1] & 15) << 2) | (rand_bytes[i*3+2] >> 6)];

View File

@ -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')

View File

@ -129,8 +129,8 @@ static TArray<PClassActor *> InfoNames;
struct BitName
{
char Name[20];
BYTE Bit;
BYTE WhichFlags;
uint8_t Bit;
uint8_t WhichFlags;
};
static TArray<BitName> BitNames;
@ -139,7 +139,7 @@ static TArray<BitName> BitNames;
struct StyleName
{
char Name[20];
BYTE Num;
uint8_t Num;
};
static TArray<StyleName> StyleNames;
@ -160,7 +160,7 @@ struct CodePointerAlias
{
FName name;
char alias[20];
BYTE params;
uint8_t params;
};
static TArray<CodePointerAlias> 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;
}
@ -401,11 +401,11 @@ static bool HandleKey (const struct Key *keys, void *structure, const char *key,
static int FindSprite (const char *sprname)
{
int i;
DWORD nameint = *((DWORD *)sprname);
uint32_t nameint = *((uint32_t *)sprname);
for (i = 0; i < NumUnchangedSprites; ++i)
{
if (*((DWORD *)&UnchangedSpriteNames[i*4]) == nameint)
if (*((uint32_t *)&UnchangedSpriteNames[i*4]) == nameint)
{
return i;
}
@ -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;
@ -850,7 +850,7 @@ static int PatchThing (int thingy)
bool patchedStates = false;
ActorFlags oldflags;
PClassActor *type;
SWORD *ednum, dummyed;
int16_t *ednum, dummyed;
type = NULL;
info = (AActor *)&dummy;
@ -898,7 +898,7 @@ static int PatchThing (int thingy)
}
else if (linelen == 11 && stricmp (Line1, "Pain chance") == 0)
{
info->PainChance = (SWORD)val;
info->PainChance = (int16_t)val;
}
else if (linelen == 12 && stricmp (Line1, "Translucency") == 0)
{
@ -1049,7 +1049,7 @@ static int PatchThing (int thingy)
}
else if (stricmp (Line1, "Bits") == 0)
{
DWORD value[4] = { 0, 0, 0 };
uint32_t value[4] = { 0, 0, 0 };
bool vchanged[4] = { false, false, false };
// ZDoom used to block the upper range of bits to force use of mnemonics for extra flags.
// MBF also defined extra flags in the same range, but without forcing mnemonics. For MBF
@ -1244,7 +1244,7 @@ static int PatchThing (int thingy)
}
else if (stricmp (Line1, "ID #") == 0)
{
*ednum = (SWORD)val;
*ednum = (int16_t)val;
}
}
else Printf (unknown_str, Line1, "Thing", thingy);
@ -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));
@ -2111,7 +2111,7 @@ static int PatchCodePtrs (int dummy)
}
else
{
TArray<DWORD> &args = sym->Variants[0].ArgFlags;
TArray<uint32_t> &args = sym->Variants[0].ArgFlags;
unsigned numargs = sym->GetImplicitArgs();
if ((sym->Variants[0].Flags & VARF_Virtual || (args.Size() > numargs && !(args[numargs] & VARF_Optional))))
{
@ -2592,9 +2592,9 @@ 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;
return *(uint32_t *)want == *(uint32_t *)have;
}
static int DehUseCount;
@ -2724,7 +2724,7 @@ static bool LoadDehSupp ()
}
else
{
TArray<DWORD> &args = sym->Variants[0].ArgFlags;
TArray<uint32_t> &args = sym->Variants[0].ArgFlags;
unsigned numargs = sym->GetImplicitArgs();
if ((sym->Variants[0].Flags & VARF_Virtual || (args.Size() > numargs && !(args[numargs] & VARF_Optional))))
{

View File

@ -45,11 +45,11 @@ enum EGenericEvent
// Event structure.
struct event_t
{
BYTE type;
BYTE subtype;
SWORD data1; // keys / mouse/joystick buttons
SWORD data2;
SWORD data3;
uint8_t type;
uint8_t subtype;
int16_t data1; // keys / mouse/joystick buttons
int16_t data2;
int16_t data3;
int x; // mouse/joystick x move
int y; // mouse/joystick y move
};

View File

@ -261,7 +261,7 @@ void FIWadManager::ParseIWadInfos(const char *fn)
FResourceFile *resfile = FResourceFile::OpenResourceFile(fn, NULL, true);
if (resfile != NULL)
{
DWORD cnt = resfile->LumpCount();
uint32_t cnt = resfile->LumpCount();
for(int i=cnt-1; i>=0; i--)
{
FResourceLump *lmp = resfile->GetLump(i);
@ -296,7 +296,7 @@ int FIWadManager::ScanIWAD (const char *iwad)
if (iwadfile != NULL)
{
ClearChecks();
for(DWORD ii = 0; ii < iwadfile->LumpCount(); ii++)
for(uint32_t ii = 0; ii < iwadfile->LumpCount(); ii++)
{
FResourceLump *lump = iwadfile->GetLump(ii);

View File

@ -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;
@ -1936,7 +1936,7 @@ static FString CheckGameInfo(TArray<FString> & pwads)
if (resfile != NULL)
{
DWORD cnt = resfile->LumpCount();
uint32_t cnt = resfile->LumpCount();
for(int i=cnt-1; i>=0; i--)
{
FResourceLump *lmp = resfile->GetLump(i);

View File

@ -77,8 +77,8 @@ struct FIWADInfo
FString Autoname; // Name of autoload ini section for this IWAD
FString Configname; // Name of config section for this IWAD
FString Required; // Requires another IWAD
DWORD FgColor; // Foreground color for title banner
DWORD BkColor; // Background color for title banner
uint32_t FgColor; // Foreground color for title banner
uint32_t BkColor; // Background color for title banner
EGameType gametype; // which game are we playing?
FString MapInfo; // Base mapinfo to load
TArray<FString> Load; // Wads to be loaded with this one.
@ -92,8 +92,8 @@ struct FIWADInfo
struct FStartupInfo
{
FString Name;
DWORD FgColor; // Foreground color for title banner
DWORD BkColor; // Background color for title banner
uint32_t FgColor; // Foreground color for title banner
uint32_t BkColor; // Background color for title banner
FString Song;
int Type;
enum

View File

@ -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 (uint32_t 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<PacketStore> 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);
@ -1405,15 +1405,15 @@ void NetUpdate (void)
struct ArbitrateData
{
DWORD playersdetected[MAXNETNODES];
BYTE gotsetup[MAXNETNODES];
uint32_t playersdetected[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;
@ -1490,7 +1490,7 @@ bool DoArbitrate (void *userdata)
if (consoleplayer == Net_Arbitrator)
{
for (i = 0; i < doomcom.numnodes; ++i)
if (data->playersdetected[i] != DWORD(1 << doomcom.numnodes) - 1 || !data->gotsetup[i])
if (data->playersdetected[i] != uint32_t(1 << doomcom.numnodes) - 1 || !data->gotsetup[i])
break;
if (i == doomcom.numnodes)
@ -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 (uint32_t 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);
@ -2270,7 +2270,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
case DEM_INVUSE:
case DEM_INVDROP:
{
DWORD which = ReadLong (stream);
uint32_t which = ReadLong (stream);
int amt = -1;
if (type == DEM_INVDROP) amt = ReadLong(stream);
@ -2308,8 +2308,8 @@ void Net_DoCommand (int type, BYTE **stream, int player)
{
PClassActor *typeinfo;
int angle = 0;
SWORD tid = 0;
BYTE special = 0;
int16_t tid = 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<int>(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)

View File

@ -59,31 +59,31 @@
//
struct doomcom_t
{
DWORD id; // should be DOOMCOM_ID
SWORD intnum; // DOOM executes an int to execute commands
uint32_t id; // should be DOOMCOM_ID
int16_t intnum; // DOOM executes an int to execute commands
// communication between DOOM and the driver
SWORD command; // CMD_SEND or CMD_GET
SWORD remotenode; // dest for send, set by get (-1 = no packet).
SWORD datalength; // bytes in doomdata to be sent
int16_t command; // CMD_SEND or CMD_GET
int16_t remotenode; // dest for send, set by get (-1 = no packet).
int16_t datalength; // bytes in doomdata to be sent
// info common to all nodes
SWORD numnodes; // console is always node 0.
SWORD ticdup; // 1 = no duplication, 2-5 = dup for slow nets
int16_t numnodes; // console is always node 0.
int16_t ticdup; // 1 = no duplication, 2-5 = dup for slow nets
#ifdef DJGPP
SWORD pad[5]; // keep things aligned for DOS drivers
int16_t pad[5]; // keep things aligned for DOS drivers
#endif
// info specific to this node
SWORD consoleplayer;
SWORD numplayers;
int16_t consoleplayer;
int16_t numplayers;
#ifdef DJGPP
SWORD angleoffset; // does not work, but needed to preserve
SWORD drone; // alignment for DOS drivers
int16_t angleoffset; // does not work, but needed to preserve
int16_t drone; // alignment for DOS drivers
#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 ();

View File

@ -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<FName> compact_names(info->CountUsed());

View File

@ -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];
};
@ -131,8 +131,8 @@ public:
int RunHealth;
int PlayerFlags;
double FullHeight;
TObjPtr<AInventory> InvFirst; // first inventory item displayed on inventory bar
TObjPtr<AInventory> InvSel; // selected inventory item
TObjPtr<AInventory*> InvFirst; // first inventory item displayed on inventory bar
TObjPtr<AInventory*> InvSel; // selected inventory item
// [GRB] Player class properties
double JumpZ;
@ -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;
};
@ -256,7 +256,7 @@ public:
bool CheckSkin (int skin);
PClassActor *Type;
DWORD Flags;
uint32_t Flags;
TArray<int> Skins;
};
@ -383,10 +383,10 @@ public:
void SendPitchLimits() const;
APlayerPawn *mo;
BYTE playerstate;
uint8_t playerstate;
ticcmd_t cmd;
usercmd_t original_cmd;
DWORD original_oldbuttons;
uint32_t original_oldbuttons;
userinfo_t userinfo; // [RH] who is this?
@ -406,28 +406,28 @@ public:
DVector2 Vel;
bool centering;
BYTE turnticks;
uint8_t turnticks;
bool attackdown;
bool usedown;
DWORD oldbuttons;
uint32_t oldbuttons;
int health; // only used between levels, mo->health
// 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
WORD WeaponState;
uint8_t multicount;
uint8_t spreecount; // [RH] Keep track of killing sprees
uint16_t WeaponState;
AWeapon *ReadyWeapon;
AWeapon *PendingWeapon; // WP_NOCHANGE if not changing
TObjPtr<DPSprite> psprites; // view sprites (gun, etc)
TObjPtr<DPSprite*> psprites; // view sprites (gun, etc)
int cheats; // bit flags
int timefreezer; // Player has an active time freezer
@ -442,8 +442,8 @@ public:
int poisoncount; // screen flash for poison damage
FName poisontype; // type of poison damage to apply
FName poisonpaintype; // type of Pain state to enter for poison damage
TObjPtr<AActor> poisoner; // NULL for non-player actors
TObjPtr<AActor> attacker; // who did damage (NULL for floors)
TObjPtr<AActor*> poisoner; // NULL for non-player actors
TObjPtr<AActor*> attacker; // who did damage (NULL for floors)
int extralight; // so gun flashes light up areas
short fixedcolormap; // can be set to REDCOLORMAP, etc.
short fixedlightlevel;
@ -451,27 +451,27 @@ public:
PClassActor *MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed
int MorphStyle; // which effects to apply for this player instance when morphed
PClassActor *MorphExitFlash; // flash to apply when demorphing (cache of value given to P_MorphPlayer)
TObjPtr<AWeapon> PremorphWeapon; // ready weapon before morphing
TObjPtr<AWeapon*> PremorphWeapon; // ready weapon before morphing
int chickenPeck; // chicken peck countdown
int jumpTics; // delay the next jump for a moment
bool onground; // Identifies if this player is on the ground or other object
int respawn_time; // [RH] delay respawning until this tic
TObjPtr<AActor> camera; // [RH] Whose eyes this player sees through
TObjPtr<AActor*> camera; // [RH] Whose eyes this player sees through
int air_finished; // [RH] Time when you start drowning
FName LastDamageType; // [RH] For damage-specific pain and death sounds
TObjPtr<AActor> MUSINFOactor; // For MUSINFO purposes
SBYTE MUSINFOtics;
TObjPtr<AActor*> MUSINFOactor; // For MUSINFO purposes
int8_t MUSINFOtics;
bool settings_controller; // Player can control game settings.
SBYTE crouching;
SBYTE crouchdir;
int8_t crouching;
int8_t crouchdir;
//Added by MC:
TObjPtr<DBot> Bot;
TObjPtr<DBot*> Bot;
float BlendR; // [RH] Final blending values
float BlendG;
@ -490,7 +490,7 @@ public:
FWeaponSlots weapons;
// [CW] I moved these here for multiplayer conversation support.
TObjPtr<AActor> ConversationNPC, ConversationPC;
TObjPtr<AActor*> ConversationNPC, ConversationPC;
DAngle ConversationNPCAngle;
bool ConversationFaceTalker;

View File

@ -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)
{
@ -159,8 +159,8 @@ int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, BYTE **stream)
// We can support up to 29 buttons, using from 0 to 4 bytes to store them.
if (flags & UCMDF_BUTTONS)
{
DWORD buttons = ucmd->buttons;
BYTE in = ReadByte(stream);
uint32_t buttons = ucmd->buttons;
uint8_t in = ReadByte(stream);
buttons = (buttons & ~0x7F) | (in & 0x7F);
if (in & 0x80)
@ -198,13 +198,13 @@ 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;
uint32_t buttons_changed;
if (basis == NULL)
{
@ -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 <assert.h>
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;

View File

@ -52,18 +52,18 @@
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
{
DWORD buttons;
uint32_t buttons;
short pitch; // up/down
short yaw; // left/right
short roll; // "tilt"
@ -141,7 +141,7 @@ enum EDemoCommand
DEM_DELCONTROLLER, // 49 Player to remove from the controller list.
DEM_KILLCLASSCHEAT, // 50 String: Class to kill.
DEM_UNDONE11, // 51
DEM_SUMMON2, // 52 String: Thing to fabricate, WORD: angle offset
DEM_SUMMON2, // 52 String: Thing to fabricate, uint16_t: angle offset
DEM_SUMMONFRIEND2, // 53
DEM_SUMMONFOE2, // 54
DEM_ADDSLOTDEFAULT, // 55
@ -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__

View File

@ -32,7 +32,7 @@
struct ticcmd_t
{
usercmd_t ucmd;
SWORD consistancy; // checks for net game
int16_t consistancy; // checks for net game
};
#endif // __D_TICCMD_H__

View File

@ -54,7 +54,7 @@
FDecalLib DecalLibrary;
static double ReadScale (FScanner &sc);
static TArray<BYTE> DecalTranslations;
static TArray<uint8_t> DecalTranslations;
// A decal group holds multiple decals and returns one randomly
// when GetDecal() is called.
@ -76,7 +76,7 @@ public:
{
Choices.ReplaceValues(from, to);
}
void AddDecal (FDecalBase *decal, WORD weight)
void AddDecal (FDecalBase *decal, uint16_t weight)
{
Choices.AddEntry (decal, weight);
}
@ -89,12 +89,12 @@ private:
struct FDecalLib::FTranslation
{
FTranslation (DWORD start, DWORD end);
FTranslation *LocateTranslation (DWORD start, DWORD end);
FTranslation (uint32_t start, uint32_t end);
FTranslation *LocateTranslation (uint32_t start, uint32_t end);
DWORD StartColor, EndColor;
uint32_t StartColor, EndColor;
FTranslation *Next;
WORD Index;
uint16_t Index;
};
struct FDecalAnimator
@ -115,7 +115,7 @@ struct DDecalThinker : public DThinker
public:
DDecalThinker (DBaseDecal *decal) : DThinker (STAT_DECALTHINKER), TheDecal (decal) {}
void Serialize(FSerializer &arc);
TObjPtr<DBaseDecal> TheDecal;
TObjPtr<DBaseDecal*> TheDecal;
protected:
DDecalThinker () : DThinker (STAT_DECALTHINKER) {}
};
@ -422,7 +422,7 @@ void FDecalLib::ReadDecals(FScanner &sc)
}
}
WORD FDecalLib::GetDecalID (FScanner &sc)
uint16_t FDecalLib::GetDecalID (FScanner &sc)
{
sc.MustGetString ();
if (!IsNum (sc.String))
@ -437,14 +437,14 @@ WORD FDecalLib::GetDecalID (FScanner &sc)
{
sc.ScriptError ("Decal ID must be between 1 and 65535");
}
return (WORD)num;
return (uint16_t)num;
}
}
void FDecalLib::ParseDecal (FScanner &sc)
{
FString decalName;
WORD decalNum;
uint16_t decalNum;
FDecalTemplate newdecal;
FTextureID picnum;
int lumpnum;
@ -546,7 +546,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
break;
case DECAL_COLORS:
DWORD startcolor, endcolor;
uint32_t startcolor, endcolor;
sc.MustGetString (); startcolor = V_GetColor (NULL, sc);
sc.MustGetString (); endcolor = V_GetColor (NULL, sc);
@ -569,7 +569,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
void FDecalLib::ParseDecalGroup (FScanner &sc)
{
FString groupName;
WORD decalNum;
uint16_t decalNum;
FDecalBase *targetDecal;
FDecalGroup *group;
@ -871,7 +871,7 @@ void FDecalLib::ReplaceDecalRef (FDecalBase *from, FDecalBase *to, FDecalBase *r
root->ReplaceDecalRef (from, to);
}
void FDecalLib::AddDecal (const char *name, WORD num, const FDecalTemplate &decal)
void FDecalLib::AddDecal (const char *name, uint16_t num, const FDecalTemplate &decal)
{
FDecalTemplate *newDecal = new FDecalTemplate;
@ -944,7 +944,7 @@ void FDecalLib::AddDecal (FDecalBase *decal)
}
}
const FDecalTemplate *FDecalLib::GetDecalByNum (WORD num) const
const FDecalTemplate *FDecalLib::GetDecalByNum (uint16_t num) const
{
if (num == 0)
{
@ -972,7 +972,7 @@ const FDecalTemplate *FDecalLib::GetDecalByName (const char *name) const
return NULL;
}
FDecalBase *FDecalLib::ScanTreeForNum (const WORD num, FDecalBase *root)
FDecalBase *FDecalLib::ScanTreeForNum (const uint16_t num, FDecalBase *root)
{
while (root != NULL)
{
@ -1009,7 +1009,7 @@ FDecalBase *FDecalLib::ScanTreeForName (const char *name, FDecalBase *root)
return root;
}
FDecalLib::FTranslation *FDecalLib::GenerateTranslation (DWORD start, DWORD end)
FDecalLib::FTranslation *FDecalLib::GenerateTranslation (uint32_t start, uint32_t end)
{
FTranslation *trans;
@ -1069,11 +1069,11 @@ const FDecalTemplate *FDecalTemplate::GetDecal () const
return this;
}
FDecalLib::FTranslation::FTranslation (DWORD start, DWORD end)
FDecalLib::FTranslation::FTranslation (uint32_t start, uint32_t end)
{
DWORD ri, gi, bi, rs, gs, bs;
uint32_t ri, gi, bi, rs, gs, bs;
PalEntry *first, *last;
BYTE *table;
uint8_t *table;
unsigned int i, tablei;
StartColor = start;
@ -1109,10 +1109,10 @@ FDecalLib::FTranslation::FTranslation (DWORD start, DWORD end)
table[i] = ColorMatcher.Pick (ri >> 24, gi >> 24, bi >> 24);
}
table[0] = table[1];
Index = (WORD)TRANSLATION(TRANSLATION_Decals, tablei >> 8);
Index = (uint16_t)TRANSLATION(TRANSLATION_Decals, tablei >> 8);
}
FDecalLib::FTranslation *FDecalLib::FTranslation::LocateTranslation (DWORD start, DWORD end)
FDecalLib::FTranslation *FDecalLib::FTranslation::LocateTranslation (uint32_t start, uint32_t end)
{
FTranslation *trans = this;

View File

@ -60,7 +60,7 @@ protected:
FDecalBase *Left, *Right;
FName Name;
WORD SpawnID;
uint16_t SpawnID;
TArray<const PClass *> Users; // Which actors generate this decal
};
@ -75,11 +75,11 @@ public:
void ReplaceDecalRef (FDecalBase *from, FDecalBase *to);
double ScaleX, ScaleY;
DWORD ShadeColor;
DWORD Translation;
uint32_t ShadeColor;
uint32_t Translation;
FRenderStyle RenderStyle;
FTextureID PicNum;
WORD RenderFlags;
uint16_t RenderFlags;
double Alpha; // same as actor->alpha
const FDecalAnimator *Animator;
const FDecalBase *LowerDecal;
@ -97,22 +97,22 @@ public:
void ReadDecals (FScanner &sc);
void ReadAllDecals ();
const FDecalTemplate *GetDecalByNum (WORD num) const;
const FDecalTemplate *GetDecalByNum (uint16_t num) const;
const FDecalTemplate *GetDecalByName (const char *name) const;
private:
struct FTranslation;
static void DelTree (FDecalBase *root);
static FDecalBase *ScanTreeForNum (const WORD num, FDecalBase *root);
static FDecalBase *ScanTreeForNum (const uint16_t num, FDecalBase *root);
static FDecalBase *ScanTreeForName (const char *name, FDecalBase *root);
static void ReplaceDecalRef (FDecalBase *from, FDecalBase *to, FDecalBase *root);
FTranslation *GenerateTranslation (DWORD start, DWORD end);
void AddDecal (const char *name, WORD num, const FDecalTemplate &decal);
FTranslation *GenerateTranslation (uint32_t start, uint32_t end);
void AddDecal (const char *name, uint16_t num, const FDecalTemplate &decal);
void AddDecal (FDecalBase *decal);
FDecalAnimator *FindAnimator (const char *name);
WORD GetDecalID (FScanner &sc);
uint16_t GetDecalID (FScanner &sc);
void ParseDecal (FScanner &sc);
void ParseDecalGroup (FScanner &sc);
void ParseGenerator (FScanner &sc);

View File

@ -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<DObject*>*)((BYTE *)this + *offsets);
auto aray = (TArray<DObject*>*)((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<DObject*>*)((BYTE *)this + *offsets);
auto aray = (TArray<DObject*>*)((uint8_t *)this + *offsets);
for (auto &p : *aray)
{
if (p == old)
@ -542,7 +542,7 @@ size_t DObject::StaticPointerSubstitution (DObject *old, DObject *notOld, bool s
for (auto &sec : level.sectors)
{
#define SECTOR_CHECK(f,t) \
if (sec.f.p == static_cast<t *>(old)) { sec.f = static_cast<t *>(notOld); changed++; }
if (sec.f.pp == static_cast<t *>(old)) { sec.f = static_cast<t *>(notOld); changed++; }
SECTOR_CHECK( SoundTarget, AActor );
SECTOR_CHECK( SecActTarget, AActor );
SECTOR_CHECK( floordata, DSectorEffect );
@ -552,9 +552,9 @@ if (sec.f.p == static_cast<t *>(old)) { sec.f = static_cast<t *>(notOld); change
}
// Go through bot stuff.
if (bglobal.firstthing.p == (AActor *)old) bglobal.firstthing = (AActor *)notOld, ++changed;
if (bglobal.body1.p == (AActor *)old) bglobal.body1 = (AActor *)notOld, ++changed;
if (bglobal.body2.p == (AActor *)old) bglobal.body2 = (AActor *)notOld, ++changed;
if (bglobal.firstthing.pp == (AActor *)old) bglobal.firstthing = (AActor *)notOld, ++changed;
if (bglobal.body1.pp == (AActor *)old) bglobal.body1 = (AActor *)notOld, ++changed;
if (bglobal.body2.pp == (AActor *)old) bglobal.body2 = (AActor *)notOld, ++changed;
return changed;
}

View File

@ -348,70 +348,54 @@ class TObjPtr
{
union
{
T *p;
T pp;
DObject *o;
};
public:
TObjPtr() throw()
{
}
TObjPtr(T *q) throw()
: p(q)
TObjPtr(T q) throw()
: pp(q)
{
}
TObjPtr(const TObjPtr<T> &q) throw()
: p(q.p)
: pp(q.pp)
{
}
T *operator=(T *q) throw()
T operator=(T q) throw()
{
return p = q;
return pp = q;
// The caller must now perform a write barrier.
}
operator T*() throw()
operator T() throw()
{
return GC::ReadBarrier(p);
return GC::ReadBarrier(pp);
}
T &operator*()
{
T *q = GC::ReadBarrier(p);
T q = GC::ReadBarrier(pp);
assert(q != NULL);
return *q;
}
T **operator&() throw()
T *operator&() throw()
{
// Does not perform a read barrier. The only real use for this is with
// the DECLARE_POINTER macro, where a read barrier would be a very bad
// thing.
return &p;
return &pp;
}
T *operator->() throw()
T operator->() throw()
{
return GC::ReadBarrier(p);
return GC::ReadBarrier(pp);
}
bool operator<(T *u) throw()
bool operator!=(T u) throw()
{
return GC::ReadBarrier(p) < u;
return GC::ReadBarrier(o) != u;
}
bool operator<=(T *u) throw()
bool operator==(T u) throw()
{
return GC::ReadBarrier(p) <= u;
}
bool operator>(T *u) throw()
{
return GC::ReadBarrier(p) > u;
}
bool operator>=(T *u) throw()
{
return GC::ReadBarrier(p) >= u;
}
bool operator!=(T *u) throw()
{
return GC::ReadBarrier(p) != u;
}
bool operator==(T *u) throw()
{
return GC::ReadBarrier(p) == u;
return GC::ReadBarrier(o) == u;
}
template<class U> friend inline void GC::Mark(TObjPtr<U> &obj);
@ -424,7 +408,7 @@ public:
// the contents of a TObjPtr to a related type.
template<class T,class U> inline T barrier_cast(TObjPtr<U> &o)
{
return static_cast<T>(static_cast<U *>(o));
return static_cast<T>(static_cast<U>(o));
}
template<class T> inline void GC::Mark(TObjPtr<T> &obj)

View File

@ -150,7 +150,7 @@ DObject *Gray;
DObject *Root;
DObject *SoftRoots;
DObject **SweepPos;
DWORD CurrentWhite = OF_White0 | OF_Fixed;
uint32_t CurrentWhite = OF_White0 | OF_Fixed;
EGCState State = GCS_Pause;
int Pause = DEFAULT_GCPAUSE;
int StepMul = DEFAULT_GCMUL;

View File

@ -637,11 +637,11 @@ void PInt::SetValue(void *addr, int val)
}
else if (Size == 1)
{
*(BYTE *)addr = val;
*(uint8_t *)addr = val;
}
else if (Size == 2)
{
*(WORD *)addr = val;
*(uint16_t *)addr = val;
}
else if (Size == 8)
{
@ -673,11 +673,11 @@ int PInt::GetValueInt(void *addr) const
}
else if (Size == 1)
{
return Unsigned ? *(BYTE *)addr : *(SBYTE *)addr;
return Unsigned ? *(uint8_t *)addr : *(int8_t *)addr;
}
else if (Size == 2)
{
return Unsigned ? *(WORD *)addr : *(SWORD *)addr;
return Unsigned ? *(uint16_t *)addr : *(int16_t *)addr;
}
else if (Size == 8)
{ // truncated output
@ -1035,7 +1035,7 @@ bool PString::ReadValue(FSerializer &ar, const char *key, void *addr) const
void PString::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *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;i<loop;i++)
{
readsomething |= ElementType->ReadValue(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; i<count; i++)
{
// Strings must be constructed first.
@ -2318,7 +2318,7 @@ void PStruct::WriteFields(FSerializer &ar, const void *addr, const TArray<PField
// Skip fields without or with native serialization
if (!(field->Flags & (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<const PField *>(sym)->Type->ReadValue(ar, nullptr,
(BYTE *)addr + static_cast<const PField *>(sym)->Offset);
(uint8_t *)addr + static_cast<const PField *>(sym)->Offset);
}
}
return readsomething || !foundsomething;
@ -2372,7 +2372,7 @@ bool PStruct::ReadFields(FSerializer &ar, void *addr) const
//
//==========================================================================
PField *PStruct::AddField(FName name, PType *type, DWORD flags)
PField *PStruct::AddField(FName name, PType *type, uint32_t flags)
{
PField *field = new PField(name, type, flags);
@ -2405,7 +2405,7 @@ PField *PStruct::AddField(FName name, PType *type, DWORD flags)
//
//==========================================================================
PField *PStruct::AddNativeField(FName name, PType *type, size_t address, DWORD flags, int bitvalue)
PField *PStruct::AddNativeField(FName name, PType *type, size_t address, uint32_t flags, int bitvalue)
{
PField *field = new PField(name, type, flags|VARF_Native|VARF_Transient, address, bitvalue);
@ -2495,7 +2495,7 @@ PField::PField()
}
PField::PField(FName name, PType *type, DWORD flags, size_t offset, int bitvalue)
PField::PField(FName name, PType *type, uint32_t flags, size_t offset, int bitvalue)
: PSymbol(name), Offset(offset), Type(type), Flags(flags)
{
if (bitvalue != 0)
@ -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)
@ -3330,7 +3330,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
//
//==========================================================================
PField *PClass::AddMetaField(FName name, PType *type, DWORD flags)
PField *PClass::AddMetaField(FName name, PType *type, uint32_t flags)
{
PField *field = new PField(name, type, flags);
@ -3360,7 +3360,7 @@ PField *PClass::AddMetaField(FName name, PType *type, DWORD flags)
//
//==========================================================================
PField *PClass::AddField(FName name, PType *type, DWORD flags)
PField *PClass::AddField(FName name, PType *type, uint32_t flags)
{
if (!(flags & VARF_Meta))
{
@ -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;

View File

@ -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();
@ -525,8 +525,8 @@ public:
VMFunction *mConstructor = nullptr;
VMFunction *mDestructor = nullptr;
virtual PField *AddField(FName name, PType *type, DWORD flags=0);
virtual PField *AddNativeField(FName name, PType *type, size_t address, DWORD flags = 0, int bitvalue = 0);
virtual PField *AddField(FName name, PType *type, uint32_t flags=0);
virtual PField *AddNativeField(FName name, PType *type, size_t address, uint32_t flags = 0, int bitvalue = 0);
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
@ -581,7 +581,7 @@ protected:
void Derive(PClass *newclass, FName name);
void InitializeSpecials(void *addr, void *defaults, TArray<FTypeAndOffset> PClass::*Inits);
void SetSuper();
PField *AddMetaField(FName name, PType *type, DWORD flags);
PField *AddMetaField(FName name, PType *type, uint32_t flags);
public:
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
void WriteAllFields(FSerializer &ar, const void *addr) const;
@ -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
@ -617,7 +617,7 @@ public:
void InsertIntoHash();
DObject *CreateNew();
PClass *CreateDerivedClass(FName name, unsigned int size);
PField *AddField(FName name, PType *type, DWORD flags=0) override;
PField *AddField(FName name, PType *type, uint32_t flags=0) override;
void InitializeActorInfo();
void BuildFlatPointers();
void BuildArrayPointers();

View File

@ -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,27 +221,27 @@ 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;
DWORD firstseg; // index of first one, segs are stored sequentially
uint16_t numsegs;
uint32_t firstseg; // index of first one, segs are stored sequentially
};
#pragma pack()
@ -249,12 +249,12 @@ struct mapsubsector4_t
// using partition lines selected by BSP builder.
struct mapseg_t
{
WORD v1;
WORD v2;
SWORD angle;
WORD linedef;
SWORD side;
SWORD offset;
uint16_t v1;
uint16_t v2;
int16_t angle;
uint16_t linedef;
int16_t side;
int16_t offset;
int V1() { return LittleShort(v1); }
int V2() { return LittleShort(v2); }
@ -264,10 +264,10 @@ struct mapseg4_t
{
int32_t v1;
int32_t v2;
SWORD angle;
WORD linedef;
SWORD side;
SWORD offset;
int16_t angle;
uint16_t linedef;
int16_t side;
int16_t offset;
int V1() { return LittleLong(v1); }
int V2() { return LittleLong(v2); }
@ -286,13 +286,13 @@ struct mapnode_t
NF_SUBSECTOR = 0x8000,
NF_LUMPOFFSET = 0
};
SWORD x,y,dx,dy; // partition line
SWORD bbox[2][4]; // bounding box for each child
int16_t x,y,dx,dy; // partition line
int16_t 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]); }
uint32_t Child(int num) { return LittleShort(children[num]); }
};
@ -303,13 +303,13 @@ struct mapnode4_t
NF_SUBSECTOR = 0x80000000,
NF_LUMPOFFSET = 8
};
SWORD x,y,dx,dy; // partition line
SWORD bbox[2][4]; // bounding box for each child
int16_t x,y,dx,dy; // partition line
int16_t 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.
DWORD children[2];
uint32_t children[2];
DWORD Child(int num) { return LittleLong(children[num]); }
uint32_t Child(int num) { return LittleLong(children[num]); }
};
@ -318,25 +318,25 @@ struct mapnode4_t
// plus skill/visibility flags and attributes.
struct mapthing_t
{
SWORD x;
SWORD y;
SWORD angle;
SWORD type;
SWORD options;
int16_t x;
int16_t y;
int16_t angle;
int16_t type;
int16_t options;
};
// [RH] Hexen-compatible MapThing.
struct mapthinghexen_t
{
SWORD thingid;
SWORD x;
SWORD y;
SWORD z;
SWORD angle;
SWORD type;
WORD flags;
BYTE special;
BYTE args[5];
int16_t thingid;
int16_t x;
int16_t y;
int16_t z;
int16_t angle;
int16_t type;
uint16_t flags;
uint8_t special;
uint8_t args[5];
};
struct FDoomEdEntry;
@ -346,24 +346,24 @@ 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;
uint32_t flags;
int special;
int args[5];
int Conversation;
double Gravity;
double Alpha;
DWORD fillcolor;
uint32_t fillcolor;
DVector2 Scale;
double Health;
int score;
short pitch;
short roll;
DWORD RenderStyle;
int16_t pitch;
int16_t roll;
uint32_t 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)

View File

@ -378,9 +378,9 @@ enum
#define BLINKTHRESHOLD (4*32)
#ifndef __BIG_ENDIAN__
#define MAKE_ID(a,b,c,d) ((DWORD)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
#define MAKE_ID(a,b,c,d) ((uint32_t)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
#else
#define MAKE_ID(a,b,c,d) ((DWORD)((d)|((c)<<8)|((b)<<16)|((a)<<24)))
#define MAKE_ID(a,b,c,d) ((uint32_t)((d)|((c)<<8)|((b)<<16)|((a)<<24)))
#endif
#endif // __DOOMDEF_H__

View File

@ -234,7 +234,7 @@ struct DehInfo
int KFAArmor;
int KFAAC;
char PlayerSprite[5];
BYTE ExplosionStyle;
uint8_t ExplosionStyle;
double ExplosionAlpha;
int NoAutofreeze;
int BFGCells;

View File

@ -57,16 +57,6 @@ typedef TMap<int, PClassActor *> FClassMap;
#define NOVTABLE
#endif
#if defined(__clang__)
#if defined(__has_feature) && __has_feature(address_sanitizer)
#define NO_SANITIZE __attribute__((no_sanitize("address")))
#else
#define NO_SANITIZE
#endif
#else
#define NO_SANITIZE
#endif
#if defined(__GNUC__)
// With versions of GCC newer than 4.2, it appears it was determined that the
// cost of an unaligned pointer on PPC was high enough to add padding to the
@ -133,24 +123,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;
};

View File

@ -29,7 +29,7 @@ public:
DMover (sector_t *sector);
void StopInterpolation(bool force = false);
protected:
TObjPtr<DInterpolation> interpolation;
TObjPtr<DInterpolation*> interpolation;
private:
protected:
DMover ();

View File

@ -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;

View File

@ -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;

View File

@ -95,8 +95,8 @@ struct EDMapthing
int type;
double height;
int args[5];
WORD skillfilter;
DWORD flags;
uint16_t skillfilter;
uint32_t flags;
};
struct EDLinedef
@ -107,8 +107,8 @@ struct EDLinedef
int id;
int args[5];
double alpha;
DWORD flags;
DWORD activation;
uint32_t flags;
uint32_t activation;
};
@ -117,24 +117,24 @@ struct EDSector
{
int recordnum;
DWORD flags;
DWORD flagsRemove;
DWORD flagsAdd;
uint32_t flags;
uint32_t flagsRemove;
uint32_t flagsAdd;
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;
DWORD color;
uint32_t color;
DWORD damageflags;
DWORD damageflagsAdd;
DWORD damageflagsRemove;
uint32_t damageflags;
uint32_t damageflagsAdd;
uint32_t damageflagsRemove;
bool flagsSet;
bool damageflagsSet;
@ -143,7 +143,7 @@ struct EDSector
// colormaptop//bottom cannot be used because ZDoom has no corresponding properties.
double xoffs[2], yoffs[2];
DAngle angle[2];
DWORD portalflags[2];
uint32_t portalflags[2];
double Overlayalpha[2];
};
@ -222,8 +222,8 @@ static void parseLinedef(FScanner &sc)
else if (sc.Compare("extflags"))
{
// these are needed to build the proper activation mask out of the possible flags which do not match ZDoom 1:1.
DWORD actmethod = 0;
DWORD acttype = 0;
uint32_t actmethod = 0;
uint32_t acttype = 0;
do
{
sc.CheckString("=");
@ -291,7 +291,7 @@ static void parseSector(FScanner &sc)
}
else if (sc.Compare("flags"))
{
DWORD *flagvar = NULL;
uint32_t *flagvar = NULL;
if (sc.CheckString("."))
{
sc.MustGetString();
@ -348,8 +348,8 @@ static void parseSector(FScanner &sc)
}
else if (sc.Compare("damageflags"))
{
DWORD *flagvar = NULL;
BYTE *leakvar = NULL;
uint32_t *flagvar = NULL;
uint8_t *leakvar = NULL;
if (sc.CheckString("."))
{
sc.MustGetString();
@ -449,7 +449,7 @@ static void parseSector(FScanner &sc)
sc.MustGetString();
// Eternity is based on SMMU and uses colormaps differently than all other ports.
// The only solution here is to convert the colormap to an RGB value and set it as the sector's color.
DWORD cmap = R_ColormapNumForName(sc.String);
uint32_t cmap = R_ColormapNumForName(sc.String);
if (cmap != 0)
{
sec.color = R_BlendForColormap(cmap) & 0xff000000;
@ -700,7 +700,7 @@ void ProcessEDLinedef(line_t *ld, int recordnum)
ld->special = 0;
return;
}
const DWORD fmask = ML_REPEAT_SPECIAL | ML_FIRSTSIDEONLY | ML_ADDTRANS | ML_BLOCKEVERYTHING | ML_ZONEBOUNDARY | ML_CLIP_MIDTEX;
const uint32_t fmask = ML_REPEAT_SPECIAL | ML_FIRSTSIDEONLY | ML_ADDTRANS | ML_BLOCKEVERYTHING | ML_ZONEBOUNDARY | ML_CLIP_MIDTEX;
ld->special = eld->special;
ld->activation = eld->activation;
ld->flags = (ld->flags&~fmask) | eld->flags;
@ -719,11 +719,11 @@ void ProcessEDSector(sector_t *sec, int recordnum)
}
// In ZDoom the regular and the damage flags are part of the same flag word so we need to do some masking.
const DWORD flagmask = SECF_SECRET | SECF_WASSECRET | SECF_FRICTION | SECF_PUSH | SECF_SILENT | SECF_SILENTMOVE;
const uint32_t flagmask = SECF_SECRET | SECF_WASSECRET | SECF_FRICTION | SECF_PUSH | SECF_SILENT | SECF_SILENTMOVE;
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;
@ -740,7 +740,7 @@ void ProcessEDSector(sector_t *sec, int recordnum)
if (esec->colorSet) sec->SetColor(RPART(esec->color), GPART(esec->color), BPART(esec->color), 0);
const DWORD pflagmask = PLANEF_DISABLED | PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_BLOCKSOUND | PLANEF_ADDITIVE;
const uint32_t pflagmask = PLANEF_DISABLED | PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_BLOCKSOUND | PLANEF_ADDITIVE;
for (int i = 0; i < 2; i++)
{
sec->SetXOffset(i, esec->xoffs[i]);

View File

@ -13,33 +13,33 @@ 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;
}
FileReaderBase &operator>> (SBYTE &v)
FileReaderBase &operator>> (int8_t &v)
{
Read (&v, 1);
return *this;
}
FileReaderBase &operator>> (WORD &v)
FileReaderBase &operator>> (uint16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderBase &operator>> (SWORD &v)
FileReaderBase &operator>> (int16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderBase &operator>> (DWORD &v)
FileReaderBase &operator>> (uint32_t &v)
{
Read (&v, 4);
v = LittleLong(v);
@ -79,33 +79,33 @@ 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;
}
FileReader &operator>> (SBYTE &v)
FileReader &operator>> (int8_t &v)
{
Read (&v, 1);
return *this;
}
FileReader &operator>> (WORD &v)
FileReader &operator>> (uint16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReader &operator>> (SWORD &v)
FileReader &operator>> (int16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReader &operator>> (DWORD &v)
FileReader &operator>> (uint32_t &v)
{
Read (&v, 4);
v = LittleLong(v);
@ -138,33 +138,33 @@ public:
virtual long Read (void *buffer, long len);
FileReaderZ &operator>> (BYTE &v)
FileReaderZ &operator>> (uint8_t &v)
{
Read (&v, 1);
return *this;
}
FileReaderZ &operator>> (SBYTE &v)
FileReaderZ &operator>> (int8_t &v)
{
Read (&v, 1);
return *this;
}
FileReaderZ &operator>> (WORD &v)
FileReaderZ &operator>> (uint16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderZ &operator>> (SWORD &v)
FileReaderZ &operator>> (int16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderZ &operator>> (DWORD &v)
FileReaderZ &operator>> (uint32_t &v)
{
Read (&v, 4);
v = LittleLong(v);
@ -184,7 +184,7 @@ private:
FileReader &File;
bool SawEOF;
z_stream Stream;
BYTE InBuff[BUFF_SIZE];
uint8_t InBuff[BUFF_SIZE];
void FillBuffer ();
@ -200,33 +200,33 @@ public:
long Read (void *buffer, long len);
FileReaderBZ2 &operator>> (BYTE &v)
FileReaderBZ2 &operator>> (uint8_t &v)
{
Read (&v, 1);
return *this;
}
FileReaderBZ2 &operator>> (SBYTE &v)
FileReaderBZ2 &operator>> (int8_t &v)
{
Read (&v, 1);
return *this;
}
FileReaderBZ2 &operator>> (WORD &v)
FileReaderBZ2 &operator>> (uint16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderBZ2 &operator>> (SWORD &v)
FileReaderBZ2 &operator>> (int16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderBZ2 &operator>> (DWORD &v)
FileReaderBZ2 &operator>> (uint32_t &v)
{
Read (&v, 4);
v = LittleLong(v);
@ -246,7 +246,7 @@ private:
FileReader &File;
bool SawEOF;
bz_stream Stream;
BYTE InBuff[BUFF_SIZE];
uint8_t InBuff[BUFF_SIZE];
void FillBuffer ();
@ -264,33 +264,33 @@ public:
long Read (void *buffer, long len);
FileReaderLZMA &operator>> (BYTE &v)
FileReaderLZMA &operator>> (uint8_t &v)
{
Read (&v, 1);
return *this;
}
FileReaderLZMA &operator>> (SBYTE &v)
FileReaderLZMA &operator>> (int8_t &v)
{
Read (&v, 1);
return *this;
}
FileReaderLZMA &operator>> (WORD &v)
FileReaderLZMA &operator>> (uint16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderLZMA &operator>> (SWORD &v)
FileReaderLZMA &operator>> (int16_t &v)
{
Read (&v, 2);
v = LittleShort(v);
return *this;
}
FileReaderLZMA &operator>> (DWORD &v)
FileReaderLZMA &operator>> (uint32_t &v)
{
Read (&v, 4);
v = LittleLong(v);
@ -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<BYTE> &GetArray() { return buf; }
TArray<uint8_t> &GetArray() { return buf; }
void UpdateLength() { Length = buf.Size(); }
protected:
TArray<BYTE> buf;
TArray<uint8_t> buf;
};

View File

@ -1218,7 +1218,7 @@ void FParser::SF_ObjFlag(void)
if(mo && flagnum<26) // nullptr check
{
DWORD tempflags = mo->flags;
uint32_t tempflags = mo->flags;
// remove old bit
tempflags &= ~(1 << flagnum);
@ -1953,7 +1953,7 @@ void FParser::SF_SectorColormap(void)
if (t_argv[1].type==svt_string)
{
DWORD cm = R_ColormapNumForName(t_argv[1].value.s);
uint32_t cm = R_ColormapNumForName(t_argv[1].value.s);
FSSectorTagIterator itr(tagnum);
while ((i = itr.Next()) >= 0)
@ -3257,7 +3257,7 @@ void FParser::SF_SpawnMissile()
void FParser::SF_MapThingNumExist()
{
TArray<TObjPtr<AActor> > &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
auto &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
int intval;
@ -3295,7 +3295,7 @@ void FParser::SF_MapThingNumExist()
void FParser::SF_MapThings()
{
TArray<TObjPtr<AActor> > &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
auto &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
t_return.type = svt_int;
t_return.value.i = SpawnedThings.Size();

View File

@ -375,7 +375,7 @@ void T_AddSpawnedThing(AActor * ac)
{
if (DFraggleThinker::ActiveThinker)
{
TArray<TObjPtr<AActor> > &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
auto &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
SpawnedThings.Push(GC::ReadBarrier(ac));
}
}

View File

@ -388,7 +388,7 @@ IMPLEMENT_POINTERS_START(DFraggleThinker)
IMPLEMENT_POINTER(LevelScript)
IMPLEMENT_POINTERS_END
TObjPtr<DFraggleThinker> DFraggleThinker::ActiveThinker;
TObjPtr<DFraggleThinker*> DFraggleThinker::ActiveThinker;
//==========================================================================
//

View File

@ -174,11 +174,11 @@ struct DFsVariable : public DObject
public:
FString Name;
TObjPtr<DFsVariable> next; // for hashing
TObjPtr<DFsVariable*> next; // for hashing
int type; // svt_string or svt_int: same as in svalue_t
FString string;
TObjPtr<AActor> actor;
TObjPtr<AActor*> actor;
union value_t
{
@ -241,7 +241,7 @@ public:
int start_index;
int end_index;
int loop_index;
TObjPtr<DFsSection> next; // for hashing
TObjPtr<DFsSection*> next; // for hashing
DFsSection()
{
@ -320,27 +320,27 @@ public:
// {} sections
TObjPtr<DFsSection> sections[SECTIONSLOTS];
TObjPtr<DFsSection*> sections[SECTIONSLOTS];
// variables:
TObjPtr<DFsVariable> variables[VARIABLESLOTS];
TObjPtr<DFsVariable*> variables[VARIABLESLOTS];
// ptr to the parent script
// the parent script is the script above this level
// eg. individual linetrigger scripts are children
// of the levelscript, which is a child of the
// global_script
TObjPtr<DFsScript> parent;
TObjPtr<DFsScript*> parent;
// haleyjd: 8-17
// child scripts.
// levelscript holds ptrs to all of the level's scripts
// here.
TObjPtr<DFsScript> children[MAXSCRIPTS];
TObjPtr<DFsScript*> children[MAXSCRIPTS];
TObjPtr<AActor> trigger; // object which triggered this script
TObjPtr<AActor*> trigger; // object which triggered this script
bool lastiftrue; // haleyjd: whether last "if" statement was
// true or false
@ -665,7 +665,7 @@ public:
void OnDestroy() override;
void Serialize(FSerializer &arc);
TObjPtr<DFsScript> script;
TObjPtr<DFsScript*> script;
// where we are
int save_point;
@ -674,10 +674,10 @@ public:
int wait_data; // data for wait: tagnum, counter, script number etc
// saved variables
TObjPtr<DFsVariable> variables[VARIABLESLOTS];
TObjPtr<DFsVariable*> variables[VARIABLESLOTS];
TObjPtr<DRunningScript> prev, next; // for chain
TObjPtr<AActor> trigger;
TObjPtr<DRunningScript*> prev, next; // for chain
TObjPtr<AActor*> trigger;
};
//-----------------------------------------------------------------------------
@ -691,9 +691,9 @@ class DFraggleThinker : public DThinker
HAS_OBJECT_POINTERS
public:
TObjPtr<DFsScript> LevelScript;
TObjPtr<DRunningScript> RunningScripts;
TArray<TObjPtr<AActor> > SpawnedThings;
TObjPtr<DFsScript*> LevelScript;
TObjPtr<DRunningScript*> RunningScripts;
TArray<TObjPtr<AActor*> > SpawnedThings;
bool nocheckposition;
bool setcolormaterial;
@ -708,7 +708,7 @@ public:
bool wait_finished(DRunningScript *script);
void AddRunningScript(DRunningScript *runscr);
static TObjPtr<DFraggleThinker> ActiveThinker;
static TObjPtr<DFraggleThinker*> ActiveThinker;
};
//-----------------------------------------------------------------------------

View File

@ -153,7 +153,7 @@ AActor* actorvalue(const svalue_t &svalue)
}
else
{
TArray<TObjPtr<AActor> > &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
auto &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
// this requires some creativity. We use the intvalue
// as the thing number of a thing in the level.
intval = intvalue(svalue);

View File

@ -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);

View File

@ -85,7 +85,7 @@ public:
AInventory *PrevInv(); // Returns the previous item with IF_INVBAR set.
AInventory *NextInv(); // Returns the next item with IF_INVBAR set.
TObjPtr<AActor> Owner; // Who owns this item? NULL if it's still a pickup.
TObjPtr<AActor*> Owner; // Who owns this item? NULL if it's still a pickup.
int Amount; // Amount of item this instance has
int MaxAmount; // Max amount of item this instance can have
int InterHubAmount; // Amount of item that can be kept between hubs or levels

View File

@ -1487,7 +1487,7 @@ static int ntoh_cmp(const void *a, const void *b)
//
//===========================================================================
void P_WriteDemoWeaponsChunk(BYTE **demo)
void P_WriteDemoWeaponsChunk(uint8_t **demo)
{
WriteWord(Weapons_ntoh.Size(), demo);
for (unsigned int i = 1; i < Weapons_ntoh.Size(); ++i)
@ -1505,7 +1505,7 @@ void P_WriteDemoWeaponsChunk(BYTE **demo)
//
//===========================================================================
void P_ReadDemoWeaponsChunk(BYTE **demo)
void P_ReadDemoWeaponsChunk(uint8_t **demo)
{
int count, i;
PClassActor *type;
@ -1570,7 +1570,7 @@ void Net_WriteWeapon(PClassActor *type)
//
//===========================================================================
PClassActor *Net_ReadWeapon(BYTE **stream)
PClassActor *Net_ReadWeapon(uint8_t **stream)
{
int index;

View File

@ -79,11 +79,11 @@ struct FWeaponSlots
void P_PlaybackKeyConfWeapons(FWeaponSlots *slots);
void Net_WriteWeapon(PClassActor *type);
PClassActor *Net_ReadWeapon(BYTE **stream);
PClassActor *Net_ReadWeapon(uint8_t **stream);
void P_SetupWeapons_ntohton();
void P_WriteDemoWeaponsChunk(BYTE **demo);
void P_ReadDemoWeaponsChunk(BYTE **demo);
void P_WriteDemoWeaponsChunk(uint8_t **demo);
void P_ReadDemoWeaponsChunk(uint8_t **demo);
class AWeapon : public AStateProvider
@ -91,7 +91,7 @@ class AWeapon : public AStateProvider
DECLARE_CLASS(AWeapon, AStateProvider)
HAS_OBJECT_POINTERS
public:
DWORD WeaponFlags;
uint32_t WeaponFlags;
PClassActor *AmmoType1, *AmmoType2; // Types of ammo used by this weapon
int AmmoGive1, AmmoGive2; // Amount of each ammo to get when picking up weapon
int MinAmmo1, MinAmmo2; // Minimum ammo needed to switch to this weapon
@ -113,8 +113,8 @@ public:
int SlotPriority;
// In-inventory instance variables
TObjPtr<AInventory> Ammo1, Ammo2;
TObjPtr<AWeapon> SisterWeapon;
TObjPtr<AInventory*> Ammo1, Ammo2;
TObjPtr<AWeapon*> SisterWeapon;
float FOVScale;
int Crosshair; // 0 to use player's crosshair
bool GivenAsMorphWeapon;

View File

@ -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<acsdefered_t> 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.

View File

@ -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<FSectorPortal> 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<DVector2> 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

View File

@ -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[] =
{

View File

@ -86,8 +86,8 @@ public:
DCorpsePointer (AActor *ptr);
void OnDestroy() override;
void Serialize(FSerializer &arc);
TObjPtr<AActor> Corpse;
DWORD Count; // Only the first corpse pointer's count is valid.
TObjPtr<AActor*> Corpse;
uint32_t Count; // Only the first corpse pointer's count is valid.
private:
DCorpsePointer () {}
};
@ -104,7 +104,7 @@ CUSTOM_CVAR(Int, sv_corpsequeuesize, 64, CVAR_ARCHIVE|CVAR_SERVERINFO)
{
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
DCorpsePointer *first = iterator.Next ();
while (first != NULL && first->Count > (DWORD)self)
while (first != NULL && first->Count > (uint32_t)self)
{
DCorpsePointer *next = iterator.Next ();
first->Destroy ();
@ -126,7 +126,7 @@ DCorpsePointer::DCorpsePointer (AActor *ptr)
if (first != this)
{
if (first->Count >= (DWORD)sv_corpsequeuesize)
if (first->Count >= (uint32_t)sv_corpsequeuesize)
{
DCorpsePointer *next = iterator.Next ();
first->Destroy ();

View File

@ -173,7 +173,7 @@ void DBaseDecal::GetXY (side_t *wall, double &ox, double &oy) const
oy = v1->fY() + LeftDistance * dy;
}
void DBaseDecal::SetShade (DWORD rgb)
void DBaseDecal::SetShade (uint32_t rgb)
{
PalEntry *entry = (PalEntry *)&rgb;
AlphaColor = rgb | (ColorMatcher.Pick (entry->r, entry->g, entry->b) << 24);

View File

@ -58,7 +58,7 @@ void DLightningThinker::LightningFlash ()
{
int i, j;
sector_t *tempSec;
BYTE flashLight;
uint8_t flashLight;
if (LightningFlashCount)
{

View File

@ -28,7 +28,7 @@ public:
void OnDestroy() override;
FTextureID StickToWall(side_t *wall, double x, double y, F3DFloor * ffloor);
double GetRealZ (const side_t *wall) const;
void SetShade (DWORD rgb);
void SetShade (uint32_t rgb);
void SetShade (int r, int g, int b);
void Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor);
void GetXY (side_t *side, double &x, double &y) const;
@ -39,10 +39,10 @@ public:
double Z;
double ScaleX, ScaleY;
double Alpha;
DWORD AlphaColor;
uint32_t AlphaColor;
int Translation;
FTextureID PicNum;
DWORD RenderFlags;
uint32_t RenderFlags;
FRenderStyle RenderStyle;
side_t *Side;
sector_t *Sector;
@ -95,7 +95,7 @@ protected:
float Blends[2][4];
int TotalTics;
int StartTic;
TObjPtr<AActor> ForWho;
TObjPtr<AActor*> ForWho;
void SetBlend (float time);
DFlashFader ();
@ -131,7 +131,7 @@ public:
void Serialize(FSerializer &arc);
void Tick ();
TObjPtr<AActor> m_Spot;
TObjPtr<AActor*> m_Spot;
double m_TremorRadius, m_DamageRadius;
int m_Countdown;
int m_CountdownStart;
@ -164,7 +164,7 @@ public:
void Die (AActor *source, AActor *inflictor, int dmgflags);
void OnDestroy() override;
TObjPtr<AActor> UnmorphedMe;
TObjPtr<AActor*> UnmorphedMe;
int UnmorphTime, MorphStyle;
PClassActor *MorphExitFlash;
ActorFlags FlagsSave;

View File

@ -46,7 +46,7 @@ static FRandom pr_spawnmace ("SpawnMace");
IMPLEMENT_CLASS(DSpotState, false, false)
IMPLEMENT_CLASS(ASpecialSpot, false, false)
TObjPtr<DSpotState> DSpotState::SpotState;
TObjPtr<DSpotState*> DSpotState::SpotState;
//----------------------------------------------------------------------------
//

View File

@ -21,7 +21,7 @@ struct FSpotList;
class DSpotState : public DThinker
{
DECLARE_CLASS(DSpotState, DThinker)
static TObjPtr<DSpotState> SpotState;
static TObjPtr<DSpotState*> SpotState;
TArray<FSpotList> SpotLists;
public:

View File

@ -281,7 +281,7 @@ void DHUDMessage::ResetText (const char *text)
V_FreeBrokenLines (Lines);
}
Lines = V_BreakLines (Font, NoWrap ? INT_MAX : width, (BYTE *)text);
Lines = V_BreakLines (Font, NoWrap ? INT_MAX : width, (uint8_t *)text);
NumLines = 0;
Width = 0;

View File

@ -670,7 +670,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
// Weapons List
//
//---------------------------------------------------------------------------
FTextureID GetInventoryIcon(AInventory *item, DWORD flags, bool *applyscale=NULL) // This function is also used by SBARINFO
FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, bool *applyscale=NULL) // This function is also used by SBARINFO
{
FTextureID picnum, AltIcon = item->AltHUDIcon;
FState * state=NULL, *ReadyState;

View File

@ -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)
{

View File

@ -133,8 +133,8 @@ protected:
DHUDMessage () : SourceText(NULL) {}
private:
TObjPtr<DHUDMessage> Next;
DWORD SBarID;
TObjPtr<DHUDMessage*> Next;
uint32_t SBarID;
char *SourceText;
friend class DBaseStatusBar;
@ -225,11 +225,11 @@ struct FMugShotFrame
struct FMugShotState
{
BYTE bUsesLevels:1;
BYTE bHealth2:1; // Health level is the 2nd character from the end.
BYTE bHealthSpecial:1; // Like health2 only the 2nd frame gets the normal health type.
BYTE bDirectional:1; // Faces direction of damage.
BYTE bFinished:1;
uint8_t bUsesLevels:1;
uint8_t bHealth2:1; // Health level is the 2nd character from the end.
uint8_t bHealthSpecial:1; // Like health2 only the 2nd frame gets the normal health type.
uint8_t bDirectional:1; // Faces direction of damage.
uint8_t bFinished:1;
unsigned int Position;
int Time;
@ -415,7 +415,7 @@ private:
void DrawConsistancy () const;
void DrawWaiting () const;
TObjPtr<DHUDMessage> Messages[NUM_HUDMSGLAYERS];
TObjPtr<DHUDMessage*> Messages[NUM_HUDMSGLAYERS];
bool ShowLog;
};
@ -433,7 +433,7 @@ void ST_LoadCrosshair(bool alwaysload=false);
void ST_Clear();
extern FTexture *CrosshairImage;
FTextureID GetInventoryIcon(AInventory *item, DWORD flags, bool *applyscale);
FTextureID GetInventoryIcon(AInventory *item, uint32_t flags, bool *applyscale);
enum DI_Flags
{

View File

@ -189,9 +189,9 @@ class SBarInfoCommand
if (!sc.CheckToken(TK_Null)) sc.MustGetToken(TK_Identifier);
EColorRange returnVal = CR_UNTRANSLATED;
FString namedTranslation; //we must send in "[translation]"
const BYTE *trans_ptr;
const uint8_t *trans_ptr;
namedTranslation.Format("[%s]", sc.String);
trans_ptr = (const BYTE *)(&namedTranslation[0]);
trans_ptr = (const uint8_t *)(&namedTranslation[0]);
if((returnVal = V_ParseFontColor(trans_ptr, CR_UNTRANSLATED, CR_UNTRANSLATED)) == CR_UNDEFINED)
{
sc.ScriptError("Missing definition for color %s.", sc.String);
@ -1379,7 +1379,7 @@ public:
double xScale = 1.0;
double yScale = 1.0;
const BYTE* str = (const BYTE*) cstring;
const uint8_t* str = (const uint8_t*) cstring;
const EColorRange boldTranslation = EColorRange(translation ? translation - 1 : NumTextColors - 1);
int fontcolor = translation;

View File

@ -344,7 +344,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
int maxheight;
double spawnScaleX;
double spawnScaleY;
DWORD flags;
uint32_t flags;
bool applyscale; //Set remotely from from GetInventoryIcon when selected sprite comes from Spawn state
// I'm using imgx/imgy here so that I can inherit drawimage with drawnumber for some commands.
SBarInfoCoordinate imgx;
@ -2132,7 +2132,7 @@ class CommandDrawShader : public SBarInfoCommand
DummySpan[1].TopOffset = 0;
DummySpan[1].Length = 0;
}
const BYTE *GetColumn(unsigned int column, const Span **spans_out)
const uint8_t *GetColumn(unsigned int column, const Span **spans_out)
{
if (spans_out != NULL)
{
@ -2140,10 +2140,10 @@ class CommandDrawShader : public SBarInfoCommand
}
return Pixels + ((column & WidthMask) << HeightBits);
}
const BYTE *GetPixels() { return Pixels; }
const uint8_t *GetPixels() { return Pixels; }
void Unload() {}
private:
BYTE Pixels[512];
uint8_t Pixels[512];
Span DummySpan[2];
};

View File

@ -403,7 +403,7 @@ void DBaseStatusBar::Tick ()
//
//---------------------------------------------------------------------------
void DBaseStatusBar::AttachMessage (DHUDMessage *msg, DWORD id, int layer)
void DBaseStatusBar::AttachMessage (DHUDMessage *msg, uint32_t id, int layer)
{
DHUDMessage *old = NULL;
DHUDMessage **prev;
@ -471,7 +471,7 @@ DHUDMessage *DBaseStatusBar::DetachMessage (DHUDMessage *msg)
return NULL;
}
DHUDMessage *DBaseStatusBar::DetachMessage (DWORD id)
DHUDMessage *DBaseStatusBar::DetachMessage (uint32_t id)
{
for (size_t i = 0; i < countof(Messages); ++i)
{
@ -597,10 +597,10 @@ void DBaseStatusBar::RefreshBackground () const
void DBaseStatusBar::DrawCrosshair ()
{
static DWORD prevcolor = 0xffffffff;
static uint32_t prevcolor = 0xffffffff;
static int palettecolor = 0;
DWORD color;
uint32_t color;
double size;
int w, h;

View File

@ -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;

View File

@ -63,7 +63,7 @@ protected:
private:
void SetRavenDefaults (bool isHexen);
void ReadCVars (DWORD flags);
void ReadCVars (uint32_t flags);
bool bModSetup;

View File

@ -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<FString> quitmessages;
FName mTitleColor;
FName mFontColor;

View File

@ -319,7 +319,7 @@ DEFINE_MAP_OPTION(lightmode, false)
FGLROptions *opt = info->GetOptData<FGLROptions>("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)

View File

@ -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++)
{

View File

@ -265,7 +265,7 @@ void OpenGLFrameBuffer::DoSetGamma()
bool useHWGamma = m_supportsGamma && ((vid_hwgamma == 0) || (vid_hwgamma == 2 && IsFullscreen()));
if (useHWGamma)
{
WORD gammaTable[768];
uint16_t gammaTable[768];
// This formula is taken from Doomsday
float gamma = clamp<float>(Gamma, 0.1f, 4.f);
@ -281,7 +281,7 @@ void OpenGLFrameBuffer::DoSetGamma()
val += bright * 128;
if(gamma != 1) val = pow(val, invgamma) / norm;
gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (WORD)clamp<double>(val*256, 0, 0xffff);
gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (uint16_t)clamp<double>(val*256, 0, 0xffff);
}
SetGammaTable(gammaTable);

View File

@ -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)

View File

@ -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;
uint32_t address;
uint16_t port;
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);

View File

@ -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;

View File

@ -124,12 +124,12 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
if (desc->mPalette.IsNotEmpty() && (lumpnum = Wads.CheckNumForFullName(desc->mPalette, true)) > 0)
{
PalEntry *palette;
const BYTE *orgpal;
const uint8_t *orgpal;
FMemLump lump;
int i;
lump = Wads.ReadLump (lumpnum);
orgpal = (BYTE *)lump.GetMem();
orgpal = (uint8_t *)lump.GetMem();
palette = screen->GetPalette ();
for (i = 256; i > 0; i--, orgpal += 3)
{
@ -721,7 +721,7 @@ void DIntermissionScreenScroller::Drawer ()
DIntermissionController *DIntermissionController::CurrentIntermission;
DIntermissionController::DIntermissionController(FIntermissionDescriptor *Desc, bool DeleteDesc, BYTE state)
DIntermissionController::DIntermissionController(FIntermissionDescriptor *Desc, bool DeleteDesc, uint8_t state)
{
mDesc = Desc;
mDeleteDesc = DeleteDesc;
@ -883,7 +883,7 @@ void DIntermissionController::OnDestroy ()
//
//==========================================================================
void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, BYTE state)
void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, uint8_t state)
{
if (DIntermissionController::CurrentIntermission != NULL)
{
@ -907,7 +907,7 @@ void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, BYTE stat
//
//==========================================================================
void F_StartIntermission(FName seq, BYTE state)
void F_StartIntermission(FName seq, uint8_t state)
{
FIntermissionDescriptor **pdesc = IntermissionDescriptors.CheckKey(seq);
if (pdesc != NULL)

View File

@ -31,15 +31,15 @@ struct FIIntermissionPatch
struct FCastSound
{
BYTE mSequence;
BYTE mIndex;
uint8_t mSequence;
uint8_t mIndex;
FString mSound;
};
struct FICastSound
{
BYTE mSequence;
BYTE mIndex;
uint8_t mSequence;
uint8_t mIndex;
FSoundID mSound;
};
@ -285,11 +285,11 @@ class DIntermissionController : public DObject
HAS_OBJECT_POINTERS
FIntermissionDescriptor *mDesc;
TObjPtr<DIntermissionScreen> mScreen;
TObjPtr<DIntermissionScreen*> mScreen;
bool mDeleteDesc;
bool mFirst;
bool mAdvance, mSentAdvance;
BYTE mGameState;
uint8_t mGameState;
int mIndex;
bool NextPage();
@ -297,7 +297,7 @@ class DIntermissionController : public DObject
public:
static DIntermissionController *CurrentIntermission;
DIntermissionController(FIntermissionDescriptor *mDesc = NULL, bool mDeleteDesc = false, BYTE state = FSTATE_ChangingLevel);
DIntermissionController(FIntermissionDescriptor *mDesc = NULL, bool mDeleteDesc = false, uint8_t state = FSTATE_ChangingLevel);
bool Responder (event_t *ev);
void Ticker ();
void Drawer ();
@ -311,8 +311,8 @@ public:
bool F_Responder (event_t* ev);
void F_Ticker ();
void F_Drawer ();
void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, BYTE state);
void F_StartIntermission(FName desc, BYTE state);
void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, uint8_t state);
void F_StartIntermission(FName desc, uint8_t state);
void F_EndFinale ();
void F_AdvanceIntermission();

View File

@ -382,10 +382,10 @@ bool FIntermissionActionCast::ParseKey(FScanner &sc)
FCastSound *cs = &mCastSounds[mCastSounds.Reserve(1)];
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
cs->mSequence = (BYTE)sc.MatchString(seqs);
cs->mSequence = (uint8_t)sc.MatchString(seqs);
sc.MustGetToken(',');
sc.MustGetToken(TK_IntConst);
cs->mIndex = (BYTE)sc.Number;
cs->mIndex = (uint8_t)sc.Number;
sc.MustGetToken(',');
sc.MustGetToken(TK_StringConst);
cs->mSound = sc.String;
@ -573,7 +573,7 @@ void FMapInfoParser::ParseIntermission()
struct EndSequence
{
SBYTE EndType;
int8_t EndType;
bool MusicLooping;
bool PlayTheEnd;
FString PicName;

View File

@ -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)
{
@ -628,7 +628,7 @@ class DSuicider : public DThinker
DECLARE_CLASS(DSuicider, DThinker)
HAS_OBJECT_POINTERS;
public:
TObjPtr<APlayerPawn> Pawn;
TObjPtr<APlayerPawn*> Pawn;
void Tick()
{

View File

@ -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);
}

View File

@ -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;

View File

@ -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)

View File

@ -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]);

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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 */

Some files were not shown because too many files have changed in this diff Show More