From: John Tsiombikas Date: Mon, 16 May 2022 04:29:14 +0000 (+0300) Subject: UNIX line endings on 2 files X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=223ecd536161ba06dd1d0f39ccf911b082742b92 UNIX line endings on 2 files --- diff --git a/.clang-format b/.clang-format index b54f2e9..5788564 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,33 @@ +UseCRLF: false UseTab: Always +TabWidth: 4 IndentWidth: 4 -ColumnLimit: 90 +ColumnLimit: 95 +SortIncludes: Never +SpaceBeforeParens: Never +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: None +AlignConsecutiveMacros: AcrossEmptyLines +AlignEscapedNewlines: DontAlign +AlignOperands: DontAlign +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortEnumsOnASingleLine: true +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: NonAssignment +BreakStringLiterals: true +SpaceInEmptyParentheses: false +IndentCaseLabels: false +ReflowComments: true +PointerAlignment: Right +SpacesInCStyleCastParentheses: false +SpaceAfterCStyleCast: false +PenaltyBreakAssignment: 1000 +SpaceBeforeParens: Never +SpaceAfterLogicalNot: false diff --git a/src/sball.h b/src/sball.h index e12b12c..e26d336 100644 --- a/src/sball.h +++ b/src/sball.h @@ -1,36 +1,36 @@ -#ifndef SBALL_H_ -#define SBALL_H_ - -enum { - SBALL_EV_NONE, - SBALL_EV_MOTION, - SBALL_EV_BUTTON -}; - -struct sball_event_motion { - int type; - int motion[6]; -}; - -struct sball_event_button { - int type; - int id; - int pressed; - unsigned int state; -}; - -typedef union sball_event { - int type; - struct sball_event_motion motion; - struct sball_event_button button; -} sball_event; - -int sball_init(void); -void sball_shutdown(void); - -int sball_getdev(void); - -int sball_pending(void); -int sball_getevent(sball_event *ev); - -#endif /* SBALL_H_ */ +#ifndef SBALL_H_ +#define SBALL_H_ + +enum { + SBALL_EV_NONE, + SBALL_EV_MOTION, + SBALL_EV_BUTTON +}; + +struct sball_event_motion { + int type; + int motion[6]; +}; + +struct sball_event_button { + int type; + int id; + int pressed; + unsigned int state; +}; + +typedef union sball_event { + int type; + struct sball_event_motion motion; + struct sball_event_button button; +} sball_event; + +int sball_init(void); +void sball_shutdown(void); + +int sball_getdev(void); + +int sball_pending(void); +int sball_getevent(sball_event *ev); + +#endif /* SBALL_H_ */ diff --git a/src/scr/thunder.c b/src/scr/thunder.c index 062eb57..3aa3b7e 100644 --- a/src/scr/thunder.c +++ b/src/scr/thunder.c @@ -377,62 +377,62 @@ unsigned char fog(float z) { return (unsigned char)ret; } -void sort(PointSprite *begin, PointSprite *end) { - PointSprite pivotValue; - size_t sz; - PointSprite *left, *right; - int leftCond, rightCond; - PointSprite tmp; - - sz = end - begin; - - if (sz < 2) return; /* already sorted */ - if (sz == 2) { - /* trivial case */ - if (begin[1] < begin[0]) { - tmp = begin[0]; - begin[0] = begin[1]; - begin[1] = tmp; - return; - } - } - - /* minimum 3 elements from now on */ - - /* choose a pivot near the middle, since we frequently sort already sorted arrays */ - pivotValue = begin[sz / 2]; - - left = begin; - right = end - 1; - - while (right > left) { - /* check if left and right elements meet the conditions */ - leftCond = pivotValue >= *left; - rightCond = pivotValue < *right; - - if (!leftCond && !rightCond) { - tmp = *left; - *left = *right; - *right = tmp; - left++; - right--; - } - else if (leftCond && rightCond) { - left++; - right--; - } - else if (leftCond) { - left++; - } - else { - right--; - } - } - - /* recursion */ - sort(begin, left); - sort(left, end); -} +void sort(PointSprite *begin, PointSprite *end) { + PointSprite pivotValue; + size_t sz; + PointSprite *left, *right; + int leftCond, rightCond; + PointSprite tmp; + + sz = end - begin; + + if (sz < 2) return; /* already sorted */ + if (sz == 2) { + /* trivial case */ + if (begin[1] < begin[0]) { + tmp = begin[0]; + begin[0] = begin[1]; + begin[1] = tmp; + return; + } + } + + /* minimum 3 elements from now on */ + + /* choose a pivot near the middle, since we frequently sort already sorted arrays */ + pivotValue = begin[sz / 2]; + + left = begin; + right = end - 1; + + while (right > left) { + /* check if left and right elements meet the conditions */ + leftCond = pivotValue >= *left; + rightCond = pivotValue < *right; + + if (!leftCond && !rightCond) { + tmp = *left; + *left = *right; + *right = tmp; + left++; + right--; + } + else if (leftCond && rightCond) { + left++; + right--; + } + else if (leftCond) { + left++; + } + else { + right--; + } + } + + /* recursion */ + sort(begin, left); + sort(left, end); +} void sortPointSprites() { sort(pointSprites, pointSprites + pointSpriteCount);