diff --git a/src/cutscene.c b/src/cutscene.c index 369fbdd..960086b 100644 --- a/src/cutscene.c +++ b/src/cutscene.c @@ -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; } diff --git a/src/defs.h b/src/defs.h index 3255608..e0f9da0 100644 --- a/src/defs.h +++ b/src/defs.h @@ -106,6 +106,14 @@ along with this program. If not, see . #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, diff --git a/src/engine.c b/src/engine.c index e434531..15002bc 100644 --- a/src/engine.c +++ b/src/engine.c @@ -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 diff --git a/src/engine.h b/src/engine.h index 5b3ece8..5c05415 100644 --- a/src/engine.h +++ b/src/engine.h @@ -89,6 +89,7 @@ typedef struct Engine_ { int useMusic; int fullScreen; int autoPause; + int radioLife; char configDirectory[PATH_MAX]; diff --git a/src/info.c b/src/info.c index cdfae6d..fb8e9d2 100644 --- a/src/info.c +++ b/src/info.c @@ -21,6 +21,7 @@ along with this program. If not, see . #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; } diff --git a/src/radio.c b/src/radio.c index 189ccb5..6c7930a 100644 --- a/src/radio.c +++ b/src/radio.c @@ -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]; diff --git a/src/title.c b/src/title.c index 06a5e8d..71bffad 100644 --- a/src/title.c +++ b/src/title.c @@ -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;