From 75e4f784924393ccedb27f2831e5a36fe11bada5 Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Tue, 3 Jul 2018 13:36:50 -0400 Subject: Merge branch 'master' of https://github.com/luckytyphlosion/pokegold-spaceworld --- constants/item_data_constants.asm | 258 +++++++++++++++++++------------------- constants/name_constants.asm | 2 +- constants/script_constants.asm | 36 +++--- engine/smallflag.asm | 142 ++++++++++----------- gfx/pokemon/annon_pic_ptrs.asm | 110 ++++++++-------- home/music.asm | 52 ++++---- macros/queue.asm | 34 ++--- macros/scripts.asm | 28 ++--- 8 files changed, 331 insertions(+), 331 deletions(-) diff --git a/constants/item_data_constants.asm b/constants/item_data_constants.asm index bf8516d..1354a40 100755 --- a/constants/item_data_constants.asm +++ b/constants/item_data_constants.asm @@ -1,129 +1,129 @@ -; item_attributes struct members (see data/items/attributes.asm) - const_def - const ITEMATTR_PRICE - const ITEMATTR_PRICE_HI - const ITEMATTR_EFFECT - const ITEMATTR_PARAM - const ITEMATTR_PERMISSIONS - const ITEMATTR_POCKET - const ITEMATTR_HELP -ITEMATTR_STRUCT_LENGTH EQU const_value - -; item types - const_def 1 - const ITEM ; 1 - const KEY_ITEM ; 2 - const BALL ; 3 - const TM_HM ; 4 - -; item menu types -; UseItem.dw indexes (see engine/items/pack.asm) -; UseRegisteredItem.SwitchTo indexes (see engine/overworld/select_menu.asm) -ITEMMENU_NOUSE EQU 0 -ITEMMENU_CURRENT EQU 4 -ITEMMENU_PARTY EQU 5 -ITEMMENU_CLOSE EQU 6 - -; item actions -CANT_SELECT_F EQU 6 -CANT_TOSS_F EQU 7 - -NO_LIMITS EQU 0 -CANT_SELECT EQU 1 << CANT_SELECT_F -CANT_TOSS EQU 1 << CANT_TOSS_F - -; pack pockets - const_def - const ITEM_POCKET ; 0 - const BALL_POCKET ; 1 - const KEY_ITEM_POCKET ; 2 - const TM_HM_POCKET ; 3 -NUM_POCKETS EQU const_value - -MAX_ITEMS EQU 20 -MAX_KEY_ITEMS EQU 20 -MAX_PC_ITEMS EQU 50 - -; held item effects - const_def - const HELD_NONE - const HELD_BERRY - const HELD_2 - const HELD_LEFTOVERS - const HELD_4 - const HELD_5 - const HELD_RESTORE_PP - const HELD_RESTORE_ALL_PP - const HELD_CLEANSE_TAG - - const_def 10 - const HELD_HEAL_POISON - const HELD_HEAL_FREEZE - const HELD_HEAL_BURN - const HELD_HEAL_SLEEP - const HELD_HEAL_PARALYZE - const HELD_HEAL_STATUS - const HELD_HEAL_CONFUSION - - const_def 20 - const HELD_PREVENT_POISON - const HELD_PREVENT_BURN - const HELD_PREVENT_FREEZE - const HELD_PREVENT_SLEEP - const HELD_PREVENT_PARALYZE - const HELD_PREVENT_CONFUSE - - const_def 30 - const HELD_30 - const HELD_ATTACK_UP - const HELD_DEFENSE_UP - const HELD_SPEED_UP - const HELD_SP_ATTACK_UP - const HELD_SP_DEFENSE_UP - const HELD_ACCURACY_UP - const HELD_EVASION_UP - const HELD_38 - - const_def 40 - const HELD_40 - const HELD_41 - const HELD_METAL_POWDER - const HELD_43 - const HELD_44 - const HELD_45 - const HELD_46 - const HELD_47 - const HELD_48 - - const_def 50 - const HELD_NORMAL_BOOST - const HELD_FIGHTING_BOOST - const HELD_FLYING_BOOST - const HELD_POISON_BOOST - const HELD_GROUND_BOOST - const HELD_ROCK_BOOST - const HELD_BUG_BOOST - const HELD_GHOST_BOOST - const HELD_FIRE_BOOST - const HELD_WATER_BOOST - const HELD_GRASS_BOOST - const HELD_ELECTRIC_BOOST - const HELD_PSYCHIC_BOOST - const HELD_ICE_BOOST - const HELD_DRAGON_BOOST - const HELD_DARK_BOOST - const HELD_STEEL_BOOST - - const_def 70 - const HELD_CATCH_CHANCE - const HELD_71 - const HELD_ESCAPE - const HELD_CRITICAL_UP - const HELD_QUICK_CLAW - const HELD_FLINCH - const HELD_AMULET_COIN - const HELD_BRIGHTPOWDER - const HELD_78 - const HELD_FOCUS_BAND - - +; item_attributes struct members (see data/items/attributes.asm) + const_def + const ITEMATTR_PRICE + const ITEMATTR_PRICE_HI + const ITEMATTR_EFFECT + const ITEMATTR_PARAM + const ITEMATTR_PERMISSIONS + const ITEMATTR_POCKET + const ITEMATTR_HELP +ITEMATTR_STRUCT_LENGTH EQU const_value + +; item types + const_def 1 + const ITEM ; 1 + const KEY_ITEM ; 2 + const BALL ; 3 + const TM_HM ; 4 + +; item menu types +; UseItem.dw indexes (see engine/items/pack.asm) +; UseRegisteredItem.SwitchTo indexes (see engine/overworld/select_menu.asm) +ITEMMENU_NOUSE EQU 0 +ITEMMENU_CURRENT EQU 4 +ITEMMENU_PARTY EQU 5 +ITEMMENU_CLOSE EQU 6 + +; item actions +CANT_SELECT_F EQU 6 +CANT_TOSS_F EQU 7 + +NO_LIMITS EQU 0 +CANT_SELECT EQU 1 << CANT_SELECT_F +CANT_TOSS EQU 1 << CANT_TOSS_F + +; pack pockets + const_def + const ITEM_POCKET ; 0 + const BALL_POCKET ; 1 + const KEY_ITEM_POCKET ; 2 + const TM_HM_POCKET ; 3 +NUM_POCKETS EQU const_value + +MAX_ITEMS EQU 20 +MAX_KEY_ITEMS EQU 20 +MAX_PC_ITEMS EQU 50 + +; held item effects + const_def + const HELD_NONE + const HELD_BERRY + const HELD_2 + const HELD_LEFTOVERS + const HELD_4 + const HELD_5 + const HELD_RESTORE_PP + const HELD_RESTORE_ALL_PP + const HELD_CLEANSE_TAG + + const_def 10 + const HELD_HEAL_POISON + const HELD_HEAL_FREEZE + const HELD_HEAL_BURN + const HELD_HEAL_SLEEP + const HELD_HEAL_PARALYZE + const HELD_HEAL_STATUS + const HELD_HEAL_CONFUSION + + const_def 20 + const HELD_PREVENT_POISON + const HELD_PREVENT_BURN + const HELD_PREVENT_FREEZE + const HELD_PREVENT_SLEEP + const HELD_PREVENT_PARALYZE + const HELD_PREVENT_CONFUSE + + const_def 30 + const HELD_30 + const HELD_ATTACK_UP + const HELD_DEFENSE_UP + const HELD_SPEED_UP + const HELD_SP_ATTACK_UP + const HELD_SP_DEFENSE_UP + const HELD_ACCURACY_UP + const HELD_EVASION_UP + const HELD_38 + + const_def 40 + const HELD_40 + const HELD_41 + const HELD_METAL_POWDER + const HELD_43 + const HELD_44 + const HELD_45 + const HELD_46 + const HELD_47 + const HELD_48 + + const_def 50 + const HELD_NORMAL_BOOST + const HELD_FIGHTING_BOOST + const HELD_FLYING_BOOST + const HELD_POISON_BOOST + const HELD_GROUND_BOOST + const HELD_ROCK_BOOST + const HELD_BUG_BOOST + const HELD_GHOST_BOOST + const HELD_FIRE_BOOST + const HELD_WATER_BOOST + const HELD_GRASS_BOOST + const HELD_ELECTRIC_BOOST + const HELD_PSYCHIC_BOOST + const HELD_ICE_BOOST + const HELD_DRAGON_BOOST + const HELD_DARK_BOOST + const HELD_STEEL_BOOST + + const_def 70 + const HELD_CATCH_CHANCE + const HELD_71 + const HELD_ESCAPE + const HELD_CRITICAL_UP + const HELD_QUICK_CLAW + const HELD_FLINCH + const HELD_AMULET_COIN + const HELD_BRIGHTPOWDER + const HELD_78 + const HELD_FOCUS_BAND + + diff --git a/constants/name_constants.asm b/constants/name_constants.asm index 7e35ebb..1db3e75 100755 --- a/constants/name_constants.asm +++ b/constants/name_constants.asm @@ -1,2 +1,2 @@ -; Name Lists +; Name Lists ITEM_NAME EQU 4 \ No newline at end of file diff --git a/constants/script_constants.asm b/constants/script_constants.asm index 15a08c0..5dc3e8d 100755 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -1,18 +1,18 @@ - -; Script IDs - const_def - const SCRIPT_ID_00 ; 00 - const SCRIPT_ID_01 ; 01 - const SCRIPT_ID_02 ; 02 - const SCRIPT_ID_03 ; 03 - const SCRIPT_ID_04 ; 04 - const SCRIPT_ID_05 ; 05 - -; Flags -SCRIPT_FINISHED_F EQU 7 - -; Masks/Return Values -SCRIPT_FINISHED_MASK EQU 1 << SCRIPT_FINISHED_F -SCRIPT_SUCCESS EQU $f -SCRIPT_FAIL EQU 0 - + +; Script IDs + const_def + const SCRIPT_ID_00 ; 00 + const SCRIPT_ID_01 ; 01 + const SCRIPT_ID_02 ; 02 + const SCRIPT_ID_03 ; 03 + const SCRIPT_ID_04 ; 04 + const SCRIPT_ID_05 ; 05 + +; Flags +SCRIPT_FINISHED_F EQU 7 + +; Masks/Return Values +SCRIPT_FINISHED_MASK EQU 1 << SCRIPT_FINISHED_F +SCRIPT_SUCCESS EQU $f +SCRIPT_FAIL EQU 0 + diff --git a/engine/smallflag.asm b/engine/smallflag.asm index dfce475..a231d0b 100755 --- a/engine/smallflag.asm +++ b/engine/smallflag.asm @@ -1,72 +1,72 @@ -SECTION "SmallFarFlagAction", ROMX[$4d33], BANK[$03] - -SmallFarFlagAction: ; 03:4d33 -; Perform action b on bit c in flag array hl. -; If checking a flag, check flag array d:hl unless d is 0. - -; For longer flag arrays, see FlagAction. - - push hl - push bc - -; Divide by 8 to get the byte we want. - push bc - srl c - srl c - srl c - ld b, 0 - add hl, bc - pop bc - -; Which bit we want from the byte - ld a, c - and 7 - ld c, a - -; Shift left until we can mask the bit - ld a, 1 - jr z, .shifted -.shift - add a - dec c - jr nz, .shift -.shifted - ld c, a - -; What are we doing to this flag? - dec b - jr z, .set ; 1 - dec b - jr z, .check ; 2 - -.reset - ld a, c - cpl - and [hl] - ld [hl], a - jr .done - -.set - ld a, [hl] - or c - ld [hl], a - jr .done - -.check - ld a, d - cp 0 - jr nz, .farcheck - - ld a, [hl] - and c - jr .done - -.farcheck - call GetFarByte - and c - -.done - pop bc - pop hl - ld c, a +SECTION "SmallFarFlagAction", ROMX[$4d33], BANK[$03] + +SmallFarFlagAction: ; 03:4d33 +; Perform action b on bit c in flag array hl. +; If checking a flag, check flag array d:hl unless d is 0. + +; For longer flag arrays, see FlagAction. + + push hl + push bc + +; Divide by 8 to get the byte we want. + push bc + srl c + srl c + srl c + ld b, 0 + add hl, bc + pop bc + +; Which bit we want from the byte + ld a, c + and 7 + ld c, a + +; Shift left until we can mask the bit + ld a, 1 + jr z, .shifted +.shift + add a + dec c + jr nz, .shift +.shifted + ld c, a + +; What are we doing to this flag? + dec b + jr z, .set ; 1 + dec b + jr z, .check ; 2 + +.reset + ld a, c + cpl + and [hl] + ld [hl], a + jr .done + +.set + ld a, [hl] + or c + ld [hl], a + jr .done + +.check + ld a, d + cp 0 + jr nz, .farcheck + + ld a, [hl] + and c + jr .done + +.farcheck + call GetFarByte + and c + +.done + pop bc + pop hl + ld c, a ret \ No newline at end of file diff --git a/gfx/pokemon/annon_pic_ptrs.asm b/gfx/pokemon/annon_pic_ptrs.asm index 45e5873..b128aee 100644 --- a/gfx/pokemon/annon_pic_ptrs.asm +++ b/gfx/pokemon/annon_pic_ptrs.asm @@ -1,55 +1,55 @@ -AnnonPicPtrs:: -AnnonPicPtrsFront:: - dw AnnonAPicFront -AnnonPicPtrsBack:: - dw AnnonAPicBack - dw AnnonBPicFront - dw AnnonBPicBack - dw AnnonCPicFront - dw AnnonCPicBack - dw AnnonDPicFront - dw AnnonDPicBack - dw AnnonEPicFront - dw AnnonEPicBack - dw AnnonFPicFront - dw AnnonFPicBack - dw AnnonGPicFront - dw AnnonGPicBack - dw AnnonHPicFront - dw AnnonHPicBack - dw AnnonIPicFront - dw AnnonIPicBack - dw AnnonJPicFront - dw AnnonJPicBack - dw AnnonKPicFront - dw AnnonKPicBack - dw AnnonLPicFront - dw AnnonLPicBack - dw AnnonMPicFront - dw AnnonMPicBack - dw AnnonNPicFront - dw AnnonNPicBack - dw AnnonOPicFront - dw AnnonOPicBack - dw AnnonPPicFront - dw AnnonPPicBack - dw AnnonQPicFront - dw AnnonQPicBack - dw AnnonRPicFront - dw AnnonRPicBack - dw AnnonSPicFront - dw AnnonSPicBack - dw AnnonTPicFront - dw AnnonTPicBack - dw AnnonUPicFront - dw AnnonUPicBack - dw AnnonVPicFront - dw AnnonVPicBack - dw AnnonWPicFront - dw AnnonWPicBack - dw AnnonXPicFront - dw AnnonXPicBack - dw AnnonYPicFront - dw AnnonYPicBack - dw AnnonZPicFront - dw AnnonYPicBack ; typo in original list +AnnonPicPtrs:: +AnnonPicPtrsFront:: + dw AnnonAPicFront +AnnonPicPtrsBack:: + dw AnnonAPicBack + dw AnnonBPicFront + dw AnnonBPicBack + dw AnnonCPicFront + dw AnnonCPicBack + dw AnnonDPicFront + dw AnnonDPicBack + dw AnnonEPicFront + dw AnnonEPicBack + dw AnnonFPicFront + dw AnnonFPicBack + dw AnnonGPicFront + dw AnnonGPicBack + dw AnnonHPicFront + dw AnnonHPicBack + dw AnnonIPicFront + dw AnnonIPicBack + dw AnnonJPicFront + dw AnnonJPicBack + dw AnnonKPicFront + dw AnnonKPicBack + dw AnnonLPicFront + dw AnnonLPicBack + dw AnnonMPicFront + dw AnnonMPicBack + dw AnnonNPicFront + dw AnnonNPicBack + dw AnnonOPicFront + dw AnnonOPicBack + dw AnnonPPicFront + dw AnnonPPicBack + dw AnnonQPicFront + dw AnnonQPicBack + dw AnnonRPicFront + dw AnnonRPicBack + dw AnnonSPicFront + dw AnnonSPicBack + dw AnnonTPicFront + dw AnnonTPicBack + dw AnnonUPicFront + dw AnnonUPicBack + dw AnnonVPicFront + dw AnnonVPicBack + dw AnnonWPicFront + dw AnnonWPicBack + dw AnnonXPicFront + dw AnnonXPicBack + dw AnnonYPicFront + dw AnnonYPicBack + dw AnnonZPicFront + dw AnnonYPicBack ; typo in original list diff --git a/home/music.asm b/home/music.asm index 8d908f0..4ad9d06 100755 --- a/home/music.asm +++ b/home/music.asm @@ -1,26 +1,26 @@ -SECTION "PlayMapMusic", ROM0[$3de1] - -PlayMapMusic: ; 00:3de1 - push hl - push de - push bc - push af - call GetMapMusic - ld a, [wMapMusic] - cp e - jr z, .dont_play - push de - ld de, 0 - call PlayMusic - call DelayFrame - pop de - ld a, e - ld [wMapMusic], a - call PlayMusic - -.dont_play - pop af - pop bc - pop de - pop hl - ret +SECTION "PlayMapMusic", ROM0[$3de1] + +PlayMapMusic: ; 00:3de1 + push hl + push de + push bc + push af + call GetMapMusic + ld a, [wMapMusic] + cp e + jr z, .dont_play + push de + ld de, 0 + call PlayMusic + call DelayFrame + pop de + ld a, e + ld [wMapMusic], a + call PlayMusic + +.dont_play + pop af + pop bc + pop de + pop hl + ret diff --git a/macros/queue.asm b/macros/queue.asm index c868dc8..37fb1cb 100755 --- a/macros/queue.asm +++ b/macros/queue.asm @@ -1,17 +1,17 @@ -queue_ab: MACRO - ld hl, \1 - ldh a, [hROMBank] - call QueueScript -ENDM - -queue_ba: MACRO - ldh a, [hROMBank] - ld hl, \1 - call QueueScript -ENDM - -far_queue: MACRO - ld hl, \1 - ld a, BANK(\1) - call QueueScript -ENDM +queue_ab: MACRO + ld hl, \1 + ldh a, [hROMBank] + call QueueScript +ENDM + +queue_ba: MACRO + ldh a, [hROMBank] + ld hl, \1 + call QueueScript +ENDM + +far_queue: MACRO + ld hl, \1 + ld a, BANK(\1) + call QueueScript +ENDM diff --git a/macros/scripts.asm b/macros/scripts.asm index 73ad461..e392391 100755 --- a/macros/scripts.asm +++ b/macros/scripts.asm @@ -1,14 +1,14 @@ -init_script_table: MACRO -script_id = 0 -ENDM - -add_script: MACRO - dw \1 -\1ScriptID = script_id -script_id = script_id + 1 -ENDM - -set_script: MACRO - ld a, \1ScriptID - ld [wFieldMoveScriptID], a -ENDM +init_script_table: MACRO +script_id = 0 +ENDM + +add_script: MACRO + dw \1 +\1ScriptID = script_id +script_id = script_id + 1 +ENDM + +set_script: MACRO + ld a, \1ScriptID + ld [wFieldMoveScriptID], a +ENDM -- cgit v1.2.3