Skip to content

Commit

Permalink
Tag player number draw_crosshair (#1227)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahoneyt944 authored Dec 4, 2021
1 parent b7f539c commit 3209513
Show file tree
Hide file tree
Showing 34 changed files with 65 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ android-arm64-v8a:
- .core-defs
only:
- master
- Tag

# Android 64-bit x86
android-x86_64:
Expand Down
15 changes: 2 additions & 13 deletions src/drawgfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3516,13 +3516,12 @@ static INLINE void plotclip(struct mame_bitmap *bitmap,int x,int y,int pen,const
plot_pixel(bitmap,x,y,pen);
}

void draw_crosshair(struct mame_bitmap *bitmap,int x,int y,const struct rectangle *clip)
void draw_crosshair(int player_number, struct mame_bitmap *bitmap,int x,int y,const struct rectangle *clip)
{
unsigned long color,black,white;
int i;
static int strobe = 0;
static bool polarity = true;
static int player_number = 1;
static int inactive_xy [MAX_PLAYER_COUNT][3];

if (!options.crosshair_enable)
Expand All @@ -3537,7 +3536,7 @@ void draw_crosshair(struct mame_bitmap *bitmap,int x,int y,const struct rectangl
{
if(inactive_xy[player_number-1][2] < 1000)
inactive_xy[player_number-1][2]++;
else goto next_player;
else return;
}
else
{
Expand Down Expand Up @@ -3607,16 +3606,6 @@ void draw_crosshair(struct mame_bitmap *bitmap,int x,int y,const struct rectangl
plotclip(bitmap,x+5,y+5,color,clip);
plotclip(bitmap,x+6,y+4,color,clip);
}

/* We rely on each frame calling draw_crosshair for each supported lightgun to
track the player_number. Each frame should end with the last lightgun / player
being drawn to reset the player_number for the next frame. This is important
when toggling options.crosshair_enable to keep the player_number in sync.
*/
next_player:
if(player_number >= options.content_flags[CONTENT_LIGHTGUN_COUNT]) player_number = 1;
else player_number++;

}


Expand Down
2 changes: 1 addition & 1 deletion src/drawgfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void mdrawgfxzoom( struct mame_bitmap *dest_bmp,const struct GfxElement *gfx,
UINT32 priority_mask);

void drawgfx_toggle_crosshair(void);
void draw_crosshair(struct mame_bitmap *bitmap,int x,int y,const struct rectangle *clip);
void draw_crosshair(int player_number, struct mame_bitmap *bitmap,int x,int y,const struct rectangle *clip);

static INLINE void sect_rect(struct rectangle *dst, const struct rectangle *src)
{
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/konamigq.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ static VIDEO_UPDATE( konamigq )
{
video_update_psx( bitmap, cliprect );

draw_crosshair( bitmap, GUNX( 5 ), GUNY( 6 ), cliprect );
draw_crosshair( bitmap, GUNX( 7 ), GUNY( 8 ), cliprect );
draw_crosshair( bitmap, GUNX( 9 ), GUNY( 10 ), cliprect );
draw_crosshair( 1, bitmap, GUNX( 5 ), GUNY( 6 ), cliprect );
draw_crosshair( 2, bitmap, GUNX( 7 ), GUNY( 8 ), cliprect );
draw_crosshair( 3, bitmap, GUNX( 9 ), GUNY( 10 ), cliprect );
}

static MEMORY_WRITE32_START( konamigq_writemem )
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/seattle.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@ static VIDEO_UPDATE( carnevil )

/* now draw the crosshairs */
get_crosshair_xy(0, &beamx, &beamy);
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(1, bitmap, beamx, beamy, cliprect);
get_crosshair_xy(1, &beamx, &beamy);
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(2, bitmap, beamx, beamy, cliprect);
}


Expand Down
2 changes: 1 addition & 1 deletion src/vidhrdw/8080bw_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ static void draw_sight(struct mame_bitmap *bitmap,const struct rectangle *clipre
}


draw_crosshair(bitmap,x,y,cliprect);
draw_crosshair(1, bitmap,x,y,cliprect);
}


Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/astrocde_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ VIDEO_UPDATE( seawolf2 )
if (centre<2) centre=2;
if (centre>317) centre=317;

draw_crosshair(bitmap,centre,35,&Machine->visible_area);
draw_crosshair(1, bitmap,centre,35,&Machine->visible_area);

/* Player 2 */

Expand All @@ -826,7 +826,7 @@ VIDEO_UPDATE( seawolf2 )
if (centre<1) centre=1;
if (centre>316) centre=316;

draw_crosshair(bitmap,centre,33,&Machine->visible_area);
draw_crosshair(2, bitmap,centre,33,&Machine->visible_area);
}
}
}
2 changes: 1 addition & 1 deletion src/vidhrdw/balsente_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,6 @@ VIDEO_UPDATE( balsente )
int beamx = balsente_shooter_x;
int beamy = balsente_shooter_y - 10;

draw_crosshair(bitmap,beamx,beamy,cliprect);
draw_crosshair(1, bitmap,beamx,beamy,cliprect);
}
}
10 changes: 5 additions & 5 deletions src/vidhrdw/bbusters_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ VIDEO_UPDATE( bbuster )
draw_sprites(bitmap,buffered_spriteram16,1,0,0);
tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);

draw_crosshair(bitmap,readinputport(6),readinputport(5),cliprect);
draw_crosshair(bitmap,readinputport(8),readinputport(7),cliprect);
draw_crosshair(bitmap,readinputport(10),readinputport(9),cliprect);
draw_crosshair(1, bitmap,readinputport(6),readinputport(5),cliprect);
draw_crosshair(2, bitmap,readinputport(8),readinputport(7),cliprect);
draw_crosshair(3, bitmap,readinputport(10),readinputport(9),cliprect);
}

VIDEO_UPDATE( mechatt )
Expand All @@ -310,6 +310,6 @@ VIDEO_UPDATE( mechatt )
draw_sprites(bitmap,buffered_spriteram16,1,0,0);
tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);

draw_crosshair(bitmap,readinputport(2),readinputport(3),cliprect);
draw_crosshair(bitmap,readinputport(4),readinputport(5),cliprect);
draw_crosshair(1, bitmap,readinputport(2),readinputport(3),cliprect);
draw_crosshair(2, bitmap,readinputport(4),readinputport(5),cliprect);
}
2 changes: 1 addition & 1 deletion src/vidhrdw/exidy440_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ static void update_screen(struct mame_bitmap *bitmap, const struct rectangle *cl
beamx = ((input_port_4_r(0) & 0xff) * 320) >> 8;
beamy = ((input_port_5_r(0) & 0xff) * 240) >> 8;

draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(1, bitmap, beamx, beamy, cliprect);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/fantland_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ VIDEO_UPDATE( borntofi )

if ( (readinputport(8) > 0) && (readinputport(9) > 0) )
{
draw_crosshair(bitmap,
draw_crosshair(1, bitmap,
readinputport(9) * 2 - 0x0e,
readinputport(8) * 2 - 0xf8,
cliprect);
}

if ( (readinputport(10) > 0) && (readinputport(11) > 0) )
{
draw_crosshair(bitmap,
draw_crosshair(2, bitmap,
readinputport(11) * 2 - 0x0e,
readinputport(10) * 2 - 0xf8,
cliprect);
Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/gaelco2_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,12 @@ VIDEO_UPDATE( bang )
/* 1P Gun */
posx = readinputport(3)*320/256;
posy = readinputport(5)*240/256;
draw_crosshair(bitmap, posx, posy + 0x0c, cliprect);
draw_crosshair(1, bitmap, posx, posy + 0x0c, cliprect);

/* 2P Gun */
posx = readinputport(4)*320/256;
posy = readinputport(6)*240/256;
draw_crosshair(bitmap, posx, posy + 0x0c, cliprect);
draw_crosshair(2, bitmap, posx, posy + 0x0c, cliprect);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/jaguar_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,11 @@ VIDEO_UPDATE( cojag )

/* draw player 1's crosshair */
get_crosshair_xy(0, &beamx, &beamy);
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(1, bitmap, beamx, beamy, cliprect);

/* draw player 2's crosshair */
get_crosshair_xy(1, &beamx, &beamy);
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(2, bitmap, beamx, beamy, cliprect);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/konamigx_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ VIDEO_UPDATE(konamigx)

if( gx_invertlayersBC )
{
draw_crosshair( bitmap, readinputport( 9)*287/0xff+24, readinputport(10)*223/0xff+16, cliprect );
draw_crosshair( bitmap, readinputport(11)*287/0xff+24, readinputport(12)*223/0xff+16, cliprect );
draw_crosshair( 1, bitmap, readinputport( 9)*287/0xff+24, readinputport(10)*223/0xff+16, cliprect );
draw_crosshair( 2, bitmap, readinputport(11)*287/0xff+24, readinputport(12)*223/0xff+16, cliprect );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/lethal_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ VIDEO_UPDATE(lethalen)
/* force "A" layer over top of everything */
K056832_tilemap_draw(bitmap, cliprect, 0, 0, 0);

draw_crosshair(bitmap, GUNX(1)+216, 240-GUNY(1), cliprect );
draw_crosshair(bitmap, GUNX(2)+216, 240-GUNY(2), cliprect );
draw_crosshair(1, bitmap, GUNX(1)+216, 240-GUNY(1), cliprect );
draw_crosshair(2, bitmap, GUNX(2)+216, 240-GUNY(2), cliprect );


#if 0
Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/lethalj_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ VIDEO_UPDATE( lethalj )

/* draw player 1's crosshair */
get_crosshair_xy(0, &beamx, &beamy);
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(1, bitmap, beamx, beamy, cliprect);

/* draw player 2's crosshair */
get_crosshair_xy(1, &beamx, &beamy);
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(2, bitmap, beamx, beamy, cliprect);

if (cliprect->max_y == Machine->visible_area.max_y)
blank_palette = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/namconb1_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ VIDEO_UPDATE( namconb1 )
{
beamx = ((readinputport(4))*288)/256;
beamy = ((readinputport(5))*224)/256;
draw_crosshair( bitmap, beamx, beamy, cliprect );
draw_crosshair( 1, bitmap, beamx, beamy, cliprect );

beamx = ((readinputport(6))*288)/256;
beamy = ((readinputport(7))*224)/256;
draw_crosshair( bitmap, beamx, beamy, cliprect );
draw_crosshair( 2, bitmap, beamx, beamy, cliprect );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/namcos2_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,11 @@ DrawCrossshair( struct mame_bitmap *bitmap, const struct rectangle *cliprect )

beamx = readinputport(2+x1port)*bitmap->width/256;
beamy = readinputport(2+y1port)*bitmap->height/256;
draw_crosshair( bitmap, beamx, beamy, cliprect );
draw_crosshair( 1, bitmap, beamx, beamy, cliprect );

beamx = readinputport(2+x2port)*bitmap->width/256;
beamy = readinputport(2+y2port)*bitmap->height/256;
draw_crosshair( bitmap, beamx, beamy, cliprect );
draw_crosshair( 2, bitmap, beamx, beamy, cliprect );
}

/**************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/nycaptor_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ VIDEO_UPDATE( nycaptor )
break;
}
if(nyc_gametype==1)
draw_crosshair(bitmap,readinputport(5),255-readinputport(6),cliprect);
draw_crosshair(1, bitmap,readinputport(5),255-readinputport(6),cliprect);
else
draw_crosshair(bitmap,readinputport(5),readinputport(6),cliprect);
draw_crosshair(1, bitmap,readinputport(5),readinputport(6),cliprect);
}
4 changes: 2 additions & 2 deletions src/vidhrdw/oneshot_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static void oneshot_drawcrosshairs( struct mame_bitmap *bitmap, const struct rec
gun_y_p1=0;

/* draw crosshair */
draw_crosshair( bitmap, xpos, ypos, cliprect );
draw_crosshair( 1, bitmap, xpos, ypos, cliprect );


/* get gun raw coordonates (player 2) */
Expand All @@ -120,7 +120,7 @@ static void oneshot_drawcrosshairs( struct mame_bitmap *bitmap, const struct rec
gun_x_p2=0;

/* draw crosshair */
draw_crosshair( bitmap, xpos, ypos, cliprect );
draw_crosshair( 2, bitmap, xpos, ypos, cliprect );
}

static void oneshot_drawsprites( struct mame_bitmap *bitmap, const struct rectangle *cliprect )
Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/othunder_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ VIDEO_UPDATE( othunder )
screeny += 2;

/* player 1 */
draw_crosshair(bitmap,screenx,screeny,cliprect);
draw_crosshair(1, bitmap,screenx,screeny,cliprect);

/* calculate p2 screen co-ords by matching routine at $AA48 */
rawx = othunder_ram[0x284c/2];
Expand Down Expand Up @@ -353,6 +353,6 @@ VIDEO_UPDATE( othunder )
screeny += 2;

/* player 2 */
draw_crosshair(bitmap,screenx,screeny,cliprect);
draw_crosshair(2, bitmap,screenx,screeny,cliprect);
}
}
2 changes: 1 addition & 1 deletion src/vidhrdw/playch10_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ VIDEO_UPDATE( playch10 )
int x_center = readinputport( 5 );
int y_center = readinputport( 6 ) + 30*8;

draw_crosshair(bitmap, x_center, y_center, &bottom_monitor);
draw_crosshair(1, bitmap, x_center, y_center, &bottom_monitor);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/policetr_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ VIDEO_UPDATE( policetr )
/* draw player 1's crosshair */
beamx = ((readinputport(3) & 0xff) * Machine->drv->screen_width) >> 8;
beamy = ((readinputport(4) & 0xff) * Machine->drv->screen_height) >> 8;
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(1, bitmap, beamx, beamy, cliprect);

/* draw player 2's crosshair */
beamx = ((readinputport(5) & 0xff) * Machine->drv->screen_width) >> 8;
beamy = ((readinputport(6) & 0xff) * Machine->drv->screen_height) >> 8;
draw_crosshair(bitmap, beamx, beamy, cliprect);
draw_crosshair(2, bitmap, beamx, beamy, cliprect);
}
2 changes: 1 addition & 1 deletion src/vidhrdw/rastan_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ VIDEO_UPDATE( opwolf )
if (1) /*input_port_4_word_r(0,0) &0x1) // Fake DSW */
{
/* Draw an aiming crosshair */
draw_crosshair(bitmap,(input_port_4_word_r(0,0xffff)*320)/256,input_port_5_word_r(0,0xffff),cliprect);
draw_crosshair(1, bitmap,(input_port_4_word_r(0,0xffff)*320)/256,input_port_5_word_r(0,0xffff),cliprect);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/seta2_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,12 @@ VIDEO_UPDATE( seta2_gun )

xpos = (readinputport(2) * 320) / 160;

draw_crosshair(bitmap,xpos-8,readinputport(8)+46,cliprect);
draw_crosshair(1, bitmap,xpos-8,readinputport(8)+46,cliprect);

xpos = (readinputport(3) * 320) / 160;

if (readinputport(3) != 0xff) /* not 1 player */
draw_crosshair(bitmap,xpos-8,readinputport(9)+46,cliprect);
draw_crosshair(2, bitmap,xpos-8,readinputport(9)+46,cliprect);
}


Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/seta_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,8 @@ static void zombraid_drawcrosshairs( struct mame_bitmap *bitmap, const struct re
int p2_x = seta_workram[0xC4AE/2];
int p2_y = 0x08+0xff - seta_workram[0xC4B0/2];

draw_crosshair(bitmap,p1_x,p1_y,cliprect);
draw_crosshair(bitmap,p2_x,p2_y,cliprect);
draw_crosshair(1, bitmap,p1_x,p1_y,cliprect);
draw_crosshair(2, bitmap,p2_x,p2_y,cliprect);
}


Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/ssv_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1510,12 +1510,12 @@ VIDEO_UPDATE( gdfs )
tilemap_draw(bitmap,cliprect, gdfs_tmap, 0, 0);

#if 0
draw_crosshair(bitmap,
draw_crosshair(1, bitmap,
Machine->visible_area.min_x + ((Machine->visible_area.max_x - Machine->visible_area.min_x) * readinputport(5)) / 255,
Machine->visible_area.min_y + ((Machine->visible_area.max_y - Machine->visible_area.min_y) * readinputport(6)) / 255,
cliprect,0);

draw_crosshair(bitmap,
draw_crosshair(2, bitmap,
Machine->visible_area.min_x + ((Machine->visible_area.max_x - Machine->visible_area.min_x) * readinputport(7)) / 255,
Machine->visible_area.min_y + ((Machine->visible_area.max_y - Machine->visible_area.min_y) * readinputport(8)) / 255,
cliprect,1);
Expand Down
4 changes: 2 additions & 2 deletions src/vidhrdw/taito_z_vidhrdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ VIDEO_UPDATE( spacegun )
--screenx;
screeny += 15;

draw_crosshair(bitmap,screenx,screeny,cliprect);
draw_crosshair(1, bitmap,screenx,screeny,cliprect);

/* calculate p2 screen co-ords by matching routine at $196EA */
rawx = taitoz_sharedram[0xd98/2];
Expand Down Expand Up @@ -1081,7 +1081,7 @@ VIDEO_UPDATE( spacegun )
--screenx;
screeny += 15;

draw_crosshair(bitmap,screenx,screeny,cliprect);
draw_crosshair(2, bitmap,screenx,screeny,cliprect);
}
}

Expand Down
Loading

0 comments on commit 3209513

Please sign in to comment.