summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2021-05-26 21:17:09 -0500
committer cracyc <cracyc@users.noreply.github.com>2021-05-26 21:17:09 -0500
commit3ade0ad948b40e2d613aa456d22ba24d2cdeda9f (patch)
tree0d63984bba10714e43af2faabdec5b842cad49fc
parent37e85b45187c09ba790e983e960e4f155ffdeebc (diff)
x68k_crtc: fix visarea
-rw-r--r--src/mame/video/x68k_crtc.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/mame/video/x68k_crtc.cpp b/src/mame/video/x68k_crtc.cpp
index 685f9b141e4..b3dd9bb62fb 100644
--- a/src/mame/video/x68k_crtc.cpp
+++ b/src/mame/video/x68k_crtc.cpp
@@ -175,19 +175,9 @@ void x68k_crtc_device::refresh_mode()
scr.max_x = m_hend + 2;
rectangle visiblescr(m_hbegin, m_hend, m_vbegin, m_vend);
- // expand visible area to the size indicated by CRTC reg 20
- int length = m_hend - m_hbegin;
- if (length < m_width)
- {
- visiblescr.min_x = m_hbegin - ((m_width - length)/2);
- visiblescr.max_x = m_hend + ((m_width - length)/2);
- }
- length = m_vend - m_vbegin;
- if (length < m_height)
- {
- visiblescr.min_y = m_vbegin - ((m_height - length)/2);
- visiblescr.max_y = m_vend + ((m_height - length)/2);
- }
+ if ((visiblescr.max_y > m_height) || (visiblescr.max_x > m_width))
+ logerror("visarea larger then reg[20]: %dx%d, %dx%d", visiblescr.max_x, visiblescr.max_y, m_width, m_height);
+
// bounds check
if (visiblescr.min_x < 0)
visiblescr.min_x = 0;
oreply.github.com> 2014-06-26 10:34:36 +0000 committer Fabio Priuli <etabeta78@users.noreply.github.com> 2014-06-26 10:34:36 +0000 k053246/k055673: updated to use delegates and inline configs. nw.' href='/mame/commit/src/mame/video/moo.c?id=19e040dc7867cac566d20e852e48bf8bbc135456'>19e040dc786
005ca1d3749
aebc07a8971
005ca1d3749
7b77f121862
19e040dc786
7b77f121862

4987adf1ae6
7b77f121862
4987adf1ae6
7b77f121862

166638ce809
7b77f121862
539367c7d1d
7b77f121862
219e6647858
6aa889372eb
7b77f121862
6aa889372eb
826fed71cd8



6aa889372eb
7b77f121862
166638ce809
6aa889372eb
539367c7d1d
6aa889372eb




826fed71cd8
6aa889372eb
826fed71cd8



7b77f121862

ddb290d5f61
7b77f121862
0f0d39ef815
7b77f121862
3b0cb91d986
7b77f121862
0f0d39ef815
5ddbca3e7a2
7b77f121862
826fed71cd8
7b77f121862
334c5538908
7b77f121862
db905cfc6e9
5ddbca3e7a2
7b77f121862
5ddbca3e7a2
826fed71cd8
7b77f121862




334c5538908
7b77f121862
db905cfc6e9
5ddbca3e7a2
7b77f121862
5ddbca3e7a2
7b77f121862


c285eb9bcd3
e5a008c29ee
7b77f121862


0f0d39ef815
7b77f121862
0f0d39ef815
7b77f121862
0f0d39ef815
7b77f121862
5ddbca3e7a2
7b77f121862
ea3ff966732
9a8d3075f03
7b77f121862
ec07fb10225
7b77f121862
0f0d39ef815
ec07fb10225
7b77f121862
ec07fb10225
7b77f121862


db905cfc6e9
7b77f121862
db905cfc6e9
7b77f121862

ec07fb10225
7b77f121862
903af18204f
7b77f121862
ec07fb10225
7b77f121862

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
                       
                                             









                                                                            
                
                         
 
                                             


                                         
                                 
                                   
                                      
                                      
                                      
                                           
            
                                                
 
                                                        

 
                                           
 
                                                                 

 
                                 
 
                                                          
 
                            
                         
 
                                                                                         



                                                
 
 
                                   
 
                                                          




                                       
                                            
 



                                            

 
                                                                                                             
 
                                                                                                                                
                      
                                               
 
                                                                               
                                    
 
                                               
         
                                                   
                 
                                                                                        
                                                                      
                         
                                                                         
                                                                    




                         
                                                              
                 
                                                                                        
                                                                      
                         
                                                                         


                                          
                          
                                                             


                      
                                                                     
                      
                                                                     
                      
                                                                     
 
                                               
 
                                                     
                                                   
 
                                            
 
                                                                                                                          
                                                                                   
 
                                                                           


                                                                                              
                                                                                             
 
                                                                        

                      
                                                                                                           
 
                                                           
 
                                                                   

                 
// license:BSD-3-Clause
// copyright-holders:R. Belmont, Acho A. Tang
/***************************************************************************

 Wild West C.O.W.boys of Moo Mesa
 Bucky O'Hare
 (c) 1992 Konami

 Video hardware emulation.

***************************************************************************/

#include "emu.h"
#include "includes/moo.h"

K053246_CB_MEMBER(moo_state::sprite_callback)
{
	int pri = (*color & 0x03e0) >> 4;

	if (pri <= m_layerpri[2])
		*priority_mask = 0;
	else if (pri <= m_layerpri[1])
		*priority_mask = 0xf0;
	else if (pri <= m_layerpri[0])
		*priority_mask = 0xf0|0xcc;
	else
		*priority_mask = 0xf0|0xcc|0xaa;

	*color = m_sprite_colorbase | (*color & 0x001f);
}

K056832_CB_MEMBER(moo_state::tile_callback)
{
	*color = m_layer_colorbase[layer] | (*color >> 2 & 0x0f);
}

VIDEO_START_MEMBER(moo_state,moo)
{
	assert(m_screen->format() == BITMAP_FORMAT_RGB32);

	m_alpha_enabled = 0;
	m_zmask = 0xffff;

	// other than the intro showing one blank line alignment is good through the game
	m_k056832->set_layer_offs(0, -2 + 1, 0);
	m_k056832->set_layer_offs(1,  2 + 1, 0);
	m_k056832->set_layer_offs(2,  4 + 1, 0);
	m_k056832->set_layer_offs(3,  6 + 1, 0);
}

VIDEO_START_MEMBER(moo_state,bucky)
{
	assert(m_screen->format() == BITMAP_FORMAT_RGB32);

	m_alpha_enabled = 0;
	m_zmask = 0x00ff;

	// Bucky doesn't chain tilemaps
	m_k056832->set_layer_association(0);

	m_k056832->set_layer_offs(0, -2, 0);
	m_k056832->set_layer_offs(1,  2, 0);
	m_k056832->set_layer_offs(2,  4, 0);
	m_k056832->set_layer_offs(3,  6, 0);
}

uint32_t moo_state::screen_update_moo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	static const int K053251_CI[4] = { k053251_device::CI1, k053251_device::CI2, k053251_device::CI3, k053251_device::CI4 };
	int layers[3];
	int new_colorbase, plane, dirty, alpha;

	m_sprite_colorbase = m_k053251->get_palette_index(k053251_device::CI0);
	m_layer_colorbase[0] = 0x70;

	if (m_k056832->get_layer_association())
	{
		for (plane = 1; plane < 4; plane++)
		{
			new_colorbase = m_k053251->get_palette_index(K053251_CI[plane]);
			if (m_layer_colorbase[plane] != new_colorbase)
			{
				m_layer_colorbase[plane] = new_colorbase;
				m_k056832->mark_plane_dirty( plane);
			}
		}
	}
	else
	{
		for (dirty = 0, plane = 1; plane < 4; plane++)
		{
			new_colorbase = m_k053251->get_palette_index(K053251_CI[plane]);
			if (m_layer_colorbase[plane] != new_colorbase)
			{
				m_layer_colorbase[plane] = new_colorbase;
				dirty = 1;
			}
		}
		if (dirty)
			m_k056832->mark_all_tilemaps_dirty();
	}

	layers[0] = 1;
	m_layerpri[0] = m_k053251->get_priority(k053251_device::CI2);
	layers[1] = 2;
	m_layerpri[1] = m_k053251->get_priority(k053251_device::CI3);
	layers[2] = 3;
	m_layerpri[2] = m_k053251->get_priority(k053251_device::CI4);

	konami_sortlayers3(layers, m_layerpri);

	m_k054338->update_all_shadows(0, *m_palette);
	m_k054338->fill_solid_bg(bitmap, cliprect);

	screen.priority().fill(0, cliprect);

	if (m_layerpri[0] < m_k053251->get_priority(k053251_device::CI1))   /* bucky hides back layer behind background */
		m_k056832->tilemap_draw(screen, bitmap, cliprect, layers[0], 0, 1);

	m_k056832->tilemap_draw(screen, bitmap, cliprect, layers[1], 0, 2);

	// Enabling alpha improves fog and fading in Moo but causes other things to disappear.
	// There is probably a control bit somewhere to turn off alpha blending.
	m_alpha_enabled = m_k054338->register_r(K338_REG_CONTROL) & K338_CTL_MIXPRI; // DUMMY

	alpha = (m_alpha_enabled) ? m_k054338->set_alpha_level(1) : 255;

	if (alpha > 0)
		m_k056832->tilemap_draw(screen, bitmap, cliprect, layers[2], TILEMAP_DRAW_ALPHA(alpha), 4);

	m_k053246->k053247_sprites_draw( bitmap, cliprect);

	m_k056832->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0);
	return 0;
}