mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-11-24 18:02:22 -05:00
Fix sprite size
This commit is contained in:
parent
92608269d3
commit
1ca9e371e4
10
constants.h
10
constants.h
@ -86,7 +86,7 @@
|
||||
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
|
||||
square).
|
||||
*/
|
||||
#define SFG_ELEMENT_COLLISION_RADIUS 1500
|
||||
#define SFG_ELEMENT_COLLISION_RADIUS 1900
|
||||
|
||||
/**
|
||||
Height, in RCL_Units, at which collisions happen with level elements
|
||||
@ -176,6 +176,11 @@
|
||||
*/
|
||||
#define SFG_WIN_ANIMATION_DURATION 2500
|
||||
|
||||
/**
|
||||
Vertical sprite size, in RCL_Units.
|
||||
*/
|
||||
#define SFG_BASE_SPRITE_SIZE RCL_UNITS_PER_SQUARE
|
||||
|
||||
// ----------------------------
|
||||
// derived constants
|
||||
|
||||
@ -187,9 +192,6 @@
|
||||
|
||||
#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS
|
||||
|
||||
#define SFG_BASE_SPRITE_SIZE \
|
||||
(SFG_GAME_RESOLUTION_Y)
|
||||
|
||||
#if SFG_MS_PER_FRAME == 0
|
||||
#define SFG_MS_PER_FRAME 1
|
||||
#endif
|
||||
|
16
main.c
16
main.c
@ -151,9 +151,11 @@ typedef struct
|
||||
#define SFG_SPRITE_SIZE(size0to3) \
|
||||
(((size0to3 + 3) * SFG_BASE_SPRITE_SIZE) / 4)
|
||||
|
||||
#define SFG_SPRITE_SIZE_PIXELS(size0to3) \
|
||||
((SFG_SPRITE_SIZE(size0to3) * SFG_GAME_RESOLUTION_Y) / RCL_UNITS_PER_SQUARE)
|
||||
|
||||
#define SFG_SPRITE_SIZE_TO_HEIGHT_ABOVE_GROUND(size0to3) \
|
||||
((SFG_SPRITE_SIZE(size0to3) * 2) / 3)
|
||||
// ^TODO: why 3/4 and not 1/2?
|
||||
(SFG_SPRITE_SIZE(size0to3) / 2)
|
||||
|
||||
/**
|
||||
Holds information about one instance of a level item (a type of level element,
|
||||
@ -3636,7 +3638,7 @@ void SFG_draw()
|
||||
SFG_drawScaledSprite(s,
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(
|
||||
SFG_SPRITE_SIZE(spriteSize),
|
||||
SFG_SPRITE_SIZE_PIXELS(spriteSize),
|
||||
p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth);
|
||||
}
|
||||
@ -3678,7 +3680,7 @@ void SFG_draw()
|
||||
SFG_drawScaledSprite(
|
||||
sprite,
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(SFG_SPRITE_SIZE(spriteSize),p.depth),
|
||||
RCL_perspectiveScale(SFG_SPRITE_SIZE_PIXELS(spriteSize),p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth);
|
||||
}
|
||||
}
|
||||
@ -3702,7 +3704,7 @@ void SFG_draw()
|
||||
|
||||
const uint8_t *s = SFG_effectSprites[proj->type];
|
||||
|
||||
int16_t spriteSize = SFG_SPRITE_SIZE(0);
|
||||
int16_t spriteSize = SFG_SPRITE_SIZE_PIXELS(0);
|
||||
|
||||
if (proj->type == SFG_PROJECTILE_EXPLOSION ||
|
||||
proj->type == SFG_PROJECTILE_DUST)
|
||||
@ -3710,10 +3712,10 @@ void SFG_draw()
|
||||
int16_t doubleFramesToLive =
|
||||
RCL_nonZero(SFG_GET_PROJECTILE_FRAMES_TO_LIVE(proj->type) / 2);
|
||||
|
||||
// grow the explosion sprite as an animation
|
||||
// grow the explosion/dust sprite as an animation
|
||||
spriteSize =
|
||||
(
|
||||
SFG_BASE_SPRITE_SIZE *
|
||||
SFG_SPRITE_SIZE_PIXELS(2) *
|
||||
RCL_sinInt(
|
||||
((doubleFramesToLive -
|
||||
proj->doubleFramesToLive) * RCL_UNITS_PER_SQUARE / 4)
|
||||
|
@ -187,7 +187,7 @@
|
||||
/**
|
||||
Developer cheat for immortality.
|
||||
*/
|
||||
#define SFG_IMMORTAL 0
|
||||
#define SFG_IMMORTAL 1
|
||||
|
||||
/**
|
||||
Turn on for previes mode for map editing (flying, noclip, fast movement etc.).
|
||||
@ -203,6 +203,6 @@
|
||||
Skips menu and starts given level immediatelly, for development. 0 means this
|
||||
options is ignored, 1 means load level 1 etc.
|
||||
*/
|
||||
#define SFG_START_LEVEL 5
|
||||
#define SFG_START_LEVEL 0
|
||||
|
||||
#endif // guard
|
||||
|
Loading…
Reference in New Issue
Block a user