-
Notifications
You must be signed in to change notification settings - Fork 6
1.commands
The following document explains what every command in the game does.
- Time in these commands is always defined in terms of frames. The game assumes a frame is 1/30 of a second, i.e. 30 frames per second. Thus, to wait one second,
one would
WAIT
for 30 frames.
Parameters: None
Displays the "Main Topic -> Avoid" graphics.
Parameters: None
When used in the initial script section, starts execution to the first script block. Otherwise, makes the script return to whatever called it (e.g. the puzzle phase) or returns you to the investigation phase.
Parameters:
-
Background
: The background to be displayed
Displays a background image on the lower screen. The background image can only be of type TEX_BG
.
Subroutine address: 0x205602C
While this is listed as a separate command, it uses the same routine as BG_DISP
.
Parameters:
-
Background
: The CG background to be displayed -
Display from Bottom
: If true, displays the bottom of a tall background (TEX_CG_SINGLE
); if false, displays the top
BG_DISPCG
works as BG_DISP
but can display a larger variety of textures – namely, TEX_CG
, TEX_CG_DUAL_SCREEN
,
TEX_CG_WIDE
, and TEX_CG_SINGLE
BGs. Notably, these are all CGs as opposed to VN backgrounds. Before displaying a standard BG after calling BG_DISPC,
one should call BG_REVERT
.
Subroutine address: 0x20541E0
Parameters:
-
Background
: The background to display as withBG_DISP
-
Background (Temp/CG)
: The index of a background to display asBG_DISPCG
; specify instead ofBackground
-
Fade Time (Frames)
: The time to fade in in frames
Like the other BG display commands but crossfades the background rather than just displaying it.
Parameters: None
Reverts the background to the last call of BG_DISP
(i.e. undoes any BG_FADE
or BG_DISPCG
calls).
This is required before returning to displaying standard TEX_BG
BGs. Note that if reverting a TEX_CG_DUAL_SCREEN
BG, SET_PLACE
must have been used to set the place location and have it displayed.
BG_REVERT
does something odd to previously displayed CGs that makes attmpeting to display them again after the BG_REVERT
crash/freeze/soft lock the game.
If you need to go back and forth between the same CGs, consider using BG_FADE
.
Parameters:
-
Scroll Direction
: The direction to scroll the BG -
Scroll Speed
: Speed at which to scroll (1 is a good default)
When a background that is larger than the screen is shown (such as TEX_CG_DUAL_SCREEN
, TEX_CG_WIDE
, and TEX_CG_SINGLE
),
scrolls the background in a DEFINED direction.
Parameters:
-
Music
: The background music to start or stop playing -
Mode
: Whether to start or stop the music -
Volume
: The volume of the BGM (0 is silent, 100 is max) -
Fade In Time (Frames)
: Time in frames that the BGM will fade in -
Fade Out Time (Frames)
: Time in frames that the BGM will fade out
Plays or stops background music.
Parameters: None
Clears all chessboard annotations. Unused.
Parameters:
-
Chess File
: The chess file to load
Loads a chess file into memory and (if the chess overlay is loaded) places it on the chessboard.
Parameters:
-
White Space Begin
: The space where a white piece to move is -
White Space End
: The space where the white piece should move to -
Black Space Begin
: The space where a black piece to move is -
Black Space End
: The space where the black piece should move to
Moves a piece (or pieces) on the chessboard.
Parameters: None
Resets the chessboard to its original state.
Subroutine address: 0x20553F0
Parameters:
-
Cross Space 0-15
: The spaces to place/remove a cross on
Crosses out spaces on the chessboard with a red X. If a space is already crossed out, this command uncrosses it out.
-
vceIndex
: The index of the voice file to be played as defined inDS_SND.S
(dat 0x9A)
Subroutine address: 0x2052250
Parameters: None
Unknown, unused in the game.
Subroutine address: 0x205229C
Parameters:
-
dialogueIndex
: Dialogue line index -
spriteIndex
: Index of the character sprite to display, as defined inCHRDATA.S
(dat 0x008) -
spriteEntranceTransition
: Transition that makes the sprite enter -
spriteExitOrInternalTransition
: Transition that makes the sprite exit -
spriteShake
: Applies a shaking effect to the sprite -
voiceIndex
: Voiced line index -
textVoiceFont
: The voice font to be applied when no voiced line is used, defined as an index intoMESSINFO.S
(dat 0x076) -
textSpeed
: The speed at which the text is rendered, defined as an index intoMESSINFO.S
(dat 0x076) -
textEntranceEffect
: The effect to use as the text is printed to the screen -
spriteLayer
: Determines which "layer" a sprite should be rendered on on entrance; higher numbers are rendered on top of lower ones -
dontClearText
: If 1, continues displaying the next dialogue line in the same box -
noLipFlap
: Manually disables lip flaps for dialogue that would otherwise have them
Displays a line of dialogue and/or manipulates character sprites.
spriteEntranceTransition |
Transition |
---|---|
0x00 | No transition (sprite will be invisible if not already entered; otherwise acts as a hard cut) |
0x01 | Slide left to center |
0x02 | Slide right to center |
0x03 | Slide left to right |
0x04 | Slide right to left |
0x05 | Slide left to right (slow) |
0x06 | Slide right to left (slow) |
0x07 | Fade to center |
0x08 | Slide left to right (fast) |
0x09 | Slide right to left (fast) |
0x0A | Peek right to left |
0x0B | Fade in left |
spriteExitOrInternalTransition |
Type | Transition |
---|---|---|
0x00 | N/A | Sprite does not exit |
0x01 | Exit | Slide from center to right fade out |
0x02 | Exit | Slide from center to left fade out |
0x03 | Internal | Slide center to right and stay |
0x04 | Internal | Slide center to left and stay |
0x05 | Exit | Slide left to right fade out |
0x06 | Exit | Slide left to left fade out |
0x07 | Exit | Fade out from center |
0x08 | Exit | Fade out left |
0x09 | Internal | Slide left to right and stay |
0x0A | Internal | Slide right to left and stay |
spriteShake |
Effect |
---|---|
0x00 | No shake |
0x01 | Shake center |
0x02 | Bounce horizontal center |
0x03 | Bounce horizontal center with small shakes |
0x04 | Shake right |
0x05 | Shake left |
textEntranceEffect |
Effect |
---|---|
0x00 | Normal |
0x01 | Shrink in |
0x02 | Terminal typing |
Subroutine address: 0x2052CA8
Parameters:
-
kbgIndex
: The index of the "kinetic" background as defined inBGTBL.S
(dat.bin #003)
Displays a particular "kinetic" (my word) background on the top screen. Must be of type KINETIC_SCREEN
.
Subroutine address: 0x2052D90
Parameters:
-
dialogueIndex
: Dialogue line index
Draws a dialogue line as monologue over all other dialogue. Undone by completing a chess game.
Subroutine address: 0x2052E5C
Parameters:
-
timeToFade
: The length of the fade in frames -
fadeInToPercentage
: The percentage darkness to fade into (where 0 is fully bright and 100 is fully dark; e.g. 50 means the screen will be 50% darker than full brightness when the fade in is complete); only respected by color fades -
fadeLocation
: 0 is bottom screen, 1 is top screen, 2 is both screens -
fadeColor
: 1 is black, 2 is white, 0 is the color set by a previousSCREEN_FADEOUT
; this parameter must match that of the previousSCREEN_FADEOUT
call
Subroutine address: 0x2052F9C
Parameters:
-
timeToFade
: The length of the fade in frames -
fadeOutToPercentage
:The percentage darkness to fade into (where 0 is fully bright and 100 is fully dark; e.g. 50 means that the screen will be 50% brighter than full black when the fade is complete); only respected by color fades -
fadeColorRed
: Red component of the fade color (0-255) -
fadeColorGreen
: Green component of the fade color (0-255) -
fadeColorBlue
: Blue component of the fade color (0-255) -
fadeLocation
: 0 is bottom screen, 1 is top screen, 2 is both screens -
fadeColor
: 1 is black, 2 is white, 0 uses the RGB color set by thefadeColorRed
,Green
, andBlue
parameters of this command; this parameter must match that of the subsequentSCREEN_FADEIN
call
Subroutine address: 0x20530D8
Parameters:
-
fadeInTime
: Time for the fade in portion of the flash in frames -
holdTime
: Time to hold on the flash color in frames -
fadeOutTime
: Time for the fade out portion of the flash in frames -
flashColorRed
: Red component of the flash color -
flashColorGreen
: Green component of the flash color -
flashColorBlue
: Blue component of the flash color
Flashes the screen a specified color for a specified amount of time.
Subroutine address: 0x20531E0
Parameters:
-
soundIndex
: The index of the sound to be played fromsnd.bin
-
mode
: Either 6 or 7 – 6 = sound start, 7 = sound stop -
volume
: The volume of the sound -
crossfadeDupe
: Duplicate ofcrossfadeTime
below (only used once in the game) -
crossfadeTime
: Time in frames that the sound will crossfade; ony can be used when changing the volume of the same sound
Plays a sound from the SDAT snd.bin
.
Subroutine address: 0x00
Removed in final version of game (not referenced in any scripts.)
Subroutine address: 0x2053290
Parameters: None
Unused in the game, unknown what this does.
Plays a voice file.
Subroutine address: 0x2053490
Parameters:
-
flag
: The flag to set or clear -
set
: 1 = set, 0 = clear
Sets or clears a flag. Note that the value of the flag is for some reason one greater than its actual name (e.g. "F70" is accessed by FLAG 71
).
Subroutine address: 0x20534C8
Parameters:
-
topicId
: The ID of the topic to give the player as defined inTOPIC.S
(evt 0x245)
Give the player a particular topic.
Subroutine address: 0x2053554
Parameters:
-
show
: If 1, shows the dialogue box; if 0, hides the dialogue box.
Shows/hides the dialogue box. Note that plenty of other commands already do one of these (e.g., DIALOGUE
automatically shows the dialogue box).
Subroutine address: 0x2053580
Parameters:
-
option1
: The 1-indexed number of the first choice to be presented -
option2
: The 1-indexed number of the second choice to be presented -
option3
: The 1-indexed number of the third choice to be presented -
option4
: The 1-indexed number of the fourth choice to be presented -
unknown08
: -
unknown0A
: -
unknown0C
: -
unknown0E
:
Presents the player with a series of choices that branch the dialogue tree. Choices are defined in their own section and have IDs that correspond to labels set in the labels section. When a choice is chosen, this ID is used to select which script block will be jumped to.
SELECT
cannot be used in the initial, unnamed script block.
Subroutine address: 0x2053758
Parameters:
-
duration
: Effect duration in frames (if -1, shakes indefinitely) -
horizontalIntensity
: Intensity of the shake in the horizontal direction -
verticalIntensity
: Intensity of the shake in the vertical direction
Shakes the bottom screen.
Subroutine address: 0x2053818
Parameters: None
Stops screen shaking from a SCREEN_SHAKE
command.
Subroutine address: 0x2053884
Parameters:
-
blockId
: The ID of the script block to jump to as defined in the Labels section
Jumps to a particular code block.
Subroutine address: 0x205390C
Parameters:
-
conditionalIndex
: Index into the conditionals block that contains the name of the scene to go to
Goes to a particular scene whose name is defined in the conditionals. Note that this scene cannot be just any evt file in evt.bin; it must be contained within a special array in ARM9 itself; thus, ROM hacks may decide to change the location of this array.
Subroutine address: 0x20539D0
Parameters:
-
frames
: The number of frames to wait
Waits a particular number of frames.
Subroutine address: 0x2053A20
Parameters: None
Stops script execution until input is received from the player.
Subroutine address: 0x2053A68
Parameters: None.
Does nothing. (Named NOOP
to avoid conflict with ARM assembly NOP
.) This command always follows TRANS_OUT
.
Subroutine address: 0x2053A70
Parameters:
-
conditionalIndex
: The index of the conditional to check from the conditionals section unused
-
gotoId
: The ID of the script block to jump to
Goes to a specified script block if a specified conditional is true.
Subroutine address: 0x2053BC0
Parameters:
-
unused
: Does not seem to be used -
addValue
: The value to add to the Haruhi Meter (positive values move the meter toward Distracted while negative values move it toward Focused) -
setValue
: The value to set the Haruhi Meter at (does not show the meter)
Modifies the value of the Haruhi Meter. The meter maximum value is 9.
Subroutine address: 0x2053E3C
Parameters:
-
addValue
: The value to add to the Haruhi Meter
Adds to the Haruhi Meter without showing the Haruhi Meter UI. Unused in the game.
Subroutine address: 0x2053F7C
Parameters:
-
paletteMode
: An index that defines how to change the palette; valid values are 216-220 -
transitionTime
: The time in frames that the BG's palette will take to switch to transition to the effect palette -
unknownBool
: This clearly does things when looking at the assembly/decomp, but I don't know what it's doing precisely
paletteMode |
Effect |
---|---|
216 | Default colors |
217 | Inverted colors |
218 | Grayscale |
219 | Sepia |
220 | Dimmed |
Subroutine address: 0x2054714
Parameters:
-
index
: The index of the particular transition to use
Plays a transition to black. Typically followed by NOOP1
.
index |
Transition |
---|---|
0x00 | Wipe right |
0x01 | Wipe down |
0x02 | Wipe diagonal right/down |
0x03 | Blinds |
0x04 | Blinds |
0x05 | Wipe left |
0x06 | Wipe up |
0x07 | Wipe diagonal left/up |
Subroutine address: 0x20547AC
Paremters:
-
index
: The index of the particular transition to use.
Plays a transition from black into the scene.
index |
Transition |
---|---|
0x00 | Wipe right |
0x01 | Wipe down |
0x02 | Wipe diagonal right |
0x03 | Blinds |
0x04 | Blinds |
0x05 | Wipe left |
0x06 | Wipe up |
0x07 | Wipe diagonal left/up |
Subroutine address: 0x2054860
Parameters:
-
display
: 0 hides the location, 1 displays it -
placeIndex
: Place name graphic as an index intoPLACE.S
(dat 0x07A)
Modifies the displayed "place name."
Subroutine address: 0x2054938
Parameters:
-
itemIndex
: The index of the item to display x?
y?
Displays the specified item image. Under certain circumstances, this should work; however it seems this soft locks the game most of the time. Unused.
Subroutine address: 0x2054ABC
Parameters: None
Stops script execution and soft locks the game. Unused.
Parameters: None
Does nothing. Unused.
Subroutine address: 0x2054B14
Parameters:
-
mapFileIndex
: The index of the map in dat.bin
Loads an isometric map for usage by INVEST_START
. Automatically fades to screen to black.
Subroutine address: 0x2054B6C
Parameters:
unknown00
unknown01
unknown02
unknown03
-
endScriptBlock
: The script block that contains theINVEST_END
command.
Starts investigation mode. Automatically fades screen in from black.
Subroutine address: 0x2054BE0
Parameters: None
Ends investigation mode and returns to the main visual novel format of the game. Automatically fades screen to black.
Subroutine address: 0x2054C44
Parameters:
-
chibiIndex
: The index of the chibi to emote -
emoteIndex
: The index of the emote that should be shown
This command displays an emote in a speech bubble above a chibi figure on the top screen.
emoteIndex |
Emote |
---|---|
0x01 | Exclamation point (!) |
0x02 | Light bulb |
0x03 | Anger mark |
0x04 | Music note |
0x05 | Sweat drop |
Subroutine address: 0x2054C78
Parameters: None
Ends the scene and moves to the next one as listed in SCENARIO.S
(evt.bin #580).
Subroutine address: 0x2054CD4
Parameters:
-
scenesToSkip
: Number of scenes that should be skipped
Sets up the NEXT_SCENE
command to skip a specified number of scenes as defined in SCENARIO.S
(evt.bin #580).
Subroutine address: 0x2054D48
Parameters:
-
globalIndex
: The index of the global variable to modify (2-7) -
value
: The value to add to the global variable
Modifies one of six global variables. These variables persist across scenes.
Subroutine address: 0x2054D7C
Parameters:
-
chibiIndex
: Specifies the chibi to add (1 = Kyon, 2 = Haruhi, 3 = Mikuru, 4 = Nagato, 5 = Koizumi) -
mode
: Specifies whether the chibi should enter or leave (0 = enter, 1 = leave) -
delay
: Specifies the number of frames after which the chibi should enter or exit
Specifies a chibi figure to enter or exit the top screen.
Subroutine address: 0x2054FA8
Parameters:
-
value
: The value to set variableglobal2D
to
Sets a global variable to a specified value. Only used in one place so it's difficult to determine what it affects.
Loads a chess file into memory and (if the chess overlay is loaded) places it on the chessboard.
Subroutine address: 0x2055034
Parameters:
-
clearBlock
: Script block to go to if the chess game is cleared -
missBlock
: Script block to go to if the chess game is failed -
miss2Block
: Script block to go to if the chess game is failed in some unused way
Monitors for the end of the chess game and then jumps to a specified script block depending on the outcome.
Subroutine address: 0x20552BC
Parameters:
-
piece1
: A space containing a piece whose potential moves to highlight -
piece2
: A space containing a piece whose potential moves to highlight -
piece3
: A space containing a piece whose potential moves to highlight -
piece4
: A space containing a piece whose potential moves to highlight
Highlights the potential moves of a piece in red. If a piece has already been highlighted, this command unhighlights it.
Subroutine address: 0x2055340
Parameters:
- params
spacesToHighlight
: A list of spaces to highlight, terminated with a -1
Highlights spaces on the chessboard in yellow. If a space is already highlighted, this command unhighlights it.
Subroutine address: 0x20554F4
Parameters:
-
conditionalIndex
: Index into the conditionals block that contains the name of the scene to go to
Goes to a particular scene whose name is defined in the conditionals. Note that this scene cannot be just any evt file in evt.bin; it must be contained
within a special array in ARM9 itself; thus, ROM hacks may decide to change the location of this array. Unlike SCENE_GOTO
,
this command does not clear a flag before jumping. Otherwise, they seem to be identical.
Subroutine address: 0x20555DC
Parameters:
-
headerIndex
: The index of the title texture to use; corresponds to entry 0xD1 +headerIndex
inSYSTEX.S
(dat 0x9B), i.e. 1 = Episode 1, 2 = Episode 2, 3 = Episode 3, 4 = Episode 4, 5 = Episode 5, 6 = Epilogue (if you want to be really clever, -1 is the main menu title)
Sets the upper screen to be an episode title texture.
Subroutine address: 0x20556E8
Parameters: None
Does nothing. (Named NOOP
to avoid conflict with ARM assembly NOP
.)
Subroutine address: 0x2055700
Parameters:
-
on
: If 1, turns confetti. If 0, turns it off.
Displays falling confetti on the top screen.
Subroutine address: 0x2055D84
Parameters: None
Suppresses the top screen UI, disables dialogue skipping, and marks the center of the screen as the position the Kyon chibi walks to, and sends the Kyon chibi out. Used only in the opening text crawl.
Subroutine address: 0x2055E78
Parameters:
-
frames
: The number of frames to wait.
A command nearly identical to WAIT
, but allows for the wait to be canceled with a button press or screen tap.