HWPFormat: Explain custom sprites and sounds
authorWuzzy
Fri, 17 Nov 2017 06:50:00 +0000
changeset 1139 8e932b5dcedd
parent 1138 b32441125bb8
child 1140 38d6a4e430b5
HWPFormat: Explain custom sprites and sounds
HWPFormat.wiki
--- a/HWPFormat.wiki	Fri Nov 17 06:39:40 2017 +0000
+++ b/HWPFormat.wiki	Fri Nov 17 06:50:00 2017 +0000
@@ -30,14 +30,19 @@
 
 HWP files reflect the content of the `Data/` directory of Hedgewars. Therefore, the structure of the HWP file must be as if it were inside the `Data/` directory of Hedgewars and using the same directory tree.
 
-HWP files will either add or replace a file. If there is no file with a identical name at the same sub-directory of `Data/`, then Hedgewars will simply add that file, making it available for Hedgewars. This is the most commonly used form of HWPs, used to create add-ons, like new missions, flag packs, themes, etc.  If there is already a file with such a name there, Hedgewars will prefer the file in the HWP and ignore the other one. This has to be done with care, some files are safe to replace while other files cannot be simply replaced, as this will cause network games to fail. For example, if you have a HWP which replaces an object of a theme and you play that theme online, the online game will fail, unless your fellow players have the same HWP installed.
+HWP files will either add or replace a file. If there is no file with a identical name at the same sub-directory of `Data/`, then Hedgewars will simply add that file, making it available for Hedgewars. This is the most commonly used form of HWPs, used to create add-ons, like new missions, flag packs, themes, etc. If there is already a file with such a name there, Hedgewars will prefer the file in the HWP and ignore the other one. This has to be done with care, some files are safe to replace while other files cannot be simply replaced, as this will cause network games to fail. For example, if you have a HWP which replaces an object of a theme and you play that theme online, the online game will fail, unless your fellow players have the same HWP installed.
 
 It is a special case when you have multiple HWPs activated, when some of them try to include a file with identical name. This is a conflict, see the conflict section for more information about this.
 
+==== Custom sprites and sounds ====
+For Lua scripts you can add a few custom sounds and sprites without actually replacing any useful resources. For this, Hedgewars offers a total of 16 empty sprites and sounds which only exist so they can be added in a HWP.
+
+The custom sprites are named `Graphics/custom1.png` to `Graphics/custom8.png` and are accessed in Lua with `sprCustom1` to `sprCustom8`.
+
+The custom sounds are named `Sounds/custom1.ogg` to `Sounds/custom8.ogg` and are accessed in Lua with `sndCustom1` to `sndCustom8`.
+
 ==== Custom ammo icons ====
-Normally, all files in an HWP can overwrite/replace existing files found in `Data`.
-
-But in 0.9.23, there is an unique exception: `Graphics/AmmoMenu/Ammos.png` and `Graphics/AmmoMenu/Ammos_bw.png` will be overlayed over the original images `Graphics/AmmoMenu/Ammos_base.png` and `Graphics/AmmoMenu/Ammos_bw_base.png`, respectively. This is useful if you only need to replace a few certain ammo icons, and not the entire set of ammo icons. This is especially important to ensure forwards-compability of your sidecar HWPs for your scripts (see below).
+Overwriting ammo icons is a special case. If `Graphics/AmmoMenu/Ammos.png` or `Graphics/AmmoMenu/Ammos_bw.png` is found in the HWP, it will be overlayed over the original images `Graphics/AmmoMenu/Ammos_base.png` and `Graphics/AmmoMenu/Ammos_bw_base.png`, respectively. This is useful if you only need to replace a few certain ammo icons, and not the entire set of ammo icons. This is especially important to ensure forwards-compability of your sidecar HWPs for your scripts (see below).
 
 For example, if you want to replace the “Air Attack” icon with a crosshair icon, but leave everything else alone, just draw the cross hair icon on the correct position and make all other frames fully transparent.