mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user