HSP
From OHRRPGCE-Wiki
The .HSP lump is identical to the .HS file imported into an .RPG file, but with a different extension. (Hspeak saves its output as an .HS file, which is given the .HSP when imported.)
It is actually a lumped file itself, and is unlumped to PLAYING.TMP upon loading a game. See RPG format#Lump Format for details.
Contents |
[edit] HS
The lump of filename "HS" contains the header. It is always the first lump in the file so that its filename can also be used to identify an HS file.
[edit] Formal Specs
| Data | Meaning |
|---|---|
| STR (12) | Header text "HamsterSpeak" |
| INT | Compiler major version (currently 3) |
| STR (2) | Compiler minor version, eg "Gd" or "H ". This field is not added by versions earlier than 3H |
[edit] SCRIPTS.TXT
This lump is a plain text file and contains the name, id, and number of args of all scripts in the .HSP file. It is processed when a .HS file is imported via custom.exe to produce PLOTSCR.LST
For each script (in any order) this file contains, each on a new line
- The name of the script
- The decimal id number of the script
- The number of arguments of the script
- For each argument, a number is printed to a line
The list of numbers is nothing but garbage in old versions of HSpeak. Since HSpeak 2I, the numbers are the default arguments of the script, but you need to confirm HSpeak 2I or greater was used before considering using them (they are not used anywhere within the the current engine). 2I was the version that added the script argument number to HSZ lump headers, so you could check the length of the header of any HSZ lump.
walkherotox 32767 2 1 2
The text file ends on a newline.
[edit] SCRIPTS.BIN
Scripts.bin is a replacement for scripts.txt that contains similiar data in a 16-bit binary format, also holds trigger type info. It contains a header and a record for each script, which are in arbitrary order.
[edit] Header
| Offset | Data | Meaning |
|---|---|---|
| 0 | INT | Header size in bytes (currently 4) |
| 1 | INT | Record size in bytes (currently 42) |
The header size is read to determine whether the file format is supported; it'll be changed next time the file format changes (which will happen).
[edit] Record
| Offset | Data | Meaning |
|---|---|---|
| 0 | INT | Script ID number |
| 1 | INT | Script trigger type: 0 = 'script' 1 = 'plotscript' |
| 2-20 | FVSTR(1i+36b=19i) | Script name (lowercase, whitespace trimmed) |
[edit] COMMANDS.BIN
This lump commands the names of functions defined in define function blocks. It has three parts: header, offset table to find function records, and the function records.
[edit] Header
| Offset | Data | Meaning |
|---|---|---|
| 0 | INT | Header size in bytes (currently 6), ie position of the offset table |
| 1 | INT | File format version (currently 0) |
| 2 | INT | Number of records in Offset Table |
[edit] Offset Table
This is a simple array of 16-bit INTs, indexed by function id number, containing the absolute file position for the record for a function, or 0 if that function id wasn't declared. Always starts at id 0.
[edit] Function Record
| Offset | Data | Meaning |
|---|---|---|
| 0 | INT | Number of arguments, or -1 if variable |
| 1+ | VSTR(1i+b..) | Function name |
[edit] #.HSX or #.HSZ
Each script is separately compiled into a binary lump composed of a binary header followed by raw script data. The name of the file is the id number of the script with extension .hsx or .hsz, which are equivalent.
The format of this lump is documented at HSZ
ARCHINYM.LMP . BROWSE.TXT . ATTACK.BIN . BINSIZE.BIN . DEFPAL#.BIN . DEFPASS.BIN . FIXBITS.BIN . LOOKUP.BIN . MENUS.BIN . MENUITEM.BIN . PALETTES.BIN . PLOTSCR.LST . SFXDATA.BIN . SONGDATA.BIN . UICOLORS.BIN . GEN . BAM . Map Format . T . P . E . D . L . N . DOR . DOX . DT0 . DT1 . DT6 . EFS . FOR . FNT . HSP . HSZ . ITM . MAP . MAS . MN . MXS . PAL . PT0 . PT1 . PT2 . PT3 . PT4 . PT5 . PT6 . PT7 . PT8 . SAY . SHO . SNG . STF . STT . TAP . TIL . TMN . VEH