shithub: pokecrystal

Download patch

ref: 50e182e83180dc6bfd012ddc26e7dc07052a89a5
parent: cc460a17b0b99208592ca31de99f526fce2bf5ad
author: Rangi <[email protected]>
date: Wed Jun 17 18:12:04 EDT 2020

Harmonize engine/overworld with pokegold

--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -148,7 +148,7 @@
 ; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm)
 	const_def
 	const CMDQUEUE_NULL
-	const CMDQUEUE_NULL2
+	const CMDQUEUE_TYPE1
 	const CMDQUEUE_STONETABLE
 	const CMDQUEUE_TYPE3
 	const CMDQUEUE_TYPE4
--- /dev/null
+++ b/engine/overworld/cmd_queue.asm
@@ -1,0 +1,302 @@
+ClearCmdQueue::
+	ld hl, wCmdQueue
+	ld de, CMDQUEUE_ENTRY_SIZE
+	ld c, CMDQUEUE_CAPACITY
+	xor a
+.loop
+	ld [hl], a
+	add hl, de
+	dec c
+	jr nz, .loop
+	ret
+
+HandleCmdQueue::
+	ld hl, wCmdQueue
+	xor a
+.loop
+	ldh [hMapObjectIndexBuffer], a
+	ld a, [hl]
+	and a
+	jr z, .skip
+	push hl
+	ld b, h
+	ld c, l
+	call HandleQueuedCommand
+	pop hl
+
+.skip
+	ld de, CMDQUEUE_ENTRY_SIZE
+	add hl, de
+	ldh a, [hMapObjectIndexBuffer]
+	inc a
+	cp CMDQUEUE_CAPACITY
+	jr nz, .loop
+	ret
+
+Unreferenced_GetNthCmdQueueEntry:
+	ld hl, wCmdQueue
+	ld bc, CMDQUEUE_ENTRY_SIZE
+	call AddNTimes
+	ld b, h
+	ld c, l
+	ret
+
+WriteCmdQueue::
+	push bc
+	push de
+	call .GetNextEmptyEntry
+	ld d, h
+	ld e, l
+	pop hl
+	pop bc
+	ret c
+	ld a, b
+	ld bc, CMDQUEUE_ENTRY_SIZE - 1
+	call FarCopyBytes
+	xor a
+	ld [hl], a
+	ret
+
+.GetNextEmptyEntry:
+	ld hl, wCmdQueue
+	ld de, CMDQUEUE_ENTRY_SIZE
+	ld c, CMDQUEUE_CAPACITY
+.loop
+	ld a, [hl]
+	and a
+	jr z, .done
+	add hl, de
+	dec c
+	jr nz, .loop
+	scf
+	ret
+
+.done
+	ld a, CMDQUEUE_CAPACITY
+	sub c
+	and a
+	ret
+
+DelCmdQueue::
+	ld hl, wCmdQueue
+	ld de, CMDQUEUE_ENTRY_SIZE
+	ld c, CMDQUEUE_CAPACITY
+.loop
+	ld a, [hl]
+	cp b
+	jr z, .done
+	add hl, de
+	dec c
+	jr nz, .loop
+	and a
+	ret
+
+.done
+	xor a
+	ld [hl], a
+	scf
+	ret
+
+_DelCmdQueue:
+	ld hl, CMDQUEUE_TYPE
+	add hl, bc
+	ld [hl], 0
+	ret
+
+HandleQueuedCommand:
+	ld hl, CMDQUEUE_TYPE
+	add hl, bc
+	ld a, [hl]
+	cp NUM_CMDQUEUE_TYPES
+	jr c, .okay
+	xor a
+
+.okay
+	ld e, a
+	ld d, 0
+	ld hl, .Jumptable
+	add hl, de
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	push af
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	pop af
+	rst FarCall
+	ret
+
+.Jumptable:
+	dba CmdQueue_Null
+	dba CmdQueue_Type1
+	dba CmdQueue_StoneTable
+	dba CmdQueue_Type3
+	dba CmdQueue_Type4
+
+CmdQueueAnonymousJumptable:
+	ld hl, CMDQUEUE_05
+	add hl, bc
+	ld a, [hl]
+	pop hl
+	rst JumpTable
+	ret
+
+CmdQueueAnonJT_Increment:
+	ld hl, CMDQUEUE_05
+	add hl, bc
+	inc [hl]
+	ret
+
+CmdQueueAnonJT_Decrement:
+	ld hl, CMDQUEUE_05
+	add hl, bc
+	dec [hl]
+	ret
+
+CmdQueue_Null:
+	ret
+
+CmdQueue_Type1:
+	call ret_2f3e
+	ret
+
+CmdQueue_Type4:
+	call CmdQueueAnonymousJumptable
+	; anonymous dw
+	dw .zero
+	dw .one
+
+.zero
+	ldh a, [hSCY]
+	ld hl, CMDQUEUE_04
+	add hl, bc
+	ld [hl], a
+	call CmdQueueAnonJT_Increment
+.one
+	ld hl, CMDQUEUE_ADDR
+	add hl, bc
+	ld a, [hl]
+	dec a
+	ld [hl], a
+	jr z, .finish
+	and 1
+	jr z, .add
+	ld hl, CMDQUEUE_02
+	add hl, bc
+	ldh a, [hSCY]
+	sub [hl]
+	ldh [hSCY], a
+	ret
+
+.add
+	ld hl, CMDQUEUE_02
+	add hl, bc
+	ldh a, [hSCY]
+	add [hl]
+	ldh [hSCY], a
+	ret
+
+.finish
+	ld hl, CMDQUEUE_04
+	add hl, bc
+	ld a, [hl]
+	ldh [hSCY], a
+	call _DelCmdQueue
+	ret
+
+CmdQueue_Type3:
+	call CmdQueueAnonymousJumptable
+	; anonymous dw
+	dw .zero
+	dw .one
+	dw .two
+
+.zero
+	call .IsPlayerFacingDown
+	jr z, .PlayerNotFacingDown
+	call CmdQueueAnonJT_Increment
+.one
+	call .IsPlayerFacingDown
+	jr z, .PlayerNotFacingDown
+	call CmdQueueAnonJT_Increment
+
+	ld hl, CMDQUEUE_02
+	add hl, bc
+	ld a, [hl]
+	ld [wd173], a
+	ret
+
+.two
+	call .IsPlayerFacingDown
+	jr z, .PlayerNotFacingDown
+	call CmdQueueAnonJT_Decrement
+
+	ld hl, CMDQUEUE_03
+	add hl, bc
+	ld a, [hl]
+	ld [wd173], a
+	ret
+
+.PlayerNotFacingDown:
+	ld a, $7f
+	ld [wd173], a
+	ld hl, CMDQUEUE_05
+	add hl, bc
+	ld [hl], 0
+	ret
+
+.IsPlayerFacingDown:
+	push bc
+	ld bc, wPlayerStruct
+	call GetSpriteDirection
+	and a
+	pop bc
+	ret
+
+CmdQueue_StoneTable:
+	ld de, wPlayerStruct
+	ld a, NUM_OBJECT_STRUCTS
+.loop
+	push af
+
+	ld hl, OBJECT_SPRITE
+	add hl, de
+	ld a, [hl]
+	and a
+	jr z, .next
+
+	ld hl, OBJECT_MOVEMENTTYPE
+	add hl, de
+	ld a, [hl]
+	cp SPRITEMOVEDATA_STRENGTH_BOULDER
+	jr nz, .next
+
+	ld hl, OBJECT_NEXT_TILE
+	add hl, de
+	ld a, [hl]
+	call CheckPitTile
+	jr nz, .next
+
+	ld hl, OBJECT_DIRECTION_WALKING
+	add hl, de
+	ld a, [hl]
+	cp STANDING
+	jr nz, .next
+	call HandleStoneQueue
+	jr c, .fall_down_hole
+
+.next
+	ld hl, OBJECT_LENGTH
+	add hl, de
+	ld d, h
+	ld e, l
+
+	pop af
+	dec a
+	jr nz, .loop
+	ret
+
+.fall_down_hole
+	pop af
+	ret
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -1338,305 +1338,4 @@
 	xor a
 	ret
 
-ClearCmdQueue::
-	ld hl, wCmdQueue
-	ld de, CMDQUEUE_ENTRY_SIZE
-	ld c, CMDQUEUE_CAPACITY
-	xor a
-.loop
-	ld [hl], a
-	add hl, de
-	dec c
-	jr nz, .loop
-	ret
-
-HandleCmdQueue::
-	ld hl, wCmdQueue
-	xor a
-.loop
-	ldh [hMapObjectIndexBuffer], a
-	ld a, [hl]
-	and a
-	jr z, .skip
-	push hl
-	ld b, h
-	ld c, l
-	call HandleQueuedCommand
-	pop hl
-
-.skip
-	ld de, CMDQUEUE_ENTRY_SIZE
-	add hl, de
-	ldh a, [hMapObjectIndexBuffer]
-	inc a
-	cp CMDQUEUE_CAPACITY
-	jr nz, .loop
-	ret
-
-Unreferenced_GetNthCmdQueueEntry:
-	ld hl, wCmdQueue
-	ld bc, CMDQUEUE_ENTRY_SIZE
-	call AddNTimes
-	ld b, h
-	ld c, l
-	ret
-
-WriteCmdQueue::
-	push bc
-	push de
-	call .GetNextEmptyEntry
-	ld d, h
-	ld e, l
-	pop hl
-	pop bc
-	ret c
-	ld a, b
-	ld bc, CMDQUEUE_ENTRY_SIZE - 1
-	call FarCopyBytes
-	xor a
-	ld [hl], a
-	ret
-
-.GetNextEmptyEntry:
-	ld hl, wCmdQueue
-	ld de, CMDQUEUE_ENTRY_SIZE
-	ld c, CMDQUEUE_CAPACITY
-.loop
-	ld a, [hl]
-	and a
-	jr z, .done
-	add hl, de
-	dec c
-	jr nz, .loop
-	scf
-	ret
-
-.done
-	ld a, CMDQUEUE_CAPACITY
-	sub c
-	and a
-	ret
-
-DelCmdQueue::
-	ld hl, wCmdQueue
-	ld de, CMDQUEUE_ENTRY_SIZE
-	ld c, CMDQUEUE_CAPACITY
-.loop
-	ld a, [hl]
-	cp b
-	jr z, .done
-	add hl, de
-	dec c
-	jr nz, .loop
-	and a
-	ret
-
-.done
-	xor a
-	ld [hl], a
-	scf
-	ret
-
-_DelCmdQueue:
-	ld hl, CMDQUEUE_TYPE
-	add hl, bc
-	ld [hl], 0
-	ret
-
-HandleQueuedCommand:
-	ld hl, CMDQUEUE_TYPE
-	add hl, bc
-	ld a, [hl]
-	cp NUM_CMDQUEUE_TYPES
-	jr c, .okay
-	xor a
-
-.okay
-	ld e, a
-	ld d, 0
-	ld hl, .Jumptable
-	add hl, de
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	push af
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	pop af
-	rst FarCall
-	ret
-
-.Jumptable:
-	dba CmdQueue_Null
-	dba CmdQueue_Null2
-	dba CmdQueue_StoneTable
-	dba CmdQueue_Type3
-	dba CmdQueue_Type4
-
-CmdQueueAnonymousJumptable:
-	ld hl, CMDQUEUE_05
-	add hl, bc
-	ld a, [hl]
-	pop hl
-	rst JumpTable
-	ret
-
-CmdQueueAnonJT_Increment:
-	ld hl, CMDQUEUE_05
-	add hl, bc
-	inc [hl]
-	ret
-
-CmdQueueAnonJT_Decrement:
-	ld hl, CMDQUEUE_05
-	add hl, bc
-	dec [hl]
-	ret
-
-CmdQueue_Null:
-	ret
-
-CmdQueue_Null2:
-	call ret_2f3e
-	ret
-
-CmdQueue_Type4:
-	call CmdQueueAnonymousJumptable
-	; anonymous dw
-	dw .zero
-	dw .one
-
-.zero
-	ldh a, [hSCY]
-	ld hl, CMDQUEUE_04
-	add hl, bc
-	ld [hl], a
-	call CmdQueueAnonJT_Increment
-.one
-	ld hl, CMDQUEUE_ADDR
-	add hl, bc
-	ld a, [hl]
-	dec a
-	ld [hl], a
-	jr z, .finish
-	and 1
-	jr z, .add
-	ld hl, CMDQUEUE_02
-	add hl, bc
-	ldh a, [hSCY]
-	sub [hl]
-	ldh [hSCY], a
-	ret
-
-.add
-	ld hl, CMDQUEUE_02
-	add hl, bc
-	ldh a, [hSCY]
-	add [hl]
-	ldh [hSCY], a
-	ret
-
-.finish
-	ld hl, CMDQUEUE_04
-	add hl, bc
-	ld a, [hl]
-	ldh [hSCY], a
-	call _DelCmdQueue
-	ret
-
-CmdQueue_Type3:
-	call CmdQueueAnonymousJumptable
-	; anonymous dw
-	dw .zero
-	dw .one
-	dw .two
-
-.zero
-	call .IsPlayerFacingDown
-	jr z, .PlayerNotFacingDown
-	call CmdQueueAnonJT_Increment
-.one
-	call .IsPlayerFacingDown
-	jr z, .PlayerNotFacingDown
-	call CmdQueueAnonJT_Increment
-
-	ld hl, CMDQUEUE_02
-	add hl, bc
-	ld a, [hl]
-	ld [wd173], a
-	ret
-
-.two
-	call .IsPlayerFacingDown
-	jr z, .PlayerNotFacingDown
-	call CmdQueueAnonJT_Decrement
-
-	ld hl, CMDQUEUE_03
-	add hl, bc
-	ld a, [hl]
-	ld [wd173], a
-	ret
-
-.PlayerNotFacingDown:
-	ld a, $7f
-	ld [wd173], a
-	ld hl, CMDQUEUE_05
-	add hl, bc
-	ld [hl], 0
-	ret
-
-.IsPlayerFacingDown:
-	push bc
-	ld bc, wPlayerStruct
-	call GetSpriteDirection
-	and a
-	pop bc
-	ret
-
-CmdQueue_StoneTable:
-	ld de, wPlayerStruct
-	ld a, NUM_OBJECT_STRUCTS
-.loop
-	push af
-
-	ld hl, OBJECT_SPRITE
-	add hl, de
-	ld a, [hl]
-	and a
-	jr z, .next
-
-	ld hl, OBJECT_MOVEMENTTYPE
-	add hl, de
-	ld a, [hl]
-	cp SPRITEMOVEDATA_STRENGTH_BOULDER
-	jr nz, .next
-
-	ld hl, OBJECT_NEXT_TILE
-	add hl, de
-	ld a, [hl]
-	call CheckPitTile
-	jr nz, .next
-
-	ld hl, OBJECT_DIRECTION_WALKING
-	add hl, de
-	ld a, [hl]
-	cp STANDING
-	jr nz, .next
-	call HandleStoneQueue
-	jr c, .fall_down_hole
-
-.next
-	ld hl, OBJECT_LENGTH
-	add hl, de
-	ld d, h
-	ld e, l
-
-	pop af
-	dec a
-	jr nz, .loop
-	ret
-
-.fall_down_hole
-	pop af
-	ret
+INCLUDE "engine/overworld/cmd_queue.asm"
--- a/engine/overworld/init_map.asm
+++ b/engine/overworld/init_map.asm
@@ -16,6 +16,7 @@
 	ldh [hBGMapMode], a
 	pop af
 	ldh [hOAMUpdate], a
+
 	ld hl, wVramState
 	set 6, [hl]
 	ret
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -1846,7 +1846,7 @@
 	ld e, [hl]
 	inc [hl]
 	ld d, 0
-	ld hl, wc2e2
+	ld hl, wMovementObject
 	ld a, [hli]
 	ld h, [hl]
 	ld l, a
--- a/engine/overworld/overworld.asm
+++ b/engine/overworld/overworld.asm
@@ -142,10 +142,10 @@
 	ld a, MAPCALLBACK_SPRITES
 	call RunMapCallback
 	call GetUsedSprites
-	call .LoadMiscTiles
+	call LoadMiscTiles
 	ret
 
-.LoadMiscTiles:
+LoadMiscTiles:
 	ld a, [wSpriteFlags]
 	bit 6, a
 	ret nz
@@ -234,7 +234,7 @@
 
 	farcall LoadOverworldMonIcon
 
-	ld l, 1
+	ld l, WALKING_SPRITE
 	ld h, 0
 	scf
 	ret
@@ -250,8 +250,8 @@
 	jp nz, GetMonSprite
 
 .NoBreedmon:
-	ld a, 1
-	ld l, 1
+	ld a, WALKING_SPRITE
+	ld l, WALKING_SPRITE
 	ld h, 0
 	and a
 	ret
--- a/engine/overworld/player_object.asm
+++ b/engine/overworld/player_object.asm
@@ -225,7 +225,7 @@
 	ret
 
 InitializeVisibleSprites:
-	ld bc, wMapObjects + MAPOBJECT_LENGTH
+	ld bc, wMap1Object
 	ld a, 1
 .loop
 	ldh [hMapObjectIndexBuffer], a
@@ -312,7 +312,7 @@
 	ld d, a
 	ld a, [wXCoord]
 	ld e, a
-	ld bc, wMapObjects + MAPOBJECT_LENGTH
+	ld bc, wMap1Object
 	ld a, 1
 .loop_v
 	ldh [hMapObjectIndexBuffer], a
@@ -368,7 +368,7 @@
 	ld e, a
 	ld a, [wYCoord]
 	ld d, a
-	ld bc, wMapObjects + MAPOBJECT_LENGTH
+	ld bc, wMap1Object
 	ld a, 1
 .loop_h
 	ldh [hMapObjectIndexBuffer], a
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -250,9 +250,6 @@
 	ret
 
 Script_callasm:
-; script command 0xe
-; parameters: asm
-
 	call GetScriptByte
 	ld b, a
 	call GetScriptByte
@@ -264,9 +261,6 @@
 	ret
 
 Script_special:
-; script command 0xf
-; parameters: predefined_script
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -275,9 +269,6 @@
 	ret
 
 Script_memcallasm:
-; script command 0x10
-; parameters: asm
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -292,9 +283,6 @@
 	ret
 
 Script_jumptextfaceplayer:
-; script command 0x51
-; parameters: text_pointer
-
 	ld a, [wScriptBank]
 	ld [wScriptTextBank], a
 	call GetScriptByte
@@ -306,9 +294,6 @@
 	jp ScriptJump
 
 Script_jumptext:
-; script command 0x53
-; parameters: text_pointer
-
 	ld a, [wScriptBank]
 	ld [wScriptTextBank], a
 	call GetScriptByte
@@ -329,9 +314,6 @@
 	end
 
 Script_farjumptext:
-; script command 0x52
-; parameters: text_pointer
-
 	call GetScriptByte
 	ld [wScriptTextBank], a
 	call GetScriptByte
@@ -343,9 +325,6 @@
 	jp ScriptJump
 
 Script_writetext:
-; script command 0x4c
-; parameters: text_pointer
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -356,9 +335,6 @@
 	ret
 
 Script_farwritetext:
-; script command 0x4b
-; parameters: text_pointer
-
 	call GetScriptByte
 	ld b, a
 	call GetScriptByte
@@ -369,9 +345,6 @@
 	ret
 
 Script_repeattext:
-; script command 0x4d
-; parameters: byte, byte
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -394,13 +367,9 @@
 	ret
 
 Script_waitbutton:
-; script command 0x54
-
 	jp WaitButton
 
 Script_promptbutton:
-; script command 0x55
-
 	ldh a, [hOAMUpdate]
 	push af
 	ld a, $1
@@ -412,8 +381,6 @@
 	ret
 
 Script_yesorno:
-; script command 0x4e
-
 	call YesNoBox
 	ld a, FALSE
 	jr c, .no
@@ -423,9 +390,6 @@
 	ret
 
 Script_loadmenu:
-; script command 0x4f
-; parameters: menu_header
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -437,16 +401,11 @@
 	ret
 
 Script_closewindow:
-; script command 0x50
-
 	call CloseWindow
 	call UpdateSprites
 	ret
 
 Script_pokepic:
-; script command 0x56
-; parameters: pokemon
-
 	call GetScriptByte
 	and a
 	jr nz, .ok
@@ -457,14 +416,10 @@
 	ret
 
 Script_closepokepic:
-; script command 0x57
-
 	farcall ClosePokepic
 	ret
 
 Script_verticalmenu:
-; script command 0x59
-
 	ld a, [wScriptBank]
 	ld hl, VerticalMenu
 	rst FarCall
@@ -476,8 +431,6 @@
 	ret
 
 Script__2dmenu:
-; script command 0x58
-
 	ld a, [wScriptBank]
 	ld hl, _2DMenu
 	rst FarCall
@@ -489,9 +442,6 @@
 	ret
 
 Script_battletowertext:
-; script command 0xa4
-; parameters: bttext_id
-
 	call SetUpTextbox
 	call GetScriptByte
 	ld c, a
@@ -499,9 +449,6 @@
 	ret
 
 Script_verbosegiveitem:
-; script command 0x9e
-; parameters: item, quantity
-
 	call Script_giveitem
 	call CurItemName
 	ld de, wStringBuffer1
@@ -534,9 +481,6 @@
 	text_end
 
 Script_verbosegiveitemvar:
-; script command 0x9f
-; parameters: item, var
-
 	call GetScriptByte
 	cp ITEM_FROM_MEM
 	jr nz, .ok
@@ -563,8 +507,6 @@
 	jp ScriptCall
 
 Script_itemnotify:
-; script command 0x45
-
 	call GetPocketName
 	call CurItemName
 	ld b, BANK(PutItemInPocketText)
@@ -573,8 +515,6 @@
 	ret
 
 Script_pocketisfull:
-; script command 0x46
-
 	call GetPocketName
 	call CurItemName
 	ld b, BANK(PocketIsFullText)
@@ -583,8 +523,6 @@
 	ret
 
 Script_specialsound:
-; script command 0x88
-
 	farcall CheckItemPocket
 	ld a, [wItemAttributeParamBuffer]
 	cp TM_HM
@@ -630,9 +568,6 @@
 	text_end
 
 Script_pokemart:
-; script command 0x94
-; parameters: mart_type, mart_id
-
 	call GetScriptByte
 	ld c, a
 	call GetScriptByte
@@ -645,9 +580,6 @@
 	ret
 
 Script_elevator:
-; script command 0x95
-; parameters: floor_list_pointer
-
 	xor a
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -663,9 +595,6 @@
 	ret
 
 Script_trade:
-; script command 0x96
-; parameters: trade_id
-
 	call GetScriptByte
 	ld e, a
 	farcall NPCTrade
@@ -672,9 +601,6 @@
 	ret
 
 Script_phonecall:
-; script command 0x98
-; parameters: caller_name
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -685,15 +611,10 @@
 	ret
 
 Script_hangup:
-; script command 0x99
-
 	farcall HangUp
 	ret
 
 Script_askforphonenumber:
-; script command 0x97
-; parameters: number
-
 	call YesNoBox
 	jr c, .refused
 	call GetScriptByte
@@ -713,9 +634,6 @@
 	ret
 
 Script_describedecoration:
-; script command 0x9a
-; parameters: byte
-
 	call GetScriptByte
 	ld b, a
 	farcall DescribeDecoration
@@ -724,9 +642,6 @@
 	jp ScriptJump
 
 Script_fruittree:
-; script command 0x9b
-; parameters: tree_id
-
 	call GetScriptByte
 	ld [wCurFruitTree], a
 	ld b, BANK(FruitTreeScript)
@@ -734,9 +649,6 @@
 	jp ScriptJump
 
 Script_swarm:
-; script command 0xa0
-; parameters: flag, map_group, map_id
-
 	call GetScriptByte
 	ld c, a
 	call GetScriptByte
@@ -747,9 +659,6 @@
 	ret
 
 Script_trainertext:
-; script command 0x62
-; parameters: text_id
-
 	call GetScriptByte
 	ld c, a
 	ld b, 0
@@ -765,8 +674,6 @@
 	ret
 
 Script_scripttalkafter:
-; script command 0x65
-
 	ld hl, wScriptAfterPointer
 	ld a, [hli]
 	ld h, [hl]
@@ -776,9 +683,6 @@
 	jp ScriptJump
 
 Script_trainerflagaction:
-; script command 0x63
-; parameters: action
-
 	xor a
 	ld [wScriptVar], a
 	ld hl, wTempTrainerEventFlag
@@ -796,9 +700,6 @@
 	ret
 
 Script_winlosstext:
-; script command 0x64
-; parameters: win_text_pointer, loss_text_pointer
-
 	ld hl, wWinTextPointer
 	call GetScriptByte
 	ld [hli], a
@@ -812,8 +713,6 @@
 	ret
 
 Script_endifjustbattled:
-; script command 0x66
-
 	ld a, [wRunningTrainerBattleScript]
 	and a
 	ret z
@@ -820,8 +719,6 @@
 	jp Script_end
 
 Script_checkjustbattled:
-; script command 0x67
-
 	ld a, TRUE
 	ld [wScriptVar], a
 	ld a, [wRunningTrainerBattleScript]
@@ -832,8 +729,6 @@
 	ret
 
 Script_encountermusic:
-; script command 0x80
-
 	ld a, [wOtherTrainerClass]
 	ld e, a
 	farcall PlayTrainerEncounterMusic
@@ -840,15 +735,10 @@
 	ret
 
 Script_playmapmusic:
-; script command 0x82
-
 	call PlayMapMusic
 	ret
 
 Script_playmusic:
-; script command 0x7f
-; parameters: music_pointer
-
 	ld de, MUSIC_NONE
 	call PlayMusic
 	xor a
@@ -862,9 +752,6 @@
 	ret
 
 Script_musicfadeout:
-; script command 0x81
-; parameters: music, fadetime
-
 	call GetScriptByte
 	ld [wMusicFadeID], a
 	call GetScriptByte
@@ -875,9 +762,6 @@
 	ret
 
 Script_playsound:
-; script command 0x85
-; parameters: sound_pointer
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -886,22 +770,15 @@
 	ret
 
 Script_waitsfx:
-; script command 0x86
-
 	call WaitSFX
 	ret
 
 Script_warpsound:
-; script command 0x87
-
 	farcall GetWarpSFX
 	call PlaySFX
 	ret
 
 Script_cry:
-; script command 0x84
-; parameters: cry_id
-
 	call GetScriptByte
 	push af
 	call GetScriptByte
@@ -922,9 +799,6 @@
 	ret
 
 Script_setlasttalked:
-; script command 0x68
-; parameters: object_id
-
 	call GetScriptByte
 	call GetScriptObject
 	ldh [hLastTalked], a
@@ -931,9 +805,6 @@
 	ret
 
 Script_applymovement:
-; script command 0x69
-; parameters: object_id, data
-
 	call GetScriptByte
 	call GetScriptObject
 	ld c, a
@@ -967,8 +838,6 @@
 	ret
 
 Script_applymovementlasttalked:
-; script command 0x6a
-; parameters: data
 ; apply movement to last talked
 
 	ldh a, [hLastTalked]
@@ -976,8 +845,6 @@
 	jp ApplyMovement
 
 Script_faceplayer:
-; script command 0x6b
-
 	ldh a, [hLastTalked]
 	and a
 	ret z
@@ -995,9 +862,6 @@
 	ret
 
 Script_faceobject:
-; script command 0x6c
-; parameters: object1, object2
-
 	call GetScriptByte
 	call GetScriptObject
 	cp LAST_TALKED
@@ -1025,9 +889,6 @@
 	ret
 
 Script_turnobject:
-; script command 0x76
-; parameters: object_id, facing
-
 	call GetScriptByte
 	call GetScriptObject
 	cp LAST_TALKED
@@ -1088,9 +949,6 @@
 	ret
 
 Script_variablesprite:
-; script command 0x6d
-; parameters: byte, sprite
-
 	call GetScriptByte
 	ld e, a
 	ld d, $0
@@ -1101,9 +959,6 @@
 	ret
 
 Script_appear:
-; script command 0x6f
-; parameters: object_id
-
 	call GetScriptByte
 	call GetScriptObject
 	call _CopyObjectStruct
@@ -1113,9 +968,6 @@
 	ret
 
 Script_disappear:
-; script command 0x6e
-; parameters: object_id
-
 	call GetScriptByte
 	call GetScriptObject
 	cp LAST_TALKED
@@ -1150,9 +1002,6 @@
 	ret
 
 Script_follow:
-; script command 0x70
-; parameters: object2, object1
-
 	call GetScriptByte
 	call GetScriptObject
 	ld b, a
@@ -1163,15 +1012,10 @@
 	ret
 
 Script_stopfollow:
-; script command 0x71
-
 	farcall StopFollow
 	ret
 
 Script_moveobject:
-; script command 0x72
-; parameters: object id, x, y
-
 	call GetScriptByte
 	call GetScriptObject
 	ld b, a
@@ -1185,9 +1029,6 @@
 	ret
 
 Script_writeobjectxy:
-; script command 0x73
-; parameters: object_id
-
 	call GetScriptByte
 	call GetScriptObject
 	cp LAST_TALKED
@@ -1199,9 +1040,6 @@
 	ret
 
 Script_follownotexact:
-; script command 0x77
-; parameters: object2, object1
-
 	call GetScriptByte
 	call GetScriptObject
 	ld b, a
@@ -1212,9 +1050,6 @@
 	ret
 
 Script_loademote:
-; script command 0x74
-; parameters: bubble
-
 	call GetScriptByte
 	cp EMOTE_FROM_MEM
 	jr nz, .not_var_emote
@@ -1225,9 +1060,6 @@
 	ret
 
 Script_showemote:
-; script command 0x75
-; parameters: bubble, object_id, time
-
 	call GetScriptByte
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -1260,9 +1092,6 @@
 	step_end
 
 Script_earthquake:
-; script command 0x78
-; parameters: param
-
 	ld hl, EarthquakeMovement
 	ld de, wEarthquakeMovementDataBuffer
 	ld bc, EarthquakeMovement.End - EarthquakeMovement
@@ -1286,8 +1115,6 @@
 .End
 
 Script_loadpikachudata:
-; script command 0x5a
-
 	ld a, PIKACHU
 	ld [wTempWildMonSpecies], a
 	ld a, 5
@@ -1295,15 +1122,11 @@
 	ret
 
 Script_randomwildmon:
-; script command 0x5b
-
 	xor a
 	ld [wBattleScriptFlags], a
 	ret
 
 Script_loadtemptrainer:
-; script command 0x5c
-
 	ld a, (1 << 7) | 1
 	ld [wBattleScriptFlags], a
 	ld a, [wTempTrainerClass]
@@ -1313,9 +1136,6 @@
 	ret
 
 Script_loadwildmon:
-; script command 0x5d
-; parameters: pokemon, level
-
 	ld a, (1 << 7)
 	ld [wBattleScriptFlags], a
 	call GetScriptByte
@@ -1325,9 +1145,6 @@
 	ret
 
 Script_loadtrainer:
-; script command 0x5e
-; parameters: trainer_group, trainer_id
-
 	ld a, (1 << 7) | 1
 	ld [wBattleScriptFlags], a
 	call GetScriptByte
@@ -1337,8 +1154,6 @@
 	ret
 
 Script_startbattle:
-; script command 0x5f
-
 	call BufferScreen
 	predef StartBattle
 	ld a, [wBattleResult]
@@ -1347,9 +1162,6 @@
 	ret
 
 Script_catchtutorial:
-; script command 0x61
-; parameters: byte
-
 	call GetScriptByte
 	ld [wBattleType], a
 	call BufferScreen
@@ -1357,8 +1169,6 @@
 	jp Script_reloadmap
 
 Script_reloadmapafterbattle:
-; script command 0x60
-
 	ld hl, wBattleScriptFlags
 	ld d, [hl]
 	ld [hl], 0
@@ -1387,8 +1197,6 @@
 	jp Script_reloadmap
 
 Script_reloadmap:
-; script command 0x7b
-
 	xor a
 	ld [wBattleScriptFlags], a
 	ld a, MAPSETUP_RELOADMAP
@@ -1399,9 +1207,6 @@
 	ret
 
 Script_scall:
-; script command 0x0
-; parameters: pointer
-
 	ld a, [wScriptBank]
 	ld b, a
 	call GetScriptByte
@@ -1411,9 +1216,6 @@
 	jr ScriptCall
 
 Script_farscall:
-; script command 0x1
-; parameters: pointer
-
 	call GetScriptByte
 	ld b, a
 	call GetScriptByte
@@ -1423,9 +1225,6 @@
 	jr ScriptCall
 
 Script_memcall:
-; script command 0x2
-; parameters: pointer
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -1475,9 +1274,6 @@
 	jp ScriptCall
 
 Script_sjump:
-; script command 0x3
-; parameters: pointer
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -1487,9 +1283,6 @@
 	jp ScriptJump
 
 Script_farsjump:
-; script command 0x4
-; parameters: pointer
-
 	call GetScriptByte
 	ld b, a
 	call GetScriptByte
@@ -1499,9 +1292,6 @@
 	jp ScriptJump
 
 Script_memjump:
-; script command 0x5
-; parameters: pointer
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -1514,9 +1304,6 @@
 	jp ScriptJump
 
 Script_iffalse:
-; script command 0x8
-; parameters: pointer
-
 	ld a, [wScriptVar]
 	and a
 	jp nz, SkipTwoScriptBytes
@@ -1523,9 +1310,6 @@
 	jp Script_sjump
 
 Script_iftrue:
-; script command 0x9
-; parameters: pointer
-
 	ld a, [wScriptVar]
 	and a
 	jp nz, Script_sjump
@@ -1532,9 +1316,6 @@
 	jp SkipTwoScriptBytes
 
 Script_ifequal:
-; script command 0x6
-; parameters: byte, pointer
-
 	call GetScriptByte
 	ld hl, wScriptVar
 	cp [hl]
@@ -1542,9 +1323,6 @@
 	jr SkipTwoScriptBytes
 
 Script_ifnotequal:
-; script command 0x7
-; parameters: byte, pointer
-
 	call GetScriptByte
 	ld hl, wScriptVar
 	cp [hl]
@@ -1552,9 +1330,6 @@
 	jr SkipTwoScriptBytes
 
 Script_ifgreater:
-; script command 0xa
-; parameters: byte, pointer
-
 	ld a, [wScriptVar]
 	ld b, a
 	call GetScriptByte
@@ -1563,9 +1338,6 @@
 	jr SkipTwoScriptBytes
 
 Script_ifless:
-; script command 0xb
-; parameters: byte, pointer
-
 	call GetScriptByte
 	ld b, a
 	ld a, [wScriptVar]
@@ -1574,16 +1346,10 @@
 	jr SkipTwoScriptBytes
 
 Script_jumpstd:
-; script command 0xc
-; parameters: predefined_script
-
 	call StdScript
 	jr ScriptJump
 
 Script_callstd:
-; script command 0xd
-; parameters: predefined_script
-
 	call StdScript
 	ld d, h
 	ld e, l
@@ -1621,9 +1387,6 @@
 	ret
 
 Script_prioritysjump:
-; script command 0x8d
-; parameters: pointer
-
 	ld a, [wScriptBank]
 	ld [wPriorityScriptBank], a
 	call GetScriptByte
@@ -1635,8 +1398,6 @@
 	ret
 
 Script_checkscene:
-; script command 0x13
-
 	call CheckScenes
 	jr z, .no_scene
 	ld [wScriptVar], a
@@ -1648,9 +1409,6 @@
 	ret
 
 Script_checkmapscene:
-; script command 0x11
-; parameters: map_group, map_id
-
 	call GetScriptByte
 	ld b, a
 	call GetScriptByte
@@ -1669,9 +1427,6 @@
 	ret
 
 Script_setscene:
-; script command 0x14
-; parameters: scene_id
-
 	ld a, [wMapGroup]
 	ld b, a
 	ld a, [wMapNumber]
@@ -1679,9 +1434,6 @@
 	jr DoScene
 
 Script_setmapscene:
-; script command 0x12
-; parameters: map_group, map_id, scene_id
-
 	call GetScriptByte
 	ld b, a
 	call GetScriptByte
@@ -1697,9 +1449,6 @@
 	ret
 
 Script_readmem:
-; script command 0x19
-; parameters: address
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -1709,9 +1458,6 @@
 	ret
 
 Script_writemem:
-; script command 0x1a
-; parameters: address
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -1721,9 +1467,6 @@
 	ret
 
 Script_loadmem:
-; script command 0x1b
-; parameters: address, value
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -1733,17 +1476,11 @@
 	ret
 
 Script_setval:
-; script command 0x15
-; parameters: value
-
 	call GetScriptByte
 	ld [wScriptVar], a
 	ret
 
 Script_addval:
-; script command 0x16
-; parameters: value
-
 	call GetScriptByte
 	ld hl, wScriptVar
 	add [hl]
@@ -1751,9 +1488,6 @@
 	ret
 
 Script_random:
-; script command 0x17
-; parameters: input
-
 	call GetScriptByte
 	ld [wScriptVar], a
 	and a
@@ -1804,9 +1538,6 @@
 	ret
 
 Script_readvar:
-; script command 0x1c
-; parameters: variable_id
-
 	call GetScriptByte
 	call GetVarAction
 	ld a, [de]
@@ -1814,9 +1545,6 @@
 	ret
 
 Script_writevar:
-; script command 0x1d
-; parameters: variable_id
-
 	call GetScriptByte
 	call GetVarAction
 	ld a, [wScriptVar]
@@ -1824,9 +1552,6 @@
 	ret
 
 Script_loadvar:
-; script command 0x1e
-; parameters: variable_id, value
-
 	call GetScriptByte
 	call GetVarAction
 	call GetScriptByte
@@ -1839,8 +1564,6 @@
 	ret
 
 Script_checkver:
-; script command 0x18
-
 	ld a, [.gs_version]
 	ld [wScriptVar], a
 	ret
@@ -1849,9 +1572,6 @@
 	db GS_VERSION
 
 Script_getmonname:
-; script command 0x40
-; parameters: string_buffer, mon_id (0 aka USE_SCRIPT_VAR to use wScriptVar)
-
 	call GetScriptByte
 	and a
 	jr nz, .gotit
@@ -1876,9 +1596,6 @@
 	ret
 
 Script_getitemname:
-; script command 0x41
-; parameters: string_buffer, item_id (0 aka USE_SCRIPT_VAR to use wScriptVar)
-
 	call GetScriptByte
 	and a ; USE_SCRIPT_VAR
 	jr nz, .ok
@@ -1890,9 +1607,6 @@
 	jr GetStringBuffer
 
 Script_getcurlandmarkname:
-; script command 0x42
-; parameters: string_buffer
-
 	ld a, [wMapGroup]
 	ld b, a
 	ld a, [wMapNumber]
@@ -1906,16 +1620,10 @@
 	jp GetStringBuffer
 
 Script_getlandmarkname:
-; script command 0xa5
-; parameters: string_buffer, landmark_id
-
 	call GetScriptByte
 	jr ConvertLandmarkToText
 
 Script_gettrainername:
-; script command 0x43
-; parameters: string_buffer, trainer_group, trainer_id
-
 	call GetScriptByte
 	ld c, a
 	call GetScriptByte
@@ -1924,9 +1632,6 @@
 	jr GetStringBuffer
 
 Script_getname:
-; script command 0xa7
-; parameters: string_buffer, type, id
-
 	call GetScriptByte
 	ld [wNamedObjectTypeBuffer], a
 
@@ -1938,17 +1643,11 @@
 	jp GetStringBuffer
 
 Script_gettrainerclassname:
-; script command 0xa6
-; parameters: string_buffer, trainer_group
-
 	ld a, TRAINER_NAME
 	ld [wNamedObjectTypeBuffer], a
 	jr ContinueToGetName
 
 Script_getmoney:
-; script command 0x3d
-; parameters: string_buffer, account
-
 	call ResetStringBuffer1
 	call GetMoneyAccount
 	ld hl, wStringBuffer1
@@ -1958,9 +1657,6 @@
 	jp GetStringBuffer
 
 Script_getcoins:
-; script command 0x3e
-; parameters: string_buffer
-
 	call ResetStringBuffer1
 	ld hl, wStringBuffer1
 	ld de, wCoins
@@ -1970,9 +1666,6 @@
 	jp GetStringBuffer
 
 Script_getnum:
-; script command 0x3f
-; parameters: string_buffer
-
 	call ResetStringBuffer1
 	ld de, wScriptVar
 	ld hl, wStringBuffer1
@@ -1989,9 +1682,6 @@
 	ret
 
 Script_getstring:
-; script command 0x44
-; parameters: string_buffer, text_pointer
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2003,9 +1693,6 @@
 	jp GetStringBuffer
 
 Script_givepokemail:
-; script command 0x2f
-; parameters: pointer
-
 	call GetScriptByte
 	ld l, a
 	call GetScriptByte
@@ -2024,9 +1711,6 @@
 	ret
 
 Script_checkpokemail:
-; script command 0x30
-; parameters: pointer
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2037,9 +1721,6 @@
 	ret
 
 Script_giveitem:
-; script command 0x1f
-; parameters: item, quantity
-
 	call GetScriptByte
 	cp ITEM_FROM_MEM
 	jr nz, .ok
@@ -2060,9 +1741,6 @@
 	ret
 
 Script_takeitem:
-; script command 0x20
-; parameters: item, quantity
-
 	xor a
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -2079,9 +1757,6 @@
 	ret
 
 Script_checkitem:
-; script command 0x21
-; parameters: item
-
 	xor a
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -2094,9 +1769,6 @@
 	ret
 
 Script_givemoney:
-; script command 0x22
-; parameters: account, money
-
 	call GetMoneyAccount
 	call LoadMoneyAmountToMem
 	farcall GiveMoney
@@ -2103,9 +1775,6 @@
 	ret
 
 Script_takemoney:
-; script command 0x23
-; parameters: account, money
-
 	call GetMoneyAccount
 	call LoadMoneyAmountToMem
 	farcall TakeMoney
@@ -2112,9 +1781,6 @@
 	ret
 
 Script_checkmoney:
-; script command 0x24
-; parameters: account, money
-
 	call GetMoneyAccount
 	call LoadMoneyAmountToMem
 	farcall CompareMoney
@@ -2156,25 +1822,16 @@
 	ret
 
 Script_givecoins:
-; script command 0x25
-; parameters: coins
-
 	call LoadCoinAmountToMem
 	farcall GiveCoins
 	ret
 
 Script_takecoins:
-; script command 0x26
-; parameters: coins
-
 	call LoadCoinAmountToMem
 	farcall TakeCoins
 	ret
 
 Script_checkcoins:
-; script command 0x27
-; parameters: coins
-
 	call LoadCoinAmountToMem
 	farcall CheckCoins
 	jr CompareMoneyAction
@@ -2188,9 +1845,6 @@
 	ret
 
 Script_checktime:
-; script command 0x2b
-; parameters: time
-
 	xor a
 	ld [wScriptVar], a
 	farcall CheckTime
@@ -2202,9 +1856,6 @@
 	ret
 
 Script_checkpoke:
-; script command 0x2c
-; parameters: pokemon
-
 	xor a
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -2217,9 +1868,6 @@
 	ret
 
 Script_addcellnum:
-; script command 0x28
-; parameters: person
-
 	xor a
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -2231,9 +1879,6 @@
 	ret
 
 Script_delcellnum:
-; script command 0x29
-; parameters: person
-
 	xor a
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -2245,8 +1890,6 @@
 	ret
 
 Script_checkcellnum:
-; script command 0x2a
-; parameters: person
 ; returns false if the cell number is not in your phone
 
 	xor a
@@ -2260,9 +1903,6 @@
 	ret
 
 Script_specialphonecall:
-; script command 0x9c
-; parameters: call_id
-
 	call GetScriptByte
 	ld [wSpecialPhoneCallID], a
 	call GetScriptByte
@@ -2270,7 +1910,6 @@
 	ret
 
 Script_checkphonecall:
-; script command 0x9d
 ; returns false if no special phone call is stored
 
 	ld a, [wSpecialPhoneCallID]
@@ -2282,9 +1921,6 @@
 	ret
 
 Script_givepoke:
-; script command 0x2d
-; parameters: pokemon, level, item, trainer, trainer_name_pointer, pkmn_nickname
-
 	call GetScriptByte
 	ld [wCurPartySpecies], a
 	call GetScriptByte
@@ -2310,8 +1946,6 @@
 	ret
 
 Script_giveegg:
-; script command 0x2e
-; parameters: pokemon, level
 ; if no room in the party, return 0 in wScriptVar; else, return 2
 
 	xor a ; PARTYMON
@@ -2328,9 +1962,6 @@
 	ret
 
 Script_setevent:
-; script command 0x33
-; parameters: bit_number
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2340,9 +1971,6 @@
 	ret
 
 Script_clearevent:
-; script command 0x32
-; parameters: bit_number
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2352,9 +1980,6 @@
 	ret
 
 Script_checkevent:
-; script command 0x31
-; parameters: bit_number
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2370,9 +1995,6 @@
 	ret
 
 Script_setflag:
-; script command 0x36
-; parameters: bit_number
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2382,9 +2004,6 @@
 	ret
 
 Script_clearflag:
-; script command 0x35
-; parameters: bit_number
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2394,9 +2013,6 @@
 	ret
 
 Script_checkflag:
-; script command 0x34
-; parameters: bit_number
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2416,23 +2032,16 @@
 	ret
 
 Script_wildoff:
-; script command 0x38
-
 	ld hl, wStatusFlags
 	set STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
 	ret
 
 Script_wildon:
-; script command 0x37
-
 	ld hl, wStatusFlags
 	res STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
 	ret
 
 Script_xycompare:
-; script command 0x39
-; parameters: pointer
-
 	call GetScriptByte
 	ld [wXYComparePointer], a
 	call GetScriptByte
@@ -2440,9 +2049,6 @@
 	ret
 
 Script_warpfacing:
-; script command 0xa3
-; parameters: facing, map_group, map_id, x, y
-
 	call GetScriptByte
 	maskbits NUM_DIRECTIONS
 	ld c, a
@@ -2453,9 +2059,6 @@
 ; fallthrough
 
 Script_warp:
-; script command 0x3c
-; parameters: map_group, map_id, x, y
-
 ; This seems to be some sort of error handling case.
 	call GetScriptByte
 	and a
@@ -2490,9 +2093,6 @@
 	ret
 
 Script_warpmod:
-; script command 0x3a
-; parameters: warp_id, map_group, map_id
-
 	call GetScriptByte
 	ld [wBackupWarpNumber], a
 	call GetScriptByte
@@ -2502,9 +2102,6 @@
 	ret
 
 Script_blackoutmod:
-; script command 0x3b
-; parameters: map_group, map_id
-
 	call GetScriptByte
 	ld [wLastSpawnMapGroup], a
 	call GetScriptByte
@@ -2512,16 +2109,11 @@
 	ret
 
 Script_dontrestartmapmusic:
-; script command 0x83
-
 	ld a, TRUE
 	ld [wDontPlayMapMusicOnReload], a
 	ret
 
 Script_writecmdqueue:
-; script command 0x7d
-; parameters: queue_pointer
-
 	call GetScriptByte
 	ld e, a
 	call GetScriptByte
@@ -2532,9 +2124,6 @@
 	ret
 
 Script_delcmdqueue:
-; script command 0x7e
-; parameters: byte
-
 	xor a
 	ld [wScriptVar], a
 	call GetScriptByte
@@ -2546,9 +2135,6 @@
 	ret
 
 Script_changemapblocks:
-; script command 0x79
-; parameters: map_data_pointer
-
 	call GetScriptByte
 	ld [wMapBlocksBank], a
 	call GetScriptByte
@@ -2560,9 +2146,6 @@
 	ret
 
 Script_changeblock:
-; script command 0x7a
-; parameters: x, y, block
-
 	call GetScriptByte
 	add 4
 	ld d, a
@@ -2576,8 +2159,6 @@
 	ret
 
 Script_reloadmappart::
-; script command 0x7c
-
 	xor a
 	ldh [hBGMapMode], a
 	call OverworldTextModeSwitch
@@ -2587,8 +2168,6 @@
 	ret
 
 Script_warpcheck:
-; script command 0x8e
-
 	call WarpCheck
 	ret nc
 	farcall EnableEvents
@@ -2600,9 +2179,6 @@
 	ret
 
 Script_newloadmap:
-; script command 0x8a
-; parameters: which_method
-
 	call GetScriptByte
 	ldh [hMapEntryMethod], a
 	ld a, MAPSTATUS_ENTER
@@ -2611,29 +2187,19 @@
 	ret
 
 Script_reloadandreturn:
-; script command 0x92
-
 	call Script_newloadmap
 	jp Script_end
 
 Script_opentext:
-; script command 0x47
-
 	call OpenText
 	ret
 
 Script_refreshscreen:
-; script command 0x48
-; parameters: dummy
-
 	call RefreshScreen
 	call GetScriptByte
 	ret
 
 Script_writeunusedbytebuffer:
-; script command 0x4a
-; parameters: byte
-
 	call GetScriptByte
 	ld [wUnusedScriptByteBuffer], a
 	ret
@@ -2641,16 +2207,11 @@
 	db closetext_command ; unused
 
 Script_closetext:
-; script command 0x49
-
 	call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap
 	call CloseText
 	ret
 
 Script_autoinput:
-; script command 0x89
-; parameters: input_pointer
-
 	call GetScriptByte
 	push af
 	call GetScriptByte
@@ -2662,9 +2223,6 @@
 	ret
 
 Script_pause:
-; script command 0x8b
-; parameters: length
-
 	call GetScriptByte
 	and a
 	jr z, .loop
@@ -2678,9 +2236,6 @@
 	ret
 
 Script_deactivatefacing:
-; script command 0x8c
-; parameters: time
-
 	call GetScriptByte
 	and a
 	jr z, .no_time
@@ -2692,15 +2247,10 @@
 	ret
 
 Script_stopandsjump:
-; script command 0x8f
-; parameters: pointer
-
 	call StopScript
 	jp Script_sjump
 
 Script_end:
-; script command 0x91
-
 	call ExitScriptSubroutine
 	jr c, .resume
 	ret
@@ -2716,8 +2266,6 @@
 	ret
 
 Script_return:
-; script command 0x90
-
 	call ExitScriptSubroutine
 	jr c, .dummy
 .dummy
@@ -2757,8 +2305,6 @@
 	ret
 
 Script_endall:
-; script command 0x93
-
 	xor a
 	ld [wScriptStackSize], a
 	ld [wScriptRunning], a
@@ -2770,8 +2316,6 @@
 	ret
 
 Script_halloffame:
-; script command 0xa1
-
 	ld hl, wGameTimerPause
 	res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
 	farcall StubbedTrainerRankings_HallOfFame
@@ -2782,8 +2326,6 @@
 	jr ReturnFromCredits
 
 Script_credits:
-; script command 0xa2
-
 	farcall RedCredits
 ReturnFromCredits:
 	call Script_endall
@@ -2793,9 +2335,6 @@
 	ret
 
 Script_wait:
-; script command 0xa8
-; parameters: unknown
-
 	push bc
 	call GetScriptByte
 .loop
@@ -2809,8 +2348,6 @@
 	ret
 
 Script_checksave:
-; script command 0xa9
-
 	farcall CheckSave
 	ld a, c
 	ld [wScriptVar], a
--- a/engine/overworld/variables.asm
+++ b/engine/overworld/variables.asm
@@ -106,11 +106,11 @@
 
 .UnownCaught:
 ; Number of unique Unown caught.
-	call .count
+	call .count_unown
 	ld a, b
 	jp .loadstringbuffer2
 
-.count
+.count_unown
 	ld hl, wUnownDex
 	ld b, 0
 .loop