Skip to content

Commit e4cf3fc

Browse files
authored
Merge pull request #153 from Sha0den/master
Miscellaneous labels
2 parents 6538bde + d1dd98c commit e4cf3fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+486
-442
lines changed

src/constants/text_constants.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ DEF TX_CTRL_END EQU $10
5050
; wFontWidth constants
5151
DEF FULL_WIDTH EQU $0
5252
DEF HALF_WIDTH EQU $1 ; non-0
53+
54+
; wLineSeparation constants
55+
DEF DOUBLE_SPACED EQU 0
56+
DEF SINGLE_SPACED EQU 1 ; non-0

src/engine/bank20.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ Func_80baa:
13001300
Func_80c64: ; unreferenced
13011301
ld a, [wLineSeparation]
13021302
push af
1303-
ld a, $01 ; no line separator
1303+
ld a, SINGLE_SPACED
13041304
ld [wLineSeparation], a
13051305
; load opponent's name
13061306
ld a, [wOpponentName]

src/engine/challenge_machine.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ChallengeMachine_Reset:
1515
; if a challenge is already in progress, then resume
1616
; otherwise, start a new 5 round challenge
1717
ChallengeMachine_Start::
18-
ld a, 0
18+
ld a, DOUBLE_SPACED
1919
ld [wLineSeparation], a
2020
call LoadConsolePaletteData
2121
call ChallengeMachine_Initialize

src/engine/duel/ai/attacks.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ GetAIScoreOfAttack:
176176
ld a, $50
177177
ld [wAIScore], a
178178

179-
xor a
179+
xor a ; PLAY_AREA_ARENA
180180
ldh [hTempPlayAreaLocation_ff9d], a
181181
call CheckIfSelectedAttackIsUnusable
182182
jr nc, .usable
@@ -254,7 +254,7 @@ GetAIScoreOfAttack:
254254
ld [wTempAI], a
255255
or a
256256
jr z, .no_damage
257-
call CalculateByteTensDigit
257+
call ConvertHPToDamageCounters_Bank5
258258
call AddToAIScore
259259
jr .check_recoil
260260
.no_damage
@@ -292,7 +292,7 @@ GetAIScoreOfAttack:
292292
ld [wDamage], a
293293
call ApplyDamageModifiers_DamageToSelf
294294
ld a, e
295-
call CalculateByteTensDigit
295+
call ConvertHPToDamageCounters_Bank5
296296
call SubFromAIScore
297297

298298
push de
@@ -570,7 +570,7 @@ GetAIScoreOfAttack:
570570
cp 1
571571
jr z, .tally_heal_score
572572
ld a, [wTempAI]
573-
call CalculateByteTensDigit
573+
call ConvertHPToDamageCounters_Bank5
574574
ld b, a
575575
ld a, [wLoadedAttackEffectParam]
576576
cp 3
@@ -581,15 +581,15 @@ GetAIScoreOfAttack:
581581
.asm_16cec
582582
ld a, DUELVARS_ARENA_CARD_HP
583583
call GetTurnDuelistVariable
584-
call CalculateByteTensDigit
584+
call ConvertHPToDamageCounters_Bank5
585585
cp b
586586
jr c, .tally_heal_score
587587
ld a, b
588588
.tally_heal_score
589589
push af
590590
ld e, PLAY_AREA_ARENA
591591
call GetCardDamageAndMaxHP
592-
call CalculateByteTensDigit
592+
call ConvertHPToDamageCounters_Bank5
593593
pop bc
594594
cp b ; wLoadedAttackEffectParam
595595
jr c, .add_heal_score

src/engine/duel/ai/common.asm

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -391,16 +391,26 @@ PickTwoAttachedEnergyCards:
391391
ld a, $ff
392392
ret
393393

394-
; copies $ff terminated buffer from hl to de
395-
CopyBuffer:
394+
; copies an $ff-terminated list from hl to de
395+
; preserves bc
396+
; input:
397+
; hl = address from which to start copying the data
398+
; de = where to copy the data
399+
CopyListWithFFTerminatorFromHLToDE_Bank8:
396400
ld a, [hli]
397401
ld [de], a
398402
cp $ff
399403
ret z
400404
inc de
401-
jr CopyBuffer
405+
jr CopyListWithFFTerminatorFromHLToDE_Bank8
402406

403-
; zeroes a bytes starting at hl
407+
; zeroes a bytes starting from hl.
408+
; this function is identical to 'ClearMemory_Bank2',
409+
; 'ClearMemory_Bank5' and 'ClearMemory_Bank6'.
410+
; preserves all registers
411+
; input:
412+
; a = number of bytes to clear
413+
; hl = where to begin erasing
404414
ClearMemory_Bank8:
405415
push af
406416
push bc
@@ -435,12 +445,13 @@ CountOppEnergyCardsInHand:
435445
or a
436446
ret
437447

438-
; converts HP in a to number of equivalent damage counters
448+
; converts an HP value or amount of damage to the number of equivalent damage counters
449+
; preserves all registers except af
439450
; input:
440-
; a = HP
451+
; a = HP value to convert
441452
; output:
442453
; a = number of damage counters
443-
ConvertHPToCounters:
454+
ConvertHPToDamageCounters_Bank8:
444455
push bc
445456
ld c, 0
446457
.loop
@@ -493,10 +504,10 @@ CalculateBDividedByA_Bank8:
493504
; input:
494505
; a = CARD_LOCATION_*
495506
; e = card ID to look for
496-
LookForCardIDInLocation:
507+
LookForCardIDInLocation_Bank8:
497508
ld b, a
498509
ld c, e
499-
lb de, $00, 0 ; d is never used
510+
lb de, 0, 0 ; d is never used
500511
.loop
501512
ld a, DUELVARS_CARD_LOCATIONS
502513
add e
@@ -574,7 +585,7 @@ LookForCardIDInDeck_GivenCardIDInHandAndPlayArea:
574585
; look for the card ID 1 in deck
575586
ld e, a
576587
ld a, CARD_LOCATION_DECK
577-
call LookForCardIDInLocation
588+
call LookForCardIDInLocation_Bank8
578589
ret nc
579590

580591
; was found, store its deck index in memory
@@ -641,7 +652,7 @@ LookForCardIDInDeck_GivenCardIDInHand:
641652
; look for the card ID 1 in deck
642653
ld e, a
643654
ld a, CARD_LOCATION_DECK
644-
call LookForCardIDInLocation
655+
call LookForCardIDInLocation_Bank8
645656
ret nc
646657

647658
; was found, store its deck index in memory
@@ -684,22 +695,22 @@ LookForCardIDInPlayArea_Bank8:
684695
call GetTurnDuelistVariable
685696
cp $ff
686697
ret z
687-
688698
call LoadCardDataToBuffer1_FromDeckIndex
689699
ld c, a
690700
ld a, [wTempCardIDToLook]
691701
cp c
692-
jr z, .is_same
693-
702+
jr z, .found
694703
inc b
695704
ld a, MAX_PLAY_AREA_POKEMON
696705
cp b
697706
jr nz, .loop
707+
708+
; not found
698709
ld b, $ff
699710
or a
700711
ret
701712

702-
.is_same
713+
.found
703714
ld a, b
704715
scf
705716
ret
@@ -807,7 +818,7 @@ LookForCardIDToTradeWithDifferentHandCard:
807818
ld a, [wTempAI]
808819
ld e, a
809820
ld a, CARD_LOCATION_DECK
810-
call LookForCardIDInLocation
821+
call LookForCardIDInLocation_Bank8
811822
jr nc, .no_carry
812823

813824
; store its deck index

0 commit comments

Comments
 (0)