mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-12-21 14:58:49 -05:00
Improve story text
This commit is contained in:
parent
d144c61620
commit
0c18fcc905
21
constants.h
21
constants.h
@ -222,6 +222,7 @@
|
|||||||
#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS
|
#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS
|
||||||
|
|
||||||
#if SFG_MS_PER_FRAME == 0
|
#if SFG_MS_PER_FRAME == 0
|
||||||
|
#undef SFG_MS_PER_FRAME
|
||||||
#define SFG_MS_PER_FRAME 1
|
#define SFG_MS_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -229,6 +230,7 @@
|
|||||||
(SFG_KEY_REPEAT_DELAY / SFG_MS_PER_FRAME)
|
(SFG_KEY_REPEAT_DELAY / SFG_MS_PER_FRAME)
|
||||||
|
|
||||||
#if SFG_KEY_REPEAT_DELAY_FRAMES == 0
|
#if SFG_KEY_REPEAT_DELAY_FRAMES == 0
|
||||||
|
#undef SFG_KEY_REPEAT_DELAY_FRAMES
|
||||||
#define SFG_KEY_REPEAT_DELAY_FRAMES 1
|
#define SFG_KEY_REPEAT_DELAY_FRAMES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -236,6 +238,7 @@
|
|||||||
(SFG_KEY_REPEAT_PERIOD / SFG_MS_PER_FRAME)
|
(SFG_KEY_REPEAT_PERIOD / SFG_MS_PER_FRAME)
|
||||||
|
|
||||||
#if SFG_KEY_REPEAT_PERIOD_FRAMES == 0
|
#if SFG_KEY_REPEAT_PERIOD_FRAMES == 0
|
||||||
|
#undef SFG_KEY_REPEAT_PERIOD_FRAMES
|
||||||
#define SFG_KEY_REPEAT_PERIOD_FRAMES 1
|
#define SFG_KEY_REPEAT_PERIOD_FRAMES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -243,6 +246,7 @@
|
|||||||
(SFG_GAME_RESOLUTION_X / (SFG_TEXTURE_SIZE * 5))
|
(SFG_GAME_RESOLUTION_X / (SFG_TEXTURE_SIZE * 5))
|
||||||
|
|
||||||
#if SFG_WEAPON_IMAGE_SCALE == 0
|
#if SFG_WEAPON_IMAGE_SCALE == 0
|
||||||
|
#undef SFG_WEAPON_IMAGE_SCALE
|
||||||
#define SFG_WEAPON_IMAGE_SCALE 1
|
#define SFG_WEAPON_IMAGE_SCALE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -259,6 +263,7 @@
|
|||||||
((SFG_PLAYER_TURN_SPEED * RCL_UNITS_PER_SQUARE) / (360 * SFG_FPS))
|
((SFG_PLAYER_TURN_SPEED * RCL_UNITS_PER_SQUARE) / (360 * SFG_FPS))
|
||||||
|
|
||||||
#if SFG_PLAYER_TURN_UNITS_PER_FRAME == 0
|
#if SFG_PLAYER_TURN_UNITS_PER_FRAME == 0
|
||||||
|
#undef SFG_PLAYER_TURN_UNITS_PER_FRAME
|
||||||
#define SFG_PLAYER_TURN_UNITS_PER_FRAME 1
|
#define SFG_PLAYER_TURN_UNITS_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -266,6 +271,7 @@
|
|||||||
((SFG_PLAYER_MOVE_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS)
|
((SFG_PLAYER_MOVE_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS)
|
||||||
|
|
||||||
#if SFG_PLAYER_MOVE_UNITS_PER_FRAME == 0
|
#if SFG_PLAYER_MOVE_UNITS_PER_FRAME == 0
|
||||||
|
#undef SFG_PLAYER_MOVE_UNITS_PER_FRAME
|
||||||
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME 1
|
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -273,6 +279,7 @@
|
|||||||
((SFG_GRAVITY_ACCELERATION * RCL_UNITS_PER_SQUARE) / (SFG_FPS * SFG_FPS))
|
((SFG_GRAVITY_ACCELERATION * RCL_UNITS_PER_SQUARE) / (SFG_FPS * SFG_FPS))
|
||||||
|
|
||||||
#if SFG_GRAVITY_SPEED_INCREASE_PER_FRAME == 0
|
#if SFG_GRAVITY_SPEED_INCREASE_PER_FRAME == 0
|
||||||
|
#undef SFG_GRAVITY_SPEED_INCREASE_PER_FRAME
|
||||||
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME 1
|
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -285,6 +292,7 @@
|
|||||||
try to solve the differential equation and plot it. */
|
try to solve the differential equation and plot it. */
|
||||||
|
|
||||||
#if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0
|
#if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0
|
||||||
|
#undef SFG_PLAYER_JUMP_OFFSET_PER_FRAME
|
||||||
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1
|
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -292,6 +300,7 @@
|
|||||||
(SFG_HEADBOB_SPEED / SFG_FPS)
|
(SFG_HEADBOB_SPEED / SFG_FPS)
|
||||||
|
|
||||||
#if SFG_HEADBOB_FRAME_INCREASE_PER_FRAME == 0
|
#if SFG_HEADBOB_FRAME_INCREASE_PER_FRAME == 0
|
||||||
|
#undef SFG_HEADBOB_FRAME_INCREASE_PER_FRAME
|
||||||
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME 1
|
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -301,6 +310,7 @@
|
|||||||
((SFG_GAME_RESOLUTION_Y * SFG_CAMERA_SHEAR_SPEED) / SFG_FPS)
|
((SFG_GAME_RESOLUTION_Y * SFG_CAMERA_SHEAR_SPEED) / SFG_FPS)
|
||||||
|
|
||||||
#if SFG_CAMERA_SHEAR_STEP_PER_FRAME == 0
|
#if SFG_CAMERA_SHEAR_STEP_PER_FRAME == 0
|
||||||
|
#undef SFG_CAMERA_SHEAR_STEP_PER_FRAME
|
||||||
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME 1
|
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -311,6 +321,7 @@
|
|||||||
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 50))
|
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 50))
|
||||||
|
|
||||||
#if SFG_FONT_SIZE_SMALL == 0
|
#if SFG_FONT_SIZE_SMALL == 0
|
||||||
|
#undef SFG_FONT_SIZE_SMALL
|
||||||
#define SFG_FONT_SIZE_SMALL 1
|
#define SFG_FONT_SIZE_SMALL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -318,6 +329,7 @@
|
|||||||
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 30))
|
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 30))
|
||||||
|
|
||||||
#if SFG_FONT_SIZE_MEDIUM == 0
|
#if SFG_FONT_SIZE_MEDIUM == 0
|
||||||
|
#undef SFG_FONT_SIZE_MEDIUM
|
||||||
#define SFG_FONT_SIZE_MEDIUM 1
|
#define SFG_FONT_SIZE_MEDIUM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -325,6 +337,7 @@
|
|||||||
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 18))
|
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 18))
|
||||||
|
|
||||||
#if SFG_FONT_SIZE_BIG == 0
|
#if SFG_FONT_SIZE_BIG == 0
|
||||||
|
#undef SFG_FONT_SIZE_BIG
|
||||||
#define SFG_FONT_SIZE_BIG 1
|
#define SFG_FONT_SIZE_BIG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -348,6 +361,7 @@
|
|||||||
(SFG_DOOR_OPEN_SPEED / (SFG_DOOR_HEIGHT_STEP * SFG_FPS))
|
(SFG_DOOR_OPEN_SPEED / (SFG_DOOR_HEIGHT_STEP * SFG_FPS))
|
||||||
|
|
||||||
#if SFG_DOOR_INCREMENT_PER_FRAME == 0
|
#if SFG_DOOR_INCREMENT_PER_FRAME == 0
|
||||||
|
#undef SFG_DOOR_INCREMENT_PER_FRAME
|
||||||
#define SFG_DOOR_INCREMENT_PER_FRAME 1
|
#define SFG_DOOR_INCREMENT_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -358,6 +372,7 @@
|
|||||||
#define SFG_MAP_PIXEL_SIZE (SFG_GAME_RESOLUTION_Y / SFG_MAP_SIZE)
|
#define SFG_MAP_PIXEL_SIZE (SFG_GAME_RESOLUTION_Y / SFG_MAP_SIZE)
|
||||||
|
|
||||||
#if SFG_MAP_PIXEL_SIZE == 0
|
#if SFG_MAP_PIXEL_SIZE == 0
|
||||||
|
#undef SFG_MAP_SIZE
|
||||||
#define SFG_MAP_SIZE 1
|
#define SFG_MAP_SIZE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -365,17 +380,15 @@
|
|||||||
(SFG_FPS / SFG_AI_FPS)
|
(SFG_FPS / SFG_AI_FPS)
|
||||||
|
|
||||||
#if SFG_AI_UPDATE_FRAME_INTERVAL == 0
|
#if SFG_AI_UPDATE_FRAME_INTERVAL == 0
|
||||||
|
#undef SFG_AI_UPDATE_FRAME_INTERVAL
|
||||||
#define SFG_AI_UPDATE_FRAME_INTERVAL 1
|
#define SFG_AI_UPDATE_FRAME_INTERVAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SFG_EXPLOSION_DURATION_DOUBLE_FRAMES == 0
|
|
||||||
#define SFG_EXPLOSION_DURATION_FRAMES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SFG_SPRITE_ANIMATION_FRAME_DURATION \
|
#define SFG_SPRITE_ANIMATION_FRAME_DURATION \
|
||||||
(SFG_FPS / SFG_SPRITE_ANIMATION_SPEED)
|
(SFG_FPS / SFG_SPRITE_ANIMATION_SPEED)
|
||||||
|
|
||||||
#if SFG_SPRITE_ANIMATION_FRAME_DURATION == 0
|
#if SFG_SPRITE_ANIMATION_FRAME_DURATION == 0
|
||||||
|
#undef SFG_SPRITE_ANIMATION_FRAME_DURATION
|
||||||
#define SFG_SPRITE_ANIMATION_FRAME_DURATION 1
|
#define SFG_SPRITE_ANIMATION_FRAME_DURATION 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
40
game.h
40
game.h
@ -3841,6 +3841,10 @@ void SFG_gameStep()
|
|||||||
void SFG_fillRectangle(
|
void SFG_fillRectangle(
|
||||||
uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t color)
|
uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t color)
|
||||||
{
|
{
|
||||||
|
if ((x + width >= SFG_GAME_RESOLUTION_X) ||
|
||||||
|
(y + height >= SFG_GAME_RESOLUTION_Y))
|
||||||
|
return;
|
||||||
|
|
||||||
for (uint16_t j = y; j < y + height; ++j)
|
for (uint16_t j = y; j < y + height; ++j)
|
||||||
for (uint16_t i = x; i < x + width; ++i)
|
for (uint16_t i = x; i < x + width; ++i)
|
||||||
SFG_setGamePixel(i,j,color);
|
SFG_setGamePixel(i,j,color);
|
||||||
@ -3932,29 +3936,25 @@ void SFG_drawMap()
|
|||||||
*/
|
*/
|
||||||
void SFG_drawStoryText()
|
void SFG_drawStoryText()
|
||||||
{
|
{
|
||||||
const char *text;
|
const char *text = SFG_outroText;
|
||||||
|
uint16_t textColor = 23;
|
||||||
uint16_t textColor;
|
uint8_t clearColor = 9;
|
||||||
|
uint8_t sprite = 18;
|
||||||
|
|
||||||
if (SFG_currentLevel.levelNumber != (SFG_NUMBER_OF_LEVELS - 1)) // intro?
|
if (SFG_currentLevel.levelNumber != (SFG_NUMBER_OF_LEVELS - 1)) // intro?
|
||||||
{
|
{
|
||||||
text = SFG_introText;
|
text = SFG_introText;
|
||||||
textColor = 7;
|
textColor = 7;
|
||||||
|
clearColor = 0;
|
||||||
SFG_clearScreen(0);
|
sprite = SFG_game.blink * 2;
|
||||||
}
|
}
|
||||||
else // outro
|
|
||||||
{
|
|
||||||
text = SFG_outroText;
|
|
||||||
textColor = 23;
|
|
||||||
|
|
||||||
SFG_clearScreen(9);
|
SFG_clearScreen(clearColor);
|
||||||
|
|
||||||
SFG_blitImage(SFG_monsterSprites + 18 * SFG_TEXTURE_SIZE,
|
SFG_blitImage(SFG_monsterSprites + sprite * SFG_TEXTURE_STORE_SIZE,
|
||||||
(SFG_GAME_RESOLUTION_X - SFG_TEXTURE_SIZE * SFG_FONT_SIZE_SMALL) / 2,
|
(SFG_GAME_RESOLUTION_X - SFG_TEXTURE_SIZE * SFG_FONT_SIZE_SMALL) / 2,
|
||||||
SFG_GAME_RESOLUTION_Y - (SFG_TEXTURE_SIZE + 3) * SFG_FONT_SIZE_SMALL,
|
SFG_GAME_RESOLUTION_Y - (SFG_TEXTURE_SIZE + 3) * SFG_FONT_SIZE_SMALL,
|
||||||
SFG_FONT_SIZE_SMALL);
|
SFG_FONT_SIZE_SMALL);
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t textLen = 0;
|
uint16_t textLen = 0;
|
||||||
|
|
||||||
@ -3966,6 +3966,20 @@ void SFG_drawStoryText()
|
|||||||
((SFG_game.frameTime - SFG_game.stateChangeTime) * textLen) /
|
((SFG_game.frameTime - SFG_game.stateChangeTime) * textLen) /
|
||||||
SFG_STORYTEXT_DURATION + 1);
|
SFG_STORYTEXT_DURATION + 1);
|
||||||
|
|
||||||
|
#define CHAR_SIZE (SFG_FONT_SIZE_SMALL * (SFG_FONT_CHARACTER_SIZE + 1))
|
||||||
|
#define LINE_LENGTH (SFG_GAME_RESOLUTION_X / CHAR_SIZE)
|
||||||
|
#define MAX_LENGTH (((SFG_GAME_RESOLUTION_Y / CHAR_SIZE) / 2) * LINE_LENGTH )
|
||||||
|
|
||||||
|
uint16_t drawShift = (drawLen < MAX_LENGTH) ? 0 :
|
||||||
|
(((drawLen - MAX_LENGTH) / LINE_LENGTH) * LINE_LENGTH);
|
||||||
|
|
||||||
|
#undef CHAR_SIZE
|
||||||
|
#undef LINE_LENGTH
|
||||||
|
#undef MAX_LENGTH
|
||||||
|
|
||||||
|
text += drawShift;
|
||||||
|
drawLen -= drawShift;
|
||||||
|
|
||||||
SFG_drawText(text,SFG_HUD_MARGIN,SFG_HUD_MARGIN,SFG_FONT_SIZE_SMALL,textColor,
|
SFG_drawText(text,SFG_HUD_MARGIN,SFG_HUD_MARGIN,SFG_FONT_SIZE_SMALL,textColor,
|
||||||
drawLen,SFG_GAME_RESOLUTION_X - SFG_HUD_MARGIN);
|
drawLen,SFG_GAME_RESOLUTION_X - SFG_HUD_MARGIN);
|
||||||
}
|
}
|
||||||
@ -4124,12 +4138,14 @@ void SFG_drawMenu()
|
|||||||
#define BACKGROUND_SCALE (SFG_GAME_RESOLUTION_X / (4 * SFG_TEXTURE_SIZE ) )
|
#define BACKGROUND_SCALE (SFG_GAME_RESOLUTION_X / (4 * SFG_TEXTURE_SIZE ) )
|
||||||
|
|
||||||
#if BACKGROUND_SCALE == 0
|
#if BACKGROUND_SCALE == 0
|
||||||
|
#undef BACKGROUND_SCALE
|
||||||
#define BACKGROUND_SCALE 1
|
#define BACKGROUND_SCALE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SCROLL_PIXELS_PER_FRAME ((64 * SFG_GAME_RESOLUTION_X) / (8 * SFG_FPS))
|
#define SCROLL_PIXELS_PER_FRAME ((64 * SFG_GAME_RESOLUTION_X) / (8 * SFG_FPS))
|
||||||
|
|
||||||
#if SCROLL_PIXELS_PER_FRAME == 0
|
#if SCROLL_PIXELS_PER_FRAME == 0
|
||||||
|
#undef SCROLL_PIXELS_PER_FRAME
|
||||||
#define SCROLL_PIXELS_PER_FRAME 1
|
#define SCROLL_PIXELS_PER_FRAME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
#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 80
|
||||||
|
// #define SFG_SCREEN_RESOLUTION_Y 64
|
||||||
|
// #define SFG_SIMPLE_MENU 1
|
||||||
|
|
||||||
#define MUSIC_VOLUME 4
|
#define MUSIC_VOLUME 4
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user