Update clang-format as self-contained binary (#1257)

Version 18.1.6 pulled from
https://github.com/xeeynamo/sotn-decomp/releases and compiled with the
following:

```Dockerfile
FROM alpine:latest
RUN apk add --no-cache \
    build-base \
    cmake \
    git \
    ninja \
    libstdc++ \
    zlib-dev \
    python3
ENV LLVM_VERSION=llvmorg-18.1.6
RUN mkdir -p /opt/llvm \
    && cd /opt/llvm \
    && git clone --depth=1 --branch $LLVM_VERSION https://github.com/llvm/llvm-project.git \
    && mkdir -p llvm-project/build \
    && cd llvm-project/build \
    && cmake -G Ninja \
        -DLLVM_ENABLE_PROJECTS=clang \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_CXX_FLAGS="-static-libstdc++ -static-libgcc" \
        -DCMAKE_EXE_LINKER_FLAGS="-static" \
        -DLLVM_ENABLE_RTTI=ON \
        ../llvm \
    && ninja clang-format \
    && strip bin/clang-format
FROM scratch
COPY --from=0 /opt/llvm/llvm-project/build/bin/clang-format /clang-format
ENTRYPOINT ["/usr/local/bin/clang-format"]
```
`docker build --output . .`

Original source code:
https://github.com/llvm/llvm-project/tree/llvmorg-18.1.6
commit: `1118c2e05e67a36ed8ca250524525cdb66a55256`
This commit is contained in:
Luciano Ciccariello 2024-06-04 21:07:50 +01:00 committed by GitHub
parent e62f6c3a64
commit 151346d62c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
69 changed files with 197 additions and 170 deletions

View File

@ -4,13 +4,40 @@ Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: false # might want to change into AcrossComments
AlignConsecutiveAssignments: false # might want to change into AcrossComments
AlignConsecutiveBitFields: false # might want to change into AcrossComments
AlignConsecutiveDeclarations: false # might want to change into AcrossComments
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: true
AcrossComments: true
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
@ -48,14 +75,15 @@ BraceWrapping:
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeConceptDeclarations: Always
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakAfterAttributes: Leave
BreakArrays: true
BreakBeforeInlineASMColon: OnlyMultiline
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
@ -64,16 +92,12 @@ CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: NextLine
BasedOnStyle: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: true
ForEachMacros:
- foreach
@ -103,14 +127,25 @@ IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentRequiresClause: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: true
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@ -135,11 +170,15 @@ PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: ReturnStatement
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: Never
SortJavaStaticImport: Before
SortUsingDeclarations: true
SortUsingDeclarations: Never
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
@ -148,6 +187,7 @@ SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
@ -156,20 +196,24 @@ SpaceBeforeParensOptions:
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Before
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1
SpacesInParentheses: false
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
@ -181,10 +225,12 @@ StatementMacros:
- QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

View File

@ -120,10 +120,10 @@ clean:
git clean -fdx config/
git clean -fdx function_calls/
git clean -fdx sotn_calltree.txt
format:
clang-format -i $$(find $(SRC_DIR)/ -type f -name "*.c" | grep -v 'src/pc/3rd')
clang-format -i $$(find $(SRC_DIR)/ -type f -name "*.h" | grep -v 'src/pc/3rd')
clang-format -i $$(find $(INCLUDE_DIR)/ -type f -name "*.h")
format: bin/clang-format
bin/clang-format -i $$(find $(SRC_DIR)/ -type f -name "*.c" | grep -v 'src/pc/3rd')
bin/clang-format -i $$(find $(SRC_DIR)/ -type f -name "*.h" | grep -v 'src/pc/3rd')
bin/clang-format -i $$(find $(INCLUDE_DIR)/ -type f -name "*.h")
cargo run --release --manifest-path ./tools/lints/sotn-lint/Cargo.toml ./src
black tools/*.py
black tools/splat_ext/*.py

View File

@ -0,0 +1 @@
4eee96d9c35df565da6266a8364d93bd7dbac35783cf0e0de2628057d0b8a1ac bin/clang-format.tar.gz

View File

@ -17,26 +17,7 @@ D_800ACE88_hd = 0x800ACE88;
D_800ACE98_hd = 0x800ACE98;
D_800ACEA8_hd = 0x800ACEA8;
D_800ACEB0_hd = 0x800ACEB0;
D_800ACE20 = 0x800ACEB8;
D_800ACEDC_hd = 0x800ACEDC;
D_800ACE44 = 0x800ACEE0;
D_800ACE48 = 0x800ACEE4;
D_800ACE60 = 0x800ACEFC;
D_800ACDF8 = 0x800ACF04;
D_800ACDFC = 0x800ACF08;
D_800ACE00 = 0x800ACF0C;
D_800ACE68 = 0x800ACF2C;
D_800ACE70 = 0x800ACF34;
D_800ACE78 = 0x800ACF3C;
D_800ACE88 = 0x800ACF4C;
D_800ACE90 = 0x800ACF54;
D_800ACE98 = 0x800ACF5C;
D_800ACEA8 = 0x800ACF6C;
D_800ACEB0 = 0x800ACF74;
D_800ACEC0 = 0x800ACF84;
D_800ACF8A_hd = 0x800ACF8A;
D_800ACED0 = 0x800ACF94;
D_800ACEE0 = 0x800ACFA4;
D_800ACF4C = 0x800AD010;
D_800ACF54 = 0x800AD018;
D_800ACF60 = 0x800AD024;
@ -197,8 +178,6 @@ func_80103EAC = 0x80103CF4;
func_801042C4 = 0x8010410C;
DestroyEntity = 0x801063CC;
func_80106A28 = 0x80106864;
func_8010D010 = 0x8010CD54;
func_8010D2C8 = 0x8010D00C;
SetPlayerStep = 0x8010D2C8;
func_8010DA48 = 0x8010D78C;
func_8010DFF0 = 0x8010DD34;

View File

@ -50,7 +50,7 @@
int sprintf(char* dst, const char* fmt, ...);
#endif
#define FIX(x) ((s32)((x)*65536.0))
#define FIX(x) ((s32)((x) * 65536.0))
#define FIX_TO_I(x) ((s32)((x) >> 16))
// The second argument to CreateEntFactoryFromEntity has weird bit packing,
@ -63,7 +63,7 @@ int sprintf(char* dst, const char* fmt, ...);
// PSX SDK libraries do not use float. Instead they use a fix-point number
// where 4096 is equal to 1.0.
#define FLT(x) ((s32)((x)*4096.0))
#define FLT(x) ((s32)((x) * 4096.0))
// Access to the Scratchpad memory. Different on different systems.
#if defined(VERSION_PC)

View File

@ -303,13 +303,13 @@ extern u8 g_BmpCastleMap[0x20000];
#define DEMO_KEY_LEN 3
#define DEMO_MAX_LEN 0x2000
#define FONT_W 8 // small font size used for dialogues and menu
#define FONT_H 8 // small font size used for dialogues and menu
#define FONT_GAP FONT_W // gap between the beginning of two letters
#define FONT_SPACE 4 // gap for the space character
#define MENUCHAR(x) ((x)-0x20) // 8x8 characters are ASCII offset by 0x20
#define DIAG_EOL 0xFF // end of line
#define DIAG_EOS 0x00 // end of string
#define FONT_W 8 // small font size used for dialogues and menu
#define FONT_H 8 // small font size used for dialogues and menu
#define FONT_GAP FONT_W // gap between the beginning of two letters
#define FONT_SPACE 4 // gap for the space character
#define MENUCHAR(x) ((x) - 0x20) // 8x8 characters are ASCII offset by 0x20
#define DIAG_EOL 0xFF // end of line
#define DIAG_EOS 0x00 // end of string
#define SAVE_FLAG_NORMAL (0)
#define SAVE_FLAG_CLEAR (1)

View File

@ -116,10 +116,11 @@
#define getTPage(tp, abr, x, y) \
((GetGraphType() == 1 || GetGraphType() == 2) \
? ((((tp)&0x3) << 9) | (((abr)&0x3) << 7) | (((y)&0x300) >> 3) | \
(((x)&0x3ff) >> 6)) \
: ((((tp)&0x3) << 7) | (((abr)&0x3) << 5) | (((y)&0x100) >> 4) | \
(((x)&0x3ff) >> 6) | (((y)&0x200) << 2)))
? ((((tp) & 0x3) << 9) | (((abr) & 0x3) << 7) | \
(((y) & 0x300) >> 3) | (((x) & 0x3ff) >> 6)) \
: ((((tp) & 0x3) << 7) | (((abr) & 0x3) << 5) | \
(((y) & 0x100) >> 4) | (((x) & 0x3ff) >> 6) | \
(((y) & 0x200) << 2)))
#define getClut(x, y) ((y << 6) | ((x >> 4) & 0x3f))

View File

@ -1174,7 +1174,7 @@ void RenderEntities(void) {
}
#endif
#define PL_SPRT(x, y, flipx) (x), ((y)&0x1FF) | ((flipx) << 9)
#define PL_SPRT(x, y, flipx) (x), ((y) & 0x1FF) | ((flipx) << 9)
s16 D_800A21B8[] = {
PL_SPRT(0x0201, 0x0101, false), PL_SPRT(0x0221, 0x0101, false),
PL_SPRT(0x0231, 0x0101, false), PL_SPRT(0x0201, 0x0181, false),

View File

@ -480,7 +480,7 @@ s32 func_800FE044(s32 amount, s32 type) {
}
bool IsRelicActive(RelicIds relicId) {
if ((g_Status.relics[relicId] & RELIC_FLAG_ACTIVE)) {
if (g_Status.relics[relicId] & RELIC_FLAG_ACTIVE) {
return 1;
}
return 0;

View File

@ -1570,7 +1570,7 @@ void func_8010C9F4(void) {
return;
}
for (; i < 4; i++) {
if ((g_Player.colliders2[i].effects & EFFECT_SOLID_FROM_ABOVE)) {
if (g_Player.colliders2[i].effects & EFFECT_SOLID_FROM_ABOVE) {
continue;
}
if ((g_Player.unk0C & 2) && (collider.effects & 0x10)) {
@ -1578,7 +1578,7 @@ void func_8010C9F4(void) {
}
temp_s0 = g_Player.colliders2[i].effects &
(EFFECT_UNK_8000 | EFFECT_UNK_0800 | EFFECT_SOLID);
if (((temp_s0 == EFFECT_SOLID) || (temp_s0 & EFFECT_UNK_8000))) {
if ((temp_s0 == EFFECT_SOLID) || (temp_s0 & EFFECT_UNK_8000)) {
if ((g_Player.unk0C & 3) && !(temp_s0 & EFFECT_SOLID)) {
continue;
}
@ -1707,7 +1707,7 @@ void func_8010C9F4(void) {
argX = var_a1 + (*xPosPtr + D_800ACEC0[i].x);
argY = *yPosPtr + D_800ACEC0[i].y + g_Player.colliders2[i].unk8;
CheckCollision(argX, argY, &collider, 0);
if ((collider.effects & 1)) {
if (collider.effects & 1) {
if (!(*vram_ptr & 1)) {
*yPosPtr +=
collider.unk20 + g_Player.colliders2[i].unk8;

View File

@ -303,7 +303,7 @@ void func_801120B4(void) {
local_flags = 1;
}
if (((u16)PLAYER.animFrameIdx >= 7U) ||
((PLAYER.animFrameDuration < 0))) {
(PLAYER.animFrameDuration < 0)) {
local_flags = 7;
}
break;

View File

@ -187,7 +187,7 @@ void func_801131C4(void) {
if ((g_Player.padTapped & PAD_CROSS) && !(g_Player.unk46 & PAD_LEFT)) {
if (g_Player.padPressed & PAD_DOWN) {
for (i = 0; i < 4; i++) {
if ((g_Player.colliders[i].effects & EFFECT_SOLID_FROM_ABOVE)) {
if (g_Player.colliders[i].effects & EFFECT_SOLID_FROM_ABOVE) {
g_Player.D_80072F00[7] = 8;
return;
}
@ -880,13 +880,13 @@ void AlucardHandleDamage(DamageParam* damage, s16 arg1) {
if ((g_StageId != STAGE_BO6) && (g_StageId != STAGE_RBO6) &&
(g_StageId != STAGE_DRE)) {
for (var_s0 = 2; var_s0 < 7; var_s0++) {
if ((g_Player.colliders3[var_s0].effects & 2)) {
if (g_Player.colliders3[var_s0].effects & 2) {
break;
}
}
if (var_s0 == 7) {
for (var_s0 = 9; var_s0 < 14; var_s0++) {
if ((g_Player.colliders3[var_s0].effects & 2)) {
if (g_Player.colliders3[var_s0].effects & 2) {
break;
}
}

View File

@ -2549,7 +2549,7 @@ void func_8012D28C(bool exitEarly) {
// Start a routine where we look through this array for a value.
bitNotFound = 0;
for (i = 3; i < 7; i++) {
if ((g_Player.colliders3[i].effects & EFFECT_UNK_0002)) {
if (g_Player.colliders3[i].effects & EFFECT_UNK_0002) {
break;
}
}
@ -2557,7 +2557,7 @@ void func_8012D28C(bool exitEarly) {
// and keep searching.
if (i == 7) {
for (i = 10; i < 14; i++) {
if ((g_Player.colliders3[i].effects & EFFECT_UNK_0002)) {
if (g_Player.colliders3[i].effects & EFFECT_UNK_0002) {
break;
}
}

View File

@ -414,9 +414,9 @@ void func_8012E550(void) {
DecelerateX(FIX(0.125));
if (g_Player.padTapped & PAD_CROSS) {
if ((g_Player.padPressed & PAD_DOWN)) {
if (g_Player.padPressed & PAD_DOWN) {
for (i = 0; i < 4; i++) {
if ((g_Player.colliders[i].effects & EFFECT_SOLID_FROM_ABOVE)) {
if (g_Player.colliders[i].effects & EFFECT_SOLID_FROM_ABOVE) {
g_Player.D_80072F00[7] = 8;
func_8012CED4();
PLAYER.animFrameIdx = 4;

View File

@ -22,9 +22,9 @@
#define GREEN_MASK 0x3E0
#define BLUE_MASK 0x7C00
#define GET_RED(x) ((x)&RED_MASK)
#define GET_GREEN(x) ((x)&GREEN_MASK)
#define GET_BLUE(x) ((x)&BLUE_MASK)
#define GET_RED(x) ((x) & RED_MASK)
#define GET_GREEN(x) ((x) & GREEN_MASK)
#define GET_BLUE(x) ((x) & BLUE_MASK)
typedef enum {
MENU_DG_MAIN,

View File

@ -18,7 +18,7 @@ typedef struct {
/* 0x0A */ s16 padding;
} MenuContextInit; // size = 0x1C
#define CH(x) ((x)-0x20)
#define CH(x) ((x) - 0x20)
#if defined(VERSION_US)
#define ShowText(str, id) func_800F99B8(str, id, 0);
@ -2358,7 +2358,7 @@ void func_800F99B8(const char* str, s32 arg1, s32 arg2) {
}
}
for (i = 0; i < FontHeight; i++) {
if ((var_a2[i * FontStride + var_a3] & 0xF0)) {
if (var_a2[i * FontStride + var_a3] & 0xF0) {
break;
}
}

View File

@ -47,7 +47,7 @@ Callback setIntrDMA(int index, Callback callback) {
if (callback != NULL) {
D_8002D380[index] = callback;
*D_8002D37C =
(*D_8002D37C & 0xFFFFFF) | 0x800000 | ((1 << (index + 16)));
(*D_8002D37C & 0xFFFFFF) | 0x800000 | (1 << (index + 16));
} else {
D_8002D380[index] = 0;
*D_8002D37C =

View File

@ -44,7 +44,7 @@ void _SsSndDecrescendo(s16 arg0, s16 arg1) {
SpuVmGetSeqVol(arg0 | (arg1 << 8), &stack.voll, &stack.volr);
if ((score->unk3E >=
((score->unk94 - score->unk98) * -score->unk42)) &&
(((-score->unk42 < stack.voll) != 0))) {
((-score->unk42 < stack.voll) != 0)) {
SpuVmSetSeqVol(arg0 | (arg1 << 8), stack.voll + score->unk42,
stack.volr + score->unk42, 0);
} else {

View File

@ -12,7 +12,7 @@ void _SsSndTempo(s16 arg0, s16 arg1) {
if (pSeq->unk44 > 0) {
if ((pSeq->unkA0 % ((u32)pSeq->unk44)) == 0) {
if ((pSeq->unk8c > pSeq->unkA4)) {
if (pSeq->unk8c > pSeq->unkA4) {
pSeq->unk8c--;
} else if (pSeq->unk8c < pSeq->unkA4) {
pSeq->unk8c++;

View File

@ -656,7 +656,7 @@ s16 SsUtKeyOn(
}
_snd_ev_flag = 1;
if ((SpuVmVSetUp(vabId, prog) == 0)) {
if (SpuVmVSetUp(vabId, prog) == 0) {
_svm_cur.field_16_vag_idx = 0x21;
_svm_cur.field_2_note = note;
_svm_cur.field_0x3 = fine;

View File

@ -46,7 +46,7 @@ char* CdSyncModeToStr(int mode) {
return "";
}
#define DECODE_BCD(x) (((x) >> 4) * 10 + ((x)&0xF))
#define DECODE_BCD(x) (((x) >> 4) * 10 + ((x) & 0xF))
int CdPosToInt(CdlLOC* p) {
return (75 * (60 * DECODE_BCD(p->minute) + DECODE_BCD(p->second))) +

View File

@ -396,7 +396,7 @@ SDL_Texture* GetVramTexture(int tpage, int clut) {
// that is half brightness. A value of 0xFF on PSX is double the brightness.
// Higher values than 0x80 on PC are for now ignored without a GPU shader.
// NOTE: For some reason it only works well on sprite primitives?
#define PSX_COL(x) MIN(0xFF, ((unsigned int)(x)*2 - 1))
#define PSX_COL(x) MIN(0xFF, ((unsigned int)(x) * 2 - 1))
#define PSX_TEX_U(x) ((float)(x) / 256.0f)
#define PSX_TEX_V(x) ((float)(x) / 256.0f)

View File

@ -655,7 +655,7 @@ block_48:
if ((PLAYER.step == 0x10) && (PLAYER.animFrameDuration < 0)) {
PLAYER.animCurFrame |= 0x8000;
}
if ((g_Player.unk0C & 0x50)) {
if (g_Player.unk0C & 0x50) {
return;
}
func_8015C4AC();

View File

@ -309,7 +309,7 @@ void func_80159670(void) {
if ((g_Player.padTapped & PAD_CROSS) && (g_Player.unk46 == 0) &&
(g_Player.padPressed & PAD_DOWN)) {
for (i = 0; i < 4; i++) {
if ((g_Player.colliders[i].effects & EFFECT_SOLID_FROM_ABOVE)) {
if (g_Player.colliders[i].effects & EFFECT_SOLID_FROM_ABOVE) {
g_Player.D_80072F00[7] = 8;
return;
}
@ -677,13 +677,13 @@ void RichterHandleDamage(s32 arg0, u32 arg1, s16 arg2) {
if ((g_StageId != STAGE_BO6) && (g_StageId != STAGE_RBO6) &&
(g_StageId != STAGE_DRE)) {
for (i = 2; i < 7; i++) {
if ((g_Player.colliders3[i].effects & 2)) {
if (g_Player.colliders3[i].effects & 2) {
break;
}
}
if (i == 7) {
for (i = 9; i < 0xE; i++) {
if ((g_Player.colliders3[i].effects & 2)) {
if (g_Player.colliders3[i].effects & 2) {
break;
}
}

View File

@ -586,8 +586,8 @@ void func_8015E800(void) {
if (temp_a0 & EFFECT_SOLID_FROM_BELOW) {
continue;
}
if (((temp_a0 & EFFECT_UNK_0002) || (PLAYER.velocityY >= 0) ||
((PLAYER.step == 26) && (temp_a0 & EFFECT_UNK_8000)))) {
if ((temp_a0 & EFFECT_UNK_0002) || (PLAYER.velocityY >= 0) ||
((PLAYER.step == 26) && (temp_a0 & EFFECT_UNK_8000))) {
temp_s0 = g_Player.colliders[i].effects &
(EFFECT_UNK_8000 | EFFECT_UNK_0800 | EFFECT_SOLID);
if ((temp_s0 == EFFECT_SOLID) ||
@ -752,7 +752,7 @@ void func_8015EE28(void) {
for (i = 1; i < 4; i++) {
var_a0 = g_Player.colliders2[i].effects;
temp_s0 = var_a0 & (EFFECT_UNK_8000 | EFFECT_UNK_0800 | EFFECT_SOLID);
if ((var_a0 & EFFECT_SOLID_FROM_ABOVE)) {
if (var_a0 & EFFECT_SOLID_FROM_ABOVE) {
continue;
}
if ((temp_s0 == EFFECT_SOLID) || (var_a0 & EFFECT_UNK_8000)) {
@ -883,7 +883,7 @@ void func_8015EE28(void) {
argX = var_a1 + (*xPosPtr + D_801545E4[i].x);
argY = *yPosPtr + D_801545E4[i].y + g_Player.colliders2[i].unk8;
g_api.CheckCollision(argX, argY, &collider, 0);
if ((collider.effects & 1)) {
if (collider.effects & 1) {
if (!(*vram_ptr & 1)) {
*yPosPtr +=
collider.unk20 + g_Player.colliders2[i].unk8;

View File

@ -263,19 +263,19 @@ void EntityShrinkingPowerUpRing(Entity* self) {
((prim2->v1 - constE0) * self->ext.ricPowerRing.unk82) / 0x100;
prim1->x2 =
selfX +
(((rcos((i + 1 << 8)) * 2) >> 8) * self->ext.ricPowerRing.unk84) /
(((rcos(i + 1 << 8) * 2) >> 8) * self->ext.ricPowerRing.unk84) /
0x100;
prim1->y2 =
selfY -
(((rsin((i + 1 << 8)) * 2) >> 8) * self->ext.ricPowerRing.unk86) /
(((rsin(i + 1 << 8) * 2) >> 8) * self->ext.ricPowerRing.unk86) /
0x100;
prim1->x3 =
selfX +
(((rcos((i + 2 << 8)) * 2) >> 8) * self->ext.ricPowerRing.unk84) /
(((rcos(i + 2 << 8) * 2) >> 8) * self->ext.ricPowerRing.unk84) /
0x100;
prim1->y3 =
selfY -
(((rsin((i + 2 << 8)) * 2) >> 8) * self->ext.ricPowerRing.unk86) /
(((rsin(i + 2 << 8) * 2) >> 8) * self->ext.ricPowerRing.unk86) /
0x100;
prim2->x2 = prim1->x0 = (prim2->x0 + prim1->x2) / 2;
prim2->y2 = prim1->y0 = (prim2->y0 + prim1->y2) / 2;

View File

@ -131,7 +131,7 @@ void EntityHolyWater(Entity* self) {
argY = 4;
}
collision_result |= func_8016840C(-7, argY);
if ((collision_result & 1)) {
if (collision_result & 1) {
self->velocityX *= 2;
self->step--;
}
@ -2148,7 +2148,7 @@ void EntitySubwpnCrashVibhuti(Entity* self) {
}
prim = &g_PrimBuf[self->primIndex];
for (i = 0; i < 9; i++) {
if ((prim->drawMode & 8)) {
if (prim->drawMode & 8) {
break;
}
prim = prim->next;

View File

@ -334,7 +334,7 @@ void AddHearts(s32 value) {
Entity* temp;
if (g_Status.hearts < g_Status.heartsMax) {
g_Status.hearts += value;
if ((g_Status.hearts > g_Status.heartsMax)) { // swapped
if (g_Status.hearts > g_Status.heartsMax) { // swapped
g_Status.hearts = g_Status.heartsMax;
}
temp = g_Entities;

View File

@ -124,7 +124,7 @@ Fixed32 MTH_Sqrt(Fixed32 x);
Fixed32 MTH_Hypot(Fixed32 x, Fixed32 y);
#define MTH_FLOAT(x) ((Float32)((long)(x) / 65536.0))
#define MTH_FIXED(x) ((Fixed32)((x)*65536.0))
#define MTH_FIXED(x) ((Fixed32)((x) * 65536.0))
Fixed32 MTH_IntToFixed(Sint32 x);
Sint32 MTH_FixedToInt(Fixed32 x);
Fixed32 MTH_Mul(Fixed32 a, Fixed32 b);

View File

@ -444,7 +444,7 @@ void SCL_PriorityInit(void) {
}
// func_06025214
Uint32 SCL_GetColRamMode(void) {
return ((Uint32)((Scl_s_reg.ramcontrl & 0x3000) >> 12));
return (Uint32)((Scl_s_reg.ramcontrl & 0x3000) >> 12);
}
// func_06025244
@ -1761,24 +1761,24 @@ Uint32 SCL_AllocColRam(Uint32 Surface, Uint32 NumOfColors, Uint8 transparent) {
SCL_FreeColRam(Surface);
if (SclColRamAlloc2048[0] != 0)
return ((Uint32)NULL);
return (Uint32)NULL;
switch (SCL_GetColRamMode()) {
case SCL_CRM15_1024:
if (1024 < NumOfColors)
return ((Uint32)NULL);
return (Uint32)NULL;
Max256 = 4;
Size256 = 512;
break;
case SCL_CRM15_2048:
if (2048 < NumOfColors)
return ((Uint32)NULL);
return (Uint32)NULL;
Max256 = 8;
Size256 = 512;
break;
case SCL_CRM24_1024:
if (1024 < NumOfColors)
return ((Uint32)NULL);
return (Uint32)NULL;
Max256 = 4;
Size256 = 1024;
break;
@ -1789,16 +1789,16 @@ Uint32 SCL_AllocColRam(Uint32 Surface, Uint32 NumOfColors, Uint8 transparent) {
if (SclColRamAlloc256[i] == 0) {
SclColRamAlloc256[i] = Surface;
SCL_SetColRamOffset(Surface, i, transparent);
return (SCL_COLRAM_ADDR + (Size256 * i));
return SCL_COLRAM_ADDR + (Size256 * i);
}
}
} else {
for (i = 0; i < Max256; i++)
if (SclColRamAlloc256[i] != 0)
return ((Uint32)NULL);
return (Uint32)NULL;
SclColRamAlloc2048[0] = Surface;
SCL_SetColRamOffset(Surface, 0, transparent);
return (SCL_COLRAM_ADDR);
return SCL_COLRAM_ADDR;
}
}
@ -1829,7 +1829,7 @@ static Fixed32 Fsin(Fixed32 a) {
if (sign)
val = -val;
return (val);
return val;
}
// func_0602AA84
@ -1845,7 +1845,7 @@ static Fixed32 Fcos(Fixed32 a) {
a = a % FIXED(360);
if (a == 0)
return (FIXED(1));
return FIXED(1);
if (FIXED(270) <= a) {
val = fcos(FIXED(360) - a);
@ -1858,7 +1858,7 @@ static Fixed32 Fcos(Fixed32 a) {
} else {
val = fcos(a);
}
return (val);
return val;
}
extern Fixed32 currentMatrix[2][9];
@ -1990,7 +1990,7 @@ void SCL_SetColRam(Uint32 Object, Uint32 Index, Uint32 num, void* Color) {
if (SCL_GetColRamMode() == 2) {
color32 = (Uint32*)Color;
ram32 = (Uint32*)((Uint32)SCL_COLRAM_ADDR +
((SCL_GetColRamOffset(Object) * 0x400))) +
(SCL_GetColRamOffset(Object) * 0x400)) +
Index;
if (num == 1) {
@ -2001,7 +2001,7 @@ void SCL_SetColRam(Uint32 Object, Uint32 Index, Uint32 num, void* Color) {
} else {
color16 = (Uint16*)Color;
ram16 = (Uint16*)((Uint32)SCL_COLRAM_ADDR +
((SCL_GetColRamOffset(Object) * 0x200))) +
(SCL_GetColRamOffset(Object) * 0x200)) +
Index;
if (num == 1) {
@ -2069,27 +2069,27 @@ extern Uint32 SclLineColRamOffset;
Uint32 SCL_GetColRamOffset(Uint32 Object) {
switch (Object) {
case SCL_SPR:
return (SCL_GET_SPCAOS());
return SCL_GET_SPCAOS();
break;
case SCL_NBG0:
case SCL_RBG1:
return (SCL_GET_N0CAOS());
return SCL_GET_N0CAOS();
break;
case SCL_NBG1:
case SCL_EXBG:
return (SCL_GET_N1CAOS());
return SCL_GET_N1CAOS();
break;
case SCL_NBG2:
return (SCL_GET_N2CAOS());
return SCL_GET_N2CAOS();
break;
case SCL_NBG3:
return (SCL_GET_N3CAOS());
return SCL_GET_N3CAOS();
break;
case SCL_RBG0:
return (SCL_GET_R0CAOS());
return SCL_GET_R0CAOS();
break;
case SCL_LNCL:
return (SclLineColRamOffset);
return SclLineColRamOffset;
break;
default:
break;

View File

@ -311,7 +311,7 @@ typedef struct SclSblSgl {
#define SCL_W0 0
#define SCL_W1 1
#define FIXED(x) ((Fixed32)((x)*65536.0))
#define FIXED(x) ((Fixed32)((x) * 65536.0))
#define MUL_FIXED(a, b) MTH_Mul(a, b)
#define DIV_FIXED(a, b) MTH_Div(a, b)

View File

@ -203,7 +203,7 @@ void func_80194B7C(s32 arg0, s16 arg1) {
g_CurrentEntity->velocityY = func_80194B34((arg0 - 0x40) & 0xFF, arg1);
}
u8 func_80194BE8(s16 x, s16 y) { return ((ratan2(y, x) >> 4) + 0x40); }
u8 func_80194BE8(s16 x, s16 y) { return (ratan2(y, x) >> 4) + 0x40; }
u8 func_80194C20(Entity* arg0, Entity* arg1) {
u16 x;

View File

@ -212,7 +212,7 @@ void func_8019ACC0(s32 arg0, s16 arg1) {
g_CurrentEntity->velocityY = func_8019AC78(arg0 - 0x40, arg1);
}
u8 func_8019AD2C(s16 x, s16 y) { return ((ratan2(y, x) >> 4) + 0x40); }
u8 func_8019AD2C(s16 x, s16 y) { return (ratan2(y, x) >> 4) + 0x40; }
u8 func_8019AD64(ObjInit2* arg0, ObjInit2* arg1) {
u16 x, y;

View File

@ -773,7 +773,7 @@ void func_801928A8(s32 arg0, s16 arg1) {
g_CurrentEntity->velocityY = func_80192860(arg0 - 0x40, arg1);
}
u8 func_80192914(s16 x, s16 y) { return ((ratan2(y, x) >> 4) + 0x40); }
u8 func_80192914(s16 x, s16 y) { return (ratan2(y, x) >> 4) + 0x40; }
u8 func_8019294C(Entity* a, Entity* b) {
s32 diffX = (u16)b->posX.i.hi - (u16)a->posX.i.hi;

View File

@ -204,7 +204,7 @@ void func_801C557C(s32 arg0, s16 arg1) {
}
u8 func_801C55E8(s16 arg0, s16 arg1) {
return ((ratan2(arg1, arg0) >> 4) + 0x40);
return (ratan2(arg1, arg0) >> 4) + 0x40;
}
u8 func_801C5620(Entity* arg0, Entity* arg1) {

View File

@ -204,7 +204,7 @@ void func_801BCDEC(s32 arg0, s16 arg1) {
g_CurrentEntity->velocityY = func_801BCDA4(arg0 - 0x40, arg1);
}
u8 func_801BCE58(s16 x, s16 y) { return ((ratan2(y, x) >> 4) + 0x40); }
u8 func_801BCE58(s16 x, s16 y) { return (ratan2(y, x) >> 4) + 0x40; }
u8 func_801BCE90(Entity* a, Entity* b) {
s32 diffX = (u16)b->posX.i.hi - (u16)a->posX.i.hi;

View File

@ -31,7 +31,7 @@ bool func_801B0A20(Entity* self) {
if (self->hitboxWidth >= diffX) {
diffX = PLAYER.posY.i.hi - self->posY.i.hi;
diffX = abs(diffX);
return (self->hitboxHeight >= diffX);
return self->hitboxHeight >= diffX;
} else {
return false;
}

View File

@ -203,7 +203,7 @@ void func_801BD204(s32 arg0, s16 arg1) {
g_CurrentEntity->velocityY = func_801BD1BC(arg0 - 0x40, arg1);
}
u8 func_801BD270(s16 x, s16 y) { return ((ratan2(y, x) >> 4) + 0x40); }
u8 func_801BD270(s16 x, s16 y) { return (ratan2(y, x) >> 4) + 0x40; }
u8 func_8019AD64(ObjInit2* arg0, ObjInit2* arg1) {
u16 x, y;

View File

@ -2426,7 +2426,7 @@ void func_801B2108(const char* str, s32 arg1) {
}
}
for (i = 0; i < FontHeight; i++) {
if ((var_a2[i * FontStride + var_a3] & 0xF0)) {
if (var_a2[i * FontStride + var_a3] & 0xF0) {
break;
}
}

View File

@ -26,7 +26,7 @@ bool func_801A7E2C(Entity* self) {
if (self->hitboxWidth >= diffX) {
diffX = PLAYER.posY.i.hi - self->posY.i.hi;
diffX = abs(diffX);
return (self->hitboxHeight >= diffX);
return self->hitboxHeight >= diffX;
} else {
return false;
}

View File

@ -590,7 +590,7 @@ void func_801B5474(s32 arg0, s16 arg1) {
}
u8 func_801B54E0(s16 arg0, s16 arg1) {
return ((ratan2(arg1, arg0) >> 4) + 0x40);
return (ratan2(arg1, arg0) >> 4) + 0x40;
}
u8 func_801B5518(Entity* arg0, Entity* arg1) {

View File

@ -217,7 +217,7 @@ void func_8018BF18(s32 arg0, s16 arg1) {
g_CurrentEntity->velocityY = func_8018BED0(arg0 - 0x40, arg1);
}
u8 func_8018BF84(s16 x, s16 y) { return ((ratan2(y, x) >> 4) + 0x40); }
u8 func_8018BF84(s16 x, s16 y) { return (ratan2(y, x) >> 4) + 0x40; }
u8 func_8018BFBC(Entity* a, Entity* b) {
s32 diffX = (u16)b->posX.i.hi - (u16)a->posX.i.hi;

View File

@ -8,7 +8,7 @@ u8 func_psp_0923C2F8(u8 arg0) {
if (arg0 & 0x80) {
return func_psp_0923C2F8((arg0 & 0x7F) + 3);
}
return (arg0 * 0x10);
return arg0 * 0x10;
}
extern s32 D_91ED5F8;

View File

@ -400,7 +400,7 @@ void EntityWeaponAttack(Entity* self) {
// Blueprint 56 is child offset 1, so this runs func_ptr_80170004 for
// food.
factory_arg1 =
56 + ((g_HandId + 1) << 0xE) + ((self->ext.food.foodId << 0x10));
56 + ((g_HandId + 1) << 0xE) + (self->ext.food.foodId << 0x10);
if (g_api.CreateEntFactoryFromEntity(self, factory_arg1, 0) != NULL) {
self->ext.food.timer = 4;
self->step++;

View File

@ -73,7 +73,7 @@ Entity* func_123000_8017A994(Entity* self, s16 angleTarget, s16 tolerance) {
continue;
}
}
if ((other->flags & FLAG_UNK_80000)) {
if (other->flags & FLAG_UNK_80000) {
entCount++;
sp10[i] = 1;
continue;

View File

@ -173,8 +173,8 @@ void func_ptr_80170004(Entity* self) {
break;
case 2:
if (self->animFrameDuration == 1) {
if ((self->animFrameIdx == 6 || self->animFrameIdx == 0xC ||
self->animFrameIdx == 0x12)) {
if (self->animFrameIdx == 6 || self->animFrameIdx == 0xC ||
self->animFrameIdx == 0x12) {
unk = 0x3E;
// TODO: FACTORY()
if (g_api.CreateEntFactoryFromEntity(

View File

@ -132,7 +132,7 @@ def re_ident(name):
# regex helper to match assembly registers
def re_reg(name):
return f"(?P<{name}>\$[0-9a-z]+)"
return rf"(?P<{name}>\$[0-9a-z]+)"
# regex helper to match the two %lo and %hi functions
@ -142,39 +142,39 @@ re_func = r"(?P<FUNC>\%(hi|lo))"
# all the regex patterns supported by the MIPS assembly parser
patterns = [
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_func}\({re_ident('SYM')}\)\({re_reg('IMM')}\)",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_func}\({re_ident('SYM')}\)\({re_reg('IMM')}\)",
["LOC", "VRAM", "VAL", "OP", "DST", "FUNC", "SYM", "IMM"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_func}\({re_ident('SYM')}\)",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_func}\({re_ident('SYM')}\)",
["LOC", "VRAM", "VAL", "OP", "DST", "FUNC", "SYM"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')},\\s+{re_reg('RIGHT')}",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')},\\s+{re_reg('RIGHT')}",
["LOC", "VRAM", "VAL", "OP", "DST", "LEFT", "RIGHT"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')},\\s+{re_func}\({re_ident('SYM')}\)\({re_reg('IMM')}\)",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')},\\s+{re_func}\({re_ident('SYM')}\)\({re_reg('IMM')}\)",
["LOC", "VRAM", "VAL", "OP", "DST", "LEFT", "FUNC", "SYM", "IMM"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')},\\s+{re_func}\({re_ident('SYM')}\)",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')},\\s+{re_func}\({re_ident('SYM')}\)",
["LOC", "VRAM", "VAL", "OP", "DST", "LEFT", "FUNC", "SYM"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')}",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+{re_reg('LEFT')}",
["LOC", "VRAM", "VAL", "OP", "DST", "LEFT"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+\.{re_ident('LABEL')}",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+\.{re_ident('LABEL')}",
["LOC", "VRAM", "VAL", "OP", "LABEL"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+\.{re_ident('LABEL')}",
rf"{re_splat_line()}\\s+{re_ident('OP')}\\s+{re_reg('DST')},\\s+\.{re_ident('LABEL')}",
["LOC", "VRAM", "VAL", "OP", "DST", "LABEL"],
),
(
f"{re_splat_line()}\\s+{re_ident('OP')}$",
rf"{re_splat_line()}\\s+{re_ident('OP')}$",
["LOC", "VRAM", "VAL", "OP"],
),
(r"glabel (?P<FUNC_NAME>\w+)", ["FUNC_NAME"]),