Ejemplo n.º 1
0
void initialize_oneplayer_screen()
{
   clear(screen_buffer);
   clear(screen);
   for (int i=0;i< NR_OF_LAYERS;i++)
       playfield->draw(screen_buffer,i);
   if (screen_buffer->w == SCREEN_W)
   {
      blit(screen_buffer,screen,0,0,0,0,SCREEN_W,SCREEN_H- 96);
   }
   else
   {
      stretch_blit(screen_buffer,screen,0,0, screen_buffer->w, screen_buffer->h,0,0,SCREEN_W,SCREEN_H- 96);
   }

   BITMAP *frame;
   for (int i=0; i<SCREEN_W;i+=640)
   {
      blit(board, screen, 0, 0 ,i , SCREEN_H - 96, 640, 96);
   }

   draw_rle_sprite(screen, (RLE_SPRITE *)(objects[GFXDATA_OBJECTS_GOUD].dat), 10, SCREEN_H - 86);
   draw_rle_sprite(screen, (RLE_SPRITE *)(objects[GFXDATA_OBJECTS_ENERG].dat),10, SCREEN_H - 44);
   draw_rle_sprite(screen, (RLE_SPRITE *)(objects[GFXDATA_OBJECTS_STER].dat),200, SCREEN_H - 86);
   draw_rle_sprite(screen, (RLE_SPRITE *)(objects[GFXDATA_OBJECTS_STUT].dat),200, SCREEN_H - 44);
   frame = create_sub_bitmap((BITMAP *)(anims[GFXDATA_ANIMS_MANS].dat), 0,0,32,32);
   masked_blit(frame,screen,0,0,400,SCREEN_H - 86,32,32);
   destroy_bitmap(frame);
   draw_rle_sprite(screen, (RLE_SPRITE *)(objects[GFXDATA_OBJECTS_HOUWEEL].dat),400, SCREEN_H - 44);
   
}
Ejemplo n.º 2
0
void Proceed()
{
    /* This is a transition effect */
    int ScreenWide;
    RLE_SPRITE *rle0, *rle1;

    strcpy(FName, "logs/");
    strcat(FName, Name);
    strcat(FName, " - ");
    strcat(FName, Number);
    strcat(FName, ".log");
    outfile = fopen(FName,"w");

    if(Option=='A')
    {
        system("mp3blaster /home/mentesuprema/Residencia/sounds/swing2.wav &");
        rest(5);
        rle0= get_rle_sprite(Screen1);
        rle1= get_rle_sprite(Screen2);

        for(ScreenWide=0; ScreenWide<=1024; ScreenWide=ScreenWide+10)
        {
            draw_rle_sprite(screen, rle0, ScreenWide, 0);
            draw_rle_sprite(screen, rle1, -1024+ScreenWide, 0);
        }
        destroy_rle_sprite(rle0);
        release_screen();
        Automatic();
    }
    if(Option=='M')
    {
        system("mp3blaster /home/mentesuprema/Residencia/sounds/swing2.wav &");
        rest(5);
        rle0= get_rle_sprite(Screen1);
        rle1= get_rle_sprite(Screen2);

        for(ScreenWide=0; ScreenWide<=1024; ScreenWide=ScreenWide+10)
        {
            draw_rle_sprite(screen, rle0, ScreenWide, 0);
            draw_rle_sprite(screen, rle1, -1024+ScreenWide, 0);
        }
        destroy_rle_sprite(rle0);
        destroy_rle_sprite(rle1);
        destroy_bitmap(Screen1);
        destroy_bitmap(Screen2);
        release_screen();
        Manual();
    }

    release_screen();
}
Ejemplo n.º 3
0
void test_fire_lit_allegro_rle(BITMAP *dst, int x, int y, int frame, int brightness)
{
    if (brightness >= 255) {
        draw_rle_sprite(dst, fire_rle_sprites[frame % SPRITE_COUNT], x, y);
    } else {
        set_trans_blender(0, 0, 0, 0);
        draw_lit_rle_sprite(dst, fire_rle_sprites[frame % SPRITE_COUNT], x, y, 255 - brightness);
    }
}
Ejemplo n.º 4
0
void render_loop() {
    int base,top,state;
    //draw them backgrounds!
    switch(levl->bgtype) {
    default:
    case 0:
        clear_bitmap(buffer); //black backgrund, not that useful
        break;
    case 1:
        render_sky(levl->lines); //sky-thingy
        break;
    case 2:
        show_fire(); //A fire...
        break;
    }
    render_level_map(levl,xorg,yorg);
    for (int ei=levl->entitycnt-1;ei>=0;ei--) {
        ENTITY *e = levl->entities+ei;
        switch (e->type) {
        default:
            printf("Unknown entity type in render loop! type: %d id: %d",e->type,ei);
        case ENTITY_TYPE_NULL:
            break;
        case ENTITY_TYPE_PLAYER:
            xorg = e->x-368/64.0 <=0 ? 0 : e->x+432/64.0 > levl->sizex ? levl->sizex-800/64.0 : e->x-368/64.0;
            yorg = e->y-268/64.0 <=0 ? 0 : e->y+332/64.0 > levl->sizey ? levl->sizey-600/64.0 : e->y-268/64.0;
            state = (e->data1&0x0300)>>16;
            top = 0;
            if (e->accely < 0) top = 1;
            if (e->accely > 0) top = 2;
            if (e->accely == 1/8.0) top = 5;
            if (e->accelx < 0) top = 3;
            if (e->accelx > 0) top = 4;
            if (e->health <= 0) top = 7;
            
            base = 0;
            render_player((e->x-xorg)*64,(e->y-yorg)*64,base,top);
            render_health(10,10,256,32,e->health,1024);
            textprintf_ex(buffer,font,0,0,getpixel(buffer,0,0)^0xFFFF,-1,"P: %d",e->data3);
            //stretch_blit(collectable_c[2],buffer,0,0,64,64,800-16,0,16,16);
            textprintf_right_ex(buffer,font,799,0,getpixel(buffer,799,0)^0xFFFF,-1,"%d",e->data4);
            break;
        case ENTITY_TYPE_COLLECTABLE:
            //printf("%X, %X, %X, %X ?? %X %X\n",e->data2,e->data2&0xFF00,e->data2&0xFF00 == 0x0100,0x0100,e->data2&0xFF00 > 0x0100,e->data2&0xFF00 < 0x0100);
            if ((e->data2&0xFF00) == 0x0100) {
                draw_rle_sprite(buffer,collectable_c[e->data2&0x0007],(e->x-xorg)*64,(e->y-yorg)*64);
                //draw_rle_sprite(buffer,collectable_c[e->data2&0x0007],0, 0);
            }
            break;
        }
    }
}
Ejemplo n.º 5
0
void draw_bullets(BITMAP *bmp)
{
   BULLET *bullet;
   for (bullet = bullet_list; bullet; bullet = bullet->next) {
      int x = bullet->x;
      int y = bullet->y;

      RLE_SPRITE *spr = data[ROCKET].dat;
      draw_rle_sprite(bmp, spr, x - spr->w / 2, y - spr->h / 2);
      if (animation_type == DIRTY_RECTANGLE)
         dirty_rectangle(x - spr->w / 2, y - spr->h / 2, spr->w, spr->h);
   }
}
Ejemplo n.º 6
0
/* worker function for changing the type of an image */
static int do_changetype(DATAFILE *dat, int *param, int type)
{
   BITMAP *bmp;
   RLE_SPRITE *spr;
   int x, y, c, r, g, b;

   if ((dat->type != DAT_BITMAP) && (dat->type != DAT_RLE_SPRITE) &&
       (dat->type != DAT_C_SPRITE) && (dat->type != DAT_XC_SPRITE)) {
      (*param)++;
      return D_O_K;
   }

   if (dat->type == type)
      return D_O_K;

   if (dat->type == DAT_RLE_SPRITE) {
      spr = (RLE_SPRITE *)dat->dat;
      bmp = create_bitmap_ex(spr->color_depth, spr->w, spr->h);
      clear_to_color(bmp, bmp->vtable->mask_color);
      draw_rle_sprite(bmp, spr, 0, 0);
      dat->dat = bmp;
      destroy_rle_sprite(spr);
   }
   else if (type == DAT_RLE_SPRITE) {
      bmp = (BITMAP *)dat->dat;
      spr = get_rle_sprite(bmp);
      dat->dat = spr;
      destroy_bitmap(bmp);
   }
   else if ((type == DAT_C_SPRITE) || (type == DAT_XC_SPRITE)) {
      bmp = (BITMAP *)dat->dat;
      if (bitmap_color_depth(bmp) == 32) {
	 for (y=0; y<bmp->h; y++) {
	    for (x=0; x<bmp->w; x++) {
	       c = getpixel(bmp, x, y);
	       r = getr32(c);
	       g = getg32(c);
	       b = getb32(c);
	       putpixel(bmp, x, y, makecol32(r, g, b));
	    }
	 }
      }
   }

   dat->type = type;

   return D_REDRAW;
}
Ejemplo n.º 7
0
int select_a_ship(void)
{

 int ship_box [8] = {0,0,0,0,0,0,0,0};

 int sbox2;

 int ship_chosen = 0;

 int level_chosen = 1;

 int max_level, wpixels;

 menu_counter = 0;
 counter2 = 0;



 int anykey = 0;

 int i, x, y, k;

 int holding_key = 1;

 while (TRUE)
 {
     menu_counter ++;

 clear_to_color(display, COL_BACK1);
 run_menu_background();

 x = 30;
 y = 40;

#define Y_INTERVAL 100
#define Y_BASE 45


// stages

 aabox(200, 50, 550, 250);
TRANS_MODE
 rectfill(display, 375 - 80, 70, 375 + 80, 100, TRANS_BLUE2);
 rect(display, 375 - 80, 70 - 0, 375 + 80, 100, TRANS_BLUE3);
 rect(display, 375 - 81, 70 - 1, 375 + 81, 100 + 1, TRANS_BLUE2);
END_TRANS

 textprintf_centre_ex(display, font, 375, 80, -1, -1, "select stage");

 switch(arena.difficulty)
 {
      case 0: textprintf_centre_ex(display, font, 375, 115, -1, -1, "NORMAL"); break;
      case 1: textprintf_centre_ex(display, font, 375, 115, -1, -1, "HARD"); break;
      case 2: textprintf_centre_ex(display, font, 375, 115, -1, -1, "PUNISHMENT"); break;
 }

 for (i = 0; i < 3; i ++)
 {
  if (i == 0)
  {
   aabox(230 + i * 70, 140 + i * 25, 270 + i * 70, 180 + i * 25);
   textprintf_centre_ex(display, font, 250 + i * 70, 152 + i * 25, -1, -1, "%i", i + 1);
   rect(display, 276 + i * 70, 141 + i * 25, 302 + i * 70, 152 + i * 25, TRANS_BLUE3);
  }
   else
    if (options.stage_power [ship_chosen] [i - 1] [arena.difficulty] != 0 || options.stage_power_bar [ship_chosen] [i - 1] [arena.difficulty] != 0)
    {
     aabox(230 + i * 70, 140 + i * 25, 270 + i * 70, 180 + i * 25);
     if (options.stage_power [ship_chosen] [i - 1] [arena.difficulty] < 0 || options.stage_power [ship_chosen] [i - 1] [arena.difficulty] > 9)
      options.stage_power [ship_chosen] [i - 1] [arena.difficulty] = 0; // sanity check

     textprintf_centre_ex(display, font, 250 + i * 70, 152 + i * 25, -1, -1, "%i", i + 1);
     TRANS_MODE
     for (k = 0; k < options.stage_power [ship_chosen] [i - 1] [arena.difficulty]; k ++)
     {
      rectfill(display, 305 + i * 70 + k * 4, 143 + i * 25, 307 + i * 70 + k * 4, 150 + i * 25, TRANS_RED1);
      rect(display, 305 + i * 70 + k * 4, 143 + i * 25, 307 + i * 70 + k * 4, 150 + i * 25, TRANS_RED4);
     }

//     rect(display, 275 + i * 70, 143 + i * 25, 303 + i * 70, 152 + i * 25, COL_OUTLINE);
//     rect(display, 276 + i * 70, 144 + i * 25, 302 + i * 70, 151 + i * 25, COL_LGREY);
     rect(display, 276 + i * 70, 141 + i * 25, 302 + i * 70, 152 + i * 25, TRANS_BLUE3);


#define LEVEL_CALC2 (3500 + (1100 * options.stage_power [ship_chosen] [i - 1] [arena.difficulty]))
// duplicated in enemy.c and level.c

     wpixels = ((float) (options.stage_power_bar [ship_chosen] [i - 1] [arena.difficulty] * 20) / LEVEL_CALC2);
     if (wpixels >= 20 || wpixels < 0)
      wpixels = 19;

     if (wpixels > 0)
     {
      rectfill(display, 279 + i * 70, 143 + i * 25, 279 + i * 70 + wpixels, 150 + i * 25, TRANS_RED1);
      rect(display, 278 + i * 70, 143 + i * 25, 278 + wpixels + i * 70, 150 + i * 25, TRANS_RED5);
     }

      END_TRANS

    }


  TRANS_MODE
  if (level_chosen - 1 == i)
    rectfill(display, 230 + i * 70, 140 + i * 25, 270 + i * 70, 180 + i * 25, TRANS_BLUE2);
  END_TRANS

 }


 if (options.clear [ship_chosen] [arena.difficulty])
 {
  TRANS_MODE
  rectfill(display, 207, 236, 214, 243, TRANS_BLUE4);
  END_TRANS

  textprintf_ex(display, font, 219, 231, -1, -1, "cleared");

 }
  else
   if (options.finished [ship_chosen] [arena.difficulty])
   {
    TRANS_MODE
    rectfill(display, 207, 236, 214, 243, TRANS_RED4);
    END_TRANS

    textprintf_ex(display, font, 219, 231, -1, -1, "finished");

   }

// ships

 draw_rle_sprite(display, eRLE_player [S_PLAYER1_1], x + 25 - 16, y + Y_BASE - 20 + 7);
 draw_rle_sprite(display, eRLE_player [S_PLAYER2_1], x + 25 - 19, y + Y_INTERVAL + Y_BASE - 8 - 5);
 draw_rle_sprite(display, eRLE_player [S_PLAYER3_1], x + 25 - 22, y + Y_INTERVAL * 2 + Y_BASE - 7 - 6);
 draw_rle_sprite(display, eRLE_player [S_PLAYER4_1], x + 25 - 16, y + Y_INTERVAL * 3 + Y_BASE - 9 - 4);
 draw_rle_sprite(display, eRLE_player [S_PLAYER4_1L], x + 25 - 16, y + Y_INTERVAL * 3 + Y_BASE - 4 + 3);
 draw_rle_sprite(display, eRLE_player [S_PLAYER5_1], x + 25 - 17, y + Y_INTERVAL * 4 + Y_BASE - 21);
// draw_rle_sprite(display, eRLE_player [S_PLAYER6_1], x + 25 - 16, y + Y_INTERVAL * 5 + 25 - 16);
/*
 textprintf_centre_ex(display, font, 100, 32, -1, -1, "g");
 textprintf_centre_ex(display, font, 100, 44, -1, -1, "g");
 textprintf_centre_ex(display, font, 100, 56, -1, -1, "g");
 textprintf_centre_ex(display, font, 100, 68, -1, -1, "g");
 textprintf_centre_ex(display, font, 100, 80, -1, -1, "g");
*/

 TRANS_MODE
 for (i = 0; i < 5; i ++)
 {
  rectfill(display, x, y - 25 + Y_BASE + i * Y_INTERVAL, x + 50, y + 25 + Y_BASE + i * Y_INTERVAL, TRANS_BLUE1);
  rect(display, x - 1, y - 25 + Y_BASE + i * Y_INTERVAL - 1, x + 50 + 1, y + 25 + Y_BASE + i * Y_INTERVAL + 1, TRANS_BLUE2);
  rect(display, x - 2, y - 25 + Y_BASE + i * Y_INTERVAL - 2, x + 50 + 2, y + 25 + Y_BASE + i * Y_INTERVAL + 2, TRANS_BLUE3);
  rect(display, x - 3, y - 25 + Y_BASE + i * Y_INTERVAL - 3, x + 50 + 3, y + 25 + Y_BASE + i * Y_INTERVAL + 3, TRANS_BLUE1);
  if (ship_chosen == i)
  {
    switch((menu_counter / 4) % 4)
    {
        case 0:
        default:
         rectfill(display, x - 1, y + i * Y_INTERVAL - 1 - 25 + Y_BASE, x + 50 + 1, y + 25 + Y_BASE + i * Y_INTERVAL + 1, TRANS_BLUE2);
         break;
/*        case 1:
         rectfill(display, x - 1, y + i * Y_INTERVAL - 1, x + 50 + 1, y + 50 + i * Y_INTERVAL + 1, TRANS_BLUE3);
         break;
        case 2:
         rectfill(display, x - 1, y + i * Y_INTERVAL - 1, x + 50 + 1, y + 50 + i * Y_INTERVAL + 1, TRANS_BLUE2);
         break;
        case 3:
         rectfill(display, x - 1, y + i * Y_INTERVAL - 1, x + 50 + 1, y + 50 + i * Y_INTERVAL + 1, TRANS_BLUE1);
         break;*/
  }
  }

  if (ship_box [i] > 0)
  {
   sbox2 = ship_box [i];
//   if (ship_box [ship_chosen] > 12 + xpart(menu_counter * 8, 5))
//    sbox2 = 12 + xpart(menu_counter * 8, 5);
   rect(display, x - 3 - sbox2, y + i * Y_INTERVAL - 3 - sbox2 - 25 + Y_BASE, x + 50 + 3 + sbox2, y + 25 + Y_BASE + i * Y_INTERVAL + 3 + sbox2, TRANS_BLUE3);
   ship_box [i] --;
  }

 }
 END_TRANS

 ship_box [ship_chosen] += 2;
 if (ship_box [ship_chosen] > 15)// + xpart(menu_counter * 8, 5))
  ship_box [ship_chosen] = 15;

#define TITLE_X 375
#define TITLE_Y 320

#define LINE_X 220

#define LINE1_Y 350
#define LINE2_Y 365
#define LINE3_Y 380
#define LINE4_Y 395


 TRANS_MODE
 rectfill(display, 200, 300, 550, 550, TRANS_BLUE1);
 rect(display, 200 - 1, 300 - 1, 550 + 1, 550 + 1, TRANS_BLUE2);
 rect(display, 200 - 2, 300 - 2, 550 + 2, 550 + 2, TRANS_BLUE3);
 rect(display, 200 - 3, 300 - 3, 550 + 3, 550 + 3, TRANS_BLUE2);
 rect(display, 200 - 4, 300 - 4, 550 + 4, 550 + 4, TRANS_BLUE1);

 sbox2 = ship_box [ship_chosen];

 rect(display, 200 - sbox2 - 0, 300 - sbox2 - 0, 550 + sbox2 + 0, 550 + sbox2 + 0, TRANS_BLUE1);
 rect(display, 200 - sbox2 - 1, 300 - sbox2 - 1, 550 + sbox2 + 1, 550 + sbox2 + 1, TRANS_BLUE2);
 rect(display, 200 - sbox2 - 2, 300 - sbox2 - 2, 550 + sbox2 + 2, 550 + sbox2 + 2, TRANS_BLUE3);
 rect(display, 200 - sbox2 - 3, 300 - sbox2 - 3, 550 + sbox2 + 3, 550 + sbox2 + 3, TRANS_BLUE2);
 rect(display, 200 - sbox2 - 4, 300 - sbox2 - 4, 550 + sbox2 + 4, 550 + sbox2 + 4, TRANS_BLUE1);

 vline(display, TITLE_X, 550 + sbox2 + 2, 590, TRANS_BLUE3);
 hline(display, 5, 590, TITLE_X, TRANS_BLUE3);
 vline(display, 5, 40 + 25 + ship_chosen * Y_INTERVAL, 590, TRANS_BLUE3);
 hline(display, 5, 40 + 25 + ship_chosen * Y_INTERVAL, 30 - sbox2 - 3, TRANS_BLUE3);

 END_TRANS

char ftext [8] [9] [150] =
{
  {
   "white butterfly",
   "1 - autocannon",
   "2 - heavy cannon",
   "3 - seekers",
   "fire1 - autocannon",
   "fire2 - charge heavy cannon",
   "fire1 while charging - seekers",
   ""
  },
  {
   "anemone",
   "1 - single cannon",
   "2 - strong, short-range blade",
   "3 - weak, long-range blade",
   "fire1 - single cannon",
   "fire2 - blade slash",
   "fire1 + fire2 - blade swing",
   " hold blade buttons for full circle",
   ""
  },
  {
   "spinneret",
   "1 - orb beams",
   "2 - orb scatter fire",
   "3 - bomb launcher",
   "fire1 - orb beams",
   "fire1 + fire2 - orb fire",
   "fire2 - bomb launcher",
   ""
  },
  {
   "hand of xom",
   "1 - multi-cannon",
   "2 - closed hand",
   "3 - open hand",
   "fire1 - multi-cannon",
   "fire2 - open up hand"
   "",
   ""
  }
,
  {
   "chaos squid",
   "1 - chaos droplets",
   "2 - chaos swarm",
   "3 - orb field",
   "fire1 while orb docked - fire droplets",
   "fire1 while orb loose - fire swarm",
   "fire2 - control orb",
   "fire1 + fire2 - repel orb"
  }

};

#define TEXT_X 230

 TRANS_MODE
 rectfill(display, TITLE_X - 80, TITLE_Y - 0, TITLE_X + 80, TITLE_Y + 30, TRANS_BLUE2);
 rect(display, TITLE_X - 80, TITLE_Y - 0, TITLE_X + 80, TITLE_Y + 30, TRANS_BLUE3);
 rect(display, TITLE_X - 81, TITLE_Y - 1, TITLE_X + 81, TITLE_Y + 31, TRANS_BLUE2);

 textprintf_centre_ex(display, font, TITLE_X, TITLE_Y + 10, -1, -1, ftext [ship_chosen] [0]);


 if (ship_chosen == 4 && options.unlock [arena.difficulty] == 0)
 {

  textprintf_centre_ex(display, font, TITLE_X, TITLE_Y + 80, -1, -1, "finish stage 3 to unlock");

 }
  else
  {
 hline(display, 198, LINE1_Y + 30, 320, TRANS_BLUE3);
 textprintf_ex(display, font, TEXT_X - 5, LINE1_Y + 20, -1, -1, "weapons");

 textprintf_ex(display, font, TEXT_X, LINE1_Y + 40, -1, -1, ftext [ship_chosen] [1]);
 textprintf_ex(display, font, TEXT_X, LINE1_Y + 55, -1, -1, ftext [ship_chosen] [2]);
 textprintf_ex(display, font, TEXT_X, LINE1_Y + 70, -1, -1, ftext [ship_chosen] [3]);
// textprintf_ex(display, font, TEXT_X, LINE1_Y + 60, -1, -1, ftext [ship_chosen] [4]);

 hline(display, 198, LINE1_Y + 110, 320, TRANS_BLUE3);
 textprintf_ex(display, font, TEXT_X - 5, LINE1_Y + 100, -1, -1, "controls");

 textprintf_ex(display, font, TEXT_X, LINE1_Y + 120, -1, -1, ftext [ship_chosen] [4]);
 textprintf_ex(display, font, TEXT_X, LINE1_Y + 135, -1, -1, ftext [ship_chosen] [5]);
 textprintf_ex(display, font, TEXT_X, LINE1_Y + 150, -1, -1, ftext [ship_chosen] [6]);
 textprintf_ex(display, font, TEXT_X, LINE1_Y + 165, -1, -1, ftext [ship_chosen] [7]);
  }

 END_TRANS

//  ship_box [ship_chosen] = 15 + xpart(menu_counter * 8, 5);

/*
 draw_rle_sprite(display, eRLE_player [S_PLAYER1_1], x + 25 - 16, y + 25 - 20 + 7);
 draw_rle_sprite(display, eRLE_player [S_PLAYER2_1], x + 90 + 25 - 19, y + 25 - 8 - 5);
 draw_rle_sprite(display, eRLE_player [S_PLAYER3_1], x + 25 - 22, y + Y_INTERVAL + 25 - 7 - 6);
 draw_rle_sprite(display, eRLE_player [S_PLAYER4_1], x + 90 + 25 - 16, y + Y_INTERVAL + 25 - 9 - 4);

 textprintf_centre_ex(display, font, 30, 102, -1, -1, "g");
 textprintf_centre_ex(display, font, 30, 114, -1, -1, "g");
 textprintf_centre_ex(display, font, 30, 126, -1, -1, "g");
 textprintf_centre_ex(display, font, 30, 138, -1, -1, "g");
 textprintf_centre_ex(display, font, 30, 150, -1, -1, "g");


 TRANS_MODE
 for (i = 0; i < 4; i ++)
 {
  rectfill(display, x, y + i * Y_INTERVAL, x + 50, y + 50 + i * Y_INTERVAL, TRANS_BLUE1);
  rect(display, x - 1, y + i * Y_INTERVAL - 1, x + 50 + 1, y + 50 + i * Y_INTERVAL + 1, TRANS_BLUE2);
  rect(display, x - 2, y + i * Y_INTERVAL - 2, x + 50 + 2, y + 50 + i * Y_INTERVAL + 2, TRANS_BLUE3);
  rect(display, x - 3, y + i * Y_INTERVAL - 3, x + 50 + 3, y + 50 + i * Y_INTERVAL + 3, TRANS_BLUE1);

  rectfill(display, x + 90, y + i * Y_INTERVAL, x + 140, y + 50 + i * Y_INTERVAL, TRANS_BLUE1);
  rect(display, x + 90 - 1, y + i * Y_INTERVAL - 1, x + 140 + 1, y + 50 + i * Y_INTERVAL + 1, TRANS_BLUE2);
  rect(display, x + 90 - 2, y + i * Y_INTERVAL - 2, x + 140 + 2, y + 50 + i * Y_INTERVAL + 2, TRANS_BLUE3);
  rect(display, x + 90 - 3, y + i * Y_INTERVAL - 3, x + 140 + 3, y + 50 + i * Y_INTERVAL + 3, TRANS_BLUE1);

 }
 END_TRANS
*/

 if (key [KEY_ESC])
  return -1;

  anykey = 0;

  for (i = KEY_A; i < KEY_CAPSLOCK + 1; i ++)
  {
   if (key [i])
   {
    anykey = 1;
   }
  }

  if (anykey == 0 && (options.joystick == 0 || any_joystick_input() == 0))
  {
   key_wait = 0;
   holding_key = 0;
  }

/*  if (anykey == 0)
  {
   key_wait = 0;
   holding_key = 0;
  }*/


 max_level = 1;

 if (options.stage_power [ship_chosen] [0] [arena.difficulty] > 0 || options.stage_power_bar [ship_chosen] [0] [arena.difficulty] > 0)
  max_level = 2;
 if (options.stage_power [ship_chosen] [1] [arena.difficulty] > 0 || options.stage_power_bar [ship_chosen] [1] [arena.difficulty] > 0)
  max_level = 3;

// if (key_wait <= 0 && holding_key == 0)
if (holding_key == 0)
 {

   if (key [player.key [CKEY_UP]] || menu_command(MC_UP))
   {
    ship_chosen --;
    if (ship_chosen < 0)
     ship_chosen = 4;
    holding_key = 1;
    key_wait = 7;
    level_chosen = 1;
   }

   if (key [player.key [CKEY_DOWN]] || menu_command(MC_DOWN))
   {
    ship_chosen ++;
    if (ship_chosen > 4)
     ship_chosen = 0;
    holding_key = 1;
    key_wait = 7;
    level_chosen = 1;
   }

   if (key [player.key [CKEY_LEFT]] || menu_command(MC_LEFT))
   {
    level_chosen --;
    if (level_chosen < 1)
     level_chosen = max_level;
    holding_key = 1;
    key_wait = 7;
   }

   if (key [player.key [CKEY_RIGHT]] || menu_command(MC_RIGHT))
   {
    level_chosen ++;
    if (level_chosen > max_level)
     level_chosen = 1;
    holding_key = 1;
    key_wait = 7;
   }


   if (key [player.key [CKEY_FIRE1]] || key [KEY_ENTER] || key [KEY_SPACE] || key [KEY_Z] || menu_command(MC_SELECT))
   {
     if (ship_chosen != 4 || options.unlock [arena.difficulty] == 1)
     {
       arena.level = level_chosen;
       return ship_chosen;
     }
   }

//  if (key [KEY_UP] || key [KEY_8_PAD])

/*  if (key [KEY_UP] || key [KEY_8_PAD])
  {
   menu_select --;
   if (menu_select < 0)
    menu_select = MENU_EXIT;
   if (menu_select == MENU_CALIBRATE && options.joystick == 0)
    menu_select = MENU_KEYS;
   if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
    menu_select = MENU_JOY_OR_KEYS - 1;
//   key_wait = 7;
   holding_key = 1;
  }
  if (key [KEY_DOWN] || key [KEY_2_PAD])
  {
   menu_select ++;
   if (menu_select > MENU_EXIT)
    menu_select = 0;
   if (menu_select == MENU_CALIBRATE && options.joystick == 0)
    menu_select = MENU_EXIT;
   if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
    menu_select = MENU_KEYS;
//   key_wait = 7;
    holding_key = 1;
  }*/
/*  if (key [KEY_LEFT] || key [KEY_4_PAD])
  {
//   if (menu_select == 2)
//    arena.starting_level = 1;
   key_wait = 7;
   holding_key = 1;
  }*/

  }
// }
  else
   key_wait --;




    do
    {
        thing ++;
    } while (ticked == 0);
    ticked = 0;

 if (arena.shift_palette > 0 && menu_counter % 12 == 0)
 {
  run_palette_shift();
  build_new_palette(0, 0, 0, 0);
  set_palette(palet);
  if (arena.shift_palette == 1)
   arena.shift_palette = 0;
 }

 vsync();
 blit(display, screen, 0, 0, 100, 0, 600, 600);



 };
Ejemplo n.º 8
0
void test_fire_allegro_rle(BITMAP *dst, int x, int y, int frame, int brightness)
{
    draw_rle_sprite(dst, fire_rle_sprites[frame % SPRITE_COUNT], x, y);
}
Ejemplo n.º 9
0
int Manual()
{
  int PVi, k;
        K= uatof(Gain);
  /* Things will be drawn more quickly if you always acquire the screen before
     trying to draw onto it. */
  acquire_screen();
  
  Graphics();	/* Call to graphics from a different function to avoid messy code */
  
  int dir = 1;   //since we are receiving data, direction should be 1
  int mode = IEEE1284_MODE_COMPAT; // parameter to set mode 'receive'
  RLE_SPRITE *rle;
  
  /* Set the direction for reception */
  ioctl(fd, PPDATADIR, &dir);
  ioctl(fd, PPWDATA, 0);
  
  PVi= 0;  k= 100;  M=0;
  while (!key[KEY_ESC])	/* Only pressing ESC can Exit */
    {
      M++;
      /* Check if user needs some help */
      if(key[KEY_F1])
	Help();

      k++;
      i= 897;
      
      Captura = create_sub_bitmap(screen, 72, 350, 898, 368);
      rle = get_rle_sprite(Captura);
      destroy_bitmap(Captura);
      draw_rle_sprite(screen, rle, 71, 350);
      destroy_rle_sprite(rle);
      
      /* This line reads data from the interfase which is
	 the process variable(measured variable) of the system */
      ioctl(fd, PPRDATA, &PVi);
      PV= PVi;
      
      if(PV<=40)
	{
	  PV= 51;
	  system("festival --tts Messages/Disconnected&");
	  blit(Disconnected, screen, 0, 0, 70, 290, 887, 52);   
	}
      
      if(PV<=48)
        PVi= 51;
      
      PV= 1.794117647*(PVi-51);
      SP= PV;
      
      if(key[KEY_RIGHT])
	{
          fd = close("/dev/parport0");	
	  Simulator();
        }
      if(key[KEY_PGUP])
	OP= (OP+46);
      
      if(key[KEY_PGDN])
	OP= (OP-46);
      
      if(key[KEY_UP])
	OP= (OP+3.66);
      
      if(key[KEY_DOWN])
	{
	  if(OP>=1)
	    OP= (OP-3.66);
	}
      
      if(key[KEY_PRTSCR])
	{
          Captura = create_sub_bitmap(screen, 0, 0, 1024, 768);
          save_bitmap("images/User/Captura.pcx", Captura, pal);
          destroy_bitmap(Captura);
        }
      
      Timer++;
      
      if(OP<=0)
	OP= 0;
      
      
      if (PV>=40)
	{
	  textprintf_ex(screen, font, 230, 297, BLACK, WHITE, "%3.1f", (PV/368)*100);	// Medición
	  textprintf_ex(screen, font, 450, 297, BLACK, WHITE, "%3.1f", (SP/368)*100);	// SP
	  textprintf_ex(screen, font, 710, 297, BLACK, WHITE, "%3.1f", (OP/368)*100);	// Controlador
	}
      
      if(k>=100)
	{
 	  k= 0;
	  vline(screen, 967, 351, 717, GRAY);
          blit(Clean, screen, 0, 0, 968, 350, 2, 368);
	}
      
      int Recorder;
      Recorder++;
      if(Recorder>=900)
	{
 	  Recorder= 0;
	  Captura = create_sub_bitmap(screen, 258, 350, 715, 368);
	}
      
      Captura = create_sub_bitmap(screen, 248, 350, 705, 368);
      
      
      if(PV>=362) PV= 365;
      if(OP>=367) OP= 365;
      
      if(PV<=0) PV= 0;
      if(OP<=0) OP= 0;
      
      /* Draw the behaviour of the PV, SP and OP over time */
      line(screen, 71+i, 717-PV, 71+i, 717-PVj, RED);	
      PVj= PV;    /* Flag for line y2 as a precedent state */
      line(screen, 71+i, 717-OP, 71+i, 717-OPj, BLUE);	
      OPj= OP;    /* Flag for line y2 as a precedent state */
      
      fprintf(outfile,"%i\t%f\t %f\t %f\n", M, ((PV/368)*100), ((SP/368)*100), ((OP/368)*100));
      rest(Delay);
    }
  int ScreenWide;
  RLE_SPRITE *rle0, *rle1;
  BITMAP *Screen3;

  Screen3 = load_bitmap("images/Close/Base.pcx", pal);
  system("mp3blaster /home/mentesuprema/Residencia/sounds/swing2.wav &");
  rest(5);

  rle0= get_rle_sprite(Screen2);
  rle1= get_rle_sprite(Screen3);
  
  for(ScreenWide=0;ScreenWide<=768;ScreenWide=ScreenWide+5)
    {
      draw_rle_sprite(screen, rle0, 0, 768);
      draw_rle_sprite(screen, rle1, 0, -768+ScreenWide);
    }

  destroy_rle_sprite(rle0);  
  destroy_rle_sprite(rle1);    
  destroy_bitmap(Screen2);
  destroy_bitmap(Screen3);
  destroy_bitmap(Clean);
  destroy_bitmap(Disconnected);
  release_screen();
  Close();
  exit(0);
} 
Ejemplo n.º 10
0
int Manual(int argc, unsigned char **argv)
{
  /* Serial port initialization */

  fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
  if (fd == -1) {
    perror("open_port: Unable to open /dev/ttyS0 - ");
    return 1;
  } else {
    fcntl(fd, F_SETFL, 0);
  }
  getbaud(fd);

  initport(fd);

  int PVi, k;
        K= uatof(Gain);
  /* Things will be drawn more quickly if you always acquire the screen before
     trying to draw onto it. */
  acquire_screen();
  
  Graphics();	/* Call to graphics from a different function to avoid messy code */
  
  RLE_SPRITE *rle;
 
            sCmd[0]= 'C';
            writeport(fd, sCmd);

  PVi= 0;  k= 100;  M=0;
  while (!key[KEY_ESC])	/* Only pressing ESC can Exit */
    {
	char ValveState;
	if(ValveState=='O')
	{
            sCmd[0]= 'A';
            writeport(fd, sCmd);
	}
	if(ValveState=='C')
	{
            sCmd[0]= 'C';
            writeport(fd, sCmd);
	}
	


      M++;
      /* Check if user needs some help */
      if(key[KEY_F1])
	Help();

      k++;
      i= 897;
      
      Captura = create_sub_bitmap(screen, 72, 350, 898, 368);
      rle = get_rle_sprite(Captura);
      destroy_bitmap(Captura);
      draw_rle_sprite(screen, rle, 71, 350);
      destroy_rle_sprite(rle);

      /* This line reads data from the interfase which is
	 the process variable(measured variable) of the system */
          fcntl(fd, F_SETFL, FNDELAY); // don't block serial read
	  readport(fd,sResult);
	  PVi= (int) *sResult;
	  PV= PVi;      
/*
      if(PVi<=40)
	{
	  PV= 51;
	  system("festival --tts Messages/Disconnected&");
	  blit(Disconnected, screen, 0, 0, 70, 290, 887, 52);   
	}
   */   
      if(PV<=48)
        PVi= 51;
      
      PV= 1.794117647*(PVi-51);
      SP= PV;
      
      if(key[KEY_RIGHT])
	{
          //fd = close("/dev/parport0");	
	  Simulator();
        }
      if(key[KEY_PGUP])
	OP= (OP+46);
      
      if(key[KEY_PGDN])
	OP= (OP-46);
      
      if(key[KEY_UP])
	{
	    OP=162; //(OP+3.66);
            sCmd[0]= 'A';
            writeport(fd, sCmd);
	    ValveState='O';
	}

      if(key[KEY_DOWN])
	{
	  if(OP>=1)
	    OP= 0;//(OP-3.66);
            sCmd[0]= 'C';
            writeport(fd, sCmd);
	    ValveState='C';
	}
      
      if(key[KEY_PRTSCR])
	{
          Captura = create_sub_bitmap(screen, 0, 0, 1024, 768);
          save_bitmap("images/User/Captura.pcx", Captura, pal);
          destroy_bitmap(Captura);
        }
      
      Timer++;
      
      if(OP<=0)
	OP= 0;
      
      
//      if (PV>=40)
//	{
	  textprintf_ex(screen, font, 230, 297, BLACK, WHITE, "%3.1f", (PV/368)*100);	// Medición
	  textprintf_ex(screen, font, 450, 297, BLACK, WHITE, "%3.1f", (SP/368)*100);	// SP
	  textprintf_ex(screen, font, 710, 297, BLACK, WHITE, "%3.1f", (OP/368)*100);	// Controlador
//	}
      
      if(k>=100)
	{
 	  k= 0;
	  vline(screen, 967, 351, 717, GRAY);
          blit(Clean, screen, 0, 0, 968, 350, 2, 368);
	}
      
      int Recorder;
      Recorder++;
      if(Recorder>=900)
	{
 	  Recorder= 0;
	  Captura = create_sub_bitmap(screen, 258, 350, 715, 368);
	}
      
      Captura = create_sub_bitmap(screen, 248, 350, 705, 368);
      
      
      if(PV>=362) PV= 365;
      if(OP>=367) OP= 365;
      
      if(PV<=0) PV= 0;
      if(OP<=0)
	 OP= 1;
/*
      OPi= fixtoi(itofix((OP*0.69234783)/255*100));
      sCmd[0]= (unsigned char)OPi+50;
      sCmd[0]= sCmd[0]+0.00;
      writeport(fd, sCmd);
*/
//     textprintf_ex(screen, font, 30, 297, BLACK, WHITE, "%i - %s - %3.1f", PVi, sResult, PV);	// Medición      

      /* Draw the behaviour of the PV, SP and OP over time */
      line(screen, 71+i, 717-PV, 71+i, 717-PVj, RED);	
      PVj= PV;    /* Flag for line y2 as a precedent state */
      line(screen, 71+i, 717-OP, 71+i, 717-OPj, BLUE);	
      OPj= OP;    /* Flag for line y2 as a precedent state */
      
      fprintf(outfile,"%i\t%f\t %f\t %f\n", M, ((PV/368)*100), ((SP/368)*100), ((OP/368)*100));
      rest(Delay);
    }
  int ScreenWide;
  RLE_SPRITE *rle0, *rle1;
  BITMAP *Screen3;

  Screen3 = load_bitmap("images/Close/Base.pcx", pal);
  system("mp3blaster /home/mentesuprema/Residencia/sounds/swing2.wav &");
  rest(5);

  rle0= get_rle_sprite(Screen2);
  rle1= get_rle_sprite(Screen3);
  
  for(ScreenWide=0;ScreenWide<=768;ScreenWide=ScreenWide+5)
    {
      draw_rle_sprite(screen, rle0, 0, 768);
      draw_rle_sprite(screen, rle1, 0, -768+ScreenWide);
    }

  destroy_rle_sprite(rle0);  
  destroy_rle_sprite(rle1);    
  destroy_bitmap(Screen2);
  destroy_bitmap(Screen3);
  destroy_bitmap(Clean);
  destroy_bitmap(Disconnected);
  release_screen();
  Close();
  exit(0);
} 
Ejemplo n.º 11
0
static int load_resource(char *datafile, char *name, ICON_DATA *icon)
{
   DATAFILE *data;
   BITMAP *temp, *bitmap = NULL;
   RLE_SPRITE *rle_sprite;
   PALETTE palette;
   int size, type, i;
   int result = 0;
   
   if (datafile[0] != '\0') {
      data = load_datafile_object(datafile, name);
      if (!data) {
         fprintf(stderr, "Error loading object '%s' from %s\n", name, datafile);
	 return -1;
      }
      switch (data->type) {
      
         case DAT_BITMAP:
	    temp = (BITMAP *)data->dat;
	    bitmap = create_bitmap_ex(temp->vtable->color_depth, temp->w, temp->h);
	    blit(temp, bitmap, 0, 0, 0, 0, temp->w, temp->h);
	    break;
	    
	 case DAT_RLE_SPRITE:
	    rle_sprite = (RLE_SPRITE *)data->dat;
	    bitmap = create_bitmap_ex(rle_sprite->color_depth, rle_sprite->w, rle_sprite->h);
	    clear_to_color(bitmap, bitmap->vtable->mask_color);
	    draw_rle_sprite(bitmap, rle_sprite, 0, 0);
	    break;
	    
	 case DAT_PALETTE:
	    select_palette((RGB *)data->dat);
	    unload_datafile_object(data);
	    return 0;
	 
	 default:
	    fprintf(stderr, "'%s' is not a BITMAP, RLE_SPRITE or PALETTE object in datafile '%s'\n", name, datafile);
	    unload_datafile_object(data);
	    return -1;
      }
      unload_datafile_object(data);
   }
   else {
      bitmap = load_bitmap(name, palette);
      select_palette(palette);
      if (!bitmap) {
         fprintf(stderr, "Unable to load '%s'\n", name);
	 return -1;
      }
   }
   
   if (!icon) {
      size = MAX(bitmap->w, bitmap->h);
      if (size <= 16)
         type = ICON_SMALL;
      else if (size <= 32)
         type = ICON_LARGE;
      else if (size <= 48)
         type = ICON_HUGE;
      else
         type = ICON_THUMBNAIL;
      icon = &icon_data[type];
      if (flags & icon->defined) {
         for (i = 0; i < 3; i++) {
	    type = (type + 1) % 4;
	    icon = &icon_data[type];
	    if (!(flags & icon->defined))
	       break;
	 }
	 if (flags & icon->defined) {
	    fprintf(stderr, "Too many icon resources!");
	    result = -1;
	    goto exit_error;
	 }
      }
   }
   else {
      if (icon->scaled) {
         fprintf(stderr, "Multiple icon resources of the same size");
	 result = -1;
	 goto exit_error;
      }
   }
   icon->original = create_bitmap_ex(bitmap->vtable->color_depth, bitmap->w, bitmap->h);
   blit(bitmap, icon->original, 0, 0, 0, 0, bitmap->w, bitmap->h);
   result = scale_icon(icon);
   flags |= icon->defined;
   
exit_error:
   destroy_bitmap(bitmap);
   
   return result;
}
Ejemplo n.º 12
0
void BASE_BACKGROUND::draw(BITMAP *onto, int x, int y, int layer)
{
   if (layer !=0)
     return;//only draw if layer =0
   draw_rle_sprite(onto, sprite, x  + xoffs, y + yoffs);
}
Ejemplo n.º 13
0
void rle_masked_image::sub_changed_hook(const zone* list)
{
  if (rle_image) draw_rle_sprite(get_sub_buffer(), rle_image, 0, 0);
}
Ejemplo n.º 14
0
/* worker function for changing the color depth of bitmap data */
static int do_changedepth(DATAFILE *dat, int *param, int depth)
{
   BITMAP *bmp, *bmp2;
   RLE_SPRITE *spr;
   RGB tmprgb = datedit_current_palette[0];

   if ((dat->type != DAT_BITMAP) && (dat->type != DAT_RLE_SPRITE) &&
       (dat->type != DAT_C_SPRITE) && (dat->type != DAT_XC_SPRITE)) {
      (*param)++;
      return D_O_K;
   }

   if (dat->type == DAT_RLE_SPRITE) {
      spr = (RLE_SPRITE *)dat->dat;
      if (spr->color_depth == depth)
	 return D_O_K;

      bmp = create_bitmap_ex(spr->color_depth, spr->w, spr->h);
      clear_to_color(bmp, bmp->vtable->mask_color);
      draw_rle_sprite(bmp, spr, 0, 0);
      bmp2 = create_bitmap_ex(depth, bmp->w, bmp->h);

      datedit_current_palette[0].r = 63;
      datedit_current_palette[0].g = 0;
      datedit_current_palette[0].b = 63;
      select_palette(datedit_current_palette);

      blit(bmp, bmp2, 0, 0, 0, 0, bmp->w, bmp->h);

      unselect_palette();
      datedit_current_palette[0] = tmprgb;

      dat->dat = get_rle_sprite(bmp2);
      destroy_bitmap(bmp);
      destroy_bitmap(bmp2);
      destroy_rle_sprite(spr);
   }
   else {
      bmp = (BITMAP *)dat->dat;
      if (bitmap_color_depth(bmp) == depth)
	 return D_O_K;
      bmp2 = create_bitmap_ex(depth, bmp->w, bmp->h);

      if ((dat->type == DAT_C_SPRITE) || (dat->type == DAT_XC_SPRITE)) {
	 datedit_current_palette[0].r = 63;
	 datedit_current_palette[0].g = 0;
	 datedit_current_palette[0].b = 63;
      }
      select_palette(datedit_current_palette);

      blit(bmp, bmp2, 0, 0, 0, 0, bmp->w, bmp->h);

      unselect_palette();
      datedit_current_palette[0] = tmprgb;

      dat->dat = bmp2;
      destroy_bitmap(bmp);
   }

   return D_REDRAW;
}
Ejemplo n.º 15
0
void startup_menu(void)
{


 reset_menu_palette();


 menu_select = 0;
 key_wait = 30;

// int counter;

 menu_counter = 0;
 counter2 = 0;

 arena.difficulty = 0;

 int y1 = 170;
 int y2 = 190 + menu_select * 30;
 int y3 = 218 + menu_select * 30;
 int y4 = 218 + menu_select * 30;

 int anykey = 0;

 int i;

//#define TEST_MUSIC


#ifdef TEST_MUSIC

 arena.level = 3;

 init_beat_new_level();

#endif

 init_menu_circles();

 while (TRUE)
 {


#ifdef TEST_MUSIC
run_beat();

#endif



 clear_to_color(display, COL_BACK1);


 run_menu_background();



 menu_counter += 4;
 if (menu_counter >= 40)
  menu_counter = 0;

 counter2 ++;
 if (counter2 >= 256)
  counter2 = 0;

// textprintf_centre_ex(display, font, 300, 190, -1, -1, "W H I T E   B U T T E R F L Y");
 draw_rle_sprite(display, white_RLE, 150, 150);

 int my = 300;

 y1 = my - 23;
 y2 = my - 10 + menu_select * 30;
 y3 = my + 19 + menu_select * 30;
 y4 = my + 150;


// rectfill(display, 370, y1, 600, y2, COL_COL1);
 TRANS_MODE
 rectfill(display, 370, y2 + 9, 640, y3 - 2, TRANS_BLUE3);
 rect(display, 368, y2 + 7, 641, y3 - 0, TRANS_BLUE3);
 END_TRANS
// rectfill(display, 370, y3, 600, y4, TRANS_DGREEN);


 textprintf_ex(display, font, 400, my, -1, -1, "START GAME");
 switch(arena.difficulty)
 {
      case 0: textprintf_ex(display, font, 400, my + 30, -1, -1, "DIFFICULTY - NORMAL"); break;
      case 1: textprintf_ex(display, font, 400, my + 30, -1, -1, "DIFFICULTY - HARD"); break;
      case 2: textprintf_ex(display, font, 400, my + 30, -1, -1, "DIFFICULTY - PUNISHMENT"); break;
 }
// textprintf_ex(display [2], font, 400, 260, -1, -1, "STAGE - %i", arena.starting_level);
 textprintf_ex(display, font, 400, my + 90, -1, -1, "SET  KEYS");
 textprintf_ex(display, font, 400, my + 120, -1, -1, "OPTIONS");
 textprintf_ex(display, font, 400, my + 150, -1, -1, "EXIT");

// textprintf_ex(display, font, 40, 10, -1, -1, "%i", joy[0].stick[options.joy_stick].axis[0].pos);
// textprintf_ex(display, font, 40, 30, -1, -1, "%i", joy[0].stick[options.joy_stick].axis[1].pos);

/*
 if (options.joystick)
  textprintf_ex(display, font, 400, my + 120, -1, -1, "CALIBRATE JOYSTICK");
   else
   {
    textprintf_ex(display, font, 400, my + 120, -1, -1, "NO JOYSTICK");
    drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
    rectfill(display, 399, my + 110, 530, my + 135, CONVERT_WHITE_TO_GREY);
    drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
   }
*/
 if (options.joystick)
 {
  if (options.key_or_joy == 1)
  textprintf_ex(display, font, 400, my + 60, -1, -1, "CONTROLS - JOYSTICK");
   else
    textprintf_ex(display, font, 400, my + 60, -1, -1, "CONTROLS - KEYBOARD");
 }
  else
  {
   textprintf_ex(display, font, 400, my + 60, -1, -1, "NO JOYSTICK");
   drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
   rectfill(display, 399, my + 50, 530, my + 75, CONVERT_WHITE_TO_GREY);
   drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);

  }


// textprintf_ex(display, font, 5, 5, -1, -1, "%i", any_joystick_input());



 my = 330;

 y2 = my + 7 + arena.just_got_highscore * 30;
 y3 = my + 29 + arena.just_got_highscore * 30;


 if (arena.just_got_highscore > 0)
 {
   rectfill(display, 0, y2 - 5, 250, y3, COL_COL3);
   rect(display, -1, y2 - 5 - 2, 250 + 2, y3 + 2, COL_COL4);
 }

// textprintf_right_ex(display, font, 137, my, -1, -1, "HIGH");
// textprintf_ex(display, font, 157, my, -1, -1, "SCORES");

 textprintf_centre_ex(display, font, 147, my, -1, -1, "HIGHSCORES");

 textprintf_right_ex(display, font, 137, my + 40, -1, -1, "NORMAL");
 textprintf_ex(display, font, 157, my + 40, -1, -1, "%i", options.highscore [0]);

 textprintf_right_ex(display, font, 137, my + 70, -1, -1, "HARD");
 textprintf_ex(display, font, 157, my + 70, -1, -1, "%i", options.highscore [1]);

 textprintf_right_ex(display, font, 137, my + 100, -1, -1, "PUNISHMENT");
 textprintf_ex(display, font, 157, my + 100, -1, -1, "%i", options.highscore [2]);

 textprintf_right_ex(display, font, 600, 570, -1, -1, "COPYRIGHT 2009 LINLEY HENZELL");

// should print last score here...

 anykey = 0;

  for (i = KEY_A; i < KEY_CAPSLOCK + 1; i ++)
  {
   if (key [i])
   {
    anykey = 1;
   }
  }

  if (anykey == 0 && (options.joystick == 0 || any_joystick_input() == 0))
   key_wait = 0;



 if (key_wait == 0)
 {
  if (menu_command(MC_UP))
  {
   menu_select --;
   if (menu_select < 0)
    menu_select = MENU_EXIT;
   if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
    menu_select = MENU_JOY_OR_KEYS - 1;
   key_wait = 7;
  }
  if (menu_command(MC_DOWN))
  {
   menu_select ++;
   if (menu_select > MENU_EXIT)
    menu_select = 0;
   if (menu_select == MENU_JOY_OR_KEYS && options.joystick == 0)
    menu_select = MENU_KEYS;
   key_wait = 7;
  }
  if (menu_command(MC_LEFT))
  {
//   if (menu_select == 2)
//    arena.starting_level = 1;
   if (menu_select == MENU_JOY_OR_KEYS)
   {
    if (options.key_or_joy == 0)
     options.key_or_joy = 1;
      else
       options.key_or_joy = 0;
   }
   if (menu_select == MENU_DIFFICULTY)
   {
    arena.difficulty --;
    if (arena.difficulty < 0)
     arena.difficulty = 0;
   }
   key_wait = 7;
  }
  if (menu_command(MC_RIGHT))
  {
//   if (menu_select == 2)
//    arena.starting_level = 2;
   if (menu_select == MENU_JOY_OR_KEYS)
   {
    if (options.key_or_joy == 0)
     options.key_or_joy = 1;
      else
       options.key_or_joy = 0;
   }
   if (menu_select == MENU_DIFFICULTY)
   {
    arena.difficulty ++;
    if (arena.difficulty > 2)
     arena.difficulty = 2;
   }
   key_wait = 7;
  }

//  if (key [KEY_ESC])
//   exit(0);
  if (menu_command(MC_SELECT))
  {
   if (menu_select == MENU_EXIT)
   {
    goodbye_menu_circles();
    return;
   }

   if (menu_select == MENU_KEYS)
   {
    key_wait = 10;
    define_keys();
    key_wait = 10;
   }

   if (menu_select == MENU_OPTIONS)
   {
    key_wait = 10;
    set_options();
    key_wait = 10;
   }

/*   if (menu_select == MENU_CALIBRATE)
   {
    jstick_calibrate();
    key_wait = 20;
    ticked = 0;
   }*/

   if (menu_select == MENU_START)
   {
    arena.level = 1;//arena.starting_level;
    ticked = 0;
    key_wait = 30;
    if (ship_select() == 1)
    {
     vsync();
//     clear_bitmap(screen);
//     clear_bitmap(display);
     player.type = PTYPE_BASIC;
//     player.type = PTYPE_BOMBER;
//     player.type = PTYPE_ANENOME;
//     player.type = PTYPE_HAND;
     player.weapon_level = 0;
     int ship_select = select_a_ship();
     if (ship_select != -1)
     {
      switch(ship_select)
      {
       default:
       case 0: player.type = PTYPE_BASIC; break;
       case 1: player.type = PTYPE_ANENOME; break;
       case 2: player.type = PTYPE_BOMBER; break;
       case 3: player.type = PTYPE_HAND; break;
       case 4: player.type = PTYPE_SQUID; break;
      }
      if (arena.level == 1)
       arena.from_start = 1;
        else
         arena.from_start = 0;
      arena.cleared = 0;
      arena.unlocked = 0;
      menu_counter = 0;
      goodbye_menu_circles();
      new_game();
      game_loop();
      if (arena.level == 4)
       congratulations();
      arena.target_palette = PAL_MENU;
      arena.shift_palette = 2;
      init_menu_circles();
//     reset_menu_palette();
      key_wait = 10; // was 1
//      flower_dir *= -1;
      ticked = 0;
     }
    }
     else key_wait = 20;
   }
    else
     key_wait = 20;
  }
 }
  else
   key_wait --;




    do
    {
        thing ++;
    } while (ticked == 0);
    ticked = 0;

 if (arena.shift_palette > 0 && menu_counter % 12 == 0)
 {
  run_palette_shift();
  build_new_palette(0, 0, 0, 0);
  set_palette(palet);
  if (arena.shift_palette == 1)
   arena.shift_palette = 0;
 }

 vsync();
 blit(display, screen, 0, 0, 100, 0, 600, 600);



 };


}
Ejemplo n.º 16
0
/* draw_compiled_sprite:
 *  Draws a compiled sprite onto the specified bitmap at the specified
 *  position.
 */
void draw_compiled_sprite(BITMAP *dst, AL_CONST COMPILED_SPRITE *src, int x, int y)
{
   ASSERT(dst);
   ASSERT(src);
   draw_rle_sprite(dst, (COMPILED_SPRITE *)src, x, y);
}
Ejemplo n.º 17
0
void render_player(int x,int y,short base,short eyes) {
    draw_rle_sprite(buffer,player_base[base],x,y);
    draw_rle_sprite(buffer,player_eyes[eyes],x,y);
}