diff options
author | entrpntr <entrpntr@gmail.com> | 2020-03-17 16:20:00 -0400 |
---|---|---|
committer | entrpntr <entrpntr@gmail.com> | 2020-03-17 16:20:00 -0400 |
commit | e67786a7a26ae7531301e928870b204043fb8a6a (patch) | |
tree | 579c9e876fa2cd46c13ecceed0e8f0358e347131 /main.asm | |
parent | c248b30aa7487b51a9182a833b1db29f14a7267c (diff) |
Cleanup of files for banks $02 and $03 for main.asm.
Diffstat (limited to 'main.asm')
-rw-r--r-- | main.asm | 437 |
1 files changed, 21 insertions, 416 deletions
@@ -17,431 +17,36 @@ INCLUDE "engine/events/happiness_egg.asm" INCLUDE "engine/events/shuckle.asm" INCLUDE "engine/events/haircut.asm" -SECTION "bank2", ROMX, BANK[$2] -_SwapTextboxPalettes:: - ld hl, wTilemap - ld de, wAttrmap - ld b, $12 -.asm_8008 - ld c, $14 -.asm_800a - ld a, [hli] - push hl - srl a - jr c, .asm_8024 - ld hl, wTilesetPalettes - add [hl] - ld l, a - ld a, [wTilesetPalettes + 1] - adc $0 - ld h, a - ld a, [hl] - and $f - bit 3, a - jr z, .asm_8045 - jr .asm_8038 - -.asm_8024 - ld hl, wTilesetPalettes - add [hl] - ld l, a - ld a, [wTilesetPalettes + 1] - adc $0 - ld h, a - ld a, [hl] - swap a - and $f - bit 3, a - jr z, .asm_8045 -.asm_8038 - ld a, [wMapGroup] - dec a - ld hl, Unknown85d7 - add l - ld l, a - jr nc, .asm_8044 - inc h -.asm_8044 - ld a, [hl] -.asm_8045 - pop hl - ld [de], a - inc de - dec c - jr nz, .asm_800a - dec b - jr nz, .asm_8008 - ret - -_ScrollBGMapPalettes:: ; 804f (2:404f) - ld hl, wBGMapBuffer - ld de, wBGMapPalBuffer -.asm_8055 - ld a, [hli] - push hl - srl a - jr c, .asm_806f - ld hl, wTilesetPalettes - add [hl] - ld l, a - ld a, [wTilesetPalettes + 1] - adc $0 - ld h, a - ld a, [hl] - and $f - bit 3, a - jr z, .asm_8090 - jr .asm_8083 - -.asm_806f - ld hl, wTilesetPalettes - add [hl] - ld l, a - ld a, [wTilesetPalettes + 1] - adc $0 - ld h, a - ld a, [hl] - swap a - and $f - bit 3, a - jr z, .asm_8090 -.asm_8083 - ld a, [wMapGroup] - dec a - ld hl, Unknown85d7 - add l - ld l, a - jr nc, .asm_808f - inc h -.asm_808f - ld a, [hl] -.asm_8090 - pop hl - ld [de], a - inc de - dec c - jr nz, .asm_8055 - ret - -INCLUDE "gfx/tilesets/palette_maps.asm" - -Unknown85d7: - rept 26 ; NUM_MAP_GROUPS - db PAL_BG_ROOF - endr +SECTION "bank2", ROMX +INCLUDE "engine/tilesets/map_palettes.asm" +INCLUDE "gfx/tileset_palette_maps.asm" INCLUDE "engine/overworld/player_object.asm" -INCLUDE "engine/sine.asm" +INCLUDE "engine/math/sine.asm" INCLUDE "engine/predef.asm" -INCLUDE "engine/color.asm" - -SECTION "bank3", ROMX, BANK[$3] -CheckTime:: - ld a, [wTimeOfDay] - ld hl, TimeOfDayTable - ld de, $2 - call IsInArray - inc hl - ld c, [hl] - ret c - xor a - ld c, a - ret - -TimeOfDayTable: - db MORN_F, MORN - db DAY_F, DAY - db NITE_F, NITE - db NITE_F, NITE - db -1 +INCLUDE "engine/gfx/color.asm" -INCLUDE "engine/engine_flags.asm" -INCLUDE "engine/variables.asm" -INCLUDE "engine/specials.asm" - -Functionc660: - nop -SmallFarFlagAction: - push hl - push bc - push bc - srl c - srl c - srl c - ld b, $0 - add hl, bc - pop bc - ld a, c - and $7 - ld c, a - ld a, $1 - jr z, .asm_c67a -.asm_c676 - add a - dec c - jr nz, .asm_c676 -.asm_c67a - ld c, a - dec b - jr z, .asm_c687 - dec b - jr z, .asm_c68c - ld a, c - cpl - and [hl] - ld [hl], a - jr .asm_c699 - -.asm_c687 - ld a, [hl] - or c - ld [hl], a - jr .asm_c699 - -.asm_c68c - ld a, d - cp $0 - jr nz, .asm_c695 - ld a, [hl] - and c - jr .asm_c699 - -.asm_c695 - call GetFarByte - and c -.asm_c699 - pop bc - pop hl - ld c, a - ret +SECTION "bank3", ROMX -INCLUDE "engine/health.asm" +INCLUDE "engine/events/checktime.asm" +INCLUDE "engine/events/engine_flags.asm" +INCLUDE "engine/overworld/variables.asm" +INCLUDE "engine/events/specials.asm" +INCLUDE "engine/smallflag.asm" +INCLUDE "engine/pokemon/health.asm" INCLUDE "engine/events/overworld.asm" -INCLUDE "engine/items.asm" +INCLUDE "engine/items/items.asm" INCLUDE "engine/overworld/player_step.asm" -INCLUDE "engine/anim_hp_bar.asm" -INCLUDE "engine/move_mon.asm" +INCLUDE "engine/battle/anim_hp_bar.asm" +INCLUDE "engine/pokemon/move_mon.asm" INCLUDE "engine/pokemon/bills_pc_top.asm" +INCLUDE "engine/pokemon/breedmon_level_growth.asm" +INCLUDE "engine/pokemon/search2.asm" +INCLUDE "engine/events/bug_contest/caught_mon.asm" +INCLUDE "engine/items/item_effects.asm" +INCLUDE "engine/pokemon/knows_move.asm" -GetBreedMon1LevelGrowth: - ld hl, wBreedMon1Species - ld de, wTempMonSpecies - ld bc, $20 - call CopyBytes - callfar CalcLevel - ld a, [wBreedMon1Level] - ld b, a - ld a, d - ld e, a - sub b - ld d, a - ret - -GetBreedMon2LevelGrowth: - ld hl, wBreedMon2Species - ld de, wTempMon - ld bc, $20 - call CopyBytes - callfar CalcLevel - ld a, [wBreedMon2Level] - ld b, a - ld a, d - ld e, a - sub b - ld d, a - ret - -PartySearch_MaximumLevel: ; e6a9 (3:66a9) - ld hl, wPartyMon1Level - call PartySearch_LessThanValue - ret - -PartySearch_MinimumHappiness: ; e6b0 (3:66b0) - ld hl, wPartyMon1Happiness - call PartySearch_GreaterThanOrEqualToValue - ret - -PartySearch_SameSpecies: ; e6b7 (3:66b7) - ld hl, wPartyMons - jp PartySearch_GetIndexOfSpeciesInParty - -PartySearch_SameSpeciesAndYourID: ; e6bd (3:66bd) - ld hl, wPartyMon1 - call PartySearch_GetIndexOfSpeciesInParty - ret z - ld a, c - ld hl, wPartyMon1ID - ld bc, PARTYMON_STRUCT_LENGTH - call AddNTimes - ld a, [wPlayerID] - cp [hl] - jr nz, .nope - inc hl - ld a, [wPlayerID + 1] - cp [hl] - jr nz, .nope - ld a, $1 - and a - ret - -.nope - xor a - ret - -PartySearch_GreaterThanOrEqualToValue: ; e6e1 (3:66e1) - ld c, $0 - ld a, [wPartyCount] - ld d, a -.loop - ld a, d - dec a - push hl - push bc - ld bc, PARTYMON_STRUCT_LENGTH - call AddNTimes - pop bc - ld a, b - cp [hl] - pop hl - jr z, .shift - jr nc, .skip -.shift - ld a, c - or $1 - ld c, a -.skip - sla c - dec d - jr nz, .loop - call PartySearch_FilterEggs - ld a, c - and a - ret - -PartySearch_LessThanValue: ; e708 (3:6708) - ld c, $0 - ld a, [wPokemonData] - ld d, a -.loop - ld a, d - dec a - push hl - push bc - ld bc, PARTYMON_STRUCT_LENGTH - call AddNTimes - pop bc - ld a, b - cp [hl] - pop hl - jr c, .skip - ld a, c - or $1 - ld c, a -.skip - sla c - dec d - jr nz, .loop - call PartySearch_FilterEggs - ld a, c - and a - ret - -PartySearch_GetIndexOfSpeciesInParty: ; e72d (3:672d) - ld c, -1 - ld hl, wPartySpecies -.loop - ld a, [hli] - cp $ff - ret z - inc c - cp b - jr nz, .loop - ld a, $1 - and a - ret - -PartySearch_FilterEggs: ; e73e (3:673e) - ld e, $FF ^ 1 - ld hl, wPartySpecies -.loop - ld a, [hli] - cp $ff - ret z - cp EGG - jr nz, .not_egg - ld a, c - and e - ld c, a -.not_egg - rlc e - jr .loop - -BugContest_SetCaughtContestMon: - ld a, [wContestMonSpecies] - and a - jr z, .asm_e76e - ld [wd151], a - farcall DisplayAlreadyCaughtText - farcall DisplayCaughtContestMonStats - lb bc, 14, 7 - call PlaceYesNoBox - ret c -.asm_e76e - call GenerateBugContestMonStats - ld a, [wTempEnemyMonSpecies] - ld [wd151], a - call GetPokemonName - ld hl, Text_CaughtBugMon - call PrintText - ret - -GenerateBugContestMonStats: ; e781 (3:6781) - ld a, [wTempEnemyMonSpecies] - ld [wCurSpecies], a - ld [wCurPartySpecies], a - call GetBaseData - xor a - ld bc, PARTYMON_STRUCT_LENGTH - ld hl, wContestMon - call ByteFill - xor a - ld [wMonType], a - ld hl, wContestMon - jp GeneratePartyMonStats - -Text_CaughtBugMon: - ; Caught @ ! - text_far Text_CaughtBugMon_ - db "@" - -INCLUDE "items/item_effects.asm" - -KnowsMove: - ld a, MON_MOVES - call GetPartyParamLocation - ld a, [wPutativeTMHMMove] - ld b, a - ld c, $4 -.asm_fa28 - ld a, [hli] - cp b - jr z, .asm_fa31 - dec c - jr nz, .asm_fa28 - and a - ret - -.asm_fa31 - ld hl, Text_KnowsMove - call PrintText - scf - ret - -Text_KnowsMove: - text_far Text_KnowsMove_ - db "@" - -SECTION "bank4", ROMX, BANK[$4] +SECTION "bank4", ROMX INCLUDE "engine/overworld/player_movement.asm" INCLUDE "engine/items/pack.asm" |