2025-02-26 20:05:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								//    Copyright 2025 Bill Rossi
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//    
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//    This file is part of Hanafuda Hachi-Hachi.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//    Hanafuda Hachi-Hachi is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//    Hanafuda Hachi-Hachi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//    You should have received a copy of the GNU General Public License along with Hanafuda Hachi-Hachi. If not, see <https://www.gnu.org/licenses/>. 
  
						 
					
						
							
								
									
										
										
										
											2025-02-02 18:30:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <stdio.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <stdlib.h> 
  
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "card.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 11:12:07 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  Vector2  card_size  =  ( Vector2 )  {  CARD_WIDTH ,  CARD_HEIGHT  } ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  char  * month_english_abbr [ 12 ]  =  {  " Jan " ,  " Feb " ,  " Mar " ,  " Apr " ,  " May " ,  " Jun " ,  " Jul " ,  " Aug " ,  " Sep " ,  " Oct " ,  " Nov " ,  " Dec "  } ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 09:54:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Color  BRICKRED  =  ( Color )  {  136 ,  12 ,  2 ,  255  } ;  
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:28:13 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  draw_card ( Card  * c ,  Texture2D  * cards_texture ,  int  index )  {  
						 
					
						
							
								
									
										
										
										
											2025-02-02 05:21:20 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  int  i_vert  =  c - > index  %  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  int  i_horiz  =  c - > index  /  4 ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 10:21:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  int  pos_vert  =  i_vert  *  CARD_HEIGHT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  int  pos_horiz  =  i_horiz  *  CARD_WIDTH ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 05:21:20 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 09:54:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  Color  color  =  index  = =  1  ?  BLACK  :  BRICKRED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-25 05:35:15 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  ( c - > selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    DrawRectangleRec ( ( Rectangle )  {  c - > position . x  -  6 ,  c - > position . y  -  6 ,  card_size . x  +  12 ,  card_size . y  +  12  } ,  BLUE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  ( c - > visible )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    DrawTexturePro ( 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:28:13 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										   * cards_texture , 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										   ( Rectangle )  {  pos_horiz ,  pos_vert ,  CARD_WIDTH ,  CARD_HEIGHT  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										   ( Rectangle )  {  c - > position . x ,  c - > position . y ,  card_size . x ,  card_size . y  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										   ( Vector2 )  {  0 ,  0  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										   0. , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										   RAYWHITE 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										   ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 09:54:46 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    DrawRectangleRec ( ( Rectangle )  {  c - > position . x ,  c - > position . y ,  card_size . x ,  card_size . y  } ,  color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2025-02-01 07:51:53 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  point_within_card ( Card  * c ,  Vector2  point )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  return  point . x  >  c - > position . x  & &  point . x  <  c - > position . x  +  card_size . x  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    point . y  >  c - > position . y  & &  point . y  <  c - > position . y  +  card_size . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2025-02-02 18:30:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  shuffle_hand ( Hand  * h )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  Card  * swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  for  ( int  i  =  h - > count  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    int  index  =  rand ( )  %  ( i  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    swap  =  h - > cards [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    h - > cards [ i ]  =  h - > cards [ index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    h - > cards [ index ]  =  swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-22 10:48:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  order_deck ( Hand  * h )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  Card  * swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  swap  =  h - > cards [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 1 ]  =  h - > cards [ 47 - 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 47 - 0 ]  =  swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  swap  =  h - > cards [ 5 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 5 ]  =  h - > cards [ 47 - 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 47 - 1 ]  =  swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  swap  =  h - > cards [ 9 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 9 ]  =  h - > cards [ 47 - 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 47 - 2 ]  =  swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  swap  =  h - > cards [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 0 ]  =  h - > cards [ 47 - 12 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 47 - 12 ]  =  swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  swap  =  h - > cards [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 4 ]  =  h - > cards [ 47 - 13 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 47 - 13 ]  =  swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  swap  =  h - > cards [ 8 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 8 ]  =  h - > cards [ 47 - 14 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > cards [ 47 - 14 ]  =  swap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 08:15:43 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  remove_from_hand ( Hand  * h ,  Card  * c )  {  
						 
					
						
							
								
									
										
										
										
											2025-02-25 19:50:24 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  c - > selected  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 08:15:43 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  bool  card_found  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  for  ( int  i  =  0 ;  i  <  h - > count  -  1 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( h - > cards [ i ]  = =  c )  card_found  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-10 17:27:02 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( card_found )  h - > cards [ i ]  =  h - > cards [ i  +  1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 08:15:43 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > count - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  first_open_spot ( Hand  * h )  {  
						 
					
						
							
								
									
										
										
										
											2025-02-12 16:45:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  int  order_guy [ 48 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  int  order_guy_count  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  for  ( int  i  =  0 ;  i  <  48 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    order_guy [ i ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  for  ( int  i  =  0 ;  i  <  h - > count ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( h - > cards [ i ]  = =  NULL )  continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    order_guy [ h - > cards [ i ] - > order ]  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    order_guy_count + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  int  fos  =  h - > count ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 16:45:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  for  ( int  i  =  0 ;  i  <  order_guy_count ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( order_guy [ i ] )  continue ;  
							 
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    fos  =  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 16:45:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-10 17:27:02 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  return  fos ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2025-02-10 17:27:02 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 06:09:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  add_to_hand ( Hand  * h ,  Card  * c ,  float  deal_speed )  {  
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  c - > order  =  first_open_spot ( h ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 16:45:31 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  h - > cards [ h - > count ]  =  c ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 20:07:22 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  c - > move . position  =  & c - > position ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  c - > move . origin . x  =  c - > position . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  c - > move . origin . y  =  c - > position . y ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  switch  ( h - > display_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  HAND_DISPLAY_ROW : 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c - > move . destination . x  =  h - > position . x  +  ( c - > order  *  ( CARD_WIDTH  +  10 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c - > move . destination . y  =  h - > position . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  HAND_DISPLAY_FIELD : 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c - > move . destination . x  =  h - > position . x  +  ( ( c - > order  /  2 )  *  ( CARD_WIDTH  +  10 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c - > move . destination . y  =  h - > position . y  +  ( c - > order  %  2  *  ( CARD_HEIGHT  +  10 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-10 17:27:02 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  HAND_DISPLAY_DECK : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c - > move . destination . x  =  h - > position . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c - > move . destination . y  =  h - > position . y ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-15 15:48:34 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  case  HAND_DISPLAY_SCORED : 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-22 13:58:22 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c - > move . destination . x  =  h - > position . x  +  ( c - > order  *  ( CARD_WIDTH  -  30 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-15 15:48:34 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    c - > move . destination . y  =  h - > position . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 20:07:22 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  c - > move . curve  =  CURVE_EASE_IN_OUT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  c - > move . current_time  =  0. ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 06:09:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  c - > move . end_time  =  deal_speed ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  h - > count + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 20:07:22 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  card_done_moving ( Card  * c )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  return  c - > move . current_time  >  c - > move . end_time ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 06:09:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  deal ( Hand  * from ,  Hand  * to ,  int  count ,  bool  up ,  float  deal_speed )  {  
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  for  ( int  i  =  0 ;  i  <  count ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 20:07:22 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Card  * c  =  from - > cards [ from - > count  -  1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    c - > visible  =  up ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 06:09:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    add_to_hand ( to ,  c ,  deal_speed ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    from - > count - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2025-02-08 07:33:23 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Rectangle  next_card_position ( Hand  * h )  {  
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  int  i  =  first_open_spot ( h ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 07:33:23 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  return  ( Rectangle )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-19 05:05:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    h - > position . x  +  ( ( i  /  2 )  *  ( CARD_WIDTH  +  10 ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    h - > position . y  +  ( i  %  2  *  ( CARD_HEIGHT  +  10 ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 07:33:23 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    CARD_WIDTH , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    CARD_HEIGHT 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}