Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pret/pokered
Browse files Browse the repository at this point in the history
  • Loading branch information
dannye committed Sep 25, 2024
2 parents 3f0da3d + d5ee4fd commit a02a98e
Show file tree
Hide file tree
Showing 287 changed files with 2,580 additions and 2,463 deletions.
17 changes: 9 additions & 8 deletions audio/engine_1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Audio1_UpdateMusic::
ld a, [wMuteAudioAndPauseMusic]
and a
jr z, .applyAffects
bit 7, a
bit BIT_MUTE_AUDIO, a
jr nz, .nextChannel
set 7, a
set BIT_MUTE_AUDIO, a
ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output
ldh [rNR51], a
Expand Down Expand Up @@ -161,7 +161,7 @@ Audio1_PlayNextNote:
cp $4
jr nz, .asm_918c
ld a, [wLowHealthAlarm]
bit 7, a
bit BIT_LOW_HEALTH_ALARM, a
jr z, .asm_918c
call Audio1_EnableChannelOutput
ret
Expand Down Expand Up @@ -206,7 +206,7 @@ Audio1_sound_ret:
.dontDisable
jr .afterDisable
.returnFromCall
res 1, [hl]
res BIT_SOUND_CALL, [hl]
ld d, $0
ld a, c
add a
Expand Down Expand Up @@ -386,8 +386,8 @@ Audio1_toggle_perfect_pitch:
ld hl, wChannelFlags1
add hl, bc
ld a, [hl]
xor $1
ld [hl], a ; flip bit 0 of wChannelFlags1
xor 1 << BIT_PERFECT_PITCH
ld [hl], a
jp Audio1_sound_ret

Audio1_vibrato:
Expand Down Expand Up @@ -841,7 +841,8 @@ Audio1_note_pitch:
bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used?
jr z, .skipFrequencyInc
inc e ; if yes, increment the frequency by 1
jr nc, .skipFrequencyInc
jr nc, .skipFrequencyInc ; Likely a mistake, because `inc` does not set flag C.
; Fortunately this does not seem to affect any notes that actually occur.
inc d
.skipFrequencyInc
ld hl, wChannelFrequencyLowBytes
Expand Down Expand Up @@ -971,7 +972,7 @@ Audio1_ApplyWavePatternAndFrequency:
cp $4
ret nz
ld a, [wLowHealthAlarm]
bit 7, a
bit BIT_LOW_HEALTH_ALARM, a
ret z
xor a
ld [wFrequencyModifier], a
Expand Down
4 changes: 2 additions & 2 deletions audio/engine_2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ INCLUDE "audio/sfx/pokeflute_ch5_ch6.asm"

Audio2_InitMusicVariables::
xor a
ld [wUnusedC000], a
ld [wUnusedMusicByte], a
ld [wDisableChannelOutputWhenSfxEnds], a
ld [wMusicTempo + 1], a
ld [wMusicWaveInstrument], a
Expand Down Expand Up @@ -376,7 +376,7 @@ Audio2_StopAllAudio::
ld a, $77
ldh [rNR50], a ; full volume
xor a
ld [wUnusedC000], a
ld [wUnusedMusicByte], a
ld [wDisableChannelOutputWhenSfxEnds], a
ld [wMuteAudioAndPauseMusic], a
ld [wMusicTempo + 1], a
Expand Down
14 changes: 7 additions & 7 deletions audio/low_health_alarm.asm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Music_DoLowHealthAlarm::
ld a, [wLowHealthAlarm]
cp $ff
cp DISABLE_LOW_HEALTH_ALARM
jr z, .disableAlarm

bit 7, a ;alarm enabled?
ret z ;nope
bit BIT_LOW_HEALTH_ALARM, a
ret z

and $7f ;low 7 bits are the timer.
and LOW_HEALTH_TIMER_MASK
jr nz, .notToneHi ;if timer > 0, play low tone.

call .playToneHi
Expand All @@ -19,15 +19,15 @@ Music_DoLowHealthAlarm::
call .playToneLo ;actually set the sound registers.

.noTone
ld a, $86
ld a, CRY_SFX_END
ld [wChannelSoundIDs + CHAN5], a ;disable sound channel?
ld a, [wLowHealthAlarm]
and $7f ;decrement alarm timer.
and LOW_HEALTH_TIMER_MASK
dec a

.resetTimer
; reset the timer and enable flag.
set 7, a
set BIT_LOW_HEALTH_ALARM, a
ld [wLowHealthAlarm], a
ret

Expand Down
8 changes: 8 additions & 0 deletions constants/audio_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ DEF HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff)

; wChannelFlags2 constant (only has one flag)
DEF BIT_EXECUTE_MUSIC EQU 0 ; if in execute music

; wMuteAudioAndPauseMusic
DEF BIT_MUTE_AUDIO EQU 7

; wLowHealthAlarm
DEF BIT_LOW_HEALTH_ALARM EQU 7
DEF LOW_HEALTH_TIMER_MASK EQU %01111111
DEF DISABLE_LOW_HEALTH_ALARM EQU $ff
13 changes: 7 additions & 6 deletions constants/battle_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ DEF MOVE_ACC rb
DEF MOVE_PP rb
DEF MOVE_LENGTH EQU _RS

; D733 flags
DEF BIT_TEST_BATTLE EQU 0

; battle type constants (wBattleType values)
const_def
const BATTLE_TYPE_NORMAL ; 0
Expand Down Expand Up @@ -77,10 +74,14 @@ DEF MAX_STAT_VALUE EQU 999
DEF ATKDEFDV_TRAINER EQU $98
DEF SPDSPCDV_TRAINER EQU $88

; wDamageMultipliers
DEF BIT_STAB_DAMAGE EQU 7
DEF EFFECTIVENESS_MASK EQU %01111111

; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags
const_def
const STORING_ENERGY ; 0 ; Bide
const THRASHING_ABOUT ; 1 ; e.g. Thrash
const THRASHING_ABOUT ; 1 ; Thrash, Petal Dance
const ATTACKING_MULTIPLE_TIMES ; 2 ; e.g. Double Kick, Fury Attack
const FLINCHED ; 3
const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly
Expand All @@ -97,11 +98,11 @@ DEF SPDSPCDV_TRAINER EQU $88
const HAS_SUBSTITUTE_UP ; 4
const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam
const USING_RAGE ; 6
const SEEDED ; 7
const SEEDED ; 7 ; Leech Seed

; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags
const_def
const BADLY_POISONED ; 0
const BADLY_POISONED ; 0 ; Toxic
const HAS_LIGHT_SCREEN_UP ; 1
const HAS_REFLECT_UP ; 2
const TRANSFORMED ; 3
6 changes: 6 additions & 0 deletions constants/gfx_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ DEF TRANSFERBOTTOM EQU 2
DEF REDRAW_COL EQU 1
DEF REDRAW_ROW EQU 2

; hUILayoutFlags
const_def
const BIT_PARTY_MENU_HP_BAR ; 0
const BIT_DOUBLE_SPACED_MENU ; 1
const BIT_SINGLE_SPACED_LINES ; 2

; tile list ids
; TileIDListPointerTable indexes (see data/tilemaps.asm)
const_def
Expand Down
15 changes: 13 additions & 2 deletions constants/hardware_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ DEF rWave_d EQU $ff3d
DEF rWave_e EQU $ff3e
DEF rWave_f EQU $ff3f
DEF rLCDC EQU $ff40 ; LCD Control (R/W)
DEF rLCDC_ENABLE EQU 7
DEF rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE
DEF rLCDC_BG_PRIORITY EQU 0
DEF rLCDC_SPRITES_ENABLE EQU 1
DEF rLCDC_SPRITE_SIZE EQU 2
DEF rLCDC_BG_TILEMAP EQU 3
DEF rLCDC_TILE_DATA EQU 4
DEF rLCDC_WINDOW_ENABLE EQU 5
DEF rLCDC_WINDOW_TILEMAP EQU 6
DEF rLCDC_ENABLE EQU 7
DEF rSTAT EQU $ff41 ; LCDC Status (R/W)
DEF rSCY EQU $ff42 ; Scroll Y (R/W)
DEF rSCX EQU $ff43 ; Scroll X (R/W)
Expand Down Expand Up @@ -112,3 +118,8 @@ DEF rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank
DEF rPCM12 EQU $ff76 ; Channels 1 & 2 Amplitude (R)
DEF rPCM34 EQU $ff77 ; Channels 3 & 4 Amplitude (R)
DEF rIE EQU $ffff ; Interrupt Enable (R/W)
DEF rIE_VBLANK EQU 0
DEF rIE_LCD EQU 1
DEF rIE_TIMER EQU 2
DEF rIE_SERIAL EQU 3
DEF rIE_JOYPAD EQU 4
26 changes: 13 additions & 13 deletions constants/icon_constants.asm
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
; party menu icons
; used in MonPartySpritePointers (see data/icon_pointers.asm)
const_def
const ICON_MON ; $0
const ICON_BALL ; $1
const ICON_HELIX ; $2
const ICON_FAIRY ; $3
const ICON_BIRD ; $4
const ICON_WATER ; $5
const ICON_BUG ; $6
const ICON_GRASS ; $7
const ICON_SNAKE ; $8
const ICON_QUADRUPED ; $9
const ICON_PIKACHU ; $A

DEF ICON_TRADEBUBBLE EQU $e
const ICON_MON ; $0
const ICON_BALL ; $1
const ICON_HELIX ; $2
const ICON_FAIRY ; $3
const ICON_BIRD ; $4
const ICON_WATER ; $5
const ICON_BUG ; $6
const ICON_GRASS ; $7
const ICON_SNAKE ; $8
const ICON_QUADRUPED ; $9
const ICON_PIKACHU ; $a
const_skip 3
const ICON_TRADEBUBBLE ; $e

DEF ICONOFFSET EQU $40 ; difference between alternating icon frames' tile IDs
16 changes: 8 additions & 8 deletions constants/input_constants.asm
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
; joypad buttons
const_def
const BIT_A_BUTTON
const BIT_B_BUTTON
const BIT_SELECT
const BIT_START
const BIT_D_RIGHT
const BIT_D_LEFT
const BIT_D_UP
const BIT_D_DOWN
const BIT_A_BUTTON ; 0
const BIT_B_BUTTON ; 1
const BIT_SELECT ; 2
const BIT_START ; 3
const BIT_D_RIGHT ; 4
const BIT_D_LEFT ; 5
const BIT_D_UP ; 6
const BIT_D_DOWN ; 7

DEF NO_INPUT EQU 0
DEF A_BUTTON EQU 1 << BIT_A_BUTTON
Expand Down
11 changes: 9 additions & 2 deletions constants/map_object_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,16 @@ DEF SPRITESTATEDATA2_LENGTH EQU const_value

DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16

const_def 6
const BIT_TRAINER ; 6
const BIT_ITEM ; 7

; different kinds of people events
DEF ITEM EQU $80
DEF TRAINER EQU $40
DEF TRAINER EQU 1 << BIT_TRAINER
DEF ITEM EQU 1 << BIT_ITEM

; movement status
DEF BIT_FACE_PLAYER EQU 7

DEF WALK EQU $FE
DEF STAY EQU $FF
Expand Down
3 changes: 3 additions & 0 deletions constants/menu_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ DEF PC_ITEM_CAPACITY EQU 50
const NO_YES_MENU ; 7
DEF NUM_TWO_OPTION_MENUS EQU const_value

; wTwoOptionMenuID
DEF BIT_SECOND_MENU_OPTION_DEFAULT EQU 7

; menu exit method constants for list menus and the buy/sell/quit menu
DEF CHOSE_MENU_ITEM EQU 1 ; pressed A
DEF CANCELLED_MENU EQU 2 ; pressed B
Expand Down
12 changes: 0 additions & 12 deletions constants/misc_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,3 @@ DEF TRUE EQU 1
const FLAG_RESET ; 0
const FLAG_SET ; 1
const FLAG_TEST ; 2

; wOptions
DEF TEXT_DELAY_FAST EQU %001 ; 1
DEF TEXT_DELAY_MEDIUM EQU %011 ; 3
DEF TEXT_DELAY_SLOW EQU %101 ; 5

const_def 6
const BIT_BATTLE_SHIFT ; 6
const BIT_BATTLE_ANIMATION ; 7

; wd732 flags
DEF BIT_DEBUG_MODE EQU 1
24 changes: 15 additions & 9 deletions constants/oam_constants.asm
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
; OAM flags used by this game
DEF OAMFLAG_ENDOFDATA EQU %00000001 ; pseudo OAM flag, only used by game logic
DEF OAMFLAG_CANBEMASKED EQU %00000010 ; pseudo OAM flag, only used by game logic
; Pseudo-OAM flags used by game logic
const_def
const BIT_END_OF_OAM_DATA ; 0
const BIT_SPRITE_UNDER_GRASS ; 1

; Used in SpriteFacingAndAnimationTable (see data/sprites/facings.asm)
DEF FACING_END EQU 1 << BIT_END_OF_OAM_DATA
DEF UNDER_GRASS EQU 1 << BIT_SPRITE_UNDER_GRASS

; OAM attribute flags
DEF OAM_PALETTE EQU %111
DEF OAM_TILE_BANK EQU 3
DEF OAM_OBP_NUM EQU 4 ; Non CGB Mode Only
DEF OAM_X_FLIP EQU 5
DEF OAM_Y_FLIP EQU 6
DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
DEF OAM_PALETTE EQU %111
const_def 3
const OAM_TILE_BANK ; 3
const OAM_OBP_NUM ; 4 ; Non CGB Mode Only
const OAM_X_FLIP ; 5
const OAM_Y_FLIP ; 6
const OAM_PRIORITY ; 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)

; OAM attribute masks
DEF OAM_HIGH_PALS EQU 1 << 2 ; palettes %100-%111 are OBP1
Expand Down
Loading

0 comments on commit a02a98e

Please sign in to comment.