- macro cleanup

This commit is contained in:
Christoph Oelckers 2020-09-04 21:17:24 +02:00
parent fd2ce0321e
commit 5bc80d2468
4 changed files with 10 additions and 73 deletions

View File

@ -73,7 +73,11 @@ int DImageScreen::Frame(uint64_t clock, bool skiprequest)
{
tex = tileGetTexture(tilenum, true);
}
if (!tex) return 0;
if (!tex)
{
twod->ClearScreen();
return 0;
}
int span = int(clock / 1'000'000);
twod->ClearScreen();
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);

View File

@ -97,6 +97,7 @@ bool RestartCheat(cheatseq_t* c)
{
if (!checkCheat(c)) return false;
DeferedStartGame(currentLevel, -1);
return true;
}
bool RoomCheat(cheatseq_t* c)

View File

@ -51,31 +51,12 @@ typedef unsigned char SWBOOL;
#define DIV8(x) ((x) >> 3)
#define DIV16(x) ((x) >> 4)
#define DIV32(x) ((x) >> 5)
#define DIV64(x) ((x) >> 6)
#define DIV128(x) ((x) >> 7)
#define DIV256(x) ((x) >> 8)
// Constants used in fast mods
#define C_MOD2 1
#define C_MOD4 3
#define C_MOD8 7
#define C_MOD16 15
#define C_MOD32 31
#define C_MOD64 63
#define C_MOD128 127
#define C_MOD256 255
// Fast mods of select 2 power numbers
#define MOD2(x) ((x) & C_MOD2)
#define MOD4(x) ((x) & C_MOD4)
#define MOD8(x) ((x) & C_MOD8)
#define MOD16(x) ((x) & C_MOD16)
#define MOD32(x) ((x) & C_MOD32)
#define MOD64(x) ((x) & C_MOD64)
#define MOD128(x) ((x) & C_MOD128)
#define MOD256(x) ((x) & C_MOD256)
#define MOD2(x) ((x) & 1)
#define MOD4(x) ((x) & 3)
// Fast mods of any power of 2
@ -83,47 +64,11 @@ typedef unsigned char SWBOOL;
// Truncates to select 2 power numbers
#define TRUNC2(x) ((x) & ~C_MOD2)
#define TRUNC4(x) ((x) & ~C_MOD4)
#define TRUNC8(x) ((x) & ~C_MOD8)
#define TRUNC16(x) ((x) & ~C_MOD16)
#define TRUNC32(x) ((x) & ~C_MOD32)
#define TRUNC64(x) ((x) & ~C_MOD64)
#define TRUNC128(x) ((x) & ~C_MOD128)
#define TRUNC256(x) ((x) & ~C_MOD256)
#define POWER2_TRUNC(number,truncby) ((number) & ~((truncby)-1))
#define TRUNC4(x) ((x) & ~3)
// moves value to closest power of 2 pixel boundry
#define BOUND_2PIX(x) ( TRUNC2((x) + MOD2(x)) )
#define BOUND_4PIX(x) ( TRUNC4((x) + MOD4(x)) )
#define BOUND_8PIX(x) ( TRUNC8((x) + MOD8(x)) )
#define BOUND_16PIX(x) ( TRUNC16((x) + MOD16(x)) )
#define BOUND_32PIX(x) ( TRUNC32((x) + MOD32(x)) )
#define BOUND_64PIX(x) ( TRUNC64((x) + MOD64(x)) )
#define BOUND_128PIX(x) ( TRUNC128((x) + MOD128(x)) )
#define BOUND_256PIX(x) ( TRUNC256((x) + MOD256(x)) )
#define BOUND_POWER2_PIX(x,bound) ( POWER2_TRUNC((x,bound) + POWER2_MOD(x,bound)) )
// A few muls with shifts and adds
// probably not needed with good compiler
#define MUL2(x) ((x)*2)
#define MUL3(x) (((x)<<1) + (x))
#define MUL5(x) (((x)<<2) + (x))
#define MUL6(x) (((x)<<2) + (x) + (x))
#define MUL7(x) (((x)<<2) + (x) + (x) + (x))
#define MUL8(x) ((x)*8)
#define MUL9(x) (((x)<<3) + (x))
#define MUL10(x) (((x)<<3) + (x) + (x))
#define MUL11(x) (((x)<<3) + (x) + (x) + (x))
#define MUL12(x) (((x)<<3) + ((x)<<2))
#define MUL13(x) (((x)<<3) + ((x)<<2) + (x))
#define MUL14(x) (((x)<<3) + ((x)<<2) + (x) + (x))
#define MUL15(x) (((x)<<3) + ((x)<<2) + (x) + (x) + (x))
#define MUL16(x) ((x)*16)
/*
===========================
@ -142,18 +87,5 @@ typedef unsigned char SWBOOL;
#define BIT(shift) (1<<(shift))
/*
===========================
=
= Miscellaneous
=
===========================
*/
//#define ABS(num) ((num) < 0 ? -(num) : (num))
#define BETWEEN(x,low,high) (((x) >= (low)) && ((x) <= (high)))
#endif

View File

@ -1564,7 +1564,7 @@ PlaceActorsOnTracks(void)
u->track = tag - TAG_ACTOR_TRACK_BEGIN;
// if facing left go backward
if (BETWEEN(sp->ang, 513, 1535))
if (sp->ang >= 513 && sp->ang <= 1535)
{
u->track_dir = -1;
}