mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2025-02-17 07:30:13 -05:00
Add bob shear
This commit is contained in:
parent
a19b9fd07b
commit
1bef03bf72
18
game.h
18
game.h
@ -4301,7 +4301,7 @@ void SFG_drawMenu()
|
|||||||
if (item == SFG_MENU_ITEM_NONE)
|
if (item == SFG_MENU_ITEM_NONE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
# if SFG_GAME_RESOLUTION_Y < 70
|
#if SFG_GAME_RESOLUTION_Y < 70
|
||||||
// with low resolution only display the selected item
|
// with low resolution only display the selected item
|
||||||
|
|
||||||
if (i != SFG_game.selectedMenuItem)
|
if (i != SFG_game.selectedMenuItem)
|
||||||
@ -4504,12 +4504,21 @@ void SFG_draw()
|
|||||||
#if SFG_HEADBOB_ENABLED
|
#if SFG_HEADBOB_ENABLED
|
||||||
RCL_Unit headBobOffset = 0;
|
RCL_Unit headBobOffset = 0;
|
||||||
|
|
||||||
|
#if SFG_HEADBOB_SHEAR != 0
|
||||||
|
int16_t headBobShearOffset;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SFG_game.state != SFG_GAME_STATE_LOSE)
|
if (SFG_game.state != SFG_GAME_STATE_LOSE)
|
||||||
{
|
{
|
||||||
RCL_Unit bobSin = RCL_sin(SFG_player.headBobFrame);
|
RCL_Unit bobSin = RCL_sin(SFG_player.headBobFrame);
|
||||||
|
|
||||||
headBobOffset = (bobSin * SFG_HEADBOB_OFFSET) / RCL_UNITS_PER_SQUARE;
|
headBobOffset = (bobSin * SFG_HEADBOB_OFFSET) / RCL_UNITS_PER_SQUARE;
|
||||||
|
|
||||||
|
#if SFG_HEADBOB_SHEAR != 0
|
||||||
|
headBobShearOffset = (bobSin * SFG_HEADBOB_SHEAR) / RCL_UNITS_PER_SQUARE;
|
||||||
|
SFG_player.camera.shear += headBobShearOffset;
|
||||||
|
#endif
|
||||||
|
|
||||||
weaponBobOffset =
|
weaponBobOffset =
|
||||||
(bobSin * SFG_WEAPONBOB_OFFSET_PIXELS) / (RCL_UNITS_PER_SQUARE) +
|
(bobSin * SFG_WEAPONBOB_OFFSET_PIXELS) / (RCL_UNITS_PER_SQUARE) +
|
||||||
SFG_WEAPONBOB_OFFSET_PIXELS;
|
SFG_WEAPONBOB_OFFSET_PIXELS;
|
||||||
@ -4527,7 +4536,7 @@ void SFG_draw()
|
|||||||
// add head bob just for the rendering (we'll will substract it back later)
|
// add head bob just for the rendering (we'll will substract it back later)
|
||||||
|
|
||||||
SFG_player.camera.height += headBobOffset;
|
SFG_player.camera.height += headBobOffset;
|
||||||
#endif
|
#endif // headbob enabled?
|
||||||
|
|
||||||
RCL_renderComplex(
|
RCL_renderComplex(
|
||||||
SFG_player.camera,
|
SFG_player.camera,
|
||||||
@ -4673,8 +4682,13 @@ void SFG_draw()
|
|||||||
#if SFG_HEADBOB_ENABLED
|
#if SFG_HEADBOB_ENABLED
|
||||||
// after rendering sprites substract back the head bob offset
|
// after rendering sprites substract back the head bob offset
|
||||||
SFG_player.camera.height -= headBobOffset;
|
SFG_player.camera.height -= headBobOffset;
|
||||||
|
|
||||||
|
#if SFG_HEADBOB_SHEAR != 0
|
||||||
|
SFG_player.camera.shear -= headBobShearOffset;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // head bob enabled?
|
||||||
|
|
||||||
#if SFG_PREVIEW_MODE == 0
|
#if SFG_PREVIEW_MODE == 0
|
||||||
SFG_drawWeapon(weaponBobOffset);
|
SFG_drawWeapon(weaponBobOffset);
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,6 +33,9 @@
|
|||||||
#define SFG_REVEAL_MAP 1
|
#define SFG_REVEAL_MAP 1
|
||||||
// #define SFG_INFINITE_AMMO 1
|
// #define SFG_INFINITE_AMMO 1
|
||||||
|
|
||||||
|
#define SFG_SCREEN_RESOLUTION_X 800
|
||||||
|
#define SFG_SCREEN_RESOLUTION_Y 600
|
||||||
|
|
||||||
// #define SFG_SCREEN_RESOLUTION_X 88
|
// #define SFG_SCREEN_RESOLUTION_X 88
|
||||||
// #define SFG_SCREEN_RESOLUTION_Y 110
|
// #define SFG_SCREEN_RESOLUTION_Y 110
|
||||||
|
|
||||||
@ -45,6 +48,7 @@
|
|||||||
*/
|
*/
|
||||||
#define SFG_PLAYER_DAMAGE_MULTIPLIER 1024
|
#define SFG_PLAYER_DAMAGE_MULTIPLIER 1024
|
||||||
#define SFG_DITHERED_SHADOW 1
|
#define SFG_DITHERED_SHADOW 1
|
||||||
|
#define SFG_HEADBOB_SHEAR (-1 * SFG_SCREEN_RESOLUTION_Y / 80)
|
||||||
|
|
||||||
#define MUSIC_VOLUME 64
|
#define MUSIC_VOLUME 64
|
||||||
|
|
||||||
|
10
settings.h
10
settings.h
@ -69,7 +69,7 @@
|
|||||||
/**
|
/**
|
||||||
How quickly player turns left/right, in degrees per second.
|
How quickly player turns left/right, in degrees per second.
|
||||||
*/
|
*/
|
||||||
#define SFG_PLAYER_TURN_SPEED 210
|
#define SFG_PLAYER_TURN_SPEED 180
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Distance, in RCL_Units, to which textures will be drawn. Textures behind this
|
Distance, in RCL_Units, to which textures will be drawn. Textures behind this
|
||||||
@ -177,6 +177,14 @@
|
|||||||
#define SFG_HEADBOB_OFFSET 200
|
#define SFG_HEADBOB_OFFSET 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
If head bob is on, this additionally sets additional camera shear bob, in
|
||||||
|
pixels, which can make bobbing look more "advanced". 0 turns this option off.
|
||||||
|
*/
|
||||||
|
#ifndef SFG_HEADBOB_SHEAR
|
||||||
|
#define SFG_HEADBOB_SHEAR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Weapon bobbing offset in weapon image pixels.
|
Weapon bobbing offset in weapon image pixels.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user