Prev: 96CC Up: Map Next: 971E
96D1: Girl Mark Cards
Used by the routine at PlayGame.
The hand has been "evaluated" at this point, so don't do anything if there is already a chance of winning.
GirlMarkCards 96D1 LD A,($949B) A=*TableHandEvaluation_Type.
96D4 LD HL,$971E HL=OutcomeTypes.
96D7 LD B,$04 Set a counter in B of the number of game "outcome" types we want to check against.
Loop through each outcome type and see if the current hand contains this outcome.
CheckOutcomes_Loop 96D9 CP (HL) Return if the current hand has a positive outcome type.
96DA RET Z
96DB INC HL Increment the outcomes pointer by one.
96DC DJNZ CheckOutcomes_Loop Decrease counter by one and loop back to CheckOutcomes_Loop until counter is zero.
The girls hand has no cards which form one of the "special" outcomes (special, as in, which aren't able to be found by counting duplicate card face values).
96DE CALL GetRandomNumber Call GetRandomNumber.
96E1 CP $0A Jump to FindCardsToMark if the random number is lower than 0A.
96E3 JR C,FindCardsToMark
Two pairs is also somewhat of a "special" outcome, so handle it separately.
96E5 LD A,($949B) Jump to FindLowestSingleCard if *TableHandEvaluation_Type is equal to "Two Pairs".
96E8 CP $03
96EA JR Z,FindLowestSingleCard
Handle all other cases.
FindCardsToMark 96EC LD A,($949C) Fetch the "special" card from *TableHandEvaluation_BaseCard and store it in D.
96EF LD D,A
96F0 LD HL,$96CC HL=GirlsHand.
96F3 LD B,$05 Set a counter in B for the total number of cards in a hand.
96F5 LD C,$03 Set a counter in C of 03 this is how many cards we want to select to be redrawn.
FindCardsToMark_Loop 96F7 LD A,(HL) Fetch the card.
96F8 AND %00001111 Convert it into a suit-less value (by keeping only bits 0-3).
96FA CP D If this card is the "special card" stored in D, jump to FindCardsToMark_Next.
96FB JR Z,FindCardsToMark_Next
Set the card in the hand to be redrawn.
96FD LD (HL),$FF Write FF to *HL.
96FF DEC C Decrease the selection counter by one.
9700 RET Z Return if the selection counter is zero.
FindCardsToMark_Next 9701 INC HL Increment the girls hand pointer by one.
9702 DJNZ FindCardsToMark_Loop Decrease the card counter by one and loop back to FindCardsToMark_Loop until the counter is zero and all cards in the hand have been checked.
9704 RET Return.
Find the lowest card value which doesn't have any duplicates.
FindLowestSingleCard 9705 LD HL,$953F HL=953F (e.g. Table_CardDuplicates-01).
FindLowestSingleCard_Loop 9708 INC HL Increment duplicate table pointer by one.
9709 LD A,(HL) Fetch the duplicate count value.
970A DEC A Keep jumping back to FindLowestSingleCard_Loop if there's more than one of this value in the hand.
970B JR NZ,FindLowestSingleCard_Loop
The card is a single and has no other duplicate face values in the hand.
970D CALL CalculateCard Call CalculateCard to convert the position in the duplicate count table to a card value.
9710 LD D,A Store the card value in D.
9711 LD HL,$96CB HL=96CB (e.g. GirlsHand-01).
FindCard_Loop 9714 INC HL Increment the girls hand pointer by one.
9715 LD A,(HL) Fetch the card.
9716 AND %00001111 Convert it into a suit-less value (by keeping only bits 0-3).
9718 CP D Keep jumping back to FindCard_Loop until this card matches the stored card value in D.
9719 JR NZ,FindCard_Loop
Set the card in the hand to be redrawn.
971B LD (HL),$FF Write FF to *HL.
971D RET Return.
Prev: 96CC Up: Map Next: 971E