From 904194e9a9e7853c2de4e408010fe17038fec7f9 Mon Sep 17 00:00:00 2001 From: chaos-lord Date: Sat, 22 Jul 2017 18:26:40 +0100 Subject: commented what looks like pokemon billboard graphics loading --- engine/pinball_game/catchem_mode.asm | 68 +++++++++++----------- .../catchem_mode/catchem_mode_red_field.asm | 16 ++--- .../evolution_mode/evolution_mode_red_field.asm | 8 +-- wram.asm | 26 ++------- 4 files changed, 51 insertions(+), 67 deletions(-) diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm index a541348..ac45f6c 100644 --- a/engine/pinball_game/catchem_mode.asm +++ b/engine/pinball_game/catchem_mode.asm @@ -55,7 +55,7 @@ StartCatchEmMode: ; 0x1003f ld l, c add hl, bc add hl, bc ; multiply the evolution line id by 3, add it to pointer to ??? - ld bc, Data_13685 ;mystery data + ld bc, Data_13685 ;mystery data, seems pokedex related too add hl, bc ld a, [hli] ld [wd5c1], a @@ -179,10 +179,10 @@ CallTable_10178: ; 0x10178 dw Func_109fc ; STAGE_BLUE_FIELD_TOP dw Func_109fc ; STAGE_BLUE_FIELD_BOTTOM -Func_10184: ; 0x10184 +Func_10184: ; 0x10184 called by what looks like the "hit voltorb and shellder" handllers, as well as some evo mode stuff ld a, [wCurrentStage] bit 0, a - ret z + ret z ;skip if stage has no flippers ld a, [wCurrentCatchEmMon] ld c, a ld b, $0 @@ -192,16 +192,16 @@ Func_10184: ; 0x10184 ld c, a jr nc, .asm_10199 inc b -.asm_10199 +.asm_10199 ;double current catch em mon ld hl, MonBillboardPicPointers add hl, bc ld a, [hli] - ld [$ff8c], a + ld [$ff8c], a ;load 3 byte billboard pointer into Hram ld a, [hli] ld [$ff8d], a ld a, [hl] ld [$ff8e], a - ld hl, MonBillboardPaletteMapPointers + ld hl, MonBillboardPaletteMapPointers ;and the PAL pointers add hl, bc ld a, [hli] ld [$ff8f], a @@ -215,21 +215,21 @@ Func_10184: ; 0x10184 .asm_101bb ld a, [hli] cp [hl] - ld [hli], a + ld [hli], a ;load first byte into next and test it gainst the second byte, if it's the same skip jr z, .asm_101d2 - ld b, a + ld b, a ;else store in b call nz, Func_101d9 ld a, [hGameBoyColorFlag] and a - jr z, .asm_101d2 + jr z, .asm_101d2 ;skip if DMG ld a, [wCurrentStage] bit 0, a ld a, b - call nz, Func_10230 + call nz, Func_10230 ;if lower stage, run ??? .asm_101d2 inc c ld a, c - cp $18 + cp $18 ;run 24 times jr nz, .asm_101bb ret @@ -239,13 +239,13 @@ Func_101d9: ; 0x101d9 push de push af ld a, $10 - ld [de], a + ld [de], a ;load 16 into de inc de ld a, $1 - ld [de], a + ld [de], a ;1 into de+1 inc de ld b, $0 - ld hl, Data_102a4 + ld hl, Data_102a4 ;add c to ??? add hl, bc ld c, [hl] sla c @@ -255,23 +255,23 @@ Func_101d9: ; 0x101d9 sla c rl b sla c - rl b - ld hl, vTilesSH tile $10 - add hl, bc + rl b ;multiply ??? by 16 + ld hl, vTilesSH tile $10 ;wut + add hl, bc ;add ???*16 to wut ld a, l ld [de], a inc de ld a, h ld [de], a - inc de - ld a, [$ff8c] + inc de ;load result in to de + ld a, [$ff8c] ;loaded billboard pointer ld l, a ld a, [$ff8d] ld h, a - add hl, bc + add hl, bc ;add ???*16 pop af and a - jr nz, .asm_10215 + jr nz, .asm_10215 ;if a is 0, add $180 (384) ld bc, $0180 add hl, bc .asm_10215 @@ -283,14 +283,14 @@ Func_101d9: ; 0x101d9 inc de ld a, [$ff8e] ld [de], a - inc de + inc de ;load adjusted pointer into de, then 0 ld a, $0 ld [de], a inc de pop bc push de xor a - ld de, Func_11d2 + ld de, Func_11d2 ;queue graphics load from the adjusted pointer bank 0 using this funch call QueueGraphicsToLoadWithFunc pop de pop hl @@ -306,13 +306,13 @@ Func_10230: ; 0x10230 ld [de], a inc de ld [de], a - inc de + inc de ;load 1 into first 2 bytes from DE ld b, $0 ld hl, Data_102a4 - add hl, bc + add hl, bc ;retrieve entry c from ??? ld c, [hl] sla c - ld hl, PointerTable_10274 + ld hl, PointerTable_10274 ;grab billboard BG position(?) pointer entry c, place in de add hl, bc ld a, [hli] ld [de], a @@ -321,34 +321,34 @@ Func_10230: ; 0x10230 ld [de], a inc de srl c - ld a, [$ff8f] + ld a, [$ff8f];load PAL pointer ld l, a ld a, [$ff90] ld h, a - add hl, bc + add hl, bc ;add the value from Data_102a4 pop af and a ld a, [$ff91] - call ReadByteFromBank - jr nz, .asm_10261 + call ReadByteFromBank ;fetch pallete data + jr nz, .asm_10261 ; ld a, $5 .asm_10261 - ld [de], a + ld [de], a ;if a's initial place is 0, make it 5 into de, else load the PAL bank inc de ld a, $0 - ld [de], a + ld [de], a ;then load 0 inc de pop bc push de xor a - ld de, LoadTileListsBank1 + ld de, LoadTileListsBank1 ;load pal pointer as graphics? call QueueGraphicsToLoadWithFunc pop de pop hl pop bc ret -PointerTable_10274: ; 0x10274 +PointerTable_10274: ; 0x10274 4x6 area? the billboard's position? dw $9887 dw $9888 dw $9889 diff --git a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm index e02f160..0e04dfc 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm @@ -27,7 +27,7 @@ PointerTable_20021: ; 0x20021 Func_20041: ; 0x20041 ld a, [wd5b6] - cp $18 + cp $18 ;if not 24, ret jr nz, .asm_2005d ld a, [wCurrentStage] bit 0, a @@ -228,28 +228,28 @@ Func_201f2: ; 0x201f2 callba Func_106a6 ret -Func_20230: ; 0x20230 +Func_20230: ; 0x20230 resolve hitting a voltorb in catch mode? ld a, [wd5b6] cp $18 - jr z, .asm_2029d + jr z, .asm_2029d ;if ?? is 24, add to jackpot and ret c sla a ld c, a ld b, $0 ld hl, wd586 - add hl, bc + add hl, bc ;else go ???*2 down ??? ld d, $4 .asm_20242 ld a, $1 ld [hli], a - inc hl + inc hl ;load in 1 ld a, l cp wd5b6 % $100 - jr z, .asm_2024e + jr z, .asm_2024e ;continue until you reach ??? or until 4 spaces are done dec d jr nz, .asm_20242 .asm_2024e ld a, [wd5b6] - add $4 + add $4 ;then add 4 to ??, clamp to 24 cp $18 jr c, .master_loop9 ld a, $18 @@ -258,7 +258,7 @@ Func_20230: ; 0x20230 cp $18 jr nz, .asm_20264 xor a - ld [wIndicatorStates + 9], a + ld [wIndicatorStates + 9], a ;if 24, unmark voltorb arrow indicator .asm_20264 callba Func_10184 ld bc, OneHundredThousandPoints diff --git a/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm b/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm index 219cb38..a38ece6 100644 --- a/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm +++ b/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm @@ -40,7 +40,7 @@ PointerTable_205d4: ; 0x205d4 padded_dab Func_2070b padded_dab Func_20757 -Func_205e0: ; 0x205e0 +Func_205e0: ; 0x205e0 runs on collecting exp in evo mode? ld a, [wCurrentStage] ld b, a ld a, [wd578] @@ -271,10 +271,10 @@ Func_2080f: ; 0x2080f call AddBCDEToJackpot ld a, [wd551] ;if ??? is not zero, ret c and a - jr nz, .asm_20837 + jr nz, .RetC ld a, [wIndicatorStates + 9] ;if indicator is z, ret and a - jr z, .asm_20837 + jr z, .RetC xor a ld [wIndicatorStates + 9], a ld a, [wd55c] @@ -284,7 +284,7 @@ Func_2080f: ; 0x2080f jp nz, Func_20977 jp Func_209eb -.asm_20837 +.RetC scf ret diff --git a/wram.asm b/wram.asm index d6c8859..c906633 100644 --- a/wram.asm +++ b/wram.asm @@ -538,7 +538,7 @@ wCollidedAlleyTriggers:: ; 0xd521 ds $6 ; free space -wIndicatorStates:: ; 0xd52f 0 = evo arrows, 1 = catch arrows, 2 = left small alley, 3 = bellsprout, 4 = slot. bit 7 controls if enabled and flashing, bit 1 and 2 control is solid (set = solid) +wIndicatorStates:: ; 0xd52f 0 = evo arrows, 1 = catch arrows, 2 = left small alley, 3 = bellsprout, 4 = slot. bit 7 controls if enabled and flashing, bit 1 and 2 control is solid (set = solid), +9 is the arrow pointing to voltorb on red evo mode ds $13 wLeftAlleyTrigger:: ; 0xd542 @@ -574,26 +574,10 @@ wInSpecialMode:: ; 0xd54b ; Set to 1 if currently in special game mode. See wSpecialMode. ds $1 -wSpecialModeCollisionID:: ; 0xd54c 10000 sets it to a input, records what the ball has collided with -;0 nothing hit? -;1 upper left red trigger (under ditto) | secondary left trigger on blue -;2 second right trigger -;3 second staryu ally trigger -;4 any voltob | any shellder -;5 bellsprout | N/A -;6 staryu | N/A -;7 left diglett | poliwag -;8 right diglett | psyduck -;9 hit right railing (33 multiplier) -;a hit right railing (otherwise) -;b upper cave lights (ball upgrade) -;c Spinner -;d slot hole -;e N/A | cloyster -;f N/A | slowpoke +wSpecialModeCollisionID:: ; 0xd54c 10000 sets it to a input, records what the ball has collided with see constants/special_collision_constants.asm for more info ds $1 -wd54d:: ; 0xd54d catch mode progress? +wd54d:: ; 0xd54d catch mode progress? used for all 3 special modes ds $1 wd54e:: ; 0xd54e @@ -607,7 +591,7 @@ wSpecialMode:: ; 0xd550 ; See SPECIAL_MODE constants. ds $1 -wd551:: ; 0xd551 +wd551:: ; 0xd551 if non zero, voltobs skip applying experiance gain in evo mode. set to 0 onm collect experiance. set to 1 is pokemon is tired, 0 on recovered. 7 when exp is active for collecting. set to 0 on conclude evo mode. Tracks evo mode state? ds $1 wCurrentEvolutionMon:: ; 0xd552 @@ -719,7 +703,7 @@ wTimerDigits:: ; 0xd582 wd586:: ; 0xd586 ds $30 -wd5b6:: ; 0xd5b6 a 24 wide block starts here and is filled before catch mode +wd5b6:: ; 0xd5b6 a 24 wide block starts here and is filled before catch mode. used in catch and evo mode. first step of catch mode only passes if it is 24 ds $5 wWildMonIsHittable:: ; 0xd5bb -- cgit v1.2.3 From 248861c859c92d16c1e9cb08c3c682743a6d4bfb Mon Sep 17 00:00:00 2001 From: chaos-lord Date: Sun, 23 Jul 2017 19:45:29 +0100 Subject: Labeled the catch mode mystery data and catch mode "catch the mon" phase Variables --- engine/pinball_game/catchem_mode.asm | 32 +++--- .../catchem_mode/catchem_mode_blue_field.asm | 42 ++++---- .../catchem_mode/catchem_mode_red_field.asm | 112 ++++++++++----------- .../draw_sprites/draw_blue_field_sprites.asm | 2 +- .../draw_sprites/draw_red_field_sprites.asm | 2 +- engine/pinball_game/evolution_mode.asm | 2 +- engine/pokedex.asm | 48 ++++----- main.asm | 2 +- text/scrolling_text.asm | 2 +- wram.asm | 24 ++--- 10 files changed, 134 insertions(+), 134 deletions(-) diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm index ac45f6c..33c9616 100644 --- a/engine/pinball_game/catchem_mode.asm +++ b/engine/pinball_game/catchem_mode.asm @@ -55,24 +55,24 @@ StartCatchEmMode: ; 0x1003f ld l, c add hl, bc add hl, bc ; multiply the evolution line id by 3, add it to pointer to ??? - ld bc, Data_13685 ;mystery data, seems pokedex related too + ld bc, CatchSpriteFrameDurations ;mystery data, seems pokedex related too add hl, bc ld a, [hli] - ld [wd5c1], a - ld [wd5be], a + ld [CurrentCatchMonIdleFrame1Duration], a + ld [wLoopsUntilNextCatchSpriteAnimationChange], a ld a, [hli] - ld [wd5c2], a + ld [CurrentCatchMonIdleFrame2Duration], a ld a, [hli] - ld [wd5c3], a ;load the 3 bytes into ???? + ld [CurrentCatchMonHitFrameDuration], a ;load the 3 bytes into ???? ld hl, wd586 - ld a, [wd5b6] + ld a, [NumberOfCatchModeTilesFlipped] ld c, a and a ld b, $18 - jr z, .asm_100c7 ;if ?? = 0, jump with b = 24 (2 seperate loops? + jr z, .asm_100c7 ;if tiles flipped = 0, jump with b = 24 (2 seperate loops?) .asm_100ba ld a, $1 - ld [hli], a ;load 1 then 0 into data from wd5b6 C times, where C is the contents of wd5b6 + ld [hli], a ;load 1 then 0 into data from NumberOfCatchModeTilesFlipped C times, where C is the contents of NumberOfCatchModeTilesFlipped xor a ld [hli], a dec b @@ -81,7 +81,7 @@ StartCatchEmMode: ; 0x1003f ld a, b ;load 24 - times looped into a, if 0: skip and a jr z, .asm_100ce -.asm_100c7 ;loop 0 then 1 into the rest of the data from wd5b6 +.asm_100c7 ;loop 0 then 1 into the rest of the data from NumberOfCatchModeTilesFlipped xor a ld [hli], a inc a @@ -165,7 +165,7 @@ ConcludeCatchEmMode: ; 0x10157 ld [wInSpecialMode], a ld [wWildMonIsHittable], a ld [wd5c6], a - ld [wd5b6], a + ld [NumberOfCatchModeTilesFlipped], a ld [wNumMonHits], a call ClearWildMonCollisionMask callba StopTimer @@ -210,7 +210,7 @@ Func_10184: ; 0x10184 called by what looks like the "hit voltorb and shellder" h ld a, [hli] ld [$ff91], a ld de, wc000 - ld hl, wd586 + ld hl, wd586 ;what tiles are flipped? ld c, $0 .asm_101bb ld a, [hli] @@ -838,14 +838,14 @@ BallCaptureAnimationData: ; 0x105e4 db $00 ; terminator Func_10611: ; 0x10611 - and a + and a ;if a NZ ret z - dec a + dec a ;dec a sla a ld c, a ld b, $0 ld hl, Data_1062a - add hl, bc + add hl, bc ;load that graphics data and qeue it up ld a, [hli] ld c, a ld a, [hl] @@ -918,8 +918,8 @@ ShowAnimatedWildMon: ; 0x10678 ld hl, MonAnimatedSpriteTypes add hl, bc ld a, [hl] - ld [wd5bc], a - ld [wd5bd], a + ld [wCurrentAnimatedMonSpriteType], a + ld [wCurrentAnimatedMonSpriteFrame], a ld a, $1 ld [wWildMonIsHittable], a xor a diff --git a/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm index b6b9462..8f454ae 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm @@ -28,7 +28,7 @@ PointerTable_202e2: ; 0x202e2 padded_dab Func_2048f Func_20302: ; 0x20302 - ld a, [wd5b6] + ld a, [NumberOfCatchModeTilesFlipped] cp $18 jr nz, .asm_2031e ld a, [wCurrentStage] @@ -86,13 +86,13 @@ Func_20364: ; 0x20364 ret Func_20394: ; 0x20394 - ld a, [wd5be] + ld a, [wLoopsUntilNextCatchSpriteAnimationChange] dec a - ld [wd5be], a + ld [wLoopsUntilNextCatchSpriteAnimationChange], a jr z, .asm_203a7 - ld a, [wd5c4] + ld a, [wCatchModeMonUpdateTimer] inc a - ld [wd5c4], a + ld [wCatchModeMonUpdateTimer], a and $3 ret nz .asm_203a7 @@ -101,10 +101,10 @@ Func_20394: ; 0x20394 jp z, .asm_20428 xor a ld [wBallHitWildMon], a - ld a, [wd5c3] - ld [wd5be], a + ld a, [CurrentCatchMonHitFrameDuration] + ld [wLoopsUntilNextCatchSpriteAnimationChange], a xor a - ld [wd5c4], a + ld [wCatchModeMonUpdateTimer], a ld a, [wCurrentCatchEmMon] cp MEW - 1 jr nz, .notMew @@ -151,12 +151,12 @@ Func_20394: ; 0x20394 jr .asm_2044b .asm_20428 - ld a, [wd5be] + ld a, [wLoopsUntilNextCatchSpriteAnimationChange] and a ret nz - ld a, [wd5bc] + ld a, [wCurrentAnimatedMonSpriteType] ld c, a - ld a, [wd5bd] + ld a, [wCurrentAnimatedMonSpriteFrame] sub c cp $1 ld c, $0 @@ -164,16 +164,16 @@ Func_20394: ; 0x20394 ld c, $1 .asm_2043d ld b, $0 - ld hl, wd5c1 + ld hl, CurrentCatchMonIdleFrame1Duration add hl, bc ld a, [hl] - ld [wd5be], a + ld [wLoopsUntilNextCatchSpriteAnimationChange], a xor a - ld [wd5c4], a + ld [wCatchModeMonUpdateTimer], a .asm_2044b - ld a, [wd5bc] + ld a, [wCurrentAnimatedMonSpriteType] add c - ld [wd5bd], a + ld [wCurrentAnimatedMonSpriteFrame], a scf ret @@ -231,7 +231,7 @@ Func_204b3: ; 0x204b3 ret Func_204f1: ; 0x204f1 - ld a, [wd5b6] + ld a, [NumberOfCatchModeTilesFlipped] cp $18 jr z, .asm_2055e sla a @@ -245,18 +245,18 @@ Func_204f1: ; 0x204f1 ld [hli], a inc hl ld a, l - cp wd5b6 % $100 + cp NumberOfCatchModeTilesFlipped % $100 jr z, .asm_2050f dec d jr nz, .asm_20503 .asm_2050f - ld a, [wd5b6] + ld a, [NumberOfCatchModeTilesFlipped] add $4 cp $18 jr c, .asm_2051a ld a, $18 .asm_2051a - ld [wd5b6], a + ld [NumberOfCatchModeTilesFlipped], a cp $18 jr nz, .asm_20525 xor a @@ -272,7 +272,7 @@ Func_204f1: ; 0x204f1 call FillBottomMessageBufferWithBlackTile call EnableBottomText ld hl, wStationaryText2 - ld de, Data_2a3d + ld de, CatchModeTileFlippedScoreStationaryTextHeader call LoadScoreTextFromStack pop de pop bc diff --git a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm index 0e04dfc..f6ffbfc 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm @@ -1,7 +1,7 @@ HandleRedCatchEmCollision: ; 0x20000 ld a, [wSpecialModeCollisionID] cp SPECIAL_COLLISION_VOLTORB - jp z, Func_20230 ;if collided with voltorb + jp z, HandleCatchModeVoltorbHit ;if collided with voltorb cp SPECIAL_COLLISION_SPINNER jp z, Func_202a8 cp SPECIAL_COLLISION_BELLSPROUT @@ -20,13 +20,13 @@ PointerTable_20021: ; 0x20021 padded_dab Func_2005f padded_dab Func_2006b padded_dab Func_200a3 - padded_dab Func_200d3 + padded_dab CatchEmModeUpdateMonStateRedTable padded_dab Func_20193 padded_dab CapturePokemonRedStage padded_dab Func_201ce Func_20041: ; 0x20041 - ld a, [wd5b6] + ld a, [NumberOfCatchModeTilesFlipped] cp $18 ;if not 24, ret jr nz, .asm_2005d ld a, [wCurrentStage] @@ -83,40 +83,40 @@ Func_200a3: ; 0x200a3 scf ret -Func_200d3: ; 0x200d3 - ld a, [wd5be] +CatchEmModeUpdateMonStateRedTable: ; 0x200d3 + ld a, [wLoopsUntilNextCatchSpriteAnimationChange] ;dec time until next animation change, if zero jump dec a - ld [wd5be], a - jr z, .asm_200e6 - ld a, [wd5c4] + ld [wLoopsUntilNextCatchSpriteAnimationChange], a + jr z, .ChangeAnimation + ld a, [wCatchModeMonUpdateTimer] ;load ??? and inc it inc a - ld [wd5c4], a + ld [wCatchModeMonUpdateTimer], a and $3 - ret nz -.asm_200e6 + ret nz ;only continue every 4 loops? +.ChangeAnimation ld a, [wBallHitWildMon] and a - jp z, .asm_20167 + jp z, .BallDidntHitMon ;if no ball hit(?), jump xor a - ld [wBallHitWildMon], a - ld a, [wd5c3] - ld [wd5be], a + ld [wBallHitWildMon], a ;toggle off ball hit + ld a, [CurrentCatchMonHitFrameDuration] + ld [wLoopsUntilNextCatchSpriteAnimationChange], a ;load byte 3 of mystery data into ??? (cause it to loop X times between a colision check?) xor a - ld [wd5c4], a + ld [wCatchModeMonUpdateTimer], a ;load 0 into ??? stops double hits? ld a, [wCurrentCatchEmMon] cp MEW - 1 jr nz, .notMew ld a, [wNumMewHitsLow] inc a ld [wNumMewHitsLow], a - jr nz, .asm_20116 + jr nz, .Not256MewHits .notMew ld a, [wNumMonHits] cp $3 jr z, .hitMonThreeTimes inc a ld [wNumMonHits], a -.asm_20116 +.Not256MewHits ld bc, ThreeHundredThousandPoints callba AddBigBCD6FromQueue ld bc, $0030 @@ -134,44 +134,44 @@ Func_200d3: ; 0x200d3 ld de, HitText call LoadStationaryTextAndHeader ld a, [wNumMonHits] - callba Func_10611 + callba Func_10611 ;queue up a graphic based on number of mon hits ld c, $2 - jr .asm_2018a + jr .UpdateMonAnimation .hitMonThreeTimes xor a ld [wTimeRanOut], a ld a, $1 - ld [wPauseTimer], a - ld hl, wd54d + ld [wPauseTimer], a ;pause timer + ld hl, wd54d ;inc ?? inc [hl] ld c, $2 - jr .asm_2018a + jr .UpdateMonAnimation -.asm_20167 - ld a, [wd5be] +.BallDidntHitMon + ld a, [wLoopsUntilNextCatchSpriteAnimationChange] and a - ret nz - ld a, [wd5bc] + ret nz ;run if ??? = 0. wLoopsUntilNextCatchSpriteAnimationChange is how many loops apart to run this? + ld a, [wCurrentAnimatedMonSpriteType] ld c, a - ld a, [wd5bd] - sub c + ld a, [wCurrentAnimatedMonSpriteFrame] + sub c ;if ??? - ??? >= 1, make c 1, else make it 0 cp $1 ld c, $0 - jr nc, .asm_2017c + jr nc, .SetFrameTo0 ld c, $1 -.asm_2017c +.SetFrameTo0 ld b, $0 - ld hl, wd5c1 + ld hl, CurrentCatchMonIdleFrame1Duration ;add c to ???, place it in ???. the mystery data sets how far apart these checks are add hl, bc ld a, [hl] - ld [wd5be], a + ld [wLoopsUntilNextCatchSpriteAnimationChange], a xor a - ld [wd5c4], a -.asm_2018a - ld a, [wd5bc] + ld [wCatchModeMonUpdateTimer], a; 0 out ??? +.UpdateMonAnimation + ld a, [wCurrentAnimatedMonSpriteType] ;add c to first animation type, add to second animation type? add c - ld [wd5bd], a + ld [wCurrentAnimatedMonSpriteFrame], a scf ret @@ -228,39 +228,39 @@ Func_201f2: ; 0x201f2 callba Func_106a6 ret -Func_20230: ; 0x20230 resolve hitting a voltorb in catch mode? - ld a, [wd5b6] +HandleCatchModeVoltorbHit: ; 0x20230 resolve hitting a voltorb in catch mode? + ld a, [NumberOfCatchModeTilesFlipped] cp $18 - jr z, .asm_2029d ;if ?? is 24, add to jackpot and ret c + jr z, .AllTilesFlipped ;if FlippedCount is 24, add to jackpot and ret c sla a ld c, a ld b, $0 ld hl, wd586 - add hl, bc ;else go ???*2 down ??? + add hl, bc ;else go FlippedCount*2 down ??? ld d, $4 -.asm_20242 +.LoopFlippedStatusInsertion ld a, $1 ld [hli], a inc hl ;load in 1 ld a, l - cp wd5b6 % $100 - jr z, .asm_2024e ;continue until you reach ??? or until 4 spaces are done + cp NumberOfCatchModeTilesFlipped % $100 + jr z, .ExitLoop ;continue until you reach FlippedCount or until 4 spaces are done dec d - jr nz, .asm_20242 -.asm_2024e - ld a, [wd5b6] - add $4 ;then add 4 to ??, clamp to 24 + jr nz, .LoopFlippedStatusInsertion +.ExitLoop + ld a, [NumberOfCatchModeTilesFlipped] + add $4 ;then add 4 to FlippedCount, clamp to 24 cp $18 - jr c, .master_loop9 + jr c, .DontClamp ld a, $18 -.master_loop9 - ld [wd5b6], a +.DontClamp + ld [NumberOfCatchModeTilesFlipped], a cp $18 - jr nz, .asm_20264 + jr nz, .NotDoneFlipping xor a ld [wIndicatorStates + 9], a ;if 24, unmark voltorb arrow indicator -.asm_20264 - callba Func_10184 +.NotDoneFlipping + callba Func_10184 ;load billboard graphics? ld bc, OneHundredThousandPoints callba AddBigBCD6FromQueue ld bc, $0010 @@ -270,14 +270,14 @@ Func_20230: ; 0x20230 resolve hitting a voltorb in catch mode? call FillBottomMessageBufferWithBlackTile call EnableBottomText ld hl, wStationaryText2 - ld de, Data_2a3d + ld de, CatchModeTileFlippedScoreStationaryTextHeader call LoadScoreTextFromStack pop de pop bc ld hl, wStationaryText1 ld de, FlippedText call LoadStationaryTextAndHeader -.asm_2029d +.AllTilesFlipped ld bc, $0001 ld de, $0000 call AddBCDEToJackpot diff --git a/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm b/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm index f9d1b86..231eb37 100644 --- a/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm +++ b/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm @@ -389,7 +389,7 @@ DrawAnimatedMon_BlueStage: ; 0x1f58b ld hl, hSCY sub [hl] ld c, a - ld a, [wd5bd] + ld a, [wCurrentAnimatedMonSpriteFrame] ld e, a ld d, $0 ld hl, AnimatedMonOAMIds_BlueStage diff --git a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm index 17f1d2c..d89ca91 100644 --- a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm +++ b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm @@ -190,7 +190,7 @@ DrawAnimatedMon_RedStage: ; 0x17c96 ld hl, hSCY sub [hl] ld c, a - ld a, [wd5bd] + ld a, [wCurrentAnimatedMonSpriteFrame] ld e, a ld d, $0 ld hl, AnimatedMonOAMIds_RedStage diff --git a/engine/pinball_game/evolution_mode.asm b/engine/pinball_game/evolution_mode.asm index d939a9c..cf09641 100755 --- a/engine/pinball_game/evolution_mode.asm +++ b/engine/pinball_game/evolution_mode.asm @@ -30,7 +30,7 @@ ConcludeEvolutionMode: ; 0x10ac8 xor a ld [wInSpecialMode], a ld [wWildMonIsHittable], a - ld [wd5b6], a + ld [NumberOfCatchModeTilesFlipped], a ld [wNumMonHits], a ld [wd551], a ld [wd554], a diff --git a/engine/pokedex.asm b/engine/pokedex.asm index be3c15f..0c57a5b 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -1180,35 +1180,35 @@ Func_287e7: ; 0x287e7 call ReadByteFromBank bit 7, a ret nz - ld [wd5bc], a + ld [wCurrentAnimatedMonSpriteType], a call Func_28815 - ld a, [wd5bd] + ld a, [wCurrentAnimatedMonSpriteFrame] add $a5 ld bc, $2030 call LoadOAMData ret Func_28815: ; 0x28815 - ld a, [wd5be] + ld a, [wLoopsUntilNextCatchSpriteAnimationChange] dec a - ld [wd5be], a + ld [wLoopsUntilNextCatchSpriteAnimationChange], a ret nz ld a, [wBallHitWildMon] inc a and $7 ld [wBallHitWildMon], a jr nz, .asm_28836 - ld a, [wd5c3] - ld [wd5be], a + ld a, [CurrentCatchMonHitFrameDuration] + ld [wLoopsUntilNextCatchSpriteAnimationChange], a xor a - ld [wd5c4], a + ld [wCatchModeMonUpdateTimer], a ld c, $2 jr .asm_28854 .asm_28836 - ld a, [wd5bc] + ld a, [wCurrentAnimatedMonSpriteType] ld c, a - ld a, [wd5bd] + ld a, [wCurrentAnimatedMonSpriteFrame] sub c cp $1 ld c, $0 @@ -1216,16 +1216,16 @@ Func_28815: ; 0x28815 ld c, $1 .asm_28846 ld b, $0 - ld hl, wd5c1 + ld hl, CurrentCatchMonIdleFrame1Duration add hl, bc ld a, [hl] - ld [wd5be], a + ld [wLoopsUntilNextCatchSpriteAnimationChange], a xor a - ld [wd5c4], a + ld [wCatchModeMonUpdateTimer], a .asm_28854 - ld a, [wd5bc] + ld a, [wCurrentAnimatedMonSpriteType] add c - ld [wd5bd], a + ld [wCurrentAnimatedMonSpriteFrame], a ret Func_2885c: ; 0x2885c @@ -1822,20 +1822,20 @@ Func_28bf5: ; 0x28bf5 jr nc, .asm_28c4b inc b .asm_28c4b - ld hl, Data_13685 + ld hl, CatchSpriteFrameDurations add hl, bc - ld a, Bank(Data_13685) + ld a, Bank(CatchSpriteFrameDurations) call ReadByteFromBank - ld [wd5c1], a - ld [wd5be], a + ld [CurrentCatchMonIdleFrame1Duration], a + ld [wLoopsUntilNextCatchSpriteAnimationChange], a inc hl - ld a, Bank(Data_13685) + ld a, Bank(CatchSpriteFrameDurations) call ReadByteFromBank - ld [wd5c2], a + ld [CurrentCatchMonIdleFrame2Duration], a inc hl - ld a, Bank(Data_13685) + ld a, Bank(CatchSpriteFrameDurations) call ReadByteFromBank - ld [wd5c3], a + ld [CurrentCatchMonHitFrameDuration], a ld a, [wCurPokedexIndex] ld c, a ld b, $0 @@ -1843,8 +1843,8 @@ Func_28bf5: ; 0x28bf5 add hl, bc ld a, Bank(MonAnimatedSpriteTypes) call ReadByteFromBank - ld [wd5bc], a - ld [wd5bd], a + ld [wCurrentAnimatedMonSpriteType], a + ld [wCurrentAnimatedMonSpriteFrame], a call Func_28cf8 pop bc ld a, [hGameBoyColorFlag] diff --git a/main.asm b/main.asm index d69c889..faa5a1c 100644 --- a/main.asm +++ b/main.asm @@ -296,7 +296,7 @@ INCLUDE "data/mon_gfx/mon_gfx_pointers.asm" INCLUDE "data/mon_animated_sprite_types.asm" INCLUDE "data/collision/mon_collision_mask_pointers.asm" -Data_13685: ; 0x13685 +CatchSpriteFrameDurations: ; 0x13685 ; Each 3-byte entry is related to an evolution line. Don't know what this is for, yet. db $12, $12, $10 ; EVOLINE_BULBASAUR db $10, $10, $10 ; EVOLINE_CHARMANDER diff --git a/text/scrolling_text.asm b/text/scrolling_text.asm index 096e026..61179e7 100644 --- a/text/scrolling_text.asm +++ b/text/scrolling_text.asm @@ -67,7 +67,7 @@ FlippedText: db $42, $00, $40, $00 db "FLIPPED @" -Data_2a3d: +CatchModeTileFlippedScoreStationaryTextHeader: db $4a, $10, $40, $00, $00, $00 JackpotText: diff --git a/wram.asm b/wram.asm index c906633..d5bf850 100644 --- a/wram.asm +++ b/wram.asm @@ -577,7 +577,7 @@ wInSpecialMode:: ; 0xd54b wSpecialModeCollisionID:: ; 0xd54c 10000 sets it to a input, records what the ball has collided with see constants/special_collision_constants.asm for more info ds $1 -wd54d:: ; 0xd54d catch mode progress? used for all 3 special modes +wd54d:: ; 0xd54d catch mode progress? used for all 3 special modes. incremented when mon in catch mode is hit 3 times ds $1 wd54e:: ; 0xd54e @@ -700,23 +700,23 @@ wTimerDigits:: ; 0xd582 ; fourth byte = unused, but still written to ds $4 -wd586:: ; 0xd586 +wd586:: ; 0xd586 something to do with catch mode billboard flipping ds $30 -wd5b6:: ; 0xd5b6 a 24 wide block starts here and is filled before catch mode. used in catch and evo mode. first step of catch mode only passes if it is 24 +NumberOfCatchModeTilesFlipped:: ; 0xd5b6 a 24 wide block starts here and is filled before catch mode. first step of catch mode only passes if it is 24. top byte records the number of tiles flipped ds $5 wWildMonIsHittable:: ; 0xd5bb ; Set to 1 when the wild pokemon is animated and hittable with the pinball. ds $1 -wd5bc:: ; 0xd5bc +wCurrentAnimatedMonSpriteType:: ; 0xd5bc ds $1 -wd5bd:: ; 0xd5bd +wCurrentAnimatedMonSpriteFrame:: ; 0xd5bd ds $1 -wd5be:: ; 0xd5be +wLoopsUntilNextCatchSpriteAnimationChange:: ; 0xd5be ds $1 wBallHitWildMon:: ; 0xd5bf @@ -725,16 +725,16 @@ wBallHitWildMon:: ; 0xd5bf wNumMonHits:: ; 0xd5c0 ds $1 -wd5c1:: ; 0xd5c1 - ds $1 +CurrentCatchMonIdleFrame1Duration:: ; 0xd5c1 sets wLoopsUntilNextCatchSpriteAnimationChange if wCurrentAnimatedMonSpriteFrame - wCurrentAnimatedMonSpriteType < 1 holds animatedSpriteType + ds $1 ;mystery data byte 1 -wd5c2:: ; 0xd5c2 - ds $1 +CurrentCatchMonIdleFrame2Duration:: ; 0xd5c2 sets wLoopsUntilNextCatchSpriteAnimationChange if wCurrentAnimatedMonSpriteFrame - wCurrentAnimatedMonSpriteType >= 1 + ds $1 ;mystery data byte 2 -wd5c3:: ; 0xd5c3 +CurrentCatchMonHitFrameDuration:: ; 0xd5c3 ds $1 -wd5c4:: ; 0xd5c4 +wCatchModeMonUpdateTimer:: ; 0xd5c4 increments while the caught mon is active once per frame(?), ensuring that the code only checks for the mon being hit every 4 frames or when the animation changes....for some reason (performance?) ds $1 wNumMewHitsLow:: ; 0xd5c5 -- cgit v1.2.3 From a6465434c3e2e944aa8835245a6a8adeac2b9f6a Mon Sep 17 00:00:00 2001 From: chaos-lord Date: Mon, 24 Jul 2017 17:39:48 +0100 Subject: little things --- engine/pinball_game/catchem_mode.asm | 22 +++++++++++----------- .../catchem_mode/catchem_mode_red_field.asm | 10 +++++----- wram.asm | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm index 33c9616..29eb5a0 100644 --- a/engine/pinball_game/catchem_mode.asm +++ b/engine/pinball_game/catchem_mode.asm @@ -179,7 +179,7 @@ CallTable_10178: ; 0x10178 dw Func_109fc ; STAGE_BLUE_FIELD_TOP dw Func_109fc ; STAGE_BLUE_FIELD_BOTTOM -Func_10184: ; 0x10184 called by what looks like the "hit voltorb and shellder" handllers, as well as some evo mode stuff +Func_10184: ; 0x10184 called by what looks like the "hit voltorb and shellder" handllers and after all tiles are flipped, as well as some evo mode stuff ld a, [wCurrentStage] bit 0, a ret z ;skip if stage has no flippers @@ -190,9 +190,9 @@ Func_10184: ; 0x10184 called by what looks like the "hit voltorb and shellder" h rl b add c ld c, a - jr nc, .asm_10199 + jr nc, .NoOverflow inc b -.asm_10199 ;double current catch em mon +.NoOverflow ;double current catch em mon ld hl, MonBillboardPicPointers add hl, bc ld a, [hli] @@ -212,25 +212,25 @@ Func_10184: ; 0x10184 called by what looks like the "hit voltorb and shellder" h ld de, wc000 ld hl, wd586 ;what tiles are flipped? ld c, $0 -.asm_101bb +.Loop24Times ld a, [hli] cp [hl] ld [hli], a ;load first byte into next and test it gainst the second byte, if it's the same skip - jr z, .asm_101d2 + jr z, .NextLoop ld b, a ;else store in b call nz, Func_101d9 ld a, [hGameBoyColorFlag] and a - jr z, .asm_101d2 ;skip if DMG + jr z, .NextLoop ;skip if DMG ld a, [wCurrentStage] bit 0, a ld a, b call nz, Func_10230 ;if lower stage, run ??? -.asm_101d2 +.NextLoop inc c ld a, c cp $18 ;run 24 times - jr nz, .asm_101bb + jr nz, .Loop24Times ret Func_101d9: ; 0x101d9 @@ -245,7 +245,7 @@ Func_101d9: ; 0x101d9 ld [de], a ;1 into de+1 inc de ld b, $0 - ld hl, Data_102a4 ;add c to ??? + ld hl, Data_102a4 ;retrieve ???? c add hl, bc ld c, [hl] sla c @@ -257,7 +257,7 @@ Func_101d9: ; 0x101d9 sla c rl b ;multiply ??? by 16 ld hl, vTilesSH tile $10 ;wut - add hl, bc ;add ???*16 to wut + add hl, bc ;add ???*16 to wut (8 2 bit pixels?) ld a, l ld [de], a inc de @@ -290,7 +290,7 @@ Func_101d9: ; 0x101d9 pop bc push de xor a - ld de, Func_11d2 ;queue graphics load from the adjusted pointer bank 0 using this funch + ld de, Func_11d2 ;queue graphics load from the adjusted pointer bank 0 using this func call QueueGraphicsToLoadWithFunc pop de pop hl diff --git a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm index f6ffbfc..5be7e20 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm @@ -27,18 +27,18 @@ PointerTable_20021: ; 0x20021 Func_20041: ; 0x20041 ld a, [NumberOfCatchModeTilesFlipped] - cp $18 ;if not 24, ret - jr nz, .asm_2005d + cp $18 ;if not 24 and not on lower stage, ret + jr nz, .NotDone ld a, [wCurrentStage] bit 0, a - jr z, .asm_2005d + jr z, .NotDone ld hl, wd54d - inc [hl] + inc [hl] ;else progress catch em mode ld a, $14 ld [wd54e], a ld a, $5 ld [wd54f], a -.asm_2005d +.NotDone scf ret diff --git a/wram.asm b/wram.asm index d5bf850..42cc1c4 100644 --- a/wram.asm +++ b/wram.asm @@ -577,13 +577,13 @@ wInSpecialMode:: ; 0xd54b wSpecialModeCollisionID:: ; 0xd54c 10000 sets it to a input, records what the ball has collided with see constants/special_collision_constants.asm for more info ds $1 -wd54d:: ; 0xd54d catch mode progress? used for all 3 special modes. incremented when mon in catch mode is hit 3 times +wd54d:: ; 0xd54d catch mode current step? used for all 3 special modes. ds $1 -wd54e:: ; 0xd54e +wd54e:: ; 0xd54e set to 20 by catch mode when all tiles are flipped and on lower stage ds $1 -wd54f:: ; 0xd54f +wd54f:: ; 0xd54f set to 5 by catch mode when all tiles are flipped and on lower stage ds $1 wSpecialMode:: ; 0xd550 @@ -700,7 +700,7 @@ wTimerDigits:: ; 0xd582 ; fourth byte = unused, but still written to ds $4 -wd586:: ; 0xd586 something to do with catch mode billboard flipping +wd586:: ; 0xd586 something to do with catch mode billboard flipping. array of flags that set wether each tile is gray? ds $30 NumberOfCatchModeTilesFlipped:: ; 0xd5b6 a 24 wide block starts here and is filled before catch mode. first step of catch mode only passes if it is 24. top byte records the number of tiles flipped -- cgit v1.2.3 From 42c14b08922c7feae1f492d6f3612b1514f2027b Mon Sep 17 00:00:00 2001 From: chaos-lord Date: Mon, 24 Jul 2017 18:08:28 +0100 Subject: fix labels --- engine/pinball_game/catchem_mode.asm | 14 +++++++------- .../pinball_game/catchem_mode/catchem_mode_blue_field.asm | 14 +++++++------- .../pinball_game/catchem_mode/catchem_mode_red_field.asm | 14 +++++++------- engine/pinball_game/evolution_mode.asm | 2 +- engine/pokedex.asm | 10 +++++----- wram.asm | 8 ++++---- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm index 8a9e427..09192f6 100644 --- a/engine/pinball_game/catchem_mode.asm +++ b/engine/pinball_game/catchem_mode.asm @@ -58,21 +58,21 @@ StartCatchEmMode: ; 0x1003f ld bc, CatchSpriteFrameDurations ;mystery data, seems pokedex related too add hl, bc ld a, [hli] - ld [CurrentCatchMonIdleFrame1Duration], a + ld [wCurrentCatchMonIdleFrame1Duration], a ld [wLoopsUntilNextCatchSpriteAnimationChange], a ld a, [hli] - ld [CurrentCatchMonIdleFrame2Duration], a + ld [wCurrentCatchMonIdleFrame2Duration], a ld a, [hli] - ld [CurrentCatchMonHitFrameDuration], a ;load the 3 bytes into ???? + ld [wCurrentCatchMonHitFrameDuration], a ;load the 3 bytes into ???? ld hl, wBillboardTilesIlluminationStates - ld a, [NumberOfCatchModeTilesFlipped] + ld a, [wNumberOfCatchModeTilesFlipped] ld c, a and a ld b, $18 jr z, .asm_100c7 ;if tiles flipped = 0, jump with b = 24 (2 seperate loops?) .asm_100ba ld a, $1 - ld [hli], a ;load 1 then 0 into data from NumberOfCatchModeTilesFlipped C times, where C is the contents of NumberOfCatchModeTilesFlipped + ld [hli], a ;load 1 then 0 into data from wNumberOfCatchModeTilesFlipped C times, where C is the contents of wNumberOfCatchModeTilesFlipped xor a ld [hli], a dec b @@ -81,7 +81,7 @@ StartCatchEmMode: ; 0x1003f ld a, b ;load 24 - times looped into a, if 0: skip and a jr z, .asm_100ce -.asm_100c7 ;loop 0 then 1 into the rest of the data from NumberOfCatchModeTilesFlipped +.asm_100c7 ;loop 0 then 1 into the rest of the data from wNumberOfCatchModeTilesFlipped xor a ld [hli], a inc a @@ -165,7 +165,7 @@ ConcludeCatchEmMode: ; 0x10157 ld [wInSpecialMode], a ld [wWildMonIsHittable], a ld [wd5c6], a - ld [NumberOfCatchModeTilesFlipped], a + ld [wNumberOfCatchModeTilesFlipped], a ld [wNumMonHits], a call ClearWildMonCollisionMask callba StopTimer diff --git a/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm index 8fc2a56..b990c8d 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_blue_field.asm @@ -28,7 +28,7 @@ PointerTable_202e2: ; 0x202e2 padded_dab Func_2048f Func_20302: ; 0x20302 - ld a, [NumberOfCatchModeTilesFlipped] + ld a, [wNumberOfCatchModeTilesFlipped] cp $18 jr nz, .asm_2031e ld a, [wCurrentStage] @@ -101,7 +101,7 @@ Func_20394: ; 0x20394 jp z, .asm_20428 xor a ld [wBallHitWildMon], a - ld a, [CurrentCatchMonHitFrameDuration] + ld a, [wCurrentCatchMonHitFrameDuration] ld [wLoopsUntilNextCatchSpriteAnimationChange], a xor a ld [wCatchModeMonUpdateTimer], a @@ -164,7 +164,7 @@ Func_20394: ; 0x20394 ld c, $1 .asm_2043d ld b, $0 - ld hl, CurrentCatchMonIdleFrame1Duration + ld hl, wCurrentCatchMonIdleFrame1Duration add hl, bc ld a, [hl] ld [wLoopsUntilNextCatchSpriteAnimationChange], a @@ -231,7 +231,7 @@ Func_204b3: ; 0x204b3 ret Func_204f1: ; 0x204f1 - ld a, [NumberOfCatchModeTilesFlipped] + ld a, [wNumberOfCatchModeTilesFlipped] cp $18 jr z, .asm_2055e sla a @@ -245,18 +245,18 @@ Func_204f1: ; 0x204f1 ld [hli], a inc hl ld a, l - cp NumberOfCatchModeTilesFlipped % $100 + cp wNumberOfCatchModeTilesFlipped % $100 jr z, .asm_2050f dec d jr nz, .asm_20503 .asm_2050f - ld a, [NumberOfCatchModeTilesFlipped] + ld a, [wNumberOfCatchModeTilesFlipped] add $4 cp $18 jr c, .asm_2051a ld a, $18 .asm_2051a - ld [NumberOfCatchModeTilesFlipped], a + ld [wNumberOfCatchModeTilesFlipped], a cp $18 jr nz, .asm_20525 xor a diff --git a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm index 35b1ab4..e0e4f60 100644 --- a/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm +++ b/engine/pinball_game/catchem_mode/catchem_mode_red_field.asm @@ -26,7 +26,7 @@ PointerTable_20021: ; 0x20021 padded_dab Func_201ce Func_20041: ; 0x20041 - ld a, [NumberOfCatchModeTilesFlipped] + ld a, [wNumberOfCatchModeTilesFlipped] cp $18 ;if not 24 and not on lower stage, ret jr nz, .NotDone ld a, [wCurrentStage] @@ -99,7 +99,7 @@ CatchEmModeUpdateMonStateRedTable: ; 0x200d3 jp z, .BallDidntHitMon ;if no ball hit(?), jump xor a ld [wBallHitWildMon], a ;toggle off ball hit - ld a, [CurrentCatchMonHitFrameDuration] + ld a, [wCurrentCatchMonHitFrameDuration] ld [wLoopsUntilNextCatchSpriteAnimationChange], a ;load byte 3 of mystery data into ??? (cause it to loop X times between a colision check?) xor a ld [wCatchModeMonUpdateTimer], a ;load 0 into ??? stops double hits? @@ -162,7 +162,7 @@ CatchEmModeUpdateMonStateRedTable: ; 0x200d3 ld c, $1 .SetFrameTo0 ld b, $0 - ld hl, CurrentCatchMonIdleFrame1Duration ;add c to ???, place it in ???. the mystery data sets how far apart these checks are + ld hl, wCurrentCatchMonIdleFrame1Duration ;add c to ???, place it in ???. the mystery data sets how far apart these checks are add hl, bc ld a, [hl] ld [wLoopsUntilNextCatchSpriteAnimationChange], a @@ -229,7 +229,7 @@ Func_201f2: ; 0x201f2 ret HandleCatchModeVoltorbHit: ; 0x20230 resolve hitting a voltorb in catch mode? - ld a, [NumberOfCatchModeTilesFlipped] + ld a, [wNumberOfCatchModeTilesFlipped] cp $18 jr z, .AllTilesFlipped ;if FlippedCount is 24, add to jackpot and ret c sla a @@ -243,18 +243,18 @@ HandleCatchModeVoltorbHit: ; 0x20230 resolve hitting a voltorb in catch mode? ld [hli], a inc hl ;load in 1 ld a, l - cp NumberOfCatchModeTilesFlipped % $100 + cp wNumberOfCatchModeTilesFlipped % $100 jr z, .ExitLoop ;continue until you reach FlippedCount or until 4 spaces are done dec d jr nz, .LoopFlippedStatusInsertion .ExitLoop - ld a, [NumberOfCatchModeTilesFlipped] + ld a, [wNumberOfCatchModeTilesFlipped] add $4 ;then add 4 to FlippedCount, clamp to 24 cp $18 jr c, .DontClamp ld a, $18 .DontClamp - ld [NumberOfCatchModeTilesFlipped], a + ld [wNumberOfCatchModeTilesFlipped], a cp $18 jr nz, .NotDoneFlipping xor a diff --git a/engine/pinball_game/evolution_mode.asm b/engine/pinball_game/evolution_mode.asm index b6e5bcc..164b92b 100755 --- a/engine/pinball_game/evolution_mode.asm +++ b/engine/pinball_game/evolution_mode.asm @@ -30,7 +30,7 @@ ConcludeEvolutionMode: ; 0x10ac8 xor a ld [wInSpecialMode], a ld [wWildMonIsHittable], a - ld [NumberOfCatchModeTilesFlipped], a + ld [wNumberOfCatchModeTilesFlipped], a ld [wNumMonHits], a ld [wd551], a ld [wd554], a diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 0c57a5b..d8eea4e 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -1198,7 +1198,7 @@ Func_28815: ; 0x28815 and $7 ld [wBallHitWildMon], a jr nz, .asm_28836 - ld a, [CurrentCatchMonHitFrameDuration] + ld a, [wCurrentCatchMonHitFrameDuration] ld [wLoopsUntilNextCatchSpriteAnimationChange], a xor a ld [wCatchModeMonUpdateTimer], a @@ -1216,7 +1216,7 @@ Func_28815: ; 0x28815 ld c, $1 .asm_28846 ld b, $0 - ld hl, CurrentCatchMonIdleFrame1Duration + ld hl, wCurrentCatchMonIdleFrame1Duration add hl, bc ld a, [hl] ld [wLoopsUntilNextCatchSpriteAnimationChange], a @@ -1826,16 +1826,16 @@ Func_28bf5: ; 0x28bf5 add hl, bc ld a, Bank(CatchSpriteFrameDurations) call ReadByteFromBank - ld [CurrentCatchMonIdleFrame1Duration], a + ld [wCurrentCatchMonIdleFrame1Duration], a ld [wLoopsUntilNextCatchSpriteAnimationChange], a inc hl ld a, Bank(CatchSpriteFrameDurations) call ReadByteFromBank - ld [CurrentCatchMonIdleFrame2Duration], a + ld [wCurrentCatchMonIdleFrame2Duration], a inc hl ld a, Bank(CatchSpriteFrameDurations) call ReadByteFromBank - ld [CurrentCatchMonHitFrameDuration], a + ld [wCurrentCatchMonHitFrameDuration], a ld a, [wCurPokedexIndex] ld c, a ld b, $0 diff --git a/wram.asm b/wram.asm index f0b66a1..973e2b7 100644 --- a/wram.asm +++ b/wram.asm @@ -712,7 +712,7 @@ wBillboardTilesIlluminationStates:: ; 0xd586 ; Bytes 2 = Previous illumination state. This is used to avoid re-loading the same graphics. ds $18 * 2 -NumberOfCatchModeTilesFlipped:: ; 0xd5b6 a 24 wide block starts here and is filled before catch mode. first step of catch mode only passes if it is 24. top byte records the number of tiles flipped +wNumberOfCatchModeTilesFlipped:: ; 0xd5b6 a 24 wide block starts here and is filled before catch mode. first step of catch mode only passes if it is 24. top byte records the number of tiles flipped ds $5 wWildMonIsHittable:: ; 0xd5bb @@ -734,13 +734,13 @@ wBallHitWildMon:: ; 0xd5bf wNumMonHits:: ; 0xd5c0 ds $1 -CurrentCatchMonIdleFrame1Duration:: ; 0xd5c1 sets wLoopsUntilNextCatchSpriteAnimationChange if wCurrentAnimatedMonSpriteFrame - wCurrentAnimatedMonSpriteType < 1 holds animatedSpriteType +wCurrentCatchMonIdleFrame1Duration:: ; 0xd5c1 sets wLoopsUntilNextCatchSpriteAnimationChange if wCurrentAnimatedMonSpriteFrame - wCurrentAnimatedMonSpriteType < 1 holds animatedSpriteType ds $1 ;mystery data byte 1 -CurrentCatchMonIdleFrame2Duration:: ; 0xd5c2 sets wLoopsUntilNextCatchSpriteAnimationChange if wCurrentAnimatedMonSpriteFrame - wCurrentAnimatedMonSpriteType >= 1 +wCurrentCatchMonIdleFrame2Duration:: ; 0xd5c2 sets wLoopsUntilNextCatchSpriteAnimationChange if wCurrentAnimatedMonSpriteFrame - wCurrentAnimatedMonSpriteType >= 1 ds $1 ;mystery data byte 2 -CurrentCatchMonHitFrameDuration:: ; 0xd5c3 +wCurrentCatchMonHitFrameDuration:: ; 0xd5c3 ds $1 wCatchModeMonUpdateTimer:: ; 0xd5c4 increments while the caught mon is active once per frame(?), ensuring that the code only checks for the mon being hit every 4 frames or when the animation changes....for some reason (performance?) -- cgit v1.2.3