📄 stactics.c
字号:
void stactics_shot_flag_clear_w(int offset, int data)
{
stactics_shot_arrive = 0;
}
void stactics_videoram_b_w(int offset,int data)
{
if (stactics_videoram_b[offset] != data)
{
stactics_videoram_b[offset] = data;
dirty_videoram_b[offset] = 1;
}
}
void stactics_chardata_b_w(int offset,int data)
{
if (stactics_chardata_b[offset] != data)
{
stactics_chardata_b[offset] = data;
dirty_chardata_b[offset>>3] = 1;
}
}
void stactics_videoram_d_w(int offset,int data)
{
if (stactics_videoram_d[offset] != data)
{
stactics_videoram_d[offset] = data;
dirty_videoram_d[offset] = 1;
}
}
void stactics_chardata_d_w(int offset,int data)
{
if (stactics_chardata_d[offset] != data)
{
stactics_chardata_d[offset] = data;
dirty_chardata_d[offset>>3] = 1;
}
}
void stactics_videoram_e_w(int offset,int data)
{
if (stactics_videoram_e[offset] != data)
{
stactics_videoram_e[offset] = data;
dirty_videoram_e[offset] = 1;
}
}
void stactics_chardata_e_w(int offset,int data)
{
if (stactics_chardata_e[offset] != data)
{
stactics_chardata_e[offset] = data;
dirty_chardata_e[offset>>3] = 1;
}
}
void stactics_videoram_f_w(int offset,int data)
{
if (stactics_videoram_f[offset] != data)
{
stactics_videoram_f[offset] = data;
dirty_videoram_f[offset] = 1;
}
}
void stactics_chardata_f_w(int offset,int data)
{
if (stactics_chardata_f[offset] != data)
{
stactics_chardata_f[offset] = data;
dirty_chardata_f[offset>>3] = 1;
}
}
/* Actual area for visible monitor stuff is only 30*8 lines */
/* The rest is used for the score, etc. */
static const struct rectangle visible_screen_area = {0*8, 32*8, 0*8, 30*8};
/***************************************************************************
Draw the game screen in the given osd_bitmap.
Do NOT call osd_update_display() from this function, it will be called by
the main emulation engine.
***************************************************************************/
void stactics_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
int offs, sx, sy, i;
int char_number;
int color_code;
int pixel_x, pixel_y;
int palette_offset = palette_select * 64;
for(offs=0x400-1; offs>=0; offs--)
{
sx = offs%32;
sy = offs/32;
color_code = palette_offset + (stactics_videoram_b[offs]>>4);
/* Draw aliens in Page D */
char_number = stactics_videoram_d[offs];
if (dirty_chardata_d[char_number] == 1)
{
decodechar(Machine->gfx[3],
char_number,
stactics_chardata_d,
Machine->drv->gfxdecodeinfo[3].gfxlayout);
dirty_chardata_d[char_number] = 2;
dirty_videoram_d[offs] = 1;
}
else if (dirty_chardata_d[char_number] == 2)
{
dirty_videoram_d[offs] = 1;
}
if (dirty_videoram_d[offs])
{
drawgfx(bitmap_D,Machine->gfx[3],
char_number,
color_code,
0,0,
sx*8,sy*8,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
dirty_videoram_d[offs] = 0;
}
/* Draw aliens in Page E */
char_number = stactics_videoram_e[offs];
if (dirty_chardata_e[char_number] == 1)
{
decodechar(Machine->gfx[2],
char_number,
stactics_chardata_e,
Machine->drv->gfxdecodeinfo[2].gfxlayout);
dirty_chardata_e[char_number] = 2;
dirty_videoram_e[offs] = 1;
}
else if (dirty_chardata_e[char_number] == 2)
{
dirty_videoram_e[offs] = 1;
}
if (dirty_videoram_e[offs])
{
drawgfx(bitmap_E,Machine->gfx[2],
char_number,
color_code,
0,0,
sx*8,sy*8,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
dirty_videoram_e[offs] = 0;
}
/* Draw aliens in Page F */
char_number = stactics_videoram_f[offs];
if (dirty_chardata_f[char_number] == 1)
{
decodechar(Machine->gfx[1],
char_number,
stactics_chardata_f,
Machine->drv->gfxdecodeinfo[1].gfxlayout);
dirty_chardata_f[char_number] = 2;
dirty_videoram_f[offs] = 1;
}
else if (dirty_chardata_f[char_number] == 2)
{
dirty_videoram_f[offs] = 1;
}
if (dirty_videoram_f[offs])
{
drawgfx(bitmap_F,Machine->gfx[1],
char_number,
color_code,
0,0,
sx*8,sy*8,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
dirty_videoram_f[offs] = 0;
}
/* Draw the page B stuff */
char_number = stactics_videoram_b[offs];
if (dirty_chardata_b[char_number] == 1)
{
decodechar(Machine->gfx[0],
char_number,
stactics_chardata_b,
Machine->drv->gfxdecodeinfo[0].gfxlayout);
dirty_chardata_b[char_number] = 2;
dirty_videoram_b[offs] = 1;
}
else if (dirty_chardata_b[char_number] == 2)
{
dirty_videoram_b[offs] = 1;
}
if (dirty_videoram_b[offs])
{
drawgfx(bitmap_B,Machine->gfx[0],
char_number,
color_code,
0,0,
sx*8,sy*8,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
dirty_videoram_b[offs] = 0;
}
}
/* Now, composite the four layers together */
copyscrollbitmap(tmpbitmap2,bitmap_D,0,0,1,&d_offset,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
copyscrollbitmap(tmpbitmap2,bitmap_E,0,0,1,&e_offset,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
copyscrollbitmap(tmpbitmap2,bitmap_F,0,0,1,&f_offset,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
copybitmap(tmpbitmap2,bitmap_B,0,0,0,0,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
/* Now flip X & simulate the monitor motion */
fillbitmap(bitmap, 0, &Machine->drv->visible_area);
copybitmap(bitmap,tmpbitmap2,1,0,stactics_horiz_pos,stactics_vert_pos,
&visible_screen_area,TRANSPARENCY_NONE,0);
/* Finally, draw stuff that is on the console or on top of the monitor (LED's) */
/***** Draw Score Display *****/
pixel_x = 16;
pixel_y = 248;
/* Draw an S */
drawgfx(bitmap,Machine->gfx[5],
18,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw a colon */
drawgfx(bitmap,Machine->gfx[5],
25,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw the digits */
for(i=1;i<7;i++)
{
drawgfx(bitmap,Machine->gfx[5],
stactics_display_buffer[i]&0x0f,
16,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
}
/***** Draw Credits Indicator *****/
pixel_x = 64+16;
/* Draw a C */
drawgfx(bitmap,Machine->gfx[5],
21,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw a colon */
drawgfx(bitmap,Machine->gfx[5],
25,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw the pips */
for(i=7;i<9;i++)
{
drawgfx(bitmap,Machine->gfx[5],
16+(stactics_display_buffer[i]&0x0f),
16,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=2;
}
/***** Draw Rounds Indicator *****/
pixel_x = 128+16;
/* Draw an R */
drawgfx(bitmap,Machine->gfx[5],
22,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw a colon */
drawgfx(bitmap,Machine->gfx[5],
25,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw the pips */
for(i=9;i<12;i++)
{
drawgfx(bitmap,Machine->gfx[5],
16 + (stactics_display_buffer[i]&0x0f),
16,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=2;
}
/***** Draw Barriers Indicator *****/
pixel_x = 192+16;
/* Draw a B */
drawgfx(bitmap,Machine->gfx[5],
23,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw a colon */
drawgfx(bitmap,Machine->gfx[5],
25,
0,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=6;
/* Draw the pips */
for(i=12;i<16;i++)
{
drawgfx(bitmap,Machine->gfx[5],
16 + (stactics_display_buffer[i]&0x0f),
16,
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
pixel_x+=2;
}
/* An LED fire beam! */
/* (There were 120 green LEDS mounted in the cabinet in the game, */
/* and one red one, for the sight) */
/* First, update the firebeam state */
old_firebeam_state = firebeam_state;
if (stactics_shot_standby == 0)
{
firebeam_state = (firebeam_state + stactics_states_per_frame)%512;
}
/* These are thresholds for the two shots from the LED fire ROM */
/* (Note: There are two more for sound triggers, */
/* whenever that gets implemented) */
if ((old_firebeam_state < 0x8b) & (firebeam_state >= 0x8b))
stactics_shot_arrive = 1;
if ((old_firebeam_state < 0xca) & (firebeam_state >= 0xca))
stactics_shot_arrive = 1;
if (firebeam_state > 255)
{
firebeam_state = 0;
stactics_shot_standby = 1;
}
/* Now, draw the beam */
pixel_x = 15;
pixel_y = 166;
for(i=0;i<8;i++)
{
if ((i%2)==1)
{
/* Draw 7 LEDS on each side */
drawgfx(bitmap,Machine->gfx[4],
stactics_beamdata[firebeam_state*8+i]&0x7f,
16*2, /* Make it green */
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
drawgfx(bitmap,Machine->gfx[4],
stactics_beamdata[firebeam_state*8+i]&0x7f,
16*2, /* Make it green */
1,0,
255-pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
pixel_x+=14;
pixel_y-=7;
}
else
{
/* Draw 8 LEDS on each side */
drawgfx(bitmap,Machine->gfx[4],
stactics_beamdata[firebeam_state*8+i],
16*2, /* Make it green */
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
drawgfx(bitmap,Machine->gfx[4],
stactics_beamdata[firebeam_state*8+i],
16*2, /* Make it green */
1,0,
255-pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
pixel_x+=16;
pixel_y-=8;
}
}
/* Red Sight LED */
pixel_x = 134;
pixel_y = 112;
if (stactics_motor_on)
{
drawgfx(bitmap,Machine->gfx[5],
26,
16, /* red */
0,0,
pixel_x,pixel_y,
&Machine->drv->visible_area,TRANSPARENCY_COLOR,0);
}
/* Update vblank counter */
stactics_vblank_count++;
/* reset dirty flags */
for(i=0;i<0xff;i++)
{
dirty_chardata_b[i] &= 0x01;
dirty_chardata_d[i] &= 0x01;
dirty_chardata_e[i] &= 0x01;
dirty_chardata_f[i] &= 0x01;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -