mirror of https://gitlab.com/drummyfish/anarch.git
Fix visibility
This commit is contained in:
parent
8ed09615c7
commit
a634519a16
15
game.h
15
game.h
|
@ -353,7 +353,8 @@ struct
|
||||||
uint8_t soundsPlayedThisFrame; /**< Each bit says whether given sound was
|
uint8_t soundsPlayedThisFrame; /**< Each bit says whether given sound was
|
||||||
played this frame, prevents playing too many
|
played this frame, prevents playing too many
|
||||||
sounds at once. */
|
sounds at once. */
|
||||||
RCL_RayConstraints rayConstraints;
|
RCL_RayConstraints rayConstraints; ///< Ray constraints for rendering.
|
||||||
|
RCL_RayConstraints visibilityRayConstraints; ///< Constraints for visibility.
|
||||||
uint8_t keyStates[SFG_KEY_COUNT]; /**< Pressed states of keys, each value
|
uint8_t keyStates[SFG_KEY_COUNT]; /**< Pressed states of keys, each value
|
||||||
stores the number of frames for which the
|
stores the number of frames for which the
|
||||||
key has been held. */
|
key has been held. */
|
||||||
|
@ -1662,6 +1663,12 @@ void SFG_init()
|
||||||
SFG_game.rayConstraints.maxHits = SFG_RAYCASTING_MAX_HITS;
|
SFG_game.rayConstraints.maxHits = SFG_RAYCASTING_MAX_HITS;
|
||||||
SFG_game.rayConstraints.maxSteps = SFG_RAYCASTING_MAX_STEPS;
|
SFG_game.rayConstraints.maxSteps = SFG_RAYCASTING_MAX_STEPS;
|
||||||
|
|
||||||
|
RCL_initRayConstraints(&SFG_game.visibilityRayConstraints);
|
||||||
|
SFG_game.visibilityRayConstraints.maxHits =
|
||||||
|
SFG_RAYCASTING_VISIBILITY_MAX_HITS;
|
||||||
|
SFG_game.visibilityRayConstraints.maxSteps =
|
||||||
|
SFG_RAYCASTING_VISIBILITY_MAX_STEPS;
|
||||||
|
|
||||||
SFG_game.antiSpam = 0;
|
SFG_game.antiSpam = 0;
|
||||||
|
|
||||||
SFG_LOG("computing average texture colors")
|
SFG_LOG("computing average texture colors")
|
||||||
|
@ -1734,6 +1741,10 @@ void SFG_init()
|
||||||
SFG_game.save[0] = SFG_NUMBER_OF_LEVELS - 1; // revealed all levels
|
SFG_game.save[0] = SFG_NUMBER_OF_LEVELS - 1; // revealed all levels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SFG_ALL_LEVELS
|
||||||
|
SFG_game.save[0] = SFG_NUMBER_OF_LEVELS - 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
SFG_setMusic((SFG_game.settings & 0x02) ?
|
SFG_setMusic((SFG_game.settings & 0x02) ?
|
||||||
SFG_MUSIC_TURN_ON : SFG_MUSIC_TURN_OFF);
|
SFG_MUSIC_TURN_ON : SFG_MUSIC_TURN_OFF);
|
||||||
|
|
||||||
|
@ -2868,7 +2879,7 @@ static inline uint8_t SFG_spriteIsVisible(RCL_Vector2D pos, RCL_Unit height,
|
||||||
height,
|
height,
|
||||||
SFG_floorHeightAt,
|
SFG_floorHeightAt,
|
||||||
SFG_ceilingHeightAt,
|
SFG_ceilingHeightAt,
|
||||||
SFG_game.rayConstraints
|
SFG_game.visibilityRayConstraints
|
||||||
) == RCL_UNITS_PER_SQUARE;
|
) == RCL_UNITS_PER_SQUARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,12 +257,13 @@
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="">GNU/Linux SDL</a></li>
|
<li><a href="">GNU/Linux SDL</a></li>
|
||||||
|
<li><a href="">GNU/Linux SDL LQ</a></li>
|
||||||
<li><a href="">GNU/Linux CSFML</a></li>
|
<li><a href="">GNU/Linux CSFML</a></li>
|
||||||
<li><a href="">play in browser</a></li>
|
<li><a href="">play in browser</a></li>
|
||||||
<li><a href="">Pokitto</a></li>
|
<li><a href="">Pokitto</a></li>
|
||||||
<li><a href="">GB Meta</a></li>
|
<li><a href="">GB Meta</a></li>
|
||||||
<li><a href="">M$ Win$hit XP SDL</a></li>
|
<li><a href="">M$ Win$hit XP SDL</a></li>
|
||||||
<li><a href="">source code</a></li>
|
<li><a href="https://gitlab.com/drummyfish/anarch/-/archive/master/anarch-master.zip">source code</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Explore</h2>
|
<h2>Explore</h2>
|
||||||
|
|
|
@ -26,11 +26,13 @@
|
||||||
|
|
||||||
// #define SFG_START_LEVEL 1
|
// #define SFG_START_LEVEL 1
|
||||||
#define SFG_IMMORTAL 1
|
#define SFG_IMMORTAL 1
|
||||||
#define SFG_UNLOCK_DOOR 1
|
#define SFG_ALL_LEVELS 1
|
||||||
|
// #define SFG_UNLOCK_DOOR 1
|
||||||
// #define SFG_REVEAL_MAP 1
|
// #define SFG_REVEAL_MAP 1
|
||||||
// #define SFG_INFINITE_AMMO 1
|
// #define SFG_INFINITE_AMMO 1
|
||||||
// #define SFG_TIME_MULTIPLIER 512
|
// #define SFG_TIME_MULTIPLIER 512
|
||||||
// #define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);
|
// #define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);
|
||||||
|
#define GAME_LQ
|
||||||
|
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
#ifndef GAME_LQ
|
#ifndef GAME_LQ
|
||||||
|
@ -53,6 +55,8 @@
|
||||||
#define SFG_DIMINISH_SPRITES 0
|
#define SFG_DIMINISH_SPRITES 0
|
||||||
#define SFG_DITHERED_SHADOW 0
|
#define SFG_DITHERED_SHADOW 0
|
||||||
#define SFG_BACKGROUND_BLUR 0
|
#define SFG_BACKGROUND_BLUR 0
|
||||||
|
#define SFG_RAYCASTING_MAX_STEPS 20
|
||||||
|
#define SFG_RAYCASTING_MAX_HITS 8
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// emscripten
|
// emscripten
|
||||||
|
@ -63,6 +67,8 @@
|
||||||
#define SFG_RESOLUTION_SCALEDOWN 2
|
#define SFG_RESOLUTION_SCALEDOWN 2
|
||||||
#define SFG_DITHERED_SHADOW 1
|
#define SFG_DITHERED_SHADOW 1
|
||||||
#define SFG_BACKGROUND_BLUR 0
|
#define SFG_BACKGROUND_BLUR 0
|
||||||
|
#define SFG_RAYCASTING_MAX_STEPS 20
|
||||||
|
#define SFG_RAYCASTING_MAX_HITS 8
|
||||||
|
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
34
settings.h
34
settings.h
|
@ -164,6 +164,30 @@
|
||||||
#define SFG_RAYCASTING_MAX_HITS 10
|
#define SFG_RAYCASTING_MAX_HITS 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
Same as SFG_RAYCASTING_MAX_STEPS but for visibility rays that are used to
|
||||||
|
check whether sprites are visible etc.
|
||||||
|
*/
|
||||||
|
#ifndef SFG_RAYCASTING_VISIBILITY_MAX_STEPS
|
||||||
|
#if SFG_RAYCASTING_MAX_STEPS < 15
|
||||||
|
#define SFG_RAYCASTING_VISIBILITY_MAX_STEPS 15
|
||||||
|
#else
|
||||||
|
#define SFG_RAYCASTING_VISIBILITY_MAX_STEPS SFG_RAYCASTING_MAX_STEPS
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
Same as SFG_RAYCASTING_MAX_HITS but for visibility rays that are used to check
|
||||||
|
whether sprites are visible etc.
|
||||||
|
*/
|
||||||
|
#ifndef SFG_RAYCASTING_VISIBILITY_MAX_HITS
|
||||||
|
#if SFG_RAYCASTING_MAX_HITS < 6
|
||||||
|
#define SFG_RAYCASTING_VISIBILITY_MAX_HITS 6
|
||||||
|
#else
|
||||||
|
#define SFG_RAYCASTING_VISIBILITY_MAX_HITS SFG_RAYCASTING_MAX_HITS
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
How many times rendering should be subsampled horizontally. Bigger number
|
How many times rendering should be subsampled horizontally. Bigger number
|
||||||
can significantly improve performance (by casting fewer rays), but can look
|
can significantly improve performance (by casting fewer rays), but can look
|
||||||
|
@ -396,7 +420,8 @@
|
||||||
look weirdly scaled, so this option can be used to fix that.
|
look weirdly scaled, so this option can be used to fix that.
|
||||||
*/
|
*/
|
||||||
#ifndef SFG_SPRITE_MAX_SIZE
|
#ifndef SFG_SPRITE_MAX_SIZE
|
||||||
#define SFG_SPRITE_MAX_SIZE SFG_SCREEN_RESOLUTION_Y
|
#define SFG_SPRITE_MAX_SIZE \
|
||||||
|
(SFG_SCREEN_RESOLUTION_Y / SFG_RESOLUTION_SCALEDOWN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -422,6 +447,13 @@
|
||||||
#define SFG_IMMORTAL 0
|
#define SFG_IMMORTAL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reveals all levels to be played.
|
||||||
|
*/
|
||||||
|
#ifndef SFG_ALL_LEVELS
|
||||||
|
#define SFG_ALL_LEVELS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Turn on for previes mode for map editing (flying, noclip, fast movement etc.).
|
Turn on for previes mode for map editing (flying, noclip, fast movement etc.).
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue