mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-20 18:37:48 -04:00
add DivRoundClosest function, formatting (#1786)
This commit is contained in:
parent
80740b0b1f
commit
c447781a13
@ -73,15 +73,16 @@ typedef byte lighttable_t;
|
||||
|
||||
#define arrlen(array) (sizeof(array) / sizeof(*array))
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
#ifndef BETWEEN
|
||||
#define BETWEEN(l,u,x) ((l)>(x)?(l):(x)>(u)?(u):(x))
|
||||
#endif
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define BETWEEN(l, u, x) ((l) > (x) ? (l) : (x) > (u) ? (u) : (x))
|
||||
|
||||
inline static int DivRoundClosest(const int n, const int d)
|
||||
{
|
||||
return ((n < 0) == (d < 0)) ? ((n + d / 2) / d) : ((n - d / 2) / d);
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
|
@ -696,13 +696,13 @@ void F_BunnyScroll (void)
|
||||
|
||||
scrolled = 320 - (finalecount-230)/2;
|
||||
|
||||
int p1offset = (video.unscaledw - SHORT(p1->width) + 1) / 2;
|
||||
int p1offset = DivRoundClosest(video.unscaledw - SHORT(p1->width), 2);
|
||||
if (SHORT(p1->width) == 320)
|
||||
{
|
||||
p1offset += (SHORT(p2->width) - 320) / 2;
|
||||
}
|
||||
|
||||
int p2offset = (video.unscaledw - SHORT(p2->width) + 1) / 2;
|
||||
int p2offset = DivRoundClosest(video.unscaledw - SHORT(p2->width), 2);
|
||||
|
||||
if (scrolled <= 0)
|
||||
{
|
||||
|
@ -519,7 +519,7 @@ void V_DrawPatchTRTR(int x, int y, patch_t *patch, byte *outr1, byte *outr2)
|
||||
|
||||
void V_DrawPatchFullScreen(patch_t *patch)
|
||||
{
|
||||
const int x = (video.unscaledw - SHORT(patch->width)) / 2;
|
||||
const int x = DivRoundClosest(video.unscaledw - SHORT(patch->width), 2);
|
||||
|
||||
patch->leftoffset = 0;
|
||||
patch->topoffset = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user