Skip to content

Commit

Permalink
Merge pull request #25 from fellowship-of-the-roms/core
Browse files Browse the repository at this point in the history
Update Gen III branch with stuff from Core
  • Loading branch information
Monstarules committed Apr 30, 2024
2 parents 72c19dd + 5382490 commit 92083c6
Show file tree
Hide file tree
Showing 181 changed files with 1,787 additions and 1,086 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# compiled graphics
*.1bpp
*.2bpp
*.2bpp.vtiles2
*.2bpp.vtiles4
*.2bpp.vtiles5
*.lz
*.gbcpal
*.dimensions
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ crystal_vc: pokecrystal.patch
clean: tidy
find gfx \
\( -name "*.[12]bpp" \
-o -name "*.2bpp.vtiles[245]" \
-o -name "*.lz" \
-o -name "*.gbcpal" \
-o -name "*.sgb.tilemap" \) \
Expand Down Expand Up @@ -267,6 +268,15 @@ gfx/mobile/stadium2_n64.2bpp: tools/gfx += --trim-whitespace
$(if $(tools/gfx),\
tools/gfx $(tools/gfx) -d1 -o $@ $@)

%.2bpp.vtiles2: %.2bpp
$Qtools/sub_2bpp.sh $< 128 > $@

%.2bpp.vtiles4: %.2bpp
$Qtools/sub_2bpp.sh $< 256 128 > $@

%.2bpp.vtiles5: %.2bpp
$Qtools/sub_2bpp.sh $< 128 128 > $@

%.gbcpal: %.png
$(RGBGFX) -c embedded -p $@ $<

Expand Down
2 changes: 1 addition & 1 deletion constants/collision_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DEF WALL_TILE EQU $0f
DEF TALK EQU $10

; collision data types (see data/tilesets/*_collision.asm)
; TileCollisionTable indexes (see data/collision/collision_permissions.asm)
; CollisionPermissionTable indexes (see data/collision/collision_permissions.asm)
DEF COLL_FLOOR EQU $00
DEF COLL_01 EQU $01 ; garbage
DEF COLL_03 EQU $03 ; garbage
Expand Down
13 changes: 12 additions & 1 deletion constants/map_data_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ DEF MAP_PALETTE rb ; 7
DEF MAP_FISHGROUP rb ; 8
DEF MAP_LENGTH EQU _RS

; map landmark name signs
const_def
const SIGN_WOOD
const SIGN_CITY
const SIGN_FOREST
const SIGN_CAVE
const SIGN_ROUTE
const SIGN_WATER
const SIGN_BUILDING
DEF NUM_SIGNS EQU const_value

; map environments (wEnvironment)
; EnvironmentColorsPointers indexes (see data/maps/environment_colors.asm)
const_def 1
Expand All @@ -29,7 +40,7 @@ DEF MAP_LENGTH EQU _RS
const DUNGEON
DEF NUM_ENVIRONMENTS EQU const_value - 1

; map palettes (wEnvironment)
; map palettes (wMapTimeOfDay)
const_def
const PALETTE_AUTO
const PALETTE_DAY
Expand Down
4 changes: 2 additions & 2 deletions constants/map_object_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DEF OBJECT_STEP_DURATION rb ; 0a
DEF OBJECT_ACTION rb ; 0b
DEF OBJECT_STEP_FRAME rb ; 0c
DEF OBJECT_FACING rb ; 0d
DEF OBJECT_TILE rb ; 0e
DEF OBJECT_TILE_COLLISION rb ; 0e
DEF OBJECT_LAST_TILE rb ; 0f
DEF OBJECT_MAP_X rb ; 10
DEF OBJECT_MAP_Y rb ; 11
Expand All @@ -37,7 +37,7 @@ DEF OBJECT_PAL_INDEX rb ; 21
rb_skip 6
DEF OBJECT_LENGTH EQU _RS
DEF NUM_OBJECT_STRUCTS EQU 13 ; see wObjectStructs
DEF FIRST_VRAM1_OBJECT_STRUCT EQU 10
DEF FIRST_VRAM1_OBJECT_STRUCT EQU 8

; object_struct OBJECT_DIRECTION values
DEF OW_DOWN EQU DOWN << 2
Expand Down
32 changes: 16 additions & 16 deletions constants/sprite_data_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ ENDM
ow_npc_pal_const POKE_BALL ; 0d (red)
ow_npc_pal_const DECO_ITEM ; 0e (blue)
ow_npc_pal_const KEY_ITEM ; 0f (green)
ow_npc_pal_const TREE ; 10
DEF NUM_OW_TIME_OF_DAY_PALS EQU const_value
ow_npc_pal_const EMOTE_GRAY ; 10
ow_npc_pal_const EMOTE_BLACK ; 11
ow_npc_pal_const EMOTE_GREEN ; 12
ow_npc_pal_const EMOTE_PURPLE ; 13
ow_npc_pal_const EMOTE_RED ; 14
ow_npc_pal_const EMOTE_ORANGE ; 15
ow_npc_pal_const EMOTE_BLUE ; 16
ow_npc_pal_const EMOTE_GRAY ; 11
ow_npc_pal_const EMOTE_BLACK ; 12
ow_npc_pal_const EMOTE_GREEN ; 13
ow_npc_pal_const EMOTE_PURPLE ; 14
ow_npc_pal_const EMOTE_RED ; 15
ow_npc_pal_const EMOTE_ORANGE ; 16
ow_npc_pal_const EMOTE_BLUE ; 17
DEF NUM_OW_INDIVIDUAL_PALS EQU const_value - NUM_OW_TIME_OF_DAY_PALS
DEF FIRST_COPY_BG_PAL EQU const_value
ow_npc_pal_const COPY_BG_GRAY ; 17
ow_npc_pal_const COPY_BG_RED ; 18
ow_npc_pal_const COPY_BG_GREEN ; 19
ow_npc_pal_const COPY_BG_WATER ; 1a
ow_npc_pal_const COPY_BG_YELLOW ; 1b
ow_npc_pal_const COPY_BG_BROWN ; 1c
ow_npc_pal_const COPY_BG_ROOF ; 1d
ow_npc_pal_const COPY_BG_TEXT ; 1e
ow_npc_pal_const COPY_BG_GRAY ; 18
ow_npc_pal_const COPY_BG_RED ; 19
ow_npc_pal_const COPY_BG_GREEN ; 1a
ow_npc_pal_const COPY_BG_WATER ; 1b
ow_npc_pal_const COPY_BG_YELLOW ; 1c
ow_npc_pal_const COPY_BG_BROWN ; 1d
ow_npc_pal_const COPY_BG_ROOF ; 1e
ow_npc_pal_const COPY_BG_TEXT ; 1f
DEF NUM_OW_BG_COPY_PALS EQU const_value - NUM_OW_INDIVIDUAL_PALS
DEF NUM_OW_PALS EQU const_value

DEF PAL_OW_TREE EQU PAL_OW_GREEN
DEF PAL_OW_ROCK EQU PAL_OW_BROWN
DEF PAL_NPC_ROCK EQU PAL_NPC_BROWN
DEF PAL_OW_GREY EQU PAL_OW_GRAY
Expand Down
2 changes: 1 addition & 1 deletion constants/tileset_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
DEF NUM_TILESETS EQU const_value - 1

; wTileset struct size
DEF TILESET_LENGTH EQU 14
DEF TILESET_LENGTH EQU 18

; roof length (see gfx/tilesets/roofs)
DEF ROOF_LENGTH EQU 9
Expand Down
12 changes: 9 additions & 3 deletions constants/wram_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ DEF AUTO_INPUT EQU $ff
const BUFFERMON ; 5

; wGameTimerPaused::
DEF GAME_TIMER_PAUSED_F EQU 0
DEF GAME_TIMER_MOBILE_F EQU 7
DEF GAME_TIMER_COUNTING_F EQU 0
DEF GAME_TIMER_MOBILE_F EQU 7

; wJoypadDisable::
DEF JOYPAD_DISABLE_MON_FAINT_F EQU 6
Expand Down Expand Up @@ -57,7 +57,7 @@ DEF NUM_FRAMES EQU const_value
; wTextboxFlags::
const_def
const FAST_TEXT_DELAY_F ; 0
const NO_TEXT_DELAY_F ; 1
const TEXT_DELAY_F ; 1

; wGBPrinterBrightness::
DEF GBPRINTER_LIGHTEST EQU $00
Expand Down Expand Up @@ -92,6 +92,12 @@ DEF RIGHT_MASK EQU 1 << RIGHT
shift_const FACE_RIGHT ; 1
DEF FACE_CURRENT EQU 0

; wStateFlags
DEF SPRITE_UPDATES_DISABLED_F EQU 0
DEF LAST_12_SPRITE_OAM_STRUCTS_RESERVED_F EQU 1
DEF TEXT_STATE_F EQU 6
DEF SCRIPTED_MOVEMENT_STATE_F EQU 7

; wPokemonWithdrawDepositParameter::
DEF PC_WITHDRAW EQU 0
DEF PC_DEPOSIT EQU 1
Expand Down
4 changes: 2 additions & 2 deletions data/collision/collision_permissions.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TileCollisionTable::
CollisionPermissionTable::
; entries correspond to COLL_* constants
table_width 1, TileCollisionTable
table_width 1, CollisionPermissionTable
db LAND_TILE ; COLL_FLOOR
db LAND_TILE ; COLL_01
db LAND_TILE ; 02
Expand Down
6 changes: 3 additions & 3 deletions data/events/special_pointers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ SpecialsPointers::
add_special CardFlip
add_special UnusedMemoryGame ; unused
add_special ClearBGPalettesBufferScreen ; unused
add_special FadeOutPalettes
add_special FadeOutToWhite
add_special BattleTowerFade
add_special FadeBlackQuickly
add_special FadeOutToBlack
add_special FadeInPalettes
add_special FadeInQuickly
add_special FadeInFromBlack
add_special ReloadSpritesNoPalettes ; bank 0
add_special ClearBGPalettes ; bank 0
add_special UpdateTimePals ; bank 0
Expand Down
3 changes: 2 additions & 1 deletion data/maps/setup_script_pointers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ MapSetupCommands:
add_mapsetup LoadMapAttributes ; 1a
add_mapsetup LoadMapAttributes_SkipObjects ; 1b
add_mapsetup ClearBGPalettes ; 1c
add_mapsetup FadeOutPalettes ; 1d
add_mapsetup FadeOutToWhite ; 1d
add_mapsetup FadeInPalettes ; 1e
add_mapsetup GetMapScreenCoords ; 1f
add_mapsetup GetWarpDestCoords ; 20
Expand All @@ -54,3 +54,4 @@ MapSetupCommands:
add_mapsetup DisableDynPalUpdates ; 2f
add_mapsetup EnableDynPalUpdates ; 30
add_mapsetup EnableDynPalUpdatesNoApply ; 31
add_mapsetup DeferredLoadMapGraphics ; 32
5 changes: 3 additions & 2 deletions data/maps/setup_scripts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ENDM
MapSetupScript_Teleport:
mapsetup ResetPlayerObjectAction
MapSetupScript_Fly:
mapsetup FadeOutPalettes
mapsetup FadeOutToWhite
mapsetup JumpRoamMons
MapSetupScript_Warp:
mapsetup DisableLCD
Expand Down Expand Up @@ -89,6 +89,7 @@ MapSetupScript_Connection:
mapsetup LoadBlockData
mapsetup LoadMapTileset
mapsetup SaveScreen
mapsetup DeferredLoadMapGraphics
mapsetup DecompressMetatiles
mapsetup LoadMapObjects
mapsetup FadeToMapMusic
Expand All @@ -104,7 +105,7 @@ MapSetupScript_Connection:
MapSetupScript_Fall:
mapsetup ResetPlayerObjectAction
MapSetupScript_Door:
mapsetup FadeOutPalettes
mapsetup FadeOutToWhite
MapSetupScript_Train:
mapsetup EnterMapWarp
mapsetup LoadMapAttributes
Expand Down
4 changes: 3 additions & 1 deletion data/tilesets.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
MACRO tileset
dba \1GFX, \1Meta, \1Coll, \1Attr
dba \1vTiles2GFX
dw \1vTiles4GFX, \1vTiles5GFX
dba \1Meta, \1Coll, \1Attr
dw \1Anim
ENDM

Expand Down
4 changes: 2 additions & 2 deletions docs/event_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ If <code><i>item_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[wScriptVar]` i
## `$47`: `opentext`


## `$48`: <code>refreshscreen [<i>dummy</i>=0]</code>
## `$48`: <code>reanchormap [<i>dummy</i>=0]</code>


## `$49`: `closetext`
Expand Down Expand Up @@ -419,7 +419,7 @@ If <code><i>item_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[wScriptVar]` i
## `$7B`: `reloadmap`


## `$7C`: `reloadmappart`
## `$7C`: `refreshmap`


## `$7D`: <code>writecmdqueue <i>queue_pointer</i></code>
Expand Down
32 changes: 16 additions & 16 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2711,7 +2711,7 @@ ForcePlayerMonChoice:
call LoadTilemapToTempTilemap
call WaitBGMap
call GetMemSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
xor a
ld c, a
ret
Expand All @@ -2730,7 +2730,7 @@ ForcePlayerMonChoice:
call _LoadHPBar
call CloseWindow
call GetMemSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call SendOutMonText
call NewBattleMonStatus
call BreakAttraction
Expand Down Expand Up @@ -2771,9 +2771,9 @@ SetUpBattlePartyMenu_Loop: ; switch to fullscreen menu?

JumpToPartyMenuAndPrintText:
farcall WritePartyMenuTilemap
farcall PrintPartyMenuText
farcall PlacePartyMenuText
call WaitBGMap
call SetPalettes
call SetDefaultBGPAndOBP
jmp DelayFrame

SelectBattleMon:
Expand Down Expand Up @@ -2889,7 +2889,7 @@ LostBattle:
; Grayscale
ld b, SCGB_BATTLE_GRAYSCALE
call GetSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
jr .end

.LostLinkBattle:
Expand Down Expand Up @@ -4918,7 +4918,7 @@ BattleMenu_Pack:
and BATTLERESULT_BITMASK
ld [wBattleResult], a ; WIN
call ClearWindowData
call SetPalettes
call SetDefaultBGPAndOBP
scf
ret

Expand Down Expand Up @@ -4961,7 +4961,7 @@ BattleMenuPKMN_Loop:
call CloseWindow
call LoadTilemapToTempTilemap
call GetMemSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
jmp BattleMenu

.GetMenu:
Expand Down Expand Up @@ -5039,7 +5039,7 @@ TryPlayerSwitch:
call _LoadHPBar
call CloseWindow
call GetMemSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld a, [wCurPartyMon]
ld [wCurBattleMon], a
PlayerSwitch:
Expand Down Expand Up @@ -6946,7 +6946,7 @@ FinishBattleAnim:
push hl
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call DelayFrame
pop hl
pop de
Expand Down Expand Up @@ -8364,7 +8364,7 @@ _DisplayLinkRecord:
call WaitBGMap2
ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld c, 8
call DelayFrames
jmp WaitPressAorB_BlinkCursor
Expand Down Expand Up @@ -8834,7 +8834,7 @@ InitBattleDisplay:
call HideSprites
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
ld a, $90
ldh [hWY], a
xor a
Expand Down Expand Up @@ -8966,7 +8966,7 @@ BattleStartMessage:
farcall Battle_GetTrainerName

ld hl, WantsToBattleText
jr .PlaceBattleStartText
jr .PrintBattleStartText

.wild
call BattleCheckEnemyShininess
Expand Down Expand Up @@ -9007,18 +9007,18 @@ BattleStartMessage:
farcall StubbedTrainerRankings_HookedEncounters

ld hl, HookedPokemonAttackedText
jr .PlaceBattleStartText
jr .PrintBattleStartText

.NotFishing:
ld hl, PokemonFellFromTreeText
cp BATTLETYPE_TREE
jr z, .PlaceBattleStartText
jr z, .PrintBattleStartText
ld hl, WildCelebiAppearedText
cp BATTLETYPE_CELEBI
jr z, .PlaceBattleStartText
jr z, .PrintBattleStartText
ld hl, WildPokemonAppearedText

.PlaceBattleStartText:
.PrintBattleStartText:
push hl
farcall BattleStart_TrainerHuds
pop hl
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/move_effects/baton_pass.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ BattleCommand_BatonPass:
call ClearBox
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
call SetPalettes
call SetDefaultBGPAndOBP
call BatonPass_LinkPlayerSwitch

ld hl, PassedBattleMonEntrance
Expand Down
Loading

0 comments on commit 92083c6

Please sign in to comment.