diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/constants/duel_constants.asm | 37 | ||||
| -rw-r--r-- | src/constants/gfx_constants.asm | 24 | ||||
| -rw-r--r-- | src/engine/bank1.asm | 16 | ||||
| -rw-r--r-- | src/engine/bank3.asm | 6 | ||||
| -rw-r--r-- | src/engine/bank4.asm | 6 | ||||
| -rw-r--r-- | src/engine/home.asm | 58 | ||||
| -rw-r--r-- | src/gfx.asm | 4 | ||||
| -rw-r--r-- | src/macros/wram.asm | 24 | 
8 files changed, 96 insertions, 79 deletions
| diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index ee964b3..4994c0c 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -1,14 +1,28 @@ -DECK_NAME_SIZE   EQU  24 -DECK_SIZE        EQU  60 -BENCH_SIZE       EQU   5 +DECK_NAME_SIZE      EQU 24 +DECK_SIZE           EQU 60 +BENCH_SIZE          EQU 5 +MAX_POKEMON_IN_PLAY EQU 6 ; arena + bench -PLAYER_TURN   EQUS "wPlayerDuelVariables >> $8" -OPPONENT_TURN EQUS "wOpponentDuelVariables >> $8" +; hWhoseTurn constants +PLAYER_TURN   EQUS "HIGH(wPlayerDuelVariables)" +OPPONENT_TURN EQUS "HIGH(wOpponentDuelVariables)" +; wDuelFinished constants  DUEL_WON  EQU $1  DUEL_LOST EQU $2  DUEL_DRAW EQU $3 +; Box message id's +	const_def +	const BOXMSG_PLAYERS_TURN +	const BOXMSG_OPPONENTS_TURN +	const BOXMSG_BETWEEN_TURNS +	const BOXMSG_DECISION +	const BOXMSG_BENCH_POKEMON +	const BOXMSG_ARENA_POKEMON +	const BOXMSG_COIN_TOSS + +; wPlayerDuelVariables or wOpponentDuelVariables constants  DUELVARS_CARD_LOCATIONS                  EQUS "wPlayerCardLocations & $ff"              ; 00  DUELVARS_HAND                            EQUS "wPlayerHand & $ff"                       ; 42  DUELVARS_DECK_CARDS                      EQUS "wPlayerDeckCards & $ff"                  ; 7e @@ -34,7 +48,7 @@ DUELVARS_ARENA_CARD_STATUS               EQUS "wPlayerArenaCardStatus & $ff"  DUELVARS_DUELIST_TYPE                    EQUS "wPlayerDuelistType & $ff"                ; f1  DUELVARS_ARENA_CARD_DISABLED_MOVE_INDEX  EQUS "wPlayerArenaCardDisabledMoveIndex & $ff" ; f2 -;;; card locations +; card location constants (DUELVARS_CARD_LOCATIONS)  CARD_LOCATION_DECK         EQU $00  CARD_LOCATION_HAND         EQU $01  CARD_LOCATION_DISCARD_PILE EQU $02 @@ -47,15 +61,12 @@ CARD_LOCATION_BENCH_4      EQU $14  CARD_LOCATION_BENCH_5      EQU $15  CARD_LOCATION_JUST_DRAWN   EQU $40 -;;; duelist types +; duelist types (DUELVARS_DUELIST_TYPE)  DUELIST_TYPE_PLAYER   EQU $00  DUELIST_TYPE_LINK_OPP EQU $01  DUELIST_TYPE_AI_OPP   EQU $80 -;;; constant values -MAX_POKEMON_IN_PLAY EQU $06 - -;;; status conditions +; status conditions (DUELVARS_ARENA_CARD_STATUS)  ; two statuses can be combined if they are identified by a different nybble  NO_STATUS       EQU $00  CONFUSED        EQU $01 @@ -66,7 +77,7 @@ DOUBLE_POISONED EQU $c0  PASSIVE_STATUS_MASK  EQU $f ; confused, asleep or paralyzed -;;; substatus conditions +; substatus conditions (DUELVARS_ARENA_CARD_SUBSTATUS*)  SUBSTATUS1_AGILITY      EQU $0c  SUBSTATUS1_FLY          EQU $0d  SUBSTATUS1_HARDEN       EQU $0e @@ -94,7 +105,7 @@ SUBSTATUS2_GROWL          EQU $12  SUBSTATUS5_THIS_TURN_DOUBLE_DAMAGE EQU 0 -;;; wNoDamageOrEffect constants +; wNoDamageOrEffect constants  NO_DAMAGE_OR_EFFECT_AGILITY      EQU $01  NO_DAMAGE_OR_EFFECT_BARRIER      EQU $02  NO_DAMAGE_OR_EFFECT_FLY          EQU $03 diff --git a/src/constants/gfx_constants.asm b/src/constants/gfx_constants.asm index 4cc72f5..2ddb8ae 100644 --- a/src/constants/gfx_constants.asm +++ b/src/constants/gfx_constants.asm @@ -17,20 +17,20 @@ SPRITE_ANIM_BUFFER_CAPACITY EQU 16 ; sprites  ; sprite_anim_struct constants  	const_def -	const SPRITE_ANIM_PROPERTY_1 -	const SPRITE_ANIM_PROPERTY_2 +	const SPRITE_ANIM_FIELD_00 +	const SPRITE_ANIM_FIELD_01  	const SPRITE_ANIM_COORD_X  	const SPRITE_ANIM_COORD_Y  	const SPRITE_ANIM_TILE_ID -	const SPRITE_ANIM_PROPERTY_6 -	const SPRITE_ANIM_PROPERTY_7 -	const SPRITE_ANIM_PROPERTY_8 -	const SPRITE_ANIM_PROPERTY_9 -	const SPRITE_ANIM_PROPERTY_10 -	const SPRITE_ANIM_PROPERTY_11 -	const SPRITE_ANIM_PROPERTY_12 -	const SPRITE_ANIM_PROPERTY_13 -	const SPRITE_ANIM_PROPERTY_14 +	const SPRITE_ANIM_FIELD_05 +	const SPRITE_ANIM_FIELD_06 +	const SPRITE_ANIM_FIELD_07 +	const SPRITE_ANIM_FIELD_08 +	const SPRITE_ANIM_FIELD_09 +	const SPRITE_ANIM_FIELD_0A +	const SPRITE_ANIM_FIELD_0B +	const SPRITE_ANIM_FIELD_0C +	const SPRITE_ANIM_FIELD_0D  	const SPRITE_ANIM_MOVEMENT_COUNTER -	const SPRITE_ANIM_PROPERTY_16 +	const SPRITE_ANIM_FIELD_0F  SPRITE_ANIM_LENGTH EQU const_value
\ No newline at end of file diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 5be8768..eedb048 100644 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -163,8 +163,8 @@ StartDuel: ; 409f (1:409f)  .duel_finished  	call $5990  	call Func_04a2 -	ld a, $3 -	call Func_2167 +	ld a, BOXMSG_DECISION +	call DrawDuelBoxMessage  	ldtx hl, DecisionText  	call DrawWideTextBox_WaitForInput  	call Func_04a2 @@ -1060,8 +1060,8 @@ Func_4b60: ; 4b60 (1:4b60)  	call $7133  	call SwapTurn  	call Func_04a2 -	ld a, $6 -	call Func_2167 +	ld a, BOXMSG_COIN_TOSS +	call DrawDuelBoxMessage  	ld hl, $0075  	call DrawWideTextBox_WaitForInput  	ld a, [$ff97] @@ -1146,8 +1146,8 @@ Func_4cd5: ; 4cd5 (1:4cd5)  .asm_4d15  	call Func_04a2 -	ld a, $5 -	call Func_2167 +	ld a, BOXMSG_ARENA_POKEMON +	call DrawDuelBoxMessage  	ld hl, $0069  	call DrawWideTextBox_WaitForInput  	ld a, $1 @@ -1171,8 +1171,8 @@ Func_4cd5: ; 4cd5 (1:4cd5)  .asm_4d4c  	call Func_04a2 -	ld a, $4 -	call Func_2167 +	ld a, BOXMSG_BENCH_POKEMON +	call DrawDuelBoxMessage  	ld hl, $006d  	call Func_2c73  	ld a, $3 diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm index b1fe932..c5e2fb4 100644 --- a/src/engine/bank3.asm +++ b/src/engine/bank3.asm @@ -680,7 +680,7 @@ Func_c58b: ; c58b (3:458b)  	call GetFloorObjectFromPos  	and $10  	push af -	ld c, SPRITE_ANIM_PROPERTY_16 +	ld c, SPRITE_ANIM_FIELD_0F  	call GetSpriteAnimBufferProperty  	pop af  	ld a, [hl] @@ -788,7 +788,7 @@ AttemptScriptedMovement: ; c619 (3:4619)  	ld [wd335], a  	ld a, $10  	ld [wd338], a -	ld c, SPRITE_ANIM_PROPERTY_16 +	ld c, SPRITE_ANIM_FIELD_0F  	call GetSpriteAnimBufferProperty  	set 2, [hl]  	ld c, SPRITE_ANIM_MOVEMENT_COUNTER @@ -918,7 +918,7 @@ Func_c6dc: ; c6dc (3:46dc)  Func_c6f7: ; c6f7 (3:46f7)  	ld a, [wd336]  	ld [wWhichSprite], a -	ld c, SPRITE_ANIM_PROPERTY_16 +	ld c, SPRITE_ANIM_FIELD_0F  	call GetSpriteAnimBufferProperty  	res 2, [hl]  	ld c, SPRITE_ANIM_MOVEMENT_COUNTER diff --git a/src/engine/bank4.asm b/src/engine/bank4.asm index 42cfdac..5aed479 100644 --- a/src/engine/bank4.asm +++ b/src/engine/bank4.asm @@ -533,7 +533,7 @@ Func_10fde: ; 10fde (4:4fde)  	farcall CheckIfEventFlagSet  	or a  	jr nz, .asm_11015 -	ld c, SPRITE_ANIM_PROPERTY_16 +	ld c, SPRITE_ANIM_FIELD_0F  	call GetSpriteAnimBufferProperty  	set 7, [hl]  .asm_11015 @@ -552,7 +552,7 @@ Func_11024: ; 11024 (4:5024)  	call PlaySFX  	ld a, [wd336]  	ld [wWhichSprite], a -	ld c, SPRITE_ANIM_PROPERTY_16 +	ld c, SPRITE_ANIM_FIELD_0F  	call GetSpriteAnimBufferProperty  	set 2, [hl]  	ld hl, Unknown_1229f @@ -1253,7 +1253,7 @@ Func_12a21: ; 12a21 (4:6a21)  Func_12ab5: ; 12ab5 (4:6ab5)  	push hl  	push af -	ld c, SPRITE_ANIM_PROPERTY_6 +	ld c, SPRITE_ANIM_FIELD_05  	call GetSpriteAnimBufferProperty  	pop af  	cp [hl] diff --git a/src/engine/home.asm b/src/engine/home.asm index beabbfc..0040051 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1122,7 +1122,7 @@ CopyDataHLtoDE: ; 073c (0:073c)  	ret  ; switch to rombank (A + top2 of H shifted down), -; set top2 of H to 01, +; set top2 of H to 01 (switchable ROM bank area),  ; return old rombank id on top-of-stack  BankpushHome: ; 0745 (0:0745)  	push hl @@ -4293,23 +4293,23 @@ Func_1f5f: ; 1f5f (0:1f5f)  	INCROM $1f96, $20b0  Func_20b0: ; 20b0 (0:20b0) -	ld hl, $2fe8 +	ld hl, DuelGraphics + $680 - $4000  	ld a, [wConsole]  	cp CONSOLE_CGB  	jr nz, .asm_20bd -	ld hl, $37f8 +	ld hl, DuelGraphics + $e90 - $4000  .asm_20bd  	ld de, vTiles1 + $500  	ld b, $30  	jr CopyFontsOrDuelGraphicsTiles  Func_20c4: ; 20c4 (0:20c4) -	ld hl, $3028 +	ld hl, DuelGraphics + $6c0 - $4000  	ld a, [wConsole]  	cp CONSOLE_CGB -	jr nz, .asm_20d1 -	ld hl, $3838 -.asm_20d1 +	jr nz, .copy +	ld hl, DuelGraphics + $ed0 - $4000 +.copy  	ld de, vTiles1 + $540  	ld b, $c  	jr CopyFontsOrDuelGraphicsTiles @@ -4321,32 +4321,32 @@ Func_20d8: ; 20d8 (0:20d8)  Func_20dc: ; 20dc (0:20dc)  	ld b, $24  asm_20de -	ld hl, $32e8 +	ld hl, DuelGraphics + $980 - $4000  	ld a, [wConsole]  	cp CONSOLE_CGB -	jr nz, .asm_20eb -	ld hl, $3af8 -.asm_20eb +	jr nz, .copy +	ld hl, DuelGraphics + $1190 - $4000 +.copy  	ld de, vTiles1 + $500  	jr CopyFontsOrDuelGraphicsTiles  Func_20f0: ; 20f0 (0:20f0) -	ld hl, $4008 +	ld hl, Fonts + $8  	ld de, vTiles1 + $200  	ld b, $d  	call CopyFontsOrDuelGraphicsTiles -	ld hl, $3528 +	ld hl, DuelGraphics + $bc0 - $4000  	ld a, [wConsole]  	cp CONSOLE_CGB -	jr nz, .asm_2108 -	ld hl, $3d38 -.asm_2108 +	jr nz, .copy +	ld hl, DuelGraphics + $13d0 - $4000 +.copy  	ld de, vTiles1 + $500  	ld b, $30  	jr CopyFontsOrDuelGraphicsTiles  Func_210f: ; 210f (0:210f) -	ld hl, $40d8 +	ld hl, DuelGraphics + $1770 - $4000  	ld de, vTiles2 + $300  	ld b, $8  	jr CopyFontsOrDuelGraphicsTiles @@ -4357,7 +4357,10 @@ Func_2119: ; 2119 (0:2119)  	ld b, $38 ; number of tiles  ;	fallthrough -; copy b tiles from BANK(Fonts):hl to de +; if hl ≤ $3fff +;   copy b tiles from Gfx1:hl to de +; if $4000 ≤ hl ≤ $7fff +;   copy b tiles from Gfx2:hl to de  CopyFontsOrDuelGraphicsTiles:  	ld a, BANK(Fonts); BANK(DuelGraphics); BANK(VWF)  	call BankpushHome @@ -4369,15 +4372,16 @@ CopyFontsOrDuelGraphicsTiles:  	INCROM $212f, $2167 -Func_2167: ; 2167 (0:2167) +DrawDuelBoxMessage: ; 2167 (0:2167)  	ld l, a -	ld h, $a0 +	ld h, (40 * TILE_SIZE) / 4 ; boxes are 10x4 tiles  	call HtimesL  	add hl, hl  	add hl, hl -	ld de, $4318 +	; hl = a * $280 +	ld de, DuelBoxMessages  	add hl, de -	ld de, $8a00 +	ld de, vTiles1 + $200  	ld b, $28  	call CopyFontsOrDuelGraphicsTiles  	ld a, $a0 @@ -4943,7 +4947,7 @@ Func_2518: ; 2518 (0:2518)  	ret  Func_252e: ; 252e (0:252e) -	ld a, $1d +	ld a, BANK(Fonts); BANK(DuelGraphics); BANK(VWF)  	call BankpushHome  	ld de, $ccf4  	push de @@ -6064,7 +6068,7 @@ Func_2f32: ; 2f32 (0:2f32)  	push hl  	call GetCardPointer  	jr c, .asm_2f43 -	ld a, $c +	ld a, BANK(CardPointers)  	call BankpushHome2  	ld l, [hl]  	call BankpopHome @@ -6078,7 +6082,7 @@ Func_2f45: ; 2f45 (0:2f45)  	push hl  	call GetCardPointer  	jr c, .asm_2f5b -	ld a, $c +	ld a, BANK(CardPointers)  	call BankpushHome2  	ld de, $0003  	add hl, de @@ -6100,7 +6104,7 @@ GetCardHeader: ; 2f5d (0:2f5d)  	ld e, a  	call GetCardPointer  	jr c, .card_not_found -	ld a, $0c +	ld a, BANK(CardPointers)  	call BankpushHome2  	ld e, [hl]  	ld bc, $5 @@ -8037,7 +8041,7 @@ Func_3d72: ; 3d72 (0:3d72)  Func_3db7: ; 3db7 (0:3db7)  	push bc -	ld c, SPRITE_ANIM_PROPERTY_1 +	ld c, SPRITE_ANIM_FIELD_00  	call GetSpriteAnimBufferProperty  	pop bc  	ret diff --git a/src/gfx.asm b/src/gfx.asm index 85d954f..67be845 100644 --- a/src/gfx.asm +++ b/src/gfx.asm @@ -14,6 +14,8 @@ INCBIN "gfx/duel/duel1.t5.2bpp", $0, $1698  SECTION "Gfx 2", ROMX  INCBIN "gfx/duel/duel1.t5.2bpp", $1698, $318 + +DuelBoxMessages:: ; 78318 (1e:4318)  INCBIN "gfx/duel/duel2.2bpp"  rept $2b68 @@ -95,7 +97,7 @@ Unnamed3Gfx: ; 8bfd2 (22:7fd2)  	dw $1  	INCBIN "gfx/unnamed/3.2bpp" -	INCROM $8bfe4, $8C000 +	INCROM $8bfe4, $8c000  SECTION "Gfx 5", ROMX diff --git a/src/macros/wram.asm b/src/macros/wram.asm index 55d32ad..9a7ffc2 100644 --- a/src/macros/wram.asm +++ b/src/macros/wram.asm @@ -43,20 +43,20 @@ ENDM  ; TODO: Figure out what the rest are for  sprite_anim_struct: MACRO -\1Property1::  ds 1 -\1Property2::  ds 1 ; movement handling / palette +\1Field0x00::  ds 1 +\1Field0x01::  ds 1 ; movement handling / palette  \1CoordX::     db  \1CoordY::     db  \1TileID::     db -\1Property6::  ds 1 -\1Property7::  ds 1 -\1Property8::  ds 1 -\1Property9::  ds 1 -\1Property10::  ds 1 -\1Property11::  ds 1 -\1Property12::  ds 1 -\1Property13::  ds 1 -\1Property14::  ds 1 +\1Field0x05::  ds 1 +\1Field0x06::  ds 1 +\1Field0x07::  ds 1 +\1Field0x08::  ds 1 +\1Field0x09::  ds 1 +\1Field0x0a::  ds 1 +\1Field0x0b::  ds 1 +\1Field0x0c::  ds 1 +\1Field0x0d::  ds 1  \1MovementCounter::  ds 1 -\1Property16::  ds 1 +\1Field0x0f::  ds 1  ENDM
\ No newline at end of file | 
