factored a little bit windows/out of windows

This commit is contained in:
damdoum 2007-01-16 14:20:11 +00:00
parent e1b4c479a5
commit a639ae21a0
2 changed files with 37 additions and 150 deletions

View File

@ -583,93 +583,33 @@ INLINE BOOL withinRect (u8 x,u8 y, u16 startX, u16 startY, u16 endX, u16 endY)
INLINE BOOL renderline_checkWindowInside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect) INLINE BOOL renderline_checkWindowInside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect)
{ {
/* priority to check the window regions: win0,win1,winobj */ /* priority to check the window regions: win0,win1,winobj */
if (gpu->dispCnt.bits.Win0_Enable) /* highest priority */ if (gpu->dispCnt.bits.Win0_Enable) /* highest priority */
{ {
if (withinRect( x,y, if (withinRect( x,y,
gpu->WINDOW_XDIM[0].bits.start,gpu->WINDOW_YDIM[0].bits.start, gpu->WINDOW_XDIM[0].bits.start,gpu->WINDOW_YDIM[0].bits.start,
gpu->WINDOW_XDIM[0].bits.end,gpu->WINDOW_YDIM[0].bits.end gpu->WINDOW_XDIM[0].bits.end,gpu->WINDOW_YDIM[0].bits.end
)) ))
{ {
switch (bgnum) { /* is drawing explicit set for this bg in this rectangle ? */
case 0: *draw = gpu->WINDOW_INCNT.windows.win0_en & (1<<bgnum);
if (!gpu->WINDOW_INCNT.bits.WIN0_BG0_Enable) *effect = gpu->WINDOW_INCNT.bits.WIN0_Effect_Enable ;
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 1:
if (!gpu->WINDOW_INCNT.bits.WIN0_BG1_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 2:
if (!gpu->WINDOW_INCNT.bits.WIN0_BG2_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 3:
if (!gpu->WINDOW_INCNT.bits.WIN0_BG3_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 4:
if (!gpu->WINDOW_INCNT.bits.WIN0_OBJ_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
}
*effect = gpu->WINDOW_INCNT.bits.WIN0_Effect_Enable ;
return TRUE ; return TRUE ;
} }
} }
if (gpu->dispCnt.bits.Win1_Enable) /* mid priority */ if (gpu->dispCnt.bits.Win1_Enable) /* mid priority */
{ {
if (withinRect( x,y, if (withinRect( x,y,
gpu->WINDOW_XDIM[1].bits.start,gpu->WINDOW_YDIM[1].bits.start, gpu->WINDOW_XDIM[1].bits.start,gpu->WINDOW_YDIM[1].bits.start,
gpu->WINDOW_XDIM[1].bits.end,gpu->WINDOW_YDIM[1].bits.end gpu->WINDOW_XDIM[1].bits.end,gpu->WINDOW_YDIM[1].bits.end
)) ))
{ {
switch (bgnum) { /* is drawing explicit set for this bg in this rectangle ? */
case 0: *draw = gpu->WINDOW_INCNT.windows.win1_en & (1<<bgnum);
if (!gpu->WINDOW_INCNT.bits.WIN1_BG0_Enable) *effect = gpu->WINDOW_INCNT.bits.WIN1_Effect_Enable ;
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 1:
if (!gpu->WINDOW_INCNT.bits.WIN1_BG1_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 2:
if (!gpu->WINDOW_INCNT.bits.WIN1_BG2_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 3:
if (!gpu->WINDOW_INCNT.bits.WIN1_BG3_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 4:
if (!gpu->WINDOW_INCNT.bits.WIN1_OBJ_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
}
*effect = gpu->WINDOW_INCNT.bits.WIN1_Effect_Enable ;
return TRUE ; return TRUE ;
} }
} }
if ((gpu->dispCnt.bits.WinOBJ_Enable) && (bgnum==4)) /* low priority, but only applies to OBJ */ if ((gpu->dispCnt.bits.WinOBJ_Enable) && (bgnum==4)) /* low priority, but only applies to OBJ */
{ {
} }
/* we have no rule, so allow everything for now */ /* we have no rule, so allow everything for now */
@ -681,93 +621,33 @@ INLINE BOOL renderline_checkWindowInside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL
INLINE BOOL renderline_checkWindowOutside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect) INLINE BOOL renderline_checkWindowOutside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect)
{ {
/* priority to check the window regions: win0,win1,winobj */ /* priority to check the window regions: win0,win1,winobj */
if (gpu->dispCnt.bits.Win0_Enable) /* highest priority */ if (gpu->dispCnt.bits.Win0_Enable) /* highest priority */
{ {
if (!withinRect( x,y, if (!withinRect( x,y,
gpu->WINDOW_XDIM[0].bits.start,gpu->WINDOW_YDIM[0].bits.start, gpu->WINDOW_XDIM[0].bits.start,gpu->WINDOW_YDIM[0].bits.start,
gpu->WINDOW_XDIM[0].bits.end,gpu->WINDOW_YDIM[0].bits.end gpu->WINDOW_XDIM[0].bits.end,gpu->WINDOW_YDIM[0].bits.end
)) ))
{ {
switch (bgnum) { /* is drawing explicit set for this bg in this rectangle ? */
case 0: *draw = gpu->WINDOW_OUTCNT.windows.win0_en & (1<<bgnum);
if (!gpu->WINDOW_OUTCNT.bits.WIN0_BG0_Enable) *effect = gpu->WINDOW_OUTCNT.bits.WIN0_Effect_Enable ;
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 1:
if (!gpu->WINDOW_OUTCNT.bits.WIN0_BG1_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 2:
if (!gpu->WINDOW_OUTCNT.bits.WIN0_BG2_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 3:
if (!gpu->WINDOW_OUTCNT.bits.WIN0_BG3_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 4:
if (!gpu->WINDOW_OUTCNT.bits.WIN0_OBJ_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
}
*effect = gpu->WINDOW_OUTCNT.bits.WIN0_Effect_Enable ;
return TRUE ; return TRUE ;
} }
} }
if (gpu->dispCnt.bits.Win1_Enable) /* mid priority */ if (gpu->dispCnt.bits.Win1_Enable) /* mid priority */
{ {
if (!withinRect( x,y, if (!withinRect( x,y,
gpu->WINDOW_XDIM[1].bits.start,gpu->WINDOW_YDIM[1].bits.start, gpu->WINDOW_XDIM[1].bits.start,gpu->WINDOW_YDIM[1].bits.start,
gpu->WINDOW_XDIM[1].bits.end,gpu->WINDOW_YDIM[1].bits.end gpu->WINDOW_XDIM[1].bits.end,gpu->WINDOW_YDIM[1].bits.end
)) ))
{ {
switch (bgnum) { /* is drawing explicit set for this bg in this rectangle ? */
case 0: *draw = gpu->WINDOW_OUTCNT.windows.win1_en & (1<<bgnum);
if (!gpu->WINDOW_OUTCNT.bits.WIN1_BG0_Enable) *effect = gpu->WINDOW_OUTCNT.bits.WIN1_Effect_Enable ;
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 1:
if (!gpu->WINDOW_OUTCNT.bits.WIN1_BG1_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 2:
if (!gpu->WINDOW_OUTCNT.bits.WIN1_BG2_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 3:
if (!gpu->WINDOW_OUTCNT.bits.WIN1_BG3_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
case 4:
if (!gpu->WINDOW_OUTCNT.bits.WIN1_OBJ_Enable)
*draw = FALSE ; /* drawing explicit disabled for thios bg in this rectangle */
else
*draw = TRUE ;
break ;
}
*effect = gpu->WINDOW_OUTCNT.bits.WIN1_Effect_Enable ;
return TRUE ; return TRUE ;
} }
} }
if ((gpu->dispCnt.bits.WinOBJ_Enable) && (bgnum==4)) /* low priority, but only applies to OBJ */ if ((gpu->dispCnt.bits.WinOBJ_Enable) && (bgnum==4)) /* low priority, but only applies to OBJ */
{ {
} }
/* we have no rule, so allow everything for now */ /* we have no rule, so allow everything for now */

View File

@ -305,6 +305,13 @@ typedef union windowcnt_t
unsigned char low ; unsigned char low ;
unsigned char high ; unsigned char high ;
} bytes ; } bytes ;
struct
{
unsigned win0_en:5;
unsigned :3;
unsigned win1_en:5;
unsigned :3;
} windows ;
unsigned short val ; unsigned short val ;
} windowcnt_t ; } windowcnt_t ;