Exemple #1
0
void JE_updateWarning( SDL_Surface * screen )
{
	if (delaycount2() == 0)
	{ /*Update Color Bars*/

		warningCol += warningColChange;
		if (warningCol > 14 * 16 + 10 || warningCol < 14 * 16 + 4)
		{
			warningColChange = -warningColChange;
		}
		fill_rectangle_xy(screen, 0, 0, 319, 5, warningCol);
		fill_rectangle_xy(screen, 0, 194, 319, 199, warningCol);
		JE_showVGA();

		setjasondelay2(6);

		if (warningSoundDelay > 0)
		{
			warningSoundDelay--;
		}
		else
		{
			warningSoundDelay = 14;
			JE_playSampleNum(17);
		}
	}
}
void JE_drawOptionLevel( void )
{
	if (twoPlayerMode)
	{
		for (temp = 1; temp <= 3; temp++)
		{
			fill_rectangle_xy(VGAScreenSeg, 268, 127 + (temp - 1) * 6, 269, 127 + 3 + (temp - 1) * 6, 193 + ((player[1].items.sidekick_level - 100) == temp) * 11);
		}
	}
}
Exemple #3
0
void JE_barDrawShadow( SDL_Surface *surface, JE_word x, JE_word y, JE_word res, JE_word col, JE_word amt, JE_word xsize, JE_word ysize )
{
	xsize--;
	ysize--;

	for (int z = 1; z <= amt / res; z++)
	{
		JE_barShade(surface, x+2, y+2, x+xsize+2, y+ysize+2);
		fill_rectangle_xy(surface, x, y, x+xsize, y+ysize, col+12);
		fill_rectangle_xy(surface, x, y, x+xsize, y, col+13);
		JE_pix(surface, x, y, col+15);
		fill_rectangle_xy(surface, x, y+ysize, x+xsize, y+ysize, col+11);
		x += xsize + 2;
	}

	amt %= res;
	if (amt > 0)
	{
		JE_barShade(surface, x+2, y+2, x+xsize+2, y+ysize+2);
		fill_rectangle_xy(surface, x,y, x+xsize, y+ysize, col+(12 / res * amt));
	}
}
void JE_drawOptions( void )
{
	SDL_Surface *temp_surface = VGAScreen;
	VGAScreen = VGAScreenSeg;

	Player *this_player = &player[twoPlayerMode ? 1 : 0];

	for (uint i = 0; i < COUNTOF(this_player->sidekick); ++i)
	{
		JE_OptionType *this_option = &options[this_player->items.sidekick[i]];

		this_player->sidekick[i].ammo =
		this_player->sidekick[i].ammo_max = this_option->ammo;

		this_player->sidekick[i].ammo_refill_ticks =
		this_player->sidekick[i].ammo_refill_ticks_max = (105 - this_player->sidekick[i].ammo) * 4;

		this_player->sidekick[i].style = this_option->tr;

		this_player->sidekick[i].animation_enabled = (this_option->option == 1);
		this_player->sidekick[i].animation_frame = 0;

		this_player->sidekick[i].charge = 0;
		this_player->sidekick[i].charge_ticks = 20;


		// draw initial sidekick HUD
		const int y = hud_sidekick_y[twoPlayerMode ? 1 : 0][i];

		fill_rectangle_xy(VGAScreenSeg, 284, y, 284 + 28, y + 15, 0);
		if (this_option->icongr > 0)
			blit_sprite(VGAScreenSeg, 284, y, OPTION_SHAPES, this_option->icongr - 1);  // sidekick HUD icon
		draw_segmented_gauge(VGAScreenSeg, 284, y + 13, 112, 2, 2, MAX(1, this_player->sidekick[i].ammo_max / 10), this_player->sidekick[i].ammo);
	}

	VGAScreen = temp_surface;

	JE_drawOptionLevel();
}
Exemple #5
0
/* Text is an array of strings terminated by a NULL */
void scroller_sine( const struct about_text_type text[] )
{
    bool ale = mt_rand() % 2;

    int visible_lines = vga_height / LINE_HEIGHT + 1;
    int current_line = -visible_lines;
    int y = 0;
    bool fade_in = true;

    struct coin_type {
        int x, y, vel, type, cur_frame;
        bool backwards;
    } coins[MAX_COINS];
    struct {
        int x, y, ay, vx, vy;
    } beer[MAX_BEER];

    if (ale)
    {
        memset(beer, 0, sizeof(beer));
    } else {
        for (int i = 0; i < MAX_COINS; i++)
        {
            coins[i].x = mt_rand() % (vga_width - 12);
            coins[i].y = mt_rand() % (vga_height - 20 - 14);

            coins[i].vel = (mt_rand() % 4) + 1;
            coins[i].type = mt_rand() % COUNTOF(coin_defs);
            coins[i].cur_frame = mt_rand() % coin_defs[coins[i].type].frame_count;
            coins[i].backwards = false;
        }
    }

    fade_black(10);

    wait_noinput(true, true, true);

    play_song(40); // BEER

    while (!JE_anyButton())
    {
        setdelay(3);

        JE_clr256(VGAScreen);

        if (!ale)
        {
            for (int i = 0; i < MAX_COINS/2; i++)
            {
                struct coin_type *coin = &coins[i];
                blit_sprite2(VGAScreen, coin->x, coin->y, eShapes5, coin_defs[coin->type].shape_num + coin->cur_frame);
            }
        }

        for (int i = 0; i < visible_lines; i++)
        {
            if (current_line + i >= 0)
            {
                if (text[current_line + i].text == NULL)
                {
                    break;
                }

                int line_x = VGAScreen->w / 2;
                int line_y = i * LINE_HEIGHT - y;

                // smooths edges on sine-wave text
                if (text[i + current_line].effect & 0x20)
                {
                    draw_font_hv(VGAScreen, line_x + 1, line_y, text[i + current_line].text, normal_font, centered, text[i + current_line].effect & 0x0f, -10);
                    draw_font_hv(VGAScreen, line_x - 1, line_y, text[i + current_line].text, normal_font, centered, text[i + current_line].effect & 0x0f, -10);
                }

                draw_font_hv(VGAScreen, line_x, line_y, text[i + current_line].text, normal_font, centered, text[i + current_line].effect & 0x0f, -4);

                if (text[i + current_line].effect & 0x10)
                {
                    for (int j = 0; j < LINE_HEIGHT; j++)
                    {
                        if (line_y + j >= 10 && line_y + j <= vga_height - 10)
                        {
                            int waver = sinf((((line_y + j) / 2) % 10) / 5.0f * M_PI) * 3;
                            memmove(&((Uint8 *)VGAScreen->pixels)[VGAScreen->pitch * (line_y + j) + waver],
                                    &((Uint8 *)VGAScreen->pixels)[VGAScreen->pitch * (line_y + j)],
                                    VGAScreen->pitch);
                        }
                    }
                }
            }
        }

        if (++y == LINE_HEIGHT)
        {
            y = 0;

            if (current_line < 0 || text[current_line].text != NULL)
                ++current_line;
            else
                current_line = -visible_lines;
        }

        if (!ale)
        {
            for (int i = MAX_COINS/2; i < MAX_COINS; i++)
            {
                struct coin_type *coin = &coins[i];
                blit_sprite2(VGAScreen, coin->x, coin->y, eShapes5, coin_defs[coin->type].shape_num + coin->cur_frame);
            }
        }

        fill_rectangle_xy(VGAScreen, 0, 0, vga_width - 1, 14, 0);
        fill_rectangle_xy(VGAScreen, 0, vga_height - 14, vga_width - 1, vga_height - 1, 0);

        if (!ale)
        {
            for (int i = 0; i < MAX_COINS; i++)
            {
                struct coin_type *coin = &coins[i];

                if (coin->backwards)
                {
                    coin->cur_frame--;
                } else {
                    coin->cur_frame++;
                }
                if (coin->cur_frame == coin_defs[coin->type].frame_count)
                {
                    if (coin_defs[coin->type].reverse_anim)
                    {
                        coin->backwards = true;
                        coin->cur_frame -= 2;
                    } else {
                        coin->cur_frame = 0;
                    }
                }
                if (coin->cur_frame == -1)
                {
                    coin->cur_frame = 1;
                    coin->backwards = false;
                }

                coin->y += coin->vel;
                if (coin->y > vga_height - 14)
                {
                    coin->x = mt_rand() % (vga_width - 12);
                    coin->y = 0;

                    coin->vel = (mt_rand() % 4) + 1;
                    coin->type = mt_rand() % COUNTOF(coin_defs);
                    coin->cur_frame = mt_rand() % coin_defs[coin->type].frame_count;
                }
            }
        } else {
            for (uint i = 0; i < COUNTOF(beer); i++)
            {
                while (beer[i].vx == 0)
                {
                    beer[i].x = mt_rand() % (vga_width - 24);
                    beer[i].y = mt_rand() % (vga_height - 28 - 50);

                    beer[i].vx = (mt_rand() % 5) - 2;
                }

                beer[i].vy++;

                if (beer[i].x + beer[i].vx > vga_width - 24 || beer[i].x + beer[i].vx < 0) // check if the beer hit the sides
                {
                    beer[i].vx = -beer[i].vx;
                }
                beer[i].x += beer[i].vx;

                if (beer[i].y + beer[i].vy > vga_height - 28) // check if the beer hit the bottom
                {
                    if ((beer[i].vy) < 8) // make sure the beer bounces!
                    {
                        beer[i].vy += mt_rand() % 2;
                    } else if (beer[i].vy > 16) { // make sure the beer doesn't bounce too high
                        beer[i].vy = 16;
                    }
                    beer[i].vy = -beer[i].vy + (mt_rand() % 3 - 1);

                    beer[i].x += (beer[i].vx > 0 ? 1 : -1) * (i % 2 ? 1 : -1);
                }
                beer[i].y += beer[i].vy;

                blit_sprite2x2(VGAScreen, beer[i].x, beer[i].y, eShapes5, BEER_SHAPE);
            }
        }

        JE_showVGA();

        if (fade_in)
        {
            fade_in = false;
            fade_palette(colors, 10, 0, 255);

            SDL_Color white = { 255, 255, 255 };
            set_colors(white, 254, 254);
        }

        wait_delay();
    }

    fade_black(10);
}