Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang format #831

Merged
merged 1 commit into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source_files/ajbsp/bsp_level.cc
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ void ParseUDMF_Pass(const std::string &data, int pass)

while (lex.TokensLeft())
{
std::string section;
std::string section;

if (!lex.GetNextToken())
return;
Expand Down
8 changes: 4 additions & 4 deletions source_files/ajbsp/bsp_misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void MarkPolyobjSector(Sector *sector)
void MarkPolyobjPoint(double x, double y)
{
size_t i;
int inside_count = 0;
int inside_count = 0;

double best_dist = 999999;
const Linedef *best_match = nullptr;
Expand Down Expand Up @@ -359,7 +359,7 @@ static int VertexCompare(const void *p1, const void *p2)

void DetectOverlappingVertices(void)
{
size_t i;
size_t i;
uint32_t *array = (uint32_t *)UtilCalloc(level_vertices.size() * sizeof(uint32_t));

// sort array of indices
Expand Down Expand Up @@ -489,8 +489,8 @@ void DetectOverlappingLines(void)
// Overlapping lines will then be near each other in this set.
// Note: does not detect partially overlapping lines.

size_t i;
int *array = (int *)UtilCalloc(level_linedefs.size() * sizeof(int));
size_t i;
int *array = (int *)UtilCalloc(level_linedefs.size() * sizeof(int));

// sort array of indices
for (i = 0; i < level_linedefs.size(); i++)
Expand Down
2 changes: 1 addition & 1 deletion source_files/coal/c_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace coal
struct MemoryBlock
{
int used = 0;

double data[4096];
};

Expand Down
10 changes: 5 additions & 5 deletions source_files/ddf/ddf_attack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,13 @@ void DDFAttackCleanUp(void)
a->atk_mobj_ = mobjtypes.Lookup(a->atk_mobj_ref_.c_str());
if (a->atk_mobj_)
{
a->damage_.nominal_ = a->atk_mobj_->explode_damage_.nominal_;
a->damage_.linear_max_ = a->atk_mobj_->explode_damage_.linear_max_;
a->damage_.nominal_ = a->atk_mobj_->explode_damage_.nominal_;
a->damage_.linear_max_ = a->atk_mobj_->explode_damage_.linear_max_;
MapObjectDefinition *atk_mod = (MapObjectDefinition *)a->atk_mobj_; // const override
if (atk_mod->dlight_.type_ == kDynamicLightTypeNone)
{
atk_mod->dlight_.type_ = kDynamicLightTypeModulate;
atk_mod->dlight_.radius_ = atk_mod->radius_ * 4;
atk_mod->dlight_.type_ = kDynamicLightTypeModulate;
atk_mod->dlight_.radius_ = atk_mod->radius_ * 4;
atk_mod->dlight_.autocolour_sprite_ = states[atk_mod->idle_state_].sprite;
}
}
Expand Down Expand Up @@ -581,7 +581,7 @@ void AttackDefinition::Default()
keepfirechance_ = 0.0f;
atk_mobj_ = nullptr;
atk_mobj_ref_.clear();
spawnedobj_ = nullptr;
spawnedobj_ = nullptr;
spawnedobj_ref_.clear();
spawn_limit_ = 0; // unlimited
puff_ = nullptr;
Expand Down
9 changes: 6 additions & 3 deletions source_files/ddf/ddf_game.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ IntermissionMapPositionInfoContainer::IntermissionMapPositionInfoContainer()
//
// wi_mapposdef_container_c Copy constructor
//
IntermissionMapPositionInfoContainer::IntermissionMapPositionInfoContainer(IntermissionMapPositionInfoContainer &rhs) : std::vector<IntermissionMapPositionInfo *>()
IntermissionMapPositionInfoContainer::IntermissionMapPositionInfoContainer(IntermissionMapPositionInfoContainer &rhs)
: std::vector<IntermissionMapPositionInfo *>()
{
Copy(rhs);
}
Expand Down Expand Up @@ -490,7 +491,8 @@ IntermissionFrameInfoContainer::IntermissionFrameInfoContainer()
//
// wi_framedef_container_c Copy constructor
//
IntermissionFrameInfoContainer::IntermissionFrameInfoContainer(IntermissionFrameInfoContainer &rhs) : std::vector<IntermissionFrameInfo *>()
IntermissionFrameInfoContainer::IntermissionFrameInfoContainer(IntermissionFrameInfoContainer &rhs)
: std::vector<IntermissionFrameInfo *>()
{
Copy(rhs);
}
Expand Down Expand Up @@ -617,7 +619,8 @@ IntermissionAnimationInfoContainer::IntermissionAnimationInfoContainer()
//
// wi_animdef_container_c Copy constructor
//
IntermissionAnimationInfoContainer::IntermissionAnimationInfoContainer(IntermissionAnimationInfoContainer &rhs) : std::vector<IntermissionAnimationInfo *>()
IntermissionAnimationInfoContainer::IntermissionAnimationInfoContainer(IntermissionAnimationInfoContainer &rhs)
: std::vector<IntermissionAnimationInfo *>()
{
Copy(rhs);
}
Expand Down
6 changes: 3 additions & 3 deletions source_files/ddf/ddf_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ class ImageDefinition

ImageDataType type_;

RGBAColor colour_; // kImageDataColor
RGBAColor colour_; // kImageDataColor

std::string info_; // kImageDataPackage, kImageDataFile, kImageDataLump
LumpImageFormat format_; //
std::string info_; // kImageDataPackage, kImageDataFile, kImageDataLump
LumpImageFormat format_; //

ImageSpecial special_;

Expand Down
2 changes: 1 addition & 1 deletion source_files/ddf/ddf_language.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::string DDFSanitizeName(const std::string &s)
class LanguageChoice
{
public:
std::string name;
std::string name;
std::unordered_map<std::string, std::string, epi::ContainerStringHash> refs;

LanguageChoice() : name(), refs()
Expand Down
14 changes: 7 additions & 7 deletions source_files/ddf/ddf_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1932,14 +1932,14 @@ DynamicLightDefinition::DynamicLightDefinition(DynamicLightDefinition &rhs)

void DynamicLightDefinition::Copy(DynamicLightDefinition &src)
{
type_ = src.type_;
shape_ = src.shape_;
radius_ = src.radius_;
colour_ = src.colour_;
height_ = src.height_;
leaky_ = src.leaky_;
type_ = src.type_;
shape_ = src.shape_;
radius_ = src.radius_;
colour_ = src.colour_;
height_ = src.height_;
leaky_ = src.leaky_;
autocolour_reference_ = src.autocolour_reference_;
autocolour_sprite_ = src.autocolour_sprite_;
autocolour_sprite_ = src.autocolour_sprite_;

cache_data_ = nullptr;
}
Expand Down
4 changes: 2 additions & 2 deletions source_files/ddf/ddf_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ constexpr float kRideFrictionDefault = 0.7f;

struct JumpActionInfo
{
float chance = 1.0f;
int amount = 0;
float chance = 1.0f;
int amount = 0;
int amount2 = 0;
};

Expand Down
12 changes: 6 additions & 6 deletions source_files/ddf/ddf_states.cc
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ void DDFStateGetDEHParams(const char *arg, State *cur_state)
if (!arg)
return;

values = new int[8]{0,0,0,0,0,0,0,0};
values = new int[8]{0, 0, 0, 0, 0, 0, 0, 0};

std::vector<std::string> args = epi::SeparatedStringVector(arg, ',');

Expand Down Expand Up @@ -817,7 +817,7 @@ void DDFStateGetJumpInt(const char *arg, State *cur_state)
}
else
{
DDFMainGetNumeric(s+1, &jump->amount);
DDFMainGetNumeric(s + 1, &jump->amount);
len = s - arg;
}

Expand Down Expand Up @@ -866,16 +866,16 @@ void DDFStateGetJumpIntPair(const char *arg, State *cur_state)
}
else
{
const char *s2 = strchr(s+1, ',');
const char *s2 = strchr(s + 1, ',');
if (!s2)
{
DDFMainGetNumeric(s+1, &jump->amount);
DDFMainGetNumeric(s + 1, &jump->amount);
jump->amount2 = 0;
}
else
{
if (sscanf(s+1, " %i , %i ", &jump->amount, &jump->amount2) != 2)
DDFError("DDFStateGetJumpIntPair: bad values: %s\n", s+1);
if (sscanf(s + 1, " %i , %i ", &jump->amount, &jump->amount2) != 2)
DDFError("DDFStateGetJumpIntPair: bad values: %s\n", s + 1);
}
len = s - arg;
}
Expand Down
90 changes: 45 additions & 45 deletions source_files/ddf/ddf_thing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,19 @@ static int dlight_radius_warnings = 0;

static DynamicLightDefinition dummy_dlight;

const DDFCommandList dlight_commands[] = {DDF_FIELD("TYPE", dummy_dlight, type_, DDFMobjGetDLight),
DDF_FIELD("GRAPHIC", dummy_dlight, shape_, DDFMainGetString),
DDF_FIELD("RADIUS", dummy_dlight, radius_, DDFMainGetFloat),
DDF_FIELD("COLOUR", dummy_dlight, colour_, DDFMainGetRGB),
DDF_FIELD("HEIGHT", dummy_dlight, height_, DDFMainGetPercent),
DDF_FIELD("LEAKY", dummy_dlight, leaky_, DDFMainGetBoolean),
DDF_FIELD("AUTOCOLOUR", dummy_dlight, autocolour_reference_, DDFMainGetString),
const DDFCommandList dlight_commands[] = {
DDF_FIELD("TYPE", dummy_dlight, type_, DDFMobjGetDLight),
DDF_FIELD("GRAPHIC", dummy_dlight, shape_, DDFMainGetString),
DDF_FIELD("RADIUS", dummy_dlight, radius_, DDFMainGetFloat),
DDF_FIELD("COLOUR", dummy_dlight, colour_, DDFMainGetRGB),
DDF_FIELD("HEIGHT", dummy_dlight, height_, DDFMainGetPercent),
DDF_FIELD("LEAKY", dummy_dlight, leaky_, DDFMainGetBoolean),
DDF_FIELD("AUTOCOLOUR", dummy_dlight, autocolour_reference_, DDFMainGetString),

// backwards compatibility
DDF_FIELD("INTENSITY", dummy_dlight, radius_, DDFMainGetFloat),

// backwards compatibility
DDF_FIELD("INTENSITY", dummy_dlight, radius_, DDFMainGetFloat),

{nullptr, nullptr, 0, nullptr}};
{nullptr, nullptr, 0, nullptr}};

static WeaknessDefinition dummy_weakness;

Expand Down Expand Up @@ -309,11 +310,11 @@ const DDFActionCode thing_actions[] = {{"NOTHING", nullptr, nullptr},
{"SET_INVULNERABLE", A_SetInvuln, nullptr},
{"CLEAR_INVULNERABLE", A_ClearInvuln, nullptr},
{"SET_PAINCHANCE", A_PainChanceSet, DDFStateGetPercent},

{"GRAVITY", A_Gravity, nullptr},
{"NO_GRAVITY", A_NoGravity, nullptr},

{"CLEAR_TARGET", A_ClearTarget, nullptr},
{"CLEAR_TARGET", A_ClearTarget, nullptr},
{"FRIEND_LOOKOUT", A_FriendLook, nullptr},

{"SET_SCALE", A_ScaleSet, DDFStateGetFloat},
Expand Down Expand Up @@ -1569,7 +1570,7 @@ static DDFSpecialFlags extended_specials[] = {{"RESPAWN", kExtendedFlagNoRespawn
{"USABLE", kExtendedFlagUsable, 0},
{"BLOCK_SHOTS", kExtendedFlagBlockShots, 0},
{"TUNNEL", kExtendedFlagTunnel, 0},
{"BORE", (kExtendedFlagTunnel|kExtendedFlagBore), 0},
{"BORE", (kExtendedFlagTunnel | kExtendedFlagBore), 0},
{"SIMPLE_ARMOUR", kExtendedFlagSimpleArmour, 0},
{nullptr, 0, 0}};

Expand Down Expand Up @@ -1600,12 +1601,11 @@ static DDFSpecialFlags hyper_specials[] = {

// MBF21 Boss Flags are already handled and converted to RTS in the Dehacked processor,
// so they do not appear here
static DDFSpecialFlags mbf21_specials[] = {
{"LOGRAV", kMBF21FlagLowGravity, 0},
{"SHORTMRANGE", kMBF21FlagShortMissileRange, 0},
{"LONGMELEE", kMBF21FlagLongMeleeRange, 0},
{"FORCERADIUSDMG", kMBF21FlagForceRadiusDamage, 0},
{nullptr, 0, 0}};
static DDFSpecialFlags mbf21_specials[] = {{"LOGRAV", kMBF21FlagLowGravity, 0},
{"SHORTMRANGE", kMBF21FlagShortMissileRange, 0},
{"LONGMELEE", kMBF21FlagLongMeleeRange, 0},
{"FORCERADIUSDMG", kMBF21FlagForceRadiusDamage, 0},
{nullptr, 0, 0}};

//
// DDFMobjGetSpecial
Expand Down Expand Up @@ -1828,7 +1828,7 @@ static void DDFMobjStateGetRADTrigger(const char *arg, State *cur_state)
if (!arg || !arg[0])
return;

//int *val_ptr = new int;
// int *val_ptr = new int;
uint64_t *val_ptr = new uint64_t;

// Modified RAD_CheckForInt
Expand Down Expand Up @@ -1939,15 +1939,15 @@ static void DDFMobjStateGetDEHMelee(const char *arg, State *cur_state)
return;

AttackDefinition *atk = new AttackDefinition();
atk->name_ = arg;
atk->attackstyle_ = kAttackStyleCloseCombat;
atk->attack_class_ = epi::BitSetFromChar('C');
atk->flags_ = (AttackFlags)(kAttackFlagFaceTarget | kAttackFlagNeedSight);
atk->name_ = arg;
atk->attackstyle_ = kAttackStyleCloseCombat;
atk->attack_class_ = epi::BitSetFromChar('C');
atk->flags_ = (AttackFlags)(kAttackFlagFaceTarget | kAttackFlagNeedSight);
atk->damage_.Default(DamageClass::kDamageClassDefaultAttack);
atk->damage_.nominal_ = 3.0f;
atk->damage_.nominal_ = 3.0f;
atk->damage_.linear_max_ = 24.0f;
atk->puff_ref_ = "PUFF";
atk->range_ = 64.0f;
atk->puff_ref_ = "PUFF";
atk->range_ = 64.0f;

size_t arg_size = args.size();

Expand All @@ -1969,7 +1969,7 @@ static void DDFMobjStateGetDEHMelee(const char *arg, State *cur_state)
if (sscanf(args[2].c_str(), "%d", &sound_id) == 1 && sound_id != 0)
{
SoundEffectDefinition *sound = sfxdefs.DEHLookup(sound_id);
atk->sound_ = sfxdefs.GetEffect(sound->name_.c_str());
atk->sound_ = sfxdefs.GetEffect(sound->name_.c_str());
}
}
if (arg_size > 3)
Expand All @@ -1993,8 +1993,8 @@ static void DDFMobjStateGetDEHProjectile(const char *arg, State *cur_state)

// Sort of a WAG based on the avergage 32 attack height vs. 56 thing height in stock DDF
// for a lot of stock Doom monsters
float dynamic_atk_height = dynamic_mobj->height_ * 0.5714285714285714f;
std::string atk_check_name = epi::StringFormat("%s_%d", arg, (int)dynamic_atk_height);
float dynamic_atk_height = dynamic_mobj->height_ * 0.5714285714285714f;
std::string atk_check_name = epi::StringFormat("%s_%d", arg, (int)dynamic_atk_height);

AttackDefinition *atk_check = atkdefs.Lookup(atk_check_name.c_str());

Expand All @@ -2010,15 +2010,15 @@ static void DDFMobjStateGetDEHProjectile(const char *arg, State *cur_state)
return;

AttackDefinition *atk = new AttackDefinition();
atk->name_ = atk_check_name;
atk->atk_mobj_ref_ = args[0];
atk->name_ = atk_check_name;
atk->atk_mobj_ref_ = args[0];

size_t arg_size = args.size();

atk->range_ = 2048.0f;
atk->attackstyle_ = kAttackStyleProjectile;
atk->range_ = 2048.0f;
atk->attackstyle_ = kAttackStyleProjectile;
atk->attack_class_ = epi::BitSetFromChar('M');
atk->flags_ = (AttackFlags)(kAttackFlagFaceTarget|kAttackFlagInheritTracerFromTarget);
atk->flags_ = (AttackFlags)(kAttackFlagFaceTarget | kAttackFlagInheritTracerFromTarget);
atk->damage_.Default(DamageClass::kDamageClassDefaultAttack);
atk->height_ = dynamic_atk_height;

Expand Down Expand Up @@ -2071,16 +2071,16 @@ static void DDFMobjStateGetDEHBullet(const char *arg, State *cur_state)
return;

AttackDefinition *atk = new AttackDefinition();
atk->name_ = arg;
atk->range_ = 2048.0f;
atk->attackstyle_ = kAttackStyleShot;
atk->attack_class_ = epi::BitSetFromChar('B');
atk->flags_ = kAttackFlagFaceTarget;
atk->name_ = arg;
atk->range_ = 2048.0f;
atk->attackstyle_ = kAttackStyleShot;
atk->attack_class_ = epi::BitSetFromChar('B');
atk->flags_ = kAttackFlagFaceTarget;
atk->damage_.Default(DamageClass::kDamageClassDefaultAttack);
atk->count_ = 1;
atk->damage_.nominal_ = 3.0f;
atk->count_ = 1;
atk->damage_.nominal_ = 3.0f;
atk->damage_.linear_max_ = 15.0f;
atk->puff_ref_ = "PUFF";
atk->puff_ref_ = "PUFF";

size_t arg_size = args.size();

Expand Down Expand Up @@ -2646,7 +2646,7 @@ void MapObjectDefinition::Default()
splash_group_ = -2;
fast_speed_ = -1;
melee_range_ = -1;
deh_thing_id_ = 0;
deh_thing_id_ = 0;
}

void MapObjectDefinition::DLightCompatibility(void)
Expand Down
Loading
Loading