Ejemplo n.º 1
0
/* get samples
   ---------------------------------------------------------------- */
void SPC_update(unsigned char *buf)
{
    // APU_LOOP
    int c, ic, oc;

    BCOLOR(255, 0, 0);

    /* VP : rewrote this loop, it was completely wrong in original
       spcxmms-0.2.1 */
    for (c = 0; c < 2048000 / RATE; ) {
        oc = c;
        for (ic = c + 256; c < ic; ) {
            int cycles;
            cycles = S9xAPUCycleLengths [*IAPU.PC];
            (*S9xApuOpcodes[*IAPU.PC]) ();
            //APU_EXECUTE1();

            if (IAPU.Slowdown > 0) {
                /* VP : in slowdown mode, SPC executes 2^SPC_slowdown_cycle_shift
                   times slower */
                c += cycles << SPC_slowdown_cycle_shift;
                IAPU.Slowdown --;
            } else {
                /* VP : no slowdown, normal speed of the SPC */
                c += cycles;
            }
        }

        /* VP : Execute timer required number of times */
        for (ic = 0; ic < (c / 32) - (oc / 32) ; ic++) {
            IAPU.TimerErrorCounter ++;
            DoTimer();
        }

    }

    BCOLOR(255, 255, 0);
    S9xMixSamples ((unsigned char *)buf, samples_per_mix);
    BCOLOR(0, 0, 0);

}
Ejemplo n.º 2
0
void gameover(int score, char *survival_time)
{
    GDATAPTR game = get_game_data();

    if(quit == NULL)
    {
        quit = create_new_button("QUITTOMENUGO",
                                 "DEFAULT",
                                 "QUIT TO MENU",
                                 game->b_font,
                                 BCOLOR(255, 255, 255, 255), //80, 112/122, 255
                                 BCOLOR(65, 105, 255, 191),
                                 -280, //263
                                 500, //225
                                 50,
                                 BRIGHT,
                                 BVISIBLE,
                                 true
                                );
    }

    add_element_to_render_queue(NULL, 280, 250, 0, RCOLOR(0, 0, 0, 255), update_score);
    add_element_to_render_queue(NULL, 280, 300, 0, RCOLOR(0, 0, 0, 255), update_survivaltime);
}
Ejemplo n.º 3
0
BUTTONPTR standard_button_animations(BUTTONPTR button)
{
    const int dx = 1, dy = 1, limit = 20;
    unsigned char r, g, b, a;
    al_unmap_rgba(button->bdata.b_color, &r, &g, &b, &a);
    if((button->bdata.bflags & BMOUSEOVER))
    {
        button->bdata.b_color = BCOLOR(r, g, b, 255);
        switch(sb)
        {
            default:
            case SBLEFT:
            case SBRIGHT:
            case SBUP:
            case SBDOWN:
            case SBNONE:
            break;
            case BBOUNCEHORZ:
            {
                if(button->bdata.sflags == SBRIGHT)
                    button->bdata.x += dx;
                else if(button->bdata.sflags == SBLEFT)
                    button->bdata.x -= dx;
                if(button->bdata.x >= button->bdata.ox+limit)
                    button->bdata.sflags = SBLEFT;
                if(button->bdata.x <= button->bdata.ox-limit)
                    button->bdata.sflags = SBRIGHT;
                if(button->bdata.sflags == 0)
                    button->bdata.sflags = SBRIGHT;
            }
            break;
            case BSHIFTRIGHT:
            {
                if(button->bdata.x < button->bdata.ox+limit)
                    button->bdata.x += 1;
            }
            break;
            case BSHIFTLEFT:
            {
                if(button->bdata.x > button->bdata.ox-limit)
                    button->bdata.x -= 1;
            }
            break;
            case BBOUNCEVERT:
            {
                if(button->bdata.sflags == SBDOWN)
                    button->bdata.y += dy;
                else if(button->bdata.sflags == SBUP)
                    button->bdata.y -= dy;
                if(button->bdata.y >= button->bdata.oy+limit)
                    button->bdata.sflags = SBUP;
                if(button->bdata.y <= button->bdata.oy-limit)
                    button->bdata.sflags = SBDOWN;
                if(button->bdata.sflags == 0)
                    button->bdata.sflags = SBDOWN;
            }
        }
    }
    else
    {
       button->bdata.b_color = BCOLOR(r, g, b, button->bdata.alpha);
       button->bdata.sflags = 0;
       if(button->bdata.x > button->bdata.ox)
            button->bdata.x -= 1;
       if(button->bdata.x < button->bdata.ox)
            button->bdata.x += 1;
       if(button->bdata.y > button->bdata.oy)
            button->bdata.y -= 1;
       if(button->bdata.y < button->bdata.oy)
            button->bdata.y += 1;
    }
    return button;
}