Flashlight changes (#81)

* Flashlight changes:
- Fixed the lighted area being way too large in the diagonal directions.
- Added a minimum range to simulate a flashlight user not illuminating its feet.
- Added angle based calculations instead of the hardcoded one.

* Flashlight changes, MR feedback.
This commit is contained in:
CptMoore
2023-01-18 20:52:12 +02:00
committed by GitHub
parent d6896c9234
commit 624c0f3bc4
4 changed files with 182 additions and 72 deletions
+14
View File
@@ -91,6 +91,11 @@ UINT8 gOneCCDirection[ NUM_WORLD_DIRECTIONS ] =
WEST
};
UINT8 DirectionIfTurnedClockwise(UINT8 facing, UINT8 times)
{
return (facing + times) % NUM_WORLD_DIRECTIONS;
}
// DIRECTION FACING DIRECTION WE WANT TO GOTO
UINT8 gPurpendicularDirection[ NUM_WORLD_DIRECTIONS ][ NUM_WORLD_DIRECTIONS ] =
{
@@ -912,6 +917,15 @@ INT16 sDeltaScreenX, sDeltaScreenY;
}
INT16 DirectionToVectorX[NUM_WORLD_DIRECTIONS] = {0, 1, 1, 1, 0, -1, -1, -1};
INT16 DirectionToVectorY[NUM_WORLD_DIRECTIONS] = {-1, -1, 0, 1, 1, 1, 0, -1};
void ConvertDirectionToVectorInXY( UINT8 ubDirection, INT16* sXDir, INT16* sYDir )
{
Assert(ubDirection >= 0 && ubDirection < NUM_WORLD_DIRECTIONS);
*sXDir = DirectionToVectorX[ubDirection];
*sYDir = DirectionToVectorY[ubDirection];
}
void ConvertGridNoToXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
{
*sYPos = sGridNo / WORLD_COLS;