diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | main.asm | 447 | ||||
| -rw-r--r-- | textpre.py | 2 | 
3 files changed, 291 insertions, 160 deletions
| @@ -15,7 +15,7 @@ redrle: extras/redrle.c  	${CC} -o $@ $>  .asm.tx: -	python textpre.py  < $< > $@ +	python2 textpre.py  < $< > $@  pokered.gbc: pokered.o  	rgblink -o $@ $< @@ -5141,7 +5141,7 @@ IncGradGBPalTable_01: ; 210D  	db %11111111 ;BG Pal  	db %11111111 ;OBJ Pal 1  	db %11111111 ;OBJ Pal 2 -                     ;and so on... +	             ;and so on...  	db %11111110  	db %11111110  	db %11111000 @@ -18447,133 +18447,133 @@ INCBIN "baserom.gbc",$12488,$12953 - $12488  ; Predef 0x37  StatusScreen: ; 0x12953 -    call LoadMonData -    ld a, [$cc49] -    cp $2 ; 2 means we're in a PC box -    jr c, .DontRecalculate ; 0x1295b $14 -    ld a, [$cf9b] -    ld [$cfb9], a -    ld [$d127], a -    ld hl, $cfa8 -    ld de, $cfba -    ld b, $1 -    call $3936 ; Recalculate stats +	call LoadMonData +	ld a, [$cc49] +	cp $2 ; 2 means we're in a PC box +	jr c, .DontRecalculate ; 0x1295b $14 +	ld a, [$cf9b] +	ld [$cfb9], a +	ld [$d127], a +	ld hl, $cfa8 +	ld de, $cfba +	ld b, $1 +	call $3936 ; Recalculate stats  .DontRecalculate -    ld hl, $d72c -    set 1, [hl] -    ld a, $33 -    ld [$ff00+$24], a ; Reduce the volume -    call GBPalWhiteOutWithDelay3 -    call ClearScreen -    call $2429 ; move sprites (?) -    call LoadHpBarAndStatusTilePatterns -    ld de, $6080 ; source -    ld hl, $96d0 ; dest -    ld bc, $0403 ; bank bytes/8 -    call CopyVideoDataDouble ; ·│ :L and halfarrow line end -    ld de, $6098 -    ld hl, $9780 -    ld bc, $0401 -    call CopyVideoDataDouble ; │ -    ld de, $60b0 -    ld hl, $9760 -    ld bc, $0402 -    call CopyVideoDataDouble ; ─┘ -    ld de, PTile -    ld hl, $9720 -    ld bc,(BANK(PTile) << 8 | $01) -    call CopyVideoDataDouble ; P (for PP), inline -    ld a, [$ff00+$d7] -    push af -    xor a -    ld [$ff00+$d7], a -    FuncCoord 19,1 -    ld hl, Coord -    ld bc, $060a -    call DrawLineBox ; Draws the box around name, HP and status -    ld de, $fffa -    add hl, de -    ld [hl], $f2 ; . after No ("." is a different one) -    dec hl -    ld [hl], $74 ; No -    FuncCoord 19,9 -    ld hl, Coord -    ld bc, $0806 -    call DrawLineBox ; Draws the box around types, ID No. and OT -    FuncCoord 10,9 -    ld hl, Coord -    ld de, Type1Text -    call PlaceString ; "TYPE1/" -    FuncCoord 11,3 -    ld hl, Coord -    ld a, $5f -    call Predef ; Draws HP bar -    ld hl, $cf25 -    call $3df9 -    ld b, $3 -    call GoPAL_SET ; SGB palette -    FuncCoord 16,6 -    ld hl, Coord -    ld de, $cf9c -    call PrintStatusCondition -    jr nz, .StatusWritten\@ ; 0x129fc $9 -    FuncCoord 16,6 -    ld hl, Coord -    ld de, OKText -    call PlaceString ; "OK" +	ld hl, $d72c +	set 1, [hl] +	ld a, $33 +	ld [$ff00+$24], a ; Reduce the volume +	call GBPalWhiteOutWithDelay3 +	call ClearScreen +	call $2429 ; move sprites (?) +	call LoadHpBarAndStatusTilePatterns +	ld de, $6080 ; source +	ld hl, $96d0 ; dest +	ld bc, $0403 ; bank bytes/8 +	call CopyVideoDataDouble ; ·│ :L and halfarrow line end +	ld de, $6098 +	ld hl, $9780 +	ld bc, $0401 +	call CopyVideoDataDouble ; │ +	ld de, $60b0 +	ld hl, $9760 +	ld bc, $0402 +	call CopyVideoDataDouble ; ─┘ +	ld de, PTile +	ld hl, $9720 +	ld bc,(BANK(PTile) << 8 | $01) +	call CopyVideoDataDouble ; P (for PP), inline +	ld a, [$ff00+$d7] +	push af +	xor a +	ld [$ff00+$d7], a +	FuncCoord 19,1 +	ld hl, Coord +	ld bc, $060a +	call DrawLineBox ; Draws the box around name, HP and status +	ld de, $fffa +	add hl, de +	ld [hl], $f2 ; . after No ("." is a different one) +	dec hl +	ld [hl], $74 ; No +	FuncCoord 19,9 +	ld hl, Coord +	ld bc, $0806 +	call DrawLineBox ; Draws the box around types, ID No. and OT +	FuncCoord 10,9 +	ld hl, Coord +	ld de, Type1Text +	call PlaceString ; "TYPE1/" +	FuncCoord 11,3 +	ld hl, Coord +	ld a, $5f +	call Predef ; Draws HP bar +	ld hl, $cf25 +	call $3df9 +	ld b, $3 +	call GoPAL_SET ; SGB palette +	FuncCoord 16,6 +	ld hl, Coord +	ld de, $cf9c +	call PrintStatusCondition +	jr nz, .StatusWritten\@ ; 0x129fc $9 +	FuncCoord 16,6 +	ld hl, Coord +	ld de, OKText +	call PlaceString ; "OK"  .StatusWritten\@ -    FuncCoord 9,6 -    ld hl, Coord -    ld de, StatusText -    call PlaceString ; "STATUS/" -    FuncCoord 14,2 -    ld hl, Coord -    call PrintLevel ; Pokémon level -    ld a, [$d0b8] -    ld [$d11e], a -    ld [$d0b5], a -    ld a, $3a -    call Predef -    FuncCoord 3,7 -    ld hl, Coord -    ld de, $d11e -    ld bc, $8103 ; Zero-padded, 3 -    call PrintNumber ; Pokémon no. -    FuncCoord 11,10 -    ld hl, Coord -    ld a, $4b -    call Predef ; Prints the type (?) -    ld hl, $6a9d -    call .unk_12a7e -    ld d, h -    ld e, l -    FuncCoord 9,1 -    ld hl, Coord -    call PlaceString ; Pokémon name -    ld hl, $6a95 -    call .unk_12a7e -    ld d, h -    ld e, l -    FuncCoord 12,16 -    ld hl, Coord -    call PlaceString ; OT -    FuncCoord 12,14 -    ld hl, Coord -    ld de, $cfa4 -    ld bc, $8205 ; 5 -    call PrintNumber ; ID Number -    ld d, $0 -    call PrintStatsBox -    call Delay3 -    call GBPalNormal -    ld hl, $c3a1 -    call $1384 ; draw Pokémon picture -    ld a, [$cf91] -    call $13d0 ; play Pokémon cry -    call $3865 ; wait for button -    pop af -    ld [$ff00+$d7], a -    ret +	FuncCoord 9,6 +	ld hl, Coord +	ld de, StatusText +	call PlaceString ; "STATUS/" +	FuncCoord 14,2 +	ld hl, Coord +	call PrintLevel ; Pokémon level +	ld a, [$d0b8] +	ld [$d11e], a +	ld [$d0b5], a +	ld a, $3a +	call Predef +	FuncCoord 3,7 +	ld hl, Coord +	ld de, $d11e +	ld bc, $8103 ; Zero-padded, 3 +	call PrintNumber ; Pokémon no. +	FuncCoord 11,10 +	ld hl, Coord +	ld a, $4b +	call Predef ; Prints the type (?) +	ld hl, $6a9d +	call .unk_12a7e +	ld d, h +	ld e, l +	FuncCoord 9,1 +	ld hl, Coord +	call PlaceString ; Pokémon name +	ld hl, $6a95 +	call .unk_12a7e +	ld d, h +	ld e, l +	FuncCoord 12,16 +	ld hl, Coord +	call PlaceString ; OT +	FuncCoord 12,14 +	ld hl, Coord +	ld de, $cfa4 +	ld bc, $8205 ; 5 +	call PrintNumber ; ID Number +	ld d, $0 +	call PrintStatsBox +	call Delay3 +	call GBPalNormal +	ld hl, $c3a1 +	call $1384 ; draw Pokémon picture +	ld a, [$cf91] +	call $13d0 ; play Pokémon cry +	call $3865 ; wait for button +	pop af +	ld [$ff00+$d7], a +	ret  .unk_12a7e ; 0x12a7e ; I don't know what this does, iterates over pointers?  	ld a, [$cc49]  	add a @@ -18593,22 +18593,22 @@ StatusScreen: ; 0x12953  INCBIN "baserom.gbc",$12a95,$12aa5 - $12a95 ; This is some pointers..  Type1Text: ; 0x12aa5 -    db "TYPE1/", $4e +	db "TYPE1/", $4e  Type2Text: ;  -    db "TYPE2/", $4e +	db "TYPE2/", $4e  IDNoText: -    db $73, $74, "/", $4e +	db $73, $74, "/", $4e  OTText: -    db "OT/", $4e, "@" +	db "OT/", $4e, "@"  StatusText: -    db "STATUS/@" +	db "STATUS/@"  OKText: ; 0x12ac4 -    db "OK@" +	db "OK@"  ; Draws a line starting from hl high b and wide c  DrawLineBox ; 0x12ac7 @@ -18645,7 +18645,7 @@ PrintStatsBox: ; 12ae4  	ld bc, $0019 ; Number offset  	jr .PrintStats ; 0x12af8 $10  .DifferentBox -    FuncCoord 9,2 +	FuncCoord 9,2  	ld hl, Coord  	ld b, $8  	ld c, $9 @@ -18678,10 +18678,10 @@ PrintStat  	ret  StatsText: -    db "ATTACK", $4e -    db "DEFENSE", $4e -    db "SPEED", $4e -    db "SPECIAL", $50 +	db "ATTACK", $4e +	db "DEFENSE", $4e +	db "SPEED", $4e +	db "SPECIAL", $50  StatusScreen2: ; 12b57  	ld a, [$ff00+$d7] @@ -18786,7 +18786,7 @@ StatusScreen2: ; 12b57  	cp $4  	jr nz, .PrintPP ; 0x12c0f $b2  .PPDone -    FuncCoord 9,3 +	FuncCoord 9,3  	ld hl, Coord  	ld de, EXPPointsText  	call PlaceString @@ -18797,7 +18797,7 @@ StatusScreen2: ; 12b57  	inc a  	ld [$cfb9], a ; Increase temporarily if not 100  .Level100 -    FuncCoord 14,6 +	FuncCoord 14,6  	ld hl, Coord  	ld [hl], $70 ; 1-tile "to"  	inc hl @@ -18869,10 +18869,10 @@ StatusScreen2: ; 12b57  	ret  EXPPointsText: -    db "EXP POINTS", $4e -     +	db "EXP POINTS", $4e +  LevelUpText: -    db "LEVEL UP", $50 +	db "LEVEL UP", $50  INCBIN "baserom.gbc",$12cc3,$12cd2 - $12cc3 @@ -45974,7 +45974,97 @@ SeafoamIslands5Object: ; 0x468bc (size=62)  SeafoamIslands5Blocks: ; 0x468fa 135  	INCBIN "maps/seafoamislands5.blk" -INCBIN "baserom.gbc",$46981,2262 +INCBIN "baserom.gbc",$46981,$46a40-$46981 + +HiddenObjectMaps: +	db REDS_HOUSE_2F +	db BLUES_HOUSE +	db OAKS_LAB +	db VIRIDIAN_POKECENTER +	db VIRIDIAN_MART +	db VIRIDIAN_SCHOOL +	db VIRIDIAN_GYM +	db MUSEUM_1F +	db PEWTER_GYM +	db PEWTER_MART +	db PEWTER_POKECENTER +	db CERULEAN_POKECENTER +	db CERULEAN_GYM +	db CERULEAN_MART +	db LAVENDER_POKECENTER +	db VERMILION_POKECENTER +	db VERMILION_GYM +	db CELADON_MANSION_2 +	db CELADON_POKECENTER +	db CELADON_GYM +	db GAME_CORNER +	db CELADON_HOTEL +	db FUCHSIA_POKECENTER +	db FUCHSIA_GYM +	db CINNABAR_GYM +	db CINNABAR_POKECENTER +	db SAFFRON_GYM +	db MT_MOON_POKECENTER +	db ROCK_TUNNEL_POKECENTER +	db BATTLE_CENTER +	db TRADE_CENTER +	db VIRIDIAN_FOREST +	db MT_MOON_3 +	db INDIGO_PLATEAU +	db ROUTE_25 +	db ROUTE_9 +	db SS_ANNE_6 +	db SS_ANNE_10 +	db ROCKET_HIDEOUT_1 +	db ROCKET_HIDEOUT_3 +	db ROCKET_HIDEOUT_4 +	db SAFFRON_POKECENTER +	db POKEMONTOWER_5 +	db ROUTE_13 +	db SAFARIZONEENTRANCE +	db SAFARI_ZONE_WEST +	db SILPH_CO_5F +	db SILPH_CO_9F +	db COPYCATS_HOUSE_2F +	db UNKNOWN_DUNGEON_1 +	db UNKNOWN_DUNGEON_3 +	db POWER_PLANT +	db SEAFOAM_ISLANDS_3 +	db SEAFOAM_ISLANDS_5 +	db MANSION_1 +	db MANSION_3 +	db ROUTE_23 +	db VICTORY_ROAD_2 +	db $6F +	db BILLS_HOUSE +	db VIRIDIAN_CITY +	db SAFARI_ZONE_REST_HOUSE_2 +	db SAFARI_ZONE_REST_HOUSE_3 +	db SAFARI_ZONE_REST_HOUSE_4 +	db $B9 +	db LAVENDER_HOUSE_1 +	db CELADON_MANSION_5 +	db FIGHTINGDOJO +	db ROUTE_10 +	db INDIGO_PLATEAU_LOBBY +	db CINNABAR_LAB_4 +	db BIKE_SHOP +	db ROUTE_11 +	db ROUTE_12 +	db MANSION_2 +	db MANSION_4 +	db SILPH_CO_11F +	db ROUTE_17 +	db UNDERGROUND_PATH_NS +	db UNDERGROUND_PATH_WE +	db CELADON_CITY +	db SEAFOAM_ISLANDS_4 +	db VERMILION_CITY +	db CERULEAN_CITY +	db ROUTE_4 +	db $FF + +INCBIN "baserom.gbc",$46a96,$48000-$46a96  SECTION "bank12",DATA,BANK[$12] @@ -66554,7 +66644,46 @@ SilphCo11Object: ; 0x62380 (size=72)  SilphCo11Blocks: ; 0x623c8 81  	INCBIN "maps/silphco11.blk" -INCBIN "baserom.gbc",$62419,$62453 - $62419 +GymStatues: ; 0x62419 +; if in a gym and have the corresponding badge, a = $D and jp $3EF5 +; if in a gym and don’t have the corresponding badge, a = $C and jp $3EF5 +; else ret  +	call $3c3c +	ld a, [$c109] +	cp $4 +	ret nz +	ld hl, .BadgeFlags +	ld a, [W_CURMAP] +	ld b, a +.asm_62429 +	ld a, [hli] +	cp $ff +	ret z +	cp b +	jr z, .asm_62433 ; 0x6242e $3 +	inc hl +	jr .asm_62429 ; 0x62431 $f6 +.asm_62433 +	ld b, [hl] +	ld a, [$d72a] +	and b +	cp b +	ld a, $d +	jr z, .asm_6243f ; 0x6243b $2 +	ld a, $c +.asm_6243f +	jp $3ef5 + +.BadgeFlags: +	db PEWTER_GYM,   %00000001 +	db CERULEAN_GYM, %00000010 +	db VERMILION_GYM,%00000100 +	db CELADON_GYM,  %00001000 +	db FUCHSIA_GYM,  %00010000 +	db SAFFRON_GYM,  %00100000 +	db CINNABAR_GYM, %01000000 +	db VIRIDIAN_GYM, %10000000 +	db $ff  UnnamedText_62453: ; 0x62453  	TX_FAR _UnnamedText_62453 @@ -66707,10 +66836,10 @@ DecrementPP: ; 0x68000  	ld a, [de]  	cp a, STRUGGLE  	ret z                ; if the pokemon is using "struggle", there's nothing to do -                         ; we don't decrement PP for "struggle" +	                     ; we don't decrement PP for "struggle"  	ld hl, W_PLAYERBATTSTATUS1  	ld a, [hli]          ; load the W_PLAYERBATTSTATUS1 pokemon status flags and increment hl to load the -                         ; W_PLAYERBATTSTATUS2 status flags later +	                     ; W_PLAYERBATTSTATUS2 status flags later  	and a, 7             ; check to see if bits 0, 1, or 2 are set  	ret nz               ; if any of these statuses are true, don't decrement PP  	bit 6, [hl]          ; check 6th bit status flag on W_PLAYERBATTSTATUS2 @@ -66721,14 +66850,14 @@ DecrementPP: ; 0x68000  	ld a, [$D064]        ; load pokemon status bits?  	bit 3, a             ; XXX transform status?  	ret nz               ; If it is, return.  Pokemon Red stores the "current pokemon's" PP -                         ; separately from the "Pokemon in your party's" PP.  This is -                         ; duplication -- in all cases *other* than Pokemon with Transform. -                         ; Normally, this means we have to go on and make the same      -                         ; modification to the "party's pokemon" PP that we made to the -                         ; "current pokemon's" PP.  But, if we're dealing with a Transformed -                         ; Pokemon, it has separate PP for the move set that it copied from -                         ; its opponent, which is *not* the same as its real PP as part of your -                         ; party.  So we return, and don't do that part. +	                     ; separately from the "Pokemon in your party's" PP.  This is +	                     ; duplication -- in all cases *other* than Pokemon with Transform. +	                     ; Normally, this means we have to go on and make the same      +	                     ; modification to the "party's pokemon" PP that we made to the +	                     ; "current pokemon's" PP.  But, if we're dealing with a Transformed +	                     ; Pokemon, it has separate PP for the move set that it copied from +	                     ; its opponent, which is *not* the same as its real PP as part of your +	                     ; party.  So we return, and don't do that part.  	ld hl, $D188         ; PP of first move (in party)  	ld a, [$CC2F]        ; which mon in party is active @@ -66739,7 +66868,7 @@ DecrementPP: ; 0x68000  	ld c, a  	ld b, 0  	add hl ,bc           ; calculate the address in memory of the PP we need to decrement -                         ; based on the move chosen. +	                     ; based on the move chosen.  	dec [hl]             ; Decrement PP  	ret  ; 0x6802f @@ -68042,9 +68171,11 @@ TheEndGfx: ; 473E  INCBIN "baserom.gbc",$747de,$74872 - $747de  Unnamed_ASM_74872: ; 0x74872 -                    ; code similar to this appears in a lot of banks; this particular -	call $20EF		; one is called after you beat the Rocket that gives you TM28 DIG -	ld a, $07		; the screen then fades out, he disappears, and fades back in +; code similar to this appears in a lot of banks; this particular +; one is called after you beat the Rocket that gives you TM28 DIG. +; the screen then fades out, he disappears, and fades back in +	call $20EF +	ld a, $07  	ld [$CC4D], a  	ld a, $15  	call $3E6D @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2  # -*- coding: utf-8 -*-  import sys | 
