~ubuntu-branches/ubuntu/lucid/sdlmame/lucid

« back to all changes in this revision

Viewing changes to src/mame/video/toaplan1.c

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Falco
  • Date: 2009-11-03 17:10:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20091103171015-6hop4ory5lxnumpn
Tags: 0.135-0ubuntu1
* New upstream release - Closes (LP: #403212)
* debian/watch: unstable releases are no longer detected
* mame.ini: added the cheat subdirectories to cheatpath so zipped
  cheatfiles will be searched too
* renamed crsshair subdirectory to crosshair to reflect upstream change
* mame.ini: renamed references to crosshair subdirectory (see above)

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
 
163
163
 
164
164
#ifdef MAME_DEBUG
165
 
static int display_pf1 = 1;
166
 
static int display_pf2 = 1;
167
 
static int display_pf3 = 1;
168
 
static int display_pf4 = 1;
169
 
static int displog = 0;
 
165
static int display_pf1;
 
166
static int display_pf2;
 
167
static int display_pf3;
 
168
static int display_pf4;
 
169
static int displog;
170
170
#endif
171
171
 
172
172
static INT32 tiles_offsetx;
278
278
        pf2_tilevram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_TILEVRAM_SIZE/2);
279
279
        pf3_tilevram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_TILEVRAM_SIZE/2);
280
280
        pf4_tilevram16 = auto_alloc_array_clear(machine, UINT16, TOAPLAN1_TILEVRAM_SIZE/2);
 
281
 
 
282
#ifdef MAME_DEBUG
 
283
        display_pf1 = 1;
 
284
        display_pf2 = 1;
 
285
        display_pf3 = 1;
 
286
        display_pf4 = 1;
 
287
        displog = 0;
 
288
#endif
281
289
}
282
290
 
283
291
static void toaplan1_spritevram_alloc(running_machine *machine)
442
450
        {
443
451
                logerror("Setting BCU controller flipscreen port to %04x\n",data);
444
452
                bcu_flipscreen = data & 0x01;           /* 0x0001 = flip, 0x0000 = no flip */
445
 
                tilemap_set_flip(ALL_TILEMAPS, (data ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0));
 
453
                tilemap_set_flip_all(space->machine, (data ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0));
446
454
                if (bcu_flipscreen)
447
455
                {
448
456
                        scrollx_offs1 = 0x080 - 6;
469
477
        {
470
478
                logerror("Setting BCU controller flipscreen port to %04x\n",data);
471
479
                bcu_flipscreen = data & 0x01;           /* 0x0001 = flip, 0x0000 = no flip */
472
 
                tilemap_set_flip(ALL_TILEMAPS, (data ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0));
 
480
                tilemap_set_flip_all(space->machine, (data ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0));
473
481
                if (bcu_flipscreen)
474
482
                {
475
483
                        scrollx_offs1 = 0x011 - 6;
738
746
 
739
747
 
740
748
 
 
749
static void toaplan1_log_vram(running_machine *machine)
 
750
{
741
751
#ifdef MAME_DEBUG
742
 
static void toaplan1_log_vram(void)
743
 
{
744
 
        if ( input_code_pressed(KEYCODE_M) )
 
752
        if ( input_code_pressed(machine, KEYCODE_M) )
745
753
        {
746
754
                offs_t sprite_voffs;
747
 
                while (input_code_pressed(KEYCODE_M)) ;
 
755
                while (input_code_pressed(machine, KEYCODE_M)) ;
748
756
                if (toaplan1_spritesizeram16)                   /* FCU controller */
749
757
                {
750
758
                        int schar,sattr,sxpos,sypos,bschar,bsattr,bsxpos,bsypos;
789
797
                }
790
798
        }
791
799
 
792
 
        if ( input_code_pressed(KEYCODE_SLASH) )
 
800
        if ( input_code_pressed(machine, KEYCODE_SLASH) )
793
801
        {
794
802
                UINT16 *size  = (UINT16 *)(toaplan1_spritesizeram16);
795
803
                UINT16 *bsize = (UINT16 *)(toaplan1_buffered_spritesizeram16);
796
804
                offs_t offs;
797
 
                while (input_code_pressed(KEYCODE_SLASH)) ;
 
805
                while (input_code_pressed(machine, KEYCODE_SLASH)) ;
798
806
                if (toaplan1_spritesizeram16)                   /* FCU controller */
799
807
                {
800
808
                        logerror("Scrolls    PF1-X  PF1-Y     PF2-X  PF2-Y     PF3-X  PF3-Y     PF4-X  PF4-Y\n");
810
818
                }
811
819
        }
812
820
 
813
 
        if ( input_code_pressed(KEYCODE_N) )
 
821
        if ( input_code_pressed(machine, KEYCODE_N) )
814
822
        {
815
823
                offs_t tile_voffs;
816
824
                int tchar[5], tattr[5];
817
 
                while (input_code_pressed(KEYCODE_N)) ; /* BCU controller */
 
825
                while (input_code_pressed(machine, KEYCODE_N)) ;        /* BCU controller */
818
826
                logerror("Scrolls    PF1-X  PF1-Y     PF2-X  PF2-Y     PF3-X  PF3-Y     PF4-X  PF4-Y\n");
819
827
                logerror("------>    #%04x  #%04x     #%04x  #%04x     #%04x  #%04x     #%04x  #%04x\n",pf1_scrollx,pf1_scrolly,pf2_scrollx,pf2_scrolly,pf3_scrollx,pf3_scrolly,pf4_scrollx,pf4_scrolly);
820
828
                for ( tile_voffs = 0; tile_voffs < (TOAPLAN1_TILEVRAM_SIZE/2); tile_voffs += 2 )
834
842
                }
835
843
        }
836
844
 
837
 
        if ( input_code_pressed(KEYCODE_W) )
 
845
        if ( input_code_pressed(machine, KEYCODE_W) )
838
846
        {
839
 
                while (input_code_pressed(KEYCODE_W)) ;
 
847
                while (input_code_pressed(machine, KEYCODE_W)) ;
840
848
                logerror("Mark here\n");
841
849
        }
842
 
        if ( input_code_pressed(KEYCODE_E) )
 
850
        if ( input_code_pressed(machine, KEYCODE_E) )
843
851
        {
844
 
                while (input_code_pressed(KEYCODE_E)) ;
 
852
                while (input_code_pressed(machine, KEYCODE_E)) ;
845
853
                displog += 1;
846
854
                displog &= 1;
847
855
        }
850
858
                logerror("Scrolls    PF1-X  PF1-Y     PF2-X  PF2-Y     PF3-X  PF3-Y     PF4-X  PF4-Y\n");
851
859
                logerror("------>    #%04x  #%04x     #%04x  #%04x     #%04x  #%04x     #%04x  #%04x\n",pf1_scrollx,pf1_scrolly,pf2_scrollx,pf2_scrolly,pf3_scrollx,pf3_scrolly,pf4_scrollx,pf4_scrolly);
852
860
        }
853
 
        if ( input_code_pressed(KEYCODE_B) )
 
861
        if ( input_code_pressed(machine, KEYCODE_B) )
854
862
        {
855
 
//      while (input_code_pressed(KEYCODE_B)) ;
 
863
//      while (input_code_pressed(machine, KEYCODE_B)) ;
856
864
                scrollx_offs1 += 0x1; scrollx_offs2 += 0x1; scrollx_offs3 += 0x1; scrollx_offs4 += 0x1;
857
865
                logerror("Scrollx_offs now = %08x\n",scrollx_offs4);
858
866
                tilemap_set_scrollx(pf1_tilemap,0,(pf1_scrollx >> 7) - (tiles_offsetx - scrollx_offs1));
860
868
                tilemap_set_scrollx(pf3_tilemap,0,(pf3_scrollx >> 7) - (tiles_offsetx - scrollx_offs3));
861
869
                tilemap_set_scrollx(pf4_tilemap,0,(pf4_scrollx >> 7) - (tiles_offsetx - scrollx_offs4));
862
870
        }
863
 
        if ( input_code_pressed(KEYCODE_V) )
 
871
        if ( input_code_pressed(machine, KEYCODE_V) )
864
872
        {
865
 
//      while (input_code_pressed(KEYCODE_V)) ;
 
873
//      while (input_code_pressed(machine, KEYCODE_V)) ;
866
874
                scrollx_offs1 -= 0x1; scrollx_offs2 -= 0x1; scrollx_offs3 -= 0x1; scrollx_offs4 -= 0x1;
867
875
                logerror("Scrollx_offs now = %08x\n",scrollx_offs4);
868
876
                tilemap_set_scrollx(pf1_tilemap,0,(pf1_scrollx >> 7) - (tiles_offsetx - scrollx_offs1));
870
878
                tilemap_set_scrollx(pf3_tilemap,0,(pf3_scrollx >> 7) - (tiles_offsetx - scrollx_offs3));
871
879
                tilemap_set_scrollx(pf4_tilemap,0,(pf4_scrollx >> 7) - (tiles_offsetx - scrollx_offs4));
872
880
        }
873
 
        if ( input_code_pressed(KEYCODE_C) )
 
881
        if ( input_code_pressed(machine, KEYCODE_C) )
874
882
        {
875
 
//      while (input_code_pressed(KEYCODE_C)) ;
 
883
//      while (input_code_pressed(machine, KEYCODE_C)) ;
876
884
                scrolly_offs += 0x1;
877
885
                logerror("Scrolly_offs now = %08x\n",scrolly_offs);
878
886
                tilemap_set_scrolly(pf1_tilemap,0,(pf1_scrolly >> 7) - (tiles_offsety - scrolly_offs));
880
888
                tilemap_set_scrolly(pf3_tilemap,0,(pf3_scrolly >> 7) - (tiles_offsety - scrolly_offs));
881
889
                tilemap_set_scrolly(pf4_tilemap,0,(pf4_scrolly >> 7) - (tiles_offsety - scrolly_offs));
882
890
        }
883
 
        if ( input_code_pressed(KEYCODE_X) )
 
891
        if ( input_code_pressed(machine, KEYCODE_X) )
884
892
        {
885
 
//      while (input_code_pressed(KEYCODE_X)) ;
 
893
//      while (input_code_pressed(machine, KEYCODE_X)) ;
886
894
                scrolly_offs -= 0x1;
887
895
                logerror("Scrolly_offs now = %08x\n",scrolly_offs);
888
896
                tilemap_set_scrolly(pf1_tilemap,0,(pf1_scrolly >> 7) - (tiles_offsety - scrolly_offs));
891
899
                tilemap_set_scrolly(pf4_tilemap,0,(pf4_scrolly >> 7) - (tiles_offsety - scrolly_offs));
892
900
        }
893
901
 
894
 
        if ( input_code_pressed(KEYCODE_L) )            /* Turn Playfield 4 on/off */
 
902
        if ( input_code_pressed(machine, KEYCODE_L) )           /* Turn Playfield 4 on/off */
895
903
        {
896
 
                while (input_code_pressed(KEYCODE_L)) ;
 
904
                while (input_code_pressed(machine, KEYCODE_L)) ;
897
905
                display_pf4 += 1;
898
906
                display_pf4 &= 1;
899
907
                tilemap_set_enable(pf4_tilemap, display_pf4);
900
908
        }
901
 
        if ( input_code_pressed(KEYCODE_K) )            /* Turn Playfield 3 on/off */
 
909
        if ( input_code_pressed(machine, KEYCODE_K) )           /* Turn Playfield 3 on/off */
902
910
        {
903
 
                while (input_code_pressed(KEYCODE_K)) ;
 
911
                while (input_code_pressed(machine, KEYCODE_K)) ;
904
912
                display_pf3 += 1;
905
913
                display_pf3 &= 1;
906
914
                tilemap_set_enable(pf3_tilemap, display_pf3);
907
915
        }
908
 
        if ( input_code_pressed(KEYCODE_J) )            /* Turn Playfield 2 on/off */
 
916
        if ( input_code_pressed(machine, KEYCODE_J) )           /* Turn Playfield 2 on/off */
909
917
        {
910
 
                while (input_code_pressed(KEYCODE_J)) ;
 
918
                while (input_code_pressed(machine, KEYCODE_J)) ;
911
919
                display_pf2 += 1;
912
920
                display_pf2 &= 1;
913
921
                tilemap_set_enable(pf2_tilemap, display_pf2);
914
922
        }
915
 
        if ( input_code_pressed(KEYCODE_H) )            /* Turn Playfield 1 on/off */
 
923
        if ( input_code_pressed(machine, KEYCODE_H) )           /* Turn Playfield 1 on/off */
916
924
        {
917
 
                while (input_code_pressed(KEYCODE_H)) ;
 
925
                while (input_code_pressed(machine, KEYCODE_H)) ;
918
926
                display_pf1 += 1;
919
927
                display_pf1 &= 1;
920
928
                tilemap_set_enable(pf1_tilemap, display_pf1);
921
929
        }
 
930
#endif
922
931
}
923
 
#endif
924
932
 
925
933
 
926
934
 
929
937
***************************************************************************/
930
938
 
931
939
// custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities
932
 
static void toaplan1_draw_sprite_custom(bitmap_t *dest_bmp,const gfx_element *gfx,
 
940
static void toaplan1_draw_sprite_custom(bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx,
933
941
                UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
934
 
                const rectangle *clip,int priority)
 
942
                int priority)
935
943
{
936
944
        int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
937
945
        const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
938
 
 
 
946
        bitmap_t *priority_bitmap = gfx->machine->priority_bitmap;
939
947
        int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16;
940
948
        int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16;
941
949
 
1080
1088
                                        if (fcu_flipscreen) sx = sx_base - dim_x;
1081
1089
                                        else                sx = sx_base + dim_x;
1082
1090
 
1083
 
                                        toaplan1_draw_sprite_custom(bitmap,machine->gfx[1],
 
1091
                                        toaplan1_draw_sprite_custom(bitmap,cliprect,machine->gfx[1],
1084
1092
                                                                           sprite,color,
1085
1093
                                                                           fcu_flipscreen,fcu_flipscreen,
1086
1094
                                                                           sx,sy,
1087
 
                                                                           cliprect,priority);
 
1095
                                                                           priority);
1088
1096
 
1089
1097
                                        sprite++ ;
1090
1098
                                }
1115
1123
                                flipx = attrib & 0x100;
1116
1124
                                if (flipx) sx -= 15;
1117
1125
                                flipy = attrib & 0x200;
1118
 
                                drawgfx(bitmap,machine->gfx[1],
 
1126
                                drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
1119
1127
                                        sprite,
1120
1128
                                        color,
1121
1129
                                        flipx,flipy,
1122
 
                                        sx-31,sy-16,
1123
 
                                        cliprect,TRANSPARENCY_PEN,0);
 
1130
                                        sx-31,sy-16,0);
1124
1131
                        }
1125
1132
                }
1126
1133
        }
1135
1142
{
1136
1143
        int priority;
1137
1144
 
1138
 
#ifdef MAME_DEBUG
1139
 
        toaplan1_log_vram();
1140
 
#endif
 
1145
        toaplan1_log_vram(screen->machine);
1141
1146
 
1142
1147
        bitmap_fill(bitmap,cliprect,0);
1143
1148
 
1159
1164
{
1160
1165
        int priority;
1161
1166
 
1162
 
#ifdef MAME_DEBUG
1163
 
        toaplan1_log_vram();
1164
 
#endif
 
1167
        toaplan1_log_vram(screen->machine);
1165
1168
 
1166
 
        bitmap_fill(priority_bitmap,cliprect,0);
 
1169
        bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
1167
1170
        bitmap_fill(bitmap,cliprect,0x120);
1168
1171
 
1169
1172
        tilemap_draw(bitmap,cliprect,pf4_tilemap,TILEMAP_DRAW_OPAQUE,0);
1186
1189
{
1187
1190
        int priority;
1188
1191
 
1189
 
#ifdef MAME_DEBUG
1190
 
        toaplan1_log_vram();
1191
 
#endif
 
1192
        toaplan1_log_vram(screen->machine);
1192
1193
 
1193
 
        bitmap_fill(priority_bitmap,cliprect,0);
 
1194
        bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
1194
1195
        bitmap_fill(bitmap,cliprect,0x120);
1195
1196
 
1196
1197
        tilemap_draw(bitmap,cliprect,pf1_tilemap,TILEMAP_DRAW_OPAQUE | 0,0);