예제 #1
0
파일: lviv.cpp 프로젝트: MASHinfo/mame
void lviv_state::setup_snapshot(uint8_t * data)
{
	/* Set registers */
	uint8_t lo = data[0x14112] & 0x0ff;
	uint8_t hi = data[0x14111] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_BC, (hi << 8) | lo);
	lo = data[0x14114] & 0x0ff;
	hi = data[0x14113] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_DE, (hi << 8) | lo);
	lo = data[0x14116] & 0x0ff;
	hi = data[0x14115] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_HL, (hi << 8) | lo);
	lo = data[0x14118] & 0x0ff;
	hi = data[0x14117] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_AF, (hi << 8) | lo);
	lo = data[0x14119] & 0x0ff;
	hi = data[0x1411a] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_SP, (hi << 8) | lo);
	lo = data[0x1411b] & 0x0ff;
	hi = data[0x1411c] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_PC, (hi << 8) | lo);

	/* Memory dump */
	memcpy (m_ram->pointer(), data+0x0011, 0xc000);
	memcpy (m_ram->pointer()+0xc000, data+0x10011, 0x4000);

	/* Ports */
	m_ppi_port_outputs[0][0] = data[0x14011+0xc0];
	m_ppi_port_outputs[0][1] = data[0x14011+0xc1];
	update_palette(m_ppi_port_outputs[0][1]&0x7f);
	m_ppi_port_outputs[0][2] = data[0x14011+0xc2];
	update_memory();
}
예제 #2
0
파일: video.cpp 프로젝트: xobs/chumby-mame
/* Update the display. */
void osd_update_display(void)
{
#if defined(GP2X) || defined(PSP)
	/* Update Timing */
	update_timing();
#endif

#ifdef PSP
	/* Wait VSync */
	if (gp2x_vsync==1)
		gp2x_video_wait_vsync();
#endif
	/* Manage the palette */
	if (dirtypalette)
		update_palette();

	/* Update Display */
	p_update_display();

#ifdef GP2X
	/* Show FPS Counter */
	if (gp2x_showfps)
		frame_counter(); 
#endif
	
#ifdef GP2X
	/* Double Buffer Video Flip */
	if (gp2x_double_buffer)
		gp2x_video_flip();
#endif
}
예제 #3
0
파일: gun.c 프로젝트: albinoz/raine
void disp_gun(int nb, int x,int y) {
  // nb is 0 for player 1 and 1 for player 2
  if (old_bpp != display_cfg.bpp) {
    sprite_gun[0] = SpriteGun1;
    sprite_gun[1] = SpriteGun2;

    if (display_cfg.bpp == 16 || display_cfg.bpp == 15) {
      int n;
      update_palette();
      for (n=252; n<=254; n++) {
	UINT16 res;
	GET_PEN_FOR_COLOUR_16(
			      pal[n].r,
			      pal[n].g,
			      pal[n].b,
			      res);
	WriteWord(&map[n*2],res);
      }
    }
    old_bpp = display_cfg.bpp;
  } else if (display_cfg.bpp == 32) {
      int n;
      update_palette();
      for (n=252; n<=254; n++) {
	UINT32 res;
	GET_PEN_FOR_COLOUR_32(
			      pal[n].r,
			      pal[n].g,
			      pal[n].b,
			      res);
	WriteLong(&map[n*4],res);
      }
    }
    old_bpp = display_cfg.bpp;

  switch(display_cfg.bpp) {
  case 8:  Draw16x16_Trans_8(sprite_gun[nb],x,y,0); update_palette(); break;
  case 15:
  case 16: Draw16x16_Trans_Mapped_16(sprite_gun[nb],x,y,map); break;
  case 32: Draw16x16_Trans_Mapped_32(sprite_gun[nb],x,y,map); break;
  }
}
예제 #4
0
파일: main.c 프로젝트: moon-watcher/daytrip
void secret(void) {
 int i;
 GET_Z80BUS;
 h_hook = no_routine;
 v_hook = no_routine;
 fade_to = -8;
 brightness = -8;
 update_palette();
 init_secret();
 for(i=0;i<0xff;i++) {
  FM1_WRITE(i,0);
  FM2_WRITE(i,0);
 }
 for(;;) {
  SYNC;
  update_palette();

  tick_secret();

 }
}
예제 #5
0
파일: gal3.c 프로젝트: esn3s/mame-rr
static SCREEN_UPDATE(gal3)
{
	gal3_state *state = screen->machine().driver_data<gal3_state>();
	int i;
	char mst[18], slv[18];
	static int pivot = 15;
	int pri;

	update_palette(screen->machine());

	if( screen->machine().input().code_pressed_once(KEYCODE_H)&&(pivot<15) )	pivot+=1;
	if( screen->machine().input().code_pressed_once(KEYCODE_J)&&(pivot>0) )	pivot-=1;

	for( pri=0; pri<pivot; pri++ )
	{
		namco_obj_draw(screen->machine(), bitmap, cliprect, pri );
	}

/*  CopyVisiblePolyFrameBuffer( bitmap, cliprect,0,0x7fbf );

    for( pri=pivot; pri<15; pri++ )
    {
        namco_obj_draw(screen->machine(), bitmap, cliprect, pri );
    }*/

	// CPU Diag LEDs
	mst[17]='\0', slv[17]='\0';
/// printf("mst=0x%x\tslv=0x%x\n", state->m_led_mst, state->m_led_slv);
	for(i=16;i<32;i++)
	{
		int t;
		if(i<24)
			t=i;
		else
			t=i+1;
		mst[8]=' '; slv[8]=' ';

		if(state->m_led_mst&(1<<i))
			mst[t-16]='*';
		else
			mst[t-16]='O';

		if(state->m_led_slv&(1<<i))
			slv[t-16]='*';
		else
			slv[t-16]='O';
	}

	popmessage("LED_MST:  %s\nLED_SLV:  %s\n2D Layer: 0-%d (Press H for +, J for -)\n", mst, slv, pivot);

	return 0;
}
예제 #6
0
파일: gal3.cpp 프로젝트: qwijibo/mame
uint32_t gal3_state::screen_update_gal3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	int i;
	char mst[18], slv[18];
	static int pivot = 15;
	int pri;

	update_palette();

	if( machine().input().code_pressed_once(KEYCODE_H)&&(pivot<15) )    pivot+=1;
	if( machine().input().code_pressed_once(KEYCODE_J)&&(pivot>0) ) pivot-=1;

	for( pri=0; pri<pivot; pri++ )
	{
		c355_obj_draw(screen, bitmap, cliprect, pri);
	}

/*  CopyVisiblePolyFrameBuffer( bitmap, cliprect,0,0x7fbf );

    for( pri=pivot; pri<15; pri++ )
    {
        c355_obj_draw(screen, bitmap, cliprect, pri);
    }*/

	// CPU Diag LEDs
	mst[17]='\0', slv[17]='\0';
/// printf("mst=0x%x\tslv=0x%x\n", m_led_mst, m_led_slv);
	for(i=16;i<32;i++)
	{
		int t;
		if(i<24)
			t=i;
		else
			t=i+1;
		mst[8]=' '; slv[8]=' ';

		if(m_led_mst&(1<<i))
			mst[t-16]='*';
		else
			mst[t-16]='O';

		if(m_led_slv&(1<<i))
			slv[t-16]='*';
		else
			slv[t-16]='O';
	}

	popmessage("LED_MST:  %s\nLED_SLV:  %s\n2D Layer: 0-%d (Press H for +, J for -)\n", mst, slv, pivot);

	return 0;
}
예제 #7
0
파일: crtc.cpp 프로젝트: meesokim/fc-100
void CRTC::initialize()
{
	// init vram
	memset(vram, 0, sizeof(vram));
	
	// init bit control
	shift = 0;
	maskl = maskh = busl = bush = 0;
	
	// init vram plane
	write_plane = 1;
	read_plane = 0;
	
	// init pallete
	for(int i = 1; i < 16; i++) {
		palette[i] = 0x1ff;
		update_palette(i);
	}
	palette[0] = 0;
	update_palette(0);
	
	// register event
	register_vline_event(this);
}
예제 #8
0
void offtwall_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
	/* remap if necessary */
	if (update_palette())
		memset(atarigen_pf_dirty, 0xff, atarigen_playfieldram_size / 4);

	/* update playfield */
	atarigen_pf_process(pf_render_callback, bitmap, &Machine->visible_area);

	/* render the motion objects */
	atarigen_mo_process(mo_render_callback, bitmap);

	/* update onscreen messages */
	atarigen_update_messages();
}
예제 #9
0
파일: relief.c 프로젝트: cdrr/MAME_hack
void relief_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
	int i;
	
#if DEBUG_VIDEO
	debug();
#endif

	/* update the palette */
	if (update_palette())
	{
		memset(atarigen_pf_dirty, 1, atarigen_playfieldram_size / 2);
		memset(atarigen_pf2_dirty, 1, atarigen_playfield2ram_size / 2);
	}

	/* set up the all-transparent overrender palette */
	for (i = 0; i < 16; i++)
		atarigen_overrender_colortable[i] = palette_transparent_pen;

	/* render the playfield */
	memset(atarigen_pf_visit, 0, 64*64);
#if DEBUG_VIDEO
	if (show_colors == 2)
		osd_clearbitmap(bitmap);
	else
#endif
	atarigen_pf_process(pf_render_callback, bitmap, &Machine->drv->visible_area);

	/* render the playfield */
	memset(atarigen_pf2_visit, 0, 64*64);
#if DEBUG_VIDEO
	if (show_colors != 1)
#endif
	atarigen_pf2_process(pf2_render_callback, bitmap, &Machine->drv->visible_area);

	/* render the motion objects */
	atarigen_mo_process(mo_render_callback, bitmap);

	/* update onscreen messages */
	atarigen_update_messages();
}
예제 #10
0
void xybots_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh)
{
    int i;

    /* update the palette */
    if (update_palette())
        memset(atarigen_pf_dirty, 1, atarigen_playfieldram_size / 2);

    /* set up the all-transparent overrender palette */
    for (i = 0; i < 16; i++)
        atarigen_overrender_colortable[i] = palette_transparent_pen;

    /* render the playfield */
    atarigen_pf_process(pf_render_callback, bitmap, &Machine->visible_area);

    /* render the motion objects */
    atarigen_mo_process(mo_render_callback, bitmap);

    /* redraw the alpha layer completely */
    {
        const struct GfxElement *gfx = Machine->gfx[2];
        int sx, sy, offs;

        for (sy = 0; sy < YCHARS; sy++)
            for (sx = 0, offs = sy * 64; sx < XCHARS; sx++, offs++)
            {
                int data = READ_WORD(&atarigen_alpharam[offs * 2]);
                int code = data & 0x3ff;
                int opaque = data & 0x8000;

                if (code || opaque)
                {
                    int color = (data >> 12) & 7;

                    drawgfx(bitmap, gfx, code, color, 0, 0, 8 * sx, 8 * sy, 0,
                            opaque ? TRANSPARENCY_NONE : TRANSPARENCY_PEN, 0);
                }
            }
    }
예제 #11
0
/* Update video */
void osd_update_video(void)
{
    /* Wait for VSync */
    if(option.vsync) vsync();

    /* Update the palette */
    if(option.video_depth == 8) update_palette();

    /* Use the blur effect */
    if(option.blur)
    {
        blur((uint16 *)&sms_bmp->line[bitmap.viewport.y][bitmap.viewport.x * bitmap.granularity],
                bitmap.viewport.w, bitmap.viewport.h, 
                (bitmap.width-bitmap.viewport.w) * bitmap.granularity
                );
    }

    if(option.fps) msg_print(2, 2, "%d", frame_rate);
    if(msg_enable)  msg_print(4, bitmap.viewport.h - 12, "%s", msg);

    blitter_proc(sms_bmp, screen);
}
예제 #12
0
파일: namcos21.c 프로젝트: antervud/MAMEHub
UINT32 namcos21_state::screen_update_namcos21(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	UINT8 *videoram = m_videoram;
	int pivot = 3;
	int pri;
	update_palette(machine());
	bitmap.fill(0xff, cliprect );

	if( m_gametype != NAMCOS21_WINRUN91 )
	{ /* draw low priority 2d sprites */
		c355_obj_draw(screen, bitmap, cliprect, 2 );
		c355_obj_draw(screen, bitmap, cliprect, 14 );   //driver's eyes
	}

	CopyVisiblePolyFrameBuffer( machine(), bitmap, cliprect, 0x7fc0, 0x7ffe );

	if( m_gametype != NAMCOS21_WINRUN91 )
	{ /* draw low priority 2d sprites */
		c355_obj_draw(screen, bitmap, cliprect, 0 );
		c355_obj_draw(screen, bitmap, cliprect, 1 );
	}

	CopyVisiblePolyFrameBuffer( machine(), bitmap, cliprect, 0, 0x7fbf );


	if( m_gametype != NAMCOS21_WINRUN91 )
	{ /* draw high priority 2d sprites */
		for( pri=pivot; pri<8; pri++ )
		{
			c355_obj_draw(screen, bitmap, cliprect, pri );
		}
			c355_obj_draw(screen, bitmap, cliprect, 15 );   //driver's eyes
	}
	else
	{ /* winrun bitmap layer */
		int yscroll = -cliprect.min_y+(INT16)m_winrun_gpu_register[0x2/2];
		int base = 0x1000+0x100*(m_winrun_color&0xf);
		int sx,sy;
		for( sy=cliprect.min_y; sy<=cliprect.max_y; sy++ )
		{
			const UINT8 *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200];
			UINT16 *pDest = &bitmap.pix16(sy);
			for( sx=cliprect.min_x; sx<=cliprect.max_x; sx++ )
			{
				int pen = pSource[sx];
				switch( pen )
				{
				case 0xff:
					break;
				case 0x00:
					pDest[sx] = (pDest[sx]&0x1fff)+0x4000;
					break;
				case 0x01:
					pDest[sx] = (pDest[sx]&0x1fff)+0x6000;
					break;
				default:
					pDest[sx] = base|pen;
					break;
				}
			}
		}
	} /* winrun bitmap layer */
	return 0;
}
예제 #13
0
파일: main.c 프로젝트: moon-watcher/daytrip
int main(void) {
 v = no_routine;
 v_hook = no_routine;
 h_hook = no_routine;
 pal_mutex = 0;

 VDP_SET_REGISTER(MODE_SET_1, 0x16);
 VDP_SET_REGISTER(NAME_TABLE_SCROLLA_BASE, SCROLL_A_ADDR(0xc000));
 VDP_SET_REGISTER(NAME_TABLE_WINDOW_BASE,  SCROLL_A_ADDR(0x10000));
 VDP_SET_REGISTER(NAME_TABLE_SCROLLB_BASE, SCROLL_B_ADDR(0xe000));
 VDP_SET_REGISTER(SPRITE_ATTRIBUTE_BASE,   SPRITE_ADDR(SPRITE_BASE));
 VDP_SET_REGISTER(0x06, 0x00);
 VDP_SET_REGISTER(BACKGROUND_COLOR, 0x00);
 VDP_SET_REGISTER(0x08, 0x01);
 VDP_SET_REGISTER(0x09, 0x01);
 VDP_SET_REGISTER(H_COUNTER, 1);
 VDP_SET_REGISTER(MODE_SET_3, HORIZONTAL_LINE);
 VDP_SET_REGISTER(MODE_SET_4, CELLW_40);
 VDP_SET_REGISTER(HSCROLL_BASE, HSCROLL_ADDR( 0xfc00));
 VDP_SET_REGISTER(0x0e, 0x00);
 VDP_SET_INC(0x02);
 VDP_SET_REGISTER(SCROLL_SIZE, SCROLL_WIDTH_64);
 VDP_SET_REGISTER(WINDOW_X, 0x00);
 VDP_SET_REGISTER(WINDOW_Y, 0x00);
 VDP_SET_REGISTER(19, 0x00);
 VDP_SET_REGISTER(20, 0x00);
 VDP_SET_REGISTER(21, 0x00);
 VDP_SET_REGISTER(22, 0x00);

 z80_write(0,z80_prog, Z80_PROG_LEN);
 z80_reset();

 brightness = -8;
 fade_to = -8;
 updating_palette = 0;
 dma_corrupt = 0; 

 secret_pos = 0;
 lcontroller = 0;
 song_pos = 0;
 song_ticks = 0;

 VDP_SET_REGISTER(MODE_SET_2, 0x74);

 proc[0]();//  init_sega();
 for(;;) {
  SYNC;
  update_palette();
  
  if(song_ticks == 0)  {
   h_hook = no_routine;
   v_hook = no_routine;
   fade_to = -8;
   brightness = -8;
   update_palette();
   proc[song_pos*2]();
   song_ticks = 0;
  }

  update_vgm_pos();
  
  proc[(song_pos*2)+1](); 

  song_ticks++;
  if(vgm_pos>=scenes[song_pos]) {
   song_pos++;
   song_ticks = 0;
  }


  lcontroller = controller;
  controller = poll_ctrl1();
  if((controller != lcontroller) && (controller != 0)) {
   if(secret_msg[secret_pos] == controller) 
    secret_pos++;
   else
    secret_pos = 0;
   if(secret_pos == 4) secret();
  } 
 }

}
예제 #14
0
int32 startgame()
{
	int32 end;
	int32 c, mc;
	int32 bx=192, by=88, h=300;
	int32 y;
	int32 upd=1;
	int32 mx, my;
	int32 cn=0;
	int32 ti, ot;
	t_ik_image *bg;
	char name[32];

	loadconfig();

	start_ik_timer(1, 31);
	while (get_ik_timer(1) < 2 && !must_quit)
	{
		ik_eventhandler();
	}
	Play_Sound(WAV_MUS_TITLE, 15, 1, 100, 22050,-1000);
	while (get_ik_timer(1) < 4 && !must_quit)
	{
		ik_eventhandler();
	}
	Play_Sound(WAV_MUS_TITLE, 14, 1, 80, 22050, 1000);


	if (settings.random_names & 1)
		strcpy(settings.captname, captnames[rand()%num_captnames]);

	if (settings.random_names & 2)
		strcpy(settings.shipname, shipnames[rand()%num_shipnames]);

	bg = ik_load_pcx("graphics/starback.pcx", NULL);

	end = 0; ti = get_ik_timer(2);
	while (!end && !must_quit)
	{
		ik_eventhandler();
		c = ik_inkey();
		mc = ik_mclick();
		mx = ik_mouse_x - bx; 
		my = ik_mouse_y - by;

		ot = ti;
		ti = get_ik_timer(2);
		if (ti != ot)
		{
			prep_screen();
			ik_blit();
		}

		if (c==13 || c==32)
			end = 2;
		if ((mc & 1) && mx > 0 && mx < 240)
		{
			if (my > h-24 && my < h-8) // buttons
			{
				if (mx > 16 && mx < 64) // cancel
					end = 1;
				else if (mx > 176 && mx < 224) // ok
				{	end = 2; Play_SoundFX(WAV_DOT); }
			}
			else if (my > 32 && my < 40) // captain
			{
				if (mx < 216)
				{
					cn |= 1;
					prep_screen();
					ik_drawbox(screen, bx+70, by+32, bx+215, by+39, STARMAP_INTERFACE_COLOR*16+3);
					ik_blit();
					strcpy(name, settings.captname);
					ik_text_input(bx+70, by+32, 14, font_6x8, "", name, STARMAP_INTERFACE_COLOR*16+3, STARMAP_INTERFACE_COLOR);
					if (strlen(name)>0)
						strcpy(settings.captname, name);
				}
				else
				{
					settings.random_names ^= 1;
					Play_SoundFX(WAV_LOCK,0);
				}
				upd = 1;must_quit=0;
			}
			else if (my > 40 && my < 48) // ship
			{
				if (mx < 216)
				{
					cn |= 2;
					prep_screen();
					ik_drawbox(screen, bx+70, by+40, bx+215, by+47, STARMAP_INTERFACE_COLOR*16+3);
					ik_blit();
					strcpy(name, settings.shipname);
					ik_text_input(bx+70, by+40, 14, font_6x8, "", name, STARMAP_INTERFACE_COLOR*16+3, STARMAP_INTERFACE_COLOR);
					if (strlen(name)>0)
						strcpy(settings.shipname, name);
				}
				else
				{
					settings.random_names ^= 2;
					Play_SoundFX(WAV_LOCK,0);
				}
				upd = 1;must_quit=0;
			}
			else if (my > 64 && my < 96)	// ship
			{
				settings.dif_ship = (mx - 16)/72;
				Play_SoundFX(WAV_SLIDER,0);
				upd = 1; 
			}
			else if (my > 112 && my < 176) // nebula
			{
				settings.dif_nebula = (mx - 16)/72;
				Play_SoundFX(WAV_SLIDER,0);
				upd = 1; 
			}
			else if (my > 192 && my < 224) // enemies
			{
				settings.dif_enemies = (mx - 16)/72;
				Play_SoundFX(WAV_SLIDER,0);
				upd = 1; 
			}
			else if (my > 232 && my < 240)	// easy/hard
			{
				c = (mx-40)/32; 
				if (c < 0) c=0;
				if (c > 4) c=4;
				settings.dif_nebula = (c+1)/2;
				settings.dif_enemies = c/2;
				upd = 1;
				Play_SoundFX(WAV_SLIDER,0);
			}
			else if (my > 256 && my < 264)	// enable tutorial
			{
				if (mx > 16 && mx < 24)
				{
					settings.random_names ^= 4;
					Play_SoundFX(WAV_LOCK,0);
					upd = 1;
				}
			}
		}
		if (upd)
		{
			upd = 0;
			prep_screen();
			ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

			y = by+16;
			interface_drawborder(screen, bx, by, bx+240, by+h, 1, STARMAP_INTERFACE_COLOR, "Start new adventure");
			ik_print(screen, font_6x8, bx+16, y+=8, 0, textstring[STR_STARTGAME_IDENTIFY]);
			ik_print(screen, font_6x8, bx+16, y+=8, 0, textstring[STR_STARTGAME_CAPTAIN]);
			ik_print(screen, font_6x8, bx+70, y, 3, settings.captname);
			if (!(cn&1))
				ik_print(screen, font_4x8, bx+216-strlen(textstring[STR_STARTGAME_RENAME])*4, y, 3, textstring[STR_STARTGAME_RENAME]);
			ik_dsprite(screen, bx+216, y, spr_IFslider->spr[8+(settings.random_names&1)], 2+((3-3*(settings.random_names&1))<<8));

			ik_print(screen, font_6x8, bx+16, y+=8, 0, textstring[STR_STARTGAME_STARSHIP]);
			ik_print(screen, font_6x8, bx+70, y, 3, settings.shipname);
			if (!(cn&2))
				ik_print(screen, font_4x8, bx+216-strlen(textstring[STR_STARTGAME_RENAME])*4, y, 3, textstring[STR_STARTGAME_RENAME]);
			ik_dsprite(screen, bx+216, y, spr_IFslider->spr[8+(settings.random_names&2)/2], 2+((3-3*(settings.random_names&2)/2)<<8));

			ik_print(screen, font_6x8, bx+16, y+=16, 0, textstring[STR_STARTGAME_LOADOUT], textstring[STR_STARTGAME_LOADOUT1+settings.dif_ship]);
			y += 8;
			for (c = 0; c < 3; c++)
			{
				ik_dsprite(screen, bx+16+c*72, y, spr_IFdifenemy->spr[c+3], 0);
				ik_dsprite(screen, bx+16+c*72, y, spr_IFborder->spr[20], 2+(3<<8)*(c==settings.dif_ship));
			}

			ik_print(screen, font_6x8, bx+16, y+=40, 0, textstring[STR_STARTGAME_NEBULA]);
			y += 8;
			for (c = 0; c < 3; c++)
			{
				ik_dsprite(screen, bx+16+c*72, y, spr_IFdifnebula->spr[c], 0);
				ik_dsprite(screen, bx+16+c*72, y, spr_IFborder->spr[18], 2+(3<<8)*(c==settings.dif_nebula));
			}

			ik_print(screen, font_6x8, bx+16, y+=72, 0, textstring[STR_STARTGAME_ENEMIES]);
			y += 8;
			for (c = 0; c < 3; c++)
			{
				ik_dsprite(screen, bx+16+c*72, y, spr_IFdifenemy->spr[c], 0);
				ik_dsprite(screen, bx+16+c*72, y, spr_IFborder->spr[20], 2+(3<<8)*(c==settings.dif_enemies));
			}

			y+=40;
			ik_print(screen, font_6x8, bx+16, y, 0, textstring[STR_STARTGAME_EASY]);
			ik_print(screen, font_6x8, bx+224-6*strlen(textstring[STR_STARTGAME_HARD]), y, 0, textstring[STR_STARTGAME_HARD]);
			ik_print(screen, font_6x8, bx+16, y+12, 0, textstring[STR_STARTGAME_LOSCORE]);
			ik_print(screen, font_6x8, bx+224-6*strlen(textstring[STR_STARTGAME_HISCORE]), y+12, 0, textstring[STR_STARTGAME_HISCORE]);
			interface_drawslider(screen, bx+56, y, 0, 128, 4, settings.dif_enemies+settings.dif_nebula, STARMAP_INTERFACE_COLOR);

			y+=24;
			ik_dsprite(screen, bx+12, y-5, spr_IFbutton->spr[(settings.random_names&4)>0], 0);
			ik_print(screen, font_6x8, bx+32, y, 0, "TUTORIAL MODE");


			interface_drawbutton(screen, bx+16, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_CANCEL]);
			interface_drawbutton(screen, bx+240-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);

			ik_blit();
			update_palette();
		}
	}

	interface_cleartuts();

	if (must_quit)
		end = 1;

	if (settings.opt_mucrontext & 1)
	{


	if (end > 1)
	{
		bx = 192; by = 72; h = 328;
		by = 220 - h/2;

		prep_screen();
		ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

		y = 3;
		interface_drawborder(screen, bx, by, bx+256, by+h, 1, STARMAP_INTERFACE_COLOR, textstring[STR_STARTGAME_TITLE1]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+84, by+y*8, 160, 88, 0, 
								textstring[STR_STARTGAME_MUCRON1]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON2]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON3]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON4]);
		interface_drawbutton(screen, bx+256-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);
		ik_dsprite(screen, bx+16, by+24, spr_SMraces->spr[race_unknown], 0);
		ik_dsprite(screen, bx+16, by+24, spr_IFborder->spr[18], 2+(STARMAP_INTERFACE_COLOR<<8));

		ik_blit();
		update_palette();
		end = waitclick(bx+256-64, by+h-24, bx+256-16, by+h-8);
	}

	if (end > 1)
	{
		bx = 192; by = 96; h = 168;
		by = 220 - h/2;

		prep_screen();
		ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

		y = 3;
		interface_drawborder(screen, bx, by, bx+256, by+h, 1, STARMAP_INTERFACE_COLOR, textstring[STR_STARTGAME_TITLE2]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+84, by+y*8, 160, 88, 0, 
								textstring[STR_STARTGAME_MUCRON5]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON6]);
		interface_drawbutton(screen, bx+256-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);
		ik_dsprite(screen, bx+16, by+24, spr_IFdifnebula->spr[1], 0);
		ik_dsprite(screen, bx+16, by+24, hulls[shiptypes[0].hull].sprite, 0);
		ik_dsprite(screen, bx+16, by+24, spr_IFborder->spr[18], 2+(STARMAP_INTERFACE_COLOR<<8));

		ik_blit();
		update_palette();
		end = waitclick(bx+256-64, by+h-24, bx+256-16, by+h-8);
	}



	if (end > 1)
	{
		bx = 192; by = 120; h = 112;
		by = 220 - h/2;

		prep_screen();
		ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

		y = 3;
		interface_drawborder(screen, bx, by, bx+256, by+h, 1, STARMAP_INTERFACE_COLOR, textstring[STR_STARTGAME_TITLE3]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+84, by+y*8, 160, 88, 0, 
								textstring[STR_STARTGAME_MUCRON7]);
		interface_drawbutton(screen, bx+256-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);
		ik_dsprite(screen, bx+16, by+24, spr_SMraces->spr[RC_PLANET], 4);
		ik_dsprite(screen, bx+16, by+24, spr_IFborder->spr[18], 2+(STARMAP_INTERFACE_COLOR<<8));

		ik_blit();
		update_palette();
		end = waitclick(bx+256-64, by+h-24, bx+256-16, by+h-8);
	}

	}

	del_image(bg);

	if (end > 1)
	{
		starmap_create();
		player_init();
	}

	saveconfig();
	
	return end-1;
}
예제 #15
0
int main ( int argc, char **argv )
{
	Q_INIT_RESOURCE(qtractor);
#ifdef CONFIG_STACKTRACE
#if defined(__GNUC__) && defined(Q_OS_LINUX)
	signal(SIGILL,  stacktrace);
	signal(SIGFPE,  stacktrace);
	signal(SIGSEGV, stacktrace);
	signal(SIGABRT, stacktrace);
	signal(SIGBUS,  stacktrace);
#endif
#endif
	qtractorApplication app(argc, argv);

	// Construct default settings; override with command line arguments.
	qtractorOptions options;
	if (!options.parse_args(app.arguments())) {
		app.quit();
		return 1;
	}

	// Have another instance running?
	if (app.setup()) {
		app.quit();
		return 2;
	}

#if QT_VERSION >= 0x050100
#ifdef CONFIG_LV2_UI_GTK2
	// Initialize GTK+ framework (LV2 plug-in UI GTK2 support)...
	gtk_init(NULL, NULL);
#endif	// CONFIG_LV2_UI_GTK2
#endif

	// Special style paths...
	if (QDir(CONFIG_PLUGINSDIR).exists())
		app.addLibraryPath(CONFIG_PLUGINSDIR);

	// Custom style theme...
	if (!options.sCustomStyleTheme.isEmpty())
		app.setStyle(QStyleFactory::create(options.sCustomStyleTheme));

	// Custom color theme (eg. "KXStudio")...
	QPalette pal(app.palette());
	unsigned int iUpdatePalette = 0;
	if (update_palette(pal, options.sCustomColorTheme))
		++iUpdatePalette;
	// Dark themes grayed/disabled color group fix...
	if (pal.base().color().value() < 0x7f) {
		const QColor& color = pal.window().color();
		const int iGroups = int(QPalette::Active | QPalette::Inactive) + 1;
		for (int i = 0; i < iGroups; ++i) {
			const QPalette::ColorGroup group = QPalette::ColorGroup(i);
			pal.setBrush(group, QPalette::Light,    color.lighter(140));
			pal.setBrush(group, QPalette::Midlight, color.lighter(100));
			pal.setBrush(group, QPalette::Mid,      color.lighter(90));
			pal.setBrush(group, QPalette::Dark,     color.darker(160));
			pal.setBrush(group, QPalette::Shadow,   color.darker(180));
		}
		pal.setColorGroup(QPalette::Disabled,
			pal.windowText().color().darker(),
			pal.button(),
			pal.light(),
			pal.dark(),
			pal.mid(),
			pal.text().color().darker(),
			pal.text().color().lighter(),
			pal.base(),
			pal.window());
	#if QT_VERSION >= 0x050000
		pal.setColor(QPalette::Disabled,
			QPalette::Highlight, pal.mid().color());
		pal.setColor(QPalette::Disabled,
			QPalette::ButtonText, pal.mid().color());
	#endif
		++iUpdatePalette;
	}
	// New palette update?
	if (iUpdatePalette > 0)
		app.setPalette(pal);

	// Set default base font...
	if (options.iBaseFontSize > 0)
		app.setFont(QFont(app.font().family(), options.iBaseFontSize));

	// Construct, setup and show the main form (a pseudo-singleton).
	qtractorMainForm w;
	w.setup(&options);
	w.show();

	// Settle this one as application main widget...
	app.setMainWidget(&w);

	return app.exec();
}