mirror of https://github.com/pret/pokecrystal.git
Assert some more table widths
This commit is contained in:
parent
3684296583
commit
6c8f8609cb
|
@ -102,6 +102,8 @@ MON_STATUS rb
|
|||
rb_skip
|
||||
MON_HP rw
|
||||
MON_MAXHP rw
|
||||
MON_STATS rw NUM_BATTLE_STATS
|
||||
rsset MON_STATS
|
||||
MON_ATK rw
|
||||
MON_DEF rw
|
||||
MON_SPD rw
|
||||
|
@ -190,7 +192,7 @@ NUM_TREEMON_SETS EQU const_value
|
|||
const TREEMON_SCORE_GOOD ; 1
|
||||
const TREEMON_SCORE_RARE ; 2
|
||||
|
||||
; ChangeHappiness arguments (see data/happiness_changes.asm)
|
||||
; ChangeHappiness arguments (see data/events/happiness_changes.asm)
|
||||
const_def 1
|
||||
const HAPPINESS_GAINLEVEL ; 01
|
||||
const HAPPINESS_USEDITEM ; 02
|
||||
|
|
|
@ -72,12 +72,12 @@ STRING_BUFFER_LENGTH EQU 19
|
|||
const VAR_BLUECARDBALANCE ; 18
|
||||
const VAR_BUENASPASSWORD ; 19
|
||||
const VAR_KENJI_BREAK ; 1a
|
||||
NUM_VARS EQU const_value ; 1b
|
||||
NUM_VARS EQU const_value ; 1b
|
||||
|
||||
; variable action types
|
||||
RETVAR_STRBUF2 EQU (0 << 6)
|
||||
RETVAR_ADDR_DE EQU (1 << 6)
|
||||
RETVAR_EXECUTE EQU (2 << 6)
|
||||
RETVAR_STRBUF2 EQU 0 << 6
|
||||
RETVAR_ADDR_DE EQU 1 << 6
|
||||
RETVAR_EXECUTE EQU 2 << 6
|
||||
|
||||
; PlayerEventScriptPointers indexes (see engine/overworld/events.asm)
|
||||
const_def -1
|
||||
|
@ -94,7 +94,7 @@ RETVAR_EXECUTE EQU (2 << 6)
|
|||
const PLAYEREVENT_JOYCHANGEFACING
|
||||
NUM_PLAYER_EVENTS EQU const_value
|
||||
|
||||
; PlayerMovement.pointers indexes (see engine/overworld/events.asm)
|
||||
; PlayerMovementPointers indexes (see engine/overworld/events.asm)
|
||||
const_def
|
||||
const PLAYERMOVEMENT_NORMAL
|
||||
const PLAYERMOVEMENT_WARP
|
||||
|
@ -104,17 +104,18 @@ NUM_PLAYER_EVENTS EQU const_value
|
|||
const PLAYERMOVEMENT_CONTINUE
|
||||
const PLAYERMOVEMENT_EXIT_WATER
|
||||
const PLAYERMOVEMENT_JUMP
|
||||
NUM_PLAYER_MOVEMENTS EQU const_value
|
||||
|
||||
; script data sizes (see macros/scripts/maps.asm)
|
||||
SCENE_SCRIPT_SIZE EQU 4 ; scene_script
|
||||
CALLBACK_SIZE EQU 3 ; callback
|
||||
WARP_EVENT_SIZE EQU 5 ; warp_event
|
||||
COORD_EVENT_SIZE EQU 8 ; coord_event
|
||||
BG_EVENT_SIZE EQU 5 ; bg_event
|
||||
SCENE_SCRIPT_SIZE EQU 4 ; scene_script
|
||||
CALLBACK_SIZE EQU 3 ; callback
|
||||
WARP_EVENT_SIZE EQU 5 ; warp_event
|
||||
COORD_EVENT_SIZE EQU 8 ; coord_event
|
||||
BG_EVENT_SIZE EQU 5 ; bg_event
|
||||
OBJECT_EVENT_SIZE EQU 13 ; object_event
|
||||
|
||||
; bg_event types
|
||||
; TryBGEvent arguments (see engine/overworld/events.asm)
|
||||
; BGEventJumptable indexes (see engine/overworld/events.asm)
|
||||
const_def
|
||||
const BGEVENT_READ
|
||||
const BGEVENT_UP
|
||||
|
@ -125,9 +126,10 @@ OBJECT_EVENT_SIZE EQU 13 ; object_event
|
|||
const BGEVENT_IFNOTSET
|
||||
const BGEVENT_ITEM
|
||||
const BGEVENT_COPY
|
||||
NUM_BGEVENTS EQU const_value
|
||||
|
||||
; object_event types
|
||||
; TryObjectEvent arguments (see engine/overworld/events.asm)
|
||||
; ObjectEventTypeArray indexes (see engine/overworld/events.asm)
|
||||
const_def
|
||||
const OBJECTTYPE_SCRIPT
|
||||
const OBJECTTYPE_ITEMBALL
|
||||
|
@ -136,6 +138,7 @@ OBJECT_EVENT_SIZE EQU 13 ; object_event
|
|||
const OBJECTTYPE_4
|
||||
const OBJECTTYPE_5
|
||||
const OBJECTTYPE_6
|
||||
NUM_OBJECT_TYPES EQU const_value
|
||||
|
||||
; command queue members
|
||||
CMDQUEUE_TYPE EQU 0
|
||||
|
@ -180,18 +183,18 @@ NUM_FLOORS EQU const_value
|
|||
; showemote arguments
|
||||
; Emotes indexes (see data/sprites/emotes.asm)
|
||||
const_def
|
||||
const EMOTE_SHOCK ; 0
|
||||
const EMOTE_QUESTION ; 1
|
||||
const EMOTE_HAPPY ; 2
|
||||
const EMOTE_SAD ; 3
|
||||
const EMOTE_HEART ; 4
|
||||
const EMOTE_BOLT ; 5
|
||||
const EMOTE_SLEEP ; 6
|
||||
const EMOTE_FISH ; 7
|
||||
const EMOTE_SHADOW ; 8
|
||||
const EMOTE_ROD ; 9
|
||||
const EMOTE_BOULDER_DUST ; 10
|
||||
const EMOTE_GRASS_RUSTLE ; 11
|
||||
const EMOTE_SHOCK
|
||||
const EMOTE_QUESTION
|
||||
const EMOTE_HAPPY
|
||||
const EMOTE_SAD
|
||||
const EMOTE_HEART
|
||||
const EMOTE_BOLT
|
||||
const EMOTE_SLEEP
|
||||
const EMOTE_FISH
|
||||
const EMOTE_SHADOW
|
||||
const EMOTE_ROD
|
||||
const EMOTE_BOULDER_DUST
|
||||
const EMOTE_GRASS_RUSTLE
|
||||
NUM_EMOTES EQU const_value
|
||||
EMOTE_FROM_MEM EQU -1
|
||||
EMOTE_LENGTH EQU 6
|
||||
|
@ -266,7 +269,7 @@ NUM_DECODESCS EQU const_value
|
|||
const MAGIKARPLENGTH_TOO_SHORT ; 2
|
||||
const MAGIKARPLENGTH_BEAT_RECORD ; 3
|
||||
|
||||
; SpecialReturnShuckle return values
|
||||
; ReturnShuckie return values
|
||||
const_def
|
||||
const SHUCKIE_WRONG_MON ; 0
|
||||
const SHUCKIE_REFUSED ; 1
|
||||
|
|
|
@ -29,7 +29,7 @@ GAME_TIMER_MOBILE_F EQU 7
|
|||
JOYPAD_DISABLE_MON_FAINT_F EQU 6
|
||||
JOYPAD_DISABLE_SGB_TRANSFER_F EQU 7
|
||||
|
||||
; wOptions::
|
||||
; wOptions1::
|
||||
TEXT_DELAY_MASK EQU %111
|
||||
const_def 4
|
||||
const NO_TEXT_SCROLL ; 4
|
||||
|
@ -245,8 +245,8 @@ NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES
|
|||
const POKEGEAR_RADIO_CARD_F ; 1
|
||||
const POKEGEAR_PHONE_CARD_F ; 2
|
||||
const POKEGEAR_EXPN_CARD_F ; 3
|
||||
|
||||
POKEGEAR_OBTAINED_F EQU 7
|
||||
const_skip 3
|
||||
const POKEGEAR_OBTAINED_F ; 7
|
||||
|
||||
; wWhichRegisteredItem::
|
||||
REGISTERED_POCKET EQU %11000000
|
||||
|
|
|
@ -87,7 +87,7 @@ SpecialsPointers::
|
|||
add_special ToggleMaptileDecorations
|
||||
add_special ToggleDecorationsVisibility
|
||||
add_special GiveShuckle
|
||||
add_special ReturnShuckle
|
||||
add_special ReturnShuckie
|
||||
add_special BillsGrandfather
|
||||
add_special CheckPokerus
|
||||
add_special DisplayCoinCaseBalance
|
||||
|
|
|
@ -71,7 +71,7 @@ SpecialShuckleOT:
|
|||
SpecialShuckleNick:
|
||||
db "SHUCKIE@"
|
||||
|
||||
ReturnShuckle:
|
||||
ReturnShuckie:
|
||||
farcall SelectMonFromParty
|
||||
jr c, .refused
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ OverworldLoop::
|
|||
ld [wMapStatus], a
|
||||
.loop
|
||||
ld a, [wMapStatus]
|
||||
ld hl, .jumps
|
||||
ld hl, .Jumptable
|
||||
rst JumpTable
|
||||
ld a, [wMapStatus]
|
||||
cp MAPSTATUS_DONE
|
||||
|
@ -16,7 +16,7 @@ OverworldLoop::
|
|||
.done
|
||||
ret
|
||||
|
||||
.jumps
|
||||
.Jumptable:
|
||||
; entries correspond to MAPSTATUS_* constants
|
||||
dw StartMap
|
||||
dw EnterMap
|
||||
|
@ -159,22 +159,22 @@ HandleMap:
|
|||
|
||||
MapEvents:
|
||||
ld a, [wMapEventStatus]
|
||||
ld hl, .jumps
|
||||
ld hl, .Jumptable
|
||||
rst JumpTable
|
||||
ret
|
||||
|
||||
.jumps
|
||||
.Jumptable:
|
||||
; entries correspond to MAPEVENTS_* constants
|
||||
dw .events
|
||||
dw .no_events
|
||||
|
||||
.events
|
||||
.events:
|
||||
call PlayerEvents
|
||||
call DisableEvents
|
||||
farcall ScriptEvents
|
||||
ret
|
||||
|
||||
.no_events
|
||||
.no_events:
|
||||
ret
|
||||
|
||||
MaxOverworldDelay:
|
||||
|
@ -557,7 +557,7 @@ TryObjectEvent:
|
|||
; Bug: If IsInArray returns nc, data at bc will be executed as code.
|
||||
push bc
|
||||
ld de, 3
|
||||
ld hl, .pointers
|
||||
ld hl, ObjectEventTypeArray
|
||||
call IsInArray
|
||||
jr nc, .nope
|
||||
pop bc
|
||||
|
@ -573,7 +573,8 @@ TryObjectEvent:
|
|||
xor a
|
||||
ret
|
||||
|
||||
.pointers
|
||||
ObjectEventTypeArray:
|
||||
table_width 3, ObjectEventTypeArray
|
||||
dbw OBJECTTYPE_SCRIPT, .script
|
||||
dbw OBJECTTYPE_ITEMBALL, .itemball
|
||||
dbw OBJECTTYPE_TRAINER, .trainer
|
||||
|
@ -582,7 +583,8 @@ TryObjectEvent:
|
|||
dbw OBJECTTYPE_4, .four
|
||||
dbw OBJECTTYPE_5, .five
|
||||
dbw OBJECTTYPE_6, .six
|
||||
db -1
|
||||
assert_table_length NUM_OBJECT_TYPES
|
||||
db -1 ; end
|
||||
|
||||
.script
|
||||
ld hl, MAPOBJECT_SCRIPT_POINTER
|
||||
|
@ -638,11 +640,12 @@ TryBGEvent:
|
|||
|
||||
.is_bg_event:
|
||||
ld a, [wCurBGEventType]
|
||||
ld hl, .bg_events
|
||||
ld hl, BGEventJumptable
|
||||
rst JumpTable
|
||||
ret
|
||||
|
||||
.bg_events
|
||||
BGEventJumptable:
|
||||
table_width 2, BGEventJumptable
|
||||
dw .read
|
||||
dw .up
|
||||
dw .down
|
||||
|
@ -652,27 +655,30 @@ TryBGEvent:
|
|||
dw .ifnotset
|
||||
dw .itemifset
|
||||
dw .copy
|
||||
assert_table_length NUM_BGEVENTS
|
||||
|
||||
.up
|
||||
.up:
|
||||
ld b, OW_UP
|
||||
jr .checkdir
|
||||
.down
|
||||
|
||||
.down:
|
||||
ld b, OW_DOWN
|
||||
jr .checkdir
|
||||
.right
|
||||
|
||||
.right:
|
||||
ld b, OW_RIGHT
|
||||
jr .checkdir
|
||||
.left
|
||||
|
||||
.left:
|
||||
ld b, OW_LEFT
|
||||
jr .checkdir
|
||||
|
||||
.checkdir
|
||||
.checkdir:
|
||||
ld a, [wPlayerDirection]
|
||||
and %1100
|
||||
cp b
|
||||
jp nz, .dontread
|
||||
|
||||
.read
|
||||
.read:
|
||||
call PlayTalkObject
|
||||
ld hl, wCurBGEventScriptAddr
|
||||
ld a, [hli]
|
||||
|
@ -683,7 +689,7 @@ TryBGEvent:
|
|||
scf
|
||||
ret
|
||||
|
||||
.itemifset
|
||||
.itemifset:
|
||||
call CheckBGEventFlag
|
||||
jp nz, .dontread
|
||||
call PlayTalkObject
|
||||
|
@ -697,7 +703,7 @@ TryBGEvent:
|
|||
scf
|
||||
ret
|
||||
|
||||
.copy
|
||||
.copy:
|
||||
call CheckBGEventFlag
|
||||
jr nz, .dontread
|
||||
call GetMapScriptsBank
|
||||
|
@ -706,16 +712,15 @@ TryBGEvent:
|
|||
call FarCopyBytes
|
||||
jr .dontread
|
||||
|
||||
.ifset
|
||||
.ifset:
|
||||
call CheckBGEventFlag
|
||||
jr z, .dontread
|
||||
jr .thenread
|
||||
|
||||
.ifnotset
|
||||
.ifnotset:
|
||||
call CheckBGEventFlag
|
||||
jr nz, .dontread
|
||||
|
||||
.thenread
|
||||
.thenread:
|
||||
push hl
|
||||
call PlayTalkObject
|
||||
pop hl
|
||||
|
@ -728,7 +733,7 @@ TryBGEvent:
|
|||
scf
|
||||
ret
|
||||
|
||||
.dontread
|
||||
.dontread:
|
||||
xor a
|
||||
ret
|
||||
|
||||
|
@ -752,13 +757,14 @@ CheckBGEventFlag:
|
|||
PlayerMovement:
|
||||
farcall DoPlayerMovement
|
||||
ld a, c
|
||||
ld hl, .pointers
|
||||
ld hl, PlayerMovementPointers
|
||||
rst JumpTable
|
||||
ld a, c
|
||||
ret
|
||||
|
||||
.pointers
|
||||
PlayerMovementPointers:
|
||||
; entries correspond to PLAYERMOVEMENT_* constants
|
||||
table_width 2, PlayerMovementPointers
|
||||
dw .normal
|
||||
dw .warp
|
||||
dw .turn
|
||||
|
@ -767,6 +773,7 @@ PlayerMovement:
|
|||
dw .continue
|
||||
dw .exit_water
|
||||
dw .jump
|
||||
assert_table_length NUM_PLAYER_MOVEMENTS
|
||||
|
||||
.normal:
|
||||
.finish:
|
||||
|
@ -974,6 +981,7 @@ DoPlayerEvent:
|
|||
|
||||
PlayerEventScriptPointers:
|
||||
; entries correspond to PLAYEREVENT_* constants
|
||||
table_width 3, PlayerEventScriptPointers
|
||||
dba InvalidEventScript ; PLAYEREVENT_NONE
|
||||
dba SeenByTrainerScript ; PLAYEREVENT_SEENBYTRAINER
|
||||
dba TalkToTrainerScript ; PLAYEREVENT_TALKTOTRAINER
|
||||
|
@ -985,6 +993,7 @@ PlayerEventScriptPointers:
|
|||
dba HatchEggScript ; PLAYEREVENT_HATCH
|
||||
dba ChangeDirectionScript ; PLAYEREVENT_JOYCHANGEFACING
|
||||
dba InvalidEventScript ; (NUM_PLAYER_EVENTS)
|
||||
assert_table_length NUM_PLAYER_EVENTS + 1
|
||||
|
||||
InvalidEventScript:
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@ ManiaScript:
|
|||
writetext ManiaText_CanIHaveMyMonBack
|
||||
yesorno
|
||||
iffalse .refused
|
||||
special ReturnShuckle
|
||||
special ReturnShuckie
|
||||
ifequal SHUCKIE_WRONG_MON, .wrong
|
||||
ifequal SHUCKIE_REFUSED, .refused
|
||||
ifequal SHUCKIE_HAPPY, .superhappy
|
||||
|
|
Loading…
Reference in New Issue