Added a text speed option, improved cutscene controls.

This is a pretty big one! Someone I know suggested that I should
make the textboxes able to stay on the screen for longer, so I've
added an option for that! In the process I also changed Fire and
Altfire to advance to the next box immediately (rather than skipping
outright), so that if you select a slower speed you can still make
the text go to the next one after you're finished reading one.
This commit is contained in:
Layla Marchant 2020-07-16 13:22:16 -04:00
parent 7b6eb5501f
commit 82b35c5ce0
7 changed files with 67 additions and 18 deletions

View File

@ -88,7 +88,7 @@ void cutscene_init(int scene)
aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
aliens[0].x = screen->w * 3 / 5;
aliens[0].y = screen->h / 2;
aliens[0].dx = 3.1;
aliens[0].dx = 3.05;
aliens[0].active = 1;
for (int i = 1 ; i < 7 ; i++)
@ -162,7 +162,7 @@ void cutscene_init(int scene)
case 2:
gfx_loadBackground("gfx/spirit.jpg");
engine.ssx = -1.4;
engine.ssx = -1.45;
engine.ssy = 0;
aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
@ -254,7 +254,7 @@ void cutscene_init(int scene)
case 4:
gfx_loadBackground("gfx/eyananth.jpg");
engine.ssx = -1.4;
engine.ssx = -1.45;
engine.ssy = 0;
aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
@ -360,7 +360,7 @@ void cutscene_init(int scene)
case 6:
gfx_loadBackground("gfx/mordor.jpg");
engine.ssx = -1.4;
engine.ssx = -1.45;
engine.ssy = 0;
aliens[0].image[0] = gfx_shipSprites[SS_FIREFLY];
@ -446,7 +446,7 @@ void cutscene_init(int scene)
if (scene == 0 && i > 0 && (timer % 15) == i) {
aliens[i].dx += (DRAND - 0.5) * 0.1;
aliens[i].dy += (DRAND - 0.5) * 0.1;
if (aliens[i].x > 500 - timer)
if (aliens[i].x > 500 - (timer % 480))
aliens[i].dx -= 0.2;
if (aliens[i].x < 0)
aliens[i].dx += 0.2;
@ -468,13 +468,13 @@ void cutscene_init(int scene)
}
timer--;
if (timer == 0)
if (timer <= 0)
{
showMessage = !showMessage;
timer = 120;
timer = 30;
if (showMessage)
{
timer = 60 * 7;
timer = engine.radioLife * 2;
currentMessage++;
if (currentMessage == 10)
@ -498,8 +498,14 @@ void cutscene_init(int scene)
game_delayFrame();
if ((engine.keyState[KEY_ESCAPE]) || (engine.keyState[KEY_FIRE]) ||
(engine.keyState[KEY_ALTFIRE]))
if ((engine.keyState[KEY_FIRE]) || (engine.keyState[KEY_ALTFIRE]))
{
timer = 0;
engine.keyState[KEY_FIRE] = 0;
engine.keyState[KEY_ALTFIRE] = 0;
}
if (engine.keyState[KEY_ESCAPE])
break;
}

View File

@ -106,6 +106,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define JS_DEADZONE 0.05
#define JS_MAX (32767 - JS_DEADZONE*32767)
// Radio life/speed
#define RADIO_LIFE_INSTANT 60
#define RADIO_LIFE_FAST 120
#define RADIO_LIFE_NORMAL 240
#define RADIO_LIFE_SLOW 360
#define RADIO_LIFE_SLOTH 480
#define DEFAULT_RADIO_LIFE RADIO_LIFE_NORMAL
// Object Flags
#define FL_WEAPCO (1L << 0)
#define FL_FRIEND (1L << 1)
@ -552,6 +560,7 @@ enum {
TS_MUSIC,
TS_FULLSCREEN,
TS_AUTOPAUSE,
TS_RADIO_SPEED,
TS_BACK_TO_MAIN_MENU,
TS_SAVESLOT_0,
TS_SAVESLOT_1,

View File

@ -274,6 +274,7 @@ void engine_setMode()
int useSound = 1;
int useMusic = 1;
int autoPause = 0;
int radioLife = DEFAULT_RADIO_LIFE;
FILE *fp;
snprintf(filename, PATH_MAX, "%sconf", engine.configDirectory);
@ -281,7 +282,7 @@ void engine_setMode()
if (fp != NULL)
{
if (fscanf(fp, "%d %d %d %d", &fullScreen, &useSound, &useMusic, &autoPause) < 4)
if (fscanf(fp, "%d %d %d %d %d", &fullScreen, &useSound, &useMusic, &autoPause, &radioLife) < 5)
printf("Warning: Config file \"%s\" is not correctly formatted\n", filename);
fclose(fp);
}
@ -290,6 +291,7 @@ void engine_setMode()
engine.useSound = useSound;
engine.useMusic = useMusic;
engine.autoPause = autoPause;
engine.radioLife = radioLife;
screen_adjustDimensions(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT);
@ -449,8 +451,9 @@ void engine_cleanup()
fp = fopen(filename, "w");
if (fp != NULL)
{
fprintf(fp, "%d %d %d %d\n", engine.fullScreen, engine.useSound,
engine.useMusic, engine.autoPause);
fprintf(fp, "%d %d %d %d %d\n",
engine.fullScreen, engine.useSound, engine.useMusic,
engine.autoPause, engine.radioLife);
fclose(fp);
}
else

View File

@ -89,6 +89,7 @@ typedef struct Engine_ {
int useMusic;
int fullScreen;
int autoPause;
int radioLife;
char configDirectory[PATH_MAX];

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "structs.h"
#include "gfx.h"
#include "engine.h"
void info_clearLines()
{
@ -66,5 +67,5 @@ void info_setLine(const char *in, int color)
}
gfx_createTextObject(index, in, 0, 0, color);
gfx_textSprites[index].life = 240;
gfx_textSprites[index].life = engine.radioLife;
}

View File

@ -41,7 +41,7 @@ void radio_setMessage(int face, const char *in, int priority)
return;
gfx_createTextObject(TS_RADIO, in, -1, 50, FONT_WHITE);
gfx_textSprites[TS_RADIO].life = 240;
gfx_textSprites[TS_RADIO].life = engine.radioLife;
if (face > -1)
faceShape = gfx_faceSprites[face];

View File

@ -131,6 +131,19 @@ static void createOptionsMenu()
gfx_createTextObject(TS_AUTOPAUSE, _("AUTOPAUSE - ON"), 0, 0, FONT_WHITE);
else
gfx_createTextObject(TS_AUTOPAUSE, _("AUTOPAUSE - OFF"), 0, 0, FONT_WHITE);
if (engine.radioLife == RADIO_LIFE_INSTANT)
gfx_createTextObject(TS_RADIO_SPEED, _("MESSAGE SPEED - INSTANT"), 0, 0, FONT_WHITE);
else if (engine.radioLife == RADIO_LIFE_FAST)
gfx_createTextObject(TS_RADIO_SPEED, _("MESSAGE SPEED - FAST"), 0, 0, FONT_WHITE);
else if (engine.radioLife == RADIO_LIFE_NORMAL)
gfx_createTextObject(TS_RADIO_SPEED, _("MESSAGE SPEED - NORMAL"), 0, 0, FONT_WHITE);
else if (engine.radioLife == RADIO_LIFE_SLOW)
gfx_createTextObject(TS_RADIO_SPEED, _("MESSAGE SPEED - SLOW"), 0, 0, FONT_WHITE);
else if (engine.radioLife == RADIO_LIFE_SLOTH)
gfx_createTextObject(TS_RADIO_SPEED, _("MESSAGE SPEED - SLOTH"), 0, 0, FONT_WHITE);
else // Shouldn't happen, but adding this just in case
gfx_createTextObject(TS_RADIO_SPEED, _("MESSAGE SPEED - ERROR"), 0, 0, FONT_WHITE);
}
static int showOptionsMenu()
@ -139,10 +152,11 @@ static int showOptionsMenu()
screen_blitText(TS_MUSIC, -1, MENU_Y + MENU_SPACING);
screen_blitText(TS_FULLSCREEN, -1, MENU_Y + 2 * MENU_SPACING);
screen_blitText(TS_AUTOPAUSE, -1, MENU_Y + 3 * MENU_SPACING);
screen_blitText(TS_RADIO_SPEED, -1, MENU_Y + 4 * MENU_SPACING);
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = 0;
screen_blitText(TS_BACK_TO_MAIN_MENU, -1, MENU_Y + 5 * MENU_SPACING);
screen_blitText(TS_BACK_TO_MAIN_MENU, -1, MENU_Y + 6 * MENU_SPACING);
return 5;
return 6;
}
static void createCheatMenu()
@ -435,7 +449,7 @@ int title_show()
else if (selectedOption == 4)
{
menuType = MENU_OPTIONS;
selectedOption = 5;
selectedOption = 6;
}
else if (selectedOption == 5)
{
@ -513,6 +527,21 @@ int title_show()
{
engine.autoPause = !engine.autoPause;
}
else if (selectedOption == 5)
{
if (engine.radioLife == RADIO_LIFE_INSTANT)
engine.radioLife = RADIO_LIFE_FAST;
else if (engine.radioLife == RADIO_LIFE_FAST)
engine.radioLife = RADIO_LIFE_NORMAL;
else if (engine.radioLife == RADIO_LIFE_NORMAL)
engine.radioLife = RADIO_LIFE_SLOW;
else if (engine.radioLife == RADIO_LIFE_SLOW)
engine.radioLife = RADIO_LIFE_SLOTH;
else if (engine.radioLife == RADIO_LIFE_SLOTH)
engine.radioLife = RADIO_LIFE_INSTANT;
else // Just in case
engine.radioLife = RADIO_LIFE_NORMAL;
}
else if (selectedOption == listLength)
{
menuType = MENU_MAIN;