From bd5a5f70d44a0fef041027be12d439588f863507 Mon Sep 17 00:00:00 2001 From: luckytyphlosion Date: Thu, 17 Mar 2016 17:37:20 -0400 Subject: Split bank1 up. --- engine/load_mon_data.asm | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 engine/load_mon_data.asm (limited to 'engine/load_mon_data.asm') diff --git a/engine/load_mon_data.asm b/engine/load_mon_data.asm new file mode 100644 index 00000000..41ba65b1 --- /dev/null +++ b/engine/load_mon_data.asm @@ -0,0 +1,68 @@ +LoadMonData_: ; 442b (1:442b) +; Load monster [wWhichPokemon] from list [wMonDataLocation]: +; 0: partymon +; 1: enemymon +; 2: boxmon +; 3: daycaremon +; Return monster id at wcf91 and its data at wLoadedMon. +; Also load base stats at wMonHeader for convenience. + + ld a, [wDayCareMonSpecies] + ld [wcf91], a + ld a, [wMonDataLocation] + cp DAYCARE_DATA + jr z, .GetMonHeader + + ld a, [wWhichPokemon] + ld e, a + call GetMonSpecies + +.GetMonHeader + ld a, [wcf91] + ld [wd0b5], a ; input for GetMonHeader + call GetMonHeader + + ld hl, wPartyMons + ld bc, wPartyMon2 - wPartyMon1 + ld a, [wMonDataLocation] + cp ENEMY_PARTY_DATA + jr c, .getMonEntry + + ld hl, wEnemyMons + jr z, .getMonEntry + + cp 2 + ld hl, wBoxMons + ld bc, wBoxMon2 - wBoxMon1 + jr z, .getMonEntry + + ld hl, wDayCareMon + jr .copyMonData + +.getMonEntry + ld a, [wWhichPokemon] + call AddNTimes + +.copyMonData + ld de, wLoadedMon + ld bc, wPartyMon2 - wPartyMon1 + jp CopyData + +; get species of mon e in list [wMonDataLocation] for LoadMonData +GetMonSpecies: ; 4478 (1:4478) + ld hl, wPartySpecies + ld a, [wMonDataLocation] + and a + jr z, .getSpecies + dec a + jr z, .enemyParty + ld hl, wBoxSpecies + jr .getSpecies +.enemyParty + ld hl, wEnemyPartyMons +.getSpecies + ld d, 0 + add hl, de + ld a, [hl] + ld [wcf91], a + ret \ No newline at end of file -- cgit v1.2.3