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-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# ifndef _HF_CARD_ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define _HF_CARD_ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <stdbool.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <raylib.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 20:07:22 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "move.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								typedef  struct  Card  Card ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 06:40:33 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								typedef  struct  Hand  Hand ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 10:21:49 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# define CARD_WIDTH 73 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define CARD_HEIGHT 120 
 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 07:33:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# define CARD_BORDER 5 
 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-04 18:47:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# define CRANE_INDEX 0 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define CURTAIN_INDEX 8 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define MOON_INDEX 28 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RAINY_MAN_INDEX 40 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define PHOENIX_INDEX 44 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								typedef  enum  CardType  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  CHAFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  RIBBON , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  ANIMAL , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  BRIGHT , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  CardType ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								typedef  enum  RibbonType  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  RIBBON_NONE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  RIBBON_PLAIN , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  RIBBON_BLUE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  RIBBON_POETRY , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  RibbonType ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 06:40:33 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								typedef  enum  Month  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  JANUARY , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  FEBRUARY , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  MARCH , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  APRIL , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  MAY , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  JUNE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  JULY , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  AUGUST , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  SEPTEMBER , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  OCTOBER , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  NOVEMBER , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  DECEMBER 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  Month ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								struct  Card  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  int  index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  CardType  type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  RibbonType  ribbon_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 06:40:33 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  Month  month ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								  Vector2  position ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 07:51:53 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  bool  selected ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  bool  visible ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 20:07:22 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  Move  move ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 16:45:31 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  int  order ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								typedef  enum  HandDisplayType  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  HAND_DISPLAY_ROW , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  HAND_DISPLAY_FIELD , 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-10 17:27:02 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  HAND_DISPLAY_DECK , 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-15 15:48:34 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  HAND_DISPLAY_SCORED , 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}  HandDisplayType ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 06:40:33 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								struct  Hand  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 18:13:19 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  Card  * cards [ 48 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 06:40:33 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  int  count ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 19:07:49 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  Vector2  position ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:19:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  HandDisplayType  display_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 06:40:33 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 17:28:13 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  draw_card ( Card  * c ,  Texture2D  * cards_texture ,  int  index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 11:12:07 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  point_within_card ( Card  * c ,  Vector2  v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 18:30:45 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  shuffle_hand ( Hand  * h ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 06:09:57 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  deal ( Hand  * from ,  Hand  * to ,  int  count ,  bool  up ,  float  deal_speed ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 16:45:31 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  remove_from_hand ( Hand  * h ,  Card  * c ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-23 06:09:57 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  add_to_hand ( Hand  * h ,  Card  * c ,  float  deal_speed ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-03 20:07:22 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  card_done_moving ( Card  * c ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 07:33:23 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Rectangle  next_card_position ( Hand  * h ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-01 05:36:42 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif