Prev: 38604 Up: Map Next: 38686
38609: 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 38609 LD A,(38043) A=*TableHandEvaluation_Type.
38612 LD HL,38686 HL=OutcomeTypes.
38615 LD B,4 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 38617 CP (HL) Return if the current hand has a positive outcome type.
38618 RET Z
38619 INC HL Increment the outcomes pointer by one.
38620 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).
38622 CALL GetRandomNumber Call GetRandomNumber.
38625 CP 10 Jump to FindCardsToMark if the random number is lower than 10.
38627 JR C,FindCardsToMark
Two pairs is also somewhat of a "special" outcome, so handle it separately.
38629 LD A,(38043) Jump to FindLowestSingleCard if *TableHandEvaluation_Type is equal to "Two Pairs".
38632 CP 3
38634 JR Z,FindLowestSingleCard
Handle all other cases.
FindCardsToMark 38636 LD A,(38044) Fetch the "special" card from *TableHandEvaluation_BaseCard and store it in D.
38639 LD D,A
38640 LD HL,38604 HL=GirlsHand.
38643 LD B,5 Set a counter in B for the total number of cards in a hand.
38645 LD C,3 Set a counter in C of 3 this is how many cards we want to select to be redrawn.
FindCardsToMark_Loop 38647 LD A,(HL) Fetch the card.
38648 AND %00001111 Convert it into a suit-less value (by keeping only bits 0-3).
38650 CP D If this card is the "special card" stored in D, jump to FindCardsToMark_Next.
38651 JR Z,FindCardsToMark_Next
Set the card in the hand to be redrawn.
38653 LD (HL),255 Write 255 to *HL.
38655 DEC C Decrease the selection counter by one.
38656 RET Z Return if the selection counter is zero.
FindCardsToMark_Next 38657 INC HL Increment the girls hand pointer by one.
38658 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.
38660 RET Return.
Find the lowest card value which doesn't have any duplicates.
FindLowestSingleCard 38661 LD HL,38207 HL=38207 (e.g. Table_CardDuplicates-1).
FindLowestSingleCard_Loop 38664 INC HL Increment duplicate table pointer by one.
38665 LD A,(HL) Fetch the duplicate count value.
38666 DEC A Keep jumping back to FindLowestSingleCard_Loop if there's more than one of this value in the hand.
38667 JR NZ,FindLowestSingleCard_Loop
The card is a single and has no other duplicate face values in the hand.
38669 CALL CalculateCard Call CalculateCard to convert the position in the duplicate count table to a card value.
38672 LD D,A Store the card value in D.
38673 LD HL,38603 HL=38603 (e.g. GirlsHand-1).
FindCard_Loop 38676 INC HL Increment the girls hand pointer by one.
38677 LD A,(HL) Fetch the card.
38678 AND %00001111 Convert it into a suit-less value (by keeping only bits 0-3).
38680 CP D Keep jumping back to FindCard_Loop until this card matches the stored card value in D.
38681 JR NZ,FindCard_Loop
Set the card in the hand to be redrawn.
38683 LD (HL),255 Write 255 to *HL.
38685 RET Return.
Prev: 38604 Up: Map Next: 38686